(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1863],{7270:function(e,t,r){(window.__NEXT_P=window.__NEXT_P||[]).push(["/upload",function(){return r(5370)}])},1731:function(e,t,r){"use strict";r.d(t,{Ol:function(){return i},SZ:function(){return c},Zb:function(){return l},aY:function(){return d},eW:function(){return u},ll:function(){return o}});var a=r(5893),s=r(7294),n=r(2917);let l=s.forwardRef((e,t)=>{let{className:r,...s}=e;return(0,a.jsx)("div",{ref:t,className:(0,n.cn)("rounded-xl border bg-card text-card-foreground shadow",r),...s})});l.displayName="Card";let i=s.forwardRef((e,t)=>{let{className:r,...s}=e;return(0,a.jsx)("div",{ref:t,className:(0,n.cn)("flex flex-col space-y-1.5 p-6",r),...s})});i.displayName="CardHeader";let o=s.forwardRef((e,t)=>{let{className:r,...s}=e;return(0,a.jsx)("h3",{ref:t,className:(0,n.cn)("font-semibold leading-none tracking-tight",r),...s})});o.displayName="CardTitle";let c=s.forwardRef((e,t)=>{let{className:r,...s}=e;return(0,a.jsx)("p",{ref:t,className:(0,n.cn)("text-sm text-muted-foreground",r),...s})});c.displayName="CardDescription";let d=s.forwardRef((e,t)=>{let{className:r,...s}=e;return(0,a.jsx)("div",{ref:t,className:(0,n.cn)("p-6 pt-0",r),...s})});d.displayName="CardContent";let u=s.forwardRef((e,t)=>{let{className:r,...s}=e;return(0,a.jsx)("div",{ref:t,className:(0,n.cn)("flex items-center p-6 pt-0",r),...s})});u.displayName="CardFooter"},293:function(e,t,r){"use strict";r.d(t,{I:function(){return l}});var a=r(5893),s=r(7294),n=r(2917);let l=s.forwardRef((e,t)=>{let{className:r,type:s,...l}=e;return(0,a.jsx)("input",{type:s,className:(0,n.cn)("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",r),ref:t,...l})});l.displayName="Input"},8953:function(e,t,r){"use strict";r.d(t,{_:function(){return c}});var a=r(5893),s=r(7294),n=r(9102),l=r(5139),i=r(2917);let o=(0,l.j)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),c=s.forwardRef((e,t)=>{let{className:r,...s}=e;return(0,a.jsx)(n.f,{ref:t,className:(0,i.cn)(o(),r),...s})});c.displayName=n.f.displayName},2260:function(e,t,r){"use strict";r.d(t,{E:function(){return o},m:function(){return c}});var a=r(5893),s=r(7294),n=r(2469),l=r(150),i=r(2917);let o=s.forwardRef((e,t)=>{let{className:r,...s}=e;return(0,a.jsx)(l.fC,{className:(0,i.cn)("grid gap-2",r),...s,ref:t})});o.displayName=l.fC.displayName;let c=s.forwardRef((e,t)=>{let{className:r,...s}=e;return(0,a.jsx)(l.ck,{ref:t,className:(0,i.cn)("aspect-square h-4 w-4 rounded-full border border-primary text-primary shadow focus:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",r),...s,children:(0,a.jsx)(l.z$,{className:"flex items-center justify-center",children:(0,a.jsx)(n.nQG,{className:"h-3.5 w-3.5 fill-primary"})})})});c.displayName=l.ck.displayName},963:function(e,t,r){"use strict";r.d(t,{x:function(){return i}});var a=r(5893),s=r(7294),n=r(5443),l=r(2917);let i=s.forwardRef((e,t)=>{let{className:r,children:s,...i}=e;return(0,a.jsxs)(n.fC,{ref:t,className:(0,l.cn)("relative overflow-hidden",r),...i,children:[(0,a.jsx)(n.l_,{className:"h-full w-full rounded-[inherit]",children:s}),(0,a.jsx)(o,{}),(0,a.jsx)(n.Ns,{})]})});i.displayName=n.fC.displayName;let o=s.forwardRef((e,t)=>{let{className:r,orientation:s="vertical",...i}=e;return(0,a.jsx)(n.gb,{ref:t,orientation:s,className:(0,l.cn)("flex touch-none select-none transition-colors","vertical"===s&&"h-full w-2.5 border-l border-l-transparent p-[1px]","horizontal"===s&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",r),...i,children:(0,a.jsx)(n.q4,{className:"relative flex-1 rounded-full bg-border"})})});o.displayName=n.gb.displayName},1805:function(e,t,r){"use strict";r.d(t,{SP:function(){return c},dr:function(){return o},mQ:function(){return i},nU:function(){return d}});var a=r(5893),s=r(7294),n=r(434),l=r(2917);let i=n.fC,o=s.forwardRef((e,t)=>{let{className:r,...s}=e;return(0,a.jsx)(n.aV,{ref:t,className:(0,l.cn)("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",r),...s})});o.displayName=n.aV.displayName;let c=s.forwardRef((e,t)=>{let{className:r,...s}=e;return(0,a.jsx)(n.xz,{ref:t,className:(0,l.cn)("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",r),...s})});c.displayName=n.xz.displayName;let d=s.forwardRef((e,t)=>{let{className:r,...s}=e;return(0,a.jsx)(n.VY,{ref:t,className:(0,l.cn)("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",r),...s})});d.displayName=n.VY.displayName},5370:function(e,t,r){"use strict";r.r(t),r.d(t,{default:function(){return TranscriptionPage}});var a=r(5893),s=r(7294),n=r(9663),l=r(293),i=r(1731),o=r(1805),c=r(963),d=r(2260),u=r(8953),f=r(1373);/** * @license lucide-react v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */let m=(0,f.Z)("FileAudio",[["path",{d:"M17.5 22h.5a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v3",key:"rslqgf"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M2 19a2 2 0 1 1 4 0v1a2 2 0 1 1-4 0v-4a6 6 0 0 1 12 0v4a2 2 0 1 1-4 0v-1a2 2 0 1 1 4 0",key:"9f7x3i"}]]);var p=r(7764);/** * @license lucide-react v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */let x=(0,f.Z)("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"}]]);function TranscriptionPage(){let[e,t]=(0,s.useState)(null),[f,h]=(0,s.useState)({isBusy:!1,text:"",chunks:[]}),b=(0,s.useRef)(null),[v,w]=(0,s.useState)(!1),[y,g]=(0,s.useState)(!1),[j,N]=(0,s.useState)(!1),[k,C]=(0,s.useState)([]),[R,S]=(0,s.useState)(0),[E,D]=(0,s.useState)("transcribe");(0,s.useEffect)(()=>(b.current=new Worker(r.tu(new URL(r.p+r.u(6447),r.b)),{type:void 0}),b.current.onmessage=e=>{let{status:t,data:r}=e.data;switch(t){case"progress":S(r);break;case"update":h({isBusy:!0,text:r[0],chunks:r[1].chunks}),C(r[1].chunks),g(!0);break;case"complete":h({isBusy:!1,text:r.text,chunks:r.chunks}),C(r.chunks),w(!1),N(!0),S(100);break;case"error":console.error("Transcription error:",r||"Unknown error"),w(!1),N(!1),g(!1)}},()=>{var e;null===(e=b.current)||void 0===e||e.terminate()}),[]);let handleFileChange=async e=>{var r;let a=null===(r=e.target.files)||void 0===r?void 0:r[0];if(a){let e=URL.createObjectURL(a);t(e),h({isBusy:!1,text:"",chunks:[]}),C([]),N(!1),g(!1),S(0)}},handleProcessClick=async()=>{if(e&&b.current){w(!0),g(!1),N(!1),S(0);try{let t=await fetch(e),r=await t.arrayBuffer(),a=new AudioContext({sampleRate:16e3});a.decodeAudioData(r,async e=>{var t;let r;if(2===e.numberOfChannels){let t=e.getChannelData(0),a=e.getChannelData(1);r=new Float32Array(t.length);for(let e=0;e<t.length;e++)r[e]=(t[e]+a[e])/2}else r=e.getChannelData(0);null===(t=b.current)||void 0===t||t.postMessage({type:"transcribeAudio",audioData:r.buffer,processType:E},[r.buffer])},e=>{console.error("Error decoding audio data:",e),w(!1),g(!1),N(!1)})}catch(e){console.error("Error fetching audio data:",e),w(!1),g(!1),N(!1)}}};function downloadResults(e){let saveBlob=(e,t)=>{let r=URL.createObjectURL(e),a=document.createElement("a");a.href=r,a.download=t,a.click(),URL.revokeObjectURL(r)};if("txt"===e){let e=f.chunks.map(e=>e.text).join("\n"),t=new Blob([e],{type:"text/plain"});saveBlob(t,"".concat(E,"_result.txt"))}else{let e="transcribe"===E?"timestamp,text\r\n":"translated_text\r\n";for(let t of f.chunks){let r=t.timestamp[0],a=t.text.replace(/"/g,'""');e+='"'.concat(r,'","').concat(a,'"\r\n')}let t=new Blob([e],{type:"text/csv;charset=utf-8"});saveBlob(t,"".concat(E,"_result.csv"))}}return(0,a.jsxs)("div",{className:"mx-auto max-w-4xl px-4 py-12 sm:px-6 lg:px-8",children:[(0,a.jsxs)(i.Zb,{className:"mb-8 w-full",children:[(0,a.jsxs)(i.Ol,{className:"space-y-4",children:[(0,a.jsx)(i.ll,{className:"text-center text-2xl font-bold sm:text-3xl",children:"Professional Audio & Video Transcription Services"}),(0,a.jsx)(i.SZ,{className:"text-center text-base sm:text-lg",children:"Convert your media content into accurate text with AI-powered transcription and translation. Support for multiple languages, timestamps, and custom formatting."})]}),(0,a.jsx)(i.aY,{children:(0,a.jsxs)("div",{className:"flex w-full flex-col items-center space-y-4",children:[(0,a.jsx)("label",{htmlFor:"file-upload",className:"w-full max-w-sm cursor-pointer",children:(0,a.jsx)("div",{className:"flex h-32 w-full items-center justify-center rounded-lg border-2 border-dashed hover:bg-gray-50",children:(0,a.jsxs)("div",{className:"space-y-1 text-center",children:[(0,a.jsx)(m,{className:"mx-auto h-12 w-12 text-gray-400"}),(0,a.jsxs)("div",{className:"flex text-sm text-gray-600",children:[(0,a.jsx)("span",{children:"Upload a media file"}),(0,a.jsx)(l.I,{id:"file-upload",name:"file-upload",type:"file",accept:"audio/*, video/*",className:"sr-only w-64",onChange:handleFileChange})]})]})})}),e&&(0,a.jsxs)("audio",{controls:!0,className:"w-full max-w-sm",children:[(0,a.jsx)("source",{src:e,type:"audio/mpeg"}),"Your browser does not support the audio element."]}),e&&(0,a.jsxs)(d.E,{defaultValue:"transcribe",onValueChange:e=>D(e),children:[(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(d.m,{value:"transcribe",id:"transcribe"}),(0,a.jsx)(u._,{htmlFor:"transcribe",children:"Transcribe"})]}),(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(d.m,{value:"translate",id:"translate"}),(0,a.jsx)(u._,{htmlFor:"translate",children:"Translate to English"})]})]}),e&&(0,a.jsx)(n.z,{onClick:handleProcessClick,disabled:v,className:"w-full max-w-sm",children:v?"Processing...":"transcribe"===E?"Transcribe":"Translate"})]})})]}),y&&(0,a.jsxs)(i.Zb,{className:"w-full",children:[(0,a.jsx)(i.Ol,{children:(0,a.jsxs)(i.ll,{className:"text-xl sm:text-2xl",children:["transcribe"===E?"Transcription":"Translation"," ","Results"]})}),(0,a.jsx)(i.aY,{children:(0,a.jsxs)(o.mQ,{defaultValue:"results",className:"w-full",children:[(0,a.jsxs)(o.dr,{className:"grid w-full grid-cols-2",children:[(0,a.jsx)(o.SP,{value:"results",children:"Results"}),(0,a.jsx)(o.SP,{value:"download",disabled:!j,children:"Download"})]}),(0,a.jsx)(o.nU,{value:"results",children:(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(p.Z,{className:"h-5 w-5 text-gray-400"}),(0,a.jsx)(l.I,{type:"search",placeholder:"Search results",onChange:e=>(function(e){if(""===e)C(f.chunks);else{let t=f.chunks.filter(t=>{let r=t.text.toLowerCase();return r.includes(e.toLowerCase())}).map(t=>{let r=t.text.toLowerCase(),a=e.toLowerCase(),s=t.text,n=0;for(;;){let t=r.indexOf(a,n);if(-1===t)break;let l=t+e.length;s=function(e,t,r){let a=Math.max(r-t,1),s=Math.max(r,1);return e.substr(0,t)+'<span class="bg-yellow-200 rounded-sm">'+e.substr(t,a)+"</span>"+e.substr(s)}(s,t,l),n=l+28}return{...t,text:s}});C(t)}})(e.target.value),disabled:!j,className:"w-full"})]}),(0,a.jsx)(c.x,{className:"h-[400px] w-full rounded-md border p-4",children:k.map((e,t)=>(0,a.jsxs)("div",{className:"mb-2 rounded-lg bg-white p-2 shadow",children:[(0,a.jsx)("span",{className:"mr-2 inline-block rounded-full bg-gray-200 px-3 py-1 text-sm font-semibold text-gray-700",children:function(e){let t=Math.floor(e/3600);return"".concat(t?String(t).padStart(2,"0")+":":"").concat(String(Math.floor(e%3600/60)).padStart(2,"0"),":").concat(String(Math.floor(e%60)).padStart(2,"0"))}(e.timestamp[0])}),(0,a.jsx)("span",{dangerouslySetInnerHTML:{__html:e.text}})]},t))})]})}),(0,a.jsx)(o.nU,{value:"download",children:(0,a.jsxs)("div",{className:"mt-4 flex flex-col justify-start space-y-2 sm:flex-row sm:space-y-0 sm:space-x-4",children:[(0,a.jsxs)(n.z,{onClick:()=>downloadResults("txt"),className:"w-full sm:w-auto",children:[(0,a.jsx)(x,{className:"mr-2 h-4 w-4"})," Download TXT"]}),(0,a.jsxs)(n.z,{onClick:()=>downloadResults("csv"),className:"w-full sm:w-auto",children:[(0,a.jsx)(x,{className:"mr-2 h-4 w-4"})," Download CSV"]})]})})]})})]})]})}},9102:function(e,t,r){"use strict";r.d(t,{f:function(){return i}});var a=r(7294),s=r(5320),n=r(5893),l=a.forwardRef((e,t)=>(0,n.jsx)(s.WV.label,{...e,ref:t,onMouseDown:t=>{let r=t.target;r.closest("button, input, select, textarea")||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));l.displayName="Label";var i=l},150:function(e,t,r){"use strict";r.d(t,{ck:function(){return V},fC:function(){return U},z$:function(){return I}});var a=r(7294),s=r(6206),n=r(5623),l=r(5360),i=r(5320),o=r(650),c=r(7342),d=r(8990),u=r(7546),f=r(7898),m=r(9115),p=r(5893),x="Radio",[h,b]=(0,l.b)(x),[v,w]=h(x),y=a.forwardRef((e,t)=>{let{__scopeRadio:r,name:l,checked:o=!1,required:c,disabled:d,value:u="on",onCheck:f,form:m,...x}=e,[h,b]=a.useState(null),w=(0,n.e)(t,e=>b(e)),y=a.useRef(!1),g=!h||m||!!h.closest("form");return(0,p.jsxs)(v,{scope:r,checked:o,disabled:d,children:[(0,p.jsx)(i.WV.button,{type:"button",role:"radio","aria-checked":o,"data-state":getState(o),"data-disabled":d?"":void 0,disabled:d,value:u,...x,ref:w,onClick:(0,s.M)(e.onClick,e=>{o||f?.(),g&&(y.current=e.isPropagationStopped(),y.current||e.stopPropagation())})}),g&&(0,p.jsx)(BubbleInput,{control:h,bubbles:!y.current,name:l,value:u,checked:o,required:c,disabled:d,form:m,style:{transform:"translateX(-100%)"}})]})});y.displayName=x;var g="RadioIndicator",j=a.forwardRef((e,t)=>{let{__scopeRadio:r,forceMount:a,...s}=e,n=w(g,r);return(0,p.jsx)(m.z,{present:a||n.checked,children:(0,p.jsx)(i.WV.span,{"data-state":getState(n.checked),"data-disabled":n.disabled?"":void 0,...s,ref:t})})});j.displayName=g;var BubbleInput=e=>{let{control:t,checked:r,bubbles:s=!0,...n}=e,l=a.useRef(null),i=(0,f.D)(r),o=(0,u.t)(t);return a.useEffect(()=>{let e=l.current,t=window.HTMLInputElement.prototype,a=Object.getOwnPropertyDescriptor(t,"checked"),n=a.set;if(i!==r&&n){let t=new Event("click",{bubbles:s});n.call(e,r),e.dispatchEvent(t)}},[i,r,s]),(0,p.jsx)("input",{type:"radio","aria-hidden":!0,defaultChecked:r,...n,tabIndex:-1,ref:l,style:{...e.style,...o,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function getState(e){return e?"checked":"unchecked"}var N=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],k="RadioGroup",[C,R]=(0,l.b)(k,[o.Pc,b]),S=(0,o.Pc)(),E=b(),[D,_]=C(k),P=a.forwardRef((e,t)=>{let{__scopeRadioGroup:r,name:a,defaultValue:s,value:n,required:l=!1,disabled:u=!1,orientation:f,dir:m,loop:x=!0,onValueChange:h,...b}=e,v=S(r),w=(0,d.gm)(m),[y,g]=(0,c.T)({prop:n,defaultProp:s,onChange:h});return(0,p.jsx)(D,{scope:r,name:a,required:l,disabled:u,value:y,onValueChange:g,children:(0,p.jsx)(o.fC,{asChild:!0,...v,orientation:f,dir:w,loop:x,children:(0,p.jsx)(i.WV.div,{role:"radiogroup","aria-required":l,"aria-orientation":f,"data-disabled":u?"":void 0,dir:w,...b,ref:t})})})});P.displayName=k;var L="RadioGroupItem",T=a.forwardRef((e,t)=>{let{__scopeRadioGroup:r,disabled:l,...i}=e,c=_(L,r),d=c.disabled||l,u=S(r),f=E(r),m=a.useRef(null),x=(0,n.e)(t,m),h=c.value===i.value,b=a.useRef(!1);return a.useEffect(()=>{let handleKeyDown=e=>{N.includes(e.key)&&(b.current=!0)},handleKeyUp=()=>b.current=!1;return document.addEventListener("keydown",handleKeyDown),document.addEventListener("keyup",handleKeyUp),()=>{document.removeEventListener("keydown",handleKeyDown),document.removeEventListener("keyup",handleKeyUp)}},[]),(0,p.jsx)(o.ck,{asChild:!0,...u,focusable:!d,active:h,children:(0,p.jsx)(y,{disabled:d,required:c.required,checked:h,...f,...i,name:c.name,ref:x,onCheck:()=>c.onValueChange(i.value),onKeyDown:(0,s.M)(e=>{"Enter"===e.key&&e.preventDefault()}),onFocus:(0,s.M)(i.onFocus,()=>{b.current&&m.current?.click()})})})});T.displayName=L;var M=a.forwardRef((e,t)=>{let{__scopeRadioGroup:r,...a}=e,s=E(r);return(0,p.jsx)(j,{...s,...a,ref:t})});M.displayName="RadioGroupIndicator";var U=P,V=T,I=M},7898:function(e,t,r){"use strict";r.d(t,{D:function(){return usePrevious}});var a=r(7294);function usePrevious(e){let t=a.useRef({value:e,previous:e});return a.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}}},function(e){e.O(0,[2721,9774,2888,179],function(){return e(e.s=7270)}),_N_E=e.O()}]);