@schibsted/advertory 2.44.0-test-art-4 → 2.44.5-art-v5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (155) hide show
  1. package/core/aftenposten/es/index.css +1 -0
  2. package/core/aftenposten/es/index.d.ts +699 -0
  3. package/core/aftenposten/es/index.js +1 -0
  4. package/core/aftenposten/es/package.json +9 -0
  5. package/core/aftenposten/index.d.ts +699 -0
  6. package/core/aftenposten/index.js +1 -0
  7. package/core/aftenposten/package.json +9 -0
  8. package/core/aftonbladet/es/index.css +1 -1
  9. package/core/aftonbladet/es/index.js +1 -1
  10. package/core/aftonbladet/index.js +1 -1
  11. package/core/aftonbladetv2/es/index.css +1 -0
  12. package/core/aftonbladetv2/es/index.d.ts +701 -0
  13. package/core/aftonbladetv2/es/index.js +1 -0
  14. package/core/aftonbladetv2/es/package.json +9 -0
  15. package/core/bt/es/index.css +1 -0
  16. package/core/bt/es/index.d.ts +699 -0
  17. package/core/bt/es/index.js +1 -0
  18. package/core/bt/es/package.json +9 -0
  19. package/core/bt/index.d.ts +699 -0
  20. package/core/bt/index.js +1 -0
  21. package/core/bt/package.json +9 -0
  22. package/core/e24/es/index.css +1 -1
  23. package/core/e24/es/index.js +1 -1
  24. package/core/e24/index.js +1 -1
  25. package/core/e24v2/es/index.css +1 -0
  26. package/core/e24v2/es/index.d.ts +699 -0
  27. package/core/e24v2/es/index.js +1 -0
  28. package/core/e24v2/es/package.json +9 -0
  29. package/core/godare/index.d.ts +699 -0
  30. package/core/godare/index.js +1 -0
  31. package/core/godare/package.json +9 -0
  32. package/core/godt/index.d.ts +701 -0
  33. package/core/godt/index.js +1 -0
  34. package/core/godt/package.json +9 -0
  35. package/core/klart/index.d.ts +701 -0
  36. package/core/klart/index.js +1 -0
  37. package/core/klart/package.json +9 -0
  38. package/core/kompakt/index.d.ts +699 -0
  39. package/core/kompakt/index.js +1 -0
  40. package/core/kompakt/package.json +9 -0
  41. package/core/minmote/index.d.ts +701 -0
  42. package/core/minmote/index.js +1 -0
  43. package/core/minmote/package.json +9 -0
  44. package/core/pent/index.d.ts +699 -0
  45. package/core/pent/index.js +1 -0
  46. package/core/pent/package.json +9 -0
  47. package/core/sa/es/index.css +1 -0
  48. package/core/sa/es/index.d.ts +699 -0
  49. package/core/sa/es/index.js +1 -0
  50. package/core/sa/es/package.json +9 -0
  51. package/core/sa/index.d.ts +699 -0
  52. package/core/sa/index.js +1 -0
  53. package/core/sa/package.json +9 -0
  54. package/core/svd/es/index.css +1 -0
  55. package/core/svd/es/index.d.ts +701 -0
  56. package/core/svd/es/index.js +1 -0
  57. package/core/svd/es/package.json +9 -0
  58. package/core/svd/index.d.ts +701 -0
  59. package/core/svd/index.js +1 -0
  60. package/core/svd/package.json +9 -0
  61. package/core/tek/index.d.ts +701 -0
  62. package/core/tek/index.js +1 -0
  63. package/core/tek/package.json +9 -0
  64. package/core/vg/es/index.css +1 -0
  65. package/core/vg/es/index.d.ts +699 -0
  66. package/core/vg/es/index.js +1 -0
  67. package/core/vg/es/package.json +9 -0
  68. package/core/vg/index.d.ts +699 -0
  69. package/core/vg/index.js +1 -0
  70. package/core/vg/package.json +9 -0
  71. package/core/vgv2/es/index.css +1 -0
  72. package/core/vgv2/es/index.d.ts +699 -0
  73. package/core/vgv2/es/index.js +1 -0
  74. package/core/vgv2/es/package.json +9 -0
  75. package/package.json +1 -1
  76. package/sites/aftenposten/es/index.css +1 -0
  77. package/sites/aftenposten/es/index.d.ts +29 -0
  78. package/sites/aftenposten/es/index.js +1 -0
  79. package/sites/aftenposten/es/package.json +9 -0
  80. package/sites/aftenposten/index.d.ts +29 -0
  81. package/sites/aftenposten/index.js +1 -0
  82. package/sites/aftenposten/package.json +9 -0
  83. package/sites/aftonbladet/es/index.css +1 -1
  84. package/sites/aftonbladetv2/es/index.css +1 -0
  85. package/sites/aftonbladetv2/es/index.d.ts +29 -0
  86. package/sites/aftonbladetv2/es/index.js +1 -0
  87. package/sites/aftonbladetv2/es/package.json +9 -0
  88. package/sites/bt/es/index.css +1 -0
  89. package/sites/bt/es/index.d.ts +29 -0
  90. package/sites/bt/es/index.js +1 -0
  91. package/sites/bt/es/package.json +9 -0
  92. package/sites/bt/index.d.ts +29 -0
  93. package/sites/bt/index.js +1 -0
  94. package/sites/bt/package.json +9 -0
  95. package/sites/e24/es/index.css +1 -1
  96. package/sites/e24v2/es/index.css +1 -0
  97. package/sites/e24v2/es/index.d.ts +33 -0
  98. package/sites/e24v2/es/index.js +1 -0
  99. package/sites/e24v2/es/package.json +9 -0
  100. package/sites/godare/index.d.ts +25 -0
  101. package/sites/godare/index.js +1 -0
  102. package/sites/godare/package.json +9 -0
  103. package/sites/klart/index.d.ts +25 -0
  104. package/sites/klart/index.js +1 -0
  105. package/sites/klart/package.json +9 -0
  106. package/sites/minmote/index.d.ts +19 -0
  107. package/sites/minmote/index.js +1 -0
  108. package/sites/minmote/package.json +9 -0
  109. package/sites/sa/es/index.css +1 -0
  110. package/sites/sa/es/index.d.ts +29 -0
  111. package/sites/sa/es/index.js +1 -0
  112. package/sites/sa/es/package.json +9 -0
  113. package/sites/sa/index.d.ts +29 -0
  114. package/sites/sa/index.js +1 -0
  115. package/sites/sa/package.json +9 -0
  116. package/sites/svd/es/index.css +1 -0
  117. package/sites/svd/es/index.d.ts +29 -0
  118. package/sites/svd/es/index.js +1 -0
  119. package/sites/svd/es/package.json +9 -0
  120. package/sites/svd/index.d.ts +29 -0
  121. package/sites/svd/index.js +1 -0
  122. package/sites/svd/package.json +9 -0
  123. package/sites/vg/es/index.css +1 -0
  124. package/sites/vg/es/index.d.ts +27 -0
  125. package/sites/vg/es/index.js +1 -0
  126. package/sites/vg/es/package.json +9 -0
  127. package/sites/vg/index.d.ts +27 -0
  128. package/sites/vg/index.js +1 -0
  129. package/sites/vg/package.json +9 -0
  130. package/sites/vgv2/es/index.css +1 -0
  131. package/sites/vgv2/es/index.d.ts +27 -0
  132. package/sites/vgv2/es/index.js +1 -0
  133. package/sites/vgv2/es/package.json +9 -0
  134. package/styles/aftenposten/index.js +3 -0
  135. package/styles/aftenposten/styles.css +1 -0
  136. package/styles/aftonbladetv2/index.js +3 -0
  137. package/styles/aftonbladetv2/styles.css +1 -0
  138. package/styles/bt/index.js +3 -0
  139. package/styles/bt/styles.css +1 -0
  140. package/styles/e24v2/index.js +3 -0
  141. package/styles/e24v2/styles.css +1 -0
  142. package/styles/godare/index.js +3 -0
  143. package/styles/godare/styles.css +1 -0
  144. package/styles/klart/index.js +3 -0
  145. package/styles/klart/styles.css +1 -0
  146. package/styles/kompakt/index.js +3 -0
  147. package/styles/kompakt/styles.css +1 -0
  148. package/styles/sa/index.js +3 -0
  149. package/styles/sa/styles.css +1 -0
  150. package/styles/svd/index.js +3 -0
  151. package/styles/svd/styles.css +1 -0
  152. package/styles/vg/index.js +3 -0
  153. package/styles/vg/styles.css +1 -0
  154. package/styles/vgv2/index.js +3 -0
  155. package/styles/vgv2/styles.css +1 -0
@@ -1 +1 @@
1
- import"react/jsx-runtime";function e(e,t,n,i){return new(n||(n=Promise))(function(r,o){function s(e){try{d(i.next(e))}catch(e){o(e)}}function a(e){try{d(i.throw(e))}catch(e){o(e)}}function d(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}d((i=i.apply(e,t||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;const t=(e,t)=>{const n="[Advertory LOG]: ";location.search.includes("ast_debug=true")&&(t?console.log(n,e,t):console.log(n,e))},n="cmp:loaded";let i,r=!1;const o=e=>{const o=!!(null==e?void 0:e.enabled),s=(null==e?void 0:e.timeout)||3e3,a=(d="bypass_tcf",new URLSearchParams(window.location.search).get(d));var d;return{initConsentManager:()=>new Promise((e,o)=>{if(t("Getting TCF consent manager..."),window._tcf_)return t("TCF consent manager is already available"),i=window._tcf_,void e(i);t("TCF consent manager is not available");const a=()=>{t("CMP loaded, resolving consent manager..."),d&&clearTimeout(d),window._tcf_?(i=window._tcf_,e(i)):o(new Error("CMP loaded but window._tcf_ is not defined"))},d=setTimeout(()=>{document.removeEventListener(n,a),r=!0,o(new Error("Timeout waiting for CMP to load"))},s);t("Listening for CMP loaded event..."),document.addEventListener(n,a,{once:!0})}),getConsentSync:()=>{if(((e,n)=>e?!!n&&(t("TCF bypass param detected, returning consent: true"),!0):(t("TCF is not enabled, returning consent: true"),!0))(o,a))return!0;if(r)return null;if(!i)throw new Error("[Advertory]: getConsentSync method was called before the tcfManager was available.");const e=i.getConsentedToAllSync();return t(`TCF consented to all is: ${e}`),i.getConsentedToAllSync()}}};function s(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var a,d;var l=s(function(){if(d)return a;d=1;var e=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var n=Object.prototype.toString.call(e);return"[object RegExp]"===n||"[object Date]"===n||function(e){return e.$$typeof===t}(e)}(e)},t="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function n(e,t){return!1!==t.clone&&t.isMergeableObject(e)?l((n=e,Array.isArray(n)?[]:{}),e,t):e;var n}function i(e,t,i){return e.concat(t).map(function(e){return n(e,i)})}function r(e){return Object.keys(e).concat(function(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter(function(t){return Object.propertyIsEnumerable.call(e,t)}):[]}(e))}function o(e,t){try{return t in e}catch(e){return!1}}function s(e,t,i){var s={};return i.isMergeableObject(e)&&r(e).forEach(function(t){s[t]=n(e[t],i)}),r(t).forEach(function(r){(function(e,t){return o(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))})(e,r)||(o(e,r)&&i.isMergeableObject(t[r])?s[r]=function(e,t){if(!t.customMerge)return l;var n=t.customMerge(e);return"function"==typeof n?n:l}(r,i)(e[r],t[r],i):s[r]=n(t[r],i))}),s}function l(t,r,o){(o=o||{}).arrayMerge=o.arrayMerge||i,o.isMergeableObject=o.isMergeableObject||e,o.cloneUnlessOtherwiseSpecified=n;var a=Array.isArray(r);return a===Array.isArray(t)?a?o.arrayMerge(t,r,o):s(t,r,o):n(r,o)}return l.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce(function(e,n){return l(e,n,t)},{})},a=l}());const c=["deviceType","pageType","placements","takeover","refreshConfig","editableConfiguration"],u={adRequested:()=>{},adAvailable:e=>{},adLoaded:e=>{},adNoBid:e=>{},adError:(e,t)=>{},adCollapse:()=>{},adRequestFailure:e=>{},adBadRequest:e=>{},adLoadedMediated:e=>{},adNoBidMediated:e=>{}},v=6;class p{set(e){this.config=e}modifyConfigProperties(e){if(!this.config)throw new Error("Config was accessed before it had been initialized.");const t={};for(const n of c){const i=e[n];void 0!==i&&(t[n]=i)}Object.assign(this.config,t),Object.prototype.hasOwnProperty.call(e,"pageOptions")&&void 0!==e.pageOptions&&(this.config.pageOptions=Object.assign(Object.assign({},this.config.pageOptions),e.pageOptions))}get(){if(!this.config)throw new Error("Config was accessed before it had been initialized.");return this.config}getHandlers(){if(!this.siteHandlers)throw new Error("Handlers were accessed before it had been initialized.");return this.siteHandlers}setHandlers(e){this.siteHandlers=l(p.DEFAULT_SITE_HANDLERS,e)}}p.DEFAULT_SITE_HANDLERS={siteEvents:u,initNativeAd:function(){}};const g=new p,h=g.modifyConfigProperties.bind(g);function m(e){const t=encodeURIComponent(e).replace(/[-.+*]/g,"\\$&"),n=new RegExp(`(?:(?:^|.*;)\\s*${t}\\s*\\=\\s*([^;]*).*$)|^.*$`);return decodeURIComponent(document.cookie.replace(n,"$1"))||null}const y={MOBILE:"mobile",TABLET:"tablet",DESKTOP:"desktop"},f=9826;class w{constructor(){this.getSupplyTypeKeywords=()=>{const{deviceType:e=y.DESKTOP,isMobileApp:t}=g.get();if(t){return{"aa-sch-supply_type":`app_${e===y.MOBILE?"phone":y.TABLET}`}}return{"aa-sch-supply_type":`web_${this.getPageOptionsFormatDevice(e)}`}}}prepare(t){return e(this,void 0,void 0,function*(){return Object.assign(Object.assign({},t),{keywords:Object.assign(Object.assign(Object.assign(Object.assign({},t.keywords),this.getSupplyTypeKeywords()),this.getFormattedExternalIdKeywords()),this.getHasContextKeywords(t.keywords)),user:{externalUid:this.getExternalUid(),dnt:this.isTrackingForbidden()}})})}getFormattedExternalIdKeywords(){const e=this.getExternalUid(),t=this.getUserId();return{"aa-sch-externalid_src":Number(!!e)+Number(!!t)}}getUserId(){return function(){const e=m("_pulse2data");return e?e.split(",")[2]:void 0}()}getExternalUid(){return function(){const{tcf:e}=g.get(),{getConsentSync:t}=o(e);if(!t())return;const n=m("_pulse2data");return n?n.split(",")[9]:void 0}()}isTrackingForbidden(){return(null===navigator||void 0===navigator?void 0:navigator.globalPrivacyControl)||"1"===(null===navigator||void 0===navigator?void 0:navigator.doNotTrack)||"DO_NOT_TRACK"===this.getExternalUid()}getMember(){const{pageOptions:{member:e},testMember:t=f}=g.get();return window.location.search.includes("inventory_test=true")?t:e}getCMPValue(e){return localStorage.getItem(`CMP:${e}`)?"0"===localStorage.getItem(`CMP:${e}`)?"0":"1":"0"}getPublisherKeywords(){const{publisher:e}=g.get();return{"aa-sch-publisher":`${e}`}}getAnalyticsConsentKeywords(){return{"aa-sch-cmp_analytics":this.getCMPValue("analytics")}}getAdvertisingConsentKeywords(){const{tcf:e}=g.get(),{getConsentSync:t}=o(e);return{"aa-sch-cmp_advertising":t()?"1":"0"}}getPageTypeKeywords(){const{pageType:e}=g.get();return{"aa-sch-page_type":e}}getCountryCodeKeywords(e){return{"aa-sch-country_code":e}}getInventoryTypeKeywords(){return{"aa-sch-inventory_type":"editorial"}}getHasContextKeywords(e){const t=e["aa-sch-context_keyword"];return{"aa-sch-has_context_keyword":Array.isArray(t)&&t.length?1:0}}getPageOptionsFormatDevice(e="desktop"){return"mobile"===e?"phone":e}getSponsorsKeywords(){var e;const{publisher:t,keywordsConfig:n}=g.get(),i=null===(e=null==n?void 0:n.sponsors)||void 0===e?void 0:e.split(":").map(e=>`${t}_${e}`);return i?{"no-sno-news-sponsors":i}:{}}}const b=new w;b.prepare.bind(b);const E=e=>e===y.DESKTOP,I=e=>e===y.MOBILE;function T(e=!1){var t,n;const i=null===(n=null===(t=window.navigator)||void 0===t?void 0:t.userAgent)||void 0===n?void 0:n.toLocaleLowerCase(),r=(()=>{const e=window.navigator.userAgent.toLowerCase(),t=[["win","windows"],["macintosh","macos"],["x11","linux"],["android","android"],["ipad","ios"],["iphone","ios"]].find(([t])=>e.includes(t));return t?t[1]:"unknown"})();return{OS:r,mobileOS:["ios","android"].includes(r)?r:"unknown",isHybridApp:i.includes("hermes"),appMode:e?"hybrid":"notinapp"}}class S extends w{constructor(){super(...arguments),this.getDeviceKeywords=()=>{const{deviceType:e=y.DESKTOP}=g.get();return{"se-generic-sitemode":this.getPageOptionsFormatDevice(e)}}}getScreenKeywords(){const e=function(){const e=window.innerWidth,t=window.innerHeight,n=document.documentElement.clientWidth,i=document.documentElement.clientHeight;return{width:e||n||0,height:t||i||0}}(),t={width:null!==(i=null===(n=window.screen)||void 0===n?void 0:n.width)&&void 0!==i?i:0,height:null!==(o=null===(r=window.screen)||void 0===r?void 0:r.height)&&void 0!==o?o:0};var n,i,r,o;return{"se-generic-viewportheight":e.height,"se-generic-viewportwidth":e.width,"se-generic-screenheight":t.height,"se-generic-screenwidth":t.width}}getExternalIdSrc(){const e=this.getExternalUid(),t=this.getUserId();return e?{"se-generic-externalid_src":Number(!!e)+Number(!!t)}:{"se-generic-externalid_src":0}}getAppTypeKeywords(){const{isMobileApp:e}=g.get(),{appMode:t,mobileOS:n}=T(e);return{"se-generic-appmode":t,"se-generic-mobileos":n}}getPublisherGroup(){return{"se-generic-publishergroup":"schibsted"}}}const A=864e5,C=(()=>{const e=e=>{const n=window.localStorage.getItem(e);if(!n)return null;try{return JSON.parse(n)}catch(e){return t("Error with parsing localStorage data"),null}},n=(e,t)=>{window.localStorage.setItem(e,JSON.stringify(t))};return{get:e,set:n,setWithTimestamp:(e,t,i=A)=>{const r={data:t,expirationTime:(new Date).getTime()+i};n(e,JSON.stringify(r))},getByTimestamp:(n,i=A)=>{const r=e(n);if(!r)return null;if(!i)return r;try{const{expirationTime:e,data:t}=JSON.parse(r);return(new Date).getTime()<=e?t:null}catch(e){return t("Error with parsing localStorage data"),null}}}})(),k={get:e=>{try{const t=sessionStorage.getItem(e);return t?JSON.parse(t):null}catch(e){return t(`sessionStorageClient.get: Error during getting data from sessionStorage: ${e}`),null}},set:(e,n)=>{try{sessionStorage.setItem(e,JSON.stringify(n))}catch(e){t(`sessionStorageClient.set: Error during saving data to sessionStorage: ${e}`)}},remove:e=>{try{sessionStorage.removeItem(e)}catch(e){t(`sessionStorageClient.remove: Error during remove data from sessionStorage: ${e}`)}}},P={NO:"no",SE:"se"},O="advertory:ppids-cache",$={[P.SE]:`SCH${P.SE.toUpperCase()}-EnvHash`,[P.NO]:`SCH${P.NO.toUpperCase()}-EnvHash`},L={[P.SE]:`SCH${P.SE.toUpperCase()}-UserHash`,[P.NO]:`SCH${P.NO.toUpperCase()}-UserHash`},x={[P.SE]:`sch${P.SE}-envhash-v3`,[P.NO]:`sch${P.NO}-envhash-v3`},N={[P.SE]:`sch${P.SE}-userhash-v3`,[P.NO]:`sch${P.NO}-userhash-v3`},j={[P.SE]:`'sch${P.SE}-iosid-v3'`,[P.NO]:`'sch${P.NO}-iosid-v3'`},_={[P.SE]:`sch${P.SE}-androidid-v3`,[P.NO]:`sch${P.NO}-androidid-v3`},D={[P.SE]:"sdrn:schibsted.com:user",[P.NO]:"sdrn:spid.no:user"},q=t=>e(void 0,void 0,void 0,function*(){const e=yield t.getEnvironmentId();if(!e)return null;return`sdrn:schibsted:environment:${e}`}),M=(t,n)=>e(void 0,void 0,void 0,function*(){const e=yield t.getUserId();if(!e)return null;return`${D[n]}:${e}`}),R=()=>e(void 0,void 0,void 0,function*(){return yield new Promise(e=>{if("undefined"!=typeof window)if(window.Identity)e(window.Identity);else{const t=()=>{e(window.Identity)};window.addEventListener("identity-initialized",t,{once:!0})}else e(void 0)})});class B{constructor(e){this.identity=e,this.getIdentityUser=this.getIdentityUser.bind(this),this.isUserLoggedIn=this.isUserLoggedIn.bind(this),this.onIdentityLogout=this.onIdentityLogout.bind(this)}getIdentityUser(){return e(this,void 0,void 0,function*(){var e;try{const t=yield null===(e=this.identity)||void 0===e?void 0:e.getUser();return null!=t?t:null}catch(e){return t("[Privacy Broker] User is not logged in."),null}})}isUserLoggedIn(){return e(this,void 0,void 0,function*(){var e,t;return null!==(t=yield null===(e=this.identity)||void 0===e?void 0:e.isLoggedIn())&&void 0!==t&&t})}onIdentityLogout(e){var t;null===(t=this.identity)||void 0===t||t.on("logout",e)}}const F="advertory-session",H=e=>{const{privacyBroker:{storageKeyPrefix:t=F}={}}=g.get();return t+"-"+e},U=()=>{const{privacyBroker:{storageKeyPrefix:e=F}={}}=g.get(),t=sessionStorage;for(const n in t)0===n.indexOf(e+"-")&&k.remove(n)},V={LOCAL:"https://user-permissions.privacy-dev.schibsted.io/privacy/v2",DEV:"https://user-permissions.privacy-dev.schibsted.io/privacy/v2",PRE:"https://user-permissions.privacy-pre.schibsted.io/privacy/v2",PRO:"https://user-permissions.privacy.schibsted.com/privacy/v2",PRO_NO:"https://user-permissions.privacy.schibsted.com/privacy/v2",PRO_FI:"https://user-permissions.privacy.schibsted.com/privacy/v2",PRO_DK:"https://user-permissions.privacy.schibsted.com/privacy/v2"},W={get:(t,n)=>e(void 0,void 0,void 0,function*(){const e=yield fetch(t,n);if(!e.ok)throw new Error(e.statusText);return yield e.json()}),post:(t,n,i)=>e(void 0,void 0,void 0,function*(){const e=JSON.stringify(i),r=yield fetch(t,{method:"POST",headers:n,body:e});if(!r.ok)throw new Error(r.statusText);return yield r.json()})},z=n=>e(void 0,[n],void 0,function*({endpoint:n,identityFacade:i,environment:r}){var o;U();const s=yield(t=>e(void 0,void 0,void 0,function*(){const e=new Headers;e.set("Content-Type","application/json");const n=yield t.getIdentityUser();return n&&e.set("Authorization",`SPIDSIG ${n.sig}`),e}))(i);try{const e=null!==(o=V[r])&&void 0!==o?o:V.PRO;return yield W.get(`${e}${n}`,{headers:s})}catch(e){return t("[PrivacyBroker] Failed to fetch permissions",e),null}}),K=()=>e(void 0,void 0,void 0,function*(){var n,i;const{privacyBroker:{enabled:r,clientId:o}={},tracker:{instance:s}={},country:a}=g.get(),d=yield R(),l=new B(d);if(!(r&&d&&s&&o))return t("[Privacy Broker]: Data not present",{enabled:r,identity:d,trackerInstance:s}),null;const c=yield l.isUserLoggedIn();l.onIdentityLogout(()=>{t("[Privacy Broker]: clearPermissions"),U()});const u=null!==(n=yield M(s,a))&&void 0!==n?n:"",v=null!==(i=yield q(s))&&void 0!==i?i:"",p=c?u:v,h=yield((t,n,i)=>e(void 0,void 0,void 0,function*(){const e=`/schacc/${n}/user/${i}/permissions`,r=`/anonymous/${n}/user/${i}/permissions`;return(yield t.getIdentityUser())?e:r}))(l,o,p),m=(e=>!!k.get(H(e)))(p),y=H(p);if(m){t("[Privacy Broker]: SessionStorage cached",{key:y,permissions:sessionStorage.getItem(y)});return k.get(y)}const f=yield(t=>e(void 0,[t],void 0,function*({endpoint:e,timeout:t,identityFacade:n,environment:i}){return yield Promise.race([z({endpoint:e,environment:i,identityFacade:n}),new Promise(e=>setTimeout(()=>e(null),t))])}))({endpoint:h,timeout:500,identityFacade:l,environment:d.env});return f?(b=p,(null==(w=f)?void 0:w.permissions)&&k.set(H(b),w.permissions),f):(t("[Privacy Broker]: Permissions not found",{permissions:f,isLoggedIn:c,identifiedId:p,country:a}),null);var w,b}),G="glimrTags",J=["glwe_","glwet_"],Y={geofenceTags:[],geoTags:[],weatherTags:[]},Q=()=>e(void 0,void 0,void 0,function*(){const{privacyBroker:n,tcf:i}=g.get(),{getConsentSync:r}=o(i),s=r();if(null==n?void 0:n.enabled){const n=(e=>{const n=null==e?void 0:e.find(e=>e.purpose.includes("targeted_advertising"));if(t("targeted_advertising permissions",n),!(null==n?void 0:n.data)||!Array.isArray(null==n?void 0:n.data))return!1;const i=null==n?void 0:n.data.find(e=>e.includes("geolocation"));return t("geolocation permission",i),!!i})(yield e(void 0,void 0,void 0,function*(){var e,n;const{country:i,tracker:{instance:r}={}}=g.get(),o=yield R();if(!r||!o)return t("[Privacy Broker] No tracker found."),null;const s=new B(o),a=yield s.isUserLoggedIn(),d=null!==(e=yield M(r,i))&&void 0!==e?e:"",l=null!==(n=yield q(r))&&void 0!==n?n:"",c=H(a?d:l);return k.get(c)||null}));return n}return!!s}),X=()=>e(void 0,void 0,void 0,function*(){const{glimr:n}=g.get();if(!(yield Q())||!(null==n?void 0:n.enabled))return void t("No consent for glimr data fetching.");const i=yield(r=500,e(void 0,void 0,void 0,function*(){return yield Promise.race([e(void 0,void 0,void 0,function*(){const e=yield import("glimr-sdk");return e.default||e}),new Promise(e=>setTimeout(()=>e(!1),r))])}));var r;if(i)try{i.setTagCacheTimeInSeconds(300),yield new Promise(e=>{i.getTags(n.clientId,(t,n)=>{C.setWithTimestamp(G,{tags:t,tagMappings:n}),e(!0)})})}catch(e){t(`Error during getting glimr data: ${e}`)}else t("Timeout (500ms) while loading glimr package. Skipping glimr data fetching.",{glimr:i})}),Z=()=>{const{country:e}=g.get();return e===P.NO?"no-sno":"se-generic"},ee=()=>{const{country:e,publisher:t}=g.get();return`${e}-${t}`},te={svd:"svd",vg:"vg",godare:"godare",aftenposten:"no-aftenposten",sa:"no-stavangeraftenblad",bt:"no-bergenstidende",aftonbladet:"aftonbladet",e24:"e24",minmote:"minmote",pent:"pent",godt:"godt",tek:"no-tek"},ne=e=>J.some(t=>e.startsWith(t)),ie=e=>e.startsWith("glgc_"),re=e=>!ne(e)&&!ie(e),oe=e=>{const t=se();if(!t)return Y;const n=((e=[])=>e.filter(ne))(t),i=((e=[])=>e.filter(ie))(t),r=((e=[],t)=>{const n=e.filter(re);if(t){const{publisher:e}=g.get(),t=te[e]||e;n.push(t)}return n})(t,e);return{geoTags:r,geofenceTags:i,weatherTags:n}},se=()=>{const e=C.getByTimestamp(G);return e&&"string"!=typeof e?null==e?void 0:e.tags:null};class ae{constructor(){this.eids=[]}add(e,t){return e&&this.eids.push({id:e,source:t}),this}buildRyEids(){return this.eids.map(({id:e,source:t})=>({source:t,uids:[{id:e,atype:1,ext:{stype:"ppuid"}}]}))}buildEids(){return[...this.eids]}buildVideoEids(){return this.eids.map(({id:e,source:t})=>`${t},${e}`).join("|")}buildNorstatPath(){const e=this.eids[0];return e?`${e.source}-${e.id}`:""}buildNorstatQuery(e){const t=new URLSearchParams;return this.eids.slice(1).forEach(({id:n,source:i})=>{t.append(e,`${i}-${n}`)}),t}}const de=new class{constructor(){this.ppid1=null,this.ppid2=null}processPPIDs(t){return e(this,arguments,void 0,function*(e,t=1e4){var n,i;const r=yield Promise.race([new Promise(e=>{setTimeout(()=>e({xandr:{ppId1:"",ppId2:""}}),t)}),e.instance.getAdvertisingIdentifiers()]);this.setPPIDs(null===(n=r.xandr)||void 0===n?void 0:n.ppId1,null===(i=r.xandr)||void 0===i?void 0:i.ppId2)})}getPPIDs(){var e,n;return null!==this.ppid1&&null!==this.ppid2||t("PPIDv2s accessed before they have been initialized"),{ppid1:null!==(e=this.ppid1)&&void 0!==e?e:"",ppid2:null!==(n=this.ppid2)&&void 0!==n?n:""}}setPPIDs(e,t){this.ppid1=null!=e?e:"",this.ppid2=null!=t?t:""}},le=new class{constructor(){this.ppid1=null,this.ppid2=null,this.idfv=null,this.anId=null}processPPIDs(t,n){return e(this,void 0,void 0,function*(){var e,i,r,o,s,a,d,l,c,u;const v=C.get(O),p=yield this.getNewPPIDs(t,n);if(this.shouldHash(v,p)){const t=this.createHasherPayload(p),n=yield this.hashPPIDs(t);return n?(this.cachePPIDs(t,n,null===(e=p.idfv)||void 0===e?void 0:e.plain,null===(i=p.anId)||void 0===i?void 0:i.plain),void this.setPPIDs(null!==(r=n.userId)&&void 0!==r?r:"",null!==(o=n.environmentId)&&void 0!==o?o:"",null===(s=p.idfv)||void 0===s?void 0:s.plain,null===(a=p.anId)||void 0===a?void 0:a.plain)):void this.setPPIDs("","")}this.setPPIDs(null!==(d=null==v?void 0:v.userId.hashed)&&void 0!==d?d:"",null!==(l=null==v?void 0:v.environmentId.hashed)&&void 0!==l?l:"",null===(c=null==p?void 0:p.idfv)||void 0===c?void 0:c.plain,null===(u=null==p?void 0:p.anId)||void 0===u?void 0:u.plain)})}getPPIDs(){var e,n;return null!==this.ppid1&&null!==this.ppid2||t("PPIDv3s accessed before they have been initialized"),{ppid1:null!==(e=this.ppid1)&&void 0!==e?e:"",ppid2:null!==(n=this.ppid2)&&void 0!==n?n:"",idfv:this.idfv,anId:this.anId}}setPPIDs(e,t,n,i){this.ppid1=null!=e?e:"",this.ppid2=null!=t?t:"",this.idfv=null!=n?n:null,this.anId=null!=i?i:null}shouldHash(e,t){var n,i;if(!e)return!0;for(const r in e){if((null===(n=e[r])||void 0===n?void 0:n.plain)!==(null===(i=t[r])||void 0===i?void 0:i.plain))return!0}return!1}cachePPIDs(e,t,n,i){const r=Object.assign(Object.assign({clientId:{plain:e.clientId},userId:{plain:e.userId,hashed:t.userId},environmentId:{plain:e.environmentId,hashed:t.environmentId},trackerType:{plain:e.trackerType},trackerVersion:{plain:e.trackerVersion}},n?{idfv:{plain:n}}:{}),i?{anId:{plain:i}}:{});C.set(O,r)}hashPPIDs(n){return e(this,void 0,void 0,function*(){try{const e=new Headers({"Content-Type":"application/json"});return yield W.post("https://hasher.schibsted.com/api/v1/hash",e,n)}catch(e){return t("Error with hashing PPIDs",e),null}})}getNewPPIDs(t,n){return e(this,arguments,void 0,function*({clientId:e,instance:t},n){const i=yield M(t,n),r=yield q(t),o=window.advertory_idfv,s=window.advertory_anId;return Object.assign(Object.assign({clientId:{plain:e},userId:{plain:i},environmentId:{plain:r},trackerType:{plain:"Advertory"},trackerVersion:{plain:"1.0.0"}},o?{idfv:{plain:o}}:{}),s?{anId:{plain:s}}:{})})}createHasherPayload({clientId:e,trackerType:t,trackerVersion:n,userId:i,environmentId:r}){return{clientId:e.plain,trackerType:t.plain,trackerVersion:n.plain,userId:i.plain,environmentId:r.plain}}},ce=e=>{const{ppid1:t,ppid2:n}=de.getPPIDs(),{ppid1:i,ppid2:r,idfv:o,anId:s}=le.getPPIDs();return{userIds:[{type:"extendedIDs",eids:(new ae).add(n,$[e]).add(t,L[e]).add(r,x[e]).add(i,N[e]).add(o,j[e]).add(s,_[e]).buildEids()}]}},ue=e=>{const{ppid1:t,ppid2:n}=de.getPPIDs(),{ppid1:i,ppid2:r,idfv:o,anId:s}=le.getPPIDs();if(!n)return{};return{userSync:{userIds:[{name:"pubProvidedId",params:{eids:(new ae).add(n,$[e]).add(t,L[e]).add(r,x[e]).add(i,N[e]).add(o,j[e]).add(s,_[e]).buildRyEids()}}]}}},ve=t=>e(void 0,void 0,void 0,function*(){const{ppid1:e,ppid2:n}=de.getPPIDs(),{ppid1:i,ppid2:r}=le.getPPIDs(),o=(new ae).add(n,$[t]).add(e,L[t]).add(r,x[t]).add(i,N[t]);return yield new Promise(e=>{e(o.buildVideoEids())})});const pe=new class extends S{constructor(){super(...arguments),this.getHasPlusMembership=()=>({"se-generic-has_plus":"plus"===m("X-AB-Site-Version")?"yes":"no"})}prepare(n){return e(this,void 0,void 0,function*(){const i=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({"aa-sch-country_code":P.SE},this.getPublisherKeywords()),this.getSupplyTypeKeywords()),this.getAppTypeKeywords()),this.getDeviceKeywords()),this.getScreenKeywords()),this.getAdvertisingConsentKeywords()),this.getAnalyticsConsentKeywords()),this.getExternalIdSrc()),this.getHasContextKeywords(n.keywords)),yield e(void 0,void 0,void 0,function*(){const{glimr:e}=g.get(),{addPublisherToGeo:n}={},i=yield Q();if(!(null==e?void 0:e.enabled)||!i)return t("No consent for getting glimr tags."),{};const r=Z(),o=oe(n);return{[`${r}-geo`]:o.geoTags,[`${r}-weather`]:o.weatherTags,[`${r}-geofence`]:o.geofenceTags}})),(()=>{const{ppid1:e,ppid2:t}=de.getPPIDs();return{"aa-sch-schuserhash":e?"1":"0","aa-sch-schenvhash":t?"1":"0"}})()),this.getHasPlusMembership()),n.keywords);return Object.assign(Object.assign({},n),{keywords:i,user:Object.assign(Object.assign({},ce(P.SE)),{externalUid:this.getExternalUid()}),member:this.getMember()})})}};var ge=pe.prepare.bind(pe);const he="ABSOLUTE_FULLSCREEN",me="ANY_FULLSCREEN",ye="VERTICAL_FULLWIDTH",fe="FULLWIDTH",we="TAKEOVER",be="WALLPAPER",Ee="COLLAPSE",Ie={ANY_FULLSCREEN:[{width:6,height:6},{width:1920,height:1080},{width:3,height:3}],ABSOLUTE_FULLSCREEN:[{width:6,height:6}],VERTICAL_FULLWIDTH:[{width:1080,height:1920}],FIXED_FULLSCREEN:[{width:1920,height:1080},{width:3,height:3}],FULLWIDTH:[{width:5},{width:400,height:400}],NATIVE_AD:[{width:1,height:1}],TAKEOVER:[{width:4,height:4}],WALLPAPER:[{width:2,height:2}],COLLAPSE:[{width:2,height:1}]},Te={wallpaper:1600,"l-format":1600},Se=e=>{const{banner:t,targetId:n}=e;return!(!t||(null==n?void 0:n.includes("takeover")))&&Re(e,me)},Ae=e=>{const{native:t}=e;return!!t},Ce=e=>Re(e,fe),ke=e=>{const{targetId:t}=e;return t.includes("takeover")||Re(e,we)},Pe=e=>Re(e,we),Oe=e=>Re(e,be),$e=e=>Re(e,Ee),Le=e=>e.targetId.includes("sponsorstripe"),xe=e=>{const t=document.querySelector(`#${e}`);return!!t&&"true"===t.dataset.isFinnBlinkPlacement},Ne=e=>e.targetId.startsWith("panorama")||e.targetId.startsWith("modul"),je=e=>e.targetId.startsWith("midboard"),_e=e=>e.targetId.startsWith("widescreen"),De=e=>e.width>=1260&&e.width<=1280,qe=e=>e.width>=1600&&e.width<=1620,Me=e=>{var t,n;return"string"==typeof(null===(t=e.native)||void 0===t?void 0:t.desc2)&&(null===(n=e.native)||void 0===n?void 0:n.desc2.endsWith("_alcohol"))},Re=(e,t)=>{const n=Ie[t];if(!n)return!1;return!!n.find(t=>{var n,i;const r=(null===(n=e.banner)||void 0===n?void 0:n.width)||e.width,o=(null===(i=e.banner)||void 0===i?void 0:i.height)||e.height,s=t.width===r,a=!t.height||t.height===o;return s&&a})},Be="0123456789abcdefghijklmnopqrstuvwxyz",Fe=()=>Promise.resolve(),He=()=>{},Ue=e=>{window.apntag.anq.push(e)},Ve=new Promise(e=>{"undefined"!=typeof document&&document.prerendering?document.addEventListener("prerenderingchange",()=>e()):e()}),We=new Promise(e=>{if("undefined"==typeof document||!document.hidden)return void e();const t=()=>{document.hidden||(document.removeEventListener("visibilitychange",t),e())};document.addEventListener("visibilitychange",t,{once:!0})}),ze=e=>{const t=e.split("-"),n=t[t.length-1];return 6===n.length&&n.match(/^[a-zA-Z0-9]+$/)?t.slice(0,-1).join("-"):e};let Ke="";const Ge=new Map,Je="advertory-wallpaper-background",Ye=()=>{const e=document.querySelector(`.${Je}`);e&&e.remove()},Qe=/^wallpaper:url:(http[s]?:\/\/)?[^\s(["<,>]*\.[^\s[",><]*/,Xe=e=>{if(window.location.href.includes("collapse_ad=0"))return;const t=document.querySelector(`div[id^="${e}"]`);if(!t)return;const n=t.parentElement;n&&(t.style.setProperty("width","0","important"),t.style.setProperty("height","0","important"),t.style.setProperty("display","none","important"),n.style.setProperty("display","none","important"),e.includes("wallpaper")&&Ye())},Ze=e=>{const t=document.querySelector(`div[id^="${e}"]`);if(!t)return;const n=t.parentElement;n&&(t.style.removeProperty("width"),t.style.removeProperty("height"),t.style.removeProperty("display"),n.style.removeProperty("display"))};class et{initialize(){this.DATA=Object.assign({},et.INITIAL_DATA)}getData(e){if(!this.DATA)throw new Error("Storage was accessed with invalid data.");return this.DATA[e]}setData(e,t){if(!this.DATA)throw new Error("Storage was accessed before it had been initialized.");this.DATA[e]=Object.assign(Object.assign({},this.DATA[e]),t)}}et.INITIAL_DATA={wallpaper:{isAvailable:!1},horseshoe:{isAvailable:!1},initialClassNames:{},alertoryConfigKeywords:{}};const tt=new et,nt=e=>{var t;const n=null===(t=document.querySelector(`#${e}`))||void 0===t?void 0:t.parentElement,i=(null==n?void 0:n.offsetHeight)||0;n&&(n.style.minHeight=`${i}px`)},it=e=>{const t=e.parentElement;if(!e||!t)return;const{container:n,wrapper:i}=(e=>{const t=tt.getData("initialClassNames")[e.id];return{wrapper:(null==t?void 0:t.wrapper)?t.wrapper.join(" "):"",container:(null==t?void 0:t.container)?t.container.join(" "):""}})(e);e.className=n,t.className=i},rt=()=>{Ye();document.querySelectorAll('[data-advertory-ad-rendered="true"]').forEach(e=>{Xe(e.id),it(e),(e=>{const t=document.querySelector(`#${e}`),n=null==t?void 0:t.getAttribute("data-probable-height"),i=null==t?void 0:t.getAttribute("data-probable-width");n&&i&&(null==t||t.style.setProperty("min-height",n+"px"),null==t||t.style.setProperty("min-probable-width",i+"px"))})(e.id),e.innerHTML="",e.id=ze(e.id)}),Ue(()=>window.apntag.clearRequest())},ot="noGroupedPlacements",st=e=>{const t=e.replace(/[0-9]/g,"");return"_"===t.slice(-1)?t.substring(0,t.length-1):t},at=e=>{if(!(null==e?void 0:e.minViewWidth))return!0;return window.innerWidth>=e.minViewWidth},dt=e=>{var t;if(!(null===(t=null===window||void 0===window?void 0:window.advertory)||void 0===t?void 0:t.initialized))return[];const{placements:n,queryConfig:i,deviceType:r}=g.get(),o=n[r].filter(at)||[],s=e?document.querySelector(e):document;if(!s)return[];const a=o.reduce((e,t)=>{const n=st(t.id);return!n||e.includes(n)||e.push(n),e},[]).flatMap(e=>{const t=new RegExp(`^${e}(_(\\d+))?$`),n=o.filter(({id:e})=>e.match(t)),a=(null==i?void 0:i.queryByDataDevice)?`div[id^="${e}"][data-device=${r}], div[id^="${e}"][data-device=all]`:`div[id^="${e}"]:not([data-disabled="true"])`,d=s.querySelectorAll(a),l=Array.from(d).filter(({id:e})=>e.match(t)).map((e,t)=>{const i=lt(e,t,n),r=`${e.id}-${((e=6)=>{if(e<=0)return"";let t="";for(let n=0;n<e;n++)t+=Be[Math.floor(36*Math.random())];return t})(6)}`;return e.id=r,e.setAttribute("data-advertory-ad-rendered","true"),i.finnBlink&&!i.finnBlink.renderOnlyWithAdBlock&&e.setAttribute("data-is-finn-blink-placement","true"),(e=>{var t;const n=e.id;n&&tt.setData("initialClassNames",{[n]:{wrapper:null===(t=e.parentElement)||void 0===t?void 0:t.className.split(" "),container:e.className.split(" ")}})})(e),Object.assign(Object.assign({},i),{id:r})});return(e=>{const{keywordsConfig:t}=g.get();return(null==t?void 0:t.includeCountingKeywordInTags)?(Ke!==window.location.pathname&&(Ge.clear(),Ke=window.location.pathname),e.map(e=>{var t;const n=e.invCode.replace(/_\d+$/,""),i=null!==(t=Ge.get(n))&&void 0!==t?t:0;return e.keywords=Object.assign({},e.keywords),e.keywords[`${ee()}-count`]=i,Ge.set(n,i+1),e})):e})(l)});return(e=>{const t=Array.from(document.querySelectorAll('div[class^="advertory"]'));return e.sort((e,n)=>t.findIndex(t=>t.id===e.id)-t.findIndex(e=>e.id===n.id))})(a)},lt=(e,t,n)=>{const i=n[t],r=n[n.length-1],o=n.filter(({id:t})=>t===e.id)[0];return(null==e?void 0:e.id)===(null==i?void 0:i.id)?i:(null==e?void 0:e.id)===(null==r?void 0:r.id)?r:o||r},ct=e=>{const{queryConfig:{placementBatches:t}={},deviceType:n}=g.get(),i=(null==t?void 0:t[n])||{},r=Object.values(i).flat(),o=(e=>{const t={};return e.forEach(e=>{const n=ze(e.id);e.isBackfill&&(t[n]=[e])}),t})(e),s=((e,t)=>{const n={};for(const[i,r]of Object.entries(t))n[i]=e.filter(e=>r.includes(ze(e.id)));return n})(e,i),a=Object.keys(o),d=((e,t)=>e.filter(e=>!t.has(ze(e.id))))(e,new Set([...a,...r]));return Object.assign(Object.assign(Object.assign({},s),o),{[ot]:d})},ut="splash",vt="welcomePage",pt="topscroller",gt=(e,t=(...e)=>{})=>{const n=t.toString();if(0===e.length)return n;const i=n.substring(0,n.indexOf("=>")).replace("(","").replace(")","").split(",").map(e=>e.trim()),r=n.substring(n.indexOf("{")+1,n.lastIndexOf("}")),o=i.map((t,n)=>`${t} = "${e[n]}"`);return new Function(...o,r).toString()},ht="takeover-displayed",mt=()=>{const{takeover:{enabled:e=!1}={}}=g.get();return!window.location.href.includes("takeover=0")&&(!!window.location.href.includes("takeover=1")||e&&!yt())},yt=()=>{var e;return"true"===m((null===(e=g.get().takeover)||void 0===e?void 0:e.cookieCapName)||ht)},ft=(e,t)=>[[1,1],[1920,1080]].some(([n,i])=>n===e&&i===t),wt=()=>{const{takeover:e}=g.get();return Boolean(null==e?void 0:e.topscroller)},bt=()=>{var e,t,n;const i=document.location.hostname,r=(null===(e=g.get().takeover)||void 0===e?void 0:e.cookieCapName)||ht,o=void 0===(null===(t=g.get().takeover)||void 0===t?void 0:t.cookieCapTime)?14400:null===(n=g.get().takeover)||void 0===n?void 0:n.cookieCapTime;o&&(window.document.cookie=`${r}=true; max-age=${o}; domain=${i}; path=/`)},Et=e=>{var t;const n=!!(null===(t=g.get().takeover)||void 0===t?void 0:t.setCookieCapForNotShownAd);return ke(e)&&n},It=(e,t)=>{var n;if(t===pt){const{topscroller:t}=e;return null!=t?t:{}}if(t===ut){const{splash:t}=e;return null!=t?t:{}}return null!==(n=e.welcomePage)&&void 0!==n?n:{}},Tt=(e,t)=>{t!==ut?(e=>{var t,n,i;const r=null===(n=null===(t=g.get().takeover)||void 0===t?void 0:t.welcomePage)||void 0===n?void 0:n.headerElementSelector,o=null===(i=g.get().takeover)||void 0===i?void 0:i.topscroller;if(!r||o)return;const s=document.querySelector(r),a=document.querySelector(".welcome-page-wrapper"),d=document.querySelector(`#${e.targetId}`),l=document.querySelector(".advertory-welcome-page-scroll");if(!(s&&a&&l&&d))return;const c=null==s?void 0:s.offsetHeight,u=Pe(e)?"60svh":`calc(100svh - ${c}px)`,v=Pe(e)?"calc(40svh + 30px)":`calc(${c}px + 30px)`;a.style.setProperty("height",u,"important"),d.style.setProperty("height",u,"important"),l.style.setProperty("bottom",v,"important")})(e):(e=>{var t;if(!(null===(t=g.get().takeover)||void 0===t?void 0:t.splash))return;const n=document.querySelector(".advertory-splash-navbar-wrapper"),i=document.querySelector(`#${e.targetId}`);if(!n||!i)return;const r=`calc(100svh - ${n.offsetHeight}px)`;i.style.setProperty("height",r,"important")})(e)},St=gt([],()=>{new MutationObserver((e,t)=>{document.querySelector("iframe")&&((()=>{const e=document.querySelector("iframe");e&&(e.onload=()=>{if(!e.contentDocument)return;document.body.style.height="100%",document.documentElement.style.height="100%",e.height="100%",e.width="100%";const t=e.contentDocument.createElement("style");t.textContent="\n .adform-adbox {\n height: 100% !important;\n width: 100% !important;\n }\n img {\n height: 100% !important;\n width: 100% !important;\n object-fit: cover !important;\n object-position: top !important;\n }\n ",e.contentDocument.head.appendChild(t)})})(),t.disconnect())}).observe(document.body,{childList:!0,subtree:!0})}),At={nativeAd:e=>Ae(e)&&!Le(e),buyrecipe:e=>e.targetId.startsWith("buyrecipe"),fullwidthAd:Ce,fullscreenScroll:Se,topscroller:e=>ke(e)&&wt(),splash:e=>ke(e)&&ft(e.width,e.height),welcomePage:ke,wallpaper:Oe,skyscraper:e=>e.targetId.includes("skyscraper")&&!!e.banner,lFormat:De,hFormat:qe,toppanorama:e=>e.targetId.startsWith("toppanorama")&&!qe(e)&&!De(e),topboard:e=>e.targetId.startsWith("topboard")&&!ke(e),widescreen:_e,insider:e=>e.targetId.startsWith("insider"),sponsorstripe:Le,brandboard:e=>(e=>(980===e.width||1920===e.width&&e.targetId.includes("brandboard"))&&!e.targetId.includes("topboard")&&!e.targetId.includes("companion")&&!Ne(e))(e)&&!(e=>e.targetId.includes("backfill"))(e)&&!je(e),outstream:e=>"https://acdn.adnxs.com/video/outstream/ANOutstreamVideo.js"===e.renderer_url,netboard:e=>(e=>e.targetId.startsWith("netboard"))(e)||(e=>e.targetId.startsWith("board"))(e),panorama:Ne,midboard:je},Ct=({adObj:e,preferredTestIdData:t})=>{var n,i;const r=null!==(n=null==t?void 0:t.targetId)&&void 0!==n?n:null==e?void 0:e.targetId;if(!r)return;const o=null===(i=document.querySelector(`#${r}`))||void 0===i?void 0:i.parentElement;if(!o)return;if(((e,t)=>{var n,i,r,o;const s=null===(o=null===(r=null===(i=null===(n=window.apntag)||void 0===n?void 0:n.requests)||void 0===i?void 0:i.tags)||void 0===r?void 0:r[e])||void 0===o?void 0:o.invCode;s&&(t.dataset.invCode=s)})(r,o),null==t?void 0:t.testId)return void(o.dataset.testid=t.testId);const s="DIV"===(null==o?void 0:o.tagName);e&&s&&((e,t)=>{var n,i;for(const[r,o]of Object.entries(At))if(o(e)){if("nativeAd"===r){const o="default";t.dataset.testid=`${r}-${null!==(i=null===(n=null==e?void 0:e.native)||void 0===n?void 0:n.desc2)&&void 0!==i?i:o}`;break}t.dataset.testid=r;break}})(e,o)},kt=e=>{var t;return(null===(t=Object.entries(At).find(([,t])=>t(e)))||void 0===t?void 0:t[0])||""},Pt=(e,t)=>{const n=e.width,i=(null!=t?t:window.screen.width)/n;return i<1?i:1},Ot=new Map;Ot.set("insider",{scale:.82,transformOrigin:"left center",cogwheelAdjust:!0}),Ot.set("panorama",{scale:.79,transformOrigin:"center center"}),Ot.set("outstream",{scale:.79,transformOrigin:"center center"}),Ot.set("integration",{scale:.79,transformOrigin:"center center"}),Ot.set("toppanorama",{scale:.8,transformOrigin:"left center"});const $t=e=>{if(!((null===(t=null===document||void 0===document?void 0:document.body)||void 0===t?void 0:t.clientWidth)>767&&(null===(n=null===document||void 0===document?void 0:document.body)||void 0===n?void 0:n.clientWidth)<=853))return;var t,n;const i=kt(e),r=Ot.get(i),o=document.querySelector(`#${e.targetId}`);if(!o||!r)return;if(o.style.transformOrigin=r.transformOrigin,o.style.transform=`scale(${r.scale})`,!(null==r?void 0:r.cogwheelAdjust))return;const s=document.querySelector(`div[class*="gdpr-cogwheel-button"][id$="${e.targetId}"]`),a=null==o?void 0:o.offsetWidth;s&&"number"==typeof a&&!isNaN(a)&&s.style.setProperty("right",String(-1*a*.2)+"px")},Lt=e=>{var t,n;const i=st(e.targetId.split("-")[0]);if(!["live"].includes(i))return;((e,t=window.screen.width)=>{const n=Pt(e,t),i=document.querySelector(`iframe[id^="utif_${e.targetId}"]`);i&&(i.style.transform=`scale(${n})`,i.style.transformOrigin="left top")})(e,null!==(n=null===(t=document.getElementById(`${e.targetId}`))||void 0===t?void 0:t.offsetWidth)&&void 0!==n?n:window.screen.width)},xt=e=>{var t;const n=document.querySelector("#superright-side");if(n){const i=40,r=(null===(t=e.banner)||void 0===t?void 0:t.height)?e.banner.height+i:0;n.style.marginTop=`${r}px`}},Nt=(e,t=0)=>{const n=e.getBoundingClientRect(),i=window.innerHeight;return n.bottom>-t&&n.top<i+t},jt=e=>e.some(e=>e.some(e=>!!e&&Nt(e,0))),_t=()=>{const e=Array.from(document.querySelectorAll('div[id="superright-side"]')).map(e=>Array.from(e.querySelectorAll('div[id^="widescreen"]')));let t=0,n=Date.now(),i=jt(e);if(!e.length)return;const r=(e,t,n)=>{e.forEach(e=>{e&&e.style.setProperty(t,n)})},o=e=>1===e?0:1;(e=>{e.forEach(e=>{e[0]&&(e[0].style.display="block"),e[1]&&(e[1].style.display="none")})})(e);const s=((e,t)=>{let n=null;return(...i)=>{null===n&&(e(...i),n=setTimeout(()=>{n=null},t))}})(()=>{i||(i=jt(e)||i,n=Date.now());Date.now()-n>=1e4&&((()=>{const n=o(t),i=e.map(e=>e[t]),s=e.map(e=>e[n]);r(i,"opacity","0"),setTimeout(()=>{r(i,"display","none"),r(s,"opacity","0"),r(s,"display","block"),setTimeout(()=>{r(s,"opacity","1")},450)},450)})(),t=o(t),n=Date.now())},1e3);window.addEventListener("scroll",s)},Dt=e=>{const t=e[0];if("attributes"===t.type&&"class"===t.attributeName){const e=t.target;setTimeout(()=>{var t;const n=document.getElementsByTagName("video")[0],i=n&&n.getBoundingClientRect(),r=e.classList.contains("jw-flag-floating")&&!e.classList.contains("jw-flag-ads")?i.height+40:40,o=null===(t=document.querySelector('div[id^="sponsorstripe"]'))||void 0===t?void 0:t.firstChild;o&&(o.style.top=`${r}px`)},750)}},qt={attributeFilter:["class"],attributes:!0,childList:!1,subtree:!1},Mt={SVD:"svd",VG:"vg",GODARE:"godare",AFTENPOSTEN:"aftenposten",SA:"sa",BT:"bt",AFTONBLADET:"aftonbladet",E24:"e24",MINMOTE:"minmote",PENT:"pent",GODT:"godt",TEK:"tekno",KLART:"klart",POLARIS:"polaris"},Rt=e=>{const{source:t}=e;return"csm"===t},Bt={[Mt.VG]:["board","netboard","backfill","outstream"],[Mt.AFTONBLADET]:["panorama","outstream"],[Mt.GODARE]:["panorama","outstream"],[Mt.SVD]:["wph-article-panorama","wph-front-panorama"]},Ft=e=>{var t;const{publisher:n}=g.get();return!!Bt[n]&&!!(null===(t=Bt[n])||void 0===t?void 0:t.some(t=>e.includes(t)))},Ht={adRequested:()=>{},adAvailable:e=>{_e(e)&&_t()},adLoaded:e=>{const t=document.getElementById(e.targetId);(e=>{var t;const n=null===(t=document.getElementById(`${e.targetId}`))||void 0===t?void 0:t.parentElement;n&&(e.width>=1260&&e.width<=1280&&(n.classList.add("advertory-aftonbladet-l-format"),xt(e)),e.width>=1600&&e.width<=1620&&(n.classList.add("advertory-aftonbladet-h-format"),xt(e)))})(e),Lt(e),Ce(e)&&(null==t?void 0:t.parentElement)&&(t.classList.add("advertory-aftonbladet-panorama__full-width-ad"),t.parentElement.classList.add("advertory-aftonbladet-panorama-wrapper__full-width-ad")),Le(e)&&((()=>{const{deviceType:e}=g.get();I(e)&&setTimeout(()=>{const e=document.querySelector(".jwplayer"),t=new MutationObserver(Dt);e&&t.observe(e,qt)},1500)})(),(e=>{var t;const n=null===(t=document.querySelector(`#${e.targetId}`))||void 0===t?void 0:t.parentElement;n&&(n.style.cssText="height: 0; margin: 0; padding: 0;")})(e)),(e=>e.targetId.startsWith("outstream"))(e)&&((e=>{const t=document.querySelector(`#div_utif_${e.targetId}`);t&&Rt(e)&&(t.style.height="0px")})(e),null==t||t.classList.add("outstream"))},adNoBid:e=>{},adError:(e,t)=>{},adCollapse:()=>{},adRequestFailure:e=>{},adBadRequest:e=>{},adLoadedMediated:e=>{},adNoBidMediated:e=>{}},Ut={publisherClassName:Mt.AFTONBLADET,fullWidthFormatClassName:"panorama",classesToRemoveOnRefresh:["advertory-aftonbladet-h-format","advertory-aftonbladet-l-format"]},Vt=()=>(window.apntag||(window.apntag={anq:[],defineTag:e=>({targetId:""}),showTag:e=>{},onEvent:(e,t,n)=>{},offEvent:(e,t)=>{},refresh:e=>{},modifyTag:(e,t)=>{},loadTags:e=>{},emitEvent:(e,t)=>{},setPageOpts:e=>{},resizeAd:(e,t,n)=>{},getAstVersion:()=>"",setEndpoint:(e,t)=>{},fireImpressionTrackers:e=>{},setKeywords:()=>{},clearRequest:()=>{}}),window.apntag),Wt=()=>(window.relevantDigital||(window.relevantDigital={cmd:[]}),window.relevantDigital),zt=(e={},t)=>{const{prebid:{externalUidInAuctionEnabled:n,forwardGlimrTags:i=!1}={}}=g.get(),r=[`${Z()}-geo`],o=["aa-sch-context_keyword","aa-sch-publisher","se-aftonbladet-section","se-svd-section","se-generic-section","no-sno-news-section","no-sno-news-subsection",...i?r:[]],s=Object.fromEntries(Object.entries(e).filter(([e])=>o.includes(e))),a=t&&n?{id:t}:{};return{ortb2:Object.assign({site:{ext:{data:s}}},a)}},Kt=(t,...n)=>e(void 0,[t,...n],void 0,function*(e,{timeout:t}={timeout:1e3}){document.querySelector(`script[src="${e}"]:not([type="module"])`)||(yield new Promise((n,i)=>{const r=document.createElement("script");r.async=!0,r.src=e;const o=()=>{a(),n()},s=()=>{a(),i(new Error(`Failed to load ${e}`))},a=()=>{r.removeEventListener("load",o),r.removeEventListener("error",s),clearTimeout(d)};r.addEventListener("load",o),r.addEventListener("error",s);const d=setTimeout(()=>{a(),i(new Error(`Loading script timed out: ${e}`))},t);document.head.appendChild(r)}).catch(e=>{console.error(e)}))}),Gt=()=>{const{prebid:e,tcf:n,country:i}=g.get(),{getConsentSync:r}=o(n),s=r(),{initNativeAd:a}=g.getHandlers();if(!(null==e?void 0:e.enabled))return;const d=(()=>{let e=!1,t=[];const n={relevantCb:{timeout:1e3},auctionCb:{timeout:2e3}};return{getCancel:()=>e,setCancel:t=>{e=t},events:n,failsafeOnTimeout:i=>{const r=Vt(),{prebid:{relevantCbTimeout:o}={}}=g.get(),s="relevantCb"===i&&o?o:n[i].timeout,a=setTimeout(()=>{!n[i].done&&!e&&(console.warn(`Doing failsafe loadTags() call after waiting too long for '${i}'`),e=!0,r.loadTags&&r.loadTags())},s);t.push(a)},cleanup:()=>{t.forEach(e=>clearTimeout(e)),t=[],e=!1,n.relevantCb.done=!1,n.auctionCb.done=!1}}})(),l=Vt(),c=(()=>{const{requests:{user:e={userIds:[]},keywords:t={}}={}}=Vt();return{user:e,keywords:t}})();d.failsafeOnTimeout("relevantCb");const{user:{externalUid:u=""}={},keywords:v}=c;(()=>{const e=Wt();return e.cmd||(e.cmd=[]),e.cmd})().push(()=>{if(d.getCancel()||!l.loadTags)return t("core loadTags() call was cancelled",{cancel:d.getCancel(),apnTagLoadTags:!l.loadTags,condition:"or"}),void d.cleanup();const n=Wt();d.events.relevantCb.done=!0,d.failsafeOnTimeout("auctionCb");const r=s?{gdpr:{cmpApi:"iab",timeout:8e3}}:{cmpApi:"none"};t("prebid consentManagement",r),n.addPrebidConfig(Object.assign(Object.assign({consentManagement:r,enableSendAllBids:!1},ue(i)),zt(v,u))),t("core add prebid config",Object.assign(Object.assign({consentManagement:r,enableSendAllBids:!1},ue(i)),zt(v,u))),n.loadPrebid({configId:e.id,manageAdserver:!1,collapseEmptyDivs:!1,collapseBeforeAdFetch:!1,noGpt:!0,noSlotReload:!0,loadUnknownSlots:!0,apntagCalls:{showTag:()=>{},loadTags:e=>{d.getCancel()||(d.events.auctionCb.done=!0,l.loadTags(e)),d.cleanup()}},customNativeRender:e=>{Jt(e,a)}}),t("core load prebid",{configId:e.id,manageAdserver:!1,collapseEmptyDivs:!1,collapseBeforeAdFetch:!1,noGpt:!0,noSlotReload:!0,loadUnknownSlots:!0,apntagCalls:{showTag:()=>{},loadTags:e=>{d.getCancel()||(d.events.auctionCb.done=!0,l.loadTags(e))}},customNativeRender:e=>{Jt(e,a)}})})},Jt=(e,t)=>{var n;const{divId:i,native:r,bid:o}=e,s=document.querySelectorAll(`[id^=${i}]`)[0],a=`RY-${s.id}`;((e,t)=>{e.childNodes.forEach(e=>e.style.cssText="position: absolute; z-index: -1;");const n=document.createElement("div");n.setAttribute("id",t),e.appendChild(n)})(s,a);const d=null===(n=s.getElementsByTagName("iframe")[0])||void 0===n?void 0:n.contentWindow;t({native:r,targetId:a},g.get()),null==d||d.postMessage(JSON.stringify({message:"Prebid Response",ad:"\x3c!-- nothing --\x3e",adId:o.adId}),"*")},Yt=e=>e.includes("snoap.no"),Qt=e=>{var t,n,i,r,o;return!!(null===(o=null===(r=null===(i=null===(n=null===(t=window.apntag)||void 0===t?void 0:t.requests)||void 0===n?void 0:n.tags[e])||void 0===i?void 0:i.adResponse)||void 0===r?void 0:r.ads[1])||void 0===o?void 0:o.rtb)},Xt=gt([],()=>{const e=({width:e,height:t})=>{var n;const i=null===(n=document.querySelector("#sf_align"))||void 0===n?void 0:n.querySelector("div");if(!i)return;const{clientWidth:r,clientHeight:o}=i,s=e/r,a=t/o;i.style.transform=`scale(${s},${a})`,i.style.transformOrigin="left top"},t=()=>{const{innerWidth:t,innerHeight:n}=window;e({width:t,height:n})};window.addEventListener("resize",t=>{if(!t.currentTarget)return;const n={width:innerWidth,height:innerHeight};e(n)});const n=window.frameElement;(null==n?void 0:n.contentWindow)?n.contentWindow.document.body.onload=t:document.body.onload=t}),Zt=e=>{const t=gt([],()=>{new MutationObserver((e,t)=>{document.querySelector("iframe")&&((()=>{const e=document.querySelector("iframe");e&&(e.onload=()=>{if(!e.contentDocument)return;document.body.style.height="100%",document.documentElement.style.height="100%",e.height="100%",e.width="100%";const t=e.contentDocument.createElement("style");t.textContent="\n adfm-ad {\n height: 100% !important;\n width: 100% !important;\n }\n ",e.contentDocument.head.appendChild(t);const n=e.contentDocument.querySelector("iframe");if(!(null==n?void 0:n.contentDocument))return;const i=n.contentDocument.createElement("style");i.textContent="\n #image {\n background-size: cover !important;\n }\n ",new MutationObserver((e,t)=>{n.contentDocument&&(n.contentDocument.head.appendChild(i),t.disconnect())}).observe(e.contentDocument,{childList:!0,subtree:!0})})})(),t.disconnect())}).observe(document.body,{childList:!0,subtree:!0})}),n=document.createElement("script");n.textContent=`(${t})()`;return e+n.outerHTML},en=[],tn={},nn=(e,t)=>{e.forEach(({target:e,isIntersecting:n})=>{const i=on(e);n?(rn(i,n),sn(e,i,t)):(rn(i,n),an(e,i,t))})},rn=(e,t)=>{var n,i;const r=null===(n=document.getElementById(e))||void 0===n?void 0:n.querySelector("iframe");if(!r)return;const o=t?"showFullscreen":"hideFullscreen";null===(i=r.contentWindow)||void 0===i||i.postMessage(`advertory:${o}-${e}`,"*")},on=e=>{var t;return null===(t=e.children[0])||void 0===t?void 0:t.id},sn=(e,t,n)=>{e.classList.add("in-screen"),document.body.classList.add("fullscreen-scroll-in-screen"),window.dispatchEvent(new CustomEvent("advertory:fullscreenScrollInView")),en.includes(t)||en.push(t),n&&window.addEventListener("scroll",tn[t],{passive:!0})},an=(e,t,n)=>{en.includes(t)&&(n&&window.removeEventListener("scroll",tn[t]),document.body.classList.remove("fullscreen-scroll-in-screen"),e.classList.remove("in-screen"),window.dispatchEvent(new CustomEvent("advertory:fullscreenScrollNotInView")))},dn=(e,t={fadingHeaderEnabled:!1,headerSelectors:[".js-masthead"],skyscraperSelectors:[".skyscraper_r"],headerZIndex:3})=>{const{headerSelectors:n=[".js-masthead"],skyscraperSelectors:i=[".skyscraper_r"],headerZIndex:r=3}=t,o=[],s=[];return n.forEach(e=>{var t;const n=null!==(t=document.querySelector(e))&&void 0!==t?t:document.querySelector("header");n&&o.push(n)}),i.forEach(e=>{const t=document.querySelector(e);t&&s.push(t)}),()=>{o.length&&ln(e,o,r,0),s.length&&ln(e,s,r,40)}},ln=(e,t,n,i)=>{const r=e.offsetHeight,o=window.scrollY,s=e.getBoundingClientRect().top+o;t.forEach(e=>{const t=e.offsetHeight;let a;a=s>o?(s-o)/t-i:(o+t-(s+r))/t;const d=a<=0;e.style.visibility=d?"hidden":"",e.style.zIndex=d?"":n.toString(),e.style.pointerEvents=d?"none":"all",e.style.opacity=a.toString()})},cn={no:{adText:"ANNONSE",adFrom:"ANNONSE FRA",adContent:"ANNONSØRINNHOLD",adContentFrom:"ANNONSØRINNHOLD FRA"},se:{adText:"ANNONS",adFrom:"ANNONS FRÅN",adContent:"EXTERN LÄNK",adContentFrom:"EXTERN LÄNK FRÅN"}};let un=null;const vn=(e,t)=>{let n=e;return n=(e=>{const t=document.createElement("script");return t.textContent="\n {\n const frame = window.frameElement;\n \n if (frame) {\n frame.contentWindow.document.body.onload = onLoad;\n } else {\n document.body.onload = onLoad;\n }\n \n function onLoad() {\n window.addEventListener('message', function(event) {\n if (event.data === 'advertory:showFullscreen-'+document.body.id) {\n document.body.style.display= \"block\";\n } else if (event.data === 'advertory:hideFullscreen-'+document.body.id) {\n document.body.style.display= \"none\";\n }\n });\n }\n }\n ",e+t.outerHTML})(e),n=(e=>{const t=document.createElement("script");return t.textContent=`(${Xt})()`,e+t.outerHTML})(n),n=(e=>{if((e=>e.includes("google"))(e))return e;const t=document.createElement("div");t.innerHTML=e;const n=t.querySelector("img");return n?(n.style.width="100%",n.style.height="100%",n.style.objectFit="cover",n.style.position="fixed",t.innerHTML):e})(n),n=(e=>{if(Yt(e))return e;const t=document.createElement("style");return t.textContent="\n .GoogleActiveViewClass, .GoogleActiveViewElement {\n transform: translate(calc(-50% + 50vw), 0);\n width: 100vw !important;\n height: 100vh !important;\n }\n .GoogleActiveViewClass img, .GoogleActiveViewElement img {\n width: 100vw;\n height: 100vh;\n object-fit: cover;\n }\n .GoogleActiveViewClass iframe {\n width: 100vw !important;\n height: 100vh !important;\n }\n ",e+t.outerHTML})(n),(e=>e.includes("adform"))(n)&&(n=(e=>{const t=document.createElement("script");t.textContent='\n var frame = window.frameElement;\n if (frame) {\n frame.style.removeProperty("width");\n frame.style.removeProperty("height");\n frame.contentWindow.document.body.onload = onLoad;\n } else {\n document.body.onload = onLoad;\n }\n \n function onLoad() {\n var iframe = document.querySelector("adfm-ad iframe");\n if (iframe) {\n var image = iframe.contentWindow.document.getElementById("image");\n if (!image) return;\n image.style.backgroundSize = "cover";\n } else {\n var iframe = document.querySelector(".adform-adbox iframe");\n if (iframe) {\n var style = document.createElement("style");\n style.textContent = "#banner {width: 100% !important; height: 100% !important;} #banner img {object-fit: cover;}";\n iframe.contentDocument.body.append(style);\n iframe.style = "width: 100vw; height: 100vh;";\n } else {\n var observer = new MutationObserver(function(mutations, obs) {\n for (var mutation of mutations) {\n var iframe = mutation.addedNodes[0];\n if (iframe && iframe.nodeName === "IFRAME") {\n iframe.style = "width: 100vw; height: 100vh;";\n iframe.dataset.contents += "<style>#banner {width: 100% !important; height: 100% !important;} #banner img {object-fit: cover;}</style>";\n obs.disconnect();\n }\n }\n });\n observer.observe(document.body, { childList: true, subtree: true });\n }\n }\n }\n ';const n=document.createElement("style");return n.textContent="\n html, body, adfm-ad, #sf_align, .adform-adbox, .adform-adbox img {\n width: 100% !important;\n height: 100% !important;\n object-fit: cover;\n max-width: 100vw;\n }\n ",e+n.outerHTML+t.outerHTML})(n)),(e=>e.includes("529299503"))(n)&&(n=Zt(n)),(e=>e.includes("de17a"))(n)&&(n=(e=>Yt(e)?e:e.replace("<iframe ","<iframe onload=\"\n var f = document.querySelector('iframe');\n if (!f) return;\n var s = f.style;\n s.transform = 'scale(' + (window.innerHeight / Number(f.height)).toFixed(2) + ')';\n s.right = parseInt((Number(f.width) - window.innerWidth) / 2) + 'px';\n s.bottom = parseInt((Number(f.height) - window.innerHeight) / 2) + 'px';\n s.position = 'relative';\n \" "))(n)),Yt(n)&&(n=(e=>{let t=e.replace("<html>",'<html style="height: 100%;">');return t=t.replace("</iframe>","</iframe><style>#sf_align {height: 100%;} #sf_align iframe {height: 100vh;}</style>"),t=t.replace('<body style="','<body style="height: 100%; '),t})(n)),(e=>e.includes("kreateam.io"))(n)&&(n=(e=>{let t=e.replace("<html>",'<html style="height: 100%;">');return t=t.replace("</div>","</div><style>#sf_align {height: 100%;} #sf_align iframe {height: 100vh;}</style>"),t=t.replace('<body style="','<body style="height: 100%; '),t})(n)),Qt(t)&&(n=(e=>{const t=document.createElement("script");t.textContent='var frame = window.frameElement;\n if (frame) {\n frame.style.width = "100vw";\n frame.style.height = "100vh";\n }';const n=document.createElement("div");return n.innerHTML=e,n.appendChild(t),n.innerHTML})(n)),n},pn=()=>{un=null;const e=window.visualViewport,t=e?e.height:window.innerHeight,n=e?e.width:window.innerWidth,i=e?e.offsetTop:0,r=e?e.offsetLeft:0,o=document.documentElement;o.style.setProperty("--advertory-fullscreen-scroll-vh",`${t}px`),o.style.setProperty("--advertory-fullscreen-scroll-vw",`${n}px`),o.style.setProperty("--advertory-fullscreen-scroll-top",`${i}px`),o.style.setProperty("--advertory-fullscreen-scroll-left",`${r}px`)},gn=()=>{un||(un=window.requestAnimationFrame(pn))},hn=(e,t)=>{var n,i,r;const{country:o}=g.get(),{targetId:s}=e;(e=>{const{articlesContainerWidth:t=1302,backgroundColor:n="#fff",foregroundColor:i="#fff",margin:r="16px 0",beforeContentValue:o=""}=e,s=t/2,a=document.createElement("style");a.innerHTML=`\n :root {\n --background: linear-gradient(\n to right,\n ${n} 0px,\n ${n} calc(50% - ${s}px),\n ${i} calc(50% - ${s}px),\n ${i} calc(50% + ${s}px),\n ${n} calc(50% + ${s}px),\n ${n} 100%\n ) !important;\n \n --fullscreen-scroll-wrapper-margin: ${r};\n }\n \n .advertory-fullscreen-scroll-wrapper {\n ${o&&"clip-path: polygon(0 -16px, 100vw -16px, 100vw 100dvh, 0 100dvh);\n -webkit-clip-path: polygon(0 -16px, 100vw -16px, 100vw 100dvh, 0 100dvh);"}\n }\n\n .advertory-fullscreen-scroll-wrapper:before, .advertory-fullscreen-scroll-wrapper:after {\n background: var(--background);\n content: '${o}' !important;\n }`,a.id="ad-fullscreen-scroll-wrapper-style",document.head.appendChild(a)})(null!==(n=null==t?void 0:t.overlayStyles)&&void 0!==n?n:{});const a=document.getElementById(s),d=null==a?void 0:a.parentElement;a&&d&&(((e,t)=>{const n=(null==t?void 0:t.fadingHeaderEnabled)||!1,i=new IntersectionObserver(e=>nn(e,n),{}),r=on(e);i.observe(e),n&&(tn[r]=dn(e,t))})(d,t),a.className="advertory-fullscreen-scroll",Re(e,he)&&(a.style.position="absolute"),d.className="advertory-fullscreen-scroll-wrapper",d.dataset.showTagSubscribeId=s,a.setAttribute("data-ad-label",cn[o].adText),(null==t?void 0:t.moveCogwheelToTheLeft)&&(a.dataset.moveCogwheelToTheLeft="true"),gn(),window.addEventListener("resize",gn),null===(i=window.visualViewport)||void 0===i||i.addEventListener("resize",gn),null===(r=window.visualViewport)||void 0===r||r.addEventListener("scroll",gn))},mn=({targetId:e})=>{const t=(e=>{const{requests:t}=window.apntag,n=Qt(e)?1:0;return null==t?void 0:t.tags[e].adResponse.ads[n].rtb.banner.content})(e);if(!t)return;((e,t)=>{const{requests:n}=window.apntag,i=Qt(e)?1:0;n&&(n.tags[e].adResponse.ads[i].rtb.banner.content=t)})(e,vn(t,e))},yn=(e,t,n)=>{const i=document.getElementById(`div_utif_${e}`);if(!i)return;const{apntag:r}=window,[o,s]=t;if(!i.dataset.lockedsize&&s&&o)i.style.width=`${o}px`,i.style.height=`${s}px`,n&&(r.resizeAd(i.id,[o,s]),i.dataset.lockedsize="true",i.dataset.lockedwidth=o.toString(),i.dataset.lockedheight=s.toString());else if(null==i?void 0:i.dataset.lockedsize){const{lockedwidth:e,lockedheight:t}=i.dataset;e&&t&&r.resizeAd(i.id,[e,t])}},fn=["netboard","board"];class wn{constructor(e,t){this.identityFacade=e,this.tracker=t}buildUrl(e,t){var n,i;const{editionName:r}=e,o=(()=>{const e=window.location.href;return new URL(e).searchParams.get("dre_override_inv_code")||""})(),s=JSON.stringify(null!==(i=null===(n=window.advertory)||void 0===n?void 0:n.renderedDrEditionAds)&&void 0!==i?i:[]),a=new URL("https://dr-edition-teaser-server.inventory.schibsted.io/editions"),{envId:d,spid:l}=t;return a.searchParams.append("editionName",r),o&&a.searchParams.append("urlData",o),s&&a.searchParams.append("excludedItems",s),l&&a.searchParams.append("spid",l),d&&a.searchParams.append("envid",d),a.toString()}fetchData(n){return e(this,void 0,void 0,function*(){var e,i;const r=yield this.identityFacade.getIdentityUser(),o=null!==(i=yield null===(e=this.tracker)||void 0===e?void 0:e.getEnvironmentId())&&void 0!==i?i:"",s=(null==r?void 0:r.userId)?String(r.userId):"",a=this.buildUrl(n,{envId:o,spid:s});try{t("Starting fetching DrEdition ad from URL:",a);const e={method:"GET"},n=yield W.get(a,e);return t("Fetch operation completed successfully."),n}catch(e){t("Error during fetch operation:",e)}return null})}}class bn{getDrEditionUTMParams(e,t){var n;const{title:i,clientName:r,creativeId:o}=null!==(n=null==e?void 0:e.pulseData)&&void 0!==n?n:{},{editionName:s}=t,a=i.replace(/<[^>]*>/g,"");return Object.assign({utm_source:"vgfront",utm_content:s,utm_campaign:r,utm_medium:a},o&&{utm_id:`df-${o}`})}getUrlSearchParams(e,t,n){if(!e)return"";const i=this.getDrEditionUTMParams(t,n),r=new URLSearchParams(decodeURIComponent(e.search)),o=new URLSearchParams(e.search);return Object.entries(i).forEach(([e,t])=>{r.has(e)||o.set(e,null!=t?t:"")}),o.toString().replace(/\+/g,"%20")}getUrlWithParams(e,t){var n;const i=null===(n=null==e?void 0:e.pulseData)||void 0===n?void 0:n.url;if(!i)return"";const r=this.getDrEditionUTMParams(e,t),o=new URL(i);return Object.entries(r).forEach(([e,t])=>{o.searchParams.has(e)||o.searchParams.set(e,null!=t?t:"")}),o.toString()}handleVideo(t,n){return e(this,void 0,void 0,function*(){const{id:e,autoplay:i,mute:r,videoLoop:o,vendor:s}=n.videoConfiguration;t.classList.add("vgtv-video-container"),Object.assign(t.dataset,{vgtvVideoId:e,vgtvVendor:s,vgtvAutoplay:i,vgtvMuted:r,vgtvLoop:!!o,vgtvNa:!0,vgtvRecommended:!1,vgtvPulseProvider:"vg",vgtvPulseProductTag:"partnerstudio"})})}getPulseObjectId(){return"sdrn:vg:content:partnerstudio:element:partnerstudio:stats"}getPulsePageId(){return"sdrn:vg:frontpage:front"}getTags(e){var t;let n;if(n=e instanceof HTMLAnchorElement?e.href:null===(t=null==e?void 0:e.querySelector("a"))||void 0===t?void 0:t.href,!n)return[];const{host:i,pathname:r}=new URL(n);if(!i.includes("www.vg.no")&&!r.includes("annonsorinnhold"))return[n];const o=r.split("/");return o.length?[...o.filter(Boolean).slice(1).map(e=>e),n]:[n]}}class En{constructor(e,t,n,i){this.drEditionService=e,this.rendererManager=t,this.videoManager=n,this.pulseManager=i,this.drEditionAds=[]}fetchAndRenderAd(n,i){return e(this,void 0,void 0,function*(){var e,r;const{drEditionConfig:{containerSelector:o},renderAsBackfill:s=!1}=i,a=n.querySelector(o);if(!a)return void t(`Container with selector "${o}" not found.`);const d=yield this.drEditionService.fetchData(i);return(null==d?void 0:d.itemId)||s?!(null==d?void 0:d.itemId)&&s?(t("No Dr. Edition ads available to render. Collapsing whole placement."),void Xe(n.id)):((null==d?void 0:d.itemId)&&s&&(t("Dr. Edition ad available to render as a Xandr backfill."),Ze(n.id)),void(d&&(d.css&&((e,t)=>{const n=document.createElement("link");n.rel="preload",n.href=e,n.as=t,document.head.appendChild(n)})(d.css,"style"),this.rendererManager.render(a,d,i),yield null===(e=this.videoManager)||void 0===e?void 0:e.handle(d,i),this.drEditionAds.push(d),window.advertory=window.advertory||{},window.advertory.renderedDrEditionAds=window.advertory.renderedDrEditionAds||[],window.advertory.renderedDrEditionAds.push(d.itemId),this.observeAdView(n,d,i),null===(r=n.querySelector("a"))||void 0===r||r.addEventListener("pointerup",()=>null)))):(t("No Dr. Edition ads available to render. Hiding Dr. Edition and rendering Xandr backfill."),this.hideDrEdition(a),void this.showBackfill(n))})}observeAdView(e,t,n){this.observeCarousel(e,t,n)||((e,t,n={threshold:.5})=>{new IntersectionObserver(([e],n)=>{e.isIntersecting&&(t(),n.disconnect())},n).observe(e)})(e,()=>this.pulseManager.trackContentView(e,t,n),{threshold:.5})}showBackfill(e){var t;const n=e.querySelector(".fallback");if(!n)return;n.style.display="block";const i=null!==(t=n.dataset.fallbackTargetId)&&void 0!==t?t:"";Ze(i)}hideDrEdition(e){e.style.display="none"}observeCarousel(e,t,n){const i=e.querySelector(".dr-edition-slider");if(!i)return!1;let r=null;const o=new IntersectionObserver(e=>{e.forEach(e=>{e.isIntersecting&&e.intersectionRatio>=.9&&(r&&clearTimeout(r),r=setTimeout(()=>{e.target.onclick=()=>this.pulseManager.trackContentClick(e.target,t,n),this.pulseManager.trackContentView(e.target,t,n)},500)),[...i.children].forEach(e=>{o.observe(e)})})},{threshold:[.9]});return[...i.children].forEach(e=>{o.observe(e)}),!0}}class In{constructor(e,t){this.newsroomStrategy=e,this.pulseManager=t}render(e,t,n){if(!(null==t?void 0:t.itemId))return;const{getConsentSync:i}=o(n.tcf),r=!!i(),s=I(n.device)?t.mobileHTML:t.desktopHTML,a=r?s:s.replace(/<img [^>]*class="tracking-pixel"[^>]*>/g,"");e.innerHTML=a,e.querySelectorAll("a").forEach(e=>{var i,r,o;e.search=null!==(o=null===(r=(i=this.newsroomStrategy).getUrlSearchParams)||void 0===r?void 0:r.call(i,e,t,n))&&void 0!==o?o:"",e.onclick=()=>this.pulseManager.trackContentClick(e,t,n)})}}class Tn{constructor(e){this.strategy=e}handle(t,n){return e(this,void 0,void 0,function*(){const{videoConfiguration:{id:e,preview:i}={}}=t;(e||i)&&(yield this.importScript(n),yield this.createVideoElement(t,n))})}importScript(n){return e(this,void 0,void 0,function*(){const e=n.drEditionConfig.videoScriptUrl,i=document.querySelector(`script[src="${e}"]`);if(e&&!window.autoplayQueue&&!i)try{yield Kt(e)}catch(e){t("Error! Failed to prepare SVP player script for Dr. Edition!",e)}})}createVideoElement(t,n){return e(this,void 0,void 0,function*(){const e=document.createElement("div"),{node:i}=t.videoConfiguration,r=[...document.querySelectorAll(`#${i}`)||[]].find(e=>0===e.children.length);if(this.handlePreviewVideo(t,n))return;this.strategy.handleVideo(e,t),null==r||r.appendChild(e),window.autoplayQueue=window.autoplayQueue||[],window.autoplayQueue.push(e=>{e.parse()});const o=null==r?void 0:r.parentNode;if(!o)return;const s=o.closest("a");o.addEventListener("click",e=>{const t=e.target.closest("a");s!==t&&t||(e.stopPropagation(),e.preventDefault())})})}handlePreviewVideo(e,t){var n,i,r;const{preview:{url:o,thumbnail:s}}=null!==(n=e.videoConfiguration)&&void 0!==n?n:{};if(!o)return!1;const a=document.querySelector(".dr-edition-preview .preview-video");return!!a&&(a.setAttribute("playsinline",""),!(!a||!s)&&(null===(r=(i=t.drEditionConfig).addPreviewVideo)||void 0===r||r.call(i,a),!0))}}class Sn{constructor(e,t){this.pulse=e,this.newsroomStrategy=t}getEventInput(e,t,n,i){return{}}mapPageType(e){return{front:"Frontpage",article:"Article",section:"Article",collection:"Article",other:"Article"}[e||"front"]||"Frontpage"}getArticleId(){return location.pathname.split("/").slice(-2,-1).pop()||""}getTeaserElementText(e,t){if(!e)return"";const n=e.querySelector({title:".dr-edition-title",subtitle:".dr-edition-subtitle",image:"img.teaser-main-image"}[t]);if(!n)return"";if("image"===t)return n.src||"";const i=null==n?void 0:n.textContent;return i?i.trim():""}getEventTarget(e,t){const{itemId:n,pulseData:{url:i}={}}=t,r=this.getTeaserElementText(e,"title");return{id:n,name:this.normalizePlacementTitle(null!=r?r:""),type:"Page",url:i}}normalizePlacementTitle(e){return e.replace(/<[^>]+>/gi,"").replace(/[^a-z0-9æøå\s_-]/gi,"")}trackContentView(t,n,i){return e(this,void 0,void 0,function*(){var e,r,o,s,a;if(!this.pulse)return;const d=this.getEventInput(t,n,i,"view");(null===(e=this.pulse)||void 0===e?void 0:e.trackViewUIElement)?null===(o=null===(r=this.pulse)||void 0===r?void 0:r.trackViewUIElement)||void 0===o||o.call(r,d):null===(a=null===(s=this.pulse)||void 0===s?void 0:s.trackElementView)||void 0===a||a.call(s,d)})}trackContentClick(t,n,i){return e(this,void 0,void 0,function*(){var e,r,o,s;if(!this.pulse)return;const a=this.getEventInput(t,n,i,"click");this.pulse.trackClickUIElement?null===(r=(e=this.pulse).trackClickUIElement)||void 0===r||r.call(e,a):null===(s=(o=this.pulse).trackElementClick)||void 0===s||s.call(o,a)})}}class An extends Sn{constructor(e,t,n){super(e,t),this.pulse=e,this.newsroomStrategy=t,this.pageType=n}getEventBaseData(e,t,n){const{pulseData:{title:i,clientName:r="",creativeId:o}={}}=t,{columnName:s,primaryPosition:a}=n;return{"@type":"UIElement",elementType:"Teaser",layout:{elementSize:"large",imageUrl:"",name:"large"},name:i,placement:{columnName:s,primaryPosition:a},"spt:custom":{is_sponsored:!0,sponsor:r,"spt: creativeId":o},url:location.origin}}getEventInput(e,t,n){return{object:this.getEventBaseData(e,t,n),target:this.getEventTarget(e,t)}}}class Cn extends Sn{constructor(e,t,n){super(e,t),this.pulse=e,this.newsroomStrategy=t,this.pageType=n}getEventBaseData(e,t,n){var i,r,o,s,a,d;const{itemId:l,pulseData:{clientName:c,creativeId:u}={}}=t,v=n.editionName,p=this.mapPageType(this.pageType),g=null===(i=this.newsroomStrategy)||void 0===i?void 0:i.getPulsePageId(this.pageType||"front",this.getArticleId());return{"@id":null!==(s=null===(o=null===(r=this.newsroomStrategy)||void 0===r?void 0:r.getPulseObjectId)||void 0===o?void 0:o.call(r))&&void 0!==s?s:v,"@type":"UIElement",position:v,elementType:"Article",custom:{customer:c,creativeId:null!=u?u:l},page:{"@id":null!=g?g:v,"@type":p,url:location.origin},tags:null===(d=null===(a=this.newsroomStrategy)||void 0===a?void 0:a.getTags)||void 0===d?void 0:d.call(a,e)}}getEventInput(e,t,n,i){return{object:this.getEventBaseData(e,t,n),partnerstudio:this.getEventPartnerstudioData(e,t,n,i),target:this.getEventTarget(e,t),provider:this.getProviderData()}}getEventPartnerstudioData(e,t,n,i){var r,o,s,a;const{pulseData:{algorithm:d="sov",clientName:l,creativeId:c,editionId:u,itemId:v,url:p,probability:g}={}}=t,h=Math.floor(Date.now()/1e3),m=this.getTeaserElementText(e,"title"),y=this.getTeaserElementText(e,"subtitle"),f=this.getTeaserElementText(e,"image"),w=null!==(a=null!==(s=null===(o=null===(r=this.newsroomStrategy)||void 0===r?void 0:r.getUrlWithParams)||void 0===o?void 0:o.call(r,t,n))&&void 0!==s?s:p)&&void 0!==a?a:"";return{algorithm:d,clientName:l,probability:g,creativeId:c,device:n.device,editionId:u,itemId:v,link:w,placement:n.editionName,subtitle:y,time:h,title:m,type:i,imageUrl:f,frontId:86,tracking_type:"ad",xandrAdLoaded:!1}}getProviderData(){return{productTag:"partnerstudio"}}}const kn={FRONT:"front",ARTICLE:"article"},Pn=(e,t)=>{null==t||t.forEach(t=>{const n=window.SVP.Player.Plugins.get(t);e.addPlugin(new n)})},On=t=>e(void 0,void 0,void 0,function*(){var e,n;return(null===(e=null===window||void 0===window?void 0:window.SVP)||void 0===e?void 0:e.Player)?new window.SVP.Player(t):((()=>{const e="svp-player-sdk",t=document.querySelector(e),n=Array.from(document.querySelectorAll('script[src^="https://cdn.stream.schibsted.media/player"]'));if(t||n.length>0)return;const i=document.createElement("script");i.id=e,i.src="https://cdn.stream.schibsted.media/player/3.78.1/player.min.js",i.async=!0;try{i.src=i.src.replace("player.min","player.next.min")}catch(e){console.error("Failed to set player.next.min source:",e)}document.head.insertBefore(i,document.head.firstChild)})(),(null===(n=window.SVP)||void 0===n?void 0:n.isLoaded)?new window.SVP.Player(t):yield new Promise(e=>{window.addEventListener("onSvpPlayerReady",()=>e(new window.SVP.Player(t)))}))}),$n={ContentMutePlugin:e=>{window.SVP.Player.Plugins.register({getName:()=>"ContentMutePlugin",initialize(){},setup(){const t=this.player.config.get("mute");this.container=e||this.player.getContainer(),this.muted=t,t&&this.listenToOnce(this.player,"ready",this.renderButtonElement,this)},getButtonElement(){const e=document.createElement("button");e.className="player-plugin-content-mute";const t=document.createElement("span");return t.className="volume-button-icon",e.appendChild(t),e},renderButtonElement(){this.buttonElement=this.getButtonElement(),this.buttonElement.addEventListener("click",this.onButtonClick.bind(this)),this.container.appendChild(this.buttonElement),this.isVideo()||(this.buttonElement.style.display="none"),this.getJWPlayer()&&this.getJWPlayer().on("mute",this.onMuteChange,this)},onButtonClick(){this.getJWPlayer()&&(this.container.classList.add("has-interacted"),this.muted=!this.muted,this.getJWPlayer().setMute(this.muted))},onMuteChange(e){this.muted=e.mute,this.muted?this.buttonElement.classList.remove("content-video-volume-on"):this.buttonElement.classList.add("content-video-volume-on")},isVideo(){return"video"===this.player.getRawAsset().assetType},getJWPlayer(){return this.player.model.player}})},IntegrationMenu:()=>{window.SVP.Player.Plugins.register({getName:()=>"IntegrationMenu",setup(){return e(this,void 0,void 0,function*(){yield Promise.resolve().then(function(){return $r})})}})}},Ln=(e,t)=>{null==e||e.forEach(e=>{$n[e](t)})};class xn{handleVideo(t,n){return e(this,arguments,void 0,function*(t,{videoConfiguration:{id:n,node:i,autoplay:r,mute:o,vendor:s}}){yield e(void 0,void 0,void 0,function*(){return yield new Promise(e=>{var t;Boolean(null===(t=window.SVP)||void 0===t?void 0:t.Player)?e(!0):window.addEventListener("onSvpPlayerReady",()=>e(!0))})});const a=["ContentMutePlugin"],d=this.createPlayerOverlay(t);Ln(a,d);const l={id:n,node:i,autoplay:r,mute:o,vendor:s,autopause:"viewable",maxBitrate:600,pulse:{provider:"e24"},recommended:{autoplay:!1,next:{countdown:10}},skin:{name:"e24-default",url:""}},c=yield On(l);c.once("assetReady",()=>{Pn(c,a)}),c.once("ready",()=>{const e=t;new MutationObserver(t=>{t.forEach(({type:t,attributeName:n})=>{"attributes"===t&&"class"===n&&(e.classList.contains("jw-state-playing")?d.classList.add("is-playing"):d.classList.remove("is-playing"),e.classList.contains("jw-flag-user-inactive")?d.classList.add("is-inactive"):d.classList.remove("is-inactive"))})}).observe(e,{attributes:!0,attributeFilter:["class"]})}),c.once("PulseStats:ready",()=>e(this,void 0,void 0,function*(){const e=yield c.getPlugin("PulseStats").getTracker();null==e||e.update({provider:{id:"e24",productTag:"partnerstudio"}})}))})}getPulseObjectId(){return"sdrn:e24:content:partnerstudio:element:partnerstudio:stats"}getPulsePageId(e,t){return e===kn.FRONT?"sdrn:e24:frontpage:front":`sdrn:e24:article:${t}`}getTags(e){var t;let n;if(n=e instanceof HTMLAnchorElement?e.href:null===(t=null==e?void 0:e.querySelector("a"))||void 0===t?void 0:t.href,!n)return[];if(!n.includes("https://e24.no/annonsorinnhold/"))return[n];const{pathname:i}=new URL(n),r=i.split("/").filter(Boolean);return r.length?[...r.slice(1),n]:[n]}createPlayerOverlay(e){const t=document.createElement("div");t.classList.add("cm-custom-video-overlay"),e.parentElement&&(t.innerHTML=e.parentElement.innerHTML,e.parentElement.replaceChild(t,e));return t.addEventListener("click",e=>{e.stopPropagation(),e.preventDefault(),t.classList.add("has-interacted")}),t}}const Nn="https://www.aftonbladet.se/video-player-extras/latest/";class jn{handleVideo(t,n){return e(this,arguments,void 0,function*(e,{videoConfiguration:{id:t,node:n,autoplay:i,mute:r,vendor:o}}){const s={id:t,node:n,autoplay:i,mute:r,vendor:o,autopause:"viewable",maxBitrate:600,pulse:{provider:"aftonbladet"},recommended:{autoplay:!1,next:{countdown:10}},skin:{name:"",url:""},plugins:{[`${Nn}cta-button.js`]:{name:"CtaButton",options:{type:"unmute"}},[`${Nn}external-link.js`]:{name:"ExternalLink"}}};yield On(s),this.addEditionVideoClass(e)})}addEditionVideoClass(e){var t;(null===(t=null==e?void 0:e.parentElement)||void 0===t?void 0:t.parentElement)&&e.parentElement.parentElement.classList.add("dr-edition-video-player")}getPulseObjectId(){return""}getPulsePageId(){return""}}class _n{handleVideo(e,t){}getPulseObjectId(){return""}getPulsePageId(e,t){return""}}const Dn=(e,t,n)=>{const{publisher:i,pageType:r,country:o}=e,s={[Mt.VG]:new bn,[Mt.E24]:new xn,[Mt.AFTONBLADET]:new jn}[i]||new _n,a=new(o===P.SE?An:Cn)(n,s,r),d=new wn(t,null==n?void 0:n.pulseTracker),l=new In(s,a),c=new Tn(s);return new En(d,l,c,a)},qn=(e,t,n)=>{const{wrapperSelector:i}=null==e?void 0:e.drEditionConfig,r=document.querySelectorAll(i),o=new IntersectionObserver((i,r)=>((e,t,n,i,r)=>{const o=Dn(n,i,r);e.forEach(e=>{var i,r,s;if(!e.isIntersecting)return;const a=e.target,d=null!==(i=a.dataset.editionName)&&void 0!==i?i:"",l=null!==(r=a.dataset.pulseColumnname)&&void 0!==r?r:"",c=null!==(s=a.dataset.pulsePrimaryposition)&&void 0!==s?s:"";o.fetchAndRenderAd(a,Object.assign(Object.assign({},n),{editionName:d,columnName:l,primaryPosition:c})),t.unobserve(a)})})(i,r,e,t,n),{rootMargin:"400% 0px"});r.forEach(e=>o.observe(e))},Mn=[],Rn=(n,i)=>e(void 0,void 0,void 0,function*(){var e;const{pulse:r,tcf:o,deviceType:s,drEdition:a,publisher:d,pageType:l,country:c}=n,u=((e,t)=>{var n;const{deviceType:i,placements:r,drEdition:{fallbackGlobalEditionName:o}={}}=e,s=r[i]||r.desktop,a=ze(t.targetId),d=s.find(e=>e.id===a),l=fn.some(e=>a.startsWith(e)),c=Mn.includes(a),u=(null===(n=null==d?void 0:d.drEdition)||void 0===n?void 0:n.editionName)||o;return d&&l&&!c&&u?(Mn.push(a),Object.assign(Object.assign({},d),{drEdition:Object.assign(Object.assign({},d.drEdition),{editionName:u})})):null})(n,i);if(!u)return;if(!(null==r?void 0:r.instance))return void t("Pulse has not been passed as a prop, aborting");const v=yield R(),p=new B(v),g=Dn({publisher:d,pageType:l,country:c},p,null==r?void 0:r.instance),h=document.getElementById(i.targetId);if(!h||!a)return;h.classList.value="";const m=document.createElement("div");m.className=a.containerSelector.replace(/^[.#:[\]]+/,""),h.innerHTML=m.outerHTML;const y={editionName:(null===(e=null==u?void 0:u.drEdition)||void 0===e?void 0:e.editionName)||"",drEditionConfig:a,device:s,tcf:o,renderAsBackfill:!0};yield g.fetchAndRenderAd(h,y)}),Bn="collapseAd",Fn="hideAd",Hn="resizeAd",Un="renderDrEditionFallback",Vn="wallpaperImageUrl",Wn="wallpaperColor",zn=[Hn,Vn,Wn,Bn,Fn,Un],Kn=e=>{if("object"==typeof e)return e;if(t=e,Qe.test(t)){const t=e.replace(/^wallpaper:url:/,"");return{name:Vn,wallpaperImageUrl:t}}var t;if((e=>e.startsWith("wallpaper:color:"))(e)){const t=e.replace(/^wallpaper:color:/,"");return{name:Wn,wallpaperColor:t}}if(e.startsWith(Un)){const t=e.split(":")[1];return{name:Un,targetId:t}}if(e.startsWith(Bn)||e.startsWith(Fn)){const t=e.split(":")[1];return{name:Bn,targetId:t}}if(e.includes("name")&&zn.some(t=>e.includes(t)))try{return JSON.parse(e)}catch(e){}},Gn=e=>{if(!["http://acdn.adnxs-simple.com","https://acdn.adnxs-simple.com","https://crcdn01.adnxs-simple.com","http://crcdn01.adnxs-simple.com","https://acdn.adnxs.com","http://acdn.adnxs.com","https://adsdk.microsoft.com","https://adsdk.bing.net","https://adsdkprod.azureedge.net"].includes(e.origin.trim()))return;const{data:t}=e;if(!t)return;const n=Kn(t);if(!n)return;if(!n.name||!zn.some(e=>n.name===e))return;const{name:i,targetId:r,wallpaperImageUrl:o,wallpaperColor:s,cmd:a,size:d}=n;i!==Bn&&i!==Fn||!r||Xe(r),i===Hn&&r&&a&&yn(r,a),i===Un&&r&&(Xe(r),Rn(g.get(),{targetId:r})),"resizeMediationAd"===i&&r&&d&&yn(r,d,!0),i===Vn&&o&&(e=>{const t=document.querySelector(`.${Je}`);t&&(t.style.backgroundImage=`url(${e})`)})(o),i===Wn&&s&&(e=>{const t=document.querySelector(`.${Je}`);t&&(t.style.backgroundColor=e)})(s)},Jn=e=>({rootMargin:`${e}px 0px ${e}px 0px`}),Yn=(n,i)=>{if(xe(i))return t(`loading finn blink ad with full ads chain for ${i}`),void(()=>{const{publisher:t,country:n,finnBlink:i}=g.get(),{loadFinnBlinkAd:r,wallpaperHandlers:{adjustAdToHorseshoe:o}}=g.getHandlers(),s=window.apntag,a={publisher:t,country:n,finnBlink:i},d=e=>{Ze(e),Ue(()=>s.showTag(e))};return{withXandrAd:d,withFinnBlinkAd:t=>e(void 0,void 0,void 0,function*(){yield r(t,a,null)}),withFullAdsChain:t=>e(void 0,void 0,void 0,function*(){yield r(t,a,d,()=>{tt.getData("horseshoe").isAvailable&&o(t)})})}})().withFullAdsChain(i);Ue(()=>(t("core showTag",{id:i}),n.showTag(i)))},Qn=(n,i)=>e(void 0,void 0,void 0,function*(){yield Ve,yield We;const e=new IntersectionObserver((e,n)=>((e,n,i)=>{e.filter(({isIntersecting:e,target:{id:t}})=>e&&!t.includes("wallpaper")).forEach(e=>{const{target:r}=e,o=(e=>{const t=e.dataset.showTagSubscribeId;return!e.id.length&&t?t:e.id})(r),s=document.getElementById(o);t("core log from intersection observer handler",{targetId:o,element:s}),i(window.apntag,o),s&&(n.unobserve(s),n.disconnect())})})(e,n,Yn),Jn(i));e.observe(n)}),Xn=new Map,Zn=["no-stavangeraftenblad","sa","no-aftenposten","aftenposten","no-bergenstidende","bt"],ei=".brandstudio-premium-content-widget",ti=({adWrapper:e,placementContainer:t})=>t.offsetHeight+(({adWrapper:e})=>{const{paddingTop:t,paddingBottom:n}=getComputedStyle(e);return parseFloat(t)+parseFloat(n)})({adWrapper:e}),ni=({adWrapper:e,placementContainer:t})=>{const n=ti({adWrapper:e,placementContainer:t});var i;null==e||e.style.setProperty("height",`${n}px`),it(i=t),i.innerHTML=""},ii=e=>{e&&e.style.getPropertyValue("height")&&e.style.removeProperty("height")},ri=({adWrapper:e,placementContainer:t})=>{const{publisher:n}=g.get(),i=Zn.includes(n)&&Boolean(t.closest(ei));const r=i?t.closest(ei):null,o=new MutationObserver(t=>{t.forEach(({addedNodes:t})=>{t.forEach(t=>{const n=t instanceof HTMLElement,s=n&&t.matches("iframe, article")&&e;if(!n||!i&&!s||i&&!r)return;if(s)return ii(e),void o.disconnect();const a=t.closest('[style*="height"]'),d=r;a&&d.contains(a)?ii(a):d.hasAttribute("style")&&ii(d),o.disconnect()})})});try{o.observe(t,{childList:!0,subtree:!0})}catch(e){o.disconnect()}},oi=(e,t,n,i,r,o)=>{var s;const a=performance.now(),d=null!==(s=Xn.get(t))&&void 0!==s?s:0,l=((e,t)=>!!t&&e+t<(new Date).getTime())(i,r)&&n<0;a-d>=r&&l&&(Xn.set(t,a),((e,t,n)=>{const i=null==n?void 0:n.parentElement;i&&n&&ni({adWrapper:i,placementContainer:n}),Ue(()=>{e.setKeywords([t],{[`${Z()}-adreload`]:"1"},{overrideKeyValue:!0}),e.refresh([t])})})(e,t,o))},si=(e,t,n,i)=>{const r=new IntersectionObserver((e,t)=>((e,t,n,i)=>{e.filter(({isIntersecting:e})=>e).forEach(e=>{const{target:r,boundingClientRect:o}=e;t(window.apntag,r.id,o.y,n,i,r)})})(e,oi,n,i),Jn(t));r.observe(e)},ai=(e,t=6)=>{const n=[];for(let i=0;i<e.length;i+=t){const r=e.slice(i,i+t);n.push(r)}return n},di=()=>navigator&&navigator.userAgent.match(/chrome/i)?null:navigator&&navigator.userAgent.match(/apple/i),li=(e,t)=>{if(!(null==t?void 0:t.scrollRefreshEnabled))return;const{targetId:n}=e,i=document.querySelector(`#${n}`),r=null==i?void 0:i.parentElement;if(!r||!i)return;ri({adWrapper:r,placementContainer:i});const{delayTime:o=1e3}=t,s=(new Date).getTime();if(i&&"true"!==i.dataset.subscribedForRefresh){const e=(e=>{var t;const{deviceType:n,preloadMarginsConfig:i}=g.get(),r=null==i?void 0:i[n];return((e,t)=>t[e])(null!==(t=e.dataset.priority)&&void 0!==t?t:"normal",(({high:e,normal:t,low:n}={})=>{var i,r,o,s,a,d;return{high:{refreshMargin:null!==(i=null==e?void 0:e.refreshMargin)&&void 0!==i?i:600,renderMargin:null!==(r=null==e?void 0:e.renderMargin)&&void 0!==r?r:300},normal:{refreshMargin:null!==(o=null==t?void 0:t.refreshMargin)&&void 0!==o?o:300,renderMargin:null!==(s=null==t?void 0:t.renderMargin)&&void 0!==s?s:150},low:{refreshMargin:null!==(a=null==n?void 0:n.refreshMargin)&&void 0!==a?a:100,renderMargin:null!==(d=null==n?void 0:n.renderMargin)&&void 0!==d?d:50}}})(r)).refreshMargin})(i);i.dataset.subscribedForRefresh="true",i.dataset.refresh&&si(i,e,s,o)}},ci=e=>{const{refreshConfig:{visibilityStateRefreshEnabled:t=!1}={}}=g.get();if(!t)return;const n=()=>{"visible"===document.visibilityState&&document.removeEventListener("visibilitychange",n),vi(e)};"visible"!==document.visibilityState&&document.addEventListener("visibilitychange",n)},ui=e=>{const{refreshConfig:{backForwardNavigationRefreshEnabled:t=!1}={},siteSpecificConfig:{classesToRemoveOnRefresh:n=[]}={}}=g.get();if(!t)return;e.forEach(({id:e})=>{var t;const n=null===(t=document.querySelector(`#${e}`))||void 0===t?void 0:t.parentElement;n&&(n.dataset.bfCacheRefresh="true")});const i=()=>{const t=document.querySelectorAll('[data-bf-cache-refresh="true"]');for(const i of t){const t=e.find(e=>{var t;return e.id===(null===(t=i.firstElementChild)||void 0===t?void 0:t.id)&&e.bfCacheRefresh}),r=null==t?void 0:t.threshold;Nt(i,r)&&t&&(nt(t.id),n.length&&i.classList.remove(...n),vi([t]))}};window.addEventListener("pageshow",e=>{const t=()=>{window.scrollY>0&&(window.removeEventListener("scroll",t),i())};e.persisted&&(di()?window.addEventListener("scroll",t,{passive:!0}):i())})},vi=e=>{const t=6,{requestSize:n=t}=g.get(),i=e.map(({id:e})=>e),r=ai(i,n);for(const e of r)Ue(()=>window.apntag.refresh(e))};const pi="#fff",gi="#0098da",hi=(e,t=!0)=>{(e===vt||e===pt)&&(e=>{e?setTimeout(()=>window.scrollTo(0,0),100):window.scrollTo(0,10)})(t)},mi=()=>{const e=parseInt(document.body.dataset.scrollY||"0",10);document.body.style.top="",window.scrollTo(0,e),document.body.classList.remove("page-locked")},yi=e=>{document.body.style.overflow=e?"initial":"hidden"},fi=e=>{const t=bi(e),n=wi(e);(e=>{e.classList.toggle("takeover-ad-hidden",!0)})(e),yi(!0),e.style.display="none",window.removeEventListener("keydown",t),window.removeEventListener("advertory:closeTakeover",n)},wi=e=>{const t=()=>fi(e);return window.addEventListener("advertory:closeTakeover",t),mi(),t},bi=e=>{const t=t=>{["Enter","Escape"].includes(t.key)&&fi(e)};return mi(),window.addEventListener("keydown",t),t},Ei=e=>{const t=e.querySelector(".advertory-splash-navbar-wrapper");t&&(bi(e),wi(e),t.addEventListener("click",()=>{fi(e),mi()}),yi(!1))},Ii=e=>{(e=>{window.addEventListener("scroll",()=>{e.getBoundingClientRect().bottom,(e=>{const t=e.getBoundingClientRect().bottom;e.style.opacity=""+t/e.offsetHeight})(e)},{passive:!0})})(e),wi(e);const t=document.querySelector("header");document.querySelectorAll(".smooth-close-takeover").forEach(e=>e.addEventListener("click",()=>null==t?void 0:t.scrollIntoView({behavior:"smooth"})))},Ti=e=>{const{takeover:{splash:{showAnnonsLabel:t=!1}={}}={}}=g.get(),n=e.querySelectorAll(".advertory-splash-navbar-wrapper"),i=document.querySelector(".advertory-takeover-label");Array.from(n).forEach(e=>e.style.display="flex"),t&&i&&(i.style.display="flex",i.innerText=cn.se.adText),e.classList.toggle("advertory-splash-wrapper",!0)},Si=e=>{const t=document.querySelectorAll(".advertory-topscroller-elements");Array.from(t).forEach(e=>e.style.display="flex");const n=document.querySelector(".advertory-takeover-label");n&&(n.style.display="flex",n.innerText=cn.no.adText,n.classList.add("takeover-topscroller-label"),e.classList.toggle("topscroller-wrapper",!0))},Ai=e=>{const t=document.querySelectorAll(".advertory-welcome-page-elements");Array.from(t).forEach(e=>{e.style.display="flex",e.style.animation="elementsAnimation 1.5s ease-out forwards"});const n=document.querySelector(".advertory-takeover-label");n&&(n.style.display="flex",n.innerText=cn.se.adText,e.classList.toggle("welcome-page-wrapper",!0))},Ci=()=>{const e=document.querySelector(".welcome-page-wrapper, .topscroller-wrapper, .advertory-splash-wrapper");if(!e)return;let t=0;new IntersectionObserver(e=>{e.forEach(e=>{var n;if(e.isIntersecting){window.dispatchEvent(new CustomEvent("advertory:takeoverInView"));(null!==(n=Array.from(e.target.classList))&&void 0!==n?n:[]).includes("advertory-splash-wrapper")&&(()=>{const e=window.scrollY||0;document.body.dataset.scrollY=e.toString(),document.body.style.top="0",document.body.classList.add("page-locked"),document.documentElement.scrollTop=0})(),t++}else t>0&&window.dispatchEvent(new CustomEvent("advertory:takeoverNotInView"))})},{root:null,rootMargin:"0px",threshold:0}).observe(e)},ki=(e,t)=>{let n=e;return e.includes("529299503")&&(n=(e=>{const t=document.createElement("script");return t.textContent=`(${St})()`,e+t.outerHTML})(e)),n},Pi=e=>{const t=(e=>{const{requests:t}=window.apntag,n=Qt(e)?1:0;return null==t?void 0:t.tags[e].adResponse.ads[n].rtb.banner.content})(e);if(!t)return;((e,t)=>{const{requests:n}=window.apntag,i=Qt(e)?1:0;n&&(n.tags[e].adResponse.ads[i].rtb.banner.content=t)})(e,ki(t))},Oi=(e,t)=>{const{takeover:n}=g.get(),{targetId:i}=e,r=document.querySelector(`#${i}`),o=document.querySelector(".advertory-takeover-wrapper");if(!r||!o||!n)return;const s=(e=>{const{width:t,height:n}=e;return ft(t,n)?ut:wt()?pt:vt})(e),a=o.offsetHeight,d=window.scrollY>a;var l,c;o.style.display="block",!d&&hi(s,!1),((e,t)=>{({[vt]:Ai,[ut]:Ti,[pt]:Si})[t](e)})(o,s),Ci(),l=o,c=s,{[vt]:Ii,[pt]:Ii,[ut]:Ei}[c](l),((e,t,n)=>{if(!n)return;({[vt]:()=>{const{buttonLabel:i}=It(n,t);["#advertory-welcome-page-scroll-label","#advertory-welcome-page-scroll-image"].forEach(t=>{const n=e.querySelector(`${t}`);n&&(n.innerText=null!=i?i:"")})},[ut]:()=>{const{themeColors:i,logotype:r,buttonLabel:o,showArrowIcon:s}=It(n,t);["#advertory-splash-close-label",".advertory-splash-close","#advertory-splash-logotype",".advertory-splash-navbar-wrapper"].forEach(t=>{const n=e.querySelector(`${t}`);if(n){if("#advertory-splash-close-label"===t&&(n.innerText=null!=o?o:""),".advertory-splash-close"===t&&s){const e=document.createElement("img");e.setAttribute("src","data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAAfQAAAH0Bx0gPAAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAABzSURBVDiNtdPJCYBADEDRzzRmE3ZgEV6tRHHpzELiIQrBZRajA7lk4EE2RIQjgApYgdbmY8EJaADZo3sDBKAvQa4JRYZc5D6pyJiDPMuKTCkkXp8icwxJd1mRxSC1/Q94328luJroGqNrkdyrzAfHVHzOG+8CKlLk+LO+AAAAAElFTkSuQmCC"),e.setAttribute("alt","close ad"),n.appendChild(e)}if("#advertory-splash-logotype"===t&&r&&(n.setAttribute("src",r.url),n.setAttribute("alt",r.alt)),".advertory-splash-navbar-wrapper"===t&&i){const{backgroundColor:e,color:t}=i;n.style.setProperty("background-color",null!=e?e:pi,"important"),n.style.color=null!=t?t:gi}}})},[pt]:()=>{const{buttonLabel:i,showArrowIcon:r,showCloseButton:o=!0}=It(n,t);["#advertory-topscroller-scroll-label","#advertory-topscroller-scroll-image",".advertory-topscroller-close"].forEach(t=>{const n=e.querySelector(`${t}`);n&&(".advertory-topscroller-close"!==t||o||(n.style.display="none"),"#advertory-topscroller-scroll-image"!==t||r||(n.style.display="none"),"#advertory-topscroller-scroll-label"===t&&(n.innerText=null!=i?i:""))})}})[t]()})(o,s,n),bt(),!d&&hi(s,!0),Tt(e,s)},$i="advertory-brandmetrics-survey",Li=()=>e(void 0,void 0,void 0,function*(){const{norstat:{enabled:t}={},country:n,isMobileApp:i}=g.get();if(!t||i)return;const r=(e=>{const{ppid1:t,ppid2:n}=de.getPPIDs(),{ppid1:i,ppid2:r}=le.getPPIDs(),o=(new ae).add(n,$[e]).add(t,L[e]).add(r,x[e]).add(i,N[e]);return`${o.buildNorstatPath()}?${o.buildNorstatQuery("alias").toString()}`})(n);((t,n,...i)=>{e(void 0,[t,n,...i],void 0,function*(e,t,n=!0){if(document.getElementById(t))return;const i=document.createElement("img");i.src=e,i.id=null!=t?t:"",n&&(i.style.display="none"),document.body.appendChild(i)})})(`https://sch-map.norstatsurveys.com/api/nids/${n===P.NO?"schibsted":"schibstedse"}/map/${r}`,"norstat")}),xi=(e,t)=>t?Object.assign(Object.assign({},e),{"aa-sch-ssa-native-ad":"true","aa-sch-ssa-format":"NATIVE_CONTENT","aa-sch-ssa-market":"XNO","aa-sch-ssa-cat":["ssa_1","ssa_2","ssa_3","ssa_4","ssa_5","ssa_6","ssa_7","ssa_8","ssa_9","ssa_10","ssa_11","ssa_12","ssa_13","ssa_14","ssa_15","ssa_16","ssa_17","ssa_18","ssa_19","ssa_20","ssa_21","ssa_22","ssa_23","ssa_24","ssa_25","ssa_26","ssa_27","ssa_28","ssa_29","ssa_30"]}):e,Ni=e=>`externalImpId:'${e}'`,ji=e=>{var n;const{forwardExternalImpId:i=!1,tracker:r}=g.get(),{id:o,sizes:s,keywords:a,allowedFormats:d,invCode:l,ssa:c=!1,nativeCustomProperties:u,safeframeConfig:v,resizeAdParentDiv:p=!1,dynamicSizeWidthCheck:h=!1}=(e=>{var t;if(!e.positionConfig)return e;const n=e.keywords[`${ee()}-count`],i=e.positionConfig.find(e=>e.adPositionIndex===n);if(!i)return e;const r=i.keywords?Object.assign(Object.assign({},e.keywords),i.keywords):e.keywords;return Object.assign(Object.assign({},e),{sizes:null!==(t=null==i?void 0:i.sizes)&&void 0!==t?t:e.sizes,keywords:r})})(e),m=Object.assign({invCode:l,sizes:s,targetId:o,keywords:xi(a,c),allowedFormats:d,resizeAdParentDiv:p,dynamicSizeWidthCheck:h},v&&{safeframeConfig:v}),y=(e=>{var n,i,r,o,s,a,d;return e?(null===(n=null==e?void 0:e.instance)||void 0===n?void 0:n.state)?(null===(r=null===(i=null==e?void 0:e.instance)||void 0===i?void 0:i.state)||void 0===r?void 0:r.pageViewId)?(t("Tracker state pageViewId is:",null===(s=null===(o=null==e?void 0:e.instance)||void 0===o?void 0:o.state)||void 0===s?void 0:s.pageViewId),null===(d=null===(a=null==e?void 0:e.instance)||void 0===a?void 0:a.state)||void 0===d?void 0:d.pageViewId):(t("Tracker state does not contain field pageViewId or it is empty"),""):(t("Tracker state is empty"),""):(t("Tracker is not configured in initAdvertory function"),"")})(r);i&&y&&(t("External Impression ID assigned to defineTag:",Ni(y)),m.externalImpId=Ni(y));const f=(e=>Object.entries({video:{required:!1},address:{required:!1},saleprice:{required:!1},rating:{required:!1},price:{required:!1},phone:{required:!1},likes:{required:!1},downloads:{required:!1},customIcon2:{required:!1}}).reduce((t,[n,i])=>((null==e?void 0:e.includes(n))&&(t[n]=i),t),{customTitle1:{required:!1},customTitle2:{required:!1},customTitle3:{required:!1},customTitle4:{required:!1},title:{required:!1},body:{required:!1},image:{required:!1},icon:{required:!1},sponsoredBy:{required:!1},cta:{required:!1},clickUrl:{required:!1},desc2:{required:!1},displayUrl:{required:!1},description:{required:!1}}))(u);return(null===(n=e.allowedFormats)||void 0===n?void 0:n.includes("native"))&&(m.native=f),m},_i="native-ad",Di=e=>{if(!e)return e;const t=e[`${Z()}-targetid`],n=t?ze(t[0]):"";return Object.assign(Object.assign({},e),t&&{[`${Z()}-targetid`]:[n]})},qi=e=>Object.assign(Object.assign(Object.assign(Object.assign({},e),e[`${Z()}-geo`]&&{[`${Z()}-geo`]:["geo-test-value"]}),e[`${Z()}-geofence`]&&{[`${Z()}-geofence`]:["geofence-test-value"]}),e[`${Z()}-weather`]&&{[`${Z()}-weather`]:["weather-test-value"]}),Mi=e=>{(e=>{const t=new URLSearchParams(window.location.search);if("true"!==t.get("scrollToFirstInvCode"))return;const n=t.get("ast_override_inv_code");if(!n)return;const i=n.split(",")[0].split(":")[0],r=e.find(e=>e.invCode===i),o=document.querySelector(`[id^=${null==r?void 0:r.id}]`);o&&o.scrollIntoView({behavior:"smooth",block:"start"})})(e),(()=>{var e;const t=new URLSearchParams(window.location.search).get("scrollToDrEditionPlacement");if(!t)return;const n=null!==(e=document.querySelector(`[id*="${t}}"]`))&&void 0!==e?e:document.querySelector(`a[aria-label*="${t}"]`);n&&n.scrollIntoView({behavior:"smooth",block:"start"})})()},Ri=()=>e(void 0,void 0,void 0,function*(){try{(()=>{const e=document.createElement("script");e.setAttribute("src","https://ads.inventory.schibsted.io/ad-service/ad-banner-sponsor-advertisement/ad.js"),e.setAttribute("type","text/javascript"),e.setAttribute("async","true"),document.head.appendChild(e)})(),(()=>{const e=document.createElement("div");e.setAttribute("id","ads-advertory-anchor"),e.classList.add("subscribe_box"),e.classList.add("ad-box"),e.classList.add("leftAd"),e.classList.add("netboard"),e.classList.add("advert"),e.classList.add("module"),e.classList.add("banner"),e.classList.add("leaderboard"),e.classList.add("adsbygoogle"),e.classList.add("ad-banner"),e.classList.add("ad-container"),e.classList.add("adsbox"),e.classList.add("sidebar-ads"),e.classList.add("banner-ads"),e.style.opacity="0",e.style.width="1px",e.style.height="1px",e.style.minWidth="0px",e.style.minHeight="0px",e.style.maxWidth="1px",e.style.maxHeight="1px",e.style.position="absolute",e.style.top="0",e.style.boxSizing="border-box",e.style.margin="0",e.style.padding="0",document.body.appendChild(e)})()}catch(e){console.error("Error running adblock scripts:",e)}}),Bi={arrayMerge:(e,t)=>t},Fi=n=>e(void 0,void 0,void 0,function*(){if(!(e=>{const{editableConfiguration:{useS3Config:t=!1,pageTypeToFetch:n}={},siteSpecificConfig:i}=e;return Boolean(t&&n&&(null==i?void 0:i.publisherClassName))})(n))return n;try{const i=yield(n=>e(void 0,void 0,void 0,function*(){const e=(e=>{const{siteSpecificConfig:t,editableConfiguration:{pageTypeToFetch:n}={}}=e;return(null==t?void 0:t.publisherClassName)&&n?`https://alertory-cdn.staging.inventory.schibsted.io/editable-configurations/${t.publisherClassName}/${n.toUpperCase()}.json`:null})(n);if(!e)return null;const i=new AbortController,r=setTimeout(()=>i.abort(),5e3);try{return yield W.get(e,{method:"GET",signal:i.signal})}catch(n){throw t("Failed to fetch S3 config",{error:n,url:e}),n}finally{clearTimeout(r)}}))(n);return i?(({siteConfig:e,configOverrides:t})=>{var n;const{keywords:i,refresh:r,placements:o,threshold:s,batchSize:a}=t,d=l.all([e.placements,o],Bi),c=l(e.pageOptions,{keywords:i},Bi),u=l(e.appearanceConfig,{defaultThreshold:s},Bi),v=l(null!==(n=e.refreshConfig)&&void 0!==n?n:{},{scrollRefreshEnabled:r},Bi);return Object.assign(Object.assign({},e),{placements:d,requestSize:null!=a?a:e.requestSize,pageOptions:c,appearanceConfig:u,refreshConfig:v})})({siteConfig:n,configOverrides:i}):n}catch(e){return t("Error fetching S3 config, using site config",{error:e}),n}});let Hi,Ui=[];const Vi=e=>{const t=(e=>{const t=tt.getData("alertoryConfigKeywords"),{queryConfig:n,placements:i,tcf:r,glimr:o,appearanceConfig:s,requestSize:a=v,publisher:d,country:l,pageType:c,deviceType:u,isMobileApp:p=!1,pageOptions:{member:g},takeover:h,fullscreenScroll:m}=e;return{xandr:{member:g,keywords:t,tags:[]},advertory:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({publisher:d,country:l,pageType:c,deviceType:u,placements:i,tcf:r,requestSize:a,isMobileApp:p},o&&{glimr:o}),n&&{queryConfig:n}),s&&{appearanceConfig:s}),h&&{takeover:h}),m&&{fullscreenScroll:m})}})(e);window.advertory={initialized:!0,siteConfig:e,alertoryConfig:t}},Wi=()=>e(void 0,void 0,void 0,function*(){const{pageOptions:e}=g.get(),{preparePageOptions:t}=g.getHandlers(),n=(()=>{const{sandboxAdIframeEnabled:e=!0}=g.get();return{sandboxAdIframe:e,sandboxAttributes:["allow-same-origin","allow-scripts","allow-top-navigation-by-user-activation","allow-popups","allow-popups-to-escape-sandbox","allow-forms"]}})(),i=yield t(Object.assign(Object.assign({disablePsa:!0,enableSafeFrame:!0},e),{renderingManagement:Object.assign({},n)}));(e=>{const t=tt.getData("alertoryConfigKeywords");if(Object.keys(t).length)return;const n=qi(e);tt.setData("alertoryConfigKeywords",n)})(i.keywords),Ue(()=>Hi.setPageOpts(i))}),zi=e=>{const{prebid:n}=g.get();Ki(e),(null==n?void 0:n.enabled)?(t("core loadPlacements prebid enabled"),Gt()):(t("core load tags invoked without prebid enabled"),Gi(e))},Ki=e=>{const{prepareTag:n}=g.getHandlers(),i=[];(e=>{const t=["skyscraperright_1","topboard","wallpaper","skyscraperleft_1"];return e.sort((e,n)=>{const i=t.findIndex(t=>e.id.includes(t)),r=t.findIndex(e=>n.id.includes(e));return-1!==i&&-1===r?-1:-1===i&&-1!==r?1:i-r})})(e).forEach(e=>{t("core defineTags",{placement:e});const r=ji(e);if(!e.id.includes("takeover")||mt()){const o=n(r),s=(e=>{const{allowedFormats:t,invCode:n,keywords:i,sizes:r}=e;return{adTypes:t,invCode:n,keywords:Di(i),sizes:r}})(o);i.push(s),Ue(()=>(t("core defineTag - add to the queue",{placement:e,preparedTag:o}),Hi.defineTag(o)))}}),(e=>{var t,n,i;(null===(i=null===(n=null===(t=window.advertory)||void 0===t?void 0:t.alertoryConfig)||void 0===n?void 0:n.xandr)||void 0===i?void 0:i.tags)&&e.length&&window.advertory.alertoryConfig.xandr.tags.push(e)})(i)},Gi=e=>{const n=e.map(({id:e})=>e);Ue(()=>(t("core loadTags",{placementsIdsToLoad:n}),Hi.loadTags([...n])))},Ji=(n,i)=>e(void 0,void 0,void 0,function*(){const{appearanceConfig:e,deviceType:r}=g.get(),{threshold:o,refresh:s,priority:a="normal"}=n,d=(e=>{const t=document.querySelector(`[data-show-tag-subscribe-id=${e.targetId}]`),n=document.querySelector(`#${e.targetId}`);return t||n})(i),l=null==e?void 0:e.defaultThreshold[r];d&&(t("core showAd - subscribe for show tag with thresholds",{placement:n,adObj:i,threshold:o,deviceDefaultThreshold:l}),yield Qn(d,null!=o?o:l)),d&&s&&(t("core showAd - setup refreshing",{placement:n,adObj:i}),d.dataset.refresh=s.toString(),d.dataset.priority=a)}),Yi=t=>e(void 0,void 0,void 0,function*(){var e;if(!(null===(e=null===window||void 0===window?void 0:window.advertory)||void 0===e?void 0:e.initialized))return;const n=6,{requestSize:i=n}=g.get(),r=ct(t);for(const e of Object.keys(r)){const t=r[e];t.length&&Qi(t,i)}}),Qi=(e,n)=>{const i=ai(e,n);for(const e of i)t("core loadAds with lazy loading",{placementsToLoad:e}),Xi(e)},Xi=e=>{const{queryConfig:{lazyLoadingV3:{enabled:n=!1,rootMargin:i="200% 0px"}={}}={}}=g.get(),r=[];if(!n)return t("lazy load is not enabled",{placements:e}),void zi(e);const o=new IntersectionObserver((n,i)=>{n.filter(({isIntersecting:e,target:{id:t}})=>e&&!t.includes("wallpaper")).forEach(n=>{t("lazy load is enabled - handler start",{loadedPlacementIds:r,placements:e});const o=e.every(e=>r.includes(e.id)),s=e.map(e=>e.id);!o&&r.push(...s),!o&&zi(e),t("lazy load is enabled - handler stop",{loadedPlacementIds:r,placements:e,arePlacementsLoaded:o,placementIds:s}),i.disconnect()})},{rootMargin:i});e.forEach(e=>{const n=document.getElementById(e.id);n&&(t("lazy loading - observe element",{placementId:e.id,element:n}),o.observe(n))})},Zi=()=>e(void 0,void 0,void 0,function*(){const{siteEvents:n,initNativeAd:i,wallpaperHandlers:{initWallpaperAd:r,adjustAdToHorseshoe:o}}=g.getHandlers(),{wallpaper:s,fullscreenScroll:a}=g.get(),d=[];Ue(()=>{Hi.onEvent("adRequested",()=>{n.adRequested()}),Hi.onEvent("adAvailable",o=>e(void 0,void 0,void 0,function*(){var e,d,l,c,u,v;t("core adAvailable start",{placementsAvailable:Ui,adObj:o,isFullscreenScrollAd:Se(o),isFinnBlink:xe(o.targetId),isNativeAd:Ae(o),isMediation:Rt(o),isTakeoverAd:ke(o),isCollapseAd:$e(o),isWallpaperAd:Oe(o)});const p=null===(l=null===(d=null===(e=null===window||void 0===window?void 0:window.apntag)||void 0===e?void 0:e.requests)||void 0===d?void 0:d.tags[o.targetId])||void 0===l?void 0:l.adResponse.ads;Rt(o)&&p&&(null===(c=p[1])||void 0===c?void 0:c.rtb)&&(o.banner=null===(v=null===(u=p[1])||void 0===u?void 0:u.rtb)||void 0===v?void 0:v.banner),Se(o)&&mn(o),Se(o)&&!xe(o.targetId)&&hn(o,a),!Ae(o)||Rt(o)||xe(o.targetId)||i(o,g.get()),ke(o)&&!$e(o)&&(Pi(o.targetId),Oi(o)),Oe(o)&&(r(()=>Ue(()=>window.apntag.showTag(o.targetId)),s),tt.setData("wallpaper",{isAvailable:!0})),(e=>e.targetId.includes("skyscraperleft")&&!!e.banner)(o)&&tt.setData("horseshoe",{isAvailable:!0}),Ct({adObj:o}),n.adAvailable(o);const h=Ui.find(({id:e})=>e===o.targetId);h&&(yield Ji(h,o),Ui=Ui.filter(e=>e.id!==h.id)),t("core adAvailable stop",{placementsAvailable:Ui,adObj:o,isFullscreenScrollAd:Se(o),isFinnBlink:xe(o.targetId),isNativeAd:Ae(o),isMediation:Rt(o),isTakeoverAd:ke(o),isCollapseAd:$e(o),isWallpaperAd:Oe(o)})})),Hi.onEvent("adLoaded",e=>{const{refreshConfig:t,appearanceConfig:r}=g.get(),s=document.getElementById(e.targetId);xe(e.targetId)&&(e=>{const{fullscreenScroll:t}=g.get(),{initNativeAd:n}=g.getHandlers();Se(e)&&hn(e,t),Ae(e)&&n(e,g.get())})(e);d.includes(e.targetId)&&Ae(e)&&(i(e,g.get()),Ct({adObj:e})),!d.includes(e.targetId)&&Rt(e)&&d.push(e.targetId),$e(e)&&Xe(e.targetId),ke(e)&&((e,t)=>{var n;const i="100%",r="100%";e.resizeAd(t,[i,r]);const o=null===(n=document.querySelector(`#div_utif_${t}`))||void 0===n?void 0:n.querySelector("iframe");if(!o)return;new MutationObserver(e=>{for(const t of e)if("attributes"===t.type&&"style"===t.attributeName){const e=window.getComputedStyle(o),t=e.width,n=e.height;t===i&&n===r||(o.style.width=i,o.style.height=r)}}).observe(o,{attributes:!0,attributeFilter:["style"]})})(Hi,e.targetId),Ce(e)&&(e=>{const t=document.querySelector(`#${e.targetId}`),{siteSpecificConfig:{publisherClassName:n,fullWidthFormatClassName:i}={}}=g.get();if(!t||!n||!i)return;const r=t.parentElement;r&&(t.classList.add(`advertory-${n}-${i}__full-width-ad`),r.classList.add(`advertory-${n}-${i}-wrapper__full-width-ad`))})(e),(e=>Re(e,ye))(e)&&(e=>{const t=document.querySelector(`#${e.targetId}`),n=null==t?void 0:t.querySelector("iframe"),i=null==n?void 0:n.parentElement,{siteSpecificConfig:{publisherClassName:r,fullWidthFormatClassName:o}={}}=g.get();if(!t||!n||!i)return;const s=window.innerWidth,a=Math.round(s/1080*1920);t.style.width="100%",t.style.height=`${a}px`,t.classList.add(`advertory-${r}-${o}__vertical-full-width-ad`);const d=Pt(e,t.offsetWidth);i.style.transform=`scale(${d})`,i.style.transformOrigin="left top"})(e),li(e,t),(null==r?void 0:r.clearProbableDimensionsEnabled)&&(e=>{const t=document.querySelector(`#${e}`);t&&(t.style.minWidth="",t.style.minHeight="")})(e.targetId);var a,l;tt.getData("horseshoe").isAvailable&&o(e.targetId),n.adLoaded(e),a=e.targetId,!document.querySelector(`#gdprAdTransparencyCogWheelButton-${a}`)&&(null===(l=window.gdpr)||void 0===l?void 0:l.setupButton)&&window.gdpr.setupButton(a),s&&s.classList.add("ad-loaded"),$t(e),window.dispatchEvent(new CustomEvent("advertory:adLoaded",{detail:{targetId:e.targetId,adFormat:kt(e)}}))}),Hi.onEvent("adNoBid",t=>e(void 0,void 0,void 0,function*(){Xe(t.targetId),yield Rn(g.get(),t),Et(t)&&bt(),n.adNoBid(t)})),Hi.onEvent("adError",(e,t)=>{Et(t)&&bt(),n.adError(e,t)}),Hi.onEvent("adCollapse",()=>{n.adCollapse()}),Hi.onEvent("adRequestFailure",e=>{Xe(e.targetId),n.adRequestFailure(e)}),Hi.onEvent("adBadRequest",e=>{Xe(e.targetId),n.adBadRequest(e)}),Hi.onEvent("adLoadedMediated",e=>n.adLoadedMediated(e)),Hi.onEvent("adNoBidMediated",e=>n.adNoBidMediated(e))})}),er=(t,n)=>e(void 0,void 0,void 0,function*(){var e;if(!(null===(e=null===window||void 0===window?void 0:window.advertory)||void 0===e?void 0:e.initialized))return[];const{clearAds:i,reloadExistingAds:r,renderFinnBlinkPlacements:o,contextSelector:s}=null!=n?n:{};if(i)return rt(),[];r&&(rt(),document.querySelectorAll('[data-advertory-ad-rendered="true"]').forEach(e=>{Ze(e.id)})),h(null!=t?t:{}),yield Wi();let a=dt(s);return o&&(a=a.filter(e=>xe(e.id))),a.length>0&&(Ui=[...Ui,...a.map(e=>Object.assign({},e))],ci(a),ui(a),yield Yi(a)),Ui}),tr=(n,i)=>e(void 0,void 0,void 0,function*(){var r;g.set(n),g.setHandlers(i),tt.initialize(),window.addEventListener("message",Gn,!1),Hi=window.apntag||{anq:[],defineTag:e=>({targetId:""}),showTag:e=>{},onEvent:(e,t,n)=>{},offEvent:(e,t)=>{},refresh:e=>{},modifyTag:(e,t)=>{},loadTags:e=>{},emitEvent:(e,t)=>{},setPageOpts:e=>{},resizeAd:(e,t,n)=>{},getAstVersion:()=>"",setEndpoint:(e,t)=>{},fireImpressionTrackers:e=>{},setKeywords:()=>{},clearRequest:()=>{}},window.apntag=Hi,yield K(),yield Promise.allSettled([e(void 0,void 0,void 0,function*(){const{prebid:e}=g.get();(null==e?void 0:e.enabled)&&(yield Kt(null==e?void 0:e.url))}),(r={country:n.country,tracker:n.tracker},e(void 0,[r],void 0,function*({country:e,tracker:n,timeout:i=1e3}){n&&(yield Promise.allSettled([de.processPPIDs(n,i),le.processPPIDs(n,e)])).forEach((e,n)=>{"rejected"===e.status&&t(`Cannot fetch PPIDs v${n+2}`,e.reason)})})),e(void 0,void 0,void 0,function*(){const{astUrl:e}=g.get();yield Kt(null!=e?e:"https://adsdk.microsoft.com/ast/ast.js")}),e(void 0,void 0,void 0,function*(){const{gptUrl:e}=g.get();yield Kt(null!=e?e:"https://securepubads.g.doubleclick.net/tag/js/gpt.js")}),e(void 0,void 0,void 0,function*(){const{brandmetrics:{enabled:e,url:t}={},tcf:n}=g.get(),{getConsentSync:i}=o(n),r=i();if(e&&t&&r){if(yield Kt(t),document.querySelector(`.${$i}`))return window._brandmetrics=window._brandmetrics||[],void window._brandmetrics.push({cmd:"_loadsurvey"});new MutationObserver((e,t)=>{for(const n of e){if("childList"!==n.type)return;Array.from(n.addedNodes).some(e=>{var t;return null===(t=e.outerHTML)||void 0===t?void 0:t.includes($i)})&&(t.disconnect(),window._brandmetrics=window._brandmetrics||[],window._brandmetrics.push({cmd:"_loadsurvey"}))}}).observe(document,{childList:!0,subtree:!0,attributes:!0})}}),X(),e(void 0,void 0,void 0,function*(){const{gdpr:{url:e,allowHidingAds:t=!0}={}}=g.get();t&&(window.gdpr=window.gdpr||{},window.gdpr.allowHidingAds=!0),yield Kt(null!=e?e:"https://cogwheel.inventory.schibsted.io/prod/latest/gdpr-bundle.js")})]),yield Li(),yield Zi(),yield Wi(),Vi(n),Ui=dt(),ci(Ui),ui(Ui),yield Yi(Ui),Mi(Ui),yield i.replaceAdsWithFinnBlink(n.finnBlink),yield(t=>e(void 0,void 0,void 0,function*(){var e;if(!t.drEdition)return;const n=yield R(),i=new B(n);qn({publisher:t.publisher,drEditionConfig:t.drEdition,device:t.deviceType,pageType:t.pageType,country:t.country},i,null===(e=t.pulse)||void 0===e?void 0:e.instance)}))(n)}),nr=(t,n)=>e(void 0,void 0,void 0,function*(){const{initConsentManager:i}=o(t.tcf),r=yield Fi(t);var s;yield Ri(),yield(s=i,e(void 0,void 0,void 0,function*(){return yield new Promise(e=>{s().then(t=>{e(null!=t?t:null)}).catch(t=>{e(null)})})})),yield tr(r,n)}),ir=()=>{if(!window.location.search.includes("kv_"))return{};const e={},t=(()=>{const e=new URLSearchParams(window.location.search);return Object.fromEntries(e)})();return Object.keys(t).forEach(n=>{n.startsWith("kv_")&&(e[n.slice(3)]=t[n])}),e},rr="native_override_desc2",or=(e,t,n)=>{var i;const{image:r,icon:o,sponsoredBy:s,title:a,clickUrl:d,cta:l,body:c,desc2:u,video:v,description:p,customTitle1:g,customTitle2:h,customTitle3:m,customTitle4:y,customIcon2:f}=e,w=(e,t="")=>{var n;return e?null!==(n=e.url)&&void 0!==n?n:e:t};return Object.assign({containerId:n,img:w(r),imgWidth:null==r?void 0:r.width,imgHeight:null==r?void 0:r.height,imgAltText:null!=a?a:"",logo:w(o),sponsoredBy:null!=s?s:"",title:null!=a?a:"",url:null!=d?d:"",cta:null!=l?l:"",description:null!==(i=null!=c?c:p)&&void 0!==i?i:"",desc2:null!=u?u:"",video:v,customTitle1:null!=g?g:"",customTitle2:null!=h?h:"",customTitle3:null!=m?m:"",customTitle4:null!=y?y:"",logo2:w(f)},t)},sr=(e,t)=>{const n=(i=rr,window.location.href.includes(i));var i;const r=new URLSearchParams(window.location.search).get(rr),o=t.includes("native_recirc");return n&&r?r:(null==e?void 0:e.includes("recirc"))?o?"native_recirc":"recirc":(null==e?void 0:e.includes("sponsor"))?"sponsorstripe":null},ar=(e,t,n,i)=>{const r=document.querySelector(`#${e}`);r&&t&&(r.innerHTML=t,((e,t)=>{const n=e.parentElement,{publisher:i,pageType:r}=t,o=i&&Object.values(Mt).includes(i);n&&o&&((e,t,n,i)=>{const r=t.parentElement;if(!r)return;const o=e?`-${e}`:"",s=i?`__${i}`:"",a=`advertory${o}-${n}${s}`,d=`advertory${o}-${n}-wrapper${s}`;t.classList.remove(...t.classList),r.classList.remove(...r.classList),t.classList.add(a),r.classList.add(d),t.dataset.adType=n})(i,e,_i,r)})(r,n),i())},dr=e=>{var t;const n=document.querySelector(`#${e.targetId}`);if(!n||!(null===(t=e.native)||void 0===t?void 0:t.clickTrackers))return;(null==n?void 0:n.querySelectorAll("a.ad-link")).forEach(t=>{"true"!==t.dataset.tracked&&(t.addEventListener("click",()=>{var t,n;for(const i of null!==(n=null===(t=e.native)||void 0===t?void 0:t.clickTrackers)&&void 0!==n?n:[])vr(i)}),t.dataset.tracked="true")})},lr=e=>{const{native:{impressionTrackers:t}={}}=e;(null==t?void 0:t.some(e=>e.includes("googleads")))?null==t||t.forEach(ur):window.apntag.fireImpressionTrackers(e)},cr=(e,t)=>{var n;let i=!1;const r=document.querySelector(`#${e.targetId}`);if(!r||!e.native)return;const{deviceType:o,appearanceConfig:s,nativeTrackingConfig:{fireImpressionsBasedOnAppearanceThreshold:a=!1}={}}=t,d=a?{rootMargin:`${l=null!==(n=null==s?void 0:s.defaultThreshold[null!=o?o:y.DESKTOP])&&void 0!==n?n:0}px 0px ${l}px 0px`}:{};var l;const c=new IntersectionObserver(t=>{if(!i)for(const n of t)if(n.isIntersecting){i=!0,lr(e),c.disconnect();break}},d);c.observe(r)},ur=e=>{const t=e.includes("googleads");"function"!=typeof window.navigator.sendBeacon||t?vr(e):window.navigator.sendBeacon(e)},vr=e=>{fetch(e,{method:"GET",mode:"no-cors"}).catch(t=>console.warn(`Tracker ${e} failed. Error: ${t||"Unknown"}`))},pr=(e,t,n)=>{const i=((e,t,n)=>{var i;const{displayTemplates:r,videoTemplates:o}=n,s="default";if(!e.native)return null;const{native:a,targetId:d}=e,{desc2:l=s}=e.native,c=l.toLowerCase(),u=null!==(i=sr(e.targetId,l))&&void 0!==i?i:c,v=cn[t.language||P.NO],p=or(a,v,d);return(a.video?o[u]:r[u]||r.default)(p,t)})(e,t,n);ar(e.targetId,i,t,()=>{const{nativeTrackingConfig:{nativeTrackingEnabled:n=!0}={}}=t;n&&((e,t)=>{dr(e),cr(e,t)})(e,t)})},gr=({containerId:e,url:t,adText:n,sponsoredBy:i,title:r,img:o,description:s,desc2:a},d)=>{const l=Me({native:{desc2:a}}),c=l?"advertory-aftonbladet-ad-native-classic-alcohol":"",u=l?'<div class="alcohol-warning-wrapper">\n <div class="alcohol-warning">Alkohol&nbsp;kan skada&nbsp;din&nbsp;hälsa</div>\n </div>':"",{deviceType:v}=d;return`<article class="advertory-aftonbladet-ad-native-classic ${c}">\n <div class="ad-info" id="${e}-button"></div>\n <a class="ad-link" href="${t}"${E(v)?"":' target="_blank" rel="noopener"'}>\n <div class="ad-content">\n <div class="ad-header">\n <span class="ad-annonse">${n}</span>\n </div>\n <div class="ad-image-container">\n <img alt="${r}" class="ad-image" src="${o}" />\n </div>\n <div class="ad-data-content">\n <div class="ad-title">${r}</div>\n <div class="ad-subtitle">\n <span class="ad-sponsored">${i}</span> ${s}\n </div>\n </div>\n ${u}\n </div>\n </a>\n </article>`},hr=e=>null!==e&&"object"==typeof e&&!Array.isArray(e),mr="viewable",yr="adClick";const fr=(e,t)=>{const n=(new DOMParser).parseFromString(e,"text/xml"),i=n.querySelector("ClickThrough"),r=n.querySelector("VideoClicks");if(i){for(;i.firstChild;)i.removeChild(i.firstChild);i.appendChild(n.createCDATASection(t))}else if(r){const e=n.createElement("ClickThrough");e.appendChild(n.createCDATASection(t)),r.appendChild(e)}return URL.createObjectURL(new Blob([(new XMLSerializer).serializeToString(n)],{type:"text/xml"}))},wr=(e,t,n,i,r="",o="xandr")=>({id:e,poster:n,vendor:"appnexus",node:t,mute:!0,skin:{name:"inventory-player",url:"https://ads.inventory.schibsted.io/styles/player.css"},settings:{jw:{stretching:"fill",advertising:{client:"vast",tag:i}}},pulse:{provider:r.toLowerCase(),decorator:e=>Object.assign(Object.assign({},hr(e)?e:{}),{provider:Object.assign(Object.assign({},hr(null==e?void 0:e.provider)?e.provider:{}),{productTag:o})})}}),br=t=>e(void 0,void 0,void 0,function*(){const{playerConfig:e,pluginsNames:n,clickUrl:i}=t,r=yield On(e);Ln(n),r.once("assetReady",()=>{Pn(r,n)}),r.on(mr,e=>{const{viewable:t}=e;t?r.play():r.pause()}),r.on(yr,()=>{window.open(i,"_blank")})}),Er=({containerId:e,url:t,adText:n,description:i,title:r,sponsoredBy:o},s,a)=>{const{deviceType:d}=s;return`<article class="advertory-aftonbladet-ad-native-classic">\n <div class="ad-info" id="${e}-button"></div>\n <div class="ad-content">\n <div class="ad-header">\n <span class="ad-annonse">${n}</span>\n </div>\n <div class="ad-image-container">\n <div class="ad-player-wrapper">\n <div id="${null!=a?a:0}"></div>\n </div>\n </div>\n <a class="ad-link" href="${t}"${E(d)?"":' target="_blank" rel="noopener"'}>\n <div class="ad-data-content">\n <div class="ad-title">${r}</div>\n <div class="ad-subtitle">\n <span class="ad-sponsored">${o}</span> ${i}\n </div>\n </div>\n </a>\n </div>\n </div>\n </article>`},Ir={CONTENT_DISPLAY:(e,{pageType:t})=>t===kn.ARTICLE&&"gambling"===e.desc2?(({containerId:e,url:t,adContentFrom:n,adText:i,sponsoredBy:r,title:o,img:s,description:a,desc2:d})=>`<article class="advertory-aftonbladet-ad-native-content article">\n <div class="ad-info" id="${e}-button"></div>\n <a class="ad-link" href="${t}" target="_blank">\n <div class="ad-content">\n <div class="ad-data-content">\n <div class="ad-annonse">${i}</div>\n <div class="ad-title">${o}</div>\n ${a&&`<div class="ad-subtitle">${a}</div>`}\n <div class="ad-sponsored">${n} ${r}</div> \n </div>\n <div class="ad-image-container">\n <img alt="${o}" class="ad-image" src="${s}" />\n </div>\n </div>\n ${"gambling"===d?'<div class="ad-gambling">\n <div class="ad-gambling-text">Åldersgräns för spel är 18 år.</div>\n <div class="ad-gambling-link">www.stodlinjen.se</div>\n </div>':""}\n </a>\n </article>`)(e):(({containerId:e,url:t,adContentFrom:n,adText:i,sponsoredBy:r,title:o,img:s,description:a,desc2:d})=>`<article class="advertory-aftonbladet-ad-native-content">\n <div class="ad-info" id="${e}-button"></div>\n <a class="ad-link" href="${t}" target="_blank">\n <div class="ad-header">\n <span class="ad-annonse">${i}</span>\n </div>\n <div class="ad-content">\n <div class="ad-data-content">\n <div class="ad-title">${o}</div>\n ${a&&`<div class="ad-subtitle">${a}</div>`}\n <div class="ad-sponsored">${n} ${r}</div> \n </div>\n <div class="ad-image-container">\n <img alt="${o}" class="ad-image" src="${s}" />\n </div>\n </div>\n ${"gambling"===d?'<div class="ad-gambling">\n <div class="ad-gambling-text">Åldersgräns för spel är 18 år.</div>\n <div class="ad-gambling-link">www.stodlinjen.se</div>\n </div>':""}\n </a>\n </article>`)(e),CLASSIC:gr,CLASSIC_VIDEO:(e,t)=>{const{video:n}=e;return(null==n?void 0:n.content)?(i=Er,(e,t,n)=>{const{video:r,img:o,url:s}=e,{publisher:a,productTag:d}=t;if(!(null==r?void 0:r.content))return null;const l=Math.ceil(1e5*Math.random()),c=o||"https://custom.inventory.schibsted.io/1x1-00000000.png",u=`ad-player-${l}`,v=fr(r.content,s),p=wr(l,u,c,v,a,d);return br({playerConfig:p,clickUrl:s,pluginsNames:n}),`${i(e,t,u)}`})(e,t):gr(e,t);var i},CHAT_INTEGRATION:({containerId:e,url:t,sponsoredBy:n,title:i,logo:r,img:o,description:s,customTitle2:a})=>{const d=a?((e,t)=>{const n=new RegExp(`(\\b[a-zäöå]+\\.${t}\\b)`,"g");return e.replace(n,e=>`<u>${e}</u>`)})(a,P.SE):void 0;return`<article class="advertory-aftonbladet-ad-native-chat-integration">\n <div class="ad-info" id="${e}-button"></div>\n <a class="ad-link" href="${t}" target="_blank">\n <div class="ad-content">\n <span class="ad-annonse">ANNONS FRÅN ${n}</span>\n <img alt="${n}" class="ad-logo" src="${r}" />\n <div class="ad-data-content">\n <span class="ad-subtitle">\n ${s}\n </span>\n <span class="ad-title">${i}</span>\n <div class="ad-button">Se alla nyheter</div>\n <div class="ad-image-container">\n <img alt="${i}" class="ad-image" src="${o}" />\n </div>\n </div>\n </div>\n </a>\n ${d?`<div class="ad-chat-warning">${d}</div>`:""} \n </article>`},SPONSORSTRIPE:({title:e,sponsoredBy:t,logo:n,url:i})=>`<article class="advertory-aftonbladet-ad-native-sponsorstripe">\n <a class="ad-link" href="${i}" target="_blank">\n <div class="ad-wrapper">\n <span class="ad-title">${e}</span>\n <img alt="${t}" class="ad-logo" src="${n}" />\n </div>\n </a>\n </article>`},Tr={displayTemplates:{brandstudio_native_ad:Ir.CLASSIC,brandstudio_native_ad_alcohol:Ir.CLASSIC,default:Ir.CONTENT_DISPLAY,gambling:Ir.CONTENT_DISPLAY,ab_chat:Ir.CHAT_INTEGRATION,sponsor:Ir.SPONSORSTRIPE,sponsortop:Ir.SPONSORSTRIPE,sponsorstripe:Ir.SPONSORSTRIPE},videoTemplates:{brandstudio_native_ad:Ir.CLASSIC_VIDEO}},Sr=e=>{const t=e.querySelector(".advertory-aftonbladet-ad-native-classic-alcohol");if(!t)return;const n=t.querySelector(".ad-content"),i=t.querySelector(".alcohol-warning");if(!i||!n)return;const r=(e=>{const t=e.getBoundingClientRect().height;return Math.floor(.25*t)})(n);i.style.height=`${r}px`},Ar=(e,t,n)=>{e.style.position=t,e.style.transform=`translateY(${n}px)`},Cr=(e,t)=>{const n=document.querySelector(t),i=document.querySelector(`#${e}`);if(!i||!n)return;const r=i.parentElement,o=new IntersectionObserver(([e])=>((e,t,n)=>{const i=window.getComputedStyle(t).position,r=e?i:"fixed",o=e?t.offsetHeight:0;Ar(n,r,o)})(e.isIntersecting,n,r)),s=new ResizeObserver(()=>((e,t)=>{const n=window.getComputedStyle(e).position;Ar(t,n,e.offsetHeight)})(n,r));o.observe(n),s.observe(n)},kr=e=>document.querySelector(e)||document.querySelector(`[class*="${e}"]`),Pr=(e,t)=>{if(!t||!Le(e))return;const{toogleEnabled:n,headerSelector:i,containersSelectors:r}=t,{targetId:o}=e;if(!n)return;const s=document.querySelector(".advertory-takeover-wrapper"),a=[()=>i&&Cr(o,i),()=>r&&((e,t)=>{const n=document.querySelector(`#${e}`);if(!n)return;const[i,r]=t;if(!i)return;const o=()=>{const e=kr(i),t=r?kr(r):null,o=n.querySelector("article");if(!o||!e)return;const s=e.getBoundingClientRect().left,a=((e,t)=>{const n=e.getBoundingClientRect(),i=null==t?void 0:t.getBoundingClientRect();return i?i.right-n.left:n.width})(e,t);o.style.left=`${s}px`,o.style.width=`${a}px`};o(),new ResizeObserver(o).observe(document.body)})(o,r),()=>s&&((e,t)=>{const n=document.querySelector(`#${e}`);if(!n||!t)return;new IntersectionObserver(([e])=>{n.style.visibility=e.isIntersecting?"hidden":"visible"}).observe(t)})(o,s)];a.forEach(e=>e())},Or=((t,n)=>i=>{return r=Object.assign(Object.assign({},i),{siteSpecificConfig:n}),o=t,e(void 0,void 0,void 0,function*(){yield nr(r,o)});var r,o})({initNativeAd:(e,t)=>{const{targetId:n}=e,i=document.querySelector(`#${n}`);if(!i)return;const{pageType:r=kn.FRONT,deviceType:o,nativeTrackingConfig:s,appearanceConfig:a}=null!=t?t:{},d={language:P.SE,publisher:Mt.AFTONBLADET,deviceType:o,pageType:r,nativeTrackingConfig:s,appearanceConfig:a};pr(e,d,Tr),Pr(e,null==t?void 0:t.sponsorstripe),Me(e)&&Sr(i)},wallpaperHandlers:{initWallpaperAd:He,adjustAdToHorseshoe:He},loadFinnBlinkAd:Fe,replaceAdsWithFinnBlink:Fe,preparePageOptions:ge,prepareTag:e=>{const{keywords:t,targetId:n,invCode:i,dynamicSizeWidthCheck:r}=e,o=(e=>{const{isMobileApp:t}=g.get();return t?(e=>e.replace(/wtb|wde|wph/g,e=>"wph"===e?"aph":"atb"))(e):e})(i),s=(e=>{const{keywords:t,dynamicSizeWidthCheck:n}=e,i=`${Z()}-adformat`,r=t?t[i]:[];if(!r)return{};const o=(Array.isArray(r)?r:[r]).filter(e=>!(e in Te)||window.innerWidth>=Te[e]);return{[i]:n?o:r}})(e),a=(e=>{const t=`${Z()}-targetid`;return e?{[t]:[e]}:{}})(n),d=(e=>{var t;const[,n]=null!==(t=e.match(/-((w|a)(?:ph|de|tb))-/))&&void 0!==t?t:[];switch(n){case"wde":return{"aa-sch-supply_type":"web_desktop"};case"wtb":return{"aa-sch-supply_type":"web_tablet"};case"wph":return{"aa-sch-supply_type":"web_phone"};case"aph":return{"aa-sch-supply_type":"app_phone"};default:return}})(o),l=ir(),c={[`${Z()}-adreload`]:"0"},u=(e=>Ft(e)?{"aa-sch-dynamic-outstream":["true"]}:{})(i),v=Object.assign({},((e,t)=>Ft(e)?Object.assign(Object.assign({},t),{playerSkin:{videoBackgroundColor:"#e6e7e8"}}):{})(i,{safeFrameAutoInitialSize:!0})),p=r&&e.sizes.length>0?e.sizes.filter(([e])=>e<=window.innerWidth):e.sizes;return Object.assign(Object.assign({},e),{sizes:p,invCode:o,keywords:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},t),s),a),d),c),u),l),rendererOptions:v})},siteEvents:Ht},Ut);var $r=Object.freeze({__proto__:null,default:""});export{ve as getVideoPPIDs,Or as initAdvertoryPackage,er as updateAdvertory};
1
+ import"react/jsx-runtime";function e(e,t,n,i){return new(n||(n=Promise))(function(r,o){function s(e){try{d(i.next(e))}catch(e){o(e)}}function a(e){try{d(i.throw(e))}catch(e){o(e)}}function d(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}d((i=i.apply(e,t||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;const t=(e,t)=>{const n="[Advertory LOG]: ";location.search.includes("ast_debug=true")&&(t?console.log(n,e,t):console.log(n,e))},n="cmp:loaded";let i,r=!1;const o=e=>{const o=!!(null==e?void 0:e.enabled),s=(null==e?void 0:e.timeout)||3e3,a=(d="bypass_tcf",new URLSearchParams(window.location.search).get(d));var d;return{initConsentManager:()=>new Promise((e,o)=>{if(t("Getting TCF consent manager..."),window._tcf_)return t("TCF consent manager is already available"),i=window._tcf_,void e(i);t("TCF consent manager is not available");const a=()=>{t("CMP loaded, resolving consent manager..."),d&&clearTimeout(d),window._tcf_?(i=window._tcf_,e(i)):o(new Error("CMP loaded but window._tcf_ is not defined"))},d=setTimeout(()=>{document.removeEventListener(n,a),r=!0,o(new Error("Timeout waiting for CMP to load"))},s);t("Listening for CMP loaded event..."),document.addEventListener(n,a,{once:!0})}),getConsentSync:()=>{if(((e,n)=>e?!!n&&(t("TCF bypass param detected, returning consent: true"),!0):(t("TCF is not enabled, returning consent: true"),!0))(o,a))return!0;if(r)return null;if(!i)throw new Error("[Advertory]: getConsentSync method was called before the tcfManager was available.");const e=i.getConsentedToAllSync();return t(`TCF consented to all is: ${e}`),i.getConsentedToAllSync()}}};function s(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var a,d;var l=s(function(){if(d)return a;d=1;var e=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var n=Object.prototype.toString.call(e);return"[object RegExp]"===n||"[object Date]"===n||function(e){return e.$$typeof===t}(e)}(e)},t="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function n(e,t){return!1!==t.clone&&t.isMergeableObject(e)?l((n=e,Array.isArray(n)?[]:{}),e,t):e;var n}function i(e,t,i){return e.concat(t).map(function(e){return n(e,i)})}function r(e){return Object.keys(e).concat(function(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter(function(t){return Object.propertyIsEnumerable.call(e,t)}):[]}(e))}function o(e,t){try{return t in e}catch(e){return!1}}function s(e,t,i){var s={};return i.isMergeableObject(e)&&r(e).forEach(function(t){s[t]=n(e[t],i)}),r(t).forEach(function(r){(function(e,t){return o(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))})(e,r)||(o(e,r)&&i.isMergeableObject(t[r])?s[r]=function(e,t){if(!t.customMerge)return l;var n=t.customMerge(e);return"function"==typeof n?n:l}(r,i)(e[r],t[r],i):s[r]=n(t[r],i))}),s}function l(t,r,o){(o=o||{}).arrayMerge=o.arrayMerge||i,o.isMergeableObject=o.isMergeableObject||e,o.cloneUnlessOtherwiseSpecified=n;var a=Array.isArray(r);return a===Array.isArray(t)?a?o.arrayMerge(t,r,o):s(t,r,o):n(r,o)}return l.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce(function(e,n){return l(e,n,t)},{})},a=l}());const c=["deviceType","pageType","placements","takeover","refreshConfig","editableConfiguration"],u={adRequested:()=>{},adAvailable:e=>{},adLoaded:e=>{},adNoBid:e=>{},adError:(e,t)=>{},adCollapse:()=>{},adRequestFailure:e=>{},adBadRequest:e=>{},adLoadedMediated:e=>{},adNoBidMediated:e=>{}},v=6;class p{set(e){this.config=e}modifyConfigProperties(e){if(!this.config)throw new Error("Config was accessed before it had been initialized.");const t={};for(const n of c){const i=e[n];void 0!==i&&(t[n]=i)}Object.assign(this.config,t),Object.prototype.hasOwnProperty.call(e,"pageOptions")&&void 0!==e.pageOptions&&(this.config.pageOptions=Object.assign(Object.assign({},this.config.pageOptions),e.pageOptions))}get(){if(!this.config)throw new Error("Config was accessed before it had been initialized.");return this.config}getHandlers(){if(!this.siteHandlers)throw new Error("Handlers were accessed before it had been initialized.");return this.siteHandlers}setHandlers(e){this.siteHandlers=l(p.DEFAULT_SITE_HANDLERS,e)}}p.DEFAULT_SITE_HANDLERS={siteEvents:u,initNativeAd:function(){}};const g=new p,h=g.modifyConfigProperties.bind(g);function m(e){const t=encodeURIComponent(e).replace(/[-.+*]/g,"\\$&"),n=new RegExp(`(?:(?:^|.*;)\\s*${t}\\s*\\=\\s*([^;]*).*$)|^.*$`);return decodeURIComponent(document.cookie.replace(n,"$1"))||null}const y={MOBILE:"mobile",TABLET:"tablet",DESKTOP:"desktop"},f=9826;class w{constructor(){this.getSupplyTypeKeywords=()=>{const{deviceType:e=y.DESKTOP,isMobileApp:t}=g.get();if(t){return{"aa-sch-supply_type":`app_${e===y.MOBILE?"phone":y.TABLET}`}}return{"aa-sch-supply_type":`web_${this.getPageOptionsFormatDevice(e)}`}}}prepare(t){return e(this,void 0,void 0,function*(){return Object.assign(Object.assign({},t),{keywords:Object.assign(Object.assign(Object.assign(Object.assign({},t.keywords),this.getSupplyTypeKeywords()),this.getFormattedExternalIdKeywords()),this.getHasContextKeywords(t.keywords)),user:{externalUid:this.getExternalUid(),dnt:this.isTrackingForbidden()}})})}getFormattedExternalIdKeywords(){const e=this.getExternalUid(),t=this.getUserId();return{"aa-sch-externalid_src":Number(!!e)+Number(!!t)}}getUserId(){return function(){const e=m("_pulse2data");return e?e.split(",")[2]:void 0}()}getExternalUid(){return function(){const{tcf:e}=g.get(),{getConsentSync:t}=o(e);if(!t())return;const n=m("_pulse2data");return n?n.split(",")[9]:void 0}()}isTrackingForbidden(){return(null===navigator||void 0===navigator?void 0:navigator.globalPrivacyControl)||"1"===(null===navigator||void 0===navigator?void 0:navigator.doNotTrack)||"DO_NOT_TRACK"===this.getExternalUid()}getMember(){const{pageOptions:{member:e},testMember:t=f}=g.get();return window.location.search.includes("inventory_test=true")?t:e}getCMPValue(e){return localStorage.getItem(`CMP:${e}`)?"0"===localStorage.getItem(`CMP:${e}`)?"0":"1":"0"}getPublisherKeywords(){const{publisher:e}=g.get();return{"aa-sch-publisher":`${e}`}}getAnalyticsConsentKeywords(){return{"aa-sch-cmp_analytics":this.getCMPValue("analytics")}}getAdvertisingConsentKeywords(){const{tcf:e}=g.get(),{getConsentSync:t}=o(e);return{"aa-sch-cmp_advertising":t()?"1":"0"}}getPageTypeKeywords(){const{pageType:e}=g.get();return{"aa-sch-page_type":e}}getCountryCodeKeywords(e){return{"aa-sch-country_code":e}}getInventoryTypeKeywords(){return{"aa-sch-inventory_type":"editorial"}}getHasContextKeywords(e){const t=e["aa-sch-context_keyword"];return{"aa-sch-has_context_keyword":Array.isArray(t)&&t.length?1:0}}getPageOptionsFormatDevice(e="desktop"){return"mobile"===e?"phone":e}getSponsorsKeywords(){var e;const{publisher:t,keywordsConfig:n}=g.get(),i=null===(e=null==n?void 0:n.sponsors)||void 0===e?void 0:e.split(":").map(e=>`${t}_${e}`);return i?{"no-sno-news-sponsors":i}:{}}}const b=new w;b.prepare.bind(b);const E=e=>e===y.DESKTOP,I=e=>e===y.MOBILE;function T(e=!1){var t,n;const i=null===(n=null===(t=window.navigator)||void 0===t?void 0:t.userAgent)||void 0===n?void 0:n.toLocaleLowerCase(),r=(()=>{const e=window.navigator.userAgent.toLowerCase(),t=[["win","windows"],["macintosh","macos"],["x11","linux"],["android","android"],["ipad","ios"],["iphone","ios"]].find(([t])=>e.includes(t));return t?t[1]:"unknown"})();return{OS:r,mobileOS:["ios","android"].includes(r)?r:"unknown",isHybridApp:i.includes("hermes"),appMode:e?"hybrid":"notinapp"}}class S extends w{constructor(){super(...arguments),this.getDeviceKeywords=()=>{const{deviceType:e=y.DESKTOP}=g.get();return{"se-generic-sitemode":this.getPageOptionsFormatDevice(e)}}}getScreenKeywords(){const e=function(){const e=window.innerWidth,t=window.innerHeight,n=document.documentElement.clientWidth,i=document.documentElement.clientHeight;return{width:e||n||0,height:t||i||0}}(),t={width:null!==(i=null===(n=window.screen)||void 0===n?void 0:n.width)&&void 0!==i?i:0,height:null!==(o=null===(r=window.screen)||void 0===r?void 0:r.height)&&void 0!==o?o:0};var n,i,r,o;return{"se-generic-viewportheight":e.height,"se-generic-viewportwidth":e.width,"se-generic-screenheight":t.height,"se-generic-screenwidth":t.width}}getExternalIdSrc(){const e=this.getExternalUid(),t=this.getUserId();return e?{"se-generic-externalid_src":Number(!!e)+Number(!!t)}:{"se-generic-externalid_src":0}}getAppTypeKeywords(){const{isMobileApp:e}=g.get(),{appMode:t,mobileOS:n}=T(e);return{"se-generic-appmode":t,"se-generic-mobileos":n}}getPublisherGroup(){return{"se-generic-publishergroup":"schibsted"}}}const A=864e5,C=(()=>{const e=e=>{const n=window.localStorage.getItem(e);if(!n)return null;try{return JSON.parse(n)}catch(e){return t("Error with parsing localStorage data"),null}},n=(e,t)=>{window.localStorage.setItem(e,JSON.stringify(t))};return{get:e,set:n,setWithTimestamp:(e,t,i=A)=>{const r={data:t,expirationTime:(new Date).getTime()+i};n(e,JSON.stringify(r))},getByTimestamp:(n,i=A)=>{const r=e(n);if(!r)return null;if(!i)return r;try{const{expirationTime:e,data:t}=JSON.parse(r);return(new Date).getTime()<=e?t:null}catch(e){return t("Error with parsing localStorage data"),null}}}})(),k={get:e=>{try{const t=sessionStorage.getItem(e);return t?JSON.parse(t):null}catch(e){return t(`sessionStorageClient.get: Error during getting data from sessionStorage: ${e}`),null}},set:(e,n)=>{try{sessionStorage.setItem(e,JSON.stringify(n))}catch(e){t(`sessionStorageClient.set: Error during saving data to sessionStorage: ${e}`)}},remove:e=>{try{sessionStorage.removeItem(e)}catch(e){t(`sessionStorageClient.remove: Error during remove data from sessionStorage: ${e}`)}}},P={NO:"no",SE:"se"},O="advertory:ppids-cache",$={[P.SE]:`SCH${P.SE.toUpperCase()}-EnvHash`,[P.NO]:`SCH${P.NO.toUpperCase()}-EnvHash`},L={[P.SE]:`SCH${P.SE.toUpperCase()}-UserHash`,[P.NO]:`SCH${P.NO.toUpperCase()}-UserHash`},x={[P.SE]:`sch${P.SE}-envhash-v3`,[P.NO]:`sch${P.NO}-envhash-v3`},N={[P.SE]:`sch${P.SE}-userhash-v3`,[P.NO]:`sch${P.NO}-userhash-v3`},j={[P.SE]:`'sch${P.SE}-iosid-v3'`,[P.NO]:`'sch${P.NO}-iosid-v3'`},_={[P.SE]:`sch${P.SE}-androidid-v3`,[P.NO]:`sch${P.NO}-androidid-v3`},D={[P.SE]:"sdrn:schibsted.com:user",[P.NO]:"sdrn:spid.no:user"},q=t=>e(void 0,void 0,void 0,function*(){const e=yield t.getEnvironmentId();if(!e)return null;return`sdrn:schibsted:environment:${e}`}),M=(t,n)=>e(void 0,void 0,void 0,function*(){const e=yield t.getUserId();if(!e)return null;return`${D[n]}:${e}`}),R=()=>e(void 0,void 0,void 0,function*(){return yield new Promise(e=>{if("undefined"!=typeof window)if(window.Identity)e(window.Identity);else{const t=()=>{e(window.Identity)};window.addEventListener("identity-initialized",t,{once:!0})}else e(void 0)})});class B{constructor(e){this.identity=e,this.getIdentityUser=this.getIdentityUser.bind(this),this.isUserLoggedIn=this.isUserLoggedIn.bind(this),this.onIdentityLogout=this.onIdentityLogout.bind(this)}getIdentityUser(){return e(this,void 0,void 0,function*(){var e;try{const t=yield null===(e=this.identity)||void 0===e?void 0:e.getUser();return null!=t?t:null}catch(e){return t("[Privacy Broker] User is not logged in."),null}})}isUserLoggedIn(){return e(this,void 0,void 0,function*(){var e,t;return null!==(t=yield null===(e=this.identity)||void 0===e?void 0:e.isLoggedIn())&&void 0!==t&&t})}onIdentityLogout(e){var t;null===(t=this.identity)||void 0===t||t.on("logout",e)}}const F="advertory-session",H=e=>{const{privacyBroker:{storageKeyPrefix:t=F}={}}=g.get();return t+"-"+e},U=()=>{const{privacyBroker:{storageKeyPrefix:e=F}={}}=g.get(),t=sessionStorage;for(const n in t)0===n.indexOf(e+"-")&&k.remove(n)},V={LOCAL:"https://user-permissions.privacy-dev.schibsted.io/privacy/v2",DEV:"https://user-permissions.privacy-dev.schibsted.io/privacy/v2",PRE:"https://user-permissions.privacy-pre.schibsted.io/privacy/v2",PRO:"https://user-permissions.privacy.schibsted.com/privacy/v2",PRO_NO:"https://user-permissions.privacy.schibsted.com/privacy/v2",PRO_FI:"https://user-permissions.privacy.schibsted.com/privacy/v2",PRO_DK:"https://user-permissions.privacy.schibsted.com/privacy/v2"},W={get:(t,n)=>e(void 0,void 0,void 0,function*(){const e=yield fetch(t,n);if(!e.ok)throw new Error(e.statusText);return yield e.json()}),post:(t,n,i)=>e(void 0,void 0,void 0,function*(){const e=JSON.stringify(i),r=yield fetch(t,{method:"POST",headers:n,body:e});if(!r.ok)throw new Error(r.statusText);return yield r.json()})},z=n=>e(void 0,[n],void 0,function*({endpoint:n,identityFacade:i,environment:r}){var o;U();const s=yield(t=>e(void 0,void 0,void 0,function*(){const e=new Headers;e.set("Content-Type","application/json");const n=yield t.getIdentityUser();return n&&e.set("Authorization",`SPIDSIG ${n.sig}`),e}))(i);try{const e=null!==(o=V[r])&&void 0!==o?o:V.PRO;return yield W.get(`${e}${n}`,{headers:s})}catch(e){return t("[PrivacyBroker] Failed to fetch permissions",e),null}}),K=()=>e(void 0,void 0,void 0,function*(){var n,i;const{privacyBroker:{enabled:r,clientId:o}={},tracker:{instance:s}={},country:a}=g.get(),d=yield R(),l=new B(d);if(!(r&&d&&s&&o))return t("[Privacy Broker]: Data not present",{enabled:r,identity:d,trackerInstance:s}),null;const c=yield l.isUserLoggedIn();l.onIdentityLogout(()=>{t("[Privacy Broker]: clearPermissions"),U()});const u=null!==(n=yield M(s,a))&&void 0!==n?n:"",v=null!==(i=yield q(s))&&void 0!==i?i:"",p=c?u:v,h=yield((t,n,i)=>e(void 0,void 0,void 0,function*(){const e=`/schacc/${n}/user/${i}/permissions`,r=`/anonymous/${n}/user/${i}/permissions`;return(yield t.getIdentityUser())?e:r}))(l,o,p),m=(e=>!!k.get(H(e)))(p),y=H(p);if(m){t("[Privacy Broker]: SessionStorage cached",{key:y,permissions:sessionStorage.getItem(y)});return k.get(y)}const f=yield(t=>e(void 0,[t],void 0,function*({endpoint:e,timeout:t,identityFacade:n,environment:i}){return yield Promise.race([z({endpoint:e,environment:i,identityFacade:n}),new Promise(e=>setTimeout(()=>e(null),t))])}))({endpoint:h,timeout:500,identityFacade:l,environment:d.env});return f?(b=p,(null==(w=f)?void 0:w.permissions)&&k.set(H(b),w.permissions),f):(t("[Privacy Broker]: Permissions not found",{permissions:f,isLoggedIn:c,identifiedId:p,country:a}),null);var w,b}),G="glimrTags",J=["glwe_","glwet_"],Y={geofenceTags:[],geoTags:[],weatherTags:[]},Q=()=>e(void 0,void 0,void 0,function*(){const{privacyBroker:n,tcf:i}=g.get(),{getConsentSync:r}=o(i),s=r();if(null==n?void 0:n.enabled){const n=(e=>{const n=null==e?void 0:e.find(e=>e.purpose.includes("targeted_advertising"));if(t("targeted_advertising permissions",n),!(null==n?void 0:n.data)||!Array.isArray(null==n?void 0:n.data))return!1;const i=null==n?void 0:n.data.find(e=>e.includes("geolocation"));return t("geolocation permission",i),!!i})(yield e(void 0,void 0,void 0,function*(){var e,n;const{country:i,tracker:{instance:r}={}}=g.get(),o=yield R();if(!r||!o)return t("[Privacy Broker] No tracker found."),null;const s=new B(o),a=yield s.isUserLoggedIn(),d=null!==(e=yield M(r,i))&&void 0!==e?e:"",l=null!==(n=yield q(r))&&void 0!==n?n:"",c=H(a?d:l);return k.get(c)||null}));return n}return!!s}),X=()=>e(void 0,void 0,void 0,function*(){const{glimr:n}=g.get();if(!(yield Q())||!(null==n?void 0:n.enabled))return void t("No consent for glimr data fetching.");const i=yield(r=500,e(void 0,void 0,void 0,function*(){return yield Promise.race([e(void 0,void 0,void 0,function*(){const e=yield import("glimr-sdk");return e.default||e}),new Promise(e=>setTimeout(()=>e(!1),r))])}));var r;if(i)try{i.setTagCacheTimeInSeconds(300),yield new Promise(e=>{i.getTags(n.clientId,(t,n)=>{C.setWithTimestamp(G,{tags:t,tagMappings:n}),e(!0)})})}catch(e){t(`Error during getting glimr data: ${e}`)}else t("Timeout (500ms) while loading glimr package. Skipping glimr data fetching.",{glimr:i})}),Z=()=>{const{country:e}=g.get();return e===P.NO?"no-sno":"se-generic"},ee=()=>{const{country:e,publisher:t}=g.get();return`${e}-${t}`},te={svd:"svd",vg:"vg",godare:"godare",aftenposten:"no-aftenposten",sa:"no-stavangeraftenblad",bt:"no-bergenstidende",aftonbladet:"aftonbladet",e24:"e24",minmote:"minmote",pent:"pent",godt:"godt",tek:"no-tek"},ne=e=>J.some(t=>e.startsWith(t)),ie=e=>e.startsWith("glgc_"),re=e=>!ne(e)&&!ie(e),oe=e=>{const t=se();if(!t)return Y;const n=((e=[])=>e.filter(ne))(t),i=((e=[])=>e.filter(ie))(t),r=((e=[],t)=>{const n=e.filter(re);if(t){const{publisher:e}=g.get(),t=te[e]||e;n.push(t)}return n})(t,e);return{geoTags:r,geofenceTags:i,weatherTags:n}},se=()=>{const e=C.getByTimestamp(G);return e&&"string"!=typeof e?null==e?void 0:e.tags:null};class ae{constructor(){this.eids=[]}add(e,t){return e&&this.eids.push({id:e,source:t}),this}buildRyEids(){return this.eids.map(({id:e,source:t})=>({source:t,uids:[{id:e,atype:1,ext:{stype:"ppuid"}}]}))}buildEids(){return[...this.eids]}buildVideoEids(){return this.eids.map(({id:e,source:t})=>`${t},${e}`).join("|")}buildNorstatPath(){const e=this.eids[0];return e?`${e.source}-${e.id}`:""}buildNorstatQuery(e){const t=new URLSearchParams;return this.eids.slice(1).forEach(({id:n,source:i})=>{t.append(e,`${i}-${n}`)}),t}}const de=new class{constructor(){this.ppid1=null,this.ppid2=null}processPPIDs(t){return e(this,arguments,void 0,function*(e,t=1e4){var n,i;const r=yield Promise.race([new Promise(e=>{setTimeout(()=>e({xandr:{ppId1:"",ppId2:""}}),t)}),e.instance.getAdvertisingIdentifiers()]);this.setPPIDs(null===(n=r.xandr)||void 0===n?void 0:n.ppId1,null===(i=r.xandr)||void 0===i?void 0:i.ppId2)})}getPPIDs(){var e,n;return null!==this.ppid1&&null!==this.ppid2||t("PPIDv2s accessed before they have been initialized"),{ppid1:null!==(e=this.ppid1)&&void 0!==e?e:"",ppid2:null!==(n=this.ppid2)&&void 0!==n?n:""}}setPPIDs(e,t){this.ppid1=null!=e?e:"",this.ppid2=null!=t?t:""}},le=new class{constructor(){this.ppid1=null,this.ppid2=null,this.idfv=null,this.anId=null}processPPIDs(t,n){return e(this,void 0,void 0,function*(){var e,i,r,o,s,a,d,l,c,u;const v=C.get(O),p=yield this.getNewPPIDs(t,n);if(this.shouldHash(v,p)){const t=this.createHasherPayload(p),n=yield this.hashPPIDs(t);return n?(this.cachePPIDs(t,n,null===(e=p.idfv)||void 0===e?void 0:e.plain,null===(i=p.anId)||void 0===i?void 0:i.plain),void this.setPPIDs(null!==(r=n.userId)&&void 0!==r?r:"",null!==(o=n.environmentId)&&void 0!==o?o:"",null===(s=p.idfv)||void 0===s?void 0:s.plain,null===(a=p.anId)||void 0===a?void 0:a.plain)):void this.setPPIDs("","")}this.setPPIDs(null!==(d=null==v?void 0:v.userId.hashed)&&void 0!==d?d:"",null!==(l=null==v?void 0:v.environmentId.hashed)&&void 0!==l?l:"",null===(c=null==p?void 0:p.idfv)||void 0===c?void 0:c.plain,null===(u=null==p?void 0:p.anId)||void 0===u?void 0:u.plain)})}getPPIDs(){var e,n;return null!==this.ppid1&&null!==this.ppid2||t("PPIDv3s accessed before they have been initialized"),{ppid1:null!==(e=this.ppid1)&&void 0!==e?e:"",ppid2:null!==(n=this.ppid2)&&void 0!==n?n:"",idfv:this.idfv,anId:this.anId}}setPPIDs(e,t,n,i){this.ppid1=null!=e?e:"",this.ppid2=null!=t?t:"",this.idfv=null!=n?n:null,this.anId=null!=i?i:null}shouldHash(e,t){var n,i;if(!e)return!0;for(const r in e){if((null===(n=e[r])||void 0===n?void 0:n.plain)!==(null===(i=t[r])||void 0===i?void 0:i.plain))return!0}return!1}cachePPIDs(e,t,n,i){const r=Object.assign(Object.assign({clientId:{plain:e.clientId},userId:{plain:e.userId,hashed:t.userId},environmentId:{plain:e.environmentId,hashed:t.environmentId},trackerType:{plain:e.trackerType},trackerVersion:{plain:e.trackerVersion}},n?{idfv:{plain:n}}:{}),i?{anId:{plain:i}}:{});C.set(O,r)}hashPPIDs(n){return e(this,void 0,void 0,function*(){try{const e=new Headers({"Content-Type":"application/json"});return yield W.post("https://hasher.schibsted.com/api/v1/hash",e,n)}catch(e){return t("Error with hashing PPIDs",e),null}})}getNewPPIDs(t,n){return e(this,arguments,void 0,function*({clientId:e,instance:t},n){const i=yield M(t,n),r=yield q(t),o=window.advertory_idfv,s=window.advertory_anId;return Object.assign(Object.assign({clientId:{plain:e},userId:{plain:i},environmentId:{plain:r},trackerType:{plain:"Advertory"},trackerVersion:{plain:"1.0.0"}},o?{idfv:{plain:o}}:{}),s?{anId:{plain:s}}:{})})}createHasherPayload({clientId:e,trackerType:t,trackerVersion:n,userId:i,environmentId:r}){return{clientId:e.plain,trackerType:t.plain,trackerVersion:n.plain,userId:i.plain,environmentId:r.plain}}},ce=e=>{const{ppid1:t,ppid2:n}=de.getPPIDs(),{ppid1:i,ppid2:r,idfv:o,anId:s}=le.getPPIDs();return{userIds:[{type:"extendedIDs",eids:(new ae).add(n,$[e]).add(t,L[e]).add(r,x[e]).add(i,N[e]).add(o,j[e]).add(s,_[e]).buildEids()}]}},ue=e=>{const{ppid1:t,ppid2:n}=de.getPPIDs(),{ppid1:i,ppid2:r,idfv:o,anId:s}=le.getPPIDs();if(!n)return{};return{userSync:{userIds:[{name:"pubProvidedId",params:{eids:(new ae).add(n,$[e]).add(t,L[e]).add(r,x[e]).add(i,N[e]).add(o,j[e]).add(s,_[e]).buildRyEids()}}]}}},ve=t=>e(void 0,void 0,void 0,function*(){const{ppid1:e,ppid2:n}=de.getPPIDs(),{ppid1:i,ppid2:r}=le.getPPIDs(),o=(new ae).add(n,$[t]).add(e,L[t]).add(r,x[t]).add(i,N[t]);return yield new Promise(e=>{e(o.buildVideoEids())})});const pe=new class extends S{constructor(){super(...arguments),this.getHasPlusMembership=()=>({"se-generic-has_plus":"plus"===m("X-AB-Site-Version")?"yes":"no"})}prepare(n){return e(this,void 0,void 0,function*(){const i=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({"aa-sch-country_code":P.SE},this.getPublisherKeywords()),this.getSupplyTypeKeywords()),this.getAppTypeKeywords()),this.getDeviceKeywords()),this.getScreenKeywords()),this.getAdvertisingConsentKeywords()),this.getAnalyticsConsentKeywords()),this.getExternalIdSrc()),this.getHasContextKeywords(n.keywords)),yield e(void 0,void 0,void 0,function*(){const{glimr:e}=g.get(),{addPublisherToGeo:n}={},i=yield Q();if(!(null==e?void 0:e.enabled)||!i)return t("No consent for getting glimr tags."),{};const r=Z(),o=oe(n);return{[`${r}-geo`]:o.geoTags,[`${r}-weather`]:o.weatherTags,[`${r}-geofence`]:o.geofenceTags}})),(()=>{const{ppid1:e,ppid2:t}=de.getPPIDs();return{"aa-sch-schuserhash":e?"1":"0","aa-sch-schenvhash":t?"1":"0"}})()),this.getHasPlusMembership()),n.keywords);return Object.assign(Object.assign({},n),{keywords:i,user:Object.assign(Object.assign({},ce(P.SE)),{externalUid:this.getExternalUid()}),member:this.getMember()})})}};var ge=pe.prepare.bind(pe);const he="ABSOLUTE_FULLSCREEN",me="ANY_FULLSCREEN",ye="VERTICAL_FULLWIDTH",fe="FULLWIDTH",we="TAKEOVER",be="WALLPAPER",Ee="COLLAPSE",Ie={ANY_FULLSCREEN:[{width:6,height:6},{width:1920,height:1080},{width:3,height:3}],ABSOLUTE_FULLSCREEN:[{width:6,height:6}],VERTICAL_FULLWIDTH:[{width:1080,height:1920}],FIXED_FULLSCREEN:[{width:1920,height:1080},{width:3,height:3}],FULLWIDTH:[{width:5},{width:400,height:400}],NATIVE_AD:[{width:1,height:1}],TAKEOVER:[{width:4,height:4}],WALLPAPER:[{width:2,height:2}],COLLAPSE:[{width:2,height:1}]},Te={wallpaper:1600,"l-format":1600},Se=e=>{const{banner:t,targetId:n}=e;return!(!t||(null==n?void 0:n.includes("takeover")))&&Re(e,me)},Ae=e=>{const{native:t}=e;return!!t},Ce=e=>Re(e,fe),ke=e=>{const{targetId:t}=e;return t.includes("takeover")||Re(e,we)},Pe=e=>Re(e,we),Oe=e=>Re(e,be),$e=e=>Re(e,Ee),Le=e=>e.targetId.includes("sponsorstripe"),xe=e=>{const t=document.querySelector(`#${e}`);return!!t&&"true"===t.dataset.isFinnBlinkPlacement},Ne=e=>e.targetId.startsWith("panorama")||e.targetId.startsWith("modul"),je=e=>e.targetId.startsWith("midboard"),_e=e=>e.targetId.startsWith("widescreen"),De=e=>e.width>=1260&&e.width<=1280,qe=e=>e.width>=1600&&e.width<=1620,Me=e=>{var t,n;return"string"==typeof(null===(t=e.native)||void 0===t?void 0:t.desc2)&&(null===(n=e.native)||void 0===n?void 0:n.desc2.endsWith("_alcohol"))},Re=(e,t)=>{const n=Ie[t];if(!n)return!1;return!!n.find(t=>{var n,i;const r=(null===(n=e.banner)||void 0===n?void 0:n.width)||e.width,o=(null===(i=e.banner)||void 0===i?void 0:i.height)||e.height,s=t.width===r,a=!t.height||t.height===o;return s&&a})},Be="0123456789abcdefghijklmnopqrstuvwxyz",Fe=()=>Promise.resolve(),He=()=>{},Ue=e=>{window.apntag.anq.push(e)},Ve=new Promise(e=>{"undefined"!=typeof document&&document.prerendering?document.addEventListener("prerenderingchange",()=>e()):e()}),We=new Promise(e=>{if("undefined"==typeof document||!document.hidden)return void e();const t=()=>{document.hidden||(document.removeEventListener("visibilitychange",t),e())};document.addEventListener("visibilitychange",t,{once:!0})}),ze=e=>{const t=e.split("-"),n=t[t.length-1];return 6===n.length&&n.match(/^[a-zA-Z0-9]+$/)?t.slice(0,-1).join("-"):e};let Ke="";const Ge=new Map,Je="advertory-wallpaper-background",Ye=()=>{const e=document.querySelector(`.${Je}`);e&&e.remove()},Qe=/^wallpaper:url:(http[s]?:\/\/)?[^\s(["<,>]*\.[^\s[",><]*/,Xe=e=>{if(window.location.href.includes("collapse_ad=0"))return;const t=document.querySelector(`div[id^="${e}"]`);if(!t)return;const n=t.parentElement;n&&(t.style.setProperty("width","0","important"),t.style.setProperty("height","0","important"),t.style.setProperty("display","none","important"),n.style.setProperty("display","none","important"),e.includes("wallpaper")&&Ye())},Ze=e=>{const t=document.querySelector(`div[id^="${e}"]`);if(!t)return;const n=t.parentElement;n&&(t.style.removeProperty("width"),t.style.removeProperty("height"),t.style.removeProperty("display"),n.style.removeProperty("display"))};class et{initialize(){this.DATA=Object.assign({},et.INITIAL_DATA)}getData(e){if(!this.DATA)throw new Error("Storage was accessed with invalid data.");return this.DATA[e]}setData(e,t){if(!this.DATA)throw new Error("Storage was accessed before it had been initialized.");this.DATA[e]=Object.assign(Object.assign({},this.DATA[e]),t)}}et.INITIAL_DATA={wallpaper:{isAvailable:!1},horseshoe:{isAvailable:!1},initialClassNames:{},alertoryConfigKeywords:{}};const tt=new et,nt=e=>{var t;const n=null===(t=document.querySelector(`#${e}`))||void 0===t?void 0:t.parentElement,i=(null==n?void 0:n.offsetHeight)||0;n&&(n.style.minHeight=`${i}px`)},it=e=>{const t=e.parentElement;if(!e||!t)return;const{container:n,wrapper:i}=(e=>{const t=tt.getData("initialClassNames")[e.id];return{wrapper:(null==t?void 0:t.wrapper)?t.wrapper.join(" "):"",container:(null==t?void 0:t.container)?t.container.join(" "):""}})(e);e.className=n,t.className=i},rt=()=>{Ye();document.querySelectorAll('[data-advertory-ad-rendered="true"]').forEach(e=>{Xe(e.id),it(e),(e=>{const t=document.querySelector(`#${e}`),n=null==t?void 0:t.getAttribute("data-probable-height"),i=null==t?void 0:t.getAttribute("data-probable-width");n&&i&&(null==t||t.style.setProperty("min-height",n+"px"),null==t||t.style.setProperty("min-probable-width",i+"px"))})(e.id),e.innerHTML="",e.id=ze(e.id)}),Ue(()=>window.apntag.clearRequest())},ot="noGroupedPlacements",st=e=>{const t=e.replace(/[0-9]/g,"");return"_"===t.slice(-1)?t.substring(0,t.length-1):t},at=e=>{if(!(null==e?void 0:e.minViewWidth))return!0;return window.innerWidth>=e.minViewWidth},dt=e=>{var t;if(!(null===(t=null===window||void 0===window?void 0:window.advertory)||void 0===t?void 0:t.initialized))return[];const{placements:n,queryConfig:i,deviceType:r}=g.get(),o=n[r].filter(at)||[],s=e?document.querySelector(e):document;if(!s)return[];const a=o.reduce((e,t)=>{const n=st(t.id);return!n||e.includes(n)||e.push(n),e},[]).flatMap(e=>{const t=new RegExp(`^${e}(_(\\d+))?$`),n=o.filter(({id:e})=>e.match(t)),a=(null==i?void 0:i.queryByDataDevice)?`div[id^="${e}"][data-device=${r}], div[id^="${e}"][data-device=all]`:`div[id^="${e}"]:not([data-disabled="true"])`,d=s.querySelectorAll(a),l=Array.from(d).filter(({id:e})=>e.match(t)).map((e,t)=>{const i=lt(e,t,n),r=`${e.id}-${((e=6)=>{if(e<=0)return"";let t="";for(let n=0;n<e;n++)t+=Be[Math.floor(36*Math.random())];return t})(6)}`;return e.id=r,e.setAttribute("data-advertory-ad-rendered","true"),i.finnBlink&&!i.finnBlink.renderOnlyWithAdBlock&&e.setAttribute("data-is-finn-blink-placement","true"),(e=>{var t;const n=e.id;n&&tt.setData("initialClassNames",{[n]:{wrapper:null===(t=e.parentElement)||void 0===t?void 0:t.className.split(" "),container:e.className.split(" ")}})})(e),Object.assign(Object.assign({},i),{id:r})});return(e=>{const{keywordsConfig:t}=g.get();return(null==t?void 0:t.includeCountingKeywordInTags)?(Ke!==window.location.pathname&&(Ge.clear(),Ke=window.location.pathname),e.map(e=>{var t;const n=e.invCode.replace(/_\d+$/,""),i=null!==(t=Ge.get(n))&&void 0!==t?t:0;return e.keywords=Object.assign({},e.keywords),e.keywords[`${ee()}-count`]=i,Ge.set(n,i+1),e})):e})(l)});return(e=>{const t=Array.from(document.querySelectorAll('div[class^="advertory"]'));return e.sort((e,n)=>t.findIndex(t=>t.id===e.id)-t.findIndex(e=>e.id===n.id))})(a)},lt=(e,t,n)=>{const i=n[t],r=n[n.length-1],o=n.filter(({id:t})=>t===e.id)[0];return(null==e?void 0:e.id)===(null==i?void 0:i.id)?i:(null==e?void 0:e.id)===(null==r?void 0:r.id)?r:o||r},ct=e=>{const{queryConfig:{placementBatches:t}={},deviceType:n}=g.get(),i=(null==t?void 0:t[n])||{},r=Object.values(i).flat(),o=(e=>{const t={};return e.forEach(e=>{const n=ze(e.id);e.isBackfill&&(t[n]=[e])}),t})(e),s=((e,t)=>{const n={};for(const[i,r]of Object.entries(t))n[i]=e.filter(e=>r.includes(ze(e.id)));return n})(e,i),a=Object.keys(o),d=((e,t)=>e.filter(e=>!t.has(ze(e.id))))(e,new Set([...a,...r]));return Object.assign(Object.assign(Object.assign({},s),o),{[ot]:d})},ut="splash",vt="welcomePage",pt="topscroller",gt=(e,t=(...e)=>{})=>{const n=t.toString();if(0===e.length)return n;const i=n.substring(0,n.indexOf("=>")).replace("(","").replace(")","").split(",").map(e=>e.trim()),r=n.substring(n.indexOf("{")+1,n.lastIndexOf("}")),o=i.map((t,n)=>`${t} = "${e[n]}"`);return new Function(...o,r).toString()},ht="takeover-displayed",mt=()=>{const{takeover:{enabled:e=!1}={}}=g.get();return!window.location.href.includes("takeover=0")&&(!!window.location.href.includes("takeover=1")||e&&!yt())},yt=()=>{var e;return"true"===m((null===(e=g.get().takeover)||void 0===e?void 0:e.cookieCapName)||ht)},ft=(e,t)=>[[1,1],[1920,1080]].some(([n,i])=>n===e&&i===t),wt=()=>{const{takeover:e}=g.get();return Boolean(null==e?void 0:e.topscroller)},bt=()=>{var e,t,n;const i=document.location.hostname,r=(null===(e=g.get().takeover)||void 0===e?void 0:e.cookieCapName)||ht,o=void 0===(null===(t=g.get().takeover)||void 0===t?void 0:t.cookieCapTime)?14400:null===(n=g.get().takeover)||void 0===n?void 0:n.cookieCapTime;o&&(window.document.cookie=`${r}=true; max-age=${o}; domain=${i}; path=/`)},Et=e=>{var t;const n=!!(null===(t=g.get().takeover)||void 0===t?void 0:t.setCookieCapForNotShownAd);return ke(e)&&n},It=(e,t)=>{var n;if(t===pt){const{topscroller:t}=e;return null!=t?t:{}}if(t===ut){const{splash:t}=e;return null!=t?t:{}}return null!==(n=e.welcomePage)&&void 0!==n?n:{}},Tt=(e,t)=>{t!==ut?(e=>{var t,n,i;const r=null===(n=null===(t=g.get().takeover)||void 0===t?void 0:t.welcomePage)||void 0===n?void 0:n.headerElementSelector,o=null===(i=g.get().takeover)||void 0===i?void 0:i.topscroller;if(!r||o)return;const s=document.querySelector(r),a=document.querySelector(".welcome-page-wrapper"),d=document.querySelector(`#${e.targetId}`),l=document.querySelector(".advertory-welcome-page-scroll");if(!(s&&a&&l&&d))return;const c=null==s?void 0:s.offsetHeight,u=Pe(e)?"60svh":`calc(100svh - ${c}px)`,v=Pe(e)?"calc(40svh + 30px)":`calc(${c}px + 30px)`;a.style.setProperty("height",u,"important"),d.style.setProperty("height",u,"important"),l.style.setProperty("bottom",v,"important")})(e):(e=>{var t;if(!(null===(t=g.get().takeover)||void 0===t?void 0:t.splash))return;const n=document.querySelector(".advertory-splash-navbar-wrapper"),i=document.querySelector(`#${e.targetId}`);if(!n||!i)return;const r=`calc(100svh - ${n.offsetHeight}px)`;i.style.setProperty("height",r,"important")})(e)},St=gt([],()=>{new MutationObserver((e,t)=>{document.querySelector("iframe")&&((()=>{const e=document.querySelector("iframe");e&&(e.onload=()=>{if(!e.contentDocument)return;document.body.style.height="100%",document.documentElement.style.height="100%",e.height="100%",e.width="100%";const t=e.contentDocument.createElement("style");t.textContent="\n .adform-adbox {\n height: 100% !important;\n width: 100% !important;\n }\n img {\n height: 100% !important;\n width: 100% !important;\n object-fit: cover !important;\n object-position: top !important;\n }\n ",e.contentDocument.head.appendChild(t)})})(),t.disconnect())}).observe(document.body,{childList:!0,subtree:!0})}),At={nativeAd:e=>Ae(e)&&!Le(e),buyrecipe:e=>e.targetId.startsWith("buyrecipe"),fullwidthAd:Ce,fullscreenScroll:Se,topscroller:e=>ke(e)&&wt(),splash:e=>ke(e)&&ft(e.width,e.height),welcomePage:ke,wallpaper:Oe,skyscraper:e=>e.targetId.includes("skyscraper")&&!!e.banner,lFormat:De,hFormat:qe,toppanorama:e=>e.targetId.startsWith("toppanorama")&&!qe(e)&&!De(e),topboard:e=>e.targetId.startsWith("topboard")&&!ke(e),widescreen:_e,insider:e=>e.targetId.startsWith("insider"),sponsorstripe:Le,brandboard:e=>(e=>(980===e.width||1920===e.width&&e.targetId.includes("brandboard"))&&!e.targetId.includes("topboard")&&!e.targetId.includes("companion")&&!Ne(e))(e)&&!(e=>e.targetId.includes("backfill"))(e)&&!je(e),outstream:e=>"https://acdn.adnxs.com/video/outstream/ANOutstreamVideo.js"===e.renderer_url,netboard:e=>(e=>e.targetId.startsWith("netboard"))(e)||(e=>e.targetId.startsWith("board"))(e),panorama:Ne,midboard:je},Ct=({adObj:e,preferredTestIdData:t})=>{var n,i;const r=null!==(n=null==t?void 0:t.targetId)&&void 0!==n?n:null==e?void 0:e.targetId;if(!r)return;const o=null===(i=document.querySelector(`#${r}`))||void 0===i?void 0:i.parentElement;if(!o)return;if(((e,t)=>{var n,i,r,o;const s=null===(o=null===(r=null===(i=null===(n=window.apntag)||void 0===n?void 0:n.requests)||void 0===i?void 0:i.tags)||void 0===r?void 0:r[e])||void 0===o?void 0:o.invCode;s&&(t.dataset.invCode=s)})(r,o),null==t?void 0:t.testId)return void(o.dataset.testid=t.testId);const s="DIV"===(null==o?void 0:o.tagName);e&&s&&((e,t)=>{var n,i;for(const[r,o]of Object.entries(At))if(o(e)){if("nativeAd"===r){const o="default";t.dataset.testid=`${r}-${null!==(i=null===(n=null==e?void 0:e.native)||void 0===n?void 0:n.desc2)&&void 0!==i?i:o}`;break}t.dataset.testid=r;break}})(e,o)},kt=e=>{var t;return(null===(t=Object.entries(At).find(([,t])=>t(e)))||void 0===t?void 0:t[0])||""},Pt=(e,t)=>{const n=e.width,i=(null!=t?t:window.screen.width)/n;return i<1?i:1},Ot=new Map;Ot.set("insider",{scale:.82,transformOrigin:"left center",cogwheelAdjust:!0}),Ot.set("panorama",{scale:.79,transformOrigin:"center center"}),Ot.set("outstream",{scale:.79,transformOrigin:"center center"}),Ot.set("integration",{scale:.79,transformOrigin:"center center"}),Ot.set("toppanorama",{scale:.8,transformOrigin:"left center"});const $t=e=>{if(!((null===(t=null===document||void 0===document?void 0:document.body)||void 0===t?void 0:t.clientWidth)>767&&(null===(n=null===document||void 0===document?void 0:document.body)||void 0===n?void 0:n.clientWidth)<=853))return;var t,n;const i=kt(e),r=Ot.get(i),o=document.querySelector(`#${e.targetId}`);if(!o||!r)return;if(o.style.transformOrigin=r.transformOrigin,o.style.transform=`scale(${r.scale})`,!(null==r?void 0:r.cogwheelAdjust))return;const s=document.querySelector(`div[class*="gdpr-cogwheel-button"][id$="${e.targetId}"]`),a=null==o?void 0:o.offsetWidth;s&&"number"==typeof a&&!isNaN(a)&&s.style.setProperty("right",String(-1*a*.2)+"px")},Lt=e=>{var t,n;const i=st(e.targetId.split("-")[0]);if(!["live"].includes(i))return;((e,t=window.screen.width)=>{const n=Pt(e,t),i=document.querySelector(`iframe[id^="utif_${e.targetId}"]`);i&&(i.style.transform=`scale(${n})`,i.style.transformOrigin="left top")})(e,null!==(n=null===(t=document.getElementById(`${e.targetId}`))||void 0===t?void 0:t.offsetWidth)&&void 0!==n?n:window.screen.width)},xt=e=>{var t;const n=document.querySelector("#superright-side");if(n){const i=40,r=(null===(t=e.banner)||void 0===t?void 0:t.height)?e.banner.height+i:0;n.style.marginTop=`${r}px`}},Nt=(e,t=0)=>{const n=e.getBoundingClientRect(),i=window.innerHeight;return n.bottom>-t&&n.top<i+t},jt=e=>e.some(e=>e.some(e=>!!e&&Nt(e,0))),_t=()=>{const e=Array.from(document.querySelectorAll('div[id="superright-side"]')).map(e=>Array.from(e.querySelectorAll('div[id^="widescreen"]')));let t=0,n=Date.now(),i=jt(e);if(!e.length)return;const r=(e,t,n)=>{e.forEach(e=>{e&&e.style.setProperty(t,n)})},o=e=>1===e?0:1;(e=>{e.forEach(e=>{e[0]&&(e[0].style.display="block"),e[1]&&(e[1].style.display="none")})})(e);const s=((e,t)=>{let n=null;return(...i)=>{null===n&&(e(...i),n=setTimeout(()=>{n=null},t))}})(()=>{i||(i=jt(e)||i,n=Date.now());Date.now()-n>=1e4&&((()=>{const n=o(t),i=e.map(e=>e[t]),s=e.map(e=>e[n]);r(i,"opacity","0"),setTimeout(()=>{r(i,"display","none"),r(s,"opacity","0"),r(s,"display","block"),setTimeout(()=>{r(s,"opacity","1")},450)},450)})(),t=o(t),n=Date.now())},1e3);window.addEventListener("scroll",s)},Dt=e=>{const t=e[0];if("attributes"===t.type&&"class"===t.attributeName){const e=t.target;setTimeout(()=>{var t;const n=document.getElementsByTagName("video")[0],i=n&&n.getBoundingClientRect(),r=e.classList.contains("jw-flag-floating")&&!e.classList.contains("jw-flag-ads")?i.height+40:40,o=null===(t=document.querySelector('div[id^="sponsorstripe"]'))||void 0===t?void 0:t.firstChild;o&&(o.style.top=`${r}px`)},750)}},qt={attributeFilter:["class"],attributes:!0,childList:!1,subtree:!1},Mt={SVD:"svd",VG:"vg",GODARE:"godare",AFTENPOSTEN:"aftenposten",SA:"sa",BT:"bt",AFTONBLADET:"aftonbladet",E24:"e24",MINMOTE:"minmote",PENT:"pent",GODT:"godt",TEK:"tekno",KLART:"klart",POLARIS:"polaris"},Rt=e=>{const{source:t}=e;return"csm"===t},Bt={[Mt.VG]:["board","netboard","backfill","outstream"],[Mt.AFTONBLADET]:["panorama","outstream"],[Mt.GODARE]:["panorama","outstream"],[Mt.SVD]:["wph-article-panorama","wph-front-panorama"]},Ft=e=>{var t;const{publisher:n}=g.get();return!!Bt[n]&&!!(null===(t=Bt[n])||void 0===t?void 0:t.some(t=>e.includes(t)))},Ht={adRequested:()=>{},adAvailable:e=>{_e(e)&&_t()},adLoaded:e=>{const t=document.getElementById(e.targetId);(e=>{var t;const n=null===(t=document.getElementById(`${e.targetId}`))||void 0===t?void 0:t.parentElement;n&&(e.width>=1260&&e.width<=1280&&(n.classList.add("advertory-aftonbladet-l-format"),xt(e)),e.width>=1600&&e.width<=1620&&(n.classList.add("advertory-aftonbladet-h-format"),xt(e)))})(e),Lt(e),Ce(e)&&(null==t?void 0:t.parentElement)&&(t.classList.add("advertory-aftonbladet-panorama__full-width-ad"),t.parentElement.classList.add("advertory-aftonbladet-panorama-wrapper__full-width-ad")),Le(e)&&((()=>{const{deviceType:e}=g.get();I(e)&&setTimeout(()=>{const e=document.querySelector(".jwplayer"),t=new MutationObserver(Dt);e&&t.observe(e,qt)},1500)})(),(e=>{var t;const n=null===(t=document.querySelector(`#${e.targetId}`))||void 0===t?void 0:t.parentElement;n&&(n.style.cssText="height: 0; margin: 0; padding: 0;")})(e)),(e=>e.targetId.startsWith("outstream"))(e)&&((e=>{const t=document.querySelector(`#div_utif_${e.targetId}`);t&&Rt(e)&&(t.style.height="0px")})(e),null==t||t.classList.add("outstream"))},adNoBid:e=>{},adError:(e,t)=>{},adCollapse:()=>{},adRequestFailure:e=>{},adBadRequest:e=>{},adLoadedMediated:e=>{},adNoBidMediated:e=>{}},Ut={publisherClassName:Mt.AFTONBLADET,fullWidthFormatClassName:"panorama",classesToRemoveOnRefresh:["advertory-aftonbladet-h-format","advertory-aftonbladet-l-format"]},Vt=()=>(window.apntag||(window.apntag={anq:[],defineTag:e=>({targetId:""}),showTag:e=>{},onEvent:(e,t,n)=>{},offEvent:(e,t)=>{},refresh:e=>{},modifyTag:(e,t)=>{},loadTags:e=>{},emitEvent:(e,t)=>{},setPageOpts:e=>{},resizeAd:(e,t,n)=>{},getAstVersion:()=>"",setEndpoint:(e,t)=>{},fireImpressionTrackers:e=>{},setKeywords:()=>{},clearRequest:()=>{}}),window.apntag),Wt=()=>(window.relevantDigital||(window.relevantDigital={cmd:[]}),window.relevantDigital),zt=(e={},t)=>{const{prebid:{externalUidInAuctionEnabled:n,forwardGlimrTags:i=!1}={}}=g.get(),r=[`${Z()}-geo`],o=["aa-sch-context_keyword","aa-sch-publisher","se-aftonbladet-section","se-svd-section","se-generic-section","no-sno-news-section","no-sno-news-subsection",...i?r:[]],s=Object.fromEntries(Object.entries(e).filter(([e])=>o.includes(e))),a=t&&n?{id:t}:{};return{ortb2:Object.assign({site:{ext:{data:s}}},a)}},Kt=(t,...n)=>e(void 0,[t,...n],void 0,function*(e,{timeout:t}={timeout:1e3}){document.querySelector(`script[src="${e}"]:not([type="module"])`)||(yield new Promise((n,i)=>{const r=document.createElement("script");r.async=!0,r.src=e;const o=()=>{a(),n()},s=()=>{a(),i(new Error(`Failed to load ${e}`))},a=()=>{r.removeEventListener("load",o),r.removeEventListener("error",s),clearTimeout(d)};r.addEventListener("load",o),r.addEventListener("error",s);const d=setTimeout(()=>{a(),i(new Error(`Loading script timed out: ${e}`))},t);document.head.appendChild(r)}).catch(e=>{console.error(e)}))}),Gt=()=>{const{prebid:e,tcf:n,country:i}=g.get(),{getConsentSync:r}=o(n),s=r(),{initNativeAd:a}=g.getHandlers();if(!(null==e?void 0:e.enabled))return;const d=(()=>{let e=!1,t=[];const n={relevantCb:{timeout:1e3},auctionCb:{timeout:2e3}};return{getCancel:()=>e,setCancel:t=>{e=t},events:n,failsafeOnTimeout:i=>{const r=Vt(),{prebid:{relevantCbTimeout:o}={}}=g.get(),s="relevantCb"===i&&o?o:n[i].timeout,a=setTimeout(()=>{!n[i].done&&!e&&(console.warn(`Doing failsafe loadTags() call after waiting too long for '${i}'`),e=!0,r.loadTags&&r.loadTags())},s);t.push(a)},cleanup:()=>{t.forEach(e=>clearTimeout(e)),t=[],e=!1,n.relevantCb.done=!1,n.auctionCb.done=!1}}})(),l=Vt(),c=(()=>{const{requests:{user:e={userIds:[]},keywords:t={}}={}}=Vt();return{user:e,keywords:t}})();d.failsafeOnTimeout("relevantCb");const{user:{externalUid:u=""}={},keywords:v}=c;(()=>{const e=Wt();return e.cmd||(e.cmd=[]),e.cmd})().push(()=>{if(d.getCancel()||!l.loadTags)return t("core loadTags() call was cancelled",{cancel:d.getCancel(),apnTagLoadTags:!l.loadTags,condition:"or"}),void d.cleanup();const n=Wt();d.events.relevantCb.done=!0,d.failsafeOnTimeout("auctionCb");const r=s?{gdpr:{cmpApi:"iab",timeout:8e3}}:{cmpApi:"none"};t("prebid consentManagement",r),n.addPrebidConfig(Object.assign(Object.assign({consentManagement:r,enableSendAllBids:!1},ue(i)),zt(v,u))),t("core add prebid config",Object.assign(Object.assign({consentManagement:r,enableSendAllBids:!1},ue(i)),zt(v,u))),n.loadPrebid({configId:e.id,manageAdserver:!1,collapseEmptyDivs:!1,collapseBeforeAdFetch:!1,noGpt:!0,noSlotReload:!0,loadUnknownSlots:!0,apntagCalls:{showTag:()=>{},loadTags:e=>{d.getCancel()||(d.events.auctionCb.done=!0,l.loadTags(e)),d.cleanup()}},customNativeRender:e=>{Jt(e,a)}}),t("core load prebid",{configId:e.id,manageAdserver:!1,collapseEmptyDivs:!1,collapseBeforeAdFetch:!1,noGpt:!0,noSlotReload:!0,loadUnknownSlots:!0,apntagCalls:{showTag:()=>{},loadTags:e=>{d.getCancel()||(d.events.auctionCb.done=!0,l.loadTags(e))}},customNativeRender:e=>{Jt(e,a)}})})},Jt=(e,t)=>{var n;const{divId:i,native:r,bid:o}=e,s=document.querySelectorAll(`[id^=${i}]`)[0],a=`RY-${s.id}`;((e,t)=>{e.childNodes.forEach(e=>e.style.cssText="position: absolute; z-index: -1;");const n=document.createElement("div");n.setAttribute("id",t),e.appendChild(n)})(s,a);const d=null===(n=s.getElementsByTagName("iframe")[0])||void 0===n?void 0:n.contentWindow;t({native:r,targetId:a},g.get()),null==d||d.postMessage(JSON.stringify({message:"Prebid Response",ad:"\x3c!-- nothing --\x3e",adId:o.adId}),"*")},Yt=e=>e.includes("snoap.no"),Qt=e=>{var t,n,i,r,o;return!!(null===(o=null===(r=null===(i=null===(n=null===(t=window.apntag)||void 0===t?void 0:t.requests)||void 0===n?void 0:n.tags[e])||void 0===i?void 0:i.adResponse)||void 0===r?void 0:r.ads[1])||void 0===o?void 0:o.rtb)},Xt=gt([],()=>{const e=({width:e,height:t})=>{var n;const i=null===(n=document.querySelector("#sf_align"))||void 0===n?void 0:n.querySelector("div");if(!i)return;const{clientWidth:r,clientHeight:o}=i,s=e/r,a=t/o;i.style.transform=`scale(${s},${a})`,i.style.transformOrigin="left top"},t=()=>{const{innerWidth:t,innerHeight:n}=window;e({width:t,height:n})};window.addEventListener("resize",t=>{if(!t.currentTarget)return;const n={width:innerWidth,height:innerHeight};e(n)});const n=window.frameElement;(null==n?void 0:n.contentWindow)?n.contentWindow.document.body.onload=t:document.body.onload=t}),Zt=e=>{const t=gt([],()=>{new MutationObserver((e,t)=>{document.querySelector("iframe")&&((()=>{const e=document.querySelector("iframe");e&&(e.onload=()=>{if(!e.contentDocument)return;document.body.style.height="100%",document.documentElement.style.height="100%",e.height="100%",e.width="100%";const t=e.contentDocument.createElement("style");t.textContent="\n adfm-ad {\n height: 100% !important;\n width: 100% !important;\n }\n ",e.contentDocument.head.appendChild(t);const n=e.contentDocument.querySelector("iframe");if(!(null==n?void 0:n.contentDocument))return;const i=n.contentDocument.createElement("style");i.textContent="\n #image {\n background-size: cover !important;\n }\n ",new MutationObserver((e,t)=>{n.contentDocument&&(n.contentDocument.head.appendChild(i),t.disconnect())}).observe(e.contentDocument,{childList:!0,subtree:!0})})})(),t.disconnect())}).observe(document.body,{childList:!0,subtree:!0})}),n=document.createElement("script");n.textContent=`(${t})()`;return e+n.outerHTML},en=[],tn={},nn=(e,t)=>{e.forEach(({target:e,isIntersecting:n})=>{const i=on(e);n?(rn(i,n),sn(e,i,t)):(rn(i,n),an(e,i,t))})},rn=(e,t)=>{var n,i;const r=null===(n=document.getElementById(e))||void 0===n?void 0:n.querySelector("iframe");if(!r)return;const o=t?"showFullscreen":"hideFullscreen";null===(i=r.contentWindow)||void 0===i||i.postMessage(`advertory:${o}-${e}`,"*")},on=e=>{var t;return null===(t=e.children[0])||void 0===t?void 0:t.id},sn=(e,t,n)=>{e.classList.add("in-screen"),document.body.classList.add("fullscreen-scroll-in-screen"),window.dispatchEvent(new CustomEvent("advertory:fullscreenScrollInView")),en.includes(t)||en.push(t),n&&window.addEventListener("scroll",tn[t],{passive:!0})},an=(e,t,n)=>{en.includes(t)&&(n&&window.removeEventListener("scroll",tn[t]),document.body.classList.remove("fullscreen-scroll-in-screen"),e.classList.remove("in-screen"),window.dispatchEvent(new CustomEvent("advertory:fullscreenScrollNotInView")))},dn=(e,t={fadingHeaderEnabled:!1,headerSelectors:[".js-masthead"],skyscraperSelectors:[".skyscraper_r"],headerZIndex:3})=>{const{headerSelectors:n=[".js-masthead"],skyscraperSelectors:i=[".skyscraper_r"],headerZIndex:r=3}=t,o=[],s=[];return n.forEach(e=>{var t;const n=null!==(t=document.querySelector(e))&&void 0!==t?t:document.querySelector("header");n&&o.push(n)}),i.forEach(e=>{const t=document.querySelector(e);t&&s.push(t)}),()=>{o.length&&ln(e,o,r,0),s.length&&ln(e,s,r,40)}},ln=(e,t,n,i)=>{const r=e.offsetHeight,o=window.scrollY,s=e.getBoundingClientRect().top+o;t.forEach(e=>{const t=e.offsetHeight;let a;a=s>o?(s-o)/t-i:(o+t-(s+r))/t;const d=a<=0;e.style.visibility=d?"hidden":"",e.style.zIndex=d?"":n.toString(),e.style.pointerEvents=d?"none":"all",e.style.opacity=a.toString()})},cn={no:{adText:"ANNONSE",adFrom:"ANNONSE FRA",adContent:"ANNONSØRINNHOLD",adContentFrom:"ANNONSØRINNHOLD FRA"},se:{adText:"ANNONS",adFrom:"ANNONS FRÅN",adContent:"EXTERN LÄNK",adContentFrom:"EXTERN LÄNK FRÅN"}};let un=null;const vn=(e,t)=>{let n=e;return n=(e=>{const t=document.createElement("script");return t.textContent="\n {\n const frame = window.frameElement;\n \n if (frame) {\n frame.contentWindow.document.body.onload = onLoad;\n } else {\n document.body.onload = onLoad;\n }\n \n function onLoad() {\n window.addEventListener('message', function(event) {\n if (event.data === 'advertory:showFullscreen-'+document.body.id) {\n document.body.style.display= \"block\";\n } else if (event.data === 'advertory:hideFullscreen-'+document.body.id) {\n document.body.style.display= \"none\";\n }\n });\n }\n }\n ",e+t.outerHTML})(e),n=(e=>{const t=document.createElement("script");return t.textContent=`(${Xt})()`,e+t.outerHTML})(n),n=(e=>{if((e=>e.includes("google"))(e))return e;const t=document.createElement("div");t.innerHTML=e;const n=t.querySelector("img");return n?(n.style.width="100%",n.style.height="100%",n.style.objectFit="cover",n.style.position="fixed",t.innerHTML):e})(n),n=(e=>{if(Yt(e))return e;const t=document.createElement("style");return t.textContent="\n .GoogleActiveViewClass, .GoogleActiveViewElement {\n transform: translate(calc(-50% + 50vw), 0);\n width: 100vw !important;\n height: 100vh !important;\n }\n .GoogleActiveViewClass img, .GoogleActiveViewElement img {\n width: 100vw;\n height: 100vh;\n object-fit: cover;\n }\n .GoogleActiveViewClass iframe {\n width: 100vw !important;\n height: 100vh !important;\n }\n ",e+t.outerHTML})(n),(e=>e.includes("adform"))(n)&&(n=(e=>{const t=document.createElement("script");t.textContent='\n var frame = window.frameElement;\n if (frame) {\n frame.style.removeProperty("width");\n frame.style.removeProperty("height");\n frame.contentWindow.document.body.onload = onLoad;\n } else {\n document.body.onload = onLoad;\n }\n \n function onLoad() {\n var iframe = document.querySelector("adfm-ad iframe");\n if (iframe) {\n var image = iframe.contentWindow.document.getElementById("image");\n if (!image) return;\n image.style.backgroundSize = "cover";\n } else {\n var iframe = document.querySelector(".adform-adbox iframe");\n if (iframe) {\n var style = document.createElement("style");\n style.textContent = "#banner {width: 100% !important; height: 100% !important;} #banner img {object-fit: cover;}";\n iframe.contentDocument.body.append(style);\n iframe.style = "width: 100vw; height: 100vh;";\n } else {\n var observer = new MutationObserver(function(mutations, obs) {\n for (var mutation of mutations) {\n var iframe = mutation.addedNodes[0];\n if (iframe && iframe.nodeName === "IFRAME") {\n iframe.style = "width: 100vw; height: 100vh;";\n iframe.dataset.contents += "<style>#banner {width: 100% !important; height: 100% !important;} #banner img {object-fit: cover;}</style>";\n obs.disconnect();\n }\n }\n });\n observer.observe(document.body, { childList: true, subtree: true });\n }\n }\n }\n ';const n=document.createElement("style");return n.textContent="\n html, body, adfm-ad, #sf_align, .adform-adbox, .adform-adbox img {\n width: 100% !important;\n height: 100% !important;\n object-fit: cover;\n max-width: 100vw;\n }\n ",e+n.outerHTML+t.outerHTML})(n)),(e=>e.includes("529299503"))(n)&&(n=Zt(n)),(e=>e.includes("de17a"))(n)&&(n=(e=>Yt(e)?e:e.replace("<iframe ","<iframe onload=\"\n var f = document.querySelector('iframe');\n if (!f) return;\n var s = f.style;\n s.transform = 'scale(' + (window.innerHeight / Number(f.height)).toFixed(2) + ')';\n s.right = parseInt((Number(f.width) - window.innerWidth) / 2) + 'px';\n s.bottom = parseInt((Number(f.height) - window.innerHeight) / 2) + 'px';\n s.position = 'relative';\n \" "))(n)),Yt(n)&&(n=(e=>{let t=e.replace("<html>",'<html style="height: 100%;">');return t=t.replace("</iframe>","</iframe><style>#sf_align {height: 100%;} #sf_align iframe {height: 100vh;}</style>"),t=t.replace('<body style="','<body style="height: 100%; '),t})(n)),(e=>e.includes("kreateam.io"))(n)&&(n=(e=>{let t=e.replace("<html>",'<html style="height: 100%;">');return t=t.replace("</div>","</div><style>#sf_align {height: 100%;} #sf_align iframe {height: 100vh;}</style>"),t=t.replace('<body style="','<body style="height: 100%; '),t})(n)),Qt(t)&&(n=(e=>{const t=document.createElement("script");t.textContent='var frame = window.frameElement;\n if (frame) {\n frame.style.width = "100vw";\n frame.style.height = "100vh";\n }';const n=document.createElement("div");return n.innerHTML=e,n.appendChild(t),n.innerHTML})(n)),n},pn=()=>{un=null;const e=window.visualViewport,t=e?e.height:window.innerHeight,n=e?e.width:window.innerWidth,i=e?e.offsetTop:0,r=e?e.offsetLeft:0,o=document.documentElement;o.style.setProperty("--advertory-fullscreen-scroll-vh",`${t}px`),o.style.setProperty("--advertory-fullscreen-scroll-vw",`${n}px`),o.style.setProperty("--advertory-fullscreen-scroll-top",`${i}px`),o.style.setProperty("--advertory-fullscreen-scroll-left",`${r}px`)},gn=()=>{un||(un=window.requestAnimationFrame(pn))},hn=(e,t)=>{var n,i,r;const{country:o}=g.get(),{targetId:s}=e;(e=>{const{articlesContainerWidth:t=1302,backgroundColor:n="#fff",foregroundColor:i="#fff",margin:r="16px 0",beforeContentValue:o=""}=e,s=t/2,a=document.createElement("style");a.innerHTML=`\n :root {\n --background: linear-gradient(\n to right,\n ${n} 0px,\n ${n} calc(50% - ${s}px),\n ${i} calc(50% - ${s}px),\n ${i} calc(50% + ${s}px),\n ${n} calc(50% + ${s}px),\n ${n} 100%\n ) !important;\n \n --advertory-fullscreen-scroll-wrapper-margin: ${r};\n }\n \n .advertory-fullscreen-scroll-wrapper {\n ${o&&"clip-path: polygon(0 -16px, 100vw -16px, 100vw 100dvh, 0 100dvh);\n -webkit-clip-path: polygon(0 -16px, 100vw -16px, 100vw 100dvh, 0 100dvh);"}\n }\n\n .advertory-fullscreen-scroll-wrapper:before, .advertory-fullscreen-scroll-wrapper:after {\n background: var(--background);\n content: '${o}' !important;\n }`,a.id="ad-fullscreen-scroll-wrapper-style",document.head.appendChild(a)})(null!==(n=null==t?void 0:t.overlayStyles)&&void 0!==n?n:{});const a=document.getElementById(s),d=null==a?void 0:a.parentElement;a&&d&&(((e,t)=>{const n=(null==t?void 0:t.fadingHeaderEnabled)||!1,i=new IntersectionObserver(e=>nn(e,n),{}),r=on(e);i.observe(e),n&&(tn[r]=dn(e,t))})(d,t),a.className="advertory-fullscreen-scroll",Re(e,he)&&(a.style.position="absolute"),d.className="advertory-fullscreen-scroll-wrapper",d.dataset.showTagSubscribeId=s,a.setAttribute("data-ad-label",cn[o].adText),(null==t?void 0:t.moveCogwheelToTheLeft)&&(a.dataset.moveCogwheelToTheLeft="true"),gn(),window.addEventListener("resize",gn),null===(i=window.visualViewport)||void 0===i||i.addEventListener("resize",gn),null===(r=window.visualViewport)||void 0===r||r.addEventListener("scroll",gn))},mn=({targetId:e})=>{const t=(e=>{const{requests:t}=window.apntag,n=Qt(e)?1:0;return null==t?void 0:t.tags[e].adResponse.ads[n].rtb.banner.content})(e);if(!t)return;((e,t)=>{const{requests:n}=window.apntag,i=Qt(e)?1:0;n&&(n.tags[e].adResponse.ads[i].rtb.banner.content=t)})(e,vn(t,e))},yn=(e,t,n)=>{const i=document.getElementById(`div_utif_${e}`);if(!i)return;const{apntag:r}=window,[o,s]=t;if(!i.dataset.lockedsize&&s&&o)i.style.width=`${o}px`,i.style.height=`${s}px`,n&&(r.resizeAd(i.id,[o,s]),i.dataset.lockedsize="true",i.dataset.lockedwidth=o.toString(),i.dataset.lockedheight=s.toString());else if(null==i?void 0:i.dataset.lockedsize){const{lockedwidth:e,lockedheight:t}=i.dataset;e&&t&&r.resizeAd(i.id,[e,t])}},fn=["netboard","board"];class wn{constructor(e,t){this.identityFacade=e,this.tracker=t}buildUrl(e,t){var n,i;const{editionName:r}=e,o=(()=>{const e=window.location.href;return new URL(e).searchParams.get("dre_override_inv_code")||""})(),s=JSON.stringify(null!==(i=null===(n=window.advertory)||void 0===n?void 0:n.renderedDrEditionAds)&&void 0!==i?i:[]),a=new URL("https://dr-edition-teaser-server.inventory.schibsted.io/editions"),{envId:d,spid:l}=t;return a.searchParams.append("editionName",r),o&&a.searchParams.append("urlData",o),s&&a.searchParams.append("excludedItems",s),l&&a.searchParams.append("spid",l),d&&a.searchParams.append("envid",d),a.toString()}fetchData(n){return e(this,void 0,void 0,function*(){var e,i;const r=yield this.identityFacade.getIdentityUser(),o=null!==(i=yield null===(e=this.tracker)||void 0===e?void 0:e.getEnvironmentId())&&void 0!==i?i:"",s=(null==r?void 0:r.userId)?String(r.userId):"",a=this.buildUrl(n,{envId:o,spid:s});try{t("Starting fetching DrEdition ad from URL:",a);const e={method:"GET"},n=yield W.get(a,e);return t("Fetch operation completed successfully."),n}catch(e){t("Error during fetch operation:",e)}return null})}}class bn{getDrEditionUTMParams(e,t){var n;const{title:i,clientName:r,creativeId:o}=null!==(n=null==e?void 0:e.pulseData)&&void 0!==n?n:{},{editionName:s}=t,a=i.replace(/<[^>]*>/g,"");return Object.assign({utm_source:"vgfront",utm_content:s,utm_campaign:r,utm_medium:a},o&&{utm_id:`df-${o}`})}getUrlSearchParams(e,t,n){if(!e)return"";const i=this.getDrEditionUTMParams(t,n),r=new URLSearchParams(decodeURIComponent(e.search)),o=new URLSearchParams(e.search);return Object.entries(i).forEach(([e,t])=>{r.has(e)||o.set(e,null!=t?t:"")}),o.toString().replace(/\+/g,"%20")}getUrlWithParams(e,t){var n;const i=null===(n=null==e?void 0:e.pulseData)||void 0===n?void 0:n.url;if(!i)return"";const r=this.getDrEditionUTMParams(e,t),o=new URL(i);return Object.entries(r).forEach(([e,t])=>{o.searchParams.has(e)||o.searchParams.set(e,null!=t?t:"")}),o.toString()}handleVideo(t,n){return e(this,void 0,void 0,function*(){const{id:e,autoplay:i,mute:r,videoLoop:o,vendor:s}=n.videoConfiguration;t.classList.add("vgtv-video-container"),Object.assign(t.dataset,{vgtvVideoId:e,vgtvVendor:s,vgtvAutoplay:i,vgtvMuted:r,vgtvLoop:!!o,vgtvNa:!0,vgtvRecommended:!1,vgtvPulseProvider:"vg",vgtvPulseProductTag:"partnerstudio"})})}getPulseObjectId(){return"sdrn:vg:content:partnerstudio:element:partnerstudio:stats"}getPulsePageId(){return"sdrn:vg:frontpage:front"}getTags(e){var t;let n;if(n=e instanceof HTMLAnchorElement?e.href:null===(t=null==e?void 0:e.querySelector("a"))||void 0===t?void 0:t.href,!n)return[];const{host:i,pathname:r}=new URL(n);if(!i.includes("www.vg.no")&&!r.includes("annonsorinnhold"))return[n];const o=r.split("/");return o.length?[...o.filter(Boolean).slice(1).map(e=>e),n]:[n]}}class En{constructor(e,t,n,i){this.drEditionService=e,this.rendererManager=t,this.videoManager=n,this.pulseManager=i,this.drEditionAds=[]}fetchAndRenderAd(n,i){return e(this,void 0,void 0,function*(){var e,r;const{drEditionConfig:{containerSelector:o},renderAsBackfill:s=!1}=i,a=n.querySelector(o);if(!a)return void t(`Container with selector "${o}" not found.`);const d=yield this.drEditionService.fetchData(i);return(null==d?void 0:d.itemId)||s?!(null==d?void 0:d.itemId)&&s?(t("No Dr. Edition ads available to render. Collapsing whole placement."),void Xe(n.id)):((null==d?void 0:d.itemId)&&s&&(t("Dr. Edition ad available to render as a Xandr backfill."),Ze(n.id)),void(d&&(d.css&&((e,t)=>{const n=document.createElement("link");n.rel="preload",n.href=e,n.as=t,document.head.appendChild(n)})(d.css,"style"),this.rendererManager.render(a,d,i),yield null===(e=this.videoManager)||void 0===e?void 0:e.handle(d,i),this.drEditionAds.push(d),window.advertory=window.advertory||{},window.advertory.renderedDrEditionAds=window.advertory.renderedDrEditionAds||[],window.advertory.renderedDrEditionAds.push(d.itemId),this.observeAdView(n,d,i),null===(r=n.querySelector("a"))||void 0===r||r.addEventListener("pointerup",()=>null)))):(t("No Dr. Edition ads available to render. Hiding Dr. Edition and rendering Xandr backfill."),this.hideDrEdition(a),void this.showBackfill(n))})}observeAdView(e,t,n){this.observeCarousel(e,t,n)||((e,t,n={threshold:.5})=>{new IntersectionObserver(([e],n)=>{e.isIntersecting&&(t(),n.disconnect())},n).observe(e)})(e,()=>this.pulseManager.trackContentView(e,t,n),{threshold:.5})}showBackfill(e){var t;const n=e.querySelector(".fallback");if(!n)return;n.style.display="block";const i=null!==(t=n.dataset.fallbackTargetId)&&void 0!==t?t:"";Ze(i)}hideDrEdition(e){e.style.display="none"}observeCarousel(e,t,n){const i=e.querySelector(".dr-edition-slider");if(!i)return!1;let r=null;const o=new IntersectionObserver(e=>{e.forEach(e=>{e.isIntersecting&&e.intersectionRatio>=.9&&(r&&clearTimeout(r),r=setTimeout(()=>{e.target.onclick=()=>this.pulseManager.trackContentClick(e.target,t,n),this.pulseManager.trackContentView(e.target,t,n)},500)),[...i.children].forEach(e=>{o.observe(e)})})},{threshold:[.9]});return[...i.children].forEach(e=>{o.observe(e)}),!0}}class In{constructor(e,t){this.newsroomStrategy=e,this.pulseManager=t}render(e,t,n){if(!(null==t?void 0:t.itemId))return;const{getConsentSync:i}=o(n.tcf),r=!!i(),s=I(n.device)?t.mobileHTML:t.desktopHTML,a=r?s:s.replace(/<img [^>]*class="tracking-pixel"[^>]*>/g,"");e.innerHTML=a,e.querySelectorAll("a").forEach(e=>{var i,r,o;e.search=null!==(o=null===(r=(i=this.newsroomStrategy).getUrlSearchParams)||void 0===r?void 0:r.call(i,e,t,n))&&void 0!==o?o:"",e.onclick=()=>this.pulseManager.trackContentClick(e,t,n)})}}class Tn{constructor(e){this.strategy=e}handle(t,n){return e(this,void 0,void 0,function*(){const{videoConfiguration:{id:e,preview:i}={}}=t;(e||i)&&(yield this.importScript(n),yield this.createVideoElement(t,n))})}importScript(n){return e(this,void 0,void 0,function*(){const e=n.drEditionConfig.videoScriptUrl,i=document.querySelector(`script[src="${e}"]`);if(e&&!window.autoplayQueue&&!i)try{yield Kt(e)}catch(e){t("Error! Failed to prepare SVP player script for Dr. Edition!",e)}})}createVideoElement(t,n){return e(this,void 0,void 0,function*(){const e=document.createElement("div"),{node:i}=t.videoConfiguration,r=[...document.querySelectorAll(`#${i}`)||[]].find(e=>0===e.children.length);if(this.handlePreviewVideo(t,n))return;this.strategy.handleVideo(e,t),null==r||r.appendChild(e),window.autoplayQueue=window.autoplayQueue||[],window.autoplayQueue.push(e=>{e.parse()});const o=null==r?void 0:r.parentNode;if(!o)return;const s=o.closest("a");o.addEventListener("click",e=>{const t=e.target.closest("a");s!==t&&t||(e.stopPropagation(),e.preventDefault())})})}handlePreviewVideo(e,t){var n,i,r;const{preview:{url:o,thumbnail:s}}=null!==(n=e.videoConfiguration)&&void 0!==n?n:{};if(!o)return!1;const a=document.querySelector(".dr-edition-preview .preview-video");return!!a&&(a.setAttribute("playsinline",""),!(!a||!s)&&(null===(r=(i=t.drEditionConfig).addPreviewVideo)||void 0===r||r.call(i,a),!0))}}class Sn{constructor(e,t){this.pulse=e,this.newsroomStrategy=t}getEventInput(e,t,n,i){return{}}mapPageType(e){return{front:"Frontpage",article:"Article",section:"Article",collection:"Article",other:"Article"}[e||"front"]||"Frontpage"}getArticleId(){return location.pathname.split("/").slice(-2,-1).pop()||""}getTeaserElementText(e,t){if(!e)return"";const n=e.querySelector({title:".dr-edition-title",subtitle:".dr-edition-subtitle",image:"img.teaser-main-image"}[t]);if(!n)return"";if("image"===t)return n.src||"";const i=null==n?void 0:n.textContent;return i?i.trim():""}getEventTarget(e,t){const{itemId:n,pulseData:{url:i}={}}=t,r=this.getTeaserElementText(e,"title");return{id:n,name:this.normalizePlacementTitle(null!=r?r:""),type:"Page",url:i}}normalizePlacementTitle(e){return e.replace(/<[^>]+>/gi,"").replace(/[^a-z0-9æøå\s_-]/gi,"")}trackContentView(t,n,i){return e(this,void 0,void 0,function*(){var e,r,o,s,a;if(!this.pulse)return;const d=this.getEventInput(t,n,i,"view");(null===(e=this.pulse)||void 0===e?void 0:e.trackViewUIElement)?null===(o=null===(r=this.pulse)||void 0===r?void 0:r.trackViewUIElement)||void 0===o||o.call(r,d):null===(a=null===(s=this.pulse)||void 0===s?void 0:s.trackElementView)||void 0===a||a.call(s,d)})}trackContentClick(t,n,i){return e(this,void 0,void 0,function*(){var e,r,o,s;if(!this.pulse)return;const a=this.getEventInput(t,n,i,"click");this.pulse.trackClickUIElement?null===(r=(e=this.pulse).trackClickUIElement)||void 0===r||r.call(e,a):null===(s=(o=this.pulse).trackElementClick)||void 0===s||s.call(o,a)})}}class An extends Sn{constructor(e,t,n){super(e,t),this.pulse=e,this.newsroomStrategy=t,this.pageType=n}getEventBaseData(e,t,n){const{pulseData:{title:i,clientName:r="",creativeId:o}={}}=t,{columnName:s,primaryPosition:a}=n;return{"@type":"UIElement",elementType:"Teaser",layout:{elementSize:"large",imageUrl:"",name:"large"},name:i,placement:{columnName:s,primaryPosition:a},"spt:custom":{is_sponsored:!0,sponsor:r,"spt: creativeId":o},url:location.origin}}getEventInput(e,t,n){return{object:this.getEventBaseData(e,t,n),target:this.getEventTarget(e,t)}}}class Cn extends Sn{constructor(e,t,n){super(e,t),this.pulse=e,this.newsroomStrategy=t,this.pageType=n}getEventBaseData(e,t,n){var i,r,o,s,a,d;const{itemId:l,pulseData:{clientName:c,creativeId:u}={}}=t,v=n.editionName,p=this.mapPageType(this.pageType),g=null===(i=this.newsroomStrategy)||void 0===i?void 0:i.getPulsePageId(this.pageType||"front",this.getArticleId());return{"@id":null!==(s=null===(o=null===(r=this.newsroomStrategy)||void 0===r?void 0:r.getPulseObjectId)||void 0===o?void 0:o.call(r))&&void 0!==s?s:v,"@type":"UIElement",position:v,elementType:"Article",custom:{customer:c,creativeId:null!=u?u:l},page:{"@id":null!=g?g:v,"@type":p,url:location.origin},tags:null===(d=null===(a=this.newsroomStrategy)||void 0===a?void 0:a.getTags)||void 0===d?void 0:d.call(a,e)}}getEventInput(e,t,n,i){return{object:this.getEventBaseData(e,t,n),partnerstudio:this.getEventPartnerstudioData(e,t,n,i),target:this.getEventTarget(e,t),provider:this.getProviderData()}}getEventPartnerstudioData(e,t,n,i){var r,o,s,a;const{pulseData:{algorithm:d="sov",clientName:l,creativeId:c,editionId:u,itemId:v,url:p,probability:g}={}}=t,h=Math.floor(Date.now()/1e3),m=this.getTeaserElementText(e,"title"),y=this.getTeaserElementText(e,"subtitle"),f=this.getTeaserElementText(e,"image"),w=null!==(a=null!==(s=null===(o=null===(r=this.newsroomStrategy)||void 0===r?void 0:r.getUrlWithParams)||void 0===o?void 0:o.call(r,t,n))&&void 0!==s?s:p)&&void 0!==a?a:"";return{algorithm:d,clientName:l,probability:g,creativeId:c,device:n.device,editionId:u,itemId:v,link:w,placement:n.editionName,subtitle:y,time:h,title:m,type:i,imageUrl:f,frontId:86,tracking_type:"ad",xandrAdLoaded:!1}}getProviderData(){return{productTag:"partnerstudio"}}}const kn={FRONT:"front",ARTICLE:"article"},Pn=(e,t)=>{null==t||t.forEach(t=>{const n=window.SVP.Player.Plugins.get(t);e.addPlugin(new n)})},On=t=>e(void 0,void 0,void 0,function*(){var e,n;return(null===(e=null===window||void 0===window?void 0:window.SVP)||void 0===e?void 0:e.Player)?new window.SVP.Player(t):((()=>{const e="svp-player-sdk",t=document.querySelector(e),n=Array.from(document.querySelectorAll('script[src^="https://cdn.stream.schibsted.media/player"]'));if(t||n.length>0)return;const i=document.createElement("script");i.id=e,i.src="https://cdn.stream.schibsted.media/player/3.78.1/player.min.js",i.async=!0;try{i.src=i.src.replace("player.min","player.next.min")}catch(e){console.error("Failed to set player.next.min source:",e)}document.head.insertBefore(i,document.head.firstChild)})(),(null===(n=window.SVP)||void 0===n?void 0:n.isLoaded)?new window.SVP.Player(t):yield new Promise(e=>{window.addEventListener("onSvpPlayerReady",()=>e(new window.SVP.Player(t)))}))}),$n={ContentMutePlugin:e=>{window.SVP.Player.Plugins.register({getName:()=>"ContentMutePlugin",initialize(){},setup(){const t=this.player.config.get("mute");this.container=e||this.player.getContainer(),this.muted=t,t&&this.listenToOnce(this.player,"ready",this.renderButtonElement,this)},getButtonElement(){const e=document.createElement("button");e.className="player-plugin-content-mute";const t=document.createElement("span");return t.className="volume-button-icon",e.appendChild(t),e},renderButtonElement(){this.buttonElement=this.getButtonElement(),this.buttonElement.addEventListener("click",this.onButtonClick.bind(this)),this.container.appendChild(this.buttonElement),this.isVideo()||(this.buttonElement.style.display="none"),this.getJWPlayer()&&this.getJWPlayer().on("mute",this.onMuteChange,this)},onButtonClick(){this.getJWPlayer()&&(this.container.classList.add("has-interacted"),this.muted=!this.muted,this.getJWPlayer().setMute(this.muted))},onMuteChange(e){this.muted=e.mute,this.muted?this.buttonElement.classList.remove("content-video-volume-on"):this.buttonElement.classList.add("content-video-volume-on")},isVideo(){return"video"===this.player.getRawAsset().assetType},getJWPlayer(){return this.player.model.player}})},IntegrationMenu:()=>{window.SVP.Player.Plugins.register({getName:()=>"IntegrationMenu",setup(){return e(this,void 0,void 0,function*(){yield Promise.resolve().then(function(){return xr})})}})}},Ln=(e,t)=>{null==e||e.forEach(e=>{$n[e](t)})};class xn{handleVideo(t,n){return e(this,arguments,void 0,function*(t,{videoConfiguration:{id:n,node:i,autoplay:r,mute:o,vendor:s}}){yield e(void 0,void 0,void 0,function*(){return yield new Promise(e=>{var t;Boolean(null===(t=window.SVP)||void 0===t?void 0:t.Player)?e(!0):window.addEventListener("onSvpPlayerReady",()=>e(!0))})});const a=["ContentMutePlugin"],d=this.createPlayerOverlay(t);Ln(a,d);const l={id:n,node:i,autoplay:r,mute:o,vendor:s,autopause:"viewable",maxBitrate:600,pulse:{provider:"e24"},recommended:{autoplay:!1,next:{countdown:10}},skin:{name:"e24-default",url:""}},c=yield On(l);c.once("assetReady",()=>{Pn(c,a)}),c.once("ready",()=>{const e=t;new MutationObserver(t=>{t.forEach(({type:t,attributeName:n})=>{"attributes"===t&&"class"===n&&(e.classList.contains("jw-state-playing")?d.classList.add("is-playing"):d.classList.remove("is-playing"),e.classList.contains("jw-flag-user-inactive")?d.classList.add("is-inactive"):d.classList.remove("is-inactive"))})}).observe(e,{attributes:!0,attributeFilter:["class"]})}),c.once("PulseStats:ready",()=>e(this,void 0,void 0,function*(){const e=yield c.getPlugin("PulseStats").getTracker();null==e||e.update({provider:{id:"e24",productTag:"partnerstudio"}})}))})}getPulseObjectId(){return"sdrn:e24:content:partnerstudio:element:partnerstudio:stats"}getPulsePageId(e,t){return e===kn.FRONT?"sdrn:e24:frontpage:front":`sdrn:e24:article:${t}`}getTags(e){var t;let n;if(n=e instanceof HTMLAnchorElement?e.href:null===(t=null==e?void 0:e.querySelector("a"))||void 0===t?void 0:t.href,!n)return[];if(!n.includes("https://e24.no/annonsorinnhold/"))return[n];const{pathname:i}=new URL(n),r=i.split("/").filter(Boolean);return r.length?[...r.slice(1),n]:[n]}createPlayerOverlay(e){const t=document.createElement("div");t.classList.add("cm-custom-video-overlay"),e.parentElement&&(t.innerHTML=e.parentElement.innerHTML,e.parentElement.replaceChild(t,e));return t.addEventListener("click",e=>{e.stopPropagation(),e.preventDefault(),t.classList.add("has-interacted")}),t}}const Nn="https://www.aftonbladet.se/video-player-extras/latest/";class jn{handleVideo(t,n){return e(this,arguments,void 0,function*(e,{videoConfiguration:{id:t,node:n,autoplay:i,mute:r,vendor:o}}){const s={id:t,node:n,autoplay:i,mute:r,vendor:o,autopause:"viewable",maxBitrate:600,pulse:{provider:"aftonbladet"},recommended:{autoplay:!1,next:{countdown:10}},skin:{name:"",url:""},plugins:{[`${Nn}cta-button.js`]:{name:"CtaButton",options:{type:"unmute"}},[`${Nn}external-link.js`]:{name:"ExternalLink"}}};yield On(s),this.addEditionVideoClass(e)})}addEditionVideoClass(e){var t;(null===(t=null==e?void 0:e.parentElement)||void 0===t?void 0:t.parentElement)&&e.parentElement.parentElement.classList.add("dr-edition-video-player")}getPulseObjectId(){return""}getPulsePageId(){return""}}class _n{handleVideo(e,t){}getPulseObjectId(){return""}getPulsePageId(e,t){return""}}const Dn=(e,t,n)=>{const{publisher:i,pageType:r,country:o}=e,s={[Mt.VG]:new bn,[Mt.E24]:new xn,[Mt.AFTONBLADET]:new jn}[i]||new _n,a=new(o===P.SE?An:Cn)(n,s,r),d=new wn(t,null==n?void 0:n.pulseTracker),l=new In(s,a),c=new Tn(s);return new En(d,l,c,a)},qn=(e,t,n)=>{const{wrapperSelector:i}=null==e?void 0:e.drEditionConfig,r=document.querySelectorAll(i),o=new IntersectionObserver((i,r)=>((e,t,n,i,r)=>{const o=Dn(n,i,r);e.forEach(e=>{var i,r,s;if(!e.isIntersecting)return;const a=e.target,d=null!==(i=a.dataset.editionName)&&void 0!==i?i:"",l=null!==(r=a.dataset.pulseColumnname)&&void 0!==r?r:"",c=null!==(s=a.dataset.pulsePrimaryposition)&&void 0!==s?s:"";o.fetchAndRenderAd(a,Object.assign(Object.assign({},n),{editionName:d,columnName:l,primaryPosition:c})),t.unobserve(a)})})(i,r,e,t,n),{rootMargin:"400% 0px"});r.forEach(e=>o.observe(e))},Mn=[],Rn=(n,i)=>e(void 0,void 0,void 0,function*(){var e;const{pulse:r,tcf:o,deviceType:s,drEdition:a,publisher:d,pageType:l,country:c}=n,u=((e,t)=>{var n;const{deviceType:i,placements:r,drEdition:{fallbackGlobalEditionName:o}={}}=e,s=r[i]||r.desktop,a=ze(t.targetId),d=s.find(e=>e.id===a),l=fn.some(e=>a.startsWith(e)),c=Mn.includes(a),u=(null===(n=null==d?void 0:d.drEdition)||void 0===n?void 0:n.editionName)||o;return d&&l&&!c&&u?(Mn.push(a),Object.assign(Object.assign({},d),{drEdition:Object.assign(Object.assign({},d.drEdition),{editionName:u})})):null})(n,i);if(!u)return;if(!(null==r?void 0:r.instance))return void t("Pulse has not been passed as a prop, aborting");const v=yield R(),p=new B(v),g=Dn({publisher:d,pageType:l,country:c},p,null==r?void 0:r.instance),h=document.getElementById(i.targetId);if(!h||!a)return;h.classList.value="";const m=document.createElement("div");m.className=a.containerSelector.replace(/^[.#:[\]]+/,""),h.innerHTML=m.outerHTML;const y={editionName:(null===(e=null==u?void 0:u.drEdition)||void 0===e?void 0:e.editionName)||"",drEditionConfig:a,device:s,tcf:o,renderAsBackfill:!0};yield g.fetchAndRenderAd(h,y)}),Bn="collapseAd",Fn="hideAd",Hn="resizeAd",Un="renderDrEditionFallback",Vn="wallpaperImageUrl",Wn="wallpaperColor",zn=[Hn,Vn,Wn,Bn,Fn,Un],Kn=e=>{if("object"==typeof e)return e;if(t=e,Qe.test(t)){const t=e.replace(/^wallpaper:url:/,"");return{name:Vn,wallpaperImageUrl:t}}var t;if((e=>e.startsWith("wallpaper:color:"))(e)){const t=e.replace(/^wallpaper:color:/,"");return{name:Wn,wallpaperColor:t}}if(e.startsWith(Un)){const t=e.split(":")[1];return{name:Un,targetId:t}}if(e.startsWith(Bn)||e.startsWith(Fn)){const t=e.split(":")[1];return{name:Bn,targetId:t}}if(e.includes("name")&&zn.some(t=>e.includes(t)))try{return JSON.parse(e)}catch(e){}},Gn=e=>{if(!["http://acdn.adnxs-simple.com","https://acdn.adnxs-simple.com","https://crcdn01.adnxs-simple.com","http://crcdn01.adnxs-simple.com","https://acdn.adnxs.com","http://acdn.adnxs.com","https://adsdk.microsoft.com","https://adsdk.bing.net","https://adsdkprod.azureedge.net"].includes(e.origin.trim()))return;const{data:t}=e;if(!t)return;const n=Kn(t);if(!n)return;if(!n.name||!zn.some(e=>n.name===e))return;const{name:i,targetId:r,wallpaperImageUrl:o,wallpaperColor:s,cmd:a,size:d}=n;i!==Bn&&i!==Fn||!r||Xe(r),i===Hn&&r&&a&&yn(r,a),i===Un&&r&&(Xe(r),Rn(g.get(),{targetId:r})),"resizeMediationAd"===i&&r&&d&&yn(r,d,!0),i===Vn&&o&&(e=>{const t=document.querySelector(`.${Je}`);t&&(t.style.backgroundImage=`url(${e})`)})(o),i===Wn&&s&&(e=>{const t=document.querySelector(`.${Je}`);t&&(t.style.backgroundColor=e)})(s)},Jn=e=>({rootMargin:`${e}px 0px ${e}px 0px`}),Yn=(n,i)=>{if(xe(i))return t(`loading finn blink ad with full ads chain for ${i}`),void(()=>{const{publisher:t,country:n,finnBlink:i}=g.get(),{loadFinnBlinkAd:r,wallpaperHandlers:{adjustAdToHorseshoe:o}}=g.getHandlers(),s=window.apntag,a={publisher:t,country:n,finnBlink:i},d=e=>{Ze(e),Ue(()=>s.showTag(e))};return{withXandrAd:d,withFinnBlinkAd:t=>e(void 0,void 0,void 0,function*(){yield r(t,a,null)}),withFullAdsChain:t=>e(void 0,void 0,void 0,function*(){yield r(t,a,d,()=>{tt.getData("horseshoe").isAvailable&&o(t)})})}})().withFullAdsChain(i);Ue(()=>(t("core showTag",{id:i}),n.showTag(i)))},Qn=(n,i)=>e(void 0,void 0,void 0,function*(){yield Ve,yield We;const e=new IntersectionObserver((e,n)=>((e,n,i)=>{e.filter(({isIntersecting:e,target:{id:t}})=>e&&!t.includes("wallpaper")).forEach(e=>{const{target:r}=e,o=(e=>{const t=e.dataset.showTagSubscribeId;return!e.id.length&&t?t:e.id})(r),s=document.getElementById(o);t("core log from intersection observer handler",{targetId:o,element:s}),i(window.apntag,o),s&&(n.unobserve(s),n.disconnect())})})(e,n,Yn),Jn(i));e.observe(n)}),Xn=new Map,Zn=["no-stavangeraftenblad","sa","no-aftenposten","aftenposten","no-bergenstidende","bt"],ei=".brandstudio-premium-content-widget",ti=({adWrapper:e,placementContainer:t})=>t.offsetHeight+(({adWrapper:e})=>{const{paddingTop:t,paddingBottom:n}=getComputedStyle(e);return parseFloat(t)+parseFloat(n)})({adWrapper:e}),ni=({adWrapper:e,placementContainer:t})=>{const n=ti({adWrapper:e,placementContainer:t});var i;null==e||e.style.setProperty("height",`${n}px`),it(i=t),i.innerHTML=""},ii=e=>{e&&e.style.getPropertyValue("height")&&e.style.removeProperty("height")},ri=({adWrapper:e,placementContainer:t})=>{const{publisher:n}=g.get(),i=Zn.includes(n)&&Boolean(t.closest(ei));const r=i?t.closest(ei):null,o=new MutationObserver(t=>{t.forEach(({addedNodes:t})=>{t.forEach(t=>{const n=t instanceof HTMLElement,s=n&&t.matches("iframe, article")&&e;if(!n||!i&&!s||i&&!r)return;if(s)return ii(e),void o.disconnect();const a=t.closest('[style*="height"]'),d=r;a&&d.contains(a)?ii(a):d.hasAttribute("style")&&ii(d),o.disconnect()})})});try{o.observe(t,{childList:!0,subtree:!0})}catch(e){o.disconnect()}},oi=(e,t,n,i,r,o)=>{var s;const a=performance.now(),d=null!==(s=Xn.get(t))&&void 0!==s?s:0,l=((e,t)=>!!t&&e+t<(new Date).getTime())(i,r)&&n<0;a-d>=r&&l&&(Xn.set(t,a),((e,t,n)=>{const i=null==n?void 0:n.parentElement;i&&n&&ni({adWrapper:i,placementContainer:n}),Ue(()=>{e.setKeywords([t],{[`${Z()}-adreload`]:"1"},{overrideKeyValue:!0}),e.refresh([t])})})(e,t,o))},si=(e,t,n,i)=>{const r=new IntersectionObserver((e,t)=>((e,t,n,i)=>{e.filter(({isIntersecting:e})=>e).forEach(e=>{const{target:r,boundingClientRect:o}=e;t(window.apntag,r.id,o.y,n,i,r)})})(e,oi,n,i),Jn(t));r.observe(e)},ai=(e,t=6)=>{const n=[];for(let i=0;i<e.length;i+=t){const r=e.slice(i,i+t);n.push(r)}return n},di=()=>navigator&&navigator.userAgent.match(/chrome/i)?null:navigator&&navigator.userAgent.match(/apple/i),li=(e,t)=>{if(!(null==t?void 0:t.scrollRefreshEnabled))return;const{targetId:n}=e,i=document.querySelector(`#${n}`),r=null==i?void 0:i.parentElement;if(!r||!i)return;ri({adWrapper:r,placementContainer:i});const{delayTime:o=1e3}=t,s=(new Date).getTime();if(i&&"true"!==i.dataset.subscribedForRefresh){const e=(e=>{var t;const{deviceType:n,preloadMarginsConfig:i}=g.get(),r=null==i?void 0:i[n];return((e,t)=>t[e])(null!==(t=e.dataset.priority)&&void 0!==t?t:"normal",(({high:e,normal:t,low:n}={})=>{var i,r,o,s,a,d;return{high:{refreshMargin:null!==(i=null==e?void 0:e.refreshMargin)&&void 0!==i?i:600,renderMargin:null!==(r=null==e?void 0:e.renderMargin)&&void 0!==r?r:300},normal:{refreshMargin:null!==(o=null==t?void 0:t.refreshMargin)&&void 0!==o?o:300,renderMargin:null!==(s=null==t?void 0:t.renderMargin)&&void 0!==s?s:150},low:{refreshMargin:null!==(a=null==n?void 0:n.refreshMargin)&&void 0!==a?a:100,renderMargin:null!==(d=null==n?void 0:n.renderMargin)&&void 0!==d?d:50}}})(r)).refreshMargin})(i);i.dataset.subscribedForRefresh="true",i.dataset.refresh&&si(i,e,s,o)}},ci=e=>{const{refreshConfig:{visibilityStateRefreshEnabled:t=!1}={}}=g.get();if(!t)return;const n=()=>{"visible"===document.visibilityState&&document.removeEventListener("visibilitychange",n),vi(e)};"visible"!==document.visibilityState&&document.addEventListener("visibilitychange",n)},ui=e=>{const{refreshConfig:{backForwardNavigationRefreshEnabled:t=!1}={},siteSpecificConfig:{classesToRemoveOnRefresh:n=[]}={},isMobileApp:i}=g.get();if(!t)return;e.forEach(({id:e})=>{var t;const n=null===(t=document.querySelector(`#${e}`))||void 0===t?void 0:t.parentElement;n&&(n.dataset.bfCacheRefresh="true")});const r=()=>{const t=document.querySelectorAll('[data-bf-cache-refresh="true"]');for(const i of t){const t=e.find(e=>{var t;return e.id===(null===(t=i.firstElementChild)||void 0===t?void 0:t.id)&&e.bfCacheRefresh}),r=null==t?void 0:t.threshold;Nt(i,r)&&t&&(nt(t.id),n.length&&i.classList.remove(...n),vi([t]))}};i&&document.addEventListener("visibilitychange",r),window.addEventListener("pageshow",e=>{const t=()=>{window.scrollY>0&&(window.removeEventListener("scroll",t),r())};e.persisted&&(di()?window.addEventListener("scroll",t,{passive:!0}):r())})},vi=e=>{const t=6,{requestSize:n=t}=g.get(),i=e.map(({id:e})=>e),r=ai(i,n);for(const e of r)Ue(()=>window.apntag.refresh(e))};const pi="#fff",gi="#0098da",hi=(e,t=!0)=>{(e===vt||e===pt)&&(e=>{e?setTimeout(()=>window.scrollTo(0,0),100):window.scrollTo(0,10)})(t)},mi=()=>{const e=parseInt(document.body.dataset.scrollY||"0",10);document.body.style.top="",window.scrollTo(0,e),document.body.classList.remove("page-locked")},yi=e=>{document.body.style.overflow=e?"initial":"hidden"},fi=e=>{const t=bi(e),n=wi(e);(e=>{e.classList.toggle("takeover-ad-hidden",!0)})(e),yi(!0),e.style.display="none",window.removeEventListener("keydown",t),window.removeEventListener("advertory:closeTakeover",n)},wi=e=>{const t=()=>fi(e);return window.addEventListener("advertory:closeTakeover",t),mi(),t},bi=e=>{const t=t=>{["Enter","Escape"].includes(t.key)&&fi(e)};return mi(),window.addEventListener("keydown",t),t},Ei=e=>{const t=e.querySelector(".advertory-splash-navbar-wrapper");t&&(bi(e),wi(e),t.addEventListener("click",()=>{fi(e),mi()}),yi(!1))},Ii=e=>{(e=>{window.addEventListener("scroll",()=>{e.getBoundingClientRect().bottom,(e=>{const t=e.getBoundingClientRect().bottom;e.style.opacity=""+t/e.offsetHeight})(e)},{passive:!0})})(e),wi(e);const t=document.querySelector("header");document.querySelectorAll(".smooth-close-takeover").forEach(e=>e.addEventListener("click",()=>null==t?void 0:t.scrollIntoView({behavior:"smooth"})))},Ti=e=>{const{takeover:{splash:{showAnnonsLabel:t=!1}={}}={}}=g.get(),n=e.querySelectorAll(".advertory-splash-navbar-wrapper"),i=document.querySelector(".advertory-takeover-label");Array.from(n).forEach(e=>e.style.display="flex"),t&&i&&(i.style.display="flex",i.innerText=cn.se.adText),e.classList.toggle("advertory-splash-wrapper",!0)},Si=e=>{const t=document.querySelectorAll(".advertory-topscroller-elements");Array.from(t).forEach(e=>e.style.display="flex");const n=document.querySelector(".advertory-takeover-label");n&&(n.style.display="flex",n.innerText=cn.no.adText,n.classList.add("takeover-topscroller-label"),e.classList.toggle("topscroller-wrapper",!0))},Ai=e=>{const t=document.querySelectorAll(".advertory-welcome-page-elements");Array.from(t).forEach(e=>{e.style.display="flex",e.style.animation="elementsAnimation 1.5s ease-out forwards"});const n=document.querySelector(".advertory-takeover-label");n&&(n.style.display="flex",n.innerText=cn.se.adText,e.classList.toggle("welcome-page-wrapper",!0))},Ci=()=>{const e=document.querySelector(".welcome-page-wrapper, .topscroller-wrapper, .advertory-splash-wrapper");if(!e)return;let t=0;new IntersectionObserver(e=>{e.forEach(e=>{var n;if(e.isIntersecting){window.dispatchEvent(new CustomEvent("advertory:takeoverInView"));(null!==(n=Array.from(e.target.classList))&&void 0!==n?n:[]).includes("advertory-splash-wrapper")&&(()=>{const e=window.scrollY||0;document.body.dataset.scrollY=e.toString(),document.body.style.top="0",document.body.classList.add("page-locked"),document.documentElement.scrollTop=0})(),t++}else t>0&&window.dispatchEvent(new CustomEvent("advertory:takeoverNotInView"))})},{root:null,rootMargin:"0px",threshold:0}).observe(e)},ki=(e,t)=>{let n=e;return e.includes("529299503")&&(n=(e=>{const t=document.createElement("script");return t.textContent=`(${St})()`,e+t.outerHTML})(e)),n},Pi=e=>{const t=(e=>{const{requests:t}=window.apntag,n=Qt(e)?1:0;return null==t?void 0:t.tags[e].adResponse.ads[n].rtb.banner.content})(e);if(!t)return;((e,t)=>{const{requests:n}=window.apntag,i=Qt(e)?1:0;n&&(n.tags[e].adResponse.ads[i].rtb.banner.content=t)})(e,ki(t))},Oi=(e,t)=>{const{takeover:n}=g.get(),{targetId:i}=e,r=document.querySelector(`#${i}`),o=document.querySelector(".advertory-takeover-wrapper");if(!r||!o||!n)return;const s=(e=>{const{width:t,height:n}=e;return ft(t,n)?ut:wt()?pt:vt})(e),a=o.offsetHeight,d=window.scrollY>a;var l,c;o.style.display="block",!d&&hi(s,!1),((e,t)=>{({[vt]:Ai,[ut]:Ti,[pt]:Si})[t](e)})(o,s),Ci(),l=o,c=s,{[vt]:Ii,[pt]:Ii,[ut]:Ei}[c](l),((e,t,n)=>{if(!n)return;({[vt]:()=>{const{buttonLabel:i}=It(n,t);["#advertory-welcome-page-scroll-label","#advertory-welcome-page-scroll-image"].forEach(t=>{const n=e.querySelector(`${t}`);n&&(n.innerText=null!=i?i:"")})},[ut]:()=>{const{themeColors:i,logotype:r,buttonLabel:o,showArrowIcon:s}=It(n,t);["#advertory-splash-close-label",".advertory-splash-close","#advertory-splash-logotype",".advertory-splash-navbar-wrapper"].forEach(t=>{const n=e.querySelector(`${t}`);if(n){if("#advertory-splash-close-label"===t&&(n.innerText=null!=o?o:""),".advertory-splash-close"===t&&s){const e=document.createElement("img");e.setAttribute("src","data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAAfQAAAH0Bx0gPAAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAABzSURBVDiNtdPJCYBADEDRzzRmE3ZgEV6tRHHpzELiIQrBZRajA7lk4EE2RIQjgApYgdbmY8EJaADZo3sDBKAvQa4JRYZc5D6pyJiDPMuKTCkkXp8icwxJd1mRxSC1/Q94328luJroGqNrkdyrzAfHVHzOG+8CKlLk+LO+AAAAAElFTkSuQmCC"),e.setAttribute("alt","close ad"),n.appendChild(e)}if("#advertory-splash-logotype"===t&&r&&(n.setAttribute("src",r.url),n.setAttribute("alt",r.alt)),".advertory-splash-navbar-wrapper"===t&&i){const{backgroundColor:e,color:t}=i;n.style.setProperty("background-color",null!=e?e:pi,"important"),n.style.color=null!=t?t:gi}}})},[pt]:()=>{const{buttonLabel:i,showArrowIcon:r,showCloseButton:o=!0}=It(n,t);["#advertory-topscroller-scroll-label","#advertory-topscroller-scroll-image",".advertory-topscroller-close"].forEach(t=>{const n=e.querySelector(`${t}`);n&&(".advertory-topscroller-close"!==t||o||(n.style.display="none"),"#advertory-topscroller-scroll-image"!==t||r||(n.style.display="none"),"#advertory-topscroller-scroll-label"===t&&(n.innerText=null!=i?i:""))})}})[t]()})(o,s,n),bt(),!d&&hi(s,!0),Tt(e,s)},$i="advertory-brandmetrics-survey",Li=()=>e(void 0,void 0,void 0,function*(){const{norstat:{enabled:t}={},country:n,isMobileApp:i}=g.get();if(!t||i)return;const r=(e=>{const{ppid1:t,ppid2:n}=de.getPPIDs(),{ppid1:i,ppid2:r}=le.getPPIDs(),o=(new ae).add(n,$[e]).add(t,L[e]).add(r,x[e]).add(i,N[e]);return`${o.buildNorstatPath()}?${o.buildNorstatQuery("alias").toString()}`})(n);((t,n,...i)=>{e(void 0,[t,n,...i],void 0,function*(e,t,n=!0){if(document.getElementById(t))return;const i=document.createElement("img");i.src=e,i.id=null!=t?t:"",n&&(i.style.display="none"),document.body.appendChild(i)})})(`https://sch-map.norstatsurveys.com/api/nids/${n===P.NO?"schibsted":"schibstedse"}/map/${r}`,"norstat")}),xi=(e,t)=>t?Object.assign(Object.assign({},e),{"aa-sch-ssa-native-ad":"true","aa-sch-ssa-format":"NATIVE_CONTENT","aa-sch-ssa-market":"XNO","aa-sch-ssa-cat":["ssa_1","ssa_2","ssa_3","ssa_4","ssa_5","ssa_6","ssa_7","ssa_8","ssa_9","ssa_10","ssa_11","ssa_12","ssa_13","ssa_14","ssa_15","ssa_16","ssa_17","ssa_18","ssa_19","ssa_20","ssa_21","ssa_22","ssa_23","ssa_24","ssa_25","ssa_26","ssa_27","ssa_28","ssa_29","ssa_30"]}):e,Ni=e=>`externalImpId:'${e}'`,ji=e=>{var n;const{forwardExternalImpId:i=!1,tracker:r}=g.get(),{id:o,sizes:s,keywords:a,allowedFormats:d,invCode:l,ssa:c=!1,nativeCustomProperties:u,safeframeConfig:v,resizeAdParentDiv:p=!1,dynamicSizeWidthCheck:h=!1}=(e=>{var t;if(!e.positionConfig)return e;const n=e.keywords[`${ee()}-count`],i=e.positionConfig.find(e=>e.adPositionIndex===n);if(!i)return e;const r=i.keywords?Object.assign(Object.assign({},e.keywords),i.keywords):e.keywords;return Object.assign(Object.assign({},e),{sizes:null!==(t=null==i?void 0:i.sizes)&&void 0!==t?t:e.sizes,keywords:r})})(e),m=Object.assign({invCode:l,sizes:s,targetId:o,keywords:xi(a,c),allowedFormats:d,resizeAdParentDiv:p,dynamicSizeWidthCheck:h},v&&{safeframeConfig:v}),y=(e=>{var n,i,r,o,s,a,d;return e?(null===(n=null==e?void 0:e.instance)||void 0===n?void 0:n.state)?(null===(r=null===(i=null==e?void 0:e.instance)||void 0===i?void 0:i.state)||void 0===r?void 0:r.pageViewId)?(t("Tracker state pageViewId is:",null===(s=null===(o=null==e?void 0:e.instance)||void 0===o?void 0:o.state)||void 0===s?void 0:s.pageViewId),null===(d=null===(a=null==e?void 0:e.instance)||void 0===a?void 0:a.state)||void 0===d?void 0:d.pageViewId):(t("Tracker state does not contain field pageViewId or it is empty"),""):(t("Tracker state is empty"),""):(t("Tracker is not configured in initAdvertory function"),"")})(r);i&&y&&(t("External Impression ID assigned to defineTag:",Ni(y)),m.externalImpId=Ni(y));const f=(e=>Object.entries({video:{required:!1},address:{required:!1},saleprice:{required:!1},rating:{required:!1},price:{required:!1},phone:{required:!1},likes:{required:!1},downloads:{required:!1},customIcon2:{required:!1}}).reduce((t,[n,i])=>((null==e?void 0:e.includes(n))&&(t[n]=i),t),{customTitle1:{required:!1},customTitle2:{required:!1},customTitle3:{required:!1},customTitle4:{required:!1},title:{required:!1},body:{required:!1},image:{required:!1},icon:{required:!1},sponsoredBy:{required:!1},cta:{required:!1},clickUrl:{required:!1},desc2:{required:!1},displayUrl:{required:!1},description:{required:!1}}))(u);return(null===(n=e.allowedFormats)||void 0===n?void 0:n.includes("native"))&&(m.native=f),m},_i="native-ad",Di=e=>{if(!e)return e;const t=e[`${Z()}-targetid`],n=t?ze(t[0]):"";return Object.assign(Object.assign({},e),t&&{[`${Z()}-targetid`]:[n]})},qi=e=>Object.assign(Object.assign(Object.assign(Object.assign({},e),e[`${Z()}-geo`]&&{[`${Z()}-geo`]:["geo-test-value"]}),e[`${Z()}-geofence`]&&{[`${Z()}-geofence`]:["geofence-test-value"]}),e[`${Z()}-weather`]&&{[`${Z()}-weather`]:["weather-test-value"]}),Mi=e=>{(e=>{const t=new URLSearchParams(window.location.search);if("true"!==t.get("scrollToFirstInvCode"))return;const n=t.get("ast_override_inv_code");if(!n)return;const i=n.split(",")[0].split(":")[0],r=e.find(e=>e.invCode===i),o=document.querySelector(`[id^=${null==r?void 0:r.id}]`);o&&o.scrollIntoView({behavior:"smooth",block:"start"})})(e),(()=>{var e;const t=new URLSearchParams(window.location.search).get("scrollToDrEditionPlacement");if(!t)return;const n=null!==(e=document.querySelector(`[id*="${t}}"]`))&&void 0!==e?e:document.querySelector(`a[aria-label*="${t}"]`);n&&n.scrollIntoView({behavior:"smooth",block:"start"})})()},Ri=()=>e(void 0,void 0,void 0,function*(){try{(()=>{const e=document.createElement("script");e.setAttribute("src","https://ads.inventory.schibsted.io/ad-service/ad-banner-sponsor-advertisement/ad.js"),e.setAttribute("type","text/javascript"),e.setAttribute("async","true"),document.head.appendChild(e)})(),(()=>{const e=document.createElement("div");e.setAttribute("id","ads-advertory-anchor"),e.classList.add("subscribe_box"),e.classList.add("ad-box"),e.classList.add("leftAd"),e.classList.add("netboard"),e.classList.add("advert"),e.classList.add("module"),e.classList.add("banner"),e.classList.add("leaderboard"),e.classList.add("adsbygoogle"),e.classList.add("ad-banner"),e.classList.add("ad-container"),e.classList.add("adsbox"),e.classList.add("sidebar-ads"),e.classList.add("banner-ads"),e.style.opacity="0",e.style.width="1px",e.style.height="1px",e.style.minWidth="0px",e.style.minHeight="0px",e.style.maxWidth="1px",e.style.maxHeight="1px",e.style.position="absolute",e.style.top="0",e.style.boxSizing="border-box",e.style.margin="0",e.style.padding="0",document.body.appendChild(e)})()}catch(e){console.error("Error running adblock scripts:",e)}}),Bi={arrayMerge:(e,t)=>t},Fi=n=>e(void 0,void 0,void 0,function*(){if(!(e=>{const{editableConfiguration:{useS3Config:t=!1,pageTypeToFetch:n}={},siteSpecificConfig:i}=e;return Boolean(t&&n&&(null==i?void 0:i.publisherClassName))})(n))return n;try{const i=yield(n=>e(void 0,void 0,void 0,function*(){const e=(e=>{const{siteSpecificConfig:t,editableConfiguration:{pageTypeToFetch:n}={}}=e;return(null==t?void 0:t.publisherClassName)&&n?`https://alertory-cdn.staging.inventory.schibsted.io/editable-configurations/${t.publisherClassName}/${n.toUpperCase()}.json`:null})(n);if(!e)return null;const i=new AbortController,r=setTimeout(()=>i.abort(),5e3);try{return yield W.get(e,{method:"GET",signal:i.signal})}catch(n){throw t("Failed to fetch S3 config",{error:n,url:e}),n}finally{clearTimeout(r)}}))(n);return i?(({siteConfig:e,configOverrides:t})=>{var n;const{keywords:i,refresh:r,placements:o,threshold:s,batchSize:a}=t,d=l.all([e.placements,o],Bi),c=l(e.pageOptions,{keywords:i},Bi),u=l(e.appearanceConfig,{defaultThreshold:s},Bi),v=l(null!==(n=e.refreshConfig)&&void 0!==n?n:{},{scrollRefreshEnabled:r},Bi);return Object.assign(Object.assign({},e),{placements:d,requestSize:null!=a?a:e.requestSize,pageOptions:c,appearanceConfig:u,refreshConfig:v})})({siteConfig:n,configOverrides:i}):n}catch(e){return t("Error fetching S3 config, using site config",{error:e}),n}});let Hi,Ui=[];const Vi=["takeover","wallpaper"],Wi=e=>{const t=(e=>{const t=tt.getData("alertoryConfigKeywords"),{queryConfig:n,placements:i,tcf:r,glimr:o,appearanceConfig:s,requestSize:a=v,publisher:d,country:l,pageType:c,deviceType:u,isMobileApp:p=!1,pageOptions:{member:g},takeover:h,fullscreenScroll:m}=e;return{xandr:{member:g,keywords:t,tags:[]},advertory:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({publisher:d,country:l,pageType:c,deviceType:u,placements:i,tcf:r,requestSize:a,isMobileApp:p},o&&{glimr:o}),n&&{queryConfig:n}),s&&{appearanceConfig:s}),h&&{takeover:h}),m&&{fullscreenScroll:m})}})(e);window.advertory={initialized:!0,siteConfig:e,alertoryConfig:t}},zi=()=>e(void 0,void 0,void 0,function*(){const{pageOptions:e}=g.get(),{preparePageOptions:t}=g.getHandlers(),n=(()=>{const{sandboxAdIframeEnabled:e=!0}=g.get();return{sandboxAdIframe:e,sandboxAttributes:["allow-same-origin","allow-scripts","allow-top-navigation-by-user-activation","allow-popups","allow-popups-to-escape-sandbox","allow-forms"]}})(),i=yield t(Object.assign(Object.assign({disablePsa:!0,enableSafeFrame:!0},e),{renderingManagement:Object.assign({},n)}));(e=>{const t=tt.getData("alertoryConfigKeywords");if(Object.keys(t).length)return;const n=qi(e);tt.setData("alertoryConfigKeywords",n)})(i.keywords),Ue(()=>Hi.setPageOpts(i))}),Ki=e=>{const{prebid:n}=g.get();Gi(e),(null==n?void 0:n.enabled)?(t("core loadPlacements prebid enabled"),Gt()):(t("core load tags invoked without prebid enabled"),Ji(e))},Gi=e=>{const{prepareTag:n}=g.getHandlers(),i=[];(e=>{const t=["skyscraperright_1","topboard","wallpaper","skyscraperleft_1"];return e.sort((e,n)=>{const i=t.findIndex(t=>e.id.includes(t)),r=t.findIndex(e=>n.id.includes(e));return-1!==i&&-1===r?-1:-1===i&&-1!==r?1:i-r})})(e).forEach(e=>{t("core defineTags",{placement:e});const r=ji(e);if(!e.id.includes("takeover")||mt()){const o=n(r),s=(e=>{const{allowedFormats:t,invCode:n,keywords:i,sizes:r}=e;return{adTypes:t,invCode:n,keywords:Di(i),sizes:r}})(o);i.push(s),Ue(()=>(t("core defineTag - add to the queue",{placement:e,preparedTag:o}),Hi.defineTag(o)))}}),(e=>{var t,n,i;(null===(i=null===(n=null===(t=window.advertory)||void 0===t?void 0:t.alertoryConfig)||void 0===n?void 0:n.xandr)||void 0===i?void 0:i.tags)&&e.length&&window.advertory.alertoryConfig.xandr.tags.push(e)})(i)},Ji=e=>{const n=e.map(({id:e})=>e);Ue(()=>(t("core loadTags",{placementsIdsToLoad:n}),Hi.loadTags([...n])))},Yi=(n,i)=>e(void 0,void 0,void 0,function*(){const{appearanceConfig:e,deviceType:r}=g.get(),{threshold:o,refresh:s,priority:a="normal"}=n,d=(e=>{const t=document.querySelector(`[data-show-tag-subscribe-id=${e.targetId}]`),n=document.querySelector(`#${e.targetId}`);return t||n})(i),l=null==e?void 0:e.defaultThreshold[r];d&&(t("core showAd - subscribe for show tag with thresholds",{placement:n,adObj:i,threshold:o,deviceDefaultThreshold:l}),yield Qn(d,null!=o?o:l)),d&&s&&(t("core showAd - setup refreshing",{placement:n,adObj:i}),d.dataset.refresh=s.toString(),d.dataset.priority=a)}),Qi=e=>e.some(({id:e})=>Vi.some(t=>e.includes(t))),Xi=t=>e(void 0,void 0,void 0,function*(){var e;if(!(null===(e=null===window||void 0===window?void 0:window.advertory)||void 0===e?void 0:e.initialized))return;const n=6,{requestSize:i=n}=g.get(),r=ct(t);for(const e of Object.keys(r)){const t=r[e];Qi(t)?Ki(t):t.length&&Zi(t,i)}}),Zi=(e,n)=>{const i=ai(e,n);for(const e of i)t("core loadAds with lazy loading",{placementsToLoad:e}),er(e)},er=e=>{const{queryConfig:{lazyLoadingV3:{enabled:n=!1,rootMargin:i="200% 0px"}={}}={}}=g.get(),r=[];if(!n)return t("lazy load is not enabled",{placements:e}),void Ki(e);const o=new IntersectionObserver((n,i)=>{n.filter(({isIntersecting:e,target:{id:t}})=>e&&!t.includes("wallpaper")).forEach(n=>{t("lazy load is enabled - handler start",{loadedPlacementIds:r,placements:e});const o=e.every(e=>r.includes(e.id)),s=e.map(e=>e.id);!o&&r.push(...s),!o&&Ki(e),t("lazy load is enabled - handler stop",{loadedPlacementIds:r,placements:e,arePlacementsLoaded:o,placementIds:s}),i.disconnect()})},{rootMargin:i});e.forEach(e=>{const n=document.getElementById(e.id);n&&(t("lazy loading - observe element",{placementId:e.id,element:n}),o.observe(n))})},tr=()=>e(void 0,void 0,void 0,function*(){const{siteEvents:n,initNativeAd:i,wallpaperHandlers:{initWallpaperAd:r,adjustAdToHorseshoe:o}}=g.getHandlers(),{wallpaper:s,fullscreenScroll:a}=g.get(),d=[];Ue(()=>{Hi.onEvent("adRequested",()=>{n.adRequested()}),Hi.onEvent("adAvailable",o=>e(void 0,void 0,void 0,function*(){var e,d,l,c,u,v;t("core adAvailable start",{placementsAvailable:Ui,adObj:o,isFullscreenScrollAd:Se(o),isFinnBlink:xe(o.targetId),isNativeAd:Ae(o),isMediation:Rt(o),isTakeoverAd:ke(o),isCollapseAd:$e(o),isWallpaperAd:Oe(o)});const p=null===(l=null===(d=null===(e=null===window||void 0===window?void 0:window.apntag)||void 0===e?void 0:e.requests)||void 0===d?void 0:d.tags[o.targetId])||void 0===l?void 0:l.adResponse.ads;Rt(o)&&p&&(null===(c=p[1])||void 0===c?void 0:c.rtb)&&(o.banner=null===(v=null===(u=p[1])||void 0===u?void 0:u.rtb)||void 0===v?void 0:v.banner),Se(o)&&mn(o),Se(o)&&!xe(o.targetId)&&hn(o,a),!Ae(o)||Rt(o)||xe(o.targetId)||i(o,g.get()),ke(o)&&!$e(o)&&(Pi(o.targetId),Oi(o)),Oe(o)&&(r(()=>Ue(()=>window.apntag.showTag(o.targetId)),s),tt.setData("wallpaper",{isAvailable:!0})),(e=>e.targetId.includes("skyscraperleft")&&!!e.banner)(o)&&tt.setData("horseshoe",{isAvailable:!0}),Ct({adObj:o}),n.adAvailable(o);const h=Ui.find(({id:e})=>e===o.targetId);h&&(yield Yi(h,o),Ui=Ui.filter(e=>e.id!==h.id)),t("core adAvailable stop",{placementsAvailable:Ui,adObj:o,isFullscreenScrollAd:Se(o),isFinnBlink:xe(o.targetId),isNativeAd:Ae(o),isMediation:Rt(o),isTakeoverAd:ke(o),isCollapseAd:$e(o),isWallpaperAd:Oe(o)})})),Hi.onEvent("adLoaded",e=>{const{refreshConfig:t,appearanceConfig:r}=g.get(),s=document.getElementById(e.targetId);xe(e.targetId)&&(e=>{const{fullscreenScroll:t}=g.get(),{initNativeAd:n}=g.getHandlers();Se(e)&&hn(e,t),Ae(e)&&n(e,g.get())})(e);d.includes(e.targetId)&&Ae(e)&&(i(e,g.get()),Ct({adObj:e})),!d.includes(e.targetId)&&Rt(e)&&d.push(e.targetId),$e(e)&&Xe(e.targetId),ke(e)&&((e,t)=>{var n;const i="100%",r="100%";e.resizeAd(t,[i,r]);const o=null===(n=document.querySelector(`#div_utif_${t}`))||void 0===n?void 0:n.querySelector("iframe");if(!o)return;new MutationObserver(e=>{for(const t of e)if("attributes"===t.type&&"style"===t.attributeName){const e=window.getComputedStyle(o),t=e.width,n=e.height;t===i&&n===r||(o.style.width=i,o.style.height=r)}}).observe(o,{attributes:!0,attributeFilter:["style"]})})(Hi,e.targetId),Ce(e)&&(e=>{const t=document.querySelector(`#${e.targetId}`),{siteSpecificConfig:{publisherClassName:n,fullWidthFormatClassName:i}={}}=g.get();if(!t||!n||!i)return;const r=t.parentElement;r&&(t.classList.add(`advertory-${n}-${i}__full-width-ad`),r.classList.add(`advertory-${n}-${i}-wrapper__full-width-ad`))})(e),(e=>Re(e,ye))(e)&&(e=>{const t=document.querySelector(`#${e.targetId}`),n=null==t?void 0:t.querySelector("iframe"),i=null==n?void 0:n.parentElement,{siteSpecificConfig:{publisherClassName:r,fullWidthFormatClassName:o}={}}=g.get();if(!t||!n||!i)return;const s=window.innerWidth,a=Math.round(s/1080*1920);t.style.width="100%",t.style.height=`${a}px`,t.classList.add(`advertory-${r}-${o}__vertical-full-width-ad`);const d=Pt(e,t.offsetWidth);i.style.transform=`scale(${d})`,i.style.transformOrigin="left top"})(e),li(e,t),(null==r?void 0:r.clearProbableDimensionsEnabled)&&(e=>{const t=document.querySelector(`#${e}`);t&&(t.style.minWidth="",t.style.minHeight="")})(e.targetId);var a,l;tt.getData("horseshoe").isAvailable&&o(e.targetId),n.adLoaded(e),a=e.targetId,!document.querySelector(`#gdprAdTransparencyCogWheelButton-${a}`)&&(null===(l=window.gdpr)||void 0===l?void 0:l.setupButton)&&window.gdpr.setupButton(a),s&&s.classList.add("ad-loaded"),$t(e),window.dispatchEvent(new CustomEvent("advertory:adLoaded",{detail:{targetId:e.targetId,adFormat:kt(e)}}))}),Hi.onEvent("adNoBid",t=>e(void 0,void 0,void 0,function*(){Xe(t.targetId),yield Rn(g.get(),t),Et(t)&&bt(),n.adNoBid(t)})),Hi.onEvent("adError",(e,t)=>{Et(t)&&bt(),n.adError(e,t)}),Hi.onEvent("adCollapse",()=>{n.adCollapse()}),Hi.onEvent("adRequestFailure",e=>{Xe(e.targetId),n.adRequestFailure(e)}),Hi.onEvent("adBadRequest",e=>{Xe(e.targetId),n.adBadRequest(e)}),Hi.onEvent("adLoadedMediated",e=>n.adLoadedMediated(e)),Hi.onEvent("adNoBidMediated",e=>n.adNoBidMediated(e))})}),nr=(t,n)=>e(void 0,void 0,void 0,function*(){var e;if(!(null===(e=null===window||void 0===window?void 0:window.advertory)||void 0===e?void 0:e.initialized))return[];const{clearAds:i,reloadExistingAds:r,renderFinnBlinkPlacements:o,contextSelector:s}=null!=n?n:{};if(i)return rt(),[];r&&(rt(),document.querySelectorAll('[data-advertory-ad-rendered="true"]').forEach(e=>{Ze(e.id)})),h(null!=t?t:{}),yield zi();let a=dt(s);return o&&(a=a.filter(e=>xe(e.id))),a.length>0&&(Ui=[...Ui,...a.map(e=>Object.assign({},e))],ci(a),ui(a),yield Xi(a)),Ui}),ir=(n,i)=>e(void 0,void 0,void 0,function*(){var r;g.set(n),g.setHandlers(i),tt.initialize(),window.addEventListener("message",Gn,!1),Hi=window.apntag||{anq:[],defineTag:e=>({targetId:""}),showTag:e=>{},onEvent:(e,t,n)=>{},offEvent:(e,t)=>{},refresh:e=>{},modifyTag:(e,t)=>{},loadTags:e=>{},emitEvent:(e,t)=>{},setPageOpts:e=>{},resizeAd:(e,t,n)=>{},getAstVersion:()=>"",setEndpoint:(e,t)=>{},fireImpressionTrackers:e=>{},setKeywords:()=>{},clearRequest:()=>{}},window.apntag=Hi,yield K(),yield Promise.allSettled([e(void 0,void 0,void 0,function*(){const{prebid:e}=g.get();(null==e?void 0:e.enabled)&&(yield Kt(null==e?void 0:e.url))}),(r={country:n.country,tracker:n.tracker},e(void 0,[r],void 0,function*({country:e,tracker:n,timeout:i=1e3}){n&&(yield Promise.allSettled([de.processPPIDs(n,i),le.processPPIDs(n,e)])).forEach((e,n)=>{"rejected"===e.status&&t(`Cannot fetch PPIDs v${n+2}`,e.reason)})})),e(void 0,void 0,void 0,function*(){const{astUrl:e}=g.get();yield Kt(null!=e?e:"https://adsdk.microsoft.com/ast/ast.js")}),e(void 0,void 0,void 0,function*(){const{gptUrl:e}=g.get();yield Kt(null!=e?e:"https://securepubads.g.doubleclick.net/tag/js/gpt.js")}),e(void 0,void 0,void 0,function*(){const{brandmetrics:{enabled:e,url:t}={},tcf:n}=g.get(),{getConsentSync:i}=o(n),r=i();if(e&&t&&r){if(yield Kt(t),document.querySelector(`.${$i}`))return window._brandmetrics=window._brandmetrics||[],void window._brandmetrics.push({cmd:"_loadsurvey"});new MutationObserver((e,t)=>{for(const n of e){if("childList"!==n.type)return;Array.from(n.addedNodes).some(e=>{var t;return null===(t=e.outerHTML)||void 0===t?void 0:t.includes($i)})&&(t.disconnect(),window._brandmetrics=window._brandmetrics||[],window._brandmetrics.push({cmd:"_loadsurvey"}))}}).observe(document,{childList:!0,subtree:!0,attributes:!0})}}),X(),e(void 0,void 0,void 0,function*(){const{gdpr:{url:e,allowHidingAds:t=!0}={}}=g.get();t&&(window.gdpr=window.gdpr||{},window.gdpr.allowHidingAds=!0),yield Kt(null!=e?e:"https://cogwheel.inventory.schibsted.io/prod/latest/gdpr-bundle.js")})]),yield Li(),yield tr(),yield zi(),Wi(n),Ui=dt(),ci(Ui),ui(Ui),yield Xi(Ui),Mi(Ui),yield i.replaceAdsWithFinnBlink(n.finnBlink),yield(t=>e(void 0,void 0,void 0,function*(){var e;if(!t.drEdition)return;const n=yield R(),i=new B(n);qn({publisher:t.publisher,drEditionConfig:t.drEdition,device:t.deviceType,pageType:t.pageType,country:t.country},i,null===(e=t.pulse)||void 0===e?void 0:e.instance)}))(n)}),rr=(t,n)=>e(void 0,void 0,void 0,function*(){const{initConsentManager:i}=o(t.tcf),r=yield Fi(t);var s;yield Ri(),yield(s=i,e(void 0,void 0,void 0,function*(){return yield new Promise(e=>{s().then(t=>{e(null!=t?t:null)}).catch(t=>{e(null)})})})),yield ir(r,n)}),or=()=>{if(!window.location.search.includes("kv_"))return{};const e={},t=(()=>{const e=new URLSearchParams(window.location.search);return Object.fromEntries(e)})();return Object.keys(t).forEach(n=>{n.startsWith("kv_")&&(e[n.slice(3)]=t[n])}),e},sr="native_override_desc2",ar=(e,t,n)=>{var i;const{image:r,icon:o,sponsoredBy:s,title:a,clickUrl:d,cta:l,body:c,desc2:u,video:v,description:p,customTitle1:g,customTitle2:h,customTitle3:m,customTitle4:y,customIcon2:f}=e,w=(e,t="")=>{var n;return e?null!==(n=e.url)&&void 0!==n?n:e:t};return Object.assign({containerId:n,img:w(r),imgWidth:null==r?void 0:r.width,imgHeight:null==r?void 0:r.height,imgAltText:null!=a?a:"",logo:w(o),sponsoredBy:null!=s?s:"",title:null!=a?a:"",url:null!=d?d:"",cta:null!=l?l:"",description:null!==(i=null!=c?c:p)&&void 0!==i?i:"",desc2:null!=u?u:"",video:v,customTitle1:null!=g?g:"",customTitle2:null!=h?h:"",customTitle3:null!=m?m:"",customTitle4:null!=y?y:"",logo2:w(f)},t)},dr=(e,t)=>{const n=(i=sr,window.location.href.includes(i));var i;const r=new URLSearchParams(window.location.search).get(sr),o=t.includes("native_recirc");return n&&r?r:(null==e?void 0:e.includes("recirc"))?o?"native_recirc":"recirc":(null==e?void 0:e.includes("sponsor"))?"sponsorstripe":null},lr=(e,t,n,i)=>{const r=document.querySelector(`#${e}`);r&&t&&(r.innerHTML=t,((e,t)=>{const n=e.parentElement,{publisher:i,pageType:r}=t,o=i&&Object.values(Mt).includes(i);n&&o&&((e,t,n,i)=>{const r=t.parentElement;if(!r)return;const o=e?`-${e}`:"",s=i?`__${i}`:"",a=`advertory${o}-${n}${s}`,d=`advertory${o}-${n}-wrapper${s}`;t.classList.remove(...t.classList),r.classList.remove(...r.classList),t.classList.add(a),r.classList.add(d),t.dataset.adType=n})(i,e,_i,r)})(r,n),i())},cr=e=>{var t;const n=document.querySelector(`#${e.targetId}`);if(!n||!(null===(t=e.native)||void 0===t?void 0:t.clickTrackers))return;(null==n?void 0:n.querySelectorAll("a.ad-link")).forEach(t=>{"true"!==t.dataset.tracked&&(t.addEventListener("click",()=>{var t,n;for(const i of null!==(n=null===(t=e.native)||void 0===t?void 0:t.clickTrackers)&&void 0!==n?n:[])gr(i)}),t.dataset.tracked="true")})},ur=e=>{const{native:{impressionTrackers:t}={}}=e;(null==t?void 0:t.some(e=>e.includes("googleads")))?null==t||t.forEach(pr):window.apntag.fireImpressionTrackers(e)},vr=(e,t)=>{var n;let i=!1;const r=document.querySelector(`#${e.targetId}`);if(!r||!e.native)return;const{deviceType:o,appearanceConfig:s,nativeTrackingConfig:{fireImpressionsBasedOnAppearanceThreshold:a=!1}={}}=t,d=a?{rootMargin:`${l=null!==(n=null==s?void 0:s.defaultThreshold[null!=o?o:y.DESKTOP])&&void 0!==n?n:0}px 0px ${l}px 0px`}:{};var l;const c=new IntersectionObserver(t=>{if(!i)for(const n of t)if(n.isIntersecting){i=!0,ur(e),c.disconnect();break}},d);c.observe(r)},pr=e=>{const t=e.includes("googleads");"function"!=typeof window.navigator.sendBeacon||t?gr(e):window.navigator.sendBeacon(e)},gr=e=>{fetch(e,{method:"GET",mode:"no-cors"}).catch(t=>console.warn(`Tracker ${e} failed. Error: ${t||"Unknown"}`))},hr=(e,t,n)=>{const i=((e,t,n)=>{var i;const{displayTemplates:r,videoTemplates:o}=n,s="default";if(!e.native)return null;const{native:a,targetId:d}=e,{desc2:l=s}=e.native,c=l.toLowerCase(),u=null!==(i=dr(e.targetId,l))&&void 0!==i?i:c,v=cn[t.language||P.NO],p=ar(a,v,d);return(a.video?o[u]:r[u]||r.default)(p,t)})(e,t,n);lr(e.targetId,i,t,()=>{const{nativeTrackingConfig:{nativeTrackingEnabled:n=!0}={}}=t;n&&((e,t)=>{cr(e),vr(e,t)})(e,t)})},mr=({containerId:e,url:t,adText:n,sponsoredBy:i,title:r,img:o,description:s,desc2:a},d)=>{const l=Me({native:{desc2:a}}),c=l?"advertory-aftonbladet-ad-native-classic-alcohol":"",u=l?'<div class="alcohol-warning-wrapper">\n <div class="alcohol-warning">Alkohol&nbsp;kan skada&nbsp;din&nbsp;hälsa</div>\n </div>':"",{deviceType:v}=d;return`<article class="advertory-aftonbladet-ad-native-classic ${c}">\n <div class="ad-info" id="${e}-button"></div>\n <a class="ad-link" href="${t}"${E(v)?"":' target="_blank" rel="noopener"'}>\n <div class="ad-content">\n <div class="ad-header">\n <span class="ad-annonse">${n}</span>\n </div>\n <div class="ad-image-container">\n <img alt="${r}" class="ad-image" src="${o}" />\n </div>\n <div class="ad-data-content">\n <div class="ad-title">${r}</div>\n <div class="ad-subtitle">\n <span class="ad-sponsored">${i}</span> ${s}\n </div>\n </div>\n ${u}\n </div>\n </a>\n </article>`},yr=e=>null!==e&&"object"==typeof e&&!Array.isArray(e),fr="viewable",wr="adClick";const br=(e,t)=>{const n=(new DOMParser).parseFromString(e,"text/xml"),i=n.querySelector("ClickThrough"),r=n.querySelector("VideoClicks");if(i){for(;i.firstChild;)i.removeChild(i.firstChild);i.appendChild(n.createCDATASection(t))}else if(r){const e=n.createElement("ClickThrough");e.appendChild(n.createCDATASection(t)),r.appendChild(e)}return URL.createObjectURL(new Blob([(new XMLSerializer).serializeToString(n)],{type:"text/xml"}))},Er=(e,t,n,i,r="",o="xandr")=>({id:e,poster:n,vendor:"appnexus",node:t,mute:!0,skin:{name:"inventory-player",url:"https://ads.inventory.schibsted.io/styles/player.css"},settings:{jw:{stretching:"fill",advertising:{client:"vast",tag:i}}},pulse:{provider:r.toLowerCase(),decorator:e=>Object.assign(Object.assign({},yr(e)?e:{}),{provider:Object.assign(Object.assign({},yr(null==e?void 0:e.provider)?e.provider:{}),{productTag:o})})}}),Ir=t=>e(void 0,void 0,void 0,function*(){const{playerConfig:e,pluginsNames:n,clickUrl:i}=t,r=yield On(e);Ln(n),r.once("assetReady",()=>{Pn(r,n)}),r.on(fr,e=>{const{viewable:t}=e;t?r.play():r.pause()}),r.on(wr,()=>{window.open(i,"_blank")})}),Tr=({containerId:e,url:t,adText:n,description:i,title:r,sponsoredBy:o},s,a)=>{const{deviceType:d}=s;return`<article class="advertory-aftonbladet-ad-native-classic">\n <div class="ad-info" id="${e}-button"></div>\n <div class="ad-content">\n <div class="ad-header">\n <span class="ad-annonse">${n}</span>\n </div>\n <div class="ad-image-container">\n <div class="ad-player-wrapper">\n <div id="${null!=a?a:0}"></div>\n </div>\n </div>\n <a class="ad-link" href="${t}"${E(d)?"":' target="_blank" rel="noopener"'}>\n <div class="ad-data-content">\n <div class="ad-title">${r}</div>\n <div class="ad-subtitle">\n <span class="ad-sponsored">${o}</span> ${i}\n </div>\n </div>\n </a>\n </div>\n </div>\n </article>`},Sr={CONTENT_DISPLAY:(e,{pageType:t})=>t===kn.ARTICLE&&"gambling"===e.desc2?(({containerId:e,url:t,adContentFrom:n,adText:i,sponsoredBy:r,title:o,img:s,description:a,desc2:d})=>`<article class="advertory-aftonbladet-ad-native-content article">\n <div class="ad-info" id="${e}-button"></div>\n <a class="ad-link" href="${t}" target="_blank">\n <div class="ad-content">\n <div class="ad-data-content">\n <div class="ad-annonse">${i}</div>\n <div class="ad-title">${o}</div>\n ${a&&`<div class="ad-subtitle">${a}</div>`}\n <div class="ad-sponsored">${n} ${r}</div> \n </div>\n <div class="ad-image-container">\n <img alt="${o}" class="ad-image" src="${s}" />\n </div>\n </div>\n ${"gambling"===d?'<div class="ad-gambling">\n <div class="ad-gambling-text">Åldersgräns för spel är 18 år.</div>\n <div class="ad-gambling-link">www.stodlinjen.se</div>\n </div>':""}\n </a>\n </article>`)(e):(({containerId:e,url:t,adContentFrom:n,adText:i,sponsoredBy:r,title:o,img:s,description:a,desc2:d})=>`<article class="advertory-aftonbladet-ad-native-content">\n <div class="ad-info" id="${e}-button"></div>\n <a class="ad-link" href="${t}" target="_blank">\n <div class="ad-header">\n <span class="ad-annonse">${i}</span>\n </div>\n <div class="ad-content">\n <div class="ad-data-content">\n <div class="ad-title">${o}</div>\n ${a&&`<div class="ad-subtitle">${a}</div>`}\n <div class="ad-sponsored">${n} ${r}</div> \n </div>\n <div class="ad-image-container">\n <img alt="${o}" class="ad-image" src="${s}" />\n </div>\n </div>\n ${"gambling"===d?'<div class="ad-gambling">\n <div class="ad-gambling-text">Åldersgräns för spel är 18 år.</div>\n <div class="ad-gambling-link">www.stodlinjen.se</div>\n </div>':""}\n </a>\n </article>`)(e),CLASSIC:mr,CLASSIC_VIDEO:(e,t)=>{const{video:n}=e;return(null==n?void 0:n.content)?(i=Tr,(e,t,n)=>{const{video:r,img:o,url:s}=e,{publisher:a,productTag:d}=t;if(!(null==r?void 0:r.content))return null;const l=Math.ceil(1e5*Math.random()),c=o||"https://custom.inventory.schibsted.io/1x1-00000000.png",u=`ad-player-${l}`,v=br(r.content,s),p=Er(l,u,c,v,a,d);return Ir({playerConfig:p,clickUrl:s,pluginsNames:n}),`${i(e,t,u)}`})(e,t):mr(e,t);var i},CHAT_INTEGRATION:({containerId:e,url:t,sponsoredBy:n,title:i,logo:r,img:o,description:s,customTitle2:a})=>{const d=a?((e,t)=>{const n=new RegExp(`(\\b[a-zäöå]+\\.${t}\\b)`,"g");return e.replace(n,e=>`<u>${e}</u>`)})(a,P.SE):void 0;return`<article class="advertory-aftonbladet-ad-native-chat-integration">\n <div class="ad-info" id="${e}-button"></div>\n <a class="ad-link" href="${t}" target="_blank">\n <div class="ad-content">\n <span class="ad-annonse">ANNONS FRÅN ${n}</span>\n <img alt="${n}" class="ad-logo" src="${r}" />\n <div class="ad-data-content">\n <span class="ad-subtitle">\n ${s}\n </span>\n <span class="ad-title">${i}</span>\n <div class="ad-button">Se alla nyheter</div>\n <div class="ad-image-container">\n <img alt="${i}" class="ad-image" src="${o}" />\n </div>\n </div>\n </div>\n </a>\n ${d?`<div class="ad-chat-warning">${d}</div>`:""} \n </article>`},SPONSORSTRIPE:({title:e,sponsoredBy:t,logo:n,url:i})=>`<article class="advertory-aftonbladet-ad-native-sponsorstripe">\n <a class="ad-link" href="${i}" target="_blank">\n <div class="ad-wrapper">\n <span class="ad-title">${e}</span>\n <img alt="${t}" class="ad-logo" src="${n}" />\n </div>\n </a>\n </article>`},Ar={displayTemplates:{brandstudio_native_ad:Sr.CLASSIC,brandstudio_native_ad_alcohol:Sr.CLASSIC,default:Sr.CONTENT_DISPLAY,gambling:Sr.CONTENT_DISPLAY,ab_chat:Sr.CHAT_INTEGRATION,sponsor:Sr.SPONSORSTRIPE,sponsortop:Sr.SPONSORSTRIPE,sponsorstripe:Sr.SPONSORSTRIPE},videoTemplates:{brandstudio_native_ad:Sr.CLASSIC_VIDEO}},Cr=e=>{const t=e.querySelector(".advertory-aftonbladet-ad-native-classic-alcohol");if(!t)return;const n=t.querySelector(".ad-content"),i=t.querySelector(".alcohol-warning");if(!i||!n)return;const r=(e=>{const t=e.getBoundingClientRect().height;return Math.floor(.25*t)})(n);i.style.height=`${r}px`},kr=(e,t,n)=>{e.style.position=t,e.style.transform=`translateY(${n}px)`},Pr=(e,t)=>{const n=document.querySelector(t),i=document.querySelector(`#${e}`);if(!i||!n)return;const r=i.parentElement,o=new IntersectionObserver(([e])=>((e,t,n)=>{const i=window.getComputedStyle(t).position,r=e?i:"fixed",o=e?t.offsetHeight:0;kr(n,r,o)})(e.isIntersecting,n,r)),s=new ResizeObserver(()=>((e,t)=>{const n=window.getComputedStyle(e).position;kr(t,n,e.offsetHeight)})(n,r));o.observe(n),s.observe(n)},Or=e=>document.querySelector(e)||document.querySelector(`[class*="${e}"]`),$r=(e,t)=>{if(!t||!Le(e))return;const{toogleEnabled:n,headerSelector:i,containersSelectors:r}=t,{targetId:o}=e;if(!n)return;const s=document.querySelector(".advertory-takeover-wrapper"),a=[()=>i&&Pr(o,i),()=>r&&((e,t)=>{const n=document.querySelector(`#${e}`);if(!n)return;const[i,r]=t;if(!i)return;const o=()=>{const e=Or(i),t=r?Or(r):null,o=n.querySelector("article");if(!o||!e)return;const s=e.getBoundingClientRect().left,a=((e,t)=>{const n=e.getBoundingClientRect(),i=null==t?void 0:t.getBoundingClientRect();return i?i.right-n.left:n.width})(e,t);o.style.left=`${s}px`,o.style.width=`${a}px`};o(),new ResizeObserver(o).observe(document.body)})(o,r),()=>s&&((e,t)=>{const n=document.querySelector(`#${e}`);if(!n||!t)return;new IntersectionObserver(([e])=>{n.style.visibility=e.isIntersecting?"hidden":"visible"}).observe(t)})(o,s)];a.forEach(e=>e())},Lr=((t,n)=>i=>{return r=Object.assign(Object.assign({},i),{siteSpecificConfig:n}),o=t,e(void 0,void 0,void 0,function*(){yield rr(r,o)});var r,o})({initNativeAd:(e,t)=>{const{targetId:n}=e,i=document.querySelector(`#${n}`);if(!i)return;const{pageType:r=kn.FRONT,deviceType:o,nativeTrackingConfig:s,appearanceConfig:a}=null!=t?t:{},d={language:P.SE,publisher:Mt.AFTONBLADET,deviceType:o,pageType:r,nativeTrackingConfig:s,appearanceConfig:a};hr(e,d,Ar),$r(e,null==t?void 0:t.sponsorstripe),Me(e)&&Cr(i)},wallpaperHandlers:{initWallpaperAd:He,adjustAdToHorseshoe:He},loadFinnBlinkAd:Fe,replaceAdsWithFinnBlink:Fe,preparePageOptions:ge,prepareTag:e=>{const{keywords:t,targetId:n,invCode:i,dynamicSizeWidthCheck:r}=e,o=(e=>{const{isMobileApp:t}=g.get();return t?(e=>e.replace(/wtb|wde|wph/g,e=>"wph"===e?"aph":"atb"))(e):e})(i),s=(e=>{const{keywords:t,dynamicSizeWidthCheck:n}=e,i=`${Z()}-adformat`,r=t?t[i]:[];if(!r)return{};const o=(Array.isArray(r)?r:[r]).filter(e=>!(e in Te)||window.innerWidth>=Te[e]);return{[i]:n?o:r}})(e),a=(e=>{const t=`${Z()}-targetid`;return e?{[t]:[e]}:{}})(n),d=(e=>{var t;const[,n]=null!==(t=e.match(/-((w|a)(?:ph|de|tb))-/))&&void 0!==t?t:[];switch(n){case"wde":return{"aa-sch-supply_type":"web_desktop"};case"wtb":return{"aa-sch-supply_type":"web_tablet"};case"wph":return{"aa-sch-supply_type":"web_phone"};case"aph":return{"aa-sch-supply_type":"app_phone"};default:return}})(o),l=or(),c={[`${Z()}-adreload`]:"0"},u=(e=>Ft(e)?{"aa-sch-dynamic-outstream":["true"]}:{})(i),v=Object.assign({},((e,t)=>Ft(e)?Object.assign(Object.assign({},t),{playerSkin:{videoBackgroundColor:"#e6e7e8"}}):{})(i,{safeFrameAutoInitialSize:!0})),p=r&&e.sizes.length>0?e.sizes.filter(([e])=>e<=window.innerWidth):e.sizes;return Object.assign(Object.assign({},e),{sizes:p,invCode:o,keywords:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},t),s),a),d),c),u),l),rendererOptions:v})},siteEvents:Ht},Ut);var xr=Object.freeze({__proto__:null,default:""});export{ve as getVideoPPIDs,Lr as initAdvertoryPackage,nr as updateAdvertory};