@schibsted/advertory 2.71.18 → 2.72.0

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 (126) hide show
  1. package/core/aftenposten/es/index.css +1 -1
  2. package/core/aftenposten/es/index.d.ts +3 -1
  3. package/core/aftenposten/es/index.js +1 -1
  4. package/core/aftenposten/index.d.ts +3 -1
  5. package/core/aftenposten/index.js +1 -1
  6. package/core/aftenpostenv2/es/index.css +1 -1
  7. package/core/aftenpostenv2/es/index.d.ts +3 -1
  8. package/core/aftenpostenv2/es/index.js +1 -1
  9. package/core/aftonbladet/es/index.css +1 -1
  10. package/core/aftonbladet/es/index.d.ts +3 -1
  11. package/core/aftonbladet/es/index.js +1 -1
  12. package/core/aftonbladet/index.d.ts +3 -1
  13. package/core/aftonbladet/index.js +1 -1
  14. package/core/aftonbladetv2/es/index.css +1 -1
  15. package/core/aftonbladetv2/es/index.d.ts +3 -1
  16. package/core/aftonbladetv2/es/index.js +1 -1
  17. package/core/bt/es/index.css +1 -1
  18. package/core/bt/es/index.d.ts +3 -1
  19. package/core/bt/es/index.js +1 -1
  20. package/core/bt/index.d.ts +3 -1
  21. package/core/bt/index.js +1 -1
  22. package/core/btv2/es/index.css +1 -1
  23. package/core/btv2/es/index.d.ts +3 -1
  24. package/core/btv2/es/index.js +1 -1
  25. package/core/e24/es/index.css +1 -1
  26. package/core/e24/es/index.d.ts +3 -1
  27. package/core/e24/es/index.js +1 -1
  28. package/core/e24/index.d.ts +3 -1
  29. package/core/e24/index.js +1 -1
  30. package/core/fotbollskanalen/es/index.css +1 -1
  31. package/core/fotbollskanalen/es/index.d.ts +3 -1
  32. package/core/fotbollskanalen/es/index.js +1 -1
  33. package/core/fotbollskanalen/index.d.ts +3 -1
  34. package/core/fotbollskanalen/index.js +1 -1
  35. package/core/godare/index.d.ts +3 -1
  36. package/core/godare/index.js +1 -1
  37. package/core/godt/index.d.ts +3 -1
  38. package/core/godt/index.js +1 -1
  39. package/core/klart/index.d.ts +3 -1
  40. package/core/klart/index.js +1 -1
  41. package/core/koket/es/index.css +1 -1
  42. package/core/koket/es/index.d.ts +3 -1
  43. package/core/koket/es/index.js +1 -1
  44. package/core/koket/index.d.ts +3 -1
  45. package/core/koket/index.js +1 -1
  46. package/core/kompakt/index.d.ts +3 -1
  47. package/core/kompakt/index.js +1 -1
  48. package/core/minmote/index.d.ts +3 -1
  49. package/core/minmote/index.js +1 -1
  50. package/core/pent/index.d.ts +3 -1
  51. package/core/pent/index.js +1 -1
  52. package/core/sa/es/index.css +1 -1
  53. package/core/sa/es/index.d.ts +3 -1
  54. package/core/sa/es/index.js +1 -1
  55. package/core/sa/index.d.ts +3 -1
  56. package/core/sa/index.js +1 -1
  57. package/core/sav2/es/index.css +1 -1
  58. package/core/sav2/es/index.d.ts +3 -1
  59. package/core/sav2/es/index.js +1 -1
  60. package/core/svd/es/index.css +1 -1
  61. package/core/svd/es/index.d.ts +3 -1
  62. package/core/svd/es/index.js +1 -1
  63. package/core/svd/index.d.ts +3 -1
  64. package/core/svd/index.js +1 -1
  65. package/core/svdv2/es/index.css +1 -1
  66. package/core/svdv2/es/index.d.ts +3 -1
  67. package/core/svdv2/es/index.js +1 -1
  68. package/core/tek/index.d.ts +3 -1
  69. package/core/tek/index.js +1 -1
  70. package/core/tv4/es/index.css +1 -1
  71. package/core/tv4/es/index.d.ts +3 -1
  72. package/core/tv4/es/index.js +1 -1
  73. package/core/tv4/index.d.ts +3 -1
  74. package/core/tv4/index.js +1 -1
  75. package/core/tvnu/index.d.ts +3 -1
  76. package/core/tvnu/index.js +1 -1
  77. package/core/vg/es/index.css +1 -1
  78. package/core/vg/es/index.d.ts +3 -1
  79. package/core/vg/es/index.js +1 -1
  80. package/core/vg/index.d.ts +3 -1
  81. package/core/vg/index.js +1 -1
  82. package/core/vgv2/es/index.css +1 -1
  83. package/core/vgv2/es/index.d.ts +3 -1
  84. package/core/vgv2/es/index.js +1 -1
  85. package/features/ad-native/index.d.ts +2 -0
  86. package/features/ad-native/index.js +1 -1
  87. package/features/dr-edition/es/index.d.ts +2 -0
  88. package/features/dr-edition/index.d.ts +2 -0
  89. package/features/kilkaya/es/index.d.ts +2 -0
  90. package/features/kilkaya/index.d.ts +2 -0
  91. package/features/tracker/index.d.ts +4 -1
  92. package/features/tracker/index.js +1 -1
  93. package/package.json +1 -1
  94. package/sites/aftenposten/es/index.css +1 -1
  95. package/sites/aftenpostenv2/es/index.css +1 -1
  96. package/sites/aftonbladet/es/index.css +1 -1
  97. package/sites/aftonbladetv2/es/index.css +1 -1
  98. package/sites/bt/es/index.css +1 -1
  99. package/sites/btv2/es/index.css +1 -1
  100. package/sites/e24/es/index.css +1 -1
  101. package/sites/koket/es/index.css +1 -1
  102. package/sites/sa/es/index.css +1 -1
  103. package/sites/sav2/es/index.css +1 -1
  104. package/sites/svd/es/index.css +1 -1
  105. package/sites/svdv2/es/index.css +1 -1
  106. package/sites/tv4/es/index.css +1 -1
  107. package/sites/vg/es/index.css +1 -1
  108. package/sites/vgv2/es/index.css +1 -1
  109. package/types/core/interface/ast.d.ts +1 -1
  110. package/types/core/interface/config.d.ts +2 -0
  111. package/types/features/ad-native/trackers/trackers.d.ts +1 -1
  112. package/types/features/ad-server-side/banner-object.d.ts +4 -0
  113. package/types/features/ad-server-side/banner-object.test.d.ts +1 -0
  114. package/types/features/ad-server-side/cogwheel.d.ts +3 -0
  115. package/types/features/ad-server-side/constants.d.ts +2 -0
  116. package/types/features/ad-server-side/index.d.ts +5 -0
  117. package/types/features/ad-server-side/keywords.d.ts +3 -0
  118. package/types/features/ad-server-side/keywords.test.d.ts +1 -0
  119. package/types/features/ad-server-side/native-request.d.ts +42 -0
  120. package/types/features/ad-server-side/native-request.test.d.ts +1 -0
  121. package/types/features/ad-server-side/server-side-xandr-renderer.d.ts +3 -0
  122. package/types/features/ad-server-side/server-side-xandr-service.d.ts +7 -0
  123. package/types/features/cogwheel/index.d.ts +1 -1
  124. package/types/features/interface/ad-native.d.ts +1 -0
  125. package/types/features/interface/ad-server-side.d.ts +48 -0
  126. package/types/features/tracker/index.d.ts +3 -2
@@ -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 t(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var n,i;"function"==typeof SuppressedError&&SuppressedError;var r=t(function(){if(i)return n;i=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 r(e,t){return!1!==t.clone&&t.isMergeableObject(e)?l((n=e,Array.isArray(n)?[]:{}),e,t):e;var n}function o(e,t,n){return e.concat(t).map(function(e){return r(e,n)})}function s(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 a(e,t){try{return t in e}catch(e){return!1}}function d(e,t,n){var i={};return n.isMergeableObject(e)&&s(e).forEach(function(t){i[t]=r(e[t],n)}),s(t).forEach(function(o){(function(e,t){return a(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))})(e,o)||(a(e,o)&&n.isMergeableObject(t[o])?i[o]=function(e,t){if(!t.customMerge)return l;var n=t.customMerge(e);return"function"==typeof n?n:l}(o,n)(e[o],t[o],n):i[o]=r(t[o],n))}),i}function l(t,n,i){(i=i||{}).arrayMerge=i.arrayMerge||o,i.isMergeableObject=i.isMergeableObject||e,i.cloneUnlessOtherwiseSpecified=r;var s=Array.isArray(n);return s===Array.isArray(t)?s?i.arrayMerge(t,n,i):d(t,n,i):r(n,i)}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)},{})},n=l}());const o=["deviceType","pageType","placements","takeover","refreshConfig","editableConfiguration"],s={adRequested:()=>{},adAvailable:e=>{},adLoaded:e=>{},adNoBid:e=>{},adError:(e,t)=>{},adCollapse:()=>{},adRequestFailure:e=>{},adBadRequest:e=>{},adLoadedMediated:e=>{},adNoBidMediated:e=>{}},a=6;class d{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 o){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)),Object.prototype.hasOwnProperty.call(e,"tcf")&&void 0!==e.tcf&&(this.config.tcf=Object.assign(Object.assign({},this.config.tcf),e.tcf))}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=r(d.DEFAULT_SITE_HANDLERS,e)}}d.DEFAULT_SITE_HANDLERS={siteEvents:s,initNativeAd:function(){}};const l=new d,c=l.modifyConfigProperties.bind(l),u={NO:"no",SE:"se"},v=(e,t)=>{const n="[Advertory LOG]: ";location.search.includes("ast_debug=true")&&(t?console.log(n,e,t):console.log(n,e))},p=e=>new URLSearchParams(window.location.search).get(e),g="takeover",h="native_override_desc2",m=e=>new Promise(t=>{if(!window._tcf_||!(null==e?void 0:e.enabled))return void t(!1);const n=(()=>{if(!window._tcf_)return null;const e=window._tcf_.getPermissionSync("CMP:advertising");if(null===e)return null;const t=Number(e);return v("Advertising permission value obtained synchronously: ",e),Boolean(t)})();if(null!==n)return void t(n);let i=!1;const r=e=>{i||(v("Resolving advertising permission value obtained"),i=!0,t(e))},o=setTimeout(()=>{v("Advertising permission timed out, resolving with false"),r(!1)},3e3);window._tcf_.onTcfReady(()=>{v("On Tcf Ready called, waiting for permission"),clearTimeout(o)}),window._tcf_.getPermission("CMP:advertising",e=>{clearTimeout(o);const t=Number(e);v("Advertising permission value obtained asynchronously: ",e),r(Boolean(t))})}),y="cmp:loaded";let f="undefined"!=typeof window?window._tcf_:void 0,w=!1;const b=(t,n,i)=>{const r=!!(null==t?void 0:t.enabled),o=(null==t?void 0:t.timeout)||3e3,s=p("bypass_tcf"),a=()=>{if(!(null==t?void 0:t.enabled))return!0;if(((e,t)=>e?!!t&&(v("TCF bypass param detected, returning consent: true"),!0):(v("TCF is not enabled, returning consent: true"),!0))(r,s))return!0;if(w)return null;if(!f)throw new Error("[Advertory]: getConsentSync method was called before the tcfManager was available.");const e=f.getConsentedToAllSync();return v(`TCF consented to all is: ${e}`),f.getConsentedToAllSync()};return{initConsentManager:()=>(null==t?void 0:t.enabled)?new Promise((e,t)=>{if(v("Getting TCF consent manager..."),window._tcf_)return v("TCF consent manager is already available"),f=window._tcf_,void e(f);v("TCF consent manager is not available");const n=()=>{v("CMP loaded, resolving consent manager..."),i&&clearTimeout(i),window._tcf_?(f=window._tcf_,e(f)):t(new Error("CMP loaded but window._tcf_ is not defined"))},i=setTimeout(()=>{document.removeEventListener(y,n),w=!0,t(new Error("Timeout waiting for CMP to load"))},o);v("Listening for CMP loaded event..."),document.addEventListener(y,n,{once:!0})}):Promise.resolve(null),getConsentSync:a,getConsentAsync:()=>e(void 0,void 0,void 0,function*(){if(null==t?void 0:t.schibstedAdChoicesOverrideValue)return v(`Schibsted Ad Choices override value is set, returning override value: ${t.schibstedAdChoicesOverrideValue}`),Boolean(Number(t.schibstedAdChoicesOverrideValue));const e=(null==t?void 0:t.schibstedAdChoicesEnabled)&&i===u.SE,n=(null==t?void 0:t.schibstedAdChoicesEnabled)&&i===u.NO;if(e||n)return v("Schibsted Ad Choices is enabled, getting advertising permissions..."),yield m(t);if(!(null==t?void 0:t.enabled))return!0;const r=a();return null!==r?r:yield new Promise((e,t)=>{try{if(!f)throw new Error("[Advertory]: getConsentAsync method was called before the tcfManager was available.");let t=!1;const n=n=>{t||(t=!0,e(n))},i=setTimeout(()=>{v("TCF isConsentedToAll timed out, resolving with false"),n(!1)},o);f.onTcfReady(()=>{v("On Tcf Ready called, waiting for consent"),clearTimeout(i)}),f.isConsentedToAll(t=>{clearTimeout(i),e(t)})}catch(e){t(e)}})})}},E=(t,n,i,...r)=>e(void 0,[t,n,i,...r],void 0,function*(e,t,n,i="NOT SPECIFIED FEATURE"){if(!(null==e?void 0:e.schibstedConsentToPayEnabled))return v(`Schibsted Consent to Pay is not enabled, returning true for ${i}`),!0;if(null==e?void 0:e.schibstedAdChoicesOverrideValue)return v(`Schibsted Ad Choices override value is set, returning override value: ${null==e?void 0:e.schibstedAdChoicesOverrideValue} for ${i}`),Boolean(Number(null==e?void 0:e.schibstedAdChoicesOverrideValue));const{getConsentAsync:r}=b(e,0,n);return(yield r())?(v(`Schibsted Ad Choices consent given according to TCF consent manager for ${i}`),!0):(v(`Schibsted Ad Choices consent not given according to TCF consent manager for ${i}`),!1)}),T=e=>{const t=encodeURIComponent(e).replace(/[-.+*]/g,"\\$&"),n=new RegExp(`(?:(?:^|.*;)\\s*${t}\\s*\\=\\s*([^;]*).*$)|^.*$`);return decodeURIComponent(document.cookie.replace(n,"$1"))||null},I=t=>e(void 0,void 0,void 0,function*(){const{tcf:e,isMobileApp:n,country:i}=t,{getConsentAsync:r}=b(e,0,i);if(!(yield r()))return;const o=T("_pulse2data");return o?o.split(",")[9]:void 0}),S={MOBILE:"mobile",TABLET:"tablet",DESKTOP:"desktop"},A="web_desktop",k="web_phone",C="wde",O="wph",P=9826;class L{constructor(){this.getSupplyTypeKeywords=()=>{const{deviceType:e=S.DESKTOP,isMobileApp:t}=l.get();if(t){return{"aa-sch-supply_type":`app_${e===S.MOBILE?"phone":S.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()),yield this.getFormattedExternalIdKeywords()),this.getHasContextKeywords(t.keywords)),user:{externalUid:yield this.getExternalUid(),dnt:yield this.isTrackingForbidden()}})})}getFormattedExternalIdKeywords(){return e(this,void 0,void 0,function*(){const e=yield this.getExternalUid(),t=this.getUserId();return{"aa-sch-externalid_src":Number(!!e)+Number(!!t)}})}getUserId(){return(()=>{const e=T("_pulse2data");return e?e.split(",")[2]:void 0})()}getExternalUid(){return e(this,void 0,void 0,function*(){return yield I(l.get())})}isTrackingForbidden(){return e(this,void 0,void 0,function*(){return(null===navigator||void 0===navigator?void 0:navigator.globalPrivacyControl)||"1"===(null===navigator||void 0===navigator?void 0:navigator.doNotTrack)||"DO_NOT_TRACK"===(yield this.getExternalUid())})}getMember(){const{pageOptions:{member:e},testMember:t=P}=l.get();return"true"===p("inventory_test")?t:e}getCMPValue(e){return localStorage.getItem(`CMP:${e}`)?"0"===localStorage.getItem(`CMP:${e}`)?"0":"1":"0"}getPublisherKeywords(){const{publisher:e}=l.get();return{"aa-sch-publisher":`${e}`}}getAnalyticsConsentKeywords(){return{"aa-sch-cmp_analytics":this.getCMPValue("analytics")}}getAdvertisingConsentKeywords(){return e(this,void 0,void 0,function*(){const{tcf:e,isMobileApp:t,country:n}=l.get(),{getConsentAsync:i}=b(e,0,n);return{"aa-sch-cmp_advertising":(yield i())?"1":"0"}})}getPageTypeKeywords(){const{pageType:e}=l.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}=l.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 $=new L;$.prepare.bind($);const _=()=>{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"},j=e=>e===S.DESKTOP,x=e=>e===S.MOBILE;class N extends L{constructor(){super(...arguments),this.getDeviceKeywords=()=>{const{deviceType:e=S.DESKTOP}=l.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(){return e(this,void 0,void 0,function*(){const e=yield this.getExternalUid(),t=this.getUserId();return e?{"se-generic-externalid_src":Number(!!e)+Number(!!t)}:{"se-generic-externalid_src":0}})}getAppTypeKeywords(){const{isMobileApp:e}=l.get(),{appMode:t,mobileOS:n}=function(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=_();return{OS:r,mobileOS:["ios","android"].includes(r)?r:"unknown",isHybridApp:i.includes("hermes"),appMode:e?"hybrid":"notinapp"}}(e);return{"se-generic-appmode":t,"se-generic-mobileos":n}}getPublisherGroup(){return{"se-generic-publishergroup":"schibsted"}}getSectionPageTypeKeywords(){var e,t;const{pageOptions:n,pageType:i}=l.get();return{"se-generic-section-page_type":`${null!==(t=null===(e=n.keywords["se-generic-section"])||void 0===e?void 0:e.toString())&&void 0!==t?t:"ettan"}_${"article"===i?"article":"front"}`}}}const q=864e5,D=(()=>{const e=e=>{const t=window.localStorage.getItem(e);if(!t)return null;try{return JSON.parse(t)}catch(e){return v("Error with parsing localStorage data"),null}},t=(e,t)=>{window.localStorage.setItem(e,JSON.stringify(t))};return{get:e,set:t,setWithTimestamp:(e,n,i=q)=>{const r={data:n,expirationTime:(new Date).getTime()+i};t(e,JSON.stringify(r))},getByTimestamp:(t,n=q)=>{const i=e(t);if(!i)return null;if(!n)return i;try{const{expirationTime:e,data:t}=JSON.parse(i);return(new Date).getTime()<=e?t:null}catch(e){return v("Error with parsing localStorage data"),null}}}})(),M="glimrTags",R=["glwe_","glwet_"],B={geofenceTags:[],geoTags:[],weatherTags:[]},F=(...t)=>e(void 0,[...t],void 0,function*(e=l.get()){const{tcf:t,isMobileApp:n,country:i}=e;if(null==t?void 0:t.schibstedConsentToPayEnabled){return yield E(t,n,i,"glimr")}const{getConsentAsync:r}=b(t,0,i);return yield r()}),U=()=>e(void 0,void 0,void 0,function*(){const{glimr:t}=l.get();if(!(yield F())||!(null==t?void 0:t.enabled))return void v("No consent for glimr data fetching.");const n=yield(i=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),i))])}));var i;if(n)try{n.setTagCacheTimeInSeconds(300),yield new Promise(e=>{n.getTags(t.clientId,(t,n)=>{D.setWithTimestamp(M,{tags:t,tagMappings:n}),e(!0)})})}catch(e){v(`Error during getting glimr data: ${e}`)}else v("Timeout (500ms) while loading glimr package. Skipping glimr data fetching.",{glimr:n})}),V={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"},H=e=>R.some(t=>e.startsWith(t)),z=e=>e.startsWith("glgc_"),W=e=>!H(e)&&!z(e),K=e=>e===u.NO?"no-sno":"se-generic",G=()=>{const{country:e,publisher:t}=l.get();return`${e}-${t}`},Y=(t,n)=>e(void 0,void 0,void 0,function*(){const{addPublisherToGeo:e}={},{glimr:n,country:i}=t,r=yield F(t);if(!(null==n?void 0:n.enabled)||!r)return v("No consent for getting glimr tags."),{};const o=K(i),s=J(t,Boolean(e));return{[`${o}-geo`]:s.geoTags,[`${o}-weather`]:s.weatherTags,[`${o}-geofence`]:s.geofenceTags}}),J=(e,t)=>{const n=Q();if(!n)return B;const i=((e=[])=>e.filter(H))(n),r=((e=[])=>e.filter(z))(n),o=((e=[],t,n)=>{const i=e.filter(W);if(n&&t){const{publisher:e}=t,n=V[e]||e;i.push(n)}return i})(n,e,t);return{geoTags:o,geofenceTags:r,weatherTags:i}},Q=()=>{const e=D.getByTimestamp(M);return e&&"string"!=typeof e?null==e?void 0:e.tags:null},X={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="advertory:ppids-cache",ee={[u.SE]:`SCH${u.SE.toUpperCase()}-EnvHash`,[u.NO]:`SCH${u.NO.toUpperCase()}-EnvHash`},te={[u.SE]:`SCH${u.SE.toUpperCase()}-UserHash`,[u.NO]:`SCH${u.NO.toUpperCase()}-UserHash`},ne={[u.SE]:`sch${u.SE}-envhash-v3`,[u.NO]:`sch${u.NO}-envhash-v3`},ie={[u.SE]:`sch${u.SE}-userhash-v3`,[u.NO]:`sch${u.NO}-userhash-v3`},re={[u.SE]:`'sch${u.SE}-iosid-v3'`,[u.NO]:`'sch${u.NO}-iosid-v3'`},oe={[u.SE]:`sch${u.SE}-androidid-v3`,[u.NO]:`sch${u.NO}-androidid-v3`},se={[u.SE]:"sdrn:schibsted.com:user",[u.NO]:"sdrn:spid.no:user"};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,t;return null!==this.ppid1&&null!==this.ppid2||v("PPIDv2s accessed before they have been initialized"),{ppid1:null!==(e=this.ppid1)&&void 0!==e?e:"",ppid2:null!==(t=this.ppid2)&&void 0!==t?t:""}}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,v;const p=D.get(Z),g=yield this.getNewPPIDs(t,n);if(this.shouldHash(p,g)){const n=null!==(e=t.hasherUrl)&&void 0!==e?e:"https://hasher.schibsted.com/api/v1/hash",l=this.createHasherPayload(g),c=yield this.hashPPIDs(l,n);return c?(this.cachePPIDs(l,c,null===(i=g.idfv)||void 0===i?void 0:i.plain,null===(r=g.anId)||void 0===r?void 0:r.plain),void this.setPPIDs(null!==(o=c.userId)&&void 0!==o?o:"",null!==(s=c.environmentId)&&void 0!==s?s:"",null===(a=g.idfv)||void 0===a?void 0:a.plain,null===(d=g.anId)||void 0===d?void 0:d.plain)):void this.setPPIDs("","")}this.setPPIDs(null!==(l=null==p?void 0:p.userId.hashed)&&void 0!==l?l:"",null!==(c=null==p?void 0:p.environmentId.hashed)&&void 0!==c?c:"",null===(u=null==g?void 0:g.idfv)||void 0===u?void 0:u.plain,null===(v=null==g?void 0:g.anId)||void 0===v?void 0:v.plain)})}getPPIDs(){var e,t;return null!==this.ppid1&&null!==this.ppid2||v("PPIDv3s accessed before they have been initialized"),{ppid1:null!==(e=this.ppid1)&&void 0!==e?e:"",ppid2:null!==(t=this.ppid2)&&void 0!==t?t:"",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}}:{});D.set(Z,r)}hashPPIDs(t,n){return e(this,void 0,void 0,function*(){try{const e=new Headers({"Content-Type":"application/json"});return yield X.post(n,e,t)}catch(e){return v("Error with hashing PPIDs",e),null}})}getNewPPIDs(t,n){return e(this,arguments,void 0,function*({clientId:t,instance:n},i){const r=yield((t,n)=>e(void 0,void 0,void 0,function*(){const e=yield t.getUserId();return e?`${se[n]}:${e}`:null}))(n,i),o=yield(t=>e(void 0,void 0,void 0,function*(){const e=yield t.getEnvironmentId();return e?`sdrn:schibsted:environment:${e}`:null}))(n),s=window.advertory_idfv,a=window.advertory_anId;return Object.assign(Object.assign({clientId:{plain:t},userId:{plain:r},environmentId:{plain:o},trackerType:{plain:"Advertory"},trackerVersion:{plain:"1.0.0"}},s?{idfv:{plain:s}}:{}),a?{anId:{plain:a}}:{})})}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=t=>e(void 0,void 0,void 0,function*(){const{tracker:e,tcf:n,country:i,isMobileApp:r}=t;if(!(yield E(n,r,i,"setXandrPPIDs")))return;if(!e)return;(yield Promise.allSettled([de.processPPIDs(e,null==n?void 0:n.timeout),le.processPPIDs(e,i)])).forEach((e,t)=>{if("rejected"===e.status){v(`Cannot fetch PPIDs v${t+2}`,e.reason)}})}),ue=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,ee[e]).add(t,te[e]).add(r,ne[e]).add(i,ie[e]).add(o,re[e]).add(s,oe[e]).buildEids()}]}},ve=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,ee[e]).add(t,te[e]).add(r,ne[e]).add(i,ie[e]).add(o,re[e]).add(s,oe[e]).buildRyEids()}}]}}},pe=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,ee[t]).add(e,te[t]).add(r,ne[t]).add(i,ie[t]);return yield new Promise(e=>{e(o.buildVideoEids())})});const ge=new class extends N{constructor(){super(...arguments),this.getHasPlusMembership=()=>({"se-generic-has_plus":"plus"===T("X-AB-Site-Version")?"yes":"no"})}prepare(t){return e(this,void 0,void 0,function*(){const e=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(Object.assign({"aa-sch-country_code":u.SE},this.getPublisherKeywords()),this.getSupplyTypeKeywords()),this.getAppTypeKeywords()),this.getDeviceKeywords()),this.getScreenKeywords()),this.getSectionPageTypeKeywords()),yield this.getAdvertisingConsentKeywords()),this.getAnalyticsConsentKeywords()),yield this.getExternalIdSrc()),this.getHasContextKeywords(t.keywords)),yield Y(l.get())),(()=>{const{ppid1:e,ppid2:t}=de.getPPIDs();return{"aa-sch-schuserhash":e?"1":"0","aa-sch-schenvhash":t?"1":"0"}})()),this.getHasPlusMembership()),t.keywords);return Object.assign(Object.assign({},t),{keywords:e,user:Object.assign(Object.assign({},ue(u.SE)),{externalUid:yield this.getExternalUid()}),member:this.getMember()})})}};var he=ge.prepare.bind(ge);const me="ABSOLUTE_FULLSCREEN",ye="ANY_FULLSCREEN",fe="VERTICAL_FULLWIDTH",we="FULLWIDTH",be="TAKEOVER",Ee="VELVET_TAKEOVER",Te="WALLPAPER",Ie="COLLAPSE",Se={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}],VELVET_TAKEOVER:[{width:7,height:7}],WALLPAPER:[{width:2,height:2}],COLLAPSE:[{width:2,height:1}]},Ae={wallpaper:1600,"l-format":1600},ke=e=>{const{banner:t,targetId:n}=e;return!(!t||(null==n?void 0:n.includes("takeover")))&&Ue(e,ye)},Ce=e=>{const{native:t}=e;return!!t},Oe=e=>Ue(e,we),Pe=e=>{const{targetId:t}=e;return t.includes("takeover")||Ue(e,be)},Le=e=>Ue(e,be),$e=e=>Ue(e,Te),_e=e=>Ue(e,Ie),je=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"),qe=e=>e.targetId.startsWith("midboard"),De=e=>e.targetId.includes("widescreen"),Me=e=>"https://acdn.adnxs.com/video/outstream/ANOutstreamVideo.js"===e.renderer_url,Re=e=>e.width>=1260&&e.width<=1280,Be=e=>e.width>=1600&&e.width<=1620,Fe=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"))},Ue=(e,t)=>{const n=Se[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})},Ve=e=>{var t,n;const{pageSectionsSelectors:{right:i}={}}=l.get();if(!i)return;const r=null===(t=Array.from(document.querySelectorAll(i)))||void 0===t?void 0:t[0];if(r){const t=40,i=(null===(n=e.banner)||void 0===n?void 0:n.height)?e.banner.height+t:0;r.style.marginTop=`${i}px`}},He=(e,t)=>{e.style.position="fixed",e.style.transform=`translateY(${t}px)`},ze=(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=e?t.offsetHeight:0;He(n,i)})(e.isIntersecting,n,r)),s=new ResizeObserver(()=>((e,t)=>{He(t,e.offsetHeight)})(n,r));o.observe(n),s.observe(n)},We=e=>["scrolling-up","menuScrollingUp"].some(t=>e.classList.contains(t)||document.body.classList.contains(t))||0===window.scrollY,Ke=e=>e.reduce((e,t)=>{var n;return e+(null!==(n=null==t?void 0:t.getBoundingClientRect().height)&&void 0!==n?n:0)},0),Ge=(e,t)=>t.map(t=>e.querySelector(t)),Ye=(e,t)=>{e.style.transform=`translateY(${t}px)`,e.style.transition="transform 0.3s ease-out"},Je=(e,t)=>{const{headerSelector:n,staticElementsSelectors:i,dynamicElementsSelectors:r}=t;if(!n||!i||!r)return;const o=document.querySelector(n),s=document.querySelector(`#${e}`);if(!o||!s)return;const a=s.parentElement,{minimizedTop:d,expandedTop:l}=((e,t,n)=>{const i=Ge(e,t),r=Ge(e,n),o=Ke(i);return{minimizedTop:o,expandedTop:o+Ke(r)}})(o,i,r);Ye(a,We(o)?l:d);const c=((e,t,n,i)=>{let r=!We(e);return()=>{const o=!We(e);o!==r&&(r=o,Ye(t,o?n:i))}})(o,a,d,l);((e,t)=>{const n=new MutationObserver(t);e.forEach(e=>{n.observe(e,{attributes:!0,attributeFilter:["class"],attributeOldValue:!1})})})([o,document.body],c)},Qe=e=>document.querySelector(e)||document.querySelector(`[class*="${e}"]`),Xe=e=>{const t=e[0];if("attributes"!==t.type||"class"!==t.attributeName)return;const n=t.target;setTimeout(()=>{var e;const t=document.getElementsByTagName("video")[0],i=null==t?void 0:t.getBoundingClientRect(),r=n.classList.contains("jw-flag-floating")&&!n.classList.contains("jw-flag-ads")?(null==i?void 0:i.height)+0:0,o=null===(e=document.querySelector('div[id^="sponsorstripe"]'))||void 0===e?void 0:e.firstChild;o&&(o.style.top=`${r}px`)},750)},Ze={attributeFilter:["class"],attributes:!0,childList:!1,subtree:!1},et=(e,t,n=S.DESKTOP)=>{if(!t||!je(e))return;const{toggleEnabled:i,headerSelector:r,containersSelectors:o,staticElementsSelectors:s,dynamicElementsSelectors:a,hideOnScroll:d}=t,{targetId:l}=e;if(!i)return;const c=null==a?void 0:a.length,u=document.querySelector(".advertory-takeover-wrapper"),v={headerSelector:r,staticElementsSelectors:s,dynamicElementsSelectors:a},p=[()=>r&&!c&&ze(l,r),()=>c&&Je(l,v),()=>o&&((e,t)=>{const n=document.querySelector(`#${e}`);if(!n)return;const[i,r]=t;if(!i)return;const o=()=>{const e=Qe(i),t=r?Qe(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)})(l,o),()=>u&&((e,t)=>{const n=document.querySelector(`#${e}`);if(!n||!t)return;new IntersectionObserver(([e])=>{n.style.visibility=e.isIntersecting?"hidden":"visible"}).observe(t)})(l,u),()=>d&&((e,t,n)=>{if(!je(e)||!x(n))return;const{hideOnScroll:i}=t;if(!i)return;const r=document.querySelector(`#${e.targetId}`),o=null==r?void 0:r.parentElement;if(!o)return;const s=1.5*window.innerHeight;window.addEventListener("scroll",()=>{window.scrollY>=s?o.classList.add("advertory-sponsorstripe-onscroll-hidden"):o.classList.remove("advertory-sponsorstripe-onscroll-hidden")},{passive:!0})})(e,t,n)];p.forEach(e=>e())},tt={adRequested:()=>{},adAvailable:e=>{(Be(e)||Re(e))&&(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"),Ve(e)),e.width>=1600&&e.width<=1620&&(n.classList.add("advertory-aftonbladet-h-format"),Ve(e)))})(e)},adLoaded:e=>{const t=document.getElementById(e.targetId);Oe(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")),je(e)&&(()=>{const{deviceType:e}=l.get();x(e)&&setTimeout(()=>{const e=document.querySelector(".jwplayer");e&&new MutationObserver(Xe).observe(e,Ze)},1500)})(),Me(e)&&(null==t||t.classList.add("outstream")),Ne(e)&&(e=>{const{deviceType:t}=l.get(),n=e.height<345;if(!x(t)||!n)return;const i=document.querySelector(`#${e.targetId}`),r=null==i?void 0:i.parentElement;i&&r&&(i.style.minHeight="unset",r.style.minHeight="unset")})(e)},adNoBid:e=>{},adError:(e,t)=>{},adCollapse:()=>{},adRequestFailure:e=>{},adBadRequest:e=>{},adLoadedMediated:e=>{},adNoBidMediated:e=>{}},nt={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",TVNU:"tvnu",POLARIS:"polaris",KOKET:"koket",TV4:"tv4",FOTBOLLSKANALEN:"fotbollskanalen"},it={publisherClassName:nt.AFTONBLADET,fullWidthFormatClassName:"panorama",classesToRemoveOnRefresh:["advertory-aftonbladet-h-format","advertory-aftonbladet-l-format"],dynamicOutstreamFormats:["panorama","outstream"]},rt={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"}},ot=()=>null!==p("disable_prebid"),st=(e,t,n,i)=>{var r;const{image:o,icon:s,sponsoredBy:a,title:d,clickUrl:l,cta:c,body:u,desc2:v,video:p,description:g,customTitle1:h,customTitle2:m,customTitle3:y,customTitle4:f,customIcon1:w,customIcon2:b,customDisplayUrl1:E}=e,T=(e,t="")=>{var n;return e?null!==(n=e.url)&&void 0!==n?n:e:t};return Object.assign({containerId:n,img:T(o),imgWidth:null==o?void 0:o.width,imgHeight:null==o?void 0:o.height,imgAltText:null!=d?d:"",logo:(()=>{var e;const t=(null==v?void 0:v.includes("sponsor"))&&"dark"===(null===(e=i.appearanceConfig)||void 0===e?void 0:e.theme)&&w;return T(t?w:s)})(),sponsoredBy:null!=a?a:"",title:null!=d?d:"",url:null!=l?l:"",cta:null!=c?c:"",description:null!==(r=null!=u?u:g)&&void 0!==r?r:"",desc2:null!=v?v:"",video:p,customTitle1:null!=h?h:"",customTitle2:null!=m?m:"",customTitle3:null!=y?y:"",customTitle4:null!=f?f:"",logo2:T(b),previewVideoSrc:null!=E?E:""},t)},at=(e,t)=>{const n=(i=h,window.location.href.includes(i));var i;const r=new URLSearchParams(window.location.search).get(h),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},dt="native-ad",lt=(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(nt).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,dt,r)})(r,n),i())},ct=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:[])gt(i)}),t.dataset.tracked="true")})},ut=e=>{const{native:{impressionTrackers:t}={}}=e;(null==t?void 0:t.some(e=>e.includes("googleads")))?null==t||t.forEach(pt):window.apntag.fireImpressionTrackers(e);const n=new CustomEvent("advertory:nativeImpression",{detail:{ad:e}});window.dispatchEvent(n)},vt=(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:S.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,ut(e),c.disconnect();break}},d);c.observe(r)},pt=e=>{const t=e.includes("googleads");"function"!=typeof window.navigator.sendBeacon||t?gt(e):window.navigator.sendBeacon(e)},gt=e=>{fetch(e,{method:"GET",mode:"no-cors"}).catch(t=>console.warn(`Tracker ${e} failed. Error: ${t||"Unknown"}`))},ht=(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(),v=null!==(i=at(e.targetId,l))&&void 0!==i?i:c,p=rt[t.language||u.NO],g=st(a,p,d,t);return(a.video?o[v]:r[v]||r.default)(g,t)})(e,t,n);lt(e.targetId,i,t,()=>{const{nativeTrackingConfig:{nativeTrackingEnabled:n=!0}={}}=t;n&&((e,t)=>{ct(e),vt(e,t)})(e,t)})},mt={FRONT:"front",ARTICLE:"article"},yt=({containerId:e,url:t,adText:n,sponsoredBy:i,title:r,img:o,description:s,desc2:a},d)=>{const l=Fe({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}"${j(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>`},ft=e=>null!==e&&"object"==typeof e&&!Array.isArray(e),wt="viewable",bt="adClick",Et=(e,t)=>{null==t||t.forEach(t=>{const n=window.SVP.Player.Plugins.get(t);e.addPlugin(new n)})},Tt=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)))}))}),It={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 vs})})}})}},St=(e,t)=>{null==e||e.forEach(e=>{It[e](t)})};const At=(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"}))},kt=({id:e,nodeId:t,poster:n,tagURL:i,publisher:r="",productTag:o="xandr",videoLoop:s=!1})=>({id:e,poster:n,vendor:"appnexus",node:t,mute:!0,autoplay:s,repeat:s,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({},ft(e)?e:{}),{provider:Object.assign(Object.assign({},ft(null==e?void 0:e.provider)?e.provider:{}),{productTag:o})})}}),Ct=t=>e(void 0,void 0,void 0,function*(){const{playerConfig:e,pluginsNames:n,clickUrl:i}=t,{repeat:r}=e,o=yield Tt(e);St(n),o.once("assetReady",()=>{Et(o,n)}),o.on(wt,e=>{const{viewable:t}=e;t?o.play():o.pause()}),o.on(bt,()=>{window.open(i,"_blank")}),r&&o.on("pause",()=>{o.play()})}),Ot=({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-video">\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}"${j(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>`},Pt={CONTENT_DISPLAY:(e,{pageType:t})=>t===mt.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:yt,CLASSIC_VIDEO:(e,t)=>{const{video:n}=e;return(null==n?void 0:n.content)?(i=Ot,(e,t,n)=>{const{video:r,img:o,url:s}=e,{publisher:a,productTag:d}=t,{pluginsNames:l,videoLoop:c}=n||{};if(!(null==r?void 0:r.content))return null;const u=Math.ceil(1e5*Math.random()),v=o||"https://custom.inventory.schibsted.io/1x1-00000000.png",p=`ad-player-${u}`,g=At(r.content,s),h=kt({id:u,nodeId:p,poster:v,tagURL:g,publisher:a,productTag:d,videoLoop:c});return Ct({playerConfig:h,clickUrl:s,pluginsNames:l}),`${i(e,t,p)}`})(e,t):yt(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,u.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>`},Lt={displayTemplates:{brandstudio_native_ad:Pt.CLASSIC,brandstudio_native_ad_alcohol:Pt.CLASSIC,default:Pt.CONTENT_DISPLAY,gambling:Pt.CONTENT_DISPLAY,ab_chat:Pt.CHAT_INTEGRATION,sponsor:Pt.SPONSORSTRIPE,sponsortop:Pt.SPONSORSTRIPE,sponsorstripe:Pt.SPONSORSTRIPE},videoTemplates:{brandstudio_native_ad:Pt.CLASSIC_VIDEO}},$t=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`};class _t{initialize(){this.DATA=Object.assign({},_t.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)}}_t.INITIAL_DATA={wallpaper:{isAvailable:!1},horseshoe:{isAvailable:!1},initialClassNames:{},alertoryConfigKeywords:{}};const jt=new _t,xt=()=>(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),Nt=()=>(window.relevantDigital||(window.relevantDigital={cmd:[]}),window.relevantDigital),qt=(e={},t)=>{const{prebid:{externalUidInAuctionEnabled:n,forwardGlimrTags:i=!1}={},country:r}=l.get(),o=[`${K(r)}-geo`],s=["aa-sch-context_keyword","aa-sch-publisher","se-aftonbladet-section","se-svd-section","se-generic-section","no-sno-news-section","no-sno-news-subsection","aa-sch-cmp_advertising",...i?o:[]],a=Object.fromEntries(Object.entries(e).filter(([e])=>s.includes(e))),d=t&&n?{id:t}:{};return{ortb2:Object.assign({site:{ext:{data:a}}},d)}},Dt=(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)}))}),Mt="advertory-fullscreen-scroll",Rt="advertory-fullscreen-scroll-wrapper",Bt="fullscreen-scroll-in-screen",Ft="in-screen",Ut=e=>e.includes("snoap.no"),Vt=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)},Ht=(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()},zt=Ht([],()=>{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}),Wt=e=>{const t=Ht([],()=>{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},Kt=[],Gt={},Yt=(e,t)=>{e.forEach(({target:e,isIntersecting:n})=>{const i=Qt(e);n?(Jt(i,n),Xt(e,i,t)):(Jt(i,n),Zt(e,i,t))})},Jt=(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}`,"*")},Qt=e=>{var t;return null===(t=e.children[0])||void 0===t?void 0:t.id},Xt=(e,t,n)=>{e.classList.add(Ft),document.body.classList.add(Bt),window.dispatchEvent(new CustomEvent("advertory:fullscreenScrollInView")),Kt.includes(t)||Kt.push(t),n&&window.addEventListener("scroll",Gt[t],{passive:!0})},Zt=(e,t,n)=>{Kt.includes(t)&&(n&&window.removeEventListener("scroll",Gt[t]),document.body.classList.remove(Bt),e.classList.remove(Ft),window.dispatchEvent(new CustomEvent("advertory:fullscreenScrollNotInView")))},en=(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&&tn(e,o,r,0),s.length&&tn(e,s,r,40)}},tn=(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()})};let nn=null;const rn=(e,t)=>{let n=e;return n=(e=>{const t=document.createElement("script");return t.textContent="\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 ",e+t.outerHTML})(e),n=(e=>{const t=document.createElement("script");return t.textContent=`(${zt})()`,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(Ut(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=Wt(n)),(e=>e.includes("de17a"))(n)&&(n=(e=>Ut(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)),Ut(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)),Vt(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},on=()=>{nn=null;const e=window.visualViewport,t=e?e.height:window.innerHeight,n=e?e.width:window.innerWidth,i=e?e.offsetLeft:0,r=document.documentElement;r.style.setProperty("--advertory-fullscreen-scroll-vh",`${t}px`),r.style.setProperty("--advertory-fullscreen-scroll-vw",`${n}px`),r.style.setProperty("--advertory-fullscreen-scroll-left",`${i}px`)},sn=()=>{nn||(nn=window.requestAnimationFrame(on))},an=(e,t)=>{var n,i,r,o;const{country:s}=l.get(),{targetId:a}=e;document.documentElement.style.setProperty("--advertory-ios-safe-area-top-fix",null!==(n=null==t?void 0:t.iosSafeAreaTopFix)&&void 0!==n?n:"0px"),(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!==(i=null==t?void 0:t.overlayStyles)&&void 0!==i?i:{});const d=document.getElementById(a),c=null==d?void 0:d.parentElement;if(!d||!c)return;((e,t)=>{const n=(null==t?void 0:t.fadingHeaderEnabled)||!1,i=new IntersectionObserver(e=>Yt(e,n),{}),r=Qt(e);i.observe(e),n&&(Gt[r]=en(e,t))})(c,t),d.className=Mt;const u=Ue(e,me)?"absolute":"fixed";d.style.position=u,c.className=Rt,c.dataset.showTagSubscribeId=a,d.setAttribute("data-ad-label",rt[s].adText),(null==t?void 0:t.moveCogwheelToTheLeft)&&(d.dataset.moveCogwheelToTheLeft="true"),sn(),window.addEventListener("resize",sn),null===(r=window.visualViewport)||void 0===r||r.addEventListener("resize",sn),null===(o=window.visualViewport)||void 0===o||o.addEventListener("scroll",sn)},dn=({targetId:e})=>{const t=(e=>{var t;const{requests:n}=window.apntag,i=Vt(e)?1:0;return null===(t=null==n?void 0:n.tags[e].adResponse.ads[i].rtb)||void 0===t?void 0:t.banner.content})(e);if(!t)return;((e,t)=>{const{requests:n}=window.apntag,i=Vt(e)?1:0,r=null==n?void 0:n.tags[e].adResponse.ads[i].rtb;r&&(r.banner.content=t)})(e,rn(t,e))},ln=e=>{var t;!document.querySelector(`#gdprAdTransparencyCogWheelButton-${e}`)&&(null===(t=window.gdpr)||void 0===t?void 0:t.setupButton)&&window.gdpr.setupButton(e)},cn="ad-loaded",un=()=>e(void 0,void 0,void 0,function*(){const{prebid:e,tcf:t,country:n,isMobileApp:i,fullscreenScroll:r}=l.get();if(!(null==e?void 0:e.enabled))return;const{initNativeAd:o}=l.getHandlers(),{getConsentAsync:s}=b(t,0,n),a=yield s(),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=xt(),{prebid:{relevantCbTimeout:o}={}}=l.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}}})(),c=xt(),u=(()=>{const{requests:{user:e={userIds:[]},keywords:t={}}={}}=xt();return{user:e,keywords:t}})();d.failsafeOnTimeout("relevantCb");const{user:{externalUid:p=""}={},keywords:g}=u;(()=>{const e=Nt();return e.cmd||(e.cmd=[]),e.cmd})().push(()=>{if(d.getCancel()||!c.loadTags)return v("core loadTags() call was cancelled",{cancel:d.getCancel(),apnTagLoadTags:!c.loadTags,condition:"or"}),void d.cleanup();const t=Nt();d.events.relevantCb.done=!0,d.failsafeOnTimeout("auctionCb");const i=a?{gdpr:{cmpApi:"iab",timeout:8e3}}:{cmpApi:"none"};v("prebid consentManagement",i),t.addPrebidConfig(Object.assign(Object.assign({consentManagement:i,enableSendAllBids:!1},ve(n)),qt(g,p))),v("core add prebid config",Object.assign(Object.assign({consentManagement:i,enableSendAllBids:!1},ve(n)),qt(g,p))),t.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,c.loadTags(e)),d.cleanup()}},customNativeRender:e=>{vn(e,o)},directRenderFn:e=>{var t;const{settings:n,renderFn:i}=e,{bid:o,adDiv:s}=n||{};if(!s)return;const a=i(n),d=Object.assign(Object.assign({},o),{targetId:s.id,banner:!0}),l=s.id,c=document.getElementById(l);c&&(ke(d)?(an(d,r),(e=>{const t=()=>{const t=e.contentDocument;if(!(null==t?void 0:t.body))return;const n=()=>{const e=t.querySelector("iframe");if(!e)return!1;const n=()=>{var t;const n=null===(t=e.contentDocument)||void 0===t?void 0:t.querySelector(".adn-ttpa-container");n&&(n.style.setProperty("bottom","10px","important"),n.style.setProperty("top","unset","important"))};return e.addEventListener("load",n),n(),!0};if(n())return;const i=new MutationObserver(()=>{n()&&i.disconnect()});i.observe(t.body,{childList:!0,subtree:!0})};e.addEventListener("load",t),t()})(a)):((e=>{if(!(null==e?void 0:e.classList.contains(Mt)))return;e.classList.remove(Mt),e.removeAttribute("style"),e.removeAttribute("data-ad-label");const t=e.parentElement;(null==t?void 0:t.classList.contains(Rt))&&(t.classList.remove(Rt),t.classList.remove(Ft))})(c),null===(t=null==c?void 0:c.parentElement)||void 0===t||t.classList.add("advertory-direct-render")),c.classList.add(cn),((e,t,n)=>{var i,r,o,s;const a=document.createElement("div");a.id=`${e}-button`,t.appendChild(a),(null===(r=null===(i=window.apntag.requests)||void 0===i?void 0:i.tags[e])||void 0===r?void 0:r.adResponse)||(null!==(o=(s=window.apntag).requests)&&void 0!==o||(s.requests={tags:{}}),window.apntag.requests.tags[e]=Object.assign(Object.assign({},window.apntag.requests.tags[e]),{adResponse:{ads:[{creative_id:n}]}})),ln(e);const d=a.firstElementChild;d&&t.insertBefore(d,a),a.remove()})(l,c,null==o?void 0:o.creativeId))}}),v("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,c.loadTags(e))}},customNativeRender:e=>{vn(e,o)},directRenderFn:()=>{}})})}),vn=(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},l.get()),null==d||d.postMessage(JSON.stringify({message:"Prebid Response",ad:"\x3c!-- nothing --\x3e",adId:o.adId}),"*")},pn="0123456789abcdefghijklmnopqrstuvwxyz",gn=()=>Promise.resolve(),hn=()=>{},mn=e=>{window.apntag.anq.push(e)},yn=new Promise(e=>{"undefined"!=typeof document&&document.prerendering?document.addEventListener("prerenderingchange",()=>e()):e()}),fn=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})});let wn="";const bn=new Map,En=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},Tn="advertory-wallpaper-background",In=()=>{const e=document.querySelector(`.${Tn}`);e&&e.remove()},Sn=/^wallpaper:url:(http[s]?:\/\/)?[^\s(["<,>]*\.[^\s[",><]*/,An=e=>{if("0"===p("collapse_ad"))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")&&In())},kn=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"))},Cn=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`)},On=e=>{const t=e.parentElement;if(!e||!t)return;const{container:n,wrapper:i}=(e=>{const t=jt.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},Pn=()=>{In();document.querySelectorAll('[data-advertory-ad-rendered="true"]').forEach(e=>{An(e.id),On(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=En(e.id)}),mn(()=>window.apntag.clearRequest())},Ln="noGroupedPlacements",$n=e=>{const t=e.replace(/[0-9]/g,"");return"_"===t.slice(-1)?t.substring(0,t.length-1):t},_n=e=>{if(!(null==e?void 0:e.minViewWidth))return!0;return window.innerWidth>=e.minViewWidth},jn=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}=l.get(),o=n[r].filter(_n)||[],s=e?document.querySelector(e):document;if(!s)return[];const a=o.reduce((e,t)=>{const n=$n(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),c=Array.from(d).filter(({id:e})=>e.match(t)).map((e,t)=>{var i;const r=xn(e,t,n),o=r.finnBlink&&!r.finnBlink.renderOnlyWithAdBlock,s=o&&(null===(i=r.finnBlink)||void 0===i?void 0:i.loadOnlyFinnBlink),a=`${e.id}-${((e=6)=>{if(e<=0)return"";let t="";for(let n=0;n<e;n++)t+=pn[Math.floor(36*Math.random())];return t})(6)}`;return e.id=a,e.setAttribute("data-advertory-ad-rendered","true"),o&&e.setAttribute("data-is-finn-blink-placement","true"),s&&e.setAttribute("data-is-finn-blink-only-placement","true"),(e=>{var t;const n=e.id;n&&jt.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({},r),{id:a})});return(e=>{const{keywordsConfig:t}=l.get();return(null==t?void 0:t.includeCountingKeywordInTags)?(wn!==window.location.pathname&&(bn.clear(),wn=window.location.pathname),e.map(e=>{var t;const n=e.invCode.replace(/_\d+$/,""),i=null!==(t=bn.get(n))&&void 0!==t?t:0;return e.keywords=Object.assign({},e.keywords),e.keywords[`${G()}-count`]=i,bn.set(n,i+1),e})):e})(c)});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)},xn=(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},Nn=e=>{const{queryConfig:{placementBatches:t}={},deviceType:n}=l.get(),i=(null==t?void 0:t[n])||{},r=Object.values(i).flat(),o=(e=>{const t={};return e.forEach(e=>{const n=En(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(En(e.id)));return n})(e,i),a=Object.keys(o),d=((e,t)=>e.filter(e=>!t.has(En(e.id))))(e,new Set([...a,...r]));return Object.assign(Object.assign(Object.assign({},s),o),{[Ln]:d})},qn=(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])}},Dn=["netboard","board"];class Mn{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(t){return e(this,void 0,void 0,function*(){var e,n,i;const r=yield this.identityFacade.getIdentityUser(),o=null!==(i=yield null===(n=null===(e=this.tracker)||void 0===e?void 0:e.getEnvironmentId)||void 0===n?void 0:n.call(e))&&void 0!==i?i:"",s=(null==r?void 0:r.userId)?String(r.userId):"",a=this.buildUrl(t,{envId:o,spid:s});try{v("Starting fetching DrEdition ad from URL:",a);const e={method:"GET"},t=yield X.get(a,e);return v("Fetch operation completed successfully."),t}catch(e){v("Error during fetch operation:",e)}return null})}}let Rn=class{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]}};const Bn=e=>{const t=e.parentElement;t?t.classList.remove("dr-edition-lock-height"):v("Dr. Edition container does not have a parent element, cannot remove height lock.")};class Fn{constructor(e,t,n,i){this.drEditionService=e,this.rendererManager=t,this.videoManager=n,this.pulseManager=i,this.drEditionAds=[]}fetchAndRenderAd(t,n){return e(this,void 0,void 0,function*(){var e,i;const{drEditionConfig:{containerSelector:r},renderAsBackfill:o=!1}=n,s=t.querySelector(r);if(!s)return void v(`Container with selector "${r}" not found.`);const a=yield this.drEditionService.fetchData(n);return(null==a?void 0:a.itemId)||o?!(null==a?void 0:a.itemId)&&o?(v("No Dr. Edition ads available to render. Collapsing whole placement."),An(t.id),void Bn(s)):((null==a?void 0:a.itemId)&&o&&(v("Dr. Edition ad available to render as a Xandr backfill."),kn(t.id)),void(a?(a.css&&((e,t)=>{const n=document.createElement("link");n.rel="preload",n.href=e,n.as=t,document.head.appendChild(n)})(a.css,"style"),yield this.rendererManager.render(s,a,n),yield null===(e=this.videoManager)||void 0===e?void 0:e.handle(a,n),Bn(s),this.drEditionAds.push(a),window.advertory=window.advertory||{},window.advertory.renderedDrEditionAds=window.advertory.renderedDrEditionAds||[],window.advertory.renderedDrEditionAds.push(a.itemId),this.observeAdView(t,a,n),null===(i=t.querySelector("a"))||void 0===i||i.addEventListener("pointerup",()=>null)):Bn(s))):(v("No Dr. Edition ads available to render. Hiding Dr. Edition and rendering Xandr backfill."),this.hideDrEdition(s),this.showBackfill(t),void Bn(s))})}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:"";kn(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 Un{constructor(e,t){this.newsroomStrategy=e,this.pulseManager=t}render(t,n,i){return e(this,void 0,void 0,function*(){if(!(null==n?void 0:n.itemId))return;const{getConsentAsync:e}=b(i.tcf,i.isMobileApp,i.country),r=yield e(),o=x(i.device)?n.mobileHTML:n.desktopHTML,s=r?o:o.replace(/<img [^>]*class="tracking-pixel"[^>]*>/g,"");t.innerHTML=s,t.querySelectorAll("a").forEach(e=>{var t,r,o;e.search=null!==(o=null===(r=(t=this.newsroomStrategy).getUrlSearchParams)||void 0===r?void 0:r.call(t,e,n,i))&&void 0!==o?o:"",e.onclick=()=>this.pulseManager.trackContentClick(e,n,i)})})}}class Vn{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(t){return e(this,void 0,void 0,function*(){const e=t.drEditionConfig.videoScriptUrl,n=document.querySelector(`script[src="${e}"]`);if(e&&!window.autoplayQueue&&!n)try{yield Dt(e)}catch(e){v("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("src",o),a.setAttribute("playsinline",""),!(!a||!s)&&(null===(r=(i=t.drEditionConfig).addPreviewVideo)||void 0===r||r.call(i,a),!0))}}let Hn=class{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,d,l,c;const u=new CustomEvent("advertory:partnerstudioAdImpression",{detail:{ad:i.editionName}});if(window.dispatchEvent(u),!this.pulse)return;const v=this.getEventInput(t,n,i,"view");(null===(e=this.pulse)||void 0===e?void 0:e.trackLegacyViewUIElement)?null===(o=null===(r=this.pulse)||void 0===r?void 0:r.trackLegacyViewUIElement)||void 0===o||o.call(r,v):(null===(s=this.pulse)||void 0===s?void 0:s.trackViewUIElement)?null===(d=null===(a=this.pulse)||void 0===a?void 0:a.trackViewUIElement)||void 0===d||d.call(a,v):null===(c=null===(l=this.pulse)||void 0===l?void 0:l.trackElementView)||void 0===c||c.call(l,v)})}trackContentClick(t,n,i){return e(this,void 0,void 0,function*(){var e,r,o,s,a,d;if(!this.pulse)return;const l=this.getEventInput(t,n,i,"click");this.pulse.trackLegacyClickUIElement?null===(r=(e=this.pulse).trackLegacyClickUIElement)||void 0===r||r.call(e,l):this.pulse.trackClickUIElement?null===(s=(o=this.pulse).trackClickUIElement)||void 0===s||s.call(o,l):null===(d=(a=this.pulse).trackElementClick)||void 0===d||d.call(a,l)})}};class zn extends Hn{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)}}}let Wn=class extends Hn{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"}}};class Kn{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);St(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 Tt(l);c.once("assetReady",()=>{Et(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===mt.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 Gn="https://www.aftonbladet.se/video-player-extras/latest/";class Yn{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:{[`${Gn}cta-button.js`]:{name:"CtaButton",options:{type:"unmute"}},[`${Gn}external-link.js`]:{name:"ExternalLink"}}};yield Tt(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 Jn{handleVideo(t,n){return e(this,arguments,void 0,function*(t,{videoConfiguration:{id:n,node:i,autoplay:r,mute:o,vendor:s}}){const a={id:n,node:i,autoplay:r,mute:o,vendor:s,locale:"se",autopause:"viewable",maxBitrate:600,sharing:!1,recommended:!1,pulse:{provider:"svdse",decorator:(e,t)=>Object.assign(Object.assign({},ft(e)?e:{}),{provider:Object.assign(Object.assign({},ft(null==e?void 0:e.provider)?e.provider:{}),{productTag:"partnerstudio"})})},skin:{name:"svd-player",url:""},settings:{pulse:{host:"se-aftonbladet.videoplaza.tv",contentMetadata:{category:"SvD",tags:["standard-linears","pause",`video-${n}`]},requestSettings:{}}}},d=yield Tt(a);d.once("PulseStats:ready",()=>e(this,void 0,void 0,function*(){const e=yield d.getPlugin("PulseStats").getTracker();null==e||e.update({provider:{id:"svdse",productTag:"partnerstudio"}})}))})}getPulseObjectId(){return"sdrn:svdse:content:partnerstudio:element:partnerstudio:stats"}getPulsePageId(e,t){return e===mt.FRONT?"sdrn:svdse:frontpage:front":`sdrn:svdse:article:${t}`}}let Qn=class{handleVideo(e,t){}getPulseObjectId(){return""}getPulsePageId(e,t){return""}};const Xn=(e,t,n)=>{var i;const{publisher:r,pageType:o,country:s}=e,a={[nt.VG]:new Rn,[nt.E24]:new Kn,[nt.AFTONBLADET]:new Yn,[nt.SVD]:new Jn}[r]||new Qn,d=new(s===u.SE?zn:Wn)(n,a,o),l=new Mn(t,null!==(i=null==n?void 0:n.pulseTracker)&&void 0!==i?i:n),c=new Un(a,d),v=new Vn(a);return new Fn(l,c,v,d)},Zn=()=>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 ei{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 v("[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 ti=(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=Xn(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))},ni=()=>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)}}),ii=[],ri=(t,n)=>e(void 0,void 0,void 0,function*(){var e;const{pulse:i,tcf:r,deviceType:o,drEdition:s,publisher:a,pageType:d,country:l,isMobileApp:c}=t;if(!(yield E(r,c,l,"handleDrEditionBackfill")))return;const u=((e,t)=>{var n;const{deviceType:i,placements:r,drEdition:{fallbackGlobalEditionName:o}={}}=e,s=r[i]||r.desktop,a=En(t.targetId),d=s.find(e=>e.id===a),l=Dn.some(e=>a.startsWith(e)),c=ii.includes(a),u=(null===(n=null==d?void 0:d.drEdition)||void 0===n?void 0:n.editionName)||o;return d&&l&&!c&&u?(ii.push(a),Object.assign(Object.assign({},d),{drEdition:Object.assign(Object.assign({},d.drEdition),{editionName:u})})):null})(t,n);if(!u)return;if(!(null==i?void 0:i.instance))return void v("Pulse has not been passed as a prop, aborting");const p=yield Zn(),g=new ei(p),h=Xn({publisher:a,pageType:d,country:l},g,null==i?void 0:i.instance),m=document.getElementById(n.targetId);if(!m||!s)return;m.classList.value="";const y=document.createElement("div");y.className=s.containerSelector.replace(/^[.#:[\]]+/,""),m.innerHTML=y.outerHTML;const f={editionName:(null===(e=null==u?void 0:u.drEdition)||void 0===e?void 0:e.editionName)||"",drEditionConfig:s,device:o,tcf:r,isMobileApp:c,country:l,renderAsBackfill:!0};yield h.fetchAndRenderAd(m,f)}),oi=(t,n)=>{var i,r,o,s;if(!(()=>{const e=document.getElementById("ads-advertory-anchor");return!(e&&"none"!==getComputedStyle(e).display&&window.advertoryFluepapir)})())return void v("Ad block not enabled, Dr. Edition backfills will not be rendered");v("Ad block is enabled, Dr. Edition backfills will be rendered");const a=null!==(s=null===(o=null===(r=null===(i=t.finnBlink)||void 0===i?void 0:i.replacementConfig)||void 0===r?void 0:r.adsToReplace)||void 0===o?void 0:o.map(([e])=>e))&&void 0!==s?s:[],d=new IntersectionObserver((n,i)=>e(void 0,void 0,void 0,function*(){for(const e of n){if(!e.isIntersecting)continue;const n=e.target;i.unobserve(n),yield ri(t,{targetId:n.id})}}),{rootMargin:"400% 0px"});n.filter(e=>!a.some(t=>e.id.startsWith(t))).forEach(e=>{const t=document.getElementById(e.id);t&&d.observe(t)})},si="collapseAd",ai="hideAd",di="resizeAd",li="renderDrEditionFallback",ci="wallpaperImageUrl",ui="wallpaperColor",vi="velvet",pi=[di,ci,ui,si,ai,li,vi];let gi;const hi=e=>{if("object"==typeof e)return e;if(t=e,Sn.test(t)){const t=e.replace(/^wallpaper:url:/,"");return{name:ci,wallpaperImageUrl:t}}var t;if((e=>e.startsWith("wallpaper:color:"))(e)){const t=e.replace(/^wallpaper:color:/,"");return{name:ui,wallpaperColor:t}}if(e.startsWith(li)){const t=e.split(":")[1];return{name:li,targetId:t}}if(e.startsWith(si)||e.startsWith(ai)){const t=e.split(":")[1];return{name:si,targetId:t}}if(e.includes("name")&&pi.some(t=>e.includes(t)))try{return JSON.parse(e)}catch(e){}},mi=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=hi(t);if(!n)return;if(!n.name||!pi.some(e=>n.name===e))return;const{name:i,targetId:r,wallpaperImageUrl:o,wallpaperColor:s,cmd:a,size:d}=n;i===vi&&a&&(a.includes("noScroll")&&(gi=(e=>{if(!e)return()=>{};const t=e.style.overflow;return e.style.setProperty("overflow","hidden"),()=>{e.style.setProperty("overflow",t)}})(document.querySelector("body"))),(a.includes("close")||a.includes("ended"))&&(null==gi||gi(),dispatchEvent(new CustomEvent("advertory:closeTakeover",{})))),i!==si&&i!==ai||!r||An(r),i===di&&r&&a&&qn(r,a),i===li&&r&&(An(r),ri(l.get(),{targetId:r})),"resizeMediationAd"===i&&r&&d&&qn(r,d,!0),i===ci&&o&&(e=>{const t=document.querySelector(`.${Tn}`);t&&(t.style.backgroundImage=`url(${e})`)})(o),i===ui&&s&&(e=>{const t=document.querySelector(`.${Tn}`);t&&(t.style.backgroundColor=e)})(s)},yi=e=>({rootMargin:`${e}px 0px ${e}px 0px`}),fi=()=>{const{publisher:t,country:n,finnBlink:i}=l.get(),{loadFinnBlinkAd:r,wallpaperHandlers:{adjustAdToHorseshoe:o}}=l.getHandlers(),s=window.apntag,a={publisher:t,country:n,finnBlink:i},d=e=>{kn(e),mn(()=>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,()=>{jt.getData("horseshoe").isAvailable&&o(t)})})}},wi=(e,t,n)=>{const i="true"===n.dataset.isFinnBlinkOnlyPlacement;return xe(t)&&i?(v(`loading finn blink ad for blink only placement for ${t}`),void fi().withFinnBlinkAd(t)):xe(t)?(v(`loading finn blink ad with full ads chain for ${t}`),void fi().withFullAdsChain(t)):void mn(()=>(v("core showTag",{id:t}),e.showTag(t)))},bi=(t,n)=>e(void 0,void 0,void 0,function*(){yield yn,yield fn;const e=new IntersectionObserver((e,n)=>((e,t,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);v("core log from intersection observer handler",{targetId:o,element:s}),n(window.apntag,o,i),s&&(t.unobserve(s),t.disconnect())})})(e,n,wi,t),yi(n));e.observe(t)}),Ei=new Map,Ti=["no-stavangeraftenblad","sa","no-aftenposten","aftenposten","no-bergenstidende","bt"],Ii=".brandstudio-premium-content-widget",Si=({adWrapper:e,placementContainer:t})=>t.offsetHeight+(({adWrapper:e})=>{const{paddingTop:t,paddingBottom:n}=getComputedStyle(e);return parseFloat(t)+parseFloat(n)})({adWrapper:e}),Ai=({adWrapper:e,placementContainer:t})=>{const n=Si({adWrapper:e,placementContainer:t});var i;null==e||e.style.setProperty("height",`${n}px`),On(i=t),i.innerHTML=""},ki=e=>{e&&e.style.getPropertyValue("height")&&e.style.removeProperty("height")},Ci=({adWrapper:e,placementContainer:t})=>{const{publisher:n}=l.get(),i=Ti.includes(n)&&Boolean(t.closest(Ii));const r=i?t.closest(Ii):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 ki(e),void o.disconnect();const a=t.closest('[style*="height"]'),d=r;a&&d.contains(a)?ki(a):d.hasAttribute("style")&&ki(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=Ei.get(t))&&void 0!==s?s:0,c=((e,t)=>!!t&&e+t<(new Date).getTime())(i,r)&&n<0;a-d>=r&&c&&(Ei.set(t,a),((e,t,n)=>{const{country:i}=l.get(),r=null==n?void 0:n.parentElement;r&&n&&Ai({adWrapper:r,placementContainer:n}),mn(()=>{e.setKeywords([t],{[`${K(i)}-adreload`]:"1"},{overrideKeyValue:!0}),e.refresh([t])})})(e,t,o))},Pi=(e,t,n)=>{const i=new IntersectionObserver((e,i)=>((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,t,n),yi(300));i.observe(e)},Li=(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},$i=()=>navigator&&navigator.userAgent.match(/chrome/i)?null:navigator&&navigator.userAgent.match(/apple/i),_i=(e,t=0)=>{const n=e.getBoundingClientRect(),i=window.innerHeight;return n.bottom>-t&&n.top<i+t},ji=e=>{const{refreshConfig:{visibilityStateRefreshEnabled:t=!1}={}}=l.get();if(!t)return;const n=()=>{"visible"===document.visibilityState&&document.removeEventListener("visibilitychange",n),Mi(e)};"visible"!==document.visibilityState&&document.addEventListener("visibilitychange",n)},xi=(e,t,n)=>{const i=document.querySelectorAll('[data-bf-cache-refresh="true"]');for(const r of i){const i=e.find(e=>{var t;return e.id===(null===(t=r.firstElementChild)||void 0===t?void 0:t.id)&&e.bfCacheRefresh}),o=null==i?void 0:i.threshold;_i(r,o)&&i&&(Cn(i.id),n.length&&r.classList.remove(...n),Mi([i],t))}},Ni=e=>{const{refreshConfig:{backForwardNavigationRefreshEnabled:t=!1}={},siteSpecificConfig:{classesToRemoveOnRefresh:n=[]}={},isMobileApp:i}=l.get();t&&(e.forEach(({id:e})=>{const t=qi(e);t&&(t.dataset.bfCacheRefresh="true")}),i?((e,t)=>{document.addEventListener("visibilitychange",()=>{"visible"===document.visibilityState&&xi(e,!0,t)})})(e,n):((e,t)=>{window.addEventListener("pageshow",n=>{const i=()=>{window.scrollY>0&&(window.removeEventListener("scroll",i),xi(e,!1,t))};n.persisted&&($i()?window.addEventListener("scroll",i,{passive:!0}):xi(e,!1,t))})})(e,n))},qi=e=>{var t,n;return null!==(n=null===(t=document.querySelector(`#${e}`))||void 0===t?void 0:t.parentElement)&&void 0!==n?n:null},Di=e=>{const{id:t,allowedFormats:n}=e,i=(e=>{if(!e)return[];try{return JSON.parse(e.dataset.adSizes||"[]")}catch(e){return[]}})(qi(t)),r=(e=>1===e[0]&&1===e[1])(i),o={sizes:[i],allowedFormats:r?n:n.filter(e=>"native"!==e),allowSmallerSizes:!1};return r||(o.native=void 0),o},Mi=(e,t=!1)=>{const{requestSize:n=a}=l.get(),i=e.map(({id:e})=>e),r=Li(i,n);if(t)for(const t of e){const e=Di(t);window.apntag.modifyTag(t.id,e)}for(const e of r)mn(()=>window.apntag.refresh(e))};const Ri="#fff",Bi="#0098da",Fi="splash",Ui="welcomePage",Vi="topscroller",Hi="velvet",zi="takeover-displayed",Wi="takeover-visit-count",Ki=14400,Gi=()=>{const e=T(Wi);return e?parseInt(e):0},Yi=()=>{const{takeover:{enabled:e=!1,secondVisitEnabled:t=!1}={}}=l.get();return"0"!==p(g)&&("1"===p(g)||!(!e||(()=>{var e;const t=(null===(e=l.get().takeover)||void 0===e?void 0:e.cookieCapName)||zi;return"true"===T(t)})())&&(!t||Ji()))},Ji=()=>{const e=Gi();return 0===e?((()=>{const e=Gi(),{takeover:{cookieCapTime:t=Ki}={}}=l.get(),n=document.location.hostname;window.document.cookie=`${Wi}=${e+1}; max-age=${t}; domain=${n}; path=/; SameSite=Lax`})(),!1):1===e},Qi=(e,t)=>[[1,1],[1920,1080]].some(([n,i])=>n===e&&i===t),Xi=()=>{const{takeover:e}=l.get();return Boolean(null==e?void 0:e.topscroller)},Zi=()=>e(void 0,void 0,void 0,function*(){const e=document.location.hostname,{takeover:{cookieCapName:t=zi,cookieCapTime:n=Ki}={},isMobileApp:i,tcf:r,country:o}=l.get(),s=yield E(r,i,o,"ad-takeover-cookiecap");n&&s&&(window.document.cookie=`${t}=true; max-age=${n}; domain=${e}; path=/`)}),er=e=>{var t;const n=!!(null===(t=l.get().takeover)||void 0===t?void 0:t.setCookieCapForNotShownAd);return Pe(e)&&n},tr=(e,t)=>{var n;if(t===Vi){const{topscroller:t}=e;return null!=t?t:{}}if(t===Fi){const{splash:t}=e;return null!=t?t:{}}return null!==(n=e.welcomePage)&&void 0!==n?n:{}},nr=(e,t)=>{t!==Fi?(e=>{var t,n,i;const r=null===(n=null===(t=l.get().takeover)||void 0===t?void 0:t.welcomePage)||void 0===n?void 0:n.headerElementSelector,o=null===(i=l.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}`),c=document.querySelector(".advertory-welcome-page-scroll");if(!(s&&a&&c&&d))return;const u=null==s?void 0:s.offsetHeight,v=Le(e)?"60svh":`calc(100svh - ${u}px)`,p=Le(e)?"calc(40svh + 30px)":`calc(${u}px + 30px)`;a.style.setProperty("height",v,"important"),d.style.setProperty("height",v,"important"),c.style.setProperty("bottom",p,"important")})(e):(e=>{var t;if(!(null===(t=l.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)},ir=Ht([],()=>{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})}),rr=(e,t=!0)=>{(e===Ui||e===Vi)&&(e=>{e?setTimeout(()=>window.scrollTo(0,0),100):window.scrollTo(0,10)})(t)},or=()=>{const e=parseInt(document.body.dataset.scrollY||"0",10);document.body.style.top="",window.scrollTo(0,e),document.body.classList.remove("page-locked")},sr=e=>{document.body.style.overflow=e?"initial":"hidden"},ar=e=>{const t=lr(e),n=dr(e);(e=>{e.classList.toggle("takeover-ad-hidden",!0)})(e),sr(!0),e.style.display="none",window.removeEventListener("keydown",t),window.removeEventListener("advertory:closeTakeover",n)},dr=e=>{const t=()=>ar(e);return window.addEventListener("advertory:closeTakeover",t),or(),t},lr=e=>{const t=t=>{["Enter","Escape"].includes(t.key)&&ar(e)};return or(),window.addEventListener("keydown",t),t},cr=e=>{const t=e.querySelector(".advertory-splash-navbar-wrapper");t&&(lr(e),dr(e),or(),t.addEventListener("click",()=>{ar(e)}),sr(!1))},ur=e=>{(e=>{window.addEventListener("scroll",()=>{e.getBoundingClientRect().bottom,(e=>{const t=e.getBoundingClientRect().bottom;e.style.opacity=""+t/e.offsetHeight})(e)},{passive:!0})})(e),dr(e);const t=document.querySelector("header");document.querySelectorAll(".smooth-close-takeover").forEach(e=>e.addEventListener("click",()=>null==t?void 0:t.scrollIntoView({behavior:"smooth"})))},vr=e=>{(e=>{window.addEventListener("advertory:closeTakeover",()=>ar(e))})(e)},pr=e=>{const{takeover:{splash:{showAnnonsLabel:t=!1}={}}={}}=l.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=rt.se.adText),e.classList.toggle("advertory-splash-wrapper",!0)},gr=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=rt.no.adText,n.classList.add("takeover-topscroller-label"),e.classList.toggle("topscroller-wrapper",!0))},hr=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=rt.se.adText,e.classList.toggle("welcome-page-wrapper",!0))},mr=e=>{const t=document.querySelector(".advertory-takeover-label");t&&(t.style.display="flex",t.innerText=rt.se.adText,e.classList.toggle("advertory-impact-wrapper",!0))},yr=()=>{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)},fr=(e,t)=>{let n=e;return e.includes("529299503")&&(n=(e=>{const t=document.createElement("script");return t.textContent=`(${ir})()`,e+t.outerHTML})(e)),n},wr=e=>{const t=(e=>{var t;const{requests:n}=window.apntag,i=Vt(e)?1:0;return null===(t=null==n?void 0:n.tags[e].adResponse.ads[i].rtb)||void 0===t?void 0:t.banner.content})(e);if(!t)return;((e,t)=>{const{requests:n}=window.apntag,i=Vt(e)?1:0,r=null==n?void 0:n.tags[e].adResponse.ads[i].rtb;r&&(r.banner.content=t)})(e,fr(t))},br=t=>e(void 0,void 0,void 0,function*(){const{takeover:e}=l.get(),{targetId:n}=t,i=document.querySelector(`#${n}`),r=document.querySelector(".advertory-takeover-wrapper");if(!i||!r||!e)return;const o=(e=>{const{width:t,height:n}=e;return Qi(t,n)?Fi:Ue(e,Ee)?Hi:Xi()?Vi:Ui})(t),s=r.offsetHeight,a=window.scrollY>s;r.style.display="block",!a&&rr(o,!1),((e,t)=>{({[Ui]:hr,[Fi]:pr,[Vi]:gr,[Hi]:mr})[t](e)})(r,o),yr(),((e,t)=>{({[Ui]:ur,[Vi]:ur,[Fi]:cr,[Hi]:vr})[t](e)})(r,o),((e,t,n)=>{if(!n)return;({[Ui]:()=>{const{buttonLabel:i}=tr(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:"")})},[Fi]:()=>{const{themeColors:i,logotype:r,buttonLabel:o,showArrowIcon:s}=tr(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:Ri,"important"),n.style.color=null!=t?t:Bi}}})},[Vi]:()=>{const{buttonLabel:i,showArrowIcon:r,showCloseButton:o=!0}=tr(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:""))})},[Hi]:()=>{}})[t]()})(r,o,e),yield Zi(),!a&&rr(o,!0),nr(t,o)}),Er="advertory-brandmetrics-survey",Tr=()=>e(void 0,void 0,void 0,function*(){const{norstat:{enabled:t}={},country:n,isMobileApp:i,tcf:r}=l.get(),o=yield E(r,i,n,"norstat");if(!t||i||!o)return;const s=(e=>{const{ppid1:t,ppid2:n}=de.getPPIDs(),{ppid1:i,ppid2:r}=le.getPPIDs(),o=(new ae).add(n,ee[e]).add(t,te[e]).add(r,ne[e]).add(i,ie[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===u.NO?"schibsted":"schibstedse"}/map/${s}`,"norstat")}),Ir={nativeAd:e=>Ce(e)&&!je(e),buyrecipe:e=>e.targetId.startsWith("buyrecipe"),fullwidthAd:Oe,fullscreenScroll:ke,topscroller:e=>Pe(e)&&Xi(),splash:e=>Pe(e)&&Qi(e.width,e.height),welcomePage:Pe,wallpaper:$e,skyscraper:e=>e.targetId.includes("skyscraper")&&!!e.banner,lFormat:Re,hFormat:Be,toppanorama:e=>e.targetId.startsWith("toppanorama")&&!Be(e)&&!Re(e),topboard:e=>e.targetId.startsWith("topboard")&&!Pe(e),widescreen:De,insider:e=>e.targetId.startsWith("insider"),sponsorstripe:je,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)&&!qe(e),outstream:Me,netboard:e=>(e=>e.targetId.startsWith("netboard"))(e)||(e=>e.targetId.startsWith("board"))(e),panorama:Ne,midboard:qe},Sr=({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(Ir))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)},Ar=e=>{var t;return(null===(t=Object.entries(Ir).find(([,t])=>t(e)))||void 0===t?void 0:t[0])||""},kr=(e,t)=>{const n=e.width,i=(null!=t?t:window.screen.width)/n;return i<1?i:1},Cr=new Map;Cr.set("insider",{scale:.82,transformOrigin:"left center",cogwheelAdjust:!0}),Cr.set("panorama",{scale:.79,transformOrigin:"center center"}),Cr.set("outstream",{scale:.79,transformOrigin:"center center"}),Cr.set("integration",{scale:.79,transformOrigin:"center center"}),Cr.set("toppanorama",{scale:.8,transformOrigin:"left center"});const Or=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=Ar(e),r=Cr.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")},Pr=e=>{var t,n,i,r,o,s;const{adScaleConfig:a,deviceType:d}=l.get();if(!(null==a?void 0:a.enabled))return;if(Ue(e,ye))return;const c=null!==(t=a.adsToBeScaled[d])&&void 0!==t?t:[],u=$n(e.targetId.split("-")[0]);if(!c.includes(u))return;const v=null!==(i=null===(n=a.offset)||void 0===n?void 0:n[u])&&void 0!==i?i:0,p=document.getElementById(e.targetId),g=null!==(r=null==p?void 0:p.offsetWidth)&&void 0!==r?r:window.screen.width,h=null!==(s=null===(o=null==p?void 0:p.parentElement)||void 0===o?void 0:o.offsetWidth)&&void 0!==s?s:window.screen.width;((e,t=window.screen.width)=>{const n=kr(e,t),i=document.querySelector(`iframe[id^="utif_${e.targetId}"]`);i&&(i.style.transform=`scale(${n})`,i.style.transformOrigin="left top")})(e,(g<h?g:h)-v)},Lr=(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,$r=e=>`externalImpId:'${e}'`,_r=e=>{var t;const{forwardExternalImpId:n=!1,tracker:i}=l.get(),r=(e=>{var t;if(!e.positionConfig)return e;const n=e.keywords[`${G()}-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),{id:o,sizes:s,keywords:a,allowedFormats:d,invCode:c,ssa:u=!1,nativeCustomProperties:p,safeframeConfig:g,dynamicSizeWidthCheck:h=!1}=(e=>{var t;if(!e.takeoverCookieCapForSharedPlacement||Yi())return e;const n=null===(t=e.keywords)||void 0===t?void 0:t["no-sno-adformat"],i=null==n?void 0:n.filter(e=>e!==Vi),r=Object.assign(Object.assign({},e.keywords),n&&{"no-sno-adformat":i}),o=e.sizes.filter(([e,t])=>4!==e||4!==t);return Object.assign(Object.assign({},e),{sizes:o,keywords:r})})(r),m=Object.assign({invCode:c,sizes:s,targetId:o,keywords:Lr(a,u),allowedFormats:d,dynamicSizeWidthCheck:h},g&&{safeframeConfig:g}),y=(e=>{var t,n,i,r,o,s,a;return e?(null===(t=null==e?void 0:e.instance)||void 0===t?void 0:t.state)?(null===(i=null===(n=null==e?void 0:e.instance)||void 0===n?void 0:n.state)||void 0===i?void 0:i.pageViewId)?(v("Tracker state pageViewId is:",null===(o=null===(r=null==e?void 0:e.instance)||void 0===r?void 0:r.state)||void 0===o?void 0:o.pageViewId),null===(a=null===(s=null==e?void 0:e.instance)||void 0===s?void 0:s.state)||void 0===a?void 0:a.pageViewId):(v("Tracker state does not contain field pageViewId or it is empty"),""):(v("Tracker state is empty"),""):(v("Tracker is not configured in initAdvertory function"),"")})(i);n&&y&&(v("External Impression ID assigned to defineTag:",$r(y)),m.externalImpId=$r(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},customIcon1:{required:!1},customIcon2:{required:!1},customDisplayUrl1:{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}}))(p);return(null===(t=e.allowedFormats)||void 0===t?void 0:t.includes("native"))&&(m.native=f),m},jr=e=>!e.includes("takeover")||Yi(),xr=e=>{const{source:t}=e;return"csm"===t},Nr=e=>{if(!e)return e;const{country:t}=l.get(),n=K(t),i=e[`${n}-targetid`],r=i?En(i[0]):"";return Object.assign(Object.assign({},e),i&&{[`${n}-targetid`]:[r]})},qr=e=>{const{country:t}=l.get(),n=K(t);return Object.assign(Object.assign(Object.assign(Object.assign({},e),e[`${n}-geo`]&&{[`${n}-geo`]:["geo-test-value"]}),e[`${n}-geofence`]&&{[`${n}-geofence`]:["geofence-test-value"]}),e[`${n}-weather`]&&{[`${n}-weather`]:["weather-test-value"]})},Dr=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"})})()},Mr=(t,n)=>e(void 0,void 0,void 0,function*(){return yield new Promise(e=>{t().then(t=>{e(null!=t?t:null)}).catch(t=>{e(null)})})}),Rr={arrayMerge:(e,t)=>t},Br=t=>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))})(t))return t;try{const n=yield(t=>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})(t);if(!e)return null;const n=new AbortController,i=setTimeout(()=>n.abort(),5e3);try{return yield X.get(e,{method:"GET",signal:n.signal})}catch(t){throw v("Failed to fetch S3 config",{error:t,url:e}),t}finally{clearTimeout(i)}}))(t);return n?(({siteConfig:e,configOverrides:t})=>{var n;const{keywords:i,refresh:o,placements:s,threshold:a,batchSize:d}=t,l=r.all([e.placements,s],Rr),c=r(e.pageOptions,{keywords:i},Rr),u=r(e.appearanceConfig,{defaultThreshold:a},Rr),v=r(null!==(n=e.refreshConfig)&&void 0!==n?n:{},{scrollRefreshEnabled:o},Rr);return Object.assign(Object.assign({},e),{placements:l,requestSize:null!=d?d:e.requestSize,pageOptions:c,appearanceConfig:u,refreshConfig:v})})({siteConfig:t,configOverrides:n}):t}catch(e){return v("Error fetching S3 config, using site config",{error:e}),t}}),Fr=".advertory-right-column-track",Ur="--advertory-right-column-track-height",Vr=e=>e.getBoundingClientRect().top+window.scrollY,Hr=e=>{const{marginTop:t,marginBottom:n}=getComputedStyle(e);return e.getBoundingClientRect().height+parseFloat(t||"0")+parseFloat(n||"0")},zr=(e,t)=>{const n=(i=t,`${Math.max(0,Math.round(i))}px`);var i;document.body.style.setProperty(e,n)},Wr=(e,t)=>`${e}-${t}`,Kr=(e,t,n)=>{var i;const r=Array.from(null!==(i=e.querySelectorAll(t))&&void 0!==i?i:[]),o=(e=>e.map(e=>{var t;return null===(t=document.querySelector(`[id^="${e}"]`))||void 0===t?void 0:t.parentElement}).map((e,t)=>({point:e,originalIndex:t})).filter(e=>Boolean(e.point)))(n);if(0===o.length)return;const s=Vr(e);(()=>{const e=document.querySelector("header");if(!e)return;const t=Hr(e);zr("--advertory-newsroom-header-height",t)})(),o.forEach(({point:e,originalIndex:t})=>{((e,t,n)=>{const i=Vr(e),r=Wr(Ur,t),o=i-n,s=Wr("--advertory-right-column-split-point-height",t),a=Hr(e);zr(r,o),zr(s,a)})(e,t+1,s),(e=>{const t=null==e?void 0:e.id;if(!t)return;const n=Wr("--advertory-right-column-ad-height",t),i=Hr(e);zr(n,i)})(r[t])});((e,t)=>{const n=Vr(e);zr(Ur,n-t)})(o[Math.min(r.length,o.length-1)].point,s)};let Gr=!1;class Yr{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 Jr{getPulseObjectId(){return""}getPulsePageId(e,t){return""}}class Qr{constructor(e,t){this.pulse=e,this.newsroomStrategy=t}getEventInput(e,t){return{}}parseKilkayaData(e){const t=e.querySelector("article");if(!t)return{};const n=t.dataset.k5aTeaserAnalytics;try{return n?JSON.parse(n):{}}catch(e){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()||""}getEventTarget(e){const{url:t,title:n,itemId:i}=this.parseKilkayaData(e);return{id:i,name:this.normalizePlacementTitle(null!=n?n:""),type:"Page",url:t}}normalizePlacementTitle(e){return e.replace(/<[^>]+>/gi,"").replace(/[^a-z0-9æøå\s_-]/gi,"")}trackContentView(t){return e(this,void 0,void 0,function*(){var e,n,i,r,o,s,a,d,l;const c=new CustomEvent("advertory:partnerstudioAdImpression",{detail:{ad:null===(e=this.parseKilkayaData(t))||void 0===e?void 0:e.placement}});if(window.dispatchEvent(c),!this.pulse)return;const u=this.getEventInput(t,"view");(null===(n=this.pulse)||void 0===n?void 0:n.trackLegacyViewUIElement)?null===(r=null===(i=this.pulse)||void 0===i?void 0:i.trackLegacyViewUIElement)||void 0===r||r.call(i,u):(null===(o=this.pulse)||void 0===o?void 0:o.trackViewUIElement)?null===(a=null===(s=this.pulse)||void 0===s?void 0:s.trackViewUIElement)||void 0===a||a.call(s,u):null===(l=null===(d=this.pulse)||void 0===d?void 0:d.trackElementView)||void 0===l||l.call(d,u)})}trackContentClick(t){return e(this,void 0,void 0,function*(){var e,n,i,r,o,s;if(!this.pulse)return;const a=this.getEventInput(t,"click");this.pulse.trackLegacyClickUIElement?null===(n=(e=this.pulse).trackLegacyClickUIElement)||void 0===n||n.call(e,a):this.pulse.trackClickUIElement?null===(r=(i=this.pulse).trackClickUIElement)||void 0===r||r.call(i,a):null===(s=(o=this.pulse).trackElementClick)||void 0===s||s.call(o,a)})}}class Xr extends Qr{constructor(e,t,n){super(e,t),this.pulse=e,this.newsroomStrategy=t,this.pageType=n}getEventBaseData(e){var t,n,i,r,o,s;const{clientName:a,creativeId:d,itemId:l,placement:c}=this.parseKilkayaData(e),u=this.mapPageType(this.pageType),v=null===(t=this.newsroomStrategy)||void 0===t?void 0:t.getPulsePageId(this.pageType||"front",this.getArticleId());return{"@id":null!==(r=null===(i=null===(n=this.newsroomStrategy)||void 0===n?void 0:n.getPulseObjectId)||void 0===i?void 0:i.call(n))&&void 0!==r?r:c,"@type":"UIElement",position:c,elementType:"Article",custom:{customer:a,creativeId:null!=d?d:l},page:{"@id":null!=v?v:c,"@type":u,url:location.origin},tags:null===(s=null===(o=this.newsroomStrategy)||void 0===o?void 0:o.getTags)||void 0===s?void 0:s.call(o,e)}}getEventTarget(e){const{link:t,itemId:n,title:i}=this.parseKilkayaData(e);return{id:n,name:this.normalizePlacementTitle(null!=i?i:""),type:"Page",url:t}}getEventInput(e,t){return{object:this.getEventBaseData(e),partnerstudio:this.getEventPartnerstudioData(e,t),target:this.getEventTarget(e),provider:this.getProviderData()}}getEventPartnerstudioData(e,t){const n=this.parseKilkayaData(e);return Object.assign(Object.assign({},n),{type:t,tracking_type:"ad",xandrAdLoaded:!1})}getProviderData(){return{productTag:"partnerstudio"}}}const Zr="[data-k5a-teaser-analytics]",eo=(e,t,n)=>{const i=document.querySelectorAll("k5a-stream");if(!i.length)return;const r=new Xr(e,t,n),o=new WeakMap,s=e=>{const t=o.get(e);t&&(t.disconnect(),o.delete(e))},a=new IntersectionObserver((e,t)=>{e.forEach(e=>{if(!e.isIntersecting)return;const n=e.target,i=n.querySelector(Zr);Boolean(null==i?void 0:i.dataset.k5aTeaserAnalytics)?(r.trackContentView(n),t.unobserve(e.target),s(n)):((e,t)=>{if(o.has(e))return;const n=new MutationObserver(()=>{const n=e.querySelector(Zr);Boolean(null==n?void 0:n.dataset.k5aTeaserAnalytics)&&(r.trackContentView(e),t.unobserve(e),s(e))});n.observe(e,{attributes:!0,childList:!0,subtree:!0,attributeFilter:["data-k5a-teaser-analytics"]}),o.set(e,n)})(n,t)})},{threshold:.5});i.forEach(e=>{a.observe(e),e.addEventListener("click",()=>r.trackContentClick(e))})};class to{handleKilkayaStreamTracking({pulse:e,pageType:t,publisher:n}){if(!(null==e?void 0:e.instance))return;const i={[nt.VG]:new Yr}[n]||new Jr;eo(e.instance,i,t)}injectKilkayaMeta(e){const t=document.createElement("script");t.textContent=`var k5aMeta = { consent: ${e} };`,document.head.appendChild(t)}observeForKilkayaBackfills(){document.addEventListener("K5A:EmptyStreamSlot",e=>{var t;const n=null===(t=null==e?void 0:e.detail)||void 0===t?void 0:t.streamSlot;if(!n)return;const i=n.parentElement;i&&(v(`Kilkaya placement ${n.getAttribute("name")} has not been loaded, loading Xandr backfill`),this.showBackfill(i))})}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:"";kn(i)}loadKilkayaScript(t){return e(this,void 0,void 0,function*(){yield Dt(t)})}run(t){return e(this,void 0,void 0,function*(){const{tcf:e,isMobileApp:n,country:i,kilkaya:r}=t;if(!(null==r?void 0:r.enabled))return;const o=yield E(e,n,i,"kilkaya");o&&(this.observeForKilkayaBackfills(),this.injectKilkayaMeta(o),yield this.loadKilkayaScript(r.url),this.handleKilkayaStreamTracking(t))})}}const no=1e4,io=e=>e.some(e=>e.some(e=>!!e&&_i(e,0)));let ro;const oo=()=>{const{widescreenSwitching:e}=l.get(),{enabled:t,rotationInterval:n=no,widescreenIdPrefix:i}=null!=e?e:{};if(!t)return;const r=((e="widescreen")=>{const{pageSectionsSelectors:{right:t}={}}=l.get();return t?Array.from(document.querySelectorAll(t)).map(t=>Array.from(t.querySelectorAll(`div[id^="${e}"]`))):[]})(i);let o=0,s=Date.now(),a=io(r);if(!r.length)return;ro&&window.removeEventListener("scroll",ro);const d=(e,t,n)=>{e.forEach(e=>{e&&e.style.setProperty(t,n)})},c=e=>1===e?0:1;(e=>{e.forEach(e=>{e[0]&&(e[0].style.display="block",e[0].style.opacity="1"),e[1]&&(e[1].style.display="none",e[1].style.opacity="")})})(r);const u=((e,t)=>{let n=null;return(...i)=>{null===n&&(e(...i),n=setTimeout(()=>{n=null},t))}})(()=>{a||(a=io(r)||a,s=Date.now());Date.now()-s>=n&&((()=>{const e=c(o),t=r.map(e=>e[o]),n=r.map(t=>t[e]);d(t,"opacity","0"),setTimeout(()=>{d(t,"display","none"),d(n,"opacity","0"),d(n,"display","block"),setTimeout(()=>{d(n,"opacity","1")},450)},450)})(),o=c(o),s=Date.now())},1e3);ro=u,window.addEventListener("scroll",u)},so=e=>document.querySelector(`#${e}`);let ao,lo=[];const co=["takeover","wallpaper"],uo=e=>{const t=(e=>{const t=jt.getData("alertoryConfigKeywords"),{queryConfig:n,placements:i,tcf:r,glimr:o,appearanceConfig:s,requestSize:d=a,publisher:l,country:c,pageType:u,deviceType:v,isMobileApp:p=!1,pageOptions:{member:g},takeover:h,fullscreenScroll:m,useAppTabletInvCode:y}=e;return{xandr:{member:g,keywords:t,tags:[]},advertory:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({publisher:l,country:c,pageType:u,deviceType:v,placements:i,tcf:r,requestSize:d,isMobileApp:p,useAppTabletInvCode:y},o&&{glimr:o}),n&&{queryConfig:n}),s&&{appearanceConfig:s}),h&&{takeover:h}),m&&{fullscreenScroll:m})}})(e);window.advertory={initialized:!0,siteConfig:e,alertoryConfig:t}},vo=()=>e(void 0,void 0,void 0,function*(){const{pageOptions:t}=l.get(),{preparePageOptions:n}=l.getHandlers(),i=(()=>{const{sandboxAdIframeEnabled:e=!0}=l.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"]}})(),r=yield e(void 0,void 0,void 0,function*(){const{tcf:e,isMobileApp:t,country:n}=l.get();return(yield E(e,t,n,"page-options"))?{}:{userSync:{disabled:!0}}}),o=yield n(Object.assign(Object.assign(Object.assign({disablePsa:!0,enableSafeFrame:!0},t),{renderingManagement:Object.assign({},i)}),r));(e=>{const t=jt.getData("alertoryConfigKeywords");if(Object.keys(t).length)return;const n=qr(e);jt.setData("alertoryConfigKeywords",n)})(o.keywords),mn(()=>ao.setPageOpts(o))}),po=t=>e(void 0,void 0,void 0,function*(){const{prebid:e,tcf:n,isMobileApp:i,country:r}=l.get(),o=yield E(n,i,r,"loadPlacements"),s=((e,t)=>t?e:(e.filter(e=>!e.supportsNonRTB).forEach(e=>An(e.id)),e.filter(e=>e.supportsNonRTB).map(e=>{return Object.assign(Object.assign({},e),{invCode:(t=e.invCode,`${t}_non_rtb`)});var t})))(t,o);go(s);(null==e?void 0:e.enabled)&&o&&!ot()?(v("core loadPlacements prebid enabled"),yield un()):(v("core load tags invoked without prebid enabled"),ho(s))}),go=e=>{const{prepareTag:t}=l.getHandlers(),n=[];(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=>{v("core defineTags",{placement:e});const i=_r(e);if(jr(e.id)){const r=t(i),o=(e=>{const{allowedFormats:t,invCode:n,keywords:i,sizes:r}=e;return{adTypes:t,invCode:n,keywords:Nr(i),sizes:r}})(r);n.push(o),mn(()=>(v("core defineTag - add to the queue",{placement:e,preparedTag:r}),ao.defineTag(r)))}}),(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)})(n)},ho=e=>{const t=e.filter(({id:e})=>jr(e)).map(({id:e})=>e);t.length&&mn(()=>(v("core loadTags",{placementsIdsToLoad:t}),ao.loadTags([...t])))},mo=(t,n)=>e(void 0,void 0,void 0,function*(){const{appearanceConfig:e,deviceType:i}=l.get(),{threshold:r,refresh:o}=t,s=(e=>{const t=document.querySelector(`[data-show-tag-subscribe-id=${e.targetId}]`),n=document.querySelector(`#${e.targetId}`);return t||n})(n),a=null==e?void 0:e.defaultThreshold[i];s&&(v("core showAd - subscribe for show tag with thresholds",{placement:t,adObj:n,threshold:r,deviceDefaultThreshold:a}),yield bi(s,null!=r?r:a)),s&&o&&(v("core showAd - setup refreshing",{placement:t,adObj:n}),s.dataset.refresh=o.toString())}),yo=e=>e.some(({id:e})=>co.some(t=>e.includes(t))),fo=t=>e(void 0,void 0,void 0,function*(){var n;if(!(null===(n=null===window||void 0===window?void 0:window.advertory)||void 0===n?void 0:n.initialized))return;const[i,r]=(e=>e.reduce(([e,t],n)=>{var i;return(null===(i=null==n?void 0:n.finnBlink)||void 0===i?void 0:i.loadOnlyFinnBlink)?[[...e,n],t]:[e,[...t,n]]},[[],[]]))(t),o=(e=>{const{requestSize:t=a,queryConfig:{placementBatches:n}={},deviceType:i}=l.get(),r=Nn(e),o=Object.keys((null==n?void 0:n[i])||{}).map(e=>r[e]||[]).filter(e=>e.length>0),s=new Set(o.flat().map(({id:e})=>e)),d=e.filter(({id:e})=>!s.has(e));return[...o,...Li(d,t)]})(r);for(const e of o)yo(e)?(v("core loadAds without lazy loading",{placementsToLoad:e}),yield po(e)):e.length&&(v("core loadAds with lazy loading",{placementsToLoad:e}),yield wo(e));yield(t=>e(void 0,void 0,void 0,function*(){if(!t.length)return;const{appearanceConfig:e,deviceType:n}=l.get(),i=null==e?void 0:e.defaultThreshold[n];for(const e of t){const{threshold:t,id:n}=e,r=so(n);r&&(yield bi(r,null!=t?t:i))}}))(i)}),wo=t=>e(void 0,void 0,void 0,function*(){const{queryConfig:{lazyLoadingV3:{enabled:e=!1,rootMargin:n="200% 0px"}={}}={}}=l.get(),i=[];if(!e)return v("lazy load is not enabled",{placements:t}),void(yield po(t));const r=new IntersectionObserver((e,n)=>{e.filter(({isIntersecting:e,target:{id:t}})=>e&&!t.includes("wallpaper")).forEach(e=>{v("lazy load is enabled - handler start",{loadedPlacementIds:i,placements:t});const r=t.every(e=>i.includes(e.id)),o=t.map(e=>e.id);!r&&i.push(...o),!r&&po(t),v("lazy load is enabled - handler stop",{loadedPlacementIds:i,placements:t,arePlacementsLoaded:r,placementIds:o}),n.disconnect()})},{rootMargin:n});t.forEach(e=>{const t=document.getElementById(e.id);t&&(v("lazy loading - observe element",{placementId:e.id,element:t}),r.observe(t))})}),bo=()=>e(void 0,void 0,void 0,function*(){const{siteEvents:t,initNativeAd:n,wallpaperHandlers:{initWallpaperAd:i,adjustAdToHorseshoe:r}}=l.getHandlers(),{wallpaper:o,fullscreenScroll:s}=l.get(),a=[];mn(()=>{ao.onEvent("adRequested",()=>{t.adRequested()}),ao.onEvent("adAvailable",r=>e(void 0,void 0,void 0,function*(){var e,a,d,c,u,p;v("core adAvailable start",{placementsAvailable:lo,adObj:r,isFullscreenScrollAd:ke(r),isFinnBlink:xe(r.targetId),isNativeAd:Ce(r),isMediation:xr(r),isTakeoverAd:Pe(r),isCollapseAd:_e(r),isWallpaperAd:$e(r)});const g=null===(d=null===(a=null===(e=null===window||void 0===window?void 0:window.apntag)||void 0===e?void 0:e.requests)||void 0===a?void 0:a.tags[r.targetId])||void 0===d?void 0:d.adResponse.ads;xr(r)&&g&&(null===(c=g[1])||void 0===c?void 0:c.rtb)&&(r.banner=null===(p=null===(u=g[1])||void 0===u?void 0:u.rtb)||void 0===p?void 0:p.banner),ke(r)&&dn(r),De(r)&&oo(),ke(r)&&!xe(r.targetId)&&an(r,s),!Ce(r)||xr(r)||xe(r.targetId)||n(r,l.get()),Pe(r)&&!_e(r)&&(wr(r.targetId),yield br(r)),$e(r)&&(i(()=>mn(()=>window.apntag.showTag(r.targetId)),o),jt.setData("wallpaper",{isAvailable:!0})),(e=>e.targetId.includes("skyscraperleft")&&!!e.banner)(r)&&jt.setData("horseshoe",{isAvailable:!0}),Sr({adObj:r}),(e=>{var t;const n=null==e?void 0:e.targetId;if(!n)return;const i=null===(t=document.querySelector(`#${n}`))||void 0===t?void 0:t.parentElement;i&&((e,t)=>{const{height:n,width:i,native:r}=e;r?t.dataset.adSizes="[1,1]":n&&i&&(t.dataset.adSizes=`[${i},${n}]`)})(e,i)})(r),t.adAvailable(r);const h=lo.find(({id:e})=>e===r.targetId);h&&(yield mo(h,r),lo=lo.filter(e=>e.id!==h.id)),v("core adAvailable stop",{placementsAvailable:lo,adObj:r,isFullscreenScrollAd:ke(r),isFinnBlink:xe(r.targetId),isNativeAd:Ce(r),isMediation:xr(r),isTakeoverAd:Pe(r),isCollapseAd:_e(r),isWallpaperAd:$e(r)})})),ao.onEvent("adLoaded",e=>{const{refreshConfig:i,appearanceConfig:o}=l.get(),s=document.getElementById(e.targetId);xe(e.targetId)&&(e=>{const{fullscreenScroll:t}=l.get(),{initNativeAd:n}=l.getHandlers();ke(e)&&an(e,t),Ce(e)&&n(e,l.get())})(e);a.includes(e.targetId)&&Ce(e)&&(n(e,l.get()),Sr({adObj:e})),!a.includes(e.targetId)&&xr(e)&&a.push(e.targetId),_e(e)&&An(e.targetId),Pe(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"]})})(ao,e.targetId),Oe(e)&&(e=>{const t=document.querySelector(`#${e.targetId}`),{siteSpecificConfig:{publisherClassName:n,fullWidthFormatClassName:i}={}}=l.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=>Ue(e,fe))(e)&&(e=>{var t;const n=document.querySelector(`#${e.targetId}`),i=null===(t=document.querySelector(`#${e.targetId}`))||void 0===t?void 0:t.parentElement,r=null==n?void 0:n.querySelector("iframe"),o=null==r?void 0:r.parentElement,{siteSpecificConfig:{publisherClassName:s,fullWidthFormatClassName:a}={}}=l.get();if(!(n&&r&&o&&i))return;i.classList.add(`advertory-${s}-${a}__vertical-full-width-ad-wrapper`);const d=window.innerWidth,c=Math.round(d/1080*1920);n.style.width="100%",n.style.height=`${c}px`,n.classList.add(`advertory-${s}-${a}__vertical-full-width-ad`);const u=kr(e,n.offsetWidth);o.style.transform=`scale(${u})`,o.style.transformOrigin="left top"})(e),((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;Ci({adWrapper:r,placementContainer:i});const{delayTime:o=1e3}=t,s=(new Date).getTime();i&&"true"!==i.dataset.subscribedForRefresh&&(i.dataset.subscribedForRefresh="true",i.dataset.refresh&&Pi(i,s,o))})(e,i),(null==o?void 0:o.clearProbableDimensionsEnabled)&&(e=>{const t=document.querySelector(`#${e}`);t&&(t.style.minWidth="",t.style.minHeight="")})(e.targetId);jt.getData("horseshoe").isAvailable&&r(e.targetId),Pr(e),t.adLoaded(e),ln(e.targetId),s&&(s.classList.add(cn),(e=>{var t,n;const{siteSpecificConfig:i}=l.get(),r=null!==(t=null==i?void 0:i.mainColumnWidth)&&void 0!==t?t:1/0;e.clientWidth>r&&(null===(n=e.parentElement)||void 0===n||n.setAttribute("data-two-column-ad-layout","true"))})(s)),Or(e),window.dispatchEvent(new CustomEvent("advertory:adLoaded",{detail:{targetId:e.targetId,adFormat:Ar(e)}}))}),ao.onEvent("adNoBid",n=>e(void 0,void 0,void 0,function*(){An(n.targetId),yield ri(l.get(),n),er(n)&&(yield Zi()),t.adNoBid(n)})),ao.onEvent("adError",(n,i)=>e(void 0,void 0,void 0,function*(){er(i)&&(yield Zi()),t.adError(n,i)})),ao.onEvent("adCollapse",()=>{t.adCollapse()}),ao.onEvent("adRequestFailure",n=>e(void 0,void 0,void 0,function*(){An(n.targetId),yield ri(l.get(),n),t.adRequestFailure(n)})),ao.onEvent("adBadRequest",n=>e(void 0,void 0,void 0,function*(){An(n.targetId),yield ri(l.get(),n),t.adBadRequest(n)})),ao.onEvent("adLoadedMediated",e=>t.adLoadedMediated(e)),ao.onEvent("adNoBidMediated",n=>e(void 0,void 0,void 0,function*(){yield ri(l.get(),n),t.adNoBidMediated(n)}))})}),Eo=(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 Pn(),[];r&&(Pn(),document.querySelectorAll('[data-advertory-ad-rendered="true"]').forEach(e=>{kn(e.id)})),c(null!=t?t:{}),yield vo();let a=jn(s);return o&&(a=a.filter(e=>xe(e.id))),a.length>0&&(lo=[...lo,...a.map(e=>Object.assign({},e))],ji(a),Ni(a),yield fo(a)),lo}),To=(t,n)=>e(void 0,void 0,void 0,function*(){var i;l.set(t),l.setHandlers(n),jt.initialize(),window.addEventListener("message",mi,!1),ao=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=ao,v("Apn tag is set up on window"),yield Promise.allSettled([e(void 0,void 0,void 0,function*(){const{tcf:e,isMobileApp:t,country:n}=l.get();(yield E(e,t,n,"xandr-endpoint"))||ao.setEndpoint("ib.adnxs-simple.com",!0)}),e(void 0,void 0,void 0,function*(){if(ot())return;const{prebid:e,tcf:t,isMobileApp:n,country:i}=l.get(),r=yield E(t,n,i,"prebid");(null==e?void 0:e.enabled)&&r&&(yield Dt(null==e?void 0:e.url))}),ce(t),e(void 0,void 0,void 0,function*(){const{astUrl:e}=l.get();yield Dt(null!=e?e:"https://adsdk.microsoft.com/ast/ast.js")}),e(void 0,void 0,void 0,function*(){const{gptUrl:e,tcf:t,isMobileApp:n,country:i}=l.get();(yield E(t,n,i,"gpt-endpoint"))&&(yield Dt(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,isMobileApp:i,country:r}=l.get(),{getConsentAsync:o}=b(n,0,r),s=yield o();if(e&&t&&s){if(yield Dt(t),document.querySelector(`.${Er}`))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(Er)})&&(t.disconnect(),window._brandmetrics=window._brandmetrics||[],window._brandmetrics.push({cmd:"_loadsurvey"}))}}).observe(document,{childList:!0,subtree:!0,attributes:!0})}}),U(),e(void 0,void 0,void 0,function*(){const{gdpr:{url:e,allowHidingAds:t=!0}={}}=l.get();t&&(window.gdpr=window.gdpr||{},window.gdpr.allowHidingAds=!0),yield Dt(null!=e?e:"https://cogwheel.inventory.schibsted.io/prod/latest/gdpr-bundle.js")})]),yield Tr(),v("Libraries have been loaded and trackers have been set"),yield(i=n.librariesToLoad,e(void 0,void 0,void 0,function*(){const e=i.map(e=>Dt(e));yield Promise.all(e)})),yield bo(),yield vo(),v("Page options have been set"),uo(t),v("Advertory is setup on window"),lo=jn(),ji(lo),Ni(lo),yield fo(lo),v("Ads has been loaded",lo),oi(t,lo),Dr(lo),yield n.replaceAdsWithFinnBlink(t.finnBlink),yield(t=>e(void 0,void 0,void 0,function*(){var e;if(!t.drEdition)return;if(!(yield E(t.tcf,t.isMobileApp,t.country,"handleDrEdition")))return;const n=yield Zn(),i=new ei(n);ti({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)}))(t),(e=>{if(!(null==e?void 0:e.enabled)||Gr)return;const{splitPointIDs:t,adSelector:n,trackSelector:i=Fr}=e,r=document.querySelector(i);if(!r)return;Gr=!0;const o=()=>{Kr(r,n,t)};o(),window.addEventListener("resize",o),window.addEventListener("orientationchange",o),window.addEventListener("load",o),window.addEventListener("advertory:adLoaded",()=>{requestAnimationFrame(o)}),new ResizeObserver(o).observe(r)})(t.rightColumnSplit),yield(t=>e(void 0,void 0,void 0,function*(){const e=new to;yield e.run(t)}))(t)}),Io=(t,n)=>e(void 0,void 0,void 0,function*(){yield((t,n)=>e(void 0,void 0,void 0,function*(){const{initConsentManager:e,getConsentAsync:i}=b(t.tcf,t.isMobileApp,t.country),r=yield Br(t);yield ni(),yield Mr(e),yield Mr(i),v("TCF resolved successfully"),yield To(r,n),v("Run function resolved successfully")}))(t,n)}),So=()=>{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},Ao=e=>{const{siteSpecificConfig:t}=l.get(),n=(null==t?void 0:t.dynamicOutstreamFormats)||[];return 0!==n.length&&n.some(t=>e.includes(t))},ko={publisher:"aftonbladet",country:u.SE,memberId:9943,sectionKeyword:"se-aftonbladet-section",frontpageInvCodeTemplate:"se-aftonbladet-{deviceType}-front-{position}",additionalFilterKeys:["se-aftonbladet-navigation","se-aftonbladet-keyword_generator","se-aftonbladet-sponsor"],tcf:{enabled:!0,schibstedAdChoicesEnabled:!0,schibstedConsentToPayEnabled:!0},glimr:{enabled:!0,clientId:"OYGH3SXYFAQR78LVPNQD"}},Co={nyheter:"nyheter",sport:"sportbladet",noje:"nojesbladet",family:"family",matdryck:"matdryck",wellness:"wellness",minekonomi:"minekonomi",resa:"resa",harligthemma:"harligthemma"},Oo=e=>(null==e?void 0:e.parent)?[...Oo(e.parent),e.shortPath||"unknown"]:[],Po=(e,t)=>t?"se-aftonbladet-{deviceType}-studio_{position}":`se-aftonbladet-tv-{deviceType}-${(e=>{var t;if(null===(t=null==e?void 0:e.metadata)||void 0===t?void 0:t.afp)return"afp";const[,n]=Oo(e);return Co[n]||"ovrigaavdelningar"})(e)}_{position}`,Lo={aftonbladet:ko},$o={aftonbladet:(e,t)=>{if(!e)return null;return{invCode:Po(e,t),videoOverlayInvCode:"se-aftonbladet-{deviceType}-other-{position}",sections:Oo(e).join(":")}}},_o=e=>{var t;if(!Lo[e]){(e=>{console.warn("[Advertory WARN]: ",e)})(`[video] No config found for publisher "${e}"`)}return null!==(t=Lo[e])&&void 0!==t?t:ko},jo=e=>{switch(e){case"auto":return 1;case"silent":return 2;default:return 3}},xo=new Map([[1,"autoplay"],[2,"muted-autoplay"],[3,"click-to-play"]]),No="se-generic",qo="aa-sch",Do="kv_",Mo="pause",Ro="{deviceType}",Bo="{position}",Fo="afp_",Uo=new Set(Object.values({PREROLL:"preroll",BUMPER:"bumper",MIDROLL:"midroll"})),Vo="1-1",Ho="16-9",zo="3-4",Wo="9-16",Ko="responsive",Go={[Vo]:1,[Ho]:1.78,[Wo]:.56,[Ko]:1},Yo={[Vo]:1,[Ho]:1.78,[zo]:1.33,[Wo]:.56},Jo=(e,t,n,i)=>{const{invCode:r="",videoOverlayInvCode:o}=null!=e?e:{},s=S.DESKTOP===n?C:O,a=r.replace(Ro,s);return(e,n)=>{if(e===Mo)return(e=>e.replace("tv-","").replace("-afp_","-afp-").replace(Bo,Mo).replace(/-([a-z]+)_/,"-article-"))(a);if(n&&Uo.has(e)){return(i&&o?o:t.frontpageInvCodeTemplate).replace(Ro,s).replace(Bo,e)}return a.replace(Bo,e)}},Qo=(e,t)=>{const n=Object.entries(e);return n.reduce((n,[i,r])=>{const o=Math.abs(e[n]-t);return Math.abs(r-t)<o?i:n},n[0][0])},Xo=()=>{var e,t;const n=jwplayer().getContainer(),i=null!==(t=null===(e=document.getElementById(n.id))||void 0===e?void 0:e.parentElement)&&void 0!==t?t:null;return i&&"number"==typeof i.offsetWidth&&"number"==typeof i.offsetHeight&&0!==i.offsetHeight?i.offsetWidth/i.offsetHeight:1},Zo=()=>{return(e=>{try{return decodeURIComponent(e)}catch(e){return""}})("undefined"!=typeof document&&null!==(t=null===(e=document.cookie.match("(^|;)\\s*_pulse2data\\s*=\\s*([^;]+)"))||void 0===e?void 0:e.pop())&&void 0!==t?t:"").split(",");var e,t},es=()=>{const e=null!==(t=Zo()[9])&&void 0!==t?t:null;var t;const n=(()=>{var e;return null!==(e=Zo()[2])&&void 0!==e?e:null})();return e?Number(Boolean(e))+Number(Boolean(n)):0},ts=()=>Object.fromEntries(new URLSearchParams(window.location.search)),ns=(t,n)=>e(void 0,void 0,void 0,function*(){const{country:i,tcf:r,publisher:o}=n,{width:s,height:a}={width:window.innerWidth,height:window.innerHeight},d=(yield E(r,t.isApp,i,"video"))?"1":"0",l=yield e(void 0,void 0,void 0,function*(){return window.__tcfapi?{gdpr:1,gdpr_consent:yield(e=window.__tcfapi,new Promise((t,n)=>{e("addEventListener",2,(n,i)=>{var r;i||t(""),"tcloaded"!==n.eventStatus&&"useractioncomplete"!==n.eventStatus||(t(null!==(r=n.tcString)&&void 0!==r?r:""),e("removeEventListener",2,()=>{},n.listenerId))})}))}:{};var e}),c=yield pe(i),u=yield I({tcf:r,isMobileApp:t.isApp,country:i}),v=null!==(p=window.location.pathname.split("/").slice(-2,-1).pop())&&void 0!==p?p:"";var p;const g=((e=1)=>Qo(Yo,Number(e.toFixed(2))))(t.instreamAspectRatio),h=(m=t.playerAspectRatio)?Qo(Go,Number(m.toFixed(2))):Ko;var m,y;return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({[`${qo}-country_code`]:i,[`${qo}-publisher`]:o,[`${qo}-supply_type`]:(y=t.deviceType,y===S.DESKTOP?A:k),[`kw_${qo}-page_type`]:"collection",[`${qo}-page_type`]:"collection",[`${No}-appmode`]:t.isAndroidApp?"hybrid":"notinapp",[`kw_${No}-page`]:"index",[`${No}-page`]:"index",[`${No}-screenheight`]:String(window.screen.height),[`${No}-screenwidth`]:String(window.screen.width),[`${No}-viewportheight`]:String(a),[`${No}-viewportwidth`]:String(s),[`${No}-loggedin`]:t.isUserLoggedIn?"yes":"no",[`${No}-mobile-os`]:_(),[`${No}-audience`]:void 0,[`${No}-externalid_src`]:es(),[`${No}-tags`]:t.tags,[`${No}-articleid`]:v,"article-id":v},yield Y(Object.assign(Object.assign({},n),{isMobileApp:t.isApp}))),u&&{external_uid:u}),t.isUserPresentOnFrontPage&&t.isInitialVideo&&{[`${No}-tvtags`]:"vinjett"}),t.pageAdsKeywords),Object.keys(ts()).some(e=>e.includes(Do))&&(()=>{const e=ts(),t=Object.fromEntries(Object.entries(e).filter(([e])=>e.startsWith(Do)).map(([e,t])=>[e.slice(3),t]));return Object.keys(t).length>0?t:void 0})()),{[n.sectionKeyword]:t.sections.split(":"),"aa-sch-cmp_advertising":d,"kw_aa-sch-cmp_advertising":d,"aa-sch-instream_player_aspectratio":g,"aa-sch-player_aspectratio":h}),l),{eids:c})}),is=["se-generic-audience","se-generic-appversion","se-generic-sitemode","se-generic-pagegen","se-generic-viewportheight","se-generic-viewportwidth","se-generic-screenheight","se-generic-screenwidth","aa-sch-inventory_type"],rs=["aa-sch-publisher","se-generic-page","aa-sch-supply_type","se-generic-story","se-generic-section","se-generic-adformat","aa-sch-context_keyword","se-generic-tvtags","se-generic-test","aa-sch-cmp_advertising","aa-sch-instream_player_aspectratio","aa-sch-player_aspectratio"],os=["external_uid","gdpr","gdpr_consent","eids","article-id"],ss=(e,t)=>{const n=[...is,...t.additionalFilterKeys];return Object.fromEntries(Object.entries(e).filter(([e])=>!n.includes(e)).map(([e,t])=>[e.includes("kw")||os.includes(e)?e:`kw_${e}`,t]))},as=e=>Object.fromEntries(Object.entries(e).filter(([e])=>rs.includes(e))),ds=(t,n)=>e(void 0,void 0,void 0,function*(){var e,i,r,o;const s=_o(t.publisher),a=(e=>{var t;return null!==(t=$o[e])&&void 0!==t?t:$o.aftonbladet})(t.publisher)(t.assetSection,t.isLiveStudio),d="/"===window.location.pathname,l=null===(i=null===(e=n.attributes)||void 0===e?void 0:e.id)||void 0===i?void 0:i.toString(),c=t.assetId===l,u=null!==(r=Number(t.aspectRatio))&&void 0!==r?r:1,v=c?"preroll":"bumper";var p;return{siteConfig:s,siteVideoParams:a,isUserPresentOnFrontPage:d,adsKeywords:yield ns({pageAdsKeywords:t.pageAdsKeywords,tags:(p=t.tags,p?p.filter(e=>e.slug).map(({slug:e})=>e).join(","):""),sections:null!==(o=null==a?void 0:a.sections)&&void 0!==o?o:"",isUserLoggedIn:t.isUserLoggedIn,isUserPresentOnFrontPage:d,isInitialVideo:c,instreamAspectRatio:u,playerAspectRatio:Xo(),isApp:t.isApp,deviceType:t.deviceType,isAndroidApp:t.isAndroidApp},s),prerollPlacementFormat:v,playbackMethod:jo(t.startMode)}}),ls=(e,t)=>{const{siteConfig:n,siteVideoParams:i,isUserPresentOnFrontPage:r,adsKeywords:o,prerollPlacementFormat:s,playbackMethod:a}=e,{invCode:d}=i||{},l=Jo(i,n,t.deviceType,t.isUsedInOverlayVideoPlayer),c=((e="")=>t=>e.includes(Fo)?`${Fo}${t}`:t)(d),u=window.location.href;return{member:n.memberId,options:{autoplayMuted:!0,vpaidcontrols:!0},adSlots:{schedule:{preroll:{inv_code:l(s,r),"se-generic-playback-method":xo.get(a),"kw_se-generic-adformat":c(s)},midroll:{inv_code:l("midroll"),"kw_se-generic-adformat":c("midroll")},postroll:{inv_code:l("postroll"),"kw_se-generic-adformat":c("postroll")}},params:Object.assign(Object.assign(Object.assign({},ss(o,n)),as(o)),{vskippable:"0",referrer:u,vplaybackmethod:a})},adPlacements:{schedule:{pause:{invCode:l("pause"),sizes:[[825,424],[1280,720],[2,1]]}},params:{keywords:Object.assign(Object.assign({},o),{"se-generic-adformat":c("pause")})}}}},cs=t=>n=>e(void 0,void 0,void 0,function*(){const e=yield ds(t,n);return ls(e,t)}),us=((e,t)=>n=>Io(Object.assign(Object.assign({},n),{siteSpecificConfig:t}),e))({initNativeAd:(e,t)=>{const{targetId:n}=e,i=document.querySelector(`#${n}`);if(!i)return;const{pageType:r=mt.FRONT,deviceType:o,nativeTrackingConfig:s,appearanceConfig:a}=null!=t?t:{},d={language:u.SE,publisher:nt.AFTONBLADET,deviceType:o,pageType:r,nativeTrackingConfig:s,appearanceConfig:a};ht(e,d,Lt),et(e,null==t?void 0:t.sponsorstripe),Fe(e)&&$t(i)},wallpaperHandlers:{initWallpaperAd:hn,adjustAdToHorseshoe:hn},loadFinnBlinkAd:gn,replaceAdsWithFinnBlink:gn,preparePageOptions:he,prepareTag:e=>{const{keywords:t,targetId:n,invCode:i,dynamicSizeWidthCheck:r}=e,{useAppTabletInvCode:o=!0,country:s}=l.get(),a=((e,t)=>{const{isMobileApp:n}=l.get();return n?((e,t)=>e.replace(/wtb|wde|wph/g,e=>"wph"===e?"aph":t?"atb":e))(e,t):e})(i,o),d=(e=>{const{country:t}=l.get(),{keywords:n,dynamicSizeWidthCheck:i}=e,r=`${K(t)}-adformat`,o=n?n[r]:[];if(!o)return{};const s=(Array.isArray(o)?o:[o]).filter(e=>!(e in Ae)||window.innerWidth>=Ae[e]);return{[r]:i?s:o}})(e),c=(e=>{const{country:t}=l.get(),n=`${K(t)}-targetid`;return e?{[n]:[e]}:{}})(n),u=(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}})(a),v=So(),p={[`${K(s)}-adreload`]:"0"},g=(e=>Ao(e)?{"aa-sch-dynamic-outstream":["true"]}:{})(i),h=Object.assign({},((e,t)=>Ao(e)?Object.assign(Object.assign({},t),{playerSkin:{videoBackgroundColor:"#e6e7e8"}}):{})(i,{safeFrameAutoInitialSize:!0})),m=r&&e.sizes.length>0?e.sizes.filter(([e])=>e<=window.innerWidth):e.sizes;return Object.assign(Object.assign({},e),{sizes:m,invCode:a,keywords:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},t),d),c),u),p),g),v),rendererOptions:h})},siteEvents:tt,librariesToLoad:[]},it);var vs=Object.freeze({__proto__:null,default:""});export{cs as getAdsConfig,pe as getVideoPPIDs,us as initAdvertoryPackage,Eo 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 t(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var n,i;"function"==typeof SuppressedError&&SuppressedError;var r=t(function(){if(i)return n;i=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 r(e,t){return!1!==t.clone&&t.isMergeableObject(e)?l((n=e,Array.isArray(n)?[]:{}),e,t):e;var n}function o(e,t,n){return e.concat(t).map(function(e){return r(e,n)})}function s(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 a(e,t){try{return t in e}catch(e){return!1}}function d(e,t,n){var i={};return n.isMergeableObject(e)&&s(e).forEach(function(t){i[t]=r(e[t],n)}),s(t).forEach(function(o){(function(e,t){return a(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))})(e,o)||(a(e,o)&&n.isMergeableObject(t[o])?i[o]=function(e,t){if(!t.customMerge)return l;var n=t.customMerge(e);return"function"==typeof n?n:l}(o,n)(e[o],t[o],n):i[o]=r(t[o],n))}),i}function l(t,n,i){(i=i||{}).arrayMerge=i.arrayMerge||o,i.isMergeableObject=i.isMergeableObject||e,i.cloneUnlessOtherwiseSpecified=r;var s=Array.isArray(n);return s===Array.isArray(t)?s?i.arrayMerge(t,n,i):d(t,n,i):r(n,i)}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)},{})},n=l}());const o=["deviceType","pageType","placements","takeover","refreshConfig","editableConfiguration"],s={adRequested:()=>{},adAvailable:e=>{},adLoaded:e=>{},adNoBid:e=>{},adError:(e,t)=>{},adCollapse:()=>{},adRequestFailure:e=>{},adBadRequest:e=>{},adLoadedMediated:e=>{},adNoBidMediated:e=>{}},a=6;class d{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 o){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)),Object.prototype.hasOwnProperty.call(e,"tcf")&&void 0!==e.tcf&&(this.config.tcf=Object.assign(Object.assign({},this.config.tcf),e.tcf))}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=r(d.DEFAULT_SITE_HANDLERS,e)}}d.DEFAULT_SITE_HANDLERS={siteEvents:s,initNativeAd:function(){}};const l=new d,c=l.modifyConfigProperties.bind(l),u={NO:"no",SE:"se"},v=(e,t)=>{const n="[Advertory LOG]: ";location.search.includes("ast_debug=true")&&(t?console.log(n,e,t):console.log(n,e))},p=e=>new URLSearchParams(window.location.search).get(e),g="takeover",h="native_override_desc2",m=e=>new Promise(t=>{if(!window._tcf_||!(null==e?void 0:e.enabled))return void t(!1);const n=(()=>{if(!window._tcf_)return null;const e=window._tcf_.getPermissionSync("CMP:advertising");if(null===e)return null;const t=Number(e);return v("Advertising permission value obtained synchronously: ",e),Boolean(t)})();if(null!==n)return void t(n);let i=!1;const r=e=>{i||(v("Resolving advertising permission value obtained"),i=!0,t(e))},o=setTimeout(()=>{v("Advertising permission timed out, resolving with false"),r(!1)},3e3);window._tcf_.onTcfReady(()=>{v("On Tcf Ready called, waiting for permission"),clearTimeout(o)}),window._tcf_.getPermission("CMP:advertising",e=>{clearTimeout(o);const t=Number(e);v("Advertising permission value obtained asynchronously: ",e),r(Boolean(t))})}),y="cmp:loaded";let f="undefined"!=typeof window?window._tcf_:void 0,w=!1;const b=(t,n,i)=>{const r=!!(null==t?void 0:t.enabled),o=(null==t?void 0:t.timeout)||3e3,s=p("bypass_tcf"),a=()=>{if(!(null==t?void 0:t.enabled))return!0;if(((e,t)=>e?!!t&&(v("TCF bypass param detected, returning consent: true"),!0):(v("TCF is not enabled, returning consent: true"),!0))(r,s))return!0;if(w)return null;if(!f)throw new Error("[Advertory]: getConsentSync method was called before the tcfManager was available.");const e=f.getConsentedToAllSync();return v(`TCF consented to all is: ${e}`),f.getConsentedToAllSync()};return{initConsentManager:()=>(null==t?void 0:t.enabled)?new Promise((e,t)=>{if(v("Getting TCF consent manager..."),window._tcf_)return v("TCF consent manager is already available"),f=window._tcf_,void e(f);v("TCF consent manager is not available");const n=()=>{v("CMP loaded, resolving consent manager..."),i&&clearTimeout(i),window._tcf_?(f=window._tcf_,e(f)):t(new Error("CMP loaded but window._tcf_ is not defined"))},i=setTimeout(()=>{document.removeEventListener(y,n),w=!0,t(new Error("Timeout waiting for CMP to load"))},o);v("Listening for CMP loaded event..."),document.addEventListener(y,n,{once:!0})}):Promise.resolve(null),getConsentSync:a,getConsentAsync:()=>e(void 0,void 0,void 0,function*(){if(null==t?void 0:t.schibstedAdChoicesOverrideValue)return v(`Schibsted Ad Choices override value is set, returning override value: ${t.schibstedAdChoicesOverrideValue}`),Boolean(Number(t.schibstedAdChoicesOverrideValue));const e=(null==t?void 0:t.schibstedAdChoicesEnabled)&&i===u.SE,n=(null==t?void 0:t.schibstedAdChoicesEnabled)&&i===u.NO;if(e||n)return v("Schibsted Ad Choices is enabled, getting advertising permissions..."),yield m(t);if(!(null==t?void 0:t.enabled))return!0;const r=a();return null!==r?r:yield new Promise((e,t)=>{try{if(!f)throw new Error("[Advertory]: getConsentAsync method was called before the tcfManager was available.");let t=!1;const n=n=>{t||(t=!0,e(n))},i=setTimeout(()=>{v("TCF isConsentedToAll timed out, resolving with false"),n(!1)},o);f.onTcfReady(()=>{v("On Tcf Ready called, waiting for consent"),clearTimeout(i)}),f.isConsentedToAll(t=>{clearTimeout(i),e(t)})}catch(e){t(e)}})})}},E=(t,n,i,...r)=>e(void 0,[t,n,i,...r],void 0,function*(e,t,n,i="NOT SPECIFIED FEATURE"){if(!(null==e?void 0:e.schibstedConsentToPayEnabled))return v(`Schibsted Consent to Pay is not enabled, returning true for ${i}`),!0;if(null==e?void 0:e.schibstedAdChoicesOverrideValue)return v(`Schibsted Ad Choices override value is set, returning override value: ${null==e?void 0:e.schibstedAdChoicesOverrideValue} for ${i}`),Boolean(Number(null==e?void 0:e.schibstedAdChoicesOverrideValue));const{getConsentAsync:r}=b(e,0,n);return(yield r())?(v(`Schibsted Ad Choices consent given according to TCF consent manager for ${i}`),!0):(v(`Schibsted Ad Choices consent not given according to TCF consent manager for ${i}`),!1)}),T=e=>{const t=encodeURIComponent(e).replace(/[-.+*]/g,"\\$&"),n=new RegExp(`(?:(?:^|.*;)\\s*${t}\\s*\\=\\s*([^;]*).*$)|^.*$`);return decodeURIComponent(document.cookie.replace(n,"$1"))||null},S=t=>e(void 0,void 0,void 0,function*(){const{tcf:e,isMobileApp:n,country:i}=t,{getConsentAsync:r}=b(e,0,i);if(!(yield r()))return;const o=T("_pulse2data");return o?o.split(",")[9]:void 0}),I={MOBILE:"mobile",TABLET:"tablet",DESKTOP:"desktop"},A="web_desktop",k="web_phone",C="wde",O="wph",P=9826;class L{constructor(){this.getSupplyTypeKeywords=()=>{const{deviceType:e=I.DESKTOP,isMobileApp:t}=l.get();if(t){return{"aa-sch-supply_type":`app_${e===I.MOBILE?"phone":I.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()),yield this.getFormattedExternalIdKeywords()),this.getHasContextKeywords(t.keywords)),user:{externalUid:yield this.getExternalUid(),dnt:yield this.isTrackingForbidden()}})})}getFormattedExternalIdKeywords(){return e(this,void 0,void 0,function*(){const e=yield this.getExternalUid(),t=this.getUserId();return{"aa-sch-externalid_src":Number(!!e)+Number(!!t)}})}getUserId(){return(()=>{const e=T("_pulse2data");return e?e.split(",")[2]:void 0})()}getExternalUid(){return e(this,void 0,void 0,function*(){return yield S(l.get())})}isTrackingForbidden(){return e(this,void 0,void 0,function*(){return(null===navigator||void 0===navigator?void 0:navigator.globalPrivacyControl)||"1"===(null===navigator||void 0===navigator?void 0:navigator.doNotTrack)||"DO_NOT_TRACK"===(yield this.getExternalUid())})}getMember(){const{pageOptions:{member:e},testMember:t=P}=l.get();return"true"===p("inventory_test")?t:e}getCMPValue(e){return localStorage.getItem(`CMP:${e}`)?"0"===localStorage.getItem(`CMP:${e}`)?"0":"1":"0"}getPublisherKeywords(){const{publisher:e}=l.get();return{"aa-sch-publisher":`${e}`}}getAnalyticsConsentKeywords(){return{"aa-sch-cmp_analytics":this.getCMPValue("analytics")}}getAdvertisingConsentKeywords(){return e(this,void 0,void 0,function*(){const{tcf:e,isMobileApp:t,country:n}=l.get(),{getConsentAsync:i}=b(e,0,n);return{"aa-sch-cmp_advertising":(yield i())?"1":"0"}})}getPageTypeKeywords(){const{pageType:e}=l.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}=l.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 $=new L;$.prepare.bind($);const j=()=>{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"},x=e=>e===I.DESKTOP,_=e=>e===I.MOBILE;class N extends L{constructor(){super(...arguments),this.getDeviceKeywords=()=>{const{deviceType:e=I.DESKTOP}=l.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(){return e(this,void 0,void 0,function*(){const e=yield this.getExternalUid(),t=this.getUserId();return e?{"se-generic-externalid_src":Number(!!e)+Number(!!t)}:{"se-generic-externalid_src":0}})}getAppTypeKeywords(){const{isMobileApp:e}=l.get(),{appMode:t,mobileOS:n}=function(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=j();return{OS:r,mobileOS:["ios","android"].includes(r)?r:"unknown",isHybridApp:i.includes("hermes"),appMode:e?"hybrid":"notinapp"}}(e);return{"se-generic-appmode":t,"se-generic-mobileos":n}}getPublisherGroup(){return{"se-generic-publishergroup":"schibsted"}}getSectionPageTypeKeywords(){var e,t;const{pageOptions:n,pageType:i}=l.get();return{"se-generic-section-page_type":`${null!==(t=null===(e=n.keywords["se-generic-section"])||void 0===e?void 0:e.toString())&&void 0!==t?t:"ettan"}_${"article"===i?"article":"front"}`}}}const q=864e5,D=(()=>{const e=e=>{const t=window.localStorage.getItem(e);if(!t)return null;try{return JSON.parse(t)}catch(e){return v("Error with parsing localStorage data"),null}},t=(e,t)=>{window.localStorage.setItem(e,JSON.stringify(t))};return{get:e,set:t,setWithTimestamp:(e,n,i=q)=>{const r={data:n,expirationTime:(new Date).getTime()+i};t(e,JSON.stringify(r))},getByTimestamp:(t,n=q)=>{const i=e(t);if(!i)return null;if(!n)return i;try{const{expirationTime:e,data:t}=JSON.parse(i);return(new Date).getTime()<=e?t:null}catch(e){return v("Error with parsing localStorage data"),null}}}})(),M="glimrTags",R=["glwe_","glwet_"],B={geofenceTags:[],geoTags:[],weatherTags:[]},F=(...t)=>e(void 0,[...t],void 0,function*(e=l.get()){const{tcf:t,isMobileApp:n,country:i}=e;if(null==t?void 0:t.schibstedConsentToPayEnabled){return yield E(t,n,i,"glimr")}const{getConsentAsync:r}=b(t,0,i);return yield r()}),U=()=>e(void 0,void 0,void 0,function*(){const{glimr:t}=l.get();if(!(yield F())||!(null==t?void 0:t.enabled))return void v("No consent for glimr data fetching.");const n=yield(i=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),i))])}));var i;if(n)try{n.setTagCacheTimeInSeconds(300),yield new Promise(e=>{n.getTags(t.clientId,(t,n)=>{D.setWithTimestamp(M,{tags:t,tagMappings:n}),e(!0)})})}catch(e){v(`Error during getting glimr data: ${e}`)}else v("Timeout (500ms) while loading glimr package. Skipping glimr data fetching.",{glimr:n})}),V={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"},H=e=>R.some(t=>e.startsWith(t)),z=e=>e.startsWith("glgc_"),W=e=>!H(e)&&!z(e),K=e=>e===u.NO?"no-sno":"se-generic",G=()=>{const{country:e,publisher:t}=l.get();return`${e}-${t}`},Y=(t,n)=>e(void 0,void 0,void 0,function*(){const{addPublisherToGeo:e}={},{glimr:n,country:i}=t,r=yield F(t);if(!(null==n?void 0:n.enabled)||!r)return v("No consent for getting glimr tags."),{};const o=K(i),s=J(t,Boolean(e));return{[`${o}-geo`]:s.geoTags,[`${o}-weather`]:s.weatherTags,[`${o}-geofence`]:s.geofenceTags}}),J=(e,t)=>{const n=Q();if(!n)return B;const i=((e=[])=>e.filter(H))(n),r=((e=[])=>e.filter(z))(n),o=((e=[],t,n)=>{const i=e.filter(W);if(n&&t){const{publisher:e}=t,n=V[e]||e;i.push(n)}return i})(n,e,t);return{geoTags:o,geofenceTags:r,weatherTags:i}},Q=()=>{const e=D.getByTimestamp(M);return e&&"string"!=typeof e?null==e?void 0:e.tags:null},X={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="advertory:ppids-cache",ee={[u.SE]:`SCH${u.SE.toUpperCase()}-EnvHash`,[u.NO]:`SCH${u.NO.toUpperCase()}-EnvHash`},te={[u.SE]:`SCH${u.SE.toUpperCase()}-UserHash`,[u.NO]:`SCH${u.NO.toUpperCase()}-UserHash`},ne={[u.SE]:`sch${u.SE}-envhash-v3`,[u.NO]:`sch${u.NO}-envhash-v3`},ie={[u.SE]:`sch${u.SE}-userhash-v3`,[u.NO]:`sch${u.NO}-userhash-v3`},re={[u.SE]:`'sch${u.SE}-iosid-v3'`,[u.NO]:`'sch${u.NO}-iosid-v3'`},oe={[u.SE]:`sch${u.SE}-androidid-v3`,[u.NO]:`sch${u.NO}-androidid-v3`},se={[u.SE]:"sdrn:schibsted.com:user",[u.NO]:"sdrn:spid.no:user"};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,t;return null!==this.ppid1&&null!==this.ppid2||v("PPIDv2s accessed before they have been initialized"),{ppid1:null!==(e=this.ppid1)&&void 0!==e?e:"",ppid2:null!==(t=this.ppid2)&&void 0!==t?t:""}}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,v;const p=D.get(Z),g=yield this.getNewPPIDs(t,n);if(this.shouldHash(p,g)){const n=null!==(e=t.hasherUrl)&&void 0!==e?e:"https://hasher.schibsted.com/api/v1/hash",l=this.createHasherPayload(g),c=yield this.hashPPIDs(l,n);return c?(this.cachePPIDs(l,c,null===(i=g.idfv)||void 0===i?void 0:i.plain,null===(r=g.anId)||void 0===r?void 0:r.plain),void this.setPPIDs(null!==(o=c.userId)&&void 0!==o?o:"",null!==(s=c.environmentId)&&void 0!==s?s:"",null===(a=g.idfv)||void 0===a?void 0:a.plain,null===(d=g.anId)||void 0===d?void 0:d.plain)):void this.setPPIDs("","")}this.setPPIDs(null!==(l=null==p?void 0:p.userId.hashed)&&void 0!==l?l:"",null!==(c=null==p?void 0:p.environmentId.hashed)&&void 0!==c?c:"",null===(u=null==g?void 0:g.idfv)||void 0===u?void 0:u.plain,null===(v=null==g?void 0:g.anId)||void 0===v?void 0:v.plain)})}getPPIDs(){var e,t;return null!==this.ppid1&&null!==this.ppid2||v("PPIDv3s accessed before they have been initialized"),{ppid1:null!==(e=this.ppid1)&&void 0!==e?e:"",ppid2:null!==(t=this.ppid2)&&void 0!==t?t:"",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}}:{});D.set(Z,r)}hashPPIDs(t,n){return e(this,void 0,void 0,function*(){try{const e=new Headers({"Content-Type":"application/json"});return yield X.post(n,e,t)}catch(e){return v("Error with hashing PPIDs",e),null}})}getNewPPIDs(t,n){return e(this,arguments,void 0,function*({clientId:t,instance:n},i){const r=yield((t,n)=>e(void 0,void 0,void 0,function*(){const e=yield t.getUserId();return e?`${se[n]}:${e}`:null}))(n,i),o=yield(t=>e(void 0,void 0,void 0,function*(){const e=yield t.getEnvironmentId();return e?`sdrn:schibsted:environment:${e}`:null}))(n),s=window.advertory_idfv,a=window.advertory_anId;return Object.assign(Object.assign({clientId:{plain:t},userId:{plain:r},environmentId:{plain:o},trackerType:{plain:"Advertory"},trackerVersion:{plain:"1.0.0"}},s?{idfv:{plain:s}}:{}),a?{anId:{plain:a}}:{})})}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=t=>e(void 0,void 0,void 0,function*(){const{tracker:e,tcf:n,country:i,isMobileApp:r}=t;if(!(yield E(n,r,i,"setXandrPPIDs")))return;if(!e)return;(yield Promise.allSettled([de.processPPIDs(e,null==n?void 0:n.timeout),le.processPPIDs(e,i)])).forEach((e,t)=>{if("rejected"===e.status){v(`Cannot fetch PPIDs v${t+2}`,e.reason)}})}),ue=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,ee[e]).add(t,te[e]).add(r,ne[e]).add(i,ie[e]).add(o,re[e]).add(s,oe[e]).buildEids()}]}},ve=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,ee[e]).add(t,te[e]).add(r,ne[e]).add(i,ie[e]).add(o,re[e]).add(s,oe[e]).buildRyEids()}}]}}},pe=e=>{const{ppid1:t,ppid2:n}=de.getPPIDs(),{ppid1:i,ppid2:r}=le.getPPIDs();return(new ae).add(n,ee[e]).add(t,te[e]).add(r,ne[e]).add(i,ie[e]).buildRyEids()},ge=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,ee[t]).add(e,te[t]).add(r,ne[t]).add(i,ie[t]);return yield new Promise(e=>{e(o.buildVideoEids())})});const he=new class extends N{constructor(){super(...arguments),this.getHasPlusMembership=()=>({"se-generic-has_plus":"plus"===T("X-AB-Site-Version")?"yes":"no"})}prepare(t){return e(this,void 0,void 0,function*(){const e=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(Object.assign({"aa-sch-country_code":u.SE},this.getPublisherKeywords()),this.getSupplyTypeKeywords()),this.getAppTypeKeywords()),this.getDeviceKeywords()),this.getScreenKeywords()),this.getSectionPageTypeKeywords()),yield this.getAdvertisingConsentKeywords()),this.getAnalyticsConsentKeywords()),yield this.getExternalIdSrc()),this.getHasContextKeywords(t.keywords)),yield Y(l.get())),(()=>{const{ppid1:e,ppid2:t}=de.getPPIDs();return{"aa-sch-schuserhash":e?"1":"0","aa-sch-schenvhash":t?"1":"0"}})()),this.getHasPlusMembership()),t.keywords);return Object.assign(Object.assign({},t),{keywords:e,user:Object.assign(Object.assign({},ue(u.SE)),{externalUid:yield this.getExternalUid()}),member:this.getMember()})})}};var me=he.prepare.bind(he);const ye="ABSOLUTE_FULLSCREEN",fe="ANY_FULLSCREEN",we="VERTICAL_FULLWIDTH",be="FULLWIDTH",Ee="TAKEOVER",Te="VELVET_TAKEOVER",Se="WALLPAPER",Ie="COLLAPSE",Ae={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}],VELVET_TAKEOVER:[{width:7,height:7}],WALLPAPER:[{width:2,height:2}],COLLAPSE:[{width:2,height:1}]},ke={wallpaper:1600,"l-format":1600},Ce=e=>{const{banner:t,targetId:n}=e;return!(!t||(null==n?void 0:n.includes("takeover")))&&Ve(e,fe)},Oe=e=>{const{native:t}=e;return!!t},Pe=e=>Ve(e,be),Le=e=>{const{targetId:t}=e;return t.includes("takeover")||Ve(e,Ee)},$e=e=>Ve(e,Ee),je=e=>Ve(e,Se),xe=e=>Ve(e,Ie),_e=e=>e.targetId.includes("sponsorstripe"),Ne=e=>{const t=document.querySelector(`#${e}`);return!!t&&"true"===t.dataset.isFinnBlinkPlacement},qe=e=>e.targetId.startsWith("panorama")||e.targetId.startsWith("modul"),De=e=>e.targetId.startsWith("midboard"),Me=e=>e.targetId.includes("widescreen"),Re=e=>"https://acdn.adnxs.com/video/outstream/ANOutstreamVideo.js"===e.renderer_url,Be=e=>e.width>=1260&&e.width<=1280,Fe=e=>e.width>=1600&&e.width<=1620,Ue=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"))},Ve=(e,t)=>{const n=Ae[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})},He=e=>{var t,n;const{pageSectionsSelectors:{right:i}={}}=l.get();if(!i)return;const r=null===(t=Array.from(document.querySelectorAll(i)))||void 0===t?void 0:t[0];if(r){const t=40,i=(null===(n=e.banner)||void 0===n?void 0:n.height)?e.banner.height+t:0;r.style.marginTop=`${i}px`}},ze=(e,t)=>{e.style.position="fixed",e.style.transform=`translateY(${t}px)`},We=(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=e?t.offsetHeight:0;ze(n,i)})(e.isIntersecting,n,r)),s=new ResizeObserver(()=>((e,t)=>{ze(t,e.offsetHeight)})(n,r));o.observe(n),s.observe(n)},Ke=e=>["scrolling-up","menuScrollingUp"].some(t=>e.classList.contains(t)||document.body.classList.contains(t))||0===window.scrollY,Ge=e=>e.reduce((e,t)=>{var n;return e+(null!==(n=null==t?void 0:t.getBoundingClientRect().height)&&void 0!==n?n:0)},0),Ye=(e,t)=>t.map(t=>e.querySelector(t)),Je=(e,t)=>{e.style.transform=`translateY(${t}px)`,e.style.transition="transform 0.3s ease-out"},Qe=(e,t)=>{const{headerSelector:n,staticElementsSelectors:i,dynamicElementsSelectors:r}=t;if(!n||!i||!r)return;const o=document.querySelector(n),s=document.querySelector(`#${e}`);if(!o||!s)return;const a=s.parentElement,{minimizedTop:d,expandedTop:l}=((e,t,n)=>{const i=Ye(e,t),r=Ye(e,n),o=Ge(i);return{minimizedTop:o,expandedTop:o+Ge(r)}})(o,i,r);Je(a,Ke(o)?l:d);const c=((e,t,n,i)=>{let r=!Ke(e);return()=>{const o=!Ke(e);o!==r&&(r=o,Je(t,o?n:i))}})(o,a,d,l);((e,t)=>{const n=new MutationObserver(t);e.forEach(e=>{n.observe(e,{attributes:!0,attributeFilter:["class"],attributeOldValue:!1})})})([o,document.body],c)},Xe=e=>document.querySelector(e)||document.querySelector(`[class*="${e}"]`),Ze=e=>{const t=e[0];if("attributes"!==t.type||"class"!==t.attributeName)return;const n=t.target;setTimeout(()=>{var e;const t=document.getElementsByTagName("video")[0],i=null==t?void 0:t.getBoundingClientRect(),r=n.classList.contains("jw-flag-floating")&&!n.classList.contains("jw-flag-ads")?(null==i?void 0:i.height)+0:0,o=null===(e=document.querySelector('div[id^="sponsorstripe"]'))||void 0===e?void 0:e.firstChild;o&&(o.style.top=`${r}px`)},750)},et={attributeFilter:["class"],attributes:!0,childList:!1,subtree:!1},tt=(e,t,n=I.DESKTOP)=>{if(!t||!_e(e))return;const{toggleEnabled:i,headerSelector:r,containersSelectors:o,staticElementsSelectors:s,dynamicElementsSelectors:a,hideOnScroll:d}=t,{targetId:l}=e;if(!i)return;const c=null==a?void 0:a.length,u=document.querySelector(".advertory-takeover-wrapper"),v={headerSelector:r,staticElementsSelectors:s,dynamicElementsSelectors:a},p=[()=>r&&!c&&We(l,r),()=>c&&Qe(l,v),()=>o&&((e,t)=>{const n=document.querySelector(`#${e}`);if(!n)return;const[i,r]=t;if(!i)return;const o=()=>{const e=Xe(i),t=r?Xe(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)})(l,o),()=>u&&((e,t)=>{const n=document.querySelector(`#${e}`);if(!n||!t)return;new IntersectionObserver(([e])=>{n.style.visibility=e.isIntersecting?"hidden":"visible"}).observe(t)})(l,u),()=>d&&((e,t,n)=>{if(!_e(e)||!_(n))return;const{hideOnScroll:i}=t;if(!i)return;const r=document.querySelector(`#${e.targetId}`),o=null==r?void 0:r.parentElement;if(!o)return;const s=1.5*window.innerHeight;window.addEventListener("scroll",()=>{window.scrollY>=s?o.classList.add("advertory-sponsorstripe-onscroll-hidden"):o.classList.remove("advertory-sponsorstripe-onscroll-hidden")},{passive:!0})})(e,t,n)];p.forEach(e=>e())},nt={adRequested:()=>{},adAvailable:e=>{(Fe(e)||Be(e))&&(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"),He(e)),e.width>=1600&&e.width<=1620&&(n.classList.add("advertory-aftonbladet-h-format"),He(e)))})(e)},adLoaded:e=>{const t=document.getElementById(e.targetId);Pe(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")),_e(e)&&(()=>{const{deviceType:e}=l.get();_(e)&&setTimeout(()=>{const e=document.querySelector(".jwplayer");e&&new MutationObserver(Ze).observe(e,et)},1500)})(),Re(e)&&(null==t||t.classList.add("outstream")),qe(e)&&(e=>{const{deviceType:t}=l.get(),n=e.height<345;if(!_(t)||!n)return;const i=document.querySelector(`#${e.targetId}`),r=null==i?void 0:i.parentElement;i&&r&&(i.style.minHeight="unset",r.style.minHeight="unset")})(e)},adNoBid:e=>{},adError:(e,t)=>{},adCollapse:()=>{},adRequestFailure:e=>{},adBadRequest:e=>{},adLoadedMediated:e=>{},adNoBidMediated:e=>{}},it={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",TVNU:"tvnu",POLARIS:"polaris",KOKET:"koket",TV4:"tv4",FOTBOLLSKANALEN:"fotbollskanalen"},rt={publisherClassName:it.AFTONBLADET,fullWidthFormatClassName:"panorama",classesToRemoveOnRefresh:["advertory-aftonbladet-h-format","advertory-aftonbladet-l-format"],dynamicOutstreamFormats:["panorama","outstream"]},ot={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"}},st=()=>null!==p("disable_prebid"),at=(e,t,n,i)=>{var r;const{image:o,icon:s,sponsoredBy:a,title:d,clickUrl:l,cta:c,body:u,desc2:v,video:p,description:g,customTitle1:h,customTitle2:m,customTitle3:y,customTitle4:f,customIcon1:w,customIcon2:b,customDisplayUrl1:E}=e,T=(e,t="")=>{var n;return e?null!==(n=e.url)&&void 0!==n?n:e:t};return Object.assign({containerId:n,img:T(o),imgWidth:null==o?void 0:o.width,imgHeight:null==o?void 0:o.height,imgAltText:null!=d?d:"",logo:(()=>{var e;const t=(null==v?void 0:v.includes("sponsor"))&&"dark"===(null===(e=i.appearanceConfig)||void 0===e?void 0:e.theme)&&w;return T(t?w:s)})(),sponsoredBy:null!=a?a:"",title:null!=d?d:"",url:null!=l?l:"",cta:null!=c?c:"",description:null!==(r=null!=u?u:g)&&void 0!==r?r:"",desc2:null!=v?v:"",video:p,customTitle1:null!=h?h:"",customTitle2:null!=m?m:"",customTitle3:null!=y?y:"",customTitle4:null!=f?f:"",logo2:T(b),previewVideoSrc:null!=E?E:""},t)},dt=(e,t)=>{const n=(i=h,window.location.href.includes(i));var i;const r=new URLSearchParams(window.location.search).get(h),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},lt=(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},ct="native-ad",ut=(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(it).includes(i);n&&o&&lt(i,e,ct,r)})(r,n),i())},vt=(e,t)=>{pt(e,t),ht(e,t)},pt=(e,t)=>{var n,i;const r=document.querySelector(`#${e.targetId}`);if(!r||!(null===(n=e.native)||void 0===n?void 0:n.clickTrackers))return;const o=null!==(i=null==t?void 0:t.clickLinkSelector)&&void 0!==i?i:"a.ad-link";(null==r?void 0:r.querySelectorAll(o)).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:[])yt(i)}),t.dataset.tracked="true")})},gt=e=>{var t;const{native:{impressionTrackers:n}={}}=e,i=null==n?void 0:n.some(e=>e.includes("googleads")),r="function"==typeof(null===(t=window.apntag)||void 0===t?void 0:t.fireImpressionTrackers)&&!!e.tagId;i||!r?null==n||n.forEach(mt):window.apntag.fireImpressionTrackers(e);const o=new CustomEvent("advertory:nativeImpression",{detail:{ad:e}});window.dispatchEvent(o)},ht=(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:I.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,gt(e),c.disconnect();break}},d);c.observe(r)},mt=e=>{const t=e.includes("googleads");"function"!=typeof window.navigator.sendBeacon||t?yt(e):window.navigator.sendBeacon(e)},yt=e=>{fetch(e,{method:"GET",mode:"no-cors"}).catch(t=>console.warn(`Tracker ${e} failed. Error: ${t||"Unknown"}`))},ft=(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(),v=null!==(i=dt(e.targetId,l))&&void 0!==i?i:c,p=ot[t.language||u.NO],g=at(a,p,d,t);return(a.video?o[v]:r[v]||r.default)(g,t)})(e,t,n);ut(e.targetId,i,t,()=>{const{nativeTrackingConfig:{nativeTrackingEnabled:n=!0}={}}=t;n&&vt(e,t)})},wt={FRONT:"front",ARTICLE:"article"},bt=({containerId:e,url:t,adText:n,sponsoredBy:i,title:r,img:o,description:s,desc2:a},d)=>{const l=Ue({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}"${x(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>`},Et=e=>null!==e&&"object"==typeof e&&!Array.isArray(e),Tt="viewable",St="adClick",It=(e,t)=>{null==t||t.forEach(t=>{const n=window.SVP.Player.Plugins.get(t);e.addPlugin(new n)})},At=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)))}))}),kt={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 Os})})}})}},Ct=(e,t)=>{null==e||e.forEach(e=>{kt[e](t)})};const Ot=(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"}))},Pt=({id:e,nodeId:t,poster:n,tagURL:i,publisher:r="",productTag:o="xandr",videoLoop:s=!1})=>({id:e,poster:n,vendor:"appnexus",node:t,mute:!0,autoplay:s,repeat:s,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({},Et(e)?e:{}),{provider:Object.assign(Object.assign({},Et(null==e?void 0:e.provider)?e.provider:{}),{productTag:o})})}}),Lt=t=>e(void 0,void 0,void 0,function*(){const{playerConfig:e,pluginsNames:n,clickUrl:i}=t,{repeat:r}=e,o=yield At(e);Ct(n),o.once("assetReady",()=>{It(o,n)}),o.on(Tt,e=>{const{viewable:t}=e;t?o.play():o.pause()}),o.on(St,()=>{window.open(i,"_blank")}),r&&o.on("pause",()=>{o.play()})}),$t=({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-video">\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}"${x(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>`},jt={CONTENT_DISPLAY:(e,{pageType:t})=>t===wt.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:bt,CLASSIC_VIDEO:(e,t)=>{const{video:n}=e;return(null==n?void 0:n.content)?(i=$t,(e,t,n)=>{const{video:r,img:o,url:s}=e,{publisher:a,productTag:d}=t,{pluginsNames:l,videoLoop:c}=n||{};if(!(null==r?void 0:r.content))return null;const u=Math.ceil(1e5*Math.random()),v=o||"https://custom.inventory.schibsted.io/1x1-00000000.png",p=`ad-player-${u}`,g=Ot(r.content,s),h=Pt({id:u,nodeId:p,poster:v,tagURL:g,publisher:a,productTag:d,videoLoop:c});return Lt({playerConfig:h,clickUrl:s,pluginsNames:l}),`${i(e,t,p)}`})(e,t):bt(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,u.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>`},xt={displayTemplates:{brandstudio_native_ad:jt.CLASSIC,brandstudio_native_ad_alcohol:jt.CLASSIC,default:jt.CONTENT_DISPLAY,gambling:jt.CONTENT_DISPLAY,ab_chat:jt.CHAT_INTEGRATION,sponsor:jt.SPONSORSTRIPE,sponsortop:jt.SPONSORSTRIPE,sponsorstripe:jt.SPONSORSTRIPE},videoTemplates:{brandstudio_native_ad:jt.CLASSIC_VIDEO}},_t=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`};class Nt{initialize(){this.DATA=Object.assign({},Nt.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)}}Nt.INITIAL_DATA={wallpaper:{isAvailable:!1},horseshoe:{isAvailable:!1},initialClassNames:{},alertoryConfigKeywords:{}};const qt=new Nt,Dt=()=>(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),Mt=()=>(window.relevantDigital||(window.relevantDigital={cmd:[]}),window.relevantDigital),Rt=(e={},t)=>{const{prebid:{externalUidInAuctionEnabled:n,forwardGlimrTags:i=!1}={},country:r}=l.get(),o=[`${K(r)}-geo`],s=["aa-sch-context_keyword","aa-sch-publisher","se-aftonbladet-section","se-svd-section","se-generic-section","no-sno-news-section","no-sno-news-subsection","aa-sch-cmp_advertising",...i?o:[]],a=Object.fromEntries(Object.entries(e).filter(([e])=>s.includes(e))),d=t&&n?{id:t}:{};return{ortb2:Object.assign({site:{ext:{data:a}}},d)}},Bt=(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)}))}),Ft="advertory-fullscreen-scroll",Ut="advertory-fullscreen-scroll-wrapper",Vt="fullscreen-scroll-in-screen",Ht="in-screen",zt=e=>e.includes("snoap.no"),Wt=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)},Kt=(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()},Gt=Kt([],()=>{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}),Yt=e=>{const t=Kt([],()=>{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},Jt=[],Qt={},Xt=(e,t)=>{e.forEach(({target:e,isIntersecting:n})=>{const i=en(e);n?(Zt(i,n),tn(e,i,t)):(Zt(i,n),nn(e,i,t))})},Zt=(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}`,"*")},en=e=>{var t;return null===(t=e.children[0])||void 0===t?void 0:t.id},tn=(e,t,n)=>{e.classList.add(Ht),document.body.classList.add(Vt),window.dispatchEvent(new CustomEvent("advertory:fullscreenScrollInView")),Jt.includes(t)||Jt.push(t),n&&window.addEventListener("scroll",Qt[t],{passive:!0})},nn=(e,t,n)=>{Jt.includes(t)&&(n&&window.removeEventListener("scroll",Qt[t]),document.body.classList.remove(Vt),e.classList.remove(Ht),window.dispatchEvent(new CustomEvent("advertory:fullscreenScrollNotInView")))},rn=(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&&on(e,o,r,0),s.length&&on(e,s,r,40)}},on=(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()})};let sn=null;const an=(e,t)=>{let n=e;return n=(e=>{const t=document.createElement("script");return t.textContent="\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 ",e+t.outerHTML})(e),n=(e=>{const t=document.createElement("script");return t.textContent=`(${Gt})()`,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(zt(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=Yt(n)),(e=>e.includes("de17a"))(n)&&(n=(e=>zt(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)),zt(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)),Wt(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},dn=()=>{sn=null;const e=window.visualViewport,t=e?e.height:window.innerHeight,n=e?e.width:window.innerWidth,i=e?e.offsetLeft:0,r=document.documentElement;r.style.setProperty("--advertory-fullscreen-scroll-vh",`${t}px`),r.style.setProperty("--advertory-fullscreen-scroll-vw",`${n}px`),r.style.setProperty("--advertory-fullscreen-scroll-left",`${i}px`)},ln=()=>{sn||(sn=window.requestAnimationFrame(dn))},cn=(e,t)=>{var n,i,r,o;const{country:s}=l.get(),{targetId:a}=e;document.documentElement.style.setProperty("--advertory-ios-safe-area-top-fix",null!==(n=null==t?void 0:t.iosSafeAreaTopFix)&&void 0!==n?n:"0px"),(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!==(i=null==t?void 0:t.overlayStyles)&&void 0!==i?i:{});const d=document.getElementById(a),c=null==d?void 0:d.parentElement;if(!d||!c)return;((e,t)=>{const n=(null==t?void 0:t.fadingHeaderEnabled)||!1,i=new IntersectionObserver(e=>Xt(e,n),{}),r=en(e);i.observe(e),n&&(Qt[r]=rn(e,t))})(c,t),d.className=Ft;const u=Ve(e,ye)?"absolute":"fixed";d.style.position=u,c.className=Ut,c.dataset.showTagSubscribeId=a,d.setAttribute("data-ad-label",ot[s].adText),(null==t?void 0:t.moveCogwheelToTheLeft)&&(d.dataset.moveCogwheelToTheLeft="true"),ln(),window.addEventListener("resize",ln),null===(r=window.visualViewport)||void 0===r||r.addEventListener("resize",ln),null===(o=window.visualViewport)||void 0===o||o.addEventListener("scroll",ln)},un=({targetId:e})=>{const t=(e=>{var t;const{requests:n}=window.apntag,i=Wt(e)?1:0;return null===(t=null==n?void 0:n.tags[e].adResponse.ads[i].rtb)||void 0===t?void 0:t.banner.content})(e);if(!t)return;((e,t)=>{const{requests:n}=window.apntag,i=Wt(e)?1:0,r=null==n?void 0:n.tags[e].adResponse.ads[i].rtb;r&&(r.banner.content=t)})(e,an(t,e))},vn=e=>{var t;!document.querySelector(`#gdprAdTransparencyCogWheelButton-${e}`)&&(null===(t=window.gdpr)||void 0===t?void 0:t.setupButton)&&window.gdpr.setupButton(e)},pn=(e,t,n)=>{var i,r,o,s;const a=document.createElement("div");a.id=`${e}-button`,t.appendChild(a);(null===(r=null===(i=window.apntag.requests)||void 0===i?void 0:i.tags[e])||void 0===r?void 0:r.adResponse)||(null!==(o=(s=window.apntag).requests)&&void 0!==o||(s.requests={tags:{}}),window.apntag.requests.tags[e]=Object.assign(Object.assign({},window.apntag.requests.tags[e]),{adResponse:{ads:[{creative_id:n}]}})),vn(e);const d=a.firstElementChild;d&&t.insertBefore(d,a),a.remove()},gn="ad-loaded",hn=()=>e(void 0,void 0,void 0,function*(){const{prebid:e,tcf:t,country:n,isMobileApp:i,fullscreenScroll:r}=l.get();if(!(null==e?void 0:e.enabled))return;const{initNativeAd:o}=l.getHandlers(),{getConsentAsync:s}=b(t,0,n),a=yield s(),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=Dt(),{prebid:{relevantCbTimeout:o}={}}=l.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}}})(),c=Dt(),u=(()=>{const{requests:{user:e={userIds:[]},keywords:t={}}={}}=Dt();return{user:e,keywords:t}})();d.failsafeOnTimeout("relevantCb");const{user:{externalUid:p=""}={},keywords:g}=u;(()=>{const e=Mt();return e.cmd||(e.cmd=[]),e.cmd})().push(()=>{if(d.getCancel()||!c.loadTags)return v("core loadTags() call was cancelled",{cancel:d.getCancel(),apnTagLoadTags:!c.loadTags,condition:"or"}),void d.cleanup();const t=Mt();d.events.relevantCb.done=!0,d.failsafeOnTimeout("auctionCb");const i=a?{gdpr:{cmpApi:"iab",timeout:8e3}}:{cmpApi:"none"};v("prebid consentManagement",i),t.addPrebidConfig(Object.assign(Object.assign({consentManagement:i,enableSendAllBids:!1},ve(n)),Rt(g,p))),v("core add prebid config",Object.assign(Object.assign({consentManagement:i,enableSendAllBids:!1},ve(n)),Rt(g,p))),t.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,c.loadTags(e)),d.cleanup()}},customNativeRender:e=>{mn(e,o)},directRenderFn:e=>{var t;const{settings:n,renderFn:i}=e,{bid:o,adDiv:s}=n||{};if(!s)return;const a=i(n),d=Object.assign(Object.assign({},o),{targetId:s.id,banner:!0}),l=s.id,c=document.getElementById(l);c&&(Ce(d)?(cn(d,r),(e=>{const t=()=>{const t=e.contentDocument;if(!(null==t?void 0:t.body))return;const n=()=>{const e=t.querySelector("iframe");if(!e)return!1;const n=()=>{var t;const n=null===(t=e.contentDocument)||void 0===t?void 0:t.querySelector(".adn-ttpa-container");n&&(n.style.setProperty("bottom","10px","important"),n.style.setProperty("top","unset","important"))};return e.addEventListener("load",n),n(),!0};if(n())return;const i=new MutationObserver(()=>{n()&&i.disconnect()});i.observe(t.body,{childList:!0,subtree:!0})};e.addEventListener("load",t),t()})(a)):((e=>{if(!(null==e?void 0:e.classList.contains(Ft)))return;e.classList.remove(Ft),e.removeAttribute("style"),e.removeAttribute("data-ad-label");const t=e.parentElement;(null==t?void 0:t.classList.contains(Ut))&&(t.classList.remove(Ut),t.classList.remove(Ht))})(c),null===(t=null==c?void 0:c.parentElement)||void 0===t||t.classList.add("advertory-direct-render")),c.classList.add(gn),(null==o?void 0:o.creativeId)&&pn(l,c,Number(null==o?void 0:o.creativeId)))}}),v("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,c.loadTags(e))}},customNativeRender:e=>{mn(e,o)},directRenderFn:()=>{}})})}),mn=(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},l.get()),null==d||d.postMessage(JSON.stringify({message:"Prebid Response",ad:"\x3c!-- nothing --\x3e",adId:o.adId}),"*")},yn="0123456789abcdefghijklmnopqrstuvwxyz",fn=(e=6)=>{if(e<=0)return"";let t="";for(let n=0;n<e;n++){t+=yn[Math.floor(36*Math.random())]}return t},wn=()=>Promise.resolve(),bn=()=>{},En=e=>{window.apntag.anq.push(e)},Tn=new Promise(e=>{"undefined"!=typeof document&&document.prerendering?document.addEventListener("prerenderingchange",()=>e()):e()}),Sn=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})});let In="";const An=new Map,kn=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},Cn="advertory-wallpaper-background",On=()=>{const e=document.querySelector(`.${Cn}`);e&&e.remove()},Pn=/^wallpaper:url:(http[s]?:\/\/)?[^\s(["<,>]*\.[^\s[",><]*/,Ln=e=>{if("0"===p("collapse_ad"))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")&&On())},$n=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"))},jn=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`)},xn=e=>{const t=e.parentElement;if(!e||!t)return;const{container:n,wrapper:i}=(e=>{const t=qt.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},_n=()=>{On();document.querySelectorAll('[data-advertory-ad-rendered="true"]').forEach(e=>{Ln(e.id),xn(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=kn(e.id)}),En(()=>window.apntag.clearRequest())},Nn="noGroupedPlacements",qn=e=>{const t=e.replace(/[0-9]/g,"");return"_"===t.slice(-1)?t.substring(0,t.length-1):t},Dn=e=>{if(!(null==e?void 0:e.minViewWidth))return!0;return window.innerWidth>=e.minViewWidth},Mn=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}=l.get(),o=n[r].filter(Dn)||[],s=e?document.querySelector(e):document;if(!s)return[];const a=o.reduce((e,t)=>{const n=qn(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),c=Array.from(d).filter(({id:e})=>e.match(t)).map((e,t)=>{var i;const r=Rn(e,t,n),o=r.finnBlink&&!r.finnBlink.renderOnlyWithAdBlock,s=o&&(null===(i=r.finnBlink)||void 0===i?void 0:i.loadOnlyFinnBlink),a=`${e.id}-${fn(6)}`;return e.id=a,e.setAttribute("data-advertory-ad-rendered","true"),o&&e.setAttribute("data-is-finn-blink-placement","true"),s&&e.setAttribute("data-is-finn-blink-only-placement","true"),(e=>{var t;const n=e.id;n&&qt.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({},r),{id:a})});return(e=>{const{keywordsConfig:t}=l.get();return(null==t?void 0:t.includeCountingKeywordInTags)?(In!==window.location.pathname&&(An.clear(),In=window.location.pathname),e.map(e=>{var t;const n=e.invCode.replace(/_\d+$/,""),i=null!==(t=An.get(n))&&void 0!==t?t:0;return e.keywords=Object.assign({},e.keywords),e.keywords[`${G()}-count`]=i,An.set(n,i+1),e})):e})(c)});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)},Rn=(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},Bn=e=>{const{queryConfig:{placementBatches:t}={},deviceType:n}=l.get(),i=(null==t?void 0:t[n])||{},r=Object.values(i).flat(),o=(e=>{const t={};return e.forEach(e=>{const n=kn(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(kn(e.id)));return n})(e,i),a=Object.keys(o),d=((e,t)=>e.filter(e=>!t.has(kn(e.id))))(e,new Set([...a,...r]));return Object.assign(Object.assign(Object.assign({},s),o),{[Nn]:d})},Fn=(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])}},Un=["netboard","board"];class Vn{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(t){return e(this,void 0,void 0,function*(){var e,n,i;const r=yield this.identityFacade.getIdentityUser(),o=null!==(i=yield null===(n=null===(e=this.tracker)||void 0===e?void 0:e.getEnvironmentId)||void 0===n?void 0:n.call(e))&&void 0!==i?i:"",s=(null==r?void 0:r.userId)?String(r.userId):"",a=this.buildUrl(t,{envId:o,spid:s});try{v("Starting fetching DrEdition ad from URL:",a);const e={method:"GET"},t=yield X.get(a,e);return v("Fetch operation completed successfully."),t}catch(e){v("Error during fetch operation:",e)}return null})}}let Hn=class{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]}};const zn=e=>{const t=e.parentElement;t?t.classList.remove("dr-edition-lock-height"):v("Dr. Edition container does not have a parent element, cannot remove height lock.")};class Wn{constructor(e,t,n,i){this.drEditionService=e,this.rendererManager=t,this.videoManager=n,this.pulseManager=i,this.drEditionAds=[]}fetchAndRenderAd(t,n){return e(this,void 0,void 0,function*(){var e,i;const{drEditionConfig:{containerSelector:r},renderAsBackfill:o=!1}=n,s=t.querySelector(r);if(!s)return void v(`Container with selector "${r}" not found.`);const a=yield this.drEditionService.fetchData(n);return(null==a?void 0:a.itemId)||o?!(null==a?void 0:a.itemId)&&o?(v("No Dr. Edition ads available to render. Collapsing whole placement."),Ln(t.id),void zn(s)):((null==a?void 0:a.itemId)&&o&&(v("Dr. Edition ad available to render as a Xandr backfill."),$n(t.id)),void(a?(a.css&&((e,t)=>{const n=document.createElement("link");n.rel="preload",n.href=e,n.as=t,document.head.appendChild(n)})(a.css,"style"),yield this.rendererManager.render(s,a,n),yield null===(e=this.videoManager)||void 0===e?void 0:e.handle(a,n),zn(s),this.drEditionAds.push(a),window.advertory=window.advertory||{},window.advertory.renderedDrEditionAds=window.advertory.renderedDrEditionAds||[],window.advertory.renderedDrEditionAds.push(a.itemId),this.observeAdView(t,a,n),null===(i=t.querySelector("a"))||void 0===i||i.addEventListener("pointerup",()=>null)):zn(s))):(v("No Dr. Edition ads available to render. Hiding Dr. Edition and rendering Xandr backfill."),this.hideDrEdition(s),this.showBackfill(t),void zn(s))})}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:"";$n(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 Kn{constructor(e,t){this.newsroomStrategy=e,this.pulseManager=t}render(t,n,i){return e(this,void 0,void 0,function*(){if(!(null==n?void 0:n.itemId))return;const{getConsentAsync:e}=b(i.tcf,i.isMobileApp,i.country),r=yield e(),o=_(i.device)?n.mobileHTML:n.desktopHTML,s=r?o:o.replace(/<img [^>]*class="tracking-pixel"[^>]*>/g,"");t.innerHTML=s,t.querySelectorAll("a").forEach(e=>{var t,r,o;e.search=null!==(o=null===(r=(t=this.newsroomStrategy).getUrlSearchParams)||void 0===r?void 0:r.call(t,e,n,i))&&void 0!==o?o:"",e.onclick=()=>this.pulseManager.trackContentClick(e,n,i)})})}}class Gn{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(t){return e(this,void 0,void 0,function*(){const e=t.drEditionConfig.videoScriptUrl,n=document.querySelector(`script[src="${e}"]`);if(e&&!window.autoplayQueue&&!n)try{yield Bt(e)}catch(e){v("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("src",o),a.setAttribute("playsinline",""),!(!a||!s)&&(null===(r=(i=t.drEditionConfig).addPreviewVideo)||void 0===r||r.call(i,a),!0))}}let Yn=class{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,d,l,c;const u=new CustomEvent("advertory:partnerstudioAdImpression",{detail:{ad:i.editionName}});if(window.dispatchEvent(u),!this.pulse)return;const v=this.getEventInput(t,n,i,"view");(null===(e=this.pulse)||void 0===e?void 0:e.trackLegacyViewUIElement)?null===(o=null===(r=this.pulse)||void 0===r?void 0:r.trackLegacyViewUIElement)||void 0===o||o.call(r,v):(null===(s=this.pulse)||void 0===s?void 0:s.trackViewUIElement)?null===(d=null===(a=this.pulse)||void 0===a?void 0:a.trackViewUIElement)||void 0===d||d.call(a,v):null===(c=null===(l=this.pulse)||void 0===l?void 0:l.trackElementView)||void 0===c||c.call(l,v)})}trackContentClick(t,n,i){return e(this,void 0,void 0,function*(){var e,r,o,s,a,d;if(!this.pulse)return;const l=this.getEventInput(t,n,i,"click");this.pulse.trackLegacyClickUIElement?null===(r=(e=this.pulse).trackLegacyClickUIElement)||void 0===r||r.call(e,l):this.pulse.trackClickUIElement?null===(s=(o=this.pulse).trackClickUIElement)||void 0===s||s.call(o,l):null===(d=(a=this.pulse).trackElementClick)||void 0===d||d.call(a,l)})}};class Jn extends Yn{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)}}}let Qn=class extends Yn{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"}}};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);Ct(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 At(l);c.once("assetReady",()=>{It(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===wt.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 Zn="https://www.aftonbladet.se/video-player-extras/latest/";class ei{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:{[`${Zn}cta-button.js`]:{name:"CtaButton",options:{type:"unmute"}},[`${Zn}external-link.js`]:{name:"ExternalLink"}}};yield At(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 ti{handleVideo(t,n){return e(this,arguments,void 0,function*(t,{videoConfiguration:{id:n,node:i,autoplay:r,mute:o,vendor:s}}){const a={id:n,node:i,autoplay:r,mute:o,vendor:s,locale:"se",autopause:"viewable",maxBitrate:600,sharing:!1,recommended:!1,pulse:{provider:"svdse",decorator:(e,t)=>Object.assign(Object.assign({},Et(e)?e:{}),{provider:Object.assign(Object.assign({},Et(null==e?void 0:e.provider)?e.provider:{}),{productTag:"partnerstudio"})})},skin:{name:"svd-player",url:""},settings:{pulse:{host:"se-aftonbladet.videoplaza.tv",contentMetadata:{category:"SvD",tags:["standard-linears","pause",`video-${n}`]},requestSettings:{}}}},d=yield At(a);d.once("PulseStats:ready",()=>e(this,void 0,void 0,function*(){const e=yield d.getPlugin("PulseStats").getTracker();null==e||e.update({provider:{id:"svdse",productTag:"partnerstudio"}})}))})}getPulseObjectId(){return"sdrn:svdse:content:partnerstudio:element:partnerstudio:stats"}getPulsePageId(e,t){return e===wt.FRONT?"sdrn:svdse:frontpage:front":`sdrn:svdse:article:${t}`}}let ni=class{handleVideo(e,t){}getPulseObjectId(){return""}getPulsePageId(e,t){return""}};const ii=(e,t,n)=>{var i;const{publisher:r,pageType:o,country:s}=e,a={[it.VG]:new Hn,[it.E24]:new Xn,[it.AFTONBLADET]:new ei,[it.SVD]:new ti}[r]||new ni,d=new(s===u.SE?Jn:Qn)(n,a,o),l=new Vn(t,null!==(i=null==n?void 0:n.pulseTracker)&&void 0!==i?i:n),c=new Kn(a,d),v=new Gn(a);return new Wn(l,c,v,d)},ri=()=>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 oi{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 v("[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 si=(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=ii(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))},ai=()=>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)}}),di=[],li=(t,n)=>e(void 0,void 0,void 0,function*(){var e;const{pulse:i,tcf:r,deviceType:o,drEdition:s,publisher:a,pageType:d,country:l,isMobileApp:c}=t;if(!(yield E(r,c,l,"handleDrEditionBackfill")))return;const u=((e,t)=>{var n;const{deviceType:i,placements:r,drEdition:{fallbackGlobalEditionName:o}={}}=e,s=r[i]||r.desktop,a=kn(t.targetId),d=s.find(e=>e.id===a),l=Un.some(e=>a.startsWith(e)),c=di.includes(a),u=(null===(n=null==d?void 0:d.drEdition)||void 0===n?void 0:n.editionName)||o;return d&&l&&!c&&u?(di.push(a),Object.assign(Object.assign({},d),{drEdition:Object.assign(Object.assign({},d.drEdition),{editionName:u})})):null})(t,n);if(!u)return;if(!(null==i?void 0:i.instance))return void v("Pulse has not been passed as a prop, aborting");const p=yield ri(),g=new oi(p),h=ii({publisher:a,pageType:d,country:l},g,null==i?void 0:i.instance),m=document.getElementById(n.targetId);if(!m||!s)return;m.classList.value="";const y=document.createElement("div");y.className=s.containerSelector.replace(/^[.#:[\]]+/,""),m.innerHTML=y.outerHTML;const f={editionName:(null===(e=null==u?void 0:u.drEdition)||void 0===e?void 0:e.editionName)||"",drEditionConfig:s,device:o,tcf:r,isMobileApp:c,country:l,renderAsBackfill:!0};yield h.fetchAndRenderAd(m,f)}),ci=(t,n)=>{var i,r,o,s;if(!(()=>{const e=document.getElementById("ads-advertory-anchor");return!(e&&"none"!==getComputedStyle(e).display&&window.advertoryFluepapir)})())return void v("Ad block not enabled, Dr. Edition backfills will not be rendered");v("Ad block is enabled, Dr. Edition backfills will be rendered");const a=null!==(s=null===(o=null===(r=null===(i=t.finnBlink)||void 0===i?void 0:i.replacementConfig)||void 0===r?void 0:r.adsToReplace)||void 0===o?void 0:o.map(([e])=>e))&&void 0!==s?s:[],d=new IntersectionObserver((n,i)=>e(void 0,void 0,void 0,function*(){for(const e of n){if(!e.isIntersecting)continue;const n=e.target;i.unobserve(n),yield li(t,{targetId:n.id})}}),{rootMargin:"400% 0px"});n.filter(e=>!a.some(t=>e.id.startsWith(t))).forEach(e=>{const t=document.getElementById(e.id);t&&d.observe(t)})},ui="collapseAd",vi="hideAd",pi="resizeAd",gi="renderDrEditionFallback",hi="wallpaperImageUrl",mi="wallpaperColor",yi="velvet",fi=[pi,hi,mi,ui,vi,gi,yi];let wi;const bi=e=>{if("object"==typeof e)return e;if(t=e,Pn.test(t)){const t=e.replace(/^wallpaper:url:/,"");return{name:hi,wallpaperImageUrl:t}}var t;if((e=>e.startsWith("wallpaper:color:"))(e)){const t=e.replace(/^wallpaper:color:/,"");return{name:mi,wallpaperColor:t}}if(e.startsWith(gi)){const t=e.split(":")[1];return{name:gi,targetId:t}}if(e.startsWith(ui)||e.startsWith(vi)){const t=e.split(":")[1];return{name:ui,targetId:t}}if(e.includes("name")&&fi.some(t=>e.includes(t)))try{return JSON.parse(e)}catch(e){}},Ei=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=bi(t);if(!n)return;if(!n.name||!fi.some(e=>n.name===e))return;const{name:i,targetId:r,wallpaperImageUrl:o,wallpaperColor:s,cmd:a,size:d}=n;i===yi&&a&&(a.includes("noScroll")&&(wi=(e=>{if(!e)return()=>{};const t=e.style.overflow;return e.style.setProperty("overflow","hidden"),()=>{e.style.setProperty("overflow",t)}})(document.querySelector("body"))),(a.includes("close")||a.includes("ended"))&&(null==wi||wi(),dispatchEvent(new CustomEvent("advertory:closeTakeover",{})))),i!==ui&&i!==vi||!r||Ln(r),i===pi&&r&&a&&Fn(r,a),i===gi&&r&&(Ln(r),li(l.get(),{targetId:r})),"resizeMediationAd"===i&&r&&d&&Fn(r,d,!0),i===hi&&o&&(e=>{const t=document.querySelector(`.${Cn}`);t&&(t.style.backgroundImage=`url(${e})`)})(o),i===mi&&s&&(e=>{const t=document.querySelector(`.${Cn}`);t&&(t.style.backgroundColor=e)})(s)},Ti=e=>({rootMargin:`${e}px 0px ${e}px 0px`}),Si=()=>{const{publisher:t,country:n,finnBlink:i}=l.get(),{loadFinnBlinkAd:r,wallpaperHandlers:{adjustAdToHorseshoe:o}}=l.getHandlers(),s=window.apntag,a={publisher:t,country:n,finnBlink:i},d=e=>{$n(e),En(()=>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,()=>{qt.getData("horseshoe").isAvailable&&o(t)})})}},Ii=(e,t,n)=>{const i="true"===n.dataset.isFinnBlinkOnlyPlacement;return Ne(t)&&i?(v(`loading finn blink ad for blink only placement for ${t}`),void Si().withFinnBlinkAd(t)):Ne(t)?(v(`loading finn blink ad with full ads chain for ${t}`),void Si().withFullAdsChain(t)):void En(()=>(v("core showTag",{id:t}),e.showTag(t)))},Ai=(t,n)=>e(void 0,void 0,void 0,function*(){yield Tn,yield Sn;const e=new IntersectionObserver((e,n)=>((e,t,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);v("core log from intersection observer handler",{targetId:o,element:s}),n(window.apntag,o,i),s&&(t.unobserve(s),t.disconnect())})})(e,n,Ii,t),Ti(n));e.observe(t)}),ki=new Map,Ci=["no-stavangeraftenblad","sa","no-aftenposten","aftenposten","no-bergenstidende","bt"],Oi=".brandstudio-premium-content-widget",Pi=({adWrapper:e,placementContainer:t})=>t.offsetHeight+(({adWrapper:e})=>{const{paddingTop:t,paddingBottom:n}=getComputedStyle(e);return parseFloat(t)+parseFloat(n)})({adWrapper:e}),Li=({adWrapper:e,placementContainer:t})=>{const n=Pi({adWrapper:e,placementContainer:t});var i;null==e||e.style.setProperty("height",`${n}px`),xn(i=t),i.innerHTML=""},$i=e=>{e&&e.style.getPropertyValue("height")&&e.style.removeProperty("height")},ji=({adWrapper:e,placementContainer:t})=>{const{publisher:n}=l.get(),i=Ci.includes(n)&&Boolean(t.closest(Oi));const r=i?t.closest(Oi):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 $i(e),void o.disconnect();const a=t.closest('[style*="height"]'),d=r;a&&d.contains(a)?$i(a):d.hasAttribute("style")&&$i(d),o.disconnect()})})});try{o.observe(t,{childList:!0,subtree:!0})}catch(e){o.disconnect()}},xi=(e,t,n,i,r,o)=>{var s;const a=performance.now(),d=null!==(s=ki.get(t))&&void 0!==s?s:0,c=((e,t)=>!!t&&e+t<(new Date).getTime())(i,r)&&n<0;a-d>=r&&c&&(ki.set(t,a),((e,t,n)=>{const{country:i}=l.get(),r=null==n?void 0:n.parentElement;r&&n&&Li({adWrapper:r,placementContainer:n}),En(()=>{e.setKeywords([t],{[`${K(i)}-adreload`]:"1"},{overrideKeyValue:!0}),e.refresh([t])})})(e,t,o))},_i=(e,t,n)=>{const i=new IntersectionObserver((e,i)=>((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,xi,t,n),Ti(300));i.observe(e)},Ni=(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},qi=()=>navigator&&navigator.userAgent.match(/chrome/i)?null:navigator&&navigator.userAgent.match(/apple/i),Di=(e,t=0)=>{const n=e.getBoundingClientRect(),i=window.innerHeight;return n.bottom>-t&&n.top<i+t},Mi=e=>{const{refreshConfig:{visibilityStateRefreshEnabled:t=!1}={}}=l.get();if(!t)return;const n=()=>{"visible"===document.visibilityState&&document.removeEventListener("visibilitychange",n),Vi(e)};"visible"!==document.visibilityState&&document.addEventListener("visibilitychange",n)},Ri=(e,t,n)=>{const i=document.querySelectorAll('[data-bf-cache-refresh="true"]');for(const r of i){const i=e.find(e=>{var t;return e.id===(null===(t=r.firstElementChild)||void 0===t?void 0:t.id)&&e.bfCacheRefresh}),o=null==i?void 0:i.threshold;Di(r,o)&&i&&(jn(i.id),n.length&&r.classList.remove(...n),Vi([i],t))}},Bi=e=>{const{refreshConfig:{backForwardNavigationRefreshEnabled:t=!1}={},siteSpecificConfig:{classesToRemoveOnRefresh:n=[]}={},isMobileApp:i}=l.get();t&&(e.forEach(({id:e})=>{const t=Fi(e);t&&(t.dataset.bfCacheRefresh="true")}),i?((e,t)=>{document.addEventListener("visibilitychange",()=>{"visible"===document.visibilityState&&Ri(e,!0,t)})})(e,n):((e,t)=>{window.addEventListener("pageshow",n=>{const i=()=>{window.scrollY>0&&(window.removeEventListener("scroll",i),Ri(e,!1,t))};n.persisted&&(qi()?window.addEventListener("scroll",i,{passive:!0}):Ri(e,!1,t))})})(e,n))},Fi=e=>{var t,n;return null!==(n=null===(t=document.querySelector(`#${e}`))||void 0===t?void 0:t.parentElement)&&void 0!==n?n:null},Ui=e=>{const{id:t,allowedFormats:n}=e,i=(e=>{if(!e)return[];try{return JSON.parse(e.dataset.adSizes||"[]")}catch(e){return[]}})(Fi(t)),r=(e=>1===e[0]&&1===e[1])(i),o={sizes:[i],allowedFormats:r?n:n.filter(e=>"native"!==e),allowSmallerSizes:!1};return r||(o.native=void 0),o},Vi=(e,t=!1)=>{const{requestSize:n=a}=l.get(),i=e.map(({id:e})=>e),r=Ni(i,n);if(t)for(const t of e){const e=Ui(t);window.apntag.modifyTag(t.id,e)}for(const e of r)En(()=>window.apntag.refresh(e))};const Hi="#fff",zi="#0098da",Wi="splash",Ki="welcomePage",Gi="topscroller",Yi="velvet",Ji="takeover-displayed",Qi="takeover-visit-count",Xi=14400,Zi=()=>{const e=T(Qi);return e?parseInt(e):0},er=()=>{const{takeover:{enabled:e=!1,secondVisitEnabled:t=!1}={}}=l.get();return"0"!==p(g)&&("1"===p(g)||!(!e||(()=>{var e;const t=(null===(e=l.get().takeover)||void 0===e?void 0:e.cookieCapName)||Ji;return"true"===T(t)})())&&(!t||tr()))},tr=()=>{const e=Zi();return 0===e?((()=>{const e=Zi(),{takeover:{cookieCapTime:t=Xi}={}}=l.get(),n=document.location.hostname;window.document.cookie=`${Qi}=${e+1}; max-age=${t}; domain=${n}; path=/; SameSite=Lax`})(),!1):1===e},nr=(e,t)=>[[1,1],[1920,1080]].some(([n,i])=>n===e&&i===t),ir=()=>{const{takeover:e}=l.get();return Boolean(null==e?void 0:e.topscroller)},rr=()=>e(void 0,void 0,void 0,function*(){const e=document.location.hostname,{takeover:{cookieCapName:t=Ji,cookieCapTime:n=Xi}={},isMobileApp:i,tcf:r,country:o}=l.get(),s=yield E(r,i,o,"ad-takeover-cookiecap");n&&s&&(window.document.cookie=`${t}=true; max-age=${n}; domain=${e}; path=/`)}),or=e=>{var t;const n=!!(null===(t=l.get().takeover)||void 0===t?void 0:t.setCookieCapForNotShownAd);return Le(e)&&n},sr=(e,t)=>{var n;if(t===Gi){const{topscroller:t}=e;return null!=t?t:{}}if(t===Wi){const{splash:t}=e;return null!=t?t:{}}return null!==(n=e.welcomePage)&&void 0!==n?n:{}},ar=(e,t)=>{t!==Wi?(e=>{var t,n,i;const r=null===(n=null===(t=l.get().takeover)||void 0===t?void 0:t.welcomePage)||void 0===n?void 0:n.headerElementSelector,o=null===(i=l.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}`),c=document.querySelector(".advertory-welcome-page-scroll");if(!(s&&a&&c&&d))return;const u=null==s?void 0:s.offsetHeight,v=$e(e)?"60svh":`calc(100svh - ${u}px)`,p=$e(e)?"calc(40svh + 30px)":`calc(${u}px + 30px)`;a.style.setProperty("height",v,"important"),d.style.setProperty("height",v,"important"),c.style.setProperty("bottom",p,"important")})(e):(e=>{var t;if(!(null===(t=l.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)},dr=Kt([],()=>{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})}),lr=(e,t=!0)=>{(e===Ki||e===Gi)&&(e=>{e?setTimeout(()=>window.scrollTo(0,0),100):window.scrollTo(0,10)})(t)},cr=()=>{const e=parseInt(document.body.dataset.scrollY||"0",10);document.body.style.top="",window.scrollTo(0,e),document.body.classList.remove("page-locked")},ur=e=>{document.body.style.overflow=e?"initial":"hidden"},vr=e=>{const t=gr(e),n=pr(e);(e=>{e.classList.toggle("takeover-ad-hidden",!0)})(e),ur(!0),e.style.display="none",window.removeEventListener("keydown",t),window.removeEventListener("advertory:closeTakeover",n)},pr=e=>{const t=()=>vr(e);return window.addEventListener("advertory:closeTakeover",t),cr(),t},gr=e=>{const t=t=>{["Enter","Escape"].includes(t.key)&&vr(e)};return cr(),window.addEventListener("keydown",t),t},hr=e=>{const t=e.querySelector(".advertory-splash-navbar-wrapper");t&&(gr(e),pr(e),cr(),t.addEventListener("click",()=>{vr(e)}),ur(!1))},mr=e=>{(e=>{window.addEventListener("scroll",()=>{e.getBoundingClientRect().bottom,(e=>{const t=e.getBoundingClientRect().bottom;e.style.opacity=""+t/e.offsetHeight})(e)},{passive:!0})})(e),pr(e);const t=document.querySelector("header");document.querySelectorAll(".smooth-close-takeover").forEach(e=>e.addEventListener("click",()=>null==t?void 0:t.scrollIntoView({behavior:"smooth"})))},yr=e=>{(e=>{window.addEventListener("advertory:closeTakeover",()=>vr(e))})(e)},fr=e=>{const{takeover:{splash:{showAnnonsLabel:t=!1}={}}={}}=l.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=ot.se.adText),e.classList.toggle("advertory-splash-wrapper",!0)},wr=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=ot.no.adText,n.classList.add("takeover-topscroller-label"),e.classList.toggle("topscroller-wrapper",!0))},br=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=ot.se.adText,e.classList.toggle("welcome-page-wrapper",!0))},Er=e=>{const t=document.querySelector(".advertory-takeover-label");t&&(t.style.display="flex",t.innerText=ot.se.adText,e.classList.toggle("advertory-impact-wrapper",!0))},Tr=()=>{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)},Sr=(e,t)=>{let n=e;return e.includes("529299503")&&(n=(e=>{const t=document.createElement("script");return t.textContent=`(${dr})()`,e+t.outerHTML})(e)),n},Ir=e=>{const t=(e=>{var t;const{requests:n}=window.apntag,i=Wt(e)?1:0;return null===(t=null==n?void 0:n.tags[e].adResponse.ads[i].rtb)||void 0===t?void 0:t.banner.content})(e);if(!t)return;((e,t)=>{const{requests:n}=window.apntag,i=Wt(e)?1:0,r=null==n?void 0:n.tags[e].adResponse.ads[i].rtb;r&&(r.banner.content=t)})(e,Sr(t))},Ar=t=>e(void 0,void 0,void 0,function*(){const{takeover:e}=l.get(),{targetId:n}=t,i=document.querySelector(`#${n}`),r=document.querySelector(".advertory-takeover-wrapper");if(!i||!r||!e)return;const o=(e=>{const{width:t,height:n}=e;return nr(t,n)?Wi:Ve(e,Te)?Yi:ir()?Gi:Ki})(t),s=r.offsetHeight,a=window.scrollY>s;r.style.display="block",!a&&lr(o,!1),((e,t)=>{({[Ki]:br,[Wi]:fr,[Gi]:wr,[Yi]:Er})[t](e)})(r,o),Tr(),((e,t)=>{({[Ki]:mr,[Gi]:mr,[Wi]:hr,[Yi]:yr})[t](e)})(r,o),((e,t,n)=>{if(!n)return;({[Ki]:()=>{const{buttonLabel:i}=sr(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:"")})},[Wi]:()=>{const{themeColors:i,logotype:r,buttonLabel:o,showArrowIcon:s}=sr(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:Hi,"important"),n.style.color=null!=t?t:zi}}})},[Gi]:()=>{const{buttonLabel:i,showArrowIcon:r,showCloseButton:o=!0}=sr(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:""))})},[Yi]:()=>{}})[t]()})(r,o,e),yield rr(),!a&&lr(o,!0),ar(t,o)}),kr="advertory-brandmetrics-survey",Cr=()=>e(void 0,void 0,void 0,function*(){const{norstat:{enabled:t}={},country:n,isMobileApp:i,tcf:r}=l.get(),o=yield E(r,i,n,"norstat");if(!t||i||!o)return;const s=(e=>{const{ppid1:t,ppid2:n}=de.getPPIDs(),{ppid1:i,ppid2:r}=le.getPPIDs(),o=(new ae).add(n,ee[e]).add(t,te[e]).add(r,ne[e]).add(i,ie[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===u.NO?"schibsted":"schibstedse"}/map/${s}`,"norstat")}),Or={nativeAd:e=>Oe(e)&&!_e(e),buyrecipe:e=>e.targetId.startsWith("buyrecipe"),fullwidthAd:Pe,fullscreenScroll:Ce,topscroller:e=>Le(e)&&ir(),splash:e=>Le(e)&&nr(e.width,e.height),welcomePage:Le,wallpaper:je,skyscraper:e=>e.targetId.includes("skyscraper")&&!!e.banner,lFormat:Be,hFormat:Fe,toppanorama:e=>e.targetId.startsWith("toppanorama")&&!Fe(e)&&!Be(e),topboard:e=>e.targetId.startsWith("topboard")&&!Le(e),widescreen:Me,insider:e=>e.targetId.startsWith("insider"),sponsorstripe:_e,brandboard:e=>(e=>(980===e.width||1920===e.width&&e.targetId.includes("brandboard"))&&!e.targetId.includes("topboard")&&!e.targetId.includes("companion")&&!qe(e))(e)&&!(e=>e.targetId.includes("backfill"))(e)&&!De(e),outstream:Re,netboard:e=>(e=>e.targetId.startsWith("netboard"))(e)||(e=>e.targetId.startsWith("board"))(e),panorama:qe,midboard:De},Pr=({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(Or))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)},Lr=e=>{var t;return(null===(t=Object.entries(Or).find(([,t])=>t(e)))||void 0===t?void 0:t[0])||""},$r=(e,t)=>{const n=e.width,i=(null!=t?t:window.screen.width)/n;return i<1?i:1},jr=new Map;jr.set("insider",{scale:.82,transformOrigin:"left center",cogwheelAdjust:!0}),jr.set("panorama",{scale:.79,transformOrigin:"center center"}),jr.set("outstream",{scale:.79,transformOrigin:"center center"}),jr.set("integration",{scale:.79,transformOrigin:"center center"}),jr.set("toppanorama",{scale:.8,transformOrigin:"left center"});const xr=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=Lr(e),r=jr.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")},_r=e=>{var t,n,i,r,o,s;const{adScaleConfig:a,deviceType:d}=l.get();if(!(null==a?void 0:a.enabled))return;if(Ve(e,fe))return;const c=null!==(t=a.adsToBeScaled[d])&&void 0!==t?t:[],u=qn(e.targetId.split("-")[0]);if(!c.includes(u))return;const v=null!==(i=null===(n=a.offset)||void 0===n?void 0:n[u])&&void 0!==i?i:0,p=document.getElementById(e.targetId),g=null!==(r=null==p?void 0:p.offsetWidth)&&void 0!==r?r:window.screen.width,h=null!==(s=null===(o=null==p?void 0:p.parentElement)||void 0===o?void 0:o.offsetWidth)&&void 0!==s?s:window.screen.width;((e,t=window.screen.width)=>{const n=$r(e,t),i=document.querySelector(`iframe[id^="utif_${e.targetId}"]`);i&&(i.style.transform=`scale(${n})`,i.style.transformOrigin="left top")})(e,(g<h?g:h)-v)},Nr=(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,qr=e=>`externalImpId:'${e}'`,Dr=e=>{var t;const{forwardExternalImpId:n=!1,tracker:i}=l.get(),r=(e=>{var t;if(!e.positionConfig)return e;const n=e.keywords[`${G()}-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),{id:o,sizes:s,keywords:a,allowedFormats:d,invCode:c,ssa:u=!1,nativeCustomProperties:p,safeframeConfig:g,dynamicSizeWidthCheck:h=!1}=(e=>{var t;if(!e.takeoverCookieCapForSharedPlacement||er())return e;const n=null===(t=e.keywords)||void 0===t?void 0:t["no-sno-adformat"],i=null==n?void 0:n.filter(e=>e!==Gi),r=Object.assign(Object.assign({},e.keywords),n&&{"no-sno-adformat":i}),o=e.sizes.filter(([e,t])=>4!==e||4!==t);return Object.assign(Object.assign({},e),{sizes:o,keywords:r})})(r),m=Object.assign({invCode:c,sizes:s,targetId:o,keywords:Nr(a,u),allowedFormats:d,dynamicSizeWidthCheck:h},g&&{safeframeConfig:g}),y=(e=>{var t,n,i,r,o,s,a;return e?(null===(t=null==e?void 0:e.instance)||void 0===t?void 0:t.state)?(null===(i=null===(n=null==e?void 0:e.instance)||void 0===n?void 0:n.state)||void 0===i?void 0:i.pageViewId)?(v("Tracker state pageViewId is:",null===(o=null===(r=null==e?void 0:e.instance)||void 0===r?void 0:r.state)||void 0===o?void 0:o.pageViewId),null===(a=null===(s=null==e?void 0:e.instance)||void 0===s?void 0:s.state)||void 0===a?void 0:a.pageViewId):(v("Tracker state does not contain field pageViewId or it is empty"),""):(v("Tracker state is empty"),""):(v("Tracker is not configured in initAdvertory function"),"")})(i);n&&y&&(v("External Impression ID assigned to defineTag:",qr(y)),m.externalImpId=qr(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},customIcon1:{required:!1},customIcon2:{required:!1},customDisplayUrl1:{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}}))(p);return(null===(t=e.allowedFormats)||void 0===t?void 0:t.includes("native"))&&(m.native=f),m},Mr=e=>!e.includes("takeover")||er(),Rr=e=>{const{source:t}=e;return"csm"===t},Br=e=>{if(!e)return e;const{country:t}=l.get(),n=K(t),i=e[`${n}-targetid`],r=i?kn(i[0]):"";return Object.assign(Object.assign({},e),i&&{[`${n}-targetid`]:[r]})},Fr=e=>{const{country:t}=l.get(),n=K(t);return Object.assign(Object.assign(Object.assign(Object.assign({},e),e[`${n}-geo`]&&{[`${n}-geo`]:["geo-test-value"]}),e[`${n}-geofence`]&&{[`${n}-geofence`]:["geofence-test-value"]}),e[`${n}-weather`]&&{[`${n}-weather`]:["weather-test-value"]})},Ur=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"})})()},Vr=(t,n)=>e(void 0,void 0,void 0,function*(){return yield new Promise(e=>{t().then(t=>{e(null!=t?t:null)}).catch(t=>{e(null)})})}),Hr="https://dr-edition-teaser-server.inventory.schibsted.io/xandr",zr=()=>e(void 0,void 0,void 0,function*(){return window.__tcfapi?{gdpr:1,gdpr_consent:yield(e=window.__tcfapi,new Promise((t,n)=>{e("addEventListener",2,(n,i)=>{var r;i||t(""),"tcloaded"!==n.eventStatus&&"useractioncomplete"!==n.eventStatus||(t(null!==(r=n.tcString)&&void 0!==r?r:""),e("removeEventListener",2,()=>{},n.listenerId))})}))}:{};var e}),Wr={publisher:"aftonbladet",country:u.SE,memberId:9943,sectionKeyword:"se-aftonbladet-section",frontpageInvCodeTemplate:"se-aftonbladet-{deviceType}-front-{position}",additionalFilterKeys:["se-aftonbladet-navigation","se-aftonbladet-keyword_generator","se-aftonbladet-sponsor"],tcf:{enabled:!0,schibstedAdChoicesEnabled:!0,schibstedConsentToPayEnabled:!0},glimr:{enabled:!0,clientId:"OYGH3SXYFAQR78LVPNQD"}},Kr={nyheter:"nyheter",sport:"sportbladet",noje:"nojesbladet",family:"family",matdryck:"matdryck",wellness:"wellness",minekonomi:"minekonomi",resa:"resa",harligthemma:"harligthemma"},Gr=e=>(null==e?void 0:e.parent)?[...Gr(e.parent),e.shortPath||"unknown"]:[],Yr=(e,t)=>t?"se-aftonbladet-{deviceType}-studio_{position}":`se-aftonbladet-tv-{deviceType}-${(e=>{var t;if(null===(t=null==e?void 0:e.metadata)||void 0===t?void 0:t.afp)return"afp";const[,n]=Gr(e);return Kr[n]||"ovrigaavdelningar"})(e)}_{position}`,Jr={aftonbladet:Wr},Qr={aftonbladet:(e,t)=>{if(!e)return null;return{invCode:Yr(e,t),videoOverlayInvCode:"se-aftonbladet-{deviceType}-other-{position}",sections:Gr(e).join(":")}}},Xr=e=>{var t;if(!Jr[e]){(e=>{console.warn("[Advertory WARN]: ",e)})(`[video] No config found for publisher "${e}"`)}return null!==(t=Jr[e])&&void 0!==t?t:Wr},Zr=e=>{switch(e){case"auto":return 1;case"silent":return 2;default:return 3}},eo=new Map([[1,"autoplay"],[2,"muted-autoplay"],[3,"click-to-play"]]),to="se-generic",no="aa-sch",io="kv_",ro="pause",oo="{deviceType}",so="{position}",ao="afp_",lo=new Set(Object.values({PREROLL:"preroll",BUMPER:"bumper",MIDROLL:"midroll"})),co="1-1",uo="16-9",vo="3-4",po="9-16",go="responsive",ho={[co]:1,[uo]:1.78,[po]:.56,[go]:1},mo={[co]:1,[uo]:1.78,[vo]:1.33,[po]:.56},yo=(e,t,n,i)=>{const{invCode:r="",videoOverlayInvCode:o}=null!=e?e:{},s=I.DESKTOP===n?C:O,a=r.replace(oo,s);return(e,n)=>{if(e===ro)return(e=>e.replace("tv-","").replace("-afp_","-afp-").replace(so,ro).replace(/-([a-z]+)_/,"-article-"))(a);if(n&&lo.has(e)){return(i&&o?o:t.frontpageInvCodeTemplate).replace(oo,s).replace(so,e)}return a.replace(so,e)}},fo=(e,t)=>{const n=Object.entries(e);return n.reduce((n,[i,r])=>{const o=Math.abs(e[n]-t);return Math.abs(r-t)<o?i:n},n[0][0])},wo=()=>{var e,t;const n=jwplayer().getContainer(),i=null!==(t=null===(e=document.getElementById(n.id))||void 0===e?void 0:e.parentElement)&&void 0!==t?t:null;return i&&"number"==typeof i.offsetWidth&&"number"==typeof i.offsetHeight&&0!==i.offsetHeight?i.offsetWidth/i.offsetHeight:1},bo=()=>{return(e=>{try{return decodeURIComponent(e)}catch(e){return""}})("undefined"!=typeof document&&null!==(t=null===(e=document.cookie.match("(^|;)\\s*_pulse2data\\s*=\\s*([^;]+)"))||void 0===e?void 0:e.pop())&&void 0!==t?t:"").split(",");var e,t},Eo=()=>{const e=null!==(t=bo()[9])&&void 0!==t?t:null;var t;const n=(()=>{var e;return null!==(e=bo()[2])&&void 0!==e?e:null})();return e?Number(Boolean(e))+Number(Boolean(n)):0},To=()=>Object.fromEntries(new URLSearchParams(window.location.search)),So=(t,n)=>e(void 0,void 0,void 0,function*(){const{country:e,tcf:i,publisher:r}=n,{width:o,height:s}={width:window.innerWidth,height:window.innerHeight},a=(yield E(i,t.isApp,e,"video"))?"1":"0",d=yield zr(),l=yield ge(e),c=yield S({tcf:i,isMobileApp:t.isApp,country:e}),u=null!==(v=window.location.pathname.split("/").slice(-2,-1).pop())&&void 0!==v?v:"";var v;const p=((e=1)=>fo(mo,Number(e.toFixed(2))))(t.instreamAspectRatio),g=(h=t.playerAspectRatio)?fo(ho,Number(h.toFixed(2))):go;var h,m;return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({[`${no}-country_code`]:e,[`${no}-publisher`]:r,[`${no}-supply_type`]:(m=t.deviceType,m===I.DESKTOP?A:k),[`kw_${no}-page_type`]:"collection",[`${no}-page_type`]:"collection",[`${to}-appmode`]:t.isAndroidApp?"hybrid":"notinapp",[`kw_${to}-page`]:"index",[`${to}-page`]:"index",[`${to}-screenheight`]:String(window.screen.height),[`${to}-screenwidth`]:String(window.screen.width),[`${to}-viewportheight`]:String(s),[`${to}-viewportwidth`]:String(o),[`${to}-loggedin`]:t.isUserLoggedIn?"yes":"no",[`${to}-mobile-os`]:j(),[`${to}-audience`]:void 0,[`${to}-externalid_src`]:Eo(),[`${to}-tags`]:t.tags,[`${to}-articleid`]:u,"article-id":u},yield Y(Object.assign(Object.assign({},n),{isMobileApp:t.isApp}))),c&&{external_uid:c}),t.isUserPresentOnFrontPage&&t.isInitialVideo&&{[`${to}-tvtags`]:"vinjett"}),t.pageAdsKeywords),Object.keys(To()).some(e=>e.includes(io))&&(()=>{const e=To(),t=Object.fromEntries(Object.entries(e).filter(([e])=>e.startsWith(io)).map(([e,t])=>[e.slice(3),t]));return Object.keys(t).length>0?t:void 0})()),{[n.sectionKeyword]:t.sections.split(":"),"aa-sch-cmp_advertising":a,"kw_aa-sch-cmp_advertising":a,"aa-sch-instream_player_aspectratio":p,"aa-sch-player_aspectratio":g}),d),{eids:l})}),Io=["se-generic-audience","se-generic-appversion","se-generic-sitemode","se-generic-pagegen","se-generic-viewportheight","se-generic-viewportwidth","se-generic-screenheight","se-generic-screenwidth","aa-sch-inventory_type"],Ao=["aa-sch-publisher","se-generic-page","aa-sch-supply_type","se-generic-story","se-generic-section","se-generic-adformat","aa-sch-context_keyword","se-generic-tvtags","se-generic-test","aa-sch-cmp_advertising","aa-sch-instream_player_aspectratio","aa-sch-player_aspectratio"],ko=["external_uid","gdpr","gdpr_consent","eids","article-id"],Co=(e,t)=>{const n=[...Io,...t.additionalFilterKeys];return Object.fromEntries(Object.entries(e).filter(([e])=>!n.includes(e)).map(([e,t])=>[e.includes("kw")||ko.includes(e)?e:`kw_${e}`,t]))},Oo=e=>Object.fromEntries(Object.entries(e).filter(([e])=>Ao.includes(e))),Po=(t,n)=>e(void 0,void 0,void 0,function*(){var e,i,r,o;const s=Xr(t.publisher),a=(e=>{var t;return null!==(t=Qr[e])&&void 0!==t?t:Qr.aftonbladet})(t.publisher)(t.assetSection,t.isLiveStudio),d="/"===window.location.pathname,l=null===(i=null===(e=n.attributes)||void 0===e?void 0:e.id)||void 0===i?void 0:i.toString(),c=t.assetId===l,u=null!==(r=Number(t.aspectRatio))&&void 0!==r?r:1,v=c?"preroll":"bumper";var p;return{siteConfig:s,siteVideoParams:a,isUserPresentOnFrontPage:d,adsKeywords:yield So({pageAdsKeywords:t.pageAdsKeywords,tags:(p=t.tags,p?p.filter(e=>e.slug).map(({slug:e})=>e).join(","):""),sections:null!==(o=null==a?void 0:a.sections)&&void 0!==o?o:"",isUserLoggedIn:t.isUserLoggedIn,isUserPresentOnFrontPage:d,isInitialVideo:c,instreamAspectRatio:u,playerAspectRatio:wo(),isApp:t.isApp,deviceType:t.deviceType,isAndroidApp:t.isAndroidApp},s),prerollPlacementFormat:v,playbackMethod:Zr(t.startMode)}}),Lo=(e,t)=>{const{siteConfig:n,siteVideoParams:i,isUserPresentOnFrontPage:r,adsKeywords:o,prerollPlacementFormat:s,playbackMethod:a}=e,{invCode:d}=i||{},l=yo(i,n,t.deviceType,t.isUsedInOverlayVideoPlayer),c=((e="")=>t=>e.includes(ao)?`${ao}${t}`:t)(d),u=window.location.href;return{member:n.memberId,options:{autoplayMuted:!0,vpaidcontrols:!0},adSlots:{schedule:{preroll:{inv_code:l(s,r),"se-generic-playback-method":eo.get(a),"kw_se-generic-adformat":c(s)},midroll:{inv_code:l("midroll"),"kw_se-generic-adformat":c("midroll")},postroll:{inv_code:l("postroll"),"kw_se-generic-adformat":c("postroll")}},params:Object.assign(Object.assign(Object.assign({},Co(o,n)),Oo(o)),{vskippable:"0",referrer:u,vplaybackmethod:a})},adPlacements:{schedule:{pause:{invCode:l("pause"),sizes:[[825,424],[1280,720],[2,1]]}},params:{keywords:Object.assign(Object.assign({},o),{"se-generic-adformat":c("pause")})}}}},$o=t=>n=>e(void 0,void 0,void 0,function*(){const e=yield Po(t,n);return Lo(e,t)}),jo={plcmtcnt:1,context:1,contextsubtype:10,plcmttype:1,assets:[{id:1,title:{len:100},required:0},{id:2,img:{type:1,hmin:10,wmin:10},required:0},{id:3,img:{type:3,hmin:10,wmin:10},required:0},{id:4,data:{type:2},required:0},{id:5,data:{type:12},required:0}],ver:"1.2",eventtrackers:[{event:1,methods:[1,2]}]},xo={no:"NOK",se:"SEK"},_o={no:"no",se:"sv"};class No{buildFetchObject(t,n,i,r){return e(this,void 0,void 0,function*(){const{country:e,pageOptions:o}=r,{invCode:s,xandrPlacementId:a}=t,d=yield zr(),l=(c=Object.assign(Object.assign({},n),i),Object.entries(c).flatMap(([e,t])=>void 0===t?[]:Array.isArray(t)?t.map(t=>`${e}=${t}`):[`${e}=${t}`]).join(","));var c;const u=new URL(window.location.href),v=(e=>{const{allowedFormats:t}=e;if(!t||t.includes("native"))return{request:JSON.stringify(jo),ver:"1.1"}})(t),p=(e=>{const{sizes:t,allowedFormats:n}=e;if((null==n?void 0:n.includes("banner"))&&t&&0!==t.length)return{format:t.map(([e,t])=>({w:e,h:t})),w:t[0][0],h:t[0][1]}})(t);return{id:fn(36),imp:[Object.assign(Object.assign(Object.assign({id:s},v&&{native:v}),p&&{banner:p}),{secure:1,tagid:s,ext:{appnexus:Object.assign(Object.assign({},a&&{placement_id:a}),{code:s,keywords:l,use_pmt_rule:!1})}})],site:{domain:u.hostname,page:u.href,publisher:{id:String(o.publisherId),domain:u.hostname},ext:{amp:0}},device:{dnt:Number((null===navigator||void 0===navigator?void 0:navigator.globalPrivacyControl)||"1"===(null===navigator||void 0===navigator?void 0:navigator.doNotTrack)),ua:window.navigator.userAgent,h:screen.height,w:screen.width,language:(navigator.language||_o[e]||"no").split("-")[0]},regs:{ext:{gdpr:d.gdpr||0}},user:{id:yield S(r),ext:{consent:d.gdpr_consent||"",eids:pe(e)}},at:1,cur:[xo[e]],source:{tid:fn(36)},ext:{prebid:{bidder:{appnexus:{member:o.member}}}}}})}fetchData(t,n,i,r){return e(this,void 0,void 0,function*(){try{v("Starting fetching Studio ad from Xandr:",Hr);const e=new Headers({"Content-Type":"application/json"}),o=new URLSearchParams(window.location.search),s=new URLSearchParams(["openRTBDebugMemberOverride","openRTBNewsroomOverride","openRTBForceNativeDesc2Override"].flatMap(e=>{const t=o.get(e);return t?[[e,t]]:[]})),a=s.size>0?`${Hr}?${s.toString()}`:Hr,d=yield this.buildFetchObject(t,n,i,r),l=yield X.post(a,e,d);return v("Fetch operation completed successfully.",l),l}catch(e){v("Error during fetch operation:",e)}return null})}}const qo=0,Do=3,Mo=e=>e.reduce((e,t)=>{if(!t.serverSidePlacement)return e.clientSidePlacements.push(t),e;const n=Math.random()<.5;return t.keywords=Object.assign(Object.assign({},t.keywords),{"aa-sch-prerenderer":n?"true":"false"}),n?e.serverSidePlacements.push(t):e.clientSidePlacements.push(t),e},{clientSidePlacements:[],serverSidePlacements:[]}),Ro=(t,n)=>e(void 0,void 0,void 0,function*(){var e,i;const{deviceType:r,appearanceConfig:o}=n,s=null==o?void 0:o.defaultThreshold[r],a=null!==(e=t.threshold)&&void 0!==e?e:s,d=document.getElementById(t.id);if(!d)return void v(`Server-side ad container not found: ${t.id}`);yield new Promise(e=>{new IntersectionObserver((t,n)=>{t.some(e=>e.isIntersecting)&&(n.disconnect(),e())},Ti(a)).observe(d)});const{prepareTag:c}=l.getHandlers(),u=qt.getData("alertoryConfigKeywords"),p=null!==(i=c(Dr(t)).keywords)&&void 0!==i?i:{},g=new No,h=yield g.fetchData(t,u,p,n);h&&(((e,t,n)=>{const i=n===I.MOBILE?t.mobileHTML:t.desktopHTML;if(i){if(t.adType===qo){const n=document.createElement("iframe");n.width=String(t.bid.w),n.height=String(t.bid.h),n.style.overflow="hidden",n.style.border="none",n.srcdoc=`<style>html,body{margin:0;overflow:hidden;}</style>${i}`,e.appendChild(n)}else e.innerHTML=i;e.classList.add("ad-loaded")}})(d,h,r),h.adType===Do&&(lt(n.publisher,d,ct,n.pageType),vt({targetId:t.id,native:{clickTrackers:h.clickTrackers,impressionTrackers:h.impTrackers}},{deviceType:r,appearanceConfig:o,nativeTrackingConfig:n.nativeTrackingConfig,clickLinkSelector:"a"})),((e,t,n,i)=>{var r,o,s;let a;(null===(r=window.apntag.requests)||void 0===r?void 0:r.tags[e])||(null!==(o=(s=window.apntag).requests)&&void 0!==o||(s.requests={tags:{}}),window.apntag.requests.tags[e]={invCode:t,adResponse:{ads:[{creative_id:Number(null==i?void 0:i.adid)}]}}),!!n.querySelector("iframe")||(a=document.createElement("iframe"),n.appendChild(a)),pn(e,n,Number(null==i?void 0:i.adid)),null==a||a.remove()})(t.id,t.invCode,d,h.bid))}),Bo=(e,t)=>{e.forEach(e=>Ro(e,t).catch(e=>{v("Failed to handle server-side ad:",e)}))},Fo={arrayMerge:(e,t)=>t},Uo=t=>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))})(t))return t;try{const n=yield(t=>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})(t);if(!e)return null;const n=new AbortController,i=setTimeout(()=>n.abort(),5e3);try{return yield X.get(e,{method:"GET",signal:n.signal})}catch(t){throw v("Failed to fetch S3 config",{error:t,url:e}),t}finally{clearTimeout(i)}}))(t);return n?(({siteConfig:e,configOverrides:t})=>{var n;const{keywords:i,refresh:o,placements:s,threshold:a,batchSize:d}=t,l=r.all([e.placements,s],Fo),c=r(e.pageOptions,{keywords:i},Fo),u=r(e.appearanceConfig,{defaultThreshold:a},Fo),v=r(null!==(n=e.refreshConfig)&&void 0!==n?n:{},{scrollRefreshEnabled:o},Fo);return Object.assign(Object.assign({},e),{placements:l,requestSize:null!=d?d:e.requestSize,pageOptions:c,appearanceConfig:u,refreshConfig:v})})({siteConfig:t,configOverrides:n}):t}catch(e){return v("Error fetching S3 config, using site config",{error:e}),t}}),Vo=".advertory-right-column-track",Ho="--advertory-right-column-track-height",zo=e=>e.getBoundingClientRect().top+window.scrollY,Wo=e=>{const{marginTop:t,marginBottom:n}=getComputedStyle(e);return e.getBoundingClientRect().height+parseFloat(t||"0")+parseFloat(n||"0")},Ko=(e,t)=>{const n=(i=t,`${Math.max(0,Math.round(i))}px`);var i;document.body.style.setProperty(e,n)},Go=(e,t)=>`${e}-${t}`,Yo=(e,t,n)=>{var i;const r=Array.from(null!==(i=e.querySelectorAll(t))&&void 0!==i?i:[]),o=(e=>e.map(e=>{var t;return null===(t=document.querySelector(`[id^="${e}"]`))||void 0===t?void 0:t.parentElement}).map((e,t)=>({point:e,originalIndex:t})).filter(e=>Boolean(e.point)))(n);if(0===o.length)return;const s=zo(e);(()=>{const e=document.querySelector("header");if(!e)return;const t=Wo(e);Ko("--advertory-newsroom-header-height",t)})(),o.forEach(({point:e,originalIndex:t})=>{((e,t,n)=>{const i=zo(e),r=Go(Ho,t),o=i-n,s=Go("--advertory-right-column-split-point-height",t),a=Wo(e);Ko(r,o),Ko(s,a)})(e,t+1,s),(e=>{const t=null==e?void 0:e.id;if(!t)return;const n=Go("--advertory-right-column-ad-height",t),i=Wo(e);Ko(n,i)})(r[t])});((e,t)=>{const n=zo(e);Ko(Ho,n-t)})(o[Math.min(r.length,o.length-1)].point,s)};let Jo=!1;class Qo{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 Xo{getPulseObjectId(){return""}getPulsePageId(e,t){return""}}class Zo{constructor(e,t){this.pulse=e,this.newsroomStrategy=t}getEventInput(e,t){return{}}parseKilkayaData(e){const t=e.querySelector("article");if(!t)return{};const n=t.dataset.k5aTeaserAnalytics;try{return n?JSON.parse(n):{}}catch(e){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()||""}getEventTarget(e){const{url:t,title:n,itemId:i}=this.parseKilkayaData(e);return{id:i,name:this.normalizePlacementTitle(null!=n?n:""),type:"Page",url:t}}normalizePlacementTitle(e){return e.replace(/<[^>]+>/gi,"").replace(/[^a-z0-9æøå\s_-]/gi,"")}trackContentView(t){return e(this,void 0,void 0,function*(){var e,n,i,r,o,s,a,d,l;const c=new CustomEvent("advertory:partnerstudioAdImpression",{detail:{ad:null===(e=this.parseKilkayaData(t))||void 0===e?void 0:e.placement}});if(window.dispatchEvent(c),!this.pulse)return;const u=this.getEventInput(t,"view");(null===(n=this.pulse)||void 0===n?void 0:n.trackLegacyViewUIElement)?null===(r=null===(i=this.pulse)||void 0===i?void 0:i.trackLegacyViewUIElement)||void 0===r||r.call(i,u):(null===(o=this.pulse)||void 0===o?void 0:o.trackViewUIElement)?null===(a=null===(s=this.pulse)||void 0===s?void 0:s.trackViewUIElement)||void 0===a||a.call(s,u):null===(l=null===(d=this.pulse)||void 0===d?void 0:d.trackElementView)||void 0===l||l.call(d,u)})}trackContentClick(t){return e(this,void 0,void 0,function*(){var e,n,i,r,o,s;if(!this.pulse)return;const a=this.getEventInput(t,"click");this.pulse.trackLegacyClickUIElement?null===(n=(e=this.pulse).trackLegacyClickUIElement)||void 0===n||n.call(e,a):this.pulse.trackClickUIElement?null===(r=(i=this.pulse).trackClickUIElement)||void 0===r||r.call(i,a):null===(s=(o=this.pulse).trackElementClick)||void 0===s||s.call(o,a)})}}class es extends Zo{constructor(e,t,n){super(e,t),this.pulse=e,this.newsroomStrategy=t,this.pageType=n}getEventBaseData(e){var t,n,i,r,o,s;const{clientName:a,creativeId:d,itemId:l,placement:c}=this.parseKilkayaData(e),u=this.mapPageType(this.pageType),v=null===(t=this.newsroomStrategy)||void 0===t?void 0:t.getPulsePageId(this.pageType||"front",this.getArticleId());return{"@id":null!==(r=null===(i=null===(n=this.newsroomStrategy)||void 0===n?void 0:n.getPulseObjectId)||void 0===i?void 0:i.call(n))&&void 0!==r?r:c,"@type":"UIElement",position:c,elementType:"Article",custom:{customer:a,creativeId:null!=d?d:l},page:{"@id":null!=v?v:c,"@type":u,url:location.origin},tags:null===(s=null===(o=this.newsroomStrategy)||void 0===o?void 0:o.getTags)||void 0===s?void 0:s.call(o,e)}}getEventTarget(e){const{link:t,itemId:n,title:i}=this.parseKilkayaData(e);return{id:n,name:this.normalizePlacementTitle(null!=i?i:""),type:"Page",url:t}}getEventInput(e,t){return{object:this.getEventBaseData(e),partnerstudio:this.getEventPartnerstudioData(e,t),target:this.getEventTarget(e),provider:this.getProviderData()}}getEventPartnerstudioData(e,t){const n=this.parseKilkayaData(e);return Object.assign(Object.assign({},n),{type:t,tracking_type:"ad",xandrAdLoaded:!1})}getProviderData(){return{productTag:"partnerstudio"}}}const ts="[data-k5a-teaser-analytics]",ns=(e,t,n)=>{const i=document.querySelectorAll("k5a-stream");if(!i.length)return;const r=new es(e,t,n),o=new WeakMap,s=e=>{const t=o.get(e);t&&(t.disconnect(),o.delete(e))},a=new IntersectionObserver((e,t)=>{e.forEach(e=>{if(!e.isIntersecting)return;const n=e.target,i=n.querySelector(ts);Boolean(null==i?void 0:i.dataset.k5aTeaserAnalytics)?(r.trackContentView(n),t.unobserve(e.target),s(n)):((e,t)=>{if(o.has(e))return;const n=new MutationObserver(()=>{const n=e.querySelector(ts);Boolean(null==n?void 0:n.dataset.k5aTeaserAnalytics)&&(r.trackContentView(e),t.unobserve(e),s(e))});n.observe(e,{attributes:!0,childList:!0,subtree:!0,attributeFilter:["data-k5a-teaser-analytics"]}),o.set(e,n)})(n,t)})},{threshold:.5});i.forEach(e=>{a.observe(e),e.addEventListener("click",()=>r.trackContentClick(e))})};class is{handleKilkayaStreamTracking({pulse:e,pageType:t,publisher:n}){if(!(null==e?void 0:e.instance))return;const i={[it.VG]:new Qo}[n]||new Xo;ns(e.instance,i,t)}injectKilkayaMeta(e){const t=document.createElement("script");t.textContent=`var k5aMeta = { consent: ${e} };`,document.head.appendChild(t)}observeForKilkayaBackfills(){document.addEventListener("K5A:EmptyStreamSlot",e=>{var t;const n=null===(t=null==e?void 0:e.detail)||void 0===t?void 0:t.streamSlot;if(!n)return;const i=n.parentElement;i&&(v(`Kilkaya placement ${n.getAttribute("name")} has not been loaded, loading Xandr backfill`),this.showBackfill(i))})}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:"";$n(i)}loadKilkayaScript(t){return e(this,void 0,void 0,function*(){yield Bt(t)})}run(t){return e(this,void 0,void 0,function*(){const{tcf:e,isMobileApp:n,country:i,kilkaya:r}=t;if(!(null==r?void 0:r.enabled))return;const o=yield E(e,n,i,"kilkaya");o&&(this.observeForKilkayaBackfills(),this.injectKilkayaMeta(o),yield this.loadKilkayaScript(r.url),this.handleKilkayaStreamTracking(t))})}}const rs=1e4,os=e=>e.some(e=>e.some(e=>!!e&&Di(e,0)));let ss;const as=()=>{const{widescreenSwitching:e}=l.get(),{enabled:t,rotationInterval:n=rs,widescreenIdPrefix:i}=null!=e?e:{};if(!t)return;const r=((e="widescreen")=>{const{pageSectionsSelectors:{right:t}={}}=l.get();return t?Array.from(document.querySelectorAll(t)).map(t=>Array.from(t.querySelectorAll(`div[id^="${e}"]`))):[]})(i);let o=0,s=Date.now(),a=os(r);if(!r.length)return;ss&&window.removeEventListener("scroll",ss);const d=(e,t,n)=>{e.forEach(e=>{e&&e.style.setProperty(t,n)})},c=e=>1===e?0:1;(e=>{e.forEach(e=>{e[0]&&(e[0].style.display="block",e[0].style.opacity="1"),e[1]&&(e[1].style.display="none",e[1].style.opacity="")})})(r);const u=((e,t)=>{let n=null;return(...i)=>{null===n&&(e(...i),n=setTimeout(()=>{n=null},t))}})(()=>{a||(a=os(r)||a,s=Date.now());Date.now()-s>=n&&((()=>{const e=c(o),t=r.map(e=>e[o]),n=r.map(t=>t[e]);d(t,"opacity","0"),setTimeout(()=>{d(t,"display","none"),d(n,"opacity","0"),d(n,"display","block"),setTimeout(()=>{d(n,"opacity","1")},450)},450)})(),o=c(o),s=Date.now())},1e3);ss=u,window.addEventListener("scroll",u)},ds=e=>document.querySelector(`#${e}`);let ls,cs=[];const us=["takeover","wallpaper"],vs=e=>{const t=(e=>{const t=qt.getData("alertoryConfigKeywords"),{queryConfig:n,placements:i,tcf:r,glimr:o,appearanceConfig:s,requestSize:d=a,publisher:l,country:c,pageType:u,deviceType:v,isMobileApp:p=!1,pageOptions:{member:g},takeover:h,fullscreenScroll:m,useAppTabletInvCode:y}=e;return{xandr:{member:g,keywords:t,tags:[]},advertory:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({publisher:l,country:c,pageType:u,deviceType:v,placements:i,tcf:r,requestSize:d,isMobileApp:p,useAppTabletInvCode:y},o&&{glimr:o}),n&&{queryConfig:n}),s&&{appearanceConfig:s}),h&&{takeover:h}),m&&{fullscreenScroll:m})}})(e);window.advertory={initialized:!0,siteConfig:e,alertoryConfig:t}},ps=()=>e(void 0,void 0,void 0,function*(){const{pageOptions:t}=l.get(),{preparePageOptions:n}=l.getHandlers(),i=(()=>{const{sandboxAdIframeEnabled:e=!0}=l.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"]}})(),r=yield e(void 0,void 0,void 0,function*(){const{tcf:e,isMobileApp:t,country:n}=l.get();return(yield E(e,t,n,"page-options"))?{}:{userSync:{disabled:!0}}}),o=yield n(Object.assign(Object.assign(Object.assign({disablePsa:!0,enableSafeFrame:!0},t),{renderingManagement:Object.assign({},i)}),r));(e=>{const t=qt.getData("alertoryConfigKeywords");if(Object.keys(t).length)return;const n=Fr(e);qt.setData("alertoryConfigKeywords",n)})(o.keywords),En(()=>ls.setPageOpts(o))}),gs=t=>e(void 0,void 0,void 0,function*(){const{prebid:e,tcf:n,isMobileApp:i,country:r}=l.get(),o=yield E(n,i,r,"loadPlacements"),s=((e,t)=>t?e:(e.filter(e=>!e.supportsNonRTB).forEach(e=>Ln(e.id)),e.filter(e=>e.supportsNonRTB).map(e=>{return Object.assign(Object.assign({},e),{invCode:(t=e.invCode,`${t}_non_rtb`)});var t})))(t,o);hs(s);(null==e?void 0:e.enabled)&&o&&!st()?(v("core loadPlacements prebid enabled"),yield hn()):(v("core load tags invoked without prebid enabled"),ms(s))}),hs=e=>{const{prepareTag:t}=l.getHandlers(),n=[];(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=>{v("core defineTags",{placement:e});const i=Dr(e);if(Mr(e.id)){const r=t(i),o=(e=>{const{allowedFormats:t,invCode:n,keywords:i,sizes:r}=e;return{adTypes:t,invCode:n,keywords:Br(i),sizes:r}})(r);n.push(o),En(()=>(v("core defineTag - add to the queue",{placement:e,preparedTag:r}),ls.defineTag(r)))}}),(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)})(n)},ms=e=>{const t=e.filter(({id:e})=>Mr(e)).map(({id:e})=>e);t.length&&En(()=>(v("core loadTags",{placementsIdsToLoad:t}),ls.loadTags([...t])))},ys=(t,n)=>e(void 0,void 0,void 0,function*(){const{appearanceConfig:e,deviceType:i}=l.get(),{threshold:r,refresh:o}=t,s=(e=>{const t=document.querySelector(`[data-show-tag-subscribe-id=${e.targetId}]`),n=document.querySelector(`#${e.targetId}`);return t||n})(n),a=null==e?void 0:e.defaultThreshold[i];s&&(v("core showAd - subscribe for show tag with thresholds",{placement:t,adObj:n,threshold:r,deviceDefaultThreshold:a}),yield Ai(s,null!=r?r:a)),s&&o&&(v("core showAd - setup refreshing",{placement:t,adObj:n}),s.dataset.refresh=o.toString())}),fs=e=>e.some(({id:e})=>us.some(t=>e.includes(t))),ws=t=>e(void 0,void 0,void 0,function*(){var n;if(!(null===(n=null===window||void 0===window?void 0:window.advertory)||void 0===n?void 0:n.initialized))return;const[i,r]=(e=>e.reduce(([e,t],n)=>{var i;return(null===(i=null==n?void 0:n.finnBlink)||void 0===i?void 0:i.loadOnlyFinnBlink)?[[...e,n],t]:[e,[...t,n]]},[[],[]]))(t),o=(e=>{const{requestSize:t=a,queryConfig:{placementBatches:n}={},deviceType:i}=l.get(),r=Bn(e),o=Object.keys((null==n?void 0:n[i])||{}).map(e=>r[e]||[]).filter(e=>e.length>0),s=new Set(o.flat().map(({id:e})=>e)),d=e.filter(({id:e})=>!s.has(e));return[...o,...Ni(d,t)]})(r);for(const e of o)fs(e)?(v("core loadAds without lazy loading",{placementsToLoad:e}),yield gs(e)):e.length&&(v("core loadAds with lazy loading",{placementsToLoad:e}),yield bs(e));yield(t=>e(void 0,void 0,void 0,function*(){if(!t.length)return;const{appearanceConfig:e,deviceType:n}=l.get(),i=null==e?void 0:e.defaultThreshold[n];for(const e of t){const{threshold:t,id:n}=e,r=ds(n);r&&(yield Ai(r,null!=t?t:i))}}))(i)}),bs=t=>e(void 0,void 0,void 0,function*(){const{queryConfig:{lazyLoadingV3:{enabled:e=!1,rootMargin:n="200% 0px"}={}}={}}=l.get(),i=[];if(!e)return v("lazy load is not enabled",{placements:t}),void(yield gs(t));const r=new IntersectionObserver((e,n)=>{e.filter(({isIntersecting:e,target:{id:t}})=>e&&!t.includes("wallpaper")).forEach(e=>{v("lazy load is enabled - handler start",{loadedPlacementIds:i,placements:t});const r=t.every(e=>i.includes(e.id)),o=t.map(e=>e.id);!r&&i.push(...o),!r&&gs(t),v("lazy load is enabled - handler stop",{loadedPlacementIds:i,placements:t,arePlacementsLoaded:r,placementIds:o}),n.disconnect()})},{rootMargin:n});t.forEach(e=>{const t=document.getElementById(e.id);t&&(v("lazy loading - observe element",{placementId:e.id,element:t}),r.observe(t))})}),Es=()=>e(void 0,void 0,void 0,function*(){const{siteEvents:t,initNativeAd:n,wallpaperHandlers:{initWallpaperAd:i,adjustAdToHorseshoe:r}}=l.getHandlers(),{wallpaper:o,fullscreenScroll:s}=l.get(),a=[];En(()=>{ls.onEvent("adRequested",()=>{t.adRequested()}),ls.onEvent("adAvailable",r=>e(void 0,void 0,void 0,function*(){var e,a,d,c,u,p;v("core adAvailable start",{placementsAvailable:cs,adObj:r,isFullscreenScrollAd:Ce(r),isFinnBlink:Ne(r.targetId),isNativeAd:Oe(r),isMediation:Rr(r),isTakeoverAd:Le(r),isCollapseAd:xe(r),isWallpaperAd:je(r)});const g=null===(d=null===(a=null===(e=null===window||void 0===window?void 0:window.apntag)||void 0===e?void 0:e.requests)||void 0===a?void 0:a.tags[r.targetId])||void 0===d?void 0:d.adResponse.ads;Rr(r)&&g&&(null===(c=g[1])||void 0===c?void 0:c.rtb)&&(r.banner=null===(p=null===(u=g[1])||void 0===u?void 0:u.rtb)||void 0===p?void 0:p.banner),Ce(r)&&un(r),Me(r)&&as(),Ce(r)&&!Ne(r.targetId)&&cn(r,s),!Oe(r)||Rr(r)||Ne(r.targetId)||n(r,l.get()),Le(r)&&!xe(r)&&(Ir(r.targetId),yield Ar(r)),je(r)&&(i(()=>En(()=>window.apntag.showTag(r.targetId)),o),qt.setData("wallpaper",{isAvailable:!0})),(e=>e.targetId.includes("skyscraperleft")&&!!e.banner)(r)&&qt.setData("horseshoe",{isAvailable:!0}),Pr({adObj:r}),(e=>{var t;const n=null==e?void 0:e.targetId;if(!n)return;const i=null===(t=document.querySelector(`#${n}`))||void 0===t?void 0:t.parentElement;i&&((e,t)=>{const{height:n,width:i,native:r}=e;r?t.dataset.adSizes="[1,1]":n&&i&&(t.dataset.adSizes=`[${i},${n}]`)})(e,i)})(r),t.adAvailable(r);const h=cs.find(({id:e})=>e===r.targetId);h&&(yield ys(h,r),cs=cs.filter(e=>e.id!==h.id)),v("core adAvailable stop",{placementsAvailable:cs,adObj:r,isFullscreenScrollAd:Ce(r),isFinnBlink:Ne(r.targetId),isNativeAd:Oe(r),isMediation:Rr(r),isTakeoverAd:Le(r),isCollapseAd:xe(r),isWallpaperAd:je(r)})})),ls.onEvent("adLoaded",e=>{const{refreshConfig:i,appearanceConfig:o}=l.get(),s=document.getElementById(e.targetId);Ne(e.targetId)&&(e=>{const{fullscreenScroll:t}=l.get(),{initNativeAd:n}=l.getHandlers();Ce(e)&&cn(e,t),Oe(e)&&n(e,l.get())})(e);a.includes(e.targetId)&&Oe(e)&&(n(e,l.get()),Pr({adObj:e})),!a.includes(e.targetId)&&Rr(e)&&a.push(e.targetId),xe(e)&&Ln(e.targetId),Le(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"]})})(ls,e.targetId),Pe(e)&&(e=>{const t=document.querySelector(`#${e.targetId}`),{siteSpecificConfig:{publisherClassName:n,fullWidthFormatClassName:i}={}}=l.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=>Ve(e,we))(e)&&(e=>{var t;const n=document.querySelector(`#${e.targetId}`),i=null===(t=document.querySelector(`#${e.targetId}`))||void 0===t?void 0:t.parentElement,r=null==n?void 0:n.querySelector("iframe"),o=null==r?void 0:r.parentElement,{siteSpecificConfig:{publisherClassName:s,fullWidthFormatClassName:a}={}}=l.get();if(!(n&&r&&o&&i))return;i.classList.add(`advertory-${s}-${a}__vertical-full-width-ad-wrapper`);const d=window.innerWidth,c=Math.round(d/1080*1920);n.style.width="100%",n.style.height=`${c}px`,n.classList.add(`advertory-${s}-${a}__vertical-full-width-ad`);const u=$r(e,n.offsetWidth);o.style.transform=`scale(${u})`,o.style.transformOrigin="left top"})(e),((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;ji({adWrapper:r,placementContainer:i});const{delayTime:o=1e3}=t,s=(new Date).getTime();i&&"true"!==i.dataset.subscribedForRefresh&&(i.dataset.subscribedForRefresh="true",i.dataset.refresh&&_i(i,s,o))})(e,i),(null==o?void 0:o.clearProbableDimensionsEnabled)&&(e=>{const t=document.querySelector(`#${e}`);t&&(t.style.minWidth="",t.style.minHeight="")})(e.targetId);qt.getData("horseshoe").isAvailable&&r(e.targetId),_r(e),t.adLoaded(e),vn(e.targetId),s&&(s.classList.add(gn),(e=>{var t,n;const{siteSpecificConfig:i}=l.get(),r=null!==(t=null==i?void 0:i.mainColumnWidth)&&void 0!==t?t:1/0;e.clientWidth>r&&(null===(n=e.parentElement)||void 0===n||n.setAttribute("data-two-column-ad-layout","true"))})(s)),xr(e),window.dispatchEvent(new CustomEvent("advertory:adLoaded",{detail:{targetId:e.targetId,adFormat:Lr(e)}}))}),ls.onEvent("adNoBid",n=>e(void 0,void 0,void 0,function*(){Ln(n.targetId),yield li(l.get(),n),or(n)&&(yield rr()),t.adNoBid(n)})),ls.onEvent("adError",(n,i)=>e(void 0,void 0,void 0,function*(){or(i)&&(yield rr()),t.adError(n,i)})),ls.onEvent("adCollapse",()=>{t.adCollapse()}),ls.onEvent("adRequestFailure",n=>e(void 0,void 0,void 0,function*(){Ln(n.targetId),yield li(l.get(),n),t.adRequestFailure(n)})),ls.onEvent("adBadRequest",n=>e(void 0,void 0,void 0,function*(){Ln(n.targetId),yield li(l.get(),n),t.adBadRequest(n)})),ls.onEvent("adLoadedMediated",e=>t.adLoadedMediated(e)),ls.onEvent("adNoBidMediated",n=>e(void 0,void 0,void 0,function*(){yield li(l.get(),n),t.adNoBidMediated(n)}))})}),Ts=(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 _n(),[];r&&(_n(),document.querySelectorAll('[data-advertory-ad-rendered="true"]').forEach(e=>{$n(e.id)})),c(null!=t?t:{}),yield ps();const{clientSidePlacements:a,serverSidePlacements:d}=Mo(Mn(s));let u=a;return o&&(u=u.filter(e=>Ne(e.id))),Bo(d,l.get()),u.length>0&&(cs=[...cs,...u.map(e=>Object.assign({},e))],Mi(u),Bi(u),yield ws(u)),cs}),Ss=(t,n)=>e(void 0,void 0,void 0,function*(){var i;l.set(t),l.setHandlers(n),qt.initialize(),window.addEventListener("message",Ei,!1),ls=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=ls,v("Apn tag is set up on window"),yield Promise.allSettled([e(void 0,void 0,void 0,function*(){const{tcf:e,isMobileApp:t,country:n}=l.get();(yield E(e,t,n,"xandr-endpoint"))||ls.setEndpoint("ib.adnxs-simple.com",!0)}),e(void 0,void 0,void 0,function*(){if(st())return;const{prebid:e,tcf:t,isMobileApp:n,country:i}=l.get(),r=yield E(t,n,i,"prebid");(null==e?void 0:e.enabled)&&r&&(yield Bt(null==e?void 0:e.url))}),ce(t),e(void 0,void 0,void 0,function*(){const{astUrl:e}=l.get();yield Bt(null!=e?e:"https://adsdk.microsoft.com/ast/ast.js")}),e(void 0,void 0,void 0,function*(){const{gptUrl:e,tcf:t,isMobileApp:n,country:i}=l.get();(yield E(t,n,i,"gpt-endpoint"))&&(yield Bt(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,isMobileApp:i,country:r}=l.get(),{getConsentAsync:o}=b(n,0,r),s=yield o();if(e&&t&&s){if(yield Bt(t),document.querySelector(`.${kr}`))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(kr)})&&(t.disconnect(),window._brandmetrics=window._brandmetrics||[],window._brandmetrics.push({cmd:"_loadsurvey"}))}}).observe(document,{childList:!0,subtree:!0,attributes:!0})}}),U(),e(void 0,void 0,void 0,function*(){const{gdpr:{url:e,allowHidingAds:t=!0}={}}=l.get();t&&(window.gdpr=window.gdpr||{},window.gdpr.allowHidingAds=!0),yield Bt(null!=e?e:"https://cogwheel.inventory.schibsted.io/prod/latest/gdpr-bundle.js")})]),yield Cr(),v("Libraries have been loaded and trackers have been set"),yield(i=n.librariesToLoad,e(void 0,void 0,void 0,function*(){const e=i.map(e=>Bt(e));yield Promise.all(e)})),yield Es(),yield ps(),v("Page options have been set"),vs(t),v("Advertory is setup on window");const{clientSidePlacements:r,serverSidePlacements:o}=Mo(Mn());cs=r,Bo(o,t),Mi(cs),Bi(cs),yield ws(cs),v("Ads has been loaded",cs),ci(t,cs),Ur(cs),yield n.replaceAdsWithFinnBlink(t.finnBlink),yield(t=>e(void 0,void 0,void 0,function*(){var e;if(!t.drEdition)return;if(!(yield E(t.tcf,t.isMobileApp,t.country,"handleDrEdition")))return;const n=yield ri(),i=new oi(n);si({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)}))(t),(e=>{if(!(null==e?void 0:e.enabled)||Jo)return;const{splitPointIDs:t,adSelector:n,trackSelector:i=Vo}=e,r=document.querySelector(i);if(!r)return;Jo=!0;const o=()=>{Yo(r,n,t)};o(),window.addEventListener("resize",o),window.addEventListener("orientationchange",o),window.addEventListener("load",o),window.addEventListener("advertory:adLoaded",()=>{requestAnimationFrame(o)}),new ResizeObserver(o).observe(r)})(t.rightColumnSplit),yield(t=>e(void 0,void 0,void 0,function*(){const e=new is;yield e.run(t)}))(t)}),Is=(t,n)=>e(void 0,void 0,void 0,function*(){yield((t,n)=>e(void 0,void 0,void 0,function*(){const{initConsentManager:e,getConsentAsync:i}=b(t.tcf,t.isMobileApp,t.country),r=yield Uo(t);yield ai(),yield Vr(e),yield Vr(i),v("TCF resolved successfully"),yield Ss(r,n),v("Run function resolved successfully")}))(t,n)}),As=()=>{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},ks=e=>{const{siteSpecificConfig:t}=l.get(),n=(null==t?void 0:t.dynamicOutstreamFormats)||[];return 0!==n.length&&n.some(t=>e.includes(t))},Cs=((e,t)=>n=>Is(Object.assign(Object.assign({},n),{siteSpecificConfig:t}),e))({initNativeAd:(e,t)=>{const{targetId:n}=e,i=document.querySelector(`#${n}`);if(!i)return;const{pageType:r=wt.FRONT,deviceType:o,nativeTrackingConfig:s,appearanceConfig:a}=null!=t?t:{},d={language:u.SE,publisher:it.AFTONBLADET,deviceType:o,pageType:r,nativeTrackingConfig:s,appearanceConfig:a};ft(e,d,xt),tt(e,null==t?void 0:t.sponsorstripe),Ue(e)&&_t(i)},wallpaperHandlers:{initWallpaperAd:bn,adjustAdToHorseshoe:bn},loadFinnBlinkAd:wn,replaceAdsWithFinnBlink:wn,preparePageOptions:me,prepareTag:e=>{const{keywords:t,targetId:n,invCode:i,dynamicSizeWidthCheck:r}=e,{useAppTabletInvCode:o=!0,country:s}=l.get(),a=((e,t)=>{const{isMobileApp:n}=l.get();return n?((e,t)=>e.replace(/wtb|wde|wph/g,e=>"wph"===e?"aph":t?"atb":e))(e,t):e})(i,o),d=(e=>{const{country:t}=l.get(),{keywords:n,dynamicSizeWidthCheck:i}=e,r=`${K(t)}-adformat`,o=n?n[r]:[];if(!o)return{};const s=(Array.isArray(o)?o:[o]).filter(e=>!(e in ke)||window.innerWidth>=ke[e]);return{[r]:i?s:o}})(e),c=(e=>{const{country:t}=l.get(),n=`${K(t)}-targetid`;return e?{[n]:[e]}:{}})(n),u=(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}})(a),v=As(),p={[`${K(s)}-adreload`]:"0"},g=(e=>ks(e)?{"aa-sch-dynamic-outstream":["true"]}:{})(i),h=Object.assign({},((e,t)=>ks(e)?Object.assign(Object.assign({},t),{playerSkin:{videoBackgroundColor:"#e6e7e8"}}):{})(i,{safeFrameAutoInitialSize:!0})),m=r&&e.sizes.length>0?e.sizes.filter(([e])=>e<=window.innerWidth):e.sizes;return Object.assign(Object.assign({},e),{sizes:m,invCode:a,keywords:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},t),d),c),u),p),g),v),rendererOptions:h})},siteEvents:nt,librariesToLoad:[]},rt);var Os=Object.freeze({__proto__:null,default:""});export{$o as getAdsConfig,ge as getVideoPPIDs,Cs as initAdvertoryPackage,Ts as updateAdvertory};