! function() { var vt = "vast", gt = "-1", e = "time", d = "[ERRORCODE]", yt = "vmap", At = 5e3, kt = 15e3, Pt = "jwp", Tt = "jwpspotx", n = "state", l = "paused", wt = "playing", bt = "complete", _t = "error", Et = "adBidRequest", It = "adBidResponse", a = "adBreakIgnored", r = "adClick", Ct = "adComplete", St = "adError", xt = "adImpression", h = "adMeta", o = "adPause", p = "adPlay", Rt = "adSchedule", i = "adSkipped", t = "adStarted", s = "click", u = "play", c = "error", f = "complete", m = [xt, St, "adPodError"], v = [t, Ct, xt, r, i, St, p, o, h], g = function(t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function") }, y = function() { function r(t, e) { for (var i = 0; i < e.length; i++) { var r = e[i]; r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(t, r.key, r) } } return function(t, e, i) { return e && r(t.prototype, e), i && r(t, i), t } }(), Vt = Object.assign || function(t) { for (var e = 1; e < arguments.length; e++) { var i = arguments[e]; for (var r in i) Object.prototype.hasOwnProperty.call(i, r) && (t[r] = i[r]) } return t }, A = function() { function s(t, e, i, r, n) { var a = this; g(this, s), this.player = t, this.state = t.state, this.vpaidURL = i, this.adTag = r, this.adParams = n.adParams, this.vpaidControls = n.vpaidControls, this.type = "vpaid", this.instream = e || t.createInstream(), this.toRemove = [], this.vpaidState = { linear: !1, expanded: !1, remainingTime: -1 }, this.paused = !1, Vt(this, t.Events), this.setMuteCallback = this.setMute.bind(this), this.playerContainer = this.player.getContainer(), n.adOptOut ? setTimeout(function() { a.sendEvent("error", { message: "Conditional ad rejected", code: 408 }) }, 0) : (this.iframe = function(t, e, i, r) { var n = document.createElement("iframe"); n.setAttribute("gesture", "media"), n.setAttribute("allow", "autoplay"), n.src = "javascript:false", t.style(n, { border: 0, width: "100%", height: "100%", position: "absolute", overflow: "hidden" }), n.scrolling = "no", i.querySelector(".jw-media").appendChild(n); var a = n.contentWindow.document; return a.open().write("\n
"), n.contentWindow.myCallback = r, a.close(), n }(t.utils, this.vpaidURL, this.playerContainer, this.callback.bind(this)), this.toRemove.push(this.iframe)) } return s.prototype.sendEvent = function(t, e) { (e = e || {}).tag || (e.tag = this.adTag), this.trigger(t, e) }, s.prototype.sendTimeEvent = function(t, e, i) { var r = e.getAdDuration(), n = e.getAdRemainingTime(), a = Vt({ duration: r }, i); this.sendEvent(t, a), 0 < n && (a.position = r - n, this.trigger("time", a)) }, s.prototype.handleQuartile = function(t, e) { this.sendTimeEvent("quartile", t, { quartile: e }) }, s.prototype.genEvent = function(e) { var i = this; return function(t) { i.on(e, t) } }, s.prototype.setMute = function() { this.player.setMute(!this.vpaidAd.getAdVolume()) }, s.prototype.userActive = function() { var t = this.player.utils.hasClass(this.playerContainer, "jw-flag-time-slider-above"); this.player.utils.style(this.iframe, { bottom: t ? 66 : 60 }) }, s.prototype.userInactive = function() { "paused" !== this.player.getState() && this.player.utils.style(this.iframe, { bottom: "0.5em" }) }, s.prototype.prepareNonlinearAd = function() { var t = !this.player.utils.hasClass(this.playerContainer, "jw-flag-user-inactive"); if (this.player.utils.style(this.iframe, { height: 150 }), this.resize(null, 150), this.userActive(t), this.player.on("userActive", this.userActive, this), this.player.on("userInactive", this.userInactive, this), this.instream) { this.instream.noResume = !0, this.instream.applyProviderListeners(null), this.instream.destroy(), this.instream = null; var e = this.playerContainer.querySelector(".jw-media"), i = e.querySelector("video,audio"); e.insertBefore(i, this.iframe), i.play() } }, s.prototype.genListeners = function(t) { var r = this; return { AdLoaded: function() { t.startAd() }, AdStarted: function() { t.getAdLinear() ? r.vpaidControls || (r.instream = r.instream || r.player.createInstream(), r.instream.hide()) : r.prepareNonlinearAd(), r.sendEvent("impression", { linear: t.getAdLinear() ? "linear" : "nonlinear" }), r.sendEvent("play", { oldstate: "buffering", newstate: wt, linear: t.getAdLinear() ? "linear" : "nonlinear" }), t.subscribe(r.setMuteCallback, "AdVolumeChange", t) }, AdVideoStart: function() { r.sendEvent("started") }, AdStopped: function() { k(r.toRemove), r.sendEvent("stopped") }, AdPaused: function() { r.paused || (r.paused = !0, r.sendEvent("pause", { newstate: l, oldstate: wt })) }, AdPlaying: function() { r.paused && (r.paused = !1, r.sendEvent("play", { newstate: wt, oldstate: l, linear: t.getAdLinear() ? "linear" : "nonlinear" })) }, AdLinearChange: function() { t.getAdLinear() ? (r.player.utils.style(r.iframe, { height: "100%" }), r.player.off(null, null, r), r.instream = r.instream || r.player.createInstream(), r.instream.init(), r.vpaidControls || r.instream.hide()) : r.prepareNonlinearAd() }, AdDurationChange: function() { r.sendTimeEvent("remainingTimeChange", t, { isDurationChange: !0, remainingTime: t.getAdRemainingTime() }) }, AdRemainingTimeChange: function() { r.sendTimeEvent("remainingTimeChange", t, { remainingTime: t.getAdRemainingTime() }) }, AdExpandedChange: function() { r.sendEvent("expandedChange", { expanded: t.getAdExpanded() }) }, AdSkipped: function() { k(r.toRemove), r.sendEvent("skipped") }, AdVideoFirstQuartile: function() { r.handleQuartile(t, 1) }, AdVideoMidpoint: function() { r.handleQuartile(t, 2) }, AdVideoThirdQuartile: function() { r.handleQuartile(t, 3) }, AdVideoComplete: function() { r.sendEvent("complete") }, AdUserClose: function() { r.sendEvent("close") }, AdClickThru: function(t, e, i) { r.sendEvent("click", { id: e, url: t, playerHandles: i }) }, AdError: function(t) { k(r.toRemove); var e = function(t) { if (t) { var e = t.match(/\b(?:[34])[0-9]{2}\b/); if (e) return parseInt(e[0], 10); if (t.match(/timeout/i)) return t.match(/vpaid|vast/i) ? 301 : 402; if (t.match(/found/i)) return 401; if (t.match(/supported/i)) return 403; if (t.match(/(?:displaying|media file)/i)) return 405 } return 901 }(t); r.sendEvent("error", { message: t, code: e, adErrorCode: 5e4 + e }) } } }, s.prototype.callback = function() { var e = this.vpaidAd = this.iframe.contentWindow.getVPAIDAd(), t = this.player.getMute() ? 0 : this.player.getVolume() / 100, i = e.handshakeVersion("2.0"); if (parseFloat(i) < 1) throw new Error("Invalid vpaid version in handshake"); var r = this.genListeners(e); Object.keys(r).forEach(function(t) { e.subscribe(r[t], t, e) }), this.listeners = r; var n = { AdParameters: this.adParams }, a = this.playerContainer.querySelector(".jw-media"), s = this.instream.getMediaElement(), o = this.iframe.contentWindow.document.createElement("div"); o.className = "jw-vpaid-wrapper", o.style.height = "100%", this.iframe.contentWindow.document.body.appendChild(o); var d = { videoSlot: s, slot: o }; e.initAd(a.clientWidth, a.clientHeight, "normal", 1e3, n, d), e.setAdVolume(t) }, s.prototype.play = function() { this.vpaidAd.resumeAd() }, s.prototype.pause = function() { this.vpaidAd.pauseAd() }, s.prototype.stop = function() { if (this.vpaidAd) try { this.vpaidAd.stopAd() } catch (t) { console.log("Unhandled exception from VPAID2 Creative stopAd", t) } }, s.prototype.setVolume = function(t) { this.vpaidAd.setAdVolume(t / 100) }, s.prototype.resize = function(t, e) { if (this.vpaidAd && this.vpaidAd.resizeAd) { var i = this.player.getFullscreen() || document.fullScreen || document.mozFullScreen || document.webkitIsFullScreen ? "fullscreen" : "normal"; this.vpaidAd.resizeAd(t || this.player.getWidth(), e || this.player.getHeight(), i) } }, s.prototype.destroy = function() { if (k(this.toRemove), this.removeEvents(), this.vpaidAd) try { var e = this.listeners, i = this.vpaidAd; Object.keys(e).forEach(function(t) { i.unsubscribe(e[t], t, i) }), i.unsubscribe(this.setMuteCallback, "AdVolumeChange", i) } catch (t) { console.log("Unhandled exception from VPAID2 Creative", t) } this.player = null, this.instream = null }, s.prototype.removeEvents = function() { this.player && this.player.off(null, null, this), this.off() }, s.prototype.attachMedia = function() {}, s.prototype.detachMedia = function() {}, s.prototype.volume = function() {}, s.prototype.mute = function() {}, s.prototype.getState = function() { return this.vpaidState.linear ? this.paused ? l : wt : "idle" }, s }(); function k(t) { for (; 0 < t.length;) { var e = t.pop(); e.parentNode && e.parentNode.removeChild(e) } } var Mt = {}, P = []; var Lt = function() { function o(t, e, i, r) { var n = this; g(this, o); var a, s = t || {}; this.map = s, this.debugTrackFn = e, this.trackerPlayerUtils = (a = i, { getPosition: function() { return a.getPosition() }, getFile: function() { return a.getPlaylistItem().file } }), this.trackingFilter = r, this.lastQuartile = 0, this.progressEvents = [], this.breakStarted = !1, this.started = !1, this.firedError = !1, this.hasComp = !1, Mt._.map(s, function(t, e) { if (s.hasOwnProperty(e) && 0 === e.indexOf("progress")) { var i = "" + e.split("_")[1], r = { key: e, offset: i, tracked: !1, percentage: !1 }; /^\d+%$/.test(i) ? (r.percentage = !0, r.offset = parseFloat(i)) : r.offset = Mt.utils.seconds(i), n.progressEvents.push(r) } }), this.setFactories() } return o.prototype.getUrls = function(t) { return this.map.hasOwnProperty(t) ? this.map[t] : [] }, o.prototype.addUrl = function(t, e) { this.map.hasOwnProperty(t) || (this.map[t] = []), this.map[t].push(e) }, o.prototype.trackPings = function(t) { var e = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {}, i = this.getUrls(t), r = this.trackingFilter, n = [], a = [], s = []; if (i.length) { e = this.replaceMacros(e), i.forEach(function(i) { if (i) { if (Mt._.each(e, function(t, e) { i = i.replace(e, t) }), r && !1 === r(i)) return void a.push(i); var t = new Image; t.src = i, n.push(i), s.push(t) } }), Array.prototype.push.apply(P, s); for (var o = P.length; o-- && (P[o].width || P[o].complete);) P.length = o } "function" == typeof this.debugTrackFn && this.debugTrackFn({ type: "ping", data: { pingType: t, urls: n, filteredUrls: a, images: s } }) }, o.prototype.replaceMacros = function(t) { var e, i, r, n, a, s, o; return t["[TIMESTAMP]"] = encodeURIComponent((e = new Date, i = e.getTime(), r = e.getTimezoneOffset() / 60, n = 6e4 * e.getTimezoneOffset(), new Date(i - n).toISOString().slice(0, -1) + (0 < r ? "-" : "+") + ("0" + r).slice(-2))), t["[CACHEBUSTING]"] = Math.random().toString().slice(2, 10), t["[ASSETURI]"] = encodeURIComponent(this.trackerPlayerUtils.getFile()), t["[CONTENTPLAYHEAD]"] = encodeURIComponent((a = this.trackerPlayerUtils.getPosition(), s = ("0" + Math.floor(a / 3600)).slice(-2), o = ("0" + Math.floor((a - 3600 * s) / 60)).slice(-2), s + ":" + o + ":" + ("0" + Math.floor(a - 3600 * s - 60 * o)).slice(-2) + "." + (a % 1).toFixed(3).toString().slice(2, 5))), t }, o.prototype.start = function() { this.started = !0, this.trackPings("start") }, o.prototype.breakStart = function() { this.breakStarted = !0, this.trackPings("breakStart") }, o.prototype.time = function(t, e) { if (!(e <= 1)) { for (var i = (4 * t + .05) / e | 0; i > this.lastQuartile && this.lastQuartile < 3;) this.lastQuartile++, 1 === this.lastQuartile ? this.trackPings("firstQuartile") : 2 === this.lastQuartile ? this.trackPings("midpoint") : 3 === this.lastQuartile && this.trackPings("thirdQuartile"); this.trackProgress(t, e) } }, o.prototype.trackProgress = function(t, e) { for (var i = this.progressEvents.length; i--;) { var r = this.progressEvents[i]; if (!r.tracked) { var n = r.offset; r.percentage && (n = e * n / 100), n <= t && (r.tracked = !0, this.trackPings(r.key)) } } }, o.prototype.error = function() { var t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 900; this.firedError = !0; var e = {}; e[d] = t, this.trackPings("error", e) }, o.prototype.factory = function(t) { var e = this; return function() { e.trackPings(t) } }, o.prototype.setFactories = function() { this.creativeView = this.factory("creativeView"), this.click = this.factory("click"), this.skip = this.factory("skip"), this.complete = this.factory("complete"), this.pause = this.factory("pause"), this.resume = this.factory("resume"), this.mute = this.factory("mute"), this.unmute = this.factory("unmute"), this.fullscreen = this.factory("fullscreen"), this.expand = this.factory("expand"), this.collapse = this.factory("collapse"), this.acceptInvitation = this.factory("acceptInvitation"), this.close = this.factory("close"), this.rewind = this.factory("rewind"), this.impression = this.factory("impression"), this.breakEnd = this.factory("breakEnd") }, o }(); function Bt(t) { var e = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 900, i = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 60900, r = {}; return r.message = t, r.code = e, r.adErrorCode = i, r } function T(t, e) { t.wrappedTags && (e.wrapperAdSystem = t.wrapper || "", e.tag = t.wrappedTags.pop(), e.wrappedTags = t.wrappedTags), e.adsystem = t.adsystem || "" } function Ot(t, e, i) { var r = t.vmap ? t.vmap : t.adschedule || t.adbreak; if (r && i[r.breakid]) { var n = i[r.breakid], a = n.bid.getEventObject(vt, n.bidders, {}); t.mediationLayerAdServer = a.mediationLayerAdServer, t.bidders = a.bidders, a.floorPriceCents && (t.floorPriceCents = a.floorPriceCents) } return t } function Ht(t, e) { var i = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : null; return { type: t, client: vt, adposition: null !== i ? i : function(t) { if (t.isBeforePlay() || 0 === t.getPosition()) return "pre"; if (t.isBeforeComplete() || t.getPosition() === t.getDuration()) return "post"; return "mid" }(e), viewable: e.getViewable() } } var jt = function() { function s(t, e, i, r, n, a) { g(this, s), this.player = e, this.staticPlayer = i, this.companion = r, this.optionalParams = n, this.debugTrackFn = a, this.scheduledAd = t.scheduledAd(), this.vastBuffet = t.adBuffet(), this.vastAdPod = t.adPod(), this.vastAd = this.vastBuffet.length ? this.vastBuffet[0] : null, this.adType = null, this.vpaidPlayer = null, this.instreamPlayer = null, this.blockingInstreamPlayer = null, this.mediaType = null, this.adPodItems = null, this.creativeTimeout = null, this.vastOptions = null, this.duration = 0, this.position = 0, this.adPodIndex = 0, this.initialIndex = 0, Vt(this, e.Events) } return s.prototype.init = function(t) { return this.init = function() { throw new Error("Adplayer can only be initialized once") }, this.blockingInstreamPlayer = t, !!this.prepareAdPod() && (this.player.on("fullscreen", this.playerFullscreenHandler, this), this.player.on("volume", this.playerVolumeHandler, this), this.player.on("mute", this.muteHandler, this), this.player.on("resize", this.playerResizeHandler, this), this.playAd()) }, s.prototype.prepareAdPod = function() { var e = this, t = null, i = 0, r = []; if (this.vastAd && (I(this.vastAd, this.debugTrackFn, this.player, this.optionalParams.trackingFilter), (t = this.prepareAdPodItem(this.vastAd)) && "vpaid" === t.adType && !E(this.vastAd) && (t = null)), this.vastAdPod) for (var n = null, a = 0; a < this.vastAdPod.length; a++) { var s = this.vastAdPod[a]; I(s, this.debugTrackFn, this.player, this.optionalParams.trackingFilter); var o = this.prepareAdPodItem(s); if (o) { if (n !== o.adType && "instream" === n) break; if (n = o.adType, "vpaid" !== o.adType || E(s)) { var d = r.length + i === a; o && d && r.push(o) } else i++ } else i++ } if (!r.length && !t) return this.adError("No Compatible Creatives", 403), !1; var l = void 0; return r.length ? (l = r, this.vastOptions = [], l.forEach(function(t) { e.vastOptions.push(e.getInstreamOptions(t.vastAd)) })) : (l = t, this.vastOptions = this.getInstreamOptions(this.vastAd)), this.adPodItems = l, !(this.adPodIndex = 0) }, s.prototype.prepareAdPodItem = function(t) { t.tracker.linear = "linear"; var e = ("" + t.media[0].adType).toLowerCase() || "instream"; "vpaid" !== e || E(t) || (e = "instream"); var i = { vastAd: t, sources: [], adType: e }; this.scheduledAd.skipoffset && (i.skipoffset = this.scheduledAd.skipoffset); var r, n, a = t.media, s = {}; if (Mt._.each(a, function(t) { i.sources.push({ file: t.file, mimeType: t.type, type: ("" + t.type).replace(/^(?:video|audio)\/(?:x-)?/, "") }), s[t.file] = { width: t.width || 0, height: t.height || 0 } }), "instream" === e && (i.sources = (r = i.sources, n = void 0, n = jwplayer.api.availableProviders.filter(function(t) { return "flash" !== t.name }), r.filter(function(e) { return n.some(function(t) { return t.supports(e) }) }))), 0 === i.sources.length) return null; this.mediaType = ("" + i.sources[0].mimeType).toLowerCase(), i.vastAd.selectedMedia = i.sources[0]; var o = this.player.getSafeRegion(!0), d = null, l = null; return i.sources.forEach(function(t) { var e = s[t.file]; e.width <= o.width && (!d || e.width > s[d.file].width) && (d = t), e.width >= o.width && (!l || e.width < s[l.file].width) && (l = t) }), d ? (i.vastAd.selectedMedia = d).default = !0 : l && ((i.vastAd.selectedMedia = l).default = !0), i }, s.prototype.getInstreamOptions = function(t) { var e = 0 <= this.optionalParams.skipoffset ? this.optionalParams.skipoffset : null; return { skipoffset: t.skipoffset || this.scheduledAd.skipoffset || e, skipMessage: this.optionalParams.skipMessage, skipText: this.optionalParams.skipText } }, s.prototype.getVastAd = function(t) { if (this.adPodItems) { var e = void 0; if ((e = this.adPodItems.length ? this.adPodItems[t] : this.adPodItems).vastAd) return e.vastAd } else if (this.vastAdPod && this.vastAdPod.length) return this.vastAdPod[t]; return this.vastAd }, s.prototype.adError = function(t, e, i) { clearTimeout(this.creativeTimeout); var r = this.getVastAd(this.adPodIndex), n = Bt(t, e, i = i || (e ? 1e4 + e : null)); (n.creativeId = r.creativeId || "", w(r, n), b(r, n), this.vastAdPod && this.adPodIndex < this.vastAdPod.length - 1) ? this.triggerEvent("adPodError", n): (r.tracker.error(n.code), T(r, n), this.addConditionalAdData(n), this.triggerEvent(St, n)) }, s.prototype.playAd = function() { var t = this.adPodItems[this.adPodIndex] || this.adPodItems; if (this.adType = t.adType, this.blockingInstreamPlayer) { var e = this.player.getConfig().localization.loadingAd; this.blockingInstreamPlayer.setText(e) } if ("vpaid" === this.adType) return this.playVpaid(t.vastAd); if ("static" === this.adType) return this.playStatic(), !0; var i = Array.isArray(this.adPodItems) ? this.adPodItems.slice(this.adPodIndex) : this.adPodItems, r = Array.isArray(this.vastOptions) ? this.vastOptions.slice(this.adPodIndex) : this.vastOptions; return this.initialIndex = this.adPodIndex, this.playInstream(i, r) }, s.prototype.clearVpaidBlocking = function() { if (this.vpaidPlayer.instream) { var t = this.vpaidPlayer.instream; this.vpaidPlayer.instream = null, this.clearBlocking(t) } }, s.prototype.clearBlocking = function(t) { (t = t || this.blockingInstreamPlayer) && t !== this.instreamPlayer && t.destroy() }, s.prototype.getState = function() { return this.instreamPlayer ? this.instreamPlayer.getState() : this.vpaidPlayer ? this.vpaidPlayer.getState() : "" }, s.prototype.clearNonlinear = function() { this.staticPlayer.stop(), this.vpaidPlayer && (this.clearVpaidBlocking(), this.vpaidPlayer && (this.vpaidPlayer.stop(), this.vpaidPlayer.destroy(), this.vpaidPlayer = null)) }, s.prototype.destroy = function() { if (this.off(), this.removePlayerListeners(), clearTimeout(this.creativeTimeout), this.instreamPlayer) { var t = this.instreamPlayer; this.instreamPlayer = null, this.clearBlocking(t) } this.vpaidPlayer && (this.clearVpaidBlocking(), this.vpaidPlayer && (this.vpaidPlayer.destroy(), this.vpaidPlayer = null)), this.clearNonlinear(), this.vastLoader = null, this.player = null, this.instreamPlayer = null, this.scheduledAd = null, this.vastBuffet = null, this.vastAd = null, this.vastAdPod = null }, s.prototype.pause = function() { this.instreamPlayer ? this.instreamPlayer.pause() : this.vpaidPlayer && this.vpaidPlayer.pause() }, s.prototype.play = function() { this.instreamPlayer ? this.instreamPlayer.play() : this.vpaidPlayer && this.vpaidPlayer.play() }, s.prototype.removePlayerListeners = function() { this.player && (this.player.off("fullscreen", this.playerFullscreenHandler, this), this.player.off("volume", this.playerVolumeHandler, this), this.player.off("mute", this.muteHandler, this)), this.instreamPlayer && this.instreamPlayer.off(null, null, this), this.vpaidPlayer && (this.vpaidPlayer.removeEvents(), this.clearVpaidBlocking(), this.vpaidPlayer && (this.vpaidPlayer.destroy(), this.vpaidPlayer = null)), this.staticPlayer.stop(), this.staticPlayer.removeEvents() }, s.prototype.adEventObject = function(t) { var e = this.scheduledAd._adQueue || {}, i = { id: this.scheduledAd._id, tag: this.scheduledAd._currentTag, client: vt, witem: this.scheduledAd._waterfallIndex || 1, wcount: e.length || 1, viewable: this.player.getViewable() }; if (this.scheduledAd._adbreak && (i.adschedule = this.scheduledAd._adbreak, i.adschedule.offset = this.scheduledAd._offSet), this.adPodItems && this.adPodItems.length && (i.sequence = this.adPodIndex + 1, i.podcount = this.adPodItems.length), this.mediaType && (i.creativetype = this.mediaType), this.scheduledAd._vmap && (i.vmap = this.scheduledAd._vmap), -1 !== v.indexOf(t)) { var r = this.getVastAd(this.adPodIndex); i.universalAdIdRegistry = r.universalAdIdRegistry, i.universalAdIdValue = r.universalAdIdValue, i.categories = r.categories } return i }, s.prototype.playStatic = function() { this.vastAd.tracker.linear = "nonlinear"; var t = this.vastAd.media[0]; this.vastAd.selectedMedia = t; var e = this.vastAd.clickthrough || "", i = this.staticPlayer; i.removeEvents(), i.on("play", this.impressionHandler, this), i.on("play", this.playHandler, this), i.on("complete", this.combinedCompleteHandler, this), i.on("click", this.clickStaticHandler, this), i.on("error", this.staticErrorHandler, this), i.playAd(t.file, e, t.minDuration, this.scheduledAd._currentTag, this.scheduledAd.requestTimeout), this.clearBlocking() }, s.prototype.creativeAdError = function(t, e, i) { this.adError(t, e, i), this.adPodItems && this.adPodItems.length - 1 > this.adPodIndex && (this.vpaidPlayer && (this.vpaidPlayer.destroy(), this.vpaidPlayer = null), this.adPodIndex++, this.playAd()) }, s.prototype.playVpaid = function(t) { var e = this; clearTimeout(this.creativeTimeout), this.creativeTimeout = setTimeout(function() { e.creativeAdError("VPAID tag communication timeout", 900, 50004) }, this.scheduledAd.creativeTimeout); var i = E(this.vastAd = t), r = this.optionalParams.conditionaladoptout && t.conditionalAd; if (this.vastAd.selectedMedia = i, this.mediaType = i.type, "flash" === _(i)) return this.creativeAdError("Flash creatives are not supported", 403, 10403), !1; var n = { adParams: this.vastAd.adParams, vpaidControls: this.optionalParams.vpaidcontrols, adOptOut: r }; return this.vpaidPlayer = new A(this.player, this.blockingInstreamPlayer, i.file, this.scheduledAd._currentTag, n), this.blockingInstreamPlayer && this.blockingInstreamPlayer.applyProviderListeners(this.vpaidPlayer), this.vpaidPlayer.on("play", this.playHandler, this), this.vpaidPlayer.on("pause", this.pauseHandler, this), this.vpaidPlayer.on("quartile", this.quartileHandler, this), this.vpaidPlayer.on("remainingTimeChange", this.remainingTimeHandler, this), this.vpaidPlayer.on("click", this.clickVpaidHandler, this), this.vpaidPlayer.on("error", this.playbackErrorHandler, this), this.vpaidPlayer.on("impression", this.impressionHandler, this), this.vpaidPlayer.on("expandedChange", this.vpaidExpandedHandler, this), this.vpaidPlayer.on("close", this.adCloseHandler, this), this.vpaidPlayer.on("skipped", this.vpaidAdSkipped, this), this.vpaidPlayer.on("stopped", this.endOfVpaidAdHandler, this), this.vpaidPlayer.on("complete", this.adCompleteHandler, this), this.vpaidPlayer.on("started", this.adStartedHandler, this), this.setupSkipButton(), !0 }, s.prototype.setupSkipButton = function() { var t = this.optionalParams.skipoffset; 0 <= t && this.blockingInstreamPlayer && (this.blockingInstreamPlayer.off(i, this.skipVpaidAd, this), this.blockingInstreamPlayer.setupSkipButton(t, this.optionalParams, Mt.utils.noop), this.blockingInstreamPlayer.on(i, this.skipVpaidAd, this)) }, s.prototype.playInstream = function(t, e) { var i = this, r = this.player.getEnvironment().OS; return r.android && 2 === r.version.major && 3 === r.version.minor ? (this.adError("Android 2.3 not supported", 900, 60007), !1) : (clearTimeout(this.creativeTimeout), this.creativeTimeout = setTimeout(function() { i.creativeAdError("VAST tag communication timeout", 900, 60004) }, this.scheduledAd.creativeTimeout), this.blockingInstreamPlayer ? this.instreamPlayer = this.blockingInstreamPlayer : this.instreamPlayer = this.player.createInstream().init(), this.instreamPlayer.on("play", this.playHandler, this), this.instreamPlayer.on("pause", this.pauseHandler, this), this.instreamPlayer.on("time", this.timeHandler, this), this.instreamPlayer.on("playlistItem", this.playlistItemHandler, this), this.instreamPlayer.on("complete", this.adCompleteHandler, this), this.instreamPlayer.on("playlistComplete", this.endOfAdBreakHandler, this), this.instreamPlayer.on("mute", this.muteHandler, this), this.instreamPlayer.on("instreamClick", this.clickInstreamHandler, this), this.instreamPlayer.on("adSkipped", this.adSkipped, this), this.instreamPlayer.on("error", this.playbackErrorHandler, this), this.instreamPlayer.on("mediaError", this.playbackErrorHandler, this), this.instreamPlayer.on("destroyed", function() { i.instreamPlayer = null }, this), this.instreamPlayer.loadItem(t, e), this.clearBlocking(), !0) }, s.prototype.playerFullscreenHandler = function(t) { var e = this.getVastAd(this.adPodIndex).tracker; t.fullscreen && e.started && e.fullscreen() }, s.prototype.playerResizeHandler = function(t) { this.vpaidPlayer && this.vpaidPlayer.resize(t.width, t.height) }, s.prototype.playerVolumeHandler = function(t) { this.vpaidPlayer && this.vpaidPlayer.setVolume(t.volume) }, s.prototype.playlistItemHandler = function(t) { this.instreamPlayer && (this.adPodIndex = t.index + this.initialIndex) }, s.prototype.impressionHandler = function(t) { var e = this.getVastAd(this.adPodIndex), i = e.tracker; i.impression(); var r = {}; r.adposition = this.scheduledAd._position || "", r.adtitle = e.adTitle || "", r.creativeId = e.creativeId || "", T(e, r), r.vastversion = e.vastversion, r.clickThroughUrl = e.clickthrough, r.duration = e.duration || 0, r.mediafile = { file: e.selectedMedia.file }, r.linear = t.linear || i.linear, this.addConditionalAdData(r), w(e, r), b(e, r), this.triggerEvent(xt, r) }, s.prototype.playHandler = function(t) { clearTimeout(this.creativeTimeout); var e, i, r = this.getVastAd(this.adPodIndex), n = r.tracker, a = void 0; if (n.started) t.oldstate === l && (n.resume(), this.dispatchPlay(t)); else { this.vpaidPlayer && (n.linear = t.linear), this.instreamPlayer && this.impressionHandler({ linear: n.linear }); var s = Vt({ linear: n.linear }, this.getInstreamOptions(r)); s.adMessage = this.optionalParams.dynamicMessage || "", s.clickThroughUrl = r.clickthrough, s.sequence && (s.podMessage = this.optionalParams.podMessage || ""), r.adTitle && (s.adtitle = r.adTitle), r.companions && (s.companions = r.companions), b(r, s), this.triggerEvent(h, s), r.companions && ((a = {}).companions = (i = r.companions, Mt._.map(i, function(t) { var e = "iframe" === t.type || "html" === t.type ? t.type : "static", i = void 0; return t.trackers && t.trackers.creativeView && t.trackers.creativeView.length && (i = t.trackers.creativeView), { width: t.width, height: t.height, type: e, resource: t.source, creativeview: i, click: t.clickthrough } })), a.universalAdIdRegistry = r.companionUniversalAdIdRegistry, a.universalAdIdValue = r.companionUniversalAdIdValue, this.triggerEvent("adCompanions", a)); var o = this.companion, d = void 0; 9 < Mt.utils.flashVersion() ? d = r.companions : (e = r.companions, d = Mt._.filter(e, function(t) { return t.type.indexOf("flash") < 0 })), this.optionalParams.companion && d && d.length && (n.hasComp = o.addCompanion(this.optionalParams.companion, d)), n.start(), n.creativeView(), this.dispatchPlay(t) } }, s.prototype.dispatchPlay = function(t) { if ("static" !== this.adType && ("vpaid" !== this.adType || "linear" === t.linear)) { var e = t.oldstate, i = t.newstate, r = {}; r.oldstate = e, r.newstate = i, this.triggerEvent(p, r), this.vpaidPlayer && this.vpaidPlayer.trigger(n, r) } }, s.prototype.pauseHandler = function(t) { this.getVastAd(this.adPodIndex).tracker.pause(); var e = t.oldstate, i = t.newstate, r = {}; r.oldstate = e, r.newstate = i, this.triggerEvent(o, r), this.vpaidPlayer && this.vpaidPlayer.trigger(n, { newstate: i, oldstate: e }) }, s.prototype.remainingTimeHandler = function(t) { t.duration ? this.duration = t.duration : this.duration = Math.max(1, this.duration, t.remainingTime); var e = 0 <= t.remainingTime ? this.duration - t.remainingTime : 0; this.timeHandler({ position: e, duration: this.duration, isDurationChange: t.isDurationChange }) }, s.prototype.quartileHandler = function(t) { if (t.duration) this.duration = t.duration; else { var e = 4 * t.remainingTime / (4 - t.quartile); this.duration = Math.max(this.duration, 1, e) } this.timeHandler({ position: this.duration * t.quartile * .25, duration: this.duration }) }, s.prototype.timeHandler = function(t) { var e = this.getVastAd(this.adPodIndex), i = t.position, r = t.duration, n = r - i, a = e.tracker, s = this.optionalParams.dynamicMessage || "", o = this.optionalParams.podMessage || ""; if (s && 0 < n) { if (s = s.replace(/xx/gi, "" + Math.ceil(n)), this.adPodItems && 1 < this.adPodItems.length && o) { var d = this.adPodIndex + 1; s = (o = (o = o.replace(/__AD_POD_CURRENT__/g, "" + d)).replace(/__AD_POD_LENGTH__/g, "" + this.adPodItems.length)) + " " + s } this.instreamPlayer ? this.instreamPlayer.setText(s) : this.vpaidPlayer && this.vpaidPlayer.instream && this.vpaidPlayer.instream.setText(s) } if (!t.isDurationChange) { a && a.time(i, r); var l = {}; l.position = this.position = i, l.duration = r, this.triggerEvent("adTime", l) } }, s.prototype.combinedCompleteHandler = function() { this.adCompleteHandler(), this.endOfAdBreakHandler() }, s.prototype.adCompleteHandler = function() { var t = this.getVastAd(this.adPodIndex).tracker; t.firedError || (t.complete(), this.triggerEvent(Ct)) }, s.prototype.adCloseHandler = function() { var t = this.getVastAd(this.adPodIndex).tracker; t.firedError || t.close() }, s.prototype.adStartedHandler = function() { this.triggerEvent(t) }, s.prototype.endOfVpaidAdHandler = function() { if (this.adPodItems && this.adPodItems.length - 1 > this.adPodIndex) return this.vpaidPlayer && (this.vpaidPlayer.destroy(), this.vpaidPlayer = null), this.adPodIndex++, void this.playAd(); this.endOfAdBreakHandler() }, s.prototype.endOfAdBreakHandler = function() { this.removePlayerListeners(), this.trigger(Ct) }, s.prototype.muteHandler = function(t) { var e = this.getVastAd(this.adPodIndex).tracker; e && (t.mute ? (e.mute(), this.vpaidPlayer && this.vpaidPlayer.setVolume(0)) : (e.unmute(), this.vpaidPlayer && this.vpaidPlayer.setVolume(this.player.getVolume() / 100))) }, s.prototype.clickStaticHandler = function() { var t = this.getVastAd(this.adPodIndex); this.player.pause(!0), this.clickThrough(t) }, s.prototype.clickVpaidHandler = function(t) { var e = this.getVastAd(this.adPodIndex), i = !0; t && t.url && (!1 === t.playerHandles && (i = !1), e.clickthrough = t.url), this.clickThrough(e, i) }, s.prototype.clickInstreamHandler = function() { this.instreamPlayer.getState() !== l && this.clickThrough(this.getVastAd(this.adPodIndex)) }, s.prototype.clickThrough = function(t) { var e = !(1 < arguments.length && void 0 !== arguments[1]) || arguments[1]; t.tracker.click(); var i = {}; t.clickthrough && (i.clickThroughUrl = t.clickthrough), this.triggerEvent(r, i), window.jwcast && window.jwcast.player.id || t.clickthrough && e && window.open(t.clickthrough) }, s.prototype.skipVpaidAd = function() { this.endOfVpaidAdHandler(), this.vpaidAdSkipped() }, s.prototype.vpaidAdSkipped = function() { this.adSkipped(), this.endOfVpaidAdHandler() }, s.prototype.adSkipped = function() { var t = this.getVastAd(this.adPodIndex); t.tracker.skip(); var e = this.optionalParams.skipoffset; this.triggerEvent(i, { duration: t.duration, skipoffset: e, position: this.position, watchedPastSkipPoint: this.position - e }) }, s.prototype.playbackErrorHandler = function(t) { var e = t.message || "Error Playing Ad Tag", i = t.code; (!i || i <= 4) && (i = 400), this.vpaidPlayer && "function" == typeof this.vpaidPlayer.off ? (this.vpaidPlayer.off(), this.creativeAdError(e, i, t.adErrorCode)) : this.adError(e, i, t.adErrorCode) }, s.prototype.staticErrorHandler = function() { this.adError("Unable to fetch NonLinear resource", 502) }, s.prototype.vpaidExpandedHandler = function(t) { var e = this.getVastAd(this.adPodIndex).tracker; t.expanded ? e.expand() : e.collapse() }, s.prototype.triggerEvent = function(t, e) { var i = this.adEventObject(t); e && Vt(i, e), -1 !== m.indexOf(t) ? this.trigger(t, i) : this.player.trigger(t, i) }, s.prototype.addConditionalAdData = function(t) { this.vastAd && (t.conditionalAd = this.vastAd.conditionalAd), this.vastAdPod && this.vastAdPod.length && (t.conditionalAd = this.vastAdPod[this.adPodIndex].conditionalAd), t.conditionalAdOptOut = this.optionalParams.conditionaladoptout }, s }(); function w(t, e) { "boolean" == typeof t.mediaFileCompliance && (e.mediaFileCompliance = t.mediaFileCompliance, t.nonComplianceReasons && (e.nonComplianceReasons = t.nonComplianceReasons)) } function b(t, e) { e.request = t.request, e.response = t.response } function _(t) { return "application/javascript" === (e = t).type || "application/x-javascript" === e.type ? "html5" : "flash"; var e } function E(t) { for (var e = void 0, i = 0; i < t.media.length; i++) { var r = t.media[i]; if ("html5" === _(r)) { e = r; break } } return e } function I(t, e, i, r) { t.tracker = new Lt(t.trackers, e, i, r) } var qt = function() { function i(t, e) { g(this, i), this.debugTrackFn = t, this.div = null, this.elem = null, this.environment = e } return i.prototype.addCompanion = function(t, e) { if (this.div = t, this.elem = document.getElementById(this.div.id), !this.elem) return !1; for (var i = 0; i < e.length; i++) if (this.fitsDiv(e[i])) return this.placeCompanion(e[i]), !0; return !1 }, i.prototype.removeCompanion = function() { this.elem.innerHTML = "" }, i.prototype.sendPings = function(t) { (t = t.creativeView) && (t.forEach(function(t) { (new Image).src = t }), "function" == typeof this.debugTrackFn && this.debugTrackFn({ type: "companion", data: { trackers: t } })) }, i.prototype.placeCompanion = function(t) { if (this.removeCompanion(), "html" === t.type) { var e = document.createElement("div"); e.innerHTML = t.source; var i = e.getElementsByTagName("script"); return i.length && Mt._.map(i, function(t) { new Mt.utils.scriptloader(t.src).load(), t.parentElement.removeChild(t) }), this.elem.appendChild(e), void this.sendPings(t.trackers) } if ("iframe" === t.type) { var r = document.createElement("iframe"); return r.height = this.div.height, r.width = this.div.width, r.src = t.source, r.scrolling = "no", r.style.border = "none", r.marginWidth = 0, r.marginHeight = 0, this.sendPings(t.trackers), this.elem.innerHTML = "", void this.elem.appendChild(r) } if ("application/x-shockwave-flash" === t.type) { var n = document.createElement("object"); return n.setAttribute("type", "application/x-shockwave-flash"), n.setAttribute("data", t.source), n.setAttribute("width", "100%"), n.setAttribute("height", "100%"), n.setAttribute("tabindex", 0), C(n, "allowfullscreen", "true"), C(n, "allowscriptaccess", "always"), C(n, "seamlesstabbing", "true"), C(n, "wmode", "opaque"), this.elem.appendChild(n), void this.sendPings(t.trackers) } var a = new Image; a.src = t.source, Mt.utils.exists(t.clickthrough) && (a.onclick = function() { window.open(t.clickthrough, "_blank").focus() }), this.elem.innerHTML = "", this.elem.appendChild(a), this.sendPings(t.trackers) }, i.prototype.fitsDiv = function(t) { return t.width === this.div.width && t.height === this.div.height }, i }(); function C(t, e, i) { var r = document.createElement("param"); r.setAttribute("name", e), r.setAttribute("value", i), t.appendChild(r) } var Ft = function() { function e(t) { g(this, e), this.preRoll = null, this.vmap = null, this.postRoll = null, this.midRolls = [], this.playedMidRolls = [], this.adRules = t, this.duration = 0 } return e.prototype.setPreRoll = function(t) { this.preRoll = t }, e.prototype.getPreRoll = function(t) { if (t) { if ("none" === this.adRules.startOnSeek) return null } else this.adRules.clearStartOnSeek(); return S(this.preRoll, this.requestTimeout, this.creativeTimeout) }, e.prototype.getPostRoll = function() { var t = S(this.postRoll, this.requestTimeout, this.creativeTimeout); return this.adRules.timeBetweenAdsAllowsAdPlayback(t) ? t : null }, e.prototype.getMidRollAtIndex = function(t) { return S(this.midRolls[t], this.requestTimeout, this.creativeTimeout) }, e.prototype.getLastMidRollIndexBetweenTime = function(t, e, i) { if (e < t) return null; this.sort(i); for (var r = this.midRolls.length; r--;) { var n = this.midRolls[r], a = x(this.midRolls[r]._offSet, i); if (a <= t) return null; if (a <= e) { var s = S(n, this.requestTimeout, this.creativeTimeout); if (!this.adRules.timeBetweenAdsAllowsAdPlayback(s)) return null; if (!this.adRules.timeBetweenAds) { if (0 <= this.playedMidRolls.indexOf(r)) return null; this.playedMidRolls.push(r) } return r } } return null }, e.prototype.getNextMidrollIndex = function(t, e, i) { if (this.adRules.timeBetweenAds || this.adRules.startOnSeek) return this.getLastMidRollIndexBetweenTime(t, e, i); if (this.midRolls.length > this.playedMidRolls.length) { var r = this.getClosestIndex(e, i); if (0 <= r && this.playedMidRolls.indexOf(r) < 0) return this.playedMidRolls.push(r), r } return null }, e.prototype.getMidRolls = function() { var e = this; return this.midRolls.map(function(t) { return S(t, e.requestTimeout, e.creativeTimeout) }) }, e.prototype.reset = function() { this.playedMidRolls = [], this.duration = 0 }, e.prototype.addMidRoll = function(t) { this.midRolls.push(t), this.duration = 0 }, e.prototype.setPostRoll = function(t) { this.postRoll = t }, e.prototype.sort = function(i, t) { (!i || i < 1) && (i = 1), (this.duration !== i || t) && (this.duration = i, this.midRolls.sort(function(t, e) { return x(t._offSet, i) - x(e._offSet, i) }), function(t, e) { for (var i = 0; i < t.length; i++) { var r = t[i]; e ? r._vmap.item = i + 1 : r._adbreak = { item: i + 1, tags: r._adQueue, breakid: r._breakId } } }(this.getAllAds(), t)) }, e.prototype.getAllAds = function() { var t = this.preRoll ? [this.preRoll] : [], e = this.postRoll ? [this.postRoll] : []; return t.concat(this.midRolls, e) }, e.prototype.getAdScheduleEventObject = function() { var t = this.getAllAds(), r = [], e = { tag: this.getVMAP(), client: "vast", adbreaks: [] }; return Mt.utils.foreach(t, function(t, e) { var i = { type: e._type, offset: e._offSet }; e._vmap ? i.vmap = e._vmap : i.adbreak = Vt({}, e._adbreak), r.push(i) }), e.adbreaks = r, e }, e.prototype.setVMAP = function(t) { this.vmap = t }, e.prototype.isVMAP = function() { return !!this.vmap }, e.prototype.getVMAP = function() { return this.vmap }, e.prototype.getClosestIndex = function(t, e) { this.sort(e); for (var i = this.midRolls.length; i--;) if (t >= x(this.midRolls[i]._offSet, e)) return i; return -1 }, e }(); function S(t, e, i) { var r = void 0; if (Mt.utils.foreach(t, function(t, e) { (r = r || {})[t] = "_adQueue" === t ? e.slice() : e }), r) return r.requestTimeout = e, r.creativeTimeout = i, r } function x(t, e) { return "%" === t.toString().slice(-1) ? e * parseFloat(t.slice(0, -1)) / 100 : parseFloat(t) } var Dt = function() { function t() { g(this, t) } return t.prototype.getSchedule = function(t, e) { var i = new Ft(e); if (i.requestTimeout = V(t.requestTimeout, At), i.creativeTimeout = V(t.creativeTimeout, kt), t.tag) i.setPreRoll({ _offSet: "pre", _adQueue: R(t.tag), _waterfallIndex: 0 }); else if ("string" == typeof t.vastxml) i.setPreRoll({ _offSet: "pre", _adXML: t.vastxml }); else { if ("string" == typeof t.schedule) return i.setVMAP(t.schedule), i; if ("string" == typeof t.adschedule) return i.setVMAP(t.adschedule), i; ! function(h, p) { var u = p.schedule || p.adschedule; if (!u) return; Object.keys(u).forEach(function(t) { var e = u[t]; e.ad && (Vt(e, e.ad), delete e.ad); var i = function(t) { if ("start" === t || "0%" === t || !t && 0 !== t) return "pre"; if ("end" === t || "100%" === t) return "post"; if ("pre" === t || "post" === t || -1 < Mt._.indexOf(t, "%")) return t; var e = Mt.utils.seconds(t); if ("number" == typeof e) return e; return !1 }(e.offset), r = V(e.requestTimeout, At), n = V(e.creativeTimeout, kt), a = { _offSet: i, _type: e.type, _breakId: t, requestTimeout: r, creativeTimeout: n }; !1 === i && Mt.utils.log("Error: ad offset format not supported", i); var s = e.skipoffset || p.skipoffset; void 0 !== s && (a.skipoffset = s); var o = e.adbreakid; o && (a.adbreakid = o); var d = e.adtagid; if (d && (a._adTagQueue = R(d)), e.tag) { var l = function(t, e) { if (!e) return t; var i = 0 <= t.indexOf("?") ? "&" : "?", r = "cust_params=", n = t.indexOf(r), a = r.length, s = "", o = ""; if (Mt.utils.foreach(e, function(t, e) { s = "" + s + o + t + "=" + e, o = "&" }), s = encodeURIComponent(s), 0 <= n) { var d = t.substr(0, n + a), l = t.substr(n + a); return "" + d + s + "%26" + l } return "" + t + i + "cust_params=" + s }(e.tag, e.custParams); a._adQueue = R(l), a._waterfallIndex = 0 } else { if ("string" != typeof e.vastxml) return void Mt.utils.log("Error: no ad tag provided"); a._adXML = e.vastxml } switch (i) { case "pre": h.setPreRoll(a); break; case "post": h.setPostRoll(a); break; default: h.addMidRoll(a) } }) }(i, t) } return i.sort(), i }, t.prototype.getOptParams = function(t) { var e = { cuetext: t.cuetext || "Advertisement", dynamicMessage: t.admessage || "This ad will end in xx", podMessage: t.podmessage || "Ad __AD_POD_CURRENT__ of __AD_POD_LENGTH__. ", skipoffset: t.skipoffset || -1, skipMessage: t.skipmessage || "Skip ad in xx", skipText: t.skiptext || "Skip", vpaidcontrols: t.vpaidcontrols || !1, conditionaladoptout: t.conditionaladoptout || !1, requestFilter: t.requestFilter, trackingFilter: t.trackingFilter }, i = t.companiondiv; return i && (e.companion = { id: i.id, height: i.height, width: i.width }), e }, t.prototype.getAdRules = function(t) { var e = t.rules || {}; return { startOn: e.startOn || 1, frequency: void 0 !== e.frequency ? e.frequency : 1, timeBetweenAds: e.timeBetweenAds || 0, startOnSeek: e.startOnSeek || null } }, t }(); function R(t) { return "string" == typeof t ? [t] : Array.isArray(t) ? t.slice(0) : t } function V(t, e) { return 0 === t ? 1 / 0 : t || e } var M = document.createElement("img"), L = document.createElement("img"); M.src = L.src = 'data:image/svg+xml;charset=UTF-8,', M.className = "jw-vast-nonlinear-open-button", L.className = "jw-vast-nonlinear-close-button"; var B = { cursor: "pointer", position: "absolute", margin: "auto", left: 0, right: 0, bottom: 0, display: "block" }, O = "opacity 0.2s", H = { "-webkit-transition": O, transition: O }; function j(t, e) { Mt.utils.style(t, { opacity: e || 1 }) } function q(t) { Mt.utils.style(t, { opacity: 0 }) } function F() { j(L) } function D() { j(L, .75) } function U() { j(M) } function N() { j(M, .5) } var Q = function() { function a(t, e, i, r, n) { g(this, a), this.player = t, this.environment = t.getEnvironment(), this.div = r, this.staticURL = e, this.clickURL = i, this.loadTimer = -1, this.animationTimer = -1, this.banner = null, Vt(this, t.Events), this.banner = document.createElement("img"), this.banner.className = "jw-banner", this.banner.id = this.player.id + "_vast_static", q([L, M]), this.remove(M), this.div.appendChild(this.banner), this.div.appendChild(L), this.loadTimer = setTimeout(this.imageLoadError.bind(this), n), this.banner.onerror = this.imageLoadError.bind(this), this.banner.onload = this.onLoaded.bind(this), this.banner.src = this.staticURL } return a.prototype.onLoaded = function() { clearTimeout(this.loadTimer), 0 !== this.banner.naturalWidth ? (this.removeBannerEventListeners(), Mt.utils.style(L, { top: -this.banner.height - 8, bottom: this.banner.height - 8, left: this.banner.width }, !0), Mt.utils.style(M, { top: -16 }, !0), j([this.div, this.banner]), j(L, .75), new Mt.utils.UI(this.banner).on("click tap", this.sendClick.bind(this)), this.environment.OS.mobile && (this.div.onmouseover = F, this.div.onmouseout = D), L.onclick = L.ontouchstart = this.collapse.bind(this), M.onclick = M.ontouchstart = this.expand.bind(this), this.trigger(u)) : this.imageLoadError() }, a.prototype.imageLoadError = function() { clearTimeout(this.loadTimer), this.trigger(c), this.removeBanner() }, a.prototype.sendClick = function() { this.trigger(s) }, a.prototype.collapse = function(t) { var e = this; - 1 === this.animationTimer && (t.preventDefault(), this.div.onmouseover = this.div.onmouseout = null, q([this.banner, L, M]), this.div.appendChild(M), this.animationTimer = setTimeout(function() { e.remove(e.banner), e.remove(L), j(M, .5), e.div.onmouseover = U, e.div.onmouseout = N, e.animationTimer = -1 }, 250)) }, a.prototype.expand = function(t) { var e = this; - 1 === this.animationTimer && (t.preventDefault(), this.div.onmouseover = this.div.onmouseout = null, this.div.appendChild(this.banner), this.div.appendChild(L), this.animationTimer = setTimeout(function() { j([e.banner, L]), e.div.onmouseover = F, e.div.onmouseout = D, e.animationTimer = -1 }, 50), q(M)) }, a.prototype.remove = function(t) { this.div.contains(t) && this.div.removeChild(t) }, a.prototype.removeBannerEventListeners = function() { this.banner.onload = this.banner.onerror = null }, a.prototype.removeBanner = function() { this.removeBannerEventListeners(), this.remove(this.banner) }, a.prototype.removeListeners = function() { clearTimeout(this.loadTimer), clearTimeout(this.animationTimer), this.div.onmouseover = this.div.onmouseout = L.onclick = M.onclick = null, this.off(), this.removeBannerEventListeners() }, a.prototype.stop = function() { q([this.div, this.banner, L, M]), setTimeout(this.removeBanner.bind(this), 400), this.remove(L), this.remove(M) }, a }(), Ut = function() { function i(t, e) { g(this, i), this.player = t, this.div = e, this.startTime = 0, this.minDur = 0, this.environment = t.getEnvironment(), Vt(this, t.Events), this.type = "static", t.on("time", this.dispatchTime, this) } return i.prototype.playAd = function(t, e, i, r, n) { this.minDur = Mt.utils.seconds(i), this.adTag = r, this.static && (this.static.removeListeners(), this.static.stop()), this.div.style.opacity = 0, this.div.style.visibility = "visible"; var a = this.environment.Browser.firefox ? {} : H; Mt.utils.style(this.div, Mt.utils.extend({ top: "", position: "absolute", width: "100%" }, a)), Mt.utils.style([L, M], Vt({ width: "18px", height: "18px", opacity: .75 }, B, a)), Mt.utils.style(L, { transform: "rotate(45deg)" }), this.static = new Q(this.player, t, e, this.div, n), this.static.on(u, this.startAd, this), this.static.on(s, this.clickHandler, this), this.static.on(c, this.errorHandler, this) }, i.prototype.dispatchTime = function(t) { this.trigger(e, t) }, i.prototype.startAd = function() { this.startTime = this.player.getPosition(), 0 < this.minDur && (0 === this.startTime ? this.on(e, this.startTimingAd, this) : this.on(e, this.timeAd, this)), this.sendEvent(u) }, i.prototype.startTimingAd = function(t) { this.startTime = t.position, this.off(e, this.startTimingAd, this), this.on(e, this.timeAd, this) }, i.prototype.timeAd = function(t) { t.position - this.startTime > this.minDur && (this.off(e, this.timeAd, this), this.stop()) }, i.prototype.clickHandler = function() { this.sendEvent(s) }, i.prototype.errorHandler = function() { this.sendEvent(c) }, i.prototype.sendEvent = function(t, e) { (e = e || {}).tag = e.tag || this.adTag, this.trigger(t, e) }, i.prototype.removeEvents = function() { this.off() }, i.prototype.getState = function() { return wt }, i.prototype.stop = function() { this.startTime && this.static && (this.startTime = 0, this.minDur = 0, this.off(e, this.startTimingAd, this), this.off(e, this.timeAd, this), this.static.removeListeners(), this.static.stop(), this.sendEvent(f)) }, i.prototype.pause = function() {}, i }(); function Nt(t, e, i) { var r = Bt(e, 1002, 11002); r.id = i, t.push(r) } function Qt() { var t = new Error("No AdBreaks in VMAP"); throw t.adErrorCode = 60005, t } var X = function() { function e(t) { g(this, e), this._parsedAds = [], this._error = null, this._version = null, t && this.parse(t) } return e.prototype.parsedAds = function() { return this._parsedAds }, e.prototype.error = function() { return this._error }, e.prototype.version = function() { return this._version }, e.prototype.parse = function(i, r) { var n = this, t = void 0, a = void 0; "VAST" === i.nodeName ? t = i : (t = Xt(i, "VAST")[0]) || (t = Xt(i, "VideoAdServingTemplate")[0]), t || this.throwError(101, "Invalid VAST response"), a = "VideoAdServingTemplate" === t.tagName ? 1 : parseFloat(Wt(t, "version") || 0), this._version = a; var e, s = Xt(t, "Ad"), o = Mt._.map(s, function(t) { var e = n.parseAd(a, t); return e.vastversion = a, e.response = i, e.request = r || null, e }); this._parsedAds = o, this._parsedAds.length || (e = Xt(t, "Error"), Mt._.each(e, function(t) { var e = $t(t).replace(d, 303), i = new Image; i.src = e })) }, e.prototype.parseAd = function(t, e, i) { i = i || {}; var r, n, a, s, o = Xt(e, "InLine")[0], d = Xt(e, "Wrapper")[0], l = o || d, h = l ? $t(Xt(l, "AdTitle")[0]) : "", p = void 0; return i.sequence = Wt(e, "sequence"), i.adTitle = h, (!t || 4 < t || t < 2) && this.throwError(102, "Vast version not supported"), 4 === t && (i.conditionalAd = !!Wt(e, "conditionalAd")), l ? (2 <= t ? (z(l, "Impression", (p = function(t) { var e = Xt(Xt(t, "Creatives")[0], "Creative"), P = {}, T = { trackers: P }; T.adsystem = $t(Xt(t, "AdSystem")[0]); var i = Xt(t, "Category"); return T.categories = Mt._.map(i, function(t) { return $t(t) }), Mt._.each(e, function(t) { var e = Xt(t, "Linear")[0], i = Xt(t, "NonLinear")[0], r = Xt(Xt(t, "TrackingEvents")[0], "Tracking"), n = Xt(t, "UniversalAdId")[0], a = Wt(n, "idRegistry") || "unknown", s = Wt(n, "idValue") || "unknown"; T.creativeId = Wt(t, "id"), e || i ? (Mt._.each(r, function(t) { zt(P, t) }), T.universalAdIdRegistry = a, T.universalAdIdValue = s) : (T.companionUniversalAdIdRegistry = a, T.companionUniversalAdIdValue = s); var o, d, l, h, p, u, c, f = $t(Xt(t, "AdParameters")[0]); if (f && (T.adParams = f), e) { var m = Xt(e, "VideoClicks")[0], v = $t(Xt(m, "ClickThrough")[0]), g = Xt(m, "ClickTracking"), y = Wt(e, "skipoffset"), A = $t(Xt(e, "Duration")[0]); Mt._.each(g, function(t) { W(P, "click", $t(t)) }), A && (T.duration = Mt.utils.seconds(A)), v && (T.clickthrough = v), y && (T.skipoffset = y), $(e, T) } else if (i) { var k = $t(Xt(i, "NonLinearClickThrough")[0]); k && (T.clickthrough = k), p = T, u = [], (c = Xt(h = t, "StaticResource")[0]) && (u.push({ type: Wt(c, "creativeType"), file: $t(c), adType: Wt(Xt(h, "NonLinear")[0], "apiFramework") || "static", minDuration: Wt(Xt(h, "NonLinear")[0], "minSuggestedDuration") || "00:00:00" }), p.media = u) } else o = T, d = Xt(Xt(t, "CompanionAds")[0], "Companion"), l = o.companions ? o.companions : [], Mt._.each(d, function(t) { var e = Xt(t, "StaticResource")[0], i = Xt(t, "IFrameResource")[0], r = Xt(t, "HTMLResource")[0], n = {}, a = void 0, s = void 0; if (e) a = Wt(e, "creativeType"), s = $t(e); else if (i) a = "iframe", s = $t(i); else { if (!r) return; a = "html", s = $t(r) } var o = Xt(Xt(t, "TrackingEvents")[0], "Tracking"); Mt._.each(o, function(t) { var e = Wt(t, "event"); W(n, e, $t(t)) }); var d = $t(Xt(t, "CompanionClickThrough")[0]); l.push({ width: parseInt(Wt(t, "width"), 10), height: parseInt(Wt(t, "height"), 10), type: a, source: s, trackers: n, clickthrough: d }) }), o.companions = l }), T }(l)).trackers), z(l, "Error", p.trackers)) : p = function(t) { var e = Xt(t, "Video")[0] || t, i = Xt(t, "NonLinear")[0], r = {}, n = { trackers: r }; if (e) { var a = Xt(Xt(t, "TrackingEvents")[0], "Tracking"); Mt._.each(a, function(t) { zt(r, t) }); var s = Xt(Xt(t, "Impression")[0], "URL"); Mt._.each(s, function(t) { W(r, "impression", $t(t)) }); var o = Xt(Xt(t, "Error")[0], "URL"); Mt._.each(o, function(t) { W(r, "error", $t(t)) }); var d = Xt(e, "VideoClicks")[0], l = $t(Xt(d, "ClickThrough")[0]), h = Xt(Xt(d, "ClickTracking")[0], "URL"); Mt._.each(h, function(t) { W(r, "click", $t(t)) }), l && (n.clickthrough = l), $(e, n); var p = Xt(e, "AdParameters")[0]; if (p) { var u = Wt(p, "apiFramework"); "vpaid" === u.toLowerCase() && (Mt._.each(n.media, function(t) { t.adType = u }), n.adParams = $t(p)) } } if (i) { var c = n.media || [], f = Xt(i, "URL")[0]; c.push({ type: Wt(i, "creativeType"), file: $t(f), adType: Wt(i, "apiFramework") }), n.media = c } var m = Xt(t, "CompanionAds")[0]; return m = Xt(m, "Companion"), n.companions = (n.companions || []).concat(Mt._.map(m, function(t) { return { width: parseInt(Wt(t, "width"), 10), height: parseInt(Wt(t, "height"), 10), type: Wt(t, "resourceType"), resource: $t(Xt(t, "URL")[0]), trackers: [], clickthrough: "" } })), n }(l), a = p, s = {}, Mt._.each(a.media, function(t) { var e = t.type, i = "application/x-mpegURL" === e || "vnd.apple.mpegURL" === e; "vpaid" === t.adType.toLowerCase() || i || (s[e] = s[e] || 0, s[e]++) }), a.mediaFileCompliance = !0, Mt._.each(s, function(t, e) { t < 3 && (a.mediaFileCompliance = !1, a.nonComplianceReasons = a.nonComplianceReasons || [], a.nonComplianceReasons.push(e + " has only " + t + " qualities")) }), d && (p.wrappedURI = $t(Xt(d, "VASTAdTagURI")[0]) || $t(Xt(d, "VASTAdTagURL")[0])), r = p, n = Vt({}, i), Mt.utils.foreach(r, function(t, e) { Mt.utils.exists(n[t]) ? Array.isArray(e) ? n[t] = n[t].concat(e) : "object" === Mt.utils.typeOf(e) ? n[t] = Vt(n[t], r[t]) : n[t] = e : n[t] = e }), p = n) : 2 === t ? this.throwError(900, "Invalid VAST response", 60001) : this.throwError(101, "Invalid VAST response", 10101), p }, e.prototype.throwError = function(t, e, i) { var r = this, n = Bt(e, t, i = i || 1e4 + t); throw n.toString = function() { return r.code + " " + r.message }, this._error = n, this._error }, e }(); function Xt(t, e, i) { var r = []; return t && (r = t.getElementsByTagName(e), i && r && 0 === r.length && (r = t.getElementsByTagName(i + ":" + e))), r } function Wt(t, e) { return t ? t.getAttribute(e) : null } function zt(t, e) { var i = Wt(e, "event"); "progress" === i && (i = i + "_" + Wt(e, "offset")); W(t, i, $t(e)) } function $t(t) { if (t) { var e = t.textContent || t.text; if (e) return Mt.utils.trim(e) } return "" } function W(t, e, i) { t[e] || (t[e] = []), i && t[e].push(i) } function z(t, e, i) { var r = Xt(t, e); Mt._.each(r, function(t) { W(i, e.toLowerCase(), $t(t)) }) } function $(t, e) { var i = Xt(Xt(t, "MediaFiles")[0], "MediaFile"), r = e.media ? e.media : []; e.media = r.concat(Mt._.map(i, function(t) { return { type: Wt(t, "type"), file: $t(t), adType: Wt(t, "apiFramework") || "", width: parseInt(Wt(t, "width"), 10) || 0, height: parseInt(Wt(t, "height"), 10) || 0 } }).filter(function(t) { return t.file })) } var Gt = function() { function h(t, e, i, r) { g(this, h), this._scheduledAd = t, this.player = e, this.options = i || {}, this.debugTrackFn = r, Vt(this, e.Events), this._history = [], this.loadedAds = [], this.parser = null, this.xmlhttp = null, this.errorSent = !1 } return h.prototype.load = function(t) { this._history.push(t), this.errorSent = !1, this.xmlhttp = this.getXhrRequest(t) }, h.prototype.getXhrRequest = function(e) { var i = this, t = this.options.requestFilter; return Mt.utils.ajax({ url: e, oncomplete: function(t) { i.ajaxComplete(t, e) }, onerror: function(t) { i.player && i.ajaxError(t, e) }, withCredentials: !0, retryWithoutCredentials: !0, requireValidXML: !0, timeout: this._scheduledAd.requestTimeout, requestFilter: t }) }, h.prototype.destroy = function() { var t; (t = this.xmlhttp) && (t.onload = null, t.onreadystatechange = null, t.onerror = null, t.abort && t.abort()), this.player = null }, h.prototype.scheduledAd = function() { return this._scheduledAd }, h.prototype.allAds = function() { return this.loadedAds }, h.prototype.adPod = function() { var e = []; return this.loadedAds.forEach(function(t) { t.sequence && e.push(t) }), e.sort(function(t, e) { return t.sequence - e.sequence }), e }, h.prototype.adBuffet = function() { var e = []; return this.loadedAds.forEach(function(t) { t.sequence || e.push(t) }), e }, h.prototype.history = function() { return this._history }, h.prototype.parseXmlString = function(t, e) { this.ajaxComplete({ responseXML: G(t) }, e) }, h.prototype.ajaxComplete = function(t, e) { var r = this; if (this.player) { this.parser = this.parser || new X; try { var i = t.responseXML; !i && t.responseText && (i = G(t.responseText)), this.parser.parse(i, t) } catch (t) { var n = t.code || 900, a = t.adErrorCode || 1e4 + n; return void this.sendErrorEvent(t.message, n, a, e) } var s = this.parser.parsedAds(); if (s && s.length) this.loadedAds = s, this.options.wrapper = this.options.wrapper || [], this.options.adsystem && this.options.wrapper.push(this.options.adsystem), this.options.adsystem = this.loadedAds[0].adsystem, s.forEach(function(e) { if (e.wrappedURI) { r.options.wrappedTags = r.options.wrappedTags || [r._scheduledAd._currentTag], r.options.wrappedTags.push(e.wrappedURI); var i = new h(r._scheduledAd, r.player, r.options, r.debugTrackFn); i.on(bt, function() { r.replaceWrappedAd(e, i.allAds()) }), i.on(_t, function(t) { r.sendAdpodErrorEvent(t.message, t.code, t.adErrorCode, t.url), r.destroyWrappedAd(e, i) }), i.load(e.wrappedURI) } else 1 < r.options.wrapper.length && (e.wrapper = r.options.wrapper, e.wrappedTags = r.options.wrappedTags) }), this.checkComplete(); else { var o = 2 === this.parser.version(), d = o ? 900 : 101, l = o ? 60001 : 10101; this.sendErrorEvent("Ad Tag Empty", d, l, e) } } }, h.prototype.destroyWrappedAd = function(t, e) { var i = this.loadedAds.indexOf(t); this.loadedAds.splice(i, 1), e.destroy(), this.checkComplete() }, h.prototype.replaceWrappedAd = function(t, e) { var n, i, a, r = (n = t, i = e, a = [], Mt.utils.foreach(i, function(t, e) { var i, r; n.companions && (e.companions = (e.companions ? e.companions : []).concat(n.companions)), n.trackers && (e.trackers = (i = e.trackers, r = n.trackers, i = i || {}, Mt.utils.foreach(r, function(t, e) { i[t] ? i[t] = i[t].concat(e) : i[t] = e }), i)), n.sequence && (e.sequence = n.sequence), a.push(e) }), a), s = this.loadedAds.indexOf(t); Array.prototype.splice.apply(this.loadedAds, [s, 1].concat(r)), this.checkComplete() }, h.prototype.checkComplete = function() { var i = !1; Mt.utils.foreach(this.loadedAds, function(t, e) { e.wrappedURI && (i = !0) }), i || this.validateVast() }, h.prototype.validateVast = function() { var e = this.loadedAds.slice(0), t = e.length; e.forEach(function(t) { t.media && t.media.length || e.length-- }); var i = 0 === t, r = e.length !== t; i || r ? this.sendErrorEvent("Ad Tag Empty", 101, 10101, this._history[this._history.length - 1]) : this.trigger(bt, { vloader: this }) }, h.prototype.ajaxError = function(t, e) { if (this.player.getAdBlock()) this.sendErrorEvent("Ad playback blocked by an ad blocker", 900, 60003, e); else if ("Invalid XML" === t) this.sendErrorEvent(t, 100, 10100, e); else if ("Error loading file" === t) { var i = this.options.wrappedTags && this.options.wrappedTags.length, r = i ? 303 : 900, n = i ? 10303 : 60006; this.sendErrorEvent(t, r, n, e) } else this.sendErrorEvent("VAST could not be loaded", 301, 10301, e) }, h.prototype.firstUrl = function() { return this._history && this._history.length ? this._history[0] : "" }, h.prototype.sendAdpodErrorEvent = function(t, e, i, r) { if (1 !== this.loadedAds.length) { var n = Bt(t, e, i); n.vloader = this, n.url = this.firstUrl() || r, this.wrappedTags = r, this.trigger("adPodError", n) } else this.sendErrorEvent(t, e, i, r) }, h.prototype.sendErrorEvent = function(t, e, i, r) { if (!this.errorSent) { this.errorSent = !0; var n = Bt(t, e, i); n.vloader = this, n.url = this.firstUrl() || r, this.options.wrappedTags && (n.wrapperAdSystem = this.options.wrapper || "", n.wrappedTags = this.options.wrappedTags), n.adsystem = this.options.adsystem || "", this.trackError(n), this.trigger(_t, n) } }, h.prototype.trackError = function(t) { var e = t.vloader.allAds(); if (e && e.length) { var i = e[0]; if (i) { var r = i.trackers; if (r && r.error) new Lt(r, this.debugTrackFn, this.player, this.options.trackingFilter).error(t.code) } } }, h }(); function G(t) { return e = t, ("object" == typeof Node ? e instanceof Node : e && "object" == typeof e && "number" == typeof e.nodeType && "string" == typeof e.nodeName) ? t : Mt.utils.parseXML(t); var e } var J = Date.now || function() { return (new Date).getTime() }, Jt = function() { function i(t, e) { g(this, i), this.player = t, this.options = e, this.ignoreStartOnSeek = !1, this.reset(), e.timeBetweenAds && t.on({ adBreakStart: this.handleAdBreakStart, adSkipped: this.handleAdSkipped, adComplete: this.handleAdComplete, adBreakEnd: this.handleAdBreakEnd, destroyPlugin: this.destroy }, this) } return i.prototype.clearStartOnSeek = function() { this.ignoreStartOnSeek = !0 }, i.prototype.sendAdBreakIgnored = function(t, e) { var i, r; t && this.player.trigger(a, (r = e, { id: (i = t)._breakId, tag: i._adQueue && 0 < i._adQueue.length ? i._adQueue[0] : i._adXML, client: vt, offset: i._offSet, timeSinceLastAd: r, type: a })) }, i.prototype.rulesAllowAdPlayback = function(t) { var e = this.options, i = 0 === e.frequency && 1 === t, r = t >= e.startOn && (t - e.startOn) % e.frequency == 0; return i || r }, i.prototype.handleAdBreakStart = function() { this.adSkipped = !1, this.adComplete = !1 }, i.prototype.handleAdComplete = function() { this.adComplete = !0 }, i.prototype.handleAdSkipped = function() { this.adSkipped = !0 }, i.prototype.handleAdBreakEnd = function() { !this.adSkipped && this.adComplete && (this.recentCompletedAdTime = J()) }, i.prototype.timeBetweenAdsAllowsAdPlayback = function(t) { if (this.options.timeBetweenAds) { var e = (J() - this.recentCompletedAdTime) / 1e3; if (e < this.options.timeBetweenAds) return this.sendAdBreakIgnored(t, e), !1 } return !0 }, i.prototype.reset = function() { this.ignoreStartOnSeek = !1, this.recentCompletedAdTime = 0 }, i.prototype.destroy = function() { this.player.off(null, null, this) }, y(i, [{ key: "timeBetweenAds", get: function() { return this.options.timeBetweenAds } }, { key: "startOnSeek", get: function() { return this.ignoreStartOnSeek ? null : this.options.startOnSeek } }]), i }(), K = {}; function Kt(t, r) { var n = this, e = K[r]; return e || (this.jwplayerEntitlements = function(t, e, i) { var r = { canPlayAds: !0 }, n = new t.key(e), a = n.edition(); if ("unlimited" === a) return i(r); var s = n.token(), o = ["//", "", "/", s, ""]; "file:" === window.location.protocol && o.unshift("https:"), t.ajax(o.join(""), function(t) { r.canPlayAds = !t || !t.response || !1 !== t.response.canPlayAds, i(r) }, function() { i(r) }, { timeout: 1e4, responseType: "" }) }, K[r] = new Promise(function(e, i) { n.jwplayerEntitlements(t, r, function(t) { t.canPlayAds ? e() : i({ message: "Ad Limit Reached" }) }) })) } var Y, Z = /^((https?:)?\/\/)?(secure)?pubads\.g\.doubleclick\.net\/gampad\/ads\?[\S]*$/, tt = /^((https?:)?\/\/)?bid\.g\.doubleclick\.net\/dbm\/vast\?[\S]*$/, et = /^((https?:)?\/\/)?ad\.doubleclick\.net(\/ddm)?\/pfadx\/[\S]*$/; function Yt(t, e, i, r) { if (!t) return t; var n, a, s, o, d, l = (a = (n = e).getConfig(), { playerHeight: n.getHeight() || a.height || "", playerWidth: n.getWidth() || a.width || "", itemDuration: (s = n.getDuration(), o = 3, d = Math.pow(10, o), Math.round(s * d) / d || ""), item: a.playlist[n.getPlaylistIndex()] || {} }), h = l.item, p = window.location.href; t = it(t = it(t = it(t = it(t = it(t = it(t = it(t = it(t, "__random-number__", Math.random() * Math.pow(10, 18)), "__timestamp__", (new Date).getTime()), "__page-url__", encodeURIComponent(p)), "__referrer__", encodeURIComponent(document.referrer)), "__player-height__", l.playerHeight), "__player-width__", l.playerWidth), "__item-duration__", l.itemDuration), "__domain__", encodeURIComponent(i)); for (var u = (t = r.companion ? it(t, "__companion-div__", r.companion.id) : it(t, "__companion-div__", "")).match(new RegExp(/__item-[a-z 0-9 A-Z]*__/g)), c = 0; u && c < u.length; c++) { var f = u[c], m = f.substring(7, f.length - 2); if (h.hasOwnProperty(m) && "string" == typeof h[m]) { var v = h[m]; 1e3 < v.length && (v = v.substring(0, 1e3)), t = it(t, f, encodeURIComponent(v)) } else t = it(t, f, "") } return t = function(t) { Z.test(t) || tt.test(t) ? t += "&sdk3p=jwplayer" : et.test(t) && (t += ";sdk3p=jwplayer"); return t }(t) } function it(t, e, i) { return t.replace(e, i) } var rt = 2e3, nt = 2e3, at = "usd", st = 1, ot = "//c.amazon-adsystem.com/aax2/apstag.js", dt = "video", lt = "2962993", ht = "//js-sec.indexww.com/htv/htv-jwplayer.min.js", pt = "//js.spotx.tv/directsdk/v1/", ut = "//search.spotxchange.com/ad/vast.html?key=", ct = "dfp", ft = "jwp", mt = "jwpspotx", Zt = "jwpdfp", te = ft, ee = "APS", ie = "Index", re = "SpotX", ne = ((Y = {})[[ct]] = [ee, "FAN", ie, re], Y[[ft]] = ["FAN", re], Y[[Zt]] = [re], Y[[mt]] = [re], Y), ae = "bid", se = "error", oe = "invalid", de = "noBid", le = Date.now || function() { return (new Date).getTime() }; function he(n, a) { return new Promise(function(e, t) { setTimeout(t, a); var i = document.createElement("script"); i.onload = i.onreadystatechange = function(t) { this.readyState && "loaded" !== this.readyState && "complete" !== this.readyState || (e(t), i.onload = i.onreadystatechange = null, r && i.parentNode && r.removeChild(i)) }, i.onerror = t, i.type = "text/javascript", i.charset = "utf-8", i.async = !0, i.timeout = a, i.src = n; var r = document.getElementsByTagName("head")[0] || document.documentElement; r.insertBefore(i, r.firstChild) }).catch(function() { return Promise.reject("Error loading script") }) } var pe = encodeURIComponent(window.location.href), ue = { requestBids: function(t, u, i) { var c = t.id, r = (e = c, n = u.playerWidth, a = u.playerHeight, ["https://an.facebook.com/v2/placementbid.json?&placementids[]=" + e, "&playerwidth=" + n, "&playerheight=" + a, "&adformats[]=" + dt, "&sdk=" + lt, "&pageurl=" + pe].join("")); var e, n, a; if (! function(t, e, i, r) { if (!r) return !1; return t === ct || e && i === at }(u.mediationLayerAdServer, u.floorPriceCents, u.floorPriceCurrency || at, r)) return Promise.resolve({ result: oe, message: "Invalid configuration" }); return new Promise(function(t) { var e = new XMLHttpRequest; e.onreadystatechange = function() { 4 === this.readyState && (t(this), e = null) }, e.open("GET", r), e.withCredentials = !0, e.send(null), i.then(function() { e && (e.abort(), e = null) }) }).then(function(t) { if (200 !== t.status) return { result: se, message: "Invalid response (status " + t.status + ")" }; var e = JSON.parse(t.responseText), i = e.errors; if (i && i.length) return { result: se, message: i[0] }; var r = e.bids; if (!r || !r[c] || !r[c][0]) return { result: de, message: "No bids for placement id" }; var n = r[c][0], a = n.bid_price_cents, s = n.bid_id; if (u.mediationLayerAdServer === ct) return { result: ae, tag: u.tag, custParams: { jwFANBidPrice: Math.round(a / 100), jwFANBidID: s } }; var o, d, l, h, p = { result: ae, priceInCents: a, priceCurrency: n.bid_price_currency }; return a >= u.floorPriceCents && (p.tag = (o = c, d = s, l = u.playerWidth, h = u.playerHeight, ["https://an.facebook.com/v1/instream/vast.xml?placementid=" + o, "&playerwidth=" + l, "&playerheight=" + h, "&sdk=" + lt, "&bidid=" + d, "&pageurl=" + pe].join(""))), p }).catch(function(t) { return { result: se, message: "FAN header bidding failed: " + t } }) }, getCustomResponse: function() { return {} } }; var ce = null; function fe() { return null === ce && (ce = Promise.resolve(window.apstag).then(function(t) { return t && t.init && t.fetchBids ? t : he(["file" === document.location.protocol ? "https:" : "", ot].join(""), nt).then(function() { return window.apstag }) }).catch(function(t) { throw ce = null, t })), ce } var me = null, ve = null; function ge(t) { if (null === ve) { var e = le(), i = me || window.SpotX; if (i && i.DirectAdOS) return ve = Promise.resolve({ SpotX: i, loadingTime: le() - e }); var r = ["file" === document.location.protocol ? "https:" : "", pt, t, ".js"].join(""); (ve = "function" == typeof require ? (n = r, a = nt, new Promise(function(t, e) { setTimeout(e, a), require([n], t, e) }).catch(function() { return Promise.reject("Error loading script") })).then(function(t) { return { SpotX: me = t, loadingTime: le() - e } }) : he(r, nt).then(function() { return { SpotX: window.SpotX, loadingTime: le() - e } })).catch(function(t) { throw ve = null, t }) } var n, a; return ve } var ye = void 0, Ae = { requestBids: function(t, l) { if (!t.id) return Promise.resolve({ result: oe, message: "Missing id in configuration" }); var a = Vt({ channel_id: t.id, slot: l.playerContainer, content_width: l.playerWidth, content_height: l.playerHeight, player_vendor: "SpotXJW", player_vendor_id: l.playerId, ad_volume: l.adVolume, autoplay: l.autoplay, blocked_autoplay_override_mode: l.autoplayAdsMuted, start_delay: function(t) { if ("start" === t || "0%" === t || !t || "pre" === t || "00:00:00" === t) return 0; if ("end" === t || "100%" === t || "post" === t) return -2; if ("string" == typeof t && 0 <= t.indexOf("%")) return -1; var e = parseInt(t); return 0 < e ? e : -1 }(l.offset), placement: 1, hide_skin: !0 }, t.optionalParams); t.passFloorPrice && l.floorPriceCents && (a.price_floor = l.floorPriceCents / 100); return ge(t.id).then(function(t) { var e = t.SpotX, i = t.loadingTime; ye = i; var r = new e.DirectAdOS(a), n = le(); return r.getAdServerKVPs().then(function(t) { return { response: t, bidNetworkStartTime: n } }) }).then(function(t) { var e = t.response, i = t.bidNetworkStartTime, r = le() - i, n = e.spotx_ad_key, a = { spotx_bid: e.spotx_bid, spotx_ad_key: n }, s = 100 * parseFloat(e.spotx_bid), o = { result: ae, priceInCents: s, custParams: a, scriptLoadingTime: ye, bidNetworkResponseTime: r }; if (l.mediationLayerAdServer === ct) return o; var d = ["file:" === document.location.protocol ? "https:" : "", ut, n].join(""); return Vt(o, { tag: d, tagKey: n }) }).catch(function(t) { return "SpotX :: Unable to find ad" === t.message ? { result: de, message: t.message, scriptLoadingTime: ye } : { result: se, message: "SpotX header bidding failed: " + t, scriptLoadingTime: ye } }) }, getCustomResponse: function() { return { scriptLoadingTime: ye } } }; var ke = null; function Pe(e) { return null === ke && (ke = Promise.resolve(window.indexapi).then(function(t) { return t || he(["file" === document.location.protocol ? "https:" : "", e || ht].join(""), nt).then(function() { return window.indexapi }) }).catch(function(t) { throw ke = null, t })), ke } var Te, we = { requestBids: function(t, r) { if (!t.id && !t.script) return Promise.resolve({ result: oe, message: "Missing id or script in configuration" }); var e = Vt({ videoCommonArgs: { protocols: [2, 3, 5, 6], mimes: ["video/mp4", "video/webm", "application/javascript"], apiList: [1, 2] }, siteID: t.id }, t); return Pe().then(function(t) { return new Promise(function(i) { t.deferQueue = t.deferQueue || [], t.deferQueue.push(function() { t.solicitIndexVideoAds(r.tag, function(t, e) { i({ updatedTag: t, indexTargeting: e }) }, e) }) }) }).then(function(t) { var e = t.indexTargeting; return void 0 !== e ? { result: ae, tag: r.tag, custParams: e } : { result: de, message: "No bids for site id" } }).catch(function(t) { return { result: se, message: "Index Exchange header bidding failed: " + t } }) }, getCustomResponse: function() { return {} } }; var be = ((Te = {})[[ee]] = { requestBids: function(i, r) { if (!i.id || !i.slotID) return Promise.resolve({ result: oe, message: "Missing id or slotID in configuration" }); return fe().then(function(e) { return e.init({ id: i.pubId, adServer: i.adServer }), new Promise(function(t) { e.fetchBids({ slots: [{ slotID: i.slotID }], timeout: r.bidTimeout }, t) }) }).then(function(t) { return t && t[0] && t[0].slotID === i.slotID ? { result: ae, tag: r.tag, custParams: { amznbid: t[0].amznbid, amzniid: t[0].amzniid } } : { result: de, message: "No bids for pubID and slotID" } }).catch(function(t) { return { result: se, message: "Amazon header bidding failed: " + t } }) }, getCustomResponse: function() { return {} } }, Te[["FAN"]] = ue, Te[[ie]] = we, Te[[re]] = Ae, Te); var _e = function() { function p() { var t, e, i, r, n = this, a = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}, s = a.settings, o = void 0 === s ? {} : s, d = a.bidders, l = void 0 === d ? [] : d, h = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {}; (g(this, p), this.settings = (t = o, i = Vt({ bidTimeout: rt, offset: "", playerContainer: (e = h).container, playerHeight: e.height || 0, playerWidth: e.width || 0, tag: "" }, e, t), ne[i.mediationLayerAdServer] || (i.mediationLayerAdServer = te), i.mediationLayerAdServer === mt && (i.floorPriceCents = st), i), this.bidders = l.reduce(function(t, e) { return e.name && (t[e.name] = Vt(e, e.custom_params)), t }, {}), "pre" !== this.settings.offset && 0 !== parseInt(this.settings.offset)) && (this.bidders = this.bidders[re] ? ((r = {})[[re]] = this.bidders[re], r) : {}); this.bidders[ee] && this.bidders[ee].id && this.bidders[ee].slotID && fe(), this.bidders[ie] && (this.bidders[ie].script || this.bidders[ie].id) && Pe(this.bidders[ie].script), this.bidders[re] && this.bidders[re].id && ge(this.bidders[re].id), this._bidRequest = null, this._currentTimeout = null, this._onCancelTrigger = null, this.onCancel = new Promise(function(t) { n._onCancelTrigger = t }) } return p.prototype.start = function() { var t, n, o, e, i; return this._bidRequest || (this._bidRequest = (t = { config: this.bidders, settings: this.settings, onCancel: this.onCancel }, n = t.config, o = t.settings, e = t.onCancel, i = ne[o.mediationLayerAdServer].filter(function(t) { return n[t] }).map(function(i) { var r = le(); return Promise.race([be[i].requestBids(n[i], o, e), e]).then(function(t) { var e = be[i].getCustomResponse(); return Vt({}, n[i], t, e, { timeForBidResponse: le() - r | 0 }) }) }), Promise.all(i).then(function(t) { var e = o.mediationLayerAdServer === ct || o.mediationLayerAdServer === Zt, i = o.mediationLayerAdServer === ft || o.mediationLayerAdServer === Zt || o.mediationLayerAdServer === mt, r = { priceInCents: o.floorPriceCents, timeForBidResponse: 1 / 0 }, n = [], a = {}, s = {}; return s.bidders = t.map(function(t) { return e || (t.winner = !1), t.result === ae && (n.push(t), Vt(a, t.custParams), i && (t.priceInCents > r.priceInCents || t.priceInCents === r && t.timeForBidResponse < r.timeForBidResponse) && (r = s.result = t)), t }), i && r.name ? r.winner = !0 : e && n.length && (s.result = { tag: o.tag, custParams: a }), s }))), this._bidRequest }, p.prototype.stop = function() { var e = this; clearTimeout(this._currentTimeout), this._onCancelTrigger({ result: "abort" }), this._bidRequest = null, this._currentTimeout = null, this._onCancelTrigger = null, this.onCancel = new Promise(function(t) { e._onCancelTrigger = t }) }, p.prototype.getEventObject = function(t, e, i) { var r = i.offset, n = this.settings.mediationLayerAdServer, a = e || []; "pre" !== r && 0 !== parseInt(r) && (a = a.filter(function(t) { return t.name === re })); var s = { client: t, offset: r, mediationLayerAdServer: n, bidders: a, bidTimeout: this.settings.bidTimeout }, o = this.settings.floorPriceCents; o && n !== mt && n !== ct && (s.floorPriceCents = o); var d = this.settings.floorPriceCurrency; return d && (s.floorPriceCurrency = d), s }, p.prototype.then = function(t) { return this._bidRequest ? this._bidRequest.then(t, t) : null }, p.prototype.timeout = function() { clearTimeout(this._currentTimeout), this._currentTimeout = setTimeout(this._onCancelTrigger, this.settings.bidTimeout, { result: "timeout" }) }, p }(); function Ee(t) { return t._adQueue && t._waterfallIndex < t._adQueue.length }(window.jwplayerPluginJsonp || window.jwplayer().registerPlugin)(vt, "8.1", function(o, d, t) { var l = Mt.utils = o.utils, h = Mt._ = o._, e = o.getConfig().key, r = o.getEnvironment(), p = d.debug && d.trackFn ? d.trackFn : null, n = this, s = [], a = Promise.resolve(), u = {}, i = null, c = d.bids && d.bids.settings ? d.bids.settings.mediationLayerAdServer || Pt : null; if ((c === Pt || c === Tt) && d.bids.bidders) { var f = d.bids.bidders; f.length && (i = Vt({}, d.bids, { bidders: f })) } var m = {}, v = !1, g = "", y = !1, A = !1, k = 0, P = [], T = [], w = !1, b = {}, _ = !1, E = -1, I = void 0, C = void 0, S = void 0, x = void 0, R = void 0, V = void 0, M = void 0, L = void 0, B = 0, O = 0, H = new Dt, j = new Ft, q = new jwplayer.utils.Timer, F = new Jt(o, H.getAdRules(d)); this.version = "8.3.5"; var D = L = H.getSchedule(d, F); function U(n) { return V && (Z(V), V = null), M = new Promise(function(t, e) { V = l.ajax({ url: n, oncomplete: t, onerror: e, withCredentials: !0, retryWithoutCredentials: !0, requireValidXML: !0, timeout: L.requestTimeout }) }).then(function(t) { for (var e = function(t, e) { var i = [], r = Xt(t, "VMAP", yt); if (!r.length) throw new Error("No VMAP tag in response"); Wt(r[0], "version") || Nt(i, "VMAP Schema Error: version missing from VMAP tag", gt); var n, a, s, o, d, l = Xt(t, "AdBreak", yt); l.length || Qt(); for (var h = t.lookupNamespaceURI(yt), p = 0; p < l.length; p++) { var u = {}, c = {}, f = l[p], m = Wt(f, "timeOffset"), v = Wt(f, "breakId"), g = Wt(f, "breakType"), y = Wt(Xt(f, "AdSource", yt)[0], "id"), A = Xt(f, "AdTagURI", yt)[0], k = Xt(f, "VASTData", yt)[0] || Xt(f, "VASTAdData", yt)[0], P = Wt(A, "templateType"), T = $t(A), w = (a = f, s = "Tracking", o = yt, d = void 0, d = [], (n = h) || a ? d = a.getElementsByTagNameNS ? a.getElementsByTagNameNS(n, s) : a.getElementsByTagName(o + ":" + s) : d); if (g || Nt(i, "VMAP Schema Error: missing breakType on AdBreak", v), k || P || Nt(i, "VMAP Schema Error: missing templateType on AdBreak", v), m || Nt(i, "VMAP Schema Error: missing timeOffset on AdBreak", v), u._type = g, u._vmap = { id: y, breakid: v, timeoffset: m }, k) u._adXML = Xt(k, "VAST")[0]; else { if ("vast2" !== P && "vast3" !== P && "vast4" !== P) continue; u._adQueue = [T], u._waterfallIndex = 0 } var b = []; if (w) for (var _ = 0; _ < w.length; _++) { zt(c, w[_]); var E = Wt(w[_], "event"); b.push(E) } switch ((b.indexOf("breakStart") < 0 || b.indexOf("breakEnd") < 0 || b.indexOf("error") < 0) && Nt(i, "Tracking events are missing breakStart, breakEnd, or error for AdBreak", v), u._trackers = c, u._type = g, m) { case "start": u._offSet = "pre", e.setPreRoll(u); break; case "100%": case "end": u._offSet = "post", e.setPostRoll(u); break; default: if (/^#/.test(m)) break; /^\d\d?(?:\.\d+)?%$/.test(m) ? u._offSet = m : u._offSet = Mt.utils.seconds(m), e.addMidRoll(u) } } return e.preRoll || e.midRolls.length || e.postRoll || Qt(), e.sort(null, !0), i }(t.responseXML, L), i = 0; i < e.length; i++) { var r = e[i]; r.vmap = n, o.trigger(St, r) } }).catch(function(t) { R && lt(); var e = void 0; if (t.message) e = Bt("VMAP Schema Error: " + t.message, 1002, t.adErrorCode || 11002); else { l.log(t); var i = { "Invalid XML": 1e3, Timeout: 1007, default: 1008 }, r = i[t] || i.default; e = Bt("Error Loading VMAP Schedule", r, r + 1e4) } e.id = gt, e.vmap = n, ut(e) }).then(function() { V = M = null }) } function N(t) { var e, i, r, n, a, s; g = t._position, C = t._vmapTracker = (e = t)._vmapTracker || new Lt(e._trackers, p, o, d.trackingFilter), clearTimeout(E), E = -1, "nonlinear" !== t._type && Q(), t._adXML ? (t._currentTag = t._currentTag || "clientloadedtag_" + k++, (i = t)._currentTag = i._currentTag || i._adXML.toString(), K(i).parseXmlString(i._adXML), G(i, i._currentTag)) : t._adQueue ? (n = (b = r = t)._waterfallIndex || 0, a = r._adQueue[n], s = Yt(a, o, ct(), m), r._waterfallIndex = n + 1, r._currentTag = s, "function" == typeof p && p({ type: "tagReplacement", data: { actualTag: s, originalTag: a } }), K(r).load(s), G(r, s)) : (l.log("scheduled ad has no url or xml", t), lt()) } function Q() { R || ((R = o.createInstream().init()).setText(null), n.trigger("blockingStarted")) } function X() { s.forEach(function(t) { return t.stop() }), s = [], u = {}; var t = i ? L.getAllAds().map(W) : []; return Promise.all(t) } function W(n) { var a = new _e(i, { offset: n._offSet, width: o.getWidth(), height: o.getHeight(), container: o.getContainer(), playerId: o.id, autoplay: o.getConfig().autostart, autoplayAdsMuted: d.autoplayadsmuted, adVolume: o.getVolume() }); a.start(), s.push(a); var t = a.getEventObject(vt, i.bidders, { offset: n._offSet }); return t.adBreakId = n._breakId, o.trigger(Et, t), a.then(function(t) { var e = t.bidders, i = t.result; i && !i.error && i.tag && (n._adQueue = n._adQueue || [], n._adQueue[0] = i.tag, n._adXML = null), u[n._vmap ? n._vmap.breakid : n._breakId] = { bid: a, bidders: e }; var r = a.getEventObject(vt, e, { offset: n._offSet }); r.adBreakId = n._breakId, o.trigger(It, r) }) } function z(t) { var e, i, r = o.getPlaylistItem(t.index); L = F.rulesAllowAdPlayback(B) ? h.isObject(r) && r.adschedule ? H.getSchedule(r, F) : D : j, rt(), nt(), dt(), y = A = !1, e = L.getMidRolls(), i = [], e.length && l.foreach(e, function(t, e) { "nonlinear" !== e._type && i.push({ begin: e._offSet, text: m.cuetext }) }), o.setCues(i), L.reset() } function $(t) { return new Array(t + 1).join((Math.random().toString(36) + "00000000000000000").slice(2, 18)).slice(0, t) } function G(t, e) { o.trigger("adRequest", J(t, e)), q.tick("adLoading" + t._id) } function J(t, e) { var i = t._adQueue || {}, r = {}, n = t.adbreakid, a = t._adTagQueue, s = t.skipoffset; if (n && (r.adbreakid = n), a) { var o = t._waterfallIndex - 1; o = o < 0 ? 0 : o, r.adtagid = a[o] } return h.isUndefined(s) || (r.skipoffset = s), Vt(r, { id: t._id, tag: e || t._currentTag, client: "vast", adposition: t._position, offset: t._offSet, witem: t._waterfallIndex || 1, wcount: i.length || 1 }) } function K(t) { var e = d.requestFilter, i = d.trackingFilter, r = new Gt(t, o, { requestFilter: e, trackingFilter: i }, p); return r.on(bt, et), r.on(_t, pt), r.on("adPodError", ht), P.push(r), R && !C.breakStarted && (R.on("destroyed", function() { C && C.breakStarted && (C.breakEnd(), o.trigger("adBreakEnd", Ht("adBreakEnd", o, g))) }), C.breakStart(), o.trigger("adBreakStart", Ht("adBreakStart", o, t._position))), r } function Y(t) { for (var e = P.length; e--;) P[e] === t && (P.splice(e, 1), t.destroy()) } function Z(t) { t.onload = null, t.onreadystatechange = null, t.onerror = null, "abort" in t && t.abort() } function tt() { V && (Z(V), V = null), rt(), nt(), lt(), dt(), o.setCues([]) } function et(t) { var e = t.vloader.scheduledAd(); R || "nonlinear" === e._type ? it(t) : (n.off("blockingStarted"), n.once("blockingStarted", function() { it(t) })) } function it(t) { var e = t.vloader; clearTimeout(E), E = -1, b.isWaterfalling || dt(), Y(e); var i = new jt(e, o, S, x, m, p); i.on(St, at), i.on(xt, st), i.on("adPodError", ut), i.init(R) ? (I = R, R = null, n.off("blockingStarted"), i.on(Ct, ot), T.push(i)) : i.destroy() } function rt() { for (var t = P.length; t--;) { var e = P[t]; P.length--, e.destroy() } } function nt() { for (var t = T.length; t--;) { var e = T[t]; T.length--, e.destroy() } } function at(t) { if (_ = !1, ut(t), !_ && Ee(b)) return R = R || I, void N(Vt({}, b, { _offset: 0, isWaterfalling: !0 })); nt(), _ = !1, E = setTimeout(function() { E = -1, 0 === P.length && ("post" === g && o.attachMedia(), lt()) }, 0) } function st(t) { b = {}, ft(t) && (q.tick("adImpression" + t.id), t.timeLoading = q.between("adLoading" + t.id, "adImpression" + t.id)), Ot(t, 0, u), o.trigger(xt, t) } function ot() { 0 === P.length && "post" === g && o.attachMedia() } function dt() { T.length && T[T.length - 1].clearNonlinear() } function lt() { if (R || I) { var t = R || I; R = null, t.destroy(), n.off("blockingStarted") } I = null } function ht(t) { var e = J(t.vloader.scheduledAd(), t.url), i = Bt(t.message, t.code, t.adErrorCode); Vt(e, i), t.wrappedTags && t.wrappedTags !== t.url && (t.wrapperAdSystem && t.wrapperAdSystem.length !== t.wrappedTags.length && (t.wrapperAdSystem.push(t.adsystem), t.adsystem = ""), e.tag = t.wrappedTags.pop(), e.wrappedTags = t.wrappedTags, e.adsystem = t.adsystem, e.wrapperAdSystem = t.wrapperAdSystem), _ = !1, ut(e) } function pt(t) { Y(t.vloader), ht(t), _ || !Ee(b) ? (nt(), _ = !1, -1 === E && (E = setTimeout(function() { E = -1, 0 === P.length && lt() }, 0))) : N(Vt({}, b, { _offset: 0, isWaterfalling: !0 })) } function ut(t) { ft(t) && (q.tick("adError" + t.id), t.timeLoading = q.between("adLoading" + t.id, "adError" + t.id)), Vt(t, { client: vt }), C && C.error(t.code), Ot(t, 0, u), v ? o.trigger(St, t) : o.once("playlistItem", function() { o.trigger(St, t) }, n) } function ct() { var t = window.location.href; return (t = t.match(new RegExp(/^[^/]*:\/\/\/?([^\/]*)/))) && 1 < t.length ? t[1] : "" } function ft(t) { return "pre" === t.adposition && (void 0 === t.podcount || 1 === t.sequence) } L.isVMAP() && U(Yt(L.getVMAP(), o, ct(), m)), Vt(this, o.Events), l.addClass(t, "jw-plugin-vast"), o.on({ ready: function() { var i = this; v = !0, S = new Ut(o, t), x = new qt(p, r), m = H.getOptParams(d), mt.catch(function(t) { tt(), o.off(null, null, i), o.playAd = l.noop; var e = Bt("Ad Error: " + t.message, null, 60002); e.code = void 0, e.id = gt, e.client = vt, e.tag = "", o.trigger(St, e) }) }, beforePlay: function t(e) { if (!w) { if (M) return Q(), void M.then(function() { return t(e) }); s.forEach(function(t) { return t.timeout() }); var i = (e || {}).startTime || o.getPosition() || null; O = i || O; var r = L.getPreRoll(i); if (!y && r) return "nonlinear" !== r._type && Q(), void a.then(function() { var t; (t = L.getPreRoll(i))._position = "pre", y = !0, t._id = $(12), N(t) }); L.isVMAP() && lt() } }, cast: function(t) { w = !!t.active }, play: function(t) { n.trigger(wt, t) }, time: function(t) { if (!w && 0 !== t.duration) { var e = L.getNextMidrollIndex(O, t.position, t.duration); O = t.position, null !== e && a.then(function() { var t; (t = L.getMidRollAtIndex(e))._position = "mid", t._id = $(12), N(t) }) } }, beforeComplete: function() { if (!w) { var t = L.getPostRoll(); !A && t && ("nonlinear" !== t._type && Q(), a.then(function() { var t; (t = L.getPostRoll())._position = "post", A = !0, o.detachMedia(), t._id = $(12), N(t) })) } }, playlistItem: function(t) { B++, O = 0; var e = L; z(t), F.reset(), L.isVMAP() && e !== L && U(Yt(L.getVMAP(), o, ct(), m)), (a = M ? M.then(X) : X()).then(function() { var t = L.getAdScheduleEventObject(); t.adbreaks = t.adbreaks.map(function(t) { return Ot(t, 0, u) }), o.trigger(Rt, t) }) }, playlistComplete: z, complete: function() { dt(), y = A = !1 }, destroyPlugin: tt }, this), o.pauseAd = function(t) { if (t = "boolean" != typeof t || t, T.length) { var e = T[T.length - 1]; t ? e.pause() : e.play() } }, o.playAd = function(t) { _ = !0, dt(); var e = void 0, i = 0 === m.requestTimeout ? 1 / 0 : m.requestTimeout, r = 0 === m.creativeTimeout ? 1 / 0 : m.creativeTimeout; e = Array.isArray(t) ? t.slice(0) : [t], N({ _id: $(12), _adQueue: e, _waterfallIndex: 0, _offset: 0, _position: "api", requestTimeout: i || At, creativeTimeout: r || kt }) }; var mt = Kt.call(this, l, e); mt.catch(l.noop), this.destroy = tt }) }();