@schibsted/advertory 2.63.2 → 2.63.3
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.
- package/core/aftenposten/es/index.css +1 -1
- package/core/aftenposten/es/index.js +1 -1
- package/core/aftenposten/index.js +1 -1
- package/core/aftenpostenv2/es/index.css +1 -1
- package/core/aftenpostenv2/es/index.js +1 -1
- package/core/aftonbladet/es/index.css +1 -1
- package/core/aftonbladetv2/es/index.css +1 -1
- package/core/aftonbladetv2/es/index.js +1 -1
- package/core/bt/es/index.css +1 -1
- package/core/bt/es/index.js +1 -1
- package/core/bt/index.js +1 -1
- package/core/e24/es/index.css +1 -1
- package/core/e24/es/index.js +1 -1
- package/core/e24/index.js +1 -1
- package/core/fotbollskanalen/es/index.css +1 -1
- package/core/fotbollskanalen/es/index.js +1 -1
- package/core/fotbollskanalen/index.js +1 -1
- package/core/godare/index.js +1 -1
- package/core/godt/index.js +1 -1
- package/core/klart/index.js +1 -1
- package/core/koket/es/index.js +1 -1
- package/core/koket/index.js +1 -1
- package/core/kompakt/index.js +1 -1
- package/core/minmote/index.js +1 -1
- package/core/pent/index.js +1 -1
- package/core/sa/es/index.css +1 -1
- package/core/sa/es/index.js +1 -1
- package/core/sa/index.js +1 -1
- package/core/svd/es/index.css +1 -1
- package/core/svdv2/es/index.css +1 -1
- package/core/svdv2/es/index.js +1 -1
- package/core/tek/index.js +1 -1
- package/core/tv4/es/index.css +1 -1
- package/core/tv4/es/index.js +1 -1
- package/core/tv4/index.js +1 -1
- package/core/tvnu/index.js +1 -1
- package/core/vg/es/index.css +1 -1
- package/core/vg/es/index.js +1 -1
- package/core/vg/index.js +1 -1
- package/core/vgv2/es/index.css +1 -1
- package/core/vgv2/es/index.js +1 -1
- package/features/ad-native/index.js +1 -1
- package/package.json +1 -1
- package/sites/aftenposten/es/index.css +1 -1
- package/sites/aftenposten/es/index.js +1 -1
- package/sites/aftenposten/index.js +1 -1
- package/sites/aftenpostenv2/es/index.css +1 -1
- package/sites/aftenpostenv2/es/index.js +1 -1
- package/sites/aftonbladet/es/index.css +1 -1
- package/sites/aftonbladetv2/es/index.css +1 -1
- package/sites/bt/es/index.css +1 -1
- package/sites/bt/es/index.js +1 -1
- package/sites/bt/index.js +1 -1
- package/sites/e24/es/index.css +1 -1
- package/sites/e24/index.js +1 -1
- package/sites/koket/es/index.css +1 -1
- package/sites/sa/es/index.css +1 -1
- package/sites/sa/es/index.js +1 -1
- package/sites/sa/index.js +1 -1
- package/sites/svd/es/index.css +1 -1
- package/sites/svd/es/index.js +1 -1
- package/sites/svd/index.js +1 -1
- package/sites/svdv2/es/index.css +1 -1
- package/sites/svdv2/es/index.js +1 -1
- package/sites/tv4/es/index.css +1 -1
- package/sites/tvnu/index.js +1 -1
- package/sites/vg/es/index.css +1 -1
- package/sites/vg/es/index.js +1 -1
- package/sites/vg/index.js +1 -1
- package/sites/vgv2/es/index.css +1 -1
- package/sites/vgv2/es/index.js +1 -1
- package/styles/aftenpostenv2/styles.css +1 -1
- package/styles/e24/styles.css +1 -1
- package/types/features/ad-scale/index.d.ts +2 -1
- /package/types/{core/handlers/scale/index.d.ts → features/ad-scale/scale-ad.d.ts} +0 -0
- /package/types/{core/handlers/scale/index.test.d.ts → features/ad-scale/scale-ad.test.d.ts} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import"react/jsx-runtime";function e(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 t(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var n,i;"function"==typeof SuppressedError&&SuppressedError;var o=t(function(){if(i)return n;i=1;var e=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var n=Object.prototype.toString.call(e);return"[object RegExp]"===n||"[object Date]"===n||function(e){return e.$$typeof===t}(e)}(e)},t="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function o(e,t){return!1!==t.clone&&t.isMergeableObject(e)?l((n=e,Array.isArray(n)?[]:{}),e,t):e;var n}function r(e,t,n){return e.concat(t).map(function(e){return o(e,n)})}function s(e){return Object.keys(e).concat(function(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter(function(t){return Object.propertyIsEnumerable.call(e,t)}):[]}(e))}function a(e,t){try{return t in e}catch(e){return!1}}function d(e,t,n){var i={};return n.isMergeableObject(e)&&s(e).forEach(function(t){i[t]=o(e[t],n)}),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)&&n.isMergeableObject(t[r])?i[r]=function(e,t){if(!t.customMerge)return l;var n=t.customMerge(e);return"function"==typeof n?n:l}(r,n)(e[r],t[r],n):i[r]=o(t[r],n))}),i}function l(t,n,i){(i=i||{}).arrayMerge=i.arrayMerge||r,i.isMergeableObject=i.isMergeableObject||e,i.cloneUnlessOtherwiseSpecified=o;var s=Array.isArray(n);return s===Array.isArray(t)?s?i.arrayMerge(t,n,i):d(t,n,i):o(n,i)}return l.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce(function(e,n){return l(e,n,t)},{})},n=l}());const r=["deviceType","pageType","placements","takeover","refreshConfig","editableConfiguration"],s={adRequested:()=>{},adAvailable:e=>{},adLoaded:e=>{},adNoBid:e=>{},adError:(e,t)=>{},adCollapse:()=>{},adRequestFailure:e=>{},adBadRequest:e=>{},adLoadedMediated:e=>{},adNoBidMediated:e=>{}},a=6;class d{set(e){this.config=e}modifyConfigProperties(e){if(!this.config)throw new Error("Config was accessed before it had been initialized.");const t={};for(const n of r){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(d.DEFAULT_SITE_HANDLERS,e)}}d.DEFAULT_SITE_HANDLERS={siteEvents:s,initNativeAd:function(){}};const l=new d,c=l.modifyConfigProperties.bind(l),u=(e,t)=>{const n="[Advertory LOG]: ";location.search.includes("ast_debug=true")&&(t?console.log(n,e,t):console.log(n,e))},v=864e5,p=(()=>{const e=e=>{const t=window.localStorage.getItem(e);if(!t)return null;try{return JSON.parse(t)}catch(e){return u("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=v)=>{const o={data:n,expirationTime:(new Date).getTime()+i};t(e,JSON.stringify(o))},getByTimestamp:(t,n=v)=>{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 u("Error with parsing localStorage data"),null}}}})(),g="glimrTags",h=["glwe_","glwet_"],m={geofenceTags:[],geoTags:[],weatherTags:[]},y=e=>new URLSearchParams(window.location.search).get(e),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 u("Advertising permission value obtained synchronously: ",e),Boolean(t)})();if(null!==n)return void t(n);let i=!1;const o=e=>{i||(u("Resolving advertising permission value obtained"),i=!0,t(e))},r=setTimeout(()=>{u("Advertising permission timed out, resolving with false"),o(!1)},3e3);window._tcf_.onTcfReady(()=>{u("On Tcf Ready called, waiting for permission"),clearTimeout(r)}),window._tcf_.getPermission("CMP:advertising",e=>{clearTimeout(r);const t=Number(e);u("Advertising permission value obtained asynchronously: ",e),o(Boolean(t))})}),w={NO:"no",SE:"se"},b="cmp:loaded";let E,T=!1;const I=(t,n,i)=>{const o=!!(null==t?void 0:t.enabled),r=(null==t?void 0:t.timeout)||3e3,s=y("bypass_tcf"),a=()=>{if(!(null==t?void 0:t.enabled))return!0;if(((e,t)=>e?!!t&&(u("TCF bypass param detected, returning consent: true"),!0):(u("TCF is not enabled, returning consent: true"),!0))(o,s))return!0;if(T)return null;if(!E)throw new Error("[Advertory]: getConsentSync method was called before the tcfManager was available.");const e=E.getConsentedToAllSync();return u(`TCF consented to all is: ${e}`),E.getConsentedToAllSync()};return{initConsentManager:()=>(null==t?void 0:t.enabled)?new Promise((e,t)=>{if(u("Getting TCF consent manager..."),window._tcf_)return u("TCF consent manager is already available"),E=window._tcf_,void e(E);u("TCF consent manager is not available");const n=()=>{u("CMP loaded, resolving consent manager..."),i&&clearTimeout(i),window._tcf_?(E=window._tcf_,e(E)):t(new Error("CMP loaded but window._tcf_ is not defined"))},i=setTimeout(()=>{document.removeEventListener(b,n),T=!0,t(new Error("Timeout waiting for CMP to load"))},r);u("Listening for CMP loaded event..."),document.addEventListener(b,n,{once:!0})}):Promise.resolve(null),getConsentSync:a,getConsentAsync:()=>e(void 0,void 0,void 0,function*(){if(null==t?void 0:t.schibstedAdChoicesOverrideValue)return u(`Schibsted Ad Choices override value is set, returning override value: ${t.schibstedAdChoicesOverrideValue}`),Boolean(Number(t.schibstedAdChoicesOverrideValue));const e=(null==t?void 0:t.schibstedAdChoicesEnabled)&&i===w.SE,o=(null==t?void 0:t.schibstedAdChoicesEnabled)&&!n&&i===w.NO;if(e||o)return u("Schibsted Ad Choices is enabled, getting advertising permissions..."),yield f(t);if(!(null==t?void 0:t.enabled))return!0;const s=a();return null!==s?s:yield new Promise((e,t)=>{try{if(!E)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(()=>{u("TCF isConsentedToAll timed out, resolving with false"),n(!1)},r);E.onTcfReady(()=>{u("On Tcf Ready called, waiting for consent"),clearTimeout(i)}),E.isConsentedToAll(t=>{clearTimeout(i),e(t)})}catch(e){t(e)}})})}},k=(t,n,i,...o)=>e(void 0,[t,n,i,...o],void 0,function*(e,t,n,i="NOT SPECIFIED FEATURE"){if(!(null==e?void 0:e.schibstedConsentToPayEnabled))return u(`Schibsted Consent to Pay is not enabled, returning true for ${i}`),!0;if(null==e?void 0:e.schibstedAdChoicesOverrideValue)return u(`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}=I(e,t,n);return(yield o())?(u(`Schibsted Ad Choices consent given according to TCF consent manager for ${i}`),!0):(u(`Schibsted Ad Choices consent not given according to TCF consent manager for ${i}`),!1)}),A=()=>e(void 0,void 0,void 0,function*(){const{tcf:e,isMobileApp:t,country:n}=l.get();if(null==e?void 0:e.schibstedConsentToPayEnabled){return yield k(e,t,n,"glimr")}const{getConsentAsync:i}=I(e,t,n);return yield i()}),S=()=>e(void 0,void 0,void 0,function*(){const{glimr:t}=l.get();if(!(yield A())||!(null==t?void 0:t.enabled))return void u("No consent for glimr data fetching.");const n=yield(i=500,e(void 0,void 0,void 0,function*(){return yield Promise.race([e(void 0,void 0,void 0,function*(){const e=yield import("glimr-sdk");return e.default||e}),new Promise(e=>setTimeout(()=>e(!1),i))])}));var i;if(n)try{n.setTagCacheTimeInSeconds(300),yield new Promise(e=>{n.getTags(t.clientId,(t,n)=>{p.setWithTimestamp(g,{tags:t,tagMappings:n}),e(!0)})})}catch(e){u(`Error during getting glimr data: ${e}`)}else u("Timeout (500ms) while loading glimr package. Skipping glimr data fetching.",{glimr:n})}),C=()=>{const{country:e}=l.get();return e===w.NO?"no-sno":"se-generic"},O=()=>{const{country:e,publisher:t}=l.get();return`${e}-${t}`},P={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"},$=e=>h.some(t=>e.startsWith(t)),L=e=>e.startsWith("glgc_"),x=e=>!$(e)&&!L(e),N=e=>{const t=j();if(!t)return m;const n=((e=[])=>e.filter($))(t),i=((e=[])=>e.filter(L))(t),o=((e=[],t)=>{const n=e.filter(x);if(t){const{publisher:e}=l.get(),t=P[e]||e;n.push(t)}return n})(t,e);return{geoTags:o,geofenceTags:i,weatherTags:n}},j=()=>{const e=p.getByTimestamp(g);return e&&"string"!=typeof e?null==e?void 0:e.tags:null},_={get:(t,n)=>e(void 0,void 0,void 0,function*(){const e=yield fetch(t,n);if(!e.ok)throw new Error(e.statusText);return yield e.json()}),post:(t,n,i)=>e(void 0,void 0,void 0,function*(){const e=JSON.stringify(i),o=yield fetch(t,{method:"POST",headers:n,body:e});if(!o.ok)throw new Error(o.statusText);return yield o.json()})},q="advertory:ppids-cache",D={[w.SE]:`SCH${w.SE.toUpperCase()}-EnvHash`,[w.NO]:`SCH${w.NO.toUpperCase()}-EnvHash`},M={[w.SE]:`SCH${w.SE.toUpperCase()}-UserHash`,[w.NO]:`SCH${w.NO.toUpperCase()}-UserHash`},B={[w.SE]:`sch${w.SE}-envhash-v3`,[w.NO]:`sch${w.NO}-envhash-v3`},R={[w.SE]:`sch${w.SE}-userhash-v3`,[w.NO]:`sch${w.NO}-userhash-v3`},F={[w.SE]:`'sch${w.SE}-iosid-v3'`,[w.NO]:`'sch${w.NO}-iosid-v3'`},V={[w.SE]:`sch${w.SE}-androidid-v3`,[w.NO]:`sch${w.NO}-androidid-v3`},U={[w.SE]:"sdrn:schibsted.com:user",[w.NO]:"sdrn:spid.no:user"};class H{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 z=new class{constructor(){this.ppid1=null,this.ppid2=null}processPPIDs(t){return e(this,arguments,void 0,function*(e,t=1e4){var n,i;const 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||u("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:""}},W=new class{constructor(){this.ppid1=null,this.ppid2=null,this.idfv=null,this.anId=null}processPPIDs(t,n){return e(this,void 0,void 0,function*(){var e,i,o,r,s,a,d,l,c,u,v;const g=p.get(q),h=yield this.getNewPPIDs(t,n);if(this.shouldHash(g,h)){const n=null!==(e=t.hasherUrl)&&void 0!==e?e:"https://hasher.schibsted.com/api/v1/hash",l=this.createHasherPayload(h),c=yield this.hashPPIDs(l,n);return c?(this.cachePPIDs(l,c,null===(i=h.idfv)||void 0===i?void 0:i.plain,null===(o=h.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=h.idfv)||void 0===a?void 0:a.plain,null===(d=h.anId)||void 0===d?void 0:d.plain)):void this.setPPIDs("","")}this.setPPIDs(null!==(l=null==g?void 0:g.userId.hashed)&&void 0!==l?l:"",null!==(c=null==g?void 0:g.environmentId.hashed)&&void 0!==c?c:"",null===(u=null==h?void 0:h.idfv)||void 0===u?void 0:u.plain,null===(v=null==h?void 0:h.anId)||void 0===v?void 0:v.plain)})}getPPIDs(){var e,t;return null!==this.ppid1&&null!==this.ppid2||u("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}}:{});p.set(q,o)}hashPPIDs(t,n){return e(this,void 0,void 0,function*(){try{const e=new Headers({"Content-Type":"application/json"});return yield _.post(n,e,t)}catch(e){return u("Error with hashing PPIDs",e),null}})}getNewPPIDs(t,n){return e(this,arguments,void 0,function*({clientId:t,instance:n},i){const o=yield((t,n)=>e(void 0,void 0,void 0,function*(){const e=yield t.getUserId();return e?`${U[n]}:${e}`:null}))(n,i),r=yield(t=>e(void 0,void 0,void 0,function*(){const e=yield t.getEnvironmentId();return e?`sdrn:schibsted:environment:${e}`:null}))(n),s=window.advertory_idfv,a=window.advertory_anId;return Object.assign(Object.assign({clientId:{plain:t},userId:{plain: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}}},K=t=>e(void 0,void 0,void 0,function*(){const{tracker:e,tcf:n,country:i,isMobileApp:o}=t;if(!(yield k(n,o,i,"setXandrPPIDs")))return;if(!e)return;(yield Promise.allSettled([z.processPPIDs(e,null==n?void 0:n.timeout),W.processPPIDs(e,i)])).forEach((e,t)=>{if("rejected"===e.status){u(`Cannot fetch PPIDs v${t+2}`,e.reason)}})}),J=e=>{const{ppid1:t,ppid2:n}=z.getPPIDs(),{ppid1:i,ppid2:o,idfv:r,anId:s}=W.getPPIDs();return{userIds:[{type:"extendedIDs",eids:(new H).add(n,D[e]).add(t,M[e]).add(o,B[e]).add(i,R[e]).add(r,F[e]).add(s,V[e]).buildEids()}]}},G=e=>{const{ppid1:t,ppid2:n}=z.getPPIDs(),{ppid1:i,ppid2:o,idfv:r,anId:s}=W.getPPIDs();if(!n)return{};return{userSync:{userIds:[{name:"pubProvidedId",params:{eids:(new H).add(n,D[e]).add(t,M[e]).add(o,B[e]).add(i,R[e]).add(r,F[e]).add(s,V[e]).buildRyEids()}}]}}},Y=e=>{const t=encodeURIComponent(e).replace(/[-.+*]/g,"\\$&"),n=new RegExp(`(?:(?:^|.*;)\\s*${t}\\s*\\=\\s*([^;]*).*$)|^.*$`);return decodeURIComponent(document.cookie.replace(n,"$1"))||null},Q=()=>{const e=Y("_pulse2data");return e?e.split(",")[2]:void 0},X={MOBILE:"mobile",TABLET:"tablet",DESKTOP:"desktop"},Z=9826;class ee{constructor(){this.getSupplyTypeKeywords=()=>{const{deviceType:e=X.DESKTOP,isMobileApp:t}=l.get();if(t){return{"aa-sch-supply_type":`app_${e===X.MOBILE?"phone":X.TABLET}`}}return{"aa-sch-supply_type":`web_${this.getPageOptionsFormatDevice(e)}`}}}prepare(t){return e(this,void 0,void 0,function*(){return Object.assign(Object.assign({},t),{keywords:Object.assign(Object.assign(Object.assign(Object.assign({},t.keywords),this.getSupplyTypeKeywords()),yield this.getFormattedExternalIdKeywords()),this.getHasContextKeywords(t.keywords)),user:{externalUid:yield this.getExternalUid(),dnt:yield this.isTrackingForbidden()}})})}getFormattedExternalIdKeywords(){return e(this,void 0,void 0,function*(){const e=yield this.getExternalUid(),t=this.getUserId();return{"aa-sch-externalid_src":Number(!!e)+Number(!!t)}})}getUserId(){return Q()}getExternalUid(){return e(this,void 0,void 0,function*(){return yield e(void 0,void 0,void 0,function*(){const{tcf:e,isMobileApp:t,country:n}=l.get(),{getConsentAsync:i}=I(e,t,n);if(!(yield i()))return;const o=Y("_pulse2data");return o?o.split(",")[9]:void 0})})}isTrackingForbidden(){return e(this,void 0,void 0,function*(){return(null===navigator||void 0===navigator?void 0:navigator.globalPrivacyControl)||"1"===(null===navigator||void 0===navigator?void 0:navigator.doNotTrack)||"DO_NOT_TRACK"===(yield this.getExternalUid())})}getMember(){const{pageOptions:{member:e},testMember:t=Z}=l.get();return window.location.search.includes("inventory_test=true")?t:e}getCMPValue(e){return localStorage.getItem(`CMP:${e}`)?"0"===localStorage.getItem(`CMP:${e}`)?"0":"1":"0"}getPublisherKeywords(){const{publisher:e}=l.get();return{"aa-sch-publisher":`${e}`}}getAnalyticsConsentKeywords(){return{"aa-sch-cmp_analytics":this.getCMPValue("analytics")}}getAdvertisingConsentKeywords(){return e(this,void 0,void 0,function*(){const{tcf:e,isMobileApp:t,country:n}=l.get(),{getConsentAsync:i}=I(e,t,n);return{"aa-sch-cmp_advertising":(yield i())?"1":"0"}})}getPageTypeKeywords(){const{pageType:e}=l.get();return{"aa-sch-page_type":e}}getCountryCodeKeywords(e){return{"aa-sch-country_code":e}}getInventoryTypeKeywords(){return{"aa-sch-inventory_type":"editorial"}}getHasContextKeywords(e){const t=e["aa-sch-context_keyword"];return{"aa-sch-has_context_keyword":Array.isArray(t)&&t.length?1:0}}getPageOptionsFormatDevice(e="desktop"){return"mobile"===e?"phone":e}getSponsorsKeywords(){var e;const{publisher:t,keywordsConfig:n}=l.get(),i=null===(e=null==n?void 0:n.sponsors)||void 0===e?void 0:e.split(":").map(e=>`${t}_${e}`);return i?{"no-sno-news-sponsors":i}:{}}}const te=new ee;te.prepare.bind(te);function ne(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 ie=["aLOLE","xBqQj","1KaqJ","1nzXzK","opm8zV","4qKXKR","Ad9QgE"];function oe(e){return t=window.location.pathname.split("/").slice(-2,-1).pop()||"",ie.includes(t)?{"no-sno-news-section":`${e}_doedsfall`}:{};var t}class re extends ee{constructor(){super(...arguments),this.getDeviceKeywords=()=>{const{deviceType:e=X.DESKTOP}=l.get();return{"no-sno-device":this.getPageOptionsFormatDevice(e)}}}getAppTypeKeywords(){const{deviceType:e,isMobileApp:t}=l.get(),{OS:n,isHybridApp:i}=ne(t);return{"no-sno-apptype":n&&e&&i?`${n}_${this.getPageOptionsFormatDevice()}_hybrid`:"none"}}getObituariesKeywords(e){return oe(e)}getSectionPageTypeKeywords(){var e,t;const{pageOptions:n,pageType:i}=l.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 se={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"};const ae=new class extends re{prepare(t){return e(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(w.NO)),this.getPublisherKeywords()),this.getPageTypeKeywords()),this.getSupplyTypeKeywords()),this.getDeviceKeywords()),this.getAppTypeKeywords()),yield this.getFormattedExternalIdKeywords()),yield this.getAdvertisingConsentKeywords()),this.getHasContextKeywords(t.keywords)),(()=>{const{ppid1:e,ppid2:t}=z.getPPIDs();return{"aa-sch-schuserhash":e?"1":"0","aa-sch-schenvhash":t?"1":"0"}})()),yield e(void 0,void 0,void 0,function*(){const{glimr:e}=l.get(),{addPublisherToGeo:t}={},n=yield A();if(!(null==e?void 0:e.enabled)||!n)return u("No consent for getting glimr tags."),{};const i=C(),o=N(t);return{[`${i}-geo`]:o.geoTags,[`${i}-weather`]:o.weatherTags,[`${i}-geofence`]:o.geofenceTags}})),t.keywords),this.getObituariesKeywords(se.AFTENPOSTEN));return Object.assign(Object.assign({},t),{keywords:n,user:Object.assign(Object.assign({},J(w.NO)),{externalUid:yield this.getExternalUid()}),member:this.getMember()})})}};var de=ae.prepare.bind(ae);class le{initialize(){this.DATA=Object.assign({},le.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)}}le.INITIAL_DATA={wallpaper:{isAvailable:!1},horseshoe:{isAvailable:!1},initialClassNames:{},alertoryConfigKeywords:{}};const ce=new le,ue=()=>(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),ve=()=>(window.relevantDigital||(window.relevantDigital={cmd:[]}),window.relevantDigital),pe=(e={},t)=>{const{prebid:{externalUidInAuctionEnabled:n,forwardGlimrTags:i=!1}={}}=l.get(),o=[`${C()}-geo`],r=["aa-sch-context_keyword","aa-sch-publisher","se-aftonbladet-section","se-svd-section","se-generic-section","no-sno-news-section","no-sno-news-subsection",...i?o:[]],s=Object.fromEntries(Object.entries(e).filter(([e])=>r.includes(e))),a=t&&n?{id:t}:{};return{ortb2:Object.assign({site:{ext:{data:s}}},a)}},ge=(t,...n)=>e(void 0,[t,...n],void 0,function*(e,{timeout:t}={timeout:1e3}){document.querySelector(`script[src="${e}"]:not([type="module"])`)||(yield new Promise((n,i)=>{const 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)}))}),he="ABSOLUTE_FULLSCREEN",me="ANY_FULLSCREEN",ye="VERTICAL_FULLWIDTH",fe="FULLWIDTH",we="TAKEOVER",be="VELVET_TAKEOVER",Ee="WALLPAPER",Te="COLLAPSE",Ie={ANY_FULLSCREEN:[{width:6,height:6},{width:1920,height:1080},{width:3,height:3}],ABSOLUTE_FULLSCREEN:[{width:6,height:6}],VERTICAL_FULLWIDTH:[{width:1080,height:1920}],FIXED_FULLSCREEN:[{width:1920,height:1080},{width:3,height:3}],FULLWIDTH:[{width:5},{width:400,height:400}],NATIVE_AD:[{width:1,height:1}],TAKEOVER:[{width:4,height:4}],VELVET_TAKEOVER:[{width:7,height:7}],WALLPAPER:[{width:2,height:2}],COLLAPSE:[{width:2,height:1}]},ke={wallpaper:1600,"l-format":1600},Ae=e=>{const{banner:t,targetId:n}=e;return!(!t||(null==n?void 0:n.includes("takeover")))&&Be(e,me)},Se=e=>{const{native:t}=e;return!!t},Ce=e=>Be(e,fe),Oe=e=>{const{targetId:t}=e;return t.includes("takeover")||Be(e,we)},Pe=e=>Be(e,we),$e=e=>Be(e,Ee),Le=e=>Be(e,Te),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.startsWith("widescreen"),De=e=>e.width>=1260&&e.width<=1280,Me=e=>e.width>=1600&&e.width<=1620,Be=(e,t)=>{const n=Ie[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=e=>e.includes("snoap.no"),Fe=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)},Ve=(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()},Ue=Ve([],()=>{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}),He=e=>{const t=Ve([],()=>{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},ze=[],We={},Ke=(e,t)=>{e.forEach(({target:e,isIntersecting:n})=>{const i=Ge(e);n?(Je(i,n),Ye(e,i,t)):(Je(i,n),Qe(e,i,t))})},Je=(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}`,"*")},Ge=e=>{var t;return null===(t=e.children[0])||void 0===t?void 0:t.id},Ye=(e,t,n)=>{e.classList.add("in-screen"),document.body.classList.add("fullscreen-scroll-in-screen"),window.dispatchEvent(new CustomEvent("advertory:fullscreenScrollInView")),ze.includes(t)||ze.push(t),n&&window.addEventListener("scroll",We[t],{passive:!0})},Qe=(e,t,n)=>{ze.includes(t)&&(n&&window.removeEventListener("scroll",We[t]),document.body.classList.remove("fullscreen-scroll-in-screen"),e.classList.remove("in-screen"),window.dispatchEvent(new CustomEvent("advertory:fullscreenScrollNotInView")))},Xe=(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&&Ze(e,r,o,0),s.length&&Ze(e,s,o,40)}},Ze=(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()})},et={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 tt=null;const nt=(e,t)=>{let n=e;return n=(e=>{const t=document.createElement("script");return t.textContent="\n {\n const frame = window.frameElement;\n \n if (frame) {\n frame.contentWindow.document.body.onload = onLoad;\n } else {\n document.body.onload = onLoad;\n }\n \n function onLoad() {\n window.addEventListener('message', function(event) {\n if (event.data === 'advertory:showFullscreen-'+document.body.id) {\n document.body.style.display= \"block\";\n } else if (event.data === 'advertory:hideFullscreen-'+document.body.id) {\n document.body.style.display= \"none\";\n }\n });\n }\n }\n ",e+t.outerHTML})(e),n=(e=>{const t=document.createElement("script");return t.textContent=`(${Ue})()`,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(Re(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=He(n)),(e=>e.includes("de17a"))(n)&&(n=(e=>Re(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)),Re(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)),Fe(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},it=()=>{tt=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`)},ot=()=>{tt||(tt=window.requestAnimationFrame(it))},rt=(e,t)=>{var n,i,o,r;const{country:s}=l.get(),{targetId:a}=e;document.documentElement.style.setProperty("--advertory-ios-safe-area-top-fix",null!==(n=null==t?void 0:t.iosSafeAreaTopFix)&&void 0!==n?n:"0px"),(e=>{const{articlesContainerWidth:t=1302,backgroundColor:n="#fff",foregroundColor:i="#fff",margin: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),c=null==d?void 0:d.parentElement;if(!d||!c)return;((e,t)=>{const n=(null==t?void 0:t.fadingHeaderEnabled)||!1,i=new IntersectionObserver(e=>Ke(e,n),{}),o=Ge(e);i.observe(e),n&&(We[o]=Xe(e,t))})(c,t),d.className="advertory-fullscreen-scroll";const u=Be(e,he)?"absolute":"fixed";d.style.position=u,c.className="advertory-fullscreen-scroll-wrapper",c.dataset.showTagSubscribeId=a,d.setAttribute("data-ad-label",et[s].adText),(null==t?void 0:t.moveCogwheelToTheLeft)&&(d.dataset.moveCogwheelToTheLeft="true"),ot(),window.addEventListener("resize",ot),null===(o=window.visualViewport)||void 0===o||o.addEventListener("resize",ot),null===(r=window.visualViewport)||void 0===r||r.addEventListener("scroll",ot)},st=({targetId:e})=>{const t=(e=>{const{requests:t}=window.apntag,n=Fe(e)?1:0;return null==t?void 0:t.tags[e].adResponse.ads[n].rtb.banner.content})(e);if(!t)return;((e,t)=>{const{requests:n}=window.apntag,i=Fe(e)?1:0;n&&(n.tags[e].adResponse.ads[i].rtb.banner.content=t)})(e,nt(t,e))},at=()=>e(void 0,void 0,void 0,function*(){const{prebid:e,tcf:t,country:n,isMobileApp:i,fullscreenScroll:o}=l.get();if(!(null==e?void 0:e.enabled))return;const{initNativeAd:r}=l.getHandlers(),{getConsentAsync:s}=I(t,i,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=ue(),{prebid:{relevantCbTimeout:r}={}}=l.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}}})(),c=ue(),v=(()=>{const{requests:{user:e={userIds:[]},keywords:t={}}={}}=ue();return{user:e,keywords:t}})();d.failsafeOnTimeout("relevantCb");const{user:{externalUid:p=""}={},keywords:g}=v;(()=>{const e=ve();return e.cmd||(e.cmd=[]),e.cmd})().push(()=>{if(d.getCancel()||!c.loadTags)return u("core loadTags() call was cancelled",{cancel:d.getCancel(),apnTagLoadTags:!c.loadTags,condition:"or"}),void d.cleanup();const t=ve();d.events.relevantCb.done=!0,d.failsafeOnTimeout("auctionCb");const i=a?{gdpr:{cmpApi:"iab",timeout:8e3}}:{cmpApi:"none"};u("prebid consentManagement",i),t.addPrebidConfig(Object.assign(Object.assign({consentManagement:i,enableSendAllBids:!1},G(n)),pe(g,p))),u("core add prebid config",Object.assign(Object.assign({consentManagement:i,enableSendAllBids:!1},G(n)),pe(g,p))),t.loadPrebid({configId:e.id,manageAdserver:!1,collapseEmptyDivs:!1,collapseBeforeAdFetch:!1,noGpt:!0,noSlotReload:!0,loadUnknownSlots:!0,apntagCalls:{showTag:()=>{},loadTags:e=>{d.getCancel()||(d.events.auctionCb.done=!0,c.loadTags(e)),d.cleanup()}},customNativeRender:e=>{dt(e,r)},directRenderFn:e=>{const{settings:t,renderFn:n}=e,{bid:i,adDiv:r}=t||{};if(!r)return;const s=n(t),a=Object.assign(Object.assign({},i),{targetId:r.id,banner:!0});Ae(a)&&(rt(a,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()})(s))}}),u("core load prebid",{configId:e.id,manageAdserver:!1,collapseEmptyDivs:!1,collapseBeforeAdFetch:!1,noGpt:!0,noSlotReload:!0,loadUnknownSlots:!0,apntagCalls:{showTag:()=>{},loadTags:e=>{d.getCancel()||(d.events.auctionCb.done=!0,c.loadTags(e))}},customNativeRender:e=>{dt(e,r)},directRenderFn:()=>{}})})}),dt=(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},l.get()),null==d||d.postMessage(JSON.stringify({message:"Prebid Response",ad:"\x3c!-- nothing --\x3e",adId:r.adId}),"*")},lt="0123456789abcdefghijklmnopqrstuvwxyz",ct=e=>{window.apntag.anq.push(e)},ut=new Promise(e=>{"undefined"!=typeof document&&document.prerendering?document.addEventListener("prerenderingchange",()=>e()):e()}),vt=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})}),pt=e=>{const t=e.split("-"),n=t[t.length-1];return 6===n.length&&n.match(/^[a-zA-Z0-9]+$/)?t.slice(0,-1).join("-"):e};let gt="";const ht=new Map,mt="advertory-wallpaper-background",yt="advertory-with-horseshoe",ft=()=>{const e=document.querySelector(`.${mt}`);e&&e.remove()},wt=e=>{const t=e.getBoundingClientRect().top;requestAnimationFrame(()=>(e=>{if(!document.body)return;const t=document.querySelector(`.${mt}`);t&&t.style.setProperty("top",`${e}px`)})(t+15))},bt=/^wallpaper:url:(http[s]?:\/\/)?[^\s(["<,>]*\.[^\s[",><]*/,Et=e=>{if(window.location.href.includes("collapse_ad=0"))return;const t=document.querySelector(`div[id^="${e}"]`);if(!t)return;const n=t.parentElement;n&&(t.style.setProperty("width","0","important"),t.style.setProperty("height","0","important"),t.style.setProperty("display","none","important"),n.style.setProperty("display","none","important"),e.includes("wallpaper")&&ft())},Tt=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"))},It=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`)},kt=e=>{const t=e.parentElement;if(!e||!t)return;const{container:n,wrapper:i}=(e=>{const t=ce.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},At=()=>{ft();document.querySelectorAll('[data-advertory-ad-rendered="true"]').forEach(e=>{Et(e.id),kt(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=pt(e.id)}),ct(()=>window.apntag.clearRequest())},St="noGroupedPlacements",Ct=e=>{const t=e.replace(/[0-9]/g,"");return"_"===t.slice(-1)?t.substring(0,t.length-1):t},Ot=e=>{if(!(null==e?void 0:e.minViewWidth))return!0;return window.innerWidth>=e.minViewWidth},Pt=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}=l.get(),r=n[o].filter(Ot)||[],s=e?document.querySelector(e):document;if(!s)return[];const a=r.reduce((e,t)=>{const n=Ct(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),c=Array.from(d).filter(({id:e})=>e.match(t)).map((e,t)=>{var i;const o=$t(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+=lt[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&&ce.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}=l.get();return(null==t?void 0:t.includeCountingKeywordInTags)?(gt!==window.location.pathname&&(ht.clear(),gt=window.location.pathname),e.map(e=>{var t;const n=e.invCode.replace(/_\d+$/,""),i=null!==(t=ht.get(n))&&void 0!==t?t:0;return e.keywords=Object.assign({},e.keywords),e.keywords[`${O()}-count`]=i,ht.set(n,i+1),e})):e})(c)});return(e=>{const t=Array.from(document.querySelectorAll('div[class^="advertory"]'));return e.sort((e,n)=>t.findIndex(t=>t.id===e.id)-t.findIndex(e=>e.id===n.id))})(a)},$t=(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},Lt=e=>{const{queryConfig:{placementBatches:t}={},deviceType:n}=l.get(),i=(null==t?void 0:t[n])||{},o=Object.values(i).flat(),r=(e=>{const t={};return e.forEach(e=>{const n=pt(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(pt(e.id)));return n})(e,i),a=Object.keys(r),d=((e,t)=>e.filter(e=>!t.has(pt(e.id))))(e,new Set([...a,...o]));return Object.assign(Object.assign(Object.assign({},s),r),{[St]:d})},xt=(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])}},Nt=["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(t){return e(this,void 0,void 0,function*(){var e,n,i;const o=yield this.identityFacade.getIdentityUser(),r=null!==(i=yield null===(n=null===(e=this.tracker)||void 0===e?void 0:e.getEnvironmentId)||void 0===n?void 0:n.call(e))&&void 0!==i?i:"",s=(null==o?void 0:o.userId)?String(o.userId):"",a=this.buildUrl(t,{envId:r,spid:s});try{u("Starting fetching DrEdition ad from URL:",a);const e={method:"GET"},t=yield _.get(a,e);return u("Fetch operation completed successfully."),t}catch(e){u("Error during fetch operation:",e)}return null})}}let _t=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(t,n){return e(this,void 0,void 0,function*(){const{id:e,autoplay:i,mute:o,videoLoop:r,vendor:s}=n.videoConfiguration;t.classList.add("vgtv-video-container"),Object.assign(t.dataset,{vgtvVideoId:e,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 qt=e=>{const t=e.parentElement;t?t.classList.remove("dr-edition-lock-height"):u("Dr. Edition container does not have a parent element, cannot remove height lock.")};class Dt{constructor(e,t,n,i){this.drEditionService=e,this.rendererManager=t,this.videoManager=n,this.pulseManager=i,this.drEditionAds=[]}fetchAndRenderAd(t,n){return e(this,void 0,void 0,function*(){var e,i;const{drEditionConfig:{containerSelector:o},renderAsBackfill:r=!1}=n,s=t.querySelector(o);if(!s)return void u(`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?(u("No Dr. Edition ads available to render. Collapsing whole placement."),Et(t.id),void qt(s)):((null==a?void 0:a.itemId)&&r&&(u("Dr. Edition ad available to render as a Xandr backfill."),Tt(t.id)),void(a?(a.css&&((e,t)=>{const n=document.createElement("link");n.rel="preload",n.href=e,n.as=t,document.head.appendChild(n)})(a.css,"style"),yield this.rendererManager.render(s,a,n),yield null===(e=this.videoManager)||void 0===e?void 0:e.handle(a,n),qt(s),this.drEditionAds.push(a),window.advertory=window.advertory||{},window.advertory.renderedDrEditionAds=window.advertory.renderedDrEditionAds||[],window.advertory.renderedDrEditionAds.push(a.itemId),this.observeAdView(t,a,n),null===(i=t.querySelector("a"))||void 0===i||i.addEventListener("pointerup",()=>null)):qt(s))):(u("No Dr. Edition ads available to render. Hiding Dr. Edition and rendering Xandr backfill."),this.hideDrEdition(s),this.showBackfill(t),void qt(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:"";Tt(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 Mt{constructor(e,t){this.newsroomStrategy=e,this.pulseManager=t}render(t,n,i){return e(this,void 0,void 0,function*(){if(!(null==n?void 0:n.itemId))return;const{getConsentAsync:e}=I(i.tcf,i.isMobileApp,i.country),o=yield e(),r=i.device===X.MOBILE?n.mobileHTML:n.desktopHTML;const s=o?r:r.replace(/<img [^>]*class="tracking-pixel"[^>]*>/g,"");t.innerHTML=s,t.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 Bt{constructor(e){this.strategy=e}handle(t,n){return e(this,void 0,void 0,function*(){const{videoConfiguration:{id:e,preview:i}={}}=t;(e||i)&&(yield this.importScript(n),yield this.createVideoElement(t,n))})}importScript(t){return e(this,void 0,void 0,function*(){const e=t.drEditionConfig.videoScriptUrl,n=document.querySelector(`script[src="${e}"]`);if(e&&!window.autoplayQueue&&!n)try{yield ge(e)}catch(e){u("Error! Failed to prepare SVP player script for Dr. Edition!",e)}})}createVideoElement(t,n){return e(this,void 0,void 0,function*(){const e=document.createElement("div"),{node:i}=t.videoConfiguration,o=[...document.querySelectorAll(`#${i}`)||[]].find(e=>0===e.children.length);if(this.handlePreviewVideo(t,n))return;this.strategy.handleVideo(e,t),null==o||o.appendChild(e),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 Rt=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(t,n,i){return e(this,void 0,void 0,function*(){var e,o,r,s,a,d,l,c;if(!this.pulse)return;const u=this.getEventInput(t,n,i,"view");(null===(e=this.pulse)||void 0===e?void 0:e.trackLegacyViewUIElement)?null===(r=null===(o=this.pulse)||void 0===o?void 0:o.trackLegacyViewUIElement)||void 0===r||r.call(o,u):(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,u):null===(c=null===(l=this.pulse)||void 0===l?void 0:l.trackElementView)||void 0===c||c.call(l,u)})}trackContentClick(t,n,i){return e(this,void 0,void 0,function*(){var e,o,r,s,a,d;if(!this.pulse)return;const l=this.getEventInput(t,n,i,"click");this.pulse.trackLegacyClickUIElement?null===(o=(e=this.pulse).trackLegacyClickUIElement)||void 0===o||o.call(e,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 Ft extends Rt{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 Vt=class extends Rt{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 Ut={FRONT:"front"},Ht=(e,t)=>{null==t||t.forEach(t=>{const n=window.SVP.Player.Plugins.get(t);e.addPlugin(new n)})},zt=t=>e(void 0,void 0,void 0,function*(){var e,n;return(null===(e=null===window||void 0===window?void 0:window.SVP)||void 0===e?void 0:e.Player)?new window.SVP.Player(t):((()=>{const e="svp-player-sdk",t=document.querySelector(e),n=Array.from(document.querySelectorAll('script[src^="https://cdn.stream.schibsted.media/player"]'));if(t||n.length>0)return;const i=document.createElement("script");i.id=e,i.src="https://cdn.stream.schibsted.media/player/3.78.1/player.min.js",i.async=!0;try{i.src=i.src.replace("player.min","player.next.min")}catch(e){console.error("Failed to set player.next.min source:",e)}document.head.insertBefore(i,document.head.firstChild)})(),(null===(n=window.SVP)||void 0===n?void 0:n.isLoaded)?new window.SVP.Player(t):yield new Promise(e=>{window.addEventListener("onSvpPlayerReady",()=>e(new window.SVP.Player(t)))}))}),Wt={ContentMutePlugin:e=>{window.SVP.Player.Plugins.register({getName:()=>"ContentMutePlugin",initialize(){},setup(){const t=this.player.config.get("mute");this.container=e||this.player.getContainer(),this.muted=t,t&&this.listenToOnce(this.player,"ready",this.renderButtonElement,this)},getButtonElement(){const e=document.createElement("button");e.className="player-plugin-content-mute";const t=document.createElement("span");return t.className="volume-button-icon",e.appendChild(t),e},renderButtonElement(){this.buttonElement=this.getButtonElement(),this.buttonElement.addEventListener("click",this.onButtonClick.bind(this)),this.container.appendChild(this.buttonElement),this.isVideo()||(this.buttonElement.style.display="none"),this.getJWPlayer()&&this.getJWPlayer().on("mute",this.onMuteChange,this)},onButtonClick(){this.getJWPlayer()&&(this.container.classList.add("has-interacted"),this.muted=!this.muted,this.getJWPlayer().setMute(this.muted))},onMuteChange(e){this.muted=e.mute,this.muted?this.buttonElement.classList.remove("content-video-volume-on"):this.buttonElement.classList.add("content-video-volume-on")},isVideo(){return"video"===this.player.getRawAsset().assetType},getJWPlayer(){return this.player.model.player}})},IntegrationMenu:()=>{window.SVP.Player.Plugins.register({getName:()=>"IntegrationMenu",setup(){return e(this,void 0,void 0,function*(){yield Promise.resolve().then(function(){return hr})})}})}},Kt=(e,t)=>{null==e||e.forEach(e=>{Wt[e](t)})};class Jt{handleVideo(t,n){return e(this,arguments,void 0,function*(t,{videoConfiguration:{id:n,node:i,autoplay:o,mute:r,vendor:s}}){yield e(void 0,void 0,void 0,function*(){return yield new Promise(e=>{var t;Boolean(null===(t=window.SVP)||void 0===t?void 0:t.Player)?e(!0):window.addEventListener("onSvpPlayerReady",()=>e(!0))})});const a=["ContentMutePlugin"],d=this.createPlayerOverlay(t);Kt(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 zt(l);c.once("assetReady",()=>{Ht(c,a)}),c.once("ready",()=>{const e=t;new MutationObserver(t=>{t.forEach(({type:t,attributeName:n})=>{"attributes"===t&&"class"===n&&(e.classList.contains("jw-state-playing")?d.classList.add("is-playing"):d.classList.remove("is-playing"),e.classList.contains("jw-flag-user-inactive")?d.classList.add("is-inactive"):d.classList.remove("is-inactive"))})}).observe(e,{attributes:!0,attributeFilter:["class"]})}),c.once("PulseStats:ready",()=>e(this,void 0,void 0,function*(){const e=yield c.getPlugin("PulseStats").getTracker();null==e||e.update({provider:{id:"e24",productTag:"partnerstudio"}})}))})}getPulseObjectId(){return"sdrn:e24:content:partnerstudio:element:partnerstudio:stats"}getPulsePageId(e,t){return e===Ut.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 Gt="https://www.aftonbladet.se/video-player-extras/latest/";class Yt{handleVideo(t,n){return e(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:{[`${Gt}cta-button.js`]:{name:"CtaButton",options:{type:"unmute"}},[`${Gt}external-link.js`]:{name:"ExternalLink"}}};yield zt(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 Qt=e=>null!==e&&"object"==typeof e&&!Array.isArray(e);class Xt{handleVideo(t,n){return e(this,arguments,void 0,function*(t,{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({},Qt(e)?e:{}),{provider:Object.assign(Object.assign({},Qt(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 zt(a);d.once("PulseStats:ready",()=>e(this,void 0,void 0,function*(){const e=yield d.getPlugin("PulseStats").getTracker();null==e||e.update({provider:{id:"svdse",productTag:"partnerstudio"}})}))})}getPulseObjectId(){return"sdrn:svdse:content:partnerstudio:element:partnerstudio:stats"}getPulsePageId(e,t){return e===Ut.FRONT?"sdrn:svdse:frontpage:front":`sdrn:svdse:article:${t}`}}let Zt=class{handleVideo(e,t){}getPulseObjectId(){return""}getPulsePageId(e,t){return""}};const en=(e,t,n)=>{var i;const{publisher:o,pageType:r,country:s}=e,a={[se.VG]:new _t,[se.E24]:new Jt,[se.AFTONBLADET]:new Yt,[se.SVD]:new Xt}[o]||new Zt,d=new(s===w.SE?Ft:Vt)(n,a,r),l=new jt(t,null!==(i=null==n?void 0:n.pulseTracker)&&void 0!==i?i:n),c=new Mt(a,d),u=new Bt(a);return new Dt(l,c,u,d)},tn=()=>e(void 0,void 0,void 0,function*(){return yield new Promise(e=>{if("undefined"!=typeof window)if(window.Identity)e(window.Identity);else{const t=()=>{e(window.Identity)};window.addEventListener("identity-initialized",t,{once:!0})}else e(void 0)})});class nn{constructor(e){this.identity=e,this.getIdentityUser=this.getIdentityUser.bind(this),this.isUserLoggedIn=this.isUserLoggedIn.bind(this),this.onIdentityLogout=this.onIdentityLogout.bind(this)}getIdentityUser(){return e(this,void 0,void 0,function*(){var e;try{const t=yield null===(e=this.identity)||void 0===e?void 0:e.getUser();return null!=t?t:null}catch(e){return u("[Privacy Broker] User is not logged in."),null}})}isUserLoggedIn(){return e(this,void 0,void 0,function*(){var e,t;return null!==(t=yield null===(e=this.identity)||void 0===e?void 0:e.isLoggedIn())&&void 0!==t&&t})}onIdentityLogout(e){var t;null===(t=this.identity)||void 0===t||t.on("logout",e)}}const on=(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=en(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))},rn=[],sn=(t,n)=>e(void 0,void 0,void 0,function*(){var e;const{pulse:i,tcf:o,deviceType:r,drEdition:s,publisher:a,pageType:d,country:l,isMobileApp:c}=t;if(!(yield k(o,c,l,"handleDrEditionBackfill")))return;const v=((e,t)=>{var n;const{deviceType:i,placements:o,drEdition:{fallbackGlobalEditionName:r}={}}=e,s=o[i]||o.desktop,a=pt(t.targetId),d=s.find(e=>e.id===a),l=Nt.some(e=>a.startsWith(e)),c=rn.includes(a),u=(null===(n=null==d?void 0:d.drEdition)||void 0===n?void 0:n.editionName)||r;return d&&l&&!c&&u?(rn.push(a),Object.assign(Object.assign({},d),{drEdition:Object.assign(Object.assign({},d.drEdition),{editionName:u})})):null})(t,n);if(!v)return;if(!(null==i?void 0:i.instance))return void u("Pulse has not been passed as a prop, aborting");const p=yield tn(),g=new nn(p),h=en({publisher:a,pageType:d,country:l},g,null==i?void 0:i.instance),m=document.getElementById(n.targetId);if(!m||!s)return;m.classList.value="";const y=document.createElement("div");y.className=s.containerSelector.replace(/^[.#:[\]]+/,""),m.innerHTML=y.outerHTML;const f={editionName:(null===(e=null==v?void 0:v.drEdition)||void 0===e?void 0:e.editionName)||"",drEditionConfig:s,device:r,tcf:o,isMobileApp:c,country:l,renderAsBackfill:!0};yield h.fetchAndRenderAd(m,f)}),an="collapseAd",dn="hideAd",ln="resizeAd",cn="renderDrEditionFallback",un="wallpaperImageUrl",vn="wallpaperColor",pn="velvet",gn=[ln,un,vn,an,dn,cn,pn];let hn;const mn=e=>{if("object"==typeof e)return e;if(t=e,bt.test(t)){const t=e.replace(/^wallpaper:url:/,"");return{name:un,wallpaperImageUrl:t}}var t;if((e=>e.startsWith("wallpaper:color:"))(e)){const t=e.replace(/^wallpaper:color:/,"");return{name:vn,wallpaperColor:t}}if(e.startsWith(cn)){const t=e.split(":")[1];return{name:cn,targetId:t}}if(e.startsWith(an)||e.startsWith(dn)){const t=e.split(":")[1];return{name:an,targetId:t}}if(e.includes("name")&&gn.some(t=>e.includes(t)))try{return JSON.parse(e)}catch(e){}},yn=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=mn(t);if(!n)return;if(!n.name||!gn.some(e=>n.name===e))return;const{name:i,targetId:o,wallpaperImageUrl:r,wallpaperColor:s,cmd:a,size:d}=n;i===pn&&a&&(a.includes("noScroll")&&(hn=(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==hn||hn(),dispatchEvent(new CustomEvent("advertory:closeTakeover",{})))),i!==an&&i!==dn||!o||Et(o),i===ln&&o&&a&&xt(o,a),i===cn&&o&&(Et(o),sn(l.get(),{targetId:o})),"resizeMediationAd"===i&&o&&d&&xt(o,d,!0),i===un&&r&&(e=>{const t=document.querySelector(`.${mt}`);t&&(t.style.backgroundImage=`url(${e})`)})(r),i===vn&&s&&(e=>{const t=document.querySelector(`.${mt}`);t&&(t.style.backgroundColor=e)})(s)},fn=e=>({rootMargin:`${e}px 0px ${e}px 0px`}),wn=()=>{const{publisher:t,country:n,finnBlink:i}=l.get(),{loadFinnBlinkAd:o,wallpaperHandlers:{adjustAdToHorseshoe:r}}=l.getHandlers(),s=window.apntag,a={publisher:t,country:n,finnBlink:i},d=e=>{Tt(e),ct(()=>s.showTag(e))};return{withXandrAd:d,withFinnBlinkAd:t=>e(void 0,void 0,void 0,function*(){yield o(t,a,null)}),withFullAdsChain:t=>e(void 0,void 0,void 0,function*(){yield o(t,a,d,()=>{ce.getData("horseshoe").isAvailable&&r(t)})})}},bn=(e,t,n)=>{const i="true"===n.dataset.isFinnBlinkOnlyPlacement;return Ne(t)&&i?(u(`loading finn blink ad for blink only placement for ${t}`),void wn().withFinnBlinkAd(t)):Ne(t)?(u(`loading finn blink ad with full ads chain for ${t}`),void wn().withFullAdsChain(t)):void ct(()=>(u("core showTag",{id:t}),e.showTag(t)))},En=(t,n)=>e(void 0,void 0,void 0,function*(){yield ut,yield vt;const e=new IntersectionObserver((e,n)=>((e,t,n,i)=>{e.filter(({isIntersecting:e,target:{id:t}})=>e&&!t.includes("wallpaper")).forEach(e=>{const{target:o}=e,r=(e=>{const t=e.dataset.showTagSubscribeId;return!e.id.length&&t?t:e.id})(o),s=document.getElementById(r);u("core log from intersection observer handler",{targetId:r,element:s}),n(window.apntag,r,i),s&&(t.unobserve(s),t.disconnect())})})(e,n,bn,t),fn(n));e.observe(t)}),Tn=new Map,In=["no-stavangeraftenblad","sa","no-aftenposten","aftenposten","no-bergenstidende","bt"],kn=".brandstudio-premium-content-widget",An=({adWrapper:e,placementContainer:t})=>t.offsetHeight+(({adWrapper:e})=>{const{paddingTop:t,paddingBottom:n}=getComputedStyle(e);return parseFloat(t)+parseFloat(n)})({adWrapper:e}),Sn=({adWrapper:e,placementContainer:t})=>{const n=An({adWrapper:e,placementContainer:t});var i;null==e||e.style.setProperty("height",`${n}px`),kt(i=t),i.innerHTML=""},Cn=e=>{e&&e.style.getPropertyValue("height")&&e.style.removeProperty("height")},On=({adWrapper:e,placementContainer:t})=>{const{publisher:n}=l.get(),i=In.includes(n)&&Boolean(t.closest(kn));const o=i?t.closest(kn):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 Cn(e),void r.disconnect();const a=t.closest('[style*="height"]'),d=o;a&&d.contains(a)?Cn(a):d.hasAttribute("style")&&Cn(d),r.disconnect()})})});try{r.observe(t,{childList:!0,subtree:!0})}catch(e){r.disconnect()}},Pn=(e,t,n,i,o,r)=>{var s;const a=performance.now(),d=null!==(s=Tn.get(t))&&void 0!==s?s:0,l=((e,t)=>!!t&&e+t<(new Date).getTime())(i,o)&&n<0;a-d>=o&&l&&(Tn.set(t,a),((e,t,n)=>{const i=null==n?void 0:n.parentElement;i&&n&&Sn({adWrapper:i,placementContainer:n}),ct(()=>{e.setKeywords([t],{[`${C()}-adreload`]:"1"},{overrideKeyValue:!0}),e.refresh([t])})})(e,t,r))},$n=(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,Pn,t,n),fn(300));i.observe(e)},Ln=(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},xn=()=>navigator&&navigator.userAgent.match(/chrome/i)?null:navigator&&navigator.userAgent.match(/apple/i),Nn=(e,t=0)=>{const n=e.getBoundingClientRect(),i=window.innerHeight;return n.bottom>-t&&n.top<i+t},jn=e=>{const{refreshConfig:{visibilityStateRefreshEnabled:t=!1}={}}=l.get();if(!t)return;const n=()=>{"visible"===document.visibilityState&&document.removeEventListener("visibilitychange",n),Bn(e)};"visible"!==document.visibilityState&&document.addEventListener("visibilitychange",n)},_n=(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;Nn(o,r)&&i&&(It(i.id),n.length&&o.classList.remove(...n),Bn([i],t))}},qn=e=>{const{refreshConfig:{backForwardNavigationRefreshEnabled:t=!1}={},siteSpecificConfig:{classesToRemoveOnRefresh:n=[]}={},isMobileApp:i}=l.get();t&&(e.forEach(({id:e})=>{const t=Dn(e);t&&(t.dataset.bfCacheRefresh="true")}),i?((e,t)=>{document.addEventListener("visibilitychange",()=>{_n(e,!0,t)})})(e,n):((e,t)=>{window.addEventListener("pageshow",n=>{const i=()=>{window.scrollY>0&&(window.removeEventListener("scroll",i),_n(e,!1,t))};n.persisted&&(xn()?window.addEventListener("scroll",i,{passive:!0}):_n(e,!1,t))})})(e,n))},Dn=e=>{var t,n;return null!==(n=null===(t=document.querySelector(`#${e}`))||void 0===t?void 0:t.parentElement)&&void 0!==n?n:null},Mn=e=>{const{id:t,allowedFormats:n}=e,i=(e=>{if(!e)return[];try{return JSON.parse(e.dataset.adSizes||"[]")}catch(e){return[]}})(Dn(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},Bn=(e,t=!1)=>{const{requestSize:n=a}=l.get(),i=e.map(({id:e})=>e),o=Ln(i,n);if(t)for(const t of e){const e=Mn(t);window.apntag.modifyTag(t.id,e)}for(const e of o)ct(()=>window.apntag.refresh(e))};const Rn="#fff",Fn="#0098da",Vn="splash",Un="welcomePage",Hn="topscroller",zn="velvet",Wn="takeover-displayed",Kn="takeover-visit-count",Jn=14400,Gn=()=>{const e=Y(Kn);return e?parseInt(e):0},Yn=()=>{const{takeover:{enabled:e=!1,secondVisitEnabled:t=!1}={}}=l.get();return!window.location.href.includes("takeover=0")&&(!!window.location.href.includes("takeover=1")||!(!e||(()=>{var e;const t=(null===(e=l.get().takeover)||void 0===e?void 0:e.cookieCapName)||Wn;return"true"===Y(t)})())&&(!t||Qn()))},Qn=()=>{const e=Gn();return 0===e?((()=>{const e=Gn(),{takeover:{cookieCapTime:t=Jn}={}}=l.get(),n=document.location.hostname;window.document.cookie=`${Kn}=${e+1}; max-age=${t}; domain=${n}; path=/`})(),!1):1===e},Xn=(e,t)=>[[1,1],[1920,1080]].some(([n,i])=>n===e&&i===t),Zn=()=>{const{takeover:e}=l.get();return Boolean(null==e?void 0:e.topscroller)},ei=()=>e(void 0,void 0,void 0,function*(){const e=document.location.hostname,{takeover:{cookieCapName:t=Wn,cookieCapTime:n=Jn}={},isMobileApp:i,tcf:o,country:r}=l.get(),s=yield k(o,i,r,"ad-takeover-cookiecap");n&&s&&(window.document.cookie=`${t}=true; max-age=${n}; domain=${e}; path=/`)}),ti=e=>{var t;const n=!!(null===(t=l.get().takeover)||void 0===t?void 0:t.setCookieCapForNotShownAd);return Oe(e)&&n},ni=(e,t)=>{var n;if(t===Hn){const{topscroller:t}=e;return null!=t?t:{}}if(t===Vn){const{splash:t}=e;return null!=t?t:{}}return null!==(n=e.welcomePage)&&void 0!==n?n:{}},ii=(e,t)=>{t!==Vn?(e=>{var t,n,i;const o=null===(n=null===(t=l.get().takeover)||void 0===t?void 0:t.welcomePage)||void 0===n?void 0:n.headerElementSelector,r=null===(i=l.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}`),c=document.querySelector(".advertory-welcome-page-scroll");if(!(s&&a&&c&&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"),c.style.setProperty("bottom",p,"important")})(e):(e=>{var t;if(!(null===(t=l.get().takeover)||void 0===t?void 0:t.splash))return;const n=document.querySelector(".advertory-splash-navbar-wrapper"),i=document.querySelector(`#${e.targetId}`);if(!n||!i)return;const o=`calc(100svh - ${n.offsetHeight}px)`;i.style.setProperty("height",o,"important")})(e)},oi=Ve([],()=>{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})}),ri=(e,t=!0)=>{(e===Un||e===Hn)&&(e=>{e?setTimeout(()=>window.scrollTo(0,0),100):window.scrollTo(0,10)})(t)},si=()=>{const e=parseInt(document.body.dataset.scrollY||"0",10);document.body.style.top="",window.scrollTo(0,e),document.body.classList.remove("page-locked")},ai=e=>{document.body.style.overflow=e?"initial":"hidden"},di=e=>{const t=ci(e),n=li(e);(e=>{e.classList.toggle("takeover-ad-hidden",!0)})(e),ai(!0),e.style.display="none",window.removeEventListener("keydown",t),window.removeEventListener("advertory:closeTakeover",n)},li=e=>{const t=()=>di(e);return window.addEventListener("advertory:closeTakeover",t),si(),t},ci=e=>{const t=t=>{["Enter","Escape"].includes(t.key)&&di(e)};return si(),window.addEventListener("keydown",t),t},ui=e=>{const t=e.querySelector(".advertory-splash-navbar-wrapper");t&&(ci(e),li(e),si(),t.addEventListener("click",()=>{di(e)}),ai(!1))},vi=e=>{(e=>{window.addEventListener("scroll",()=>{e.getBoundingClientRect().bottom,(e=>{const t=e.getBoundingClientRect().bottom;e.style.opacity=""+t/e.offsetHeight})(e)},{passive:!0})})(e),li(e);const t=document.querySelector("header");document.querySelectorAll(".smooth-close-takeover").forEach(e=>e.addEventListener("click",()=>null==t?void 0:t.scrollIntoView({behavior:"smooth"})))},pi=e=>{(e=>{window.addEventListener("advertory:closeTakeover",()=>di(e))})(e)},gi=e=>{const{takeover:{splash:{showAnnonsLabel:t=!1}={}}={}}=l.get(),n=e.querySelectorAll(".advertory-splash-navbar-wrapper"),i=document.querySelector(".advertory-takeover-label");Array.from(n).forEach(e=>e.style.display="flex"),t&&i&&(i.style.display="flex",i.innerText=et.se.adText),e.classList.toggle("advertory-splash-wrapper",!0)},hi=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=et.no.adText,n.classList.add("takeover-topscroller-label"),e.classList.toggle("topscroller-wrapper",!0))},mi=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=et.se.adText,e.classList.toggle("welcome-page-wrapper",!0))},yi=e=>{const t=document.querySelector(".advertory-takeover-label");t&&(t.style.display="flex",t.innerText=et.se.adText,e.classList.toggle("advertory-impact-wrapper",!0))},fi=()=>{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)},wi=(e,t)=>{let n=e;return e.includes("529299503")&&(n=(e=>{const t=document.createElement("script");return t.textContent=`(${oi})()`,e+t.outerHTML})(e)),n},bi=e=>{const t=(e=>{const{requests:t}=window.apntag,n=Fe(e)?1:0;return null==t?void 0:t.tags[e].adResponse.ads[n].rtb.banner.content})(e);if(!t)return;((e,t)=>{const{requests:n}=window.apntag,i=Fe(e)?1:0;n&&(n.tags[e].adResponse.ads[i].rtb.banner.content=t)})(e,wi(t))},Ei=t=>e(void 0,void 0,void 0,function*(){const{takeover:e}=l.get(),{targetId:n}=t,i=document.querySelector(`#${n}`),o=document.querySelector(".advertory-takeover-wrapper");if(!i||!o||!e)return;const r=(e=>{const{width:t,height:n}=e;return Xn(t,n)?Vn:Be(e,be)?zn:Zn()?Hn:Un})(t),s=o.offsetHeight,a=window.scrollY>s;o.style.display="block",!a&&ri(r,!1),((e,t)=>{({[Un]:mi,[Vn]:gi,[Hn]:hi,[zn]:yi})[t](e)})(o,r),fi(),((e,t)=>{({[Un]:vi,[Hn]:vi,[Vn]:ui,[zn]:pi})[t](e)})(o,r),((e,t,n)=>{if(!n)return;({[Un]:()=>{const{buttonLabel:i}=ni(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:"")})},[Vn]:()=>{const{themeColors:i,logotype:o,buttonLabel:r,showArrowIcon:s}=ni(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:Rn,"important"),n.style.color=null!=t?t:Fn}}})},[Hn]:()=>{const{buttonLabel:i,showArrowIcon:o,showCloseButton:r=!0}=ni(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:""))})},[zn]:()=>{}})[t]()})(o,r,e),yield ei(),!a&&ri(r,!0),ii(t,r)}),Ti="advertory-brandmetrics-survey",Ii=()=>e(void 0,void 0,void 0,function*(){const{norstat:{enabled:t}={},country:n,isMobileApp:i,tcf:o}=l.get(),r=yield k(o,i,n,"norstat");if(!t||i||!r)return;const s=(e=>{const{ppid1:t,ppid2:n}=z.getPPIDs(),{ppid1:i,ppid2:o}=W.getPPIDs(),r=(new H).add(n,D[e]).add(t,M[e]).add(o,B[e]).add(i,R[e]);return`${r.buildNorstatPath()}?${r.buildNorstatQuery("alias").toString()}`})(n);((t,n,...i)=>{e(void 0,[t,n,...i],void 0,function*(e,t,n=!0){if(document.getElementById(t))return;const i=document.createElement("img");i.src=e,i.id=null!=t?t:"",n&&(i.style.display="none"),document.body.appendChild(i)})})(`https://sch-map.norstatsurveys.com/api/nids/${n===w.NO?"schibsted":"schibstedse"}/map/${s}`,"norstat")}),ki={nativeAd:e=>Se(e)&&!xe(e),buyrecipe:e=>e.targetId.startsWith("buyrecipe"),fullwidthAd:Ce,fullscreenScroll:Ae,topscroller:e=>Oe(e)&&Zn(),splash:e=>Oe(e)&&Xn(e.width,e.height),welcomePage:Oe,wallpaper:$e,skyscraper:e=>e.targetId.includes("skyscraper")&&!!e.banner,lFormat:De,hFormat:Me,toppanorama:e=>e.targetId.startsWith("toppanorama")&&!Me(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},Ai=({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(ki))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)},Si=e=>{var t;return(null===(t=Object.entries(ki).find(([,t])=>t(e)))||void 0===t?void 0:t[0])||""},Ci=(e,t)=>{const n=e.width,i=(null!=t?t:window.screen.width)/n;return i<1?i:1},Oi=new Map;Oi.set("insider",{scale:.82,transformOrigin:"left center",cogwheelAdjust:!0}),Oi.set("panorama",{scale:.79,transformOrigin:"center center"}),Oi.set("outstream",{scale:.79,transformOrigin:"center center"}),Oi.set("integration",{scale:.79,transformOrigin:"center center"}),Oi.set("toppanorama",{scale:.8,transformOrigin:"left center"});const Pi=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=Si(e),o=Oi.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")},$i=(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,Li=e=>`externalImpId:'${e}'`,xi=e=>{var t;const{forwardExternalImpId:n=!1,tracker:i}=l.get(),o=(e=>{var t;if(!e.positionConfig)return e;const n=e.keywords[`${O()}-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:c,ssa:v=!1,nativeCustomProperties:p,safeframeConfig:g,dynamicSizeWidthCheck:h=!1}=(e=>{var t;if(!e.takeoverCookieCapForSharedPlacement||Yn())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!==Hn),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:c,sizes:s,targetId:r,keywords:$i(a,v),allowedFormats:d,dynamicSizeWidthCheck:h},g&&{safeframeConfig:g}),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)?(u("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):(u("Tracker state does not contain field pageViewId or it is empty"),""):(u("Tracker state is empty"),""):(u("Tracker is not configured in initAdvertory function"),"")})(i);n&&y&&(u("External Impression ID assigned to defineTag:",Li(y)),m.externalImpId=Li(y));const f=(e=>Object.entries({video:{required:!1},address:{required:!1},saleprice:{required:!1},rating:{required:!1},price:{required:!1},phone:{required:!1},likes:{required:!1},downloads:{required:!1},customIcon2:{required:!1}}).reduce((t,[n,i])=>((null==e?void 0:e.includes(n))&&(t[n]=i),t),{customTitle1:{required:!1},customTitle2:{required:!1},customTitle3:{required:!1},customTitle4:{required:!1},title:{required:!1},body:{required:!1},image:{required:!1},icon:{required:!1},sponsoredBy:{required:!1},cta:{required:!1},clickUrl:{required:!1},desc2:{required:!1},displayUrl:{required:!1},description:{required:!1}}))(p);return(null===(t=e.allowedFormats)||void 0===t?void 0:t.includes("native"))&&(m.native=f),m},Ni=e=>!e.includes("takeover")||Yn(),ji=e=>{const{source:t}=e;return"csm"===t},_i=(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},qi="finn-blink",Di="native-ad",Mi=e=>{const{publisher:t=""}=l.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`)},Bi=e=>{if(!e)return e;const t=e[`${C()}-targetid`],n=t?pt(t[0]):"";return Object.assign(Object.assign({},e),t&&{[`${C()}-targetid`]:[n]})},Ri=e=>Object.assign(Object.assign(Object.assign(Object.assign({},e),e[`${C()}-geo`]&&{[`${C()}-geo`]:["geo-test-value"]}),e[`${C()}-geofence`]&&{[`${C()}-geofence`]:["geofence-test-value"]}),e[`${C()}-weather`]&&{[`${C()}-weather`]:["weather-test-value"]}),Fi=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"})})()},Vi=(t,n)=>e(void 0,void 0,void 0,function*(){return yield new Promise(e=>{t().then(t=>{e(null!=t?t:null)}).catch(t=>{e(null)})})}),Ui=()=>e(void 0,void 0,void 0,function*(){try{(()=>{const e=document.createElement("script");e.setAttribute("src","https://ads.inventory.schibsted.io/ad-service/ad-banner-sponsor-advertisement/ad.js"),e.setAttribute("type","text/javascript"),e.setAttribute("async","true"),document.head.appendChild(e)})(),(()=>{const e=document.createElement("div");e.setAttribute("id","ads-advertory-anchor"),e.classList.add("subscribe_box"),e.classList.add("ad-box"),e.classList.add("leftAd"),e.classList.add("netboard"),e.classList.add("advert"),e.classList.add("module"),e.classList.add("banner"),e.classList.add("leaderboard"),e.classList.add("adsbygoogle"),e.classList.add("ad-banner"),e.classList.add("ad-container"),e.classList.add("adsbox"),e.classList.add("sidebar-ads"),e.classList.add("banner-ads"),e.style.opacity="0",e.style.width="1px",e.style.height="1px",e.style.minWidth="0px",e.style.minHeight="0px",e.style.maxWidth="1px",e.style.maxHeight="1px",e.style.position="absolute",e.style.top="0",e.style.boxSizing="border-box",e.style.margin="0",e.style.padding="0",document.body.appendChild(e)})()}catch(e){console.error("Error running adblock scripts:",e)}}),Hi={arrayMerge:(e,t)=>t},zi=t=>e(void 0,void 0,void 0,function*(){if(!(e=>{const{editableConfiguration:{useS3Config:t=!1,pageTypeToFetch:n}={},siteSpecificConfig:i}=e;return Boolean(t&&n&&(null==i?void 0:i.publisherClassName))})(t))return t;try{const n=yield(t=>e(void 0,void 0,void 0,function*(){const e=(e=>{const{siteSpecificConfig:t,editableConfiguration:{pageTypeToFetch:n}={}}=e;return(null==t?void 0:t.publisherClassName)&&n?`https://alertory-cdn.staging.inventory.schibsted.io/editable-configurations/${t.publisherClassName}/${n.toUpperCase()}.json`:null})(t);if(!e)return null;const n=new AbortController,i=setTimeout(()=>n.abort(),5e3);try{return yield _.get(e,{method:"GET",signal:n.signal})}catch(t){throw u("Failed to fetch S3 config",{error:t,url:e}),t}finally{clearTimeout(i)}}))(t);return n?(({siteConfig:e,configOverrides:t})=>{var n;const{keywords:i,refresh:r,placements:s,threshold:a,batchSize:d}=t,l=o.all([e.placements,s],Hi),c=o(e.pageOptions,{keywords:i},Hi),u=o(e.appearanceConfig,{defaultThreshold:a},Hi),v=o(null!==(n=e.refreshConfig)&&void 0!==n?n:{},{scrollRefreshEnabled:r},Hi);return Object.assign(Object.assign({},e),{placements:l,requestSize:null!=d?d:e.requestSize,pageOptions:c,appearanceConfig:u,refreshConfig:v})})({siteConfig:t,configOverrides:n}):t}catch(e){return u("Error fetching S3 config, using site config",{error:e}),t}}),Wi=".advertory-right-column-track",Ki="--advertory-right-column-track-height",Ji=e=>e.getBoundingClientRect().top+window.scrollY,Gi=e=>{const{marginTop:t,marginBottom:n}=getComputedStyle(e);return e.getBoundingClientRect().height+parseFloat(t||"0")+parseFloat(n||"0")},Yi=(e,t)=>{const n=(i=t,`${Math.max(0,Math.round(i))}px`);var i;document.body.style.setProperty(e,n)},Qi=(e,t)=>`${e}-${t}`,Xi=(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=Ji(e);(()=>{const e=document.querySelector("header");if(!e)return;const t=Gi(e);Yi("--advertory-newsroom-header-height",t)})(),r.forEach(({point:e,originalIndex:t})=>{((e,t,n)=>{const i=Ji(e),o=Qi(Ki,t),r=i-n,s=Qi("--advertory-right-column-split-point-height",t),a=Gi(e);Yi(o,r),Yi(s,a)})(e,t+1,s),(e=>{const t=null==e?void 0:e.id;if(!t)return;const n=Qi("--advertory-right-column-ad-height",t),i=Gi(e);Yi(n,i)})(o[t])});((e,t)=>{const n=Ji(e);Yi(Ki,n-t)})(r[Math.min(o.length,r.length-1)].point,s)};let Zi=!1;class eo{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 to{getPulseObjectId(){return""}getPulsePageId(e,t){return""}}class no{constructor(e,t){this.pulse=e,this.newsroomStrategy=t}getEventInput(e,t){return{}}parseKilkayaData(e){const t=e.querySelector("article");if(!t)return{};const n=t.dataset.k5aTeaserAnalytics;try{return n?JSON.parse(n):{}}catch(e){return{}}}mapPageType(e){return{front:"Frontpage",article:"Article",section:"Article",collection:"Article",other:"Article"}[e||"front"]||"Frontpage"}getArticleId(){return location.pathname.split("/").slice(-2,-1).pop()||""}getEventTarget(e){const{url:t,title:n,itemId:i}=this.parseKilkayaData(e);return{id:i,name:this.normalizePlacementTitle(null!=n?n:""),type:"Page",url:t}}normalizePlacementTitle(e){return e.replace(/<[^>]+>/gi,"").replace(/[^a-z0-9æøå\s_-]/gi,"")}trackContentView(t){return e(this,void 0,void 0,function*(){var e,n,i,o,r,s,a,d;if(!this.pulse)return;const l=this.getEventInput(t,"view");(null===(e=this.pulse)||void 0===e?void 0:e.trackLegacyViewUIElement)?null===(i=null===(n=this.pulse)||void 0===n?void 0:n.trackLegacyViewUIElement)||void 0===i||i.call(n,l):(null===(o=this.pulse)||void 0===o?void 0:o.trackViewUIElement)?null===(s=null===(r=this.pulse)||void 0===r?void 0:r.trackViewUIElement)||void 0===s||s.call(r,l):null===(d=null===(a=this.pulse)||void 0===a?void 0:a.trackElementView)||void 0===d||d.call(a,l)})}trackContentClick(t){return e(this,void 0,void 0,function*(){var e,n,i,o,r,s;if(!this.pulse)return;const a=this.getEventInput(t,"click");this.pulse.trackLegacyClickUIElement?null===(n=(e=this.pulse).trackLegacyClickUIElement)||void 0===n||n.call(e,a):this.pulse.trackClickUIElement?null===(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 io extends no{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 oo="[data-k5a-teaser-analytics]",ro=(e,t,n)=>{const i=document.querySelectorAll("k5a-stream");if(!i.length)return;const o=new io(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(oo);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(oo);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 so{handleKilkayaStreamTracking({pulse:e,pageType:t,publisher:n}){if(!(null==e?void 0:e.instance))return;const i={[se.VG]:new eo}[n]||new to;ro(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&&(u(`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:"";Tt(i)}loadKilkayaScript(t){return e(this,void 0,void 0,function*(){yield ge(t)})}run(t){return e(this,void 0,void 0,function*(){const{tcf:e,isMobileApp:n,country:i,kilkaya:o}=t;if(!(null==o?void 0:o.enabled))return;const r=yield k(e,n,i,"kilkaya");r&&(this.observeForKilkayaBackfills(),this.injectKilkayaMeta(r),yield this.loadKilkayaScript(o.url),this.handleKilkayaStreamTracking(t))})}}const ao=e=>{var t,n,i,o,r,s;const{adScaleConfig:a,deviceType:d}=l.get();if(!(null==a?void 0:a.enabled))return;if(Be(e,me))return;const c=null!==(t=a.adsToBeScaled[d])&&void 0!==t?t:[],u=Ct(e.targetId.split("-")[0]);if(!c.includes(u))return;const v=null!==(i=null===(n=a.offset)||void 0===n?void 0:n[u])&&void 0!==i?i:0,p=document.getElementById(e.targetId),g=null!==(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=Ci(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)},lo=1e4,co=e=>e.some(e=>e.some(e=>!!e&&Nn(e,0))),uo=()=>{const{widescreenSwitching:e}=l.get(),{enabled:t,rotationInterval:n=lo,widescreenIdPrefix:i}=null!=e?e:{};if(!t)return;const o=((e="widescreen")=>{const{pageSectionsSelectors:{right:t}={}}=l.get();return t?Array.from(document.querySelectorAll(t)).map(t=>Array.from(t.querySelectorAll(`div[id^="${e}"]`))):[]})(i);let r=0,s=Date.now(),a=co(o);if(!o.length)return;const d=(e,t,n)=>{e.forEach(e=>{e&&e.style.setProperty(t,n)})},c=e=>1===e?0:1;(e=>{e.forEach(e=>{e[0]&&(e[0].style.display="block"),e[1]&&(e[1].style.display="none")})})(o);const u=((e,t)=>{let n=null;return(...i)=>{null===n&&(e(...i),n=setTimeout(()=>{n=null},t))}})(()=>{a||(a=co(o)||a,s=Date.now());Date.now()-s>=n&&((()=>{const e=c(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=c(r),s=Date.now())},1e3);window.addEventListener("scroll",u)},vo={Blink:"Blink"},po=new Map,go=e=>{var t;if(!po.has(e)){const t=import(e).then(e=>(e=>{for(const[t,n]of Object.entries(vo)){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()},ho="https://assets.finn.no/pkg/distribution-fixed/v1/FINNExternalDistribution.modern.js",mo={get:e=>{try{const t=sessionStorage.getItem(e);return t?JSON.parse(t):null}catch(e){return u(`sessionStorageClient.get: Error during getting data from sessionStorage: ${e}`),null}},set:(e,t)=>{try{sessionStorage.setItem(e,JSON.stringify(t))}catch(e){u(`sessionStorageClient.set: Error during saving data to sessionStorage: ${e}`)}},remove:e=>{try{sessionStorage.removeItem(e)}catch(e){u(`sessionStorageClient.remove: Error during remove data from sessionStorage: ${e}`)}}},yo="finn_blink_id",fo=t=>e(void 0,void 0,void 0,function*(){const{id:e,hashed_email:n,theme:i}=t,o=function(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}(t,["id","hashed_email","theme"]),r=window[vo.Blink];if(!r)return;const s=new r({remote:"https://www.finn.no/distribution-front/external/carousel",id:e,hashed_email:n,theme:i});yield s.inject(o)}),wo=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}={}}=l.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:c,position:u,offset:v,advertoryTheme:p}=t||{};return{selector:`#${wo(e)}`,enabled:i,position:null!=u?u:e,distributionTypes:null!=c?c:[],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}},Eo=(t,n,i)=>e(void 0,void 0,void 0,function*(){const{placements:o,deviceType:r}=l.get();u(`rendering finn blink ad for ${t}`);const s=pt(t),a=o[r].find(e=>e.id===s),d=bo(t,null==a?void 0:a.finnBlink),{publisher:c,country:v,finnBlink:p}=n,{userId:g,uuid:h,channel:m,theme:f}=null!=p?p:{},w=null!=m?m:`${c}.${v}`,b=(e=>{if(!e){const e=Q();return null!=e?e:""}return e})(g),E="dark"===f?"dark":"light";if(!(null==d?void 0:d.enabled))return u(`Finn blink is not enabled on placement: ${t}`),i&&i(t),void Mi(t);if((e=>{var t;const n=wo(e),i=document.querySelector(`[id^="${n}"]`);return!!(null===(t=null==i?void 0:i.classList)||void 0===t?void 0:t.contains("finn"))})(t))u(`Finn blink already loaded ${t}`);else try{const t=yield e(void 0,void 0,void 0,function*(){const{finnBlink:{identifierUrl:e}={}}=l.get(),t=mo.get(yo),n=y("finncode");if(!e||n)return"";if(!t){const t=yield _.get(e,{credentials:"include"}),{finn_blink_id:n}=t;if(!n)throw new Error("getFinnBlinkIdentifier: No finn_blink_id found");return mo.set(yo,n),n}return t});yield fo(Object.assign(Object.assign({},d),{hashed_email:t,channel:w,id:b,theme:E,uuid:h})).then(()=>{((e,t)=>{const{siteSpecificConfig:{publisherClassName:n}={},pageType:i}=l.get(),o=document.querySelector(`#${e}`);if(!o)return;if(o.classList.add("disable-cogwheel"),!n)return;_i(n,o,qi,null!=t?t:i),Ai({preferredTestIdData:{targetId:e,testId:"finn"}})})(d.selector.replace("#",""),d.advertoryTheme)})}catch(e){u(`Finn blink error ${e}`),i&&i(t),!i&&Et(t),Mi(t)}}),To=(e,t)=>{var n;(u(`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)):u(`Cannot perform afterend on: ${e.id}`)},Io=e=>document.querySelector(`#${e}`);let ko,Ao=[];const So=["takeover","wallpaper"],Co=e=>{const t=(e=>{const t=ce.getData("alertoryConfigKeywords"),{queryConfig:n,placements:i,tcf:o,glimr:r,appearanceConfig:s,requestSize:d=a,publisher:l,country:c,pageType:u,deviceType:v,isMobileApp:p=!1,pageOptions:{member:g},takeover:h,fullscreenScroll:m,useAppTabletInvCode:y}=e;return{xandr:{member:g,keywords:t,tags:[]},advertory:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({publisher:l,country:c,pageType:u,deviceType:v,placements:i,tcf:o,requestSize:d,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}},Oo=()=>e(void 0,void 0,void 0,function*(){const{pageOptions:t}=l.get(),{preparePageOptions:n}=l.getHandlers(),i=(()=>{const{sandboxAdIframeEnabled:e=!0}=l.get();return{sandboxAdIframe:e,sandboxAttributes:["allow-same-origin","allow-scripts","allow-top-navigation-by-user-activation","allow-popups","allow-popups-to-escape-sandbox","allow-forms"]}})(),o=yield e(void 0,void 0,void 0,function*(){const{tcf:e,isMobileApp:t,country:n}=l.get();return(yield k(e,t,n,"page-options"))?{}:{userSync:{disabled:!0}}}),r=yield n(Object.assign(Object.assign(Object.assign({disablePsa:!0,enableSafeFrame:!0},t),{renderingManagement:Object.assign({},i)}),o));(e=>{const t=ce.getData("alertoryConfigKeywords");if(Object.keys(t).length)return;const n=Ri(e);ce.setData("alertoryConfigKeywords",n)})(r.keywords),ct(()=>ko.setPageOpts(r))}),Po=t=>e(void 0,void 0,void 0,function*(){const{prebid:e,tcf:n,isMobileApp:i,country:o}=l.get();$o(t);const r=yield k(n,i,o,"prebid");(null==e?void 0:e.enabled)&&r?(u("core loadPlacements prebid enabled"),yield at()):(u("core load tags invoked without prebid enabled"),Lo(t))}),$o=e=>{const{prepareTag:t}=l.getHandlers(),n=[];(e=>{const t=["skyscraperright_1","topboard","wallpaper","skyscraperleft_1"];return e.sort((e,n)=>{const i=t.findIndex(t=>e.id.includes(t)),o=t.findIndex(e=>n.id.includes(e));return-1!==i&&-1===o?-1:-1===i&&-1!==o?1:i-o})})(e).forEach(e=>{u("core defineTags",{placement:e});const i=xi(e);if(Ni(e.id)){const o=t(i),r=(e=>{const{allowedFormats:t,invCode:n,keywords:i,sizes:o}=e;return{adTypes:t,invCode:n,keywords:Bi(i),sizes:o}})(o);n.push(r),ct(()=>(u("core defineTag - add to the queue",{placement:e,preparedTag:o}),ko.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)},Lo=e=>{const t=e.filter(({id:e})=>Ni(e)).map(({id:e})=>e);t.length&&ct(()=>(u("core loadTags",{placementsIdsToLoad:t}),ko.loadTags([...t])))},xo=(t,n)=>e(void 0,void 0,void 0,function*(){const{appearanceConfig:e,deviceType:i}=l.get(),{threshold:o,refresh:r}=t,s=(e=>{const t=document.querySelector(`[data-show-tag-subscribe-id=${e.targetId}]`),n=document.querySelector(`#${e.targetId}`);return t||n})(n),a=null==e?void 0:e.defaultThreshold[i];s&&(u("core showAd - subscribe for show tag with thresholds",{placement:t,adObj:n,threshold:o,deviceDefaultThreshold:a}),yield En(s,null!=o?o:a)),s&&r&&(u("core showAd - setup refreshing",{placement:t,adObj:n}),s.dataset.refresh=r.toString())}),No=e=>e.some(({id:e})=>So.some(t=>e.includes(t))),jo=t=>e(void 0,void 0,void 0,function*(){var n;if(!(null===(n=null===window||void 0===window?void 0:window.advertory)||void 0===n?void 0:n.initialized))return;const[i,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]]},[[],[]]))(t),r=(e=>{const{requestSize:t=a,queryConfig:{placementBatches:n}={},deviceType:i}=l.get(),o=Lt(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)),d=e.filter(({id:e})=>!s.has(e));return[...r,...Ln(d,t)]})(o);for(const e of r)No(e)?(u("core loadAds without lazy loading",{placementsToLoad:e}),yield Po(e)):e.length&&(u("core loadAds with lazy loading",{placementsToLoad:e}),yield _o(e));yield(t=>e(void 0,void 0,void 0,function*(){if(!t.length)return;const{appearanceConfig:e,deviceType:n}=l.get(),i=null==e?void 0:e.defaultThreshold[n];for(const e of t){const{threshold:t,id:n}=e,o=Io(n);o&&(yield En(o,null!=t?t:i))}}))(i)}),_o=t=>e(void 0,void 0,void 0,function*(){const{queryConfig:{lazyLoadingV3:{enabled:e=!1,rootMargin:n="200% 0px"}={}}={}}=l.get(),i=[];if(!e)return u("lazy load is not enabled",{placements:t}),void(yield Po(t));const o=new IntersectionObserver((e,n)=>{e.filter(({isIntersecting:e,target:{id:t}})=>e&&!t.includes("wallpaper")).forEach(e=>{u("lazy load is enabled - handler start",{loadedPlacementIds:i,placements:t});const o=t.every(e=>i.includes(e.id)),r=t.map(e=>e.id);!o&&i.push(...r),!o&&Po(t),u("lazy load is enabled - handler stop",{loadedPlacementIds:i,placements:t,arePlacementsLoaded:o,placementIds:r}),n.disconnect()})},{rootMargin:n});t.forEach(e=>{const t=document.getElementById(e.id);t&&(u("lazy loading - observe element",{placementId:e.id,element:t}),o.observe(t))})}),qo=()=>e(void 0,void 0,void 0,function*(){const{siteEvents:t,initNativeAd:n,wallpaperHandlers:{initWallpaperAd:i,adjustAdToHorseshoe:o}}=l.getHandlers(),{wallpaper:r,fullscreenScroll:s}=l.get(),a=[];ct(()=>{ko.onEvent("adRequested",()=>{t.adRequested()}),ko.onEvent("adAvailable",o=>e(void 0,void 0,void 0,function*(){var e,a,d,c,v,p;u("core adAvailable start",{placementsAvailable:Ao,adObj:o,isFullscreenScrollAd:Ae(o),isFinnBlink:Ne(o.targetId),isNativeAd:Se(o),isMediation:ji(o),isTakeoverAd:Oe(o),isCollapseAd:Le(o),isWallpaperAd:$e(o)});const g=null===(d=null===(a=null===(e=null===window||void 0===window?void 0:window.apntag)||void 0===e?void 0:e.requests)||void 0===a?void 0:a.tags[o.targetId])||void 0===d?void 0:d.adResponse.ads;ji(o)&&g&&(null===(c=g[1])||void 0===c?void 0:c.rtb)&&(o.banner=null===(p=null===(v=g[1])||void 0===v?void 0:v.rtb)||void 0===p?void 0:p.banner),Ae(o)&&st(o),qe(o)&&uo(),Ae(o)&&!Ne(o.targetId)&&rt(o,s),!Se(o)||ji(o)||Ne(o.targetId)||n(o,l.get()),Oe(o)&&!Le(o)&&(bi(o.targetId),yield Ei(o)),$e(o)&&(i(()=>ct(()=>window.apntag.showTag(o.targetId)),r),ce.setData("wallpaper",{isAvailable:!0})),(e=>e.targetId.includes("skyscraperleft")&&!!e.banner)(o)&&ce.setData("horseshoe",{isAvailable:!0}),Ai({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),t.adAvailable(o);const h=Ao.find(({id:e})=>e===o.targetId);h&&(yield xo(h,o),Ao=Ao.filter(e=>e.id!==h.id)),u("core adAvailable stop",{placementsAvailable:Ao,adObj:o,isFullscreenScrollAd:Ae(o),isFinnBlink:Ne(o.targetId),isNativeAd:Se(o),isMediation:ji(o),isTakeoverAd:Oe(o),isCollapseAd:Le(o),isWallpaperAd:$e(o)})})),ko.onEvent("adLoaded",e=>{const{refreshConfig:i,appearanceConfig:r}=l.get(),s=document.getElementById(e.targetId);Ne(e.targetId)&&(e=>{const{fullscreenScroll:t}=l.get(),{initNativeAd:n}=l.getHandlers();Ae(e)&&rt(e,t),Se(e)&&n(e,l.get())})(e);a.includes(e.targetId)&&Se(e)&&(n(e,l.get()),Ai({adObj:e})),!a.includes(e.targetId)&&ji(e)&&a.push(e.targetId),Le(e)&&Et(e.targetId),Oe(e)&&((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"]})})(ko,e.targetId),Ce(e)&&(e=>{const t=document.querySelector(`#${e.targetId}`),{siteSpecificConfig:{publisherClassName:n,fullWidthFormatClassName:i}={}}=l.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`))})(e),(e=>Be(e,ye))(e)&&(e=>{const t=document.querySelector(`#${e.targetId}`),n=null==t?void 0:t.querySelector("iframe"),i=null==n?void 0:n.parentElement,{siteSpecificConfig:{publisherClassName:o,fullWidthFormatClassName:r}={}}=l.get();if(!t||!n||!i)return;const s=window.innerWidth,a=Math.round(s/1080*1920);t.style.width="100%",t.style.height=`${a}px`,t.classList.add(`advertory-${o}-${r}__vertical-full-width-ad`);const d=Ci(e,t.offsetWidth);i.style.transform=`scale(${d})`,i.style.transformOrigin="left top"})(e),((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;On({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&&$n(i,s,r))})(e,i),(null==r?void 0:r.clearProbableDimensionsEnabled)&&(e=>{const t=document.querySelector(`#${e}`);t&&(t.style.minWidth="",t.style.minHeight="")})(e.targetId);var d,c;ce.getData("horseshoe").isAvailable&&o(e.targetId),ao(e),t.adLoaded(e),d=e.targetId,!document.querySelector(`#gdprAdTransparencyCogWheelButton-${d}`)&&(null===(c=window.gdpr)||void 0===c?void 0:c.setupButton)&&window.gdpr.setupButton(d),s&&(s.classList.add("ad-loaded"),(e=>{var t;const{siteSpecificConfig:n}=l.get(),i=null!==(t=null==n?void 0:n.mainColumnWidth)&&void 0!==t?t:1/0;e.clientWidth>i&&e.setAttribute("data-two-column-ad-layout","true")})(s)),Pi(e),window.dispatchEvent(new CustomEvent("advertory:adLoaded",{detail:{targetId:e.targetId,adFormat:Si(e)}}))}),ko.onEvent("adNoBid",n=>e(void 0,void 0,void 0,function*(){Et(n.targetId),yield sn(l.get(),n),ti(n)&&(yield ei()),t.adNoBid(n)})),ko.onEvent("adError",(n,i)=>e(void 0,void 0,void 0,function*(){ti(i)&&(yield ei()),t.adError(n,i)})),ko.onEvent("adCollapse",()=>{t.adCollapse()}),ko.onEvent("adRequestFailure",e=>{Et(e.targetId),t.adRequestFailure(e)}),ko.onEvent("adBadRequest",e=>{Et(e.targetId),t.adBadRequest(e)}),ko.onEvent("adLoadedMediated",e=>t.adLoadedMediated(e)),ko.onEvent("adNoBidMediated",e=>t.adNoBidMediated(e))})}),Do=(t,n)=>e(void 0,void 0,void 0,function*(){var e;if(!(null===(e=null===window||void 0===window?void 0:window.advertory)||void 0===e?void 0:e.initialized))return[];const{clearAds:i,reloadExistingAds:o,renderFinnBlinkPlacements:r,contextSelector:s}=null!=n?n:{};if(i)return At(),[];o&&(At(),document.querySelectorAll('[data-advertory-ad-rendered="true"]').forEach(e=>{Tt(e.id)})),c(null!=t?t:{}),yield Oo();let a=Pt(s);return r&&(a=a.filter(e=>Ne(e.id))),a.length>0&&(Ao=[...Ao,...a.map(e=>Object.assign({},e))],jn(a),qn(a),yield jo(a)),Ao}),Mo=(t,n)=>e(void 0,void 0,void 0,function*(){var i;l.set(t),l.setHandlers(n),ce.initialize(),window.addEventListener("message",yn,!1),ko=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=ko,u("Apn tag is set up on window"),yield Promise.allSettled([e(void 0,void 0,void 0,function*(){const{tcf:e,isMobileApp:t,country:n}=l.get();(yield k(e,t,n,"xandr-endpoint"))||ko.setEndpoint("ib.adnxs-simple.com",!0)}),e(void 0,void 0,void 0,function*(){const{prebid:e,tcf:t,isMobileApp:n,country:i}=l.get(),o=yield k(t,n,i,"prebid");(null==e?void 0:e.enabled)&&o&&(yield ge(null==e?void 0:e.url))}),K(t),e(void 0,void 0,void 0,function*(){const{astUrl:e}=l.get();yield ge(null!=e?e:"https://adsdk.microsoft.com/ast/ast.js")}),e(void 0,void 0,void 0,function*(){const{gptUrl:e}=l.get();yield ge(null!=e?e:"https://securepubads.g.doubleclick.net/tag/js/gpt.js")}),e(void 0,void 0,void 0,function*(){const{brandmetrics:{enabled:e,url:t}={},tcf:n,isMobileApp:i,country:o}=l.get(),{getConsentAsync:r}=I(n,i,o),s=yield r();if(e&&t&&s){if(yield ge(t),document.querySelector(`.${Ti}`))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(Ti)})&&(t.disconnect(),window._brandmetrics=window._brandmetrics||[],window._brandmetrics.push({cmd:"_loadsurvey"}))}}).observe(document,{childList:!0,subtree:!0,attributes:!0})}}),S(),e(void 0,void 0,void 0,function*(){const{gdpr:{url:e,allowHidingAds:t=!0}={}}=l.get();t&&(window.gdpr=window.gdpr||{},window.gdpr.allowHidingAds=!0),yield ge(null!=e?e:"https://cogwheel.inventory.schibsted.io/prod/latest/gdpr-bundle.js")})]),yield Ii(),u("Libraries have been loaded and trackers have been set"),yield(i=n.librariesToLoad,e(void 0,void 0,void 0,function*(){const e=i.map(e=>ge(e));yield Promise.all(e)})),yield qo(),yield Oo(),u("Page options have been set"),Co(t),u("Advertory is setup on window"),Ao=Pt(),jn(Ao),qn(Ao),yield jo(Ao),u("Ads has been loaded",Ao),Fi(Ao),yield n.replaceAdsWithFinnBlink(t.finnBlink),yield(t=>e(void 0,void 0,void 0,function*(){var e;if(!t.drEdition)return;if(!(yield k(t.tcf,t.isMobileApp,t.country,"handleDrEdition")))return;const n=yield tn(),i=new nn(n);on({publisher:t.publisher,drEditionConfig:t.drEdition,device:t.deviceType,pageType:t.pageType,country:t.country},i,null===(e=t.pulse)||void 0===e?void 0:e.instance)}))(t),(e=>{if(!(null==e?void 0:e.enabled)||Zi)return;const{splitPointIDs:t,adSelector:n,trackSelector:i=Wi}=e,o=document.querySelector(i);if(!o)return;Zi=!0;const r=()=>{Xi(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)})(t.rightColumnSplit),yield(t=>e(void 0,void 0,void 0,function*(){const e=new so;yield e.run(t)}))(t)}),Bo=(t,n)=>e(void 0,void 0,void 0,function*(){yield((t,n)=>e(void 0,void 0,void 0,function*(){const{initConsentManager:e,getConsentAsync:i}=I(t.tcf,t.isMobileApp,t.country),o=yield zi(t);yield Ui(),yield Vi(e),yield Vi(i),u("TCF resolved successfully"),yield Mo(o,n),u("Run function resolved successfully")}))(t,n)}),Ro="native_override_desc2",Fo=(e,t,n)=>{var i;const{image:o,icon:r,sponsoredBy:s,title:a,clickUrl:d,cta:l,body:c,desc2:u,video:v,description:p,customTitle1:g,customTitle2:h,customTitle3:m,customTitle4:y,customIcon2:f}=e,w=(e,t="")=>{var n;return e?null!==(n=e.url)&&void 0!==n?n:e:t};return Object.assign({containerId:n,img:w(o),imgWidth:null==o?void 0:o.width,imgHeight:null==o?void 0:o.height,imgAltText:null!=a?a:"",logo:w(r),sponsoredBy:null!=s?s:"",title:null!=a?a:"",url:null!=d?d:"",cta:null!=l?l:"",description:null!==(i=null!=c?c:p)&&void 0!==i?i:"",desc2:null!=u?u:"",video:v,customTitle1:null!=g?g:"",customTitle2:null!=h?h:"",customTitle3:null!=m?m:"",customTitle4:null!=y?y:"",logo2:w(f)},t)},Vo=(e,t)=>{const n=(i=Ro,window.location.href.includes(i));var i;const o=new URLSearchParams(window.location.search).get(Ro),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},Uo=(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(se).includes(i);n&&r&&_i(i,e,Di,o)})(o,n),i())},Ho=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:[])Jo(i)}),t.dataset.tracked="true")})},zo=e=>{const{native:{impressionTrackers:t}={}}=e;(null==t?void 0:t.some(e=>e.includes("googleads")))?null==t||t.forEach(Ko):window.apntag.fireImpressionTrackers(e);const n=new CustomEvent("advertory:nativeImpression",{detail:{ad:e}});window.dispatchEvent(n)},Wo=(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:X.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,zo(e),c.disconnect();break}},d);c.observe(o)},Ko=e=>{const t=e.includes("googleads");"function"!=typeof window.navigator.sendBeacon||t?Jo(e):window.navigator.sendBeacon(e)},Jo=e=>{fetch(e,{method:"GET",mode:"no-cors"}).catch(t=>console.warn(`Tracker ${e} failed. Error: ${t||"Unknown"}`))},Go=(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=Vo(e.targetId,l))&&void 0!==i?i:c,v=et[t.language||w.NO],p=Fo(a,v,d);return(a.video?r[u]:o[u]||o.default)(p,t)})(e,t,n);Uo(e.targetId,i,t,()=>{const{nativeTrackingConfig:{nativeTrackingEnabled:n=!0}={}}=t;n&&((e,t)=>{Ho(e),Wo(e,t)})(e,t)})},Yo="viewable",Qo="adClick";var Xo=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=Zo(o.content,s),h=er({id:u,nodeId:p,poster:v,tagURL:g,publisher:a,productTag:d,videoLoop:c});return tr({playerConfig:h,clickUrl:s,pluginsNames:l}),`${e(t,n,p)}`};const Zo=(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"}))},er=({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({},Qt(e)?e:{}),{provider:Object.assign(Object.assign({},Qt(null==e?void 0:e.provider)?e.provider:{}),{productTag:r})})}}),tr=t=>e(void 0,void 0,void 0,function*(){const{playerConfig:e,pluginsNames:n,clickUrl:i}=t,{repeat:o}=e,r=yield zt(e);Kt(n),r.once("assetReady",()=>{Ht(r,n)}),r.on(Yo,e=>{const{viewable:t}=e;t?r.play():r.pause()}),r.on(Qo,()=>{window.open(i,"_blank")}),o&&r.on("pause",()=>{r.play()})}),nr=({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>`,ir=({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>`),or={VIDEO:(e,t)=>Xo(nr)(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>`,PODME_SECTION:({url:e,title:t,description:n,img:i,logo:o,containerId:r})=>`<article class="advertory-abo-ad-native-podme-section ${n&&"description"}">\n <div class="ad-info" id="${r}-button"></div>\n <a class="ad-link" href="${e}" target="_blank">\n <div class="ad-content-wrapper">\n <div class="ad-text-container">\n <div class="ad-title">${t}</div>\n <div class="ad-description">${n}</div>\n </div>\n <div class="ad-small-image-container">\n <img alt="podme-ad" class="ad-small-image" src="${i}" />\n </div>\n <div class="ad-logo">\n <img alt="${o}" class="logo" src="${o}"/>\n </div>\n </div>\n </a>\n </article>\n`,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)?Xo(ir)(e,t):null}},rr={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>`},sr={CONTENT:({containerId:e,url:t,sponsoredBy:n,title:i,logo:o,img:r,description:s})=>`<article class="advertory-aftenposten-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>`,RECIRC:({containerId:e,url:t,sponsoredBy:n,title:i,logo:o,img:r,adFrom:s,adText:a})=>`<article class="advertory-aftenposten-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>`},ar={displayTemplates:{podme_section:or.PODME_SECTION,content:sr.CONTENT,sponsorstripe:or.SPONSORSTRIPE,recirc:sr.RECIRC,native:rr.NATIVE_TEMPLATE,native_recirc:rr.NATIVE_RECIRC,default:or.CONTENT_BASIC},videoTemplates:{default:or.VIDEO,content:or.CONTENT_VIDEO}},dr=(e,t)=>{e.style.position="fixed",e.style.transform=`translateY(${t}px)`},lr=(e,t)=>{const n=document.querySelector(t),i=document.querySelector(`#${e}`);if(!i||!n)return;const o=i.parentElement,r=new IntersectionObserver(([e])=>((e,t,n)=>{const i=e?t.offsetHeight:0;dr(n,i)})(e.isIntersecting,n,o)),s=new ResizeObserver(()=>((e,t)=>{dr(t,e.offsetHeight)})(n,o));r.observe(n),s.observe(n)},cr=e=>document.querySelector(e)||document.querySelector(`[class*="${e}"]`),ur=(e,t)=>{if(!t||!xe(e))return;const{toggleEnabled:n,headerSelector:i,containersSelectors:o}=t,{targetId:r}=e;if(!n)return;const s=document.querySelector(".advertory-takeover-wrapper"),a=[()=>i&&lr(r,i),()=>o&&((e,t)=>{const n=document.querySelector(`#${e}`);if(!n)return;const[i,o]=t;if(!i)return;const r=()=>{const e=cr(i),t=o?cr(o):null,r=n.querySelector("article");if(!r||!e)return;const s=e.getBoundingClientRect().left,a=((e,t)=>{const n=e.getBoundingClientRect(),i=null==t?void 0:t.getBoundingClientRect();return i?i.right-n.left:n.width})(e,t);r.style.left=`${s}px`,r.style.width=`${a}px`};r(),new ResizeObserver(r).observe(document.body)})(r,o),()=>s&&((e,t)=>{const n=document.querySelector(`#${e}`);if(!n||!t)return;new IntersectionObserver(([e])=>{n.style.visibility=e.isIntersecting?"hidden":"visible"}).observe(t)})(r,s)];a.forEach(e=>e())},vr=e=>{const{deviceType:t}=l.get();navigator&&navigator.userAgent.match(/firefox/i)&&(e=>e===X.DESKTOP||"tablet"===e)(t)&&pr(e)},pr=e=>{var t,n,i,o,r,s,a,d;const l=ji(e)?1:0,c=null===(i=null===(n=null===(t=window.apntag)||void 0===t?void 0:t.requests)||void 0===n?void 0:n.tags)||void 0===i?void 0:i[e.targetId];if(null===(d=null===(a=null===(s=null===(r=null===(o=null==c?void 0:c.adResponse)||void 0===o?void 0:o.ads)||void 0===r?void 0:r[l])||void 0===s?void 0:s.rtb)||void 0===a?void 0:a.banner)||void 0===d?void 0:d.content){const e="<style>body { margin:0 !important; }</style>";c.adResponse.ads[l].rtb.banner.content+=e}},gr=((e,t)=>n=>Bo(Object.assign(Object.assign({},n),{siteSpecificConfig:t}),e))({initNativeAd:(e,t)=>{const{targetId:n}=e;if(!document.querySelector(`#${n}`))return;const{pageType:i=Ut.FRONT,nativeTrackingConfig:o,appearanceConfig:r,deviceType:s}=null!=t?t:{},a={language:w.NO,publisher:se.AFTENPOSTEN,deviceType:s,pageType:i,nativeTrackingConfig:o,appearanceConfig:r};Go(e,a,ar),ur(e,null==t?void 0:t.sponsorstripe)},wallpaperHandlers:{initWallpaperAd:(e,t)=>{if(!t)return;const{options:{appMainContainerSelector:n,wallpaperAnchorSelector:i}={}}=t;(e=>{const t=document.querySelector(e||"#application");if(!t)return;ft();const n=document.createElement("div");n.classList.add(mt),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, 0) - 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&&(wt(n),window.addEventListener("scroll",()=>wt(n)))})(i),e()},adjustAdToHorseshoe:e=>{var t;const n=document.querySelector(`#${e}`);n&&(null===(t=n.parentElement)||void 0===t||t.classList.add(yt),n.classList.add(yt))}},loadFinnBlinkAd:(t,n,i,o)=>e(void 0,void 0,void 0,function*(){const{isMobileApp:r}=l.get();if(u(`loadFinnBlinkAd: loading finn blink ad for ${t}`),!(yield e(void 0,void 0,void 0,function*(){const{tcf:e,isMobileApp:t,country:n}=l.get(),{getConsentAsync:i}=I(e,t,n),o=yield i();return!(!(null==e?void 0:e.enabled)||!o)||(u("Skip loading finn blink ad due to missing TCF consent."),!1)}))||r)return i&&i(t),Mi(t),void(!i&&Et(t));yield go(ho),yield Eo(t,n,i),o&&o()}),replaceAdsWithFinnBlink:t=>e(void 0,void 0,void 0,function*(){if(!t)return;yield go(ho);const{replacementConfig:e}=t;if(!((()=>{const e=document.getElementById("ads-advertory-anchor");return!(e&&"none"!==getComputedStyle(e).display&&window.advertoryFluepapir)})()&&(null==e?void 0:e.adsToReplace)&&(null==e?void 0:e.sizes)&&t.enabled))return void u(`Finn blink configuration is incorrect: ${JSON.stringify(e)}`);const{adsToReplace:n,sizes:i}=e;n.forEach(([e,t])=>{const n=document.querySelector(`[id^="${e}"]`);if(!n)return;const i=(e=>{const{siteSpecificConfig:{publisherClassName:t}={}}=l.get(),n=document.createElement("div"),i=document.createElement("div");return i.id=e,n.appendChild(i),_i(t,i,qi),u(`Creating blink container for: ${e}`),n})(t);(e=>{u(`Hiding old ad container: ${e.id}`),e.style.setProperty("display","none","important")})(n),To(n,i),n.dataset.finnBlinkId=t,wn().withFullAdsChain(e)})}),preparePageOptions:de,prepareTag:e=>{const{keywords:t,targetId:n,invCode:i}=e,{useAppTabletInvCode:o=!0}=l.get(),r=((e,t)=>{const{isMobileApp:n}=l.get();return n?((e,t)=>e.replace(/wtb|wde|wph/g,e=>"wph"===e?"aph":t?"atb":e))(e,t):e})(i,o),s=(e=>{const{keywords:t,dynamicSizeWidthCheck:n}=e,i=`${C()}-adformat`,o=t?t[i]:[];if(!o)return{};const r=(Array.isArray(o)?o:[o]).filter(e=>!(e in ke)||window.innerWidth>=ke[e]);return{[i]:n?r:o}})(e),a=(e=>{const t=`${C()}-targetid`;return e?{[t]:[e]}:{}})(n),d=(e=>{var t;const[,n]=null!==(t=e.match(/-((w|a)(?:ph|de|tb))-/))&&void 0!==t?t:[];switch(n){case"wde":return{"aa-sch-supply_type":"web_desktop"};case"wtb":return{"aa-sch-supply_type":"web_tablet"};case"wph":return{"aa-sch-supply_type":"web_phone"};case"aph":return{"aa-sch-supply_type":"app_phone"};default:return}})(r);return Object.assign(Object.assign({},e),{invCode:r,keywords:Object.assign(Object.assign(Object.assign(Object.assign({},t),s),a),d)})},siteEvents:{adRequested:()=>{},adAvailable:e=>{Oe(e)&&(()=>{const e=document.querySelector(".advertory-aftenposten-topboard-wrapper__front"),t=document.querySelector("#takeover");e&&t&&t.appendChild(e.firstChild)})(),vr(e)},adLoaded:e=>{$e(e)&&(()=>{const e=document.querySelector("body");e&&e.classList.add("advertory-aftenposten-body__with-wallpaper")})(),Ae(e)||((e,t,n="front")=>{var i;const{targetId:o}=e,r=o.startsWith("contentboard"),s=document.querySelector(`#${o}`);if(!s||!r)return;const a=document.createElement("div");a.classList.add(`advertory-${t}-netboard-wrapper__${n}`),s.classList.add(`advertory-${t}-netboard__${n}`),null===(i=s.parentNode)||void 0===i||i.replaceChild(a,s),a.appendChild(s),Ai({adObj:e})})(e,se.AFTENPOSTEN,"brandboard")},adNoBid:e=>{},adError:(e,t)=>{},adCollapse:()=>{},adRequestFailure:e=>{},adBadRequest:e=>{},adLoadedMediated:e=>{},adNoBidMediated:e=>{}},librariesToLoad:[]},{publisherClassName:se.AFTENPOSTEN,fullWidthFormatClassName:"netboard"});var hr=Object.freeze({__proto__:null,default:""});export{gr as initAdvertoryPackage,Do as updateAdvertory};
|
|
1
|
+
import"react/jsx-runtime";function e(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 t(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var n,i;"function"==typeof SuppressedError&&SuppressedError;var o=t(function(){if(i)return n;i=1;var e=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var n=Object.prototype.toString.call(e);return"[object RegExp]"===n||"[object Date]"===n||function(e){return e.$$typeof===t}(e)}(e)},t="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function o(e,t){return!1!==t.clone&&t.isMergeableObject(e)?l((n=e,Array.isArray(n)?[]:{}),e,t):e;var n}function r(e,t,n){return e.concat(t).map(function(e){return o(e,n)})}function s(e){return Object.keys(e).concat(function(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter(function(t){return Object.propertyIsEnumerable.call(e,t)}):[]}(e))}function a(e,t){try{return t in e}catch(e){return!1}}function d(e,t,n){var i={};return n.isMergeableObject(e)&&s(e).forEach(function(t){i[t]=o(e[t],n)}),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)&&n.isMergeableObject(t[r])?i[r]=function(e,t){if(!t.customMerge)return l;var n=t.customMerge(e);return"function"==typeof n?n:l}(r,n)(e[r],t[r],n):i[r]=o(t[r],n))}),i}function l(t,n,i){(i=i||{}).arrayMerge=i.arrayMerge||r,i.isMergeableObject=i.isMergeableObject||e,i.cloneUnlessOtherwiseSpecified=o;var s=Array.isArray(n);return s===Array.isArray(t)?s?i.arrayMerge(t,n,i):d(t,n,i):o(n,i)}return l.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce(function(e,n){return l(e,n,t)},{})},n=l}());const r=["deviceType","pageType","placements","takeover","refreshConfig","editableConfiguration"],s={adRequested:()=>{},adAvailable:e=>{},adLoaded:e=>{},adNoBid:e=>{},adError:(e,t)=>{},adCollapse:()=>{},adRequestFailure:e=>{},adBadRequest:e=>{},adLoadedMediated:e=>{},adNoBidMediated:e=>{}},a=6;class d{set(e){this.config=e}modifyConfigProperties(e){if(!this.config)throw new Error("Config was accessed before it had been initialized.");const t={};for(const n of r){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(d.DEFAULT_SITE_HANDLERS,e)}}d.DEFAULT_SITE_HANDLERS={siteEvents:s,initNativeAd:function(){}};const l=new d,c=l.modifyConfigProperties.bind(l),u=(e,t)=>{const n="[Advertory LOG]: ";location.search.includes("ast_debug=true")&&(t?console.log(n,e,t):console.log(n,e))},v=864e5,p=(()=>{const e=e=>{const t=window.localStorage.getItem(e);if(!t)return null;try{return JSON.parse(t)}catch(e){return u("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=v)=>{const o={data:n,expirationTime:(new Date).getTime()+i};t(e,JSON.stringify(o))},getByTimestamp:(t,n=v)=>{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 u("Error with parsing localStorage data"),null}}}})(),g="glimrTags",h=["glwe_","glwet_"],m={geofenceTags:[],geoTags:[],weatherTags:[]},y=e=>new URLSearchParams(window.location.search).get(e),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 u("Advertising permission value obtained synchronously: ",e),Boolean(t)})();if(null!==n)return void t(n);let i=!1;const o=e=>{i||(u("Resolving advertising permission value obtained"),i=!0,t(e))},r=setTimeout(()=>{u("Advertising permission timed out, resolving with false"),o(!1)},3e3);window._tcf_.onTcfReady(()=>{u("On Tcf Ready called, waiting for permission"),clearTimeout(r)}),window._tcf_.getPermission("CMP:advertising",e=>{clearTimeout(r);const t=Number(e);u("Advertising permission value obtained asynchronously: ",e),o(Boolean(t))})}),w={NO:"no",SE:"se"},b="cmp:loaded";let E,T=!1;const I=(t,n,i)=>{const o=!!(null==t?void 0:t.enabled),r=(null==t?void 0:t.timeout)||3e3,s=y("bypass_tcf"),a=()=>{if(!(null==t?void 0:t.enabled))return!0;if(((e,t)=>e?!!t&&(u("TCF bypass param detected, returning consent: true"),!0):(u("TCF is not enabled, returning consent: true"),!0))(o,s))return!0;if(T)return null;if(!E)throw new Error("[Advertory]: getConsentSync method was called before the tcfManager was available.");const e=E.getConsentedToAllSync();return u(`TCF consented to all is: ${e}`),E.getConsentedToAllSync()};return{initConsentManager:()=>(null==t?void 0:t.enabled)?new Promise((e,t)=>{if(u("Getting TCF consent manager..."),window._tcf_)return u("TCF consent manager is already available"),E=window._tcf_,void e(E);u("TCF consent manager is not available");const n=()=>{u("CMP loaded, resolving consent manager..."),i&&clearTimeout(i),window._tcf_?(E=window._tcf_,e(E)):t(new Error("CMP loaded but window._tcf_ is not defined"))},i=setTimeout(()=>{document.removeEventListener(b,n),T=!0,t(new Error("Timeout waiting for CMP to load"))},r);u("Listening for CMP loaded event..."),document.addEventListener(b,n,{once:!0})}):Promise.resolve(null),getConsentSync:a,getConsentAsync:()=>e(void 0,void 0,void 0,function*(){if(null==t?void 0:t.schibstedAdChoicesOverrideValue)return u(`Schibsted Ad Choices override value is set, returning override value: ${t.schibstedAdChoicesOverrideValue}`),Boolean(Number(t.schibstedAdChoicesOverrideValue));const e=(null==t?void 0:t.schibstedAdChoicesEnabled)&&i===w.SE,o=(null==t?void 0:t.schibstedAdChoicesEnabled)&&!n&&i===w.NO;if(e||o)return u("Schibsted Ad Choices is enabled, getting advertising permissions..."),yield f(t);if(!(null==t?void 0:t.enabled))return!0;const s=a();return null!==s?s:yield new Promise((e,t)=>{try{if(!E)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(()=>{u("TCF isConsentedToAll timed out, resolving with false"),n(!1)},r);E.onTcfReady(()=>{u("On Tcf Ready called, waiting for consent"),clearTimeout(i)}),E.isConsentedToAll(t=>{clearTimeout(i),e(t)})}catch(e){t(e)}})})}},k=(t,n,i,...o)=>e(void 0,[t,n,i,...o],void 0,function*(e,t,n,i="NOT SPECIFIED FEATURE"){if(!(null==e?void 0:e.schibstedConsentToPayEnabled))return u(`Schibsted Consent to Pay is not enabled, returning true for ${i}`),!0;if(null==e?void 0:e.schibstedAdChoicesOverrideValue)return u(`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}=I(e,t,n);return(yield o())?(u(`Schibsted Ad Choices consent given according to TCF consent manager for ${i}`),!0):(u(`Schibsted Ad Choices consent not given according to TCF consent manager for ${i}`),!1)}),A=()=>e(void 0,void 0,void 0,function*(){const{tcf:e,isMobileApp:t,country:n}=l.get();if(null==e?void 0:e.schibstedConsentToPayEnabled){return yield k(e,t,n,"glimr")}const{getConsentAsync:i}=I(e,t,n);return yield i()}),S=()=>e(void 0,void 0,void 0,function*(){const{glimr:t}=l.get();if(!(yield A())||!(null==t?void 0:t.enabled))return void u("No consent for glimr data fetching.");const n=yield(i=500,e(void 0,void 0,void 0,function*(){return yield Promise.race([e(void 0,void 0,void 0,function*(){const e=yield import("glimr-sdk");return e.default||e}),new Promise(e=>setTimeout(()=>e(!1),i))])}));var i;if(n)try{n.setTagCacheTimeInSeconds(300),yield new Promise(e=>{n.getTags(t.clientId,(t,n)=>{p.setWithTimestamp(g,{tags:t,tagMappings:n}),e(!0)})})}catch(e){u(`Error during getting glimr data: ${e}`)}else u("Timeout (500ms) while loading glimr package. Skipping glimr data fetching.",{glimr:n})}),C=()=>{const{country:e}=l.get();return e===w.NO?"no-sno":"se-generic"},O=()=>{const{country:e,publisher:t}=l.get();return`${e}-${t}`},P={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"},$=e=>h.some(t=>e.startsWith(t)),L=e=>e.startsWith("glgc_"),x=e=>!$(e)&&!L(e),N=e=>{const t=j();if(!t)return m;const n=((e=[])=>e.filter($))(t),i=((e=[])=>e.filter(L))(t),o=((e=[],t)=>{const n=e.filter(x);if(t){const{publisher:e}=l.get(),t=P[e]||e;n.push(t)}return n})(t,e);return{geoTags:o,geofenceTags:i,weatherTags:n}},j=()=>{const e=p.getByTimestamp(g);return e&&"string"!=typeof e?null==e?void 0:e.tags:null},_={get:(t,n)=>e(void 0,void 0,void 0,function*(){const e=yield fetch(t,n);if(!e.ok)throw new Error(e.statusText);return yield e.json()}),post:(t,n,i)=>e(void 0,void 0,void 0,function*(){const e=JSON.stringify(i),o=yield fetch(t,{method:"POST",headers:n,body:e});if(!o.ok)throw new Error(o.statusText);return yield o.json()})},q="advertory:ppids-cache",D={[w.SE]:`SCH${w.SE.toUpperCase()}-EnvHash`,[w.NO]:`SCH${w.NO.toUpperCase()}-EnvHash`},M={[w.SE]:`SCH${w.SE.toUpperCase()}-UserHash`,[w.NO]:`SCH${w.NO.toUpperCase()}-UserHash`},B={[w.SE]:`sch${w.SE}-envhash-v3`,[w.NO]:`sch${w.NO}-envhash-v3`},R={[w.SE]:`sch${w.SE}-userhash-v3`,[w.NO]:`sch${w.NO}-userhash-v3`},F={[w.SE]:`'sch${w.SE}-iosid-v3'`,[w.NO]:`'sch${w.NO}-iosid-v3'`},V={[w.SE]:`sch${w.SE}-androidid-v3`,[w.NO]:`sch${w.NO}-androidid-v3`},U={[w.SE]:"sdrn:schibsted.com:user",[w.NO]:"sdrn:spid.no:user"};class H{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 z=new class{constructor(){this.ppid1=null,this.ppid2=null}processPPIDs(t){return e(this,arguments,void 0,function*(e,t=1e4){var n,i;const 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||u("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:""}},W=new class{constructor(){this.ppid1=null,this.ppid2=null,this.idfv=null,this.anId=null}processPPIDs(t,n){return e(this,void 0,void 0,function*(){var e,i,o,r,s,a,d,l,c,u,v;const g=p.get(q),h=yield this.getNewPPIDs(t,n);if(this.shouldHash(g,h)){const n=null!==(e=t.hasherUrl)&&void 0!==e?e:"https://hasher.schibsted.com/api/v1/hash",l=this.createHasherPayload(h),c=yield this.hashPPIDs(l,n);return c?(this.cachePPIDs(l,c,null===(i=h.idfv)||void 0===i?void 0:i.plain,null===(o=h.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=h.idfv)||void 0===a?void 0:a.plain,null===(d=h.anId)||void 0===d?void 0:d.plain)):void this.setPPIDs("","")}this.setPPIDs(null!==(l=null==g?void 0:g.userId.hashed)&&void 0!==l?l:"",null!==(c=null==g?void 0:g.environmentId.hashed)&&void 0!==c?c:"",null===(u=null==h?void 0:h.idfv)||void 0===u?void 0:u.plain,null===(v=null==h?void 0:h.anId)||void 0===v?void 0:v.plain)})}getPPIDs(){var e,t;return null!==this.ppid1&&null!==this.ppid2||u("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}}:{});p.set(q,o)}hashPPIDs(t,n){return e(this,void 0,void 0,function*(){try{const e=new Headers({"Content-Type":"application/json"});return yield _.post(n,e,t)}catch(e){return u("Error with hashing PPIDs",e),null}})}getNewPPIDs(t,n){return e(this,arguments,void 0,function*({clientId:t,instance:n},i){const o=yield((t,n)=>e(void 0,void 0,void 0,function*(){const e=yield t.getUserId();return e?`${U[n]}:${e}`:null}))(n,i),r=yield(t=>e(void 0,void 0,void 0,function*(){const e=yield t.getEnvironmentId();return e?`sdrn:schibsted:environment:${e}`:null}))(n),s=window.advertory_idfv,a=window.advertory_anId;return Object.assign(Object.assign({clientId:{plain:t},userId:{plain: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}}},K=t=>e(void 0,void 0,void 0,function*(){const{tracker:e,tcf:n,country:i,isMobileApp:o}=t;if(!(yield k(n,o,i,"setXandrPPIDs")))return;if(!e)return;(yield Promise.allSettled([z.processPPIDs(e,null==n?void 0:n.timeout),W.processPPIDs(e,i)])).forEach((e,t)=>{if("rejected"===e.status){u(`Cannot fetch PPIDs v${t+2}`,e.reason)}})}),J=e=>{const{ppid1:t,ppid2:n}=z.getPPIDs(),{ppid1:i,ppid2:o,idfv:r,anId:s}=W.getPPIDs();return{userIds:[{type:"extendedIDs",eids:(new H).add(n,D[e]).add(t,M[e]).add(o,B[e]).add(i,R[e]).add(r,F[e]).add(s,V[e]).buildEids()}]}},G=e=>{const{ppid1:t,ppid2:n}=z.getPPIDs(),{ppid1:i,ppid2:o,idfv:r,anId:s}=W.getPPIDs();if(!n)return{};return{userSync:{userIds:[{name:"pubProvidedId",params:{eids:(new H).add(n,D[e]).add(t,M[e]).add(o,B[e]).add(i,R[e]).add(r,F[e]).add(s,V[e]).buildRyEids()}}]}}},Y=e=>{const t=encodeURIComponent(e).replace(/[-.+*]/g,"\\$&"),n=new RegExp(`(?:(?:^|.*;)\\s*${t}\\s*\\=\\s*([^;]*).*$)|^.*$`);return decodeURIComponent(document.cookie.replace(n,"$1"))||null},Q=()=>{const e=Y("_pulse2data");return e?e.split(",")[2]:void 0},X={MOBILE:"mobile",TABLET:"tablet",DESKTOP:"desktop"},Z=9826;class ee{constructor(){this.getSupplyTypeKeywords=()=>{const{deviceType:e=X.DESKTOP,isMobileApp:t}=l.get();if(t){return{"aa-sch-supply_type":`app_${e===X.MOBILE?"phone":X.TABLET}`}}return{"aa-sch-supply_type":`web_${this.getPageOptionsFormatDevice(e)}`}}}prepare(t){return e(this,void 0,void 0,function*(){return Object.assign(Object.assign({},t),{keywords:Object.assign(Object.assign(Object.assign(Object.assign({},t.keywords),this.getSupplyTypeKeywords()),yield this.getFormattedExternalIdKeywords()),this.getHasContextKeywords(t.keywords)),user:{externalUid:yield this.getExternalUid(),dnt:yield this.isTrackingForbidden()}})})}getFormattedExternalIdKeywords(){return e(this,void 0,void 0,function*(){const e=yield this.getExternalUid(),t=this.getUserId();return{"aa-sch-externalid_src":Number(!!e)+Number(!!t)}})}getUserId(){return Q()}getExternalUid(){return e(this,void 0,void 0,function*(){return yield e(void 0,void 0,void 0,function*(){const{tcf:e,isMobileApp:t,country:n}=l.get(),{getConsentAsync:i}=I(e,t,n);if(!(yield i()))return;const o=Y("_pulse2data");return o?o.split(",")[9]:void 0})})}isTrackingForbidden(){return e(this,void 0,void 0,function*(){return(null===navigator||void 0===navigator?void 0:navigator.globalPrivacyControl)||"1"===(null===navigator||void 0===navigator?void 0:navigator.doNotTrack)||"DO_NOT_TRACK"===(yield this.getExternalUid())})}getMember(){const{pageOptions:{member:e},testMember:t=Z}=l.get();return window.location.search.includes("inventory_test=true")?t:e}getCMPValue(e){return localStorage.getItem(`CMP:${e}`)?"0"===localStorage.getItem(`CMP:${e}`)?"0":"1":"0"}getPublisherKeywords(){const{publisher:e}=l.get();return{"aa-sch-publisher":`${e}`}}getAnalyticsConsentKeywords(){return{"aa-sch-cmp_analytics":this.getCMPValue("analytics")}}getAdvertisingConsentKeywords(){return e(this,void 0,void 0,function*(){const{tcf:e,isMobileApp:t,country:n}=l.get(),{getConsentAsync:i}=I(e,t,n);return{"aa-sch-cmp_advertising":(yield i())?"1":"0"}})}getPageTypeKeywords(){const{pageType:e}=l.get();return{"aa-sch-page_type":e}}getCountryCodeKeywords(e){return{"aa-sch-country_code":e}}getInventoryTypeKeywords(){return{"aa-sch-inventory_type":"editorial"}}getHasContextKeywords(e){const t=e["aa-sch-context_keyword"];return{"aa-sch-has_context_keyword":Array.isArray(t)&&t.length?1:0}}getPageOptionsFormatDevice(e="desktop"){return"mobile"===e?"phone":e}getSponsorsKeywords(){var e;const{publisher:t,keywordsConfig:n}=l.get(),i=null===(e=null==n?void 0:n.sponsors)||void 0===e?void 0:e.split(":").map(e=>`${t}_${e}`);return i?{"no-sno-news-sponsors":i}:{}}}const te=new ee;te.prepare.bind(te);function ne(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 ie=["aLOLE","xBqQj","1KaqJ","1nzXzK","opm8zV","4qKXKR","Ad9QgE"];function oe(e){return t=window.location.pathname.split("/").slice(-2,-1).pop()||"",ie.includes(t)?{"no-sno-news-section":`${e}_doedsfall`}:{};var t}class re extends ee{constructor(){super(...arguments),this.getDeviceKeywords=()=>{const{deviceType:e=X.DESKTOP}=l.get();return{"no-sno-device":this.getPageOptionsFormatDevice(e)}}}getAppTypeKeywords(){const{deviceType:e,isMobileApp:t}=l.get(),{OS:n,isHybridApp:i}=ne(t);return{"no-sno-apptype":n&&e&&i?`${n}_${this.getPageOptionsFormatDevice()}_hybrid`:"none"}}getObituariesKeywords(e){return oe(e)}getSectionPageTypeKeywords(){var e,t;const{pageOptions:n,pageType:i}=l.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 se={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"};const ae=new class extends re{prepare(t){return e(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(w.NO)),this.getPublisherKeywords()),this.getPageTypeKeywords()),this.getSupplyTypeKeywords()),this.getDeviceKeywords()),this.getAppTypeKeywords()),yield this.getFormattedExternalIdKeywords()),yield this.getAdvertisingConsentKeywords()),this.getHasContextKeywords(t.keywords)),(()=>{const{ppid1:e,ppid2:t}=z.getPPIDs();return{"aa-sch-schuserhash":e?"1":"0","aa-sch-schenvhash":t?"1":"0"}})()),yield e(void 0,void 0,void 0,function*(){const{glimr:e}=l.get(),{addPublisherToGeo:t}={},n=yield A();if(!(null==e?void 0:e.enabled)||!n)return u("No consent for getting glimr tags."),{};const i=C(),o=N(t);return{[`${i}-geo`]:o.geoTags,[`${i}-weather`]:o.weatherTags,[`${i}-geofence`]:o.geofenceTags}})),t.keywords),this.getObituariesKeywords(se.AFTENPOSTEN));return Object.assign(Object.assign({},t),{keywords:n,user:Object.assign(Object.assign({},J(w.NO)),{externalUid:yield this.getExternalUid()}),member:this.getMember()})})}};var de=ae.prepare.bind(ae);class le{initialize(){this.DATA=Object.assign({},le.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)}}le.INITIAL_DATA={wallpaper:{isAvailable:!1},horseshoe:{isAvailable:!1},initialClassNames:{},alertoryConfigKeywords:{}};const ce=new le,ue=()=>(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),ve=()=>(window.relevantDigital||(window.relevantDigital={cmd:[]}),window.relevantDigital),pe=(e={},t)=>{const{prebid:{externalUidInAuctionEnabled:n,forwardGlimrTags:i=!1}={}}=l.get(),o=[`${C()}-geo`],r=["aa-sch-context_keyword","aa-sch-publisher","se-aftonbladet-section","se-svd-section","se-generic-section","no-sno-news-section","no-sno-news-subsection",...i?o:[]],s=Object.fromEntries(Object.entries(e).filter(([e])=>r.includes(e))),a=t&&n?{id:t}:{};return{ortb2:Object.assign({site:{ext:{data:s}}},a)}},ge=(t,...n)=>e(void 0,[t,...n],void 0,function*(e,{timeout:t}={timeout:1e3}){document.querySelector(`script[src="${e}"]:not([type="module"])`)||(yield new Promise((n,i)=>{const 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)}))}),he="ABSOLUTE_FULLSCREEN",me="ANY_FULLSCREEN",ye="VERTICAL_FULLWIDTH",fe="FULLWIDTH",we="TAKEOVER",be="VELVET_TAKEOVER",Ee="WALLPAPER",Te="COLLAPSE",Ie={ANY_FULLSCREEN:[{width:6,height:6},{width:1920,height:1080},{width:3,height:3}],ABSOLUTE_FULLSCREEN:[{width:6,height:6}],VERTICAL_FULLWIDTH:[{width:1080,height:1920}],FIXED_FULLSCREEN:[{width:1920,height:1080},{width:3,height:3}],FULLWIDTH:[{width:5},{width:400,height:400}],NATIVE_AD:[{width:1,height:1}],TAKEOVER:[{width:4,height:4}],VELVET_TAKEOVER:[{width:7,height:7}],WALLPAPER:[{width:2,height:2}],COLLAPSE:[{width:2,height:1}]},ke={wallpaper:1600,"l-format":1600},Ae=e=>{const{banner:t,targetId:n}=e;return!(!t||(null==n?void 0:n.includes("takeover")))&&Be(e,me)},Se=e=>{const{native:t}=e;return!!t},Ce=e=>Be(e,fe),Oe=e=>{const{targetId:t}=e;return t.includes("takeover")||Be(e,we)},Pe=e=>Be(e,we),$e=e=>Be(e,Ee),Le=e=>Be(e,Te),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.startsWith("widescreen"),De=e=>e.width>=1260&&e.width<=1280,Me=e=>e.width>=1600&&e.width<=1620,Be=(e,t)=>{const n=Ie[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=e=>e.includes("snoap.no"),Fe=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)},Ve=(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()},Ue=Ve([],()=>{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}),He=e=>{const t=Ve([],()=>{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},ze=[],We={},Ke=(e,t)=>{e.forEach(({target:e,isIntersecting:n})=>{const i=Ge(e);n?(Je(i,n),Ye(e,i,t)):(Je(i,n),Qe(e,i,t))})},Je=(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}`,"*")},Ge=e=>{var t;return null===(t=e.children[0])||void 0===t?void 0:t.id},Ye=(e,t,n)=>{e.classList.add("in-screen"),document.body.classList.add("fullscreen-scroll-in-screen"),window.dispatchEvent(new CustomEvent("advertory:fullscreenScrollInView")),ze.includes(t)||ze.push(t),n&&window.addEventListener("scroll",We[t],{passive:!0})},Qe=(e,t,n)=>{ze.includes(t)&&(n&&window.removeEventListener("scroll",We[t]),document.body.classList.remove("fullscreen-scroll-in-screen"),e.classList.remove("in-screen"),window.dispatchEvent(new CustomEvent("advertory:fullscreenScrollNotInView")))},Xe=(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&&Ze(e,r,o,0),s.length&&Ze(e,s,o,40)}},Ze=(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()})},et={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 tt=null;const nt=(e,t)=>{let n=e;return n=(e=>{const t=document.createElement("script");return t.textContent="\n {\n const frame = window.frameElement;\n \n if (frame) {\n frame.contentWindow.document.body.onload = onLoad;\n } else {\n document.body.onload = onLoad;\n }\n \n function onLoad() {\n window.addEventListener('message', function(event) {\n if (event.data === 'advertory:showFullscreen-'+document.body.id) {\n document.body.style.display= \"block\";\n } else if (event.data === 'advertory:hideFullscreen-'+document.body.id) {\n document.body.style.display= \"none\";\n }\n });\n }\n }\n ",e+t.outerHTML})(e),n=(e=>{const t=document.createElement("script");return t.textContent=`(${Ue})()`,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(Re(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=He(n)),(e=>e.includes("de17a"))(n)&&(n=(e=>Re(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)),Re(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)),Fe(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},it=()=>{tt=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`)},ot=()=>{tt||(tt=window.requestAnimationFrame(it))},rt=(e,t)=>{var n,i,o,r;const{country:s}=l.get(),{targetId:a}=e;document.documentElement.style.setProperty("--advertory-ios-safe-area-top-fix",null!==(n=null==t?void 0:t.iosSafeAreaTopFix)&&void 0!==n?n:"0px"),(e=>{const{articlesContainerWidth:t=1302,backgroundColor:n="#fff",foregroundColor:i="#fff",margin: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),c=null==d?void 0:d.parentElement;if(!d||!c)return;((e,t)=>{const n=(null==t?void 0:t.fadingHeaderEnabled)||!1,i=new IntersectionObserver(e=>Ke(e,n),{}),o=Ge(e);i.observe(e),n&&(We[o]=Xe(e,t))})(c,t),d.className="advertory-fullscreen-scroll";const u=Be(e,he)?"absolute":"fixed";d.style.position=u,c.className="advertory-fullscreen-scroll-wrapper",c.dataset.showTagSubscribeId=a,d.setAttribute("data-ad-label",et[s].adText),(null==t?void 0:t.moveCogwheelToTheLeft)&&(d.dataset.moveCogwheelToTheLeft="true"),ot(),window.addEventListener("resize",ot),null===(o=window.visualViewport)||void 0===o||o.addEventListener("resize",ot),null===(r=window.visualViewport)||void 0===r||r.addEventListener("scroll",ot)},st=({targetId:e})=>{const t=(e=>{const{requests:t}=window.apntag,n=Fe(e)?1:0;return null==t?void 0:t.tags[e].adResponse.ads[n].rtb.banner.content})(e);if(!t)return;((e,t)=>{const{requests:n}=window.apntag,i=Fe(e)?1:0;n&&(n.tags[e].adResponse.ads[i].rtb.banner.content=t)})(e,nt(t,e))},at=()=>e(void 0,void 0,void 0,function*(){const{prebid:e,tcf:t,country:n,isMobileApp:i,fullscreenScroll:o}=l.get();if(!(null==e?void 0:e.enabled))return;const{initNativeAd:r}=l.getHandlers(),{getConsentAsync:s}=I(t,i,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=ue(),{prebid:{relevantCbTimeout:r}={}}=l.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}}})(),c=ue(),v=(()=>{const{requests:{user:e={userIds:[]},keywords:t={}}={}}=ue();return{user:e,keywords:t}})();d.failsafeOnTimeout("relevantCb");const{user:{externalUid:p=""}={},keywords:g}=v;(()=>{const e=ve();return e.cmd||(e.cmd=[]),e.cmd})().push(()=>{if(d.getCancel()||!c.loadTags)return u("core loadTags() call was cancelled",{cancel:d.getCancel(),apnTagLoadTags:!c.loadTags,condition:"or"}),void d.cleanup();const t=ve();d.events.relevantCb.done=!0,d.failsafeOnTimeout("auctionCb");const i=a?{gdpr:{cmpApi:"iab",timeout:8e3}}:{cmpApi:"none"};u("prebid consentManagement",i),t.addPrebidConfig(Object.assign(Object.assign({consentManagement:i,enableSendAllBids:!1},G(n)),pe(g,p))),u("core add prebid config",Object.assign(Object.assign({consentManagement:i,enableSendAllBids:!1},G(n)),pe(g,p))),t.loadPrebid({configId:e.id,manageAdserver:!1,collapseEmptyDivs:!1,collapseBeforeAdFetch:!1,noGpt:!0,noSlotReload:!0,loadUnknownSlots:!0,apntagCalls:{showTag:()=>{},loadTags:e=>{d.getCancel()||(d.events.auctionCb.done=!0,c.loadTags(e)),d.cleanup()}},customNativeRender:e=>{dt(e,r)},directRenderFn:e=>{const{settings:t,renderFn:n}=e,{bid:i,adDiv:r}=t||{};if(!r)return;const s=n(t),a=Object.assign(Object.assign({},i),{targetId:r.id,banner:!0});Ae(a)&&(rt(a,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()})(s))}}),u("core load prebid",{configId:e.id,manageAdserver:!1,collapseEmptyDivs:!1,collapseBeforeAdFetch:!1,noGpt:!0,noSlotReload:!0,loadUnknownSlots:!0,apntagCalls:{showTag:()=>{},loadTags:e=>{d.getCancel()||(d.events.auctionCb.done=!0,c.loadTags(e))}},customNativeRender:e=>{dt(e,r)},directRenderFn:()=>{}})})}),dt=(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},l.get()),null==d||d.postMessage(JSON.stringify({message:"Prebid Response",ad:"\x3c!-- nothing --\x3e",adId:r.adId}),"*")},lt="0123456789abcdefghijklmnopqrstuvwxyz",ct=e=>{window.apntag.anq.push(e)},ut=new Promise(e=>{"undefined"!=typeof document&&document.prerendering?document.addEventListener("prerenderingchange",()=>e()):e()}),vt=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})}),pt=e=>{const t=e.split("-"),n=t[t.length-1];return 6===n.length&&n.match(/^[a-zA-Z0-9]+$/)?t.slice(0,-1).join("-"):e};let gt="";const ht=new Map,mt="advertory-wallpaper-background",yt="advertory-with-horseshoe",ft=()=>{const e=document.querySelector(`.${mt}`);e&&e.remove()},wt=e=>{const t=e.getBoundingClientRect().top;requestAnimationFrame(()=>(e=>{if(!document.body)return;const t=document.querySelector(`.${mt}`);t&&t.style.setProperty("top",`${e}px`)})(t+15))},bt=/^wallpaper:url:(http[s]?:\/\/)?[^\s(["<,>]*\.[^\s[",><]*/,Et=e=>{if(window.location.href.includes("collapse_ad=0"))return;const t=document.querySelector(`div[id^="${e}"]`);if(!t)return;const n=t.parentElement;n&&(t.style.setProperty("width","0","important"),t.style.setProperty("height","0","important"),t.style.setProperty("display","none","important"),n.style.setProperty("display","none","important"),e.includes("wallpaper")&&ft())},Tt=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"))},It=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`)},kt=e=>{const t=e.parentElement;if(!e||!t)return;const{container:n,wrapper:i}=(e=>{const t=ce.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},At=()=>{ft();document.querySelectorAll('[data-advertory-ad-rendered="true"]').forEach(e=>{Et(e.id),kt(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=pt(e.id)}),ct(()=>window.apntag.clearRequest())},St="noGroupedPlacements",Ct=e=>{const t=e.replace(/[0-9]/g,"");return"_"===t.slice(-1)?t.substring(0,t.length-1):t},Ot=e=>{if(!(null==e?void 0:e.minViewWidth))return!0;return window.innerWidth>=e.minViewWidth},Pt=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}=l.get(),r=n[o].filter(Ot)||[],s=e?document.querySelector(e):document;if(!s)return[];const a=r.reduce((e,t)=>{const n=Ct(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),c=Array.from(d).filter(({id:e})=>e.match(t)).map((e,t)=>{var i;const o=$t(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+=lt[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&&ce.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}=l.get();return(null==t?void 0:t.includeCountingKeywordInTags)?(gt!==window.location.pathname&&(ht.clear(),gt=window.location.pathname),e.map(e=>{var t;const n=e.invCode.replace(/_\d+$/,""),i=null!==(t=ht.get(n))&&void 0!==t?t:0;return e.keywords=Object.assign({},e.keywords),e.keywords[`${O()}-count`]=i,ht.set(n,i+1),e})):e})(c)});return(e=>{const t=Array.from(document.querySelectorAll('div[class^="advertory"]'));return e.sort((e,n)=>t.findIndex(t=>t.id===e.id)-t.findIndex(e=>e.id===n.id))})(a)},$t=(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},Lt=e=>{const{queryConfig:{placementBatches:t}={},deviceType:n}=l.get(),i=(null==t?void 0:t[n])||{},o=Object.values(i).flat(),r=(e=>{const t={};return e.forEach(e=>{const n=pt(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(pt(e.id)));return n})(e,i),a=Object.keys(r),d=((e,t)=>e.filter(e=>!t.has(pt(e.id))))(e,new Set([...a,...o]));return Object.assign(Object.assign(Object.assign({},s),r),{[St]:d})},xt=(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])}},Nt=["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(t){return e(this,void 0,void 0,function*(){var e,n,i;const o=yield this.identityFacade.getIdentityUser(),r=null!==(i=yield null===(n=null===(e=this.tracker)||void 0===e?void 0:e.getEnvironmentId)||void 0===n?void 0:n.call(e))&&void 0!==i?i:"",s=(null==o?void 0:o.userId)?String(o.userId):"",a=this.buildUrl(t,{envId:r,spid:s});try{u("Starting fetching DrEdition ad from URL:",a);const e={method:"GET"},t=yield _.get(a,e);return u("Fetch operation completed successfully."),t}catch(e){u("Error during fetch operation:",e)}return null})}}let _t=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(t,n){return e(this,void 0,void 0,function*(){const{id:e,autoplay:i,mute:o,videoLoop:r,vendor:s}=n.videoConfiguration;t.classList.add("vgtv-video-container"),Object.assign(t.dataset,{vgtvVideoId:e,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 qt=e=>{const t=e.parentElement;t?t.classList.remove("dr-edition-lock-height"):u("Dr. Edition container does not have a parent element, cannot remove height lock.")};class Dt{constructor(e,t,n,i){this.drEditionService=e,this.rendererManager=t,this.videoManager=n,this.pulseManager=i,this.drEditionAds=[]}fetchAndRenderAd(t,n){return e(this,void 0,void 0,function*(){var e,i;const{drEditionConfig:{containerSelector:o},renderAsBackfill:r=!1}=n,s=t.querySelector(o);if(!s)return void u(`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?(u("No Dr. Edition ads available to render. Collapsing whole placement."),Et(t.id),void qt(s)):((null==a?void 0:a.itemId)&&r&&(u("Dr. Edition ad available to render as a Xandr backfill."),Tt(t.id)),void(a?(a.css&&((e,t)=>{const n=document.createElement("link");n.rel="preload",n.href=e,n.as=t,document.head.appendChild(n)})(a.css,"style"),yield this.rendererManager.render(s,a,n),yield null===(e=this.videoManager)||void 0===e?void 0:e.handle(a,n),qt(s),this.drEditionAds.push(a),window.advertory=window.advertory||{},window.advertory.renderedDrEditionAds=window.advertory.renderedDrEditionAds||[],window.advertory.renderedDrEditionAds.push(a.itemId),this.observeAdView(t,a,n),null===(i=t.querySelector("a"))||void 0===i||i.addEventListener("pointerup",()=>null)):qt(s))):(u("No Dr. Edition ads available to render. Hiding Dr. Edition and rendering Xandr backfill."),this.hideDrEdition(s),this.showBackfill(t),void qt(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:"";Tt(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 Mt{constructor(e,t){this.newsroomStrategy=e,this.pulseManager=t}render(t,n,i){return e(this,void 0,void 0,function*(){if(!(null==n?void 0:n.itemId))return;const{getConsentAsync:e}=I(i.tcf,i.isMobileApp,i.country),o=yield e(),r=i.device===X.MOBILE?n.mobileHTML:n.desktopHTML;const s=o?r:r.replace(/<img [^>]*class="tracking-pixel"[^>]*>/g,"");t.innerHTML=s,t.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 Bt{constructor(e){this.strategy=e}handle(t,n){return e(this,void 0,void 0,function*(){const{videoConfiguration:{id:e,preview:i}={}}=t;(e||i)&&(yield this.importScript(n),yield this.createVideoElement(t,n))})}importScript(t){return e(this,void 0,void 0,function*(){const e=t.drEditionConfig.videoScriptUrl,n=document.querySelector(`script[src="${e}"]`);if(e&&!window.autoplayQueue&&!n)try{yield ge(e)}catch(e){u("Error! Failed to prepare SVP player script for Dr. Edition!",e)}})}createVideoElement(t,n){return e(this,void 0,void 0,function*(){const e=document.createElement("div"),{node:i}=t.videoConfiguration,o=[...document.querySelectorAll(`#${i}`)||[]].find(e=>0===e.children.length);if(this.handlePreviewVideo(t,n))return;this.strategy.handleVideo(e,t),null==o||o.appendChild(e),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 Rt=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(t,n,i){return e(this,void 0,void 0,function*(){var e,o,r,s,a,d,l,c;if(!this.pulse)return;const u=this.getEventInput(t,n,i,"view");(null===(e=this.pulse)||void 0===e?void 0:e.trackLegacyViewUIElement)?null===(r=null===(o=this.pulse)||void 0===o?void 0:o.trackLegacyViewUIElement)||void 0===r||r.call(o,u):(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,u):null===(c=null===(l=this.pulse)||void 0===l?void 0:l.trackElementView)||void 0===c||c.call(l,u)})}trackContentClick(t,n,i){return e(this,void 0,void 0,function*(){var e,o,r,s,a,d;if(!this.pulse)return;const l=this.getEventInput(t,n,i,"click");this.pulse.trackLegacyClickUIElement?null===(o=(e=this.pulse).trackLegacyClickUIElement)||void 0===o||o.call(e,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 Ft extends Rt{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 Vt=class extends Rt{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 Ut={FRONT:"front"},Ht=(e,t)=>{null==t||t.forEach(t=>{const n=window.SVP.Player.Plugins.get(t);e.addPlugin(new n)})},zt=t=>e(void 0,void 0,void 0,function*(){var e,n;return(null===(e=null===window||void 0===window?void 0:window.SVP)||void 0===e?void 0:e.Player)?new window.SVP.Player(t):((()=>{const e="svp-player-sdk",t=document.querySelector(e),n=Array.from(document.querySelectorAll('script[src^="https://cdn.stream.schibsted.media/player"]'));if(t||n.length>0)return;const i=document.createElement("script");i.id=e,i.src="https://cdn.stream.schibsted.media/player/3.78.1/player.min.js",i.async=!0;try{i.src=i.src.replace("player.min","player.next.min")}catch(e){console.error("Failed to set player.next.min source:",e)}document.head.insertBefore(i,document.head.firstChild)})(),(null===(n=window.SVP)||void 0===n?void 0:n.isLoaded)?new window.SVP.Player(t):yield new Promise(e=>{window.addEventListener("onSvpPlayerReady",()=>e(new window.SVP.Player(t)))}))}),Wt={ContentMutePlugin:e=>{window.SVP.Player.Plugins.register({getName:()=>"ContentMutePlugin",initialize(){},setup(){const t=this.player.config.get("mute");this.container=e||this.player.getContainer(),this.muted=t,t&&this.listenToOnce(this.player,"ready",this.renderButtonElement,this)},getButtonElement(){const e=document.createElement("button");e.className="player-plugin-content-mute";const t=document.createElement("span");return t.className="volume-button-icon",e.appendChild(t),e},renderButtonElement(){this.buttonElement=this.getButtonElement(),this.buttonElement.addEventListener("click",this.onButtonClick.bind(this)),this.container.appendChild(this.buttonElement),this.isVideo()||(this.buttonElement.style.display="none"),this.getJWPlayer()&&this.getJWPlayer().on("mute",this.onMuteChange,this)},onButtonClick(){this.getJWPlayer()&&(this.container.classList.add("has-interacted"),this.muted=!this.muted,this.getJWPlayer().setMute(this.muted))},onMuteChange(e){this.muted=e.mute,this.muted?this.buttonElement.classList.remove("content-video-volume-on"):this.buttonElement.classList.add("content-video-volume-on")},isVideo(){return"video"===this.player.getRawAsset().assetType},getJWPlayer(){return this.player.model.player}})},IntegrationMenu:()=>{window.SVP.Player.Plugins.register({getName:()=>"IntegrationMenu",setup(){return e(this,void 0,void 0,function*(){yield Promise.resolve().then(function(){return hr})})}})}},Kt=(e,t)=>{null==e||e.forEach(e=>{Wt[e](t)})};class Jt{handleVideo(t,n){return e(this,arguments,void 0,function*(t,{videoConfiguration:{id:n,node:i,autoplay:o,mute:r,vendor:s}}){yield e(void 0,void 0,void 0,function*(){return yield new Promise(e=>{var t;Boolean(null===(t=window.SVP)||void 0===t?void 0:t.Player)?e(!0):window.addEventListener("onSvpPlayerReady",()=>e(!0))})});const a=["ContentMutePlugin"],d=this.createPlayerOverlay(t);Kt(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 zt(l);c.once("assetReady",()=>{Ht(c,a)}),c.once("ready",()=>{const e=t;new MutationObserver(t=>{t.forEach(({type:t,attributeName:n})=>{"attributes"===t&&"class"===n&&(e.classList.contains("jw-state-playing")?d.classList.add("is-playing"):d.classList.remove("is-playing"),e.classList.contains("jw-flag-user-inactive")?d.classList.add("is-inactive"):d.classList.remove("is-inactive"))})}).observe(e,{attributes:!0,attributeFilter:["class"]})}),c.once("PulseStats:ready",()=>e(this,void 0,void 0,function*(){const e=yield c.getPlugin("PulseStats").getTracker();null==e||e.update({provider:{id:"e24",productTag:"partnerstudio"}})}))})}getPulseObjectId(){return"sdrn:e24:content:partnerstudio:element:partnerstudio:stats"}getPulsePageId(e,t){return e===Ut.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 Gt="https://www.aftonbladet.se/video-player-extras/latest/";class Yt{handleVideo(t,n){return e(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:{[`${Gt}cta-button.js`]:{name:"CtaButton",options:{type:"unmute"}},[`${Gt}external-link.js`]:{name:"ExternalLink"}}};yield zt(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 Qt=e=>null!==e&&"object"==typeof e&&!Array.isArray(e);class Xt{handleVideo(t,n){return e(this,arguments,void 0,function*(t,{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({},Qt(e)?e:{}),{provider:Object.assign(Object.assign({},Qt(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 zt(a);d.once("PulseStats:ready",()=>e(this,void 0,void 0,function*(){const e=yield d.getPlugin("PulseStats").getTracker();null==e||e.update({provider:{id:"svdse",productTag:"partnerstudio"}})}))})}getPulseObjectId(){return"sdrn:svdse:content:partnerstudio:element:partnerstudio:stats"}getPulsePageId(e,t){return e===Ut.FRONT?"sdrn:svdse:frontpage:front":`sdrn:svdse:article:${t}`}}let Zt=class{handleVideo(e,t){}getPulseObjectId(){return""}getPulsePageId(e,t){return""}};const en=(e,t,n)=>{var i;const{publisher:o,pageType:r,country:s}=e,a={[se.VG]:new _t,[se.E24]:new Jt,[se.AFTONBLADET]:new Yt,[se.SVD]:new Xt}[o]||new Zt,d=new(s===w.SE?Ft:Vt)(n,a,r),l=new jt(t,null!==(i=null==n?void 0:n.pulseTracker)&&void 0!==i?i:n),c=new Mt(a,d),u=new Bt(a);return new Dt(l,c,u,d)},tn=()=>e(void 0,void 0,void 0,function*(){return yield new Promise(e=>{if("undefined"!=typeof window)if(window.Identity)e(window.Identity);else{const t=()=>{e(window.Identity)};window.addEventListener("identity-initialized",t,{once:!0})}else e(void 0)})});class nn{constructor(e){this.identity=e,this.getIdentityUser=this.getIdentityUser.bind(this),this.isUserLoggedIn=this.isUserLoggedIn.bind(this),this.onIdentityLogout=this.onIdentityLogout.bind(this)}getIdentityUser(){return e(this,void 0,void 0,function*(){var e;try{const t=yield null===(e=this.identity)||void 0===e?void 0:e.getUser();return null!=t?t:null}catch(e){return u("[Privacy Broker] User is not logged in."),null}})}isUserLoggedIn(){return e(this,void 0,void 0,function*(){var e,t;return null!==(t=yield null===(e=this.identity)||void 0===e?void 0:e.isLoggedIn())&&void 0!==t&&t})}onIdentityLogout(e){var t;null===(t=this.identity)||void 0===t||t.on("logout",e)}}const on=(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=en(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))},rn=[],sn=(t,n)=>e(void 0,void 0,void 0,function*(){var e;const{pulse:i,tcf:o,deviceType:r,drEdition:s,publisher:a,pageType:d,country:l,isMobileApp:c}=t;if(!(yield k(o,c,l,"handleDrEditionBackfill")))return;const v=((e,t)=>{var n;const{deviceType:i,placements:o,drEdition:{fallbackGlobalEditionName:r}={}}=e,s=o[i]||o.desktop,a=pt(t.targetId),d=s.find(e=>e.id===a),l=Nt.some(e=>a.startsWith(e)),c=rn.includes(a),u=(null===(n=null==d?void 0:d.drEdition)||void 0===n?void 0:n.editionName)||r;return d&&l&&!c&&u?(rn.push(a),Object.assign(Object.assign({},d),{drEdition:Object.assign(Object.assign({},d.drEdition),{editionName:u})})):null})(t,n);if(!v)return;if(!(null==i?void 0:i.instance))return void u("Pulse has not been passed as a prop, aborting");const p=yield tn(),g=new nn(p),h=en({publisher:a,pageType:d,country:l},g,null==i?void 0:i.instance),m=document.getElementById(n.targetId);if(!m||!s)return;m.classList.value="";const y=document.createElement("div");y.className=s.containerSelector.replace(/^[.#:[\]]+/,""),m.innerHTML=y.outerHTML;const f={editionName:(null===(e=null==v?void 0:v.drEdition)||void 0===e?void 0:e.editionName)||"",drEditionConfig:s,device:r,tcf:o,isMobileApp:c,country:l,renderAsBackfill:!0};yield h.fetchAndRenderAd(m,f)}),an="collapseAd",dn="hideAd",ln="resizeAd",cn="renderDrEditionFallback",un="wallpaperImageUrl",vn="wallpaperColor",pn="velvet",gn=[ln,un,vn,an,dn,cn,pn];let hn;const mn=e=>{if("object"==typeof e)return e;if(t=e,bt.test(t)){const t=e.replace(/^wallpaper:url:/,"");return{name:un,wallpaperImageUrl:t}}var t;if((e=>e.startsWith("wallpaper:color:"))(e)){const t=e.replace(/^wallpaper:color:/,"");return{name:vn,wallpaperColor:t}}if(e.startsWith(cn)){const t=e.split(":")[1];return{name:cn,targetId:t}}if(e.startsWith(an)||e.startsWith(dn)){const t=e.split(":")[1];return{name:an,targetId:t}}if(e.includes("name")&&gn.some(t=>e.includes(t)))try{return JSON.parse(e)}catch(e){}},yn=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=mn(t);if(!n)return;if(!n.name||!gn.some(e=>n.name===e))return;const{name:i,targetId:o,wallpaperImageUrl:r,wallpaperColor:s,cmd:a,size:d}=n;i===pn&&a&&(a.includes("noScroll")&&(hn=(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==hn||hn(),dispatchEvent(new CustomEvent("advertory:closeTakeover",{})))),i!==an&&i!==dn||!o||Et(o),i===ln&&o&&a&&xt(o,a),i===cn&&o&&(Et(o),sn(l.get(),{targetId:o})),"resizeMediationAd"===i&&o&&d&&xt(o,d,!0),i===un&&r&&(e=>{const t=document.querySelector(`.${mt}`);t&&(t.style.backgroundImage=`url(${e})`)})(r),i===vn&&s&&(e=>{const t=document.querySelector(`.${mt}`);t&&(t.style.backgroundColor=e)})(s)},fn=e=>({rootMargin:`${e}px 0px ${e}px 0px`}),wn=()=>{const{publisher:t,country:n,finnBlink:i}=l.get(),{loadFinnBlinkAd:o,wallpaperHandlers:{adjustAdToHorseshoe:r}}=l.getHandlers(),s=window.apntag,a={publisher:t,country:n,finnBlink:i},d=e=>{Tt(e),ct(()=>s.showTag(e))};return{withXandrAd:d,withFinnBlinkAd:t=>e(void 0,void 0,void 0,function*(){yield o(t,a,null)}),withFullAdsChain:t=>e(void 0,void 0,void 0,function*(){yield o(t,a,d,()=>{ce.getData("horseshoe").isAvailable&&r(t)})})}},bn=(e,t,n)=>{const i="true"===n.dataset.isFinnBlinkOnlyPlacement;return Ne(t)&&i?(u(`loading finn blink ad for blink only placement for ${t}`),void wn().withFinnBlinkAd(t)):Ne(t)?(u(`loading finn blink ad with full ads chain for ${t}`),void wn().withFullAdsChain(t)):void ct(()=>(u("core showTag",{id:t}),e.showTag(t)))},En=(t,n)=>e(void 0,void 0,void 0,function*(){yield ut,yield vt;const e=new IntersectionObserver((e,n)=>((e,t,n,i)=>{e.filter(({isIntersecting:e,target:{id:t}})=>e&&!t.includes("wallpaper")).forEach(e=>{const{target:o}=e,r=(e=>{const t=e.dataset.showTagSubscribeId;return!e.id.length&&t?t:e.id})(o),s=document.getElementById(r);u("core log from intersection observer handler",{targetId:r,element:s}),n(window.apntag,r,i),s&&(t.unobserve(s),t.disconnect())})})(e,n,bn,t),fn(n));e.observe(t)}),Tn=new Map,In=["no-stavangeraftenblad","sa","no-aftenposten","aftenposten","no-bergenstidende","bt"],kn=".brandstudio-premium-content-widget",An=({adWrapper:e,placementContainer:t})=>t.offsetHeight+(({adWrapper:e})=>{const{paddingTop:t,paddingBottom:n}=getComputedStyle(e);return parseFloat(t)+parseFloat(n)})({adWrapper:e}),Sn=({adWrapper:e,placementContainer:t})=>{const n=An({adWrapper:e,placementContainer:t});var i;null==e||e.style.setProperty("height",`${n}px`),kt(i=t),i.innerHTML=""},Cn=e=>{e&&e.style.getPropertyValue("height")&&e.style.removeProperty("height")},On=({adWrapper:e,placementContainer:t})=>{const{publisher:n}=l.get(),i=In.includes(n)&&Boolean(t.closest(kn));const o=i?t.closest(kn):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 Cn(e),void r.disconnect();const a=t.closest('[style*="height"]'),d=o;a&&d.contains(a)?Cn(a):d.hasAttribute("style")&&Cn(d),r.disconnect()})})});try{r.observe(t,{childList:!0,subtree:!0})}catch(e){r.disconnect()}},Pn=(e,t,n,i,o,r)=>{var s;const a=performance.now(),d=null!==(s=Tn.get(t))&&void 0!==s?s:0,l=((e,t)=>!!t&&e+t<(new Date).getTime())(i,o)&&n<0;a-d>=o&&l&&(Tn.set(t,a),((e,t,n)=>{const i=null==n?void 0:n.parentElement;i&&n&&Sn({adWrapper:i,placementContainer:n}),ct(()=>{e.setKeywords([t],{[`${C()}-adreload`]:"1"},{overrideKeyValue:!0}),e.refresh([t])})})(e,t,r))},$n=(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,Pn,t,n),fn(300));i.observe(e)},Ln=(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},xn=()=>navigator&&navigator.userAgent.match(/chrome/i)?null:navigator&&navigator.userAgent.match(/apple/i),Nn=(e,t=0)=>{const n=e.getBoundingClientRect(),i=window.innerHeight;return n.bottom>-t&&n.top<i+t},jn=e=>{const{refreshConfig:{visibilityStateRefreshEnabled:t=!1}={}}=l.get();if(!t)return;const n=()=>{"visible"===document.visibilityState&&document.removeEventListener("visibilitychange",n),Bn(e)};"visible"!==document.visibilityState&&document.addEventListener("visibilitychange",n)},_n=(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;Nn(o,r)&&i&&(It(i.id),n.length&&o.classList.remove(...n),Bn([i],t))}},qn=e=>{const{refreshConfig:{backForwardNavigationRefreshEnabled:t=!1}={},siteSpecificConfig:{classesToRemoveOnRefresh:n=[]}={},isMobileApp:i}=l.get();t&&(e.forEach(({id:e})=>{const t=Dn(e);t&&(t.dataset.bfCacheRefresh="true")}),i?((e,t)=>{document.addEventListener("visibilitychange",()=>{_n(e,!0,t)})})(e,n):((e,t)=>{window.addEventListener("pageshow",n=>{const i=()=>{window.scrollY>0&&(window.removeEventListener("scroll",i),_n(e,!1,t))};n.persisted&&(xn()?window.addEventListener("scroll",i,{passive:!0}):_n(e,!1,t))})})(e,n))},Dn=e=>{var t,n;return null!==(n=null===(t=document.querySelector(`#${e}`))||void 0===t?void 0:t.parentElement)&&void 0!==n?n:null},Mn=e=>{const{id:t,allowedFormats:n}=e,i=(e=>{if(!e)return[];try{return JSON.parse(e.dataset.adSizes||"[]")}catch(e){return[]}})(Dn(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},Bn=(e,t=!1)=>{const{requestSize:n=a}=l.get(),i=e.map(({id:e})=>e),o=Ln(i,n);if(t)for(const t of e){const e=Mn(t);window.apntag.modifyTag(t.id,e)}for(const e of o)ct(()=>window.apntag.refresh(e))};const Rn="#fff",Fn="#0098da",Vn="splash",Un="welcomePage",Hn="topscroller",zn="velvet",Wn="takeover-displayed",Kn="takeover-visit-count",Jn=14400,Gn=()=>{const e=Y(Kn);return e?parseInt(e):0},Yn=()=>{const{takeover:{enabled:e=!1,secondVisitEnabled:t=!1}={}}=l.get();return!window.location.href.includes("takeover=0")&&(!!window.location.href.includes("takeover=1")||!(!e||(()=>{var e;const t=(null===(e=l.get().takeover)||void 0===e?void 0:e.cookieCapName)||Wn;return"true"===Y(t)})())&&(!t||Qn()))},Qn=()=>{const e=Gn();return 0===e?((()=>{const e=Gn(),{takeover:{cookieCapTime:t=Jn}={}}=l.get(),n=document.location.hostname;window.document.cookie=`${Kn}=${e+1}; max-age=${t}; domain=${n}; path=/`})(),!1):1===e},Xn=(e,t)=>[[1,1],[1920,1080]].some(([n,i])=>n===e&&i===t),Zn=()=>{const{takeover:e}=l.get();return Boolean(null==e?void 0:e.topscroller)},ei=()=>e(void 0,void 0,void 0,function*(){const e=document.location.hostname,{takeover:{cookieCapName:t=Wn,cookieCapTime:n=Jn}={},isMobileApp:i,tcf:o,country:r}=l.get(),s=yield k(o,i,r,"ad-takeover-cookiecap");n&&s&&(window.document.cookie=`${t}=true; max-age=${n}; domain=${e}; path=/`)}),ti=e=>{var t;const n=!!(null===(t=l.get().takeover)||void 0===t?void 0:t.setCookieCapForNotShownAd);return Oe(e)&&n},ni=(e,t)=>{var n;if(t===Hn){const{topscroller:t}=e;return null!=t?t:{}}if(t===Vn){const{splash:t}=e;return null!=t?t:{}}return null!==(n=e.welcomePage)&&void 0!==n?n:{}},ii=(e,t)=>{t!==Vn?(e=>{var t,n,i;const o=null===(n=null===(t=l.get().takeover)||void 0===t?void 0:t.welcomePage)||void 0===n?void 0:n.headerElementSelector,r=null===(i=l.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}`),c=document.querySelector(".advertory-welcome-page-scroll");if(!(s&&a&&c&&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"),c.style.setProperty("bottom",p,"important")})(e):(e=>{var t;if(!(null===(t=l.get().takeover)||void 0===t?void 0:t.splash))return;const n=document.querySelector(".advertory-splash-navbar-wrapper"),i=document.querySelector(`#${e.targetId}`);if(!n||!i)return;const o=`calc(100svh - ${n.offsetHeight}px)`;i.style.setProperty("height",o,"important")})(e)},oi=Ve([],()=>{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})}),ri=(e,t=!0)=>{(e===Un||e===Hn)&&(e=>{e?setTimeout(()=>window.scrollTo(0,0),100):window.scrollTo(0,10)})(t)},si=()=>{const e=parseInt(document.body.dataset.scrollY||"0",10);document.body.style.top="",window.scrollTo(0,e),document.body.classList.remove("page-locked")},ai=e=>{document.body.style.overflow=e?"initial":"hidden"},di=e=>{const t=ci(e),n=li(e);(e=>{e.classList.toggle("takeover-ad-hidden",!0)})(e),ai(!0),e.style.display="none",window.removeEventListener("keydown",t),window.removeEventListener("advertory:closeTakeover",n)},li=e=>{const t=()=>di(e);return window.addEventListener("advertory:closeTakeover",t),si(),t},ci=e=>{const t=t=>{["Enter","Escape"].includes(t.key)&&di(e)};return si(),window.addEventListener("keydown",t),t},ui=e=>{const t=e.querySelector(".advertory-splash-navbar-wrapper");t&&(ci(e),li(e),si(),t.addEventListener("click",()=>{di(e)}),ai(!1))},vi=e=>{(e=>{window.addEventListener("scroll",()=>{e.getBoundingClientRect().bottom,(e=>{const t=e.getBoundingClientRect().bottom;e.style.opacity=""+t/e.offsetHeight})(e)},{passive:!0})})(e),li(e);const t=document.querySelector("header");document.querySelectorAll(".smooth-close-takeover").forEach(e=>e.addEventListener("click",()=>null==t?void 0:t.scrollIntoView({behavior:"smooth"})))},pi=e=>{(e=>{window.addEventListener("advertory:closeTakeover",()=>di(e))})(e)},gi=e=>{const{takeover:{splash:{showAnnonsLabel:t=!1}={}}={}}=l.get(),n=e.querySelectorAll(".advertory-splash-navbar-wrapper"),i=document.querySelector(".advertory-takeover-label");Array.from(n).forEach(e=>e.style.display="flex"),t&&i&&(i.style.display="flex",i.innerText=et.se.adText),e.classList.toggle("advertory-splash-wrapper",!0)},hi=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=et.no.adText,n.classList.add("takeover-topscroller-label"),e.classList.toggle("topscroller-wrapper",!0))},mi=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=et.se.adText,e.classList.toggle("welcome-page-wrapper",!0))},yi=e=>{const t=document.querySelector(".advertory-takeover-label");t&&(t.style.display="flex",t.innerText=et.se.adText,e.classList.toggle("advertory-impact-wrapper",!0))},fi=()=>{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)},wi=(e,t)=>{let n=e;return e.includes("529299503")&&(n=(e=>{const t=document.createElement("script");return t.textContent=`(${oi})()`,e+t.outerHTML})(e)),n},bi=e=>{const t=(e=>{const{requests:t}=window.apntag,n=Fe(e)?1:0;return null==t?void 0:t.tags[e].adResponse.ads[n].rtb.banner.content})(e);if(!t)return;((e,t)=>{const{requests:n}=window.apntag,i=Fe(e)?1:0;n&&(n.tags[e].adResponse.ads[i].rtb.banner.content=t)})(e,wi(t))},Ei=t=>e(void 0,void 0,void 0,function*(){const{takeover:e}=l.get(),{targetId:n}=t,i=document.querySelector(`#${n}`),o=document.querySelector(".advertory-takeover-wrapper");if(!i||!o||!e)return;const r=(e=>{const{width:t,height:n}=e;return Xn(t,n)?Vn:Be(e,be)?zn:Zn()?Hn:Un})(t),s=o.offsetHeight,a=window.scrollY>s;o.style.display="block",!a&&ri(r,!1),((e,t)=>{({[Un]:mi,[Vn]:gi,[Hn]:hi,[zn]:yi})[t](e)})(o,r),fi(),((e,t)=>{({[Un]:vi,[Hn]:vi,[Vn]:ui,[zn]:pi})[t](e)})(o,r),((e,t,n)=>{if(!n)return;({[Un]:()=>{const{buttonLabel:i}=ni(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:"")})},[Vn]:()=>{const{themeColors:i,logotype:o,buttonLabel:r,showArrowIcon:s}=ni(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:Rn,"important"),n.style.color=null!=t?t:Fn}}})},[Hn]:()=>{const{buttonLabel:i,showArrowIcon:o,showCloseButton:r=!0}=ni(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:""))})},[zn]:()=>{}})[t]()})(o,r,e),yield ei(),!a&&ri(r,!0),ii(t,r)}),Ti="advertory-brandmetrics-survey",Ii=()=>e(void 0,void 0,void 0,function*(){const{norstat:{enabled:t}={},country:n,isMobileApp:i,tcf:o}=l.get(),r=yield k(o,i,n,"norstat");if(!t||i||!r)return;const s=(e=>{const{ppid1:t,ppid2:n}=z.getPPIDs(),{ppid1:i,ppid2:o}=W.getPPIDs(),r=(new H).add(n,D[e]).add(t,M[e]).add(o,B[e]).add(i,R[e]);return`${r.buildNorstatPath()}?${r.buildNorstatQuery("alias").toString()}`})(n);((t,n,...i)=>{e(void 0,[t,n,...i],void 0,function*(e,t,n=!0){if(document.getElementById(t))return;const i=document.createElement("img");i.src=e,i.id=null!=t?t:"",n&&(i.style.display="none"),document.body.appendChild(i)})})(`https://sch-map.norstatsurveys.com/api/nids/${n===w.NO?"schibsted":"schibstedse"}/map/${s}`,"norstat")}),ki={nativeAd:e=>Se(e)&&!xe(e),buyrecipe:e=>e.targetId.startsWith("buyrecipe"),fullwidthAd:Ce,fullscreenScroll:Ae,topscroller:e=>Oe(e)&&Zn(),splash:e=>Oe(e)&&Xn(e.width,e.height),welcomePage:Oe,wallpaper:$e,skyscraper:e=>e.targetId.includes("skyscraper")&&!!e.banner,lFormat:De,hFormat:Me,toppanorama:e=>e.targetId.startsWith("toppanorama")&&!Me(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},Ai=({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(ki))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)},Si=e=>{var t;return(null===(t=Object.entries(ki).find(([,t])=>t(e)))||void 0===t?void 0:t[0])||""},Ci=(e,t)=>{const n=e.width,i=(null!=t?t:window.screen.width)/n;return i<1?i:1},Oi=new Map;Oi.set("insider",{scale:.82,transformOrigin:"left center",cogwheelAdjust:!0}),Oi.set("panorama",{scale:.79,transformOrigin:"center center"}),Oi.set("outstream",{scale:.79,transformOrigin:"center center"}),Oi.set("integration",{scale:.79,transformOrigin:"center center"}),Oi.set("toppanorama",{scale:.8,transformOrigin:"left center"});const Pi=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=Si(e),o=Oi.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")},$i=e=>{var t,n,i,o,r,s;const{adScaleConfig:a,deviceType:d}=l.get();if(!(null==a?void 0:a.enabled))return;if(Be(e,me))return;const c=null!==(t=a.adsToBeScaled[d])&&void 0!==t?t:[],u=Ct(e.targetId.split("-")[0]);if(!c.includes(u))return;const v=null!==(i=null===(n=a.offset)||void 0===n?void 0:n[u])&&void 0!==i?i:0,p=document.getElementById(e.targetId),g=null!==(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=Ci(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)},Li=(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,xi=e=>`externalImpId:'${e}'`,Ni=e=>{var t;const{forwardExternalImpId:n=!1,tracker:i}=l.get(),o=(e=>{var t;if(!e.positionConfig)return e;const n=e.keywords[`${O()}-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:c,ssa:v=!1,nativeCustomProperties:p,safeframeConfig:g,dynamicSizeWidthCheck:h=!1}=(e=>{var t;if(!e.takeoverCookieCapForSharedPlacement||Yn())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!==Hn),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:c,sizes:s,targetId:r,keywords:Li(a,v),allowedFormats:d,dynamicSizeWidthCheck:h},g&&{safeframeConfig:g}),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)?(u("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):(u("Tracker state does not contain field pageViewId or it is empty"),""):(u("Tracker state is empty"),""):(u("Tracker is not configured in initAdvertory function"),"")})(i);n&&y&&(u("External Impression ID assigned to defineTag:",xi(y)),m.externalImpId=xi(y));const f=(e=>Object.entries({video:{required:!1},address:{required:!1},saleprice:{required:!1},rating:{required:!1},price:{required:!1},phone:{required:!1},likes:{required:!1},downloads:{required:!1},customIcon2:{required:!1}}).reduce((t,[n,i])=>((null==e?void 0:e.includes(n))&&(t[n]=i),t),{customTitle1:{required:!1},customTitle2:{required:!1},customTitle3:{required:!1},customTitle4:{required:!1},title:{required:!1},body:{required:!1},image:{required:!1},icon:{required:!1},sponsoredBy:{required:!1},cta:{required:!1},clickUrl:{required:!1},desc2:{required:!1},displayUrl:{required:!1},description:{required:!1}}))(p);return(null===(t=e.allowedFormats)||void 0===t?void 0:t.includes("native"))&&(m.native=f),m},ji=e=>!e.includes("takeover")||Yn(),_i=e=>{const{source:t}=e;return"csm"===t},qi=(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},Di="finn-blink",Mi="native-ad",Bi=e=>{const{publisher:t=""}=l.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`)},Ri=e=>{if(!e)return e;const t=e[`${C()}-targetid`],n=t?pt(t[0]):"";return Object.assign(Object.assign({},e),t&&{[`${C()}-targetid`]:[n]})},Fi=e=>Object.assign(Object.assign(Object.assign(Object.assign({},e),e[`${C()}-geo`]&&{[`${C()}-geo`]:["geo-test-value"]}),e[`${C()}-geofence`]&&{[`${C()}-geofence`]:["geofence-test-value"]}),e[`${C()}-weather`]&&{[`${C()}-weather`]:["weather-test-value"]}),Vi=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"})})()},Ui=(t,n)=>e(void 0,void 0,void 0,function*(){return yield new Promise(e=>{t().then(t=>{e(null!=t?t:null)}).catch(t=>{e(null)})})}),Hi=()=>e(void 0,void 0,void 0,function*(){try{(()=>{const e=document.createElement("script");e.setAttribute("src","https://ads.inventory.schibsted.io/ad-service/ad-banner-sponsor-advertisement/ad.js"),e.setAttribute("type","text/javascript"),e.setAttribute("async","true"),document.head.appendChild(e)})(),(()=>{const e=document.createElement("div");e.setAttribute("id","ads-advertory-anchor"),e.classList.add("subscribe_box"),e.classList.add("ad-box"),e.classList.add("leftAd"),e.classList.add("netboard"),e.classList.add("advert"),e.classList.add("module"),e.classList.add("banner"),e.classList.add("leaderboard"),e.classList.add("adsbygoogle"),e.classList.add("ad-banner"),e.classList.add("ad-container"),e.classList.add("adsbox"),e.classList.add("sidebar-ads"),e.classList.add("banner-ads"),e.style.opacity="0",e.style.width="1px",e.style.height="1px",e.style.minWidth="0px",e.style.minHeight="0px",e.style.maxWidth="1px",e.style.maxHeight="1px",e.style.position="absolute",e.style.top="0",e.style.boxSizing="border-box",e.style.margin="0",e.style.padding="0",document.body.appendChild(e)})()}catch(e){console.error("Error running adblock scripts:",e)}}),zi={arrayMerge:(e,t)=>t},Wi=t=>e(void 0,void 0,void 0,function*(){if(!(e=>{const{editableConfiguration:{useS3Config:t=!1,pageTypeToFetch:n}={},siteSpecificConfig:i}=e;return Boolean(t&&n&&(null==i?void 0:i.publisherClassName))})(t))return t;try{const n=yield(t=>e(void 0,void 0,void 0,function*(){const e=(e=>{const{siteSpecificConfig:t,editableConfiguration:{pageTypeToFetch:n}={}}=e;return(null==t?void 0:t.publisherClassName)&&n?`https://alertory-cdn.staging.inventory.schibsted.io/editable-configurations/${t.publisherClassName}/${n.toUpperCase()}.json`:null})(t);if(!e)return null;const n=new AbortController,i=setTimeout(()=>n.abort(),5e3);try{return yield _.get(e,{method:"GET",signal:n.signal})}catch(t){throw u("Failed to fetch S3 config",{error:t,url:e}),t}finally{clearTimeout(i)}}))(t);return n?(({siteConfig:e,configOverrides:t})=>{var n;const{keywords:i,refresh:r,placements:s,threshold:a,batchSize:d}=t,l=o.all([e.placements,s],zi),c=o(e.pageOptions,{keywords:i},zi),u=o(e.appearanceConfig,{defaultThreshold:a},zi),v=o(null!==(n=e.refreshConfig)&&void 0!==n?n:{},{scrollRefreshEnabled:r},zi);return Object.assign(Object.assign({},e),{placements:l,requestSize:null!=d?d:e.requestSize,pageOptions:c,appearanceConfig:u,refreshConfig:v})})({siteConfig:t,configOverrides:n}):t}catch(e){return u("Error fetching S3 config, using site config",{error:e}),t}}),Ki=".advertory-right-column-track",Ji="--advertory-right-column-track-height",Gi=e=>e.getBoundingClientRect().top+window.scrollY,Yi=e=>{const{marginTop:t,marginBottom:n}=getComputedStyle(e);return e.getBoundingClientRect().height+parseFloat(t||"0")+parseFloat(n||"0")},Qi=(e,t)=>{const n=(i=t,`${Math.max(0,Math.round(i))}px`);var i;document.body.style.setProperty(e,n)},Xi=(e,t)=>`${e}-${t}`,Zi=(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=Gi(e);(()=>{const e=document.querySelector("header");if(!e)return;const t=Yi(e);Qi("--advertory-newsroom-header-height",t)})(),r.forEach(({point:e,originalIndex:t})=>{((e,t,n)=>{const i=Gi(e),o=Xi(Ji,t),r=i-n,s=Xi("--advertory-right-column-split-point-height",t),a=Yi(e);Qi(o,r),Qi(s,a)})(e,t+1,s),(e=>{const t=null==e?void 0:e.id;if(!t)return;const n=Xi("--advertory-right-column-ad-height",t),i=Yi(e);Qi(n,i)})(o[t])});((e,t)=>{const n=Gi(e);Qi(Ji,n-t)})(r[Math.min(o.length,r.length-1)].point,s)};let eo=!1;class to{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 no{getPulseObjectId(){return""}getPulsePageId(e,t){return""}}class io{constructor(e,t){this.pulse=e,this.newsroomStrategy=t}getEventInput(e,t){return{}}parseKilkayaData(e){const t=e.querySelector("article");if(!t)return{};const n=t.dataset.k5aTeaserAnalytics;try{return n?JSON.parse(n):{}}catch(e){return{}}}mapPageType(e){return{front:"Frontpage",article:"Article",section:"Article",collection:"Article",other:"Article"}[e||"front"]||"Frontpage"}getArticleId(){return location.pathname.split("/").slice(-2,-1).pop()||""}getEventTarget(e){const{url:t,title:n,itemId:i}=this.parseKilkayaData(e);return{id:i,name:this.normalizePlacementTitle(null!=n?n:""),type:"Page",url:t}}normalizePlacementTitle(e){return e.replace(/<[^>]+>/gi,"").replace(/[^a-z0-9æøå\s_-]/gi,"")}trackContentView(t){return e(this,void 0,void 0,function*(){var e,n,i,o,r,s,a,d;if(!this.pulse)return;const l=this.getEventInput(t,"view");(null===(e=this.pulse)||void 0===e?void 0:e.trackLegacyViewUIElement)?null===(i=null===(n=this.pulse)||void 0===n?void 0:n.trackLegacyViewUIElement)||void 0===i||i.call(n,l):(null===(o=this.pulse)||void 0===o?void 0:o.trackViewUIElement)?null===(s=null===(r=this.pulse)||void 0===r?void 0:r.trackViewUIElement)||void 0===s||s.call(r,l):null===(d=null===(a=this.pulse)||void 0===a?void 0:a.trackElementView)||void 0===d||d.call(a,l)})}trackContentClick(t){return e(this,void 0,void 0,function*(){var e,n,i,o,r,s;if(!this.pulse)return;const a=this.getEventInput(t,"click");this.pulse.trackLegacyClickUIElement?null===(n=(e=this.pulse).trackLegacyClickUIElement)||void 0===n||n.call(e,a):this.pulse.trackClickUIElement?null===(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 oo extends io{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 ro="[data-k5a-teaser-analytics]",so=(e,t,n)=>{const i=document.querySelectorAll("k5a-stream");if(!i.length)return;const o=new oo(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(ro);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(ro);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 ao{handleKilkayaStreamTracking({pulse:e,pageType:t,publisher:n}){if(!(null==e?void 0:e.instance))return;const i={[se.VG]:new to}[n]||new no;so(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&&(u(`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:"";Tt(i)}loadKilkayaScript(t){return e(this,void 0,void 0,function*(){yield ge(t)})}run(t){return e(this,void 0,void 0,function*(){const{tcf:e,isMobileApp:n,country:i,kilkaya:o}=t;if(!(null==o?void 0:o.enabled))return;const r=yield k(e,n,i,"kilkaya");r&&(this.observeForKilkayaBackfills(),this.injectKilkayaMeta(r),yield this.loadKilkayaScript(o.url),this.handleKilkayaStreamTracking(t))})}}const lo=1e4,co=e=>e.some(e=>e.some(e=>!!e&&Nn(e,0))),uo=()=>{const{widescreenSwitching:e}=l.get(),{enabled:t,rotationInterval:n=lo,widescreenIdPrefix:i}=null!=e?e:{};if(!t)return;const o=((e="widescreen")=>{const{pageSectionsSelectors:{right:t}={}}=l.get();return t?Array.from(document.querySelectorAll(t)).map(t=>Array.from(t.querySelectorAll(`div[id^="${e}"]`))):[]})(i);let r=0,s=Date.now(),a=co(o);if(!o.length)return;const d=(e,t,n)=>{e.forEach(e=>{e&&e.style.setProperty(t,n)})},c=e=>1===e?0:1;(e=>{e.forEach(e=>{e[0]&&(e[0].style.display="block"),e[1]&&(e[1].style.display="none")})})(o);const u=((e,t)=>{let n=null;return(...i)=>{null===n&&(e(...i),n=setTimeout(()=>{n=null},t))}})(()=>{a||(a=co(o)||a,s=Date.now());Date.now()-s>=n&&((()=>{const e=c(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=c(r),s=Date.now())},1e3);window.addEventListener("scroll",u)},vo={Blink:"Blink"},po=new Map,go=e=>{var t;if(!po.has(e)){const t=import(e).then(e=>(e=>{for(const[t,n]of Object.entries(vo)){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()},ho="https://assets.finn.no/pkg/distribution-fixed/v1/FINNExternalDistribution.modern.js",mo={get:e=>{try{const t=sessionStorage.getItem(e);return t?JSON.parse(t):null}catch(e){return u(`sessionStorageClient.get: Error during getting data from sessionStorage: ${e}`),null}},set:(e,t)=>{try{sessionStorage.setItem(e,JSON.stringify(t))}catch(e){u(`sessionStorageClient.set: Error during saving data to sessionStorage: ${e}`)}},remove:e=>{try{sessionStorage.removeItem(e)}catch(e){u(`sessionStorageClient.remove: Error during remove data from sessionStorage: ${e}`)}}},yo="finn_blink_id",fo=t=>e(void 0,void 0,void 0,function*(){const{id:e,hashed_email:n,theme:i}=t,o=function(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}(t,["id","hashed_email","theme"]),r=window[vo.Blink];if(!r)return;const s=new r({remote:"https://www.finn.no/distribution-front/external/carousel",id:e,hashed_email:n,theme:i});yield s.inject(o)}),wo=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}={}}=l.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:c,position:u,offset:v,advertoryTheme:p}=t||{};return{selector:`#${wo(e)}`,enabled:i,position:null!=u?u:e,distributionTypes:null!=c?c:[],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}},Eo=(t,n,i)=>e(void 0,void 0,void 0,function*(){const{placements:o,deviceType:r}=l.get();u(`rendering finn blink ad for ${t}`);const s=pt(t),a=o[r].find(e=>e.id===s),d=bo(t,null==a?void 0:a.finnBlink),{publisher:c,country:v,finnBlink:p}=n,{userId:g,uuid:h,channel:m,theme:f}=null!=p?p:{},w=null!=m?m:`${c}.${v}`,b=(e=>{if(!e){const e=Q();return null!=e?e:""}return e})(g),E="dark"===f?"dark":"light";if(!(null==d?void 0:d.enabled))return u(`Finn blink is not enabled on placement: ${t}`),i&&i(t),void Bi(t);if((e=>{var t;const n=wo(e),i=document.querySelector(`[id^="${n}"]`);return!!(null===(t=null==i?void 0:i.classList)||void 0===t?void 0:t.contains("finn"))})(t))u(`Finn blink already loaded ${t}`);else try{const t=yield e(void 0,void 0,void 0,function*(){const{finnBlink:{identifierUrl:e}={}}=l.get(),t=mo.get(yo),n=y("finncode");if(!e||n)return"";if(!t){const t=yield _.get(e,{credentials:"include"}),{finn_blink_id:n}=t;if(!n)throw new Error("getFinnBlinkIdentifier: No finn_blink_id found");return mo.set(yo,n),n}return t});yield fo(Object.assign(Object.assign({},d),{hashed_email:t,channel:w,id:b,theme:E,uuid:h})).then(()=>{((e,t)=>{const{siteSpecificConfig:{publisherClassName:n}={},pageType:i}=l.get(),o=document.querySelector(`#${e}`);if(!o)return;if(o.classList.add("disable-cogwheel"),!n)return;qi(n,o,Di,null!=t?t:i),Ai({preferredTestIdData:{targetId:e,testId:"finn"}})})(d.selector.replace("#",""),d.advertoryTheme)})}catch(e){u(`Finn blink error ${e}`),i&&i(t),!i&&Et(t),Bi(t)}}),To=(e,t)=>{var n;(u(`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)):u(`Cannot perform afterend on: ${e.id}`)},Io=e=>document.querySelector(`#${e}`);let ko,Ao=[];const So=["takeover","wallpaper"],Co=e=>{const t=(e=>{const t=ce.getData("alertoryConfigKeywords"),{queryConfig:n,placements:i,tcf:o,glimr:r,appearanceConfig:s,requestSize:d=a,publisher:l,country:c,pageType:u,deviceType:v,isMobileApp:p=!1,pageOptions:{member:g},takeover:h,fullscreenScroll:m,useAppTabletInvCode:y}=e;return{xandr:{member:g,keywords:t,tags:[]},advertory:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({publisher:l,country:c,pageType:u,deviceType:v,placements:i,tcf:o,requestSize:d,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}},Oo=()=>e(void 0,void 0,void 0,function*(){const{pageOptions:t}=l.get(),{preparePageOptions:n}=l.getHandlers(),i=(()=>{const{sandboxAdIframeEnabled:e=!0}=l.get();return{sandboxAdIframe:e,sandboxAttributes:["allow-same-origin","allow-scripts","allow-top-navigation-by-user-activation","allow-popups","allow-popups-to-escape-sandbox","allow-forms"]}})(),o=yield e(void 0,void 0,void 0,function*(){const{tcf:e,isMobileApp:t,country:n}=l.get();return(yield k(e,t,n,"page-options"))?{}:{userSync:{disabled:!0}}}),r=yield n(Object.assign(Object.assign(Object.assign({disablePsa:!0,enableSafeFrame:!0},t),{renderingManagement:Object.assign({},i)}),o));(e=>{const t=ce.getData("alertoryConfigKeywords");if(Object.keys(t).length)return;const n=Fi(e);ce.setData("alertoryConfigKeywords",n)})(r.keywords),ct(()=>ko.setPageOpts(r))}),Po=t=>e(void 0,void 0,void 0,function*(){const{prebid:e,tcf:n,isMobileApp:i,country:o}=l.get();$o(t);const r=yield k(n,i,o,"prebid");(null==e?void 0:e.enabled)&&r?(u("core loadPlacements prebid enabled"),yield at()):(u("core load tags invoked without prebid enabled"),Lo(t))}),$o=e=>{const{prepareTag:t}=l.getHandlers(),n=[];(e=>{const t=["skyscraperright_1","topboard","wallpaper","skyscraperleft_1"];return e.sort((e,n)=>{const i=t.findIndex(t=>e.id.includes(t)),o=t.findIndex(e=>n.id.includes(e));return-1!==i&&-1===o?-1:-1===i&&-1!==o?1:i-o})})(e).forEach(e=>{u("core defineTags",{placement:e});const i=Ni(e);if(ji(e.id)){const o=t(i),r=(e=>{const{allowedFormats:t,invCode:n,keywords:i,sizes:o}=e;return{adTypes:t,invCode:n,keywords:Ri(i),sizes:o}})(o);n.push(r),ct(()=>(u("core defineTag - add to the queue",{placement:e,preparedTag:o}),ko.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)},Lo=e=>{const t=e.filter(({id:e})=>ji(e)).map(({id:e})=>e);t.length&&ct(()=>(u("core loadTags",{placementsIdsToLoad:t}),ko.loadTags([...t])))},xo=(t,n)=>e(void 0,void 0,void 0,function*(){const{appearanceConfig:e,deviceType:i}=l.get(),{threshold:o,refresh:r}=t,s=(e=>{const t=document.querySelector(`[data-show-tag-subscribe-id=${e.targetId}]`),n=document.querySelector(`#${e.targetId}`);return t||n})(n),a=null==e?void 0:e.defaultThreshold[i];s&&(u("core showAd - subscribe for show tag with thresholds",{placement:t,adObj:n,threshold:o,deviceDefaultThreshold:a}),yield En(s,null!=o?o:a)),s&&r&&(u("core showAd - setup refreshing",{placement:t,adObj:n}),s.dataset.refresh=r.toString())}),No=e=>e.some(({id:e})=>So.some(t=>e.includes(t))),jo=t=>e(void 0,void 0,void 0,function*(){var n;if(!(null===(n=null===window||void 0===window?void 0:window.advertory)||void 0===n?void 0:n.initialized))return;const[i,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]]},[[],[]]))(t),r=(e=>{const{requestSize:t=a,queryConfig:{placementBatches:n}={},deviceType:i}=l.get(),o=Lt(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)),d=e.filter(({id:e})=>!s.has(e));return[...r,...Ln(d,t)]})(o);for(const e of r)No(e)?(u("core loadAds without lazy loading",{placementsToLoad:e}),yield Po(e)):e.length&&(u("core loadAds with lazy loading",{placementsToLoad:e}),yield _o(e));yield(t=>e(void 0,void 0,void 0,function*(){if(!t.length)return;const{appearanceConfig:e,deviceType:n}=l.get(),i=null==e?void 0:e.defaultThreshold[n];for(const e of t){const{threshold:t,id:n}=e,o=Io(n);o&&(yield En(o,null!=t?t:i))}}))(i)}),_o=t=>e(void 0,void 0,void 0,function*(){const{queryConfig:{lazyLoadingV3:{enabled:e=!1,rootMargin:n="200% 0px"}={}}={}}=l.get(),i=[];if(!e)return u("lazy load is not enabled",{placements:t}),void(yield Po(t));const o=new IntersectionObserver((e,n)=>{e.filter(({isIntersecting:e,target:{id:t}})=>e&&!t.includes("wallpaper")).forEach(e=>{u("lazy load is enabled - handler start",{loadedPlacementIds:i,placements:t});const o=t.every(e=>i.includes(e.id)),r=t.map(e=>e.id);!o&&i.push(...r),!o&&Po(t),u("lazy load is enabled - handler stop",{loadedPlacementIds:i,placements:t,arePlacementsLoaded:o,placementIds:r}),n.disconnect()})},{rootMargin:n});t.forEach(e=>{const t=document.getElementById(e.id);t&&(u("lazy loading - observe element",{placementId:e.id,element:t}),o.observe(t))})}),qo=()=>e(void 0,void 0,void 0,function*(){const{siteEvents:t,initNativeAd:n,wallpaperHandlers:{initWallpaperAd:i,adjustAdToHorseshoe:o}}=l.getHandlers(),{wallpaper:r,fullscreenScroll:s}=l.get(),a=[];ct(()=>{ko.onEvent("adRequested",()=>{t.adRequested()}),ko.onEvent("adAvailable",o=>e(void 0,void 0,void 0,function*(){var e,a,d,c,v,p;u("core adAvailable start",{placementsAvailable:Ao,adObj:o,isFullscreenScrollAd:Ae(o),isFinnBlink:Ne(o.targetId),isNativeAd:Se(o),isMediation:_i(o),isTakeoverAd:Oe(o),isCollapseAd:Le(o),isWallpaperAd:$e(o)});const g=null===(d=null===(a=null===(e=null===window||void 0===window?void 0:window.apntag)||void 0===e?void 0:e.requests)||void 0===a?void 0:a.tags[o.targetId])||void 0===d?void 0:d.adResponse.ads;_i(o)&&g&&(null===(c=g[1])||void 0===c?void 0:c.rtb)&&(o.banner=null===(p=null===(v=g[1])||void 0===v?void 0:v.rtb)||void 0===p?void 0:p.banner),Ae(o)&&st(o),qe(o)&&uo(),Ae(o)&&!Ne(o.targetId)&&rt(o,s),!Se(o)||_i(o)||Ne(o.targetId)||n(o,l.get()),Oe(o)&&!Le(o)&&(bi(o.targetId),yield Ei(o)),$e(o)&&(i(()=>ct(()=>window.apntag.showTag(o.targetId)),r),ce.setData("wallpaper",{isAvailable:!0})),(e=>e.targetId.includes("skyscraperleft")&&!!e.banner)(o)&&ce.setData("horseshoe",{isAvailable:!0}),Ai({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),t.adAvailable(o);const h=Ao.find(({id:e})=>e===o.targetId);h&&(yield xo(h,o),Ao=Ao.filter(e=>e.id!==h.id)),u("core adAvailable stop",{placementsAvailable:Ao,adObj:o,isFullscreenScrollAd:Ae(o),isFinnBlink:Ne(o.targetId),isNativeAd:Se(o),isMediation:_i(o),isTakeoverAd:Oe(o),isCollapseAd:Le(o),isWallpaperAd:$e(o)})})),ko.onEvent("adLoaded",e=>{const{refreshConfig:i,appearanceConfig:r}=l.get(),s=document.getElementById(e.targetId);Ne(e.targetId)&&(e=>{const{fullscreenScroll:t}=l.get(),{initNativeAd:n}=l.getHandlers();Ae(e)&&rt(e,t),Se(e)&&n(e,l.get())})(e);a.includes(e.targetId)&&Se(e)&&(n(e,l.get()),Ai({adObj:e})),!a.includes(e.targetId)&&_i(e)&&a.push(e.targetId),Le(e)&&Et(e.targetId),Oe(e)&&((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"]})})(ko,e.targetId),Ce(e)&&(e=>{const t=document.querySelector(`#${e.targetId}`),{siteSpecificConfig:{publisherClassName:n,fullWidthFormatClassName:i}={}}=l.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`))})(e),(e=>Be(e,ye))(e)&&(e=>{const t=document.querySelector(`#${e.targetId}`),n=null==t?void 0:t.querySelector("iframe"),i=null==n?void 0:n.parentElement,{siteSpecificConfig:{publisherClassName:o,fullWidthFormatClassName:r}={}}=l.get();if(!t||!n||!i)return;const s=window.innerWidth,a=Math.round(s/1080*1920);t.style.width="100%",t.style.height=`${a}px`,t.classList.add(`advertory-${o}-${r}__vertical-full-width-ad`);const d=Ci(e,t.offsetWidth);i.style.transform=`scale(${d})`,i.style.transformOrigin="left top"})(e),((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;On({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&&$n(i,s,r))})(e,i),(null==r?void 0:r.clearProbableDimensionsEnabled)&&(e=>{const t=document.querySelector(`#${e}`);t&&(t.style.minWidth="",t.style.minHeight="")})(e.targetId);var d,c;ce.getData("horseshoe").isAvailable&&o(e.targetId),$i(e),t.adLoaded(e),d=e.targetId,!document.querySelector(`#gdprAdTransparencyCogWheelButton-${d}`)&&(null===(c=window.gdpr)||void 0===c?void 0:c.setupButton)&&window.gdpr.setupButton(d),s&&(s.classList.add("ad-loaded"),(e=>{var t;const{siteSpecificConfig:n}=l.get(),i=null!==(t=null==n?void 0:n.mainColumnWidth)&&void 0!==t?t:1/0;e.clientWidth>i&&e.setAttribute("data-two-column-ad-layout","true")})(s)),Pi(e),window.dispatchEvent(new CustomEvent("advertory:adLoaded",{detail:{targetId:e.targetId,adFormat:Si(e)}}))}),ko.onEvent("adNoBid",n=>e(void 0,void 0,void 0,function*(){Et(n.targetId),yield sn(l.get(),n),ti(n)&&(yield ei()),t.adNoBid(n)})),ko.onEvent("adError",(n,i)=>e(void 0,void 0,void 0,function*(){ti(i)&&(yield ei()),t.adError(n,i)})),ko.onEvent("adCollapse",()=>{t.adCollapse()}),ko.onEvent("adRequestFailure",e=>{Et(e.targetId),t.adRequestFailure(e)}),ko.onEvent("adBadRequest",e=>{Et(e.targetId),t.adBadRequest(e)}),ko.onEvent("adLoadedMediated",e=>t.adLoadedMediated(e)),ko.onEvent("adNoBidMediated",e=>t.adNoBidMediated(e))})}),Do=(t,n)=>e(void 0,void 0,void 0,function*(){var e;if(!(null===(e=null===window||void 0===window?void 0:window.advertory)||void 0===e?void 0:e.initialized))return[];const{clearAds:i,reloadExistingAds:o,renderFinnBlinkPlacements:r,contextSelector:s}=null!=n?n:{};if(i)return At(),[];o&&(At(),document.querySelectorAll('[data-advertory-ad-rendered="true"]').forEach(e=>{Tt(e.id)})),c(null!=t?t:{}),yield Oo();let a=Pt(s);return r&&(a=a.filter(e=>Ne(e.id))),a.length>0&&(Ao=[...Ao,...a.map(e=>Object.assign({},e))],jn(a),qn(a),yield jo(a)),Ao}),Mo=(t,n)=>e(void 0,void 0,void 0,function*(){var i;l.set(t),l.setHandlers(n),ce.initialize(),window.addEventListener("message",yn,!1),ko=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=ko,u("Apn tag is set up on window"),yield Promise.allSettled([e(void 0,void 0,void 0,function*(){const{tcf:e,isMobileApp:t,country:n}=l.get();(yield k(e,t,n,"xandr-endpoint"))||ko.setEndpoint("ib.adnxs-simple.com",!0)}),e(void 0,void 0,void 0,function*(){const{prebid:e,tcf:t,isMobileApp:n,country:i}=l.get(),o=yield k(t,n,i,"prebid");(null==e?void 0:e.enabled)&&o&&(yield ge(null==e?void 0:e.url))}),K(t),e(void 0,void 0,void 0,function*(){const{astUrl:e}=l.get();yield ge(null!=e?e:"https://adsdk.microsoft.com/ast/ast.js")}),e(void 0,void 0,void 0,function*(){const{gptUrl:e}=l.get();yield ge(null!=e?e:"https://securepubads.g.doubleclick.net/tag/js/gpt.js")}),e(void 0,void 0,void 0,function*(){const{brandmetrics:{enabled:e,url:t}={},tcf:n,isMobileApp:i,country:o}=l.get(),{getConsentAsync:r}=I(n,i,o),s=yield r();if(e&&t&&s){if(yield ge(t),document.querySelector(`.${Ti}`))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(Ti)})&&(t.disconnect(),window._brandmetrics=window._brandmetrics||[],window._brandmetrics.push({cmd:"_loadsurvey"}))}}).observe(document,{childList:!0,subtree:!0,attributes:!0})}}),S(),e(void 0,void 0,void 0,function*(){const{gdpr:{url:e,allowHidingAds:t=!0}={}}=l.get();t&&(window.gdpr=window.gdpr||{},window.gdpr.allowHidingAds=!0),yield ge(null!=e?e:"https://cogwheel.inventory.schibsted.io/prod/latest/gdpr-bundle.js")})]),yield Ii(),u("Libraries have been loaded and trackers have been set"),yield(i=n.librariesToLoad,e(void 0,void 0,void 0,function*(){const e=i.map(e=>ge(e));yield Promise.all(e)})),yield qo(),yield Oo(),u("Page options have been set"),Co(t),u("Advertory is setup on window"),Ao=Pt(),jn(Ao),qn(Ao),yield jo(Ao),u("Ads has been loaded",Ao),Vi(Ao),yield n.replaceAdsWithFinnBlink(t.finnBlink),yield(t=>e(void 0,void 0,void 0,function*(){var e;if(!t.drEdition)return;if(!(yield k(t.tcf,t.isMobileApp,t.country,"handleDrEdition")))return;const n=yield tn(),i=new nn(n);on({publisher:t.publisher,drEditionConfig:t.drEdition,device:t.deviceType,pageType:t.pageType,country:t.country},i,null===(e=t.pulse)||void 0===e?void 0:e.instance)}))(t),(e=>{if(!(null==e?void 0:e.enabled)||eo)return;const{splitPointIDs:t,adSelector:n,trackSelector:i=Ki}=e,o=document.querySelector(i);if(!o)return;eo=!0;const r=()=>{Zi(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)})(t.rightColumnSplit),yield(t=>e(void 0,void 0,void 0,function*(){const e=new ao;yield e.run(t)}))(t)}),Bo=(t,n)=>e(void 0,void 0,void 0,function*(){yield((t,n)=>e(void 0,void 0,void 0,function*(){const{initConsentManager:e,getConsentAsync:i}=I(t.tcf,t.isMobileApp,t.country),o=yield Wi(t);yield Hi(),yield Ui(e),yield Ui(i),u("TCF resolved successfully"),yield Mo(o,n),u("Run function resolved successfully")}))(t,n)}),Ro="native_override_desc2",Fo=(e,t,n)=>{var i;const{image:o,icon:r,sponsoredBy:s,title:a,clickUrl:d,cta:l,body:c,desc2:u,video:v,description:p,customTitle1:g,customTitle2:h,customTitle3:m,customTitle4:y,customIcon2:f}=e,w=(e,t="")=>{var n;return e?null!==(n=e.url)&&void 0!==n?n:e:t};return Object.assign({containerId:n,img:w(o),imgWidth:null==o?void 0:o.width,imgHeight:null==o?void 0:o.height,imgAltText:null!=a?a:"",logo:w(r),sponsoredBy:null!=s?s:"",title:null!=a?a:"",url:null!=d?d:"",cta:null!=l?l:"",description:null!==(i=null!=c?c:p)&&void 0!==i?i:"",desc2:null!=u?u:"",video:v,customTitle1:null!=g?g:"",customTitle2:null!=h?h:"",customTitle3:null!=m?m:"",customTitle4:null!=y?y:"",logo2:w(f)},t)},Vo=(e,t)=>{const n=(i=Ro,window.location.href.includes(i));var i;const o=new URLSearchParams(window.location.search).get(Ro),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},Uo=(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(se).includes(i);n&&r&&qi(i,e,Mi,o)})(o,n),i())},Ho=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:[])Jo(i)}),t.dataset.tracked="true")})},zo=e=>{const{native:{impressionTrackers:t}={}}=e;(null==t?void 0:t.some(e=>e.includes("googleads")))?null==t||t.forEach(Ko):window.apntag.fireImpressionTrackers(e);const n=new CustomEvent("advertory:nativeImpression",{detail:{ad:e}});window.dispatchEvent(n)},Wo=(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:X.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,zo(e),c.disconnect();break}},d);c.observe(o)},Ko=e=>{const t=e.includes("googleads");"function"!=typeof window.navigator.sendBeacon||t?Jo(e):window.navigator.sendBeacon(e)},Jo=e=>{fetch(e,{method:"GET",mode:"no-cors"}).catch(t=>console.warn(`Tracker ${e} failed. Error: ${t||"Unknown"}`))},Go=(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=Vo(e.targetId,l))&&void 0!==i?i:c,v=et[t.language||w.NO],p=Fo(a,v,d);return(a.video?r[u]:o[u]||o.default)(p,t)})(e,t,n);Uo(e.targetId,i,t,()=>{const{nativeTrackingConfig:{nativeTrackingEnabled:n=!0}={}}=t;n&&((e,t)=>{Ho(e),Wo(e,t)})(e,t)})},Yo="viewable",Qo="adClick";var Xo=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=Zo(o.content,s),h=er({id:u,nodeId:p,poster:v,tagURL:g,publisher:a,productTag:d,videoLoop:c});return tr({playerConfig:h,clickUrl:s,pluginsNames:l}),`${e(t,n,p)}`};const Zo=(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"}))},er=({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({},Qt(e)?e:{}),{provider:Object.assign(Object.assign({},Qt(null==e?void 0:e.provider)?e.provider:{}),{productTag:r})})}}),tr=t=>e(void 0,void 0,void 0,function*(){const{playerConfig:e,pluginsNames:n,clickUrl:i}=t,{repeat:o}=e,r=yield zt(e);Kt(n),r.once("assetReady",()=>{Ht(r,n)}),r.on(Yo,e=>{const{viewable:t}=e;t?r.play():r.pause()}),r.on(Qo,()=>{window.open(i,"_blank")}),o&&r.on("pause",()=>{r.play()})}),nr=({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>`,ir=({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>`),or={VIDEO:(e,t)=>Xo(nr)(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>`,PODME_SECTION:({url:e,title:t,description:n,img:i,logo:o,containerId:r})=>`<article class="advertory-abo-ad-native-podme-section ${n&&"description"}">\n <div class="ad-info" id="${r}-button"></div>\n <a class="ad-link" href="${e}" target="_blank">\n <div class="ad-content-wrapper">\n <div class="ad-text-container">\n <div class="ad-title">${t}</div>\n <div class="ad-description">${n}</div>\n </div>\n <div class="ad-small-image-container">\n <img alt="podme-ad" class="ad-small-image" src="${i}" />\n </div>\n <div class="ad-logo">\n <img alt="${o}" class="logo" src="${o}"/>\n </div>\n </div>\n </a>\n </article>\n`,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)?Xo(ir)(e,t):null}},rr={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>`},sr={CONTENT:({containerId:e,url:t,sponsoredBy:n,title:i,logo:o,img:r,description:s})=>`<article class="advertory-aftenposten-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>`,RECIRC:({containerId:e,url:t,sponsoredBy:n,title:i,logo:o,img:r,adFrom:s,adText:a})=>`<article class="advertory-aftenposten-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>`},ar={displayTemplates:{podme_section:or.PODME_SECTION,content:sr.CONTENT,sponsorstripe:or.SPONSORSTRIPE,recirc:sr.RECIRC,native:rr.NATIVE_TEMPLATE,native_recirc:rr.NATIVE_RECIRC,default:or.CONTENT_BASIC},videoTemplates:{default:or.VIDEO,content:or.CONTENT_VIDEO}},dr=(e,t)=>{e.style.position="fixed",e.style.transform=`translateY(${t}px)`},lr=(e,t)=>{const n=document.querySelector(t),i=document.querySelector(`#${e}`);if(!i||!n)return;const o=i.parentElement,r=new IntersectionObserver(([e])=>((e,t,n)=>{const i=e?t.offsetHeight:0;dr(n,i)})(e.isIntersecting,n,o)),s=new ResizeObserver(()=>((e,t)=>{dr(t,e.offsetHeight)})(n,o));r.observe(n),s.observe(n)},cr=e=>document.querySelector(e)||document.querySelector(`[class*="${e}"]`),ur=(e,t)=>{if(!t||!xe(e))return;const{toggleEnabled:n,headerSelector:i,containersSelectors:o}=t,{targetId:r}=e;if(!n)return;const s=document.querySelector(".advertory-takeover-wrapper"),a=[()=>i&&lr(r,i),()=>o&&((e,t)=>{const n=document.querySelector(`#${e}`);if(!n)return;const[i,o]=t;if(!i)return;const r=()=>{const e=cr(i),t=o?cr(o):null,r=n.querySelector("article");if(!r||!e)return;const s=e.getBoundingClientRect().left,a=((e,t)=>{const n=e.getBoundingClientRect(),i=null==t?void 0:t.getBoundingClientRect();return i?i.right-n.left:n.width})(e,t);r.style.left=`${s}px`,r.style.width=`${a}px`};r(),new ResizeObserver(r).observe(document.body)})(r,o),()=>s&&((e,t)=>{const n=document.querySelector(`#${e}`);if(!n||!t)return;new IntersectionObserver(([e])=>{n.style.visibility=e.isIntersecting?"hidden":"visible"}).observe(t)})(r,s)];a.forEach(e=>e())},vr=e=>{const{deviceType:t}=l.get();navigator&&navigator.userAgent.match(/firefox/i)&&(e=>e===X.DESKTOP||"tablet"===e)(t)&&pr(e)},pr=e=>{var t,n,i,o,r,s,a,d;const l=_i(e)?1:0,c=null===(i=null===(n=null===(t=window.apntag)||void 0===t?void 0:t.requests)||void 0===n?void 0:n.tags)||void 0===i?void 0:i[e.targetId];if(null===(d=null===(a=null===(s=null===(r=null===(o=null==c?void 0:c.adResponse)||void 0===o?void 0:o.ads)||void 0===r?void 0:r[l])||void 0===s?void 0:s.rtb)||void 0===a?void 0:a.banner)||void 0===d?void 0:d.content){const e="<style>body { margin:0 !important; }</style>";c.adResponse.ads[l].rtb.banner.content+=e}},gr=((e,t)=>n=>Bo(Object.assign(Object.assign({},n),{siteSpecificConfig:t}),e))({initNativeAd:(e,t)=>{const{targetId:n}=e;if(!document.querySelector(`#${n}`))return;const{pageType:i=Ut.FRONT,nativeTrackingConfig:o,appearanceConfig:r,deviceType:s}=null!=t?t:{},a={language:w.NO,publisher:se.AFTENPOSTEN,deviceType:s,pageType:i,nativeTrackingConfig:o,appearanceConfig:r};Go(e,a,ar),ur(e,null==t?void 0:t.sponsorstripe)},wallpaperHandlers:{initWallpaperAd:(e,t)=>{if(!t)return;const{options:{appMainContainerSelector:n,wallpaperAnchorSelector:i}={}}=t;(e=>{const t=document.querySelector(e||"#application");if(!t)return;ft();const n=document.createElement("div");n.classList.add(mt),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, 0) - 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&&(wt(n),window.addEventListener("scroll",()=>wt(n)))})(i),e()},adjustAdToHorseshoe:e=>{var t;const n=document.querySelector(`#${e}`);n&&(null===(t=n.parentElement)||void 0===t||t.classList.add(yt),n.classList.add(yt))}},loadFinnBlinkAd:(t,n,i,o)=>e(void 0,void 0,void 0,function*(){const{isMobileApp:r}=l.get();if(u(`loadFinnBlinkAd: loading finn blink ad for ${t}`),!(yield e(void 0,void 0,void 0,function*(){const{tcf:e,isMobileApp:t,country:n}=l.get(),{getConsentAsync:i}=I(e,t,n),o=yield i();return!(!(null==e?void 0:e.enabled)||!o)||(u("Skip loading finn blink ad due to missing TCF consent."),!1)}))||r)return i&&i(t),Bi(t),void(!i&&Et(t));yield go(ho),yield Eo(t,n,i),o&&o()}),replaceAdsWithFinnBlink:t=>e(void 0,void 0,void 0,function*(){if(!t)return;yield go(ho);const{replacementConfig:e}=t;if(!((()=>{const e=document.getElementById("ads-advertory-anchor");return!(e&&"none"!==getComputedStyle(e).display&&window.advertoryFluepapir)})()&&(null==e?void 0:e.adsToReplace)&&(null==e?void 0:e.sizes)&&t.enabled))return void u(`Finn blink configuration is incorrect: ${JSON.stringify(e)}`);const{adsToReplace:n,sizes:i}=e;n.forEach(([e,t])=>{const n=document.querySelector(`[id^="${e}"]`);if(!n)return;const i=(e=>{const{siteSpecificConfig:{publisherClassName:t}={}}=l.get(),n=document.createElement("div"),i=document.createElement("div");return i.id=e,n.appendChild(i),qi(t,i,Di),u(`Creating blink container for: ${e}`),n})(t);(e=>{u(`Hiding old ad container: ${e.id}`),e.style.setProperty("display","none","important")})(n),To(n,i),n.dataset.finnBlinkId=t,wn().withFullAdsChain(e)})}),preparePageOptions:de,prepareTag:e=>{const{keywords:t,targetId:n,invCode:i}=e,{useAppTabletInvCode:o=!0}=l.get(),r=((e,t)=>{const{isMobileApp:n}=l.get();return n?((e,t)=>e.replace(/wtb|wde|wph/g,e=>"wph"===e?"aph":t?"atb":e))(e,t):e})(i,o),s=(e=>{const{keywords:t,dynamicSizeWidthCheck:n}=e,i=`${C()}-adformat`,o=t?t[i]:[];if(!o)return{};const r=(Array.isArray(o)?o:[o]).filter(e=>!(e in ke)||window.innerWidth>=ke[e]);return{[i]:n?r:o}})(e),a=(e=>{const t=`${C()}-targetid`;return e?{[t]:[e]}:{}})(n),d=(e=>{var t;const[,n]=null!==(t=e.match(/-((w|a)(?:ph|de|tb))-/))&&void 0!==t?t:[];switch(n){case"wde":return{"aa-sch-supply_type":"web_desktop"};case"wtb":return{"aa-sch-supply_type":"web_tablet"};case"wph":return{"aa-sch-supply_type":"web_phone"};case"aph":return{"aa-sch-supply_type":"app_phone"};default:return}})(r);return Object.assign(Object.assign({},e),{invCode:r,keywords:Object.assign(Object.assign(Object.assign(Object.assign({},t),s),a),d)})},siteEvents:{adRequested:()=>{},adAvailable:e=>{Oe(e)&&(()=>{const e=document.querySelector(".advertory-aftenposten-topboard-wrapper__front"),t=document.querySelector("#takeover");e&&t&&t.appendChild(e.firstChild)})(),vr(e)},adLoaded:e=>{$e(e)&&(()=>{const e=document.querySelector("body");e&&e.classList.add("advertory-aftenposten-body__with-wallpaper")})(),Ae(e)||((e,t,n="front")=>{var i;const{targetId:o}=e,r=o.startsWith("contentboard"),s=document.querySelector(`#${o}`);if(!s||!r)return;const a=document.createElement("div");a.classList.add(`advertory-${t}-netboard-wrapper__${n}`),s.classList.add(`advertory-${t}-netboard__${n}`),null===(i=s.parentNode)||void 0===i||i.replaceChild(a,s),a.appendChild(s),Ai({adObj:e})})(e,se.AFTENPOSTEN,"brandboard")},adNoBid:e=>{},adError:(e,t)=>{},adCollapse:()=>{},adRequestFailure:e=>{},adBadRequest:e=>{},adLoadedMediated:e=>{},adNoBidMediated:e=>{}},librariesToLoad:[]},{publisherClassName:se.AFTENPOSTEN,fullWidthFormatClassName:"netboard"});var hr=Object.freeze({__proto__:null,default:""});export{gr as initAdvertoryPackage,Do as updateAdvertory};
|