jassub 1.6.1 → 1.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- var h=h,qe=e=>console.log(e),Ye=e=>console.error(e);function Ke(){}self.assert||(self.assert=(e,r)=>{if(!e)throw r});String.prototype.startsWith||(String.prototype.startsWith=function(e,r){return r===void 0&&(r=0),this.substring(r,e.length)===e});String.prototype.includes||(String.prototype.includes=function(e,r){return this.indexOf(e,r)!==-1});if(!ArrayBuffer.isView){const e=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];ArrayBuffer.isView=r=>r&&r.constructor&&e.indexOf(r.constructor)!==-1}Uint8Array.prototype.slice||(Uint8Array.prototype.slice=function(e,r){return new Uint8Array(this.subarray(e,r))});Date.now||(Date.now=()=>new Date().getTime());"performance"in self||(self.performance={now:()=>Date.now()});if(typeof console>"u"){const e=(r,t)=>{postMessage({target:"console",command:r,content:JSON.stringify(Array.prototype.slice.call(t))})};console={log:function(){e("log",arguments)},debug:function(){e("debug",arguments)},info:function(){e("info",arguments)},warn:function(){e("warn",arguments)},error:function(){e("error",arguments)}},console.log("Detected lack of console, overridden console")}const Se=(e,r)=>{const t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType=r?"arraybuffer":"text",t.send(null),t.response},Sr=(e,r,t)=>{const n=new XMLHttpRequest;n.open("GET",e,!0),n.responseType="arraybuffer",n.onload=()=>{if((n.status===200||n.status===0)&&n.response)return r(n.response);t()},n.onerror=t,n.send(null)};h={wasm:WebAssembly&&!WebAssembly.instantiateStreaming&&Se("jassub-worker.wasm",!0)};Ke=()=>postMessage({target:"ready"});qe=e=>{e==="JASSUB: No usable fontconfig configuration file found, using fallback."?console.debug(e):console.log(e)};Ye=e=>{e==="Fontconfig error: Cannot load default config file: No such file: (null)"?console.debug(e):console.error(e)};let J=0;const Fr=1;let E=null,He=!1,Fe=Date.now(),ie=24,Qe=!1,Ze="js",oe={};const Ve={};let Ar=0,Ne;self.width=0;self.height=0;let M=!1;self.addFont=({font:e})=>Ae(e);const Te=e=>{e=e.trim().toLowerCase(),e.startsWith("@")&&(e=e.substring(1)),!Ve[e]&&(Ve[e]=!0,oe[e]?Ae(oe[e]):Qe&&postMessage({target:"getLocalFont",font:e}))},Ae=e=>{ArrayBuffer.isView(e)?xe(e):Sr(e,r=>{xe(new Uint8Array(r))},console.error)},xe=e=>{const r=ve(e.byteLength);w.set(e,r),p.addFont("font-"+Ar++,r,e.byteLength),p.reloadFonts()},er=e=>{if(!oe)return;const r=Or(e);for(let i=0;i<r.length;i++)for(let s=0;s<r[i].body.length;s++)r[i].body[s].key==="Style"&&Te(r[i].body[s].value.Fontname);const t=/\\fn([^\\}]*?)[\\}]/g;let n;for(;(n=t.exec(e))!==null;)Te(n[1])};self.setTrack=({content:e})=>{er(e),p.createTrackMem(e),Oe=tr[p.getTrackColorSpace()]};self.freeTrack=()=>{p.removeTrack()};self.setTrackByUrl=({url:e})=>{self.setTrack({content:Se(e)})};const kr=()=>{const e=(Date.now()-Fe)/1e3;return ae?J:(e>5&&(console.error("Didn't received currentTime > 5 seconds. Assuming video was paused."),rr(!0)),J+e*Fr)},Er=e=>{J=e,Fe=Date.now(),E||(He?E=Ee(se):(se(),setTimeout(()=>{He=!1},20)))};let ae=!0;const rr=e=>{e!==ae&&(ae=e,e?E&&(clearTimeout(E),E=null):(Fe=Date.now(),E=Ee(se)))},H="BT.601",ze="BT.709",Ge="SMPTE240M",tr=[H,H,H,H,H,ze,ze,Ge,Ge,"FCC","FCC"],ke=(e,r)=>{const t=performance.now(),n=Ze==="wasm"?p.renderBlend(e,r||0):p.renderImage(e,r||0),i={renderTime:performance.now()-t-p.time,decodeTime:p.time};if(p.changed!==0||r){const s=[];let o=[];const f=performance.now();if(!n)return _e({images:s,buffers:o,times:i,decodeStartTime:f});if(M){const a=[];for(let l=n,u=0;u<p.count;l=l.next,++u)s.push({w:l.w,h:l.h,x:l.x,y:l.y}),a.push(createImageBitmap(new ImageData(Ue.slice(l.image,l.image+l.w*l.h*4),l.w,l.h)));Promise.all(a).then(l=>{for(let u=0;u<s.length;u++)s[u].image=l[u];o=l,_e({images:s,buffers:o,times:i,decodeStartTime:f})})}else{for(let a=n,l=0;l<p.count;a=a.next,++l){const u={w:a.w,h:a.h,x:a.x,y:a.y,image:a.image};if(!j){const c=K.slice(a.image,a.image+a.w*a.h*4);o.push(c),u.image=c}s.push(u)}_e({images:s,buffers:o,times:i,decodeStartTime:f})}}else postMessage({target:"unbusy"})};self.demand=({time:e})=>{J=e,ke(e)};const se=e=>{E=0,ke(kr(),e),ae||(E=Ee(se))},_e=({times:e,images:r,decodeStartTime:t,buffers:n})=>{e.decodeTime=performance.now()-t;const i={target:"render",async:M,images:r,times:e,width:self.width,height:self.height,colorSpace:Oe};if(j){const s=performance.now();(D.height!==self.height||D.width!==self.width)&&(D.width=self.width,D.height=self.height),j.clearRect(0,0,self.width,self.height);for(const o of r)o.image&&(M?(j.drawImage(o.image,o.x,o.y),o.image.close()):(V.width=o.w,V.height=o.h,nr.putImageData(new ImageData(Ue.subarray(o.image,o.image+o.w*o.h*4),o.w,o.h),0,0),j.drawImage(V,o.x,o.y)));if(Ne){e.drawTime=performance.now()-s;let o=0;for(const f in e)o+=e[f];console.log("Bitmaps: "+r.length+" Total: "+Math.round(o)+"ms",e)}try{const o=D.transferToImageBitmap();i.images=[{image:o,x:0,y:0}],i.async=!0,postMessage(i,[o])}catch{postMessage({target:"unbusy"})}}else postMessage(i,n)},Or=e=>{let r,t,n,i,s,o,f,a,l,u;const c=[],d=e.split(/[\r\n]+/g);for(a=0;a<d.length;a++)if(r=d[a].match(/^\[(.*)\]$/),r)t=null,c.push({name:r[1],body:[]});else{if(/^\s*$/.test(d[a])||c.length===0)continue;if(u=c[c.length-1].body,d[a][0]===";")u.push({type:"comment",value:d[a].substring(1)});else{if(i=d[a].split(":"),s=i[0],o=i.slice(1).join(":").trim(),(t||s==="Format")&&(o=o.split(","),t&&o.length>t.length&&(n=o.slice(t.length-1).join(","),o=o.slice(0,t.length-1),o.push(n)),o=o.map(v=>v.trim()),t)){for(f={},l=0;l<o.length;l++)f[t[l]]=o[l];o=f}s==="Format"&&(t=o),u.push({key:s,value:o})}}return c},Ee=(()=>{let e=0;return r=>{const t=Date.now();if(e===0)e=t+1e3/ie;else for(;t+2>=e;)e+=1e3/ie;const n=Math.max(e-t,0);return setTimeout(r,n)}})(),de=(e,r)=>{for(const t of Object.keys(e))r[t]=e[t]};let D,j,V,nr,p,Oe;self.init=e=>{self.width=e.width,self.height=e.height,Ze=e.blendMode,M=e.asyncRender,M&&typeof createImageBitmap>"u"&&(M=!1,console.error("'createImageBitmap' needed for 'asyncRender' unsupported!")),oe=e.availableFonts,Ne=e.debug,ie=e.targetFps||ie,Qe=e.useLocalFonts;const r=e.fallbackFont.toLowerCase();p=new h.JASSUB(self.width,self.height,r||null),r&&Te(r);let t=e.subContent;t||(t=Se(e.subUrl)),er(t);for(const n of e.fonts||[])Ae(n);p.createTrackMem(t),Oe=tr[p.trackColorSpace],p.setDropAnimations(e.dropAllAnimations||0),(e.libassMemoryLimit>0||e.libassGlyphLimit>0)&&p.setMemoryLimits(e.libassGlyphLimit||0,e.libassMemoryLimit||0),e.offscreenRender&&(D=new OffscreenCanvas(self.height,self.width),j=D.getContext("2d",{desynchronized:!0}),M||(V=new OffscreenCanvas(self.height,self.width),nr=V.getContext("2d",{desynchronized:!0})))};self.canvas=({width:e,height:r,force:t})=>{if(e==null)throw new Error("Invalid canvas size specified");self.width=e,self.height=r,p.resizeCanvas(e,r),t&&ke(J)};self.video=({currentTime:e,isPaused:r,rate:t})=>{e!=null&&Er(e),r!=null&&rr(r),t=t||t};self.destroy=()=>{p.quitLibrary()};self.createEvent=({event:e})=>{de(e,p.getEvent(p.allocEvent()))};self.getEvents=()=>{const e=[];for(let r=0;r<p.getEventCount();r++){const{Start:t,Duration:n,ReadOrder:i,Layer:s,Style:o,MarginL:f,MarginR:a,MarginV:l,Name:u,Text:c,Effect:d}=p.getEvent(r);e.push({Start:t,Duration:n,ReadOrder:i,Layer:s,Style:o,MarginL:f,MarginR:a,MarginV:l,Name:u,Text:c,Effect:d})}postMessage({target:"getEvents",events:e})};self.setEvent=({event:e,index:r})=>{de(e,p.getEvent(r))};self.removeEvent=({index:e})=>{p.removeEvent(e)};self.createStyle=({style:e})=>{de(e,p.getStyle(p.allocStyle()))};self.getStyles=()=>{const e=[];for(let r=0;r<p.getStyleCount();r++){const{Name:t,FontName:n,FontSize:i,PrimaryColour:s,SecondaryColour:o,OutlineColour:f,BackColour:a,Bold:l,Italic:u,Underline:c,StrikeOut:d,ScaleX:v,ScaleY:y,Spacing:m,Angle:b,BorderStyle:C,Outline:U,Shadow:P,Alignment:be,MarginL:Z,MarginR:N,MarginV:ee,Encoding:Cr,treat_fontname_as_pattern:Tr,Blur:Pr,Justify:$r}=p.getStyle(r);e.push({Name:t,FontName:n,FontSize:i,PrimaryColour:s,SecondaryColour:o,OutlineColour:f,BackColour:a,Bold:l,Italic:u,Underline:c,StrikeOut:d,ScaleX:v,ScaleY:y,Spacing:m,Angle:b,BorderStyle:C,Outline:U,Shadow:P,Alignment:be,MarginL:Z,MarginR:N,MarginV:ee,Encoding:Cr,treat_fontname_as_pattern:Tr,Blur:Pr,Justify:$r})}postMessage({target:"getStyles",time:Date.now(),styles:e})};self.setStyle=({style:e,index:r})=>{de(e,p.getStyle(r))};self.removeStyle=({index:e})=>{p.removeStyle(e)};onmessage=({data:e})=>{if(self[e.target])self[e.target](e);else throw new Error("Unknown event target "+e.target)};let Ue=null;le=(e=>r=>{e(r),Ue=new Uint8ClampedArray(K)})(le);function ir(e){throw e}var or=new TextDecoder("utf8");function Ur(e,r,t){for(var n=r+t,i=r;e[i]&&!(i>=n);)++i;return or.decode(e.buffer?e.subarray(r,i):new Uint8Array(e.slice(r,i)))}function ne(e,r){if(!e)return"";for(var t=e+r,n=e;!(n>=t)&&w[n];)++n;return or.decode(w.subarray(e,n))}function Dr(e,r,t,n){if(!(n>0))return 0;for(var i=t,s=t+n-1,o=0;o<e.length;++o){var f=e.charCodeAt(o);if(f>=55296&&f<=57343){var a=e.charCodeAt(++o);f=65536+((f&1023)<<10)|a&1023}if(f<=127){if(t>=s)break;r[t++]=f}else if(f<=2047){if(t+1>=s)break;r[t++]=192|f>>6,r[t++]=128|f&63}else if(f<=65535){if(t+2>=s)break;r[t++]=224|f>>12,r[t++]=128|f>>6&63,r[t++]=128|f&63}else{if(t+3>=s)break;r[t++]=240|f>>18,r[t++]=128|f>>12&63,r[t++]=128|f>>6&63,r[t++]=128|f&63}}return r[t]=0,t-i}function Mr(e,r,t){return Dr(e,w,r,t)}function Wr(e){for(var r=0,t=0;t<e.length;++t){var n=e.charCodeAt(t);n<=127?r++:n<=2047?r+=2:n>=55296&&n<=57343?(r+=4,++t):r+=3}return r}var De,X,W,w,ge,T,ar,sr,fe,K,fr;function le(e){K=e,De=new Int8Array(e),X=new Int16Array(e),W=new Int32Array(e),w=new Uint8Array(e),ge=new Uint16Array(e),T=new Uint32Array(e),ar=new Float32Array(e),sr=new Float64Array(e)}function Rr(e,r,t,n){ir("Assertion failed: "+ne(e)+", at: "+[r?ne(r):"unknown filename",t,n?ne(n):"unknown function"])}function jr(e,r,t){return 0}function Ir(e,r,t){}function Lr(e,r,t){return 0}function Br(e,r,t,n){}function Hr(e,r,t,n,i){}function Me(e){switch(e){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+e)}}function Vr(){for(var e=new Array(256),r=0;r<256;++r)e[r]=String.fromCharCode(r);lr=e}var lr=void 0;function _(e){for(var r="",t=e;w[t];)r+=lr[w[t++]];return r}var I={},L={},ue={},xr=48,zr=57;function We(e){if(e===void 0)return"_unknown";e=e.replace(/[^a-zA-Z0-9_]/g,"$");var r=e.charCodeAt(0);return r>=xr&&r<=zr?"_"+e:e}function Re(e,r){return e=We(e),new Function("body","return function "+e+`() {
1
+ var h=h,qe=e=>console.log(e),Ye=e=>console.error(e);function Ke(){}self.assert||(self.assert=(e,r)=>{if(!e)throw r});String.prototype.startsWith||(String.prototype.startsWith=function(e,r){return r===void 0&&(r=0),this.substring(r,e.length)===e});String.prototype.includes||(String.prototype.includes=function(e,r){return this.indexOf(e,r)!==-1});if(!ArrayBuffer.isView){const e=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];ArrayBuffer.isView=r=>r&&r.constructor&&e.indexOf(r.constructor)!==-1}Uint8Array.prototype.slice||(Uint8Array.prototype.slice=function(e,r){return new Uint8Array(this.subarray(e,r))});Date.now||(Date.now=()=>new Date().getTime());"performance"in self||(self.performance={now:()=>Date.now()});if(typeof console>"u"){const e=(r,t)=>{postMessage({target:"console",command:r,content:JSON.stringify(Array.prototype.slice.call(t))})};console={log:function(){e("log",arguments)},debug:function(){e("debug",arguments)},info:function(){e("info",arguments)},warn:function(){e("warn",arguments)},error:function(){e("error",arguments)}},console.log("Detected lack of console, overridden console")}const Se=(e,r)=>{const t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType=r?"arraybuffer":"text",t.send(null),t.response},Sr=(e,r,t)=>{const n=new XMLHttpRequest;n.open("GET",e,!0),n.responseType="arraybuffer",n.onload=()=>{if((n.status===200||n.status===0)&&n.response)return r(n.response);t()},n.onerror=t,n.send(null)};h={wasm:WebAssembly&&!WebAssembly.instantiateStreaming&&Se("jassub-worker.wasm",!0)};Ke=()=>postMessage({target:"ready"});qe=e=>{e==="JASSUB: No usable fontconfig configuration file found, using fallback."?console.debug(e):console.log(e)};Ye=e=>{e==="Fontconfig error: Cannot load default config file: No such file: (null)"?console.debug(e):console.error(e)};let J=0;const Fr=1;let E=null,He=!1,Fe=Date.now(),ie=24,Qe=!1,Ze="js",oe={};const Ve={};let Ar=0,Ne;self.width=0;self.height=0;let M=!1;self.addFont=({font:e})=>Ae(e);const Te=e=>{e=e.trim().toLowerCase(),e.startsWith("@")&&(e=e.substring(1)),!Ve[e]&&(Ve[e]=!0,oe[e]?Ae(oe[e]):Qe&&postMessage({target:"getLocalFont",font:e}))},Ae=e=>{ArrayBuffer.isView(e)?xe(e):Sr(e,r=>{xe(new Uint8Array(r))},console.error)},xe=e=>{const r=ve(e.byteLength);w.set(e,r),p.addFont("font-"+Ar++,r,e.byteLength),p.reloadFonts()},er=e=>{if(!oe)return;const r=Or(e);for(let i=0;i<r.length;i++)for(let s=0;s<r[i].body.length;s++)r[i].body[s].key==="Style"&&Te(r[i].body[s].value.Fontname);const t=/\\fn([^\\}]*?)[\\}]/g;let n;for(;(n=t.exec(e))!==null;)Te(n[1])};self.setTrack=({content:e})=>{er(e),p.createTrackMem(e),Oe=tr[p.trackColorSpace]};self.freeTrack=()=>{p.removeTrack()};self.setTrackByUrl=({url:e})=>{self.setTrack({content:Se(e)})};const kr=()=>{const e=(Date.now()-Fe)/1e3;return ae?J:(e>5&&(console.error("Didn't received currentTime > 5 seconds. Assuming video was paused."),rr(!0)),J+e*Fr)},Er=e=>{J=e,Fe=Date.now(),E||(He?E=Ee(se):(se(),setTimeout(()=>{He=!1},20)))};let ae=!0;const rr=e=>{e!==ae&&(ae=e,e?E&&(clearTimeout(E),E=null):(Fe=Date.now(),E=Ee(se)))},H="BT.601",ze="BT.709",Ge="SMPTE240M",tr=[H,H,H,H,H,ze,ze,Ge,Ge,"FCC","FCC"],ke=(e,r)=>{const t=performance.now(),n=Ze==="wasm"?p.renderBlend(e,r||0):p.renderImage(e,r||0),i={renderTime:performance.now()-t-p.time,decodeTime:p.time};if(p.changed!==0||r){const s=[];let o=[];const f=performance.now();if(!n)return _e({images:s,buffers:o,times:i,decodeStartTime:f});if(M){const a=[];for(let l=n,u=0;u<p.count;l=l.next,++u)s.push({w:l.w,h:l.h,x:l.x,y:l.y}),a.push(createImageBitmap(new ImageData(Ue.slice(l.image,l.image+l.w*l.h*4),l.w,l.h)));Promise.all(a).then(l=>{for(let u=0;u<s.length;u++)s[u].image=l[u];o=l,_e({images:s,buffers:o,times:i,decodeStartTime:f})})}else{for(let a=n,l=0;l<p.count;a=a.next,++l){const u={w:a.w,h:a.h,x:a.x,y:a.y,image:a.image};if(!j){const c=K.slice(a.image,a.image+a.w*a.h*4);o.push(c),u.image=c}s.push(u)}_e({images:s,buffers:o,times:i,decodeStartTime:f})}}else postMessage({target:"unbusy"})};self.demand=({time:e})=>{J=e,ke(e)};const se=e=>{E=0,ke(kr(),e),ae||(E=Ee(se))},_e=({times:e,images:r,decodeStartTime:t,buffers:n})=>{e.decodeTime=performance.now()-t;const i={target:"render",async:M,images:r,times:e,width:self.width,height:self.height,colorSpace:Oe};if(j){const s=performance.now();(D.height!==self.height||D.width!==self.width)&&(D.width=self.width,D.height=self.height),j.clearRect(0,0,self.width,self.height);for(const o of r)o.image&&(M?(j.drawImage(o.image,o.x,o.y),o.image.close()):(V.width=o.w,V.height=o.h,nr.putImageData(new ImageData(Ue.subarray(o.image,o.image+o.w*o.h*4),o.w,o.h),0,0),j.drawImage(V,o.x,o.y)));if(Ne){e.drawTime=performance.now()-s;let o=0;for(const f in e)o+=e[f];console.log("Bitmaps: "+r.length+" Total: "+Math.round(o)+"ms",e)}try{const o=D.transferToImageBitmap();i.images=[{image:o,x:0,y:0}],i.async=!0,postMessage(i,[o])}catch{postMessage({target:"unbusy"})}}else postMessage(i,n)},Or=e=>{let r,t,n,i,s,o,f,a,l,u;const c=[],d=e.split(/[\r\n]+/g);for(a=0;a<d.length;a++)if(r=d[a].match(/^\[(.*)\]$/),r)t=null,c.push({name:r[1],body:[]});else{if(/^\s*$/.test(d[a])||c.length===0)continue;if(u=c[c.length-1].body,d[a][0]===";")u.push({type:"comment",value:d[a].substring(1)});else{if(i=d[a].split(":"),s=i[0],o=i.slice(1).join(":").trim(),(t||s==="Format")&&(o=o.split(","),t&&o.length>t.length&&(n=o.slice(t.length-1).join(","),o=o.slice(0,t.length-1),o.push(n)),o=o.map(v=>v.trim()),t)){for(f={},l=0;l<o.length;l++)f[t[l]]=o[l];o=f}s==="Format"&&(t=o),u.push({key:s,value:o})}}return c},Ee=(()=>{let e=0;return r=>{const t=Date.now();if(e===0)e=t+1e3/ie;else for(;t+2>=e;)e+=1e3/ie;const n=Math.max(e-t,0);return setTimeout(r,n)}})(),de=(e,r)=>{for(const t of Object.keys(e))r[t]=e[t]};let D,j,V,nr,p,Oe;self.init=e=>{self.width=e.width,self.height=e.height,Ze=e.blendMode,M=e.asyncRender,M&&typeof createImageBitmap>"u"&&(M=!1,console.error("'createImageBitmap' needed for 'asyncRender' unsupported!")),oe=e.availableFonts,Ne=e.debug,ie=e.targetFps||ie,Qe=e.useLocalFonts;const r=e.fallbackFont.toLowerCase();p=new h.JASSUB(self.width,self.height,r||null),r&&Te(r);let t=e.subContent;t||(t=Se(e.subUrl)),er(t);for(const n of e.fonts||[])Ae(n);p.createTrackMem(t),Oe=tr[p.trackColorSpace],p.setDropAnimations(e.dropAllAnimations||0),(e.libassMemoryLimit>0||e.libassGlyphLimit>0)&&p.setMemoryLimits(e.libassGlyphLimit||0,e.libassMemoryLimit||0),e.offscreenRender&&(D=new OffscreenCanvas(self.height,self.width),j=D.getContext("2d",{desynchronized:!0}),M||(V=new OffscreenCanvas(self.height,self.width),nr=V.getContext("2d",{desynchronized:!0})))};self.canvas=({width:e,height:r,force:t})=>{if(e==null)throw new Error("Invalid canvas size specified");self.width=e,self.height=r,p.resizeCanvas(e,r),t&&ke(J)};self.video=({currentTime:e,isPaused:r,rate:t})=>{e!=null&&Er(e),r!=null&&rr(r),t=t||t};self.destroy=()=>{p.quitLibrary()};self.createEvent=({event:e})=>{de(e,p.getEvent(p.allocEvent()))};self.getEvents=()=>{const e=[];for(let r=0;r<p.getEventCount();r++){const{Start:t,Duration:n,ReadOrder:i,Layer:s,Style:o,MarginL:f,MarginR:a,MarginV:l,Name:u,Text:c,Effect:d}=p.getEvent(r);e.push({Start:t,Duration:n,ReadOrder:i,Layer:s,Style:o,MarginL:f,MarginR:a,MarginV:l,Name:u,Text:c,Effect:d})}postMessage({target:"getEvents",events:e})};self.setEvent=({event:e,index:r})=>{de(e,p.getEvent(r))};self.removeEvent=({index:e})=>{p.removeEvent(e)};self.createStyle=({style:e})=>{de(e,p.getStyle(p.allocStyle()))};self.getStyles=()=>{const e=[];for(let r=0;r<p.getStyleCount();r++){const{Name:t,FontName:n,FontSize:i,PrimaryColour:s,SecondaryColour:o,OutlineColour:f,BackColour:a,Bold:l,Italic:u,Underline:c,StrikeOut:d,ScaleX:v,ScaleY:y,Spacing:m,Angle:b,BorderStyle:C,Outline:U,Shadow:P,Alignment:be,MarginL:Z,MarginR:N,MarginV:ee,Encoding:Cr,treat_fontname_as_pattern:Tr,Blur:Pr,Justify:$r}=p.getStyle(r);e.push({Name:t,FontName:n,FontSize:i,PrimaryColour:s,SecondaryColour:o,OutlineColour:f,BackColour:a,Bold:l,Italic:u,Underline:c,StrikeOut:d,ScaleX:v,ScaleY:y,Spacing:m,Angle:b,BorderStyle:C,Outline:U,Shadow:P,Alignment:be,MarginL:Z,MarginR:N,MarginV:ee,Encoding:Cr,treat_fontname_as_pattern:Tr,Blur:Pr,Justify:$r})}postMessage({target:"getStyles",time:Date.now(),styles:e})};self.setStyle=({style:e,index:r})=>{de(e,p.getStyle(r))};self.removeStyle=({index:e})=>{p.removeStyle(e)};onmessage=({data:e})=>{if(self[e.target])self[e.target](e);else throw new Error("Unknown event target "+e.target)};let Ue=null;le=(e=>r=>{e(r),Ue=new Uint8ClampedArray(K)})(le);function ir(e){throw e}var or=new TextDecoder("utf8");function Ur(e,r,t){for(var n=r+t,i=r;e[i]&&!(i>=n);)++i;return or.decode(e.buffer?e.subarray(r,i):new Uint8Array(e.slice(r,i)))}function ne(e,r){if(!e)return"";for(var t=e+r,n=e;!(n>=t)&&w[n];)++n;return or.decode(w.subarray(e,n))}function Dr(e,r,t,n){if(!(n>0))return 0;for(var i=t,s=t+n-1,o=0;o<e.length;++o){var f=e.charCodeAt(o);if(f>=55296&&f<=57343){var a=e.charCodeAt(++o);f=65536+((f&1023)<<10)|a&1023}if(f<=127){if(t>=s)break;r[t++]=f}else if(f<=2047){if(t+1>=s)break;r[t++]=192|f>>6,r[t++]=128|f&63}else if(f<=65535){if(t+2>=s)break;r[t++]=224|f>>12,r[t++]=128|f>>6&63,r[t++]=128|f&63}else{if(t+3>=s)break;r[t++]=240|f>>18,r[t++]=128|f>>12&63,r[t++]=128|f>>6&63,r[t++]=128|f&63}}return r[t]=0,t-i}function Mr(e,r,t){return Dr(e,w,r,t)}function Wr(e){for(var r=0,t=0;t<e.length;++t){var n=e.charCodeAt(t);n<=127?r++:n<=2047?r+=2:n>=55296&&n<=57343?(r+=4,++t):r+=3}return r}var De,X,W,w,ge,T,ar,sr,fe,K,fr;function le(e){K=e,De=new Int8Array(e),X=new Int16Array(e),W=new Int32Array(e),w=new Uint8Array(e),ge=new Uint16Array(e),T=new Uint32Array(e),ar=new Float32Array(e),sr=new Float64Array(e)}function Rr(e,r,t,n){ir("Assertion failed: "+ne(e)+", at: "+[r?ne(r):"unknown filename",t,n?ne(n):"unknown function"])}function jr(e,r,t){return 0}function Ir(e,r,t){}function Lr(e,r,t){return 0}function Br(e,r,t,n){}function Hr(e,r,t,n,i){}function Me(e){switch(e){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+e)}}function Vr(){for(var e=new Array(256),r=0;r<256;++r)e[r]=String.fromCharCode(r);lr=e}var lr=void 0;function _(e){for(var r="",t=e;w[t];)r+=lr[w[t++]];return r}var I={},L={},ue={},xr=48,zr=57;function We(e){if(e===void 0)return"_unknown";e=e.replace(/[^a-zA-Z0-9_]/g,"$");var r=e.charCodeAt(0);return r>=xr&&r<=zr?"_"+e:e}function Re(e,r){return e=We(e),new Function("body","return function "+e+`() {
2
2
  "use strict"; return body.apply(this, arguments);
3
3
  };
4
4
  `)(r)}function je(e,r){var t=Re(r,function(n){this.name=r,this.message=n;var i=new Error(n).stack;i!==void 0&&(this.stack=this.toString()+`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jassub",
3
- "version": "1.6.1",
3
+ "version": "1.6.2",
4
4
  "description": "libass Subtitle Renderer and Parser library for browsers",
5
5
  "main": "src/jassub.js",
6
6
  "files": [