trackkun-dom 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +1 -1
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1 +1 @@
1
- (function(U,F){typeof exports=="object"&&typeof module<"u"?F(exports):typeof define=="function"&&define.amd?define(["exports"],F):(U=typeof globalThis<"u"?globalThis:U||self,F(U._trackkun_={}))})(this,function(U){"use strict";function F(a){let e=!1;return new Promise((t,r)=>{Promise.all(a.map(async n=>{const l=await n;!e&&l&&(e=!0,t(l))})).then(()=>{e||t(void 0)})})}function oe(a,{removeTrailingSlash:e=!0}={}){if(!a)return;const t=e&&a.endsWith("/")?a.slice(0,-1):a;try{return new URL(t)}catch{return}}function x(a){var e,t;if(!(!a||typeof a!="string"))return a.startsWith("http://")||a.startsWith("https://")?(e=oe(a))==null?void 0:e.pathname:a.startsWith("//")?(t=oe(`https:${a}`))==null?void 0:t.pathname:a}async function I(a,e,t){const r=await t(()=>{a=0});if(r!==void 0)return r;if(!(a<=0))return await new Promise(n=>{setTimeout(async()=>{const l=await I(a-1,e,t);n(l)},e)})}async function M(a,e,t=0){var r,n;const l=(r=e.root)!=null?r:document.documentElement,i=(n=e.timeoutMs)!=null?n:1e4;return I(e.lazy===!0?i/50:0,50,()=>{var o;const s=e.all===!0?Array.from(l.querySelectorAll(a)):(o=l.querySelector(a))!=null?o:void 0;return(e.all?!(s!=null&&s.length):!s)?void 0:s})}const Lt={text:Et,attr:At,"attr-contain":kt,value:zt,row:qt};function f(a,e={}){if(!a)return;const{root:t=document.documentElement,returnAll:r,preProcess:n}=e,l=ye(a);if(l.length>1){for(let p=0;p<l.length;p+=1){const d=f(l[p],e);if(d!=null&&d.length)return d}return}const[i,o]=a.split("|");if(!o)return;const s=(o!=null&&o.startsWith("[")&&o.endsWith("]")?o.substring(1,o.length-1).split(","):[o]).map(p=>{const d=p.indexOf(":"),g=d!==-1;return{action:g?p.substring(0,d):p,param:g?p.substring(d+1):""}}),c=i?Array.from(t.querySelectorAll(i)):[t];if(!c.length)return r?[]:void 0;n&&n(c);const u=[];for(const p of c)for(const d of s){const g=Lt[d.action],h=g(p,d.param);if(h){if(r){u.push(h);break}return h}}return r?u:void 0}function Et(a){return Array.from(a.childNodes).filter(e=>e.nodeType===3).map(e=>V(e.textContent)).filter(Boolean).join(" ").trim()||V(a.textContent)}function At(a,e){return V(a.getAttribute(e))}function kt(a,e){let t=a.getAttribute(e);if(!t){const r=a.getAttributeNames().find(n=>n.includes(e));r&&(t=a.getAttribute(r))}return V(t)}function ye(a){const e=[],t=a.split("||").map(r=>r.trim()).filter(Boolean);return t.forEach((r,n)=>{if(r.includes("|")){e.push(r);return}const l=t[n+1];l&&(t[n+1]=`${r},${l}`)}),e}function zt(a){return a.value}function qt(a,e){var t,r,n,l;if(!e)return;const i=(t=V(a.textContent))==null?void 0:t.toLowerCase(),o=e.toLowerCase();if(!(i!==o&&i!==`${o}:`))return V((l=(r=a.nextElementSibling)==null?void 0:r.textContent)!=null?l:(n=a.nextSibling)==null?void 0:n.textContent)}function V(a){if(a)return a?.replace(/(\n|\t)/g," ").trim()||void 0}var Wt=(a=>(a[a.reading=1]="reading",a[a.paused=2]="paused",a[a.plan=3]="plan",a[a.completed=4]="completed",a[a.dropped=5]="dropped",a[a.deleted=6]="deleted",a))(Wt||{}),se=(a=>(a.id="id",a.name="name",a.slug="slug",a))(se||{}),ce=(a=>(a.blank="about:blank",a.title="meta.title",a.reader="meta.reader",a))(ce||{}),Ut=(a=>(a[a.string=1]="string",a[a.number=2]="number",a[a.bool=3]="bool",a[a.selection=4]="selection",a))(Ut||{}),Ft=(a=>(a[a.pending=0]="pending",a[a.completed=1]="completed",a[a.offline=2]="offline",a[a.incompat=3]="incompat",a))(Ft||{});const Vt=/(vol(ume)?|season)(\s*|-|\.)(\d+)/i,Jt=/(ch(ap(t(er)?|\.)?|\.)?|^#|episode\.?)(\s*|-)(\d+([_-~,.]\d+)?)/i,Ht=/\d+([_-~,.]\d+)?/,Gt=/[_-~,]/;function E(a){var e;if(!a||!a)return;if(!isNaN(+a))return{chap:+a};const t=a.match(Vt),r=t!=null&&t[0]?a.replace(t[0],"").trim():a,n=r.match(Jt),l=r.match(Ht),i=(e=n?.[6])!=null?e:l?.[0];if(!i)return;const o=+i.replace(Gt,".");if(isNaN(o))return;const s=t?.[4];return{vol:s&&!isNaN(+s)?+s:void 0,chap:o}}function A(a){return a.sort((e,t)=>e.vol===void 0||t.vol===void 0?t.chap-e.chap:t.vol-e.vol||t.chap-e.chap),Xt(a)}function Xt(a){var e;const t={};for(let r=a.length-1;r>=0;r--){const n=a[r],l=(e=n.lang)!=null?e:"";n.vol!==void 0?t[l]=n.vol:t[l]!==void 0&&(n.inferVol=t[l])}return a}const Qt=[{regex:/(sec|giây)/,seconds:1},{regex:/(min|phút)/,seconds:60},{regex:/(hour|giờ)/,seconds:3600},{regex:/(day|ngày)/,seconds:86400},{regex:/(week|tuần)/,seconds:604800},{regex:/(month|tháng)/,seconds:2592e3},{regex:/(year|năm)/,seconds:31536e3}];function we(a){const e=a?.toLowerCase();if(!e||e.includes("now"))return Date.now();if(e.includes("yesterday"))return Date.now()-864e5;const t=new Date(e);if(t instanceof Date){const l=t.valueOf();if(!isNaN(l))return t.getHours()===0&&t.getMinutes()===0?Math.min(Date.now(),l+432e5):l}const r=Qt.find(l=>l.regex.test(e));if(!r)return;const n=e.split(" ").filter(Boolean);for(let l=0;l<n.length;l++){const i=n[l],o=i==="a"||i==="an"?1:+i;if(!o)continue;if(o<0)return;const s=Date.now()-o*r.seconds*1e3;return s>0?s:void 0}}function ue(a,e=location.origin){if(!a)return;const t=new URL(a.startsWith("//")?`${location.protocol}${a}`:a,location.origin+location.pathname).toString();return t.startsWith(e)?t.replace(e,""):t}function be(a,e){if(!a)return"/";const t=a.replace("{titleSlug}",e),r=t.endsWith("/")?t:t+"/";return r.startsWith("/")?r:"/"+r}var Yt=Object.defineProperty,$e=Object.getOwnPropertySymbols,Zt=Object.prototype.hasOwnProperty,Kt=Object.prototype.propertyIsEnumerable,Re=(a,e,t)=>e in a?Yt(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,ea=(a,e)=>{for(var t in e||(e={}))Zt.call(e,t)&&Re(a,t,e[t]);if($e)for(var t of $e(e))Kt.call(e,t)&&Re(a,t,e[t]);return a};function ta(a,e){var t,r;const n=[...e],l=[];let i=-1,o=-1;for(let c=0;c<a.length&&!(!n.length&&c>=10);c++){const u=ea({},a[c]),p=n.findIndex(h=>h.slug===u.slug&&h.name===u.name),d=p===-1?void 0:n.splice(p,1)[0],g=!d||((t=d.chapters[0])==null?void 0:t.chap)!==((r=u.chapters[0])==null?void 0:r.chap);p!==-1&&(o=c),g&&(i=c,u.changed=!0),l.push(u)}if(i===-1)return[];if(n.length&&n.length!==e.length){const c=Math.max(10,o+1);l.splice(c);for(let u=o+1;u<l.length;u++)l[u].changed=!1;return l}const s=Math.min(Math.max(i+1,10),Math.max(o+1,100));return l.slice(0,s)}var aa=Object.defineProperty,ra=Object.defineProperties,na=Object.getOwnPropertyDescriptors,Oe=Object.getOwnPropertySymbols,la=Object.prototype.hasOwnProperty,ia=Object.prototype.propertyIsEnumerable,Pe=(a,e,t)=>e in a?aa(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,oa=(a,e)=>{for(var t in e||(e={}))la.call(e,t)&&Pe(a,t,e[t]);if(Oe)for(var t of Oe(e))ia.call(e,t)&&Pe(a,t,e[t]);return a},sa=(a,e)=>ra(a,na(e));function ca(a,e){const t={};return a.forEach(r=>{const n=r.chapters.reduce((l,i)=>{const o=i.lang||e||"";return l[o]||(l[o]=[]),l[o].push(i),l},{});Object.entries(n).forEach(([l,i])=>{const o=`${r.slug}:${l}`;t[o]?(t[o].chapters.push(...i),A(t[o].chapters)):t[o]=sa(oa({},r),{lang:l===""?void 0:l,chapters:i})})}),Object.values(t)}var O=(a=>(a.title="title",a.reader="reader",a.releases="releases",a.chapters="chapters",a.search="search",a))(O||{});class pe{constructor(e){this.methodsMap={[O.title]:()=>this.getRawTitleData(),[O.reader]:()=>this.getRawReaderData(),[O.releases]:()=>this.getRawReleasesData(),[O.search]:()=>this.getRawSearchData(),[O.chapters]:()=>this.getRawChaptersData()},this.spec=e.spec,this.siteMeta=e.siteMeta,this.tags=e.tags,this.context=e.context}async getRawSearchData(){throw new Error("Unimplemented")}async getRawPageByType(e,t=!1){const r=await this.methodsMap[e]();if(t&&!r)return;const n=location.origin+location.pathname;return{type:e,is404:pa(this.spec),specId:this.spec.id,siteName:f(this.spec.name),url:n,data:r,spec:this.spec,context:this.context}}resolveReaderSlug(e,t,r){return t.startsWith(e)?t.replace(e,""):t}resolveTitleSlug(e){var t;if(typeof e!="string")return;const r=(t=x(e))==null?void 0:t.split("/").filter(Boolean);return!r||!r.length?e:r[r.length-1]}finalizeRawReleasesData(e){var t,r,n;const l=(r=(t=this.spec.releases)==null?void 0:t.title)!=null&&r.lang?this.siteMeta.defaultLang:void 0,i=ca(e.rawReleases,l);if(i.length)return{rawReleases:(n=this.context)!=null&&n.oldRawReleases?ta(i,this.context.oldRawReleases):i}}getTagIdsFromNames(e){var t;if(!(e!=null&&e.length))return;const r=(t=this.normalizedTagsMap)!=null?t:this.normalizedTagsMap=ua(this.tags),n=e.map(l=>r[de(l)]).filter(Boolean);return n.length===0?void 0:Array.from(new Set(n)).sort((l,i)=>l-i)}}function ua(a){const e={};return a.forEach(({id:t,name:r,altNames:n})=>{e[de(r)]=t,n&&n.forEach(l=>{e[de(l)]=t})}),e}function de(a){const e=a.toLowerCase().replaceAll(" ","").replaceAll("-","");return e[e.length-1]==="s"?e.substring(0,e.length-1):e}function pa(a){return a[404]&&document.querySelector(a[404])?!0:document.title.toLowerCase().includes("not found")}var da=Object.defineProperty,ga=Object.defineProperties,ha=Object.getOwnPropertyDescriptors,Q=Object.getOwnPropertySymbols,Se=Object.prototype.hasOwnProperty,je=Object.prototype.propertyIsEnumerable,De=(a,e,t)=>e in a?da(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,B=(a,e)=>{for(var t in e||(e={}))Se.call(e,t)&&De(a,t,e[t]);if(Q)for(var t of Q(e))je.call(e,t)&&De(a,t,e[t]);return a},k=(a,e)=>ga(a,ha(e)),Ce=(a,e)=>{var t={};for(var r in a)Se.call(a,r)&&e.indexOf(r)<0&&(t[r]=a[r]);if(a!=null&&Q)for(var r of Q(a))e.indexOf(r)<0&&je.call(a,r)&&(t[r]=a[r]);return t};class S extends pe{async getRawReleasesData(){var e,t;if(!((t=(e=this.spec)==null?void 0:e.releases)!=null&&t.title))return;const r=this.spec.releases.title,{chapter:n}=r,l=Ce(r,["chapter"]),i=await M(l.sel,{lazy:!0,all:!0});if(!(i!=null&&i.length))return;const o=i.slice(0,100).map(c=>{var u;const p=f(l.url,{root:c}),d=x(p),g=f(l.name,{root:c}),h=f(l.at,{root:c});if(!(!d||!g))return{titleEl:c,id:f(l.id,{root:c}),path:d,name:g,lang:(u=f(l.lang,{root:c}))==null?void 0:u.toLowerCase(),at:h?we(h):void 0}}).filter(Boolean);if(!o.length)return;const s=await Promise.all(o.map(async c=>{var u;const p=c,{path:d,titleEl:g,lang:h,at:y}=p,v=Ce(p,["path","titleEl","lang","at"]),$=this.resolveTitleSlug(d),R=(u=await this.getChapters(n,{root:g,titleSlug:$}))!=null?u:[];return B({slug:$,chapters:h||y?R.map(b=>{var P,m;return k(B({},b),{lang:(P=b.lang)!=null?P:h,ts:(m=b.ts)!=null?m:y})}):R},v)}));return this.finalizeRawReleasesData({rawReleases:s})}async getRawTitleData(){var e,t,r;const n=this.spec.title;if(!n||n.sel&&!await M(n.sel,{lazy:!!n.lazy}))return;const l=f(n.name);if(!l){await new Promise(u=>setTimeout(u,9e4));return}const i=this.resolveTitleSlug(location.pathname);if(!i)return;let o=(e=f(n.tags,{returnAll:!0}))!=null?e:[];o.length===1&&(o=o[0].split(",").map(u=>u.trim()).filter(Boolean));const s=f(n.type),c=(t=f(n.langs,{returnAll:!0}))==null?void 0:t.map(u=>u.toLowerCase());return{id:f(n.id),url:location.origin+location.pathname,slug:i,name:l,langs:c!=null&&c.length?c:n.langs&&this.siteMeta.defaultLang?[this.siteMeta.defaultLang]:void 0,tags:this.getTagIdsFromNames([...o??[],...s?[s]:[]]),chapters:(r=await this.getChapters(n.chapter,{lazy:!0,titleSlug:i}))!=null?r:[],img:ue(f(n.img))}}async getRawReaderData(){var e,t,r,n,l,i,o;const{spec:s,siteMeta:c}=this;if(!(s!=null&&s.reader)||s.generic&&!await S.isReaderPage(s.reader))return;const u=s.reader.imgs;if(!(!u||await S.verifyImgsLocator(u)))return;const p=s.reader.title,d=document.querySelector(p.sel);if(!d)return;const g=f(p.name,{root:d}),h=f(p.url,{root:d}),y=this.resolveTitleSlug(h),v=f(p.img,{root:d});if(!g||!h||!y)return;const $=!!((e=this.context)!=null&&e.disableLazyChapters),R=(r=await this.getChapters((t=s.reader)==null?void 0:t.chapter,{titleSlug:y,lazy:!$,timeoutMs:4e4}))!=null?r:[],b=(n=f(s.reader.label))==null?void 0:n.toLowerCase().replace(g.toLowerCase(),"");if(!b)return;const{vol:P,chap:m=0}=E(b)||{},j=be(c.readerBase,y),T=c.readerBase.split("/").indexOf("{lang}"),D=T!==-1?(l=location.pathname.substring(1).split("/")[T])==null?void 0:l.toLowerCase():void 0,w=D?j.replace("{lang}",D):j,C=(o=D??((i=f(s.reader.lang))==null?void 0:i.toLowerCase()))!=null?o:s.reader.lang?this.siteMeta.defaultLang:void 0;return this.finalizeRawReaderData({vol:P,chap:m,lang:C,slug:this.resolveReaderSlug(w,location.pathname,location.href),basePath:w,imgsLocator:s.reader.imgs,title:{id:f(p.id),url:h,slug:y,name:g,langs:C?[C]:void 0,img:ue(v),chapters:R,hasMoreChapters:!R.length&&$}},{prevSlug:this.findNeighborChapter({sel:s.reader.prev,basePath:w}),nextSlug:this.findNeighborChapter({sel:s.reader.next,basePath:w})})}async getRawChaptersData(){var e,t;const r=this.siteMeta.chapters;if(r===ce.blank)return;const n=r===ce.reader?(e=await this.getRawReaderData())==null?void 0:e.title:await this.getRawTitleData();if(!n)return;const l=(t=this.context)==null?void 0:t.lang,{chapters:i}=n,o=l?i.filter(s=>!s.lang||s.lang===l):i;return{chapters:o,title:k(B({},n),{chapters:[]}),hasMore:!1,asc:!1,total:o.length}}async getRawSearchData(){var e;const t=(e=this.spec.search)==null?void 0:e.title;if(!t)return;const{chapter:r}=t,n=[];return await Promise.all(Array.from(document.querySelectorAll(t.sel)).map(async l=>{var i;const o=f(t.url,{root:l}),s=x(o),c=f(t.name,{root:l}),u=this.resolveTitleSlug(s);!s||!c||!u||n.push({slug:u,name:c,chapters:(i=await this.getChapters(r,{root:l,titleSlug:u}))!=null?i:[]})})),n.length?{rawReleases:n}:void 0}async getChapters(e,{root:t=document.documentElement,titleSlug:r="",lazy:n=!0,timeoutMs:l}){var i;if(!e)return;const o=[],s=await M(e.sel,{root:t,all:!0,lazy:n,timeoutMs:l});if(!(s!=null&&s.length))return o;const c=(s??[]).map(v=>({id:f(e.id,{root:v}),label:f(e.label,{root:v}),url:f(e.url,{root:v}),at:f(e.at,{root:v})})),u=c.map(({label:v})=>E(v)),p=(i=u[1])==null?void 0:i.chap;!u[0]&&(p===void 0||p<=1)&&(u[0]={chap:0});const{readerBase:d}=this.siteMeta,g=be(d,r),h=d.split("/").indexOf("{lang}"),y=h!==-1;return u.forEach((v,$)=>{var R,b;if(!v)return;const{id:P,url:m,at:j}=c[$],T=m?.startsWith("http")&&!m.startsWith(location.origin),D=T?m:x(m);if(!D)return;const w=!T&&y?(R=D?.substring(1).split("/")[h])==null?void 0:R.toLowerCase():void 0,C=T?D:this.resolveReaderSlug(w?g.replace("{lang}",w):g,D,m);o.push(k(B({},v),{id:P,slug:C,lang:w,ts:we(j)||((b=o[o.length+1])==null?void 0:b.ts)||Date.now()}))}),A(o)}static async isReaderPage(e){return!!e.sel&&!!await M(e.sel,{lazy:!!e.lazy})}static async verifyImgsLocator(e){const t=ye(e).map(r=>r.split("|")[0]).join(",");return!!await M(t,{lazy:!0})}findNeighborChapter({sel:e,basePath:t}){const r=f(e);if(!r||r.startsWith("#")||r.startsWith("/#"))return;const n=x(r);return n?this.resolveReaderSlug(t,n,r):void 0}finalizeRawReaderData(e,{prevSlug:t,nextSlug:r}={}){var n;const l=(n=e.title)==null?void 0:n.chapters;if(!(l!=null&&l.length)){const u=E(t),p=E(r);return!u&&!p?e:k(B({},e),{prev:u?k(B({},u),{slug:t}):void 0,next:p?k(B({},p),{slug:r}):void 0})}let i,o,s,c;for(let u=0;u<l.length&&!(i&&(!t||s)&&!r&&c);u++){const p=l[u];!i&&(e.slug==p.slug||e.chap===p.chap&&(e.vol===p.vol||e.vol===void 0))?(i=p,o=u):!s&&t===p.slug?s=p:!c&&r===p.slug&&(c=p)}return o!==void 0&&(s!=null||(s=l[o+1]),c!=null||(c=l[o-1])),k(B({},e),{inferVol:i?.inferVol,prev:s,next:c})}}class xe extends S{resolveTitleSlug(e){var t;return(t=x(e))==null?void 0:t.split("/").filter(Boolean)[1]}}xe.specId="bato";function va(){return Math.random().toString(16).slice(2)}async function fa({addListener:a,removeListener:e,transform:t,filter:r,handler:n,onTimeout:l,timeout:i,once:o}){return new Promise(s=>{a(p);const c=()=>o===!0&&e(p),u=i?setTimeout(()=>{c(),s(void 0),l?.()},i):void 0;async function p(d,...g){d=t?t(d):d,d!==void 0&&(!r||r(d,...g))&&(c(),s(d),n?.(d,...g),u&&clearTimeout(u))}})}var ma=Object.defineProperty,Te=Object.getOwnPropertySymbols,ya=Object.prototype.hasOwnProperty,wa=Object.prototype.propertyIsEnumerable,Me=(a,e,t)=>e in a?ma(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,ba=(a,e)=>{for(var t in e||(e={}))ya.call(e,t)&&Me(a,t,e[t]);if(Te)for(var t of Te(e))wa.call(e,t)&&Me(a,t,e[t]);return a};async function $a(a){const e=await fa(ba({addListener:t=>window.addEventListener("message",t),removeListener:t=>window.removeEventListener("message",t)},a));return e?.data}async function Ra(a){var e;const{receiverWindow:t,timeout:r,targetOrigin:n,event:l,args:i}=a,o={reqId:va(),event:l,args:i};(e=t||window)==null||e.postMessage(o,n??"*");const s=await $a({filter:c=>{var u;return((u=c?.data)==null?void 0:u.resId)===o.reqId},timeout:r??3e4,once:!0});return s?.result}const N={isAny:!0};function L(a,...e){return Ra({event:"tk:fetchResult",args:{baseUrl:a,segments:e}})}function Oa(a){if(a)try{return JSON.parse(a)}catch{return}}var Pa=Object.defineProperty,Sa=Object.defineProperties,ja=Object.getOwnPropertyDescriptors,_e=Object.getOwnPropertySymbols,Da=Object.prototype.hasOwnProperty,Ca=Object.prototype.propertyIsEnumerable,Ie=(a,e,t)=>e in a?Pa(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,Y=(a,e)=>{for(var t in e||(e={}))Da.call(e,t)&&Ie(a,t,e[t]);if(_e)for(var t of _e(e))Ca.call(e,t)&&Ie(a,t,e[t]);return a},Z=(a,e)=>Sa(a,ja(e));class Ne extends S{async getRawReleasesData(){let e=[];try{e=await(await fetch("https://api.comick.app/chapter?page=1&device-memory=8&order=hot&accept_erotic_content=true")).json()}catch{return}const t=[];return e.forEach(r=>{const{vol:n,chap:l,hid:i,lang:o,updated_at:s,md_comics:c}=r,u=typeof l=="string"&&!isNaN(+l)?+l:void 0;typeof u=="number"&&t.push({id:c.hid,slug:c.slug,name:c.title,chapters:[{slug:i,vol:typeof n=="string"&&!isNaN(+n)?+n:void 0,chap:u,lang:o,ts:new Date(s).valueOf()}]})}),super.finalizeRawReleasesData({rawReleases:t})}async getRawTitleData(){var e,t,r,n,l,i,o,s;const c=await super.getRawTitleData();if(!c)return c;const u=await L("https://api.comick.app/","comic",N,"chapters");if(!u)return c;const p=await xa(c.slug),d=Be(u),g=f("h1 ~ div.text-sm span:first-child|row:demographic"),h=g?(e=this.getTagIdsFromNames([g]))==null?void 0:e[0]:void 0;return h&&!((t=c.tags)!=null&&t.includes(h))&&((r=c.tags)==null||r.push(h),(n=c.tags)==null||n.sort((y,v)=>y-v)),Z(Y({},c),{img:(i=c.img)!=null?i:ue(f((l=this.spec.title)==null?void 0:l.img)),id:p,hasMoreChapters:(o=d?.hasMore)!=null?o:!1,chapters:(s=d?.chapters)!=null?s:[]})}async getRawReaderData(){var e,t,r,n,l,i,o;const s=await super.getRawReaderData();if(!s)return s;const c=await L("/_next/data/",N,"comic",N),u=(e=c?.comic)==null?void 0:e.hid,p=(n=(r=(t=c?.comic)==null?void 0:t.md_comic_md_genres)==null?void 0:r.map)==null?void 0:n.call(r,g=>{var h;return(h=g?.md_genre)==null?void 0:h.name}),d=(o=(i=(l=c?.comic)==null?void 0:l.md_covers)==null?void 0:i[0])==null?void 0:o.b2key;return Z(Y({},s),{title:Z(Y({},s.title),{id:u?u+"":void 0,tags:this.getTagIdsFromNames(p),img:typeof d=="string"?`https://meo.comick.pictures/${d}`:void 0})})}async getRawChaptersData(){var e;if(!((e=this.context)!=null&&e.rawId))return;const{rawId:t,lang:r="en",skip:n}=this.context,l=n?Math.floor(n/1e3)+1:void 0;try{const i=await fetch(`https://api.comick.app/comic/${t}/chapters?lang=${r}&limit=1000${l&&l>1?`&page=${l}`:""}`),o=Be(await i.json());return o?Z(Y({},o),{lang:r,asc:!1}):void 0}catch{return}}}Ne.specId="comick";function Be(a){var e;if(!Array.isArray(a?.chapters))return;const t=[];return a.chapters.forEach(r=>{const{vol:n,chap:l,hid:i,lang:o,updated_at:s}=r,c=typeof l=="string"&&!isNaN(+l)?+l:void 0;typeof c!="number"||t.some(u=>u.vol==n&&u.chap===c&&u.lang===o)||t.push({slug:i,vol:typeof n=="string"&&!isNaN(+n)?+n:void 0,chap:c,lang:o,ts:new Date(s).valueOf()})}),{chapters:A(t),total:(e=a.total)!=null?e:t.length,hasMore:a.total>a.limit}}async function xa(a){var e,t,r,n,l,i,o,s,c;const u=(e=document.querySelector("script#__NEXT_DATA__"))==null?void 0:e.textContent,p=u?Oa(u):void 0;if(((t=p?.query)==null?void 0:t.slug)===a)return(i=(l=(n=(r=p?.props)==null?void 0:r.pageProps)==null?void 0:n.comic)==null?void 0:l.hid)!=null?i:void 0;const d=await L("/_next/data/",N,"comic",a,"covers.json");return(c=(s=(o=d?.pageProps)==null?void 0:o.comic)==null?void 0:s.hid)!=null?c:void 0}var Ta=Object.defineProperty,Ma=Object.defineProperties,_a=Object.getOwnPropertyDescriptors,Le=Object.getOwnPropertySymbols,Ia=Object.prototype.hasOwnProperty,Na=Object.prototype.propertyIsEnumerable,Ee=(a,e,t)=>e in a?Ta(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,Ba=(a,e)=>{for(var t in e||(e={}))Ia.call(e,t)&&Ee(a,t,e[t]);if(Le)for(var t of Le(e))Na.call(e,t)&&Ee(a,t,e[t]);return a},La=(a,e)=>Ma(a,_a(e));class Ae extends S{async getRawReleasesData(){const e=await this.getVM();if(!e)return super.getRawReleasesData();const t=e.LatestJSON.slice(0,100).map(r=>{const n=+r.Chapter.substring(1)/10;return{slug:r.IndexName,name:r.SeriesName,chapters:[{chap:n,slug:`${r.IndexName}-chapter-${n}.html`,ts:new Date(r.Date).valueOf()}]}});return this.finalizeRawReleasesData({rawReleases:t})}async getRawTitleData(){const e=await super.getRawTitleData();return e&&La(Ba({},e),{chapters:ke(await this.getVM(),e.slug),hasMoreChapters:!1})}resolveReaderSlug(e,t){return super.resolveReaderSlug(e,t).replace(/-page-\d{1,3}\.html$/,".html")}async getRawReaderData(){var e;const t=await this.getVM();if(!t)return;const r=(e=document.querySelector(".ImageGallery img.img-fluid"))==null?void 0:e.getAttribute("ng-src"),n=t.IndexName,l=ze(t.CurChapter,n);return this.finalizeRawReaderData({chap:l.chap,slug:l.slug,imgs:Ea(t,r??void 0),basePath:"/"+this.siteMeta.readerBase.replace("{titleSlug}",n)+"/",title:{name:t.SeriesName,slug:n,url:`/${this.siteMeta.titleBase}/${n}`,chapters:ke(t,n),hasMoreChapters:!1}})}getVM(){return I(40,50,()=>{var e,t,r,n;return(n=(r=(t=(e=window.angular)==null?void 0:e.element)==null?void 0:t.call(e,document.documentElement))==null?void 0:r.scope())==null?void 0:n.vm})}}Ae.specId="manga4life";function ke(a,e){var t,r;return((r=(t=a?.Chapters)!=null?t:a?.CHAPTERS)!=null?r:[]).sort((n,l)=>l.Chapter-n.Chapter).map(n=>ze(n,e))}function ze(a,e){const t=+a.Chapter.substring(1)/10;return{slug:`${e}-chapter-${t}.html`,chap:t,ts:new Date(a.Date).valueOf()}}function Ea(a,e){var t;let r=(t=e?.split(".").slice(-1)[0])!=null?t:"png";r=r.length>=3&&r.length<=4?r:"png";try{const n=a.CurChapter.Chapter.slice(1,-1),l=a.CurChapter.Chapter[a.CurChapter.Chapter.length-1],i=l!=="0"?`${n}.${l}`:n,o=`https://${a.CurPathName}/manga/${a.IndexName}/${a.CurChapter.Directory?`${a.CurChapter.Directory}/`:""}${i}-`;return a.Pages.map(s=>{const c=(s+"").padStart(3,"0");return`${o}${c}.${r}`})}catch{return}}var Aa=Object.defineProperty,ka=Object.defineProperties,za=Object.getOwnPropertyDescriptors,qe=Object.getOwnPropertySymbols,qa=Object.prototype.hasOwnProperty,Wa=Object.prototype.propertyIsEnumerable,We=(a,e,t)=>e in a?Aa(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,Ue=(a,e)=>{for(var t in e||(e={}))qa.call(e,t)&&We(a,t,e[t]);if(qe)for(var t of qe(e))Wa.call(e,t)&&We(a,t,e[t]);return a},Fe=(a,e)=>ka(a,za(e));class Ve extends pe{resolveTitleSlug(e){var t;return(t=x(e))==null?void 0:t.split("/").filter(Boolean)[1]}async getRawReleasesData(){let e=[];try{e=(await(await fetch("https://api.mangadex.org/chapter?limit=96&offset=0&includes[]=manga&contentRating[]=safe&contentRating[]=suggestive&contentRating[]=erotica&contentRating[]=pornographic&order[readableAt]=desc")).json()).data}catch{return}const t=[];return e.forEach(({relationships:r,attributes:n,id:l})=>{const i=r.find(({type:c})=>c==="manga"),o=typeof n.volume=="string"?+n.volume:void 0,s=typeof n.chapter=="string"?+n.chapter:void 0;s&&t.push({slug:i.id,name:Object.values(i.attributes.title)[0],chapters:[{slug:n.externalUrl||l,vol:o,chap:s,lang:n.translatedLanguage,ts:new Date(n.readableAt).valueOf()}]})}),super.finalizeRawReleasesData({rawReleases:t})}async getRawTitleData(){var e,t,r;const n="https://api.mangadex.org/manga/",[l,i]=await Promise.all([L(n,N),L(n,N,"feed")]);if(!l||!i)return;const o=(r=(t=(e=i.data)==null?void 0:e.map)==null?void 0:t.call(e,u=>{const{attributes:p,id:d}=u;if(typeof p!="object"||typeof d!="string"||!d)return;const{externalUrl:g,title:h,volume:y,chapter:v,translatedLanguage:$}=p;return{slug:g||d,label:h||void 0,vol:typeof y=="string"?+y:void 0,chap:typeof v=="string"?+v:void 0,lang:$||"en",ts:new Date(p.readableAt).valueOf()}}).filter(u=>u?.chap!=null))!=null?r:[],{data:s}=l;if(!s)return;const c=He({data:s,getTagIdsFromNames:u=>this.getTagIdsFromNames(u)});if(c)return Fe(Ue({},c),{chapters:A(o),hasMoreChapters:(i.total||0)>(i.limit||0)})}async getRawReaderData(){var e,t,r,n,l,i,o,s,c,u,p,d,g,h,y,v;const $="https://api.mangadex.org/",[R,b,P]=await Promise.all([L($,"chapter",N),L($,"at-home","server",N),L($,"manga",N,"aggregate")]);if(!R||!b||!P)return;const m=R.data,{volume:j,chapter:T,externalUrl:D,translatedLanguage:w}=m.attributes||{},{baseUrl:C,chapter:{data:ne,dataSaver:Wr,hash:Ur}}=b,le=(t=(e=m.relationships)==null?void 0:e.find)==null?void 0:t.call(e,_=>_.type==="manga");if(!le)return;const Nt=He({data:le,getTagIdsFromNames:_=>this.getTagIdsFromNames(_)});if(!Nt||typeof P.volumes!="object")return;const W=(r=Je(P))!=null?r:[];(typeof T!="string"||T==="none")&&!W.length&&W.push({chap:0,slug:m.id});const me=W.findIndex(_=>_.slug===m.id),ie=(l=(n=m.relationships)==null?void 0:n.find)==null?void 0:l.call(n,_=>_.type==="scanlation_group"),Fr=C.endsWith("/")?C:C+"/",Bt=!!((o=(i=localStorage.getItem("md"))==null?void 0:i.includes)!=null&&o.call(i,'"dataSaver":true')),Vr=`${Fr}${Bt?"data-saver":"data"}/`,Jr=(p=(u=(c=(s=Bt?Wr:ne)!=null?s:[]).map)==null?void 0:u.call(c,_=>`${Vr}${Ur}/${_}`))!=null?p:[];return{externalUrl:D,vol:typeof j=="string"?+j:void 0,inferVol:(d=W[me])==null?void 0:d.inferVol,chap:+T||0,imgs:Jr,lang:w,slug:m.id,prev:W[me+1],next:W[me-1],basePath:"/chapter/",groupName:(g=ie?.attributes)==null?void 0:g.name,groupUrl:(h=ie?.attributes)==null?void 0:h.website,isWebtoon:(v=(y=le?.attributes)==null?void 0:y.tags)==null?void 0:v.some(_=>_.attributes.name.en==="Long Strip"),title:Fe(Ue({},Nt),{chapters:W})}}async getRawChaptersData(){if(!this.context)return;const{titleSlug:e,lang:t="en"}=this.context;let r;try{const n=await fetch(`https://api.mangadex.org/manga/${e}/aggregate?translatedLanguage[]=${t}`);r=Je(await n.json())}catch{return}if(r)return{chapters:r,lang:t,asc:!1,hasMore:!1,total:r.length}}}Ve.specId="mangadex";function Je(a){if(typeof a.volumes!="object")return;const e=Object.values(a.volumes).map(({volume:t,chapters:r})=>{const n=t==="none"||typeof t!="string"?void 0:+t;return Object.values(r).map(({id:l,chapter:i})=>typeof i!="string"||i==="none"?void 0:{vol:n,chap:+i,slug:l})}).flat().filter(Boolean).reverse();return A(e)}function He({data:a,getTagIdsFromNames:e}){var t,r,n,l,i,o;const{id:s,attributes:c,relationships:u}=a;if(!s||typeof s!="string"||typeof c!="object")return;const{title:p,availableTranslatedLanguages:d,altTitles:g,tags:h,contentRating:y}=c;if(typeof p!="object"||d&&!Array.isArray(d))return;const v=Object.values(p)[0];if(!v||typeof v!="string")return;const $=Ua(),R=(n=(r=(t=d??[])==null?void 0:t.map)==null?void 0:r.call(t,w=>typeof w=="string"?w:void 0).filter(Boolean))!=null?n:[],b=R.filter(w=>w&&(!$||$.includes(w))),P=(l=g?.map)==null?void 0:l.call(g,w=>{const[[,C]=[]]=Object.entries(w);return C}),m=(i=u?.find)==null?void 0:i.call(u,w=>w.type==="cover_art"),j=(o=m?.attributes)==null?void 0:o.fileName,T=j?`https://mangadex.org/covers/${s}/${j}`:void 0,D=(h||[]).map(w=>{var C,ne;return(ne=(C=w?.attributes)==null?void 0:C.name)==null?void 0:ne.en}).concat(y).filter(Boolean);return{url:`${location.origin}/title/${s}`,slug:s,name:v,altNames:P,langs:b.length>0?b:R.length>0?R:["en"],img:T,tags:e(D)}}function Ua(){var a;const e=localStorage.getItem("md");if(e)try{const t=JSON.parse(e),r=(a=t?.userPreferences)==null?void 0:a.filteredLanguages;return r!=null&&r.length?r:void 0}catch{return}}var Fa=Object.defineProperty,Va=Object.defineProperties,Ja=Object.getOwnPropertyDescriptors,Ge=Object.getOwnPropertySymbols,Ha=Object.prototype.hasOwnProperty,Ga=Object.prototype.propertyIsEnumerable,Xe=(a,e,t)=>e in a?Fa(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,Qe=(a,e)=>{for(var t in e||(e={}))Ha.call(e,t)&&Xe(a,t,e[t]);if(Ge)for(var t of Ge(e))Ga.call(e,t)&&Xe(a,t,e[t]);return a},Ye=(a,e)=>Va(a,Ja(e));class Ze extends S{async getRawReleasesData(){const e=await super.getRawReleasesData();if(e)return Ye(Qe({},e),{rawReleases:e.rawReleases.map(t=>{var r;return Ye(Qe({},t),{id:(r=t.id)==null?void 0:r.split("?")[0]})})})}async getRawReaderData(){var e;const t=await M(".current-viewtype",{lazy:!0,all:!1});if(((e=t?.textContent)==null?void 0:e.trim().toLowerCase())!=="volume")return await super.getRawReaderData()}async getRawChaptersData(){var e;const t=(e=this.context)==null?void 0:e.lang;if(!t)return;const r=await M(`.tab-content[data-name="chapter"] a.dropdown-item[data-code="${t.toUpperCase()}"]`,{lazy:!0,all:!1});if(r)return r.click(),await M(`.tab-content[data-name="chapter"] li.item[data-number] a[href*="/${t}/"]`,{lazy:!0,all:!1}),await super.getRawChaptersData()}}Ze.specId="mangafire";var Xa=Object.defineProperty,Qa=Object.defineProperties,Ya=Object.getOwnPropertyDescriptors,Ke=Object.getOwnPropertySymbols,Za=Object.prototype.hasOwnProperty,Ka=Object.prototype.propertyIsEnumerable,et=(a,e,t)=>e in a?Xa(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,er=(a,e)=>{for(var t in e||(e={}))Za.call(e,t)&&et(a,t,e[t]);if(Ke)for(var t of Ke(e))Ka.call(e,t)&&et(a,t,e[t]);return a},tr=(a,e)=>Qa(a,Ya(e));class tt extends S{async getRawReaderData(){const e=await super.getRawReaderData();return e&&tr(er({},e),{imgs:await this.getImgs()})}resolveReaderSlug(e,t){const r=super.resolveReaderSlug(e,t),n=r.split("/").filter(Boolean);return n[n.length-1].startsWith("pg-")?n.slice(0,-1).join("/"):r}async getImgs(){const e=await I(100,20,()=>window.imgsrcs),t=window.CryptoJS,r=t.enc.Hex.parse("e11adc3949ba59abbe56e057f20f883e"),n={iv:t.enc.Hex.parse("1234567890abcdef1234567890abcdef"),padding:t.pad.ZeroPadding};return t.AES.decrypt(e,r,n).toString(t.enc.Utf8).split(",")}}tt.specId="mangago";var ar=Object.defineProperty,rr=Object.defineProperties,nr=Object.getOwnPropertyDescriptors,at=Object.getOwnPropertySymbols,lr=Object.prototype.hasOwnProperty,ir=Object.prototype.propertyIsEnumerable,rt=(a,e,t)=>e in a?ar(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,H=(a,e)=>{for(var t in e||(e={}))lr.call(e,t)&&rt(a,t,e[t]);if(at)for(var t of at(e))ir.call(e,t)&&rt(a,t,e[t]);return a},K=(a,e)=>rr(a,nr(e));class nt extends pe{async getRawReleasesData(){throw new Error("Unimplemented")}async getRawTitleData(){var e,t;const r=await this.getPageData();if(!r)return;const n=await this.getPrefLangs(),l=(t=(e=r.chart_count_lang_to_serials)==null?void 0:e.find(o=>n?.includes(o?.field)))==null?void 0:t.count,i=await this.getTitleChapters();return K(H({},this.transformRawTitleData(r)),{chapters:i,hasMoreChapters:l&&l>i.length})}async getRawReaderData(){var e,t;const r=await this.getPageData(),n=(e=r?.comicNode)==null?void 0:e.data,l=r?.imageSet;if(!r||!n||!l)return;const{httpLis:i,wordLis:o}=l,s=this.transformRawTitleData(n);return K(H({slug:location.pathname.split("/").filter(Boolean)[2],lang:r.lang,vol:(t=r.volume)!=null?t:void 0,chap:r.serial,imgs:i.map((c,u)=>`${c}?${o[u]}`),title:K(H({},s),{chapters:[],hasMoreChapters:!0})},await this.getReaderPrevNext()),{basePath:`/title/${s.slug}/`})}async getRawChaptersData(){var e;if(!this.context)return;const{lang:t,titleSlug:r,skip:n}=this.context;if(!t||!r)return;const l=(e=await this.getPrefLangs())!=null?e:[];let i;try{i=await fetch("https://mangapark.net/apo/",{method:"POST",body:JSON.stringify({query:"query get_content_comic_chapters($comicId: Int!, $isPref: Boolean) { get_content_comic_chapters(comicId: $comicId, isPref: $isPref) {serial chapters{lang cids}}}",variables:{comicId:+r,isPref:l.includes(t)},operationName:"get_content_comic_chapters"}),headers:{"Content-Type":"application/json"}})}catch{return}const o=[],s=(await i.json()).data.get_content_comic_chapters.reverse();return(n?s.slice(n):s).forEach(c=>{var u;const p=c.chapters.find(h=>h.lang===t);if(!p)return;const d=(u=p.cids)==null?void 0:u[0];if(!p||!d)return;const g=c.serial;o.push({slug:`${d}-${t}-ch.${g}`,chap:g,ts:c.datePublic})}),{chapters:o,lang:t,asc:!1,hasMore:!1,total:o.length}}transformRawTitleData(e){var t,r,n,l;return{url:e.urlPath,slug:e.id+"",name:e.name,langs:(r=(t=e.chart_count_lang_to_serials)==null?void 0:t.map)==null?void 0:r.call(t,i=>{var o;return(o=i?.field)==null?void 0:o.toLowerCase()}).filter(Boolean),img:(l=(n=e.urlCover300)!=null?n:e.urlCover600)!=null?l:e.urlCoverOri,tags:this.getTagIdsFromNames(e.genres)}}async getReaderPrevNext(){let e,t;return await I(20,100,async()=>{const r=await M("main a.btn",{lazy:!0,all:!0});if(r!=null&&r.length)return e=r.find(n=>{var l;return(l=n.textContent)==null?void 0:l.toLowerCase().includes("prev")}),t=r.find(n=>{var l;return(l=n.textContent)==null?void 0:l.toLowerCase().includes("next")}),e||t?!0:void 0}),{prev:this.getChapterFromBtn(e),next:this.getChapterFromBtn(t)}}getChapterFromBtn(e){const t=e?.getAttribute("href");if(!t)return;const r=t.split("/").filter(Boolean).slice(-1)[0];if(!r)return;const n=E(r.split("-").slice(2).join("-"));if(n)return H({slug:r,lang:r.split("-")[1]||void 0},n)}async getTitleChapters(){const e=[],t=await M(".file-list-by-serial time[time]",{lazy:!0,all:!0});if(!(t!=null&&t.length))return e;let r;return t.forEach(n=>{var l,i,o,s;const c=n.parentElement;for(let u=0;u<5;u++){const p=c?.parentElement,d=p?.querySelector('a[href*="/title/"]');if(!d)continue;const g=(l=d.getAttribute("href"))==null?void 0:l.split("/").filter(Boolean)[2],h=(i=d.textContent)==null?void 0:i.replace(/(\n|\t)/g," ").trim(),y=E(h);if(!y||!g||r&&r.chap==y.chap&&((o=r.vol)!=null?o:0)==((s=y.vol)!=null?s:0))break;const v=+n.getAttribute("time");r=K(H({},y),{slug:g,lang:g.split("-")[1]||void 0,ts:v===v&&typeof v=="number"?v:void 0}),e.push(r);break}}),A(e)}getPageData(){return I(100,50,()=>{var e,t,r,n,l,i,o,s;return(s=(o=(i=(l=(n=(r=(t=(e=window.__NEXT_DATA__)==null?void 0:e.props)==null?void 0:t.pageProps)==null?void 0:r.dehydratedState)==null?void 0:n.queries)==null?void 0:l[0])==null?void 0:i.state)==null?void 0:o.data)==null?void 0:s.data})}getPrefLangs(){return I(100,50,()=>{var e,t,r,n,l;const i=(t=(e=window.__NEXT_DATA__)==null?void 0:e.props)==null?void 0:t.pageProps;if(!i)return;const o=(l=(n=(r=i?.extra)==null?void 0:r.sets)==null?void 0:n.general_prefLangs)==null?void 0:l.filter(Boolean);return o!=null&&o.length?o:["en"]})}}nt.specId="mangapark";function lt(a,e){const t=a[0]===e?a.substring(1):a;return t[t.length-1]===e?t.substring(0,t.length-1):t}var or=Object.defineProperty,sr=Object.defineProperties,cr=Object.getOwnPropertyDescriptors,it=Object.getOwnPropertySymbols,ur=Object.prototype.hasOwnProperty,pr=Object.prototype.propertyIsEnumerable,ot=(a,e,t)=>e in a?or(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,z=(a,e)=>{for(var t in e||(e={}))ur.call(e,t)&&ot(a,t,e[t]);if(it)for(var t of it(e))pr.call(e,t)&&ot(a,t,e[t]);return a},J=(a,e)=>sr(a,cr(e));class st extends S{async getRawReleasesData(){const e=await super.getRawReleasesData();if(e)return J(z({},e),{siteMeta:dr(this.spec.releases,this.siteMeta)})}async getRawTitleData(){var e;const t=await super.getRawTitleData();if(!t)return;const r=q(location.pathname);let n;if((e=t.chapters)!=null&&e.length){const l=this.spec.title.chapter,i=document.querySelector(l.sel),o=x(f(l.url,{root:i}));o&&(n=q(o))}return J(z({},t),{siteMeta:ee(this.siteMeta,{titleBase:r,readerBase:n})})}async getRawReaderData(){const e=await super.getRawReaderData();if(e)return J(z({},e),{siteMeta:ee(this.siteMeta,{titleBase:q(x(e.title.url)),readerBase:q(location.pathname),idBase:ct()}),title:J(z({},e.title),{id:await this.getReaderTitleId()})})}async getRawSearchData(){const e=await super.getRawSearchData();if(!e)return;const t=this.spec.search.title,r=document.querySelector(t.sel),n=f(t.url,{root:r});return J(z({},e),{siteMeta:ee(this.siteMeta,{titleBase:q(x(n)),idBase:ct()})})}async getReaderTitleId(){var e,t;const r=await((t=(e=window.HISTORY)==null?void 0:e.getStored)==null?void 0:t.call(e));if(!r||typeof r!="object")return;const n=Object.values(r).filter(Boolean);if(n.length)return n.sort((l,i)=>i.time-l.time),n[0].manga_ID}}st.specId="mangastream";function dr(a,e){var t,r;if(!a)return;const n=J(z({},e),{releases:lt(location.pathname,"/")}),l=a.title,i=(t=document.querySelector(l.sel))!=null?t:void 0;if(!i)return;const o=x(f(l.url,{root:i}));if(o===void 0)return;const s=(r=i.querySelector(l.chapter.sel))!=null?r:void 0;if(!s)return;const c=x(f(l.chapter.url,{root:s}));if(c!==void 0)return n.titleBase=q(o),n.readerBase=q(c),e.titleIdType===se.id&&(f(l.id,{root:i})||(e.titleIdType=se.name)),ee(e,n)}function ct(){return document.querySelector('link[rel="shortlink"][href*="/?p="]')?"?p=":void 0}function ee(a,e){const t=Object.keys(e),r=z({},a);let n=!1;return t.forEach(l=>{const i=e[l];i!==a[l]&&(r[l]=i,n=!0)}),n?r:void 0}function q(a){return lt(a,"/").split("/").slice(0,-1).join("/")}var gr=Object.defineProperty,hr=Object.defineProperties,vr=Object.getOwnPropertyDescriptors,ut=Object.getOwnPropertySymbols,fr=Object.prototype.hasOwnProperty,mr=Object.prototype.propertyIsEnumerable,pt=(a,e,t)=>e in a?gr(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,ge=(a,e)=>{for(var t in e||(e={}))fr.call(e,t)&&pt(a,t,e[t]);if(ut)for(var t of ut(e))mr.call(e,t)&&pt(a,t,e[t]);return a},dt=(a,e)=>hr(a,vr(e));class gt extends S{async getRawReaderData(){const e=await super.getRawReaderData();if(!e)return e;let t=e.title.id;if(!t){const r=this.spec.reader.title;r.id&&await M(r.id.split("|")[0],{lazy:!0}),t=f(r.id)}return dt(ge({},e),{title:dt(ge({},e.title),{id:t,chapters:await yr(t),hasMoreChapters:!1})})}resolveTitleSlug(e){const t=super.resolveTitleSlug(e);if(!t)return;const r=t.lastIndexOf("-"),n=+t.substring(r+1);return r===-1||isNaN(n)||n<1e3?t:t.substring(0,r)}}gt.specId="nettruyen";async function yr(a){var e;if(!a)return[];const t=await fetch(`/Comic/Services/ComicService.asmx/ProcessChapterList?comicId=${a}`).then(r=>r.status===200?r.json():void 0).catch(()=>[]);return(e=t?.chapters)!=null&&e.length?A(t.chapters.map(r=>{const{name:n,url:l}=r,i=E(n);if(!(!i||!l))return ge({slug:x(l).split("/").filter(Boolean).slice(2).join("/")},i)})):[]}var wr=Object.defineProperty,br=Object.defineProperties,$r=Object.getOwnPropertyDescriptors,te=Object.getOwnPropertySymbols,ht=Object.prototype.hasOwnProperty,vt=Object.prototype.propertyIsEnumerable,ft=(a,e,t)=>e in a?wr(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,G=(a,e)=>{for(var t in e||(e={}))ht.call(e,t)&&ft(a,t,e[t]);if(te)for(var t of te(e))vt.call(e,t)&&ft(a,t,e[t]);return a},X=(a,e)=>br(a,$r(e)),mt=(a,e)=>{var t={};for(var r in a)ht.call(a,r)&&e.indexOf(r)<0&&(t[r]=a[r]);if(a!=null&&te)for(var r of te(a))e.indexOf(r)<0&&vt.call(a,r)&&(t[r]=a[r]);return t};class yt extends S{async getRawTitleData(){const e=await super.getRawTitleData();return e&&X(G({},e),{hasMoreChapters:!!he()})}async getRawChaptersData(){var e,t;const r=await this.getRawTitleData();if(!(r!=null&&r.hasMoreChapters))return r;const n=(e=this.context)==null?void 0:e.findContinue;if(n){const d=await this.findContinueChapters({rawTitleData:r,chapter:n});return d?{chapters:d,title:X(G({},r),{chapters:[]})}:void 0}const l=(t=this.context)==null?void 0:t.skip,i=r,{chapters:o}=i,s=mt(i,["chapters"]),c=o.length,u=l&&l>=c?Math.floor(l/c)+1:void 0;if(!u)return{chapters:o,title:X(G({},s),{chapters:[]}),hasMore:!!he()};const p=await this.getChaptersByPage({page:u,titleSlug:r.slug});return{chapters:p??[],title:X(G({},s),{chapters:[]}),hasMore:!!he(u),asc:!1,skip:l}}async findContinueChapters(e){var t=e,{rawTitleData:r,chapter:{chap:n},curPage:l=1,cacheChaptersByPage:i={}}=t,o=mt(t,["rawTitleData","chapter","curPage","cacheChaptersByPage"]),s,c;const u=(s=i[l])!=null?s:r.chapters,p=u[u.length-1].chap<=n,d=(c=o.maxPage)!=null?c:Rr();if(p){if(u[0].chap>n){const m=[...u].reverse().find(j=>j.chap>n);return m?[m]:u.slice(0,1)}if(l<=1)return u.slice(0,1)}else if(l===d)return u.slice(-1);const g=r.chapters.length,h=Object.keys(i).map(m=>+m).sort((m,j)=>m-j),y=p?-1:1,v=h[h.indexOf(l)+y];if(v===l+y)return p?i[v].slice(-1).concat(u.slice(0,1)):u.slice(-1).concat(i[v].slice(0,1));const $=p?n-u[0].chap:u[0].chap-n,R=Math.floor($/g)+1,b=p?Math.max(R,(v??1)+1):Math.min(R,(v??d+1)-1,d),P=await this.getChaptersByPage({page:b,titleSlug:r.slug});if(P)return await this.findContinueChapters({rawTitleData:r,chapter:{chap:n},curPage:b,maxPage:d,cacheChaptersByPage:X(G({},i),{1:r.chapters,[b]:P})})}async getChaptersByPage({page:e,titleSlug:t}){const r=wt(e);if(!r)return;const n=this.spec.title.chapter,l=n.sel,i=document.querySelector(l),o=I(100,30,()=>{const s=document.querySelector(l);if(s&&i!==s)return!0;r.click()});return r.click(),await o,await this.getChapters(n,{lazy:!1,titleSlug:t})}}yt.specId="reaper";function he(a=1){return wt(a+1)}function wt(a){const e=`span[wire\\:key="paginator-page-1-page${a}"] button,button[aria-label="Go to page ${a}"]`;return document.querySelector(e)}function Rr(){const a=Array.from(document.querySelectorAll('span[wire\\:key^="paginator-page-"]'));return a.length?+a[a.length-1].getAttribute("wire:key").split("-").slice(-1)[0].replace("page",""):1}var Or=Object.defineProperty,Pr=Object.defineProperties,Sr=Object.getOwnPropertyDescriptors,bt=Object.getOwnPropertySymbols,jr=Object.prototype.hasOwnProperty,Dr=Object.prototype.propertyIsEnumerable,$t=(a,e,t)=>e in a?Or(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,ae=(a,e)=>{for(var t in e||(e={}))jr.call(e,t)&&$t(a,t,e[t]);if(bt)for(var t of bt(e))Dr.call(e,t)&&$t(a,t,e[t]);return a},re=(a,e)=>Pr(a,Sr(e));class Rt extends S{async getRawTitleData(){var e,t;const r=await super.getRawTitleData();if(!r)return;const n=(e=f(".info-detail__row > .genre-btn,.info__right .stats__row:first-child|text",{returnAll:!0}))==null?void 0:e.map(l=>[l,...l.split(" ")]).flat();return Ot(re(ae({},r),{tags:(t=this.getTagIdsFromNames(n))!=null?t:[]}),".episode-header .episode-cnt")}async getRawReaderData(){const e=await super.getRawReaderData();if(e)return re(ae({},e),{title:Ot(re(ae({},e.title),{url:`${location.origin}/series/${e.title.slug}/info`,tags:[]}),".episode-list .js-ep-cnt")})}async getRawChaptersData(){if(!this.context)return;const{rawId:e,skip:t}=this.context,r=1e3,n=t?Math.floor(t/1e3)+1:1;try{const l=await fetch(`/series/${e}/episodes?page=${n}&sort=NEWEST&max_limit=${r}`);return Cr(await l.json())}catch{return}}resolveTitleSlug(e){var t;if(!e)return;const r=e.split("/").filter(Boolean);return(t=r[1])!=null?t:r[0]}}Rt.specId="tapas";function Ot(a,e){const t=xr(e)>20;return re(ae({},a),{chapters:t?[]:a.chapters,hasMoreChapters:t})}function Cr(a){var e,t,r;const n=(e=a?.data)==null?void 0:e.episodes;if(!Array.isArray(n))return;const l=n.map(o=>{var s,c,u;return{chap:(s=o.pending_scene)!=null?s:o.scene,slug:o.id+"",ts:((u=(c=new Date(o.publish_date))==null?void 0:c.valueOf)==null?void 0:u.call(c))||void 0}}),i=(t=a?.data)==null?void 0:t.pagination;return{chapters:l,total:(r=i?.total)!=null?r:l.length,hasMore:!!(i!=null&&i.has_next)}}function xr(a){var e;const t=document.querySelector(a);return+(((e=t?.textContent)==null?void 0:e.trim().split(" ")[0])||0)}var Tr=Object.defineProperty,Mr=Object.defineProperties,_r=Object.getOwnPropertyDescriptors,Pt=Object.getOwnPropertySymbols,Ir=Object.prototype.hasOwnProperty,Nr=Object.prototype.propertyIsEnumerable,St=(a,e,t)=>e in a?Tr(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,ve=(a,e)=>{for(var t in e||(e={}))Ir.call(e,t)&&St(a,t,e[t]);if(Pt)for(var t of Pt(e))Nr.call(e,t)&&St(a,t,e[t]);return a},fe=(a,e)=>Mr(a,_r(e));class jt extends S{async getRawTitleData(){var e,t;const r=new URLSearchParams(location.search),n=r.get("episode_no"),l=r.get("title_no");if(n||!l)return;const i=await super.getRawTitleData();if(!i)return;const o=location.pathname.split("/")[1];return fe(ve({},i),{id:l,langs:[o].filter(Boolean),chapters:i.chapters.map(s=>fe(ve({},s),{lang:o})),hasMoreChapters:((t=(e=document.querySelector(".paginate"))==null?void 0:e.childElementCount)!=null?t:1)>1})}async getRawReaderData(){var e;const t=new URLSearchParams(location.search),r=t.get("episode_no"),n=t.get("title_no");if(!r||!n)return;const l=+r;if(l!==l)return;const i=(e=document.title.split("|")[1])==null?void 0:e.trim();if(!i)return;const o=location.pathname.split("/"),s=`${o.slice(0,4).join("/")}/list?title_no=${n}`,c=await this.getChapters({sel:"#sequence_scroll li.eg-flick-panel,#toolbar .episode_lst li[data-episode-no]",url:"a|attr:href",label:"|attr:data-episode-no || .num|text"},{lazy:!1}),u=o[1];return{chap:l,lang:u,slug:`${location.pathname}?title_no=${n}&episode_no=${l}`,basePath:"",imgs:await this.getReaderImgs(),isWebtoon:!0,title:{id:n,url:s,slug:s,name:i,langs:[u],chapters:(c??[]).map(p=>fe(ve({},p),{lang:u})),hasMoreChapters:!1}}}async getReaderImgs(){const e=f("#_imageList img|[attr:data-url,attr:src]",{returnAll:!0});return e!=null&&e.length?e:await I(100,50,()=>{var t,r,n;return(n=(r=(t=window.__viewerState__)==null?void 0:t.scrollViewerParam)==null?void 0:r.imageList)==null?void 0:n.map(({url:l})=>l).filter(Boolean)})}resolveReaderSlug(e,t,r){if(!r)return t;if(r.startsWith("http://")||r.startsWith("https://")){const n=oe(r);return n.pathname+n.search}return r}}jt.specId="webtoon";const Br=[xe,Ne,Ae,Ve,st,gt,yt,Rt,tt,Ze,nt,jt];function Dt(a){var e;const t=(e=Br.find(r=>r.specId===a.spec.id))!=null?e:S;return new t(a)}var Lr=Object.defineProperty,Er=Object.defineProperties,Ar=Object.getOwnPropertyDescriptors,Ct=Object.getOwnPropertySymbols,kr=Object.prototype.hasOwnProperty,zr=Object.prototype.propertyIsEnumerable,xt=(a,e,t)=>e in a?Lr(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,Tt=(a,e)=>{for(var t in e||(e={}))kr.call(e,t)&&xt(a,t,e[t]);if(Ct)for(var t of Ct(e))zr.call(e,t)&&xt(a,t,e[t]);return a},Mt=(a,e)=>Er(a,Ar(e));async function qr(a){var e,t;const{spec:r}=a;if(r){const n=(e=a.siteMeta)!=null?e:r.meta,l=a.type?[a.type]:_t(n,r.generic);if(!l.length)return;const i=Dt(Mt(Tt({},a),{spec:r,siteMeta:n}));return await F(l.map(o=>i.getRawPageByType(o,l.length>1)))}return await F(((t=a.genericSpecs)!=null?t:[]).map(n=>{const l=_t(n.meta,n.generic);if(!l.length)return[];const i=Dt(Mt(Tt({},a),{spec:n,siteMeta:n.meta}));return l.map(o=>i.getRawPageByType(o,!0))}).flat())}function _t(a,e){if(location.pathname==="/")return[];const{titleBase:t,readerBase:r}=a,n=location.pathname.split("/").filter(Boolean),l=It(n,r),i=It(n,t);if(l!==i)return l>i?[O.reader]:[O.title];if(l>0)return[O.reader,O.title];if(n.length===1){const o=[!r&&O.reader,!t&&O.title].filter(Boolean);if(o.length)return o}return!r&&!t||e?[O.reader,O.title]:[]}function It(a,e){if(!e)return 0;const t=e.split("/").filter(Boolean),r=t.includes("{slug}"),n=a.length-t.length;return r&&n!==0||!r&&n<1?0:t.filter((l,i)=>a[i]===l||l==="{titleSlug}"||l==="{lang}"||l==="{slug}").length}U.PageType=O,U.scrape=qr});
1
+ (function(U,F){typeof exports=="object"&&typeof module<"u"?F(exports):typeof define=="function"&&define.amd?define(["exports"],F):(U=typeof globalThis<"u"?globalThis:U||self,F(U._trackkun_={}))})(this,function(U){"use strict";function F(a){let e=!1;return new Promise((t,r)=>{Promise.all(a.map(async n=>{const l=await n;!e&&l&&(e=!0,t(l))})).then(()=>{e||t(void 0)})})}function oe(a,{removeTrailingSlash:e=!0}={}){if(!a)return;const t=e&&a.endsWith("/")?a.slice(0,-1):a;try{return new URL(t)}catch{return}}function x(a){var e,t;if(!(!a||typeof a!="string"))return a.startsWith("http://")||a.startsWith("https://")?(e=oe(a))==null?void 0:e.pathname:a.startsWith("//")?(t=oe(`https:${a}`))==null?void 0:t.pathname:a}async function I(a,e,t){const r=await t(()=>{a=0});if(r!==void 0)return r;if(!(a<=0))return await new Promise(n=>{setTimeout(async()=>{const l=await I(a-1,e,t);n(l)},e)})}async function M(a,e,t=0){var r,n;const l=(r=e.root)!=null?r:document.documentElement,i=(n=e.timeoutMs)!=null?n:1e4;return I(e.lazy===!0?i/50:0,50,()=>{var o;const s=e.all===!0?Array.from(l.querySelectorAll(a)):(o=l.querySelector(a))!=null?o:void 0;return(e.all?!(s!=null&&s.length):!s)?void 0:s})}const Lt={text:Et,attr:At,"attr-contain":kt,value:zt,row:qt};function f(a,e={}){if(!a)return;const{root:t=document.documentElement,returnAll:r,preProcess:n}=e,l=ye(a);if(l.length>1){for(let p=0;p<l.length;p+=1){const d=f(l[p],e);if(d!=null&&d.length)return d}return}const[i,o]=a.split("|");if(!o)return;const s=(o!=null&&o.startsWith("[")&&o.endsWith("]")?o.substring(1,o.length-1).split(","):[o]).map(p=>{const d=p.indexOf(":"),g=d!==-1;return{action:g?p.substring(0,d):p,param:g?p.substring(d+1):""}}),c=i?Array.from(t.querySelectorAll(i)):[t];if(!c.length)return r?[]:void 0;n&&n(c);const u=[];for(const p of c)for(const d of s){const g=Lt[d.action],h=g(p,d.param);if(h){if(r){u.push(h);break}return h}}return r?u:void 0}function Et(a){return Array.from(a.childNodes).filter(e=>e.nodeType===3).map(e=>V(e.textContent)).filter(Boolean).join(" ").trim()||V(a.textContent)}function At(a,e){return V(a.getAttribute(e))}function kt(a,e){let t=a.getAttribute(e);if(!t){const r=a.getAttributeNames().find(n=>n.includes(e));r&&(t=a.getAttribute(r))}return V(t)}function ye(a){const e=[],t=a.split("||").map(r=>r.trim()).filter(Boolean);return t.forEach((r,n)=>{if(r.includes("|")){e.push(r);return}const l=t[n+1];l&&(t[n+1]=`${r},${l}`)}),e}function zt(a){return a.value}function qt(a,e){var t,r,n,l;if(!e)return;const i=(t=V(a.textContent))==null?void 0:t.toLowerCase(),o=e.toLowerCase();if(!(i!==o&&i!==`${o}:`))return V((l=(r=a.nextElementSibling)==null?void 0:r.textContent)!=null?l:(n=a.nextSibling)==null?void 0:n.textContent)}function V(a){if(a)return a?.replace(/(\n|\t)/g," ").trim()||void 0}var Wt=(a=>(a[a.reading=1]="reading",a[a.paused=2]="paused",a[a.plan=3]="plan",a[a.completed=4]="completed",a[a.dropped=5]="dropped",a[a.deleted=6]="deleted",a))(Wt||{}),se=(a=>(a.id="id",a.name="name",a.slug="slug",a))(se||{}),ce=(a=>(a.blank="about:blank",a.title="meta.title",a.reader="meta.reader",a))(ce||{}),Ut=(a=>(a[a.string=1]="string",a[a.number=2]="number",a[a.bool=3]="bool",a[a.selection=4]="selection",a))(Ut||{}),Ft=(a=>(a[a.pending=0]="pending",a[a.completed=1]="completed",a[a.offline=2]="offline",a[a.incompat=3]="incompat",a))(Ft||{});const Vt=/(vol(ume)?|season)(\s*|-|\.)(\d+)/i,Jt=/(ch(ap(t(er)?|\.)?|\.)?|^#|episode\.?)(\s*|-)(\d+([_-~,.]\d+)?)/i,Ht=/\d+([_-~,.]\d+)?/,Gt=/[_-~,]/;function E(a){var e;if(!a||!a)return;if(!isNaN(+a))return{chap:+a};const t=a.match(Vt),r=t!=null&&t[0]?a.replace(t[0],"").trim():a,n=r.match(Jt),l=r.match(Ht),i=(e=n?.[6])!=null?e:l?.[0];if(!i)return;const o=+i.replace(Gt,".");if(isNaN(o))return;const s=t?.[4];return{vol:s&&!isNaN(+s)?+s:void 0,chap:o}}function A(a){return a.sort((e,t)=>e.vol===void 0||t.vol===void 0?t.chap-e.chap:t.vol-e.vol||t.chap-e.chap),Xt(a)}function Xt(a){var e;const t={};for(let r=a.length-1;r>=0;r--){const n=a[r],l=(e=n.lang)!=null?e:"";n.vol!==void 0?t[l]=n.vol:t[l]!==void 0&&(n.inferVol=t[l])}return a}const Qt=[{regex:/(sec|giây)/,seconds:1},{regex:/(min|phút)/,seconds:60},{regex:/(hour|giờ)/,seconds:3600},{regex:/(day|ngày)/,seconds:86400},{regex:/(week|tuần)/,seconds:604800},{regex:/(month|tháng)/,seconds:2592e3},{regex:/(year|năm)/,seconds:31536e3}];function we(a){const e=a?.toLowerCase();if(!e||e.includes("now"))return Date.now();if(e.includes("yesterday"))return Date.now()-864e5;const t=new Date(e);if(t instanceof Date){const l=t.valueOf();if(!isNaN(l))return t.getHours()===0&&t.getMinutes()===0?Math.min(Date.now(),l+432e5):l}const r=Qt.find(l=>l.regex.test(e));if(!r)return;const n=e.split(" ").filter(Boolean);for(let l=0;l<n.length;l++){const i=n[l],o=i==="a"||i==="an"?1:+i;if(!o)continue;if(o<0)return;const s=Date.now()-o*r.seconds*1e3;return s>0?s:void 0}}function ue(a,e=location.origin){if(!a)return;const t=new URL(a.startsWith("//")?`${location.protocol}${a}`:a,location.origin+location.pathname).toString();return t.startsWith(e)?t.replace(e,""):t}function be(a,e){if(!a)return"/";const t=a.replace("{titleSlug}",e),r=t.endsWith("/")?t:t+"/";return r.startsWith("/")?r:"/"+r}var Yt=Object.defineProperty,$e=Object.getOwnPropertySymbols,Zt=Object.prototype.hasOwnProperty,Kt=Object.prototype.propertyIsEnumerable,Re=(a,e,t)=>e in a?Yt(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,ea=(a,e)=>{for(var t in e||(e={}))Zt.call(e,t)&&Re(a,t,e[t]);if($e)for(var t of $e(e))Kt.call(e,t)&&Re(a,t,e[t]);return a};function ta(a,e){var t,r;const n=[...e],l=[];let i=-1,o=-1;for(let c=0;c<a.length&&!(!n.length&&c>=10);c++){const u=ea({},a[c]),p=n.findIndex(h=>h.slug===u.slug&&h.name===u.name),d=p===-1?void 0:n.splice(p,1)[0],g=!d||((t=d.chapters[0])==null?void 0:t.chap)!==((r=u.chapters[0])==null?void 0:r.chap);p!==-1&&(o=c),g&&(i=c,u.changed=!0),l.push(u)}if(i===-1)return[];if(n.length&&n.length!==e.length){const c=Math.max(10,o+1);l.splice(c);for(let u=o+1;u<l.length;u++)l[u].changed=!1;return l}const s=Math.min(Math.max(i+1,10),Math.max(o+1,100));return l.slice(0,s)}var aa=Object.defineProperty,ra=Object.defineProperties,na=Object.getOwnPropertyDescriptors,Oe=Object.getOwnPropertySymbols,la=Object.prototype.hasOwnProperty,ia=Object.prototype.propertyIsEnumerable,Pe=(a,e,t)=>e in a?aa(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,oa=(a,e)=>{for(var t in e||(e={}))la.call(e,t)&&Pe(a,t,e[t]);if(Oe)for(var t of Oe(e))ia.call(e,t)&&Pe(a,t,e[t]);return a},sa=(a,e)=>ra(a,na(e));function ca(a,e){const t={};return a.forEach(r=>{const n=r.chapters.reduce((l,i)=>{const o=i.lang||e||"";return l[o]||(l[o]=[]),l[o].push(i),l},{});Object.entries(n).forEach(([l,i])=>{const o=`${r.slug}:${l}`;t[o]?(t[o].chapters.push(...i),A(t[o].chapters)):t[o]=sa(oa({},r),{lang:l===""?void 0:l,chapters:i})})}),Object.values(t)}var O=(a=>(a.title="title",a.reader="reader",a.releases="releases",a.chapters="chapters",a.search="search",a))(O||{});class pe{constructor(e){this.methodsMap={[O.title]:()=>this.getRawTitleData(),[O.reader]:()=>this.getRawReaderData(),[O.releases]:()=>this.getRawReleasesData(),[O.search]:()=>this.getRawSearchData(),[O.chapters]:()=>this.getRawChaptersData()},this.spec=e.spec,this.siteMeta=e.siteMeta,this.tags=e.tags,this.context=e.context}async getRawSearchData(){throw new Error("Unimplemented")}async getRawPageByType(e,t=!1){const r=await this.methodsMap[e](),n=!r&&pa(this.spec);if(t&&!r&&!n)return;const l=location.origin+location.pathname;return{type:e,is404:n,specId:this.spec.id,siteName:f(this.spec.name),url:l,data:r,spec:this.spec,context:this.context}}resolveReaderSlug(e,t,r){return t.startsWith(e)?t.replace(e,""):t}resolveTitleSlug(e){var t;if(typeof e!="string")return;const r=(t=x(e))==null?void 0:t.split("/").filter(Boolean);return!r||!r.length?e:r[r.length-1]}finalizeRawReleasesData(e){var t,r,n;const l=(r=(t=this.spec.releases)==null?void 0:t.title)!=null&&r.lang?this.siteMeta.defaultLang:void 0,i=ca(e.rawReleases,l);if(i.length)return{rawReleases:(n=this.context)!=null&&n.oldRawReleases?ta(i,this.context.oldRawReleases):i}}getTagIdsFromNames(e){var t;if(!(e!=null&&e.length))return;const r=(t=this.normalizedTagsMap)!=null?t:this.normalizedTagsMap=ua(this.tags),n=e.map(l=>r[de(l)]).filter(Boolean);return n.length===0?void 0:Array.from(new Set(n)).sort((l,i)=>l-i)}}function ua(a){const e={};return a.forEach(({id:t,name:r,altNames:n})=>{e[de(r)]=t,n&&n.forEach(l=>{e[de(l)]=t})}),e}function de(a){const e=a.toLowerCase().replaceAll(" ","").replaceAll("-","");return e[e.length-1]==="s"?e.substring(0,e.length-1):e}function pa(a){return a[404]&&document.querySelector(a[404])?!0:document.title.toLowerCase().includes("not found")}var da=Object.defineProperty,ga=Object.defineProperties,ha=Object.getOwnPropertyDescriptors,Q=Object.getOwnPropertySymbols,Se=Object.prototype.hasOwnProperty,je=Object.prototype.propertyIsEnumerable,De=(a,e,t)=>e in a?da(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,B=(a,e)=>{for(var t in e||(e={}))Se.call(e,t)&&De(a,t,e[t]);if(Q)for(var t of Q(e))je.call(e,t)&&De(a,t,e[t]);return a},k=(a,e)=>ga(a,ha(e)),Ce=(a,e)=>{var t={};for(var r in a)Se.call(a,r)&&e.indexOf(r)<0&&(t[r]=a[r]);if(a!=null&&Q)for(var r of Q(a))e.indexOf(r)<0&&je.call(a,r)&&(t[r]=a[r]);return t};class S extends pe{async getRawReleasesData(){var e,t;if(!((t=(e=this.spec)==null?void 0:e.releases)!=null&&t.title))return;const r=this.spec.releases.title,{chapter:n}=r,l=Ce(r,["chapter"]),i=await M(l.sel,{lazy:!0,all:!0});if(!(i!=null&&i.length))return;const o=i.slice(0,100).map(c=>{var u;const p=f(l.url,{root:c}),d=x(p),g=f(l.name,{root:c}),h=f(l.at,{root:c});if(!(!d||!g))return{titleEl:c,id:f(l.id,{root:c}),path:d,name:g,lang:(u=f(l.lang,{root:c}))==null?void 0:u.toLowerCase(),at:h?we(h):void 0}}).filter(Boolean);if(!o.length)return;const s=await Promise.all(o.map(async c=>{var u;const p=c,{path:d,titleEl:g,lang:h,at:y}=p,v=Ce(p,["path","titleEl","lang","at"]),$=this.resolveTitleSlug(d),R=(u=await this.getChapters(n,{root:g,titleSlug:$}))!=null?u:[];return B({slug:$,chapters:h||y?R.map(b=>{var P,m;return k(B({},b),{lang:(P=b.lang)!=null?P:h,ts:(m=b.ts)!=null?m:y})}):R},v)}));return this.finalizeRawReleasesData({rawReleases:s})}async getRawTitleData(){var e,t,r;const n=this.spec.title;if(!n||n.sel&&!await M(n.sel,{lazy:!!n.lazy}))return;const l=f(n.name);if(!l){await new Promise(u=>setTimeout(u,9e4));return}const i=this.resolveTitleSlug(location.pathname);if(!i)return;let o=(e=f(n.tags,{returnAll:!0}))!=null?e:[];o.length===1&&(o=o[0].split(",").map(u=>u.trim()).filter(Boolean));const s=f(n.type),c=(t=f(n.langs,{returnAll:!0}))==null?void 0:t.map(u=>u.toLowerCase());return{id:f(n.id),url:location.origin+location.pathname,slug:i,name:l,langs:c!=null&&c.length?c:n.langs&&this.siteMeta.defaultLang?[this.siteMeta.defaultLang]:void 0,tags:this.getTagIdsFromNames([...o??[],...s?[s]:[]]),chapters:(r=await this.getChapters(n.chapter,{lazy:!0,titleSlug:i}))!=null?r:[],img:ue(f(n.img))}}async getRawReaderData(){var e,t,r,n,l,i,o;const{spec:s,siteMeta:c}=this;if(!(s!=null&&s.reader)||s.generic&&!await S.isReaderPage(s.reader))return;const u=s.reader.imgs;if(!(!u||await S.verifyImgsLocator(u)))return;const p=s.reader.title,d=document.querySelector(p.sel);if(!d)return;const g=f(p.name,{root:d}),h=f(p.url,{root:d}),y=this.resolveTitleSlug(h),v=f(p.img,{root:d});if(!g||!h||!y)return;const $=!!((e=this.context)!=null&&e.disableLazyChapters),R=(r=await this.getChapters((t=s.reader)==null?void 0:t.chapter,{titleSlug:y,lazy:!$,timeoutMs:4e4}))!=null?r:[],b=(n=f(s.reader.label))==null?void 0:n.toLowerCase().replace(g.toLowerCase(),"");if(!b)return;const{vol:P,chap:m=0}=E(b)||{},j=be(c.readerBase,y),T=c.readerBase.split("/").indexOf("{lang}"),D=T!==-1?(l=location.pathname.substring(1).split("/")[T])==null?void 0:l.toLowerCase():void 0,w=D?j.replace("{lang}",D):j,C=(o=D??((i=f(s.reader.lang))==null?void 0:i.toLowerCase()))!=null?o:s.reader.lang?this.siteMeta.defaultLang:void 0;return this.finalizeRawReaderData({vol:P,chap:m,lang:C,slug:this.resolveReaderSlug(w,location.pathname,location.href),basePath:w,imgsLocator:s.reader.imgs,title:{id:f(p.id),url:h,slug:y,name:g,langs:C?[C]:void 0,img:ue(v),chapters:R,hasMoreChapters:!R.length&&$}},{prevSlug:this.findNeighborChapter({sel:s.reader.prev,basePath:w}),nextSlug:this.findNeighborChapter({sel:s.reader.next,basePath:w})})}async getRawChaptersData(){var e,t;const r=this.siteMeta.chapters;if(r===ce.blank)return;const n=r===ce.reader?(e=await this.getRawReaderData())==null?void 0:e.title:await this.getRawTitleData();if(!n)return;const l=(t=this.context)==null?void 0:t.lang,{chapters:i}=n,o=l?i.filter(s=>!s.lang||s.lang===l):i;return{chapters:o,title:k(B({},n),{chapters:[]}),hasMore:!1,asc:!1,total:o.length}}async getRawSearchData(){var e;const t=(e=this.spec.search)==null?void 0:e.title;if(!t)return;const{chapter:r}=t,n=[];return await Promise.all(Array.from(document.querySelectorAll(t.sel)).map(async l=>{var i;const o=f(t.url,{root:l}),s=x(o),c=f(t.name,{root:l}),u=this.resolveTitleSlug(s);!s||!c||!u||n.push({slug:u,name:c,chapters:(i=await this.getChapters(r,{root:l,titleSlug:u}))!=null?i:[]})})),n.length?{rawReleases:n}:void 0}async getChapters(e,{root:t=document.documentElement,titleSlug:r="",lazy:n=!0,timeoutMs:l}){var i;if(!e)return;const o=[],s=await M(e.sel,{root:t,all:!0,lazy:n,timeoutMs:l});if(!(s!=null&&s.length))return o;const c=(s??[]).map(v=>({id:f(e.id,{root:v}),label:f(e.label,{root:v}),url:f(e.url,{root:v}),at:f(e.at,{root:v})})),u=c.map(({label:v})=>E(v)),p=(i=u[1])==null?void 0:i.chap;!u[0]&&(p===void 0||p<=1)&&(u[0]={chap:0});const{readerBase:d}=this.siteMeta,g=be(d,r),h=d.split("/").indexOf("{lang}"),y=h!==-1;return u.forEach((v,$)=>{var R,b;if(!v)return;const{id:P,url:m,at:j}=c[$],T=m?.startsWith("http")&&!m.startsWith(location.origin),D=T?m:x(m);if(!D)return;const w=!T&&y?(R=D?.substring(1).split("/")[h])==null?void 0:R.toLowerCase():void 0,C=T?D:this.resolveReaderSlug(w?g.replace("{lang}",w):g,D,m);o.push(k(B({},v),{id:P,slug:C,lang:w,ts:we(j)||((b=o[o.length+1])==null?void 0:b.ts)||Date.now()}))}),A(o)}static async isReaderPage(e){return!!e.sel&&!!await M(e.sel,{lazy:!!e.lazy})}static async verifyImgsLocator(e){const t=ye(e).map(r=>r.split("|")[0]).join(",");return!!await M(t,{lazy:!0})}findNeighborChapter({sel:e,basePath:t}){const r=f(e);if(!r||r.startsWith("#")||r.startsWith("/#"))return;const n=x(r);return n?this.resolveReaderSlug(t,n,r):void 0}finalizeRawReaderData(e,{prevSlug:t,nextSlug:r}={}){var n;const l=(n=e.title)==null?void 0:n.chapters;if(!(l!=null&&l.length)){const u=E(t),p=E(r);return!u&&!p?e:k(B({},e),{prev:u?k(B({},u),{slug:t}):void 0,next:p?k(B({},p),{slug:r}):void 0})}let i,o,s,c;for(let u=0;u<l.length&&!(i&&(!t||s)&&!r&&c);u++){const p=l[u];!i&&(e.slug==p.slug||e.chap===p.chap&&(e.vol===p.vol||e.vol===void 0))?(i=p,o=u):!s&&t===p.slug?s=p:!c&&r===p.slug&&(c=p)}return o!==void 0&&(s!=null||(s=l[o+1]),c!=null||(c=l[o-1])),k(B({},e),{inferVol:i?.inferVol,prev:s,next:c})}}class xe extends S{resolveTitleSlug(e){var t;return(t=x(e))==null?void 0:t.split("/").filter(Boolean)[1]}}xe.specId="bato";function va(){return Math.random().toString(16).slice(2)}async function fa({addListener:a,removeListener:e,transform:t,filter:r,handler:n,onTimeout:l,timeout:i,once:o}){return new Promise(s=>{a(p);const c=()=>o===!0&&e(p),u=i?setTimeout(()=>{c(),s(void 0),l?.()},i):void 0;async function p(d,...g){d=t?t(d):d,d!==void 0&&(!r||r(d,...g))&&(c(),s(d),n?.(d,...g),u&&clearTimeout(u))}})}var ma=Object.defineProperty,Te=Object.getOwnPropertySymbols,ya=Object.prototype.hasOwnProperty,wa=Object.prototype.propertyIsEnumerable,Me=(a,e,t)=>e in a?ma(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,ba=(a,e)=>{for(var t in e||(e={}))ya.call(e,t)&&Me(a,t,e[t]);if(Te)for(var t of Te(e))wa.call(e,t)&&Me(a,t,e[t]);return a};async function $a(a){const e=await fa(ba({addListener:t=>window.addEventListener("message",t),removeListener:t=>window.removeEventListener("message",t)},a));return e?.data}async function Ra(a){var e;const{receiverWindow:t,timeout:r,targetOrigin:n,event:l,args:i}=a,o={reqId:va(),event:l,args:i};(e=t||window)==null||e.postMessage(o,n??"*");const s=await $a({filter:c=>{var u;return((u=c?.data)==null?void 0:u.resId)===o.reqId},timeout:r??3e4,once:!0});return s?.result}const N={isAny:!0};function L(a,...e){return Ra({event:"tk:fetchResult",args:{baseUrl:a,segments:e}})}function Oa(a){if(a)try{return JSON.parse(a)}catch{return}}var Pa=Object.defineProperty,Sa=Object.defineProperties,ja=Object.getOwnPropertyDescriptors,_e=Object.getOwnPropertySymbols,Da=Object.prototype.hasOwnProperty,Ca=Object.prototype.propertyIsEnumerable,Ie=(a,e,t)=>e in a?Pa(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,Y=(a,e)=>{for(var t in e||(e={}))Da.call(e,t)&&Ie(a,t,e[t]);if(_e)for(var t of _e(e))Ca.call(e,t)&&Ie(a,t,e[t]);return a},Z=(a,e)=>Sa(a,ja(e));class Ne extends S{async getRawReleasesData(){let e=[];try{e=await(await fetch("https://api.comick.app/chapter?page=1&device-memory=8&order=hot&accept_erotic_content=true")).json()}catch{return}const t=[];return e.forEach(r=>{const{vol:n,chap:l,hid:i,lang:o,updated_at:s,md_comics:c}=r,u=typeof l=="string"&&!isNaN(+l)?+l:void 0;typeof u=="number"&&t.push({id:c.hid,slug:c.slug,name:c.title,chapters:[{slug:i,vol:typeof n=="string"&&!isNaN(+n)?+n:void 0,chap:u,lang:o,ts:new Date(s).valueOf()}]})}),super.finalizeRawReleasesData({rawReleases:t})}async getRawTitleData(){var e,t,r,n,l,i,o,s;const c=await super.getRawTitleData();if(!c)return c;const u=await L("https://api.comick.app/","comic",N,"chapters");if(!u)return c;const p=await xa(c.slug),d=Be(u),g=f("h1 ~ div.text-sm span:first-child|row:demographic"),h=g?(e=this.getTagIdsFromNames([g]))==null?void 0:e[0]:void 0;return h&&!((t=c.tags)!=null&&t.includes(h))&&((r=c.tags)==null||r.push(h),(n=c.tags)==null||n.sort((y,v)=>y-v)),Z(Y({},c),{img:(i=c.img)!=null?i:ue(f((l=this.spec.title)==null?void 0:l.img)),id:p,hasMoreChapters:(o=d?.hasMore)!=null?o:!1,chapters:(s=d?.chapters)!=null?s:[]})}async getRawReaderData(){var e,t,r,n,l,i,o;const s=await super.getRawReaderData();if(!s)return s;const c=await L("/_next/data/",N,"comic",N),u=(e=c?.comic)==null?void 0:e.hid,p=(n=(r=(t=c?.comic)==null?void 0:t.md_comic_md_genres)==null?void 0:r.map)==null?void 0:n.call(r,g=>{var h;return(h=g?.md_genre)==null?void 0:h.name}),d=(o=(i=(l=c?.comic)==null?void 0:l.md_covers)==null?void 0:i[0])==null?void 0:o.b2key;return Z(Y({},s),{title:Z(Y({},s.title),{id:u?u+"":void 0,tags:this.getTagIdsFromNames(p),img:typeof d=="string"?`https://meo.comick.pictures/${d}`:void 0})})}async getRawChaptersData(){var e;if(!((e=this.context)!=null&&e.rawId))return;const{rawId:t,lang:r="en",skip:n}=this.context,l=n?Math.floor(n/1e3)+1:void 0;try{const i=await fetch(`https://api.comick.app/comic/${t}/chapters?lang=${r}&limit=1000${l&&l>1?`&page=${l}`:""}`),o=Be(await i.json());return o?Z(Y({},o),{lang:r,asc:!1}):void 0}catch{return}}}Ne.specId="comick";function Be(a){var e;if(!Array.isArray(a?.chapters))return;const t=[];return a.chapters.forEach(r=>{const{vol:n,chap:l,hid:i,lang:o,updated_at:s}=r,c=typeof l=="string"&&!isNaN(+l)?+l:void 0;typeof c!="number"||t.some(u=>u.vol==n&&u.chap===c&&u.lang===o)||t.push({slug:i,vol:typeof n=="string"&&!isNaN(+n)?+n:void 0,chap:c,lang:o,ts:new Date(s).valueOf()})}),{chapters:A(t),total:(e=a.total)!=null?e:t.length,hasMore:a.total>a.limit}}async function xa(a){var e,t,r,n,l,i,o,s,c;const u=(e=document.querySelector("script#__NEXT_DATA__"))==null?void 0:e.textContent,p=u?Oa(u):void 0;if(((t=p?.query)==null?void 0:t.slug)===a)return(i=(l=(n=(r=p?.props)==null?void 0:r.pageProps)==null?void 0:n.comic)==null?void 0:l.hid)!=null?i:void 0;const d=await L("/_next/data/",N,"comic",a,"covers.json");return(c=(s=(o=d?.pageProps)==null?void 0:o.comic)==null?void 0:s.hid)!=null?c:void 0}var Ta=Object.defineProperty,Ma=Object.defineProperties,_a=Object.getOwnPropertyDescriptors,Le=Object.getOwnPropertySymbols,Ia=Object.prototype.hasOwnProperty,Na=Object.prototype.propertyIsEnumerable,Ee=(a,e,t)=>e in a?Ta(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,Ba=(a,e)=>{for(var t in e||(e={}))Ia.call(e,t)&&Ee(a,t,e[t]);if(Le)for(var t of Le(e))Na.call(e,t)&&Ee(a,t,e[t]);return a},La=(a,e)=>Ma(a,_a(e));class Ae extends S{async getRawReleasesData(){const e=await this.getVM();if(!e)return super.getRawReleasesData();const t=e.LatestJSON.slice(0,100).map(r=>{const n=+r.Chapter.substring(1)/10;return{slug:r.IndexName,name:r.SeriesName,chapters:[{chap:n,slug:`${r.IndexName}-chapter-${n}.html`,ts:new Date(r.Date).valueOf()}]}});return this.finalizeRawReleasesData({rawReleases:t})}async getRawTitleData(){const e=await super.getRawTitleData();return e&&La(Ba({},e),{chapters:ke(await this.getVM(),e.slug),hasMoreChapters:!1})}resolveReaderSlug(e,t){return super.resolveReaderSlug(e,t).replace(/-page-\d{1,3}\.html$/,".html")}async getRawReaderData(){var e;const t=await this.getVM();if(!t)return;const r=(e=document.querySelector(".ImageGallery img.img-fluid"))==null?void 0:e.getAttribute("ng-src"),n=t.IndexName,l=ze(t.CurChapter,n);return this.finalizeRawReaderData({chap:l.chap,slug:l.slug,imgs:Ea(t,r??void 0),basePath:"/"+this.siteMeta.readerBase.replace("{titleSlug}",n)+"/",title:{name:t.SeriesName,slug:n,url:`/${this.siteMeta.titleBase}/${n}`,chapters:ke(t,n),hasMoreChapters:!1}})}getVM(){return I(40,50,()=>{var e,t,r,n;return(n=(r=(t=(e=window.angular)==null?void 0:e.element)==null?void 0:t.call(e,document.documentElement))==null?void 0:r.scope())==null?void 0:n.vm})}}Ae.specId="manga4life";function ke(a,e){var t,r;return((r=(t=a?.Chapters)!=null?t:a?.CHAPTERS)!=null?r:[]).sort((n,l)=>l.Chapter-n.Chapter).map(n=>ze(n,e))}function ze(a,e){const t=+a.Chapter.substring(1)/10;return{slug:`${e}-chapter-${t}.html`,chap:t,ts:new Date(a.Date).valueOf()}}function Ea(a,e){var t;let r=(t=e?.split(".").slice(-1)[0])!=null?t:"png";r=r.length>=3&&r.length<=4?r:"png";try{const n=a.CurChapter.Chapter.slice(1,-1),l=a.CurChapter.Chapter[a.CurChapter.Chapter.length-1],i=l!=="0"?`${n}.${l}`:n,o=`https://${a.CurPathName}/manga/${a.IndexName}/${a.CurChapter.Directory?`${a.CurChapter.Directory}/`:""}${i}-`;return a.Pages.map(s=>{const c=(s+"").padStart(3,"0");return`${o}${c}.${r}`})}catch{return}}var Aa=Object.defineProperty,ka=Object.defineProperties,za=Object.getOwnPropertyDescriptors,qe=Object.getOwnPropertySymbols,qa=Object.prototype.hasOwnProperty,Wa=Object.prototype.propertyIsEnumerable,We=(a,e,t)=>e in a?Aa(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,Ue=(a,e)=>{for(var t in e||(e={}))qa.call(e,t)&&We(a,t,e[t]);if(qe)for(var t of qe(e))Wa.call(e,t)&&We(a,t,e[t]);return a},Fe=(a,e)=>ka(a,za(e));class Ve extends pe{resolveTitleSlug(e){var t;return(t=x(e))==null?void 0:t.split("/").filter(Boolean)[1]}async getRawReleasesData(){let e=[];try{e=(await(await fetch("https://api.mangadex.org/chapter?limit=96&offset=0&includes[]=manga&contentRating[]=safe&contentRating[]=suggestive&contentRating[]=erotica&contentRating[]=pornographic&order[readableAt]=desc")).json()).data}catch{return}const t=[];return e.forEach(({relationships:r,attributes:n,id:l})=>{const i=r.find(({type:c})=>c==="manga"),o=typeof n.volume=="string"?+n.volume:void 0,s=typeof n.chapter=="string"?+n.chapter:void 0;s&&t.push({slug:i.id,name:Object.values(i.attributes.title)[0],chapters:[{slug:n.externalUrl||l,vol:o,chap:s,lang:n.translatedLanguage,ts:new Date(n.readableAt).valueOf()}]})}),super.finalizeRawReleasesData({rawReleases:t})}async getRawTitleData(){var e,t,r;const n="https://api.mangadex.org/manga/",[l,i]=await Promise.all([L(n,N),L(n,N,"feed")]);if(!l||!i)return;const o=(r=(t=(e=i.data)==null?void 0:e.map)==null?void 0:t.call(e,u=>{const{attributes:p,id:d}=u;if(typeof p!="object"||typeof d!="string"||!d)return;const{externalUrl:g,title:h,volume:y,chapter:v,translatedLanguage:$}=p;return{slug:g||d,label:h||void 0,vol:typeof y=="string"?+y:void 0,chap:typeof v=="string"?+v:void 0,lang:$||"en",ts:new Date(p.readableAt).valueOf()}}).filter(u=>u?.chap!=null))!=null?r:[],{data:s}=l;if(!s)return;const c=He({data:s,getTagIdsFromNames:u=>this.getTagIdsFromNames(u)});if(c)return Fe(Ue({},c),{chapters:A(o),hasMoreChapters:(i.total||0)>(i.limit||0)})}async getRawReaderData(){var e,t,r,n,l,i,o,s,c,u,p,d,g,h,y,v;const $="https://api.mangadex.org/",[R,b,P]=await Promise.all([L($,"chapter",N),L($,"at-home","server",N),L($,"manga",N,"aggregate")]);if(!R||!b||!P)return;const m=R.data,{volume:j,chapter:T,externalUrl:D,translatedLanguage:w}=m.attributes||{},{baseUrl:C,chapter:{data:ne,dataSaver:Wr,hash:Ur}}=b,le=(t=(e=m.relationships)==null?void 0:e.find)==null?void 0:t.call(e,_=>_.type==="manga");if(!le)return;const Nt=He({data:le,getTagIdsFromNames:_=>this.getTagIdsFromNames(_)});if(!Nt||typeof P.volumes!="object")return;const W=(r=Je(P))!=null?r:[];(typeof T!="string"||T==="none")&&!W.length&&W.push({chap:0,slug:m.id});const me=W.findIndex(_=>_.slug===m.id),ie=(l=(n=m.relationships)==null?void 0:n.find)==null?void 0:l.call(n,_=>_.type==="scanlation_group"),Fr=C.endsWith("/")?C:C+"/",Bt=!!((o=(i=localStorage.getItem("md"))==null?void 0:i.includes)!=null&&o.call(i,'"dataSaver":true')),Vr=`${Fr}${Bt?"data-saver":"data"}/`,Jr=(p=(u=(c=(s=Bt?Wr:ne)!=null?s:[]).map)==null?void 0:u.call(c,_=>`${Vr}${Ur}/${_}`))!=null?p:[];return{externalUrl:D,vol:typeof j=="string"?+j:void 0,inferVol:(d=W[me])==null?void 0:d.inferVol,chap:+T||0,imgs:Jr,lang:w,slug:m.id,prev:W[me+1],next:W[me-1],basePath:"/chapter/",groupName:(g=ie?.attributes)==null?void 0:g.name,groupUrl:(h=ie?.attributes)==null?void 0:h.website,isWebtoon:(v=(y=le?.attributes)==null?void 0:y.tags)==null?void 0:v.some(_=>_.attributes.name.en==="Long Strip"),title:Fe(Ue({},Nt),{chapters:W})}}async getRawChaptersData(){if(!this.context)return;const{titleSlug:e,lang:t="en"}=this.context;let r;try{const n=await fetch(`https://api.mangadex.org/manga/${e}/aggregate?translatedLanguage[]=${t}`);r=Je(await n.json())}catch{return}if(r)return{chapters:r,lang:t,asc:!1,hasMore:!1,total:r.length}}}Ve.specId="mangadex";function Je(a){if(typeof a.volumes!="object")return;const e=Object.values(a.volumes).map(({volume:t,chapters:r})=>{const n=t==="none"||typeof t!="string"?void 0:+t;return Object.values(r).map(({id:l,chapter:i})=>typeof i!="string"||i==="none"?void 0:{vol:n,chap:+i,slug:l})}).flat().filter(Boolean).reverse();return A(e)}function He({data:a,getTagIdsFromNames:e}){var t,r,n,l,i,o;const{id:s,attributes:c,relationships:u}=a;if(!s||typeof s!="string"||typeof c!="object")return;const{title:p,availableTranslatedLanguages:d,altTitles:g,tags:h,contentRating:y}=c;if(typeof p!="object"||d&&!Array.isArray(d))return;const v=Object.values(p)[0];if(!v||typeof v!="string")return;const $=Ua(),R=(n=(r=(t=d??[])==null?void 0:t.map)==null?void 0:r.call(t,w=>typeof w=="string"?w:void 0).filter(Boolean))!=null?n:[],b=R.filter(w=>w&&(!$||$.includes(w))),P=(l=g?.map)==null?void 0:l.call(g,w=>{const[[,C]=[]]=Object.entries(w);return C}),m=(i=u?.find)==null?void 0:i.call(u,w=>w.type==="cover_art"),j=(o=m?.attributes)==null?void 0:o.fileName,T=j?`https://mangadex.org/covers/${s}/${j}`:void 0,D=(h||[]).map(w=>{var C,ne;return(ne=(C=w?.attributes)==null?void 0:C.name)==null?void 0:ne.en}).concat(y).filter(Boolean);return{url:`${location.origin}/title/${s}`,slug:s,name:v,altNames:P,langs:b.length>0?b:R.length>0?R:["en"],img:T,tags:e(D)}}function Ua(){var a;const e=localStorage.getItem("md");if(e)try{const t=JSON.parse(e),r=(a=t?.userPreferences)==null?void 0:a.filteredLanguages;return r!=null&&r.length?r:void 0}catch{return}}var Fa=Object.defineProperty,Va=Object.defineProperties,Ja=Object.getOwnPropertyDescriptors,Ge=Object.getOwnPropertySymbols,Ha=Object.prototype.hasOwnProperty,Ga=Object.prototype.propertyIsEnumerable,Xe=(a,e,t)=>e in a?Fa(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,Qe=(a,e)=>{for(var t in e||(e={}))Ha.call(e,t)&&Xe(a,t,e[t]);if(Ge)for(var t of Ge(e))Ga.call(e,t)&&Xe(a,t,e[t]);return a},Ye=(a,e)=>Va(a,Ja(e));class Ze extends S{async getRawReleasesData(){const e=await super.getRawReleasesData();if(e)return Ye(Qe({},e),{rawReleases:e.rawReleases.map(t=>{var r;return Ye(Qe({},t),{id:(r=t.id)==null?void 0:r.split("?")[0]})})})}async getRawReaderData(){var e;const t=await M(".current-viewtype",{lazy:!0,all:!1});if(((e=t?.textContent)==null?void 0:e.trim().toLowerCase())!=="volume")return await super.getRawReaderData()}async getRawChaptersData(){var e;const t=(e=this.context)==null?void 0:e.lang;if(!t)return;const r=await M(`.tab-content[data-name="chapter"] a.dropdown-item[data-code="${t.toUpperCase()}"]`,{lazy:!0,all:!1});if(r)return r.click(),await M(`.tab-content[data-name="chapter"] li.item[data-number] a[href*="/${t}/"]`,{lazy:!0,all:!1}),await super.getRawChaptersData()}}Ze.specId="mangafire";var Xa=Object.defineProperty,Qa=Object.defineProperties,Ya=Object.getOwnPropertyDescriptors,Ke=Object.getOwnPropertySymbols,Za=Object.prototype.hasOwnProperty,Ka=Object.prototype.propertyIsEnumerable,et=(a,e,t)=>e in a?Xa(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,er=(a,e)=>{for(var t in e||(e={}))Za.call(e,t)&&et(a,t,e[t]);if(Ke)for(var t of Ke(e))Ka.call(e,t)&&et(a,t,e[t]);return a},tr=(a,e)=>Qa(a,Ya(e));class tt extends S{async getRawReaderData(){const e=await super.getRawReaderData();return e&&tr(er({},e),{imgs:await this.getImgs()})}resolveReaderSlug(e,t){const r=super.resolveReaderSlug(e,t),n=r.split("/").filter(Boolean);return n[n.length-1].startsWith("pg-")?n.slice(0,-1).join("/"):r}async getImgs(){const e=await I(100,20,()=>window.imgsrcs),t=window.CryptoJS,r=t.enc.Hex.parse("e11adc3949ba59abbe56e057f20f883e"),n={iv:t.enc.Hex.parse("1234567890abcdef1234567890abcdef"),padding:t.pad.ZeroPadding};return t.AES.decrypt(e,r,n).toString(t.enc.Utf8).split(",")}}tt.specId="mangago";var ar=Object.defineProperty,rr=Object.defineProperties,nr=Object.getOwnPropertyDescriptors,at=Object.getOwnPropertySymbols,lr=Object.prototype.hasOwnProperty,ir=Object.prototype.propertyIsEnumerable,rt=(a,e,t)=>e in a?ar(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,H=(a,e)=>{for(var t in e||(e={}))lr.call(e,t)&&rt(a,t,e[t]);if(at)for(var t of at(e))ir.call(e,t)&&rt(a,t,e[t]);return a},K=(a,e)=>rr(a,nr(e));class nt extends pe{async getRawReleasesData(){throw new Error("Unimplemented")}async getRawTitleData(){var e,t;const r=await this.getPageData();if(!r)return;const n=await this.getPrefLangs(),l=(t=(e=r.chart_count_lang_to_serials)==null?void 0:e.find(o=>n?.includes(o?.field)))==null?void 0:t.count,i=await this.getTitleChapters();return K(H({},this.transformRawTitleData(r)),{chapters:i,hasMoreChapters:l&&l>i.length})}async getRawReaderData(){var e,t;const r=await this.getPageData(),n=(e=r?.comicNode)==null?void 0:e.data,l=r?.imageSet;if(!r||!n||!l)return;const{httpLis:i,wordLis:o}=l,s=this.transformRawTitleData(n);return K(H({slug:location.pathname.split("/").filter(Boolean)[2],lang:r.lang,vol:(t=r.volume)!=null?t:void 0,chap:r.serial,imgs:i.map((c,u)=>`${c}?${o[u]}`),title:K(H({},s),{chapters:[],hasMoreChapters:!0})},await this.getReaderPrevNext()),{basePath:`/title/${s.slug}/`})}async getRawChaptersData(){var e;if(!this.context)return;const{lang:t,titleSlug:r,skip:n}=this.context;if(!t||!r)return;const l=(e=await this.getPrefLangs())!=null?e:[];let i;try{i=await fetch("https://mangapark.net/apo/",{method:"POST",body:JSON.stringify({query:"query get_content_comic_chapters($comicId: Int!, $isPref: Boolean) { get_content_comic_chapters(comicId: $comicId, isPref: $isPref) {serial chapters{lang cids}}}",variables:{comicId:+r,isPref:l.includes(t)},operationName:"get_content_comic_chapters"}),headers:{"Content-Type":"application/json"}})}catch{return}const o=[],s=(await i.json()).data.get_content_comic_chapters.reverse();return(n?s.slice(n):s).forEach(c=>{var u;const p=c.chapters.find(h=>h.lang===t);if(!p)return;const d=(u=p.cids)==null?void 0:u[0];if(!p||!d)return;const g=c.serial;o.push({slug:`${d}-${t}-ch.${g}`,chap:g,ts:c.datePublic})}),{chapters:o,lang:t,asc:!1,hasMore:!1,total:o.length}}transformRawTitleData(e){var t,r,n,l;return{url:e.urlPath,slug:e.id+"",name:e.name,langs:(r=(t=e.chart_count_lang_to_serials)==null?void 0:t.map)==null?void 0:r.call(t,i=>{var o;return(o=i?.field)==null?void 0:o.toLowerCase()}).filter(Boolean),img:(l=(n=e.urlCover300)!=null?n:e.urlCover600)!=null?l:e.urlCoverOri,tags:this.getTagIdsFromNames(e.genres)}}async getReaderPrevNext(){let e,t;return await I(20,100,async()=>{const r=await M("main a.btn",{lazy:!0,all:!0});if(r!=null&&r.length)return e=r.find(n=>{var l;return(l=n.textContent)==null?void 0:l.toLowerCase().includes("prev")}),t=r.find(n=>{var l;return(l=n.textContent)==null?void 0:l.toLowerCase().includes("next")}),e||t?!0:void 0}),{prev:this.getChapterFromBtn(e),next:this.getChapterFromBtn(t)}}getChapterFromBtn(e){const t=e?.getAttribute("href");if(!t)return;const r=t.split("/").filter(Boolean).slice(-1)[0];if(!r)return;const n=E(r.split("-").slice(2).join("-"));if(n)return H({slug:r,lang:r.split("-")[1]||void 0},n)}async getTitleChapters(){const e=[],t=await M(".file-list-by-serial time[time]",{lazy:!0,all:!0});if(!(t!=null&&t.length))return e;let r;return t.forEach(n=>{var l,i,o,s;const c=n.parentElement;for(let u=0;u<5;u++){const p=c?.parentElement,d=p?.querySelector('a[href*="/title/"]');if(!d)continue;const g=(l=d.getAttribute("href"))==null?void 0:l.split("/").filter(Boolean)[2],h=(i=d.textContent)==null?void 0:i.replace(/(\n|\t)/g," ").trim(),y=E(h);if(!y||!g||r&&r.chap==y.chap&&((o=r.vol)!=null?o:0)==((s=y.vol)!=null?s:0))break;const v=+n.getAttribute("time");r=K(H({},y),{slug:g,lang:g.split("-")[1]||void 0,ts:v===v&&typeof v=="number"?v:void 0}),e.push(r);break}}),A(e)}getPageData(){return I(100,50,()=>{var e,t,r,n,l,i,o,s;return(s=(o=(i=(l=(n=(r=(t=(e=window.__NEXT_DATA__)==null?void 0:e.props)==null?void 0:t.pageProps)==null?void 0:r.dehydratedState)==null?void 0:n.queries)==null?void 0:l[0])==null?void 0:i.state)==null?void 0:o.data)==null?void 0:s.data})}getPrefLangs(){return I(100,50,()=>{var e,t,r,n,l;const i=(t=(e=window.__NEXT_DATA__)==null?void 0:e.props)==null?void 0:t.pageProps;if(!i)return;const o=(l=(n=(r=i?.extra)==null?void 0:r.sets)==null?void 0:n.general_prefLangs)==null?void 0:l.filter(Boolean);return o!=null&&o.length?o:["en"]})}}nt.specId="mangapark";function lt(a,e){const t=a[0]===e?a.substring(1):a;return t[t.length-1]===e?t.substring(0,t.length-1):t}var or=Object.defineProperty,sr=Object.defineProperties,cr=Object.getOwnPropertyDescriptors,it=Object.getOwnPropertySymbols,ur=Object.prototype.hasOwnProperty,pr=Object.prototype.propertyIsEnumerable,ot=(a,e,t)=>e in a?or(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,z=(a,e)=>{for(var t in e||(e={}))ur.call(e,t)&&ot(a,t,e[t]);if(it)for(var t of it(e))pr.call(e,t)&&ot(a,t,e[t]);return a},J=(a,e)=>sr(a,cr(e));class st extends S{async getRawReleasesData(){const e=await super.getRawReleasesData();if(e)return J(z({},e),{siteMeta:dr(this.spec.releases,this.siteMeta)})}async getRawTitleData(){var e;const t=await super.getRawTitleData();if(!t)return;const r=q(location.pathname);let n;if((e=t.chapters)!=null&&e.length){const l=this.spec.title.chapter,i=document.querySelector(l.sel),o=x(f(l.url,{root:i}));o&&(n=q(o))}return J(z({},t),{siteMeta:ee(this.siteMeta,{titleBase:r,readerBase:n})})}async getRawReaderData(){const e=await super.getRawReaderData();if(e)return J(z({},e),{siteMeta:ee(this.siteMeta,{titleBase:q(x(e.title.url)),readerBase:q(location.pathname),idBase:ct()}),title:J(z({},e.title),{id:await this.getReaderTitleId()})})}async getRawSearchData(){const e=await super.getRawSearchData();if(!e)return;const t=this.spec.search.title,r=document.querySelector(t.sel),n=f(t.url,{root:r});return J(z({},e),{siteMeta:ee(this.siteMeta,{titleBase:q(x(n)),idBase:ct()})})}async getReaderTitleId(){var e,t;const r=await((t=(e=window.HISTORY)==null?void 0:e.getStored)==null?void 0:t.call(e));if(!r||typeof r!="object")return;const n=Object.values(r).filter(Boolean);if(n.length)return n.sort((l,i)=>i.time-l.time),n[0].manga_ID}}st.specId="mangastream";function dr(a,e){var t,r;if(!a)return;const n=J(z({},e),{releases:lt(location.pathname,"/")}),l=a.title,i=(t=document.querySelector(l.sel))!=null?t:void 0;if(!i)return;const o=x(f(l.url,{root:i}));if(o===void 0)return;const s=(r=i.querySelector(l.chapter.sel))!=null?r:void 0;if(!s)return;const c=x(f(l.chapter.url,{root:s}));if(c!==void 0)return n.titleBase=q(o),n.readerBase=q(c),e.titleIdType===se.id&&(f(l.id,{root:i})||(e.titleIdType=se.name)),ee(e,n)}function ct(){return document.querySelector('link[rel="shortlink"][href*="/?p="]')?"?p=":void 0}function ee(a,e){const t=Object.keys(e),r=z({},a);let n=!1;return t.forEach(l=>{const i=e[l];i!==a[l]&&(r[l]=i,n=!0)}),n?r:void 0}function q(a){return lt(a,"/").split("/").slice(0,-1).join("/")}var gr=Object.defineProperty,hr=Object.defineProperties,vr=Object.getOwnPropertyDescriptors,ut=Object.getOwnPropertySymbols,fr=Object.prototype.hasOwnProperty,mr=Object.prototype.propertyIsEnumerable,pt=(a,e,t)=>e in a?gr(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,ge=(a,e)=>{for(var t in e||(e={}))fr.call(e,t)&&pt(a,t,e[t]);if(ut)for(var t of ut(e))mr.call(e,t)&&pt(a,t,e[t]);return a},dt=(a,e)=>hr(a,vr(e));class gt extends S{async getRawReaderData(){const e=await super.getRawReaderData();if(!e)return e;let t=e.title.id;if(!t){const r=this.spec.reader.title;r.id&&await M(r.id.split("|")[0],{lazy:!0}),t=f(r.id)}return dt(ge({},e),{title:dt(ge({},e.title),{id:t,chapters:await yr(t),hasMoreChapters:!1})})}resolveTitleSlug(e){const t=super.resolveTitleSlug(e);if(!t)return;const r=t.lastIndexOf("-"),n=+t.substring(r+1);return r===-1||isNaN(n)||n<1e3?t:t.substring(0,r)}}gt.specId="nettruyen";async function yr(a){var e;if(!a)return[];const t=await fetch(`/Comic/Services/ComicService.asmx/ProcessChapterList?comicId=${a}`).then(r=>r.status===200?r.json():void 0).catch(()=>[]);return(e=t?.chapters)!=null&&e.length?A(t.chapters.map(r=>{const{name:n,url:l}=r,i=E(n);if(!(!i||!l))return ge({slug:x(l).split("/").filter(Boolean).slice(2).join("/")},i)})):[]}var wr=Object.defineProperty,br=Object.defineProperties,$r=Object.getOwnPropertyDescriptors,te=Object.getOwnPropertySymbols,ht=Object.prototype.hasOwnProperty,vt=Object.prototype.propertyIsEnumerable,ft=(a,e,t)=>e in a?wr(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,G=(a,e)=>{for(var t in e||(e={}))ht.call(e,t)&&ft(a,t,e[t]);if(te)for(var t of te(e))vt.call(e,t)&&ft(a,t,e[t]);return a},X=(a,e)=>br(a,$r(e)),mt=(a,e)=>{var t={};for(var r in a)ht.call(a,r)&&e.indexOf(r)<0&&(t[r]=a[r]);if(a!=null&&te)for(var r of te(a))e.indexOf(r)<0&&vt.call(a,r)&&(t[r]=a[r]);return t};class yt extends S{async getRawTitleData(){const e=await super.getRawTitleData();return e&&X(G({},e),{hasMoreChapters:!!he()})}async getRawChaptersData(){var e,t;const r=await this.getRawTitleData();if(!(r!=null&&r.hasMoreChapters))return r;const n=(e=this.context)==null?void 0:e.findContinue;if(n){const d=await this.findContinueChapters({rawTitleData:r,chapter:n});return d?{chapters:d,title:X(G({},r),{chapters:[]})}:void 0}const l=(t=this.context)==null?void 0:t.skip,i=r,{chapters:o}=i,s=mt(i,["chapters"]),c=o.length,u=l&&l>=c?Math.floor(l/c)+1:void 0;if(!u)return{chapters:o,title:X(G({},s),{chapters:[]}),hasMore:!!he()};const p=await this.getChaptersByPage({page:u,titleSlug:r.slug});return{chapters:p??[],title:X(G({},s),{chapters:[]}),hasMore:!!he(u),asc:!1,skip:l}}async findContinueChapters(e){var t=e,{rawTitleData:r,chapter:{chap:n},curPage:l=1,cacheChaptersByPage:i={}}=t,o=mt(t,["rawTitleData","chapter","curPage","cacheChaptersByPage"]),s,c;const u=(s=i[l])!=null?s:r.chapters,p=u[u.length-1].chap<=n,d=(c=o.maxPage)!=null?c:Rr();if(p){if(u[0].chap>n){const m=[...u].reverse().find(j=>j.chap>n);return m?[m]:u.slice(0,1)}if(l<=1)return u.slice(0,1)}else if(l===d)return u.slice(-1);const g=r.chapters.length,h=Object.keys(i).map(m=>+m).sort((m,j)=>m-j),y=p?-1:1,v=h[h.indexOf(l)+y];if(v===l+y)return p?i[v].slice(-1).concat(u.slice(0,1)):u.slice(-1).concat(i[v].slice(0,1));const $=p?n-u[0].chap:u[0].chap-n,R=Math.floor($/g)+1,b=p?Math.max(R,(v??1)+1):Math.min(R,(v??d+1)-1,d),P=await this.getChaptersByPage({page:b,titleSlug:r.slug});if(P)return await this.findContinueChapters({rawTitleData:r,chapter:{chap:n},curPage:b,maxPage:d,cacheChaptersByPage:X(G({},i),{1:r.chapters,[b]:P})})}async getChaptersByPage({page:e,titleSlug:t}){const r=wt(e);if(!r)return;const n=this.spec.title.chapter,l=n.sel,i=document.querySelector(l),o=I(100,30,()=>{const s=document.querySelector(l);if(s&&i!==s)return!0;r.click()});return r.click(),await o,await this.getChapters(n,{lazy:!1,titleSlug:t})}}yt.specId="reaper";function he(a=1){return wt(a+1)}function wt(a){const e=`span[wire\\:key="paginator-page-1-page${a}"] button,button[aria-label="Go to page ${a}"]`;return document.querySelector(e)}function Rr(){const a=Array.from(document.querySelectorAll('span[wire\\:key^="paginator-page-"]'));return a.length?+a[a.length-1].getAttribute("wire:key").split("-").slice(-1)[0].replace("page",""):1}var Or=Object.defineProperty,Pr=Object.defineProperties,Sr=Object.getOwnPropertyDescriptors,bt=Object.getOwnPropertySymbols,jr=Object.prototype.hasOwnProperty,Dr=Object.prototype.propertyIsEnumerable,$t=(a,e,t)=>e in a?Or(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,ae=(a,e)=>{for(var t in e||(e={}))jr.call(e,t)&&$t(a,t,e[t]);if(bt)for(var t of bt(e))Dr.call(e,t)&&$t(a,t,e[t]);return a},re=(a,e)=>Pr(a,Sr(e));class Rt extends S{async getRawTitleData(){var e,t;const r=await super.getRawTitleData();if(!r)return;const n=(e=f(".info-detail__row > .genre-btn,.info__right .stats__row:first-child|text",{returnAll:!0}))==null?void 0:e.map(l=>[l,...l.split(" ")]).flat();return Ot(re(ae({},r),{tags:(t=this.getTagIdsFromNames(n))!=null?t:[]}),".episode-header .episode-cnt")}async getRawReaderData(){const e=await super.getRawReaderData();if(e)return re(ae({},e),{title:Ot(re(ae({},e.title),{url:`${location.origin}/series/${e.title.slug}/info`,tags:[]}),".episode-list .js-ep-cnt")})}async getRawChaptersData(){if(!this.context)return;const{rawId:e,skip:t}=this.context,r=1e3,n=t?Math.floor(t/1e3)+1:1;try{const l=await fetch(`/series/${e}/episodes?page=${n}&sort=NEWEST&max_limit=${r}`);return Cr(await l.json())}catch{return}}resolveTitleSlug(e){var t;if(!e)return;const r=e.split("/").filter(Boolean);return(t=r[1])!=null?t:r[0]}}Rt.specId="tapas";function Ot(a,e){const t=xr(e)>20;return re(ae({},a),{chapters:t?[]:a.chapters,hasMoreChapters:t})}function Cr(a){var e,t,r;const n=(e=a?.data)==null?void 0:e.episodes;if(!Array.isArray(n))return;const l=n.map(o=>{var s,c,u;return{chap:(s=o.pending_scene)!=null?s:o.scene,slug:o.id+"",ts:((u=(c=new Date(o.publish_date))==null?void 0:c.valueOf)==null?void 0:u.call(c))||void 0}}),i=(t=a?.data)==null?void 0:t.pagination;return{chapters:l,total:(r=i?.total)!=null?r:l.length,hasMore:!!(i!=null&&i.has_next)}}function xr(a){var e;const t=document.querySelector(a);return+(((e=t?.textContent)==null?void 0:e.trim().split(" ")[0])||0)}var Tr=Object.defineProperty,Mr=Object.defineProperties,_r=Object.getOwnPropertyDescriptors,Pt=Object.getOwnPropertySymbols,Ir=Object.prototype.hasOwnProperty,Nr=Object.prototype.propertyIsEnumerable,St=(a,e,t)=>e in a?Tr(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,ve=(a,e)=>{for(var t in e||(e={}))Ir.call(e,t)&&St(a,t,e[t]);if(Pt)for(var t of Pt(e))Nr.call(e,t)&&St(a,t,e[t]);return a},fe=(a,e)=>Mr(a,_r(e));class jt extends S{async getRawTitleData(){var e,t;const r=new URLSearchParams(location.search),n=r.get("episode_no"),l=r.get("title_no");if(n||!l)return;const i=await super.getRawTitleData();if(!i)return;const o=location.pathname.split("/")[1];return fe(ve({},i),{id:l,langs:[o].filter(Boolean),chapters:i.chapters.map(s=>fe(ve({},s),{lang:o})),hasMoreChapters:((t=(e=document.querySelector(".paginate"))==null?void 0:e.childElementCount)!=null?t:1)>1})}async getRawReaderData(){var e;const t=new URLSearchParams(location.search),r=t.get("episode_no"),n=t.get("title_no");if(!r||!n)return;const l=+r;if(l!==l)return;const i=(e=document.title.split("|")[1])==null?void 0:e.trim();if(!i)return;const o=location.pathname.split("/"),s=`${o.slice(0,4).join("/")}/list?title_no=${n}`,c=await this.getChapters({sel:"#sequence_scroll li.eg-flick-panel,#toolbar .episode_lst li[data-episode-no]",url:"a|attr:href",label:"|attr:data-episode-no || .num|text"},{lazy:!1}),u=o[1];return{chap:l,lang:u,slug:`${location.pathname}?title_no=${n}&episode_no=${l}`,basePath:"",imgs:await this.getReaderImgs(),isWebtoon:!0,title:{id:n,url:s,slug:s,name:i,langs:[u],chapters:(c??[]).map(p=>fe(ve({},p),{lang:u})),hasMoreChapters:!1}}}async getReaderImgs(){const e=f("#_imageList img|[attr:data-url,attr:src]",{returnAll:!0});return e!=null&&e.length?e:await I(100,50,()=>{var t,r,n;return(n=(r=(t=window.__viewerState__)==null?void 0:t.scrollViewerParam)==null?void 0:r.imageList)==null?void 0:n.map(({url:l})=>l).filter(Boolean)})}resolveReaderSlug(e,t,r){if(!r)return t;if(r.startsWith("http://")||r.startsWith("https://")){const n=oe(r);return n.pathname+n.search}return r}}jt.specId="webtoon";const Br=[xe,Ne,Ae,Ve,st,gt,yt,Rt,tt,Ze,nt,jt];function Dt(a){var e;const t=(e=Br.find(r=>r.specId===a.spec.id))!=null?e:S;return new t(a)}var Lr=Object.defineProperty,Er=Object.defineProperties,Ar=Object.getOwnPropertyDescriptors,Ct=Object.getOwnPropertySymbols,kr=Object.prototype.hasOwnProperty,zr=Object.prototype.propertyIsEnumerable,xt=(a,e,t)=>e in a?Lr(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,Tt=(a,e)=>{for(var t in e||(e={}))kr.call(e,t)&&xt(a,t,e[t]);if(Ct)for(var t of Ct(e))zr.call(e,t)&&xt(a,t,e[t]);return a},Mt=(a,e)=>Er(a,Ar(e));async function qr(a){var e,t;const{spec:r}=a;if(r){const n=(e=a.siteMeta)!=null?e:r.meta,l=a.type?[a.type]:_t(n,r.generic);if(!l.length)return;const i=Dt(Mt(Tt({},a),{spec:r,siteMeta:n}));return await F(l.map(o=>i.getRawPageByType(o,l.length>1)))}return await F(((t=a.genericSpecs)!=null?t:[]).map(n=>{const l=_t(n.meta,n.generic);if(!l.length)return[];const i=Dt(Mt(Tt({},a),{spec:n,siteMeta:n.meta}));return l.map(o=>i.getRawPageByType(o,!0))}).flat())}function _t(a,e){if(location.pathname==="/")return[];const{titleBase:t,readerBase:r}=a,n=location.pathname.split("/").filter(Boolean),l=It(n,r),i=It(n,t);if(l!==i)return l>i?[O.reader]:[O.title];if(l>0)return[O.reader,O.title];if(n.length===1){const o=[!r&&O.reader,!t&&O.title].filter(Boolean);if(o.length)return o}return!r&&!t||e?[O.reader,O.title]:[]}function It(a,e){if(!e)return 0;const t=e.split("/").filter(Boolean),r=t.includes("{slug}"),n=a.length-t.length;return r&&n!==0||!r&&n<1?0:t.filter((l,i)=>a[i]===l||l==="{titleSlug}"||l==="{lang}"||l==="{slug}").length}U.PageType=O,U.scrape=qr});
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "trackkun-dom",
3
3
  "author": "endyquang",
4
- "version": "1.0.0",
4
+ "version": "1.0.1",
5
5
  "license": "UNLICENSED",
6
6
  "description": "Trkun DOM parser",
7
7
  "main": "index.js",