1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/guideBook-XcUfAKKk.js","assets/index-CGi0bt1A.js","assets/react-D88zDUjx.js","assets/epub-iBTXOzSI.js","assets/index-BPp4UNtk.css"])))=>i.map(i=>d[i]); 2import{i as ve,j as e,w as ne,_ as Fe,K as Ct,m as Oe,x as Re,M as on,N as ln,O as cn,e as dn,Q as un,b as hn,I as gn,y as fn,A as pn,F as mn,R as yn,S as pt,T as xn,g as bn,U as vn,V as wn}from"./index-CGi0bt1A.js";import{r as l,R as oe,a as et,d as St}from"./react-D88zDUjx.js";import"./epub-iBTXOzSI.js";function _n({message:t,onReLogin:n}){const{t:s}=ve();return e.jsx("div",{className:"sim-overlay",children:e.jsxs("div",{className:"sim-modal",children:[e.jsx("div",{className:"sim-icon",children:"â ï¸"}),e.jsx("h2",{className:"sim-title",children:s("session.invalidTitle")||"ç»å½å·²å¤±æ"}),e.jsx("p",{className:"sim-message",children:t}),e.jsx("p",{className:"sim-hint",children:s("session.invalidHint")||"å½å设å¤å·²ç»åºã"}),e.jsx("button",{type:"button",className:"sim-btn",onClick:n,children:s("session.reLogin")||"éæ°ç»å½"})]})})}const Lt="easeverse_dismissed_notifications",jn=6e4;function kn(){try{const t=sessionStorage.getItem(Lt);if(!t)return new Set;const n=JSON.parse(t);return new Set(Array.isArray(n)?n:[])}catch{return new Set}}function Nn(t){try{sessionStorage.setItem(Lt,JSON.stringify(Array.from(t)))}catch{}}function Cn(t){return t?t==="zh-TW"?"zh_tw":t:"en"}function Sn(t,n){const s=[Cn(n),"zh","en"];for(const c of s){const g=t[`title_${c}`],f=t[`body_${c}`];if(g&&f)return{title:g,body:f}}return null}function Ln(){const{t,language:n}=ve(),[s,c]=l.useState([]),[g,f]=l.useState(()=>kn()),y=l.useCallback(async()=>{const b=await ne.getActiveNotifications();c(Array.isArray(b==null?void 0:b.notifications)?b.notifications:[])},[]);l.useEffect(()=>{let b=!1,i=null;const M=async()=>{b||typeof document<"u"&&document.hidden||await y()};M(),i=setInterval(M,jn);const o=()=>{document.hidden||M()};return document.addEventListener("visibilitychange",o),()=>{b=!0,i&&clearInterval(i),document.removeEventListener("visibilitychange",o)}},[y]);const a=b=>{const i=new Set(g);i.add(b),f(i),Nn(i)},v=s.filter(b=>!g.has(b.id));return v.length===0?null:e.jsx(e.Fragment,{children:v.map(b=>{const i=Sn(b,n);return i?e.jsxs("div",{className:"app-notification-banner",role:"status",children:[e.jsxs("div",{className:"app-notification-text",children:[e.jsx("span",{className:"app-notification-title",children:i.title}),e.jsx("span",{className:"app-notification-body",children:i.body})]}),e.jsx("button",{type:"button",className:"app-notification-dismiss",onClick:()=>a(b.id),"aria-label":t("notification.dismiss")||"Dismiss",title:t("notification.dismiss")||"Dismiss",children:"Ã"})]},b.id):null})})}function zn({kind:t,pages:n,quota:s,fileName:c,onConfirm:g,onCancel:f,onUpgrade:y}){const{t:a}=ve(),v=(s==null?void 0:s.monthlyLimit)??0,b=(s==null?void 0:s.dailyLimit)??0,i=(s==null?void 0:s.monthlyUsed)??0,M=(s==null?void 0:s.dailyUsed)??0,o=Math.max(0,v-i),d=Math.max(0,b-M),u=Math.max(0,o-n),_=Math.max(0,d-n),D=(s==null?void 0:s.perBookCap)??0,x=v>0&&u<v*.2,S=b>0&&_<b*.2,j=L=>a("library.pdf.unit.pages",{n:L}),m=t==="upgrade"?"library.pdf.upgrade.title":t==="per_book_cap"?"library.pdf.error.perBookCapTitle":t==="quota_exceeded"?"library.pdf.error.quotaExceededTitle":t==="unreadable"?"library.pdf.error.unreadableTitle":"library.pdf.confirm.title",C=t==="confirm"?g:y,$=t==="confirm"?"library.pdf.confirm.confirm":"library.pdf.upgrade.cta",A=t!=="unreadable";return e.jsx("div",{className:"pcd-overlay",onClick:f,children:e.jsxs("div",{className:"pcd-modal",onClick:L=>L.stopPropagation(),role:"dialog","aria-modal":"true",children:[e.jsxs("header",{className:"pcd-head",children:[e.jsx("h2",{className:"pcd-title",children:a(m)}),e.jsxs("div",{className:"pcd-fileline",children:[e.jsx("span",{className:"pcd-filename",title:c,children:c}),n>0&&e.jsx("span",{className:"pcd-pagebadge",children:j(n)})]})]}),t==="confirm"&&e.jsxs("section",{className:"pcd-body",children:[e.jsx("p",{className:"pcd-summary",children:a("library.pdf.confirm.summary",{pages:n})}),e.jsxs("div",{className:"pcd-quota-table",children:[e.jsxs("div",{className:"pcd-quota-header",children:[e.jsx("span",{}),e.jsx("span",{children:a("library.pdf.confirm.colCurrent")}
2),e.jsx("span",{"aria-hidden":!0,children:"â"}),e.jsx("span",{children:a("library.pdf.confirm.colAfter")})]}),e.jsxs("div",{className:"pcd-quota-row",children:[e.jsxs("span",{className:"pcd-quota-label",children:[a("library.pdf.confirm.rowDaily"),e.jsxs("span",{className:"pcd-quota-cap",children:["/ ",j(b)]})]}),e.jsx("span",{className:"pcd-quota-num",children:d}),e.jsx("span",{className:"pcd-quota-arrow","aria-hidden":!0,children:"â"}),e.jsx("span",{className:`pcd-quota-num pcd-quota-after ${S?"pcd-warn":""}`,children:_})]}),e.jsxs("div",{className:"pcd-quota-row",children:[e.jsxs("span",{className:"pcd-quota-label",children:[a("library.pdf.confirm.rowMonthly"),e.jsxs("span",{className:"pcd-quota-cap",children:["/ ",j(v)]})]}),e.jsx("span",{className:"pcd-quota-num",children:o}),e.jsx("span",{className:"pcd-quota-arrow","aria-hidden":!0,children:"â"}),e.jsx("span",{className:`pcd-quota-num pcd-quota-after ${x?"pcd-warn":""}`,children:u})]})]})]}),t==="per_book_cap"&&e.jsxs("section",{className:"pcd-body",children:[e.jsx("p",{className:"pcd-error-line",children:a("library.pdf.error.perBookCapBody",{pages:n,cap:D})}),e.jsxs("div",{className:"pcd-bar",children:[e.jsx("div",{className:"pcd-bar-fill pcd-bar-over",style:{width:`${Math.min(100,n/Math.max(D,1)*100)}%`}}),e.jsx("div",{className:"pcd-bar-cap-marker",style:{left:"100%"},"aria-label":`cap ${D}`})]}),e.jsx("p",{className:"pcd-bar-legend",children:e.jsx("span",{children:a("library.pdf.error.perBookCapLegend",{pages:n,cap:D})})})]}),t==="quota_exceeded"&&e.jsxs("section",{className:"pcd-body",children:[e.jsx("p",{className:"pcd-error-line",children:a("library.pdf.error.quotaExceededBody",{pages:n})}),e.jsxs("div",{className:"pcd-quota-table",children:[e.jsxs("div",{className:"pcd-quota-row",children:[e.jsx("span",{className:"pcd-quota-label",children:a("library.pdf.confirm.rowDaily")}),e.jsx("span",{className:"pcd-quota-num",children:d}),e.jsx("span",{className:"pcd-quota-arrow","aria-hidden":!0,children:"·"}),e.jsx("span",{className:"pcd-quota-need",children:a("library.pdf.error.needs",{pages:n})})]}),e.jsxs("div",{className:"pcd-quota-row",children:[e.jsx("span",{className:"pcd-quota-label",children:a("library.pdf.confirm.rowMonthly")}),e.jsx("span",{className:"pcd-quota-num",children:o}),e.jsx("span",{className:"pcd-quota-arrow","aria-hidden":!0,children:"·"}),e.jsx("span",{className:"pcd-quota-need",children:a("library.pdf.error.needs",{pages:n})})]})]})]}),t==="upgrade"&&e.jsxs("section",{className:"pcd-body",children:[e.jsx("p",{className:"pcd-summary",children:a("library.pdf.upgrade.body")}),e.jsxs("ul",{className:"pcd-benefits",children:[e.jsx("li",{children:a("library.pdf.upgrade.benefit1")}),e.jsx("li",{children:a("library.pdf.upgrade.benefit2")}),e.jsx("li",{children:a("library.pdf.upgrade.benefit3")})]})]}),t==="unreadable"&&e.jsxs("section",{className:"pcd-body",children:[e.jsx("p",{className:"pcd-error-line",children:a("library.pdf.error.unreadableBody")}),e.jsxs("ul",{className:"pcd-causes",children:[e.jsx("li",{children:a("library.pdf.error.unreadableCause1")}),e.jsx("li",{children:a("library.pdf.error.unreadableCause2")}),e.jsx("li",{children:a("library.pdf.error.unreadableCause3")})]})]}),e.jsxs("footer",{className:"pcd-actions",children:[e.jsx("button",{type:"button",className:"pcd-btn pcd-btn-secondary",onClick:f,children:a(A?"library.pdf.confirm.cancel":"library.pdf.error.dismiss")}),A&&e.jsx("button",{type:"button",className:"pcd-btn pcd-btn-primary",onClick:C,children:a($)})]})]})})}function Bn({fileName:t,chapters:n=[],totalPages:s=0,outlineQuality:c="good",quota:g=null,alreadyConvertedIndices:f=[],cachedPages:y=[],isScanOnly:a=!1,charsPerPage:v=0,tocHarvested:b=!1,onSubmit:i,onClose:M,busy:o=!1,error:d=null}){const{t:u}=ve(),[_,D]=l.useState(!1),x=l.useMemo(()=>new Set(f),[f]),[S,j]=l.useState(()=>new Set(n.map((R,ee)=>ee)));l.useEffect(()=>{j(new Set(n.map((R,ee)=>ee)))},[n.length]);const m=l.useMemo(()=>{let R=0;for(const ee of S){const H=n[ee];H&&(R+=H.pageCount)}return R},[S,n]),C=l.useMemo(()=>{let R=0;for(const ee of S){const H=n[ee];H&&(x.has(H.chapterIndex)||(R+=H.pageCount))}return R},[S,n,x]),$=m-C,A=l.useMemo(()=>new Set(y),[y]),L=l.useMemo(()=>
2{if(A.size===0)return 0;let R=0;for(const ee of S){const H=n[ee];if(H&&!x.has(H.chapterIndex))for(let he=H.startPage;he<=H.endPage;he++)A.has(he)&&R++}return Math.min(R,C)},[S,n,x,A,C]),W=C-L,q=_&&W>0,G=Math.ceil(L/2)+(q?Math.ceil(W/2):W),k=(g==null?void 0:g.perBookCap)??0,z=(g==null?void 0:g.monthlyLimit)??0,Y=(g==null?void 0:g.monthlyUsed)??0,K=(g==null?void 0:g.dailyLimit)??0,ie=(g==null?void 0:g.dailyUsed)??0,E=Math.max(0,z-Y),T=Math.max(0,K-ie),p=Math.max(0,E-G),I=Math.max(0,T-G),Z=k>0&&C>k,Q=z>0&&G>E,te=K>0&&G>T,ae=!(S.size===0)&&!Z&&!Q&&!te&&!o,me=z>0&&p<z*.2,fe=K>0&&I<K*.2,de=R=>{const ee=n[R];return ee!=null&&x.has(ee.chapterIndex)},pe=R=>{de(R)||j(ee=>{const H=new Set(ee);return H.has(R)?H.delete(R):H.add(R),H})},w=()=>j(new Set(n.map((R,ee)=>ee))),U=()=>{j(R=>{const ee=new Set;for(let H=0;H<n.length;H++){if(de(H)){ee.add(H);continue}R.has(H)||ee.add(H)}return ee})},O=()=>{if(!ae)return;const R=Array.from(S).sort((ee,H)=>ee-H);i(R,{batch:q})},P=n.filter(R=>R.displayTitle).length,se=!b||P===0?"none":P===n.length?"full":"partial",ce=se==="full"?"chapterSelection.tocHarvested":se==="partial"?"chapterSelection.tocHarvestedPartial":c==="sparse"?"chapterSelection.outlineSparse":c==="heuristic"?"chapterSelection.outlineHeuristic":c==="fallback_single"?"chapterSelection.fallbackSingle":c==="fallback_chunks"?"chapterSelection.fallbackChunks":null,_e=R=>c==="fallback_chunks"?R.displayTitle||u("chapterSelection.pageRangeTitle",{start:R.startPage,end:R.endPage})||`${R.startPage}â${R.endPage}`:R.displayTitle||R.title;return e.jsx("div",{className:"pcd-overlay",onClick:o?void 0:M,children:e.jsxs("div",{className:"pcd-modal csm-modal",onClick:R=>R.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"csm-title",children:[e.jsxs("header",{className:"pcd-head",children:[e.jsx("h2",{className:"pcd-title",id:"csm-title",children:u("chapterSelection.title")||"éæ©è¦è½¬æ¢çç« è"}),e.jsxs("div",{className:"pcd-fileline",children:[e.jsx("span",{className:"pcd-filename",title:t,children:t}),s>0&&e.jsx("span",{className:"pcd-pagebadge",children:u("library.pdf.unit.pages",{n:s})})]})]}),e.jsxs("div",{className:"csm-body",children:[ce&&e.jsx("div",{className:"csm-quality-hint",role:"status",children:u(ce)}),o&&n.length===0?e.jsxs("div",{className:"csm-loading-outline",role:"status","aria-live":"polite",children:[e.jsx("div",{className:"csm-spinner","aria-hidden":!0}),e.jsx("p",{children:u("chapterSelection.loadingOutline")||"æ£å¨è§£æç« èâ¦"})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"csm-toolbar",children:[e.jsx("button",{type:"button",className:"csm-tool-btn",onClick:w,disabled:o,children:u("chapterSelection.selectAll")||"å
¨é"}),e.jsx("button",{type:"button",className:"csm-tool-btn",onClick:U,disabled:o,children:u("chapterSelection.invertSelection")||"åé"}),e.jsx("span",{className:"csm-tool-spacer"}),e.jsxs("span",{className:"csm-tool-counter",children:[u("chapterSelection.selectedCount",{n:S.size,pages:m})||`å·²é ${S.size} ç« / ${m} 页`,$>0&&e.jsx("span",{className:"csm-tool-counter-free",children:u("chapterSelection.includesFreePages",{pages:$})||`ï¼å
¶ä¸ ${$} 页å
è´¹ï¼`})]})]}),e.jsx("ul",{className:"csm-chapter-list",children:n.map((R,ee)=>{const H=S.has(ee),he=x.has(R.chapterIndex);return e.jsx("li",{className:`csm-row ${H?"csm-row-checked":""} ${he?"csm-row-paid":""}`,children:e.jsxs("label",{className:"csm-row-label",children:[e.jsx("input",{type:"checkbox",checked:H,onChange:()=>pe(ee),disabled:o||he}),e.jsx("span",{className:"csm-row-title",title:_e(R),children:_e(R)}),e.jsx("span",{className:"csm-row-pages",children:u("library.pdf.unit.pages",{n:R.pageCount})}),he&&e.jsx("span",{className:"csm-row-paid-badge",children:u("chapterSelection.alreadyConverted")||"â 已转æ¢"})]})},R.chapterIndex??ee)})}),e.jsxs("div",{className:"csm-footer-summary",children:[W>0&&e.jsxs("label",{className:`csm-batch-option ${_?"csm-batch-on":""}`,children:[e.jsx("input",{type:"checkbox",checked:_,onChange:R=>D(R.target.checked),disabled:o}),e.jsxs("span",{className:"csm-batch-copy",children:[e.jsx("span",{className:"csm-batch-title",children:u("chapterSelection.batchTitle")||"æ
¢é转æ¢ï¼é
é¢åå"}),e.jsx("span",{className:"csm-batch-hint",children:u("chapterSelection.batchHint")||"é常æ°å°æ¶å
å®æï¼æè¿æ¬¡æ¥ï¼å®æå书æ¶ä¸å³å¯é
读"})]})]}),C>0&&G!==C&&e.jsxs("div",{className:"csm-charge-summary",role:"status",children:[u("chapterSelection.chargeSummary",{pages:G})||`æ¬æ¬¡å°æ£ ${G} 页é
é¢`,L>0&&e.jsx("span",{className:"csm-charge-cached",children:u("chapterSelection.cachedDiscount",{pages:L})||`ï¼${L} 页å½ä¸å
±äº«ç¼åï¼åä»·ï¼`})]}),(z>0||K>0)&&e.jsxs("div",{className:"pcd-quota-table csm-quota-table",children:[e.jsxs("div",{className:"pcd-quota-header",children:[e.jsx("span",{}),e.jsx("span",{children:u("library.pdf.confirm.colCurrent")}
2),e.jsx("span",{"aria-hidden":!0,children:"â"}),e.jsx("span",{children:u("library.pdf.confirm.colAfter")})]}),K>0&&e.jsxs("div",{className:"pcd-quota-row",children:[e.jsxs("span",{className:"pcd-quota-label",children:[u("library.pdf.confirm.rowDaily"),e.jsxs("span",{className:"pcd-quota-cap",children:["/ ",u("library.pdf.unit.pages",{n:K})]})]}),e.jsx("span",{className:"pcd-quota-num",children:T}),e.jsx("span",{className:"pcd-quota-arrow","aria-hidden":!0,children:"â"}),e.jsx("span",{className:`pcd-quota-num pcd-quota-after ${fe?"pcd-warn":""} ${te?"csm-warn-num":""}`,children:te?`â${G-T}`:I})]}),z>0&&e.jsxs("div",{className:"pcd-quota-row",children:[e.jsxs("span",{className:"pcd-quota-label",children:[u("library.pdf.confirm.rowMonthly"),e.jsxs("span",{className:"pcd-quota-cap",children:["/ ",u("library.pdf.unit.pages",{n:z})]})]}),e.jsx("span",{className:"pcd-quota-num",children:E}),e.jsx("span",{className:"pcd-quota-arrow","aria-hidden":!0,children:"â"}),e.jsx("span",{className:`pcd-quota-num pcd-quota-after ${me?"pcd-warn":""} ${Q?"csm-warn-num":""}`,children:Q?`â${G-E}`:p})]})]}),Z&&e.jsx("div",{className:"csm-quota-line csm-warn",children:u("chapterSelection.exceedsCap",{cap:k})||`è¶
åºåæ¬ä¸é ${k} 页`}),(Q||te)&&!Z&&e.jsx("div",{className:"csm-quota-line csm-warn",children:u("chapterSelection.exceedsQuota",{pages:G})||"éä¸é¡µæ°è¶
åºå©ä½é
é¢ï¼è¯·åå°éæ©"}),d&&e.jsx("div",{className:"csm-quota-line csm-warn",role:"alert",children:d})]})]})]}),e.jsxs("footer",{className:"pcd-actions",children:[e.jsx("button",{type:"button",className:"pcd-btn pcd-btn-secondary",onClick:M,disabled:o,children:u("library.pdf.confirm.cancel")||"åæ¶"}),e.jsx("button",{type:"button",className:"pcd-btn pcd-btn-primary",onClick:O,disabled:!ae,children:o&&n.length>0?u("chapterSelection.submitting")||"æäº¤ä¸â¦":u("chapterSelection.startConversion")||"å¼å§è½¬æ¢"})]})]})})}async function Mn(t){try{const n=await t.arrayBuffer(),s=await Fe(()=>import("./pdfjs-DeWlx49F.js"),[]);if(!s.GlobalWorkerOptions.workerSrc){const g=(await Fe(async()=>{const{default:f}=await import("./pdf.worker.min-DVp0HCY1.js");return{default:f}},[])).default;s.GlobalWorkerOptions.workerSrc=g}const c=await s.getDocument({data:n,useSystemFonts:!1,disableFontFace:!0,verbosity:0}).promise;try{return c.numPages}finally{await c.destroy()}}catch{return null}}function Tn(t){const n=t==null?void 0:t.pdfPagesLimitMonthly;return n===void 0?(t==null?void 0:t.plan)!=="free"&&!!(t!=null&&t.plan):n!==0}function Pn(t){var n;return((n=t==null?void 0:t.detail)==null?void 0:n.error)==="pdf_not_available"}function An({exts:t,pdfEnabled:n,readerPaid:s,currentCount:c,limit:g}){return!n&&t.includes(".pdf")?"pdf_upgrade":!s&&c+t.length>g?"book_limit":null}function Qe(t){return typeof(t==null?void 0:t.file_url)=="string"&&(t.file_url.startsWith("curated-books/")||t.file_url.includes("/curated-books/"))}function Dn(t){if(!t)return"";const n=new Date(t),c=new Date-n,g=Math.floor(c/6e4),f=Math.floor(c/36e5),y=Math.floor(c/864e5);return g<1?"Just now":g<60?`${g} min ago`:f<24?`${f} hour${f>1?"s":""} ago`:y<7?`${y} day${y>1?"s":""} ago`:n.toLocaleDateString()}function mt(t){if(!t)return null;try{const n=new Date(t),s=n.getFullYear(),c=String(n.getMonth()+1).padStart(2,"0"),g=String(n.getDate()).padStart(2,"0");return`${s}å¹´${c}æ${g}æ¥`}catch{return null}}function Xe(t){const n=[...t].sort((i,M)=>new Date(M.created_at)-new Date(i.created_at)),s=new Date,c=new Date(s.getTime()-7*24*60*60*1e3),g=s.getFullYear(),f=[],y=[],a={};for(const i of n){const M=new Date(i.created_at);if(M>=c)f.push(i);else if(M.getFullYear()===g)y.push(i);else{const o=M.getFullYear();a[o]||(a[o]=[]),a[o].push(i)}}const v=[];f.length&&v.push({labelKey:"library.last7Days",labelParam:void 0,books:f}),y.length&&v.push({labelKey:"library.thisYear",labelParam:void 0,books:y});const b=Object.keys(a).map(Number).sort((i,M)=>M-i);for(const i of b)v.push({labelKey:"library.yearUploaded",labelParam:{year:i},books:a[i]});return v}function En(t,n){const s=t.map(a=>{var v;return{book:a,finished_at:((v=n[a.id])==null?void 0:v.finished_at)||null}}).sort((a,v)=>a.finished_at?v.finished_at?new Date(v.finished_at)-new Date(a.finished_at):-1:1),c={};for(const{book:a,finished_at:v}of s){const b=v?new Date(v):null,i=b?b.getFullYear():0,M=b?b.getMonth():-1;c[i]||(c[i]={}),c[i][M]||(c[i][M]=[]),c[i][M].push(a)}const g=Object.keys(c).map(Number).filter(a=>a>0).sort((a,v)=>v-a),f=c[0]&&c[0][-1]?c[0][-1]:[],y=[];for(const a of g){const v=c[a],i=Object.keys(v).map(Number).sort((o,d)=>d-o).map(o=>({month:o,books:v[o]}
2)),M=i.reduce((o,d)=>o+d.books.length,0);y.push({labelKey:"library.yearFinishedCount",labelParam:{year:a,count:M},year:a,rows:i})}if(f.length){const a=new Date().getFullYear();y.push({labelKey:"library.yearFinishedCount",labelParam:{year:a,count:f.length},year:a,rows:[{month:null,books:f}]})}return y}function In({book:t}){const{t:n}=ve(),s=t==null?void 0:t.conversion_status;if(!s||s==="ready"||s==="failed")return null;if(s==="uploading"){const a=n("library.uploadingBadge")||"ä¸ä¼ ä¸â¦";return e.jsx("span",{className:`book-conversion-badge book-conversion-badge-${s}`,title:a,children:a})}if(s==="batch_pending"){const a=n("library.batchPendingBadge")||"æéä¸Â·æ
¢é";return e.jsx("span",{className:`book-conversion-badge book-conversion-badge-${s}`,title:n("reader.pdfBatch.hint")||a,children:a})}if(s==="pending_preview"){const a=n("library.pendingPreviewBadge")||"å¾
éç« è";return e.jsx("span",{className:`book-conversion-badge book-conversion-badge-${s}`,title:a,children:a})}const c=Number(t.chapters_total)||0,g=Number(t.chapters_completed)||0;let f,y;return c===0?(f=n("library.badgeExtracting")||"è§£æä¸",y=n("reader.pdfPreparing.stage1")||"è§£æ PDF ææ¬"):g<c?(f=`${n("library.badgeConverting")||"æ´ç"} ${g}/${c}`,y=`${n("reader.pdfPreparing.stage2")||"æ£å¨æ´ç为å¯è¯»æ ¼å¼"} (${g}/${c})`):(f=n("library.badgeFinishing")||"å³å°å®æ",y=n("reader.pdfPreparing.stage4")||"ä¿åå°äºç«¯"),e.jsx("span",{className:`book-conversion-badge book-conversion-badge-${s}`,title:y,children:f})}const We=oe.memo(In);function qe(t){if(!t)return!1;if(typeof t.outline_chapter_total!="number"||t.outline_chapter_total<=0)return!0;const n=t.selected_chapter_indices;let s=0;if(Array.isArray(n))s=n.length;else if(typeof n=="string")try{const c=JSON.parse(n);Array.isArray(c)&&(s=c.length)}catch{}return s<t.outline_chapter_total}function $n({book:t,index:n,showTime:s=!0,showFinishedDate:c=!1,showProgress:g=!1,selectionOpts:f=null,ctx:y}){var Q,te,re;const{cloudDownloading:a,bookCovers:v,coverLoading:b,localFileIds:i,cloudUploading:M,isPaid:o,justDidBoxSelectRef:d,bookProgress:u,t:_,getLastReadTime:D,isCloudOnly:x,isBookFinished:S,handleOpenBook:j,handleDelete:m,handleCloudUpload:C,openChapterPickerForBook:$,isAccessible:A}=y,L=A?!A(t.id):!1,W=Qe(t)?_("library.returnBook"):_("library.deleteBook"),q=v[t.id],[G,k]=l.useState(!1),[z,Y]=l.useState(q);z!==q&&(Y(q),k(!1));const K=a[t.id]!=null,ie=a[t.id]||0,E=S(t.id),T=f==null?void 0:f.selectionMode,p=(f==null?void 0:f.selected)??!1,I=f==null?void 0:f.onToggleSelect,Z=f==null?void 0:f.finishedAt;return e.jsxs("article",{"data-book-id":t.id,className:`book-card ${K?"downloading":""} ${T?"selection-mode":""} ${p?"selected":""} ${L?"phantom":""}`,style:{animationDelay:`${n*30}ms`},onClick:()=>{if(!d.current){if(T&&I){I(t.id);return}K||j(t)}},children:[!T&&!L&&s&&e.jsx("span",{className:"book-time",children:Dn(D(t)||t.created_at)}),!T&&e.jsx("button",{className:"book-delete",onClick:ae=>m(ae,t.id),title:W,"aria-label":W,children:e.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("path",{d:"M6 18L18 6M6 6l12 12",strokeLinecap:"round",strokeLinejoin:"round"})})}),e.jsxs("div",{className:"book-cover",children:[T&&e.jsx("span",{className:`book-selection-check ${p?"checked":""}`,"aria-hidden":"true",children:p&&e.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("polyline",{points:"20 6 9 17 4 12"})})}),q&&!G?e.jsx("img",{src:q,alt:t.title,className:"book-cover-image",loading:"lazy",decoding:"async",onError:()=>k(!0)}):e.jsx("div",{className:`book-cover-placeholder ${b[t.id]?"loading":"no-cover"}`,children:b[t.id]?e.jsx("div",{className:"cover-spinner"}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"book-cover-initial",children:(t.title||"?").charAt(0).toUpperCase()}),e.jsx("span",{className:"book-cover-title",children:t.title})]})}),E&&!K&&e.jsx("span",{className:"book-finished-badge",title:_("library.finishedReading"),children:_("library.finishedShort")}),!Ct(t.file_type)&&!K&&e.jsx("span",{className:"format-disabled-badge",title:_("reader.formatTemporarilyUnavailable",{format:String(t.file_type||"").toUpperCase()}),children:String(t.file_type||"").toUpperCase()}),!K&&e.jsx(We,{book:t}),L&&!K&&e.jsx("span",{className:"phantom-badge",title:_("library.notAvailable"),children:e.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M20 16.58A5 5 0 0018 7h-1.26A8 8 0 104 15.25",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M8 17l8-8",strokeLinecap:"round"})]})}),!L&&x(t)&&!K&&e.jsx("span",{className:"cloud-badge",title:_("library.cloudOnly"),children:e.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("path",{d:"M20 16.58A5 5 0 0018 7h-1.26A8 8 0 104 15.25",strokeLinecap:"round",strokeLinejoin:"round"})})}),K&&e.jsxs("div",{className:"cloud-download-overlay",children:[e.jsxs("svg",{className:"cloud-download-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M12 4v12m0 0l-3-3m3 3l3-3",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M20 16.58A5 5 0 0018 7h-1.26A8 8 0 104 15.25",strokeLinecap:"round",strokeLinejoin:"round"})]}),e.jsxs("span",{className:"cloud-download-pct",children:[ie,"%"]}),e.jsx("div",{className:"cloud-download-bar",children:e.jsx("div",{className:"cloud-download-fill",style:{width:`${ie}%`}})})]}),!T&&!L&&o&&i.has(t.id)&&!t.file_url&&e.jsx("button",{type:"button",className:`book-cloud-btn ${M[t.id]?"uploading":""}`,onClick:ae=>C(ae,t),title:"Upload to cloud",children:e.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M12 16V8m0 0l-3 3m3-3l3 3",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M20 16.58A5 5 0 0018 7h-1.26A8 8 0 104 15.25",strokeLinecap:"round",strokeLinejoin:"round"})]})}),!T&&!L&&t.file_type==="epub_from_pdf"&&t.conversion_status==="ready"&&$&&qe(t)&&e.jsx("button",{type:"button",className:"book-add-chapters-btn",onClick:ae=>{ae.stopPropagation(),$(t)}
2,title:_("library.addChapters")||"å¢å ç« è",children:e.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",children:e.jsx("path",{d:"M12 5v14M5 12h14"})})})]}),e.jsx("h3",{className:"book-title",title:t.title,children:t.title}),g?e.jsxs("div",{className:"book-progress-row",children:[e.jsx("div",{className:"book-progress-bar",children:e.jsx("div",{className:"book-progress-fill",style:{width:`${Math.round(((Q=u[t.id])==null?void 0:Q.percentage)||0)}%`}})}),e.jsxs("span",{className:"book-progress-pct",children:[Math.round(((te=u[t.id])==null?void 0:te.percentage)||0),"%"]})]}):c?e.jsx("span",{className:"book-finished-date-label",children:mt((re=u[t.id])==null?void 0:re.finished_at)||"â"}):null,f&&"finishedAt"in f&&e.jsx("div",{className:"book-finished-date-wrap",children:e.jsx("span",{className:"book-finished-date",children:mt(Z)||"â"})})]},t.id)}const tt=oe.memo($n),Fn={en:"en",zh:"zh-CN","zh-TW":"zh-TW",fr:"fr",ja:"ja"},Ke={};function Rn(t,n){const s=Fn[n]||"en";return Ke[s]||(Ke[s]=new Intl.DateTimeFormat(s,{month:"long"})),Ke[s].format(new Date(2e3,t,1))}function Wn({books:t,ctx:n}){const{t:s,language:c}=ve(),g=n.bookProgress,f=l.useMemo(()=>En(t,g),[t,g]),y=new Date().getFullYear(),[a,v]=l.useState(()=>new Set([y])),b=l.useCallback(i=>{v(M=>{const o=new Set(M);return o.has(i)?o.delete(i):o.add(i),o})},[]);return f.length?e.jsx("ol",{className:"finished-timeline",children:f.map(i=>{const M=a.has(i.year);return e.jsxs("li",{className:"finished-timeline-year","data-expanded":M?"true":"false",children:[e.jsxs("button",{type:"button",className:"finished-timeline-year-head",onClick:()=>b(i.year),"aria-expanded":M,children:[e.jsx("span",{className:"finished-timeline-year-dot","aria-hidden":"true"}),e.jsx("span",{className:"finished-timeline-year-label",children:s(i.labelKey,i.labelParam)}),e.jsx("svg",{className:"finished-timeline-year-caret",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),M&&e.jsx("div",{className:"finished-timeline-year-body",children:i.rows.map(o=>e.jsxs("section",{className:"finished-timeline-month",children:[e.jsxs("h4",{className:"finished-timeline-month-title",children:[e.jsx("span",{className:"finished-timeline-month-dot","aria-hidden":"true"}),e.jsx("span",{className:"finished-timeline-month-name",children:o.month===null?s("library.otherFinishedCount",{count:o.books.length}):Rn(o.month,c)}),o.month!==null&&e.jsxs("span",{className:"finished-timeline-month-count",children:["· ",s("library.bookCount",{count:o.books.length})]})]}),e.jsx("div",{className:"books-grid-full",children:o.books.map((d,u)=>e.jsx(tt,{book:d,index:u,showTime:!1,showProgress:!1,showFinishedDate:!0,selectionOpts:null,ctx:n},d.id))})]},o.month??"no-date"))})]},i.year)})}):null}const qn=oe.memo(Wn),On=[{value:"cloud",labelKey:"library.filterCloud"},{value:"local",labelKey:"library.filterLocal"},{value:"curated",labelKey:"library.filterCurated"}],yt=()=>e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("polyline",{points:"20 6 9 17 4 12"})});function Hn({gridBookFilter:t,setGridBookFilter:n,bookList:s,t:c}){const[g,f]=l.useState(!1),y=l.useRef(null),{storage:a,language:v}=t,b=(a!=="all"?1:0)+(v!=="all"?1:0);l.useEffect(()=>{if(!g)return;const d=u=>{y.current&&!y.current.contains(u.target)&&f(!1)};return document.addEventListener("pointerdown",d),()=>document.removeEventListener("pointerdown",d)},[g]);const i=oe.useMemo(()=>{const d={};for(const u of s){const _=(u.language||"").toLowerCase();_&&_!=="und"&&(d[_]=(d[_]||0)+1)}return Object.entries(d).sort((u,_)=>_[1]-u[1])},[s]),M=d=>n(u=>({...u,storage:u.storage===d?"all":d})),o=d=>n(u=>({...u,language:u.language===d?"all":d}));return e.jsxs("div",{className:"grid-filter-wrap",ref:y,children:[e.jsxs("button",{type:"button",className:`btn-icon-action ${b>0?"btn-icon-action-active":""}`,onClick:()=>f(d=>!d),title:c("library.filter"),children:[e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M3 4h18l-7 8.5V18l-4 2v-7.5L3 4z"})}),b>0&&e.jsx("span",{className:"filter-badge",children:b})]}),g&&e.jsxs("div",{className:"grid-filter-dropdown",children:[e.jsx("div",{className:"grid-filter-section-label",children:c("library.filterStorageSection")}),On.map(d=>e.jsxs("button",{type:"button",className:a===d.value?"active":"",onClick:()=>
2M(d.value),children:[c(d.labelKey),a===d.value&&e.jsx(yt,{})]},d.value)),i.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"grid-filter-divider"}),e.jsx("div",{className:"grid-filter-section-label",children:c("library.filterLanguageSection")}),i.map(([d,u])=>e.jsxs("button",{type:"button",className:v===d?"active":"",onClick:()=>o(d),children:[c(`dashboard.langName.${d}`)||d.toUpperCase(),e.jsx("span",{className:"grid-filter-count",children:u}),v===d&&e.jsx(yt,{})]},d))]})]})]})}function Un({title:t,bookList:n,filterBaseList:s,gridViewType:c=null,ctx:g}){const{user:f,autoBackupEnabled:y,setAutoBackup:a}=Oe(),v=c==="all-books"&&!!(f!=null&&f.readerPaid),{bookProgress:b,localPinnedIds:i,gridSelectionMode:M,gridSelectedIds:o,gridBookFilter:d,boxSelectStart:u,boxSelectCurrent:_,gridScrollRef:D,isPaid:x,localFileIds:S,cloudUploading:j,t:m,goBackHome:C,setGridSelectionMode:$,setGridSelectedIds:A,setGridBookFilter:L,setLocalPinnedIds:W,setCloudUploading:q,setBooks:G,setLocalFileIds:k,setError:z,persistLocalPinned:Y,api:K,books:ie}=g,E=w=>{A(U=>{const O=new Set(U);return O.has(w)?O.delete(w):O.add(w),O})},T=()=>{W(w=>{const U=new Set(w);return o.forEach(O=>U.add(O)),Y(U),U}),A(new Set),$(!1)},p=()=>{W(w=>{const U=new Set(w);return o.forEach(O=>U.delete(O)),Y(U),U}),A(new Set),$(!1)},I=async()=>{if(!x){z(m("library.cloudProOnly"));return}const w=[...o].filter(O=>S.has(O));if(w.length===0)return;z("");const U=4;for(let O=0;O<w.length;O+=U){const P=w.slice(O,O+U);q(se=>({...se,...Object.fromEntries(P.map(ce=>[ce,!0]))})),await Promise.all(P.map(async se=>{try{const{file_url:ce}=await K.uploadBookToCloud(se);G(_e=>_e.map(R=>R.id===se?{...R,file_url:ce}:R))}catch(ce){z(ce.message||m("library.uploadFailed")),console.error(ce),Re(ce.message||"Bulk cloud upload failed",{level:"error",stack:ce.stack,metadata:{source:"GridView.handleBulkUploadToCloud",bookId:se}})}finally{q(ce=>({...ce,[se]:!1}))}}))}A(new Set),$(!1)},Z=async()=>{if(o.size===0||!confirm(m("library.confirmRemoveFromLocal",{count:o.size})))return;z("");const w=new Set(o);try{const U=[];for(const O of w){const P=ie.find(se=>se.id===O);P!=null&&P.file_url?await K.freeLocalSpace(O):(await K.deleteBook(O),U.push(O))}k(O=>{const P=new Set(O);return w.forEach(se=>P.delete(se)),P}),U.length>0&&G(O=>O.filter(P=>!U.includes(P.id))),A(new Set),$(!1)}catch(U){z(m("library.deleteFailed")),Re(U.message||"Bulk remove from local failed",{level:"error",stack:U.stack,metadata:{source:"GridView.handleBulkRemoveFromLocal"}})}},Q=n.length,te=c==="finished",re=c==="reading",ae=te||re,me=d.storage!=="all"||d.language!=="all";let fe;if(ae||me){const w=me?[...n].sort((U,O)=>new Date(O.created_at)-new Date(U.created_at)):n;fe=w.length?[{labelKey:null,labelParam:void 0,books:w}]:[]}else if(c==="local-library"){const w=n.filter(P=>i.has(P.id)),U=n.filter(P=>!i.has(P.id));fe=[...w.length?[{labelKey:"library.pinToTop",labelParam:void 0,books:[...w].sort((P,se)=>new Date(se.created_at)-new Date(P.created_at))}]:[],...Xe(U)]}else fe=Xe(n);const de=!!c&&!ae,pe=de&&M?{selectionMode:!0,selected:w=>o.has(w),onToggleSelect:E}:null;return e.jsxs("section",{className:`grid-view ${de?"grid-view-cloud":""}`,children:[e.jsxs("div",{className:"grid-view-header",children:[e.jsx("button",{className:"btn-back",onClick:C,"aria-label":m("library.back"),children:e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M15 18l-6-6 6-6"})})}),e.jsxs("div",{className:"grid-view-header-left",children:[e.jsx("h2",{children:t}),e.jsx("span",{className:"grid-view-count",children:m("library.bookCount",{count:Q})})]}),e.jsxs("div",{className:"grid-view-header-right",children:[v&&e.jsxs("label",{className:"cloud-backup-toggle",title:m("library.cloudBackupDesc"),children:[e.jsx("input",{className:"cbt-input",type:"checkbox",checked:!!y,onChange:w=>a(w.target.checked)}),e.jsx("span",{className:"cbt-track","aria-hidden":"true",children:e.jsx("span",{className:"cbt-thumb"})}),e.jsx("span",{className:"cbt-label",children:m("library.cloudBackupToggle")})]}),c&&e.jsx(Hn,{gridBookFilter:d,setGridBookFilter:L,bookList:s||n,t:m}),de?M?e.jsxs("button",{type:"button",className:"btn-icon-action btn-icon-action-active",onClick:()=>{$(!1),A(new Set)},title:m("library.cancel"),children:[o.size>0&&e.jsx("span",{className:"select-count-badge",children:o.size}),e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M18 6L6 18M6 6l12 12"})})]}):e.jsx("button",{type:"button",className:"btn-icon-action",onClick:()=>$(!0),title:m("library.select"),children:e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"3",y:"3",width:"7",height:"7",rx:"1"}),e.jsx("rect",{x:"14",y:"3",width:"7",height:"7",rx:"1"}),e.jsx("rect",{x:"3",y:"14",width:"7",height:"7",rx:"1"}),e.jsx("rect",{x:"14",y:"14",width:"7",height:"7",rx:"1"})]})}):null]})]}),n.length===0?e.jsxs("div",{className:"books-empty",children:[e.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1",children:e.jsx("path",{d:"M12 6.042A8.967 8.967 0 006 3.75c-1.052 0-2.062.18-3 .512v14.25A8.987 8.987 0 016 18c2.305 0 4.408.867 6 2.292m0-14.25a8.966 8.966 0 016-2.292c1.052 0 2.062.18 3 .512v14.25A8.987 8.987 0 0018 18a8.967 8.967 0 00-6 2.292m0-14.25v14.25",strokeLinecap:"round",strokeLinejoin:"round"})}),e.jsx("p",{children:m("library.emptyTitle")})]}):te?e.jsx("div",{className:"grid-view-scroll",ref:D,children:e.jsx(qn,{books:n,ctx:g})}):e.jsx("div",{className:"grid-view-scroll",ref:D,children:fe.map((w,U)=>{var O;return e.jsxs("div",{className:"grid-view-section",children:[w.labelKey?e.jsx("h3",{className:"grid-view-section-title",children:w.labelParam?m(w.labelKey,w.labelParam):m(w.labelKey)}):e.jsx("h3",{className:"grid-view-section-title","aria-hidden":"true",style:{visibility:"hidden"},children:"Â "}),e.jsx("div",{className:"books-grid-full",children:w.books.map((P,se)=>e.jsx(tt,{book:P,index:se,showTime:!1,showProgress:re,showFinishedDate:te,selectionOpts:pe?{...pe,selected:pe.selected(P.id),pinned:c==="local-library"?i.has(P.id):!1}:null,ctx:g},P.id))})]},(w.labelKey||"flat")+(((O=w.labelParam)==null?void 0:O.year)??"")+U)})}),de&&u&&_&&(()=>{const w=D.current;if(!w)return null;const U=w.getBoundingClientRect(),O=U.left-w.scrollLeft+Math.min(u.x,_.x),P=U.top-w.scrollTop+Math.min(u.y,_.y);return e.jsx("div",{className:"box-select-overlay",style:{left:O,top:P,width:Math.abs(_.x-u.x),height:Math.abs(_.y-u.y)},"aria-hidden":!0})})(),de&&M&&e.jsxs("div",{className:"cloud-selection-bar",children:[e.jsxs("button",{type:"button",className:"cloud-selection-btn",onClick:()=>{const w=n.map(O=>O.id),U=w.length>0&&w.every(O=>o.has(O));A(U?new Set:new Set(w))},title:m("library.selectAll"),children:[e.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M9 11l3 3L22 4",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M21 12v7a2 2 0 01-2 2H5a2 2 0 01-2-2V5a2 2 0 012-2h11",strokeLinecap:"round",strokeLinejoin:"round"})]}),e.jsx("span",{children:m("library.selectAll")})]}),c==="local-library"&&(()=>{const w=o.size>0&&[...o].every(U=>i.has(U));return e.jsxs("button",{type:"button",className:"cloud-selection-btn",onClick:w?p:T,title:m(w?"library.unpinFromTop":"library.pinToTop"),children:[e.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("path",{d:"M18 15l-6-6-6 6",strokeLinecap:"round",strokeLinejoin:"round"})}),e.jsx("span",{children:m(w?"library.unpinFromTop":"library.pinToTop")})]})})(),x&&(()=>{const w=[...o].filter(O=>{var P;return S.has(O)&&!((P=ie.find(se=>se.id===O))!=null&&P.file_url)});if(w.length===0)return null;const U=w.some(O=>j[O]);return e.jsxs("button",{type:"button",className:`cloud-selection-btn ${U?"cloud-selection-btn-uploading":""}`,onClick:I,title:m("library.addToCloudShort"),disabled:U,children:[e.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M12 16V8m0 0l-3 3m3-3l3 3",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M20 16.58A5 5 0 0018 7h-1.26A8 8 0 104 15.25",strokeLinecap:"round",strokeLinejoin:"round"})]}),e.jsx("span",{children:m(U?"library.uploading":"library.addToCloudShort")})]})})(),e.jsxs("button",{type:"button",className:"cloud-selection-btn cloud-selection-btn-remove",onClick:Z,title:m("library.deleteShort"),children:[e.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("path",{d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16",strokeLinecap:"round",strokeLinejoin:"round"})}),e.jsx("span",{children:m("library.deleteShort")})]}),e.jsxs("button",{type:"button",className:"cloud-selection-btn",onClick:()=>{A(new Set),$(!1)},title:m("library.cancel"),children:[e.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("path",{d:"M18 6L6 18M6 6l12 12",strokeLinecap:"round",strokeLinejoin:"round"})}),e.jsx("span",{children:m("library.cancel")})]})]})]})}const Ce=oe.memo(Un),xt=80,Jn=14;
2function Gn({viewMode:t,gridScrollRef:n,justDidBoxSelectRef:s,setCloudSelectedIds:c,setCloudSelectionMode:g,setGridSelectedIds:f,setGridSelectionMode:y}){const a=l.useRef(!1),v=l.useRef({x:0,y:0}),b=l.useRef(0),[i,M]=l.useState(null),[o,d]=l.useState(null),[,u]=l.useState(0),_=l.useCallback((x,S)=>{const j=n.current;if(!j)return{x,y:S};const m=j.getBoundingClientRect();return{x:x-m.left+j.scrollLeft,y:S-m.top+j.scrollTop}},[n]),D=t==="cloud-library"||t==="all-books"||t==="local-library";return l.useEffect(()=>{if(!D)return;const x=S=>{if(S.button!==0||S.target.closest('button, a, input, textarea, select, [contenteditable="true"]'))return;a.current=!0;const j=_(S.clientX,S.clientY);M(j),d(j)};return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[D,_]),l.useEffect(()=>{if(i==null)return;const x=n.current,S=5,j=A=>{v.current={x:A.clientX,y:A.clientY},d(_(A.clientX,A.clientY));const L=A.clientY;L>=window.innerHeight-xt?b.current=1:L<=xt?b.current=-1:b.current=0},m=A=>{b.current=0;const L=_(A.clientX,A.clientY),W=Math.min(i.x,L.x),q=Math.min(i.y,L.y),G=Math.abs(L.x-i.x),k=Math.abs(L.y-i.y);if(M(null),d(null),a.current=!1,G>=S&&k>=S&&x){const z=x.getBoundingClientRect(),Y={left:z.left-x.scrollLeft+W,top:z.top-x.scrollTop+q,right:z.left-x.scrollLeft+W+G,bottom:z.top-x.scrollTop+q+k},K=x.querySelectorAll(".book-card[data-book-id]"),ie=[];K.forEach(E=>{const T=E.getAttribute("data-book-id");if(!T)return;const p=E.getBoundingClientRect();!(Y.right<p.left||Y.left>p.right||Y.bottom<p.top||Y.top>p.bottom)&&ie.push(T)}),ie.length>0&&(s.current=!0,setTimeout(()=>{s.current=!1},120),t==="cloud-library"?(c(E=>{const T=new Set(E);return ie.forEach(p=>{T.has(p)?T.delete(p):T.add(p)}),T}),g(!0)):(f(E=>{const T=new Set(E);return ie.forEach(p=>{T.has(p)?T.delete(p):T.add(p)}),T}),y(!0)))}},C=()=>u(A=>A+1),$=setInterval(()=>{const A=b.current;if(A===0)return;window.scrollBy(0,A*Jn);const{x:L,y:W}=v.current;d(_(L,W))},50);return document.addEventListener("mousemove",j),document.addEventListener("mouseup",m),x&&x.addEventListener("scroll",C,{passive:!0}),()=>{b.current=0,clearInterval($),document.removeEventListener("mousemove",j),document.removeEventListener("mouseup",m),x&&x.removeEventListener("scroll",C)}},[i,_,t,n,s,c,g,f,y]),{boxSelectStart:i,boxSelectCurrent:o,boxSelectActiveRef:a}}function Vn({books:t,localFileIds:n,api:s}){const[c,g]=l.useState({}),[f,y]=l.useState({}),a=l.useRef({}),v=l.useRef(c);l.useEffect(()=>{v.current=c},[c]);const b=l.useRef(f);l.useEffect(()=>{b.current=f},[f]),l.useEffect(()=>{try{localStorage.removeItem("easeverse_cover_cache")}catch{}},[]),l.useEffect(()=>()=>{Object.values(a.current).forEach(o=>{o!=null&&o.startsWith("blob:")&&URL.revokeObjectURL(o)})},[]);const i=l.useCallback(async o=>{var d;if(a.current[o.id])return a.current[o.id];y(u=>({...u,[o.id]:!0}));try{if(o.cover_url){const _=await s.fetchBookCoverFromCloud(o.id);if(_)return a.current[o.id]=_,g(D=>({...D,[o.id]:_})),y(D=>({...D,[o.id]:!1})),_}const u=await on(o.id);if(u!=null&&u.data){const _=URL.createObjectURL(u.data);return a.current[o.id]=_,g(D=>({...D,[o.id]:_})),y(D=>({...D,[o.id]:!1})),_}if((d=ln(o.file_type))!=null&&d.coverExtractor&&n.has(o.id)){const _=await cn(o.id);if(_){const D=await dn(_,o.file_type);if(D){const x=un(D);hn(o.id,x).catch(()=>{});const S=URL.createObjectURL(x);return a.current[o.id]=S,g(j=>({...j,[o.id]:S})),y(j=>({...j,[o.id]:!1})),S}}}return y(_=>({..._,[o.id]:!1})),null}catch(u){return console.warn("Failed to load cover for",o.title,u),y(_=>({..._,[o.id]:!1})),null}},[n,s]),M=l.useRef(n);return l.useEffect(()=>{const o=M.current,d=[];for(const u of n)o.has(u)||d.push(u);M.current=n,d.length!==0&&y(u=>{const _={...u};for(const D of d)v.current[D]||delete _[D];return _})},[n]),l.useEffect(()=>{t.length>0&&t.forEach(o=>{!v.current[o.id]&&b.current[o.id]===void 0&&i(o)})},[t,n,i]),{bookCovers:c,coverLoading:f}}function Yn({ctx:t}){const{books:n,cloudBooks:s,localFileIds:c,cloudPinnedIds:g,cloudSelectionMode:f,cloudSelectedIds:y,boxSelectStart:a,boxSelectCurrent:v,gridScrollRef:b,t:i,goBackHome:M,setCloudSelectionMode:o,setCloudSelectedIds:d,setCloudDownloading:u,setLocalFileIds:_,setError:D,setCloudPinnedIds:x,persist
2CloudPinned:S,api:j}=t,m=E=>{d(T=>{const p=new Set(T);return p.has(E)?p.delete(E):p.add(E),p})},C=async()=>{const E=[...y];D("");for(const T of E){const p=n.find(I=>I.id===T);if(!(!p||!p.file_url||c.has(T))){u(I=>({...I,[T]:0}));try{await j.fetchBookFileFromCloud(T,Z=>{u(Q=>({...Q,[T]:Z}))})&&_(Z=>new Set([...Z,T]))}catch(I){D(i("library.downloadFailed")),Re((I==null?void 0:I.message)||"Bulk download from cloud failed",{level:"error",stack:I==null?void 0:I.stack,metadata:{source:"CloudLibraryView.handleBulkDownload",bookId:T}})}finally{u(I=>{const Z={...I};return delete Z[T],Z})}}}d(new Set),o(!1)},$=async()=>{const E=[...y].filter(T=>c.has(T));if(E.length!==0&&confirm(i("library.confirmBulkFreeLocalSpace",{count:E.length}))){D("");for(const T of E)try{await j.freeLocalSpace(T)}catch(p){D(p.message||"Failed to free local space"),console.error(p),Re(p.message||"Failed to free local space",{level:"error",stack:p.stack,metadata:{source:"CloudLibraryView.handleBulkFreeLocalSpace",bookId:T}})}_(T=>{const p=new Set(T);return E.forEach(I=>p.delete(I)),p}),d(new Set),o(!1)}},A=()=>{x(E=>{const T=new Set(E);return y.forEach(p=>T.add(p)),S(T),T}),d(new Set),o(!1)},L=()=>{x(E=>{const T=new Set(E);return y.forEach(p=>T.delete(p)),S(T),T}),d(new Set),o(!1)},W=s.length,q=s.filter(E=>g.has(E.id)),G=s.filter(E=>!g.has(E.id)),k=q.length?[{labelKey:"library.pinToTop",labelParam:void 0,books:[...q].sort((E,T)=>new Date(T.created_at)-new Date(E.created_at))}]:[],z=Xe(G),Y=[...k,...z],K=f?{selectionMode:!0,selected:E=>y.has(E),onToggleSelect:m}:null,ie=y.size>0&&[...y].every(E=>g.has(E));return e.jsxs("section",{className:"grid-view grid-view-cloud",children:[e.jsxs("div",{className:"grid-view-header grid-view-header-cloud",children:[e.jsx("button",{className:"btn-back",onClick:M,"aria-label":i("library.back"),children:e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M15 18l-6-6 6-6"})})}),e.jsx("h2",{children:i("library.cloudLibrary")}),e.jsx("div",{className:"grid-view-header-right",children:f?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"grid-view-selected-count",children:i("library.selectedCount",{count:y.size})}),e.jsx("button",{type:"button",className:"btn-cancel-select",onClick:()=>{o(!1),d(new Set)},children:i("library.cancel")})]}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"grid-view-count",children:i("library.bookCount",{count:W})}),e.jsx("button",{type:"button",className:"btn-select",onClick:()=>o(!0),children:i("library.select")})]})})]}),W===0?e.jsxs("div",{className:"books-empty",children:[e.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1",children:e.jsx("path",{d:"M12 6.042A8.967 8.967 0 006 3.75c-1.052 0-2.062.18-3 .512v14.25A8.987 8.987 0 016 18c2.305 0 4.408.867 6 2.292m0-14.25a8.966 8.966 0 016-2.292c1.052 0 2.062.18 3 .512v14.25A8.987 8.987 0 0018 18a8.967 8.967 0 00-6 2.292m0-14.25v14.25",strokeLinecap:"round",strokeLinejoin:"round"})}),e.jsx("p",{children:i("library.emptyTitle")})]}):e.jsx("div",{className:"grid-view-scroll",ref:b,children:Y.map(E=>{var T;return e.jsxs("div",{className:"grid-view-section",children:[e.jsx("h3",{className:"grid-view-section-title",children:E.labelParam?i(E.labelKey,E.labelParam):i(E.labelKey)}),e.jsx("div",{className:"books-grid-full",children:E.books.map((p,I)=>e.jsx(tt,{book:p,index:I,showTime:!1,selectionOpts:K?{...K,selected:K.selected(p.id),pinned:g.has(p.id)}:{pinned:g.has(p.id)},ctx:t},p.id))})]},E.labelKey+(((T=E.labelParam)==null?void 0:T.year)??""))})}),a&&v&&(()=>{const E=b.current;if(!E)return null;const T=E.getBoundingClientRect(),p=T.left-E.scrollLeft+Math.min(a.x,v.x),I=T.top-E.scrollTop+Math.min(a.y,v.y);return e.jsx("div",{className:"box-select-overlay",style:{left:p,top:I,width:Math.abs(v.x-a.x),height:Math.abs(v.y-a.y)},"aria-hidden":!0})})(),f&&e.jsxs("div",{className:"cloud-selection-bar",children:[e.jsxs("button",{type:"button",className:"cloud-selection-btn",onClick:()=>{const E=Y.flatMap(p=>p.books.map(I=>I.id)),T=E.length>0&&E.every(p=>y.has(p));d(T?new Set:new Set(E))},title:i("library.selectAll"),children:[e.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M9 11l3 3L22 4",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M21 12v7a2 2 0 01-2 2H5a2 2 0 01-2-2V5a2 2 0 012-2h11",strokeLinecap:"round",strokeLinejoin:"round"})]}),e.jsx("span",{children:i("library.selectAll")})]}),e.jsxs("button",{type:"button",className:"cloud-selection-btn",onClick:ie?L:A,title:i(ie?"library.unpinFromTop":"library.pinToTop"),children:[e.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("path",{d:"M18 15l-6-6-6 6",strokeLinecap:"round",strokeLinejoin:"round"})}),e.jsx("span",{children:i(ie?"library.unpinFromTop":"library.pinToTop")})]}),e.jsxs("button",{type:"button",className:"cloud-selection-btn",onClick:C,title:i("library.downloadToLocal"),children:[e.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("path",{d:"M21 15v4a2 2 0 01-2 2H5a2 2 0 01-2-2v-4M7 10l5 5 5-5M12 15V3"})}),e.jsx("span",{children:i("library.downloadToLocal")})]}),e.jsxs("button",{type:"button",className:"cloud-selection-btn",onClick:$,title:i("library.freeLocalSpaceShort"),children:[e.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("path",{d:"M3 6h18M8 6V4h8v2M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6",strokeLinecap:"round",strokeLinejoin:"round"})}),e.jsx("span",{children:i("library.freeLocalSpaceShort")})]}),e.jsxs("button",{type:"button",className:"cloud-selection-btn",onClick:()=>{d(new Set),o(!1)},title:i("library.cancel"),children:[e.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("path",{d:"M18 6L6 18M6 6l12 12",strokeLinecap:"round",strokeLinejoin:"round"})}),e.jsx("span",{children:i("library.cancel")})]})]})]})}const Kn=oe.memo(Yn),bt="ev_backup_consent_seen";function Zn(){const{user:t,autoBackupEnabled:n}=Oe(),{t:s}=ve(),c=!!(t!=null&&t.readerPaid),[g,f]=l.useState(()=>{try{return localStorage.getItem(bt)==="1"}catch{return!0}});if(!c||g||!n)return null;const y=()=>{try{localStorage.setItem(bt,"1")}
2catch{}f(!0)};return e.jsxs("div",{className:"cloud-backup-consent",role:"status",children:[e.jsx("span",{className:"cbc-icon","aria-hidden":"true",children:e.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M18 10h-1.26A8 8 0 1 0 9 20h9a5 5 0 0 0 0-10z"})})}),e.jsxs("div",{className:"cbc-text",children:[e.jsx("strong",{className:"cbc-title",children:s("library.cloudBackupTitle")}),e.jsx("span",{className:"cbc-desc",children:s("library.cloudBackupDesc")})]}),e.jsx("div",{className:"cbc-actions",children:e.jsx("button",{type:"button",className:"cbc-btn cbc-ok",onClick:y,children:s("library.cloudBackupGotIt")})})]})}const Qn=60*60*1e3;function Xn(t,n=Date.now()){return Array.isArray(t)?t.filter(s=>{if(!s||s.file_type!=="pdf"||s.source_pdf_url||s.deleted_at)return!1;if(s.updated_at){const c=n-new Date(s.updated_at).getTime();if(Number.isFinite(c)&&c<Qn)return!1}return!0}):[]}function er({books:t,onDeleteBook:n}){const{t:s}=ve(),[c,g]=l.useState(()=>new Set),f=l.useMemo(()=>Xn(t),[t]),y=l.useMemo(()=>f.filter(v=>!c.has(v.id)),[f,c]);if(y.length===0)return null;function a(v){n&&(n(v),g(b=>{const i=new Set(b);return i.add(v.id),i}))}return e.jsxs("div",{className:"stuck-pdf-banner",role:"status",children:[e.jsx("strong",{className:"stuck-pdf-banner-title",children:s("stuckPdf.title",{count:y.length})}),e.jsx("p",{className:"stuck-pdf-banner-explanation",children:s("stuckPdf.explanation")}),e.jsx("ul",{className:"stuck-pdf-banner-list",children:y.map(v=>e.jsxs("li",{className:"stuck-pdf-banner-item",children:[e.jsx("span",{className:"stuck-pdf-banner-item-title",title:v.title,children:v.title||v.file_name||"(untitled PDF)"}),e.jsx("button",{type:"button",className:"stuck-pdf-banner-item-delete",onClick:()=>a(v),children:s("stuckPdf.deleteBook")})]},v.id))})]})}function tr({book:t,index:n,ctx:s}){const{bookProgress:c,cloudDownloading:g,bookCovers:f,coverLoading:y,t:a,isCloudOnly:v,handleOpenBook:b,openChapterPickerForBook:i}=s,M=c[t.id],o=Math.round((M==null?void 0:M.percentage)||0),d=g[t.id]!=null,u=g[t.id]||0;return e.jsxs("article",{className:`continue-card ${d?"downloading":""}`,style:{animationDelay:`${n*30}ms`},onClick:()=>!d&&b(t),children:[e.jsxs("div",{className:"continue-cover",children:[f[t.id]?e.jsx("img",{src:f[t.id],alt:t.title,className:"book-cover-image"}):e.jsx("div",{className:`book-cover-placeholder ${y[t.id]?"loading":"no-cover"}`,children:y[t.id]?e.jsx("div",{className:"cover-spinner"}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"book-cover-initial",children:(t.title||"?").charAt(0).toUpperCase()}),e.jsx("span",{className:"book-cover-title",children:t.title})]})}),v(t)&&!d&&e.jsx("span",{className:"cloud-badge",title:a("library.cloudOnly"),children:e.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("path",{d:"M20 16.58A5 5 0 0018 7h-1.26A8 8 0 104 15.25",strokeLinecap:"round",strokeLinejoin:"round"})})}),!d&&e.jsx(We,{book:t}),!d&&t.file_type==="epub_from_pdf"&&t.conversion_status==="ready"&&i&&qe(t)&&e.jsx("button",{type:"button",className:"book-add-chapters-btn",onClick:_=>{_.stopPropagation(),i(t)},title:a("library.addChapters")||"å¢å ç« è",children:e.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",children:e.jsx("path",{d:"M12 5v14M5 12h14"})})}),d&&e.jsxs("div",{className:"cloud-download-overlay",children:[e.jsxs("svg",{className:"cloud-download-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M12 4v12m0 0l-3-3m3 3l3-3",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M20 16.58A5 5 0 0018 7h-1.26A8 8 0 104 15.25",strokeLinecap:"round",strokeLinejoin:"round"})]}),e.jsxs("span",{className:"cloud-download-pct",children:[u,"%"]}),e.jsx("div",{className:"cloud-download-bar",children:e.jsx("div",{className:"cloud-download-fill",style:{width:`${u}%`}})})]})]}),e.jsxs("div",{className:"continue-info",children:[e.jsx("h3",{className:"continue-title",title:t.title,children:t.title}),e.jsxs("div",{className:"continue-progress-row",children:[e.jsx("div",{className:"continue-progress-bar",children:e.jsx("div",{className:"continue-progress-fill",style:{width:`${o}%`}})}),e.jsxs("span",{className:"continue-progress-pct",children:[o,"%"]})]})]})]},t.id)}const nr=oe.memo(tr),vt={zh:"å¼å§é
读åï¼è¿éä¼è®°å½æ¯å¤©çé
读æ¶é¿","zh-TW":"éå§é±è®å¾ï¼é裡æè¨éæ¯å¤©çé±è®æé·",en:"Your daily reading time will appear here",fr:"Votre temps de lecture quotidien apparaîtra ici"},wt=30,_t=14;function rr(){const[t,n]=l.useState(()=>typeof window<"u"&&window.innerWidth<480?_t:wt);return l.useEffect(()=>{const s=window.matchMedia("(max-width: 480px)"),c=g=>n(g.matches?_t:wt);return s.addEventListener("change",c),()=>s.removeEventListener("change",c)},[]),t}function ar({bookId:t,language:n}){const[s,c]=l.useState([]),[g,f]=l.useState(!1),[y,a]=l.useState(null),v=l.useRef(null),b=rr(),i=l.useMemo(()=>gn()||!matchMedia("(hover: hover)").matches,[]);l.useEffect(()=>{if(!t)return;let j=!1;return ne.getBookDailyStats(t).then(m=>{var C;j||((C=m==null?void 0:m.days)!=null&&C.length&&c(m.days),f(!0))}),()=>{j=!0}},[t]);const M=l.useMemo(()=>s.slice(-b),[s,b]),o=l.useCallback((j,m)=>{const C=new Date(j+"T12:00:00"),$=Math.max(1,Math.round(m/6e4));return n==="zh"||n==="zh-TW"?`${C.getFullYear()}å¹´${C.getMonth()+1}æ${C.getDate()}æ¥ï¼${$}åé`:n==="fr"?`${C.getDate()}/${C.getMonth()+1}/${C.getFullYear()}, ${$} min`:`${["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][C.getMonth()]} ${C.getDate()}, ${C.getFullYear()}, ${$} min`},[n]),d=l.useCallback((j,m)=>{var L;
2const C=j.currentTarget;if(!C)return;const $=C.getBoundingClientRect(),A=(L=v.current)==null?void 0:L.getBoundingClientRect();A&&a({date:m.date,text:o(m.date,m.total_ms),x:$.left+$.width/2-A.left,y:$.top-A.top-6})},[o]),u=i?void 0:(j,m)=>d(j,m),_=i?void 0:()=>a(null),D=l.useCallback((j,m)=>{var A;if(j.stopPropagation(),!i)return;const C=j.currentTarget.getBoundingClientRect(),$=(A=v.current)==null?void 0:A.getBoundingClientRect();a(L=>(L==null?void 0:L.date)===m.date||!$?null:{date:m.date,text:o(m.date,m.total_ms),x:C.left+C.width/2-$.left,y:C.top-$.top-6})},[i,o]),x=l.useCallback(j=>{j.stopPropagation()},[]);if(!M.length)return g?e.jsx("div",{className:"book-daily-chart book-daily-chart-empty",onClick:x,children:e.jsx("p",{className:"book-daily-chart-empty-text",children:vt[n]||vt.en})}):null;const S=Math.max(...M.map(j=>j.total_ms),1);return e.jsxs("div",{className:"book-daily-chart",ref:v,onClick:x,children:[y&&e.jsx("div",{className:"book-daily-chart-tooltip",style:{left:y.x,top:y.y},children:y.text}),e.jsx("div",{className:"book-daily-chart-bars",children:M.map(j=>{const m=Math.max(8,j.total_ms/S*100);return e.jsx("div",{className:`book-daily-chart-bar${(y==null?void 0:y.date)===j.date?" active":""}`,style:{height:`${m}%`},onMouseEnter:u?C=>u(C,j):void 0,onMouseLeave:_,onClick:C=>D(C,j)},j.date)})})]})}const sr=oe.memo(ar);function or(){const[t,n]=l.useState(null),[s,c]=l.useState(null),[g,f]=l.useState(!0),[y,a]=l.useState(null),v=l.useRef(!1),b=l.useCallback(async()=>{try{f(!0),a(null);const[u,_]=await Promise.allSettled([ne.getDashboard(),ne.getHeatmap()]);if(u.status==="fulfilled"&&u.value)n(u.value);else if(u.status==="rejected")throw u.reason;_.status==="fulfilled"&&_.value&&c(_.value.days||[])}catch(u){a(u.message)}finally{f(!1)}},[]);l.useEffect(()=>{v.current||(v.current=!0,b())},[b]);const i=l.useCallback(()=>{b()},[b]),M=l.useCallback(u=>{ne.ackMilestone(u),n(_=>_&&{..._,new_milestones:(_.new_milestones||[]).filter(D=>D.key!==u)})},[]),o=l.useCallback(async u=>{const _=await ne.setYearlyGoal(u);return n(D=>{var x;return D&&{...D,yearly_goal:{...D.yearly_goal,..._.goal,current_words:((x=D.yearly_goal)==null?void 0:x.current_words)||0}}}),_},[]),d=l.useCallback(async({days:u,minutes:_,yearlyTarget:D})=>{const x={reading_goal_days:u,reading_goal_minutes:_};D&&(x.yearly_target=D);const S=await ne.updateSettings(x);if(S.error_code==="GOAL_EDIT_EXHAUSTED"){const j=new Error("GOAL_EDIT_EXHAUSTED");throw j.code="GOAL_EDIT_EXHAUSTED",j}n(j=>{var C;if(!j)return j;const m={...j,week:{...j.week,goal_days:u,goal_minutes:_},goal_edit_remaining:S.remaining??j.goal_edit_remaining};return S.goal&&(m.yearly_goal={...j.yearly_goal,...S.goal,current_words:((C=j.yearly_goal)==null?void 0:C.current_words)||0}),m})},[]);return{data:t,heatmap:s,loading:g,error:y,refresh:i,ackMilestone:M,setYearlyGoal:o,saveGoal:d}}const Se=[{id:"en_001",lang:"en",text:"To be, or not to be, that is the question: Whether 'tis nobler in the mind to suffer the slings and arrows of outrageous fortune, or to take arms against a sea of troubles, and by opposing end them.",author:"William Shakespeare",source:"Hamlet",genre:"drama"},{id:"en_002",lang:"en",text:"All the world's a stage, and all the men and women merely players. They have their exits and their entrances; and one man in his time plays many parts.",author:"William Shakespeare",source:"As You Like It",genre:"drama"},{id:"en_005",lang:"en",text:"We are such stuff as dreams are made on, and our little life is rounded with a sleep.",author:"William Shakespeare",source:"The Tempest",genre:"drama"},{id:"en_007",lang:"en",text:"There is nothing either good or bad, but thinking makes it so.",author:"William Shakespeare",source:"Hamlet",genre:"drama"},{id:"en_009",lang:"en",text:"I declare after all there is no enjoyment like reading! How much sooner one tires of anything than of a book!",author:"Jane Austen",source:"Pride and Prejudice",genre:"fiction"},{id:"en_012",lang:"en",text:"Seldom, very seldom, does complete truth belong to any human disclosure; seldom can it happen that something is not a little disguised or a little mistaken.",author:"Jane Austen",source:"Emma",genre:"fiction"},{id:"en_013",lang:"en",text:"Know your own happiness. You want nothing but patience â or give it a more fascinating name, call it hope.",author:"Jane Austen",source:"Sense and Sensibility",genre:"fiction"},{id:"en_014",lang:"en",text:"It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness.",author:"Charles Dickens",source:"A Tale of Two Cities",genre:"fiction"},{id:"en_015",lang:"en",text:"It is a far, far better thing that I do, than I have ever done; it is a far, far better rest that I go to than I have ever known.",author:"Charles Dickens",source:"A Tale of Two Cities",genre:"fiction"},{id:"en_016",lang:"en",text:"Suffering has been stronger than all other teaching, and has taught me to understand what your heart used to be. I have been bent and broken, but â I hope â into a better shape.",author:"Charles Dickens",source:"Great Expectations",genre:"fiction"},{id:"en_017",lang:"en",text:"There are books of which the backs and covers are by far the best parts.",author:"Charles Dickens",source:"Oliver Twist",genre:"fiction"},{id:"en_018",lang:"en",text:"Whether I shall turn out to be the hero of my own life, or whether that station will be held by anybody else, these pages must show.",author:"Charles Dickens",source:"David Copperfield",genre:"fiction"},{id:"en_019",lang:"en",text:"Have a heart that never hardens, and a temper that never tires, and a touch that never hurts.",author:"Charles Dickens",source:"Our Mutual Friend",genre:"fiction"},{id:"en_020",lang:"en",text:"The world breaks everyone and afterward many are strong at the broken places.",author:"Ernest Hemingway",source:"A Farewell to Arms",genre:"fiction"},{id:"en_021",lang:"en",text:"But man is not made for defeat. A man can be destroyed but not defeated.",author:"Ernest Hemingway",source:"The Old Man and the Sea",genre:"fiction"},{id:"en_022",lang:"en",text:"There is nothing noble in being superior to your fellow man; true nobility is being superior to your former self.",author:"Ernest Hemingway",source:"The Sun Also Rises",genre:"fiction"},{id:"en_023",lang:"en",text:"Every day is a new day. It is better to be lucky. But I would rather be exact. Then when luck comes you are ready.",author:"Ernest Hemingway",source:"The Old Man and the Sea",genre:"fiction"},{id:"en_025",lang:"en",text:"So we beat on, boats against the current, borne back ceaselessly into the past.",author:"F. Scott Fitzgerald",source:"The Great Gatsby",genre:"fiction"},{id:"en_026",lang:"en",text:`In my younger and more vulnerable years my father gave me some advice that I've been turning over in my mind ever since. "Whenever you feel like criticizing anyone," he told me, "just remember that all the people in this world haven't had the advantages that you've had."`,author:"F. Scott Fitzgerald",source:"The Great Gatsby",genre:"fiction"},{id:"en_029",lang:"en",text:"The test of a first-rate intelligence is the ability to hold two opposed ideas in mind at the same time and still retain the ability to function.",author:"F. Scott Fitzgerald",source:"The Crack-Up",genre:"essay"},{id:"en_030",lang:"en",text:"Who controls the past controls the future. Who controls the present controls the past.",author:"George Orwell",source:"1984",genre:"fiction"},{id:"en_031",lang:"en",text:"All animals are equal, but some animals are more equal than others.",author:"George Orwell",source:"Animal Farm",genre:"fiction"},{id:"en_032",lang:"en",text:"In a time of deceit telling the truth is a revolutionary act.",author:"George Orwell",source:"1984",genre:"fiction"},{id:"en_033",lang:"en",text:"Perhaps one did not want to be loved so much as to be understood.",author:"George Orwell",source:"1984",genre:"fiction"},{id:"en_036",lang:"en",text:"You cannot find peace by avoiding life.",author:"Virginia Woolf",source:"The Hours",genre:"fiction"},{id:"en_037",lang:"en",text:"For now she need not think of anybody. She could be herself, by herself. And that was what now she often felt the need of â to think; well, not even to think. To be silent; to be alone.",author:"Virginia Woolf",source:"To the Lighthouse",genre:"fiction"},{id:"en_038",lang:"en",text:"A woman must have money and a room of her own if she is to write fiction.",author:"Virginia Woolf",source:"A Room of One's Own",genre:"essay"},{id:"en_040",lang:"en",text:"I have dreamt in my life, dreams that have stayed with me ever after, and changed my ideas; they have gone through and through me, like wine through water, and altered the colour of my mind.",author:"Emily Brontë",source:"Wuthering Heights",genre:"fiction"},{id:"en_041",lang:"en",text:"I am no bird; and no net ensnares me: I am a free human being with an independent will.",author:"Charlotte Brontë",source:"Jane Eyre",genre:"fiction"},{id:"en_042",lang:"en",text:"I would always rather be happy than dignified.",author:"Charlotte Brontë",source:"Jane Eyre",genre:"fiction"},{id:"en_043",lang:"en",text:"Not all those who wander are lost.",author:"J.R.R. Tolkien",source:"The Fellowship of the Ring",genre:"fiction"},{id:"en_045",lang:"en",text:"Even the smallest person can change the course of the future.",author:"J.R.R. Tolkien",source:"The Fellowship of the Ring",genre:"fiction"},{id:"en_046",lang:"en",text:"Whenever you find yourself on the side of the majority, it is time to pause and reflect.",author:"Mark Twain",source:"Notebook",genre:"essay"},{id:"en_047",lang:"en",text:"The two most important days in your life are the day you are born and the day you find out why.",author:"Mark Twain",source:"Attributed",genre:"essay"},{id:"en_048",lang:"en",text:"Travel is fatal to prejudice, bigotry, and narrow-mindedness, and many of our people need it sorely on these accounts.",author:"Mark Twain",source:"The Innocents Abroad",genre:"essay"},{id:"en_049",lang:"en",text:"All you need in this life is ignorance and confidence, and then success is sure.",author:"Mark Twain",source:"Letter to Mrs. Foote",genre:"essay"},{id:"en_050",lang:"en",text:"To live is the rarest thing in the world. Most people exist, that is all.",author:"Oscar Wilde",source:"The Soul of Man under Socialism",genre:"essay"},{id:"en_051",lang:"en",text:"Be yourself; everyone else is already taken.",author:"Oscar Wilde",source:"Attributed",genre:"essay"},{id:"en_053",lang:"en",text:"We are all in the gutter, but some of us are looking at the stars.",author:"Oscar Wilde",source:"Lady Windermere's Fan",genre:"drama"},{id:"en_054",lang:"en",text:"Experience is simply the name we give our mistakes.",author:"Oscar Wilde",source:"The Picture of Dorian Gray",genre:"fiction"},{id:"en_059",lang:"en",text:"Hope is the thing with feathers that perches in the soul, and sings the tune without the words, and never stops at all.",author:"Emily Dickinson",source:"Hope is the thing with feathers",genre:"poetry"},{id:"en_060",lang:"en",text:"I dwell in Possibility â a fairer House than Prose â more numerous of Windows â superior â for Doors.",author:"Emily Dickinson",source:"I dwell in Possibility",genre:"poetry"},{id:"en_062",lang:"en",text:"Tell all the truth but tell it slant â Success in Circuit lies.",author:"Emily Dickinson",source:"Tell all the truth but tell it slant",genre:"poetry"},{id:"en_063",lang:"en",text:"I am large, I contain multitudes.",author:"Walt Whitman",source:"Song of Myself",genre:"poetry"},{id:"en_065",lang:"en",text:"Keep your face always toward the sunshine â and shadows will fall behind you.",author:"Walt Whitman",source:"Leaves of Grass",genre:"poetry"},{id:"en_067",lang:"en",text:"It is not down on any map; true places never are.",author:"Herman Melville",source:"Moby-Dick",genre:"fiction"},{id:"en_068",lang:"en",text:"As for me, I am tormented with an everlasting itch for things remote. I love to sail forbidden seas, and land on barbarous coasts.",author:"Herman Melville",source:"Moby-Dick",genre:"fiction"},{id:"en_069",lang:"en",text:"If you surrendered to the air, you could ride it.",author:"Toni Morrison",source:"Song of Solomon",genre:"fiction"},{id:"en_070",lang:"en",text:"You wanna fly, you got to give up the shit that weighs you down.",author:"Toni Morrison",source:"Song of Solomon",genre:"fiction"},{id:"en_071",lang:"en",text:"Freeing yourself was one thing, claiming ownership of that freed self was another.",author:"Toni Morrison",source:"Beloved",genre:"fiction"},{id:"en_072",lang:"en",text:"You never really understand a person until you consider things from his point of view â until you climb into his skin and walk around in it.",author:"Harper Lee",source:"To Kill a Mockingbird",genre:"fiction"},{id:"en_073",lang:"en",text:"People generally see what they look for, and hear what they listen for.",author:"Harper Lee",source:"To Kill a Mockingbird",genre:"fiction"},{id:"en_074",lang:"en",text:"The one thing that doesn't abide by majority rule is a person's conscience.",author:"Harper Lee",source:"To Kill a Mockingbird",genre:"fiction"},{id:"en_075",lang:"en",text:"You don't have to burn books to destroy a culture. You just have to get people to stop reading them.",author:"Ray Bradbury",source:"Fahrenheit 451",genre:"fiction"},{id:"en_076",lang:"en",text:"Stuff your eyes with wonder. Live as if you'd drop dead in ten seconds. See the world. It's more fantastic than any dream made or paid for in factories.",author:"Ray Bradbury",source:"Fahrenheit 451",genre:"fiction"},{id:"en_077",lang:"en",text:"There must be something in books, something we can't imagine, to make a woman stay in a burning house.",author:"Ray Bradbury",source:"Fahrenheit 451",genre:"fiction"},{id:"en_079",lang:"en",text:"We are what we pretend to be, so we must be careful about what we pretend to be.",author:"Kurt Vonnegut",source:"Mother Night",genre:"fiction"},{id:"en_081",lang:"en",text:"I took a deep breath and listened to the old brag of my heart. I am, I am, I am.",author:"Sylvia Plath",source:"The Bell Jar",genre:"fiction"},{id:"en_083",lang:"en",text:"Perhaps when we find ourselves wanting everything, it is because we are dangerously close to wanting nothing.",author:"Sylvia Plath",source:"The Bell Jar",genre:"fiction"},{id:"en_084",lang:"en",text:"I went to the woods because I wished to live deliberately, to front only the essential facts of life, and see if I could not learn what it had to teach, and not, when I came to die, discover that I had not lived.",author:"Henry David Thoreau",source:"Walden",genre:"philosophy"},{id:"en_085",lang:"en",text:"How vain it is to sit down to write when you have not stood up to live.",author:"Henry David Thoreau",source:"Journal",genre:"essay"},{id:"en_086",lang:"en",text:"To be yourself in a world that is constantly trying to make you something else is the greatest accomplishment.",author:"Ralph Waldo Emerson",
2source:"Self-Reliance",genre:"philosophy"},{id:"en_087",lang:"en",text:"What lies behind us and what lies before us are tiny matters compared to what lies within us.",author:"Ralph Waldo Emerson",source:"Self-Reliance",genre:"philosophy"},{id:"en_088",lang:"en",text:"And now that you don't have to be perfect, you can be good.",author:"John Steinbeck",source:"East of Eden",genre:"fiction"},{id:"en_089",lang:"en",text:"I wonder how many people I've looked at all my life and never seen.",author:"John Steinbeck",source:"The Winter of Our Discontent",genre:"fiction"},{id:"en_090",lang:"en",text:"The past is never dead. It's not even past.",author:"William Faulkner",source:"Requiem for a Nun",genre:"fiction"},{id:"en_092",lang:"en",text:"Nothing is so painful to the human mind as a great and sudden change.",author:"Mary Shelley",source:"Frankenstein",genre:"fiction"},{id:"en_093",lang:"en",text:"Beware; for I am fearless, and therefore powerful.",author:"Mary Shelley",source:"Frankenstein",genre:"fiction"},{id:"en_094",lang:"en",text:"It's no use going back to yesterday, because I was a different person then.",author:"Lewis Carroll",source:"Alice's Adventures in Wonderland",genre:"fiction"},{id:"en_095",lang:"en",text:"Two roads diverged in a wood, and I â I took the one less traveled by, and that has made all the difference.",author:"Robert Frost",source:"The Road Not Taken",genre:"poetry"},{id:"en_096",lang:"en",text:"In three words I can sum up everything I've learned about life: it goes on.",author:"Robert Frost",source:"Attributed",genre:"poetry"},{id:"en_097",lang:"en",text:"Hold fast to dreams, for if dreams die, life is a broken-winged bird that cannot fly.",author:"Langston Hughes",source:"Dreams",genre:"poetry"},{id:"en_098",lang:"en",text:"We shall not cease from exploration, and the end of all our exploring will be to arrive where we started and know the place for the first time.",author:"T.S. Eliot",source:"Four Quartets",genre:"poetry"},{id:"en_099",lang:"en",text:"There is no greater agony than bearing an untold story inside you.",author:"Maya Angelou",source:"I Know Why the Caged Bird Sings",genre:"fiction"},{id:"en_100",lang:"en",text:"Not everything that is faced can be changed, but nothing can be changed until it is faced.",author:"James Baldwin",source:"The Cross of Redemption",genre:"essay"},{id:"en_101",lang:"en",text:"Missing one workout happens, but I'm not going to miss two in a row. I can't be perfect, but I can avoid a second lapse.",author:"James Clear",source:"Atomic Habits",genre:"essay"},{id:"en_102",lang:"en",text:"Good habits make time your ally. Bad habits make time your enemy.",author:"James Clear",source:"Atomic Habits",genre:"essay"},{id:"en_103",lang:"en",text:"The most powerful outcomes of any compounding process are delayed. You need to be patient.",author:"James Clear",source:"Atomic Habits",genre:"essay"},{id:"en_104",lang:"en",text:"A slight change in your daily habits can guide your life to a very different destination.",author:"James Clear",source:"Atomic Habits",genre:"essay"},{id:"en_105",lang:"en",text:"Every action you take is a vote for the type of person you wish to become.",author:"James Clear",source:"Atomic Habits",genre:"essay"},{id:"en_106",lang:"en",text:"The goal is not to read a book, the goal is to become a reader.",author:"James Clear",source:"Atomic Habits",genre:"essay"},{id:"en_107",lang:"en",text:"It's hard to change your habits if you never change the underlying beliefs that led to your past behavior.",author:"James Clear",source:"Atomic Habits",genre:"essay"},{id:"en_108",lang:"en",text:"You have to learn to fall in love with boredom.",author:"James Clear",source:"Atomic Habits",genre:"essay"},{id:"en_109",lang:"en",text:"The only way to become excellent is to be endlessly fascinated by doing the same thing over and over.",author:"James Clear",source:"Atomic Habits",genre:"essay"},{id:"en_110",lang:"en",text:"The most effective way to change your habits is to join a culture where your desired behavior is the normal behavior.",author:"James Clear",source:"Atomic Habits",genre:"essay"},{id:"en_111",lang:"en",text:"Read what you love until you love to read.",author:"Naval Ravikant",source:"The Almanack of Naval Ravikant",genre:"essay"},{id:"en_112",lang:"en",text:"All the real benefits in life come from compound interest.",author:"Naval Ravikant",source:"The Almanack of Naval Ravikant",genre:"essay"},{id:"en_113",lang:"en",text:"Intentions don't matter. Actions do.",author:"Naval Ravikant",source:"The Almanack of Naval Ravikant",genre:"essay"},{id:"en_114",lang:"en",text:"We are what we repeatedly do. Excellence, then, is not an act, but a habit.",author:"Will Durant",source:"The Story of Philosophy",genre:"philosophy"},{id:"en_115",lang:"en",text:"Motivation is what gets you started. Habit is what keeps you going.",author:"Jim Ryun",source:"Attributed",genre:"essay"},{id:"en_116",lang:"en",text:"Don't let the noise of others' opinions drown out your own inner voice.",author:"Steve Jobs",source:"Stanford Commencement Speech",genre:"essay"},{id:"en_117",lang:"en",text:"Your time is limited, don't waste it living someone else's life.",author:"Steve Jobs",source:"Stanford Commencement Speech",genre:"essay"},{id:"en_118",lang:"en",text:"Success is the sum of small efforts, repeated day in and day out.",author:"Robert C
2ollier",source:"Attributed",genre:"essay"},{id:"en_119",lang:"en",text:"You are never too old to set another goal or to dream a new dream.",author:"C.S. Lewis",source:"Attributed",genre:"essay"},{id:"en_120",lang:"en",text:"Turn your wounds into wisdom.",author:"Oprah Winfrey",source:"Attributed",genre:"essay"},{id:"en_121",lang:"en",text:"Opportunities don't happen. You create them.",author:"Chris Grosser",source:"Attributed",genre:"essay"},{id:"en_122",lang:"en",text:"The secret of getting ahead is getting started.",author:"Mark Twain",source:"Attributed",genre:"essay"},{id:"en_123",lang:"en",text:"Believe you can and you're halfway there.",author:"Theodore Roosevelt",source:"Attributed",genre:"essay"},{id:"en_124",lang:"en",text:"Do one thing every day that scares you.",author:"Eleanor Roosevelt",source:"Attributed",genre:"essay"},{id:"en_125",lang:"en",text:"Better to light a candle than curse the darkness.",author:"Eleanor Roosevelt",source:"Attributed",genre:"essay"},{id:"en_126",lang:"en",text:`Nothing is impossible; the word itself says "I'm possible"!`,author:"Audrey Hepburn",source:"Attributed",genre:"essay"},{id:"en_127",lang:"en",text:"The reading of all good books is like a conversation with the finest minds of past centuries.",author:"René Descartes",source:"Discourse on the Method",genre:"philosophy"},{id:"en_128",lang:"en",text:"The biggest risk is not taking any risk.",author:"Mark Zuckerberg",source:"Attributed",genre:"essay"},{id:"en_129",lang:"en",text:"You don't have to be great to start, but you have to start to be great.",author:"Zig Ziglar",source:"Attributed",genre:"essay"},{id:"en_130",lang:"en",text:"Be the change that you wish to see in the world.",author:"Mahatma Gandhi",source:"Attributed",genre:"philosophy"},{id:"en_131",lang:"en",text:"She was still too young to know that life never gives anything for nothing, and that a price is always paid for what fate bestows.",author:"Stefan Zweig",source:"Marie Antoinette",genre:"fiction"},{id:"en_132",lang:"en",text:"What is once well done is done forever.",author:"Henry David Thoreau",source:"Journal",genre:"essay"},{id:"en_133",lang:"en",text:"He who has a why to live can bear almost any how.",author:"Friedrich Nietzsche",source:"Twilight of the Idols",genre:"philosophy"},{id:"en_134",lang:"en",text:"The struggle itself toward the heights is enough to fill a man's heart.",author:"Albert Camus",source:"The Myth of Sisyphus",genre:"philosophy"},{id:"en_135",lang:"en",text:"I am not what happened to me, I am what I choose to become.",author:"Carl Jung",source:"Attributed",genre:"philosophy"},{id:"zh_001",lang:"zh",text:"满纸èåè¨ï¼ä¸æè¾é
¸æ³ªãé½äºä½è
ç´ï¼è°è§£å
¶ä¸å³ã",author:"æ¹éªè¹",source:"红楼梦",genre:"fiction"},{id:"zh_002",lang:"zh",text:"ä¸äºæ´æçå¦é®ï¼äººæ
ç»è¾¾å³æç« ã",author:"æ¹éªè¹",source:"红楼梦",genre:"fiction"},{id:"zh_003",lang:"zh",text:"åä½çæ¶ç亦åï¼æ 为æå¤æè¿æ ã",author:"æ¹éªè¹",source:"红楼梦",genre:"fiction"},{id:"zh_005",lang:"zh",text:"è´¨æ¬æ´æ¥è¿æ´å»ï¼å¼ºäºæ±¡æ·é·æ¸ æ²ã",author:"æ¹éªè¹",source:"红楼梦",genre:"fiction"},{id:"zh_006",lang:"zh",text:"é»éä¸ä¸¤å®¹æå¾ï¼ç¥å¿ä¸ä¸ªä¹é¾æ±ã",author:"æ¹éªè¹",source:"红楼梦",genre:"fiction"},{id:"zh_007",lang:"zh",text:"横çå·å¯¹å夫æï¼ä¿¯é¦ç为åºåçã",author:"é²è¿
",source:"èªå²",genre:"poetry"},{id:"zh_008",lang:"zh",text:"ä¸å¨æ²é»ä¸çåï¼å°±å¨æ²é»ä¸ç亡ã",author:"é²è¿
",source:"记念ååçå",genre:"essay"},{id:"zh_009",lang:"zh",text:"å
¶å®å°ä¸æ¬æ²¡æè·¯ï¼èµ°ç人å¤äºï¼ä¹ä¾¿æäºè·¯ã",author:"é²è¿
",source:"æ
乡",genre:"fiction"},{id:"zh_010",lang:"zh",text:"çççå£«ï¼æ¢äºç´é¢æ¨æ·¡ç人çï¼æ¢äºæ£è§æ·æ¼çé²è¡ã",author:"é²è¿
",source:"记念ååçå",genre:"essay"},{id:"zh_013",lang:"zh",text:"é¨ä¸ç»å¯äººï¼ä¹ä¸ç»ç©·äººï¼ä¸ç»ä¹äººï¼ä¹ä¸ç»ä¸ä¹ç人ãå
¶å®ï¼é¨å¹¶ä¸å
¬éï¼å 为ä¸è½å¨ä¸ä¸ªæ²¡æå
¬éçä¸çä¸ã",author:"è
2è",source:"éªé©¼ç¥¥å",genre:"fiction"},{id:"zh_014",lang:"zh",text:"çæ´»æ¯ç§å¾å¨ï¼é¡»æå
æå½±ï¼æå·¦æå³ï¼ææ´æé¨ï¼è¶£å³å°±å¨è¿åèä¸ççæ²æéã",author:"èè",source:"å°ç
",genre:"essay"},{id:"zh_015",lang:"zh",text:"æåæ¯ååï¼è¾è¦æ¯ç£¨åç³ï¼åéå©çååï¼è¥æ¥ä¹
ä¸ç£¨ï¼ä¹ä¼çéã",author:"èè",source:"èèæ£æ",genre:"essay"},{id:"zh_021",lang:"zh",text:"æ¥å¤´æ²¡æè¾è´æä»¬ï¼æä»¬ä¹åè«è¾è´æ¥å¤´ã",author:"æ²ä»æ",source:"è¾¹å",genre:"fiction"},{id:"zh_022",lang:"zh",text:"å 为æå¾ï¼æä»¥æ
æ²ã",author:"å¼ ç±ç²",source:"å¾å乿",genre:"fiction"},{id:"zh_028",lang:"zh",text:"天ä¸åªæä¸¤ç§äººãæ¯å¦ä¸ä¸²è¡èå°æï¼ä¸ç§äººææå¥½çå
åï¼å¦ä¸ç§äººææå¥½ççå°æååãç
§ä¾ç¬¬ä¸ç§äººåºè¯¥ä¹è§ï¼å ä¸ºä»æ¯åä¸é¢é½æ¯åå©çè¡èéæå¥½çï¼ç¬¬äºç§äººåºè¯¥æ²è§ãä¸è¿äºå®å´éå¾å
¶åã",author:"é±é书",source:"å´å",genre:"fiction"},{id:"zh_031",lang:"zh",text:"æä»¬æ¾å¦æ¤æ¸´æå½è¿çæ³¢æ¾ï¼å°æåæåç°ï¼äººçææ¼å¦ç飿¯ï¼ç«æ¯å
å¿çæ·¡å®ä¸ä»å®¹ã",author:"æ¨ç»",source:"ä¸ç¾å²æè¨",genre:"essay"},{id:"zh_032",lang:"zh",text:"ä½ çé®é¢ä¸»è¦å¨äºè¯»ä¹¦ä¸å¤èæ³å¾å¤ªå¤ã",author:"æ¨ç»",source:"æ¨ç»æé",genre:"essay"},{id:"zh_034",lang:"zh",text:"æåè°é½ä¸äºï¼åè°äºæé½ä¸å±ã",author:"æ¨ç»",source:"æ¨ç»æ£æ",genre:"essay"},{id:"zh_035",lang:"zh",text:"人æ¯ä¸ºæ´»çæ¬èº«èæ´»ççï¼è䏿¯ä¸ºäºæ´»çä¹å¤çä»»ä½äºç©ææ´»çã",author:"ä½å",source:"æ´»ç",genre:"fiction"},{id:"zh_036",lang:"zh",text:"以ç¬çæ¹å¼åï¼å¨æ»äº¡çä¼´é䏿´»çã",author:"ä½å",source:"æ´»ç",genre:"fiction"},{id:"zh_037",lang:"zh",text:"没æä»ä¹æ¯æ¶é´æ´å
·æè¯´æåäºï¼å 为æ¶é´æ ééç¥æä»¬å°±å¯ä»¥æ¹åä¸åã",author:"ä½å",source:"æ´»ç",genre:"fiction"},{id:"zh_039",lang:"zh",text:"ä¸çä¸çäºæ
ï¼æå¿è®³çå°±æ¯ä¸ªåå
¨åç¾ï¼ä½ çé£å¤©ä¸çæäº®ï¼ä¸æ¦å满äºï¼é©¬ä¸å°±è¦äºåã",author:"è«è¨",source:"æªé¦å",genre:"fiction"},{id:"zh_040",lang:"zh",text:"æå¦åç§å¦ç¸æ¯è¾ï¼ç确没ä»ä¹ç¨å¤ï¼ä½æå¦æå¤§çç¨å¤ï¼ä¹è®¸å°±æ¯å®æ²¡æç¨å¤ã",author:"è«è¨",source:"诺è´å°æå¦å¥æ¼è®²",genre:"essay"},{id:"zh_042",lang:"zh",text:"人çä¸è¿å¦æ¤ï¼ä¸è¡ä¸çæãèªå·±æ°¸è¿æ¯èªå·±ç主è§ï¼ä¸è¦æ»å¨å«äººçæå§éå
å½çé
è§ã",author:"æè¯å ",source:"人çä¸è¿å¦æ¤",genre:"essay"},{id:"zh_043",lang:"zh",text:"å¤ç¬è¿ä¸¤ä¸ªåæå¼æ¥çï¼æå©ç«¥ï¼æçæï¼æå°ç¬ï¼æè´è¶ã足以æèµ·ä¸ä¸ªçå¤åæçå··å£ï¼äººæ
å³åè¶³ã",author:"æè¯å ",source:"æè¯å æ£æ",genre:"essay"},{id:"zh_044",lang:"zh",text:"读书使人å¾å°ä¸ç§ä¼é
åé£å³ï¼è¿å°±æ¯è¯»ä¹¦çæ´ä¸ªç®çï¼èåªææ±çè¿ç§ç®çç读书æå¯ä»¥å«åèºæ¯ã",author:"æè¯å ",source:"çæ´»çèºæ¯",genre:"essay"},{id:"zh_045",lang:"zh",text:"é£ä¸å¤©æäºåä¸å²ï¼å¨æä¸ççé»éæ¶ä»£ï¼ææå¥½å¤å¥¢æãææ³ç±ï¼æ³åï¼è¿æ³å¨ä¸ç¬é´åæå¤©ä¸åæåæçäºã",author:"çå°æ³¢",source:"é»éæ¶ä»£",genre:"fiction"},{id:"zh_047",lang:"zh",text:"ä¸ä¸ªäººåªæ¥ææ¤çæ¤ä¸æ¯ä¸å¤çï¼ä»è¿åºè¯¥æ¥æè¯æçä¸çã",author:"çå°æ³¢",source:"ä¸å¯¿å¯º",genre:"fiction"},{id:"zh_048",lang:"zh",text:"大æ±ä¸å»ï¼æµªæ·å°½ï¼åå¤é£æµäººç©ã",author:"èè½¼",source:"念奴å¨Â·èµ¤å£æå¤",genre:"poetry"},{id:"zh_050",lang:"zh",text:"人çå¦éæ
ï¼æäº¦æ¯è¡äººã",author:"èè½¼",source:"临æ±ä»Â·éé±ç©ç¶",genre:"poetry"},{id:"zh_051",lang:"zh",text:"竹æèéè½»è马ï¼è°æï¼ä¸èçé¨ä»»å¹³çã",author:"èè½¼",source:"å®é£æ³¢",genre:"poetry"},{id:"zh_052",lang:"zh",text:"åé¦åæ¥è§çå¤ï¼å½å»ï¼ä¹æ é£é¨ä¹æ æ´ã",author:"èè½¼",source:"å®é£æ³¢",genre:"poetry"},{id:"zh_053",lang:"zh",text:"é¿é£ç ´æµªä¼ææ¶ï¼ç´æäºå¸æµæ²§æµ·ã",author:"æç½",source:"è¡è·¯é¾",genre:"poetry"},{id:"zh_055",lang:"zh",text:"å¤©çææå¿
æç¨ï¼å鿣尽è¿å¤æ¥ã",author:"æç½",source:"å°è¿é
",genre:"poetry"},{id:"zh_057",lang:"zh",text:"两岸ç¿å£°å¼ä¸ä½ï¼è½»èå·²è¿ä¸éå±±ã",author:"æç½",source:"æ©åç½å¸å",genre:"poetry"},{id:"zh_058",lang:"zh",text:"ä¼å½åç»é¡¶ï¼ä¸è§ä¼å±±å°ã",author:"æç«",source:"æå²³",genre:"poetry"},{id:"zh_059",lang:"zh",text:"å®å¾å¹¿å¦åä¸é´ï¼å¤§åºå¤©ä¸å¯å£«ä¿±æ¬¢é¢ã",author:"æç«",source:"è
å±ä¸ºç§é£æç ´æ",genre:"poetry"},{id:"zh_060",lang:"zh",text:"è¯»ä¹¦ç ´ä¸å·ï¼ä¸ç¬å¦æç¥ã",author:"æç«",source:"å¥èµ é¦å·¦ä¸ä¸äºåäºéµ",genre:"poetry"},{id:"zh_062",lang:"zh",text:"çå½ä½äººæ°ï¼æ»äº¦ä¸ºé¬¼éã",author:"ææ¸
ç
§",source:"夿¥ç»å¥",genre:"poetry"},{id:"zh_065",lang:"zh",text:"éèä¸ç¯±ä¸ï¼æ ç¶è§åå±±ã",author:"é¶æ¸æ",source:"饮é
·å
¶äº",genre:"poetry"},{id:"zh_066",lang:"zh",text:"çå¹´ä¸éæ¥ï¼ä¸æ¥é¾åæ¨ãåæ¶å½åå±ï¼å²æä¸å¾
人ã",author:"é¶æ¸æ",source:"æè¯",genre:"poetry"},{id:"zh_067",lang:"zh",text:"纵浪大åä¸ï¼ä¸åäº¦ä¸æ§ãåºå°½ä¾¿é¡»å°½ï¼æ å¤ç¬å¤èã",author:"é¶æ¸æ",source:"形影ç¥ä¸é¦",genre:"poetry"},{id:"zh_070",lang:"zh",text:"å±±ä¸ç¨ï¼æ°´ä¸ç¨ï¼èº«åæ¦å
³é£çè¡ï¼å¤æ·±åå¸ç¯ã",author:"纳å
°æ§å¾·",source:"é¿ç¸æ",genre:"poetry"},{id:"zh_071",lang:"zh",text:"æä¸é
åä¸çç¯ï¼é£ä¹å°±è®©æåä¸åæ¨æ´å§ï¼ææ¿æææä»å¤ªé³é£éåå°ççæ¾æ£åºæ¥ã",author:"å·´é",source:"å®¶",genre:"fiction"},{id:"zh_072",lang:"zh",text:"å
è¾ççæ³åæåçæ°´ä¸æ ·æ´å»æå¿çµä¸çå°å¢ã",author:"å·´é",source:"å®¶",genre:"fiction"},{id:"zh_073",lang:"zh",text:"çåå»äºï¼æåæ¥çæ¶åï¼æ¨æ³æ¯äºï¼æåéçæ¶åï¼æ¡è±è°¢äºï¼æåå¼çæ¶åã使¯ï¼èªæçï¼ä½ åè¯æï¼
2æä»¬çæ¥å为ä»ä¹ä¸å»ä¸å¤è¿å¢ï¼",author:"æ±èªæ¸
",source:"åå",genre:"essay"},{id:"zh_074",lang:"zh",text:"仿¤æä¸åä»°è¸çé天ï¼ä¸åä½å¤´çç½æ°´ï¼åªè°¨æ
çæååçèæ¥ï¼æè¦ä¸æ¥ä¸æ¥è¸å¨æ³¥åä¸ï¼æä¸æ·±æ·±çèå°ï¼",author:"æ±èªæ¸
",source:"æ¯ç",genre:"poetry"},{id:"zh_075",lang:"zh",text:"å¢è§çè±ï¼ä½ å¤è³èªèµæ¶ï¼å¤©å°ä¾¿å°äºã",author:"å°å¿",source:"ç¹æÂ·æ¥æ°´",genre:"poetry"},{id:"zh_076",lang:"zh",text:"ç±å¨å·¦ï¼åæ
å¨å³ï¼èµ°å¨çå½è·¯ç两æï¼éæ¶æç§ï¼éæ¶å¼è±ã",author:"å°å¿",source:"å¯å°è¯»è
",genre:"essay"},{id:"zh_079",lang:"zh",text:"çæ´»ä¸è½çå¾
å«äººæ¥å®æï¼è¦èªå·±å»äºåå奿ï¼èä¸è®ºå
¶ç»ææ¯åæ¯æ²ï¼ä½å¯ä»¥æ
°èçæ¯ï¼ä½ æ»ä¸æå¨è¿ä¸ç䏿´»äºä¸åºã",author:"è·¯é¥",source:"å¹³å¡çä¸ç",genre:"fiction"},{id:"zh_080",lang:"zh",text:"äººä»¬å®æ¿å»å
³å¿ä¸ä¸ªè¹©èçµå½±æ¼åçååææå鸡æ¯èç®ï¼è䏿¿äºè§£ä¸ä¸ªæ®éäººæ³¢æ¶æ±¹æ¶çå
å¿ä¸çã",author:"è·¯é¥",source:"å¹³å¡çä¸ç",genre:"fiction"},{id:"zh_081",lang:"zh",text:"æ»æ¯ä¸ä»¶ä¸å¿
æ¥äºæ±æçäºï¼æ»æ¯ä¸ä¸ªå¿
ç¶ä¼é临çèæ¥ã",author:"å²éç",source:"æä¸å°å",genre:"essay"},{id:"zh_084",lang:"zh",text:"岿ä¸é¥¶äººï¼æäº¦æªæ¾é¥¶è¿å²æã",author:"æ¨å¿",source:"äºéå«äºä¸æ´å¤©",genre:"poetry"},{id:"zh_085",lang:"zh",text:"èªç¶æ¯ä¼å¤§çï¼äººç±»æ¯ä¼å¤§çï¼ç¶èå
满äºå´é«ç²¾ç¥çäººç±»çæ´»å¨ï¼ä¹æ¯ä¼å¤§ä¸ä¹å°¤å
¶ä¼å¤§è
ã",author:"è
ç¾",source:"ç½æ¨ç¤¼èµ",genre:"essay"},{id:"zh_086",lang:"zh",text:"ä¼é寻ä»åç¾åº¦ï¼è¦ç¶åé¦ï¼é£äººå´å¨ï¼ç¯ç«éçå¤ã",author:"è¾å¼ç¾",source:"éçæ¡Â·å
å¤",genre:"poetry"},{id:"zh_087",lang:"zh",text:"å°å¹´ä¸è¯ææ»å³ï¼ç±ä¸å±æ¥¼ãç±ä¸å±æ¥¼ï¼ä¸ºèµæ°è¯å¼ºè¯´æã",author:"è¾å¼ç¾",source:"ä¸å¥´å¿Â·ä¹¦åå±±éä¸å£",genre:"poetry"},{id:"zh_088",lang:"zh",text:"è¡å°æ°´ç©·å¤ï¼åçäºèµ·æ¶ã",author:"çç»´",source:"ç»åå«ä¸",genre:"poetry"},{id:"zh_090",lang:"zh",text:"衣带æ¸å®½ç»ä¸æï¼ä¸ºä¼æ¶å¾äººææ´ã",author:"æ³æ°¸",source:"è¶æè±",genre:"poetry"},{id:"zh_091",lang:"zh",text:"人çä¸çï¼è¦ä¹ç½¢ï¼ä¹ä¹ç½¢ï¼å¾ä¹ç½¢ï¼å¤±ä¹ç½¢ãè¦ç´§çæ¯å¿é´ç䏿³æ¸
æ³éä¸è½æ²¡ææè¾ã",author:"贾平å¹",source:"èªå¨ç¬è¡",genre:"essay"},{id:"zh_092",lang:"zh",text:"ä¸ä¹±äºå¿ï¼ä¸å°äºæ
ãä¸çå°æ¥ï¼ä¸å¿µè¿å¾ã妿¤ï¼å®å¥½ã",author:"ä¸°åæº",source:"ä¸å® æ æè¿ä¸ç",genre:"essay"},{id:"zh_094",lang:"zh",text:"å¦æææ¥çï¼è¦å䏿£µæ ï¼ç«ææ°¸æï¼æ²¡ææ²æ¬¢çå§¿å¿ãä¸åå¨å°åéå®è¯¦ï¼ä¸åå¨é£é飿¬ã",author:"䏿¯",source:"说ç»èªå·±å¬",genre:"essay"},{id:"zh_095",lang:"zh",text:"æ¯ä¸ªäººé½äºåä¸ä¸ªå®æ»¡ç人çãç¶èï¼èªå¤åä»ï¼æµ·å
æµ·å¤ï¼ä¸ä¸ªç¾åä¹ç¾å®æ»¡çäººçæ¯æ²¡æçã",author:"å£ç¾¡æ",source:"ä¸å®æ»¡ææ¯äººç",genre:"essay"},{id:"zh_097",lang:"zh",text:"åæ¯å¤©æ¶¯æ²¦è½äººï¼ç¸é¢ä½å¿
æ¾ç¸è¯ã",author:"ç½å±
æ",source:"çµç¶è¡",genre:"poetry"},{id:"zh_098",lang:"zh",text:"æ²èä¾§çåå¸è¿ï¼ç
æ å头䏿¨æ¥ã",author:"å禹é¡",source:"é
¬ä¹å¤©æ¬å·åé¢å¸ä¸è§èµ ",genre:"poetry"},{id:"zh_099",lang:"zh",text:"è½çº¢ä¸æ¯æ æ
ç©ï¼å使¥æ³¥æ´æ¤è±ã",author:"é¾èªç",source:"己亥æè¯",genre:"poetry"},{id:"zh_100",lang:"zh",text:"山鿰´å¤çæ è·¯ï¼æ³æè±æå䏿ã",author:"鿏¸",source:"游山西æ",genre:"poetry"},{id:"zh_101",lang:"zh",text:"æè¦æè½åæèªå·±çèªç±ï¼åæ¢åæèªå·±çèéã",author:"æè¯å ",source:"æè¯å æ£æ",genre:"essay"},{id:"zh_102",lang:"zh",text:"é¡ä¸æåï¼é²å
æç»ã",author:"è¯ç»",source:"大é
·è¡",genre:"poetry"},{id:"zh_103",lang:"zh",text:"è
¹æè¯ä¹¦æ°èªåã",author:"èè½¼",source:"åè£ä¼ çå«",genre:"poetry"},{id:"zh_104",lang:"zh",text:"æ¥æ±ä¸åï¼åä¸åæã",author:"ä¿è¯",source:"æ°é´è°è¯",genre:"philosophy"},{id:"zh_105",lang:"zh",text:"ä¸èªè§ï¼æ
æï¼ä¸èªæ¯ï¼æ
å½°ï¼ä¸èªä¼ï¼æ
æåï¼ä¸èªçï¼æ
é¿ã",author:"è
2å",source:"éå¾·ç»Â·ç¬¬äºåäºç« ",genre:"philosophy"},{id:"zh_106",lang:"zh",text:"å¦è䏿åç½ï¼æèä¸å¦åæ®ã",author:"åå",source:"论è¯Â·ä¸ºæ¿",genre:"philosophy"},{id:"zh_107",lang:"zh",text:"ç¥ä¹è
ä¸å¦å¥½ä¹è
ï¼å¥½ä¹è
ä¸å¦ä¹ä¹è
ã",author:"åå",source:"论è¯Â·éä¹",genre:"philosophy"},{id:"zh_108",lang:"zh",text:"ä¸äººè¡ï¼å¿
ææå¸çãæ©å
¶åè
èä»ä¹ï¼å
¶ä¸åè
èæ¹ä¹ã",author:"åå",source:"论è¯Â·è¿°è",genre:"philosophy"},{id:"zh_109",lang:"zh",text:"天è¡å¥ï¼åå以èªå¼ºä¸æ¯ã",author:"卿",source:"ä¹¾å¦Â·è±¡ä¼ ",genre:"philosophy"},{id:"zh_110",lang:"zh",text:"ä¸ç§¯è·¬æ¥ï¼æ 以è³åéï¼ä¸ç§¯å°æµï¼æ ä»¥ææ±æµ·ã",author:"èå",source:"åå¦",genre:"philosophy"},{id:"zh_111",lang:"zh",text:"é²èèä¹ï¼æ½æ¨ä¸æï¼é²èä¸èï¼éç³å¯éã",author:"èå",source:"åå¦",genre:"philosophy"},{id:"zh_112",lang:"zh",text:"天å°éå¤§ä»»äºæ¯äººä¹ï¼å¿
å
è¦å
¶å¿å¿ï¼å³å
¶ç骨ï¼é¥¿å
¶ä½è¤ï¼ç©ºä¹å
¶èº«ã",author:"åå",source:"ååä¸",genre:"philosophy"},{id:"zh_113",lang:"zh",text:"尽信书ï¼åä¸å¦æ 书ã",author:"åå",source:"å°½å¿ä¸",genre:"philosophy"},{id:"zh_114",lang:"zh",text:"åå¦ä¹ï¼å®¡é®ä¹ï¼æ
æä¹ï¼æè¾¨ä¹ï¼ç¬è¡ä¹ã",author:"åæ",source:"ä¸åº¸",genre:"philosophy"},{id:"zh_115",lang:"zh",text:"éæ·¡æ³æ 以æå¿ï¼éå®éæ 以è´è¿ã",author:"诸è亮",source:"诫å书",genre:"essay"},{id:"zh_116",lang:"zh",text:"å
天ä¸ä¹å¿§èå¿§ï¼å天ä¸ä¹ä¹èä¹ã",author:"è仲淹",source:"岳鳿¥¼è®°",genre:"essay"},{id:"zh_117",lang:"zh",text:"人çèªå¤è°æ æ»ï¼çå丹å¿ç
§æ±éã",author:"æå¤©ç¥¥",source:"è¿é¶ä¸æ´",genre:"poetry"},{id:"zh_118",lang:"zh",text:"ç©·ä¸çåï¼ä¸å éäºä¹å¿ã",author:"çå",source:"æ»çéåº",genre:"essay"},{id:"zh_119",lang:"zh",text:"书山æè·¯å¤ä¸ºå¾ï¼å¦æµ·æ 涯è¦ä½èã",author:"驿",source:"Attributed",genre:"poetry"},{id:"zh_120",lang:"zh",text:"鮿¸ é£å¾æ¸
å¦è®¸ï¼ä¸ºææºå¤´æ´»æ°´æ¥ã",author:"æ±ç¹",source:"è§ä¹¦ææ",genre:"poetry"},{id:"zh_121",lang:"zh",text:"ç¥æ¯è¡ä¹å§ï¼è¡æ¯ç¥ä¹æã",author:"ç鳿",source:"ä¼ ä¹ å½",genre:"philosophy"},{id:"zh_122",lang:"zh",text:"å¤ªä¸æç«å¾·ï¼å
¶æ¬¡æç«åï¼å
¶æ¬¡æç«è¨ï¼è½ä¹
ä¸åºï¼æ¤ä¹è°ä¸æ½ã",author:"ååè±¹",source:"å·¦ä¼ Â·è¥å
¬äºååå¹´",genre:"philosophy"},{id:"zh_123",lang:"zh",text:"é»åä¸ç¥å¤å¦æ©ï¼ç½é¦æ¹æè¯»ä¹¦è¿ã",author:"é¢çå¿",source:"åå¦è¯",genre:"poetry"},{id:"zh_124",lang:"zh",text:"纸ä¸å¾æ¥ç»è§æµ
ï¼ç»ç¥æ¤äºè¦èº¬è¡ã",author:"鿏¸",source:"å¬å¤è¯»ä¹¦ç¤ºåè¿",genre:"poetry"},{id:"zh_125",lang:"zh",text:"书ç¹è¯ä¹ï¼å读ä¹å¯ä»¥å»æã",author:"åå",source:"说è",genre:"philosophy"},{id:"zh_126",lang:"zh",text:"仿¥ä¹è´£ä»»ï¼ä¸å¨ä»äººï¼èå
¨å¨æå°å¹´ã",author:"æ¢å¯è¶
",source:"å°å¹´ä¸å½è¯´",genre:"essay"},{id:"zh_127",lang:"zh",text:"æä»ä¹ççæ ç©·ï¼è¿ä¸å¯¸æä¸å¯¸ç欢åã",author:"è¡é",source:"è¡éæ¥è®°",genre:"essay"},{id:"zh_128",lang:"zh",text:"天ä¸å¤ä»ä¹åº¸äººï¼ç以䏿°åè´è´¥ï¼å¤©ä¸å¤ä»ä¹äººæï¼ç以ä¸å²åè´è´¥ã",author:"æ¾å½è©",source:"æ¾å½è©å®¶ä¹¦",genre:"essay"},{id:"zh_129",lang:"zh",text:"路漫漫å
¶ä¿®è¿å
®ï¼å¾å°ä¸ä¸èæ±ç´¢ã",author:"å±å",source:"离éª",genre:"poetry"},{id:"zh_130",lang:"zh",text:"为天å°ç«å¿ï¼ä¸ºçæ°ç«å½ï¼ä¸ºå¾å£ç»§ç»å¦ï¼ä¸ºä¸ä¸å¼å¤ªå¹³ã",author:"å¼ è½½",source:"æ¨ªæ¸ åå¥",genre:"philosophy"},{id:"zh_131",lang:"zh",text:"å¦ç¶åç¥ä¸è¶³ï¼æç¶åç¥å°ã",author:"礼记",source:"å¦è®°",genre:"philosophy"},{id:"zh_132",lang:"zh",text:"å¾çä¹ææ¶¯ï¼èç¥ä¹æ 涯ã",author:"åºå",source:"å
»ç主",genre:"philosophy"},{id:"tw_006",lang:"zh-TW",text:"æè¬ç¶å¥³æ¯åä¸å ´ï¼åªä¸éæå³èï¼ä½ åä»çç·£åå°±æ¯ä»çä»ä¸ä¸æ·å°å¨ç®éä»çèå½±æ¼¸è¡æ¼¸é ã",author:"龿å°",source:"ç®é",genre:"essay"},{id:"tw_007",lang:"zh-TW",text:"æäºè·¯åï¼åªè½ä¸å人走ã",author:"龿å°",source:"ç®é",genre:"essay"},{id:"tw_009",lang:"zh-TW",text:"ä¸å社æç¹ç«ç¨è¡ç人è¶å¤ï¼å¤©åãææ°£ãéå¾·ãåæ°£å°±è¶å¤ã",author:"龿å°",source:"éç«é",genre:"essay"},{id:"tw_010",lang:"zh-TW",text:"䏿¯æ¼¸è¡æ¼¸é ï¼èæ¯æä¸å¤©çµè¦éé¢ã",author:"龿å°",source:"ç®é",genre:"essay"},{id:"tw_012",lang:"zh-TW",text:"ä¸å人è³å°ææä¸å夢æ³ï¼æä¸åçç±å»å
å¼·ãå¿è¥æ²ææ£²æ¯çå°æ¹ï¼å°åªè£¡é½æ¯å¨æµæµªã",author:"䏿¯",source:"æåæçæ
äº",genre:"essay"},{id:"tw_013",lang:"zh-TW",text:"çå½çæ»å³ï¼ç¡è«æ¯é½æ¥ç½éªï¼éèè±è
ï¼é½è¦èªå·±å»åä¸ååã",author:"䏿¯",source:"æåæçæ
äº",genre:"essay"},{id:"tw_014",lang:"zh-TW",text:"æç¬ï¼ä¾¿é¢å¦æ¥è±ï¼å®æ¯è½æå人çï¼ä»»ä»æ¯èª°ã",author:"䏿¯",source:"å¾å",genre:"essay"},{id:"tw_015",lang:"zh-TW",text:"æ²ææ¥µç¾ï¼å¨æ¼å®å¿
ç¶çæµéãæ¥è±ãç§æã夿¥ãå¬éªã",author:"䏿¯",source:"æ²æ",genre:"essay"},{id:"tw_020",lang:"zh-TW",text:"ç¸ç¸çè±å
è½äºï¼æä¹ä¸åæ¯å°å©åã",author:"ææµ·é³",source:"ååèäº",genre:"fiction"},{id:"tw_025",lang:"zh-TW",text:"é
å
¥è±ªè
¸ï¼ä¸åéæäºæå
ï¼é¤ä¸çä¸å坿忰£ï¼ç¹¡å£ä¸åå°±ååçåã",author:"ä½å
ä¸",source:"å°æç½",genre:"poetry"},{id:"tw_026",lang:"zh-TW",text:"æé ä¸å»æ¯é¢¨å¹é»é«®ï¼åé¦åä¾å·²éªæ»¿ç½é ã",author:"ä½å
ä¸",source:"浪ååé ",genre:"poetry"}
2,{id:"tw_028",lang:"zh-TW",text:"æ
è¡ä¹æç¾©ä¸¦ä¸æ¯å訴å¥äººãé裡æä¾éãï¼èæ¯ä¸ç¨®æ¹è®ã",author:"ä½å
ä¸",source:"ä½å
䏿£æ",genre:"essay"},{id:"tw_037",lang:"zh-TW",text:"å°é®ç人åå䏿£µæ£µèæ¨¹ï¼æ ¹æå¨åå°è£¡ï¼ä»»é¢¨é¨ææä¹ä¸åã",author:"黿¥æ",source:"å
åç大ç©å¶",genre:"fiction"},{id:"tw_038",lang:"zh-TW",text:"人活èå°±è¦æå°å´ï¼å°å´æ¯ä»éº¼é½éè¦ã",author:"黿¥æ",source:"çæµ·çæ¥å",genre:"fiction"},{id:"tw_039",lang:"zh-TW",text:"çå½ä¸æçè²´çæ±è¥¿ï¼å¾å¾æ¯æä¸èµ·ç¼çã",author:"黿¥æ",source:"èå²å¨å¦ï¼åè¦",genre:"fiction"},{id:"tw_042",lang:"zh-TW",text:"ææçç¾éºé½æ¯çæ«çï¼æ£å çºçæ«ï¼æå¦æ¤å人ã",author:"æ±å¤©æ",source:"çå¤ä¹é½",genre:"fiction"},{id:"tw_046",lang:"zh-TW",text:"人ççæ³å³ï¼å°±å¨æ¼é£äºä¸ç¶æçç¬éã",author:"å¼µæ¼å¨",source:"人é好æç¯",genre:"essay"},{id:"tw_049",lang:"zh-TW",text:"è®æç人æï¼è®ä¸æçäººä¸æãè®ä¸çæ¯ä¸çï¼æçå¿æ¯æçç¹ã",author:"ç°¡åª",source:"æ°´å",genre:"essay"},{id:"tw_050",lang:"zh-TW",text:"ææ³å¸æç¨ä¸ç¨®å·å½èæ¸
æçå¿æ
ï¼å»çå¾
çå½ä¸ææçæµè½èè®é·ã",author:"ç°¡åª",source:"å¾®æç樹æ",genre:"essay"},{id:"tw_051",lang:"zh-TW",text:"æå
ç
§å¨å¤§å°ä¸ï¼ä¸ç忽ç¶å®éå¾åä¸é¦è©©ã",author:"ç°¡åª",source:"夢鿏",genre:"essay"},{id:"tw_053",lang:"zh-TW",text:"æäºäºç©æ¶å¤±äºï¼ä½å®åæ¾ç¶åå¨éï¼éå°±å¤ äºã",author:"峿ç",source:"å®è»å¤±ç«è¨",genre:"fiction"},{id:"tw_054",lang:"zh-TW",text:"æ¯ä¸æ£µæ¨¹é½æèªå·±çæ
äºï¼åªæ¯æåå¾å°åä¸ä¾å¾è½ã",author:"峿ç",source:"è¦é¨ä¹å°",genre:"fiction"},{id:"tw_055",lang:"zh-TW",text:"ç¾ï¼å
¶å¯¦æ¯ä¸ç¨®æ¯æãå¨æçµæçæå»ï¼ç¾è®äººæäºæ´»ä¸å»çåæ°£ã",author:"è£å³",source:"ç¾çæ²æ",genre:"essay"},{id:"tw_056",lang:"zh-TW",text:"å¤ç¨åå¯å¯ä¸ä¸æ¨£ãå¯å¯æç¼æ
ï¼å¤ç¨åæ¯é£½æ»¿çã",author:"è£å³",source:"å¤ç¨å
è¬",genre:"essay"},{id:"tw_057",lang:"zh-TW",text:"å¤ç¨æ¯ä¸ç¨®æ²æ¾±ï¼èæ²æ¾±ä¹å¾çæç¶æ¯æ¸
æã",author:"è£å³",source:"å¤ç¨å
è¬",genre:"essay"},{id:"tw_058",lang:"zh-TW",text:"çå½è£¡ç¬¬ä¸åææçå°è±¡æè©²æ¯èªå·±ï¼å¯«è©©çµ¦èªå·±ï¼èèªå·±å°è©±ï¼å¨ä¸å空é裡å®éä¸ä¾ï¼èè½èªå·±çå¿è·³èå¼å¸ã",author:"è£å³",source:"çæ´»åè¬",genre:"essay"},{id:"tw_059",lang:"zh-TW",text:"以æ¸
æ·¨å¿çä¸çï¼ä»¥æ¡åå¿éçæ´»ï¼ä»¥å¹³å¸¸å¿çæ
å³ï¼ä»¥æè»å¿é¤æç¤ã",author:"ææ¸
ç",source:"æ¸
æ·¨ä¹è®",genre:"essay"},{id:"tw_060",lang:"zh-TW",text:"人çéè¦æºåçï¼ä¸æ¯æè²´çè¶ï¼èæ¯åè¶çå¿æ
ã",author:"ææ¸
ç",source:"人éæå³æ¯æ¸
æ¡",genre:"essay"},{id:"tw_061",lang:"zh-TW",text:"ä»å¤©æ¯æ¨å¤©æ
æ²ï¼ä»å¤©æ¯æ¨å¤©æºæ
§ï¼ä»å¤©æ¯æ¨å¤©å¿«æ¨ï¼éå°±æ¯æåã",author:"ææ¸
ç",source:"ææ¸
çæ£æ",genre:"essay"},{id:"tw_062",lang:"zh-TW",text:"å¨ç©¿éæéçæåï¼æè¦ºå¾éº»éçæ»äº¡çµ¦æä¸äºåç¤ºï¼æåéç¶å¨å¡µç¶²ä¸çæ´»ï¼ä½æ°¸é ä¸è¦å¤±å»æ³é£çå¿ï¼ä¸è¦å¿è¨é£ç¿çå§¿å¢ã",author:"ææ¸
ç",source:"å¿çè©æ",genre:"essay"},{id:"tw_063",lang:"zh-TW",text:"æ¯æ¬¡è½è®ï¼ç¸½æå¨çå½ä¸çä¸äºéæ¥çå°çã",author:"ææ¸
ç",source:"è©æåæ¸",genre:"essay"},{id:"tw_064",lang:"zh-TW",text:"ä½ ä¸è½æ±ºå®çå½çé·åº¦ï¼ä½ä½ å¯ä»¥æ§å¶å®ç寬度ã",author:"åå¢",source:"è¢çªå°èª",genre:"essay"},{id:"tw_065",lang:"zh-TW",text:"å¹´è¼çæå以çºä¸è®æ¸ä¸è¶³ä»¥äºè§£äººçï¼ç´å°å¾ä¾æç¼ç¾å¦æä¸äºè§£äººçï¼æ¯è®ä¸ææ¸çã",author:"åå¢",source:"è¢çªå°èª",genre:"essay"},{id:"tw_066",lang:"zh-TW",text:"æ¯ä¸åæåè
齿ä¸åéå§ãåæ¼éå§ï¼æè½æ¾å°æåçè·¯ã",author:"åå¢",source:"æä¸æ¯æä½ è©",genre:"essay"},{id:"tw_070",lang:"zh-TW",text:"人çå½é䏿¯ç±èªå·±æ±ºå®çï¼ä½äººå¯ä»¥æ±ºå®é¢å°å½éçæ
度ã",author:"鳿 ç",source:"山路",genre:"fiction"},{id:"tw_074",lang:"zh-TW",text:"ä»å¤©çé½å
å¾å¥½ï¼å¥½å¾è®äººæ³ä¸è¼©åé½ä¸éç¼ã",author:"æ´å¤«",source:"æ¼æ¨",genre:"poetry"},{id:"tw_075",lang:"zh-TW",text:"溫æä¹å¿
è¦ãè¯å®ä¹å¿
è¦ãä¸é»é»é
åæ¨æ¨¨è±ä¹å¿
è¦ã",author:"ç弦",source:"妿çè¡æ¿",genre:"poetry"},{id:"tw_076",lang:"zh-TW",text:"給æä¸åè§£éæå°±å¯ä»¥åç¸ä¿¡ä¸æ¬¡äººä¸ï¼çµ¦æä¸å¼µçæå°±å¯ä»¥åç¿»ä¸éåå°ã",author:"ç弦",source:"深淵",genre:"poetry"}
2,{id:"tw_078",lang:"zh-TW",text:"ä»å¼·ç±ä»å¼·ï¼æ¸
風æå±±å²¡ï¼ä»æ©«ä»»ä»æ©«ï¼ææç
§å¤§æ±ã",author:"é庸",source:"åå¤©å± é¾è¨",genre:"fiction"},{id:"tw_079",lang:"zh-TW",text:"人çå¨ä¸ï¼å»è¥æé²ãéé
æäººï¼å¯ç¡ä¿¡éªï¼",author:"é庸",source:"åå¤©å± é¾è¨",genre:"fiction"},{id:"tw_080",lang:"zh-TW",text:"ç¶é«éµåè»å éå°æéä¸ç¾å
¬éï¼å好ççè»ä¹è¿½ä¸ä¸ãä¸å人çç¼ç決å®äºä»çé«åº¦ã",author:"ææ",source:"ææèªé",genre:"essay"},{id:"tw_081",lang:"zh-TW",text:"å°èªªå®¶ä¸éæ¯å說æ
äºç人ï¼å¯æ¯å¥½çæ
äºè¶³ä»¥æ¹è®ä¸å人çå¾
ä¸ççæ¹å¼ã",author:"張大æ¥",source:"å°èªªç¨é¡",genre:"essay"},{id:"tw_082",lang:"zh-TW",text:"人ç妿²ï¼ä½ä¸è½å½©æãæ¯ä¸å¤©é½æ¯ç¾å ´ç´æã",author:"çé¼é",source:"éæ¾ç人ç",genre:"essay"},{id:"tw_083",lang:"zh-TW",text:"䏿èï¼ä¸é»é²ã天ç¡çµäººä¹è·¯ã",author:"çé¼é",source:"ç¢çç",genre:"essay"},{id:"tw_084",lang:"zh-TW",text:"樹å¨ãå±±å¨ã大å°å¨ãæ²æå¨ãæå¨ãä½ éè¦ææ¨£æ´å¥½çä¸çï¼",author:"å¼µæé¢¨",source:"æå¨",genre:"essay"},{id:"tw_087",lang:"zh-TW",text:"å人å¡äºè¦éï¼ééå°ä¾ï¼ééå°å»ï¼ééåªåï¼ééæ¶ç©«ã",author:"亦è",source:"ç´è³æµ·æ¯ç³ç",genre:"fiction"},{id:"tw_088",lang:"zh-TW",text:"è¥åé®çå±
æ°ï¼æ¯å人çè
¦è¢è£¡é½ä½èä¸åº§è±åã",author:"西西",source:"æå",genre:"fiction"},{id:"tw_090",lang:"zh-TW",text:"å¨åå¸çå¢æè£¡ï¼æ¯ä¸ççç«é½æ¯ä¸å人çæ
äºã",author:"乿¯",source:"åå¸çè¨",genre:"poetry"},{id:"tw_091",lang:"zh-TW",text:"èµ°è·¯æ¯ä¸ç¨®ç·©æ
¢çæ
è¡ï¼è®ä½ çè¦å¹³å¸¸è¦èä¸è¦ç風æ¯ã",author:"åå
è¥",source:"å䏿çç½èè±",genre:"essay"},{id:"tw_093",lang:"zh-TW",text:"å¤§æ²³å¥æµï¼å¸¶èµ°äºå¤å°æ²æï¼å»å¸¶ä¸èµ°é£äºå»éª¨éå¿çè¨æ¶ã",author:"é½é¦åª",source:"å·¨æµæ²³",genre:"essay"},{id:"tw_094",lang:"zh-TW",text:"ä¸ççæ
äºï¼å¾åªè£¡éå§èªªèµ·å¢ï¼å¾é£æ¢å¤§æ²³ï¼å¾é£å年代ã",author:"é½é¦åª",source:"å·¨æµæ²³",genre:"essay"},{id:"tw_095",lang:"zh-TW",text:"åæ¹æ¯ææ²é»çç¼è¨ï¼èè¬ç±é½æ¯æçç¥é³ã",author:"å¨å¤¢è¶",source:"ééè",genre:"poetry"},{id:"tw_096",lang:"zh-TW",text:"æ²ææ²åå°±æ²ææ²å£¯ï¼æ²ææ²å£¯å°±æ²æå´é«ã",author:"ä½ç§é¨",source:"æåè¦æ
",genre:"essay"},{id:"tw_098",lang:"zh-TW",text:"æµ·çæ¯å¤§æµ·ä¸çç²¾éï¼ç å卿´é¢¨é¨ä¸æ¡å«ï¼é£æ¯å°ç彿ç±çç禮è®ã",author:"鿝é¸",source:"æµ·ç",genre:"essay"},{id:"tw_100",lang:"zh-TW",text:"æå¸æ¯ä¸é¢é¡åï¼æ ç
§åºä¸åæä»£çééãèå³¶å¶¼çæå¸ï¼æ ç
§çæ¯æ¼æµè
æ°¸æçéæã",author:"é³è³æ",source:"å°ç£æ°æå¸å²",genre:"history"},{id:"fr_001",lang:"fr",text:"La suprême sagesse et la suprême raison est de bien remplir le moment présent.",author:"Victor Hugo",source:"Les Misérables",genre:"fiction"},{id:"fr_002",lang:"fr",text:"Même la nuit la plus sombre prendra fin et le soleil se lèvera.",author:"Victor Hugo",source:"Les Misérables",genre:"fiction"},{id:"fr_003",lang:"fr",text:"La liberté commence où l'ignorance finit.",author:"Victor Hugo",source:"Les Misérables",genre:"fiction"},{id:"fr_004",lang:"fr",text:"Il y a des pensées qui sont des prières. Il y a des moments où, quelle que soit l'attitude du corps, l'âme est à genoux.",author:"Victor Hugo",source:"Les Misérables",genre:"fiction"},{id:"fr_006",lang:"fr",text:"Les mots sont les passants mystérieux de l'âme.",author:"Victor Hugo",source:"Les Contemplations",genre:"poetry"},{id:"fr_007",lang:"fr",text:"Le véritable voyage de découverte ne consiste pas à chercher de nouveaux paysages, mais à avoir de nouveaux yeux.",author:"Marcel Proust",source:"à la recherche du temps perdu",genre:"fiction"},{id:"fr_008",lang:"fr",text:"On ne reçoit pas la sagesse, il faut la découvrir soi-même après un trajet que personne ne peut faire pour nous, ne peut nous épargner.",author:"Marcel Proust",source:"à l'ombre des jeunes filles en fleurs",genre:"fiction"}
2,{id:"fr_009",lang:"fr",text:"Le bonheur est salutaire pour le corps, mais c'est le chagrin qui développe les forces de l'esprit.",author:"Marcel Proust",source:"Le Temps retrouvé",genre:"fiction"},{id:"fr_012",lang:"fr",text:"Au milieu de l'hiver, j'ai découvert en moi un invincible été.",author:"Albert Camus",source:"Retour à Tipasa",genre:"essay"},{id:"fr_013",lang:"fr",text:"Il faut imaginer Sisyphe heureux.",author:"Albert Camus",source:"Le Mythe de Sisyphe",genre:"philosophy"},{id:"fr_014",lang:"fr",text:"La lutte elle-même vers les sommets suffit à remplir un cÅur d'homme.",author:"Albert Camus",source:"Le Mythe de Sisyphe",genre:"philosophy"},{id:"fr_016",lang:"fr",text:"Je n'ai pas appris la liberté dans Marx. Il est vrai : je l'ai apprise dans la misère.",author:"Albert Camus",source:"Carnets",genre:"essay"},{id:"fr_018",lang:"fr",text:"On ne voit bien qu'avec le cÅur. L'essentiel est invisible pour les yeux.",author:"Antoine de Saint-Exupéry",source:"Le Petit Prince",genre:"fiction"},{id:"fr_019",lang:"fr",text:"Tu deviens responsable pour toujours de ce que tu as apprivoisé.",author:"Antoine de Saint-Exupéry",source:"Le Petit Prince",genre:"fiction"},{id:"fr_020",lang:"fr",text:"C'est le temps que tu as perdu pour ta rose qui fait ta rose si importante.",author:"Antoine de Saint-Exupéry",source:"Le Petit Prince",genre:"fiction"},{id:"fr_021",lang:"fr",text:"Toutes les grandes personnes ont d'abord été des enfants. Mais peu d'entre elles s'en souviennent.",author:"Antoine de Saint-Exupéry",source:"Le Petit Prince",genre:"fiction"},{id:"fr_022",lang:"fr",text:"La terre nous en apprend plus long sur nous que tous les livres. Parce qu'elle nous résiste.",author:"Antoine de Saint-Exupéry",source:"Terre des hommes",genre:"essay"},{id:"fr_023",lang:"fr",text:"Aimer, ce n'est pas se regarder l'un l'autre, c'est regarder ensemble dans la même direction.",author:"Antoine de Saint-Exupéry",source:"Terre des hommes",genre:"essay"},{id:"fr_024",lang:"fr",text:"La parole humaine est comme un chaudron fêlé où nous battons des mélodies à faire danser les ours, quand on voudrait attendrir les étoiles.",author:"Gustave Flaubert",source:"Madame Bovary",genre:"fiction"},{id:"fr_026",lang:"fr",text:"On ne doit écrire que quand on laisse un morceau de sa chair dans l'encrier, chaque fois qu'on trempe sa plume.",author:"Gustave Flaubert",source:"Correspondance",genre:"essay"},{id:"fr_027",lang:"fr",text:"Lisez pour vivre.",author:"Gustave Flaubert",source:"Correspondance",genre:"essay"},{id:"fr_028",lang:"fr",text:"Le hasard est le plus grand romancier du monde ; pour être fécond, il n'y a qu'à l'étudier.",author:"Honoré de Balzac",source:"La Comédie humaine",genre:"fiction"},{id:"fr_030",lang:"fr",text:"La résignation est un suicide quotidien.",author:"Honoré de Balzac",source:"Illusions perdues",genre:"fiction"},{id:"fr_031",lang:"fr",text:"Toute la sagesse humaine sera dans ces deux mots : Attendre et Espérer.",author:"Alexandre Dumas",source:"Le Comte de Monte-Cristo",genre:"fiction"},{id:"fr_032",lang:"fr",text:"La vie est un orage. Un jour tu te prends au soleil, le lendemain la foudre t'éclate sur un rocher.",author:"Alexandre Dumas",source:"Le Comte de Monte-Cristo",genre:"fiction"},{id:"fr_033",lang:"fr",text:"Un pour tous, tous pour un.",author:"Alexandre Dumas",source:"Les Trois Mousquetaires",genre:"fiction"},{id:"fr_035",lang:"fr",text:"Enivrez-vous. Il faut être toujours ivre. Tout est là : c'est l'unique question.",author:"Charles Baudelaire",source:"Le Spleen de Paris",genre:"poetry"},{id:"fr_037",lang:"fr",text:"Le génie n'est que l'enfance retrouvée à volonté.",author:"Charles Baudelaire",source:"Le Peintre de la vie moderne",genre:"essay"},{id:"fr_038",lang:"fr",text:"Homme libre, toujours tu chériras la mer !",author:"Charles Baudelaire",source:"Les Fleurs du mal",genre:"poetry"},{id:"fr_039",lang:"fr",text:"Il faut cultiver notre jardin.",author:"Voltaire",source:"Candide",genre:"fiction"},{id:"fr_040",lang:"fr",text:"Le doute n'est pas un état bien agréable, mais l'assurance est un état ridicule.",author:"Voltaire",source:"C
2orrespondance",genre:"philosophy"},{id:"fr_041",lang:"fr",text:"J'ai décidé d'être heureux parce que c'est bon pour la santé.",author:"Voltaire",source:"Correspondance",genre:"philosophy"},{id:"fr_042",lang:"fr",text:"Le secret d'ennuyer est celui de tout dire.",author:"Voltaire",source:"Discours en vers sur l'homme",genre:"poetry"},{id:"fr_043",lang:"fr",text:"Je ne suis pas d'accord avec ce que vous dites, mais je me battrai jusqu'à la mort pour que vous ayez le droit de le dire.",author:"Voltaire",source:"Attributed",genre:"philosophy"},{id:"fr_044",lang:"fr",text:"Il faut manger pour vivre et non pas vivre pour manger.",author:"Molière",source:"L'Avare",genre:"drama"},{id:"fr_046",lang:"fr",text:"Plus grand est l'obstacle, et plus grande est la gloire de le surmonter.",author:"Molière",source:"Les Fourberies de Scapin",genre:"drama"},{id:"fr_047",lang:"fr",text:"L'existence précède l'essence.",author:"Jean-Paul Sartre",source:"L'Existentialisme est un humanisme",genre:"philosophy"},{id:"fr_049",lang:"fr",text:"L'homme est condamné à être libre.",author:"Jean-Paul Sartre",source:"L'Existentialisme est un humanisme",genre:"philosophy"},{id:"fr_050",lang:"fr",text:"Nous sommes nos choix.",author:"Jean-Paul Sartre",source:"L'Ãtre et le Néant",genre:"philosophy"},{id:"fr_051",lang:"fr",text:"On ne naît pas femme : on le devient.",author:"Simone de Beauvoir",source:"Le Deuxième Sexe",genre:"philosophy"},{id:"fr_052",lang:"fr",text:"C'est dans la connaissance des conditions véritables de notre vie qu'il nous faut puiser la force de vivre et des raisons d'agir.",author:"Simone de Beauvoir",source:"Pour une morale de l'ambiguïté",genre:"philosophy"},{id:"fr_053",lang:"fr",text:"Je suis trop intelligente, trop exigeante et trop ingénieuse pour que quiconque puisse prendre en charge ma liberté.",author:"Simone de Beauvoir",source:"Les Mandarins",genre:"fiction"},{id:"fr_054",lang:"fr",text:"Ãcrire, c'est aussi ne pas parler. C'est se taire. C'est hurler sans bruit.",author:"Marguerite Duras",source:"Ãcrire",genre:"essay"},{id:"fr_056",lang:"fr",text:"L'alcool n'a pas consolé, la musique non plus, ni la littérature. Mais la littérature, c'est quand même autre chose.",author:"Marguerite Duras",source:"Outside",genre:"essay"},{id:"fr_057",lang:"fr",text:"Un roman est un miroir qui se promène sur une grande route.",author:"Stendhal",source:"Le Rouge et le Noir",genre:"fiction"},{id:"fr_060",lang:"fr",text:"La vérité est en marche et rien ne l'arrêtera.",author:"Ãmile Zola",source:"J'accuseâ¦!",genre:"essay"},{id:"fr_061",lang:"fr",text:"Si vous me demandez ce que je suis venu faire en ce monde, moi, artiste, je vous répondrai : je suis venu vivre à voix haute.",author:"Ãmile Zola",source:"Mes Haines",genre:"essay"},{id:"fr_062",lang:"fr",text:"La vie, voyez-vous, ça n'est jamais si bon ni si mauvais qu'on croit.",author:"Guy de Maupassant",source:"Une vie",genre:"fiction"},{id:"fr_064",lang:"fr",text:"On a vraiment du mérite que dans ce qu'on ne possède pas de naissance.",author:"Guy de Maupassant",source:"Fort comme la mort",genre:"fiction"},{id:"fr_068",lang:"fr",text:"Patience et longueur de temps font plus que force ni que rage.",author:"Jean de La Fontaine",source:"Fables",genre:"poetry"},{id:"fr_069",lang:"fr",text:"On a souvent besoin d'un plus petit que soi.",author:"Jean de La Fontaine",source:"Fables",genre:"poetry"},{id:"fr_070",lang:"fr",text:"Rien ne sert de courir ; il faut partir à point.",author:"Jean de La Fontaine",source:"Fables",genre:"poetry"},{id:"fr_073",lang:"fr",text:"Philosopher, c'est apprendre à mourir.",author:"Michel de Montaigne",source:"Essais",genre:"philosophy"},{id:"fr_074",lang:"fr",text:"Le monde n'est qu'une branloire pérenne. Toutes choses y branlent sans cesse.",author:"Michel de Montaigne",source:"Essais",genre:"philosophy"},{id:"fr_075",lang:"fr",text:"Chaque homme porte la forme entière de l'humaine condition.",author:"Michel de Montaigne",source:"Essais",genre:"philosophy"},{id:"fr_076",lang:"fr",text:"L'homme est né libre, et partout il est dans les fers.",author:"Jean-Jacques Rousseau",source:"Du contrat social",genre:"philosophy"}
2,{id:"fr_077",lang:"fr",text:"Vivre n'est pas respirer, c'est agir.",author:"Jean-Jacques Rousseau",source:"Ãmile, ou De l'éducation",genre:"philosophy"},{id:"fr_078",lang:"fr",text:"Il faut avec les mots de tout le monde écrire comme personne.",author:"Colette",source:"Journal à rebours",genre:"essay"},{id:"fr_079",lang:"fr",text:"Le difficile, ce n'est pas de donner, c'est de ne pas tout donner.",author:"Colette",source:"La Naissance du jour",genre:"fiction"},{id:"fr_080",lang:"fr",text:"Il faudrait essayer d'être heureux, ne serait-ce que pour donner l'exemple.",author:"Jacques Prévert",source:"Spectacle",genre:"poetry"},{id:"fr_082",lang:"fr",text:"Il n'y a pas de hasard, il n'y a que des rendez-vous.",author:"Paul Ãluard",source:"Capitale de la douleur",genre:"poetry"},{id:"fr_084",lang:"fr",text:"Le cÅur a ses raisons que la raison ne connaît point.",author:"Blaise Pascal",source:"Pensées",genre:"philosophy"},{id:"fr_085",lang:"fr",text:"Tout le malheur des hommes vient d'une seule chose, qui est de ne savoir pas demeurer en repos dans une chambre.",author:"Blaise Pascal",source:"Pensées",genre:"philosophy"},{id:"fr_086",lang:"fr",text:"L'homme n'est qu'un roseau, le plus faible de la nature ; mais c'est un roseau pensant.",author:"Blaise Pascal",source:"Pensées",genre:"philosophy"},{id:"fr_087",lang:"fr",text:"Je pense, donc je suis.",author:"René Descartes",source:"Discours de la méthode",genre:"philosophy"},{id:"fr_088",lang:"fr",text:"Il est bon de suivre sa pente, pourvu que ce soit en montant.",author:"André Gide",source:"Les Faux-Monnayeurs",genre:"fiction"},{id:"fr_089",lang:"fr",text:"On ne découvre pas de terre nouvelle sans consentir à perdre de vue, d'abord et longtemps, tout rivage.",author:"André Gide",source:"Les Faux-Monnayeurs",genre:"fiction"},{id:"fr_090",lang:"fr",text:"Les yeux ouverts, je me suis exercé à contempler le monde en homme qui va le quitter.",author:"Marguerite Yourcenar",source:"Mémoires d'Hadrien",genre:"fiction"},{id:"fr_091",lang:"fr",text:"Tout bonheur est un chef-d'Åuvre : la moindre erreur le fausse, la moindre hésitation l'altère.",author:"Marguerite Yourcenar",source:"Mémoires d'Hadrien",genre:"fiction"},{id:"fr_092",lang:"fr",text:"Le style est une manière absolue de voir les choses.",author:"Gustave Flaubert",source:"Correspondance",genre:"essay"},{id:"fr_093",lang:"fr",text:"Nous avons tous assez de force pour supporter les maux d'autrui.",author:"François de La Rochefoucauld",source:"Maximes",genre:"philosophy"},{id:"fr_095",lang:"fr",text:"On risque autant à croire trop qu'à croire trop peu.",author:"Denis Diderot",source:"Pensées philosophiques",genre:"philosophy"},{id:"fr_096",lang:"fr",text:"à temps ! suspends ton vol, et vous, heures propices ! Suspendez votre cours.",author:"Alphonse de Lamartine",source:"Le Lac",genre:"poetry"},{id:"fr_098",lang:"fr",text:"C'est la nuit qu'il est beau de croire à la lumière.",author:"Edmond Rostand",source:"Chantecler",genre:"drama"},{id:"fr_099",lang:"fr",text:"Mal nommer un objet, c'est ajouter au malheur de ce monde.",author:"Albert Camus",source:"Sur une philosophie de l'expression",genre:"essay"},{id:"fr_101",lang:"fr",text:"Vivre, c'est ce qu'il y a de plus rare au monde. La plupart des gens existent, c'est tout.",author:"Oscar Wilde",source:"L'Ãme humaine (trad.)",genre:"essay"},{id:"fr_102",lang:"fr",text:"La lecture de tous les bons livres est comme une conversation avec les plus honnêtes gens des siècles passés.",author:"René Descartes",source:"Discours de la méthode",genre:"philosophy"},{id:"fr_103",lang:"fr",text:"Il faut beaucoup étudier pour savoir un peu.",author:"Montesquieu",source:"Pensées",genre:"philosophy"},{id:"fr_104",lang:"fr",text:"L'attention est la forme la plus rare et la plus pure de la générosité.",author:"Simone Weil",source:"Lettre à Joë Bousquet",genre:"philosophy"}];function ir({className:t,children:n}){const s=oe.useRef(null),[c,g]=l.useState(!1),[f,y]=l.useState(!1),a=l.useCallback(()=>{const b=s.current;b&&(g(b.scrollLeft>4),y(b.scrollLeft+b.clientWidth<b.scrollWidth-4))},[]);l.useEffect(()=>{const b=s.current;if(!b)return;a(),b.addEventListener("scroll",a,{passive:!0});const i=new ResizeObserver(a);return i.observe(b),()=>{b.removeEventListener("scroll",a),i.disconnect()}},[a]);const v=b=>{const i=s.current;i&&i.scrollBy({left:b*i.clientWidth*.7,behavior:fn()})};return e.jsxs("div",{className:"scroll-row-wrap",children:[e.jsx("div",{ref:s,className:`${t} scroll-row-hidden-bar`,children:n}),c&&e.jsx("button",{type:"button",className:"scroll-arrow scroll-arrow-left",onClick:()=>v(-1),children:e.jsx("svg",{viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("polyline",{points:"15 18 9 12 15 6"})})}),f&&e.jsx("button",{type:"button",className:"scroll-arrow scroll-arrow-right",onClick:()=>v(1),children:e.jsx("svg",{viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("polyline",{points:"9 6 15 12 9 18"})})})]})}function lr(t,n,s,c){let g=n||"";if(g){const z=g.match(/^([^:\(\u2014\u2013]{4,})[:\(\u2014\u2013]/);z&&(g=z[1].trim()),g.length>30&&(g=g.slice(0,28)+"â¦")}const f=new Date().getHours(),y=new Date().getDay(),a=y===0||y===6,b=t==="zh"||t==="zh-TW"?"ï¼":", ",i=g,{weekMs:M,streak:o,todayMs:d,daysMetCount:u}=s,_=z=>z>0?c(z):"",D=_(M),x=[],S=[],j=[],m=[];d>=3e5&&(x.push(`You've read ${_(d)} today â keep going whenever you're ready.`),S.push(`ä»å¤©è¯»äº ${_(d)}ï¼æ³ç»§ç»çæ¶åéæ¶ç¿»å¼ã`),j.push(`ä»å¤©è®äº ${_(d)}ï¼æ³ç¹¼çºçæåé¨æç¿»éã`),m.push(`${_(d)} aujourd'hui â reprenez quand vous voulez.`)),o>=7?(x.push(`${o}-day streak â keep the rhythm going!`),S.push(`è¿ç»é
读 ${o} 天äºï¼ä¿æè¿ä¸ªèå¥ï¼`),j.push(`é£çºé±è® ${o} 天äºï¼ä¿æéåç¯å¥ï¼`),m.push(`${o} jours d'affilée â gardez le rythme !`)):o>=3&&(x.push(`${o} days in a row â today makes it even better!`),S.push(`è¿ç» ${o} 天äºï¼ä»å¤©ç»§ç»ï¼`),j.push(`é£çº ${o} 天äºï¼ä»å¤©ç¹¼çºï¼`),m.push(`${o} jours consécutifs â encore un aujourd'hui ?`)),u>=5&&(x.push(`${u}/7 days this week â almost a perfect week!`),S.push(`æ¬å¨ ${u}/7 天达æ ï¼å¿«æ»¡å¤äºï¼`),j.push(`æ¬é± ${u}/7 天鿍ï¼å¿«æ»¿å¤äºï¼`),m.push(`${u}/7 jours cette semaine â presque parfait !`)),M>=18e5&&(x.push(`${D} this week â shall we add a few more pages?`),S.push(`æ¬å¨å·²è¯» ${D}ï¼è¦ä¸è¦åç¿»å 页ï¼`),j.push(`æ¬é±å·²è® ${D}ï¼è¦ä¸è¦å翻幾é ï¼`),m.push(`${D} cette semaine â on continue ?`));const C=z=>z.length>0?z[Math.floor(Math.random()*z.length)]:null,$={en:x,zh:S,"zh-TW":j,fr:m},A=C($[t]||$.en),L={en:{morning:"Good morning",afternoon:"Hey",evening:"Good evening",lateNight:"Still up",weekend:"Happy weekend"},zh:{morning:"æ©ä¸å¥½",afternoon:"ä¸å好",evening:"æä¸å¥½",lateNight:"夿·±äº",weekend:"卿«æå¿«"},"zh-TW":{morning:"æ©å®",afternoon:"åå®",evening:"æä¸å¥½",lateNight:"夿·±äº",weekend:"鱿«æå¿«"},fr:{morning:"Bonjour",afternoon:"Salut",evening:"Bonsoir",lateNight:"Encore debout",weekend:"Bon week-end"}},W=L[t]||L.en;let q;a?q=W.weekend:f<6?q=W.lateNight:f<12?q=W.morning:f<18?q=W.afternoon:f<23?q=W.evening:q=W.lateNight;const G={en:i?[`Pick up "${i}" where you left off?`,`"${i}" is waiting for you.`,`Ready for the next chapter of "${i}"?`]:["A good book makes any moment better.","Your next great read is one click away.","Every page counts â start reading!"],zh:i?[`ç»§ç»ã${i}ãçæ
ç¨ï¼`,`ã${i}ãçæ
äºè¿å¨çä½ ã`,`ç¿»å¼ã${i}ãï¼åå°ä¸æ¬¡ç精彩ã`]:["好书让æ¯ä¸å»é½æ´ææä¹ã","ç¿»å¼ä¸æ¬ä¹¦ï¼å¼å¯ä»å¤©çé
读ã","æ¯ä¸é¡µé½ç®æ°ï¼å¼å§è¯»å§ï¼"],"zh-TW":i?[`ç¹¼çºã${i}ãçæ
ç¨ï¼`,`ã${i}ãçæ
äºéå¨çä½ ã`,`ç¿»éã${i}ãï¼åå°ä¸æ¬¡ç精彩ã`]:["好æ¸è®æ¯ä¸å»é½æ´ææç¾©ã","ç¿»é䏿¬æ¸ï¼éåä»å¤©çé±è®ã","æ¯ä¸é é½ç®æ¸ï¼éå§è®å§ï¼"],fr:i?[`On reprend "${i}" ?`,`"${i}" vous attend.`,`Prêt(e) pour le prochain chapitre de "${i}" ?`]:["Un bon livre rend chaque instant meilleur.","Votre prochaine lecture est à portée de clic.","Chaque page compte â commencez à lire !"]},k=A||C(G[t]||G.en)||"";return{prefix:q+b,body:k}}function cr({ctx:t,recentBooks:n,fileInputRef:s}){var ie,E,T;const{t:c,language:g}=t,{user:f}=Oe(),y=et(),{data:a,loading:v}=or(),[b,i]=l.useState(new Set),[M,o]=l.useState({}),[d,u]=l.useState(()=>Se[Math.floor(Math.random()*Se.length)]);l.useEffect(()=>{ne.getQuoteLikes().then(p=>{p!=null&&p.likes&&i(new Set(p.likes))}).catch(()=>{})},[]),l.useEffect(()=>{if(!d)return;const p=d.id;if(p in M)return;let I=!1;
2return ne.getQuoteLikeCount(p).then(Z=>{if(I)return;const Q=Number((Z==null?void 0:Z.count)??0);o(te=>({...te,[p]:Q}))}).catch(()=>{}),()=>{I=!0}},[d,M]);const _=d&&b.has(d.id),D=d?M[d.id]??null:null,x=l.useCallback(async()=>{if(!d)return;const p=d.id,I=b.has(p),Z=M[p]??0;i(Q=>{const te=new Set(Q);return I?te.delete(p):te.add(p),te}),o(Q=>({...Q,[p]:Math.max(0,Z+(I?-1:1))}));try{const Q=I?await ne.unlikeQuote(p):await ne.likeQuote({quote_id:p,genre:d.genre,author_name:d.author,language:d.lang});Q&&typeof Q.count=="number"&&o(te=>({...te,[p]:Q.count}))}catch{i(Q=>{const te=new Set(Q);return I?te.add(p):te.delete(p),te}),o(Q=>({...Q,[p]:Z}))}},[d,b,M]),S=l.useCallback(()=>{if(Se.length<=1)return;let p;do p=Se[Math.floor(Math.random()*Se.length)];while(p.id===(d==null?void 0:d.id)&&Se.length>1);u(p)},[d]),j=p=>{if(!p)return"0m";const I=Math.floor(p/6e4);if(I<1)return"<1m";const Z=Math.floor(I/60),Q=I%60;return Z>0&&Q>0?`${Z}h ${Q}m`:Z>0?`${Z}h`:`${Q}m`},m=a==null?void 0:a.week,C=a==null?void 0:a.month,$=c(`stats.month${new Date().getMonth()+1}`),A=[c("stats.mon"),c("stats.tue"),c("stats.wed"),c("stats.thu"),c("stats.fri"),c("stats.sat"),c("stats.sun")],L=n[0],W=L?t.bookProgress[L.id]:null,q=Math.round((W==null?void 0:W.percentage)||0),G=(W==null?void 0:W.chapter)||"",k=L?t.bookCovers[L.id]:null,z=(f==null?void 0:f.display_name)||((E=(ie=f==null?void 0:f.email)==null?void 0:ie.split("@"))==null?void 0:E[0])||"",Y=m!=null&&m.days_met?m.days_met.filter(Boolean).length:0,K=l.useMemo(()=>{var p;return lr(g,(L==null?void 0:L.title)||"",{monthMs:(C==null?void 0:C.total_ms)||0,weekMs:(m==null?void 0:m.total_ms)||0,streak:(a==null?void 0:a.streak)||0,todayMs:((p=a==null?void 0:a.today)==null?void 0:p.ms)||0,booksFinished:(a==null?void 0:a.books_finished)||0,totalDays:(a==null?void 0:a.total_reading_days)||0,daysMetCount:Y},j)},[g,L==null?void 0:L.title,C==null?void 0:C.total_ms,m==null?void 0:m.total_ms,a==null?void 0:a.streak,(T=a==null?void 0:a.today)==null?void 0:T.ms,Y]);return e.jsxs("div",{className:"landing-view",children:[d&&e.jsxs("div",{className:"landing-quote-card",children:[e.jsx("div",{className:"landing-quote-card-bg"}),e.jsxs("div",{className:"landing-quote-card-inner",children:[e.jsx("p",{className:"landing-quote-text",children:d.text}),e.jsxs("div",{className:"landing-quote-row",children:[e.jsxs("span",{className:"landing-quote-meta",children:[d.author,d.source&&e.jsxs("span",{className:"landing-quote-source",children:[", ",d.source]})]}),e.jsxs("button",{className:`landing-like-btn ${_?"liked":""}`,onClick:x,title:c(_?"landing.liked":"landing.like"),children:[_?e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"currentColor",stroke:"none",children:e.jsx("path",{d:"M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z"})}):e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"})}),D!==null&&D>0&&e.jsx("span",{className:"landing-like-count",children:D})]}),e.jsx("button",{className:"landing-refresh-btn",onClick:S,title:c("landing.nextQuote"),children:e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("polyline",{points:"23 4 23 10 17 10"}),e.jsx("path",{d:"M20.49 15a9 9 0 1 1-2.12-9.36L23 10"})]})})]})]})]}),e.jsxs("div",{className:"landing-mid-row",children:[L&&e.jsxs("div",{className:"landing-hero",onClick:()=>t.handleOpenBook(L),children:[e.jsxs("div",{className:"landing-hero-cover-col",children:[e.jsxs("div",{className:"landing-hero-cover",children:[k?e.jsx("img",{src:k,alt:L.title,className:"landing-hero-cover-img"}):e.jsx("div",{className:"landing-hero-cover-placeholder",children:e.jsx("span",{children:(L.title||"?").charAt(0).toUpperCase()})}),e.jsx(We,{book:L}),L.file_type==="epub_from_pdf"&&L.conversion_status==="ready"&&t.openChapterPickerForBook&&qe(L)&&e.jsx("button",{type:"button",className:"book-add-chapters-btn",onClick:p=>{p.stopPropagation(),t.openChapterPickerForBook(L)}
2,title:c("library.addChapters")||"å¢å ç« è",children:e.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",children:e.jsx("path",{d:"M12 5v14M5 12h14"})})})]}),e.jsxs("div",{className:"continue-info",children:[e.jsx("h3",{className:"continue-title",title:L.title,children:L.title}),e.jsxs("div",{className:"continue-progress-row",children:[e.jsx("div",{className:"continue-progress-bar",children:e.jsx("div",{className:"continue-progress-fill",style:{width:`${q}%`}})}),e.jsxs("span",{className:"continue-progress-pct",children:[q,"%"]})]})]})]}),e.jsxs("div",{className:"landing-hero-info",children:[e.jsxs("h2",{className:"landing-hero-hello",children:[K.prefix,e.jsx("strong",{className:"landing-hero-hello-name",children:z})]}),K.body&&e.jsx("p",{className:"landing-hero-subtitle",children:K.body}),G&&e.jsxs("p",{className:"landing-hero-chapter",children:[c("landing.lastRead"),": ",G]}),e.jsx(sr,{bookId:L==null?void 0:L.id,language:g})]})]}),a&&!v&&e.jsxs("aside",{className:"landing-aside",children:[e.jsxs("div",{className:"landing-aside-stat-row",children:[e.jsxs("button",{className:"landing-stat-box",onClick:()=>y("/dashboard"),children:[e.jsx("span",{className:"landing-stat-label",children:c("landing.weekReading")}),e.jsx("strong",{className:"landing-stat-value",children:j(m==null?void 0:m.total_ms)})]}),e.jsxs("button",{className:"landing-stat-box",onClick:()=>y("/dashboard"),children:[e.jsxs("span",{className:"landing-stat-label",children:[$,c("stats.reading")]}),e.jsx("strong",{className:"landing-stat-value",children:j(C==null?void 0:C.total_ms)})]})]}),e.jsx("div",{className:"landing-aside-card landing-aside-card-clickable",onClick:()=>y("/dashboard"),children:e.jsx("div",{className:"landing-week-days",children:A.map((p,I)=>{var me,fe;const Z=(new Date().getDay()+6)%7,Q=((me=m==null?void 0:m.days_met)==null?void 0:me[I])||!1,te=I>Z,re=((fe=m==null?void 0:m.days_ms)==null?void 0:fe[I])||0,ae=I===Z&&!Q&&re>0?Math.min(1,re/(5*60*1e3)):0;return e.jsxs("div",{className:"landing-day-col",title:(()=>{if(te)return"";const de=new Date;return de.setDate(de.getDate()+(I-Z)),`${de.getMonth()+1}æ${de.getDate()}æ¥ ${j(re)}`})(),children:[e.jsxs("div",{className:`landing-day-circle ${Q?"met":""} ${te?"future":""} ${ae>0?"partial":""}`,children:[Q&&e.jsx("svg",{width:"9",height:"9",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3.5",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("polyline",{points:"20 6 9 17 4 12"})}),ae>0&&e.jsxs("svg",{className:"landing-day-ring",width:"18",height:"18",viewBox:"0 0 18 18",children:[e.jsx("circle",{cx:"9",cy:"9",r:"7.5",fill:"none",stroke:"currentColor",strokeWidth:"1.5",opacity:"0.15"}),e.jsx("circle",{cx:"9",cy:"9",r:"7.5",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:`${ae*47.1} 47.1`,strokeLinecap:"round",transform:"rotate(-90 9 9)"})]})]}),e.jsx("span",{className:"landing-day-label",children:p})]},I)})})}),e.jsxs("div",{className:"landing-aside-card landing-shelf",children:[e.jsxs("button",{className:"landing-shelf-header",onClick:()=>y("/?view=home"),children:[e.jsx("span",{children:c("sidebar.myBookshelf")}),e.jsx("svg",{className:"landing-books-arrow",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("polyline",{points:"9 6 15 12 9 18"})})]}),e.jsxs("div",{className:"landing-shelf-grid",children:[e.jsx("button",{className:"landing-shelf-add",onClick:p=>{var I;p.stopPropagation(),(I=s==null?void 0:s.current)==null||I.click()},children:e.jsx("svg",{viewBox:"0 0 24 24",width:"20",height:"20",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:e.jsx("path",{d:"M12 5v14M5 12h14",strokeLinecap:"round",strokeLinejoin:"round"})})}),(t.books||[]).filter(p=>!p.deleted_at).sort((p,I)=>new Date(I.created_at)-new Date(p.created_at)).slice(0,3).map(p=>e.jsxs("div",{className:"landing-shelf-book",onClick:()=>t.handleOpenBook(p),children:[t.bookCovers[p.id]?e.jsx("img",{src:t.bookCovers[p.id],alt:p.title,className:"landing-shelf-cover"}):e.jsx("div",{className:"landing-shelf-placeholder",children:e.jsx("span",{children:(p.title||"?").charAt(0).toUpperCase()})}
2),e.jsx(We,{book:p}),p.file_type==="epub_from_pdf"&&p.conversion_status==="ready"&&t.openChapterPickerForBook&&qe(p)&&e.jsx("button",{type:"button",className:"book-add-chapters-btn",onClick:I=>{I.stopPropagation(),t.openChapterPickerForBook(p)},title:c("library.addChapters")||"å¢å ç« è",children:e.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",children:e.jsx("path",{d:"M12 5v14M5 12h14"})})})]},p.id))]})]})]})]}),n.length>1&&e.jsxs("div",{className:"landing-books-full",children:[e.jsxs("button",{className:"landing-books-title",onClick:()=>y("/?view=continue-reading"),children:[c("landing.continueReading")," ",e.jsx("svg",{className:"landing-books-arrow",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("polyline",{points:"9 6 15 12 9 18"})})]}),e.jsx(ir,{className:"books-row continue-row",children:n.slice(1).map((p,I)=>e.jsx(nr,{book:p,index:I,ctx:t},p.id))})]})]})}const dr=oe.memo(cr),Ze=()=>e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("polyline",{points:"20 6 9 17 4 12"})});function ur({filters:t,setFilters:n,books:s,t:c,uiLang:g}){const[f,y]=l.useState(!1),a=l.useRef(null),v=(t.difficulty!=="all"?1:0)+(t.length!=="all"?1:0)+(t.list!=="all"?1:0);l.useEffect(()=>{if(!f)return;const x=S=>{a.current&&!a.current.contains(S.target)&&y(!1)};return document.addEventListener("pointerdown",x),()=>document.removeEventListener("pointerdown",x)},[f]);const b=oe.useMemo(()=>{const x={};for(const S of s||[])S.difficulty_level&&(x[S.difficulty_level]=(x[S.difficulty_level]||0)+1);return Object.entries(x).sort((S,j)=>{const m=jt.indexOf(S[0]),C=jt.indexOf(j[0]);return m===-1&&C===-1?S[0].localeCompare(j[0]):m===-1?1:C===-1?-1:m-C})},[s]),i=oe.useMemo(()=>{const x={};for(const S of s||[])for(const j of nt(S.reading_lists))x[j]=(x[j]||0)+1;return Mt.filter(S=>x[S]).map(S=>[S,x[S]])},[s]),M=(x,S)=>n(j=>({...j,[x]:j[x]===S?"all":S})),o=Le(g),d=o?"é¾åº¦":"Level",u=o?"ç¯å¹
":"Length",_=o?"书å":"Reading list",D=o?{short:"< 5ä¸å",medium:"5â15ä¸å",long:"> 15ä¸å"}:{short:"< 50k",medium:"50â150k",long:"> 150k"};return e.jsxs("div",{className:"grid-filter-wrap",ref:a,children:[e.jsxs("button",{type:"button",className:`btn-icon-action ${v>0?"btn-icon-action-active":""}`,onClick:()=>y(x=>!x),title:c("library.filter")||"Filter",children:[e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M3 4h18l-7 8.5V18l-4 2v-7.5L3 4z"})}),v>0&&e.jsx("span",{className:"filter-badge",children:v})]}),f&&e.jsxs("div",{className:"grid-filter-dropdown",children:[b.length>1&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"grid-filter-section-label",children:d}),b.map(([x,S])=>e.jsxs("button",{type:"button",className:t.difficulty===x?"active":"",onClick:()=>M("difficulty",x),children:[x,e.jsx("span",{className:"grid-filter-count",children:S}),t.difficulty===x&&e.jsx(Ze,{})]},x)),e.jsx("div",{className:"grid-filter-divider"})]}),i.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"grid-filter-section-label",children:_}),i.map(([x,S])=>e.jsxs("button",{type:"button",title:Pt(x,g),className:t.list===x?"active":"",onClick:()=>M("list",x),children:[Tt(x,g),e.jsx("span",{className:"grid-filter-count",children:S}),t.list===x&&e.jsx(Ze,{})]},x)),e.jsx("div",{className:"grid-filter-divider"})]}),e.jsx("div",{className:"grid-filter-section-label",children:u}),zt.map(x=>e.jsxs("button",{type:"button",className:t.length===x.id?"active":"",onClick:()=>M("length",x.id),children:[e.jsx(Et,{bucket:x.id}),D[x.id],t.length===x.id&&e.jsx(Ze,{})]},x.id))]})]})}function Le(t){return t==="zh"||t==="zh-TW"}const jt=["A1","A2","A2-B1","B1","B1-B2","B2","B2-C1","C1","C1-C2","C2"],zt=[{id:"short",maxWords:5e4},{id:"medium",maxWords:15e4},{id:"long",maxWords:1/0}],Bt={harvard_classics:{en:"Harvard Classics",zh:"åä½ç»å
¸",descEn:"Harvard classics list",descZh:"åä½å¤§å¦ç»å
¸ä¹¦å"},columbia_lithum:{en:"Columbia Lit Hum",zh:"å¥å¤§æå¦æ ¸å¿",descEn:"Columbia must-read",descZh:"å¥å¤§æ¬ç§å¿
读书"},stjohns_greatbooks:{en:"Great Books",zh:"ç»å
¸åè课ç¨",descEn:`St. John's "Great Books" program`,descZh:"å£çº¦ç¿°å¦é¢âGreat Booksâ课ç¨ä¹¦å"},ap_literature:{en:"AP Literature",zh:"AP æå¦",descEn:"US AP-level lit",descZh:"ç¾å½å¤§å¦å
修课"},commoncore_hs:{en:"Common Core",zh:"ç¾å½K12å¿
读",descEn:"US K-12 must-read",descZh:"ç¾å½ä¸å°å¦å¿
读"},harvard_reading:{en:"Harvard Reading",zh:"å使¨è",descEn:"Harvard recommended",descZh:"åä½å¤§å¦æ¨è书"},yale_princeton:{en:"Yale / Princeton",zh:"è¶é²/æ®ææ¯é¡¿",descEn:"Yale/Princeton picks",de
2scZh:"è¶é²æ®ææ¯é¡¿æ¨è"},canada_university:{en:"Canadian Univ.",zh:"å æ¿å¤§å¤§å¦",descEn:"Top Canadian unis",descZh:"å æ¿å¤§åæ ¡æ¨è"},canada_highschool:{en:"Canadian HS",zh:"å æ¿å¤§é«ä¸",descEn:"Canadian HS must-read",descZh:"å æ¿å¤§é«ä¸å¿
读"}},Mt=["harvard_classics","columbia_lithum","stjohns_greatbooks","ap_literature","commoncore_hs","harvard_reading","yale_princeton","canada_university","canada_highschool"];function nt(t){if(!t)return[];if(Array.isArray(t))return t;try{const n=JSON.parse(t);return Array.isArray(n)?n:[]}catch{return[]}}function Tt(t,n){const s=Bt[t];return s?Le(n)?s.zh:s.en:t}function Pt(t,n){const s=Bt[t];return s?Le(n)?s.descZh||"":s.descEn||"":""}const At="easeverse-curated-filters";function hr(){try{const t=localStorage.getItem(At);if(!t)return null;const n=JSON.parse(t);return!n||typeof n!="object"?null:n}catch{return null}}function gr(t){try{localStorage.setItem(At,JSON.stringify(t))}catch{}}function Dt(t){if(!t||t<=0)return null;for(const n of zt)if(t<=n.maxWords)return n.id;return"long"}function fr({ctx:t}){const{t:n,language:s,api:c,isPaid:g,goBackHome:f,setError:y,setBooks:a,setLocalFileIds:v,books:b}=t,i=et(),[M]=St(),o=(M.get("clang")||"en").toLowerCase(),[d,u]=l.useState(null),[_,D]=l.useState(!0),[x,S]=l.useState({}),[j,m]=l.useState({}),[C,$]=l.useState(()=>{const k=hr();return{difficulty:(k==null?void 0:k.difficulty)||"all",length:(k==null?void 0:k.length)||"all",list:(k==null?void 0:k.list)||"all",free:(k==null?void 0:k.free)||"all"}});l.useEffect(()=>{gr(C)},[C]);const A=oe.useMemo(()=>{const k=new Set;for(const z of b||[])z.canonical_book_id&&k.add(z.canonical_book_id);return k},[b]),L=l.useCallback(k=>{if(!k||!b)return null;const z=b.find(Y=>Y.canonical_book_id===k);return z?z.id:null},[b]);l.useEffect(()=>{let k=!1;return(async()=>{try{const{books:z}=await c.getCuratedBooks();k||u(z||[])}catch(z){k||y(z.message||"Failed to load curated books")}finally{k||D(!1)}})(),()=>{k=!0}},[c,y]);const W=l.useCallback(async k=>{if(!x[k.id]){if(!g&&!k.free_access){y(n("library.cloudUpgrade"));return}S(z=>({...z,[k.id]:!0})),m(z=>({...z,[k.id]:0}));try{const z=await c.addCuratedBookFull(k,Y=>{m(K=>({...K,[k.id]:Y}))});a(Y=>Y.some(K=>K.id===z.book_id)?Y:[{id:z.book_id,title:k.title,author:k.author,language:k.language,file_url:k.file_url??!0,canonical_book_id:z.canonical_book_id,created_at:new Date().toISOString(),updated_at:new Date().toISOString()},...Y]),v(Y=>new Set([...Y,z.book_id])),i(`/read/${z.book_id}`)}catch(z){z.code==="PLAN_REQUIRED"?y(n("library.cloudUpgrade")):z.code==="BOOK_LIMIT"?y(n("library.bookLimitExceeded")):y(z.message||"Failed to add book")}finally{S(z=>({...z,[k.id]:!1})),m(z=>{const Y={...z};return delete Y[k.id],Y})}}},[x,g,c,n,y,a,v,i]),q=oe.useMemo(()=>d?d.filter(k=>(k.language||"").toLowerCase()===o):null,[d,o]),G=oe.useMemo(()=>q?q.filter(k=>{if(C.free==="free"&&!k.free_access||C.difficulty!=="all"&&k.difficulty_level!==C.difficulty||C.list!=="all"&&!nt(k.reading_lists).includes(C.list))return!1;if(C.length!=="all"){const z=Dt(k.total_words);if(z&&z!==C.length)return!1}return!0}):null,[q,C]);return e.jsxs("section",{className:"curated-library-view",children:[e.jsxs("div",{className:"grid-view-header",children:[e.jsx("button",{className:"btn-back",onClick:f,"aria-label":n("library.back"),children:e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M15 18l-6-6 6-6"})})}),e.jsx("div",{className:"grid-view-header-left",children:e.jsx("h2",{children:n(o==="fr"?"library.curatedFrench":"library.curatedEnglish")})}),e.jsxs("div",{className:"grid-view-header-right",children:[!g&&q&&q.some(k=>k.free_access)&&e.jsxs("button",{type:"button",className:`curated-free-chip ${C.free==="free"?"active":""}`,onClick:()=>$(k=>({...k,free:k.free==="free"?"all":"free"})),"aria-pressed":C.free==="free",children:[n("library.freeBadge"),e.jsx("span",{className:"grid-filter-count",children:q.filter(k=>k.free_access).length})]}),q&&q.length>0&&e.jsx(ur,{filters:C,setFilters:$,books:q,t:n,uiLang:s})]})]}),_?e.jsxs("div",{className:"books-loading",children:[e.jsx("div",{className:"loading-spinner"}),e.jsx("p",{children:n("library.loading")})]}):!q||q.length===0?e.jsxs("div",{className:"books-empty",children:[e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 -960 960 960",fill:"currentColor",width:"48",height:"48",children:e.jsx("path",{d:"M80-160v-80h800v80H80Zm80-160v-320h80v320h-80Zm160 0v-480h80v480h-80Zm160 0v-480h80v480h-80Zm280 0L600-600l70-40 160 280-70 40Z"})}),e.jsx("p",{children:n("library.curatedComingSoon")})]}):G&&G.length===0?e.jsx("div",{className:"books-empty",children:e.jsx("p",{children:Le(s)?"没æç¬¦åç鿡件ç书":"No books match the current filters"})}):e.jsx("div",{className:"curated-grid",children:G.map(k=>{const z=A.has(k.canonical_book_id),Y=z?L(k.canonical_book_id):null;return e.jsx(yr,{book:k,token:c.token,adding:!!x[k.id],progress:j[k.id],owned:z,onAdd:()=>W(k),onOpen:()=>Y&&i(`/read/${Y}`),t:n,uiLang:s,isPaid:g},k.id)})})]})}const kt={en:{A1:"Starter",A2:"Elementary",B1:"Intermediate",B2:"Upper-Inter.",C1:"Advanced",C2:"Mastery"},zh:{A1:"å
¥é¨",A2:"åºç¡",B1:"ä¸çº§",B2:"ä¸é«çº§",C1:"é«çº§",C2:"ç²¾é"},"zh-TW":{A1:"å
¥é",A2:"åºç¤",B1:"ä¸ç´",B2:"ä¸é«ç´",C1:"é«ç´",C2:"ç²¾é"},fr:{A1:"Débutant",A2:"Ãlémentaire",B1:"Intermédiaire",B2:"Interméd. sup.",C1:"Avancé",C2:"Maîtrise"}};function pr(t){if(!t)return{quote:"",hasMore:!1};const n=t.match(/^[^ãï¼ï¼.!?\n]+[ãï¼ï¼.!?]/);if(n){const s=n[0].trim();return{quote:s,hasMore:t.length>s.length+2}}if(t.length>60){const s=t.lastIndexOf("ï¼",60);return{quote:t.slice(0,s>20?s+1:60)+"â¦â¦",hasMore:!0}}return{quote:t,hasMore:!1}}function Et({bucket:t}){const s={short:.3333333333333333,medium:.6666666666666666,long:1}[t];
2if(!s)return null;const c=7,g=7,f=5.5,y={viewBox:"0 0 14 14",width:14,height:14,"aria-hidden":!0,style:{verticalAlign:"-2px",marginRight:4}};if(s>=1)return e.jsx("svg",{...y,children:e.jsx("circle",{cx:c,cy:g,r:f,fill:"currentColor"})});const a=s*2*Math.PI,v=c+f*Math.sin(a),b=g-f*Math.cos(a),i=s>.5?1:0;return e.jsxs("svg",{...y,children:[e.jsx("circle",{cx:c,cy:g,r:f,fill:"none",stroke:"currentColor",strokeWidth:"1"}),e.jsx("path",{d:`M ${c} ${g} L ${c} ${g-f} A ${f} ${f} 0 ${i} 1 ${v} ${b} Z`,fill:"currentColor"})]})}function mr(t,n){if(!t||t<=0)return null;const c=["zh","ja","ko"].includes((n||"").toLowerCase())?350:150;return t/(c*60)}function Nt(t,n,s){return(s==="zh"||s==="zh-TW"?t[`${n}_zh`]:t[`${n}_en`])||t[`${n}_en`]||t[`${n}_zh`]||""}function yr({book:t,token:n,adding:s,progress:c,owned:g,onAdd:f,onOpen:y,t:a,uiLang:v,isPaid:b}){var C;const[i,M]=l.useState(null),o=l.useRef(null);l.useEffect(()=>{if(!n)return;let $=!1;return(async()=>{try{const A=await fetch(`${pn}/reader/curated-books/${t.id}/cover`,{headers:{Authorization:`Bearer ${n}`}});if(!A.ok||$)return;const L=await A.blob();if($)return;const W=URL.createObjectURL(L);o.current=W,M(W)}catch{}})(),()=>{$=!0,o.current&&URL.revokeObjectURL(o.current)}},[n,t.id]);const d=Nt(t,"description",v),u=Nt(t,"title",v),_=(t.language||"").toLowerCase(),D=v==="zh"||v==="zh-TW",x=u&&u!==t.title&&(_==="en"&&D||_!=="en"&&v==="en"||_==="en"&&v==="fr"),S=kt[v]||kt.en,j=t.difficulty_level||"",m=S[j]||j;return e.jsxs("article",{className:"curated-book-card",children:[e.jsxs("div",{className:"curated-book-cover",children:[!b&&!!t.free_access&&e.jsx("span",{className:`curated-free-badge ${t.free_access_source==="rotation"?"rotation":""}`,children:t.free_access_source==="rotation"?a("library.freeThisMonth"):a("library.freeBadge")}),i?e.jsx("img",{src:i,alt:t.title}):e.jsx("div",{className:"curated-book-cover-placeholder",children:e.jsx("span",{children:((C=t.title)==null?void 0:C[0])||"?"})})]}),e.jsxs("div",{className:"curated-book-info",children:[e.jsx("h3",{className:"curated-book-title",title:t.title,children:t.title}),x&&e.jsx("p",{className:"curated-book-subtitle",children:u}),t.author&&e.jsx("p",{className:"curated-book-author",children:t.author}),d&&(()=>{const{quote:$,hasMore:A}=pr(d);return e.jsxs("div",{className:"curated-book-quote-wrap",children:[e.jsx("p",{className:"curated-book-quote",children:$}),A&&e.jsx("div",{className:"curated-book-quote-full",children:d})]})})(),e.jsxs("div",{className:"curated-book-meta",children:[t.language&&e.jsx("span",{className:"curated-meta-tag",children:t.language.toUpperCase()}),j&&e.jsx("span",{className:"curated-meta-tag curated-meta-level",title:m,children:j}),(()=>{const $=Dt(t.total_words);if($){const A=Le(v),L=["zh","ja","ko"].includes((t.language||"").toLowerCase()),W=mr(t.total_words,t.language),q=W?W<10?W.toFixed(1).replace(/\.0$/,""):Math.round(W).toString():null;let G;if(A){const k=parseFloat((t.total_words/1e4).toFixed(1)),z=L?"å":"è¯";G=q?`约 ${q} å°æ¶ï¼${k}ä¸${z}ï¼`:`约 ${k}ä¸${z}`}else{const k=L?"characters":"words",z=(t.total_words/1e3).toFixed(0);G=q?`~${q}h read (${z}k ${k})`:`~${z}k ${k}`}return e.jsx("span",{className:"curated-meta-tag curated-meta-length",title:G,children:e.jsx(Et,{bucket:$})})}return t.total_chapters?e.jsxs("span",{className:"curated-meta-tag",children:[t.total_chapters," ",a("library.chapterUnit")||"ch."]}):null})(),(()=>{const $=Mt.filter(k=>nt(t.reading_lists).includes(k));if(!$.length)return null;const A=$.length,L=Le(v),W=L?`${A} 个书å`:A===1?"1 list":`${A} lists`,G=(L?`å¨è¿ ${A} 个书åä¸ï¼`:`On ${A} reading list${A>1?"s":""}:`)+` 3`+$.map(k=>`${Tt(k,v)} â ${Pt(k,v)}`).join(` 4`);return e.jsx("span",{className:"curated-meta-tag curated-meta-list",title:G,children:W})})()]}),g?e.jsx("button",{className:"curated-add-btn curated-owned-btn",onClick:y,children:a("library.continueReading")}):e.jsx("button",{className:`curated-add-btn ${s?"curated-add-btn-loading":""}`,onClick:f,disabled:s,children:s?c!=null&&c<100?`${c}%`:a("library.adding"):a("library.addToMyLibrary")})]})]})}const xr=oe.memo(fr);function br({book:t,onChoice:n,t:s}){return t?e.jsx("div",{className:"delete-dialog-overlay",onClick:()=>n("cancel"),children:e.jsxs("div",{className:"delete-dialog",onClick:c=>c.stopPropagation(),children:[e.jsx("p",{className:"delete-dialog-title",children:t.title}),e.jsx("p",{className:"delete-dialog-desc",children:s("library.deleteDialogDesc")}),e.jsxs("div",{className:"delete-dialog-actions",children:[e.jsx("button",{type:"button",className:"delete-dialog-btn delete-dialog-btn-local",onClick:()=>n("local"),children:s("library.deleteLocalOnly")}),e.jsx("button",{type:"button",className:"delete-dialog-btn delete-dialog-btn-full",onClick:()=>n("full"),children:s("library.deleteCompletely")}),e.jsx("button",{type:"button",className:"delete-dialog-btn delete-dialog-btn-cancel",onClick:()=>n("cancel"),children:s("library.cancel")})]})]})}):null}const vr=oe.memo(br);function wr({book:t,onChoice:n,t:s}){return t?e.jsx("div",{className:"delete-dialog-overlay",onClick:()=>n("cancel"),children:e.jsxs("div",{className:"delete-dialog phantom-dialog",onClick:c=>c.stopPropagation(),children:[e.jsx("p",{className:"delete-dialog-title",children:t.title}),e.jsx("p",{className:"delete-dialog-desc",children:s("library.phantomDialogDesc")}),e.jsxs("div",{className:"delete-dialog-actions",children:[e.jsx("button",{type:"button",className:"delete-dialog-btn delete-dialog-btn-local",onClick:()=>n("upload"),children:s("library.phantomUploadNew")}),e.jsx("button",{type:"button",className:"delete-dialog-btn delete-dialog-btn-full",onClick:()=>n("remove"),children:s("library.phantomRemove")}),e.jsx("button",{type:"button",className:"delete-dialog-btn delete-dialog-btn-cancel",onClick:()=>n("cancel"),children:s("library.cancel")})]})]})}):null}const _r=oe.memo(wr);function zr(){var ft;const[t,n]=l.useState([]),[s,c]=l.useState(!0),[g,f]=l.useState(!1),[y,a]=l.useState(""),[v,b]=l.useState(!1),[i,M]=l.useState({}),[o,d]=l.useState(new Set),[u,_]=l.useState({}),[D,x]=l.useState({}),[S,j]=l.useState(!1),[m,C]=l.useState(new Set),[$,A]=l.useState(new Set),[L,W]=l.useState(!1),[q,G]=l.useState(new Set),k={storage:"all",language:"all"},[z,Y]=l.useState(k),[K,ie]=l.useState(new Set),[E,T]=l.useState(null),[p,I]=l.useState(null),[Z,Q]=l.useState(null),te=l.useRef(null),[re,ae]=l.useState(null),me=l.useRef(null),fe=l.useRef(null),de=l.useRef(!1),pe=l.useRef(0),{user:w,getToken:U,sessionInvalidMessage:O}=Oe(),{t:P,language:se}=ve(),ce=!!(w!=null&&w.readerPaid),_e=(w==null?void 0:w.readerBookLimit)??3,R=Tn(w),ee=et(),[H,he]=St(
4),ge=H.get("view")||"landing",ze=(H.get("q")||"").trim().toLowerCase(),rt=l.useCallback(r=>ze?r.filter(h=>(h.title||"").toLowerCase().includes(ze)||(h.author||"").toLowerCase().includes(ze)):r,[ze]),{boxSelectStart:at,boxSelectCurrent:It,boxSelectActiveRef:$t}=Gn({viewMode:ge,gridScrollRef:fe,justDidBoxSelectRef:de,setCloudSelectedIds:C,setCloudSelectionMode:j,setGridSelectedIds:G,setGridSelectionMode:W}),{bookCovers:Ft,coverLoading:Rt}=Vn({books:t,localFileIds:o,api:ne});l.useEffect(()=>{const r="#fafafa",h=[document.documentElement,document.body,document.getElementById("root")].filter(Boolean),N=h.map(B=>B.style.backgroundColor);return h.forEach(B=>{B.style.backgroundColor=r}),()=>{h.forEach((B,F)=>{B.style.backgroundColor=N[F]})}},[]);const st=oe.useRef(H.toString());l.useEffect(()=>{const r=H.toString(),h=r!==st.current;st.current=r,ge!=="cloud-library"&&(j(!1),C(new Set)),ge!=="all-books"&&ge!=="local-library"?(W(!1),G(new Set),Y(k)):h&&Y(k)},[ge,H]);const He=oe.useRef(null);l.useEffect(()=>{const r=H.get("openPicker");if(!r||He.current===r)return;const h=t.find(N=>N.id===r);if(h){if(h.conversion_status!=="pending_preview"){He.current=r,he(N=>{const B=new URLSearchParams(N);return B.delete("openPicker"),B},{replace:!0});return}He.current=r,Ae(h),he(N=>{const B=new URLSearchParams(N);return B.delete("openPicker"),B},{replace:!0})}},[t,H,he]);const ot="easeverse-reader-cloud-pinned";l.useEffect(()=>{if(w!=null&&w.id)try{const r=localStorage.getItem(`${ot}-${w.id}`);if(r){const h=JSON.parse(r);Array.isArray(h)&&A(new Set(h))}}catch{}},[w==null?void 0:w.id]);const it="easeverse-reader-local-pinned";l.useEffect(()=>{if(w!=null&&w.id)try{const r=localStorage.getItem(`${it}-${w.id}`);if(r){const h=JSON.parse(r);Array.isArray(h)&&ie(new Set(h))}}catch{}},[w==null?void 0:w.id]);const Wt=l.useCallback(r=>{if(w!=null&&w.id)try{localStorage.setItem(`${it}-${w.id}`,JSON.stringify([...r]))}catch{}},[w==null?void 0:w.id]),qt=l.useCallback(r=>{if(w!=null&&w.id)try{localStorage.setItem(`${ot}-${w.id}`,JSON.stringify([...r]))}catch{}},[w==null?void 0:w.id]),lt=l.useCallback(async()=>{try{c(!0);const[{books:r},h]=await Promise.all([ne.getBooks(),ne.getLocalFileBookIds()]);n(r||[]),d(h);try{const{progress:N}=await ne.getAllProgress(),B={};(N||[]).forEach(F=>{B[F.book_id]=F}),_(B)}catch(N){console.warn("Failed to load progress:",N)}try{ne.backfillBookLanguages((r||[]).filter(N=>!N.deleted_at)).catch(()=>{})}catch{}try{const{isGuideBook:N,upgradeGuideBookIfNeeded:B}=await Fe(async()=>{const{isGuideBook:X,upgradeGuideBookIfNeeded:V}=await import("./guideBook-XcUfAKKk.js");return{isGuideBook:X,upgradeGuideBookIfNeeded:V}},__vite__mapDeps([0,1,2,3,4])),F=(r||[]).find(N);F&&B(F).catch(()=>{})}catch{}}catch(r){a(P("library.loadFailed")),console.error(r)}finally{c(!1)}},[P]);l.useEffect(()=>{const r=U();if(!r){n([]);return}ne.setToken(r);let h=!1;return(async()=>{ce&&await xn(r).catch(()=>{}),!h&&await lt()})(),()=>{h=!0}},[U,ce,lt]),l.useEffect(()=>{const r=t.filter(B=>B.conversion_status&&B.conversion_status!=="ready"&&B.conversion_status!=="failed"&&B.conversion_status!=="uploading"&&B.conversion_status!=="batch_pending").map(B=>B.id);if(r.length===0)return;let h=!1;const N=setInterval(async()=>{try{const B=await Promise.all(r.map(X=>ne.getBookRemote(X).catch(()=>null)));if(h)return;const F=new Map(B.filter(Boolean).map(X=>[X.id,X]));if(F.size===0)return;n(X=>X.map(V=>F.get(V.id)?{...V,...F.get(V.id)}:V))}catch{}},5e3);return()=>{h=!0,clearInterval(N)}},[t]);const Ot=async()=>{try{const{progress:r}=await ne.getAllProgress(),h={};(r||[]).forEach(N=>{h[N.book_id]=N}),_(h)}catch(r){console.warn("Failed to reload progress:",r)}};l.useEffect(()=>{const r=mn(async()=>{try{const h=await bn(w==null?void 0:w.id),N=await ne.getLocalFileBookIds();n(h||[]),d(N)}catch(h){console.warn("[SyncCallback] Failed to refresh books:",h)}Ot()});return()=>{typeof r=="function"&&r()}},[w==null?void 0:w.id]);const Be=oe.useMemo(()=>{const r=new Set;for(const h of t)(o.has(h.id)||h.file_url)&&r.add(h.id);return r},[t,o]),Ht=r=>Be.has(r),je=oe.useMemo(()=>{const r=new Set;for(const[h,N]of Object.entries(u))(N.finished_at||Number(N.percentage||0)>=100)&&r.add(h);return r},[u]),Pe=r=>new Promise(h=>{te.current=h,Q(r)}),Ue=r=>{Q(null),te.current&&(te.current(r),te.current=null)},Ut=async r=>{if(!R)return await Pe({kind:"upgrade",file:r,pages:0,quota:null});let h;try{h=await Mn(r)}catch{h=null}return h===null?(await Pe({kind:"unreadable",file:r,pages:0,quota:null}),!1):!0},Ae=async r=>{var h,N;ae({bookId:r.id,fileName:r.file_name||r.title||"PDF",chapters:[],totalPages:0,outlineQuality:"good",quota:null,alreadyConvertedIndices:[],cachedPages:[],isScanOnly:!1,charsPerPage:0,tocHarvested:!1,busy:!0,error:null});try{const B=await ne.previewPdfChapters(r.id);if(ae(F=>F&&F.bookId===r.id?{...F,chapters:B.chapters||[],totalPages:B.total_pages||0,outlineQuality:B.outline_quality||"good",quota:B.quota||null,alreadyConvertedIndices:B.already_converted_indices||[],cachedPages:B.cached_pages||[],isScanOnly:!!B.is_scan_only,charsPerPage:B.chars_per_page||0,tocHarvested:!!B.toc_harvested,busy:!1}
4:F),B.is_scan_only){n(F=>F.map(X=>X.id===r.id?{...X,is_scan_only:1}:X));try{await yn(r.id,{is_scan_only:1})}catch(F){console.warn("[Library] patchBookFromServer scan-only failed",F)}}}catch(B){const F=((h=B==null?void 0:B.detail)==null?void 0:h.error_code)==="pdf_outline_unreadable"?P("chapterSelection.unreadablePdf"):((N=B==null?void 0:B.detail)==null?void 0:N.error)||(B==null?void 0:B.message)||"preview failed";ae(X=>X&&X.bookId===r.id?{...X,busy:!1,error:F}:X)}},Jt=async(r,h={})=>{var B;if(!re)return;const N=re.bookId;ae(F=>F&&{...F,busy:!0,error:null});try{await ne.startPdfConversion(N,r,h),n(F=>F.map(X=>X.id===N?{...X,conversion_status:"pending",selected_chapter_indices:JSON.stringify(r)}:X)),ae(null)}catch(F){if(Pn(F)){const V=re==null?void 0:re.fileName;ae(null),await Pe({kind:"upgrade",file:V?{name:V}:null,pages:0,quota:null});return}const X=((B=F==null?void 0:F.detail)==null?void 0:B.error)||(F==null?void 0:F.message)||"start conversion failed";ae(V=>V&&{...V,busy:!1,error:X})}},ct=async r=>{if(!r||r.length===0)return;const h=pt().map(J=>"."+J),N=Array.from(r),B=J=>"."+J.name.split(".").pop().toLowerCase();if(N.some(J=>B(J)===".pdf"&&!Ct("pdf"))){a(P("library.pdfTemporarilyDisabled"));return}const X=N.filter(J=>h.includes(B(J)));if(X.length===0){a(P("library.invalidFormat"));return}const V=An({exts:X.map(B),pdfEnabled:R,readerPaid:ce,currentCount:t.filter(J=>!J.deleted_at).length,limit:_e});if(V==="pdf_upgrade"){await Pe({kind:"upgrade",file:X.find(J=>B(J)===".pdf"),pages:0,quota:null});return}if(V==="book_limit"){a(P("library.freeLimitReached",{limit:_e}));return}f(!0),a("");try{for(const J of X){if(B(J)===".pdf"&&!await Ut(J))continue;const le=await ne.findDuplicateBook(J);if(le){if(le.isPhantom){const{book:be}=await ne.uploadBook(J,le.book.id);n(Te=>Te.some($e=>$e.id===be.id)?Te.map($e=>$e.id===be.id?be:$e):[be,...Te]),d(Te=>new Set([...Te,be.id]));continue}const ye=le.book.author?P("library.bookExistsByAuthor",{author:le.book.author}):"";if(!window.confirm(P("library.bookExists",{title:le.book.title,author:ye})))continue}const{book:ue}=await ne.uploadBook(J);n(ye=>ye.some(be=>be.id===ue.id)?ye.map(be=>be.id===ue.id?ue:be):[ue,...ye]),d(ye=>new Set([...ye,ue.id])),ue.conversion_status==="pending_preview"&&Ae(ue)}}catch(J){const le=J==null?void 0:J.code;le==="DRM_PROTECTED"?a(P("library.drmProtected")):le==="HUFF_NOT_SUPPORTED"?a(P("library.huffNotSupported")):le==="BOOK_LIMIT"?a(P("library.bookLimitExceeded")):le&&/_PARSE_FAILED$/.test(le)?a(P("library.parseFailed")):a(P("library.uploadFailed")),console.error(J)}finally{f(!1)}},Gt=r=>{var N;const h=(N=r.dataTransfer)==null?void 0:N.types;return h?Array.from(h).includes("Files"):!1},Je=r=>{if(r.preventDefault(),r.stopPropagation(),r.type==="dragenter"){if(!Gt(r)||$t.current)return;pe.current+=1,pe.current===1&&b(!0)}else if(r.type==="dragleave"){if(pe.current===0)return;pe.current-=1,pe.current===0&&b(!1)}},Vt=r=>{r.preventDefault(),r.stopPropagation(),pe.current=0,b(!1),r.dataTransfer.files.length>0&&ct(r.dataTransfer.files)},Yt=async(r,h)=>{if(r.stopPropagation(),!i[h.id]){if(!ce){a(P("library.cloudProOnly"));return}M(N=>({...N,[h.id]:!0})),a("");try{const{file_url:N}=await ne.uploadBookToCloud(h.id);n(B=>B.map(F=>F.id===h.id?{...F,file_url:N}:F))}catch(N){(N==null?void 0:N.code)==="BOOK_LIMIT"?a(P("library.bookLimitExceeded")):a(N.message||"Upload to cloud failed"),console.error(N)}finally{M(N=>({...N,[h.id]:!1}))}}},Kt=(r,h)=>{r.stopPropagation();const N=t.find(B=>B.id===h);if(N){if(Qe(N)){if(!confirm(P("library.confirmRemoveCurated")))return;Me(h);return}if(N.file_url&&o.has(h))T(N);else{if(!confirm(P("library.confirmDelete")))return;Me(h)}}},Me=async r=>{try{await ne.deleteBook(r),n(h=>h.filter(N=>N.id!==r))}catch{a(P("library.deleteFailed"))}},Zt=async r=>{const h=E;if(T(null),!(!h||r==="cancel"))if(r==="local")try{await ne.freeLocalSpace(h.id),d(N=>{const B=new Set(N);return B.delete(h.id),B})}catch(N){a(N.message||"Failed to free local space")}else r==="full"&&await Me(h.id)},Qt=r=>{var N;const h=p;I(null),!(!h||r==="cancel")&&(r==="upload"?(N=me.current)==null||N.click():r==="remove"&&Me(h.id))},Xt=l.useCallback(r=>je.has(r),[je]),ke=l.useMemo(()=>t.filter(r=>Be.has(r.id)),[t,Be]),Ne=[...ke].sort((r,h)=>new Date(h.created_at)-new Date(r.created_at)),De=r=>{if(r.last_read_at)return r.last_read_at;const h=u[r.id];
4return(h==null?void 0:h.updated_at)||null},Ee=[...ke].filter(r=>De(r)).sort((r,h)=>new Date(De(h))-new Date(De(r))).slice(0,20),dt=l.useRef(!1);l.useEffect(()=>{dt.current||s||!(w!=null&&w.id)||H.get("onboarding")!=="day2"||(dt.current=!0,(async()=>{try{const{findGuideBook:h,seedGuideBook:N,upgradeGuideBookIfNeeded:B}=await Fe(async()=>{const{findGuideBook:V,seedGuideBook:J,upgradeGuideBookIfNeeded:le}=await import("./guideBook-XcUfAKKk.js");return{findGuideBook:V,seedGuideBook:J,upgradeGuideBookIfNeeded:le}},__vite__mapDeps([0,1,2,3,4])),F=w==null?void 0:w.id,X=F?await h(F):null;if(X){B(X).catch(()=>{}),ee(`/read/${X.id}?onboarding=day2`);return}if(F){const V=await N(F,se);n(J=>J.some(ue=>ue.id===V.id)?J.map(ue=>ue.id===V.id?V:ue):[V,...J]),d(J=>new Set([...J,V.id])),ee(`/read/${V.id}?onboarding=day2`)}}catch{const N=[...Ee,...ke].filter(B=>Be.has(B.id))[0];N?ee(`/read/${N.id}?onboarding=day2`):a(P("library.downloadFailed"))}})())},[s,H,Ee,ke,Be,ee,P,se,w]);const Ge=ke.filter(r=>o.has(r.id)),en=ke.filter(r=>!!r.file_url),ut=oe.useMemo(()=>{var h;const r=new Set;for(const N of t)(N.last_read_at||((h=u[N.id])==null?void 0:h.updated_at)||null)&&!je.has(N.id)&&r.add(N.id);return r},[t,u,je]),ht=l.useCallback(r=>Qe(r),[]),we=l.useCallback(r=>{let h=r;const{storage:N,language:B}=z;return N==="cloud"?h=h.filter(F=>!!F.file_url):N==="local"?h=h.filter(F=>o.has(F.id)):N==="curated"&&(h=h.filter(ht)),B!=="all"&&(h=h.filter(F=>(F.language||"").toLowerCase()===B.toLowerCase())),h},[z,o,ht]),tn=l.useMemo(()=>we(Ge),[Ge,we]),Ie=l.useMemo(()=>[...t].sort((r,h)=>new Date(h.created_at)-new Date(r.created_at)),[t]),gt=l.useMemo(()=>we(Ie),[Ie,we]),Ve=l.useMemo(()=>Ne.filter(r=>ut.has(r.id)),[Ne,ut]),Ye=l.useMemo(()=>[...Ne.filter(r=>je.has(r.id)),...t.filter(r=>!Ne.some(h=>h.id===r.id)&&je.has(r.id))],[Ne,t,je]),nn=l.useMemo(()=>{const r=h=>{var N;return h.last_read_at||((N=u[h.id])==null?void 0:N.updated_at)||null};return we(Ve).sort((h,N)=>new Date(r(N)||0)-new Date(r(h)||0))},[Ve,u,we]),rn=l.useMemo(()=>we(Ye).sort((r,h)=>{var N,B;return new Date(((N=u[h.id])==null?void 0:N.finished_at)||0)-new Date(((B=u[r.id])==null?void 0:B.finished_at)||0)}),[Ye,u,we]),an=l.useCallback(()=>{he({})},[he]),xe={books:t,accessibleBooks:ke,bookCovers:Ft,coverLoading:Rt,bookProgress:u,localFileIds:o,cloudDownloading:D,cloudUploading:i,cloudBooks:en,cloudPinnedIds:$,cloudSelectionMode:S,cloudSelectedIds:m,gridSelectionMode:L,gridSelectedIds:q,gridBookFilter:z,localPinnedIds:K,boxSelectStart:at,boxSelectCurrent:It,isPaid:ce,language:se,gridScrollRef:fe,justDidBoxSelectRef:de,setGridSelectionMode:W,setGridSelectedIds:G,setGridBookFilter:Y,setCloudSelectionMode:j,setCloudSelectedIds:C,setLocalPinnedIds:ie,setCloudUploading:M,setBooks:n,setLocalFileIds:d,setError:a,setCloudDownloading:x,setCloudPinnedIds:A,persistLocalPinned:Wt,persistCloudPinned:qt,api:ne,t:P,getLastReadTime:De,isCloudOnly:r=>!o.has(r.id)&&!!r.file_url,isAccessible:Ht,isBookFinished:Xt,handleOpenBook:async r=>{if(r.file_type==="pdf"&&r.conversion_status==="uploading")return;if(r.file_type==="pdf"&&r.conversion_status==="pending_preview"){Ae(r);return}let h=o.has(r.id);const N=!!r.file_url,B=r.file_type==="pdf"&&r.conversion_status&&r.conversion_status!=="ready";if(h&&r.file_type==="epub_from_pdf"&&r.conversion_status==="ready")try{const V=await ne.getBookRemote(r.id),J=await vn(r.id),le=(V==null?void 0:V.epub_version)??0;J!=null&&le>J&&(await wn(r.id),d(ue=>{const ye=new Set(ue);return ye.delete(r.id),ye}),h=!1,console.log(`[Library §F17] Evicted stale EPUB for ${r.id} (cached v${J}, server v${le})`))}catch(V){console.warn("[Library §F17] freshness check failed (using cache):",(V==null?void 0:V.message)||V)}if(!h&&!N&&!B){I(r);return}const F=H.get("onboarding"),X=F?`?onboarding=${F}`:"";if(h||B){ee(`/read/${r.id}${X}`);return}x(V=>({...V,[r.id]:0}));try{if(!await ne.fetchBookFileFromCloud(r.id,J=>{x(le=>({...le,[r.id]:J}))})){a(P("library.downloadFailed"));return}d(J=>new Set([...J,r.id])),ee(`/read/${r.id}${X}`)}catch{a(P("library.downloadFailed"))}finally{x(V=>{const J={...V};return delete J[r.id],J})}},handleDelete:Kt,handleCloudUpload:Yt,openChapterPickerForBook:Ae,goBackHome:an};return e.jsxs("div",{className:`library-container ${v?"drag-active":""} ${at!=null?"box-selecting":""}`,onDragEnter:Je,onDragLeave:Je,onDragOver:Je,onDrop:Vt,children:[e.jsxs("main",{className:"library-main",children:[e.jsx("input",{ref:me,type:"file",accept:pt().map(r=>"."+r).join(","),multiple:!0,onChange:r=>ct(r.target.files),hidden:!0}),e.jsx(Ln,{}),e.jsx(Zn,{}),O&&e.jsx(_n,{message:O,onReLogin:()=>{window.location.href="/auth"}}),y&&e.jsxs("div",{className:"library-error",children:[y,e.jsx("button",{type:"button",onClick:()=>a(""),"aria-label":"Dismiss",children:"Ã"})]}),e.jsx(er,{books:t,onDeleteBook:r=>{confirm(P("library.confirmDelete"))&&Me(r.id)}}),v&&e.jsx("div",{className:"drop-overlay",children:e.jsxs("div",{className:"drop-content",children:[e.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:e.jsx("path",{d:"M12 16v-8m0 0l-4 4m4-4l4 4M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z",strokeLinecap:"round",strokeLinejoin:"round"})}),e.jsx("p",{children:P("library.dropHere")}
4),e.jsx("span",{children:P("library.dropFormats")})]})}),s?e.jsxs("div",{className:"books-loading",children:[e.jsx("div",{className:"loading-spinner"}),e.jsx("p",{children:P("library.loading")})]}):ze?e.jsx(Ce,{title:`"${H.get("q")}" â ${rt(Ne).length} ${P("library.searchResults")}`,bookList:rt(Ne),gridViewType:null,ctx:xe}):ge==="all-books"&&H.get("filter")==="reading"?e.jsx(Ce,{title:P("sidebar.reading"),bookList:nn,filterBaseList:Ve,gridViewType:"reading",ctx:xe}):ge==="all-books"&&H.get("filter")==="finished"?e.jsx(Ce,{title:P("sidebar.finished"),bookList:rn,filterBaseList:Ye,gridViewType:"finished",ctx:xe}):ge==="all-books"?e.jsx(Ce,{title:P("library.allBooks"),bookList:gt,filterBaseList:Ie,gridViewType:"all-books",ctx:xe}):ge==="local-library"?e.jsx(Ce,{title:P("library.localLibrary"),bookList:tn,filterBaseList:Ge,gridViewType:"local-library",ctx:xe}):ge==="cloud-library"?e.jsx(Kn,{ctx:xe}):ge==="continue-reading"?e.jsx(Ce,{title:P("library.continueReading"),bookList:Ee,gridViewType:null,ctx:xe}):ge==="curated-library"?e.jsx(xr,{ctx:xe}):ge==="home"?e.jsx(Ce,{title:P("library.allBooks"),bookList:gt,filterBaseList:Ie,gridViewType:"all-books",ctx:xe}):e.jsx(dr,{ctx:xe,recentBooks:Ee,fileInputRef:me})]}),e.jsx(vr,{book:E,onChoice:Zt,t:P}),e.jsx(_r,{book:p,onChoice:Qt,t:P}),Z&&e.jsx(zn,{kind:Z.kind,pages:Z.pages,quota:Z.quota,fileName:((ft=Z.file)==null?void 0:ft.name)||"",onConfirm:()=>Ue(!0),onCancel:()=>Ue(!1),onUpgrade:()=>{Ue(!1),window.open("https://easeverse.ink/pricing","_blank","noopener")}}),re&&e.jsx(Bn,{fileName:re.fileName,chapters:re.chapters,totalPages:re.totalPages,outlineQuality:re.outlineQuality,quota:re.quota,alreadyConvertedIndices:re.alreadyConvertedIndices||[],isScanOnly:!!re.isScanOnly,charsPerPage:re.charsPerPage||0,tocHarvested:!!re.tocHarvested,cachedPages:re.cachedPages||[],busy:re.busy,error:re.error,onClose:()=>ae(null),onSubmit:(r,h)=>Jt(r,h)})]})}export{zr as default}; 5//# sourceMappingURL=Library-CVMKUhhy.js.map
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.