(function(){"use strict";try{if(typeof document<"u"){var t=document.createElement("style");t.id="inside-ad",t.appendChild(document.createTextNode("#streann-node{position:fixed;right:0;bottom:0;width:auto}#page-content{position:relative;width:426px}#page-content-split-ad{position:relative!important;width:100vh!important}#video-container{position:relative;padding-bottom:56.25%}#video-element{position:absolute;top:0;left:0;width:100%;height:100%}#streann-adhesion{position:fixed;width:100%;left:0;top:0;background:#0006;height:100px;z-index:10000;padding-top:15px;padding-bottom:15px}.adhesion-container{width:100%;margin:0 auto;text-align:center;opacity:1!important;z-index:11111}#adhesion{margin:0 auto;text-align:center}.close-btn-container{position:fixed;right:10px;opacity:1!important;top:10px;height:30px;width:30px;border-radius:100%;background-color:#fff;display:flex;justify-content:center}.closeButton{position:absolute;background-color:#00000080;padding:5px 13px;top:0;right:0;z-index:1;cursor:pointer;border-radius:4px;display:none}#streann-logo{position:absolute;top:0;left:0;z-index:1;cursor:pointer}.logo{width:30px;height:30px}#un-mute,#mute{position:absolute;bottom:0;left:0;padding:5px 13px;z-index:1;cursor:pointer}.split-ad-close-btn{position:absolute;right:1px;top:90%;transform:translateY(-50%);background-color:transparent;color:#fff;padding:10px 20px;border:2px solid white;cursor:pointer;border-radius:5px;font-size:16px}.split-ad-unmute-btn{display:block;position:absolute;top:10px;right:10px;background-color:transparent;border:none;border-radius:50%;width:40px;height:40px;cursor:pointer;padding:8px;z-index:1000}#video-container-split-ad{position:relative!important;padding-bottom:56.25%}")),document.head.appendChild(t)}}catch(o){console.error("vite-plugin-css-injected-by-js",o)}})();
var Me = Object.defineProperty;
var Ue = (t, e, n) => e in t ? Me(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
var l = (t, e, n) => (Ue(t, typeof e != "symbol" ? e + "" : e, n), n);
var P = /* @__PURE__ */ ((t) => (t.CORNER = "CORNER", t.EMBED = "EMBED", t.ADHESION = "ADHESION", t.EMBED_FLOAT = "EMBED_FLOAT", t.SPLIT_AD = "SPLIT_AD", t))(P || {}), R = /* @__PURE__ */ ((t) => (t.VAST = "VAST", t.BANNER = "BANNER", t.LOCAL_VIDEO = "LOCAL_VIDEO", t.LOCAL_IMAGE = "LOCAL_IMAGE", t))(R || {}), Ae = /* @__PURE__ */ ((t) => (t[t.SUNDAY = 0] = "SUNDAY", t[t.MONDAY = 1] = "MONDAY", t[t.TUESDAY = 2] = "TUESDAY", t[t.WEDNESDAY = 3] = "WEDNESDAY", t[t.THURSDAY = 4] = "THURSDAY", t[t.FRIDAY = 5] = "FRIDAY", t[t.SATURDAY = 6] = "SATURDAY", t))(Ae || {});
const T = {
  apiKey: "",
  apiToken: "",
  baseUrl: "",
  isAlreadyInit: !1
};
async function _e() {
  const t = await He();
  localStorage.setItem("streannCountryId", t.countryCode);
  const e = await fetch(
    `${T.baseUrl}v1/r/${T.apiKey}/campaigns/WEB?country=${t.countryCode}`,
    {
      method: "GET",
      headers: new Headers({
        Authorization: `ApiToken ${T.apiToken}`
      })
    }
  );
  if (e.status != 200)
    throw new Error("Someting went wrong fetching campaign err");
  return e.json();
}
async function He() {
  const t = await fetch(`${T.baseUrl}v1/geo-ip-config`), { geoIpUrl: e } = await t.json();
  return await (await fetch(e)).json();
}
function Ve() {
  return Object.values(Ae)[(/* @__PURE__ */ new Date()).getDay()];
}
function ce(t) {
  let e = t.reduce((o, s) => o + s.weight, 0), n = Math.floor(Math.random() * e) + 1, r = 0, i = null;
  for (let o of t)
    if (r += o.weight, n <= r) {
      i = o;
      break;
    }
  return i || t[0];
}
function ye(t) {
  return new Promise((e, n) => {
    const r = document.createElement("script");
    r.async = !0, r.src = t, r.onload = e, r.onerror = n, document.body.appendChild(r);
  });
}
function xe(t) {
  const e = Date.now(), n = new Date(t.startDate), r = new Date(t.endDate);
  return n.getTime() <= e && r.getTime() >= e;
}
function Fe(t) {
  if (!t.timePeriods)
    return !0;
  const e = Ve(), n = /* @__PURE__ */ new Date();
  return t.timePeriods.every((i) => {
    const [o, s, d] = i.startTime.split(":").map(Number), c = /* @__PURE__ */ new Date();
    c.setHours(o), c.setMinutes(s), c.setSeconds(d);
    const [y, S, f] = i.endTime.split(":").map(Number), h = /* @__PURE__ */ new Date();
    return h.setHours(y), h.setMinutes(S), h.setSeconds(f), i.daysOfWeek.includes(e) && c <= n && h >= n;
  });
}
function Ye(t) {
  const e = location.host.replace(/^www\./, ""), n = t.replace(/^https?:\/\//, "").replace(/^www\./, "");
  return e === n;
}
function ge(t) {
  if (t.domain) {
    if (t.domain.includes(location.host) || Ye(t.domain)) {
      if (t.absolutePath && t.absolutePath.length > 0)
        return !!t.absolutePath.some((e) => e === location.pathname);
      if (t.tags && t.tags.length)
        return t.tags.some((e) => location.pathname.includes(e));
    }
    return !1;
  } else {
    if (t.absolutePath && t.absolutePath.length > 0)
      return !!t.absolutePath.some((e) => e === location.pathname);
    if (t.tags && t.tags.length)
      return t.tags.some((e) => location.pathname.includes(e));
  }
  return !0;
}
function je(t) {
  const e = t.placements.filter(ge).filter(Se);
  return !(!e || e.length == 0);
}
function Se(t) {
  var i, o;
  const e = (o = (i = t.properties) == null ? void 0 : i.webSettings) == null ? void 0 : o.screens;
  let n = "";
  const r = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
  return r <= 425 ? n = "MOBILE" : r <= 768 ? n = "TABLET" : n = "DESKTOP", e ? e.includes(n) : !0;
}
function ze(t) {
  const e = t.filter(xe).filter(Fe);
  if (e.length == 0)
    throw new Error("No valid campaigns");
  let n;
  if (e.length > 1 ? n = ce(e.filter(je)) : n = e[0], !n)
    throw new Error("No valid campaign");
  const r = n.placements.filter(ge).filter(Se);
  if (r.length == 0)
    throw new Error("No valid placement Tag");
  const i = r.map(
    (o) => o.ads.length > 1 ? { ...o, ad: ce(o.ads) } : { ...o, ad: o.ads[0] }
  );
  return { campaign: n, filteredPlacements: i };
}
class Ge {
  info(...e) {
    console.info(
      "%c streann.com(cornerAd) %c",
      "background: orange; color: black; display: block;border-radius: 2px; padding: 2px;",
      "background: white; color: black;",
      ...e
    );
  }
  warn(...e) {
    console.warn(
      "%c streann.com(cornerAd) %c",
      "background: orange; color: black; display: block;border-radius: 2px; padding: 2px;",
      "background: white; color: black;",
      ...e
    );
  }
  error(...e) {
    console.error(
      "%c streann.com(cornerAd) %c",
      "background: orange; color: black; display: block;border-radius: 2px; padding: 2px;",
      "background: white; color: black;",
      ...e
    );
  }
}
const a = new Ge();
class qe {
  constructor(e, n) {
    l(this, "campaing");
    l(this, "refresh");
    l(this, "refreshTimeout");
    this.campaing = e, this.refresh = n;
  }
  insideAdReceived(e) {
    a.info("insideAdReceived", e);
  }
  insideAdLoaded() {
  }
  insideAdPlay() {
  }
  insideAdStop() {
    const e = this.campaing.properties.intervalInMinutes || 1;
    !e || e <= 0 || (this.clearRefreshTimeout(), this.refreshTimeout = setTimeout(() => {
      this.refresh();
    }, e * 6e4));
  }
  insideAdSkipped() {
  }
  insideAdClicked() {
  }
  insideAdError(e) {
    a.info("insideAdError", e);
  }
  insideAdVolumeChanged(e) {
    a.info("insideAdVolumeChanged", e);
  }
  clearRefreshTimeout() {
    clearTimeout(this.refreshTimeout);
  }
}
const Ke = "https://imasdk.googleapis.com/js/sdkloader/ima3.js";
let D = null;
const ue = () => {
  D = null;
}, ve = () => {
  const t = window;
  return t.google && t.google.ima ? Promise.resolve(t.google.ima) : D || (D = ye(Ke).then(() => t.google.ima), D.then(ue).catch(ue), D);
}, We = "https://securepubads.g.doubleclick.net/tag/js/gpt.js", $e = () => {
  const t = window;
  return t.googletag && t.googletag.apiReady ? Promise.resolve(t.googletag) : ye(We).then(() => t.googletag);
};
var W = function(t, e) {
  return W = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(n, r) {
    n.__proto__ = r;
  } || function(n, r) {
    for (var i in r)
      Object.prototype.hasOwnProperty.call(r, i) && (n[i] = r[i]);
  }, W(t, e);
};
function F(t, e) {
  if (typeof e != "function" && e !== null)
    throw new TypeError("Class extends value " + String(e) + " is not a constructor or null");
  W(t, e);
  function n() {
    this.constructor = t;
  }
  t.prototype = e === null ? Object.create(e) : (n.prototype = e.prototype, new n());
}
function $(t) {
  var e = typeof Symbol == "function" && Symbol.iterator, n = e && t[e], r = 0;
  if (n)
    return n.call(t);
  if (t && typeof t.length == "number")
    return {
      next: function() {
        return t && r >= t.length && (t = void 0), { value: t && t[r++], done: !t };
      }
    };
  throw new TypeError(e ? "Object is not iterable." : "Symbol.iterator is not defined.");
}
function H(t, e) {
  var n = typeof Symbol == "function" && t[Symbol.iterator];
  if (!n)
    return t;
  var r = n.call(t), i, o = [], s;
  try {
    for (; (e === void 0 || e-- > 0) && !(i = r.next()).done; )
      o.push(i.value);
  } catch (d) {
    s = { error: d };
  } finally {
    try {
      i && !i.done && (n = r.return) && n.call(r);
    } finally {
      if (s)
        throw s.error;
    }
  }
  return o;
}
function V(t, e, n) {
  if (n || arguments.length === 2)
    for (var r = 0, i = e.length, o; r < i; r++)
      (o || !(r in e)) && (o || (o = Array.prototype.slice.call(e, 0, r)), o[r] = e[r]);
  return t.concat(o || Array.prototype.slice.call(e));
}
function b(t) {
  return typeof t == "function";
}
function Te(t) {
  var e = function(r) {
    Error.call(r), r.stack = new Error().stack;
  }, n = t(e);
  return n.prototype = Object.create(Error.prototype), n.prototype.constructor = n, n;
}
var q = Te(function(t) {
  return function(n) {
    t(this), this.message = n ? n.length + ` errors occurred during unsubscription:
` + n.map(function(r, i) {
      return i + 1 + ") " + r.toString();
    }).join(`
  `) : "", this.name = "UnsubscriptionError", this.errors = n;
  };
});
function X(t, e) {
  if (t) {
    var n = t.indexOf(e);
    0 <= n && t.splice(n, 1);
  }
}
var Y = function() {
  function t(e) {
    this.initialTeardown = e, this.closed = !1, this._parentage = null, this._finalizers = null;
  }
  return t.prototype.unsubscribe = function() {
    var e, n, r, i, o;
    if (!this.closed) {
      this.closed = !0;
      var s = this._parentage;
      if (s)
        if (this._parentage = null, Array.isArray(s))
          try {
            for (var d = $(s), c = d.next(); !c.done; c = d.next()) {
              var y = c.value;
              y.remove(this);
            }
          } catch (E) {
            e = { error: E };
          } finally {
            try {
              c && !c.done && (n = d.return) && n.call(d);
            } finally {
              if (e)
                throw e.error;
            }
          }
        else
          s.remove(this);
      var S = this.initialTeardown;
      if (b(S))
        try {
          S();
        } catch (E) {
          o = E instanceof q ? E.errors : [E];
        }
      var f = this._finalizers;
      if (f) {
        this._finalizers = null;
        try {
          for (var h = $(f), g = h.next(); !g.done; g = h.next()) {
            var I = g.value;
            try {
              pe(I);
            } catch (E) {
              o = o ?? [], E instanceof q ? o = V(V([], H(o)), H(E.errors)) : o.push(E);
            }
          }
        } catch (E) {
          r = { error: E };
        } finally {
          try {
            g && !g.done && (i = h.return) && i.call(h);
          } finally {
            if (r)
              throw r.error;
          }
        }
      }
      if (o)
        throw new q(o);
    }
  }, t.prototype.add = function(e) {
    var n;
    if (e && e !== this)
      if (this.closed)
        pe(e);
      else {
        if (e instanceof t) {
          if (e.closed || e._hasParent(this))
            return;
          e._addParent(this);
        }
        (this._finalizers = (n = this._finalizers) !== null && n !== void 0 ? n : []).push(e);
      }
  }, t.prototype._hasParent = function(e) {
    var n = this._parentage;
    return n === e || Array.isArray(n) && n.includes(e);
  }, t.prototype._addParent = function(e) {
    var n = this._parentage;
    this._parentage = Array.isArray(n) ? (n.push(e), n) : n ? [n, e] : e;
  }, t.prototype._removeParent = function(e) {
    var n = this._parentage;
    n === e ? this._parentage = null : Array.isArray(n) && X(n, e);
  }, t.prototype.remove = function(e) {
    var n = this._finalizers;
    n && X(n, e), e instanceof t && e._removeParent(this);
  }, t.EMPTY = function() {
    var e = new t();
    return e.closed = !0, e;
  }(), t;
}(), be = Y.EMPTY;
function Ne(t) {
  return t instanceof Y || t && "closed" in t && b(t.remove) && b(t.add) && b(t.unsubscribe);
}
function pe(t) {
  b(t) ? t() : t.unsubscribe();
}
var Ie = {
  onUnhandledError: null,
  onStoppedNotification: null,
  Promise: void 0,
  useDeprecatedSynchronousErrorHandling: !1,
  useDeprecatedNextContext: !1
}, Q = {
  setTimeout: function(t, e) {
    for (var n = [], r = 2; r < arguments.length; r++)
      n[r - 2] = arguments[r];
    var i = Q.delegate;
    return i != null && i.setTimeout ? i.setTimeout.apply(i, V([t, e], H(n))) : setTimeout.apply(void 0, V([t, e], H(n)));
  },
  clearTimeout: function(t) {
    var e = Q.delegate;
    return ((e == null ? void 0 : e.clearTimeout) || clearTimeout)(t);
  },
  delegate: void 0
};
function Xe(t) {
  Q.setTimeout(function() {
    throw t;
  });
}
function he() {
}
function U(t) {
  t();
}
var Re = function(t) {
  F(e, t);
  function e(n) {
    var r = t.call(this) || this;
    return r.isStopped = !1, n ? (r.destination = n, Ne(n) && n.add(r)) : r.destination = et, r;
  }
  return e.create = function(n, r, i) {
    return new J(n, r, i);
  }, e.prototype.next = function(n) {
    this.isStopped || this._next(n);
  }, e.prototype.error = function(n) {
    this.isStopped || (this.isStopped = !0, this._error(n));
  }, e.prototype.complete = function() {
    this.isStopped || (this.isStopped = !0, this._complete());
  }, e.prototype.unsubscribe = function() {
    this.closed || (this.isStopped = !0, t.prototype.unsubscribe.call(this), this.destination = null);
  }, e.prototype._next = function(n) {
    this.destination.next(n);
  }, e.prototype._error = function(n) {
    try {
      this.destination.error(n);
    } finally {
      this.unsubscribe();
    }
  }, e.prototype._complete = function() {
    try {
      this.destination.complete();
    } finally {
      this.unsubscribe();
    }
  }, e;
}(Y), Qe = Function.prototype.bind;
function K(t, e) {
  return Qe.call(t, e);
}
var Je = function() {
  function t(e) {
    this.partialObserver = e;
  }
  return t.prototype.next = function(e) {
    var n = this.partialObserver;
    if (n.next)
      try {
        n.next(e);
      } catch (r) {
        M(r);
      }
  }, t.prototype.error = function(e) {
    var n = this.partialObserver;
    if (n.error)
      try {
        n.error(e);
      } catch (r) {
        M(r);
      }
    else
      M(e);
  }, t.prototype.complete = function() {
    var e = this.partialObserver;
    if (e.complete)
      try {
        e.complete();
      } catch (n) {
        M(n);
      }
  }, t;
}(), J = function(t) {
  F(e, t);
  function e(n, r, i) {
    var o = t.call(this) || this, s;
    if (b(n) || !n)
      s = {
        next: n ?? void 0,
        error: r ?? void 0,
        complete: i ?? void 0
      };
    else {
      var d;
      o && Ie.useDeprecatedNextContext ? (d = Object.create(n), d.unsubscribe = function() {
        return o.unsubscribe();
      }, s = {
        next: n.next && K(n.next, d),
        error: n.error && K(n.error, d),
        complete: n.complete && K(n.complete, d)
      }) : s = n;
    }
    return o.destination = new Je(s), o;
  }
  return e;
}(Re);
function M(t) {
  Xe(t);
}
function Ze(t) {
  throw t;
}
var et = {
  closed: !0,
  next: he,
  error: Ze,
  complete: he
}, tt = function() {
  return typeof Symbol == "function" && Symbol.observable || "@@observable";
}();
function nt(t) {
  return t;
}
function rt(t) {
  return t.length === 0 ? nt : t.length === 1 ? t[0] : function(n) {
    return t.reduce(function(r, i) {
      return i(r);
    }, n);
  };
}
var fe = function() {
  function t(e) {
    e && (this._subscribe = e);
  }
  return t.prototype.lift = function(e) {
    var n = new t();
    return n.source = this, n.operator = e, n;
  }, t.prototype.subscribe = function(e, n, r) {
    var i = this, o = ot(e) ? e : new J(e, n, r);
    return U(function() {
      var s = i, d = s.operator, c = s.source;
      o.add(d ? d.call(o, c) : c ? i._subscribe(o) : i._trySubscribe(o));
    }), o;
  }, t.prototype._trySubscribe = function(e) {
    try {
      return this._subscribe(e);
    } catch (n) {
      e.error(n);
    }
  }, t.prototype.forEach = function(e, n) {
    var r = this;
    return n = me(n), new n(function(i, o) {
      var s = new J({
        next: function(d) {
          try {
            e(d);
          } catch (c) {
            o(c), s.unsubscribe();
          }
        },
        error: o,
        complete: i
      });
      r.subscribe(s);
    });
  }, t.prototype._subscribe = function(e) {
    var n;
    return (n = this.source) === null || n === void 0 ? void 0 : n.subscribe(e);
  }, t.prototype[tt] = function() {
    return this;
  }, t.prototype.pipe = function() {
    for (var e = [], n = 0; n < arguments.length; n++)
      e[n] = arguments[n];
    return rt(e)(this);
  }, t.prototype.toPromise = function(e) {
    var n = this;
    return e = me(e), new e(function(r, i) {
      var o;
      n.subscribe(function(s) {
        return o = s;
      }, function(s) {
        return i(s);
      }, function() {
        return r(o);
      });
    });
  }, t.create = function(e) {
    return new t(e);
  }, t;
}();
function me(t) {
  var e;
  return (e = t ?? Ie.Promise) !== null && e !== void 0 ? e : Promise;
}
function it(t) {
  return t && b(t.next) && b(t.error) && b(t.complete);
}
function ot(t) {
  return t && t instanceof Re || it(t) && Ne(t);
}
var st = Te(function(t) {
  return function() {
    t(this), this.name = "ObjectUnsubscribedError", this.message = "object unsubscribed";
  };
}), we = function(t) {
  F(e, t);
  function e() {
    var n = t.call(this) || this;
    return n.closed = !1, n.currentObservers = null, n.observers = [], n.isStopped = !1, n.hasError = !1, n.thrownError = null, n;
  }
  return e.prototype.lift = function(n) {
    var r = new Ee(this, this);
    return r.operator = n, r;
  }, e.prototype._throwIfClosed = function() {
    if (this.closed)
      throw new st();
  }, e.prototype.next = function(n) {
    var r = this;
    U(function() {
      var i, o;
      if (r._throwIfClosed(), !r.isStopped) {
        r.currentObservers || (r.currentObservers = Array.from(r.observers));
        try {
          for (var s = $(r.currentObservers), d = s.next(); !d.done; d = s.next()) {
            var c = d.value;
            c.next(n);
          }
        } catch (y) {
          i = { error: y };
        } finally {
          try {
            d && !d.done && (o = s.return) && o.call(s);
          } finally {
            if (i)
              throw i.error;
          }
        }
      }
    });
  }, e.prototype.error = function(n) {
    var r = this;
    U(function() {
      if (r._throwIfClosed(), !r.isStopped) {
        r.hasError = r.isStopped = !0, r.thrownError = n;
        for (var i = r.observers; i.length; )
          i.shift().error(n);
      }
    });
  }, e.prototype.complete = function() {
    var n = this;
    U(function() {
      if (n._throwIfClosed(), !n.isStopped) {
        n.isStopped = !0;
        for (var r = n.observers; r.length; )
          r.shift().complete();
      }
    });
  }, e.prototype.unsubscribe = function() {
    this.isStopped = this.closed = !0, this.observers = this.currentObservers = null;
  }, Object.defineProperty(e.prototype, "observed", {
    get: function() {
      var n;
      return ((n = this.observers) === null || n === void 0 ? void 0 : n.length) > 0;
    },
    enumerable: !1,
    configurable: !0
  }), e.prototype._trySubscribe = function(n) {
    return this._throwIfClosed(), t.prototype._trySubscribe.call(this, n);
  }, e.prototype._subscribe = function(n) {
    return this._throwIfClosed(), this._checkFinalizedStatuses(n), this._innerSubscribe(n);
  }, e.prototype._innerSubscribe = function(n) {
    var r = this, i = this, o = i.hasError, s = i.isStopped, d = i.observers;
    return o || s ? be : (this.currentObservers = null, d.push(n), new Y(function() {
      r.currentObservers = null, X(d, n);
    }));
  }, e.prototype._checkFinalizedStatuses = function(n) {
    var r = this, i = r.hasError, o = r.thrownError, s = r.isStopped;
    i ? n.error(o) : s && n.complete();
  }, e.prototype.asObservable = function() {
    var n = new fe();
    return n.source = this, n;
  }, e.create = function(n, r) {
    return new Ee(n, r);
  }, e;
}(fe), Ee = function(t) {
  F(e, t);
  function e(n, r) {
    var i = t.call(this) || this;
    return i.destination = n, i.source = r, i;
  }
  return e.prototype.next = function(n) {
    var r, i;
    (i = (r = this.destination) === null || r === void 0 ? void 0 : r.next) === null || i === void 0 || i.call(r, n);
  }, e.prototype.error = function(n) {
    var r, i;
    (i = (r = this.destination) === null || r === void 0 ? void 0 : r.error) === null || i === void 0 || i.call(r, n);
  }, e.prototype.complete = function() {
    var n, r;
    (r = (n = this.destination) === null || n === void 0 ? void 0 : n.complete) === null || r === void 0 || r.call(n);
  }, e.prototype._subscribe = function(n) {
    var r, i;
    return (i = (r = this.source) === null || r === void 0 ? void 0 : r.subscribe(n)) !== null && i !== void 0 ? i : be;
  }, e;
}(we);
const Ce = new we();
function _(t) {
  Ce.next(t);
}
function at() {
  return Ce.asObservable();
}
class dt {
  constructor() {
    l(this, "googletag");
    l(this, "timeOutCornerBanner");
    l(this, "timeOutAdhesion");
    l(this, "insideAdCallback");
    l(this, "onCornerBannerFinish");
    l(this, "onCornerBannerLoaded");
    l(this, "mapBanners", /* @__PURE__ */ new Map());
    l(this, "onSlotRender", (e) => {
      const n = e.slot, r = n.getSlotElementId(), i = this.mapBanners.get(r);
      i && (e.isEmpty ? (a.warn("Banner slot rendered EMPTY", {
        slotId: r,
        bannerUrl: i.url,
        bannerType: i.type,
        adUnitPath: n.getAdUnitPath(),
        size: e.size,
        creativeId: e.creativeId,
        lineItemId: e.lineItemId
      }), i.type === "CORNER" && this.onCornerBannerFinish(!0), i.type === "ADHESION" && _("ERROR")) : (a.info("Banner slot rendered SUCCESSFULLY", {
        slotId: r,
        bannerUrl: i.url,
        size: e.size,
        creativeId: e.creativeId,
        lineItemId: e.lineItemId,
        advertiserId: e.advertiserId
      }), i.type === "CORNER" && this.onCornerBannerLoaded && this.onCornerBannerLoaded(), i.type === "ADHESION" && _("STARTED")));
    });
    l(this, "onViewableListener", (e) => {
      const n = e.slot, r = this.mapBanners.get(n.getSlotElementId());
      r && (r.type === "CORNER" ? this.timeOutCornerBanner = setTimeout(() => {
        if (!this.checkIfBannerExist(n.getSlotElementId())) {
          a.error("Banner not found refreshing false");
          return;
        }
        this.destroyCornerAdBanner();
      }, r.duration * 1e3) : r.type === "ADHESION" ? this.timeOutAdhesion = setTimeout(() => {
        if (!this.checkIfBannerExist(n.getSlotElementId())) {
          a.error("Banner not found refreshing false");
          return;
        }
        this.removeBanner(r.id);
      }, r.duration * 1e3) : setTimeout(() => {
        if (!this.checkIfBannerExist(n.getSlotElementId())) {
          a.error("Banner not found refreshing false");
          return;
        }
        a.info("Refreshing banner", r == null ? void 0 : r.id), this.googletag.pubads().refresh([n]);
      }, r.duration * 1e3));
    });
    $e().then((e) => {
      this.googletag = e, this.init();
    });
  }
  init() {
    this.googletag.cmd.push(() => {
      this.googletag.pubads().addEventListener("impressionViewable", this.onViewableListener), this.googletag.pubads().addEventListener("slotRenderEnded", this.onSlotRender), this.googletag.pubads().addEventListener("slotRequested", (e) => {
        const n = e.slot;
        this.mapBanners.get(n.getSlotElementId()) && a.info("Banner ad REQUEST sent to Google", {
          slotId: n.getSlotElementId(),
          adUnitPath: n.getAdUnitPath(),
          targetingKeys: n.getTargetingKeys()
        });
      }), this.googletag.pubads().addEventListener("slotResponseReceived", (e) => {
        const n = e.slot;
        this.mapBanners.get(n.getSlotElementId()) && a.info("Banner ad RESPONSE received from Google", {
          slotId: n.getSlotElementId(),
          adUnitPath: n.getAdUnitPath()
        });
      }), this.googletag.pubads().setCentering(!0), this.googletag.enableServices();
    });
  }
  checkIfBannerExist(e) {
    return this.mapBanners.has(e);
  }
  mapToBannerSizes(e) {
    const n = [];
    return e.forEach(({ width: r, height: i }) => {
      n.push([r, i]);
    }), n;
  }
  addBanners(e) {
    this.googletag.cmd.push(() => {
      e.forEach((n) => {
        if (n.type == "CORNER") {
          const o = document.querySelector("#streann-node");
          if (!o) {
            a.warn("streann-node not found - cannot insert corner banner"), setTimeout(() => this.addBanners([n]), 500);
            return;
          }
          const s = o.querySelector("#page-content");
          s && s.remove(), document.getElementById(n.id) || o.insertAdjacentHTML("beforeend", `<div id="${n.id}"></div>`);
          const d = this.mapBanners.get(n.id);
          if (d)
            try {
              this.googletag.destroySlots([d.slot]), this.mapBanners.delete(n.id), a.info("Destroyed existing banner slot", n.id);
            } catch (c) {
              a.warn("Error destroying existing slot:", c), this.mapBanners.delete(n.id);
            }
        }
        const r = this.mapToBannerSizes(n.sizes);
        a.info("Attempting to define banner slot", {
          adUnitPath: n.url,
          sizes: r,
          elementId: n.id,
          bannerType: n.type
        });
        const i = this.googletag.defineSlot(
          n.url,
          r,
          n.id
        );
        if (!i) {
          a.warn("Banner cannot be defined", n), n.type === "CORNER" && this.onCornerBannerFinish && this.onCornerBannerFinish(!0);
          return;
        }
        a.info("Banner defined successfully", {
          adUnitPath: i.getAdUnitPath(),
          slotElementId: i.getSlotElementId()
        }), i.addService(this.googletag.pubads()), this.mapBanners.set(n.id, { ...n, slot: i }), a.info("Calling googletag.display() for banner", n.id), this.googletag.display(n.id);
      });
    });
  }
  removeBanner(e) {
    const n = this.mapBanners.get(e);
    if (n) {
      if (n.type === "ADHESION") {
        _("FINISHED"), clearTimeout(this.timeOutAdhesion), this.clearSlot(n.slot), this.mapBanners.delete(e);
        return;
      }
      this.clearSlot(n.slot);
    }
  }
  addCallback(e, n, r) {
    this.insideAdCallback = e, this.onCornerBannerFinish = n, this.onCornerBannerLoaded = r;
  }
  destroyCornerAdBanner() {
    const e = this.mapBanners.get("corner-banner");
    e && (clearTimeout(this.timeOutCornerBanner), this.mapBanners.delete("corner-banner"), this.googletag.cmd.push(() => {
      try {
        this.googletag.destroySlots([e.slot]), a.info("Destroyed corner banner slot");
      } catch (n) {
        a.warn("Error destroying corner banner slot:", n);
      }
    }), this.onCornerBannerFinish(!1), this.insideAdCallback && this.insideAdCallback.insideAdStop());
  }
  clearSlot(e) {
    this.googletag.cmd.push(() => {
      const n = this.googletag.pubads().clear([e]);
      a.info("clearing slot", e, "is Cleared", n);
      try {
        const r = e.getSlotElementId();
        this.mapBanners.has(r) && (this.mapBanners.delete(r), a.info("deleted banner mapping for", r));
      } catch (r) {
        a.warn("Could not delete banner map entry:", r);
      }
    });
  }
  clearAllSlots() {
    this.googletag.cmd.push(() => {
    }), this.mapBanners.clear();
  }
}
const L = new dt();
let m, A, k, j, w, C, p, z, re, u, G, Z, x = !1, v = 0;
const Be = `
<div id="page-content">
    <div id="video-container">
      <video id="video-element" src="">
      </video>
      <div id="ad-container"></div>
    </div>
</div>
`, lt = `
<div id="page-content-split-ad">
 <div id="video-container-split-ad">
      <video id="video-element" src="">
      </video>
      <div id="ad-container"></div>
    </div>
</div>
`;
let ie = "", N;
function ct(t, e, n, r) {
  v++;
  const i = v;
  a.info("initImaSdk called - starting VAST ad request", {
    vastUrl: e,
    sessionId: i,
    timestamp: (/* @__PURE__ */ new Date()).toISOString()
  }), ve().then((o) => {
    var c;
    if (i !== v) {
      a.warn("STALE SESSION detected - ad request cancelled", {
        requestedSessionId: i,
        currentSessionId: v
      });
      return;
    }
    G = n, Z = r, N = t, (c = document.querySelector("#streann-node")) == null || c.insertAdjacentHTML("beforeend", Be), u = o, ie = Le(e), p = document.getElementById("video-element"), j = document.getElementById("playButton"), w = document.getElementById("mute"), C = document.getElementById("un-mute"), C.style.display = "none", w.style.display = "none";
    const s = document.getElementById("cornerCloseButton"), d = document.getElementById("streann-logo");
    s && (s.style.display = "none"), d && (d.style.display = "none"), mt(), De();
  }).catch((o) => {
    a.error("Fail loading ima", o);
  });
}
function ut(t, e, n, r) {
  ve().then((i) => {
    G = n, N = t;
    const o = document.getElementById(r);
    if (o)
      o.insertAdjacentHTML("beforeend", lt);
    else {
      console.error(`Container with id ${r} not found`);
      return;
    }
    u = i, ie = Le(e), p = o.querySelector("#video-element"), j = o.querySelector("#playButton"), Et(r), De();
  }).catch((i) => {
    a.error("Fail loading ima", i);
  });
}
function Le(t) {
  switch (!0) {
    case t.includes("[STREANN-PLAYER-HEIGHT]"):
      return t.replace("[STREANN-PLAYER-HEIGHT]", window.innerHeight.toString());
    case t.includes("[STREANN-PLAYER-WIDTH]"):
      return t.replace("[STREANN-PLAYER-WIDTH]", window.innerWidth.toString());
    case t.includes("[STREANN-APP-BUNDLE-ID]"):
      return t.replace("[STREANN-APP-BUNDLE-ID]", "");
    case t.includes("[STREANN-APP-NAME]"):
      return t.replace("[STREANN-APP-NAME]", "");
    case t.includes("[STREANN-APP-VERSION]"):
      return t.replace("[STREANN-APP-VERSION]", "");
    case t.includes("[STREANN-APP-DOMAIN]"):
      return t.replace("[STREANN-APP-DOMAIN]", "");
    case t.includes("[STREANN-APP-STORE-URL]"):
      return t.replace("[STREANN-APP-STORE-URL]", "");
    case t.includes("[STREANN-SITE-URL]"):
      return t.replace("[STREANN-SITE-URL]", `${window.location.origin}${window.location.pathname}`);
    case t.includes("[STREANN-CONTENT-ID]"): {
      const e = localStorage.getItem("streannContentId") || "";
      return t.replace("[STREANN-CONTENT-ID]", e);
    }
    case t.includes("[STREANN-CONTENT-TITLE]"): {
      const e = localStorage.getItem("streannContentTitle") || "";
      return t.replace("[STREANN-CONTENT-TITLE]", e);
    }
    case t.includes("[STREANN-CONTENT-LENGTH]"):
      return t.replace("[STREANN-CONTENT-LENGTH]", "");
    case t.includes("[STREANN-CONTENT-URL]"):
      return t.replace("[STREANN-CONTENT-URL]", window.location.href);
    case t.includes("[STREANN-CONTENT-ENCODED-URL]"):
      return t.replace("[STREANN-CONTENT-ENCODED-URL]", "");
    case t.includes("[STREANN-DESCRIPTION-URL]"):
      return t.replace("[STREANN-DESCRIPTION-URL]", "");
    case t.includes("[STREANN-DEVICE-ID]"):
      return t.replace("[STREANN-DEVICE-ID]", "");
    case t.includes("[STREANN-NETWORK]"):
      return t.replace("[STREANN-NETWORK]", "");
    case t.includes("[STREANN-CARRIER]"):
      return t.replace("[STREANN-CARRIER]", "");
    case t.includes("[STREANN-DEVICE-MANUFACTURER]"):
      return t.replace("[STREANN-DEVICE-MANUFACTURER]", "");
    case t.includes("[STREANN-DEVICE-MODEL]"):
      return t.replace("[STREANN-DEVICE-MODEL]", "");
    case t.includes("[STREANN-DEVICE-OS]"):
      return t.replace("[STREANN-DEVICE-OS]", "");
    case t.includes("[STREANN-DEVICE-OS-VERSION]"):
      return t.replace("[STREANN-DEVICE-OS-VERSION]", "");
    case t.includes("[STREANN-DEVICE-TYPE]"):
      return t.replace("[STREANN-DEVICE-TYPE]", "web");
    case t.includes("[STREANN-IP]"):
      return t.replace("[STREANN-IP]", "https://geoip.streann.com/");
    case t.includes("[STREANN-UA]"):
      return t.replace("[STREANN-UA]", navigator.userAgent);
    case t.includes("[STREANN-IFA-TYPE]"):
      return t.replace("[STREANN-IFA-TYPE]", "");
    case t.includes("[STREANN-ADVERTISING-ID]"):
      return t.replace("[STREANN-ADVERTISING-ID]", "");
    case t.includes("[STREANN-ADVERTISING-ID-HEX]"):
      return t.replace("[STREANN-ADVERTISING-ID-HEX]", "");
    case t.includes("[STREANN-ADVERTISING-ID-MD5]"):
      return t.replace("[STREANN-ADVERTISING-ID-MD5]", "");
    case t.includes("[STREANN-IDFA]"):
      return t.replace("[STREANN-IDFA]", "");
    case t.includes("[STREANN-IDFA-MD5]"):
      return t.replace("[STREANN-IDFA-MD5]", "");
    case t.includes("[STREANN-IDFA-HEX]"):
      return t.replace("[STREANN-IDFA-HEX]", "");
    case t.includes("[STREANN-LOCATION-LAT]"):
      return t.replace("[STREANN-LOCATION-LAT]", "");
    case t.includes("[STREANN-LOCATION-LONG]"):
      return t.replace("[STREANN-LOCATION-LONG]", "");
    case t.includes("[STREANN-COUNTRY-ID]"): {
      const e = localStorage.getItem("streannCountryId") || "";
      return t.replace("[STREANN-COUNTRY-ID]", e);
    }
    case t.includes("[STREANN-DO-NOT-TRACK]"):
      return t.replace("[STREANN-DO-NOT-TRACK]", "");
    case t.includes("[STREANN-GDPR]"):
      return t.replace("[STREANN-GDPR]", "");
    case t.includes("[STREANN-GDPR-CONSENT]"):
      return t.replace("[STREANN-GDPR-CONSENT]", "");
    case t.includes("[STREANN-USER-BIRTHYEAR]"):
      return t.replace("[STREANN-USER-BIRTHYEAR]", "");
    case t.includes("[STREANN-USER-GENDER]"):
      return t.replace("[STREANN-USER-GENDER]", "");
    case t.includes("[STREANN-CACHEBUSTER]"): {
      const e = () => Math.random().toString(36).substring(2, 12);
      return t.replace("[STREANN-CACHEBUSTER]", e());
    }
    case t.includes("[STREANN-US-PRIVACY]"):
      return t.replace("[STREANN-US-PRIVACY]", "");
    default:
      return t;
  }
}
function pt(t) {
  var i;
  (i = document.querySelector("#streann-node")) == null || i.insertAdjacentHTML("beforeend", Be);
  const e = document.getElementById("video-element");
  j = document.getElementById("playButton"), w = document.getElementById("mute"), C = document.getElementById("un-mute");
  const n = document.getElementById("cornerCloseButton"), r = document.getElementById("streann-logo");
  n && (n.style.display = "none"), r && (r.style.display = "block"), e.src = t.url, e.load(), C.style.display = "block", w.style.display = "none", e.addEventListener("play", () => {
    r && (r.style.display = "block");
  }), e.muted = !0, e.play().catch(function(o) {
    console.error("Autoplay failed:", o);
  }), e.addEventListener("click", function() {
    t.properties.clickThroughUrl && window.open(t.properties.clickThroughUrl, "_blank");
  }), e.addEventListener("ended", oe), w.addEventListener("click", () => {
    e.muted = !0, w.style.display = "none", C.style.display = "block";
  }), C.addEventListener("click", () => {
    e.muted = !1, C.style.display = "none", w.style.display = "block";
  });
}
function oe() {
  const t = document.getElementById("video-element");
  t && (t.pause(), t.removeEventListener("ended", oe), t.style.display = "none");
  const e = document.getElementById("page-content");
  e && e.remove();
}
function De() {
  p.volume = 0, p.muted = !0;
  const t = p.play();
  t !== void 0 && t.then(ht).catch(ft);
}
function ht() {
  p.pause(), z = !0, re = !0, Oe();
}
function ft() {
  p.pause(), z = !0, re = !0, Oe();
}
function mt() {
  yt(), A = new u.AdsLoader(k), A.getSettings().setDisableCustomPlaybackForIOS10Plus(!0), A.addEventListener(
    u.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,
    Pe,
    !1
  ), x = !1, A.addEventListener(u.AdErrorEvent.Type.AD_ERROR, ae, !1), p.onended = se;
}
function Et(t) {
  At(t), A = new u.AdsLoader(k), A.addEventListener(
    u.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,
    Pe,
    !1
  ), A.addEventListener(u.AdErrorEvent.Type.AD_ERROR, ae, !1), p.onended = se;
}
function At(t) {
  var n;
  const e = (n = document.getElementById(t)) == null ? void 0 : n.querySelector("#ad-container");
  if (e.style.display = "none", !e) {
    console.error(`Ad container not found in ${t}`);
    return;
  }
  k = new u.AdDisplayContainer(e, p);
}
function se() {
  p.onended = null, A && A.contentComplete();
}
function Oe() {
  const t = new u.AdsRequest();
  t.adTagUrl = ie, t.linearAdSlotWidth = p.clientWidth, t.linearAdSlotHeight = p.clientHeight, t.nonLinearAdSlotWidth = p.clientWidth, t.nonLinearAdSlotHeight = p.clientHeight / 3, t.vastLoadTimeout = 1e4, t.setAdWillAutoPlay(z), t.setAdWillPlayMuted(re), A.requestAds(t);
}
function yt() {
  const t = document.getElementById("ad-container");
  if (!t) {
    console.error("NO AD CONTIANER");
    return;
  }
  k = new u.AdDisplayContainer(t, p);
}
function gt() {
  try {
    k.initialize(), m.init(
      p.clientWidth,
      p.clientHeight,
      u.ViewMode.NORMAL
    ), m.start();
  } catch (t) {
    console.error(t), p.play();
  }
}
function Pe(t) {
  const e = new u.AdsRenderingSettings();
  e.restoreCustomPlaybackStateOnAdBreakComplete = !0, e.loadVideoTimeout = 15e3, m = t.getAdsManager(
    p,
    e
  ), m.setVolume(0), x = !1, m.addEventListener(u.AdErrorEvent.Type.AD_ERROR, ae), m.addEventListener(
    u.AdEvent.Type.CONTENT_PAUSE_REQUESTED,
    St
  ), m.addEventListener(
    u.AdEvent.Type.CONTENT_RESUME_REQUESTED,
    vt
  ), m.addEventListener(u.AdEvent.Type.ALL_ADS_COMPLETED, O), m.addEventListener(u.AdEvent.Type.LOADED, O), m.addEventListener(u.AdEvent.Type.STARTED, O), m.addEventListener(u.AdEvent.Type.IMPRESSION, O), m.addEventListener(u.AdEvent.Type.COMPLETE, O), z ? gt() : j.style.display = "block";
}
function O(t) {
  var n;
  const e = t.getAd();
  switch (a.info(t), t.type) {
    case u.AdEvent.Type.LOADED:
      N.insideAdLoaded(), e.isLinear() || p.play();
      break;
    case u.AdEvent.Type.STARTED:
      N.insideAdPlay();
      const r = (n = document.getElementById("split-ad-container")) == null ? void 0 : n.querySelector("#ad-container");
      if (r) {
        r.style.display = "block";
        const i = document.getElementById("vjsplayer");
        i && (i.style.width = "50%", i.style.float = "right");
      }
      break;
    case u.AdEvent.Type.IMPRESSION:
      de(!0), Z && Z();
      break;
    case u.AdEvent.Type.CLICK:
      N.insideAdClicked();
      break;
    case u.AdEvent.Type.SKIPPED:
      ee(), N.insideAdSkipped();
      break;
    case u.AdEvent.Type.ALL_ADS_COMPLETED:
      ee();
      break;
    case u.AdEvent.Type.COMPLETE:
      break;
  }
}
function ae(t) {
  var n;
  if (x) {
    a.warn("VAST error BLOCKED - adErrorHandled flag already true", {
      errorCode: t.getError().getErrorCode(),
      errorMessage: t.getError().getMessage(),
      currentSessionId: v
    });
    return;
  }
  if (x = !0, a.error("VAST ad ERROR - triggering fallback", {
    errorCode: t.getError().getErrorCode(),
    errorMessage: t.getError().getMessage(),
    errorType: t.getError().getType(),
    sessionId: v
  }), v++, a.info("Session ID incremented to prevent stale errors", {
    newSessionId: v
  }), (n = document.getElementById("split-ad-container")) == null || n.remove(), m)
    try {
      m.destroy();
    } catch {
    }
  if (A)
    try {
      A.contentComplete();
    } catch {
    }
  const e = document.getElementById("page-content");
  e && e.remove(), p && (p.onended = null, p.pause()), de(!1), N.insideAdError(t.getError().toString()), a.info("VAST error cleanup complete - calling onAdFinish(true) to trigger waterfall"), G(!0);
}
function St() {
  p.pause(), p.onended = null;
}
function vt() {
  p.onended = se;
}
function ee() {
  if (a.info("destoryIma called - cleaning up VAST ad", {
    sessionId: v
  }), v++, G(), de(!1), m)
    try {
      m.destroy(), a.info("adsManager destroyed successfully");
    } catch (e) {
      a.warn("Error destroying adsManager:", e);
    }
  if (A)
    try {
      A.contentComplete(), a.info("adsLoader content complete called");
    } catch (e) {
      a.warn("Error calling adsLoader.contentComplete:", e);
    }
  const t = document.getElementById("page-content");
  t && t.remove(), N.insideAdStop();
}
function de(t) {
  const e = document.getElementById("streann-logo");
  t ? e && (e.style.display = "block") : e && (e.style.display = "none");
}
const B = class B {
  constructor(e, n, r) {
    l(this, "placement");
    // private ad : any;
    l(this, "counterFailedCornerAd", 0);
    l(this, "insideAdCallback");
    l(this, "currentAd");
    l(this, "closeButtonTimer");
    l(this, "adInProgress", !1);
    l(this, "lastAttemptTime", 0);
    l(this, "currentAttemptCount", 0);
    l(this, "finishing", !1);
    this.placement = e, this.insideAdCallback = r;
    const i = 1;
    this.counterFailedCornerAd = 0, setTimeout(() => {
      this.startAd(n);
    }, Number(i) * 1e3);
  }
  cornerElem(e) {
    return `
  <div id="streann-node" style="${e}">
    <div id="cornerCloseButton" class="closeButton">x</div>
    <div id="streann-logo" class="streann-logo">
      <a href="https://streann.com/" target="_blank">
        <img src="https://img.streann.com/streann-img/559ff7ade4b0d0aff40888dd/uploads/images/754c4884-ab89-4331-9134-bbe6f89bde28/NEW_Streann-Logo-Icon-Inside-Corner.png" class="logo" alt="streann-logo">    
      </a>
    </div>
    <div id="un-mute" class="un-mute">
      <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" class="bi bi-volume-mute-fill" viewBox="0 0 16 16">
        <path d="M6.717 3.55A.5.5 0 0 1 7 4v8a.5.5 0 0 1-.812.39L3.825 10.5H1.5A.5.5 0 0 1 1 10V6a.5.5 0 0 1 .5-.5h2.325l2.363-1.89a.5.5 0 0 1 .529-.06m7.137 2.096a.5.5 0 0 1 0 .708L12.207 8l1.647 1.646a.5.5 0 0 1-.708.708L11.5 8.707l-1.646 1.647a.5.5 0 0 1-.708-.708L10.793 8 9.146 6.354a.5.5 0 1 1 .708-.708L11.5 7.293l1.646-1.647a.5.5 0 0 1 .708 0"/>
      </svg>
    </div>
    <div class="mute" id="mute">
      <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" class="bi bi-volume-up-fill" viewBox="0 0 16 16">
        <path d="M11.536 14.01A8.47 8.47 0 0 0 14.026 8a8.47 8.47 0 0 0-2.49-6.01l-.708.707A7.48 7.48 0 0 1 13.025 8c0 2.071-.84 3.946-2.197 5.303z"/>
        <path d="M10.121 12.596A6.48 6.48 0 0 0 12.025 8a6.48 6.48 0 0 0-1.904-4.596l-.707.707A5.48 5.48 0 0 1 11.025 8a5.48 5.48 0 0 1-1.61 3.89z"/>
        <path d="M8.707 11.182A4.5 4.5 0 0 0 10.025 8a4.5 4.5 0 0 0-1.318-3.182L8 5.525A3.5 3.5 0 0 1 9.025 8 3.5 3.5 0 0 1 8 10.475zM6.717 3.55A.5.5 0 0 1 7 4v8a.5.5 0 0 1-.812.39L3.825 10.5H1.5A.5.5 0 0 1 1 10V6a.5.5 0 0 1 .5-.5h2.325l2.363-1.89a.5.5 0 0 1 .529-.06"/>
      </svg>
    </div>
  </div>
`;
  }
  // Delay before trying next ad in waterfall
  startAd(e) {
    var i;
    if (this.adInProgress) {
      a.warn("BLOCKED: Ad already in progress, skipping startAd", {
        blockedAdType: e.adType,
        blockedAdName: e.name,
        currentAdInProgress: (i = this.currentAd) == null ? void 0 : i.adType
      });
      return;
    }
    const n = Date.now(), r = n - this.lastAttemptTime;
    if (this.currentAttemptCount > 0 && r < B.MIN_RETRY_DELAY && this.lastAttemptTime > 0) {
      const o = B.MIN_RETRY_DELAY - r;
      a.warn("RATE LIMITED: Delaying startAd", {
        adType: e.adType,
        adName: e.name,
        delayMs: o
      }), setTimeout(() => this.startAd(e), o);
      return;
    }
    if (this.lastAttemptTime = n, this.currentAttemptCount++, a.info("Starting ad attempt", {
      adType: e.adType,
      adName: e.name,
      attemptNumber: this.currentAttemptCount,
      waterfallDepth: this.counterFailedCornerAd
    }), this.adInProgress = !0, this.currentAd = e, this.createCornerAdView(), e.adType == R.VAST)
      ct(
        this.insideAdCallback,
        e.url,
        this.onAdFinish.bind(this),
        this.startCloseButtonTimer.bind(this)
        // Start timer only when VAST ad loads
      );
    else if (e.adType == R.BANNER) {
      L.addCallback(
        this.insideAdCallback,
        this.onAdFinish.bind(this),
        this.startCloseButtonTimer.bind(this)
        // Start timer only when banner loads
      );
      const o = {
        duration: e.properties.durationInSeconds,
        id: "corner-banner",
        sizes: e.properties.sizes,
        type: "CORNER",
        url: e.url
      };
      L.addBanners([o]);
    } else
      e.adType == R.LOCAL_VIDEO && pt(e);
  }
  createCornerAdView() {
    var r, i, o;
    if (document.getElementById("streann-node")) {
      const s = document.getElementById("cornerCloseButton");
      s && (s.style.display = "none");
      return;
    }
    const n = ((i = (r = this.placement.properties) == null ? void 0 : r.webSettings) == null ? void 0 : i.styles) || `
      position: fixed;
      bottom: 20px;
      right: 20px;
      z-index: 1000;
      width: 300px;
      height: 250px;
    `;
    a.info("style", n), (o = document.querySelector("body")) == null || o.insertAdjacentHTML("beforeend", this.cornerElem(n || ""));
  }
  // Call this when ad successfully loads (from bannerService or ima)
  startCloseButtonTimer() {
    this.showCloseButton();
  }
  showCloseButton() {
    if (this.closeButtonTimer && (clearTimeout(this.closeButtonTimer), this.closeButtonTimer = void 0), this.placement.properties.showCloseButtonAfterSeconds != null) {
      const e = this.placement.properties.showCloseButtonAfterSeconds;
      this.closeButtonTimer = setTimeout(() => {
        const n = document.getElementById("cornerCloseButton");
        n && (n.onclick = this.handleOnCloseButton.bind(this), n.style.setProperty("display", "block"));
      }, Number(e) * 1e3);
    }
  }
  handleOnCloseButton() {
    var e, n, r;
    ((e = this.currentAd) == null ? void 0 : e.adType) == R.BANNER ? L.destroyCornerAdBanner() : ((n = this.currentAd) == null ? void 0 : n.adType) == R.VAST ? ee() : ((r = this.currentAd) == null ? void 0 : r.adType) == R.LOCAL_VIDEO ? oe() : a.error("Closing UnSupperoted ad type");
  }
  onAdFinish(e = !1) {
    var s, d, c, y, S, f, h, g;
    if (this.finishing)
      return;
    this.finishing = !0, this.adInProgress = !1, this.closeButtonTimer && (clearTimeout(this.closeButtonTimer), this.closeButtonTimer = void 0), a.info("cornerAd finished", {
      withError: e,
      failedAttempts: this.counterFailedCornerAd,
      currentAdType: (s = this.currentAd) == null ? void 0 : s.adType,
      currentAdName: (d = this.currentAd) == null ? void 0 : d.name,
      hasFallback: !!((c = this.currentAd) != null && c.fallback)
    });
    const n = (y = this.currentAd) == null ? void 0 : y.fallback;
    if (n && e && this.counterFailedCornerAd < 20) {
      a.info("cornerAd starting waterfall ad", {
        adId: n.id,
        adName: n.name,
        adType: n.adType,
        waterfallDepth: this.counterFailedCornerAd + 1
      }), this.counterFailedCornerAd++;
      const I = document.getElementById("cornerCloseButton"), E = document.getElementById("streann-logo");
      I && (I.style.display = "none"), E && (E.style.display = "none"), this.finishing = !1, setTimeout(() => {
        this.startAd(n);
      }, B.WATERFALL_RETRY_DELAY);
      return;
    }
    e && !n ? a.warn("cornerAd waterfall EXHAUSTED - no more fallbacks", {
      lastAdType: (S = this.currentAd) == null ? void 0 : S.adType,
      lastAdName: (f = this.currentAd) == null ? void 0 : f.name,
      totalAttempts: this.counterFailedCornerAd + 1
    }) : e && this.counterFailedCornerAd >= 20 && a.error("cornerAd waterfall MAX RETRIES reached", {
      lastAdType: (h = this.currentAd) == null ? void 0 : h.adType,
      lastAdName: (g = this.currentAd) == null ? void 0 : g.name,
      totalAttempts: this.counterFailedCornerAd + 1
    });
    const r = e ? 0 : 1e3;
    this.counterFailedCornerAd = 0, this.currentAttemptCount = 0, this.lastAttemptTime = 0;
    const i = document.getElementById("cornerCloseButton"), o = document.getElementById("streann-logo");
    i && (i.style.display = "none"), o && (o.style.display = "none"), setTimeout(() => {
      const I = document.getElementById("streann-node");
      I && I.remove(), this.finishing = !1, this.insideAdCallback && this.insideAdCallback.insideAdStop();
    }, r);
  }
};
l(B, "MIN_RETRY_DELAY", 1e3), // 1 second between attempts
l(B, "WATERFALL_RETRY_DELAY", 500);
let te = B;
class Tt {
  constructor(e, n) {
    var c, y, S;
    const r = {
      id: "",
      duration: n.properties.durationInSeconds,
      sizes: n.properties.sizes,
      type: "EMBED",
      url: n.url
    }, i = (c = e.properties) == null ? void 0 : c.webSettings;
    if (!i) {
      a.error("invalid Embed placement with out web settings");
      return;
    }
    const { elemId: o, parentXpath: s, advancedScript: d } = i;
    if (o) {
      const f = document.getElementById(o);
      if (!f) {
        a.error("invalid element id");
        return;
      }
      const h = (S = (y = e.properties) == null ? void 0 : y.webSettings) == null ? void 0 : S.styles;
      h && f.setAttribute("style", h), r.id = o;
    } else if (s) {
      const f = this.getElementByXpath(s);
      if (!f) {
        a.error("invalid xpath");
        return;
      }
      if (document.getElementById(e.id))
        r.id = e.id;
      else {
        const g = this.generateElement(e);
        f.appendChild(g), r.id = e.id;
      }
    } else if (d) {
      const f = new Function(d)();
      if (!document.getElementById(f)) {
        a.error("invalid element id advanced script");
        return;
      }
      r.id = f;
    } else {
      a.error("invalid Embed placement with incorrect web settings");
      return;
    }
    L.addBanners([r]);
  }
  getElementByXpath(e) {
    return document.evaluate(
      e,
      document,
      null,
      XPathResult.FIRST_ORDERED_NODE_TYPE,
      null
    ).singleNodeValue;
  }
  generateElement(e) {
    var i, o;
    const n = document.createElement("div");
    n.setAttribute("id", e.id);
    const r = (o = (i = e.properties) == null ? void 0 : i.webSettings) == null ? void 0 : o.styles;
    return r && n.setAttribute("style", r), n;
  }
  randId() {
    return Math.random().toString(36).replace("0.", "inside-ad");
  }
}
class bt {
  constructor() {
    l(this, "adHeasonElem", `<div id="streann-adhesion">
    <div class="adhesion-container">
        <div id="adhesion">
        </div>
    </div>
    <div class="close-btn-container">
    <button id='adHesionCloseBtn' class="closeButton">x</button>
    </div>
</div>`);
    l(this, "lastShownLocation", "");
    l(this, "adHesionTimeout");
  }
  setAd(e, n) {
    if (this.lastShownLocation == location.pathname)
      return;
    at().subscribe({
      next: (i) => {
        switch (a.info("Adhesion Event", i), i) {
          case "REQUESTED":
            this.lastShownLocation = location.pathname;
            break;
          case "ERROR":
            this.onAdFinish();
            break;
          case "STARTED":
            break;
          case "FINISHED":
            this.onAdFinish();
            break;
        }
      }
    });
    const r = e.properties.startAfterSeconds;
    r != null ? (clearTimeout(this.adHesionTimeout), this.adHesionTimeout = setTimeout(() => {
      this.startAd(n);
    }, Number(r) * 1e3)) : this.startAd(n);
  }
  onCloseButton() {
    L.removeBanner("adhesion");
  }
  createAdHeasonElem() {
    var n;
    (n = document.querySelector("body")) == null || n.insertAdjacentHTML("beforeend", this.adHeasonElem);
    const e = document.getElementById("adHesionCloseBtn");
    e && (e.style.setProperty("display", "block"), e.onclick = this.onCloseButton.bind(this));
  }
  startAd(e) {
    _("REQUESTED"), this.createAdHeasonElem();
    const n = {
      duration: e.properties.durationInSeconds,
      id: "adhesion",
      sizes: e.properties.sizes,
      type: "ADHESION",
      url: e.url
      // url: "/22290518902/flexflix_web_corner_rectangle",
    };
    L.addBanners([n]);
  }
  onAdFinish() {
    var e;
    (e = document.getElementById("streann-adhesion")) == null || e.remove();
  }
}
const ke = new bt();
class Nt {
  constructor(e, n, r) {
    l(this, "placement");
    l(this, "ad");
    l(this, "insideAdCallback");
    l(this, "currentAd");
    l(this, "insideAdActive", !1);
    this.placement = e, this.ad = n, this.insideAdCallback = r, setTimeout(() => {
      this.startAd(n);
    }, Number(5) * 1e3), window.addEventListener("popstate", this.removeAd.bind(this)), window.addEventListener("hashchange", this.removeAd.bind(this));
  }
  splitAdElem(e) {
    return `<div id="streann-splitad" style="${e};height: 100vh; background: black; display: flex; justify-content: center; align-items: center; position: relative;">
            <video id="ad-player" style="width: 100%; height: 100%;"></video>
            <button id="cornerUnmuteSplitAdButton" class="split-ad-unmute-btn"></button>
            <button id="cornerCloseSplitAdButton" class="split-ad-close-btn">Skip Ad</button>
        </div>`;
  }
  initLocalVideoAd_(e) {
    const n = document.getElementById("ad-player");
    n ? (n.style.display = "none", n.addEventListener("play", () => {
      n.style.display = "block";
    }), n.src = e.url, n.muted = !0, n.autoplay = !0, n.play().catch((r) => {
      console.error("Error playing ad video:", r);
    }), n.addEventListener("ended", () => {
      var i;
      console.log("Ad finished playing"), (i = document.getElementById("streann-splitad")) == null || i.remove();
      const r = document.getElementById("vjsplayer");
      r && (r.style.width = "100%", r.style.float = "none");
    })) : console.error("Ad player not found");
  }
  startAd(e) {
    if (this.insideAdActive)
      return;
    this.insideAdActive = !0;
    const n = localStorage.getItem("streannShowSplitAd");
    if (this.cleanupExistingAdContainer(), !n || n === "false") {
      console.warn("No ads in player"), this.insideAdActive = !1;
      return;
    } else {
      this.currentAd = e;
      const r = document.querySelector("body");
      r && (r.classList.remove("flex-column"), r.classList.add("flex-row-reverse")), e.adType === "LOCAL_VIDEO" ? (this.createSplitAdView(), this.initLocalVideoAd_(e)) : e.adType === "VAST" ? (this.createSplitAdViewVast(), ut(this.insideAdCallback, e.url, this.removeAd, "split-ad-container")) : console.warn("Ad type not supported");
    }
  }
  createSplitAdViewVast() {
    const e = document.createElement("div");
    e.id = "split-ad-container", e.style.setProperty("width", "50%", "important"), e.style.background = "black", e.style.height = "100vh", e.style.display = "flex", e.style.justifyContent = "center", e.style.alignItems = "center", document.body.appendChild(e);
  }
  createSplitAdView() {
    var r, i, o;
    const e = document.getElementById("vjsplayer");
    e && (e.style.width = "50%", e.style.float = "right", e.style.height = "100vh", e.style.display = "flex", e.style.justifyContent = "center", e.style.alignItems = "center");
    const n = ((i = (r = this.placement.properties) == null ? void 0 : r.webSettings) == null ? void 0 : i.styles) || "";
    (o = document.querySelector("body")) == null || o.insertAdjacentHTML("beforeend", this.splitAdElem(n)), this.showCloseButton(), this.showUnmuteButton();
  }
  showCloseButton() {
    if (this.placement.properties.showCloseButtonAfterSeconds != null) {
      const e = document.getElementById("cornerCloseSplitAdButton");
      if (!e)
        return;
      const n = this.placement.properties.showCloseButtonAfterSeconds;
      e.style.setProperty("display", "none"), setTimeout(() => {
        e.onclick = this.handleOnCloseButton.bind(this), e.style.setProperty("display", "block");
      }, Number(n) * 1e3);
    }
  }
  showUnmuteButton() {
    const e = document.getElementById("cornerUnmuteSplitAdButton");
    e && (e.innerHTML = `<svg width="24" height="24" viewBox="0 0 24 24" fill="white">
                <path d="M16.5 12c0-1.77-1.02-3.29-2.5-4.03v2.21l2.45 2.45c.03-.2.05-.41.05-.63zm2.5 0c0 .94-.2 1.82-.54 2.64l1.51 1.51C20.63 14.91 21 13.5 21 12c0-4.28-2.99-7.86-7-8.77v2.06c2.89.86 5 3.54 5 6.71zM4.27 3L3 4.27 7.73 9H3v6h4l5 5v-6.73l4.25 4.25c-.67.52-1.42.93-2.25 1.18v2.06c1.38-.31 2.63-.95 3.69-1.81L19.73 21 21 19.73l-9-9L4.27 3zM12 4L9.91 6.09 12 8.18V4z"/>
            </svg>`, e.onclick = this.toggleMute.bind(this));
  }
  toggleMute() {
    const e = document.getElementById("cornerUnmuteSplitAdButton"), n = document.getElementById("ad-player");
    !n || !e || (n.muted ? (n.muted = !1, e.innerHTML = `<svg width="24" height="24" viewBox="0 0 24 24" fill="white">
                    <path d="M3 9v6h4l5 5V4L7 9H3zm13.5 3c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02zM14 3.23v2.06c2.89.86 5 3.54 5 6.71s-2.11 5.85-5 6.71v2.06c4.01-.91 7-4.49 7-8.77s-2.99-7.86-7-8.77z"/>
                </svg>`) : (n.muted = !0, e.innerHTML = `<svg width="24" height="24" viewBox="0 0 24 24" fill="white">
                    <path d="M16.5 12c0-1.77-1.02-3.29-2.5-4.03v2.21l2.45 2.45c.03-.2.05-.41.05-.63zm2.5 0c0 .94-.2 1.82-.54 2.64l1.51 1.51C20.63 14.91 21 13.5 21 12c0-4.28-2.99-7.86-7-8.77v2.06c2.89.86 5 3.54 5 6.71zM4.27 3L3 4.27 7.73 9H3v6h4l5 5v-6.73l4.25 4.25c-.67.52-1.42.93-2.25 1.18v2.06c1.38-.31 2.63-.95 3.69-1.81L19.73 21 21 19.73l-9-9L4.27 3zM12 4L9.91 6.09 12 8.18V4z"/>
                </svg>`));
  }
  handleOnCloseButton() {
    const e = document.getElementById("streann-splitad"), n = document.getElementById("ad-player");
    n && (n.pause(), n.currentTime = 0), e && e.remove();
    const r = document.getElementById("vjsplayer");
    r && (r.style.width = "100%", r.style.float = "none");
  }
  removeAd() {
    var r, i;
    this.insideAdActive = !1, (r = document.getElementById("split-ad-container")) == null || r.remove(), (i = document.getElementById("streann-splitad")) == null || i.remove();
    const e = document.getElementById("vjsplayer");
    e && (e.style.width = "100%", e.style.float = "none");
    const n = document.querySelector("body");
    n && (n.classList.remove("flex-row-reverse"), n.classList.add("flex-column"));
  }
  cleanupExistingAdContainer() {
    const e = document.getElementById("split-ad-container");
    e && e.remove();
    const n = document.getElementById("streann-splitad");
    n && n.remove();
  }
}
window.insideAd = {
  initialize: It,
  debug: !0
};
function It(t) {
  if (!T.isAlreadyInit) {
    if (!t.apiKey && !t.apiToken && !t.baseUrl) {
      a.error("Invalid key config");
      return;
    }
    T.apiKey = t.apiKey, T.apiToken = t.apiToken, T.baseUrl = t.baseUrl, T.isAlreadyInit = !0, a.info("24.10.2025 12:10 | V.3.6.6"), le();
  }
}
let ne;
async function le() {
  const t = await _e(), { campaign: e, filteredPlacements: n } = ze(t), r = new qe(e, le), i = n.find(
    (d) => d.viewType == P.CORNER
  );
  i && (ne = new te(
    i,
    i.ad,
    r
  ));
  const o = n.find(
    (d) => d.viewType == P.SPLIT_AD
  );
  o && new Nt(
    o,
    o.ad,
    r
  );
  const s = n.find(
    (d) => d.viewType == P.ADHESION
  );
  s && ke.setAd(s, s.ad), n.filter((d) => d.viewType == P.EMBED).forEach((d) => new Tt(d, d.ad));
}
let Rt = window.location.pathname;
function wt() {
  console.log("Path changed to:", window.location.pathname), Rt != window.location.pathname && (L.clearAllSlots(), ne && ne.handleOnCloseButton(), ke.onAdFinish(), le());
}
window.addEventListener("locationchange", function() {
  wt();
});
(() => {
  let t = history.pushState;
  history.pushState = function() {
    let r = t.apply(this, arguments);
    return window.dispatchEvent(new Event("pushstate")), window.dispatchEvent(new Event("locationchange")), r;
  };
  let e = history.replaceState;
  history.replaceState = function() {
    let r = e.apply(this, arguments);
    return window.dispatchEvent(new Event("replacestate")), window.dispatchEvent(new Event("locationchange")), r;
  }, window.addEventListener("popstate", () => {
    window.dispatchEvent(new Event("locationchange"));
  });
})();
