@schibsted/advertory 2.71.18 → 2.72.1

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 (134) 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/aftenposten/index.js +1 -1
  96. package/sites/aftenpostenv2/es/index.css +1 -1
  97. package/sites/aftonbladet/es/index.css +1 -1
  98. package/sites/aftonbladetv2/es/index.css +1 -1
  99. package/sites/bt/es/index.css +1 -1
  100. package/sites/bt/index.js +1 -1
  101. package/sites/btv2/es/index.css +1 -1
  102. package/sites/e24/es/index.css +1 -1
  103. package/sites/fotbollskanalen/es/index.css +1 -1
  104. package/sites/koket/es/index.css +1 -1
  105. package/sites/sa/es/index.css +1 -1
  106. package/sites/sa/index.js +1 -1
  107. package/sites/sav2/es/index.css +1 -1
  108. package/sites/svd/es/index.css +1 -1
  109. package/sites/svd/index.js +1 -1
  110. package/sites/svdv2/es/index.css +1 -1
  111. package/sites/tv4/es/index.css +1 -1
  112. package/sites/tvnu/index.js +1 -1
  113. package/sites/vg/es/index.css +1 -1
  114. package/sites/vg/index.js +1 -1
  115. package/sites/vgv2/es/index.css +1 -1
  116. package/styles/aftonbladetv2/styles.css +1 -1
  117. package/types/core/interface/ast.d.ts +1 -1
  118. package/types/core/interface/config.d.ts +2 -0
  119. package/types/features/ad-native/trackers/trackers.d.ts +1 -1
  120. package/types/features/ad-server-side/banner-object.d.ts +4 -0
  121. package/types/features/ad-server-side/banner-object.test.d.ts +1 -0
  122. package/types/features/ad-server-side/cogwheel.d.ts +3 -0
  123. package/types/features/ad-server-side/constants.d.ts +2 -0
  124. package/types/features/ad-server-side/index.d.ts +5 -0
  125. package/types/features/ad-server-side/keywords.d.ts +3 -0
  126. package/types/features/ad-server-side/keywords.test.d.ts +1 -0
  127. package/types/features/ad-server-side/native-request.d.ts +42 -0
  128. package/types/features/ad-server-side/native-request.test.d.ts +1 -0
  129. package/types/features/ad-server-side/server-side-xandr-renderer.d.ts +3 -0
  130. package/types/features/ad-server-side/server-side-xandr-service.d.ts +7 -0
  131. package/types/features/cogwheel/index.d.ts +1 -1
  132. package/types/features/interface/ad-native.d.ts +1 -0
  133. package/types/features/interface/ad-server-side.d.ts +48 -0
  134. package/types/features/tracker/index.d.ts +3 -2
@@ -1 +1 @@
1
- import"react/jsx-runtime";function e(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(i=Object.getOwnPropertySymbols(e);o<i.length;o++)t.indexOf(i[o])<0&&Object.prototype.propertyIsEnumerable.call(e,i[o])&&(n[i[o]]=e[i[o]])}return n}function t(e,t,n,i){return new(n||(n=Promise))(function(o,r){function s(e){try{d(i.next(e))}catch(e){r(e)}}function a(e){try{d(i.throw(e))}catch(e){r(e)}}function d(e){var t;e.done?o(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 n(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var i,o;"function"==typeof SuppressedError&&SuppressedError;var r=n(function(){if(o)return i;o=1;var e=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var n=Object.prototype.toString.call(e);return"[object RegExp]"===n||"[object Date]"===n||function(e){return e.$$typeof===t}(e)}(e)},t="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function n(e,t){return!1!==t.clone&&t.isMergeableObject(e)?l((n=e,Array.isArray(n)?[]:{}),e,t):e;var n}function r(e,t,i){return e.concat(t).map(function(e){return n(e,i)})}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,i){var o={};return i.isMergeableObject(e)&&s(e).forEach(function(t){o[t]=n(e[t],i)}),s(t).forEach(function(r){(function(e,t){return a(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))})(e,r)||(a(e,r)&&i.isMergeableObject(t[r])?o[r]=function(e,t){if(!t.customMerge)return l;var n=t.customMerge(e);return"function"==typeof n?n:l}(r,i)(e[r],t[r],i):o[r]=n(t[r],i))}),o}function l(t,i,o){(o=o||{}).arrayMerge=o.arrayMerge||r,o.isMergeableObject=o.isMergeableObject||e,o.cloneUnlessOtherwiseSpecified=n;var s=Array.isArray(i);return s===Array.isArray(t)?s?o.arrayMerge(t,i,o):d(t,i,o):n(i,o)}return l.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce(function(e,n){return l(e,n,t)},{})},i=l}());const s=["deviceType","pageType","placements","takeover","refreshConfig","editableConfiguration"],a={adRequested:()=>{},adAvailable:e=>{},adLoaded:e=>{},adNoBid:e=>{},adError:(e,t)=>{},adCollapse:()=>{},adRequestFailure:e=>{},adBadRequest:e=>{},adLoadedMediated:e=>{},adNoBidMediated:e=>{}},d=6;class l{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 s){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(l.DEFAULT_SITE_HANDLERS,e)}}l.DEFAULT_SITE_HANDLERS={siteEvents:a,initNativeAd:function(){}};const c=new l,u=c.modifyConfigProperties.bind(c),v={NO:"no",SE:"se"},p={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"},g=(e,t)=>{const n="[Advertory LOG]: ";location.search.includes("ast_debug=true")&&(t?console.log(n,e,t):console.log(n,e))},h=e=>new URLSearchParams(window.location.search).get(e),m="takeover",y="native_override_desc2",f=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 g("Advertising permission value obtained synchronously: ",e),Boolean(t)})();if(null!==n)return void t(n);let i=!1;const o=e=>{i||(g("Resolving advertising permission value obtained"),i=!0,t(e))},r=setTimeout(()=>{g("Advertising permission timed out, resolving with false"),o(!1)},3e3);window._tcf_.onTcfReady(()=>{g("On Tcf Ready called, waiting for permission"),clearTimeout(r)}),window._tcf_.getPermission("CMP:advertising",e=>{clearTimeout(r);const t=Number(e);g("Advertising permission value obtained asynchronously: ",e),o(Boolean(t))})}),w="cmp:loaded";let b="undefined"!=typeof window?window._tcf_:void 0,E=!1;const T=(e,n,i)=>{const o=!!(null==e?void 0:e.enabled),r=(null==e?void 0:e.timeout)||3e3,s=h("bypass_tcf"),a=()=>{if(!(null==e?void 0:e.enabled))return!0;if(((e,t)=>e?!!t&&(g("TCF bypass param detected, returning consent: true"),!0):(g("TCF is not enabled, returning consent: true"),!0))(o,s))return!0;if(E)return null;if(!b)throw new Error("[Advertory]: getConsentSync method was called before the tcfManager was available.");const t=b.getConsentedToAllSync();return g(`TCF consented to all is: ${t}`),b.getConsentedToAllSync()};return{initConsentManager:()=>(null==e?void 0:e.enabled)?new Promise((e,t)=>{if(g("Getting TCF consent manager..."),window._tcf_)return g("TCF consent manager is already available"),b=window._tcf_,void e(b);g("TCF consent manager is not available");const n=()=>{g("CMP loaded, resolving consent manager..."),i&&clearTimeout(i),window._tcf_?(b=window._tcf_,e(b)):t(new Error("CMP loaded but window._tcf_ is not defined"))},i=setTimeout(()=>{document.removeEventListener(w,n),E=!0,t(new Error("Timeout waiting for CMP to load"))},r);g("Listening for CMP loaded event..."),document.addEventListener(w,n,{once:!0})}):Promise.resolve(null),getConsentSync:a,getConsentAsync:()=>t(void 0,void 0,void 0,function*(){if(null==e?void 0:e.schibstedAdChoicesOverrideValue)return g(`Schibsted Ad Choices override value is set, returning override value: ${e.schibstedAdChoicesOverrideValue}`),Boolean(Number(e.schibstedAdChoicesOverrideValue));const t=(null==e?void 0:e.schibstedAdChoicesEnabled)&&i===v.SE,n=(null==e?void 0:e.schibstedAdChoicesEnabled)&&i===v.NO;if(t||n)return g("Schibsted Ad Choices is enabled, getting advertising permissions..."),yield f(e);if(!(null==e?void 0:e.enabled))return!0;const o=a();return null!==o?o:yield new Promise((e,t)=>{try{if(!b)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(()=>{g("TCF isConsentedToAll timed out, resolving with false"),n(!1)},r);b.onTcfReady(()=>{g("On Tcf Ready called, waiting for consent"),clearTimeout(i)}),b.isConsentedToAll(t=>{clearTimeout(i),e(t)})}catch(e){t(e)}})})}},I=(e,n,i,...o)=>t(void 0,[e,n,i,...o],void 0,function*(e,t,n,i="NOT SPECIFIED FEATURE"){if(!(null==e?void 0:e.schibstedConsentToPayEnabled))return g(`Schibsted Consent to Pay is not enabled, returning true for ${i}`),!0;if(null==e?void 0:e.schibstedAdChoicesOverrideValue)return g(`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:o}=T(e,0,n);return(yield o())?(g(`Schibsted Ad Choices consent given according to TCF consent manager for ${i}`),!0):(g(`Schibsted Ad Choices consent not given according to TCF consent manager for ${i}`),!1)}),k=e=>{const t=encodeURIComponent(e).replace(/[-.+*]/g,"\\$&"),n=new RegExp(`(?:(?:^|.*;)\\s*${t}\\s*\\=\\s*([^;]*).*$)|^.*$`);return decodeURIComponent(document.cookie.replace(n,"$1"))||null},A=()=>{const e=k("_pulse2data");return e?e.split(",")[2]:void 0},C={MOBILE:"mobile",TABLET:"tablet",DESKTOP:"desktop"},S=9826;class O{constructor(){this.getSupplyTypeKeywords=()=>{const{deviceType:e=C.DESKTOP,isMobileApp:t}=c.get();if(t){return{"aa-sch-supply_type":`app_${e===C.MOBILE?"phone":C.TABLET}`}}return{"aa-sch-supply_type":`web_${this.getPageOptionsFormatDevice(e)}`}}}prepare(e){return t(this,void 0,void 0,function*(){return Object.assign(Object.assign({},e),{keywords:Object.assign(Object.assign(Object.assign(Object.assign({},e.keywords),this.getSupplyTypeKeywords()),yield this.getFormattedExternalIdKeywords()),this.getHasContextKeywords(e.keywords)),user:{externalUid:yield this.getExternalUid(),dnt:yield this.isTrackingForbidden()}})})}getFormattedExternalIdKeywords(){return t(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 A()}getExternalUid(){return t(this,void 0,void 0,function*(){return yield(e=>t(void 0,void 0,void 0,function*(){const{tcf:t,isMobileApp:n,country:i}=e,{getConsentAsync:o}=T(t,0,i);if(!(yield o()))return;const r=k("_pulse2data");return r?r.split(",")[9]:void 0}))(c.get())})}isTrackingForbidden(){return t(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=S}=c.get();return"true"===h("inventory_test")?t:e}getCMPValue(e){return localStorage.getItem(`CMP:${e}`)?"0"===localStorage.getItem(`CMP:${e}`)?"0":"1":"0"}getPublisherKeywords(){const{publisher:e}=c.get();return{"aa-sch-publisher":`${e}`}}getAnalyticsConsentKeywords(){return{"aa-sch-cmp_analytics":this.getCMPValue("analytics")}}getAdvertisingConsentKeywords(){return t(this,void 0,void 0,function*(){const{tcf:e,isMobileApp:t,country:n}=c.get(),{getConsentAsync:i}=T(e,0,n);return{"aa-sch-cmp_advertising":(yield i())?"1":"0"}})}getPageTypeKeywords(){const{pageType:e}=c.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}=c.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 P=new O;P.prepare.bind(P);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(),o=(()=>{const e=window.navigator.userAgent.toLowerCase(),t=[["win","windows"],["macintosh","macos"],["x11","linux"],["android","android"],["ipad","ios"],["iphone","ios"]].find(([t])=>e.includes(t));return t?t[1]:"unknown"})();return{OS:o,mobileOS:["ios","android"].includes(o)?o:"unknown",isHybridApp:i.includes("hermes"),appMode:e?"hybrid":"notinapp"}}const L=["aLOLE","xBqQj","1KaqJ","1nzXzK","opm8zV","4qKXKR","Ad9QgE"];function x(e){return t=window.location.pathname.split("/").slice(-2,-1).pop()||"",L.includes(t)?{"no-sno-news-section":`${e}_doedsfall`}:{};var t}class N extends O{constructor(){super(...arguments),this.getDeviceKeywords=()=>{const{deviceType:e=C.DESKTOP}=c.get();return{"no-sno-device":this.getPageOptionsFormatDevice(e)}}}getAppTypeKeywords(){const{deviceType:e,isMobileApp:t}=c.get(),{OS:n,isHybridApp:i}=$(t);return{"no-sno-apptype":n&&e&&i?`${n}_${this.getPageOptionsFormatDevice()}_hybrid`:"none"}}getObituariesKeywords(e){return x(e)}getSectionPageTypeKeywords(){var e,t;const{pageOptions:n,pageType:i}=c.get(),o=null!==(t=null===(e=n.keywords["no-sno-news-section"])||void 0===e?void 0:e.toString())&&void 0!==t?t:"ettan";return{"no-sno-section-page_type":`${o.split("_").pop()||o}_${"article"===i?"article":"front"}`}}}const j=864e5,_=(()=>{const e=e=>{const t=window.localStorage.getItem(e);if(!t)return null;try{return JSON.parse(t)}catch(e){return g("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=j)=>{const o={data:n,expirationTime:(new Date).getTime()+i};t(e,JSON.stringify(o))},getByTimestamp:(t,n=j)=>{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 g("Error with parsing localStorage data"),null}}}})(),q="glimrTags",D=["glwe_","glwet_"],B={geofenceTags:[],geoTags:[],weatherTags:[]},M=(...e)=>t(void 0,[...e],void 0,function*(e=c.get()){const{tcf:t,isMobileApp:n,country:i}=e;if(null==t?void 0:t.schibstedConsentToPayEnabled){return yield I(t,n,i,"glimr")}const{getConsentAsync:o}=T(t,0,i);return yield o()}),R=()=>t(void 0,void 0,void 0,function*(){const{glimr:e}=c.get();if(!(yield M())||!(null==e?void 0:e.enabled))return void g("No consent for glimr data fetching.");const n=yield(i=500,t(void 0,void 0,void 0,function*(){return yield Promise.race([t(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(t=>{n.getTags(e.clientId,(e,n)=>{_.setWithTimestamp(q,{tags:e,tagMappings:n}),t(!0)})})}catch(e){g(`Error during getting glimr data: ${e}`)}else g("Timeout (500ms) while loading glimr package. Skipping glimr data fetching.",{glimr:n})}),F={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"},V=e=>D.some(t=>e.startsWith(t)),U=e=>e.startsWith("glgc_"),H=e=>!V(e)&&!U(e),z=e=>e===v.NO?"no-sno":"se-generic",W=()=>{const{country:e,publisher:t}=c.get();return`${e}-${t}`},K=(e,t)=>{const n=G();if(!n)return B;const i=((e=[])=>e.filter(V))(n),o=((e=[])=>e.filter(U))(n),r=((e=[],t,n)=>{const i=e.filter(H);if(n&&t){const{publisher:e}=t,n=F[e]||e;i.push(n)}return i})(n,e,t);return{geoTags:r,geofenceTags:o,weatherTags:i}},G=()=>{const e=_.getByTimestamp(q);return e&&"string"!=typeof e?null==e?void 0:e.tags:null},J={get:(e,n)=>t(void 0,void 0,void 0,function*(){const t=yield fetch(e,n);if(!t.ok)throw new Error(t.statusText);return yield t.json()}),post:(e,n,i)=>t(void 0,void 0,void 0,function*(){const t=JSON.stringify(i),o=yield fetch(e,{method:"POST",headers:n,body:t});if(!o.ok)throw new Error(o.statusText);return yield o.json()})},Q="advertory:ppids-cache",Y={[v.SE]:`SCH${v.SE.toUpperCase()}-EnvHash`,[v.NO]:`SCH${v.NO.toUpperCase()}-EnvHash`},X={[v.SE]:`SCH${v.SE.toUpperCase()}-UserHash`,[v.NO]:`SCH${v.NO.toUpperCase()}-UserHash`},Z={[v.SE]:`sch${v.SE}-envhash-v3`,[v.NO]:`sch${v.NO}-envhash-v3`},ee={[v.SE]:`sch${v.SE}-userhash-v3`,[v.NO]:`sch${v.NO}-userhash-v3`},te={[v.SE]:`'sch${v.SE}-iosid-v3'`,[v.NO]:`'sch${v.NO}-iosid-v3'`},ne={[v.SE]:`sch${v.SE}-androidid-v3`,[v.NO]:`sch${v.NO}-androidid-v3`},ie={[v.SE]:"sdrn:schibsted.com:user",[v.NO]:"sdrn:spid.no:user"};class oe{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 re=new class{constructor(){this.ppid1=null,this.ppid2=null}processPPIDs(e){return t(this,arguments,void 0,function*(e,t=1e4){var n,i;const o=yield Promise.race([new Promise(e=>{setTimeout(()=>e({xandr:{ppId1:"",ppId2:""}}),t)}),e.instance.getAdvertisingIdentifiers()]);this.setPPIDs(null===(n=o.xandr)||void 0===n?void 0:n.ppId1,null===(i=o.xandr)||void 0===i?void 0:i.ppId2)})}getPPIDs(){var e,t;return null!==this.ppid1&&null!==this.ppid2||g("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:""}},se=new class{constructor(){this.ppid1=null,this.ppid2=null,this.idfv=null,this.anId=null}processPPIDs(e,n){return t(this,void 0,void 0,function*(){var t,i,o,r,s,a,d,l,c,u,v;const p=_.get(Q),g=yield this.getNewPPIDs(e,n);if(this.shouldHash(p,g)){const n=null!==(t=e.hasherUrl)&&void 0!==t?t:"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===(o=g.anId)||void 0===o?void 0:o.plain),void this.setPPIDs(null!==(r=c.userId)&&void 0!==r?r:"",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||g("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 o in e){if((null===(n=e[o])||void 0===n?void 0:n.plain)!==(null===(i=t[o])||void 0===i?void 0:i.plain))return!0}return!1}cachePPIDs(e,t,n,i){const o=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}}:{});_.set(Q,o)}hashPPIDs(e,n){return t(this,void 0,void 0,function*(){try{const t=new Headers({"Content-Type":"application/json"});return yield J.post(n,t,e)}catch(e){return g("Error with hashing PPIDs",e),null}})}getNewPPIDs(e,n){return t(this,arguments,void 0,function*({clientId:e,instance:n},i){const o=yield((e,n)=>t(void 0,void 0,void 0,function*(){const t=yield e.getUserId();return t?`${ie[n]}:${t}`:null}))(n,i),r=yield(e=>t(void 0,void 0,void 0,function*(){const t=yield e.getEnvironmentId();return t?`sdrn:schibsted:environment:${t}`:null}))(n),s=window.advertory_idfv,a=window.advertory_anId;return Object.assign(Object.assign({clientId:{plain:e},userId:{plain:o},environmentId:{plain:r},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:o}){return{clientId:e.plain,trackerType:t.plain,trackerVersion:n.plain,userId:i.plain,environmentId:o.plain}}},ae=e=>t(void 0,void 0,void 0,function*(){const{tracker:t,tcf:n,country:i,isMobileApp:o}=e;if(!(yield I(n,o,i,"setXandrPPIDs")))return;if(!t)return;(yield Promise.allSettled([re.processPPIDs(t,null==n?void 0:n.timeout),se.processPPIDs(t,i)])).forEach((e,t)=>{if("rejected"===e.status){g(`Cannot fetch PPIDs v${t+2}`,e.reason)}})}),de=e=>{const{ppid1:t,ppid2:n}=re.getPPIDs(),{ppid1:i,ppid2:o,idfv:r,anId:s}=se.getPPIDs();return{userIds:[{type:"extendedIDs",eids:(new oe).add(n,Y[e]).add(t,X[e]).add(o,Z[e]).add(i,ee[e]).add(r,te[e]).add(s,ne[e]).buildEids()}]}},le=e=>{const{ppid1:t,ppid2:n}=re.getPPIDs(),{ppid1:i,ppid2:o,idfv:r,anId:s}=se.getPPIDs();if(!n)return{};return{userSync:{userIds:[{name:"pubProvidedId",params:{eids:(new oe).add(n,Y[e]).add(t,X[e]).add(o,Z[e]).add(i,ee[e]).add(r,te[e]).add(s,ne[e]).buildRyEids()}}]}}};const ce=new class extends N{prepare(e){return t(this,void 0,void 0,function*(){const n=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({},this.getCountryCodeKeywords(v.NO)),this.getPublisherKeywords()),this.getPageTypeKeywords()),this.getSupplyTypeKeywords()),this.getDeviceKeywords()),yield this.getFormattedExternalIdKeywords()),this.getAppTypeKeywords()),yield this.getAdvertisingConsentKeywords()),this.getHasContextKeywords(e.keywords)),(()=>{const{ppid1:e,ppid2:t}=re.getPPIDs();return{"aa-sch-schuserhash":e?"1":"0","aa-sch-schenvhash":t?"1":"0"}})()),yield(i=c.get(),o={addPublisherToGeo:!0},t(void 0,void 0,void 0,function*(){const{addPublisherToGeo:e}=o||{},{glimr:t,country:n}=i,r=yield M(i);if(!(null==t?void 0:t.enabled)||!r)return g("No consent for getting glimr tags."),{};const s=z(n),a=K(i,Boolean(e));return{[`${s}-geo`]:a.geoTags,[`${s}-weather`]:a.weatherTags,[`${s}-geofence`]:a.geofenceTags}}))),e.keywords),this.getObituariesKeywords(p.BT));var i,o;return Object.assign(Object.assign({},e),{keywords:n,user:Object.assign(Object.assign({},de(v.NO)),{externalUid:yield this.getExternalUid()}),member:this.getMember()})})}};var ue=ce.prepare.bind(ce);const ve="ABSOLUTE_FULLSCREEN",pe="ANY_FULLSCREEN",ge="VERTICAL_FULLWIDTH",he="FULLWIDTH",me="TAKEOVER",ye="VELVET_TAKEOVER",fe="WALLPAPER",we="COLLAPSE",be={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}]},Ee={wallpaper:1600,"l-format":1600},Te=()=>{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},Ie=e=>{const{source:t}=e;return"csm"===t},ke=e=>{const{siteSpecificConfig:t}=c.get(),n=(null==t?void 0:t.dynamicOutstreamFormats)||[];return 0!==n.length&&n.some(t=>e.includes(t))},Ae=e=>{const{banner:t,targetId:n}=e;return!(!t||(null==n?void 0:n.includes("takeover")))&&Me(e,pe)},Ce=e=>{const{native:t}=e;return!!t},Se=e=>Me(e,he),Oe=e=>{const{targetId:t}=e;return t.includes("takeover")||Me(e,me)},Pe=e=>Me(e,me),$e=e=>Me(e,fe),Le=e=>Me(e,we),xe=e=>e.targetId.includes("sponsorstripe"),Ne=e=>{const t=document.querySelector(`#${e}`);return!!t&&"true"===t.dataset.isFinnBlinkPlacement},je=e=>e.targetId.startsWith("panorama")||e.targetId.startsWith("modul"),_e=e=>e.targetId.startsWith("midboard"),qe=e=>e.targetId.includes("widescreen"),De=e=>e.width>=1260&&e.width<=1280,Be=e=>e.width>=1600&&e.width<=1620,Me=(e,t)=>{const n=be[t];if(!n)return!1;return!!n.find(t=>{var n,i;const o=(null===(n=e.banner)||void 0===n?void 0:n.width)||e.width,r=(null===(i=e.banner)||void 0===i?void 0:i.height)||e.height,s=t.width===o,a=!t.height||t.height===r;return s&&a})},Re={adRequested:()=>{},adAvailable:e=>{},adLoaded:e=>{Oe(e)&&(()=>{const e=document.querySelector("#takeover"),t=document.querySelector("div[id*='mobile-topboard'], div[id*='topboard']"),n=null==t?void 0:t.parentElement;t&&n&&e&&(e.appendChild(t),n.style.display="none")})()},adNoBid:e=>{},adError:(e,t)=>{},adCollapse:()=>{},adRequestFailure:e=>{},adBadRequest:e=>{},adLoadedMediated:e=>{},adNoBidMediated:e=>{}},Fe={publisherClassName:p.BT,fullWidthFormatClassName:"netboard",mainColumnWidth:660};class Ve{initialize(){this.DATA=Object.assign({},Ve.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)}}Ve.INITIAL_DATA={wallpaper:{isAvailable:!1},horseshoe:{isAvailable:!1},initialClassNames:{},alertoryConfigKeywords:{}};const Ue=new Ve,He=()=>(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),ze=()=>(window.relevantDigital||(window.relevantDigital={cmd:[]}),window.relevantDigital),We=(e={},t)=>{const{prebid:{externalUidInAuctionEnabled:n,forwardGlimrTags:i=!1}={},country:o}=c.get(),r=[`${z(o)}-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?r:[]],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)}},Ke=(e,...n)=>t(void 0,[e,...n],void 0,function*(e,{timeout:t}={timeout:1e3}){document.querySelector(`script[src="${e}"]:not([type="module"])`)||(yield new Promise((n,i)=>{const o=document.createElement("script");o.async=!0,o.src=e;const r=()=>{a(),n()},s=()=>{a(),i(new Error(`Failed to load ${e}`))},a=()=>{o.removeEventListener("load",r),o.removeEventListener("error",s),clearTimeout(d)};o.addEventListener("load",r),o.addEventListener("error",s);const d=setTimeout(()=>{a(),i(new Error(`Loading script timed out: ${e}`))},t);document.head.appendChild(o)}).catch(e=>{console.error(e)}))}),Ge="advertory-fullscreen-scroll",Je="advertory-fullscreen-scroll-wrapper",Qe="fullscreen-scroll-in-screen",Ye="in-screen",Xe=e=>e.includes("snoap.no"),Ze=e=>{var t,n,i,o,r;return!!(null===(r=null===(o=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===o?void 0:o.ads[1])||void 0===r?void 0:r.rtb)},et=(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()),o=n.substring(n.indexOf("{")+1,n.lastIndexOf("}")),r=i.map((t,n)=>`${t} = "${e[n]}"`);return new Function(...r,o).toString()},tt=et([],()=>{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:o,clientHeight:r}=i,s=e/o,a=t/r;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}),nt=e=>{const t=et([],()=>{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},it=[],ot={},rt=(e,t)=>{e.forEach(({target:e,isIntersecting:n})=>{const i=at(e);n?(st(i,n),dt(e,i,t)):(st(i,n),lt(e,i,t))})},st=(e,t)=>{var n,i;const o=null===(n=document.getElementById(e))||void 0===n?void 0:n.querySelector("iframe");if(!o)return;const r=t?"showFullscreen":"hideFullscreen";null===(i=o.contentWindow)||void 0===i||i.postMessage(`advertory:${r}-${e}`,"*")},at=e=>{var t;return null===(t=e.children[0])||void 0===t?void 0:t.id},dt=(e,t,n)=>{e.classList.add(Ye),document.body.classList.add(Qe),window.dispatchEvent(new CustomEvent("advertory:fullscreenScrollInView")),it.includes(t)||it.push(t),n&&window.addEventListener("scroll",ot[t],{passive:!0})},lt=(e,t,n)=>{it.includes(t)&&(n&&window.removeEventListener("scroll",ot[t]),document.body.classList.remove(Qe),e.classList.remove(Ye),window.dispatchEvent(new CustomEvent("advertory:fullscreenScrollNotInView")))},ct=(e,t={fadingHeaderEnabled:!1,headerSelectors:[".js-masthead"],skyscraperSelectors:[".skyscraper_r"],headerZIndex:3})=>{const{headerSelectors:n=[".js-masthead"],skyscraperSelectors:i=[".skyscraper_r"],headerZIndex:o=3}=t,r=[],s=[];return n.forEach(e=>{var t;const n=null!==(t=document.querySelector(e))&&void 0!==t?t:document.querySelector("header");n&&r.push(n)}),i.forEach(e=>{const t=document.querySelector(e);t&&s.push(t)}),()=>{r.length&&ut(e,r,o,0),s.length&&ut(e,s,o,40)}},ut=(e,t,n,i)=>{const o=e.offsetHeight,r=window.scrollY,s=e.getBoundingClientRect().top+r;t.forEach(e=>{const t=e.offsetHeight;let a;a=s>r?(s-r)/t-i:(r+t-(s+o))/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()})},vt={no:{adText:"ANNONSE",adFrom:"ANNONSE FRA",adContent:"ANNONSØRINNHOLD",adContentFrom:"ANNONSØRINNHOLD FRA"},se:{adText:"ANNONS",adFrom:"ANNONS FRÅN",adContent:"EXTERN LÄNK",adContentFrom:"EXTERN LÄNK FRÅN"}};let pt=null;const gt=(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=`(${tt})()`,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(Xe(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=nt(n)),(e=>e.includes("de17a"))(n)&&(n=(e=>Xe(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)),Xe(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)),Ze(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},ht=()=>{pt=null;const e=window.visualViewport,t=e?e.height:window.innerHeight,n=e?e.width:window.innerWidth,i=e?e.offsetLeft:0,o=document.documentElement;o.style.setProperty("--advertory-fullscreen-scroll-vh",`${t}px`),o.style.setProperty("--advertory-fullscreen-scroll-vw",`${n}px`),o.style.setProperty("--advertory-fullscreen-scroll-left",`${i}px`)},mt=()=>{pt||(pt=window.requestAnimationFrame(ht))},yt=(e,t)=>{var n,i,o,r;const{country:s}=c.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:o="16px 0",beforeContentValue:r=""}=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: ${o};\n }\n \n .advertory-fullscreen-scroll-wrapper {\n ${r&&"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: '${r}' !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),l=null==d?void 0:d.parentElement;if(!d||!l)return;((e,t)=>{const n=(null==t?void 0:t.fadingHeaderEnabled)||!1,i=new IntersectionObserver(e=>rt(e,n),{}),o=at(e);i.observe(e),n&&(ot[o]=ct(e,t))})(l,t),d.className=Ge;const u=Me(e,ve)?"absolute":"fixed";d.style.position=u,l.className=Je,l.dataset.showTagSubscribeId=a,d.setAttribute("data-ad-label",vt[s].adText),(null==t?void 0:t.moveCogwheelToTheLeft)&&(d.dataset.moveCogwheelToTheLeft="true"),mt(),window.addEventListener("resize",mt),null===(o=window.visualViewport)||void 0===o||o.addEventListener("resize",mt),null===(r=window.visualViewport)||void 0===r||r.addEventListener("scroll",mt)},ft=({targetId:e})=>{const t=(e=>{var t;const{requests:n}=window.apntag,i=Ze(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=Ze(e)?1:0,o=null==n?void 0:n.tags[e].adResponse.ads[i].rtb;o&&(o.banner.content=t)})(e,gt(t,e))},wt=e=>{var t;!document.querySelector(`#gdprAdTransparencyCogWheelButton-${e}`)&&(null===(t=window.gdpr)||void 0===t?void 0:t.setupButton)&&window.gdpr.setupButton(e)},bt="ad-loaded",Et=()=>null!==h("disable_prebid"),Tt=()=>t(void 0,void 0,void 0,function*(){const{prebid:e,tcf:t,country:n,isMobileApp:i,fullscreenScroll:o}=c.get();if(!(null==e?void 0:e.enabled))return;const{initNativeAd:r}=c.getHandlers(),{getConsentAsync:s}=T(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 o=He(),{prebid:{relevantCbTimeout:r}={}}=c.get(),s="relevantCb"===i&&r?r:n[i].timeout,a=setTimeout(()=>{!n[i].done&&!e&&(console.warn(`Doing failsafe loadTags() call after waiting too long for '${i}'`),e=!0,o.loadTags&&o.loadTags())},s);t.push(a)},cleanup:()=>{t.forEach(e=>clearTimeout(e)),t=[],e=!1,n.relevantCb.done=!1,n.auctionCb.done=!1}}})(),l=He(),u=(()=>{const{requests:{user:e={userIds:[]},keywords:t={}}={}}=He();return{user:e,keywords:t}})();d.failsafeOnTimeout("relevantCb");const{user:{externalUid:v=""}={},keywords:p}=u;(()=>{const e=ze();return e.cmd||(e.cmd=[]),e.cmd})().push(()=>{if(d.getCancel()||!l.loadTags)return g("core loadTags() call was cancelled",{cancel:d.getCancel(),apnTagLoadTags:!l.loadTags,condition:"or"}),void d.cleanup();const t=ze();d.events.relevantCb.done=!0,d.failsafeOnTimeout("auctionCb");const i=a?{gdpr:{cmpApi:"iab",timeout:8e3}}:{cmpApi:"none"};g("prebid consentManagement",i),t.addPrebidConfig(Object.assign(Object.assign({consentManagement:i,enableSendAllBids:!1},le(n)),We(p,v))),g("core add prebid config",Object.assign(Object.assign({consentManagement:i,enableSendAllBids:!1},le(n)),We(p,v))),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,l.loadTags(e)),d.cleanup()}},customNativeRender:e=>{It(e,r)},directRenderFn:e=>{var t;const{settings:n,renderFn:i}=e,{bid:r,adDiv:s}=n||{};if(!s)return;const a=i(n),d=Object.assign(Object.assign({},r),{targetId:s.id,banner:!0}),l=s.id,c=document.getElementById(l);c&&(Ae(d)?(yt(d,o),(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(Ge)))return;e.classList.remove(Ge),e.removeAttribute("style"),e.removeAttribute("data-ad-label");const t=e.parentElement;(null==t?void 0:t.classList.contains(Je))&&(t.classList.remove(Je),t.classList.remove(Ye))})(c),null===(t=null==c?void 0:c.parentElement)||void 0===t||t.classList.add("advertory-direct-render")),c.classList.add(bt),((e,t,n)=>{var i,o,r,s;const a=document.createElement("div");a.id=`${e}-button`,t.appendChild(a),(null===(o=null===(i=window.apntag.requests)||void 0===i?void 0:i.tags[e])||void 0===o?void 0:o.adResponse)||(null!==(r=(s=window.apntag).requests)&&void 0!==r||(s.requests={tags:{}}),window.apntag.requests.tags[e]=Object.assign(Object.assign({},window.apntag.requests.tags[e]),{adResponse:{ads:[{creative_id:n}]}})),wt(e);const d=a.firstElementChild;d&&t.insertBefore(d,a),a.remove()})(l,c,null==r?void 0:r.creativeId))}}),g("core load prebid",{configId:e.id,manageAdserver:!1,collapseEmptyDivs:!1,collapseBeforeAdFetch:!1,noGpt:!0,noSlotReload:!0,loadUnknownSlots:!0,apntagCalls:{showTag:()=>{},loadTags:e=>{d.getCancel()||(d.events.auctionCb.done=!0,l.loadTags(e))}},customNativeRender:e=>{It(e,r)},directRenderFn:()=>{}})})}),It=(e,t)=>{var n;const{divId:i,native:o,bid:r}=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:o,targetId:a},c.get()),null==d||d.postMessage(JSON.stringify({message:"Prebid Response",ad:"\x3c!-- nothing --\x3e",adId:r.adId}),"*")},kt="0123456789abcdefghijklmnopqrstuvwxyz",At=e=>{window.apntag.anq.push(e)},Ct=new Promise(e=>{"undefined"!=typeof document&&document.prerendering?document.addEventListener("prerenderingchange",()=>e()):e()}),St=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 Ot="";const Pt=new Map,$t=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},Lt="advertory-wallpaper-background",xt="advertory-with-horseshoe",Nt=()=>{const e=document.querySelector(`.${Lt}`);e&&e.remove()},jt=e=>{const t=e.getBoundingClientRect().top;requestAnimationFrame(()=>(e=>{if(!document.body)return;const t=document.querySelector(`.${Lt}`);t&&t.style.setProperty("top",`${e}px`)})(t+15))},_t=/^wallpaper:url:(http[s]?:\/\/)?[^\s(["<,>]*\.[^\s[",><]*/,qt=e=>{if("0"===h("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")&&Nt())},Dt=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"))},Bt=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`)},Mt=e=>{const t=e.parentElement;if(!e||!t)return;const{container:n,wrapper:i}=(e=>{const t=Ue.getData("initialClassNames")[e.id];return{wrapper:(null==t?void 0:t.wrapper)?t.wrapper.join(" "):"",container:(null==t?void 0:t.container)?t.container.join(" "):""}})(e);e.className=n,t.className=i},Rt=()=>{Nt();document.querySelectorAll('[data-advertory-ad-rendered="true"]').forEach(e=>{qt(e.id),Mt(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=$t(e.id)}),At(()=>window.apntag.clearRequest())},Ft="noGroupedPlacements",Vt=e=>{const t=e.replace(/[0-9]/g,"");return"_"===t.slice(-1)?t.substring(0,t.length-1):t},Ut=e=>{if(!(null==e?void 0:e.minViewWidth))return!0;return window.innerWidth>=e.minViewWidth},Ht=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:o}=c.get(),r=n[o].filter(Ut)||[],s=e?document.querySelector(e):document;if(!s)return[];const a=r.reduce((e,t)=>{const n=Vt(t.id);return!n||e.includes(n)||e.push(n),e},[]).flatMap(e=>{const t=new RegExp(`^${e}(_(\\d+))?$`),n=r.filter(({id:e})=>e.match(t)),a=(null==i?void 0:i.queryByDataDevice)?`div[id^="${e}"][data-device=${o}], div[id^="${e}"][data-device=all]`:`div[id^="${e}"]:not([data-disabled="true"])`,d=s.querySelectorAll(a),l=Array.from(d).filter(({id:e})=>e.match(t)).map((e,t)=>{var i;const o=zt(e,t,n),r=o.finnBlink&&!o.finnBlink.renderOnlyWithAdBlock,s=r&&(null===(i=o.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+=kt[Math.floor(36*Math.random())];return t})(6)}`;return e.id=a,e.setAttribute("data-advertory-ad-rendered","true"),r&&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&&Ue.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({},o),{id:a})});return(e=>{const{keywordsConfig:t}=c.get();return(null==t?void 0:t.includeCountingKeywordInTags)?(Ot!==window.location.pathname&&(Pt.clear(),Ot=window.location.pathname),e.map(e=>{var t;const n=e.invCode.replace(/_\d+$/,""),i=null!==(t=Pt.get(n))&&void 0!==t?t:0;return e.keywords=Object.assign({},e.keywords),e.keywords[`${W()}-count`]=i,Pt.set(n,i+1),e})):e})(l)});return(e=>{const t=Array.from(document.querySelectorAll('div[class^="advertory"]'));return e.sort((e,n)=>t.findIndex(t=>t.id===e.id)-t.findIndex(e=>e.id===n.id))})(a)},zt=(e,t,n)=>{const i=n[t],o=n[n.length-1],r=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==o?void 0:o.id)?o:r||o},Wt=e=>{const{queryConfig:{placementBatches:t}={},deviceType:n}=c.get(),i=(null==t?void 0:t[n])||{},o=Object.values(i).flat(),r=(e=>{const t={};return e.forEach(e=>{const n=$t(e.id);e.isBackfill&&(t[n]=[e])}),t})(e),s=((e,t)=>{const n={};for(const[i,o]of Object.entries(t))n[i]=e.filter(e=>o.includes($t(e.id)));return n})(e,i),a=Object.keys(r),d=((e,t)=>e.filter(e=>!t.has($t(e.id))))(e,new Set([...a,...o]));return Object.assign(Object.assign(Object.assign({},s),r),{[Ft]:d})},Kt=(e,t,n)=>{const i=document.getElementById(`div_utif_${e}`);if(!i)return;const{apntag:o}=window,[r,s]=t;if(!i.dataset.lockedsize&&s&&r)i.style.width=`${r}px`,i.style.height=`${s}px`,n&&(o.resizeAd(i.id,[r,s]),i.dataset.lockedsize="true",i.dataset.lockedwidth=r.toString(),i.dataset.lockedheight=s.toString());else if(null==i?void 0:i.dataset.lockedsize){const{lockedwidth:e,lockedheight:t}=i.dataset;e&&t&&o.resizeAd(i.id,[e,t])}},Gt=["netboard","board"];class Jt{constructor(e,t){this.identityFacade=e,this.tracker=t}buildUrl(e,t){var n,i;const{editionName:o}=e,r=(()=>{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",o),r&&a.searchParams.append("urlData",r),s&&a.searchParams.append("excludedItems",s),l&&a.searchParams.append("spid",l),d&&a.searchParams.append("envid",d),a.toString()}fetchData(e){return t(this,void 0,void 0,function*(){var t,n,i;const o=yield this.identityFacade.getIdentityUser(),r=null!==(i=yield null===(n=null===(t=this.tracker)||void 0===t?void 0:t.getEnvironmentId)||void 0===n?void 0:n.call(t))&&void 0!==i?i:"",s=(null==o?void 0:o.userId)?String(o.userId):"",a=this.buildUrl(e,{envId:r,spid:s});try{g("Starting fetching DrEdition ad from URL:",a);const e={method:"GET"},t=yield J.get(a,e);return g("Fetch operation completed successfully."),t}catch(e){g("Error during fetch operation:",e)}return null})}}let Qt=class{getDrEditionUTMParams(e,t){var n;const{title:i="",clientName:o,creativeId:r}=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:o,utm_medium:a},r&&{utm_id:`df-${r}`})}getUrlSearchParams(e,t,n){if(!e)return"";const i=this.getDrEditionUTMParams(t,n),o=new URLSearchParams(decodeURIComponent(e.search)),r=new URLSearchParams(e.search);return Object.entries(i).forEach(([e,t])=>{o.has(e)||r.set(e,null!=t?t:"")}),r.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 o=this.getDrEditionUTMParams(e,t),r=new URL(i);return Object.entries(o).forEach(([e,t])=>{r.searchParams.has(e)||r.searchParams.set(e,null!=t?t:"")}),r.toString()}handleVideo(e,n){return t(this,void 0,void 0,function*(){const{id:t,autoplay:i,mute:o,videoLoop:r,vendor:s}=n.videoConfiguration;e.classList.add("vgtv-video-container"),Object.assign(e.dataset,{vgtvVideoId:t,vgtvVendor:s,vgtvAutoplay:i,vgtvMuted:o,vgtvLoop:!!r,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:o}=new URL(n);if(!i.includes("www.vg.no")&&!o.includes("annonsorinnhold"))return[n];const r=o.split("/");return r.length?[...r.filter(Boolean).slice(1).map(e=>e),n]:[n]}};const Yt=e=>{const t=e.parentElement;t?t.classList.remove("dr-edition-lock-height"):g("Dr. Edition container does not have a parent element, cannot remove height lock.")};class Xt{constructor(e,t,n,i){this.drEditionService=e,this.rendererManager=t,this.videoManager=n,this.pulseManager=i,this.drEditionAds=[]}fetchAndRenderAd(e,n){return t(this,void 0,void 0,function*(){var t,i;const{drEditionConfig:{containerSelector:o},renderAsBackfill:r=!1}=n,s=e.querySelector(o);if(!s)return void g(`Container with selector "${o}" not found.`);const a=yield this.drEditionService.fetchData(n);return(null==a?void 0:a.itemId)||r?!(null==a?void 0:a.itemId)&&r?(g("No Dr. Edition ads available to render. Collapsing whole placement."),qt(e.id),void Yt(s)):((null==a?void 0:a.itemId)&&r&&(g("Dr. Edition ad available to render as a Xandr backfill."),Dt(e.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===(t=this.videoManager)||void 0===t?void 0:t.handle(a,n),Yt(s),this.drEditionAds.push(a),window.advertory=window.advertory||{},window.advertory.renderedDrEditionAds=window.advertory.renderedDrEditionAds||[],window.advertory.renderedDrEditionAds.push(a.itemId),this.observeAdView(e,a,n),null===(i=e.querySelector("a"))||void 0===i||i.addEventListener("pointerup",()=>null)):Yt(s))):(g("No Dr. Edition ads available to render. Hiding Dr. Edition and rendering Xandr backfill."),this.hideDrEdition(s),this.showBackfill(e),void Yt(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:"";Dt(i)}hideDrEdition(e){e.style.display="none"}observeCarousel(e,t,n){const i=e.querySelector(".dr-edition-slider");if(!i)return!1;let o=null;const r=new IntersectionObserver(e=>{e.forEach(e=>{e.isIntersecting&&e.intersectionRatio>=.9&&(o&&clearTimeout(o),o=setTimeout(()=>{e.target.onclick=()=>this.pulseManager.trackContentClick(e.target,t,n),this.pulseManager.trackContentView(e.target,t,n)},500)),[...i.children].forEach(e=>{r.observe(e)})})},{threshold:[.9]});return[...i.children].forEach(e=>{r.observe(e)}),!0}}class Zt{constructor(e,t){this.newsroomStrategy=e,this.pulseManager=t}render(e,n,i){return t(this,void 0,void 0,function*(){if(!(null==n?void 0:n.itemId))return;const{getConsentAsync:t}=T(i.tcf,i.isMobileApp,i.country),o=yield t(),r=i.device===C.MOBILE?n.mobileHTML:n.desktopHTML;const s=o?r:r.replace(/<img [^>]*class="tracking-pixel"[^>]*>/g,"");e.innerHTML=s,e.querySelectorAll("a").forEach(e=>{var t,o,r;e.search=null!==(r=null===(o=(t=this.newsroomStrategy).getUrlSearchParams)||void 0===o?void 0:o.call(t,e,n,i))&&void 0!==r?r:"",e.onclick=()=>this.pulseManager.trackContentClick(e,n,i)})})}}class en{constructor(e){this.strategy=e}handle(e,n){return t(this,void 0,void 0,function*(){const{videoConfiguration:{id:t,preview:i}={}}=e;(t||i)&&(yield this.importScript(n),yield this.createVideoElement(e,n))})}importScript(e){return t(this,void 0,void 0,function*(){const t=e.drEditionConfig.videoScriptUrl,n=document.querySelector(`script[src="${t}"]`);if(t&&!window.autoplayQueue&&!n)try{yield Ke(t)}catch(e){g("Error! Failed to prepare SVP player script for Dr. Edition!",e)}})}createVideoElement(e,n){return t(this,void 0,void 0,function*(){const t=document.createElement("div"),{node:i}=e.videoConfiguration,o=[...document.querySelectorAll(`#${i}`)||[]].find(e=>0===e.children.length);if(this.handlePreviewVideo(e,n))return;this.strategy.handleVideo(t,e),null==o||o.appendChild(t),window.autoplayQueue=window.autoplayQueue||[],window.autoplayQueue.push(e=>{e.parse()});const r=null==o?void 0:o.parentNode;if(!r)return;const s=r.closest("a");r.addEventListener("click",e=>{const t=e.target.closest("a");s!==t&&t||(e.stopPropagation(),e.preventDefault())})})}handlePreviewVideo(e,t){var n,i,o;const{preview:{url:r,thumbnail:s}}=null!==(n=e.videoConfiguration)&&void 0!==n?n:{};if(!r)return!1;const a=document.querySelector(".dr-edition-preview .preview-video");return!!a&&(a.setAttribute("src",r),a.setAttribute("playsinline",""),!(!a||!s)&&(null===(o=(i=t.drEditionConfig).addPreviewVideo)||void 0===o||o.call(i,a),!0))}}let tn=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,o=this.getTeaserElementText(e,"title");return{id:n,name:this.normalizePlacementTitle(null!=o?o:""),type:"Page",url:i}}normalizePlacementTitle(e){return e.replace(/<[^>]+>/gi,"").replace(/[^a-z0-9æøå\s_-]/gi,"")}trackContentView(e,n,i){return t(this,void 0,void 0,function*(){var t,o,r,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(e,n,i,"view");(null===(t=this.pulse)||void 0===t?void 0:t.trackLegacyViewUIElement)?null===(r=null===(o=this.pulse)||void 0===o?void 0:o.trackLegacyViewUIElement)||void 0===r||r.call(o,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(e,n,i){return t(this,void 0,void 0,function*(){var t,o,r,s,a,d;if(!this.pulse)return;const l=this.getEventInput(e,n,i,"click");this.pulse.trackLegacyClickUIElement?null===(o=(t=this.pulse).trackLegacyClickUIElement)||void 0===o||o.call(t,l):this.pulse.trackClickUIElement?null===(s=(r=this.pulse).trackClickUIElement)||void 0===s||s.call(r,l):null===(d=(a=this.pulse).trackElementClick)||void 0===d||d.call(a,l)})}};class nn extends tn{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:o="",creativeId:r}={}}=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:o,"spt:creativeId":r},url:location.origin}}getEventInput(e,t,n){return{object:this.getEventBaseData(e,t,n),target:this.getEventTarget(e,t)}}}let on=class extends tn{constructor(e,t,n){super(e,t),this.pulse=e,this.newsroomStrategy=t,this.pageType=n}getEventBaseData(e,t,n){var i,o,r,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===(r=null===(o=this.newsroomStrategy)||void 0===o?void 0:o.getPulseObjectId)||void 0===r?void 0:r.call(o))&&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 o,r,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===(r=null===(o=this.newsroomStrategy)||void 0===o?void 0:o.getUrlWithParams)||void 0===r?void 0:r.call(o,t,n))&&void 0!==s?s:p)&&void 0!==a?a:"";return{algorithm:d,clientName:l,probability:g,creativeId:c,device:n.device,editionId:u,itemId:v,link:w,placement:n.editionName,subtitle:y,time:h,title:m,type:i,imageUrl:f,frontId:86,tracking_type:"ad",xandrAdLoaded:!1}}getProviderData(){return{productTag:"partnerstudio"}}};const rn={FRONT:"front"},sn=(e,t)=>{null==t||t.forEach(t=>{const n=window.SVP.Player.Plugins.get(t);e.addPlugin(new n)})},an=e=>t(void 0,void 0,void 0,function*(){var t,n;return(null===(t=null===window||void 0===window?void 0:window.SVP)||void 0===t?void 0:t.Player)?new window.SVP.Player(e):((()=>{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(e):yield new Promise(t=>{window.addEventListener("onSvpPlayerReady",()=>t(new window.SVP.Player(e)))}))}),dn={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 t(this,void 0,void 0,function*(){yield Promise.resolve().then(function(){return Sr})})}})}},ln=(e,t)=>{null==e||e.forEach(e=>{dn[e](t)})};class cn{handleVideo(e,n){return t(this,arguments,void 0,function*(e,{videoConfiguration:{id:n,node:i,autoplay:o,mute:r,vendor:s}}){yield t(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(e);ln(a,d);const l={id:n,node:i,autoplay:o,mute:r,vendor:s,autopause:"viewable",maxBitrate:600,pulse:{provider:"e24"},recommended:{autoplay:!1,next:{countdown:10}},skin:{name:"e24-default",url:""}},c=yield an(l);c.once("assetReady",()=>{sn(c,a)}),c.once("ready",()=>{const t=e;new MutationObserver(e=>{e.forEach(({type:e,attributeName:n})=>{"attributes"===e&&"class"===n&&(t.classList.contains("jw-state-playing")?d.classList.add("is-playing"):d.classList.remove("is-playing"),t.classList.contains("jw-flag-user-inactive")?d.classList.add("is-inactive"):d.classList.remove("is-inactive"))})}).observe(t,{attributes:!0,attributeFilter:["class"]})}),c.once("PulseStats:ready",()=>t(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===rn.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),o=i.split("/").filter(Boolean);return o.length?[...o.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 un="https://www.aftonbladet.se/video-player-extras/latest/";class vn{handleVideo(e,n){return t(this,arguments,void 0,function*(e,{videoConfiguration:{id:t,node:n,autoplay:i,mute:o,vendor:r}}){const s={id:t,node:n,autoplay:i,mute:o,vendor:r,autopause:"viewable",maxBitrate:600,pulse:{provider:"aftonbladet"},recommended:{autoplay:!1,next:{countdown:10}},skin:{name:"",url:""},plugins:{[`${un}cta-button.js`]:{name:"CtaButton",options:{type:"unmute"}},[`${un}external-link.js`]:{name:"ExternalLink"}}};yield an(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""}}const pn=e=>null!==e&&"object"==typeof e&&!Array.isArray(e);class gn{handleVideo(e,n){return t(this,arguments,void 0,function*(e,{videoConfiguration:{id:n,node:i,autoplay:o,mute:r,vendor:s}}){const a={id:n,node:i,autoplay:o,mute:r,vendor:s,locale:"se",autopause:"viewable",maxBitrate:600,sharing:!1,recommended:!1,pulse:{provider:"svdse",decorator:(e,t)=>Object.assign(Object.assign({},pn(e)?e:{}),{provider:Object.assign(Object.assign({},pn(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 an(a);d.once("PulseStats:ready",()=>t(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===rn.FRONT?"sdrn:svdse:frontpage:front":`sdrn:svdse:article:${t}`}}let hn=class{handleVideo(e,t){}getPulseObjectId(){return""}getPulsePageId(e,t){return""}};const mn=(e,t,n)=>{var i;const{publisher:o,pageType:r,country:s}=e,a={[p.VG]:new Qt,[p.E24]:new cn,[p.AFTONBLADET]:new vn,[p.SVD]:new gn}[o]||new hn,d=new(s===v.SE?nn:on)(n,a,r),l=new Jt(t,null!==(i=null==n?void 0:n.pulseTracker)&&void 0!==i?i:n),c=new Zt(a,d),u=new en(a);return new Xt(l,c,u,d)},yn=()=>t(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 fn{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 t(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 g("[Privacy Broker] User is not logged in."),null}})}isUserLoggedIn(){return t(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 wn=(e,t,n)=>{const{wrapperSelector:i}=null==e?void 0:e.drEditionConfig,o=document.querySelectorAll(i),r=new IntersectionObserver((i,o)=>((e,t,n,i,o)=>{const r=mn(n,i,o);e.forEach(e=>{var i,o,s;if(!e.isIntersecting)return;const a=e.target,d=null!==(i=a.dataset.editionName)&&void 0!==i?i:"",l=null!==(o=a.dataset.pulseColumnname)&&void 0!==o?o:"",c=null!==(s=a.dataset.pulsePrimaryposition)&&void 0!==s?s:"";r.fetchAndRenderAd(a,Object.assign(Object.assign({},n),{editionName:d,columnName:l,primaryPosition:c})),t.unobserve(a)})})(i,o,e,t,n),{rootMargin:"400% 0px"});o.forEach(e=>r.observe(e))},bn=()=>t(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)}}),En=()=>{const e=document.getElementById("ads-advertory-anchor");return!(e&&"none"!==getComputedStyle(e).display&&window.advertoryFluepapir)},Tn=[],In=(e,n)=>t(void 0,void 0,void 0,function*(){var t;const{pulse:i,tcf:o,deviceType:r,drEdition:s,publisher:a,pageType:d,country:l,isMobileApp:c}=e;if(!(yield I(o,c,l,"handleDrEditionBackfill")))return;const u=((e,t)=>{var n;const{deviceType:i,placements:o,drEdition:{fallbackGlobalEditionName:r}={}}=e,s=o[i]||o.desktop,a=$t(t.targetId),d=s.find(e=>e.id===a),l=Gt.some(e=>a.startsWith(e)),c=Tn.includes(a),u=(null===(n=null==d?void 0:d.drEdition)||void 0===n?void 0:n.editionName)||r;return d&&l&&!c&&u?(Tn.push(a),Object.assign(Object.assign({},d),{drEdition:Object.assign(Object.assign({},d.drEdition),{editionName:u})})):null})(e,n);if(!u)return;if(!(null==i?void 0:i.instance))return void g("Pulse has not been passed as a prop, aborting");const v=yield yn(),p=new fn(v),h=mn({publisher:a,pageType:d,country:l},p,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===(t=null==u?void 0:u.drEdition)||void 0===t?void 0:t.editionName)||"",drEditionConfig:s,device:r,tcf:o,isMobileApp:c,country:l,renderAsBackfill:!0};yield h.fetchAndRenderAd(m,f)}),kn="collapseAd",An="hideAd",Cn="resizeAd",Sn="renderDrEditionFallback",On="wallpaperImageUrl",Pn="wallpaperColor",$n="velvet",Ln=[Cn,On,Pn,kn,An,Sn,$n];let xn;const Nn=e=>{if("object"==typeof e)return e;if(t=e,_t.test(t)){const t=e.replace(/^wallpaper:url:/,"");return{name:On,wallpaperImageUrl:t}}var t;if((e=>e.startsWith("wallpaper:color:"))(e)){const t=e.replace(/^wallpaper:color:/,"");return{name:Pn,wallpaperColor:t}}if(e.startsWith(Sn)){const t=e.split(":")[1];return{name:Sn,targetId:t}}if(e.startsWith(kn)||e.startsWith(An)){const t=e.split(":")[1];return{name:kn,targetId:t}}if(e.includes("name")&&Ln.some(t=>e.includes(t)))try{return JSON.parse(e)}catch(e){}},jn=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=Nn(t);if(!n)return;if(!n.name||!Ln.some(e=>n.name===e))return;const{name:i,targetId:o,wallpaperImageUrl:r,wallpaperColor:s,cmd:a,size:d}=n;i===$n&&a&&(a.includes("noScroll")&&(xn=(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==xn||xn(),dispatchEvent(new CustomEvent("advertory:closeTakeover",{})))),i!==kn&&i!==An||!o||qt(o),i===Cn&&o&&a&&Kt(o,a),i===Sn&&o&&(qt(o),In(c.get(),{targetId:o})),"resizeMediationAd"===i&&o&&d&&Kt(o,d,!0),i===On&&r&&(e=>{const t=document.querySelector(`.${Lt}`);t&&(t.style.backgroundImage=`url(${e})`)})(r),i===Pn&&s&&(e=>{const t=document.querySelector(`.${Lt}`);t&&(t.style.backgroundColor=e)})(s)},_n=e=>({rootMargin:`${e}px 0px ${e}px 0px`}),qn=()=>{const{publisher:e,country:n,finnBlink:i}=c.get(),{loadFinnBlinkAd:o,wallpaperHandlers:{adjustAdToHorseshoe:r}}=c.getHandlers(),s=window.apntag,a={publisher:e,country:n,finnBlink:i},d=e=>{Dt(e),At(()=>s.showTag(e))};return{withXandrAd:d,withFinnBlinkAd:e=>t(void 0,void 0,void 0,function*(){yield o(e,a,null)}),withFullAdsChain:e=>t(void 0,void 0,void 0,function*(){yield o(e,a,d,()=>{Ue.getData("horseshoe").isAvailable&&r(e)})})}},Dn=(e,t,n)=>{const i="true"===n.dataset.isFinnBlinkOnlyPlacement;return Ne(t)&&i?(g(`loading finn blink ad for blink only placement for ${t}`),void qn().withFinnBlinkAd(t)):Ne(t)?(g(`loading finn blink ad with full ads chain for ${t}`),void qn().withFullAdsChain(t)):void At(()=>(g("core showTag",{id:t}),e.showTag(t)))},Bn=(e,n)=>t(void 0,void 0,void 0,function*(){yield Ct,yield St;const t=new IntersectionObserver((t,n)=>((e,t,n,i)=>{e.filter(({isIntersecting:e,target:{id:t}})=>e&&!t.includes("wallpaper")).forEach(e=>{const{target:o}=e,r=(e=>{const t=e.dataset.showTagSubscribeId;return!e.id.length&&t?t:e.id})(o),s=document.getElementById(r);g("core log from intersection observer handler",{targetId:r,element:s}),n(window.apntag,r,i),s&&(t.unobserve(s),t.disconnect())})})(t,n,Dn,e),_n(n));t.observe(e)}),Mn=new Map,Rn=["no-stavangeraftenblad","sa","no-aftenposten","aftenposten","no-bergenstidende","bt"],Fn=".brandstudio-premium-content-widget",Vn=({adWrapper:e,placementContainer:t})=>t.offsetHeight+(({adWrapper:e})=>{const{paddingTop:t,paddingBottom:n}=getComputedStyle(e);return parseFloat(t)+parseFloat(n)})({adWrapper:e}),Un=({adWrapper:e,placementContainer:t})=>{const n=Vn({adWrapper:e,placementContainer:t});var i;null==e||e.style.setProperty("height",`${n}px`),Mt(i=t),i.innerHTML=""},Hn=e=>{e&&e.style.getPropertyValue("height")&&e.style.removeProperty("height")},zn=({adWrapper:e,placementContainer:t})=>{const{publisher:n}=c.get(),i=Rn.includes(n)&&Boolean(t.closest(Fn));const o=i?t.closest(Fn):null,r=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&&!o)return;if(s)return Hn(e),void r.disconnect();const a=t.closest('[style*="height"]'),d=o;a&&d.contains(a)?Hn(a):d.hasAttribute("style")&&Hn(d),r.disconnect()})})});try{r.observe(t,{childList:!0,subtree:!0})}catch(e){r.disconnect()}},Wn=(e,t,n,i,o,r)=>{var s;const a=performance.now(),d=null!==(s=Mn.get(t))&&void 0!==s?s:0,l=((e,t)=>!!t&&e+t<(new Date).getTime())(i,o)&&n<0;a-d>=o&&l&&(Mn.set(t,a),((e,t,n)=>{const{country:i}=c.get(),o=null==n?void 0:n.parentElement;o&&n&&Un({adWrapper:o,placementContainer:n}),At(()=>{e.setKeywords([t],{[`${z(i)}-adreload`]:"1"},{overrideKeyValue:!0}),e.refresh([t])})})(e,t,r))},Kn=(e,t,n)=>{const i=new IntersectionObserver((e,i)=>((e,t,n,i)=>{e.filter(({isIntersecting:e})=>e).forEach(e=>{const{target:o,boundingClientRect:r}=e;t(window.apntag,o.id,r.y,n,i,o)})})(e,Wn,t,n),_n(300));i.observe(e)},Gn=(e,t=6)=>{const n=[];for(let i=0;i<e.length;i+=t){const o=e.slice(i,i+t);n.push(o)}return n},Jn=()=>navigator&&navigator.userAgent.match(/chrome/i)?null:navigator&&navigator.userAgent.match(/apple/i),Qn=(e,t=0)=>{const n=e.getBoundingClientRect(),i=window.innerHeight;return n.bottom>-t&&n.top<i+t},Yn=e=>{const{refreshConfig:{visibilityStateRefreshEnabled:t=!1}={}}=c.get();if(!t)return;const n=()=>{"visible"===document.visibilityState&&document.removeEventListener("visibilitychange",n),ni(e)};"visible"!==document.visibilityState&&document.addEventListener("visibilitychange",n)},Xn=(e,t,n)=>{const i=document.querySelectorAll('[data-bf-cache-refresh="true"]');for(const o of i){const i=e.find(e=>{var t;return e.id===(null===(t=o.firstElementChild)||void 0===t?void 0:t.id)&&e.bfCacheRefresh}),r=null==i?void 0:i.threshold;Qn(o,r)&&i&&(Bt(i.id),n.length&&o.classList.remove(...n),ni([i],t))}},Zn=e=>{const{refreshConfig:{backForwardNavigationRefreshEnabled:t=!1}={},siteSpecificConfig:{classesToRemoveOnRefresh:n=[]}={},isMobileApp:i}=c.get();t&&(e.forEach(({id:e})=>{const t=ei(e);t&&(t.dataset.bfCacheRefresh="true")}),i?((e,t)=>{document.addEventListener("visibilitychange",()=>{"visible"===document.visibilityState&&Xn(e,!0,t)})})(e,n):((e,t)=>{window.addEventListener("pageshow",n=>{const i=()=>{window.scrollY>0&&(window.removeEventListener("scroll",i),Xn(e,!1,t))};n.persisted&&(Jn()?window.addEventListener("scroll",i,{passive:!0}):Xn(e,!1,t))})})(e,n))},ei=e=>{var t,n;return null!==(n=null===(t=document.querySelector(`#${e}`))||void 0===t?void 0:t.parentElement)&&void 0!==n?n:null},ti=e=>{const{id:t,allowedFormats:n}=e,i=(e=>{if(!e)return[];try{return JSON.parse(e.dataset.adSizes||"[]")}catch(e){return[]}})(ei(t)),o=(e=>1===e[0]&&1===e[1])(i),r={sizes:[i],allowedFormats:o?n:n.filter(e=>"native"!==e),allowSmallerSizes:!1};return o||(r.native=void 0),r},ni=(e,t=!1)=>{const{requestSize:n=d}=c.get(),i=e.map(({id:e})=>e),o=Gn(i,n);if(t)for(const t of e){const e=ti(t);window.apntag.modifyTag(t.id,e)}for(const e of o)At(()=>window.apntag.refresh(e))};const ii="#fff",oi="#0098da",ri="splash",si="welcomePage",ai="topscroller",di="velvet",li="takeover-displayed",ci="takeover-visit-count",ui=14400,vi=()=>{const e=k(ci);return e?parseInt(e):0},pi=()=>{const{takeover:{enabled:e=!1,secondVisitEnabled:t=!1}={}}=c.get();return"0"!==h(m)&&("1"===h(m)||!(!e||(()=>{var e;const t=(null===(e=c.get().takeover)||void 0===e?void 0:e.cookieCapName)||li;return"true"===k(t)})())&&(!t||gi()))},gi=()=>{const e=vi();return 0===e?((()=>{const e=vi(),{takeover:{cookieCapTime:t=ui}={}}=c.get(),n=document.location.hostname;window.document.cookie=`${ci}=${e+1}; max-age=${t}; domain=${n}; path=/; SameSite=Lax`})(),!1):1===e},hi=(e,t)=>[[1,1],[1920,1080]].some(([n,i])=>n===e&&i===t),mi=()=>{const{takeover:e}=c.get();return Boolean(null==e?void 0:e.topscroller)},yi=()=>t(void 0,void 0,void 0,function*(){const e=document.location.hostname,{takeover:{cookieCapName:t=li,cookieCapTime:n=ui}={},isMobileApp:i,tcf:o,country:r}=c.get(),s=yield I(o,i,r,"ad-takeover-cookiecap");n&&s&&(window.document.cookie=`${t}=true; max-age=${n}; domain=${e}; path=/`)}),fi=e=>{var t;const n=!!(null===(t=c.get().takeover)||void 0===t?void 0:t.setCookieCapForNotShownAd);return Oe(e)&&n},wi=(e,t)=>{var n;if(t===ai){const{topscroller:t}=e;return null!=t?t:{}}if(t===ri){const{splash:t}=e;return null!=t?t:{}}return null!==(n=e.welcomePage)&&void 0!==n?n:{}},bi=(e,t)=>{t!==ri?(e=>{var t,n,i;const o=null===(n=null===(t=c.get().takeover)||void 0===t?void 0:t.welcomePage)||void 0===n?void 0:n.headerElementSelector,r=null===(i=c.get().takeover)||void 0===i?void 0:i.topscroller;if(!o||r)return;const s=document.querySelector(o),a=document.querySelector(".welcome-page-wrapper"),d=document.querySelector(`#${e.targetId}`),l=document.querySelector(".advertory-welcome-page-scroll");if(!(s&&a&&l&&d))return;const u=null==s?void 0:s.offsetHeight,v=Pe(e)?"60svh":`calc(100svh - ${u}px)`,p=Pe(e)?"calc(40svh + 30px)":`calc(${u}px + 30px)`;a.style.setProperty("height",v,"important"),d.style.setProperty("height",v,"important"),l.style.setProperty("bottom",p,"important")})(e):(e=>{var t;if(!(null===(t=c.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 o=`calc(100svh - ${n.offsetHeight}px)`;i.style.setProperty("height",o,"important")})(e)},Ei=et([],()=>{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})}),Ti=(e,t=!0)=>{(e===si||e===ai)&&(e=>{e?setTimeout(()=>window.scrollTo(0,0),100):window.scrollTo(0,10)})(t)},Ii=()=>{const e=parseInt(document.body.dataset.scrollY||"0",10);document.body.style.top="",window.scrollTo(0,e),document.body.classList.remove("page-locked")},ki=e=>{document.body.style.overflow=e?"initial":"hidden"},Ai=e=>{const t=Si(e),n=Ci(e);(e=>{e.classList.toggle("takeover-ad-hidden",!0)})(e),ki(!0),e.style.display="none",window.removeEventListener("keydown",t),window.removeEventListener("advertory:closeTakeover",n)},Ci=e=>{const t=()=>Ai(e);return window.addEventListener("advertory:closeTakeover",t),Ii(),t},Si=e=>{const t=t=>{["Enter","Escape"].includes(t.key)&&Ai(e)};return Ii(),window.addEventListener("keydown",t),t},Oi=e=>{const t=e.querySelector(".advertory-splash-navbar-wrapper");t&&(Si(e),Ci(e),Ii(),t.addEventListener("click",()=>{Ai(e)}),ki(!1))},Pi=e=>{(e=>{window.addEventListener("scroll",()=>{e.getBoundingClientRect().bottom,(e=>{const t=e.getBoundingClientRect().bottom;e.style.opacity=""+t/e.offsetHeight})(e)},{passive:!0})})(e),Ci(e);const t=document.querySelector("header");document.querySelectorAll(".smooth-close-takeover").forEach(e=>e.addEventListener("click",()=>null==t?void 0:t.scrollIntoView({behavior:"smooth"})))},$i=e=>{(e=>{window.addEventListener("advertory:closeTakeover",()=>Ai(e))})(e)},Li=e=>{const{takeover:{splash:{showAnnonsLabel:t=!1}={}}={}}=c.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=vt.se.adText),e.classList.toggle("advertory-splash-wrapper",!0)},xi=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=vt.no.adText,n.classList.add("takeover-topscroller-label"),e.classList.toggle("topscroller-wrapper",!0))},Ni=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=vt.se.adText,e.classList.toggle("welcome-page-wrapper",!0))},ji=e=>{const t=document.querySelector(".advertory-takeover-label");t&&(t.style.display="flex",t.innerText=vt.se.adText,e.classList.toggle("advertory-impact-wrapper",!0))},_i=()=>{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)},qi=(e,t)=>{let n=e;return e.includes("529299503")&&(n=(e=>{const t=document.createElement("script");return t.textContent=`(${Ei})()`,e+t.outerHTML})(e)),n},Di=e=>{const t=(e=>{var t;const{requests:n}=window.apntag,i=Ze(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=Ze(e)?1:0,o=null==n?void 0:n.tags[e].adResponse.ads[i].rtb;o&&(o.banner.content=t)})(e,qi(t))},Bi=e=>t(void 0,void 0,void 0,function*(){const{takeover:t}=c.get(),{targetId:n}=e,i=document.querySelector(`#${n}`),o=document.querySelector(".advertory-takeover-wrapper");if(!i||!o||!t)return;const r=(e=>{const{width:t,height:n}=e;return hi(t,n)?ri:Me(e,ye)?di:mi()?ai:si})(e),s=o.offsetHeight,a=window.scrollY>s;o.style.display="block",!a&&Ti(r,!1),((e,t)=>{({[si]:Ni,[ri]:Li,[ai]:xi,[di]:ji})[t](e)})(o,r),_i(),((e,t)=>{({[si]:Pi,[ai]:Pi,[ri]:Oi,[di]:$i})[t](e)})(o,r),((e,t,n)=>{if(!n)return;({[si]:()=>{const{buttonLabel:i}=wi(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:"")})},[ri]:()=>{const{themeColors:i,logotype:o,buttonLabel:r,showArrowIcon:s}=wi(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!=r?r:""),".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&&o&&(n.setAttribute("src",o.url),n.setAttribute("alt",o.alt)),".advertory-splash-navbar-wrapper"===t&&i){const{backgroundColor:e,color:t}=i;n.style.setProperty("background-color",null!=e?e:ii,"important"),n.style.color=null!=t?t:oi}}})},[ai]:()=>{const{buttonLabel:i,showArrowIcon:o,showCloseButton:r=!0}=wi(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||r||(n.style.display="none"),"#advertory-topscroller-scroll-image"!==t||o||(n.style.display="none"),"#advertory-topscroller-scroll-label"===t&&(n.innerText=null!=i?i:""))})},[di]:()=>{}})[t]()})(o,r,t),yield yi(),!a&&Ti(r,!0),bi(e,r)}),Mi="advertory-brandmetrics-survey",Ri=()=>t(void 0,void 0,void 0,function*(){const{norstat:{enabled:e}={},country:n,isMobileApp:i,tcf:o}=c.get(),r=yield I(o,i,n,"norstat");if(!e||i||!r)return;const s=(e=>{const{ppid1:t,ppid2:n}=re.getPPIDs(),{ppid1:i,ppid2:o}=se.getPPIDs(),r=(new oe).add(n,Y[e]).add(t,X[e]).add(o,Z[e]).add(i,ee[e]);return`${r.buildNorstatPath()}?${r.buildNorstatQuery("alias").toString()}`})(n);((e,n,...i)=>{t(void 0,[e,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===v.NO?"schibsted":"schibstedse"}/map/${s}`,"norstat")}),Fi={nativeAd:e=>Ce(e)&&!xe(e),buyrecipe:e=>e.targetId.startsWith("buyrecipe"),fullwidthAd:Se,fullscreenScroll:Ae,topscroller:e=>Oe(e)&&mi(),splash:e=>Oe(e)&&hi(e.width,e.height),welcomePage:Oe,wallpaper:$e,skyscraper:e=>e.targetId.includes("skyscraper")&&!!e.banner,lFormat:De,hFormat:Be,toppanorama:e=>e.targetId.startsWith("toppanorama")&&!Be(e)&&!De(e),topboard:e=>e.targetId.startsWith("topboard")&&!Oe(e),widescreen:qe,insider:e=>e.targetId.startsWith("insider"),sponsorstripe:xe,brandboard:e=>(e=>(980===e.width||1920===e.width&&e.targetId.includes("brandboard"))&&!e.targetId.includes("topboard")&&!e.targetId.includes("companion")&&!je(e))(e)&&!(e=>e.targetId.includes("backfill"))(e)&&!_e(e),outstream:e=>"https://acdn.adnxs.com/video/outstream/ANOutstreamVideo.js"===e.renderer_url,netboard:e=>(e=>e.targetId.startsWith("netboard"))(e)||(e=>e.targetId.startsWith("board"))(e),panorama:je,midboard:_e},Vi=({adObj:e,preferredTestIdData:t})=>{var n,i;const o=null!==(n=null==t?void 0:t.targetId)&&void 0!==n?n:null==e?void 0:e.targetId;if(!o)return;const r=null===(i=document.querySelector(`#${o}`))||void 0===i?void 0:i.parentElement;if(!r)return;if(((e,t)=>{var n,i,o,r;const s=null===(r=null===(o=null===(i=null===(n=window.apntag)||void 0===n?void 0:n.requests)||void 0===i?void 0:i.tags)||void 0===o?void 0:o[e])||void 0===r?void 0:r.invCode;s&&(t.dataset.invCode=s)})(o,r),null==t?void 0:t.testId)return void(r.dataset.testid=t.testId);const s="DIV"===(null==r?void 0:r.tagName);e&&s&&((e,t)=>{var n,i;for(const[o,r]of Object.entries(Fi))if(r(e)){if("nativeAd"===o){const r="default";t.dataset.testid=`${o}-${null!==(i=null===(n=null==e?void 0:e.native)||void 0===n?void 0:n.desc2)&&void 0!==i?i:r}`;break}t.dataset.testid=o;break}})(e,r)},Ui=e=>{var t;return(null===(t=Object.entries(Fi).find(([,t])=>t(e)))||void 0===t?void 0:t[0])||""},Hi=(e,t)=>{const n=e.width,i=(null!=t?t:window.screen.width)/n;return i<1?i:1},zi=new Map;zi.set("insider",{scale:.82,transformOrigin:"left center",cogwheelAdjust:!0}),zi.set("panorama",{scale:.79,transformOrigin:"center center"}),zi.set("outstream",{scale:.79,transformOrigin:"center center"}),zi.set("integration",{scale:.79,transformOrigin:"center center"}),zi.set("toppanorama",{scale:.8,transformOrigin:"left center"});const Wi=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=Ui(e),o=zi.get(i),r=document.querySelector(`#${e.targetId}`);if(!r||!o)return;if(r.style.transformOrigin=o.transformOrigin,r.style.transform=`scale(${o.scale})`,!(null==o?void 0:o.cogwheelAdjust))return;const s=document.querySelector(`div[class*="gdpr-cogwheel-button"][id$="${e.targetId}"]`),a=null==r?void 0:r.offsetWidth;s&&"number"==typeof a&&!isNaN(a)&&s.style.setProperty("right",String(-1*a*.2)+"px")},Ki=e=>{var t,n,i,o,r,s;const{adScaleConfig:a,deviceType:d}=c.get();if(!(null==a?void 0:a.enabled))return;if(Me(e,pe))return;const l=null!==(t=a.adsToBeScaled[d])&&void 0!==t?t:[],u=Vt(e.targetId.split("-")[0]);if(!l.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!==(o=null==p?void 0:p.offsetWidth)&&void 0!==o?o:window.screen.width,h=null!==(s=null===(r=null==p?void 0:p.parentElement)||void 0===r?void 0:r.offsetWidth)&&void 0!==s?s:window.screen.width;((e,t=window.screen.width)=>{const n=Hi(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)},Gi=(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,Ji=e=>`externalImpId:'${e}'`,Qi=e=>{var t;const{forwardExternalImpId:n=!1,tracker:i}=c.get(),o=(e=>{var t;if(!e.positionConfig)return e;const n=e.keywords[`${W()}-count`],i=e.positionConfig.find(e=>e.adPositionIndex===n);if(!i)return e;const o=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:o})})(e),{id:r,sizes:s,keywords:a,allowedFormats:d,invCode:l,ssa:u=!1,nativeCustomProperties:v,safeframeConfig:p,dynamicSizeWidthCheck:h=!1}=(e=>{var t;if(!e.takeoverCookieCapForSharedPlacement||pi())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!==ai),o=Object.assign(Object.assign({},e.keywords),n&&{"no-sno-adformat":i}),r=e.sizes.filter(([e,t])=>4!==e||4!==t);return Object.assign(Object.assign({},e),{sizes:r,keywords:o})})(o),m=Object.assign({invCode:l,sizes:s,targetId:r,keywords:Gi(a,u),allowedFormats:d,dynamicSizeWidthCheck:h},p&&{safeframeConfig:p}),y=(e=>{var t,n,i,o,r,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)?(g("Tracker state pageViewId is:",null===(r=null===(o=null==e?void 0:e.instance)||void 0===o?void 0:o.state)||void 0===r?void 0:r.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):(g("Tracker state does not contain field pageViewId or it is empty"),""):(g("Tracker state is empty"),""):(g("Tracker is not configured in initAdvertory function"),"")})(i);n&&y&&(g("External Impression ID assigned to defineTag:",Ji(y)),m.externalImpId=Ji(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}}))(v);return(null===(t=e.allowedFormats)||void 0===t?void 0:t.includes("native"))&&(m.native=f),m},Yi=e=>!e.includes("takeover")||pi(),Xi=(e,t,n,i)=>{const o=t.parentElement;if(!o)return;const r=e?`-${e}`:"",s=i?`__${i}`:"",a=`advertory${r}-${n}${s}`,d=`advertory${r}-${n}-wrapper${s}`;t.classList.remove(...t.classList),o.classList.remove(...o.classList),t.classList.add(a),o.classList.add(d),t.dataset.adType=n},Zi="finn-blink",eo="native-ad",to=e=>{const{publisher:t=""}=c.get(),n=document.querySelector(`#${e}`);if(!n)return;const i=`-${t}`;n.classList.remove(`advertory${i}-finn-blink`),n.classList.remove(`advertory${i}-finn-blink-wrapper`)},no=e=>{if(!e)return e;const{country:t}=c.get(),n=z(t),i=e[`${n}-targetid`],o=i?$t(i[0]):"";return Object.assign(Object.assign({},e),i&&{[`${n}-targetid`]:[o]})},io=e=>{const{country:t}=c.get(),n=z(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"]})},oo=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],o=e.find(e=>e.invCode===i),r=document.querySelector(`[id^=${null==o?void 0:o.id}]`);r&&r.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"})})()},ro=(e,n)=>t(void 0,void 0,void 0,function*(){return yield new Promise(t=>{e().then(e=>{t(null!=e?e:null)}).catch(e=>{t(null)})})}),so={arrayMerge:(e,t)=>t},ao=e=>t(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))})(e))return e;try{const n=yield(e=>t(void 0,void 0,void 0,function*(){const t=(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})(e);if(!t)return null;const n=new AbortController,i=setTimeout(()=>n.abort(),5e3);try{return yield J.get(t,{method:"GET",signal:n.signal})}catch(e){throw g("Failed to fetch S3 config",{error:e,url:t}),e}finally{clearTimeout(i)}}))(e);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],so),c=r(e.pageOptions,{keywords:i},so),u=r(e.appearanceConfig,{defaultThreshold:a},so),v=r(null!==(n=e.refreshConfig)&&void 0!==n?n:{},{scrollRefreshEnabled:o},so);return Object.assign(Object.assign({},e),{placements:l,requestSize:null!=d?d:e.requestSize,pageOptions:c,appearanceConfig:u,refreshConfig:v})})({siteConfig:e,configOverrides:n}):e}catch(t){return g("Error fetching S3 config, using site config",{error:t}),e}}),lo=".advertory-right-column-track",co="--advertory-right-column-track-height",uo=e=>e.getBoundingClientRect().top+window.scrollY,vo=e=>{const{marginTop:t,marginBottom:n}=getComputedStyle(e);return e.getBoundingClientRect().height+parseFloat(t||"0")+parseFloat(n||"0")},po=(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}`,ho=(e,t,n)=>{var i;const o=Array.from(null!==(i=e.querySelectorAll(t))&&void 0!==i?i:[]),r=(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===r.length)return;const s=uo(e);(()=>{const e=document.querySelector("header");if(!e)return;const t=vo(e);po("--advertory-newsroom-header-height",t)})(),r.forEach(({point:e,originalIndex:t})=>{((e,t,n)=>{const i=uo(e),o=go(co,t),r=i-n,s=go("--advertory-right-column-split-point-height",t),a=vo(e);po(o,r),po(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=vo(e);po(n,i)})(o[t])});((e,t)=>{const n=uo(e);po(co,n-t)})(r[Math.min(o.length,r.length-1)].point,s)};let mo=!1;class yo{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:o}=new URL(n);if(!i.includes("www.vg.no")&&!o.includes("annonsorinnhold"))return[n];const r=o.split("/");return r.length?[...r.filter(Boolean).slice(1).map(e=>e),n]:[n]}}class fo{getPulseObjectId(){return""}getPulsePageId(e,t){return""}}class wo{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(e){return t(this,void 0,void 0,function*(){var t,n,i,o,r,s,a,d,l;const c=new CustomEvent("advertory:partnerstudioAdImpression",{detail:{ad:null===(t=this.parseKilkayaData(e))||void 0===t?void 0:t.placement}});if(window.dispatchEvent(c),!this.pulse)return;const u=this.getEventInput(e,"view");(null===(n=this.pulse)||void 0===n?void 0:n.trackLegacyViewUIElement)?null===(o=null===(i=this.pulse)||void 0===i?void 0:i.trackLegacyViewUIElement)||void 0===o||o.call(i,u):(null===(r=this.pulse)||void 0===r?void 0:r.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(e){return t(this,void 0,void 0,function*(){var t,n,i,o,r,s;if(!this.pulse)return;const a=this.getEventInput(e,"click");this.pulse.trackLegacyClickUIElement?null===(n=(t=this.pulse).trackLegacyClickUIElement)||void 0===n||n.call(t,a):this.pulse.trackClickUIElement?null===(o=(i=this.pulse).trackClickUIElement)||void 0===o||o.call(i,a):null===(s=(r=this.pulse).trackElementClick)||void 0===s||s.call(r,a)})}}class bo extends wo{constructor(e,t,n){super(e,t),this.pulse=e,this.newsroomStrategy=t,this.pageType=n}getEventBaseData(e){var t,n,i,o,r,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!==(o=null===(i=null===(n=this.newsroomStrategy)||void 0===n?void 0:n.getPulseObjectId)||void 0===i?void 0:i.call(n))&&void 0!==o?o: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===(r=this.newsroomStrategy)||void 0===r?void 0:r.getTags)||void 0===s?void 0:s.call(r,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 Eo="[data-k5a-teaser-analytics]",To=(e,t,n)=>{const i=document.querySelectorAll("k5a-stream");if(!i.length)return;const o=new bo(e,t,n),r=new WeakMap,s=e=>{const t=r.get(e);t&&(t.disconnect(),r.delete(e))},a=new IntersectionObserver((e,t)=>{e.forEach(e=>{if(!e.isIntersecting)return;const n=e.target,i=n.querySelector(Eo);Boolean(null==i?void 0:i.dataset.k5aTeaserAnalytics)?(o.trackContentView(n),t.unobserve(e.target),s(n)):((e,t)=>{if(r.has(e))return;const n=new MutationObserver(()=>{const n=e.querySelector(Eo);Boolean(null==n?void 0:n.dataset.k5aTeaserAnalytics)&&(o.trackContentView(e),t.unobserve(e),s(e))});n.observe(e,{attributes:!0,childList:!0,subtree:!0,attributeFilter:["data-k5a-teaser-analytics"]}),r.set(e,n)})(n,t)})},{threshold:.5});i.forEach(e=>{a.observe(e),e.addEventListener("click",()=>o.trackContentClick(e))})};class Io{handleKilkayaStreamTracking({pulse:e,pageType:t,publisher:n}){if(!(null==e?void 0:e.instance))return;const i={[p.VG]:new yo}[n]||new fo;To(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&&(g(`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:"";Dt(i)}loadKilkayaScript(e){return t(this,void 0,void 0,function*(){yield Ke(e)})}run(e){return t(this,void 0,void 0,function*(){const{tcf:t,isMobileApp:n,country:i,kilkaya:o}=e;if(!(null==o?void 0:o.enabled))return;const r=yield I(t,n,i,"kilkaya");r&&(this.observeForKilkayaBackfills(),this.injectKilkayaMeta(r),yield this.loadKilkayaScript(o.url),this.handleKilkayaStreamTracking(e))})}}const ko=1e4,Ao=e=>e.some(e=>e.some(e=>!!e&&Qn(e,0)));let Co;const So=()=>{const{widescreenSwitching:e}=c.get(),{enabled:t,rotationInterval:n=ko,widescreenIdPrefix:i}=null!=e?e:{};if(!t)return;const o=((e="widescreen")=>{const{pageSectionsSelectors:{right:t}={}}=c.get();return t?Array.from(document.querySelectorAll(t)).map(t=>Array.from(t.querySelectorAll(`div[id^="${e}"]`))):[]})(i);let r=0,s=Date.now(),a=Ao(o);if(!o.length)return;Co&&window.removeEventListener("scroll",Co);const d=(e,t,n)=>{e.forEach(e=>{e&&e.style.setProperty(t,n)})},l=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="")})})(o);const u=((e,t)=>{let n=null;return(...i)=>{null===n&&(e(...i),n=setTimeout(()=>{n=null},t))}})(()=>{a||(a=Ao(o)||a,s=Date.now());Date.now()-s>=n&&((()=>{const e=l(r),t=o.map(e=>e[r]),n=o.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)})(),r=l(r),s=Date.now())},1e3);Co=u,window.addEventListener("scroll",u)},Oo={Blink:"Blink"},Po=new Map,$o=e=>{var t;if(!Po.has(e)){const t=import(/* webpackIgnore: true */e).then(e=>(e=>{for(const[t,n]of Object.entries(Oo)){const i=e[t];null!=i&&(window[n]=i)}})(e)).catch(t=>{throw Po.delete(e),t});Po.set(e,t)}return null!==(t=Po.get(e))&&void 0!==t?t:Promise.resolve()},Lo="https://assets.finn.no/pkg/distribution-fixed/v1/FINNExternalDistribution.modern.js",xo="https://www.finn.no/distribution-front/external/carousel",No={get:e=>{try{const t=sessionStorage.getItem(e);return t?JSON.parse(t):null}catch(e){return g(`sessionStorageClient.get: Error during getting data from sessionStorage: ${e}`),null}},set:(e,t)=>{try{sessionStorage.setItem(e,JSON.stringify(t))}catch(e){g(`sessionStorageClient.set: Error during saving data to sessionStorage: ${e}`)}},remove:e=>{try{sessionStorage.removeItem(e)}catch(e){g(`sessionStorageClient.remove: Error during remove data from sessionStorage: ${e}`)}}},jo="finn_blink_id",_o=n=>t(void 0,void 0,void 0,function*(){const{userId:t,id:i,hashed_email:o,theme:r}=n,s=e(n,["userId","id","hashed_email","theme"]),a=window[Oo.Blink];if(!a)return;const d=new a({remote:xo,id:i,hashed_email:o,theme:r});yield d.inject(Object.assign({},s))}),qo=n=>t(void 0,void 0,void 0,function*(){const{userId:t,theme:i}=n,o=e(n,["userId","theme"]),r=window[Oo.Blink];if(!r)return;const s=new r({remote:xo,userId:t,theme:i});yield s.inject(Object.assign({},o))}),Do=e=>{var t,n;const i=document.querySelector(`[id^="${e}"]`);return null!==(n=null===(t=null==i?void 0:i.dataset)||void 0===t?void 0:t.finnBlinkId)&&void 0!==n?n:e},Bo=(e,t)=>{const{finnBlink:{enabled:n}={}}=c.get(),i=(null==t?void 0:t.enabled)||(e=>{var t;const n=document.querySelector(`[id^="${e}"]`);return!!(null===(t=null==n?void 0:n.dataset)||void 0===t?void 0:t.noBidAd)})(e);if(!i||!n)return null;const{limit:o,height:r,requireImage:s,theme:a,rec:d,distributionTypes:l,position:u,offset:v,advertoryTheme:p}=t||{};return{selector:`#${Do(e)}`,enabled:i,position:null!=u?u:e,distributionTypes:null!=l?l:[],limit:null!=o?o:100,height:null!=r?r:100,offset:null!=v?v:200,requireImage:s,rec:d,theme:"dark"===a?"dark":"light",advertoryTheme:p}},Mo=(e,n,i)=>t(void 0,void 0,void 0,function*(){var o;const{placements:r,deviceType:s}=c.get();g(`rendering finn blink ad for ${e}`);const a=$t(e),d=r[s].find(e=>e.id===a),l=Bo(e,null==d?void 0:d.finnBlink);if(!(null==l?void 0:l.enabled))return g(`Finn blink is not enabled on placement: ${e}`),i&&i(e),void to(e);if((e=>{var t;const n=Do(e),i=document.querySelector(`[id^="${n}"]`);return!!(null===(t=null==i?void 0:i.classList)||void 0===t?void 0:t.contains("finn"))})(e))return void g(`Finn blink already loaded ${e}`);const{publisher:u,country:v,finnBlink:p}=n,{userId:m,uuid:y,channel:f,theme:w}=null!=p?p:{},b=null!=f?f:`${u}.${v}`,E=(e=>{if(!e){const e=A();return null!=e?e:""}return e})(m),T="dark"===w?"dark":"light";try{const e=yield t(void 0,void 0,void 0,function*(){const{finnBlink:{identifierUrl:e}={}}=c.get(),t=No.get(jo),n=h("finncode");if(!e||n)return"";if(!t){const t=yield J.get(e,{credentials:"include"}),{finn_blink_id:n}=t;if(!n)throw new Error("getFinnBlinkIdentifier: No finn_blink_id found");return No.set(jo,n),n}return t}),n=yield t(void 0,void 0,void 0,function*(){const{ppid2:e}=se.getPPIDs();return e}),i=(null===(o=null==d?void 0:d.finnBlink)||void 0===o?void 0:o.useNewConstructor)?qo:_o;yield i(Object.assign(Object.assign({},l),{channel:b,id:E,userId:n,hashed_email:e,theme:T,uuid:y})).then(()=>{((e,t)=>{const{siteSpecificConfig:{publisherClassName:n}={},pageType:i}=c.get(),o=document.querySelector(`#${e}`);if(!o)return;if(o.classList.add("disable-cogwheel"),!n)return;Xi(n,o,Zi,null!=t?t:i),Vi({preferredTestIdData:{targetId:e,testId:"finn"}})})(l.selector.replace("#",""),l.advertoryTheme)})}catch(t){g(`Finn blink error ${t}`),i&&i(e),!i&&qt(e),to(e)}}),Ro=()=>t(void 0,void 0,void 0,function*(){const{tcf:e,isMobileApp:t,country:n}=c.get();return!!(yield I(e,t,n,"finn-blink"))||(g("Skip loading finn blink ad due to missing TCF consent."),!1)}),Fo=(e,t)=>{var n;(g(`Appending ${t.id} after ${e.id}`),e.parentElement&&(n=e.parentElement,!Array.from(n.children).some(e=>e.classList.contains("advertory-finn-blink-wrapper"))))?(e.parentElement.style.display="none",e.parentElement.insertAdjacentElement("afterend",t)):g(`Cannot perform afterend on: ${e.id}`)},Vo=e=>document.querySelector(`#${e}`);let Uo,Ho=[];const zo=["takeover","wallpaper"],Wo=e=>{const t=(e=>{const t=Ue.getData("alertoryConfigKeywords"),{queryConfig:n,placements:i,tcf:o,glimr:r,appearanceConfig:s,requestSize:a=d,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:o,requestSize:a,isMobileApp:p,useAppTabletInvCode:y},r&&{glimr:r}),n&&{queryConfig:n}),s&&{appearanceConfig:s}),h&&{takeover:h}),m&&{fullscreenScroll:m})}})(e);window.advertory={initialized:!0,siteConfig:e,alertoryConfig:t}},Ko=()=>t(void 0,void 0,void 0,function*(){const{pageOptions:e}=c.get(),{preparePageOptions:n}=c.getHandlers(),i=(()=>{const{sandboxAdIframeEnabled:e=!0}=c.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"]}})(),o=yield t(void 0,void 0,void 0,function*(){const{tcf:e,isMobileApp:t,country:n}=c.get();return(yield I(e,t,n,"page-options"))?{}:{userSync:{disabled:!0}}}),r=yield n(Object.assign(Object.assign(Object.assign({disablePsa:!0,enableSafeFrame:!0},e),{renderingManagement:Object.assign({},i)}),o));(e=>{const t=Ue.getData("alertoryConfigKeywords");if(Object.keys(t).length)return;const n=io(e);Ue.setData("alertoryConfigKeywords",n)})(r.keywords),At(()=>Uo.setPageOpts(r))}),Go=e=>t(void 0,void 0,void 0,function*(){const{prebid:t,tcf:n,isMobileApp:i,country:o}=c.get(),r=yield I(n,i,o,"loadPlacements"),s=((e,t)=>t?e:(e.filter(e=>!e.supportsNonRTB).forEach(e=>qt(e.id)),e.filter(e=>e.supportsNonRTB).map(e=>{return Object.assign(Object.assign({},e),{invCode:(t=e.invCode,`${t}_non_rtb`)});var t})))(e,r);Jo(s);(null==t?void 0:t.enabled)&&r&&!Et()?(g("core loadPlacements prebid enabled"),yield Tt()):(g("core load tags invoked without prebid enabled"),Qo(s))}),Jo=e=>{const{prepareTag:t}=c.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)),o=t.findIndex(e=>n.id.includes(e));return-1!==i&&-1===o?-1:-1===i&&-1!==o?1:i-o})})(e).forEach(e=>{g("core defineTags",{placement:e});const i=Qi(e);if(Yi(e.id)){const o=t(i),r=(e=>{const{allowedFormats:t,invCode:n,keywords:i,sizes:o}=e;return{adTypes:t,invCode:n,keywords:no(i),sizes:o}})(o);n.push(r),At(()=>(g("core defineTag - add to the queue",{placement:e,preparedTag:o}),Uo.defineTag(o)))}}),(e=>{var t,n,i;(null===(i=null===(n=null===(t=window.advertory)||void 0===t?void 0:t.alertoryConfig)||void 0===n?void 0:n.xandr)||void 0===i?void 0:i.tags)&&e.length&&window.advertory.alertoryConfig.xandr.tags.push(e)})(n)},Qo=e=>{const t=e.filter(({id:e})=>Yi(e)).map(({id:e})=>e);t.length&&At(()=>(g("core loadTags",{placementsIdsToLoad:t}),Uo.loadTags([...t])))},Yo=(e,n)=>t(void 0,void 0,void 0,function*(){const{appearanceConfig:t,deviceType:i}=c.get(),{threshold:o,refresh:r}=e,s=(e=>{const t=document.querySelector(`[data-show-tag-subscribe-id=${e.targetId}]`),n=document.querySelector(`#${e.targetId}`);return t||n})(n),a=null==t?void 0:t.defaultThreshold[i];s&&(g("core showAd - subscribe for show tag with thresholds",{placement:e,adObj:n,threshold:o,deviceDefaultThreshold:a}),yield Bn(s,null!=o?o:a)),s&&r&&(g("core showAd - setup refreshing",{placement:e,adObj:n}),s.dataset.refresh=r.toString())}),Xo=e=>e.some(({id:e})=>zo.some(t=>e.includes(t))),Zo=e=>t(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,o]=(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]]},[[],[]]))(e),r=(e=>{const{requestSize:t=d,queryConfig:{placementBatches:n}={},deviceType:i}=c.get(),o=Wt(e),r=Object.keys((null==n?void 0:n[i])||{}).map(e=>o[e]||[]).filter(e=>e.length>0),s=new Set(r.flat().map(({id:e})=>e)),a=e.filter(({id:e})=>!s.has(e));return[...r,...Gn(a,t)]})(o);for(const e of r)Xo(e)?(g("core loadAds without lazy loading",{placementsToLoad:e}),yield Go(e)):e.length&&(g("core loadAds with lazy loading",{placementsToLoad:e}),yield er(e));yield(e=>t(void 0,void 0,void 0,function*(){if(!e.length)return;const{appearanceConfig:t,deviceType:n}=c.get(),i=null==t?void 0:t.defaultThreshold[n];for(const t of e){const{threshold:e,id:n}=t,o=Vo(n);o&&(yield Bn(o,null!=e?e:i))}}))(i)}),er=e=>t(void 0,void 0,void 0,function*(){const{queryConfig:{lazyLoadingV3:{enabled:t=!1,rootMargin:n="200% 0px"}={}}={}}=c.get(),i=[];if(!t)return g("lazy load is not enabled",{placements:e}),void(yield Go(e));const o=new IntersectionObserver((t,n)=>{t.filter(({isIntersecting:e,target:{id:t}})=>e&&!t.includes("wallpaper")).forEach(t=>{g("lazy load is enabled - handler start",{loadedPlacementIds:i,placements:e});const o=e.every(e=>i.includes(e.id)),r=e.map(e=>e.id);!o&&i.push(...r),!o&&Go(e),g("lazy load is enabled - handler stop",{loadedPlacementIds:i,placements:e,arePlacementsLoaded:o,placementIds:r}),n.disconnect()})},{rootMargin:n});e.forEach(e=>{const t=document.getElementById(e.id);t&&(g("lazy loading - observe element",{placementId:e.id,element:t}),o.observe(t))})}),tr=()=>t(void 0,void 0,void 0,function*(){const{siteEvents:e,initNativeAd:n,wallpaperHandlers:{initWallpaperAd:i,adjustAdToHorseshoe:o}}=c.getHandlers(),{wallpaper:r,fullscreenScroll:s}=c.get(),a=[];At(()=>{Uo.onEvent("adRequested",()=>{e.adRequested()}),Uo.onEvent("adAvailable",o=>t(void 0,void 0,void 0,function*(){var t,a,d,l,u,v;g("core adAvailable start",{placementsAvailable:Ho,adObj:o,isFullscreenScrollAd:Ae(o),isFinnBlink:Ne(o.targetId),isNativeAd:Ce(o),isMediation:Ie(o),isTakeoverAd:Oe(o),isCollapseAd:Le(o),isWallpaperAd:$e(o)});const p=null===(d=null===(a=null===(t=null===window||void 0===window?void 0:window.apntag)||void 0===t?void 0:t.requests)||void 0===a?void 0:a.tags[o.targetId])||void 0===d?void 0:d.adResponse.ads;Ie(o)&&p&&(null===(l=p[1])||void 0===l?void 0:l.rtb)&&(o.banner=null===(v=null===(u=p[1])||void 0===u?void 0:u.rtb)||void 0===v?void 0:v.banner),Ae(o)&&ft(o),qe(o)&&So(),Ae(o)&&!Ne(o.targetId)&&yt(o,s),!Ce(o)||Ie(o)||Ne(o.targetId)||n(o,c.get()),Oe(o)&&!Le(o)&&(Di(o.targetId),yield Bi(o)),$e(o)&&(i(()=>At(()=>window.apntag.showTag(o.targetId)),r),Ue.setData("wallpaper",{isAvailable:!0})),(e=>e.targetId.includes("skyscraperleft")&&!!e.banner)(o)&&Ue.setData("horseshoe",{isAvailable:!0}),Vi({adObj:o}),(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:o}=e;o?t.dataset.adSizes="[1,1]":n&&i&&(t.dataset.adSizes=`[${i},${n}]`)})(e,i)})(o),e.adAvailable(o);const h=Ho.find(({id:e})=>e===o.targetId);h&&(yield Yo(h,o),Ho=Ho.filter(e=>e.id!==h.id)),g("core adAvailable stop",{placementsAvailable:Ho,adObj:o,isFullscreenScrollAd:Ae(o),isFinnBlink:Ne(o.targetId),isNativeAd:Ce(o),isMediation:Ie(o),isTakeoverAd:Oe(o),isCollapseAd:Le(o),isWallpaperAd:$e(o)})})),Uo.onEvent("adLoaded",t=>{const{refreshConfig:i,appearanceConfig:r}=c.get(),s=document.getElementById(t.targetId);Ne(t.targetId)&&(e=>{const{fullscreenScroll:t}=c.get(),{initNativeAd:n}=c.getHandlers();Ae(e)&&yt(e,t),Ce(e)&&n(e,c.get())})(t);a.includes(t.targetId)&&Ce(t)&&(n(t,c.get()),Vi({adObj:t})),!a.includes(t.targetId)&&Ie(t)&&a.push(t.targetId),Le(t)&&qt(t.targetId),Oe(t)&&((e,t)=>{var n;const i="100%",o="100%";e.resizeAd(t,[i,o]);const r=null===(n=document.querySelector(`#div_utif_${t}`))||void 0===n?void 0:n.querySelector("iframe");if(!r)return;new MutationObserver(e=>{for(const t of e)if("attributes"===t.type&&"style"===t.attributeName){const e=window.getComputedStyle(r),t=e.width,n=e.height;t===i&&n===o||(r.style.width=i,r.style.height=o)}}).observe(r,{attributes:!0,attributeFilter:["style"]})})(Uo,t.targetId),Se(t)&&(e=>{const t=document.querySelector(`#${e.targetId}`),{siteSpecificConfig:{publisherClassName:n,fullWidthFormatClassName:i}={}}=c.get();if(!t||!n||!i)return;const o=t.parentElement;o&&(t.classList.add(`advertory-${n}-${i}__full-width-ad`),o.classList.add(`advertory-${n}-${i}-wrapper__full-width-ad`))})(t),(e=>Me(e,ge))(t)&&(e=>{var t;const n=document.querySelector(`#${e.targetId}`),i=null===(t=document.querySelector(`#${e.targetId}`))||void 0===t?void 0:t.parentElement,o=null==n?void 0:n.querySelector("iframe"),r=null==o?void 0:o.parentElement,{siteSpecificConfig:{publisherClassName:s,fullWidthFormatClassName:a}={}}=c.get();if(!(n&&o&&r&&i))return;i.classList.add(`advertory-${s}-${a}__vertical-full-width-ad-wrapper`);const d=window.innerWidth,l=Math.round(d/1080*1920);n.style.width="100%",n.style.height=`${l}px`,n.classList.add(`advertory-${s}-${a}__vertical-full-width-ad`);const u=Hi(e,n.offsetWidth);r.style.transform=`scale(${u})`,r.style.transformOrigin="left top"})(t),((e,t)=>{if(!(null==t?void 0:t.scrollRefreshEnabled))return;const{targetId:n}=e,i=document.querySelector(`#${n}`),o=null==i?void 0:i.parentElement;if(!o||!i)return;zn({adWrapper:o,placementContainer:i});const{delayTime:r=1e3}=t,s=(new Date).getTime();i&&"true"!==i.dataset.subscribedForRefresh&&(i.dataset.subscribedForRefresh="true",i.dataset.refresh&&Kn(i,s,r))})(t,i),(null==r?void 0:r.clearProbableDimensionsEnabled)&&(e=>{const t=document.querySelector(`#${e}`);t&&(t.style.minWidth="",t.style.minHeight="")})(t.targetId);Ue.getData("horseshoe").isAvailable&&o(t.targetId),Ki(t),e.adLoaded(t),wt(t.targetId),s&&(s.classList.add(bt),(e=>{var t,n;const{siteSpecificConfig:i}=c.get(),o=null!==(t=null==i?void 0:i.mainColumnWidth)&&void 0!==t?t:1/0;e.clientWidth>o&&(null===(n=e.parentElement)||void 0===n||n.setAttribute("data-two-column-ad-layout","true"))})(s)),Wi(t),window.dispatchEvent(new CustomEvent("advertory:adLoaded",{detail:{targetId:t.targetId,adFormat:Ui(t)}}))}),Uo.onEvent("adNoBid",n=>t(void 0,void 0,void 0,function*(){qt(n.targetId),yield In(c.get(),n),fi(n)&&(yield yi()),e.adNoBid(n)})),Uo.onEvent("adError",(n,i)=>t(void 0,void 0,void 0,function*(){fi(i)&&(yield yi()),e.adError(n,i)})),Uo.onEvent("adCollapse",()=>{e.adCollapse()}),Uo.onEvent("adRequestFailure",n=>t(void 0,void 0,void 0,function*(){qt(n.targetId),yield In(c.get(),n),e.adRequestFailure(n)})),Uo.onEvent("adBadRequest",n=>t(void 0,void 0,void 0,function*(){qt(n.targetId),yield In(c.get(),n),e.adBadRequest(n)})),Uo.onEvent("adLoadedMediated",t=>e.adLoadedMediated(t)),Uo.onEvent("adNoBidMediated",n=>t(void 0,void 0,void 0,function*(){yield In(c.get(),n),e.adNoBidMediated(n)}))})}),nr=(e,n)=>t(void 0,void 0,void 0,function*(){var t;if(!(null===(t=null===window||void 0===window?void 0:window.advertory)||void 0===t?void 0:t.initialized))return[];const{clearAds:i,reloadExistingAds:o,renderFinnBlinkPlacements:r,contextSelector:s}=null!=n?n:{};if(i)return Rt(),[];o&&(Rt(),document.querySelectorAll('[data-advertory-ad-rendered="true"]').forEach(e=>{Dt(e.id)})),u(null!=e?e:{}),yield Ko();let a=Ht(s);return r&&(a=a.filter(e=>Ne(e.id))),a.length>0&&(Ho=[...Ho,...a.map(e=>Object.assign({},e))],Yn(a),Zn(a),yield Zo(a)),Ho}),ir=(e,n)=>t(void 0,void 0,void 0,function*(){var i;c.set(e),c.setHandlers(n),Ue.initialize(),window.addEventListener("message",jn,!1),Uo=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=Uo,g("Apn tag is set up on window"),yield Promise.allSettled([t(void 0,void 0,void 0,function*(){const{tcf:e,isMobileApp:t,country:n}=c.get();(yield I(e,t,n,"xandr-endpoint"))||Uo.setEndpoint("ib.adnxs-simple.com",!0)}),t(void 0,void 0,void 0,function*(){if(Et())return;const{prebid:e,tcf:t,isMobileApp:n,country:i}=c.get(),o=yield I(t,n,i,"prebid");(null==e?void 0:e.enabled)&&o&&(yield Ke(null==e?void 0:e.url))}),ae(e),t(void 0,void 0,void 0,function*(){const{astUrl:e}=c.get();yield Ke(null!=e?e:"https://adsdk.microsoft.com/ast/ast.js")}),t(void 0,void 0,void 0,function*(){const{gptUrl:e,tcf:t,isMobileApp:n,country:i}=c.get();(yield I(t,n,i,"gpt-endpoint"))&&(yield Ke(null!=e?e:"https://securepubads.g.doubleclick.net/tag/js/gpt.js"))}),t(void 0,void 0,void 0,function*(){const{brandmetrics:{enabled:e,url:t}={},tcf:n,isMobileApp:i,country:o}=c.get(),{getConsentAsync:r}=T(n,0,o),s=yield r();if(e&&t&&s){if(yield Ke(t),document.querySelector(`.${Mi}`))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(Mi)})&&(t.disconnect(),window._brandmetrics=window._brandmetrics||[],window._brandmetrics.push({cmd:"_loadsurvey"}))}}).observe(document,{childList:!0,subtree:!0,attributes:!0})}}),R(),t(void 0,void 0,void 0,function*(){const{gdpr:{url:e,allowHidingAds:t=!0}={}}=c.get();t&&(window.gdpr=window.gdpr||{},window.gdpr.allowHidingAds=!0),yield Ke(null!=e?e:"https://cogwheel.inventory.schibsted.io/prod/latest/gdpr-bundle.js")})]),yield Ri(),g("Libraries have been loaded and trackers have been set"),yield(i=n.librariesToLoad,t(void 0,void 0,void 0,function*(){const e=i.map(e=>Ke(e));yield Promise.all(e)})),yield tr(),yield Ko(),g("Page options have been set"),Wo(e),g("Advertory is setup on window"),Ho=Ht(),Yn(Ho),Zn(Ho),yield Zo(Ho),g("Ads has been loaded",Ho),((e,n)=>{var i,o,r,s;if(!En())return void g("Ad block not enabled, Dr. Edition backfills will not be rendered");g("Ad block is enabled, Dr. Edition backfills will be rendered");const a=null!==(s=null===(r=null===(o=null===(i=e.finnBlink)||void 0===i?void 0:i.replacementConfig)||void 0===o?void 0:o.adsToReplace)||void 0===r?void 0:r.map(([e])=>e))&&void 0!==s?s:[],d=new IntersectionObserver((n,i)=>t(void 0,void 0,void 0,function*(){for(const t of n){if(!t.isIntersecting)continue;const n=t.target;i.unobserve(n),yield In(e,{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)})})(e,Ho),oo(Ho),yield n.replaceAdsWithFinnBlink(e.finnBlink),yield(e=>t(void 0,void 0,void 0,function*(){var t;if(!e.drEdition)return;if(!(yield I(e.tcf,e.isMobileApp,e.country,"handleDrEdition")))return;const n=yield yn(),i=new fn(n);wn({publisher:e.publisher,drEditionConfig:e.drEdition,device:e.deviceType,pageType:e.pageType,country:e.country},i,null===(t=e.pulse)||void 0===t?void 0:t.instance)}))(e),(e=>{if(!(null==e?void 0:e.enabled)||mo)return;const{splitPointIDs:t,adSelector:n,trackSelector:i=lo}=e,o=document.querySelector(i);if(!o)return;mo=!0;const r=()=>{ho(o,n,t)};r(),window.addEventListener("resize",r),window.addEventListener("orientationchange",r),window.addEventListener("load",r),window.addEventListener("advertory:adLoaded",()=>{requestAnimationFrame(r)}),new ResizeObserver(r).observe(o)})(e.rightColumnSplit),yield(e=>t(void 0,void 0,void 0,function*(){const t=new Io;yield t.run(e)}))(e)}),or=(e,n)=>t(void 0,void 0,void 0,function*(){yield((e,n)=>t(void 0,void 0,void 0,function*(){const{initConsentManager:t,getConsentAsync:i}=T(e.tcf,e.isMobileApp,e.country),o=yield ao(e);yield bn(),yield ro(t),yield ro(i),g("TCF resolved successfully"),yield ir(o,n),g("Run function resolved successfully")}))(e,n)}),rr=(e,t,n,i)=>{var o;const{image:r,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(r),imgWidth:null==r?void 0:r.width,imgHeight:null==r?void 0:r.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!==(o=null!=u?u:g)&&void 0!==o?o:"",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)},sr=(e,t)=>{const n=(i=y,window.location.href.includes(i));var i;const o=new URLSearchParams(window.location.search).get(y),r=t.includes("native_recirc");return n&&o?o:(null==e?void 0:e.includes("recirc"))?r?"native_recirc":"recirc":(null==e?void 0:e.includes("sponsor"))?"sponsorstripe":null},ar=(e,t,n,i)=>{const o=document.querySelector(`#${e}`);o&&t&&(o.innerHTML=t,((e,t)=>{const n=e.parentElement,{publisher:i,pageType:o}=t,r=i&&Object.values(p).includes(i);n&&r&&Xi(i,e,eo,o)})(o,n),i())},dr=e=>{var t;const n=document.querySelector(`#${e.targetId}`);if(!n||!(null===(t=e.native)||void 0===t?void 0:t.clickTrackers))return;(null==n?void 0:n.querySelectorAll("a.ad-link")).forEach(t=>{"true"!==t.dataset.tracked&&(t.addEventListener("click",()=>{var t,n;for(const i of null!==(n=null===(t=e.native)||void 0===t?void 0:t.clickTrackers)&&void 0!==n?n:[])vr(i)}),t.dataset.tracked="true")})},lr=e=>{const{native:{impressionTrackers:t}={}}=e;(null==t?void 0:t.some(e=>e.includes("googleads")))?null==t||t.forEach(ur):window.apntag.fireImpressionTrackers(e);const n=new CustomEvent("advertory:nativeImpression",{detail:{ad:e}});window.dispatchEvent(n)},cr=(e,t)=>{var n;let i=!1;const o=document.querySelector(`#${e.targetId}`);if(!o||!e.native)return;const{deviceType:r,appearanceConfig:s,nativeTrackingConfig:{fireImpressionsBasedOnAppearanceThreshold:a=!1}={}}=t,d=a?{rootMargin:`${l=null!==(n=null==s?void 0:s.defaultThreshold[null!=r?r:C.DESKTOP])&&void 0!==n?n:0}px 0px ${l}px 0px`}:{};var l;const c=new IntersectionObserver(t=>{if(!i)for(const n of t)if(n.isIntersecting){i=!0,lr(e),c.disconnect();break}},d);c.observe(o)},ur=e=>{const t=e.includes("googleads");"function"!=typeof window.navigator.sendBeacon||t?vr(e):window.navigator.sendBeacon(e)},vr=e=>{fetch(e,{method:"GET",mode:"no-cors"}).catch(t=>console.warn(`Tracker ${e} failed. Error: ${t||"Unknown"}`))},pr=(e,t,n)=>{const i=((e,t,n)=>{var i;const{displayTemplates:o,videoTemplates:r}=n,s="default";if(!e.native)return null;const{native:a,targetId:d}=e,{desc2:l=s}=e.native,c=l.toLowerCase(),u=null!==(i=sr(e.targetId,l))&&void 0!==i?i:c,p=vt[t.language||v.NO],g=rr(a,p,d,t);return(a.video?r[u]:o[u]||o.default)(g,t)})(e,t,n);ar(e.targetId,i,t,()=>{const{nativeTrackingConfig:{nativeTrackingEnabled:n=!0}={}}=t;n&&((e,t)=>{dr(e),cr(e,t)})(e,t)})},gr="viewable",hr="adClick";var mr=e=>(t,n,i)=>{const{video:o,img:r,url:s}=t,{publisher:a,productTag:d}=n,{pluginsNames:l,videoLoop:c}=i||{};if(!(null==o?void 0:o.content))return null;const u=Math.ceil(1e5*Math.random()),v=r||"https://custom.inventory.schibsted.io/1x1-00000000.png",p=`ad-player-${u}`,g=yr(o.content,s),h=fr({id:u,nodeId:p,poster:v,tagURL:g,publisher:a,productTag:d,videoLoop:c});return wr({playerConfig:h,clickUrl:s,pluginsNames:l}),`${e(t,n,p)}`};const yr=(e,t)=>{const n=(new DOMParser).parseFromString(e,"text/xml"),i=n.querySelector("ClickThrough"),o=n.querySelector("VideoClicks");if(i){for(;i.firstChild;)i.removeChild(i.firstChild);i.appendChild(n.createCDATASection(t))}else if(o){const e=n.createElement("ClickThrough");e.appendChild(n.createCDATASection(t)),o.appendChild(e)}return URL.createObjectURL(new Blob([(new XMLSerializer).serializeToString(n)],{type:"text/xml"}))},fr=({id:e,nodeId:t,poster:n,tagURL:i,publisher:o="",productTag:r="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:o.toLowerCase(),decorator:e=>Object.assign(Object.assign({},pn(e)?e:{}),{provider:Object.assign(Object.assign({},pn(null==e?void 0:e.provider)?e.provider:{}),{productTag:r})})}}),wr=e=>t(void 0,void 0,void 0,function*(){const{playerConfig:t,pluginsNames:n,clickUrl:i}=e,{repeat:o}=t,r=yield an(t);ln(n),r.once("assetReady",()=>{sn(r,n)}),r.on(gr,e=>{const{viewable:t}=e;t?r.play():r.pause()}),r.on(hr,()=>{window.open(i,"_blank")}),o&&r.on("pause",()=>{r.play()})}),br=({containerId:e,adText:t,url:n,adFrom:i,sponsoredBy:o,title:r},s,a)=>`<article class="advertory-abo-ad-native-video">\n <div class="ad-info" id="${e}-button"></div>\n <div class="ad-content">\n <div class="ad-image-container">\n <div class="ad-header">\n <span>${t}</span>\n </div>\n <div class="ad-player-wrapper">\n <div id="${a}"></div>\n </div>\n </div>\n <div class="ad-text-container">\n <span class="sponsored-by">\n ${i} ${o}\n </span>\n <a class="ad-link" href="${n}" target="_blank">\n <span class="ad-title">${r}</span>\n <div class="ad-description">${r}</div>\n </a>\n </div>\n </div>\n </article>`,Er=({containerId:e,url:t,adContent:n,logo:i,description:o,title:r,customTitle1:s,customTitle2:a},{publisher:d},l)=>(((e,t)=>{const n=document.querySelector(`#${t}`);if(n)for(const t of Object.keys(e))n.style.setProperty(t,e[t])})({"--desktopTitleSize":`${s?`${s}px`:"clamp(22px, 3.6rem, 59px)"}`},e),`<article class="advertory-abo-ad-native-content-video ${d}">\n <div class="ad-info" id="${e}-button"></div>\n <div class="ad-content">\n <div class="ad-header">\n <span>${n}</span>\n <img alt="${r}" class="ad-logo" src="${i}" loading="lazy" />\n </div>\n <div class="ad-image-container">\n <div class="ad-player-wrapper">\n <div id="${null!=l?l:0}"></div>\n </div>\n </div>\n <a class="ad-link" href="${t}" target="_blank">\n <div class="ad-text-container">\n <div class="ad-description">${o}</div>\n <h2 class="ad-title">\n ${r}\n </h2>\n </div>\n </a>\n </div>\n </div>\n </div>\n </article>`),Tr={VIDEO:(e,t)=>mr(br)(e,t),SPONSORSTRIPE:({title:e,sponsoredBy:t,logo:n})=>`<article class="advertory-abo-ad-native-sponsorstripe">\n <div class="ad-wrapper">\n <div class="info-button-wrapper" onClick="\n const adDescription = document.getElementById('ad-sponsorstripe-description');\n adDescription.classList.toggle('hide');\n ">\n <div class="info-button"></div>\n </div>\n\n <span class="ad-title">${e}</span>\n <img alt="${t}" class="ad-logo" src="${n}" />\n\n <div id="ad-sponsorstripe-description" class="ad-description hide">\n <span>${(e=>`Annonsøren har betalt for profilering av logo og merkenavn i artikler tilknyttet ${e}. Annonsøren har ingen innflytelse på Aftenpostens journalistiske virksomhet.`)(t)}</span>\n <a class="ad-description-readmore" href="https://www.aftenposten.no/slik-jobber-vi-i-aftenposten/i/xgKR18/ekstern-finansiering-av-innhold-i-aftenposten" target="_blank">Les mer</a>\n <div class="close-button-wrapper" onClick="\n const adDescription = document.getElementById('ad-sponsorstripe-description');\n adDescription.classList.toggle('hide');\n ">\n <div class="close-button"></div>\n </div>\n </div>\n </div>\n \n </article>`,RECIRC:({containerId:e,url:t,sponsoredBy:n,title:i,logo:o,img:r,adFrom:s,adText:a})=>`<article class="advertory-abo-ad-native-recirc">\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-image-container">\n <div class="ad-header">\n <span>${a}</span>\n </div>\n <img alt="${i}" class="ad-image" src="${r}" />\n <img alt="${n}" class="ad-logo" src="${o}" />\n </div>\n <div class="ad-text-container">\n <div class="ad-sponsored-by">\n ${s} ${n}\n </div>\n <div class="ad-title">${i}</div>\n </div>\n </div>\n </a>\n </article>`,CONTENT_BASIC:({containerId:e,url:t,sponsoredBy:n,title:i,logo:o,img:r,adFrom:s,adText:a},{publisher:d})=>`<article class="advertory-abo-ad-native-default ${d}">\n <div class="ad-info" id="${e}-button"></div>\n <a class="ad-link" href="${t}" target="_self">\n <div class="ad-content">\n <div class="ad-image-container">\n <div class="ad-header">\n <span>${a}</span>\n </div>\n <img alt="${i}" class="ad-image" src="${r}" />\n <img alt="${n}" class="ad-logo" src="${o}" />\n </div>\n <div class="ad-text-container">\n <div class="ad-sponsored-by">\n ${s} ${n}\n </div>\n <div class="ad-title">${i}</div>\n </div>\n </div>\n </a>\n </article>`,CONTENT_VIDEO:(e,t)=>{const{video:n}=e;return(null==n?void 0:n.content)?mr(Er)(e,t):null}},Ir={NATIVE_TEMPLATE:({containerId:e,url:t,sponsoredBy:n,title:i,img:o,adText:r})=>`<article class="advertory-no-ad-native-default">\n <div class="ad-info" id="${e}-button"></div>\n <a class="ad-link" href="${t}" target="_self">\n <div class="ad-content">\n <div class="ad-image-container">\n <img alt="${i}" class="ad-image" src="${o}" />\n </div>\n <div class="ad-text-container">\n <div class="ad-sponsor">\n <span class="ad-label">${r}</span> ${n}\n </div>\n <div class="ad-title">${i}</div>\n </div>\n </div>\n </a>\n </article>`,NATIVE_RECIRC:({containerId:e,url:t,sponsoredBy:n,title:i,img:o,adText:r})=>`<article class="advertory-no-ad-native-recirc">\n <div class="ad-info" id="${e}-button"></div>\n <a class="ad-link" href="${t}" target="_self">\n <div class="ad-content">\n <div class="ad-image-container">\n <img alt="${i}" class="ad-image" src="${o}" />\n </div>\n <div class="ad-text-container">\n <div class="ad-sponsor">\n <span class="ad-label">${r}</span> ${n}\n </div>\n <div class="ad-title">${i}</div>\n </div>\n </div>\n </a>\n </article>`,NATIVE_SEAMLESS:({containerId:e,url:t,adText:n,img:i,cta:o,description:r,logo:s,sponsoredBy:a,title:d,customTitle2:l})=>`<article class="advertory-no-ad-native-seamless">\n <div class="ad-info" id="${e}-button">\n <a class="ad-link" href="${t}" target="_blank">\n <div class="ad-content">\n <div class="ad-header">\n <div class="ad-brand">\n ${s&&`<img alt="${a}" class="ad-logo" src="${s}" loading="lazy" />`}\n <div class="ad-brand-text">\n <div class="sponsored-by">${a}</div>\n <div class="ad-annons">${n}</div>\n </div>\n </div>\n <h2 class="ad-headline">${d}</h2>\n </div>\n <div class="ad-image-container">\n <img alt="${d}" class="ad-image" src="${i}" loading="lazy">\n </div>\n <div class="ad-footer">\n <div class="ad-row">\n <div class="ad-text-wrapper">\n <div class="ad-domain">${l}</div>\n <div class="ad-description">${r}</div>\n </div>\n <div class="ad-action">${o}</div>\n </div>\n </div>\n </div>\n </a>\n </div>\n </article>`},kr={CONTENT:({containerId:e,url:t,sponsoredBy:n,title:i,logo:o,img:r,description:s})=>`<article class="advertory-bt-ad-native-content">\n <div class="ad-info" id="${e}-button"></div>\n <a class="ad-link" href="${t}" target="_self">\n <div class="ad-content">\n <div class="ad-header">\n <span class="ad-annonse">ANNONSØRINNHOLD</span>\n <img alt="${n}" class="ad-logo" src="${o}" />\n </div>\n <div class="ad-image-container">\n <img alt="${i}" class="ad-image" src="${r}" />\n </div>\n <div class="ad-text-container">\n <span class="ad-subtitle">\n ${s}\n </span>\n <span class="ad-title">${i}</span>\n </div>\n </div>\n </a>\n </article>`},Ar={displayTemplates:{content:kr.CONTENT,recirc:Tr.RECIRC,sponsorstripe:Tr.SPONSORSTRIPE,native:Ir.NATIVE_TEMPLATE,native_recirc:Ir.NATIVE_RECIRC,seamless:Ir.NATIVE_SEAMLESS,default:Tr.CONTENT_BASIC},videoTemplates:{default:Tr.VIDEO,content:Tr.CONTENT_VIDEO}},Cr=((e,t)=>n=>or(Object.assign(Object.assign({},n),{siteSpecificConfig:t}),e))({initNativeAd:(e,t)=>{const{targetId:n}=e;if(!document.querySelector(`#${n}`))return;const{pageType:i=rn.FRONT,nativeTrackingConfig:o,appearanceConfig:r,deviceType:s}=null!=t?t:{},a={language:v.NO,publisher:p.BT,deviceType:s,pageType:i,nativeTrackingConfig:o,appearanceConfig:r};pr(e,a,Ar)},wallpaperHandlers:{initWallpaperAd:(e,t)=>{if(!t)return;const{options:{appMainContainerSelector:n,wallpaperAnchorSelector:i}={}}=t;(e=>{const t=document.querySelector(e||"#application");if(!t)return;Nt();const n=document.createElement("div");n.classList.add(Lt),document.body.insertBefore(n,t.nextSibling),n.style.setProperty("position","fixed"),n.style.setProperty("width","100%"),n.style.setProperty("height","calc(100% - var(--header-height, 0px) - 15px)"),n.style.setProperty("background-position","center top"),n.style.setProperty("background-repeat","no-repeat")})(n),(e=>{const t=e||".advertory-wrapper-common-skyscraperleft_1",n=document.querySelector(t);n&&(jt(n),window.addEventListener("scroll",()=>jt(n)))})(i),e()},adjustAdToHorseshoe:e=>{var t;const n=document.querySelector(`#${e}`);n&&(null===(t=n.parentElement)||void 0===t||t.classList.add(xt),n.classList.add(xt))}},loadFinnBlinkAd:(e,n,i,o)=>t(void 0,void 0,void 0,function*(){const{isMobileApp:t}=c.get();if(g(`loadFinnBlinkAd: loading finn blink ad for ${e}`),!(yield Ro())||t)return i&&i(e),to(e),void(!i&&qt(e));try{yield $o(Lo)}catch(e){console.error(e)}yield Mo(e,n,i),o&&o()}),replaceAdsWithFinnBlink:e=>t(void 0,void 0,void 0,function*(){if(!e)return;const{replacementConfig:t}=e;if(!(En()&&(null==t?void 0:t.adsToReplace)&&(null==t?void 0:t.sizes)&&e.enabled))return void g(`Finn blink configuration is incorrect: ${JSON.stringify(t)}`);if(!(yield Ro()))return;yield $o(Lo);const{adsToReplace:n,sizes:i}=t;n.forEach(([e,t])=>{const n=document.querySelector(`[id^="${e}"]`);if(!n)return;const i=(e=>{const{siteSpecificConfig:{publisherClassName:t}={}}=c.get(),n=document.createElement("div"),i=document.createElement("div");return i.id=e,n.appendChild(i),Xi(t,i,Zi),g(`Creating blink container for: ${e}`),n})(t);(e=>{g(`Hiding old ad container: ${e.id}`),e.style.setProperty("display","none","important")})(n),Fo(n,i),n.dataset.finnBlinkId=t,qn().withFullAdsChain(e)})}),preparePageOptions:ue,prepareTag:e=>{const{keywords:t,targetId:n,invCode:i}=e,{useAppTabletInvCode:o=!0}=c.get(),r=((e,t)=>{const{isMobileApp:n}=c.get();return n?((e,t)=>e.replace(/wtb|wde|wph/g,e=>"wph"===e?"aph":t?"atb":e))(e,t):e})(i,o),s=(e=>{const{country:t}=c.get(),{keywords:n,dynamicSizeWidthCheck:i}=e,o=`${z(t)}-adformat`,r=n?n[o]:[];if(!r)return{};const s=(Array.isArray(r)?r:[r]).filter(e=>!(e in Ee)||window.innerWidth>=Ee[e]);return{[o]:i?s:r}})(e),a=(e=>{const{country:t}=c.get(),n=`${z(t)}-targetid`;return e?{[n]:[e]}:{}})(n),d=Te(),l=(e=>ke(e)?{"aa-sch-dynamic-outstream":["true"]}:{})(i),u=((e,t)=>ke(e)?Object.assign(Object.assign({},t),{playerSkin:{videoBackgroundColor:"#e6e7e8"}}):{})(i);return Object.assign(Object.assign({},e),{invCode:r,keywords:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},t),s),a),l),d),rendererOptions:u})},siteEvents:Re,librariesToLoad:[]},Fe);var Sr=Object.freeze({__proto__:null,default:""});export{Cr as initAdvertoryPackage,nr as updateAdvertory};
1
+ import"react/jsx-runtime";function e(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(n[i[r]]=e[i[r]])}return n}function t(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 n(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var i,r;"function"==typeof SuppressedError&&SuppressedError;var o=n(function(){if(r)return i;r=1;var e=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var n=Object.prototype.toString.call(e);return"[object RegExp]"===n||"[object Date]"===n||function(e){return e.$$typeof===t}(e)}(e)},t="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function n(e,t){return!1!==t.clone&&t.isMergeableObject(e)?l((n=e,Array.isArray(n)?[]:{}),e,t):e;var n}function o(e,t,i){return e.concat(t).map(function(e){return n(e,i)})}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,i){var r={};return i.isMergeableObject(e)&&s(e).forEach(function(t){r[t]=n(e[t],i)}),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)&&i.isMergeableObject(t[o])?r[o]=function(e,t){if(!t.customMerge)return l;var n=t.customMerge(e);return"function"==typeof n?n:l}(o,i)(e[o],t[o],i):r[o]=n(t[o],i))}),r}function l(t,i,r){(r=r||{}).arrayMerge=r.arrayMerge||o,r.isMergeableObject=r.isMergeableObject||e,r.cloneUnlessOtherwiseSpecified=n;var s=Array.isArray(i);return s===Array.isArray(t)?s?r.arrayMerge(t,i,r):d(t,i,r):n(i,r)}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)},{})},i=l}());const s=["deviceType","pageType","placements","takeover","refreshConfig","editableConfiguration"],a={adRequested:()=>{},adAvailable:e=>{},adLoaded:e=>{},adNoBid:e=>{},adError:(e,t)=>{},adCollapse:()=>{},adRequestFailure:e=>{},adBadRequest:e=>{},adLoadedMediated:e=>{},adNoBidMediated:e=>{}},d=6;class l{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 s){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=o(l.DEFAULT_SITE_HANDLERS,e)}}l.DEFAULT_SITE_HANDLERS={siteEvents:a,initNativeAd:function(){}};const c=new l,u=c.modifyConfigProperties.bind(c),v={NO:"no",SE:"se"},p={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"},g=(e,t)=>{const n="[Advertory LOG]: ";location.search.includes("ast_debug=true")&&(t?console.log(n,e,t):console.log(n,e))},m=e=>new URLSearchParams(window.location.search).get(e),h="takeover",y="native_override_desc2",f=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 g("Advertising permission value obtained synchronously: ",e),Boolean(t)})();if(null!==n)return void t(n);let i=!1;const r=e=>{i||(g("Resolving advertising permission value obtained"),i=!0,t(e))},o=setTimeout(()=>{g("Advertising permission timed out, resolving with false"),r(!1)},3e3);window._tcf_.onTcfReady(()=>{g("On Tcf Ready called, waiting for permission"),clearTimeout(o)}),window._tcf_.getPermission("CMP:advertising",e=>{clearTimeout(o);const t=Number(e);g("Advertising permission value obtained asynchronously: ",e),r(Boolean(t))})}),w="cmp:loaded";let b="undefined"!=typeof window?window._tcf_:void 0,E=!1;const T=(e,n,i)=>{const r=!!(null==e?void 0:e.enabled),o=(null==e?void 0:e.timeout)||3e3,s=m("bypass_tcf"),a=()=>{if(!(null==e?void 0:e.enabled))return!0;if(((e,t)=>e?!!t&&(g("TCF bypass param detected, returning consent: true"),!0):(g("TCF is not enabled, returning consent: true"),!0))(r,s))return!0;if(E)return null;if(!b)throw new Error("[Advertory]: getConsentSync method was called before the tcfManager was available.");const t=b.getConsentedToAllSync();return g(`TCF consented to all is: ${t}`),b.getConsentedToAllSync()};return{initConsentManager:()=>(null==e?void 0:e.enabled)?new Promise((e,t)=>{if(g("Getting TCF consent manager..."),window._tcf_)return g("TCF consent manager is already available"),b=window._tcf_,void e(b);g("TCF consent manager is not available");const n=()=>{g("CMP loaded, resolving consent manager..."),i&&clearTimeout(i),window._tcf_?(b=window._tcf_,e(b)):t(new Error("CMP loaded but window._tcf_ is not defined"))},i=setTimeout(()=>{document.removeEventListener(w,n),E=!0,t(new Error("Timeout waiting for CMP to load"))},o);g("Listening for CMP loaded event..."),document.addEventListener(w,n,{once:!0})}):Promise.resolve(null),getConsentSync:a,getConsentAsync:()=>t(void 0,void 0,void 0,function*(){if(null==e?void 0:e.schibstedAdChoicesOverrideValue)return g(`Schibsted Ad Choices override value is set, returning override value: ${e.schibstedAdChoicesOverrideValue}`),Boolean(Number(e.schibstedAdChoicesOverrideValue));const t=(null==e?void 0:e.schibstedAdChoicesEnabled)&&i===v.SE,n=(null==e?void 0:e.schibstedAdChoicesEnabled)&&i===v.NO;if(t||n)return g("Schibsted Ad Choices is enabled, getting advertising permissions..."),yield f(e);if(!(null==e?void 0:e.enabled))return!0;const r=a();return null!==r?r:yield new Promise((e,t)=>{try{if(!b)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(()=>{g("TCF isConsentedToAll timed out, resolving with false"),n(!1)},o);b.onTcfReady(()=>{g("On Tcf Ready called, waiting for consent"),clearTimeout(i)}),b.isConsentedToAll(t=>{clearTimeout(i),e(t)})}catch(e){t(e)}})})}},I=(e,n,i,...r)=>t(void 0,[e,n,i,...r],void 0,function*(e,t,n,i="NOT SPECIFIED FEATURE"){if(!(null==e?void 0:e.schibstedConsentToPayEnabled))return g(`Schibsted Consent to Pay is not enabled, returning true for ${i}`),!0;if(null==e?void 0:e.schibstedAdChoicesOverrideValue)return g(`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}=T(e,0,n);return(yield r())?(g(`Schibsted Ad Choices consent given according to TCF consent manager for ${i}`),!0):(g(`Schibsted Ad Choices consent not given according to TCF consent manager for ${i}`),!1)}),k=e=>{const t=encodeURIComponent(e).replace(/[-.+*]/g,"\\$&"),n=new RegExp(`(?:(?:^|.*;)\\s*${t}\\s*\\=\\s*([^;]*).*$)|^.*$`);return decodeURIComponent(document.cookie.replace(n,"$1"))||null},S=e=>t(void 0,void 0,void 0,function*(){const{tcf:t,isMobileApp:n,country:i}=e,{getConsentAsync:r}=T(t,0,i);if(!(yield r()))return;const o=k("_pulse2data");return o?o.split(",")[9]:void 0}),A=()=>{const e=k("_pulse2data");return e?e.split(",")[2]:void 0},C={MOBILE:"mobile",TABLET:"tablet",DESKTOP:"desktop"},O=9826;class P{constructor(){this.getSupplyTypeKeywords=()=>{const{deviceType:e=C.DESKTOP,isMobileApp:t}=c.get();if(t){return{"aa-sch-supply_type":`app_${e===C.MOBILE?"phone":C.TABLET}`}}return{"aa-sch-supply_type":`web_${this.getPageOptionsFormatDevice(e)}`}}}prepare(e){return t(this,void 0,void 0,function*(){return Object.assign(Object.assign({},e),{keywords:Object.assign(Object.assign(Object.assign(Object.assign({},e.keywords),this.getSupplyTypeKeywords()),yield this.getFormattedExternalIdKeywords()),this.getHasContextKeywords(e.keywords)),user:{externalUid:yield this.getExternalUid(),dnt:yield this.isTrackingForbidden()}})})}getFormattedExternalIdKeywords(){return t(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 A()}getExternalUid(){return t(this,void 0,void 0,function*(){return yield S(c.get())})}isTrackingForbidden(){return t(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=O}=c.get();return"true"===m("inventory_test")?t:e}getCMPValue(e){return localStorage.getItem(`CMP:${e}`)?"0"===localStorage.getItem(`CMP:${e}`)?"0":"1":"0"}getPublisherKeywords(){const{publisher:e}=c.get();return{"aa-sch-publisher":`${e}`}}getAnalyticsConsentKeywords(){return{"aa-sch-cmp_analytics":this.getCMPValue("analytics")}}getAdvertisingConsentKeywords(){return t(this,void 0,void 0,function*(){const{tcf:e,isMobileApp:t,country:n}=c.get(),{getConsentAsync:i}=T(e,0,n);return{"aa-sch-cmp_advertising":(yield i())?"1":"0"}})}getPageTypeKeywords(){const{pageType:e}=c.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}=c.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 P;$.prepare.bind($);function L(e=!1){var t,n;const i=null===(n=null===(t=window.navigator)||void 0===t?void 0:t.userAgent)||void 0===n?void 0:n.toLocaleLowerCase(),r=(()=>{const e=window.navigator.userAgent.toLowerCase(),t=[["win","windows"],["macintosh","macos"],["x11","linux"],["android","android"],["ipad","ios"],["iphone","ios"]].find(([t])=>e.includes(t));return t?t[1]:"unknown"})();return{OS:r,mobileOS:["ios","android"].includes(r)?r:"unknown",isHybridApp:i.includes("hermes"),appMode:e?"hybrid":"notinapp"}}const x=["aLOLE","xBqQj","1KaqJ","1nzXzK","opm8zV","4qKXKR","Ad9QgE"];function N(e){return t=window.location.pathname.split("/").slice(-2,-1).pop()||"",x.includes(t)?{"no-sno-news-section":`${e}_doedsfall`}:{};var t}class j extends P{constructor(){super(...arguments),this.getDeviceKeywords=()=>{const{deviceType:e=C.DESKTOP}=c.get();return{"no-sno-device":this.getPageOptionsFormatDevice(e)}}}getAppTypeKeywords(){const{deviceType:e,isMobileApp:t}=c.get(),{OS:n,isHybridApp:i}=L(t);return{"no-sno-apptype":n&&e&&i?`${n}_${this.getPageOptionsFormatDevice()}_hybrid`:"none"}}getObituariesKeywords(e){return N(e)}getSectionPageTypeKeywords(){var e,t;const{pageOptions:n,pageType:i}=c.get(),r=null!==(t=null===(e=n.keywords["no-sno-news-section"])||void 0===e?void 0:e.toString())&&void 0!==t?t:"ettan";return{"no-sno-section-page_type":`${r.split("_").pop()||r}_${"article"===i?"article":"front"}`}}}const q=864e5,_=(()=>{const e=e=>{const t=window.localStorage.getItem(e);if(!t)return null;try{return JSON.parse(t)}catch(e){return g("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 g("Error with parsing localStorage data"),null}}}})(),D="glimrTags",B=["glwe_","glwet_"],M={geofenceTags:[],geoTags:[],weatherTags:[]},R=(...e)=>t(void 0,[...e],void 0,function*(e=c.get()){const{tcf:t,isMobileApp:n,country:i}=e;if(null==t?void 0:t.schibstedConsentToPayEnabled){return yield I(t,n,i,"glimr")}const{getConsentAsync:r}=T(t,0,i);return yield r()}),F=()=>t(void 0,void 0,void 0,function*(){const{glimr:e}=c.get();if(!(yield R())||!(null==e?void 0:e.enabled))return void g("No consent for glimr data fetching.");const n=yield(i=500,t(void 0,void 0,void 0,function*(){return yield Promise.race([t(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(t=>{n.getTags(e.clientId,(e,n)=>{_.setWithTimestamp(D,{tags:e,tagMappings:n}),t(!0)})})}catch(e){g(`Error during getting glimr data: ${e}`)}else g("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"},U=e=>B.some(t=>e.startsWith(t)),H=e=>e.startsWith("glgc_"),z=e=>!U(e)&&!H(e),W=e=>e===v.NO?"no-sno":"se-generic",K=()=>{const{country:e,publisher:t}=c.get();return`${e}-${t}`},J=(e,t)=>{const n=G();if(!n)return M;const i=((e=[])=>e.filter(U))(n),r=((e=[])=>e.filter(H))(n),o=((e=[],t,n)=>{const i=e.filter(z);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}},G=()=>{const e=_.getByTimestamp(D);return e&&"string"!=typeof e?null==e?void 0:e.tags:null},Q={get:(e,n)=>t(void 0,void 0,void 0,function*(){const t=yield fetch(e,n);if(!t.ok)throw new Error(t.statusText);return yield t.json()}),post:(e,n,i)=>t(void 0,void 0,void 0,function*(){const t=JSON.stringify(i),r=yield fetch(e,{method:"POST",headers:n,body:t});if(!r.ok)throw new Error(r.statusText);return yield r.json()})},Y="advertory:ppids-cache",X={[v.SE]:`SCH${v.SE.toUpperCase()}-EnvHash`,[v.NO]:`SCH${v.NO.toUpperCase()}-EnvHash`},Z={[v.SE]:`SCH${v.SE.toUpperCase()}-UserHash`,[v.NO]:`SCH${v.NO.toUpperCase()}-UserHash`},ee={[v.SE]:`sch${v.SE}-envhash-v3`,[v.NO]:`sch${v.NO}-envhash-v3`},te={[v.SE]:`sch${v.SE}-userhash-v3`,[v.NO]:`sch${v.NO}-userhash-v3`},ne={[v.SE]:`'sch${v.SE}-iosid-v3'`,[v.NO]:`'sch${v.NO}-iosid-v3'`},ie={[v.SE]:`sch${v.SE}-androidid-v3`,[v.NO]:`sch${v.NO}-androidid-v3`},re={[v.SE]:"sdrn:schibsted.com:user",[v.NO]:"sdrn:spid.no:user"};class oe{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 se=new class{constructor(){this.ppid1=null,this.ppid2=null}processPPIDs(e){return t(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||g("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:""}},ae=new class{constructor(){this.ppid1=null,this.ppid2=null,this.idfv=null,this.anId=null}processPPIDs(e,n){return t(this,void 0,void 0,function*(){var t,i,r,o,s,a,d,l,c,u,v;const p=_.get(Y),g=yield this.getNewPPIDs(e,n);if(this.shouldHash(p,g)){const n=null!==(t=e.hasherUrl)&&void 0!==t?t:"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||g("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}}:{});_.set(Y,r)}hashPPIDs(e,n){return t(this,void 0,void 0,function*(){try{const t=new Headers({"Content-Type":"application/json"});return yield Q.post(n,t,e)}catch(e){return g("Error with hashing PPIDs",e),null}})}getNewPPIDs(e,n){return t(this,arguments,void 0,function*({clientId:e,instance:n},i){const r=yield((e,n)=>t(void 0,void 0,void 0,function*(){const t=yield e.getUserId();return t?`${re[n]}:${t}`:null}))(n,i),o=yield(e=>t(void 0,void 0,void 0,function*(){const t=yield e.getEnvironmentId();return t?`sdrn:schibsted:environment:${t}`:null}))(n),s=window.advertory_idfv,a=window.advertory_anId;return Object.assign(Object.assign({clientId:{plain:e},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}}},de=e=>t(void 0,void 0,void 0,function*(){const{tracker:t,tcf:n,country:i,isMobileApp:r}=e;if(!(yield I(n,r,i,"setXandrPPIDs")))return;if(!t)return;(yield Promise.allSettled([se.processPPIDs(t,null==n?void 0:n.timeout),ae.processPPIDs(t,i)])).forEach((e,t)=>{if("rejected"===e.status){g(`Cannot fetch PPIDs v${t+2}`,e.reason)}})}),le=e=>{const{ppid1:t,ppid2:n}=se.getPPIDs(),{ppid1:i,ppid2:r,idfv:o,anId:s}=ae.getPPIDs();return{userIds:[{type:"extendedIDs",eids:(new oe).add(n,X[e]).add(t,Z[e]).add(r,ee[e]).add(i,te[e]).add(o,ne[e]).add(s,ie[e]).buildEids()}]}},ce=e=>{const{ppid1:t,ppid2:n}=se.getPPIDs(),{ppid1:i,ppid2:r,idfv:o,anId:s}=ae.getPPIDs();if(!n)return{};return{userSync:{userIds:[{name:"pubProvidedId",params:{eids:(new oe).add(n,X[e]).add(t,Z[e]).add(r,ee[e]).add(i,te[e]).add(o,ne[e]).add(s,ie[e]).buildRyEids()}}]}}},ue=e=>{const{ppid1:t,ppid2:n}=se.getPPIDs(),{ppid1:i,ppid2:r}=ae.getPPIDs();return(new oe).add(n,X[e]).add(t,Z[e]).add(r,ee[e]).add(i,te[e]).buildRyEids()};const ve=new class extends j{prepare(e){return t(this,void 0,void 0,function*(){const n=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({},this.getCountryCodeKeywords(v.NO)),this.getPublisherKeywords()),this.getPageTypeKeywords()),this.getSupplyTypeKeywords()),this.getDeviceKeywords()),yield this.getFormattedExternalIdKeywords()),this.getAppTypeKeywords()),yield this.getAdvertisingConsentKeywords()),this.getHasContextKeywords(e.keywords)),(()=>{const{ppid1:e,ppid2:t}=se.getPPIDs();return{"aa-sch-schuserhash":e?"1":"0","aa-sch-schenvhash":t?"1":"0"}})()),yield(i=c.get(),r={addPublisherToGeo:!0},t(void 0,void 0,void 0,function*(){const{addPublisherToGeo:e}=r||{},{glimr:t,country:n}=i,o=yield R(i);if(!(null==t?void 0:t.enabled)||!o)return g("No consent for getting glimr tags."),{};const s=W(n),a=J(i,Boolean(e));return{[`${s}-geo`]:a.geoTags,[`${s}-weather`]:a.weatherTags,[`${s}-geofence`]:a.geofenceTags}}))),e.keywords),this.getObituariesKeywords(p.BT));var i,r;return Object.assign(Object.assign({},e),{keywords:n,user:Object.assign(Object.assign({},le(v.NO)),{externalUid:yield this.getExternalUid()}),member:this.getMember()})})}};var pe=ve.prepare.bind(ve);const ge="ABSOLUTE_FULLSCREEN",me="ANY_FULLSCREEN",he="VERTICAL_FULLWIDTH",ye="FULLWIDTH",fe="TAKEOVER",we="VELVET_TAKEOVER",be="WALLPAPER",Ee="COLLAPSE",Te={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}]},Ie={wallpaper:1600,"l-format":1600},ke=()=>{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},Se=e=>{const{source:t}=e;return"csm"===t},Ae=e=>{const{siteSpecificConfig:t}=c.get(),n=(null==t?void 0:t.dynamicOutstreamFormats)||[];return 0!==n.length&&n.some(t=>e.includes(t))},Ce=e=>{const{banner:t,targetId:n}=e;return!(!t||(null==n?void 0:n.includes("takeover")))&&Fe(e,me)},Oe=e=>{const{native:t}=e;return!!t},Pe=e=>Fe(e,ye),$e=e=>{const{targetId:t}=e;return t.includes("takeover")||Fe(e,fe)},Le=e=>Fe(e,fe),xe=e=>Fe(e,be),Ne=e=>Fe(e,Ee),je=e=>e.targetId.includes("sponsorstripe"),qe=e=>{const t=document.querySelector(`#${e}`);return!!t&&"true"===t.dataset.isFinnBlinkPlacement},_e=e=>e.targetId.startsWith("panorama")||e.targetId.startsWith("modul"),De=e=>e.targetId.startsWith("midboard"),Be=e=>e.targetId.includes("widescreen"),Me=e=>e.width>=1260&&e.width<=1280,Re=e=>e.width>=1600&&e.width<=1620,Fe=(e,t)=>{const n=Te[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={adRequested:()=>{},adAvailable:e=>{},adLoaded:e=>{$e(e)&&(()=>{const e=document.querySelector("#takeover"),t=document.querySelector("div[id*='mobile-topboard'], div[id*='topboard']"),n=null==t?void 0:t.parentElement;t&&n&&e&&(e.appendChild(t),n.style.display="none")})()},adNoBid:e=>{},adError:(e,t)=>{},adCollapse:()=>{},adRequestFailure:e=>{},adBadRequest:e=>{},adLoadedMediated:e=>{},adNoBidMediated:e=>{}},Ue={publisherClassName:p.BT,fullWidthFormatClassName:"netboard",mainColumnWidth:660};class He{initialize(){this.DATA=Object.assign({},He.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)}}He.INITIAL_DATA={wallpaper:{isAvailable:!1},horseshoe:{isAvailable:!1},initialClassNames:{},alertoryConfigKeywords:{}};const ze=new He,We=()=>(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),Ke=()=>(window.relevantDigital||(window.relevantDigital={cmd:[]}),window.relevantDigital),Je=(e={},t)=>{const{prebid:{externalUidInAuctionEnabled:n,forwardGlimrTags:i=!1}={},country:r}=c.get(),o=[`${W(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)}},Ge=(e,...n)=>t(void 0,[e,...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)}))}),Qe="advertory-fullscreen-scroll",Ye="advertory-fullscreen-scroll-wrapper",Xe="fullscreen-scroll-in-screen",Ze="in-screen",et=e=>e.includes("snoap.no"),tt=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)},nt=(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()},it=nt([],()=>{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}),rt=e=>{const t=nt([],()=>{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},ot=[],st={},at=(e,t)=>{e.forEach(({target:e,isIntersecting:n})=>{const i=lt(e);n?(dt(i,n),ct(e,i,t)):(dt(i,n),ut(e,i,t))})},dt=(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}`,"*")},lt=e=>{var t;return null===(t=e.children[0])||void 0===t?void 0:t.id},ct=(e,t,n)=>{e.classList.add(Ze),document.body.classList.add(Xe),window.dispatchEvent(new CustomEvent("advertory:fullscreenScrollInView")),ot.includes(t)||ot.push(t),n&&window.addEventListener("scroll",st[t],{passive:!0})},ut=(e,t,n)=>{ot.includes(t)&&(n&&window.removeEventListener("scroll",st[t]),document.body.classList.remove(Xe),e.classList.remove(Ze),window.dispatchEvent(new CustomEvent("advertory:fullscreenScrollNotInView")))},vt=(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&&pt(e,o,r,0),s.length&&pt(e,s,r,40)}},pt=(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()})},gt={no:{adText:"ANNONSE",adFrom:"ANNONSE FRA",adContent:"ANNONSØRINNHOLD",adContentFrom:"ANNONSØRINNHOLD FRA"},se:{adText:"ANNONS",adFrom:"ANNONS FRÅN",adContent:"EXTERN LÄNK",adContentFrom:"EXTERN LÄNK FRÅN"}};let mt=null;const ht=(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=`(${it})()`,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(et(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=rt(n)),(e=>e.includes("de17a"))(n)&&(n=(e=>et(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)),et(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)),tt(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},yt=()=>{mt=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`)},ft=()=>{mt||(mt=window.requestAnimationFrame(yt))},wt=(e,t)=>{var n,i,r,o;const{country:s}=c.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),l=null==d?void 0:d.parentElement;if(!d||!l)return;((e,t)=>{const n=(null==t?void 0:t.fadingHeaderEnabled)||!1,i=new IntersectionObserver(e=>at(e,n),{}),r=lt(e);i.observe(e),n&&(st[r]=vt(e,t))})(l,t),d.className=Qe;const u=Fe(e,ge)?"absolute":"fixed";d.style.position=u,l.className=Ye,l.dataset.showTagSubscribeId=a,d.setAttribute("data-ad-label",gt[s].adText),(null==t?void 0:t.moveCogwheelToTheLeft)&&(d.dataset.moveCogwheelToTheLeft="true"),ft(),window.addEventListener("resize",ft),null===(r=window.visualViewport)||void 0===r||r.addEventListener("resize",ft),null===(o=window.visualViewport)||void 0===o||o.addEventListener("scroll",ft)},bt=({targetId:e})=>{const t=(e=>{var t;const{requests:n}=window.apntag,i=tt(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=tt(e)?1:0,r=null==n?void 0:n.tags[e].adResponse.ads[i].rtb;r&&(r.banner.content=t)})(e,ht(t,e))},Et=e=>{var t;!document.querySelector(`#gdprAdTransparencyCogWheelButton-${e}`)&&(null===(t=window.gdpr)||void 0===t?void 0:t.setupButton)&&window.gdpr.setupButton(e)},Tt=(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}]}})),Et(e);const d=a.firstElementChild;d&&t.insertBefore(d,a),a.remove()},It="ad-loaded",kt=()=>null!==m("disable_prebid"),St=()=>t(void 0,void 0,void 0,function*(){const{prebid:e,tcf:t,country:n,isMobileApp:i,fullscreenScroll:r}=c.get();if(!(null==e?void 0:e.enabled))return;const{initNativeAd:o}=c.getHandlers(),{getConsentAsync:s}=T(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=We(),{prebid:{relevantCbTimeout:o}={}}=c.get(),s="relevantCb"===i&&o?o:n[i].timeout,a=setTimeout(()=>{!n[i].done&&!e&&(console.warn(`Doing failsafe loadTags() call after waiting too long for '${i}'`),e=!0,r.loadTags&&r.loadTags())},s);t.push(a)},cleanup:()=>{t.forEach(e=>clearTimeout(e)),t=[],e=!1,n.relevantCb.done=!1,n.auctionCb.done=!1}}})(),l=We(),u=(()=>{const{requests:{user:e={userIds:[]},keywords:t={}}={}}=We();return{user:e,keywords:t}})();d.failsafeOnTimeout("relevantCb");const{user:{externalUid:v=""}={},keywords:p}=u;(()=>{const e=Ke();return e.cmd||(e.cmd=[]),e.cmd})().push(()=>{if(d.getCancel()||!l.loadTags)return g("core loadTags() call was cancelled",{cancel:d.getCancel(),apnTagLoadTags:!l.loadTags,condition:"or"}),void d.cleanup();const t=Ke();d.events.relevantCb.done=!0,d.failsafeOnTimeout("auctionCb");const i=a?{gdpr:{cmpApi:"iab",timeout:8e3}}:{cmpApi:"none"};g("prebid consentManagement",i),t.addPrebidConfig(Object.assign(Object.assign({consentManagement:i,enableSendAllBids:!1},ce(n)),Je(p,v))),g("core add prebid config",Object.assign(Object.assign({consentManagement:i,enableSendAllBids:!1},ce(n)),Je(p,v))),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,l.loadTags(e)),d.cleanup()}},customNativeRender:e=>{At(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)?(wt(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(Qe)))return;e.classList.remove(Qe),e.removeAttribute("style"),e.removeAttribute("data-ad-label");const t=e.parentElement;(null==t?void 0:t.classList.contains(Ye))&&(t.classList.remove(Ye),t.classList.remove(Ze))})(c),null===(t=null==c?void 0:c.parentElement)||void 0===t||t.classList.add("advertory-direct-render")),c.classList.add(It),(null==o?void 0:o.creativeId)&&Tt(l,c,Number(null==o?void 0:o.creativeId)))}}),g("core load prebid",{configId:e.id,manageAdserver:!1,collapseEmptyDivs:!1,collapseBeforeAdFetch:!1,noGpt:!0,noSlotReload:!0,loadUnknownSlots:!0,apntagCalls:{showTag:()=>{},loadTags:e=>{d.getCancel()||(d.events.auctionCb.done=!0,l.loadTags(e))}},customNativeRender:e=>{At(e,o)},directRenderFn:()=>{}})})}),At=(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},c.get()),null==d||d.postMessage(JSON.stringify({message:"Prebid Response",ad:"\x3c!-- nothing --\x3e",adId:o.adId}),"*")},Ct="0123456789abcdefghijklmnopqrstuvwxyz",Ot=(e=6)=>{if(e<=0)return"";let t="";for(let n=0;n<e;n++){t+=Ct[Math.floor(36*Math.random())]}return t},Pt=e=>{window.apntag.anq.push(e)},$t=new Promise(e=>{"undefined"!=typeof document&&document.prerendering?document.addEventListener("prerenderingchange",()=>e()):e()}),Lt=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 xt="";const Nt=new Map,jt=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},qt="advertory-wallpaper-background",_t="advertory-with-horseshoe",Dt=()=>{const e=document.querySelector(`.${qt}`);e&&e.remove()},Bt=e=>{const t=e.getBoundingClientRect().top;requestAnimationFrame(()=>(e=>{if(!document.body)return;const t=document.querySelector(`.${qt}`);t&&t.style.setProperty("top",`${e}px`)})(t+15))},Mt=/^wallpaper:url:(http[s]?:\/\/)?[^\s(["<,>]*\.[^\s[",><]*/,Rt=e=>{if("0"===m("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")&&Dt())},Ft=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"))},Vt=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`)},Ut=e=>{const t=e.parentElement;if(!e||!t)return;const{container:n,wrapper:i}=(e=>{const t=ze.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},Ht=()=>{Dt();document.querySelectorAll('[data-advertory-ad-rendered="true"]').forEach(e=>{Rt(e.id),Ut(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=jt(e.id)}),Pt(()=>window.apntag.clearRequest())},zt="noGroupedPlacements",Wt=e=>{const t=e.replace(/[0-9]/g,"");return"_"===t.slice(-1)?t.substring(0,t.length-1):t},Kt=e=>{if(!(null==e?void 0:e.minViewWidth))return!0;return window.innerWidth>=e.minViewWidth},Jt=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}=c.get(),o=n[r].filter(Kt)||[],s=e?document.querySelector(e):document;if(!s)return[];const a=o.reduce((e,t)=>{const n=Wt(t.id);return!n||e.includes(n)||e.push(n),e},[]).flatMap(e=>{const t=new RegExp(`^${e}(_(\\d+))?$`),n=o.filter(({id:e})=>e.match(t)),a=(null==i?void 0:i.queryByDataDevice)?`div[id^="${e}"][data-device=${r}], div[id^="${e}"][data-device=all]`:`div[id^="${e}"]:not([data-disabled="true"])`,d=s.querySelectorAll(a),l=Array.from(d).filter(({id:e})=>e.match(t)).map((e,t)=>{var i;const r=Gt(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}-${Ot(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&&ze.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}=c.get();return(null==t?void 0:t.includeCountingKeywordInTags)?(xt!==window.location.pathname&&(Nt.clear(),xt=window.location.pathname),e.map(e=>{var t;const n=e.invCode.replace(/_\d+$/,""),i=null!==(t=Nt.get(n))&&void 0!==t?t:0;return e.keywords=Object.assign({},e.keywords),e.keywords[`${K()}-count`]=i,Nt.set(n,i+1),e})):e})(l)});return(e=>{const t=Array.from(document.querySelectorAll('div[class^="advertory"]'));return e.sort((e,n)=>t.findIndex(t=>t.id===e.id)-t.findIndex(e=>e.id===n.id))})(a)},Gt=(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},Qt=e=>{const{queryConfig:{placementBatches:t}={},deviceType:n}=c.get(),i=(null==t?void 0:t[n])||{},r=Object.values(i).flat(),o=(e=>{const t={};return e.forEach(e=>{const n=jt(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(jt(e.id)));return n})(e,i),a=Object.keys(o),d=((e,t)=>e.filter(e=>!t.has(jt(e.id))))(e,new Set([...a,...r]));return Object.assign(Object.assign(Object.assign({},s),o),{[zt]:d})},Yt=(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])}},Xt=["netboard","board"];class Zt{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(e){return t(this,void 0,void 0,function*(){var t,n,i;const r=yield this.identityFacade.getIdentityUser(),o=null!==(i=yield null===(n=null===(t=this.tracker)||void 0===t?void 0:t.getEnvironmentId)||void 0===n?void 0:n.call(t))&&void 0!==i?i:"",s=(null==r?void 0:r.userId)?String(r.userId):"",a=this.buildUrl(e,{envId:o,spid:s});try{g("Starting fetching DrEdition ad from URL:",a);const e={method:"GET"},t=yield Q.get(a,e);return g("Fetch operation completed successfully."),t}catch(e){g("Error during fetch operation:",e)}return null})}}let en=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(e,n){return t(this,void 0,void 0,function*(){const{id:t,autoplay:i,mute:r,videoLoop:o,vendor:s}=n.videoConfiguration;e.classList.add("vgtv-video-container"),Object.assign(e.dataset,{vgtvVideoId:t,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 tn=e=>{const t=e.parentElement;t?t.classList.remove("dr-edition-lock-height"):g("Dr. Edition container does not have a parent element, cannot remove height lock.")};class nn{constructor(e,t,n,i){this.drEditionService=e,this.rendererManager=t,this.videoManager=n,this.pulseManager=i,this.drEditionAds=[]}fetchAndRenderAd(e,n){return t(this,void 0,void 0,function*(){var t,i;const{drEditionConfig:{containerSelector:r},renderAsBackfill:o=!1}=n,s=e.querySelector(r);if(!s)return void g(`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?(g("No Dr. Edition ads available to render. Collapsing whole placement."),Rt(e.id),void tn(s)):((null==a?void 0:a.itemId)&&o&&(g("Dr. Edition ad available to render as a Xandr backfill."),Ft(e.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===(t=this.videoManager)||void 0===t?void 0:t.handle(a,n),tn(s),this.drEditionAds.push(a),window.advertory=window.advertory||{},window.advertory.renderedDrEditionAds=window.advertory.renderedDrEditionAds||[],window.advertory.renderedDrEditionAds.push(a.itemId),this.observeAdView(e,a,n),null===(i=e.querySelector("a"))||void 0===i||i.addEventListener("pointerup",()=>null)):tn(s))):(g("No Dr. Edition ads available to render. Hiding Dr. Edition and rendering Xandr backfill."),this.hideDrEdition(s),this.showBackfill(e),void tn(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:"";Ft(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 rn{constructor(e,t){this.newsroomStrategy=e,this.pulseManager=t}render(e,n,i){return t(this,void 0,void 0,function*(){if(!(null==n?void 0:n.itemId))return;const{getConsentAsync:t}=T(i.tcf,i.isMobileApp,i.country),r=yield t(),o=i.device===C.MOBILE?n.mobileHTML:n.desktopHTML;const s=r?o:o.replace(/<img [^>]*class="tracking-pixel"[^>]*>/g,"");e.innerHTML=s,e.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 on{constructor(e){this.strategy=e}handle(e,n){return t(this,void 0,void 0,function*(){const{videoConfiguration:{id:t,preview:i}={}}=e;(t||i)&&(yield this.importScript(n),yield this.createVideoElement(e,n))})}importScript(e){return t(this,void 0,void 0,function*(){const t=e.drEditionConfig.videoScriptUrl,n=document.querySelector(`script[src="${t}"]`);if(t&&!window.autoplayQueue&&!n)try{yield Ge(t)}catch(e){g("Error! Failed to prepare SVP player script for Dr. Edition!",e)}})}createVideoElement(e,n){return t(this,void 0,void 0,function*(){const t=document.createElement("div"),{node:i}=e.videoConfiguration,r=[...document.querySelectorAll(`#${i}`)||[]].find(e=>0===e.children.length);if(this.handlePreviewVideo(e,n))return;this.strategy.handleVideo(t,e),null==r||r.appendChild(t),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 sn=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(e,n,i){return t(this,void 0,void 0,function*(){var t,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(e,n,i,"view");(null===(t=this.pulse)||void 0===t?void 0:t.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(e,n,i){return t(this,void 0,void 0,function*(){var t,r,o,s,a,d;if(!this.pulse)return;const l=this.getEventInput(e,n,i,"click");this.pulse.trackLegacyClickUIElement?null===(r=(t=this.pulse).trackLegacyClickUIElement)||void 0===r||r.call(t,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 an extends sn{constructor(e,t,n){super(e,t),this.pulse=e,this.newsroomStrategy=t,this.pageType=n}getEventBaseData(e,t,n){const{pulseData:{title:i,clientName:r="",creativeId:o}={}}=t,{columnName:s,primaryPosition:a}=n;return{"@type":"UIElement",elementType:"Teaser",layout:{elementSize:"large",imageUrl:"",name:"large"},name:i,placement:{columnName:s,primaryPosition:a},"spt:custom":{is_sponsored:!0,sponsor:r,"spt:creativeId":o},url:location.origin}}getEventInput(e,t,n){return{object:this.getEventBaseData(e,t,n),target:this.getEventTarget(e,t)}}}let dn=class extends sn{constructor(e,t,n){super(e,t),this.pulse=e,this.newsroomStrategy=t,this.pageType=n}getEventBaseData(e,t,n){var i,r,o,s,a,d;const{itemId:l,pulseData:{clientName:c,creativeId:u}={}}=t,v=n.editionName,p=this.mapPageType(this.pageType),g=null===(i=this.newsroomStrategy)||void 0===i?void 0:i.getPulsePageId(this.pageType||"front",this.getArticleId());return{"@id":null!==(s=null===(o=null===(r=this.newsroomStrategy)||void 0===r?void 0:r.getPulseObjectId)||void 0===o?void 0:o.call(r))&&void 0!==s?s:v,"@type":"UIElement",position:v,elementType:"Article",custom:{customer:c,creativeId:null!=u?u:l},page:{"@id":null!=g?g:v,"@type":p,url:location.origin},tags:null===(d=null===(a=this.newsroomStrategy)||void 0===a?void 0:a.getTags)||void 0===d?void 0:d.call(a,e)}}getEventInput(e,t,n,i){return{object:this.getEventBaseData(e,t,n),partnerstudio:this.getEventPartnerstudioData(e,t,n,i),target:this.getEventTarget(e,t),provider:this.getProviderData()}}getEventPartnerstudioData(e,t,n,i){var r,o,s,a;const{pulseData:{algorithm:d="sov",clientName:l,creativeId:c,editionId:u,itemId:v,url:p,probability:g}={}}=t,m=Math.floor(Date.now()/1e3),h=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:m,title:h,type:i,imageUrl:f,frontId:86,tracking_type:"ad",xandrAdLoaded:!1}}getProviderData(){return{productTag:"partnerstudio"}}};const ln={FRONT:"front"},cn=(e,t)=>{null==t||t.forEach(t=>{const n=window.SVP.Player.Plugins.get(t);e.addPlugin(new n)})},un=e=>t(void 0,void 0,void 0,function*(){var t,n;return(null===(t=null===window||void 0===window?void 0:window.SVP)||void 0===t?void 0:t.Player)?new window.SVP.Player(e):((()=>{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(e):yield new Promise(t=>{window.addEventListener("onSvpPlayerReady",()=>t(new window.SVP.Player(e)))}))}),vn={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 t(this,void 0,void 0,function*(){yield Promise.resolve().then(function(){return Vo})})}})}},pn=(e,t)=>{null==e||e.forEach(e=>{vn[e](t)})};class gn{handleVideo(e,n){return t(this,arguments,void 0,function*(e,{videoConfiguration:{id:n,node:i,autoplay:r,mute:o,vendor:s}}){yield t(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(e);pn(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 un(l);c.once("assetReady",()=>{cn(c,a)}),c.once("ready",()=>{const t=e;new MutationObserver(e=>{e.forEach(({type:e,attributeName:n})=>{"attributes"===e&&"class"===n&&(t.classList.contains("jw-state-playing")?d.classList.add("is-playing"):d.classList.remove("is-playing"),t.classList.contains("jw-flag-user-inactive")?d.classList.add("is-inactive"):d.classList.remove("is-inactive"))})}).observe(t,{attributes:!0,attributeFilter:["class"]})}),c.once("PulseStats:ready",()=>t(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===ln.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 mn="https://www.aftonbladet.se/video-player-extras/latest/";class hn{handleVideo(e,n){return t(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:{[`${mn}cta-button.js`]:{name:"CtaButton",options:{type:"unmute"}},[`${mn}external-link.js`]:{name:"ExternalLink"}}};yield un(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""}}const yn=e=>null!==e&&"object"==typeof e&&!Array.isArray(e);class fn{handleVideo(e,n){return t(this,arguments,void 0,function*(e,{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({},yn(e)?e:{}),{provider:Object.assign(Object.assign({},yn(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 un(a);d.once("PulseStats:ready",()=>t(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===ln.FRONT?"sdrn:svdse:frontpage:front":`sdrn:svdse:article:${t}`}}let wn=class{handleVideo(e,t){}getPulseObjectId(){return""}getPulsePageId(e,t){return""}};const bn=(e,t,n)=>{var i;const{publisher:r,pageType:o,country:s}=e,a={[p.VG]:new en,[p.E24]:new gn,[p.AFTONBLADET]:new hn,[p.SVD]:new fn}[r]||new wn,d=new(s===v.SE?an:dn)(n,a,o),l=new Zt(t,null!==(i=null==n?void 0:n.pulseTracker)&&void 0!==i?i:n),c=new rn(a,d),u=new on(a);return new nn(l,c,u,d)},En=()=>t(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 Tn{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 t(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 g("[Privacy Broker] User is not logged in."),null}})}isUserLoggedIn(){return t(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 In=(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=bn(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))},kn=()=>t(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)}}),Sn=()=>{const e=document.getElementById("ads-advertory-anchor");return!(e&&"none"!==getComputedStyle(e).display&&window.advertoryFluepapir)},An=[],Cn=(e,n)=>t(void 0,void 0,void 0,function*(){var t;const{pulse:i,tcf:r,deviceType:o,drEdition:s,publisher:a,pageType:d,country:l,isMobileApp:c}=e;if(!(yield I(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=jt(t.targetId),d=s.find(e=>e.id===a),l=Xt.some(e=>a.startsWith(e)),c=An.includes(a),u=(null===(n=null==d?void 0:d.drEdition)||void 0===n?void 0:n.editionName)||o;return d&&l&&!c&&u?(An.push(a),Object.assign(Object.assign({},d),{drEdition:Object.assign(Object.assign({},d.drEdition),{editionName:u})})):null})(e,n);if(!u)return;if(!(null==i?void 0:i.instance))return void g("Pulse has not been passed as a prop, aborting");const v=yield En(),p=new Tn(v),m=bn({publisher:a,pageType:d,country:l},p,null==i?void 0:i.instance),h=document.getElementById(n.targetId);if(!h||!s)return;h.classList.value="";const y=document.createElement("div");y.className=s.containerSelector.replace(/^[.#:[\]]+/,""),h.innerHTML=y.outerHTML;const f={editionName:(null===(t=null==u?void 0:u.drEdition)||void 0===t?void 0:t.editionName)||"",drEditionConfig:s,device:o,tcf:r,isMobileApp:c,country:l,renderAsBackfill:!0};yield m.fetchAndRenderAd(h,f)}),On="collapseAd",Pn="hideAd",$n="resizeAd",Ln="renderDrEditionFallback",xn="wallpaperImageUrl",Nn="wallpaperColor",jn="velvet",qn=[$n,xn,Nn,On,Pn,Ln,jn];let _n;const Dn=e=>{if("object"==typeof e)return e;if(t=e,Mt.test(t)){const t=e.replace(/^wallpaper:url:/,"");return{name:xn,wallpaperImageUrl:t}}var t;if((e=>e.startsWith("wallpaper:color:"))(e)){const t=e.replace(/^wallpaper:color:/,"");return{name:Nn,wallpaperColor:t}}if(e.startsWith(Ln)){const t=e.split(":")[1];return{name:Ln,targetId:t}}if(e.startsWith(On)||e.startsWith(Pn)){const t=e.split(":")[1];return{name:On,targetId:t}}if(e.includes("name")&&qn.some(t=>e.includes(t)))try{return JSON.parse(e)}catch(e){}},Bn=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=Dn(t);if(!n)return;if(!n.name||!qn.some(e=>n.name===e))return;const{name:i,targetId:r,wallpaperImageUrl:o,wallpaperColor:s,cmd:a,size:d}=n;i===jn&&a&&(a.includes("noScroll")&&(_n=(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==_n||_n(),dispatchEvent(new CustomEvent("advertory:closeTakeover",{})))),i!==On&&i!==Pn||!r||Rt(r),i===$n&&r&&a&&Yt(r,a),i===Ln&&r&&(Rt(r),Cn(c.get(),{targetId:r})),"resizeMediationAd"===i&&r&&d&&Yt(r,d,!0),i===xn&&o&&(e=>{const t=document.querySelector(`.${qt}`);t&&(t.style.backgroundImage=`url(${e})`)})(o),i===Nn&&s&&(e=>{const t=document.querySelector(`.${qt}`);t&&(t.style.backgroundColor=e)})(s)},Mn=e=>({rootMargin:`${e}px 0px ${e}px 0px`}),Rn=()=>{const{publisher:e,country:n,finnBlink:i}=c.get(),{loadFinnBlinkAd:r,wallpaperHandlers:{adjustAdToHorseshoe:o}}=c.getHandlers(),s=window.apntag,a={publisher:e,country:n,finnBlink:i},d=e=>{Ft(e),Pt(()=>s.showTag(e))};return{withXandrAd:d,withFinnBlinkAd:e=>t(void 0,void 0,void 0,function*(){yield r(e,a,null)}),withFullAdsChain:e=>t(void 0,void 0,void 0,function*(){yield r(e,a,d,()=>{ze.getData("horseshoe").isAvailable&&o(e)})})}},Fn=(e,t,n)=>{const i="true"===n.dataset.isFinnBlinkOnlyPlacement;return qe(t)&&i?(g(`loading finn blink ad for blink only placement for ${t}`),void Rn().withFinnBlinkAd(t)):qe(t)?(g(`loading finn blink ad with full ads chain for ${t}`),void Rn().withFullAdsChain(t)):void Pt(()=>(g("core showTag",{id:t}),e.showTag(t)))},Vn=(e,n)=>t(void 0,void 0,void 0,function*(){yield $t,yield Lt;const t=new IntersectionObserver((t,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);g("core log from intersection observer handler",{targetId:o,element:s}),n(window.apntag,o,i),s&&(t.unobserve(s),t.disconnect())})})(t,n,Fn,e),Mn(n));t.observe(e)}),Un=new Map,Hn=["no-stavangeraftenblad","sa","no-aftenposten","aftenposten","no-bergenstidende","bt"],zn=".brandstudio-premium-content-widget",Wn=({adWrapper:e,placementContainer:t})=>t.offsetHeight+(({adWrapper:e})=>{const{paddingTop:t,paddingBottom:n}=getComputedStyle(e);return parseFloat(t)+parseFloat(n)})({adWrapper:e}),Kn=({adWrapper:e,placementContainer:t})=>{const n=Wn({adWrapper:e,placementContainer:t});var i;null==e||e.style.setProperty("height",`${n}px`),Ut(i=t),i.innerHTML=""},Jn=e=>{e&&e.style.getPropertyValue("height")&&e.style.removeProperty("height")},Gn=({adWrapper:e,placementContainer:t})=>{const{publisher:n}=c.get(),i=Hn.includes(n)&&Boolean(t.closest(zn));const r=i?t.closest(zn):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 Jn(e),void o.disconnect();const a=t.closest('[style*="height"]'),d=r;a&&d.contains(a)?Jn(a):d.hasAttribute("style")&&Jn(d),o.disconnect()})})});try{o.observe(t,{childList:!0,subtree:!0})}catch(e){o.disconnect()}},Qn=(e,t,n,i,r,o)=>{var s;const a=performance.now(),d=null!==(s=Un.get(t))&&void 0!==s?s:0,l=((e,t)=>!!t&&e+t<(new Date).getTime())(i,r)&&n<0;a-d>=r&&l&&(Un.set(t,a),((e,t,n)=>{const{country:i}=c.get(),r=null==n?void 0:n.parentElement;r&&n&&Kn({adWrapper:r,placementContainer:n}),Pt(()=>{e.setKeywords([t],{[`${W(i)}-adreload`]:"1"},{overrideKeyValue:!0}),e.refresh([t])})})(e,t,o))},Yn=(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,Qn,t,n),Mn(300));i.observe(e)},Xn=(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},Zn=()=>navigator&&navigator.userAgent.match(/chrome/i)?null:navigator&&navigator.userAgent.match(/apple/i),ei=(e,t=0)=>{const n=e.getBoundingClientRect(),i=window.innerHeight;return n.bottom>-t&&n.top<i+t},ti=e=>{const{refreshConfig:{visibilityStateRefreshEnabled:t=!1}={}}=c.get();if(!t)return;const n=()=>{"visible"===document.visibilityState&&document.removeEventListener("visibilitychange",n),si(e)};"visible"!==document.visibilityState&&document.addEventListener("visibilitychange",n)},ni=(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;ei(r,o)&&i&&(Vt(i.id),n.length&&r.classList.remove(...n),si([i],t))}},ii=e=>{const{refreshConfig:{backForwardNavigationRefreshEnabled:t=!1}={},siteSpecificConfig:{classesToRemoveOnRefresh:n=[]}={},isMobileApp:i}=c.get();t&&(e.forEach(({id:e})=>{const t=ri(e);t&&(t.dataset.bfCacheRefresh="true")}),i?((e,t)=>{document.addEventListener("visibilitychange",()=>{"visible"===document.visibilityState&&ni(e,!0,t)})})(e,n):((e,t)=>{window.addEventListener("pageshow",n=>{const i=()=>{window.scrollY>0&&(window.removeEventListener("scroll",i),ni(e,!1,t))};n.persisted&&(Zn()?window.addEventListener("scroll",i,{passive:!0}):ni(e,!1,t))})})(e,n))},ri=e=>{var t,n;return null!==(n=null===(t=document.querySelector(`#${e}`))||void 0===t?void 0:t.parentElement)&&void 0!==n?n:null},oi=e=>{const{id:t,allowedFormats:n}=e,i=(e=>{if(!e)return[];try{return JSON.parse(e.dataset.adSizes||"[]")}catch(e){return[]}})(ri(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},si=(e,t=!1)=>{const{requestSize:n=d}=c.get(),i=e.map(({id:e})=>e),r=Xn(i,n);if(t)for(const t of e){const e=oi(t);window.apntag.modifyTag(t.id,e)}for(const e of r)Pt(()=>window.apntag.refresh(e))};const ai="#fff",di="#0098da",li="splash",ci="welcomePage",ui="topscroller",vi="velvet",pi="takeover-displayed",gi="takeover-visit-count",mi=14400,hi=()=>{const e=k(gi);return e?parseInt(e):0},yi=()=>{const{takeover:{enabled:e=!1,secondVisitEnabled:t=!1}={}}=c.get();return"0"!==m(h)&&("1"===m(h)||!(!e||(()=>{var e;const t=(null===(e=c.get().takeover)||void 0===e?void 0:e.cookieCapName)||pi;return"true"===k(t)})())&&(!t||fi()))},fi=()=>{const e=hi();return 0===e?((()=>{const e=hi(),{takeover:{cookieCapTime:t=mi}={}}=c.get(),n=document.location.hostname;window.document.cookie=`${gi}=${e+1}; max-age=${t}; domain=${n}; path=/; SameSite=Lax`})(),!1):1===e},wi=(e,t)=>[[1,1],[1920,1080]].some(([n,i])=>n===e&&i===t),bi=()=>{const{takeover:e}=c.get();return Boolean(null==e?void 0:e.topscroller)},Ei=()=>t(void 0,void 0,void 0,function*(){const e=document.location.hostname,{takeover:{cookieCapName:t=pi,cookieCapTime:n=mi}={},isMobileApp:i,tcf:r,country:o}=c.get(),s=yield I(r,i,o,"ad-takeover-cookiecap");n&&s&&(window.document.cookie=`${t}=true; max-age=${n}; domain=${e}; path=/`)}),Ti=e=>{var t;const n=!!(null===(t=c.get().takeover)||void 0===t?void 0:t.setCookieCapForNotShownAd);return $e(e)&&n},Ii=(e,t)=>{var n;if(t===ui){const{topscroller:t}=e;return null!=t?t:{}}if(t===li){const{splash:t}=e;return null!=t?t:{}}return null!==(n=e.welcomePage)&&void 0!==n?n:{}},ki=(e,t)=>{t!==li?(e=>{var t,n,i;const r=null===(n=null===(t=c.get().takeover)||void 0===t?void 0:t.welcomePage)||void 0===n?void 0:n.headerElementSelector,o=null===(i=c.get().takeover)||void 0===i?void 0:i.topscroller;if(!r||o)return;const s=document.querySelector(r),a=document.querySelector(".welcome-page-wrapper"),d=document.querySelector(`#${e.targetId}`),l=document.querySelector(".advertory-welcome-page-scroll");if(!(s&&a&&l&&d))return;const 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"),l.style.setProperty("bottom",p,"important")})(e):(e=>{var t;if(!(null===(t=c.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)},Si=nt([],()=>{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})}),Ai=(e,t=!0)=>{(e===ci||e===ui)&&(e=>{e?setTimeout(()=>window.scrollTo(0,0),100):window.scrollTo(0,10)})(t)},Ci=()=>{const e=parseInt(document.body.dataset.scrollY||"0",10);document.body.style.top="",window.scrollTo(0,e),document.body.classList.remove("page-locked")},Oi=e=>{document.body.style.overflow=e?"initial":"hidden"},Pi=e=>{const t=Li(e),n=$i(e);(e=>{e.classList.toggle("takeover-ad-hidden",!0)})(e),Oi(!0),e.style.display="none",window.removeEventListener("keydown",t),window.removeEventListener("advertory:closeTakeover",n)},$i=e=>{const t=()=>Pi(e);return window.addEventListener("advertory:closeTakeover",t),Ci(),t},Li=e=>{const t=t=>{["Enter","Escape"].includes(t.key)&&Pi(e)};return Ci(),window.addEventListener("keydown",t),t},xi=e=>{const t=e.querySelector(".advertory-splash-navbar-wrapper");t&&(Li(e),$i(e),Ci(),t.addEventListener("click",()=>{Pi(e)}),Oi(!1))},Ni=e=>{(e=>{window.addEventListener("scroll",()=>{e.getBoundingClientRect().bottom,(e=>{const t=e.getBoundingClientRect().bottom;e.style.opacity=""+t/e.offsetHeight})(e)},{passive:!0})})(e),$i(e);const t=document.querySelector("header");document.querySelectorAll(".smooth-close-takeover").forEach(e=>e.addEventListener("click",()=>null==t?void 0:t.scrollIntoView({behavior:"smooth"})))},ji=e=>{(e=>{window.addEventListener("advertory:closeTakeover",()=>Pi(e))})(e)},qi=e=>{const{takeover:{splash:{showAnnonsLabel:t=!1}={}}={}}=c.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=gt.se.adText),e.classList.toggle("advertory-splash-wrapper",!0)},_i=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=gt.no.adText,n.classList.add("takeover-topscroller-label"),e.classList.toggle("topscroller-wrapper",!0))},Di=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=gt.se.adText,e.classList.toggle("welcome-page-wrapper",!0))},Bi=e=>{const t=document.querySelector(".advertory-takeover-label");t&&(t.style.display="flex",t.innerText=gt.se.adText,e.classList.toggle("advertory-impact-wrapper",!0))},Mi=()=>{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)},Ri=(e,t)=>{let n=e;return e.includes("529299503")&&(n=(e=>{const t=document.createElement("script");return t.textContent=`(${Si})()`,e+t.outerHTML})(e)),n},Fi=e=>{const t=(e=>{var t;const{requests:n}=window.apntag,i=tt(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=tt(e)?1:0,r=null==n?void 0:n.tags[e].adResponse.ads[i].rtb;r&&(r.banner.content=t)})(e,Ri(t))},Vi=e=>t(void 0,void 0,void 0,function*(){const{takeover:t}=c.get(),{targetId:n}=e,i=document.querySelector(`#${n}`),r=document.querySelector(".advertory-takeover-wrapper");if(!i||!r||!t)return;const o=(e=>{const{width:t,height:n}=e;return wi(t,n)?li:Fe(e,we)?vi:bi()?ui:ci})(e),s=r.offsetHeight,a=window.scrollY>s;r.style.display="block",!a&&Ai(o,!1),((e,t)=>{({[ci]:Di,[li]:qi,[ui]:_i,[vi]:Bi})[t](e)})(r,o),Mi(),((e,t)=>{({[ci]:Ni,[ui]:Ni,[li]:xi,[vi]:ji})[t](e)})(r,o),((e,t,n)=>{if(!n)return;({[ci]:()=>{const{buttonLabel:i}=Ii(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:"")})},[li]:()=>{const{themeColors:i,logotype:r,buttonLabel:o,showArrowIcon:s}=Ii(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:ai,"important"),n.style.color=null!=t?t:di}}})},[ui]:()=>{const{buttonLabel:i,showArrowIcon:r,showCloseButton:o=!0}=Ii(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:""))})},[vi]:()=>{}})[t]()})(r,o,t),yield Ei(),!a&&Ai(o,!0),ki(e,o)}),Ui="advertory-brandmetrics-survey",Hi=()=>t(void 0,void 0,void 0,function*(){const{norstat:{enabled:e}={},country:n,isMobileApp:i,tcf:r}=c.get(),o=yield I(r,i,n,"norstat");if(!e||i||!o)return;const s=(e=>{const{ppid1:t,ppid2:n}=se.getPPIDs(),{ppid1:i,ppid2:r}=ae.getPPIDs(),o=(new oe).add(n,X[e]).add(t,Z[e]).add(r,ee[e]).add(i,te[e]);return`${o.buildNorstatPath()}?${o.buildNorstatQuery("alias").toString()}`})(n);((e,n,...i)=>{t(void 0,[e,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===v.NO?"schibsted":"schibstedse"}/map/${s}`,"norstat")}),zi={nativeAd:e=>Oe(e)&&!je(e),buyrecipe:e=>e.targetId.startsWith("buyrecipe"),fullwidthAd:Pe,fullscreenScroll:Ce,topscroller:e=>$e(e)&&bi(),splash:e=>$e(e)&&wi(e.width,e.height),welcomePage:$e,wallpaper:xe,skyscraper:e=>e.targetId.includes("skyscraper")&&!!e.banner,lFormat:Me,hFormat:Re,toppanorama:e=>e.targetId.startsWith("toppanorama")&&!Re(e)&&!Me(e),topboard:e=>e.targetId.startsWith("topboard")&&!$e(e),widescreen:Be,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")&&!_e(e))(e)&&!(e=>e.targetId.includes("backfill"))(e)&&!De(e),outstream:e=>"https://acdn.adnxs.com/video/outstream/ANOutstreamVideo.js"===e.renderer_url,netboard:e=>(e=>e.targetId.startsWith("netboard"))(e)||(e=>e.targetId.startsWith("board"))(e),panorama:_e,midboard:De},Wi=({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(zi))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)},Ki=e=>{var t;return(null===(t=Object.entries(zi).find(([,t])=>t(e)))||void 0===t?void 0:t[0])||""},Ji=(e,t)=>{const n=e.width,i=(null!=t?t:window.screen.width)/n;return i<1?i:1},Gi=new Map;Gi.set("insider",{scale:.82,transformOrigin:"left center",cogwheelAdjust:!0}),Gi.set("panorama",{scale:.79,transformOrigin:"center center"}),Gi.set("outstream",{scale:.79,transformOrigin:"center center"}),Gi.set("integration",{scale:.79,transformOrigin:"center center"}),Gi.set("toppanorama",{scale:.8,transformOrigin:"left center"});const Qi=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=Ki(e),r=Gi.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")},Yi=e=>{var t,n,i,r,o,s;const{adScaleConfig:a,deviceType:d}=c.get();if(!(null==a?void 0:a.enabled))return;if(Fe(e,me))return;const l=null!==(t=a.adsToBeScaled[d])&&void 0!==t?t:[],u=Wt(e.targetId.split("-")[0]);if(!l.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,m=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=Ji(e,t),i=document.querySelector(`iframe[id^="utif_${e.targetId}"]`);i&&(i.style.transform=`scale(${n})`,i.style.transformOrigin="left top")})(e,(g<m?g:m)-v)},Xi=(e,t)=>t?Object.assign(Object.assign({},e),{"aa-sch-ssa-native-ad":"true","aa-sch-ssa-format":"NATIVE_CONTENT","aa-sch-ssa-market":"XNO","aa-sch-ssa-cat":["ssa_1","ssa_2","ssa_3","ssa_4","ssa_5","ssa_6","ssa_7","ssa_8","ssa_9","ssa_10","ssa_11","ssa_12","ssa_13","ssa_14","ssa_15","ssa_16","ssa_17","ssa_18","ssa_19","ssa_20","ssa_21","ssa_22","ssa_23","ssa_24","ssa_25","ssa_26","ssa_27","ssa_28","ssa_29","ssa_30"]}):e,Zi=e=>`externalImpId:'${e}'`,er=e=>{var t;const{forwardExternalImpId:n=!1,tracker:i}=c.get(),r=(e=>{var t;if(!e.positionConfig)return e;const n=e.keywords[`${K()}-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:l,ssa:u=!1,nativeCustomProperties:v,safeframeConfig:p,dynamicSizeWidthCheck:m=!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!==ui),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),h=Object.assign({invCode:l,sizes:s,targetId:o,keywords:Xi(a,u),allowedFormats:d,dynamicSizeWidthCheck:m},p&&{safeframeConfig:p}),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)?(g("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):(g("Tracker state does not contain field pageViewId or it is empty"),""):(g("Tracker state is empty"),""):(g("Tracker is not configured in initAdvertory function"),"")})(i);n&&y&&(g("External Impression ID assigned to defineTag:",Zi(y)),h.externalImpId=Zi(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}}))(v);return(null===(t=e.allowedFormats)||void 0===t?void 0:t.includes("native"))&&(h.native=f),h},tr=e=>!e.includes("takeover")||yi(),nr=(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},ir="finn-blink",rr="native-ad",or=e=>{const{publisher:t=""}=c.get(),n=document.querySelector(`#${e}`);if(!n)return;const i=`-${t}`;n.classList.remove(`advertory${i}-finn-blink`),n.classList.remove(`advertory${i}-finn-blink-wrapper`)},sr=e=>{if(!e)return e;const{country:t}=c.get(),n=W(t),i=e[`${n}-targetid`],r=i?jt(i[0]):"";return Object.assign(Object.assign({},e),i&&{[`${n}-targetid`]:[r]})},ar=e=>{const{country:t}=c.get(),n=W(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"})})()},lr=(e,n)=>t(void 0,void 0,void 0,function*(){return yield new Promise(t=>{e().then(e=>{t(null!=e?e:null)}).catch(e=>{t(null)})})}),cr="https://dr-edition-teaser-server.inventory.schibsted.io/xandr";new Set(Object.values({PREROLL:"preroll",BUMPER:"bumper",MIDROLL:"midroll"}));const ur={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]}]},vr={no:"NOK",se:"SEK"},pr={no:"no",se:"sv"};class gr{buildFetchObject(e,n,i,r){return t(this,void 0,void 0,function*(){const{country:o,pageOptions:s}=r,{invCode:a,xandrPlacementId:d}=e,l=yield t(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=(u=Object.assign(Object.assign({},n),i),Object.entries(u).flatMap(([e,t])=>void 0===t?[]:Array.isArray(t)?t.map(t=>`${e}=${t}`):[`${e}=${t}`]).join(","));var u;const v=new URL(window.location.href),p=(e=>{const{allowedFormats:t}=e;if(!t||t.includes("native"))return{request:JSON.stringify(ur),ver:"1.1"}})(e),g=(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]}})(e);return{id:Ot(36),imp:[Object.assign(Object.assign(Object.assign({id:a},p&&{native:p}),g&&{banner:g}),{secure:1,tagid:a,ext:{appnexus:Object.assign(Object.assign({},d&&{placement_id:d}),{code:a,keywords:c,use_pmt_rule:!1})}})],site:{domain:v.hostname,page:v.href,publisher:{id:String(s.publisherId),domain:v.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||pr[o]||"no").split("-")[0]},regs:{ext:{gdpr:l.gdpr||0}},user:{id:yield S(r),ext:{consent:l.gdpr_consent||"",eids:ue(o)}},at:1,cur:[vr[o]],source:{tid:Ot(36)},ext:{prebid:{bidder:{appnexus:{member:s.member}}}}}})}fetchData(e,n,i,r){return t(this,void 0,void 0,function*(){try{g("Starting fetching Studio ad from Xandr:",cr);const t=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?`${cr}?${s.toString()}`:cr,d=yield this.buildFetchObject(e,n,i,r),l=yield Q.post(a,t,d);return g("Fetch operation completed successfully.",l),l}catch(e){g("Error during fetch operation:",e)}return null})}}const mr=0,hr=3,yr=(e,t)=>{fr(e,t),br(e,t)},fr=(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:[])Tr(i)}),t.dataset.tracked="true")})},wr=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(Er):window.apntag.fireImpressionTrackers(e);const o=new CustomEvent("advertory:nativeImpression",{detail:{ad:e}});window.dispatchEvent(o)},br=(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:C.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,wr(e),c.disconnect();break}},d);c.observe(r)},Er=e=>{const t=e.includes("googleads");"function"!=typeof window.navigator.sendBeacon||t?Tr(e):window.navigator.sendBeacon(e)},Tr=e=>{fetch(e,{method:"GET",mode:"no-cors"}).catch(t=>console.warn(`Tracker ${e} failed. Error: ${t||"Unknown"}`))},Ir=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:[]}),kr=(e,n)=>t(void 0,void 0,void 0,function*(){var t,i;const{deviceType:r,appearanceConfig:o}=n,s=null==o?void 0:o.defaultThreshold[r],a=null!==(t=e.threshold)&&void 0!==t?t:s,d=document.getElementById(e.id);if(!d)return void g(`Server-side ad container not found: ${e.id}`);yield new Promise(e=>{new IntersectionObserver((t,n)=>{t.some(e=>e.isIntersecting)&&(n.disconnect(),e())},Mn(a)).observe(d)});const{prepareTag:l}=c.getHandlers(),u=ze.getData("alertoryConfigKeywords"),v=null!==(i=l(er(e)).keywords)&&void 0!==i?i:{},p=new gr,m=yield p.fetchData(e,u,v,n);m&&(((e,t,n)=>{const i=n===C.MOBILE?t.mobileHTML:t.desktopHTML;if(i){if(t.adType===mr){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,m,r),m.adType===hr&&(nr(n.publisher,d,rr,n.pageType),yr({targetId:e.id,native:{clickTrackers:m.clickTrackers,impressionTrackers:m.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)),Tt(e,n,Number(null==i?void 0:i.adid)),null==a||a.remove()})(e.id,e.invCode,d,m.bid))}),Sr=(e,t)=>{e.forEach(e=>kr(e,t).catch(e=>{g("Failed to handle server-side ad:",e)}))},Ar={arrayMerge:(e,t)=>t},Cr=e=>t(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))})(e))return e;try{const n=yield(e=>t(void 0,void 0,void 0,function*(){const t=(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})(e);if(!t)return null;const n=new AbortController,i=setTimeout(()=>n.abort(),5e3);try{return yield Q.get(t,{method:"GET",signal:n.signal})}catch(e){throw g("Failed to fetch S3 config",{error:e,url:t}),e}finally{clearTimeout(i)}}))(e);return n?(({siteConfig:e,configOverrides:t})=>{var n;const{keywords:i,refresh:r,placements:s,threshold:a,batchSize:d}=t,l=o.all([e.placements,s],Ar),c=o(e.pageOptions,{keywords:i},Ar),u=o(e.appearanceConfig,{defaultThreshold:a},Ar),v=o(null!==(n=e.refreshConfig)&&void 0!==n?n:{},{scrollRefreshEnabled:r},Ar);return Object.assign(Object.assign({},e),{placements:l,requestSize:null!=d?d:e.requestSize,pageOptions:c,appearanceConfig:u,refreshConfig:v})})({siteConfig:e,configOverrides:n}):e}catch(t){return g("Error fetching S3 config, using site config",{error:t}),e}}),Or=".advertory-right-column-track",Pr="--advertory-right-column-track-height",$r=e=>e.getBoundingClientRect().top+window.scrollY,Lr=e=>{const{marginTop:t,marginBottom:n}=getComputedStyle(e);return e.getBoundingClientRect().height+parseFloat(t||"0")+parseFloat(n||"0")},xr=(e,t)=>{const n=(i=t,`${Math.max(0,Math.round(i))}px`);var i;document.body.style.setProperty(e,n)},Nr=(e,t)=>`${e}-${t}`,jr=(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=$r(e);(()=>{const e=document.querySelector("header");if(!e)return;const t=Lr(e);xr("--advertory-newsroom-header-height",t)})(),o.forEach(({point:e,originalIndex:t})=>{((e,t,n)=>{const i=$r(e),r=Nr(Pr,t),o=i-n,s=Nr("--advertory-right-column-split-point-height",t),a=Lr(e);xr(r,o),xr(s,a)})(e,t+1,s),(e=>{const t=null==e?void 0:e.id;if(!t)return;const n=Nr("--advertory-right-column-ad-height",t),i=Lr(e);xr(n,i)})(r[t])});((e,t)=>{const n=$r(e);xr(Pr,n-t)})(o[Math.min(r.length,o.length-1)].point,s)};let qr=!1;class _r{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 Dr{getPulseObjectId(){return""}getPulsePageId(e,t){return""}}class Br{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(e){return t(this,void 0,void 0,function*(){var t,n,i,r,o,s,a,d,l;const c=new CustomEvent("advertory:partnerstudioAdImpression",{detail:{ad:null===(t=this.parseKilkayaData(e))||void 0===t?void 0:t.placement}});if(window.dispatchEvent(c),!this.pulse)return;const u=this.getEventInput(e,"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(e){return t(this,void 0,void 0,function*(){var t,n,i,r,o,s;if(!this.pulse)return;const a=this.getEventInput(e,"click");this.pulse.trackLegacyClickUIElement?null===(n=(t=this.pulse).trackLegacyClickUIElement)||void 0===n||n.call(t,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 Mr extends Br{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 Rr="[data-k5a-teaser-analytics]",Fr=(e,t,n)=>{const i=document.querySelectorAll("k5a-stream");if(!i.length)return;const r=new Mr(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(Rr);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(Rr);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 Vr{handleKilkayaStreamTracking({pulse:e,pageType:t,publisher:n}){if(!(null==e?void 0:e.instance))return;const i={[p.VG]:new _r}[n]||new Dr;Fr(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&&(g(`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:"";Ft(i)}loadKilkayaScript(e){return t(this,void 0,void 0,function*(){yield Ge(e)})}run(e){return t(this,void 0,void 0,function*(){const{tcf:t,isMobileApp:n,country:i,kilkaya:r}=e;if(!(null==r?void 0:r.enabled))return;const o=yield I(t,n,i,"kilkaya");o&&(this.observeForKilkayaBackfills(),this.injectKilkayaMeta(o),yield this.loadKilkayaScript(r.url),this.handleKilkayaStreamTracking(e))})}}const Ur=1e4,Hr=e=>e.some(e=>e.some(e=>!!e&&ei(e,0)));let zr;const Wr=()=>{const{widescreenSwitching:e}=c.get(),{enabled:t,rotationInterval:n=Ur,widescreenIdPrefix:i}=null!=e?e:{};if(!t)return;const r=((e="widescreen")=>{const{pageSectionsSelectors:{right:t}={}}=c.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=Hr(r);if(!r.length)return;zr&&window.removeEventListener("scroll",zr);const d=(e,t,n)=>{e.forEach(e=>{e&&e.style.setProperty(t,n)})},l=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=Hr(r)||a,s=Date.now());Date.now()-s>=n&&((()=>{const e=l(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=l(o),s=Date.now())},1e3);zr=u,window.addEventListener("scroll",u)},Kr={Blink:"Blink"},Jr=new Map,Gr=e=>{var t;if(!Jr.has(e)){const t=import(/* webpackIgnore: true */e).then(e=>(e=>{for(const[t,n]of Object.entries(Kr)){const i=e[t];null!=i&&(window[n]=i)}})(e)).catch(t=>{throw Jr.delete(e),t});Jr.set(e,t)}return null!==(t=Jr.get(e))&&void 0!==t?t:Promise.resolve()},Qr="https://assets.finn.no/pkg/distribution-fixed/v1/FINNExternalDistribution.modern.js",Yr="https://www.finn.no/distribution-front/external/carousel",Xr={get:e=>{try{const t=sessionStorage.getItem(e);return t?JSON.parse(t):null}catch(e){return g(`sessionStorageClient.get: Error during getting data from sessionStorage: ${e}`),null}},set:(e,t)=>{try{sessionStorage.setItem(e,JSON.stringify(t))}catch(e){g(`sessionStorageClient.set: Error during saving data to sessionStorage: ${e}`)}},remove:e=>{try{sessionStorage.removeItem(e)}catch(e){g(`sessionStorageClient.remove: Error during remove data from sessionStorage: ${e}`)}}},Zr="finn_blink_id",eo=n=>t(void 0,void 0,void 0,function*(){const{userId:t,id:i,hashed_email:r,theme:o}=n,s=e(n,["userId","id","hashed_email","theme"]),a=window[Kr.Blink];if(!a)return;const d=new a({remote:Yr,id:i,hashed_email:r,theme:o});yield d.inject(Object.assign({},s))}),to=n=>t(void 0,void 0,void 0,function*(){const{userId:t,theme:i}=n,r=e(n,["userId","theme"]),o=window[Kr.Blink];if(!o)return;const s=new o({remote:Yr,userId:t,theme:i});yield s.inject(Object.assign({},r))}),no=e=>{var t,n;const i=document.querySelector(`[id^="${e}"]`);return null!==(n=null===(t=null==i?void 0:i.dataset)||void 0===t?void 0:t.finnBlinkId)&&void 0!==n?n:e},io=(e,t)=>{const{finnBlink:{enabled:n}={}}=c.get(),i=(null==t?void 0:t.enabled)||(e=>{var t;const n=document.querySelector(`[id^="${e}"]`);return!!(null===(t=null==n?void 0:n.dataset)||void 0===t?void 0:t.noBidAd)})(e);if(!i||!n)return null;const{limit:r,height:o,requireImage:s,theme:a,rec:d,distributionTypes:l,position:u,offset:v,advertoryTheme:p}=t||{};return{selector:`#${no(e)}`,enabled:i,position:null!=u?u:e,distributionTypes:null!=l?l:[],limit:null!=r?r:100,height:null!=o?o:100,offset:null!=v?v:200,requireImage:s,rec:d,theme:"dark"===a?"dark":"light",advertoryTheme:p}},ro=(e,n,i)=>t(void 0,void 0,void 0,function*(){var r;const{placements:o,deviceType:s}=c.get();g(`rendering finn blink ad for ${e}`);const a=jt(e),d=o[s].find(e=>e.id===a),l=io(e,null==d?void 0:d.finnBlink);if(!(null==l?void 0:l.enabled))return g(`Finn blink is not enabled on placement: ${e}`),i&&i(e),void or(e);if((e=>{var t;const n=no(e),i=document.querySelector(`[id^="${n}"]`);return!!(null===(t=null==i?void 0:i.classList)||void 0===t?void 0:t.contains("finn"))})(e))return void g(`Finn blink already loaded ${e}`);const{publisher:u,country:v,finnBlink:p}=n,{userId:h,uuid:y,channel:f,theme:w}=null!=p?p:{},b=null!=f?f:`${u}.${v}`,E=(e=>{if(!e){const e=A();return null!=e?e:""}return e})(h),T="dark"===w?"dark":"light";try{const e=yield t(void 0,void 0,void 0,function*(){const{finnBlink:{identifierUrl:e}={}}=c.get(),t=Xr.get(Zr),n=m("finncode");if(!e||n)return"";if(!t){const t=yield Q.get(e,{credentials:"include"}),{finn_blink_id:n}=t;if(!n)throw new Error("getFinnBlinkIdentifier: No finn_blink_id found");return Xr.set(Zr,n),n}return t}),n=yield t(void 0,void 0,void 0,function*(){const{ppid2:e}=ae.getPPIDs();return e}),i=(null===(r=null==d?void 0:d.finnBlink)||void 0===r?void 0:r.useNewConstructor)?to:eo;yield i(Object.assign(Object.assign({},l),{channel:b,id:E,userId:n,hashed_email:e,theme:T,uuid:y})).then(()=>{((e,t)=>{const{siteSpecificConfig:{publisherClassName:n}={},pageType:i}=c.get(),r=document.querySelector(`#${e}`);if(!r)return;if(r.classList.add("disable-cogwheel"),!n)return;nr(n,r,ir,null!=t?t:i),Wi({preferredTestIdData:{targetId:e,testId:"finn"}})})(l.selector.replace("#",""),l.advertoryTheme)})}catch(t){g(`Finn blink error ${t}`),i&&i(e),!i&&Rt(e),or(e)}}),oo=()=>t(void 0,void 0,void 0,function*(){const{tcf:e,isMobileApp:t,country:n}=c.get();return!!(yield I(e,t,n,"finn-blink"))||(g("Skip loading finn blink ad due to missing TCF consent."),!1)}),so=(e,t)=>{var n;(g(`Appending ${t.id} after ${e.id}`),e.parentElement&&(n=e.parentElement,!Array.from(n.children).some(e=>e.classList.contains("advertory-finn-blink-wrapper"))))?(e.parentElement.style.display="none",e.parentElement.insertAdjacentElement("afterend",t)):g(`Cannot perform afterend on: ${e.id}`)},ao=e=>document.querySelector(`#${e}`);let lo,co=[];const uo=["takeover","wallpaper"],vo=e=>{const t=(e=>{const t=ze.getData("alertoryConfigKeywords"),{queryConfig:n,placements:i,tcf:r,glimr:o,appearanceConfig:s,requestSize:a=d,publisher:l,country:c,pageType:u,deviceType:v,isMobileApp:p=!1,pageOptions:{member:g},takeover:m,fullscreenScroll:h,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:a,isMobileApp:p,useAppTabletInvCode:y},o&&{glimr:o}),n&&{queryConfig:n}),s&&{appearanceConfig:s}),m&&{takeover:m}),h&&{fullscreenScroll:h})}})(e);window.advertory={initialized:!0,siteConfig:e,alertoryConfig:t}},po=()=>t(void 0,void 0,void 0,function*(){const{pageOptions:e}=c.get(),{preparePageOptions:n}=c.getHandlers(),i=(()=>{const{sandboxAdIframeEnabled:e=!0}=c.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 t(void 0,void 0,void 0,function*(){const{tcf:e,isMobileApp:t,country:n}=c.get();return(yield I(e,t,n,"page-options"))?{}:{userSync:{disabled:!0}}}),o=yield n(Object.assign(Object.assign(Object.assign({disablePsa:!0,enableSafeFrame:!0},e),{renderingManagement:Object.assign({},i)}),r));(e=>{const t=ze.getData("alertoryConfigKeywords");if(Object.keys(t).length)return;const n=ar(e);ze.setData("alertoryConfigKeywords",n)})(o.keywords),Pt(()=>lo.setPageOpts(o))}),go=e=>t(void 0,void 0,void 0,function*(){const{prebid:t,tcf:n,isMobileApp:i,country:r}=c.get(),o=yield I(n,i,r,"loadPlacements"),s=((e,t)=>t?e:(e.filter(e=>!e.supportsNonRTB).forEach(e=>Rt(e.id)),e.filter(e=>e.supportsNonRTB).map(e=>{return Object.assign(Object.assign({},e),{invCode:(t=e.invCode,`${t}_non_rtb`)});var t})))(e,o);mo(s);(null==t?void 0:t.enabled)&&o&&!kt()?(g("core loadPlacements prebid enabled"),yield St()):(g("core load tags invoked without prebid enabled"),ho(s))}),mo=e=>{const{prepareTag:t}=c.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=>{g("core defineTags",{placement:e});const i=er(e);if(tr(e.id)){const r=t(i),o=(e=>{const{allowedFormats:t,invCode:n,keywords:i,sizes:r}=e;return{adTypes:t,invCode:n,keywords:sr(i),sizes:r}})(r);n.push(o),Pt(()=>(g("core defineTag - add to the queue",{placement:e,preparedTag:r}),lo.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})=>tr(e)).map(({id:e})=>e);t.length&&Pt(()=>(g("core loadTags",{placementsIdsToLoad:t}),lo.loadTags([...t])))},yo=(e,n)=>t(void 0,void 0,void 0,function*(){const{appearanceConfig:t,deviceType:i}=c.get(),{threshold:r,refresh:o}=e,s=(e=>{const t=document.querySelector(`[data-show-tag-subscribe-id=${e.targetId}]`),n=document.querySelector(`#${e.targetId}`);return t||n})(n),a=null==t?void 0:t.defaultThreshold[i];s&&(g("core showAd - subscribe for show tag with thresholds",{placement:e,adObj:n,threshold:r,deviceDefaultThreshold:a}),yield Vn(s,null!=r?r:a)),s&&o&&(g("core showAd - setup refreshing",{placement:e,adObj:n}),s.dataset.refresh=o.toString())}),fo=e=>e.some(({id:e})=>uo.some(t=>e.includes(t))),wo=e=>t(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]]},[[],[]]))(e),o=(e=>{const{requestSize:t=d,queryConfig:{placementBatches:n}={},deviceType:i}=c.get(),r=Qt(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)),a=e.filter(({id:e})=>!s.has(e));return[...o,...Xn(a,t)]})(r);for(const e of o)fo(e)?(g("core loadAds without lazy loading",{placementsToLoad:e}),yield go(e)):e.length&&(g("core loadAds with lazy loading",{placementsToLoad:e}),yield bo(e));yield(e=>t(void 0,void 0,void 0,function*(){if(!e.length)return;const{appearanceConfig:t,deviceType:n}=c.get(),i=null==t?void 0:t.defaultThreshold[n];for(const t of e){const{threshold:e,id:n}=t,r=ao(n);r&&(yield Vn(r,null!=e?e:i))}}))(i)}),bo=e=>t(void 0,void 0,void 0,function*(){const{queryConfig:{lazyLoadingV3:{enabled:t=!1,rootMargin:n="200% 0px"}={}}={}}=c.get(),i=[];if(!t)return g("lazy load is not enabled",{placements:e}),void(yield go(e));const r=new IntersectionObserver((t,n)=>{t.filter(({isIntersecting:e,target:{id:t}})=>e&&!t.includes("wallpaper")).forEach(t=>{g("lazy load is enabled - handler start",{loadedPlacementIds:i,placements:e});const r=e.every(e=>i.includes(e.id)),o=e.map(e=>e.id);!r&&i.push(...o),!r&&go(e),g("lazy load is enabled - handler stop",{loadedPlacementIds:i,placements:e,arePlacementsLoaded:r,placementIds:o}),n.disconnect()})},{rootMargin:n});e.forEach(e=>{const t=document.getElementById(e.id);t&&(g("lazy loading - observe element",{placementId:e.id,element:t}),r.observe(t))})}),Eo=()=>t(void 0,void 0,void 0,function*(){const{siteEvents:e,initNativeAd:n,wallpaperHandlers:{initWallpaperAd:i,adjustAdToHorseshoe:r}}=c.getHandlers(),{wallpaper:o,fullscreenScroll:s}=c.get(),a=[];Pt(()=>{lo.onEvent("adRequested",()=>{e.adRequested()}),lo.onEvent("adAvailable",r=>t(void 0,void 0,void 0,function*(){var t,a,d,l,u,v;g("core adAvailable start",{placementsAvailable:co,adObj:r,isFullscreenScrollAd:Ce(r),isFinnBlink:qe(r.targetId),isNativeAd:Oe(r),isMediation:Se(r),isTakeoverAd:$e(r),isCollapseAd:Ne(r),isWallpaperAd:xe(r)});const p=null===(d=null===(a=null===(t=null===window||void 0===window?void 0:window.apntag)||void 0===t?void 0:t.requests)||void 0===a?void 0:a.tags[r.targetId])||void 0===d?void 0:d.adResponse.ads;Se(r)&&p&&(null===(l=p[1])||void 0===l?void 0:l.rtb)&&(r.banner=null===(v=null===(u=p[1])||void 0===u?void 0:u.rtb)||void 0===v?void 0:v.banner),Ce(r)&&bt(r),Be(r)&&Wr(),Ce(r)&&!qe(r.targetId)&&wt(r,s),!Oe(r)||Se(r)||qe(r.targetId)||n(r,c.get()),$e(r)&&!Ne(r)&&(Fi(r.targetId),yield Vi(r)),xe(r)&&(i(()=>Pt(()=>window.apntag.showTag(r.targetId)),o),ze.setData("wallpaper",{isAvailable:!0})),(e=>e.targetId.includes("skyscraperleft")&&!!e.banner)(r)&&ze.setData("horseshoe",{isAvailable:!0}),Wi({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),e.adAvailable(r);const m=co.find(({id:e})=>e===r.targetId);m&&(yield yo(m,r),co=co.filter(e=>e.id!==m.id)),g("core adAvailable stop",{placementsAvailable:co,adObj:r,isFullscreenScrollAd:Ce(r),isFinnBlink:qe(r.targetId),isNativeAd:Oe(r),isMediation:Se(r),isTakeoverAd:$e(r),isCollapseAd:Ne(r),isWallpaperAd:xe(r)})})),lo.onEvent("adLoaded",t=>{const{refreshConfig:i,appearanceConfig:o}=c.get(),s=document.getElementById(t.targetId);qe(t.targetId)&&(e=>{const{fullscreenScroll:t}=c.get(),{initNativeAd:n}=c.getHandlers();Ce(e)&&wt(e,t),Oe(e)&&n(e,c.get())})(t);a.includes(t.targetId)&&Oe(t)&&(n(t,c.get()),Wi({adObj:t})),!a.includes(t.targetId)&&Se(t)&&a.push(t.targetId),Ne(t)&&Rt(t.targetId),$e(t)&&((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"]})})(lo,t.targetId),Pe(t)&&(e=>{const t=document.querySelector(`#${e.targetId}`),{siteSpecificConfig:{publisherClassName:n,fullWidthFormatClassName:i}={}}=c.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`))})(t),(e=>Fe(e,he))(t)&&(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}={}}=c.get();if(!(n&&r&&o&&i))return;i.classList.add(`advertory-${s}-${a}__vertical-full-width-ad-wrapper`);const d=window.innerWidth,l=Math.round(d/1080*1920);n.style.width="100%",n.style.height=`${l}px`,n.classList.add(`advertory-${s}-${a}__vertical-full-width-ad`);const u=Ji(e,n.offsetWidth);o.style.transform=`scale(${u})`,o.style.transformOrigin="left top"})(t),((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;Gn({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&&Yn(i,s,o))})(t,i),(null==o?void 0:o.clearProbableDimensionsEnabled)&&(e=>{const t=document.querySelector(`#${e}`);t&&(t.style.minWidth="",t.style.minHeight="")})(t.targetId);ze.getData("horseshoe").isAvailable&&r(t.targetId),Yi(t),e.adLoaded(t),Et(t.targetId),s&&(s.classList.add(It),(e=>{var t,n;const{siteSpecificConfig:i}=c.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)),Qi(t),window.dispatchEvent(new CustomEvent("advertory:adLoaded",{detail:{targetId:t.targetId,adFormat:Ki(t)}}))}),lo.onEvent("adNoBid",n=>t(void 0,void 0,void 0,function*(){Rt(n.targetId),yield Cn(c.get(),n),Ti(n)&&(yield Ei()),e.adNoBid(n)})),lo.onEvent("adError",(n,i)=>t(void 0,void 0,void 0,function*(){Ti(i)&&(yield Ei()),e.adError(n,i)})),lo.onEvent("adCollapse",()=>{e.adCollapse()}),lo.onEvent("adRequestFailure",n=>t(void 0,void 0,void 0,function*(){Rt(n.targetId),yield Cn(c.get(),n),e.adRequestFailure(n)})),lo.onEvent("adBadRequest",n=>t(void 0,void 0,void 0,function*(){Rt(n.targetId),yield Cn(c.get(),n),e.adBadRequest(n)})),lo.onEvent("adLoadedMediated",t=>e.adLoadedMediated(t)),lo.onEvent("adNoBidMediated",n=>t(void 0,void 0,void 0,function*(){yield Cn(c.get(),n),e.adNoBidMediated(n)}))})}),To=(e,n)=>t(void 0,void 0,void 0,function*(){var t;if(!(null===(t=null===window||void 0===window?void 0:window.advertory)||void 0===t?void 0:t.initialized))return[];const{clearAds:i,reloadExistingAds:r,renderFinnBlinkPlacements:o,contextSelector:s}=null!=n?n:{};if(i)return Ht(),[];r&&(Ht(),document.querySelectorAll('[data-advertory-ad-rendered="true"]').forEach(e=>{Ft(e.id)})),u(null!=e?e:{}),yield po();const{clientSidePlacements:a,serverSidePlacements:d}=Ir(Jt(s));let l=a;return o&&(l=l.filter(e=>qe(e.id))),Sr(d,c.get()),l.length>0&&(co=[...co,...l.map(e=>Object.assign({},e))],ti(l),ii(l),yield wo(l)),co}),Io=(e,n)=>t(void 0,void 0,void 0,function*(){var i;c.set(e),c.setHandlers(n),ze.initialize(),window.addEventListener("message",Bn,!1),lo=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=lo,g("Apn tag is set up on window"),yield Promise.allSettled([t(void 0,void 0,void 0,function*(){const{tcf:e,isMobileApp:t,country:n}=c.get();(yield I(e,t,n,"xandr-endpoint"))||lo.setEndpoint("ib.adnxs-simple.com",!0)}),t(void 0,void 0,void 0,function*(){if(kt())return;const{prebid:e,tcf:t,isMobileApp:n,country:i}=c.get(),r=yield I(t,n,i,"prebid");(null==e?void 0:e.enabled)&&r&&(yield Ge(null==e?void 0:e.url))}),de(e),t(void 0,void 0,void 0,function*(){const{astUrl:e}=c.get();yield Ge(null!=e?e:"https://adsdk.microsoft.com/ast/ast.js")}),t(void 0,void 0,void 0,function*(){const{gptUrl:e,tcf:t,isMobileApp:n,country:i}=c.get();(yield I(t,n,i,"gpt-endpoint"))&&(yield Ge(null!=e?e:"https://securepubads.g.doubleclick.net/tag/js/gpt.js"))}),t(void 0,void 0,void 0,function*(){const{brandmetrics:{enabled:e,url:t}={},tcf:n,isMobileApp:i,country:r}=c.get(),{getConsentAsync:o}=T(n,0,r),s=yield o();if(e&&t&&s){if(yield Ge(t),document.querySelector(`.${Ui}`))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(Ui)})&&(t.disconnect(),window._brandmetrics=window._brandmetrics||[],window._brandmetrics.push({cmd:"_loadsurvey"}))}}).observe(document,{childList:!0,subtree:!0,attributes:!0})}}),F(),t(void 0,void 0,void 0,function*(){const{gdpr:{url:e,allowHidingAds:t=!0}={}}=c.get();t&&(window.gdpr=window.gdpr||{},window.gdpr.allowHidingAds=!0),yield Ge(null!=e?e:"https://cogwheel.inventory.schibsted.io/prod/latest/gdpr-bundle.js")})]),yield Hi(),g("Libraries have been loaded and trackers have been set"),yield(i=n.librariesToLoad,t(void 0,void 0,void 0,function*(){const e=i.map(e=>Ge(e));yield Promise.all(e)})),yield Eo(),yield po(),g("Page options have been set"),vo(e),g("Advertory is setup on window");const{clientSidePlacements:r,serverSidePlacements:o}=Ir(Jt());co=r,Sr(o,e),ti(co),ii(co),yield wo(co),g("Ads has been loaded",co),((e,n)=>{var i,r,o,s;if(!Sn())return void g("Ad block not enabled, Dr. Edition backfills will not be rendered");g("Ad block is enabled, Dr. Edition backfills will be rendered");const a=null!==(s=null===(o=null===(r=null===(i=e.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)=>t(void 0,void 0,void 0,function*(){for(const t of n){if(!t.isIntersecting)continue;const n=t.target;i.unobserve(n),yield Cn(e,{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)})})(e,co),dr(co),yield n.replaceAdsWithFinnBlink(e.finnBlink),yield(e=>t(void 0,void 0,void 0,function*(){var t;if(!e.drEdition)return;if(!(yield I(e.tcf,e.isMobileApp,e.country,"handleDrEdition")))return;const n=yield En(),i=new Tn(n);In({publisher:e.publisher,drEditionConfig:e.drEdition,device:e.deviceType,pageType:e.pageType,country:e.country},i,null===(t=e.pulse)||void 0===t?void 0:t.instance)}))(e),(e=>{if(!(null==e?void 0:e.enabled)||qr)return;const{splitPointIDs:t,adSelector:n,trackSelector:i=Or}=e,r=document.querySelector(i);if(!r)return;qr=!0;const o=()=>{jr(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)})(e.rightColumnSplit),yield(e=>t(void 0,void 0,void 0,function*(){const t=new Vr;yield t.run(e)}))(e)}),ko=(e,n)=>t(void 0,void 0,void 0,function*(){yield((e,n)=>t(void 0,void 0,void 0,function*(){const{initConsentManager:t,getConsentAsync:i}=T(e.tcf,e.isMobileApp,e.country),r=yield Cr(e);yield kn(),yield lr(t),yield lr(i),g("TCF resolved successfully"),yield Io(r,n),g("Run function resolved successfully")}))(e,n)}),So=(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:m,customTitle2:h,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!=m?m:"",customTitle2:null!=h?h:"",customTitle3:null!=y?y:"",customTitle4:null!=f?f:"",logo2:T(b),previewVideoSrc:null!=E?E:""},t)},Ao=(e,t)=>{const n=(i=y,window.location.href.includes(i));var i;const r=new URLSearchParams(window.location.search).get(y),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},Co=(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(p).includes(i);n&&o&&nr(i,e,rr,r)})(r,n),i())},Oo=(e,t,n)=>{const i=((e,t,n)=>{var i;const{displayTemplates:r,videoTemplates:o}=n,s="default";if(!e.native)return null;const{native:a,targetId:d}=e,{desc2:l=s}=e.native,c=l.toLowerCase(),u=null!==(i=Ao(e.targetId,l))&&void 0!==i?i:c,p=gt[t.language||v.NO],g=So(a,p,d,t);return(a.video?o[u]:r[u]||r.default)(g,t)})(e,t,n);Co(e.targetId,i,t,()=>{const{nativeTrackingConfig:{nativeTrackingEnabled:n=!0}={}}=t;n&&yr(e,t)})},Po="viewable",$o="adClick";var Lo=e=>(t,n,i)=>{const{video:r,img:o,url:s}=t,{publisher:a,productTag:d}=n,{pluginsNames:l,videoLoop:c}=i||{};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=xo(r.content,s),m=No({id:u,nodeId:p,poster:v,tagURL:g,publisher:a,productTag:d,videoLoop:c});return jo({playerConfig:m,clickUrl:s,pluginsNames:l}),`${e(t,n,p)}`};const xo=(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"}))},No=({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({},yn(e)?e:{}),{provider:Object.assign(Object.assign({},yn(null==e?void 0:e.provider)?e.provider:{}),{productTag:o})})}}),jo=e=>t(void 0,void 0,void 0,function*(){const{playerConfig:t,pluginsNames:n,clickUrl:i}=e,{repeat:r}=t,o=yield un(t);pn(n),o.once("assetReady",()=>{cn(o,n)}),o.on(Po,e=>{const{viewable:t}=e;t?o.play():o.pause()}),o.on($o,()=>{window.open(i,"_blank")}),r&&o.on("pause",()=>{o.play()})}),qo=({containerId:e,adText:t,url:n,adFrom:i,sponsoredBy:r,title:o},s,a)=>`<article class="advertory-abo-ad-native-video">\n <div class="ad-info" id="${e}-button"></div>\n <div class="ad-content">\n <div class="ad-image-container">\n <div class="ad-header">\n <span>${t}</span>\n </div>\n <div class="ad-player-wrapper">\n <div id="${a}"></div>\n </div>\n </div>\n <div class="ad-text-container">\n <span class="sponsored-by">\n ${i} ${r}\n </span>\n <a class="ad-link" href="${n}" target="_blank">\n <span class="ad-title">${o}</span>\n <div class="ad-description">${o}</div>\n </a>\n </div>\n </div>\n </article>`,_o=({containerId:e,url:t,adContent:n,logo:i,description:r,title:o,customTitle1:s,customTitle2:a},{publisher:d},l)=>(((e,t)=>{const n=document.querySelector(`#${t}`);if(n)for(const t of Object.keys(e))n.style.setProperty(t,e[t])})({"--desktopTitleSize":`${s?`${s}px`:"clamp(22px, 3.6rem, 59px)"}`},e),`<article class="advertory-abo-ad-native-content-video ${d}">\n <div class="ad-info" id="${e}-button"></div>\n <div class="ad-content">\n <div class="ad-header">\n <span>${n}</span>\n <img alt="${o}" class="ad-logo" src="${i}" loading="lazy" />\n </div>\n <div class="ad-image-container">\n <div class="ad-player-wrapper">\n <div id="${null!=l?l:0}"></div>\n </div>\n </div>\n <a class="ad-link" href="${t}" target="_blank">\n <div class="ad-text-container">\n <div class="ad-description">${r}</div>\n <h2 class="ad-title">\n ${o}\n </h2>\n </div>\n </a>\n </div>\n </div>\n </div>\n </article>`),Do={VIDEO:(e,t)=>Lo(qo)(e,t),SPONSORSTRIPE:({title:e,sponsoredBy:t,logo:n})=>`<article class="advertory-abo-ad-native-sponsorstripe">\n <div class="ad-wrapper">\n <div class="info-button-wrapper" onClick="\n const adDescription = document.getElementById('ad-sponsorstripe-description');\n adDescription.classList.toggle('hide');\n ">\n <div class="info-button"></div>\n </div>\n\n <span class="ad-title">${e}</span>\n <img alt="${t}" class="ad-logo" src="${n}" />\n\n <div id="ad-sponsorstripe-description" class="ad-description hide">\n <span>${(e=>`Annonsøren har betalt for profilering av logo og merkenavn i artikler tilknyttet ${e}. Annonsøren har ingen innflytelse på Aftenpostens journalistiske virksomhet.`)(t)}</span>\n <a class="ad-description-readmore" href="https://www.aftenposten.no/slik-jobber-vi-i-aftenposten/i/xgKR18/ekstern-finansiering-av-innhold-i-aftenposten" target="_blank">Les mer</a>\n <div class="close-button-wrapper" onClick="\n const adDescription = document.getElementById('ad-sponsorstripe-description');\n adDescription.classList.toggle('hide');\n ">\n <div class="close-button"></div>\n </div>\n </div>\n </div>\n \n </article>`,RECIRC:({containerId:e,url:t,sponsoredBy:n,title:i,logo:r,img:o,adFrom:s,adText:a})=>`<article class="advertory-abo-ad-native-recirc">\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-image-container">\n <div class="ad-header">\n <span>${a}</span>\n </div>\n <img alt="${i}" class="ad-image" src="${o}" />\n <img alt="${n}" class="ad-logo" src="${r}" />\n </div>\n <div class="ad-text-container">\n <div class="ad-sponsored-by">\n ${s} ${n}\n </div>\n <div class="ad-title">${i}</div>\n </div>\n </div>\n </a>\n </article>`,CONTENT_BASIC:({containerId:e,url:t,sponsoredBy:n,title:i,logo:r,img:o,adFrom:s,adText:a},{publisher:d})=>`<article class="advertory-abo-ad-native-default ${d}">\n <div class="ad-info" id="${e}-button"></div>\n <a class="ad-link" href="${t}" target="_self">\n <div class="ad-content">\n <div class="ad-image-container">\n <div class="ad-header">\n <span>${a}</span>\n </div>\n <img alt="${i}" class="ad-image" src="${o}" />\n <img alt="${n}" class="ad-logo" src="${r}" />\n </div>\n <div class="ad-text-container">\n <div class="ad-sponsored-by">\n ${s} ${n}\n </div>\n <div class="ad-title">${i}</div>\n </div>\n </div>\n </a>\n </article>`,CONTENT_VIDEO:(e,t)=>{const{video:n}=e;return(null==n?void 0:n.content)?Lo(_o)(e,t):null}},Bo={NATIVE_TEMPLATE:({containerId:e,url:t,sponsoredBy:n,title:i,img:r,adText:o})=>`<article class="advertory-no-ad-native-default">\n <div class="ad-info" id="${e}-button"></div>\n <a class="ad-link" href="${t}" target="_self">\n <div class="ad-content">\n <div class="ad-image-container">\n <img alt="${i}" class="ad-image" src="${r}" />\n </div>\n <div class="ad-text-container">\n <div class="ad-sponsor">\n <span class="ad-label">${o}</span> ${n}\n </div>\n <div class="ad-title">${i}</div>\n </div>\n </div>\n </a>\n </article>`,NATIVE_RECIRC:({containerId:e,url:t,sponsoredBy:n,title:i,img:r,adText:o})=>`<article class="advertory-no-ad-native-recirc">\n <div class="ad-info" id="${e}-button"></div>\n <a class="ad-link" href="${t}" target="_self">\n <div class="ad-content">\n <div class="ad-image-container">\n <img alt="${i}" class="ad-image" src="${r}" />\n </div>\n <div class="ad-text-container">\n <div class="ad-sponsor">\n <span class="ad-label">${o}</span> ${n}\n </div>\n <div class="ad-title">${i}</div>\n </div>\n </div>\n </a>\n </article>`,NATIVE_SEAMLESS:({containerId:e,url:t,adText:n,img:i,cta:r,description:o,logo:s,sponsoredBy:a,title:d,customTitle2:l})=>`<article class="advertory-no-ad-native-seamless">\n <div class="ad-info" id="${e}-button">\n <a class="ad-link" href="${t}" target="_blank">\n <div class="ad-content">\n <div class="ad-header">\n <div class="ad-brand">\n ${s&&`<img alt="${a}" class="ad-logo" src="${s}" loading="lazy" />`}\n <div class="ad-brand-text">\n <div class="sponsored-by">${a}</div>\n <div class="ad-annons">${n}</div>\n </div>\n </div>\n <h2 class="ad-headline">${d}</h2>\n </div>\n <div class="ad-image-container">\n <img alt="${d}" class="ad-image" src="${i}" loading="lazy">\n </div>\n <div class="ad-footer">\n <div class="ad-row">\n <div class="ad-text-wrapper">\n <div class="ad-domain">${l}</div>\n <div class="ad-description">${o}</div>\n </div>\n <div class="ad-action">${r}</div>\n </div>\n </div>\n </div>\n </a>\n </div>\n </article>`},Mo={CONTENT:({containerId:e,url:t,sponsoredBy:n,title:i,logo:r,img:o,description:s})=>`<article class="advertory-bt-ad-native-content">\n <div class="ad-info" id="${e}-button"></div>\n <a class="ad-link" href="${t}" target="_self">\n <div class="ad-content">\n <div class="ad-header">\n <span class="ad-annonse">ANNONSØRINNHOLD</span>\n <img alt="${n}" class="ad-logo" src="${r}" />\n </div>\n <div class="ad-image-container">\n <img alt="${i}" class="ad-image" src="${o}" />\n </div>\n <div class="ad-text-container">\n <span class="ad-subtitle">\n ${s}\n </span>\n <span class="ad-title">${i}</span>\n </div>\n </div>\n </a>\n </article>`},Ro={displayTemplates:{content:Mo.CONTENT,recirc:Do.RECIRC,sponsorstripe:Do.SPONSORSTRIPE,native:Bo.NATIVE_TEMPLATE,native_recirc:Bo.NATIVE_RECIRC,seamless:Bo.NATIVE_SEAMLESS,default:Do.CONTENT_BASIC},videoTemplates:{default:Do.VIDEO,content:Do.CONTENT_VIDEO}},Fo=((e,t)=>n=>ko(Object.assign(Object.assign({},n),{siteSpecificConfig:t}),e))({initNativeAd:(e,t)=>{const{targetId:n}=e;if(!document.querySelector(`#${n}`))return;const{pageType:i=ln.FRONT,nativeTrackingConfig:r,appearanceConfig:o,deviceType:s}=null!=t?t:{},a={language:v.NO,publisher:p.BT,deviceType:s,pageType:i,nativeTrackingConfig:r,appearanceConfig:o};Oo(e,a,Ro)},wallpaperHandlers:{initWallpaperAd:(e,t)=>{if(!t)return;const{options:{appMainContainerSelector:n,wallpaperAnchorSelector:i}={}}=t;(e=>{const t=document.querySelector(e||"#application");if(!t)return;Dt();const n=document.createElement("div");n.classList.add(qt),document.body.insertBefore(n,t.nextSibling),n.style.setProperty("position","fixed"),n.style.setProperty("width","100%"),n.style.setProperty("height","calc(100% - var(--header-height, 0px) - 15px)"),n.style.setProperty("background-position","center top"),n.style.setProperty("background-repeat","no-repeat")})(n),(e=>{const t=e||".advertory-wrapper-common-skyscraperleft_1",n=document.querySelector(t);n&&(Bt(n),window.addEventListener("scroll",()=>Bt(n)))})(i),e()},adjustAdToHorseshoe:e=>{var t;const n=document.querySelector(`#${e}`);n&&(null===(t=n.parentElement)||void 0===t||t.classList.add(_t),n.classList.add(_t))}},loadFinnBlinkAd:(e,n,i,r)=>t(void 0,void 0,void 0,function*(){const{isMobileApp:t}=c.get();if(g(`loadFinnBlinkAd: loading finn blink ad for ${e}`),!(yield oo())||t)return i&&i(e),or(e),void(!i&&Rt(e));try{yield Gr(Qr)}catch(e){console.error(e)}yield ro(e,n,i),r&&r()}),replaceAdsWithFinnBlink:e=>t(void 0,void 0,void 0,function*(){if(!e)return;const{replacementConfig:t}=e;if(!(Sn()&&(null==t?void 0:t.adsToReplace)&&(null==t?void 0:t.sizes)&&e.enabled))return void g(`Finn blink configuration is incorrect: ${JSON.stringify(t)}`);if(!(yield oo()))return;yield Gr(Qr);const{adsToReplace:n,sizes:i}=t;n.forEach(([e,t])=>{const n=document.querySelector(`[id^="${e}"]`);if(!n)return;const i=(e=>{const{siteSpecificConfig:{publisherClassName:t}={}}=c.get(),n=document.createElement("div"),i=document.createElement("div");return i.id=e,n.appendChild(i),nr(t,i,ir),g(`Creating blink container for: ${e}`),n})(t);(e=>{g(`Hiding old ad container: ${e.id}`),e.style.setProperty("display","none","important")})(n),so(n,i),n.dataset.finnBlinkId=t,Rn().withFullAdsChain(e)})}),preparePageOptions:pe,prepareTag:e=>{const{keywords:t,targetId:n,invCode:i}=e,{useAppTabletInvCode:r=!0}=c.get(),o=((e,t)=>{const{isMobileApp:n}=c.get();return n?((e,t)=>e.replace(/wtb|wde|wph/g,e=>"wph"===e?"aph":t?"atb":e))(e,t):e})(i,r),s=(e=>{const{country:t}=c.get(),{keywords:n,dynamicSizeWidthCheck:i}=e,r=`${W(t)}-adformat`,o=n?n[r]:[];if(!o)return{};const s=(Array.isArray(o)?o:[o]).filter(e=>!(e in Ie)||window.innerWidth>=Ie[e]);return{[r]:i?s:o}})(e),a=(e=>{const{country:t}=c.get(),n=`${W(t)}-targetid`;return e?{[n]:[e]}:{}})(n),d=ke(),l=(e=>Ae(e)?{"aa-sch-dynamic-outstream":["true"]}:{})(i),u=((e,t)=>Ae(e)?Object.assign(Object.assign({},t),{playerSkin:{videoBackgroundColor:"#e6e7e8"}}):{})(i);return Object.assign(Object.assign({},e),{invCode:o,keywords:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},t),s),a),l),d),rendererOptions:u})},siteEvents:Ve,librariesToLoad:[]},Ue);var Vo=Object.freeze({__proto__:null,default:""});export{Fo as initAdvertoryPackage,To as updateAdvertory};