!function(){const e="beforeend",n="hidden",t=(n,t,i=e)=>{t.insertAdjacentHTML(i,n)};class i{#e=null;#n=null;#t=null;#i=null;#r=null;#a=null;#l=null;#o=null;#s=null;#c=null;#m=localStorage;constructor(e){this.#e=e.outerHTML,this.#o=document.querySelector(".gc-main-content")}get templateStyle(){return"\n "}get template(){return`\n \n \n
\n ${this.#e}\n
\n\n
\n
\n `}get element(){return this.#n||(this.#n=this.template),this.#n}init(){if(t(this.templateStyle,this.#o),t(this.element,this.#o),this.#p(),this.#t=document.querySelector(".ip-banner-fire"),this.#i=this.#t.querySelector(".ip-banner-fire__close"),this.#r=this.#t.querySelector(".ip-banner-fire__content"),this.#a=this.#r.querySelector(".lite-page.block-set"),this.#a.classList.add("ip-banner-fire__content-frame"),this.#a.classList.remove("lite-page"),this.#a.classList.remove("block-set"),this.#l=this.#t.querySelector(".ip-banner-fire-item"),this.#c=this.#t.querySelectorAll(".image-box img"),this.#l?this.#s=this.#l.className.split("ip-banner-fire-item-")[1]:this.#t.classList.add(n),this.#c.length)for(let e of this.#c)e.src=e.dataset.src;this.#i.addEventListener("click",this.#d),this.#t.addEventListener("click",this.#u),document.addEventListener("keydown",this.#h);const e=this.#m.getItem(`IpBannerFireFullStateId-${this.#s}`);if(console.log(`fire-banner: IpBannerFireFullStateId-${this.#s}`),e){const t=JSON.parse(e),i=JSON.parse(e).id,r=JSON.parse(e).count;if(moment((new Date).valueOf())-moment(t.timeCloseClick).valueOf()>=216e5&&r<3)console.log("fire-banner: currentDate >= timeEndMs && count < 3");else{document.querySelector(`.ip-banner-fire-item-${i}`).classList.add(n);document.querySelectorAll(".ip-banner-fire-item")[0].classList.contains(n)&&this.#t.classList.add(n),console.log("fire-banner: currentDate < timeEndMs && count > 3")}}this.#f()}#p(){const e=document.querySelectorAll(".ip-banner-fire-item");if(e.length){for(const n of e)n.style="display: none !important";e[0].style="display: block !important"}}#g=()=>{const e=this.#s;if(e>=1){const n=moment(new Date),t=this.#m.getItem(`IpBannerFireFullStateId-${e}`);let i;t&&(i=JSON.parse(t).count),this.#m.setItem(`IpBannerFireFullStateId-${e}`,JSON.stringify({id:e,count:i?++i:1,timeCloseClick:n}))}};#d=()=>{this.#t.classList.add(n),this.#g(),document.removeEventListener("keydown",this.#h)};#u=e=>{e.target.classList.contains("ip-banner-fire")&&(this.#t.classList.add(n),this.#g(),document.removeEventListener("keydown",this.#h))};#h=e=>{"Escape"===e.key&&(this.#t.classList.add(n),this.#g(),document.removeEventListener("keydown",this.#h))};#f(){const e=document.querySelectorAll(".cst-fire-card-container")[0];if(2===e.children.length){const n=e.querySelectorAll(".cst-fire-card")[0],t=e.querySelectorAll(".cst-fire-card")[1];t.style="display: none",setTimeout((()=>{n.remove(),t.style="display: block"}),6e3)}}}const r=(()=>{const e=location.pathname;return["/teach/control/stream","/pl/teach/control/lesson","/sales/control","/profile","/src-main","/src-library/cases","/cst-banner-manipulator"].some((n=>-1!==e.indexOf(n)))})(),a=localStorage.getItem("DeleteCSTBanner");fetch("/cst-banner-hs-card").then((e=>e.text())).then((e=>(new DOMParser).parseFromString(e,"text/html").querySelector(".lite-page.block-set"))).then((e=>{if(r&&!a){new i(e).init()}})).catch((e=>console.log("Failed to fetch page: ",e)));const l=setInterval((()=>{if(document.querySelector(".cst-lk-menu-content")){document.querySelector(".cst-lk-menu-content").insertAdjacentHTML("afterbegin",`\n `);document.querySelector(".cst-lk-menu-fire-banner-link").addEventListener("click",(e=>{e.preventDefault();const t=document.querySelector(".ip-banner-fire");if(t){t.classList.remove(n);const e=document.querySelector(".ip-banner-fire-item").className.split("ip-banner-fire-item-")[1].split(" ")[0],i=localStorage.getItem(`IpBannerFireFullStateId-${e}`);if(i){const e=JSON.parse(i).id,n=Number(JSON.parse(i).count)-1;e>=1&&localStorage.setItem(`IpBannerFireFullStateId-${e}`,JSON.stringify({id:e,count:n,timeCloseClick:JSON.parse(i).timeCloseClick}))}}})),clearInterval(l)}}),10)}();