import{Ea as c,ea as u,lg as R}from"./chunk-QXV2GR6R.js";import{a as E,b as I,i as T}from"./chunk-JJ4RDTEF.js";var H=(()=>{let n=class n{constructor(t){T(this,"htmlRenderer");this.htmlRenderer=t}transform(t){return this.htmlRenderer.convertToBr(t)}};T(n,"\u0275fac",function(o){return new(o||n)(c(R,16))}),T(n,"\u0275pipe",u({name:"nl2br",type:n,pure:!0,standalone:!0}));let r=n;return r})();var i=r=>typeof r.id=="string"&&typeof r.from=="number"&&typeof r.to=="number"&&typeof r.text=="string",a=r=>!r||/^\s*$/.test(r),p={ID:"ID",TIME_LINE:"TIME_LINE",TEXT:"TEXT",MULTI_LINE_TEXT:"MULTI_LINE_TEXT",FIN_ENTRY:"FIN_ENTRY",FINISH:"FINISH"},O=r=>{let n=r.split(":"),e,t,o;return n.length===2?[t,o]=n:[e,t,o]=n,parseInt(o.replace(",",""),10)+parseInt(t,10)*60*1e3+(e?parseInt(e,10):0)*60*60*1e3},L=()=>({start(r){let n=p.ID,e={tokens:r.split(/\n/),pos:0,result:[],current:{}};for(;n!==p.FINISH;){let t=this[n](e);e=t.params,n=t.next}return e.result},[p.ID](r){let{tokens:n,pos:e,current:t}=r;if(n.length<=e)return{next:p.FINISH,params:r};if(a(n[e]))return{next:p.ID,params:I(E({},r),{pos:e+1})};let o=n[e].includes("-->");return t.id=o?"":n[e],{next:p.TIME_LINE,params:I(E({},r),{current:t,tokens:n,pos:o?e:e+1})}},[p.TIME_LINE](r){let{tokens:n,pos:e,current:t}=r,o=n[e],[_,N]=o.split("-->");return t.from=O(_),t.to=O(N),{next:p.TEXT,params:I(E({},r),{current:t,pos:e+1})}},[p.TEXT](r){let{tokens:n,pos:e,current:t}=r;return n.length<=e?{next:p.FINISH,params:r}:(t.text=n[e],{next:p.MULTI_LINE_TEXT,params:I(E({},r),{current:t,pos:e+1})})},[p.MULTI_LINE_TEXT](r){let{tokens:n,pos:e,current:t}=r;return n.length<=e||a(n[e])?{next:p.FIN_ENTRY,params:r}:(t.text=`${t.text}
${n[e]}`,{next:p.MULTI_LINE_TEXT,params:I(E({},r),{current:t,pos:e+1})})},[p.FIN_ENTRY](r){let{pos:n,current:e,result:t}=r;if(i(e))t.push(e);else throw new Error(`Parsing error current not complete ${JSON.stringify(e)}`);return{next:p.ID,params:I(E({},r),{current:{},pos:n+1})}},[p.FINISH](r){return{next:p.FINISH,params:r}}}),l=r=>({entries:L().start(r)}),s={HEADER:"HEADER",ID:"ID",TIME_LINE:"TIME_LINE",ID_OR_NOTE_OR_STYLE_OR_REGION:"ID_OR_NOTE_OR_STYLE_OR_REGION",STYLE:"STYLE",NOTE:"NOTE",REGION:"REGION",LEGACY_HEADER:"LEGACY_HEADER",TEXT:"TEXT",MULTI_LINE_TEXT:"MULTI_LINE_TEXT",FIN_ENTRY:"FIN_ENTRY",FINISH:"FINISH"},m=r=>{let n=r.split(":"),e,t,o;return n.length===2?[t,o]=n:[e,t,o]=n,parseInt(o.replace(".",""),10)+parseInt(t,10)*60*1e3+(e?parseInt(e,10):0)*60*60*1e3},x=()=>({start(r){let n=s.HEADER,e={tokens:r.split(/\n/),pos:0,result:[],current:{}};for(;n!==s.FINISH;){let t=this[n](e);e=t.params,n=t.next}return e.result},[s.HEADER](r){return{next:s.LEGACY_HEADER,params:I(E({},r),{pos:r.pos+1})}},[s.LEGACY_HEADER](r){let{tokens:n,pos:e}=r;return n.length<=e?{next:s.FINISH,params:r}:n[e].includes(":")&&!n[e].includes("-->")?{next:s.LEGACY_HEADER,params:I(E({},r),{pos:e+1})}:{next:s.ID_OR_NOTE_OR_STYLE_OR_REGION,params:r}},[s.ID_OR_NOTE_OR_STYLE_OR_REGION](r){let{tokens:n,pos:e}=r;return n.length<=e?{next:s.FINISH,params:r}:a(n[e])?{next:s.ID_OR_NOTE_OR_STYLE_OR_REGION,params:I(E({},r),{pos:e+1})}:n[e].toUpperCase().includes("NOTE")?{next:s.NOTE,params:r}:n[e].toUpperCase().includes("STYLE")?{next:s.STYLE,params:r}:n[e].toUpperCase().includes("REGION")?{next:s.REGION,params:r}:{next:s.ID,params:r}},[s.STYLE](r){let{tokens:n,pos:e}=r;return a(n[e])?{next:s.ID_OR_NOTE_OR_STYLE_OR_REGION,params:I(E({},r),{pos:e+1})}:{next:s.STYLE,params:I(E({},r),{pos:e+1})}},[s.NOTE](r){let{tokens:n,pos:e}=r;return a(n[e])?{next:s.ID_OR_NOTE_OR_STYLE_OR_REGION,params:I(E({},r),{pos:e+1})}:{next:s.STYLE,params:I(E({},r),{pos:e+1})}},[s.REGION](r){let{tokens:n,pos:e}=r;return a(n[e])?{next:s.ID_OR_NOTE_OR_STYLE_OR_REGION,params:I(E({},r),{pos:e+1})}:{next:s.REGION,params:I(E({},r),{pos:e+1})}},[s.ID](r){let{tokens:n,pos:e,current:t}=r;if(n.length<=e)return{next:s.FINISH,params:r};if(a(n[e]))return{next:s.ID,params:I(E({},r),{pos:e+1})};let o=n[e].includes("-->");return t.id=o?"":n[e],{next:s.TIME_LINE,params:I(E({},r),{current:t,tokens:n,pos:o?e:e+1})}},[s.TIME_LINE](r){let{tokens:n,pos:e,current:t}=r,o=n[e],[_,N]=o.split("-->");return t.from=m(_),t.to=m(N),{next:s.TEXT,params:I(E({},r),{current:t,pos:e+1})}},[s.TEXT](r){let{tokens:n,pos:e,current:t}=r;return n.length<=e?{next:s.FINISH,params:r}:(t.text=n[e],{next:s.MULTI_LINE_TEXT,params:I(E({},r),{current:t,pos:e+1})})},[s.MULTI_LINE_TEXT](r){let{tokens:n,pos:e,current:t}=r;return n.length<=e||a(n[e])?{next:s.FIN_ENTRY,params:r}:(t.text=`${t.text}
${n[e]}`,{next:s.MULTI_LINE_TEXT,params:I(E({},r),{current:t,pos:e+1})})},[s.FIN_ENTRY](r){let{pos:n,current:e,result:t}=r;if(i(e))t.push(e);else throw new Error(`Parsing error current not complete ${JSON.stringify(e)}`);return{next:s.ID_OR_NOTE_OR_STYLE_OR_REGION,params:I(E({},r),{current:{},pos:n+1})}},[s.FINISH](r){return{next:s.FINISH,params:r}}}),S=r=>({entries:x().start(r)}),h=r=>r.startsWith("WEBVTT")?S(r):l(r);export{H as a,h as b};
/**i18n:224bcada6943fe8b17ea60808c2d370cec9507c3bd670ebe71692d099a3befa1*/
//# sourceMappingURL=chunk-RB4ORSVR.js.map
