polotno-node 2.14.8 → 2.14.9

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.
@@ -511,7 +511,7 @@ T* `):V.join(` Tj
511
511
  endobj\r
512
512
  `},r.outline.count_r=function(n,i){for(var a=0;a<i.children.length;a++)n.count++,this.count_r(n,i.children[a]);return n.count}}])})(cr.API),(function(t){var e=[192,193,194,195,196,197,198,199];t.processJPEG=function(r,n,i,a,o,s){var l,c=this.decode.DCT_DECODE,f=null;if(typeof r=="string"||this.__addimage__.isArrayBuffer(r)||this.__addimage__.isArrayBufferView(r)){switch(r=o||r,r=this.__addimage__.isArrayBuffer(r)?new Uint8Array(r):r,l=(function(h){for(var d,p=256*h.charCodeAt(4)+h.charCodeAt(5),y=h.length,w={width:0,height:0,numcomponents:1},x=4;x<y;x+=2){if(x+=p,e.indexOf(h.charCodeAt(x+1))!==-1){d=256*h.charCodeAt(x+5)+h.charCodeAt(x+6),w={width:256*h.charCodeAt(x+7)+h.charCodeAt(x+8),height:d,numcomponents:h.charCodeAt(x+9)};break}p=256*h.charCodeAt(x+2)+h.charCodeAt(x+3)}return w})(r=this.__addimage__.isArrayBufferView(r)?this.__addimage__.arrayBufferToBinaryString(r):r),l.numcomponents){case 1:s=this.color_spaces.DEVICE_GRAY;break;case 4:s=this.color_spaces.DEVICE_CMYK;break;case 3:s=this.color_spaces.DEVICE_RGB}f={data:r,width:l.width,height:l.height,colorSpace:s,bitsPerComponent:8,filter:c,index:n,alias:i}}return f}})(cr.API),cr.API.processPNG=function(t,e,r,n){if(this.__addimage__.isArrayBuffer(t)&&(t=new Uint8Array(t)),this.__addimage__.isArrayBufferView(t)){var i,a=VU(t,{checkCrc:!0}),o=a.width,s=a.height,l=a.channels,c=a.palette,f=a.depth;i=c&&l===1?(function(O){for(var M=O.width,F=O.height,T=O.data,L=O.palette,H=O.depth,q=!1,ee=[],se=[],te=void 0,Z=!1,ne=0,Y=0;Y<L.length;Y++){var j=V8(L[Y],4),B=j[0],z=j[1],X=j[2],J=j[3];ee.push(B,z,X),J!=null&&(J===0?(ne++,se.length<1&&se.push(Y)):J<255&&(Z=!0))}if(Z||ne>1){q=!0,se=void 0;var K=M*F;te=new Uint8Array(K);for(var ie=new DataView(T.buffer),he=0;he<K;he++){var ue=Zy(ie,he,H),we=V8(L[ue],4)[3];te[he]=we}}else ne===0&&(se=void 0);return{colorSpace:"Indexed",colorsPerPixel:1,sMaskBitsPerComponent:q?8:void 0,colorBytes:T,alphaBytes:te,needSMask:q,palette:ee,mask:se}})(a):l===2||l===4?(function(O){for(var M=O.data,F=O.width,T=O.height,L=O.channels,H=O.depth,q=L===2?"DeviceGray":"DeviceRGB",ee=L-1,se=F*T,te=ee,Z=se*te,ne=1*se,Y=Math.ceil(Z*H/8),j=Math.ceil(ne*H/8),B=new Uint8Array(Y),z=new Uint8Array(j),X=new DataView(M.buffer),J=new DataView(B.buffer),K=new DataView(z.buffer),ie=!1,he=0;he<se;he++){for(var ue=he*L,we=0;we<te;we++)Yx(J,Zy(X,ue+we,H),he*te+we,H);var Te=Zy(X,ue+te,H);Te<(1<<H)-1&&(ie=!0),Yx(K,Te,1*he,H)}return{colorSpace:q,colorsPerPixel:ee,sMaskBitsPerComponent:ie?H:void 0,colorBytes:B,alphaBytes:z,needSMask:ie}})(a):(function(O){var M=O.data,F=O.channels===1?"DeviceGray":"DeviceRGB";return{colorSpace:F,colorsPerPixel:F==="DeviceGray"?1:3,colorBytes:M instanceof Uint16Array?(function(T){for(var L=T.length,H=new Uint8Array(2*L),q=new DataView(H.buffer,H.byteOffset,H.byteLength),ee=0;ee<L;ee++)q.setUint16(2*ee,T[ee],!1);return H})(M):M,needSMask:!1}})(a);var h,d,p,y=i,w=y.colorSpace,x=y.colorsPerPixel,b=y.sMaskBitsPerComponent,S=y.colorBytes,E=y.alphaBytes,_=y.needSMask,P=y.palette,N=y.mask,C=null;return n!==cr.API.image_compression.NONE&&typeof Y5=="function"?(C=(function(O){var M;switch(O){case cr.API.image_compression.FAST:M=11;break;case cr.API.image_compression.MEDIUM:M=13;break;case cr.API.image_compression.SLOW:M=14;break;default:M=12}return M})(n),h=this.decode.FLATE_DECODE,d="/Predictor ".concat(C," /Colors ").concat(x," /BitsPerComponent ").concat(f," /Columns ").concat(o),t=Vx(S,Math.ceil(o*x*f/8),x,f,n),_&&(p=Vx(E,Math.ceil(o*b/8),1,b,n))):(h=void 0,d=void 0,t=S,_&&(p=E)),(this.__addimage__.isArrayBuffer(t)||this.__addimage__.isArrayBufferView(t))&&(t=this.__addimage__.arrayBufferToBinaryString(t)),(p&&this.__addimage__.isArrayBuffer(p)||this.__addimage__.isArrayBufferView(p))&&(p=this.__addimage__.arrayBufferToBinaryString(p)),{alias:r,data:t,index:e,filter:h,decodeParameters:d,transparency:N,palette:P,sMask:p,predictor:C,width:o,height:s,bitsPerComponent:f,sMaskBitsPerComponent:b,colorSpace:w}}},(function(t){t.processGIF89A=function(e,r,n,i){var a=new fq(e),o=a.width,s=a.height,l=[];a.decodeAndBlitFrameRGBA(0,l);var c={data:l,width:o,height:s},f=new Qy(100).encode(c,100);return t.processJPEG.call(this,f,r,n,i)},t.processGIF87A=t.processGIF89A})(cr.API),wu.prototype.parseHeader=function(){if(this.fileSize=this.datav.getUint32(this.pos,!0),this.pos+=4,this.reserved=this.datav.getUint32(this.pos,!0),this.pos+=4,this.offset=this.datav.getUint32(this.pos,!0),this.pos+=4,this.headerSize=this.datav.getUint32(this.pos,!0),this.pos+=4,this.width=this.datav.getUint32(this.pos,!0),this.pos+=4,this.height=this.datav.getInt32(this.pos,!0),this.pos+=4,this.planes=this.datav.getUint16(this.pos,!0),this.pos+=2,this.bitPP=this.datav.getUint16(this.pos,!0),this.pos+=2,this.compress=this.datav.getUint32(this.pos,!0),this.pos+=4,this.rawSize=this.datav.getUint32(this.pos,!0),this.pos+=4,this.hr=this.datav.getUint32(this.pos,!0),this.pos+=4,this.vr=this.datav.getUint32(this.pos,!0),this.pos+=4,this.colors=this.datav.getUint32(this.pos,!0),this.pos+=4,this.importantColors=this.datav.getUint32(this.pos,!0),this.pos+=4,this.bitPP===16&&this.is_with_alpha&&(this.bitPP=15),this.bitPP<15){var t=this.colors===0?1<<this.bitPP:this.colors;this.palette=new Array(t);for(var e=0;e<t;e++){var r=this.datav.getUint8(this.pos++,!0),n=this.datav.getUint8(this.pos++,!0),i=this.datav.getUint8(this.pos++,!0),a=this.datav.getUint8(this.pos++,!0);this.palette[e]={red:i,green:n,blue:r,quad:a}}}this.height<0&&(this.height*=-1,this.bottom_up=!1)},wu.prototype.parseBGR=function(){this.pos=this.offset;try{var t="bit"+this.bitPP,e=this.width*this.height*4;this.data=new Uint8Array(e),this[t]()}catch(r){ai.log("bit decode error:"+r)}},wu.prototype.bit1=function(){var t,e=Math.ceil(this.width/8),r=e%4;for(t=this.height-1;t>=0;t--){for(var n=this.bottom_up?t:this.height-1-t,i=0;i<e;i++)for(var a=this.datav.getUint8(this.pos++,!0),o=n*this.width*4+8*i*4,s=0;s<8&&8*i+s<this.width;s++){var l=this.palette[a>>7-s&1];this.data[o+4*s]=l.blue,this.data[o+4*s+1]=l.green,this.data[o+4*s+2]=l.red,this.data[o+4*s+3]=255}r!==0&&(this.pos+=4-r)}},wu.prototype.bit4=function(){for(var t=Math.ceil(this.width/2),e=t%4,r=this.height-1;r>=0;r--){for(var n=this.bottom_up?r:this.height-1-r,i=0;i<t;i++){var a=this.datav.getUint8(this.pos++,!0),o=n*this.width*4+2*i*4,s=a>>4,l=15&a,c=this.palette[s];if(this.data[o]=c.blue,this.data[o+1]=c.green,this.data[o+2]=c.red,this.data[o+3]=255,2*i+1>=this.width)break;c=this.palette[l],this.data[o+4]=c.blue,this.data[o+4+1]=c.green,this.data[o+4+2]=c.red,this.data[o+4+3]=255}e!==0&&(this.pos+=4-e)}},wu.prototype.bit8=function(){for(var t=this.width%4,e=this.height-1;e>=0;e--){for(var r=this.bottom_up?e:this.height-1-e,n=0;n<this.width;n++){var i=this.datav.getUint8(this.pos++,!0),a=r*this.width*4+4*n;if(i<this.palette.length){var o=this.palette[i];this.data[a]=o.red,this.data[a+1]=o.green,this.data[a+2]=o.blue,this.data[a+3]=255}else this.data[a]=255,this.data[a+1]=255,this.data[a+2]=255,this.data[a+3]=255}t!==0&&(this.pos+=4-t)}},wu.prototype.bit15=function(){for(var t=this.width%3,e=parseInt("11111",2),r=this.height-1;r>=0;r--){for(var n=this.bottom_up?r:this.height-1-r,i=0;i<this.width;i++){var a=this.datav.getUint16(this.pos,!0);this.pos+=2;var o=(a&e)/e*255|0,s=(a>>5&e)/e*255|0,l=(a>>10&e)/e*255|0,c=a>>15?255:0,f=n*this.width*4+4*i;this.data[f]=l,this.data[f+1]=s,this.data[f+2]=o,this.data[f+3]=c}this.pos+=t}},wu.prototype.bit16=function(){for(var t=this.width%3,e=parseInt("11111",2),r=parseInt("111111",2),n=this.height-1;n>=0;n--){for(var i=this.bottom_up?n:this.height-1-n,a=0;a<this.width;a++){var o=this.datav.getUint16(this.pos,!0);this.pos+=2;var s=(o&e)/e*255|0,l=(o>>5&r)/r*255|0,c=(o>>11)/e*255|0,f=i*this.width*4+4*a;this.data[f]=c,this.data[f+1]=l,this.data[f+2]=s,this.data[f+3]=255}this.pos+=t}},wu.prototype.bit24=function(){for(var t=this.height-1;t>=0;t--){for(var e=this.bottom_up?t:this.height-1-t,r=0;r<this.width;r++){var n=this.datav.getUint8(this.pos++,!0),i=this.datav.getUint8(this.pos++,!0),a=this.datav.getUint8(this.pos++,!0),o=e*this.width*4+4*r;this.data[o]=a,this.data[o+1]=i,this.data[o+2]=n,this.data[o+3]=255}this.pos+=this.width%4}},wu.prototype.bit32=function(){for(var t=this.height-1;t>=0;t--)for(var e=this.bottom_up?t:this.height-1-t,r=0;r<this.width;r++){var n=this.datav.getUint8(this.pos++,!0),i=this.datav.getUint8(this.pos++,!0),a=this.datav.getUint8(this.pos++,!0),o=this.datav.getUint8(this.pos++,!0),s=e*this.width*4+4*r;this.data[s]=a,this.data[s+1]=i,this.data[s+2]=n,this.data[s+3]=o}},wu.prototype.getData=function(){return this.data},(function(t){t.processBMP=function(e,r,n,i){var a=new wu(e,!1),o=a.width,s=a.height,l={data:a.getData(),width:o,height:s},c=new Qy(100).encode(l,100);return t.processJPEG.call(this,c,r,n,i)}})(cr.API),Zx.prototype.getData=function(){return this.data},(function(t){t.processWEBP=function(e,r,n,i){var a=new Zx(e),o=a.width,s=a.height,l={data:a.getData(),width:o,height:s},c=new Qy(100).encode(l,100);return t.processJPEG.call(this,c,r,n,i)}})(cr.API),cr.API.processRGBA=function(t,e,r){for(var n=t.data,i=n.length,a=new Uint8Array(i/4*3),o=new Uint8Array(i/4),s=0,l=0,c=0;c<i;c+=4){var f=n[c],h=n[c+1],d=n[c+2],p=n[c+3];a[s++]=f,a[s++]=h,a[s++]=d,o[l++]=p}var y=this.__addimage__.arrayBufferToBinaryString(a);return{alpha:this.__addimage__.arrayBufferToBinaryString(o),data:y,index:e,alias:r,colorSpace:"DeviceRGB",bitsPerComponent:8,width:t.width,height:t.height}},cr.API.setLanguage=function(t){return this.internal.languageSettings===void 0&&(this.internal.languageSettings={},this.internal.languageSettings.isSubscribed=!1),{af:"Afrikaans",sq:"Albanian",ar:"Arabic (Standard)","ar-DZ":"Arabic (Algeria)","ar-BH":"Arabic (Bahrain)","ar-EG":"Arabic (Egypt)","ar-IQ":"Arabic (Iraq)","ar-JO":"Arabic (Jordan)","ar-KW":"Arabic (Kuwait)","ar-LB":"Arabic (Lebanon)","ar-LY":"Arabic (Libya)","ar-MA":"Arabic (Morocco)","ar-OM":"Arabic (Oman)","ar-QA":"Arabic (Qatar)","ar-SA":"Arabic (Saudi Arabia)","ar-SY":"Arabic (Syria)","ar-TN":"Arabic (Tunisia)","ar-AE":"Arabic (U.A.E.)","ar-YE":"Arabic (Yemen)",an:"Aragonese",hy:"Armenian",as:"Assamese",ast:"Asturian",az:"Azerbaijani",eu:"Basque",be:"Belarusian",bn:"Bengali",bs:"Bosnian",br:"Breton",bg:"Bulgarian",my:"Burmese",ca:"Catalan",ch:"Chamorro",ce:"Chechen",zh:"Chinese","zh-HK":"Chinese (Hong Kong)","zh-CN":"Chinese (PRC)","zh-SG":"Chinese (Singapore)","zh-TW":"Chinese (Taiwan)",cv:"Chuvash",co:"Corsican",cr:"Cree",hr:"Croatian",cs:"Czech",da:"Danish",nl:"Dutch (Standard)","nl-BE":"Dutch (Belgian)",en:"English","en-AU":"English (Australia)","en-BZ":"English (Belize)","en-CA":"English (Canada)","en-IE":"English (Ireland)","en-JM":"English (Jamaica)","en-NZ":"English (New Zealand)","en-PH":"English (Philippines)","en-ZA":"English (South Africa)","en-TT":"English (Trinidad & Tobago)","en-GB":"English (United Kingdom)","en-US":"English (United States)","en-ZW":"English (Zimbabwe)",eo:"Esperanto",et:"Estonian",fo:"Faeroese",fj:"Fijian",fi:"Finnish",fr:"French (Standard)","fr-BE":"French (Belgium)","fr-CA":"French (Canada)","fr-FR":"French (France)","fr-LU":"French (Luxembourg)","fr-MC":"French (Monaco)","fr-CH":"French (Switzerland)",fy:"Frisian",fur:"Friulian",gd:"Gaelic (Scots)","gd-IE":"Gaelic (Irish)",gl:"Galacian",ka:"Georgian",de:"German (Standard)","de-AT":"German (Austria)","de-DE":"German (Germany)","de-LI":"German (Liechtenstein)","de-LU":"German (Luxembourg)","de-CH":"German (Switzerland)",el:"Greek",gu:"Gujurati",ht:"Haitian",he:"Hebrew",hi:"Hindi",hu:"Hungarian",is:"Icelandic",id:"Indonesian",iu:"Inuktitut",ga:"Irish",it:"Italian (Standard)","it-CH":"Italian (Switzerland)",ja:"Japanese",kn:"Kannada",ks:"Kashmiri",kk:"Kazakh",km:"Khmer",ky:"Kirghiz",tlh:"Klingon",ko:"Korean","ko-KP":"Korean (North Korea)","ko-KR":"Korean (South Korea)",la:"Latin",lv:"Latvian",lt:"Lithuanian",lb:"Luxembourgish",mk:"North Macedonia",ms:"Malay",ml:"Malayalam",mt:"Maltese",mi:"Maori",mr:"Marathi",mo:"Moldavian",nv:"Navajo",ng:"Ndonga",ne:"Nepali",no:"Norwegian",nb:"Norwegian (Bokmal)",nn:"Norwegian (Nynorsk)",oc:"Occitan",or:"Oriya",om:"Oromo",fa:"Persian","fa-IR":"Persian/Iran",pl:"Polish",pt:"Portuguese","pt-BR":"Portuguese (Brazil)",pa:"Punjabi","pa-IN":"Punjabi (India)","pa-PK":"Punjabi (Pakistan)",qu:"Quechua",rm:"Rhaeto-Romanic",ro:"Romanian","ro-MO":"Romanian (Moldavia)",ru:"Russian","ru-MO":"Russian (Moldavia)",sz:"Sami (Lappish)",sg:"Sango",sa:"Sanskrit",sc:"Sardinian",sd:"Sindhi",si:"Singhalese",sr:"Serbian",sk:"Slovak",sl:"Slovenian",so:"Somani",sb:"Sorbian",es:"Spanish","es-AR":"Spanish (Argentina)","es-BO":"Spanish (Bolivia)","es-CL":"Spanish (Chile)","es-CO":"Spanish (Colombia)","es-CR":"Spanish (Costa Rica)","es-DO":"Spanish (Dominican Republic)","es-EC":"Spanish (Ecuador)","es-SV":"Spanish (El Salvador)","es-GT":"Spanish (Guatemala)","es-HN":"Spanish (Honduras)","es-MX":"Spanish (Mexico)","es-NI":"Spanish (Nicaragua)","es-PA":"Spanish (Panama)","es-PY":"Spanish (Paraguay)","es-PE":"Spanish (Peru)","es-PR":"Spanish (Puerto Rico)","es-ES":"Spanish (Spain)","es-UY":"Spanish (Uruguay)","es-VE":"Spanish (Venezuela)",sx:"Sutu",sw:"Swahili",sv:"Swedish","sv-FI":"Swedish (Finland)","sv-SV":"Swedish (Sweden)",ta:"Tamil",tt:"Tatar",te:"Teluga",th:"Thai",tig:"Tigre",ts:"Tsonga",tn:"Tswana",tr:"Turkish",tk:"Turkmen",uk:"Ukrainian",hsb:"Upper Sorbian",ur:"Urdu",ve:"Venda",vi:"Vietnamese",vo:"Volapuk",wa:"Walloon",cy:"Welsh",xh:"Xhosa",ji:"Yiddish",zu:"Zulu"}[t]!==void 0&&(this.internal.languageSettings.languageCode=t,this.internal.languageSettings.isSubscribed===!1&&(this.internal.events.subscribe("putCatalog",function(){this.internal.write("/Lang ("+this.internal.languageSettings.languageCode+")")}),this.internal.languageSettings.isSubscribed=!0)),this},Zd=cr.API,Pg=Zd.getCharWidthsArray=function(t,e){var r,n,i=(e=e||{}).font||this.internal.getFont(),a=e.fontSize||this.internal.getFontSize(),o=e.charSpace||this.internal.getCharSpace(),s=e.widths?e.widths:i.metadata.Unicode.widths,l=s.fof?s.fof:1,c=e.kerning?e.kerning:i.metadata.Unicode.kerning,f=c.fof?c.fof:1,h=e.doKerning!==!1,d=0,p=t.length,y=0,w=s[0]||l,x=[];for(r=0;r<p;r++)n=t.charCodeAt(r),typeof i.metadata.widthOfString=="function"?x.push((i.metadata.widthOfGlyph(i.metadata.characterToGlyph(n))+o*(1e3/a)||0)/1e3):(d=h&&Hn(c[n])==="object"&&!isNaN(parseInt(c[n][y],10))?c[n][y]/f:0,x.push((s[n]||w)/l+d)),y=n;return x},Ux=Zd.getStringUnitWidth=function(t,e){var r=(e=e||{}).fontSize||this.internal.getFontSize(),n=e.font||this.internal.getFont(),i=e.charSpace||this.internal.getCharSpace();return Zd.processArabic&&(t=Zd.processArabic(t)),typeof n.metadata.widthOfString=="function"?n.metadata.widthOfString(t,r,i)/r:Pg.apply(this,arguments).reduce(function(a,o){return a+o},0)},qx=function(t,e,r,n){for(var i=[],a=0,o=t.length,s=0;a!==o&&s+e[a]<r;)s+=e[a],a++;i.push(t.slice(0,a));var l=a;for(s=0;a!==o;)s+e[a]>n&&(i.push(t.slice(l,a)),s=0,l=a),s+=e[a],a++;return l!==a&&i.push(t.slice(l,a)),i},Hx=function(t,e,r){r||(r={});var n,i,a,o,s,l,c,f=[],h=[f],d=r.textIndent||0,p=0,y=0,w=t.split(" "),x=Pg.apply(this,[" ",r])[0];if(l=r.lineIndent===-1?w[0].length+2:r.lineIndent||0){var b=Array(l).join(" "),S=[];w.map(function(_){(_=_.split(/\s*\n/)).length>1?S=S.concat(_.map(function(P,N){return(N&&P.length?`
513
513
  `:"")+P})):S.push(_[0])}),w=S,l=Ux.apply(this,[b,r])}for(a=0,o=w.length;a<o;a++){var E=0;if(n=w[a],l&&n[0]==`
514
- `&&(n=n.substr(1),E=1),d+p+(y=(i=Pg.apply(this,[n,r])).reduce(function(_,P){return _+P},0))>e||E){if(y>e){for(s=qx.apply(this,[n,i,e-(d+p),e]),f.push(s.shift()),f=[s.pop()];s.length;)h.push([s.shift()]);y=i.slice(n.length-(f[0]?f[0].length:0)).reduce(function(_,P){return _+P},0)}else f=[n];h.push(f),d=y+l,p=x}else f.push(n),d+=p+y,p=x}return c=l?function(_,P){return(P?b:"")+_.join(" ")}:function(_){return _.join(" ")},h.map(c)},Zd.splitTextToSize=function(t,e,r){var n,i=(r=r||{}).fontSize||this.internal.getFontSize(),a=(function(f){if(f.widths&&f.kerning)return{widths:f.widths,kerning:f.kerning};var h=this.internal.getFont(f.fontName,f.fontStyle),d="Unicode";return h.metadata[d]?{widths:h.metadata[d].widths||{0:1},kerning:h.metadata[d].kerning||{}}:{font:h.metadata,fontSize:this.internal.getFontSize(),charSpace:this.internal.getCharSpace()}}).call(this,r);n=Array.isArray(t)?t:String(t).split(/\r?\n/);var o=1*this.internal.scaleFactor*e/i;a.textIndent=r.textIndent?1*r.textIndent*this.internal.scaleFactor/i:0,a.lineIndent=r.lineIndent;var s,l,c=[];for(s=0,l=n.length;s<l;s++)c=c.concat(Hx.apply(this,[n[s],o,a]));return c},(function(t){t.__fontmetrics__=t.__fontmetrics__||{};for(var e="0123456789abcdef",r="klmnopqrstuvwxyz",n={},i={},a=0;a<16;a++)n[r[a]]=e[a],i[e[a]]=r[a];var o=function(d){return"0x"+parseInt(d,10).toString(16)},s=t.__fontmetrics__.compress=function(d){var p,y,w,x,b=["{"];for(var S in d){if(p=d[S],isNaN(parseInt(S,10))?y="'"+S+"'":(S=parseInt(S,10),y=(y=o(S).slice(2)).slice(0,-1)+i[y.slice(-1)]),typeof p=="number")p<0?(w=o(p).slice(3),x="-"):(w=o(p).slice(2),x=""),w=x+w.slice(0,-1)+i[w.slice(-1)];else{if(Hn(p)!=="object")throw new Error("Don't know what to do with value type "+Hn(p)+".");w=s(p)}b.push(y+w)}return b.push("}"),b.join("")},l=t.__fontmetrics__.uncompress=function(d){if(typeof d!="string")throw new Error("Invalid argument passed to uncompress.");for(var p,y,w,x,b={},S=1,E=b,_=[],P="",N="",C=d.length-1,O=1;O<C;O+=1)(x=d[O])=="'"?p?(w=p.join(""),p=void 0):p=[]:p?p.push(x):x=="{"?(_.push([E,w]),E={},w=void 0):x=="}"?((y=_.pop())[0][y[1]]=E,w=void 0,E=y[0]):x=="-"?S=-1:w===void 0?n.hasOwnProperty(x)?(P+=n[x],w=parseInt(P,16)*S,S=1,P=""):P+=x:n.hasOwnProperty(x)?(N+=n[x],E[w]=parseInt(N,16)*S,S=1,w=void 0,N=""):N+=x;return b},c={codePages:["WinAnsiEncoding"],WinAnsiEncoding:l("{19m8n201n9q201o9r201s9l201t9m201u8m201w9n201x9o201y8o202k8q202l8r202m9p202q8p20aw8k203k8t203t8v203u9v2cq8s212m9t15m8w15n9w2dw9s16k8u16l9u17s9z17x8y17y9y}")},f={Unicode:{Courier:c,"Courier-Bold":c,"Courier-BoldOblique":c,"Courier-Oblique":c,Helvetica:c,"Helvetica-Bold":c,"Helvetica-BoldOblique":c,"Helvetica-Oblique":c,"Times-Roman":c,"Times-Bold":c,"Times-BoldItalic":c,"Times-Italic":c}},h={Unicode:{"Courier-Oblique":l("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),"Times-BoldItalic":l("{'widths'{k3o2q4ycx2r201n3m201o6o201s2l201t2l201u2l201w3m201x3m201y3m2k1t2l2r202m2n2n3m2o3m2p5n202q6o2r1w2s2l2t2l2u3m2v3t2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v2l3w3t3x3t3y3t3z3m4k5n4l4m4m4m4n4m4o4s4p4m4q4m4r4s4s4y4t2r4u3m4v4m4w3x4x5t4y4s4z4s5k3x5l4s5m4m5n3r5o3x5p4s5q4m5r5t5s4m5t3x5u3x5v2l5w1w5x2l5y3t5z3m6k2l6l3m6m3m6n2w6o3m6p2w6q2l6r3m6s3r6t1w6u1w6v3m6w1w6x4y6y3r6z3m7k3m7l3m7m2r7n2r7o1w7p3r7q2w7r4m7s3m7t2w7u2r7v2n7w1q7x2n7y3t202l3mcl4mal2ram3man3mao3map3mar3mas2lat4uau1uav3maw3way4uaz2lbk2sbl3t'fof'6obo2lbp3tbq3mbr1tbs2lbu1ybv3mbz3mck4m202k3mcm4mcn4mco4mcp4mcq5ycr4mcs4mct4mcu4mcv4mcw2r2m3rcy2rcz2rdl4sdm4sdn4sdo4sdp4sdq4sds4sdt4sdu4sdv4sdw4sdz3mek3mel3mem3men3meo3mep3meq4ser2wes2wet2weu2wev2wew1wex1wey1wez1wfl3rfm3mfn3mfo3mfp3mfq3mfr3tfs3mft3rfu3rfv3rfw3rfz2w203k6o212m6o2dw2l2cq2l3t3m3u2l17s3x19m3m}'kerning'{cl{4qu5kt5qt5rs17ss5ts}201s{201ss}201t{cks4lscmscnscoscpscls2wu2yu201ts}201x{2wu2yu}2k{201ts}2w{4qx5kx5ou5qx5rs17su5tu}2x{17su5tu5ou}2y{4qx5kx5ou5qx5rs17ss5ts}'fof'-6ofn{17sw5tw5ou5qw5rs}7t{cksclscmscnscoscps4ls}3u{17su5tu5os5qs}3v{17su5tu5os5qs}7p{17su5tu}ck{4qu5kt5qt5rs17ss5ts}4l{4qu5kt5qt5rs17ss5ts}cm{4qu5kt5qt5rs17ss5ts}cn{4qu5kt5qt5rs17ss5ts}co{4qu5kt5qt5rs17ss5ts}cp{4qu5kt5qt5rs17ss5ts}6l{4qu5ou5qw5rt17su5tu}5q{ckuclucmucnucoucpu4lu}5r{ckuclucmucnucoucpu4lu}7q{cksclscmscnscoscps4ls}6p{4qu5ou5qw5rt17sw5tw}ek{4qu5ou5qw5rt17su5tu}el{4qu5ou5qw5rt17su5tu}em{4qu5ou5qw5rt17su5tu}en{4qu5ou5qw5rt17su5tu}eo{4qu5ou5qw5rt17su5tu}ep{4qu5ou5qw5rt17su5tu}es{17ss5ts5qs4qu}et{4qu5ou5qw5rt17sw5tw}eu{4qu5ou5qw5rt17ss5ts}ev{17ss5ts5qs4qu}6z{17sw5tw5ou5qw5rs}fm{17sw5tw5ou5qw5rs}7n{201ts}fo{17sw5tw5ou5qw5rs}fp{17sw5tw5ou5qw5rs}fq{17sw5tw5ou5qw5rs}7r{cksclscmscnscoscps4ls}fs{17sw5tw5ou5qw5rs}ft{17su5tu}fu{17su5tu}fv{17su5tu}fw{17su5tu}fz{cksclscmscnscoscps4ls}}}"),"Helvetica-Bold":l("{'widths'{k3s2q4scx1w201n3r201o6o201s1w201t1w201u1w201w3m201x3m201y3m2k1w2l2l202m2n2n3r2o3r2p5t202q6o2r1s2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v2l3w3u3x3u3y3u3z3x4k6l4l4s4m4s4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3r4v4s4w3x4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v2l5w1w5x2l5y3u5z3r6k2l6l3r6m3x6n3r6o3x6p3r6q2l6r3x6s3x6t1w6u1w6v3r6w1w6x5t6y3x6z3x7k3x7l3x7m2r7n3r7o2l7p3x7q3r7r4y7s3r7t3r7u3m7v2r7w1w7x2r7y3u202l3rcl4sal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3xbq3rbr1wbs2lbu2obv3rbz3xck4s202k3rcm4scn4sco4scp4scq6ocr4scs4mct4mcu4mcv4mcw1w2m2zcy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3res3ret3reu3rev3rew1wex1wey1wez1wfl3xfm3xfn3xfo3xfp3xfq3xfr3ufs3xft3xfu3xfv3xfw3xfz3r203k6o212m6o2dw2l2cq2l3t3r3u2l17s4m19m3r}'kerning'{cl{4qs5ku5ot5qs17sv5tv}201t{2ww4wy2yw}201w{2ks}201x{2ww4wy2yw}2k{201ts201xs}2w{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}2x{5ow5qs}2y{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}'fof'-6o7p{17su5tu5ot}ck{4qs5ku5ot5qs17sv5tv}4l{4qs5ku5ot5qs17sv5tv}cm{4qs5ku5ot5qs17sv5tv}cn{4qs5ku5ot5qs17sv5tv}co{4qs5ku5ot5qs17sv5tv}cp{4qs5ku5ot5qs17sv5tv}6l{17st5tt5os}17s{2kwclvcmvcnvcovcpv4lv4wwckv}5o{2kucltcmtcntcotcpt4lt4wtckt}5q{2ksclscmscnscoscps4ls4wvcks}5r{2ks4ws}5t{2kwclvcmvcnvcovcpv4lv4wwckv}eo{17st5tt5os}fu{17su5tu5ot}6p{17ss5ts}ek{17st5tt5os}el{17st5tt5os}em{17st5tt5os}en{17st5tt5os}6o{201ts}ep{17st5tt5os}es{17ss5ts}et{17ss5ts}eu{17ss5ts}ev{17ss5ts}6z{17su5tu5os5qt}fm{17su5tu5os5qt}fn{17su5tu5os5qt}fo{17su5tu5os5qt}fp{17su5tu5os5qt}fq{17su5tu5os5qt}fs{17su5tu5os5qt}ft{17su5tu5ot}7m{5os}fv{17su5tu5ot}fw{17su5tu5ot}}}"),Courier:l("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),"Courier-BoldOblique":l("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),"Times-Bold":l("{'widths'{k3q2q5ncx2r201n3m201o6o201s2l201t2l201u2l201w3m201x3m201y3m2k1t2l2l202m2n2n3m2o3m2p6o202q6o2r1w2s2l2t2l2u3m2v3t2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v2l3w3t3x3t3y3t3z3m4k5x4l4s4m4m4n4s4o4s4p4m4q3x4r4y4s4y4t2r4u3m4v4y4w4m4x5y4y4s4z4y5k3x5l4y5m4s5n3r5o4m5p4s5q4s5r6o5s4s5t4s5u4m5v2l5w1w5x2l5y3u5z3m6k2l6l3m6m3r6n2w6o3r6p2w6q2l6r3m6s3r6t1w6u2l6v3r6w1w6x5n6y3r6z3m7k3r7l3r7m2w7n2r7o2l7p3r7q3m7r4s7s3m7t3m7u2w7v2r7w1q7x2r7y3o202l3mcl4sal2lam3man3mao3map3mar3mas2lat4uau1yav3maw3tay4uaz2lbk2sbl3t'fof'6obo2lbp3rbr1tbs2lbu2lbv3mbz3mck4s202k3mcm4scn4sco4scp4scq6ocr4scs4mct4mcu4mcv4mcw2r2m3rcy2rcz2rdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3rek3mel3mem3men3meo3mep3meq4ser2wes2wet2weu2wev2wew1wex1wey1wez1wfl3rfm3mfn3mfo3mfp3mfq3mfr3tfs3mft3rfu3rfv3rfw3rfz3m203k6o212m6o2dw2l2cq2l3t3m3u2l17s4s19m3m}'kerning'{cl{4qt5ks5ot5qy5rw17sv5tv}201t{cks4lscmscnscoscpscls4wv}2k{201ts}2w{4qu5ku7mu5os5qx5ru17su5tu}2x{17su5tu5ou5qs}2y{4qv5kv7mu5ot5qz5ru17su5tu}'fof'-6o7t{cksclscmscnscoscps4ls}3u{17su5tu5os5qu}3v{17su5tu5os5qu}fu{17su5tu5ou5qu}7p{17su5tu5ou5qu}ck{4qt5ks5ot5qy5rw17sv5tv}4l{4qt5ks5ot5qy5rw17sv5tv}cm{4qt5ks5ot5qy5rw17sv5tv}cn{4qt5ks5ot5qy5rw17sv5tv}co{4qt5ks5ot5qy5rw17sv5tv}cp{4qt5ks5ot5qy5rw17sv5tv}6l{17st5tt5ou5qu}17s{ckuclucmucnucoucpu4lu4wu}5o{ckuclucmucnucoucpu4lu4wu}5q{ckzclzcmzcnzcozcpz4lz4wu}5r{ckxclxcmxcnxcoxcpx4lx4wu}5t{ckuclucmucnucoucpu4lu4wu}7q{ckuclucmucnucoucpu4lu}6p{17sw5tw5ou5qu}ek{17st5tt5qu}el{17st5tt5ou5qu}em{17st5tt5qu}en{17st5tt5qu}eo{17st5tt5qu}ep{17st5tt5ou5qu}es{17ss5ts5qu}et{17sw5tw5ou5qu}eu{17sw5tw5ou5qu}ev{17ss5ts5qu}6z{17sw5tw5ou5qu5rs}fm{17sw5tw5ou5qu5rs}fn{17sw5tw5ou5qu5rs}fo{17sw5tw5ou5qu5rs}fp{17sw5tw5ou5qu5rs}fq{17sw5tw5ou5qu5rs}7r{cktcltcmtcntcotcpt4lt5os}fs{17sw5tw5ou5qu5rs}ft{17su5tu5ou5qu}7m{5os}fv{17su5tu5ou5qu}fw{17su5tu5ou5qu}fz{cksclscmscnscoscps4ls}}}"),Symbol:l("{'widths'{k3uaw4r19m3m2k1t2l2l202m2y2n3m2p5n202q6o3k3m2s2l2t2l2v3r2w1t3m3m2y1t2z1wbk2sbl3r'fof'6o3n3m3o3m3p3m3q3m3r3m3s3m3t3m3u1w3v1w3w3r3x3r3y3r3z2wbp3t3l3m5v2l5x2l5z3m2q4yfr3r7v3k7w1o7x3k}'kerning'{'fof'-6o}}"),Helvetica:l("{'widths'{k3p2q4mcx1w201n3r201o6o201s1q201t1q201u1q201w2l201x2l201y2l2k1w2l1w202m2n2n3r2o3r2p5t202q6o2r1n2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v1w3w3u3x3u3y3u3z3r4k6p4l4m4m4m4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3m4v4m4w3r4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v1w5w1w5x1w5y2z5z3r6k2l6l3r6m3r6n3m6o3r6p3r6q1w6r3r6s3r6t1q6u1q6v3m6w1q6x5n6y3r6z3r7k3r7l3r7m2l7n3m7o1w7p3r7q3m7r4s7s3m7t3m7u3m7v2l7w1u7x2l7y3u202l3rcl4mal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3rbr1wbs2lbu2obv3rbz3xck4m202k3rcm4mcn4mco4mcp4mcq6ocr4scs4mct4mcu4mcv4mcw1w2m2ncy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3mes3ret3reu3rev3rew1wex1wey1wez1wfl3rfm3rfn3rfo3rfp3rfq3rfr3ufs3xft3rfu3rfv3rfw3rfz3m203k6o212m6o2dw2l2cq2l3t3r3u1w17s4m19m3r}'kerning'{5q{4wv}cl{4qs5kw5ow5qs17sv5tv}201t{2wu4w1k2yu}201x{2wu4wy2yu}17s{2ktclucmucnu4otcpu4lu4wycoucku}2w{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}2x{17sy5ty5oy5qs}2y{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}'fof'-6o7p{17sv5tv5ow}ck{4qs5kw5ow5qs17sv5tv}4l{4qs5kw5ow5qs17sv5tv}cm{4qs5kw5ow5qs17sv5tv}cn{4qs5kw5ow5qs17sv5tv}co{4qs5kw5ow5qs17sv5tv}cp{4qs5kw5ow5qs17sv5tv}6l{17sy5ty5ow}do{17st5tt}4z{17st5tt}7s{fst}dm{17st5tt}dn{17st5tt}5o{ckwclwcmwcnwcowcpw4lw4wv}dp{17st5tt}dq{17st5tt}7t{5ow}ds{17st5tt}5t{2ktclucmucnu4otcpu4lu4wycoucku}fu{17sv5tv5ow}6p{17sy5ty5ow5qs}ek{17sy5ty5ow}el{17sy5ty5ow}em{17sy5ty5ow}en{5ty}eo{17sy5ty5ow}ep{17sy5ty5ow}es{17sy5ty5qs}et{17sy5ty5ow5qs}eu{17sy5ty5ow5qs}ev{17sy5ty5ow5qs}6z{17sy5ty5ow5qs}fm{17sy5ty5ow5qs}fn{17sy5ty5ow5qs}fo{17sy5ty5ow5qs}fp{17sy5ty5qs}fq{17sy5ty5ow5qs}7r{5ow}fs{17sy5ty5ow5qs}ft{17sv5tv5ow}7m{5ow}fv{17sv5tv5ow}fw{17sv5tv5ow}}}"),"Helvetica-BoldOblique":l("{'widths'{k3s2q4scx1w201n3r201o6o201s1w201t1w201u1w201w3m201x3m201y3m2k1w2l2l202m2n2n3r2o3r2p5t202q6o2r1s2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v2l3w3u3x3u3y3u3z3x4k6l4l4s4m4s4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3r4v4s4w3x4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v2l5w1w5x2l5y3u5z3r6k2l6l3r6m3x6n3r6o3x6p3r6q2l6r3x6s3x6t1w6u1w6v3r6w1w6x5t6y3x6z3x7k3x7l3x7m2r7n3r7o2l7p3x7q3r7r4y7s3r7t3r7u3m7v2r7w1w7x2r7y3u202l3rcl4sal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3xbq3rbr1wbs2lbu2obv3rbz3xck4s202k3rcm4scn4sco4scp4scq6ocr4scs4mct4mcu4mcv4mcw1w2m2zcy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3res3ret3reu3rev3rew1wex1wey1wez1wfl3xfm3xfn3xfo3xfp3xfq3xfr3ufs3xft3xfu3xfv3xfw3xfz3r203k6o212m6o2dw2l2cq2l3t3r3u2l17s4m19m3r}'kerning'{cl{4qs5ku5ot5qs17sv5tv}201t{2ww4wy2yw}201w{2ks}201x{2ww4wy2yw}2k{201ts201xs}2w{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}2x{5ow5qs}2y{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}'fof'-6o7p{17su5tu5ot}ck{4qs5ku5ot5qs17sv5tv}4l{4qs5ku5ot5qs17sv5tv}cm{4qs5ku5ot5qs17sv5tv}cn{4qs5ku5ot5qs17sv5tv}co{4qs5ku5ot5qs17sv5tv}cp{4qs5ku5ot5qs17sv5tv}6l{17st5tt5os}17s{2kwclvcmvcnvcovcpv4lv4wwckv}5o{2kucltcmtcntcotcpt4lt4wtckt}5q{2ksclscmscnscoscps4ls4wvcks}5r{2ks4ws}5t{2kwclvcmvcnvcovcpv4lv4wwckv}eo{17st5tt5os}fu{17su5tu5ot}6p{17ss5ts}ek{17st5tt5os}el{17st5tt5os}em{17st5tt5os}en{17st5tt5os}6o{201ts}ep{17st5tt5os}es{17ss5ts}et{17ss5ts}eu{17ss5ts}ev{17ss5ts}6z{17su5tu5os5qt}fm{17su5tu5os5qt}fn{17su5tu5os5qt}fo{17su5tu5os5qt}fp{17su5tu5os5qt}fq{17su5tu5os5qt}fs{17su5tu5os5qt}ft{17su5tu5ot}7m{5os}fv{17su5tu5ot}fw{17su5tu5ot}}}"),ZapfDingbats:l("{'widths'{k4u2k1w'fof'6o}'kerning'{'fof'-6o}}"),"Courier-Bold":l("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),"Times-Italic":l("{'widths'{k3n2q4ycx2l201n3m201o5t201s2l201t2l201u2l201w3r201x3r201y3r2k1t2l2l202m2n2n3m2o3m2p5n202q5t2r1p2s2l2t2l2u3m2v4n2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v2l3w4n3x4n3y4n3z3m4k5w4l3x4m3x4n4m4o4s4p3x4q3x4r4s4s4s4t2l4u2w4v4m4w3r4x5n4y4m4z4s5k3x5l4s5m3x5n3m5o3r5p4s5q3x5r5n5s3x5t3r5u3r5v2r5w1w5x2r5y2u5z3m6k2l6l3m6m3m6n2w6o3m6p2w6q1w6r3m6s3m6t1w6u1w6v2w6w1w6x4s6y3m6z3m7k3m7l3m7m2r7n2r7o1w7p3m7q2w7r4m7s2w7t2w7u2r7v2s7w1v7x2s7y3q202l3mcl3xal2ram3man3mao3map3mar3mas2lat4wau1vav3maw4nay4waz2lbk2sbl4n'fof'6obo2lbp3mbq3obr1tbs2lbu1zbv3mbz3mck3x202k3mcm3xcn3xco3xcp3xcq5tcr4mcs3xct3xcu3xcv3xcw2l2m2ucy2lcz2ldl4mdm4sdn4sdo4sdp4sdq4sds4sdt4sdu4sdv4sdw4sdz3mek3mel3mem3men3meo3mep3meq4mer2wes2wet2weu2wev2wew1wex1wey1wez1wfl3mfm3mfn3mfo3mfp3mfq3mfr4nfs3mft3mfu3mfv3mfw3mfz2w203k6o212m6m2dw2l2cq2l3t3m3u2l17s3r19m3m}'kerning'{cl{5kt4qw}201s{201sw}201t{201tw2wy2yy6q-t}201x{2wy2yy}2k{201tw}2w{7qs4qy7rs5ky7mw5os5qx5ru17su5tu}2x{17ss5ts5os}2y{7qs4qy7rs5ky7mw5os5qx5ru17su5tu}'fof'-6o6t{17ss5ts5qs}7t{5os}3v{5qs}7p{17su5tu5qs}ck{5kt4qw}4l{5kt4qw}cm{5kt4qw}cn{5kt4qw}co{5kt4qw}cp{5kt4qw}6l{4qs5ks5ou5qw5ru17su5tu}17s{2ks}5q{ckvclvcmvcnvcovcpv4lv}5r{ckuclucmucnucoucpu4lu}5t{2ks}6p{4qs5ks5ou5qw5ru17su5tu}ek{4qs5ks5ou5qw5ru17su5tu}el{4qs5ks5ou5qw5ru17su5tu}em{4qs5ks5ou5qw5ru17su5tu}en{4qs5ks5ou5qw5ru17su5tu}eo{4qs5ks5ou5qw5ru17su5tu}ep{4qs5ks5ou5qw5ru17su5tu}es{5ks5qs4qs}et{4qs5ks5ou5qw5ru17su5tu}eu{4qs5ks5qw5ru17su5tu}ev{5ks5qs4qs}ex{17ss5ts5qs}6z{4qv5ks5ou5qw5ru17su5tu}fm{4qv5ks5ou5qw5ru17su5tu}fn{4qv5ks5ou5qw5ru17su5tu}fo{4qv5ks5ou5qw5ru17su5tu}fp{4qv5ks5ou5qw5ru17su5tu}fq{4qv5ks5ou5qw5ru17su5tu}7r{5os}fs{4qv5ks5ou5qw5ru17su5tu}ft{17su5tu5qs}fu{17su5tu5qs}fv{17su5tu5qs}fw{17su5tu5qs}}}"),"Times-Roman":l("{'widths'{k3n2q4ycx2l201n3m201o6o201s2l201t2l201u2l201w2w201x2w201y2w2k1t2l2l202m2n2n3m2o3m2p5n202q6o2r1m2s2l2t2l2u3m2v3s2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v1w3w3s3x3s3y3s3z2w4k5w4l4s4m4m4n4m4o4s4p3x4q3r4r4s4s4s4t2l4u2r4v4s4w3x4x5t4y4s4z4s5k3r5l4s5m4m5n3r5o3x5p4s5q4s5r5y5s4s5t4s5u3x5v2l5w1w5x2l5y2z5z3m6k2l6l2w6m3m6n2w6o3m6p2w6q2l6r3m6s3m6t1w6u1w6v3m6w1w6x4y6y3m6z3m7k3m7l3m7m2l7n2r7o1w7p3m7q3m7r4s7s3m7t3m7u2w7v3k7w1o7x3k7y3q202l3mcl4sal2lam3man3mao3map3mar3mas2lat4wau1vav3maw3say4waz2lbk2sbl3s'fof'6obo2lbp3mbq2xbr1tbs2lbu1zbv3mbz2wck4s202k3mcm4scn4sco4scp4scq5tcr4mcs3xct3xcu3xcv3xcw2l2m2tcy2lcz2ldl4sdm4sdn4sdo4sdp4sdq4sds4sdt4sdu4sdv4sdw4sdz3mek2wel2wem2wen2weo2wep2weq4mer2wes2wet2weu2wev2wew1wex1wey1wez1wfl3mfm3mfn3mfo3mfp3mfq3mfr3sfs3mft3mfu3mfv3mfw3mfz3m203k6o212m6m2dw2l2cq2l3t3m3u1w17s4s19m3m}'kerning'{cl{4qs5ku17sw5ou5qy5rw201ss5tw201ws}201s{201ss}201t{ckw4lwcmwcnwcowcpwclw4wu201ts}2k{201ts}2w{4qs5kw5os5qx5ru17sx5tx}2x{17sw5tw5ou5qu}2y{4qs5kw5os5qx5ru17sx5tx}'fof'-6o7t{ckuclucmucnucoucpu4lu5os5rs}3u{17su5tu5qs}3v{17su5tu5qs}7p{17sw5tw5qs}ck{4qs5ku17sw5ou5qy5rw201ss5tw201ws}4l{4qs5ku17sw5ou5qy5rw201ss5tw201ws}cm{4qs5ku17sw5ou5qy5rw201ss5tw201ws}cn{4qs5ku17sw5ou5qy5rw201ss5tw201ws}co{4qs5ku17sw5ou5qy5rw201ss5tw201ws}cp{4qs5ku17sw5ou5qy5rw201ss5tw201ws}6l{17su5tu5os5qw5rs}17s{2ktclvcmvcnvcovcpv4lv4wuckv}5o{ckwclwcmwcnwcowcpw4lw4wu}5q{ckyclycmycnycoycpy4ly4wu5ms}5r{cktcltcmtcntcotcpt4lt4ws}5t{2ktclvcmvcnvcovcpv4lv4wuckv}7q{cksclscmscnscoscps4ls}6p{17su5tu5qw5rs}ek{5qs5rs}el{17su5tu5os5qw5rs}em{17su5tu5os5qs5rs}en{17su5qs5rs}eo{5qs5rs}ep{17su5tu5os5qw5rs}es{5qs}et{17su5tu5qw5rs}eu{17su5tu5qs5rs}ev{5qs}6z{17sv5tv5os5qx5rs}fm{5os5qt5rs}fn{17sv5tv5os5qx5rs}fo{17sv5tv5os5qx5rs}fp{5os5qt5rs}fq{5os5qt5rs}7r{ckuclucmucnucoucpu4lu5os}fs{17sv5tv5os5qx5rs}ft{17ss5ts5qs}fu{17sw5tw5qs}fv{17sw5tw5qs}fw{17ss5ts5qs}fz{ckuclucmucnucoucpu4lu5os5rs}}}"),"Helvetica-Oblique":l("{'widths'{k3p2q4mcx1w201n3r201o6o201s1q201t1q201u1q201w2l201x2l201y2l2k1w2l1w202m2n2n3r2o3r2p5t202q6o2r1n2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v1w3w3u3x3u3y3u3z3r4k6p4l4m4m4m4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3m4v4m4w3r4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v1w5w1w5x1w5y2z5z3r6k2l6l3r6m3r6n3m6o3r6p3r6q1w6r3r6s3r6t1q6u1q6v3m6w1q6x5n6y3r6z3r7k3r7l3r7m2l7n3m7o1w7p3r7q3m7r4s7s3m7t3m7u3m7v2l7w1u7x2l7y3u202l3rcl4mal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3rbr1wbs2lbu2obv3rbz3xck4m202k3rcm4mcn4mco4mcp4mcq6ocr4scs4mct4mcu4mcv4mcw1w2m2ncy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3mes3ret3reu3rev3rew1wex1wey1wez1wfl3rfm3rfn3rfo3rfp3rfq3rfr3ufs3xft3rfu3rfv3rfw3rfz3m203k6o212m6o2dw2l2cq2l3t3r3u1w17s4m19m3r}'kerning'{5q{4wv}cl{4qs5kw5ow5qs17sv5tv}201t{2wu4w1k2yu}201x{2wu4wy2yu}17s{2ktclucmucnu4otcpu4lu4wycoucku}2w{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}2x{17sy5ty5oy5qs}2y{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}'fof'-6o7p{17sv5tv5ow}ck{4qs5kw5ow5qs17sv5tv}4l{4qs5kw5ow5qs17sv5tv}cm{4qs5kw5ow5qs17sv5tv}cn{4qs5kw5ow5qs17sv5tv}co{4qs5kw5ow5qs17sv5tv}cp{4qs5kw5ow5qs17sv5tv}6l{17sy5ty5ow}do{17st5tt}4z{17st5tt}7s{fst}dm{17st5tt}dn{17st5tt}5o{ckwclwcmwcnwcowcpw4lw4wv}dp{17st5tt}dq{17st5tt}7t{5ow}ds{17st5tt}5t{2ktclucmucnu4otcpu4lu4wycoucku}fu{17sv5tv5ow}6p{17sy5ty5ow5qs}ek{17sy5ty5ow}el{17sy5ty5ow}em{17sy5ty5ow}en{5ty}eo{17sy5ty5ow}ep{17sy5ty5ow}es{17sy5ty5qs}et{17sy5ty5ow5qs}eu{17sy5ty5ow5qs}ev{17sy5ty5ow5qs}6z{17sy5ty5ow5qs}fm{17sy5ty5ow5qs}fn{17sy5ty5ow5qs}fo{17sy5ty5ow5qs}fp{17sy5ty5qs}fq{17sy5ty5ow5qs}7r{5ow}fs{17sy5ty5ow5qs}ft{17sv5tv5ow}7m{5ow}fv{17sv5tv5ow}fw{17sv5tv5ow}}}")}};t.events.push(["addFont",function(d){var p=d.font,y=h.Unicode[p.postScriptName];y&&(p.metadata.Unicode={},p.metadata.Unicode.widths=y.widths,p.metadata.Unicode.kerning=y.kerning);var w=f.Unicode[p.postScriptName];w&&(p.metadata.Unicode.encoding=w,p.encoding=w.codePages[0])}])})(cr.API),(function(t){var e=function(r){for(var n=r.length,i=new Uint8Array(n),a=0;a<n;a++)i[a]=r.charCodeAt(a);return i};t.API.events.push(["addFont",function(r){var n=void 0,i=r.font,a=r.instance;if(!i.isStandardFont){if(a===void 0)throw new Error("Font does not exist in vFS, import fonts or remove declaration doc.addFont('"+i.postScriptName+"').");if(typeof(n=a.existsFileInVFS(i.postScriptName)===!1?a.loadFile(i.postScriptName):a.getFileFromVFS(i.postScriptName))!="string")throw new Error("Font is not stored as string-data in vFS, import fonts or remove declaration doc.addFont('"+i.postScriptName+"').");(function(o,s){s=/^\x00\x01\x00\x00/.test(s)?e(s):e(zg(s)),o.metadata=t.API.TTFFont.open(s),o.metadata.Unicode=o.metadata.Unicode||{encoding:{},kerning:{},widths:[]},o.metadata.glyIdsUsed=[0]})(i,n)}}])})(cr),cr.API.addSvgAsImage=function(t,e,r,n,i,a,o,s){if(isNaN(e)||isNaN(r))throw ai.error("jsPDF.addSvgAsImage: Invalid coordinates",arguments),new Error("Invalid coordinates passed to jsPDF.addSvgAsImage");if(isNaN(n)||isNaN(i))throw ai.error("jsPDF.addSvgAsImage: Invalid measurements",arguments),new Error("Invalid measurements (width and/or height) passed to jsPDF.addSvgAsImage");var l=document.createElement("canvas");l.width=n,l.height=i;var c=l.getContext("2d");c.fillStyle="#fff",c.fillRect(0,0,l.width,l.height);var f={ignoreMouse:!0,ignoreAnimation:!0,ignoreDimensions:!0},h=this;return(Ar.canvg?Promise.resolve(Ar.canvg):Cg(()=>import("./index.es-CeNS_VG7.js"),[],import.meta.url)).catch(function(d){return Promise.reject(new Error("Could not load canvg: "+d))}).then(function(d){return d.default?d.default:d}).then(function(d){return d.fromString(c,t,f)},function(){return Promise.reject(new Error("Could not load canvg."))}).then(function(d){return d.render(f)}).then(function(){h.addImage(l.toDataURL("image/jpeg",1),e,r,n,i,o,s)})},cr.API.putTotalPages=function(t){var e,r=0;parseInt(this.internal.getFont().id.substr(1),10)<15?(e=new RegExp(t,"g"),r=this.internal.getNumberOfPages()):(e=new RegExp(this.pdfEscape16(t,this.internal.getFont()),"g"),r=this.pdfEscape16(this.internal.getNumberOfPages()+"",this.internal.getFont()));for(var n=1;n<=this.internal.getNumberOfPages();n++)for(var i=0;i<this.internal.pages[n].length;i++)this.internal.pages[n][i]=this.internal.pages[n][i].replace(e,r);return this},cr.API.viewerPreferences=function(t,e){var r;t=t||{},e=e||!1;var n,i,a,o={HideToolbar:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},HideMenubar:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},HideWindowUI:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},FitWindow:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},CenterWindow:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},DisplayDocTitle:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.4},NonFullScreenPageMode:{defaultValue:"UseNone",value:"UseNone",type:"name",explicitSet:!1,valueSet:["UseNone","UseOutlines","UseThumbs","UseOC"],pdfVersion:1.3},Direction:{defaultValue:"L2R",value:"L2R",type:"name",explicitSet:!1,valueSet:["L2R","R2L"],pdfVersion:1.3},ViewArea:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},ViewClip:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},PrintArea:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},PrintClip:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},PrintScaling:{defaultValue:"AppDefault",value:"AppDefault",type:"name",explicitSet:!1,valueSet:["AppDefault","None"],pdfVersion:1.6},Duplex:{defaultValue:"",value:"none",type:"name",explicitSet:!1,valueSet:["Simplex","DuplexFlipShortEdge","DuplexFlipLongEdge","none"],pdfVersion:1.7},PickTrayByPDFSize:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.7},PrintPageRange:{defaultValue:"",value:"",type:"array",explicitSet:!1,valueSet:null,pdfVersion:1.7},NumCopies:{defaultValue:1,value:1,type:"integer",explicitSet:!1,valueSet:null,pdfVersion:1.7}},s=Object.keys(o),l=[],c=0,f=0,h=0;function d(y,w){var x,b=!1;for(x=0;x<y.length;x+=1)y[x]===w&&(b=!0);return b}if(this.internal.viewerpreferences===void 0&&(this.internal.viewerpreferences={},this.internal.viewerpreferences.configuration=JSON.parse(JSON.stringify(o)),this.internal.viewerpreferences.isSubscribed=!1),r=this.internal.viewerpreferences.configuration,t==="reset"||e===!0){var p=s.length;for(h=0;h<p;h+=1)r[s[h]].value=r[s[h]].defaultValue,r[s[h]].explicitSet=!1}if(Hn(t)==="object"){for(i in t)if(a=t[i],d(s,i)&&a!==void 0){if(r[i].type==="boolean"&&typeof a=="boolean")r[i].value=a;else if(r[i].type==="name"&&d(r[i].valueSet,a))r[i].value=a;else if(r[i].type==="integer"&&Number.isInteger(a))r[i].value=a;else if(r[i].type==="array"){for(c=0;c<a.length;c+=1)if(n=!0,a[c].length===1&&typeof a[c][0]=="number")l.push(String(a[c]-1));else if(a[c].length>1){for(f=0;f<a[c].length;f+=1)typeof a[c][f]!="number"&&(n=!1);n===!0&&l.push([a[c][0]-1,a[c][1]-1].join(" "))}r[i].value="["+l.join(" ")+"]"}else r[i].value=r[i].defaultValue;r[i].explicitSet=!0}}return this.internal.viewerpreferences.isSubscribed===!1&&(this.internal.events.subscribe("putCatalog",function(){var y,w=[];for(y in r)r[y].explicitSet===!0&&(r[y].type==="name"?w.push("/"+y+" /"+r[y].value):w.push("/"+y+" "+r[y].value));w.length!==0&&this.internal.write(`/ViewerPreferences
514
+ `&&(n=n.substr(1),E=1),d+p+(y=(i=Pg.apply(this,[n,r])).reduce(function(_,P){return _+P},0))>e||E){if(y>e){for(s=qx.apply(this,[n,i,e-(d+p),e]),f.push(s.shift()),f=[s.pop()];s.length;)h.push([s.shift()]);y=i.slice(n.length-(f[0]?f[0].length:0)).reduce(function(_,P){return _+P},0)}else f=[n];h.push(f),d=y+l,p=x}else f.push(n),d+=p+y,p=x}return c=l?function(_,P){return(P?b:"")+_.join(" ")}:function(_){return _.join(" ")},h.map(c)},Zd.splitTextToSize=function(t,e,r){var n,i=(r=r||{}).fontSize||this.internal.getFontSize(),a=(function(f){if(f.widths&&f.kerning)return{widths:f.widths,kerning:f.kerning};var h=this.internal.getFont(f.fontName,f.fontStyle),d="Unicode";return h.metadata[d]?{widths:h.metadata[d].widths||{0:1},kerning:h.metadata[d].kerning||{}}:{font:h.metadata,fontSize:this.internal.getFontSize(),charSpace:this.internal.getCharSpace()}}).call(this,r);n=Array.isArray(t)?t:String(t).split(/\r?\n/);var o=1*this.internal.scaleFactor*e/i;a.textIndent=r.textIndent?1*r.textIndent*this.internal.scaleFactor/i:0,a.lineIndent=r.lineIndent;var s,l,c=[];for(s=0,l=n.length;s<l;s++)c=c.concat(Hx.apply(this,[n[s],o,a]));return c},(function(t){t.__fontmetrics__=t.__fontmetrics__||{};for(var e="0123456789abcdef",r="klmnopqrstuvwxyz",n={},i={},a=0;a<16;a++)n[r[a]]=e[a],i[e[a]]=r[a];var o=function(d){return"0x"+parseInt(d,10).toString(16)},s=t.__fontmetrics__.compress=function(d){var p,y,w,x,b=["{"];for(var S in d){if(p=d[S],isNaN(parseInt(S,10))?y="'"+S+"'":(S=parseInt(S,10),y=(y=o(S).slice(2)).slice(0,-1)+i[y.slice(-1)]),typeof p=="number")p<0?(w=o(p).slice(3),x="-"):(w=o(p).slice(2),x=""),w=x+w.slice(0,-1)+i[w.slice(-1)];else{if(Hn(p)!=="object")throw new Error("Don't know what to do with value type "+Hn(p)+".");w=s(p)}b.push(y+w)}return b.push("}"),b.join("")},l=t.__fontmetrics__.uncompress=function(d){if(typeof d!="string")throw new Error("Invalid argument passed to uncompress.");for(var p,y,w,x,b={},S=1,E=b,_=[],P="",N="",C=d.length-1,O=1;O<C;O+=1)(x=d[O])=="'"?p?(w=p.join(""),p=void 0):p=[]:p?p.push(x):x=="{"?(_.push([E,w]),E={},w=void 0):x=="}"?((y=_.pop())[0][y[1]]=E,w=void 0,E=y[0]):x=="-"?S=-1:w===void 0?n.hasOwnProperty(x)?(P+=n[x],w=parseInt(P,16)*S,S=1,P=""):P+=x:n.hasOwnProperty(x)?(N+=n[x],E[w]=parseInt(N,16)*S,S=1,w=void 0,N=""):N+=x;return b},c={codePages:["WinAnsiEncoding"],WinAnsiEncoding:l("{19m8n201n9q201o9r201s9l201t9m201u8m201w9n201x9o201y8o202k8q202l8r202m9p202q8p20aw8k203k8t203t8v203u9v2cq8s212m9t15m8w15n9w2dw9s16k8u16l9u17s9z17x8y17y9y}")},f={Unicode:{Courier:c,"Courier-Bold":c,"Courier-BoldOblique":c,"Courier-Oblique":c,Helvetica:c,"Helvetica-Bold":c,"Helvetica-BoldOblique":c,"Helvetica-Oblique":c,"Times-Roman":c,"Times-Bold":c,"Times-BoldItalic":c,"Times-Italic":c}},h={Unicode:{"Courier-Oblique":l("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),"Times-BoldItalic":l("{'widths'{k3o2q4ycx2r201n3m201o6o201s2l201t2l201u2l201w3m201x3m201y3m2k1t2l2r202m2n2n3m2o3m2p5n202q6o2r1w2s2l2t2l2u3m2v3t2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v2l3w3t3x3t3y3t3z3m4k5n4l4m4m4m4n4m4o4s4p4m4q4m4r4s4s4y4t2r4u3m4v4m4w3x4x5t4y4s4z4s5k3x5l4s5m4m5n3r5o3x5p4s5q4m5r5t5s4m5t3x5u3x5v2l5w1w5x2l5y3t5z3m6k2l6l3m6m3m6n2w6o3m6p2w6q2l6r3m6s3r6t1w6u1w6v3m6w1w6x4y6y3r6z3m7k3m7l3m7m2r7n2r7o1w7p3r7q2w7r4m7s3m7t2w7u2r7v2n7w1q7x2n7y3t202l3mcl4mal2ram3man3mao3map3mar3mas2lat4uau1uav3maw3way4uaz2lbk2sbl3t'fof'6obo2lbp3tbq3mbr1tbs2lbu1ybv3mbz3mck4m202k3mcm4mcn4mco4mcp4mcq5ycr4mcs4mct4mcu4mcv4mcw2r2m3rcy2rcz2rdl4sdm4sdn4sdo4sdp4sdq4sds4sdt4sdu4sdv4sdw4sdz3mek3mel3mem3men3meo3mep3meq4ser2wes2wet2weu2wev2wew1wex1wey1wez1wfl3rfm3mfn3mfo3mfp3mfq3mfr3tfs3mft3rfu3rfv3rfw3rfz2w203k6o212m6o2dw2l2cq2l3t3m3u2l17s3x19m3m}'kerning'{cl{4qu5kt5qt5rs17ss5ts}201s{201ss}201t{cks4lscmscnscoscpscls2wu2yu201ts}201x{2wu2yu}2k{201ts}2w{4qx5kx5ou5qx5rs17su5tu}2x{17su5tu5ou}2y{4qx5kx5ou5qx5rs17ss5ts}'fof'-6ofn{17sw5tw5ou5qw5rs}7t{cksclscmscnscoscps4ls}3u{17su5tu5os5qs}3v{17su5tu5os5qs}7p{17su5tu}ck{4qu5kt5qt5rs17ss5ts}4l{4qu5kt5qt5rs17ss5ts}cm{4qu5kt5qt5rs17ss5ts}cn{4qu5kt5qt5rs17ss5ts}co{4qu5kt5qt5rs17ss5ts}cp{4qu5kt5qt5rs17ss5ts}6l{4qu5ou5qw5rt17su5tu}5q{ckuclucmucnucoucpu4lu}5r{ckuclucmucnucoucpu4lu}7q{cksclscmscnscoscps4ls}6p{4qu5ou5qw5rt17sw5tw}ek{4qu5ou5qw5rt17su5tu}el{4qu5ou5qw5rt17su5tu}em{4qu5ou5qw5rt17su5tu}en{4qu5ou5qw5rt17su5tu}eo{4qu5ou5qw5rt17su5tu}ep{4qu5ou5qw5rt17su5tu}es{17ss5ts5qs4qu}et{4qu5ou5qw5rt17sw5tw}eu{4qu5ou5qw5rt17ss5ts}ev{17ss5ts5qs4qu}6z{17sw5tw5ou5qw5rs}fm{17sw5tw5ou5qw5rs}7n{201ts}fo{17sw5tw5ou5qw5rs}fp{17sw5tw5ou5qw5rs}fq{17sw5tw5ou5qw5rs}7r{cksclscmscnscoscps4ls}fs{17sw5tw5ou5qw5rs}ft{17su5tu}fu{17su5tu}fv{17su5tu}fw{17su5tu}fz{cksclscmscnscoscps4ls}}}"),"Helvetica-Bold":l("{'widths'{k3s2q4scx1w201n3r201o6o201s1w201t1w201u1w201w3m201x3m201y3m2k1w2l2l202m2n2n3r2o3r2p5t202q6o2r1s2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v2l3w3u3x3u3y3u3z3x4k6l4l4s4m4s4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3r4v4s4w3x4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v2l5w1w5x2l5y3u5z3r6k2l6l3r6m3x6n3r6o3x6p3r6q2l6r3x6s3x6t1w6u1w6v3r6w1w6x5t6y3x6z3x7k3x7l3x7m2r7n3r7o2l7p3x7q3r7r4y7s3r7t3r7u3m7v2r7w1w7x2r7y3u202l3rcl4sal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3xbq3rbr1wbs2lbu2obv3rbz3xck4s202k3rcm4scn4sco4scp4scq6ocr4scs4mct4mcu4mcv4mcw1w2m2zcy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3res3ret3reu3rev3rew1wex1wey1wez1wfl3xfm3xfn3xfo3xfp3xfq3xfr3ufs3xft3xfu3xfv3xfw3xfz3r203k6o212m6o2dw2l2cq2l3t3r3u2l17s4m19m3r}'kerning'{cl{4qs5ku5ot5qs17sv5tv}201t{2ww4wy2yw}201w{2ks}201x{2ww4wy2yw}2k{201ts201xs}2w{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}2x{5ow5qs}2y{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}'fof'-6o7p{17su5tu5ot}ck{4qs5ku5ot5qs17sv5tv}4l{4qs5ku5ot5qs17sv5tv}cm{4qs5ku5ot5qs17sv5tv}cn{4qs5ku5ot5qs17sv5tv}co{4qs5ku5ot5qs17sv5tv}cp{4qs5ku5ot5qs17sv5tv}6l{17st5tt5os}17s{2kwclvcmvcnvcovcpv4lv4wwckv}5o{2kucltcmtcntcotcpt4lt4wtckt}5q{2ksclscmscnscoscps4ls4wvcks}5r{2ks4ws}5t{2kwclvcmvcnvcovcpv4lv4wwckv}eo{17st5tt5os}fu{17su5tu5ot}6p{17ss5ts}ek{17st5tt5os}el{17st5tt5os}em{17st5tt5os}en{17st5tt5os}6o{201ts}ep{17st5tt5os}es{17ss5ts}et{17ss5ts}eu{17ss5ts}ev{17ss5ts}6z{17su5tu5os5qt}fm{17su5tu5os5qt}fn{17su5tu5os5qt}fo{17su5tu5os5qt}fp{17su5tu5os5qt}fq{17su5tu5os5qt}fs{17su5tu5os5qt}ft{17su5tu5ot}7m{5os}fv{17su5tu5ot}fw{17su5tu5ot}}}"),Courier:l("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),"Courier-BoldOblique":l("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),"Times-Bold":l("{'widths'{k3q2q5ncx2r201n3m201o6o201s2l201t2l201u2l201w3m201x3m201y3m2k1t2l2l202m2n2n3m2o3m2p6o202q6o2r1w2s2l2t2l2u3m2v3t2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v2l3w3t3x3t3y3t3z3m4k5x4l4s4m4m4n4s4o4s4p4m4q3x4r4y4s4y4t2r4u3m4v4y4w4m4x5y4y4s4z4y5k3x5l4y5m4s5n3r5o4m5p4s5q4s5r6o5s4s5t4s5u4m5v2l5w1w5x2l5y3u5z3m6k2l6l3m6m3r6n2w6o3r6p2w6q2l6r3m6s3r6t1w6u2l6v3r6w1w6x5n6y3r6z3m7k3r7l3r7m2w7n2r7o2l7p3r7q3m7r4s7s3m7t3m7u2w7v2r7w1q7x2r7y3o202l3mcl4sal2lam3man3mao3map3mar3mas2lat4uau1yav3maw3tay4uaz2lbk2sbl3t'fof'6obo2lbp3rbr1tbs2lbu2lbv3mbz3mck4s202k3mcm4scn4sco4scp4scq6ocr4scs4mct4mcu4mcv4mcw2r2m3rcy2rcz2rdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3rek3mel3mem3men3meo3mep3meq4ser2wes2wet2weu2wev2wew1wex1wey1wez1wfl3rfm3mfn3mfo3mfp3mfq3mfr3tfs3mft3rfu3rfv3rfw3rfz3m203k6o212m6o2dw2l2cq2l3t3m3u2l17s4s19m3m}'kerning'{cl{4qt5ks5ot5qy5rw17sv5tv}201t{cks4lscmscnscoscpscls4wv}2k{201ts}2w{4qu5ku7mu5os5qx5ru17su5tu}2x{17su5tu5ou5qs}2y{4qv5kv7mu5ot5qz5ru17su5tu}'fof'-6o7t{cksclscmscnscoscps4ls}3u{17su5tu5os5qu}3v{17su5tu5os5qu}fu{17su5tu5ou5qu}7p{17su5tu5ou5qu}ck{4qt5ks5ot5qy5rw17sv5tv}4l{4qt5ks5ot5qy5rw17sv5tv}cm{4qt5ks5ot5qy5rw17sv5tv}cn{4qt5ks5ot5qy5rw17sv5tv}co{4qt5ks5ot5qy5rw17sv5tv}cp{4qt5ks5ot5qy5rw17sv5tv}6l{17st5tt5ou5qu}17s{ckuclucmucnucoucpu4lu4wu}5o{ckuclucmucnucoucpu4lu4wu}5q{ckzclzcmzcnzcozcpz4lz4wu}5r{ckxclxcmxcnxcoxcpx4lx4wu}5t{ckuclucmucnucoucpu4lu4wu}7q{ckuclucmucnucoucpu4lu}6p{17sw5tw5ou5qu}ek{17st5tt5qu}el{17st5tt5ou5qu}em{17st5tt5qu}en{17st5tt5qu}eo{17st5tt5qu}ep{17st5tt5ou5qu}es{17ss5ts5qu}et{17sw5tw5ou5qu}eu{17sw5tw5ou5qu}ev{17ss5ts5qu}6z{17sw5tw5ou5qu5rs}fm{17sw5tw5ou5qu5rs}fn{17sw5tw5ou5qu5rs}fo{17sw5tw5ou5qu5rs}fp{17sw5tw5ou5qu5rs}fq{17sw5tw5ou5qu5rs}7r{cktcltcmtcntcotcpt4lt5os}fs{17sw5tw5ou5qu5rs}ft{17su5tu5ou5qu}7m{5os}fv{17su5tu5ou5qu}fw{17su5tu5ou5qu}fz{cksclscmscnscoscps4ls}}}"),Symbol:l("{'widths'{k3uaw4r19m3m2k1t2l2l202m2y2n3m2p5n202q6o3k3m2s2l2t2l2v3r2w1t3m3m2y1t2z1wbk2sbl3r'fof'6o3n3m3o3m3p3m3q3m3r3m3s3m3t3m3u1w3v1w3w3r3x3r3y3r3z2wbp3t3l3m5v2l5x2l5z3m2q4yfr3r7v3k7w1o7x3k}'kerning'{'fof'-6o}}"),Helvetica:l("{'widths'{k3p2q4mcx1w201n3r201o6o201s1q201t1q201u1q201w2l201x2l201y2l2k1w2l1w202m2n2n3r2o3r2p5t202q6o2r1n2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v1w3w3u3x3u3y3u3z3r4k6p4l4m4m4m4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3m4v4m4w3r4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v1w5w1w5x1w5y2z5z3r6k2l6l3r6m3r6n3m6o3r6p3r6q1w6r3r6s3r6t1q6u1q6v3m6w1q6x5n6y3r6z3r7k3r7l3r7m2l7n3m7o1w7p3r7q3m7r4s7s3m7t3m7u3m7v2l7w1u7x2l7y3u202l3rcl4mal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3rbr1wbs2lbu2obv3rbz3xck4m202k3rcm4mcn4mco4mcp4mcq6ocr4scs4mct4mcu4mcv4mcw1w2m2ncy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3mes3ret3reu3rev3rew1wex1wey1wez1wfl3rfm3rfn3rfo3rfp3rfq3rfr3ufs3xft3rfu3rfv3rfw3rfz3m203k6o212m6o2dw2l2cq2l3t3r3u1w17s4m19m3r}'kerning'{5q{4wv}cl{4qs5kw5ow5qs17sv5tv}201t{2wu4w1k2yu}201x{2wu4wy2yu}17s{2ktclucmucnu4otcpu4lu4wycoucku}2w{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}2x{17sy5ty5oy5qs}2y{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}'fof'-6o7p{17sv5tv5ow}ck{4qs5kw5ow5qs17sv5tv}4l{4qs5kw5ow5qs17sv5tv}cm{4qs5kw5ow5qs17sv5tv}cn{4qs5kw5ow5qs17sv5tv}co{4qs5kw5ow5qs17sv5tv}cp{4qs5kw5ow5qs17sv5tv}6l{17sy5ty5ow}do{17st5tt}4z{17st5tt}7s{fst}dm{17st5tt}dn{17st5tt}5o{ckwclwcmwcnwcowcpw4lw4wv}dp{17st5tt}dq{17st5tt}7t{5ow}ds{17st5tt}5t{2ktclucmucnu4otcpu4lu4wycoucku}fu{17sv5tv5ow}6p{17sy5ty5ow5qs}ek{17sy5ty5ow}el{17sy5ty5ow}em{17sy5ty5ow}en{5ty}eo{17sy5ty5ow}ep{17sy5ty5ow}es{17sy5ty5qs}et{17sy5ty5ow5qs}eu{17sy5ty5ow5qs}ev{17sy5ty5ow5qs}6z{17sy5ty5ow5qs}fm{17sy5ty5ow5qs}fn{17sy5ty5ow5qs}fo{17sy5ty5ow5qs}fp{17sy5ty5qs}fq{17sy5ty5ow5qs}7r{5ow}fs{17sy5ty5ow5qs}ft{17sv5tv5ow}7m{5ow}fv{17sv5tv5ow}fw{17sv5tv5ow}}}"),"Helvetica-BoldOblique":l("{'widths'{k3s2q4scx1w201n3r201o6o201s1w201t1w201u1w201w3m201x3m201y3m2k1w2l2l202m2n2n3r2o3r2p5t202q6o2r1s2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v2l3w3u3x3u3y3u3z3x4k6l4l4s4m4s4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3r4v4s4w3x4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v2l5w1w5x2l5y3u5z3r6k2l6l3r6m3x6n3r6o3x6p3r6q2l6r3x6s3x6t1w6u1w6v3r6w1w6x5t6y3x6z3x7k3x7l3x7m2r7n3r7o2l7p3x7q3r7r4y7s3r7t3r7u3m7v2r7w1w7x2r7y3u202l3rcl4sal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3xbq3rbr1wbs2lbu2obv3rbz3xck4s202k3rcm4scn4sco4scp4scq6ocr4scs4mct4mcu4mcv4mcw1w2m2zcy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3res3ret3reu3rev3rew1wex1wey1wez1wfl3xfm3xfn3xfo3xfp3xfq3xfr3ufs3xft3xfu3xfv3xfw3xfz3r203k6o212m6o2dw2l2cq2l3t3r3u2l17s4m19m3r}'kerning'{cl{4qs5ku5ot5qs17sv5tv}201t{2ww4wy2yw}201w{2ks}201x{2ww4wy2yw}2k{201ts201xs}2w{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}2x{5ow5qs}2y{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}'fof'-6o7p{17su5tu5ot}ck{4qs5ku5ot5qs17sv5tv}4l{4qs5ku5ot5qs17sv5tv}cm{4qs5ku5ot5qs17sv5tv}cn{4qs5ku5ot5qs17sv5tv}co{4qs5ku5ot5qs17sv5tv}cp{4qs5ku5ot5qs17sv5tv}6l{17st5tt5os}17s{2kwclvcmvcnvcovcpv4lv4wwckv}5o{2kucltcmtcntcotcpt4lt4wtckt}5q{2ksclscmscnscoscps4ls4wvcks}5r{2ks4ws}5t{2kwclvcmvcnvcovcpv4lv4wwckv}eo{17st5tt5os}fu{17su5tu5ot}6p{17ss5ts}ek{17st5tt5os}el{17st5tt5os}em{17st5tt5os}en{17st5tt5os}6o{201ts}ep{17st5tt5os}es{17ss5ts}et{17ss5ts}eu{17ss5ts}ev{17ss5ts}6z{17su5tu5os5qt}fm{17su5tu5os5qt}fn{17su5tu5os5qt}fo{17su5tu5os5qt}fp{17su5tu5os5qt}fq{17su5tu5os5qt}fs{17su5tu5os5qt}ft{17su5tu5ot}7m{5os}fv{17su5tu5ot}fw{17su5tu5ot}}}"),ZapfDingbats:l("{'widths'{k4u2k1w'fof'6o}'kerning'{'fof'-6o}}"),"Courier-Bold":l("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),"Times-Italic":l("{'widths'{k3n2q4ycx2l201n3m201o5t201s2l201t2l201u2l201w3r201x3r201y3r2k1t2l2l202m2n2n3m2o3m2p5n202q5t2r1p2s2l2t2l2u3m2v4n2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v2l3w4n3x4n3y4n3z3m4k5w4l3x4m3x4n4m4o4s4p3x4q3x4r4s4s4s4t2l4u2w4v4m4w3r4x5n4y4m4z4s5k3x5l4s5m3x5n3m5o3r5p4s5q3x5r5n5s3x5t3r5u3r5v2r5w1w5x2r5y2u5z3m6k2l6l3m6m3m6n2w6o3m6p2w6q1w6r3m6s3m6t1w6u1w6v2w6w1w6x4s6y3m6z3m7k3m7l3m7m2r7n2r7o1w7p3m7q2w7r4m7s2w7t2w7u2r7v2s7w1v7x2s7y3q202l3mcl3xal2ram3man3mao3map3mar3mas2lat4wau1vav3maw4nay4waz2lbk2sbl4n'fof'6obo2lbp3mbq3obr1tbs2lbu1zbv3mbz3mck3x202k3mcm3xcn3xco3xcp3xcq5tcr4mcs3xct3xcu3xcv3xcw2l2m2ucy2lcz2ldl4mdm4sdn4sdo4sdp4sdq4sds4sdt4sdu4sdv4sdw4sdz3mek3mel3mem3men3meo3mep3meq4mer2wes2wet2weu2wev2wew1wex1wey1wez1wfl3mfm3mfn3mfo3mfp3mfq3mfr4nfs3mft3mfu3mfv3mfw3mfz2w203k6o212m6m2dw2l2cq2l3t3m3u2l17s3r19m3m}'kerning'{cl{5kt4qw}201s{201sw}201t{201tw2wy2yy6q-t}201x{2wy2yy}2k{201tw}2w{7qs4qy7rs5ky7mw5os5qx5ru17su5tu}2x{17ss5ts5os}2y{7qs4qy7rs5ky7mw5os5qx5ru17su5tu}'fof'-6o6t{17ss5ts5qs}7t{5os}3v{5qs}7p{17su5tu5qs}ck{5kt4qw}4l{5kt4qw}cm{5kt4qw}cn{5kt4qw}co{5kt4qw}cp{5kt4qw}6l{4qs5ks5ou5qw5ru17su5tu}17s{2ks}5q{ckvclvcmvcnvcovcpv4lv}5r{ckuclucmucnucoucpu4lu}5t{2ks}6p{4qs5ks5ou5qw5ru17su5tu}ek{4qs5ks5ou5qw5ru17su5tu}el{4qs5ks5ou5qw5ru17su5tu}em{4qs5ks5ou5qw5ru17su5tu}en{4qs5ks5ou5qw5ru17su5tu}eo{4qs5ks5ou5qw5ru17su5tu}ep{4qs5ks5ou5qw5ru17su5tu}es{5ks5qs4qs}et{4qs5ks5ou5qw5ru17su5tu}eu{4qs5ks5qw5ru17su5tu}ev{5ks5qs4qs}ex{17ss5ts5qs}6z{4qv5ks5ou5qw5ru17su5tu}fm{4qv5ks5ou5qw5ru17su5tu}fn{4qv5ks5ou5qw5ru17su5tu}fo{4qv5ks5ou5qw5ru17su5tu}fp{4qv5ks5ou5qw5ru17su5tu}fq{4qv5ks5ou5qw5ru17su5tu}7r{5os}fs{4qv5ks5ou5qw5ru17su5tu}ft{17su5tu5qs}fu{17su5tu5qs}fv{17su5tu5qs}fw{17su5tu5qs}}}"),"Times-Roman":l("{'widths'{k3n2q4ycx2l201n3m201o6o201s2l201t2l201u2l201w2w201x2w201y2w2k1t2l2l202m2n2n3m2o3m2p5n202q6o2r1m2s2l2t2l2u3m2v3s2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v1w3w3s3x3s3y3s3z2w4k5w4l4s4m4m4n4m4o4s4p3x4q3r4r4s4s4s4t2l4u2r4v4s4w3x4x5t4y4s4z4s5k3r5l4s5m4m5n3r5o3x5p4s5q4s5r5y5s4s5t4s5u3x5v2l5w1w5x2l5y2z5z3m6k2l6l2w6m3m6n2w6o3m6p2w6q2l6r3m6s3m6t1w6u1w6v3m6w1w6x4y6y3m6z3m7k3m7l3m7m2l7n2r7o1w7p3m7q3m7r4s7s3m7t3m7u2w7v3k7w1o7x3k7y3q202l3mcl4sal2lam3man3mao3map3mar3mas2lat4wau1vav3maw3say4waz2lbk2sbl3s'fof'6obo2lbp3mbq2xbr1tbs2lbu1zbv3mbz2wck4s202k3mcm4scn4sco4scp4scq5tcr4mcs3xct3xcu3xcv3xcw2l2m2tcy2lcz2ldl4sdm4sdn4sdo4sdp4sdq4sds4sdt4sdu4sdv4sdw4sdz3mek2wel2wem2wen2weo2wep2weq4mer2wes2wet2weu2wev2wew1wex1wey1wez1wfl3mfm3mfn3mfo3mfp3mfq3mfr3sfs3mft3mfu3mfv3mfw3mfz3m203k6o212m6m2dw2l2cq2l3t3m3u1w17s4s19m3m}'kerning'{cl{4qs5ku17sw5ou5qy5rw201ss5tw201ws}201s{201ss}201t{ckw4lwcmwcnwcowcpwclw4wu201ts}2k{201ts}2w{4qs5kw5os5qx5ru17sx5tx}2x{17sw5tw5ou5qu}2y{4qs5kw5os5qx5ru17sx5tx}'fof'-6o7t{ckuclucmucnucoucpu4lu5os5rs}3u{17su5tu5qs}3v{17su5tu5qs}7p{17sw5tw5qs}ck{4qs5ku17sw5ou5qy5rw201ss5tw201ws}4l{4qs5ku17sw5ou5qy5rw201ss5tw201ws}cm{4qs5ku17sw5ou5qy5rw201ss5tw201ws}cn{4qs5ku17sw5ou5qy5rw201ss5tw201ws}co{4qs5ku17sw5ou5qy5rw201ss5tw201ws}cp{4qs5ku17sw5ou5qy5rw201ss5tw201ws}6l{17su5tu5os5qw5rs}17s{2ktclvcmvcnvcovcpv4lv4wuckv}5o{ckwclwcmwcnwcowcpw4lw4wu}5q{ckyclycmycnycoycpy4ly4wu5ms}5r{cktcltcmtcntcotcpt4lt4ws}5t{2ktclvcmvcnvcovcpv4lv4wuckv}7q{cksclscmscnscoscps4ls}6p{17su5tu5qw5rs}ek{5qs5rs}el{17su5tu5os5qw5rs}em{17su5tu5os5qs5rs}en{17su5qs5rs}eo{5qs5rs}ep{17su5tu5os5qw5rs}es{5qs}et{17su5tu5qw5rs}eu{17su5tu5qs5rs}ev{5qs}6z{17sv5tv5os5qx5rs}fm{5os5qt5rs}fn{17sv5tv5os5qx5rs}fo{17sv5tv5os5qx5rs}fp{5os5qt5rs}fq{5os5qt5rs}7r{ckuclucmucnucoucpu4lu5os}fs{17sv5tv5os5qx5rs}ft{17ss5ts5qs}fu{17sw5tw5qs}fv{17sw5tw5qs}fw{17ss5ts5qs}fz{ckuclucmucnucoucpu4lu5os5rs}}}"),"Helvetica-Oblique":l("{'widths'{k3p2q4mcx1w201n3r201o6o201s1q201t1q201u1q201w2l201x2l201y2l2k1w2l1w202m2n2n3r2o3r2p5t202q6o2r1n2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v1w3w3u3x3u3y3u3z3r4k6p4l4m4m4m4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3m4v4m4w3r4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v1w5w1w5x1w5y2z5z3r6k2l6l3r6m3r6n3m6o3r6p3r6q1w6r3r6s3r6t1q6u1q6v3m6w1q6x5n6y3r6z3r7k3r7l3r7m2l7n3m7o1w7p3r7q3m7r4s7s3m7t3m7u3m7v2l7w1u7x2l7y3u202l3rcl4mal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3rbr1wbs2lbu2obv3rbz3xck4m202k3rcm4mcn4mco4mcp4mcq6ocr4scs4mct4mcu4mcv4mcw1w2m2ncy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3mes3ret3reu3rev3rew1wex1wey1wez1wfl3rfm3rfn3rfo3rfp3rfq3rfr3ufs3xft3rfu3rfv3rfw3rfz3m203k6o212m6o2dw2l2cq2l3t3r3u1w17s4m19m3r}'kerning'{5q{4wv}cl{4qs5kw5ow5qs17sv5tv}201t{2wu4w1k2yu}201x{2wu4wy2yu}17s{2ktclucmucnu4otcpu4lu4wycoucku}2w{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}2x{17sy5ty5oy5qs}2y{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}'fof'-6o7p{17sv5tv5ow}ck{4qs5kw5ow5qs17sv5tv}4l{4qs5kw5ow5qs17sv5tv}cm{4qs5kw5ow5qs17sv5tv}cn{4qs5kw5ow5qs17sv5tv}co{4qs5kw5ow5qs17sv5tv}cp{4qs5kw5ow5qs17sv5tv}6l{17sy5ty5ow}do{17st5tt}4z{17st5tt}7s{fst}dm{17st5tt}dn{17st5tt}5o{ckwclwcmwcnwcowcpw4lw4wv}dp{17st5tt}dq{17st5tt}7t{5ow}ds{17st5tt}5t{2ktclucmucnu4otcpu4lu4wycoucku}fu{17sv5tv5ow}6p{17sy5ty5ow5qs}ek{17sy5ty5ow}el{17sy5ty5ow}em{17sy5ty5ow}en{5ty}eo{17sy5ty5ow}ep{17sy5ty5ow}es{17sy5ty5qs}et{17sy5ty5ow5qs}eu{17sy5ty5ow5qs}ev{17sy5ty5ow5qs}6z{17sy5ty5ow5qs}fm{17sy5ty5ow5qs}fn{17sy5ty5ow5qs}fo{17sy5ty5ow5qs}fp{17sy5ty5qs}fq{17sy5ty5ow5qs}7r{5ow}fs{17sy5ty5ow5qs}ft{17sv5tv5ow}7m{5ow}fv{17sv5tv5ow}fw{17sv5tv5ow}}}")}};t.events.push(["addFont",function(d){var p=d.font,y=h.Unicode[p.postScriptName];y&&(p.metadata.Unicode={},p.metadata.Unicode.widths=y.widths,p.metadata.Unicode.kerning=y.kerning);var w=f.Unicode[p.postScriptName];w&&(p.metadata.Unicode.encoding=w,p.encoding=w.codePages[0])}])})(cr.API),(function(t){var e=function(r){for(var n=r.length,i=new Uint8Array(n),a=0;a<n;a++)i[a]=r.charCodeAt(a);return i};t.API.events.push(["addFont",function(r){var n=void 0,i=r.font,a=r.instance;if(!i.isStandardFont){if(a===void 0)throw new Error("Font does not exist in vFS, import fonts or remove declaration doc.addFont('"+i.postScriptName+"').");if(typeof(n=a.existsFileInVFS(i.postScriptName)===!1?a.loadFile(i.postScriptName):a.getFileFromVFS(i.postScriptName))!="string")throw new Error("Font is not stored as string-data in vFS, import fonts or remove declaration doc.addFont('"+i.postScriptName+"').");(function(o,s){s=/^\x00\x01\x00\x00/.test(s)?e(s):e(zg(s)),o.metadata=t.API.TTFFont.open(s),o.metadata.Unicode=o.metadata.Unicode||{encoding:{},kerning:{},widths:[]},o.metadata.glyIdsUsed=[0]})(i,n)}}])})(cr),cr.API.addSvgAsImage=function(t,e,r,n,i,a,o,s){if(isNaN(e)||isNaN(r))throw ai.error("jsPDF.addSvgAsImage: Invalid coordinates",arguments),new Error("Invalid coordinates passed to jsPDF.addSvgAsImage");if(isNaN(n)||isNaN(i))throw ai.error("jsPDF.addSvgAsImage: Invalid measurements",arguments),new Error("Invalid measurements (width and/or height) passed to jsPDF.addSvgAsImage");var l=document.createElement("canvas");l.width=n,l.height=i;var c=l.getContext("2d");c.fillStyle="#fff",c.fillRect(0,0,l.width,l.height);var f={ignoreMouse:!0,ignoreAnimation:!0,ignoreDimensions:!0},h=this;return(Ar.canvg?Promise.resolve(Ar.canvg):Cg(()=>import("./index.es-C9SyaVce.js"),[],import.meta.url)).catch(function(d){return Promise.reject(new Error("Could not load canvg: "+d))}).then(function(d){return d.default?d.default:d}).then(function(d){return d.fromString(c,t,f)},function(){return Promise.reject(new Error("Could not load canvg."))}).then(function(d){return d.render(f)}).then(function(){h.addImage(l.toDataURL("image/jpeg",1),e,r,n,i,o,s)})},cr.API.putTotalPages=function(t){var e,r=0;parseInt(this.internal.getFont().id.substr(1),10)<15?(e=new RegExp(t,"g"),r=this.internal.getNumberOfPages()):(e=new RegExp(this.pdfEscape16(t,this.internal.getFont()),"g"),r=this.pdfEscape16(this.internal.getNumberOfPages()+"",this.internal.getFont()));for(var n=1;n<=this.internal.getNumberOfPages();n++)for(var i=0;i<this.internal.pages[n].length;i++)this.internal.pages[n][i]=this.internal.pages[n][i].replace(e,r);return this},cr.API.viewerPreferences=function(t,e){var r;t=t||{},e=e||!1;var n,i,a,o={HideToolbar:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},HideMenubar:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},HideWindowUI:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},FitWindow:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},CenterWindow:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},DisplayDocTitle:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.4},NonFullScreenPageMode:{defaultValue:"UseNone",value:"UseNone",type:"name",explicitSet:!1,valueSet:["UseNone","UseOutlines","UseThumbs","UseOC"],pdfVersion:1.3},Direction:{defaultValue:"L2R",value:"L2R",type:"name",explicitSet:!1,valueSet:["L2R","R2L"],pdfVersion:1.3},ViewArea:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},ViewClip:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},PrintArea:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},PrintClip:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},PrintScaling:{defaultValue:"AppDefault",value:"AppDefault",type:"name",explicitSet:!1,valueSet:["AppDefault","None"],pdfVersion:1.6},Duplex:{defaultValue:"",value:"none",type:"name",explicitSet:!1,valueSet:["Simplex","DuplexFlipShortEdge","DuplexFlipLongEdge","none"],pdfVersion:1.7},PickTrayByPDFSize:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.7},PrintPageRange:{defaultValue:"",value:"",type:"array",explicitSet:!1,valueSet:null,pdfVersion:1.7},NumCopies:{defaultValue:1,value:1,type:"integer",explicitSet:!1,valueSet:null,pdfVersion:1.7}},s=Object.keys(o),l=[],c=0,f=0,h=0;function d(y,w){var x,b=!1;for(x=0;x<y.length;x+=1)y[x]===w&&(b=!0);return b}if(this.internal.viewerpreferences===void 0&&(this.internal.viewerpreferences={},this.internal.viewerpreferences.configuration=JSON.parse(JSON.stringify(o)),this.internal.viewerpreferences.isSubscribed=!1),r=this.internal.viewerpreferences.configuration,t==="reset"||e===!0){var p=s.length;for(h=0;h<p;h+=1)r[s[h]].value=r[s[h]].defaultValue,r[s[h]].explicitSet=!1}if(Hn(t)==="object"){for(i in t)if(a=t[i],d(s,i)&&a!==void 0){if(r[i].type==="boolean"&&typeof a=="boolean")r[i].value=a;else if(r[i].type==="name"&&d(r[i].valueSet,a))r[i].value=a;else if(r[i].type==="integer"&&Number.isInteger(a))r[i].value=a;else if(r[i].type==="array"){for(c=0;c<a.length;c+=1)if(n=!0,a[c].length===1&&typeof a[c][0]=="number")l.push(String(a[c]-1));else if(a[c].length>1){for(f=0;f<a[c].length;f+=1)typeof a[c][f]!="number"&&(n=!1);n===!0&&l.push([a[c][0]-1,a[c][1]-1].join(" "))}r[i].value="["+l.join(" ")+"]"}else r[i].value=r[i].defaultValue;r[i].explicitSet=!0}}return this.internal.viewerpreferences.isSubscribed===!1&&(this.internal.events.subscribe("putCatalog",function(){var y,w=[];for(y in r)r[y].explicitSet===!0&&(r[y].type==="name"?w.push("/"+y+" /"+r[y].value):w.push("/"+y+" "+r[y].value));w.length!==0&&this.internal.write(`/ViewerPreferences
515
515
  <<
516
516
  `+w.join(`
517
517
  `)+`
@@ -540,4 +540,4 @@ endbfchar
540
540
  CMapName currentdict /CMap defineresource pop
541
541
  end
542
542
  end`};e.events.push(["putFont",function(a){(function(o){var s=o.font,l=o.out,c=o.newObject,f=o.putStream;if(s.metadata instanceof t.API.TTFFont&&s.encoding==="Identity-H"){for(var h=s.metadata.Unicode.widths,d=s.metadata.subset.encode(s.metadata.glyIdsUsed,1),p="",y=0;y<d.length;y++)p+=String.fromCharCode(d[y]);var w=c();f({data:p,addLength1:!0,objectId:w}),l("endobj");var x=c();f({data:n(s.metadata.toUnicode),addLength1:!0,objectId:x}),l("endobj");var b=c();l("<<"),l("/Type /FontDescriptor"),l("/FontName /"+ip(s.fontName)),l("/FontFile2 "+w+" 0 R"),l("/FontBBox "+t.API.PDFObject.convert(s.metadata.bbox)),l("/Flags "+s.metadata.flags),l("/StemV "+s.metadata.stemV),l("/ItalicAngle "+s.metadata.italicAngle),l("/Ascent "+s.metadata.ascender),l("/Descent "+s.metadata.decender),l("/CapHeight "+s.metadata.capHeight),l(">>"),l("endobj");var S=c();l("<<"),l("/Type /Font"),l("/BaseFont /"+ip(s.fontName)),l("/FontDescriptor "+b+" 0 R"),l("/W "+t.API.PDFObject.convert(h)),l("/CIDToGIDMap /Identity"),l("/DW 1000"),l("/Subtype /CIDFontType2"),l("/CIDSystemInfo"),l("<<"),l("/Supplement 0"),l("/Registry (Adobe)"),l("/Ordering ("+s.encoding+")"),l(">>"),l(">>"),l("endobj"),s.objectNumber=c(),l("<<"),l("/Type /Font"),l("/Subtype /Type0"),l("/ToUnicode "+x+" 0 R"),l("/BaseFont /"+ip(s.fontName)),l("/Encoding /"+s.encoding),l("/DescendantFonts ["+S+" 0 R]"),l(">>"),l("endobj"),s.isAlreadyPutted=!0}})(a)}]),e.events.push(["putFont",function(a){(function(o){var s=o.font,l=o.out,c=o.newObject,f=o.putStream;if(s.metadata instanceof t.API.TTFFont&&s.encoding==="WinAnsiEncoding"){for(var h=s.metadata.rawData,d="",p=0;p<h.length;p++)d+=String.fromCharCode(h[p]);var y=c();f({data:d,addLength1:!0,objectId:y}),l("endobj");var w=c();f({data:n(s.metadata.toUnicode),addLength1:!0,objectId:w}),l("endobj");var x=c();l("<<"),l("/Descent "+s.metadata.decender),l("/CapHeight "+s.metadata.capHeight),l("/StemV "+s.metadata.stemV),l("/Type /FontDescriptor"),l("/FontFile2 "+y+" 0 R"),l("/Flags 96"),l("/FontBBox "+t.API.PDFObject.convert(s.metadata.bbox)),l("/FontName /"+ip(s.fontName)),l("/ItalicAngle "+s.metadata.italicAngle),l("/Ascent "+s.metadata.ascender),l(">>"),l("endobj"),s.objectNumber=c();for(var b=0;b<s.metadata.hmtx.widths.length;b++)s.metadata.hmtx.widths[b]=parseInt(s.metadata.hmtx.widths[b]*(1e3/s.metadata.head.unitsPerEm));l("<</Subtype/TrueType/Type/Font/ToUnicode "+w+" 0 R/BaseFont/"+ip(s.fontName)+"/FontDescriptor "+x+" 0 R/Encoding/"+s.encoding+" /FirstChar 29 /LastChar 255 /Widths "+t.API.PDFObject.convert(s.metadata.hmtx.widths)+">>"),l("endobj"),s.isAlreadyPutted=!0}})(a)}]);var i=function(a){var o,s=a.text||"",l=a.x,c=a.y,f=a.options||{},h=a.mutex||{},d=h.pdfEscape,p=h.activeFontKey,y=h.fonts,w=p,x="",b=0,S="",E=y[w].encoding;if(y[w].encoding!=="Identity-H")return{text:s,x:l,y:c,options:f,mutex:h};for(S=s,w=p,Array.isArray(s)&&(S=s[0]),b=0;b<S.length;b+=1)y[w].metadata.hasOwnProperty("cmap")&&(o=y[w].metadata.cmap.unicode.codeMap[S[b].charCodeAt(0)]),o||S[b].charCodeAt(0)<256&&y[w].metadata.hasOwnProperty("Unicode")?x+=S[b]:x+="";var _="";return parseInt(w.slice(1))<14||E==="WinAnsiEncoding"?_=d(x,w).split("").map(function(P){return P.charCodeAt(0).toString(16)}).join(""):E==="Identity-H"&&(_=r(x,y[w])),h.isHex=!0,{text:_,x:l,y:c,options:f,mutex:h}};e.events.push(["postProcessText",function(a){var o=a.text||"",s=[],l={text:o,x:a.x,y:a.y,options:a.options,mutex:a.mutex};if(Array.isArray(o)){var c=0;for(c=0;c<o.length;c+=1)Array.isArray(o[c])&&o[c].length===3?s.push([i(Object.assign({},l,{text:o[c][0]})).text,o[c][1],o[c][2]]):s.push(i(Object.assign({},l,{text:o[c]})).text);a.text=s}else a.text=i(Object.assign({},l,{text:o})).text}])})(cr),(function(t){var e=function(){return this.internal.vFS===void 0&&(this.internal.vFS={}),!0};t.existsFileInVFS=function(r){return e.call(this),this.internal.vFS[r]!==void 0},t.addFileToVFS=function(r,n){return e.call(this),this.internal.vFS[r]=n,this},t.getFileFromVFS=function(r){return e.call(this),this.internal.vFS[r]!==void 0?this.internal.vFS[r]:null}})(cr.API),(function(t){t.__bidiEngine__=t.prototype.__bidiEngine__=function(n){var i,a,o,s,l,c,f,h=e,d=[[0,3,0,1,0,0,0],[0,3,0,1,2,2,0],[0,3,0,17,2,0,1],[0,3,5,5,4,1,0],[0,3,21,21,4,0,1],[0,3,5,5,4,2,0]],p=[[2,0,1,1,0,1,0],[2,0,1,1,0,2,0],[2,0,2,1,3,2,0],[2,0,2,33,3,1,1]],y={L:0,R:1,EN:2,AN:3,N:4,B:5,S:6},w={0:0,5:1,6:2,7:3,32:4,251:5,254:6,255:7},x=["(",")","(","<",">","<","[","]","[","{","}","{","«","»","«","‹","›","‹","⁅","⁆","⁅","⁽","⁾","⁽","₍","₎","₍","≤","≥","≤","〈","〉","〈","﹙","﹚","﹙","﹛","﹜","﹛","﹝","﹞","﹝","﹤","﹥","﹤"],b=new RegExp(/^([1-4|9]|1[0-9]|2[0-9]|3[0168]|4[04589]|5[012]|7[78]|159|16[0-9]|17[0-2]|21[569]|22[03489]|250)$/),S=!1,E=0;this.__bidiEngine__={};var _=function(T){var L=T.charCodeAt(),H=L>>8,q=w[H];return q!==void 0?h[256*q+(255&L)]:H===252||H===253?"AL":b.test(H)?"L":H===8?"R":"N"},P=function(T){for(var L,H=0;H<T.length;H++){if((L=_(T.charAt(H)))==="L")return!1;if(L==="R")return!0}return!1},N=function(T,L,H,q){var ee,se,te,Z,ne=L[q];switch(ne){case"L":case"R":case"LRE":case"RLE":case"LRO":case"RLO":case"PDF":S=!1;break;case"N":case"AN":break;case"EN":S&&(ne="AN");break;case"AL":S=!0,ne="R";break;case"WS":case"BN":ne="N";break;case"CS":q<1||q+1>=L.length||(ee=H[q-1])!=="EN"&&ee!=="AN"||(se=L[q+1])!=="EN"&&se!=="AN"?ne="N":S&&(se="AN"),ne=se===ee?se:"N";break;case"ES":ne=(ee=q>0?H[q-1]:"B")==="EN"&&q+1<L.length&&L[q+1]==="EN"?"EN":"N";break;case"ET":if(q>0&&H[q-1]==="EN"){ne="EN";break}if(S){ne="N";break}for(te=q+1,Z=L.length;te<Z&&L[te]==="ET";)te++;ne=te<Z&&L[te]==="EN"?"EN":"N";break;case"NSM":if(o&&!s){for(Z=L.length,te=q+1;te<Z&&L[te]==="NSM";)te++;if(te<Z){var Y=T[q],j=Y>=1425&&Y<=2303||Y===64286;if(ee=L[te],j&&(ee==="R"||ee==="AL")){ne="R";break}}}ne=q<1||(ee=L[q-1])==="B"?"N":H[q-1];break;case"B":S=!1,i=!0,ne=E;break;case"S":a=!0,ne="N"}return ne},C=function(T,L,H){var q=T.split("");return H&&O(q,H,{hiLevel:E}),q.reverse(),L&&L.reverse(),q.join("")},O=function(T,L,H){var q,ee,se,te,Z,ne=-1,Y=T.length,j=0,B=[],z=E?p:d,X=[];for(S=!1,i=!1,a=!1,ee=0;ee<Y;ee++)X[ee]=_(T[ee]);for(se=0;se<Y;se++){if(Z=j,B[se]=N(T,X,B,se),q=240&(j=z[Z][y[B[se]]]),j&=15,L[se]=te=z[j][5],q>0)if(q===16){for(ee=ne;ee<se;ee++)L[ee]=1;ne=-1}else ne=-1;if(z[j][6])ne===-1&&(ne=se);else if(ne>-1){for(ee=ne;ee<se;ee++)L[ee]=te;ne=-1}X[se]==="B"&&(L[se]=0),H.hiLevel|=te}a&&(function(J,K,ie){for(var he=0;he<ie;he++)if(J[he]==="S"){K[he]=E;for(var ue=he-1;ue>=0&&J[ue]==="WS";ue--)K[ue]=E}})(X,L,Y)},M=function(T,L,H,q,ee){if(!(ee.hiLevel<T)){if(T===1&&E===1&&!i)return L.reverse(),void(H&&H.reverse());for(var se,te,Z,ne,Y=L.length,j=0;j<Y;){if(q[j]>=T){for(Z=j+1;Z<Y&&q[Z]>=T;)Z++;for(ne=j,te=Z-1;ne<te;ne++,te--)se=L[ne],L[ne]=L[te],L[te]=se,H&&(se=H[ne],H[ne]=H[te],H[te]=se);j=Z}j++}}},F=function(T,L,H){var q=T.split(""),ee={hiLevel:E};return H||(H=[]),O(q,H,ee),(function(se,te,Z){if(Z.hiLevel!==0&&f)for(var ne,Y=0;Y<se.length;Y++)te[Y]===1&&(ne=x.indexOf(se[Y]))>=0&&(se[Y]=x[ne+1])})(q,H,ee),M(2,q,L,H,ee),M(1,q,L,H,ee),q.join("")};return this.__bidiEngine__.doBidiReorder=function(T,L,H){if((function(ee,se){if(se)for(var te=0;te<ee.length;te++)se[te]=te;s===void 0&&(s=P(ee)),c===void 0&&(c=P(ee))})(T,L),o||!l||c)if(o&&l&&s^c)E=s?1:0,T=C(T,L,H);else if(!o&&l&&c)E=s?1:0,T=F(T,L,H),T=C(T,L);else if(!o||s||l||c){if(o&&!l&&s^c)T=C(T,L),s?(E=0,T=F(T,L,H)):(E=1,T=F(T,L,H),T=C(T,L));else if(o&&s&&!l&&c)E=1,T=F(T,L,H),T=C(T,L);else if(!o&&!l&&s^c){var q=f;s?(E=1,T=F(T,L,H),E=0,f=!1,T=F(T,L,H),f=q):(E=0,T=F(T,L,H),T=C(T,L),E=1,f=!1,T=F(T,L,H),f=q,T=C(T,L))}}else E=0,T=F(T,L,H);else E=s?1:0,T=F(T,L,H);return T},this.__bidiEngine__.setOptions=function(T){T&&(o=T.isInputVisual,l=T.isOutputVisual,s=T.isInputRtl,c=T.isOutputRtl,f=T.isSymmetricSwapping)},this.__bidiEngine__.setOptions(n),this.__bidiEngine__};var e=["BN","BN","BN","BN","BN","BN","BN","BN","BN","S","B","S","WS","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","B","B","B","S","WS","N","N","ET","ET","ET","N","N","N","N","N","ES","CS","ES","CS","CS","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","CS","N","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","N","BN","BN","BN","BN","BN","BN","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","CS","N","ET","ET","ET","ET","N","N","N","N","L","N","N","BN","N","N","ET","ET","EN","EN","N","L","N","N","N","EN","L","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","L","L","L","L","L","L","L","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","L","N","N","N","N","N","ET","N","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","R","NSM","R","NSM","NSM","R","NSM","NSM","R","NSM","N","N","N","N","N","N","N","N","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","N","N","N","N","N","R","R","R","R","R","N","N","N","N","N","N","N","N","N","N","N","AN","AN","AN","AN","AN","AN","N","N","AL","ET","ET","AL","CS","AL","N","N","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","AL","AL","N","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","AN","AN","AN","AN","AN","AN","AN","AN","AN","AN","ET","AN","AN","AL","AL","AL","NSM","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","AN","N","NSM","NSM","NSM","NSM","NSM","NSM","AL","AL","NSM","NSM","N","NSM","NSM","NSM","NSM","AL","AL","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","N","AL","AL","NSM","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","N","N","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","AL","N","N","N","N","N","N","N","N","N","N","N","N","N","N","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","R","R","N","N","N","N","R","N","N","N","N","N","WS","WS","WS","WS","WS","WS","WS","WS","WS","WS","WS","BN","BN","BN","L","R","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","WS","B","LRE","RLE","PDF","LRO","RLO","CS","ET","ET","ET","ET","ET","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","CS","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","WS","BN","BN","BN","BN","BN","N","LRI","RLI","FSI","PDI","BN","BN","BN","BN","BN","BN","EN","L","N","N","EN","EN","EN","EN","EN","EN","ES","ES","N","N","N","L","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","ES","ES","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","L","L","L","L","L","L","L","N","N","N","N","N","N","N","N","N","N","N","N","L","L","L","L","L","N","N","N","N","N","R","NSM","R","R","R","R","R","R","R","R","R","R","ES","R","R","R","R","R","R","R","R","R","R","R","R","R","N","R","R","R","R","R","N","R","N","R","R","N","R","R","N","R","R","R","R","R","R","R","R","R","R","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","CS","N","CS","N","N","CS","N","N","N","N","N","N","N","N","N","ET","N","N","ES","ES","N","N","N","N","N","ET","ET","N","N","N","N","N","AL","AL","AL","AL","AL","N","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","N","N","BN","N","N","N","ET","ET","ET","N","N","N","N","N","ES","CS","ES","CS","CS","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","CS","N","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","N","N","N","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","L","L","L","L","L","L","N","N","L","L","L","L","L","L","N","N","L","L","L","L","L","L","N","N","L","L","L","N","N","N","ET","ET","N","N","N","ET","ET","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N"],r=new t.__bidiEngine__({isInputVisual:!0});t.API.events.push(["postProcessText",function(n){var i=n.text;n.x,n.y;var a=n.options||{};n.mutex,a.lang;var o=[];if(a.isInputVisual=typeof a.isInputVisual!="boolean"||a.isInputVisual,r.setOptions(a),Object.prototype.toString.call(i)==="[object Array]"){var s=0;for(o=[],s=0;s<i.length;s+=1)Object.prototype.toString.call(i[s])==="[object Array]"?o.push([r.doBidiReorder(i[s][0]),i[s][1],i[s][2]]):o.push([r.doBidiReorder(i[s])]);n.text=o}else n.text=r.doBidiReorder(i);r.setOptions({isInputVisual:!0})}])})(cr),cr.API.TTFFont=(function(){function t(e){var r;if(this.rawData=e,r=this.contents=new hh(e),this.contents.pos=4,r.readString(4)==="ttcf")throw new Error("TTCF not supported.");r.pos=0,this.parse(),this.subset=new Pq(this),this.registerTTF()}return t.open=function(e){return new t(e)},t.prototype.parse=function(){return this.directory=new hq(this.contents),this.head=new pq(this),this.name=new bq(this),this.cmap=new oE(this),this.toUnicode={},this.hhea=new gq(this),this.maxp=new wq(this),this.hmtx=new xq(this),this.post=new vq(this),this.os2=new mq(this),this.loca=new Eq(this),this.glyf=new Sq(this),this.ascender=this.os2.exists&&this.os2.ascender||this.hhea.ascender,this.decender=this.os2.exists&&this.os2.decender||this.hhea.decender,this.lineGap=this.os2.exists&&this.os2.lineGap||this.hhea.lineGap,this.bbox=[this.head.xMin,this.head.yMin,this.head.xMax,this.head.yMax]},t.prototype.registerTTF=function(){var e,r,n,i,a;if(this.scaleFactor=1e3/this.head.unitsPerEm,this.bbox=(function(){var o,s,l,c;for(c=[],o=0,s=(l=this.bbox).length;o<s;o++)e=l[o],c.push(Math.round(e*this.scaleFactor));return c}).call(this),this.stemV=0,this.post.exists?(n=255&(i=this.post.italic_angle),32768&(r=i>>16)&&(r=-(1+(65535^r))),this.italicAngle=+(r+"."+n)):this.italicAngle=0,this.ascender=Math.round(this.ascender*this.scaleFactor),this.decender=Math.round(this.decender*this.scaleFactor),this.lineGap=Math.round(this.lineGap*this.scaleFactor),this.capHeight=this.os2.exists&&this.os2.capHeight||this.ascender,this.xHeight=this.os2.exists&&this.os2.xHeight||0,this.familyClass=(this.os2.exists&&this.os2.familyClass||0)>>8,this.isSerif=(a=this.familyClass)===1||a===2||a===3||a===4||a===5||a===7,this.isScript=this.familyClass===10,this.flags=0,this.post.isFixedPitch&&(this.flags|=1),this.isSerif&&(this.flags|=2),this.isScript&&(this.flags|=8),this.italicAngle!==0&&(this.flags|=64),this.flags|=32,!this.cmap.unicode)throw new Error("No unicode cmap for font")},t.prototype.characterToGlyph=function(e){var r;return((r=this.cmap.unicode)!=null?r.codeMap[e]:void 0)||0},t.prototype.widthOfGlyph=function(e){var r;return r=1e3/this.head.unitsPerEm,this.hmtx.forGlyph(e).advance*r},t.prototype.widthOfString=function(e,r,n){var i,a,o,s;for(o=0,a=0,s=(e=""+e).length;0<=s?a<s:a>s;a=0<=s?++a:--a)i=e.charCodeAt(a),o+=this.widthOfGlyph(this.characterToGlyph(i))+n*(1e3/r)||0;return o*(r/1e3)},t.prototype.lineHeight=function(e,r){var n;return r==null&&(r=!1),n=r?this.lineGap:0,(this.ascender+n-this.decender)/1e3*e},t})();var Mu,hh=(function(){function t(e){this.data=e??[],this.pos=0,this.length=this.data.length}return t.prototype.readByte=function(){return this.data[this.pos++]},t.prototype.writeByte=function(e){return this.data[this.pos++]=e},t.prototype.readUInt32=function(){return 16777216*this.readByte()+(this.readByte()<<16)+(this.readByte()<<8)+this.readByte()},t.prototype.writeUInt32=function(e){return this.writeByte(e>>>24&255),this.writeByte(e>>16&255),this.writeByte(e>>8&255),this.writeByte(255&e)},t.prototype.readInt32=function(){var e;return(e=this.readUInt32())>=2147483648?e-4294967296:e},t.prototype.writeInt32=function(e){return e<0&&(e+=4294967296),this.writeUInt32(e)},t.prototype.readUInt16=function(){return this.readByte()<<8|this.readByte()},t.prototype.writeUInt16=function(e){return this.writeByte(e>>8&255),this.writeByte(255&e)},t.prototype.readInt16=function(){var e;return(e=this.readUInt16())>=32768?e-65536:e},t.prototype.writeInt16=function(e){return e<0&&(e+=65536),this.writeUInt16(e)},t.prototype.readString=function(e){var r,n;for(n=[],r=0;0<=e?r<e:r>e;r=0<=e?++r:--r)n[r]=String.fromCharCode(this.readByte());return n.join("")},t.prototype.writeString=function(e){var r,n,i;for(i=[],r=0,n=e.length;0<=n?r<n:r>n;r=0<=n?++r:--r)i.push(this.writeByte(e.charCodeAt(r)));return i},t.prototype.readShort=function(){return this.readInt16()},t.prototype.writeShort=function(e){return this.writeInt16(e)},t.prototype.readLongLong=function(){var e,r,n,i,a,o,s,l;return e=this.readByte(),r=this.readByte(),n=this.readByte(),i=this.readByte(),a=this.readByte(),o=this.readByte(),s=this.readByte(),l=this.readByte(),128&e?-1*(72057594037927940*(255^e)+281474976710656*(255^r)+1099511627776*(255^n)+4294967296*(255^i)+16777216*(255^a)+65536*(255^o)+256*(255^s)+(255^l)+1):72057594037927940*e+281474976710656*r+1099511627776*n+4294967296*i+16777216*a+65536*o+256*s+l},t.prototype.writeLongLong=function(e){var r,n;return r=Math.floor(e/4294967296),n=4294967295&e,this.writeByte(r>>24&255),this.writeByte(r>>16&255),this.writeByte(r>>8&255),this.writeByte(255&r),this.writeByte(n>>24&255),this.writeByte(n>>16&255),this.writeByte(n>>8&255),this.writeByte(255&n)},t.prototype.readInt=function(){return this.readInt32()},t.prototype.writeInt=function(e){return this.writeInt32(e)},t.prototype.read=function(e){var r,n;for(r=[],n=0;0<=e?n<e:n>e;n=0<=e?++n:--n)r.push(this.readByte());return r},t.prototype.write=function(e){var r,n,i,a;for(a=[],n=0,i=e.length;n<i;n++)r=e[n],a.push(this.writeByte(r));return a},t})(),hq=(function(){var t;function e(r){var n,i,a;for(this.scalarType=r.readInt(),this.tableCount=r.readShort(),this.searchRange=r.readShort(),this.entrySelector=r.readShort(),this.rangeShift=r.readShort(),this.tables={},i=0,a=this.tableCount;0<=a?i<a:i>a;i=0<=a?++i:--i)n={tag:r.readString(4),checksum:r.readInt(),offset:r.readInt(),length:r.readInt()},this.tables[n.tag]=n}return e.prototype.encode=function(r){var n,i,a,o,s,l,c,f,h,d,p,y,w;for(w in p=Object.keys(r).length,l=Math.log(2),h=16*Math.floor(Math.log(p)/l),o=Math.floor(h/l),f=16*p-h,(i=new hh).writeInt(this.scalarType),i.writeShort(p),i.writeShort(h),i.writeShort(o),i.writeShort(f),a=16*p,c=i.pos+a,s=null,y=[],r)for(d=r[w],i.writeString(w),i.writeInt(t(d)),i.writeInt(c),i.writeInt(d.length),y=y.concat(d),w==="head"&&(s=c),c+=d.length;c%4;)y.push(0),c++;return i.write(y),n=2981146554-t(i.data),i.pos=s+8,i.writeUInt32(n),i.data},t=function(r){var n,i,a,o;for(r=sE.call(r);r.length%4;)r.push(0);for(a=new hh(r),i=0,n=0,o=r.length;n<o;n=n+=4)i+=a.readUInt32();return 4294967295&i},e})(),dq={}.hasOwnProperty,Sc=function(t,e){for(var r in e)dq.call(e,r)&&(t[r]=e[r]);function n(){this.constructor=t}return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t};Mu=(function(){function t(e){var r;this.file=e,r=this.file.directory.tables[this.tag],this.exists=!!r,r&&(this.offset=r.offset,this.length=r.length,this.parse(this.file.contents))}return t.prototype.parse=function(){},t.prototype.encode=function(){},t.prototype.raw=function(){return this.exists?(this.file.contents.pos=this.offset,this.file.contents.read(this.length)):null},t})();var pq=(function(){function t(){return t.__super__.constructor.apply(this,arguments)}return Sc(t,Mu),t.prototype.tag="head",t.prototype.parse=function(e){return e.pos=this.offset,this.version=e.readInt(),this.revision=e.readInt(),this.checkSumAdjustment=e.readInt(),this.magicNumber=e.readInt(),this.flags=e.readShort(),this.unitsPerEm=e.readShort(),this.created=e.readLongLong(),this.modified=e.readLongLong(),this.xMin=e.readShort(),this.yMin=e.readShort(),this.xMax=e.readShort(),this.yMax=e.readShort(),this.macStyle=e.readShort(),this.lowestRecPPEM=e.readShort(),this.fontDirectionHint=e.readShort(),this.indexToLocFormat=e.readShort(),this.glyphDataFormat=e.readShort()},t.prototype.encode=function(e){var r;return(r=new hh).writeInt(this.version),r.writeInt(this.revision),r.writeInt(this.checkSumAdjustment),r.writeInt(this.magicNumber),r.writeShort(this.flags),r.writeShort(this.unitsPerEm),r.writeLongLong(this.created),r.writeLongLong(this.modified),r.writeShort(this.xMin),r.writeShort(this.yMin),r.writeShort(this.xMax),r.writeShort(this.yMax),r.writeShort(this.macStyle),r.writeShort(this.lowestRecPPEM),r.writeShort(this.fontDirectionHint),r.writeShort(e),r.writeShort(this.glyphDataFormat),r.data},t})(),Qx=(function(){function t(e,r){var n,i,a,o,s,l,c,f,h,d,p,y,w,x,b,S,E;switch(this.platformID=e.readUInt16(),this.encodingID=e.readShort(),this.offset=r+e.readInt(),h=e.pos,e.pos=this.offset,this.format=e.readUInt16(),this.length=e.readUInt16(),this.language=e.readUInt16(),this.isUnicode=this.platformID===3&&this.encodingID===1&&this.format===4||this.platformID===0&&this.format===4,this.codeMap={},this.format){case 0:for(l=0;l<256;++l)this.codeMap[l]=e.readByte();break;case 4:for(p=e.readUInt16(),d=p/2,e.pos+=6,a=(function(){var _,P;for(P=[],l=_=0;0<=d?_<d:_>d;l=0<=d?++_:--_)P.push(e.readUInt16());return P})(),e.pos+=2,w=(function(){var _,P;for(P=[],l=_=0;0<=d?_<d:_>d;l=0<=d?++_:--_)P.push(e.readUInt16());return P})(),c=(function(){var _,P;for(P=[],l=_=0;0<=d?_<d:_>d;l=0<=d?++_:--_)P.push(e.readUInt16());return P})(),f=(function(){var _,P;for(P=[],l=_=0;0<=d?_<d:_>d;l=0<=d?++_:--_)P.push(e.readUInt16());return P})(),i=(this.length-e.pos+this.offset)/2,s=(function(){var _,P;for(P=[],l=_=0;0<=i?_<i:_>i;l=0<=i?++_:--_)P.push(e.readUInt16());return P})(),l=b=0,E=a.length;b<E;l=++b)for(x=a[l],n=S=y=w[l];y<=x?S<=x:S>=x;n=y<=x?++S:--S)f[l]===0?o=n+c[l]:(o=s[f[l]/2+(n-y)-(d-l)]||0)!==0&&(o+=c[l]),this.codeMap[n]=65535&o}e.pos=h}return t.encode=function(e,r){var n,i,a,o,s,l,c,f,h,d,p,y,w,x,b,S,E,_,P,N,C,O,M,F,T,L,H,q,ee,se,te,Z,ne,Y,j,B,z,X,J,K,ie,he,ue,we,Te,qe;switch(q=new hh,o=Object.keys(e).sort(function(ze,rt){return ze-rt}),r){case"macroman":for(w=0,x=(function(){var ze=[];for(y=0;y<256;++y)ze.push(0);return ze})(),S={0:0},a={},ee=0,ne=o.length;ee<ne;ee++)S[ue=e[i=o[ee]]]==null&&(S[ue]=++w),a[i]={old:e[i],new:S[e[i]]},x[i]=S[e[i]];return q.writeUInt16(1),q.writeUInt16(0),q.writeUInt32(12),q.writeUInt16(0),q.writeUInt16(262),q.writeUInt16(0),q.write(x),{charMap:a,subtable:q.data,maxGlyphID:w+1};case"unicode":for(L=[],h=[],E=0,S={},n={},b=c=null,se=0,Y=o.length;se<Y;se++)S[P=e[i=o[se]]]==null&&(S[P]=++E),n[i]={old:P,new:S[P]},s=S[P]-i,b!=null&&s===c||(b&&h.push(b),L.push(i),c=s),b=i;for(b&&h.push(b),h.push(65535),L.push(65535),F=2*(M=L.length),O=2*Math.pow(Math.log(M)/Math.LN2,2),d=Math.log(O/2)/Math.LN2,C=2*M-O,l=[],N=[],p=[],y=te=0,j=L.length;te<j;y=++te){if(T=L[y],f=h[y],T===65535){l.push(0),N.push(0);break}if(T-(H=n[T].new)>=32768)for(l.push(0),N.push(2*(p.length+M-y)),i=Z=T;T<=f?Z<=f:Z>=f;i=T<=f?++Z:--Z)p.push(n[i].new);else l.push(H-T),N.push(0)}for(q.writeUInt16(3),q.writeUInt16(1),q.writeUInt32(12),q.writeUInt16(4),q.writeUInt16(16+8*M+2*p.length),q.writeUInt16(0),q.writeUInt16(F),q.writeUInt16(O),q.writeUInt16(d),q.writeUInt16(C),ie=0,B=h.length;ie<B;ie++)i=h[ie],q.writeUInt16(i);for(q.writeUInt16(0),he=0,z=L.length;he<z;he++)i=L[he],q.writeUInt16(i);for(we=0,X=l.length;we<X;we++)s=l[we],q.writeUInt16(s);for(Te=0,J=N.length;Te<J;Te++)_=N[Te],q.writeUInt16(_);for(qe=0,K=p.length;qe<K;qe++)w=p[qe],q.writeUInt16(w);return{charMap:n,subtable:q.data,maxGlyphID:E+1}}},t})(),oE=(function(){function t(){return t.__super__.constructor.apply(this,arguments)}return Sc(t,Mu),t.prototype.tag="cmap",t.prototype.parse=function(e){var r,n,i;for(e.pos=this.offset,this.version=e.readUInt16(),i=e.readUInt16(),this.tables=[],this.unicode=null,n=0;0<=i?n<i:n>i;n=0<=i?++n:--n)r=new Qx(e,this.offset),this.tables.push(r),r.isUnicode&&this.unicode==null&&(this.unicode=r);return!0},t.encode=function(e,r){var n,i;return r==null&&(r="macroman"),n=Qx.encode(e,r),(i=new hh).writeUInt16(0),i.writeUInt16(1),n.table=i.data.concat(n.subtable),n},t})(),gq=(function(){function t(){return t.__super__.constructor.apply(this,arguments)}return Sc(t,Mu),t.prototype.tag="hhea",t.prototype.parse=function(e){return e.pos=this.offset,this.version=e.readInt(),this.ascender=e.readShort(),this.decender=e.readShort(),this.lineGap=e.readShort(),this.advanceWidthMax=e.readShort(),this.minLeftSideBearing=e.readShort(),this.minRightSideBearing=e.readShort(),this.xMaxExtent=e.readShort(),this.caretSlopeRise=e.readShort(),this.caretSlopeRun=e.readShort(),this.caretOffset=e.readShort(),e.pos+=8,this.metricDataFormat=e.readShort(),this.numberOfMetrics=e.readUInt16()},t})(),mq=(function(){function t(){return t.__super__.constructor.apply(this,arguments)}return Sc(t,Mu),t.prototype.tag="OS/2",t.prototype.parse=function(e){if(e.pos=this.offset,this.version=e.readUInt16(),this.averageCharWidth=e.readShort(),this.weightClass=e.readUInt16(),this.widthClass=e.readUInt16(),this.type=e.readShort(),this.ySubscriptXSize=e.readShort(),this.ySubscriptYSize=e.readShort(),this.ySubscriptXOffset=e.readShort(),this.ySubscriptYOffset=e.readShort(),this.ySuperscriptXSize=e.readShort(),this.ySuperscriptYSize=e.readShort(),this.ySuperscriptXOffset=e.readShort(),this.ySuperscriptYOffset=e.readShort(),this.yStrikeoutSize=e.readShort(),this.yStrikeoutPosition=e.readShort(),this.familyClass=e.readShort(),this.panose=(function(){var r,n;for(n=[],r=0;r<10;++r)n.push(e.readByte());return n})(),this.charRange=(function(){var r,n;for(n=[],r=0;r<4;++r)n.push(e.readInt());return n})(),this.vendorID=e.readString(4),this.selection=e.readShort(),this.firstCharIndex=e.readShort(),this.lastCharIndex=e.readShort(),this.version>0&&(this.ascent=e.readShort(),this.descent=e.readShort(),this.lineGap=e.readShort(),this.winAscent=e.readShort(),this.winDescent=e.readShort(),this.codePageRange=(function(){var r,n;for(n=[],r=0;r<2;r=++r)n.push(e.readInt());return n})(),this.version>1))return this.xHeight=e.readShort(),this.capHeight=e.readShort(),this.defaultChar=e.readShort(),this.breakChar=e.readShort(),this.maxContext=e.readShort()},t})(),vq=(function(){function t(){return t.__super__.constructor.apply(this,arguments)}return Sc(t,Mu),t.prototype.tag="post",t.prototype.parse=function(e){var r,n,i;switch(e.pos=this.offset,this.format=e.readInt(),this.italicAngle=e.readInt(),this.underlinePosition=e.readShort(),this.underlineThickness=e.readShort(),this.isFixedPitch=e.readInt(),this.minMemType42=e.readInt(),this.maxMemType42=e.readInt(),this.minMemType1=e.readInt(),this.maxMemType1=e.readInt(),this.format){case 65536:case 196608:break;case 131072:var a;for(n=e.readUInt16(),this.glyphNameIndex=[],a=0;0<=n?a<n:a>n;a=0<=n?++a:--a)this.glyphNameIndex.push(e.readUInt16());for(this.names=[],i=[];e.pos<this.offset+this.length;)r=e.readByte(),i.push(this.names.push(e.readString(r)));return i;case 151552:return n=e.readUInt16(),this.offsets=e.read(n);case 262144:return this.map=(function(){var o,s,l;for(l=[],a=o=0,s=this.file.maxp.numGlyphs;0<=s?o<s:o>s;a=0<=s?++o:--o)l.push(e.readUInt32());return l}).call(this)}},t})(),yq=function(t,e){this.raw=t,this.length=t.length,this.platformID=e.platformID,this.encodingID=e.encodingID,this.languageID=e.languageID},bq=(function(){function t(){return t.__super__.constructor.apply(this,arguments)}return Sc(t,Mu),t.prototype.tag="name",t.prototype.parse=function(e){var r,n,i,a,o,s,l,c,f,h,d;for(e.pos=this.offset,e.readShort(),r=e.readShort(),s=e.readShort(),n=[],a=0;0<=r?a<r:a>r;a=0<=r?++a:--a)n.push({platformID:e.readShort(),encodingID:e.readShort(),languageID:e.readShort(),nameID:e.readShort(),length:e.readShort(),offset:this.offset+s+e.readShort()});for(l={},a=f=0,h=n.length;f<h;a=++f)i=n[a],e.pos=i.offset,c=e.readString(i.length),o=new yq(c,i),l[d=i.nameID]==null&&(l[d]=[]),l[i.nameID].push(o);this.strings=l,this.copyright=l[0],this.fontFamily=l[1],this.fontSubfamily=l[2],this.uniqueSubfamily=l[3],this.fontName=l[4],this.version=l[5];try{this.postscriptName=l[6][0].raw.replace(/[\x00-\x19\x80-\xff]/g,"")}catch{this.postscriptName=l[4][0].raw.replace(/[\x00-\x19\x80-\xff]/g,"")}return this.trademark=l[7],this.manufacturer=l[8],this.designer=l[9],this.description=l[10],this.vendorUrl=l[11],this.designerUrl=l[12],this.license=l[13],this.licenseUrl=l[14],this.preferredFamily=l[15],this.preferredSubfamily=l[17],this.compatibleFull=l[18],this.sampleText=l[19]},t})(),wq=(function(){function t(){return t.__super__.constructor.apply(this,arguments)}return Sc(t,Mu),t.prototype.tag="maxp",t.prototype.parse=function(e){return e.pos=this.offset,this.version=e.readInt(),this.numGlyphs=e.readUInt16(),this.maxPoints=e.readUInt16(),this.maxContours=e.readUInt16(),this.maxCompositePoints=e.readUInt16(),this.maxComponentContours=e.readUInt16(),this.maxZones=e.readUInt16(),this.maxTwilightPoints=e.readUInt16(),this.maxStorage=e.readUInt16(),this.maxFunctionDefs=e.readUInt16(),this.maxInstructionDefs=e.readUInt16(),this.maxStackElements=e.readUInt16(),this.maxSizeOfInstructions=e.readUInt16(),this.maxComponentElements=e.readUInt16(),this.maxComponentDepth=e.readUInt16()},t})(),xq=(function(){function t(){return t.__super__.constructor.apply(this,arguments)}return Sc(t,Mu),t.prototype.tag="hmtx",t.prototype.parse=function(e){var r,n,i,a,o,s,l;for(e.pos=this.offset,this.metrics=[],r=0,s=this.file.hhea.numberOfMetrics;0<=s?r<s:r>s;r=0<=s?++r:--r)this.metrics.push({advance:e.readUInt16(),lsb:e.readInt16()});for(i=this.file.maxp.numGlyphs-this.file.hhea.numberOfMetrics,this.leftSideBearings=(function(){var c,f;for(f=[],r=c=0;0<=i?c<i:c>i;r=0<=i?++c:--c)f.push(e.readInt16());return f})(),this.widths=(function(){var c,f,h,d;for(d=[],c=0,f=(h=this.metrics).length;c<f;c++)a=h[c],d.push(a.advance);return d}).call(this),n=this.widths[this.widths.length-1],l=[],r=o=0;0<=i?o<i:o>i;r=0<=i?++o:--o)l.push(this.widths.push(n));return l},t.prototype.forGlyph=function(e){return e in this.metrics?this.metrics[e]:{advance:this.metrics[this.metrics.length-1].advance,lsb:this.leftSideBearings[e-this.metrics.length]}},t})(),sE=[].slice,Sq=(function(){function t(){return t.__super__.constructor.apply(this,arguments)}return Sc(t,Mu),t.prototype.tag="glyf",t.prototype.parse=function(){return this.cache={}},t.prototype.glyphFor=function(e){var r,n,i,a,o,s,l,c,f,h;return e in this.cache?this.cache[e]:(a=this.file.loca,r=this.file.contents,n=a.indexOf(e),(i=a.lengthOf(e))===0?this.cache[e]=null:(r.pos=this.offset+n,o=(s=new hh(r.read(i))).readShort(),c=s.readShort(),h=s.readShort(),l=s.readShort(),f=s.readShort(),this.cache[e]=o===-1?new kq(s,c,h,l,f):new _q(s,o,c,h,l,f),this.cache[e]))},t.prototype.encode=function(e,r,n){var i,a,o,s,l;for(o=[],a=[],s=0,l=r.length;s<l;s++)i=e[r[s]],a.push(o.length),i&&(o=o.concat(i.encode(n)));return a.push(o.length),{table:o,offsets:a}},t})(),_q=(function(){function t(e,r,n,i,a,o){this.raw=e,this.numberOfContours=r,this.xMin=n,this.yMin=i,this.xMax=a,this.yMax=o,this.compound=!1}return t.prototype.encode=function(){return this.raw.data},t})(),kq=(function(){function t(e,r,n,i,a){var o,s;for(this.raw=e,this.xMin=r,this.yMin=n,this.xMax=i,this.yMax=a,this.compound=!0,this.glyphIDs=[],this.glyphOffsets=[],o=this.raw;s=o.readShort(),this.glyphOffsets.push(o.pos),this.glyphIDs.push(o.readUInt16()),32&s;)o.pos+=1&s?4:2,128&s?o.pos+=8:64&s?o.pos+=4:8&s&&(o.pos+=2)}return t.prototype.encode=function(){var e,r,n;for(r=new hh(sE.call(this.raw.data)),e=0,n=this.glyphIDs.length;e<n;++e)r.pos=this.glyphOffsets[e];return r.data},t})(),Eq=(function(){function t(){return t.__super__.constructor.apply(this,arguments)}return Sc(t,Mu),t.prototype.tag="loca",t.prototype.parse=function(e){var r,n;return e.pos=this.offset,r=this.file.head.indexToLocFormat,this.offsets=r===0?(function(){var i,a;for(a=[],n=0,i=this.length;n<i;n+=2)a.push(2*e.readUInt16());return a}).call(this):(function(){var i,a;for(a=[],n=0,i=this.length;n<i;n+=4)a.push(e.readUInt32());return a}).call(this)},t.prototype.indexOf=function(e){return this.offsets[e]},t.prototype.lengthOf=function(e){return this.offsets[e+1]-this.offsets[e]},t.prototype.encode=function(e,r){for(var n=new Uint32Array(this.offsets.length),i=0,a=0,o=0;o<n.length;++o)if(n[o]=i,a<r.length&&r[a]==o){++a,n[o]=i;var s=this.offsets[o],l=this.offsets[o+1]-s;l>0&&(i+=l)}for(var c=new Array(4*n.length),f=0;f<n.length;++f)c[4*f+3]=255&n[f],c[4*f+2]=(65280&n[f])>>8,c[4*f+1]=(16711680&n[f])>>16,c[4*f]=(4278190080&n[f])>>24;return c},t})(),Pq=(function(){function t(e){this.font=e,this.subset={},this.unicodes={},this.next=33}return t.prototype.generateCmap=function(){var e,r,n,i,a;for(r in i=this.font.cmap.tables[0].codeMap,e={},a=this.subset)n=a[r],e[r]=i[n];return e},t.prototype.glyphsFor=function(e){var r,n,i,a,o,s,l;for(i={},o=0,s=e.length;o<s;o++)i[a=e[o]]=this.font.glyf.glyphFor(a);for(a in r=[],i)(n=i[a])!=null&&n.compound&&r.push.apply(r,n.glyphIDs);if(r.length>0)for(a in l=this.glyphsFor(r))n=l[a],i[a]=n;return i},t.prototype.encode=function(e,r){var n,i,a,o,s,l,c,f,h,d,p,y,w,x,b;for(i in n=oE.encode(this.generateCmap(),"unicode"),o=this.glyphsFor(e),p={0:0},b=n.charMap)p[(l=b[i]).old]=l.new;for(y in d=n.maxGlyphID,o)y in p||(p[y]=d++);return f=(function(S){var E,_;for(E in _={},S)_[S[E]]=E;return _})(p),h=Object.keys(f).sort(function(S,E){return S-E}),w=(function(){var S,E,_;for(_=[],S=0,E=h.length;S<E;S++)s=h[S],_.push(f[s]);return _})(),a=this.font.glyf.encode(o,w,p),c=this.font.loca.encode(a.offsets,w),x={cmap:this.font.cmap.raw(),glyf:a.table,loca:c,hmtx:this.font.hmtx.raw(),hhea:this.font.hhea.raw(),maxp:this.font.maxp.raw(),post:this.font.post.raw(),name:this.font.name.raw(),head:this.font.head.encode(r)},this.font.os2.exists&&(x["OS/2"]=this.font.os2.raw()),this.font.directory.encode(x)},t})();cr.API.PDFObject=(function(){var t;function e(){}return t=function(r,n){return(Array(n+1).join("0")+r).slice(-n)},e.convert=function(r){var n,i,a,o;if(Array.isArray(r))return"["+(function(){var s,l,c;for(c=[],s=0,l=r.length;s<l;s++)n=r[s],c.push(e.convert(n));return c})().join(" ")+"]";if(typeof r=="string")return"/"+r;if(r?.isString)return"("+r+")";if(r instanceof Date)return"(D:"+t(r.getUTCFullYear(),4)+t(r.getUTCMonth(),2)+t(r.getUTCDate(),2)+t(r.getUTCHours(),2)+t(r.getUTCMinutes(),2)+t(r.getUTCSeconds(),2)+"Z)";if({}.toString.call(r)==="[object Object]"){for(i in a=["<<"],r)o=r[i],a.push("/"+i+" "+e.convert(o));return a.push(">>"),a.join(`
543
- `)}return""+r},e})();window.jspdf={jsPDF:cr};Tt.prototype._requestDraw=()=>{};qN(!1);Y_("change-font-size");const Cq=new URLSearchParams(location.search).get("key"),lE=VB({key:Cq});window.store=lE;let Jy=null;window.loadVideoExportModule=async()=>(Jy||(Jy=Cg(()=>import("./index-TOYj-xbM.js"),[],import.meta.url)),await Jy);window.config={addGlobalFont:YN,setRichTextEnabled:nI,setTextVerticalResizeEnabled:rI,setTextOverflow:Y_,onLoadError:XN,setAssetLoadTimeout:VN,setFontLoadTimeout:$N,unstable_setTextSplitAllowed:aI};const Aq=eS.createRoot(document.getElementById("root"));Aq.render(oe.createElement(Bj,{visiblePagesOffset:0,renderOnlyActivePage:!0,store:lE,components:{PageControls:()=>null,Tooltip:()=>null}}));export{mH as $,Wm as A,L5 as B,zb as C,pH as D,iH as E,aH as F,eH as G,oH as H,rH as I,rh as J,nh as K,i7 as L,qb as M,UM as N,Bo as O,of as P,f7 as Q,D0 as R,Jq as S,Ub as T,ku as U,Zq as V,nH as W,mp as X,MM as Y,Wq as Z,gH as _,$e as a,Yq as a0,n7 as a1,Kq as a2,qq as a3,vH as a4,DF as a5,NF as a6,LF as a7,u8 as a8,$g as a9,Hn as aa,hd as ab,Ip as b,$q as c,td as d,iD as e,wl as f,tH as g,SD as h,Hq as i,YM as j,Xq as k,El as l,ZM as m,hH as n,Gq as o,d7 as p,lH as q,uH as r,fH as s,Vq as t,cH as u,sH as v,_0 as w,ep as x,Qq as y,dH as z};
543
+ `)}return""+r},e})();window.jspdf={jsPDF:cr};Tt.prototype._requestDraw=()=>{};qN(!1);Y_("change-font-size");const Cq=new URLSearchParams(location.search).get("key"),lE=VB({key:Cq});window.store=lE;let Jy=null;window.loadVideoExportModule=async()=>(Jy||(Jy=Cg(()=>import("./index-DyW7HlHt.js"),[],import.meta.url)),await Jy);window.config={addGlobalFont:YN,setRichTextEnabled:nI,setTextVerticalResizeEnabled:rI,setTextOverflow:Y_,onLoadError:XN,setAssetLoadTimeout:VN,setFontLoadTimeout:$N,unstable_setTextSplitAllowed:aI};const Aq=eS.createRoot(document.getElementById("root"));Aq.render(oe.createElement(Bj,{visiblePagesOffset:0,renderOnlyActivePage:!0,store:lE,components:{PageControls:()=>null,Tooltip:()=>null}}));export{mH as $,Wm as A,L5 as B,zb as C,pH as D,iH as E,aH as F,eH as G,oH as H,rH as I,rh as J,nh as K,i7 as L,qb as M,UM as N,Bo as O,of as P,f7 as Q,D0 as R,Jq as S,Ub as T,ku as U,Zq as V,nH as W,mp as X,MM as Y,Wq as Z,gH as _,$e as a,Yq as a0,n7 as a1,Kq as a2,qq as a3,vH as a4,DF as a5,NF as a6,LF as a7,u8 as a8,$g as a9,Hn as aa,hd as ab,Ip as b,$q as c,td as d,iD as e,wl as f,tH as g,SD as h,Hq as i,YM as j,Xq as k,El as l,ZM as m,hH as n,Gq as o,d7 as p,lH as q,uH as r,fH as s,Vq as t,cH as u,sH as v,_0 as w,ep as x,Qq as y,dH as z};
@@ -0,0 +1,65 @@
1
+ import{A as Ie,a as m,t as z,i as K,k as Re,b as Ce,R as gt,U as wt,p as X,l as $,c as Tt,P as Y,g as yt,C as We,T as Ue,M as Ve,d as Z,e as bt,f as Ct,h as Et,v as vt,j as St,s as _t,m as xt,n as kt,o as At,q as Pt,r as Mt,u as Ot,w as Ae,x as ae,V as U,N as zt,S as re,y as L,z as pe,B as ge,D as we,E as Ne,F as Bt,G as Ft,H as It,I as Rt,J as $e,K as Le,L as He,O as ee,Q as Wt,W as Ut,X as P,Y as Vt,Z as Nt,_ as $t,$ as Lt,a0 as Ht,a1 as Qt,a2 as qt,a3 as jt,a4 as Gt,a5 as te,a6 as se,a7 as Kt,a8 as ce}from"./index-CFeAsg7B.js";class Xt{constructor(e){this.mutex=new Ie,this.firstMediaStreamTimestamp=null,this.trackTimestampInfo=new WeakMap,this.output=e}onTrackClose(e){}validateAndNormalizeTimestamp(e,s,i){s+=e.source._timestampOffset;let r=this.trackTimestampInfo.get(e);if(!r){if(!i)throw new Error("First packet must be a key packet.");r={maxTimestamp:s,maxTimestampBeforeLastKeyPacket:s},this.trackTimestampInfo.set(e,r)}if(s<0)throw new Error(`Timestamps must be non-negative (got ${s}s).`);if(i&&(r.maxTimestampBeforeLastKeyPacket=r.maxTimestamp),s<r.maxTimestampBeforeLastKeyPacket)throw new Error(`Timestamps cannot be smaller than the largest timestamp of the previous GOP (a GOP begins with a key packet and ends right before the next key packet). Got ${s}s, but largest timestamp is ${r.maxTimestampBeforeLastKeyPacket}s.`);return r.maxTimestamp=Math.max(r.maxTimestamp,s),s}}const Pe=/<(?:(\d{2}):)?(\d{2}):(\d{2}).(\d{3})>/g,Yt=t=>{const e=Math.floor(t/36e5),s=Math.floor(t%(3600*1e3)/(60*1e3)),i=Math.floor(t%(60*1e3)/1e3),r=t%1e3;return e.toString().padStart(2,"0")+":"+s.toString().padStart(2,"0")+":"+i.toString().padStart(2,"0")+"."+r.toString().padStart(3,"0")};class Me{constructor(e){this.writer=e,this.helper=new Uint8Array(8),this.helperView=new DataView(this.helper.buffer),this.offsets=new WeakMap}writeU32(e){this.helperView.setUint32(0,e,!1),this.writer.write(this.helper.subarray(0,4))}writeU64(e){this.helperView.setUint32(0,Math.floor(e/2**32),!1),this.helperView.setUint32(4,e,!1),this.writer.write(this.helper.subarray(0,8))}writeAscii(e){for(let s=0;s<e.length;s++)this.helperView.setUint8(s%8,e.charCodeAt(s)),s%8===7&&this.writer.write(this.helper);e.length%8!==0&&this.writer.write(this.helper.subarray(0,e.length%8))}writeBox(e){if(this.offsets.set(e,this.writer.getPos()),e.contents&&!e.children)this.writeBoxHeader(e,e.size??e.contents.byteLength+8),this.writer.write(e.contents);else{const s=this.writer.getPos();if(this.writeBoxHeader(e,0),e.contents&&this.writer.write(e.contents),e.children)for(const n of e.children)n&&this.writeBox(n);const i=this.writer.getPos(),r=e.size??i-s;this.writer.seek(s),this.writeBoxHeader(e,r),this.writer.seek(i)}}writeBoxHeader(e,s){this.writeU32(e.largeSize?1:s),this.writeAscii(e.type),e.largeSize&&this.writeU64(s)}measureBoxHeader(e){return 8+(e.largeSize?8:0)}patchBox(e){const s=this.offsets.get(e);m(s!==void 0);const i=this.writer.getPos();this.writer.seek(s),this.writeBox(e),this.writer.seek(i)}measureBox(e){if(e.contents&&!e.children)return this.measureBoxHeader(e)+e.contents.byteLength;{let s=this.measureBoxHeader(e);if(e.contents&&(s+=e.contents.byteLength),e.children)for(const i of e.children)i&&(s+=this.measureBox(i));return s}}}const y=new Uint8Array(8),B=new DataView(y.buffer),v=t=>[(t%256+256)%256],p=t=>(B.setUint16(0,t,!1),[y[0],y[1]]),Qe=t=>(B.setInt16(0,t,!1),[y[0],y[1]]),qe=t=>(B.setUint32(0,t,!1),[y[1],y[2],y[3]]),l=t=>(B.setUint32(0,t,!1),[y[0],y[1],y[2],y[3]]),W=t=>(B.setInt32(0,t,!1),[y[0],y[1],y[2],y[3]]),H=t=>(B.setUint32(0,Math.floor(t/2**32),!1),B.setUint32(4,t,!1),[y[0],y[1],y[2],y[3],y[4],y[5],y[6],y[7]]),je=t=>(B.setInt16(0,2**8*t,!1),[y[0],y[1]]),F=t=>(B.setInt32(0,2**16*t,!1),[y[0],y[1],y[2],y[3]]),ue=t=>(B.setInt32(0,2**30*t,!1),[y[0],y[1],y[2],y[3]]),de=(t,e)=>{const s=[];let i=t;do{let r=i&127;i>>=7,s.length>0&&(r|=128),s.push(r)}while(i>0||e);return s.reverse()},_=(t,e=!1)=>{const s=Array(t.length).fill(null).map((i,r)=>t.charCodeAt(r));return e&&s.push(0),s},Ee=t=>{let e=null;for(const s of t)(!e||s.timestamp>e.timestamp)&&(e=s);return e},Ge=t=>{const e=t*(Math.PI/180),s=Math.round(Math.cos(e)),i=Math.round(Math.sin(e));return[s,i,0,-i,s,0,0,0,1]},Ke=Ge(0),Xe=t=>[F(t[0]),F(t[1]),ue(t[2]),F(t[3]),F(t[4]),ue(t[5]),F(t[6]),F(t[7]),ue(t[8])],g=(t,e,s)=>({type:t,contents:e&&new Uint8Array(e.flat(10)),children:s}),C=(t,e,s,i,r)=>g(t,[v(e),qe(s),i??[]],r),Zt=t=>t.isQuickTime?g("ftyp",[_("qt "),l(512),_("qt ")]):t.fragmented?g("ftyp",[_("iso5"),l(512),_("iso5"),_("iso6"),_("mp41")]):g("ftyp",[_("isom"),l(512),_("isom"),t.holdsAvc?_("avc1"):[],_("mp41")]),ie=t=>({type:"mdat",largeSize:t}),Jt=t=>({type:"free",size:t}),D=t=>g("moov",void 0,[Dt(t.creationTime,t.trackDatas),...t.trackDatas.map(e=>es(e,t.creationTime)),t.isFragmented?Is(t.trackDatas):null,Ks(t)]),Dt=(t,e)=>{const s=S(Math.max(0,...e.filter(o=>o.samples.length>0).map(o=>{const a=Ee(o.samples);return a.timestamp+a.duration})),Te),i=Math.max(0,...e.map(o=>o.track.id))+1,r=!K(t)||!K(s),n=r?H:l;return C("mvhd",+r,0,[n(t),n(t),l(Te),n(s),F(1),je(1),Array(10).fill(0),Xe(Ke),Array(24).fill(0),l(i)])},es=(t,e)=>{const s=ni(t);return g("trak",void 0,[ts(t,e),ss(t,e),s.name!==void 0?g("udta",void 0,[g("name",[...z.encode(s.name)])]):null])},ts=(t,e)=>{const s=Ee(t.samples),i=S(s?s.timestamp+s.duration:0,Te),r=!K(e)||!K(i),n=r?H:l;let o;if(t.type==="video"){const u=t.track.metadata.rotation;o=Ge(u??0)}else o=Ke;let a=2;return t.track.metadata.disposition?.default!==!1&&(a|=1),C("tkhd",+r,a,[n(e),n(e),l(t.track.id),l(0),n(i),Array(8).fill(0),p(0),p(t.track.id),je(t.type==="audio"?1:0),p(0),Xe(o),F(t.type==="video"?t.info.width:0),F(t.type==="video"?t.info.height:0)])},ss=(t,e)=>g("mdia",void 0,[is(t,e),ve(!0,rs[t.type],ns[t.type]),os(t)]),is=(t,e)=>{const s=Ee(t.samples),i=S(s?s.timestamp+s.duration:0,t.timescale),r=!K(e)||!K(i),n=r?H:l;return C("mdhd",+r,0,[n(e),n(e),l(t.timescale),n(i),p(De(t.track.metadata.languageCode??wt)),p(0)])},rs={video:"vide",audio:"soun",subtitle:"text"},ns={video:"MediabunnyVideoHandler",audio:"MediabunnySoundHandler",subtitle:"MediabunnyTextHandler"},ve=(t,e,s,i="\0\0\0\0")=>C("hdlr",0,0,[t?_("mhlr"):l(0),_(e),_(i),l(0),l(0),_(s,!0)]),os=t=>g("minf",void 0,[ds[t.type](),ls(),ms(t)]),as=()=>C("vmhd",0,1,[p(0),p(0),p(0),p(0)]),cs=()=>C("smhd",0,0,[p(0),p(0)]),us=()=>C("nmhd",0,0),ds={video:as,audio:cs,subtitle:us},ls=()=>g("dinf",void 0,[hs()]),hs=()=>C("dref",0,0,[l(1)],[fs()]),fs=()=>C("url ",0,1),ms=t=>{const e=t.compositionTimeOffsetTable.length>1||t.compositionTimeOffsetTable.some(s=>s.sampleCompositionTimeOffset!==0);return g("stbl",void 0,[ps(t),As(t),e?Bs(t):null,e?Fs(t):null,Ms(t),Os(t),zs(t),Ps(t)])},ps=t=>{let e;if(t.type==="video")e=gs(Js(t.track.source._codec,t.info.decoderConfig.codec),t);else if(t.type==="audio"){const s=Je(t.track.source._codec,t.muxer.isQuickTime);m(s),e=Cs(s,t)}else t.type==="subtitle"&&(e=xs(ti[t.track.source._codec],t));return m(e),C("stsd",0,0,[l(1)],[e])},gs=(t,e)=>g(t,[Array(6).fill(0),p(1),p(0),p(0),Array(12).fill(0),p(e.info.width),p(e.info.height),l(4718592),l(4718592),l(0),p(1),Array(32).fill(0),p(24),Qe(65535)],[Ds[e.track.source._codec](e),Tt(e.info.decoderConfig.colorSpace)?ws(e):null]),ws=t=>g("colr",[_("nclx"),p(We[t.info.decoderConfig.colorSpace.primaries]),p(Ue[t.info.decoderConfig.colorSpace.transfer]),p(Ve[t.info.decoderConfig.colorSpace.matrix]),v((t.info.decoderConfig.colorSpace.fullRange?1:0)<<7)]),Ts=t=>t.info.decoderConfig&&g("avcC",[...Z(t.info.decoderConfig.description)]),ys=t=>t.info.decoderConfig&&g("hvcC",[...Z(t.info.decoderConfig.description)]),Oe=t=>{if(!t.info.decoderConfig)return null;const e=t.info.decoderConfig,s=e.codec.split("."),i=Number(s[1]),r=Number(s[2]),n=Number(s[3]),o=s[4]?Number(s[4]):1,a=s[8]?Number(s[8]):Number(e.colorSpace?.fullRange??0),u=(n<<4)+(o<<1)+a,c=s[5]?Number(s[5]):e.colorSpace?.primaries?We[e.colorSpace.primaries]:2,d=s[6]?Number(s[6]):e.colorSpace?.transfer?Ue[e.colorSpace.transfer]:2,w=s[7]?Number(s[7]):e.colorSpace?.matrix?Ve[e.colorSpace.matrix]:2;return C("vpcC",1,0,[v(i),v(r),v(u),v(c),v(d),v(w),p(0)])},bs=t=>g("av1C",yt(t.info.decoderConfig.codec)),Cs=(t,e)=>{let s=0,i,r=16;if(Y.includes(e.track.source._codec)){const n=e.track.source._codec,{sampleSize:o}=X(n);r=8*o,r>16&&(s=1)}return s===0?i=[Array(6).fill(0),p(1),p(s),p(0),l(0),p(e.info.numberOfChannels),p(r),p(0),p(0),p(e.info.sampleRate<2**16?e.info.sampleRate:0),p(0)]:i=[Array(6).fill(0),p(1),p(s),p(0),l(0),p(e.info.numberOfChannels),p(Math.min(r,16)),p(0),p(0),p(e.info.sampleRate<2**16?e.info.sampleRate:0),p(0),l(1),l(r/8),l(e.info.numberOfChannels*r/8),l(2)],g(t,i,[ei(e.track.source._codec,e.muxer.isQuickTime)?.(e)??null])},le=t=>{let e;switch(t.track.source._codec){case"aac":e=64;break;case"mp3":e=107;break;case"vorbis":e=221;break;default:throw new Error(`Unhandled audio codec: ${t.track.source._codec}`)}let s=[...v(e),...v(21),...qe(0),...l(0),...l(0)];if(t.info.decoderConfig.description){const i=Z(t.info.decoderConfig.description);s=[...s,...v(5),...de(i.byteLength),...i]}return s=[...p(1),...v(0),...v(4),...de(s.length),...s,...v(6),...v(1),...v(2)],s=[...v(3),...de(s.length),...s],C("esds",0,0,s)},R=t=>g("wave",void 0,[Es(t),vs(t),g("\0\0\0\0")]),Es=t=>g("frma",[_(Je(t.track.source._codec,t.muxer.isQuickTime))]),vs=t=>{const{littleEndian:e}=X(t.track.source._codec);return g("enda",[p(+e)])},Ss=t=>{let e=t.info.numberOfChannels,s=3840,i=t.info.sampleRate,r=0,n=0,o=new Uint8Array(0);const a=t.info.decoderConfig?.description;if(a){m(a.byteLength>=18);const u=Z(a),c=bt(u);e=c.outputChannelCount,s=c.preSkip,i=c.inputSampleRate,r=c.outputGain,n=c.channelMappingFamily,c.channelMappingTable&&(o=c.channelMappingTable)}return g("dOps",[v(0),v(e),p(s),l(i),Qe(r),v(n),...o])},_s=t=>{const e=t.info.decoderConfig?.description;m(e);const s=Z(e);return C("dfLa",0,0,[...s.subarray(4)])},M=t=>{const{littleEndian:e,sampleSize:s}=X(t.track.source._codec),i=+e;return C("pcmC",0,0,[v(i),v(8*s)])},xs=(t,e)=>g(t,[Array(6).fill(0),p(1)],[si[e.track.source._codec](e)]),ks=t=>g("vttC",[...z.encode(t.info.config.description)]),As=t=>C("stts",0,0,[l(t.timeToSampleTable.length),t.timeToSampleTable.map(e=>[l(e.sampleCount),l(e.sampleDelta)])]),Ps=t=>{if(t.samples.every(s=>s.type==="key"))return null;const e=[...t.samples.entries()].filter(([,s])=>s.type==="key");return C("stss",0,0,[l(e.length),e.map(([s])=>l(s+1))])},Ms=t=>C("stsc",0,0,[l(t.compactlyCodedChunkTable.length),t.compactlyCodedChunkTable.map(e=>[l(e.firstChunk),l(e.samplesPerChunk),l(1)])]),Os=t=>{if(t.type==="audio"&&t.info.requiresPcmTransformation){const{sampleSize:e}=X(t.track.source._codec);return C("stsz",0,0,[l(e*t.info.numberOfChannels),l(t.samples.reduce((s,i)=>s+S(i.duration,t.timescale),0))])}return C("stsz",0,0,[l(0),l(t.samples.length),t.samples.map(e=>l(e.size))])},zs=t=>t.finalizedChunks.length>0&&$(t.finalizedChunks).offset>=2**32?C("co64",0,0,[l(t.finalizedChunks.length),t.finalizedChunks.map(e=>H(e.offset))]):C("stco",0,0,[l(t.finalizedChunks.length),t.finalizedChunks.map(e=>l(e.offset))]),Bs=t=>C("ctts",1,0,[l(t.compositionTimeOffsetTable.length),t.compositionTimeOffsetTable.map(e=>[l(e.sampleCount),W(e.sampleCompositionTimeOffset)])]),Fs=t=>{let e=1/0,s=-1/0,i=1/0,r=-1/0;m(t.compositionTimeOffsetTable.length>0),m(t.samples.length>0);for(let o=0;o<t.compositionTimeOffsetTable.length;o++){const a=t.compositionTimeOffsetTable[o];e=Math.min(e,a.sampleCompositionTimeOffset),s=Math.max(s,a.sampleCompositionTimeOffset)}for(let o=0;o<t.samples.length;o++){const a=t.samples[o];i=Math.min(i,S(a.timestamp,t.timescale)),r=Math.max(r,S(a.timestamp+a.duration,t.timescale))}const n=Math.max(-e,0);return r>=2**31?null:C("cslg",0,0,[W(n),W(e),W(s),W(i),W(r)])},Is=t=>g("mvex",void 0,t.map(Rs)),Rs=t=>C("trex",0,0,[l(t.track.id),l(1),l(0),l(0),l(0)]),ze=(t,e)=>g("moof",void 0,[Ws(t),...e.map(Us)]),Ws=t=>C("mfhd",0,0,[l(t)]),Ye=t=>{let e=0,s=0;const i=0,r=0,n=t.type==="delta";return s|=+n,n?e|=1:e|=2,e<<24|s<<16|i<<8|r},Us=t=>g("traf",void 0,[Vs(t),Ns(t),$s(t)]),Vs=t=>{m(t.currentChunk);let e=0;e|=8,e|=16,e|=32,e|=131072;const s=t.currentChunk.samples[1]??t.currentChunk.samples[0],i={duration:s.timescaleUnitsToNextSample,size:s.size,flags:Ye(s)};return C("tfhd",0,e,[l(t.track.id),l(i.duration),l(i.size),l(i.flags)])},Ns=t=>(m(t.currentChunk),C("tfdt",1,0,[H(S(t.currentChunk.startTimestamp,t.timescale))])),$s=t=>{m(t.currentChunk);const e=t.currentChunk.samples.map(b=>b.timescaleUnitsToNextSample),s=t.currentChunk.samples.map(b=>b.size),i=t.currentChunk.samples.map(Ye),r=t.currentChunk.samples.map(b=>S(b.timestamp-b.decodeTimestamp,t.timescale)),n=new Set(e),o=new Set(s),a=new Set(i),u=new Set(r),c=a.size===2&&i[0]!==i[1],d=n.size>1,w=o.size>1,f=!c&&a.size>1,h=u.size>1||[...u].some(b=>b!==0);let T=0;return T|=1,T|=4*+c,T|=256*+d,T|=512*+w,T|=1024*+f,T|=2048*+h,C("trun",1,T,[l(t.currentChunk.samples.length),l(t.currentChunk.offset-t.currentChunk.moofOffset||0),c?l(i[0]):[],t.currentChunk.samples.map((b,E)=>[d?l(e[E]):[],w?l(s[E]):[],f?l(i[E]):[],h?W(r[E]):[]])])},Ls=t=>g("mfra",void 0,[...t.map(Hs),Qs()]),Hs=(t,e)=>C("tfra",1,0,[l(t.track.id),l(63),l(t.finalizedChunks.length),t.finalizedChunks.map(i=>[H(S(i.samples[0].timestamp,t.timescale)),H(i.moofOffset),l(e+1),l(1),l(1)])]),Qs=()=>C("mfro",0,0,[l(0)]),qs=()=>g("vtte"),js=(t,e,s,i,r)=>g("vttc",void 0,[r!==null?g("vsid",[W(r)]):null,s!==null?g("iden",[...z.encode(s)]):null,e!==null?g("ctim",[...z.encode(Yt(e))]):null,i!==null?g("sttg",[...z.encode(i)]):null,g("payl",[...z.encode(t)])]),Gs=t=>g("vtta",[...z.encode(t)]),Ks=t=>{const e=[],s=t.format._options.metadataFormat??"auto",i=t.output._metadataTags;if(s==="mdir"||s==="auto"&&!t.isQuickTime){const r=Ys(i);r&&e.push(r)}else if(s==="mdta"){const r=Zs(i);r&&e.push(r)}else(s==="udta"||s==="auto"&&t.isQuickTime)&&Xs(e,t.output._metadataTags);return e.length===0?null:g("udta",void 0,e)},Xs=(t,e)=>{for(const{key:s,value:i}of Re(e))switch(s){case"title":t.push(O("©nam",i));break;case"description":t.push(O("©des",i));break;case"artist":t.push(O("©ART",i));break;case"album":t.push(O("©alb",i));break;case"albumArtist":t.push(O("albr",i));break;case"genre":t.push(O("©gen",i));break;case"date":t.push(O("©day",i.toISOString().slice(0,10)));break;case"comment":t.push(O("©cmt",i));break;case"lyrics":t.push(O("©lyr",i));break;case"raw":break;case"discNumber":case"discsTotal":case"trackNumber":case"tracksTotal":case"images":break;default:Ce(s)}if(e.raw)for(const s in e.raw){const i=e.raw[s];i==null||s.length!==4||t.some(r=>r.type===s)||(typeof i=="string"?t.push(O(s,i)):i instanceof Uint8Array&&t.push(g(s,Array.from(i))))}},O=(t,e)=>{const s=z.encode(e);return g(t,[p(s.length),p(De("und")),Array.from(s)])},Be={"image/jpeg":13,"image/png":14,"image/bmp":27},Ze=(t,e)=>{const s=[];for(const{key:i,value:r}of Re(t))switch(i){case"title":s.push({key:e?"title":"©nam",value:A(r)});break;case"description":s.push({key:e?"description":"©des",value:A(r)});break;case"artist":s.push({key:e?"artist":"©ART",value:A(r)});break;case"album":s.push({key:e?"album":"©alb",value:A(r)});break;case"albumArtist":s.push({key:e?"album_artist":"aART",value:A(r)});break;case"comment":s.push({key:e?"comment":"©cmt",value:A(r)});break;case"genre":s.push({key:e?"genre":"©gen",value:A(r)});break;case"lyrics":s.push({key:e?"lyrics":"©lyr",value:A(r)});break;case"date":s.push({key:e?"date":"©day",value:A(r.toISOString().slice(0,10))});break;case"images":for(const n of r)n.kind==="coverFront"&&s.push({key:"covr",value:g("data",[l(Be[n.mimeType]??0),l(0),Array.from(n.data)])});break;case"trackNumber":if(e){const n=t.tracksTotal!==void 0?`${r}/${t.tracksTotal}`:r.toString();s.push({key:"track",value:A(n)})}else s.push({key:"trkn",value:g("data",[l(0),l(0),p(0),p(r),p(t.tracksTotal??0),p(0)])});break;case"discNumber":e||s.push({key:"disc",value:g("data",[l(0),l(0),p(0),p(r),p(t.discsTotal??0),p(0)])});break;case"tracksTotal":case"discsTotal":break;case"raw":break;default:Ce(i)}if(t.raw)for(const i in t.raw){const r=t.raw[i];r==null||!e&&i.length!==4||s.some(n=>n.key===i)||(typeof r=="string"?s.push({key:i,value:A(r)}):r instanceof Uint8Array?s.push({key:i,value:g("data",[l(0),l(0),Array.from(r)])}):r instanceof gt&&s.push({key:i,value:g("data",[l(Be[r.mimeType]??0),l(0),Array.from(r.data)])}))}return s},Ys=t=>{const e=Ze(t,!1);return e.length===0?null:C("meta",0,0,void 0,[ve(!1,"mdir","","appl"),g("ilst",void 0,e.map(s=>g(s.key,void 0,[s.value])))])},Zs=t=>{const e=Ze(t,!0);return e.length===0?null:g("meta",void 0,[ve(!1,"mdta",""),C("keys",0,0,[l(e.length)],e.map(s=>g("mdta",[...z.encode(s.key)]))),g("ilst",void 0,e.map((s,i)=>{const r=String.fromCharCode(...l(i+1));return g(r,void 0,[s.value])}))])},A=t=>g("data",[l(1),l(0),...z.encode(t)]),Js=(t,e)=>{switch(t){case"avc":return e.startsWith("avc3")?"avc3":"avc1";case"hevc":return"hvc1";case"vp8":return"vp08";case"vp9":return"vp09";case"av1":return"av01"}},Ds={avc:Ts,hevc:ys,vp8:Oe,vp9:Oe,av1:bs},Je=(t,e)=>{switch(t){case"aac":return"mp4a";case"mp3":return"mp4a";case"opus":return"Opus";case"vorbis":return"mp4a";case"flac":return"fLaC";case"ulaw":return"ulaw";case"alaw":return"alaw";case"pcm-u8":return"raw ";case"pcm-s8":return"sowt"}if(e)switch(t){case"pcm-s16":return"sowt";case"pcm-s16be":return"twos";case"pcm-s24":return"in24";case"pcm-s24be":return"in24";case"pcm-s32":return"in32";case"pcm-s32be":return"in32";case"pcm-f32":return"fl32";case"pcm-f32be":return"fl32";case"pcm-f64":return"fl64";case"pcm-f64be":return"fl64"}else switch(t){case"pcm-s16":return"ipcm";case"pcm-s16be":return"ipcm";case"pcm-s24":return"ipcm";case"pcm-s24be":return"ipcm";case"pcm-s32":return"ipcm";case"pcm-s32be":return"ipcm";case"pcm-f32":return"fpcm";case"pcm-f32be":return"fpcm";case"pcm-f64":return"fpcm";case"pcm-f64be":return"fpcm"}},ei=(t,e)=>{switch(t){case"aac":return le;case"mp3":return le;case"opus":return Ss;case"vorbis":return le;case"flac":return _s}if(e)switch(t){case"pcm-s24":return R;case"pcm-s24be":return R;case"pcm-s32":return R;case"pcm-s32be":return R;case"pcm-f32":return R;case"pcm-f32be":return R;case"pcm-f64":return R;case"pcm-f64be":return R}else switch(t){case"pcm-s16":return M;case"pcm-s16be":return M;case"pcm-s24":return M;case"pcm-s24be":return M;case"pcm-s32":return M;case"pcm-s32be":return M;case"pcm-f32":return M;case"pcm-f32be":return M;case"pcm-f64":return M;case"pcm-f64be":return M}return null},ti={webvtt:"wvtt"},si={webvtt:ks},De=t=>{m(t.length===3);let e=0;for(let s=0;s<3;s++)e<<=5,e+=t.charCodeAt(s)-96;return e};class ii{constructor(){this.ensureMonotonicity=!1,this.trackedWrites=null,this.trackedStart=-1,this.trackedEnd=-1}start(){}maybeTrackWrites(e){if(!this.trackedWrites)return;let s=this.getPos();if(s<this.trackedStart){if(s+e.byteLength<=this.trackedStart)return;e=e.subarray(this.trackedStart-s),s=0}const i=s+e.byteLength-this.trackedStart;let r=this.trackedWrites.byteLength;for(;r<i;)r*=2;if(r!==this.trackedWrites.byteLength){const n=new Uint8Array(r);n.set(this.trackedWrites,0),this.trackedWrites=n}this.trackedWrites.set(e,s-this.trackedStart),this.trackedEnd=Math.max(this.trackedEnd,s+e.byteLength)}startTrackingWrites(){this.trackedWrites=new Uint8Array(2**10),this.trackedStart=this.getPos(),this.trackedEnd=this.trackedStart}stopTrackingWrites(){if(!this.trackedWrites)throw new Error("Internal error: Can't get tracked writes since nothing was tracked.");const s={data:this.trackedWrites.subarray(0,this.trackedEnd-this.trackedStart),start:this.trackedStart,end:this.trackedEnd};return this.trackedWrites=null,s}}const he=2**16,fe=2**32;class et extends ii{constructor(e){if(super(),this.pos=0,this.maxPos=0,this.target=e,this.supportsResize="resize"in new ArrayBuffer(0),this.supportsResize)try{this.buffer=new ArrayBuffer(he,{maxByteLength:fe})}catch{this.buffer=new ArrayBuffer(he),this.supportsResize=!1}else this.buffer=new ArrayBuffer(he);this.bytes=new Uint8Array(this.buffer)}ensureSize(e){let s=this.buffer.byteLength;for(;s<e;)s*=2;if(s!==this.buffer.byteLength){if(s>fe)throw new Error(`ArrayBuffer exceeded maximum size of ${fe} bytes. Please consider using another target.`);if(this.supportsResize)this.buffer.resize(s);else{const i=new ArrayBuffer(s),r=new Uint8Array(i);r.set(this.bytes,0),this.buffer=i,this.bytes=r}}}write(e){this.maybeTrackWrites(e),this.ensureSize(this.pos+e.byteLength),this.bytes.set(e,this.pos),this.target.onwrite?.(this.pos,this.pos+e.byteLength),this.pos+=e.byteLength,this.maxPos=Math.max(this.maxPos,this.pos)}seek(e){this.pos=e}getPos(){return this.pos}async flush(){}async finalize(){this.ensureSize(this.pos),this.target.buffer=this.buffer.slice(0,Math.max(this.maxPos,this.pos))}async close(){}getSlice(e,s){return this.bytes.slice(e,s)}}class tt{constructor(){this._output=null,this.onwrite=null}}class st extends tt{constructor(){super(...arguments),this.buffer=null}_createWriter(){return new et(this)}}const Te=1e3,ri=2082844800,ni=t=>{const e={},s=t.track;return s.metadata.name!==void 0&&(e.name=s.metadata.name),e},S=(t,e,s=!0)=>{const i=t*e;return s?Math.round(i):i};class oi extends Xt{constructor(e,s){super(e),this.auxTarget=new st,this.auxWriter=this.auxTarget._createWriter(),this.auxBoxWriter=new Me(this.auxWriter),this.mdat=null,this.ftypSize=null,this.trackDatas=[],this.allTracksKnown=Ct(),this.creationTime=Math.floor(Date.now()/1e3)+ri,this.finalizedChunks=[],this.nextFragmentNumber=1,this.maxWrittenTimestamp=-1/0,this.format=s,this.writer=e._writer,this.boxWriter=new Me(this.writer),this.isQuickTime=s instanceof ot;const i=this.writer instanceof et?"in-memory":!1;this.fastStart=s._options.fastStart??i,this.isFragmented=this.fastStart==="fragmented",(this.fastStart==="in-memory"||this.isFragmented)&&(this.writer.ensureMonotonicity=!0),this.minimumFragmentDuration=s._options.minimumFragmentDuration??1}async start(){const e=await this.mutex.acquire(),s=this.output._tracks.some(i=>i.type==="video"&&i.source._codec==="avc");if(this.format._options.onFtyp&&this.writer.startTrackingWrites(),this.boxWriter.writeBox(Zt({isQuickTime:this.isQuickTime,holdsAvc:s,fragmented:this.isFragmented})),this.format._options.onFtyp){const{data:i,start:r}=this.writer.stopTrackingWrites();this.format._options.onFtyp(i,r)}if(this.ftypSize=this.writer.getPos(),this.fastStart!=="in-memory")if(this.fastStart==="reserve"){for(const i of this.output._tracks)if(i.metadata.maximumPacketCount===void 0)throw new Error("All tracks must specify maximumPacketCount in their metadata when using fastStart: 'reserve'.")}else this.isFragmented||(this.format._options.onMdat&&this.writer.startTrackingWrites(),this.mdat=ie(!0),this.boxWriter.writeBox(this.mdat));await this.writer.flush(),e()}allTracksAreKnown(){for(const e of this.output._tracks)if(!e.source._closed&&!this.trackDatas.some(s=>s.track===e))return!1;return!0}async getMimeType(){await this.allTracksKnown.promise;const e=this.trackDatas.map(s=>s.type==="video"||s.type==="audio"?s.info.decoderConfig.codec:{webvtt:"wvtt"}[s.track.source._codec]);return Et({isQuickTime:this.isQuickTime,hasVideo:this.trackDatas.some(s=>s.type==="video"),hasAudio:this.trackDatas.some(s=>s.type==="audio"),codecStrings:e})}getVideoTrackData(e,s,i){const r=this.trackDatas.find(c=>c.track===e);if(r)return r;vt(i),m(i),m(i.decoderConfig);const n={...i.decoderConfig};m(n.codedWidth!==void 0),m(n.codedHeight!==void 0);let o=!1;if(e.source._codec==="avc"&&!n.description){const c=St(s.data);if(!c)throw new Error("Couldn't extract an AVCDecoderConfigurationRecord from the AVC packet. Make sure the packets are in Annex B format (as specified in ITU-T-REC-H.264) when not providing a description, or provide a description (must be an AVCDecoderConfigurationRecord as specified in ISO 14496-15) and ensure the packets are in AVCC format.");n.description=_t(c),o=!0}else if(e.source._codec==="hevc"&&!n.description){const c=xt(s.data);if(!c)throw new Error("Couldn't extract an HEVCDecoderConfigurationRecord from the HEVC packet. Make sure the packets are in Annex B format (as specified in ITU-T-REC-H.265) when not providing a description, or provide a description (must be an HEVCDecoderConfigurationRecord as specified in ISO 14496-15) and ensure the packets are in HEVC format.");n.description=kt(c),o=!0}const a=At(1/(e.metadata.frameRate??57600),1e6).denominator,u={muxer:this,track:e,type:"video",info:{width:n.codedWidth,height:n.codedHeight,decoderConfig:n,requiresAnnexBTransformation:o},timescale:a,samples:[],sampleQueue:[],timestampProcessingQueue:[],timeToSampleTable:[],compositionTimeOffsetTable:[],lastTimescaleUnits:null,lastSample:null,finalizedChunks:[],currentChunk:null,compactlyCodedChunkTable:[]};return this.trackDatas.push(u),this.trackDatas.sort((c,d)=>c.track.id-d.track.id),this.allTracksAreKnown()&&this.allTracksKnown.resolve(),u}getAudioTrackData(e,s){const i=this.trackDatas.find(n=>n.track===e);if(i)return i;Pt(s),m(s),m(s.decoderConfig);const r={muxer:this,track:e,type:"audio",info:{numberOfChannels:s.decoderConfig.numberOfChannels,sampleRate:s.decoderConfig.sampleRate,decoderConfig:s.decoderConfig,requiresPcmTransformation:!this.isFragmented&&Y.includes(e.source._codec)},timescale:s.decoderConfig.sampleRate,samples:[],sampleQueue:[],timestampProcessingQueue:[],timeToSampleTable:[],compositionTimeOffsetTable:[],lastTimescaleUnits:null,lastSample:null,finalizedChunks:[],currentChunk:null,compactlyCodedChunkTable:[]};return this.trackDatas.push(r),this.trackDatas.sort((n,o)=>n.track.id-o.track.id),this.allTracksAreKnown()&&this.allTracksKnown.resolve(),r}getSubtitleTrackData(e,s){const i=this.trackDatas.find(n=>n.track===e);if(i)return i;Mt(s),m(s),m(s.config);const r={muxer:this,track:e,type:"subtitle",info:{config:s.config},timescale:1e3,samples:[],sampleQueue:[],timestampProcessingQueue:[],timeToSampleTable:[],compositionTimeOffsetTable:[],lastTimescaleUnits:null,lastSample:null,finalizedChunks:[],currentChunk:null,compactlyCodedChunkTable:[],lastCueEndTimestamp:0,cueQueue:[],nextSourceId:0,cueToSourceId:new WeakMap};return this.trackDatas.push(r),this.trackDatas.sort((n,o)=>n.track.id-o.track.id),this.allTracksAreKnown()&&this.allTracksKnown.resolve(),r}async addEncodedVideoPacket(e,s,i){const r=await this.mutex.acquire();try{const n=this.getVideoTrackData(e,s,i);let o=s.data;if(n.info.requiresAnnexBTransformation){const c=Ot(o);if(!c)throw new Error("Failed to transform packet data. Make sure all packets are provided in Annex B format, as specified in ITU-T-REC-H.264 and ITU-T-REC-H.265.");o=c}const a=this.validateAndNormalizeTimestamp(n.track,s.timestamp,s.type==="key"),u=this.createSampleForTrack(n,o,a,s.duration,s.type);await this.registerSample(n,u)}finally{r()}}async addEncodedAudioPacket(e,s,i){const r=await this.mutex.acquire();try{const n=this.getAudioTrackData(e,i),o=this.validateAndNormalizeTimestamp(n.track,s.timestamp,s.type==="key"),a=this.createSampleForTrack(n,s.data,o,s.duration,s.type);n.info.requiresPcmTransformation&&await this.maybePadWithSilence(n,o),await this.registerSample(n,a)}finally{r()}}async maybePadWithSilence(e,s){const i=$(e.samples),r=i?i.timestamp+i.duration:0,n=s-r,o=S(n,e.timescale);if(o>0){const{sampleSize:a,silentValue:u}=X(e.info.decoderConfig.codec),c=o*e.info.numberOfChannels,d=new Uint8Array(a*c).fill(u),w=this.createSampleForTrack(e,new Uint8Array(d.buffer),r,n,"key");await this.registerSample(e,w)}}async addSubtitleCue(e,s,i){const r=await this.mutex.acquire();try{const n=this.getSubtitleTrackData(e,i);this.validateAndNormalizeTimestamp(n.track,s.timestamp,!0),e.source._codec==="webvtt"&&(n.cueQueue.push(s),await this.processWebVTTCues(n,s.timestamp))}finally{r()}}async processWebVTTCues(e,s){for(;e.cueQueue.length>0;){const i=new Set([]);for(const c of e.cueQueue)m(c.timestamp<=s),m(e.lastCueEndTimestamp<=c.timestamp+c.duration),i.add(Math.max(c.timestamp,e.lastCueEndTimestamp)),i.add(c.timestamp+c.duration);const r=[...i].sort((c,d)=>c-d),n=r[0],o=r[1]??n;if(s<o)break;if(e.lastCueEndTimestamp<n){this.auxWriter.seek(0);const c=qs();this.auxBoxWriter.writeBox(c);const d=this.auxWriter.getSlice(0,this.auxWriter.getPos()),w=this.createSampleForTrack(e,d,e.lastCueEndTimestamp,n-e.lastCueEndTimestamp,"key");await this.registerSample(e,w),e.lastCueEndTimestamp=n}this.auxWriter.seek(0);for(let c=0;c<e.cueQueue.length;c++){const d=e.cueQueue[c];if(d.timestamp>=o)break;Pe.lastIndex=0;const w=Pe.test(d.text),f=d.timestamp+d.duration;let h=e.cueToSourceId.get(d);if(h===void 0&&o<f&&(h=e.nextSourceId++,e.cueToSourceId.set(d,h)),d.notes){const b=Gs(d.notes);this.auxBoxWriter.writeBox(b)}const T=js(d.text,w?n:null,d.identifier??null,d.settings??null,h??null);this.auxBoxWriter.writeBox(T),f===o&&e.cueQueue.splice(c--,1)}const a=this.auxWriter.getSlice(0,this.auxWriter.getPos()),u=this.createSampleForTrack(e,a,n,o-n,"key");await this.registerSample(e,u),e.lastCueEndTimestamp=o}}createSampleForTrack(e,s,i,r,n){return{timestamp:i,decodeTimestamp:i,duration:r,data:s,size:s.byteLength,type:n,timescaleUnitsToNextSample:S(r,e.timescale)}}processTimestamps(e,s){if(e.timestampProcessingQueue.length===0)return;if(e.type==="audio"&&e.info.requiresPcmTransformation){let r=0;for(let n=0;n<e.timestampProcessingQueue.length;n++){const o=e.timestampProcessingQueue[n],a=S(o.duration,e.timescale);r+=a}if(e.timeToSampleTable.length===0)e.timeToSampleTable.push({sampleCount:r,sampleDelta:1});else{const n=$(e.timeToSampleTable);n.sampleCount+=r}e.timestampProcessingQueue.length=0;return}const i=e.timestampProcessingQueue.map(r=>r.timestamp).sort((r,n)=>r-n);for(let r=0;r<e.timestampProcessingQueue.length;r++){const n=e.timestampProcessingQueue[r];n.decodeTimestamp=i[r],!this.isFragmented&&e.lastTimescaleUnits===null&&(n.decodeTimestamp=0);const o=S(n.timestamp-n.decodeTimestamp,e.timescale),a=S(n.duration,e.timescale);if(e.lastTimescaleUnits!==null){m(e.lastSample);const u=S(n.decodeTimestamp,e.timescale,!1),c=Math.round(u-e.lastTimescaleUnits);if(m(c>=0),e.lastTimescaleUnits+=c,e.lastSample.timescaleUnitsToNextSample=c,!this.isFragmented){let d=$(e.timeToSampleTable);if(m(d),d.sampleCount===1){d.sampleDelta=c;const f=e.timeToSampleTable[e.timeToSampleTable.length-2];f&&f.sampleDelta===c&&(f.sampleCount++,e.timeToSampleTable.pop(),d=f)}else d.sampleDelta!==c&&(d.sampleCount--,e.timeToSampleTable.push(d={sampleCount:1,sampleDelta:c}));d.sampleDelta===a?d.sampleCount++:e.timeToSampleTable.push({sampleCount:1,sampleDelta:a});const w=$(e.compositionTimeOffsetTable);m(w),w.sampleCompositionTimeOffset===o?w.sampleCount++:e.compositionTimeOffsetTable.push({sampleCount:1,sampleCompositionTimeOffset:o})}}else e.lastTimescaleUnits=S(n.decodeTimestamp,e.timescale,!1),this.isFragmented||(e.timeToSampleTable.push({sampleCount:1,sampleDelta:a}),e.compositionTimeOffsetTable.push({sampleCount:1,sampleCompositionTimeOffset:o}));e.lastSample=n}if(e.timestampProcessingQueue.length=0,m(e.lastSample),m(e.lastTimescaleUnits!==null),s!==void 0&&e.lastSample.timescaleUnitsToNextSample===0){m(s.type==="key");const r=S(s.timestamp,e.timescale,!1),n=Math.round(r-e.lastTimescaleUnits);e.lastSample.timescaleUnitsToNextSample=n}}async registerSample(e,s){s.type==="key"&&this.processTimestamps(e,s),e.timestampProcessingQueue.push(s),this.isFragmented?(e.sampleQueue.push(s),await this.interleaveSamples()):this.fastStart==="reserve"?await this.registerSampleFastStartReserve(e,s):await this.addSampleToTrack(e,s)}async addSampleToTrack(e,s){if(!this.isFragmented&&(e.samples.push(s),this.fastStart==="reserve")){const r=e.track.metadata.maximumPacketCount;if(m(r!==void 0),e.samples.length>r)throw new Error(`Track #${e.track.id} has already reached the maximum packet count (${r}). Either add less packets or increase the maximum packet count.`)}let i=!1;if(!e.currentChunk)i=!0;else{e.currentChunk.startTimestamp=Math.min(e.currentChunk.startTimestamp,s.timestamp);const r=s.timestamp-e.currentChunk.startTimestamp;if(this.isFragmented){const n=this.trackDatas.every(o=>{if(e===o)return s.type==="key";const a=o.sampleQueue[0];return a?a.type==="key":o.track.source._closed});r>=this.minimumFragmentDuration&&n&&s.timestamp>this.maxWrittenTimestamp&&(i=!0,await this.finalizeFragment())}else i=r>=.5}i&&(e.currentChunk&&await this.finalizeCurrentChunk(e),e.currentChunk={startTimestamp:s.timestamp,samples:[],offset:null,moofOffset:null}),m(e.currentChunk),e.currentChunk.samples.push(s),this.isFragmented&&(this.maxWrittenTimestamp=Math.max(this.maxWrittenTimestamp,s.timestamp))}async finalizeCurrentChunk(e){if(m(!this.isFragmented),!e.currentChunk)return;e.finalizedChunks.push(e.currentChunk),this.finalizedChunks.push(e.currentChunk);let s=e.currentChunk.samples.length;if(e.type==="audio"&&e.info.requiresPcmTransformation&&(s=e.currentChunk.samples.reduce((i,r)=>i+S(r.duration,e.timescale),0)),(e.compactlyCodedChunkTable.length===0||$(e.compactlyCodedChunkTable).samplesPerChunk!==s)&&e.compactlyCodedChunkTable.push({firstChunk:e.finalizedChunks.length,samplesPerChunk:s}),this.fastStart==="in-memory"){e.currentChunk.offset=0;return}e.currentChunk.offset=this.writer.getPos();for(const i of e.currentChunk.samples)m(i.data),this.writer.write(i.data),i.data=null;await this.writer.flush()}async interleaveSamples(e=!1){if(m(this.isFragmented),!(!e&&!this.allTracksAreKnown()))e:for(;;){let s=null,i=1/0;for(const n of this.trackDatas){if(!e&&n.sampleQueue.length===0&&!n.track.source._closed)break e;n.sampleQueue.length>0&&n.sampleQueue[0].timestamp<i&&(s=n,i=n.sampleQueue[0].timestamp)}if(!s)break;const r=s.sampleQueue.shift();await this.addSampleToTrack(s,r)}}async finalizeFragment(e=!0){m(this.isFragmented);const s=this.nextFragmentNumber++;if(s===1){this.format._options.onMoov&&this.writer.startTrackingWrites();const h=D(this);if(this.boxWriter.writeBox(h),this.format._options.onMoov){const{data:T,start:b}=this.writer.stopTrackingWrites();this.format._options.onMoov(T,b)}}const i=this.trackDatas.filter(h=>h.currentChunk),r=ze(s,i),n=this.writer.getPos(),o=n+this.boxWriter.measureBox(r);let a=o+ae,u=1/0;for(const h of i){h.currentChunk.offset=a,h.currentChunk.moofOffset=n;for(const T of h.currentChunk.samples)a+=T.size;u=Math.min(u,h.currentChunk.startTimestamp)}const c=a-o,d=c>=2**32;if(d)for(const h of i)h.currentChunk.offset+=Ae-ae;this.format._options.onMoof&&this.writer.startTrackingWrites();const w=ze(s,i);if(this.boxWriter.writeBox(w),this.format._options.onMoof){const{data:h,start:T}=this.writer.stopTrackingWrites();this.format._options.onMoof(h,T,u)}m(this.writer.getPos()===o),this.format._options.onMdat&&this.writer.startTrackingWrites();const f=ie(d);f.size=c,this.boxWriter.writeBox(f),this.writer.seek(o+(d?Ae:ae));for(const h of i)for(const T of h.currentChunk.samples)this.writer.write(T.data),T.data=null;if(this.format._options.onMdat){const{data:h,start:T}=this.writer.stopTrackingWrites();this.format._options.onMdat(h,T)}for(const h of i)h.finalizedChunks.push(h.currentChunk),this.finalizedChunks.push(h.currentChunk),h.currentChunk=null;e&&await this.writer.flush()}async registerSampleFastStartReserve(e,s){if(this.allTracksAreKnown()){if(!this.mdat){const i=D(this),n=this.boxWriter.measureBox(i)+this.computeSampleTableSizeUpperBound()+4096;m(this.ftypSize!==null),this.writer.seek(this.ftypSize+n),this.format._options.onMdat&&this.writer.startTrackingWrites(),this.mdat=ie(!0),this.boxWriter.writeBox(this.mdat);for(const o of this.trackDatas){for(const a of o.sampleQueue)await this.addSampleToTrack(o,a);o.sampleQueue.length=0}}await this.addSampleToTrack(e,s)}else e.sampleQueue.push(s)}computeSampleTableSizeUpperBound(){m(this.fastStart==="reserve");let e=0;for(const s of this.trackDatas){const i=s.track.metadata.maximumPacketCount;m(i!==void 0),e+=8*Math.ceil(2/3*i),e+=4*i,e+=8*Math.ceil(2/3*i),e+=12*Math.ceil(2/3*i),e+=4*i,e+=8*i}return e}async onTrackClose(e){const s=await this.mutex.acquire();if(e.type==="subtitle"&&e.source._codec==="webvtt"){const i=this.trackDatas.find(r=>r.track===e);i&&await this.processWebVTTCues(i,1/0)}this.allTracksAreKnown()&&this.allTracksKnown.resolve(),this.isFragmented&&await this.interleaveSamples(),s()}async finalize(){const e=await this.mutex.acquire();this.allTracksKnown.resolve();for(const s of this.trackDatas)s.type==="subtitle"&&s.track.source._codec==="webvtt"&&await this.processWebVTTCues(s,1/0);if(this.isFragmented){await this.interleaveSamples(!0);for(const s of this.trackDatas)this.processTimestamps(s);await this.finalizeFragment(!1)}else for(const s of this.trackDatas)this.processTimestamps(s),await this.finalizeCurrentChunk(s);if(this.fastStart==="in-memory"){this.mdat=ie(!1);let s;for(let r=0;r<2;r++){const n=D(this),o=this.boxWriter.measureBox(n);s=this.boxWriter.measureBox(this.mdat);let a=this.writer.getPos()+o+s;for(const u of this.finalizedChunks){u.offset=a;for(const{data:c}of u.samples)m(c),a+=c.byteLength,s+=c.byteLength}if(a<2**32)break;s>=2**32&&(this.mdat.largeSize=!0)}this.format._options.onMoov&&this.writer.startTrackingWrites();const i=D(this);if(this.boxWriter.writeBox(i),this.format._options.onMoov){const{data:r,start:n}=this.writer.stopTrackingWrites();this.format._options.onMoov(r,n)}this.format._options.onMdat&&this.writer.startTrackingWrites(),this.mdat.size=s,this.boxWriter.writeBox(this.mdat);for(const r of this.finalizedChunks)for(const n of r.samples)m(n.data),this.writer.write(n.data),n.data=null;if(this.format._options.onMdat){const{data:r,start:n}=this.writer.stopTrackingWrites();this.format._options.onMdat(r,n)}}else if(this.isFragmented){const s=this.writer.getPos(),i=Ls(this.trackDatas);this.boxWriter.writeBox(i);const r=this.writer.getPos()-s;this.writer.seek(this.writer.getPos()-4),this.boxWriter.writeU32(r)}else{m(this.mdat);const s=this.boxWriter.offsets.get(this.mdat);m(s!==void 0);const i=this.writer.getPos()-s;if(this.mdat.size=i,this.mdat.largeSize=i>=2**32,this.boxWriter.patchBox(this.mdat),this.format._options.onMdat){const{data:n,start:o}=this.writer.stopTrackingWrites();this.format._options.onMdat(n,o)}const r=D(this);if(this.fastStart==="reserve"){m(this.ftypSize!==null),this.writer.seek(this.ftypSize),this.format._options.onMoov&&this.writer.startTrackingWrites(),this.boxWriter.writeBox(r);const n=this.boxWriter.offsets.get(this.mdat)-this.writer.getPos();this.boxWriter.writeBox(Jt(n))}else this.format._options.onMoov&&this.writer.startTrackingWrites(),this.boxWriter.writeBox(r);if(this.format._options.onMoov){const{data:n,start:o}=this.writer.stopTrackingWrites();this.format._options.onMoov(n,o)}}e()}}class it{getSupportedVideoCodecs(){return this.getSupportedCodecs().filter(e=>U.includes(e))}getSupportedAudioCodecs(){return this.getSupportedCodecs().filter(e=>L.includes(e))}getSupportedSubtitleCodecs(){return this.getSupportedCodecs().filter(e=>re.includes(e))}_codecUnsupportedHint(e){return""}}class rt extends it{constructor(e={}){if(!e||typeof e!="object")throw new TypeError("options must be an object.");if(e.fastStart!==void 0&&![!1,"in-memory","reserve","fragmented"].includes(e.fastStart))throw new TypeError("options.fastStart, when provided, must be false, 'in-memory', 'reserve', or 'fragmented'.");if(e.minimumFragmentDuration!==void 0&&(!Number.isFinite(e.minimumFragmentDuration)||e.minimumFragmentDuration<0))throw new TypeError("options.minimumFragmentDuration, when provided, must be a non-negative number.");if(e.onFtyp!==void 0&&typeof e.onFtyp!="function")throw new TypeError("options.onFtyp, when provided, must be a function.");if(e.onMoov!==void 0&&typeof e.onMoov!="function")throw new TypeError("options.onMoov, when provided, must be a function.");if(e.onMdat!==void 0&&typeof e.onMdat!="function")throw new TypeError("options.onMdat, when provided, must be a function.");if(e.onMoof!==void 0&&typeof e.onMoof!="function")throw new TypeError("options.onMoof, when provided, must be a function.");if(e.metadataFormat!==void 0&&!["mdir","mdta","udta","auto"].includes(e.metadataFormat))throw new TypeError("options.metadataFormat, when provided, must be either 'auto', 'mdir', 'mdta', or 'udta'.");super(),this._options=e}getSupportedTrackCounts(){return{video:{min:0,max:1/0},audio:{min:0,max:1/0},subtitle:{min:0,max:1/0},total:{min:1,max:2**32-1}}}get supportsVideoRotationMetadata(){return!0}_createMuxer(e){return new oi(e,this)}}class nt extends rt{constructor(e){super(e)}get _name(){return"MP4"}get fileExtension(){return".mp4"}get mimeType(){return"video/mp4"}getSupportedCodecs(){return[...U,...zt,"pcm-s16","pcm-s16be","pcm-s24","pcm-s24be","pcm-s32","pcm-s32be","pcm-f32","pcm-f32be","pcm-f64","pcm-f64be",...re]}_codecUnsupportedHint(e){return new ot().getSupportedCodecs().includes(e)?" Switching to MOV will grant support for this codec.":""}}class ot extends rt{constructor(e){super(e)}get _name(){return"MOV"}get fileExtension(){return".mov"}get mimeType(){return"video/quicktime"}getSupportedCodecs(){return[...U,...L]}_codecUnsupportedHint(e){return new nt().getSupportedCodecs().includes(e)?" Switching to MP4 will grant support for this codec.":""}}const ai=t=>{if(!t||typeof t!="object")throw new TypeError("Encoding config must be an object.");if(!U.includes(t.codec))throw new TypeError(`Invalid video codec '${t.codec}'. Must be one of: ${U.join(", ")}.`);if(!(t.bitrate instanceof Q)&&(!Number.isInteger(t.bitrate)||t.bitrate<=0))throw new TypeError("config.bitrate must be a positive integer or a quality.");if(t.keyFrameInterval!==void 0&&(!Number.isFinite(t.keyFrameInterval)||t.keyFrameInterval<0))throw new TypeError("config.keyFrameInterval, when provided, must be a non-negative number.");if(t.sizeChangeBehavior!==void 0&&!["deny","passThrough","fill","contain","cover"].includes(t.sizeChangeBehavior))throw new TypeError("config.sizeChangeBehavior, when provided, must be 'deny', 'passThrough', 'fill', 'contain' or 'cover'.");if(t.onEncodedPacket!==void 0&&typeof t.onEncodedPacket!="function")throw new TypeError("config.onEncodedChunk, when provided, must be a function.");if(t.onEncoderConfig!==void 0&&typeof t.onEncoderConfig!="function")throw new TypeError("config.onEncoderConfig, when provided, must be a function.");at(t.codec,t)},at=(t,e)=>{if(!e||typeof e!="object")throw new TypeError("Encoding options must be an object.");if(e.alpha!==void 0&&!["discard","keep"].includes(e.alpha))throw new TypeError("options.alpha, when provided, must be 'discard' or 'keep'.");if(e.bitrateMode!==void 0&&!["constant","variable"].includes(e.bitrateMode))throw new TypeError("bitrateMode, when provided, must be 'constant' or 'variable'.");if(e.latencyMode!==void 0&&!["quality","realtime"].includes(e.latencyMode))throw new TypeError("latencyMode, when provided, must be 'quality' or 'realtime'.");if(e.fullCodecString!==void 0&&typeof e.fullCodecString!="string")throw new TypeError("fullCodecString, when provided, must be a string.");if(e.fullCodecString!==void 0&&Ne(e.fullCodecString)!==t)throw new TypeError(`fullCodecString, when provided, must be a string that matches the specified codec (${t}).`);if(e.hardwareAcceleration!==void 0&&!["no-preference","prefer-hardware","prefer-software"].includes(e.hardwareAcceleration))throw new TypeError("hardwareAcceleration, when provided, must be 'no-preference', 'prefer-hardware' or 'prefer-software'.");if(e.scalabilityMode!==void 0&&typeof e.scalabilityMode!="string")throw new TypeError("scalabilityMode, when provided, must be a string.");if(e.contentHint!==void 0&&typeof e.contentHint!="string")throw new TypeError("contentHint, when provided, must be a string.")},ye=t=>{const e=t.bitrate instanceof Q?t.bitrate._toVideoBitrate(t.codec,t.width,t.height):t.bitrate;return{codec:t.fullCodecString??Ft(t.codec,t.width,t.height,e),width:t.width,height:t.height,bitrate:e,bitrateMode:t.bitrateMode,alpha:t.alpha??"discard",framerate:t.framerate,latencyMode:t.latencyMode,hardwareAcceleration:t.hardwareAcceleration,scalabilityMode:t.scalabilityMode,contentHint:t.contentHint,...Bt(t.codec)}},ci=t=>{if(!t||typeof t!="object")throw new TypeError("Encoding config must be an object.");if(!L.includes(t.codec))throw new TypeError(`Invalid audio codec '${t.codec}'. Must be one of: ${L.join(", ")}.`);if(t.bitrate===void 0&&(!Y.includes(t.codec)||t.codec==="flac"))throw new TypeError("config.bitrate must be provided for compressed audio codecs.");if(t.bitrate!==void 0&&!(t.bitrate instanceof Q)&&(!Number.isInteger(t.bitrate)||t.bitrate<=0))throw new TypeError("config.bitrate, when provided, must be a positive integer or a quality.");if(t.onEncodedPacket!==void 0&&typeof t.onEncodedPacket!="function")throw new TypeError("config.onEncodedChunk, when provided, must be a function.");if(t.onEncoderConfig!==void 0&&typeof t.onEncoderConfig!="function")throw new TypeError("config.onEncoderConfig, when provided, must be a function.");ct(t.codec,t)},ct=(t,e)=>{if(!e||typeof e!="object")throw new TypeError("Encoding options must be an object.");if(e.bitrateMode!==void 0&&!["constant","variable"].includes(e.bitrateMode))throw new TypeError("bitrateMode, when provided, must be 'constant' or 'variable'.");if(e.fullCodecString!==void 0&&typeof e.fullCodecString!="string")throw new TypeError("fullCodecString, when provided, must be a string.");if(e.fullCodecString!==void 0&&Ne(e.fullCodecString)!==t)throw new TypeError(`fullCodecString, when provided, must be a string that matches the specified codec (${t}).`)},be=t=>{const e=t.bitrate instanceof Q?t.bitrate._toAudioBitrate(t.codec):t.bitrate;return{codec:t.fullCodecString??Rt(t.codec,t.numberOfChannels,t.sampleRate),numberOfChannels:t.numberOfChannels,sampleRate:t.sampleRate,bitrate:e,bitrateMode:t.bitrateMode,...It(t.codec)}};class Q{constructor(e){this._factor=e}_toVideoBitrate(e,s,i){const r=s*i,n={avc:1,hevc:.6,vp9:.6,av1:.4,vp8:1.2},o=1920*1080,a=3e6,u=Math.pow(r/o,.95),w=a*u*n[e]*this._factor;return Math.ceil(w/1e3)*1e3}_toAudioBitrate(e){if(Y.includes(e)||e==="flac")return;const i={aac:128e3,opus:64e3,mp3:16e4,vorbis:64e3}[e];if(!i)throw new Error(`Unhandled codec: ${e}`);let r=i*this._factor;return e==="aac"?r=[96e3,128e3,16e4,192e3].reduce((o,a)=>Math.abs(a-r)<Math.abs(o-r)?a:o):e==="opus"||e==="vorbis"?r=Math.max(6e3,r):e==="mp3"&&(r=[8e3,16e3,24e3,32e3,4e4,48e3,64e3,8e4,96e3,112e3,128e3,16e4,192e3,224e3,256e3,32e4].reduce((o,a)=>Math.abs(a-r)<Math.abs(o-r)?a:o)),Math.round(r/1e3)*1e3}}const ut=new Q(2),ui=async(t,e={})=>{const{width:s=1280,height:i=720,bitrate:r=1e6,...n}=e;if(!U.includes(t))return!1;if(!Number.isInteger(s)||s<=0)throw new TypeError("width must be a positive integer.");if(!Number.isInteger(i)||i<=0)throw new TypeError("height must be a positive integer.");if(!(r instanceof Q)&&(!Number.isInteger(r)||r<=0))throw new TypeError("bitrate must be a positive integer or a quality.");at(t,n);let o=null;return pe.length>0&&(o??=ye({codec:t,width:s,height:i,bitrate:r,framerate:void 0,...n}),pe.some(c=>c.supports(t,o)))?!0:typeof VideoEncoder>"u"||(s%2===1||i%2===1)&&(t==="avc"||t==="hevc")||(o??=ye({codec:t,width:s,height:i,bitrate:r,framerate:void 0,...n,alpha:"discard"}),!(await VideoEncoder.isConfigSupported(o)).supported)?!1:ge()?new Promise(async c=>{try{const d=new VideoEncoder({output:()=>{},error:()=>c(!1)});d.configure(o);const w=new Uint8Array(s*i*4),f=new VideoFrame(w,{format:"RGBA",codedWidth:s,codedHeight:i,timestamp:0});d.encode(f),f.close(),await d.flush(),c(!0)}catch{c(!1)}}):!0},di=async(t,e={})=>{const{numberOfChannels:s=2,sampleRate:i=48e3,bitrate:r=128e3,...n}=e;if(!L.includes(t))return!1;if(!Number.isInteger(s)||s<=0)throw new TypeError("numberOfChannels must be a positive integer.");if(!Number.isInteger(i)||i<=0)throw new TypeError("sampleRate must be a positive integer.");if(!(r instanceof Q)&&(!Number.isInteger(r)||r<=0))throw new TypeError("bitrate must be a positive integer.");ct(t,n);let o=null;return we.length>0&&(o??=be({codec:t,numberOfChannels:s,sampleRate:i,bitrate:r,...n}),we.some(u=>u.supports(t,o)))||Y.includes(t)?!0:typeof AudioEncoder>"u"?!1:(o??=be({codec:t,numberOfChannels:s,sampleRate:i,bitrate:r,...n}),(await AudioEncoder.isConfigSupported(o)).supported===!0)},li=async(t,e)=>{for(const s of t)if(await ui(s,e))return s;return null},hi=async(t,e)=>{for(const s of t)if(await di(s,e))return s;return null};class Se{constructor(){this._connectedTrack=null,this._closingPromise=null,this._closed=!1,this._timestampOffset=0}_ensureValidAdd(){if(!this._connectedTrack)throw new Error("Source is not connected to an output track.");if(this._connectedTrack.output.state==="canceled")throw new Error("Output has been canceled.");if(this._connectedTrack.output.state==="finalizing"||this._connectedTrack.output.state==="finalized")throw new Error("Output has been finalized.");if(this._connectedTrack.output.state==="pending")throw new Error("Output has not started.");if(this._closed)throw new Error("Source is closed.")}async _start(){}async _flushAndClose(e){}close(){if(this._closingPromise)return;const e=this._connectedTrack;if(!e)throw new Error("Cannot call close without connecting the source to an output track.");if(e.output.state==="pending")throw new Error("Cannot call close before output has been started.");this._closingPromise=(async()=>{await this._flushAndClose(!1),this._closed=!0,!(e.output.state==="finalizing"||e.output.state==="finalized")&&e.output._muxer.onTrackClose(e)})()}async _flushOrWaitForOngoingClose(e){return this._closingPromise?this._closingPromise:this._flushAndClose(e)}}class dt extends Se{constructor(e){if(super(),this._connectedTrack=null,!U.includes(e))throw new TypeError(`Invalid video codec '${e}'. Must be one of: ${U.join(", ")}.`);this._codec=e}}class fi{constructor(e,s){this.source=e,this.encodingConfig=s,this.ensureEncoderPromise=null,this.encoderInitialized=!1,this.encoder=null,this.muxer=null,this.lastMultipleOfKeyFrameInterval=-1,this.codedWidth=null,this.codedHeight=null,this.resizeCanvas=null,this.customEncoder=null,this.customEncoderCallSerializer=new He,this.customEncoderQueueSize=0,this.alphaEncoder=null,this.splitter=null,this.splitterCreationFailed=!1,this.alphaFrameQueue=[],this.error=null,this.errorNeedsNewStack=!0}async add(e,s,i){try{if(this.checkForEncoderError(),this.source._ensureValidAdd(),this.codedWidth!==null&&this.codedHeight!==null){if(e.codedWidth!==this.codedWidth||e.codedHeight!==this.codedHeight){const a=this.encodingConfig.sizeChangeBehavior??"deny";if(a!=="passThrough"){if(a==="deny")throw new Error(`Video sample size must remain constant. Expected ${this.codedWidth}x${this.codedHeight}, got ${e.codedWidth}x${e.codedHeight}. To allow the sample size to change over time, set \`sizeChangeBehavior\` to a value other than 'strict' in the encoding options.`);{let u=!1;this.resizeCanvas||(typeof document<"u"?(this.resizeCanvas=document.createElement("canvas"),this.resizeCanvas.width=this.codedWidth,this.resizeCanvas.height=this.codedHeight):this.resizeCanvas=new OffscreenCanvas(this.codedWidth,this.codedHeight),u=!0);const c=this.resizeCanvas.getContext("2d",{alpha:ge()});m(c),u||(ge()?(c.fillStyle="black",c.fillRect(0,0,this.codedWidth,this.codedHeight)):c.clearRect(0,0,this.codedWidth,this.codedHeight)),e.drawWithFit(c,{fit:a}),s&&e.close(),e=new $e(this.resizeCanvas,{timestamp:e.timestamp,duration:e.duration,rotation:e.rotation}),s=!0}}}}else this.codedWidth=e.codedWidth,this.codedHeight=e.codedHeight;this.encoderInitialized||(this.ensureEncoderPromise||this.ensureEncoder(e),this.encoderInitialized||await this.ensureEncoderPromise),m(this.encoderInitialized);const r=this.encodingConfig.keyFrameInterval??5,n=Math.floor(e.timestamp/r),o={...i,keyFrame:i?.keyFrame||r===0||n!==this.lastMultipleOfKeyFrameInterval};if(this.lastMultipleOfKeyFrameInterval=n,this.customEncoder){this.customEncoderQueueSize++;const a=e.clone(),u=this.customEncoderCallSerializer.call(()=>this.customEncoder.encode(a,o)).then(()=>this.customEncoderQueueSize--).catch(c=>this.error??=c).finally(()=>{a.close()});this.customEncoderQueueSize>=4&&await u}else{m(this.encoder);const a=e.toVideoFrame();if(!this.alphaEncoder)this.encoder.encode(a,o),a.close();else if(!!a.format&&!a.format.includes("A")||this.splitterCreationFailed)this.alphaFrameQueue.push(null),this.encoder.encode(a,o),a.close();else{const c=a.displayWidth,d=a.displayHeight;if(!this.splitter)try{this.splitter=new mi(c,d)}catch(w){console.error("Due to an error, only color data will be encoded.",w),this.splitterCreationFailed=!0,this.alphaFrameQueue.push(null),this.encoder.encode(a,o),a.close()}if(this.splitter){const w=this.splitter.extractColor(a),f=this.splitter.extractAlpha(a);this.alphaFrameQueue.push(f),this.encoder.encode(w,o),w.close(),a.close()}}s&&e.close(),this.encoder.encodeQueueSize>=4&&await new Promise(u=>this.encoder.addEventListener("dequeue",u,{once:!0}))}await this.muxer.mutex.currentPromise}finally{s&&e.close()}}ensureEncoder(e){const s=new Error;this.ensureEncoderPromise=(async()=>{const i=ye({width:e.codedWidth,height:e.codedHeight,...this.encodingConfig,framerate:this.source._connectedTrack?.metadata.frameRate});this.encodingConfig.onEncoderConfig?.(i);const r=pe.find(n=>n.supports(this.encodingConfig.codec,i));if(r)this.customEncoder=new r,this.customEncoder.codec=this.encodingConfig.codec,this.customEncoder.config=i,this.customEncoder.onPacket=(n,o)=>{if(!(n instanceof ee))throw new TypeError("The first argument passed to onPacket must be an EncodedPacket.");if(o!==void 0&&(!o||typeof o!="object"))throw new TypeError("The second argument passed to onPacket must be an object or undefined.");this.encodingConfig.onEncodedPacket?.(n,o),this.muxer.addEncodedVideoPacket(this.source._connectedTrack,n,o).catch(a=>{this.error??=a,this.errorNeedsNewStack=!1})},await this.customEncoder.init();else{if(typeof VideoEncoder>"u")throw new Error("VideoEncoder is not supported by this browser.");if(i.alpha="discard",this.encodingConfig.alpha==="keep"&&(i.latencyMode="quality"),(i.width%2===1||i.height%2===1)&&(this.encodingConfig.codec==="avc"||this.encodingConfig.codec==="hevc"))throw new Error(`The dimensions ${i.width}x${i.height} are not supported for codec '${this.encodingConfig.codec}'; both width and height must be even numbers. Make sure to round your dimensions to the nearest even number.`);if(!(await VideoEncoder.isConfigSupported(i)).supported)throw new Error(`This specific encoder configuration (${i.codec}, ${i.bitrate} bps, ${i.width}x${i.height}, hardware acceleration: ${i.hardwareAcceleration??"no-preference"}) is not supported by this browser. Consider using another codec or changing your video parameters.`);const a=[],u=[];let c=0,d=0;const w=(f,h,T)=>{const b={};if(h){const x=new Uint8Array(h.byteLength);h.copyTo(x),b.alpha=x}const E=ee.fromEncodedChunk(f,b);this.encodingConfig.onEncodedPacket?.(E,T),this.muxer.addEncodedVideoPacket(this.source._connectedTrack,E,T).catch(x=>{this.error??=x,this.errorNeedsNewStack=!1})};this.encoder=new VideoEncoder({output:(f,h)=>{if(!this.alphaEncoder){w(f,null,h);return}const T=this.alphaFrameQueue.shift();m(T!==void 0),T?(this.alphaEncoder.encode(T,{keyFrame:f.type==="key"}),d++,T.close(),a.push({chunk:f,meta:h})):d===0?w(f,null,h):(u.push(c+d),a.push({chunk:f,meta:h}))},error:f=>{f.stack=s.stack,this.error??=f}}),this.encoder.configure(i),this.encodingConfig.alpha==="keep"&&(this.alphaEncoder=new VideoEncoder({output:(f,h)=>{d--;const T=a.shift();for(m(T!==void 0),w(T.chunk,f,T.meta),c++;u.length>0&&u[0]===c;){u.shift();const b=a.shift();m(b!==void 0),w(b.chunk,null,b.meta)}},error:f=>{f.stack=s.stack,this.error??=f}}),this.alphaEncoder.configure(i))}m(this.source._connectedTrack),this.muxer=this.source._connectedTrack.output._muxer,this.encoderInitialized=!0})()}async flushAndClose(e){e||this.checkForEncoderError(),this.customEncoder?(e||this.customEncoderCallSerializer.call(()=>this.customEncoder.flush()),await this.customEncoderCallSerializer.call(()=>this.customEncoder.close())):this.encoder&&(e||(await this.encoder.flush(),await this.alphaEncoder?.flush()),this.encoder.state!=="closed"&&this.encoder.close(),this.alphaEncoder&&this.alphaEncoder.state!=="closed"&&this.alphaEncoder.close(),this.alphaFrameQueue.forEach(s=>s?.close()),this.splitter?.close()),e||this.checkForEncoderError()}getQueueSize(){return this.customEncoder?this.customEncoderQueueSize:this.encoder?.encodeQueueSize??0}checkForEncoderError(){if(this.error)throw this.errorNeedsNewStack&&(this.error.stack=new Error().stack),this.error}}class mi{constructor(e,s){this.lastFrame=null,typeof OffscreenCanvas<"u"?this.canvas=new OffscreenCanvas(e,s):(this.canvas=document.createElement("canvas"),this.canvas.width=e,this.canvas.height=s);const i=this.canvas.getContext("webgl2",{alpha:!0});if(!i)throw new Error("Couldn't acquire WebGL 2 context.");this.gl=i,this.colorProgram=this.createColorProgram(),this.alphaProgram=this.createAlphaProgram(),this.vao=this.createVAO(),this.sourceTexture=this.createTexture(),this.alphaResolutionLocation=this.gl.getUniformLocation(this.alphaProgram,"u_resolution"),this.gl.useProgram(this.colorProgram),this.gl.uniform1i(this.gl.getUniformLocation(this.colorProgram,"u_sourceTexture"),0),this.gl.useProgram(this.alphaProgram),this.gl.uniform1i(this.gl.getUniformLocation(this.alphaProgram,"u_sourceTexture"),0)}createVertexShader(){return this.createShader(this.gl.VERTEX_SHADER,`#version 300 es
2
+ in vec2 a_position;
3
+ in vec2 a_texCoord;
4
+ out vec2 v_texCoord;
5
+
6
+ void main() {
7
+ gl_Position = vec4(a_position, 0.0, 1.0);
8
+ v_texCoord = a_texCoord;
9
+ }
10
+ `)}createColorProgram(){const e=this.createVertexShader(),s=this.createShader(this.gl.FRAGMENT_SHADER,`#version 300 es
11
+ precision highp float;
12
+
13
+ uniform sampler2D u_sourceTexture;
14
+ in vec2 v_texCoord;
15
+ out vec4 fragColor;
16
+
17
+ void main() {
18
+ vec4 source = texture(u_sourceTexture, v_texCoord);
19
+ fragColor = vec4(source.rgb, 1.0);
20
+ }
21
+ `),i=this.gl.createProgram();return this.gl.attachShader(i,e),this.gl.attachShader(i,s),this.gl.linkProgram(i),i}createAlphaProgram(){const e=this.createVertexShader(),s=this.createShader(this.gl.FRAGMENT_SHADER,`#version 300 es
22
+ precision highp float;
23
+
24
+ uniform sampler2D u_sourceTexture;
25
+ uniform vec2 u_resolution; // The width and height of the canvas
26
+ in vec2 v_texCoord;
27
+ out vec4 fragColor;
28
+
29
+ // This function determines the value for a single byte in the YUV stream
30
+ float getByteValue(float byteOffset) {
31
+ float width = u_resolution.x;
32
+ float height = u_resolution.y;
33
+
34
+ float yPlaneSize = width * height;
35
+
36
+ if (byteOffset < yPlaneSize) {
37
+ // This byte is in the luma plane. Find the corresponding pixel coordinates to sample from
38
+ float y = floor(byteOffset / width);
39
+ float x = mod(byteOffset, width);
40
+
41
+ // Add 0.5 to sample the center of the texel
42
+ vec2 sampleCoord = (vec2(x, y) + 0.5) / u_resolution;
43
+
44
+ // The luma value is the alpha from the source texture
45
+ return texture(u_sourceTexture, sampleCoord).a;
46
+ } else {
47
+ // Write a fixed value for chroma and beyond
48
+ return 128.0 / 255.0;
49
+ }
50
+ }
51
+
52
+ void main() {
53
+ // Each fragment writes 4 bytes (R, G, B, A)
54
+ float pixelIndex = floor(gl_FragCoord.y) * u_resolution.x + floor(gl_FragCoord.x);
55
+ float baseByteOffset = pixelIndex * 4.0;
56
+
57
+ vec4 result;
58
+ for (int i = 0; i < 4; i++) {
59
+ float currentByteOffset = baseByteOffset + float(i);
60
+ result[i] = getByteValue(currentByteOffset);
61
+ }
62
+
63
+ fragColor = result;
64
+ }
65
+ `),i=this.gl.createProgram();return this.gl.attachShader(i,e),this.gl.attachShader(i,s),this.gl.linkProgram(i),i}createShader(e,s){const i=this.gl.createShader(e);return this.gl.shaderSource(i,s),this.gl.compileShader(i),this.gl.getShaderParameter(i,this.gl.COMPILE_STATUS)||console.error("Shader compile error:",this.gl.getShaderInfoLog(i)),i}createVAO(){const e=this.gl.createVertexArray();this.gl.bindVertexArray(e);const s=new Float32Array([-1,-1,0,1,1,-1,1,1,-1,1,0,0,1,1,1,0]),i=this.gl.createBuffer();this.gl.bindBuffer(this.gl.ARRAY_BUFFER,i),this.gl.bufferData(this.gl.ARRAY_BUFFER,s,this.gl.STATIC_DRAW);const r=this.gl.getAttribLocation(this.colorProgram,"a_position"),n=this.gl.getAttribLocation(this.colorProgram,"a_texCoord");return this.gl.enableVertexAttribArray(r),this.gl.vertexAttribPointer(r,2,this.gl.FLOAT,!1,16,0),this.gl.enableVertexAttribArray(n),this.gl.vertexAttribPointer(n,2,this.gl.FLOAT,!1,16,8),e}createTexture(){const e=this.gl.createTexture();return this.gl.bindTexture(this.gl.TEXTURE_2D,e),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR),e}updateTexture(e){this.lastFrame!==e&&((e.displayWidth!==this.canvas.width||e.displayHeight!==this.canvas.height)&&(this.canvas.width=e.displayWidth,this.canvas.height=e.displayHeight),this.gl.activeTexture(this.gl.TEXTURE0),this.gl.bindTexture(this.gl.TEXTURE_2D,this.sourceTexture),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.gl.RGBA,this.gl.UNSIGNED_BYTE,e),this.lastFrame=e)}extractColor(e){return this.updateTexture(e),this.gl.useProgram(this.colorProgram),this.gl.viewport(0,0,this.canvas.width,this.canvas.height),this.gl.clear(this.gl.COLOR_BUFFER_BIT),this.gl.bindVertexArray(this.vao),this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4),new VideoFrame(this.canvas,{timestamp:e.timestamp,duration:e.duration??void 0,alpha:"discard"})}extractAlpha(e){this.updateTexture(e),this.gl.useProgram(this.alphaProgram),this.gl.uniform2f(this.alphaResolutionLocation,this.canvas.width,this.canvas.height),this.gl.viewport(0,0,this.canvas.width,this.canvas.height),this.gl.clear(this.gl.COLOR_BUFFER_BIT),this.gl.bindVertexArray(this.vao),this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4);const{width:s,height:i}=this.canvas,r=Math.ceil(s/2)*Math.ceil(i/2),n=s*i+r*2,o=Math.ceil(n/(s*4));let a=new Uint8Array(4*s*o);this.gl.readPixels(0,0,s,o,this.gl.RGBA,this.gl.UNSIGNED_BYTE,a),a=a.subarray(0,n),m(a[s*i]===128),m(a[a.length-1]===128);const u={format:"I420",codedWidth:s,codedHeight:i,timestamp:e.timestamp,duration:e.duration??void 0,transfer:[a.buffer]};return new VideoFrame(a,u)}close(){this.gl.getExtension("WEBGL_lose_context")?.loseContext(),this.gl=null}}class pi extends dt{constructor(e,s){if(!(typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement)&&!(typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas))throw new TypeError("canvas must be an HTMLCanvasElement or OffscreenCanvas.");ai(s),super(s.codec),this._encoder=new fi(this,s),this._canvas=e}add(e,s=0,i){if(!Number.isFinite(e)||e<0)throw new TypeError("timestamp must be a non-negative number.");if(!Number.isFinite(s)||s<0)throw new TypeError("duration must be a non-negative number.");const r=new $e(this._canvas,{timestamp:e,duration:s});return this._encoder.add(r,!0,i)}_flushAndClose(e){return this._encoder.flushAndClose(e)}}class lt extends Se{constructor(e){if(super(),this._connectedTrack=null,!L.includes(e))throw new TypeError(`Invalid audio codec '${e}'. Must be one of: ${L.join(", ")}.`);this._codec=e}}class gi{constructor(e,s){this.source=e,this.encodingConfig=s,this.ensureEncoderPromise=null,this.encoderInitialized=!1,this.encoder=null,this.muxer=null,this.lastNumberOfChannels=null,this.lastSampleRate=null,this.isPcmEncoder=!1,this.outputSampleSize=null,this.writeOutputValue=null,this.customEncoder=null,this.customEncoderCallSerializer=new He,this.customEncoderQueueSize=0,this.lastEndSampleIndex=null,this.error=null,this.errorNeedsNewStack=!0}async add(e,s){try{if(this.checkForEncoderError(),this.source._ensureValidAdd(),this.lastNumberOfChannels!==null&&this.lastSampleRate!==null){if(e.numberOfChannels!==this.lastNumberOfChannels||e.sampleRate!==this.lastSampleRate)throw new Error(`Audio parameters must remain constant. Expected ${this.lastNumberOfChannels} channels at ${this.lastSampleRate} Hz, got ${e.numberOfChannels} channels at ${e.sampleRate} Hz.`)}else this.lastNumberOfChannels=e.numberOfChannels,this.lastSampleRate=e.sampleRate;this.encoderInitialized||(this.ensureEncoderPromise||this.ensureEncoder(e),this.encoderInitialized||await this.ensureEncoderPromise),m(this.encoderInitialized);{const i=Math.round(e.timestamp*e.sampleRate),r=Math.round((e.timestamp+e.duration)*e.sampleRate);if(this.lastEndSampleIndex===null)this.lastEndSampleIndex=r;else{const n=i-this.lastEndSampleIndex;if(n>=64){const o=new Le({data:new Float32Array(n*e.numberOfChannels),format:"f32-planar",sampleRate:e.sampleRate,numberOfChannels:e.numberOfChannels,numberOfFrames:n,timestamp:this.lastEndSampleIndex/e.sampleRate});await this.add(o,!0)}this.lastEndSampleIndex+=e.numberOfFrames}}if(this.customEncoder){this.customEncoderQueueSize++;const i=e.clone(),r=this.customEncoderCallSerializer.call(()=>this.customEncoder.encode(i)).then(()=>this.customEncoderQueueSize--).catch(n=>this.error??=n).finally(()=>{i.close()});this.customEncoderQueueSize>=4&&await r,await this.muxer.mutex.currentPromise}else if(this.isPcmEncoder)await this.doPcmEncoding(e,s);else{m(this.encoder);const i=e.toAudioData();this.encoder.encode(i),i.close(),s&&e.close(),this.encoder.encodeQueueSize>=4&&await new Promise(r=>this.encoder.addEventListener("dequeue",r,{once:!0})),await this.muxer.mutex.currentPromise}}finally{s&&e.close()}}async doPcmEncoding(e,s){m(this.outputSampleSize),m(this.writeOutputValue);const{numberOfChannels:i,numberOfFrames:r,sampleRate:n,timestamp:o}=e,a=2048,u=[];for(let f=0;f<r;f+=a){const h=Math.min(a,e.numberOfFrames-f),T=h*i*this.outputSampleSize,b=new ArrayBuffer(T),E=new DataView(b);u.push({frameCount:h,view:E})}const c=e.allocationSize({planeIndex:0,format:"f32-planar"}),d=new Float32Array(c/Float32Array.BYTES_PER_ELEMENT);for(let f=0;f<i;f++){e.copyTo(d,{planeIndex:f,format:"f32-planar"});for(let h=0;h<u.length;h++){const{frameCount:T,view:b}=u[h];for(let E=0;E<T;E++)this.writeOutputValue(b,(E*i+f)*this.outputSampleSize,d[h*a+E])}}s&&e.close();const w={decoderConfig:{codec:this.encodingConfig.codec,numberOfChannels:i,sampleRate:n}};for(let f=0;f<u.length;f++){const{frameCount:h,view:T}=u[f],b=T.buffer,E=f*a,x=new ee(new Uint8Array(b),"key",o+E/n,h/n);this.encodingConfig.onEncodedPacket?.(x,w),await this.muxer.addEncodedAudioPacket(this.source._connectedTrack,x,w)}}ensureEncoder(e){const s=new Error;this.ensureEncoderPromise=(async()=>{const{numberOfChannels:i,sampleRate:r}=e,n=be({numberOfChannels:i,sampleRate:r,...this.encodingConfig});this.encodingConfig.onEncoderConfig?.(n);const o=we.find(a=>a.supports(this.encodingConfig.codec,n));if(o)this.customEncoder=new o,this.customEncoder.codec=this.encodingConfig.codec,this.customEncoder.config=n,this.customEncoder.onPacket=(a,u)=>{if(!(a instanceof ee))throw new TypeError("The first argument passed to onPacket must be an EncodedPacket.");if(u!==void 0&&(!u||typeof u!="object"))throw new TypeError("The second argument passed to onPacket must be an object or undefined.");this.encodingConfig.onEncodedPacket?.(a,u),this.muxer.addEncodedAudioPacket(this.source._connectedTrack,a,u).catch(c=>{this.error??=c,this.errorNeedsNewStack=!1})},await this.customEncoder.init();else if(Y.includes(this.encodingConfig.codec))this.initPcmEncoder();else{if(typeof AudioEncoder>"u")throw new Error("AudioEncoder is not supported by this browser.");if(!(await AudioEncoder.isConfigSupported(n)).supported)throw new Error(`This specific encoder configuration (${n.codec}, ${n.bitrate} bps, ${n.numberOfChannels} channels, ${n.sampleRate} Hz) is not supported by this browser. Consider using another codec or changing your audio parameters.`);this.encoder=new AudioEncoder({output:(u,c)=>{if(this.encodingConfig.codec==="aac"&&c?.decoderConfig){let w=!1;if(!c.decoderConfig.description||c.decoderConfig.description.byteLength<2?w=!0:w=Wt(Z(c.decoderConfig.description)).objectType===0,w){const f=Number($(n.codec.split(".")));c.decoderConfig.description=Ut({objectType:f,numberOfChannels:c.decoderConfig.numberOfChannels,sampleRate:c.decoderConfig.sampleRate})}}const d=ee.fromEncodedChunk(u);this.encodingConfig.onEncodedPacket?.(d,c),this.muxer.addEncodedAudioPacket(this.source._connectedTrack,d,c).catch(w=>{this.error??=w,this.errorNeedsNewStack=!1})},error:u=>{u.stack=s.stack,this.error??=u}}),this.encoder.configure(n)}m(this.source._connectedTrack),this.muxer=this.source._connectedTrack.output._muxer,this.encoderInitialized=!0})()}initPcmEncoder(){this.isPcmEncoder=!0;const e=this.encodingConfig.codec,{dataType:s,sampleSize:i,littleEndian:r}=X(e);switch(this.outputSampleSize=i,i){case 1:s==="unsigned"?this.writeOutputValue=(n,o,a)=>n.setUint8(o,P((a+1)*127.5,0,255)):s==="signed"?this.writeOutputValue=(n,o,a)=>{n.setInt8(o,P(Math.round(a*128),-128,127))}:s==="ulaw"?this.writeOutputValue=(n,o,a)=>{const u=P(Math.floor(a*32767),-32768,32767);n.setUint8(o,$t(u))}:s==="alaw"?this.writeOutputValue=(n,o,a)=>{const u=P(Math.floor(a*32767),-32768,32767);n.setUint8(o,Lt(u))}:m(!1);break;case 2:s==="unsigned"?this.writeOutputValue=(n,o,a)=>n.setUint16(o,P((a+1)*32767.5,0,65535),r):s==="signed"?this.writeOutputValue=(n,o,a)=>n.setInt16(o,P(Math.round(a*32767),-32768,32767),r):m(!1);break;case 3:s==="unsigned"?this.writeOutputValue=(n,o,a)=>Vt(n,o,P((a+1)*83886075e-1,0,16777215),r):s==="signed"?this.writeOutputValue=(n,o,a)=>Nt(n,o,P(Math.round(a*8388607),-8388608,8388607),r):m(!1);break;case 4:s==="unsigned"?this.writeOutputValue=(n,o,a)=>n.setUint32(o,P((a+1)*21474836475e-1,0,4294967295),r):s==="signed"?this.writeOutputValue=(n,o,a)=>n.setInt32(o,P(Math.round(a*2147483647),-2147483648,2147483647),r):s==="float"?this.writeOutputValue=(n,o,a)=>n.setFloat32(o,a,r):m(!1);break;case 8:s==="float"?this.writeOutputValue=(n,o,a)=>n.setFloat64(o,a,r):m(!1);break;default:Ce(i),m(!1)}}async flushAndClose(e){e||this.checkForEncoderError(),this.customEncoder?(e||this.customEncoderCallSerializer.call(()=>this.customEncoder.flush()),await this.customEncoderCallSerializer.call(()=>this.customEncoder.close())):this.encoder&&(e||await this.encoder.flush(),this.encoder.state!=="closed"&&this.encoder.close()),e||this.checkForEncoderError()}getQueueSize(){return this.customEncoder?this.customEncoderQueueSize:this.isPcmEncoder?0:this.encoder?.encodeQueueSize??0}checkForEncoderError(){if(this.error)throw this.errorNeedsNewStack&&(this.error.stack=new Error().stack),this.error}}class wi extends lt{constructor(e){ci(e),super(e.codec),this._accumulatedTime=0,this._encoder=new gi(this,e)}async add(e){if(!(e instanceof AudioBuffer))throw new TypeError("audioBuffer must be an AudioBuffer.");const s=Le._fromAudioBuffer(e,this._accumulatedTime);this._accumulatedTime+=e.duration;for(const i of s)await this._encoder.add(i,!0)}_flushAndClose(e){return this._encoder.flushAndClose(e)}}class Ti extends Se{constructor(e){if(super(),this._connectedTrack=null,!re.includes(e))throw new TypeError(`Invalid subtitle codec '${e}'. Must be one of: ${re.join(", ")}.`);this._codec=e}}const yi=["video","audio","subtitle"],me=t=>{if(!t||typeof t!="object")throw new TypeError("metadata must be an object.");if(t.languageCode!==void 0&&!Qt(t.languageCode))throw new TypeError("metadata.languageCode, when provided, must be a three-letter, ISO 639-2/T language code.");if(t.name!==void 0&&typeof t.name!="string")throw new TypeError("metadata.name, when provided, must be a string.");if(t.disposition!==void 0&&qt(t.disposition),t.maximumPacketCount!==void 0&&(!Number.isInteger(t.maximumPacketCount)||t.maximumPacketCount<0))throw new TypeError("metadata.maximumPacketCount, when provided, must be a non-negative integer.")};class bi{constructor(e){if(this.state="pending",this._tracks=[],this._startPromise=null,this._cancelPromise=null,this._finalizePromise=null,this._mutex=new Ie,this._metadataTags={},!e||typeof e!="object")throw new TypeError("options must be an object.");if(!(e.format instanceof it))throw new TypeError("options.format must be an OutputFormat.");if(!(e.target instanceof tt))throw new TypeError("options.target must be a Target.");if(e.target._output)throw new Error("Target is already used for another output.");e.target._output=this,this.format=e.format,this.target=e.target,this._writer=e.target._createWriter(),this._muxer=e.format._createMuxer(this)}addVideoTrack(e,s={}){if(!(e instanceof dt))throw new TypeError("source must be a VideoSource.");if(me(s),s.rotation!==void 0&&![0,90,180,270].includes(s.rotation))throw new TypeError(`Invalid video rotation: ${s.rotation}. Has to be 0, 90, 180 or 270.`);if(!this.format.supportsVideoRotationMetadata&&s.rotation)throw new Error(`${this.format._name} does not support video rotation metadata.`);if(s.frameRate!==void 0&&(!Number.isFinite(s.frameRate)||s.frameRate<=0))throw new TypeError(`Invalid video frame rate: ${s.frameRate}. Must be a positive number.`);this._addTrack("video",e,s)}addAudioTrack(e,s={}){if(!(e instanceof lt))throw new TypeError("source must be an AudioSource.");me(s),this._addTrack("audio",e,s)}addSubtitleTrack(e,s={}){if(!(e instanceof Ti))throw new TypeError("source must be a SubtitleSource.");me(s),this._addTrack("subtitle",e,s)}setMetadataTags(e){if(Ht(e),this.state!=="pending")throw new Error("Cannot set metadata tags after output has been started or canceled.");this._metadataTags=e}_addTrack(e,s,i){if(this.state!=="pending")throw new Error("Cannot add track after output has been started or canceled.");if(s._connectedTrack)throw new Error("Source is already used for a track.");const r=this.format.getSupportedTrackCounts(),n=this._tracks.reduce((c,d)=>c+(d.type===e?1:0),0),o=r[e].max;if(n===o)throw new Error(o===0?`${this.format._name} does not support ${e} tracks.`:`${this.format._name} does not support more than ${o} ${e} track${o===1?"":"s"}.`);const a=r.total.max;if(this._tracks.length===a)throw new Error(`${this.format._name} does not support more than ${a} tracks${a===1?"":"s"} in total.`);const u={id:this._tracks.length+1,output:this,type:e,source:s,metadata:i};if(u.type==="video"){const c=this.format.getSupportedVideoCodecs();if(c.length===0)throw new Error(`${this.format._name} does not support video tracks.`+this.format._codecUnsupportedHint(u.source._codec));if(!c.includes(u.source._codec))throw new Error(`Codec '${u.source._codec}' cannot be contained within ${this.format._name}. Supported video codecs are: ${c.map(d=>`'${d}'`).join(", ")}.`+this.format._codecUnsupportedHint(u.source._codec))}else if(u.type==="audio"){const c=this.format.getSupportedAudioCodecs();if(c.length===0)throw new Error(`${this.format._name} does not support audio tracks.`+this.format._codecUnsupportedHint(u.source._codec));if(!c.includes(u.source._codec))throw new Error(`Codec '${u.source._codec}' cannot be contained within ${this.format._name}. Supported audio codecs are: ${c.map(d=>`'${d}'`).join(", ")}.`+this.format._codecUnsupportedHint(u.source._codec))}else if(u.type==="subtitle"){const c=this.format.getSupportedSubtitleCodecs();if(c.length===0)throw new Error(`${this.format._name} does not support subtitle tracks.`+this.format._codecUnsupportedHint(u.source._codec));if(!c.includes(u.source._codec))throw new Error(`Codec '${u.source._codec}' cannot be contained within ${this.format._name}. Supported subtitle codecs are: ${c.map(d=>`'${d}'`).join(", ")}.`+this.format._codecUnsupportedHint(u.source._codec))}this._tracks.push(u),s._connectedTrack=u}async start(){const e=this.format.getSupportedTrackCounts();for(const i of yi){const r=this._tracks.reduce((o,a)=>o+(a.type===i?1:0),0),n=e[i].min;if(r<n)throw new Error(n===e[i].max?`${this.format._name} requires exactly ${n} ${i} track${n===1?"":"s"}.`:`${this.format._name} requires at least ${n} ${i} track${n===1?"":"s"}.`)}const s=e.total.min;if(this._tracks.length<s)throw new Error(s===e.total.max?`${this.format._name} requires exactly ${s} track${s===1?"":"s"}.`:`${this.format._name} requires at least ${s} track${s===1?"":"s"}.`);if(this.state==="canceled")throw new Error("Output has been canceled.");return this._startPromise?(console.warn("Output has already been started."),this._startPromise):this._startPromise=(async()=>{this.state="started",this._writer.start();const i=await this._mutex.acquire();await this._muxer.start();const r=this._tracks.map(n=>n.source._start());await Promise.all(r),i()})()}getMimeType(){return this._muxer.getMimeType()}async cancel(){if(this._cancelPromise)return console.warn("Output has already been canceled."),this._cancelPromise;if(this.state==="finalizing"||this.state==="finalized"){console.warn("Output has already been finalized.");return}return this._cancelPromise=(async()=>{this.state="canceled";const e=await this._mutex.acquire(),s=this._tracks.map(i=>i.source._flushOrWaitForOngoingClose(!0));await Promise.all(s),await this._writer.close(),e()})()}async finalize(){if(this.state==="pending")throw new Error("Cannot finalize before starting.");if(this.state==="canceled")throw new Error("Cannot finalize after canceling.");return this._finalizePromise?(console.warn("Output has already been finalized."),this._finalizePromise):this._finalizePromise=(async()=>{this.state="finalizing";const e=await this._mutex.acquire(),s=this._tracks.map(i=>i.source._flushOrWaitForOngoingClose(!1));await Promise.all(s),await this._muxer.finalize(),await this._writer.flush(),await this._writer.finalize(),this.state="finalized",e()})()}}function Fe(t){return Math.round(t/2)*2}function Ci(t){return t.pages.reduce((e,s)=>e+(s.duration||5e3),0)}function Ei(t){let e=0;return t.pages.map(s=>{const i=e,r=s.duration||5e3;return e=i+r,{id:s.id,startTime:i,duration:r}})}function ht(t){const e=[];let s=0;for(const i of t.pages){const r=i.duration||5e3;for(const n of i.children)if(n.type==="video"){const o=n.volume!==void 0?n.volume:1;if(o===0)continue;const a=n.startTime||0,u=n.endTime||1,c=n.duration||5e3;e.push({id:n.id,src:n.src,volume:o,startTime:a,endTime:u,duration:c,pageStartTime:s,pageDuration:r})}s+=r}return e}function vi(t){const e=t.width,s=t.height;if(e%2!==0||s%2!==0){const i=Fe(e),r=Fe(s);return console.warn(`[polotno-video-export] Store dimensions ${e}x${s} are not even. Temporarily resizing to ${i}x${r} for H.264 codec compatibility.`),t.setSize(i,r,!0),{width:e,height:s}}return null}function Si(t,e){t.setSize(e.width,e.height,!0)}async function _i(t){for(const e of t.pages)t.selectPage(e.id),await t.waitLoading()}function xi(t,e){const s=jt(),i=s.sceneCanvas._canvas,r=t.width,n=t.height;if(i.width=r*e,i.height=n*e,i.width<=0||i.height<=0)throw new Error(`Invalid canvas dimensions: ${i.width}x${i.height}`);return{canvas:i,canvases:s}}async function ki(t,e){const s=new bi({target:new st,format:new nt}),i=await li(s.format.getSupportedVideoCodecs(),{width:t.width,height:t.height});if(!i)throw new Error("Your browser doesn't support video encoding.");const r=new pi(t,{codec:i,bitrate:ut});return s.addVideoTrack(r,{frameRate:e}),{output:s,canvasSource:r}}async function Ai(t,e,s){if(!s)return{audioBufferSource:null};const i=44100,r=2,n=e.audios&&e.audios.length>0,o=ht(e).length>0;if(!n&&!o)return{audioBufferSource:null};const a=await hi(t.format.getSupportedAudioCodecs(),{numberOfChannels:r,sampleRate:i});if(!a)return console.warn("Browser doesn't support audio encoding, video will be generated without audio."),{audioBufferSource:null};const u=new wi({codec:a,bitrate:ut});return t.addAudioTrack(u),{audioBufferSource:u,audioCodec:a}}function Pi(t,e,s){const i=e[s];return i&&t>=i.startTime&&t<i.startTime+i.duration?s:e.findIndex(r=>t>=r.startTime&&t<r.startTime+r.duration)}async function Mi(t,e,s,i,r){t.setCurrentTime(e),await t._toCanvas({pixelRatio:i,pageId:t.pages[s]?.id,_skipTimeout:!0,_exportCanvases:r})}async function Oi(t,e,s,i,r,n,o,a){const u=1e3/n,c=Math.floor(r/1e3*n)||1;t.setElementsPixelRatio(o),await _i(t);let d=-1,w=0;const f=300;for(let h=0;h<c;h++){const T=Date.now(),b=h/n,E=1/n;let x=b*1e3;h===0&&(x=1),h===c-1&&(x=Math.min(r-1,(h+1)*u-1));const V=Pi(x,i,d);if(V!==d&&V>=0&&(t.activePage.set({_rendering:!1}),t.selectPage(t.pages[V].id),t.activePage.set({_rendering:!0}),await t.waitLoading(),d=V),await Mi(t,x,V,o,s),await e.add(b,E),a){const J=Date.now();if(h===c-1||J-w>=f){const ne=J-T,k=(h+1)/c*.95;a(k,ne),w=J}}}t.pages.forEach(h=>{h.set({_rendering:!1})}),t.setCurrentTime(0)}async function zi(t){const e=await fetch(t);if(!e.ok)throw new Error(`Failed to download audio from ${t}`);return e.arrayBuffer()}async function Bi(t,e){return t.decodeAudioData(e)}function Fi(t){return t.startsWith("data:")}function Ii(t){return t.startsWith("file://")}function Ri(t){return t.startsWith("http://")||t.startsWith("https://")}function Wi(t){const e=t.split(",")[1],s=atob(e),i=new Uint8Array(s.length);for(let r=0;r<s.length;r++)i[r]=s.charCodeAt(r);return i.buffer}async function Ui(t){try{if(Ri(t))return new te({source:new Kt(t),formats:se});if(Fi(t)){const e=Wi(t);return new te({source:new ce(e),formats:se})}else if(Ii(t)){const e=await(await fetch(t)).arrayBuffer();return new te({source:new ce(e),formats:se})}else{const e=await(await fetch(t)).arrayBuffer();return new te({source:new ce(e),formats:se})}}catch(e){return console.error(`Failed to create input from ${t.slice(0,50)}:`,e),null}}async function Vi(t){try{const e=await Ui(t);return e?(await e.getAudioTracks()).length===0?(e.dispose(),{hasAudio:!1,input:null}):{hasAudio:!0,input:e}:{hasAudio:!1,input:null}}catch(e){return console.error(`Failed to check audio for ${t.slice(0,50)}:`,e),{hasAudio:!1,input:null}}}function ft(t){const e=t.audios||[],s=ht(t),i=e.map(n=>({audio:n,bufferPromise:zi(n.src).catch(o=>(console.error(`Failed to download audio ${n.src}:`,o),null))})),r=s.map(n=>({video:n,inputPromise:Vi(n.src)}));return{storeAudios:i,videoAudios:r}}function Ni(t,e,s){const i=(t.delay||0)/1e3,r=t.volume!==void 0?t.volume:1,n=t.startTime||0,o=t.endTime||1,a=t.duration||s.totalDuration,u=n*a/1e3,c=a*(o-n)/1e3;let d=i,w=u,f=Math.min(c,e.duration-u);if(d<0&&(w+=Math.abs(d),f-=Math.abs(d),d=0),f<=0||w>=e.duration)return;const h=s.offlineContext.createBufferSource();h.buffer=e;const T=s.offlineContext.createGain();T.gain.value=r,h.connect(T),T.connect(s.offlineContext.destination),h.start(d,w,f)}function $i(t,e,s){const i=t.startTime*t.duration/1e3,r=t.duration*(t.endTime-t.startTime)/1e3,n=t.pageStartTime/1e3;let o=Math.max(0,n),a=Math.max(0,i),u=Math.min(r,e.duration-a,t.pageDuration/1e3);if(u<=0||a>=e.duration)return;const c=s.offlineContext.createBufferSource();c.buffer=e;const d=s.offlineContext.createGain();d.gain.value=t.volume,c.connect(d),d.connect(s.offlineContext.destination),c.start(o,a,u)}async function Li(t,e,s,i,r,n){const o=r||ft(t);if(o.storeAudios.length+o.videoAudios.length===0)return;const a=44100,u=2,c=typeof i=="string"?i:typeof i?.codec=="string"?i.codec:void 0,d=c?.includes("opus")?960:1024,w=c==="aac"?3:c?.includes("opus")?2:0,f=Math.floor(s/1e3*a),h=Math.floor(f/d)*d,T=w*d,b=Math.max(d,h-T),E=new OfflineAudioContext(u,b,a),x={offlineContext:E,totalDuration:s};n?.(.95);const[V,J]=await Promise.all([Promise.all(o.storeAudios.map(async({audio:k,bufferPromise:oe})=>{try{const I=await oe;if(!I)return null;const q=await Bi(E,I);return{audio:k,audioBuffer:q}}catch(I){return console.error(`Failed to process audio ${k.src}:`,I),null}})),Promise.all(o.videoAudios.map(async({video:k,inputPromise:oe})=>{try{const{hasAudio:I,input:q}=await oe;if(!I||!q)return null;const _e=await q.getPrimaryAudioTrack();if(!_e)return q.dispose(),null;const mt=new Gt(_e),j=[];for await(const N of mt.buffers())j.push(N.buffer);if(q.dispose(),j.length===0)return null;const pt=j.reduce((N,G)=>N+G.length,0),xe=E.createBuffer(j[0].numberOfChannels,pt,j[0].sampleRate);let ke=0;for(const N of j){for(let G=0;G<N.numberOfChannels;G++)xe.getChannelData(G).set(N.getChannelData(G),ke);ke+=N.length}return{video:k,audioBuffer:xe}}catch(I){return console.error(`Failed to extract video audio ${k.src}:`,I),null}}))]);n?.(.97);for(const k of V)k&&Ni(k.audio,k.audioBuffer,x);for(const k of J)k&&$i(k.video,k.audioBuffer,x);const ne=await E.startRendering();n?.(.99),await e.add(ne)}async function Qi({store:t,fps:e=30,pixelRatio:s=1,onProgress:i,includeAudio:r=!0}){const n=vi(t);try{const o=Ci(t);if(o===0)throw new Error("Video duration is 0");const a=Ei(t),{canvas:u,canvases:c}=xi(t,s),{output:d,canvasSource:w}=await ki(u,e),{audioBufferSource:f,audioCodec:h}=await Ai(d,t,r);await d.start(),await Oi(t,w,c,a,o,e,s,i),w.close();const T=f?ft(t):null;f&&T&&(await Li(t,f,o,h,T,i),f.close()),await d.finalize();const b=d.target;return new Blob([b.buffer],{type:d.format.mimeType})}finally{n&&Si(t,n)}}export{Qi as storeToVideo};