PageSourceSearch

https://paper2gal.com/assets/SettingsModal-5SZs2RBK.js

js paper2gal.com collected 2026-10-09 22:39:32 UTC 38,166 bytes, 1 lines download raw bytes

1import{r as i,d as k,j as e}from"./react-vendor-CHQL15iE.js";import{u as os,T as ds,v as be,R as cs,w as xs,s as ms}from"./main-Dck1T9BT.js";import{n as ge,c as fe,a1 as je,a2 as W,a3 as ps,a4 as us,a5 as hs,q as bs,B as gs,P as fs,X as js,o as X,a6 as ys,a7 as vs,a8 as K,a9 as ws,aa as ye,ab as Ns,i as ks,ac as ve,h as we,ad as Ne,v as ke,G as $s}from"./lucide-BFLOpGdB.js";import"./pdfjs-ji3DqnKJ.js";import"./markdown-W-rE_H7s.js";import"./katex-math-BxKHCrdI.js";const Z=o=>{const n=Number(o);return Number.isFinite(n)&&n>0?Math.floor(n):0},z=(o,n)=>o.replace(/\{\{(\w+)\}\}/g,(x,h)=>String(n[h]??x)),Cs=(o,n)=>{const x=[],h=Z(o.permanentBonus),y=Z(o.permanentVoiceBonus),$=Z(o.membershipDays);h>0&&x.push(z(n.redemptionPermanentUsesReward||"{{count}} permanent uses",{count:h})),y>0&&x.push(z(n.redemptionPermanentVoiceReward||"{{count}} permanent voice uses",{count:y})),$>0&&x.push(z(n.redemptionMembershipDaysReward||"{{count}} membership days",{count:$}));const C=x.length>0?z(n.redemptionSuccessWithRewards||"Redeemed successfully: {{rewards}}",{rewards:x.join(n.redemptionRewardSeparator||", ")}):n.redemptionSuccess||"Redeemed successfully";return o.grantVoiceCommunity&&n.redemptionCommunityReward?`${C} ${n.redemptionCommunityReward}`:C},Is=({isOpen:o,onClose:n,bgmVolume:x,setBgmVolume:h,voiceVolume:y,setVoiceVolume:$,textSpeed:C,setTextSpeed:$e,dialogueFontScale:Y,setDialogueFontScale:Ce,gameUiPreset:Se,setGameUiPreset:Te,isMembershipActive:ee=!1,isMembershipStatusLoading:Pe=!1,onOpenMembership:L,autoAdvanceDelayMs:se,setAutoAdvanceDelayMs:Ae,autoAdvanceByVoice:I,setAutoAdvanceByVoice:ze,language:v,setLanguage:Le,outputLanguage:Ie,setOutputLanguage:Ee,voiceLanguage:Fe,setVoiceLanguage:Me,playerNickname:Re,setPlayerNickname:_e,paperPreferences:m,setPaperPreferences:te,bgmUrl:p,setBgmUrl:b,customBgms:E,setCustomBgms:ae,storyQuestionArchiveEnabled:De,setStoryQuestionArchiveEnabled:Ue,onRedeemSuccess:F})=>{const a=os(),[Oe,Be]=i.useState(()=>typeof localStorage>"u"?!1:localStorage.getItem("p2g_story_question_archive_enabled")==="1"),[d,w]=i.useState("basic"),[g,M]=i.useState(null),[R,le]=i.useState(""),[_,f]=i.useState(null),[re,ne]=i.useState(!1),[D,U]=i.useState(""),[Ge,ie]=i.useState(""),[oe,de]=i.useState([]),[ce,Ve]=i.useState("MCP / CLI"),[O,j]=i.useState(!1),[B,xe]=i.useState(null),[G,u]=i.useState(null),[S,qe]=i.useState(()=>typeof document<"u"&&!!document.fullscreenElement),[He,V]=i.useState(!1),T=k.useRef(null),Qe=a?{WebkitOverflowScrolling:"touch",touchAction:"auto"}:void 0,Je=110-C,q=se/1e3,We=Number.isInteger(q)?String(q):q.toFixed(1),t=ds[v],P=De??Oe,Xe=Ue||(s=>{Be(s);try{localStorage.setItem("p2g_story_question_archive_enabled",s?"1":"0")}catch{}}),Ke=[["Artificial Intelligence",t.topicAi],["Computer Vision",t.topicVision],["Natural Language Processing",t.topicNlp],["Robotics",t.topicRobotics],["Medicine",t.topicMedicine],["Biology",t.topicBiology],["Physics",t.topicPhysics],["Chemistry",t.topicChemistry],["Materials Science",t.topicMaterials],["Economics",t.topicEconomics],["Psychology",t.topicPsychology],["Education",t.topicEducation]],me=s=>{const l=xs([...m,s]);(l.length!==m.length||l.some((r,c)=>r!==m[c]))&&te(l),ie(""),U("")},pe=v==="zh"?"zh-CN":v==="ja"?"ja-JP":v==="ru"?"ru-RU":"en-US",Ze=[{value:"auto",label:"Auto"},{value:"zh",label:"中文"},{value:"ja",label:"日本語"},{value:"en",label:"English"}],Ye=[{id:"classic",label:t.gameUiPresetClassic||"Classic Pink",desc:t.gameUiPresetClassicDesc||"Bright visual novel panel with soft pink accents.",swatch:"from-pink-100 via-white to-sky-100"},{id:"floral",label:t.gameUiPresetFloral||"Vintage Floral",desc:t.gameUiPresetFloralDesc||"Free sepia floral dialogue style with matching controls.",swatch:"from-[#3a2116] via-[#f8ead9] to-[#c49a75]"},{id:"sakura",label:t.gameUiPresetSakura||"Sakura Frame",desc:t.gameUiPresetSakuraDesc||"A refined sakura dialogue style with an ornate nameplate.",swatch:"from-pink-100 via-rose-50 to-amber-100",vipOnly:!0},{id:"gothic",label:t.gameUiPresetGothic||"Gothic Rose",desc:t.gameUiPresetGothicDesc||"A dark style with silver trim and purple rose ornaments.",swatch:"from-zinc-950 via-purple-950 to-fuchsia-900",vipOnly:!0},{id:"fullwidth",label:t.gameUiPresetFullwidth,desc:t.gameUiPresetFullwidthDesc,swatch:"from-transparent via-yellow-700 to-yellow-950",vipOnly:!0}],N=()=>{T.current&&(T.current.pause(),T.current=null),M(null)};k.useEffect(()=>{o||N()},[o]),k.useEffect(()=>()=>{N()},[]),k.useEffect(()=>{const s=()=>{qe(!!document.fullscreenElement),V(!1)};
1return document.addEventListener("fullscreenchange",s),()=>document.removeEventListener("fullscreenchange",s)},[]);const H=typeof document<"u"&&document.fullscreenEnabled,es=async()=>{if(H){V(!1);try{document.fullscreenElement?await document.exitFullscreen():await document.documentElement.requestFullscreen()}catch{V(!0)}}},ue=s=>{if(g===s){N();return}N();const l=new Audio(s);l.volume=x,ms(l,r=>console.error("Preview failed",r)),l.onended=()=>M(null),T.current=l,M(s)},ss=s=>{var c;const l=(c=s.target.files)==null?void 0:c[0];if(!l)return;if(l.size>10*1024*1024){alert("File too large (>10MB). Please use a smaller MP3.");return}const r=new FileReader;r.onload=J=>{var he;const A=(he=J.target)==null?void 0:he.result,is={name:l.name,url:A};ae([...E,is]),b(A)},r.readAsDataURL(l)},ts=s=>{const l=E.filter(r=>r.url!==s);ae(l),p===s&&b(be),g===s&&N()},as=[{id:"bgm2",url:be,label:t.bgmPeaceful||"Peaceful"},{id:"bgm3",url:"/assets/local/audio/bgm3.mp3",label:t.bgmJoyful||"Joyful"},{id:"bgm4",url:"/assets/local/audio/bgm4.mp3",label:t.bgmEmotional||"Emotional"},{id:"relaxing",url:cs,label:t.bgmRelaxing||"Relaxing"}],ls=s=>{const l=parseInt(s.target.value);$e(110-l)},Q=async()=>{const s=typeof localStorage<"u"?localStorage.getItem("p2g_token"):null;if(s){j(!0);try{const l=await fetch("/api/user/api-tokens",{headers:{Authorization:`Bearer ${s}`}}),r=await l.json().catch(()=>({}));if(!l.ok)throw new Error(r.error||t.apiTokenLoadFailed||"Failed to load API Tokens");de(Array.isArray(r.tokens)?r.tokens:[])}catch(l){u({type:"error",message:l.message||t.apiTokenLoadFailed||"Failed to load API Tokens"})}finally{j(!1)}}};k.useEffect(()=>{o&&d==="api"&&Q()},[o,d]);const rs=async()=>{const s=typeof localStorage<"u"?localStorage.getItem("p2g_token"):null;if(!s){u({type:"error",message:t.apiTokenLoginRequired||"Please log in before creating an API Token"});return}j(!0),u(null),xe(null);try{const l=await fetch("/api/user/api-tokens",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${s}`},body:JSON.stringify({name:ce.trim()||"MCP / CLI"})}),r=await l.json().catch(()=>({}));if(!l.ok)throw new Error(r.error||t.apiTokenCreateFailed||"Failed to create API Token");xe(r.token),u({type:"success",message:t.apiTokenCreatedMessage||"API Token created. Copy and save it now."}),await Q()}catch(l){u({type:"error",message:l.message||t.apiTokenCreateFailed||"Failed to create API Token"})}finally{j(!1)}},ns=async s=>{const l=typeof localStorage<"u"?localStorage.getItem("p2g_token"):null;if(l){j(!0),u(null);try{const r=await fetch(`/api/user/api-tokens/${s}`,{method:"DELETE",headers:{Authorization:`Bearer ${l}`}}),c=await r.json().catch(()=>({}));if(!r.ok)throw new Error(c.error||t.apiTokenDeleteFailed||"Failed to delete API Token");de(J=>J.filter(A=>A.id!==s)),u({type:"success",message:t.apiTokenDeletedMessage||"API Token deleted."})}catch(r){u({type:"error",message:r.message||t.apiTokenDeleteFailed||"Failed to delete API Token"})}finally{j(!1)}}};return o?e.jsx("div",{className:`absolute inset-0 z-[100] flex items-center justify-center bg-black/40 backdrop-blur-sm animate-fade-in font-sans ${a?"p-1.5 overflow-y-auto overscroll-y-contain":"p-2 md:p-4"}`,children:e.jsxs("div",{className:`bg-white/95 backdrop-blur-xl shadow-[0_20px_60px_rgba(0,0,0,0.3)] border-white ring-pink-200 overflow-hidden flex flex-row transform transition-all scale-100 ${a?"mobile-landscape-modal min-h-0 rounded-[18px] border-[2px] ring-1":"w-[96%] md:w-full md:max-w-4xl rounded-[24px] border-[2px] md:border-[4px] ring-2 h-[85dvh] md:h-[70vh]"}`,onClick:s=>s.stopPropagation(),children:[e.jsxs("div",{className:`bg-slate-50/50 border-r border-slate-100 flex flex-col shrink-0 ${a?"w-12 p-1 gap-1":"w-16 md:w-64 p-2 md:p-4 gap-2"}`,children:[e.jsxs("div",{className:a?"hidden":"hidden md:flex items-center gap-2 px-3 py-4 mb-2",children:[e.jsx("div",{className:"w-8 h-8 rounded-lg bg-pink-500 flex items-center justify-center text-white shadow-lg shadow-pink-200",children:e.jsx(ge,{size:18})}),e.jsx("h2",{className:"text-sm font-black text-slate-700 tracking-wider uppercase",children:"Options"})]}),e.jsxs("button",{onClick:()=>w("basic"),className:`${a?"flex items-center justify-center px-1.5 py-2 rounded-lg font-bold text-[10px] transition-all":"flex items-center justify-center md:justify-start gap-3 px-3 py-3 md:px-4 md:py-3 rounded-xl font-bold text-sm transition-all"} ${d==="basic"?"bg-white text-pink-500 shadow-md border border-pink-100":"text-slate-400 md:text-slate-500 hover:shadow-md hover:shadow-
1pink-200/70"}`,title:t.settings,children:[e.jsx(ge,{size:a?16:20,className:"shrink-0"}),!a&&e.jsx("span",{children:t.settings||"基本设置"})]}),e.jsxs("button",{onClick:()=>w("ai"),className:`${a?"flex items-center justify-center px-1.5 py-2 rounded-lg font-bold text-[10px] transition-all":"flex items-center justify-center md:justify-start gap-3 px-3 py-3 md:px-4 md:py-3 rounded-xl font-bold text-sm transition-all"} ${d==="ai"?"bg-white text-indigo-500 shadow-md border border-indigo-100":"text-slate-400 md:text-slate-500 hover:shadow-md hover:shadow-violet-200/70"}`,title:t.aiSettings,children:[e.jsx(fe,{size:a?16:20,className:"shrink-0"}),!a&&e.jsx("span",{children:t.aiSettings||"AI设置"})]}),e.jsxs("button",{onClick:()=>w("api"),className:`${a?"flex items-center justify-center px-1.5 py-2 rounded-lg font-bold text-[10px] transition-all":"flex items-center justify-center md:justify-start gap-3 px-3 py-3 md:px-4 md:py-3 rounded-xl font-bold text-sm transition-all"} ${d==="api"?"bg-white text-sky-500 shadow-md border border-sky-100":"text-slate-400 md:text-slate-500 hover:shadow-md hover:shadow-sky-200/70"}`,title:"API Token",children:[e.jsx(je,{size:a?16:20,className:"shrink-0"}),!a&&e.jsx("span",{children:"API Token"})]}),e.jsxs("button",{onClick:()=>w("music"),className:`${a?"flex items-center justify-center px-1.5 py-2 rounded-lg font-bold text-[10px] transition-all":"flex items-center justify-center md:justify-start gap-3 px-3 py-3 md:px-4 md:py-3 rounded-xl font-bold text-sm transition-all"} ${d==="music"?"bg-white text-orange-500 shadow-md border border-orange-100":"text-slate-400 md:text-slate-500 hover:shadow-md hover:shadow-orange-200/70"}`,title:t.musicSettings,children:[e.jsx(W,{size:a?16:20,className:"shrink-0"}),!a&&e.jsx("span",{children:t.musicSettings||"音乐设置"})]}),e.jsxs("button",{onClick:()=>w("redemption"),className:`${a?"flex items-center justify-center px-1.5 py-2 rounded-lg font-bold text-[10px] transition-all":"flex items-center justify-center md:justify-start gap-3 px-3 py-3 md:px-4 md:py-3 rounded-xl font-bold text-sm transition-all"} ${d==="redemption"?"bg-white text-emerald-500 shadow-md border border-emerald-100":"text-slate-400 md:text-slate-500 hover:shadow-md hover:shadow-green-200/70"}`,title:t.redemptionCode||"兑换码",children:[e.jsx(ps,{size:a?16:20,className:"shrink-0"}),!a&&e.jsx("span",{children:t.redemptionCode||"兑换码"})]})]}),e.jsxs("div",{className:"flex-1 flex flex-col min-w-0 bg-white",children:[e.jsxs("div",{className:`flex-1 overflow-y-auto custom-scrollbar overscroll-y-contain ${a?"p-2":"p-4 md:p-10"}`,style:Qe,children:[d==="basic"&&e.jsx("div",{className:`${a?"space-y-3":"space-y-8"} animate-fade-in-up`,children:e.jsxs("div",{children:[e.jsxs("h3",{className:`${a?"text-base mb-3":"text-xl mb-6"} font-black text-slate-800 flex items-center gap-2`,children:[e.jsx("div",{className:"w-1.5 h-6 bg-pink-500 rounded-full"}),t.settings||"基本设置"]}),e.jsxs("div",{className:`${a?"space-y-5":"space-y-8"}`,children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("label",{className:`font-bold text-slate-600 flex items-center gap-2 ${a?"text-xs":"text-sm"}`,children:[e.jsx(us,{className:"text-green-500",size:18})," ",t.language]}),e.jsx("div",{className:a?"grid grid-cols-2 gap-2":"grid grid-cols-2 md:grid-cols-4 gap-2",children:["zh","en","ja","ru"].map(s=>e.jsx("button",{onClick:()=>Le(s),className:`${a?"py-2 rounded-xl text-xs":"py-3 rounded-2xl text-sm"} border-2 font-bold transition-all ${v===s?"border-green-500 bg-green-50 text-green-700 shadow-sm":"border-slate-100 bg-white text-slate-400 hover:border-green-200"}`,children:s==="zh"?"中文":s==="en"?"English":s==="ja"?"日本語":"Русский"},s))})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("label",{className:`font-bold text-slate-600 flex items-center gap-2 ${a?"text-xs":"text-sm"}`,children:[e.jsx(fe,{className:"text-pink-500",size:18})," ",t.gameUiPreset||"Game UI Preset"]}),e.jsx("div",{className:a?"grid grid-cols-1 gap-2":"grid grid-cols-1 md:grid-cols-2 gap-3",children:Ye.map(s=>{const l=Se===s.id,r=s.vipOnly&&!ee,c=s.vipOnly&&Pe;return e.jsxs("button",{"data-testid":`game-ui-preset-${s.id}`,"aria-pressed":l,type:"button",disabled:c,onClick:()=>
1{if(r){L==null||L();return}Te(s.id)},className:`group relative flex items-center gap-3 rounded-2xl border-2 p-3 text-left transition-all ${l?"border-pink-400 bg-pink-50 shadow-md shadow-pink-100":r?"border-amber-100 bg-amber-50/50 hover:border-amber-200 hover:shadow-sm disabled:cursor-wait":"border-slate-100 bg-white hover:border-pink-200 hover:shadow-sm"}`,children:[e.jsx("span",{className:`h-12 w-16 shrink-0 rounded-xl bg-gradient-to-br ${s.swatch} shadow-inner ring-1 ring-black/5 transition-transform group-hover:scale-105 ${r?"opacity-70":""}`}),e.jsxs("span",{className:"min-w-0",children:[e.jsxs("span",{className:`flex items-center gap-2 text-sm font-black ${l?"text-pink-600":r?"text-amber-700":"text-slate-700"}`,children:[e.jsx("span",{className:"truncate",children:s.label}),s.vipOnly&&e.jsxs("span",{className:`inline-flex shrink-0 items-center gap-1 rounded-full px-2 py-0.5 text-[9px] font-black ${ee?"bg-pink-100 text-pink-600":"bg-amber-100 text-amber-700"}`,children:[r?e.jsx(hs,{size:9}):e.jsx(bs,{size:9}),"VIP"]})]}),e.jsx("span",{className:"mt-1 block text-[10px] font-bold leading-snug text-slate-400",children:s.desc})]})]},s.id)})})]}),e.jsxs("div",{className:"space-y-3 rounded-[22px] border border-pink-100 bg-pink-50/40 p-4",children:[e.jsxs("label",{className:`font-bold text-slate-600 flex items-center gap-2 ${a?"text-xs":"text-sm"}`,children:[e.jsx(gs,{className:"text-pink-500",size:18})," ",t.paperPreferencesTitle||"Paper preferences"]}),e.jsx("p",{className:"text-[10px] md:text-xs text-slate-400",children:t.paperPreferencesHint||"Choose up to three research interests for daily recommendations."}),e.jsxs("select",{value:Ge,onChange:s=>{ie(s.target.value),me(s.target.value)},disabled:m.length>=3,className:"w-full rounded-xl border-2 border-white bg-white px-3 py-2 text-sm font-bold text-slate-600 outline-none focus:border-pink-300 disabled:opacity-50",children:[e.jsx("option",{value:"",children:t.paperPreferencesPreset||"Choose a research topic"}),Ke.map(([s,l])=>e.jsx("option",{value:s,children:l},s))]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",value:D,onChange:s=>U(s.target.value),maxLength:80,disabled:m.length>=3,placeholder:t.paperPreferencesCustom||"Custom research topic",className:"min-w-0 flex-1 rounded-xl border-2 border-white bg-white px-3 py-2 text-sm outline-none focus:border-pink-300 disabled:opacity-50"}),e.jsxs("button",{type:"button",onClick:()=>{me(D),U("")},disabled:!D.trim()||m.length>=3,className:"flex items-center gap-1 rounded-xl bg-pink-500 px-3 py-2 text-xs font-black text-white disabled:opacity-40",children:[e.jsx(fs,{size:14})," ",t.paperPreferencesAdd||"Add"]})]}),m.length>0&&e.jsx("div",{className:"flex flex-wrap gap-2 pt-1",children:m.map(s=>e.jsxs("span",{className:"flex items-center gap-1 rounded-full border border-pink-100 bg-white px-3 py-1.5 text-xs font-bold text-slate-600",children:[s,e.jsx("button",{type:"button",onClick:()=>te(m.filter(l=>l!==s)),className:"text-slate-300 hover:text-pink-500","aria-label":String(t.paperPreferencesRemove||"Remove {{name}}").replace("{{name}}",s),children:e.jsx(js,{size:13})})]},s))})]}),e.jsx("div",{className:`${a?"p-3 rounded-[18px]":"p-4 rounded-[22px]"} mb-6 border border-violet-100 bg-violet-50/70`,children:e.jsxs("button",{type:"button",role:"switch","aria-label":t.storyQuestionArchiveTitle||"Save story questions","aria-checked":P,onClick:()=>Xe(!P),className:"w-full flex items-center justify-between gap-4 text-left",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"font-bold text-slate-700 text-sm",children:t.storyQuestionArchiveTitle||"Save story questions"}),e.jsx("div",{className:"mt-1 text-xs text-slate-500",children:t.storyQuestionArchivePrivacy||"Only you can access saved questions. Replay does not call AI or TTS."})]}),e.jsx("div",{className:`relative w-11 h-6 rounded-full border-2 shrink-0 ${P?"bg-violet-500 border-violet-400":"bg-slate-200 border-slate-300"}`,children:e.jsx("div",{className:`absolute top-0.5 w-4 h-4 bg-white rounded-full shadow-md transition-transform ${P?"translate-x-5":"translate-x-0.5"}`})})]})}),e.jsxs("div",{className:a?"grid grid-cols-1 gap-4":"grid grid-cols-1 md:grid-cols-2 gap-8",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsxs("label",{className:`font-bold text-slate-600 flex items-center gap-2 ${a?"text-xs":"text-sm"}`,children:[e.jsx(X,{className:"text-brand-blue",size:18})," ",t.bgmVolume||t.volume]}),e.jsxs("div",{className:"px-1",children:[e.jsx("input",{type:"range",min:"0",max:"1",step:"0.05",value:x,onChange:s=>h(parseFloat(s.target.value)),className:"w-full h-2.5 bg-slate-100 rounded-full appearance-none cursor-pointer accent-brand-blue"}),e.jsxs("div",{className:"flex justify-between mt-2 text-[10px] font-bold text-slate-300",children:[e.jsx("span",{children:"MIN"}),e.jsxs("span",{children:[Math.round(x*100),"%"]}),e.jsx("span",{children:"MAX"})]})]})]}),e.jsx("div",{className:`${a?"p-3 rounded-[18px]":"p-4 rounded-[22px]"} border border-slate-100 bg-slate-50/80`,children:e.jsxs("button",{type:"button",role:"switch","aria-checked":S,disabled:!H,onClick:es,className:"w-full flex items-center justify-between gap-4 text-left disabled:cursor-not-allowed disabled:opacity-55",children:[e.jsxs("div",{className:"flex min-w-0 items-start gap-3",children:[S?e.jsx(ys,{className:"mt-0.5 shrink-0 text-pink-500",size:18}):e.jsx(vs,{className:"mt-0.5 shrink-0 text-pink-500",size:18}),e.jsxs("div",{children:[e.jsx("div",{className:`font-bold text-slate-700 ${a?"text-xs":"text-sm"}`,children:t.fullscreenMode||"全屏模式"}),e.jsx("div",{className:`mt-1 text-slate-400 ${a?"text-[10px]":"text-xs"}`,children:H?He?t.fullscreenFailed||"无法进入全屏,请检查浏览器权限。":t.fullscreenModeHint||"隐藏浏览器界面,按 Esc 可退出全屏。":t.fullscreenUnsupported||"当前浏览器不支持网页全屏。"})]})]}),e.jsx("div",{className:`relative w-11 h-6 rounded-full transition-all duration-300 border-2 shrink-0 ${S?"bg-pink-500 border-pink-400":"bg-slate-200 border-slate-300"}`,children:e.jsx("div",{className:`absolute top-0.5 w-4 h-4 bg-white rounded-full shadow-md transition-all duration-300 transform ${S?"translate-x-5":"translate-x-0.5"}`})})]})}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("label",{className:`font-bold text-slate-600 flex items-center gap-2 ${a?"text-xs":"text-sm"}`,children:[e.jsx(X,{className:"text-brand-orange",size:18})," ",t.voiceVolume||t.voiceMode||"Voice"]}),e.jsxs("div",{className:"px-1",children:[e.jsx("input",{type:"range",min:"0",max:"1",step:"0.05",value:y,onChange:s=>$(parseFloat(s.target.value)),className:"w-full h-2.5 bg-slate-100 rounded-full appearance-none cursor-pointer accent-brand-orange"}),e.jsxs("div",{className:"flex justify-between mt-2 text-[10px] font-bold text-slate-300",children:[e.jsx("span",{children:"MIN"}),e.jsxs("span",{children:[Math.round(y*100),"%"]}),e.jsx("span",{children:"MAX"})]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("label",{className:`font-bold text-slate-600 flex items-center gap-2 ${a?"text-xs":"text-sm"}`,children:[e.jsx(K,{className:"text-brand-orange",size:18})," ",t.textSpeed]}),e.jsxs("div",{className:"px-1",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(ws,{size:16,className:"text-slate-300"}),e.jsx("input",{type:"range",min:"10",max:"100",step:"5",value:Je,onChange:ls,className:"flex-1 h-2.5 bg-slate-100 rounded-full appearance-none cursor-pointer accent-brand-orange"}),e.jsx(ye,{size:16,className:"text-brand-orange"})]}),e.jsxs("div",{className:"flex justify-between mt-2 text-[10px] font-bold text-slate-300",children:[e.jsx("span",{children:"SLOW"}),e.jsx("span",{children:"FAST"})]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("label",{className:`font-bold text-slate-600 flex items-center gap-2 ${a?"text-xs":"text-sm"}`,children:[e.jsx(K,{className:"text-pink-500",size:18})," ",t.fontSize||"字体大小"]}),e.jsxs("div",{className:"px-1",children:[e.jsx("input",{type:"range",min:"0.8",max:"1.4",step:"0.05",value:Y,onChange:s=>Ce(parseFloat(s.target.value)),className:"w-full h-2.5 bg-slate-100 rounded-full appearance-none cursor-pointer accent-pink-500"}),e.jsxs("div",{className:"flex justify-between mt-2 text-[10px] font-bold text-slate-300",children:[e.jsx("span",{children:"SMALL"}),e.jsxs("span",{children:[Math.round(Y*100),"%"]}),e.jsx("span",{children:"LARGE"})]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("label",{className:`font-bold text-slate-600 flex items-center gap-2 ${a?"text-xs":"text-sm"}`,children:[e.jsx(ye,{className:"text-sky-500",size:18})," ",t.autoAdvanceDelay||"自动翻页间隔"]}),e.jsxs("div",{className:"px-1",children:[e.jsx("input",{type:"range",min:"2000",max:"30000",step:"500",value:se,onChange:s=>Ae(parseInt(s.target.value,10)),className:"w-full h-2.5 bg-slate-100 rounded-full appearance-none cursor-pointer accent-sky-500"}),e.jsxs("div",{className:"flex justify-between mt-2 text-[10px] font-bold text-slate-300",children:[e.jsx("span",{children:"2s"}),e.jsxs("span",{children:[We,"s"]}),e.jsx("span",{children:"30s"})]})]})]}),e.jsx("div",{className:`${a?"p-3 rounded-[18px]":"p-4 rounded-[22px]"} border border-slate-100 bg-slate-50/80`,children:e.jsxs("button",{type:"button",onClick:()=>ze(!I),className:"w-full flex items-center justify-between gap-4 text-left",children:[e.jsxs("div",{children:[e.jsx("div",{className:`font-bold text-slate-700 ${a?"text-xs":"text-sm"}`,children:t.autoAdvanceByVoice||"根据语音自动翻页"}),e.jsx("div",{className:"text-[10px] md:text-xs text-slate-400 mt-1",children:t.autoAdvanceByVoiceHint||"开启后自动模式会在语音播放结束后 1 秒翻页;无语音时回退到上方间隔。"})]}),e.jsx("div",{className:`relative w-11 h-6 rounded-full transition-all duration-300 border-2 shrink-0 ${I?"bg-sky-500 border-sky-400":"bg-slate-200 border-slate-300"}`,children:e.jsx("div",{className:`absolute top-0.5 w-4 h-4 bg-white rounded-full shadow-md transition-all duration-300 transform ${I?"translate-x-5":"translate-x-0.5"}`})})]})})]})]})]})}
1),d==="ai"&&e.jsx("div",{className:`${a?"space-y-3":"space-y-8"} animate-fade-in-up`,children:e.jsxs("div",{children:[e.jsxs("h3",{className:`${a?"text-base mb-3":"text-xl mb-6"} font-black text-slate-800 flex items-center gap-2`,children:[e.jsx("div",{className:"w-1.5 h-6 bg-indigo-500 rounded-full"}),t.aiSettings||"AI设置"]}),e.jsxs("div",{className:`${a?"space-y-5":"space-y-8"}`,children:[e.jsxs("div",{className:`${a?"space-y-2":"space-y-3"}`,children:[e.jsxs("label",{className:"font-bold text-indigo-700 flex items-center gap-2 text-sm",children:[e.jsx(Ns,{className:"text-pink-500",size:18})," ",t.playerNickname]}),e.jsx("input",{type:"text",value:Re,onChange:s=>_e(s.target.value),placeholder:t.playerNicknameHint,maxLength:20,className:`w-full bg-white border border-indigo-100 rounded-2xl px-4 py-3 text-sm text-slate-700 focus:border-indigo-400 focus:ring-4 focus:ring-indigo-50 outline-none transition-all ${a?"touch-pan-y":""}`,style:a?{touchAction:"pan-y"}:void 0}),e.jsx("p",{className:"text-[10px] md:text-xs text-indigo-400/80 leading-relaxed font-medium",children:t.playerNicknameHint})]}),e.jsxs("div",{className:`${a?"p-3 rounded-[18px] space-y-3":"p-5 rounded-[24px] space-y-4"} bg-indigo-50/50 border border-indigo-100/50`,children:[e.jsxs("div",{className:`${a?"space-y-2":"space-y-3"}`,children:[e.jsxs("label",{className:`font-bold text-indigo-700 flex items-center gap-2 ${a?"text-xs":"text-sm"}`,children:[e.jsx(K,{size:18})," ",t.outputLanguage]}),e.jsx("input",{type:"text",value:Ie,onChange:s=>Ee(s.target.value),placeholder:"default (same as UI)",className:`w-full bg-white border border-indigo-100 rounded-2xl px-4 py-3 text-sm text-slate-700 focus:border-indigo-400 focus:ring-4 focus:ring-indigo-50 outline-none transition-all ${a?"touch-pan-y":""}`,style:a?{touchAction:"pan-y"}:void 0}),e.jsx("p",{className:"text-[10px] md:text-xs text-indigo-400/80 leading-relaxed font-medium",children:t.outputLanguageHint})]}),e.jsxs("div",{className:`${a?"space-y-2":"space-y-3"}`,children:[e.jsxs("label",{className:`font-bold text-indigo-700 flex items-center gap-2 ${a?"text-xs":"text-sm"}`,children:[e.jsx(X,{size:18})," ",t.voiceOutputLanguage||"Voice Output"]}),e.jsx("div",{className:"grid grid-cols-4 gap-2",children:Ze.map(s=>{const l=(Fe||"auto")===s.value;return e.jsx("button",{type:"button",onClick:()=>Me(s.value),className:`${a?"py-2 rounded-xl text-[11px]":"py-2.5 rounded-2xl text-xs"} border-2 font-black transition-all ${l?"border-indigo-500 bg-white text-indigo-700 shadow-sm":"border-white/70 bg-white/60 text-slate-400 hover:border-indigo-200"}`,children:s.label},s.value)})}),e.jsx("p",{className:"text-[10px] md:text-xs text-indigo-400/80 leading-relaxed font-medium",children:t.voiceOutputLanguageHint||"Auto follows the site language. If voice differs from AI output text, a separate voice line is generated for TTS."})]})]})]})]})}),d==="api"&&e.jsx("div",{className:`${a?"space-y-3":"space-y-6"} animate-fade-in-up`,children:e.jsxs("div",{children:[e.jsxs("h3",{className:`${a?"text-base mb-3":"text-xl mb-6"} font-black text-slate-800 flex items-center gap-2`,children:[e.jsx("div",{className:"w-1.5 h-6 bg-sky-500 rounded-full"}),"API Token"]}),e.jsxs("p",{className:"text-xs text-slate-500 mb-4 leading-relaxed",children:[t.apiTokenDescriptionPrefix||"Use this for MCP or CLI access to Paper2Gal. CLI install: ",e.jsx("a",{href:"https://www.npmjs.com/package/@paper2gal/cli",target:"_blank",rel:"noopener noreferrer",className:"font-bold text-sky-600 hover:text-sky-700 hover:underline",children:"@paper2gal/cli"}),t.apiTokenDescriptionSuffix||". Tokens are shown only once when created. Copy and save them."]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"rounded-2xl border border-sky-100 bg-sky-50/50 p-4 space-y-3",children:[e.jsxs("label",{className:"text-[10px] font-black text-slate-400 uppercase tracking-widest flex items-center gap-1.5",children:[e.jsx(je,{size:12})," ",t.apiTokenNameLabel||"Token Name"]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[e.jsx("input",{type:"text",value:ce,onChange:s=>Ve(s.target.value),className:"flex-1 bg-white border border-slate-200 rounded-2xl px-4 py-3 text-sm text-slate-700 focus:border-sky-400 focus:ring-4 focus:ring-sky-50 outline-none transition-all shadow-sm",placeholder:"MCP / CLI"}),e.jsx("button",{type:"button",disabled:O,onClick:rs,className:"shrink-0 px-5 py-3 rounded-2xl font-black text-sm bg-sky-500 text-white shadow-md hover:bg-sky-600 disabled:opacity-50 transition-all",children:t.apiTokenCreateButton||"Create Token"})]})]}),B&&e.jsxs("div",{className:"rounded-2xl border border-emerald-100 bg-emerald-50 p-4 space-y-3",children:[e.jsx("div",{className:"text-xs font-black text-emerald-700",children:t.apiTokenNewTokenLabel||"New Token (shown once)"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{readOnly:!0,value:B,className:"flex-1 min-w-0 bg-white border border-emerald-100 rounded-xl px-3 py-2 text-xs font-mono text-slate-700"}),e.jsx("button",{type:"button",onClick:()=>{var s;return(s=navigator.clipboard)==null?void 0:s.writeText(B)},className:"px-3 py-2 rounded-xl bg-white border border-emerald-100 text-emerald-700 font-bold text-xs hover:bg-emerald-100 transition-colors",children:e.jsx(ks,{size:14})})]})]}),G&&e.jsx("div",{className:`rounded-xl px-4 py-3 text-sm font-medium ${G.type==="success"?"bg-emerald-50 text-emerald-700 border border-emerald-100":"bg-red-50 text-red-700 border border-red-100"}`,children:G.message}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h4",{className:"text-sm font-black text-slate-700",children:t.apiTokenMyTokens||"My Tokens"}),e.jsx("button",{type:"button",onClick:Q,disabled:O,className:"text-xs font-bold text-sky-600 hover:text-sky-700 disabled:opacity-50",children:t.refresh||"Refresh"})]}),e.jsx("div",{className:"space-y-2",children:oe.length===0?e.jsx("div",{className:"rounded-2xl border border-slate-100 bg-slate-50 px-4 py-5 text-sm text-slate-400 font-bold text-center",children:t.apiTokenEmpty||"No API Tokens"}):oe.map(s=>e.jsxs("div",{className:"rounded-2xl border border-slate-100 bg-white px-4 py-3 flex items-center gap-3",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"font-black text-slate-700 text-sm truncate",children:s.name}),e.jsxs("div",{className:"text-[11px] text-slate-400 font-mono mt-0.5",children:[s.prefix,"..."]}),e.jsxs("div",{className:"text-[10px] text-slate-400 mt-1",children:[t.apiTokenCreatedAt||"Created",": ",new Date(s.createdAt).toLocaleStr
1ing(pe)," · ",t.apiTokenLastUsedAt||"Last used",": ",s.lastUsedAt?new Date(s.lastUsedAt).toLocaleString(pe):t.apiTokenNeverUsed||"Never used"]})]}),e.jsx("button",{type:"button",onClick:()=>ns(s.id),disabled:O,className:"p-2 rounded-xl bg-red-50 text-red-500 hover:bg-red-100 disabled:opacity-50 transition-colors",children:e.jsx(ve,{size:16})})]},s.id))})]})]})]})}),d==="redemption"&&e.jsx("div",{className:`${a?"space-y-3":"space-y-8"} animate-fade-in-up`,children:e.jsxs("div",{children:[e.jsxs("h3",{className:`${a?"text-base mb-3":"text-xl mb-6"} font-black text-slate-800 flex items-center gap-2`,children:[e.jsx("div",{className:"w-1.5 h-6 bg-emerald-500 rounded-full"}),t.redemptionCode||"兑换码"]}),e.jsx("p",{className:"text-xs text-slate-500 mb-4",children:t.redemptionCodeHint||"输入兑换码可获得永久使用次数或永久语音次数;每个账号对同一兑换码仅可使用一次。"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[e.jsx("input",{type:"text",value:R,onChange:s=>{le(s.target.value),f(null)},placeholder:t.redemptionCodePlaceholder||"请输入兑换码",className:"flex-1 bg-white border border-slate-200 rounded-2xl px-4 py-3 text-sm text-slate-700 focus:border-emerald-400 focus:ring-4 focus:ring-emerald-50 outline-none transition-all shadow-sm"}),e.jsx("button",{type:"button",disabled:re||!R.trim(),onClick:async()=>{ne(!0),f(null);try{const s=typeof localStorage<"u"?localStorage.getItem("p2g_token"):null,l={"Content-Type":"application/json"};s&&(l.Authorization=`Bearer ${s}`);const r=await fetch("/api/redeem",{method:"POST",headers:l,credentials:"include",body:JSON.stringify({code:R.trim()})}),c=await r.json().catch(()=>({}));r.ok&&c.success?(f({type:"success",message:Cs(c,t)}),le(""),F==null||F()):r.status===401?f({type:"error",message:t.redeemLoginRequired||"请先登录后再兑换"}):f({type:"error",message:c.error||t.redeemFailed||"兑换失败"})}catch{f({type:"error",message:t.redeemFailed||"兑换失败,请稍后重试"})}finally{ne(!1)}},className:"shrink-0 px-6 py-3 rounded-2xl font-bold text-sm bg-emerald-500 text-white shadow-md hover:bg-emerald-600 disabled:opacity-50 disabled:cursor-not-allowed transition-all",children:re?t.redeeming||"兑换中...":t.redeem||"兑换"})]}),_&&e.jsx("div",{className:`rounded-xl px-4 py-3 text-sm font-medium ${_.type==="success"?"bg-emerald-50 text-emerald-700 border border-emerald-100":"bg-red-50 text-red-700 border border-red-100"}`,children:_.message})]})]})}),d==="music"&&e.jsx("div",{className:`${a?"space-y-3":"space-y-8"} animate-fade-in-up`,children:e.jsxs("div",{children:[e.jsxs("h3",{className:`${a?"text-base mb-3":"text-xl mb-6"} font-black text-slate-800 flex items-center gap-2`,children:[e.jsx("div",{className:"w-1.5 h-6 bg-orange-500 rounded-full"}),t.musicSettings||"音乐设置"]}),e.jsx("p",{className:"text-xs text-slate-500 mb-4",children:t.bgmCredit}),e.jsxs("div",{className:`${a?"space-y-3.5":"space-y-6"}`,children:[e.jsx("div",{className:a?"grid grid-cols-1 gap-3":"grid grid-cols-1 md:grid-cols-2 gap-4",children:as.map(s=>e.jsxs("div",{className:`group relative ${a?"p-2.5 rounded-[16px]":"p-4 rounded-[24px]"} border-2 transition-all duration-300 flex items-center justify-between ${p===s.url?"bg-orange-50/50 border-orange-200 shadow-lg shadow-orange-100/50":"bg-white border-slate-100 hover:border-orange-100"}`,children:[e.jsxs("div",{className:"flex items-center gap-3 overflow-hidden",children:[e.jsx("div",{onClick:()=>b(s.url),className:`${a?"w-8 h-8 rounded-lg":"w-10 h-10 rounded-xl"} flex items-center justify-center cursor-pointer transition-all ${p===s.url?"bg-orange-500 text-white":"bg-slate-100 text-slate-400 group-hover:bg-orange-100 group-hover:text-orange-500"}`,children:p===s.url?e.jsx(we,{size:20,strokeWidth:3}):e.jsx(W,{size:18})}),e.jsxs("div",{className:"truncate",onClick:()=>b(s.url),children:[e.jsx("p",{className:`font-bold ${a?"text-xs":"text-sm"} truncate ${p===s.url?"text-orange-700":"text-slate-600"}`,children:s.label}),e.jsx("p",{className:"text-[10px] text-slate-400 font-medium",children:"Remote Stream"})]})]}),e.jsx("button",{onClick:()=>ue(s.url),className:`${a?"p-1.5":"p-2"} rounded-full transition-all ${g===s.url?"bg-orange-500 text-white shadow-lg":"bg-white text-slate-400 hover:text-orange-500 border border-slate-100 shadow-sm"}`,children:g===s.url?e.jsx(Ne,{size:16,fill:"white"}):e.jsx(ke,{size:16,fill:"currentColor"})})]},s.id))}),e.jsx("div",{className:"h-px bg-slate-100 w-full"}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h4",{className:"text-[10px] font-black text-slate-400 uppercase tracking-widest ml-1",children:"Custom Uploaded"}),e.jsxs("div",{className:`${a?"grid grid-cols-1 gap-3":"grid grid-cols-1 md:grid-cols-2 gap-4"} max-h-64 overflow-y-auto custom-scrollbar pr-2`,children:[E.map((s,l)=>e.jsxs("div",{className:`group relative ${a?"p-2.5 rounded-[16px]":"p-4 rounded-[24px]"} border-2 transition-all duration-300 flex items-center justify-between ${p===s.url?"bg-orange-50/50 border-orange-200 shadow-lg shadow-orange-100/50":"bg-white border-slate-100 hover:border-orange-100"}`,children:[e.jsxs("div",{className:"flex items-center gap-3 overflow-hidden flex-1",children:[e.jsx("div",{onClick:()=>b(s.url),className:`shrink-0 ${a?"w-8 h-8 rounded-lg":"w-10 h-10 rounded-xl"} flex items-center justify-center cursor-pointer transition-all ${p===s.url?"bg-orange-500 text-white":"bg-slate-100 text-slate-400 group-hover:bg-orange-100 group-hover:text-orange-500"}`,children:p===s.url?e.jsx(we,{size:20,strokeWidth:3}):e.jsx(W,{size:18})}),e.jsxs("div",{className:"truncate",onClick:()=>b(s.url),children:[e.jsx("p",{className:`font-bold ${a?"text-xs":"text-sm"} truncate ${p===s.url?"text-orange-700":"text-slate-600"}`,children:s.name}),e.jsx("p",{className:"text-[10px] text-slate-400 font-medium",children:"Local Storage"})]})]}),e.jsxs("div",{className:"flex items-center gap-2 px-1",children:[e.jsx("button",{onClick:()=>ue(s.url),className:`${a?"p-1.5":"p-2"} rounded-full transition-all ${g===s.url?"bg-orange-500 text-white shadow-lg":"bg-white text-slate-400 hover:text-orange-500 border border-slate-100 shadow-sm"}`,children:g===s.url?e.jsx(Ne,{size:16,fill:"white"}):e.jsx(ke,{size:16,fill:"currentColor"})}),e.jsx("button",{onClick:()=>ts(s.url),className:`${a?"p-1.5":"p-2"} bg-white text-slate-300 hover:text-red-500 rounded-full border border-slate-100 shadow-sm transition-all`,children:e.jsx(ve,{size:16})})]})]},l)),e.jsxs("div",{className:`${a?"col-span-1 p-3 rounded-[16px] gap-2.5":"col-span-1 md:col-span-2 p-6 rounded-[32px] gap-4"} border-2 border-dashed border-slate-200 bg-slate-50/50 hover:bg-white hover:border-orange-200 transition-all group flex flex-col items-center justify-center text-center`,children:[e.jsx("div",{className:"w-12 h-12 rounded-full bg-white shadow-sm flex items-center justify-center text-slate-300 group-hover:text-orange-400 transition-colors",children:e.jsx($s,{size:24})}),e.jsx("div",{children:e.jsx("h4",{className:"font-black text-slate-700 text-sm whitespace-nowrap",children:t.uploadCustomBgm||"上传本地音乐"})}),e.jsxs("label",{className:"cursor-pointer bg-white border border-slate-200 hover:border-orange-500 hover:text-orange-500 px-6 py-2 rounded-xl font-bold text-xs transition-all shadow-sm",children:[e.jsx("span",{children:"Select File"}),e.jsx("input",{type:"file",accept:"audio/mpeg",className:"hidden",onChange:ss})]})]})]})]})]})]})})]}),e.jsx("div",{className:`bg-white border-t border-slate-50 flex shrink-0 ${a?"p-2 justify-center":"p-4 md:p-8 justify-end"}`,children:e.jsx("button",{onClick:n,className:`bg-slate-900 text-white rounded-[18px] font-black text-sm shadow-xl shadow-slate-200 hover:bg-pink-500 hover:shadow-
1pink-200 hover:-translate-y-0.5 active:scale-95 transition-all duration-300 ${a?"w-full max-w-[200px] px-4 py-2.5 text-xs":"px-8 py-3.5"}`,children:t.saveClose})})]})]})}):null};export{Is as default};

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