PageSourceSearch

https://novelzy.com/assets/reader-DDkMwoRn.js

js novelzy.com collected 2026-10-02 01:37:40 UTC 30,119 bytes, 40 lines download raw bytes

1import{u as dt,j as e}from"./vendor-query-6nO0aXI-.js";import{e as ut,u as pt,r as o}from"./vendor-router-yscda1MA.js";import{a as T}from"./api-B7OcOsYd.js";import{i as ht}from"./languages-n-zsb-Mz.js";import{X as gt,n as ft,M as De,o as Me,a as xt,C as mt,p as yt,q as bt,r as St}from"./vendor-ui-CtoxC0Mt.js";const ne={cream:{name:"cream",bg:"#FAF7F1",text:"#2D2520",muted:"#A09080",card:"#FFFFFF",border:"#EDE6DA",accent:"#BE465A",selection:"#BE465A25"},white:{name:"white",bg:"#FFFFFF",text:"#1A1A2E",muted:"#9CA3AF",card:"#F9FAFB",border:"#E5E7EB",accent:"#BE465A",selection:"#BE465A25"},sepia:{name:"sepia",bg:"#F4ECD8",text:"#5B4636",muted:"#9C8B7A",card:"#EFE5CF",border:"#E0D5BE",accent:"#A0522D",selection:"#A0522D25"},dark:{name:"dark",bg:"#1A1A1A",text:"#D4CFC8",muted:"#6B6560",card:"#242424",border:"#333333",accent:"#E8736B",selection:"#E8736B25"}},xe=[{key:"georgia",label:"Georgia",family:"Georgia, serif"},{key:"merriweather",label:"Merriweather",family:"'Merriweather', serif"},{key:"lora",label:"Lora",family:"'Lora', serif"},{key:"literata",label:"Literata",family:"'Literata', serif"},{key:"inter",label:"Inter",family:"'Inter', sans-serif"},{key:"opendyslexic",label:"OpenDyslexic",family:"'OpenDyslexic', sans-serif"}],vt=[{value:1.5,label:"Tight"},{value:1.7,label:"Normal"},{value:1.85,label:"Relaxed"},{value:2,label:"Wide"},{value:2.2,label:"X-Wide"}],jt={narrow:560,normal:660,wide:760},wt=[{value:"narrow",label:"Narrow"},{value:"normal",label:"Normal"},{value:"wide",label:"Wide"}],kt=[{value:"left",label:"Left"},{value:"justify",label:"Justified"}];function Ct(){if(document.getElementById("reader-fonts-link"))return;const r=document.createElement("link");if(r.id="reader-fonts-link",r.rel="stylesheet",r.href="https://fonts.googleapis.com/css2?family=Merriweather:ital,wght@0,400;0,700;1,400&family=Lora:ital,wght@0,400;0,600;0,700;1,400&family=Literata:ital,wght@0,400;0,600;1,400&family=Inter:wght@400;500;600&family=Playfair+Display:wght@700&display=swap",document.head.appendChild(r),!document.getElementById("reader-rtl-fonts-link")){const s=document.createElement("link");s.id="reader-rtl-fonts-link",s.rel="stylesheet",s.href="https://fonts.googleapis.com/css2?family=Noto+Naskh+Arabic:wght@400;500;700&family=Vazirmatn:wght@400;500;700&family=Noto+Sans+Hebrew:wght@400;500;700&display=swap",document.head.appendChild(s)}if(!document.getElementById("reader-dyslexic-link")){const s=document.createElement("link");s.id="reader-dyslexic-link",s.rel="stylesheet",s.href="https://fonts.cdnfonts.com/css/opendyslexic",document.head.appendChild(s)}}const Ye="nv-reader-v3";function zt(){try{const r=JSON.parse(localStorage.getItem(Ye)||"{}");return{fontSize:typeof r.fontSize=="number"?r.fontSize:18,fontFamily:typeof r.fontFamily=="string"?r.fontFamily:"georgia",lineHeight:typeof r.lineHeight=="number"?r.lineHeight:1.85,theme:r.theme in ne?r.theme:"cream",textAlign:r.textAlign==="justify"?"justify":"left",contentWidth:["narrow","normal","wide"].includes(r.contentWidth)?r.contentWidth:"normal"}}catch{return{fontSize:18,fontFamily:"georgia",lineHeight:1.85,theme:"cream",textAlign:"left",contentWidth:"normal"}}}function At(r){localStorage.setItem(Ye,JSON.stringify(r))}function Tt(r){return r>=1e3?(r/1e3).toFixed(1)+"K":String(r)}function $t(r){return r.replace(/<br\s*\/?>/gi,`
2`).replace(/<\/p>\s*<p[^>]*>/gi,`
3
4`).replace(/<\/?(p|div)[^>]*>/gi,`
5`).replace(/<[^>]+>/g,"").replace(/&nbsp;/g," ").replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#39;/g,"'").trim()}function Oe(r){if(!r)return[];const s=/<\/?(p|br|div|h[1-6])\b/i.test(r)?$t(r):r,u=s.includes(`
6
7`)?/\n\n+/:/\n+/;return s.split(u).map(h=>h.trim()).filter(Boolean)}function Pe(r,s){let u=r.replace(new RegExp("(?<![*\\w])--(?![*\\w])","g"),"—");u=u.replace(/"([^"\n]*)"/g,"“$1”").replace(/(\w)'(\w)/g,"$1’$2");const h=[],g=/\*([^*\n]+)\*|_([^_\n]+)_/g;let p=0,d,m=0;for(;(d=g.exec(u))!==null;)d.index>p&&h.push(e.jsx("span",{children:u.slice(p,d.index)},`${s}-t${m++}`)),h.push(e.jsx("em",{style:{fontStyle:"italic"},children:d[1]||d[2]},`${s}-e${m++}`)),p=d.index+d[0].length;return p<u.length&&h.push(e.jsx("span",{children:u.slice(p)},`${s}-t${m++}`)),h.length?h:[u]}function Et(r){if(r.length>60||/[.!?]$/.test(r))return!1;const s=r.replace(/[^A-Za-z]/g,"");return s.length<3?!1:s===s.toUpperCase()}function qe({paragraphs:r,fontSize:s,lineHeight:u,fontFamily:h,theme:g,textAlign:p}){let d=!1;return e.jsx(e.Fragment,{children:r.map((m,y)=>{const b=m;if(/^(\*\s?\*\s?\*|---+|—{2,}|\.{3,}|~ ~ ~|⁂|#)$/.test(b))return e.jsx("div",{style:{textAlign:"center",padding:"24px 0",color:g.muted,fontSize:16,letterSpacing:12},children:"· · ·"},y);if(b.startsWith("# ")||b.startsWith("## ")||Et(b)){const L=b.replace(/^#+\s*/,"");return e.jsx("h3",{style:{fontFamily:h,fontSize:s+4,fontWeight:700,color:g.text,textAlign:"center",margin:`${s*2}px 0 ${s}px`,letterSpacing:1},children:L},y)}if(b.startsWith(">")){const L=b.replace(/^>\s?/gm,"");return e.jsx("blockquote",{style:{fontFamily:h,fontSize:s-1,fontStyle:"italic",color:g.muted,lineHeight:u,margin:`${s}px 0`,padding:`${s}px ${s*1.2}px`,borderLeft:`3px solid ${g.accent}30`,background:g.name==="dark"?"rgba(255,255,255,.03)":"rgba(0,0,0,.02)",borderRadius:"0 8px 8px 0",textAlign:"left"},children:Pe(L,`bq${y}`)},y)}const w=/^["\u201C\u201D\u2018\u2019«'—–]/.test(b),re=!d;d||(d=!0);const $={fontFamily:h,fontSize:s,lineHeight:u,color:g.text,marginBottom:s*1.1,marginTop:0,textAlign:p,WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale",textRendering:"optimizeLegibility",hyphens:p==="justify"?"auto":"manual",WebkitHyphens:p==="justify"?"auto":"manual",wordBreak:"break-word",overflowWrap:"break-word"};return e.jsx("p",{style:{...$,textIndent:!w&&!re?s*1.5:0,fontStyle:w?"normal":void 0},children:Pe(b,`p${y}`)},y)})})}function Ht(){const r=ut(),s=r.slug,u=r.chapterNumber?parseInt(r.chapterNumber):void 0,h=r.chapterId?parseInt(r.chapterId):void 0,[,g]=pt(),p=zt(),[d,m]=o.useState(p.fontSize),[y,b]=o.useState(p.fontFamily),[w,re]=o.useState(p.lineHeight),[$,L]=o.useState(p.theme),[I,Ge]=o.useState(p.textAlign),[O,Je]=o.useState(p.contentWidth),[ye,ie]=o.useState(!0),[P,oe]=o.useState(!1),[R,be]=o.useState(0),[W,Se]=o.useState(!1),[ve,je]=o.useState(0),[we,ke]=o.useState(!1),[B,Ce]=o.useState(!1),[q,se]=o.useState([]),[H,ae]=o.useState(""),[X,ze]=o.useState(!1),[le,Ae]=o.useState(!1),[Y,Te]=o.useState(!1),[ce,$e]=o.useState(0),[Ee,Fe]=o.useState(!1),Le=o.useRef(Date.now()),de=o.useRef(0),[G,_]=o.useState(""),[ue,N]=o.useState(null),[Ke,E]=o.useState(!1),J=o.useRef(null),K=o.useRef(null),t=ne[$],D=xe.find(n=>n.key===y)||xe[0],Ve=jt[O],pe=!!s&&u!==void 0,{data:z,isLoading:Ue}=dt({queryKey:pe?["chapter-slug",s,u]:["chapter-id",h],queryFn:pe?()=>T.getChapterBySlug(s,u):()=>T.getChapter(h),enabled:pe?!0:!!h}),a=z?.chapter,V=z?.novel_title,k=z?.novel_slug||s||"",v=z?.prev,Qe=z?.next,U=z?.total,M=z?.novel_language,j=ht(M),Ie=j?M==="he"?"'Noto Sans Hebrew', 'Noto Naskh Arabic', system-ui, sans-serif":M==="fa"||M==="ps"||M==="ur"?"'Vazirmatn', 'Noto Naskh Arabic', Tahoma, sans-serif":"'Noto Naskh Arabic', 'Vazirmatn', Tahoma, sans-serif":D.family,Q=j&&I==="justify"?"right":I,Ze=o.useMemo(()=>Oe(a?.content||""),[a?.content]),he=a?.word_count||0,Re=Math.max(0,Math.ceil(he*(1-R/100)/250)),[C,We]=o.useState([]),[Z,ge]=o.useState(!1),[Be,ee]=o.useState(null),He=o.useRef(null),fe=10,S=C.length>0?C[C.length-1].next:Qe,f=S;o.useEffect(()=>{We([]),ee(null),ge(!1)},[a?.id]),o.useEffect(()=>{if(!k||!S||S.is_free===!1||C.length>=fe||Z)return;const n=He.current;if(!n)return;const i=new IntersectionObserver(async c=>{if(c[0].isIntersecting&&!Z){ge(!0),ee(null);try{const l=await T.getChapterBySlug(k,S.chapter_number);l?.chapter&&We(x=>[...x,{chapter:l.chapter,next:l.next,paragraphs:Oe(l.chapter.content||"")}])}catch{ee("Could not load next chapter")}finally{ge(!1)}}},{rootMargin:"1200px 0px"});return i.observe(n),()=>i.disconnect()},[k,S?.chapter_number,S?.is_free,C.length,Z]),o.useEffect(()=>{Ct()},[]),o.useEffect(()=>{At({fontSize:d,fontFamily:y,lineHeight:w,theme:$,textAlign:I,contentWidth:O})},[d,y,w,$,I,O]),o.useEffect(()=>(document.body.style.backgroundColor=t.bg,()=>{document.body.style.backgroundColor=""}),[t.bg]),o.useEffect(()=>{if(!a)return;be(0),ie(!0),Fe(!1),$e(0),Le.current=Date.now(),de.current=0,window.scrollTo(0,0);const n=localStorage.getItem(`nv-bookmark-${a.id}`);if(n)try{const{scrollPercent:i}=JSON.parse(n);i>5&&i<95&&setTimeout(()=>{const c=document.documentElement.scrollHeight-window.innerHeight;window.scrollTo({top:c*(i/100),behavior:"auto"})},300)}catch{}},[a?.id]),o.useEffect(()=>{a&&(je(a.likes??0),Se(!1),Ce(!1),se([]),Ae(!1),ae(""))},[a?.id]),o.useEffect(()=>{let n;const i=()=>{const c=document.documentElement.scrollTop||document.body.scrollTop,l=document.documentElement.scrollHeight-document.documentElement.clientHeight,x=l>0?Math.min(100,c/l*100):0;be(x);const Ne=c-de.current;Ne>
720?(ie(!1),oe(!1)):Ne<-10&&ie(!0),de.current=c,a?.id&&(n&&window.clearTimeout(n),n=window.setTimeout(()=>{localStorage.setItem(`nv-bookmark-${a.id}`,JSON.stringify({scrollPercent:Math.round(x),timestamp:Date.now()}))},500))};return window.addEventListener("scroll",i,{passive:!0}),()=>{window.removeEventListener("scroll",i),n&&window.clearTimeout(n)}},[a?.id]),o.useEffect(()=>{if(Ee||R<90||!a)return;const n=Math.floor((a.word_count||0)/200*60*.3),i=(Date.now()-Le.current)/1e3;i<n||(Fe(!0),T.completeChapter(a.id,Math.round(i)).catch(()=>{}))},[R,Ee,a]),o.useEffect(()=>{let n=null,i=!1;const c=async()=>{try{const x=navigator;x.wakeLock?.request&&(n=await x.wakeLock.request("screen"))}catch{}},l=()=>{document.visibilityState==="visible"&&!i&&c()};return c(),document.addEventListener("visibilitychange",l),()=>{i=!0,document.removeEventListener("visibilitychange",l);try{n?.release()}catch{}}},[]),o.useEffect(()=>{const n=()=>{const i=window.getSelection(),c=i?.toString().trim()||"";if(c.length>1&&i&&i.rangeCount>0){const l=i.getRangeAt(0).getBoundingClientRect();if(l.width>0&&l.height>0){_(c);const x=130;N({top:Math.max(8,l.top-50),left:Math.min(window.innerWidth-x-8,Math.max(x+8,l.left+l.width/2))});return}}_(""),N(null)};return document.addEventListener("mouseup",n),document.addEventListener("touchend",n),()=>{document.removeEventListener("mouseup",n),document.removeEventListener("touchend",n)}},[]);const A=o.useCallback(n=>{k&&(window.scrollTo(0,0),g(`/novel/${k}/chapter/${n}`,{replace:!0}))},[k,g]);o.useEffect(()=>{const n=i=>{if(i.target instanceof HTMLInputElement||i.target instanceof HTMLTextAreaElement)return;const c=j?f:v,l=j?v:f;i.key==="ArrowLeft"&&c&&A(c.chapter_number),i.key==="ArrowRight"&&l&&A(l.chapter_number),(i.key==="+"||i.key==="=")&&m(x=>Math.min(28,x+1)),(i.key==="-"||i.key==="_")&&m(x=>Math.max(14,x-1)),i.key==="Escape"&&oe(!1)};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[v,f,A,j]);const et=n=>{J.current=n.touches[0].clientX,K.current=n.touches[0].clientY},tt=n=>{if(J.current===null||K.current===null)return;const i=J.current-n.changedTouches[0].clientX,c=Math.abs(K.current-n.changedTouches[0].clientY);if(J.current=null,K.current=null,c>60||window.getSelection()?.toString().trim())return;const l=80;i>l&&f?A(f.chapter_number):i<-l&&v&&A(v.chapter_number)},nt=async()=>{if(!(we||!a)){ke(!0);try{const n=await T.likeChapter(a.id);Se(n.liked),je(n.likes)}catch{}ke(!1)}},rt=async()=>{try{await navigator.clipboard.writeText(window.location.href)}catch{}Te(!0),setTimeout(()=>Te(!1),2500)},it=async()=>{try{await navigator.clipboard.writeText(G)}catch{}_(""),N(null),window.getSelection()?.removeAllRanges(),E(!0),setTimeout(()=>E(!1),1500)},ot=()=>{if(a){try{const n=`nv-highlights-${a.id}`,i=JSON.parse(localStorage.getItem(n)||"[]");i.push({text:G,ts:Date.now()}),localStorage.setItem(n,JSON.stringify(i))}catch{}_(""),N(null),window.getSelection()?.removeAllRanges(),E(!0),setTimeout(()=>E(!1),1500)}},st=async()=>{const n=window.location.href,i=`"${G}"
8
9— from ${V}
10${n}`;try{navigator.share?await navigator.share({title:V,text:i,url:n}):(await navigator.clipboard.writeText(i),E(!0),setTimeout(()=>E(!1),1500))}catch{}_(""),N(null),window.getSelection()?.removeAllRanges()},at=async()=>{if(!(le||!a)){try{const n=await T.getChapterComments(a.id);se(n.comments||[])}catch{}Ae(!0)}},lt=()=>{B||at(),Ce(n=>!n)},_e=async()=>{if(!(!H.trim()||X||!a)){ze(!0);try{const n=await T.addChapterComment(a.id,{content:H.trim()});n.comment&&se(i=>[n.comment,...i]),ae("")}catch{}ze(!1)}},ct=ye?3:-64;return Ue?e.jsxs("div",{style:{minHeight:"100vh",background:t.bg,display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column",gap:24},children:[e.jsx("div",{style:{width:200},children:[...Array(4)].map((n,i)=>e.jsx("div",{style:{height:12,borderRadius:6,background:t.border,marginBottom:12,width:`${90-i*12}%`,animation:"pulse 1.5s ease-in-out infinite"}},i))}),e.jsx("p",{style:{color:t.muted,fontSize:13,letterSpacing:"0.15em",textTransform:"uppercase"},children:"Loading chapter…"})]}):a?e.jsxs("div",{className:"reader-root",style:{background:t.bg,minHeight:"100vh",color:t.text},children:[e.jsx("div",{style:{position:"fixed",top:0,left:0,right:0,height:3,background:t.border,zIndex:200},children:e.jsx("div",{style:{height:"100%",width:`${R}%`,background:`linear-gradient(90deg, ${t.accent}, ${t.accent}cc)`,transition:"width 0.15s linear"}})}),e.jsxs("div",{style:{position:"fixed",top:ct,left:0,right:0,zIndex:150,transition:"top 0.25s ease",maxWidth:760,margin:"0 auto"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"10px 16px",gap:12,background:`${t.bg}f0`,backdropFilter:"blur(12px)",borderBottom:`1px solid ${t.border}`},children:[e.jsx("button",{onClick:()=>g(`/novel/${k}`,{replace:!0}),style:{width:36,height:36,borderRadius:"50%",border:`1px solid ${t.border}`,background:t.card,color:t.text,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},"data-testid":"link-back-reader",children:e.jsx(gt,{size:16})}),e.jsxs("div",{style:{flex:1,textAlign:"center",overflow:"hidden",minWidth:0},children:[e.jsxs("div",{style:{fontSize:11,color:t.muted,lineHeight:1.2,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:[V,R>5&&e.jsxs("span",{style:{marginLeft:8,opacity:.7},children:["· ",Re>0?`${Re} min left`:"Almost done"]})]}),e.jsxs("div",{style:{fontSize:13,fontWeight:600,fontFamily:D.family,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},"data-testid":"text-chapter-title",children:["Ch.",a.chapter_number,": ",a.title]})]}),e.jsx("button",{onClick:()=>oe(n=>!n),style:{width:36,height:36,borderRadius:"50%",border:`1px solid ${P?t.accent:t.border}`,background:P?t.accent:t.card,color:P?"#fff":t.text,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},"data-testid":"button-reader-settings",children:e.jsx("span",{style:{fontSize:14,fontWeight:700,fontFamily:"serif",lineHeight:1},children:"Aa"})})]}),P&&e.jsxs("div",{style:{background:t.bg,borderBottom:`1px solid ${t.border}`,padding:"16px 20px",display:"flex",flexDirection:"column",gap:18,animation:"slideDown .2s ease",maxHeight:"75vh",overflowY:"auto"},children:[e.jsx(F,{label:"Text Size",theme:t,children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[e.jsx("button",{onClick:()=>m(n=>Math.max(14,n-1)),style:Xe(t),children:"A-"}),e.jsx("input",{type:"range",min:14,max:28,value:d,onChange:n=>m(+n.target.value),style:{flex:1,accentColor:t.accent,height:4,cursor:"pointer"}}),e.jsx("button",{onClick:()=>m(n=>Math.min(28,n+1)),style:{...Xe(t),fontSize:18},children:"A+"}),e.jsxs("span",{style:{fontSize:12,color:t.muted,width:36,textAlign:"center",flexShrink:0},children:[d,"px"]})]})}),e.jsx(F,{label:"Line Spacing",theme:t,children:e.jsx("div",{style:{display:"flex",gap:6,flexWrap:"wrap"},children:vt.map(n=>e.jsx("button",{onClick:()=>
10re(n.value),style:te(t,w===n.value),children:n.label},n.value))})}),e.jsx(F,{label:"Font",theme:t,children:e.jsx("div",{style:{display:"flex",gap:6,flexWrap:"wrap"},children:xe.map(n=>e.jsx("button",{onClick:()=>b(n.key),style:{...te(t,y===n.key),fontFamily:n.family},children:n.label},n.key))})}),e.jsx(F,{label:"Alignment",theme:t,children:e.jsx("div",{style:{display:"flex",gap:6,flexWrap:"wrap"},children:kt.map(n=>e.jsx("button",{onClick:()=>Ge(n.value),style:te(t,I===n.value),children:n.label},n.value))})}),e.jsx(F,{label:"Margins",theme:t,children:e.jsx("div",{style:{display:"flex",gap:6,flexWrap:"wrap"},children:wt.map(n=>e.jsx("button",{onClick:()=>Je(n.value),style:te(t,O===n.value),children:n.label},n.value))})}),e.jsx(F,{label:"Theme",theme:t,children:e.jsx("div",{style:{display:"flex",gap:8},children:Object.keys(ne).map(n=>{const i=ne[n],c=$===n;return e.jsx("button",{onClick:()=>L(n),style:{width:48,height:40,borderRadius:10,cursor:"pointer",background:i.bg,border:`2px solid ${c?i.accent:i.border}`,display:"flex",alignItems:"center",justifyContent:"center",boxShadow:c?`0 0 0 2px ${i.accent}40`:"none",transition:"all .15s"},children:e.jsx("span",{style:{fontSize:14,fontWeight:700,color:i.text,fontFamily:"Georgia, serif"},children:"Aa"})},n)})})})]})]}),e.jsxs("div",{onTouchStart:et,onTouchEnd:tt,style:{maxWidth:Ve,margin:"0 auto",padding:`${ye?100:40}px 20px 80px`,transition:"padding-top 0.25s ease, max-width 0.2s ease"},children:[e.jsxs("header",{style:{textAlign:"center",marginBottom:40,paddingTop:16},children:[e.jsxs("div",{style:{fontSize:12,color:t.muted,marginBottom:8},children:["Chapter ",a.chapter_number,U?` of ${U}`:"",he>0&&e.jsxs(e.Fragment,{children:[" · ~",Math.ceil(he/250)," min read"]})]}),e.jsx("h1",{style:{fontSize:d+8,fontFamily:D.family,fontWeight:700,color:t.text,marginBottom:10,lineHeight:1.3},children:a.title})]}),e.jsx("div",{style:{textAlign:"center",color:t.muted,letterSpacing:12,fontSize:14,marginBottom:40,opacity:.5},children:"· · ·"}),e.jsx("article",{className:"reader-content","data-testid":"text-chapter-content",dir:j?"rtl":"ltr",style:j?{direction:"rtl",textAlign:Q}:void 0,children:e.jsx(qe,{paragraphs:Ze,fontSize:d,lineHeight:w,fontFamily:Ie,theme:t,textAlign:Q})}),C.map(n=>e.jsxs("section",{"data-chapter-id":n.chapter.id,children:[e.jsx("div",{style:{textAlign:"center",margin:"56px 0 32px",color:t.muted,letterSpacing:8,fontSize:14,opacity:.6},children:"· · ·"}),e.jsxs("header",{style:{textAlign:"center",marginBottom:24},children:[e.jsxs("div",{style:{fontSize:12,color:t.muted,marginBottom:6,letterSpacing:1,textTransform:"uppercase"},children:["Chapter ",n.chapter.chapter_number,U?` of ${U}`:""]}),e.jsx("h2",{style:{fontSize:d+6,fontFamily:D.family,fontWeight:700,color:t.text,margin:0,lineHeight:1.3},children:n.chapter.title})]}),e.jsx("div",{style:{textAlign:"center",color:t.muted,letterSpacing:12,fontSize:14,marginBottom:32,opacity:.5},children:"· · ·"}),e.jsx("article",{className:"reader-content",dir:j?"rtl":"ltr",style:j?{direction:"rtl",textAlign:Q}:void 0,children:e.jsx(qe,{paragraphs:n.paragraphs,fontSize:d,lineHeight:w,fontFamily:Ie,theme:t,textAlign:Q})})]},n.chapter.id)),S&&S.is_free!==!1&&C.length<fe&&e.jsx("div",{ref:He,style:{minHeight:1}}),Z&&e.jsxs("div",{style:{textAlign:"center",padding:"32px 0",color:t.muted,fontSize:13,letterSpacing:1},children:[e.jsx("div",{style:{display:"inline-block",width:22,height:22,borderRadius:"50%",border:`2px solid ${t.border}`,borderTopColor:t.accent,animation:"nv-spin 0.7s linear infinite",marginBottom:8}}),e.jsxs("div",{children:["Loading Ch. ",S?.chapter_number,"…"]}),e.jsx("style",{children:"@keyframes nv-spin { to { transform: rotate(360deg); } }"})]}),Be&&e.jsxs("div",{style:{textAlign:"center",padding:16,color:"#dc2626",fontSize:13},children:[Be," · ",e.jsx("button",{onClick:()=>{ee(null)},style:{border:"none",background:"none",color:t.accent,textDecoration:"underline",cursor:"pointer"},children:"retry"})]}),C.length>=fe&&S&&e.jsx("div",{style:{textAlign:"center",padding:16,color:t.muted,fontSize:12},children:'Tap "Next" below to keep reading'}),e.jsx("div",{style:{textAlign:"center",color:t.muted,fontSize:16,margin:"48px 0 24px",letterSpacing:4},children:"— ✦ —"}),e.jsxs("div",{style:{textAlign:"center",padding:20,margin:"16px 0 24px",background:t.card,borderRadius:14,border:`1px solid ${t.border}`},children:[e.jsx("div",{style:{fontSize:13,fontWeight:600,color:t.text,marginBottom:10},children:"How was this chapter?"}),e.jsx("div",{style:{display:"flex",justifyContent:"center",gap:8},children:[1,2,3,4,5].map(n=>e.jsx("button",{onClick:()=>$e(n),style:{background:"none",border:"none",cursor:"pointer",fontSize:28,color:n<=ce?"#f59e0b":t.border,transform:n<=ce?"scale(1.08)":"scale(1)",transition:"transform .15s, color .15s",lineHeight:1,padding:"2px 4px"},children:"★"},n))}),ce>0&&e.jsx("div",{style:{fontSize:12,color:t.accent,marginTop:8},children:"Thanks for rating! ⭐"})]}),e.jsxs("div",{style:{display:"flex",justifyContent:"center",gap:10,marginBottom:32,flexWrap:"wrap"},children:[e.jsxs("button",{onClick:nt,disabled:we,style:{display:"flex",alignItems:"center",gap:6,padding:"9px 20px",borderRadius:24,fontSize:14,fontWeight:500,cursor:"pointer",border:`1px solid ${W?t.accent:t.border}`,background:W?`${t.accent}18`:t.card,color:W?t.accent:t.text,transition:"all .2s"},children:[e.jsx(ft,{size:16,style:{fill:W?t.accent:"none",stroke:W?t.accent:"currentColor"}}),ve>0?Tt(ve):"Like"]}),e.jsxs("button",{onClick:lt,style:{display:"flex",alignItems:"center",gap:6,padding:"9px 20px",borderRadius:24,fontSize:14,fontWeight:500,cursor:"pointer",border:`1px solid ${B?t.accent:t.border}`,background:B?`${t.accent}18`:t.card,color:B?t.accent:t.text,transition:"all .2s"},children:[e.jsx(De,{size:16}),le&&q.length>0?`${q.length} Comments`:"Comments"]}),e.jsxs("button",{onClick:rt,style:{display:"flex",alignItems:"center",gap:6,padding:"9px 20px",borderRadius:24,fontSize:14,fontWeight:500,cursor:"pointer",border:`1px solid ${Y?"#22c55e":t.border}`,background:Y?"#22c55e18":t.card,color:Y?"#22c55e":t.text,transition:"all .2s"},children:[e.jsx(Me,{size:16}),Y?"Copied!":"Share"]})]}),B&&e.jsxs("div",{style:{marginBottom:40,borderRadius:16,overflow:"hidden",border:`1px solid ${t.border}`},children:[e.jsxs("div",{style:{padding:"14px 16px",borderBottom:`1px solid ${t.border}
10`,display:"flex",alignItems:"flex-start",gap:10},children:[e.jsx("div",{style:{width:32,height:32,borderRadius:"50%",background:t.accent,display:"flex",alignItems:"center",justifyContent:"center",color:"#fff",fontSize:13,fontWeight:700,flexShrink:0},children:"R"}),e.jsxs("div",{style:{flex:1},children:[e.jsx("textarea",{value:H,onChange:n=>ae(n.target.value),onKeyDown:n=>{n.key==="Enter"&&(n.ctrlKey||n.metaKey)&&_e()},placeholder:"Share your thoughts about this chapter…",rows:H?3:1,style:{width:"100%",borderRadius:10,border:`1px solid ${t.border}`,background:t.bg,color:t.text,padding:"8px 12px",fontSize:14,resize:"none",outline:"none",fontFamily:D.family}}),H&&e.jsx("button",{onClick:_e,disabled:X,style:{marginTop:8,padding:"6px 16px",borderRadius:8,border:"none",background:t.accent,color:"#fff",fontSize:13,fontWeight:600,cursor:"pointer",opacity:X?.7:1},children:X?"Posting…":"Post"})]})]}),le?q.length===0?e.jsxs("div",{style:{padding:"32px 16px",textAlign:"center",color:t.muted,fontSize:14},children:[e.jsx(De,{size:28,style:{margin:"0 auto 8px",display:"block",opacity:.3}}),"No comments yet. Be the first!"]}):q.map(n=>e.jsxs("div",{style:{padding:"12px 16px",borderBottom:`1px solid ${t.border}`,display:"flex",gap:10},children:[e.jsx("div",{style:{width:32,height:32,borderRadius:"50%",background:t.accent,display:"flex",alignItems:"center",justifyContent:"center",color:"#fff",fontSize:12,fontWeight:700,flexShrink:0},children:(n.user_display_name||"R")[0].toUpperCase()}),e.jsxs("div",{style:{flex:1},children:[e.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center",marginBottom:4},children:[e.jsx("span",{style:{fontSize:13,fontWeight:600,color:t.text},children:n.user_display_name||"Reader"}),e.jsx("span",{style:{fontSize:12,color:t.muted},children:new Date(n.created_at).toLocaleDateString(void 0,{month:"short",day:"numeric"})})]}),e.jsx("p",{style:{fontSize:14,lineHeight:1.6,color:t.text,margin:0,opacity:.9},children:n.content})]})]},n.id)):e.jsx("div",{style:{padding:24,textAlign:"center",color:t.muted,fontSize:14},children:"Loading…"})]}),e.jsxs("div",{style:{display:"flex",gap:12,marginBottom:24},children:[v?e.jsxs("button",{onClick:()=>A(v.chapter_number),style:{flex:1,padding:"16px 14px",borderRadius:14,cursor:"pointer",textAlign:"left",border:`1px solid ${t.border}`,background:t.card,color:t.text,display:"flex",flexDirection:"column",gap:4,transition:"border-color .2s"},children:[e.jsxs("div",{style:{fontSize:12,color:t.muted,display:"flex",alignItems:"center",gap:4},children:[e.jsx(xt,{size:14})," Previous"]}),e.jsxs("div",{style:{fontSize:13,fontWeight:600,lineHeight:1.3},children:["Ch.",v.chapter_number,": ",v.title]})]}):e.jsx("div",{style:{flex:1}}),f?e.jsxs("button",{onClick:()=>A(f.chapter_number),style:{flex:1,padding:"16px 14px",borderRadius:14,cursor:"pointer",textAlign:"right",border:`1px solid ${f.is_free===!1?t.border:t.accent}`,background:f.is_free===!1?t.card:t.accent,color:f.is_free===!1?t.text:"#fff",display:"flex",flexDirection:"column",gap:4,alignItems:"flex-end",transition:"all .2s"},children:[e.jsxs("div",{style:{fontSize:12,opacity:.8,display:"flex",alignItems:"center",gap:4},children:["Next ",e.jsx(mt,{size:14})]}),e.jsxs("div",{style:{fontSize:13,fontWeight:600,lineHeight:1.3},children:["Ch.",f.chapter_number,": ",f.title]}),f.is_free===!1&&e.jsxs("div",{style:{fontSize:12,display:"flex",alignItems:"center",gap:4,color:t.muted},children:[e.jsx(yt,{size:12})," 🪙 ",f.coin_price||5]})]}):e.jsx("div",{style:{flex:1,padding:"16px 14px",borderRadius:14,textAlign:"center",border:`1px solid ${t.border}`,background:t.card,color:t.muted,fontSize:13,display:"flex",alignItems:"center",justifyContent:"center"},children:"📚 You're all caught up! New chapters coming soon"})]}),e.jsx("div",{style:{textAlign:"center",marginBottom:48},children:e.jsxs("button",{onClick:()=>g(`/novel/${k}`,{replace:!0}),style:{padding:"10px 24px",borderRadius:24,fontSize:14,cursor:"pointer",border:`1px solid ${t.border}`,background:t.card,color:t.accent,fontWeight:500,transition:"all .2s"},children:['← Back to "',V,'"']})})]}
10),G&&ue&&e.jsxs("div",{style:{position:"fixed",top:ue.top,left:ue.left,transform:"translateX(-50%)",background:t.card,borderRadius:10,padding:"4px",boxShadow:"0 6px 20px rgba(0,0,0,.18)",border:`1px solid ${t.border}`,display:"flex",gap:2,zIndex:300,maxWidth:"calc(100vw - 16px)",flexWrap:"wrap",justifyContent:"center"},children:[e.jsxs("button",{onClick:it,title:"Copy",style:me(t),children:[e.jsx(bt,{size:14})," Copy"]}),e.jsxs("button",{onClick:ot,title:"Highlight",style:{...me(t),color:t.accent},children:[e.jsx(St,{size:14})," Highlight"]}),e.jsxs("button",{onClick:st,title:"Share",style:me(t),children:[e.jsx(Me,{size:14})," Share"]})]}),Ke&&e.jsx("div",{style:{position:"fixed",bottom:24,left:"50%",transform:"translateX(-50%)",background:t.card,color:t.text,border:`1px solid ${t.border}`,borderRadius:24,padding:"8px 16px",fontSize:13,fontWeight:500,boxShadow:"0 4px 16px rgba(0,0,0,.12)",zIndex:400},children:"✓ Done"}),e.jsx("style",{children:`
11        @keyframes slideDown {
12          from { opacity: 0; transform: translateY(-8px); }
13          to   { opacity: 1; transform: translateY(0); }
14        }
15        @keyframes pulse {
16          0%, 100% { opacity: 1; }
17          50% { opacity: 0.4; }
18        }
19        * { box-sizing: border-box; }
20        button { font-family: inherit; }
21        textarea { font-family: inherit; box-sizing: border-box; }
22        input[type=range] { -webkit-appearance: none; appearance: none; height: 4px; border-radius: 2px; outline: none; }
23        input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%; background: ${t.accent}; cursor: pointer; }
24
25        .reader-root { transition: background-color 0.3s ease, color 0.3s ease; }
26        .reader-content {
27          -webkit-font-smoothing: antialiased;
28          -moz-osx-font-smoothing: grayscale;
29          text-rendering: optimizeLegibility;
30          font-feature-settings: 'kern' 1, 'liga' 1;
31          -webkit-text-size-adjust: 100%;
32          text-size-adjust: 100%;
33          word-spacing: 0.02em;
34          letter-spacing: 0.005em;
35        }
36        .reader-content ::selection { background: ${t.selection}; }
37        .reader-content p, .reader-content h3, .reader-content blockquote {
38          transition: color 0.3s ease;
39        }
40      `})]}):e.jsxs("div",{style:{minHeight:"100vh",background:t.bg,display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column",gap:16},children:[e.jsx("div",{style:{fontSize:48},children:"📖"}),e.jsx("p",{style:{color:t.muted,fontSize:15},children:"Chapter not found"}),e.jsx("button",{onClick:()=>g("/"),style:{color:t.accent,fontSize:14,border:"none",background:"none",cursor:"pointer"},children:"← Go Home"})]})}function F({label:r,theme:s,children:u}){return e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:11,color:s.muted,marginBottom:8,fontWeight:600,letterSpacing:"0.08em",textTransform:"uppercase"},children:r}),u]})}function Xe(r){return{width:32,height:32,borderRadius:8,border:`1px solid ${r.border}`,background:r.card,color:r.text,cursor:"pointer",fontSize:16,fontWeight:700,display:"flex",alignItems:"center",justifyContent:"center"}}function te(r,s){return{padding:"6px 12px",borderRadius:8,fontSize:13,cursor:"pointer",border:`1.5px solid ${s?r.accent:r.border}`,background:s?`${r.accent}18`:r.card,color:s?r.accent:r.text,fontWeight:s?600:400}}function me(r){return{display:"flex",alignItems:"center",gap:4,padding:"6px 10px",borderRadius:6,border:"none",background:"none",fontSize:12,color:r.text,cursor:"pointer",fontWeight:500}}export{Ht as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.