(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 Le = Object.defineProperty;
var Oe = (t, e, n) => e in t ? Le(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
var l = (t, e, n) => (Oe(t, typeof e != "symbol" ? e + "" : e, n), n);
var L = /* @__PURE__ */ ((t) => (t.CORNER = "CORNER", t.EMBED = "EMBED", t.ADHESION = "ADHESION", t.EMBED_FLOAT = "EMBED_FLOAT", t.SPLIT_AD = "SPLIT_AD", t))(L || {}), N = /* @__PURE__ */ ((t) => (t.VAST = "VAST", t.BANNER = "BANNER", t.LOCAL_VIDEO = "LOCAL_VIDEO", t.LOCAL_IMAGE = "LOCAL_IMAGE", t))(N || {}), pe = /* @__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))(pe || {});
const y = {
  apiKey: "",
  apiToken: "",
  baseUrl: "",
  isAlreadyInit: !1
};
async function Pe() {
  const t = await ke();
  localStorage.setItem("streannCountryId", t.countryCode);
  const e = await fetch(
    `${y.baseUrl}v1/r/${y.apiKey}/campaigns/WEB?country=${t.countryCode}`,
    {
      method: "GET",
      headers: new Headers({
        Authorization: `ApiToken ${y.apiToken}`
      })
    }
  );
  if (e.status != 200)
    throw new Error("Someting went wrong fetching campaign err");
  return e.json();
}
async function ke() {
  const t = await fetch(`${y.baseUrl}v1/geo-ip-config`), { geoIpUrl: e } = await t.json();
  return await (await fetch(e)).json();
}
function Me() {
  return Object.values(pe)[(/* @__PURE__ */ new Date()).getDay()];
}
function oe(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 he(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 _e(t) {
  const e = Date.now(), n = new Date(t.startDate), r = new Date(t.endDate);
  return n.getTime() <= e && r.getTime() >= e;
}
function Ue(t) {
  if (!t.timePeriods)
    return !0;
  const e = Me(), n = /* @__PURE__ */ new Date();
  return t.timePeriods.every((i) => {
    const [o, s, a] = i.startTime.split(":").map(Number), p = /* @__PURE__ */ new Date();
    p.setHours(o), p.setMinutes(s), p.setSeconds(a);
    const [v, T, E] = i.endTime.split(":").map(Number), f = /* @__PURE__ */ new Date();
    return f.setHours(v), f.setMinutes(T), f.setSeconds(E), i.daysOfWeek.includes(e) && p <= n && f >= n;
  });
}
function He(t) {
  const e = location.host.replace(/^www\./, ""), n = t.replace(/^https?:\/\//, "").replace(/^www\./, "");
  return e === n;
}
function fe(t) {
  if (t.domain) {
    if (t.domain.includes(location.host) || He(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 Ve(t) {
  const e = t.placements.filter(fe).filter(Ee);
  return !(!e || e.length == 0);
}
function Ee(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 xe(t) {
  const e = t.filter(_e).filter(Ue);
  if (e.length == 0)
    throw new Error("No valid campaigns");
  let n;
  if (e.length > 1 ? n = oe(e.filter(Ve)) : n = e[0], !n)
    throw new Error("No valid campaign");
  const r = n.placements.filter(fe).filter(Ee);
  if (r.length == 0)
    throw new Error("No valid placement Tag");
  const i = r.map(
    (o) => o.ads.length > 1 ? { ...o, ad: oe(o.ads) } : { ...o, ad: o.ads[0] }
  );
  return { campaign: n, filteredPlacements: i };
}
class Fe {
  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 d = new Fe();
class je {
  constructor(e, n) {
    l(this, "campaing");
    l(this, "refresh");
    l(this, "refreshTimeout");
    this.campaing = e, this.refresh = n;
  }
  insideAdReceived(e) {
    d.info("insideAdReceived", e);
  }
  insideAdLoaded() {
  }
  insideAdPlay() {
  }
  insideAdStop() {
    this.campaing.properties.intervalInMinutes && (this.clearRefreshTimeout(), this.refreshTimeout = setTimeout(() => {
      this.refresh();
    }, this.campaing.properties.intervalInMinutes * 6e4));
  }
  insideAdSkipped() {
  }
  insideAdClicked() {
  }
  insideAdError(e) {
    d.info("insideAdError", e);
  }
  insideAdVolumeChanged(e) {
    d.info("insideAdVolumeChanged", e);
  }
  clearRefreshTimeout() {
    clearTimeout(this.refreshTimeout);
  }
}
const Ye = "https://imasdk.googleapis.com/js/sdkloader/ima3.js";
let D = null;
const se = () => {
  D = null;
}, me = () => {
  const t = window;
  return t.google && t.google.ima ? Promise.resolve(t.google.ima) : D || (D = he(Ye).then(() => t.google.ima), D.then(se).catch(se), D);
}, ze = "https://securepubads.g.doubleclick.net/tag/js/gpt.js", Ge = () => {
  const t = window;
  return t.googletag && t.googletag.apiReady ? Promise.resolve(t.googletag) : he(ze).then(() => t.googletag);
};
var q = function(t, e) {
  return q = 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]);
  }, q(t, e);
};
function V(t, e) {
  if (typeof e != "function" && e !== null)
    throw new TypeError("Class extends value " + String(e) + " is not a constructor or null");
  q(t, e);
  function n() {
    this.constructor = t;
  }
  t.prototype = e === null ? Object.create(e) : (n.prototype = e.prototype, new n());
}
function K(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 U(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 (a) {
    s = { error: a };
  } finally {
    try {
      i && !i.done && (n = r.return) && n.call(r);
    } finally {
      if (s)
        throw s.error;
    }
  }
  return o;
}
function H(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 g(t) {
  return typeof t == "function";
}
function Ae(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 z = Ae(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 $(t, e) {
  if (t) {
    var n = t.indexOf(e);
    0 <= n && t.splice(n, 1);
  }
}
var x = 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 a = K(s), p = a.next(); !p.done; p = a.next()) {
              var v = p.value;
              v.remove(this);
            }
          } catch (m) {
            e = { error: m };
          } finally {
            try {
              p && !p.done && (n = a.return) && n.call(a);
            } finally {
              if (e)
                throw e.error;
            }
          }
        else
          s.remove(this);
      var T = this.initialTeardown;
      if (g(T))
        try {
          T();
        } catch (m) {
          o = m instanceof z ? m.errors : [m];
        }
      var E = this._finalizers;
      if (E) {
        this._finalizers = null;
        try {
          for (var f = K(E), S = f.next(); !S.done; S = f.next()) {
            var De = S.value;
            try {
              ae(De);
            } catch (m) {
              o = o ?? [], m instanceof z ? o = H(H([], U(o)), U(m.errors)) : o.push(m);
            }
          }
        } catch (m) {
          r = { error: m };
        } finally {
          try {
            S && !S.done && (i = f.return) && i.call(f);
          } finally {
            if (r)
              throw r.error;
          }
        }
      }
      if (o)
        throw new z(o);
    }
  }, t.prototype.add = function(e) {
    var n;
    if (e && e !== this)
      if (this.closed)
        ae(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) && $(n, e);
  }, t.prototype.remove = function(e) {
    var n = this._finalizers;
    n && $(n, e), e instanceof t && e._removeParent(this);
  }, t.EMPTY = function() {
    var e = new t();
    return e.closed = !0, e;
  }(), t;
}(), ye = x.EMPTY;
function ge(t) {
  return t instanceof x || t && "closed" in t && g(t.remove) && g(t.add) && g(t.unsubscribe);
}
function ae(t) {
  g(t) ? t() : t.unsubscribe();
}
var ve = {
  onUnhandledError: null,
  onStoppedNotification: null,
  Promise: void 0,
  useDeprecatedSynchronousErrorHandling: !1,
  useDeprecatedNextContext: !1
}, W = {
  setTimeout: function(t, e) {
    for (var n = [], r = 2; r < arguments.length; r++)
      n[r - 2] = arguments[r];
    var i = W.delegate;
    return i != null && i.setTimeout ? i.setTimeout.apply(i, H([t, e], U(n))) : setTimeout.apply(void 0, H([t, e], U(n)));
  },
  clearTimeout: function(t) {
    var e = W.delegate;
    return ((e == null ? void 0 : e.clearTimeout) || clearTimeout)(t);
  },
  delegate: void 0
};
function qe(t) {
  W.setTimeout(function() {
    throw t;
  });
}
function de() {
}
function M(t) {
  t();
}
var Se = function(t) {
  V(e, t);
  function e(n) {
    var r = t.call(this) || this;
    return r.isStopped = !1, n ? (r.destination = n, ge(n) && n.add(r)) : r.destination = Xe, r;
  }
  return e.create = function(n, r, i) {
    return new X(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;
}(x), Ke = Function.prototype.bind;
function G(t, e) {
  return Ke.call(t, e);
}
var $e = 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) {
        P(r);
      }
  }, t.prototype.error = function(e) {
    var n = this.partialObserver;
    if (n.error)
      try {
        n.error(e);
      } catch (r) {
        P(r);
      }
    else
      P(e);
  }, t.prototype.complete = function() {
    var e = this.partialObserver;
    if (e.complete)
      try {
        e.complete();
      } catch (n) {
        P(n);
      }
  }, t;
}(), X = function(t) {
  V(e, t);
  function e(n, r, i) {
    var o = t.call(this) || this, s;
    if (g(n) || !n)
      s = {
        next: n ?? void 0,
        error: r ?? void 0,
        complete: i ?? void 0
      };
    else {
      var a;
      o && ve.useDeprecatedNextContext ? (a = Object.create(n), a.unsubscribe = function() {
        return o.unsubscribe();
      }, s = {
        next: n.next && G(n.next, a),
        error: n.error && G(n.error, a),
        complete: n.complete && G(n.complete, a)
      }) : s = n;
    }
    return o.destination = new $e(s), o;
  }
  return e;
}(Se);
function P(t) {
  qe(t);
}
function We(t) {
  throw t;
}
var Xe = {
  closed: !0,
  next: de,
  error: We,
  complete: de
}, Qe = function() {
  return typeof Symbol == "function" && Symbol.observable || "@@observable";
}();
function Je(t) {
  return t;
}
function Ze(t) {
  return t.length === 0 ? Je : t.length === 1 ? t[0] : function(n) {
    return t.reduce(function(r, i) {
      return i(r);
    }, n);
  };
}
var ce = 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 = tt(e) ? e : new X(e, n, r);
    return M(function() {
      var s = i, a = s.operator, p = s.source;
      o.add(a ? a.call(o, p) : p ? 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 = le(n), new n(function(i, o) {
      var s = new X({
        next: function(a) {
          try {
            e(a);
          } catch (p) {
            o(p), 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[Qe] = function() {
    return this;
  }, t.prototype.pipe = function() {
    for (var e = [], n = 0; n < arguments.length; n++)
      e[n] = arguments[n];
    return Ze(e)(this);
  }, t.prototype.toPromise = function(e) {
    var n = this;
    return e = le(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 le(t) {
  var e;
  return (e = t ?? ve.Promise) !== null && e !== void 0 ? e : Promise;
}
function et(t) {
  return t && g(t.next) && g(t.error) && g(t.complete);
}
function tt(t) {
  return t && t instanceof Se || et(t) && ge(t);
}
var nt = Ae(function(t) {
  return function() {
    t(this), this.name = "ObjectUnsubscribedError", this.message = "object unsubscribed";
  };
}), be = function(t) {
  V(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 ue(this, this);
    return r.operator = n, r;
  }, e.prototype._throwIfClosed = function() {
    if (this.closed)
      throw new nt();
  }, e.prototype.next = function(n) {
    var r = this;
    M(function() {
      var i, o;
      if (r._throwIfClosed(), !r.isStopped) {
        r.currentObservers || (r.currentObservers = Array.from(r.observers));
        try {
          for (var s = K(r.currentObservers), a = s.next(); !a.done; a = s.next()) {
            var p = a.value;
            p.next(n);
          }
        } catch (v) {
          i = { error: v };
        } finally {
          try {
            a && !a.done && (o = s.return) && o.call(s);
          } finally {
            if (i)
              throw i.error;
          }
        }
      }
    });
  }, e.prototype.error = function(n) {
    var r = this;
    M(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;
    M(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, a = i.observers;
    return o || s ? ye : (this.currentObservers = null, a.push(n), new x(function() {
      r.currentObservers = null, $(a, 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 ce();
    return n.source = this, n;
  }, e.create = function(n, r) {
    return new ue(n, r);
  }, e;
}(ce), ue = function(t) {
  V(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 : ye;
  }, e;
}(be);
const Te = new be();
function _(t) {
  Te.next(t);
}
function rt() {
  return Te.asObservable();
}
class it {
  constructor() {
    l(this, "googletag");
    l(this, "timeOutCornerBanner");
    l(this, "timeOutAdhesion");
    l(this, "insideAdCallback");
    l(this, "onCornerBannerFinish");
    l(this, "mapBanners", /* @__PURE__ */ new Map());
    l(this, "onSlotRender", (e) => {
      const n = e.slot, r = this.mapBanners.get(n.getSlotElementId());
      if (d.info("Banner:", r == null ? void 0 : r.id, "is Empty", e.isEmpty), !r) {
        d.warn("Banner not found");
        return;
      }
      e.isEmpty ? (r.type === "CORNER" && this.onCornerBannerFinish(!0), r.type === "ADHESION" && _("ERROR")) : r.type === "ADHESION" && _("STARTED");
    });
    l(this, "onViewableListener", (e) => {
      const n = e.slot, r = this.mapBanners.get(n.getSlotElementId());
      if (!r) {
        d.error("Banner not found");
        return;
      }
      r.type === "CORNER" ? this.timeOutCornerBanner = setTimeout(() => {
        if (!this.checkIfBannerExist(n.getSlotElementId())) {
          d.error("Banner not found refreshing false");
          return;
        }
        this.destroyCornerAdBanner();
      }, r.duration * 1e3) : r.type === "ADHESION" ? this.timeOutAdhesion = setTimeout(() => {
        if (!this.checkIfBannerExist(n.getSlotElementId())) {
          d.error("Banner not found refreshing false");
          return;
        }
        this.removeBanner(r.id);
      }, r.duration * 1e3) : setTimeout(() => {
        if (!this.checkIfBannerExist(n.getSlotElementId())) {
          d.error("Banner not found refreshing false");
          return;
        }
        d.info("Refreshing banner", r == null ? void 0 : r.id), this.googletag.pubads().refresh([n]);
      }, r.duration * 1e3);
    });
    Ge().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().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) {
    d.info("adding banners", e), this.googletag.cmd.push(() => {
      e.forEach((n) => {
        var o;
        n.type == "CORNER" && ((o = document.querySelector("#streann-node")) == null || o.insertAdjacentHTML("beforeend", `<div id=${n.id}></div>`));
        const r = this.mapBanners.get(n.id);
        if (r && r.type === "CORNER") {
          this.googletag.pubads().refresh([r.slot]);
          return;
        }
        const i = this.googletag.defineSlot(
          n.url,
          this.mapToBannerSizes(n.sizes),
          n.id
        );
        if (!i) {
          d.warn("Banner cannot be defined", n);
          return;
        }
        d.info("Banner defined", i), i.addService(this.googletag.pubads()), this.googletag.display(i), this.mapBanners.set(n.id, { ...n, slot: i });
      });
    });
  }
  removeBanner(e) {
    const n = this.mapBanners.get(e);
    n && (n.type === "ADHESION" && (_("FINISHED"), this.mapBanners.delete(e), clearTimeout(this.timeOutAdhesion)), this.clearSlot(n.slot));
  }
  addCallback(e, n) {
    this.insideAdCallback = e, this.onCornerBannerFinish = n;
  }
  destroyCornerAdBanner() {
    const e = this.mapBanners.get("corner-banner");
    e && (clearTimeout(this.timeOutCornerBanner), this.clearSlot(e.slot), this.onCornerBannerFinish(!1), this.insideAdCallback.insideAdStop());
  }
  clearSlot(e) {
    this.googletag.cmd.push(() => {
      const n = this.googletag.pubads().clear([e]);
      d.info("clearing slot", e, "is Cleared", n);
    });
  }
  clearAllSlots() {
    this.googletag.cmd.push(() => {
    }), this.mapBanners.clear();
  }
}
const I = new it();
let h, A, O, F, w, R, C, B, u, j, Z, c, Y;
const Ne = `
<div id="page-content">
    <div id="video-container">
      <video id="video-element" src="">
      </video>
      <div id="ad-container"></div>
    </div>
</div>
`, ot = `
<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 ee = "", b;
function st(t, e, n) {
  me().then((r) => {
    var i;
    Y = n, b = t, (i = document.querySelector("#streann-node")) == null || i.insertAdjacentHTML("beforeend", Ne), c = r, ee = we(e), u = document.getElementById("video-element"), F = document.getElementById("playButton"), w = document.getElementById("mute"), R = document.getElementById("un-mute"), R.style.display = "none", w.style.display = "none", C = document.getElementById("cornerCloseButton"), B = document.getElementById("streann-logo"), C.style.display = "none", B.style.display = "none", ut(), Re();
  }).catch((r) => {
    d.error("Fail loading ima", r);
  });
}
function at(t, e, n, r) {
  me().then((i) => {
    Y = n, b = t;
    const o = document.getElementById(r);
    if (o)
      o.insertAdjacentHTML("beforeend", ot);
    else {
      console.error(`Container with id ${r} not found`);
      return;
    }
    c = i, ee = we(e), u = o.querySelector("#video-element"), F = o.querySelector("#playButton"), pt(r), Re();
  }).catch((i) => {
    d.error("Fail loading ima", i);
  });
}
function we(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 dt(t) {
  var n;
  (n = document.querySelector("#streann-node")) == null || n.insertAdjacentHTML("beforeend", Ne);
  const e = document.getElementById("video-element");
  F = document.getElementById("playButton"), w = document.getElementById("mute"), R = document.getElementById("un-mute"), C = document.getElementById("cornerCloseButton"), B = document.getElementById("streann-logo"), e.src = t.url, e.load(), R.style.display = "block", w.style.display = "none", C.style.display = "none", B.style.display = "none", e.addEventListener("play", () => {
    C.style.display = "block", B.style.display = "block";
  }), e.muted = !0, e.play().catch(function(r) {
    console.error("Autoplay failed:", r);
  }), e.addEventListener("click", function() {
    t.properties.clickThroughUrl && window.open(t.properties.clickThroughUrl, "_blank");
  }), e.addEventListener("ended", te), w.addEventListener("click", () => {
    e.muted = !0, w.style.display = "none", R.style.display = "block";
  }), R.addEventListener("click", () => {
    e.muted = !1, R.style.display = "none", w.style.display = "block";
  });
}
function te() {
  var e;
  const t = document.getElementById("video-element");
  (e = document.getElementById("streann-node")) == null || e.remove(), t.style.display = "none", t.pause(), t.removeEventListener("ended", te);
}
function Re() {
  u.volume = 0, u.muted = !0;
  const t = u.play();
  t !== void 0 && t.then(ct).catch(lt);
}
function ct() {
  u.pause(), j = !0, Z = !0, Ie();
}
function lt() {
  u.pause(), j = !0, Z = !0, Ie();
}
function ut() {
  ft(), A = new c.AdsLoader(O), A.getSettings().setDisableCustomPlaybackForIOS10Plus(!0), A.addEventListener(
    c.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,
    Ce,
    !1
  ), A.addEventListener(c.AdErrorEvent.Type.AD_ERROR, re, !1), u.onended = ne;
}
function pt(t) {
  ht(t), A = new c.AdsLoader(O), A.addEventListener(
    c.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,
    Ce,
    !1
  ), A.addEventListener(c.AdErrorEvent.Type.AD_ERROR, re, !1), u.onended = ne;
}
function ht(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;
  }
  O = new c.AdDisplayContainer(e, u);
}
function ne() {
  u.onended = null, A && A.contentComplete();
}
function Ie() {
  const t = new c.AdsRequest();
  t.adTagUrl = ee, t.linearAdSlotWidth = u.clientWidth, t.linearAdSlotHeight = u.clientHeight, t.nonLinearAdSlotWidth = u.clientWidth, t.nonLinearAdSlotHeight = u.clientHeight / 3, t.setAdWillAutoPlay(j), t.setAdWillPlayMuted(Z), A.requestAds(t);
}
function ft() {
  const t = document.getElementById("ad-container");
  if (!t) {
    console.error("NO AD CONTIANER");
    return;
  }
  O = new c.AdDisplayContainer(t, u);
}
function Et() {
  try {
    O.initialize(), h.init(
      u.clientWidth,
      u.clientHeight,
      c.ViewMode.NORMAL
    ), h.start();
  } catch (t) {
    console.error(t), u.play();
  }
}
function Ce(t) {
  const e = new c.AdsRenderingSettings();
  e.restoreCustomPlaybackStateOnAdBreakComplete = !0, h = t.getAdsManager(
    u,
    e
  ), h.setVolume(0), h.addEventListener(c.AdErrorEvent.Type.AD_ERROR, re), h.addEventListener(
    c.AdEvent.Type.CONTENT_PAUSE_REQUESTED,
    mt
  ), h.addEventListener(
    c.AdEvent.Type.CONTENT_RESUME_REQUESTED,
    At
  ), h.addEventListener(c.AdEvent.Type.ALL_ADS_COMPLETED, k), h.addEventListener(c.AdEvent.Type.LOADED, k), h.addEventListener(c.AdEvent.Type.STARTED, k), h.addEventListener(c.AdEvent.Type.COMPLETE, k), j ? Et() : F.style.display = "block";
}
function k(t) {
  var n;
  const e = t.getAd();
  switch (d.info(t), t.type) {
    case c.AdEvent.Type.LOADED:
      b.insideAdLoaded(), e.isLinear() || u.play();
      break;
    case c.AdEvent.Type.STARTED:
      b.insideAdPlay(), C && (C.style.display = "block"), B && (B.style.display = "block");
      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 c.AdEvent.Type.CLICK:
      b.insideAdClicked();
      break;
    case c.AdEvent.Type.SKIPPED:
      Q(), b.insideAdSkipped();
      break;
    case c.AdEvent.Type.ALL_ADS_COMPLETED:
      Q();
      break;
    case c.AdEvent.Type.COMPLETE:
      break;
  }
}
function re(t) {
  var n;
  d.warn("Ima error:", t.getError()), (n = document.getElementById("split-ad-container")) == null || n.remove(), b.insideAdError(t.getError().toString()), Y(!0);
  const e = document.getElementById("page-content");
  e == null || e.remove(), h && h.destroy();
}
function mt() {
  u.pause(), u.onended = null;
}
function At() {
  u.onended = ne;
}
function Q() {
  Y(), b.insideAdStop(), h && h.destroy();
}
class yt {
  constructor(e, n, r) {
    l(this, "placement");
    l(this, "ad");
    l(this, "counterFailedCornerAd", 0);
    l(this, "insideAdCallback");
    l(this, "currentAd");
    this.placement = e, this.ad = n, this.insideAdCallback = r;
    const i = 5;
    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>
`;
  }
  startAd(e) {
    if (this.currentAd = e, this.createCornerAdView(), e.adType == N.VAST)
      st(this.insideAdCallback, e.url, this.onAdFinish.bind(this));
    else if (e.adType == N.BANNER) {
      I.addCallback(
        this.insideAdCallback,
        this.onAdFinish.bind(this)
      );
      const n = {
        duration: e.properties.durationInSeconds,
        id: "corner-banner",
        sizes: e.properties.sizes,
        type: "CORNER",
        url: e.url
      };
      I.addBanners([n]);
    } else
      e.adType == N.LOCAL_VIDEO ? dt(e) : d.warn("AD TYPE NOT SUPPORTED");
  }
  createCornerAdView() {
    var n, r, i;
    if (document.getElementById("streann-node"))
      return;
    const e = (r = (n = this.placement.properties) == null ? void 0 : n.webSettings) == null ? void 0 : r.styles;
    d.info("style", e), (i = document.querySelector("body")) == null || i.insertAdjacentHTML("beforeend", this.cornerElem(e || "")), this.showCloseButton();
  }
  showCloseButton() {
    if (this.placement.properties.showCloseButtonAfterSeconds != null) {
      const e = document.getElementById("cornerCloseButton");
      if (!e)
        return;
      const n = this.placement.properties.showCloseButtonAfterSeconds;
      setTimeout(() => {
        e.onclick = this.handleOnCloseButton.bind(this), e.style.setProperty("display", "block");
      }, Number(n) * 1e3);
    }
  }
  handleOnCloseButton() {
    var e, n, r;
    ((e = this.currentAd) == null ? void 0 : e.adType) == N.BANNER ? I.destroyCornerAdBanner() : ((n = this.currentAd) == null ? void 0 : n.adType) == N.VAST ? Q() : ((r = this.currentAd) == null ? void 0 : r.adType) == N.LOCAL_VIDEO ? te() : d.error("Closing UnSupperoted ad type");
  }
  onAdFinish(e = !1) {
    var n;
    if (d.info("cornerAd finished with error", e), this.ad.fallback && e && this.counterFailedCornerAd <= 5) {
      d.info("cornerAd starting waterfall ad", this.ad.fallback), this.startAd(this.ad.fallback), this.counterFailedCornerAd++;
      return;
    }
    (n = document.getElementById("streann-node")) == null || n.remove();
  }
}
class gt {
  constructor(e, n) {
    var p, v, T;
    const r = {
      id: "",
      duration: n.properties.durationInSeconds,
      sizes: n.properties.sizes,
      type: "EMBED",
      url: n.url
    }, i = (p = e.properties) == null ? void 0 : p.webSettings;
    if (!i) {
      d.error("invalid Embed placement with out web settings");
      return;
    }
    const { elemId: o, parentXpath: s, advancedScript: a } = i;
    if (o) {
      const E = document.getElementById(o);
      if (!E) {
        d.error("invalid element id");
        return;
      }
      const f = (T = (v = e.properties) == null ? void 0 : v.webSettings) == null ? void 0 : T.styles;
      f && E.setAttribute("style", f), r.id = o;
    } else if (s) {
      const E = this.getElementByXpath(s);
      if (!E) {
        d.error("invalid xpath");
        return;
      }
      if (document.getElementById(e.id))
        r.id = e.id;
      else {
        const S = this.generateElement(e);
        E.appendChild(S), r.id = e.id;
      }
    } else if (a) {
      const E = new Function(a)();
      if (!document.getElementById(E)) {
        d.error("invalid element id advanced script");
        return;
      }
      r.id = E;
    } else {
      d.error("invalid Embed placement with incorrect web settings");
      return;
    }
    I.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 vt {
  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;
    rt().subscribe({
      next: (i) => {
        switch (d.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() {
    I.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",
    };
    I.addBanners([n]);
  }
  onAdFinish() {
    var e;
    (e = document.getElementById("streann-adhesion")) == null || e.remove();
  }
}
const Be = new vt();
class St {
  constructor(e, n, r) {
    l(this, "placement");
    l(this, "ad");
    l(this, "insideAdCallback");
    l(this, "currentAd");
    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) {
    const n = localStorage.getItem("streannShowSplitAd");
    if (this.cleanupExistingAdContainer(), n === "false")
      console.warn("No ads in player");
    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(), at(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;
    (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();
  }
}
window.insideAd = {
  initialize: bt,
  debug: !0
};
function bt(t) {
  if (!y.isAlreadyInit) {
    if (!t.apiKey && !t.apiToken && !t.baseUrl) {
      d.error("Invalid key config");
      return;
    }
    y.apiKey = t.apiKey, y.apiToken = t.apiToken, y.baseUrl = t.baseUrl, y.isAlreadyInit = !0, d.info("V.30.5.1"), ie();
  }
}
let J;
async function ie() {
  const t = await Pe(), { campaign: e, filteredPlacements: n } = xe(t), r = new je(e, ie), i = n.find(
    (a) => a.viewType == L.CORNER
  );
  i && (J = new yt(
    i,
    i.ad,
    r
  ));
  const o = n.find(
    (a) => a.viewType == L.SPLIT_AD
  );
  o && new St(
    o,
    o.ad,
    r
  );
  const s = n.find(
    (a) => a.viewType == L.ADHESION
  );
  s && Be.setAd(s, s.ad), n.filter((a) => a.viewType == L.EMBED).forEach((a) => new gt(a, a.ad));
}
let Tt = window.location.pathname;
function Nt() {
  console.log("Path changed to:", window.location.pathname), Tt != window.location.pathname && (I.clearAllSlots(), J && J.handleOnCloseButton(), Be.onAdFinish(), ie());
}
window.addEventListener("locationchange", function() {
  Nt();
});
(() => {
  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"));
  });
})();
