1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[705],{38767:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/youtube/[id]",function(){return n(40742)}])},89489:function(e,t,n){"use strict";n.d(t,{V:function(){return a}});var r=n(75271);function a(e,t){let[n,a]=(0,r.useState)(()=>{try{let n=localStorage.getItem(e);return n?JSON.parse(n):t}catch(e){return t}});return(0,r.useEffect)(()=>{try{localStorage.setItem(e,JSON.stringify(n))}catch(e){}},[e,n]),[n,a]}},26031:function(e,t,n){"use strict";n.d(t,{O:function(){return i}});var r=n(57260),a=n(68669),l=n(75271);let s="yt_watch_history";function i(){let e=(0,a.NL)();return{updateHistory:(0,l.useCallback)(async(t,n,a,l)=>{let i=await e.fetchQuery({queryKey:["ytMetadata",t],queryFn:()=>(0,r.Jf)(t)}),o={videoId:t,lang:n,title:i.title,author_name:i.author_name,author_url:i.author_url,thumbnail_url:i.thumbnail_url,lastTimestamp:a,maxTimestamp:l},c=localStorage.getItem(s),d=c?JSON.parse(c):[];(d=d.filter(e=>e.videoId!==t)).unshift(o),d.length>100&&(d=d.slice(0,100)),localStorage.setItem(s,JSON.stringify(d))},[e]),getHistory:(0,l.useCallback)(()=>{let e=localStorage.getItem(s);return e?JSON.parse(e):[]},[])}}},57260:function(e,t,n){"use strict";n.d(t,{Jf:function(){return i},TP:function(){return s},cJ:function(){return l},mr:function(){return a}});let r={mediaTab:"TAB_YOUTUBE",searchText:"",duration:{min:null,max:null},sortBy:"date"};function a(e){let t=Math.floor(e/3600),n=Math.floor(e%3600/60),r=Math.floor(e%60),a=e=>String(e).padStart(2,"0");return t>0?"".concat(t,":").concat(a(n),":").concat(a(r)):"".concat(n,":").concat(a(r))}async function l(e){let{freq95:t={min:0,max:1e5},searchText:n="",sortBy:a="date",duration:l={min:null,max:null},lang_G:s="es",target:i="en"}=e,o={auth:null,translationLang_G:i,freq95:t,lang_G:s,filters:{...r,searchText:n,sortBy:a,duration:l},pinnedDiocoPlaylistIds:[]},c=await fetch("https://api-cdn.dioco.io/base_media_getMediaPlaylists_5",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)});if(!c.ok)throw Error("Failed to fetch media playlists: ".concat(c.statusText));return c.json()}async function s(e){let{diocoPlaylistId:t,freq95:n={min:0,max:1e5},searchText:a="",sortBy:l="date",duration:s={min:null,max:null},forceIncludeDiocoDocId:i=null,lang_G:o="es",target:c="en"}=e,d={auth:null,translationLang_G:c,freq95:n,lang_G:o,filters:{...r,searchText:a,sortBy:l,duration:s},pinnedDiocoPlaylistIds:[],diocoPlaylistId:t,forceIncludeDiocoDocId:i},u=await fetch("https://api-cdn.dioco.io/base_media_getMediaDocs_5",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(d)});if(!u.ok)throw Error("Failed to fetch media docs: ".concat(u.statusText));return u.json()}async function i(e){let t=await fetch("https://www.youtube.com/oembed?url=https://www.youtube.com/watch?v=".concat(e,"&format=json"),{method:"GET",headers:{"Content-Type":"application/json"}});if(!t.ok)throw Error("Failed to fetch youtube video metadata: ".concat(t.statusText));return t.json()}},40742:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return ea}});var r=n(52676),a=n(75271),l=n(12979),s=n(38605),i=n.n(s),o=n(69424),c=n(89489);async function d(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"YT",n=await fetch("https://api-cdn.dioco.io/base_media_getYoutubeSubsData_2",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:t,videoId:e})});if(!n.ok)throw Error("Failed to fetch subs data: ".concat(n.statusText));return n.json()}async function u(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"en",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"YT",r=await fetch("https://api-cdn.dioco.io/base_media_getYoutubeSubsTranslations",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({videoId:e,destLang_G:t,type:n})});if(!r.ok)throw Error("Failed to fetch subs translations: ".concat(r.statusText));return r.json()}async function x(e){let t=new URLSearchParams(e).toString(),n=await fetch("https://api-cdn-plus.dioco.io/base_dict_getFullDict_8?".concat(t));if(!n.ok)throw Error("Failed to fetch full dict: ".concat(n.statusText));return n.json()}async function m(e,t){let n=new URLSearchParams({lang:e,text:t}).toString(),r=await fetch("https://api-cdn-plus.dioco.io/base_dict_getDictTTS_3?".concat(n));if(!r.ok)throw Error("Failed to fetch TTS: ".concat(r.statusText));let a=await r.json();if(!a.data||!a.data.startsWith("data:audio/"))throw Error("Invalid audio format in response");return a.data}async function h(e,t,n){let r=new URLSearchParams({lang:e,text:t,hash:n}).toString(),a=await fetch("https://api-cdn-plus.dioco.io/base_items_getSentenceTTS_3?".concat(r));if(!a.ok)throw Error("Failed to fetch TTS: ".concat(a.statusText));let l=await a.json();if(!l.data||!l.data.startsWith("data:audio/"))throw Error("Invalid audio format in response");return l.data}var f=n(20289),p=n(7198);function v(e,t,n){let r=n[e]||"";return t?"".concat(r," underline decoration-[1.5px] underline-offset-4"):r}function y(e){var t,n,r,a,l,s,i;if(Array.isArray(null==e?void 0:null===(t=e.form)||void 0===t?void 0:t.pinyin))return null===(s=e.form.pinyin)||void 0===s?void 0:s.join("");if(Array.isArray(null==e?void 0:null===(n=e.form_norm)||void 0===n?void 0:n.pinyin))return null==e?void 0:null===(i=e.form_norm.pinyin)||void 0===i?void 0:i.join("");for(let t of[null==e?void 0:null===(r=e.form)||void 0===r?void 0:r.translit,null==e?void 0:null===(a=e.form_norm)||void 0===a?void 0:a.translit,null==e?void 0:null===(l=e.lemma)||void 0===l?void 0:l.translit]){if(Array.isArray(t))return t.join(" ");if("string"==typeof t)return t}return""}function b(e){var t,n,r,a;return Array.isArray(null===(t=e.form)||void 0===t?void 0:t.pinyin)?e.form.pinyin.join(" "):(null===(n=e.form)||void 0===n?void 0:n.translit)?Array.isArray(e.form.translit)?e.form.translit.join(" "):e.form.translit:(null===(r=e.form_norm)||void 0===r?void 0:r.translit)?Array.isArray(e.form_norm.translit)?e.form_norm.translit.join(" "):e.form_norm.translit:(null===(a=e.lemma)||void 0===a?void 0:a.translit)?Array.isArray(e.lemma.translit)?e.lemma.translit.join(" "):e.lemma.translit:""}let j=[{label:"1-100",min:1,max:100},{label:"101-200",min:101,max:200},{label:"201-500",min:201,max:500},{label:"501-1000",min:501,max:1e3},{label:"1001-2000",min:1001,max:2e3},{label:"2001-3500",min:2001,max:3500},{label:"3501-5000",min:3501,max:5e3},{label:"5001-8000",min:5001,max:8e3},{label:"8001+",min:8001,max:1/0}];function w(e){return(0,a.useMemo)(()=>
1{if(!e||"success"!==e.status)return{categorizedGroups:{},subtitles:[],haveWordFrequency:!1,ranges:j};let t=e.data.sourceSubs.data,n=t.nlp,r=t.subs;return{categorizedGroups:function(e){let t={},n=new Set;for(let r of e)for(let e of r){let r="number"==typeof e.freq?e.freq:null;if(null===r)continue;let a=e.form.text;if(n.has(a))continue;n.add(a);let l=j.find(e=>r>=e.min&&r<=e.max);l&&(t[l.label]||(t[l.label]=[]),t[l.label].push(e))}return t}(n),subtitles:r.map((e,t)=>{let r=(n[t]||[]).map(e=>{let t="number"==typeof e.freq?e.freq:parseInt(e.diocoFreq)||0;return{...e,freqRange:function(e){var t;if("number"!=typeof e||e<=0)return null;let n=j.find(t=>e>=t.min&&e<=t.max);return null!==(t=null==n?void 0:n.label)&&void 0!==t?t:null}(t)}});return{...e,tokens:r}}),haveWordFrequency:t.haveWordFrequency,ranges:j}},[e])}var g=n(96055);let N=(0,a.createContext)(void 0),k=e=>{var t;let{children:n}=e,[a,l]=(0,c.V)("colorBy","pos"),[s,i]=(0,c.V)("videoSize","default"),[o,x]=(0,c.V)("colorMode","text"),[m,h]=(0,c.V)("audioOnly",!1),[v,y]=(0,c.V)("showPinyin",!0),[b,j]=(0,c.V)("showTranslation",!0),k=(0,p.useParams)(),S=null==k?void 0:k.id,T=null!==(t=(0,p.useSearchParams)().get("lang"))&&void 0!==t?t:"es",{locale:C}=(0,g.b)(),{data:P,isLoading:_,isError:E}=(0,f.a)({queryKey:["subsData",S],queryFn:()=>d(S),enabled:"string"==typeof S&&!!S}),{data:O,isLoading:A,isError:F}=(0,f.a)({queryKey:["subsTranslations",S],queryFn:()=>u(S,C),enabled:"string"==typeof S&&!!S&&"string"==typeof C}),{subtitles:R}=w(P);return(0,r.jsx)(N.Provider,{value:{colorBy:a,setColorBy:l,colorMode:o,setColorMode:x,videoSize:s,setVideoSize:i,audioOnly:m,setAudioOnly:h,showPinyin:v,setShowPinyin:y,showTranslation:b,setShowTranslation:j,videoId:S,lang:T,subsData:P,subsTranslations:null==O?void 0:O.data,isError:E||F,isLoading:_&&A,subtitles:R},children:n})};function S(){return(0,a.useContext)(N)||{videoSize:"default"}}var T=n(83830);function C(){let{colorBy:e,setColorBy:t,colorMode:n,setColorMode:a,videoSize:l,setVideoSize:s,audioOnly:i,setAudioOnly:c,showPinyin:d,setShowPinyin:u,showTranslation:x,setShowTranslation:m}=S();return(0,r.jsxs)("div",{className:"max-w-4xl mx-auto max-md:rounded-none max-md:shadow-none max-md:p-3",children:[(0,r.jsx)("p",{children:"Subtitle Settings"}),(0,r.jsxs)("div",{className:"flex flex-col sm:flex-row sm:justify-between sm:items-center gap-4 mb-4 mt-2",children:[(0,r.jsxs)("div",{className:"flex flex-wrap gap-2 items-center",children:[(0,r.jsx)("p",{className:"shrink-0",children:"Color by:"}),(0,r.jsxs)(o.Ph,{value:e,onValueChange:e=>t(e),children:[(0,r.jsx)(o.i4,{id:"size",className:"mt-2 min-w-[140px]",children:(0,r.jsx)(o.ki,{placeholder:"Select"})}),(0,r.jsxs)(o.Bw,{children:[(0,r.jsx)(o.Ql,{value:"none",children:"No Color"}),(0,r.jsx)(o.Ql,{value:"pos",children:"Part of Speech"}),(0,r.jsx)(o.Ql,{value:"freq",children:"Vocabulary Level"})]})]}),(0,r.jsx)("p",{className:"shrink-0",children:"Video Size"}),(0,r.jsxs)(o.Ph,{value:l,onValueChange:e=>s(e),children:[(0,r.jsx)(o.i4,{id:"size",className:"mt-2 min-w-[140px]",children:(0,r.jsx)(o.ki,{placeholder:"Select"})}),(0,r.jsxs)(o.Bw,{children:[(0,r.jsx)(o.Ql,{value:"default",children:"Default"}),(0,r.jsx)(o.Ql,{value:"half-screen",children:"Half Screen"}),(0,r.jsx)(o.Ql,{value:"full-screen",children:"Full Screen"})]})]})]}),(0,r.jsxs)("div",{className:"flex flex-wrap w-full gap-4 items-center",children:[(0,r.jsxs)("div",{className:"flex justify-between shrink-0 w-full gap-2",children:[(0,r.jsx)("p",{children:"Underline"}),(0,r.jsx)(T.r,{checked:"underline"===n,onCheckedChange:e=>a(e?"underline":"text")})]}),(0,r.jsxs)("div",{className:"flex justify-between shrink-0 w-full gap-2",children:[(0,r.jsx)("p",{children:"Audio Only"}),(0,r.jsx)(T.r,{checked:i,onCheckedChange:e=>c(e)})]}),(0,r.jsxs)("div",{className:"flex justify-between shrink-0 w-full gap-2",children:[(0,r.jsx)("p",{children:"Show Translation"}),(0,r.jsx)(T.r,{checked:x,onCheckedChange:e=>m(e)})]}),(0,r.jsxs)("div",{className:"flex justify-between shrink-0 w-full gap-2",children:[(0,r.jsx)("p",{children:"Show Transliteration"}),(0,r.jsx)(T.r,{checked:d,onCheckedChange:e=>u(e)})]})]})]})]})}function P(e){let t=Math.round(e/1e3);return[Math.floor(t/3600),Math.floor(t%3600/60),t%60].map(e=>String(e).padStart(2,"0")).join(":")}n(59324);let _={NOUN:"text-blue-500 dark:text-blue-300",VERB:"text-green-500 dark:text-green-300",ADJ:"text-red-500 dark:text-red-300",ADV:"text-purple-500 dark:text-purple-300",PRON:"text-amber-600 dar
1k:text-amber-300",PROPN:"text-yellow-600 dark:text-yellow-300",NUM:"text-pink-500 dark:text-pink-300",ADP:"text-teal-500 dark:text-teal-300",PART:"text-indigo-500 dark:text-indigo-300",CCONJ:"text-cyan-600 dark:text-cyan-300",SCONJ:"text-cyan-800 dark:text-cyan-400",DET:"text-fuchsia-600 dark:text-fuchsia-300",AUX:"text-lime-600 dark:text-lime-300",INTJ:"text-rose-500 dark:text-rose-300",SYM:"text-gray-600 dark:text-gray-400",X:"text-gray-400 dark:text-gray-300",PUNCT:"text-gray-500 dark:text-gray-300"},E={"1-100":"text-red-600 dark:text-red-300","101-200":"text-orange-600 dark:text-orange-300","201-500":"text-yellow-600 dark:text-yellow-300","501-1000":"text-green-600 dark:text-green-300","1001-2000":"text-blue-500 dark:text-blue-300","2001-3500":"text-blue-700 dark:text-blue-400","3501-5000":"text-blue-800 dark:text-blue-500","5001-8000":"text-purple-500 dark:text-purple-300","8001+":"text-purple-700 dark:text-purple-400"},O={NOUN:"Noun",VERB:"Verb",ADJ:"Adjective",ADV:"Adverb",PRON:"Pronoun",PROPN:"Proper Noun",NUM:"Numeral",ADP:"Adposition",PART:"Particle",CCONJ:"Coordinating Conjunction",SCONJ:"Subordinating Conjunction",DET:"Determiner",AUX:"Auxiliary Verb",INTJ:"Interjection",SYM:"Symbol",X:"Unknown",PUNCT:"Punctuation"},A=(0,a.createContext)(void 0),F=e=>{let{children:t}=e,[n,l]=(0,a.useState)(!1),[s,i]=(0,a.useState)(""),[o,c]=(0,a.useState)(""),[d,u]=(0,a.useState)(""),{locale:p}=(0,g.b)(),{data:v,isLoading:y}=(0,f.a)({queryKey:["dictEntry",s,p],queryFn:()=>{let[e,t,n]=s.split(",");return x({form:e,lemma:"",sl:n,tl:p,pos:t.toUpperCase(),pow:"n"})},staleTime:1/0,refetchOnMount:!1,refetchOnWindowFocus:!1,refetchOnReconnect:!1,enabled:s.length>0&&"string"==typeof p}),{data:b}=(0,f.a)({queryKey:["audio",s],queryFn:()=>{let[e,t,n]=s.split(",");return m(n,e)},staleTime:1/0,refetchOnMount:!1,refetchOnWindowFocus:!1,refetchOnReconnect:!1,enabled:s.length>0}),{data:j}=(0,f.a)({queryKey:["sentence-audio",o],queryFn:()=>{let[e,t]=o.split(","),[n,r,a]=s.split(",");return h(a,e,t)},staleTime:1/0,refetchOnMount:!1,refetchOnWindowFocus:!1,refetchOnReconnect:!1,enabled:o.length>0});return(0,r.jsx)(A.Provider,{value:{drawerOpen:n,setDrawerOpen:l,dictEntry:null==v?void 0:v.data,isLoading:y,audio:b,setDictParams:i,token:d,setToken:u,setSentenceParams:c,sentenceAudio:j},children:t})};function R(){let e=(0,a.useContext)(A);if(!e)throw Error("useDictEntry must be used within a DictEntryProvider");return e}var q=n(682),D=n(32751);function M(){let[e,t]=(0,a.useState)(!1);return(0,a.useEffect)(()=>{e?document.body.style.overflow="hidden":document.body.style.overflow="auto"},[e]),(0,r.jsx)("button",{title:"lock/unlock window scroll",className:"absolute top-1/2 -translate-y-1/2 right-2 text-smokewhite",onClick:()=>t(!e),children:e?(0,r.jsx)(q.Z,{className:"w-5 h-5"}):(0,r.jsx)(D.Z,{className:"w-5 h-5 opacity-50"})})}var I=n(60173),J=n(9679),V=n(85542);function U(e){let{text:t,className:n="top-4"}=e,[l,s]=(0,a.useState)(!1),i=(0,a.useRef)(0);return(0,r.jsx)("div",{className:(0,I.cn)("absolute right-4",n),children:(0,r.jsx)("button",{onClick:()=>{clearTimeout(i.current),navigator.clipboard.writeText(t),s(!0),i.current=setTimeout(()=>{s(!1)},3e3)},className:"text-smokewhite opacity-50 active:opacity-100",children:l?(0,r.jsx)(J.Z,{className:"w-5 h-5"}):(0,r.jsx)(V.Z,{className:"w-5 h-5"})})})}var z=n(39555);function L(e){let{children:t}=e,{setDictParams:n,setDrawerOpen:a,setToken:l}=R();return(0,r.jsx)(r.Fragment,{children:t((e,t)=>{n(e),l(t),a(!0)})})}function W(e){var t;let{getCurrentTime:n,onTimestampClick:l,setPlaying:s}=e,i=(0,a.useRef)(null),o=(0,a.useRef)(null),{subsData:c,subsTranslations:d,isLoading:u,isError:x,colorBy:m,colorMode:h,showPinyin:f,showTranslation:y}=S(),j=null!==(t=(0,p.useSearchParams)().get("lang"))&&void 0!==t?t:"es",g="underline"===h,{ranges:N,categorizedGroups:k,subtitles:T}=w(c),[C,O]=(0,a.useState)(0),A=(0,a.useMemo)(()=>T.map(e=>({start:e.begin/1e3,end:e.end/1e3})),[T]),F=(0,a.useMemo)(()=>Object.entries(k).sort((e,t)=>{let[n]=e,[r]=t;return(parseInt(n.split("-")[0])||0)-(parseInt(r.split("-")[0])||0)}),[k]),R=(0,a.useCallback)(()=>{let e=o.current,t=i.current,n=window.innerWidth<768;if(e&&t){let r=e.offsetTop-(n?t.offsetTop:0)-t.clientHeight*(n?.1:.25);t.scrollTo({top:r,behavior:"smooth"})}},[]);return(0,a.useEffect)(()=>{R()},[C,R]),(0,a.useEffect)(()=>{let e=setInterval(()=>{let e=n();if(!e)return;let t=A.findIndex(t=>e+.3>=t.start&&e+.3<t.end);-1!=t&&O(t)},50);return()=>clearInterval(e)},[n,A]),(0,r.jsxs)(z.mQ,{className:"h-full",defaultValue:"transcripts",children:[(0,r.jsxs)(z.dr,{className:"relative pt-4 max-sm:px-0 max-xl:px-2",children:[(0,r.jsx)(z.SP,{value:"transcripts",onClick:()=>R(),children:"Transcripts"}),(0,r.jsx)(z.SP,{value:"words",children:"Words"}),(0,r.jsx)(M,{})]}),(0,r.jsxs)("div",{className:"relative h-full",children:[(0,r.jsxs)(z.nU,{value:"transcripts",ref:i,className:"h-full max-h-[calc(100%-48px)] overflow-y-auto scrollbar xl:space-y-4 sm:max-xl:px-2 pt-2 xl:pr-4 pb-4",children:[T.map((e,t)=>(0,r.jsxs)("div",{ref:t===C?o:null,className:(0,I.cn)("relative subtitle p-2 xl:rounded cursor-pointer transition-colors",t===C?"bg-blue-50 dark:bg-blue-800/30":"hover:bg-gray-200 dark:hover:bg-gray-800 opacity-50"),children:[(0,r.jsx)(U,{text:"".concat(e.text,"\n").concat(null==d?void 0:d[t])}),(0,r.jsx)("button",{onClick:()=>l(e.begin),className:"text-sm text-blue-300 active:text-blue-400",children:P(e.begin)}),(0,r.jsx)("div",{className:"text-xl flex flex-wrap gap-1 pr-8",children:e.tokens.map((e,t)=>{var n;let a=v("pos"===m?e.pos:null!==(n=function(e,t){if("number"!=typeof e)return"unknown";let n=t.find(t=>e>=t.min&&e<=t.max);return n?n.label:"unknown"}(e.freq,N))&&void 0!==n?n:"unknown",g,"pos"===m?_:E),l=b(e);return(0,r.jsx)(L,{children:t=>(0,r.jsxs)("div",{onClick:()=>{s(!1),t("".concat(e.form.text,",").concat(e.pos,",").concat(j),"".concat(e.form.text,",").concat(l))},className:"flex flex-col items-center",children:[f&&(0,r.jsx)("span",{className:"text-xs text-gray-500 dark:text-gray-300",children:l}),(0,r.jsx)("span",{className:(0,I.cn)(a,"none"===m&&"text-gray-700"),children:e.form.text})]})},t)})}),y&&d&&(0,r.jsx)("p",{className:"text-sm text-gray-400 dark:text-gray-400 italic mt-1",children:d[t]})]},t)),u&&(0,r.jsx)("p",{className:"mt-2",children:"Transcripts will show here."}),x&&(0,r.jsx)("p",{className:"mt-2 text-red-500",children:"Failed to fetch transcripts."})]}),(0,r.jsxs)(z.nU,{value:"words",className:"h-full mt-0 max-h-[calc(100%-48px)] overflow-y-auto scrollbar xl:space-y-4 sm:max-xl:px-2 pt-2 xl:pr-4 pb-4",children:[F.map(e=>{let[t,n]=e;return(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-base",children:t}),(0,r.jsx)("div",{className:"flex flex-wrap gap-2 mt-2 text-xl",children:n.map((e,n)=>{let a=v("pos"===m?e.pos:t,g,"pos"===m?_:E),l=b(e);return(0,r.jsx)(L,{children:t=>(0,r.jsxs)("div",{onClick:()=>{s(!1),t("".concat(e.form.text,",").concat(e.pos,",").concat(j),"".concat(e.form.text,",").concat(l))},className:"py-1 flex flex-col items-center cursor-pointer",children:[f&&(0,r.jsx)("span",{className:"text-xs text-gray-500 dark:text-gray-300",children:l}),(0,r.jsx)("span",{className:(0,I.cn)("px-2 xl:rounded",a,"none"===m&&"text-gray-700"),children:e.form.text},n)]})},n)})})]},t)}),u&&(0,r.jsx)("p",{className:"mt-2",children:"Vocabularies categorized by levels will show here."}),x&&(0,r.jsx)("p",{className:"mt-2 text-red-500",children:"Failed to fetch vocabularies."})]})]})]})}var H=n(25040);function B(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],n=(0,a.useRef)(null);return(0,a.useEffect)(()=>
1{if(!e)return;n.current&&(n.current.pause(),n.current.src="");let r=new Audio(e);return n.current=r,t&&r.play().catch(e=>{console.error("Auto playback failed:",e)}),()=>{r.pause(),r.src=""}},[e,t]),{play:(0,a.useCallback)(()=>{n.current&&n.current.play().catch(e=>{console.error("Manual playback failed:",e)})},[]),pause:(0,a.useCallback)(()=>{var e;null===(e=n.current)||void 0===e||e.pause()},[]),stop:(0,a.useCallback)(()=>{n.current&&(n.current.pause(),n.current.currentTime=0)},[]),audio:n.current}}let Q=(0,a.createContext)(void 0);var Z=n(95728),Y=n(58840);function G(e){let{word:t}=e,{subtitles:n,subsTranslations:s}=S(),i=(0,a.useMemo)(()=>{if(!t||!n||!s)return[];{let e=[];for(let r=0;r<n.length&&3!==e.length;r++){let a=n[r],l=a.tokens.map(b).join(" ").trim(),i=a.text.split(t||"").flatMap((e,n,r)=>n<r.length-1?[e,t]:[e]),o=s[r];a.text.includes(t)&&e.length<3&&e.push({index:r,transliteration:l,sentenceChunks:i,translation:o,...a})}return e}},[s,n,t]),{onTimestampClick:o}=function(){let e=(0,a.useContext)(Q);if(!e)throw Error("useReactPlayer must be used within a ReactPlayerProvider");return e}();return 0===i.length?null:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"mt-4",children:[(0,r.jsx)("p",{className:"text-xs text-secondary uppercase tracking-wide mb-2",children:"Examples from Subtitles"}),(0,r.jsx)("div",{className:"space-y-4",children:i.map((e,n)=>(0,r.jsxs)("div",{className:"relative border-l-2 border-l-softzinc pl-2 pr-3 mb-2",children:[(0,r.jsx)(U,{className:"top-2 right-4",text:"".concat(t,": \n\n").concat(e.text,"\n").concat(e.translation,"\n- - - - -\n")}),(0,r.jsx)("button",{onClick:()=>o(e.begin,e.end),className:"mt-2 text-sm text-blue-300 active:text-blue-400",children:P(e.begin)}),(0,r.jsx)("div",{className:"flex justify-between items-center",children:(0,r.jsx)("p",{className:"text-white text-xl",children:e.sentenceChunks.map((e,n)=>{let a=e===t;return(0,r.jsx)("span",{className:a?"text-yellow-600 dark:text-yellow-500":"",children:e},n)})})}),(0,r.jsx)("p",{className:"text-secondary dark:text-gray-400 italic",children:e.transliteration}),(0,r.jsx)("p",{className:"text-blue-800 pr-8 dark:text-blue-400 mt-2",children:e.translation})]},n))})]}),(0,r.jsx)(l.iz,{})]})}function K(e){var t,n,s,i;let{lang:o,withExamplesFromSubtitles:c,limitHeight:d}=e,{drawerOpen:u,setDrawerOpen:x,setSentenceParams:m,isLoading:h,audio:f,sentenceAudio:p,dictEntry:v,token:b}=R(),{play:j}=B(f),{play:w}=B(p),[N,k]=(0,a.useState)({width:0,height:0}),{videoSize:T}=S(),C=N.width>640,P=C||!d||"full-screen"===T?"".concat(N.height+4,"px"):"half-screen"===T?"".concat(.5*N.height,"px"):"".concat(N.height-9*N.width/16,"px"),_=N.width<768&&N.width>640,E=N.width<640,A=_?"320px":E?N.width:"448px";(0,a.useEffect)(()=>{var e;let t=(null===(e=window.visualViewport)||void 0===e?void 0:e.height)||window.innerHeight,n=()=>k({width:window.innerWidth,height:t});return n(),window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[]);let[F,q]=b.split(","),{t:D}=(0,g.b)();return(0,r.jsx)(H.dy.Root,{open:u,onOpenChange:x,direction:C?"right":"bottom",children:(0,r.jsxs)(H.dy.Portal,{children:[(0,r.jsx)(H.dy.Overlay,{className:(0,I.cn)("fixed inset-0 z-30",d&&(!C||_)?"":"bg-black/40 ")}),(0,r.jsx)(H.dy.Content,{className:(0,I.cn)("bg-black rounded-none transition-transform focus:outline-none p-0",C?"right-0 top-0 bottom-0":"bottom-0 left-0 right-0","fixed z-40 flex flex-col h-full w-full overflow-hidden"),style:{maxHeight:P,maxWidth:A},children:(0,r.jsxs)("div",{className:"p-4 overflow-y-auto scrollbar",children:[(0,r.jsxs)("div",{className:"flex justify-between items-start mb-4",children:[(0,r.jsx)(H.dy.Title,{asChild:!0,children:(0,r.jsxs)("div",{className:"flex justify-between items-end gap-4",children:[(0,r.jsxs)("div",{className:"flex flex-col items-center w-fit",children:[(0,r.jsx)("p",{className:"text-sm text-green-400 italic",children:q}),(0,r.jsx)("p",{className:"text-3xl font-bold text-yellow-400",children:F})]}),(0,r.jsx)("button",{onClick:j,className:"mb-1 text-smokewhite opacity-50 active:opacity-100 active:text-blue-400",children:(0,r.jsx)(Z.Z,{})})]})}),(0,r.jsx)("button",{onClick:()=>x(!1),className:"p-2 text-smokewhite opacity-50 active:opacity-100",children:(0,r.jsx)(Y.Z,{})})]}),h?D.loading:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"mb-4 space-y-2",children:null==v?void 0:null===(i=v.renderData)||void 0===i?void 0:null===(s=i.fullDictRenderData)||void 0===s?void 0:null===(n=s.entries)||void 0===n?void 0:null===(t=n[0])||void 0===t?void 0:t.posGroups.map((e,t)=>(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-secondary italic",children:e.pos?"(".concat(e.pos,")"):""}),(0,r.jsx)("p",{className:"text-black dark:text-white",children:e.translations.join(", ")})]},t))}),(0,r.jsx)(l.iz,{}),c&&(0,r.jsx)(G,{word:F}),(0,r.jsxs)("div",{className:"mt-4",children:[(0,r.jsx)("p",{className:"text-xs text-secondary uppercase tracking-wide mb-2",children:"Examples by Part of Speech"}),(null==v?void 0:v.tatoebaExamples)?Object.entries(v.tatoebaExamples).map(e=>{let[t,n]=e;return(0,r.jsxs)("div",{className:"mb-4 space-y-4",children:[(0,r.jsx)("p",{className:"text-sm font-semibold text-gray-300 mb-2",children:O[t]}),n.map((e,t)=>{var n,a;let l=e.nlp.map(y).join(" ").trim(),s="".concat(e.text,",").concat(e.textHash);return(0,r.jsxs)("div",{className:"relative border-l-2 border-l-softzinc pl-2 pr-3 mb-2",children:[(0,r.jsx)("div",{className:"flex justify-between items-center",children:(0,r.jsx)("p",{className:"text-white text-xl",children:e.nlp.map((e,t)=>{let n=e.form.text===F;return(0,r.jsx)("span",{className:n?"text-yellow-600 dark:text-yellow-500":"",children:e.form.text},t)})})}),(0,r.jsx)("p",{className:"text-gray-400 italic",children:l}),(0,r.jsx)("p",{className:"text-blue-400 mt-2",children:null===(n=e.translation)||void 0===n?void 0:n.text}),(0,r.jsxs)("p",{className:"text-xs text-secondary mt-1",children:["Frequency Rank: ",e.avgFreqRank]}),(0,r.jsxs)("div",{className:"mt-4 flex gap-4",children:[(0,r.jsx)(U,{text:"".concat(F,": \n\n").concat(e.text,"\n").concat(null===(a=e.translation)||void 0===a?void 0:a.text,"\n- - - - -\n"),className:"relative right-0"}),(0,r.jsx)("button",{className:"text-smokewhite opacity-50 active:opacity-100 active:text-blue-400",onClick:()=>{m(s),w()},children:(0,r.jsx)(Z.Z,{className:"-mt-0.5 w-6 h-6"})})]})]},t)})]},t)}):"No Examples found."]})]})]})})]})})}var X=n(26031),$=n(4814),ee=n(13847);function et(){return(0,r.jsx)(F,{children:(0,r.jsx)(k,{children:(0,r.jsx)(en,{})})})}function en(){var e,t;let n=(0,a.useRef)(null),l=(0,a.useRef)(null),[s,o]=(0,a.useState)(null),{videoId:c,videoSize:d,audioOnly:u}=S(),x=(0,a.useCallback)(()=>n.current?n.current.getCurrentTime():null,[]),{updateHistory:m}=(0,X.O)(),h=(0,p.useSearchParams)(),f=null!==(e=h.get("lang"))&&void 0!==e?e:"es",v=parseInt(null!==(t=h.get("last_watched"))&&void 0!==t?t:"0"),{drawerOpen:y,setDrawerOpen:b}=R(),j=(0,a.useRef)(0),w=(0,a.useCallback)((e,t)=>{b(r=>{if(r){if(t){let r=t-e;o(()=>{var t;return null===(t=n.current)||void 0===t||t.seekTo(e/1e3,"seconds"),j.current=r,!0})}return!0}return o(t=>{var r;return null===(r=n.current)||void 0===r||r.seekTo(e/1e3,"seconds"),!!t||null==t}),r})},[b]),{width:g}=(0,ee.iP)();return(0,r.jsxs)(Q.Provider,{value:{onTimestampClick:w},children:[(0,r.jsx)(K,{lang:f,withExamplesFromSubtitles:!0,limitHeight:!0}),(0,r.jsxs)("div",{className:"max-w-7xl mx-auto flex flex-col sm:flex-row md:gap-3 xl:gap-6 p-0 sm:p-0 md:p-3 xl:p-6",children:[(0,r.jsxs)("div",{className:"h-full w-full sm:w-2/3",children:[(0,r.jsx)("div",{ref:l,children:(0,r.jsx)(C,{})}),(0,r.jsx)("div",{className:(0,$.Z)("md:rounded-lg sm:overflow-hidden sm:mt-0 md:mt-3 xl:mt-6","default"===d&&"aspect-video w-full","half-screen"===d&&"h-[50dvh] w-full","full-screen"===d&&"h-[calc(100dvh+4px)] w-full",u&&"opacity-0 h-0 w-0"),children:(0,r.jsx)(i(),{ref:n,url:"https://www.youtube.com/watch?v=".concat(c),playing:s,width:"100%",height:"100%",controls:!y,onReady:()=>
1{if(v){var e;null==n||null===(e=n.current)||void 0===e||e.seekTo(v),o(!0)}},onPlay:()=>{if(o(!0),l.current){let e=l.current.offsetTop,t=l.current.offsetHeight,n=window.innerWidth<768?2:0;window.scrollTo({top:e+t+n,behavior:"smooth"})}j.current&&(setTimeout(()=>{o(!1)},j.current-300),j.current=0)},onPause:()=>o(!1),onProgress:async e=>{var t;let{playedSeconds:r}=e;await m(c,f,r,null===(t=n.current)||void 0===t?void 0:t.getDuration())}})}),(0,r.jsxs)("div",{className:"hidden sm:block m-3",children:[(0,r.jsx)("p",{children:"Subtitles API:"}),(0,r.jsx)("a",{href:"https://www.languagereactor.com/",target:"_blank",rel:"noopener noreferrer",className:"text-blue-400",children:"Language Reactor"})]})]}),(0,r.jsx)("div",{className:"max-sm:hidden sticky top-0 max-md:border-l-0 max-md:rounded-none max-md:shadow-none md:top-2 xl:top-4 w-full max-w-xs lg:max-w-sm p-0 overflow-hidden",style:{maxHeight:g<1080?"100dvh":"calc(100dvh - 68px)"},children:(0,r.jsx)(W,{setPlaying:o,getCurrentTime:x,onTimestampClick:w})}),(0,r.jsx)("div",{className:"sm:hidden pl-3 overflow-hidden space-y-2",style:{height:"calc(100vh - 56.25vw + 4px)"},children:(0,r.jsx)(W,{setPlaying:o,getCurrentTime:x,onTimestampClick:w})})]})]})}var er=n(83506);function ea(){return(0,r.jsx)(er.Ar,{children:(0,r.jsx)("div",{children:(0,r.jsxs)("main",{className:"max-w-[1080px] mx-auto md:px-8",children:[(0,r.jsx)("div",{className:"flex flex-col justify-end bg-black z-10 max-md:px-2 pb-2 border-b-[1.5px] border-b-subtle",children:(0,r.jsx)("div",{className:"w-fit",children:(0,r.jsx)(l.up,{})})}),(0,r.jsx)(et,{})]})})})}}},function(e){e.O(0,[689,196,888,774,179],function(){return e(e.s=38767)}),_N_E=e.O()}]);
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.