/*! For license information please see main.js.LICENSE.txt */ (()=>{var e={602:e=>{e.exports={_SITE_URL:"https://rawsakura.org/",_CDN:"https://rawsakura.org/",_SITE_NAME:"RawSakura",_EMAIL:"rawuwu.online@gmail.com",_TWITTER:"#",_LOGO_ICON:"https://rawsakura.org/public/icons/rawsakura.png",_LOGO:"https://rawsakura.org/public/icons/rawsakura.png",_AMP_URL:"https://rawsakura.org/",_SOCKET:"https://rawsakura.org/"}},595:e=>{var t;self,t=function(){return(()=>{"use strict";var e={311:(e,t,n)=>{n.r(t),n.d(t,{default:()=>ve});var i={};function r(){return(r=Object.assign||function(e){for(var t=1;tH,DESTROYED:()=>Y,IDLE:()=>V,MOUNTED:()=>F,MOVING:()=>W});var s=Object.keys;function o(e,t){s(e).some((function(n,i){return t(e[n],n,i)}))}function a(e){return s(e).map((function(t){return e[t]}))}function c(e){return"object"==typeof e}function l(e,t){var n=r({},e);return o(t,(function(e,t){c(e)?(c(n[t])||(n[t]={}),n[t]=l(n[t],e)):n[t]=e})),n}function u(e){return Array.isArray(e)?e:[e]}function d(e,t,n){return Math.min(Math.max(e,t>n?n:t),t>n?t:n)}function h(e,t){var n=0;return e.replace(/%s/g,(function(){return u(t)[n++]}))}function p(e){var t=typeof e;return"number"===t&&e>0?parseFloat(e)+"px":"string"===t?e:""}function f(e){return e<10?"0"+e:e}function m(e,t){if("string"==typeof t){var n=b("div",{});x(n,{position:"absolute",width:t}),k(e,n),t=n.clientWidth,_(n)}return+t||0}function v(e,t){return e?e.querySelector(t.split(" ")[0]):null}function g(e,t){return y(e,t)[0]}function y(e,t){return e?a(e.children).filter((function(e){return L(e,t.split(" ")[0])||e.tagName===t})):[]}function b(e,t){var n=document.createElement(e);return o(t,(function(e,t){return T(n,t,e)})),n}function w(e){var t=b("div",{});return t.innerHTML=e,t.firstChild}function _(e){u(e).forEach((function(e){if(e){var t=e.parentElement;t&&t.removeChild(e)}}))}function k(e,t){e&&e.appendChild(t)}function E(e,t){if(e&&t){var n=t.parentElement;n&&n.insertBefore(e,t)}}function x(e,t){e&&o(t,(function(t,n){null!==t&&(e.style[n]=t)}))}function S(e,t,n){e&&u(t).forEach((function(t){t&&e.classList[n?"remove":"add"](t)}))}function A(e,t){S(e,t,!1)}function $(e,t){S(e,t,!0)}function L(e,t){return!!e&&e.classList.contains(t)}function T(e,t,n){e&&e.setAttribute(t,n)}function C(e,t){return e?e.getAttribute(t):""}function O(e,t){u(t).forEach((function(t){u(e).forEach((function(e){return e&&e.removeAttribute(t)}))}))}function q(e){return e.getBoundingClientRect()}var N="slide",R="loop",I="fade";const j=function(e,t){var n,i;return{mount:function(){n=t.Elements.list,e.on("transitionend",(function(e){e.target===n&&i&&i()}),n)},start:function(r,s,o,a,c){var l=e.options,u=t.Controller.edgeIndex,d=l.speed;i=c,e.is(N)&&(0===o&&s>=u||o>=u&&0===s)&&(d=l.rewindSpeed||d),x(n,{transition:"transform "+d+"ms "+l.easing,transform:"translate("+a.x+"px,"+a.y+"px)"})}}},B=function(e,t){function n(n){var i=e.options;x(t.Elements.slides[n],{transition:"opacity "+i.speed+"ms "+i.easing})}return{mount:function(){n(e.index)},start:function(e,i,r,s,o){var a=t.Elements.track;x(a,{height:p(a.clientHeight)}),n(i),setTimeout((function(){o(),x(a,{height:""})}))}}};function M(e){console.error("[SPLIDE] "+e)}function P(e,t){if(!e)throw new Error(t)}var D="splide",U={active:"is-active",visible:"is-visible",loading:"is-loading"},z={type:"slide",rewind:!1,speed:400,rewindSpeed:0,waitForTransition:!0,width:0,height:0,fixedWidth:0,fixedHeight:0,heightRatio:0,autoWidth:!1,autoHeight:!1,perPage:1,perMove:0,clones:0,start:0,focus:!1,gap:0,padding:0,arrows:!0,arrowPath:"",pagination:!0,autoplay:!1,interval:5e3,pauseOnHover:!0,pauseOnFocus:!0,resetProgress:!0,lazyLoad:!1,preloadPages:1,easing:"cubic-bezier(.42,.65,.27,.99)",keyboard:"global",drag:!0,dragAngleThreshold:30,swipeDistanceThreshold:150,flickVelocityThreshold:.6,flickPower:600,flickMaxPages:1,direction:"ltr",cover:!1,accessibility:!0,slideFocus:!0,isNavigation:!1,trimSpace:!0,updateOnMove:!1,throttle:100,destroy:!1,breakpoints:!1,classes:{root:D,slider:D+"__slider",track:D+"__track",list:D+"__list",slide:D+"__slide",container:D+"__slide__container",arrows:D+"__arrows",arrow:D+"__arrow",prev:D+"__arrow--prev",next:D+"__arrow--next",pagination:D+"__pagination",page:D+"__pagination__page",clone:D+"__slide--clone",progress:D+"__progress",bar:D+"__progress__bar",autoplay:D+"__autoplay",play:D+"__play",pause:D+"__pause",spinner:D+"__spinner",sr:D+"__sr"},i18n:{prev:"Previous slide",next:"Next slide",first:"Go to first slide",last:"Go to last slide",slideX:"Go to slide %s",pageX:"Go to page %s",play:"Start autoplay",pause:"Pause autoplay"}},H=1,F=2,V=3,W=4,Y=5;function G(e,t){for(var n=0;n1?n-1:0),r=1;r1?n-1:0),r=1;r",Left:"<",Right:">"},rtl:{ArrowLeft:">",ArrowRight:"<",Left:">",Right:"<"},ttb:{ArrowUp:"<",ArrowDown:">",Up:"<",Down:">"}};var he="move.sync",pe="mouseup touchend",fe=[" ","Enter","Spacebar"],me={Options:function(e){var t=C(e.root,"data-splide");if(t)try{e.options=JSON.parse(t)}catch(e){M(e.message)}return{mount:function(){e.State.is(H)&&(e.index=e.options.start)}}},Breakpoints:function(e){var t,n,i=e.options.breakpoints,r=te(o,50),s=[];function o(){var r,o=(r=s.filter((function(e){return e.mql.matches}))[0])?r.point:-1;if(o!==n){n=o;var a=e.State,c=i[o]||t,l=c.destroy;l?(e.options=t,e.destroy("completely"===l)):(a.is(Y)&&e.mount(),e.options=c)}}return{required:i&&matchMedia,mount:function(){s=Object.keys(i).sort((function(e,t){return+e-+t})).map((function(e){return{point:e,mql:matchMedia("(max-width:"+e+"px)")}})),this.destroy(!0),addEventListener("resize",r),t=e.options,o()},destroy:function(e){e&&removeEventListener("resize",r)}}},Controller:function(e,t){var n,i,r={mount:function(){n=e.options,i=e.is(R),e.on("move",(function(t){e.index=t})).on("updated refresh",(function(t){n=t||n,e.index=d(e.index,0,r.edgeIndex)}))},go:function(e,n){var i=this.trim(this.parse(e));t.Track.go(i,this.rewind(i),n)},parse:function(t){var i=e.index,s=String(t).match(/([+\-<>]+)(\d+)?/),o=s?s[1]:"",a=s?parseInt(s[2]):0;switch(o){case"+":i+=a||1;break;case"-":i-=a||1;break;case">":case"<":i=function(e,t,i){if(e>-1)return r.toIndex(e);var s=n.perMove,o=i?-1:1;return s?t+s*o:r.toIndex(r.toPage(t)+o)}(a,i,"<"===o);break;default:i=parseInt(t)}return i},toIndex:function(t){if(s())return t;var i=e.length,r=n.perPage,o=t*r;return i-r<=(o-=(this.pageLength*r-i)*Q(o/i))&&ot;)e-=t+1;for(;e<0;)e+=t+1}else e>t?e=0:e<0&&(e=t);return e},isRtl:function(){return n.direction===K},get pageLength(){var t=e.length;return s()?t:Math.ceil(t/n.perPage)},get edgeIndex(){var t=e.length;return t?s()||n.isNavigation||i?t-1:t-n.perPage:0},get prevIndex(){var t=e.index-1;return(i||n.rewind)&&(t=this.rewind(t)),t>-1?t:-1},get nextIndex(){var t=e.index+1;return(i||n.rewind)&&(t=this.rewind(t)),e.index-1,mount:function(){var o=this;this.isClone||(i.id=e.root.id+"-slide"+f(t+1)),e.on(s,(function(){return o.update()})).on(Z,l).on("click",(function(){return e.emit("click",o)}),i),r&&e.on("move.slide",(function(e){e===n&&c(!0,!1)})),x(i,{display:""}),this.styles=C(i,"style")||""},destroy:function(){e.off(s).off(Z).off("click",i),$(i,a(U)),l(),O(this.container,"style")},update:function(){c(this.isActive(),!1),c(this.isVisible(),!0)},isActive:function(){return e.index===t},isVisible:function(){var t=this.isActive();if(e.is(I)||t)return t;var n=Math.ceil,r=q(e.Components.Elements.track),s=q(i);return e.options.direction===X?r.top<=s.top&&s.bottom<=n(r.bottom):r.left<=s.left&&s.right<=n(r.right)},isWithin:function(n,i){var r=Math.abs(n-t);return e.is(N)||this.isClone||(r=Math.min(r,e.length-r)),r=1||o?t.Transition.start(n,i,a,this.toCoord(s),(function(){h(n,i,a,r)})):n!==a&&"move"===e.options.trimSpace?t.Controller.go(n+n-a,r):h(n,i,a,r))},jump:function(e){this.translate(p(e))},translate:function(e){x(r,{transform:"translate"+(s?"Y":"X")+"("+e+"px)"})},cancel:function(){e.is(R)?this.shift():this.translate(this.position),x(r,{transition:""})},shift:function(){var t=ee(this.position),n=ee(this.toPosition(0)),i=ee(this.toPosition(e.length)),r=i-n;ti&&(t-=r),this.translate(l*t)},trim:function(t){return!e.options.trimSpace||e.is(R)?t:d(t,l*(n.totalSize()-n.size-n.gap),0)},toIndex:function(e){var t=this,n=0,r=1/0;return i.getSlides(!0).forEach((function(i){var s=i.index,o=ee(t.toPosition(s)-e);or&&(t=r+7*Math.log(t-r)),t*=n}return t}(o))}}else(function(t){var n=t.offset;if(e.State.is(W)&&e.options.waitForTransition)return!1;var i=180*Math.atan(ne(n.y)/ne(n.x))/Math.PI;return l&&(i=90-i),i0){var s=e.options,o=e.index,l=i<0?-1:1,h=o;if(!e.is(I)){var p=a.position;r>s.flickVelocityThreshold&&ne(n.offset[u]).1&&(h=o+l*a.sign),e.is(N)&&(h=d(h,0,c.edgeIndex)),c.go(h,s.isNavigation)}}(r),s=!1)}function g(e,t){var n=e.timeStamp,i=e.touches,r=i?i[0]:e,s=r.clientX,o=r.clientY,a=t.to||{},c=a.x,l=void 0===c?s:c,u=a.y,d={x:s-l,y:o-(void 0===u?o:u)},h=n-(t.time||0);return{to:{x:s,y:o},offset:d,time:n,velocity:{x:d.x/h,y:d.y/h}}}return h},Click:function(e,t){var n=!1;function i(e){n&&(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation())}return{required:e.options.drag,mount:function(){e.on("click",i,t.Elements.track,{capture:!0}).on("drag",(function(){n=!0})).on("dragged",(function(){setTimeout((function(){n=!1}))}))}}},Autoplay:function(e,t,n){var i,r=[],s=t.Elements,o={required:e.options.autoplay,mount:function(){var t=e.options;s.slides.length>t.perPage&&(i=function(t,n,i){var r,s,o,a=window.requestAnimationFrame,c=!0,l=function t(l){c||(r||(r=l,o&&o<1&&(r-=o*n)),o=(s=l-r)/n,s>=n&&(r=0,o=1,e.go(">")),i&&i(o),a(t))};return{pause:function(){c=!0,r=0},play:function(e){r=0,e&&(o=0),c&&(c=!1,a(l))}}}(0,t.interval,(function(t){e.emit(n+":playing",t),s.bar&&x(s.bar,{width:100*t+"%"})})),function(){var t=e.options,n=e.sibling,i=[e.root,n?n.root:null];t.pauseOnHover&&(a(i,"mouseleave",1,!0),a(i,"mouseenter",1,!1)),t.pauseOnFocus&&(a(i,"focusout",2,!0),a(i,"focusin",2,!1)),s.play&&e.on("click",(function(){o.play(2),o.play(3)}),s.play),s.pause&&a([s.pause],"click",3,!1),e.on("move refresh",(function(){o.play()})).on("destroy",(function(){o.pause()}))}(),this.play())},play:function(t){void 0===t&&(t=0),(r=r.filter((function(e){return e!==t}))).length||(e.emit(n+":play"),i.play(e.options.resetProgress))},pause:function(t){void 0===t&&(t=0),i.pause(),-1===r.indexOf(t)&&r.push(t),1===r.length&&e.emit(n+":pause")}};function a(t,n,i,r){t.forEach((function(t){e.on(n,(function(){o[r?"play":"pause"](i)}),t)}))}return o},Cover:function(e,t){function n(e){t.Elements.each((function(t){var n=g(t.slide,"IMG")||g(t.container,"IMG");n&&n.src&&i(n,e)}))}function i(e,t){x(e.parentElement,{background:t?"":'center/cover no-repeat url("'+e.src+'")'}),x(e,{display:t?"":"none"})}return{required:e.options.cover,mount:function(){e.on("lazyload:loaded",(function(e){i(e,!1)})),e.on("mounted updated refresh",(function(){return n(!1)}))},destroy:function(){n(!0)}}},Arrows:function(e,t,n){var i,r,s,o=e.classes,a=e.root,c=t.Elements;function l(){var s=t.Controller,o=s.prevIndex,a=s.nextIndex,c=e.length>e.options.perPage||e.is(R);i.disabled=o<0||!c,r.disabled=a<0||!c,e.emit(n+":updated",i,r,o,a)}function u(t){return w('\n \n ')[0];i.querySelector(".cmt-area-button button").addEventListener("click",(function(){let e=this;if(!this.classList.contains("loading")){this.classList.add("loading"),this.innerHTML=ie;var t=this.closest(".comment-area").querySelector("textarea"),r=new FormData,s=document.getElementById("manga-id").value,o=document.getElementById("chapter-id");o=o?o.value:"",r.append("reply_id",n),r.append("manga_id",s),r.append("chapter_id",o),r.append("content",t.value),$()({url:"/ajax/manga/reply-cmt/"+s,method:"post",responseType:"json",data:r}).then((function(n){let r=n.data;if(r.message&&alert(r.message),1==r.success){var s=e.closest(".cmt-item"),o=f.createStr(`
${ce(r.cmt)}
`)[0];ae(o.getElementsByClassName("reply-cmt"));var a=s.querySelector(".child-box");a?a.appendChild(o):((a=f.createStr('
')[0]).appendChild(o),p(a,s.querySelector(".cmt-content"))),t.value="",i.style.display="none"}})).then((function(){e.classList.remove("loading"),e.innerHTML="Send"}))}}));let r=e.closest(".cmt-item");r.querySelector(".child-box")?p(i,r.querySelector(".child-box")):p(i,r.querySelector(".cmt-content"))}))}))}function ce(e,n=!1){let i="";1==n&&(i=`ReplyReply`);let r="";return e.chapter_number&&(r=`
Chapter ${e.chapter_number}
`),`
\n \n
\n
\n
\n \n ${r}\n
${F(Date.parse(e.cmt_date_published))}
\n
\n
${e.cmt_content}
\n
\n ${i}`}function le(){var e=document.getElementById("manga-id").value,t=document.getElementById("chapter-id");t=t?t.value:"",new S([document.getElementById("comment-content")]).addEventListener("click",(function(){var n=f.createStr('
\n \n
')[0];n.querySelector("button").addEventListener("click",(function(n){let i=this;if(!this.classList.contains("loading")){this.classList.add("loading"),this.innerHTML=ie;var r=this.closest(".comment-area").querySelector("textarea"),s=new FormData;s.append("chapter_id",t),s.append("content",r.value),$()({url:"/ajax/manga/add-cmt/"+e,method:"post",responseType:"json",data:s}).then((function(e){let t=e.data;if(t.message&&alert(t.message),1==t.success){r.value="";var n=f.createStr(`
${ce(t.cmt,!0)}
`)[0],i=document.getElementsByClassName("list-cmt")[0];i.querySelector(".cmt-item")?i.insertBefore(n,i.firstChild):i.appendChild(n),ae(n.getElementsByClassName("reply-cmt"))}})).then((function(){i.classList.remove("loading"),i.innerHTML="Send"}))}})),this.parentNode.appendChild(n),new S([this]).removeEventListener("click")})),se(),oe(),ae(document.getElementsByClassName("reply-cmt"))}function ue(e){var t=e.querySelector(".inner");if(t.offsetHeight>=160){t.classList.add("shortened");var n=f.createStr('+ Read more')[0];n.addEventListener("click",(function(e){e.preventDefault(),t.classList.toggle("shortened"),t.classList.contains("shortened")?(n.innerHTML="+ Read more",n.setAttribute("title","Read more")):(n.innerHTML="- Collapse",n.setAttribute("title","Collapse"))})),e.appendChild(n)}}function de(e){for(var t=1;t .inner").style.top=0,document.querySelector(".c-hidden-btn").style.bottom=0)}function ve(e){var t=document.querySelectorAll(".chapter-img");if(e==`page${Math.ceil(t.length/2)}`){var n=new FormData;n.append("chapter_id",document.querySelector("#chapter-id").value),n.append("manga_id",document.querySelector("#manga-id").value),$()({url:"/ajax/user-history",method:"post",data:n})}}var ge,ye,be=200,we=function(){var e=window.innerWidth;be=e<400?40:e>=400&&e<800?100:200};function _e(e){if(!e||!e.querySelector(".chapter-img").classList.contains("shine"))return;var t=e.querySelector("canvas.lazy");const n=t.getContext("2d"),i=new Image;i.onload=function(){n.drawImage(i,0,0,this.width,this.height),t.closest(".chapter-img").classList.remove("shine")},i.src=fe+t.getAttribute("data-srcset"),ve(e.id)}function ke(){var e=window.location.hash||"#page0",t=document.querySelector(e);if(e&&t){var n=document.querySelector(".first-page");n&&n.classList.remove("first-page"),document.querySelector(".current-page").classList.remove("current-page"),t.classList.add("current-page"),_e(t),_e(t.nextElementSibling)}}function Ee(){pe=setTimeout((function(){var e=new FormData;e.append("chapter_id",document.querySelector("#chapter-id").value),e.append("manga_id",document.querySelector("#manga-id").value),$()({url:"/ajax/count-view",method:"post",data:e})}),5e3),window.removeEventListener("scroll",Ee)}function xe(e,n){var i="";e.forEach((function(e){let n=e.manga_id,r=v(e.manga_name),s=e.manga_cover_img,o=`/${a(e.manga_name)}-c${n}`,c=g(s),l=c?`width="${c.w}" height="${c.h}"`:"",u=e.chapter_number,d=F(Date.parse(e.chapter_date_published)),h=`Chapter ${u}`;i+=`
\n
\n
\n \n ${r}\n \n
\n
\n \n
\n \n
\n
Remove
\n
\n
\n
`})),document.querySelector(".manga-list").innerHTML=i,n()}var Se=new z([{path:"/",module:function(){return{script:function(){(J=new(Y())(".splide",{perPage:5,perMove:1,cover:!0,pagination:!1,autoplay:!0,arrows:0,interval:1500,type:document.querySelectorAll(".slider ul li").length>5?"loop":0,padding:{right:document.querySelectorAll(".slider ul li").length>5?"5em":0},breakpoints:{1100:{perPage:5,type:document.querySelectorAll(".slider ul li").length>4?"loop":0,padding:{right:document.querySelectorAll(".slider ul li").length>4?"5em":0}},900:{perPage:4,type:document.querySelectorAll(".slider ul li").length>3?"loop":0,padding:{right:document.querySelectorAll(".slider ul li").length>3?"5em":0}},700:{perPage:3,type:document.querySelectorAll(".slider ul li").length>2?"loop":0,padding:{right:document.querySelectorAll(".slider ul li").length>2?"5em":0}},550:{perPage:2,type:document.querySelectorAll(".slider ul li").length>2?"loop":0,padding:{right:document.querySelectorAll(".slider ul li").length>2?"5em":0}},400:{perPage:2,type:document.querySelectorAll(".slider ul li").length>1?"loop":0,padding:0}}})).mount(),K?K.update():K=new(Z())({elements_selector:".lazy"}),function(){var e=G();if(0!=e.length){var n=new FormData,i=[];e.slice(0,3).forEach((function(e){i.push(e.chapter_id)})),n.append("cids[]",i),$()({url:"/ajax/history",method:"post",responseType:"json",data:n}).then((function(e){var n="";e.data.forEach((function(e,t){let i=e.manga_id,r=v(e.manga_name),s=e.manga_cover_img,o=`/${a(e.manga_name)}-c${i}`,c=g(s),l=c?`width="${c.w}" height="${c.h}"`:"",u=e.chapter_number,d=F(Date.parse(e.chapter_date_published)),h=`Chapter ${u}`;n+=`
\n
\n
\n \n ${r}\n \n
\n
\n \n
\n \n
\n
\n
\n
`})),document.querySelector(".history").innerHTML=`
\n

History

\n
\n
\n ${n}\n
\n
\n \n Views all \n \n
\n
\n
`,D()}))}}()},fetch:function(e){$()({url:"/spa/home",method:"get",responseType:"json"}).then((function(n){e.set_state(function(e){let n="Manga raw desu!!",i="",r="";return e.new_cmts.forEach((e=>{e.cmt_id;let t=e.account,n=v(e.nickname),r=e.cmt_content,s=F(Date.parse(e.cmt_date_published)),o=e.chapter_number,c=e.manga_id,l=e.manga_name,u=v(e.manga_name),d=`/${a(l)}-c${c}`,h=e.avatar,p="";o&&(p=`
Chapter ${o}
`),i+=`
\n \n
\n ${u}\n
\n
\n
\n \n ${p}\n
${s}
\n
\n
${r}
\n
\n
`})),e.top_hot.forEach((function(e){var n=e.manga_id,i=e.manga_name,s=v(i),o=e.manga_cover_img,c=`/${a(i)}-c${n}`,l=e.manga_views,u=e.manga_chapters||[],d=g(o),h=d?`width="${d.w}" height="${d.h}"`:"",p="";u.forEach((function(e){e.chapter_id;var n=e.chapter_number,i=`Chapter ${n}`;p+=`
${i}
views${l}
`})),""==p&&(p+=`
Updating...
views${l}
`),r+=`
  • \n
    \n
    \n \n ${s}\n \n
    \n
    \n
    \n ${s}\n
    \n ${p}\n
    \n
    \n
  • `})),C.innerHTML=`
    \n

    ${t._SITE_NAME} - ${n}

    \n
    \n

    Most viewed today

    \n
    \n
    \n
    \n
    \n
    \n
      \n ${r}\n
    \n
    \n
    \n
    \n
    \n
    \n \n
    \n

    Last updated

    \n
    \n
    \n ${V(e.manga_list)}\n
    \n
    \n \n Read more \n \n
    \n
    \n
    \n
    \n

    New comments

    \n
    \n
    \n
    ${i}
    \n
    \n
    `,{html:y(C),title:n+" - "+t._SITE_NAME}}(n.data))}))},remove_event:function(){if(J)try{J.destroy()}catch(e){}}}}},{path:"/about",module:function(){return{script:function(){},fetch:function(e){e.set_state((C.innerHTML=`
    \n
    \n

    About ${t._SITE_NAME}

    \n

    ${t._SITE_NAME} is a site to read manga raw online for free . We have more than 10000+ manga raw with high quality images

    \n

    Any questions contact : ${t._EMAIL}

    \n

    Follow ${t._SITE_NAME} on :

    \n \n
    \n
    `,{html:y(C),title:"About - "+t._SITE_NAME}))}}}},{path:"/latest",module:function(){return{script:function(){ee?ee.update():ee=new(Z())({elements_selector:".lazy"})},fetch:function(e){$()({url:"/spa/latest-manga"+window.location.search,method:"get",responseType:"json"}).then((function(n){e.set_state(function(e){let n="Latest updates";C.innerHTML=`
    \n \n
    \n

    ${n}

    \n
    \n
    \n ${V(e.manga_list)}\n
    \n \n ${Q(e.pagi)}\n
    `;let i=n;return e.pagi.cur_page>1&&(i+=" | Page "+e.pagi.cur_page),{html:y(C),title:i+" - "+t._SITE_NAME}}(n.data))}))}}}},{path:"/([a-zA-Z0-9-]+)-c([0-9]+)",module:function(e){const n=e[1];return{script:function(){var e=document.getElementById("manga-id").value,i=document.querySelector(".show-all-chapters > a");i&&i.addEventListener("click",(function(e){e.preventDefault();var t=this;$()({url:"/spa/manga/"+n,method:"get",responseType:"json"}).then((function(e){var t=e.data.chapters,n="",i=window.location.pathname;t.forEach((function(e){e.chapter_id;let t=e.chapter_views,r=e.chapter_number,s=F(Date.parse(e.chapter_date_published)),o=`Chapter ${r}`+(""!=e.chapter_title?` : ${v(e.chapter_title)}`:"");n+=`
  • \n \n
    \n
    ${o}
    \n
    ${s}
    \n
    \n
    ${t}
    \n
    \n
  • `})),document.querySelector(".manga-chapters > ul").innerHTML=n})).finally((function(){d(t)}))})),ue(document.querySelector(".manga-description")),ue(document.querySelector(".manga-others-name")),$()({url:"/ajax/bookmark-status/"+e,method:"get",responseType:"json"}).then((function(e){let t=e.data,n=document.getElementById("bookmark");1==parseInt(t.status)&&(n.setAttribute("title","Unbookmarks"),n.setAttribute("class","b"),n.innerHTML="- Unbookmarks")})),document.getElementById("bookmark").addEventListener("click",(function(t){t.preventDefault();let n=this;n.classList.contains("loading")||(n.classList.add("loading"),n.innerHTML=ie,$()({url:"/ajax/bookmark/"+e,method:"get",responseType:"json"}).then((function(e){let t=e.data;1==t.status?(n.setAttribute("title","Unbookmarks"),n.setAttribute("class","b"),n.innerHTML="- Unbookmarks"):-1==t.status&&(n.setAttribute("title","Bookmarks"),n.setAttribute("class",""),n.innerHTML="+ Bookmarks"),t.message&&alert(t.message)})).finally((function(){n.classList.remove("loading"),n.querySelector("img")&&(n.setAttribute("title","Bookmarks"),n.setAttribute("class",""),n.innerHTML="+ Bookmarks")})))})),le(),document.getElementById("comment-box").getAttribute("admin")&&(m(".list-cmt","click",".cmt-item .del-cmt",(function(e){e.preventDefault();var t=this,n=t.innerHTML,i=t.closest(".cmt-item"),r=i.getAttribute("data-cmt-id");t.innerHTML=ie,$()({url:"/ajax/del-cmt/"+r,method:"get",responseType:"json"}).then((function(e){var r=e.data;if(r.success){var s=i.querySelector(".child-box"),o=!1;s&&1==s.querySelectorAll(".cmt_item").length&&(o=!0),d(i),1==o&&d(s)}r.parent&&(i.querySelector(".cmt-content").innerHTML='This comment has been deleted!',t.innerHTML=n)})).catch((function(){t.innerHTML=n}))})),h(document.querySelectorAll(".cmt-item .cmt-user-name"),(function(e){if(!e.querySelector(".del-cmt")){var n=f.createStr(``)[0];e.append(n)}})))},fetch:function(e){$()({url:"/spa/manga/"+n,method:"get",responseType:"json"}).then((function(n){e.set_state(function(e){const n=e.detail,i=e.tags,r=e.authors,s=e.chapters;var o=n.manga_id,l=n.manga_name,u=0==n.manga_status?"Ongoing":"Completed",d=n.manga_updated,h=v(l).replace(/\s+$/,""),p=(n.manga_date_published,Math.max(0,n.manga_views)),f=n.manga_cover_img,m=g(f),b=m?`width="${m.w}" height="${m.h}"`:"",w=null==n.manga_others_name?"Updating...":n.manga_others_name,_=null==n.manga_description?"Updating...":n.manga_description,E=n.manga_cover_img_full;const x=`/${a(l)}-c${o}`;var S="/",A="/";if(s.length>0){var $=s[s.length-1];S=`${x}/chapter-${$.chapter_number}`;var L=s[0];A=`${x}/chapter-${L.chapter_number}`}var T="";i.forEach((function(e){let{tag_id:t,tag_name:n}=e,i=v(n),r=`/genre/${t}/${encodeURIComponent(n)}`;T+=`${i}`})),""==T&&(T="Updating...");var O="";r.forEach((function(e){let{author_id:t,author_name:n}=e,i=v(n),r=`/author/${t}/${encodeURIComponent(n)}`;O+=`${i}`})),""==O&&(O="Updating...");var q=[];q.push({name:h,item:x});var N="";s.forEach((function(e){e.chapter_id;let t=e.chapter_views,n=e.chapter_number,i=F(Date.parse(e.chapter_date_published)),r=`Chapter ${n}`+(""!=e.chapter_title?` : ${v(e.chapter_title)}`:"");N+=`
  • \n \n
    \n
    ${r}
    \n
    ${i}
    \n
    \n
    ${t}
    \n
    \n
  • `})),""!=N&&(N=`

    Chapters

      ${N}
    `),s.length,C.innerHTML=`
    \n \n ${k(q)}\n \n
    \n
    \n
    \n
    \n ${h}\n
    \n
    \n \n
    \n
    \n
    \n

    ${h}

    \n
    \n

    ${w}

    \n
    \n

    Summary

    \n
    \n

    ${_}

    \n
    \n
      \n
    • \n
      Authour(s):
      \n
      ${O}
      \n
    • \n
    • \n
      Status:
      \n
      ${u}
      \n
    • \n
    • \n
      Genre(s):
      \n
      ${T}
      \n
    • \n
    • \n
      Updated:
      \n
      \n
    • \n
    • \n
      Views:
      \n
      ${p}
      \n
    • \n
    \n
    \n
    \n ${N}\n
    \n ${re(e.cmts)}\n
    `;var R=s.length>0?` [Up to chapter ${s[0].chapter_number}]`:"";return{html:y(C),title:h+`${R} Raw - `+t._SITE_NAME}}(n.data))}))},remove_event:function(){}}}},{path:"/[a-zA-Z0-9-]+-c([0-9]+)/chapter-([0-9.]+)",module:function(e){var n=e[0],i=e[1];return{script:function(){fe=document.querySelector(".servers a.current").getAttribute("data-server"),window.addEventListener("scroll",Ee),document.querySelector(".wrapper").classList.add("chapter-page"),le(),document.querySelector(".select-chapter > select").addEventListener("change",(function(){var e=this.options[this.selectedIndex].value;Ae.push(e)})),document.querySelector(".report a").addEventListener("click",(function(e){var n;e.preventDefault(),(n=document.querySelector(".overlay"))||(n=f.createStr(`
    `)[0],new S([n,n.querySelector(".modal-top img")]).addEventListener("click",(function(e){e.preventDefault(),e.target===this&&(e.stopImmediatePropagation(),d(n))})),n.querySelector(".modal-send a").addEventListener("click",(function(e){e.preventDefault();var t=this;if(!t.classList.contains("loading")){t.innerHTML=ie,t.classList.add("loading");var i=document.getElementById("modal-txt").value,r=document.getElementById("modal-select").value,s=document.getElementById("chapter-id").value,o=new FormData;o.append("report_content",i),o.append("report_type",r),$()({url:"/ajax/report/"+s,responseType:"json",method:"post",data:o}).then((function(e){var t=e.data;t.message&&alert(t.message),t.success&&d(n)})).finally((function(){t.innerHTML="Send",t.classList.remove("loading")}))}})),document.body.appendChild(n))}));var n=document.querySelector(".continue-hidden a");n&&n.addEventListener("click",(function(e){e.preventDefault(),he.set("read","1",{expires:30}),Ae.push(window.location.pathname,"",!0)})),new S(document.querySelectorAll(".servers a")).addEventListener("click",(function(e){e.preventDefault(),this.id,document.querySelector(".servers a.current").classList.remove("current"),this.classList.add("current"),fe=this.getAttribute("data-server"),h(document.querySelectorAll(".lazy.entered"),(function(e){let t=this,n=t.getContext("2d"),i=new Image;i.onload=function(){n.drawImage(i,0,0,this.width,this.height),t.closest(".chapter-img").classList.remove("shine")},i.src=fe+t.getAttribute("data-srcset")}))}));var i=document.querySelector(".chapter-imgs.single");i?function(e){window.addEventListener("scroll",me),we(),window.addEventListener("resize",we);var t=window.location.hash;window.location.hash&&document.querySelector(t);var n=e.querySelector(".first-page");n.classList.add("current-page"),_e(n),_e(n.nextElementSibling);var i=0;e.addEventListener("click",(function(e){e.stopPropagation(),e.preventDefault();var t,n=this.querySelector(".current-page"),r=event.clientX,s=window.innerWidth/2,o=document.querySelector(".header > .inner"),a=document.querySelector(".c-hidden-btn");if(r=s+be)i=1,t=n.previousSibling,o.style.top="-60px",a.style.bottom="-40px";else{i=0;var c=parseInt(o.style.top)||0,l=parseInt(a.style.bottom)||0;o.style.top=0==c?"-60px":0,a.style.bottom=0==l?"-40px":0}if(t&&"DIV"==t.tagName)location.hash="#"+t.id;else{var u=n.querySelector(".chapter-img");2==i?(u.style.left="50px",setTimeout((function(){u.style.left=0}),200)):1==i&&(u.style.right="50px",setTimeout((function(){u.style.right=0}),200))}}))}(i):ge?ge.update():ge=new(Z())({elements_selector:".lazy",threshold:4e3,callback_enter:function(e){const t=e.getContext("2d"),n=new Image;n.onload=function(){t.drawImage(n,0,0,this.width,this.height),e.closest(".chapter-img").classList.remove("shine")},n.src=fe+e.getAttribute("data-srcset"),ve(e.closest(".page-wrapper").id)},callback_loaded:function(e){e.closest(".chapter-img").classList.remove("shine")}}),document.querySelector("#view-mode").addEventListener("change",(function(){var e=this.value;2==e?he.set("mode",e,{expires:30}):he.remove("mode"),Ae.push(window.location.pathname,"",!0)})),document.querySelector("#img-view").addEventListener("change",(function(){var e=this.value;2==e?(he.set("img_mode",e,{expires:30}),document.querySelector(".chapter-imgs").classList.add("fit-height")):(document.querySelector(".chapter-imgs").classList.remove("fit-height"),he.remove("img_mode"))})),function(e){localStorage.getItem("visit-chapter")||localStorage.setItem("visit-chapter",[]);var t,n=document.getElementById("chapter-id").value,i=e[0],r=[],s=localStorage.getItem("visit-chapter"),o={};document.querySelector(".m-page a"),o.manga_id=i,o.chapter_id=n;try{t=JSON.parse(s)}catch(e){t=[]}if(t.length>0){for(var a=0;a${i.chapter_title}`:"",d=i.manga_url,h=`${r} Chapter ${a}`,p=he.get("mode")||"1",f={},m=' selected="selected"';f[p]=m;var g=he.get("img_mode")||"1",b={};m=' selected="selected"',b[p]=m;var w=[];w.push({name:r,item:d}),w.push({name:"Chapter "+a});var _="",x="",S="",A="";e.prev&&(_=``,A=``),e.next&&(x=``,S=``);let $="",L=2;return(i.slaves||[]).forEach((function(e,t){$+=`Server ${L}`,L++})),C.innerHTML=`\n \n
    \n
    ${k(w)}
    \n
    \n
    \n

    ${h} Raw

    \n \n ${u}\n \n
    \n
    If the image does not display, please switch to the image server below:
    \n
    \n \n \n
    \n
    \n
    \n Server 1\n ${$}\n
    \n
    \n
    ${i.chapter_content}
    \n \n
    \n \n
    \n
    ${re(e.cmts||[])}
    `,n=`\n
    \n
    \n
    \n ${_}\n
    \n \n
    \n ${x}\n
    \n
    \n
    `,{sub_html:n,html:y(C),title:`${h} Next Chapter ${E(a)+1} Raw - ${t._SITE_NAME}`}}(n.data))}))},remove_event:function(){document.querySelector(".wrapper").setAttribute("class","wrapper"),window.removeEventListener("resize",we),window.removeEventListener("scroll",me);let e=document.querySelector(".overlay");e&&d(e);try{clearTimeout(pe)}catch(e){}},hash:ke}}},{path:"/(genre)/([0-9]+)/[^/]+",module:ne},{path:"/all",module:ne},{path:"/author/([0-9]+)/[^/]+",module:function(e){var n=e[0];return{script:function(){document.querySelector(".select-box select").addEventListener("change",(function(){var e=this.options[this.selectedIndex].value;Ae.push(e)}))},fetch:function(e){$()({url:"/spa/author/"+n,method:"get",responseType:"json"}).then((function(n){e.set_state(function(e){const n=v(e.author_name);return C.innerHTML=`
    \n
    \n

    ${n}

    \n
    \n
    \n ${e.tags_2}\n
    \n
    \n \n
    \n
    \n ${V(e.manga_list)}\n
    \n
    `,{html:y(C),title:n+" - "+t._SITE_NAME}}(n.data))}))}}}},{path:"/history",module:function(){return{script:function(){1==(he.get("history_mode")||1)?document.querySelector(".swbtns a").classList.add("act"):document.querySelector(".swbtns a:nth-child(2)").classList.add("act"),m(".manga-list","click",".manga-list .h-remove a",(function(e){e.preventDefault();let t=document.querySelector(".swbtns a.act"),n=this.closest(".m-item"),i=n.getAttribute("data-manga-id");if("device"==t.id){let t=localStorage.getItem("visit-chapter");try{t=JSON.parse(t)}catch(e){return}for(var r=0;r0?r>i&&(r=i):r=1;var s=40*(r-1),o=[],a={next:0,prev:0};let c=0;if(r>1&&(a.prev=r-1),r-2>0&&r+2<=i)for(let e=r-2;e<=r+2;e++)o[c]={},o[c].page=e,e==r&&(o[c].act=!0),c++;else{var l=5;l=r-2<=0?l>i?i:5:i;for(let e=r-2<=0||i-4<=0?1:i-4;e<=l;e++)o[c]={},o[c].page=e,e==r&&(o[c].act=!0),c++}return rSign Up\n \n \n
    \n ',{html:y(C),title:"Reading history - "+t._SITE_NAME}))}}}},{path:"/search",module:function(){return{script:function(){ye?ye.update():ye=new(Z())({elements_selector:".lazy"})},fetch:function(e){var n="?"+new URLSearchParams({query:b("query")||"",page:b("page")||""}).toString();$()({url:"/spa/search"+n,method:"get",responseType:"json"}).then((function(n){var i;e.set_state((i=n.data,C.innerHTML=`
    \n \n
    \n

    Search manga

    \n
    \n \n
    \n ${V(i.manga_list)}\n
    \n ${Q(i.pagi)}\n
    `,{html:y(C),title:"Search manga - "+t._SITE_NAME}))}))}}}}]);Se.init();const Ae=Se,$e=Object.create(null);$e.open="0",$e.close="1",$e.ping="2",$e.pong="3",$e.message="4",$e.upgrade="5",$e.noop="6";const Le=Object.create(null);Object.keys($e).forEach((e=>{Le[$e[e]]=e}));const Te={type:"error",data:"parser error"},Ce="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Object.prototype.toString.call(Blob),Oe="function"==typeof ArrayBuffer,qe=e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,Ne=({type:e,data:t},n,i)=>Ce&&t instanceof Blob?n?i(t):Re(t,i):Oe&&(t instanceof ArrayBuffer||qe(t))?n?i(t):Re(new Blob([t]),i):i($e[e]+(t||"")),Re=(e,t)=>{const n=new FileReader;return n.onload=function(){const e=n.result.split(",")[1];t("b"+(e||""))},n.readAsDataURL(e)};function Ie(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let je;const Be="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Me="undefined"==typeof Uint8Array?[]:new Uint8Array(256);for(let e=0;e{if("string"!=typeof e)return{type:"message",data:ze(e,t)};const n=e.charAt(0);return"b"===n?{type:"message",data:Ue(e.substring(1),t)}:Le[n]?e.length>1?{type:Le[n],data:e.substring(1)}:{type:Le[n]}:Te},Ue=(e,t)=>{if(Pe){const n=(e=>{let t,n,i,r,s,o=.75*e.length,a=e.length,c=0;"="===e[e.length-1]&&(o--,"="===e[e.length-2]&&o--);const l=new ArrayBuffer(o),u=new Uint8Array(l);for(t=0;t>4,u[c++]=(15&i)<<4|r>>2,u[c++]=(3&r)<<6|63&s;return l})(e);return ze(n,t)}return{base64:!0,data:e}},ze=(e,t)=>{switch(t){case"blob":return e instanceof Blob?e:new Blob([e]);case"arraybuffer":default:return e instanceof ArrayBuffer?e:e.buffer}},He=String.fromCharCode(30);let Fe;function Ve(e){return e.reduce(((e,t)=>e+t.length),0)}function We(e,t){if(e[0].length===t)return e.shift();const n=new Uint8Array(t);let i=0;for(let r=0;r(e.hasOwnProperty(n)&&(t[n]=e[n]),t)),{})}const Ke=Ge.setTimeout,Xe=Ge.clearTimeout;function Ze(e,t){t.useNativeTimers?(e.setTimeoutFn=Ke.bind(Ge),e.clearTimeoutFn=Xe.bind(Ge)):(e.setTimeoutFn=Ge.setTimeout.bind(Ge),e.clearTimeoutFn=Ge.clearTimeout.bind(Ge))}class Qe extends Error{constructor(e,t,n){super(e),this.description=t,this.context=n,this.type="TransportError"}}class et extends Ye{constructor(e){super(),this.writable=!1,Ze(this,e),this.opts=e,this.query=e.query,this.socket=e.socket}onError(e,t,n){return super.emitReserved("error",new Qe(e,t,n)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this}send(e){"open"===this.readyState&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const t=De(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,t={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){const e=this.opts.hostname;return-1===e.indexOf(":")?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(443!==this.opts.port)||!this.opts.secure&&80!==Number(this.opts.port))?":"+this.opts.port:""}_query(e){const t=function(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}(e);return t.length?"?"+t:""}}const tt="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),nt={};let it,rt=0,st=0;function ot(e){let t="";do{t=tt[e%64]+t,e=Math.floor(e/64)}while(e>0);return t}function at(){const e=ot(+new Date);return e!==it?(rt=0,it=e):e+"."+ot(rt++)}for(;st<64;st++)nt[tt[st]]=st;let ct=!1;try{ct="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(e){}const lt=ct;function ut(e){const t=e.xdomain;try{if("undefined"!=typeof XMLHttpRequest&&(!t||lt))return new XMLHttpRequest}catch(e){}if(!t)try{return new(Ge[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(e){}}function dt(){}const ht=null!=new ut({xdomain:!1}).responseType;class pt extends Ye{constructor(e,t){super(),Ze(this,t),this.opts=t,this.method=t.method||"GET",this.uri=e,this.data=void 0!==t.data?t.data:null,this.create()}create(){var e;const t=Je(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");t.xdomain=!!this.opts.xd;const n=this.xhr=new ut(t);try{n.open(this.method,this.uri,!0);try{if(this.opts.extraHeaders){n.setDisableHeaderCheck&&n.setDisableHeaderCheck(!0);for(let e in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(e)&&n.setRequestHeader(e,this.opts.extraHeaders[e])}}catch(e){}if("POST"===this.method)try{n.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(e){}try{n.setRequestHeader("Accept","*/*")}catch(e){}null===(e=this.opts.cookieJar)||void 0===e||e.addCookies(n),"withCredentials"in n&&(n.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(n.timeout=this.opts.requestTimeout),n.onreadystatechange=()=>{var e;3===n.readyState&&(null===(e=this.opts.cookieJar)||void 0===e||e.parseCookies(n)),4===n.readyState&&(200===n.status||1223===n.status?this.onLoad():this.setTimeoutFn((()=>{this.onError("number"==typeof n.status?n.status:0)}),0))},n.send(this.data)}catch(e){return void this.setTimeoutFn((()=>{this.onError(e)}),0)}"undefined"!=typeof document&&(this.index=pt.requestsCount++,pt.requests[this.index]=this)}onError(e){this.emitReserved("error",e,this.xhr),this.cleanup(!0)}cleanup(e){if(void 0!==this.xhr&&null!==this.xhr){if(this.xhr.onreadystatechange=dt,e)try{this.xhr.abort()}catch(e){}"undefined"!=typeof document&&delete pt.requests[this.index],this.xhr=null}}onLoad(){const e=this.xhr.responseText;null!==e&&(this.emitReserved("data",e),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}}function ft(){for(let e in pt.requests)pt.requests.hasOwnProperty(e)&&pt.requests[e].abort()}pt.requestsCount=0,pt.requests={},"undefined"!=typeof document&&("function"==typeof attachEvent?attachEvent("onunload",ft):"function"==typeof addEventListener&&addEventListener("onpagehide"in Ge?"pagehide":"unload",ft,!1));const mt="function"==typeof Promise&&"function"==typeof Promise.resolve?e=>Promise.resolve().then(e):(e,t)=>t(e,0),vt=Ge.WebSocket||Ge.MozWebSocket,gt="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase(),yt={websocket:class extends et{constructor(e){super(e),this.supportsBinary=!e.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const e=this.uri(),t=this.opts.protocols,n=gt?{}:Je(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(n.headers=this.opts.extraHeaders);try{this.ws=gt?new vt(e,t,n):t?new vt(e,t):new vt(e)}catch(e){return this.emitReserved("error",e)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t{try{this.ws.send(e)}catch(e){}i&&mt((()=>{this.writable=!0,this.emitReserved("drain")}),this.setTimeoutFn)}))}}doClose(){void 0!==this.ws&&(this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=at()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}check(){return!!vt}},webtransport:class extends et{get name(){return"webtransport"}doOpen(){"function"==typeof WebTransport&&(this.transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name]),this.transport.closed.then((()=>{this.onClose()})).catch((e=>{this.onError("webtransport error",e)})),this.transport.ready.then((()=>{this.transport.createBidirectionalStream().then((e=>{const t=function(e,t){Fe||(Fe=new TextDecoder);const n=[];let i=0,r=-1,s=!1;return new TransformStream({transform(o,a){for(n.push(o);;){if(0===i){if(Ve(n)<1)break;const e=We(n,1);s=128==(128&e[0]),r=127&e[0],i=r<126?3:126===r?1:2}else if(1===i){if(Ve(n)<2)break;const e=We(n,2);r=new DataView(e.buffer,e.byteOffset,e.length).getUint16(0),i=3}else if(2===i){if(Ve(n)<8)break;const e=We(n,8),t=new DataView(e.buffer,e.byteOffset,e.length),s=t.getUint32(0);if(s>Math.pow(2,21)-1){a.enqueue(Te);break}r=s*Math.pow(2,32)+t.getUint32(4),i=3}else{if(Ve(n)e){a.enqueue(Te);break}}}})}(Number.MAX_SAFE_INTEGER,this.socket.binaryType),n=e.readable.pipeThrough(t).getReader(),i=new TransformStream({transform(e,t){!function(e,t){Ce&&e.data instanceof Blob?e.data.arrayBuffer().then(Ie).then(t):Oe&&(e.data instanceof ArrayBuffer||qe(e.data))?t(Ie(e.data)):Ne(e,!1,(e=>{je||(je=new TextEncoder),t(je.encode(e))}))}(e,(n=>{const i=n.length;let r;if(i<126)r=new Uint8Array(1),new DataView(r.buffer).setUint8(0,i);else if(i<65536){r=new Uint8Array(3);const e=new DataView(r.buffer);e.setUint8(0,126),e.setUint16(1,i)}else{r=new Uint8Array(9);const e=new DataView(r.buffer);e.setUint8(0,127),e.setBigUint64(1,BigInt(i))}e.data&&"string"!=typeof e.data&&(r[0]|=128),t.enqueue(r),t.enqueue(n)}))}});i.readable.pipeTo(e.writable),this.writer=i.writable.getWriter();const r=()=>{n.read().then((({done:e,value:t})=>{e||(this.onPacket(t),r())})).catch((e=>{}))};r();const s={type:"open"};this.query.sid&&(s.data=`{"sid":"${this.query.sid}"}`),this.writer.write(s).then((()=>this.onOpen()))}))})))}write(e){this.writable=!1;for(let t=0;t{i&&mt((()=>{this.writable=!0,this.emitReserved("drain")}),this.setTimeoutFn)}))}}doClose(){var e;null===(e=this.transport)||void 0===e||e.close()}},polling:class extends et{constructor(e){if(super(e),this.polling=!1,"undefined"!=typeof location){const t="https:"===location.protocol;let n=location.port;n||(n=t?"443":"80"),this.xd="undefined"!=typeof location&&e.hostname!==location.hostname||n!==e.port}const t=e&&e.forceBase64;this.supportsBinary=ht&&!t,this.opts.withCredentials&&(this.cookieJar=void 0)}get name(){return"polling"}doOpen(){this.poll()}pause(e){this.readyState="pausing";const t=()=>{this.readyState="paused",e()};if(this.polling||!this.writable){let e=0;this.polling&&(e++,this.once("pollComplete",(function(){--e||t()}))),this.writable||(e++,this.once("drain",(function(){--e||t()})))}else t()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){((e,t)=>{const n=e.split(He),i=[];for(let e=0;e{if("opening"===this.readyState&&"open"===e.type&&this.onOpen(),"close"===e.type)return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(e)})),"closed"!==this.readyState&&(this.polling=!1,this.emitReserved("pollComplete"),"open"===this.readyState&&this.poll())}doClose(){const e=()=>{this.write([{type:"close"}])};"open"===this.readyState?e():this.once("open",e)}write(e){this.writable=!1,((e,t)=>{const n=e.length,i=new Array(n);let r=0;e.forEach(((e,s)=>{Ne(e,!1,(e=>{i[s]=e,++r===n&&t(i.join(He))}))}))})(e,(e=>{this.doWrite(e,(()=>{this.writable=!0,this.emitReserved("drain")}))}))}uri(){const e=this.opts.secure?"https":"http",t=this.query||{};return!1!==this.opts.timestampRequests&&(t[this.opts.timestampParam]=at()),this.supportsBinary||t.sid||(t.b64=1),this.createUri(e,t)}request(e={}){return Object.assign(e,{xd:this.xd,cookieJar:this.cookieJar},this.opts),new pt(this.uri(),e)}doWrite(e,t){const n=this.request({method:"POST",data:e});n.on("success",t),n.on("error",((e,t)=>{this.onError("xhr post error",e,t)}))}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",((e,t)=>{this.onError("xhr poll error",e,t)})),this.pollXhr=e}}},bt=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,wt=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function _t(e){if(e.length>2e3)throw"URI too long";const t=e,n=e.indexOf("["),i=e.indexOf("]");-1!=n&&-1!=i&&(e=e.substring(0,n)+e.substring(n,i).replace(/:/g,";")+e.substring(i,e.length));let r=bt.exec(e||""),s={},o=14;for(;o--;)s[wt[o]]=r[o]||"";return-1!=n&&-1!=i&&(s.source=t,s.host=s.host.substring(1,s.host.length-1).replace(/;/g,":"),s.authority=s.authority.replace("[","").replace("]","").replace(/;/g,":"),s.ipv6uri=!0),s.pathNames=function(e,t){const n=t.replace(/\/{2,9}/g,"/").split("/");return"/"!=t.slice(0,1)&&0!==t.length||n.splice(0,1),"/"==t.slice(-1)&&n.splice(n.length-1,1),n}(0,s.path),s.queryKey=function(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,(function(e,t,i){t&&(n[t]=i)})),n}(0,s.query),s}class kt extends Ye{constructor(e,t={}){super(),this.binaryType="arraybuffer",this.writeBuffer=[],e&&"object"==typeof e&&(t=e,e=null),e?(e=_t(e),t.hostname=e.host,t.secure="https"===e.protocol||"wss"===e.protocol,t.port=e.port,e.query&&(t.query=e.query)):t.host&&(t.hostname=_t(t.host).host),Ze(this,t),this.secure=null!=t.secure?t.secure:"undefined"!=typeof location&&"https:"===location.protocol,t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||("undefined"!=typeof location?location.hostname:"localhost"),this.port=t.port||("undefined"!=typeof location&&location.port?location.port:this.secure?"443":"80"),this.transports=t.transports||["polling","websocket","webtransport"],this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},t),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),"string"==typeof this.opts.query&&(this.opts.query=function(e){let t={},n=e.split("&");for(let e=0,i=n.length;e{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this.beforeunloadEventListener,!1)),"localhost"!==this.hostname&&(this.offlineEventListener=()=>{this.onClose("transport close",{description:"network connection lost"})},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(e){const t=Object.assign({},this.opts.query);t.EIO=4,t.transport=e,this.id&&(t.sid=this.id);const n=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new yt[e](n)}open(){let e;if(this.opts.rememberUpgrade&&kt.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket"))e="websocket";else{if(0===this.transports.length)return void this.setTimeoutFn((()=>{this.emitReserved("error","No transports available")}),0);e=this.transports[0]}this.readyState="opening";try{e=this.createTransport(e)}catch(e){return this.transports.shift(),void this.open()}e.open(),this.setTransport(e)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",(e=>this.onClose("transport close",e)))}probe(e){let t=this.createTransport(e),n=!1;kt.priorWebsocketSuccess=!1;const i=()=>{n||(t.send([{type:"ping",data:"probe"}]),t.once("packet",(e=>{if(!n)if("pong"===e.type&&"probe"===e.data){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;kt.priorWebsocketSuccess="websocket"===t.name,this.transport.pause((()=>{n||"closed"!==this.readyState&&(l(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())}))}else{const e=new Error("probe error");e.transport=t.name,this.emitReserved("upgradeError",e)}})))};function r(){n||(n=!0,l(),t.close(),t=null)}const s=e=>{const n=new Error("probe error: "+e);n.transport=t.name,r(),this.emitReserved("upgradeError",n)};function o(){s("transport closed")}function a(){s("socket closed")}function c(e){t&&e.name!==t.name&&r()}const l=()=>{t.removeListener("open",i),t.removeListener("error",s),t.removeListener("close",o),this.off("close",a),this.off("upgrading",c)};t.once("open",i),t.once("error",s),t.once("close",o),this.once("close",a),this.once("upgrading",c),-1!==this.upgrades.indexOf("webtransport")&&"webtransport"!==e?this.setTimeoutFn((()=>{n||t.open()}),200):t.open()}onOpen(){if(this.readyState="open",kt.priorWebsocketSuccess="websocket"===this.transport.name,this.emitReserved("open"),this.flush(),"open"===this.readyState&&this.opts.upgrade){let e=0;const t=this.upgrades.length;for(;e{this.onClose("ping timeout")}),this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,0===this.writeBuffer.length?this.emitReserved("drain"):this.flush()}flush(){if("closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this.getWritablePackets();this.transport.send(e),this.prevBufferLen=e.length,this.emitReserved("flush")}}getWritablePackets(){if(!(this.maxPayload&&"polling"===this.transport.name&&this.writeBuffer.length>1))return this.writeBuffer;let e=1;for(let n=0;n=57344?n+=3:(i++,n+=4);return n}(t):Math.ceil(1.33*(t.byteLength||t.size))),n>0&&e>this.maxPayload)return this.writeBuffer.slice(0,n);e+=2}var t;return this.writeBuffer}write(e,t,n){return this.sendPacket("message",e,t,n),this}send(e,t,n){return this.sendPacket("message",e,t,n),this}sendPacket(e,t,n,i){if("function"==typeof t&&(i=t,t=void 0),"function"==typeof n&&(i=n,n=null),"closing"===this.readyState||"closed"===this.readyState)return;(n=n||{}).compress=!1!==n.compress;const r={type:e,data:t,options:n};this.emitReserved("packetCreate",r),this.writeBuffer.push(r),i&&this.once("flush",i),this.flush()}close(){const e=()=>{this.onClose("forced close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},n=()=>{this.once("upgrade",t),this.once("upgradeError",t)};return"opening"!==this.readyState&&"open"!==this.readyState||(this.readyState="closing",this.writeBuffer.length?this.once("drain",(()=>{this.upgrading?n():e()})):this.upgrading?n():e()),this}onError(e){kt.priorWebsocketSuccess=!1,this.emitReserved("error",e),this.onClose("transport error",e)}onClose(e,t){"opening"!==this.readyState&&"open"!==this.readyState&&"closing"!==this.readyState||(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),"function"==typeof removeEventListener&&(removeEventListener("beforeunload",this.beforeunloadEventListener,!1),removeEventListener("offline",this.offlineEventListener,!1)),this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(e){const t=[];let n=0;const i=e.length;for(;n"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer)(e))||St&&e instanceof Blob||At&&e instanceof File}function Lt(e,t){if(!e||"object"!=typeof e)return!1;if(Array.isArray(e)){for(let t=0,n=e.length;t=0&&e.num{delete this.acks[e];for(let t=0;t{this.io.clearTimeoutFn(r),t.apply(this,[null,...e])}}emitWithAck(e,...t){const n=void 0!==this.flags.timeout||void 0!==this._opts.ackTimeout;return new Promise(((i,r)=>{t.push(((e,t)=>n?e?r(e):i(t):i(e))),this.emit(e,...t)}))}_addToQueue(e){let t;"function"==typeof e[e.length-1]&&(t=e.pop());const n={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push(((e,...i)=>{if(n===this._queue[0])return null!==e?n.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(e)):(this._queue.shift(),t&&t(null,...i)),n.pending=!1,this._drainQueue()})),this._queue.push(n),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||0===this._queue.length)return;const t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){"function"==typeof this.auth?this.auth((e=>{this._sendConnectPacket(e)})):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:It.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t)}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case It.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case It.EVENT:case It.BINARY_EVENT:this.onevent(e);break;case It.ACK:case It.BINARY_ACK:this.onack(e);break;case It.DISCONNECT:this.ondisconnect();break;case It.CONNECT_ERROR:this.destroy();const t=new Error(e.data.message);t.data=e.data.data,this.emitReserved("connect_error",t)}}onevent(e){const t=e.data||[];null!=e.id&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const t=this._anyListeners.slice();for(const n of t)n.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&"string"==typeof e[e.length-1]&&(this._lastOffset=e[e.length-1])}ack(e){const t=this;let n=!1;return function(...i){n||(n=!0,t.packet({type:It.ACK,id:e,data:i}))}}onack(e){const t=this.acks[e.id];"function"==typeof t&&(t.apply(this,e.data),delete this.acks[e.id])}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach((e=>this.emitEvent(e))),this.receiveBuffer=[],this.sendBuffer.forEach((e=>{this.notifyOutgoingListeners(e),this.packet(e)})),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach((e=>e())),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:It.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const t=this._anyListeners;for(let n=0;n0&&e.jitter<=1?e.jitter:0,this.attempts=0}Ht.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=0==(1&Math.floor(10*t))?e-n:e+n}return 0|Math.min(e,this.max)},Ht.prototype.reset=function(){this.attempts=0},Ht.prototype.setMin=function(e){this.ms=e},Ht.prototype.setMax=function(e){this.max=e},Ht.prototype.setJitter=function(e){this.jitter=e};class Ft extends Ye{constructor(t,n){var i;super(),this.nsps={},this.subs=[],t&&"object"==typeof t&&(n=t,t=void 0),(n=n||{}).path=n.path||"/socket.io",this.opts=n,Ze(this,n),this.reconnection(!1!==n.reconnection),this.reconnectionAttempts(n.reconnectionAttempts||1/0),this.reconnectionDelay(n.reconnectionDelay||1e3),this.reconnectionDelayMax(n.reconnectionDelayMax||5e3),this.randomizationFactor(null!==(i=n.randomizationFactor)&&void 0!==i?i:.5),this.backoff=new Ht({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==n.timeout?2e4:n.timeout),this._readyState="closed",this.uri=t;const r=n.parser||e;this.encoder=new r.Encoder,this.decoder=new r.Decoder,this._autoConnect=!1!==n.autoConnect,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,this):this._reconnection}reconnectionAttempts(e){return void 0===e?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return void 0===e?this._reconnectionDelay:(this._reconnectionDelay=e,null===(t=this.backoff)||void 0===t||t.setMin(e),this)}randomizationFactor(e){var t;return void 0===e?this._randomizationFactor:(this._randomizationFactor=e,null===(t=this.backoff)||void 0===t||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return void 0===e?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,null===(t=this.backoff)||void 0===t||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new kt(this.uri,this.opts);const t=this.engine,n=this;this._readyState="opening",this.skipReconnect=!1;const i=Dt(t,"open",(function(){n.onopen(),e&&e()})),r=t=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",t),e?e(t):this.maybeReconnectOnOpen()},s=Dt(t,"error",r);if(!1!==this._timeout){const e=this._timeout,n=this.setTimeoutFn((()=>{i(),r(new Error("timeout")),t.close()}),e);this.opts.autoUnref&&n.unref(),this.subs.push((()=>{this.clearTimeoutFn(n)}))}return this.subs.push(i),this.subs.push(s),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(Dt(e,"ping",this.onping.bind(this)),Dt(e,"data",this.ondata.bind(this)),Dt(e,"error",this.onerror.bind(this)),Dt(e,"close",this.onclose.bind(this)),Dt(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(e){this.onclose("parse error",e)}}ondecoded(e){mt((()=>{this.emitReserved("packet",e)}),this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let n=this.nsps[e];return n?this._autoConnect&&!n.active&&n.connect():(n=new zt(this,e,t),this.nsps[e]=n),n}_destroy(e){const t=Object.keys(this.nsps);for(const e of t)if(this.nsps[e].active)return;this._close()}_packet(e){const t=this.encoder.encode(e);for(let n=0;ne())),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close"),this.engine&&this.engine.close()}disconnect(){return this._close()}onclose(e,t){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const t=this.backoff.duration();this._reconnecting=!0;const n=this.setTimeoutFn((()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),e.skipReconnect||e.open((t=>{t?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",t)):e.onreconnect()})))}),t);this.opts.autoUnref&&n.unref(),this.subs.push((()=>{this.clearTimeoutFn(n)}))}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const Vt={};function Wt(e,t){"object"==typeof e&&(t=e,e=void 0);const n=function(e,t="",n){let i=e;n=n||"undefined"!=typeof location&&location,null==e&&(e=n.protocol+"//"+n.host),"string"==typeof e&&("/"===e.charAt(0)&&(e="/"===e.charAt(1)?n.protocol+e:n.host+e),/^(https?|wss?):\/\//.test(e)||(e=void 0!==n?n.protocol+"//"+e:"https://"+e),i=_t(e)),i.port||(/^(http|ws)$/.test(i.protocol)?i.port="80":/^(http|ws)s$/.test(i.protocol)&&(i.port="443")),i.path=i.path||"/";const r=-1!==i.host.indexOf(":")?"["+i.host+"]":i.host;return i.id=i.protocol+"://"+r+":"+i.port+t,i.href=i.protocol+"://"+r+(n&&n.port===i.port?"":":"+i.port),i}(e,(t=t||{}).path||"/socket.io"),i=n.source,r=n.id,s=n.path,o=Vt[r]&&s in Vt[r].nsps;let a;return t.forceNew||t["force new connection"]||!1===t.multiplex||o?a=new Ft(i,t):(Vt[r]||(Vt[r]=new Ft(i,t)),a=Vt[r]),n.query&&!t.query&&(t.query=n.queryKey),a.socket(n.path,t)}Object.assign(Wt,{Manager:Ft,Socket:zt,io:Wt,connect:Wt}),function(){var e,n=document.getElementsByClassName("user");new S([document.querySelector("#open-sidebar"),document.querySelector(".c-hidden-btn")]).addEventListener("click",(function(e){e.preventDefault();var t=document.querySelector(".wrapper");t.classList.toggle("open"),t.classList.remove("open-chat")})),document.querySelector(".s-overlay").addEventListener("click",(function(e){e.preventDefault(),document.querySelector(".wrapper").classList.toggle("open")})),function(e){new S(e).addEventListener("click",(function(t){var n=this,i=n.querySelector(".show-menu"),r=document.querySelector(".u-overlay");if(i.hasAttribute("show"))return i.removeAttribute("show"),_(i,200,(function(){i.style.display="none",n.ih=!1})),void(r.style="");1!=this.ih&&(r.style.display="block",h(e,(function(e){e.querySelector(".show-menu").hasAttribute("show")&&e.event()})),this.ih=!0,this.event=function(){i.removeAttribute("show"),_(i,200,(function(){i.style.display="none",n.ih=!1})),r.style=""},i.setAttribute("show",""),i.style.display="block",i.style.opacity=0,function(e,t,n=function(){}){w({step:function(t){e.style.opacity=t},duration:200,callback:n})}(i))}))}(n),function(e){document.getElementById("header");var t=document.querySelector(".inner"),n=window.pageYOffset,i=document.querySelector(".c-hidden-btn"),r=window.pageYOffset;window.addEventListener("scroll",(function(){if(h(e,(function(e){e.querySelector(".show-menu").hasAttribute("show")&&e.event()})),!document.querySelector(".chapter-imgs.single")){var i=window.pageYOffset;t.style.top=n>i?"0":"-60px",n=i}})),window.addEventListener("scroll",(function(){if(!document.querySelector(".chapter-imgs.single")){var e=window.pageYOffset;i.style.bottom=r>e?"0":"-40px",r=e}}))}(n),$()({url:"/ajax/get-auth",method:"get",dataType:"json"}).then((function(e){let n=e.data;if(0!=n){var i=document.getElementsByClassName("show-menu")[0],r=(window.location.href,"");if(1==n.level&&(r='
  • Admin Cpanel
  • '),""!=n.avatar){var s=document.getElementsByClassName("user-avatar")[0];s.src=n.avatar,s.style.padding=0}document.querySelector(".s-register").innerHTML='Logout',document.querySelector(".s-user").innerHTML=`${n.nickname}${n.nickname}`,i.innerHTML=`
  • ${n.nickname}
  • \n ${r}\n
  • Logout
  • `,document.getElementById("fav")}})),document.querySelector(".sidebar li.genres a").addEventListener("click",(function(e){e.preventDefault();var t=document.querySelector(".header .dropdown").cloneNode(!0),n=this.closest("li");n.querySelector(".dropdown")||n.appendChild(t),n.classList.toggle("open")})),new S([document.querySelector(".btns .search-btn a"),document.getElementById("mobi-search")]).addEventListener("click",(function(e){e.preventDefault(),document.querySelector(".wrapper").classList.remove("open"),document.querySelector(".sb-overlay").style.display="block",document.querySelector(".search-box .inner").focus()})),document.querySelector(".sb-overlay").addEventListener("click",(function(e){e.target!=this&&this.querySelector(".overflow")!=e.target||(this.style.display="none")})),document.querySelector(".sb-overlay .s-top a").addEventListener("click",(function(e){e.preventDefault(),this.closest(".sb-overlay").style.display="none"})),document.querySelector(".search-box .search-content input").addEventListener("input",(function(){clearTimeout(e);var t=this,n=t.closest(".search-box"),i=n.querySelector(".loading");t.value.length>2&&(e=setTimeout((function(){i.querySelector("svg")||(i.innerHTML=ie),$()({url:"/ajax/search-manga?query="+t.value,method:"get",responseType:"json"}).then((function(e){let t=e.data||[];var i="";t.forEach((function(e){let{manga_cover_img:t,manga_name:n,manga_id:r,chapter_number:s}=e,o=v(n),c=`/${a(n)}-c${r}`;s=s?`Chapter ${s}`:"Updating...",i+=`
  • \n \n ${o}\n
    \n
    ${n}
    \n
    ${s}
    \n
    \n
    \n
  • `})),n.querySelector(".search-result ul").innerHTML=i})).then((function(){n.querySelector(".loading").innerHTML=""}))}),500))})),document.querySelector(".search-content form").addEventListener("submit",(function(e){e.preventDefault();var t=this.querySelector("input").value;Ae.push("/search?query="+encodeURIComponent(t))})),h(document.querySelectorAll(".search-input"),(function(e){e.closest(".search-box").querySelector(".search-results > .inner")}));var i=!1;new S(document.querySelectorAll(".i-chat")).addEventListener("click",(function(e){e.preventDefault();var n=document.querySelector(".wrapper");n.classList.add("open-chat"),n.classList.remove("open"),1!=i&&(i=!0,function(){var e=Wt.connect(t._SOCKET),n=document.getElementById("message"),i=document.getElementById("handle"),r=(document.getElementById("send"),document.getElementById("output")),s=document.getElementById("feedback");document.getElementById("chat-window"),document.getElementById("send-chat").addEventListener("submit",(function(t){t.preventDefault(),e.emit("chat",{message:n.value,handle:i.value}),n.value=""})),n.addEventListener("keypress",(function(){""!=i.value?e.emit("typing",i.value):alert("Please Enter your name first!")})),e.on("load",(function(e){var t="";e.forEach((function(e){let n="";1==e.level&&(n=' class="pri"'),t+=`

    ${e.username}: ${e.content}( ${F(Date.parse(e.create_on))} )

    `})),r.innerHTML+=t})),e.on("chat",(function(e){let t="";1==e.level&&(t=' class="pri"');var n=f.createStr(`

    ${e.handle}: ${e.message}( ${F(Date.parse(e.create_on))} )

    `)[0];s.innerHTML="",r.insertBefore(n,r.firstChild)})),document.querySelector("#join").addEventListener("click",(function(){e.emit("join",document.querySelector("#handle").value)})),e.on("alert",(function(e){alert(e.message)})),e.on("joinSuccess",(function(e){document.querySelector("#handle").classList.add("joinSuccess"),e.username&&(i.value=e.username)}));const o=document.getElementById("chat-window");o.addEventListener("scroll",(function(){if(o.scrollTop+o.clientHeight>=o.scrollHeight){var e=this;if(1==e.flag)return;e.flag=!0;var t=new FormData;t.append("id",r.lastChild.id),$()({url:"/ajax/get-chat",method:"post",data:t}).then((function(e){let t="";h(e.data,(function(e){let n="";1==e.level&&(n=' class="pri"'),t+=`

    ${e.username}: ${e.content}( ${F(Date.parse(e.create_on))} )

    `})),console.log(e),console.log(t),r.innerHTML+=t})).finally((function(){e.flag=!1}))}}))}())})),document.querySelector(".chat-box .hide-chat").addEventListener("click",(function(e){e.preventDefault(),document.querySelector(".wrapper").classList.remove("open-chat")}))}()})()})();