`:`
`;t++});i.innerHTML+=f;isLoading=!1;curentPage.value=Number(n)+1}else curentPage.value=-1}))}function showVideo(n){var t,i,r,f;if(!isTransitioning){isTransitioning=!0;t=document.querySelectorAll(".video-slide");t.length>=0&&n{}),currentIndex=n,setTimeout(()=>{isTransitioning=!1},500));const u=t[n].getAttribute("data-url");if(u){const n=`${window.location.origin}${u}`;history.pushState(null,"",n)}i=t[n].getAttribute("data-title");i&&(document.title=i,r=document.getElementById("reels_title"),r&&(r.textContent=i));n>=t.length-1&&Number(curentPage.value)>0&&LoadData(Number(curentPage.value));CheckPlay();f=t[n].getAttribute("data-id");updateCountLikeAndCmt(f)}}function updateMuteButton(n){video.muted?(n.innerHTML=turnOff,n.dataset.state="muted"):(n.innerHTML=turnOn,n.dataset.state="unmuted")}function getTouches(n){return n.touches||n.originalEvent.touches}function handleTouchStart(n){const t=getTouches(n)[0];xDown=t.clientX;yDown=t.clientY}function handleTouchMove(n){if(xDown&&yDown&&!isTransitioning){const i=n.touches[0].clientX,r=n.touches[0].clientY,u=xDown-i,t=yDown-r;Math.abs(u)>Math.abs(t)||(t>0?SlideUpAll(currentIndex+1):SlideDownAll(currentIndex-1));xDown=null;yDown=null}}function CheckPlay(){video.paused?playeButton.classList.remove("hide_play_btn"):playeButton.classList.add("hide_play_btn")}function SwiperSlide(n,t){const e=document.querySelectorAll(".video-slide");if(!(t>=e.length)){const o=e[t],r=o.offsetTop;var u=video.offsetHeight;const i=document.querySelector(".swiper-area"),f=window.getComputedStyle(i).getPropertyValue("transform");if(video.style.transition="transform 0.3s ease",video.pause(),n=="up")if(f!=="none"){const n=new DOMMatrix(f);video.style.transform=`translate(0px, ${-u}px)`;i.style.transform=`translate(${n.m41}px, ${-r}px)`}else video.style.transform=`translate(0px, ${-u}px)`,i.style.transform=`translate(0px, ${-r}px)`;else if(f!=="none"){const n=new DOMMatrix(f);video.style.transform=`translate(0px, ${u}px)`;i.style.transform=`translate(${n.m41}px, ${-r}px)`}else video.style.transform=`translate(0px, ${u}px)`,i.style.transform="translate(0px, "+r+"px)";video.addEventListener("transitionend",function(n){n.propertyName==="transform"&&(transformOccurred=!0,video.style.opacity="0")})}}function SlideUpAll(n){SwiperSlide("up",n);setTimeout(function(){showVideo(n)},500)}function SlideDownAll(n){n>=0&&(SwiperSlide("down",n),setTimeout(function(){showVideo(n)},500))}function updateCountLikeAndCmt(n){var t,i;n!=undefined&&(document.getElementById("ShortId").value=n,heart_btn&&heart_btn.classList.remove("active"),span_&&(span_.innerText=0),url="/Interaction/GetListArticleInteraction?ArticleId="+n,t=new XMLHttpRequest,t.open("GET",url,!0),t.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),t.responseType="json",t.onreadystatechange=function(){if(t.readyState==4&&t.status==200){var i=this.response.list;if(i.length>0){let n=i.find(n=>n.Interaction===2),t=n?n.Count:0,r=t.toLocaleString("vi-VN");span_!=undefined&&(span_.innerText=r)}getInteractStorage(n)}},t.send(),i=document.querySelector(".ds-comments-wrapper"),i&&(i.innerHTML="",document.querySelector(".number-cmt-2").innerHTML="",document.querySelector(".comment-number").innerText=0,comment.init(n)))}function changeStorageInteract(n,t){let i=JSON.parse(localStorage.getItem("itr_"));if(t!=undefined)if(i!=null){let r=i[n];if(r!=undefined)i[n]=t,localStorage.setItem("itr_",JSON.stringify(i));else{let r="{"+JSON.stringify(i).replaceAll("{","").replaceAll("}","")+',"'+n+'":"'+t+'"}';localStorage.setItem("itr_",r)}}else{let i='{"'+n+'":"'+t+'"}';localStorage.setItem("itr_",i)}}function getInteractStorage(n){let t=JSON.parse(localStorage.getItem("itr_"));if(t!=null){let i=t[n];if(i!=undefined){let n=document.querySelector('.reels-heart-btn[data-value="'+i+'"]');n!=undefined&&n.classList.add("active")}}}function changeInteractionArticle(n,t,i){if(n!=undefined&&t!=undefined){url="/Interaction/ChangeInteractionArticle";var r=new XMLHttpRequest;r.open("POST",url,!0);r.setRequestHeader("Content-Type","application/x-www-form-urlencoded");r.responseType="json";r.onreadystatechange=function(){r.readyState==4&&r.status==200&&(console.log(this.response.code),this.response.code>0&&changeStorageInteract(n,t))};r.send("&ArticleId="+n+"&NewInteraction="+t+"&OldInteraction="+i)}}function changeStorageReaction(n,t){var r;let i=JSON.parse(localStorage.getItem("reaction"));if(t!=null)if(i!=null){let u=i.filter(t=>t.id===n);if(u.length!=0){for(r in i)if(i[r].id==n){i[r].value=t;break}}else i.push({id:n,value:t})}else i=[],i.push({id:n,value:t});else for(r in i)if(i[r].id==n){i.splice(r,1);break}localStorage.setItem("reaction",JSON.stringify(i))}function getReactionStorage(n){let t=JSON.parse(localStorage.getItem("reaction"));if(t==null)return-1;let i=t.filter(t=>t.id==n);return i.length==0?-1:i[0].value}var curentPage,cmt_btn,share_btn,back_reels_btn,extend_btn,heart_btn,sharefb,sharelink,shareTwitter,shareTitok,avartar;let currentIndex=0;const video=document.querySelector(".main-video"),overlay=document.querySelector(".video-overlay"),btn=document.querySelector(".mute-btn"),videoSlide=document.querySelectorAll(".video-overlay");let isTransitioning=!1,lastMuteState=!0,transformOccurred=!1,playeButton=document.querySelector(".play-button");curentPage=document.getElementById("CURRENT_PAGE");let isLoading=!1;const timeline=document.getElementById("timeline");let arrayItem=[];var mediaServer=document.getElementById("MEDIA_SERVER"),videoServer=document.getElementById("VIDEO_SERVER"),turnOn='