/* served 2021-11-08 17:01:53*/ /* gen time 2021-11-08 17:01:53*/ (function(){'use strict';const envVars={"app_env":"prod","app_host":"https://sac.ayads.co/","app_debug":false,"sublime_prefix":"ayads","delivery_url":"https://cdn.ayads.co/","ads_ayads_url":"https://ads.ayads.co/","sublime_url":"https://sac.ayads.co/sublime/","ayads_host":"ayads.co","ayads_url":"https://ayads.co","cookie_domain":".ayads.co","antenna_host":"antenna.ayads.co","antenna_url":"https://antenna.ayads.co","optchk_url":"https://optchk.ayads.co","xcookie_url":"https://optchk.ayads.co/?xc","geoloc_eeu_host":"geoworker.ayads.co"}||{};const globalVars={ads:[{"id":100373,"priority":5,"weight":10,"zone_id":22348,"color":"","click_area":"double","creative_type":null,"fixed":0,"format":"skinz","html":"","html_usage":"","image":"","moat":0,"mobile_setup":"","desktop_setup":"","name":"[IT] News / PositanoNews_fullsite","script_url":"","ssp_id":12912745,"ssp_name":"appnexus","top":220,"type":"skinz","url":"","vast_url":"","video":"","video_autoplay":1,"video_bg":"","viewability":0,"category_id":null,"end":"2038-01-19 03:14:02","campaign_id":8367,"campaign_name":"[Appnexus LTDv2] Programmatic Campaign","traffic_type":"rtb","images":{"bg":""},"supported_devices":["desktop"],"cappings":{"clicks":0,"impressions":0,"duration":0},"header_bidding":true,"originalUrl":""},{"id":114299,"priority":0,"weight":10,"zone_id":22348,"color":"#FFF","click_area":"double","creative_type":"html5 full skinz html5","fixed":0,"format":"skinz","html":"","html_usage":"raw","image":"","moat":0,"mobile_setup":"","desktop_setup":[],"name":"[IT - Criteo] Generic Shopping Skinz","script_url":"","ssp_id":1272202,"ssp_name":"criteogeneric","top":220,"type":"html5","url":"","vast_url":"","video":"","video_autoplay":1,"video_bg":"","viewability":0,"category_id":null,"end":"2038-01-19 03:14:02","campaign_id":3544,"campaign_name":"[IT- Criteo] Shopping Skinz IT","traffic_type":"rtb","images":{"bg":""},"supported_devices":["desktop"],"cappings":{"clicks":0,"impressions":0,"duration":86400},"header_bidding":false,"originalUrl":""},{"id":123632,"priority":0,"weight":10,"zone_id":22348,"color":"#FFF","click_area":"double","creative_type":"mobile m-skinz classic","fixed":0,"format":"skinz","html":"","html_usage":"raw","image":"","moat":0,"mobile_setup":{"top":{"key":"top","type":"img","video":"","src":"https://cdn.ayads.co/11/67/image-top-116721.jpg"},"panel":{"key":"panel","type":"img","src":"https://cdn.ayads.co/11/67/image-panel-116721.jpg","arrowAttrs":{"fill":"rgba(255, 255, 255, 0.8)","stroke":"rgba(22, 22, 22, 0.5)"},"videoScale":1.35,"effect":"move","clickArrow":true,"showCloseHandle":false},"bottom":{"key":"bottom","type":"img","src":"https://cdn.ayads.co/11/67/image-top-116721.jpg"},"js":"","css":"","footer_fixed":""},"desktop_setup":"","name":"[IT // Criteo] Generic Shopping M-Skinz","script_url":"","ssp_id":1332570,"ssp_name":"criteogeneric","top":220,"type":"mobile","url":"","vast_url":"","video":"","video_autoplay":1,"video_bg":"","viewability":0,"category_id":null,"end":"2038-01-19 03:14:02","campaign_id":10294,"campaign_name":"[IT // Criteo] Generic Shopping MSkinz","traffic_type":"rtb","images":{"bg":""},"supported_devices":["mobile"],"cappings":{"clicks":0,"impressions":0,"duration":0},"header_bidding":false,"originalUrl":""},{"id":180878,"priority":5,"weight":10,"zone_id":22348,"color":"","click_area":"double","creative_type":null,"fixed":0,"format":"skinz","html":"","html_usage":"","image":"","moat":0,"mobile_setup":"","desktop_setup":"","name":"[IT] News / PositanoNews_fullsite","script_url":"","ssp_id":12912745,"ssp_name":"appnexus","top":220,"type":"mobile","url":"","vast_url":"","video":"","video_autoplay":1,"video_bg":"","viewability":0,"category_id":null,"end":"2038-01-19 03:14:02","campaign_id":9841,"campaign_name":"[Appnexus LTDv2] Programmatic Mobile Campaign","traffic_type":"rtb","images":{"bg":""},"supported_devices":["mobile"],"cappings":{"clicks":0,"impressions":0,"duration":0},"header_bidding":true,"originalUrl":""},{"id":203987,"priority":4,"weight":10,"zone_id":22348,"color":"","click_area":"double","creative_type":null,"fixed":0,"format":"skinz","html":"","html_usage":"","image":"","moat":0,"mobile_setup":"","desktop_setup":"","name":"[IT] News / PositanoNews_fullsite","script_url":"","ssp_id":"351740|1487708|42281","ssp_name":"smartadserver","top":220,"type":"skinz","url":"","vast_url":"","video":"","video_autoplay":1,"video_bg":"","viewability":0,"category_id":null,"end":"2038-01-19 03:14:02","campaign_id":6528,"campaign_name":"[SmartAdserver] IT Desktop Campaigns","traffic_type":"rtb","images":{"bg":""},"supported_devices":["desktop"],"cappings":{"clicks":0,"impressions":0,"duration":0},"header_bidding":false,"originalUrl":""},{"id":203988,"priority":4,"weight":10,"zone_id":22348,"color":"","click_area":"double","creative_type":null,"fixed":0,"format":"skinz","html":"","html_usage":"","image":"","moat":0,"mobile_setup":"","desktop_setup":"","name":"[IT] News / PositanoNews_fullsite","script_url":"","ssp_id":"351740|1487708|44974","ssp_name":"smartadserver","top":220,"type":"mobile","url":"","vast_url":"","video":"","video_autoplay":1,"video_bg":"","viewability":0,"category_id":null,"end":"2038-01-19 03:14:02","campaign_id":5674,"campaign_name":"[SmartAdserver] IT Mobile campaigns","traffic_type":"rtb","images":{"bg":""},"supported_devices":["mobile"],"cappings":{"clicks":0,"impressions":0,"duration":0},"header_bidding":false,"originalUrl":""}],callback:null,cookieMatchSetup:[{"url":"https://www8.smartadserver.com/ac?nwid=1827&siteid=392138&pgid=1345107&fmtid=97506&async=1&visit=m&tmstp=&gdpr_consent=${GDPR_CONSENT_45}","type":"js"}],cpms:null,css:{"commonsVideo":"body { position: static !important;}#ayads-video { height: 100%; min-height: 80px;}#ayads-video-bg { min-width: 100%; min-height: 100%; position: fixed; top: 0; left: 0; right: 0; z-index: -2147483648; cursor: pointer;}#ayads-video-bg.blurred { filter: blur(5px) brightness(75%); transform: scale(1.06);}#ayads-video-layer { z-index: -2147483647; margin: auto; width: 100%; left: 0; right: 0; -webkit-transform: translate3d(0,0,0);}#ayads-video-container { position: absolute; margin: auto; left: 50%; transform: translate3d(-50%,0,0); cursor: pointer;}#ayads-video-overlay { height: 100%; width: 100%; position: fixed; top: 0; left: 0; background-color: black; opacity: 0.5;}#ayads-video-controls { display: flex; justify-content: center; align-items: center; position: absolute; z-index: 1; bottom: 0; margin:auto;}#ayads-video-controls.paused { height: 100%; width: 100%; position: fixed; top: 0; left: 0;}#ayads-video-controls-sound { opacity: .5; transition: opacity .3s; position: absolute; right: 10px; bottom: 10px; height: 25px; width: 25px; margin: 0; background-image: url(https://cdn.ayads.co/creatives/commons/volume-up.svg);}#ayads-video-controls-sound.mute { opacity: 1; background-image: url(https://cdn.ayads.co/creatives/commons/volume-off.svg);}#ayads-video-controls-sound.mute.pulsing-sound-button { transition: opacity .2s cubic-bezier(0.4, 0, 1, 1); animation-name: pulsing-sound-button; animation-duration: 1s; animation-iteration-count: infinite; animation-direction: alternate-reverse; animation-timing-function: cubic-bezier(0.4, 0, 1, 1); cursor: pointer;}@keyframes pulsing-sound-button { from { transform: scale(1); } to { transform: scale(1.4); }}.ayads-video-buttons { background: no-repeat center; position: absolute; background-size: contain; z-index: 1; bottom: 0; margin: 10px 12px;}#ayads-video-buttons-play { height: 37px; width: 37px; position: initial; background-image: url(https://cdn.ayads.co/creatives/commons/icon-play.svg);}#play-video-pulsar{ position: absolute; background: transparent; border: 1px solid white; width: 35px; border-radius: 50%; height: 35px; z-index: 5; transform-origin: center; animation-name: play-video-pulsar; animation-duration: .5s; animation-iteration-count: infinite; animation-direction: alternate-reverse; animation-timing-function: cubic-bezier(0.4,0,1,1);}@keyframes play-video-pulsar{ from { transform:scale(1.5); opacity:.2; } to { transform:scale(1.2); opacity:1; }}.sublime-loading-bar { position: absolute; bottom: 0; height: 5px; width: 100%; background-color: white}.sublime-loading-bar-progress { position: relative; height: 5px; width: 0%; background-color: #e9531d}","mskinz":"body { position: relative !important; overflow-x: hidden !important;}.sublime-transition { transition: transform 0.2s !important;}.sublime-transition #sublime-position-indicator-block { transition: transform 0.2s, 300ms opacity ease, 300ms visibility ease !important;}#pathIdD { transform:rotate(0deg);-webkit-transform:rotate(0deg)}@media (orientation: landscape){ #ayads-html{ display:none } body { padding-top:0 !important }}html { overflow-x:initial !important; overflow-y: initial !important;}body.sublime-panel-opened { overflow:hidden !important; overflow-scrolling: auto; -webkit-overflow-scrolling:auto;}body.sublime-panel-opening { overflow:hidden !important; overflow-scrolling:auto; -webkit-overflow-scrolling:auto;}.sublime-mobile-container { background-size: contain; background: transparent url(\'https://cdn.ayads.co/creatives/loading.gif\') no-repeat 50% 50%; cursor: pointer !important; left: 0; overflow:hidden !important; position: absolute !important; width:100%;}.sublime-mobile-type-video { height: 100% !important; object-fit: cover !important;}body.sublime-landscape .sublime-mobile-type-video { object-fit: none !important;}#sublime-mobile-top-container { top: 0 !important; transform: translate(0, 0); z-index: 1 !important; width:100%; overflow: hidden;}#sublime-mobile-top-image { width:100%; background-size: cover; height: 100%;}.sublime-mobile-top-close{ z-index: 3; position: absolute; width: 25px; height: 25px; top: 4px; right: 4px; background-size: contain; background-repeat: no-repeat; background-image: url(https://cdn.ayads.co/creatives/commons/close-up.svg);}.sublime-mobile-top-close.sublime-hidden{ display: none !important;}#sublime-mobile-panel-container { box-shadow: inset 25px 0px 20px -16px rgba(0,0,0,0.5);height: 100%; position: fixed !important; top: 0; left: 100%; width: 100%; z-index: 1000000 !important; overflow: hidden !important;}#sublime-mobile-panel-img { position: absolute !important; left: 50% !important; top: 50% !important; height: 100% !important; width: auto !important; -webkit-transform: translate(-50%,-50%) !important; -ms-transform: translate(-50%,-50%) !important; transform: translate(-50%,-50%); max-width: none;}#sublime-mobile-bottom-container { box-shadow: 0px -12px 25px -2px rgba(0, 0, 0, 0.5);background-size: cover;}#sublime-mobile-bottom-container.sublime-fixed-footer-option { transition:300ms transform ease;transform:translate3d(0,0,0);position:fixed !important; bottom:0px !important; width:100% !important; z-index:10000;}.sublime-hide{ display: none;}#sublime-mobile-top-container{ transition: left .5s ease-in;}#sublime-mobile-top-container.sublime-top-fixed{ z-index: 15000000 !important; position: fixed !important;}#sublime-mobile-top-container::after { content: \"\"; display: block; width: 100%; bottom: 0; height: 0; box-shadow: 0 0 13px 11px rgba(0,0,0,0.5); position: absolute; z-index: 1;}#sublime-mobile-top-image.sublime-top-fixed{ transform: translate3d(0px, 0px, 0px) !important;}#sublime-mobile-top-img { height: auto !important; max-width: 100% !important; width:100% !important;}#sublime-mobile-bottom-img { height: auto !important; max-width: 100% !important; width:100% !important;}#sublime-mobile-panel-close { color: white !important; cursor: pointer !important; font-size: 5vw !important; padding: 10px 15px !important; position: absolute !important; right: 20px !important; top: 20px !important; z-index: 10 !important;}.sublime-indicator-container { position: absolute !important; left: 0; right: 0; bottom: 0; background: rgba(0, 0, 0, .7); color: #fff; height: 6vh; line-height: 6vh; text-align: center;}.sublime-indicator-container.hide { display: none;}.sublime-indicator-text { font-family: sans-serif; margin: 0; text-transform: uppercase; font-size: 2.3vh; height: 100%; display: inline-block; vertical-align: top;}#sublime-mobile-panel-swipe-icon { width: 3.3vh; display: inline; height: 100%; margin-right: 3vw;}#sublime-mobile-panel-swipe-icon path { fill: #ffffff;}#sublime-position-indicator-block { width: 100%; height: 25px; position: fixed!important; top: 0; left: 0; z-index: 1000001; opacity: 1; visibility: visible; transition: 300ms opacity ease, 300ms visibility ease;}#sublime-position-indicator-block.hide { opacity: 0; visibility: hidden;}#sublime-position-indicator-container { width: 50px; height: 15px; margin: 5px auto; background: rgba(0, 0, 0, .7); border-radius: 14px; text-align: center; border: 1px solid rgba(255, 255, 255, .7);}.sublime-position-indicator { width: 5px; height: 5px; border-radius: 50%; display: inline-block; background: #ffffff; transform-origin: center; vertical-align: top; margin-top: 5px;}#sublime-position-indicator-left { margin-right: 5px; width: 7px; height: 7px; margin-top: 4px;}.sublime-panel-opened #sublime-position-indicator-left { width: 5px; height: 5px; margin-top: 5px;}.sublime-panel-opened #sublime-position-indicator-right { width: 7px; height: 7px; margin-top: 4px;}#sublime-mobile-panel-arrow-container { position: fixed !important; right:0; top: 50%; border: 1px solid rgba(255, 255, 255, .7); border-right: none; z-index: 10001 !important; background: rgba(0, 0, 0, .7); -webkit-transform-origin: 50% 50%; -moz-transform-origin: 50% 50%; -ms-transform-origin: 50% 50%; -o-transform-origin: 50% 50%; transform-origin: 50% 50%; padding: 10px 5px 10px 10px; border-radius: 50px 0 0 50px;}#sublime-mobile-panel-arrow-container.hide { display:none;}#sublime-mobile-panel-arrow-container{ transition: margin .5s ease-in;}#sublime-mobile-panel-arrow-container.sublime-top-fixed{ margin-right: -50px;}.sublime-panel-opened #sublime-mobile-panel-arrow-container{ transition: margin .5s ease-in; transform: rotate(180deg); transform-origin: center; z-index: 9999999 !important;}.sublime-panel-opened #sublime-mobile-panel-arrow-container.sublime-top-fixed{ margin-right: 0px;}#sublime-mobile-panel-arrow { display:block; fill: #fff;}","mskinzVideo":"#sublime-mobile-top-image { display: none;}.sublime-indicator-container { display: none; line-height: 0;}#sublime-mobile-video { width: 100%;}.sublime-panel-opened #sublime-mobile-video { margin-top:0px;}#sublime-position-indicator-block { display: none;}#sublime-mobile-video-container { position: absolute; top: 0; width: inherit; overflow: hidden;}.sublime-mobile-video-mute { position: absolute; width: 23px; height: 23px; bottom: 4px; left: 4px; background-size: contain; background-repeat: no-repeat;}.mute-animation { animation-name: muteScale; animation-duration: 1s; animation-iteration-count: infinite; animation-direction: alternate; animation-timing-function: ease-in-out;}.sublime-mobile-video-mute.muteOff { background-image: url(https://cdn.ayads.co/creatives/commons/volume-up.svg);}.sublime-mobile-video-mute.muteOn { background-image: url(https://cdn.ayads.co/creatives/commons/volume-down.svg);}@keyframes muteScale{ 0% { transform: scale(1); } 50% { transform: scale(1); } 100%{ transform: scale(1.1); }}@keyframes countdownFixSafari{ 0% { transform: scale(1); } 100%{ transform: scale(1); }}.sublime-mobile-loading-bar{ position: absolute; bottom: 0; height: 3px; width: 100%; background-color: rgba(255, 255, 255);}.sublime-mobile-loading-bar-progress{ position: relative; height: 3px; width: 0%; background-color: rgba(233, 83, 29);}.sublime-mobile-video-play-controls { height: 100%; width: 100%; display: flex; justify-content: center; align-items: center; background: no-repeat center; position: absolute; background-size: contain; z-index: 1; bottom: 0;}#sublime-mobile-video-buttons-play { height: 37px; width: 37px; background-image: url(https://cdn.ayads.co/creatives/commons/icon-play.svg);}#play-video-pulsar { position: absolute; background: transparent; border:1px solid white; width: 35px; border-radius: 50%; height: 35px; z-index: 5; transform-origin:center; animation-name: play-video-pulsar; animation-duration: .5s; animation-iteration-count: infinite; animation-direction: alternate-reverse; animation-timing-function: cubic-bezier(0.4,0,1,1);}@keyframes play-video-pulsar { from { transform:scale(1.5); opacity:.2; } to { transform:scale(1.2); opacity:1; }}#sublime-mobile-video-overlay { height: 100%; width: 100%; position: fixed; top: 0; left: 0; background-color: black; opacity:0.5;}","mskinzShop":"@import url(https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700);#sublime-mobile-panel-container { box-shadow: none !important;}.container-criteo .product img { width: auto; max-height: 60px; margin: 0 auto; max-width: 100%;}.container-criteo .products-container { width: 100%; position: absolute; bottom: 25px; max-height: calc(60% - 10px); height: 50%;}.container-criteo .product { bottom: 0; width: 25%; height: 100%; box-sizing: border-box; float: left; text-align: center; font-size: 9px; padding: 0; background-color: #fff;}.container-criteo .product:not(:first-child) { border-left: 1px solid #d8d8d8; padding: 4px 8px;}.container-criteo .product:first-child { background-size: contain; background-repeat: no-repeat; background-position: center;}.container-criteo .product .description { display: none;}.container-criteo .product .title { margin-bottom: 5px; text-transform: uppercase; margin-top: 5px; -webkit-line-clamp: 2; max-height: 2em;}.container-criteo .product .price { margin-top: 0; -webkit-line-clamp: 1; max-height: 1em;}.container-criteo .product .title, .container-criteo .product .price { font-weight: bold; font-size: 9px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-box-orient: vertical;}.container-criteo .product h4, .container-criteo .product p { font-family: \"Source Sans Pro\", Helvetica, sans-serif;}.sublime-adchoice { height: 20px !important; width: 20px !important; background-color: #fff; position: absolute; left: 0; top: 0; z-index: 10000000; background-position-y: 3px;}.sublime-panel-opened #ayads-html > .sublime-adchoice { left: 100%;}","mskinzShopExtra":"@import url(https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600);body { margin: 0; font-family: \"Source Sans Pro\", Helvetica, sans-serif;}.container-criteo { height: 100%;}.container-criteo img { width: 100%; display: block;}.container-criteo .products-container { height: 90%; overflow-y: scroll; -webkit-overflow-scrolling:touch;}.container-criteo .product { width: calc(50% - 2px); float: left; height: 33%; background-color: #fff; position: relative; text-align: center; border: 1px solid #c7c7c7; font-family: \"Source Sans Pro\", Helvetica, sans-serif !important;}.container-criteo .product img { width: auto; max-height: 50%; margin: 0 auto; max-width: 100%; padding-top: 20px}.container-criteo .product:first-child img { width: auto; max-height: 100%; margin: 0 auto; max-width: 100%; padding-top: 0;}.container-criteo .product:first-child { background-size: contain; background-repeat: no-repeat; background-position: center;}.container-criteo > .block-top { border-bottom: 1px solid #e0e0e0;}.container-criteo .text-bottom { width: 30%; margin: calc((15% - 30px)/2) auto 0; height: 30px; text-align: center; line-height: 31px; position: relative; display: block; border: 2px solid #5b595a; color: #000; text-transform: uppercase; font-size: 12px; font-weight: 700; cursor: default;}.container-criteo > div[class^=\"block\"] { height: 10%;width: 100%; background-repeat: no-repeat; background-size: auto 100%; background-position: center top; background-color: #f9f9f9;}.container-criteo .block-bottom { position: absolute; bottom: 0; z-index: 1; box-shadow: 0 0 13px 11px rgba(0,0,0,0.5);}.container-criteo .product .product-infos { position: absolute; bottom: 5%; margin: 0 auto; left: 0; right: 0;}.container-criteo .product .description { font-size: 11px;margin: 2px 0; display: none;}.container-criteo .product .title { font-size: 11px; text-transform: uppercase; margin: 5px 0 2px;}.sublime-adchoice { height: 20px !important; width: 20px !important; background-color: #fff; position: absolute; left: 0; top: 0; z-index: 10000000;}.container-criteo .product .price { font-size: 12px; font-weight: bold; margin: 2px 0 5px;}","mskinzV2":"/** * Swiper 4.4.2 * Most modern mobile touch slider and framework with hardware accelerated transitions * http://www.idangero.us/swiper/ * * Copyright 2014-2018 Vladimir Kharlampidi * * Released under the MIT License * * Released on: December 18, 2018 */.swiper-container { margin: 0 auto; position: relative; overflow: hidden; list-style: none; padding: 0; z-index: 1}.swiper-container-no-flexbox .swiper-slide { float: left}.swiper-container-vertical > .swiper-wrapper { -webkit-box-orient: vertical; -webkit-box-direction: normal; -webkit-flex-direction: column; -ms-flex-direction: column; flex-direction: column}.swiper-wrapper { position: relative; width: 100%; height: 100%; z-index: 1; display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; display: flex; -webkit-transition-property: -webkit-transform; transition-property: -webkit-transform; -o-transition-property: transform; transition-property: transform; transition-property: transform, -webkit-transform; -webkit-box-sizing: content-box; box-sizing: content-box}.swiper-container-android .swiper-slide, .swiper-wrapper { -webkit-transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0)}.swiper-container-multirow > .swiper-wrapper { -webkit-flex-wrap: wrap; -ms-flex-wrap: wrap; flex-wrap: wrap}.swiper-container-free-mode > .swiper-wrapper { -webkit-transition-timing-function: ease-out; -o-transition-timing-function: ease-out; transition-timing-function: ease-out; margin: 0 auto}.swiper-slide { -webkit-flex-shrink: 0; -ms-flex-negative: 0; flex-shrink: 0; width: 100%; height: 100%; position: relative; -webkit-transition-property: -webkit-transform; transition-property: -webkit-transform; -o-transition-property: transform; transition-property: transform; transition-property: transform, -webkit-transform}.swiper-slide-invisible-blank { visibility: hidden}.swiper-container-autoheight, .swiper-container-autoheight .swiper-slide { height: auto}.swiper-container-autoheight .swiper-wrapper { -webkit-box-align: start; -webkit-align-items: flex-start; -ms-flex-align: start; align-items: flex-start; -webkit-transition-property: height, -webkit-transform; transition-property: height, -webkit-transform; -o-transition-property: transform, height; transition-property: transform, height; transition-property: transform, height, -webkit-transform}.swiper-container-3d { -webkit-perspective: 1200px; perspective: 1200px}.swiper-container-3d .swiper-cube-shadow, .swiper-container-3d .swiper-slide, .swiper-container-3d .swiper-slide-shadow-bottom, .swiper-container-3d .swiper-slide-shadow-left, .swiper-container-3d .swiper-slide-shadow-right, .swiper-container-3d .swiper-slide-shadow-top, .swiper-container-3d .swiper-wrapper { -webkit-transform-style: preserve-3d; transform-style: preserve-3d}.swiper-container-3d .swiper-slide-shadow-bottom, .swiper-container-3d .swiper-slide-shadow-left, .swiper-container-3d .swiper-slide-shadow-right, .swiper-container-3d .swiper-slide-shadow-top { position: absolute; left: 0; top: 0; width: 100%; height: 100%; pointer-events: none; z-index: 10}.swiper-container-3d .swiper-slide-shadow-left { background-image: -webkit-gradient(linear, right top, left top, from(rgba(0, 0, 0, .5)), to(rgba(0, 0, 0, 0))); background-image: -webkit-linear-gradient(right, rgba(0, 0, 0, .5), rgba(0, 0, 0, 0)); background-image: -o-linear-gradient(right, rgba(0, 0, 0, .5), rgba(0, 0, 0, 0)); background-image: linear-gradient(to left, rgba(0, 0, 0, .5), rgba(0, 0, 0, 0))}.swiper-container-3d .swiper-slide-shadow-right { background-image: -webkit-gradient(linear, left top, right top, from(rgba(0, 0, 0, .5)), to(rgba(0, 0, 0, 0))); background-image: -webkit-linear-gradient(left, rgba(0, 0, 0, .5), rgba(0, 0, 0, 0)); background-image: -o-linear-gradient(left, rgba(0, 0, 0, .5), rgba(0, 0, 0, 0)); background-image: linear-gradient(to right, rgba(0, 0, 0, .5), rgba(0, 0, 0, 0))}.swiper-container-3d .swiper-slide-shadow-top { background-image: -webkit-gradient(linear, left bottom, left top, from(rgba(0, 0, 0, .5)), to(rgba(0, 0, 0, 0))); background-image: -webkit-linear-gradient(bottom, rgba(0, 0, 0, .5), rgba(0, 0, 0, 0)); background-image: -o-linear-gradient(bottom, rgba(0, 0, 0, .5), rgba(0, 0, 0, 0)); background-image: linear-gradient(to top, rgba(0, 0, 0, .5), rgba(0, 0, 0, 0))}.swiper-container-3d .swiper-slide-shadow-bottom { background-image: -webkit-gradient(linear, left top, left bottom, from(rgba(0, 0, 0, .5)), to(rgba(0, 0, 0, 0))); background-image: -webkit-linear-gradient(top, rgba(0, 0, 0, .5), rgba(0, 0, 0, 0)); background-image: -o-linear-gradient(top, rgba(0, 0, 0, .5), rgba(0, 0, 0, 0)); background-image: linear-gradient(to bottom, rgba(0, 0, 0, .5), rgba(0, 0, 0, 0))}.swiper-container-wp8-horizontal, .swiper-container-wp8-horizontal > .swiper-wrapper { -ms-touch-action: pan-y; touch-action: pan-y}.swiper-container-wp8-vertical, .swiper-container-wp8-vertical > .swiper-wrapper { -ms-touch-action: pan-x; touch-action: pan-x}.swiper-container-coverflow .swiper-wrapper { -ms-perspective: 1200px}#sublime-mobile-top { overflow: hidden;}#sublime-mobile-top-container { width: 100%; left: 0; top: 0; position: absolute; -webkit-transition: left .5s linear; -moz-transition: left .5s linear; -ms-transition: left .5s linear; -o-transition: left .5s linear; transition: left .5s linear;}.sublime-mobile-top-container-v { background: #eee; height: 100vh; overflow-y: hidden;}#sublime-top-tooltip svg { position: absolute; top: 50%; right: 6vw; width: 4vw; transform: translateY(-50%); -webkit-transform: translateY(-50%); -moz-transform: translateY(-50%); -ms-transform: translateY(-50%); -o-transform: translateY(-50%);}#sublime-position-indicator-block { display: none;}#sublime-mobile-top-container.sublime-top-fixed { top: 0 !important; position: fixed !important;}#sublime-mobile-top-container .swiper-slide { text-align: center; font-size: 18px; background: #fff;}#sublime-mobile-top-container .swiper-slide img { width: 100%;}#sublime-mobile-top-container .swiper-slide { background-color: transparent; background-repeat: no-repeat; background-position: top;}#sublime-mobile-top-container .sublime-panel-slide { height: 100vh !important; background-position: center; background-size: cover;}#sublime-top-tooltip svg { position: absolute; top: 50%; right: 6vw; width: 4vw; transform: translateY(-50%); -webkit-transform: translateY(-50%); -moz-transform: translateY(-50%); -ms-transform: translateY(-50%); -o-transform: translateY(-50%);}#sublime-panel-navbar { position: fixed; top: 0; right: 0; left: 0; width: 100%; background-color: rgba(0, 0, 0, 0.5); height: 6.4vh; line-height: 6.4vh; vertical-align: middle; text-align: center; transition: opacity .3s linear; -webkit-transition: opacity .3s linear; -moz-transition: opacity .3s linear; -ms-transition: opacity .3s linear; -o-transition: opacity .3s linear; opacity: 0;}#sublime-panel-navbar #sublime-mobile-panel-arrow { position: absolute; left: 2.5vw; width: 5.4vw; margin: 1.8vh 0;}#sublime-panel-navbar .sublime-brand { max-height: 90%; max-width: 80%; width: auto; height: auto; position: absolute; top: 0; bottom: 0; left: 0; right: 0; margin: auto;}#sublime-mobile-top-container { overflow: hidden;}#sublime-mobile-top-close { position: fixed; width: 25px; opacity: 0; -webkit-transition: opacity .3s ease-in; -moz-transition: opacity .3s ease-in; -ms-transition: opacity .3s ease-in; -o-transition: opacity .3s ease-in; transition: opacity .3s ease-in; height: 25px; top: 4px; right: 4px; background-size: contain; background-repeat: no-repeat; background-image: url(https://cdn.ayads.co/creatives/commons/close-up.svg);}#sublime-mobile-top-timer { position: fixed; width: 6.4vw; height: 6.4vw; line-height: 6.4vw; top: 1vh; right: 1vh; text-align: center; border-radius: 50%; opacity: 0; -webkit-transition: opacity .3s ease-in; -moz-transition: opacity .3s ease-in; -ms-transition: opacity .3s ease-in; -o-transition: opacity .3s ease-in; transition: opacity .3s ease-in; border: 1px solid white; color: white;}#sublime-mobile-top-container .sublime-hidden, .sublime-hidden { display: none;}#sublime-overlay { position: fixed; width: 100%; height: 100%; top: 0; left: 0; right: 0; bottom: 0; background-color: rgba(0, 0, 0, 0.5); opacity: 1; -webkit-transition: opacity .5s linear; -moz-transition: opacity .5s linear; -ms-transition: opacity .5s linear; -o-transition: opacity .5s linear; transition: opacity .5s linear;}#sublime-mobile-panel-arrow-container { transition: margin .3s ease-in; position: fixed !important; right: 0; transform: translateY(-50%); -webkit-transform: translateY(-50%); -moz-transform: translateY(-50%); -ms-transform: translateY(-50%); -o-transform: translateY(-50%); margin-right: -80px;}#sublime-mobile-panel-arrow-container svg { width: 76px;}#mobile-panel-top-arrow-container { position: absolute; right: 0; z-index: 2; top: 40px; height: 50px;}#mobile-panel-top-arrow-container-img { height: 100%; width: inherit !important;}.swiper-button-next-v { left: 30% !important; bottom: 4vh !important; right: auto !important; top: auto !important; -webkit-transform: rotate(90deg) translateX(-50%); -moz-transform: rotate(90deg) translateX(-50%); -ms-transform: rotate(90deg) translateX(-50%); -o-transform: rotate(90deg) translateX(-50%); transform: rotate(90deg) translateX(-50%);}.swiper-button-prev-v { left: 70% !important; top: 8vh !important; right: auto !important; bottom: auto !important; -webkit-transform: rotate(-90deg) translateX(-50%); -moz-transform: rotate(-90deg) translateX(-50%); -ms-transform: rotate(-90deg) translateX(-50%); -o-transform: rotate(-90deg) translateX(-50%); transform: rotate(-90deg) translateX(-50%);}#sublime-container-swipe { cursor: pointer; background: white; position: absolute; bottom: 90px; right: 1.2vh; height: 30px; text-align: left; width: 180px; z-index: 3; border-radius: 15px; overflow: hidden; border: 1px solid rgb(211, 211, 211); font-family: \'Arvo\', serif; transition: width .15s linear; -webkit-transition: width .15s linear; -moz-transition: width .15s linear; -ms-transition: width .15s linear; -o-transition: width .15s linear;}#sublime-container-swipe #sublime-text-swipe { line-height: 2.5; margin-left: 10px; font-size: 12px; position: absolute; text-transform: uppercase; transition: opacity .1s linear; -webkit-transition: opacity .1s linear; -moz-transition: opacity .1s linear; -ms-transition: opacity .1s linear; -o-transition: opacity .1s linear;}#sublime-icon-swipe { width: 40px !important; position: absolute; top: -5px; right: 0;}#sublime-animation-3 { width: 70px !important; z-index: 3; position: absolute; bottom: 20px; right: calc(50% - 55px); -webkit-animation: tooltip-animation3 1.6s infinite linear; /* Safari 4.0 - 8.0 */ animation: tooltip-animation3 1.6s infinite linear; opacity: 0.84; transition: opacity 1s linear; -webkit-transition: opacity 1s linear; -moz-transition: opacity 1s linear; -ms-transition: opacity 1s linear; -o-transition: opacity 1s linear;}/* Safari 4.0 - 8.0 */@-webkit-keyframes tooltip-animation3 { 0% { left: calc(50% - 55px); } 50% { left: calc(50% - 15px); } 100% { left: calc(50% - 55px); }}@keyframes tooltip-animation3 { 0% { left: calc(50% - 55px); } 50% { left: calc(50% - 15px); } 100% { left: calc(50% - 55px); }}/* Footer */#sublime-mobile-bottom-container { background-color: rgb(255, 255, 255); width: 100%; position: absolute; left: 0; -webkit-transform: translate3d(0, 200px, 0); -moz-transform: translate3d(0, 200px, 0); -ms-transform: translate3d(0, 200px, 0); -o-transform: translate3d(0, 200px, 0); transform: translate3d(0, 200px, 0); -webkit-transition: -webkit-transform .3s ease; -moz-transition: -moz-transform .3s ease; -ms-transition: -ms-transform .3s ease; transition: transform .3s ease;}#sublime-mobile-bottom-container img { width: 100%;}#sublime-mobile-bottom-container.sublime-fixed-footer { position: fixed !important; left: 0; bottom: 0 !important; width: 100%; z-index: 996;}#sublime-top-tooltip { height: 100%; line-height: 100%; width: 16vw; z-index: 3; float: right; position: absolute; right: -16vw; top: 0; background-color: rgba(0, 0, 0, 0.35); -webkit-transition: right .5s linear; -moz-transition: right .5s linear; -ms-transition: right .5s linear; -o-transition: right .5s linear; transition: right .5s linear;}.bounce-out-right { -webkit-animation: bounce-out-right 2.5s both; animation: bounce-out-right 2.5s both;}@-webkit-keyframes bounce-out-right { 0% { -webkit-transform: translateX(0); transform: translateX(0); -webkit-animation-timing-function: ease-in; animation-timing-function: ease-in; } 15% { -webkit-transform: translateX(-16vw); transform: translateX(-16vw); -webkit-animation-timing-function: ease-out; animation-timing-function: ease-out; } 25% { -webkit-transform: translateX(-14vw); transform: translateX(-14vw); -webkit-animation-timing-function: ease-in; animation-timing-function: ease-in; } 35% { -webkit-transform: translateX(-16vw); transform: translateX(-16vw); -webkit-animation-timing-function: ease-out; animation-timing-function: ease-out; } 45% { -webkit-transform: translateX(-15vw); transform: translateX(-15vw); -webkit-animation-timing-function: ease-in; animation-timing-function: ease-in; } 55% { -webkit-transform: translateX(-16vw); transform: translateX(-16vw); -webkit-animation-timing-function: ease-out; animation-timing-function: ease-out; } 85% { -webkit-transform: translateX(-16vw); transform: translateX(-16vw); } 100% { -webkit-transform: translateX(0); transform: translateX(0); -webkit-animation-timing-function: ease-in; animation-timing-function: ease-in; }}@keyframes bounce-out-right { 0% { -webkit-transform: translateX(0); transform: translateX(0); -webkit-animation-timing-function: ease-in; animation-timing-function: ease-in; } 15% { -webkit-transform: translateX(-16vw); transform: translateX(-16vw); -webkit-animation-timing-function: ease-out; animation-timing-function: ease-out; } 25% { -webkit-transform: translateX(-14vw); transform: translateX(-14vw); -webkit-animation-timing-function: ease-in; animation-timing-function: ease-in; } 35% { -webkit-transform: translateX(-16vw); transform: translateX(-16vw); -webkit-animation-timing-function: ease-out; animation-timing-function: ease-out; } 45% { -webkit-transform: translateX(-14vw); transform: translateX(-14vw); -webkit-animation-timing-function: ease-in; animation-timing-function: ease-in; } 55% { -webkit-transform: translateX(-16vw); transform: translateX(-16vw); -webkit-animation-timing-function: ease-out; animation-timing-function: ease-out; } 85% { -webkit-transform: translateX(-16vw); transform: translateX(-16vw); } 100% { -webkit-transform: translateX(0); transform: translateX(0); -webkit-animation-timing-function: ease-in; animation-timing-function: ease-in; }}#animation4-images-container { animation: animation4-image 5s infinite; animation-delay: 1s; transform-origin: center;}.animation4-image-copy { position: absolute; top: 0; left: 100%; margin-left: 7%;}#animation4-gesture { position: absolute; left: 50%; width: 60px !important; height: 83px; bottom: -10px; opacity: .7; animation: animation4-gesture 5s infinite; animation-delay: 1s; transform: translate3d(100%, 100%, 0); filter: drop-shadow(0 0 1px #000);}#animation4-arrow { position: absolute; right: -50px; width: 50px !important; top: calc(50% - 13px); height: 26px; animation: animation4-arrow 5s infinite; animation-delay: 1s; opacity: .7; filter: drop-shadow(0 0 1px #000);}@keyframes animation4-image { 10% { transform: none; } 20% { transform: scale(.9); } 30% { transform: translate3d(-50px, 0, 0) scale(.9) } 43% { transform: translate3d(-50px, 0, 0) scale(.9); } 53% { transform: translate3d(0, 0, 0) scale(.9); } 63% { transform: scale(1); }}@keyframes animation4-gesture { 10% { transform: translate3d(0, 0, 0); } 20% { transform: scale(.8); } 30% { transform: translate3d(-50px, 0, 0) scale(.8); } 43% { transform: translate3d(-50px, 0, 0) scale(.8); } 53% { transform: translate3d(0, 0, 0) scale(.8); opacity: .7; } 63% { opacity: 0; } 100% { opacity: 0; }}@keyframes animation4-arrow { 20% { transform: translate3d(0, 0, 0); } 30% { transform: translate3d(-80px, 0, 0); } 43% { transform: translate3d(-80px, 0, 0); } 53% { transform: translate3d(0, 0, 0); }}#panel-double-buffer-image { position: fixed; width: 100vh; height: 100vh; top: 0; left: 0; right: 0; bottom: 0; background-position: center; background-size: cover;}/* MSkinz Video */#sublime-mobile-video-container { width: 100% !important; height: auto !important; position: absolute; top: 0; line-height: 0;}.sublime-mobile-video-mute { position: absolute; width: 23px; height: 23px; bottom: 4px; left: 4px; z-index: 4; background-size: contain; background-repeat: no-repeat;}.mute-animation { animation-name: muteScale; animation-duration: 1s; animation-iteration-count: infinite; animation-direction: alternate; animation-timing-function: ease-in-out;}.sublime-mobile-video-mute.muteOff { background-image: url(https://cdn.ayads.co/creatives/commons/volume-up.svg);}.sublime-mobile-video-mute.muteOn { background-image: url(https://cdn.ayads.co/creatives/commons/volume-down.svg);}@keyframes muteScale { 0% { transform: scale(1); } 50% { transform: scale(1); } 100% { transform: scale(1.1); }}@keyframes countdownFixSafari { 0% { transform: scale(1); } 100% { transform: scale(1); }}.sublime-mobile-loading-bar { position: absolute; bottom: 0; height: 3px; width: 100%; background-color: rgba(255, 255, 255);}.sublime-mobile-loading-bar-progress { position: relative; height: 3px; width: 0%; background-color: rgba(233, 83, 29);}.sublime-mobile-video-play-controls { height:100%; width:100%; display:flex; justify-content:center; align-items:center; background:no-repeat center; position:absolute; background-size:contain; z-index:1; bottom:0;}#sublime-mobile-video-buttons-play { height:37px; width:37px; background-image:url(https://cdn.ayads.co/creatives/commons/icon-play.svg);}#play-video-pulsar{ position:absolute; background:transparent; border:1px solid white; width:35px; border-radius:50%; height:35px; z-index:5; transform-origin:center; animation-name:play-video-pulsar; animation-duration:.5s; animation-iteration-count:infinite; animation-direction:alternate-reverse; animation-timing-function:cubic-bezier(0.4,0,1,1);}@keyframes play-video-pulsar{ from { transform:scale(1.5); opacity:.2; } to { transform:scale(1.2); opacity:1; }}#sublime-mobile-video-overlay { height:100%; width:100%; position:inherit; top:0; left:0; background-color:black; opacity:0.5;}/* Move video on the panel when it open when class sublime-video-panel-open is set top the top container *//* This CSS replace the .appendChild() we did on the video container */#sublime-mobile-top-container.sublime-video-panel-open { transform: none !important; /* Cancel 3d slide effects from swiper.js */}#sublime-mobile-top-container.sublime-video-panel-open #sublime-mobile-video-container { top: 6.4vh; /* Margin of the return button */ left: 100% !important; /* This push the video to the left on the other panel */}#sublime-mobile-top-container.sublime-video-panel-open #sublime-mobile-panel-container { z-index: -1 !important; /* Pass panel container behind video top */}#sublime-mobile-top-container.sublime-video-panel-open #sublime-mobile-top { transform: none !important; /* Cancel 3d slide effects from swiper.js */ overflow: visible !important; /* Force video top to be print on the screen */}#sublime-mobile-top-container.sublime-video-panel-open #sublime-top-tooltip,#sublime-mobile-top-container.sublime-video-panel-open #sublime-mobile-top-image-copy { display: none; /* Since we print the overflow of the mobile top on the panel, we need to hide the slide tooltip AND the copy image (DL-1168) */}.mksinz-simple #sublime-mobile-video-container video { width: 100% !important;}.mksinz-simple .sublime-panel-slide #sublime-mobile-video-container { transform: translateY(-50%); top: 50% !important;}#sublime-fullscreen-icon { filter: invert(100%); height: 1.2em !important; width: auto !important; vertical-align: middle; margin-top: -0.2em !important;}#sublime-fullscreen { position: absolute; top: calc(50vh + 50vw + 20px); color: #FFF; left: 50%; transform: translateX(-50%); border: 1px solid #FFF; border-radius: 5px; padding: 8px; white-space: nowrap; font-size: 4vw !important;}#sublime-fullscreen:active { background: rgba(255, 255, 255, .3)}#ayads-html.sublime-landscape-display { display: block !important}#sublime-mobile-video-bg { position: absolute; z-index: -1; width: 100%; left: 0; top: 0; height: 100%; object-fit: cover; filter: blur(5px);}.sublime-video-bottom-hidden { display: none !important; }","shop":"body { position: static!important;}#sublime-ad-shop-left, #sublime-ad-shop-right { z-index: -1; position: absolute; transition: all 0.7s linear; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; padding: 0;}#sublime-ad-shop-left { -webkit-transform: translateX(-100%); -ms-transform: translateX(-100%); transform: translateX(-100%);}#sublime-ad-shop-right { -webkit-transform: translateX(100%); -ms-transform: translateX(100%); transform: translateX(100%);}.sublime-ad-item { text-align: center; transition: all 0.3s linear; position: relative; /*box-sizing: border-box;*/}.sublime-ad-item a { display: block; position: absolute; height: 100%;}.sublime-ad-item-title { font-weight: 600; font-size: 12px; margin: 5px 0 0 0; padding: 0 30%;}.sublime-ad-privacy-link { position: absolute;}.sublime-ad-item { background: #FFF; color: #000; font-size: 12px; overflow: hidden; text-align: center;}.sublime-ad-item a { box-sizing: border-box; color: #555; display: block; text-decoration: none; width: 100%;}#sskz-bigTitle > .sublime-ad-item a { width: calc(100% - 60px);}.sublime-ad-item img.sublime-ad-item-image { display: inline;}.sublime-ad-item-name { height: 28px; overflow: hidden; font-family: Arial, sans-serif !important; margin-top: 2px;}.sublime-ad-item-price-container { font-weight: bold; font-family: Arial, sans-serif !important;}img.sublime-ad-item-logo { height: 20px !important; vertical-align: middle; border: none; display: inline-block;}.sublime-ad-item-discount_price { text-decoration: line-through; color: #999}.sublime-ad-item-discount { color: #FFF; position: absolute; top: 10px; left: 10px; background: #fe0d54; border-radius: 20px; font-size: 15px; line-height: 40px; width: 40px;}#ayads-html { top: 0px; position: absolute; overflow: hidden;}#sskz-bigTitle { position: absolute; top: 0; margin: 0 auto; width: 770px; height: inherit; overflow: hidden;}#sskz-bigTitle #criteo-logo { position: absolute; display: block; margin: auto; max-width: 340px; left: 0; top: 0px;}#sskz-bigTitle .sublime-ad-top-texte { font-size: 30px; font-weight: 200; font-family: \'Raleway\', sans-serif; z-index: 2; position: absolute; bottom: 20px; display: block; left: 0px; height: 60px; padding-left: 11px;}#sskz-bigTitle>.sublime-ad-item-top { position: absolute; z-index: 11; width: 200px; right: 150px; padding: 10px 30px; box-sizing: initial !important;}.sublime-ad-item-top img { max-height: 130px;}.sublime-ad-item-top .sublime-ad-item-name { bottom: -220px; left: 0;}.sublime-ad-item-top .sublime-ad-item-price-container { top: 0;}.sublime-ad-item-top:hover .sublime-ad-item-price-container { right: 0 !important;}.sublime-ad-item-top:hover .sublime-ad-item-name { bottom: 0 !important;}","shopData":"#sublime-ad-shop-left, #sublime-ad-shop-right { padding: 0 2px;}.sublime-ad-item { border-radius: 6px; box-shadow: 0 0 7px rgba(0,0,0,.8); margin-bottom: 30px; height: 180px; line-height: 14px;}.sublime-ad-item a { box-sizing: border-box; color: #555; display: block; padding: 23px 18px; position: absolute; text-decoration: none; width: 100%;}.sublime-ad-item-price-container { color: red;}img.sublime-ad-item-image { height: 85px;}.sublime-ad-item:hover { transform: scale(1.1);}.sublime-ad-item-price { margin-left: 5px;}","toproll":"#sublime-container { position: relative; box-sizing: border-box;}#sublime-slot { position: fixed; left: 0; top: 0; width: 100%; overflow: hidden; pointer-events: none;}/* UTILS * ----------------------------------------------- */#sublime-container .sublime--hide { display: none;}/* MAIN CONTAINERS * ----------------------------------------------- *//* Main wrapper for our video format */#sublime-video-wrapper { position: fixed; z-index: 2147483647; /* max z-index possible */ top: 0; left: 0; height: 100%; width: 100%; box-sizing: border-box; overflow: hidden; /* Video background is transparent so we need a background color behind. We should consider using the color defined within the ad format. */ background-color: #000;}body:not(.sublime-toproll-expand) #sublime-video-wrapper { /* Next line works around a layout issue on iOS (DL-1902). Behaviour is more or less this https://drafts.csswg.org/css-sizing-4/#valdef-width-stretch we use the old prefixed name for this to work (spec did change). For those wondering, sizing the wrapper to 100vh exhibits the same issue. This avoids having `videoWrapper.clientHeight` > `container.clientHeight` when scrolling up on iOS (thus masking Safari’s address and tool bar). Normally, #sublime-video-wrapper height is set to 100% of #sublime-container, which own height is set on TopRoll init to `window.innerHeight` (viewport height). */ height: -webkit-fill-available;}/* Main video element */#sublime-video { height: 100%; width: 100%;}/* Main video background element */#sublime-video-background { position:absolute; z-index: -1; filter: blur(2px);}/* UI CONTAINER * ----------------------------------------------- */#sublime-video-overlay { position:absolute; top:0; left:0; z-index: 2; width: 100%; height: 100%; box-sizing: border-box; transition: background-color .8s;}/* Visual effects for all icons */#sublime-video-overlay .sublime--icon { filter: drop-shadow(0 0 5px #000); width: 5vmin; height: 5vmin;}/* In expand mode, our icons are slightly larger */.sublime-toproll-expand #sublime-video-overlay .sublime--icon { width: 6vmin; height: 6vmin;}/* In large desktop screen, we make our UI smaller */@media (orientation: landscape) and (min-width: 1200px) { #sublime-video-overlay .sublime--icon { width: 2.5vmin; height: 2.5vmin; } .sublime-toproll-expand #sublime-video-overlay .sublime--icon { width: 3vmin; height: 3vmin; }}/* Class for the basic positionning of our icons. * Multiple icons are not yet defined, but a transformation * with a combinator selector (+ or ~) looks like a good candidate */#sublime-video-overlay .sublime--top { top: 2vmin; }#sublime-video-overlay .sublime--bottom { bottom: 2vmin; }#sublime-video-overlay .sublime--left { left: 2vmin; }#sublime-video-overlay .sublime--right { right: 2vmin; }.sublime-toproll-expand #sublime-video-overlay .sublime--top { top: 2vmax; }.sublime-toproll-expand #sublime-video-overlay .sublime--bottom { bottom: 2vmax; }.sublime-toproll-expand #sublime-video-overlay .sublime--left { left: 2vmax; }.sublime-toproll-expand #sublime-video-overlay .sublime--right { right: 2vmax; }@media (orientation: landscape) and (min-width: 1200px) { #sublime-video-overlay .sublime--top { top: 1.5vmin; } #sublime-video-overlay .sublime--bottom { bottom: 1.5vmin; } #sublime-video-overlay .sublime--left { left: 1.5vmin; } #sublime-video-overlay .sublime--right { right: 1.5vmin; } .sublime-toproll-expand #sublime-video-overlay .sublime--top { top: 1.5vmin; } .sublime-toproll-expand #sublime-video-overlay .sublime--bottom { bottom: 1.5vmin; } .sublime-toproll-expand #sublime-video-overlay .sublime--left { left: 1.5vmin; } .sublime-toproll-expand #sublime-video-overlay .sublime--right { right: 1.5vmin; }}.sublime--video-complete #sublime-video-overlay { background-color: rgba(0, 0, 0, .5);}/* SPECIFIC ICONS DEFINITION * ----------------------------------------------- *//* Sound icon *//* recalculate the specificity when we have the Toproll class */#sublime-ui-sound { position: absolute; background: url(\'data:image/svg+xml,\'); background-size: contain; opacity: .8; /* Icons are defined as NOT visible; their specific visibility according to UI state is defined in the ad-hoc section */ display: none;}#sublime-ui-sound.sublime--muted { background-image: url(\'data:image/svg+xml,\');}/* Close icon */#sublime-ui-close { position: absolute; z-index: 2; font: 4vmin/1.5 sans-serif; text-align: center; color: white;}.sublime-toproll-expand #sublime-ui-close { font-size: 6vmin; /* font-size needs to be adjust to fit the icon size */}@media (orientation: landscape) and (min-width: 1200px) { /* font-size needs to be adjust to fit the icon size */ #sublime-ui-close { font-size: 2.5vmin; } .sublime-toproll-expand #sublime-ui-close { font-size: 3vmin; }}#sublime-ui-close.sublime--icon-cross { background-image: url(\'data:image/svg+xml,\');}/* Collapse icon */#sublime-ui-collapse { position:absolute; background: url(\'data:image/svg+xml,\'); background-size: contain; /* Icons are defined as NOT visible; their specific visibility according to UI state is defined in the ad-hoc section */ display: none;}/* CTA button (not a generic icon) */#sublime-ui-cta { position: absolute; bottom: 0; left: 0; /* Icons are defined as NOT visible; their specific visibility according to UI state is defined in the ad-hoc section */ display: none; /* display: flex; */ align-items: center; padding: 0.1em 1.5em 0 .7em; border-radius: 8em; border: 2px solid #fff; font: bold 12px/2 sans-serif; text-transform: uppercase; white-space: nowrap; color: #eee;}#sublime-ui-cta::before { content: \'\'; display: block; height: 3em; width: 3em; margin: 0; border-radius: 3em; background-image: url(\'data:image/svg+xml,\'); background-repeat: no-repeat; background-size: 1.9em; background-position: center;}/* In desktop mode we want a larger CTA */@media (orientation: landscape) and (min-width: 1200px) { #sublime-ui-cta { font-size: 24px; }}/* recalculate the specificity when we have the Toproll class */#sublime-ui-touchscroll { position: absolute; filter: drop-shadow(0 0 10px rgba(0,0,0,.45)); width: 10vmin; height: 15vmin; transform: translate(-2vmin, 2vmin); background-image: url(\'data:image/svg+xml,\ \ \ \ \ \ \ \ \ \ \ \ \ \ \'); /* Icons are defined as NOT visible; their specific visibility according to UI state is defined in the ad-hoc section */ display: none;}/* In large desktop screen, we make our UI smaller */@media (orientation: landscape) and (min-width: 1200px) { #sublime-ui-touchscroll { width: 5vmin; height: 7.5vmin; transform: translate(-1vmin, 1vmin); }}/* Replay icon */#sublime-ui-replay { position: absolute; background-image: url(\'data:image/svg+xml,\'); background-size: contain; /* Icons are defined as NOT visible; their specific visibility according to UI state is defined in the ad-hoc section */ display: none;}/* Icons\' visibility states *//* Any (loaded) toproll states except expand state *//* Explicit \"body\" selector to not have :not() matching another touchscroll ancestor */body:not(.sublime-toproll-loading):not(.sublime-toproll-expand):not(.sublime--video-complete) #sublime-ui-touchscroll,/* In expand state */.sublime-toproll-expand #sublime-ui-collapse,.sublime-toproll-expand:not(.sublime-toproll-loading):not(.sublime--video-complete) #sublime-ui-sound,/* When this is visible #sublime-ui-touchscroll & #sublime-ui-sound are not */.sublime--video-complete #sublime-ui-replay { display: block;}/* CTA is only displayed when video is complete */.sublime-toproll-full.sublime--video-complete #sublime-ui-cta,.sublime-toproll-expand-transition.sublime--video-complete #sublime-ui-cta,.sublime-toproll-expand.sublime--video-complete #sublime-ui-cta { display: flex;}","videoReminder":"#ayads-video-container { margin-right: 0; transition: margin-right 0.5s ease-out; box-shadow: none !important;}#ayads-video-container.sublime-reminder { position: fixed !important; bottom: 0 !important; margin-top: auto !important; z-index: 100000000 !important; transform: translate3d(0%,0,0) !important; left: inherit;}/* We dont want our ad to use \"auto\" as width because it need to fit in the container width */#ayads-video { width: inherit; display: block;}#ayads-video.sublime-reminder { width: 100% !important; height: initial !important; min-height: initial !important;}#sublime-video-close { transition: opacity 0.2s ease-out, top 0.3s ease-out; top: 10px; right: 0; width: 20px; height: 20px; opacity: 0; background-image: url(\"https://cdn.ayads.co/creatives/commons/close-up.svg\");}#ayads-video-container.sublime-reminder:hover #sublime-video-close{ opacity: 1; top: 0;}#sublime-video-close.show { display: inherit !important;}#sublime-video-close.hide { display: none !important;}"},currencies:null,defaultProtocol:"https",electionOrdering:null,eventCollectorEndpoint:"https://event-collector-staging.ayads.co/collect",eventEmitterSampling:0,featureFlipping:{"smartConsent":true,"smartKeywordConsent":true,"stickyConsent":[23651,19014,348,19342,2576,3408,3409,4428,4430,5733,5836,7131,7135,9466,16087,17392,17486,18516,19245,19688,20373,21551,21647,22921,21627,29433],"improveConsent":[23651,19014,348,19342,2576,3408,3409,4428,4430,5733,5836,7131,7135,9466,16087,17392,17486,18516,19245,19688,20373,21551,21647,22921,21627,29433],"cookieConsent":[23651,19014,348,19342,2576,3408,3409,4428,4430,5733,5836,7131,7135,9466,16087,17392,17486,18516,19245,19688,20373,21551,21647,22921,21627,29433],"appnexusSendImpressionId":[16235],"smartSendImpressionId":[16235],"noPixelBeforeRender":[],"noPipedNumericSmartKeywords":[],"blankSJS":[],"jsBundler":[1458,102,3587]},gdprApplies:true,mode:"wf",prebidBidHost:null,prebidGlobal:null,sspSetup:{"improve":[],"appnexus":[],"smartadserver":[],"sticky":[]},versionId:20211105131840,siteId:17485,sources:[],srcType:"a",zone:{"id":22348,"site_id":17485,"main_category_id":80,"sub_category_id":64,"html":"\n\n","passback":"","mobilepassback":"","premium":0,"block_cookies":0,"scale":0.99,"url":"www.positanonews.it","width":0,"mobile_setup":{"footer_fixed":1},"sticky_setup":{"js":"","css":".celtra-expanded-ad {z-index: 21474836460 !important;}"},"mobilecss":"/* auto_migrated:DL-1640 */\n#sublime-mobile-top-container {margin-top: 42px;}\n.sublime-panel-opened #sublime-mobile-top-container, #sublime-mobile-top-container.sublime-video-panel-open #sublime-mobile-panel-container, #sublime-mobile-top-container .sublime-panel-slide {margin-top: 0 !important;}\n.sublime-panel-opened #wrap-topbar {z-index: 1;}\n\n/* TopRoll */\n.sublime-toproll:not(.sublime-toproll-expand):not(.sublime-toproll-expand-transition) #sublime-video-wrapper {top: 42px;}\n.sublime-toproll.sublime-toproll-expand #wrap-topbar, .sublime-toproll.sublime-toproll-expand-transition #wrap-topbar {position: relative;}\n.sublime-toproll.sublime-toproll-expand #header-search-box, .sublime-toproll.sublime-toproll-expand-transition #header-search-box {position: absolute;}\n.sublime-toproll.sublime-toproll-expand, .sublime-toproll.sublime-toproll-expand-transition {padding-top: 0;}","mobilejs":"var videoSizes = {},\n body = top.document.body,\n sublimeAdTop, sublimeTopRoll, sublimeTopRollWrapper, sublimeTopRollVideo, ratio;\n\nfunction init(){\n sublimeAdTop = top.window.document.querySelector(\'#sublime-mobile-top-container\');\n sublimeTopRoll = top.window.document.querySelector(\'#sublime-container\');\n sublimeTopRollWrapper = top.document.querySelector(\'#sublime-video-wrapper\');\n sublimeTopRollVideo = top.document.querySelector(\'#sublime-container #sublime-video\');\n\n if (sublimeTopRoll) { /* For TopRoll format */\n videoSizes = {\n realWidth: sublimeTopRollVideo.videoWidth,\n realHeight: sublimeTopRollVideo.videoHeight,\n width: sublimeTopRollVideo.offsetWidth\n };\n ratio = Math.ceil((videoSizes.width / videoSizes.realWidth) * 100) / 100;\n\n body.classList.add(\'sublime-topRoll\');\n getLimitTopVideo();\n top.window.addEventListener(\'scroll\', getLimitTopVideo);\n } else if (sublimeAdTop.offsetHeight > 0) { /* For Mskin format */\n body.style.paddingTop = (sublimeAdTop.offsetHeight + 42) + \"px\";\n } else {\n sublime.timer.setTimeout(function() { init(); }, 200);\n }\n}\n\n/* Detect if the TopRoll is expanded */\nfunction getLimitTopVideo() {\n if (sublimeTopRollVideo.offsetHeight > Math.ceil(videoSizes.realHeight * ratio)) {\n body.classList.add(\'sublime-topRoll-expand\');\n } else {\n body.classList.remove(\'sublime-topRoll-expand\');\n }\n}\n\n/* Detect if the element we need is present */\nfunction checkDivPresence(div, callback){\n var myDiv = top.document.querySelectorAll(div)[0];\n if (myDiv) {\n callback();\n } else {\n sublime.timer.setTimeout(function() { checkDivPresence(div, callback); }, 100);\n }\n}\n\nif (sublime.creativeAd.mobile_setup.top.video) {\n /* launch the functions if there is a video */\n sublime.hook.register(\'step.video.quartile0\', function(){\n checkDivPresence(\'#sublime-mobile-top-container\', init);\n checkDivPresence(\'#sublime-container\', init);\n });\n} else {\n sublime.hook.register(\'step.impression.sec1\', function(){\n checkDivPresence(\'#sublime-mobile-top-container\', init);\n });\n}\n\n/* Remove all changes if the sublime.cleanUp() is executed */\nsublime.hook.register(\'event.cleanUp\', function(){\n body.style.paddingTop = \"\";\n body.classList.remove(\'sublime-topRoll\');\n body.classList.remove(\'sublime-topRoll-expand\');\n top.window.removeEventListener(\'scroll\', getLimitTopVideo);\n});","mobile_bottom_selector":"","mobile_bottom_append_position":"","tag_type":"waterfall","video_mute":0,"video_autoplay":1,"passback_render":"iframe","sjs_debug":0,"country":"IT","site_url":"www.positanonews.it","company_id":2020,"autoskinz":1,"autovideo":1,"use_cls_desktop":0,"use_cls_mobile":0,"desktop_html_cls":"","desktop_scale_cls":100.00,"mobile_js_cls":"","mobile_css_cls":"","supported_devices":["mobile","desktop"],"main_category_name":"News","sub_category_name":"Local News","nortb":0,"novideo":0,"noreminder":0,"host":"www.positanonews.it","cappings":{"impressions":0,"impressions_mobile":0,"duration":86400},"accepted_placement_types":{"desktop":{"skinz":1},"mobile":{"mskinz":1,"toproll":1}},"ignore_client_width":false,"scaleCompat":99,"continent":"EU","mmd":5,"mmm":3},zoneAcceptedPlacementTypes:{"desktop":{"skinz":1},"mobile":{"mskinz":1,"toproll":1}},zoneId:22348,zoneNoReminder:0,zoneNovideo:0,zoneScale:0.99,zoneSetup:"\n\n",zoneSiteUrl:"www.positanonews.it",zoneVideoAutoplay:1,zoneUseCLSDesktop:false,zoneUseCLSMobile:false,zoneDesktopHtmlCLS:"",smartExtraKeywords:{"mobile":{"toproll-m":150,"skinz-m":150,"bottom-m":150},"desktop":{"skinz-d":300}},appnexusExtraKeywords:{"mobile":{"toproll-m":150,"skinz-m":150,"bottom-m":150},"desktop":{"skinz-d":300}},zoneIgnoreClientWidth:false,zoneMonetizedImpressionDesktop:5,zoneMonetizedImpressionMobile:3,xhrWithCredentials:true,moatScriptDisplay:"https://z.moatads.com/sublimeskinz337986118618/moatad.js",moatScriptVideo:"https://z.moatads.com/sublimeskinzjsvidint156314443957/moatvideo.js",sirData:{"enabled":true,"pid":28662,"keyid":33,"delay":100,"useCanonicalUrl":true},dar:{"enabled":false},};const env=function env(name){if(name in envVars){return envVars[name];} if(name in globalVars){return globalVars[name];} console.error('Env '+name+' is not defined');return undefined;};if(typeof window!=='undefined'){window.sublime=window.sublime||{};window.sublime.env=env;} const TIME_START=Date.now();const MAX_TIME_DELAY=30000;const currentWindow=window;const sublime=currentWindow.sublime||{};sublime.originWindow=currentWindow;let highestAccessibleWindow=currentWindow;while(highestAccessibleWindow!==currentWindow.top){try{if(highestAccessibleWindow.parent.document){highestAccessibleWindow=highestAccessibleWindow.parent;}else{break;}}catch(e){break;}} sublime.window=highestAccessibleWindow;sublime.windowIsTop=highestAccessibleWindow===currentWindow.top;sublime.document=highestAccessibleWindow.document;sublime.isSSL=highestAccessibleWindow.location.protocol==='https:';if(highestAccessibleWindow.performance.timeOrigin){sublime.timeStart=highestAccessibleWindow.performance.timeOrigin;}else if(highestAccessibleWindow.performance.timing&&highestAccessibleWindow.performance.timing.navigationStart){sublime.timeStart=highestAccessibleWindow.performance.timing.navigationStart;}else if(sublime.timeStart&&Number(sublime.timeStart)>TIME_START-MAX_TIME_DELAY){sublime.timeStart=Number(sublime.timeStart);}else{sublime.timeStart=TIME_START;} sublime.ivTime=highestAccessibleWindow.performance.now();sublime.loadedCount=(sublime.loadedCount+1)||1;sublime.versionId=env('versionId')||'1337';sublime.srcType=env('srcType')||'U';sublime.noOp=function noOp(){};highestAccessibleWindow.sublime=sublime;currentWindow.sublime=sublime;function reverse(promise){return new Promise(function promiseReverse(promiseResolve,promiseReject){return Promise.resolve(promise).then(promiseReject,promiseResolve);});} function promiseAny(promises){return reverse(Promise.all(Array.from(promises,reverse)));} sublime.Promise=Promise;const OS_UA_MATCHER=/\b(Mac OS X|Windows (?:NT|Phone)|CPU(?: iPhone| iPod| iPad)? OS|Android)[^)]+?([0-9._]+)/i;const MOBILE_UA_MATCHER=/(?:phone|windows\s+phone|ipod|blackberry|Galaxy Nexus|SM-G892A|(?:android|bbd+|meego|silk|googlebot) .+?mobile|palm|windows\s+ce|opera mini|avantgo|docomo)/i;const TABLET_UA_MATCHER=/(?:ipad|playbook|Tablet|(?:android|bb\d+|meego|silk)(?! .+? mobile))/i;const IE_UA_MATCHER=/MSIE ([0-9._]+)/;const EDGE_UA_MATCHER=/Edge?\/([0-9._]+)/;const CHROME_UA_MATCHER=/ Chrom(?:e|ium)\/([0-9._]+)/;const SAFARI_UA_MATCHER=/Version\/([0-9._]+)(?: Mobile.*?)? Safari\//;const FIREFOX_UA_MATCHER=/Gecko\/[0-9._]+ Firefox\/([0-9._]+)/;const DEVICE_TYPE=Object.freeze({MOBILE:'mobile',TABLET:'tablet',DESKTOP:'desktop',});const OS=Object.freeze({IOS:'iOS',MACOS:'Mac',ANDROID:'android',WINDOWS:'Windows',WINDOWS_PHONE:'windowsPhone',});const BROWSER=Object.freeze({CHROME:'Chrome',SAFARI:'Safari',FIREFOX:'Firefox',EDGE:'Edge',IE:'Internet Explorer',});const SIZE=Object.freeze({SMALL:'small',LARGE:'large',MEDIUM:'medium',UNKNOWN:'unknown',});const FEATURES_DETECT={DATA_SAVER:()=>(sublime.window.navigator.connection&&sublime.window.navigator.connection.saveData),};const device={get type(){const ua=sublime.window.navigator.userAgent;return((MOBILE_UA_MATCHER.test(ua)&&DEVICE_TYPE.MOBILE)||(TABLET_UA_MATCHER.test(ua)&&DEVICE_TYPE.TABLET)||DEVICE_TYPE.DESKTOP);},get os(){const ua=sublime.window.navigator.userAgent;const data=OS_UA_MATCHER.exec(ua);let name='';let version=0;if(data){name=data[1].toUpperCase().replace('MAC OS X',OS.MACOS).replace('WINDOWS PHONE',OS.WINDOWS_PHONE).replace('WINDOWS NT',OS.WINDOWS).replace(/^CPU.*$/,OS.IOS).replace('ANDROID',OS.ANDROID);version=parseFloat(data[2].replace(/_/g,'.'));} return Object.freeze({name:name,version:version});},get browser(){const ua=sublime.window.navigator.userAgent;function version(str){return parseFloat(str.replace(/_/g,'.'));} const edge=EDGE_UA_MATCHER.exec(ua);if(edge){return Object.freeze({name:BROWSER.EDGE,version:version(edge[1])});} const safari=SAFARI_UA_MATCHER.exec(ua);if(safari){return Object.freeze({name:BROWSER.SAFARI,version:version(safari[1])});} const firefox=FIREFOX_UA_MATCHER.exec(ua);if(firefox){return Object.freeze({name:BROWSER.FIREFOX,version:version(firefox[1])});} const chrome=CHROME_UA_MATCHER.exec(ua);if(chrome){return Object.freeze({name:BROWSER.CHROME,version:version(chrome[1])});} const ie=IE_UA_MATCHER.exec(ua);if(ie){return Object.freeze({name:BROWSER.IE,version:parseFloat(sublime.document.documentMode)||version(ie[1])||0,});} return Object.freeze({name:'',version:0});},get screen(){if(!sublime.window.innerWidth){return SIZE.UNKNOWN;} const width=sublime.window.innerWidth / env('zoneScale');return((width<=1024&&SIZE.SMALL)||(width<=1299&&SIZE.MEDIUM)||SIZE.LARGE);},is:(...strs)=>Boolean(strs.length)&&strs.every((str)=>(device.type===str||device.os.name===str||device.browser.name===str||device.screen===str)),hasFeature(featureName){return Boolean(FEATURES_DETECT[featureName]&&FEATURES_DETECT[featureName]());},...DEVICE_TYPE,...OS,...BROWSER,SCREEN:SIZE,FEATURE:Object.freeze(Object.keys(FEATURES_DETECT).reduce((obj,key)=>({...obj,[key]:key}),{})),};device.is=new Proxy(device.is,{get:(target,prop)=>(target[prop]||device.is(device[prop.toUpperCase()])),});if(typeof window!=='undefined'){window.sublime=window.sublime||{};window.sublime.device=device.type;window.sublime.detectDevice=Object.assign(window.sublime.detectDevice||{},{detectType(){return device.type;},detectMobileOS(){if(device.is(device.IOS)||device.is(device.ANDROID)||device.is(device.WINDOWS_PHONE)){return device.os;} return{name:false,version:false};},isDataSaverEnabled(){return device.hasFeature('DATA_SAVER');},categorizedScreenSize(){return device.screen;},});Object.defineProperties(window.sublime,{IEVersion:{get:()=>((device.is(device.IE)&&device.browser.version)||0),configurable:true,},isEdge:{get:device.is.bind(null,device.EDGE),configurable:true,},isIe:{get:()=>(device.is(device.IE)||device.is(device.EDGE)),configurable:true,},isChrome:{get:device.is.bind(null,device.CHROME),configurable:true,},isFirefox:{get:device.is.bind(null,device.FIREFOX),configurable:true,},isWindowsSafari:{get:device.is.bind(null,device.SAFARI,device.WINDOWS),configurable:true,},isIphoneSafari:{get:device.is.bind(null,device.SAFARI,device.IOS),configurable:true,},});} function addCss(css,document){const id=env('sublime_prefix')+'-style';const doc=document||sublime.document;let style=doc.getElementById(id);if(!style){style=doc.createElement('style');style.type='text/css';style.id=id;doc.head.appendChild(style);} if(style.styleSheet){style.styleSheet.cssText+=css;}else{style.appendChild(doc.createTextNode(css));}} if(typeof window!=='undefined'){window.sublime=window.sublime||{};window.sublime.helpers=window.sublime.helpers||{};window.sublime.helpers.addCss=addCss;} const merge=function merge(){const args=Array.prototype.slice.call(arguments,0);let result;if(Array.isArray(args[0])){result=[];}else if(args[0]&&typeof args[0]==='object'){result={};}else{return args[0];} args.forEach(function mergeArgsForEach(obj){if(!obj){return;} Object.keys(obj).forEach(function mergeArgsForEachKey(key){if(!Array.isArray(obj[key])&&obj[key]&&typeof obj[key]==='object'&&result[key]&&typeof result[key]==='object'){result[key]=merge(result[key],obj[key]);}else{result[key]=obj[key];}});});return result;};if(typeof window!=='undefined'){window.sublime=window.sublime||{};window.sublime.merge=merge;} function isOfType(type,data){return typeof data!=='undefined'&&Object.prototype.toString.call(data)==='[object '+type+']';} function isScalar(data){return(/boolean|number|string/).test(typeof data);} function isNum(n){return!isNaN(parseFloat(n))&&isFinite(n);} function pInt(n,base){var integer=parseInt(n,base||10);return isNum(integer)?integer:null;} const isString=isOfType.bind(null,'String');function ucFirst(string){return String(string).charAt(0).toUpperCase()+String(string).slice(1);} function inArray(data,dataList,returnIndex){const index=dataList.indexOf(data);return returnIndex?index:(index>-1);} const isArray=isOfType.bind(null,'Array');const isFunction=isOfType.bind(null,'Function');const isObject=isOfType.bind(null,'Object');function isDefined(prop){return prop!==undefined&&prop!==null&&prop!=='undefined';} function isEmpty(data){if(data==null){return true;} if(isArray(data)){return data.length===0;} if(isObject(data)){return Object.keys(data).length===0;} return!data;} if(typeof window!=='undefined'){window.sublime=window.sublime||{};window.sublime.isEmpty=isEmpty;} function parseUrlQueryString(url){let qs='';if(url.indexOf('?')>-1){qs=url.substring(url.indexOf('?')+1);}else if(!isUrl(url)){qs=url;} if(!qs){return{};} if(qs.indexOf('#')>-1){qs=qs.substring(0,qs.indexOf('#'));} return qs.replace(/&/g,'&').split('&').reduce(function extractKeyValuePair(params,str){const data=str.split('=');const key=data[0];const value=data[1]&&decodeURIComponent(data[1]);const pair={};if(key.indexOf('[')===-1){pair[key]=value;return merge({},params,pair);} if(key.indexOf('[')===0){return merge({},params);} const structure=key.match(/^([a-z0-9]+)\[([a-z-0-9]*)]$/i);const parent=structure[1];const child=structure[2];if(child){pair[parent]=params[parent]||{};pair[parent][child]=value;}else{pair[parent]=params[parent]||[];pair[parent].push(value);} return merge({},params,pair);},{});} function buildUrlQueryString(params){if(!params){return'';} return Object.keys(params).map(function map(key){const value=params[key];if(!isDefined(value)){return key;} if(isArray(value)){return value.map(function eachValue(val){return key+'[]'+(isDefined(val)?'='+encodeURIComponent(val):'');}).join('&');} if(isObject(value)){return Object.keys(value).map(function eachValue(subKey){const val=value[subKey];return key+'['+subKey+']'+(isDefined(val)?'='+encodeURIComponent(val):'');}).join('&');} return key+'='+encodeURIComponent(value);}).join('&');} function mergeUrlQueryString(){if(arguments.length===0){throw new Error('Merge needs arguments');} const args=Array.prototype.slice.call(arguments);return args.reduce(function processArgs(qs,arg){if(typeof arg==='string'){return merge({},qs,parseUrlQueryString(arg));} if(!isObject(arg)){throw new Error("Can't merge non object");} return merge({},qs,arg);},{});} function mergeAndBuildUrlQueryString(){return buildUrlQueryString(mergeUrlQueryString.apply(null,arguments));} function parseUrl(url){const regex=/^(?:(https?):)?(?:\/\/)?([0-9a-z-._]+)?(\/[^?#]*)?(?:\?([^#]*))?(?:#(.*))?$/i;const parts=url.match(regex)||[];return{url:url,scheme:parts[1]||'',host:parts[2]||'',path:parts[3]||'',query:parts[4]||'',hash:parts[5]||'',};} function buildUrl(params){return((params.scheme?params.scheme+':':'')+'//' +params.host +params.path +(params.query?'?'+params.query:'') +(params.hash?'#'+params.hash:''));} function setUrlProtocol(url,ssl){const parts=parseUrl(url);if(ssl===true){parts.scheme='https';}else if(ssl===false){parts.scheme='http';}else{parts.scheme='';} return buildUrl(parts);} function mergeUrl(url,params){if(!isObject(params)||isEmpty(params)){return url;} let baseUrl;let qs;if(url.indexOf('?')>-1){baseUrl=url.substring(0,url.indexOf('?'));qs=mergeAndBuildUrlQueryString(url,params);}else{baseUrl=url;qs=mergeAndBuildUrlQueryString('',params);} return baseUrl+(qs?'?'+qs:'');} function isUrl(url){return /^((https?:)?\/\/)/.test(String(url));} if(typeof window!=='undefined'){window.sublime=window.sublime||{};window.sublime.isUrl=isUrl;window.sublime.url={};window.sublime.url.build=buildUrl;window.sublime.url.merge=mergeUrl;window.sublime.url.parse=parseUrl;window.sublime.url.setProtocol=setUrlProtocol;window.sublime.qs={};window.sublime.qs.build=buildUrlQueryString;window.sublime.qs.merge=mergeUrlQueryString;window.sublime.qs.parse=parseUrlQueryString;window.sublime.qs.mergeAndBuild=mergeAndBuildUrlQueryString;} function getEntry(key){try{return JSON.parse(sublime.window.localStorage.getItem(key));}catch(e){return null;}} const storage={config:Object.freeze({ttl:864e+5*90,prefix:env('sublime_prefix')+'-',}),get:function get(name){const entry=getEntry(storage.config.prefix+name);if(entry&&(entry.expire-1){enabled=true;}}catch(e){log.error('Error happened when checking front feature flipping',{},e);} return enabled;} if(typeof window!=='undefined'){window.sublime=window.sublime||{};window.sublime.isFeatureEnabled=isFeatureEnabled;} var forceOriginWindow=false||false;if(forceOriginWindow){sublime.window=sublime.originWindow;sublime.document=sublime.originWindow.document;} sublime.mergeConfig=function(config,pluginName){if((pluginName in sublime)&&sublime[pluginName].config){config=merge(config,sublime[pluginName].config);} return config;};var BASECHAR_62="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";sublime.base62Encode=function(integer){if(integer===0){return'0';} var output='';while(integer>0){output=BASECHAR_62[integer%62]+output;integer=Math.floor(integer / 62);} return output;};sublime.base62Decode=function(str){var output=0,chars=(''+str).split('').reverse();chars.forEach(function(c,i){output+=BASECHAR_62.indexOf(c)*Math.pow(62,i);});return output;};sublime.DOMReadyTime=null;sublime.computeDOMReadyTime=function(){if(sublime.window.performance&&sublime.window.performance.timing&&sublime.window.performance.timing.domInteractive){sublime.DOMReadyTime=sublime.window.performance.timing.domInteractive;}else if(!sublime.DOMReadyTime){sublime.DOMReadyTime=Date.now();} return sublime.DOMReadyTime;};sublime.watch=function sublimeWatch(prop,setterHandler){var currentValue=this[prop];Object.defineProperty(sublime,prop,{get:function getter(){return currentValue;},set:function setter(val){currentValue=val;setterHandler.call(this,val);},configurable:true,});};const OPTIMAL_HEIGHT_FOR_MOBILE=3600;const OPTIMAL_HEIGHT_FOR_DESKTOP=2300;function createNamespace(objectPath){let parts=objectPath.split('.');let i;let parent=sublime;if(parts[0]!=='sublime'){return;} for(parts=parts.slice(1),i=0;i');iframe.contentDocument.close();w=iframe.contentWindow;} const s=sublime.document.createElement('script');s.type='application/javascript';s.async=false;s.addEventListener('load',function onLoad(){resolve(w);});s.addEventListener('error',reject);s.src=url;w.document.body.appendChild(s);});} function getPageHeight(){const body=sublime.document.body;const element=sublime.document.documentElement;if(typeof sublime.document.height!=='undefined'){return sublime.document.height;} return Math.max(body.scrollHeight,body.offsetHeight,element.clientHeight,element.scrollHeight,element.offsetHeight);} function isSublimeElement(el){if(!el){return false;} const sublimeReg=/^(ayads|sublime)/;if(sublimeReg.test(el.id)){return true;} for(let i=0;iwindow.setTimeout(resolve,delay));} if(typeof window!=='undefined'){window.sublime=window.sublime||{};window.sublime.helpers=window.sublime.helpers||{};window.sublime.helpers.getScript=getScript;window.sublime.helpers.time2secs=time2secs;window.sublime.helpers.hasProperty=hasProperty;window.sublime.helpers.tryParseXml=tryParseXml;window.sublime.helpers.tryParseJson=tryParseJson;window.sublime.helpers.getPageHeight=getPageHeight;window.sublime.helpers.createNamespace=createNamespace;window.sublime.helpers.isOptimalHeight=isOptimalHeight;window.sublime.helpers.isSublimeElement=isSublimeElement;window.sublime.helpers.getBrowserDimensions=getBrowserDimensions;} const timeoutIDS=[];const intervalIDS=[];const timer={};timer.setTimeout=function setTimeout(){var tid=sublime.window.setTimeout.apply(null,arguments);timeoutIDS.push(tid);return tid;};timer.clearTimeout=function clearTimeout(){return sublime.window.clearTimeout.apply(null,arguments);};timer.clearAllTimeouts=function clearAllTimeouts(){for(let i=timeoutIDS.length-1;i>=0;i-=1){sublime.window.clearTimeout(timeoutIDS[i]);}};timer.setInterval=function setInterval(){var tid=sublime.window.setInterval.apply(null,arguments);intervalIDS.push(tid);return tid;};timer.clearInterval=function clearInterval(){return sublime.window.clearInterval.apply(null,arguments);};timer.clearAllIntervals=function clearAllIntervals(){for(let i=intervalIDS.length-1;i>=0;i-=1){sublime.window.clearInterval(intervalIDS[i]);}};if(typeof window!=='undefined'){window.sublime=window.sublime||{};window.sublime.timer=timer;} const THROTTLE_MIN_DELAY=10;function throttle(func){let isRunning;let args;let lastTime=0;function run(){isRunning=false;func.apply(null,args);} return function throttled(){args=arguments;const now=Date.now();if(isRunning||(now-lastTimeMINIMUM_SUPPORT_WIDTH);return browserAllowed&&clientWidthAllowed;} function isOSCompatible(osData){const iOSIsCompatible=osData.name===device.IOS&&osData.version>=9;const androidIsCompatible=osData.name===device.ANDROID&&osData.version>=4.4;const osIsCompatible=iOSIsCompatible||androidIsCompatible;if(!osIsCompatible){log.warn('OS is not compatible : '+osData);} return osIsCompatible;} function isPlaceableOnMobile(hasViewportMeta,userAgent,forceDevice,osData,isPortrait){const allowedUA=/\bCrMo\b|CriOS|Chrome|Firefox|Safari|iPhone/i.test(userAgent);let osIsCompatible=isOSCompatible(osData);if(forceDevice){log.warn('Previewing in forced mode with os : ',osData);osIsCompatible=true;} return allowedUA&&osIsCompatible&&hasViewportMeta&&isPortrait;} const isPlaceable=function isPlaceable(params){const config=merge({},{device:device.type,userAgent:navigator.userAgent,ignoreClientWidth:env('zoneIgnoreClientWidth'),maxDeviceWidth:sublime.window.innerWidth,hasViewportMeta:Boolean(sublime.document.querySelector('meta[name=viewport]')),forceDevice:Boolean(preview.enabled&&isDefined(preview.params)&&preview.params.forceDevice),isPortrait:sublime.window.innerHeight>sublime.window.innerWidth,},params);config.osData=device.os;if(config.device==='desktop'){return isPlaceableOnDesktop(config.ignoreClientWidth,config.maxDeviceWidth);} if(config.device==='mobile'){return isPlaceableOnMobile(config.hasViewportMeta,config.userAgent,config.forceDevice,config.osData,config.isPortrait);} log.info('device is not placeable, got:',config.device);return false;};const videoTest={};const EMPTY_VIDEO_SRC='data:video/mp4;base64,AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1wNDEAAAAIZnJlZQAAAu1tZGF0AAACrQYF//+p3EXpvebZSLeWLNgg2SPu73gyNjQgLSBjb3JlIDE1NSByMjkwMSA3ZDBmZjIyIC0gSC4yNjQvTVBFRy00IEFWQyBjb2RlYyAtIENvcHlsZWZ0IDIwMDMtMjAxOCAtIGh0dHA6Ly93d3cudmlkZW9sYW4ub3JnL3gyNjQuaHRtbCAtIG9wdGlvbnM6IGNhYmFjPTEgcmVmPTMgZGVibG9jaz0xOjA6MCBhbmFseXNlPTB4MzoweDExMyBtZT1oZXggc3VibWU9NyBwc3k9MSBwc3lfcmQ9MS4wMDowLjAwIG1peGVkX3JlZj0xIG1lX3JhbmdlPTE2IGNocm9tYV9tZT0xIHRyZWxsaXM9MSA4eDhkY3Q9MSBjcW09MCBkZWFkem9uZT0yMSwxMSBmYXN0X3Bza2lwPTEgY2hyb21hX3FwX29mZnNldD0tMiB0aHJlYWRzPTMgbG9va2FoZWFkX3RocmVhZHM9MSBzbGljZWRfdGhyZWFkcz0wIG5yPTAgZGVjaW1hdGU9MSBpbnRlcmxhY2VkPTAgYmx1cmF5X2NvbXBhdD0wIGNvbnN0cmFpbmVkX2ludHJhPTAgYmZyYW1lcz0zIGJfcHlyYW1pZD0yIGJfYWRhcHQ9MSBiX2JpYXM9MCBkaXJlY3Q9MSB3ZWlnaHRiPTEgb3Blbl9nb3A9MCB3ZWlnaHRwPTIga2V5aW50PTI1MCBrZXlpbnRfbWluPTEgc2NlbmVjdXQ9NDAgaW50cmFfcmVmcmVzaD0wIHJjX2xvb2thaGVhZD00MCByYz1jcmYgbWJ0cmVlPTEgY3JmPTI4LjAgcWNvbXA9MC42MCBxcG1pbj0wIHFwbWF4PTY5IHFwc3RlcD00IGlwX3JhdGlvPTEuNDAgYXE9MToxLjAwAIAAAAAwZYiEAD//8m+P5OXfBeLGOfKE3xkODvFZuBflHv/+VwJIta6cbpIo4ABLoKBaYTkTAAAC7m1vb3YAAABsbXZoZAAAAAAAAAAAAAAAAAAAA+gAAAPoAAEAAAEAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAIYdHJhawAAAFx0a2hkAAAAAwAAAAAAAAAAAAAAAQAAAAAAAAPoAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAQAAAAACgAAAAWgAAAAAAJGVkdHMAAAAcZWxzdAAAAAAAAAABAAAD6AAAAAAAAQAAAAABkG1kaWEAAAAgbWRoZAAAAAAAAAAAAAAAAAAAQAAAAEAAVcQAAAAAAC1oZGxyAAAAAAAAAAB2aWRlAAAAAAAAAAAAAAAAVmlkZW9IYW5kbGVyAAAAATttaW5mAAAAFHZtaGQAAAABAAAAAAAAAAAAAAAkZGluZgAAABxkcmVmAAAAAAAAAAEAAAAMdXJsIAAAAAEAAAD7c3RibAAAAJdzdHNkAAAAAAAAAAEAAACHYXZjMQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAACgAFoASAAAAEgAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABj//wAAADFhdmNDAWQACv/hABhnZAAKrNlCjfkhAAADAAEAAAMAAg8SJZYBAAZo6+JLIsAAAAAYc3R0cwAAAAAAAAABAAAAAQAAQAAAAAAcc3RzYwAAAAAAAAABAAAAAQAAAAEAAAABAAAAFHN0c3oAAAAAAAAC5QAAAAEAAAAUc3RjbwAAAAAAAAABAAAAMAAAAGJ1ZHRhAAAAWm1ldGEAAAAAAAAAIWhkbHIAAAAAAAAAAG1kaXJhcHBsAAAAAAAAAAAAAAAALWlsc3QAAAAlqXRvbwAAAB1kYXRhAAAAAQAAAABMYXZmNTguMTIuMTAw';videoTest.SUPPORTED_PLAY_TYPES=['video/webm','video/mp4'];videoTest.SUPPORTED_PLAY_TYPE_3GPP=['video/3gpp'];videoTest.BITRATE_REFERENCE=1000;function videoGetTestingVideo(){return sublime.document.createElement('video');} videoTest.canAutoplay=function videoCanAutoplay(){return new sublime.Promise(function canAutoplayPromise(resolve){let element=videoGetTestingVideo();element.muted=true;element.setAttribute('muted','muted');element.setAttribute('playsinline','playsinline');element.src=EMPTY_VIDEO_SRC;const playResult=element.play();if(playResult!==undefined){playResult.then(function canAutoplayResult(){resolve(true);element=null;}).catch(function canAutoplayResult(){resolve(false);element=null;});}else{element=null;resolve(false);}});};videoTest.canPlayType=function videoCanPlayType(type){const result=videoGetTestingVideo().canPlayType(type);switch(result){case'probably':return 2;case'maybe':return 1;default:return 0;}};const base64url={};const b64u='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_';const b64pad='=';function base64CharIndex(c){if(c==='+'){return 62;} if(c==='/'){return 63;} return b64u.indexOf(c);} base64url.decode=function decode(data){let dst='';let i;let a;let b;let c;let d;for(i=0;i>>4));if(data.charAt(i+2)!==b64pad){dst+=String.fromCharCode(((b<<4)&0xF0)|((c>>>2)&0x0F));} if(data.charAt(i+3)!==b64pad){dst+=String.fromCharCode(((c<<6)&0xC0)|d);}} dst=decodeURIComponent(encodeURIComponent(dst));return dst;};function domWrite(html,opts){var defaults={id:'sublime-'+(new Date().getTime()).toString(16),iframeAttributes:{},iframeVars:{},};if(!opts||!isObject(opts)){opts={};} const options=merge(defaults,opts);log.info('sublime.write');const doc=sublime.document;let idSuffix=1;do{const newId=options.id+'-'+idSuffix;if(doc.getElementById(newId)){idSuffix+=1;}else{options.id=newId;break;}}while(true);const i=doc.createElement('iframe');i.id=options.id;i.name=options.id;i.className=env('sublime_prefix')+'-write';i.scrolling='no';i.frameBorder='0';i.hspace='0';i.vspace='0';i.marginwidth='0';i.marginheight='0';i.allowTransparency='true';i.width='1px';i.height='1px';const attrs=Object.keys(options.iframeAttributes);attrs.forEach(function setAttribute(attr){const attrNode=doc.createAttribute(attr);attrNode.value=options.iframeAttributes[attr];i.setAttributeNode(attrNode);});if(options.targetElement){const locationElement=options.targetElement;if(locationElement.tagName==='BODY'){locationElement.appendChild(i);}else{locationElement.parentNode.insertBefore(i,locationElement.nextSibling);}}else{doc.body.appendChild(i);} const iWin=i.contentWindow;const iDoc=i.contentDocument;iDoc.open();const vars=Object.keys(options.iframeVars);vars.forEach(function setVar(name){const value=options.iframeVars[name];if(isFunction(value)){iWin[name]=value.bind(iWin);}else{iWin[name]=value;}});iWin.sublime=sublime;iDoc.write(''+html+'');iDoc.close();return i;} function domWriteToIframe(target,html){let iframe=target;if(typeof target==='string'){iframe=sublime.document.getElementById(target);}else if(target.frameElement){iframe=target.frameElement;} const iDoc=iframe.contentDocument;iDoc.open();iDoc.write(html);iDoc.close();} function domRemoveElement(element){if(element&&element.parentNode!==null){element.parentNode.removeChild(element);return true;} return false;} function evalScriptTag(elem,targetWindow){const doc=targetWindow.document;const script=doc.createElement('script');script.type='text/javascript';const data=(elem.text||elem.textContent||elem.innerHTML||'');try{script.appendChild(doc.createTextNode(data));}catch(e){script.text=data;} const head=doc.getElementsByTagName('head')[0]||doc.documentElement;head.insertBefore(script,head.firstChild);head.removeChild(script);} function domWriteAndEvalScripts(targetWindow,html,divId){const id=divId||env('sublime_prefix')+'-waes';const win=targetWindow;const doc=win.document;let div=doc.getElementById(id);if(!div){div=doc.createElement('div');div.id=id;doc.body.appendChild(div);} div.innerHTML=html;const scriptsTags=div.getElementsByTagName('script');for(let i=0;i{log.error('GDPR error: ',{},error);return sublime.Promise.resolve();});};if(gdpr.injected.gdprApplies){gdprApplies=gdpr.injected.gdprApplies;gdprAppliesSource=SOURCE_INJECTED;}else if(env('gdprApplies')&&storage.get('is_eea')!==null){gdprApplies=storage.get('is_eea');gdprAppliesSource=SOURCE_GEO;} if(typeof window!=='undefined'){window.sublime=window.sublime||{};window.sublime.gdpr=gdpr;} function toDigits(n,b){const digits=[];while(n>0){digits.push(n%b);n=(n / b)|0;} return digits;} function charOf(digit){return'0123456789abcdef'[digit];} function fromDigits(digits){const chars=digits.map(charOf);return chars.reverse().join('')||'0';} function trimDigits(v){let i=v.length;while(v[--i]===0);v.length=i+1;} function multiply(n,m,b){const nl=n.length;const ml=m.length;const base=typeof b==='number'?b:10;const result=new Array(nl+ml);for(let i=0;i3584){data=JSON.stringify({provider:vpaidData.provider,adSystem:vpaidData.adSystem,mediaFile:vpaidData.mediaFile,});} log.error('AdError from vpaid.',{adUnitMessage:message,adUnit:data,});reject(vpaidWrapper);},});});}).catch(function scriptSandboxCatch(e){delete sublime.creativeAd.vpaid;player.container.remove();log.error('Could not load VPAID media.',{adUnit:JSON.stringify(vpaidData),},e);});};sublime.vpaid.clean=function clean(videoContainer){const children=videoContainer.children;const toRemove=[];for(let i=0;i div:first-of-type ' +'{ position: absolute;transform: translateY(0); z-index: 0 !important; }' +'#'+DISPLAY_ELEMENTS.VIDEO_CONTAINER_ID[device.type]+' > div:first-of-type > video ' +'{ position: initial !important; }' +'div[class*=" integral-vid-"] ' +'{ top: 0 }';} if(css!==''){addCssToDisplayRootDocument(css);}};function Wrapper(){this.isDeleted=false;this.isPaused=false;this.config={};this.init=function init(vpaidCreative){this.creative=vpaidCreative;this.isVideoFinished=false;this.version=this.creative.handshakeVersion();this.setCallbacksForCreative();this.checkVPAIDInterface(this.creative);return this;};this.collapseAd=function collapseAd(){log.info('VPAID > Emit collapseAd');hook.register({namespace:sublime.vpaid.hookNames.adLoaded,callback:this.creative.collapseAd(),});};this.expandAd=function expandAd(){log.info('VPAID > Emit expandAd');hook.register({namespace:sublime.vpaid.hookNames.adLoaded,callback:this.creative.expandAd(),});};this.initAd=function initAd(width,height,viewMode,desiredBitrate,creativeData,environmentVars){this.creative.initAd(width,height,viewMode,desiredBitrate,creativeData,environmentVars);};this.pauseAd=function pauseAd(){log.info('VPAID > Emit pauseAd');if(!this.isPaused){hook.call(sublime.vpaid.hookNames.pauseAd);}};this.resizeAd=function resizeAd(width,height,viewMode){log.info('VPAID > Emit resizeAd');hook.register({namespace:sublime.vpaid.hookNames.adLoaded,callback:function adLoaded(){log.info('VPAID > Resizing ad w='+width+' h='+height+' v='+viewMode);this.creative.resizeAd(width,height,viewMode);}.bind(this),});};this.resumeAd=function resumeAd(){log.info('VPAID > Emit resumeAd');if(this.isPaused){hook.call(sublime.vpaid.hookNames.resumeAd);}};this.startAd=function startAd(){log.info('VPAID > startAd');this.creative.startAd();};this.stopAd=function stopAd(){this.creative.stopAd();};this.on=function on(eventName,callback){log.info('VPAID > New subscribtion on event : ',eventName,callback);this.creative.subscribe(callback,eventName,this);};this.onAdClickThru=function onAdClickThru(url,id,playerHandles){let playerReallyHandles=playerHandles;log.info('VPAID > Clickthrough portion of the ad was clicked, url: ',url);sublime.ad.url=url||sublime.ad.url;sublime.creativeAd.url=url||sublime.creativeAd.url;if(!sublime.ad.isExternal){const shouldOpenTargetUrlProviders=['ias','doubleverify','moat'];playerReallyHandles=playerHandles&&inArray(sublime.ad.vpaid.provider,shouldOpenTargetUrlProviders);} if(playerReallyHandles&&!this.isVideoFinished){hook.call(sublime.vpaid.hookNames.adClickThru);}else{analytics.fire(env('zoneId'),'click');}};this.onAdDurationChange=function onAdDurationChange(){};this.onAdError=function onAdError(message){log.info('VPAID > onAdError >',message);analytics.fire(env('zoneId'),'vpaid_error');emitter.info('rendering.vpaid.adError',{adUnitMessage:message,adUnit:this.config,});hook.call(sublime.vpaid.hookNames.adError,message);};this.onAdExpandedChange=function onAdExpandedChange(){log.info('VPAID > Ad Expanded Changed to: '+this.creative.getAdExpanded());};this.onAdImpression=function onAdImpression(){log.info('VPAID > Ad Impression');};this.onAdInteraction=function onAdInteraction(id){log.info('VPAID > A non-clickthrough event has occured');};this.onAdLinearChange=function onAdLinearChange(){log.info('VPAID > Ad linear has changed: '+this.creative.getAdLinear());};this.onAdLoaded=function onAdLoaded(){log.info('VPAID > ad has been loaded');hook.call(sublime.vpaid.hookNames.adLoaded);if(window.google&&window.google.ima){window.google.ima.settings.setVpaidMode(window.google.ima.ImaSdkSettings.VpaidMode.INSECURE);}};this.onAdLog=function onAdLog(message){log.info('VPAID > onAdLog: '+message);};this.onAdPaused=function onAdPaused(){log.info('VPAID > onAdPaused');hook.call(sublime.vpaid.hookNames.adPaused);this.isPaused=true;};this.onAdPlaying=function onAdPlaying(){log.info('VPAID > onAdPlaying');hook.call(sublime.vpaid.hookNames.adPlaying);this.isPaused=false;};this.onAdRemainingTimeChange=function onAdRemainingTimeChange(){};this.onAdSizeChange=function onAdSizeChange(){log.info('VPAID > Ad size changed to: w='+this.creative.getAdWidth()+' h ='+this.creative.getAdHeight());};this.onAdSkippableStateChange=function onAdSkippableStateChange(){log.info('VPAID > Ad Skippable State Changed to: '+this.creative.getAdSkippableState());};this.onAdUserAcceptInvitation=function onAdUserAcceptInvitation(){log.info('VPAID > onAdUserAcceptInvitation');};this.onAdUserClose=function onAdUserClose(){log.info('VPAID > onAdUserClose');sublime.clean();};this.onAdUserMinimize=function onAdUserMinimize(){log.info('VPAID > onAdUserMinimize');};this.onAdVideoStart=function onAdVideoStart(){log.info('VPAID > Video 0% completed');analytics.fire(env('zoneId'),'videoQ0');hook.call('step.video.quartile0',{quartile:0,quartileName:'start',});};this.onAdVideoFirstQuartile=function onAdVideoFirstQuartile(){log.info('VPAID > Video 25% completed');analytics.fire(env('zoneId'),'videoQ1');hook.call('step.video.quartile1',{quartile:1,quartileName:'firstQuartile',});};this.onAdVideoMidpoint=function onAdVideoMidpoint(){log.info('VPAID > Video 50% completed');analytics.fire(env('zoneId'),'videoQ2');hook.call('step.video.quartile2',{quartile:2,quartileName:'midpoint',});};this.onAdVideoThirdQuartile=function onAdVideoThirdQuartile(){log.info('VPAID > Video 75% completed');analytics.fire(env('zoneId'),'videoQ3');hook.call('step.video.quartile3',{quartile:3,quartileName:'thirdQuartile',});};this.onAdVideoComplete=function onAdVideoComplete(){log.info('VPAID > Video 100% completed');analytics.fire(env('zoneId'),'videoQ4');hook.call('step.video.quartile4',{quartile:4,quartileName:'complete',});};this.onAdVolumeChange=function onAdVolumeChange(){log.info('VPAID > Ad Volume has changed to - '+this.creative.getAdVolume());};this.onStartAd=function onStartAd(){log.info('VPAID > Ad has started');this.isPaused=false;hook.register({namespace:sublime.vpaid.hookNames.pauseAd,callback:this.creative.pauseAd.bind(this.creative),});hook.register({namespace:sublime.vpaid.hookNames.resumeAd,callback:this.creative.resumeAd.bind(this.creative),});};this.onStopAd=function onStopAd(){log.info('VPAID > Ad has stopped');this.isVideoFinished=true;hook.call(sublime.vpaid.hookNames.adStopped);};this.onSkipAd=function onSkipAd(){log.info('VPAID > Ad was skipped');};this.getAdExpanded=function getAdExpanded(){log.info('VPAID > getAdExpanded');return this.creative.getAdExpanded();};this.getAdLinear=function getAdLinear(){log.info('VPAID > getAdLinear');return this.creative.getAdLinear();};this.getAdRemainingTime=function getAdRemainingTime(){log.info('VPAID > getAdRemainingTime');return this.creative.getAdRemainingTime();};this.getAdSkippableState=function getAdSkippableState(){log.info('VPAID > getAdSkippableState');return this.creative.getAdSkippableState();};this.getAdVolume=function getAdVolume(){return this.creative.getAdVolume();};this.setAdVolume=function setAdVolume(val){this.creative.setAdVolume(val);};this.setCallbacksForCreative=function setCallbacksForCreative(){var callbacks={AdStarted:this.onStartAd,AdStopped:this.onStopAd,AdSkipped:this.onSkipAd,AdLoaded:this.onAdLoaded,AdLinearChange:this.onAdLinearChange,AdSizeChange:this.onAdSizeChange,AdExpandedChange:this.onAdExpandedChange,AdSkippableStateChange:this.onAdSkippableStateChange,AdDurationChange:this.onAdDurationChange,AdRemainingTimeChange:this.onAdRemainingTimeChange,AdVolumeChange:this.onAdVolumeChange,AdImpression:this.onAdImpression,AdClickThru:this.onAdClickThru,AdInteraction:this.onAdInteraction,AdVideoStart:this.onAdVideoStart,AdVideoFirstQuartile:this.onAdVideoFirstQuartile,AdVideoMidpoint:this.onAdVideoMidpoint,AdVideoThirdQuartile:this.onAdVideoThirdQuartile,AdVideoComplete:this.onAdVideoComplete,AdUserAcceptInvitation:this.onAdUserAcceptInvitation,AdUserMinimize:this.onAdUserMinimize,AdUserClose:this.onAdUserClose,AdPaused:this.onAdPaused,AdPlaying:this.onAdPlaying,AdError:this.onAdError,AdLog:this.onAdLog,};Object.keys(callbacks).forEach(function cb(eventName){log.info('VPAID > Subscribe to ',eventName);this.creative.subscribe(callbacks[eventName],eventName,this);},this);};this.checkVPAIDInterface=function checkVPAIDInterface(vpaidCreative){if(!vpaidCreative.handshakeVersion||typeof vpaidCreative.handshakeVersion!=='function'||!vpaidCreative.initAd||typeof vpaidCreative.initAd!=='function'||!vpaidCreative.startAd||typeof vpaidCreative.startAd!=='function'||!vpaidCreative.stopAd||typeof vpaidCreative.stopAd!=='function'||!vpaidCreative.skipAd||typeof vpaidCreative.skipAd!=='function'||!vpaidCreative.resizeAd||typeof vpaidCreative.resizeAd!=='function'||!vpaidCreative.pauseAd||typeof vpaidCreative.pauseAd!=='function'||!vpaidCreative.resumeAd||typeof vpaidCreative.resumeAd!=='function'||!vpaidCreative.expandAd||typeof vpaidCreative.expandAd!=='function'||!vpaidCreative.collapseAd||typeof vpaidCreative.collapseAd!=='function'||!vpaidCreative.subscribe||typeof vpaidCreative.subscribe!=='function'||!vpaidCreative.unsubscribe||typeof vpaidCreative.unsubscribe!=='function'){log.error('VPAID > The creative doesn\'t conform to the VPAID spec',{adUnit:JSON.stringify(this.creative),});return false;} log.info('VPAID > The creative is conform to the VPAID spec');return true;};} sublime.vpaid.create=function vpaidCreate(vpaidCreative){return(new Wrapper()).init(vpaidCreative);};sublime.moat={};const MOAT_TRACKING={disabled:0,display:1,video:2,both:3,};sublime.moat.register=function register(){if(env('zoneId')===803){log.log('Moat: disabled on preview zone');return;} hook.register('step.creativeContainerAdded',function onContainerAdded(){if(!sublime.creativeAd){return;} switch(sublime.creativeAd.moat){case MOAT_TRACKING['display']:log.log('Moat: Inject script `Display`');injectScriptDisplay(sublime.creativeAd);break;case MOAT_TRACKING['video']:log.log('Moat: Inject script `Video`');injectScriptVideo(sublime.creativeAd);break;case MOAT_TRACKING['both']:log.log('Moat: Inject scripts `Display` & `Video`');injectScriptDisplay(sublime.creativeAd);injectScriptVideo(sublime.creativeAd);break;default:log.log('Moat: disabled in Ad');break;}});};function getApiParams(ad,scriptType){const p={moatClientLevel1:ad.rcid||ad.campaign_id||'0',moatClientLevel2:ad.raid||ad.id||'0',moatClientLevel3:ad.ssp_name?ad.ssp_name+'_'+(ad.creative_id||'0'):'',moatClientLevel4:env('zoneId')||'0',};if(scriptType==='video'){p.slicer1=env('zoneSiteUrl');p.slicer2=env('zoneSiteUrl');} log.log('Moat: '+scriptType+' params generated',p);return p;} function injectScriptDisplay(creativeAd){try{let creativeContainer;if(creativeAd.creative_type==='mobile kargo sticky'){creativeContainer=sublime.display.getKargoCreativeContainer().contentWindow.document.getElementsByClassName('celtra-ad-v3')[0];}else{creativeContainer=sublime.display.getCreativeContainer();} if(!creativeContainer){throw new Error('Can\'t inject Moat display, creativeContainer is not available');} const isSkin=device.is.desktop;const moatParams=getApiParams(creativeAd,'display');const scriptElement=createDisplayScript(moatParams,isSkin);if(!scriptElement){throw new Error('Moat Display script not available');} creativeContainer.appendChild(scriptElement);log.log('Moat: tracking display script injected');}catch(e){log.error('Error on Moat Display script injection',{creativeAd:creativeAd,},e);}} function createDisplayScript(params,isSkin){try{if(isSkin){params.skin=1;} const src=env('moatScriptDisplay')+'#'+buildUrlQueryString(params);const s=sublime.document.createElement('script');s.type='text/javascript';s.src=src;return s;}catch(e){log.error('Error on Moat Video initialization',{params:params},e);return null;}} function createVideoScript(a,c,d){try{const f=sublime.document.createElement('script');let b=[];let e;let g;c={adData:{ids:c,duration:d,url:a.src,},dispatchEvent:function dispatchEvent(a){if(this.sendEvent){if(b){b.push(a);a=b;b=false;} this.sendEvent(a);}else{b.push(a);}},};d='_moatApi'+Math.floor(1E8*Math.random());try{e=a.ownerDocument;g=e.defaultView||e.parentWindow;}catch(l){e=document;g=window;} g[d]=c;f.type='text/javascript';if(a){a.insertBefore(f,a.childNodes[0]||null);} f.src=env('moatScriptVideo')+'#'+d;return c;}catch(e){log.error('Error on Moat Display script injection',{params:c},e);return null;}} function injectScriptVideo(creativeAd){try{if(creativeAd.creative_type==='mobile kargo sticky'){log.log('Moat: video tracking is disabled due to Celtra integration');return;} let player=sublime.display.getVideoPlayer();if(preview.enabled&&preview.params.device){player=sublime.display.getVideoPlayer(preview.params.device);} if(typeof player==='undefined'||player===null){log.log('Moat: video not ready');timer.setTimeout(function injectScriptVideoNewAttempt(){injectScriptVideo(creativeAd);},50);return;} const params=getApiParams(creativeAd,'video');const duration='41';const moatVideoApiService=createVideoScript(player,params,duration);if(!moatVideoApiService){throw new Error('moatVideoApiService not available');} registerVideoEvents(player,moatVideoApiService);log.log('Moat: tracking video script injected');}catch(e){log.error('Error on Moat Video script injection',{creativeAd:creativeAd},e);}} function registerVideoEvents(player,moatVideoApiService){hook.register('step.video.quartile0',function registerQ0(){try{moatVideoApiService.dispatchEvent({type:'AdVideoStart',adVolume:player.volume,});}catch(e){log.error('Moat event `AdVideoStart` failed',{player:player,moatVideoApiService:moatVideoApiService,},e);}});hook.register('step.video.quartile1',function registerQ1(){try{moatVideoApiService.dispatchEvent({type:'AdVideoFirstQuartile',adVolume:player.volume,});}catch(e){log.error('Moat event `AdVideoFirstQuartile` failed',{player:player,moatVideoApiService:moatVideoApiService,},e);}});hook.register('step.video.quartile2',function registerQ2(){try{moatVideoApiService.dispatchEvent({type:'AdVideoMidpoint',adVolume:player.volume,});}catch(e){log.error('Moat event `AdVideoMidpoint` failed',{player:player,moatVideoApiService:moatVideoApiService,},e);}});hook.register('step.video.quartile3',function registerQ3(){try{moatVideoApiService.dispatchEvent({type:'AdVideoThirdQuartile',adVolume:player.volume,});}catch(e){log.error('Moat event `AdVideoThirdQuartile` failed',{player:player,moatVideoApiService:moatVideoApiService,},e);}});hook.register('step.video.quartile4',function registerQ4(){try{moatVideoApiService.dispatchEvent({type:'AdVideoComplete',adVolume:player.volume,});}catch(e){log.error('Moat event `AdVideoComplete` failed',{player:player,moatVideoApiService:moatVideoApiService,},e);}});} sublime.moat.register();const canApplyCookieSync=function canApplyCookieSync(zone,isPreviewing){if(!gdpr.getSublimeConsent()){log.info('No GDPR Consent: cookieMatch disabled');return false;} if(zone.id===803||zone.nortb){return false;} if(isPreviewing){log.info('Preview: cookieMatch disabled');return false;} return true;};const applyCookieSync=function applyCookieSync(setup){Object.keys(setup).forEach(function each(i){let url=setup[i].url;url=sublime.macros.replace(url);if(setup[i].type==='img'){new window.Image().src=url;}else{const s=sublime.document.createElement('script');s.id='sublime-cm-'+i;s.type='text/javascript';s.async=true;s.src=url;sublime.document.body.appendChild(s);}});};const runCookieSync=function runCookieSync(){const zone=env('zone');if(canApplyCookieSync(zone,preview.enabled)){const setup=env('cookieMatchSetup')||{};applyCookieSync(setup);}};hook.register('step.call',runCookieSync);let scrollCauses=[];(function(){if(!device.is.mobile)return;let programmaticCalls=[];function overrideMethod(name){const method=window[name];sublime.window[name]=function(){const call={ts:performance.now(),fn:name,args:Array.from(arguments),internal:scrollTo.inStack,state:'pending',};programmaticCalls.push(call);method.apply(this,arguments);requestAnimationFrame(function postScrollCall(){call.state='done';});};} overrideMethod('scroll');overrideMethod('scrollTo');overrideMethod('scrollBy');let hadScroll=false;let hadTouch=false;sublime.window.addEventListener('pageshow',function handlePageShow(ev){if(ev.persisted){hadScroll=false;hadTouch=false;}});let currentTouches=0;function handleTouchEvent(ev){currentTouches=ev.touches.length;bumpInteractionTimer(true);} sublime.document.addEventListener('touchstart',function handleTouchStart(ev){hadTouch=true;handleTouchEvent(ev);});sublime.document.addEventListener('touchmove',handleTouchEvent);sublime.document.addEventListener('touchend',handleTouchEvent);sublime.document.addEventListener('touchcancel',handleTouchEvent);let interactionTimerID=0;function hadRecentInteraction(){return Boolean(interactionTimerID||currentTouches>0);} function bumpInteractionTimer(forceStart){if(interactionTimerID)clearTimeout(interactionTimerID);if(interactionTimerID||forceStart){interactionTimerID=setTimeout(function resetInteractionTimer(){interactionTimerID=0;},120);}} let scrollTimerID=0;function bumpScrollTimer(){if(scrollTimerID)clearTimeout(scrollTimerID);scrollTimerID=setTimeout(function resetScrollTimer(){scrollTimerID=0;programmaticCalls=[];},120);} sublime.document.addEventListener('scroll',function scrollInitiatorListener(ev){const programmatic=!ev.isTrusted||programmaticCalls.length>0;const asr=(sublime.window.history.scrollRestoration!=='manual'&&!hadTouch&&!hadScroll&&!programmatic);scrollCauses=[];if(asr)scrollCauses.push('asr');if(hadRecentInteraction())scrollCauses.push('touch');if(programmaticCalls.filter(function filterExternalCall(call){return!call.internal;}).length)scrollCauses.push('external_call');if(programmaticCalls.filter(function filterInternalCall(call){return call.internal;}).length)scrollCauses.push('internal_call');if(didMutateDOM.inProgress)scrollCauses.push('internal_dom_mutation');if(!scrollCauses.length){scrollCauses.push('unknown');} hadScroll=true;bumpScrollTimer();bumpInteractionTimer(false);});}());function getScrollCauses(){return scrollCauses;} function incrementCappings(cappingName){const targets=['ad','zone'];if(isFeatureEnabled('cookieConsent')){if(!gdpr.getSublimeConsent()){return;}} targets.forEach((name)=>{const target=sublime[name];if(target.cappings&&target.cappings[cappingName]){const storageKey='capping.'+(name+''+target.id);const value=storage.get(storageKey)||{};const ONE_DAY_IN_SEC=24*60*60;const durationInSeconds=target.cappings.duration||ONE_DAY_IN_SEC;if(value[cappingName]){value[cappingName]+=1;storage.set(storageKey,value);}else{value[cappingName]=1;storage.set(storageKey,value,durationInSeconds*1E3);}}});} function isCapped(targetName,cappingType){let output=false;if(sublime.previewing){log.warn('Preview: sublime.adServer.isCapped disabled');return false;} if(sublime[targetName]&&sublime[targetName].cappings&&sublime[targetName].cappings[cappingType]&&sublime[targetName].cappings.duration){const storageKey='capping.'+targetName+sublime[targetName].id;const value=storage.get(storageKey);if(value&&value[cappingType]&&value[cappingType]>=sublime[targetName].cappings[cappingType]){output=true;}} return output;} const preview={params:{},notPreviewParams:{},enabled:false,enable(){preview.enabled=true;log.level=40;},init(){let previewData=storage.get('sublime-preview');if(!previewData){previewData=parseUrl(String(sublime.window.location)).hash;} if(previewData){const hashPrefix=env('sublime_prefix');const args=parseUrlQueryString(previewData);if(args[hashPrefix+'-aid']){preview.params.adId=pInt(args[hashPrefix+'-aid']);}else if(hashPrefix+'-test'in args){preview.params.testCard=true;}else if(hashPrefix+'-ssp'in args){preview.params.ssp=args[hashPrefix+'-ssp'];} if(hashPrefix+'-traffic_type'in args){preview.params.trafficType=args[hashPrefix+'-traffic_type'];} if(hashPrefix+'-vast'in args){preview.params.vastUrl=args[hashPrefix+'-vast'];log.info('Preview/VAST:',preview.params.vastUrl);} if(hashPrefix+'-format'in args){const format=args[hashPrefix+'-format'];if(format==='toproll'){preview.params.format=format;log.info('Preview/format:',format);}} if('forceDisplay'in args){preview.params.forceDisplay=true;} if(hashPrefix+'-sspkw'in args){try{preview.notPreviewParams.sspKeywords=JSON.parse(args['ayads-sspkw']);log.info('Previewing with SSP Keywords',preview.notPreviewParams.sspKeywords);}catch(e){log.warn(`Error while parsing ayads-sspkw key: ${args['ayads-sspkw']}`,e);}} const acceptedKeywords=['criteoBanner','criteoCampaign','device','forceDevice','forceDisplay',];acceptedKeywords.forEach(function each(keyword){if(keyword in args){preview.params[keyword]=args[keyword]||true;}});if(!isEmpty(preview.params)){preview.enable();}}},run(displayAdCallback,passbackCallback){const zone=env('zone');preview.params=merge(preview.params,this.params);if(preview.params.adId===0){passbackCallback();return;} if(preview.params.adId){const url=`${env('sublime_url')}ad/${preview.params.adId}/${zone.id}`;sublime.xhr(url,{jsonp:true,success:preview.formatResponse.bind(null,displayAdCallback),});}else if(preview.params.testCard){const url=`${env('sublime_url')}ad/0/${zone.id}`;sublime.xhr(url,{jsonp:true,success:preview.formatResponse.bind(null,displayAdCallback),});}else if(preview.params.ssp){let url=`${env('sublime_url')}ad/ssp/${preview.params.ssp}/${zone.id}`;if(preview.params.trafficType){url+='/'+preview.params.trafficType;} sublime.xhr(url,{jsonp:true,success:preview.formatResponse.bind(null,displayAdCallback),});}else if(preview.params.vastUrl){parseVast.query(preview.params.vastUrl,{successCallback:function successPreviewCallback(ad){ad.video_autoplay=true;preview.formatResponse(displayAdCallback,{ad});},errorCallback:function errorPreviewCallback(error){log.warn('Preview > Error in XHR call',error);},});}},formatResponse(callback,response){let ad;if(response.ad){ad=response.ad;}else{ad={id:14,url:'https://cdn.ayads.co/creatives/redirectUrl/index.html',images:{bg:'https://cdn.ayads.co/creatives/redirectUrl/test.jpg',},supported_devices:['desktop'],top:220,type:'skinz',noCookieMatch:true,};} callback(response.zone,ad);},};function isUserOptout(){const lc='dnt';const ttl=30*60*1000;const localIsOptout=storage.get(lc);function checkOptoutBeforeExecutingCallback(isOptout,fromStorage){if(!fromStorage&&gdpr.getSublimeConsent()){storage.set(lc,isOptout,ttl);} log.log(isOptout?'isOptout':'isNotOptout');return isOptout;} if(localIsOptout===null){sublime.xhr(env('optchk_url'),{async:true,jsonp:true,callbackName:'sublimeOptchk',success:checkOptoutBeforeExecutingCallback,});return false;} return checkOptoutBeforeExecutingCallback(localIsOptout,true);} function registerMacros(){const allowedMacros={click:'pixelClick',impression:'pixelImpression',};Object.keys(allowedMacros).forEach((slot)=>{const pixelUrl=sublime[allowedMacros[slot]];if(isEmpty(pixelUrl)){return;} log.info('Macro found for '+slot+': '+pixelUrl);if(!isUrl(pixelUrl)){log.warn('Macro for '+slot+' is not a valid url');return;} analytics.setPixels(env('zoneId'),{inherit:'_external',slot:slot+'.macro',url:pixelUrl,});});} var configCookie={ttl:0,expires:null,path:'/',domain:env('cookie_domain'),secure:''};configCookie=sublime.mergeConfig(configCookie,'cookie');var decodeCookieValue=function(value){try{value=decodeURIComponent(value);if(value.charAt(0)==='{'&&value.slice(-1)==='}'){value=JSON.parse(value);} return value;}catch(e){return null;}};var encodeCookieValue=function(value){try{if(!isScalar(value)){value=JSON.stringify(value);} return encodeURIComponent(value);}catch(e){return null;}};sublime.cookie={get:function(name){var result=name?null:{},cookies=document.cookie?document.cookie.split('; '):[];for(var i in cookies){var parts=cookies[i].split('='),key=parts[0],value=decodeCookieValue(parts[1]);if(key===name){return value;}else if(!name){result[key]=value;}} return result;},set:function(name,value,options){options=merge(configCookie,options);if(options.ttl){options.expires=new Date();options.expires.setTime(Date.now()+options.ttl);} try{document.cookie=[name,'=',encodeCookieValue(value),options.expires?'; expires='+options.expires.toUTCString():'',options.path?'; path='+options.path:'',options.domain?'; domain='+options.domain:'',options.secure?'; secure':''].join('');return true;}catch(e){return false;}},del:function(name){return sublime.cookie.set(name,null,{ttl:-1e12});},config:configCookie};let nonce=Date.now();const jsonpCallbackFnPrefix='sublimeCb';const XMLHTTPRequestObject=XMLHttpRequest;sublime.xhr=function xhr(url,params){const defaults={jsonp:false,timeout:false,async:false,success:null,error:null,cacheBuster:false,onTimeout:sublime.noOp,qs:{},};if(!isUrl(url)){log.warn('Invalid url');if(isFunction(params.error)){params.error();} return false;} const options=merge({},defaults,params);const isAbs=url.indexOf('http')===0||url.indexOf('https')===0||url.indexOf('//')===0;if(!isAbs){log.error('Invalid url: non absolute url');if(isFunction(options.error)){options.error();} return false;} const extraUrlParam=options.qs||{};if(options.cacheBuster){extraUrlParam._=nonce;nonce+=1;} const fullUrl=mergeUrl(url,extraUrlParam);if(options.jsonp){return jsonpRequest(fullUrl,options);} return xmlRequest(fullUrl,options);};const xmlRequest=function xmlRequest(url,params){const options=merge({method:'GET',headers:{},},params);let requestBody=null;if(options.headers['Content-Type']==='application/x-www-form-urlencoded'){requestBody=buildUrlQueryString(options.data);}else if(isObject(options.data)){requestBody=JSON.stringify(options.data);} const request=new XMLHTTPRequestObject();let ironFlag=false;let fullUrl=url;if(url.match(/^\/\//)){fullUrl=sublime.isSSL?'https:'+url:'http:'+url;} log.info('xhr.xmlRequest call',fullUrl);request.open(options.method,fullUrl,options.async);Object.keys(options.headers).forEach(function each(prop){request.setRequestHeader(prop,options.headers[prop]);});if(options.withCredentials){request.withCredentials=!!options.withCredentials;} if(!options.async&&navigator.userAgent.indexOf('Gecko')===-1){request.withCredentials=true;} request.onload=function onLoad(){if(isFunction(options.success)){if(ironFlag){return;} ironFlag=true;options.success.call(this,this.responseText);}};if(options.async&&options.timeout){request.timeout=options.timeout;request.ontimeout=function onTimeout(){if(isFunction(options.onTimeout)){if(ironFlag){return;} ironFlag=true;options.onTimeout.call(this);}};} if(isFunction(options.error)){request.onerror=function onError(){if(ironFlag){return;} ironFlag=true;options.error.call(this,this.responseText);};} hook.register('event.cleanUp',function abortXHR(){request.abort();});try{request.send(requestBody);}catch(e){if(isFunction(options.error)){if(ironFlag){return false;} ironFlag=true;return options.error.call(request,request.responseText);} return false;} return request.responseText;};const jsonpRequest=function jsonpRequest(url,options){const jsonpCallbackFnName=options.callbackName||jsonpCallbackFnPrefix+nonce++;let timeoutTimer;let abort=false;let fullUrl=url;if(isFunction(options.success)){const callbackGetVar=isString(options.jsonp)&&options.jsonp.length>1?options.jsonp:'callback';const extraUrlParam={};extraUrlParam[callbackGetVar]=jsonpCallbackFnName;fullUrl=mergeUrl(url,extraUrlParam);sublime.window[jsonpCallbackFnName]=function cb(result){log.log('jsonp callback execute');if(typeof window.sublime==='undefined'||abort){log.info('jsonp callback aborted');return;} if(timeoutTimer){timer.clearTimeout(timeoutTimer);} try{options.success(result);log.info('jsonp callback success');}catch(e){if(isFunction(options.error)){if(abort){return;} options.error(e);}}};hook.register('event.cleanUp',function abortXHR(){abort=true;});}else{log.error("xhr: can't run a jsonp request without success callback");return;} const h=sublime.document.getElementsByTagName('head')[0];const s=sublime.document.createElement('script');s.type='text/javascript';s.id=jsonpCallbackFnName;s.async=options.async||false;s.src=fullUrl;if(isFunction(options.error)){s.onerror=function onError(e){if(abort){return;} if(timeoutTimer){timer.clearTimeout(timeoutTimer);} options.error(e);};} if(options.timeout&&options.timeout>0&&options.onTimeout){timeoutTimer=timer.setTimeout(options.onTimeout,options.timeout);} log.info('xhr.jsonpRequest call',fullUrl);h.appendChild(s);};const analytics={};if(!sublime.SHARED_ANALYTICS_DATA){sublime.SHARED_ANALYTICS_DATA=Object.seal({pixels:{},slotIdx:1,memberIdx:1,sequenceId:0,renderPassed:false,});} const getPixelDefault=function getPixelDefault(){return{url:env('antenna_url'),qs:{},repeat:false,delay:0,fired:0,parent:null,members:{},inherit:'',slot:'',isInternal:true,addBrowserDimensions:false,addPageHeightDimension:false,};};analytics.getPixels=function getPixels(){return sublime.SHARED_ANALYTICS_DATA.pixels;};const setIsInternal=function setIsInternal(pixel){if(!hasProperty(pixel,'isInternal')){if(pixel.url){const urlParts=parseUrl(pixel.url);pixel.isInternal=(urlParts.host===env('antenna_host')||urlParts.host===env('ayads_host'));}else{pixel.isInternal=true;}} return pixel;};analytics.setPixels=function setPixels(zoneId,modulePixels,slotPrefix){if(!zoneId){log.error('Can\'t set pixel with empty zoneId');return[];} let pixelsList={};const newPixels={};const addedParentSlot=[];if(modulePixels.qs||modulePixels.url){if(!modulePixels.slot){modulePixels.slot='slot'+sublime.SHARED_ANALYTICS_DATA.slotIdx;sublime.SHARED_ANALYTICS_DATA.slotIdx+=1;} pixelsList[modulePixels.slot]=modulePixels;}else{pixelsList=modulePixels;} Object.keys(pixelsList).forEach(function eachPixel(name){let pixel=pixelsList[name];if(!isObject(pixel)||(!pixel.qs&&!pixel.url)){log.warn('Can\'t setup pixel, must have a `qs` or `url`',pixel);return;} pixel=setIsInternal(pixel);if(!pixel.isInternal){delete pixel.qs;}else{pixel.qs=pixel.qs||{};pixel.qs.z=zoneId;} if(!pixel.slot){pixel.slot=name;} if(slotPrefix){pixel.slot=slotPrefix+pixel.slot;} if(pixel.members){Object.keys(pixel.members).forEach(function eachPixelMembers(key){let p=pixel.members[key];p=setIsInternal(p);if(!p.isInternal){delete p.qs;}else{p.qs=p.qs||{};p.qs.z=zoneId;}});} if(pixel.slot.indexOf('.')>-1){const parts=pixel.slot.split('.');const parent=parts[0];const slot=parts[1];pixel.slot=slot;pixel.parent=parent;if(!isDefined(newPixels[parent])){newPixels[parent]={members:{}};} newPixels[parent].members[slot+'_'+sublime.SHARED_ANALYTICS_DATA.memberIdx]=pixel;sublime.SHARED_ANALYTICS_DATA.memberIdx+=1;addedParentSlot.push(parent);}else{newPixels[pixel.slot]=pixel;addedParentSlot.push(pixel.slot);}});const pixels=analytics.getPixels();pixels[zoneId]=pixels[zoneId]||{};pixels[zoneId]=merge(pixels[zoneId],newPixels);return addedParentSlot;};analytics.fire=function fire(zoneId,slot,param){if(isFeatureEnabled('noPixelBeforeRender')){if(slot==='render'){sublime.SHARED_ANALYTICS_DATA.renderPassed=true;} let bypass=false;switch(slot){case'place':case'bid':bypass=true;break;default:break;} if(!bypass&&!sublime.SHARED_ANALYTICS_DATA.renderPassed){return false;}} if(!isNum(zoneId)){param=slot;slot=zoneId;zoneId=hasProperty(param,'qs.z')?param.qs.z:null;} if(!zoneId){log.error('Can\'t send pixel with empty zoneId');return false;} if(typeof slot==='string'&&isUrl(slot)){const pixel={url:slot,};slot=analytics.setPixels(zoneId,pixel)[0];} if(param&&isObject(param)){param.slot=param.slot||slot;analytics.setPixels(zoneId,param);} const pixels=analytics.getPixels();if(!pixels[zoneId]){log.error('Tried to fire non registered zoneId',{zoneId:zoneId,pixels:pixels});return false;} if(!(slot in pixels[zoneId])){log.warn('Tried to fire non registered slot',{slot:slot,pixels:pixels});return false;} if(slot.charAt(0)==='_'){log.error('Tried to fire a config');return false;} return executeFire(pixels[zoneId][slot]);};const executeFire=function executeFire(pixelDefinition){const pixels=analytics.getPixels();let pixel=merge(getPixelDefault(),pixelDefinition);pixel=analytics.handleInheritance(pixel);pixel.url=mergeUrl(pixel.url,pixel.qs||'');const canFire=!pixel.fired||(pixel.repeat&&pixel.repeat>pixel.fired);if(!canFire){return pixel;} const slotNamespace=(pixel.parent?pixel.parent+'.':'')+pixel.slot;const message='Analytics: Fire (delay '+pixel.delay+') '+slotNamespace;log.info(message+' #'+pixel.fired);timer.setTimeout(function delay(){sendPixel(pixel);},pixel.delay||0);if(!pixel.parent){if(hasProperty(pixel,'qs.z')&&hasProperty(pixels,String(pixel.qs.z))){pixels[pixel.qs.z][pixel.slot]=pixel;}} if(!pixel.parent&&pixel.members&&Object.keys(pixel.members).length){Object.keys(pixel.members).forEach(function eachPixelMember(id){if(!pixel.members[id].parent){pixel.members[id].parent=pixel.slot;} pixel.members[id].slot=id;pixel.members[id]=executeFire(pixel.members[id]);});} return pixel;};analytics.clearAllPixels=function clearAllPixels(){sublime.SHARED_ANALYTICS_DATA.memberIdx=1;sublime.SHARED_ANALYTICS_DATA.pixels={};sublime.SHARED_ANALYTICS_DATA.sequenceId=0;};const sendPixel=function sendPixel(pixel){const isInternal=pixel.isInternal;const tfz=elapsedSinceInvocation();let url=pixel.url;pixel.fired=(pixel.fired||0)+1;if(isInternal){url+='&tse='+Date.now();url+='&et='+Math.round(elapsed());url+='&tfz='+tfz;pixel.qs.tfz=tfz;sublime.SHARED_ANALYTICS_DATA.sequenceId+=1;url+='&sqid='+sublime.SHARED_ANALYTICS_DATA.sequenceId;pixel.qs.sqid=sublime.SHARED_ANALYTICS_DATA.sequenceId;} if(pixel.addBrowserDimensions&&isUrl(url)){const dimensions=getBrowserDimensions();url+='&bw='+dimensions.bw;url+='&bh='+dimensions.bh;} if(pixel.addPageHeightDimension&&isUrl(url)){const pageHeight=getPageHeight();url+='&ph='+pageHeight;} if(isFunction(pixel.onFire)){pixel.onFire();} if(preview.enabled){log.info('Preview: pixel send to '+url);return null;} const img=new sublime.window.Image(1,1);img.src=url;log.info('Analytics: fired pixel "'+pixel.slot+'"',pixel.qs);return img;};const applyPrefire=function applyPrefire(pixel){if(isFunction(pixel.preFireCallback)){pixel.preFireCallback.apply(pixel);}};analytics.handleInheritance=function handleInheritance(pixel){if(!pixel.inherit){applyPrefire(pixel);return merge({},pixel);} const pixels=analytics.getPixels();if(hasProperty(pixel,'qs.z')&&hasProperty(pixels,pixel.qs.z+'.'+pixel.inherit)){const parentPixel=analytics.handleInheritance(pixels[pixel.qs.z][pixel.inherit]);delete parentPixel.members;delete parentPixel.onFire;const inherit=merge({},parentPixel);applyPrefire(pixel);return merge(inherit,pixel);} return merge({},pixel);};if(typeof window!=='undefined'){window.sublime=window.sublime||{};window.sublime.analytics=analytics;} sublime.macros=sublime.macros||{};sublime.macros.replace=function macrosReplace(string,data){const PREVIEW_ZONE_IDS=[803,28808,15939];if(typeof string!=='string'){log.error('macrosReplace first argument MUST be of "string" type');return'';} const defaultConfig={id:'',raid:'',campaign_id:'',ssp_name:'',creative_type:'',type:'',deal_id:'',insertion_id:'',click_url:'',url:'',click_macro:'',rcid:'',originalUrl:'',html:'',};const config=merge(defaultConfig,data);const zone=env('zone');const gdprConsentString=gdpr.getConsentString()||'';let replacements={'\\[timezone_offset\\]':(new Date().getTimezoneOffset()),'\\[REFERRER_URL\\]':encodeURIComponent(sublime.window.location.href),'\\[Ref_Url\\]':encodeURIComponent(sublime.window.location.href),'\\[Random_Number\\]':Date.now(),'\\[timestamp\\]':Date.now(),'\\${CACHEBUSTER}':Date.now(),'\\$\\[CACHEBUSTER\\]':Date.now(),'\\[CACHEBUSTER\\]':Date.now(),'\\${sub:timestamp}':Date.now(),'\\${sub:puid}':uuid.get('p'),'\\${sub:suid}':uuid.get('s'),'\\${sub:zone_id}':env('zoneId'),'\\${sub:site_id}':env('siteId'),'\\${sub:zone_reminder}':!zone.noreminder,'\\${sub:domain}':encodeURIComponent(sublime.window.location.hostname),'\\${sub:ad_id}':config.raid||config.id,'\\${sub:campaign_id}':config.rcid||config.campaign_id,'\\${sub:ssp}':config.ssp_name,'\\${sub:creative_type}':config.creative_type,'\\${sub:ad_type}':config.type,'\\${sub:deal_id}':config.deal_id,'\\${sub:insertion_id}':config.insertion_id,'\\${CLICK_URL}':config.click_url,'\\${sub:click_url_encoded}':config.click_url?encodeURIComponent(config.click_url):'','\\${sub:landing_page}':config.originalUrl,'\\${sub:landing_page_encoded}':config.originalUrl?encodeURIComponent(config.originalUrl):'','\\${ext:clickmacro}':config.click_macro,'\\${ext:clickmacro_encoded}':config.click_macro?encodeURIComponent(config.click_macro):'',};if(!inArray(zone.id,PREVIEW_ZONE_IDS)){replacements=merge(replacements,{'\\${GDPR}':Number(gdpr.isActive()),'\\${GDPR_CONSENT_\\d+}':gdprConsentString,'\\${GDPR_PD}':1,});} const creativeExternalData=sublime.creativeExternalData;if(typeof creativeExternalData==='object'){Object.keys(creativeExternalData).forEach(function externalDataReplacement(key){const replacementKey='\\${ext:'+key+'}';if(replacementKey in replacements){return;} replacements[replacementKey]=creativeExternalData[key];});} let newString=string;Object.keys(replacements).forEach(function dataReplacement(regexString){newString=newString.replace(new RegExp(regexString,'gi'),replacements[regexString]);});return newString;};function createStore(initialState){let state=initialState;function getState(){return merge({},state);} function updateState(updater,params){state=updater(getState(),params);} return{getState:getState,updateState:updateState,};} const store=createStore({connectors:Object.create(null),creative:null,});function createMapUpdater(rootProp,valueUpdater,getKey){return function mapUpdater(rootState,params){const key=getKey(params);if(typeof key==='undefined'){log.warn("Can't update store, with key: "+key);return rootState;} const map=rootState[rootProp]||Object.create(null);map[key]=valueUpdater(map[key],params);rootState[rootProp]=map;return rootState;};} function createConnectorUpdater(connectorUpdater,getConnectorID){return createMapUpdater('connectors',connectorUpdater,getConnectorID);} if(window){window.sublime=window.sublime||{};window.sublime.store=store;} const sirData={setContextualCategories(state,contextualCategories){const roundedContextualCategories={};Object.keys(contextualCategories).forEach((key)=>{roundedContextualCategories[key]=Math.round(contextualCategories[key]/ 10);});return merge(state,{sirData:{contextualCategories:roundedContextualCategories,},});},getContextualCategories(){const state=store.getState();if(hasProperty(state,'sirData.contextualCategories')){return state.sirData.contextualCategories;} log.info('Partners/SirData: No Contextual Categories in store');return{};},getSerializedContextualCategories(){const contextualCategories=sirData.getContextualCategories();const serializedValues=[];Object.keys(contextualCategories).forEach((id)=>{serializedValues.push([id,contextualCategories[id]].join(':'));});return serializedValues.join(',');},successCallback(sirDataResponse){log.info(`Partners/SirData: response in ${Math.round(elapsedSinceLastCall('sirDataCall'))}ms`);if(!(hasProperty(sirDataResponse,'contextual_categories')&&isObject(sirDataResponse.contextual_categories))){log.error('Partners/SirData: no contextual categories in response',sirDataResponse);return{};} const contextualCategories=sirDataResponse.contextual_categories;log.info('Partners/SirData: contextual categories',contextualCategories);store.updateState(sirData.setContextualCategories,contextualCategories);return contextualCategories;},errorCallback(event){log.error('Partners/SirData: API call error',event);return new Error('Partners/SirData: API call error');},call(){elapsedSinceLastCall('sirDataCall');const{pid,keyid,useCanonicalUrl}=env('sirData');log.info('Partners/SirData: run Contextual API');if(!sublime.windowIsTop){log.warn('Partners/SirData: no top url access, aborting context detection');return sublime.Promise.reject(new Error('Partners/SirData: no top url access, aborting context detection'));} let url=sublime.window.location.href;if(useCanonicalUrl){const canonicalTag=sublime.document.querySelector('link[rel=canonical]');if(canonicalTag&&canonicalTag.href){url=canonicalTag.href;}} const zone=env('zone');const sirDataUrl='https://kvt.cookieless-data.com/api/v1/public' +'/p/'+pid +'/d/'+keyid +'/c?'+buildUrlQueryString({url:url,args_country:zone.country,args_device:device.type,args_zone_id:zone.id,});return new sublime.Promise((resolve,reject)=>{sublime.xhr(sirDataUrl,{async:true,jsonp:true,success:resolve,error:reject,});}).then(sirData.successCallback).catch(sirData.errorCallback);},run(){if(!env('sirData').enabled){log.info('Partners/SirData: not enabled');return sublime.Promise.resolve();} const delay=env('sirData').delay;log.info(`Partners/SirData: max delay of ${delay}ms`);return sublime.Promise.race([sirData.call(),wait(delay),]).catch((error)=>{log.error('SirData error: ',{},error);return sublime.Promise.resolve();});},};const dar={successCallback:function darSuccessCallback(darResponse){let parsedResponse;try{parsedResponse=JSON.parse(darResponse);}catch(err){log.warn('Partners/DAR: failed to parse response: '+err.message);return;} if(parsedResponse.ad){const ad=parsedResponse.ad;if(ad.impUrls){new sublime.window.Image().src=ad.impUrls;} if(ad.creativeScriptRAW){domWrite(ad.creativeScriptRAW);}}},run:function darRun(){if(!env('dar').enabled)return false;log.info('Partners/DAR: run DAR Audit');const zone=env('zone');const siteId=345551;const pageId=1205083;const formatId=device.is.desktop?42281:44974;const darUrl='https://www8.smartadserver.com/ac?'+buildUrlQueryString({siteid:siteId,pgid:pageId,fmtid:formatId,visit:'M',tmstp:Date.now(),out:'json',sh:sublime.window.top.innerHeight,sw:sublime.window.top.innerWidth,tgt:['json','gm=0','screen=large','large_screen=TRUE','zone_id='+(zone.id||0),'gc='+(gdpr.getSublimeConsent()?1:0),].join(';'),gdpr:1,gdpr_consent:gdpr.getConsentString(),});sublime.xhr(darUrl,{withCredentials:true,async:true,success:dar.successCallback,});return true;},};hook.register('step.place',dar.run);let sessionInsideSampling;function isInsideSampling(){if(typeof sessionInsideSampling==='undefined'){sessionInsideSampling=Math.random(){const link=d.createElement('link');link.id='sublime-dns-prefetch-'+i;link.rel='dns-prefetch';link.href=String(url);head.appendChild(link);});} function hookRegisterStepImpression(){const POST_IMPRESSION_EVENTS={sec1:1000,sec2:2000,sec3:3000,sec4:4000,sec5:5000,};hook.register('step.impression.before',()=>{analytics.fire(env('zoneId'),'impression');incrementCappings('impressions');Object.entries(POST_IMPRESSION_EVENTS).forEach(([name,ms])=>{timer.setTimeout(hook.call.bind(hook,'step.impression.'+name),ms);});});} sublime.display=sublime.display||{};sublime.creativeAd={};sublime.zone=env('zone')||{};const stampImageUrl='https://cdn.ayads.co/creatives/watermark803-v3.png';sublime.display.adIsReady=function displayAdIsReady(ad){if(!ad||!isObject(ad)){log.warn('display: Ad is not ready, missing ad');return false;} const displayClass=getDisplayClass(ad);if(!displayClass){return false;} if(!isFunction(displayClass.adIsReady)||!displayClass.adIsReady(ad)){log.warn('Ad NOT complete',merge({},ad));return false;} return true;};sublime.display.adIsCompatibleWithDevice=function displayAdIsCompatibleWithDevice(ad,deviceType){const displayClass=getDisplayClass(ad);if(!displayClass){return false;} if(sublime.adServer.isRedirectPreview){return true;} if(ad.supported_devices.indexOf(deviceType)<0){log.warn('Ad IS NOT compatible with device',merge({},ad));return false;} return true;};sublime.display.adIsClickable=function adIsClickable(ad){if(ad.disableClick){return{clickable:false,message:'Click disabled',};} if(!ad.url||!isUrl(ad.url)){return{clickable:false,message:'No url',};} return{clickable:true,};};function alterCreative(creativeAd,deviceType,state){const output={creative_type:creativeAd.creative_type,};const monetizationType=hasProperty(state,`connectors.${creativeAd.id}.response.monetizationType`)&&state.connectors[creativeAd.id].response.monetizationType;if(preview.enabled){switch(preview.params.format){case'toproll':output.creative_type='mobile toproll classic';output.placementType='toproll';break;default:} return output;} if(deviceType==='mobile'&&inArray(monetizationType,['deal','direct'])&&creativeAd.isExternal){output.creative_type='mobile toproll classic';output.placementType='toproll';} return output;} sublime.display.render=function displayRender(ad){hookRegisterStepImpression();hook.register('step.impression.after',()=>{dnsPrefetch(env('ayads_url'),ad.url);});displayRoot.set(sublime.document.body);if(env('zoneUseCLSDesktop')||env('zoneUseCLSMobile')){sublime.document.body.classList.add('sublime-cls');} if(preview.enabled&&preview.zone){sublime.zone=preview.zone;} const displayClass=getDisplayClass(ad);if(!displayClass){return false;} if(!isFunction(displayClass.render)){log.warn('Display Class has no render function');return false;} sublime.creativeAd=merge({placementType:'skinz',},sublime.creativeAd,ad);sublime.creativeAd=merge(sublime.creativeAd,alterCreative(sublime.creativeAd,device.type,store.getState()));sublime.creativeAd.click_url=sublime.adServer.clickurlizeAntenna(sublime.creativeAd.click_macro);store.updateState(setCreative(sublime.creativeAd,sublime.ad.id));sublime.ad=merge(sublime.ad,sublime.creativeAd);emitter.info('rendering.display.before_render');displayClass.render(sublime.creativeAd);return true;};function getDisplayClass(ad){if(!ad||isEmpty(ad)){return false;} let className='';const desktopAdType=['skinz','video','html5'];const isDesktop=desktopAdType.indexOf(ad.type)>-1;if(ad.type==='mobile'){className='mobile';}else if(ad.format==='generic'){className='generic';}else if(isDesktop){className='desktop';} if(sublime.display[className]){return sublime.display[className];} log.error('Display type not supported',{ad:ad,className:className,});return false;} sublime.display.addCreativeContainer=function displayAddCreativeContainer(){const root=displayRoot.get();const divId=env('sublime_prefix')+'-html';let div=root.ownerDocument.getElementById(divId);if(!div){div=root.ownerDocument.createElement('div');div.id=divId;root.insertBefore(div,root.firstChild);hook.call('step.creativeContainerAdded');} return div;};sublime.display.getCreativeContainer=function displayGetCreativeContainer(){const divId=env('sublime_prefix')+'-html';const document=displayRoot.get().ownerDocument;return document.getElementById(divId);};sublime.display.getKargoCreativeContainer=function displayGetKargoCreativeContainer(){const divId=env('sublime_prefix')+'-kargo-1';const document=displayRoot.get().ownerDocument;return document.getElementById(divId);};sublime.display.writeToContainer=function displayWriteToContainer(html,toTopId){const topId=toTopId||env('sublime_prefix')+'-html';const globalVar=env('sublime_prefix');let stampHtml='';if(env('zoneId')===803){stampHtml='
' +'
';const stampedIframeCss='#ayads-html #iframe-container, #ayads-html #sublime-iframe-container {z-index:-1;} #ayads-html {height:0;}';addCssToDisplayRootDocument(stampedIframeCss);} const fullHtml='' +html +stampHtml;const iframe=domWrite(fullHtml,{id:env('sublime_prefix')+'-pull-creative',});sublime.display.pullToCreativeContainer(iframe,topId);};sublime.display.pullToCreativeContainer=function displayPullToCreativeContainer(iframe,toTopId){const document=displayRoot.get().ownerDocument;const element=iframe.contentDocument.body;const elementsToMove=[];let child;for(let i=0;i-1){output.vast_url=ad.data.sticky;}else{output.vast_url='https://ads.stickyadstv.com/www/delivery/swfIndex.php?reqType=AdsSetup&protocolVersion=2.0&zoneId='+ad.data.sticky;} output.ssp_id=null;}else if(ad.data.improve_id){if(ad.data.improve_id.match(/^rubicon:/)){output.ssp_name='rubicon';output.ssp_id=ad.data.improve_id.split(':')[1];}else if(ad.data.improve_id&&ad.data.improve_id.match(/^appnexus3:/)){output.ssp_name='appnexus';output.ssp_id=ad.data.improve_id.split(':')[1];}else if(ad.data.improve_id.toString().indexOf('://')>-1){output.script_url=ad.data.improve_id;}else{output.ssp_name='improve';output.ssp_id=ad.data.improve_id;}} if(ad.data.video){let videoSrc=env('delivery_url');let videoBg;let videoId;const matchedVideoId=String(ad.data.video).match(/^video-(\d+)\.mp4/);if(matchedVideoId&&matchedVideoId[1]){log.error('Erroneous video format in Redirect: bad format',{from:'fromAyadsAd',redirect:ad,tags:{level:'debug'},});ad.data.video=matchedVideoId[1];} if(isUrl(ad.data.video)){const regex=new RegExp(env('delivery_url').replace('/','\\/'));if(ad.data.video.match(regex)){videoSrc=ad.data.video;if(isUrl(ad.data.video_bg)&&ad.data.video_bg.match(regex)){videoBg=ad.data.video_bg;}}else{videoBg='';}}else{log.error('Erroneous video format in Redirect: noUrl',{from:'fromAyadsAd',redirect:ad,tags:{level:'debug'},});videoSrc+='/delivery/video-';videoBg=videoSrc+'bg-';videoId=ad.data.video?(ad.raid||ad.aid):ad.data.video;videoSrc+=videoId+'.mp4';videoBg+=videoId+'.mp4';} output.videos.top=videoSrc;output.videos.bg=videoBg;hideBgVideo=(ad.data.html&&ad.data.html.match(regexNoBgVideo));if(hideBgVideo){output.videos.bg=null;}} if(ad.data.shop&&ad.data.shop.products){output.shopData={url:'',showProduct:true,showPrice:true,products:ad.data.shop.products,prependWings:{left:'',right:'',},appendWings:{left:'',right:'',},privacy:{optout_click_url:'',optout_image_url:'',},};output.type='html5';} function recursiveClean(adObject){Object.keys(adObject).forEach(function each(i){if(isObject(adObject[i])){recursiveClean(adObject[i]);} if(inArray(i,['top','fixed','footer_fixed','top_sticky','moat','html'])){return;} if(!adObject[i]){delete adObject[i];}});} if(exclude){recursiveClean(output);} return output;};sublime.compat.windowHasAds=function windowHasAds(someWindow){let hasAds=someWindow.ayads_ads||null;if(!hasAds||!isArray(hasAds)){if(someWindow.ayads_data){hasAds=[{data:someWindow.ayads_data,}];}} if(isEmpty(hasAds)){const childrenIframe=someWindow.document.querySelector('iframe[id^="tm_ad_"]');if(childrenIframe){const childrenIframeWindow=childrenIframe.contentWindow;if(childrenIframeWindow.ayads_data){hasAds=[{data:childrenIframeWindow.ayads_data,}];}}} if(isEmpty(hasAds)){return[];} const sublimeAds=[];hasAds.forEach(function each(rawAd){const ad=sublime.compat.fromAyadsAd(rawAd,true);ad.response_format='html';if(ad.raid){ad.isRedirect=true;}else{ad.isAdserving=true;} sublimeAds.push(ad);});if(typeof someWindow.sublimeExternalData==='object'){sublime.creativeExternalData=merge({},someWindow.sublimeExternalData);} return sublimeAds;};sublime.compat.windowHasRedirect=function windowHasRedirect(someWindow){var sublimeAds=sublime.compat.windowHasAds(someWindow);if(sublimeAds&&sublimeAds[0]){return sublimeAds[0];} return null;};hook.register('step.creativeContainerAdded',function register(){sublime.window.ayads.additionalScriptsLoaded=true;});createNamespace('sublime.display.desktop');function isReminder(creativeAd){const creativeHasReminder=hasProperty(creativeAd,'desktop_setup.reminder')&&pInt(creativeAd.desktop_setup.reminder);const creativeHasVideo=creativeAd.videos&&creativeAd.videos.top;const creativeIsVpaid=!!creativeAd.vpaid;return!env('zoneNoReminder')&&creativeHasReminder&&(creativeHasVideo||creativeIsVpaid);} function desktopRenderVPaid(ad){const VIDEO_RATIO=16 / 9;log.info('VPAID > AdUnit provided by '+(ad.vpaid.provider||ad.vpaid.mediaFile));ad.vpaid.config={width:ad.top*VIDEO_RATIO,height:ad.top,viewMode:'normal',bitrate:100000,};sublime.display.desktop.skinz.commonsVideo.registerPixels();const player=sublime.display.desktop.skinz.commonsVideo.createPlayerElement(ad,ad.vpaid.config.width);sublime.vpaid.render(ad.vpaid,player).then(function vpaidRenderSuccess(vpaidWrapper){hook.call('step.impression.before');sublime.vpaid.addExtraCss(ad.vpaid.provider);vpaidWrapper.on('AdStopped',function AdStopped(message){vpaidWrapper.onStopAd();log.info('VPAID > Ad has stopped',message);log.info('Reload video.');sublime.vpaid.clean(player.container);const ayadsVideo=displayRoot.get().ownerDocument.getElementById(DISPLAY_ELEMENTS.VIDEO_ID.desktop);if(isUrl(ad.videos.top)){ayadsVideo.src=ad.videos.top;ayadsVideo.loop=true;ayadsVideo.play();}});if(isReminder(ad)){sublime.display.desktop.skinz.videoReminder.render(ad);}else{sublime.display.desktop.skinz.video.render(ad);} hook.call('step.impression.after');});} sublime.display.desktop.adIsReady=function adIsReady(ad){if(ad.creative_type==='video toproll classic'){return topRollAdIsReady(ad);} if(ad.shopData){return sublime.display.desktop.skinz.shop.adIsReady(ad);} if(isReminder(ad)){return sublime.display.desktop.skinz.videoReminder.adIsReady(ad);} if((ad.videos&&ad.videos.top)||ad.vpaid){return sublime.display.desktop.skinz.video.adIsReady(ad);} if(ad.type==='html5'){return sublime.display.desktop.skinz.html5.adIsReady(ad);} return sublime.display.desktop.skinz.classic.adIsReady(ad);};sublime.display.desktop.render=function render(ad){log.info('sublime.display.desktop');ad.top=Object.prototype.hasOwnProperty.call(ad,'top')?pInt(ad.top||0):220;ad.top=Math.round(ad.top*env('zoneScale'));if(ad.creative_type==='video toproll classic'){topRollRender(ad,displayRoot.get());return;} if(ad.vpaid){desktopRenderVPaid(ad);return;} hook.call('step.impression.before');if(ad.shopData){sublime.display.desktop.skinz.shop.render(ad);}else if(isReminder(ad)){sublime.display.desktop.skinz.videoReminder.render(ad);}else if(ad.videos&&ad.videos.top){sublime.display.desktop.skinz.video.render(ad);}else if(ad.type==='html5'){sublime.display.desktop.skinz.html5.render(ad);}else{sublime.display.desktop.skinz.classic.render(ad);} hook.call('step.impression.after');};sublime.display.desktop.setupZoneAd=function setupZoneAd(ad){hook.call('step.setupZoneAd.before');const zoneHTML=env('zoneUseCLSDesktop')?env('zoneDesktopHtmlCLS'):env('zoneSetup');let html=zoneHTML+(ad.html||'');if(html){html=sublime.macros.replace(html,ad);sublime.display.writeToContainer(html);} hook.call('step.setupZoneAd.after');};createNamespace('sublime.display.desktop.skinz');const STAMP_IMAGE_URL_DESKTOP=env('delivery_url')+'creatives/watermark803-v3.png';sublime.display.desktop.skinz.adIsReady=function adIsReady(ad){return!isEmpty(ad);};sublime.display.desktop.skinz.render=function render(ad){const clickCallback=clickCallbackCreator(ad);sublime.display.addCreativeContainer();sublime.document.documentElement.addEventListener('click',clickCallback,false);hook.register('event.cleanUp',function clearEventListener(){sublime.document.documentElement.removeEventListener('click',clickCallback,false);});sublime.display.desktop.setupZoneAd(ad);addCommonCss(ad);};sublime.display.desktop.skinz.addBgImage=function addBgImage(imageUrl,selector='body'){let cssBackgroundImgProperty='background-image: url("'+imageUrl+'") !important;';if(env('zoneId')===803){cssBackgroundImgProperty='background-image:url('+STAMP_IMAGE_URL_DESKTOP+'), url("'+imageUrl+'") !important;';} sublime.display.loadImage(imageUrl,()=>{const width=this.width||1800;const css=[selector+' {',cssBackgroundImgProperty,'background-size:'+Math.round(width*env('zoneScale'))+'px auto !important;','background-position: center top;','background-repeat: no-repeat;','}',].join('');addCssToDisplayRootDocument(css);});};function addCommonCss(ad){const scale=env('zoneScale');ad.color=ad.color||'#fff';if(ad.fixed){ad.bgPosition='50% '+sublime.window.getComputedStyle(sublime.document.documentElement).marginTop;ad.bgAttachement='fixed';}else{ad.bgPosition='center top';ad.bgAttachement='scroll';} const css={html:['background-image:none !important;','background-color:transparent !important;','cursor:pointer;',].join(''),body:['cursor:default;','background-position:'+ad.bgPosition+' !important;','background-repeat:no-repeat !important;','background-image:none;','background-color:'+ad.color+' !important;','background-attachment:'+ad.bgAttachement+' !important;',].join(''),};if(!env('zoneUseCLSDesktop')){css.body+=['margin-left:auto !important;','margin-right:auto !important;','margin-top:'+ad.top+'px !important;','max-width:'+(1000*scale)+'px;',].join('');} const cssText=Object.keys(css).reduce(function cssTextReducer(text,selector){return text+selector+' {'+css[selector]+'}';},'');addCssToDisplayRootDocument(cssText);} const DEFAULT_SKINZ_WIDTH=1800;function getMouseRelativePosition(absoluteX,absoluteY){const scale=env('zoneScale');const w=sublime.window||window;const d=w.document;const browserwidth=Math.max(d.body.parentNode.clientWidth,d.body.clientWidth);const scrolltop=Math.max(d.body.scrollTop,w.pageYOffset);const marginLeft=Math.round((browserwidth-DEFAULT_SKINZ_WIDTH*scale)/ 2);const html=d.body.parentElement;const style=html.currentStyle||window.getComputedStyle(html);const marginTop=pInt(style.marginTop);const x=absoluteX-marginLeft;let y=!document.documentMode?(absoluteY-marginTop):absoluteY;if(sublime.ad.fixed){y-=scrolltop;} return{x:Math.round(x / scale),y:Math.round(y / scale)};} function clickCallbackCreator(ad){return function clickCallback(e){let target=false;const videoTargets=['ayads-video','ayads-video-bg','ayads-video-layer'];const allowedClickAreas=['double','full','strict'];const pos=getMouseRelativePosition(e.clientX,e.pageY);let clickheight=ad.height||1000;let clickInSideGutter=false;let clickInBottom=false;const gutterWidth=0;const adIsClickable=sublime.display.adIsClickable(ad);if(adIsClickable.clickable===false){log.warn(adIsClickable.message);return;} if(e.target===sublime.document.documentElement){target='html';}else if(e.target===sublime.document.body){target='body';}else if(inArray(e.target.id,videoTargets)){target='video';} if(!target){return;} log.info('Sublime click',e.clientX,e.pageY);if(!ad.click_area||!inArray(ad.click_area,allowedClickAreas)){ad.click_area=allowedClickAreas[0];} if(ad.click_area==='double'){clickheight*=2;} if(ad.click_area==='strict'||ad.click_area==='double'){if(!ad.fixed){clickInBottom=pos.y<0||pos.y>clickheight;}} clickInSideGutter=sublime.document.documentElement.clientWidth-e.clientX{const videoTopMutationObserver=new MutationObserver((mutationsList)=>{mutationsList.forEach((mutation)=>{if(mutation.type==='attributes'&&mutation.attributeName==='src'&&isUrl(videoTop.src)&&videoBg.src!==videoTop.src){videoTopMutationObserver.disconnect();resolve(videoTop.src);}});});videoTopMutationObserver.observe(videoTop,{attributes:true,});});const adPlayingPromise=new sublime.Promise((resolve)=>{hook.register({namespace:sublime.vpaid.hookNames.adPlaying,callback(){resolve(defaultVideoBgSrc);},});});if(isUrl(videoTop.src)){videoBg.src=videoTop.src;}else{promiseAny([videoTopMutationPromise,adPlayingPromise]).then((src)=>{videoBg.src=src;videoBg.play();});} videoBg.classList.add('blurred');} root.insertBefore(videoBg,root.firstChild);} hook.call('step.videoContainerAdded');};sublime.display.desktop.skinz.commonsVideo.registerPixels=()=>{analytics.setPixels(env('zoneId'),videoPixelsDesktop);};sublime.display.desktop.skinz.commonsVideo.createPlayerElement=function createPlayerElement(ad,width){const node=displayRoot.get();videoTop=createVideoTopElement();skinzVideoContainer=createVideoControlsContainer(ad.top,width);videoTopControls=createVideoControls();skinzVideoContainer.appendChild(videoTopControls);const loadingBar=createVideoLoadingBar();skinzVideoContainer.appendChild(loadingBar);muteBtn=createvideoMuteButton();skinzVideoContainer.appendChild(muteBtn);addCommonVideoCss(ad);skinzVideoContainer.appendChild(videoTop);node.insertBefore(skinzVideoContainer,node.firstChild);const layer=createVideoLayer(skinzVideoContainer.style.marginTop);node.insertBefore(layer,node.firstChild);videoTop.addEventListener('loadstart',()=>{analytics.fire(env('zoneId'),'videoStartedLoading');});videoTop.addEventListener('ended',computeVideoMetrics);videoTop.addEventListener('loadeddata',function videoLoadeddataCallback(){analytics.fire(env('zoneId'),'videoLoadeddata');});videoTop.addEventListener('playing',function videoPlayingCallback(){analytics.fire(env('zoneId'),'videoPlaying');});return{video:videoTop,container:skinzVideoContainer,};};function createVideoTopElement(){const doc=displayRoot.get().ownerDocument;const ayadsVideo=doc.getElementById(DISPLAY_ELEMENTS.VIDEO_ID.desktop);const video=ayadsVideo||doc.createElement('video');video.id=DISPLAY_ELEMENTS.VIDEO_ID.desktop;if(!sublime.creativeAd.vpaid){video.loop=true;} video.autoplay=true;video.preload=true;video.muted=true;video.volume=0;return video;} function createVideoBgElement(){const video=displayRoot.get().ownerDocument.createElement('video');video.id='ayads-video-bg';video.preload=true;video.loop=true;video.muted=true;video.volume=0;return video;} function createVideoControlsContainer(top,width){const document=displayRoot.get().ownerDocument;let container=document.getElementById(DISPLAY_ELEMENTS.VIDEO_CONTAINER_ID.desktop);if(!container){container=document.createElement('div');container.id=DISPLAY_ELEMENTS.VIDEO_CONTAINER_ID.desktop;} container.style.height=top+'px';if(env('zoneUseCLSDesktop')===false){container.style.marginTop='-'+container.style.height;} if(width){container.style.width=width+'px';} return container;} function createVideoLoadingBar(){const document=displayRoot.get().ownerDocument;const loadingBar=document.createElement('div');const progressBar=document.createElement('div');loadingBar.classList.add('sublime-loading-bar');progressBar.classList.add('sublime-loading-bar-progress');loadingBar.appendChild(progressBar);videoTop.addEventListener('timeupdate',()=>{const loadingBarPercentage=Math.abs((((videoTop.duration-videoTop.currentTime)/ videoTop.duration)*100)-100);progressBar.style.width=loadingBarPercentage+'%';});return loadingBar;} function createVideoLayer(marginTop){const layer=displayRoot.get().ownerDocument.createElement('div');layer.id='ayads-video-layer';if(env('zoneUseCLSDesktop')===false){layer.style.marginTop=marginTop;} return layer;} function createVideoControls(){const controls=displayRoot.get().ownerDocument.createElement('div');controls.id='ayads-video-controls';controls.classList.add('ayads-video-buttons');controls.addEventListener('click',()=>{playPause();});return controls;} function createvideoMuteButton(){const button=displayRoot.get().ownerDocument.createElement('div');button.id='ayads-video-controls-sound';button.classList.add('ayads-video-buttons','ayads-video-controls-sound','mute','pulsing-sound-button');button.addEventListener('click',(e)=>{e.stopPropagation();e.preventDefault();button.classList.remove('pulsing-sound-button');toggleMute(videoTop,button,!button.classList.contains('mute'));});return button;} function addEventsOnVideoTop(){videoTop.addEventListener('canplaythrough',videoTopCanplaythroughCallback);videoTop.addEventListener('play',()=>{pausePlayElementsRender('playing');});videoTop.addEventListener('pause',()=>{pausePlayElementsRender('paused');});hook.register(sublime.vpaid.hookNames.adClickThru,()=>{sublime.display.openTargetUrl({},sublime.creativeAd,sublime.ad.url);});} function addEventsOnVideoBg(){videoBg.addEventListener('canplaythrough',videoBgCanplaythroughCallback);} function videoTopCanplaythroughCallback(){var computeInterval=500;sublime.creativeAd.video_duration=parseInt(videoTop.duration,10);analytics.fire(env('zoneId'),'videoCanplaythrough');playPause(env('zoneVideoAutoplay')&&!!sublime.creativeAd.video_autoplay);videosSynchronizer();computeVideoMetrics();timer.setInterval(()=>{if(!videoTop.paused){videosSynchronizer();computeVideoMetrics();}},computeInterval);hook.call('step.videoCanplaythrought',{video:videoTop,});videoTop.removeEventListener('canplaythrough',videoTopCanplaythroughCallback);} function videoBgCanplaythroughCallback(){hook.call('step.videoBgCanplaythrought',{video:videoBg,});videoBg.removeEventListener('canplaythrough',videoBgCanplaythroughCallback);} function playPause(play){const shouldPlay=typeof play!=='undefined'?play:videoTop.paused;if(shouldPlay){videoTop.play();if(videoBg){videoBg.play();} if(videoTop.isVpaid){videoTop.vpaid.resumeAd();}}else{videoTop.pause();if(videoBg){videoBg.pause();} if(videoTop.isVpaid){videoTop.vpaid.pauseAd();}}} function computeVideoMetrics(){if(sublime.ad.vpaid){return;} const quartileNames=['start','firstQuartile','midpoint','thirdQuartile','complete'];if(!isDefined(videoTop.currentTime)||!isDefined(videoTop.duration)){log.error('video.currentTime or video.duration is not defined, no metrics sent.');return;} if(videoTop.paused&&videoTop.duration!==videoTop.currentTime){log.warn('Video is paused, no metrics sent.');return;} const quartileLength=videoTop.duration / 4;const unroundedQuartile=videoTop.currentTime / quartileLength;let quartile=Math.floor(unroundedQuartile);if(unroundedQuartile<3&&triggeredQuartiles[3]){quartile=4;} if(quartile>4||triggeredQuartiles[quartile]){return;} for(let index=0;index{videoReady.apply(videoTop);});} videoTop.addEventListener('loadedmetadata',videoReady,false);};function videoReady(){videoTopCss=videoTopCss||videoTop.style.cssText;skinzVideoContainerCss=skinzVideoContainerCss||skinzVideoContainer.style.cssText;originalVideoWidth=originalVideoWidth||videoTop.offsetWidth;originalVideoHeight=originalVideoHeight||videoTop.offsetHeight;fullVideoWidth=this.videoWidth*env('zoneScale');fullVideoHeight=this.videoHeight*env('zoneScale');originalVideoRatio=fullVideoWidth / fullVideoHeight;videoReminderScrollCallback();sublime.window.addEventListener('scroll',videoReminderScrollCallback);sublime.window.addEventListener('resize',debounce(videoReminderResizeCallback,100));} function createCloseVideoReminderBtn(){const document=displayRoot.get().ownerDocument;const closeBtn=document.createElement('div');closeBtn.id='sublime-video-close';closeBtn.className='ayads-video-buttons';skinzVideoContainer.insertBefore(closeBtn,skinzVideoContainer.firstChild);const muteBtn=document.getElementById('ayads-video-controls-sound');closeBtn.addEventListener('click',()=>{videoClosed=true;closeBtn.classList.add('hide');closeBtn.classList.remove('show');displayVideoAtTop();toggleMute(videoTop,muteBtn,true);analytics.fire(env('zoneId'),'reminderClose');});} function videoReminderScrollCallback(){if(videoClosed){return;} if(!canDisplayVideoAsReminder()){analytics.fire(env('zoneId'),'noVideoReminder');return;} if(!videoIsReminder&&!videoIsVisibleEnough(getViewablePointsToCheck())){switchVideoScrollPosition=sublime.window.pageYOffset;displayVideoAsReminder();videoIsReminder=true;return;} if(videoIsReminder&&sublime.window.pageYOffsetMIN_WING_SIZE*2;} function getViewablePointsToCheck(){const videoTopY=videoTop.getBoundingClientRect().y||videoTop.getBoundingClientRect().top;const videoTopX=videoTop.getBoundingClientRect().x||videoTop.getBoundingClientRect().left;const originalVideoMidPointY=videoTopY+(videoTop.offsetHeight / 2);const originalVideoMidPointX=videoTopX+(videoTop.offsetWidth / 2);const percentageToCheckFromMid=Math.abs(50-PERCENTAGE_TO_DISPLAY_REMINDER);const distanceFromMid=videoTop.offsetHeight / percentageToCheckFromMid;return{topPointX:originalVideoMidPointX,topPointY:originalVideoMidPointY-distanceFromMid,bottomPointX:originalVideoMidPointX,bottomPointY:originalVideoMidPointY+distanceFromMid,};} function videoIsVisibleEnough(pointsToCheck){const document=displayRoot.get().ownerDocument;const elementOnTopPoint=document.elementFromPoint(pointsToCheck.topPointX,pointsToCheck.topPointY);const elementOnBottomPoint=document.elementFromPoint(pointsToCheck.bottomPointX,pointsToCheck.bottomPointY);return(skinzVideoContainer.contains(elementOnTopPoint)&&skinzVideoContainer.contains(elementOnBottomPoint));} function displayVideoAsReminder(){skinzVideoContainer.classList.add('sublime-reminder');videoTop.classList.add('sublime-reminder');resizeVideoReminder();} function displayVideoAtTop(){if(videoTop.vpaid){videoTop.vpaid.resizeAd(originalVideoWidth,originalVideoHeight,'normal');} skinzVideoContainer.classList.remove('sublime-reminder');videoTop.style.cssText=videoTopCss;skinzVideoContainer.style.cssText=skinzVideoContainerCss;videoTop.classList.remove('sublime-reminder');} function resizeVideoReminder(){const siteWidth=Math.ceil(env('zoneScale')*BASE_SITE_WIDTH);const sideWidth=(sublime.window.document.documentElement.clientWidth-siteWidth)/ 2;let videoWidth=Math.max(originalVideoWidth,fullVideoWidth);videoWidth=Math.min(sideWidth,videoWidth);videoWidth=Math.min(MAX_VIDEO_WIDTH,videoWidth);const videoHeight=videoWidth / originalVideoRatio;if(videoTop.vpaid){videoTop.vpaid.resizeAd(videoWidth,videoHeight,'thumbnail');} skinzVideoContainer.style.right=sideWidth+'px';skinzVideoContainer.style.marginRight=-videoWidth+'px';skinzVideoContainer.style.setProperty('width',videoWidth+'px','important');skinzVideoContainer.style.setProperty('height',videoHeight+'px','important');} function addVideoReminderCss(){const css=env('css').videoReminder;addCssToDisplayRootDocument(css);} createNamespace('sublime.display.desktop.skinz.html5');sublime.display.desktop.skinz.html5.adIsReady=function adIsReady(ad){const hasValidUrl=isUrl(ad.url);const hasHTML=!isEmpty(ad.html);return sublime.display.desktop.skinz.adIsReady(ad)&&hasHTML&&hasValidUrl;};sublime.display.desktop.skinz.html5.render=function render(ad){log.info('sublime.display.desktop.skinz.html5');sublime.display.desktop.skinz.render(ad);if(ad.images.bg){sublime.display.desktop.skinz.addBgImage(ad.images.bg);}};createNamespace('sublime.display.desktop.skinz.shop');sublime.display.desktop.skinz.shop.adIsReady=function adIsReady(ad){const hasShop=!isEmpty(ad.shopData);return sublime.display.desktop.skinz.adIsReady(ad)&&isUrl(ad.url)&&hasShop;};function desktopShopCreateProductElement(product,ad){const document=displayRoot.get().ownerDocument;const shopData=ad.shopData;const itemUrl=sublime.display.getFinalClickUrl(ad,product.url);const itemContainer=document.createElement('div');itemContainer.classList.add('sublime-ad-item');const itemClickElement=document.createElement('a');itemClickElement.href=itemUrl;itemClickElement.title=product.name;itemClickElement.target='_blank';itemContainer.appendChild(itemClickElement);const itemImageElement=document.createElement('img');itemImageElement.classList.add('sublime-ad-item-image');itemImageElement.src=product.image;itemImageElement.style.maxHeight='calc(130px * '+env('zoneScale')+')';itemContainer.appendChild(itemImageElement);const itemNameElement=document.createElement('div');itemNameElement.classList.add('sublime-ad-item-name');itemNameElement.innerText=product.name;itemContainer.appendChild(itemNameElement);if(shopData.showPrice){const itemPriceContainer=document.createElement('div');itemPriceContainer.classList.add('sublime-ad-item-price-container');if(product.logo){const itemProductLogoElement=document.createElement('img');itemProductLogoElement.classList.add('sublime-ad-item-logo');itemProductLogoElement.src=product.logo;itemPriceContainer.appendChild(itemProductLogoElement);} if(product.price){const itemPriceElement=document.createElement('span');itemPriceElement.classList.add('sublime-ad-item-price');itemPriceElement.innerText=product.price+(!product.price.match(/[£€$]/)?'€':'');itemPriceContainer.appendChild(itemPriceElement);} if(product.discount_price){const itemDiscountPriceElement=document.createElement('div');itemDiscountPriceElement.classList.add('sublime-ad-item-discount_price');itemDiscountPriceElement.innerText=product.discount_price;itemPriceContainer.appendChild(itemDiscountPriceElement);} if(product.discount){const itemDiscountElement=document.createElement('div');itemDiscountElement.classList.add('sublime-ad-item-discount');itemDiscountElement.innerText=product.discount;itemPriceContainer.appendChild(itemDiscountElement);} itemContainer.appendChild(itemPriceContainer);} return itemContainer;} function shopCreateTop(ad){const root=displayRoot.get();const shopData=ad.shopData;const htmlStyle=sublime.window.getComputedStyle(sublime.window.document.getElementsByTagName('html')[0]);const htmlMarginTop=device.is.chrome?parseInt(htmlStyle.paddingTop,10):parseInt(htmlStyle.marginTop,10);const bigTitleElement=root.ownerDocument.createElement('div');bigTitleElement.id='sskz-bigTitle';bigTitleElement.style.marginTop=htmlMarginTop+'px';const criteoLogo=root.ownerDocument.createElement('img');criteoLogo.id='criteo-logo';criteoLogo.src=shopData.logo||'//cdn.ayads.co/creatives/creative-19424/logo-annonceur-criteo.jpg';const topText=root.ownerDocument.createElement('span');topText.classList.add('sublime-ad-top-texte');topText.innerText=i18n('shopPresent').toUpperCase();const product=desktopShopCreateProductElement(shopData.products[0],ad);product.classList.add('sublime-ad-item-top');bigTitleElement.appendChild(criteoLogo);bigTitleElement.appendChild(topText);bigTitleElement.appendChild(product);root.insertBefore(bigTitleElement,root.firstChild);root.style.top=ad.top+'px';root.style.width=1000*env('zoneScale')+'px';root.style.height=220*env('zoneScale')+'px';} function adjustWings(wings,siteWidth){const wingsElement=wings;const sideWidth=Math.ceil((displayRoot.get().ownerDocument.documentElement.clientWidth-siteWidth)/ 2);wingsElement.left.style.left=sideWidth+'px';wingsElement.right.style.right=sideWidth+'px';} function displayShop(ad){const root=displayRoot.get();const data=ad.shopData;let i=0;const siteWidth=env('zoneScale')*1000;const sideWidth=Math.ceil((root.ownerDocument.documentElement.clientWidth-siteWidth)/ 2);const gutterWidth=Math.ceil(data.gutterWidth*env('zoneScale'));const wings={left:null,right:null,};addCssToDisplayRootDocument(env('css').shop);if(!data.showProduct){log.info("displayShop: don't show products");return;} if(!data.products||!data.products.length){log.info('displayShop: no products');return;} data.gutterWidth=data.gutterWidth||180;data.repeatProducts=isDefined(data.repeatProducts)?data.repeatProducts:10;data.showCurrency=isDefined(data.showCurrency)?data.showCurrency:true;if(!isString(data.css)||!data.css.length){data.css=env('css').shopData;} addCssToDisplayRootDocument(data.css);if(data.privacy&&data.privacy.optout_click_url&&data.privacy.optout_image_url){const privacyLink=root.ownerDocument.createElement('a');privacyLink.id='sublime-ad-privacy-link';privacyLink.href=data.privacy.optout_click_url;privacyLink.classList.add('sublime-ad-privacy-link');privacyLink.style.marginTop=(ad.top*-1)+'px';privacyLink.target='_blank';privacyLink.innerHTML='';privacyLink.style.right=sideWidth+'px';root.insertBefore(privacyLink,root.firstChild);} Object.keys(wings).forEach(function shopAddWingAndPrependContent(position){wings[position]=root.ownerDocument.createElement('div');wings[position].id='sublime-ad-shop-'+position;wings[position].style.width=gutterWidth+'px';root.insertBefore(wings[position],root.firstChild);if(data.prependWings&&data.prependWings[position]){wings[position].innerHTML=data.prependWings[position];wings[position].style.display='inline-block';}});if(data.repeatProducts){data.repeatProducts=pInt(data.repeatProducts);const repeat=Math.ceil(data.repeatProducts / data.products.length);let products=[];for(i=0;i{switch(ad.creative_type){case'mobile toproll classic':ad.placementType='toproll';return topRollAdIsReady(ad);case'mobile m-skinz2 video':return sublime.display.mobile.panel2.mskinzVideo.adIsReady(ad);case'mobile m-skinz2 video simple':return sublime.display.mobile.panel2.mskinzSimple.adIsReady(ad);case'mobile m-skinz2':case'mobile m-skinz2-a':case'mobile m-skinz2 classic':case'mobile m-skinz2 capsule':case'mobile m-skinz2 video celtra':case'mobile m-skinz2 duo':case'mobile m-skinz2 sliding':case'mobile m-skinz2 story':case'mobile m-skinz2 swapping':case'mobile m-skinz2 travelling':case'mobile m-skinz2 vertical video':case'mobile m-skinz2 wipeable':case'mobile m-skinz2 plus':case'mobile m-skinz2 swipetosite':return sublime.display.mobile.panel2.mskinz.adIsReady(ad);case'mobile kargo sticky':ad.placementType='bottom';return sublime.display.mobile.kargo.adIsReady(ad);case'mobile m-skinz video':return sublime.display.mobile.panel.mskinzVideo.adIsReady(ad);default:return sublime.display.mobile.panel.mskinz.adIsReady(ad);}};sublime.display.mobile.render=(ad)=>{const root=displayRoot.get();applyOrientationClass();if(!sublime.display.mobile.isPortrait()){return sublime.Promise.resolve();} checkViewPortMeta();addOrientationEvents();if(ad.vpaid&&(ad.creative_type!=='mobile toproll classic')){log.info('VPAID > AdUnit provided by '+(ad.vpaid.provider||ad.vpaid.mediaFile));let player={};const adWithoutVideo=merge(ad,{mobile_setup:{top:{video:null}}});const displayClass=ad.isExternal?sublime.display.mobile.panel2.mskinzSimple:sublime.display.mobile.panel2.mskinzVideo;return displayClass.render(adWithoutVideo).then((mskinzPlayer)=>{return new sublime.Promise((resolve,reject)=>{hook.register({namespace:sublime.display.mobile.panel2.mskinzVideo._hookNames.topImageLoaded,callback(){ad.vpaid.config={width:sublime.window.innerWidth,height:sublime.display.mobile.panel2.mskinzVideo._top.getMediaHeight(),viewMode:'normal',bitrate:100000,};if(sublime.display.mobile.panel2.mskinzVideo.videoSize){ad.vpaid.config.width=sublime.display.mobile.panel2.mskinzVideo.videoSize.top.width;ad.vpaid.config.height=sublime.display.mobile.panel2.mskinzVideo.videoSize.top.height;} player=mskinzPlayer;try{resolve(sublime.vpaid.render(ad.vpaid,player));}catch(error){reject(error);}},once:true,});});}).then((vpaidWrapper)=>{hook.call('step.impression.before');if(ad.vpaid&&ad.vpaid.provider){sublime.vpaid.addExtraCss(ad.vpaid.provider);} hook.register({namespace:sublime.vpaid.hookNames.adStopped,callback(){log.info('Reload video.');if(!ad.isExternal){sublime.vpaid.clean(player.container);vpaidWrapper.isDeleted=true;const ayadsVideo=player.video;ayadsVideo.src=ad.mobile_setup.top.video;ayadsVideo.loop=true;sublime.display.mobile.panel2.mskinzVideo._playVideo();}},});hook.register({namespace:sublime.display.mobile.panel2.mskinzVideo._hookNames.clickMuteBtn,callback(isMuted){const volume=isMuted?0:1;vpaidWrapper.setAdVolume(volume);},});vpaidWrapper.on('AdRemainingTimeChange',()=>{const duration=vpaidWrapper.creative.getAdDuration();const remainingTime=vpaidWrapper.creative.getAdRemainingTime();const percentage=100*((duration-remainingTime)/ duration);const progressBar=root.ownerDocument.querySelector('.sublime-mobile-loading-bar-progress');progressBar.style.width=percentage+'%';});hook.call('step.impression.after');});} switch(ad.creative_type){case'mobile toproll classic':return topRollRender(ad,root);case'mobile m-skinz2 video':return sublime.display.mobile.panel2.mskinzVideo.render(ad);case'mobile m-skinz2 video simple':return sublime.display.mobile.panel2.mskinzSimple.render(ad);case'mobile m-skinz2':case'mobile m-skinz2-a':case'mobile m-skinz2 classic':case'mobile m-skinz2 capsule':case'mobile m-skinz2 video celtra':case'mobile m-skinz2 duo':case'mobile m-skinz2 sliding':case'mobile m-skinz2 story':case'mobile m-skinz2 swapping':case'mobile m-skinz2 travelling':case'mobile m-skinz2 vertical video':case'mobile m-skinz2 wipeable':case'mobile m-skinz2 plus':case'mobile m-skinz2 swipetosite':return sublime.display.mobile.panel2.mskinz.render(ad);case'mobile kargo sticky':return sublime.display.mobile.kargo.render(ad);case'mobile m-skinz video':return sublime.display.mobile.panel.mskinzVideo.render(ad);case'mobile m-skinz shop':return sublime.display.mobile.panel.mskinzShop.render(ad);default:return sublime.display.mobile.panel.mskinz.render(ad);}};function addOrientationEvents(){sublime.window.addEventListener('orientationchange',applyOrientationClass);sublime.window.addEventListener('resize',applyOrientationClass);hook.register('event.cleanUp',()=>{sublime.window.removeEventListener('orientationchange',applyOrientationClass);sublime.window.removeEventListener('resize',applyOrientationClass);});} function checkViewPortMeta(){const document=displayRoot.get().ownerDocument;let viewport=document.querySelector('meta[name="viewport"]');if(!viewport){viewport=document.createElement('meta');viewport.id='sublime-viewport';viewport.name='viewport';document.head.appendChild(viewport);} viewport.content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0';} function getOrientation(){return(sublime.window.innerHeightgetOrientation()==='portrait';const pixelSlotToHookNamespace={close:'event.creative.close',complete:'event.creative.complete',expand:'event.creative.expand',fullscreen:'event.creative.fullscreen',mute:'event.creative.mute',pause:'event.creative.pause',resume:'event.creative.resume',rewind:'event.creative.rewind',unmute:'event.creative.unmute',};function registerPixelsToHooks(){Object.keys(pixelSlotToHookNamespace).forEach(function each(pixelSlot){const hookNamespace=pixelSlotToHookNamespace[pixelSlot];hook.register(hookNamespace,function register(context){analytics.fire(env('zoneId'),pixelSlot,context);});});} const START_PLAYBACK_POSITION=0;const END_PLAYBACK_POSITION=1;function range(value,min,max){min=Number(min)||0;max=Number(max)||0;let n=parseFloat(value);if(Number.isNaN(n)){n=min;} if(String(value).slice(-1)==='%'){n=n / 100;} return Math.min(Math.max(n,min),max);} function videoProgress(video){return video.currentTime / video.duration;} function normalizeTrackActions(actions){return Object.keys(actions).map(function(key){return{time:range(key,START_PLAYBACK_POSITION,END_PLAYBACK_POSITION),callback:actions[key]};}).filter(function(obj){return typeof obj.callback==='function';}).sort(function(a,b){return a.time>b.time?1:-1;});} function trackVideoPlayback(video,trackActions,loop){let actions=normalizeTrackActions(trackActions);let prev=START_PLAYBACK_POSITION;function trigger(now){while(actions[0]&&now>=actions[0].time){const action=actions.shift();action.callback.call(null,now);}} function onTimeUpdate(){const now=videoProgress(video);if(prev>now){if(actions.length>0){trigger(END_PLAYBACK_POSITION);} if(loop){actions=normalizeTrackActions(trackActions);}}else{trigger(now);} prev=now;} video.addEventListener('timeupdate',onTimeUpdate);} const VIDEO_QUARTILES_NAMES=['start','firstQuartile','midPoint','thirdQuartile','complete',];const VIDEO_QUARTILES=[];const pixelsVideo={videoQ0:{inherit:'_videoQuartile',qs:{e:'q0'},addBrowserDimensions:true,addPageHeightDimension:true,},videoQ1:{inherit:'_videoQuartile',qs:{e:'q1'},addBrowserDimensions:true,addPageHeightDimension:true,},videoQ2:{inherit:'_videoQuartile',qs:{e:'q2'},addBrowserDimensions:true,addPageHeightDimension:true,},videoQ3:{inherit:'_videoQuartile',qs:{e:'q3'},addBrowserDimensions:true,addPageHeightDimension:true,},videoQ4:{inherit:'_videoQuartile',qs:{e:'q4'},addBrowserDimensions:true,addPageHeightDimension:true,},complete:{inherit:'_commonSkinz',qs:{e:'complete'}},mute:{inherit:'_commonSkinz',qs:{e:'mute'}},unmute:{inherit:'_commonSkinz',qs:{e:'unmute'}},rewind:{inherit:'_commonSkinz',qs:{e:'rewind'}},pause:{inherit:'_commonSkinz',qs:{e:'pause'}},resume:{inherit:'_commonSkinz',qs:{e:'resume'}},expand:{inherit:'_commonSkinz',qs:{e:'expand'}},close:{inherit:'_commonSkinz',qs:{e:'close'}},creativeView:{inherit:'_commonSkinz',qs:{e:'creativeView'}},videoStartedLoading:{inherit:'_commonSkinz',qs:{e:'vsl'}},videoCanplaythrough:{inherit:'_commonSkinz',qs:{e:'dicpt'}},videoLoadeddata:{inherit:'_commonSkinz',qs:{e:'dild'}},videoPlaying:{inherit:'_commonSkinz',qs:{e:'dip'}},};function registerVideoPixels(){analytics.setPixels(env('zoneId'),pixelsVideo);} function registerVideoHooks(){if(VIDEO_QUARTILES.length>0){return;} VIDEO_QUARTILES_NAMES.forEach(function init(name,quartile){const namespace='step.video.quartile'+quartile;hook.register(namespace,function registerHooks(){analytics.fire(env('zoneId'),'videoQ'+quartile);});VIDEO_QUARTILES.push({name:name,namespace:namespace});});} function setUpVideoQuartiles(video){registerVideoHooks();trackVideoPlayback(video,VIDEO_QUARTILES.reduce(function makeTrackers(trackers,info,quartile){const name=info.name;const namespace=info.namespace;trackers[quartile / 4]=function cb(){hook.call(namespace,{duration:video.duration,currentTime:video.currentTime,quartile:quartile,quartileName:name,});};return trackers;},{}));} function setupSrcRemovalBypass(video){video.removeAttribute=function gatedRemoveAttribute(attrName){if(attrName==='src'){log.info('Bypassing attempt remove the src attribute on video element');video.load=function fakeLoad(){delete video.removeAttribute;delete video.load;log.info('Bypass logic was removed');};return;} window.HTMLVideoElement.prototype.removeAttribute.call(this,attrName);};} function SublimeCountdown(frame,data){this.frame=frame;this.durationDefault=data.duration||SublimeCountdown.COUNTDOWN_DURATION_DEFAULT;this.duration=this.durationDefault;this.callbacks=data.callbacks;this.lastTime=Date.now();this.timerState=true;} SublimeCountdown.COUNTDOWN_DURATION_DEFAULT=3;SublimeCountdown.prototype.setTimerState=function SublimeCountdownTimerState(state){this.timerState=state;};SublimeCountdown.prototype.setDuration=function SublimeCountdownSetDuration(duration){this.duration=duration;};SublimeCountdown.prototype.resetTimer=function SublimeCountdownResetTimer(){this.setDuration(this.durationDefault);};SublimeCountdown.prototype.startTimer=function SublimeCountdownStartTimer(){const currentTime=Date.now();if(this.duration===this.durationDefault){if(this.callbacks.start){this.callbacks.start();}} if(currentTime-this.lastTime>=1000&&this.timerState){if(this.callbacks.update){this.callbacks.update(this.duration);} this.lastTime=currentTime;this.duration-=1;} if(this.duration>=0){this.frame.requestAnimationFrame(this.startTimer.bind(this));return;} if(this.callbacks.end){this.callbacks.end();}};function setSetupZone(){const zone=env('zone');hook.call('step.setupZoneAd.before');if(device.is.mobile){if(zone.mobilecss){addCss(zone.mobilecss);} if(zone.mobilejs){applyJs(zone.mobilejs);}} hook.call('step.setupZoneAd.after');} const VIDEO_RATIO_DEFAULT=9 / 16;const CONTAINER_RATIO_MAX=32 / 100;function topRollVideoHeightBoundaries(context){const container=context.frame;const isLandscape=container.innerWidth>container.innerHeight;if(isLandscape){return{optimal:container.innerHeight / 4,min:container.innerHeight / 8,max:container.innerHeight,};} const root=container.document.documentElement;const width=Math.max(root.clientWidth,container.innerWidth);const heightMax=Math.max(root.clientHeight,container.innerHeight)*CONTAINER_RATIO_MAX;const videoWidth=context.nodes.video.videoWidth;const videoHeight=context.nodes.video.videoHeight;const videoRatio=(videoHeight / videoWidth)||VIDEO_RATIO_DEFAULT;const heightOptimal=width*videoRatio;const height=Math.min(heightOptimal,heightMax);return{optimal:height,min:height / 2,max:container.innerHeight,};} function topRollVideoSize(context){const viewport={width:context.frame.innerWidth,height:context.frame.innerHeight,};const videoRatio=(context.nodes.video.videoHeight / context.nodes.video.videoWidth)||VIDEO_RATIO_DEFAULT;const height=viewport.width*videoRatio;if(viewport.height>viewport.width&&context.nodes.video.videoWidth>context.nodes.video.videoHeight&&height>viewport.height*CONTAINER_RATIO_MAX){return{width:Math.floor((viewport.height*CONTAINER_RATIO_MAX)/ videoRatio),height:Math.floor(viewport.height*CONTAINER_RATIO_MAX),};} if(height>viewport.height){return{width:Math.floor(viewport.height / videoRatio),height:Math.floor(viewport.height),};} return{width:Math.floor(viewport.width),height:Math.floor(height),};} const adjustVideoSize=function adjustVideoSize(context){const slot=context.nodes.slot;const video=context.nodes.video;const videoWrapper=context.nodes.videoWrapper;const videoBackground=context.nodes.videoBackground;const ctaButton=context.nodes.ctaButton;const closeButton=context.nodes.closeButton;const collapseButton=context.nodes.collapseButton;const minVideoHeight=topRollVideoHeightBoundaries(context).min;const isClosed=videoWrapper.classList.contains('sublime--inline');const maxScrollShift=Math.min(context.frame.scrollY,isClosed?videoWrapper.clientHeight:videoWrapper.clientHeight-minVideoHeight);const videoPosition={scale:Math.min(videoWrapper.clientWidth / parseFloat(video.style.width),(videoWrapper.clientHeight-maxScrollShift)/ video.clientHeight),x:(videoWrapper.clientWidth-video.clientWidth)/ 2,y:Math.ceil((maxScrollShift+videoWrapper.clientHeight-video.clientHeight)/ 2),};const widthScaleDifferenceBetweenWrapperAndVideo=(videoWrapper.clientWidth / video.clientWidth-1)*2;const backgroundPosition={scale:(2+widthScaleDifferenceBetweenWrapperAndVideo)*Math.max(1,(videoWrapper.clientHeight-maxScrollShift)/ video.clientHeight),x:videoPosition.x+videoBackground.width / 2,y:videoPosition.y+videoBackground.height / 2,};const ctaPosition={x:videoPosition.x+(video.clientWidth-ctaButton.clientWidth)/ 2,y:-0.15*(videoWrapper.clientHeight-maxScrollShift),};video.style.transform='translate(' +videoPosition.x+'px, ' +videoPosition.y+'px) scale(' +videoPosition.scale+')';slot.style.height=`${videoWrapper.clientHeight - maxScrollShift}px`;slot.style.top=context.frame.getComputedStyle(videoWrapper).top;videoBackground.style.transform='translate(' +backgroundPosition.x+'px, ' +backgroundPosition.y+'px) scale(' +backgroundPosition.scale+')';videoWrapper.style.clipPath='inset('+maxScrollShift+'px 0 0 0)';videoWrapper.style.transform='translateY(-'+maxScrollShift+'px)';closeButton.style.transform='translateY('+maxScrollShift+'px)';collapseButton.style.transform='translateY('+maxScrollShift+'px)';ctaButton.style.transform='translate(' +ctaPosition.x+'px, ' +ctaPosition.y+'px)';};const setVideoSize=function setVideoSize(context){const size=topRollVideoSize(context);const video=context.nodes.video;video.style.width=size.width+'px';video.style.height=size.height+'px';adjustVideoSize(context);};function topRollNormalizeData(ad){const macros=window.sublime.macros;const display=window.sublime.display;const vpaid=window.sublime.vpaid;const merge=window.sublime.merge;let htmlData;let targetUrlData;let typeData;let videoData;let vpaidData;try{if(ad.creative_type==='mobile toproll classic'){typeData='mobile';}else if(ad.creative_type==='video toproll classic'){typeData='desktop';} if(typeData==='mobile'){videoData={src:ad.mobile_setup.top.video,};}else if(typeData==='desktop'){videoData={src:ad.videos.top,};} if(videoData&&(typeof ad.video_duration==='number')){videoData.duration=ad.video_duration;} if(ad.vpaid){vpaidData=merge({config:vpaid.defaultInitAdParams,},ad.vpaid);} htmlData=macros.replace(ad.html||'',ad);targetUrlData=display.getFinalClickUrl(ad);}catch(e){htmlData=undefined;targetUrlData=undefined;typeData=undefined;videoData=undefined;vpaidData=undefined;} return{html:htmlData,targetUrl:targetUrlData,type:typeData,video:videoData,vpaid:vpaidData,};} function topRollBuildDOMTree(){const doc=sublime.document;const container=doc.createElement('div');container.id='sublime-container';const slot=doc.createElement('div');slot.id='sublime-slot';const videoWrapper=doc.createElement('div');videoWrapper.id='sublime-video-wrapper';const videoBackground=doc.createElement('canvas');videoBackground.id='sublime-video-background';const video=doc.createElement('video');video.id='sublime-video';['muted','autoplay','playsinline'].forEach(function setupAttributes(attributeName){video.setAttribute(attributeName,'');video[attributeName]=true;});setupSrcRemovalBypass(video);const videoOverlay=doc.createElement('div');videoOverlay.id='sublime-video-overlay';const soundButton=doc.createElement('span');soundButton.id='sublime-ui-sound';soundButton.className='sublime--icon sublime--bottom sublime--left sublime--muted';soundButton.setAttribute('role','button');const touchscroll=doc.createElement('span');touchscroll.id='sublime-ui-touchscroll';touchscroll.className='sublime--bottom sublime--left';const closeButton=doc.createElement('span');closeButton.id='sublime-ui-close';closeButton.className='sublime--icon sublime--top sublime--right sublime--hide';closeButton.setAttribute('role','button');const ctaButton=doc.createElement('span');ctaButton.id='sublime-ui-cta';ctaButton.setAttribute('role','button');ctaButton.innerText=i18n('topRollCTA');const collapseButton=doc.createElement('span');collapseButton.id='sublime-ui-collapse';collapseButton.className='sublime--icon sublime--top sublime--right';collapseButton.setAttribute('role','button');const replayButton=doc.createElement('span');replayButton.id='sublime-ui-replay';replayButton.className='sublime--icon sublime--bottom sublime--left';replayButton.setAttribute('role','button');container.appendChild(videoWrapper);container.appendChild(slot);videoWrapper.appendChild(videoBackground);videoWrapper.appendChild(video);videoWrapper.appendChild(videoOverlay);videoOverlay.appendChild(soundButton);videoOverlay.appendChild(closeButton);videoOverlay.appendChild(ctaButton);videoOverlay.appendChild(collapseButton);videoOverlay.appendChild(replayButton);videoOverlay.appendChild(touchscroll);return{container,slot,videoWrapper,video,videoBackground,videoOverlay,soundButton,closeButton,ctaButton,collapseButton,replayButton,};} const TOPROLL_STATE_VIDEO_EXPAND='expand';const TOPROLL_STATE_VIDEO_EXPAND_TRANSITION='expand-transition';const TOPROLL_STATE_VIDEO_FULL='full';const TOPROLL_STATE_VIDEO_BANNER='banner';const TOPROLL_STATE_VIDEO_STICKY='sticky';const TOPROLL_STATE_VIDEO_STICKY_CLOSEABLE='sticky-closeable';let topRollState;let topRollPreviousState;function getTopRollState(context){const frame=context.frame;const height=topRollVideoHeightBoundaries(context);let state;if(frame.scrollY<=0){state=TOPROLL_STATE_VIDEO_EXPAND;}else if(frame.scrollYMath.floor(height.max-height.optimal)&&frame.scrollY<=(height.max-height.min)){state=TOPROLL_STATE_VIDEO_BANNER;}else if(frame.scrollY>=frame.innerHeight){state=TOPROLL_STATE_VIDEO_STICKY_CLOSEABLE;}else if(frame.scrollY>(height.max-height.min)){state=TOPROLL_STATE_VIDEO_STICKY;} return state;} function setTopRollState(context,state,event){if(event){event.stopPropagation();} const currentState=getTopRollState(context);if(state===currentState){return;} const frame=context.frame;const height=topRollVideoHeightBoundaries(context);switch(state){case TOPROLL_STATE_VIDEO_EXPAND:context.scrollY=frame.scrollY;scrollTo(frame,0,0);break;case TOPROLL_STATE_VIDEO_EXPAND_TRANSITION:case TOPROLL_STATE_VIDEO_FULL:scrollTo(frame,0,Math.floor(height.max-height.optimal));break;case TOPROLL_STATE_VIDEO_BANNER:scrollTo(frame,0,height.max-height.min);break;case TOPROLL_STATE_VIDEO_STICKY:case TOPROLL_STATE_VIDEO_STICKY_CLOSEABLE:if(typeof context.scrollY!=='number'){return;} scrollTo(frame,0,context.scrollY);break;default:log.warn('Unknown state: '+state+'; ' +'valid states are: ' +[TOPROLL_STATE_VIDEO_EXPAND,TOPROLL_STATE_VIDEO_FULL,TOPROLL_STATE_VIDEO_BANNER,TOPROLL_STATE_VIDEO_STICKY,TOPROLL_STATE_VIDEO_STICKY_CLOSEABLE,].join(', '));}} function goToPreviousTopRollState(context,event){if(event){event.stopPropagation();} if(topRollPreviousState!==topRollState){setTopRollState(context,topRollPreviousState,event);}} function publishTopRollStateChange(previousState,newState,context){if(previousState!==undefined&&newState===TOPROLL_STATE_VIDEO_EXPAND){const scrollCauses=getScrollCauses();hook.call('event.creative.expand',{qs:{pbr:scrollCauses.join('|'),dlt:context.nodes.video.currentTime,},});} context.frame.document.body.classList.toggle('sublime-toproll-expand',newState===TOPROLL_STATE_VIDEO_EXPAND);context.frame.document.body.classList.toggle('sublime-toproll-expand-transition',newState===TOPROLL_STATE_VIDEO_EXPAND_TRANSITION);context.frame.document.body.classList.toggle('sublime-toproll-full',newState===TOPROLL_STATE_VIDEO_FULL);context.frame.document.body.classList.toggle('sublime-toproll-banner',newState===TOPROLL_STATE_VIDEO_BANNER);context.frame.document.body.classList.toggle('sublime-toproll-sticky',newState===TOPROLL_STATE_VIDEO_STICKY);context.frame.document.body.classList.toggle('sublime-toproll-sticky-closeable',newState===TOPROLL_STATE_VIDEO_STICKY_CLOSEABLE);} function topRollStateListener(context){const state=getTopRollState(context);if(state===topRollState){return;} topRollPreviousState=topRollState;topRollState=state;publishTopRollStateChange(topRollPreviousState,topRollState,context);} function topRollGlobalSublimeAPI(context){context.frame.sublime.setTopRollState=setTopRollState.bind(context.frame,context);context.frame.sublime.getTopRollState=getTopRollState.bind(context.frame,context);return context;} const scrollToFnStash=new Map();function scrollTo(frame){scrollTo.inStack=true;const currentFrame=scrollToFnStash.get(frame)||frame;const scrollToFn=currentFrame.scrollTo;const scrollArgs=Array.prototype.slice.call(arguments,1);scrollToFn.apply(frame,scrollArgs);scrollTo.inStack=false;} scrollTo.inStack=false;function didMutateDOM(){if(didMutateDOM.inProgress){log.warn('A previous call to didMutateDOM() is still in progress');return;} didMutateDOM.inProgress=true;window.requestAnimationFrame(function rabbit(){window.requestAnimationFrame(function hole(){didMutateDOM.inProgress=false;});});} didMutateDOM.inProgress=false;function topRollInterceptScrollTo(context){const frame=context.frame;function mapScrollOptions(scrollOptions){if(Number.isFinite(scrollOptions.top)){const copy=merge(scrollOptions);copy.top+=frame.innerHeight;return copy;} return scrollOptions;} function topRollInterceptScrollToCreator(method){return function scrollMethodIntercepted(){if(arguments.length===2){const options=mapScrollOptions({left:arguments[0],top:arguments[1],});arguments[0]=options.left;arguments[1]=options.top;}else{arguments[0]=mapScrollOptions(arguments[0]);} scrollToFnStash.get(frame)[method].apply(this,arguments);};} scrollToFnStash.set(frame,{scroll:frame.scroll,scrollTo:frame.scrollTo,});frame.scroll=topRollInterceptScrollToCreator('scroll');frame.scrollTo=topRollInterceptScrollToCreator('scrollTo');hook.register('event.cleanUp',function cleanUpScrollInterceptor(){frame.scroll=scrollToFnStash.get(frame).scroll;frame.scrollTo=scrollToFnStash.get(frame).scrollTo;scrollToFnStash.delete(frame);});return context;} function topRollVPAID(context){const vpaid=window.sublime.vpaid;const{slot,video}=context.nodes;const data=context.data;if(data.vpaid){data.vpaid.config.width=slot.clientWidth;data.vpaid.config.height=slot.clientHeight;return vpaid.render(data.vpaid,{container:slot,video}).then(function vpaidRendered(vpaidWrapper){context.vpaidWrapper=vpaidWrapper;vpaid.addExtraCss(data.vpaid.provider);adjustVideoSize(context);return context;});} return window.sublime.Promise.resolve(context);} const COUNTDOWN_DURATION=SublimeCountdown.COUNTDOWN_DURATION_DEFAULT;function startNewCountdown(context){const frame=context.frame;const nodes=context.nodes;const closeButton=nodes.closeButton;const datas={duration:COUNTDOWN_DURATION,callbacks:{start:function startNewCountdownCallbackStart(){closeButton.classList.remove('sublime--icon-cross');},update:function startNewCountdownCallbackUpdate(val){closeButton.innerHTML=val;},end:function startNewCountdownCallbackEnd(){closeButton.innerHTML='';closeButton.classList.add('sublime--icon-cross');},},};return new SublimeCountdown(frame,datas);} function createClickEventButtonClose(context){const nodes=context.nodes;const closeButton=nodes.closeButton;const videoWrapper=nodes.videoWrapper;closeButton.addEventListener('click',function initButtonCloseClickCallback(e){e.preventDefault();e.stopPropagation();const closeButtonIsVisible=!closeButton.classList.contains('sublime--hide');if(closeButton.classList.contains('sublime--icon-cross')&&closeButtonIsVisible){videoWrapper.classList.add('sublime--inline');closeButton.classList.toggle('sublime--hide');adjustVideoSize(context);hook.call('event.creative.close');}});} function scrollCallback(context,data){const nodes=context.nodes;const closeButton=nodes.closeButton;const videoWrapper=nodes.videoWrapper;if(nodes.video.currentTime===0){return;} const state=getTopRollState(context);const stickyIsCloseable=state===TOPROLL_STATE_VIDEO_STICKY_CLOSEABLE;data.topRollCountdown.setTimerState(stickyIsCloseable);const isInline=videoWrapper.classList.contains('sublime--inline');if(isInline){return;} const closeButtonHasHide=closeButton.classList.contains('sublime--hide');if(closeButtonHasHide&&stickyIsCloseable){data.topRollCountdown.startTimer();} if(nodes.video.ended){data.topRollCountdown.setDuration(0);} closeButton.classList.toggle('sublime--hide',!stickyIsCloseable);} function topRollBindEventCloseButton(context){const frame=context.frame;const nodes=context.nodes;createClickEventButtonClose(context);const topRollCountdown=startNewCountdown(context);topRollCountdown.setTimerState(false);topRollCountdown.startTimer();eventListener.add(frame,'scroll',throttle(scrollCallback.bind(null,context,{topRollCountdown:topRollCountdown,})));eventListener.add(frame,'resize',scrollCallback.bind(null,context,{topRollCountdown:topRollCountdown,}));nodes.video.addEventListener('timeupdate',function timeupdateListener(){if(nodes.video.ended){topRollCountdown.duration=0;} if(nodes.video.currentTime>0){const state=getTopRollState(context);topRollCountdown.setTimerState(state===TOPROLL_STATE_VIDEO_STICKY_CLOSEABLE);}});} function topRollBindEventCanvas(context){const nodes=context.nodes;const video=nodes.video;const videoBackground=nodes.videoBackground;videoBackground.width=video.clientWidth / 2;videoBackground.height=video.clientHeight / 2;videoBackground.getContext('2d').drawImage(video,0,0,video.clientWidth / 2,video.clientHeight / 2);context.frame.requestAnimationFrame(topRollBindEventCanvas.bind(null,context));} function topRollToggleSound(context,force){const video=context.nodes.video;let soundShouldBeOn;if(arguments.length>1){soundShouldBeOn=force;}else if(context.vpaidWrapper){soundShouldBeOn=!context.vpaidWrapper.getAdVolume();}else{soundShouldBeOn=video.muted;} if(context.vpaidWrapper){context.vpaidWrapper.setAdVolume(+soundShouldBeOn);} video.muted=!soundShouldBeOn;hook.call(video.muted?'event.creative.mute':'event.creative.unmute');return soundShouldBeOn;} function topRollBindEventForSound(context){const video=context.nodes.video;const frame=context.frame;const wrapper=context.nodes.videoWrapper;let isSoundOn=false;function toggleSoundOnScroll(){if(!isSoundOn&&frame.scrollY===0&&video.dataset.userAction==='click'){isSoundOn=topRollToggleSound(context,true);} if(isSoundOn&&frame.scrollY>0){isSoundOn=topRollToggleSound(context,false);}} eventListener.add(frame,'scroll',throttle(toggleSoundOnScroll));wrapper.addEventListener('click',function toggleSoundOnClick(event){event.stopPropagation();video.dataset.userAction='click';if(frame.scrollY===0){isSoundOn=topRollToggleSound(context);}});} function topRollBindEventForSoundUI(context){const nodes=context.nodes;const video=nodes.video;const soundIcon=nodes.soundButton;video.addEventListener('volumechange',function updateSoundUI(){soundIcon.classList.toggle('sublime--muted',video.muted);});} function topRollBindReplayVideo(context){const nodes=context.nodes;const video=nodes.video;const playPromise=video.play()||window.sublime.Promise.resolve();hook.call('event.creative.rewind');playPromise.catch(function replayError(error){log.log('Replay failed',error);});} function topRollBindLoadedmetadataVideo(context){setVideoSize(context);const stateAfterLoadMetadata=getTopRollState(context);if(stateAfterLoadMetadata===TOPROLL_STATE_VIDEO_FULL||stateAfterLoadMetadata===TOPROLL_STATE_VIDEO_EXPAND_TRANSITION){const height=topRollVideoHeightBoundaries(context);scrollTo(context.frame,0,height.max-height.optimal);}} function topRollBindFocusVideo(context){const frame=context.frame;const nodes=context.nodes;const video=nodes.video;const videoWrapper=nodes.videoWrapper;const height=topRollVideoHeightBoundaries(context);const videoBottomRect=nodes.container.getBoundingClientRect().bottom;const sublimeInline=videoWrapper.classList.contains('sublime--inline');const isPlaying=video.currentTime>0&&!video.paused&&!video.ended&&video.readyState>video.HAVE_CURRENT_DATA;const hasPlayed=video.currentTime>0&&video.paused&&!video.ended;const isDocumentHidden=frame.document.hidden;const isVideoHalfHidden=videoBottomRect<=(height.min / 2);const shouldBePaused=isDocumentHidden||(isVideoHalfHidden&&sublimeInline);if(shouldBePaused&&isPlaying){video.pause();}else if(hasPlayed&&!shouldBePaused){video.play();}} function topRollBindEventCallToAction(context,event){event.stopPropagation();const frame=context.frame;const data=context.data;analytics.fire(env('zoneId'),'click');frame.open(data.targetUrl);} function topRollBindEventCallToActionOverlay(context,event){const nodes=context.nodes;const video=nodes.video;if(!video.ended){return;} const state=getTopRollState(context);if(state===TOPROLL_STATE_VIDEO_EXPAND||state===TOPROLL_STATE_VIDEO_FULL||state===TOPROLL_STATE_VIDEO_EXPAND_TRANSITION){topRollBindEventCallToAction(context,event);}} function setQuartileClassname(node,indexQuartile){VIDEO_QUARTILES_NAMES.forEach(function initEachVideoQuartiles(quartile,index){node.classList.toggle('sublime--video-'+quartile,index===indexQuartile);});} function topRollSetUpEvents(context){const frame=context.frame;const body=frame.document.body;const nodes=context.nodes;eventListener.add(frame,'scroll',throttle(topRollStateListener.bind(null,context)));eventListener.add(frame,'scroll',throttle(adjustVideoSize.bind(null,context)));eventListener.add(frame,'resize',throttle(setVideoSize.bind(null,context)));eventListener.add(frame,'orientationchange',setVideoSize.bind(null,context));nodes.ctaButton.addEventListener('click',topRollBindEventCallToAction.bind(null,context));nodes.videoOverlay.addEventListener('click',topRollBindEventCallToActionOverlay.bind(null,context));nodes.collapseButton.addEventListener('click',goToPreviousTopRollState.bind(null,context));nodes.videoWrapper.addEventListener('click',setTopRollState.bind(null,context,TOPROLL_STATE_VIDEO_EXPAND));topRollBindEventForSoundUI(context);topRollBindEventForSound(context);topRollBindEventCloseButton(context);nodes.video.addEventListener('loadedmetadata',topRollBindLoadedmetadataVideo.bind(null,context));nodes.video.addEventListener('play',topRollBindEventCanvas.bind(context.frame,context));nodes.video.addEventListener('play',function removeClassLoadingOnPlayEvent(){body.classList.remove('sublime-toproll-loading');});nodes.video.addEventListener('play',adjustVideoSize.bind(null,context));nodes.video.addEventListener('ended',adjustVideoSize.bind(null,context));trackVideoPlayback(nodes.video,{'0%':setQuartileClassname.bind(null,body,0),'25%':setQuartileClassname.bind(null,body,1),'50%':setQuartileClassname.bind(null,body,2),'75%':setQuartileClassname.bind(null,body,3),'100%':setQuartileClassname.bind(null,body,4),},true);nodes.replayButton.addEventListener('click',topRollBindReplayVideo.bind(null,context));eventListener.add(frame,'visibilitychange',topRollBindFocusVideo.bind(null,context));eventListener.add(frame,'scroll',throttle(topRollBindFocusVideo.bind(null,context)));hook.register('event.cleanUp',function topRollCleanup(){body.className=body.className.replace(/sublime-\S+/ig,'').trim();body.removeChild(nodes.container);});return context;} function topRollInit(context){const data=context.data;const nodes=context.nodes;const rootNode=context.root;const frame=context.frame;const container=context.nodes.container;rootNode.classList.add('sublime-toproll');rootNode.classList.add('sublime-toproll-loading');addCss(env('css')['toproll']);if(env('zoneUseCLSMobile')){container.style.height=0;addCss('.sublime-cls > :not(#sublime-container) {\n' +' transform: translateY('+frame.innerHeight+'px);\n' +'}');}else{container.style.height=frame.innerHeight+'px';} rootNode.insertBefore(container,rootNode.firstChild);didMutateDOM();setVideoSize(context);topRollStateListener(context);(function preventExpandUntilUserAction(){let isUserActive=false;const userEvents=['wheel','mousedown','mousemove','mouseup','touchstart','touchmove','touchend','pointerdown','pointermove','pointerup',];function setActiveUser(){isUserActive=true;userEvents.forEach(function each(evtName){frame.removeEventListener(evtName,setActiveUser);});} userEvents.forEach(function each(evtName){frame.addEventListener(evtName,setActiveUser);});function checkUser(){if(isUserActive){return;} const state=getTopRollState(context);if(state===TOPROLL_STATE_VIDEO_EXPAND_TRANSITION||state===TOPROLL_STATE_VIDEO_EXPAND){setTopRollState(context,TOPROLL_STATE_VIDEO_FULL);} context.frame.requestAnimationFrame(checkUser);} checkUser();}());if(data.html){domWrite(data.html);} if(!data.vpaid&&isObject(data.video)&&isString(data.video.src)){nodes.video.setAttribute('src',data.video.src);} return context;} function topRollAdIsReady(ad){const mobile=ad.creative_type==='mobile toproll classic'&&hasProperty(ad,'mobile_setup.top.video')&&isUrl(ad.mobile_setup.top.video);const desktop=ad.creative_type==='video toproll classic'&&hasProperty(ad,'videos.top')&&isUrl(ad.videos.top);return isUrl(ad.originalUrl)&&(mobile||desktop);} function topRollContext(nodes,data,root){const context={frame:sublime.window,root:root,nodes:nodes,data:data,scrollY:undefined,};return sublime.Promise.resolve(context);} function topRollRender(ad,root){registerPixelsToHooks();const nodes=topRollBuildDOMTree();const data=topRollNormalizeData(ad);registerVideoPixels();if(!data.vpaid){setUpVideoQuartiles(nodes.video);} setSetupZone();if(data.video&&(typeof data.video.duration==='number')){ad.video_duration=data.video.duration;} hook.call('step.impression.before');return topRollContext(nodes,data,root).then(topRollInterceptScrollTo).then(topRollGlobalSublimeAPI).then(topRollSetUpEvents).then(topRollInit).then(topRollVPAID).then(function hookImpressionAfter(context){hook.call('step.impression.after');return context;});} createNamespace('sublime.display.mobile.panel2');const mskinzHookNames={topCloseButtonClicked:'event.mobile.topCloseButtonClicked',topAutoHide:'event.mobile.topAutoHide',beforeClosePanel:'event.mobile.beforeClosePanel',afterClosePanel:'event.mobile.afterClosePanel',beforeOpenPanel:'event.mobile.beforeOpenPanel',afterOpenPanel:'event.mobile.afterOpenPanel',swipeToPanel:'event.mobile.swipeToPanel',swipeToMainPage:'event.mobile.swipeToMainPage',orientationChange:'event.mobile.orientationChange',arrowReady:'step.mobile.arrowReady',swiperCreated:'event.mobile.swiperCreated',topImageLoaded:'event.mobile.topImageLoaded',swiperTouchStart:'event.mobile.swiperTouchStart',swiperTouchCancel:'event.mobile.swiperTouchCancel',bottomReady:'step.mobile.bottomReady',closePanel:'event.mobile.closePanel',openPanel:'event.mobile.openPanel',click:'event.mobile.click',clickTop:'event.mobile.clickTop',clickBottom:'event.mobile.clickBottom',clickPanel:'event.mobile.clickPanel',topReady:'step.mobile.topReady',panelReady:'step.mobile.panelReady',domInteractive:'dom.interactive',};const cdn=env('delivery_url');const pixelsMskinzAbstract={close:{inherit:'_commonSkinz',qs:{e:'close'}},topView:{inherit:'_commonSkinz',qs:{e:'mtv'}},bottomView:{inherit:'_commonSkinz',qs:{e:'mbv'}},panelView:{inherit:'_commonSkinz',qs:{e:'mp0'}},panelViewSec1:{inherit:'_commonSkinz',qs:{e:'mp1'}},panelViewSec3:{inherit:'_commonSkinz',qs:{e:'mp3'}},};const NAVBAR_ZINDEX=2147483647;const PANEL_ZINDEX=NAVBAR_ZINDEX-1;const DOUBLE_BUFF_IMAGE_ZINDEX=PANEL_ZINDEX-1;sublime.display.mobile.panel2.swiperContainer=null;sublime.display.mobile.panel2.hookNames=mskinzHookNames;sublime.display.mobile.panel2.adIsReady=function mskinzAdIsReady(ad){if(!ad.isRedirect&&!isUrl(ad.url)){return false;} const elementToTest=['top','bottom','panel'];let isReady=true;elementToTest.forEach(function each(element){const hasElement=Boolean(ad.mobile_setup[element]&&ad.mobile_setup[element].key&&isUrl(ad.mobile_setup[element].src)&&ad.mobile_setup[element].type);isReady=isReady&&hasElement;});return isReady;};sublime.display.mobile.panel2.render=function mskinzRender(ad){ad.click_url_top_final=sublime.display.getFinalClickUrl(ad,null,'mct');ad.click_url_panel_final=sublime.display.getFinalClickUrl(ad,null,'mcp');ad.click_url_bottom_final=sublime.display.getFinalClickUrl(ad,null,'mcb');hook.register(mskinzHookNames.domInteractive,function mskinzDomInteractive(){loadSwiperLibraryAndDisplayAd(ad);});};sublime.display.mobile.panel2.openClosePanel=function openClosePanel(open){if(open&&sublime.display.mobile.panel2.swiperContainer.isMainPage()){hook.call(mskinzHookNames.swipeToPanel);}else{sublime.display.mobile.panel2.swiperContainer.swipeToMainPage();}};sublime.display.mobile.panel2.getComponent=function mskinzGetComponent(key){const swiperContainer=sublime.display.mobile.panel2.swiperContainer;const components={top:swiperContainer.top.element,close_button:swiperContainer.top.closeButton.element,arrowContainer:swiperContainer.arrow.element,arrow:swiperContainer.arrow.element,bottom:swiperContainer.bottom.element,panel:swiperContainer.panel.element,};return components[key]||null;};function loadSwiperLibraryAndDisplayAd(ad){analytics.setPixels(env('zoneId'),pixelsMskinzAbstract);setPixelSwipeMacro(ad);hook.call('step.impression.before');const zone=env('zone');setupZoneAdMskinzAbstract(zone,ad);initMskinz(zone,ad);hook.call('step.impression.after');} function initMskinz(zone,ad){addCssToDisplayRootDocument(env('css')['mskinzV2']);const script=sublime.display.addJavascriptToHead(cdn+'mskinz/swiper.min.js');script.addEventListener('load',()=>{initSwiperContainer(zone,ad);});} function initSwiperContainer(zone,ad){sublime.display.mobile.panel2.swiperContainer=SwiperContainer.create(zone,ad);hook.call(mskinzHookNames.swiperCreated);} function setupZoneAdMskinzAbstract(zone,ad){hook.call('step.setupZoneAd.before');if(zone.mobilecss){addCssToDisplayRootDocument(zone.mobilecss);} if(zone.mobilejs){applyJs(zone.mobilejs);} if(ad.mobile_setup.css){ad.mobile_setup.css=sublime.macros.replace(ad.mobile_setup.css,ad);addCssToDisplayRootDocument(ad.mobile_setup.css);} if(ad.mobile_setup.js){ad.mobile_setup.js=sublime.macros.replace(ad.mobile_setup.js,ad);applyJs(ad.mobile_setup.js);} if(ad.html){let clickMacro='';if(ad.isRedirect){clickMacro=ad.click_macro;} const adWithMcp=merge(ad,{click_url:sublime.adServer.clickurlizeAntenna(clickMacro,'mcp'),});ad.html=sublime.macros.replace(ad.html,adWithMcp);} hook.call('step.setupZoneAd.after');} function setPixelSwipeMacro(ad){if(!isUrl(ad.swipe_macro)){return;} const pixels={'panelView.swipeMacro':{slot:'panelView.swipeMacro',url:ad.swipe_macro,repeat:3,},};analytics.setPixels(env('zoneId'),pixels);} PanelDoubleBuffLayer.create=(transitionColors)=>(new PanelDoubleBuffLayer())._init(transitionColors);function PanelDoubleBuffLayer(){this.element=null;this.id='panel-double-buffer-image';this._init=function _init(transitionColors){this.element=displayRoot.get().ownerDocument.createElement('div');this.element.id=this.id;this.element.style.zIndex=DOUBLE_BUFF_IMAGE_ZINDEX;this.hide();this.element.style.backgroundColor=(transitionColors&&transitionColors[1])||'#e9531d';sublime.display.getCreativeContainer().appendChild(this.element);return this;};this.show=function show(){this.element.classList.remove('sublime-hidden');};this.hide=function hide(){this.element.classList.add('sublime-hidden');};} TopTooltip.create=function create(parentElement,tooltipType,topImage){return(new TopTooltip())._init(parentElement,tooltipType,topImage);};function TopTooltip(){this.id='sublime-top-tooltip';this.element=null;this.childElement=null;this._parentElement=null;this.tooltipType=null;this.arrow=null;this.gesture=null;this._init=function _init(parentElement,tooltipType,topImage){this._parentElement=parentElement;this.tooltipType=parseInt(tooltipType,10);switch(this.tooltipType){case 1:this._renderAnimation1();break;case 2:this._renderAnimation2();break;case 3:this._renderAnimation3();break;default:this._renderAnimation4(topImage);break;} parentElement.appendChild(this.element);return this;};this._renderAnimation1=function _renderAnimation1(){const document=displayRoot.get().ownerDocument;this.element=document.createElement('div');this.element.id=this.id;this.element.addEventListener('click',function onclick(e){e.preventDefault();e.stopPropagation();if(sublime.display.mobile.panel2.swiperContainer.isMainPage()){hook.call(mskinzHookNames.swipeToPanel);}});const svgNS='http://www.w3.org/2000/svg';const svg=document.createElementNS(svgNS,'svg');svg.setAttributeNS(null,'viewBox','0 0 26.81 56.96');const path=document.createElementNS(svgNS,'path');path.setAttributeNS(null,'d','M26.06.66,1.34,28.48,26.06,56.29');path.setAttributeNS(null,'fill','none');path.setAttributeNS(null,'stroke','#fff');path.setAttributeNS(null,'stroke-miterlimit','10');path.setAttributeNS(null,'stroke-width','2');svg.appendChild(path);this.element.appendChild(svg);const self=this;function showAnimation(){self.element.classList.add('bounce-out-right');timer.setTimeout(function timerSetTimeout(){self.element.classList.remove('bounce-out-right');},2500);} function resetAnimation(){self.element.style.transform='translateX(0)';} showAnimation();timer.setInterval(()=>{resetAnimation();showAnimation();},3500);};this._renderAnimation2=function _renderAnimation2(){const document=displayRoot.get().ownerDocument;const font=document.createElement('link');font.href='https://fonts.googleapis.com/css?family=Arvo';font.rel='stylesheet';document.head.appendChild(font);this.element=document.createElement('div');this.element.id='sublime-container-swipe';const tooltipText=document.createElement('span');tooltipText.id='sublime-text-swipe';tooltipText.innerHTML='SWIPE TO DISCOVER';this.element.appendChild(tooltipText);const tooltipIcon=document.createElement('img');tooltipIcon.id='sublime-icon-swipe';tooltipIcon.src=cdn+'mskinz/animation2_gesture.svg';this.element.appendChild(tooltipIcon);let showed=true;const self=this;function hideTooltip(){showed=false;tooltipText.style.opacity=0;timer.setTimeout(function timerSetTimeout(){self.element.style.width='40px';},100);} function showTooltip(){showed=true;self.element.style.width='180px';timer.setTimeout(()=>{tooltipText.style.opacity=1;},150);} timer.setInterval(()=>{if(showed){hideTooltip();}else{showTooltip();}},1500);};this._renderAnimation3=function _renderAnimation3(){const document=displayRoot.get().ownerDocument;this.element=document.createElement('div');this.element.id='sublime-animation-3';const image=document.createElement('img');image.src=cdn+'mskinz/animation3_gesture.png';image.addEventListener('load',()=>{timer.setTimeout(()=>{this.element.style.opacity=0;},5000);});this.element.appendChild(image);};this._renderAnimation4=function _renderAnimation4(topImage){const document=displayRoot.get().ownerDocument;this.element=document.createElement('div');this._parentElement.classList.add('sublime-animation-4');topImage.classList.add('sublime-animation-4-image');this.childElement=document.createElement('div');this.childElement.id='animation4-images-container';const self=this;timer.setTimeout(function onsetTimeout(){self.childElement.appendChild(topImage);const topImageCopy=topImage.cloneNode();topImageCopy.id=topImageCopy.getAttribute('id')+'-copy';topImageCopy.classList.add('animation4-image-copy');self.childElement.appendChild(topImageCopy);},1000);this.element.appendChild(this.childElement);this.gesture=document.createElement('img');this.gesture.src=cdn+'mskinz/animation4_gesture.svg';this.gesture.id='animation4-gesture';this.element.appendChild(this.gesture);this.arrow=document.createElement('img');this.arrow.src=cdn+'mskinz/animation4_arrow.svg';this.arrow.id='animation4-arrow';this.element.appendChild(this.arrow);this.element.addEventListener('touchstart',this._disableTooltip.bind(this));};this._disableTooltip=function _disableTooltip(){if(this.gesture){this.gesture.style.display='none';} if(this.arrow){this.arrow.style.display='none';} [this.gesture,this.arrow,this.childElement].forEach((element)=>{if(element){element.style.animation='none';}});};} TopCloseButton.create=()=>(new TopCloseButton())._init();function TopCloseButton(){this.id='sublime-mobile-top-close';this.element=null;this._isClicked=false;this._init=function _init(){this.element=displayRoot.get().ownerDocument.createElement('div');this.element.style.zIndex=996;this.element.id=this.id;this._bindEvents();return this;};this._bindEvents=function _bindEvents(){this.element.addEventListener('click',(e)=>{e.preventDefault();hook.call(mskinzHookNames.topCloseButtonClicked);analytics.fire(env('zoneId'),'close');this.fadeOut();this._isClicked=true;});};this.fadeOut=function fadeOut(){this.element.style.opacity=0;this.element.style.zIndex=0;};this.fadeIn=function fadeIn(){this.element.style.opacity=1;this.element.style.zIndex=998;};this.update=function update(isMainPage,isSupportTopSticky,anchorScrollY){if(!this._isClicked&&isMainPage&&isSupportTopSticky&&sublime.window.pageYOffset>anchorScrollY){this.fadeIn();}else{this.fadeOut();}};} TopTimer.create=(autoHideDuration)=>(new TopTimer())._init(autoHideDuration);function TopTimer(){this.id='sublime-mobile-top-timer';this.element=null;this._autoHideDuration=0;this._interval=null;this._resetTime=0;this._finished=false;this._init=function _init(autoHideDuration){this._autoHideDuration=autoHideDuration;this.element=displayRoot.get().ownerDocument.createElement('div');this.element.style.zIndex=996;this.element.id=this.id;return this;};this.fadeIn=function fadeIn(){this.element.style.zIndex=998;this.element.style.opacity=1;};this.fadeOut=function fadeOut(){this.element.style.opacity=0;this.element.style.zIndex=996;};this._updateText=function _updateText(){this.element.innerText=pInt(this._resetTime / 1000)+1;};this._clearTimerInterval=function _clearTimerInterval(){this.fadeOut();timer.clearInterval(this._interval);this._interval=null;};this.update=function update(isMainPage,isSupportTopSticky,anchorScrollY){if(this._finished||!isMainPage||!isSupportTopSticky||this._autoHideDuration<=0||sublime.window.pageYOffset<=anchorScrollY){this._clearTimerInterval();return;} if(!this._interval){this._resetTime=this._autoHideDuration*1000-1;this._updateText();this.fadeIn();this._interval=timer.setInterval(()=>{this._resetTime-=500;this._updateText();if(this._resetTime<=0){this._clearTimerInterval();this._finished=true;hook.call(mskinzHookNames.topAutoHide);}},500);}};} TopContainer.create=(ad,zoneFooterFixed,parentElement)=>(new TopContainer())._init(ad,zoneFooterFixed,parentElement);function TopContainer(){this.id='sublime-mobile-top';this.element=null;this.image=null;this._ad={};this._params={};this.parallaxSpeed=0.5;this.isSupportParallax=false;this.isSupportSticky=false;this._showTimer=false;this.tooltip=null;this.closeButton=null;this.originPaddingTop=0;this.originMarginTop=0;this.timer=null;this._isFirstShow=true;this._init=function _init(ad,zoneSupportSticky,parentElement){this._ad=ad;this._params=ad.mobile_setup.top;this.originMarginTop=parseFloat(getComputedStyle(parentElement).marginTop)||0;const adSupportSticky=this._params.autoHideTopDuration>0||this._params.supportTopClose;this.isSupportSticky=this._shouldSupportSticky(zoneSupportSticky,adSupportSticky);this._showTimer=!this._params.supportTopClose||this._params.autoHideTopDuration>0;this._createElement(this._params.src);this.resetParallax();this.tooltip=TopTooltip.create(this.element,this._params.tooltipType,this.image);if(this.isSupportSticky){if(this._showTimer){this.timer=TopTimer.create(this._params.autoHideTopDuration||3);parentElement.appendChild(this.timer.element);}else{this.closeButton=TopCloseButton.create();parentElement.appendChild(this.closeButton.element);}} this._bindEvents();this.isInScreen();return this;};this._createElement=function _createElement(imageUrl){const root=displayRoot.get();this.element=root.ownerDocument.createElement('div');this.element.id=this.id;this.element.className='swiper-slide';this.image=root.ownerDocument.createElement('img');this.image.id='sublime-mobile-top-image';this.image.src=imageUrl;this.image.addEventListener('load',()=>{if(!env('zoneUseCLSMobile')){this.originPaddingTop=parseFloat(root.paddingTop||0)+this.originMarginTop;root.style.setProperty('padding-top',(this.originPaddingTop+this.image.clientHeight)+'px','important');}else{addCssToDisplayRootDocument(['.sublime-cls > :not(#'+env('sublime_prefix')+'-html, #sublime-mobile-bottom-container) {','transform: translateY('+this.image.clientHeight+'px)','}',].join(''));} hook.call(mskinzHookNames.topImageLoaded);});this.element.appendChild(this.image);};this._shouldSupportSticky=function _shouldSupportSticky(zoneSupportSticky,adSupportSticky){const result=isDefined(zoneSupportSticky)?zoneSupportSticky:true;return!!Number(result)&&adSupportSticky;};this.getMediaHeight=function getMediaHeight(){return this.image.clientHeight;};this._bindEvents=function _bindEvents(){const self=this;this.element.addEventListener('click',function onclick(e){e.stopPropagation();e.preventDefault();if(self.video&&self.video.isVpaid&&!self.video.vpaid.isDeleted){return;} if(self._params.showPanelWhenClicked&&sublime.display.mobile.panel2.swiperContainer.isMainPage()){hook.call(mskinzHookNames.swipeToPanel);}else{analytics.fire(env('zoneId'),'click');sublime.window.open(self._ad.click_url_top_final);hook.call(mskinzHookNames.click);hook.call(mskinzHookNames.clickTop);}});};this.resetParallax=function resetParallax(){this.isSupportParallax=this._params.supportTopParallax||false;};this.disableParallax=function disableParallax(){this.isSupportParallax=false;};this.disableSupportSticky=function disableSupportSticky(){this.isSupportSticky=false;};this.isInScreen=function isInScreen(){let result;if(this.isSupportSticky){result=true;}else if(this.isSupportParallax){result=sublime.window.pageYOffset<=(this.element.clientHeight / this.parallaxSpeed);}else{result=sublime.window.pageYOffset<=this.element.clientHeight;} if(this._isFirstShow&&result){analytics.fire(env('zoneId'),'topView');this._isFirstShow=false;} return result;};this.update=function update(isMainPage){if(this.isSupportSticky){if(this._showTimer){this.timer.update(isMainPage,this.isSupportSticky,this.getMediaHeight());}else{this.closeButton.update(isMainPage,this.isSupportSticky,this.getMediaHeight());}}};} BottomContainer.create=(ad,isSupportTopSticky,zoneFooterFixed)=>(new BottomContainer())._init(ad,isSupportTopSticky,zoneFooterFixed);function BottomContainer(){this.id='sublime-mobile-bottom-container';this.element=null;this.disable=false;this.image=null;this._ad={};this._params={};this._originPaddingBottom=0;this.isSupportSticky=false;this._isFirstShow=true;this._lastScrollY=0;this._init=function _init(ad,isSupportTopSticky,zoneFooterFixed){this._ad=ad;this._params=ad.mobile_setup.bottom;this.isSupportSticky=ad.mobile_setup.footer_fixed&&zoneFooterFixed;if(!env('zoneUseCLSMobile')){this._originPaddingBottom=parseFloat(getComputedStyle(displayRoot.get()).paddingBottom||0);} this._createElement();this._bindEvents();if(!env('zoneUseCLSMobile')&&!this.isSupportSticky){this.element.style.transform='translate3d(0,'+this._originPaddingBottom+'px,0)';} this.setVisible(!isSupportTopSticky);hook.call(mskinzHookNames.bottomReady);return this;};this._bindEvents=function _bindEvents(){const self=this;if(this._params.showPanelWhenClicked){this.element.addEventListener('touchstart',function ontouchstart(){hook.call(mskinzHookNames.click);hook.call(mskinzHookNames.clickBottom);if(sublime.display.mobile.panel2.swiperContainer.isMainPage()){hook.call(mskinzHookNames.swipeToPanel);}});}else{this.element.addEventListener('click',function onclick(){hook.call(mskinzHookNames.click);hook.call(mskinzHookNames.clickBottom);sublime.window.open(self._ad.click_url_bottom_final);});} timer.setInterval(()=>{this._lastScrollY=sublime.window.pageYOffset;},100);};this._createElement=function _createElement(){const root=displayRoot.get();this.element=root.ownerDocument.createElement('div');this.element.id=this.id;this.element.classList.add('sublime-mobile-bottom-container');this.element.style.zIndex=DOUBLE_BUFF_IMAGE_ZINDEX-1;this.image=root.ownerDocument.createElement('img');this.image.id='sublime-mobile-bottom-image';this.image.src=this._params.src;this.element.appendChild(this.image);root.appendChild(this.element);};this.setSticky=function setSticky(sticky){const node=displayRoot.get();if(sticky){this.slideIn();if(!env('zoneUseCLSMobile')){node.style.paddingBottom=((this._originPaddingBottom||0)+this.element.clientHeight)+'px';} this.element.classList.add('sublime-fixed-footer');}else{this.slideOut();if(!env('zoneUseCLSMobile')){node.style.paddingBottom=(this._originPaddingBottom||0)+'px';} this.element.classList.remove('sublime-fixed-footer');}};this.setVisible=function setVisible(visible){if(visible){this.element.classList.remove('sublime-hidden');}else{this.element.classList.add('sublime-hidden');}};this.isAtBottom=function isAtBottom(){const windowHeight=Math.max(displayRoot.get().scrollHeight,displayRoot.get().offsetHeight,displayRoot.get().parentNode.clientHeight);return(windowHeight-this.element.clientHeight<=sublime.window.innerHeight+sublime.window.scrollY);};this.slideIn=function slideIn(){if(env('zoneUseCLSMobile')){this.element.style.transform='translateY('+this.image.clientHeight+')';return;} if(this.isSupportSticky){this.element.style.transform='translate3d(0,0,0)';}else{this.element.style.transform='translate3d(0,'+this._originPaddingBottom+'px,0)';}};this.slideOut=function slideOut(){this.element.style.transform='translate3d(0,'+(this.element.clientHeight+this._originPaddingBottom)+'px, 0)';};this.scrollUpOffset=function scrollUpOffset(){return this._lastScrollY-window.pageYOffset;};this.hide=function hide(){this.element.classList.add('sublime-hidden');if(!env('zoneUseCLSMobile')){displayRoot.get().style.paddingBottom=this._originPaddingBottom+'px';}};this.update=function update(isMainPage,isTopSupportSticky,isTopInScreen){if(isTopSupportSticky||!isMainPage||isTopInScreen){this.slideOut();return;} if(this.isAtBottom()){this.slideIn();}else if(this.isSupportSticky&&this.scrollUpOffset()>30){this.setSticky(true);}else if(this.scrollUpOffset()<=-10){this.slideOut();} if(!this._isFirstShow){return;} if(!this.disable&&((this.isSupportSticky&&this.scrollUpOffset()>30)||this.isAtBottom())){analytics.fire(env('zoneId'),'bottomView');this._isFirstShow=false;}};} PanelContainer.create=(ad)=>(new PanelContainer())._init(ad);function PanelContainer(){this.id='sublime-mobile-panel-container';this.element=null;this._slides=[];this._params={};this._ad={};this.getSlides=function getSlides(){return this._slides;};this.clickCallback=function clickCallback(){if(this._ad.click_url_panel_final){analytics.fire(env('zoneId'),'click');hook.call(mskinzHookNames.click);hook.call(mskinzHookNames.clickPanel);sublime.window.open(this._ad.click_url_panel_final);}else{log.warn('Click event as occured on the panel but no url is set');}};this._init=function _init(ad){this._ad=ad;this._params=ad.mobile_setup.panel;this.element=this._createSlide(this._params.src);this.element.id=this.id;this._slides.push(this.element);this._bindEvents();return this;};this._createSlide=function _createSlide(imageUrl){const div=displayRoot.get().ownerDocument.createElement('div');div.classList.add('swiper-slide');div.classList.add('sublime-panel-slide');div.style.backgroundImage='url('+imageUrl+')';return div;};this._bindEvents=function _bindEvents(){this.element.addEventListener('click',this.clickCallback.bind(this));hook.register({namespace:mskinzHookNames.panelReady,callback:this._appendIframe.bind(this),multiple:false,});};this._appendIframe=function _appendIframe(){if(isEmpty(this._ad.html)){return;} if(inArray(this._ad.html_usage,['iframe-lazy','iframe','cross-domain-iframe'])){const i=this._createIframe();this.element.appendChild(i);if(this._ad.html_usage==='cross-domain-iframe'){i.src=env('sublime_url')+'ad/'+this._ad.id+'/iframe';return;} if(this._ad.html_usage==='iframe'){this._writeToIframe(i,this._ad.html);return;} if(this._ad.html_usage==='iframe-lazy'){hook.register({namespace:mskinzHookNames.beforeOpenPanel,callback:()=>{this._writeToIframe(i,this._ad.html);},multiple:false,});}}else{sublime.display.writeToContainer(this._ad.html,this.id);}};this._writeToIframe=function _writeToIframe(i,html){const result=html+'';const iDoc=i.contentDocument;iDoc.open();iDoc.write(`${result}`);iDoc.close();};this._createIframe=function _createIframe(){const navbarHeight=6.4;const i=displayRoot.get().ownerDocument.createElement('iframe');i.id='ayads-rich-media';i.name='ayads-rich-media';i.height=(100-navbarHeight)+'%';i.style.position='absolute';i.style.top=navbarHeight+'%';i.style.left=0;i.width='100%';i.style.borderWidth='0';return i;};} ArrowButton.create=()=>(new ArrowButton())._init();function ArrowButton(){this.id='sublime-mobile-panel-arrow-container';this.element=null;this._touchStartX=0;this._panelOpened=false;this._init=function _init(){this._createElement();this._bindEvents();return this;};this._createElement=function _createElement(){const document=displayRoot.get().ownerDocument;this.element=document.createElement('div');this.element.id=this.id;this.element.style.zIndex=DOUBLE_BUFF_IMAGE_ZINDEX-1;const svgNS='http://www.w3.org/2000/svg';const svg=document.createElementNS(svgNS,'svg');svg.setAttributeNS(null,'viewBox','0 0 126 54');const bg=document.createElementNS(svgNS,'path');bg.setAttributeNS(null,'d','M27,0a27,27,0,0,0,0,54H126V0Z');bg.setAttributeNS(null,'fill','#1e3c86');svg.appendChild(bg);const arrow=document.createElementNS(svgNS,'path');arrow.setAttributeNS(null,'d','M19.67,28.21l6.16,6.16A1.71,1.71,0,0,0,28.25,32L25,28.71H33.2a1.71,1.71,0,0,0,0-3.42H25l3.24-3.24a1.71,1.71,0,0,0-2.42-2.42l-6.16,6.16A1.73,1.73,0,0,0,19.67,28.21Z');arrow.setAttributeNS(null,'fill','#fff');svg.appendChild(arrow);const circle=document.createElementNS(svgNS,'circle');circle.setAttributeNS(null,'cx','27');circle.setAttributeNS(null,'cy','27');circle.setAttributeNS(null,'r','15.22');circle.setAttributeNS(null,'fill','none');circle.setAttributeNS(null,'stroke','#fff');circle.setAttributeNS(null,'stroke-miterlimit','10');circle.setAttributeNS(null,'stroke-width','3');svg.appendChild(circle);this.element.appendChild(svg);sublime.display.getCreativeContainer().appendChild(this.element);const arrowHeight=3.4;this.element.style.bottom=(50-arrowHeight)+'vh';};this._bindEvents=function _bindEvents(){hook.call(mskinzHookNames.arrowReady);const self=this;this.element.addEventListener('touchstart',function ontouchstart(e){if(e.touches&&e.touches.length>1){return;} self._touchStartX=e.touches[0].screenX;});this.element.addEventListener('touchmove',function ontouchmove(e){if(e.touches&&e.touches.length>1){return;} const touchCurrentX=(e.touches&&e.touches[0]?e.touches[0].screenX:touchCurrentX)||0;const touchDelta=touchCurrentX-self._touchStartX;if(touchDelta<=-36&&!self._panelOpened){hook.call(mskinzHookNames.swipeToPanel);self._panelOpened=true;}else{self.element.style.transform='translate3d('+touchDelta+'px, -50% , 0)';}});function openPanel(){if(!self._panelOpened){hook.call(mskinzHookNames.swipeToPanel);} self.element.style.transform='translate3d(0, -50% , 0)';self._panelOpened=false;} this.element.addEventListener('touchend',openPanel);if(preview.enabled&&device.is.desktop){this.element.addEventListener('mousedown',function(){sublime.window.addEventListener('mouseup',function previewMouseDown(){openPanel();sublime.display.mobile.panel2.swiperContainer.top.tooltip._disableTooltip();sublime.window.removeEventListener('mouseup',previewMouseDown);});});}};this.fadeOut=function fadeOut(){this.element.style.marginRight='-80px';};this.fadeIn=function fadeIn(){this.element.style.marginRight='-36px';};this.update=function update(isMainPage,isTopSupportSticky,isTopInScreen){if(!isTopSupportSticky&&isMainPage&&!isTopInScreen){this.fadeIn();}else{this.fadeOut();}};} Overlay.create=()=>(new Overlay())._init();function Overlay(){this.id='sublime-overlay';this.element=null;this._init=function(){this.element=displayRoot.get().ownerDocument.createElement('div');this.element.id=this.id;this.element.classList.add('sublime-hidden');sublime.display.getCreativeContainer().appendChild(this.element);return this;};this.fadeOut=function fadeOut(){this.setOpacity(0);timer.setTimeout(()=>{this.element.classList.add('sublime-hidden');},1000);};this.show=function show(){this.element.classList.remove('sublime-hidden');};this.setOpacity=function setOpacity(opacity){this.element.style.opacity=opacity;};} Navbar.create=(ad,params)=>(new Navbar())._init(ad,params);function Navbar(){this.id='sublime-panel-navbar';this.element=null;this.arrowId='sublime-mobile-panel-arrow';this.arrow=null;this._params={};this.brand=null;this._ad={};this._init=function _init(ad,params){this._ad=ad;this._params=params;this._createElement();if(this._params.navbarBrand){this._createBrandElement();} this._bindEvents();return this;};this._createBrandElement=function _createBrandElement(){this.brand=displayRoot.get().ownerDocument.createElement('img');this.brand.id='sublime-brand';this.brand.classList.add('sublime-brand');this.brand.src=this._params.navbarBrand;this.brand.addEventListener('load',()=>{const maxRatio=9;if(this.brand.height>0){const logoRatio=this.brand.width / this.brand.height;if(logoRatio<=maxRatio){this.element.appendChild(this.brand);}}});};this._createElement=function _createElement(){const document=displayRoot.get().ownerDocument;this.element=document.createElement('div');this.element.id=this.id;this.element.style.backgroundColor=this._params.navbarColor||'#000000';const svgNS='http://www.w3.org/2000/svg';this.arrow=document.createElementNS(svgNS,'svg');this.arrow.setAttributeNS(null,'viewBox','0 0 477.175 477.175');this.arrow.id=this.arrowId;const arrowPath=document.createElementNS(svgNS,'path');arrowPath.setAttributeNS(null,'d','M145.188,238.575l215.5-215.5c5.3-5.3,5.3-13.8,0-19.1s-13.8-5.3-19.1,0l-225.1,225.1c-5.3,5.3-5.3,13.8,0,19.1l225.1,225c2.6,2.6,6.1,4,9.5,4s6.9-1.3,9.5-4c5.3-5.3,5.3-13.8,0-19.1L145.188,238.575z');const arrowColor=this._params.navbarArrowColor||'#FFFFFF';arrowPath.setAttributeNS(null,'fill',arrowColor);this.arrow.appendChild(arrowPath);this.element.appendChild(this.arrow);sublime.display.getCreativeContainer().appendChild(this.element);};this._callHookClosePanel=function _callHookClosePanel(e){e.stopPropagation();e.preventDefault();hook.call(mskinzHookNames.swipeToMainPage);};this._bindEvents=function _bindEvents(){this.arrow.addEventListener('touchstart',this._callHookClosePanel.bind(this));if(preview.enabled&&device.is.desktop){this.arrow.addEventListener('click',this._callHookClosePanel.bind(this));} if(this.brand){this.brand.addEventListener('click',()=>{sublime.window.open(this._ad.click_url_panel_final);});}};this.hide=function hide(){this.setOpacity(0);};this.show=function show(){this.element.classList.remove('sublime-hidden');this.element.style.zIndex=NAVBAR_ZINDEX;};this.setOpacity=function setOpacity(opacity){this.element.style.opacity=opacity;if(opacity===0){this.element.classList.add('sublime-hidden');this.element.style.zIndex=0;}};} SwiperContainer.create=(zone,ad)=>(new SwiperContainer())._init(zone,ad);function SwiperContainer(){this.id='sublime-mobile-top-container';this.element=null;this.slideWrapper=null;this._params=null;this._ad={};this.swiper=null;this.top=null;this.bottom=null;this.panel=null;this.overlay=null;this.navbar=null;this.arrow=null;this.panelDoubleBuffLayer=null;this._contentScrollY=0;this._timeElapsedOnPanel=0;this._timeout1s=null;this._startSwiperIndex=0;this._timeout3s=null;this._ayadsHtmlContainer=false;this._touchStartAt=null;this._stopRenderer=false;this._originZIndex=1029;this._init=function _init(zone,ad){this._ad=ad;this._params=ad.mobile_setup;sublime.display.addCreativeContainer();this._createElement();this.top=TopContainer.create(ad,zone.mobile_setup.footer_fixed,this.element);this.bottom=BottomContainer.create(ad,this.top.isSupportSticky,zone.mobile_setup.footer_fixed);this.panel=PanelContainer.create(ad);this.arrow=ArrowButton.create();this.overlay=Overlay.create();this.navbar=Navbar.create(ad,this._params.panel);this.panelDoubleBuffLayer=PanelDoubleBuffLayer.create(this._params.panel.transitionColors);this.appendSlide(this.top.element);hook.call(mskinzHookNames.topReady);this.panel.getSlides().forEach((slide)=>{this.appendSlide(slide);slide.style.marginTop='-'+this.top.originMarginTop+'px';});this._initSwiper();this._bindEvents();this.setSwiperSticky(this.top.isSupportSticky);this.update();hook.call(mskinzHookNames.panelReady);return this;};this._createElement=function _createElement(){const document=displayRoot.get().ownerDocument;this.element=document.createElement('div');this.element.id=this.id;this.element.className='swiper-container';const color1=(this._params.panel.transitionColors&&this._params.panel.transitionColors[0])||'#1f3c86';const color2=(this._params.panel.transitionColors&&this._params.panel.transitionColors[1])||'#e9531d';this.element.style.backgroundColor=color1;this.element.style.backgroundImage='-webkit-gradient(linear, left top, right top, from('+color1+'), to('+color2+')), ' +'linear-gradient(90deg, '+color1+', '+color2+')';this.slideWrapper=document.createElement('div');this.slideWrapper.className='swiper-wrapper';this.element.appendChild(this.slideWrapper);this._ayadsHtmlContainer=sublime.display.getCreativeContainer();this._ayadsHtmlContainer.appendChild(this.element);const zIndex=getComputedStyle(this.element).zIndex;this._originZIndex=zIndex>1?zIndex:this._originZIndex;this.element.style.zIndex=this._originZIndex;const indicator=document.createElement('div');indicator.id='sublime-position-indicator-block';this._ayadsHtmlContainer.appendChild(indicator);};this.appendSlide=function appendSlide(slide){this.slideWrapper.appendChild(slide);};this._bindEvents=function _bindEvents(){const self=this;sublime.window.addEventListener('scroll',this.update.bind(this));hook.register('event.cleanUp',function clearEventListeners(){sublime.window.removeEventListener('scroll',self.update);});hook.register({namespace:mskinzHookNames.orientationChange,callback(){if(Math.abs(window.orientation)===90){self._stopRenderer=true;self.hideAd();}else{self._stopRenderer=false;timer.setTimeout(()=>{self.showAd();},100);}},});hook.register({namespace:mskinzHookNames.topCloseButtonClicked,callback:this._closeTopClicked.bind(this),});hook.register({namespace:mskinzHookNames.topAutoHide,callback:this._closeTopClicked.bind(this),});hook.register({namespace:mskinzHookNames.swipeToPanel,callback:this.swipeToPanel.bind(this),});hook.register({namespace:mskinzHookNames.swipeToMainPage,callback:this.swipeToMainPage.bind(this),});};this._closeTopClicked=function _closeTopClicked(){const self=this;if(!this.isMainPage()){return;} this.slideSwiperOut();timer.setTimeout(()=>{self.disableSupportTopSticky();self.update();},500);};this.hideAd=function hideAd(){this._ayadsHtmlContainer.classList.add('sublime-hidden');if(!env('zoneUseCLSMobile')){displayRoot.get().style.setProperty('padding-top',this.top.originPaddingTop+'px','important');} this.bottom.hide();};this.showAd=function showAd(){this._ayadsHtmlContainer.classList.remove('sublime-hidden');if(!env('zoneUseCLSMobile')){displayRoot.get().style.setProperty('padding-top',(this.top.originPaddingTop+this.top.getMediaHeight())+'px','important');} if(!this.top.isSupportSticky){this.bottom.element.classList.remove('sublime-hidden');this.bottom.update(this.isMainPage(),this.top.isSupportSticky,this.top.isInScreen());}};this.update=function update(){if(this._stopRenderer){return;} this._handleSwiperParallax();this.top.update(this.isMainPage());this.bottom.update(this.isMainPage(),this.top.isSupportSticky,this.top.isInScreen());this.arrow.update(this.isMainPage(),this.top.isSupportSticky,this.top.isInScreen());};this.isMainPage=function isMainPage(){return this.swiper.realIndex===0;};this._updateHeight=function _updateHeight(progress){const height=progress*this.panel.getSlides().length*sublime.window.innerHeight;if(height{this.bottom.setVisible(true);if(!this.bottom.isSupportSticky){this.bottom.slideIn();}},500);};this.setSwiperSticky=function setSwiperSticky(sticky){if(sticky){this.element.classList.add('sublime-top-fixed');this.element.style.transform='translate3d(0, 0, 0)';}else{this.element.classList.remove('sublime-top-fixed');}};this.slideSwiperOut=function slideSwiperOut(){if(env('zoneUseCLSMobile')){this.element.style.transform='translateX('+this.element.clientWidth+'px)';return;} this.element.style.left=this.element.clientWidth+'px';};this.slideSwiperIn=function slideSwiperIn(){this.element.style.left=0;};this.swipeToPanel=function swipeToPanel(){this.navbar.show();this.swiper.slideTo(1,300);this._activePanelMode();};this.swipeToMainPage=function swipeToMainPage(){if(!this.isMainPage()){this.swiper.slideTo(0,300*(this.swiper.realIndex+1));this._activeMainPageMode();}};this._panelModeZIndex=function _panelModeZIndex(){this.element.style.overflow='visible';this.element.style.zIndex=PANEL_ZINDEX;};this._mainPageModeZIndex=function _mainPageModeZIndex(){this.element.style.overflow='hidden';this.element.style.zIndex=this._originZIndex;};this._activeMainPageMode=function _activeMainPageMode(){hook.call(mskinzHookNames.beforeClosePanel);this._mainPageModeZIndex();this.navbar.hide();if(this._contentScrollY>=0){sublime.window.scrollTo(0,this._contentScrollY);} displayRoot.get().classList.remove('sublime-panel-opened');this.setSwiperSticky(this.top.isSupportSticky);this.top.resetParallax();hook.call(mskinzHookNames.closePanel);this._removePanelPixelsTimer();this.update();hook.call(mskinzHookNames.afterClosePanel);};this._activePanelMode=function _activePanelMode(){this._panelModeZIndex();hook.call(mskinzHookNames.beforeOpenPanel);this._rememberContentScrollY();sublime.window.scrollTo(0,0);displayRoot.get().classList.add('sublime-panel-opened');this.navbar.setOpacity(1);this.setSwiperSticky(true);this.top.disableParallax();this.element.style.transform='translate3d(0px, 0px, 0px)';hook.call(mskinzHookNames.openPanel);this._addPanelPixelsTimer();this.update();hook.call(mskinzHookNames.afterOpenPanel);};this._addPanelPixelsTimer=function _addPanelPixelsTimer(){elapsedSinceLastCall('mobilePanel');analytics.fire(env('zoneId'),'panelView');if(this._timeElapsedOnPanel<1000){this._timeout1s=timer.setTimeout(()=>{analytics.fire(env('zoneId'),'panelViewSec1');},1000-this._timeElapsedOnPanel);} if(this._timeElapsedOnPanel<3000){this._timeout3s=timer.setTimeout(()=>{analytics.fire(env('zoneId'),'panelViewSec3');},3000-this._timeElapsedOnPanel);}};this._removePanelPixelsTimer=function _removePanelPixelsTimer(){this._timeElapsedOnPanel+=elapsedSinceLastCall('mobilePanel');if(this._timeout1s){timer.clearTimeout(this._timeout1s);} if(this._timeout3s){timer.clearTimeout(this._timeout3s);}};this._isFromMainPage=function _isFromMainPage(){return this.swiper.previousIndex===0;};this._isFromPanel=function _isFromPanel(){return this.swiper.previousIndex===1;};this._initSwiper=function _initSwiper(){const self=this;this.swiper=new sublime.window.Swiper('#'+this.id,{autoHeight:true,effect:'coverflow',coverflowEffect:{slideShadows:false,},iOSEdgeSwipeDetection:true,});this.swiper.on('touchStart',function ontouchStart(){self._startSwiperIndex=this.realIndex;self._touchStartAt=(new Date()).getTime();if(preview.enabled&&device.is.desktop){self.top.tooltip._disableTooltip();} self._panelModeZIndex();hook.call(mskinzHookNames.swiperTouchStart);});this.swiper.on('touchEnd',function ontouchEnd(){self.overlay.fadeOut();const touchEndAt=(new Date()).getTime();const timeDiff=touchEndAt-self._touchStartAt;if(timeDiff=1){self.panelDoubleBuffLayer.show();}else{self.panelDoubleBuffLayer.hide();}});};} createNamespace('sublime.display.mobile.panel2.mskinz');sublime.display.mobile.panel2.mskinz.adIsReady=sublime.display.mobile.panel2.adIsReady;sublime.display.mobile.panel2.mskinz.render=sublime.display.mobile.panel2.render;createNamespace('sublime.display.mobile.panel2.mskinzVideo');const pixelsMskinzVideo={videoQ0:{inherit:'_videoQuartile',qs:{e:'q0'},addBrowserDimensions:true,addPageHeightDimension:true,},videoQ1:{inherit:'_videoQuartile',qs:{e:'q1'},addBrowserDimensions:true,addPageHeightDimension:true,},videoQ2:{inherit:'_videoQuartile',qs:{e:'q2'},addBrowserDimensions:true,addPageHeightDimension:true,},videoQ3:{inherit:'_videoQuartile',qs:{e:'q3'},addBrowserDimensions:true,addPageHeightDimension:true,},videoQ4:{inherit:'_videoQuartile',qs:{e:'q4'},addBrowserDimensions:true,addPageHeightDimension:true,},complete:{inherit:'_commonSkinz',qs:{e:'complete'}},mute:{inherit:'_commonSkinz',qs:{e:'mute'}},unmute:{inherit:'_commonSkinz',qs:{e:'unmute'}},rewind:{inherit:'_commonSkinz',qs:{e:'rewind'}},pause:{inherit:'_commonSkinz',qs:{e:'pause'}},resume:{inherit:'_commonSkinz',qs:{e:'resume'}},creativeView:{inherit:'_commonSkinz',qs:{e:'creativeView'}},videoStartedLoading:{inherit:'_commonSkinz',qs:{e:'vsl'}},videoCanplaythrough:{inherit:'_commonSkinz',qs:{e:'dicpt'}},videoLoadeddata:{inherit:'_commonSkinz',qs:{e:'dild'}},videoPlaying:{inherit:'_commonSkinz',qs:{e:'dip'}},};sublime.display.mobile.panel2.mskinzVideo.adIsReady=(ad)=>(sublime.display.mobile.panel2.adIsReady(ad)&&Object.prototype.hasOwnProperty.call(ad.mobile_setup.top,'video'));sublime.display.mobile.panel2.mskinzVideo.render=(ad)=>new sublime.Promise((resolve)=>{analytics.setPixels(env('zoneId'),pixelsMskinzVideo);sublime.display.mobile.panel2.render(MskinzVideo.setDefaultParams(ad));hook.register({namespace:sublime.display.mobile.panel2.hookNames.swiperCreated,once:true,callback(){sublime.display.mobile.panel2.mskinzVideo=MskinzVideo.create(ad);resolve({container:sublime.display.mobile.panel2.mskinzVideo._videoContainer,video:sublime.display.mobile.panel2.mskinzVideo.video,});},});});MskinzVideo.setDefaultParams=(ad)=>{ad.mobile_setup.top.supportTopClose=typeof ad.mobile_setup.top.supportTopClose==='undefined'?1:ad.mobile_setup.top.supportTopClose;ad.mobile_setup.top.showPanelWhenClicked=typeof ad.mobile_setup.top.showPanelWhenClicked==='undefined'?1:ad.mobile_setup.top.showPanelWhenClicked;ad.mobile_setup.top.tooltipType=typeof ad.mobile_setup.top.tooltipType==='undefined'?4:ad.mobile_setup.top.tooltipType;return ad;};MskinzVideo.create=(ad)=>(new MskinzVideo())._init(ad.mobile_setup.top.video);function MskinzVideo(){this._videoContainer=null;this._progress=null;this._progressBar=null;this._muteButton=null;this.video=null;this.videoSize=null;this._isVideoFinished=false;this._hasBeenClicked=false;this._hookNames=merge(sublime.display.mobile.panel2.hookNames,{clickMuteBtn:'event.mobile.clickMuteBtn',});this._triggeredQuartiles=[];this._quartileNames=['start','firstQuartile','midpoint','thirdQuartile','complete'];this._playControls=null;this._swiperContainer=sublime.display.mobile.panel2.swiperContainer;this._top=this._swiperContainer.top;this._panel=this._swiperContainer.panel;this._init=function _init(videoSource){this._reconfigSwiperContainer();this._createVideoContainer();this._createVideoProgress();this._videoContainer.appendChild(this._progress);this._createVideoProgressBar();this._progress.appendChild(this._progressBar);this._createMuteButton();this._videoContainer.appendChild(this._muteButton);this._createPlayControls();this.video=this._createVideo(videoSource);this._videoContainer.insertBefore(this.video,this._videoContainer.firstChild);this._resizeVideo();this._addEvents();this._addVideoToMainPage();this._startVideo();return this;};this._resizeVideo=function _resizeVideo(){const self=this;hook.register({namespace:self._hookNames.topImageLoaded,callback(){self.videoSize=self._getVideoSize();if(!self.videoSize){self.video.height=self._top.getMediaHeight();return;} self.video.height=self.videoSize.top.height;self.video.width=self.videoSize.top.width;},once:true,});};this._getVideoSize=function _getVideoSize(){if(!sublime.creativeAd.video_resolution){log.info('Mskinz2 Video > No video resolution for this creative');return null;} const videoResolution=sublime.creativeAd.video_resolution.split('x');const videoWidth=pInt(videoResolution[0]);const videoHeight=pInt(videoResolution[1]);if(!isNum(videoWidth)||!isNum(videoHeight)){log.error('Mskinz2 Video > Unable to parse videoWidth or videoHeight',videoResolution);return null;} const screenWidth=sublime.window.innerWidth;const zoneTop=this._top.getMediaHeight();const sizes={top:{width:(videoWidth*zoneTop)/ videoHeight,height:zoneTop,},panel:{width:screenWidth,height:(screenWidth*videoHeight)/ videoWidth,},};if(sizes.top.width>screenWidth){sizes.top.width=screenWidth;sizes.top.height=(screenWidth*videoHeight)/ videoWidth;} return sizes;};this._createVideoContainer=function _createVideoContainer(){this._videoContainer=displayRoot.get().ownerDocument.createElement('div');this._videoContainer.id='sublime-mobile-video-container';this._videoContainer.style.zIndex='2';};this._createVideoProgress=function _createVideoProgress(){this._progress=displayRoot.get().ownerDocument.createElement('div');this._progress.className='sublime-mobile-loading-bar';};this._createVideoProgressBar=function _createVideoProgressBar(){this._progressBar=displayRoot.get().ownerDocument.createElement('div');this._progressBar.className='sublime-mobile-loading-bar-progress';};this.setMuteVideo=function setMuteVideo(isMuted){this.video.muted=isMuted;this._muteButton.className='sublime-mobile-video-mute '+(this.video.muted?'muteOn':'muteOff');};this._createMuteButton=function _createMuteButton(){this._muteButton=displayRoot.get().ownerDocument.createElement('div');this._muteButton.className='sublime-mobile-video-mute muteOn mute-animation';hook.register(this._hookNames.clickMuteBtn,this.setMuteVideo.bind(this));this._muteButton.onclick=(e)=>{e.stopPropagation();e.preventDefault();hook.call(this._hookNames.clickMuteBtn,!this.video.muted);this._muteButton.classList.remove('mute-animation');if(this.video.muted){analytics.fire(env('zoneId'),'mute');}else{analytics.fire(env('zoneId'),'unmute');}};};this._createVideo=function _createVideo(videoSource){const document=displayRoot.get().ownerDocument;let video=document.getElementById(DISPLAY_ELEMENTS.VIDEO_ID.mobile);if(!video){video=document.createElement('video');video.id=DISPLAY_ELEMENTS.VIDEO_ID.mobile;} video.controls=false;video.muted=true;video.loop=false;video.preload='auto';video.style.display='';video.setAttribute('playsinline','playsinline');video.setAttribute('muted','muted');if(videoSource){video.src=videoSource;} return video;};this._reconfigSwiperContainer=function _reconfigSwiperContainer(){this._top.isSupportParallax=true;this._top.resetParallax=()=>{this._top.isSupportParallax=true;};hook.register({namespace:this._hookNames.topCloseButtonClicked,callback:this._pauseVideo.bind(this),});hook.register({namespace:this._hookNames.openPanel,callback:this._activePanelMode.bind(this),});hook.register({namespace:this._hookNames.closePanel,callback:this._activeMainPageMode.bind(this),});};this._addVideoToMainPage=function _addVideoToMainPage(){if(this._top.tooltip.tooltipType===4){this._top.tooltip.childElement.appendChild(this._videoContainer);}else{this._top.element.appendChild(this._videoContainer);}};this._createPlayControls=function _createPlayControls(){const self=this;const d=displayRoot.get().ownerDocument;const controls=d.createElement('div');controls.id='sublime-mobile-video-play-controls';controls.className='sublime-mobile-video-play-controls';controls.classList.add('sublime-hidden');const playButton=d.createElement('div');playButton.id='sublime-mobile-video-buttons-play';playButton.className='play';controls.appendChild(playButton);const pauseButtonPulseCircle=d.createElement('div');pauseButtonPulseCircle.id='play-video-pulsar';controls.appendChild(pauseButtonPulseCircle);const vidOverlay=d.createElement('div');vidOverlay.id='sublime-mobile-video-overlay';vidOverlay.classList.add('sublime-hidden');this._videoContainer.appendChild(vidOverlay);this._playControls={overlay:vidOverlay,controls:controls,};controls.addEventListener('click',(e)=>{e.stopPropagation();e.preventDefault();self._playVideo();});this._videoContainer.appendChild(controls);};this._activeMainPageMode=function _activeMainPageMode(){sublime.display.mobile.panel2.swiperContainer.element.classList.remove('sublime-video-panel-open');this._videoContainer.style.top=0;this._videoContainer.style.height=this._top.getMediaHeight()+'px';if(this.videoSize){this.video.height=this.videoSize.top.height;this.video.width=this.videoSize.top.width;}else{this.video.removeAttribute('width');this.video.height=this._top.getMediaHeight();} if(this.video.isVpaid&&!this.video.vpaid.isDeleted){this.video.vpaid.resizeAd(this.video.offsetWidth,this.video.offsetHeight,'normal');this.video.style.width='';this.video.style.height='';} if(this._isVideoFinished){return;} if(this._top.isSupportSticky||this.isOnTopOfPage()){this._playVideo();}};this._activePanelMode=function _activePanelMode(){sublime.display.mobile.panel2.swiperContainer.element.classList.add('sublime-video-panel-open');this._videoContainer.style.top='6.4vh';this._videoContainer.style.height='';if(this.videoSize){this.video.height=this.videoSize.panel.height;this.video.width=this.videoSize.panel.width;}else{this.video.removeAttribute('height');this.video.width=sublime.window.innerWidth;} if(this.video.isVpaid&&!this.video.vpaid.isDeleted){this.video.vpaid.resizeAd(this.video.offsetWidth,this.video.offsetHeight,'normal');this.video.style.width='';this.video.style.height='';}};this._startVideo=function _startVideo(){if(this.video.isVpaid&&!this.video.vpaid.isDeleted){return this.video.vpaid.startAd();} this.video.play();return undefined;};this._playVideo=function _playVideo(){if(this.video.isVpaid&&!this.video.vpaid.isDeleted){return this.video.vpaid.resumeAd();} this.video.play();return undefined;};this._pauseVideo=function _pauseVideo(){if(this.video.isVpaid&&!this.video.vpaid.isDeleted){return this.video.vpaid.pauseAd();} this.video.pause();return undefined;};this.computeMetrics=function computeMetrics(video){if(!isDefined(video.currentTime)||!isDefined(video.duration)||!isNum(video.currentTime)||!isNum(video.duration)){log.warn('video.currentTime or video.duration is not defined, no metrics sent.');return;} if(video.paused&&video.duration!==video.currentTime){log.warn('Video is paused, no metrics sent.');return;} const quartile=this.getQuartile(video.currentTime,video.duration);if(quartile>4||this._triggeredQuartiles[quartile]){return;} for(let index=0;index{self._playControls.overlay.classList.remove('sublime-hidden');self._playControls.controls.classList.remove('sublime-hidden');});hook.register(sublime.vpaid.hookNames.adPlaying,()=>{self._playControls.overlay.classList.add('sublime-hidden');self._playControls.controls.classList.add('sublime-hidden');});hook.register(sublime.vpaid.hookNames.adClickThru,()=>{if(self._swiperContainer.isMainPage()&&sublime.creativeAd.mobile_setup.top.showPanelWhenClicked){hook.call(self._hookNames.openPanel);}else{sublime.display.openTargetUrl({},sublime.creativeAd,sublime.ad.url);}});},});hook.register(this._hookNames.afterOpenPanel,()=>{analytics.fire(env('zoneId'),'creativeView');});this.video.addEventListener('loadstart',()=>{analytics.fire(env('zoneId'),'videoStartedLoading');});this.video.addEventListener('canplaythrough',()=>{analytics.fire(env('zoneId'),'videoCanplaythrough');});this.video.addEventListener('playing',()=>{analytics.fire(env('zoneId'),'videoPlaying');});this.video.addEventListener('loadeddata',()=>{analytics.fire(env('zoneId'),'videoLoadeddata');self._top.video=self.video;});let previousTime=0;let isRewinding=false;this.video.addEventListener('timeupdate',()=>{if(self.vpaid&&!self.vpaid.isDeleted){return;} if(!isRewinding&&previousTime>self.video.currentTime){analytics.fire(env('zoneId'),'rewind');isRewinding=true;setTimeout(()=>{isRewinding=false;},1000);} previousTime=self.video.currentTime;const percentage=Math.abs((((self.video.duration-self.video.currentTime)/ self.video.duration)*100)-100);self._progressBar.style.width=percentage+'%';sublime.creativeAd.video_duration=parseInt(self.video.duration,10);self.computeMetrics(self.video);});this.video.addEventListener('ended',()=>{self._isVideoFinished=true;analytics.fire(env('zoneId'),'complete');});sublime.window.addEventListener('scroll',()=>{if(self.isOnTopOfPage()){if(!self._isVideoFinished&&!self._hasBeenClicked&&(!!self.video.paused||!(self.video.isVpaid&&!self.video.vpaid.isPaused))){self._playVideo();}}else if(self._swiperContainer.isMainPage()&&!self._top.isSupportSticky&&(!!self.video.paused||(self.video.isVpaid&&!self.video.vpaid.isPaused))){self._pauseVideo();}});};this.getQuartile=function getQuartile(currentTime,duration){const quartileLength=duration / 4;const unroundedQuartile=currentTime / quartileLength;return Math.floor(unroundedQuartile);};this.isOnTopOfPage=function isOnTopOfPage(){return sublime.window.pageYOffset<=this._top.getMediaHeight()*0.5;};} createNamespace('sublime.display.mobile.panel2.mskinzSimple');const pixelsMskinzVideoSimple={fullscreen:{inherit:'_commonSkinz',qs:{e:'fullscreen'}},};sublime.display.mobile.panel2.mskinzSimple.adIsReady=function displayMobilePanel2SimpleAdIsReady(ad){const isReadableAd=isUrl(ad.url)&&hasProperty(ad,'mobile_setup.top.video');const isExternalVPAID=ad.vpaid&&ad.isExternal;return isReadableAd||isExternalVPAID;};sublime.display.mobile.panel2.mskinzSimple.render=(ad)=>{analytics.setPixels(env('zoneId'),pixelsMskinzVideoSimple);return sublime.display.mobile.panel2.mskinzVideo.render(ad).then((player)=>{hook.register({namespace:sublime.display.mobile.panel2.hookNames.swiperCreated,once:true,callback(){MskinzSimple.create(ad);},});return player;});};MskinzSimple.create=(ad)=>(new MskinzSimple())._init(ad.mobile_setup.top.video);function MskinzSimple(){this._swiperContainer=sublime.display.mobile.panel2.swiperContainer;this._mskinzVideo=sublime.display.mobile.panel2.mskinzVideo;this._hookNames=merge(sublime.display.mobile.panel2.hookNames,{});this._video=this._mskinzVideo.video;this._panel=this._swiperContainer.panel.element;this._swiper=this._swiperContainer.element;this._bottom=this._swiperContainer.bottom.element;this._videoBackground=null;this._init=function _init(){this._swiper.classList.add('mksinz-simple');this._addEvents();this._hideBottom();};this._hideBottom=function _hideBottom(){hook.register(this._hookNames.bottomReady,()=>{sublime.display.mobile.panel2.swiperContainer.bottom.disable=true;this._bottom.classList.add('sublime-video-bottom-hidden');});};this._requestFullscreen=(ele)=>{if(ele.requestFullscreen){ele.requestFullscreen();}else if(ele.webkitRequestFullscreen){ele.webkitRequestFullscreen();}else if(ele.mozRequestFullScreen){ele.mozRequestFullScreen();}else if(ele.msRequestFullscreen){ele.msRequestFullscreen();}else{console.log('Fullscreen API is not supported.');}};this._addEvents=function _addEvents(){this._video.addEventListener('play',()=>{if(this._videoBackground){this._videoBackground.play().catch(()=>{log.error('Cannot play background video');});}});this._video.addEventListener('pause',()=>{if(this._videoBackground){this._videoBackground.pause();}});this._video.addEventListener('loadeddata',()=>{this._createBackground();this._syncVideos();});};this._syncVideos=function _syncVideos(){setInterval(()=>{if(Math.abs(this._videoBackground.currentTime-this._video.currentTime)>=0.1){this._videoBackground.currentTime=this._video.currentTime;} if(this._videoBackground.paused!==this._video.paused){if(this._videoBackground.paused){this._videoBackground.play();}else{this._videoBackground.pause();}} if(this._videoBackground.src!==this._video.src){this._videoBackground.src=this._video.src;}},500);};this._createBackground=function _createBackground(){this._videoBackground=displayRoot.get().ownerDocument.createElement('video');this._videoBackground.src=this._video.src;this._videoBackground.autoplay=this._video.autoplay;this._videoBackground.muted=true;this._videoBackground.setAttribute('playsinline',true);this._videoBackground.loop=this._video.loop;this._videoBackground.id='sublime-mobile-video-bg';this._videoBackground.classList.add('sublime-hidden');this._panel.appendChild(this._videoBackground);hook.register({namespace:this._hookNames.closePanel,callback:()=>{this._videoBackground.classList.add('sublime-hidden');},});hook.register({namespace:this._hookNames.swiperTouchCancel,callback:()=>{this._videoBackground.classList.add('sublime-hidden');},});hook.register({namespace:this._hookNames.openPanel,callback:()=>{this._videoBackground.classList.remove('sublime-hidden');},});hook.register({namespace:this._hookNames.swiperTouchStart,callback:()=>{this._videoBackground.classList.remove('sublime-hidden');},});};} createNamespace('sublime.display.mobile.panel');let orientation;let creativeAd={};var components={};let isOpened;let isOpening;let percentX;let percentY;let touchStartX=null;let touchStartY=null;let touchCurrentX=0;let touchCurrentY=0;let touchDeltaX=0;let touchDeltaY=0;let startPercentX=0;let timeElapsedOnPanel=0;let timeout1s;let timeout3s;let timeoutScroll;let svgArrowHeight;let hideIndicatorTimeout;let lastScrollPosition=0;let componentBottomHeight;let noSwipeElements=[];let canSwipe=true;let isOnPanel=false;let isTopAdClosed=false;let topSticky;sublime.display.mobile.panel.isOnPanel=()=>isOnPanel;sublime.display.mobile.panel.isTopAdClosed=()=>isTopAdClosed;sublime.display.mobile.panel.isOnTopOfPage=()=>{const yPos=sublime.window.pageYOffset;return yPos<=components.top.clientHeight*0.5;};sublime.display.mobile.panel.adIsReady=(ad)=>{if(isEmpty(ad)||isEmpty(ad.mobile_setup)){return false;} if(!ad.isRedirect&&!isUrl(ad.url)){return false;} const elementToTest=['top','bottom','panel'];let isReady=true;elementToTest.forEach((element)=>{const hasElement=!!(ad.mobile_setup[element]&&ad.mobile_setup[element].key&&isUrl(ad.mobile_setup[element].src)&&ad.mobile_setup[element].type);isReady=isReady&&hasElement;});return isReady;};sublime.display.mobile.panel.render=(ad)=>{hook.register('dom.interactive',()=>{creativeAd=ad;const zone=env('zone');topSticky=sublime.display.mobile.panel.getTopSticky(zone.mobile_setup.footer_fixed,ad.mobile_setup.top_sticky);displayPanel();});};sublime.display.mobile.panel.getTopSticky=(footer,top)=>{const f=isDefined(footer)?footer:true;const t=isDefined(top)?top:true;const adTop=!!Number(f)&&!!Number(t);return isDefined(topSticky)?topSticky:adTop;};function displayPanel(){applyOrientationClassPanel();checkViewPortMetaPanel();log.info('sublime.display.mobile.panel');analytics.setPixels(env('zoneId'),pixelsPanel);setPixelSwipeMacroPanel();if(!isPortrait()){return;} hook.call('step.impression.before');sublime.display.addCreativeContainer();addMobileCss();sublime.display.mobile.panel.setupZoneAd();analytics.fire(env('zoneId'),'topView');setUpPanel();hook.call('step.impression.after');} function addTopCloseButton(){const closeButton=document.createElement('div');closeButton.className='sublime-mobile-top-close sublime-hidden';closeButton.innerHTML='';components.close_button=closeButton;closeButton.addEventListener('click',(e)=>{e.stopPropagation();e.preventDefault();isTopAdClosed=true;const topContainer=components.top;const yPos=sublime.window.pageYOffset;if(yPos>topContainer.style.height){topContainer.style.left=0;}else{topContainer.style.left=topContainer.clientWidth+'px';} timer.setTimeout(()=>{closeButton.classList.add('sublime-hidden');topContainer.classList.remove('sublime-top-fixed');components.arrowContainer.classList.remove('sublime-top-fixed');},550);});components.top.appendChild(closeButton);return closeButton;} sublime.display.mobile.panel.openClosePanel=(action)=>{const node=displayRoot.get();node.classList.add('sublime-transition');moveArrow();timer.setTimeout(()=>{node.classList.remove('sublime-transition');},200);if(action==='close'){hook.call('event.mobile.closePanel');}else{hook.call('event.mobile.openPanel');}};sublime.display.mobile.panel.setupZoneAd=()=>{hook.call('step.setupZoneAd.before');if(sublime.zone.mobilecss){addCssToDisplayRootDocument(sublime.zone.mobilecss);} if(sublime.zone.mobilejs){applyJs(sublime.zone.mobilejs);} if(creativeAd.mobile_setup.css){addCssToDisplayRootDocument(creativeAd.mobile_setup.css);} if(creativeAd.mobile_setup.js){applyJs(sublime.ad.mobile_setup.js);} if(creativeAd.html){creativeAd.html=sublime.macros.replace(creativeAd.html,creativeAd);} hook.call('step.setupZoneAd.after');};sublime.display.mobile.panel.moveBottom=(selector,positionInside=false)=>{const root=displayRoot.get();if(!selector){root.insertBefore(components.bottom,root.lastChild);hook.call('step.mobile.bottomReady');return;} const el=root.ownerDocument.querySelector(selector);if(!el){log.warn('Mobile : no element in moveBottom');return;} if(positionInside){el.appendChild(components.bottom);}else{el.parentNode.insertBefore(components.bottom,el.nextSibling);} hook.call('step.mobile.bottomReady');};sublime.display.mobile.panel.isArrow=(element)=>element.id==='sublime-mobile-panel-arrow'||element.id==='pathIdD';sublime.display.mobile.panel.getComponent=(componentKey)=>components[componentKey];sublime.display.mobile.panel.getComponents=()=>components;sublime.display.mobile.panel.setTopSticky=(sticky)=>{topSticky=sticky;};sublime.display.mobile.panel.setNoSwipeElements=(elements)=>{if(!isArray(elements)){log.warn('Set no swipe : elements must be an array');return;} noSwipeElements=elements;};function checkViewPortMetaPanel(){const document=displayRoot.get().ownerDocument;let viewport=document.querySelector('meta[name="viewport"]');if(!viewport){viewport=document.createElement('meta');viewport.id='sublime-viewport';viewport.name='viewport';document.querySelector('head').appendChild(viewport);} viewport.content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0';} function computeOrientation(){orientation=(sublime.window.innerHeight{closePanel();};} function setUpPanel(){const document=displayRoot.get().ownerDocument;components.top=appendComponentTop(creativeAd.mobile_setup.top);components.panel=appendComponentPanel(creativeAd.mobile_setup.panel);components.panel.style.top=sublime.window.scrollY+'px';components.bottom=buildComponentBottom(creativeAd.mobile_setup.bottom);components.arrow=appendArrow(sublime.display.getCreativeContainer(),20);components.positionIndicator=appendPositionIndicator();svgArrowHeight=components.arrow.getBBox().height;components.ayadsHtml=document.querySelector('#ayads-html');if(topSticky){addTopCloseButton();components.top.classList.add('sublime-top-fixed');components.topImage.classList.add('sublime-top-fixed');components.arrowContainer.classList.add('sublime-top-fixed');} sublime.display.mobile.panel.moveBottom(sublime.zone.mobile_bottom_selector,sublime.zone.mobile_bottom_append_position);hook.register({namespace:'event.mobile.closePanel',callback:closePanel,multiple:true,});hook.register({namespace:'event.mobile.openPanel',callback:openPanel,multiple:true,});hook.register({namespace:'event.mobile.clickTop',callback:handleTopClick,multiple:true,});hook.register({namespace:'event.mobile.clickBottom',callback:handleBottomClick,multiple:true,});hook.register({namespace:'step.mobile.panelReady',callback:appendIframeInsidePanel,multiple:false,});addWindowEvents();} function setPixelSwipeMacroPanel(){if(!isUrl(creativeAd.swipe_macro)){return;} const pixels={'panelView.swipeMacro':{slot:'panelView.swipeMacro',url:creativeAd.swipe_macro,repeat:3,},};analytics.setPixels(env('zoneId'),pixels);} function addMobileCss(){const css=env('css').mskinz;addCssToDisplayRootDocument(css);} function createComponentContainer(componentKey){const container=displayRoot.get().ownerDocument.createElement('div');container.id='sublime-mobile-'+componentKey+'-container';container.className='sublime-mobile-container';container.style.backgroundColor=creativeAd.color;return container;} function changeComponentBackground(component,container,callback){let mediaHeight=0;container.style.backgroundImage='url(\''+component.src+'\')';const image=new sublime.window.Image();image.src=component.src;image.onload=function onload(){mediaHeight=parseInt((image.height / image.width)*displayRoot.get().clientWidth,10);container.style.backgroundSize='cover';callback.call(this,mediaHeight);};} function appendComponentTop(component){const root=displayRoot.get();const container=createComponentContainer(component.key);const image=root.ownerDocument.createElement('div');image.id='sublime-mobile-top-image';components.topImage=image;changeComponentBackground(component,image,(mediaHeight)=>{container.style.background='transparent';if(!env('zoneUseCLSMobile')){root.style.setProperty('padding-top',mediaHeight+'px');} container.style.height=mediaHeight+'px';container.appendChild(image);sublime.display.getCreativeContainer().appendChild(container);hook.call('step.mobile.topReady');});container.addEventListener('click',()=>{hook.call('event.mobile.clickTop');});return container;} function appendComponentPanel(component){const container=createComponentContainer(component.key);const indicationContainer=createIndicator();changeComponentBackground(component,container,()=>{container.style.height=sublime.window.innerHeight+'px';container.appendChild(indicationContainer);sublime.display.getCreativeContainer().appendChild(container);hook.call('step.mobile.panelReady');});container.onclick=handlePanelClick;return container;} function buildComponentBottom(component){const container=createComponentContainer(component.key);changeComponentBackground(component,container,(mediaHeight)=>{container.style.height=mediaHeight+'px';componentBottomHeight=mediaHeight;});container.addEventListener('click',()=>{hook.call('event.mobile.clickBottom');});return container;} function appendArrow(parentElement,width,arrowAttrs){const document=displayRoot.get().ownerDocument;const defaultWidth=30;const size=width||defaultWidth;const attrs=arrowAttrs||{};const svgNS='http://www.w3.org/2000/svg';const container=document.createElement('div');container.id='sublime-mobile-panel-arrow-container';const svg=document.createElementNS(svgNS,'svg');svg.setAttributeNS(null,'viewBox','0 0 24 37');svg.id='sublime-mobile-panel-arrow';const arrowPath=document.createElementNS(svgNS,'path');arrowPath.setAttributeNS(null,'id','pathIdD');arrowPath.setAttributeNS(null,'d','M17.8,36.8c-1.2,0-2.4-0.5-3.3-1.4L1.3,21.5c-1.7-1.8-1.7-4.5,0-6.3L14.5,1.4c1.7-1.8,4.6-1.9,6.4-0.1 C22.7,3,22.8,5.9,21,7.8L10.9,18.4l10.2,10.7c1.7,1.8,1.7,4.7-0.2,6.5C20,36.4,18.9,36.8,17.8,36.8L17.8,36.8z');addCssToDisplayRootDocument('#sublime-mobile-panel-arrow {width: '+size+'px;}' +'.sublime-panel-opened #sublime-mobile-panel-arrow-container{right: -'+(size+15)+'px;}');Object.keys(attrs).forEach(function each(prop){arrowPath.setAttributeNS(null,prop,attrs[prop]);});svg.appendChild(arrowPath);container.appendChild(svg);parentElement.appendChild(container);components.arrowContainer=container;svg.addEventListener('click',handleArrowClick);return svg;} function createIndicator(){const document=displayRoot.get().ownerDocument;const container=document.createElement('div');container.className='sublime-indicator-container';const p=document.createElement('p');p.className='sublime-indicator-text';p.innerHTML=i18n('swipeBack');container.appendChild(createSwipeBackIcon());container.appendChild(p);return container;} function appendPositionIndicator(){const document=displayRoot.get().ownerDocument;const block=document.createElement('div');block.id='sublime-position-indicator-block';const container=document.createElement('div');container.id='sublime-position-indicator-container';const positions=['left','right'];positions.forEach((value)=>{const indicator=document.createElement('div');indicator.id='sublime-position-indicator-'+value;indicator.className='sublime-position-indicator';container.appendChild(indicator);});block.appendChild(container);sublime.display.getCreativeContainer().appendChild(block);return block;} function createSwipeBackIcon(){const document=displayRoot.get().ownerDocument;const svgNS='http://www.w3.org/2000/svg';const svg=document.createElementNS(svgNS,'svg');svg.setAttributeNS(null,'viewBox','0 0 178 220');svg.id='sublime-mobile-panel-swipe-icon';const arrowPath=document.createElementNS(svgNS,'path');arrowPath.setAttributeNS(null,'id','icon-arrow-swipe');arrowPath.setAttributeNS(null,'d','M78.7,45.2h70.2c0.1,0,0.1,0.1,0,0.1l-15.1,15.1c-2.9,2.9-3.1,7.9-0.1,10.7c1.4,1.3,3.1,1.9,4.9,1.9c1.8,0,3.7-0.7,5.1-2.1 l27-26.9c2.8-2.8,2.8-7.4,0-10.2L143,6.2c-3-3-7.9-2.8-10.6,0.5c-2.4,2.9-2,7.3,0.7,10l14,14v0.1h-68c-3.8,0-7.2,2.8-7.6,6.6 C71.1,41.7,74.5,45.2,78.7,45.2L78.7,45.2z');const handPath=document.createElementNS(svgNS,'path');handPath.setAttributeNS(null,'id','icon-hand-swipe');handPath.setAttributeNS(null,'d','M162.7,115.9c-3.8-22.9-18.6-27-25.6-27.6c-5.3-6.9-12.9-10.7-21.6-10.7c-1.9,0-3.8,0.2-5.7,0.5c-5.2-6.2-12.3-9.5-20.4-9.5 c-6.1,0-11.5,1.9-15.2,4.1L59,25C55.9,15.1,47.7,8.9,37.6,8.9l0,0c-7.6,0-14.8,3.6-19.1,9.6c-4.2,5.8-5.3,13-3,20.2L34.6,99 c-2.7,1.6-5.1,3.7-7.1,6.2c-3.9,4.9-6.3,11.5-7,19.4c-1.1,11.8,2.8,24.9,11.6,39.1c5.9,9.5,12.5,17,15.2,19.8l9,21.1 c2.2,5.2,7.2,8.4,12.8,8.4H129c6.8,0,12.6-4.8,13.8-11.5c0-0.2,0-0.3,0.1-0.4l2.5-21c0.1-0.3,0.3-0.6,0.4-0.9 C159.1,148.5,164.7,127.8,162.7,115.9L162.7,115.9z M136.2,176.9c-0.1,0.3-0.2,0.6-0.3,1l-2.6,21.9c-0.4,2.1-2.2,3.5-4.3,3.5H69.1 c-1.7,0-3.3-0.9-4-2.6l-9.4-22c-0.2-0.5-0.5-0.9-0.9-1.3c-3.9-4-26.9-29.2-24.8-52.1c1.2-13.6,7.8-18,12.3-19.4 c2.3-0.7,3.5-3.2,2.8-5.4L24.6,35.9c-3.2-10.3,5-17.2,13-17.2c5.1,0,10.2,2.8,12.2,9.3l17.6,55.2c0.6,2,2.4,3.1,4.2,3.1 c1.3,0,2.5-0.5,3.4-1.7c0.7-1,1.6-1.9,2.6-2.7c2.3-1.8,6.8-3.7,11.7-3.7c5.1,0,10.5,2,14.5,8.1c0.8,1.3,2.2,2,3.7,2 c0.4,0,0.8-0.1,1.2-0.2c1.7-0.5,4.1-1,6.6-1c4.9,0,10.8,1.8,15.1,8.6c0.8,1.3,2.2,2.1,3.7,2.1h0.1c0.2,0,0.3,0,0.5,0 c5.2,0,15.5,2.3,18.4,19.7C155.9,133.7,138.2,172.2,136.2,176.9L136.2,176.9z');svg.appendChild(handPath);svg.appendChild(arrowPath);return svg;} function addWindowEvents(){sublime.window.addEventListener('orientationchange',applyOrientationClassPanel);sublime.window.addEventListener('resize',handleResize);sublime.window.addEventListener('scroll',handleScroll);sublime.document.body.addEventListener('touchstart',sublime.display.mobile.panel.handleTouchStart);sublime.document.body.addEventListener('touchmove',sublime.display.mobile.panel.handleTouchMove);sublime.document.body.addEventListener('touchend',sublime.display.mobile.panel.handleTouchEnd);hook.register('event.cleanUp',function clearEventListeners(){sublime.window.removeEventListener('orientationchange',applyOrientationClassPanel);sublime.window.removeEventListener('resize',handleResize);sublime.window.removeEventListener('scroll',handleScroll);sublime.document.body.removeEventListener('touchstart',sublime.display.mobile.panel.handleTouchStart);sublime.document.body.removeEventListener('touchmove',sublime.display.mobile.panel.handleTouchMove);sublime.document.body.removeEventListener('touchend',sublime.display.mobile.panel.handleTouchEnd);});} sublime.display.mobile.panel.handleTouchStart=function handleTouchStart(e){if(!canSwipe){return;} if(e.touches&&e.touches.length>1){return;} if(!isPortrait()){return;} for(let i=0,lgt=noSwipeElements.length;i1){return;} if(!isPortrait()){return;} touchCurrentX=(e.touches&&e.touches[0]?e.touches[0].screenX:touchCurrentX)||0;touchCurrentY=(e.touches&&e.touches[0]?e.touches[0].screenY:touchCurrentY)||0;if(!touchCurrentX||!touchCurrentY){return;} let direction;isOpened=node.classList.contains('sublime-panel-opened');isOpening=node.classList.contains('sublime-panel-opening');touchDeltaX=touchCurrentX-touchStartX;touchDeltaY=touchCurrentY-touchStartY;percentY=(touchDeltaY / sublime.window.innerHeight)*100;if(Math.abs(touchDeltaY)>Math.abs(touchDeltaX)){if(isOpened||isOpening){return;} return;} if(node.classList.contains('sublime-scrolling')){return;} node.classList.add('sublime-panel-opening');if(touchDeltaX>0){direction='right';}else{direction='left';} if(direction==='right'&&!isOpened){return;} if(direction==='left'&&isOpened){return;} percentX=(touchDeltaX /(sublime.window.innerWidth))*100;if(Math.abs(percentX)>100){percentX=(direction==='left')?-100:100;} components.positionIndicator.style.top=sublime.window.scrollY+'px';movePanel(percentX);movePositionIndicator(percentX);moveArrow();};sublime.display.mobile.panel.handleTouchEnd=function handleTouchEnd(e){if(Math.abs(touchDeltaY)>Math.abs(touchDeltaX)){openClosePanelChecker();resetTouchVariables();return;} if((percentX===undefined||percentX===null)&&(percentY===undefined||percentY===null)){resetTouchVariables();return;} openClosePanelChecker();resetTouchVariables();e.preventDefault();};function handleResize(){computeOrientation();components.panel.style.height=sublime.window.innerHeight+'px';} function showFooter(param){if(param){components.bottom.style.transform='translate3d(0,0,0)';analytics.fire(env('zoneId'),'bottomView');}else{components.bottom.style.transform='translate3d(0,'+(componentBottomHeight+25)+'px, 0)';}} function handleScroll(){const node=displayRoot.get();if(topSticky){if(sublime.display.mobile.panel.isOnTopOfPage()){components.close_button.classList.add('sublime-hidden');components.top.style.left=0;}else if(!sublime.display.mobile.panel.isOnPanel()&&!sublime.display.mobile.panel.isTopAdClosed()){components.close_button.classList.remove('sublime-hidden');}} components.panel.style.top=sublime.window.scrollY+'px';if(isOpened||isOpening){moveArrow();} const windowHeight=Math.max(sublime.document.body.scrollHeight,sublime.document.body.offsetHeight,sublime.document.body.parentNode.clientHeight);const bottomHeight=components.bottom.clientHeight;const footerFixedClass=components.bottom.classList.contains('sublime-fixed-footer-option');const isViewabilityBoosted=components.bottom.classList.contains('sublime-viewability-behaviour');if(!sublime.zone.mobile_setup){sublime.zone.mobile_setup={};sublime.zone.mobile_setup.footer_fixed=0;} const footerFixed=creativeAd.mobile_setup.footer_fixed&&sublime.zone.mobile_setup.footer_fixed;if(!footerFixedClass&&footerFixed){components.bottom.classList.add('sublime-fixed-footer-option');} if(hideIndicatorTimeout){timer.clearTimeout(hideIndicatorTimeout);hideIndicatorTimeout=null;} if(sublime.window.scrollY>components.top.clientHeight){if(!isOpened||!isOpening){if(!footerFixed){components.positionIndicator.classList.add('hide');}else if(lastScrollPosition-sublime.window.scrollY>50){showFooter(true);components.arrowContainer.classList.remove('hide');components.positionIndicator.classList.remove('hide');}else if(lastScrollPosition-sublime.window.scrollY<0){if(!isViewabilityBoosted){showFooter(false);} components.arrowContainer.classList.add('hide');components.positionIndicator.classList.add('hide');}}else{components.positionIndicator.classList.remove('hide');}}else{components.positionIndicator.classList.remove('hide');components.arrowContainer.classList.remove('hide');if(footerFixed){showFooter(false);} canSwipe=true;} timer.setTimeout(()=>{lastScrollPosition=sublime.window.scrollY;},100);if(windowHeight-bottomHeight{node.classList.remove('sublime-scrolling');},delay);} function handleParallax(){const val=sublime.window.scrollY / 2;components.topImage.style.transform='translate3d(0, '+val+'px, 0)';} function handleArrowClick(e){e.preventDefault();e.stopPropagation();if(displayRoot.get().classList.contains('sublime-panel-opened')){sublime.display.mobile.panel.openClosePanel('close');}else{sublime.display.mobile.panel.openClosePanel('open');}} function handleTopClick(){analytics.fire(env('zoneId'),'click');sublime.window.open(sublime.adServer.clickurlizeAntenna(creativeAd.url,'mct'));} function handleBottomClick(){analytics.fire(env('zoneId'),'click');sublime.window.open(sublime.adServer.clickurlizeAntenna(creativeAd.url,'mcb'));} function handlePanelClick(){analytics.fire(env('zoneId'),'click');hook.call('event.mobile.clickPanel');sublime.window.open(sublime.adServer.clickurlizeAntenna(creativeAd.url,'mcp'));} function appendIframeInsidePanel(){const document=displayRoot.get().ownerDocument;if(isEmpty(creativeAd.html)){return;} if(inArray(creativeAd.html_usage,['iframe-lazy','iframe','cross-domain-iframe'])){const i=document.createElement('iframe');i.id=env('sublime_prefix')+'-rich-media';i.name=env('sublime_prefix')+'-rich-media';i.height='94%';i.width='100%';i.style.borderWidth='0';if(creativeAd.html_usage==='cross-domain-iframe'){i.src=env('sublime_url')+'ad/'+creativeAd.id+'/iframe';components.panel.appendChild(i);return;} if(creativeAd.html_usage==='iframe'){writeToIframeAndAppendToPanelContent(i,creativeAd.html);return;} if(creativeAd.html_usage==='iframe-lazy'){hook.register({namespace:'event.mobile.openPanel',callback:()=>{writeToIframeAndAppendToPanelContent(i,creativeAd.html);},multiple:false,});}}else{sublime.display.writeToContainer(creativeAd.html,components.panel.id);}} function movePanel(x){displayRoot.get().style.transform='translate3d('+(x+startPercentX)+'%, 0, 0)';} function movePositionIndicator(x){components.positionIndicator.style.transform='translate3d('+(-(x+startPercentX))+'%, 0, 0)';} function openClosePanelChecker(){if(isOpened){if(Math.abs(percentX)>30){sublime.display.mobile.panel.openClosePanel('close');}else{sublime.display.mobile.panel.openClosePanel('open');}}else if(isOpening){if(Math.abs(percentX)>30){sublime.display.mobile.panel.openClosePanel('open');}else{sublime.display.mobile.panel.openClosePanel('close');}}} function handlePositionIndicatorsOnPanelClose(){components.positionIndicator.style.transform='translate3d(0, 0, 0)';components.positionIndicator.style.top='0';if(sublime.window.scrollY>components.top.clientHeight){hideIndicatorTimeout=timer.setTimeout(()=>{components.positionIndicator.classList.add('hide');},1000);}} function handlePositionIndicatorsOnPanelOpen(){components.positionIndicator.style.transform='translate3d(100%, 0, 0)';components.positionIndicator.classList.remove('hide');if(hideIndicatorTimeout){timer.clearTimeout(hideIndicatorTimeout);hideIndicatorTimeout=null;}} function closePanel(){const node=displayRoot.get();node.style.transform='translate3d(0, 0, 0)';handlePositionIndicatorsOnPanelClose();recenterArrow();stepMobilePanelClose();node.classList.remove('sublime-panel-opened');node.classList.remove('sublime-panel-opening');isOpened=false;isOpening=false;isOnPanel=false;node.style.transform='';} function openPanel(){const node=displayRoot.get();isOnPanel=true;node.style.transform='translate3d(-100%, 0, 0)';node.classList.add('sublime-panel-opened');handlePositionIndicatorsOnPanelOpen();stepMobilePanelOpen();controlBackButton();} function moveArrow(){components.arrowContainer.style.top=(sublime.window.scrollY+(sublime.window.innerHeight / 2-(svgArrowHeight / 2)))+'px';} function recenterArrow(){components.arrowContainer.style.top=(sublime.window.innerHeight / 2-(svgArrowHeight / 2))+'px';} function stepMobilePanelOpen(){elapsedSinceLastCall('mobilePanel');analytics.fire(env('zoneId'),'panelView');if(timeElapsedOnPanel<1000){timeout1s=timer.setTimeout(()=>{analytics.fire(env('zoneId'),'panelViewSec1');},1000-timeElapsedOnPanel);} if(timeElapsedOnPanel<3000){timeout1s=timer.setTimeout(()=>{analytics.fire(env('zoneId'),'panelViewSec3');},3000-timeElapsedOnPanel);}} function stepMobilePanelClose(){if(!isOpened){return;} timeElapsedOnPanel+=elapsedSinceLastCall('mobilePanel');if(timeout1s){timer.clearTimeout(timeout1s);} if(timeout3s){timer.clearTimeout(timeout3s);}} function resetTouchVariables(){touchStartY=0;touchStartX=0;percentX=null;percentY=null;touchDeltaY=0;touchDeltaX=0;} function writeToIframeAndAppendToPanelContent(i,html){components.panel.appendChild(i);const str=html+'';const iDoc=i.contentDocument;iDoc.open();iDoc.write(`${str}`);iDoc.close();} const pixelsPanel={topView:{inherit:'_commonSkinz',qs:{e:'mtv',},},bottomView:{inherit:'_commonSkinz',qs:{e:'mbv',},},panelView:{inherit:'_commonSkinz',qs:{e:'mp0',},},panelViewSec1:{inherit:'_commonSkinz',qs:{e:'mp1',},},panelViewSec3:{inherit:'_commonSkinz',qs:{e:'mp3',},},};createNamespace('sublime.display.mobile.panel.mskinz');sublime.display.mobile.panel.mskinz.adIsReady=sublime.display.mobile.panel.adIsReady;sublime.display.mobile.panel.mskinz.render=sublime.display.mobile.panel.render;sublime.display.mobile.setNoSwipeElements=sublime.display.mobile.panel.setNoSwipeElements;sublime.display.mobile.getComponent=sublime.display.mobile.panel.getComponent;sublime.display.mobile.moveBottom=sublime.display.mobile.panel.moveBottom;sublime.display.mobile.openClosePanel=sublime.display.mobile.panel.openClosePanel;createNamespace('sublime.display.mobile.panel.mskinzVideo');const VIDEO_CONTAINER='video_container';const VIDEO='video';const CLOSE_BUTTON='close_button';const MUTE_BUTTON='mute_button';const VIDEO_PROGRESS_BAR='video_progress_bar';const quartileNames=['start','firstQuartile','midpoint','thirdQuartile','complete'];var components=[];var triggeredQuartiles=[];let isVideoFinished=false;let hasBeenClicked=false;sublime.display.mobile.panel.mskinzVideo.adIsReady=(ad)=>(sublime.display.mobile.panel.adIsReady(ad)&&Object.prototype.hasOwnProperty.call(ad.mobile_setup.top,'video'));sublime.display.mobile.panel.mskinzVideo.render=(ad)=>{analytics.setPixels(env('zoneId'),videoPixelsMskinzVideo);sublime.display.mobile.panel.setTopSticky(true);sublime.display.mobile.panel.render(ad);components=sublime.display.mobile.panel.getComponents();addMSkinVideoCss();const video=displayMSkinzVideo(ad.mobile_setup.top.video);addEventsMskinzVideo();video.play();};function displayMSkinzVideo(videoSrc){const videoContainer=createVideoContainer();const videoLoading=createVideoLoading();videoContainer.appendChild(videoLoading);const videoProgressBar=createVideoProgressBar();videoLoading.appendChild(videoProgressBar);const muteButton=createVideoMuteButton();videoContainer.appendChild(muteButton);const video=createVideo(videoSrc);videoContainer.insertBefore(video,videoContainer.firstChild);const topContainer=components.top;topContainer.appendChild(videoContainer);return video;} function createVideoContainer(){const videoContainer=document.createElement('div');videoContainer.id='sublime-mobile-video-container';videoContainer.style.height='inherit';videoContainer.style.zIndex='2';components[VIDEO_CONTAINER]=videoContainer;return videoContainer;} function createVideoLoading(){const videoLoading=document.createElement('div');videoLoading.className='sublime-mobile-loading-bar';return videoLoading;} function createVideoProgressBar(){const videoLoadingProgress=document.createElement('div');videoLoadingProgress.className='sublime-mobile-loading-bar-progress';components[VIDEO_PROGRESS_BAR]=videoLoadingProgress;return videoLoadingProgress;} function createVideoMuteButton(){const videoMute=document.createElement('div');videoMute.className='sublime-mobile-video-mute muteOn mute-animation';components[MUTE_BUTTON]=videoMute;videoMute.onclick=(e)=>{e.stopPropagation();e.preventDefault();const video=components[VIDEO];video.muted=!video.muted;videoMute.className='sublime-mobile-video-mute '+(video.muted?'muteOn':'muteOff');videoMute.classList.remove('mute-animation');};return videoMute;} function createVideo(videoSrc){const video=sublime.window.document.createElement('video');video.id=DISPLAY_ELEMENTS.VIDEO_ID.mobile;video.src=videoSrc;video.controls=false;video.muted=true;video.loop=false;video.preload='auto';video.style.width='inherit';video.style.display='';video.setAttribute('playsinline','playsinline');video.setAttribute('muted','muted');components[VIDEO]=video;video.onclick=()=>{sublime.display.mobile.panel.openClosePanel('open');};const videoLoadingProgress=components[VIDEO_PROGRESS_BAR];video.ontimeupdate=()=>{const percentage=Math.abs((((video.duration-video.currentTime)/ video.duration)*100)-100);videoLoadingProgress.style.width=percentage+'%';sublime.creativeAd.video_duration=parseInt(video.duration,10);computeMetrics(video);};function createPlayControls(){const d=displayRoot.get().ownerDocument;const container=d.getElementById('sublime-mobile-video-container');const controls=d.createElement('div');controls.id='sublime-mobile-video-play-controls';controls.className='sublime-mobile-video-play-controls';const playButton=d.createElement('div');playButton.id='sublime-mobile-video-buttons-play';playButton.className='play';controls.appendChild(playButton);const pauseButtonPulseCircle=d.createElement('div');pauseButtonPulseCircle.id='play-video-pulsar';controls.appendChild(pauseButtonPulseCircle);const vidOverlay=d.createElement('div');vidOverlay.id='sublime-mobile-video-overlay';container.appendChild(vidOverlay);controls.addEventListener('click',(e)=>{e.stopPropagation();e.preventDefault();video.play();d.getElementById('sublime-mobile-video-overlay').remove();d.getElementById('sublime-mobile-video-play-controls').remove();});container.appendChild(controls);} video.onended=()=>{isVideoFinished=true;createPlayControls();};video.addEventListener('canplaythrough',()=>{analytics.fire(env('zoneId'),'videoCanplaythrough');});video.addEventListener('loadeddata',()=>{analytics.fire(env('zoneId'),'videoLoadeddata');});video.addEventListener('playing',()=>{analytics.fire(env('zoneId'),'videoPlaying');});return video;} function removeTopContainerClickEventMskinzVideo(){hook.register({namespace:'event.mobile.clickTop',callback:sublime.noOp,only:true,});} function pauseAndMuteVideo(){hasBeenClicked=true;components[VIDEO].pause();} function addEventsMskinzVideo(){removeTopContainerClickEventMskinzVideo();const videoContainer=components[VIDEO_CONTAINER];const video=components[VIDEO];const topContainer=components.top;hook.register('event.mobile.clickPanel',pauseAndMuteVideo);hook.register('event.mobile.clickBottom',pauseAndMuteVideo);hook.register('event.mobile.openPanel',()=>{components.panel.appendChild(videoContainer);videoContainer.style.height=topContainer.clientHeight+'px';if(!isVideoFinished){video.play();}});hook.register('event.mobile.closePanel',()=>{topContainer.appendChild(videoContainer);components.topImage.style.display='none';videoContainer.style.height='inherit';if(!isVideoFinished){const isVideoClosed=sublime.display.mobile.panel.isTopAdClosed();if(!isVideoClosed||(isVideoClosed&&sublime.display.mobile.panel.isOnTopOfPage())){video.play();}}});components[CLOSE_BUTTON].addEventListener('click',(e)=>{e.stopPropagation();e.preventDefault();components[VIDEO].pause();});sublime.window.addEventListener('scroll',()=>{if(sublime.display.mobile.panel.isOnTopOfPage()){if(!isVideoFinished&&!hasBeenClicked){video.play();}}else if(!sublime.display.mobile.panel.isOnPanel()&&sublime.display.mobile.panel.isTopAdClosed()){video.pause();}});} function getQuartile(currentTime,duration){const quartileLength=duration / 4;const unroundedQuartile=currentTime / quartileLength;return Math.floor(unroundedQuartile);} function computeMetrics(video){if(!isDefined(video.currentTime)||!isDefined(video.duration)||!isNum(video.currentTime)||!isNum(video.duration)){log.warn('video.currentTime or video.duration is not defined, no metrics sent.');return;} if(video.paused&&video.duration!==video.currentTime){log.warn('Video is paused, no metrics sent.');return;} const quartile=getQuartile(video.currentTime,video.duration);if(quartile>4||triggeredQuartiles[quartile]){return;} for(let index=0;index{sublime.display.mobile.panel.setTopSticky(false);sublime.display.mobile.panel.render(ad);addMSkinShopCss();addEvents(ad);};function removeTopContainerClickEvent(){hook.register({namespace:'event.mobile.clickTop',callback:sublime.noOp,only:true,});} function removeBottomContainerClickEvent(){hook.register({namespace:'event.mobile.clickBottom',callback:sublime.noOp,only:true,});} function addEvents(ad){removeSwipeBackClickEvent();removeTopContainerClickEvent();removeBottomContainerClickEvent();hook.register('step.mobile.topReady',()=>{const components=sublime.display.mobile.panel.getComponents();if(hasProperty(ad,'sspResponse.privacy.optout_image_url')&&hasProperty(ad,'sspResponse.privacy.optout_click_url')){const optoutImageUrl=ad.sspResponse.privacy.optout_image_url;const optoutClickUrl=ad.sspResponse.privacy.optout_click_url;appendAdChoice(components.ayadsHtml,optoutImageUrl,optoutClickUrl);appendAdChoice(components.bottom,optoutImageUrl,optoutClickUrl);appendAdChoice(components.panel,optoutImageUrl,optoutClickUrl);} appendProductsList(components.top,ad.shopData,'top');appendProductsList(components.bottom,ad.shopData,'bottom');});hook.register('event.mobile.openPanel',()=>{if(isPanelMskinzShopFirstOpen){isPanelMskinzShopFirstOpen=false;createPanelIframe(ad.shopData);}});} function removeSwipeBackClickEvent(){const panel=sublime.display.mobile.panel.getComponent('panel');panel.onclick=()=>{sublime.display.mobile.panel.openClosePanel('close');};} function createPanelIframe(shopData){const iframe=sublime.document.createElement('iframe');iframe.id='sublime-iframe-criteo';iframe.setAttribute('frameborder','0');iframe.scrolling='no';iframe.width='1';iframe.height='1';iframe.style.cssText='border: 0px; width: 100%; height: calc(100% - 6vh); margin: 0px auto; display: block;';const iframeHtml='';const panel=sublime.display.mobile.panel.getComponent('panel');panel.appendChild(iframe);iframe.contentWindow.document.open();iframe.contentWindow.document.write(iframeHtml);iframe.contentWindow.document.close();iframe.contentWindow.document.addEventListener('touchstart',sublime.display.mobile.panel.handleTouchStart);iframe.contentWindow.document.addEventListener('touchmove',sublime.display.mobile.panel.handleTouchMove);iframe.contentWindow.document.addEventListener('touchend',sublime.display.mobile.panel.handleTouchEnd);appendProductsList(iframe.contentWindow.document.body,shopData,'panel');} function bindRedirectUrl(element,url,eventName){element.addEventListener('click',(e)=>{analytics.fire(env('zoneId'),'click');sublime.window.open(sublime.adServer.clickurlizeAntenna(url,eventName));e.stopPropagation();});} function createElement(elementType,cssNames){const element=sublime.window.document.createElement(elementType);if(cssNames instanceof Array){cssNames.forEach((cssName)=>{element.classList.add(cssName);});}else{element.classList.add(cssNames);} return element;} function appendElement(sibling,elementType,cssNames){const element=createElement(elementType,cssNames);sibling.appendChild(element);return element;} function appendAdChoice(sibling,optoutImageUrl,optoutClickUrl){const adChoice=appendElement(sibling,'img','sublime-adchoice');adChoice.style.backgroundImage='url('+optoutImageUrl+')';adChoice.addEventListener('click',()=>{sublime.window.open(optoutClickUrl);});} function appendLogoContainer(parent,url,logo,eventName){const logoDiv=appendElement(parent,'div',['product']);bindRedirectUrl(logoDiv,url,eventName);logoDiv.style='background-image: url('+logo+')';return logoDiv;} function appendDiscoverContainer(sibling,url){const discoverContainer=appendElement(sibling,'div','block-bottom');bindRedirectUrl(discoverContainer,url,'mcp');const discoverPanel=appendElement(discoverContainer,'p','text-bottom');discoverPanel.innerHTML=i18n('shopDiscover');return discoverContainer;} function appendProductDiv(sibling,index,product,eventName){const productDiv=appendElement(sibling,'div',['product','product'+index]);bindRedirectUrl(productDiv,product.url,eventName);const image=appendElement(productDiv,'img','image-product');image.src=product.image;const infoContainer=appendElement(productDiv,'div','product-infos');const name=appendElement(infoContainer,'h4','title');name.innerHTML=product.name;const description=appendElement(infoContainer,'p','description');description.innerHTML=product.description;const price=appendElement(infoContainer,'p','price');price.innerHTML=product.price;return productDiv;} function appendCriteoContainer(sibling){return appendElement(sibling,'div','container-criteo');} function appendProductsContainer(parent){const productsContainer=createElement('div','products-container');parent.insertBefore(productsContainer,parent.lastChild);return productsContainer;} function appendProductsList(sibling,shopData,position){const criteoContainer=appendCriteoContainer(sibling);const eventName='mc'+position.substring(0,1);let limitItems=3;if(position==='panel'){limitItems=5;appendDiscoverContainer(criteoContainer,shopData.url);} const productsContainer=appendProductsContainer(criteoContainer);appendLogoContainer(productsContainer,shopData.url,shopData.logo,eventName);for(let i=0;i{if(isEmpty(ad.html)){log.warn('adServer: Ad is not displayable, empty ad html');return false;} return true;};sublime.display.generic.render=()=>{log.info('sublime.display.generic');hook.call('step.impression.before');const ad=sublime.creativeAd;const zone=sublime.zone;ad.noCookieMatch=zone.block_cookies;sublime.display.generic.setupZoneAd();hook.call('step.impression.after');};sublime.display.generic.setupZoneAd=()=>{hook.call('step.setupZoneAd.before');const ad=sublime.creativeAd;if(isEmpty(ad.html)){return;} let html=ad.html;html=sublime.macros.replace(html);const id=env('sublime_prefix')+'-generic';domWrite(html,{id});hook.call('step.setupZoneAd.after');};const passback={};passback.render=function passbackRender(script,renderType){const divId=env('sublime_prefix')+'-passback';sublime.script_location=sublime.script_location||sublime.originWindow.document.querySelector('script[src*="sac.ayads.co/sublime"]')||sublime.originWindow.document.querySelector('script[src*="ads.ayads.co/ajs.php?zid="]');sublime.compat.toAyads();const globalVar=env('sublime_prefix');const passbackScript=''+script;if(!isDefined(sublime.script_location)||(sublime.script_location.parentElement&&sublime.script_location.parentElement.nodeName==='HEAD')){if(sublime.originWindow.document.body.firstChild){sublime.script_location=sublime.originWindow.document.body.firstChild;}else{sublime.script_location=sublime.originWindow.document.body;}} if(isEmpty(sublime.script_location)){log.error('No script location to render passback: ',sublime.script_location);return null;} const p=sublime.document.querySelectorAll('.ayads-passback');for(let i=0;i=50){timer.clearInterval(interval);} i+=1;},100);} function autoResizeIframeInterval(iframe,withParent){withParent=!!(withParent||0);if(!iframe&&this){iframe=this;} if(iframe.nodeName!=='IFRAME'||!iframe.contentWindow){log.warn("autoResizeIframe: passed argument isn't an iframe",iframe);return;} const iframeDocument=iframe.contentWindow.document.body;iframeDocument.style.margin=0;iframe.style.border='0';let elementWidth;let elementHeight;if(iframeDocument.getBoundingClientRect().height&&iframeDocument.getBoundingClientRect().width){elementWidth=iframeDocument.getBoundingClientRect().width;elementHeight=iframeDocument.getBoundingClientRect().height;}else{elementWidth=iframeDocument.offsetWidth;elementHeight=iframeDocument.offsetHeight;} if(elementWidth<30&&iframeDocument.scrollWidth>30){elementWidth=iframeDocument.scrollWidth;} if(elementHeight<30&&iframeDocument.scrollHeight>30){elementHeight=iframeDocument.scrollHeight;} const isContentDisplayable=elementWidth>30&&elementHeight>30;if(!isContentDisplayable){elementWidth=1;elementHeight=1;} if(withParent){checkIframeDegree(iframe,elementWidth,elementHeight);}else{applyIframeDimension(iframe,elementWidth,elementHeight);}} function checkIframeDegree(iframe,width,height){applyIframeDimension(iframe,width,height);const frameParent=sublime.originWindow.frameElement||false;if(!frameParent){return;} applyIframeDimension(frameParent,width,height);const isAThirdDegreeIframe=frameParent&&(frameParent.id==='ayads-launcher')&&((sublime.originWindow.parent).frameElement);const thirdDegreIframe=isAThirdDegreeIframe?(sublime.originWindow.parent).frameElement:false;if(thirdDegreIframe){applyIframeDimension(thirdDegreIframe,width,height);}} function applyIframeDimension(iframe,width,height){iframe.width=width;iframe.style.width=width+'px';iframe.height=height;iframe.style.height=height+'px';iframe.style.border='0';iframe.style.margin='0 auto';if(iframe.id&&iframe.id.match(/^ayads-passback/)){return;} iframe.style.display='block';} function pullToOriginWindow(iframe,scriptLocation){const element=iframe.contentDocument.body;const elementsToMove=[];let child;let i;for(i=0;i=0;i-=1){const ad=sublime.ads[i];if(!adCollection.matchSupported(device.type,ad.supported_devices)){sublime.ads.splice(i,1);log.info('adCollection: unsupported device ad',merge({},ad));}} return sublime.ads;};adCollection.matchSupported=function adCollectionMatchSupported(placeable){let result=arguments.length>1;for(let i=1;ib.rand){return-1;} if(a.rand{log.info('body is ready');if(preview.enabled){log.info('preview mode enabled, not calling SSPs');preview.run((zonePreview,adPreview)=>{preview.zone=zonePreview;sublime.ad=adPreview;sublime.adServer.serveAd();},()=>{sublime.adServer.passback('preview_passback');});}else{runAds();}});};sublime.adServer.execute=function adServerExecute(){if(preview.enabled){log.warn('sublime.adServer.execute on preview');return;} log.info('sublime.adServer.execute');if(!sublime.adCollection.next()){log.success('Ads exhausted');sublime.adServer.passback('impression');return;} log.info('Process Ad '+sublime.adsProcessed.length+'/'+(sublime.ads.length+sublime.adsProcessed.length)+' : '+sublime.ad.id);log.info('Check capping');if(isCapped('ad','clicks')||isCapped('ad','impressions')){log.warn('Ad '+sublime.ad.id+' capped, continue');sublime.adServer.execute();return;} if(sublime.ad.ssp_name&&!sublime.ad.ssp_id&&!sublime.ad.vast_url&&!sublime.ad.script_url){sublime.adServer.execute();return;} sublime.adServer.serveAd();};sublime.adServer.serveAd=function adServerServeAd(){if(sublime.ad.ssp_name){log.info('Try to serve SSP ad');sublime.ssp.query();}else{log.info('Try to serve direct ad');sublime.adServer.displayAd();}};sublime.adServer.displayAd=function adServerDisplayAd(){log.info('sublime.adServer.displayAd()');log.info('adServer: Ad ID',sublime.ad.id);log.info('adServer: Traffic type',sublime.ad.traffic_type);log.info('adServer: Ad',merge({},sublime.ad));const forceDisplay=Boolean(preview.enabled&&isDefined(preview.params)&&preview.params.forceDisplay);if(!sublime.display.adIsReady(sublime.ad)&&!preview.enabled){sublime.adServer.execute();return;} if(!forceDisplay&&!sublime.display.adIsCompatibleWithDevice(sublime.ad,device.type)){sublime.adServer.execute();return;} sublime.display.render(merge({},sublime.ad));if(hasProperty(sublime,'creativeAd.raid')){log.success('Ad displayed '+sublime.creativeAd.raid);} log.success('Ad trafficked '+sublime.ad.id);};sublime.adServer.passback=function adServerPassback(reason){let passbackReason=reason;if(isEmpty(passbackReason)){passbackReason='no reason given';} log.info('sublime passback '+passbackReason);if(passbackReason==='place'){analytics.fire(env('zoneId'),'place_passback');}else if(passbackReason==='impression'){analytics.fire(env('zoneId'),'impression_passback');}else if(passbackReason==='preview_passback'){log.info('Preview passback',{reason:passbackReason});}else{log.error('Bad reason for passback',{reason:passbackReason});} let passbackScript='';if(device.is.desktop&&zone.passback){passbackScript=zone.passback;}else if(!device.is.desktop&&zone.mobilepassback){passbackScript=zone.mobilepassback;zone.passback_render='iframeResizeParent';} if(!passbackScript){log.info('sublime passback: no passbackScript');return;} analytics.fire(env('zoneId'),'script_passback');log.info('sublime passback: write passbackScript');hook.register('dom.bodyReady',function passbackRenderOnDomReady(){passback.render(passbackScript,zone.passback_render);});};sublime.adServer.clickurlize=function(targetUrl,extraParams){var antennaUrl=sublime.adServer.clickurlizeAntenna(null,null,extraParams);var clickurlizeThroughAntenna=antennaUrl+targetUrl;return clickurlizeThroughAntenna;};sublime.adServer.clickurlizeAyads=function(targetUrl){const ad=sublime.ad;const url=env('ayads_url')+'/click.php';const qs={zid:zone.id,aid:ad.id,ref:sublime.originWindow.btoa(sublime.window.location.href),ua:sublime.originWindow.btoa(navigator.userAgent),t:sublime.timeStart,};if(ad.raid){qs.raid=ad.raid;} if(ad.conversion){qs.conversion='1';} if(ad.ssp_name){qs.isssp='1';qs.at=getAdTypeAyads(ad);} if(isDefined(targetUrl)){qs.url=targetUrl;} if(ad.id===52157){return targetUrl;} return mergeUrl(url,qs);};sublime.adServer.clickurlizeAntenna=function adServerClickurlizeAntenna(targetUrl,event,extraParams){targetUrl=targetUrl||'';const url=env('antenna_url')+'/redirect.php';const pixelAntenna=analytics.handleInheritance({inherit:'_commonSkinz',qs:{z:env('zoneId')},});let qs=mergeUrlQueryString(pixelAntenna.qs,sublime.pixels._commonSkinz.qs,{e:isString(event)&&event.length?event:'c',tse:Date.now(),});if(!isEmpty(extraParams)){qs=mergeUrlQueryString(qs,extraParams);} qs=mergeUrlQueryString(qs,{url3rd:'',});return mergeUrl(url,qs)+targetUrl;};sublime.cookiesBlocked=function(){if(!sublime.ad){return true;} if(isDefined(zone.block_cookies)){return!!zone.block_cookies;} return false;};sublime.adServer.handleAdServing=function(){let asAds=sublime.compat.windowHasAds(sublime.originWindow);if(isEmpty(asAds)){asAds=sublime.compat.windowHasAds(sublime.window);} if(isEmpty(asAds)||!isArray(asAds)){return;} sublime.adCollection.empty();asAds.forEach(function each(asAd){const ad=merge(adDefaultFormat,asAd);sublime.adCollection.add(ad);});};const getAdTypeAyads=function getAdTypeAyads(ad){return ad.type.charAt(0)==='v'?'v':'i';};analytics.setPixels(env('zoneId'),sublime.pixels);sublime.sspRequest=sublime.sspRequest||{};sublime.sspRequest.ssp_response={OK:0,EMPTY_RESPONSE:1,TIMEOUT:2,REQUEST_ERROR:3,PARSE_ERROR:4,PARAMETERS_ERROR:5,PARSE_TIMEOUT:6,UNKNOWN_REQUEST_CALL:7,REQUEST_CANCELLED:8,RESPONSE_DISCARDED:9,UNKNOWN_ERROR:99,};function sspRequestKeywords(){const keywords={};keywords.page_home=String(sublime.window.location.pathname==='/');const pageHeight=getPageHeight();keywords.page_height_num=Math.round(pageHeight / 1000)*1000;const pageWeight=sublime.document.documentElement.outerHTML.length;keywords.page_weight=Math.round(pageWeight / 10000)*10000;if('connection'in window.navigator&&'downlink'in window.navigator.connection){const downlink=window.navigator.connection.downlink;keywords.user_bandwidth=Math.round(downlink*10)/ 10;const pageLoadingSpeed=((pageWeight*8) / 1E6 / downlink)*1000;keywords.page_loading_speed=Math.round(pageLoadingSpeed / 10)*10;} return keywords;} createNamespace('sublime.sspRequest.appnexusRequest');const SSP_NAME_APPNEXUS='appnexus';const SUBLIME_BUYER_ID=[3538,3539,3540];const APPNEXUS_REQUEST_KEYWORD_PAGE_HEIGHT_LARGE=7000;function getUUID(){let e=(new Date()).getTime();const t='xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g,function(t){const n=(e+16*Math.random())%16|0;return e=Math.floor(e / 16),(t==='x'?n:3&n|8).toString(16);});return t;} function getAppnexusNumericKeywords(){const keywords=env('appnexusExtraKeywords')||{};let result={};if(device.type in keywords){result=keywords[device.type];} const state=store.getState();if(hasProperty(state,'sirData.contextualCategories')){const contextualCategories=state.sirData.contextualCategories;Object.keys(contextualCategories).forEach(function sirDataContextualCategoriesEach(id){const relevancy=contextualCategories[id];result['sdta-'+id]=relevancy;});} return result;} function appnexusRequestGetKeywords(options){let output={tag:env('mode'),gc:String(Number(gdpr.getSublimeConsent())),gm:String(Number(gdpr.cmpHasAnswered())),screen:device.screen,};const genericKeywords=sspRequestKeywords();output=merge(output,genericKeywords);const acceptedPlacementTypes=env('zoneAcceptedPlacementTypes')||{};const acceptedPlacementTypesForDevice=acceptedPlacementTypes[device.type]||{};Object.keys(acceptedPlacementTypesForDevice).forEach(function placementTypeLoop(placementType){output[placementType]='true';});if(getPageHeight()>=APPNEXUS_REQUEST_KEYWORD_PAGE_HEIGHT_LARGE){output.page_height='large';} if(options.acceptVideo&&isOptimalHeight(device.type)){output.vskinz='true';} const numericKeywords=getAppnexusNumericKeywords();if(numericKeywords){output=merge(output,numericKeywords);} if(isObject(preview.notPreviewParams.sspKeywords)){log.info('appnexusRequest: found preview keywords',preview.notPreviewParams.sspKeywords);output=merge(output,preview.notPreviewParams.sspKeywords);} const keywords=[];Object.keys(output).forEach(function placementTypeSetupForEach(key){keywords.push({key:key,value:[String(output[key])],});});return keywords;} function appnexusRequestGetDataParams(source,options){const data={member_id:'none',sdk:{source:'ast',version:'0.16.2'},tags:[{ad_types:['banner'],allow_smaller_sizes:false,id:source.id,keywords:[],prebid:true,primary_size:{width:1800,height:1000},sizes:[{width:1800,height:1000}],use_pmt_rule:true,uuid:getUUID(),}],uuid:getUUID(),gdpr_consent:{},};if(!isEmpty(gdpr.getConsentString())){data.gdpr_consent={consent_string:gdpr.getConsentString(),consent_required:gdpr.isActive(),};} if(options.isMobile){data.tags[0].primary_size={width:640,height:300};data.tags[0].sizes=[{width:640,height:300}];} if(options.acceptVideo&&isOptimalHeight(device.type)){data.tags[0].ad_types.push('video');} if(options.acceptVideo){data.tags[0].video={context:4,frameworks:[1,2,],};} if(!isEmpty(gdpr.getConsentString())){data.gdpr_consent={consent_string:gdpr.getConsentString(),consent_required:gdpr.isActive(),};} if(isFeatureEnabled('appnexusSendImpressionId')){data.tags[0].external_imp_id=sublime.uuid.get('p');} data.tags[0].keywords=appnexusRequestGetKeywords(options);return data;} function parseVideoResponse(resolve,response){return resolve({sspName:SSP_NAME_APPNEXUS,success:true,srcType:'vast-string',vast:response.tags[0].ads[0].rtb.video.content,});} function parseImageResponse(resolve,response){let contentSourceType;let contentSource;let adHtml;let impressionPixels;try{contentSourceType=response.tags[0].ads[0].content_source;contentSource=response.tags[0].ads[0][contentSourceType];adHtml=contentSource.banner.content||'';impressionPixels=contentSource.trackers[0].impression_urls||[];}catch(e){return resolve({sspName:SSP_NAME_APPNEXUS,success:false,error_code:sublime.sspRequest.ssp_response.EMPTY_RESPONSE,});} if(!isString(adHtml)||isEmpty(adHtml.trim())){return resolve({sspName:SSP_NAME_APPNEXUS,success:false,error_code:sublime.sspRequest.ssp_response.EMPTY_RESPONSE,});} for(let i=0;i';} return resolve({sspName:SSP_NAME_APPNEXUS,success:true,srcType:'html',html:adHtml,});} function appnexusRequestSuccessCallback(jsonResponse,resolve,source){try{const response=JSON.parse(jsonResponse);const hasBid=!response.tags[0].nobid;const dealId=hasProperty(response,'tags.0.ads.0.deal_id')?response.tags[0].ads[0].deal_id:null;const buyerMemberId=hasProperty(response,'tags.0.ads.0.buyer_member_id')?pInt(response.tags[0].ads[0].buyer_member_id,10):null;const isOpenAuction=isEmpty(dealId)&&!inArray(buyerMemberId,SUBLIME_BUYER_ID);const isVideo=hasProperty(response,'tags.0.ads.0.rtb.video.content');if(!isEmpty(dealId)){sublime.creativeAd.deal_id=dealId;} let monetizationType;if(hasBid&&isOpenAuction){monetizationType='open_auction';}else if(dealId){monetizationType='deal';}else if(isEmpty(dealId)&&inArray(buyerMemberId,SUBLIME_BUYER_ID)){monetizationType='direct';} const extractedData={buyerId:buyerMemberId,dealId:dealId,monetizationType:monetizationType,};store.updateState(appnexusRequestSourceUpdater,merge(source,extractedData));if(device.is.mobile&&isOpenAuction&&!isVideo){log.warn('Open auction from Appnexus blocked : no deal_id in Appnexus response');return resolve({sspName:SSP_NAME_APPNEXUS,success:false,error_code:sublime.sspRequest.ssp_response.PARAMETERS_ERROR,});} if(isVideo){return parseVideoResponse(resolve,response);} return parseImageResponse(resolve,response);}catch(e){return resolve({sspName:SSP_NAME_APPNEXUS,success:false,error_code:sublime.sspRequest.ssp_response.EMPTY_RESPONSE,});}} sublime.sspRequest.appnexusRequest.call=function appnexusRequestCall(source,callOptions){const defaults={async:true,timeout:1000,};const options=merge(defaults,callOptions);const data=appnexusRequestGetDataParams(source,options);return new sublime.Promise(function(resolve){sublime.xhr(source.url,{async:options.async,timeout:options.timeout,withCredentials:env('xhrWithCredentials'),method:'POST',headers:{'Content-Type':'text/plain',},data:data,success:function appnexusCallSuccess(jsonResponse){return appnexusRequestSuccessCallback(jsonResponse,resolve,source);},error:function appnexusCallError(){return resolve({sspName:SSP_NAME_APPNEXUS,success:false,error_code:sublime.sspRequest.ssp_response.REQUEST_ERROR,});},onTimeout:function appnexusCallOnTimeout(){return resolve({sspName:SSP_NAME_APPNEXUS,success:false,error_code:sublime.sspRequest.ssp_response.TIMEOUT,});},});});};const appnexusRequestSourceUpdater=createConnectorUpdater(function sourceInjector(connectorState,augmentedSource){const sspResponse={};if(augmentedSource.buyerId){sspResponse.buyerId=augmentedSource.buyerId;} if(augmentedSource.dealId){sspResponse.dealId=augmentedSource.dealId;} if(augmentedSource.monetizationType){sspResponse.monetizationType=augmentedSource.monetizationType;} return merge({},connectorState,{response:sspResponse,});},function getConnectorID(augmentedSource){return augmentedSource.aid;});createNamespace('sublime.sspRequest.stickyRequest');var SSP_NAME_STICKY="sticky";sublime.sspRequest.stickyRequest.call=function(source,options){var defaults={timeout:1000};if(!options||!isObject(options)){options={};} source.url=sublime.sspRequest.stickyRequest.buildGDPRQuery(source.url);return new sublime.Promise(function(resolve,reject){options=merge(defaults,{errorCallback:function(){return resolve({sspName:SSP_NAME_STICKY,success:false,error_code:sublime.sspRequest.ssp_response.REQUEST_ERROR});},successCallback:function(creativeAd,data){creativeAd.pixels=data.pixels;return sublime.sspRequest.stickyRequest.successCallback(creativeAd,resolve);}},options);sublime.parseVast.query(source.url,options);});};sublime.sspRequest.stickyRequest.buildGDPRQuery=function buildGDPRQuery(baseUrl){if(!isFeatureEnabled('stickyConsent')){return baseUrl;} const baseParams=parseUrlQueryString(baseUrl);const params={};let querySeparator='&';if(gdpr.getConsentString()){params._fw_gdpr_consent=gdpr.getConsentString();}else if(gdpr.isActive()){params._fw_gdpr=1;}else{params._fw_gdpr=0;} if(isEmpty(baseParams)){querySeparator='?';} return baseUrl+querySeparator+buildUrlQueryString(params);};sublime.sspRequest.stickyRequest.successCallback=function(creativeAd,resolve){return resolve({sspName:SSP_NAME_STICKY,success:true,srcType:'creative',creative:creativeAd});};createNamespace('sublime.sspRequest.smartadserverRequest');const SSP_NAME_SMARTADSERVER='smartadserver';const SMART_REQUEST_KEYWORD_PAGE_HEIGHT_LARGE=7000;sublime.sspRequest.smartadserverRequest.call=function smartadserverRequestCall(source,options){return new sublime.Promise(function call(resolve){return callSmart(resolve,source,options);});};function callSmart(resolve,source,options){const sspRequest=sublime.sspRequest;sublime.elapsedSinceLastCall('smartRequest.call');let url=sspRequest.smartadserverRequest.buildUrl(source.url,options);sublime.xhr(url,{timeout:options.timeout||false,async:true,withCredentials:env('xhrWithCredentials'),success:function success(response){const duration=sublime.elapsedSinceLastCall('smartRequest.call');emitter.timer('smartRequest-success',duration);smartadserverRequestSuccessCallback(response,resolve,source);},error:function error(e){const duration=sublime.elapsedSinceLastCall('smartRequest.call');emitter.timer('smartRequest-error',duration);return resolve({sspName:SSP_NAME_SMARTADSERVER,success:false,message:'Error SmartAdServer response',error_code:sspRequest.ssp_response.REQUEST_ERROR,});},onTimeout:function onTimeout(){const duration=sublime.elapsedSinceLastCall('smartRequest.call');emitter.timer('smartRequest-timeout',duration);return resolve({sspName:SSP_NAME_SMARTADSERVER,success:false,message:'Timeout SmartAdServer error',error_code:sspRequest.ssp_response.TIMEOUT,});},});} function getSmartKeywords(){const keywords=env('smartExtraKeywords')||{};const keywordsDevice=keywords[device.type]||{};const smartKeywords=[];Object.keys(keywordsDevice).forEach(function keywordsDeviceForEach(placementType){smartKeywords.push(placementType+'='+keywordsDevice[placementType]);});const state=store.getState();if(hasProperty(state,'sirData.contextualCategories')){Object.keys(state.sirData.contextualCategories).forEach((id)=>smartKeywords.push(`sdta=${id}`));} return smartKeywords;} sublime.sspRequest.smartadserverRequest.buildUrl=function(baseUrl,options){let params=parseUrlQueryString(baseUrl);const tgtMatch=baseUrl.match(/[?&]tgt=([^&]+)/);if(tgtMatch&&tgtMatch[1]){params.tgt=tgtMatch[1].split(';');}else{params.tgt=[];} if(!inArray('json',params.tgt)){params.tgt.push('json');} if(options.acceptVideo&&isOptimalHeight(device.type)){params.tgt.push('vskinz=true');} if(isFeatureEnabled('smartSendImpressionId')){params.tgt.push('puid='+uuid.get('p'));} if(isDefined(params.tmstp)){params.tmstp=Date.now();} if(isFeatureEnabled('smartConsent')){params=sublime.sspRequest.smartadserverRequest.addGDPRQueryParameters(params);} params.pgDomain=encodeURI(window.location.href);params.tgt.push('screen='+device.screen);params.tgt.push(device.screen+'_screen=TRUE');params.tgt.push('tag='+env('mode'));if(getPageHeight()>=SMART_REQUEST_KEYWORD_PAGE_HEIGHT_LARGE){params.tgt.push('page_height=large');} const genericKeywords=sspRequestKeywords();Object.keys(genericKeywords).forEach((keyword)=>{params.tgt.push(keyword+'='+genericKeywords[keyword]);});const acceptedPlacementTypes=env('zoneAcceptedPlacementTypes')||{};const acceptedPlacementTypesForDevice=acceptedPlacementTypes[device.type]||{};Object.keys(acceptedPlacementTypesForDevice).forEach((placementType)=>{params.tgt.push(placementType+'=true');});const smartKeywords=getSmartKeywords();params.tgt=params.tgt.concat(smartKeywords);if(isObject(preview.notPreviewParams.sspKeywords)){log.info('SmartRequest: found preview keywords',preview.notPreviewParams.sspKeywords);Object.keys(preview.notPreviewParams.sspKeywords).forEach((keyword)=>{const value=preview.notPreviewParams.sspKeywords[keyword];params.tgt.push(keyword+'='+value);});} params.tgt=params.tgt.join(';');const urlParts=parseUrl(baseUrl);urlParts.query=buildUrlQueryString(params);return buildUrl(urlParts);};sublime.sspRequest.smartadserverRequest.addGDPRQueryParameters=function smartadserverRequestAddGDPRQueryParameters(params){if(gdpr.isActive()){params.gdpr=1;if(gdpr.getConsentString()){params.gdpr_consent=gdpr.getConsentString();}}else{params.gdpr=0;} if(isFeatureEnabled('smartKeywordConsent')){if(gdpr.cmpHasAnswered()){params.tgt.push('gc='+(gdpr.getSublimeConsent()?1:0));params.tgt.push('gm=1');}else{params.tgt.push('gm=0');}} return params;};sublime.sspRequest.smartadserverRequest.parseJSONResponse=function(json){if(!hasProperty(json,'ad.creativeScriptRAW')){return{sspName:SSP_NAME_SMARTADSERVER,success:false,message:'Query SmartAdServer JSON no ad to display',error_code:sublime.sspRequest.ssp_response.EMPTY_RESPONSE,};} const pixels={};if(json.ad.sendImpPixel&&json.ad.impUrls&&isUrl(json.ad.impUrls)){pixels.impressionSmart={isInternal:false,slot:'impression.smart',url:json.ad.impUrls,};} if(json.ad.vtrPixel&&isUrl(json.ad.vtrPixel)){log.log('Adding smart video completion pixels');const quartiles=['start','firstquartile','midpoint','thirdquartile','complete'];Object.keys(quartiles).forEach(function eachPixel(i){const vtrPixel=mergeUrl(json.ad.vtrPixel,{key:quartiles[i],});pixels['videoQ'+i+'Smart']={isInternal:false,slot:'videoQ'+i+'.smartQ'+i,url:vtrPixel,};});} return{sspName:SSP_NAME_SMARTADSERVER,success:true,srcType:'html',html:json.ad.creativeScriptRAW,json:json,pixels:pixels,};};function smartRequestExtractDataFromJSON(response){const extractedData={};if(hasProperty(response,'json.ad.insertionId')){extractedData.insertionId=response.json.ad.insertionId;} if(hasProperty(response,'json.ad.externaldealId')){extractedData.dealId=response.json.ad.externaldealId;extractedData.monetizationType='deal';}else if(hasProperty(response,'json.ad.buyingType')){const buyingType=response.json.ad.buyingType;if(buyingType==='programmatic'){extractedData.monetizationType='open_auction';}else{extractedData.monetizationType='direct';}} return extractedData;} function smartadserverRequestSuccessCallback(response,resolve,source){if(isEmpty(response)||response==='sas_noad = true;'){return resolve({sspName:SSP_NAME_SMARTADSERVER,success:false,message:'Query SmartAdServer empty response',error_code:sublime.sspRequest.ssp_response.EMPTY_RESPONSE,});} const json=tryParseJson(response);if(json){const HTMLResponse=sublime.sspRequest.smartadserverRequest.parseJSONResponse(json);const extractedData=smartRequestExtractDataFromJSON(HTMLResponse);store.updateState(smartRequestSourceUpdater,merge(source,extractedData));if(isObject(sublime.ad)){sublime.ad.deal_id=extractedData.dealId;sublime.ad.insertion_id=extractedData.insertionId;} return resolve(HTMLResponse);} const vast=tryParseXml(response);if(vast){return resolve({sspName:SSP_NAME_SMARTADSERVER,success:true,srcType:'vast-string',vast:response,});} log.error('smartadserver.queryCallback: parse error',{response:response});return resolve({sspName:SSP_NAME_SMARTADSERVER,success:false,message:'Query SmartAdServer parse error',error_code:sublime.sspRequest.ssp_response.PARSE_ERROR,});} sublime.sspRequest.smartadserverRequest.getDefaultSourceUrl=function getSourceUrl(sspId){const parts=sspId.toString().split('|');const parameters={siteId:pInt(parts[0]),pageId:pInt(parts[1]),formatId:pInt(parts[2]),};const dimensions=getBrowserDimensions();const url='https://www8.smartadserver.com/ac?siteid='+parameters.siteId +'&pgid='+parameters.pageId +'&fmtid='+parameters.formatId +'&visit=M&tmstp='+Date.now() +'&out=json' +'&sh='+dimensions.bh +'&sw='+dimensions.bw;return url;};const smartRequestSourceUpdater=createConnectorUpdater(function sourceInjector(connectorState,augmentedSource){const sspResponse={};if(augmentedSource.dealId){sspResponse.dealId=augmentedSource.dealId;} if(augmentedSource.insertionId){sspResponse.insertionId=augmentedSource.insertionId;} if(augmentedSource.monetizationType){sspResponse.monetizationType=augmentedSource.monetizationType;} return merge({},connectorState,{response:sspResponse,});},function getConnectorID(augmentedSource){return augmentedSource.aid;});createNamespace('sublime.sspRequest.improveRequest');var SSP_NAME_IMPROVE="improve";sublime.sspRequest.improveRequest.buildGDPRQuery=function buildGDPRQuery(baseUrl){if(!isFeatureEnabled('improveConsent')){return baseUrl;} const baseParams=parseUrlQueryString(baseUrl);const params={};let querySeparator='&';if(gdpr.isActive()&&gdpr.getConsentString()){params.GDPR=gdpr.getConsentString();}else if(gdpr.isActive()){params.GDPR='';} if(isEmpty(params)){return baseUrl;} if(isEmpty(baseParams)){querySeparator='?';} return baseUrl+querySeparator+buildUrlQueryString(params);};sublime.sspRequest.improveRequest.call=function(source,options){var defaults={async:true,timeout:1000};if(!options||!isObject(options)){options={};} options=merge(defaults,options);var jsonpParam=sublime.sspRequest.improveRequest.getDataParams(source,options);var url=mergeUrl(source.url,{jsonp:JSON.stringify(jsonpParam)});return new sublime.Promise(function(resolve,reject){sublime.xhr(url,{async:options.async,timeout:options.timeout,withCredentials:env('xhrWithCredentials'),success:function(jsonResponse){return sublime.sspRequest.improveRequest.callSuccessCallback(jsonResponse,resolve);},error:function(){return resolve({sspName:SSP_NAME_IMPROVE,success:false,error_code:sublime.sspRequest.ssp_response.REQUEST_ERROR});},onTimeout:function(){return resolve({sspName:SSP_NAME_IMPROVE,success:false,error_code:sublime.sspRequest.ssp_response.TIMEOUT});}});});};sublime.sspRequest.improveRequest.callSuccessCallback=function(jsonResponse,resolve){try{var response=JSON.parse(jsonResponse);if(!isObject(response)||!isArray(response.bid)||!isObject(response.bid[0])||!isString(response.bid[0].adm)||isEmpty(response.bid[0].adm.trim())){return resolve({sspName:SSP_NAME_IMPROVE,success:false,error_code:sublime.sspRequest.ssp_response.PARSE_ERROR});} var bidResponse=response.bid[0];if(bidResponse.adm.match(/]+src=\\"https?:\\\/\\\/creative\.360yield\.com\\\/file\\\/\d+\\\/1x1\.gif/)){return resolve({sspName:SSP_NAME_IMPROVE,success:false,error_code:sublime.sspRequest.ssp_response.EMPTY_RESPONSE});} var output={sspName:SSP_NAME_IMPROVE,success:true,srcType:'html',html:'',pixels:{}};output.pixels.impressionImprove={slot:'impression.improve',url:bidResponse.nurl};return resolve(output);}catch(e){return resolve({sspName:SSP_NAME_IMPROVE,success:false,error_code:sublime.sspRequest.ssp_response.EMPTY_RESPONSE});}};sublime.sspRequest.improveRequest.getDataParams=function(source,options){const buffer=new Uint32Array(4);const crypto=window.crypto||window.msCrypto;crypto.getRandomValues(buffer);var data={bid_request:{id:multiplyUint32(buffer[0],buffer[1],16).substr(2),secure:1,version:"Sublime-1.0",imp:[{id:multiplyUint32(buffer[2],buffer[3],16).substr(2),pid:source.id,banner:{}}]}};if(isFeatureEnabled('improveConsent')&&gdpr.getConsentString()){data.bid_request.gdpr=gdpr.getConsentString();} return data;};sublime.ssp=sublime.ssp||{};sublime.ssp.callStopwatch=createStopwatch();sublime.ssp.successAndDisplayAd=function(ad,data){log.info('event.ssp.ok',data);const fireSspPixelExtraQs={ssprf:ad.response_format,};if(hasProperty(ad,'vpaid.provider')){fireSspPixelExtraQs.vtpp=ad.vpaid.provider;} store.updateState(sspAdUpdater,merge(ad,{aid:sublime.ad.id,}));if(data.type==='vast'){if(isObject(data.pixels)&&Object.keys(data.pixels).length){analytics.setPixels(env('zoneId'),data.pixels);} if(isDefined(ad.mobile_setup)){ad.type='mobile';ad.creative_type=ad.creative_type||'mobile m-skinz video';}else{ad.type='video';}} sublime.ad=merge(sublime.ad,ad);sublime.ssp.fireSspPixel('sspOk',0,fireSspPixelExtraQs);sublime.adServer.displayAd();};sublime.ssp.errorAndGoNext=function sspErrorAndGoNext(options){const data=merge(options,{'event.ssp.ko':sublime.ad.ssp_name,});if(data.parseScript_response&&(data.parseScript_response in sublime.sspRequest.ssp_response)){data.ssp_response=sublime.sspRequest.ssp_response[data.parseScript_response];} if(data.parseVast_response&&(data.parseVast_response in sublime.sspRequest.ssp_response)){data.ssp_response=sublime.sspRequest.ssp_response[data.parseVast_response];} const sspResponse=data.ssp_response?pInt(data.ssp_response):99;log.warn(data);const extraQS={};if(isObject(data.ad)){store.updateState(sspAdUpdater,merge(data.ad,{aid:sublime.ad.id,}));if(isDefined(data.ad.raid)){extraQS.ra=data.ad.raid;} if(isDefined(data.ad.deal_id)){extraQS.di=data.ad.deal_id;} if(isDefined(data.ad.insertion_id)){extraQS.ii=data.ad.insertion_id;} if(hasProperty(data.ad,'vpaid.provider')){extraQS.vtpp=data.ad.vpaid.provider;}} sublime.ssp.fireSspPixel('sspKo',sspResponse,extraQS);delete sublime.ad.response_format;return sublime.adServer.execute();};const sspAdUpdater=createConnectorUpdater(function sourceInjector(connectorState,ad){const responseData={};if(ad.response_format){responseData.creativeWrapper=ad.response_format;} if(ad.raid){responseData.sublimeCreativeId=ad.raid;} if(ad.buyerId){responseData.buyerId=ad.buyerId;} if(ad.dealId||ad.deal_id){responseData.dealId=ad.dealId||ad.deal_id;} if(ad.insertion_id){responseData.insertionId=ad.insertion_id;} if(ad.monetizationType){responseData.monetizationType=ad.monetizationType;} if(ad.vpaid){responseData.vpaid={adSystem:ad.vpaid.adSystem,mediaFile:ad.vpaid.mediaFile,provider:ad.vpaid.provider,};} return merge({},connectorState,{response:responseData,});},function getConnectorID(augmentedSource){return augmentedSource.aid;});sublime.ssp.fireSspPixel=function(callName,sspResponse,extraQS){var e=(callName==='sspCall')?'sspc':callName.toLowerCase();var pixel={inherit:'_ssp',qs:{e:e,},};var id=sublime.ad.ssp_id||'ad-'+sublime.ad.id;if(callName==='sspCall'){sublime.ssp.callStopwatch.start();}else{pixel.qs.sspr=pInt(sspResponse);const callDuration=sublime.ssp.callStopwatch.stop();pixel.preFireCallback=function(){this.qs.rt=callDuration;};} if(isObject(extraQS)){pixel.qs=merge(pixel.qs,extraQS);} analytics.fire(env('zoneId'),callName+'-'+sublime.ad.ssp_name+'-'+id,pixel);};sublime.ssp.setup=env('sspSetup')||{};sublime.ssp.query=function sspQuery(){var sspClass=sublime.ssp.getSspClassFromAd(sublime.ad);if(!sspClass){log.error('Ssp not supported',{ssp:sublime.ad.ssp_name});return sublime.adServer.execute();} log.info('SSP Call: '+sublime.ad.ssp_name);sublime.ssp.fireSspPixel('sspCall');try{return sspClass.query();}catch(e){log.error('Error ssp query',{ssp:sublime.ad.ssp_name},e);return sublime.ssp.errorAndGoNext({message:'Error ssp query '+sublime.ad.ssp_name,ssp_response:sublime.sspRequest.ssp_response.REQUEST_ERROR,});}};sublime.ssp.getSspClassFromAd=function(ad){var sspNamespace=ad.ssp_name.toLowerCase();if(sublime.ssp[sspNamespace]&&isFunction(sublime.ssp[sspNamespace].query)){return sublime.ssp[sspNamespace];} return false;};const pixelsSsp={_ssp:{inherit:'_commonSkinz',preFireCallback:function(){if(isDefined(sublime.ad)&&'ssp_name'in sublime.ad){let sspName=sublime.ad.ssp_name;if(sublime.ad.ssp_name==='appnexus'&&sublime.ad.header_bidding){sspName='appnexus3';} this.qs.sspname='sspv3-'+sspName;} if(isDefined(sublime.ad)&&'ssp_id'in sublime.ad){this.qs.sspplid=sublime.ad.ssp_id;} this.qs.isssp=1;},qs:{},},};analytics.setPixels(env('zoneId'),pixelsSsp);const parseVast={emptyResponse:/[\s\r\n]*<\/VAST>/,};parseVast.response={OK:'OK',EMPTY_RESPONSE:'EMPTY_RESPONSE',PARSE_ERROR:'PARSE_ERROR',PARSE_TIMEOUT:'PARSE_TIMEOUT',REQUEST_ERROR:'REQUEST_ERROR',UNKNOWN_ERROR:'UNKNOWN_ERROR',};const vastQuartileNames=['start','firstQuartile','midpoint','thirdQuartile','complete'];const eventNames=['close','complete','expand','fullscreen','mute','pause','resume','rewind','unmute'];const imageSelector='sublime_img_bg';let pixelNumber=0;let allPixels=[];let insertionId=null;let dealId=null;let monetizationType=null;let buyerId=null;let vpaid=null;function getNodeValue(e){if(!e||!e.childNodes){return null;} let child=e.childNodes.length===1?e.firstChild:e.childNodes[1];for(let i=0;i0&&config.supported>=0;});mediaFiles=mediaFiles.sort(function sortMediaFiles(a,b){if(a.supported>b.supported){return 1;} if(a.supportedMath.abs(b.bitrate-bitrate)){return 1;} return 0;});return mediaFiles[0];} parseVast.pickMediaFile=function pickMediaFile(mediaFiles){const BITRATE_REFERENCE=videoTest.BITRATE_REFERENCE;const SUPPORTED_PLAY_TYPES=videoTest.SUPPORTED_PLAY_TYPES;const SUPPORTED_PLAY_TYPE_3GPP=videoTest.SUPPORTED_PLAY_TYPE_3GPP;if(mediaFiles===undefined||mediaFiles.length===0){log.warn('pickMediaFile: empty mediaFiles collection');return undefined;} let mediaFilesAvailable=sortCanPlayMediaFiles(mediaFiles,SUPPORTED_PLAY_TYPES);let playableMediaFiles;if(mediaFilesAvailable.length>0){playableMediaFiles=getOneMediaFile(mediaFilesAvailable,BITRATE_REFERENCE);} if(!playableMediaFiles){mediaFilesAvailable=sortCanPlayMediaFiles(mediaFiles,SUPPORTED_PLAY_TYPE_3GPP);if(mediaFilesAvailable.length>0){playableMediaFiles=getOneMediaFile(mediaFilesAvailable,BITRATE_REFERENCE);}} if(!playableMediaFiles){log.warn('pickMediaFile: no playable mediaFile');return undefined;} return playableMediaFiles.mediaFile;};function detectSublimeCreativeInVPAID(adElementId,adParameters,mediaFile){let output={creativeId:null,queryString:null,};const vastURLRegex=new RegExp(('sac.*?.ayads.co.*?/vast/').replace(/[/]/g,'\\/') +'(\\d+)([^\\]"]*)?','i');const encodedVastURLRegex=new RegExp('sac.*?.ayads.co.*?%2fvast%2f(\\d+)(%3f[^&$]*)?','i');let matches;if(adElementId){matches=adElementId.match(/^Sublime-(\d+)$/);} if(!matches&&adParameters){matches=adParameters.match(vastURLRegex);} if(!matches&&mediaFile){matches=mediaFile.match(encodedVastURLRegex);if(matches&&matches[2]){matches[2]=decodeURIComponent(matches[2]);}} if(!matches&&tryParseJson(adParameters)){const decodedContent=decodeAppnexusWrappedContent(adParameters);matches=decodedContent.match(vastURLRegex);} if(matches&&matches.length){output={creativeId:matches[1],queryString:matches[2]?parseUrlQueryString(matches[2]):null,};} return output;} function vastParse(responseXML){if(!responseXML){return false;} const o={adElement:responseXML.querySelector('Ad'),wrapperElement:responseXML.querySelector('Wrapper'),impressionElements:responseXML.querySelectorAll('Impression'),errorElements:responseXML.querySelectorAll('Error'),trackingElements:responseXML.querySelectorAll('Tracking'),videoElement:parseVast.pickMediaFile(responseXML.querySelectorAll('MediaFile')),adParametersElement:responseXML.querySelector('AdParameters'),clickThroughElement:responseXML.querySelector('ClickThrough'),customClickElement:responseXML.querySelector('CustomClick'),clickTrackingElements:responseXML.querySelectorAll('ClickTracking'),companionAdsElement:responseXML.querySelectorAll('CompanionAds'),durationElement:responseXML.querySelector('Duration'),smartMacrosElement:responseXML.querySelector('SmartMacros'),rtbMacrosElement:responseXML.querySelector('RtbMacros'),companions:{},data:{ad:{raid:null,rcid:null,insertionId:null,dealId:null,images:[],htmlParts:[],isWrapper:true,sublimeCreativeDetected:false,},hooks:{},pixels:[],childUri:null,},};if(!o.adElement){return false;} if(o.smartMacrosElement){if(o.rtbMacrosElement){const extractedDealId=Number(getNodeValue(o.rtbMacrosElement.querySelector('DealId')));if(extractedDealId>0){monetizationType='deal';dealId=extractedDealId;o.data.ad.dealId=extractedDealId;if(isObject(sublime.ad)){sublime.ad.deal_id=dealId;}}else{monetizationType='open_auction';} buyerId=getNodeValue(o.rtbMacrosElement.querySelector('BuyerId'));if(buyerId){o.data.ad.buyerId=buyerId;}}else{monetizationType='direct';} o.data.ad.monetizationType=monetizationType;insertionId=getNodeValue(o.smartMacrosElement.querySelector('insertionID'));if(insertionId){o.data.ad.insertionId=insertionId;if(isObject(sublime.ad)){sublime.ad.insertion_id=insertionId;}}} const vastId=o.adElement.getAttribute('id');if(vastId&&vastId.match(/^sublime-.*/i)){o.data.ad.raid=vastId.replace(/^sublime-(.*)$/i,'$1');if(isObject(sublime.ad)){sublime.ad.raid=o.data.ad.raid;} o.data.ad.sublimeCreativeDetected=true;o.data.ad.isWrapper=false;} const vastCampaignId=o.adElement.getAttribute('sskzCampaignId');if(vastCampaignId){o.data.ad.rcid=vastCampaignId;} const vastType=o.adElement.getAttribute('sskzType');if(vastType==='light'){o.data.childUri=env('app_host')+'/vast/'+o.data.ad.raid;return o;} o.data.device=o.adElement.getAttribute('sskzDevice')||device.type;const creativeType=o.adElement.getAttribute('sskzCreativeType');if(creativeType){o.data.ad.creative_type=creativeType;} const mobileSetup=o.adElement.getAttribute('sskzMobileSetup');if(mobileSetup){o.data.ad.mobile_setup=mobileSetup;} const desktopSetup=o.adElement.getAttribute('sskzDesktopSetup');if(desktopSetup){o.data.ad.desktop_setup=desktopSetup;} const moat=parseInt(o.adElement.getAttribute('sskzMoat')||0,10);if(moat>=1){o.data.ad.moat=moat;} const htmlUsage=o.adElement.getAttribute('sskzHtmlUsage');if(htmlUsage){o.data.ad.html_usage=htmlUsage;} let eventNode;let impressionValue;let clickValue;let eventValue;let eventName;let companionNode;let companionName;let i;let j;let companions;let companionAdParameters;let companionImage;let companionVideoBackground;let pixelName;o.adParametersValue=getNodeValue(o.adParametersElement);if(o.durationElement){o.data.duration=time2secs(getNodeValue(o.durationElement));} function isExternalTrackingURL(nodeValue){const hostOnAyadsDomain=/\.ayads\.co(?:\.local)?$/;return(isUrl(nodeValue)&&!hostOnAyadsDomain.test(parseUrl(nodeValue).host));} for(i=0;i=options.tryRepeat){log.info('parseScript clear interval');timer.clearInterval(interval);interval=null;if(result.adFound){result.creativeAd.response_format='redirect';options.successCallback(result.creativeAd,{type:'script',tries:tries,result:result,});return;} let parseScriptResponse=sublime.parseScript.response.PARSE_TIMEOUT;if(result.responseFound){parseScriptResponse=sublime.parseScript.response.EMPTY_RESPONSE;} if(!result.responseFound&&sublime.ad&&sublime.ad.ssp_name==='smartadserver'){iframeHtml='-- could not retrieve iframe content --';if(iframe.contentWindow&&iframe.contentWindow.document&&iframe.contentWindow.document.body&&iframe.contentWindow.document.body.innerHTML){iframeHtml=iframe.contentWindow.document.body.innerHTML;} log.warn('parseScript.write: parse timeout on smartAdServer',{iframeHtml:iframeHtml,tags:{ssp:'smartadserver',},});} sublime.parseScript.removeIframe(iframe);options.errorCallback({type:'script',tries:tries,parseScript_response:parseScriptResponse,});return;} log.log('parseScript end read response');},options.tryIntervalMs);};sublime.parseScript.removeIframe=function removeIframe(iframe){if(!iframe){return false;} let str='parseScript delete iframe';if(iframe.id&&iframe.id.length>0){str+='#'+iframe.id;if(iframe.name&&iframe.name.length>0){str+='[name='+iframe.name+']';}} log.info(str);if(log.level<40){return sublime.removeElement(iframe);} log.log('parseScript delete iframe < is fake delete');return true;};const redirectLightRequests={};const redirectLightOutputs={};sublime.parseScript.readResponseFromIframe=function readResponseFromIframe(iframeWindow){var output={responseFound:false,adFound:false,creativeAd:{},};if(!iframeWindow||!iframeWindow.document){return output;} const redirectAd=sublime.compat.windowHasRedirect(iframeWindow);if(redirectAd){if(redirectAd.id){delete redirectAd.id;} if(isDefined(redirectAd.raid)&&isDefined(redirectAd.rtype)&&redirectAd.rtype==='light'){log.info('Identified Redirect light: '+redirectAd.raid);if(!redirectLightRequests[redirectAd.raid]){log.info('Requesting redirect');sublime.xhr(env('sublime_url')+'ad/'+redirectAd.raid,{jsonp:true,callbackName:'sublimeCbRedLightAd',success:function successXhr(response){var creativeResponse=response;creativeResponse.originalUrl=creativeResponse.url;creativeResponse.url=redirectAd.click_macro+creativeResponse.url;creativeResponse.click_macro=redirectAd.click_macro;creativeResponse.isRedirect=true;creativeResponse.raid=redirectAd.raid;delete creativeResponse.aid;delete creativeResponse.id;redirectLightOutputs[redirectAd.raid]={responseFound:true,adFound:true,creativeAd:creativeResponse,};log.info('Redirect light response received',redirectAd.raid,response,redirectLightOutputs[redirectAd.raid]);},error:function errorXhr(){redirectLightOutputs[redirectAd.raid]={responseFound:true,adFound:false,};log.warn('Redirect light error',redirectAd.raid,redirectLightOutputs[redirectAd.raid]);},});redirectLightRequests[redirectAd.raid]=true;} if(redirectLightOutputs[redirectAd.raid]){log.info('Redirect light usable');return redirectLightOutputs[redirectAd.raid];} if(redirectLightRequests[redirectAd.raid]){log.info('Redirect light request pending');return output;} log.warn("Can't find Redirect light",redirectAd.raid);return output;} log.info('Compact redirect in use');output.responseFound=true;output.adFound=true;output.creativeAd=redirectAd;return output;} let img=iframeWindow.document.querySelector('img[onclick^="window.open"]');if(img){const matches=img.getAttribute('onclick').toString().match(/^window\.open\('(http.*?)'/);const url=matches&&matches[1];if(url){output.creativeAd.url=url;output.creativeAd.originalUrl=url;output.creativeAd.images={bg:img.src};output.creativeAd.type='skinz';output.responseFound=true;output.adFound=true;return output;}} const links=iframeWindow.document.getElementsByTagName('a');if(!links.length){log.warn('No href found in response');return output;} const a=links[0];const imgs=a.getElementsByTagName('img');if(!imgs.length){log.warn('No image found in response');return output;} img=imgs[0];if(a&&img&&a.href&&img.src){if(a.href.charAt(0)!=='j'&&!isUrl(a.href)){output.responseFound=true;return output;} if(img.src.indexOf('1x1')>-1||img.src.indexOf('adchoices')>-1||a.href.toString().indexOf('info.criteo')>-1||a.href.toString().indexOf('unicef')>-1){log.warn('Negative response');output.responseFound=true;return output;} if(a.href.indexOf('j')===0){hook.register('event.click',function onClick(){eval(a.href.replace('javascript:',''));});output.creativeAd.url=a.href.match(/\(.*\)/)[0].replace(/\(|\)|'/gi,'');}else{output.creativeAd.url=a.href;} output.creativeAd.originalUrl=output.creativeAd.url;if(a.onclick){hook.register('event.click',a.onclick);} if(isEmpty(output.creativeAd.images)){output.creativeAd.images={};} output.creativeAd.images.bg=img.src;output.creativeAd.type='skinz';output.creativeAd.response_format='html';log.info('Href found in response',a.href);output.responseFound=true;output.adFound=true;} return output;};const waterfallSspAppnexus={name:'appnexus',iframeId:'sublime-appnexus-iframe',timeout:2500,setup:{customUrls:{query:'',prebidQuery:'',},},setQueryUrl(url){waterfallSspAppnexus.setup.customUrls.query=url;},setPrebidQueryUrl(url){waterfallSspAppnexus.setup.customUrls.prebidQuery=url;},query(){log.info('appnexus.query: PROMISE');const options={async:true,timeout:1000,isMobile:device.is.mobile,acceptVideo:(!env('zoneNovideo')&&!device.hasFeature(device.FEATURE.DATA_SAVER)&&(device.is.mobile||(inArray(device.screen,['large','unknown'])))),};const source={url:'https://ib.adnxs.com/ut/v3/prebid',id:sublime.ad.ssp_id,aid:sublime.ad.id,};return sublime.sspRequest.appnexusRequest.call(source,options).then((response)=>{if(response.success){if(response.vast){const xmlDocument=tryParseXml(response.vast);return sublime.parseVast.decodeVastResponse(xmlDocument,{errorCallback:sublime.ssp.errorAndGoNext,successCallback:sublime.ssp.successAndDisplayAd,});} return sublime.parseScript.write(response.html,{id:sublime.ssp.appnexus.iframeId,iframeAttributes:{'data-ssp-name':sublime.ad.ssp_name,'data-ssp':sublime.ad.ssp_id,width:'1800px',height:'1000px',style:'margin-left: -900px;' +'position: absolute;' +'z-index: 999;' +'top: 0;' +'left: 50%;' +'opacity: 0.001;' +'display: block;' +'transform: scale(0.001);' +'transform-origin: top',},errorCallback:sublime.ssp.errorAndGoNext,successCallback:sublime.ssp.successAndDisplayAd,tryIntervalMs:30,tryRepeat:50,});} return sublime.ssp.errorAndGoNext({message:'Error Appnexus WF query',ssp_response:response.error_code,});}).catch((e)=>{log.error('Error with appnexus call',{},e);return sublime.ssp.errorAndGoNext({message:'Error in the Appnexus Promise, error catched',ssp_response:sublime.sspRequest.ssp_response.UNKNOWN_ERROR,});});},};if(typeof window!=='undefined'){window.sublime=window.sublime||{};window.sublime.ssp=window.sublime.ssp||{};window.sublime.ssp.appnexus=waterfallSspAppnexus;} sublime.ssp=sublime.ssp||{};sublime.ssp.improve={name:"improve",iframeId:"sublime-improve-iframe"};var improveSetup={customUrls:{query:''}};sublime.ssp.improve.setQueryUrl=function(url){improveSetup.customUrls.query=url;};sublime.ssp.improve.query=function(){improveQuery();};var improveQuery=function(){var url=getQueryUrl(),html='';sublime.parseScript.write(html,{id:sublime.ssp.improve.iframeId,iframeAttributes:{"data-ssp-name":sublime.ad.ssp_name,"data-ssp":sublime.ad.ssp_id},errorCallback:sublime.ssp.errorAndGoNext,successCallback:sublime.ssp.successAndDisplayAd,tryIntervalMs:100,tryRepeat:20});};var getQueryUrl=function(){var queryType='query';var nuggad_qs=storage.get('nuggad-profile-qs');var url='https://ad.360yield.com/adj?p='+ sublime.ad.ssp_id+'&w=1800&h=1000&tz='+ (new Date().getTimezoneOffset())+ (nuggad_qs?'&'+nuggad_qs:'')+'&click3rd=';if(improveSetup.customUrls&&improveSetup.customUrls[queryType]){return improveSetup.customUrls[queryType];} url=sublime.sspRequest.improveRequest.buildGDPRQuery(url);return url;};sublime.ssp=sublime.ssp||{};sublime.ssp.criteo={name:'criteo',iframeId:'sublime-criteo-iframe',timeout:1000,url:null,};sublime.ssp.criteo.query=function sspCriteoQuery(){domWrite(sspCriteoTagContent());};sublime.ssp.criteo.callback=function sspCriteoCallback(response){log.info('Criteo response',response);if(response.response_status>0){let sspResponse=sublime.sspRequest.ssp_response.REQUEST_ERROR;if(response.response_status===1){sspResponse=sublime.sspRequest.ssp_response.EMPTY_RESPONSE;} return sublime.ssp.errorAndGoNext({message:'Criteo request not handled',response:response.response,ssp_response:sspResponse,});} let shopData;try{shopData=sspCriteoRemapShopData(response);}catch(e){log.error('sspCriteo.sspCriteoRemapShopData error',{response:response},e);return sublime.ssp.errorAndGoNext({message:'sspCriteo.sspCriteoRemapShopData error',ssp_response:sublime.sspRequest.ssp_response.PARSE_ERROR,});} if(!shopData){return sublime.ssp.errorAndGoNext({message:'No shop data',ssp_response:sublime.sspRequest.ssp_response.PARSE_ERROR,});} sublime.ad.sspResponse=response;sublime.ad.shopData=shopData;if(sublime.ad.type==='mobile'){sublime.ad.creative_type='mobile m-skinz shop';}else{sublime.ad.type='html5';} if(response.impression_pixels&&response.impression_pixels.length){for(let i=0;i' +''+response.advertiser.description+'' +'';shopData.prependWings.left=htmlLogo;shopData.prependWings.right=htmlLogo;} let knowMoreTxt='En savoir +';if(shopData.language&&shopData.language==='en'){knowMoreTxt='Learn more';} shopData.css='@import url(https://fonts.googleapis.com/css?family=Open+Sans:400,600,700);' +'*[id*="sublime-ad-"], *[class*="sublime-ad-"] {font-family: "Open Sans", Helvetica, sans-serif; }' +'#sublime-ad-shop-left, #sublime-ad-shop-right { background-color: #fff; padding: 0 5px;}' +'#sublime-ad-shop-left .ad-logo, #sublime-ad-shop-right .ad-logo {display: block; text-align: center; padding: 10px 0; }' +'.sublime-ad-item { padding-top: 5px; margin-bottom: 15px; text-align: center; }' +'.sublime-ad-item a { color: #000; }' +'.sublime-ad-item a:after {opacity: 0; content: "'+knowMoreTxt+'"; position: absolute; top: 50%; left: 50%; color: #000000; background-color: rgba(255,255,255,0.8); padding: 5px; font-size: 10px; -webkit-transform: translate(-50%, -50%); transform: translate(-50%, -50%); transition: all 0.3s ease; }' +'.sublime-ad-item:hover a:after {opacity: 1; }' +'img.sublime-ad-item-image {max-width: 100%; height: auto; }' +'.sublime-ad-item:first-child{margin-top: 50px; }' +'.sublime-ad-item-name { font-weight: 600; font-size: 12px; margin: 5px 0 0 0; }' +'.sublime-ad-item-price-container {font-size: 16px; font-weight: 700; margin: 5px 0 0 0; padding: 0 0%; }';shopData.gutterWidth=140;shopData.repeatProducts=false;shopData.showCurrency=false;return shopData;} function sspCriteoGrabAdData(htmlData){let html=htmlData||sublime.ad.html;html=html.replace(/[\n\r\t]+/g,'').replace(/[\s]+/g,' ');const data=html.match(/\/\*\s*BEGINCRITEO\s*\*\/(.+)\/\*\s*ENDCRITEO\s*\*\//);if(!data||!data[1]){return false;} try{eval('data = '+data[1]);}catch(e){return false;} return data;} function sspCriteoGrabBannerData(bannerId,html){var adData=sspCriteoGrabAdData(html);if(adData&&!adData[bannerId]){return null;} return adData[bannerId];} function sspCriteoTagContent(){let tag='';if(sublime.ssp.criteo.url){tag=' ';} tag+='' +'' +'
' +'' +'
';return tag;} sublime.ssp.criteogeneric={name:'criteogeneric',iframeId:'sublime-criteogeneric-iframe',timeout:false};sublime.ssp.criteogeneric.query=sublime.ssp.criteo.query;sublime.ssp=sublime.ssp||{};sublime.ssp.rubicon={name:'rubicon',iframeId:'sublime-rubicon-iframe'};sublime.ssp.rubicon.query=function(){if(sublime.ad.header_bidding){log.warn('Header bidding not yet supported for Rubicon');} var rpParams=getParameters();if(!rpParams){return sublime.ssp.errorAndGoNext({message:"sspRubicon: ssp_id incorrect: "+sublime.ad.ssp_id,ssp_response:sublime.sspRequest.ssp_response.PARAMETERS_ERROR});} var rpParamsString=JSON.stringify(rpParams),html=''+''+'sublime.info("Rubicon Params", '+rpParamsString+');'+'';delete rpParams.url;domWrite(html,{id:sublime.ssp.rubicon.iframeId,iframeVars:rpParams});};var getParameters=function(){var parts=sublime.ad.ssp_id.toString().split(':');if(parts.length!==3){return false;} var zone=env('zone')||{};var rpx_params=sublime.originWindow.rpx_params||sublime.window.rpx_params;var output={};output.rp_account=parts[0];output.rp_site=parts[1];output.rp_zonesize=parts[2];output.rp_adtype='jsonp';output.rp_callback=renderCallback;output.rp_smartfile='[SMART FILE URL]';output.rp_kw=(typeof rpx_params!=='undefined'&&typeof rpx_params.kw!=='undefined')?rpx_params.kw:'';output.rp_visitor=(typeof rpx_params!=='undefined'&&typeof rpx_params.visitor!=='undefined')?rpx_params.visitor:{};if(typeof rpx_params!=='undefined'&&typeof rpx_params.inventory!=='undefined'){output.rp_inventory=rpx_params.inventory;}else if(!sublime.ad.traffic_type||sublime.ad.traffic_type!=='pmp'){output.rp_inventory={zone_id:zone.id,category:zone.main_category_name+','+zone.sub_category_name,broadcasting:'',novideo:zone.novideo?1:0};}else{output.rp_inventory={main_channel:zone.main_category_name,sub_channel:zone.sub_category_name};} output.url='https://ads.rubiconproject.com/ad/'+output.rp_account+'.js';return output;};var renderCallback=function(response){if(response.status!=="ok"){return sublime.ssp.errorAndGoNext({message:"sspRubicon: request error : "+sublime.ad.ssp_id,ssp_response:sublime.sspRequest.ssp_response.REQUEST_ERROR});} if(isEmpty(response.ads)){return sublime.ssp.errorAndGoNext({message:"sspRubicon: empty response",ssp_response:sublime.sspRequest.ssp_response.EMPTY_RESPONSE});} var ad,html='';for(var i=0;i'+ad.script+'';}else if(ad.type==="html"){html=ad.html;} if(html){return sublime.parseScript.write(html,{id:sublime.ssp.rubicon.iframeId+'-callback',iframeAttributes:{"data-ssp-name":sublime.ad.ssp_name,"data-ssp":sublime.ad.ssp_id},errorCallback:sublime.ssp.errorAndGoNext,successCallback:sublime.ssp.successAndDisplayAd,tryIntervalMs:100,tryRepeat:30,responseReader:sublime.ssp.rubicon.readResponse,iframeVars:getParameters()});}} return sublime.ssp.errorAndGoNext({message:"sspRubicon: empty ads",ssp_response:sublime.sspRequest.ssp_response.EMPTY_RESPONSE});};sublime.ssp.rubicon.readResponse=function(iframeWindow){var output={responseFound:false,adFound:false,creativeAd:{}};var imgs=iframeWindow.document.getElementsByTagName('img');for(var i=0,img;i-1){output.responseFound=true;return output;}} output=sublime.parseScript.readResponseFromIframe(iframeWindow);return output;};sublime.ssp.smartadserver={name:'smartadserver',iframeId:'sublime-smartadserver-iframe',timeout:false,};sublime.ssp.smartadserver.query=function(){var isUSCampaign=sublime.ad.campaign_id===5691;log.info(sublime.ssp.smartadserver.name+'.query: PROMISE');const source={url:sublime.sspRequest.smartadserverRequest.getDefaultSourceUrl(sublime.ad.ssp_id),aid:sublime.ad.id,};const options={isUSCampaign:isUSCampaign,acceptVideo:!env('zoneNovideo')&&!device.hasFeature(device.FEATURE.DATA_SAVER),};return sublime.sspRequest.smartadserverRequest.call(source,options).then(function(response){if(response.success){if(response.vast){return displayVideoAd(response.vast);}else if(response.json){return displayHTMLAd(response.json.ad.creativeScriptRAW,response.pixels);}} return sublime.ssp.errorAndGoNext({message:response.message,ssp_response:response.error_code,sspName:sublime.ssp.smartadserver.name});}).catch(function(e){log.error('Error with '+sublime.ssp.smartadserver.name+'call',{},e);return sublime.ssp.errorAndGoNext({message:'Error in the SmartAdServer Promise, error catched',ssp_response:sublime.sspRequest.ssp_response.UNKNOWN_ERROR,sspName:sublime.ssp.smartadserver.name,});});};function displayVideoAd(vastString){const xmlDocument=tryParseXml(vastString);return sublime.parseVast.decodeVastResponse(xmlDocument,{errorCallback:sublime.ssp.errorAndGoNext,successCallback:sublime.ssp.successAndDisplayAd,});} function displayHTMLAd(html,pixels){sublime.parseScript.write(html,{id:sublime.ssp.smartadserver.iframeId,iframeAttributes:{"data-ssp-name":sublime.ad.ssp_name,"data-ssp":sublime.ad.ssp_id},errorCallback:sublime.ssp.errorAndGoNext,successCallback:function(creativeAd){log.info("event.ssp.ok",creativeAd);store.updateState(sspAdUpdater,merge(creativeAd,{aid:sublime.ad.id,}));if(pixels){log.log("Adding Smart pixels");analytics.setPixels(env('zoneId'),pixels);} sublime.ad=merge(sublime.ad,creativeAd);sublime.ssp.fireSspPixel('sspOk',0);return sublime.adServer.displayAd();},tryIntervalMs:30,tryRepeat:50});} sublime.ssp.sticky={name:'sticky',timeout:false};var customUrlsSspSticky={query:''};sublime.ssp.sticky.setQueryUrl=function(url){customUrlsSspSticky.query=url;};sublime.ssp.sticky.query=function(){var url;if(customUrlsSspSticky&&customUrlsSspSticky.query){url=customUrlsSspSticky.query;}else{url=sublime.ssp.sticky.getQueryUrl();} sublime.parseVast.query(url,{sspName:'sticky',adId:sublime.ad.id,timeout:sublime.ssp.sticky.timeout,errorCallback:sublime.ssp.errorAndGoNext,successCallback:sublime.ssp.successAndDisplayAd});return true;};sublime.ssp.sticky.getQueryUrl=function(){var url='https://ads.stickyadstv.com/www/delivery/swfIndex.php?reqType=AdsSetup&protocolVersion=2.0&zoneId='+sublime.ad.ssp_id;url=sublime.macros.replace(url);url=sublime.sspRequest.stickyRequest.buildGDPRQuery(url);return url;};const sspGeneric={name:'generic',iframeId:'sublime-generic-iframe',timeout:false,};sspGeneric.query=function sspGenericQuery(){if(sublime.ad.vast_url){sublime.parseVast.query(sublime.macros.replace(sublime.ad.vast_url),{timeout:sspGeneric.timeout,errorCallback:sublime.ssp.errorAndGoNext,successCallback:sublime.ssp.successAndDisplayAd,});}else if(sublime.ad.script_url){sublime.parseScript.write('',{errorCallback:sublime.ssp.errorAndGoNext,successCallback:sublime.ssp.successAndDisplayAd,});}else{sublime.ssp.errorAndGoNext({message:'Cannot use ssp generic without vast_url or script_url',ssp_response:sublime.sspRequest.ssp_response.PARAMETERS_ERROR,});}};if(typeof window!=='undefined'){window.sublime=window.sublime||{};window.sublime.ssp=window.sublime.ssp||{};window.sublime.ssp.generic=sspGeneric;} sublime.cleanUp=function cleanUp(){hook.call('event.cleanUp');timer.clearAllTimeouts();timer.clearAllIntervals();removeDomNodes();removeGlobals();};function removeDomNodes(){const elements=Array.prototype.slice.call(sublime.document.querySelectorAll('[id^="ayads"],' +'[id^="sublime"],' +'div[class*="celtraCloseButtonBackground"],' +'[class*="celtra-expanded-ad"],' +'[class*="celtra-placement-sticky"]'),0);log.info('SJS Cleanup','DOM Elements to remove:',elements.length);elements.forEach(function each(node){if(node.parentNode){node.parentNode.removeChild(node);}});} function removeGlobals(){sublime.window.sublime=undefined;sublime.window.ayads=undefined;window.sublime=undefined;window.ayads=undefined;} hook.call('step.run');elapsedSinceLastCall('step.run');analytics.fire(env('zoneId'),'call');const waterfallRunPromise=sublime.Promise.all([gdpr.run(),sirData.run(),]).then(()=>{log.info(`sublime.adServer.run starts after ${Math.round(elapsedSinceLastCall('step.run'))}ms`);sublime.adServer.run();}).catch((error)=>{log.error('Waterfall runner on error',{global:1},error);});})();