@eternalheart/react-file-preview 1.3.9 → 1.3.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -0
- package/README.zh-CN.md +10 -0
- package/lib/FilePreviewContent.d.ts.map +1 -1
- package/lib/chunks/{index-B-H9HQiI.mjs → index-B0JUZ5rS.mjs} +10 -10
- package/lib/chunks/{index-B-H9HQiI.mjs.map → index-B0JUZ5rS.mjs.map} +1 -1
- package/lib/chunks/{index-r3q2xCCI.mjs → index-BAYc4aBz.mjs} +2 -2
- package/lib/chunks/{index-r3q2xCCI.mjs.map → index-BAYc4aBz.mjs.map} +1 -1
- package/lib/chunks/{index-BNUiNUWa.mjs → index-BOQJNL71.mjs} +2 -2
- package/lib/chunks/{index-BNUiNUWa.mjs.map → index-BOQJNL71.mjs.map} +1 -1
- package/lib/chunks/{index-BdYkTSTt.mjs → index-BkU8rK-0.mjs} +3 -3
- package/lib/chunks/{index-BdYkTSTt.mjs.map → index-BkU8rK-0.mjs.map} +1 -1
- package/lib/chunks/{index-CgV8T0G5.mjs → index-BnDoXBnH.mjs} +2 -2
- package/lib/chunks/{index-CgV8T0G5.mjs.map → index-BnDoXBnH.mjs.map} +1 -1
- package/lib/chunks/index-C5YHI0Zs.mjs +160 -0
- package/lib/chunks/index-C5YHI0Zs.mjs.map +1 -0
- package/lib/chunks/{index-Bv93wiEK.mjs → index-CGNWXFy3.mjs} +716 -666
- package/lib/chunks/index-CGNWXFy3.mjs.map +1 -0
- package/lib/chunks/{index-DdOEWhrk.mjs → index-CwmZQ-JO.mjs} +16 -16
- package/lib/chunks/{index-DdOEWhrk.mjs.map → index-CwmZQ-JO.mjs.map} +1 -1
- package/lib/chunks/{index-CKirCT35.mjs → index-CzflrElZ.mjs} +5 -5
- package/lib/chunks/{index-CKirCT35.mjs.map → index-CzflrElZ.mjs.map} +1 -1
- package/lib/chunks/{index-D8GtNeDn.mjs → index-CztCCF7q.mjs} +2 -2
- package/lib/chunks/{index-D8GtNeDn.mjs.map → index-CztCCF7q.mjs.map} +1 -1
- package/lib/chunks/{index-BGeyzo6u.mjs → index-DKEcGewg.mjs} +2 -2
- package/lib/chunks/{index-BGeyzo6u.mjs.map → index-DKEcGewg.mjs.map} +1 -1
- package/lib/chunks/{index-DV5Jd7Qe.mjs → index-DN8BQIqo.mjs} +2 -2
- package/lib/chunks/{index-DV5Jd7Qe.mjs.map → index-DN8BQIqo.mjs.map} +1 -1
- package/lib/chunks/{index-zEVVgWCH.mjs → index-DPpUj8Yy.mjs} +2 -2
- package/lib/chunks/{index-zEVVgWCH.mjs.map → index-DPpUj8Yy.mjs.map} +1 -1
- package/lib/chunks/{index-BSD3w5eG.mjs → index-DSAXdrgU.mjs} +2 -2
- package/lib/chunks/{index-BSD3w5eG.mjs.map → index-DSAXdrgU.mjs.map} +1 -1
- package/lib/chunks/{index-DGuiWJr7.mjs → index-DveR0rOk.mjs} +15 -15
- package/lib/chunks/{index-DGuiWJr7.mjs.map → index-DveR0rOk.mjs.map} +1 -1
- package/lib/chunks/{index-BqEuP_8r.mjs → index-QfO-sASN.mjs} +2 -2
- package/lib/chunks/{index-BqEuP_8r.mjs.map → index-QfO-sASN.mjs.map} +1 -1
- package/lib/chunks/{index-BcBe6KW7.mjs → index-h9bO9wmq.mjs} +4 -4
- package/lib/chunks/{index-BcBe6KW7.mjs.map → index-h9bO9wmq.mjs.map} +1 -1
- package/lib/chunks/index-mvSVNKlQ.mjs +228 -0
- package/lib/chunks/index-mvSVNKlQ.mjs.map +1 -0
- package/lib/chunks/{index-U3w45GW8.mjs → index-tecGXW2S.mjs} +43 -43
- package/lib/chunks/{index-U3w45GW8.mjs.map → index-tecGXW2S.mjs.map} +1 -1
- package/lib/chunks/{useShikiHighlight-DzEAK0S7.mjs → useShikiHighlight-DHFYu0BU.mjs} +3 -3
- package/lib/chunks/{useShikiHighlight-DzEAK0S7.mjs.map → useShikiHighlight-DHFYu0BU.mjs.map} +1 -1
- package/lib/index.cjs +22 -18
- package/lib/index.cjs.map +1 -1
- package/lib/index.css +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.mjs +13 -12
- package/lib/renderers/Font/index.d.ts +6 -0
- package/lib/renderers/Font/index.d.ts.map +1 -0
- package/lib/renderers/Pdf/index.d.ts +0 -1
- package/lib/renderers/Pdf/index.d.ts.map +1 -1
- package/lib/renderers/lazy.d.ts +2 -0
- package/lib/renderers/lazy.d.ts.map +1 -1
- package/lib/utils/pdfConfig.d.ts +2 -2
- package/lib/utils/pdfConfig.d.ts.map +1 -1
- package/package.json +3 -2
- package/lib/chunks/index-Bv93wiEK.mjs.map +0 -1
- package/lib/chunks/index-DmepcY31.mjs +0 -96
- package/lib/chunks/index-DmepcY31.mjs.map +0 -1
package/lib/index.cjs
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),
|
|
2
|
-
`&&(f+=1),i.push(
|
|
3
|
-
`){i.push(
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),n=require("react"),gr=require("react-dom"),re=require("framer-motion"),E=require("lucide-react"),Hr=require("pdfjs-dist/build/pdf.mjs"),Ar=require("mammoth"),Br=require("exceljs"),br=require("x-data-spreadsheet"),Ie=require("pptx-preview"),qr=require("@kenjiuno/msgreader"),Ur=require("@likecoin/epub-ts");require("foliate-js/view.js");const Gr=require("video.js"),Vr=require("react-markdown"),Xr=require("remark-gfm"),Zr=require("remark-math"),Jr=require("rehype-katex"),Yr=require("rehype-raw");require("katex/dist/katex.min.css");const Kr=require("shiki"),Qr=require("opentype.js"),et=require("jszip");function rt(r){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const s in r)if(s!=="default"){const a=Object.getOwnPropertyDescriptor(r,s);Object.defineProperty(t,s,a.get?a:{enumerable:!0,get:()=>r[s]})}}return t.default=r,Object.freeze(t)}const Xe=rt(Hr),tt="1.3.10",nt={version:tt},st=["image","pdf","docx","xlsx","pptx","msg","epub","mobi","video","audio","markdown","json","csv","xml","subtitle","zip","text","font"];function ot(r){try{const t=new URL(r).pathname.split("/").pop()||"file";return decodeURIComponent(t)}catch{const t=r.split("/").pop()||"file";return decodeURIComponent(t)}}function Ce(r){var t;const s=((t=r.split(".").pop())==null?void 0:t.toLowerCase())||"";return{jpg:"image/jpeg",jpeg:"image/jpeg",png:"image/png",gif:"image/gif",webp:"image/webp",svg:"image/svg+xml",bmp:"image/bmp",ico:"image/x-icon",mp4:"video/mp4",webm:"video/webm",ogg:"video/ogg",ogv:"video/ogg",mov:"video/quicktime",avi:"video/x-msvideo",mkv:"video/x-matroska",m4v:"video/x-m4v","3gp":"video/3gpp",flv:"video/x-flv",mp3:"audio/mpeg",wav:"audio/wav",m4a:"audio/mp4",aac:"audio/aac",flac:"audio/flac",pdf:"application/pdf",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",pptx:"application/vnd.openxmlformats-officedocument.presentationml.presentation",ppt:"application/vnd.ms-powerpoint",msg:"application/vnd.ms-outlook",mobi:"application/x-mobipocket-ebook",azw:"application/vnd.amazon.ebook",azw3:"application/vnd.amazon.ebook",kf8:"application/vnd.amazon.ebook",txt:"text/plain",md:"text/markdown",markdown:"text/markdown",json:"application/json",xml:"application/xml",html:"text/html",css:"text/css",js:"text/javascript",ts:"text/typescript",jsx:"text/javascript",tsx:"text/typescript",py:"text/x-python",java:"text/x-java",cpp:"text/x-c++src",c:"text/x-csrc",cs:"text/x-csharp",php:"text/x-php",rb:"text/x-ruby",go:"text/x-go",rs:"text/x-rust",yaml:"text/yaml",yml:"text/yaml",toml:"text/toml",ini:"text/plain",env:"text/plain",diff:"text/x-diff",patch:"text/x-diff",log:"text/plain",csv:"text/csv",tsv:"text/tab-separated-values",srt:"application/x-subrip",vtt:"text/vtt",zip:"application/zip"}[s]||"application/octet-stream"}function yr(r,t=0){if(r instanceof File)return{id:`file-${Date.now()}-${t}`,name:r.name,url:URL.createObjectURL(r),type:r.type||Ce(r.name),size:r.size};if(typeof r=="string"){const s=ot(r);return{id:`url-${Date.now()}-${t}`,name:s,url:r,type:Ce(s)}}return{id:r.id||`link-${Date.now()}-${t}`,name:r.name,url:r.url,type:r.type||Ce(r.name),size:r.size}}function wr(r){return r.map((t,s)=>yr(t,s))}function vr(r){var t;const s=((t=r.name.split(".").pop())==null?void 0:t.toLowerCase())||"",a=r.type.toLowerCase();if(a.startsWith("image/")||["jpg","jpeg","png","gif","webp","svg"].includes(s))return"image";if(a.includes("pdf")||s==="pdf")return"pdf";if(a.includes("wordprocessingml")||s==="docx")return"docx";if(a.includes("spreadsheetml")||s==="xlsx")return"xlsx";if(a.includes("presentationml")||s==="pptx"||s==="ppt")return"pptx";if(a.includes("ms-outlook")||s==="msg")return"msg";if(a.includes("epub")||s==="epub")return"epub";if(["mobi","azw","azw3","kf8"].includes(s)||a==="application/x-mobipocket-ebook"||a==="application/vnd.amazon.ebook")return"mobi";if(["csv","tsv"].includes(s)||a==="text/csv"||a==="text/tab-separated-values")return"csv";if(s==="xml"||a==="application/xml"||a==="text/xml")return"xml";if(["srt","vtt","lrc","elrc","ass","ssa","ttml","dfxp"].includes(s)||a==="text/vtt"||a==="application/x-subrip"||a==="application/ttml+xml")return"subtitle";if(s==="zip"||a==="application/zip"||a==="application/x-zip-compressed")return"zip";if(["ttf","otf","woff","woff2"].includes(s)||a.startsWith("font/")||a==="application/font-woff"||a==="application/font-woff2"||a==="application/x-font-ttf"||a==="application/x-font-otf"||a==="application/font-sfnt")return"font";if(a.startsWith("video/")||["mp4","webm","ogg","ogv","mov","avi","mkv","m4v","3gp","flv"].includes(s))return"video";if(a.startsWith("audio/")||["mp3","wav","ogg","m4a","flac","aac"].includes(s))return"audio";if(s==="md"||s==="markdown")return"markdown";if(a==="application/json"||s==="json")return"json";const o=["txt","log","lock","js","jsx","ts","tsx","py","java","cpp","c","h","cs","php","rb","go","mod","rs","swift","kt","lua","vim","html","css","scss","sass","less","yaml","yml","toml","ini","conf","env","diff","patch","sh","bash","zsh","sql"];return a.startsWith("text/")||o.includes(s)?"text":"unsupported"}function at(r){var t;const s=((t=r.split(".").pop())==null?void 0:t.toLowerCase())||"";return{js:"javascript",jsx:"jsx",ts:"typescript",tsx:"tsx",py:"python",java:"java",cpp:"cpp",c:"c",cs:"csharp",php:"php",rb:"ruby",go:"go",mod:"go",rs:"rust",swift:"swift",kt:"kotlin",lua:"lua",vim:"vim",scala:"scala",sh:"bash",bash:"bash",zsh:"bash",json:"json",xml:"xml",html:"html",css:"css",scss:"scss",sass:"sass",less:"less",sql:"sql",yaml:"yaml",yml:"yaml",toml:"toml",ini:"ini",env:"bash",conf:"nginx",diff:"diff",patch:"diff",log:"log",md:"markdown",txt:"text"}[s]||"text"}function jr(r){return r<1024?`${r} B`:r<1024*1024?`${(r/1024).toFixed(1)} KB`:`${(r/(1024*1024)).toFixed(1)} MB`}function it(r){var t;return(((t=r.split(".").pop())==null?void 0:t.toLowerCase())||"")==="tsv"?" ":","}function lt(r,t={}){const s=t.delimiter??",",a=t.firstRowAsHeader??!0,o=[];let i=[],c="",l=!1,f=0;const d=r.length;for(;f<d;){const m=r[f];if(l){if(m==='"'){if(r[f+1]==='"'){c+='"',f+=2;continue}l=!1,f+=1;continue}c+=m,f+=1;continue}if(m==='"'){l=!0,f+=1;continue}if(m===s){i.push(c),c="",f+=1;continue}if(m==="\r"){r[f+1]===`
|
|
2
|
+
`&&(f+=1),i.push(c),o.push(i),i=[],c="",f+=1;continue}if(m===`
|
|
3
|
+
`){i.push(c),o.push(i),i=[],c="",f+=1;continue}c+=m,f+=1}for((c.length>0||i.length>0)&&(i.push(c),o.push(i));o.length>0;){const m=o[o.length-1];if(m.length===1&&m[0]==="")o.pop();else break}let u=[],p=o;a&&o.length>0&&(u=o[0],p=o.slice(1));const h=Math.max(u.length,...p.map(m=>m.length),0);for(const m of p)for(;m.length<h;)m.push("");return{header:u,rows:p,columnCount:h,delimiter:s}}function ft(r){const t=r instanceof Uint8Array?r:new Uint8Array(r);if(t.length>=3&&t[0]===239&&t[1]===187&&t[2]===191)return new TextDecoder("utf-8").decode(t);if(t.length>=2&&t[0]===255&&t[1]===254)return new TextDecoder("utf-16le").decode(t);if(t.length>=2&&t[0]===254&&t[1]===255)return new TextDecoder("utf-16be").decode(t);try{return new TextDecoder("utf-8",{fatal:!0}).decode(t)}catch{}try{return new TextDecoder("gbk").decode(t)}catch{}return new TextDecoder("utf-8",{fatal:!1}).decode(t)}async function Re(r,t){const s=!!t&&("fetcher"in t||"init"in t),a=s?t.fetcher??fetch:fetch,o=s?t.init:t,i=await a(r,o);if(!i.ok)throw new Error(`请求失败: ${i.status}`);const c=await i.arrayBuffer();return ft(c)}async function ct(r,t){if(r)return typeof r=="function"?await r(t):r}function pt(r,t){if(!r&&!t)return;if(!r)return t;if(!t)return r;const s=new Headers(r.headers||{});return t.headers&&new Headers(t.headers).forEach((a,o)=>{s.set(o,a)}),{...r,...t,headers:s}}function dt(r){const t=(r==null?void 0:r.requestHandler)??((a,o)=>fetch(a,o)),s=r==null?void 0:r.requestInit;return async(a,o)=>{const i=await ct(s,a),c=pt(i,o);return t(a,c)}}async function ut(r,t=fetch,s){const a=await t(r,s);if(!a.ok)throw new Error(`请求失败: ${a.status}`);const o=await a.blob();return URL.createObjectURL(o)}async function mt(r,t,s=fetch,a){const o=await s(r,a);if(!o.ok)throw new Error(`请求失败: ${o.status}`);const i=await o.blob(),c=URL.createObjectURL(i);try{const l=document.createElement("a");l.href=c,l.download=t,l.style.display="none",document.body.appendChild(l),l.click(),document.body.removeChild(l)}finally{setTimeout(()=>URL.revokeObjectURL(c),1e3)}}function lr(r){const t=r.trim().replace(",","."),s=t.split(":").map(a=>a.trim());if(s.length===3){const[a,o,i]=s;return Number(a)*3600+Number(o)*60+Number(i)}if(s.length===2){const[a,o]=s;return Number(a)*60+Number(o)}return Number(t)||0}function Pe(r){if(!isFinite(r)||r<0)return"00:00:00.000";const t=Math.floor(r*1e3),s=t%1e3,a=Math.floor(t/1e3)%60,o=Math.floor(t/6e4)%60,i=Math.floor(t/36e5),c=(l,f=2)=>l.toString().padStart(f,"0");return`${c(i)}:${c(o)}:${c(a)}.${c(s,3)}`}const fr=/(\d{1,2}:)?\d{1,2}:\d{1,2}[.,]\d{1,3}\s*-->\s*(\d{1,2}:)?\d{1,2}:\d{1,2}[.,]\d{1,3}/,ht=/^\s*\[\d{1,2}:\d{1,2}(?:[.:]\d{1,3})?\]/;function xt(r){const t=r.replace(/^\uFEFF/,"").trimStart();return/^WEBVTT/.test(t)?"vtt":/^<\?xml/i.test(t)||/<tt\b[^>]*>/i.test(t)?"ttml":/^\[Script Info\]/im.test(t)||/^Dialogue:/m.test(t)?/ScriptType:\s*v4\.00\s*$/im.test(t)?"ssa":"ass":ht.test(t)||/^\[(ti|ar|al|au|by|length|offset|re|ve):/im.test(t)?/<\d{1,2}:\d{1,2}(?:[.:]\d{1,3})?>/.test(t)?"elrc":"lrc":"srt"}function cr(r,t){const s=r.replace(/\r\n?/g,`
|
|
4
4
|
`).replace(/^\uFEFF/,"").split(`
|
|
5
|
-
`),a=[];let o,i=0;if(t==="vtt"){const
|
|
6
|
-
`);i<
|
|
7
|
-
`)})}return{format:t,cues:a,header:o}}function
|
|
5
|
+
`),a=[];let o,i=0;if(t==="vtt"){const c=[];for(;i<s.length&&s[i].trim()!=="";)c.push(s[i]),i++;for(o=c.join(`
|
|
6
|
+
`);i<s.length&&s[i].trim()==="";)i++}for(;i<s.length;){for(;i<s.length&&s[i].trim()==="";)i++;if(i>=s.length)break;let c,l=null;if(fr.test(s[i]))l=s[i],i++;else if(c=s[i].trim()||void 0,i++,i<s.length&&fr.test(s[i]))l=s[i],i++;else continue;if(!l)continue;const f=l.match(/([\d:.,]+)\s*-->\s*([\d:.,]+)/);if(!f)continue;const d=lr(f[1]),u=lr(f[2]),p=[];for(;i<s.length&&s[i].trim()!=="";)p.push(s[i]),i++;a.push({id:c,start:d,end:u,text:p.join(`
|
|
7
|
+
`)})}return{format:t,cues:a,header:o}}function Ge(r,t,s){const a=Number(r),o=Number(t);let i=0;if(s){const c=(s+"000").slice(0,3);i=Number(c)}return a*60+o+i/1e3}function Nr(r,t){const s=/^\[(ti|ar|al|au|by|length|offset|re|ve):(.*)\]$/i.exec(r.trim());if(!s)return!1;const a=s[1].toLowerCase(),o=s[2].trim();if(t.metadata[a]=o,a==="offset"){const i=Number(o);isNaN(i)||(t.offsetMs=i)}return!0}function gt(r){const t=r.replace(/\r\n?/g,`
|
|
8
8
|
`).replace(/^\uFEFF/,"").split(`
|
|
9
|
-
`),
|
|
9
|
+
`),s={metadata:{},offsetMs:0},a=/\[(\d{1,2}):(\d{1,2})(?:[.:](\d{1,3}))?\]/g,o=[];for(const c of t){const l=c.trim();if(!l||Nr(l,s))continue;const f=[];let d=0;a.lastIndex=0;let u;for(;(u=a.exec(l))!==null&&u.index===d;)f.push(Ge(u[1],u[2],u[3])),d=u.index+u[0].length;if(f.length===0)continue;const p=l.slice(d).trim();for(const h of f)o.push({start:h,text:p})}o.sort((c,l)=>c.start-l.start);const i=s.offsetMs/1e3;return{format:"lrc",cues:o.map((c,l)=>{const f=Math.max(0,c.start-i),d=o[l+1],u=d?Math.max(f,d.start-i):f+5;return{start:f,end:u,text:c.text}}),metadata:s.metadata}}function bt(r){const t=r.replace(/\r\n?/g,`
|
|
10
10
|
`).replace(/^\uFEFF/,"").split(`
|
|
11
|
-
`),
|
|
11
|
+
`),s={metadata:{},offsetMs:0},a=/\[(\d{1,2}):(\d{1,2})(?:[.:](\d{1,3}))?\]/g,o=/<(\d{1,2}):(\d{1,2})(?:[.:](\d{1,3}))?>/g,i=[];for(const l of t){const f=l.trim();if(!f||Nr(f,s))continue;const d=[];let u=0;a.lastIndex=0;let p;for(;(p=a.exec(f))!==null&&p.index===u;)d.push(Ge(p[1],p[2],p[3])),u=p.index+p[0].length;if(d.length===0)continue;const h=f.slice(u);for(const m of d)i.push({start:m,raw:h})}i.sort((l,f)=>l.start-f.start);const c=s.offsetMs/1e3;return{format:"elrc",cues:i.map((l,f)=>{const d=[];let u="",p=0,h=null;o.lastIndex=0;let m;for(;(m=o.exec(l.raw))!==null;){const y=l.raw.slice(p,m.index);h!==null&&y&&d.push({start:Math.max(0,h-c),text:y}),u+=y,h=Ge(m[1],m[2],m[3]),p=m.index+m[0].length}const g=l.raw.slice(p);h!==null&&g&&d.push({start:Math.max(0,h-c),text:g}),u+=g;const x=Math.max(0,l.start-c),b=i[f+1],v=b?Math.max(x,b.start-c):x+5;return{start:x,end:v,text:u.trim(),words:d.length?d:void 0}}),metadata:s.metadata}}function pr(r){const t=r.trim().split(":");return t.length!==3?0:Number(t[0])*3600+Number(t[1])*60+Number(t[2].replace(",","."))}function dr(r,t){const s=r.replace(/\r\n?/g,`
|
|
12
12
|
`).replace(/^\uFEFF/,"").split(`
|
|
13
|
-
`);let a="",o=[];const i=[],
|
|
13
|
+
`);let a="",o=[];const i=[],c=[];for(const l of s){const f=l.replace(/\s+$/,""),d=f.trim(),u=/^\[([^\]]+)\]\s*$/.exec(d);if(u){a=u[1].toLowerCase(),c.push(f);continue}if(a!=="events"){c.push(f);continue}const p=/^Format:\s*(.+)$/i.exec(d);if(p){o=p[1].split(",").map(S=>S.trim());continue}const h=/^(Dialogue|Comment):\s*(.+)$/i.exec(d);if(!h||h[1].toLowerCase()==="comment"||o.length===0)continue;const m=o.length,g=h[2].split(","),x=g.slice(0,m-1),b=g.slice(m-1).join(","),v={};o.forEach((S,k)=>{v[S]=k===m-1?b:x[k]??""});const y=pr(v.Start||""),w=pr(v.End||""),T=(v.Text||"").replace(/\\N/g,`
|
|
14
14
|
`).replace(/\\n/g,`
|
|
15
|
-
`).replace(/\\h/g," ").replace(/\{[^}]*\}/g,"");i.push({start:
|
|
16
|
-
`).trim()||void 0}}function
|
|
17
|
-
`:
|
|
18
|
-
`).trim();(m||u||d)&&a.push({start:u,end:d,text:m})}return a.sort((o,i)=>o.start-i.start),{format:"ttml",cues:a}}function ht(r,t){switch(t??pt(r)){case"lrc":return dt(r);case"elrc":return ut(r);case"ass":return fr(r,"ass");case"ssa":return fr(r,"ssa");case"ttml":return mt(r);case"vtt":return ir(r,"vtt");case"srt":default:return ir(r,"srt")}}async function xt(r){return Jr.loadAsync(r)}function bt(r){const t=[];return r.forEach((n,a)=>{var o;const i=a.dir,p=i&&!n.endsWith("/")?n+"/":n,l=i?p.replace(/\/$/,""):p,f=l.lastIndexOf("/"),u=f>=0?l.slice(f+1):l,d=f>=0?l.slice(0,f):"",c=i?0:((o=a._data)==null?void 0:o.uncompressedSize)??0;t.push({path:p,name:u,dir:d,isDir:i,size:c,date:a.date})}),t}function gt(r){const t={name:"",path:"",isDir:!0,children:[],size:0},n=new Map;n.set("",t);const a=i=>{if(n.has(i))return n.get(i);const p=i.split("/").filter(Boolean);let l=t,f="";for(const u of p){f=f?`${f}/${u}`:u;let d=n.get(f);d||(d={name:u,path:f+"/",isDir:!0,children:[],size:0},l.children.push(d),n.set(f,d)),l=d}return l};for(const i of r){if(i.isDir){a(i.path.replace(/\/$/,""));continue}a(i.dir).children.push({name:i.name,path:i.path,isDir:!1,size:i.size})}const o=i=>{if(i.children){i.children.sort((p,l)=>p.isDir!==l.isDir?p.isDir?-1:1:p.name.localeCompare(l.name));for(const p of i.children)o(p)}};return o(t),t}async function yt(r,t,n){const a=r.file(t);if(!a)throw new Error(`ZIP entry not found: ${t}`);const o=await a.async("arraybuffer");return new Blob([o],n?{type:n}:void 0)}function wt(r){return r?r.startsWith("#")?r:r.length===8?"#"+r.substring(2):r.length===6?"#"+r:"#000000":"#000000"}const vt=["FFFFFF","000000","E7E6E6","44546A","4472C4","ED7D31","A5A5A5","FFC000","5B9BD5","70AD47"],jt=["000000","FFFFFF","FF0000","00FF00","0000FF","FFFF00","FF00FF","00FFFF","000000","FFFFFF","FF0000","00FF00","0000FF","FFFF00","FF00FF","00FFFF","800000","008000","000080","808000","800080","008080","C0C0C0","808080","9999FF","993366","FFFFCC","CCFFFF","660066","FF8080","0066CC","CCCCFF","000080","FF00FF","FFFF00","00FFFF","800080","800000","008080","0000FF","00CCFF","CCFFFF","CCFFCC","FFFF99","99CCFF","FF99CC","CC99FF","FFCC99","3366FF","33CCCC","99CC00","FFCC00","FF9900","FF6600","666699","969696","003366","339966","003300","333300","993300","993366","333399","333333"];function Nt(r,t){const n=parseInt(r.substring(0,2),16),a=parseInt(r.substring(2,4),16),o=parseInt(r.substring(4,6),16),i=u=>t<0?Math.round(u*(1+t)):Math.round(u+(255-u)*t),p=Math.min(255,Math.max(0,i(n))),l=Math.min(255,Math.max(0,i(a))),f=Math.min(255,Math.max(0,i(o)));return p.toString(16).padStart(2,"0")+l.toString(16).padStart(2,"0")+f.toString(16).padStart(2,"0")}function kt(r){if(r&&r.type==="pattern"&&r.pattern==="solid"){const t=r.fgColor;if(t)return Ve(t)}}function Ve(r){if(r){if("argb"in r&&typeof r.argb=="string"&&r.argb)return wt(r.argb);if("theme"in r&&typeof r.theme=="number"){const t=vt[r.theme]||"000000",n="tint"in r&&typeof r.tint=="number"?r.tint:0;return"#"+(n!==0?Nt(t,n):t)}if("indexed"in r&&typeof r.indexed=="number"){const t=jt[r.indexed];if(t)return"#"+t}}}function St(r){if(!r||!r.style)return;const t=Ve(r.color)||"#000000";return[r.style,t]}function _t(r){const t={};let n=!1;if(r.font){const o=r.font;if((o.name||o.size||o.bold||o.italic)&&(n=!0,t.font={},o.name&&(t.font.name=o.name),o.size&&(t.font.size=o.size),o.bold&&(t.font.bold=!0),o.italic&&(t.font.italic=!0)),o.color){const i=Ve(o.color);i&&(n=!0,t.color=i)}o.underline&&(n=!0,t.underline=!0),o.strike&&(n=!0,t.strike=!0)}const a=kt(r.fill);if(a&&(n=!0,t.bgcolor=a),r.alignment){const o=r.alignment;o.horizontal&&(n=!0,t.align=o.horizontal),o.vertical&&(n=!0,t.valign=o.vertical),o.wrapText&&(n=!0,t.textwrap=!0)}if(r.border){const o={};let i=!1;const p=["top","bottom","left","right"];for(const l of p){const f=St(r.border[l]);f&&(o[l]=f,i=!0)}i&&(n=!0,t.border=o)}return n?t:null}function Rt(r){return JSON.stringify(r)}function Ct(r,t,n){const a=_t(r);if(!a)return-1;const o=Rt(a),i=n.get(o);if(i!==void 0)return i;const p=t.length;return t.push(a),n.set(o,p),p}function Mt(r){const t=r.value;if(t==null)return"";if(typeof t=="string")return t;if(typeof t=="number")return String(t);if(typeof t=="boolean")return t?"TRUE":"FALSE";if(t instanceof Date)return t.toLocaleDateString();if(typeof t=="object"&&"formula"in t){const n=t.result;return n!=null?String(n):""}return typeof t=="object"&&"richText"in t?t.richText.map(n=>n.text).join(""):typeof t=="object"&&"hyperlink"in t?t.text||"":typeof t=="object"&&"error"in t?String(t.error):String(t)}function Tt(r){const t=r.split(":"),n=cr(t[0]),a=t[1]?cr(t[1]):n;return{top:n.row,left:n.col,bottom:a.row,right:a.col}}function cr(r){const t=r.match(/^([A-Z]+)(\d+)$/);if(!t)return{row:1,col:1};const n=t[1],a=parseInt(t[2],10);let o=0;for(let i=0;i<n.length;i++)o=o*26+(n.charCodeAt(i)-64);return{row:a,col:o}}function Et(r){const t=[];return r.eachSheet(n=>{const a=[],o=new Map,i=[],p={},l={},f=n.columnCount;for(let m=1;m<=f;m++){const h=n.getColumn(m);h.width&&(l[String(m-1)]={width:Math.round(h.width*7.5)})}l.len=Math.max(f,26);const u=new Map,d=n.model,c=(d==null?void 0:d.merges)||[];for(const m of c){i.push(m);const{top:h,left:y,bottom:x,right:w}=Tt(m),b=x-h,g=w-y;u.set(`${h-1},${y-1}`,[b,g])}n.eachRow({includeEmpty:!0},(m,h)=>{const y=h-1,x={};m.eachCell({includeEmpty:!1},(b,g)=>{const v=g-1;if(b.isMerged&&b.master!==b)return;const k=Mt(b),S=Ct(b,a,o),M={text:k};S!==-1&&(M.style=S);const T=`${y},${v}`;u.has(T)&&(M.merge=u.get(T)),x[String(v)]=M});const w={cells:x};m.height&&(w.height=Math.round(m.height*1.333)),p[String(y)]=w}),t.push({name:n.name,styles:a,merges:i,rows:p,cols:l})}),t}function Ft(r,t,n="Sheet1"){const a=r.length>0,o=a?[{font:{bold:!0}}]:[],i={};if(a){const l={};r.forEach((f,u)=>{l[String(u)]={text:f,style:0}}),i[0]={cells:l}}const p=a?1:0;return t.forEach((l,f)=>{const u={};l.forEach((d,c)=>{d!==void 0&&d!==""&&(u[String(c)]={text:d})}),i[String(f+p)]={cells:u}}),[{name:n,styles:o,rows:i}]}const Lt={"common.download":"下载","common.close":"关闭","common.loading":"加载中","common.unknown_error":"未知错误","common.unsupported_preview":"不支持预览此文件类型 ({type})","toolbar.zoom_in":"放大","toolbar.zoom_out":"缩小","toolbar.rotate_left":"向左旋转","toolbar.rotate_right":"向右旋转","toolbar.reset":"复原","toolbar.fit_to_window":"适应窗口","toolbar.original_size":"原始尺寸","toolbar.toc":"目录","toolbar.prev_page":"上一页","toolbar.next_page":"下一页","toolbar.full_width":"全屏宽度","toolbar.normal_width":"正常宽度","toolbar.wrap_on":"自动换行","toolbar.wrap_off":"不换行","toolbar.source":"源码","toolbar.preview":"预览","image.load_failed":"图片加载失败","pdf.load_failed":"PDF 文件加载失败","docx.parse_failed":"Word 文档解析失败","xlsx.loading":"加载 Excel 中...","xlsx.load_failed":"Excel 加载失败","xlsx.parse_failed":"Excel 文件解析失败","xlsx.not_found":"Excel 文件不存在","pptx.loading":"加载 PPT 中...","pptx.load_failed":"PPT 加载失败","pptx.parse_failed":"PPT 文件解析失败","pptx.not_found":"PPT 文件不存在","pptx.invalid_format":"PPT 文件格式错误或已损坏","pptx.no_pages":"PPT 文件无有效页面","pptx.timeout":"加载超时,请检查网络或稍后重试","msg.parse_failed":"Outlook 邮件解析失败","msg.parse_failed_short":"邮件解析失败","msg.empty_body":"(无邮件正文)","epub.load_failed":"EPUB 文件加载失败","mobi.load_failed":"电子书加载失败,文件可能已损坏或带有 DRM 保护","video.loading":"加载视频中...","video.load_failed":"视频加载失败","video.load_failed_with_error":"视频加载失败: {error}","audio.aria.play":"播放","audio.aria.pause":"暂停","audio.aria.forward_10":"前进 10 秒","audio.aria.backward_10":"后退 10 秒","audio.aria.mute":"静音","audio.aria.unmute":"取消静音","audio.aria.loop_on":"开启循环","audio.aria.loop_off":"关闭循环","audio.aria.progress":"播放进度","audio.aria.volume":"音量","markdown.load_failed":"Markdown 文件加载失败","markdown.copy_code":"复制代码","markdown.copied":"已复制","json.load_failed":"JSON 文件加载失败","json.items":"items","json.keys":"keys","csv.loading":"加载 CSV 中...","csv.load_failed":"CSV 文件加载失败","csv.parse_failed":"CSV 解析失败","xml.load_failed":"XML 文件加载失败","subtitle.load_failed":"字幕文件加载失败","subtitle.parse_failed":"字幕解析失败","subtitle.lines":"lines","subtitle.cues":"cues","subtitle.meta.title":"标题","subtitle.meta.artist":"艺术家","subtitle.meta.album":"专辑","subtitle.meta.author":"作者","subtitle.meta.by":"制作","subtitle.meta.length":"时长","subtitle.meta.offset":"偏移","subtitle.meta.editor":"编辑器","subtitle.meta.version":"版本","zip.load_failed":"ZIP 文件加载失败","zip.parse_failed":"ZIP 解析失败","text.load_failed":"文本文件加载失败"},Pt={"common.download":"Download","common.close":"Close","common.loading":"Loading","common.unknown_error":"Unknown error","common.unsupported_preview":"Preview not supported for this file type ({type})","toolbar.zoom_in":"Zoom in","toolbar.zoom_out":"Zoom out","toolbar.rotate_left":"Rotate left","toolbar.rotate_right":"Rotate right","toolbar.reset":"Reset","toolbar.fit_to_window":"Fit to window","toolbar.original_size":"Original size","toolbar.toc":"Table of contents","toolbar.prev_page":"Previous page","toolbar.next_page":"Next page","toolbar.full_width":"Full width","toolbar.normal_width":"Normal width","toolbar.wrap_on":"Word wrap","toolbar.wrap_off":"No wrap","toolbar.source":"Source","toolbar.preview":"Preview","image.load_failed":"Failed to load image","pdf.load_failed":"Failed to load PDF","docx.parse_failed":"Failed to parse Word document","xlsx.loading":"Loading Excel...","xlsx.load_failed":"Failed to load Excel","xlsx.parse_failed":"Failed to parse Excel file","xlsx.not_found":"Excel file not found","pptx.loading":"Loading PPT...","pptx.load_failed":"Failed to load PPT","pptx.parse_failed":"Failed to parse PPT file","pptx.not_found":"PPT file not found","pptx.invalid_format":"PPT file format is invalid or corrupted","pptx.no_pages":"PPT file has no valid pages","pptx.timeout":"Loading timed out, please check your network and retry","msg.parse_failed":"Failed to parse Outlook message","msg.parse_failed_short":"Failed to parse message","msg.empty_body":"(No message body)","epub.load_failed":"Failed to load EPUB","mobi.load_failed":"Failed to load ebook — file may be corrupted or DRM-protected","video.loading":"Loading video...","video.load_failed":"Failed to load video","video.load_failed_with_error":"Failed to load video: {error}","audio.aria.play":"Play","audio.aria.pause":"Pause","audio.aria.forward_10":"Forward 10 seconds","audio.aria.backward_10":"Back 10 seconds","audio.aria.mute":"Mute","audio.aria.unmute":"Unmute","audio.aria.loop_on":"Enable loop","audio.aria.loop_off":"Disable loop","audio.aria.progress":"Playback progress","audio.aria.volume":"Volume","markdown.load_failed":"Failed to load Markdown","markdown.copy_code":"Copy code","markdown.copied":"Copied","json.load_failed":"Failed to load JSON","json.items":"items","json.keys":"keys","csv.loading":"Loading CSV...","csv.load_failed":"Failed to load CSV","csv.parse_failed":"Failed to parse CSV","xml.load_failed":"Failed to load XML","subtitle.load_failed":"Failed to load subtitle","subtitle.parse_failed":"Failed to parse subtitle","subtitle.lines":"lines","subtitle.cues":"cues","subtitle.meta.title":"Title","subtitle.meta.artist":"Artist","subtitle.meta.album":"Album","subtitle.meta.author":"Author","subtitle.meta.by":"By","subtitle.meta.length":"Length","subtitle.meta.offset":"Offset","subtitle.meta.editor":"Editor","subtitle.meta.version":"Version","zip.load_failed":"Failed to load ZIP","zip.parse_failed":"Failed to parse ZIP","text.load_failed":"Failed to load text file"},$e={"zh-CN":Lt,"en-US":Pt},zt=/\{(\w+)\}/g;function $t(r,t){return t?r.replace(zt,(n,a)=>{const o=t[a];return o===void 0?`{${a}}`:String(o)}):r}function Xe(r){var t;const n=r.fallbackLocale??"zh-CN",a=$e[r.locale]??$e[n]??$e["zh-CN"],o=(t=r.messages)==null?void 0:t[r.locale],i=o?{...a,...o}:a,p=$e["zh-CN"];return(l,f)=>{const u=i[l]??p[l]??l;return $t(u,f)}}const Ze=s.createContext(null),vr=({locale:r="zh-CN",messages:t,children:n})=>{const a=s.useMemo(()=>{const o=Xe({locale:r,messages:t});return{locale:r,t:o}},[r,t]);return e.jsx(Ze.Provider,{value:a,children:n})};let Be=null;function Dt(){return Be||(Be=Xe({locale:"zh-CN"})),Be}function J(){const r=s.useContext(Ze);return(r==null?void 0:r.t)??Dt()}function Wt(){const r=s.useContext(Ze);return(r==null?void 0:r.locale)??"zh-CN"}const jr=s.createContext(null),It=({theme:r,children:t})=>e.jsx(jr.Provider,{value:r,children:t});function Nr(){return s.useContext(jr)??"dark"}const Ot=({className:r})=>e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:r,children:e.jsx("text",{x:"12",y:"17.5",textAnchor:"middle",fontSize:"20",fontWeight:"bold",fill:"currentColor",stroke:"none",children:"1:1"})});function Ht(r){return[{items:[{type:"button",icon:e.jsx(_.ZoomOut,{className:"rfp-w-4 rfp-h-4"}),tooltip:r.t("toolbar.zoom_out"),action:r.onZoomOut,disabled:r.zoom<=.01},{type:"text",content:`${Math.round(r.zoom*100)}%`,minWidth:"3rem"},{type:"button",icon:e.jsx(_.ZoomIn,{className:"rfp-w-4 rfp-h-4"}),tooltip:r.t("toolbar.zoom_in"),action:r.onZoomIn,disabled:r.zoom>=10}]},{items:[{type:"button",icon:e.jsx(_.Scan,{className:"rfp-w-4 rfp-h-4"}),tooltip:r.t("toolbar.fit_to_window"),action:r.onFitToWidth},{type:"button",icon:e.jsx(Ot,{className:"rfp-w-4 rfp-h-4"}),tooltip:r.t("toolbar.original_size"),action:r.onOriginalSize}]},{items:[{type:"button",icon:e.jsx(_.RotateCcw,{className:"rfp-w-4 rfp-h-4"}),tooltip:r.t("toolbar.rotate_left"),action:r.onRotateLeft},{type:"button",icon:e.jsx(_.RotateCw,{className:"rfp-w-4 rfp-h-4"}),tooltip:r.t("toolbar.rotate_right"),action:r.onRotateRight}]},{items:[{type:"button",icon:e.jsx(_.RefreshCw,{className:"rfp-w-4 rfp-h-4"}),tooltip:r.t("toolbar.reset"),action:r.onReset}]}]}function At(r){return[{items:[{type:"button",icon:e.jsx(_.ZoomOut,{className:"rfp-w-4 rfp-h-4"}),tooltip:r.t("toolbar.zoom_out"),action:r.onZoomOut,disabled:r.zoom<=.01},{type:"text",content:`${Math.round(r.zoom*100)}%`,minWidth:"3rem"},{type:"button",icon:e.jsx(_.ZoomIn,{className:"rfp-w-4 rfp-h-4"}),tooltip:r.t("toolbar.zoom_in"),action:r.onZoomIn,disabled:r.zoom>=10}]},{items:[{type:"button",icon:e.jsx(_.RefreshCw,{className:"rfp-w-4 rfp-h-4"}),tooltip:r.t("toolbar.reset"),action:r.onReset}]}]}function Bt(r){return[{items:[{type:"button",icon:e.jsx(_.List,{className:"rfp-w-4 rfp-h-4"}),tooltip:r.t("toolbar.toc"),action:()=>{var t;return(t=r.epubRef.current)==null?void 0:t.toggleToc()}}]},{items:[{type:"button",icon:e.jsx(_.ChevronLeft,{className:"rfp-w-4 rfp-h-4"}),tooltip:r.t("toolbar.prev_page"),action:()=>{var t;return(t=r.epubRef.current)==null?void 0:t.prevPage()}},{type:"text",content:`${r.current} / ${r.total}`,minWidth:"4rem"},{type:"button",icon:e.jsx(_.ChevronRight,{className:"rfp-w-4 rfp-h-4"}),tooltip:r.t("toolbar.next_page"),action:()=>{var t;return(t=r.epubRef.current)==null?void 0:t.nextPage()}}]},{items:[{type:"button",icon:r.fullWidth?e.jsx(_.Minimize2,{className:"rfp-w-4 rfp-h-4"}):e.jsx(_.Maximize2,{className:"rfp-w-4 rfp-h-4"}),tooltip:r.fullWidth?r.t("toolbar.normal_width"):r.t("toolbar.full_width"),action:()=>{var t;return(t=r.epubRef.current)==null?void 0:t.toggleFullWidth()}}]}]}function qt(r){return[{items:[{type:"button",icon:e.jsx(_.List,{className:"rfp-w-4 rfp-h-4"}),tooltip:r.t("toolbar.toc"),action:()=>{var t;return(t=r.mobiRef.current)==null?void 0:t.toggleToc()}}]},{items:[{type:"button",icon:e.jsx(_.ChevronLeft,{className:"rfp-w-4 rfp-h-4"}),tooltip:r.t("toolbar.prev_page"),action:()=>{var t;return(t=r.mobiRef.current)==null?void 0:t.prevPage()}},{type:"text",content:`${r.current} / ${r.total}`,minWidth:"4rem"},{type:"button",icon:e.jsx(_.ChevronRight,{className:"rfp-w-4 rfp-h-4"}),tooltip:r.t("toolbar.next_page"),action:()=>{var t;return(t=r.mobiRef.current)==null?void 0:t.nextPage()}}]},{items:[{type:"button",icon:r.fullWidth?e.jsx(_.Minimize2,{className:"rfp-w-4 rfp-h-4"}):e.jsx(_.Maximize2,{className:"rfp-w-4 rfp-h-4"}),tooltip:r.fullWidth?r.t("toolbar.normal_width"):r.t("toolbar.full_width"),action:()=>{var t;return(t=r.mobiRef.current)==null?void 0:t.toggleFullWidth()}}]}]}function Ut({stats:r}){return r?[{items:[{type:"text",content:`${r.files} files · ${r.dirs} dirs · ${yr(r.size)}`,minWidth:"10rem"}]}]:[]}function Gt(r){const t=[{items:[{type:"button",icon:e.jsx(_.WrapText,{className:"rfp-w-4 rfp-h-4"}),tooltip:r.wordWrap?r.t("toolbar.wrap_off"):r.t("toolbar.wrap_on"),action:r.onToggleWrap}]}];return r.isHtml&&t.push({items:[{type:"button",icon:r.htmlPreview?e.jsx(_.Code,{className:"rfp-w-4 rfp-h-4"}):e.jsx(_.Eye,{className:"rfp-w-4 rfp-h-4"}),tooltip:r.htmlPreview?r.t("toolbar.source"):r.t("toolbar.preview"),action:r.onToggleHtmlPreview}]}),t}function Vt(r){return[{items:[{type:"button",icon:r.viewMode==="preview"?e.jsx(_.Code,{className:"rfp-w-4 rfp-h-4"}):e.jsx(_.Eye,{className:"rfp-w-4 rfp-h-4"}),tooltip:r.viewMode==="preview"?r.t("toolbar.source"):r.t("toolbar.preview"),action:r.onToggleViewMode}]}]}const Xt={fetcher:(r,t)=>fetch(r,t)},Je=s.createContext(Xt),Zt=({requestInit:r,requestHandler:t,shouldFetchAsBlob:n,children:a})=>{const o=s.useMemo(()=>({fetcher:it({requestInit:r,requestHandler:t}),shouldFetchAsBlob:n}),[r,t,n]);return e.jsx(Je.Provider,{value:o,children:a})};function se(){return s.useContext(Je).fetcher}function Jt(r){const{fetcher:t,shouldFetchAsBlob:n}=s.useContext(Je),a=!!(r&&(n!=null&&n(r))),[o,i]=s.useState(()=>r?a?"":r.url:""),p=s.useRef(null);return s.useEffect(()=>{if(!r){i("");return}if(!a){i(r.url);return}let l=!1;return i(""),lt(r.url,t).then(f=>{if(l){URL.revokeObjectURL(f);return}p.current&&URL.revokeObjectURL(p.current),p.current=f,i(f)}).catch(f=>{l||(console.error("[file-preview] resolve blob url failed:",f),i(r.url))}),()=>{l=!0}},[r==null?void 0:r.id,r==null?void 0:r.url,a,t]),s.useEffect(()=>()=>{p.current&&(URL.revokeObjectURL(p.current),p.current=null)},[]),o}const Yt=s.lazy(()=>Promise.resolve().then(()=>Ns).then(r=>({default:r.ImageRenderer}))),Kt=s.lazy(()=>Promise.resolve().then(()=>Ss).then(r=>({default:r.PdfRenderer}))),Qt=s.lazy(()=>Promise.resolve().then(()=>Ms).then(r=>({default:r.DocxRenderer}))),es=s.lazy(()=>Promise.resolve().then(()=>Es).then(r=>({default:r.XlsxRenderer}))),rs=s.lazy(()=>Promise.resolve().then(()=>Ls).then(r=>({default:r.PptxRenderer}))),ts=s.lazy(()=>Promise.resolve().then(()=>Ds).then(r=>({default:r.MsgRenderer}))),ss=s.lazy(()=>Promise.resolve().then(()=>Os).then(r=>({default:r.EpubRenderer}))),ns=s.lazy(()=>Promise.resolve().then(()=>Bs).then(r=>({default:r.MobiRenderer}))),os=s.lazy(()=>Promise.resolve().then(()=>Gs).then(r=>({default:r.VideoRenderer}))),as=s.lazy(()=>Promise.resolve().then(()=>Ys).then(r=>({default:r.AudioRenderer}))),is=s.lazy(()=>Promise.resolve().then(()=>tn).then(r=>({default:r.MarkdownRenderer}))),ls=s.lazy(()=>Promise.resolve().then(()=>fn).then(r=>({default:r.JsonRenderer}))),fs=s.lazy(()=>Promise.resolve().then(()=>pn).then(r=>({default:r.CsvRenderer}))),cs=s.lazy(()=>Promise.resolve().then(()=>hn).then(r=>({default:r.XmlRenderer}))),ps=s.lazy(()=>Promise.resolve().then(()=>yn).then(r=>({default:r.SubtitleRenderer}))),ds=s.lazy(()=>Promise.resolve().then(()=>kn).then(r=>({default:r.ZipRenderer}))),us=s.lazy(()=>Promise.resolve().then(()=>_n).then(r=>({default:r.TextRenderer}))),pr=({fileName:r,fileType:t,onDownload:n})=>{const a=J();return e.jsxs("div",{className:"rfp-flex rfp-flex-col rfp-items-center rfp-justify-center rfp-w-full rfp-h-full rfp-p-8 rfp-gap-6",children:[e.jsx("div",{className:"rfp-w-32 rfp-h-32 rfp-rounded-full rfp-bg-surface-2 rfp-flex rfp-items-center rfp-justify-center",children:e.jsx(_.FileQuestion,{className:"rfp-w-16 rfp-h-16 rfp-text-fg-secondary"})}),e.jsxs("div",{className:"rfp-text-fg-primary rfp-text-center",children:[e.jsx("p",{className:"rfp-text-xl rfp-font-medium rfp-mb-2",children:r}),e.jsx("p",{className:"rfp-text-fg-secondary",children:a("common.unsupported_preview",{type:t})})]}),e.jsxs("button",{onClick:n,className:"rfp-flex rfp-items-center rfp-gap-2 rfp-px-6 rfp-py-3 rfp-bg-surface-2 hover:rfp-bg-surface-3 rfp-backdrop-blur-sm rfp-rounded-lg rfp-text-fg-primary rfp-font-medium rfp-transition-all",children:[e.jsx(_.Download,{className:"rfp-w-5 rfp-h-5"}),a("common.download")]})]})},ms=()=>{const r=J();return e.jsx("div",{className:"rfp-flex rfp-items-center rfp-justify-center rfp-w-full rfp-h-full rfp-text-fg-muted",children:e.jsxs("div",{className:"rfp-flex rfp-flex-col rfp-items-center rfp-gap-3",children:[e.jsx("div",{className:"rfp-w-8 rfp-h-8 rfp-rounded-full rfp-border-2 rfp-border-fg-muted rfp-border-t-transparent rfp-animate-spin"}),e.jsx("span",{className:"rfp-text-sm",children:r("common.loading")??"Loading..."})]})})},hs=3,We=r=>{const{requestInit:t,requestHandler:n,shouldFetchAsBlob:a}=r;return e.jsx(Zt,{requestInit:t,requestHandler:n,shouldFetchAsBlob:a,children:e.jsx(xs,{...r})})},xs=({files:r,currentIndex:t,onNavigate:n,customRenderers:a=[],mode:o="modal",onClose:i,zipNestingDepth:p=0,locale:l="zh-CN",messages:f,headless:u=!1,theme:d="dark",onCustomEvent:c,onDownload:m,requestInit:h,requestHandler:y,shouldFetchAsBlob:x})=>{const w=s.useMemo(()=>Xe({locale:l,messages:f}),[l,f]),[b,g]=s.useState(()=>typeof window<"u"?window.matchMedia("(prefers-color-scheme: dark)").matches:!0);s.useEffect(()=>{if(d!=="auto")return;const P=window.matchMedia("(prefers-color-scheme: dark)"),U=de=>g(de.matches);return P.addEventListener("change",U),()=>P.removeEventListener("change",U)},[d]);const v=d==="auto"?b?"dark":"light":d,[k,S]=s.useState(1),[M,T]=s.useState(0),[D,N]=s.useState(1),[,E]=s.useState(1),[F,H]=s.useState(0),[A,Z]=s.useState(0),[G,j]=s.useState(0),R=s.useRef(null),C=s.useRef(null),B=s.useRef(null),[I,q]=s.useState(0),[L,z]=s.useState(0),[$,Y]=s.useState(!1),V=s.useRef(null),[te,K]=s.useState(0),[be,Q]=s.useState(0),[me,X]=s.useState(!1),[ne,ce]=s.useState(null),[he,je]=s.useState(!0),[Ne,_e]=s.useState(!1),[ye,ge]=s.useState("preview"),[xe,ke]=s.useState(!0),pe=s.useRef(null),Re=2e3,Fe=s.useCallback(()=>{ke(!0),pe.current&&clearTimeout(pe.current),pe.current=window.setTimeout(()=>{ke(!1)},Re)},[]),Tr=s.useCallback(()=>{Fe()},[Fe]),we=s.useMemo(()=>br(r),[r]),W=we[t],ee=Jt(W),Ce=s.useMemo(()=>W?a.find(P=>P.test(W)):null,[W,a]),O=W?gr(W):"unsupported",Ye=s.useCallback((P,U)=>{W&&(c==null||c({name:P,payload:U,file:W}))},[W,c]),Ke=s.useMemo(()=>({emit:Ye,t:w,theme:v,locale:l}),[Ye,w,v,l]);s.useEffect(()=>{S(1),T(0),N(1),E(1),H(0),Z(0),ke(!0),pe.current&&clearTimeout(pe.current)},[t]),s.useEffect(()=>{if(O==="image"&&F>0&&A>0&&R.current){const P=R.current.clientWidth,U=R.current.clientHeight,de=P/F,ue=U/A,Te=Math.min(de,ue);S(Math.max(.01,Math.min(10,Te)))}},[O,F,A]),s.useEffect(()=>(we.length>1&&Fe(),()=>{pe.current&&clearTimeout(pe.current)}),[we.length,Fe]),s.useEffect(()=>{const P=U=>{U.key==="Escape"&&o==="modal"?i==null||i():U.key==="ArrowLeft"&&t>0?n==null||n(t-1):U.key==="ArrowRight"&&t<we.length-1&&(n==null||n(t+1))};if(o==="modal")return window.addEventListener("keydown",P),()=>window.removeEventListener("keydown",P);{const U=C.current;return U?(U.addEventListener("keydown",P),()=>U.removeEventListener("keydown",P)):void 0}},[o,t,we.length,i,n]);const Qe=s.useCallback(()=>{S(P=>Math.min(P+.1,10))},[]),er=s.useCallback(()=>{S(P=>Math.max(P-.1,.01))},[]),Er=s.useCallback(()=>{T(P=>P+90)},[]),Fr=s.useCallback(()=>{T(P=>P-90)},[]),Lr=s.useCallback(()=>{if(R.current&&F>0&&A>0){const P=R.current.clientWidth,U=R.current.clientHeight,de=P/F,ue=U/A,Te=Math.min(de,ue);S(Math.max(.01,Math.min(10,Te)))}else S(1);T(0),j(P=>P+1)},[F,A]),Pr=s.useCallback(()=>{S(1),T(0),j(P=>P+1)},[]),zr=s.useCallback(P=>{S(P)},[]),rr=s.useCallback(()=>{S(1),T(0),j(P=>P+1)},[]),tr=se(),Oe=s.useCallback(async()=>{if(W){if(m){await m(W);return}try{await ft(W.url,W.name,tr)}catch(P){console.error("[file-preview] download failed:",P)}}},[W,m,tr]),$r=s.useCallback((P,U)=>{q(P),z(U)},[]),Dr=s.useCallback((P,U)=>{K(P),Q(U)},[]),Wr=s.useCallback(P=>{ce(P)},[]);if(!W)return null;const Ir=o==="modal"&&!!i,Le=(()=>{var P,U;if(Ce)return((P=Ce.getToolbarGroups)==null?void 0:P.call(Ce,W,Ke))??[];if(O==="image")return Ht({zoom:k,onZoomIn:Qe,onZoomOut:er,onFitToWidth:Lr,onOriginalSize:Pr,onRotateLeft:Fr,onRotateRight:Er,onReset:rr,t:w});if(O==="pdf")return At({zoom:k,onZoomIn:Qe,onZoomOut:er,onReset:rr,t:w});if(O==="epub")return Bt({epubRef:B,current:I,total:L,fullWidth:$,t:w});if(O==="mobi")return qt({mobiRef:V,current:te,total:be,fullWidth:me,t:w});if(O==="zip")return Ut({stats:ne});if(O==="text"){const de=((U=W.name.split(".").pop())==null?void 0:U.toLowerCase())||"";return Gt({wordWrap:he,onToggleWrap:()=>je(ue=>!ue),isHtml:de==="html"||de==="htm",htmlPreview:Ne,onToggleHtmlPreview:()=>_e(ue=>!ue),t:w})}return O==="markdown"?Vt({viewMode:ye,onToggleViewMode:()=>ge(de=>de==="preview"?"source":"preview"),t:w}):[]})(),sr=[{items:[{type:"button",icon:e.jsx(_.Download,{className:"rfp-w-4 rfp-h-4"}),tooltip:w("common.download"),action:Oe}]},...Ir?[{items:[{type:"button",icon:e.jsx(_.X,{className:"rfp-w-4 rfp-h-4"}),tooltip:w("common.close"),action:i}]}]:[]],Pe=(P,U)=>P.map((de,ue,Te)=>e.jsxs(s.Fragment,{children:[de.items.map((Se,nr)=>Se.type==="button"?e.jsx(bs,{icon:Se.icon,label:Se.tooltip,onClick:Se.action,disabled:Se.disabled},`${ue}-${nr}`):e.jsx("span",{className:"rfp-text-xs rfp-text-center rfp-font-medium rfp-tabular-nums rfp-text-fg-tertiary",style:{minWidth:Se.minWidth||"auto"},children:Se.content},`${ue}-${nr}`)),ue<Te.length-1&&e.jsx("div",{className:`rfp-w-px rfp-h-4 rfp-bg-divide ${U}`})]},ue));return e.jsx(vr,{locale:l,messages:f,children:e.jsx(It,{theme:v,children:e.jsxs("div",{ref:C,tabIndex:o==="embed"?0:-1,"data-theme":v,className:"rfp-relative rfp-w-full rfp-h-full rfp-flex rfp-flex-col rfp-overflow-hidden rfp-outline-none",children:[!u&&e.jsxs(re.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"rfp-flex-shrink-0 rfp-z-10 rfp-backdrop-blur-md rfp-border-b rfp-bg-surface-toolbar rfp-border-line",style:{paddingTop:"env(safe-area-inset-top, 0px)"},children:[e.jsxs("div",{className:"rfp-flex rfp-items-center rfp-justify-between rfp-px-3 md:rfp-px-5 rfp-py-1.5 md:rfp-py-2.5",children:[e.jsxs("div",{className:"rfp-flex rfp-items-center rfp-flex-1 rfp-min-w-0 rfp-mr-2 md:rfp-mr-3",children:[e.jsx("h2",{className:"rfp-font-medium rfp-text-xs md:rfp-text-sm rfp-truncate rfp-text-fg-primary",children:W.name}),e.jsxs("span",{className:"rfp-text-xs rfp-ml-2 rfp-flex-shrink-0 rfp-text-fg-muted",children:[t+1,"/",we.length]})]}),e.jsx("div",{className:"rfp-flex rfp-items-center rfp-gap-1 md:rfp-hidden rfp-flex-shrink-0",children:Pe(sr,"rfp-mx-0.5")}),e.jsxs("div",{className:"rfp-hidden md:rfp-flex rfp-items-center rfp-gap-1 rfp-flex-shrink-0",children:[Pe(Le,"rfp-mx-1"),Le.length>0&&e.jsx("div",{className:"rfp-w-px rfp-h-4 rfp-mx-1 rfp-bg-divide"}),Pe(sr,"rfp-mx-1")]})]}),Le.length>0&&e.jsx("div",{className:"rfp-flex rfp-items-center rfp-gap-1 rfp-px-3 rfp-pb-1.5 rfp-overflow-x-auto scrollbar-hide md:rfp-hidden",children:Pe(Le,"rfp-mx-0.5")})]}),e.jsx("div",{ref:R,className:"rfp-flex-1 rfp-flex rfp-items-center rfp-justify-center rfp-overflow-auto",onMouseMove:Tr,children:Ce?Ce.render(W,Ke):e.jsxs(s.Suspense,{fallback:e.jsx(ms,{}),children:[O==="image"&&e.jsx(Yt,{url:ee,zoom:k,rotation:M,resetKey:G,fileSize:W.size,onZoomChange:zr,onNaturalWidthChange:H,onNaturalHeightChange:Z}),O==="pdf"&&e.jsx(Kt,{url:ee,zoom:k,currentPage:D,onPageChange:N,onTotalPagesChange:E,onPageWidthChange:H}),O==="docx"&&e.jsx(Qt,{url:ee}),O==="xlsx"&&e.jsx(es,{url:ee}),O==="pptx"&&e.jsx(rs,{url:ee}),O==="msg"&&e.jsx(ts,{url:ee}),O==="epub"&&e.jsx(ss,{ref:B,url:ee,onChapterChange:$r,onFullWidthChange:Y}),O==="mobi"&&e.jsx(ns,{ref:V,url:ee,onChapterChange:Dr,onFullWidthChange:X}),O==="video"&&e.jsx(os,{url:ee}),O==="audio"&&e.jsx(as,{url:ee,fileName:W.name}),O==="markdown"&&e.jsx(is,{url:ee,viewMode:ye}),O==="json"&&e.jsx(ls,{url:ee,fileName:W.name}),O==="csv"&&e.jsx(fs,{url:ee,fileName:W.name}),O==="xml"&&e.jsx(cs,{url:ee,fileName:W.name}),O==="subtitle"&&e.jsx(ps,{url:ee,fileName:W.name}),O==="zip"&&(p>=hs?e.jsx(pr,{fileName:W.name,fileType:W.type,onDownload:Oe}):e.jsx(ds,{url:ee,onStatsChange:Wr,nestingDepth:p})),O==="text"&&e.jsx(us,{url:ee,fileName:W.name,wordWrap:he,htmlPreview:Ne}),O==="unsupported"&&e.jsx(pr,{fileName:W.name,fileType:W.type,onDownload:Oe})]})}),!u&&we.length>1&&e.jsxs(e.Fragment,{children:[t>0&&e.jsx(re.motion.button,{initial:{opacity:0},animate:{opacity:xe?1:0,x:xe?0:-20},transition:{duration:.2},onClick:()=>n==null?void 0:n(t-1),onMouseEnter:()=>ke(!0),style:{pointerEvents:xe?"auto":"none"},className:"rfp-absolute rfp-z-20 rfp-left-2 md:rfp-left-4 rfp-top-1/2 -rfp-translate-y-1/2 rfp-w-10 rfp-h-10 md:rfp-w-12 md:rfp-h-12 rfp-rounded-full rfp-backdrop-blur-xl rfp-border rfp-flex rfp-items-center rfp-justify-center rfp-transition-colors rfp-shadow-2xl rfp-bg-surface-nav rfp-border-line hover:rfp-bg-surface-nav-hover rfp-text-fg-primary",children:e.jsx(_.ChevronLeft,{className:"rfp-w-5 rfp-h-5 md:rfp-w-6 md:rfp-h-6"})}),t<we.length-1&&e.jsx(re.motion.button,{initial:{opacity:0},animate:{opacity:xe?1:0,x:xe?0:20},transition:{duration:.2},onClick:()=>n==null?void 0:n(t+1),onMouseEnter:()=>ke(!0),style:{pointerEvents:xe?"auto":"none"},className:"rfp-absolute rfp-z-20 rfp-right-2 md:rfp-right-4 rfp-top-1/2 -rfp-translate-y-1/2 rfp-w-10 rfp-h-10 md:rfp-w-12 md:rfp-h-12 rfp-rounded-full rfp-backdrop-blur-xl rfp-border rfp-flex rfp-items-center rfp-justify-center rfp-transition-colors rfp-shadow-2xl rfp-bg-surface-nav rfp-border-line hover:rfp-bg-surface-nav-hover rfp-text-fg-primary",children:e.jsx(_.ChevronRight,{className:"rfp-w-5 rfp-h-5 md:rfp-w-6 md:rfp-h-6"})})]})]})})})},bs=({icon:r,label:t,onClick:n,disabled:a})=>e.jsxs("button",{onClick:n,disabled:a,className:`rfp-relative rfp-group rfp-p-2 md:rfp-p-1.5 rfp-rounded-md rfp-transition-all rfp-select-none ${a?"rfp-text-fg-disabled rfp-cursor-not-allowed":"rfp-text-fg-primary hover:rfp-bg-surface-2 active:rfp-bg-surface-3"}`,children:[r,e.jsxs("span",{className:"rfp-absolute rfp-left-1/2 -rfp-translate-x-1/2 rfp-top-full rfp-mt-1.5 rfp-px-2 rfp-py-1 rfp-text-xs rfp-rounded rfp-whitespace-nowrap rfp-pointer-events-none rfp-opacity-0 rfp-invisible group-hover:rfp-opacity-100 group-hover:rfp-visible rfp-transition-opacity rfp-duration-200 rfp-z-50 rfp-bg-fg-primary rfp-text-fg-inverse",children:[e.jsx("span",{className:"rfp-absolute rfp-left-1/2 -rfp-translate-x-1/2 -rfp-top-1 rfp-w-2 rfp-h-2 rfp-rotate-45 rfp-bg-fg-primary"}),e.jsx("span",{className:"rfp-relative",children:t})]})]}),gs=Object.freeze(Object.defineProperty({__proto__:null,FilePreviewContent:We},Symbol.toStringTag,{value:"Module"})),ys=({files:r,currentIndex:t,isOpen:n,onClose:a,onNavigate:o,customRenderers:i=[],locale:p,messages:l,headless:f,theme:u="dark",onCustomEvent:d,requestInit:c,requestHandler:m,shouldFetchAsBlob:h,onDownload:y})=>{const[x,w]=s.useState(()=>typeof window<"u"?window.matchMedia("(prefers-color-scheme: dark)").matches:!0);s.useEffect(()=>{if(u!=="auto")return;const v=window.matchMedia("(prefers-color-scheme: dark)"),k=S=>w(S.matches);return v.addEventListener("change",k),()=>v.removeEventListener("change",k)},[u]);const b=u==="auto"?x?"dark":"light":u;if(s.useEffect(()=>{if(n){const v=document.body.style.overflow,k=document.body.style.paddingRight,S=window.innerWidth-document.documentElement.clientWidth;return document.body.style.overflow="hidden",S>0&&(document.body.style.paddingRight=`${S}px`),()=>{document.body.style.overflow=v,document.body.style.paddingRight=k}}},[n]),!n)return null;const g=e.jsx("div",{className:"rfp-root","data-theme":b,children:e.jsx(re.AnimatePresence,{children:n&&e.jsx(re.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"rfp-fixed rfp-inset-0 rfp-z-[9999] rfp-flex rfp-items-center rfp-justify-center rfp-backdrop-blur-md rfp-overflow-hidden rfp-bg-surface-overlay",onClick:a,onWheel:v=>v.stopPropagation(),children:e.jsx("div",{className:"rfp-relative rfp-w-full rfp-h-full",onClick:v=>v.stopPropagation(),children:e.jsx(We,{mode:"modal",files:r,currentIndex:t,onClose:a,onNavigate:o,customRenderers:i,locale:p,messages:l,headless:f,theme:u,onCustomEvent:d,requestInit:c,requestHandler:m,shouldFetchAsBlob:h,onDownload:y})})})})});return mr.createPortal(g,document.body)},ws=({files:r,currentIndex:t=0,onNavigate:n,customRenderers:a=[],width:o="100%",height:i="100%",className:p,style:l,locale:f,messages:u,headless:d,theme:c="dark",onCustomEvent:m,requestInit:h,requestHandler:y,shouldFetchAsBlob:x,onDownload:w})=>{const[b,g]=s.useState(()=>typeof window<"u"?window.matchMedia("(prefers-color-scheme: dark)").matches:!0);s.useEffect(()=>{if(c!=="auto")return;const k=window.matchMedia("(prefers-color-scheme: dark)"),S=M=>g(M.matches);return k.addEventListener("change",S),()=>k.removeEventListener("change",S)},[c]);const v=c==="auto"?b?"dark":"light":c;return e.jsx("div",{className:`rfp-root ${p??""}`,style:{width:o,height:i,...l},"data-theme":v,children:e.jsx("div",{className:"rfp-relative rfp-w-full rfp-h-full rfp-overflow-hidden rfp-bg-surface-overlay",children:e.jsx(We,{mode:"embed",files:r,currentIndex:t,onNavigate:n,customRenderers:a,locale:f,messages:u,headless:d,theme:c,onCustomEvent:m,requestInit:h,requestHandler:y,shouldFetchAsBlob:x,onDownload:w})})})};function kr(r){if(typeof window>"u")return;const{workerSrc:t=`https://unpkg.com/pdfjs-dist@${ve.pdfjs.version}/build/pdf.worker.min.mjs`,cMapUrl:n=`https://unpkg.com/pdfjs-dist@${ve.pdfjs.version}/cmaps/`,cMapPacked:a=!0}=r||{};ve.pdfjs.GlobalWorkerOptions.workerSrc=t,ve.pdfjs.GlobalWorkerOptions.cMapUrl=n,ve.pdfjs.GlobalWorkerOptions.cMapPacked=a}kr();const vs=Qr.version,js=({url:r,zoom:t,rotation:n,resetKey:a,fileSize:o,onZoomChange:i,onNaturalWidthChange:p,onNaturalHeightChange:l})=>{const f=J(),[u,d]=s.useState(!1),[c,m]=s.useState(null),[h,y]=s.useState({x:0,y:0}),[x,w]=s.useState(!1),[b,g]=s.useState({x:0,y:0}),[v,k]=s.useState(1),[S,M]=s.useState({width:0,height:0}),T=s.useRef(null),D=s.useRef(null);s.useEffect(()=>{d(!1),m(null),y({x:0,y:0}),k(1)},[r]),s.useEffect(()=>{k(t)},[t]),s.useEffect(()=>{a!==void 0&&y({x:0,y:0})},[a]);const N=j=>{d(!0);const R=j.currentTarget;M({width:R.naturalWidth,height:R.naturalHeight}),p==null||p(R.naturalWidth),l==null||l(R.naturalHeight)},E=s.useCallback((j,R)=>{const C=D.current;if(!C||S.width===0)return j;const B=C.clientWidth,I=C.clientHeight,q=S.width*R,L=S.height*R,z=Math.min(80,B*.15,I*.15),$=(B+q)/2-z,Y=(I+L)/2-z;return{x:$>0?Math.max(-$,Math.min($,j.x)):0,y:Y>0?Math.max(-Y,Math.min(Y,j.y)):0}},[S]),F=()=>{m(f("image.load_failed")),d(!0)},H=()=>{y({x:0,y:0}),k(1),i==null||i(1)};s.useEffect(()=>{const j=D.current;if(!j)return;const R=C=>{C.preventDefault(),C.stopPropagation();const B=j.getBoundingClientRect(),I=C.clientX-B.left-B.width/2,q=C.clientY-B.top-B.height/2,L=C.deltaY>0?-.05:.05;k(z=>{const $=Math.max(.01,Math.min(10,z+L)),Y=$/z;return y(V=>E({x:I-Y*(I-V.x),y:q-Y*(q-V.y)},$)),i==null||i($),$})};return j.addEventListener("wheel",R,{passive:!1}),()=>j.removeEventListener("wheel",R)},[i,E]);const A=s.useCallback(j=>{j.button===0&&(w(!0),g({x:j.clientX-h.x,y:j.clientY-h.y}))},[h]),Z=s.useCallback(j=>{x&&y(E({x:j.clientX-b.x,y:j.clientY-b.y},v))},[x,b,v,E]),G=s.useCallback(()=>{w(!1)},[]);return e.jsxs("div",{ref:D,className:"rfp-relative rfp-flex rfp-items-center rfp-justify-center rfp-w-full rfp-h-full rfp-overflow-hidden",onMouseDown:A,onMouseMove:Z,onMouseUp:G,onMouseLeave:G,style:{cursor:x?"grabbing":"grab"},children:[!u&&!c&&e.jsx("div",{className:"rfp-flex rfp-items-center rfp-justify-center",children:e.jsx("div",{className:"rfp-w-12 rfp-h-12 rfp-border-4 rfp-border-line-strong rfp-border-t-spinner-head rfp-rounded-full rfp-animate-spin"})}),c&&e.jsx("div",{className:"rfp-text-fg-secondary rfp-text-center",children:e.jsx("p",{className:"rfp-text-lg",children:c})}),e.jsx(re.motion.img,{ref:T,src:r,alt:"Preview",className:`rfp-max-w-none rfp-select-none ${u?"":"rfp-hidden"}`,style:{transform:`translate(${h.x}px, ${h.y}px) scale(${v}) rotate(${n}deg)`,transformOrigin:"center",transition:x?"none":"transform 0.3s ease-out"},onLoad:N,onError:F,onDoubleClick:H,initial:{opacity:0},animate:{opacity:u?1:0},transition:{duration:.3},draggable:!1}),u&&!c&&S.width>0&&e.jsxs("div",{className:"rfp-absolute rfp-bottom-2 rfp-right-3 rfp-text-[10px] rfp-text-fg-disabled hover:rfp-text-fg-secondary rfp-transition-colors rfp-pointer-events-auto rfp-select-none rfp-cursor-default",children:[S.width," × ",S.height,o!=null&&` · ${o<1024?`${o} B`:o<1024*1024?`${(o/1024).toFixed(1)} KB`:`${(o/(1024*1024)).toFixed(1)} MB`}`]})]})},Ns=Object.freeze(Object.defineProperty({__proto__:null,ImageRenderer:js},Symbol.toStringTag,{value:"Module"})),ks=({url:r,zoom:t,currentPage:n,onPageChange:a,onTotalPagesChange:o,onPageWidthChange:i})=>{const p=J(),[l,f]=s.useState(0),[u,d]=s.useState(null),c=s.useRef(null),m=s.useRef(new Map);s.useEffect(()=>{d(null)},[r]);const h=({numPages:b})=>{f(b),o(b),a(1)},y=b=>{console.error("PDF 加载错误:",b),d(p("pdf.load_failed"))},x=s.useCallback(()=>{if(!c.current)return;const b=c.current,g=b.scrollTop,v=b.clientHeight,k=g+v/2;let S=1,M=1/0;m.current.forEach((T,D)=>{const N=T.getBoundingClientRect(),E=b.getBoundingClientRect(),F=N.top-E.top+N.height/2+g,H=Math.abs(F-k);H<M&&(M=H,S=D)}),S!==n&&a(S)},[n,a]);s.useEffect(()=>{const b=c.current;if(b)return b.addEventListener("scroll",x),()=>b.removeEventListener("scroll",x)},[x]);const w=s.useCallback((b,g)=>{g?m.current.set(b,g):m.current.delete(b)},[]);return e.jsxs("div",{ref:c,className:"rfp-flex rfp-flex-col rfp-items-center rfp-w-full rfp-h-full rfp-overflow-auto rfp-py-4 md:rfp-py-8 rfp-px-2 md:rfp-px-4",children:[u&&e.jsx("div",{className:"rfp-text-fg-secondary rfp-text-center",children:e.jsx("p",{className:"rfp-text-lg",children:u})}),!u&&e.jsx(ve.Document,{file:r,onLoadSuccess:h,onLoadError:y,loading:e.jsx("div",{className:"rfp-flex rfp-items-center rfp-justify-center rfp-min-h-screen",children:e.jsx("div",{className:"rfp-w-12 rfp-h-12 rfp-border-4 rfp-border-line-strong rfp-border-t-spinner-head rfp-rounded-full rfp-animate-spin"})}),children:e.jsx("div",{className:"rfp-flex rfp-flex-col rfp-gap-4",children:Array.from(new Array(l),(b,g)=>{const v=g+1;return e.jsxs("div",{ref:k=>w(v,k),className:"rfp-relative",children:[e.jsx(ve.Page,{pageNumber:v,scale:t,loading:e.jsx("div",{className:"rfp-flex rfp-items-center rfp-justify-center rfp-p-8 rfp-bg-surface-1 rfp-rounded-lg rfp-min-h-[600px]",children:e.jsx("div",{className:"rfp-w-8 rfp-h-8 rfp-border-4 rfp-border-line-strong rfp-border-t-spinner-head rfp-rounded-full rfp-animate-spin"})}),renderTextLayer:!1,renderAnnotationLayer:!1,className:"rfp-shadow-2xl",onRenderSuccess:k=>{v===1&&i&&i(k.originalWidth||k.width/t)}}),e.jsx("div",{className:"rfp-absolute rfp-top-2 rfp-right-2 rfp-bg-surface-nav-hover rfp-backdrop-blur-sm rfp-text-fg-primary rfp-text-xs rfp-px-3 rfp-py-1 rfp-rounded-full",children:v})]},`page_${v}`)})})}),l>0&&e.jsxs("div",{className:"rfp-sticky rfp-bottom-2 md:rfp-bottom-4 rfp-mt-4 md:rfp-mt-8 rfp-bg-surface-nav-hover rfp-backdrop-blur-xl rfp-text-fg-primary rfp-px-4 rfp-py-2 md:rfp-px-6 md:rfp-py-3 rfp-rounded-full rfp-text-xs md:rfp-text-sm rfp-font-medium rfp-shadow-2xl rfp-border rfp-border-line-weak",children:["第 ",n," 页 / 共 ",l," 页"]})]})},Ss=Object.freeze(Object.defineProperty({__proto__:null,PdfRenderer:ks},Symbol.toStringTag,{value:"Module"})),Sr=1123,_r=60,dr=50,_s=Sr-_r*2,Rs=24,ur={fontFamily:"system-ui, -apple-system, sans-serif",lineHeight:"1.8",color:"#333"},Cs=({url:r})=>{const t=J(),n=se(),[a,o]=s.useState(""),[i,p]=s.useState(!0),[l,f]=s.useState(null),[u,d]=s.useState([]),c=s.useRef(null);s.useEffect(()=>{(async()=>{p(!0),f(null),o("");try{const y=await n(r);if(!y.ok)throw new Error("文件加载失败");const x=await y.arrayBuffer(),w=await Or.convertToHtml({arrayBuffer:x});o(w.value)}catch(y){console.error("Docx 解析错误:",y),f(t("docx.parse_failed"))}finally{p(!1)}})()},[r,n,t]);const m=s.useCallback(()=>{const h=c.current;if(!h||!a)return;const y=Array.from(h.children);if(y.length===0){d([a]);return}const x=[[]];let w=0;for(const b of y){const g=b.offsetHeight;w>0&&w+g>_s&&(x.push([]),w=0),x[x.length-1].push(b.outerHTML),w+=g}x.length===0&&x.push([]),d(x.map(b=>b.join("")))},[a]);return s.useEffect(()=>{!a||!c.current||requestAnimationFrame(()=>{m()})},[a,m]),i?e.jsx("div",{className:"rfp-flex rfp-items-center rfp-justify-center rfp-w-full rfp-h-full",children:e.jsx("div",{className:"rfp-w-12 rfp-h-12 rfp-border-4 rfp-border-line-strong rfp-border-t-spinner-head rfp-rounded-full rfp-animate-spin"})}):l?e.jsx("div",{className:"rfp-flex rfp-items-center rfp-justify-center rfp-w-full rfp-h-full",children:e.jsx("div",{className:"rfp-text-fg-secondary rfp-text-center",children:e.jsx("p",{className:"rfp-text-lg",children:l})})}):e.jsxs("div",{className:"rfp-w-full rfp-h-full rfp-overflow-auto",style:{background:"rgba(0, 0, 0, 0.15)"},children:[e.jsx("div",{ref:c,dangerouslySetInnerHTML:{__html:a},style:{...ur,position:"absolute",visibility:"hidden",width:`${794-dr*2}px`,pointerEvents:"none"}}),e.jsx("div",{className:"rfp-py-6 md:rfp-py-10 rfp-flex rfp-flex-col rfp-items-center",style:{gap:`${Rs}px`},children:(u.length>0?u:[""]).map((h,y)=>e.jsx("div",{style:{width:"100%",maxWidth:"794px",minHeight:`${Sr}px`,background:"white",boxShadow:"0 2px 12px rgba(0, 0, 0, 0.15)",flexShrink:0,padding:`${_r}px ${dr}px`},children:e.jsx("div",{dangerouslySetInnerHTML:{__html:h},style:ur})},y))})]})},Ms=Object.freeze(Object.defineProperty({__proto__:null,DocxRenderer:Cs},Symbol.toStringTag,{value:"Module"})),Ts=({url:r})=>{const t=J(),n=se(),[a,o]=s.useState(!0),[i,p]=s.useState(null),l=s.useRef(null),f=s.useRef(null),u=s.useRef(null),d=s.useRef(null),c=s.useRef(null),m=s.useRef({width:0,height:0}),h=s.useCallback(()=>{if(!l.current)return{width:800,height:600};const x=l.current.clientWidth,w=l.current.clientHeight,b=x>100?x:800,g=w>100?w:600;return{width:b,height:g}},[]),y=s.useCallback(()=>{if(!l.current||!u.current)return;l.current.innerHTML="",f.current=null;const{width:x,height:w}=h(),b=x<640,g=new hr(l.current,{mode:"read",showToolbar:!1,showContextmenu:!1,showGrid:!0,row:{len:100,height:25},col:{len:26,width:b?80:100,indexWidth:b?40:60,minWidth:b?40:60},view:{height:()=>w,width:()=>x}});g.loadData(u.current),f.current=g},[h]);return s.useEffect(()=>{if(!l.current)return;let x=!0;const w=()=>{if(x){x=!1,m.current=h();return}const b=h(),g=m.current,v=Math.abs(g.width-b.width),k=Math.abs(g.height-b.height);v<10&&k<10||(m.current=b,c.current&&clearTimeout(c.current),c.current=window.setTimeout(()=>{u.current&&y()},500))};return d.current=new ResizeObserver(()=>{w()}),d.current.observe(l.current),()=>{d.current&&d.current.disconnect(),c.current&&clearTimeout(c.current)}},[h,y]),s.useEffect(()=>{let x=!0;const w=async()=>{if(l.current){o(!0),p(null);try{const g=await n(r,{mode:"cors",credentials:"omit",redirect:"follow"});if(!g.ok)throw g.status===404?new Error(t("xlsx.not_found")):g.status===403?new Error("无权限访问此文件"):new Error(`文件加载失败 (${g.status})`);const v=await g.arrayBuffer();if(v.byteLength===0)throw new Error("文件为空");const k=new Hr.Workbook;await k.xlsx.load(v);const S=Et(k);if(!x)return;u.current=S,y(),o(!1)}catch(g){if(x){console.error("Excel 解析错误:",g);let v=t("xlsx.parse_failed");g instanceof Error&&(v=g.message),p(v),o(!1)}}}},b=setTimeout(()=>{requestAnimationFrame(()=>{w()})},100);return()=>{x=!1,clearTimeout(b),u.current=null,l.current&&(l.current.innerHTML=""),f.current=null}},[r,y]),e.jsxs("div",{className:"rfp-relative rfp-flex rfp-flex-col rfp-items-center rfp-w-full rfp-h-full",children:[a&&e.jsx("div",{className:"rfp-absolute rfp-inset-0 rfp-flex rfp-items-center rfp-justify-center rfp-bg-surface-toolbar rfp-backdrop-blur-sm rfp-z-10",children:e.jsxs("div",{className:"rfp-text-center",children:[e.jsx("div",{className:"rfp-w-10 rfp-h-10 md:rfp-w-12 md:rfp-h-12 rfp-mx-auto rfp-mb-3 rfp-border-4 rfp-border-line-strong rfp-border-t-spinner-head rfp-rounded-full rfp-animate-spin"}),e.jsx("p",{className:"rfp-text-xs md:rfp-text-sm rfp-text-fg-secondary rfp-font-medium",children:t("xlsx.loading")})]})}),i&&!a&&e.jsx("div",{className:"rfp-absolute rfp-inset-0 rfp-flex rfp-items-center rfp-justify-center rfp-bg-surface-toolbar rfp-backdrop-blur-sm rfp-z-10",children:e.jsxs("div",{className:"rfp-text-center rfp-max-w-sm md:rfp-max-w-md rfp-px-4",children:[e.jsx("div",{className:"rfp-w-24 rfp-h-24 md:rfp-w-32 md:rfp-h-32 rfp-mx-auto rfp-mb-4 md:rfp-mb-6 rfp-rounded-2xl md:rfp-rounded-3xl rfp-bg-gradient-to-br rfp-from-green-500 rfp-via-emerald-500 rfp-to-teal-500 rfp-flex rfp-items-center rfp-justify-center rfp-shadow-2xl",children:e.jsx(_.FileSpreadsheet,{className:"rfp-w-12 rfp-h-12 md:rfp-w-16 md:rfp-h-16 rfp-text-fg-primary"})}),e.jsx("p",{className:"rfp-text-lg md:rfp-text-xl rfp-text-fg-primary rfp-mb-2 md:rfp-mb-3 rfp-font-medium",children:t("xlsx.load_failed")}),e.jsx("p",{className:"rfp-text-xs md:rfp-text-sm rfp-text-fg-tertiary rfp-mb-4 md:rfp-mb-6",children:i}),e.jsxs("a",{href:r,download:!0,className:"rfp-inline-flex rfp-items-center rfp-gap-2 rfp-px-4 rfp-py-2 md:rfp-px-6 md:rfp-py-3 rfp-bg-gradient-to-r rfp-from-purple-500 rfp-to-pink-500 rfp-text-fg-primary rfp-text-sm md:rfp-text-base rfp-rounded-lg md:rfp-rounded-xl hover:rfp-scale-105 rfp-transition-all rfp-shadow-lg",children:[e.jsx("svg",{className:"rfp-w-4 rfp-h-4 md:rfp-w-5 md:rfp-h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"})}),t("common.download")]}),e.jsx("p",{className:"rfp-text-xs rfp-text-fg-muted rfp-mt-3 md:rfp-mt-4",children:"提示:可以使用 Microsoft Excel 或 WPS 打开"})]})}),!i&&e.jsx("div",{ref:l,className:"xlsx-spreadsheet-container rfp-w-full rfp-h-full",style:{opacity:a?0:1}})]})},Es=Object.freeze(Object.defineProperty({__proto__:null,XlsxRenderer:Ts},Symbol.toStringTag,{value:"Module"})),Fs=({url:r,tiled:t=!0})=>{const n=J(),a=se(),[o,i]=s.useState(!0),[p,l]=s.useState(null),[f,u]=s.useState(0),d=s.useRef(null),c=s.useRef(null),m=s.useRef(null),h=s.useRef(null),y=s.useRef(null),x=s.useRef({width:0,height:0}),w=s.useCallback(()=>{var M;if(!d.current)return{width:960,height:540};const g=d.current.clientWidth,v=((M=d.current.parentElement)==null?void 0:M.clientWidth)||0,k=g>100?g:v>100?v:300,S=Math.floor(k*9/16);return{width:k,height:S}},[]),b=s.useCallback(async()=>{if(!(!d.current||!h.current||f===0))try{if(c.current)try{c.current.destroy()}catch{}d.current.innerHTML="";const g=w(),v=He.init(d.current,{width:g.width,height:t?g.height*f:g.height,mode:t?"list":"slide"});c.current=v,await v.preview(h.current)}catch{}},[w,t,f]);return s.useEffect(()=>{if(!d.current)return;let g=!0;const v=()=>{if(g){g=!1,x.current=w();return}const k=w(),S=x.current,M=Math.abs(S.width-k.width),T=Math.abs(S.height-k.height);M<10&&T<10||(x.current=k,y.current&&clearTimeout(y.current),y.current=window.setTimeout(()=>{c.current&&h.current&&b()},800))};return m.current=new ResizeObserver(()=>{v()}),m.current.observe(d.current),()=>{m.current&&m.current.disconnect(),y.current&&clearTimeout(y.current)}},[w,b]),s.useEffect(()=>{let g=!0,v=null;const k=async()=>{if(d.current){i(!0),l(null),v=setTimeout(()=>{g&&(l(n("pptx.timeout")),i(!1))},3e4);try{const M=await a(r,{mode:"cors",credentials:"omit",redirect:"follow"});if(!M.ok)throw M.status===404?new Error(n("pptx.not_found")):M.status===403?new Error("无权限访问此文件"):M.status>=500?new Error("服务器错误,请稍后重试"):new Error(`文件加载失败 (${M.status})`);const T=await M.arrayBuffer();if(T.byteLength===0)throw new Error("文件为空");if(h.current=T,!g)return;const D=document.createElement("div");D.style.cssText="position:absolute;left:-9999px;top:-9999px;visibility:hidden",document.body.appendChild(D);try{const N=He.init(D,{width:100,height:100,mode:"slide"});try{await N.preview(T)}catch{throw new Error(n("pptx.invalid_format"))}const E=N.slideCount;if(!E||E===0)throw new Error(n("pptx.no_pages"));if(N.destroy(),!g)return;u(E),d.current&&(d.current.innerHTML="");const F=w(),H=He.init(d.current,{width:F.width,height:t?F.height*E:F.height,mode:t?"list":"slide"});c.current=H,await H.preview(T),v&&(clearTimeout(v),v=null),g&&i(!1)}finally{document.body.contains(D)&&document.body.removeChild(D)}}catch(M){if(v&&(clearTimeout(v),v=null),g){let T=n("pptx.parse_failed");M instanceof Error?T=M.message:typeof M=="string"&&(T=M),l(T),i(!1)}}}},S=setTimeout(()=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{k()})})},150);return()=>{if(g=!1,clearTimeout(S),v&&clearTimeout(v),h.current=null,u(0),c.current)try{c.current.destroy()}catch{}c.current=null}},[r,w,t]),e.jsxs("div",{className:"rfp-relative rfp-flex rfp-flex-col rfp-items-center rfp-w-full rfp-h-full",children:[o&&e.jsx("div",{className:"rfp-absolute rfp-inset-0 rfp-flex rfp-items-center rfp-justify-center rfp-bg-surface-toolbar rfp-backdrop-blur-sm rfp-z-10",children:e.jsxs("div",{className:"rfp-text-center",children:[e.jsx("div",{className:"rfp-w-10 rfp-h-10 md:rfp-w-12 md:rfp-h-12 rfp-mx-auto rfp-mb-3 rfp-border-4 rfp-border-line-strong rfp-border-t-spinner-head rfp-rounded-full rfp-animate-spin"}),e.jsx("p",{className:"rfp-text-xs md:rfp-text-sm rfp-text-fg-secondary rfp-font-medium",children:n("pptx.loading")})]})}),p&&!o&&e.jsx("div",{className:"rfp-absolute rfp-inset-0 rfp-flex rfp-items-center rfp-justify-center rfp-bg-surface-toolbar rfp-backdrop-blur-sm rfp-z-10",children:e.jsxs("div",{className:"rfp-text-center rfp-max-w-sm md:rfp-max-w-md rfp-px-4",children:[e.jsx("div",{className:"rfp-w-24 rfp-h-24 md:rfp-w-32 md:rfp-h-32 rfp-mx-auto rfp-mb-4 md:rfp-mb-6 rfp-rounded-2xl md:rfp-rounded-3xl rfp-bg-gradient-to-br rfp-from-orange-500 rfp-via-red-500 rfp-to-pink-500 rfp-flex rfp-items-center rfp-justify-center rfp-shadow-2xl",children:e.jsx(_.Presentation,{className:"rfp-w-12 rfp-h-12 md:rfp-w-16 md:rfp-h-16 rfp-text-fg-primary"})}),e.jsx("p",{className:"rfp-text-lg md:rfp-text-xl rfp-text-fg-primary rfp-mb-2 md:rfp-mb-3 rfp-font-medium",children:n("pptx.load_failed")}),e.jsx("p",{className:"rfp-text-xs md:rfp-text-sm rfp-text-fg-tertiary rfp-mb-4 md:rfp-mb-6",children:p}),e.jsxs("a",{href:r,download:!0,className:"rfp-inline-flex rfp-items-center rfp-gap-2 rfp-px-4 rfp-py-2 md:rfp-px-6 md:rfp-py-3 rfp-bg-gradient-to-r rfp-from-purple-500 rfp-to-pink-500 rfp-text-fg-primary rfp-text-sm md:rfp-text-base rfp-rounded-lg md:rfp-rounded-xl hover:rfp-scale-105 rfp-transition-all rfp-shadow-lg",children:[e.jsx("svg",{className:"rfp-w-4 rfp-h-4 md:rfp-w-5 md:rfp-h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"})}),n("common.download")]}),e.jsx("p",{className:"rfp-text-xs rfp-text-fg-muted rfp-mt-3 md:rfp-mt-4",children:"提示:可以使用 Microsoft PowerPoint 或 WPS 打开"})]})}),!p&&e.jsx("div",{ref:d,className:"pptx-wrapper rfp-w-full rfp-max-w-full md:rfp-max-w-6xl",style:{opacity:o?0:1}})]})},Ls=Object.freeze(Object.defineProperty({__proto__:null,PptxRenderer:Fs},Symbol.toStringTag,{value:"Module"}));function qe(r,t){return r?r.filter(n=>n.recipType===t).map(n=>{const a=n.name||"",o=n.smtpAddress||n.email||"";return a&&o&&a!==o?`${a} <${o}>`:a||o}).filter(Boolean).join("; "):""}function De(r){if(!r)return"";try{const t=new Date(r);return isNaN(t.getTime())?r:t.toLocaleString()}catch{return r}}function Ps(r,t){if(r.bodyHtml)return r.bodyHtml;if(r.html)try{return new TextDecoder("utf-8").decode(r.html)}catch{}return r.body?`<pre style="white-space: pre-wrap; word-wrap: break-word; font-family: system-ui, sans-serif;">${r.body.replace(/&/g,"&").replace(/\x3c/g,"<").replace(/>/g,">")}</pre>`:`<p style="color: #999;">${t}</p>`}function zs(r){return r?{"IPM.Note":"Email","IPM.Note.SMIME":"Encrypted Email","IPM.Note.SMIME.MultipartSigned":"Signed Email","IPM.Appointment":"Appointment","IPM.Schedule.Meeting.Request":"Meeting Request","IPM.Schedule.Meeting.Canceled":"Meeting Cancellation","IPM.Contact":"Contact","IPM.Task":"Task","IPM.StickyNote":"Sticky Note"}[r]||r:""}const oe={flexShrink:0,color:"#6b7280",fontWeight:500,marginRight:"8px",whiteSpace:"nowrap"},ae={display:"flex",alignItems:"flex-start",gap:"8px",padding:"6px 0"},ie={flexShrink:0,display:"flex",alignItems:"center",height:"1.4em"},le={flexShrink:0,color:"#9ca3af"},fe={color:"#111827",wordBreak:"break-word",flex:1},$s=({url:r})=>{const t=J(),n=se(),[a,o]=s.useState(!0),[i,p]=s.useState(null),[l,f]=s.useState(null);if(s.useEffect(()=>{(async()=>{o(!0),p(null),f(null);try{const G=await n(r);if(!G.ok)throw new Error("文件加载失败");const j=await G.arrayBuffer(),C=new Ar(j).getFileData();f(C)}catch(G){console.error("MSG 解析错误:",G),p(t("msg.parse_failed"))}finally{o(!1)}})()},[r]),a)return e.jsx("div",{className:"rfp-flex rfp-items-center rfp-justify-center rfp-w-full rfp-h-full",children:e.jsx("div",{className:"rfp-w-12 rfp-h-12 rfp-border-4 rfp-border-line-strong rfp-border-t-spinner-head rfp-rounded-full rfp-animate-spin"})});if(i||!l)return e.jsx("div",{className:"rfp-flex rfp-items-center rfp-justify-center rfp-w-full rfp-h-full",children:e.jsx("div",{className:"rfp-text-fg-secondary rfp-text-center",children:e.jsx("p",{className:"rfp-text-lg",children:i||t("msg.parse_failed_short")})})});const u=qe(l.recipients,"to"),d=qe(l.recipients,"cc"),c=qe(l.recipients,"bcc"),m=l.senderName||"",h=l.senderSmtpAddress||l.senderEmail||"",y=m&&h&&m!==h?`${m} <${h}>`:m||h,x=De(l.clientSubmitTime),w=De(l.messageDeliveryTime),b=De(l.creationTime),g=De(l.lastModificationTime),v=l.subject||"(无主题)",k=(l.attachments||[]).filter(Z=>!Z.attachmentHidden),S=Ps(l,t("msg.empty_body")),M=zs(l.messageClass),T=l.messageId||"",D=l,N=typeof D.importance=="number"?D.importance:void 0,E=N===2?"High":N===0?"Low":"",F=typeof D.sensitivity=="number"?D.sensitivity:void 0,A=F!==void 0&&F!==0&&{0:"Normal",1:"Personal",2:"Private",3:"Confidential"}[F]||"";return e.jsx("div",{className:"rfp-w-full rfp-h-full rfp-overflow-auto",style:{background:"white"},children:e.jsxs("div",{style:{width:"100%",background:"white",minHeight:"100%"},children:[e.jsxs("div",{style:{borderBottom:"1px solid #e5e7eb",padding:"clamp(12px, 3vw, 24px) clamp(16px, 3vw, 28px)",background:"#f9fafb"},children:[e.jsx("h2",{style:{margin:"0 0 16px 0",fontSize:"clamp(16px, 2.5vw, 20px)",fontWeight:600,color:"#111827",lineHeight:1.4},children:v}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",fontSize:"clamp(12px, 1.8vw, 14px)",color:"#4b5563"},children:[y&&e.jsxs("div",{style:ae,children:[e.jsx("span",{style:ie,children:e.jsx(_.User,{size:16,style:le})}),e.jsxs("div",{style:{display:"flex",flex:1},children:[e.jsx("span",{style:oe,children:"From"}),e.jsx("span",{style:fe,children:y})]})]}),u&&e.jsxs("div",{style:ae,children:[e.jsx("span",{style:ie,children:e.jsx(_.Users,{size:16,style:le})}),e.jsxs("div",{style:{display:"flex",flex:1},children:[e.jsx("span",{style:oe,children:"To"}),e.jsx("span",{style:fe,children:u})]})]}),d&&e.jsxs("div",{style:ae,children:[e.jsx("span",{style:ie,children:e.jsx(_.Users,{size:16,style:le})}),e.jsxs("div",{style:{display:"flex",flex:1},children:[e.jsx("span",{style:oe,children:"Cc"}),e.jsx("span",{style:fe,children:d})]})]}),c&&e.jsxs("div",{style:ae,children:[e.jsx("span",{style:ie,children:e.jsx(_.Users,{size:16,style:le})}),e.jsxs("div",{style:{display:"flex",flex:1},children:[e.jsx("span",{style:oe,children:"Bcc"}),e.jsx("span",{style:fe,children:c})]})]}),x&&e.jsxs("div",{style:ae,children:[e.jsx("span",{style:ie,children:e.jsx(_.Calendar,{size:16,style:le})}),e.jsxs("div",{style:{display:"flex",flex:1},children:[e.jsx("span",{style:oe,children:"Sent"}),e.jsx("span",{style:fe,children:x})]})]}),w&&w!==x&&e.jsxs("div",{style:ae,children:[e.jsx("span",{style:ie,children:e.jsx(_.Clock,{size:16,style:le})}),e.jsxs("div",{style:{display:"flex",flex:1},children:[e.jsx("span",{style:oe,children:"Received"}),e.jsx("span",{style:fe,children:w})]})]}),!x&&!w&&b&&e.jsxs("div",{style:ae,children:[e.jsx("span",{style:ie,children:e.jsx(_.Calendar,{size:16,style:le})}),e.jsxs("div",{style:{display:"flex",flex:1},children:[e.jsx("span",{style:oe,children:"Date"}),e.jsx("span",{style:fe,children:b})]})]}),E&&e.jsxs("div",{style:ae,children:[e.jsx("span",{style:ie,children:e.jsx(_.Tag,{size:16,style:le})}),e.jsxs("div",{style:{display:"flex",flex:1},children:[e.jsx("span",{style:oe,children:"Importance"}),e.jsx("span",{style:{...fe,color:N===2?"#dc2626":"#2563eb",fontWeight:500},children:E})]})]}),A&&e.jsxs("div",{style:ae,children:[e.jsx("span",{style:ie,children:e.jsx(_.Tag,{size:16,style:le})}),e.jsxs("div",{style:{display:"flex",flex:1},children:[e.jsx("span",{style:oe,children:"Sensitivity"}),e.jsx("span",{style:fe,children:A})]})]}),M&&M!=="Email"&&e.jsxs("div",{style:ae,children:[e.jsx("span",{style:ie,children:e.jsx(_.Mail,{size:16,style:le})}),e.jsxs("div",{style:{display:"flex",flex:1},children:[e.jsx("span",{style:oe,children:"Type"}),e.jsx("span",{style:fe,children:M})]})]}),k.length>0&&e.jsxs("div",{style:{...ae,borderTop:"1px solid #e5e7eb",marginTop:"4px",paddingTop:"10px"},children:[e.jsx("span",{style:ie,children:e.jsx(_.Paperclip,{size:16,style:le})}),e.jsxs("div",{style:{display:"flex",flex:1},children:[e.jsx("span",{style:oe,children:"Attachments"}),e.jsx("div",{style:{...fe,display:"flex",flexWrap:"wrap",gap:"6px"},children:k.map((Z,G)=>{const j=Z.fileName||Z.name||"未知文件",R=Z.contentLength,C=R?R>1048576?`${(R/1048576).toFixed(1)} MB`:R>1024?`${(R/1024).toFixed(0)} KB`:`${R} B`:"";return e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:"4px",padding:"2px 8px",background:"#f3f4f6",borderRadius:"4px",fontSize:"13px",color:"#374151",border:"1px solid #e5e7eb"},children:[j,C&&e.jsxs("span",{style:{color:"#9ca3af",fontSize:"12px"},children:["(",C,")"]})]},G)})})]})]}),T&&e.jsxs("div",{style:{...ae,borderTop:k.length>0?"none":"1px solid #e5e7eb",marginTop:"4px",paddingTop:"10px"},children:[e.jsx("span",{style:ie,children:e.jsx(_.Hash,{size:16,style:le})}),e.jsxs("div",{style:{display:"flex",flex:1},children:[e.jsx("span",{style:oe,children:"Message-ID"}),e.jsx("span",{style:{...fe,fontSize:"12px",color:"#9ca3af",fontFamily:"monospace"},children:T})]})]}),g&&g!==x&&g!==w&&e.jsxs("div",{style:ae,children:[e.jsx("span",{style:ie,children:e.jsx(_.Clock,{size:16,style:le})}),e.jsxs("div",{style:{display:"flex",flex:1},children:[e.jsx("span",{style:oe,children:"Modified"}),e.jsx("span",{style:{...fe,fontSize:"12px",color:"#9ca3af"},children:g})]})]})]})]}),e.jsx("div",{style:{padding:"clamp(12px, 3vw, 24px) clamp(16px, 3vw, 28px)",fontFamily:"system-ui, -apple-system, sans-serif",lineHeight:"1.6",color:"#333",overflowX:"auto"},dangerouslySetInnerHTML:{__html:S}})]})})},Ds=Object.freeze(Object.defineProperty({__proto__:null,MsgRenderer:$s},Symbol.toStringTag,{value:"Module"}));if(typeof document<"u"&&!document.getElementById("rfp-epub-styles")){const r=document.createElement("style");r.id="rfp-epub-styles",r.textContent=`
|
|
15
|
+
`).replace(/\\h/g," ").replace(/\{[^}]*\}/g,"");i.push({start:y,end:w,text:T,style:v.Style})}return i.sort((l,f)=>l.start-f.start),{format:t,cues:i,header:c.join(`
|
|
16
|
+
`).trim()||void 0}}function He(r){const t=r.trim();if(!t)return 0;const s=/^(\d+(?:\.\d+)?)(h|m|s|ms|f|t)$/i.exec(t);if(s){const o=Number(s[1]),i=s[2].toLowerCase();return i==="h"?o*3600:i==="m"?o*60:i==="ms"?o/1e3:o}const a=t.split(":");return a.length===3?Number(a[0])*3600+Number(a[1])*60+Number(a[2]):a.length===2?Number(a[0])*60+Number(a[1]):Number(t)||0}function yt(r){if(typeof DOMParser>"u")throw new Error("TTML parsing requires a DOMParser environment");const t=new DOMParser().parseFromString(r,"application/xml");if(t.getElementsByTagName("parsererror").length>0)throw new Error("TTML XML parse error");const s=t.getElementsByTagName("p"),a=[];for(let o=0;o<s.length;o++){const i=s[o],c=i.getAttribute("begin")||"",l=i.getAttribute("end")||"",f=i.getAttribute("dur")||"",d=He(c);let u;l?u=He(l):f?u=d+He(f):u=d+5;let p="";i.childNodes.forEach(m=>{if(m.nodeType===3)p+=m.nodeValue||"";else if(m.nodeType===1){const g=m;g.tagName.toLowerCase()==="br"?p+=`
|
|
17
|
+
`:p+=g.textContent||""}});const h=p.replace(/[ \t]+/g," ").replace(/\n /g,`
|
|
18
|
+
`).trim();(h||d||u)&&a.push({start:d,end:u,text:h})}return a.sort((o,i)=>o.start-i.start),{format:"ttml",cues:a}}function wt(r,t){switch(t??xt(r)){case"lrc":return gt(r);case"elrc":return bt(r);case"ass":return dr(r,"ass");case"ssa":return dr(r,"ssa");case"ttml":return yt(r);case"vtt":return cr(r,"vtt");case"srt":default:return cr(r,"srt")}}async function vt(r){return et.loadAsync(r)}function jt(r){const t=[];return r.forEach((s,a)=>{var o;const i=a.dir,c=i&&!s.endsWith("/")?s+"/":s,l=i?c.replace(/\/$/,""):c,f=l.lastIndexOf("/"),d=f>=0?l.slice(f+1):l,u=f>=0?l.slice(0,f):"",p=i?0:((o=a._data)==null?void 0:o.uncompressedSize)??0;t.push({path:c,name:d,dir:u,isDir:i,size:p,date:a.date})}),t}function Nt(r){const t={name:"",path:"",isDir:!0,children:[],size:0},s=new Map;s.set("",t);const a=i=>{if(s.has(i))return s.get(i);const c=i.split("/").filter(Boolean);let l=t,f="";for(const d of c){f=f?`${f}/${d}`:d;let u=s.get(f);u||(u={name:d,path:f+"/",isDir:!0,children:[],size:0},l.children.push(u),s.set(f,u)),l=u}return l};for(const i of r){if(i.isDir){a(i.path.replace(/\/$/,""));continue}a(i.dir).children.push({name:i.name,path:i.path,isDir:!1,size:i.size})}const o=i=>{if(i.children){i.children.sort((c,l)=>c.isDir!==l.isDir?c.isDir?-1:1:c.name.localeCompare(l.name));for(const c of i.children)o(c)}};return o(t),t}async function kt(r,t,s){const a=r.file(t);if(!a)throw new Error(`ZIP entry not found: ${t}`);const o=await a.async("arraybuffer");return new Blob([o],s?{type:s}:void 0)}function St(r){return r?r.startsWith("#")?r:r.length===8?"#"+r.substring(2):r.length===6?"#"+r:"#000000":"#000000"}const _t=["FFFFFF","000000","E7E6E6","44546A","4472C4","ED7D31","A5A5A5","FFC000","5B9BD5","70AD47"],Tt=["000000","FFFFFF","FF0000","00FF00","0000FF","FFFF00","FF00FF","00FFFF","000000","FFFFFF","FF0000","00FF00","0000FF","FFFF00","FF00FF","00FFFF","800000","008000","000080","808000","800080","008080","C0C0C0","808080","9999FF","993366","FFFFCC","CCFFFF","660066","FF8080","0066CC","CCCCFF","000080","FF00FF","FFFF00","00FFFF","800080","800000","008080","0000FF","00CCFF","CCFFFF","CCFFCC","FFFF99","99CCFF","FF99CC","CC99FF","FFCC99","3366FF","33CCCC","99CC00","FFCC00","FF9900","FF6600","666699","969696","003366","339966","003300","333300","993300","993366","333399","333333"];function Rt(r,t){const s=parseInt(r.substring(0,2),16),a=parseInt(r.substring(2,4),16),o=parseInt(r.substring(4,6),16),i=d=>t<0?Math.round(d*(1+t)):Math.round(d+(255-d)*t),c=Math.min(255,Math.max(0,i(s))),l=Math.min(255,Math.max(0,i(a))),f=Math.min(255,Math.max(0,i(o)));return c.toString(16).padStart(2,"0")+l.toString(16).padStart(2,"0")+f.toString(16).padStart(2,"0")}function Ft(r){if(r&&r.type==="pattern"&&r.pattern==="solid"){const t=r.fgColor;if(t)return Ze(t)}}function Ze(r){if(r){if("argb"in r&&typeof r.argb=="string"&&r.argb)return St(r.argb);if("theme"in r&&typeof r.theme=="number"){const t=_t[r.theme]||"000000",s="tint"in r&&typeof r.tint=="number"?r.tint:0;return"#"+(s!==0?Rt(t,s):t)}if("indexed"in r&&typeof r.indexed=="number"){const t=Tt[r.indexed];if(t)return"#"+t}}}function Ct(r){if(!r||!r.style)return;const t=Ze(r.color)||"#000000";return[r.style,t]}function Et(r){const t={};let s=!1;if(r.font){const o=r.font;if((o.name||o.size||o.bold||o.italic)&&(s=!0,t.font={},o.name&&(t.font.name=o.name),o.size&&(t.font.size=o.size),o.bold&&(t.font.bold=!0),o.italic&&(t.font.italic=!0)),o.color){const i=Ze(o.color);i&&(s=!0,t.color=i)}o.underline&&(s=!0,t.underline=!0),o.strike&&(s=!0,t.strike=!0)}const a=Ft(r.fill);if(a&&(s=!0,t.bgcolor=a),r.alignment){const o=r.alignment;o.horizontal&&(s=!0,t.align=o.horizontal),o.vertical&&(s=!0,t.valign=o.vertical),o.wrapText&&(s=!0,t.textwrap=!0)}if(r.border){const o={};let i=!1;const c=["top","bottom","left","right"];for(const l of c){const f=Ct(r.border[l]);f&&(o[l]=f,i=!0)}i&&(s=!0,t.border=o)}return s?t:null}function Mt(r){return JSON.stringify(r)}function Lt(r,t,s){const a=Et(r);if(!a)return-1;const o=Mt(a),i=s.get(o);if(i!==void 0)return i;const c=t.length;return t.push(a),s.set(o,c),c}function Pt(r){const t=r.value;if(t==null)return"";if(typeof t=="string")return t;if(typeof t=="number")return String(t);if(typeof t=="boolean")return t?"TRUE":"FALSE";if(t instanceof Date)return t.toLocaleDateString();if(typeof t=="object"&&"formula"in t){const s=t.result;return s!=null?String(s):""}return typeof t=="object"&&"richText"in t?t.richText.map(s=>s.text).join(""):typeof t=="object"&&"hyperlink"in t?t.text||"":typeof t=="object"&&"error"in t?String(t.error):String(t)}function zt(r){const t=r.split(":"),s=ur(t[0]),a=t[1]?ur(t[1]):s;return{top:s.row,left:s.col,bottom:a.row,right:a.col}}function ur(r){const t=r.match(/^([A-Z]+)(\d+)$/);if(!t)return{row:1,col:1};const s=t[1],a=parseInt(t[2],10);let o=0;for(let i=0;i<s.length;i++)o=o*26+(s.charCodeAt(i)-64);return{row:a,col:o}}function $t(r){const t=[];return r.eachSheet(s=>{const a=[],o=new Map,i=[],c={},l={},f=s.columnCount;for(let h=1;h<=f;h++){const m=s.getColumn(h);m.width&&(l[String(h-1)]={width:Math.round(m.width*7.5)})}l.len=Math.max(f,26);const d=new Map,u=s.model,p=(u==null?void 0:u.merges)||[];for(const h of p){i.push(h);const{top:m,left:g,bottom:x,right:b}=zt(h),v=x-m,y=b-g;d.set(`${m-1},${g-1}`,[v,y])}s.eachRow({includeEmpty:!0},(h,m)=>{const g=m-1,x={};h.eachCell({includeEmpty:!1},(v,y)=>{const w=y-1;if(v.isMerged&&v.master!==v)return;const T=Pt(v),S=Lt(v,a,o),k={text:T};S!==-1&&(k.style=S);const _=`${g},${w}`;d.has(_)&&(k.merge=d.get(_)),x[String(w)]=k});const b={cells:x};h.height&&(b.height=Math.round(h.height*1.333)),c[String(g)]=b}),t.push({name:s.name,styles:a,merges:i,rows:c,cols:l})}),t}function Dt(r,t,s="Sheet1"){const a=r.length>0,o=a?[{font:{bold:!0}}]:[],i={};if(a){const l={};r.forEach((f,d)=>{l[String(d)]={text:f,style:0}}),i[0]={cells:l}}const c=a?1:0;return t.forEach((l,f)=>{const d={};l.forEach((u,p)=>{u!==void 0&&u!==""&&(d[String(p)]={text:u})}),i[String(f+c)]={cells:d}}),[{name:s,styles:o,rows:i}]}function Wt(r,t){var s;if(typeof window>"u")return;const a=(r==null?void 0:r.version)||((s=r==null?void 0:r.GlobalWorkerOptions)==null?void 0:s.version)||"",{workerSrc:o=`https://unpkg.com/pdfjs-dist@${a}/build/pdf.worker.min.mjs`,cMapUrl:i=`https://unpkg.com/pdfjs-dist@${a}/cmaps/`,cMapPacked:c=!0}=t||{};r.GlobalWorkerOptions&&(r.GlobalWorkerOptions.workerSrc=o,r.GlobalWorkerOptions.cMapUrl=i,r.GlobalWorkerOptions.cMapPacked=c)}const Ot={"common.download":"下载","common.close":"关闭","common.loading":"加载中","common.unknown_error":"未知错误","common.unsupported_preview":"不支持预览此文件类型 ({type})","toolbar.zoom_in":"放大","toolbar.zoom_out":"缩小","toolbar.rotate_left":"向左旋转","toolbar.rotate_right":"向右旋转","toolbar.reset":"复原","toolbar.fit_to_window":"适应窗口","toolbar.original_size":"原始尺寸","toolbar.toc":"目录","toolbar.prev_page":"上一页","toolbar.next_page":"下一页","toolbar.full_width":"全屏宽度","toolbar.normal_width":"正常宽度","toolbar.wrap_on":"自动换行","toolbar.wrap_off":"不换行","toolbar.source":"源码","toolbar.preview":"预览","image.load_failed":"图片加载失败","pdf.load_failed":"PDF 文件加载失败","docx.parse_failed":"Word 文档解析失败","xlsx.loading":"加载 Excel 中...","xlsx.load_failed":"Excel 加载失败","xlsx.parse_failed":"Excel 文件解析失败","xlsx.not_found":"Excel 文件不存在","pptx.loading":"加载 PPT 中...","pptx.load_failed":"PPT 加载失败","pptx.parse_failed":"PPT 文件解析失败","pptx.not_found":"PPT 文件不存在","pptx.invalid_format":"PPT 文件格式错误或已损坏","pptx.no_pages":"PPT 文件无有效页面","pptx.timeout":"加载超时,请检查网络或稍后重试","msg.parse_failed":"Outlook 邮件解析失败","msg.parse_failed_short":"邮件解析失败","msg.empty_body":"(无邮件正文)","epub.load_failed":"EPUB 文件加载失败","mobi.load_failed":"电子书加载失败,文件可能已损坏或带有 DRM 保护","video.loading":"加载视频中...","video.load_failed":"视频加载失败","video.load_failed_with_error":"视频加载失败: {error}","audio.aria.play":"播放","audio.aria.pause":"暂停","audio.aria.forward_10":"前进 10 秒","audio.aria.backward_10":"后退 10 秒","audio.aria.mute":"静音","audio.aria.unmute":"取消静音","audio.aria.loop_on":"开启循环","audio.aria.loop_off":"关闭循环","audio.aria.progress":"播放进度","audio.aria.volume":"音量","markdown.load_failed":"Markdown 文件加载失败","markdown.copy_code":"复制代码","markdown.copied":"已复制","json.load_failed":"JSON 文件加载失败","json.items":"items","json.keys":"keys","csv.loading":"加载 CSV 中...","csv.load_failed":"CSV 文件加载失败","csv.parse_failed":"CSV 解析失败","xml.load_failed":"XML 文件加载失败","subtitle.load_failed":"字幕文件加载失败","subtitle.parse_failed":"字幕解析失败","subtitle.lines":"lines","subtitle.cues":"cues","subtitle.meta.title":"标题","subtitle.meta.artist":"艺术家","subtitle.meta.album":"专辑","subtitle.meta.author":"作者","subtitle.meta.by":"制作","subtitle.meta.length":"时长","subtitle.meta.offset":"偏移","subtitle.meta.editor":"编辑器","subtitle.meta.version":"版本","zip.load_failed":"ZIP 文件加载失败","zip.parse_failed":"ZIP 解析失败","text.load_failed":"文本文件加载失败","font.loading":"加载字体中...","font.load_failed":"字体文件加载失败","font.parse_failed":"字体解析失败","font.meta.family":"字体家族","font.meta.subfamily":"子系列","font.meta.version":"版本","font.meta.designer":"设计师","font.meta.glyphs":"字形数量","font.meta.format":"格式","font.sample_text_placeholder":"输入自定义文本..."},It={"common.download":"Download","common.close":"Close","common.loading":"Loading","common.unknown_error":"Unknown error","common.unsupported_preview":"Preview not supported for this file type ({type})","toolbar.zoom_in":"Zoom in","toolbar.zoom_out":"Zoom out","toolbar.rotate_left":"Rotate left","toolbar.rotate_right":"Rotate right","toolbar.reset":"Reset","toolbar.fit_to_window":"Fit to window","toolbar.original_size":"Original size","toolbar.toc":"Table of contents","toolbar.prev_page":"Previous page","toolbar.next_page":"Next page","toolbar.full_width":"Full width","toolbar.normal_width":"Normal width","toolbar.wrap_on":"Word wrap","toolbar.wrap_off":"No wrap","toolbar.source":"Source","toolbar.preview":"Preview","image.load_failed":"Failed to load image","pdf.load_failed":"Failed to load PDF","docx.parse_failed":"Failed to parse Word document","xlsx.loading":"Loading Excel...","xlsx.load_failed":"Failed to load Excel","xlsx.parse_failed":"Failed to parse Excel file","xlsx.not_found":"Excel file not found","pptx.loading":"Loading PPT...","pptx.load_failed":"Failed to load PPT","pptx.parse_failed":"Failed to parse PPT file","pptx.not_found":"PPT file not found","pptx.invalid_format":"PPT file format is invalid or corrupted","pptx.no_pages":"PPT file has no valid pages","pptx.timeout":"Loading timed out, please check your network and retry","msg.parse_failed":"Failed to parse Outlook message","msg.parse_failed_short":"Failed to parse message","msg.empty_body":"(No message body)","epub.load_failed":"Failed to load EPUB","mobi.load_failed":"Failed to load ebook — file may be corrupted or DRM-protected","video.loading":"Loading video...","video.load_failed":"Failed to load video","video.load_failed_with_error":"Failed to load video: {error}","audio.aria.play":"Play","audio.aria.pause":"Pause","audio.aria.forward_10":"Forward 10 seconds","audio.aria.backward_10":"Back 10 seconds","audio.aria.mute":"Mute","audio.aria.unmute":"Unmute","audio.aria.loop_on":"Enable loop","audio.aria.loop_off":"Disable loop","audio.aria.progress":"Playback progress","audio.aria.volume":"Volume","markdown.load_failed":"Failed to load Markdown","markdown.copy_code":"Copy code","markdown.copied":"Copied","json.load_failed":"Failed to load JSON","json.items":"items","json.keys":"keys","csv.loading":"Loading CSV...","csv.load_failed":"Failed to load CSV","csv.parse_failed":"Failed to parse CSV","xml.load_failed":"Failed to load XML","subtitle.load_failed":"Failed to load subtitle","subtitle.parse_failed":"Failed to parse subtitle","subtitle.lines":"lines","subtitle.cues":"cues","subtitle.meta.title":"Title","subtitle.meta.artist":"Artist","subtitle.meta.album":"Album","subtitle.meta.author":"Author","subtitle.meta.by":"By","subtitle.meta.length":"Length","subtitle.meta.offset":"Offset","subtitle.meta.editor":"Editor","subtitle.meta.version":"Version","zip.load_failed":"Failed to load ZIP","zip.parse_failed":"Failed to parse ZIP","text.load_failed":"Failed to load text file","font.loading":"Loading font...","font.load_failed":"Failed to load font","font.parse_failed":"Failed to parse font","font.meta.family":"Family","font.meta.subfamily":"Subfamily","font.meta.version":"Version","font.meta.designer":"Designer","font.meta.glyphs":"Glyphs","font.meta.format":"Format","font.sample_text_placeholder":"Type custom text..."},ze={"zh-CN":Ot,"en-US":It},Ht=/\{(\w+)\}/g;function At(r,t){return t?r.replace(Ht,(s,a)=>{const o=t[a];return o===void 0?`{${a}}`:String(o)}):r}function Je(r){var t;const s=r.fallbackLocale??"zh-CN",a=ze[r.locale]??ze[s]??ze["zh-CN"],o=(t=r.messages)==null?void 0:t[r.locale],i=o?{...a,...o}:a,c=ze["zh-CN"];return(l,f)=>{const d=i[l]??c[l]??l;return At(d,f)}}const Ye=n.createContext(null),kr=({locale:r="zh-CN",messages:t,children:s})=>{const a=n.useMemo(()=>{const o=Je({locale:r,messages:t});return{locale:r,t:o}},[r,t]);return e.jsx(Ye.Provider,{value:a,children:s})};let Ae=null;function Bt(){return Ae||(Ae=Je({locale:"zh-CN"})),Ae}function J(){const r=n.useContext(Ye);return(r==null?void 0:r.t)??Bt()}function qt(){const r=n.useContext(Ye);return(r==null?void 0:r.locale)??"zh-CN"}const Sr=n.createContext(null),Ut=({theme:r,children:t})=>e.jsx(Sr.Provider,{value:r,children:t});function Ke(){return n.useContext(Sr)??"dark"}const Gt=({className:r})=>e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:r,children:e.jsx("text",{x:"12",y:"17.5",textAnchor:"middle",fontSize:"20",fontWeight:"bold",fill:"currentColor",stroke:"none",children:"1:1"})});function Vt(r){return[{items:[{type:"button",icon:e.jsx(E.ZoomOut,{className:"rfp-w-4 rfp-h-4"}),tooltip:r.t("toolbar.zoom_out"),action:r.onZoomOut,disabled:r.zoom<=.01},{type:"text",content:`${Math.round(r.zoom*100)}%`,minWidth:"3rem"},{type:"button",icon:e.jsx(E.ZoomIn,{className:"rfp-w-4 rfp-h-4"}),tooltip:r.t("toolbar.zoom_in"),action:r.onZoomIn,disabled:r.zoom>=10}]},{items:[{type:"button",icon:e.jsx(E.Scan,{className:"rfp-w-4 rfp-h-4"}),tooltip:r.t("toolbar.fit_to_window"),action:r.onFitToWidth},{type:"button",icon:e.jsx(Gt,{className:"rfp-w-4 rfp-h-4"}),tooltip:r.t("toolbar.original_size"),action:r.onOriginalSize}]},{items:[{type:"button",icon:e.jsx(E.RotateCcw,{className:"rfp-w-4 rfp-h-4"}),tooltip:r.t("toolbar.rotate_left"),action:r.onRotateLeft},{type:"button",icon:e.jsx(E.RotateCw,{className:"rfp-w-4 rfp-h-4"}),tooltip:r.t("toolbar.rotate_right"),action:r.onRotateRight}]},{items:[{type:"button",icon:e.jsx(E.RefreshCw,{className:"rfp-w-4 rfp-h-4"}),tooltip:r.t("toolbar.reset"),action:r.onReset}]}]}function Xt(r){return[{items:[{type:"button",icon:e.jsx(E.ZoomOut,{className:"rfp-w-4 rfp-h-4"}),tooltip:r.t("toolbar.zoom_out"),action:r.onZoomOut,disabled:r.zoom<=.01},{type:"text",content:`${Math.round(r.zoom*100)}%`,minWidth:"3rem"},{type:"button",icon:e.jsx(E.ZoomIn,{className:"rfp-w-4 rfp-h-4"}),tooltip:r.t("toolbar.zoom_in"),action:r.onZoomIn,disabled:r.zoom>=10}]},{items:[{type:"button",icon:e.jsx(E.RefreshCw,{className:"rfp-w-4 rfp-h-4"}),tooltip:r.t("toolbar.reset"),action:r.onReset}]}]}function Zt(r){return[{items:[{type:"button",icon:e.jsx(E.List,{className:"rfp-w-4 rfp-h-4"}),tooltip:r.t("toolbar.toc"),action:()=>{var t;return(t=r.epubRef.current)==null?void 0:t.toggleToc()}}]},{items:[{type:"button",icon:e.jsx(E.ChevronLeft,{className:"rfp-w-4 rfp-h-4"}),tooltip:r.t("toolbar.prev_page"),action:()=>{var t;return(t=r.epubRef.current)==null?void 0:t.prevPage()}},{type:"text",content:`${r.current} / ${r.total}`,minWidth:"4rem"},{type:"button",icon:e.jsx(E.ChevronRight,{className:"rfp-w-4 rfp-h-4"}),tooltip:r.t("toolbar.next_page"),action:()=>{var t;return(t=r.epubRef.current)==null?void 0:t.nextPage()}}]},{items:[{type:"button",icon:r.fullWidth?e.jsx(E.Minimize2,{className:"rfp-w-4 rfp-h-4"}):e.jsx(E.Maximize2,{className:"rfp-w-4 rfp-h-4"}),tooltip:r.fullWidth?r.t("toolbar.normal_width"):r.t("toolbar.full_width"),action:()=>{var t;return(t=r.epubRef.current)==null?void 0:t.toggleFullWidth()}}]}]}function Jt(r){return[{items:[{type:"button",icon:e.jsx(E.List,{className:"rfp-w-4 rfp-h-4"}),tooltip:r.t("toolbar.toc"),action:()=>{var t;return(t=r.mobiRef.current)==null?void 0:t.toggleToc()}}]},{items:[{type:"button",icon:e.jsx(E.ChevronLeft,{className:"rfp-w-4 rfp-h-4"}),tooltip:r.t("toolbar.prev_page"),action:()=>{var t;return(t=r.mobiRef.current)==null?void 0:t.prevPage()}},{type:"text",content:`${r.current} / ${r.total}`,minWidth:"4rem"},{type:"button",icon:e.jsx(E.ChevronRight,{className:"rfp-w-4 rfp-h-4"}),tooltip:r.t("toolbar.next_page"),action:()=>{var t;return(t=r.mobiRef.current)==null?void 0:t.nextPage()}}]},{items:[{type:"button",icon:r.fullWidth?e.jsx(E.Minimize2,{className:"rfp-w-4 rfp-h-4"}):e.jsx(E.Maximize2,{className:"rfp-w-4 rfp-h-4"}),tooltip:r.fullWidth?r.t("toolbar.normal_width"):r.t("toolbar.full_width"),action:()=>{var t;return(t=r.mobiRef.current)==null?void 0:t.toggleFullWidth()}}]}]}function Yt({stats:r}){return r?[{items:[{type:"text",content:`${r.files} files · ${r.dirs} dirs · ${jr(r.size)}`,minWidth:"10rem"}]}]:[]}function Kt(r){const t=[{items:[{type:"button",icon:e.jsx(E.WrapText,{className:"rfp-w-4 rfp-h-4"}),tooltip:r.wordWrap?r.t("toolbar.wrap_off"):r.t("toolbar.wrap_on"),action:r.onToggleWrap}]}];return r.isHtml&&t.push({items:[{type:"button",icon:r.htmlPreview?e.jsx(E.Code,{className:"rfp-w-4 rfp-h-4"}):e.jsx(E.Eye,{className:"rfp-w-4 rfp-h-4"}),tooltip:r.htmlPreview?r.t("toolbar.source"):r.t("toolbar.preview"),action:r.onToggleHtmlPreview}]}),t}function Qt(r){return[{items:[{type:"button",icon:r.viewMode==="preview"?e.jsx(E.Code,{className:"rfp-w-4 rfp-h-4"}):e.jsx(E.Eye,{className:"rfp-w-4 rfp-h-4"}),tooltip:r.viewMode==="preview"?r.t("toolbar.source"):r.t("toolbar.preview"),action:r.onToggleViewMode}]}]}const en={fetcher:(r,t)=>fetch(r,t)},Qe=n.createContext(en),rn=({requestInit:r,requestHandler:t,shouldFetchAsBlob:s,children:a})=>{const o=n.useMemo(()=>({fetcher:dt({requestInit:r,requestHandler:t}),shouldFetchAsBlob:s}),[r,t,s]);return e.jsx(Qe.Provider,{value:o,children:a})};function te(){return n.useContext(Qe).fetcher}function tn(r){const{fetcher:t,shouldFetchAsBlob:s}=n.useContext(Qe),a=!!(r&&(s!=null&&s(r))),[o,i]=n.useState(()=>r?a?"":r.url:""),c=n.useRef(null);return n.useEffect(()=>{if(!r){i("");return}if(!a){i(r.url);return}let l=!1;return i(""),ut(r.url,t).then(f=>{if(l){URL.revokeObjectURL(f);return}c.current&&URL.revokeObjectURL(c.current),c.current=f,i(f)}).catch(f=>{l||(console.error("[file-preview] resolve blob url failed:",f),i(r.url))}),()=>{l=!0}},[r==null?void 0:r.id,r==null?void 0:r.url,a,t]),n.useEffect(()=>()=>{c.current&&(URL.revokeObjectURL(c.current),c.current=null)},[]),o}const nn=n.lazy(()=>Promise.resolve().then(()=>Mn).then(r=>({default:r.ImageRenderer}))),sn=n.lazy(()=>Promise.resolve().then(()=>Pn).then(r=>({default:r.PdfRenderer}))),on=n.lazy(()=>Promise.resolve().then(()=>Wn).then(r=>({default:r.DocxRenderer}))),an=n.lazy(()=>Promise.resolve().then(()=>In).then(r=>({default:r.XlsxRenderer}))),ln=n.lazy(()=>Promise.resolve().then(()=>An).then(r=>({default:r.PptxRenderer}))),fn=n.lazy(()=>Promise.resolve().then(()=>Gn).then(r=>({default:r.MsgRenderer}))),cn=n.lazy(()=>Promise.resolve().then(()=>Zn).then(r=>({default:r.EpubRenderer}))),pn=n.lazy(()=>Promise.resolve().then(()=>Kn).then(r=>({default:r.MobiRenderer}))),dn=n.lazy(()=>Promise.resolve().then(()=>rs).then(r=>({default:r.VideoRenderer}))),un=n.lazy(()=>Promise.resolve().then(()=>as).then(r=>({default:r.AudioRenderer}))),mn=n.lazy(()=>Promise.resolve().then(()=>ps).then(r=>({default:r.MarkdownRenderer}))),hn=n.lazy(()=>Promise.resolve().then(()=>gs).then(r=>({default:r.JsonRenderer}))),xn=n.lazy(()=>Promise.resolve().then(()=>ys).then(r=>({default:r.CsvRenderer}))),gn=n.lazy(()=>Promise.resolve().then(()=>Ns).then(r=>({default:r.XmlRenderer}))),bn=n.lazy(()=>Promise.resolve().then(()=>Ts).then(r=>({default:r.SubtitleRenderer}))),yn=n.lazy(()=>Promise.resolve().then(()=>Ms).then(r=>({default:r.ZipRenderer}))),wn=n.lazy(()=>Promise.resolve().then(()=>Ps).then(r=>({default:r.TextRenderer}))),vn=n.lazy(()=>Promise.resolve().then(()=>Ds).then(r=>({default:r.FontRenderer}))),mr=({fileName:r,fileType:t,onDownload:s})=>{const a=J();return e.jsxs("div",{className:"rfp-flex rfp-flex-col rfp-items-center rfp-justify-center rfp-w-full rfp-h-full rfp-p-8 rfp-gap-6",children:[e.jsx("div",{className:"rfp-w-32 rfp-h-32 rfp-rounded-full rfp-bg-surface-2 rfp-flex rfp-items-center rfp-justify-center",children:e.jsx(E.FileQuestion,{className:"rfp-w-16 rfp-h-16 rfp-text-fg-secondary"})}),e.jsxs("div",{className:"rfp-text-fg-primary rfp-text-center",children:[e.jsx("p",{className:"rfp-text-xl rfp-font-medium rfp-mb-2",children:r}),e.jsx("p",{className:"rfp-text-fg-secondary",children:a("common.unsupported_preview",{type:t})})]}),e.jsxs("button",{onClick:s,className:"rfp-flex rfp-items-center rfp-gap-2 rfp-px-6 rfp-py-3 rfp-bg-surface-2 hover:rfp-bg-surface-3 rfp-backdrop-blur-sm rfp-rounded-lg rfp-text-fg-primary rfp-font-medium rfp-transition-all",children:[e.jsx(E.Download,{className:"rfp-w-5 rfp-h-5"}),a("common.download")]})]})},jn=()=>{const r=J();return e.jsx("div",{className:"rfp-flex rfp-items-center rfp-justify-center rfp-w-full rfp-h-full rfp-text-fg-muted",children:e.jsxs("div",{className:"rfp-flex rfp-flex-col rfp-items-center rfp-gap-3",children:[e.jsx("div",{className:"rfp-w-8 rfp-h-8 rfp-rounded-full rfp-border-2 rfp-border-fg-muted rfp-border-t-transparent rfp-animate-spin"}),e.jsx("span",{className:"rfp-text-sm",children:r("common.loading")??"Loading..."})]})})},Nn=3,De=r=>{const{requestInit:t,requestHandler:s,shouldFetchAsBlob:a}=r;return e.jsx(rn,{requestInit:t,requestHandler:s,shouldFetchAsBlob:a,children:e.jsx(kn,{...r})})},kn=({files:r,currentIndex:t,onNavigate:s,customRenderers:a=[],mode:o="modal",onClose:i,zipNestingDepth:c=0,locale:l="zh-CN",messages:f,headless:d=!1,theme:u="dark",onCustomEvent:p,onDownload:h,requestInit:m,requestHandler:g,shouldFetchAsBlob:x})=>{const b=n.useMemo(()=>Je({locale:l,messages:f}),[l,f]),[v,y]=n.useState(()=>typeof window<"u"?window.matchMedia("(prefers-color-scheme: dark)").matches:!0);n.useEffect(()=>{if(u!=="auto")return;const z=window.matchMedia("(prefers-color-scheme: dark)"),V=de=>y(de.matches);return z.addEventListener("change",V),()=>z.removeEventListener("change",V)},[u]);const w=u==="auto"?v?"dark":"light":u,[T,S]=n.useState(1),[k,_]=n.useState(0),[R,j]=n.useState(1),[,L]=n.useState(1),[M,O]=n.useState(0),[W,H]=n.useState(0),[I,N]=n.useState(0),F=n.useRef(null),C=n.useRef(null),U=n.useRef(null),[B,G]=n.useState(0),[P,$]=n.useState(0),[D,Y]=n.useState(!1),X=n.useRef(null),[ne,K]=n.useState(0),[ge,Q]=n.useState(0),[me,Z]=n.useState(!1),[se,ce]=n.useState(null),[he,ve]=n.useState(!0),[je,Se]=n.useState(!1),[ye,be]=n.useState("preview"),[xe,Ne]=n.useState(!0),pe=n.useRef(null),_e=2e3,Ee=n.useCallback(()=>{Ne(!0),pe.current&&clearTimeout(pe.current),pe.current=window.setTimeout(()=>{Ne(!1)},_e)},[]),Er=n.useCallback(()=>{Ee()},[Ee]),we=n.useMemo(()=>wr(r),[r]),A=we[t],ee=tn(A),Te=n.useMemo(()=>A?a.find(z=>z.test(A)):null,[A,a]),q=A?vr(A):"unsupported",er=n.useCallback((z,V)=>{A&&(p==null||p({name:z,payload:V,file:A}))},[A,p]),rr=n.useMemo(()=>({emit:er,t:b,theme:w,locale:l}),[er,b,w,l]);n.useEffect(()=>{S(1),_(0),j(1),L(1),O(0),H(0),Ne(!0),pe.current&&clearTimeout(pe.current)},[t]),n.useEffect(()=>{if(q==="image"&&M>0&&W>0&&F.current){const z=F.current.clientWidth,V=F.current.clientHeight,de=z/M,ue=V/W,Fe=Math.min(de,ue);S(Math.max(.01,Math.min(10,Fe)))}},[q,M,W]),n.useEffect(()=>(we.length>1&&Ee(),()=>{pe.current&&clearTimeout(pe.current)}),[we.length,Ee]),n.useEffect(()=>{const z=V=>{V.key==="Escape"&&o==="modal"?i==null||i():V.key==="ArrowLeft"&&t>0?s==null||s(t-1):V.key==="ArrowRight"&&t<we.length-1&&(s==null||s(t+1))};if(o==="modal")return window.addEventListener("keydown",z),()=>window.removeEventListener("keydown",z);{const V=C.current;return V?(V.addEventListener("keydown",z),()=>V.removeEventListener("keydown",z)):void 0}},[o,t,we.length,i,s]);const tr=n.useCallback(()=>{S(z=>Math.min(z+.1,10))},[]),nr=n.useCallback(()=>{S(z=>Math.max(z-.1,.01))},[]),Mr=n.useCallback(()=>{_(z=>z+90)},[]),Lr=n.useCallback(()=>{_(z=>z-90)},[]),Pr=n.useCallback(()=>{if(F.current&&M>0&&W>0){const z=F.current.clientWidth,V=F.current.clientHeight,de=z/M,ue=V/W,Fe=Math.min(de,ue);S(Math.max(.01,Math.min(10,Fe)))}else S(1);_(0),N(z=>z+1)},[M,W]),zr=n.useCallback(()=>{S(1),_(0),N(z=>z+1)},[]),$r=n.useCallback(z=>{S(z)},[]),sr=n.useCallback(()=>{S(1),_(0),N(z=>z+1)},[]),or=te(),Oe=n.useCallback(async()=>{if(A){if(h){await h(A);return}try{await mt(A.url,A.name,or)}catch(z){console.error("[file-preview] download failed:",z)}}},[A,h,or]),Dr=n.useCallback((z,V)=>{G(z),$(V)},[]),Wr=n.useCallback((z,V)=>{K(z),Q(V)},[]),Or=n.useCallback(z=>{ce(z)},[]);if(!A)return null;const Ir=o==="modal"&&!!i,Me=(()=>{var z,V;if(Te)return((z=Te.getToolbarGroups)==null?void 0:z.call(Te,A,rr))??[];if(q==="image")return Vt({zoom:T,onZoomIn:tr,onZoomOut:nr,onFitToWidth:Pr,onOriginalSize:zr,onRotateLeft:Lr,onRotateRight:Mr,onReset:sr,t:b});if(q==="pdf")return Xt({zoom:T,onZoomIn:tr,onZoomOut:nr,onReset:sr,t:b});if(q==="epub")return Zt({epubRef:U,current:B,total:P,fullWidth:D,t:b});if(q==="mobi")return Jt({mobiRef:X,current:ne,total:ge,fullWidth:me,t:b});if(q==="zip")return Yt({stats:se});if(q==="text"){const de=((V=A.name.split(".").pop())==null?void 0:V.toLowerCase())||"";return Kt({wordWrap:he,onToggleWrap:()=>ve(ue=>!ue),isHtml:de==="html"||de==="htm",htmlPreview:je,onToggleHtmlPreview:()=>Se(ue=>!ue),t:b})}return q==="markdown"?Qt({viewMode:ye,onToggleViewMode:()=>be(de=>de==="preview"?"source":"preview"),t:b}):[]})(),ar=[{items:[{type:"button",icon:e.jsx(E.Download,{className:"rfp-w-4 rfp-h-4"}),tooltip:b("common.download"),action:Oe}]},...Ir?[{items:[{type:"button",icon:e.jsx(E.X,{className:"rfp-w-4 rfp-h-4"}),tooltip:b("common.close"),action:i}]}]:[]],Le=(z,V)=>z.map((de,ue,Fe)=>e.jsxs(n.Fragment,{children:[de.items.map((ke,ir)=>ke.type==="button"?e.jsx(Sn,{icon:ke.icon,label:ke.tooltip,onClick:ke.action,disabled:ke.disabled},`${ue}-${ir}`):e.jsx("span",{className:"rfp-text-xs rfp-text-center rfp-font-medium rfp-tabular-nums rfp-text-fg-tertiary",style:{minWidth:ke.minWidth||"auto"},children:ke.content},`${ue}-${ir}`)),ue<Fe.length-1&&e.jsx("div",{className:`rfp-w-px rfp-h-4 rfp-bg-divide ${V}`})]},ue));return e.jsx(kr,{locale:l,messages:f,children:e.jsx(Ut,{theme:w,children:e.jsxs("div",{ref:C,tabIndex:o==="embed"?0:-1,"data-theme":w,className:"rfp-relative rfp-w-full rfp-h-full rfp-flex rfp-flex-col rfp-overflow-hidden rfp-outline-none",children:[!d&&e.jsxs(re.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"rfp-flex-shrink-0 rfp-z-10 rfp-backdrop-blur-md rfp-border-b rfp-bg-surface-toolbar rfp-border-line",style:{paddingTop:"env(safe-area-inset-top, 0px)"},children:[e.jsxs("div",{className:"rfp-flex rfp-items-center rfp-justify-between rfp-px-3 md:rfp-px-5 rfp-py-1.5 md:rfp-py-2.5",children:[e.jsxs("div",{className:"rfp-flex rfp-items-center rfp-flex-1 rfp-min-w-0 rfp-mr-2 md:rfp-mr-3",children:[e.jsx("h2",{className:"rfp-font-medium rfp-text-xs md:rfp-text-sm rfp-truncate rfp-text-fg-primary",children:A.name}),e.jsxs("span",{className:"rfp-text-xs rfp-ml-2 rfp-flex-shrink-0 rfp-text-fg-muted",children:[t+1,"/",we.length]})]}),e.jsx("div",{className:"rfp-flex rfp-items-center rfp-gap-1 md:rfp-hidden rfp-flex-shrink-0",children:Le(ar,"rfp-mx-0.5")}),e.jsxs("div",{className:"rfp-hidden md:rfp-flex rfp-items-center rfp-gap-1 rfp-flex-shrink-0",children:[Le(Me,"rfp-mx-1"),Me.length>0&&e.jsx("div",{className:"rfp-w-px rfp-h-4 rfp-mx-1 rfp-bg-divide"}),Le(ar,"rfp-mx-1")]})]}),Me.length>0&&e.jsx("div",{className:"rfp-flex rfp-items-center rfp-gap-1 rfp-px-3 rfp-pb-1.5 rfp-overflow-x-auto scrollbar-hide md:rfp-hidden",children:Le(Me,"rfp-mx-0.5")})]}),e.jsx("div",{ref:F,className:"rfp-flex-1 rfp-flex rfp-items-center rfp-justify-center rfp-overflow-auto",onMouseMove:Er,children:Te?Te.render(A,rr):e.jsxs(n.Suspense,{fallback:e.jsx(jn,{}),children:[q==="image"&&e.jsx(nn,{url:ee,zoom:T,rotation:k,resetKey:I,fileSize:A.size,onZoomChange:$r,onNaturalWidthChange:O,onNaturalHeightChange:H}),q==="pdf"&&e.jsx(sn,{url:ee,zoom:T,currentPage:R,onPageChange:j,onTotalPagesChange:L,onPageWidthChange:O}),q==="docx"&&e.jsx(on,{url:ee}),q==="xlsx"&&e.jsx(an,{url:ee}),q==="pptx"&&e.jsx(ln,{url:ee}),q==="msg"&&e.jsx(fn,{url:ee}),q==="epub"&&e.jsx(cn,{ref:U,url:ee,onChapterChange:Dr,onFullWidthChange:Y}),q==="mobi"&&e.jsx(pn,{ref:X,url:ee,onChapterChange:Wr,onFullWidthChange:Z}),q==="video"&&e.jsx(dn,{url:ee}),q==="audio"&&e.jsx(un,{url:ee,fileName:A.name}),q==="markdown"&&e.jsx(mn,{url:ee,viewMode:ye}),q==="json"&&e.jsx(hn,{url:ee,fileName:A.name}),q==="csv"&&e.jsx(xn,{url:ee,fileName:A.name}),q==="xml"&&e.jsx(gn,{url:ee,fileName:A.name}),q==="subtitle"&&e.jsx(bn,{url:ee,fileName:A.name}),q==="zip"&&(c>=Nn?e.jsx(mr,{fileName:A.name,fileType:A.type,onDownload:Oe}):e.jsx(yn,{url:ee,onStatsChange:Or,nestingDepth:c})),q==="text"&&e.jsx(wn,{url:ee,fileName:A.name,wordWrap:he,htmlPreview:je}),q==="font"&&e.jsx(vn,{url:ee}),q==="unsupported"&&e.jsx(mr,{fileName:A.name,fileType:A.type,onDownload:Oe})]})}),!d&&we.length>1&&e.jsxs(e.Fragment,{children:[t>0&&e.jsx(re.motion.button,{initial:{opacity:0},animate:{opacity:xe?1:0,x:xe?0:-20},transition:{duration:.2},onClick:()=>s==null?void 0:s(t-1),onMouseEnter:()=>Ne(!0),style:{pointerEvents:xe?"auto":"none"},className:"rfp-absolute rfp-z-20 rfp-left-2 md:rfp-left-4 rfp-top-1/2 -rfp-translate-y-1/2 rfp-w-10 rfp-h-10 md:rfp-w-12 md:rfp-h-12 rfp-rounded-full rfp-backdrop-blur-xl rfp-border rfp-flex rfp-items-center rfp-justify-center rfp-transition-colors rfp-shadow-2xl rfp-bg-surface-nav rfp-border-line hover:rfp-bg-surface-nav-hover rfp-text-fg-primary",children:e.jsx(E.ChevronLeft,{className:"rfp-w-5 rfp-h-5 md:rfp-w-6 md:rfp-h-6"})}),t<we.length-1&&e.jsx(re.motion.button,{initial:{opacity:0},animate:{opacity:xe?1:0,x:xe?0:20},transition:{duration:.2},onClick:()=>s==null?void 0:s(t+1),onMouseEnter:()=>Ne(!0),style:{pointerEvents:xe?"auto":"none"},className:"rfp-absolute rfp-z-20 rfp-right-2 md:rfp-right-4 rfp-top-1/2 -rfp-translate-y-1/2 rfp-w-10 rfp-h-10 md:rfp-w-12 md:rfp-h-12 rfp-rounded-full rfp-backdrop-blur-xl rfp-border rfp-flex rfp-items-center rfp-justify-center rfp-transition-colors rfp-shadow-2xl rfp-bg-surface-nav rfp-border-line hover:rfp-bg-surface-nav-hover rfp-text-fg-primary",children:e.jsx(E.ChevronRight,{className:"rfp-w-5 rfp-h-5 md:rfp-w-6 md:rfp-h-6"})})]})]})})})},Sn=({icon:r,label:t,onClick:s,disabled:a})=>e.jsxs("button",{onClick:s,disabled:a,className:`rfp-relative rfp-group rfp-p-2 md:rfp-p-1.5 rfp-rounded-md rfp-transition-all rfp-select-none ${a?"rfp-text-fg-disabled rfp-cursor-not-allowed":"rfp-text-fg-primary hover:rfp-bg-surface-2 active:rfp-bg-surface-3"}`,children:[r,e.jsxs("span",{className:"rfp-absolute rfp-left-1/2 -rfp-translate-x-1/2 rfp-top-full rfp-mt-1.5 rfp-px-2 rfp-py-1 rfp-text-xs rfp-rounded rfp-whitespace-nowrap rfp-pointer-events-none rfp-opacity-0 rfp-invisible group-hover:rfp-opacity-100 group-hover:rfp-visible rfp-transition-opacity rfp-duration-200 rfp-z-50 rfp-bg-fg-primary rfp-text-fg-inverse",children:[e.jsx("span",{className:"rfp-absolute rfp-left-1/2 -rfp-translate-x-1/2 -rfp-top-1 rfp-w-2 rfp-h-2 rfp-rotate-45 rfp-bg-fg-primary"}),e.jsx("span",{className:"rfp-relative",children:t})]})]}),_n=Object.freeze(Object.defineProperty({__proto__:null,FilePreviewContent:De},Symbol.toStringTag,{value:"Module"})),Tn=({files:r,currentIndex:t,isOpen:s,onClose:a,onNavigate:o,customRenderers:i=[],locale:c,messages:l,headless:f,theme:d="dark",onCustomEvent:u,requestInit:p,requestHandler:h,shouldFetchAsBlob:m,onDownload:g})=>{const[x,b]=n.useState(()=>typeof window<"u"?window.matchMedia("(prefers-color-scheme: dark)").matches:!0);n.useEffect(()=>{if(d!=="auto")return;const w=window.matchMedia("(prefers-color-scheme: dark)"),T=S=>b(S.matches);return w.addEventListener("change",T),()=>w.removeEventListener("change",T)},[d]);const v=d==="auto"?x?"dark":"light":d;if(n.useEffect(()=>{if(s){const w=document.body.style.overflow,T=document.body.style.paddingRight,S=window.innerWidth-document.documentElement.clientWidth;return document.body.style.overflow="hidden",S>0&&(document.body.style.paddingRight=`${S}px`),()=>{document.body.style.overflow=w,document.body.style.paddingRight=T}}},[s]),!s)return null;const y=e.jsx("div",{className:"rfp-root","data-theme":v,children:e.jsx(re.AnimatePresence,{children:s&&e.jsx(re.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"rfp-fixed rfp-inset-0 rfp-z-[9999] rfp-flex rfp-items-center rfp-justify-center rfp-backdrop-blur-md rfp-overflow-hidden rfp-bg-surface-overlay",onClick:a,onWheel:w=>w.stopPropagation(),children:e.jsx("div",{className:"rfp-relative rfp-w-full rfp-h-full",onClick:w=>w.stopPropagation(),children:e.jsx(De,{mode:"modal",files:r,currentIndex:t,onClose:a,onNavigate:o,customRenderers:i,locale:c,messages:l,headless:f,theme:d,onCustomEvent:u,requestInit:p,requestHandler:h,shouldFetchAsBlob:m,onDownload:g})})})})});return gr.createPortal(y,document.body)},Rn=({files:r,currentIndex:t=0,onNavigate:s,customRenderers:a=[],width:o="100%",height:i="100%",className:c,style:l,locale:f,messages:d,headless:u,theme:p="dark",onCustomEvent:h,requestInit:m,requestHandler:g,shouldFetchAsBlob:x,onDownload:b})=>{const[v,y]=n.useState(()=>typeof window<"u"?window.matchMedia("(prefers-color-scheme: dark)").matches:!0);n.useEffect(()=>{if(p!=="auto")return;const T=window.matchMedia("(prefers-color-scheme: dark)"),S=k=>y(k.matches);return T.addEventListener("change",S),()=>T.removeEventListener("change",S)},[p]);const w=p==="auto"?v?"dark":"light":p;return e.jsx("div",{className:`rfp-root ${c??""}`,style:{width:o,height:i,...l},"data-theme":w,children:e.jsx("div",{className:"rfp-relative rfp-w-full rfp-h-full rfp-overflow-hidden rfp-bg-surface-overlay",children:e.jsx(De,{mode:"embed",files:r,currentIndex:t,onNavigate:s,customRenderers:a,locale:f,messages:d,headless:u,theme:p,onCustomEvent:h,requestInit:m,requestHandler:g,shouldFetchAsBlob:x,onDownload:b})})})};function Fn(r){Wt(Xe,r)}const Cn=nt.version,En=({url:r,zoom:t,rotation:s,resetKey:a,fileSize:o,onZoomChange:i,onNaturalWidthChange:c,onNaturalHeightChange:l})=>{const f=J(),[d,u]=n.useState(!1),[p,h]=n.useState(null),[m,g]=n.useState({x:0,y:0}),[x,b]=n.useState(!1),[v,y]=n.useState({x:0,y:0}),[w,T]=n.useState(1),[S,k]=n.useState({width:0,height:0}),_=n.useRef(null),R=n.useRef(null);n.useEffect(()=>{u(!1),h(null),g({x:0,y:0}),T(1)},[r]),n.useEffect(()=>{T(t)},[t]),n.useEffect(()=>{a!==void 0&&g({x:0,y:0})},[a]);const j=N=>{u(!0);const F=N.currentTarget;k({width:F.naturalWidth,height:F.naturalHeight}),c==null||c(F.naturalWidth),l==null||l(F.naturalHeight)},L=n.useCallback((N,F)=>{const C=R.current;if(!C||S.width===0)return N;const U=C.clientWidth,B=C.clientHeight,G=S.width*F,P=S.height*F,$=Math.min(80,U*.15,B*.15),D=(U+G)/2-$,Y=(B+P)/2-$;return{x:D>0?Math.max(-D,Math.min(D,N.x)):0,y:Y>0?Math.max(-Y,Math.min(Y,N.y)):0}},[S]),M=()=>{h(f("image.load_failed")),u(!0)},O=()=>{g({x:0,y:0}),T(1),i==null||i(1)};n.useEffect(()=>{const N=R.current;if(!N)return;const F=C=>{C.preventDefault(),C.stopPropagation();const U=N.getBoundingClientRect(),B=C.clientX-U.left-U.width/2,G=C.clientY-U.top-U.height/2,P=C.deltaY>0?-.05:.05;T($=>{const D=Math.max(.01,Math.min(10,$+P)),Y=D/$;return g(X=>L({x:B-Y*(B-X.x),y:G-Y*(G-X.y)},D)),i==null||i(D),D})};return N.addEventListener("wheel",F,{passive:!1}),()=>N.removeEventListener("wheel",F)},[i,L]);const W=n.useCallback(N=>{N.button===0&&(b(!0),y({x:N.clientX-m.x,y:N.clientY-m.y}))},[m]),H=n.useCallback(N=>{x&&g(L({x:N.clientX-v.x,y:N.clientY-v.y},w))},[x,v,w,L]),I=n.useCallback(()=>{b(!1)},[]);return e.jsxs("div",{ref:R,className:"rfp-relative rfp-flex rfp-items-center rfp-justify-center rfp-w-full rfp-h-full rfp-overflow-hidden",onMouseDown:W,onMouseMove:H,onMouseUp:I,onMouseLeave:I,style:{cursor:x?"grabbing":"grab"},children:[!d&&!p&&e.jsx("div",{className:"rfp-flex rfp-items-center rfp-justify-center",children:e.jsx("div",{className:"rfp-w-12 rfp-h-12 rfp-border-4 rfp-border-line-strong rfp-border-t-spinner-head rfp-rounded-full rfp-animate-spin"})}),p&&e.jsx("div",{className:"rfp-text-fg-secondary rfp-text-center",children:e.jsx("p",{className:"rfp-text-lg",children:p})}),e.jsx(re.motion.img,{ref:_,src:r,alt:"Preview",className:`rfp-max-w-none rfp-select-none ${d?"":"rfp-hidden"}`,style:{transform:`translate(${m.x}px, ${m.y}px) scale(${w}) rotate(${s}deg)`,transformOrigin:"center",transition:x?"none":"transform 0.3s ease-out"},onLoad:j,onError:M,onDoubleClick:O,initial:{opacity:0},animate:{opacity:d?1:0},transition:{duration:.3},draggable:!1}),d&&!p&&S.width>0&&e.jsxs("div",{className:"rfp-absolute rfp-bottom-2 rfp-right-3 rfp-text-[10px] rfp-text-fg-disabled hover:rfp-text-fg-secondary rfp-transition-colors rfp-pointer-events-auto rfp-select-none rfp-cursor-default",children:[S.width," × ",S.height,o!=null&&` · ${o<1024?`${o} B`:o<1024*1024?`${(o/1024).toFixed(1)} KB`:`${(o/(1024*1024)).toFixed(1)} MB`}`]})]})},Mn=Object.freeze(Object.defineProperty({__proto__:null,ImageRenderer:En},Symbol.toStringTag,{value:"Module"})),Ln=({url:r,zoom:t,currentPage:s,onPageChange:a,onTotalPagesChange:o,onPageWidthChange:i})=>{const c=J(),[l,f]=n.useState(0),[d,u]=n.useState(null),[p,h]=n.useState(!0),m=n.useRef(null),g=n.useRef(null),x=n.useRef(new Map),b=n.useRef(null),v=n.useCallback(async(k,_)=>{if(!g.current)return;const R=x.current.get(k);if(!(!R||R.rendering)){R.rendering=!0;try{const j=await g.current.getPage(k),L=j.getViewport({scale:_}),M=document.createElement("canvas");M.width=L.width,M.height=L.height,M.style.maxWidth="100%",M.style.height="auto",M.style.borderRadius="0",M.style.display="block";const O=M.getContext("2d");if(!O)return;const W=j.render({canvasContext:O,viewport:L});if(R.renderTask=W,await W.promise,k===1&&i){const I=j.getViewport({scale:1});i(I.width)}R.element.innerHTML="",R.element.appendChild(M);const H=document.createElement("div");H.textContent=String(k),H.className="rfp-absolute rfp-top-2 rfp-right-2 rfp-bg-surface-nav-hover rfp-backdrop-blur-sm rfp-text-fg-primary rfp-text-xs rfp-px-3 rfp-py-1 rfp-rounded-full",R.element.appendChild(H),R.rendered=!0}catch(j){(j==null?void 0:j.name)!=="RenderingCancelledException"&&console.error(`渲染页面 ${k} 失败:`,j)}finally{R.rendering=!1,R.renderTask=null}}},[i]),y=n.useCallback(k=>{const _=x.current.get(k);if(!_)return;_.renderTask&&(_.renderTask.cancel(),_.renderTask=null);const R=_.element.querySelector("canvas");if(R){const j=R.getContext("2d");j&&j.clearRect(0,0,R.width,R.height),R.remove()}_.element.innerHTML="",_.rendered=!1,_.rendering=!1},[]),w=n.useCallback(()=>{if(!g.current||!m.current)return;const k=m.current.querySelector(".pdf-pages");if(k){k.innerHTML="",x.current.clear();for(let _=1;_<=l;_++){const R=document.createElement("div");R.className="rfp-relative rfp-flex rfp-justify-center rfp-min-h-[800px]",R.setAttribute("data-page-number",String(_)),k.appendChild(R),x.current.set(_,{element:R,rendered:!1,rendering:!1,renderTask:null}),b.current&&b.current.observe(R)}}},[l]),T=n.useCallback(async()=>{if(u(null),h(!0),f(0),g.current){try{g.current.destroy()}catch{}g.current=null}try{const k=Xe.getDocument({url:r});g.current=await k.promise;const _=g.current.numPages;f(_),o(_),a(1),h(!1)}catch(k){console.error("PDF 加载错误:",k),u(c("pdf.load_failed")),h(!1)}},[r,o,a,c]),S=n.useCallback(()=>{if(!m.current||x.current.size===0)return;const k=m.current,_=k.scrollTop,R=k.clientHeight,j=_+R/2;let L=1,M=1/0;x.current.forEach((O,W)=>{const H=O.element.getBoundingClientRect(),I=k.getBoundingClientRect(),N=H.top-I.top+H.height/2+_,F=Math.abs(N-j);F<M&&(M=F,L=W)}),L!==s&&a(L)},[s,a]);return n.useEffect(()=>(b.current=new IntersectionObserver(k=>{k.forEach(_=>{const R=Number(_.target.getAttribute("data-page-number"));if(R)if(_.isIntersecting)v(R,t);else{const j=x.current.get(R);j&&j.rendered&&y(R)}})},{root:m.current,rootMargin:"500px 0px",threshold:0}),()=>{b.current&&(b.current.disconnect(),b.current=null)}),[t,v,y]),n.useEffect(()=>{T()},[T]),n.useEffect(()=>{l>0&&setTimeout(()=>{w()},0)},[l,w]),n.useEffect(()=>{const k=setTimeout(()=>{x.current.forEach((_,R)=>{_.rendered&&y(R)}),b.current&&m.current&&x.current.forEach(_=>{var R,j;(R=b.current)==null||R.unobserve(_.element),(j=b.current)==null||j.observe(_.element)})},150);return()=>clearTimeout(k)},[t,y]),n.useEffect(()=>{const k=m.current;if(k)return k.addEventListener("scroll",S),()=>k.removeEventListener("scroll",S)},[S]),n.useEffect(()=>()=>{if(x.current.forEach(k=>{k.renderTask&&k.renderTask.cancel()}),x.current.clear(),g.current){try{g.current.destroy()}catch{}g.current=null}},[]),e.jsxs("div",{ref:m,className:"rfp-flex rfp-flex-col rfp-items-center rfp-w-full rfp-h-full rfp-overflow-auto rfp-py-4 md:rfp-py-8 rfp-px-2 md:rfp-px-4",children:[d&&e.jsx("div",{className:"rfp-text-fg-secondary rfp-text-center",children:e.jsx("p",{className:"rfp-text-lg",children:d})}),!d&&p&&e.jsx("div",{className:"rfp-flex rfp-items-center rfp-justify-center rfp-min-h-screen",children:e.jsx("div",{className:"rfp-w-12 rfp-h-12 rfp-border-4 rfp-border-line-strong rfp-border-t-spinner-head rfp-rounded-full rfp-animate-spin"})}),!d&&!p&&e.jsx("div",{className:"pdf-pages rfp-flex rfp-flex-col rfp-gap-4"}),l>0&&e.jsxs("div",{className:"rfp-sticky rfp-bottom-2 md:rfp-bottom-4 rfp-mt-4 md:rfp-mt-8 rfp-bg-surface-nav-hover rfp-backdrop-blur-xl rfp-text-fg-primary rfp-px-4 rfp-py-2 md:rfp-px-6 md:rfp-py-3 rfp-rounded-full rfp-text-xs md:rfp-text-sm rfp-font-medium rfp-shadow-2xl rfp-border rfp-border-line-weak",children:["第 ",s," 页 / 共 ",l," 页"]})]})},Pn=Object.freeze(Object.defineProperty({__proto__:null,PdfRenderer:Ln},Symbol.toStringTag,{value:"Module"})),_r=1123,Tr=60,hr=50,zn=_r-Tr*2,$n=24,xr={fontFamily:"system-ui, -apple-system, sans-serif",lineHeight:"1.8",color:"#333"},Dn=({url:r})=>{const t=J(),s=te(),[a,o]=n.useState(""),[i,c]=n.useState(!0),[l,f]=n.useState(null),[d,u]=n.useState([]),p=n.useRef(null);n.useEffect(()=>{(async()=>{c(!0),f(null),o("");try{const g=await s(r);if(!g.ok)throw new Error("文件加载失败");const x=await g.arrayBuffer(),b=await Ar.convertToHtml({arrayBuffer:x});o(b.value)}catch(g){console.error("Docx 解析错误:",g),f(t("docx.parse_failed"))}finally{c(!1)}})()},[r,s,t]);const h=n.useCallback(()=>{const m=p.current;if(!m||!a)return;const g=Array.from(m.children);if(g.length===0){u([a]);return}const x=[[]];let b=0;for(const v of g){const y=v.offsetHeight;b>0&&b+y>zn&&(x.push([]),b=0),x[x.length-1].push(v.outerHTML),b+=y}x.length===0&&x.push([]),u(x.map(v=>v.join("")))},[a]);return n.useEffect(()=>{!a||!p.current||requestAnimationFrame(()=>{h()})},[a,h]),i?e.jsx("div",{className:"rfp-flex rfp-items-center rfp-justify-center rfp-w-full rfp-h-full",children:e.jsx("div",{className:"rfp-w-12 rfp-h-12 rfp-border-4 rfp-border-line-strong rfp-border-t-spinner-head rfp-rounded-full rfp-animate-spin"})}):l?e.jsx("div",{className:"rfp-flex rfp-items-center rfp-justify-center rfp-w-full rfp-h-full",children:e.jsx("div",{className:"rfp-text-fg-secondary rfp-text-center",children:e.jsx("p",{className:"rfp-text-lg",children:l})})}):e.jsxs("div",{className:"rfp-w-full rfp-h-full rfp-overflow-auto",style:{background:"rgba(0, 0, 0, 0.15)"},children:[e.jsx("div",{ref:p,dangerouslySetInnerHTML:{__html:a},style:{...xr,position:"absolute",visibility:"hidden",width:`${794-hr*2}px`,pointerEvents:"none"}}),e.jsx("div",{className:"rfp-py-6 md:rfp-py-10 rfp-flex rfp-flex-col rfp-items-center",style:{gap:`${$n}px`},children:(d.length>0?d:[""]).map((m,g)=>e.jsx("div",{style:{width:"100%",maxWidth:"794px",minHeight:`${_r}px`,background:"white",boxShadow:"0 2px 12px rgba(0, 0, 0, 0.15)",flexShrink:0,padding:`${Tr}px ${hr}px`},children:e.jsx("div",{dangerouslySetInnerHTML:{__html:m},style:xr})},g))})]})},Wn=Object.freeze(Object.defineProperty({__proto__:null,DocxRenderer:Dn},Symbol.toStringTag,{value:"Module"})),On=({url:r})=>{const t=J(),s=te(),[a,o]=n.useState(!0),[i,c]=n.useState(null),l=n.useRef(null),f=n.useRef(null),d=n.useRef(null),u=n.useRef(null),p=n.useRef(null),h=n.useRef({width:0,height:0}),m=n.useCallback(()=>{if(!l.current)return{width:800,height:600};const x=l.current.clientWidth,b=l.current.clientHeight,v=x>100?x:800,y=b>100?b:600;return{width:v,height:y}},[]),g=n.useCallback(()=>{if(!l.current||!d.current)return;l.current.innerHTML="",f.current=null;const{width:x,height:b}=m(),v=x<640,y=new br(l.current,{mode:"read",showToolbar:!1,showContextmenu:!1,showGrid:!0,row:{len:100,height:25},col:{len:26,width:v?80:100,indexWidth:v?40:60,minWidth:v?40:60},view:{height:()=>b,width:()=>x}});y.loadData(d.current),f.current=y},[m]);return n.useEffect(()=>{if(!l.current)return;let x=!0;const b=()=>{if(x){x=!1,h.current=m();return}const v=m(),y=h.current,w=Math.abs(y.width-v.width),T=Math.abs(y.height-v.height);w<10&&T<10||(h.current=v,p.current&&clearTimeout(p.current),p.current=window.setTimeout(()=>{d.current&&g()},500))};return u.current=new ResizeObserver(()=>{b()}),u.current.observe(l.current),()=>{u.current&&u.current.disconnect(),p.current&&clearTimeout(p.current)}},[m,g]),n.useEffect(()=>{let x=!0;const b=async()=>{if(l.current){o(!0),c(null);try{const y=await s(r,{mode:"cors",credentials:"omit",redirect:"follow"});if(!y.ok)throw y.status===404?new Error(t("xlsx.not_found")):y.status===403?new Error("无权限访问此文件"):new Error(`文件加载失败 (${y.status})`);const w=await y.arrayBuffer();if(w.byteLength===0)throw new Error("文件为空");const T=new Br.Workbook;await T.xlsx.load(w);const S=$t(T);if(!x)return;d.current=S,g(),o(!1)}catch(y){if(x){console.error("Excel 解析错误:",y);let w=t("xlsx.parse_failed");y instanceof Error&&(w=y.message),c(w),o(!1)}}}},v=setTimeout(()=>{requestAnimationFrame(()=>{b()})},100);return()=>{x=!1,clearTimeout(v),d.current=null,l.current&&(l.current.innerHTML=""),f.current=null}},[r,g]),e.jsxs("div",{className:"rfp-relative rfp-flex rfp-flex-col rfp-items-center rfp-w-full rfp-h-full",children:[a&&e.jsx("div",{className:"rfp-absolute rfp-inset-0 rfp-flex rfp-items-center rfp-justify-center rfp-bg-surface-toolbar rfp-backdrop-blur-sm rfp-z-10",children:e.jsxs("div",{className:"rfp-text-center",children:[e.jsx("div",{className:"rfp-w-10 rfp-h-10 md:rfp-w-12 md:rfp-h-12 rfp-mx-auto rfp-mb-3 rfp-border-4 rfp-border-line-strong rfp-border-t-spinner-head rfp-rounded-full rfp-animate-spin"}),e.jsx("p",{className:"rfp-text-xs md:rfp-text-sm rfp-text-fg-secondary rfp-font-medium",children:t("xlsx.loading")})]})}),i&&!a&&e.jsx("div",{className:"rfp-absolute rfp-inset-0 rfp-flex rfp-items-center rfp-justify-center rfp-bg-surface-toolbar rfp-backdrop-blur-sm rfp-z-10",children:e.jsxs("div",{className:"rfp-text-center rfp-max-w-sm md:rfp-max-w-md rfp-px-4",children:[e.jsx("div",{className:"rfp-w-24 rfp-h-24 md:rfp-w-32 md:rfp-h-32 rfp-mx-auto rfp-mb-4 md:rfp-mb-6 rfp-rounded-2xl md:rfp-rounded-3xl rfp-bg-gradient-to-br rfp-from-green-500 rfp-via-emerald-500 rfp-to-teal-500 rfp-flex rfp-items-center rfp-justify-center rfp-shadow-2xl",children:e.jsx(E.FileSpreadsheet,{className:"rfp-w-12 rfp-h-12 md:rfp-w-16 md:rfp-h-16 rfp-text-fg-primary"})}),e.jsx("p",{className:"rfp-text-lg md:rfp-text-xl rfp-text-fg-primary rfp-mb-2 md:rfp-mb-3 rfp-font-medium",children:t("xlsx.load_failed")}),e.jsx("p",{className:"rfp-text-xs md:rfp-text-sm rfp-text-fg-tertiary rfp-mb-4 md:rfp-mb-6",children:i}),e.jsxs("a",{href:r,download:!0,className:"rfp-inline-flex rfp-items-center rfp-gap-2 rfp-px-4 rfp-py-2 md:rfp-px-6 md:rfp-py-3 rfp-bg-gradient-to-r rfp-from-purple-500 rfp-to-pink-500 rfp-text-fg-primary rfp-text-sm md:rfp-text-base rfp-rounded-lg md:rfp-rounded-xl hover:rfp-scale-105 rfp-transition-all rfp-shadow-lg",children:[e.jsx("svg",{className:"rfp-w-4 rfp-h-4 md:rfp-w-5 md:rfp-h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"})}),t("common.download")]}),e.jsx("p",{className:"rfp-text-xs rfp-text-fg-muted rfp-mt-3 md:rfp-mt-4",children:"提示:可以使用 Microsoft Excel 或 WPS 打开"})]})}),!i&&e.jsx("div",{ref:l,className:"xlsx-spreadsheet-container rfp-w-full rfp-h-full",style:{opacity:a?0:1}})]})},In=Object.freeze(Object.defineProperty({__proto__:null,XlsxRenderer:On},Symbol.toStringTag,{value:"Module"})),Hn=({url:r,tiled:t=!0})=>{const s=J(),a=te(),[o,i]=n.useState(!0),[c,l]=n.useState(null),[f,d]=n.useState(0),u=n.useRef(null),p=n.useRef(null),h=n.useRef(null),m=n.useRef(null),g=n.useRef(null),x=n.useRef({width:0,height:0}),b=n.useCallback(()=>{var k;if(!u.current)return{width:960,height:540};const y=u.current.clientWidth,w=((k=u.current.parentElement)==null?void 0:k.clientWidth)||0,T=y>100?y:w>100?w:300,S=Math.floor(T*9/16);return{width:T,height:S}},[]),v=n.useCallback(async()=>{if(!(!u.current||!m.current||f===0))try{if(p.current)try{p.current.destroy()}catch{}u.current.innerHTML="";const y=b(),w=Ie.init(u.current,{width:y.width,height:t?y.height*f:y.height,mode:t?"list":"slide"});p.current=w,await w.preview(m.current)}catch{}},[b,t,f]);return n.useEffect(()=>{if(!u.current)return;let y=!0;const w=()=>{if(y){y=!1,x.current=b();return}const T=b(),S=x.current,k=Math.abs(S.width-T.width),_=Math.abs(S.height-T.height);k<10&&_<10||(x.current=T,g.current&&clearTimeout(g.current),g.current=window.setTimeout(()=>{p.current&&m.current&&v()},800))};return h.current=new ResizeObserver(()=>{w()}),h.current.observe(u.current),()=>{h.current&&h.current.disconnect(),g.current&&clearTimeout(g.current)}},[b,v]),n.useEffect(()=>{let y=!0,w=null;const T=async()=>{if(u.current){i(!0),l(null),w=setTimeout(()=>{y&&(l(s("pptx.timeout")),i(!1))},3e4);try{const k=await a(r,{mode:"cors",credentials:"omit",redirect:"follow"});if(!k.ok)throw k.status===404?new Error(s("pptx.not_found")):k.status===403?new Error("无权限访问此文件"):k.status>=500?new Error("服务器错误,请稍后重试"):new Error(`文件加载失败 (${k.status})`);const _=await k.arrayBuffer();if(_.byteLength===0)throw new Error("文件为空");if(m.current=_,!y)return;const R=document.createElement("div");R.style.cssText="position:absolute;left:-9999px;top:-9999px;visibility:hidden",document.body.appendChild(R);try{const j=Ie.init(R,{width:100,height:100,mode:"slide"});try{await j.preview(_)}catch{throw new Error(s("pptx.invalid_format"))}const L=j.slideCount;if(!L||L===0)throw new Error(s("pptx.no_pages"));if(j.destroy(),!y)return;d(L),u.current&&(u.current.innerHTML="");const M=b(),O=Ie.init(u.current,{width:M.width,height:t?M.height*L:M.height,mode:t?"list":"slide"});p.current=O,await O.preview(_),w&&(clearTimeout(w),w=null),y&&i(!1)}finally{document.body.contains(R)&&document.body.removeChild(R)}}catch(k){if(w&&(clearTimeout(w),w=null),y){let _=s("pptx.parse_failed");k instanceof Error?_=k.message:typeof k=="string"&&(_=k),l(_),i(!1)}}}},S=setTimeout(()=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{T()})})},150);return()=>{if(y=!1,clearTimeout(S),w&&clearTimeout(w),m.current=null,d(0),p.current)try{p.current.destroy()}catch{}p.current=null}},[r,b,t]),e.jsxs("div",{className:"rfp-relative rfp-flex rfp-flex-col rfp-items-center rfp-w-full rfp-h-full",children:[o&&e.jsx("div",{className:"rfp-absolute rfp-inset-0 rfp-flex rfp-items-center rfp-justify-center rfp-bg-surface-toolbar rfp-backdrop-blur-sm rfp-z-10",children:e.jsxs("div",{className:"rfp-text-center",children:[e.jsx("div",{className:"rfp-w-10 rfp-h-10 md:rfp-w-12 md:rfp-h-12 rfp-mx-auto rfp-mb-3 rfp-border-4 rfp-border-line-strong rfp-border-t-spinner-head rfp-rounded-full rfp-animate-spin"}),e.jsx("p",{className:"rfp-text-xs md:rfp-text-sm rfp-text-fg-secondary rfp-font-medium",children:s("pptx.loading")})]})}),c&&!o&&e.jsx("div",{className:"rfp-absolute rfp-inset-0 rfp-flex rfp-items-center rfp-justify-center rfp-bg-surface-toolbar rfp-backdrop-blur-sm rfp-z-10",children:e.jsxs("div",{className:"rfp-text-center rfp-max-w-sm md:rfp-max-w-md rfp-px-4",children:[e.jsx("div",{className:"rfp-w-24 rfp-h-24 md:rfp-w-32 md:rfp-h-32 rfp-mx-auto rfp-mb-4 md:rfp-mb-6 rfp-rounded-2xl md:rfp-rounded-3xl rfp-bg-gradient-to-br rfp-from-orange-500 rfp-via-red-500 rfp-to-pink-500 rfp-flex rfp-items-center rfp-justify-center rfp-shadow-2xl",children:e.jsx(E.Presentation,{className:"rfp-w-12 rfp-h-12 md:rfp-w-16 md:rfp-h-16 rfp-text-fg-primary"})}),e.jsx("p",{className:"rfp-text-lg md:rfp-text-xl rfp-text-fg-primary rfp-mb-2 md:rfp-mb-3 rfp-font-medium",children:s("pptx.load_failed")}),e.jsx("p",{className:"rfp-text-xs md:rfp-text-sm rfp-text-fg-tertiary rfp-mb-4 md:rfp-mb-6",children:c}),e.jsxs("a",{href:r,download:!0,className:"rfp-inline-flex rfp-items-center rfp-gap-2 rfp-px-4 rfp-py-2 md:rfp-px-6 md:rfp-py-3 rfp-bg-gradient-to-r rfp-from-purple-500 rfp-to-pink-500 rfp-text-fg-primary rfp-text-sm md:rfp-text-base rfp-rounded-lg md:rfp-rounded-xl hover:rfp-scale-105 rfp-transition-all rfp-shadow-lg",children:[e.jsx("svg",{className:"rfp-w-4 rfp-h-4 md:rfp-w-5 md:rfp-h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"})}),s("common.download")]}),e.jsx("p",{className:"rfp-text-xs rfp-text-fg-muted rfp-mt-3 md:rfp-mt-4",children:"提示:可以使用 Microsoft PowerPoint 或 WPS 打开"})]})}),!c&&e.jsx("div",{ref:u,className:"pptx-wrapper rfp-w-full rfp-max-w-full md:rfp-max-w-6xl",style:{opacity:o?0:1}})]})},An=Object.freeze(Object.defineProperty({__proto__:null,PptxRenderer:Hn},Symbol.toStringTag,{value:"Module"}));function Be(r,t){return r?r.filter(s=>s.recipType===t).map(s=>{const a=s.name||"",o=s.smtpAddress||s.email||"";return a&&o&&a!==o?`${a} <${o}>`:a||o}).filter(Boolean).join("; "):""}function $e(r){if(!r)return"";try{const t=new Date(r);return isNaN(t.getTime())?r:t.toLocaleString()}catch{return r}}function Bn(r,t){if(r.bodyHtml)return r.bodyHtml;if(r.html)try{return new TextDecoder("utf-8").decode(r.html)}catch{}return r.body?`<pre style="white-space: pre-wrap; word-wrap: break-word; font-family: system-ui, sans-serif;">${r.body.replace(/&/g,"&").replace(/\x3c/g,"<").replace(/>/g,">")}</pre>`:`<p style="color: #999;">${t}</p>`}function qn(r){return r?{"IPM.Note":"Email","IPM.Note.SMIME":"Encrypted Email","IPM.Note.SMIME.MultipartSigned":"Signed Email","IPM.Appointment":"Appointment","IPM.Schedule.Meeting.Request":"Meeting Request","IPM.Schedule.Meeting.Canceled":"Meeting Cancellation","IPM.Contact":"Contact","IPM.Task":"Task","IPM.StickyNote":"Sticky Note"}[r]||r:""}const oe={flexShrink:0,color:"#6b7280",fontWeight:500,marginRight:"8px",whiteSpace:"nowrap"},ae={display:"flex",alignItems:"flex-start",gap:"8px",padding:"6px 0"},ie={flexShrink:0,display:"flex",alignItems:"center",height:"1.4em"},le={flexShrink:0,color:"#9ca3af"},fe={color:"#111827",wordBreak:"break-word",flex:1},Un=({url:r})=>{const t=J(),s=te(),[a,o]=n.useState(!0),[i,c]=n.useState(null),[l,f]=n.useState(null);if(n.useEffect(()=>{(async()=>{o(!0),c(null),f(null);try{const I=await s(r);if(!I.ok)throw new Error("文件加载失败");const N=await I.arrayBuffer(),C=new qr(N).getFileData();f(C)}catch(I){console.error("MSG 解析错误:",I),c(t("msg.parse_failed"))}finally{o(!1)}})()},[r]),a)return e.jsx("div",{className:"rfp-flex rfp-items-center rfp-justify-center rfp-w-full rfp-h-full",children:e.jsx("div",{className:"rfp-w-12 rfp-h-12 rfp-border-4 rfp-border-line-strong rfp-border-t-spinner-head rfp-rounded-full rfp-animate-spin"})});if(i||!l)return e.jsx("div",{className:"rfp-flex rfp-items-center rfp-justify-center rfp-w-full rfp-h-full",children:e.jsx("div",{className:"rfp-text-fg-secondary rfp-text-center",children:e.jsx("p",{className:"rfp-text-lg",children:i||t("msg.parse_failed_short")})})});const d=Be(l.recipients,"to"),u=Be(l.recipients,"cc"),p=Be(l.recipients,"bcc"),h=l.senderName||"",m=l.senderSmtpAddress||l.senderEmail||"",g=h&&m&&h!==m?`${h} <${m}>`:h||m,x=$e(l.clientSubmitTime),b=$e(l.messageDeliveryTime),v=$e(l.creationTime),y=$e(l.lastModificationTime),w=l.subject||"(无主题)",T=(l.attachments||[]).filter(H=>!H.attachmentHidden),S=Bn(l,t("msg.empty_body")),k=qn(l.messageClass),_=l.messageId||"",R=l,j=typeof R.importance=="number"?R.importance:void 0,L=j===2?"High":j===0?"Low":"",M=typeof R.sensitivity=="number"?R.sensitivity:void 0,W=M!==void 0&&M!==0&&{0:"Normal",1:"Personal",2:"Private",3:"Confidential"}[M]||"";return e.jsx("div",{className:"rfp-w-full rfp-h-full rfp-overflow-auto",style:{background:"white"},children:e.jsxs("div",{style:{width:"100%",background:"white",minHeight:"100%"},children:[e.jsxs("div",{style:{borderBottom:"1px solid #e5e7eb",padding:"clamp(12px, 3vw, 24px) clamp(16px, 3vw, 28px)",background:"#f9fafb"},children:[e.jsx("h2",{style:{margin:"0 0 16px 0",fontSize:"clamp(16px, 2.5vw, 20px)",fontWeight:600,color:"#111827",lineHeight:1.4},children:w}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",fontSize:"clamp(12px, 1.8vw, 14px)",color:"#4b5563"},children:[g&&e.jsxs("div",{style:ae,children:[e.jsx("span",{style:ie,children:e.jsx(E.User,{size:16,style:le})}),e.jsxs("div",{style:{display:"flex",flex:1},children:[e.jsx("span",{style:oe,children:"From"}),e.jsx("span",{style:fe,children:g})]})]}),d&&e.jsxs("div",{style:ae,children:[e.jsx("span",{style:ie,children:e.jsx(E.Users,{size:16,style:le})}),e.jsxs("div",{style:{display:"flex",flex:1},children:[e.jsx("span",{style:oe,children:"To"}),e.jsx("span",{style:fe,children:d})]})]}),u&&e.jsxs("div",{style:ae,children:[e.jsx("span",{style:ie,children:e.jsx(E.Users,{size:16,style:le})}),e.jsxs("div",{style:{display:"flex",flex:1},children:[e.jsx("span",{style:oe,children:"Cc"}),e.jsx("span",{style:fe,children:u})]})]}),p&&e.jsxs("div",{style:ae,children:[e.jsx("span",{style:ie,children:e.jsx(E.Users,{size:16,style:le})}),e.jsxs("div",{style:{display:"flex",flex:1},children:[e.jsx("span",{style:oe,children:"Bcc"}),e.jsx("span",{style:fe,children:p})]})]}),x&&e.jsxs("div",{style:ae,children:[e.jsx("span",{style:ie,children:e.jsx(E.Calendar,{size:16,style:le})}),e.jsxs("div",{style:{display:"flex",flex:1},children:[e.jsx("span",{style:oe,children:"Sent"}),e.jsx("span",{style:fe,children:x})]})]}),b&&b!==x&&e.jsxs("div",{style:ae,children:[e.jsx("span",{style:ie,children:e.jsx(E.Clock,{size:16,style:le})}),e.jsxs("div",{style:{display:"flex",flex:1},children:[e.jsx("span",{style:oe,children:"Received"}),e.jsx("span",{style:fe,children:b})]})]}),!x&&!b&&v&&e.jsxs("div",{style:ae,children:[e.jsx("span",{style:ie,children:e.jsx(E.Calendar,{size:16,style:le})}),e.jsxs("div",{style:{display:"flex",flex:1},children:[e.jsx("span",{style:oe,children:"Date"}),e.jsx("span",{style:fe,children:v})]})]}),L&&e.jsxs("div",{style:ae,children:[e.jsx("span",{style:ie,children:e.jsx(E.Tag,{size:16,style:le})}),e.jsxs("div",{style:{display:"flex",flex:1},children:[e.jsx("span",{style:oe,children:"Importance"}),e.jsx("span",{style:{...fe,color:j===2?"#dc2626":"#2563eb",fontWeight:500},children:L})]})]}),W&&e.jsxs("div",{style:ae,children:[e.jsx("span",{style:ie,children:e.jsx(E.Tag,{size:16,style:le})}),e.jsxs("div",{style:{display:"flex",flex:1},children:[e.jsx("span",{style:oe,children:"Sensitivity"}),e.jsx("span",{style:fe,children:W})]})]}),k&&k!=="Email"&&e.jsxs("div",{style:ae,children:[e.jsx("span",{style:ie,children:e.jsx(E.Mail,{size:16,style:le})}),e.jsxs("div",{style:{display:"flex",flex:1},children:[e.jsx("span",{style:oe,children:"Type"}),e.jsx("span",{style:fe,children:k})]})]}),T.length>0&&e.jsxs("div",{style:{...ae,borderTop:"1px solid #e5e7eb",marginTop:"4px",paddingTop:"10px"},children:[e.jsx("span",{style:ie,children:e.jsx(E.Paperclip,{size:16,style:le})}),e.jsxs("div",{style:{display:"flex",flex:1},children:[e.jsx("span",{style:oe,children:"Attachments"}),e.jsx("div",{style:{...fe,display:"flex",flexWrap:"wrap",gap:"6px"},children:T.map((H,I)=>{const N=H.fileName||H.name||"未知文件",F=H.contentLength,C=F?F>1048576?`${(F/1048576).toFixed(1)} MB`:F>1024?`${(F/1024).toFixed(0)} KB`:`${F} B`:"";return e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:"4px",padding:"2px 8px",background:"#f3f4f6",borderRadius:"4px",fontSize:"13px",color:"#374151",border:"1px solid #e5e7eb"},children:[N,C&&e.jsxs("span",{style:{color:"#9ca3af",fontSize:"12px"},children:["(",C,")"]})]},I)})})]})]}),_&&e.jsxs("div",{style:{...ae,borderTop:T.length>0?"none":"1px solid #e5e7eb",marginTop:"4px",paddingTop:"10px"},children:[e.jsx("span",{style:ie,children:e.jsx(E.Hash,{size:16,style:le})}),e.jsxs("div",{style:{display:"flex",flex:1},children:[e.jsx("span",{style:oe,children:"Message-ID"}),e.jsx("span",{style:{...fe,fontSize:"12px",color:"#9ca3af",fontFamily:"monospace"},children:_})]})]}),y&&y!==x&&y!==b&&e.jsxs("div",{style:ae,children:[e.jsx("span",{style:ie,children:e.jsx(E.Clock,{size:16,style:le})}),e.jsxs("div",{style:{display:"flex",flex:1},children:[e.jsx("span",{style:oe,children:"Modified"}),e.jsx("span",{style:{...fe,fontSize:"12px",color:"#9ca3af"},children:y})]})]})]})]}),e.jsx("div",{style:{padding:"clamp(12px, 3vw, 24px) clamp(16px, 3vw, 28px)",fontFamily:"system-ui, -apple-system, sans-serif",lineHeight:"1.6",color:"#333",overflowX:"auto"},dangerouslySetInnerHTML:{__html:S}})]})})},Gn=Object.freeze(Object.defineProperty({__proto__:null,MsgRenderer:Un},Symbol.toStringTag,{value:"Module"}));if(typeof document<"u"&&!document.getElementById("rfp-epub-styles")){const r=document.createElement("style");r.id="rfp-epub-styles",r.textContent=`
|
|
19
19
|
.epub-container { overflow-y: auto !important; scrollbar-width: thin; }
|
|
20
20
|
.epub-container::-webkit-scrollbar { width: 8px; }
|
|
21
21
|
.epub-container::-webkit-scrollbar-track { background: transparent; }
|
|
22
22
|
.epub-container::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); border-radius: 4px; }
|
|
23
23
|
.epub-container::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.3); }
|
|
24
24
|
.epub-view > iframe { background: white; }
|
|
25
|
-
`,document.head.appendChild(r)}const
|
|
25
|
+
`,document.head.appendChild(r)}const Vn=794,Xn=n.forwardRef(({url:r,onChapterChange:t,onFullWidthChange:s},a)=>{const o=J(),i=te(),c=n.useRef(null),l=n.useRef(null),f=n.useRef(null),d=n.useRef(t),u=n.useRef(s);d.current=t,u.current=s;const p=n.useRef(0),h=n.useRef(null),m=n.useRef(!1),[g,x]=n.useState(!0),[b,v]=n.useState(null),[y,w]=n.useState(!1),[T,S]=n.useState([]),[k,_]=n.useState(!1),[R,j]=n.useState(""),L=n.useRef([]);L.current=T,m.current=y;const M=n.useCallback(()=>{var P;(P=f.current)==null||P.prev()},[]),O=n.useCallback(()=>{var P;(P=f.current)==null||P.next()},[]),W=n.useRef(null),H=n.useRef(0),I=n.useRef(P=>{var X,ne;const $=W.current;if(!$)return;const D=$;if(D.scrollTop+D.clientHeight>=D.scrollHeight-200)try{const K=(X=f.current)==null?void 0:X.manager;(ne=K==null?void 0:K.check)==null||ne.call(K,500,500)}catch{}}),N=n.useCallback(()=>{W.current&&(W.current.removeEventListener("scroll",I.current),W.current=null),cancelAnimationFrame(H.current);const P=()=>{var D;const $=((D=c.current)==null?void 0:D.querySelector(".epub-container"))??null;if(!$){H.current=requestAnimationFrame(P);return}W.current=$,$.addEventListener("scroll",I.current,{passive:!0})};H.current=requestAnimationFrame(P)},[]),F=n.useCallback(()=>{var $;const P=!m.current;w(P),($=u.current)==null||$.call(u,P),setTimeout(()=>{const D=c.current,Y=f.current;!D||!Y||(Y.resize(D.offsetWidth,D.offsetHeight),h.current&&Y.display(h.current),N())},350)},[N]),C=n.useCallback(()=>{_(P=>!P)},[]),U=n.useCallback(P=>{var $;j(P),($=f.current)==null||$.display(P),_(!1)},[]);n.useImperativeHandle(a,()=>({prevPage:M,nextPage:O,toggleFullWidth:F,toggleToc:C}),[M,O,F,C]),n.useEffect(()=>{const P=c.current;if(!P)return;x(!0),v(null),S([]),_(!1),P.innerHTML="",h.current=null,p.current=0;let $=!1;const D=window.setTimeout(()=>{$||Y()},0),Y=async()=>{var X;try{let ne=r;r.startsWith("blob:")&&(ne=await(await i(r)).arrayBuffer());const K=Ur(ne);l.current=K;const ge=K.renderTo(P,{manager:"continuous",flow:"scrolled",width:"100%",height:"100%"});f.current=ge,ge.themes.register("default",{body:{background:"#ffffff !important",color:"#1a1a1a !important","font-family":'"Noto Serif SC", "Source Han Serif SC", Georgia, "Times New Roman", serif !important',"font-size":"16px !important","line-height":"2 !important",padding:"40px 60px !important","max-width":"100% !important","box-sizing":"border-box !important","word-break":"break-word !important","overflow-wrap":"break-word !important"},p:{"text-indent":"2em !important",margin:"0.8em 0 !important"},h1:{"text-align":"center !important",margin:"1.5em 0 1em !important"},h2:{margin:"1.2em 0 0.8em !important"},h3:{margin:"1em 0 0.6em !important"},img:{"max-width":"100% !important",height:"auto !important"},a:{color:"#2563eb !important","text-decoration":"none !important"}}),ge.themes.select("default"),await K.ready,K.locations.generate(1024).then(()=>{var se,ce,he;if($)return;p.current=K.locations.length();const me=(se=f.current)==null?void 0:se.currentLocation(),Z=((ce=me==null?void 0:me.start)==null?void 0:ce.location)??0;(he=d.current)==null||he.call(d,Z+1,p.current)}).catch(()=>{});const Q=await K.loaded.navigation;if(!$&&Array.isArray(Q==null?void 0:Q.toc)&&S(Q.toc),await ge.display(),$)return;x(!1),(X=d.current)==null||X.call(d,1,p.current||1),ge.on("relocated",me=>{var he,ve,je,Se;const Z=me;if((he=Z==null?void 0:Z.start)!=null&&he.cfi&&(h.current=Z.start.cfi),(ve=Z==null?void 0:Z.start)!=null&&ve.href){const ye=Z.start.href,be=[],xe=Ne=>{for(const pe of Ne){const _e=pe.href.split("#")[0];_e&&(ye===_e||ye.endsWith("/"+_e)||ye.endsWith(_e))&&be.push(pe.href),pe.subitems&&xe(pe.subitems)}};xe(L.current),be.length===1&&j(be[0])}const se=(je=Z==null?void 0:Z.start)==null?void 0:je.location,ce=p.current;typeof se=="number"&&ce>0&&((Se=d.current)==null||Se.call(d,se+1,ce))})}catch(ne){console.error("EPUB 加载错误:",ne),$||(v(o("epub.load_failed")),x(!1))}};return()=>{var X,ne,K;$=!0,window.clearTimeout(D);try{(ne=(X=f.current)==null?void 0:X.destroy)==null||ne.call(X)}catch{}try{(K=l.current)==null||K.destroy()}catch{}f.current=null,l.current=null}},[r]),n.useEffect(()=>{const P=()=>{const $=c.current;!$||!f.current||f.current.resize($.offsetWidth,$.offsetHeight)};return window.addEventListener("resize",P),()=>window.removeEventListener("resize",P)},[]),n.useEffect(()=>(N(),()=>{var P;cancelAnimationFrame(H.current),(P=W.current)==null||P.removeEventListener("scroll",I.current)}),[r,N]);const B=n.useCallback(P=>P===R,[R]),G=(P,$=0)=>e.jsx("ul",{style:{marginLeft:$>0?16:0},children:P.map((D,Y)=>{const X=B(D.href);return e.jsxs("li",{children:[e.jsx("button",{onClick:()=>U(D.href),className:`rfp-w-full rfp-text-left rfp-py-2 rfp-px-3 rfp-text-sm rfp-rounded rfp-transition-all rfp-truncate ${X?"rfp-text-fg-primary rfp-bg-surface-3 rfp-font-medium":"rfp-text-fg-secondary hover:rfp-text-fg-primary hover:rfp-bg-surface-2"}`,title:D.label,children:D.label.trim()}),D.subitems&&D.subitems.length>0&&G(D.subitems,$+1)]},`${D.href}-${Y}`)})});return e.jsxs("div",{className:"rfp-relative rfp-w-full rfp-h-full rfp-flex rfp-justify-center rfp-bg-[#f5f5f0] rfp-overflow-hidden",children:[b&&e.jsx("div",{className:"rfp-absolute rfp-inset-0 rfp-flex rfp-items-center rfp-justify-center rfp-text-fg-secondary rfp-text-center",children:e.jsx("p",{className:"rfp-text-lg",children:b})}),g&&!b&&e.jsx("div",{className:"rfp-absolute rfp-inset-0 rfp-flex rfp-items-center rfp-justify-center rfp-z-10",children:e.jsx("div",{className:"rfp-w-12 rfp-h-12 rfp-border-4 rfp-border-line-strong rfp-border-t-spinner-head rfp-rounded-full rfp-animate-spin"})}),T.length>0&&e.jsxs("div",{className:"rfp-absolute rfp-inset-0 rfp-z-20 rfp-flex rfp-transition-opacity rfp-duration-300",style:{opacity:k?1:0,pointerEvents:k?"auto":"none"},children:[e.jsxs("div",{className:"rfp-w-72 rfp-max-w-[80%] rfp-h-full rfp-bg-surface-overlay rfp-backdrop-blur-xl rfp-border-r rfp-border-line-weak rfp-flex rfp-flex-col rfp-shadow-2xl rfp-transition-transform rfp-duration-300",style:{transform:k?"translateX(0)":"translateX(-100%)"},children:[e.jsxs("div",{className:"rfp-flex rfp-items-center rfp-justify-between rfp-px-4 rfp-py-3 rfp-border-b rfp-border-line-weak rfp-flex-shrink-0",children:[e.jsx("span",{className:"rfp-text-fg-primary rfp-font-medium rfp-text-sm",children:o("toolbar.toc")}),e.jsx("button",{onClick:()=>_(!1),className:"rfp-text-fg-tertiary hover:rfp-text-fg-primary rfp-transition-colors",children:e.jsx(E.X,{className:"rfp-w-4 rfp-h-4"})})]}),e.jsx("div",{className:"rfp-flex-1 rfp-overflow-y-auto rfp-py-4 rfp-px-1",children:G(T)})]}),e.jsx("div",{className:"rfp-flex-1 rfp-transition-opacity rfp-duration-300",style:{background:k?"rgba(0,0,0,0.3)":"transparent"},onClick:()=>_(!1)})]}),!b&&e.jsx("div",{ref:c,className:"rfp-h-full rfp-bg-surface-toolbar rfp-shadow-lg",style:{width:y?"100%":`${Vn}px`,maxWidth:"100%",transition:"width 0.3s ease",overflow:"hidden"}})]})}),Zn=Object.freeze(Object.defineProperty({__proto__:null,EpubRenderer:Xn},Symbol.toStringTag,{value:"Module"})),Jn=`
|
|
26
26
|
@namespace epub "http://www.idpf.org/2007/ops";
|
|
27
27
|
html { color-scheme: light; }
|
|
28
28
|
body {
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
img { max-width: 100% !important; height: auto !important; }
|
|
45
45
|
a { color: #2563eb; text-decoration: none; }
|
|
46
46
|
pre { white-space: pre-wrap !important; }
|
|
47
|
-
`,As=794,Rr=s.forwardRef(({url:r,onChapterChange:t,onFullWidthChange:n},a)=>{const o=J(),i=se(),p=s.useRef(null),l=s.useRef(null),f=s.useRef(t),u=s.useRef(n);f.current=t,u.current=n;const d=s.useRef(1),[c,m]=s.useState(!0),[h,y]=s.useState(null),[x,w]=s.useState([]),[b,g]=s.useState(!1),[v,k]=s.useState(""),[S,M]=s.useState(!1),T=s.useRef(!1);T.current=S;const D=s.useCallback((j,R)=>{var C;R>0&&(d.current=R),(C=f.current)==null||C.call(f,Math.max(1,j+1),d.current)},[]),N=s.useCallback(()=>{const j=l.current;j&&j.prev().catch(()=>{})},[]),E=s.useCallback(()=>{const j=l.current;j&&j.next().catch(()=>{})},[]),F=s.useCallback(()=>g(j=>!j),[]),H=s.useCallback(()=>{var B;const j=!T.current;M(j),(B=u.current)==null||B.call(u,j);const R=l.current;if(!R)return;const C=R.renderer;C&&C.setAttribute("max-inline-size",j?"9999":"720")},[]),A=s.useCallback(j=>{var R;k(j),g(!1),(R=l.current)==null||R.goTo(j).catch(()=>{})},[]);s.useImperativeHandle(a,()=>({prevPage:N,nextPage:E,toggleFullWidth:H,toggleToc:F}),[N,E,H,F]),s.useEffect(()=>{const j=p.current;if(!j)return;m(!0),y(null),w([]),g(!1),k(""),j.replaceChildren();let R=!1,C=null;return(async()=>{var I,q,L,z,$,Y;try{if(R)return;C=document.createElement("foliate-view"),j.appendChild(C),l.current=C,C.addEventListener("relocate",me=>{var he,je;const X=me.detail;if(!X)return;const ne=X.location;if(ne&&typeof ne.current=="number"&&typeof ne.total=="number")D(ne.current,ne.total);else{const Ne=((je=(he=l.current)==null?void 0:he.book)==null?void 0:je.sections)??[],_e=X.index??0,ye=X.fraction??0,ge=Math.max(Ne.length,1),xe=Math.round((_e+ye)/ge*ge);D(xe,ge)}const ce=X.tocItem;ce!=null&&ce.href&&k(ce.href)});const V=await i(r);if(!V.ok)throw new Error(`请求失败: ${V.status}`);const te=await V.blob();let K="book.mobi";try{const X=new URL(r,window.location.href).pathname.split("/").pop();X&&(K=decodeURIComponent(X))}catch{}const be=new File([te],K);if(await C.open(be),R){(q=(I=C.book)==null?void 0:I.destroy)==null||q.call(I);return}const Q=C.renderer;Q&&(Q.setAttribute("animated",""),Q.setAttribute("max-inline-size","720"),Q.setAttribute("margin","48"),Q.setAttribute("gap","5%"),(L=Q.setStyles)==null||L.call(Q,Hs),await((z=Q.next)==null?void 0:z.call(Q))),w((($=C.book)==null?void 0:$.toc)??[]),m(!1),D(0,((Y=C.book)==null?void 0:Y.sections.length)??1)}catch(V){console.error("MOBI/AZW3 加载错误:",V),R||(y(o("mobi.load_failed")),m(!1))}})(),()=>{var I,q,L;R=!0;try{(L=(q=(I=l.current)==null?void 0:I.book)==null?void 0:q.destroy)==null||L.call(q)}catch{}l.current=null,j.replaceChildren()}},[r,D]);const Z=s.useCallback(j=>!!j&&j===v,[v]),G=(j,R=0)=>e.jsx("ul",{style:{listStyle:"none",padding:0,margin:R>0?"0 0 0 16px":0},children:j.map((C,B)=>{var I,q;return e.jsxs("li",{children:[C.href?e.jsx("button",{onClick:()=>A(C.href),className:`rfp-w-full rfp-text-left rfp-py-2 rfp-px-3 rfp-text-sm rfp-rounded rfp-transition-all rfp-truncate ${Z(C.href)?"rfp-text-fg-primary rfp-bg-surface-3 rfp-font-medium":"rfp-text-fg-secondary hover:rfp-text-fg-primary hover:rfp-bg-surface-2"}`,title:C.label,children:(I=C.label)==null?void 0:I.trim()}):e.jsx("div",{className:"rfp-w-full rfp-py-2 rfp-px-3 rfp-text-sm rfp-text-fg-tertiary rfp-truncate",children:(q=C.label)==null?void 0:q.trim()}),C.subitems&&C.subitems.length>0&&G(C.subitems,R+1)]},`${C.href??C.label}-${B}`)})});return e.jsxs("div",{className:"rfp-relative rfp-w-full rfp-h-full rfp-flex rfp-justify-center rfp-bg-[#f5f5f0] rfp-overflow-hidden",children:[h&&e.jsx("div",{className:"rfp-absolute rfp-inset-0 rfp-flex rfp-items-center rfp-justify-center rfp-text-fg-secondary rfp-text-center rfp-p-6",children:e.jsx("p",{className:"rfp-text-lg",children:h})}),c&&!h&&e.jsx("div",{className:"rfp-absolute rfp-inset-0 rfp-flex rfp-items-center rfp-justify-center rfp-z-10",children:e.jsx("div",{className:"rfp-w-12 rfp-h-12 rfp-border-4 rfp-border-line-strong rfp-border-t-spinner-head rfp-rounded-full rfp-animate-spin"})}),x.length>0&&e.jsxs("div",{className:"rfp-absolute rfp-inset-0 rfp-z-20 rfp-flex rfp-transition-opacity rfp-duration-300",style:{opacity:b?1:0,pointerEvents:b?"auto":"none"},children:[e.jsxs("div",{className:"rfp-w-72 rfp-max-w-[80%] rfp-h-full rfp-bg-surface-overlay rfp-backdrop-blur-xl rfp-border-r rfp-border-line-weak rfp-flex rfp-flex-col rfp-shadow-2xl rfp-transition-transform rfp-duration-300",style:{transform:b?"translateX(0)":"translateX(-100%)"},children:[e.jsxs("div",{className:"rfp-flex rfp-items-center rfp-justify-between rfp-px-4 rfp-py-3 rfp-border-b rfp-border-line-weak rfp-flex-shrink-0",children:[e.jsx("span",{className:"rfp-text-fg-primary rfp-font-medium rfp-text-sm",children:o("toolbar.toc")}),e.jsx("button",{onClick:()=>g(!1),className:"rfp-text-fg-tertiary hover:rfp-text-fg-primary rfp-transition-colors",children:e.jsx(_.X,{className:"rfp-w-4 rfp-h-4"})})]}),e.jsx("div",{className:"rfp-flex-1 rfp-overflow-y-auto rfp-py-4 rfp-px-1",children:G(x)})]}),e.jsx("div",{className:"rfp-flex-1 rfp-transition-opacity rfp-duration-300",style:{background:b?"rgba(0,0,0,0.3)":"transparent"},onClick:()=>g(!1)})]}),!h&&e.jsx("div",{ref:p,className:"rfp-h-full rfp-bg-surface-toolbar rfp-shadow-lg",style:{width:S?"100%":`${As}px`,maxWidth:"100%",transition:"width 0.3s ease"}})]})});Rr.displayName="MobiRenderer";const Bs=Object.freeze(Object.defineProperty({__proto__:null,MobiRenderer:Rr},Symbol.toStringTag,{value:"Module"})),qs=r=>{var a;const t=((a=r.split(".").pop())==null?void 0:a.toLowerCase().split("?")[0])||"";return{mp4:"video/mp4",webm:"video/webm",ogg:"video/ogg",ogv:"video/ogg",mov:"video/quicktime",avi:"video/x-msvideo",mkv:"video/x-matroska",m4v:"video/mp4","3gp":"video/3gpp",flv:"video/x-flv"}[t]||"video/mp4"},Us=({url:r})=>{const t=J(),[n,a]=s.useState(null),[o,i]=s.useState(!0),p=s.useRef(null),l=s.useRef(null);return s.useEffect(()=>{if(!l.current&&p.current){const f=document.createElement("video-js");f.classList.add("vjs-big-play-centered","vjs-theme-apple"),p.current.appendChild(f);const u=qs(r),c=qr(f,{controls:!0,fill:!0,preload:"auto",controlBar:{children:["playToggle","volumePanel","currentTimeDisplay","timeDivider","durationDisplay","progressControl","remainingTimeDisplay","fullscreenToggle"],volumePanel:{inline:!1}},html5:{vhs:{overrideNative:!0},nativeVideoTracks:!1,nativeAudioTracks:!1,nativeTextTracks:!1},sources:u==="video/quicktime"?[{src:r,type:"video/quicktime"},{src:r,type:"video/mp4"}]:[{src:r,type:u}]}),m=c.el().querySelector("video");m&&(m.style.objectFit="contain"),c.on("loadeddata",()=>{i(!1)}),c.on("error",()=>{const h=c.error();console.error("Video.js error:",h),a(t("video.load_failed_with_error",{error:(h==null?void 0:h.message)||t("common.unknown_error")})),i(!1)}),l.current=c}},[r]),s.useEffect(()=>{const f=l.current;return()=>{f&&!f.isDisposed()&&(f.dispose(),l.current=null)}},[]),n?e.jsx("div",{className:"rfp-flex rfp-items-center rfp-justify-center rfp-w-full rfp-h-full",children:e.jsxs("div",{className:"rfp-text-center",children:[e.jsx("div",{className:"rfp-w-16 rfp-h-16 rfp-mx-auto rfp-mb-4 rfp-rounded-full rfp-bg-red-500/10 rfp-flex rfp-items-center rfp-justify-center",children:e.jsx("svg",{className:"rfp-w-8 rfp-h-8 rfp-text-red-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),e.jsx("p",{className:"rfp-text-lg rfp-font-medium rfp-text-fg-primary rfp-mb-2",children:t("video.load_failed")}),e.jsx("p",{className:"rfp-text-sm rfp-text-fg-tertiary",children:n})]})}):e.jsx("div",{className:"rfp-flex rfp-items-center rfp-justify-center rfp-w-full rfp-h-full",children:e.jsxs("div",{className:"rfp-w-full rfp-h-full rfp-relative",children:[o&&e.jsx("div",{className:"rfp-absolute rfp-inset-0 rfp-flex rfp-items-center rfp-justify-center rfp-bg-surface-3 rfp-backdrop-blur-sm rfp-z-10",children:e.jsxs("div",{className:"rfp-text-center",children:[e.jsx("div",{className:"rfp-w-12 rfp-h-12 rfp-mx-auto rfp-mb-3 rfp-border-3 rfp-border-line-strong rfp-border-t-spinner-head rfp-rounded-full rfp-animate-spin"}),e.jsx("p",{className:"rfp-text-sm rfp-text-fg-secondary rfp-font-medium",children:t("video.loading")})]})}),e.jsx("div",{ref:p,className:"rfp-overflow-hidden rfp-w-full rfp-h-full [&_video]:rfp-object-contain",style:{boxShadow:"0 20px 60px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.05)"}})]})})},Gs=Object.freeze(Object.defineProperty({__proto__:null,VideoRenderer:Us},Symbol.toStringTag,{value:"Module"}));function Vs({url:r}){const t=s.useRef(null),[n,a]=s.useState(!1),[o,i]=s.useState(!0),[p,l]=s.useState(0),[f,u]=s.useState(0),[d,c]=s.useState(1),[m,h]=s.useState(!1),[y,x]=s.useState(!1),[w,b]=s.useState(null);s.useEffect(()=>{const N=t.current;if(!N)return;i(!0),b(null);const E=()=>{isNaN(N.currentTime)||l(N.currentTime)},F=()=>{!isNaN(N.duration)&&isFinite(N.duration)&&u(N.duration)},H=()=>{i(!1),F()},A=()=>i(!0),Z=()=>{i(!1),a(!0)},G=()=>a(!0),j=()=>a(!1),R=()=>a(!1),C=()=>{b("音频加载失败"),i(!1)};return N.addEventListener("timeupdate",E),N.addEventListener("loadedmetadata",F),N.addEventListener("durationchange",F),N.addEventListener("canplay",H),N.addEventListener("waiting",A),N.addEventListener("playing",Z),N.addEventListener("play",G),N.addEventListener("pause",j),N.addEventListener("ended",R),N.addEventListener("error",C),N.readyState>=3?(i(!1),F()):N.readyState>=1&&F(),()=>{N.removeEventListener("timeupdate",E),N.removeEventListener("loadedmetadata",F),N.removeEventListener("durationchange",F),N.removeEventListener("canplay",H),N.removeEventListener("waiting",A),N.removeEventListener("playing",Z),N.removeEventListener("play",G),N.removeEventListener("pause",j),N.removeEventListener("ended",R),N.removeEventListener("error",C)}},[r]);const g=s.useCallback(()=>{const N=t.current;N&&(N.paused?N.play().catch(()=>{}):N.pause())},[]),v=s.useCallback(N=>{const E=t.current;E&&(E.currentTime=N,l(N))},[]),k=s.useCallback(N=>{const E=t.current;E&&(E.currentTime=Math.max(0,Math.min(E.currentTime+N,E.duration||1/0)))},[]),S=s.useCallback(N=>{const E=t.current;if(!E)return;const F=Math.max(0,Math.min(1,N));E.volume=F,c(F),F>0&&(E.muted=!1,h(!1))},[]),M=s.useCallback(()=>{const N=t.current;N&&(N.muted=!N.muted,h(N.muted))},[]),T=s.useCallback(()=>{const N=t.current;if(!N)return;const E=!N.loop;N.loop=E,x(E)},[]),D=s.useCallback(N=>{if(!isFinite(N)||isNaN(N)||N<0)return"0:00";const E=Math.floor(N/60),F=Math.floor(N%60);return`${E}:${F.toString().padStart(2,"0")}`},[]);return{audioRef:t,isPlaying:n,isLoading:o,isLoop:y,currentTime:p,duration:f,volume:d,isMuted:m,error:w,togglePlay:g,seek:v,skip:k,setVolume:S,toggleMute:M,toggleLoop:T,formatTime:D}}const Xs=({text:r,className:t="",style:n})=>{const a=s.useRef(null),o=s.useRef(null),[i,p]=s.useState(!1),[l,f]=s.useState(0);s.useEffect(()=>{const m=()=>{const y=a.current,x=o.current;if(!y||!x)return;const w=y.clientWidth,b=x.scrollWidth;p(b>w),f(b)};m();const h=new ResizeObserver(m);return a.current&&h.observe(a.current),()=>h.disconnect()},[r]);const u=60,d=l+u,c=d/40;return e.jsxs("div",{ref:a,className:`rfp-overflow-hidden rfp-whitespace-nowrap ${t}`,style:n,children:[i?e.jsxs(re.motion.div,{className:"rfp-inline-flex rfp-whitespace-nowrap",animate:{x:[0,-d]},transition:{duration:c,repeat:1/0,ease:"linear",repeatDelay:1.5},children:[e.jsx("span",{children:r}),e.jsx("span",{style:{width:u},className:"rfp-inline-block"}),e.jsx("span",{children:r})]}):null,e.jsx("div",{ref:o,className:"rfp-whitespace-nowrap",style:i?{position:"absolute",visibility:"hidden",pointerEvents:"none"}:void 0,children:r})]})},Zs=({isPlaying:r})=>e.jsx(re.motion.div,{className:"rfp-absolute",style:{top:"-6px",right:"2px",width:"100px",height:"120px",transformOrigin:"76px 16px",zIndex:5},animate:{rotate:r?16:0},transition:{duration:.8,ease:[.4,0,.2,1]},children:e.jsxs("svg",{width:"100",height:"120",viewBox:"0 0 100 120",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsx("circle",{cx:"76",cy:"16",r:"13",fill:"rgba(0,0,0,0.3)"}),e.jsx("circle",{cx:"76",cy:"16",r:"11",fill:"url(#baseGrad)"}),e.jsx("circle",{cx:"76",cy:"16",r:"6",fill:"url(#baseInnerGrad)"}),e.jsx("circle",{cx:"76",cy:"16",r:"2.5",fill:"#222",stroke:"#555",strokeWidth:"0.5"}),e.jsx("path",{d:"M74 22 L56 88",stroke:"url(#armGrad)",strokeWidth:"3.5",strokeLinecap:"round"}),e.jsx("path",{d:"M74.8 22 L56.8 88",stroke:"rgba(255,255,255,0.06)",strokeWidth:"1",strokeLinecap:"round"}),e.jsx("rect",{x:"50",y:"86",width:"12",height:"7",rx:"1.5",fill:"url(#headGrad)"}),e.jsx("rect",{x:"52.5",y:"92",width:"7",height:"9",rx:"1",fill:"url(#cartridgeGrad)"}),e.jsx("line",{x1:"56",y1:"101",x2:"56",y2:"105",stroke:"#bbb",strokeWidth:"1.2",strokeLinecap:"round"}),e.jsx("circle",{cx:"56",cy:"105.5",r:"0.8",fill:"#ddd"}),e.jsxs("defs",{children:[e.jsxs("radialGradient",{id:"baseGrad",cx:"40%",cy:"35%",children:[e.jsx("stop",{offset:"0%",stopColor:"#555"}),e.jsx("stop",{offset:"100%",stopColor:"#1a1a1a"})]}),e.jsxs("radialGradient",{id:"baseInnerGrad",cx:"40%",cy:"35%",children:[e.jsx("stop",{offset:"0%",stopColor:"#666"}),e.jsx("stop",{offset:"100%",stopColor:"#333"})]}),e.jsxs("linearGradient",{id:"armGrad",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:"#555"}),e.jsx("stop",{offset:"50%",stopColor:"#444"}),e.jsx("stop",{offset:"100%",stopColor:"#333"})]}),e.jsxs("linearGradient",{id:"headGrad",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:"#555"}),e.jsx("stop",{offset:"100%",stopColor:"#333"})]}),e.jsxs("linearGradient",{id:"cartridgeGrad",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:"#444"}),e.jsx("stop",{offset:"100%",stopColor:"#222"})]})]})]})}),Js=({url:r,fileName:t})=>{const n=J(),{audioRef:a,isPlaying:o,isLoading:i,isLoop:p,currentTime:l,duration:f,volume:u,isMuted:d,error:c,togglePlay:m,seek:h,skip:y,setVolume:x,toggleMute:w,toggleLoop:b,formatTime:g}=Vs({url:r}),[v,k]=s.useState(!1),S=s.useRef(null),M=s.useRef(),T=f>0?l/f:0;s.useEffect(()=>{const F=H=>{S.current&&!S.current.contains(H.target)&&k(!1)};return v&&document.addEventListener("mousedown",F),()=>document.removeEventListener("mousedown",F)},[v]);const D=()=>{clearTimeout(M.current),k(!0)},N=()=>{M.current=setTimeout(()=>k(!1),300)},E=d||u===0?_.VolumeX:u<.5?_.Volume1:_.Volume2;return c?e.jsx("div",{className:"rfp-flex rfp-items-center rfp-justify-center rfp-w-full rfp-h-full",children:e.jsx("div",{className:"rfp-text-fg-secondary rfp-text-center",children:e.jsx("p",{className:"rfp-text-lg",children:c})})}):e.jsxs("div",{className:"rfp-flex rfp-flex-col rfp-items-center rfp-justify-center rfp-w-full rfp-h-full rfp-p-4 md:rfp-p-8 rfp-gap-5 md:rfp-gap-8 rfp-select-none",children:[e.jsxs("div",{className:"rfp-relative",style:{width:"260px",height:"240px"},children:[e.jsx(re.motion.div,{className:"rfp-absolute rfp-rounded-full",style:{width:"220px",height:"220px",top:"18px",left:"8px",background:"radial-gradient(circle, rgba(129,140,248,0.12) 0%, transparent 70%)"},animate:o?{scale:[1,1.08,1],opacity:[.5,1,.5]}:{scale:1,opacity:.2},transition:o?{duration:3,repeat:1/0,ease:"easeInOut"}:{duration:.5}}),e.jsxs("div",{className:"rfp-absolute rfp-rounded-full rfp-overflow-hidden",style:{width:"200px",height:"200px",top:"28px",left:"18px",background:`
|
|
47
|
+
`,Yn=794,Rr=n.forwardRef(({url:r,onChapterChange:t,onFullWidthChange:s},a)=>{const o=J(),i=te(),c=n.useRef(null),l=n.useRef(null),f=n.useRef(t),d=n.useRef(s);f.current=t,d.current=s;const u=n.useRef(1),[p,h]=n.useState(!0),[m,g]=n.useState(null),[x,b]=n.useState([]),[v,y]=n.useState(!1),[w,T]=n.useState(""),[S,k]=n.useState(!1),_=n.useRef(!1);_.current=S;const R=n.useCallback((N,F)=>{var C;F>0&&(u.current=F),(C=f.current)==null||C.call(f,Math.max(1,N+1),u.current)},[]),j=n.useCallback(()=>{const N=l.current;N&&N.prev().catch(()=>{})},[]),L=n.useCallback(()=>{const N=l.current;N&&N.next().catch(()=>{})},[]),M=n.useCallback(()=>y(N=>!N),[]),O=n.useCallback(()=>{var U;const N=!_.current;k(N),(U=d.current)==null||U.call(d,N);const F=l.current;if(!F)return;const C=F.renderer;C&&C.setAttribute("max-inline-size",N?"9999":"720")},[]),W=n.useCallback(N=>{var F;T(N),y(!1),(F=l.current)==null||F.goTo(N).catch(()=>{})},[]);n.useImperativeHandle(a,()=>({prevPage:j,nextPage:L,toggleFullWidth:O,toggleToc:M}),[j,L,O,M]),n.useEffect(()=>{const N=c.current;if(!N)return;h(!0),g(null),b([]),y(!1),T(""),N.replaceChildren();let F=!1,C=null;return(async()=>{var B,G,P,$,D,Y;try{if(F)return;C=document.createElement("foliate-view"),N.appendChild(C),l.current=C,C.addEventListener("relocate",me=>{var he,ve;const Z=me.detail;if(!Z)return;const se=Z.location;if(se&&typeof se.current=="number"&&typeof se.total=="number")R(se.current,se.total);else{const je=((ve=(he=l.current)==null?void 0:he.book)==null?void 0:ve.sections)??[],Se=Z.index??0,ye=Z.fraction??0,be=Math.max(je.length,1),xe=Math.round((Se+ye)/be*be);R(xe,be)}const ce=Z.tocItem;ce!=null&&ce.href&&T(ce.href)});const X=await i(r);if(!X.ok)throw new Error(`请求失败: ${X.status}`);const ne=await X.blob();let K="book.mobi";try{const Z=new URL(r,window.location.href).pathname.split("/").pop();Z&&(K=decodeURIComponent(Z))}catch{}const ge=new File([ne],K);if(await C.open(ge),F){(G=(B=C.book)==null?void 0:B.destroy)==null||G.call(B);return}const Q=C.renderer;Q&&(Q.setAttribute("animated",""),Q.setAttribute("max-inline-size","720"),Q.setAttribute("margin","48"),Q.setAttribute("gap","5%"),(P=Q.setStyles)==null||P.call(Q,Jn),await(($=Q.next)==null?void 0:$.call(Q))),b(((D=C.book)==null?void 0:D.toc)??[]),h(!1),R(0,((Y=C.book)==null?void 0:Y.sections.length)??1)}catch(X){console.error("MOBI/AZW3 加载错误:",X),F||(g(o("mobi.load_failed")),h(!1))}})(),()=>{var B,G,P;F=!0;try{(P=(G=(B=l.current)==null?void 0:B.book)==null?void 0:G.destroy)==null||P.call(G)}catch{}l.current=null,N.replaceChildren()}},[r,R]);const H=n.useCallback(N=>!!N&&N===w,[w]),I=(N,F=0)=>e.jsx("ul",{style:{listStyle:"none",padding:0,margin:F>0?"0 0 0 16px":0},children:N.map((C,U)=>{var B,G;return e.jsxs("li",{children:[C.href?e.jsx("button",{onClick:()=>W(C.href),className:`rfp-w-full rfp-text-left rfp-py-2 rfp-px-3 rfp-text-sm rfp-rounded rfp-transition-all rfp-truncate ${H(C.href)?"rfp-text-fg-primary rfp-bg-surface-3 rfp-font-medium":"rfp-text-fg-secondary hover:rfp-text-fg-primary hover:rfp-bg-surface-2"}`,title:C.label,children:(B=C.label)==null?void 0:B.trim()}):e.jsx("div",{className:"rfp-w-full rfp-py-2 rfp-px-3 rfp-text-sm rfp-text-fg-tertiary rfp-truncate",children:(G=C.label)==null?void 0:G.trim()}),C.subitems&&C.subitems.length>0&&I(C.subitems,F+1)]},`${C.href??C.label}-${U}`)})});return e.jsxs("div",{className:"rfp-relative rfp-w-full rfp-h-full rfp-flex rfp-justify-center rfp-bg-[#f5f5f0] rfp-overflow-hidden",children:[m&&e.jsx("div",{className:"rfp-absolute rfp-inset-0 rfp-flex rfp-items-center rfp-justify-center rfp-text-fg-secondary rfp-text-center rfp-p-6",children:e.jsx("p",{className:"rfp-text-lg",children:m})}),p&&!m&&e.jsx("div",{className:"rfp-absolute rfp-inset-0 rfp-flex rfp-items-center rfp-justify-center rfp-z-10",children:e.jsx("div",{className:"rfp-w-12 rfp-h-12 rfp-border-4 rfp-border-line-strong rfp-border-t-spinner-head rfp-rounded-full rfp-animate-spin"})}),x.length>0&&e.jsxs("div",{className:"rfp-absolute rfp-inset-0 rfp-z-20 rfp-flex rfp-transition-opacity rfp-duration-300",style:{opacity:v?1:0,pointerEvents:v?"auto":"none"},children:[e.jsxs("div",{className:"rfp-w-72 rfp-max-w-[80%] rfp-h-full rfp-bg-surface-overlay rfp-backdrop-blur-xl rfp-border-r rfp-border-line-weak rfp-flex rfp-flex-col rfp-shadow-2xl rfp-transition-transform rfp-duration-300",style:{transform:v?"translateX(0)":"translateX(-100%)"},children:[e.jsxs("div",{className:"rfp-flex rfp-items-center rfp-justify-between rfp-px-4 rfp-py-3 rfp-border-b rfp-border-line-weak rfp-flex-shrink-0",children:[e.jsx("span",{className:"rfp-text-fg-primary rfp-font-medium rfp-text-sm",children:o("toolbar.toc")}),e.jsx("button",{onClick:()=>y(!1),className:"rfp-text-fg-tertiary hover:rfp-text-fg-primary rfp-transition-colors",children:e.jsx(E.X,{className:"rfp-w-4 rfp-h-4"})})]}),e.jsx("div",{className:"rfp-flex-1 rfp-overflow-y-auto rfp-py-4 rfp-px-1",children:I(x)})]}),e.jsx("div",{className:"rfp-flex-1 rfp-transition-opacity rfp-duration-300",style:{background:v?"rgba(0,0,0,0.3)":"transparent"},onClick:()=>y(!1)})]}),!m&&e.jsx("div",{ref:c,className:"rfp-h-full rfp-bg-surface-toolbar rfp-shadow-lg",style:{width:S?"100%":`${Yn}px`,maxWidth:"100%",transition:"width 0.3s ease"}})]})});Rr.displayName="MobiRenderer";const Kn=Object.freeze(Object.defineProperty({__proto__:null,MobiRenderer:Rr},Symbol.toStringTag,{value:"Module"})),Qn=r=>{var a;const t=((a=r.split(".").pop())==null?void 0:a.toLowerCase().split("?")[0])||"";return{mp4:"video/mp4",webm:"video/webm",ogg:"video/ogg",ogv:"video/ogg",mov:"video/quicktime",avi:"video/x-msvideo",mkv:"video/x-matroska",m4v:"video/mp4","3gp":"video/3gpp",flv:"video/x-flv"}[t]||"video/mp4"},es=({url:r})=>{const t=J(),[s,a]=n.useState(null),[o,i]=n.useState(!0),c=n.useRef(null),l=n.useRef(null);return n.useEffect(()=>{if(!l.current&&c.current){const f=document.createElement("video-js");f.classList.add("vjs-big-play-centered","vjs-theme-apple"),c.current.appendChild(f);const d=Qn(r),p=Gr(f,{controls:!0,fill:!0,preload:"auto",controlBar:{children:["playToggle","volumePanel","currentTimeDisplay","timeDivider","durationDisplay","progressControl","remainingTimeDisplay","fullscreenToggle"],volumePanel:{inline:!1}},html5:{vhs:{overrideNative:!0},nativeVideoTracks:!1,nativeAudioTracks:!1,nativeTextTracks:!1},sources:d==="video/quicktime"?[{src:r,type:"video/quicktime"},{src:r,type:"video/mp4"}]:[{src:r,type:d}]}),h=p.el().querySelector("video");h&&(h.style.objectFit="contain"),p.on("loadeddata",()=>{i(!1)}),p.on("error",()=>{const m=p.error();console.error("Video.js error:",m),a(t("video.load_failed_with_error",{error:(m==null?void 0:m.message)||t("common.unknown_error")})),i(!1)}),l.current=p}},[r]),n.useEffect(()=>{const f=l.current;return()=>{f&&!f.isDisposed()&&(f.dispose(),l.current=null)}},[]),s?e.jsx("div",{className:"rfp-flex rfp-items-center rfp-justify-center rfp-w-full rfp-h-full",children:e.jsxs("div",{className:"rfp-text-center",children:[e.jsx("div",{className:"rfp-w-16 rfp-h-16 rfp-mx-auto rfp-mb-4 rfp-rounded-full rfp-bg-red-500/10 rfp-flex rfp-items-center rfp-justify-center",children:e.jsx("svg",{className:"rfp-w-8 rfp-h-8 rfp-text-red-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),e.jsx("p",{className:"rfp-text-lg rfp-font-medium rfp-text-fg-primary rfp-mb-2",children:t("video.load_failed")}),e.jsx("p",{className:"rfp-text-sm rfp-text-fg-tertiary",children:s})]})}):e.jsx("div",{className:"rfp-flex rfp-items-center rfp-justify-center rfp-w-full rfp-h-full",children:e.jsxs("div",{className:"rfp-w-full rfp-h-full rfp-relative",children:[o&&e.jsx("div",{className:"rfp-absolute rfp-inset-0 rfp-flex rfp-items-center rfp-justify-center rfp-bg-surface-3 rfp-backdrop-blur-sm rfp-z-10",children:e.jsxs("div",{className:"rfp-text-center",children:[e.jsx("div",{className:"rfp-w-12 rfp-h-12 rfp-mx-auto rfp-mb-3 rfp-border-3 rfp-border-line-strong rfp-border-t-spinner-head rfp-rounded-full rfp-animate-spin"}),e.jsx("p",{className:"rfp-text-sm rfp-text-fg-secondary rfp-font-medium",children:t("video.loading")})]})}),e.jsx("div",{ref:c,className:"rfp-overflow-hidden rfp-w-full rfp-h-full [&_video]:rfp-object-contain",style:{boxShadow:"0 20px 60px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.05)"}})]})})},rs=Object.freeze(Object.defineProperty({__proto__:null,VideoRenderer:es},Symbol.toStringTag,{value:"Module"}));function ts({url:r}){const t=n.useRef(null),[s,a]=n.useState(!1),[o,i]=n.useState(!0),[c,l]=n.useState(0),[f,d]=n.useState(0),[u,p]=n.useState(1),[h,m]=n.useState(!1),[g,x]=n.useState(!1),[b,v]=n.useState(null);n.useEffect(()=>{const j=t.current;if(!j)return;i(!0),v(null);const L=()=>{isNaN(j.currentTime)||l(j.currentTime)},M=()=>{!isNaN(j.duration)&&isFinite(j.duration)&&d(j.duration)},O=()=>{i(!1),M()},W=()=>i(!0),H=()=>{i(!1),a(!0)},I=()=>a(!0),N=()=>a(!1),F=()=>a(!1),C=()=>{v("音频加载失败"),i(!1)};return j.addEventListener("timeupdate",L),j.addEventListener("loadedmetadata",M),j.addEventListener("durationchange",M),j.addEventListener("canplay",O),j.addEventListener("waiting",W),j.addEventListener("playing",H),j.addEventListener("play",I),j.addEventListener("pause",N),j.addEventListener("ended",F),j.addEventListener("error",C),j.readyState>=3?(i(!1),M()):j.readyState>=1&&M(),()=>{j.removeEventListener("timeupdate",L),j.removeEventListener("loadedmetadata",M),j.removeEventListener("durationchange",M),j.removeEventListener("canplay",O),j.removeEventListener("waiting",W),j.removeEventListener("playing",H),j.removeEventListener("play",I),j.removeEventListener("pause",N),j.removeEventListener("ended",F),j.removeEventListener("error",C)}},[r]);const y=n.useCallback(()=>{const j=t.current;j&&(j.paused?j.play().catch(()=>{}):j.pause())},[]),w=n.useCallback(j=>{const L=t.current;L&&(L.currentTime=j,l(j))},[]),T=n.useCallback(j=>{const L=t.current;L&&(L.currentTime=Math.max(0,Math.min(L.currentTime+j,L.duration||1/0)))},[]),S=n.useCallback(j=>{const L=t.current;if(!L)return;const M=Math.max(0,Math.min(1,j));L.volume=M,p(M),M>0&&(L.muted=!1,m(!1))},[]),k=n.useCallback(()=>{const j=t.current;j&&(j.muted=!j.muted,m(j.muted))},[]),_=n.useCallback(()=>{const j=t.current;if(!j)return;const L=!j.loop;j.loop=L,x(L)},[]),R=n.useCallback(j=>{if(!isFinite(j)||isNaN(j)||j<0)return"0:00";const L=Math.floor(j/60),M=Math.floor(j%60);return`${L}:${M.toString().padStart(2,"0")}`},[]);return{audioRef:t,isPlaying:s,isLoading:o,isLoop:g,currentTime:c,duration:f,volume:u,isMuted:h,error:b,togglePlay:y,seek:w,skip:T,setVolume:S,toggleMute:k,toggleLoop:_,formatTime:R}}const ns=({text:r,className:t="",style:s})=>{const a=n.useRef(null),o=n.useRef(null),[i,c]=n.useState(!1),[l,f]=n.useState(0);n.useEffect(()=>{const h=()=>{const g=a.current,x=o.current;if(!g||!x)return;const b=g.clientWidth,v=x.scrollWidth;c(v>b),f(v)};h();const m=new ResizeObserver(h);return a.current&&m.observe(a.current),()=>m.disconnect()},[r]);const d=60,u=l+d,p=u/40;return e.jsxs("div",{ref:a,className:`rfp-overflow-hidden rfp-whitespace-nowrap ${t}`,style:s,children:[i?e.jsxs(re.motion.div,{className:"rfp-inline-flex rfp-whitespace-nowrap",animate:{x:[0,-u]},transition:{duration:p,repeat:1/0,ease:"linear",repeatDelay:1.5},children:[e.jsx("span",{children:r}),e.jsx("span",{style:{width:d},className:"rfp-inline-block"}),e.jsx("span",{children:r})]}):null,e.jsx("div",{ref:o,className:"rfp-whitespace-nowrap",style:i?{position:"absolute",visibility:"hidden",pointerEvents:"none"}:void 0,children:r})]})},ss=({isPlaying:r})=>e.jsx(re.motion.div,{className:"rfp-absolute",style:{top:"-6px",right:"2px",width:"100px",height:"120px",transformOrigin:"76px 16px",zIndex:5},animate:{rotate:r?16:0},transition:{duration:.8,ease:[.4,0,.2,1]},children:e.jsxs("svg",{width:"100",height:"120",viewBox:"0 0 100 120",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsx("circle",{cx:"76",cy:"16",r:"13",fill:"rgba(0,0,0,0.3)"}),e.jsx("circle",{cx:"76",cy:"16",r:"11",fill:"url(#baseGrad)"}),e.jsx("circle",{cx:"76",cy:"16",r:"6",fill:"url(#baseInnerGrad)"}),e.jsx("circle",{cx:"76",cy:"16",r:"2.5",fill:"#222",stroke:"#555",strokeWidth:"0.5"}),e.jsx("path",{d:"M74 22 L56 88",stroke:"url(#armGrad)",strokeWidth:"3.5",strokeLinecap:"round"}),e.jsx("path",{d:"M74.8 22 L56.8 88",stroke:"rgba(255,255,255,0.06)",strokeWidth:"1",strokeLinecap:"round"}),e.jsx("rect",{x:"50",y:"86",width:"12",height:"7",rx:"1.5",fill:"url(#headGrad)"}),e.jsx("rect",{x:"52.5",y:"92",width:"7",height:"9",rx:"1",fill:"url(#cartridgeGrad)"}),e.jsx("line",{x1:"56",y1:"101",x2:"56",y2:"105",stroke:"#bbb",strokeWidth:"1.2",strokeLinecap:"round"}),e.jsx("circle",{cx:"56",cy:"105.5",r:"0.8",fill:"#ddd"}),e.jsxs("defs",{children:[e.jsxs("radialGradient",{id:"baseGrad",cx:"40%",cy:"35%",children:[e.jsx("stop",{offset:"0%",stopColor:"#555"}),e.jsx("stop",{offset:"100%",stopColor:"#1a1a1a"})]}),e.jsxs("radialGradient",{id:"baseInnerGrad",cx:"40%",cy:"35%",children:[e.jsx("stop",{offset:"0%",stopColor:"#666"}),e.jsx("stop",{offset:"100%",stopColor:"#333"})]}),e.jsxs("linearGradient",{id:"armGrad",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:"#555"}),e.jsx("stop",{offset:"50%",stopColor:"#444"}),e.jsx("stop",{offset:"100%",stopColor:"#333"})]}),e.jsxs("linearGradient",{id:"headGrad",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:"#555"}),e.jsx("stop",{offset:"100%",stopColor:"#333"})]}),e.jsxs("linearGradient",{id:"cartridgeGrad",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:"#444"}),e.jsx("stop",{offset:"100%",stopColor:"#222"})]})]})]})}),os=({url:r,fileName:t})=>{const s=J(),{audioRef:a,isPlaying:o,isLoading:i,isLoop:c,currentTime:l,duration:f,volume:d,isMuted:u,error:p,togglePlay:h,seek:m,skip:g,setVolume:x,toggleMute:b,toggleLoop:v,formatTime:y}=ts({url:r}),[w,T]=n.useState(!1),S=n.useRef(null),k=n.useRef(),_=f>0?l/f:0;n.useEffect(()=>{const M=O=>{S.current&&!S.current.contains(O.target)&&T(!1)};return w&&document.addEventListener("mousedown",M),()=>document.removeEventListener("mousedown",M)},[w]);const R=()=>{clearTimeout(k.current),T(!0)},j=()=>{k.current=setTimeout(()=>T(!1),300)},L=u||d===0?E.VolumeX:d<.5?E.Volume1:E.Volume2;return p?e.jsx("div",{className:"rfp-flex rfp-items-center rfp-justify-center rfp-w-full rfp-h-full",children:e.jsx("div",{className:"rfp-text-fg-secondary rfp-text-center",children:e.jsx("p",{className:"rfp-text-lg",children:p})})}):e.jsxs("div",{className:"rfp-flex rfp-flex-col rfp-items-center rfp-justify-center rfp-w-full rfp-h-full rfp-p-4 md:rfp-p-8 rfp-gap-5 md:rfp-gap-8 rfp-select-none",children:[e.jsxs("div",{className:"rfp-relative",style:{width:"260px",height:"240px"},children:[e.jsx(re.motion.div,{className:"rfp-absolute rfp-rounded-full",style:{width:"220px",height:"220px",top:"18px",left:"8px",background:"radial-gradient(circle, rgba(129,140,248,0.12) 0%, transparent 70%)"},animate:o?{scale:[1,1.08,1],opacity:[.5,1,.5]}:{scale:1,opacity:.2},transition:o?{duration:3,repeat:1/0,ease:"easeInOut"}:{duration:.5}}),e.jsxs("div",{className:"rfp-absolute rfp-rounded-full rfp-overflow-hidden",style:{width:"200px",height:"200px",top:"28px",left:"18px",background:`
|
|
48
48
|
radial-gradient(circle at center, transparent 95%, rgba(30,30,30,0.8) 95.5%, #111 97%),
|
|
49
49
|
radial-gradient(circle at center, transparent 38%, rgba(50,50,50,0.5) 38.15%, transparent 38.4%),
|
|
50
50
|
radial-gradient(circle at center, transparent 45%, rgba(50,50,50,0.3) 45.15%, transparent 45.4%),
|
|
@@ -60,8 +60,12 @@
|
|
|
60
60
|
radial-gradient(circle at center, transparent 50%, rgba(0,0,0,0.2) 51%, transparent 52%),
|
|
61
61
|
radial-gradient(circle at center, transparent 70%, rgba(0,0,0,0.3) 71%, transparent 72%),
|
|
62
62
|
radial-gradient(circle at center, transparent 88%, rgba(0,0,0,0.2) 89%, transparent 90%)
|
|
63
|
-
`}}),e.jsx("div",{className:"rfp-absolute rfp-rounded-full",style:{width:"14%",height:"14%",top:"43%",left:"43%",background:"radial-gradient(circle at 40% 40%, #333, #0d0d0d)",boxShadow:"inset 0 1px 3px rgba(0,0,0,0.9), 0 0 2px rgba(0,0,0,0.5)"}})]}),i&&e.jsx(re.motion.div,{className:"rfp-absolute rfp-inset-0 rfp-rounded-full",style:{border:"2px solid rgba(129,140,248,0.3)"},animate:{scale:[1,1.02,1],opacity:[.3,.6,.3]},transition:{duration:1.5,repeat:1/0}})]}),e.jsx(Zs,{isPlaying:o})]}),e.jsxs("div",{className:"rfp-text-center rfp-max-w-sm md:rfp-max-w-md rfp-px-4",children:[e.jsx(Xs,{text:t,className:"rfp-text-lg md:rfp-text-xl rfp-font-medium rfp-mb-1 rfp-text-fg-primary"}),e.jsx("p",{className:"rfp-text-xs rfp-tracking-widest rfp-uppercase rfp-text-accent",children:"Audio"})]}),e.jsxs("div",{className:"rfp-w-full rfp-max-w-sm md:rfp-max-w-md rfp-rounded-2xl rfp-p-4 md:rfp-p-6 rfp-border rfp-bg-surface-1 rfp-border-line-weak",style:{backdropFilter:"blur(16px)"},children:[e.jsxs("div",{className:"rfp-mb-5",children:[e.jsxs("div",{className:"rfp-relative rfp-h-4 rfp-flex rfp-items-center",children:[e.jsx("div",{className:"rfp-absolute rfp-w-full rfp-h-[5px] rfp-rounded-full rfp-bg-surface-2"}),e.jsx("div",{className:"rfp-absolute rfp-h-[5px] rfp-rounded-full rfp-pointer-events-none",style:{width:`${T*100}%`,background:"linear-gradient(90deg, var(--fp-accent), var(--fp-accent-hover))",boxShadow:o?"0 0 8px rgba(129,140,248,0.4)":"none",transition:"width 0.1s linear"}}),e.jsx("input",{type:"range",min:"0",max:f>0?f:l||100,step:"any",value:l,onChange:F=>h(parseFloat(F.target.value)),disabled:f<=0,"aria-label":n("audio.aria.progress"),className:"audio-slider rfp-absolute rfp-w-full"})]}),e.jsxs("div",{className:"rfp-flex rfp-justify-between rfp-text-xs rfp-mt-2.5 rfp-text-fg-tertiary",children:[e.jsx("span",{style:{fontVariantNumeric:"tabular-nums"},children:g(l)}),e.jsx("span",{style:{fontVariantNumeric:"tabular-nums"},children:f>0?g(f):"--:--"})]})]}),e.jsxs("div",{className:"rfp-flex rfp-items-center rfp-justify-center rfp-gap-3",children:[e.jsx(re.motion.button,{onClick:b,whileHover:{scale:1.1},whileTap:{scale:.92},"aria-label":n(p?"audio.aria.loop_off":"audio.aria.loop_on"),className:`rfp-w-9 rfp-h-9 rfp-rounded-full rfp-flex rfp-items-center rfp-justify-center rfp-transition-colors ${p?"rfp-bg-accent-soft rfp-text-accent":"rfp-bg-surface-2 rfp-text-fg-tertiary"}`,children:e.jsx(_.Repeat,{className:"rfp-w-4 rfp-h-4"})}),e.jsx(re.motion.button,{onClick:()=>y(-10),whileHover:{scale:1.1},whileTap:{scale:.92},"aria-label":n("audio.aria.backward_10"),className:"rfp-w-10 rfp-h-10 rfp-rounded-full rfp-flex rfp-items-center rfp-justify-center rfp-transition-colors rfp-bg-surface-2 rfp-text-fg-secondary",children:e.jsx(_.SkipBack,{className:"rfp-w-[18px] rfp-h-[18px]"})}),e.jsx(re.motion.button,{onClick:m,whileHover:{scale:1.06},whileTap:{scale:.94},"aria-label":n(o?"audio.aria.pause":"audio.aria.play"),className:"rfp-w-14 rfp-h-14 rfp-rounded-full rfp-flex rfp-items-center rfp-justify-center",style:{background:"linear-gradient(135deg, var(--fp-accent-hover), var(--fp-accent))",color:"#fff",boxShadow:"0 4px 20px rgba(99,102,241,0.35)"},children:o?e.jsx(_.Pause,{className:"rfp-w-6 rfp-h-6"}):e.jsx(_.Play,{className:"rfp-w-6 rfp-h-6 rfp-ml-0.5"})}),e.jsx(re.motion.button,{onClick:()=>y(10),whileHover:{scale:1.1},whileTap:{scale:.92},"aria-label":n("audio.aria.forward_10"),className:"rfp-w-10 rfp-h-10 rfp-rounded-full rfp-flex rfp-items-center rfp-justify-center rfp-transition-colors rfp-bg-surface-2 rfp-text-fg-secondary",children:e.jsx(_.SkipForward,{className:"rfp-w-[18px] rfp-h-[18px]"})}),e.jsxs("div",{ref:S,className:"rfp-relative",onMouseEnter:D,onMouseLeave:N,children:[e.jsx(re.motion.button,{onClick:w,whileHover:{scale:1.1},whileTap:{scale:.92},"aria-label":n(d?"audio.aria.unmute":"audio.aria.mute"),className:`rfp-w-9 rfp-h-9 rfp-rounded-full rfp-flex rfp-items-center rfp-justify-center rfp-transition-colors ${v?"rfp-bg-accent-soft rfp-text-accent":"rfp-bg-surface-2 rfp-text-fg-secondary"}`,children:e.jsx(E,{className:"rfp-w-4 rfp-h-4"})}),e.jsx(re.AnimatePresence,{children:v&&e.jsx(re.motion.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},transition:{duration:.12},className:"rfp-absolute rfp-bottom-full rfp-mb-2 rfp-rounded-xl rfp-p-3 rfp-border rfp-bg-surface-3 rfp-border-line",style:{left:"50%",marginLeft:"-27px",backdropFilter:"blur(16px)"},onMouseEnter:D,onMouseLeave:N,children:e.jsxs("div",{className:"rfp-flex rfp-flex-col rfp-items-center rfp-gap-2",style:{height:"100px"},children:[e.jsxs("div",{className:"rfp-relative rfp-flex rfp-items-center rfp-justify-center",style:{width:"24px",height:"80px"},children:[e.jsx("div",{className:"rfp-absolute rfp-rounded-full rfp-bg-surface-2",style:{width:"3px",height:"100%"}}),e.jsx("div",{className:"rfp-absolute rfp-bottom-0 rfp-rounded-full rfp-pointer-events-none",style:{width:"3px",height:`${(d?0:u)*100}%`,background:"var(--fp-accent-hover)",transition:"height 0.1s linear"}}),e.jsx("input",{type:"range",min:"0",max:"1",step:"0.01",value:d?0:u,onChange:F=>x(parseFloat(F.target.value)),"aria-label":n("audio.aria.volume"),className:"volume-slider-vertical rfp-absolute",style:{width:"80px",height:"24px",transform:"rotate(-90deg)",transformOrigin:"center center"}})]}),e.jsx("span",{className:"rfp-text-[10px] rfp-tabular-nums rfp-text-fg-tertiary",children:Math.round((d?0:u)*100)})]})})})]})]})]}),e.jsx("audio",{ref:a,src:r,className:"rfp-hidden"})]})},Ys=Object.freeze(Object.defineProperty({__proto__:null,AudioRenderer:Js},Symbol.toStringTag,{value:"Module"}));function Ie(r,t){const n=Nr(),[a,o]=s.useState(""),[i,p]=s.useState(!0);return s.useEffect(()=>{let l=!1;return p(!0),Yr.codeToHtml(r,{lang:t,theme:n==="light"?"github-light":"dark-plus"}).then(f=>{l||(o(f),p(!1))}).catch(()=>{l||(o(""),p(!1))}),()=>{l=!0}},[r,t,n]),{html:a,loading:i}}const Cr=r=>{const[t,n]=s.useState(!1),a=s.useCallback(async()=>{try{await navigator.clipboard.writeText(r)}catch{const o=document.createElement("textarea");o.value=r,document.body.appendChild(o),o.select(),document.execCommand("copy"),document.body.removeChild(o)}n(!0),setTimeout(()=>n(!1),2e3)},[r]);return{copied:t,handleCopy:a}},Ks=({text:r})=>{const t=J(),{copied:n,handleCopy:a}=Cr(r);return e.jsx("button",{onClick:a,className:"rfp-p-1 rfp-rounded rfp-text-fg-muted hover:rfp-text-fg-secondary rfp-transition-colors rfp-flex rfp-items-center rfp-gap-1",title:t(n?"markdown.copied":"markdown.copy_code"),children:n?e.jsx(_.Check,{size:13}):e.jsx(_.Copy,{size:13})})},Qs=({text:r})=>{const t=J(),{copied:n,handleCopy:a}=Cr(r);return e.jsx("button",{onClick:a,className:"rfp-absolute rfp-top-2 rfp-right-2 rfp-p-1.5 rfp-rounded-md rfp-bg-surface-2 hover:rfp-bg-surface-3 rfp-text-fg-tertiary hover:rfp-text-fg-secondary rfp-transition-colors rfp-opacity-0 group-hover:rfp-opacity-100 rfp-border rfp-border-line",title:t(n?"markdown.copied":"markdown.copy_code"),children:n?e.jsx(_.Check,{size:14}):e.jsx(_.Copy,{size:14})})},en=({code:r,lang:t})=>{const{html:n}=Ie(r,t);return e.jsxs("div",{className:"rfp-relative rfp-group rfp-my-4",children:[e.jsxs("div",{className:"rfp-flex rfp-items-center rfp-justify-between rfp-px-4 rfp-py-1.5 rfp-bg-surface-1 rfp-border rfp-border-line-weak rfp-rounded-t-md rfp-border-b-0",children:[e.jsx("span",{className:"rfp-text-xs rfp-text-fg-secondary rfp-font-mono rfp-select-none",children:t}),e.jsx(Ks,{text:r})]}),n?e.jsx("div",{className:"rfp-shiki-wrapper rfp-rounded-b-md rfp-border rfp-border-line-weak rfp-border-t-0 rfp-overflow-x-auto",dangerouslySetInnerHTML:{__html:n}}):e.jsx("pre",{className:"rfp-m-0 rfp-rounded-b-md rfp-border rfp-border-line-weak rfp-border-t-0 rfp-overflow-x-auto rfp-p-4 rfp-bg-code-bg",style:{fontSize:"13px",lineHeight:"1.5"},children:e.jsx("code",{className:"rfp-font-mono rfp-text-code-fg rfp-text-sm",children:r})})]})},rn=({url:r,viewMode:t="preview"})=>{const n=J(),a=se(),[o,i]=s.useState(""),[p,l]=s.useState(!0),[f,u]=s.useState(null),{html:d}=Ie(t==="source"?o:"","markdown");return s.useEffect(()=>{(async()=>{try{l(!0),u(null);const m=await Me(r,{fetcher:a});i(m)}catch(m){u(n("markdown.load_failed")),console.error(m)}finally{l(!1)}})()},[r,a,n]),p?e.jsx("div",{className:"rfp-flex rfp-items-center rfp-justify-center rfp-w-full rfp-h-full",children:e.jsx("div",{className:"rfp-w-12 rfp-h-12 rfp-border-4 rfp-border-line-strong rfp-border-t-spinner-head rfp-rounded-full rfp-animate-spin"})}):f?e.jsx("div",{className:"rfp-flex rfp-items-center rfp-justify-center rfp-w-full rfp-h-full",children:e.jsx("div",{className:"rfp-text-fg-secondary rfp-text-center",children:e.jsx("p",{className:"rfp-text-lg",children:f})})}):t==="source"?e.jsx("div",{className:"rfp-w-full rfp-h-full rfp-overflow-auto rfp-bg-code-bg",children:d?e.jsx("div",{className:"rfp-shiki-wrapper with-line-numbers",dangerouslySetInnerHTML:{__html:d}}):e.jsx("pre",{className:"rfp-p-6 rfp-text-fg-primary rfp-font-mono rfp-text-sm rfp-whitespace-pre-wrap rfp-break-words",children:o})}):e.jsx("div",{className:"rfp-w-full rfp-h-full rfp-overflow-auto rfp-p-6 md:rfp-p-10",children:e.jsx("div",{className:"rfp-max-w-full md:rfp-max-w-4xl rfp-mx-auto",children:e.jsx(Ur,{remarkPlugins:[Gr,Vr],rehypePlugins:[Zr,Xr],components:{code({node:c,inline:m,className:h,children:y,...x}){const w=/language-(\w+)/.exec(h||""),b=String(y).replace(/\n$/,"");return!m&&w?e.jsx(en,{code:b,lang:w[1]}):m?e.jsx("code",{className:"rfp-bg-surface-2 rfp-px-1.5 rfp-py-0.5 rfp-rounded rfp-text-sm rfp-font-mono rfp-text-fg-primary rfp-border rfp-border-line-weak",...x,children:y}):e.jsxs("div",{className:"rfp-relative rfp-group rfp-my-4",children:[e.jsx(Qs,{text:b}),e.jsx("pre",{className:"rfp-m-0 rfp-rounded-md rfp-border rfp-border-line-weak rfp-overflow-x-auto rfp-p-4 rfp-bg-code-bg",style:{fontSize:"13px",lineHeight:"1.5"},children:e.jsx("code",{className:"rfp-font-mono rfp-text-code-fg rfp-text-sm",children:y})})]})},h1:({children:c})=>e.jsx("h1",{className:"rfp-text-3xl rfp-font-semibold rfp-mb-4 rfp-mt-6 rfp-text-fg-primary first:rfp-mt-0",children:c}),h2:({children:c})=>e.jsx("h2",{className:"rfp-text-2xl rfp-font-semibold rfp-mb-3 rfp-mt-8 rfp-text-fg-primary",children:c}),h3:({children:c})=>e.jsx("h3",{className:"rfp-text-xl rfp-font-semibold rfp-mb-2 rfp-mt-6 rfp-text-fg-primary",children:c}),h4:({children:c})=>e.jsx("h4",{className:"rfp-text-lg rfp-font-semibold rfp-mb-2 rfp-mt-4 rfp-text-fg-primary",children:c}),p:({children:c})=>e.jsx("p",{className:"rfp-text-fg-secondary rfp-mb-4 rfp-leading-7 rfp-text-base",children:c}),a:({href:c,children:m})=>e.jsx("a",{href:c,className:"rfp-text-indigo-400 hover:rfp-text-indigo-300 rfp-underline rfp-decoration-indigo-600 hover:rfp-decoration-indigo-400",target:"_blank",rel:"noopener noreferrer",children:m}),ul:({children:c})=>e.jsx("ul",{className:"rfp-list-disc rfp-pl-6 rfp-mb-4 rfp-text-fg-secondary rfp-space-y-1",children:c}),ol:({children:c})=>e.jsx("ol",{className:"rfp-list-decimal rfp-pl-6 rfp-mb-4 rfp-text-fg-secondary rfp-space-y-1",children:c}),li:({children:c})=>e.jsx("li",{className:"rfp-leading-7",children:c}),blockquote:({children:c})=>e.jsx("blockquote",{className:"rfp-border-l-4 rfp-border-line-strong rfp-pl-4 rfp-text-fg-tertiary rfp-my-4 rfp-italic",children:c}),table:({children:c})=>e.jsx("div",{className:"rfp-overflow-x-auto rfp-my-4 rfp-rounded-md rfp-border rfp-border-line",children:e.jsx("table",{className:"rfp-min-w-full rfp-divide-y rfp-divide-divide",children:c})}),thead:({children:c})=>e.jsx("thead",{className:"rfp-bg-surface-1",children:c}),tbody:({children:c})=>e.jsx("tbody",{className:"rfp-divide-y rfp-divide-divide rfp-bg-transparent",children:c}),tr:({children:c})=>e.jsx("tr",{className:"hover:rfp-bg-surface-1 rfp-transition-colors",children:c}),th:({children:c})=>e.jsx("th",{className:"rfp-px-4 rfp-py-3 rfp-text-left rfp-text-xs rfp-font-semibold rfp-text-fg-tertiary rfp-uppercase rfp-tracking-wider",children:c}),td:({children:c})=>e.jsx("td",{className:"rfp-px-4 rfp-py-3 rfp-text-sm rfp-text-fg-secondary",children:c}),hr:()=>e.jsx("hr",{className:"rfp-border-line rfp-my-6"}),img:({src:c,alt:m})=>e.jsx("img",{src:c,alt:m,className:"rfp-rounded-md rfp-max-w-full rfp-h-auto rfp-my-4 rfp-mx-auto rfp-block rfp-shadow-sm"}),input:({type:c,checked:m,...h})=>c==="checkbox"?e.jsx("input",{type:"checkbox",checked:m,readOnly:!0,className:"rfp-mr-2 rfp-rounded rfp-border-line",...h}):e.jsx("input",{type:c,...h}),strong:({children:c})=>e.jsx("strong",{className:"rfp-font-semibold rfp-text-fg-primary",children:c}),em:({children:c})=>e.jsx("em",{className:"rfp-italic",children:c}),del:({children:c})=>e.jsx("del",{className:"rfp-text-fg-muted rfp-line-through",children:c})},children:o})})})},tn=Object.freeze(Object.defineProperty({__proto__:null,MarkdownRenderer:rn},Symbol.toStringTag,{value:"Module"})),sn={key:"#9cdcfe",string:"#ce9178",number:"#b5cea8",keyword:"#569cd6",bracket:"#d4d4d4",colon:"rgb(255 255 255 / 0.6)",collapsed:"rgb(255 255 255 / 0.4)",arrow:"rgb(255 255 255 / 0.5)"},nn={key:"#005cc5",string:"#032f62",number:"#005cc5",keyword:"#d73a49",bracket:"#24292e",colon:"rgb(23 23 23 / 0.6)",collapsed:"rgb(23 23 23 / 0.45)",arrow:"rgb(23 23 23 / 0.55)"},Ge=({keyName:r,value:t,depth:n,defaultExpanded:a,colors:o})=>{const i=J(),[p,l]=s.useState(a),f=n*20,u=s.useCallback(()=>l(x=>!x),[]);if(t==null||typeof t!="object")return e.jsxs("div",{className:"rfp-flex rfp-items-start rfp-py-px rfp-font-mono rfp-text-sm",style:{paddingLeft:`${f}px`},children:[e.jsx("span",{className:"rfp-w-4 rfp-h-5 rfp-flex-shrink-0"}),r!==void 0&&e.jsxs("span",{className:"rfp-flex-shrink-0",style:{color:o.key},children:['"',r,'"',e.jsx("span",{style:{color:o.colon},children:": "})]}),on(t,o)]});const d=Array.isArray(t),m=(d?t:Object.entries(t)).length,h=d?"[":"{",y=d?"]":"}";return m===0?e.jsxs("div",{className:"rfp-flex rfp-items-start rfp-py-px rfp-font-mono rfp-text-sm",style:{paddingLeft:`${f}px`},children:[e.jsx("span",{className:"rfp-w-4 rfp-h-5 rfp-flex-shrink-0"}),r!==void 0&&e.jsxs("span",{className:"rfp-flex-shrink-0",style:{color:o.key},children:['"',r,'"',e.jsx("span",{style:{color:o.colon},children:": "})]}),e.jsxs("span",{style:{color:o.bracket},children:[h,y]})]}):e.jsxs("div",{children:[e.jsxs("div",{className:"rfp-flex rfp-items-start rfp-py-px rfp-font-mono rfp-text-sm rfp-cursor-pointer hover:rfp-bg-surface-1 rfp-select-none",style:{paddingLeft:`${f}px`},onClick:u,children:[e.jsx("span",{className:"rfp-w-4 rfp-h-5 rfp-flex-shrink-0 rfp-flex rfp-items-center rfp-justify-center",style:{color:o.arrow},children:p?e.jsx(_.ChevronDown,{className:"rfp-w-3.5 rfp-h-3.5"}):e.jsx(_.ChevronRight,{className:"rfp-w-3.5 rfp-h-3.5"})}),r!==void 0&&e.jsxs("span",{className:"rfp-flex-shrink-0",style:{color:o.key},children:['"',r,'"',e.jsx("span",{style:{color:o.colon},children:": "})]}),e.jsx("span",{style:{color:o.bracket},children:h}),!p&&e.jsxs("span",{className:"rfp-ml-1",style:{color:o.collapsed},children:[d?`${m} ${i("json.items")}`:`${m} ${i("json.keys")}`,e.jsxs("span",{style:{color:o.bracket},children:[" ",y]})]})]}),p&&e.jsxs(e.Fragment,{children:[d?t.map((x,w)=>e.jsx(Ge,{value:x,depth:n+1,defaultExpanded:n<1,colors:o},w)):Object.entries(t).map(([x,w])=>e.jsx(Ge,{keyName:x,value:w,depth:n+1,defaultExpanded:n<1,colors:o},x)),e.jsx("div",{className:"rfp-font-mono rfp-text-sm rfp-py-px",style:{paddingLeft:`${f+20}px`,color:o.bracket},children:y})]})]})};function on(r,t){return r===null?e.jsx("span",{style:{color:t.keyword,fontStyle:"italic"},children:"null"}):r===void 0?e.jsx("span",{style:{color:t.keyword,fontStyle:"italic"},children:"undefined"}):typeof r=="boolean"?e.jsx("span",{style:{color:t.keyword},children:String(r)}):typeof r=="number"?e.jsx("span",{style:{color:t.number},children:String(r)}):typeof r=="string"?e.jsxs("span",{style:{color:t.string},children:['"',r,'"']}):e.jsx("span",{style:{color:t.bracket},children:String(r)})}function an(r){return r==="light"?nn:sn}const ln=({url:r})=>{const t=J(),n=se(),a=Nr(),o=s.useMemo(()=>an(a),[a]),[i,p]=s.useState(null),[l,f]=s.useState(!0),[u,d]=s.useState(null);return s.useEffect(()=>{(async()=>{try{f(!0),d(null);const m=await Me(r,{fetcher:n});p(JSON.parse(m))}catch(m){d(t("json.load_failed")),console.error(m)}finally{f(!1)}})()},[r]),l?e.jsx("div",{className:"rfp-flex rfp-items-center rfp-justify-center rfp-w-full rfp-h-full",children:e.jsx("div",{className:"rfp-w-12 rfp-h-12 rfp-border-4 rfp-border-line-strong rfp-border-t-spinner-head rfp-rounded-full rfp-animate-spin"})}):u?e.jsx("div",{className:"rfp-flex rfp-items-center rfp-justify-center rfp-w-full rfp-h-full",children:e.jsx("div",{className:"rfp-text-fg-secondary rfp-text-center",children:e.jsx("p",{className:"rfp-text-lg",children:u})})}):e.jsx("div",{className:"rfp-w-full rfp-h-full rfp-overflow-auto rfp-bg-code-bg rfp-py-3 rfp-pr-4",children:e.jsx(Ge,{value:i,depth:0,defaultExpanded:!0,colors:o})})},fn=Object.freeze(Object.defineProperty({__proto__:null,JsonRenderer:ln},Symbol.toStringTag,{value:"Module"})),cn=({url:r,fileName:t})=>{const n=J(),a=se(),[o,i]=s.useState(!0),[p,l]=s.useState(null),f=s.useRef(null),u=s.useRef(null),d=s.useRef(null),c=s.useRef(null),m=s.useRef(null),h=s.useRef({width:0,height:0}),y=s.useCallback(()=>{if(!f.current)return{width:800,height:600};const w=f.current.clientWidth,b=f.current.clientHeight,g=w>100?w:800,v=b>100?b:600;return{width:g,height:v}},[]),x=s.useCallback(()=>{if(!f.current||!d.current)return;f.current.innerHTML="",u.current=null;const{width:w,height:b}=y(),g=w<640,v=new hr(f.current,{mode:"read",showToolbar:!1,showContextmenu:!1,showGrid:!0,row:{len:100,height:25},col:{len:26,width:g?80:100,indexWidth:g?40:60,minWidth:g?40:60},view:{height:()=>b,width:()=>w}});v.loadData(d.current),u.current=v},[y]);return s.useEffect(()=>{if(!f.current)return;let w=!0;const b=()=>{if(w){w=!1,h.current=y();return}const g=y(),v=h.current,k=Math.abs(v.width-g.width),S=Math.abs(v.height-g.height);k<10&&S<10||(h.current=g,m.current&&clearTimeout(m.current),m.current=window.setTimeout(()=>{d.current&&x()},500))};return c.current=new ResizeObserver(()=>{b()}),c.current.observe(f.current),()=>{c.current&&c.current.disconnect(),m.current&&clearTimeout(m.current)}},[y,x]),s.useEffect(()=>{let w=!0;const b=async()=>{if(f.current){i(!0),l(null);try{const v=await Me(r,{fetcher:a}),k=st(v,{delimiter:tt(t)}),S=Ft(k.header,k.rows,t);if(!w)return;d.current=S,x(),i(!1)}catch(v){w&&(console.error("CSV 解析错误:",v),l(n("csv.load_failed")),i(!1))}}},g=setTimeout(()=>{requestAnimationFrame(()=>{b()})},100);return()=>{w=!1,clearTimeout(g),d.current=null,f.current&&(f.current.innerHTML=""),u.current=null}},[r,t,x]),e.jsxs("div",{className:"rfp-relative rfp-flex rfp-flex-col rfp-items-center rfp-w-full rfp-h-full",children:[o&&e.jsx("div",{className:"rfp-absolute rfp-inset-0 rfp-flex rfp-items-center rfp-justify-center rfp-bg-surface-toolbar rfp-backdrop-blur-sm rfp-z-10",children:e.jsxs("div",{className:"rfp-text-center",children:[e.jsx("div",{className:"rfp-w-10 rfp-h-10 md:rfp-w-12 md:rfp-h-12 rfp-mx-auto rfp-mb-3 rfp-border-4 rfp-border-line-strong rfp-border-t-spinner-head rfp-rounded-full rfp-animate-spin"}),e.jsx("p",{className:"rfp-text-xs md:rfp-text-sm rfp-text-fg-secondary rfp-font-medium",children:n("csv.loading")})]})}),p&&!o&&e.jsx("div",{className:"rfp-absolute rfp-inset-0 rfp-flex rfp-items-center rfp-justify-center rfp-bg-surface-toolbar rfp-backdrop-blur-sm rfp-z-10",children:e.jsxs("div",{className:"rfp-text-center rfp-max-w-sm md:rfp-max-w-md rfp-px-4",children:[e.jsx("div",{className:"rfp-w-24 rfp-h-24 md:rfp-w-32 md:rfp-h-32 rfp-mx-auto rfp-mb-4 md:rfp-mb-6 rfp-rounded-2xl md:rfp-rounded-3xl rfp-bg-gradient-to-br rfp-from-green-500 rfp-via-emerald-500 rfp-to-teal-500 rfp-flex rfp-items-center rfp-justify-center rfp-shadow-2xl",children:e.jsx(_.FileSpreadsheet,{className:"rfp-w-12 rfp-h-12 md:rfp-w-16 md:rfp-h-16 rfp-text-fg-primary"})}),e.jsx("p",{className:"rfp-text-lg md:rfp-text-xl rfp-text-fg-primary rfp-mb-2 md:rfp-mb-3 rfp-font-medium",children:n("csv.load_failed")}),e.jsx("p",{className:"rfp-text-xs md:rfp-text-sm rfp-text-fg-tertiary rfp-mb-4 md:rfp-mb-6",children:p})]})}),!p&&e.jsx("div",{ref:f,className:"xlsx-spreadsheet-container rfp-w-full rfp-h-full",style:{opacity:o?0:1}})]})},pn=Object.freeze(Object.defineProperty({__proto__:null,CsvRenderer:cn},Symbol.toStringTag,{value:"Module"})),dn=r=>{try{const n=new DOMParser().parseFromString(r,"application/xml");if(n.querySelector("parsererror"))return r;const i=new XMLSerializer().serializeToString(n);return un(i)}catch{return r}},un=r=>{const t=" ",n=/(>)(<)(\/*)/g;let a=r.replace(n,`$1
|
|
63
|
+
`}}),e.jsx("div",{className:"rfp-absolute rfp-rounded-full",style:{width:"14%",height:"14%",top:"43%",left:"43%",background:"radial-gradient(circle at 40% 40%, #333, #0d0d0d)",boxShadow:"inset 0 1px 3px rgba(0,0,0,0.9), 0 0 2px rgba(0,0,0,0.5)"}})]}),i&&e.jsx(re.motion.div,{className:"rfp-absolute rfp-inset-0 rfp-rounded-full",style:{border:"2px solid rgba(129,140,248,0.3)"},animate:{scale:[1,1.02,1],opacity:[.3,.6,.3]},transition:{duration:1.5,repeat:1/0}})]}),e.jsx(ss,{isPlaying:o})]}),e.jsxs("div",{className:"rfp-text-center rfp-max-w-sm md:rfp-max-w-md rfp-px-4",children:[e.jsx(ns,{text:t,className:"rfp-text-lg md:rfp-text-xl rfp-font-medium rfp-mb-1 rfp-text-fg-primary"}),e.jsx("p",{className:"rfp-text-xs rfp-tracking-widest rfp-uppercase rfp-text-accent",children:"Audio"})]}),e.jsxs("div",{className:"rfp-w-full rfp-max-w-sm md:rfp-max-w-md rfp-rounded-2xl rfp-p-4 md:rfp-p-6 rfp-border rfp-bg-surface-1 rfp-border-line-weak",style:{backdropFilter:"blur(16px)"},children:[e.jsxs("div",{className:"rfp-mb-5",children:[e.jsxs("div",{className:"rfp-relative rfp-h-4 rfp-flex rfp-items-center",children:[e.jsx("div",{className:"rfp-absolute rfp-w-full rfp-h-[5px] rfp-rounded-full rfp-bg-surface-2"}),e.jsx("div",{className:"rfp-absolute rfp-h-[5px] rfp-rounded-full rfp-pointer-events-none",style:{width:`${_*100}%`,background:"linear-gradient(90deg, var(--fp-accent), var(--fp-accent-hover))",boxShadow:o?"0 0 8px rgba(129,140,248,0.4)":"none",transition:"width 0.1s linear"}}),e.jsx("input",{type:"range",min:"0",max:f>0?f:l||100,step:"any",value:l,onChange:M=>m(parseFloat(M.target.value)),disabled:f<=0,"aria-label":s("audio.aria.progress"),className:"audio-slider rfp-absolute rfp-w-full"})]}),e.jsxs("div",{className:"rfp-flex rfp-justify-between rfp-text-xs rfp-mt-2.5 rfp-text-fg-tertiary",children:[e.jsx("span",{style:{fontVariantNumeric:"tabular-nums"},children:y(l)}),e.jsx("span",{style:{fontVariantNumeric:"tabular-nums"},children:f>0?y(f):"--:--"})]})]}),e.jsxs("div",{className:"rfp-flex rfp-items-center rfp-justify-center rfp-gap-3",children:[e.jsx(re.motion.button,{onClick:v,whileHover:{scale:1.1},whileTap:{scale:.92},"aria-label":s(c?"audio.aria.loop_off":"audio.aria.loop_on"),className:`rfp-w-9 rfp-h-9 rfp-rounded-full rfp-flex rfp-items-center rfp-justify-center rfp-transition-colors ${c?"rfp-bg-accent-soft rfp-text-accent":"rfp-bg-surface-2 rfp-text-fg-tertiary"}`,children:e.jsx(E.Repeat,{className:"rfp-w-4 rfp-h-4"})}),e.jsx(re.motion.button,{onClick:()=>g(-10),whileHover:{scale:1.1},whileTap:{scale:.92},"aria-label":s("audio.aria.backward_10"),className:"rfp-w-10 rfp-h-10 rfp-rounded-full rfp-flex rfp-items-center rfp-justify-center rfp-transition-colors rfp-bg-surface-2 rfp-text-fg-secondary",children:e.jsx(E.SkipBack,{className:"rfp-w-[18px] rfp-h-[18px]"})}),e.jsx(re.motion.button,{onClick:h,whileHover:{scale:1.06},whileTap:{scale:.94},"aria-label":s(o?"audio.aria.pause":"audio.aria.play"),className:"rfp-w-14 rfp-h-14 rfp-rounded-full rfp-flex rfp-items-center rfp-justify-center",style:{background:"linear-gradient(135deg, var(--fp-accent-hover), var(--fp-accent))",color:"#fff",boxShadow:"0 4px 20px rgba(99,102,241,0.35)"},children:o?e.jsx(E.Pause,{className:"rfp-w-6 rfp-h-6"}):e.jsx(E.Play,{className:"rfp-w-6 rfp-h-6 rfp-ml-0.5"})}),e.jsx(re.motion.button,{onClick:()=>g(10),whileHover:{scale:1.1},whileTap:{scale:.92},"aria-label":s("audio.aria.forward_10"),className:"rfp-w-10 rfp-h-10 rfp-rounded-full rfp-flex rfp-items-center rfp-justify-center rfp-transition-colors rfp-bg-surface-2 rfp-text-fg-secondary",children:e.jsx(E.SkipForward,{className:"rfp-w-[18px] rfp-h-[18px]"})}),e.jsxs("div",{ref:S,className:"rfp-relative",onMouseEnter:R,onMouseLeave:j,children:[e.jsx(re.motion.button,{onClick:b,whileHover:{scale:1.1},whileTap:{scale:.92},"aria-label":s(u?"audio.aria.unmute":"audio.aria.mute"),className:`rfp-w-9 rfp-h-9 rfp-rounded-full rfp-flex rfp-items-center rfp-justify-center rfp-transition-colors ${w?"rfp-bg-accent-soft rfp-text-accent":"rfp-bg-surface-2 rfp-text-fg-secondary"}`,children:e.jsx(L,{className:"rfp-w-4 rfp-h-4"})}),e.jsx(re.AnimatePresence,{children:w&&e.jsx(re.motion.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},transition:{duration:.12},className:"rfp-absolute rfp-bottom-full rfp-mb-2 rfp-rounded-xl rfp-p-3 rfp-border rfp-bg-surface-3 rfp-border-line",style:{left:"50%",marginLeft:"-27px",backdropFilter:"blur(16px)"},onMouseEnter:R,onMouseLeave:j,children:e.jsxs("div",{className:"rfp-flex rfp-flex-col rfp-items-center rfp-gap-2",style:{height:"100px"},children:[e.jsxs("div",{className:"rfp-relative rfp-flex rfp-items-center rfp-justify-center",style:{width:"24px",height:"80px"},children:[e.jsx("div",{className:"rfp-absolute rfp-rounded-full rfp-bg-surface-2",style:{width:"3px",height:"100%"}}),e.jsx("div",{className:"rfp-absolute rfp-bottom-0 rfp-rounded-full rfp-pointer-events-none",style:{width:"3px",height:`${(u?0:d)*100}%`,background:"var(--fp-accent-hover)",transition:"height 0.1s linear"}}),e.jsx("input",{type:"range",min:"0",max:"1",step:"0.01",value:u?0:d,onChange:M=>x(parseFloat(M.target.value)),"aria-label":s("audio.aria.volume"),className:"volume-slider-vertical rfp-absolute",style:{width:"80px",height:"24px",transform:"rotate(-90deg)",transformOrigin:"center center"}})]}),e.jsx("span",{className:"rfp-text-[10px] rfp-tabular-nums rfp-text-fg-tertiary",children:Math.round((u?0:d)*100)})]})})})]})]})]}),e.jsx("audio",{ref:a,src:r,className:"rfp-hidden"})]})},as=Object.freeze(Object.defineProperty({__proto__:null,AudioRenderer:os},Symbol.toStringTag,{value:"Module"}));function We(r,t){const s=Ke(),[a,o]=n.useState(""),[i,c]=n.useState(!0);return n.useEffect(()=>{let l=!1;return c(!0),Kr.codeToHtml(r,{lang:t,theme:s==="light"?"github-light":"dark-plus"}).then(f=>{l||(o(f),c(!1))}).catch(()=>{l||(o(""),c(!1))}),()=>{l=!0}},[r,t,s]),{html:a,loading:i}}const Fr=r=>{const[t,s]=n.useState(!1),a=n.useCallback(async()=>{try{await navigator.clipboard.writeText(r)}catch{const o=document.createElement("textarea");o.value=r,document.body.appendChild(o),o.select(),document.execCommand("copy"),document.body.removeChild(o)}s(!0),setTimeout(()=>s(!1),2e3)},[r]);return{copied:t,handleCopy:a}},is=({text:r})=>{const t=J(),{copied:s,handleCopy:a}=Fr(r);return e.jsx("button",{onClick:a,className:"rfp-p-1 rfp-rounded rfp-text-fg-muted hover:rfp-text-fg-secondary rfp-transition-colors rfp-flex rfp-items-center rfp-gap-1",title:t(s?"markdown.copied":"markdown.copy_code"),children:s?e.jsx(E.Check,{size:13}):e.jsx(E.Copy,{size:13})})},ls=({text:r})=>{const t=J(),{copied:s,handleCopy:a}=Fr(r);return e.jsx("button",{onClick:a,className:"rfp-absolute rfp-top-2 rfp-right-2 rfp-p-1.5 rfp-rounded-md rfp-bg-surface-2 hover:rfp-bg-surface-3 rfp-text-fg-tertiary hover:rfp-text-fg-secondary rfp-transition-colors rfp-opacity-0 group-hover:rfp-opacity-100 rfp-border rfp-border-line",title:t(s?"markdown.copied":"markdown.copy_code"),children:s?e.jsx(E.Check,{size:14}):e.jsx(E.Copy,{size:14})})},fs=({code:r,lang:t})=>{const{html:s}=We(r,t);return e.jsxs("div",{className:"rfp-relative rfp-group rfp-my-4",children:[e.jsxs("div",{className:"rfp-flex rfp-items-center rfp-justify-between rfp-px-4 rfp-py-1.5 rfp-bg-surface-1 rfp-border rfp-border-line-weak rfp-rounded-t-md rfp-border-b-0",children:[e.jsx("span",{className:"rfp-text-xs rfp-text-fg-secondary rfp-font-mono rfp-select-none",children:t}),e.jsx(is,{text:r})]}),s?e.jsx("div",{className:"rfp-shiki-wrapper rfp-rounded-b-md rfp-border rfp-border-line-weak rfp-border-t-0 rfp-overflow-x-auto",dangerouslySetInnerHTML:{__html:s}}):e.jsx("pre",{className:"rfp-m-0 rfp-rounded-b-md rfp-border rfp-border-line-weak rfp-border-t-0 rfp-overflow-x-auto rfp-p-4 rfp-bg-code-bg",style:{fontSize:"13px",lineHeight:"1.5"},children:e.jsx("code",{className:"rfp-font-mono rfp-text-code-fg rfp-text-sm",children:r})})]})},cs=({url:r,viewMode:t="preview"})=>{const s=J(),a=te(),[o,i]=n.useState(""),[c,l]=n.useState(!0),[f,d]=n.useState(null),{html:u}=We(t==="source"?o:"","markdown");return n.useEffect(()=>{(async()=>{try{l(!0),d(null);const h=await Re(r,{fetcher:a});i(h)}catch(h){d(s("markdown.load_failed")),console.error(h)}finally{l(!1)}})()},[r,a,s]),c?e.jsx("div",{className:"rfp-flex rfp-items-center rfp-justify-center rfp-w-full rfp-h-full",children:e.jsx("div",{className:"rfp-w-12 rfp-h-12 rfp-border-4 rfp-border-line-strong rfp-border-t-spinner-head rfp-rounded-full rfp-animate-spin"})}):f?e.jsx("div",{className:"rfp-flex rfp-items-center rfp-justify-center rfp-w-full rfp-h-full",children:e.jsx("div",{className:"rfp-text-fg-secondary rfp-text-center",children:e.jsx("p",{className:"rfp-text-lg",children:f})})}):t==="source"?e.jsx("div",{className:"rfp-w-full rfp-h-full rfp-overflow-auto rfp-bg-code-bg",children:u?e.jsx("div",{className:"rfp-shiki-wrapper with-line-numbers",dangerouslySetInnerHTML:{__html:u}}):e.jsx("pre",{className:"rfp-p-6 rfp-text-fg-primary rfp-font-mono rfp-text-sm rfp-whitespace-pre-wrap rfp-break-words",children:o})}):e.jsx("div",{className:"rfp-w-full rfp-h-full rfp-overflow-auto rfp-p-6 md:rfp-p-10",children:e.jsx("div",{className:"rfp-max-w-full md:rfp-max-w-4xl rfp-mx-auto",children:e.jsx(Vr,{remarkPlugins:[Xr,Zr],rehypePlugins:[Yr,Jr],components:{code({node:p,inline:h,className:m,children:g,...x}){const b=/language-(\w+)/.exec(m||""),v=String(g).replace(/\n$/,"");return!h&&b?e.jsx(fs,{code:v,lang:b[1]}):h?e.jsx("code",{className:"rfp-bg-surface-2 rfp-px-1.5 rfp-py-0.5 rfp-rounded rfp-text-sm rfp-font-mono rfp-text-fg-primary rfp-border rfp-border-line-weak",...x,children:g}):e.jsxs("div",{className:"rfp-relative rfp-group rfp-my-4",children:[e.jsx(ls,{text:v}),e.jsx("pre",{className:"rfp-m-0 rfp-rounded-md rfp-border rfp-border-line-weak rfp-overflow-x-auto rfp-p-4 rfp-bg-code-bg",style:{fontSize:"13px",lineHeight:"1.5"},children:e.jsx("code",{className:"rfp-font-mono rfp-text-code-fg rfp-text-sm",children:g})})]})},h1:({children:p})=>e.jsx("h1",{className:"rfp-text-3xl rfp-font-semibold rfp-mb-4 rfp-mt-6 rfp-text-fg-primary first:rfp-mt-0",children:p}),h2:({children:p})=>e.jsx("h2",{className:"rfp-text-2xl rfp-font-semibold rfp-mb-3 rfp-mt-8 rfp-text-fg-primary",children:p}),h3:({children:p})=>e.jsx("h3",{className:"rfp-text-xl rfp-font-semibold rfp-mb-2 rfp-mt-6 rfp-text-fg-primary",children:p}),h4:({children:p})=>e.jsx("h4",{className:"rfp-text-lg rfp-font-semibold rfp-mb-2 rfp-mt-4 rfp-text-fg-primary",children:p}),p:({children:p})=>e.jsx("p",{className:"rfp-text-fg-secondary rfp-mb-4 rfp-leading-7 rfp-text-base",children:p}),a:({href:p,children:h})=>e.jsx("a",{href:p,className:"rfp-text-indigo-400 hover:rfp-text-indigo-300 rfp-underline rfp-decoration-indigo-600 hover:rfp-decoration-indigo-400",target:"_blank",rel:"noopener noreferrer",children:h}),ul:({children:p})=>e.jsx("ul",{className:"rfp-list-disc rfp-pl-6 rfp-mb-4 rfp-text-fg-secondary rfp-space-y-1",children:p}),ol:({children:p})=>e.jsx("ol",{className:"rfp-list-decimal rfp-pl-6 rfp-mb-4 rfp-text-fg-secondary rfp-space-y-1",children:p}),li:({children:p})=>e.jsx("li",{className:"rfp-leading-7",children:p}),blockquote:({children:p})=>e.jsx("blockquote",{className:"rfp-border-l-4 rfp-border-line-strong rfp-pl-4 rfp-text-fg-tertiary rfp-my-4 rfp-italic",children:p}),table:({children:p})=>e.jsx("div",{className:"rfp-overflow-x-auto rfp-my-4 rfp-rounded-md rfp-border rfp-border-line",children:e.jsx("table",{className:"rfp-min-w-full rfp-divide-y rfp-divide-divide",children:p})}),thead:({children:p})=>e.jsx("thead",{className:"rfp-bg-surface-1",children:p}),tbody:({children:p})=>e.jsx("tbody",{className:"rfp-divide-y rfp-divide-divide rfp-bg-transparent",children:p}),tr:({children:p})=>e.jsx("tr",{className:"hover:rfp-bg-surface-1 rfp-transition-colors",children:p}),th:({children:p})=>e.jsx("th",{className:"rfp-px-4 rfp-py-3 rfp-text-left rfp-text-xs rfp-font-semibold rfp-text-fg-tertiary rfp-uppercase rfp-tracking-wider",children:p}),td:({children:p})=>e.jsx("td",{className:"rfp-px-4 rfp-py-3 rfp-text-sm rfp-text-fg-secondary",children:p}),hr:()=>e.jsx("hr",{className:"rfp-border-line rfp-my-6"}),img:({src:p,alt:h})=>e.jsx("img",{src:p,alt:h,className:"rfp-rounded-md rfp-max-w-full rfp-h-auto rfp-my-4 rfp-mx-auto rfp-block rfp-shadow-sm"}),input:({type:p,checked:h,...m})=>p==="checkbox"?e.jsx("input",{type:"checkbox",checked:h,readOnly:!0,className:"rfp-mr-2 rfp-rounded rfp-border-line",...m}):e.jsx("input",{type:p,...m}),strong:({children:p})=>e.jsx("strong",{className:"rfp-font-semibold rfp-text-fg-primary",children:p}),em:({children:p})=>e.jsx("em",{className:"rfp-italic",children:p}),del:({children:p})=>e.jsx("del",{className:"rfp-text-fg-muted rfp-line-through",children:p})},children:o})})})},ps=Object.freeze(Object.defineProperty({__proto__:null,MarkdownRenderer:cs},Symbol.toStringTag,{value:"Module"})),ds={key:"#9cdcfe",string:"#ce9178",number:"#b5cea8",keyword:"#569cd6",bracket:"#d4d4d4",colon:"rgb(255 255 255 / 0.6)",collapsed:"rgb(255 255 255 / 0.4)",arrow:"rgb(255 255 255 / 0.5)"},us={key:"#005cc5",string:"#032f62",number:"#005cc5",keyword:"#d73a49",bracket:"#24292e",colon:"rgb(23 23 23 / 0.6)",collapsed:"rgb(23 23 23 / 0.45)",arrow:"rgb(23 23 23 / 0.55)"},Ve=({keyName:r,value:t,depth:s,defaultExpanded:a,colors:o})=>{const i=J(),[c,l]=n.useState(a),f=s*20,d=n.useCallback(()=>l(x=>!x),[]);if(t==null||typeof t!="object")return e.jsxs("div",{className:"rfp-flex rfp-items-start rfp-py-px rfp-font-mono rfp-text-sm",style:{paddingLeft:`${f}px`},children:[e.jsx("span",{className:"rfp-w-4 rfp-h-5 rfp-flex-shrink-0"}),r!==void 0&&e.jsxs("span",{className:"rfp-flex-shrink-0",style:{color:o.key},children:['"',r,'"',e.jsx("span",{style:{color:o.colon},children:": "})]}),ms(t,o)]});const u=Array.isArray(t),h=(u?t:Object.entries(t)).length,m=u?"[":"{",g=u?"]":"}";return h===0?e.jsxs("div",{className:"rfp-flex rfp-items-start rfp-py-px rfp-font-mono rfp-text-sm",style:{paddingLeft:`${f}px`},children:[e.jsx("span",{className:"rfp-w-4 rfp-h-5 rfp-flex-shrink-0"}),r!==void 0&&e.jsxs("span",{className:"rfp-flex-shrink-0",style:{color:o.key},children:['"',r,'"',e.jsx("span",{style:{color:o.colon},children:": "})]}),e.jsxs("span",{style:{color:o.bracket},children:[m,g]})]}):e.jsxs("div",{children:[e.jsxs("div",{className:"rfp-flex rfp-items-start rfp-py-px rfp-font-mono rfp-text-sm rfp-cursor-pointer hover:rfp-bg-surface-1 rfp-select-none",style:{paddingLeft:`${f}px`},onClick:d,children:[e.jsx("span",{className:"rfp-w-4 rfp-h-5 rfp-flex-shrink-0 rfp-flex rfp-items-center rfp-justify-center",style:{color:o.arrow},children:c?e.jsx(E.ChevronDown,{className:"rfp-w-3.5 rfp-h-3.5"}):e.jsx(E.ChevronRight,{className:"rfp-w-3.5 rfp-h-3.5"})}),r!==void 0&&e.jsxs("span",{className:"rfp-flex-shrink-0",style:{color:o.key},children:['"',r,'"',e.jsx("span",{style:{color:o.colon},children:": "})]}),e.jsx("span",{style:{color:o.bracket},children:m}),!c&&e.jsxs("span",{className:"rfp-ml-1",style:{color:o.collapsed},children:[u?`${h} ${i("json.items")}`:`${h} ${i("json.keys")}`,e.jsxs("span",{style:{color:o.bracket},children:[" ",g]})]})]}),c&&e.jsxs(e.Fragment,{children:[u?t.map((x,b)=>e.jsx(Ve,{value:x,depth:s+1,defaultExpanded:s<1,colors:o},b)):Object.entries(t).map(([x,b])=>e.jsx(Ve,{keyName:x,value:b,depth:s+1,defaultExpanded:s<1,colors:o},x)),e.jsx("div",{className:"rfp-font-mono rfp-text-sm rfp-py-px",style:{paddingLeft:`${f+20}px`,color:o.bracket},children:g})]})]})};function ms(r,t){return r===null?e.jsx("span",{style:{color:t.keyword,fontStyle:"italic"},children:"null"}):r===void 0?e.jsx("span",{style:{color:t.keyword,fontStyle:"italic"},children:"undefined"}):typeof r=="boolean"?e.jsx("span",{style:{color:t.keyword},children:String(r)}):typeof r=="number"?e.jsx("span",{style:{color:t.number},children:String(r)}):typeof r=="string"?e.jsxs("span",{style:{color:t.string},children:['"',r,'"']}):e.jsx("span",{style:{color:t.bracket},children:String(r)})}function hs(r){return r==="light"?us:ds}const xs=({url:r})=>{const t=J(),s=te(),a=Ke(),o=n.useMemo(()=>hs(a),[a]),[i,c]=n.useState(null),[l,f]=n.useState(!0),[d,u]=n.useState(null);return n.useEffect(()=>{(async()=>{try{f(!0),u(null);const h=await Re(r,{fetcher:s});c(JSON.parse(h))}catch(h){u(t("json.load_failed")),console.error(h)}finally{f(!1)}})()},[r]),l?e.jsx("div",{className:"rfp-flex rfp-items-center rfp-justify-center rfp-w-full rfp-h-full",children:e.jsx("div",{className:"rfp-w-12 rfp-h-12 rfp-border-4 rfp-border-line-strong rfp-border-t-spinner-head rfp-rounded-full rfp-animate-spin"})}):d?e.jsx("div",{className:"rfp-flex rfp-items-center rfp-justify-center rfp-w-full rfp-h-full",children:e.jsx("div",{className:"rfp-text-fg-secondary rfp-text-center",children:e.jsx("p",{className:"rfp-text-lg",children:d})})}):e.jsx("div",{className:"rfp-w-full rfp-h-full rfp-overflow-auto rfp-bg-code-bg rfp-py-3 rfp-pr-4",children:e.jsx(Ve,{value:i,depth:0,defaultExpanded:!0,colors:o})})},gs=Object.freeze(Object.defineProperty({__proto__:null,JsonRenderer:xs},Symbol.toStringTag,{value:"Module"})),bs=({url:r,fileName:t})=>{const s=J(),a=te(),[o,i]=n.useState(!0),[c,l]=n.useState(null),f=n.useRef(null),d=n.useRef(null),u=n.useRef(null),p=n.useRef(null),h=n.useRef(null),m=n.useRef({width:0,height:0}),g=n.useCallback(()=>{if(!f.current)return{width:800,height:600};const b=f.current.clientWidth,v=f.current.clientHeight,y=b>100?b:800,w=v>100?v:600;return{width:y,height:w}},[]),x=n.useCallback(()=>{if(!f.current||!u.current)return;f.current.innerHTML="",d.current=null;const{width:b,height:v}=g(),y=b<640,w=new br(f.current,{mode:"read",showToolbar:!1,showContextmenu:!1,showGrid:!0,row:{len:100,height:25},col:{len:26,width:y?80:100,indexWidth:y?40:60,minWidth:y?40:60},view:{height:()=>v,width:()=>b}});w.loadData(u.current),d.current=w},[g]);return n.useEffect(()=>{if(!f.current)return;let b=!0;const v=()=>{if(b){b=!1,m.current=g();return}const y=g(),w=m.current,T=Math.abs(w.width-y.width),S=Math.abs(w.height-y.height);T<10&&S<10||(m.current=y,h.current&&clearTimeout(h.current),h.current=window.setTimeout(()=>{u.current&&x()},500))};return p.current=new ResizeObserver(()=>{v()}),p.current.observe(f.current),()=>{p.current&&p.current.disconnect(),h.current&&clearTimeout(h.current)}},[g,x]),n.useEffect(()=>{let b=!0;const v=async()=>{if(f.current){i(!0),l(null);try{const w=await Re(r,{fetcher:a}),T=lt(w,{delimiter:it(t)}),S=Dt(T.header,T.rows,t);if(!b)return;u.current=S,x(),i(!1)}catch(w){b&&(console.error("CSV 解析错误:",w),l(s("csv.load_failed")),i(!1))}}},y=setTimeout(()=>{requestAnimationFrame(()=>{v()})},100);return()=>{b=!1,clearTimeout(y),u.current=null,f.current&&(f.current.innerHTML=""),d.current=null}},[r,t,x]),e.jsxs("div",{className:"rfp-relative rfp-flex rfp-flex-col rfp-items-center rfp-w-full rfp-h-full",children:[o&&e.jsx("div",{className:"rfp-absolute rfp-inset-0 rfp-flex rfp-items-center rfp-justify-center rfp-bg-surface-toolbar rfp-backdrop-blur-sm rfp-z-10",children:e.jsxs("div",{className:"rfp-text-center",children:[e.jsx("div",{className:"rfp-w-10 rfp-h-10 md:rfp-w-12 md:rfp-h-12 rfp-mx-auto rfp-mb-3 rfp-border-4 rfp-border-line-strong rfp-border-t-spinner-head rfp-rounded-full rfp-animate-spin"}),e.jsx("p",{className:"rfp-text-xs md:rfp-text-sm rfp-text-fg-secondary rfp-font-medium",children:s("csv.loading")})]})}),c&&!o&&e.jsx("div",{className:"rfp-absolute rfp-inset-0 rfp-flex rfp-items-center rfp-justify-center rfp-bg-surface-toolbar rfp-backdrop-blur-sm rfp-z-10",children:e.jsxs("div",{className:"rfp-text-center rfp-max-w-sm md:rfp-max-w-md rfp-px-4",children:[e.jsx("div",{className:"rfp-w-24 rfp-h-24 md:rfp-w-32 md:rfp-h-32 rfp-mx-auto rfp-mb-4 md:rfp-mb-6 rfp-rounded-2xl md:rfp-rounded-3xl rfp-bg-gradient-to-br rfp-from-green-500 rfp-via-emerald-500 rfp-to-teal-500 rfp-flex rfp-items-center rfp-justify-center rfp-shadow-2xl",children:e.jsx(E.FileSpreadsheet,{className:"rfp-w-12 rfp-h-12 md:rfp-w-16 md:rfp-h-16 rfp-text-fg-primary"})}),e.jsx("p",{className:"rfp-text-lg md:rfp-text-xl rfp-text-fg-primary rfp-mb-2 md:rfp-mb-3 rfp-font-medium",children:s("csv.load_failed")}),e.jsx("p",{className:"rfp-text-xs md:rfp-text-sm rfp-text-fg-tertiary rfp-mb-4 md:rfp-mb-6",children:c})]})}),!c&&e.jsx("div",{ref:f,className:"xlsx-spreadsheet-container rfp-w-full rfp-h-full",style:{opacity:o?0:1}})]})},ys=Object.freeze(Object.defineProperty({__proto__:null,CsvRenderer:bs},Symbol.toStringTag,{value:"Module"})),ws=r=>{try{const s=new DOMParser().parseFromString(r,"application/xml");if(s.querySelector("parsererror"))return r;const i=new XMLSerializer().serializeToString(s);return vs(i)}catch{return r}},vs=r=>{const t=" ",s=/(>)(<)(\/*)/g;let a=r.replace(s,`$1
|
|
64
64
|
$2$3`),o=0;return a.split(`
|
|
65
|
-
`).map(i=>{let
|
|
66
|
-
`)},mn=({url:r})=>{const t=J(),n=se(),[a,o]=s.useState(""),[i,p]=s.useState(!0),[l,f]=s.useState(null),{html:u}=Ie(a,"xml");return s.useEffect(()=>{(async()=>{try{p(!0),f(null);const c=await Me(r,{fetcher:n});o(dn(c))}catch(c){console.error(c),f(t("xml.load_failed"))}finally{p(!1)}})()},[r]),i?e.jsx("div",{className:"rfp-flex rfp-items-center rfp-justify-center rfp-w-full rfp-h-full",children:e.jsx("div",{className:"rfp-w-12 rfp-h-12 rfp-border-4 rfp-border-line-strong rfp-border-t-spinner-head rfp-rounded-full rfp-animate-spin"})}):l?e.jsx("div",{className:"rfp-flex rfp-items-center rfp-justify-center rfp-w-full rfp-h-full",children:e.jsx("div",{className:"rfp-text-fg-secondary rfp-text-center",children:e.jsx("p",{className:"rfp-text-lg",children:l})})}):e.jsx("div",{className:"rfp-w-full rfp-h-full rfp-overflow-auto rfp-bg-code-bg",children:u?e.jsx("div",{className:"rfp-shiki-wrapper with-line-numbers",dangerouslySetInnerHTML:{__html:u}}):e.jsx("pre",{className:"rfp-p-6 rfp-text-fg-primary rfp-font-mono rfp-text-sm rfp-whitespace-pre-wrap rfp-break-words",children:a})})},hn=Object.freeze(Object.defineProperty({__proto__:null,XmlRenderer:mn},Symbol.toStringTag,{value:"Module"})),xn={srt:"srt",vtt:"vtt",lrc:"lrc",elrc:"elrc",ass:"ass",ssa:"ssa",ttml:"ttml",dfxp:"ttml"},bn=r=>{var n;const t=((n=r.split(".").pop())==null?void 0:n.toLowerCase())||"";return xn[t]},gn=({url:r,fileName:t})=>{const n=J(),a=se(),[o,i]=s.useState(""),[p,l]=s.useState(!0),[f,u]=s.useState(null);s.useEffect(()=>{(async()=>{try{l(!0),u(null),i(await Me(r,{fetcher:a}))}catch(x){console.error(x),u(n("subtitle.load_failed"))}finally{l(!1)}})()},[r]);const d=s.useMemo(()=>{if(!o)return null;try{return ht(o,bn(t))}catch(y){return console.error(y),null}},[o,t]);if(p)return e.jsx("div",{className:"rfp-flex rfp-items-center rfp-justify-center rfp-w-full rfp-h-full rfp-bg-[#0f0f12]",children:e.jsx("div",{className:"rfp-w-12 rfp-h-12 rfp-border-4 rfp-border-line-strong rfp-border-t-spinner-head rfp-rounded-full rfp-animate-spin"})});if(f||!d)return e.jsx("div",{className:"rfp-flex rfp-items-center rfp-justify-center rfp-w-full rfp-h-full rfp-bg-[#0f0f12]",children:e.jsx("div",{className:"rfp-text-fg-secondary rfp-text-center",children:e.jsx("p",{className:"rfp-text-lg",children:f||n("subtitle.parse_failed")})})});const c=d.format==="lrc"||d.format==="elrc",m=d.metadata??{},h=c?"group-hover:rfp-bg-violet-400":"group-hover:rfp-bg-sky-400";return e.jsxs("div",{className:"rfp-relative rfp-w-full rfp-h-full rfp-bg-[#0f0f12]",children:[e.jsx("div",{className:"rfp-w-full rfp-h-full rfp-overflow-auto rfp-px-6 md:rfp-px-10 rfp-pt-6 rfp-pb-16 md:rfp-pb-20",children:e.jsxs("div",{className:"rfp-relative rfp-max-w-5xl rfp-mx-auto",children:[e.jsx("div",{className:"rfp-absolute rfp-left-[5px] md:rfp-left-[7px] rfp-top-2 rfp-bottom-2 rfp-w-px rfp-bg-surface-1"}),e.jsx("ol",{className:"rfp-space-y-5 md:rfp-space-y-6",children:d.cues.map((y,x)=>e.jsxs("li",{className:"rfp-relative rfp-pl-6 md:rfp-pl-8 rfp-group",children:[e.jsx("div",{className:`rfp-absolute rfp-left-0 rfp-top-2 rfp-w-3 rfp-h-3 rfp-rounded-full rfp-bg-surface-3 rfp-border-2 rfp-border-[#0f0f12] rfp-transition-colors ${h}`}),e.jsxs("div",{className:"rfp-flex rfp-flex-wrap rfp-items-baseline rfp-gap-x-3 rfp-gap-y-1 rfp-mb-1.5",children:[e.jsx("span",{className:"rfp-text-[11px] rfp-font-mono rfp-text-fg-muted rfp-tabular-nums",children:ze(y.start)}),e.jsx("span",{className:"rfp-text-[11px] rfp-text-fg-disabled",children:"→"}),e.jsx("span",{className:"rfp-text-[11px] rfp-font-mono rfp-text-fg-muted rfp-tabular-nums",children:ze(y.end)}),e.jsxs("span",{className:"rfp-text-[10px] rfp-font-mono rfp-text-fg-disabled rfp-tabular-nums",children:["#",y.id??x+1]}),y.style&&e.jsx("span",{className:"rfp-text-[9px] rfp-uppercase rfp-tracking-widest rfp-text-fg-tertiary rfp-px-1.5 rfp-py-0.5 rfp-rounded rfp-bg-surface-1 rfp-border rfp-border-line-weak",children:y.style})]}),y.words&&y.words.length>0?e.jsx("div",{className:"rfp-flex rfp-flex-wrap rfp-gap-x-1.5 rfp-gap-y-1 rfp-text-base md:rfp-text-lg rfp-text-fg-primary rfp-leading-relaxed group-hover:rfp-text-fg-primary rfp-transition-colors",children:y.words.map((w,b)=>e.jsxs("span",{className:"rfp-inline-flex rfp-flex-col rfp-items-start",title:ze(w.start),children:[e.jsx("span",{className:"rfp-text-[9px] rfp-text-fg-disabled rfp-font-mono rfp-leading-none rfp-tabular-nums",children:ze(w.start).slice(3,8)}),e.jsx("span",{className:"rfp-leading-snug",children:w.text})]},`w-${b}`))}):e.jsx("p",{className:`rfp-whitespace-pre-wrap rfp-break-words rfp-leading-relaxed group-hover:rfp-text-fg-primary rfp-transition-colors rfp-text-fg-primary ${c?"rfp-text-base md:rfp-text-xl rfp-font-medium":"rfp-text-sm md:rfp-text-base"}`,children:y.text})]},`cue-${x}`))})]})}),e.jsxs("div",{className:"rfp-pointer-events-none rfp-absolute rfp-bottom-3 rfp-right-3 md:rfp-bottom-4 md:rfp-right-4 rfp-flex rfp-items-center rfp-gap-2 rfp-px-2.5 rfp-py-1 rfp-rounded-full rfp-bg-surface-nav rfp-backdrop-blur rfp-border rfp-border-line-weak rfp-text-[10px] rfp-text-fg-tertiary rfp-font-mono rfp-tabular-nums",children:[e.jsxs("span",{children:[d.cues.length," ",n(c?"subtitle.lines":"subtitle.cues")]}),m.length&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"rfp-text-fg-disabled",children:"·"}),e.jsx("span",{children:m.length})]})]})]})},yn=Object.freeze(Object.defineProperty({__proto__:null,SubtitleRenderer:gn},Symbol.toStringTag,{value:"Module"})),wn=({left:r,right:t,initialLeftWidth:n=280,minLeftWidth:a=160,maxLeftWidth:o=640,minRightWidth:i=200,storageKey:p,desktopMedia:l="(min-width: 768px)",className:f=""})=>{const u=s.useRef(null),[d,c]=s.useState(()=>{if(p&&typeof window<"u"){const b=Number(window.localStorage.getItem(p));if(!isNaN(b)&&b>0)return b}return n}),[m,h]=s.useState(!1),[y,x]=s.useState(!1);s.useEffect(()=>{if(typeof window>"u")return;const b=window.matchMedia(l),g=()=>x(b.matches);return g(),b.addEventListener("change",g),()=>b.removeEventListener("change",g)},[l]),s.useEffect(()=>{if(!m)return;const b=S=>{if(!u.current)return;const M=u.current.getBoundingClientRect(),T=S.clientX-M.left,D=M.width-i-6,N=Math.min(o,D),E=Math.max(a,Math.min(N,T));c(E)},g=()=>h(!1);window.addEventListener("mousemove",b),window.addEventListener("mouseup",g);const v=document.body.style.cursor,k=document.body.style.userSelect;return document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{window.removeEventListener("mousemove",b),window.removeEventListener("mouseup",g),document.body.style.cursor=v,document.body.style.userSelect=k}},[m,a,o,i]),s.useEffect(()=>{if(!(!p||m))try{window.localStorage.setItem(p,String(d))}catch{}},[d,p,m]);const w=s.useCallback(b=>{b.preventDefault(),h(!0)},[]);return e.jsxs("div",{ref:u,className:`rfp-w-full rfp-h-full rfp-flex rfp-flex-col md:rfp-flex-row rfp-min-h-0 rfp-min-w-0 ${f}`,children:[e.jsx("div",{className:"rfp-min-h-0 rfp-min-w-0 rfp-flex-shrink-0 rfp-w-full rfp-max-h-60 md:rfp-h-full md:rfp-max-h-none",style:y?{width:`${d}px`}:void 0,children:r}),e.jsx("div",{role:"separator","aria-orientation":"vertical",onMouseDown:w,className:`rfp-hidden md:rfp-block rfp-relative rfp-w-1.5 rfp-flex-shrink-0 rfp-cursor-col-resize rfp-transition-colors ${m?"rfp-bg-surface-toolbar":"rfp-bg-surface-2 hover:rfp-bg-surface-3"}`,children:e.jsx("span",{className:"rfp-absolute rfp-inset-y-0 -rfp-left-1 -rfp-right-1"})}),e.jsx("div",{className:"rfp-flex-1 rfp-min-w-0 rfp-min-h-0 rfp-overflow-hidden",children:t})]})},vn=s.lazy(()=>Promise.resolve().then(()=>gs).then(r=>({default:r.FilePreviewContent}))),jn=r=>{const t=gr({name:r,type:""});return t==="image"?_.FileImage:t==="text"||t==="markdown"||t==="json"||t==="csv"||t==="xml"||t==="subtitle"?r.endsWith(".md")||r.endsWith(".markdown")?_.FileText:_.FileCode:_.File},Mr=({node:r,depth:t,selectedPath:n,expanded:a,onToggle:o,onSelect:i,onHover:p,onLeave:l})=>{var h;const f=a.has(r.path),u=n===r.path,d={paddingLeft:`${t*14+10}px`},c=y=>{const x=y.currentTarget.getBoundingClientRect();p(r.name||"/",x)};if(r.isDir)return e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",onClick:()=>o(r.path),onMouseEnter:c,onMouseLeave:l,className:"rfp-w-full rfp-flex rfp-items-center rfp-gap-1.5 rfp-py-1.5 rfp-pr-2 rfp-text-left rfp-text-fg-secondary hover:rfp-bg-surface-1 rfp-text-sm",style:d,children:[e.jsx(_.ChevronRight,{className:`rfp-w-3.5 rfp-h-3.5 rfp-flex-shrink-0 rfp-transition-transform ${f?"rfp-rotate-90":""}`}),f?e.jsx(_.FolderOpen,{className:"rfp-w-4 rfp-h-4 rfp-flex-shrink-0 rfp-text-amber-300/80"}):e.jsx(_.Folder,{className:"rfp-w-4 rfp-h-4 rfp-flex-shrink-0 rfp-text-amber-300/80"}),e.jsx("span",{className:"rfp-truncate rfp-flex-1 rfp-min-w-0",children:r.name||"/"})]}),f&&((h=r.children)==null?void 0:h.map(y=>e.jsx(Mr,{node:y,depth:t+1,selectedPath:n,expanded:a,onToggle:o,onSelect:i,onHover:p,onLeave:l},y.path)))]});const m=jn(r.name);return e.jsxs("button",{type:"button",onClick:()=>i(r),onMouseEnter:c,onMouseLeave:l,className:`rfp-w-full rfp-flex rfp-items-center rfp-gap-1.5 rfp-py-1.5 rfp-pr-2 rfp-text-left rfp-text-sm ${u?"rfp-bg-surface-2 rfp-text-fg-primary":"rfp-text-fg-secondary hover:rfp-bg-surface-1"}`,style:d,children:[e.jsx("span",{className:"rfp-w-3.5 rfp-h-3.5 rfp-flex-shrink-0"}),e.jsx(m,{className:"rfp-w-4 rfp-h-4 rfp-flex-shrink-0 rfp-text-fg-tertiary"}),e.jsx("span",{className:"rfp-flex-1 rfp-truncate rfp-min-w-0",children:r.name}),e.jsx("span",{className:"rfp-text-xs rfp-text-fg-disabled rfp-flex-shrink-0 rfp-ml-2",children:yr(r.size)})]})},Nn=({url:r,nestingDepth:t=0,onStatsChange:n})=>{var G;const a=J(),o=se(),[i,p]=s.useState(null),[l,f]=s.useState(null),[u,d]=s.useState(!0),[c,m]=s.useState(null),[h,y]=s.useState(new Set([""])),[x,w]=s.useState(null),[b,g]=s.useState(!1),[v,k]=s.useState(null),[S,M]=s.useState(null),T=s.useRef(n);s.useEffect(()=>{T.current=n},[n]),s.useEffect(()=>{let j=!1;return(async()=>{try{d(!0),m(null);const C=await o(r);if(!C.ok)throw new Error("加载失败");const B=await C.arrayBuffer(),I=await xt(B);if(j)return;const q=bt(I),L=gt(q);p(I),f(L);const z=new Set([""]);if(L.children)for(const $ of L.children)$.isDir&&z.add($.path);y(z)}catch(C){console.error(C),j||m(a("zip.load_failed"))}finally{j||d(!1)}})(),()=>{j=!0}},[r]),s.useEffect(()=>()=>{x!=null&&x.blobUrl&&URL.revokeObjectURL(x.blobUrl)},[x]);const D=s.useMemo(()=>{if(!l)return null;let j=0,R=0,C=0;const B=I=>{var q;I.isDir?(I.path&&R++,(q=I.children)==null||q.forEach(B)):(j++,C+=I.size)};return B(l),{files:j,dirs:R,size:C}},[l]);s.useEffect(()=>{var j;return(j=T.current)==null||j.call(T,D),()=>{var R;(R=T.current)==null||R.call(T,null)}},[D]);const N=s.useCallback(j=>{y(R=>{const C=new Set(R);return C.has(j)?C.delete(j):C.add(j),C})},[]),E=s.useCallback((j,R)=>{M({text:j,x:R.right+8,y:R.top+R.height/2})},[]),F=s.useCallback(()=>{M(null)},[]),H=s.useCallback(async j=>{if(!(!i||j.isDir)){x!=null&&x.blobUrl&&URL.revokeObjectURL(x.blobUrl),g(!0),k(null);try{const R=Ee(j.name),C=await yt(i,j.path,R!=="application/octet-stream"?R:void 0),B=URL.createObjectURL(C);w({path:j.path,name:j.name,size:j.size,blobUrl:B})}catch(R){console.error(R),k("条目读取失败")}finally{g(!1)}}},[i,x]);if(u)return e.jsx("div",{className:"rfp-flex rfp-items-center rfp-justify-center rfp-w-full rfp-h-full",children:e.jsx("div",{className:"rfp-w-12 rfp-h-12 rfp-border-4 rfp-border-line-strong rfp-border-t-spinner-head rfp-rounded-full rfp-animate-spin"})});if(c||!l)return e.jsx("div",{className:"rfp-flex rfp-items-center rfp-justify-center rfp-w-full rfp-h-full",children:e.jsx("div",{className:"rfp-text-fg-secondary rfp-text-center",children:e.jsx("p",{className:"rfp-text-lg",children:c||a("zip.parse_failed")})})});const A=e.jsx("div",{className:"rfp-w-full rfp-h-full rfp-overflow-auto",children:(G=l.children)==null?void 0:G.map(j=>e.jsx(Mr,{node:j,depth:0,selectedPath:(x==null?void 0:x.path)??null,expanded:h,onToggle:N,onSelect:H,onHover:E,onLeave:F},j.path))}),Z=e.jsxs("div",{className:"rfp-w-full rfp-h-full rfp-flex rfp-flex-col",children:[!x&&e.jsx("div",{className:"rfp-flex-1 rfp-flex rfp-items-center rfp-justify-center rfp-text-fg-muted rfp-text-sm rfp-p-6",children:"从左侧选择一个文件以预览"}),x&&b&&e.jsx("div",{className:"rfp-flex-1 rfp-flex rfp-items-center rfp-justify-center",children:e.jsx("div",{className:"rfp-w-8 rfp-h-8 rfp-border-4 rfp-border-line-strong rfp-border-t-spinner-head rfp-rounded-full rfp-animate-spin"})}),x&&!b&&v&&e.jsx("div",{className:"rfp-flex-1 rfp-flex rfp-items-center rfp-justify-center rfp-text-fg-secondary",children:v}),x&&!b&&!v&&e.jsx(e.Fragment,{children:e.jsx("div",{className:"rfp-flex-1 rfp-min-h-0 rfp-overflow-hidden rfp-flex rfp-relative rfp-z-0",children:e.jsx(s.Suspense,{fallback:e.jsx("div",{className:"rfp-flex-1 rfp-flex rfp-items-center rfp-justify-center",children:e.jsx("div",{className:"rfp-w-8 rfp-h-8 rfp-border-4 rfp-border-line-strong rfp-border-t-spinner-head rfp-rounded-full rfp-animate-spin"})}),children:e.jsx(vn,{mode:"embed",files:[{name:x.name,url:x.blobUrl,type:Ee(x.name)}],currentIndex:0,zipNestingDepth:t+1})})})})]});return e.jsxs(e.Fragment,{children:[e.jsx(wn,{left:A,right:Z,initialLeftWidth:280,minLeftWidth:180,maxLeftWidth:560,storageKey:"rfp-zip-split-left"}),S&&typeof document<"u"&&mr.createPortal(e.jsx("div",{className:"rfp-fixed rfp-z-[9999] rfp-pointer-events-none rfp-px-2 rfp-py-1 rfp-bg-[rgba(0,0,0,0.85)] rfp-text-fg-primary rfp-text-xs rfp-rounded rfp-whitespace-nowrap rfp-shadow-lg",style:{left:`${S.x}px`,top:`${S.y}px`,transform:"translateY(-50%)"},children:S.text}),document.body)]})},kn=Object.freeze(Object.defineProperty({__proto__:null,ZipRenderer:Nn},Symbol.toStringTag,{value:"Module"})),Sn=({url:r,fileName:t,wordWrap:n=!0,htmlPreview:a=!1})=>{const o=J(),i=se(),[p,l]=s.useState(""),[f,u]=s.useState(!0),[d,c]=s.useState(null),m=rt(t),{html:h}=Ie(m!=="text"?p:"",m);return s.useEffect(()=>{(async()=>{try{u(!0),c(null);const x=await Me(r,{fetcher:i});l(x)}catch(x){c(o("text.load_failed")),console.error(x)}finally{u(!1)}})()},[r]),f?e.jsx("div",{className:"rfp-flex rfp-items-center rfp-justify-center rfp-w-full rfp-h-full",children:e.jsx("div",{className:"rfp-w-12 rfp-h-12 rfp-border-4 rfp-border-line-strong rfp-border-t-spinner-head rfp-rounded-full rfp-animate-spin"})}):d?e.jsx("div",{className:"rfp-flex rfp-items-center rfp-justify-center rfp-w-full rfp-h-full",children:e.jsx("div",{className:"rfp-text-fg-secondary rfp-text-center",children:e.jsx("p",{className:"rfp-text-lg",children:d})})}):a&&m==="html"?e.jsx("div",{className:"rfp-w-full rfp-h-full rfp-bg-surface-toolbar",children:e.jsx("iframe",{srcDoc:p,sandbox:"allow-same-origin",className:"rfp-w-full rfp-h-full rfp-border-0",title:t})}):e.jsx("div",{className:"rfp-w-full rfp-h-full rfp-overflow-auto rfp-bg-code-bg",children:m==="text"||!h?e.jsx("pre",{className:`rfp-p-6 rfp-text-fg-primary rfp-font-mono rfp-text-sm ${n?"rfp-whitespace-pre-wrap rfp-break-words":"rfp-whitespace-pre"}`,children:p}):e.jsx("div",{className:`rfp-shiki-wrapper with-line-numbers ${n?"":"no-wrap"}`,dangerouslySetInnerHTML:{__html:h}})})},_n=Object.freeze(Object.defineProperty({__proto__:null,TextRenderer:Sn},Symbol.toStringTag,{value:"Module"}));Object.defineProperty(exports,"pdfjs",{enumerable:!0,get:()=>ve.pdfjs});exports.FilePreviewContent=We;exports.FilePreviewEmbed=ws;exports.FilePreviewModal=ys;exports.LocaleProvider=vr;exports.VERSION=vs;exports.configurePdfjs=kr;exports.normalizeFile=xr;exports.normalizeFiles=br;exports.useLocale=Wt;exports.useTranslator=J;
|
|
65
|
+
`).map(i=>{let c=0;/^<\/\w/.test(i)?o=Math.max(o-1,0):/^<\w[^>]*[^/]>.*$/.test(i)&&!/<.+<\/.+>$/.test(i)&&(c=1);const l=t.repeat(o)+i;return o+=c,l}).join(`
|
|
66
|
+
`)},js=({url:r})=>{const t=J(),s=te(),[a,o]=n.useState(""),[i,c]=n.useState(!0),[l,f]=n.useState(null),{html:d}=We(a,"xml");return n.useEffect(()=>{(async()=>{try{c(!0),f(null);const p=await Re(r,{fetcher:s});o(ws(p))}catch(p){console.error(p),f(t("xml.load_failed"))}finally{c(!1)}})()},[r]),i?e.jsx("div",{className:"rfp-flex rfp-items-center rfp-justify-center rfp-w-full rfp-h-full",children:e.jsx("div",{className:"rfp-w-12 rfp-h-12 rfp-border-4 rfp-border-line-strong rfp-border-t-spinner-head rfp-rounded-full rfp-animate-spin"})}):l?e.jsx("div",{className:"rfp-flex rfp-items-center rfp-justify-center rfp-w-full rfp-h-full",children:e.jsx("div",{className:"rfp-text-fg-secondary rfp-text-center",children:e.jsx("p",{className:"rfp-text-lg",children:l})})}):e.jsx("div",{className:"rfp-w-full rfp-h-full rfp-overflow-auto rfp-bg-code-bg",children:d?e.jsx("div",{className:"rfp-shiki-wrapper with-line-numbers",dangerouslySetInnerHTML:{__html:d}}):e.jsx("pre",{className:"rfp-p-6 rfp-text-fg-primary rfp-font-mono rfp-text-sm rfp-whitespace-pre-wrap rfp-break-words",children:a})})},Ns=Object.freeze(Object.defineProperty({__proto__:null,XmlRenderer:js},Symbol.toStringTag,{value:"Module"})),ks={srt:"srt",vtt:"vtt",lrc:"lrc",elrc:"elrc",ass:"ass",ssa:"ssa",ttml:"ttml",dfxp:"ttml"},Ss=r=>{var s;const t=((s=r.split(".").pop())==null?void 0:s.toLowerCase())||"";return ks[t]},_s=({url:r,fileName:t})=>{const s=J(),a=te(),[o,i]=n.useState(""),[c,l]=n.useState(!0),[f,d]=n.useState(null);n.useEffect(()=>{(async()=>{try{l(!0),d(null),i(await Re(r,{fetcher:a}))}catch(x){console.error(x),d(s("subtitle.load_failed"))}finally{l(!1)}})()},[r]);const u=n.useMemo(()=>{if(!o)return null;try{return wt(o,Ss(t))}catch(g){return console.error(g),null}},[o,t]);if(c)return e.jsx("div",{className:"rfp-flex rfp-items-center rfp-justify-center rfp-w-full rfp-h-full rfp-bg-[#0f0f12]",children:e.jsx("div",{className:"rfp-w-12 rfp-h-12 rfp-border-4 rfp-border-line-strong rfp-border-t-spinner-head rfp-rounded-full rfp-animate-spin"})});if(f||!u)return e.jsx("div",{className:"rfp-flex rfp-items-center rfp-justify-center rfp-w-full rfp-h-full rfp-bg-[#0f0f12]",children:e.jsx("div",{className:"rfp-text-fg-secondary rfp-text-center",children:e.jsx("p",{className:"rfp-text-lg",children:f||s("subtitle.parse_failed")})})});const p=u.format==="lrc"||u.format==="elrc",h=u.metadata??{},m=p?"group-hover:rfp-bg-violet-400":"group-hover:rfp-bg-sky-400";return e.jsxs("div",{className:"rfp-relative rfp-w-full rfp-h-full rfp-bg-[#0f0f12]",children:[e.jsx("div",{className:"rfp-w-full rfp-h-full rfp-overflow-auto rfp-px-6 md:rfp-px-10 rfp-pt-6 rfp-pb-16 md:rfp-pb-20",children:e.jsxs("div",{className:"rfp-relative rfp-max-w-5xl rfp-mx-auto",children:[e.jsx("div",{className:"rfp-absolute rfp-left-[5px] md:rfp-left-[7px] rfp-top-2 rfp-bottom-2 rfp-w-px rfp-bg-surface-1"}),e.jsx("ol",{className:"rfp-space-y-5 md:rfp-space-y-6",children:u.cues.map((g,x)=>e.jsxs("li",{className:"rfp-relative rfp-pl-6 md:rfp-pl-8 rfp-group",children:[e.jsx("div",{className:`rfp-absolute rfp-left-0 rfp-top-2 rfp-w-3 rfp-h-3 rfp-rounded-full rfp-bg-surface-3 rfp-border-2 rfp-border-[#0f0f12] rfp-transition-colors ${m}`}),e.jsxs("div",{className:"rfp-flex rfp-flex-wrap rfp-items-baseline rfp-gap-x-3 rfp-gap-y-1 rfp-mb-1.5",children:[e.jsx("span",{className:"rfp-text-[11px] rfp-font-mono rfp-text-fg-muted rfp-tabular-nums",children:Pe(g.start)}),e.jsx("span",{className:"rfp-text-[11px] rfp-text-fg-disabled",children:"→"}),e.jsx("span",{className:"rfp-text-[11px] rfp-font-mono rfp-text-fg-muted rfp-tabular-nums",children:Pe(g.end)}),e.jsxs("span",{className:"rfp-text-[10px] rfp-font-mono rfp-text-fg-disabled rfp-tabular-nums",children:["#",g.id??x+1]}),g.style&&e.jsx("span",{className:"rfp-text-[9px] rfp-uppercase rfp-tracking-widest rfp-text-fg-tertiary rfp-px-1.5 rfp-py-0.5 rfp-rounded rfp-bg-surface-1 rfp-border rfp-border-line-weak",children:g.style})]}),g.words&&g.words.length>0?e.jsx("div",{className:"rfp-flex rfp-flex-wrap rfp-gap-x-1.5 rfp-gap-y-1 rfp-text-base md:rfp-text-lg rfp-text-fg-primary rfp-leading-relaxed group-hover:rfp-text-fg-primary rfp-transition-colors",children:g.words.map((b,v)=>e.jsxs("span",{className:"rfp-inline-flex rfp-flex-col rfp-items-start",title:Pe(b.start),children:[e.jsx("span",{className:"rfp-text-[9px] rfp-text-fg-disabled rfp-font-mono rfp-leading-none rfp-tabular-nums",children:Pe(b.start).slice(3,8)}),e.jsx("span",{className:"rfp-leading-snug",children:b.text})]},`w-${v}`))}):e.jsx("p",{className:`rfp-whitespace-pre-wrap rfp-break-words rfp-leading-relaxed group-hover:rfp-text-fg-primary rfp-transition-colors rfp-text-fg-primary ${p?"rfp-text-base md:rfp-text-xl rfp-font-medium":"rfp-text-sm md:rfp-text-base"}`,children:g.text})]},`cue-${x}`))})]})}),e.jsxs("div",{className:"rfp-pointer-events-none rfp-absolute rfp-bottom-3 rfp-right-3 md:rfp-bottom-4 md:rfp-right-4 rfp-flex rfp-items-center rfp-gap-2 rfp-px-2.5 rfp-py-1 rfp-rounded-full rfp-bg-surface-nav rfp-backdrop-blur rfp-border rfp-border-line-weak rfp-text-[10px] rfp-text-fg-tertiary rfp-font-mono rfp-tabular-nums",children:[e.jsxs("span",{children:[u.cues.length," ",s(p?"subtitle.lines":"subtitle.cues")]}),h.length&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"rfp-text-fg-disabled",children:"·"}),e.jsx("span",{children:h.length})]})]})]})},Ts=Object.freeze(Object.defineProperty({__proto__:null,SubtitleRenderer:_s},Symbol.toStringTag,{value:"Module"})),Rs=({left:r,right:t,initialLeftWidth:s=280,minLeftWidth:a=160,maxLeftWidth:o=640,minRightWidth:i=200,storageKey:c,desktopMedia:l="(min-width: 768px)",className:f=""})=>{const d=n.useRef(null),[u,p]=n.useState(()=>{if(c&&typeof window<"u"){const v=Number(window.localStorage.getItem(c));if(!isNaN(v)&&v>0)return v}return s}),[h,m]=n.useState(!1),[g,x]=n.useState(!1);n.useEffect(()=>{if(typeof window>"u")return;const v=window.matchMedia(l),y=()=>x(v.matches);return y(),v.addEventListener("change",y),()=>v.removeEventListener("change",y)},[l]),n.useEffect(()=>{if(!h)return;const v=S=>{if(!d.current)return;const k=d.current.getBoundingClientRect(),_=S.clientX-k.left,R=k.width-i-6,j=Math.min(o,R),L=Math.max(a,Math.min(j,_));p(L)},y=()=>m(!1);window.addEventListener("mousemove",v),window.addEventListener("mouseup",y);const w=document.body.style.cursor,T=document.body.style.userSelect;return document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{window.removeEventListener("mousemove",v),window.removeEventListener("mouseup",y),document.body.style.cursor=w,document.body.style.userSelect=T}},[h,a,o,i]),n.useEffect(()=>{if(!(!c||h))try{window.localStorage.setItem(c,String(u))}catch{}},[u,c,h]);const b=n.useCallback(v=>{v.preventDefault(),m(!0)},[]);return e.jsxs("div",{ref:d,className:`rfp-w-full rfp-h-full rfp-flex rfp-flex-col md:rfp-flex-row rfp-min-h-0 rfp-min-w-0 ${f}`,children:[e.jsx("div",{className:"rfp-min-h-0 rfp-min-w-0 rfp-flex-shrink-0 rfp-w-full rfp-max-h-60 md:rfp-h-full md:rfp-max-h-none",style:g?{width:`${u}px`}:void 0,children:r}),e.jsx("div",{role:"separator","aria-orientation":"vertical",onMouseDown:b,className:`rfp-hidden md:rfp-block rfp-relative rfp-w-1.5 rfp-flex-shrink-0 rfp-cursor-col-resize rfp-transition-colors ${h?"rfp-bg-surface-toolbar":"rfp-bg-surface-2 hover:rfp-bg-surface-3"}`,children:e.jsx("span",{className:"rfp-absolute rfp-inset-y-0 -rfp-left-1 -rfp-right-1"})}),e.jsx("div",{className:"rfp-flex-1 rfp-min-w-0 rfp-min-h-0 rfp-overflow-hidden",children:t})]})},Fs=n.lazy(()=>Promise.resolve().then(()=>_n).then(r=>({default:r.FilePreviewContent}))),Cs=r=>{const t=vr({name:r,type:""});return t==="image"?E.FileImage:t==="text"||t==="markdown"||t==="json"||t==="csv"||t==="xml"||t==="subtitle"?r.endsWith(".md")||r.endsWith(".markdown")?E.FileText:E.FileCode:E.File},Cr=({node:r,depth:t,selectedPath:s,expanded:a,onToggle:o,onSelect:i,onHover:c,onLeave:l})=>{var m;const f=a.has(r.path),d=s===r.path,u={paddingLeft:`${t*14+10}px`},p=g=>{const x=g.currentTarget.getBoundingClientRect();c(r.name||"/",x)};if(r.isDir)return e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",onClick:()=>o(r.path),onMouseEnter:p,onMouseLeave:l,className:"rfp-w-full rfp-flex rfp-items-center rfp-gap-1.5 rfp-py-1.5 rfp-pr-2 rfp-text-left rfp-text-fg-secondary hover:rfp-bg-surface-1 rfp-text-sm",style:u,children:[e.jsx(E.ChevronRight,{className:`rfp-w-3.5 rfp-h-3.5 rfp-flex-shrink-0 rfp-transition-transform ${f?"rfp-rotate-90":""}`}),f?e.jsx(E.FolderOpen,{className:"rfp-w-4 rfp-h-4 rfp-flex-shrink-0 rfp-text-amber-300/80"}):e.jsx(E.Folder,{className:"rfp-w-4 rfp-h-4 rfp-flex-shrink-0 rfp-text-amber-300/80"}),e.jsx("span",{className:"rfp-truncate rfp-flex-1 rfp-min-w-0",children:r.name||"/"})]}),f&&((m=r.children)==null?void 0:m.map(g=>e.jsx(Cr,{node:g,depth:t+1,selectedPath:s,expanded:a,onToggle:o,onSelect:i,onHover:c,onLeave:l},g.path)))]});const h=Cs(r.name);return e.jsxs("button",{type:"button",onClick:()=>i(r),onMouseEnter:p,onMouseLeave:l,className:`rfp-w-full rfp-flex rfp-items-center rfp-gap-1.5 rfp-py-1.5 rfp-pr-2 rfp-text-left rfp-text-sm ${d?"rfp-bg-surface-2 rfp-text-fg-primary":"rfp-text-fg-secondary hover:rfp-bg-surface-1"}`,style:u,children:[e.jsx("span",{className:"rfp-w-3.5 rfp-h-3.5 rfp-flex-shrink-0"}),e.jsx(h,{className:"rfp-w-4 rfp-h-4 rfp-flex-shrink-0 rfp-text-fg-tertiary"}),e.jsx("span",{className:"rfp-flex-1 rfp-truncate rfp-min-w-0",children:r.name}),e.jsx("span",{className:"rfp-text-xs rfp-text-fg-disabled rfp-flex-shrink-0 rfp-ml-2",children:jr(r.size)})]})},Es=({url:r,nestingDepth:t=0,onStatsChange:s})=>{var I;const a=J(),o=te(),[i,c]=n.useState(null),[l,f]=n.useState(null),[d,u]=n.useState(!0),[p,h]=n.useState(null),[m,g]=n.useState(new Set([""])),[x,b]=n.useState(null),[v,y]=n.useState(!1),[w,T]=n.useState(null),[S,k]=n.useState(null),_=n.useRef(s);n.useEffect(()=>{_.current=s},[s]),n.useEffect(()=>{let N=!1;return(async()=>{try{u(!0),h(null);const C=await o(r);if(!C.ok)throw new Error("加载失败");const U=await C.arrayBuffer(),B=await vt(U);if(N)return;const G=jt(B),P=Nt(G);c(B),f(P);const $=new Set([""]);if(P.children)for(const D of P.children)D.isDir&&$.add(D.path);g($)}catch(C){console.error(C),N||h(a("zip.load_failed"))}finally{N||u(!1)}})(),()=>{N=!0}},[r]),n.useEffect(()=>()=>{x!=null&&x.blobUrl&&URL.revokeObjectURL(x.blobUrl)},[x]);const R=n.useMemo(()=>{if(!l)return null;let N=0,F=0,C=0;const U=B=>{var G;B.isDir?(B.path&&F++,(G=B.children)==null||G.forEach(U)):(N++,C+=B.size)};return U(l),{files:N,dirs:F,size:C}},[l]);n.useEffect(()=>{var N;return(N=_.current)==null||N.call(_,R),()=>{var F;(F=_.current)==null||F.call(_,null)}},[R]);const j=n.useCallback(N=>{g(F=>{const C=new Set(F);return C.has(N)?C.delete(N):C.add(N),C})},[]),L=n.useCallback((N,F)=>{k({text:N,x:F.right+8,y:F.top+F.height/2})},[]),M=n.useCallback(()=>{k(null)},[]),O=n.useCallback(async N=>{if(!(!i||N.isDir)){x!=null&&x.blobUrl&&URL.revokeObjectURL(x.blobUrl),y(!0),T(null);try{const F=Ce(N.name),C=await kt(i,N.path,F!=="application/octet-stream"?F:void 0),U=URL.createObjectURL(C);b({path:N.path,name:N.name,size:N.size,blobUrl:U})}catch(F){console.error(F),T("条目读取失败")}finally{y(!1)}}},[i,x]);if(d)return e.jsx("div",{className:"rfp-flex rfp-items-center rfp-justify-center rfp-w-full rfp-h-full",children:e.jsx("div",{className:"rfp-w-12 rfp-h-12 rfp-border-4 rfp-border-line-strong rfp-border-t-spinner-head rfp-rounded-full rfp-animate-spin"})});if(p||!l)return e.jsx("div",{className:"rfp-flex rfp-items-center rfp-justify-center rfp-w-full rfp-h-full",children:e.jsx("div",{className:"rfp-text-fg-secondary rfp-text-center",children:e.jsx("p",{className:"rfp-text-lg",children:p||a("zip.parse_failed")})})});const W=e.jsx("div",{className:"rfp-w-full rfp-h-full rfp-overflow-auto",children:(I=l.children)==null?void 0:I.map(N=>e.jsx(Cr,{node:N,depth:0,selectedPath:(x==null?void 0:x.path)??null,expanded:m,onToggle:j,onSelect:O,onHover:L,onLeave:M},N.path))}),H=e.jsxs("div",{className:"rfp-w-full rfp-h-full rfp-flex rfp-flex-col",children:[!x&&e.jsx("div",{className:"rfp-flex-1 rfp-flex rfp-items-center rfp-justify-center rfp-text-fg-muted rfp-text-sm rfp-p-6",children:"从左侧选择一个文件以预览"}),x&&v&&e.jsx("div",{className:"rfp-flex-1 rfp-flex rfp-items-center rfp-justify-center",children:e.jsx("div",{className:"rfp-w-8 rfp-h-8 rfp-border-4 rfp-border-line-strong rfp-border-t-spinner-head rfp-rounded-full rfp-animate-spin"})}),x&&!v&&w&&e.jsx("div",{className:"rfp-flex-1 rfp-flex rfp-items-center rfp-justify-center rfp-text-fg-secondary",children:w}),x&&!v&&!w&&e.jsx(e.Fragment,{children:e.jsx("div",{className:"rfp-flex-1 rfp-min-h-0 rfp-overflow-hidden rfp-flex rfp-relative rfp-z-0",children:e.jsx(n.Suspense,{fallback:e.jsx("div",{className:"rfp-flex-1 rfp-flex rfp-items-center rfp-justify-center",children:e.jsx("div",{className:"rfp-w-8 rfp-h-8 rfp-border-4 rfp-border-line-strong rfp-border-t-spinner-head rfp-rounded-full rfp-animate-spin"})}),children:e.jsx(Fs,{mode:"embed",files:[{name:x.name,url:x.blobUrl,type:Ce(x.name)}],currentIndex:0,zipNestingDepth:t+1})})})})]});return e.jsxs(e.Fragment,{children:[e.jsx(Rs,{left:W,right:H,initialLeftWidth:280,minLeftWidth:180,maxLeftWidth:560,storageKey:"rfp-zip-split-left"}),S&&typeof document<"u"&&gr.createPortal(e.jsx("div",{className:"rfp-fixed rfp-z-[9999] rfp-pointer-events-none rfp-px-2 rfp-py-1 rfp-bg-[rgba(0,0,0,0.85)] rfp-text-fg-primary rfp-text-xs rfp-rounded rfp-whitespace-nowrap rfp-shadow-lg",style:{left:`${S.x}px`,top:`${S.y}px`,transform:"translateY(-50%)"},children:S.text}),document.body)]})},Ms=Object.freeze(Object.defineProperty({__proto__:null,ZipRenderer:Es},Symbol.toStringTag,{value:"Module"})),Ls=({url:r,fileName:t,wordWrap:s=!0,htmlPreview:a=!1})=>{const o=J(),i=te(),[c,l]=n.useState(""),[f,d]=n.useState(!0),[u,p]=n.useState(null),h=at(t),{html:m}=We(h!=="text"?c:"",h);return n.useEffect(()=>{(async()=>{try{d(!0),p(null);const x=await Re(r,{fetcher:i});l(x)}catch(x){p(o("text.load_failed")),console.error(x)}finally{d(!1)}})()},[r]),f?e.jsx("div",{className:"rfp-flex rfp-items-center rfp-justify-center rfp-w-full rfp-h-full",children:e.jsx("div",{className:"rfp-w-12 rfp-h-12 rfp-border-4 rfp-border-line-strong rfp-border-t-spinner-head rfp-rounded-full rfp-animate-spin"})}):u?e.jsx("div",{className:"rfp-flex rfp-items-center rfp-justify-center rfp-w-full rfp-h-full",children:e.jsx("div",{className:"rfp-text-fg-secondary rfp-text-center",children:e.jsx("p",{className:"rfp-text-lg",children:u})})}):a&&h==="html"?e.jsx("div",{className:"rfp-w-full rfp-h-full rfp-bg-surface-toolbar",children:e.jsx("iframe",{srcDoc:c,sandbox:"allow-same-origin",className:"rfp-w-full rfp-h-full rfp-border-0",title:t})}):e.jsx("div",{className:"rfp-w-full rfp-h-full rfp-overflow-auto rfp-bg-code-bg",children:h==="text"||!m?e.jsx("pre",{className:`rfp-p-6 rfp-text-fg-primary rfp-font-mono rfp-text-sm ${s?"rfp-whitespace-pre-wrap rfp-break-words":"rfp-whitespace-pre"}`,children:c}):e.jsx("div",{className:`rfp-shiki-wrapper with-line-numbers ${s?"":"no-wrap"}`,dangerouslySetInnerHTML:{__html:m}})})},Ps=Object.freeze(Object.defineProperty({__proto__:null,TextRenderer:Ls},Symbol.toStringTag,{value:"Module"})),qe={latin:`ABCDEFGHIJKLMNOPQRSTUVWXYZ
|
|
67
|
+
abcdefghijklmnopqrstuvwxyz
|
|
68
|
+
0123456789 .,;:!?@#$%&*()[]{}`,chinese:"春夏秋冬东南西北天地人和风雨雷电山水日月",mixed:`The Quick Brown Fox Jumps Over The Lazy Dog
|
|
69
|
+
敏捷的棕色狐狸跳过了懒狗`},zs=[72,48,36,24,18],$s=({url:r})=>{const t=J(),s=te(),a=Ke(),[o,i]=n.useState(null),[c,l]=n.useState(null),[f,d]=n.useState(!0),[u,p]=n.useState(null),[h,m]=n.useState(""),[g,x]=n.useState("fontface"),b=n.useRef(null);n.useEffect(()=>{let w=!0;return(async()=>{var S,k,_,R,j,L,M;try{d(!0),p(null);const O=await s(r);if(!O.ok)throw new Error("Failed to load font file");const W=await O.arrayBuffer();if(!w)return;const H=W.slice(0),I=Qr.parse(W);if(!I)throw new Error("Font data is invalid");const N=I.names||{},F={family:((S=N.fontFamily)==null?void 0:S.en)||((k=N.fontFamily)==null?void 0:k["zh-Hans"])||((_=N.postScriptName)==null?void 0:_.en)||"Unknown",subfamily:((R=N.fontSubfamily)==null?void 0:R.en)||((j=N.fontSubfamily)==null?void 0:j["zh-Hans"])||"",version:((L=N.version)==null?void 0:L.en)||"",designer:((M=N.designer)==null?void 0:M.en)||"",glyphCount:I.numGlyphs||0,format:v(r)};if(!w)return;i(I),l(F);try{const C=new FontFace("PreviewFont",H);if(await C.load(),!w)return;document.fonts.add(C),b.current=C,x("fontface")}catch(C){if(console.warn("[FontRenderer] FontFace API rejected, fallback to Canvas:",C),!w)return;x("canvas")}w&&d(!1)}catch(O){if(!w)return;console.error("[FontRenderer] Error:",O);let W=t("font.load_failed");O instanceof Error&&(W=O.message),p(W),d(!1)}})(),()=>{w=!1,b.current&&(document.fonts.delete(b.current),b.current=null)}},[r,s,t]);const v=w=>{var k;const T=((k=w.split(".").pop())==null?void 0:k.toLowerCase().split("?")[0])||"";return{ttf:"TrueType (TTF)",otf:"OpenType (OTF)",woff:"Web Open Font Format (WOFF)",woff2:"Web Open Font Format 2 (WOFF2)"}[T]||"TTF"};if(f)return e.jsx("div",{className:"rfp-flex rfp-items-center rfp-justify-center rfp-w-full rfp-h-full",children:e.jsx("div",{className:"rfp-text-fg-secondary",children:t("font.loading")})});if(u||!o||!c)return e.jsx("div",{className:"rfp-flex rfp-items-center rfp-justify-center rfp-w-full rfp-h-full",children:e.jsx("div",{className:"rfp-text-fg-secondary",children:u||t("font.parse_failed")})});const y=h||qe.mixed;return e.jsxs("div",{className:"rfp-flex rfp-flex-col rfp-w-full rfp-h-full rfp-overflow-hidden rfp-min-w-0",children:[e.jsx("div",{className:"rfp-flex-shrink-0 rfp-px-6 rfp-py-4 rfp-bg-surface-1 rfp-border-b rfp-border-line-weak rfp-min-w-0",children:e.jsxs("div",{className:"rfp-grid rfp-grid-cols-2 rfp-gap-x-6 rfp-gap-y-2 rfp-text-sm rfp-min-w-0",children:[e.jsxs("div",{className:"rfp-flex rfp-items-center rfp-gap-2 rfp-min-w-0",children:[e.jsxs("span",{className:"rfp-text-fg-tertiary rfp-flex-shrink-0",children:[t("font.meta.family"),":"]}),e.jsx("span",{className:"rfp-text-fg-primary rfp-font-semibold rfp-truncate",children:c.family})]}),c.subfamily&&e.jsxs("div",{className:"rfp-flex rfp-items-center rfp-gap-2 rfp-min-w-0",children:[e.jsxs("span",{className:"rfp-text-fg-tertiary rfp-flex-shrink-0",children:[t("font.meta.subfamily"),":"]}),e.jsx("span",{className:"rfp-text-fg-primary rfp-truncate",children:c.subfamily})]}),e.jsxs("div",{className:"rfp-flex rfp-items-center rfp-gap-2 rfp-min-w-0",children:[e.jsxs("span",{className:"rfp-text-fg-tertiary rfp-flex-shrink-0",children:[t("font.meta.format"),":"]}),e.jsx("span",{className:"rfp-text-fg-primary rfp-truncate",children:c.format})]}),e.jsxs("div",{className:"rfp-flex rfp-items-center rfp-gap-2 rfp-min-w-0",children:[e.jsxs("span",{className:"rfp-text-fg-tertiary rfp-flex-shrink-0",children:[t("font.meta.glyphs"),":"]}),e.jsx("span",{className:"rfp-text-fg-primary rfp-truncate",children:c.glyphCount})]}),c.designer&&e.jsxs("div",{className:"rfp-flex rfp-items-center rfp-gap-2 rfp-min-w-0",children:[e.jsxs("span",{className:"rfp-text-fg-tertiary rfp-flex-shrink-0",children:[t("font.meta.designer"),":"]}),e.jsx("span",{className:"rfp-text-fg-primary rfp-truncate",children:c.designer})]}),c.version&&e.jsxs("div",{className:"rfp-flex rfp-items-center rfp-gap-2 rfp-min-w-0",children:[e.jsxs("span",{className:"rfp-text-fg-tertiary rfp-flex-shrink-0",children:[t("font.meta.version"),":"]}),e.jsx("span",{className:"rfp-text-fg-primary rfp-truncate",children:c.version})]})]})}),e.jsx("div",{className:"rfp-flex-1 rfp-overflow-auto rfp-min-w-0",children:e.jsxs("div",{className:"rfp-px-6 rfp-py-6 rfp-space-y-8 rfp-min-w-0",children:[e.jsxs("div",{className:"rfp-min-w-0",children:[e.jsx("label",{className:"rfp-block rfp-text-xs rfp-text-fg-tertiary rfp-mb-2",children:t("font.sample_text_placeholder")}),e.jsx("textarea",{className:"rfp-block rfp-w-full rfp-box-border rfp-px-3 rfp-py-2.5 rfp-bg-surface-2 rfp-text-fg-primary rfp-text-sm rfp-leading-relaxed rfp-border rfp-border-line rfp-rounded-md rfp-resize-y focus:rfp-outline-none focus:rfp-border-line-strong",rows:2,placeholder:t("font.sample_text_placeholder"),value:h,onChange:w=>m(w.target.value),style:{minHeight:"64px",maxHeight:"160px"}})]}),e.jsx("div",{className:"rfp-space-y-6 rfp-min-w-0",children:zs.map(w=>e.jsxs("div",{className:"rfp-space-y-2 rfp-min-w-0",children:[e.jsxs("div",{className:"rfp-text-xs rfp-text-fg-tertiary",children:[w,"px"]}),e.jsx(Ue,{font:o,text:y,fontSize:w,renderMode:g,theme:a})]},w))}),e.jsxs("div",{className:"rfp-space-y-6 rfp-pt-6 rfp-border-t rfp-border-line-weak rfp-min-w-0",children:[e.jsxs("div",{className:"rfp-min-w-0",children:[e.jsx("div",{className:"rfp-text-sm rfp-text-fg-tertiary rfp-mb-3",children:"Latin Alphabet"}),e.jsx(Ue,{font:o,text:qe.latin,fontSize:24,renderMode:g,theme:a})]}),e.jsxs("div",{className:"rfp-min-w-0",children:[e.jsx("div",{className:"rfp-text-sm rfp-text-fg-tertiary rfp-mb-3",children:"Chinese Characters"}),e.jsx(Ue,{font:o,text:qe.chinese,fontSize:24,renderMode:g,theme:a})]})]})]})})]})},Ue=({font:r,text:t,fontSize:s,renderMode:a,theme:o})=>{const i=n.useRef(null),c=n.useRef(null),l=n.useCallback(()=>{const f=i.current,d=c.current;if(!f||!d||a!=="canvas")return;const u=f.clientWidth||600,p=window.devicePixelRatio||1,h=s*1.4,m=o==="light"?"#1f2937":"#f3f4f6",g=w=>{if(!w)return[""];const T=[];let S="";for(const k of Array.from(w)){const _=S+k;r.getAdvanceWidth(_,s)>u&&S?(T.push(S),S=k):S=_}return S&&T.push(S),T},x=[];t.split(`
|
|
70
|
+
`).forEach(w=>{g(w).forEach(T=>x.push(T))});const b=u,v=h*x.length+4;d.width=Math.max(1,Math.floor(b*p)),d.height=Math.max(1,Math.floor(v*p)),d.style.width=`${b}px`,d.style.height=`${v}px`;const y=d.getContext("2d");y&&(y.setTransform(p,0,0,p,0,0),y.clearRect(0,0,b,v),x.forEach((w,T)=>{const S=r.getPath(w,0,s+T*h,s);S.fill=m,S.draw(y)}))},[r,t,s,a,o]);return n.useEffect(()=>{if(a!=="canvas")return;l();const f=i.current;if(!f||typeof ResizeObserver>"u")return;const d=new ResizeObserver(()=>l());return d.observe(f),()=>d.disconnect()},[l,a]),a==="canvas"?e.jsx("div",{ref:i,className:"rfp-w-full",children:e.jsx("canvas",{ref:c,className:"rfp-block"})}):e.jsx("div",{ref:i,className:"rfp-w-full rfp-text-fg-primary rfp-whitespace-pre-wrap rfp-break-words",style:{fontFamily:"PreviewFont, sans-serif",fontSize:`${s}px`,lineHeight:1.4},children:t})},Ds=Object.freeze(Object.defineProperty({__proto__:null,FontRenderer:$s},Symbol.toStringTag,{value:"Module"}));exports.pdfjs=Xe;exports.FilePreviewContent=De;exports.FilePreviewEmbed=Rn;exports.FilePreviewModal=Tn;exports.LocaleProvider=kr;exports.SUPPORTED_FILE_TYPES=st;exports.VERSION=Cn;exports.configurePdfjs=Fn;exports.normalizeFile=yr;exports.normalizeFiles=wr;exports.useLocale=qt;exports.useTranslator=J;
|
|
67
71
|
//# sourceMappingURL=index.cjs.map
|