import{c as x,s as w$1}from"./chunk-C6uGsfWa.js";import{$s as td,Ds as q_e,fr as S,sc as ui}from"./chunk-B_pj7Jpm.js";var R=class t{warnCacheKey;warnCacheResult;errCacheKey;errCacheResult;buildWarn(r){let{videoId:e,state:a}=r,s=`${e}-${a}`;return this.warnCacheKey===s&&this.warnCacheResult?this.warnCacheResult:(this.warnCacheResult=this._buildWarn(r),this.warnCacheKey=s,this.warnCacheResult)}_buildWarn(r){let{videoId:e,state:a}=r,s="Your video file is being processed.",l="This can take a while and some features may not be available until it is complete.",u="Contact your administrator to fix it.",I="Your web browser may not be able to play it.";switch(a){case td.PUBLISHED:case td.LIVE_ENDED:case td.WAITING_FOR_LIVE:return;case td.TO_TRANSCODE:return{title:"Transcoding in progress",manageMain:s,manageSecondary:l,watchMain:I,watchSecondary:``};case td.TO_IMPORT:return{title:"Import in progress",manageMain:"Your remote video is being imported.",manageSecondary:l,watchMain:"The remote video is being imported, it will be available when the import is complete.",watchSecondary:``,routerLink:{text:"Review your import",link:[`/my-library/video-imports`],queryParams:{videoId:e}}};case td.TO_IMPORT_FAILED:{let m="The remote video failed to import, it will not be available.";return{title:"Import failed",manageMain:"Your remote video failed to import.",manageSecondary:``,watchMain:m,watchSecondary:``,routerLink:{text:"Review your import",link:[`/my-library/video-imports`],queryParams:{videoId:e}}}}case td.TO_MOVE_TO_FILE_SYSTEM:return{title:"Moving video files",manageMain:s,manageSecondary:l,watchMain:I,watchSecondary:"The video is being moved to the file system."};case td.TO_MOVE_TO_FILE_SYSTEM_FAILED:{let m="Failed to move video files to the platform file system.";return{title:"Failed to move video files",manageMain:m,manageSecondary:u,watchMain:I,watchSecondary:m}}case td.TO_MOVE_TO_EXTERNAL_STORAGE:return{title:"Moving video files",manageMain:s,manageSecondary:l,watchMain:I,watchSecondary:"The video is being moved to an external storage."};case td.TO_MOVE_TO_EXTERNAL_STORAGE_FAILED:{let m="Failed to move video files to an external storage.";return{title:"Failed to move video files",manageMain:m,manageSecondary:u,watchMain:I,watchSecondary:m}}case td.TO_EDIT:return{title:"Studio edition in progress",manageMain:s,manageSecondary:l,watchMain:I,watchSecondary:``};case td.TRANSCODING_FAILED:return{title:"Transcodifica fallita",manageMain:"Failure during transcoding of your video files",manageSecondary:u,watchMain:I,watchSecondary:``};default:return a}}buildErr(r){let{videoId:e,blacklisted:a,blacklistedReason:s}=r,l=`${e}-${a}-${q_e(s)}`;return this.errCacheKey===l&&this.errCacheResult?this.errCacheResult:(this.errCacheResult=this._buildErr(r),this.errCacheKey=l,this.errCacheResult)}_buildErr(r){let{blacklisted:e,blacklistedReason:a}=r;if(e)return{title:"Blocked video",main:a||"Your video has been blocked by the platform"}}static ɵfac=function(e){return new(e||t)};static ɵprov=S({token:t,factory:t.ɵfac})};var O=t=>typeof t.id==`string`&&typeof t.from==`number`&&typeof t.to==`number`&&typeof t.text==`string`;var p=t=>!t||/^\s*$/.test(t);var c={ID:`ID`,TIME_LINE:`TIME_LINE`,TEXT:`TEXT`,MULTI_LINE_TEXT:`MULTI_LINE_TEXT`,FIN_ENTRY:`FIN_ENTRY`,FINISH:`FINISH`};var N=t=>{let r=t.split(`:`),e,a,s;return r.length===2?[a,s]=r:[e,a,s]=r,parseInt(s.replace(`,`,``),10)+parseInt(a,10)*60*1e3+(e?parseInt(e,10):0)*60*60*1e3};var f=()=>({start(t){let r=c.ID,e={tokens:t.split(/\n/),pos:0,result:[],current:{}};for(;r!==c.FINISH;){let a=this[r](e);e=a.params,r=a.next}return e.result},[c.ID](t){let{tokens:r,pos:e,current:a}=t;if(r.length<=e)return{next:c.FINISH,params:t};if(p(r[e]))return{next:c.ID,params:x(w$1({},t),{pos:e+1})};let s=r[e].includes(`-->`);return a.id=s?``:r[e],{next:c.TIME_LINE,params:x(w$1({},t),{current:a,tokens:r,pos:s?e:e+1})}},[c.TIME_LINE](t){let{tokens:r,pos:e,current:a}=t,[l,u]=r[e].split(`-->`);return a.from=N(l),a.to=N(u),{next:c.TEXT,params:x(w$1({},t),{current:a,pos:e+1})}},[c.TEXT](t){let{tokens:r,pos:e,current:a}=t;return r.length<=e?{next:c.FINISH,params:t}:(a.text=r[e],{next:c.MULTI_LINE_TEXT,params:x(w$1({},t),{current:a,pos:e+1})})},[c.MULTI_LINE_TEXT](t){let{tokens:r,pos:e,current:a}=t;return r.length<=e||p(r[e])?{next:c.FIN_ENTRY,params:t}:(a.text=`${a.text}
${r[e]}`,{next:c.MULTI_LINE_TEXT,params:x(w$1({},t),{current:a,pos:e+1})})},[c.FIN_ENTRY](t){let{pos:r,current:e,result:a}=t;if(O(e))a.push(e);else throw new Error(`Parsing error current not complete ${JSON.stringify(e)}`);return{next:c.ID,params:x(w$1({},t),{current:{},pos:r+1})}},[c.FINISH](t){return{next:c.FINISH,params:t}}});var y=t=>({entries:f().start(t)});var n={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`};var h=t=>{let r=t.split(`:`),e,a,s;return r.length===2?[a,s]=r:[e,a,s]=r,parseInt(s.replace(`.`,``),10)+parseInt(a,10)*60*1e3+(e?parseInt(e,10):0)*60*60*1e3};var L=()=>({start(t){let r=n.HEADER,e={tokens:t.split(/\n/),pos:0,result:[],current:{}};for(;r!==n.FINISH;){let a=this[r](e);e=a.params,r=a.next}return e.result},[n.HEADER](t){return{next:n.LEGACY_HEADER,params:x(w$1({},t),{pos:t.pos+1})}},[n.LEGACY_HEADER](t){let{tokens:r,pos:e}=t;return r.length<=e?{next:n.FINISH,params:t}:r[e].includes(`:`)&&!r[e].includes(`-->`)?{next:n.LEGACY_HEADER,params:x(w$1({},t),{pos:e+1})}:{next:n.ID_OR_NOTE_OR_STYLE_OR_REGION,params:t}},[n.ID_OR_NOTE_OR_STYLE_OR_REGION](t){let{tokens:r,pos:e}=t;return r.length<=e?{next:n.FINISH,params:t}:p(r[e])?{next:n.ID_OR_NOTE_OR_STYLE_OR_REGION,params:x(w$1({},t),{pos:e+1})}:r[e].toUpperCase().includes(`NOTE`)?{next:n.NOTE,params:t}:r[e].toUpperCase().includes(`STYLE`)?{next:n.STYLE,params:t}:r[e].toUpperCase().includes(`REGION`)?{next:n.REGION,params:t}:{next:n.ID,params:t}},[n.STYLE](t){let{tokens:r,pos:e}=t;return p(r[e])?{next:n.ID_OR_NOTE_OR_STYLE_OR_REGION,params:x(w$1({},t),{pos:e+1})}:{next:n.STYLE,params:x(w$1({},t),{pos:e+1})}},[n.NOTE](t){let{tokens:r,pos:e}=t;return p(r[e])?{next:n.ID_OR_NOTE_OR_STYLE_OR_REGION,params:x(w$1({},t),{pos:e+1})}:{next:n.STYLE,params:x(w$1({},t),{pos:e+1})}},[n.REGION](t){let{tokens:r,pos:e}=t;return p(r[e])?{next:n.ID_OR_NOTE_OR_STYLE_OR_REGION,params:x(w$1({},t),{pos:e+1})}:{next:n.REGION,params:x(w$1({},t),{pos:e+1})}},[n.ID](t){let{tokens:r,pos:e,current:a}=t;if(r.length<=e)return{next:n.FINISH,params:t};if(p(r[e]))return{next:n.ID,params:x(w$1({},t),{pos:e+1})};let s=r[e].includes(`-->`);return a.id=s?``:r[e],{next:n.TIME_LINE,params:x(w$1({},t),{current:a,tokens:r,pos:s?e:e+1})}},[n.TIME_LINE](t){let{tokens:r,pos:e,current:a}=t,[l,u]=r[e].split(`-->`);return a.from=h(l),a.to=h(u),{next:n.TEXT,params:x(w$1({},t),{current:a,pos:e+1})}},[n.TEXT](t){let{tokens:r,pos:e,current:a}=t;return r.length<=e?{next:n.FINISH,params:t}:(a.text=r[e],{next:n.MULTI_LINE_TEXT,params:x(w$1({},t),{current:a,pos:e+1})})},[n.MULTI_LINE_TEXT](t){let{tokens:r,pos:e,current:a}=t;return r.length<=e||p(r[e])?{next:n.FIN_ENTRY,params:t}:(a.text=`${a.text}
${r[e]}`,{next:n.MULTI_LINE_TEXT,params:x(w$1({},t),{current:a,pos:e+1})})},[n.FIN_ENTRY](t){let{pos:r,current:e,result:a}=t;if(O(e))a.push(e);else throw new Error(`Parsing error current not complete ${JSON.stringify(e)}`);return{next:n.ID_OR_NOTE_OR_STYLE_OR_REGION,params:x(w$1({},t),{current:{},pos:r+1})}},[n.FINISH](t){return{next:n.FINISH,params:t}}});var M=t=>({entries:L().start(t)});var w=t=>t.startsWith(`WEBVTT`)?M(t):y(t);var g=class t{transform(r){let e=Math.floor(r/3600),a=Math.floor(r%3600/60),s=r%60;if(e>0){let l=`${e}h`;return a!==0&&(l+=` `+`${a}min`),s!==0&&(l+=` `+`${s}sec`),l}if(a>0){let l=`${a}min`;return s!==0&&(l+=` `+`${s}sec`),l}return `${s} sec `}static ɵfac=function(e){return new(e||t)};static ɵpipe=ui({name:`myTimeDurationFormatter`,type:t,pure:!0})};export{g as n,w as r,R as t};
//# debugId=6cb8f132-f33a-5035-a925-e12c09f3f77a
//# sourceMappingURL=chunk-7OmbJtav.js.map