1import{bb as N,G as C,j as U,N as I,a4 as P,x as O,cD as L,cE as z,q as f,cF as E,C as m,cG as $,au as F,ag as _,bI as M,cH as k,cI as V,P as T,O as B,aT as G,aS as R,_ as j,r as g,o as u,c as q,l as v,w as y,$ as W,h as S}from"./index-D-iuxWOd.js";import{s as A}from"./SeedingAllianceSDKLoader-Yf9-dXXq.js";import{P as K,a as Z}from"./index-BXk4ke_e.js";class H{constructor(){this.counter={},this.pianoArticles=[],this.viewportCount={}}resetCounter(){this.viewportCount={},Object.keys(N).forEach(e=>{this.counter[e]=0})}}const r=new H;var J=Object.defineProperty,Q=Object.getOwnPropertyDescriptor,p=(s,e,t,i)=>{for(var o=i>1?void 0:i?Q(e,t):e,c=s.length-1,a;c>=0;c--)(a=s[c])&&(o=(i?a(e,t,o):a(o))||o);return i&&o&&J(e,t,o),o};const b=C("contentPage"),X=C("edition");let n=class extends U(I){constructor(){super(...arguments),this.UUID=P(),this.nativeAdIdPrefix="nativendo-teaser",this.showLazyLoadedAd=!1,this.isNativeAdConsentGiven=!1,this.isLazyLoaded=!1,this.specialTopicsArticle=null}get teaserStyle(){return O()&&(L()||z())?this.teaserStyleMobile:this.teaserStyleDesktop}addToCounter(){var e;this.teaserStyle&&(r.counter[this.teaserStyle]||(r.counter[this.teaserStyle]=new Set),(e=r.counter[this.teaserStyle])==null||e.add(this.UUID))}addToViewportCounter(){var t,i;const e=(t=this.getNativeAdStyling(this.teaserStyle))==null?void 0:t.viewport;e&&(r.viewportCount[e]||(r.viewportCount[e]=new Set),(i=r.viewportCount[e])==null||i.add(this.UUID))}removeFromCounter(){var e;this.teaserStyle&&(r.counter[this.teaserStyle]||(r.counter[this.teaserStyle]=new Set),(e=r.counter[this.teaserStyle])==null||e.delete(this.UUID))}removeFromViewportCounter(){var t,i;const e=(t=this.getNativeAdStyling(this.teaserStyle))==null?void 0:t.viewport;e&&(r.viewportCount[e]||(r.viewportCount[e]=new Set),(i=r.viewportCount[e])==null||i.delete(this.UUID))}getCountFromUUID(){if(!this.teaserStyle)return 0;const e=r.counter[this.teaserStyle]||new Set;return Array.from(e).indexOf(this.UUID)+1}getViewportCountFromUUID(){var t;const e=(t=this.getNativeAdStyling(this.teaserStyle))==null?void 0:t.viewport;if(e){const i=r.viewportCount[e];if(i&&i.size)return Array.from(i).indexOf(this.UUID)+1}return 0}get showNativeAd(){if(!this.teaserStyle)return!1;const e=this.getCountFromUUID(),t=f.nativeAds[this.edition.publication],i=t?t[this.teaserStyle]:0;return e<=i}get nativeAdID(){const e=this.getNativeAdStyling(this.teaserStyle);if(!e)return"";const t=this.getCountFromUUID();return t<=0?"":`${this.nativeAdIdPrefix}-${e.viewport}-${e.size}-${t}`}getNativeAdStyling(e){if(e)return E[e]}beforeUpdate(){this.addToCounter(),this.addToViewportCounter()}unmounted(){this.removeFromCounter(),this.removeFromViewportCounter(),this.RemoveDuplicates.removeComponentFromUniqueArticles(`nativeAdSpecialTopics-${this.UUID}`),this.routeSubscription&&this.EventBus.unsubscribe(this.routeSubscription),this.consentApprovedSubscription&&this.EventBus.unsubscribe(this.consentApprovedSubscription)}deactivated(){this.removeFromCounter(),this.removeFromViewportCounter()}mounted(){var t;this.addToCounter(),this.addToViewportCounter();const e=((t=this.$route)==null?void 0:t.hash)||"";(m.isConsentLayerLoaded()&&!m.isConsentLayerVisible()||e.includes($))&&this.prepareAd(),this.consentApprovedSubscription=this.EventBus.subscribe("consentManager.sdk.consent",this.prepareAd)}get adZone(){var t,i,o,c,a,d;const e=((i=(t=this.sectionTagConfiguration)==null?void 0:t.fields)==null?void 0:i.oms)||((d=(a=(c=(o=F)==null?void 0:o.front)==null?void 0:c.meta)==null?void 0:a.ads)==null?void 0:d.oms);return e?encodeURI(e):""}prepareAd(){this.isNativeAdConsentGiven=m.hasVendorConsent(f.consentManager.vendorIds.seedingAlliance),this.isNativeAdConsentGiven&&this.prepareSeedingAllianceAd(),this.prepareSpecialTopicsAd(),this.routeSubscription=this.EventBus.subscribe("route.changed",()=>{r.resetCounter()}),this.$nextTick(()=>this.registerObserver())}prepareSeedingAllianceAd(){A.setAdZone(this.adZone),A.setEdition(this.edition),A.initSDKLoader(this.EventBus),this.EventBus.publish(A.getLoadSDKEventName()),this.currentPageType!==_.ArticlePage&&this.getViewportCountFromUUID()<=2&&(this.showLazyLoadedAd=!0)}async prepareSpecialTopicsAd(){r.pianoArticles=await this.getPianoArticles()}async getPianoArticles(){var a,d,h;const e=(d=(a=this.edition)==null?void 0:a.piano)==null?void 0:d.widgets[K.specialTopicsAds];if(!e)return[];const t={context:{parameters:e.params,url:((h=window==null?void 0:window.location)==null?void 0:h.href)||""},widgetId:e.id},i=await M(f.piano.widgetDataBasePath,t),o=(i==null?void 0:i.items)||[];return new Z(this.edition).map(o)}get teaserSize(){const e=this.getNativeAdStyling(this.teaserStyle);return e==null?void 0:e.size}get isTeaserCard(){return this.teaserSize===k.Card}computeSpecialTopicsArticles(){var i;let e,t=!1;for(;!t&&r.pianoArticles.length;)e=r.pianoArticles.shift(),this.RemoveDuplicates.checkIfArticleExist(e.id)?r.pianoArticles.length||(e=void 0):(e=(i=this.RemoveDuplicates.addArticlesToUniqueArticles(`nativeAdSpecialTopics-${this.UUID}`,[e],1))==null?void 0:i[0],t=!0);this.specialTopicsArticle=e}async setSpecialTopicsArticle(){r.pianoArticles.length?this.computeSpecialTopicsArticles():this.getPianoArticles().then(e=>{r.pianoArticles=e,this.computeSpecialTopicsArticles()}).catch(()=>{this.specialTopicsArticle=null})}registerObserver(){this.lazyLoadObserver&&this.lazyLoadObserver.disconnect(),!(!this.$refs.nativeAdWrapper||this.showLazyLoadedAd)&&(this.lazyLoadObserver=new IntersectionObserver((e,t)=>
1{e.forEach(i=>{i.isIntersecting&&(this.showLazyLoadedAd=!0,t.disconnect())})},{rootMargin:V}),this.isLazyLoaded=!0,this.lazyLoadObserver.observe(this.$refs.nativeAdWrapper))}};p([T({required:!1})],n.prototype,"teaserStyleMobile",2);p([T({required:!1})],n.prototype,"teaserStyleDesktop",2);p([b.Getter("currentSectionConfiguration")],n.prototype,"sectionTagConfiguration",2);p([b.Getter("currentPageType")],n.prototype,"currentPageType",2);p([X.Getter("getEdition")],n.prototype,"edition",2);n=p([B({name:"NativeAd",components:{DnmTeaser:G,DnmTeaserCard:R}})],n);const Y={key:0,"data-testid":"native-ad",ref:"nativeAdWrapper"},x=["id","data-uuid","data-testid"];function ee(s,e,t,i,o,c){const a=g("client-only"),d=g("DnmTeaserCard"),h=g("DnmTeaser");return s.isNativeAdConsentGiven&&(s.specialTopicsArticle||s.showNativeAd)?(u(),q("div",Y,[s.showNativeAd&&s.showLazyLoadedAd?(u(),v(a,{key:0},{default:y(()=>[W("div",{id:s.nativeAdID,"data-uuid":s.UUID,"data-testid":`native-ad-${s.teaserStyle}`},null,8,x)]),_:1})):s.specialTopicsArticle&&s.showLazyLoadedAd?(u(),v(a,{key:1},{default:y(()=>[s.isTeaserCard?(u(),v(d,{key:0,article:s.specialTopicsArticle,onOnClick:e[0]||(e[0]=D=>{var l;return s.navigate(((l=s.specialTopicsArticle)==null?void 0:l.url)||"")}),"data-testid":"native-ad-piano-article","full-width":"",stretch:""},null,8,["article"])):(u(),v(h,{key:1,article:s.specialTopicsArticle,"size-desktop":s.teaserSize,"size-mobile":s.teaserSize,onOnClick:e[1]||(e[1]=D=>{var l;return s.navigate(((l=s.specialTopicsArticle)==null?void 0:l.url)||"")}),"data-testid":"native-ad-piano-article","hide-author":""},null,8,["article","size-desktop","size-mobile"]))]),_:1})):S("",!0)],512)):S("",!0)}const oe=j(n,[["render",ee]]);var w;try{"__c"in n&&((w=n.__c).componentFileName??(w.componentFileName=Object.create(null)),Object.defineProperty(n.__c,"componentFileName",{value:"app/components/nativeAd/NativeAd.vue"}))}catch(s){console.error("injectFileNamePlugin",s)}export{oe as N};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.