1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[31812],{13559:(e,a,t)=>{t.d(a,{SQ:()=>n,aQ:()=>l,i9:()=>o,pM:()=>r});let r="vi-VN-HoaiMyNeural",l=5e3,n=[{shortName:"vi-VN-HoaiMyNeural",label:"Ho\xe0i My \xb7 Viá»t (nữ)",locale:"vi-VN",gender:"Female"},{shortName:"vi-VN-NamMinhNeural",label:"Nam Minh \xb7 Viá»t (nam)",locale:"vi-VN",gender:"Male"},{shortName:"en-US-AriaNeural",label:"Aria \xb7 Anh Mỹ (nữ)",locale:"en-US",gender:"Female"},{shortName:"en-US-GuyNeural",label:"Guy \xb7 Anh Mỹ (nam)",locale:"en-US",gender:"Male"},{shortName:"ja-JP-NanamiNeural",label:"Nanami \xb7 Nháºt (nữ)",locale:"ja-JP",gender:"Female"},{shortName:"ja-JP-KeitaNeural",label:"Keita \xb7 Nháºt (nam)",locale:"ja-JP",gender:"Male"},{shortName:"ko-KR-SunHiNeural",label:"SunHi \xb7 H\xe0n (nữ)",locale:"ko-KR",gender:"Female"},{shortName:"ko-KR-InJoonNeural",label:"InJoon \xb7 H\xe0n (nam)",locale:"ko-KR",gender:"Male"},{shortName:"zh-CN-XiaoxiaoNeural",label:"Xiaoxiao \xb7 Trung (nữ)",locale:"zh-CN",gender:"Female"},{shortName:"zh-CN-YunxiNeural",label:"Yunxi \xb7 Trung (nam)",locale:"zh-CN",gender:"Male"}],o=[{value:.75,label:"0.75x"},{value:1,label:"1x"},{value:1.25,label:"1.25x"},{value:1.5,label:"1.5x"},{value:2,label:"2x"}]},17606:(e,a,t)=>{t.d(a,{A:()=>r});let r=(0,t(41285).A)("Volume2",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]])},17687:(e,a,t)=>{t.d(a,{A:()=>r});let r=(0,t(41285).A)("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]])},31812:(e,a,t)=>{t.r(a),t.d(a,{default:()=>h});var r=t(95818),l=t(16418),n=t(17687),o=t(94988),i=t(17606),u=t(41447),c=t(97350),s=t(55649),d=t(13559);function h(){let[e,a]=(0,l.useState)(""),[t,h]=(0,l.useState)(d.pM),[m,g]=(0,l.useState)(1),[b,p]=(0,l.useState)(!1),[x,N]=(0,l.useState)(!1),v=(0,l.useRef)(null),y=(0,l.useRef)(null);(0,l.useEffect)(()=>()=>{var e,a;null===(e=v.current)||void 0===e||e.pause(),(0,s.ZH)(null===(a=y.current)||void 0===a?void 0:a.url),y.current=null},[]);let f=(0,l.useCallback)(()=>{if(v.current)return v.current;let e=new Audio;return e.preload="auto",e.onended=()=>N(!1),e.onpause=()=>N(!1),e.onplaying=()=>N(!0),v.current=e,e},[]),k=(0,l.useCallback)(async()=>{var a,r;let l=e.trim();if(!l)return c.W.info("Chưa c\xf3 ná»i dung Äá» Äá»c."),null;let n="".concat(t,"::").concat(m,"::").concat(l);if((null===(a=y.current)||void 0===a?void 0:a.key)===n)return y.current;p(!0);try{let e=await (0,s.D4)({text:l,voice:t,rate:m});return(0,s.ZH)(null===(r=y.current)||void 0===r?void 0:r.url),y.current={key:n,url:e.url,blob:e.blob},y.current}catch(e){return c.W.error(e instanceof Error?e.message:"Kh\xf4ng tạo ÄÆ°á»£c giá»ng Äá»c."),null}finally{p(!1)}},[m,e,t]),j=(0,l.useCallback)(async()=>{if(x){var e;null===(e=v.current)||void 0===e||e.pause();return}let a=await k();if(!a)return;let t=f();t.src!==a.url&&(t.src=a.url),t.currentTime=0;try{await t.play()}catch(e){c.W.error("Tr\xecnh duyá»t chặn tá»± ph\xe1t, bấm Äá»c lần nữa.")}},[k,f,x]),w=(0,l.useCallback)(async()=>{let e=await k();if(!e)return;let a=document.createElement("a");a.href=e.url,a.download="tts-".concat(t,".mp3"),document.body.appendChild(a),a.click(),a.remove()},[k,t]),C=e.length>d.aQ;return(0,r.jsxs)("div",{className:"p-3",children:[(0,r.jsxs)("div",{className:"rounded-xl border border-border bg-background p-2.5",children:[(0,r.jsx)("textarea",{value:e,onChange:e=>a(e.target.value),rows:10,placeholder:"D\xe1n ná»i dung cần Äá»c",className:"w-full resize-y bg-transparent text-sm text-foreground outline-none placeholder:text-muted-foreground"}),(0,r.jsxs)("p",{className:"mt-1 text-right text-xs ".concat(C?"text-destructive":"text-muted-foreground"),children:[e.length.toLocaleString("vi-VN"),"/",d.aQ.toLocaleString("vi-VN")]})]}),(0,r.jsxs)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[(0,r.jsx)("select",{value:t,onChange:e=>h(e.target.value),disabled:b,title:"Giá»ng Äá»c",className:"rounded-lg border border-border bg-card px-3 py-2 text-sm font-semibold text-foreground outline-none disabled:opacity-50",children:d.SQ.map(e=>(0,r.jsx)("option",{value:e.shortName,children:e.label},e.shortName))}),(0,r.jsx)("select",{value:String(m),onChange:e=>g(Number(e.target.value)),disabled:b,title:"Tá»c Äá» Äá»c",className:"rounded-lg border border-border bg-card px-3 py-2 text-sm font-semibold text-foreground outline-none disabled:opacity-50",children:d.i9.map(e=>(0,r.jsx)("option",{value:String(e.value),children:e.label},e.value))}),(0,r.jsxs)("button",{type:"button",onClick:()=>void j(),disabled:b||C||!e.trim(),className:"inline-flex items-center gap-2 rounded-lg border border-primary bg-primary/15 px-3 py-2 text-sm font-semibold text-primary transition disabled:opacity-50",children:[b?(0,r.jsx)(n.A,{className:"h-4 w-4 animate-spin"}):x?(0,r.jsx)(o.A,{className:"h-4 w-4"}):(0,r.jsx)(i.A,{className:"h-4 w-4"}),x?"Dừng":"Äá»c"]}),(0,r.jsxs)("button",{type:"button",onClick:()=>void w(),disabled:b||C||!e.trim(),className:"inline-flex items-center gap-2 rounded-lg border border-border px-3 py-2 text-sm font-semibold text-foreground transition hover:border-primary hover:text-primary disabled:opacity-50",children:[(0,r.jsx)(u.A,{className:"h-4 w-4"}),"Tải MP3"]})]}),(0,r.jsx)("p",{className:"mt-2 text-xs text-muted-foreground",children:"Giá»ng Viá»t Äá»c Ä\xfang hÆ¡n khi c\xe2u c\xf3 dấu v\xe0 dấu c\xe2u Äầy Äá»§"})]})}},41447:(e,a,t)=>{t.d(a,{A:()=>r});let r=(0,t(41285).A)("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]])},55649:(e,a,t)=>{t.d(a,{D4:()=>n,ZH:()=>o});var r=t(13559);function l(e,a){let t=Error(e);return t.status=a,t.needsAuth=401===a,t}async function n(e){let a=e.text.trim();
1if(!a)throw l("Chưa c\xf3 ná»i dung Äá» Äá»c.",400);if(a.length>r.aQ)throw l("Ná»i dung tá»i Äa ".concat(r.aQ," k\xfd tá»±."),400);let t=e.voice||r.pM,n=await fetch("/api/tts",{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:a,voice:t,rate:e.rate,pitch:e.pitch}),signal:e.signal});if(!n.ok){let e=await n.json().catch(()=>({}));if(401===n.status)throw l("string"==typeof e.error?e.error:"Cần ÄÄng nháºp Äá» d\xf9ng Äá»c to.",401);throw l("string"==typeof e.error?e.error:"Kh\xf4ng tạo ÄÆ°á»£c giá»ng Äá»c.",n.status)}let o=await n.blob();if(!o.size)throw l("Kh\xf4ng tạo ÄÆ°á»£c giá»ng Äá»c.",500);return{blob:o,url:URL.createObjectURL(o),voice:t}}function o(e){e&&URL.revokeObjectURL(e)}},94988:(e,a,t)=>{t.d(a,{A:()=>r});let r=(0,t(41285).A)("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]])}}]);
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.