(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5405],{8312:function(e,t,s){(window.__NEXT_P=window.__NEXT_P||[]).push(["/",function(){return s(2321)}])},1522:function(e,t,s){"use strict";s.d(t,{C:function(){return Badge}});var a=s(5893);s(7294);var r=s(5139),n=s(2917);let l=(0,r.j)("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function Badge(e){let{className:t,variant:s,...r}=e;return(0,a.jsx)("div",{className:(0,n.cn)(l({variant:s}),t),...r})}},293:function(e,t,s){"use strict";s.d(t,{I:function(){return l}});var a=s(5893),r=s(7294),n=s(2917);let l=r.forwardRef((e,t)=>{let{className:s,type:r,...l}=e;return(0,a.jsx)("input",{type:r,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",s),ref:t,...l})});l.displayName="Input"},8953:function(e,t,s){"use strict";s.d(t,{_:function(){return c}});var a=s(5893),r=s(7294),n=s(9102),l=s(5139),i=s(2917);let o=(0,l.j)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),c=r.forwardRef((e,t)=>{let{className:s,...r}=e;return(0,a.jsx)(n.f,{ref:t,className:(0,i.cn)(o(),s),...r})});c.displayName=n.f.displayName},2260:function(e,t,s){"use strict";s.d(t,{E:function(){return o},m:function(){return c}});var a=s(5893),r=s(7294),n=s(2469),l=s(150),i=s(2917);let o=r.forwardRef((e,t)=>{let{className:s,...r}=e;return(0,a.jsx)(l.fC,{className:(0,i.cn)("grid gap-2",s),...r,ref:t})});o.displayName=l.fC.displayName;let c=r.forwardRef((e,t)=>{let{className:s,...r}=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",s),...r,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,s){"use strict";s.d(t,{x:function(){return i}});var a=s(5893),r=s(7294),n=s(5443),l=s(2917);let i=r.forwardRef((e,t)=>{let{className:s,children:r,...i}=e;return(0,a.jsxs)(n.fC,{ref:t,className:(0,l.cn)("relative overflow-hidden",s),...i,children:[(0,a.jsx)(n.l_,{className:"h-full w-full rounded-[inherit]",children:r}),(0,a.jsx)(o,{}),(0,a.jsx)(n.Ns,{})]})});i.displayName=n.fC.displayName;let o=r.forwardRef((e,t)=>{let{className:s,orientation:r="vertical",...i}=e;return(0,a.jsx)(n.gb,{ref:t,orientation:r,className:(0,l.cn)("flex touch-none select-none transition-colors","vertical"===r&&"h-full w-2.5 border-l border-l-transparent p-[1px]","horizontal"===r&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",s),...i,children:(0,a.jsx)(n.q4,{className:"relative flex-1 rounded-full bg-border"})})});o.displayName=n.gb.displayName},2053:function(e,t,s){"use strict";s.d(t,{O:function(){return Skeleton}});var a=s(5893),r=s(2917);function Skeleton(e){let{className:t,...s}=e;return(0,a.jsx)("div",{className:(0,r.cn)("animate-pulse rounded-md bg-primary/10",t),...s})}},1805:function(e,t,s){"use strict";s.d(t,{SP:function(){return c},dr:function(){return o},mQ:function(){return i},nU:function(){return d}});var a=s(5893),r=s(7294),n=s(434),l=s(2917);let i=n.fC,o=r.forwardRef((e,t)=>{let{className:s,...r}=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",s),...r})});o.displayName=n.aV.displayName;let c=r.forwardRef((e,t)=>{let{className:s,...r}=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",s),...r})});c.displayName=n.xz.displayName;let d=r.forwardRef((e,t)=>{let{className:s,...r}=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",s),...r})});d.displayName=n.VY.displayName},2321:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return IndexPage}});var a=s(5893),r=s(7294),n=s(6310),l=s.n(n),i=s(7871),o=s(7066);let c=[{start:0,text:"The video is a commencement speech given by Steve Jobs, the CEO and co-founder of Apple and Pixar Animation Studios, at Stanford University. Jobs shares three stories from his life: the first is about connecting the dots and trusting in intuition, the second is about finding love and dealing with loss, and the third is about death and the importance of living a purposeful life. He emphasizes the importance of following one's passions and doing what one loves, taking risks, and believing in oneself. Jobs also talks about his experiences with Apple, Pixar, and the development of innovative technology, stressing the importance of creativity, imagination, and education in transforming lives and making the world a better place."},{start:900,text:'In this speech, the speaker shares his personal experiences and insights on life. He talks about being fired from Apple but later returning and developing technology that was at the heart of Apple\'s current success. He emphasizes the importance of finding what you love in work and not settling for anything less. He also shares his thoughts on death, stating that remembering that we will all eventually die helps us focus on what is truly important in life. He then shares his personal experience facing pancreatic cancer and how it strengthened his belief that we should all stay true to our hearts and intuition. He references the Whole Earth Catalog, a publication from his generation, and its farewell message to "stay hungry, stay foolish", which he wishes for the new graduates as they begin their journeys.'}],d=[{point:"Connect the dots: Trust your intuition and believe in yourself.",details:"Jobs emphasizes the importance of following one's passions and trusting one's gut feelings, even if the path is unclear.  His own journey is highlighted as an example of this."},{point:"Find what you love and do it:  Don't settle for anything less.",details:"Jobs stresses the importance of finding work that is meaningful and fulfilling, and pursuing it with passion. He illustrates this with his own experiences at Apple and Pixar."},{point:"Death is inevitable, so live purposefully.",details:"The inevitability of death, according to Jobs, provides perspective and encourages a focus on what truly matters.  His experience with cancer reinforces this message."},{point:"Stay hungry, stay foolish.",details:"This message from the Whole Earth Catalog encapsulates the spirit of continuous learning, innovation, and courage.  It encourages graduates to maintain a spirit of curiosity and risk-taking."},{point:"Creativity and innovation transform lives.",details:"Jobs' work with Apple and Pixar demonstrates the power of creativity and innovation to make the world a better place.  This includes both technological advancements and creative content."},{point:"Overcoming setbacks leads to greater success.",details:"Being fired from Apple served as a catalyst for Jobs' renewed creativity and the eventual success of Apple's innovative technologies."}];var u=s(9108);function TranslateTranscript(e){let{showTranslation:t,handleTranslate:s}=e;return(0,a.jsx)("div",{className:"mx-auto my-4 max-w-md",children:(0,a.jsx)("div",{className:"rounded-lg border border-amber-200 bg-amber-50 p-4 shadow-sm",children:(0,a.jsxs)("div",{className:"flex items-start space-x-3",children:[(0,a.jsx)(u.Z,{className:"mt-0.5 h-5 w-5 flex-shrink-0 text-amber-500"}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("h3",{className:"text-sm font-medium text-amber-800",children:"Translation Available"}),(0,a.jsx)("div",{className:"mt-3",children:(0,a.jsx)("button",{onClick:s,className:"inline-flex items-center justify-center rounded-md border border-amber-200 bg-amber-100 px-3 py-2 text-sm font-medium text-amber-900 transition-colors hover:bg-amber-200 focus:outline-none focus:ring-2 focus:ring-amber-500 focus:ring-offset-2",children:(0,a.jsxs)("span",{className:"flex items-center",children:[t?"Show Translation":"Show Original",(0,a.jsx)(u.Z,{className:"ml-2 h-4 w-4"})]})})})]})]})})})}var m=s(9663),h=s(1731),x=s(8953),f=s(8482),p=s(2917);let g=r.forwardRef((e,t)=>{let{className:s,...r}=e;return(0,a.jsxs)(f.fC,{ref:t,className:(0,p.cn)("relative flex w-full touch-none select-none items-center",s),...r,children:[(0,a.jsx)(f.fQ,{className:"relative h-1.5 w-full grow overflow-hidden rounded-full bg-primary/20",children:(0,a.jsx)(f.e6,{className:"absolute h-full bg-primary"})}),(0,a.jsx)(f.bU,{className:"block h-4 w-4 rounded-full border border-primary/50 bg-background shadow transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50"})]})});g.displayName=f.fC.displayName;var b=s(7885),y=s(3766),j=s(8419);let v=[{name:"CSV",value:"csv"},{name:"CSV (Detailed)",value:"csv-detailed"},{name:"Text",value:"text"},{name:"Doc",value:"doc"},{name:"SRT",value:"srt"},{name:"VTT",value:"vtt"}];function SettingsArea(e){let{summaryEnabled:t,handleIntervalChange:s,originalTranscript:n,originalSummary:l,handleDownloadVideo:o,subscription:c}=e,[d,u]=(0,r.useState)(!1),[f,p]=(0,r.useState)(15),handleDownloadVideoLocally=async()=>{u(!0),await o(),u(!1)};return(0,a.jsxs)(h.Zb,{className:"h-full w-full rounded-none",children:[(0,a.jsx)(h.Ol,{children:(0,a.jsx)(h.ll,{children:"Video Settings"})}),(0,a.jsxs)(h.aY,{className:"space-y-8",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between ".concat(t?"pointer-events-none opacity-30":""),children:[(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)(x._,{htmlFor:"transcript-interval",children:"Transcript Interval"}),(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:"Adjust the interval for transcript generation"})]}),(0,a.jsx)(g,{id:"transcript-interval",min:0,max:60,step:15,value:[f],onValueChange:e=>{p(e[0]),s(e[0])},className:"w-[120px]"})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:[(0,a.jsxs)(b.h_,{children:[(0,a.jsx)(b.$F,{asChild:!0,children:(0,a.jsxs)(m.z,{variant:"outline",className:"w-full",children:[(0,a.jsx)(y.Z,{className:"mr-2 h-4 w-4"}),"Download Transcript"]})}),(0,a.jsx)(b.AW,{children:v.map(e=>(0,a.jsx)(b.Xi,{style:{fontFamily:"sans-serif"},onClick:()=>(0,i.be)(e.value,n),children:e.name},e.value))})]}),(0,a.jsxs)(b.h_,{children:[(0,a.jsx)(b.$F,{asChild:!0,children:(0,a.jsxs)(m.z,{variant:"outline",className:"w-full",children:[(0,a.jsx)(y.Z,{className:"mr-2 h-4 w-4"}),"Download Summary"]})}),(0,a.jsx)(b.AW,{children:v.filter(e=>"srt"!==e.value&&"vtt"!==e.value).map(e=>(0,a.jsx)(b.Xi,{style:{fontFamily:"sans-serif"},onClick:()=>(0,i.be)(e.value,l),children:e.name},e.value))})]}),(0,a.jsx)(m.z,{variant:"default",onClick:handleDownloadVideoLocally,disabled:d,className:"w-full sm:col-span-2 ".concat(c?"":"pointer-events-none opacity-30"),children:d?"Downloading...":(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(j.Z,{className:"mr-2 h-4 w-4"}),c?"Download Video":"Download Video (Pro)"]})})]})]})]})}var w=s(1805),N=s(3114),S=s(5480),k=s(2260),T=s(2309);let C=r.forwardRef((e,t)=>{let{className:s,value:r,...n}=e;return(0,a.jsx)(T.fC,{ref:t,className:(0,p.cn)("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",s),...n,children:(0,a.jsx)(T.z$,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:"translateX(-".concat(100-(r||0),"%)")}})})});C.displayName=T.fC.displayName;var E=s(6316),z=s(5594),R=s(1108),Z=s(2188),P=s.n(Z);function OptimizedQuizArea(e){let{summaryEnabled:t,summaryPartlyLoaded:s,summaryLoading:n,subscription:l,summaryError:i,finalTranscript:c}=e,[d,u]=(0,r.useState)(!1),[f,p]=(0,r.useState)([]),[g,b]=(0,r.useState)(!1),[y,j]=(0,r.useState)({}),[v,w]=(0,r.useState)(!1),[T,Z]=(0,r.useState)(0),[I,L]=(0,r.useState)(!1);async function handleQuizGeneration(){b(!0);try{let e=await o.Z.post("/api/quiz",{transcript:c.slice(0,100),subscriptionId:null==l?void 0:l.id});if("Something went wrong"===e.data.response)throw Error("Quiz generation failed");p(e.data.response),u(!0)}catch(e){console.error("Error generating quiz:",e)}finally{b(!1)}}return(0,r.useEffect)(()=>{v&&T===f.length&&(L(!0),setTimeout(()=>L(!1),5e3))},[v]),t&&!s&&n?(0,a.jsx)(ResultLoading,{subscription:l}):t&&i?(0,a.jsx)(ResultError,{}):(0,a.jsxs)(h.Zb,{className:"w-full h-full rounded-none",children:[(0,a.jsx)(h.Ol,{children:(0,a.jsx)(h.ll,{className:"text-center text-2xl font-bold",children:"Quiz Area"})}),(0,a.jsx)(h.aY,{children:g?(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center py-12",children:[(0,a.jsx)(E.Z,{className:"h-8 w-8 animate-spin text-primary"}),(0,a.jsx)("p",{className:"mt-4 text-lg font-medium",children:"Generating quiz..."})]}):d?(0,a.jsxs)(N.M,{children:[I&&(0,a.jsx)(P(),{}),(0,a.jsxs)(S.E.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},transition:{duration:.5},children:[v&&(0,a.jsxs)("div",{className:"mb-6 text-center",children:[(0,a.jsxs)("p",{className:"text-2xl font-bold",children:["Your Score: ",T,"/",f.length]}),(0,a.jsx)(C,{value:T/f.length*100,className:"mt-2"})]}),f.map((e,t)=>(0,a.jsxs)(h.Zb,{className:"mb-6",children:[(0,a.jsx)(h.Ol,{children:(0,a.jsx)(h.ll,{className:"text-lg font-semibold",children:e.question})}),(0,a.jsx)(h.aY,{children:(0,a.jsx)(k.E,{onValueChange:e=>{j(s=>({...s,[t]:e}))},disabled:v,children:e.options.map((s,r)=>(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(k.m,{value:s,id:"q".concat(t,"-a").concat(r),checked:y[t]===s}),(0,a.jsxs)(x._,{htmlFor:"q".concat(t,"-a").concat(r),className:"flex-grow rounded-md p-2 ".concat(v&&s===e.answer?"bg-green-100 dark:bg-green-800":v&&y[t]===s&&s!==e.answer?"bg-red-100 dark:bg-red-800":""),children:[s,v&&s===e.answer&&(0,a.jsx)(z.Z,{className:"ml-2 inline-block text-green-500"}),v&&y[t]===s&&s!==e.answer&&(0,a.jsx)(R.Z,{className:"ml-2 inline-block text-red-500"})]})]},"".concat(t,"-").concat(r)))})})]},t)),!v&&(0,a.jsx)(m.z,{onClick:function(){let e=f.reduce((e,t,s)=>y[s]===t.answer?e+1:e,0);Z(e),w(!0)},size:"lg",className:"mt-4 w-full",children:"Submit Quiz"})]})]}):(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center py-12",children:[(0,a.jsx)("p",{className:"mb-6 text-center text-lg font-medium",children:"Ready to test your knowledge? Generate a quiz based on the video content!"}),(0,a.jsx)(m.z,{onClick:handleQuizGeneration,size:"lg",children:"Generate Quiz"})]})})]})}function ResultLoading(e){let{subscription:t}=e;return(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center py-12",children:[(0,a.jsx)(E.Z,{className:"h-8 w-8 animate-spin text-primary"}),(0,a.jsx)("p",{className:"mt-4 text-lg font-medium",children:"Loading results..."})]})}function ResultError(){return(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center py-12",children:[(0,a.jsx)(R.Z,{className:"h-12 w-12 text-red-500"}),(0,a.jsx)("p",{className:"mt-4 text-center text-lg font-medium",children:"An error occurred while loading the results. Please try again later."})]})}var I=s(1664),L=s.n(I),A=s(1947),_=s(4526),F=s(5181),O=s(963);function BlogArea_ResultError(){return(0,a.jsx)("div",{className:"flex h-full min-h-[34rem] w-full flex-grow items-start justify-center px-2 py-6",children:(0,a.jsxs)("div",{className:"text-center",children:[(0,a.jsx)("p",{className:"mb-4",children:"There was an error generating the summary or you reached the daily limit."}),(0,a.jsxs)("p",{children:["To not be subject to daily limits and generate summaries for longer videos, please check out our"," ",(0,a.jsx)(L(),{href:"/pricing",className:"text-primary hover:underline",children:"Pro plans"}),"."]})]})})}function BlogList(e){let{finalTranscript:t,subscription:s,blogGenerated:n,setBlogGenerated:l,blog:i,setBlog:c,blogLoading:d,setBlogLoading:u,topics:f,setTopics:p}=e,[g,b]=(0,r.useState)(""),[y,j]=(0,r.useState)(!1),[v,w]=(0,r.useState)(null);async function handleMediaGeneration(e){u(!0),w(null);try{let a=await o.Z.post("/api/convert-video",{transcript:t.slice(0,500),subscriptionId:null==s?void 0:s.id,mediaType:e,topic:g});if("Something went wrong"===a.data.response)throw Error("Failed to generate content");c(a.data.response),l(!0)}catch(e){console.error("Failed to generate content:",e),w("Failed to generate content. Please try again.")}finally{u(!1)}}return((0,r.useEffect)(()=>{if(!f||0===f.length){j(!0);let e=t.map(e=>e.text).join("\n"),fetchTopics=async()=>{try{let t=await o.Z.post("/api/get-topics",{transcript:e});p(t.data.response||[]),w(null)}catch(e){console.error("Failed to fetch topics:",e),p([]),w("Failed to generate topics. Please try again.")}finally{j(!1)}};fetchTopics()}},[f,t,p]),y||d)?(0,a.jsx)("div",{className:"flex h-full items-center justify-center",children:(0,a.jsxs)("div",{className:"text-center",children:[(0,a.jsx)(E.Z,{className:"mx-auto h-8 w-8 animate-spin"}),(0,a.jsx)("p",{className:"mt-2 text-lg font-semibold",children:y?"Generating topics...":"Generating content..."})]})}):n?(0,a.jsxs)(h.Zb,{className:"h-full w-full rounded-none",children:[(0,a.jsxs)(h.Ol,{className:"flex flex-row items-center justify-between",children:[(0,a.jsx)(h.ll,{children:"Generated Content"}),(0,a.jsxs)(m.z,{variant:"outline",size:"sm",className:"h-8 w-8 p-0",onClick:()=>l(!1),children:[(0,a.jsx)(A.Z,{className:"h-4 w-4"}),(0,a.jsx)("span",{className:"sr-only",children:"Reset"})]})]}),(0,a.jsx)(h.aY,{className:"bg-white",children:(0,a.jsx)("div",{className:"prose max-w-none dark:prose-invert",children:(0,a.jsx)(_.U,{children:i})})})]}):(0,a.jsxs)(h.Zb,{className:"h-full w-full rounded-none",children:[(0,a.jsx)(h.Ol,{children:(0,a.jsx)(h.ll,{children:"Generate Content"})}),(0,a.jsxs)(h.aY,{children:[v&&(0,a.jsx)(F.bZ,{variant:"destructive",className:"mb-4",children:(0,a.jsx)(F.X,{children:v})}),f.length>0&&(0,a.jsxs)("div",{className:"mb-6",children:[(0,a.jsx)("h3",{className:"mb-4 text-lg font-medium",children:"Pick a topic (optional):"}),(0,a.jsx)(O.x,{className:"h-[300px] pr-4",children:(0,a.jsx)(k.E,{value:g,onValueChange:b,className:"space-y-3",children:f.map((e,t)=>(0,a.jsxs)("div",{className:"flex items-center space-x-3 rounded-lg border p-4",children:[(0,a.jsx)(k.m,{value:e,id:"topic-".concat(t)}),(0,a.jsx)(x._,{htmlFor:"topic-".concat(t),className:"flex-grow cursor-pointer",children:e})]},t))})})]}),(0,a.jsxs)("div",{className:"flex flex-col space-y-2",children:[(0,a.jsx)(m.z,{onClick:()=>handleMediaGeneration("Generate Blog"),children:"Generate Blog"}),(0,a.jsx)(m.z,{onClick:()=>handleMediaGeneration("Generate LinkedIn Post"),children:"Generate LinkedIn Post"}),(0,a.jsx)(m.z,{onClick:()=>handleMediaGeneration("Generate Twitter Thread"),children:"Generate Twitter Thread"})]})]})]})}function BlogArea(e){let{summaryEnabled:t,summaryError:s,finalTranscript:r,blogGenerated:n,setBlogGenerated:l,blog:i,setBlog:o,blogLoading:c,setBlogLoading:d,topics:u,setTopics:m,subscription:h}=e;return(0,a.jsx)("div",{className:"h-full w-full",children:t&&s?(0,a.jsx)(BlogArea_ResultError,{}):(0,a.jsx)(BlogList,{finalTranscript:r,subscription:h,blogGenerated:n,setBlogGenerated:l,blog:i,setBlog:o,blogLoading:c,setBlogLoading:d,topics:u,setTopics:m})})}var H=s(2053);function KeyInsights(e){let{content:t,isLoading:s,subscription:r}=e;if(s)return(0,a.jsx)(h.Zb,{children:(0,a.jsxs)(h.aY,{className:"p-6",children:[(0,a.jsx)(H.O,{className:"mb-4 h-4 w-2/3"}),(0,a.jsx)(H.O,{className:"mb-4 h-4 w-3/4"}),(0,a.jsx)(H.O,{className:"h-4 w-1/2"})]})});if("Limit Reached"===t)return(0,a.jsx)(F.bZ,{variant:"destructive",children:(0,a.jsx)(F.X,{children:"Rate limit reached. Please upgrade to Pro to use Key Insights."})});let n=Array.isArray(t)?t:[];return(0,a.jsx)(h.Zb,{children:(0,a.jsx)(h.aY,{className:"p-6",children:(0,a.jsx)("div",{className:"max-h-[calc(100vh-200px)] overflow-y-auto",children:(0,a.jsx)("ul",{className:"custom-bullets space-y-4",children:n.map((e,t)=>(0,a.jsxs)("li",{className:"flex flex-col",children:[(0,a.jsx)("span",{className:"font-medium text-foreground",children:e.point}),e.details&&(0,a.jsx)("span",{className:"mt-1 text-sm text-muted-foreground",children:e.details})]},t))})})})})}let MultiRangeSlider=e=>{let{min:t,max:s,onChange:n,className:l}=e,[i,o]=(0,r.useState)(t),[c,d]=(0,r.useState)(s),u=(0,r.useRef)(null),m=(0,r.useRef)(null),h=(0,r.useRef)(null),x=(0,r.useCallback)(e=>Math.round((e-t)/(s-t)*100),[t,s]);return(0,r.useEffect)(()=>{if(m.current){let e=x(i),t=x(+m.current.value);h.current&&(h.current.style.left="".concat(e,"%"),h.current.style.width="".concat(t-e,"%"))}},[i,x]),(0,r.useEffect)(()=>{if(u.current){let e=x(+u.current.value),t=x(c);h.current&&(h.current.style.width="".concat(t-e,"%"))}},[c,x]),(0,r.useEffect)(()=>{n({min:i,max:c})},[i,c,n]),(0,a.jsxs)("div",{className:(0,p.cn)("relative h-5 w-full",l),children:[(0,a.jsx)("input",{type:"range",min:t,max:s,value:i,ref:u,onChange:e=>{let t=Math.min(+e.target.value,c-1);o(t),e.target.value=t.toString()},className:(0,p.cn)("pointer-events-none absolute top-1/2 h-0 w-full -translate-y-1/2 appearance-none","bg-transparent outline-none","[&::-webkit-slider-thumb]:pointer-events-auto","[&::-webkit-slider-thumb]:h-5","[&::-webkit-slider-thumb]:w-5","[&::-webkit-slider-thumb]:appearance-none","[&::-webkit-slider-thumb]:rounded-full","[&::-webkit-slider-thumb]:bg-white","[&::-webkit-slider-thumb]:shadow-[0_0_1px_1px_rgba(0,0,0,0.1)]","[&::-moz-range-thumb]:pointer-events-auto","[&::-moz-range-thumb]:h-5","[&::-moz-range-thumb]:w-5","[&::-moz-range-thumb]:appearance-none","[&::-moz-range-thumb]:rounded-full","[&::-moz-range-thumb]:bg-white","[&::-moz-range-thumb]:shadow-[0_0_1px_1px_rgba(0,0,0,0.1)]","hover:[&::-webkit-slider-thumb]:bg-gray-100","hover:[&::-moz-range-thumb]:bg-gray-100","focus:[&::-webkit-slider-thumb]:ring-2","focus:[&::-webkit-slider-thumb]:ring-primary","focus:[&::-moz-range-thumb]:ring-2","focus:[&::-moz-range-thumb]:ring-primary",i>s-100?"z-[5]":"z-[3]")}),(0,a.jsx)("input",{type:"range",min:t,max:s,value:c,ref:m,onChange:e=>{let t=Math.max(+e.target.value,i+1);d(t),e.target.value=t.toString()},className:(0,p.cn)("pointer-events-none absolute top-1/2 h-0 w-full -translate-y-1/2 appearance-none","bg-transparent outline-none","[&::-webkit-slider-thumb]:pointer-events-auto","[&::-webkit-slider-thumb]:h-5","[&::-webkit-slider-thumb]:w-5","[&::-webkit-slider-thumb]:appearance-none","[&::-webkit-slider-thumb]:rounded-full","[&::-webkit-slider-thumb]:bg-white","[&::-webkit-slider-thumb]:shadow-[0_0_1px_1px_rgba(0,0,0,0.1)]","[&::-moz-range-thumb]:pointer-events-auto","[&::-moz-range-thumb]:h-5","[&::-moz-range-thumb]:w-5","[&::-moz-range-thumb]:appearance-none","[&::-moz-range-thumb]:rounded-full","[&::-moz-range-thumb]:bg-white","[&::-moz-range-thumb]:shadow-[0_0_1px_1px_rgba(0,0,0,0.1)]","hover:[&::-webkit-slider-thumb]:bg-gray-100","hover:[&::-moz-range-thumb]:bg-gray-100","focus:[&::-webkit-slider-thumb]:ring-2","focus:[&::-webkit-slider-thumb]:ring-primary","focus:[&::-moz-range-thumb]:ring-2","focus:[&::-moz-range-thumb]:ring-primary","z-[4]")}),(0,a.jsx)("div",{className:"absolute top-1/2 h-1 w-full -translate-y-1/2 rounded-full bg-gray-200",children:(0,a.jsx)("div",{ref:h,className:"absolute h-full rounded-full bg-primary"})})]})};function SelectedSummary(e){let{originalTranscript:t,subscription:s,selectedSummary:n,setSelectedSummary:l}=e,[i,c]=(0,r.useState)(!1),d=t.reduce((e,t)=>Math.max(e,t.start+t.duration),0),u=Math.floor(d/60),[x,f]=(0,r.useState)(0),[p,g]=(0,r.useState)(u),[b,y]=(0,r.useState)("");async function handleSelectedSummary(){try{c(!0);let e=await o.Z.post("/api/summarize-segment",{transcript:b,subscriptionId:null==s?void 0:s.id});l(e.data.response)}catch(e){console.error("Failed to generate summary:",e)}finally{c(!1)}}return((0,r.useEffect)(()=>{let e=60*x,s=60*p,a=t.filter(t=>t.start>=e-60&&t.start+t.duration<=s+60),r=a.map(e=>e.text).join("\n");y(r)},[x,p,t]),n)?(0,a.jsxs)(h.Zb,{className:"w-full",children:[(0,a.jsxs)(h.Ol,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[(0,a.jsx)(h.ll,{children:"Selected Summary"}),(0,a.jsxs)(m.z,{variant:"outline",size:"sm",onClick:()=>l(null),disabled:i,children:[(0,a.jsx)(A.Z,{className:"mr-2 h-4 w-4"}),"Reset"]})]}),(0,a.jsx)(h.aY,{children:(0,a.jsx)("div",{dangerouslySetInnerHTML:{__html:n},className:"prose w-full max-w-none"})})]}):(0,a.jsxs)(h.Zb,{className:"w-full",children:[(0,a.jsx)(h.Ol,{children:(0,a.jsx)(h.ll,{children:"Generate Custom Summary"})}),(0,a.jsxs)(h.aY,{className:"space-y-6",children:[(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)("label",{className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:"Select time range (in minutes)"}),(0,a.jsx)(MultiRangeSlider,{min:0,max:u,onChange:e=>{let{min:t,max:s}=e;f(t),g(s)}}),(0,a.jsxs)("div",{className:"flex justify-between text-sm text-muted-foreground",children:[(0,a.jsxs)("span",{children:[x," min"]}),(0,a.jsxs)("span",{children:[p," min"]})]})]}),(0,a.jsx)(m.z,{className:"w-full",onClick:handleSelectedSummary,disabled:i,children:i?"Generating...":"Generate Summary"}),(0,a.jsxs)(h.Zb,{children:[(0,a.jsx)(h.Ol,{children:(0,a.jsx)(h.ll,{className:"text-sm",children:"Selected Segment"})}),(0,a.jsx)(h.aY,{children:(0,a.jsx)("pre",{className:"max-h-48 overflow-auto whitespace-pre-wrap text-sm",children:b})})]})]})]})}var G=s(293);function ChatbotArea(e){let{originalTranscript:t,messages:s,setMessages:n,subscription:l}=e,i=(0,r.useCallback)(async e=>{e.preventDefault();let a=e.currentTarget,r=a.elements.namedItem("chat-input"),i=r.value||"hey";r.value="",n(e=>[...e,{sender:"client",message:i},{sender:"bot",message:"..."}]);try{let e=await o.Z.post("/api/chat",{transcript:t,messages:[...s,{sender:"client",message:i}],subscriptionId:null==l?void 0:l.id});n(t=>{let s=[...t];return s[s.length-1]={sender:"bot",message:e.data.response},s})}catch(e){console.error("Error in chat API:",e),n(e=>{let t=[...e];return t[t.length-1]={sender:"bot",message:"Sorry, I encountered an error. Please try again."},t})}},[s,t,null==l?void 0:l.id]);return l?(0,a.jsx)(h.Zb,{className:"flex h-full min-h-[30rem] flex-col rounded-none",children:(0,a.jsxs)(h.aY,{className:"flex h-full flex-col p-4",children:[(0,a.jsx)("ul",{className:"flex-grow space-y-4 overflow-y-auto py-4",children:s.map((e,t)=>(0,a.jsx)("li",{className:"flex ".concat("bot"===e.sender?"justify-start":"justify-end"),children:(0,a.jsx)("span",{className:"whitespace-pre-wrap rounded-lg px-3 py-2 ".concat("bot"===e.sender?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground"),children:"..."===e.message?(0,a.jsx)(E.Z,{className:"h-4 w-4 animate-spin"}):function(e){if("string"==typeof e)return e;try{return JSON.stringify(e,null,2)}catch(e){return"Error displaying message"}}(e.message)})},t))}),(0,a.jsxs)("form",{onSubmit:i,className:"mt-4 flex gap-2",children:[(0,a.jsx)(G.I,{id:"chat-input",name:"chat-input",type:"text",placeholder:"Ask a question",className:"flex-grow"}),(0,a.jsx)(m.z,{type:"submit",children:"Send"})]})]})}):(0,a.jsx)(h.Zb,{className:"h-full",children:(0,a.jsx)(h.aY,{className:"flex h-full items-center justify-center p-6",children:(0,a.jsx)("p",{className:"text-center text-muted-foreground",children:"Chat is a Pro feature. Please upgrade to use this feature."})})})}var M=s(7884),D=s(7737),V=s(320),Y=s(1211),J=s(1408),U=s(6915);function ResultError_ResultError(){return(0,a.jsx)("div",{className:"flex h-full min-h-[34rem] w-full flex-grow items-start justify-center px-2 py-6",children:(0,a.jsxs)("div",{children:["There was an error generating the summary or you reached the daily limit.",(0,a.jsx)("br",{}),(0,a.jsx)("br",{}),"To not be subject to daily limits and generate summaries for longer videos, please check out our"," ",(0,a.jsx)(L(),{href:"/pricing",className:"inline text-red-500 hover:text-red-600",children:"Pro plans"}),"."]})})}function ResultLoading_ResultLoading(e){let{subscription:t}=e;return(0,a.jsx)("div",{className:"flex h-full min-h-[34rem] w-full flex-grow items-start justify-center px-2 py-6",children:(0,a.jsxs)("div",{children:["Summary is being generated. It can take up to 1 minute for every hour of video.",(0,a.jsx)("br",{}),(0,a.jsx)("br",{}),t?null:(0,a.jsxs)(a.Fragment,{children:["To not be subject to daily limits and generate summaries for longer videos, please check out our"," ",(0,a.jsx)(L(),{href:"/pricing",className:"inline text-red-500 hover:text-red-600",children:"Pro plans"}),"."]})]})})}var B=s(2297),W=s(6439);function HighlightsArea(e){let{summaryEnabled:t,summaryPartlyLoaded:s,summaryLoading:n,subscription:l,summaryError:c,originalTranscript:d,setStartTime:u,setAutoPlayEnabled:x}=e,[f,p]=(0,r.useState)([]),[g,b]=(0,r.useState)(!1),[y,j]=(0,r.useState)(!1),[v,w]=(0,r.useState)(!1),[N,S]=(0,r.useState)(!1),k=(0,i.Q7)(15,d),[T,C]=(0,r.useState)(!1);async function handleHighlightsGeneration(){b(!0),w(!1),C(!1);try{let e=await o.Z.post("/api/get-transcript-highlights",{transcript:k,subscriptionId:null==l?void 0:l.id}),t=e.data.response;if("No subscription ID provided"===t){C(!0);return}let s=t.map(e=>{let t=k.find(t=>{let s=t.start-e.start;return s>=0&&s===Math.min(...k.map(t=>{let s=t.start-e.start;return s>=0?s:1/0}))});return t&&t?{start:e.start,text:t.text,reason:e.reason}:null}),a=s.filter(e=>null!==e);a&&a.length>0?(p(a),j(!0)):w(!0)}catch(e){console.error("Error generating highlights:",e),w(!0)}finally{b(!1)}}function handleReset(){p([]),j(!1),w(!1),C(!1)}return((0,r.useEffect)(()=>(S(!0),()=>S(!1)),[g,y,v]),t&&!s&&n)?(0,a.jsx)(HighlightsArea_ResultLoading,{subscription:l}):t&&c?(0,a.jsx)(HighlightsArea_ResultError,{}):(0,a.jsxs)(h.Zb,{className:"h-full w-full",children:[(0,a.jsx)(h.Ol,{children:(0,a.jsx)(h.ll,{className:"text-center text-2xl font-bold",children:"Highlights"})}),(0,a.jsx)(h.aY,{children:(0,a.jsx)("div",{className:"transition-opacity duration-300 ".concat(N?"opacity-100":"opacity-0"),children:g?(0,a.jsx)(LoadingState,{}):T?(0,a.jsx)(SubscriptionNotFoundState,{onReset:handleReset}):y||v?v?(0,a.jsx)(NoHighlightsState,{onReset:handleReset}):(0,a.jsx)(HighlightsList,{highlights:f,setStartTime:u,setAutoPlayEnabled:x}):(0,a.jsx)(InitialState,{onGenerate:handleHighlightsGeneration})})}),y&&!v&&(0,a.jsx)(h.eW,{className:"mt-4 flex justify-center",children:(0,a.jsxs)(m.z,{onClick:handleReset,variant:"outline",size:"sm",children:[(0,a.jsx)(B.Z,{className:"mr-2 h-4 w-4"}),"Reset Highlights"]})})]})}function LoadingState(){return(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center py-12",children:[(0,a.jsx)(E.Z,{className:"h-12 w-12 animate-spin text-primary"}),(0,a.jsx)("p",{className:"mt-4 text-lg font-medium",children:"Generating highlights..."})]})}function InitialState(e){let{onGenerate:t}=e;return(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center py-12",children:[(0,a.jsx)("p",{className:"mb-6 text-center text-lg font-medium",children:"Get the key highlights from the video"}),(0,a.jsx)(m.z,{onClick:t,size:"lg",children:"Generate Highlights"})]})}function NoHighlightsState(e){let{onReset:t}=e;return(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center py-12",children:[(0,a.jsx)(R.Z,{className:"mb-4 h-12 w-12 text-red-500"}),(0,a.jsx)("p",{className:"mb-6 text-center text-lg font-medium",children:"No highlights were found. Please try again."}),(0,a.jsx)(m.z,{onClick:t,size:"lg",children:"Try Again"})]})}function HighlightsList(e){let{highlights:t,setStartTime:s,setAutoPlayEnabled:r}=e,handleClick=e=>{r(!0),s(e)};return(0,a.jsx)(O.x,{className:"h-[400px] pr-4",children:(0,a.jsx)("ul",{className:"space-y-4",children:t.map((e,t)=>(0,a.jsx)("li",{className:"rounded-lg bg-secondary p-4 shadow-sm transition-all duration-300 ease-in-out hover:shadow-md",style:{animationDelay:"".concat(100*t,"ms")},children:(0,a.jsxs)("div",{className:"flex items-start space-x-4",children:[(0,a.jsxs)(m.z,{variant:"outline",size:"sm",className:"mt-1 flex-shrink-0",onClick:()=>handleClick(e.start),children:[(0,a.jsx)(W.Z,{className:"mr-2 h-4 w-4"}),(0,a.jsx)("span",{className:"sr-only",children:"Play from"}),(0,i.eC)(e.start)]}),(0,a.jsxs)("div",{className:"flex-grow",children:[(0,a.jsx)("p",{className:"mb-2 text-sm text-muted-foreground",children:e.reason}),(0,a.jsx)("div",{className:"prose prose-sm max-w-none",dangerouslySetInnerHTML:{__html:e.text}})]})]})},e.start))})})}function HighlightsArea_ResultLoading(e){let{subscription:t}=e;return(0,a.jsx)(h.Zb,{className:"flex h-full w-full items-center justify-center",children:(0,a.jsxs)(h.aY,{className:"flex flex-col items-center justify-center py-12",children:[(0,a.jsx)(E.Z,{className:"h-12 w-12 animate-spin text-primary"}),(0,a.jsx)("p",{className:"mt-4 text-lg font-medium",children:"Loading results..."})]})})}function HighlightsArea_ResultError(){return(0,a.jsx)(h.Zb,{className:"flex h-full w-full items-center justify-center",children:(0,a.jsxs)(h.aY,{className:"flex flex-col items-center justify-center py-12",children:[(0,a.jsx)(R.Z,{className:"h-12 w-12 text-red-500"}),(0,a.jsx)("p",{className:"mt-4 text-center text-lg font-medium",children:"An error occurred while loading the results. Please try again later."})]})})}function SubscriptionNotFoundState(e){let{onReset:t}=e;return(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center py-12",children:[(0,a.jsx)(R.Z,{className:"mb-4 h-12 w-12 text-red-500"}),(0,a.jsx)("p",{className:"mb-6 text-center text-lg font-medium",children:"Your subscription was not found. Please check your account status and try again."}),(0,a.jsx)(m.z,{onClick:t,size:"lg",children:"Try Again"})]})}var q=s(1522),Q=s(9589),X=s(3510);let EvaluationBadge=e=>{let{evaluation:t}=e,s={VERIFIED:{icon:Q.Z,color:"bg-green-100 text-green-800 hover:bg-green-200"},INCORRECT:{icon:R.Z,color:"bg-red-100 text-red-800 hover:bg-red-200"},UNCERTAIN:{icon:X.Z,color:"bg-yellow-100 text-yellow-800 hover:bg-yellow-200"}},{icon:r,color:n}=s[t];return(0,a.jsxs)(q.C,{className:"flex items-center gap-1 ".concat(n),children:[(0,a.jsx)(r,{className:"h-3 w-3"}),t]})};function FactChecker(e){let{content:t,isLoading:s,subscription:r}=e;if(s)return(0,a.jsx)(h.Zb,{children:(0,a.jsxs)(h.aY,{className:"p-6",children:[(0,a.jsx)(H.O,{className:"mb-4 h-4 w-2/3"}),(0,a.jsx)(H.O,{className:"mb-4 h-4 w-3/4"}),(0,a.jsx)(H.O,{className:"h-4 w-1/2"})]})});if("Limit Reached"===t)return(0,a.jsx)(F.bZ,{variant:"destructive",children:(0,a.jsx)(F.X,{children:"Rate limit reached. Please upgrade to Pro to use Fact Checker."})});let n=null;try{n=JSON.parse(t)}catch(e){return(0,a.jsx)(F.bZ,{variant:"destructive",children:(0,a.jsx)(F.X,{children:"Error parsing fact check results. Please try again."})})}if(!(null==n?void 0:n.content))return(0,a.jsx)(F.bZ,{variant:"destructive",children:(0,a.jsx)(F.X,{children:"Invalid fact check response format. Please try again."})});let{claims:l,summary:i}=n.content;return(0,a.jsx)(h.Zb,{children:(0,a.jsx)(h.aY,{className:"p-6",children:(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)("div",{className:"rounded-lg bg-gray-50 p-4 dark:bg-gray-900",children:[(0,a.jsx)("h3",{className:"mb-2 font-semibold",children:"Summary"}),(0,a.jsx)("p",{className:"text-sm text-gray-700 dark:text-gray-300",children:i})]}),(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)("h3",{className:"font-semibold",children:"Claims Analysis"}),l.map((e,t)=>(0,a.jsxs)("div",{className:"rounded-lg border p-4 dark:border-gray-700",children:[(0,a.jsxs)("div",{className:"mb-2 flex items-start justify-between gap-4",children:[(0,a.jsx)("p",{className:"font-medium",children:e.claim}),(0,a.jsx)(EvaluationBadge,{evaluation:e.evaluation})]}),(0,a.jsx)("p",{className:"mb-2 text-sm text-gray-700 dark:text-gray-300",children:e.explanation}),(0,a.jsxs)("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:["Context: ",e.context]})]},t))]})]})})})}function ResultArea(e){let{url:t,transcript:s,filterResults:n,summary:i,summaryEnabled:o,summaryLoading:c,summaryPartlyLoaded:d,summaryError:u,handleIntervalChange:m,originalTranscript:h,originalSummary:x,subscription:f,handleTranslate:p,translationProgress:g,handleDownloadVideo:b,toggleTabs:j,activeTab:v,showTranslation:N,usingFallback:S}=e,[k,T]=(0,r.useState)(0),[C,E]=(0,r.useState)([{sender:"bot",message:"Hi! I can help answer questions about this video. What would you like to know?"}]),[z,R]=(0,r.useState)(!1),[Z,P]=(0,r.useState)(!1),[I,L]=(0,r.useState)(""),[A,_]=(0,r.useState)([]),[F,O]=(0,r.useState)(!1),[H,G]=(0,r.useState)(!1);if((0,r.useEffect)(()=>{let checkIfMobile=()=>O(window.innerWidth<768);return checkIfMobile(),window.addEventListener("resize",checkIfMobile),()=>window.removeEventListener("resize",checkIfMobile)},[]),""===t)return null;let U=[{value:"transcript",label:"Transcript",icon:(0,a.jsx)(y.Z,{className:"h-4 w-4"})},{value:"summary",label:"Summary",icon:(0,a.jsx)(M.Z,{className:"h-4 w-4"})},{value:"chat",label:"Chat",icon:(0,a.jsx)(D.Z,{className:"h-4 w-4"})},{value:"convert",label:"Convert",icon:(0,a.jsx)(V.Z,{className:"h-4 w-4"})},{value:"quiz",label:"Quiz",icon:(0,a.jsx)(Y.Z,{className:"h-4 w-4"})},{value:"settings",label:"Settings",icon:(0,a.jsx)(J.Z,{className:"h-4 w-4"})}];return(0,a.jsx)("div",{className:"flex h-full w-full flex-col",children:(0,a.jsxs)(w.mQ,{value:v,onValueChange:j,className:"w-full",children:[(0,a.jsx)(w.dr,{className:"grid w-full ".concat(F?"grid-cols-3":"grid-cols-6"," ").concat(F?"fixed bottom-0 left-0 z-50 h-28 rounded-none border-t bg-gray-50":"rounded-sm"),children:U.map(e=>(0,a.jsx)(w.SP,{value:e.value,className:"flex items-center justify-center py-2 data-[state=active]:bg-foreground data-[state=active]:text-background sm:py-1",children:F?e.icon:(0,a.jsxs)(a.Fragment,{children:[e.icon,(0,a.jsx)("span",{className:"ml-2 hidden sm:inline",children:e.label})]})},e.value))}),(0,a.jsxs)("div",{className:"mt-4 flex h-full flex-col sm:h-[30rem] lg:h-[calc(100vh-20rem)] lg:flex-row ".concat(F?"mb-16":""),children:[(0,a.jsx)("div",{className:"h-[20rem] sm:h-full lg:w-3/5",children:(0,a.jsx)(l(),{url:"".concat(t,"?t=").concat(k),height:"100%",width:"100%",playing:H,controls:!0})}),(0,a.jsxs)("div",{className:"h-full overflow-auto bg-gray-50 lg:w-2/5",children:[(0,a.jsx)(w.nU,{value:"transcript",className:"mt-0 h-full",children:(0,a.jsx)(SummaryTranscriptArea,{summaryEnabled:o,summaryPartlyLoaded:d,summaryLoading:c,subscription:f,summaryError:u,finalTranscript:o?i:s,setStartTime:T,filterResults:n,originalTranscript:h,handleTranslate:p,translationProgress:g,setAutoPlayEnabled:G,showTranslation:N,usingFallback:S})}),(0,a.jsx)(w.nU,{value:"summary",className:"mt-0 h-full",children:(0,a.jsx)(SummaryTranscriptArea,{summaryEnabled:!0,summaryPartlyLoaded:d,summaryLoading:c,subscription:f,summaryError:u,finalTranscript:i,setStartTime:T,filterResults:n,originalTranscript:h,handleTranslate:p,translationProgress:g,setAutoPlayEnabled:G,showTranslation:N,usingFallback:S})}),(0,a.jsx)(w.nU,{value:"settings",className:"mt-0 h-full",children:(0,a.jsx)(SettingsArea,{summaryEnabled:o,handleIntervalChange:m,originalTranscript:h,originalSummary:x,handleDownloadVideo:b,subscription:f})}),(0,a.jsx)(w.nU,{value:"chat",className:"mt-0 h-full",children:f?(0,a.jsx)(ChatbotArea,{originalTranscript:h,messages:C,setMessages:E,subscription:f}):(0,a.jsx)(UpgradePrompt,{imageSrc:"/chat-demo.png"})}),(0,a.jsx)(w.nU,{value:"convert",className:"mt-0 h-full",children:f?(0,a.jsx)(BlogArea,{summaryEnabled:o,summaryPartlyLoaded:d,summaryLoading:c,subscription:f,summaryError:u,finalTranscript:s,blogGenerated:z,setBlogGenerated:R,blogLoading:Z,setBlogLoading:P,blog:I,setBlog:L,topics:A,setTopics:_}):(0,a.jsx)(UpgradePrompt,{imageSrc:"/convert-demo.png"})}),(0,a.jsx)(w.nU,{value:"quiz",className:"mt-0 h-full",children:f?(0,a.jsx)(OptimizedQuizArea,{summaryEnabled:o,summaryPartlyLoaded:d,summaryLoading:c,subscription:f,summaryError:u,finalTranscript:s}):(0,a.jsx)(UpgradePrompt,{imageSrc:"/quiz-demo.png"})})]})]})]})})}function UpgradePrompt(e){let{imageSrc:t}=e;return(0,a.jsxs)("div",{className:"relative my-6 h-full w-full p-4 text-center font-medium",children:[(0,a.jsxs)("p",{className:"mb-4",children:["Please upgrade to the Pro Plan ",(0,a.jsx)("br",{}),"to use this feature."]}),(0,a.jsx)("img",{src:t,alt:"Feature preview",className:"mx-auto h-auto w-full max-w-md object-contain opacity-90"})]})}function SummaryTranscriptArea(e){let{summaryEnabled:t,summaryPartlyLoaded:s,summaryLoading:n,subscription:l,summaryError:c,finalTranscript:u,setStartTime:m,filterResults:h,originalTranscript:x,handleTranslate:f,translationProgress:p,setAutoPlayEnabled:g,showTranslation:b,usingFallback:y}=e,[j,v]=(0,r.useState)("Original"),[w,N]=(0,r.useState)(!1),[S,k]=(0,r.useState)(""),[T,C]=(0,r.useState)(!1),[E,z]=(0,r.useState)(""),[R,Z]=(0,r.useState)(!1),[P,I]=(0,r.useState)(null);async function handleSubTab(e){let t=e.target.innerText;if(v(t),"Key Insights"===t){C(!0);let e="";if(u.forEach(t=>{e+=t.text+"\n"}),e.startsWith("The video is a commencement speech given by Steve Jobs"))await new Promise(e=>setTimeout(e,1e3)),k(d);else if(""===S&&!T){let t=await o.Z.post("/api/key-insights",{transcript:e,subscriptionId:null==l?void 0:l.id});k(t.data.response)}C(!1)}else if("Fact Checker"===t){Z(!0);let e="";if(u.forEach(t=>{e+=t.text+"\n"}),e.startsWith("The video is a commencement speech given by Steve Jobs"))await new Promise(e=>setTimeout(e,1e3)),z('{"content": {"claims": [{"claim": "Steve Jobs was fired from Apple but later returned and developed technology that was at the heart of Apple\'s current success.", "evaluation": "VERIFIED", "explanation": "This is a well-documented fact. Steve Jobs was ousted from Apple in 1985 but returned as CEO in 1997, leading Apple\'s resurgence and the development of iconic products like the iMac, iPod, iPhone, and iPad.", "context": "This is presented as a key personal experience that shaped Jobs\' philosophy and business practices."}, {"claim": "The speaker emphasizes the importance of finding what you love in work and not settling for anything less.", "evaluation": "VERIFIED", "explanation": "This is a central theme of Jobs\' Stanford commencement speech.  He repeatedly emphasizes the importance of following one\'s passion and doing what one loves, aligning with his personal experiences.", "context": "This is a recurring theme throughout the speech, motivating the graduates to pursue their passions."}, {"claim": "Remembering that we will all eventually die helps us focus on what is truly important in life.", "evaluation": "UNCERTAIN", "explanation": "While this is a common philosophical perspective, its effectiveness is subjective and difficult to empirically verify. While Jobs\' experience with pancreatic cancer may have solidified this belief for him, it\'s not universally applicable or scientifically proven.", "context": "Jobs shares this reflection as a significant life lesson learned from confronting mortality."}, {"claim": "He shares his personal experience facing pancreatic cancer and how it strengthened his belief that we should all stay true to our hearts and intuition.", "evaluation": "VERIFIED", "explanation": "It\'s widely known that Steve Jobs was diagnosed with and treated for pancreatic cancer.  The impact on his perspective is documented in various biographies and accounts of his life.", "context": "He uses his personal experience with cancer to emphasize the importance of following one\'s intuition and living life to the fullest."}, {"claim": "He references the Whole Earth Catalog and its farewell message to “stay hungry, stay foolish.”", "evaluation": "VERIFIED", "explanation": "The Whole Earth Catalog was a real publication, and its farewell message is accurately quoted.", "context": "Jobs uses this message as inspiration and parting advice for the graduates."}], "summary": "Most of the claims made in the transcript about Steve Jobs\' life and career are verifiable.  The claim regarding the impact of contemplating death on one\'s focus is more subjective and difficult to verify definitively."}}');else if(""===E&&!R){let t=await o.Z.post("/api/fact-checker",{transcript:e,subscriptionId:null==l?void 0:l.id});z(t.data.response)}Z(!1)}else"Selected"===t&&console.log("Selected")}return(0,a.jsxs)("div",{className:"px-4 pt-4",children:[t&&!s&&!n&&(0,a.jsx)("ul",{className:"flex items-center space-x-4",children:["Original","Selected","Key Insights","Fact Checker","Highlights"].map(e=>(0,a.jsx)("li",{className:"pb-2 text-xs sm:text-sm",children:(0,a.jsx)("button",{className:(0,i.AK)(j===e?"font-medium text-gray-900":"font-normal text-gray-600","hover:text-gray-900"),onClick:handleSubTab,children:e})},e))}),t&&(!t||s||n||"Original"!==j)?["Selected","Key Insights","Fact Checker","Highlights"].includes(j)?null:(0,a.jsx)("div",{className:"px-2 font-medium",children:"Generating summary..."}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)("label",{htmlFor:"youtube-url",className:"sr-only",children:t?"Search Summary":"Search Transcript"}),(0,a.jsx)("input",{id:"search-transcript",name:"search-transcript",type:"search",disabled:0!==p&&100!==p,onChange:e=>h(e.target.value.toLowerCase()),autoComplete:"search-transcript",className:"min-w-0 flex-1 rounded border-0 px-3.5 py-2 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-yellow-400 sm:text-sm sm:leading-6",placeholder:t?"Search Summary":"Search Transcript"}),u&&(0,a.jsxs)("button",{onClick:()=>{let e=u.map(e=>e.text).join("\n");navigator.clipboard.writeText(e),N(!0),setTimeout(()=>N(!1),1e3)},className:"flex items-center gap-2 rounded-md bg-foreground px-3 py-2 text-sm text-background hover:bg-foreground/80",children:[(0,a.jsx)(U.Z,{className:"h-4 w-4"}),(0,a.jsx)("span",{className:"hidden sm:inline",children:w?"Copied!":"Copy"})]})]}),y&&!t&&(0,a.jsx)(TranslateTranscript,{showTranslation:b,handleTranslate:f})]}),t&&!s&&n?(0,a.jsx)(ResultLoading_ResultLoading,{subscription:l}):t&&c?(0,a.jsx)(ResultError_ResultError,{}):t&&"Key Insights"===j?(0,a.jsx)(KeyInsights,{content:S,isLoading:T,subscription:l}):t&&"Fact Checker"===j?(0,a.jsx)(FactChecker,{content:E,isLoading:R,subscription:l}):t&&"Selected"===j?(0,a.jsx)(SelectedSummary,{originalTranscript:x,subscription:l,selectedSummary:P,setSelectedSummary:I}):t&&"Highlights"===j?(0,a.jsx)(HighlightsArea,{summaryEnabled:t,summaryPartlyLoaded:s,summaryLoading:n,subscription:l,summaryError:c,originalTranscript:x,setStartTime:m,setAutoPlayEnabled:g}):(0,a.jsx)(ResultList,{finalTranscript:u,setStartTime:m,subscription:l,summaryEnabled:t,setAutoPlayEnabled:g})]})}function ResultList(e){let{finalTranscript:t,setStartTime:s,subscription:n,summaryEnabled:l,setAutoPlayEnabled:o}=e,c=t.reduce((e,t)=>(e[t.start]=(0,r.createRef)(),e),{});return(0,a.jsx)("div",{className:"mt-3 h-full w-full overflow-y-auto",children:t?(0,a.jsx)("ul",{className:"space-y-2 rounded-md",children:t.map(e=>(0,a.jsxs)("li",{className:"rounded bg-white p-2 text-gray-900 shadow-sm",ref:c[e.start],children:[(0,a.jsx)("button",{className:"mr-2 rounded bg-gray-100 py-1 px-2 text-gray-600 hover:bg-gray-200 focus:outline-none",onClick:()=>{var t;s(t=e.start),null!==t&&null!==c&&c[t].current.scrollIntoView({behavior:"smooth",block:"start"}),o(!0)},children:(0,i.eC)(e.start)}),(0,a.jsx)("span",{className:"prose",dangerouslySetInnerHTML:{__html:e.text}})]},e.start))}):(0,a.jsx)("div",{children:"no data"})})}var K=s(5274),$=s(4080),ee=s(7349),et=s(4589),es=s(5794),ea=s(7215),er=s.n(ea),en=s(787);function ProAlert(e){let{isOpen:t,setIsOpen:s,proAlertMessage:n}=e;function closeModal(){s(!1)}return(0,a.jsx)("div",{className:"".concat(er().variable," font-sans"),children:(0,a.jsx)($.u,{appear:!0,show:t,as:r.Fragment,children:(0,a.jsxs)(en.V,{as:"div",className:"relative z-10 ".concat(er().variable),onClose:closeModal,children:[(0,a.jsx)($.u.Child,{as:r.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"ease-in duration-200",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,a.jsx)("div",{className:"fixed inset-0 bg-black bg-opacity-25"})}),(0,a.jsx)("div",{className:"fixed inset-0 overflow-y-auto",children:(0,a.jsx)("div",{className:"flex min-h-full items-center justify-center p-4 text-center",children:(0,a.jsx)($.u.Child,{as:r.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0 scale-95",enterTo:"opacity-100 scale-100",leave:"ease-in duration-200",leaveFrom:"opacity-100 scale-100",leaveTo:"opacity-0 scale-95",children:(0,a.jsxs)(en.V.Panel,{className:"w-full max-w-md transform overflow-hidden rounded-2xl bg-white p-6 text-left align-middle shadow-xl transition-all",children:[(0,a.jsx)(en.V.Title,{as:"h3",className:"text-lg font-medium leading-6 text-gray-900",children:n}),(0,a.jsx)("div",{className:"mt-2",children:(0,a.jsxs)("p",{className:"text-sm text-gray-500",children:["Daily Limit Reached"==n?"You've reached the daily limit of summaries allowed.":"You are trying to summarize a longer video than the current tier allows (1 hour Free or 10 hours on Pro).",(0,a.jsx)("br",{}),(0,a.jsx)("br",{}),"Please"," ",(0,a.jsx)(L(),{href:"/pricing",className:"font-medium text-red-500 hover:text-red-600",children:"upgrade to Pro"})," ","to continue using the service."]})}),(0,a.jsx)("div",{className:"mt-4",children:(0,a.jsx)("button",{type:"button",className:"inline-flex justify-center rounded-md border border-transparent bg-red-100 px-4 py-2 text-sm font-medium text-red-900 hover:bg-red-200 focus:outline-none focus-visible:ring-2 focus-visible:ring-red-500 focus-visible:ring-offset-2",onClick:closeModal,children:"Got it, thanks!"})})]})})})})]})})})}var el=s(5922),ei=s(5152),eo=s.n(ei),ec=s(9461),ed=s(5077),eu=s(2566),em=s(5162),eh=s(1163);let ex=eo()(()=>s.e(155).then(s.bind(s,155)),{loadableGenerated:{webpack:()=>[155]},ssr:!1,loading:()=>(0,a.jsx)("div",{})});function IndexPage(e){let[t,s]=(0,r.useState)(!1),[n,l]=(0,r.useState)(""),[d,u]=(0,r.useState)([]),[m,x]=(0,r.useState)([]),[f,p]=(0,r.useState)(15),[g,b]=(0,r.useState)(!1),[y,j]=(0,r.useState)(!1),[v,w]=(0,r.useState)(!1),[N,S]=(0,r.useState)(!1),[k,T]=(0,r.useState)(!1),[C,E]=(0,r.useState)([]),[z,R]=(0,r.useState)([]),[Z,P]=(0,r.useState)(null),[I,A]=(0,r.useState)(!1),[_,O]=(0,r.useState)(!1),[H,G]=(0,r.useState)(""),[M,D]=(0,r.useState)("transcript"),[V,Y]=(0,r.useState)(""),{user:J,subscription:U}=(0,el.aF)(),[B,q]=(0,r.useState)(null),[Q,ea]=(0,r.useState)(0),[er,en]=(0,r.useState)(!1),[ei,eo]=(0,r.useState)(!1),[ef,ep]=(0,r.useState)(0),[eg,eb]=(0,r.useState)(!1),[ey,ej]=(0,r.useState)(!1),ev=(0,r.useRef)(null),ew=(0,r.useRef)(null),eN=(0,eh.useRouter)(),eS=eN.locale;async function checkFallbackTranscriptionStatus(){if(B)try{let e=await o.Z.post("/api/check-transcript",{jobId:B});if("finished"===e.data.status){q(null);let{transcript:t,videoTitle:s}=e.data.data;Y(s),u(t);let a=aggregateTimeStampsWithState(f,t);x(a),eo(!1)}else"error"===e.data.status&&(q(null),A(!0),eo(!1))}catch(e){console.error("Error checking fallback transcription status:",e)}}if((0,r.useEffect)(()=>{let e=function(){{let e=localStorage.getItem("youtldrSelectedLanguage");return e?JSON.parse(e):es.C[20]}}();P(e)},[U]),(0,r.useEffect)(()=>{Z&&localStorage.setItem("youtldrSelectedLanguage",JSON.stringify(Z))},[Z]),!function(e,t){let s=(0,r.useRef)();(0,r.useEffect)(()=>{s.current=e},[e]),(0,r.useEffect)(()=>{if(null!==t){let e=setInterval(function(){var e;null===(e=s.current)||void 0===e||e.call(s)},t);return()=>clearInterval(e)}},[t])}(()=>{checkFallbackTranscriptionStatus()},B?5e3:null),(0,r.useEffect)(()=>{let e;return t||ei?e=setInterval(()=>{ep(e=>e+1)},1e3):ep(0),()=>clearInterval(e)},[t,ei]),null===Z)return(0,a.jsx)("div",{className:"mt-40 flex h-screen w-screen items-start justify-center text-xl font-medium sm:text-2xl",children:"Loading..."});function aggregateTimeStampsWithState(e,t){if(0===e)return x(d),d;let s=(0,i.Q7)(e,t);return s}async function handleSubmit(e){e.preventDefault(),A(!1),b(!1),S(!1),T(!1),q(null),D("transcript"),R([]),E([]),ea(0);let t=new FormData(e.currentTarget),a=t.get("youtube-url");l(a);let r=(0,i.Tm)(a);s(!0),en(!0);try{let e=[];if("Hd_ptbiPoXM"===r&&"English"===Z.language){let t=await o.Z.post("/api/default-transcript");e=t.data.response}else{let t=await o.Z.post("/api/transcript",{video_id:r,languageCode:Z.languageCode,userId:null==J?void 0:J.id,subscriptionId:null==U?void 0:U.id,locale:eS});if("FALLBACK_REQUIRED"===t.data.error){s(!1),eo(!0),ej(!0);let e=await o.Z.post("/api/fallback-transcript",{video_id:r,language_code:Z.languageCode});q(e.data.jobId);return}e=t.data.response.transcript,Y(t.data.response.videoTitle)}u(e);let t=aggregateTimeStampsWithState(f,e);x(t)}catch(e){A(!0)}s(!1),eo(!1),en(!1)}async function firstTimeSummaryGenerated(){j(!0),S(!0);let e=aggregateTimeStampsWithState(900,d),t=[];if("https://youtu.be/Hd_ptbiPoXM"===n&&"English"===Z.language){await new Promise(e=>setTimeout(e,1500)),E(t=c),R(t),j(!1);return}if(e.length>4&&!U){j(!1),T(!0),O(!0),G("Video Length Limit Reached");return}let s=await o.Z.post("/api/summarize-full",{transcript:e,title:V,subscriptionId:null==U?void 0:U.id}),a=s.data.response;for(let s of e.slice(0,40)){let e=await o.Z.post("/api/summarize-section",{transcript:s,subscriptionId:null==U?void 0:U.id,youtubeUrl:n,fullSumResData:a,language:Z.language});if(500===e.data.status){j(!1),T(!0);return}if("Limit Reached"===e.data.response){j(!1),T(!0),O(!0),G("Daily Limit Reached");return}let r=function(e){if(!e||"string"!=typeof e.text)return console.log("Input not valid or not a string:",e),e;let{start:t,text:s}=e,a=s.replace(/"?\*\*(.*?)\*\*"?/g,"<b>$1</b>");return{start:t,text:a}}(e.data.response);R([...t,r]),t.push(r),w(!0)}E(t),R(t),j(!1),w(!1)}function insertSubstring(e,t,s){let a=Math.max(s-t,1),r=e.substr(0,t)+'<span class="bg-yellow-200 rounded-sm">'+e.substr(t,a)+"</span>"+e.substr(Math.max(s,1));return r}async function handleTranslate(){let e=d.map(e=>eg&&e.translated_text?{...e,text:e.translated_text}:e);x(eg?e.slice(0,1):e),eb(!eg)}async function handleDownloadVideo(){let e=(0,i.Tm)(n);try{var t;let s=await o.Z.post("/api/download-video",{videoId:e,subscriptionId:null==U?void 0:U.id});s.data.url?(t=s.data.url,window.open(t,"_blank")):console.error("Download URL not found in the response")}catch(e){console.error("Error downloading video:",e),o.Z.isAxiosError(e)&&e.response?429===e.response.status&&"Monthly usage limit exceeded"===e.response.data.error?alert("Monthly usage limit exceeded. Please try again next month or upgrade your plan."):alert("An error occurred while downloading the video. Please try again later."):alert("An unexpected error occurred. Please try again later.")}}function handleTryExample(){P(es.C[20]),ew.current&&(ew.current.value="https://youtu.be/Hd_ptbiPoXM"),setTimeout(()=>{ev.current&&ev.current.dispatchEvent(new Event("submit",{bubbles:!0,cancelable:!0}))},0)}return(0,a.jsxs)("div",{className:"relative",children:[!U&&(0,a.jsx)(ex,{locale:eS}),(0,a.jsxs)("div",{className:"py-6 pb-12",children:[(0,a.jsx)(ProAlert,{isOpen:_,setIsOpen:O,proAlertMessage:H}),(0,a.jsxs)("div",{className:"mx-auto max-w-4xl px-2 xs:px-6 lg:px-8",children:[""===n?(0,a.jsx)("div",{className:"mb-6 text-center",children:(0,a.jsxs)("div",{className:"mx-auto max-w-4xl px-4 pb-2 text-center sm:pb-4",children:[(0,a.jsxs)("h1",{className:"text-3xl font-extrabold tracking-tight text-foreground sm:text-5xl md:text-6xl",children:["Get the"," ",(0,a.jsxs)("span",{className:"relative inline-block",children:[(0,a.jsx)("span",{className:"relative z-10 text-red-600",children:"TLDR"}),(0,a.jsx)("svg",{className:"absolute inset-0 h-full w-full text-red-100",viewBox:"0 0 100 100",preserveAspectRatio:"none",children:(0,a.jsx)("path",{d:"M0,50 Q20,55 50,50 Q80,45 100,50 L100,100 L0,100 Z",fill:"currentColor"})})]})," ","of any YouTube video",(0,a.jsx)("br",{className:"hidden sm:inline"})," in"," ",(0,a.jsxs)("span",{className:"relative inline-block",children:[(0,a.jsx)("span",{className:"relative z-10",children:"seconds"}),(0,a.jsx)("span",{className:"absolute bottom-0 left-0 right-0 h-3 -rotate-2 bg-yellow-100"})]})]}),(0,a.jsx)("div",{className:"flex justify-center",children:(0,a.jsxs)("div",{className:"mt-8 flex flex-col items-start justify-start space-y-4 text-base text-muted-foreground sm:text-lg md:text-xl",children:[(0,a.jsxs)("p",{className:"flex items-start justify-start text-left sm:items-center sm:justify-center",children:[(0,a.jsx)(ec.Z,{className:"mr-2 h-6 w-6 flex-shrink-0 text-red-500"}),(0,a.jsx)("span",{className:"font-medium",children:"Unlock your genius: Master any subject at superhuman speed."})]}),(0,a.jsxs)("p",{className:"flex items-start justify-start text-left sm:items-center sm:justify-center",children:[(0,a.jsx)(ed.Z,{className:"mr-2 h-6 w-6 flex-shrink-0 text-red-500"}),(0,a.jsx)("span",{className:"font-medium",children:"Instantly grasp the core of any video in your native tongue."})]}),(0,a.jsxs)("p",{className:"flex items-start justify-start text-left sm:items-center sm:justify-center",children:[(0,a.jsx)(eu.Z,{className:"mr-2 h-6 w-6 flex-shrink-0 text-red-500"}),(0,a.jsx)("span",{className:"font-medium",children:"Turn mountains of content into powerful, actionable knowledge."})]})]})})]})}):null,U?null:(0,a.jsxs)(F.bZ,{variant:"default",className:"mx-auto mt-6 max-w-2xl bg-yellow-50/40 text-left",children:[(0,a.jsx)(X.Z,{className:"h-4 w-4"}),(0,a.jsx)(F.Cd,{children:"Subscriber Only Features"}),(0,a.jsxs)(F.X,{className:"space-y-4",children:[(0,a.jsxs)("p",{children:["All features of you-tldr are now subscriber only."," ",(0,a.jsx)(L(),{href:"/pricing",className:"font-semibold hover:text-red-900",children:"Upgrade to Premium"})," ","to access."]}),(0,a.jsxs)("div",{className:"flex items-center gap-4",children:[(0,a.jsxs)("a",{href:"https://youtu.be/f-IpPrCztDI?si=ySOjTIOHqkwle9xn",target:"_blank",rel:"noopener noreferrer",className:"flex items-center hover:text-red-900",children:[(0,a.jsx)(W.Z,{className:"mr-1 h-4 w-4"}),"Watch demo"]}),(0,a.jsxs)("button",{type:"button",onClick:handleTryExample,className:"flex items-center hover:text-red-900",children:[(0,a.jsx)(em.Z,{className:"mr-1 h-4 w-4"}),"Try Free example"]})]})]})]}),(0,a.jsx)(h.Zb,{className:"mx-auto mt-8 max-w-3xl p-6",children:(0,a.jsxs)("form",{ref:ev,onSubmit:handleSubmit,className:"space-y-4",children:[(0,a.jsxs)("div",{className:"flex flex-col space-y-3 sm:flex-row sm:space-y-0",children:[(0,a.jsx)("label",{htmlFor:"youtube-url",className:"sr-only",children:"Enter Youtube URL"}),(0,a.jsx)("input",{id:"youtube-url",name:"youtube-url",type:"text",ref:ew,autoComplete:"youtube-url",pattern:"^(?:https?:\\/\\/)?(?:m\\.|www\\.)?(?:youtu\\.be\\/|youtube\\.com\\/(?:embed\\/|v\\/|watch\\?v=|watch\\?.+&v=))((\\w|-){11})(?:\\S+)?$",title:"Enter a valid Youtube URL",defaultValue:"https://youtu.be/Hd_ptbiPoXM",required:!0,className:"flex-grow rounded-md border-0 px-3.5 py-2 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-red-500 sm:text-sm sm:leading-6",placeholder:"Enter Youtube URL"}),(0,a.jsxs)("div",{className:"flex space-x-2 sm:ml-2",children:[(0,a.jsx)("div",{className:"group z-10 w-full sm:w-[140px]",children:(0,a.jsx)(K.R,{value:Z,onChange:P,disabled:!U,children:(0,a.jsxs)("div",{className:"relative h-full w-full",children:[(0,a.jsxs)(K.R.Button,{className:"relative h-full w-full rounded-md py-2 px-3 text-left text-sm font-medium text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 focus:outline-none focus:ring-2 focus:ring-red-500 ".concat(U?"":"cursor-not-allowed opacity-50"),title:U?"":"Please subscribe to change language",children:[(0,a.jsx)("span",{className:"block truncate",children:Z.language}),(0,a.jsx)("span",{className:"pointer-events-none absolute inset-y-0 right-0 flex items-center pr-2",children:(0,a.jsx)(ee.Z,{className:"h-5 w-5 text-gray-400","aria-hidden":"true"})})]}),(0,a.jsx)($.u,{as:r.Fragment,leave:"transition ease-in duration-100",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,a.jsx)(K.R.Options,{className:"absolute mt-1 max-h-60 w-full overflow-auto rounded-md bg-white py-1 text-sm shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none",children:es.C.map(e=>(0,a.jsx)(K.R.Option,{className:e=>{let{active:t}=e;return"relative cursor-default select-none py-2 pl-10 pr-4 ".concat(t?"bg-red-100 text-red-900":"text-gray-900")},value:e,children:t=>{let{selected:s}=t;return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{className:"block truncate ".concat(s?"font-medium":"font-normal"),children:e.language}),s?(0,a.jsx)("span",{className:"absolute inset-y-0 left-0 flex items-center pl-3 text-red-600",children:(0,a.jsx)(et.Z,{className:"h-5 w-5","aria-hidden":"true"})}):null]})}},e.languageCode))})})]})})}),(0,a.jsx)("button",{type:"submit",className:"w-full rounded-md bg-red-500 px-3.5 py-2 text-sm font-semibold text-white shadow-sm hover:bg-red-600 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-red-500 disabled:cursor-not-allowed disabled:bg-gray-400 sm:w-auto",disabled:er,title:U?"":"Please subscribe to use this feature",children:"TLDR it"})]})]}),(0,a.jsxs)("div",{className:"flex flex-col items-start justify-between text-sm sm:flex-row sm:items-center",children:[(0,a.jsx)("span",{className:"mb-2 text-gray-600 sm:mb-0 sm:pl-0.5",children:"Enter any YouTube URL to get instant insights"}),U&&(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsxs)("a",{href:"https://youtu.be/f-IpPrCztDI?si=ySOjTIOHqkwle9xn",target:"_blank",rel:"noopener noreferrer",className:"flex items-center text-gray-600 hover:text-gray-800",children:[(0,a.jsx)(W.Z,{className:"mr-1 h-4 w-4"}),"Watch demo"]}),(0,a.jsxs)("button",{type:"button",onClick:handleTryExample,className:"flex items-center text-gray-600 hover:text-gray-800",children:[(0,a.jsx)(em.Z,{className:"mr-1 h-4 w-4"}),"Try example"]})]})]})]})})]}),I?(0,a.jsx)("div",{className:"mx-auto mt-12 max-w-md pb-64",children:U?(0,a.jsxs)(F.bZ,{variant:"destructive",children:[(0,a.jsx)(X.Z,{className:"h-4 w-4"}),(0,a.jsx)(F.Cd,{children:"Oops! Something went wrong"}),(0,a.jsxs)(F.X,{children:[(0,a.jsx)("p",{className:"mt-2",children:"This could be due to:"}),(0,a.jsxs)("ul",{className:"mt-2 list-disc space-y-1 pl-5",children:[(0,a.jsx)("li",{children:"Missing subtitles for the selected language"}),(0,a.jsx)("li",{children:"New video with subtitles still being generated"})]})]})]}):(0,a.jsxs)(F.bZ,{variant:"destructive",children:[(0,a.jsx)(X.Z,{className:"h-4 w-4"}),(0,a.jsx)(F.Cd,{children:"Subscriber Only Feature"}),(0,a.jsxs)(F.X,{className:"mt-2",children:["This feature is only available to subscribers. Please"," ",(0,a.jsx)("a",{href:"/pricing",className:"font-semibold hover:text-red-600",children:"upgrade"})," ","to access this feature."]})]})}):t||ei?(0,a.jsxs)("div",{className:"mt-12 flex flex-col items-center justify-center pb-64 sm:mt-20",children:[(0,a.jsx)("div",{className:"inline-block h-8 w-8 animate-spin rounded-full border-4 border-solid border-current border-r-transparent align-[-0.125em] text-red-500 motion-reduce:animate-[spin_1.5s_linear_infinite] sm:h-10 sm:w-10",role:"status",children:(0,a.jsx)("span",{className:"sr-only",children:"Loading..."})}),(0,a.jsx)("p",{className:"mt-4 text-center text-sm text-gray-600",children:ei?"This is taking longer than usual. Please bear with us for a few minutes. (".concat(ef,"s)"):"Loading... (".concat(ef,"s)")})]}):n?(0,a.jsx)("div",{className:"mx-auto mt-6 w-full max-w-7xl sm:px-12",children:(0,a.jsx)(ResultArea,{url:n,transcript:m,filterResults:function(e){if(g){let t=JSON.parse(JSON.stringify(C)),s=[];""===e?R(C):(t.forEach(t=>{let a=t.text.toLowerCase();if(a.includes(e)){let r=a.indexOf(e),n=a.indexOf(e)+e.length;t.text=insertSubstring(t.text,r,n),s.push(t)}}),R(s))}else{let t=aggregateTimeStampsWithState(f,d),s=[];if(""===e){let e=aggregateTimeStampsWithState(f,d);x(e)}else t.forEach(t=>{let a=t.text.toLowerCase();if(a.includes(e)){let r=a.indexOf(e),n=a.indexOf(e)+e.length;t.text=insertSubstring(t.text,r,n),s.push(t)}}),x(s)}},summary:z,summaryEnabled:g,summaryLoading:y,summaryPartlyLoaded:v,summaryError:k,toggleTabs:function(e){D(e),"summary"===e?(b(!0),!1===N&&firstTimeSummaryGenerated()):b(!1)},activeTab:M,handleIntervalChange:function(e){p(e);let t=aggregateTimeStampsWithState(e,d);x(t)},originalTranscript:d,originalSummary:C,subscription:U,handleTranslate:handleTranslate,translationProgress:Q,handleDownloadVideo:handleDownloadVideo,showTranslation:eg,setShowTranslation:eb,usingFallback:ey})}):(0,a.jsx)("div",{className:"pb-64"})]})]})}}},function(e){e.O(0,[7066,4526,2721,2116,7546,7623,9774,2888,179],function(){return e(e.s=8312)}),_N_E=e.O()}]);