canvaskit-wasm
Version:
A WASM version of Skia's Canvas API
108 lines (105 loc) • 136 kB
JavaScript
var CanvasKitInit = (function() {
var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;
if (typeof __filename !== 'undefined') _scriptDir = _scriptDir || __filename;
return (
function(CanvasKitInit) {
CanvasKitInit = CanvasKitInit || {};
null;var f;f||(f=typeof CanvasKitInit !== 'undefined' ? CanvasKitInit : {});var ca,ea;f.ready=new Promise(function(a,b){ca=a;ea=b});
(function(a){a.Xf=a.Xf||[];a.Xf.push(function(){a.MakeSWCanvasSurface=function(b){var c=b;if("CANVAS"!==c.tagName&&(c=document.getElementById(b),!c))throw"Canvas with id "+b+" was not found";if(b=a.MakeSurface(c.width,c.height))b.Tf=c;return b};a.MakeCanvasSurface||(a.MakeCanvasSurface=a.MakeSWCanvasSurface);a.MakeSurface=function(b,c){var d={width:b,height:c,colorType:a.ColorType.RGBA_8888,alphaType:a.AlphaType.Unpremul,colorSpace:a.ColorSpace.SRGB},h=b*c*4,m=a._malloc(h);if(d=this._getRasterDirectSurface(d,
m,4*b))d.Tf=null,d.Oh=b,d.Kh=c,d.Nh=h,d.mh=m,d.getCanvas().clear(a.TRANSPARENT);return d};a.Surface.prototype.flush=function(b){this._flush();if(this.Tf){var c=new Uint8ClampedArray(a.HEAPU8.buffer,this.mh,this.Nh);c=new ImageData(c,this.Oh,this.Kh);b?this.Tf.getContext("2d").putImageData(c,0,0,b[0],b[1],b[2]-b[0],b[3]-b[1]):this.Tf.getContext("2d").putImageData(c,0,0)}};a.Surface.prototype.dispose=function(){this.mh&&a._free(this.mh);this.delete()};a.currentContext=a.currentContext||function(){};
a.setCurrentContext=a.setCurrentContext||function(){}})})(f);
(function(a){a.Xf=a.Xf||[];a.Xf.push(function(){function b(c,d,h){return c&&c.hasOwnProperty(d)?c[d]:h}a.GetWebGLContext=function(c,d){if(!c)throw"null canvas passed into makeWebGLContext";var h={alpha:b(d,"alpha",1),depth:b(d,"depth",1),stencil:b(d,"stencil",8),antialias:b(d,"antialias",0),premultipliedAlpha:b(d,"premultipliedAlpha",1),preserveDrawingBuffer:b(d,"preserveDrawingBuffer",0),preferLowPowerToHighPerformance:b(d,"preferLowPowerToHighPerformance",0),failIfMajorPerformanceCaveat:b(d,"failIfMajorPerformanceCaveat",
0),enableExtensionsByDefault:b(d,"enableExtensionsByDefault",1),explicitSwapControl:b(d,"explicitSwapControl",0),renderViaOffscreenBackBuffer:b(d,"renderViaOffscreenBackBuffer",0)};h.majorVersion=d&&d.majorVersion?d.majorVersion:"undefined"!==typeof WebGL2RenderingContext?2:1;if(h.explicitSwapControl)throw"explicitSwapControl is not supported";if(c=1<h.majorVersion?c.getContext("webgl2",h):c.getContext("webgl",h)){d=fa(ha);var m={ai:d,attributes:h,version:h.majorVersion,Ah:c};c.canvas&&(c.canvas.Ih=
m);ha[d]=m;("undefined"===typeof h.Th||h.Th)&&ja(m);h=d}else h=0;if(!h)return 0;ka(h);return h};a.MakeWebGLCanvasSurface=function(c,d,h){d=d||null;var m=c,p="undefined"!==typeof OffscreenCanvas&&m instanceof OffscreenCanvas;if(!("undefined"!==typeof HTMLCanvasElement&&m instanceof HTMLCanvasElement||p||(m=document.getElementById(c),m)))throw"Canvas with id "+c+" was not found";c=this.GetWebGLContext(m,h);h=m.Ih.version;if(!c||0>c)throw"failed to create webgl context: err "+c;p=this.MakeGrContext(c);
d=this.MakeOnScreenGLSurface(p,m.width,m.height,d);if(!d)return d=m.cloneNode(!0),m.parentNode.replaceChild(d,m),d.classList.add("ck-replaced"),a.MakeSWCanvasSurface(d);d.tg=c;d.grContext=p;d.openGLversion=h;return d};a.MakeCanvasSurface=a.MakeWebGLCanvasSurface})})(f);
(function(a){function b(g){return Math.round(Math.max(0,Math.min(g||0,255)))}function c(g){return g?g.constructor===Float32Array&&4===g.length:!1}function d(g){return(b(255*g[3])<<24|b(255*g[0])<<16|b(255*g[1])<<8|b(255*g[2])<<0)>>>0}function h(g){if(g instanceof Float32Array){for(var n=Math.floor(g.length/4),x=new Uint32Array(n),B=0;B<n;B++)x[B]=d(g.slice(4*B,4*(B+1)));return x}if(g instanceof Uint32Array)return g;if(g instanceof Array&&g[0]instanceof Float32Array)return g.map(d)}function m(g){if(void 0===
g)return 1;var n=parseFloat(g);return g&&-1!==g.indexOf("%")?n/100:n}function p(g,n,x){if(!g||!g.length)return 0;if(g._ck)return g.byteOffset;var B=a[n].BYTES_PER_ELEMENT;x||(x=a._malloc(g.length*B));a[n].set(g,x/B);return x}function u(g,n,x){if(!g||!g.length)return 0;var B=a[n].BYTES_PER_ELEMENT;x||(x=a._malloc(g.length*g[0].length*B));n=a[n];var L=0;B=x/B;for(var V=0;V<g.length;V++)for(var e=0;e<g[0].length;e++)n[B+L]=g[V][e],L++;return x}function z(g){var n={ig:0,count:g.length,Wg:a.ColorType.RGBA_F32};
if(g instanceof Float32Array)n.ig=p(g,"HEAPF32"),n.count=g.length/4;else if(g instanceof Uint32Array)n.ig=p(g,"HEAPU32"),n.Wg=a.ColorType.RGBA_8888;else if(g instanceof Array&&g[0]instanceof Float32Array)n.ig=u(g,"HEAPF32");else throw"Invalid argument to copyFlexibleColorArray, Not a color array "+typeof g;return n}function E(g){if(!g)return 0;if(g.length){if(6!==g.length&&9!==g.length)throw"invalid matrix size";var n=p(g,"HEAPF32",jb);6===g.length&&a.HEAPF32.set(Cb,6+n/4);return n}n=fc.toTypedArray();
n[0]=g.m11;n[1]=g.m21;n[2]=g.m41;n[3]=g.m12;n[4]=g.m22;n[5]=g.m42;n[6]=g.m14;n[7]=g.m24;n[8]=g.m44;return jb}function I(g){if(!g)return 0;var n=hc.toTypedArray();if(g.length){if(16!==g.length&&6!==g.length&&9!==g.length)throw"invalid matrix size";if(16===g.length)return p(g,"HEAPF32",Ga);n.fill(0);n[0]=g[0];n[1]=g[1];n[3]=g[2];n[4]=g[3];n[5]=g[4];n[7]=g[5];n[12]=g[6];n[13]=g[7];n[15]=g[8];6===g.length&&(n[12]=0,n[13]=0,n[15]=1);return Ga}n[0]=g.m11;n[1]=g.m21;n[2]=g.m31;n[3]=g.m41;n[4]=g.m12;n[5]=
g.m22;n[6]=g.m32;n[7]=g.m42;n[8]=g.m13;n[9]=g.m23;n[10]=g.m33;n[11]=g.m43;n[12]=g.m14;n[13]=g.m24;n[14]=g.m34;n[15]=g.m44;return Ga}function N(g){for(var n=Array(16),x=0;16>x;x++)n[x]=a.HEAPF32[g/4+x];return n}function Q(g,n){return p(g,"HEAPF32",n||kb)}function A(g,n,x,B){var L=ic.toTypedArray();L[0]=g;L[1]=n;L[2]=x;L[3]=B;return kb}function R(g){for(var n=new Float32Array(4),x=0;4>x;x++)n[x]=a.HEAPF32[g/4+x];return n}function T(g,n){return p(g,"HEAPF32",n||Fa)}function da(g,n){return p(g,"HEAPF32",
n||jc)}function wa(g,n){if(lb)require("fs").writeFile(n,new Buffer(g),function(B){if(B)throw B;});else{url=window.URL.createObjectURL(new Blob([g],{type:"application/octet-stream"}));var x=document.createElement("a");document.body.appendChild(x);x.href=url;x.download=n;x.click();setTimeout(function(){URL.revokeObjectURL(url);x.remove()},50)}}function U(g,n){n&&!n._ck&&a._free(g)}a.Color=function(g,n,x,B){void 0===B&&(B=1);return a.Color4f(b(g)/255,b(n)/255,b(x)/255,B)};a.ColorAsInt=function(g,n,x,
B){void 0===B&&(B=255);return(b(B)<<24|b(g)<<16|b(n)<<8|b(x)<<0&268435455)>>>0};a.Color4f=function(g,n,x,B){void 0===B&&(B=1);return Float32Array.of(g,n,x,B)};Object.defineProperty(a,"TRANSPARENT",{get:function(){return a.Color4f(0,0,0,0)}});Object.defineProperty(a,"BLACK",{get:function(){return a.Color4f(0,0,0,1)}});Object.defineProperty(a,"WHITE",{get:function(){return a.Color4f(1,1,1,1)}});Object.defineProperty(a,"RED",{get:function(){return a.Color4f(1,0,0,1)}});Object.defineProperty(a,"GREEN",
{get:function(){return a.Color4f(0,1,0,1)}});Object.defineProperty(a,"BLUE",{get:function(){return a.Color4f(0,0,1,1)}});Object.defineProperty(a,"YELLOW",{get:function(){return a.Color4f(1,1,0,1)}});Object.defineProperty(a,"CYAN",{get:function(){return a.Color4f(0,1,1,1)}});Object.defineProperty(a,"MAGENTA",{get:function(){return a.Color4f(1,0,1,1)}});a.getColorComponents=function(g){return[Math.floor(255*g[0]),Math.floor(255*g[1]),Math.floor(255*g[2]),g[3]]};a.parseColorString=function(g,n){g=g.toLowerCase();
if(g.startsWith("#")){n=255;switch(g.length){case 9:n=parseInt(g.slice(7,9),16);case 7:var x=parseInt(g.slice(1,3),16);var B=parseInt(g.slice(3,5),16);var L=parseInt(g.slice(5,7),16);break;case 5:n=17*parseInt(g.slice(4,5),16);case 4:x=17*parseInt(g.slice(1,2),16),B=17*parseInt(g.slice(2,3),16),L=17*parseInt(g.slice(3,4),16)}return a.Color(x,B,L,n/255)}return g.startsWith("rgba")?(g=g.slice(5,-1),g=g.split(","),a.Color(+g[0],+g[1],+g[2],m(g[3]))):g.startsWith("rgb")?(g=g.slice(4,-1),g=g.split(","),
a.Color(+g[0],+g[1],+g[2],m(g[3]))):g.startsWith("gray(")||g.startsWith("hsl")||!n||(g=n[g],void 0===g)?a.BLACK:g};a.multiplyByAlpha=function(g,n){g=g.slice();g[3]=Math.max(0,Math.min(g[3]*n,1));return g};var lb=!(new Function("try {return this===window;}catch(e){ return false;}"))(),Cb=Float32Array.of(0,0,1),jb=0,fc,Ga=0,hc,kb=0,ic,Ha,Fa=0,Oc,Pc=0,Qc,kc=0,Rc,jc=0,Sc,Tc=0,lc={};a.yg=function(){this.sg=[];this.ag=null;Object.defineProperty(this,"length",{enumerable:!0,get:function(){return this.sg.length/
4}})};a.yg.prototype.push=function(g,n,x,B){this.ag||this.sg.push(g,n,x,B)};a.yg.prototype.set=function(g,n,x,B,L){0>g||g>=this.sg.length/4||(g*=4,this.ag?(g=this.ag/4+g,a.HEAPF32[g]=n,a.HEAPF32[g+1]=x,a.HEAPF32[g+2]=B,a.HEAPF32[g+3]=L):(this.sg[g]=n,this.sg[g+1]=x,this.sg[g+2]=B,this.sg[g+3]=L))};a.yg.prototype.build=function(){return this.ag?this.ag:this.ag=p(this.sg,"HEAPF32")};a.yg.prototype.delete=function(){this.ag&&(a._free(this.ag),this.ag=null)};a.Pg=function(){this.Vg=[];this.ag=null;Object.defineProperty(this,
"length",{enumerable:!0,get:function(){return this.Vg.length}})};a.Pg.prototype.push=function(g){this.ag||this.Vg.push(g)};a.Pg.prototype.set=function(g,n){0>g||g>=this.Vg.length||(g*=4,this.ag?a.HEAPU32[this.ag/4+g]=n:this.Vg[g]=n)};a.Pg.prototype.build=function(){return this.ag?this.ag:this.ag=p(this.Vg,"HEAPU32")};a.Pg.prototype.delete=function(){this.ag&&(a._free(this.ag),this.ag=null)};a.RectBuilder=a.yg;a.RSXFormBuilder=a.yg;a.ColorBuilder=a.Pg;a.Malloc=function(g,n){var x=a._malloc(n*g.BYTES_PER_ELEMENT);
return{_ck:!0,length:n,byteOffset:x,xg:null,subarray:function(B,L){B=this.toTypedArray().subarray(B,L);B._ck=!0;return B},toTypedArray:function(){if(this.xg&&this.xg.length)return this.xg;this.xg=new g(a.HEAPU8.buffer,x,n);this.xg._ck=!0;return this.xg}}};a.Free=function(g){a._free(g.byteOffset);g.byteOffset=0;g.toTypedArray=null;g.xg=null};a.onRuntimeInitialized=function(){function g(e,l,t,w,C){for(var r=0;r<e.length;r++)l[r*t+(r*C+w+t)%t]=e[r];return l}function n(e){for(var l=e*e,t=Array(l);l--;)t[l]=
0==l%(e+1)?1:0;return t}function x(){for(var e=0,l=0;l<arguments.length-1;l+=2)e+=arguments[l]*arguments[l+1];return e}function B(e,l,t){for(var w=Array(e.length),C=0;C<t;C++)for(var r=0;r<t;r++){for(var F=0,M=0;M<t;M++)F+=e[t*C+M]*l[t*M+r];w[C*t+r]=F}return w}function L(e,l){for(var t=B(l[0],l[1],e),w=2;w<l.length;)t=B(t,l[w],e),w++;return t}ic=a.Malloc(Float32Array,4);kb=ic.byteOffset;hc=a.Malloc(Float32Array,16);Ga=hc.byteOffset;fc=a.Malloc(Float32Array,9);jb=fc.byteOffset;Rc=a.Malloc(Float32Array,
12);jc=Rc.byteOffset;Sc=a.Malloc(Float32Array,12);Tc=Sc.byteOffset;Ha=a.Malloc(Float32Array,4);Fa=Ha.byteOffset;Oc=a.Malloc(Float32Array,4);Pc=Oc.byteOffset;Qc=a.Malloc(Int32Array,4);kc=Qc.byteOffset;a.ColorSpace.SRGB=a.ColorSpace._MakeSRGB();a.ColorSpace.DISPLAY_P3=a.ColorSpace._MakeDisplayP3();a.ColorSpace.ADOBE_RGB=a.ColorSpace._MakeAdobeRGB();a.Matrix={};a.Matrix.identity=function(){return n(3)};a.Matrix.invert=function(e){var l=e[0]*e[4]*e[8]+e[1]*e[5]*e[6]+e[2]*e[3]*e[7]-e[2]*e[4]*e[6]-e[1]*
e[3]*e[8]-e[0]*e[5]*e[7];return l?[(e[4]*e[8]-e[5]*e[7])/l,(e[2]*e[7]-e[1]*e[8])/l,(e[1]*e[5]-e[2]*e[4])/l,(e[5]*e[6]-e[3]*e[8])/l,(e[0]*e[8]-e[2]*e[6])/l,(e[2]*e[3]-e[0]*e[5])/l,(e[3]*e[7]-e[4]*e[6])/l,(e[1]*e[6]-e[0]*e[7])/l,(e[0]*e[4]-e[1]*e[3])/l]:null};a.Matrix.mapPoints=function(e,l){for(var t=0;t<l.length;t+=2){var w=l[t],C=l[t+1],r=e[6]*w+e[7]*C+e[8],F=e[3]*w+e[4]*C+e[5];l[t]=(e[0]*w+e[1]*C+e[2])/r;l[t+1]=F/r}return l};a.Matrix.multiply=function(){return L(3,arguments)};a.Matrix.rotated=function(e,
l,t){l=l||0;t=t||0;var w=Math.sin(e);e=Math.cos(e);return[e,-w,x(w,t,1-e,l),w,e,x(-w,l,1-e,t),0,0,1]};a.Matrix.scaled=function(e,l,t,w){t=t||0;w=w||0;var C=g([e,l],n(3),3,0,1);return g([t-e*t,w-l*w],C,3,2,0)};a.Matrix.skewed=function(e,l,t,w){t=t||0;w=w||0;var C=g([e,l],n(3),3,1,-1);return g([-e*t,-l*w],C,3,2,0)};a.Matrix.translated=function(e,l){return g(arguments,n(3),3,2,0)};a.Vector={};a.Vector.dot=function(e,l){return e.map(function(t,w){return t*l[w]}).reduce(function(t,w){return t+w})};a.Vector.lengthSquared=
function(e){return a.Vector.dot(e,e)};a.Vector.length=function(e){return Math.sqrt(a.Vector.lengthSquared(e))};a.Vector.mulScalar=function(e,l){return e.map(function(t){return t*l})};a.Vector.add=function(e,l){return e.map(function(t,w){return t+l[w]})};a.Vector.sub=function(e,l){return e.map(function(t,w){return t-l[w]})};a.Vector.dist=function(e,l){return a.Vector.length(a.Vector.sub(e,l))};a.Vector.normalize=function(e){return a.Vector.mulScalar(e,1/a.Vector.length(e))};a.Vector.cross=function(e,
l){return[e[1]*l[2]-e[2]*l[1],e[2]*l[0]-e[0]*l[2],e[0]*l[1]-e[1]*l[0]]};a.M44={};a.M44.identity=function(){return n(4)};a.M44.translated=function(e){return g(e,n(4),4,3,0)};a.M44.scaled=function(e){return g(e,n(4),4,0,1)};a.M44.rotated=function(e,l){return a.M44.rotatedUnitSinCos(a.Vector.normalize(e),Math.sin(l),Math.cos(l))};a.M44.rotatedUnitSinCos=function(e,l,t){var w=e[0],C=e[1];e=e[2];var r=1-t;return[r*w*w+t,r*w*C-l*e,r*w*e+l*C,0,r*w*C+l*e,r*C*C+t,r*C*e-l*w,0,r*w*e-l*C,r*C*e+l*w,r*e*e+t,0,
0,0,0,1]};a.M44.lookat=function(e,l,t){l=a.Vector.normalize(a.Vector.sub(l,e));t=a.Vector.normalize(t);t=a.Vector.normalize(a.Vector.cross(l,t));var w=a.M44.identity();g(t,w,4,0,0);g(a.Vector.cross(t,l),w,4,1,0);g(a.Vector.mulScalar(l,-1),w,4,2,0);g(e,w,4,3,0);e=a.M44.invert(w);return null===e?a.M44.identity():e};a.M44.perspective=function(e,l,t){var w=1/(l-e);t/=2;t=Math.cos(t)/Math.sin(t);return[t,0,0,0,0,t,0,0,0,0,(l+e)*w,2*l*e*w,0,0,-1,1]};a.M44.rc=function(e,l,t){return e[4*l+t]};a.M44.multiply=
function(){return L(4,arguments)};a.M44.invert=function(e){var l=e[0],t=e[4],w=e[8],C=e[12],r=e[1],F=e[5],M=e[9],P=e[13],W=e[2],ba=e[6],ma=e[10],oa=e[14],J=e[3],k=e[7],q=e[11];e=e[15];var y=l*F-t*r,D=l*M-w*r,G=l*P-C*r,H=t*M-w*F,O=t*P-C*F,aa=w*P-C*M,ia=W*k-ba*J,pa=W*q-ma*J,qa=W*e-oa*J,Xa=ba*q-ma*k,Ya=ba*e-oa*k,Za=ma*e-oa*q,Uc=y*Za-D*Ya+G*Xa+H*qa-O*pa+aa*ia,ra=1/Uc;if(0===Uc||Infinity===ra)return null;y*=ra;D*=ra;G*=ra;H*=ra;O*=ra;aa*=ra;ia*=ra;pa*=ra;qa*=ra;Xa*=ra;Ya*=ra;Za*=ra;l=[F*Za-M*Ya+P*Xa,M*
qa-r*Za-P*pa,r*Ya-F*qa+P*ia,F*pa-r*Xa-M*ia,w*Ya-t*Za-C*Xa,l*Za-w*qa+C*pa,t*qa-l*Ya-C*ia,l*Xa-t*pa+w*ia,k*aa-q*O+e*H,q*G-J*aa-e*D,J*O-k*G+e*y,k*D-J*H-q*y,ma*O-ba*aa-oa*H,W*aa-ma*G+oa*D,ba*G-W*O-oa*y,W*H-ba*D+ma*y];return l.every(function(mc){return!isNaN(mc)&&Infinity!==mc&&-Infinity!==mc})?l:null};a.M44.transpose=function(e){return[e[0],e[4],e[8],e[12],e[1],e[5],e[9],e[13],e[2],e[6],e[10],e[14],e[3],e[7],e[11],e[15]]};a.M44.mustInvert=function(e){e=a.M44.invert(e);if(null===e)throw"Matrix not invertible";
return e};a.M44.setupCamera=function(e,l,t){var w=a.M44.lookat(t.eye,t.coa,t.up);t=a.M44.perspective(t.near,t.far,t.angle);l=[(e[2]-e[0])/2,(e[3]-e[1])/2,l];e=a.M44.multiply(a.M44.translated([(e[0]+e[2])/2,(e[1]+e[3])/2,0]),a.M44.scaled(l));return a.M44.multiply(e,t,w,a.M44.mustInvert(e))};a.ColorMatrix={};a.ColorMatrix.identity=function(){var e=new Float32Array(20);e[0]=1;e[6]=1;e[12]=1;e[18]=1;return e};a.ColorMatrix.scaled=function(e,l,t,w){var C=new Float32Array(20);C[0]=e;C[6]=l;C[12]=t;C[18]=
w;return C};var V=[[6,7,11,12],[0,10,2,12],[0,1,5,6]];a.ColorMatrix.rotated=function(e,l,t){var w=a.ColorMatrix.identity();e=V[e];w[e[0]]=t;w[e[1]]=l;w[e[2]]=-l;w[e[3]]=t;return w};a.ColorMatrix.postTranslate=function(e,l,t,w,C){e[4]+=l;e[9]+=t;e[14]+=w;e[19]+=C;return e};a.ColorMatrix.concat=function(e,l){for(var t=new Float32Array(20),w=0,C=0;20>C;C+=5){for(var r=0;4>r;r++)t[w++]=e[C]*l[r]+e[C+1]*l[r+5]+e[C+2]*l[r+10]+e[C+3]*l[r+15];t[w++]=e[C]*l[4]+e[C+1]*l[9]+e[C+2]*l[14]+e[C+3]*l[19]+e[C+4]}return t};
a.Path.MakeFromCmds=function(e){for(var l=0,t=0;t<e.length;t++)l+=e[t].length;if(lc[l])var w=lc[l];else w=new Float32Array(l),lc[l]=w;var C=0;for(t=0;t<e.length;t++)for(var r=0;r<e[t].length;r++)w[C]=e[t][r],C++;e=[p(w,"HEAPF32"),l];l=a.Path._MakeFromCmds(e[0],e[1]);a._free(e[0]);return l};a.MakePathFromCmds=a.Path.MakeFromCmds;a.Path.MakeFromVerbsPointsWeights=function(e,l,t){var w=p(e,"HEAPU8"),C=p(l,"HEAPF32"),r=p(t,"HEAPF32"),F=a.Path._MakeFromVerbsPointsWeights(w,e.length,C,l.length,r,t&&t.length||
0);U(w,e);U(C,l);U(r,t);return F};a.Path.prototype.addArc=function(e,l,t){e=T(e);this._addArc(e,l,t);return this};a.Path.prototype.addOval=function(e,l,t){void 0===t&&(t=1);e=T(e);this._addOval(e,!!l,t);return this};a.Path.prototype.addPath=function(){var e=Array.prototype.slice.call(arguments),l=e[0],t=!1;"boolean"===typeof e[e.length-1]&&(t=e.pop());if(1===e.length)this._addPath(l,1,0,0,0,1,0,0,0,1,t);else if(2===e.length)e=e[1],this._addPath(l,e[0],e[1],e[2],e[3],e[4],e[5],e[6]||0,e[7]||0,e[8]||
1,t);else if(7===e.length||10===e.length)this._addPath(l,e[1],e[2],e[3],e[4],e[5],e[6],e[7]||0,e[8]||0,e[9]||1,t);else return null;return this};a.Path.prototype.addPoly=function(e,l){if(e._ck){var t=e.byteOffset;var w=e.length/2}else t=u(e,"HEAPF32"),w=e.length;this._addPoly(t,w,l);U(t,e);return this};a.Path.prototype.addRect=function(e,l){e=T(e);this._addRect(e,!!l);return this};a.Path.prototype.addRRect=function(e,l){e=da(e);this._addRRect(e,!!l);return this};a.Path.prototype.addVerbsPointsWeights=
function(e,l,t){var w=p(e,"HEAPU8"),C=p(l,"HEAPF32"),r=p(t,"HEAPF32");this._addVerbsPointsWeights(w,e.length,C,l.length,r,t&&t.length||0);U(w,e);U(C,l);U(r,t)};a.Path.prototype.arc=function(e,l,t,w,C,r){e=a.LTRBRect(e-t,l-t,e+t,l+t);C=(C-w)/Math.PI*180-360*!!r;r=new a.Path;r.addArc(e,w/Math.PI*180,C);this.addPath(r,!0);r.delete();return this};a.Path.prototype.arcToOval=function(e,l,t,w){e=T(e);this._arcToOval(e,l,t,w);return this};a.Path.prototype.arcToRotated=function(e,l,t,w,C,r,F){this._arcToRotated(e,
l,t,!!w,!!C,r,F);return this};a.Path.prototype.arcToTangent=function(e,l,t,w,C){this._arcToTangent(e,l,t,w,C);return this};a.Path.prototype.close=function(){this._close();return this};a.Path.prototype.conicTo=function(e,l,t,w,C){this._conicTo(e,l,t,w,C);return this};a.Path.prototype.computeTightBounds=function(e){this._computeTightBounds(Fa);var l=Ha.toTypedArray();return e?(e.set(l),e):l.slice()};a.Path.prototype.cubicTo=function(e,l,t,w,C,r){this._cubicTo(e,l,t,w,C,r);return this};a.Path.prototype.dash=
function(e,l,t){return this._dash(e,l,t)?this:null};a.Path.prototype.getBounds=function(e){this._getBounds(Fa);var l=Ha.toTypedArray();return e?(e.set(l),e):l.slice()};a.Path.prototype.lineTo=function(e,l){this._lineTo(e,l);return this};a.Path.prototype.moveTo=function(e,l){this._moveTo(e,l);return this};a.Path.prototype.offset=function(e,l){this._transform(1,0,e,0,1,l,0,0,1);return this};a.Path.prototype.quadTo=function(e,l,t,w){this._quadTo(e,l,t,w);return this};a.Path.prototype.rArcTo=function(e,
l,t,w,C,r,F){this._rArcTo(e,l,t,w,C,r,F);return this};a.Path.prototype.rConicTo=function(e,l,t,w,C){this._rConicTo(e,l,t,w,C);return this};a.Path.prototype.rCubicTo=function(e,l,t,w,C,r){this._rCubicTo(e,l,t,w,C,r);return this};a.Path.prototype.rLineTo=function(e,l){this._rLineTo(e,l);return this};a.Path.prototype.rMoveTo=function(e,l){this._rMoveTo(e,l);return this};a.Path.prototype.rQuadTo=function(e,l,t,w){this._rQuadTo(e,l,t,w);return this};a.Path.prototype.stroke=function(e){e=e||{};e.width=
e.width||1;e.miter_limit=e.miter_limit||4;e.cap=e.cap||a.StrokeCap.Butt;e.join=e.join||a.StrokeJoin.Miter;e.precision=e.precision||1;return this._stroke(e)?this:null};a.Path.prototype.transform=function(){if(1===arguments.length){var e=arguments[0];this._transform(e[0],e[1],e[2],e[3],e[4],e[5],e[6]||0,e[7]||0,e[8]||1)}else if(6===arguments.length||9===arguments.length)e=arguments,this._transform(e[0],e[1],e[2],e[3],e[4],e[5],e[6]||0,e[7]||0,e[8]||1);else throw"transform expected to take 1 or 9 arguments. Got "+
arguments.length;return this};a.Path.prototype.trim=function(e,l,t){return this._trim(e,l,!!t)?this:null};a.Image.prototype.encodeToData=function(){if(!arguments.length)return this._encodeToData();if(2===arguments.length){var e=arguments;return this._encodeToDataWithFormat(e[0],e[1])}throw"encodeToData expected to take 0 or 2 arguments. Got "+arguments.length;};a.Image.prototype.makeShader=function(e,l,t){t=E(t);return this._makeShader(e,l,t)};a.Image.prototype.readPixels=function(e,l,t){switch(e.colorType){case a.ColorType.RGBA_8888:var w=
4*e.width;break;case a.ColorType.RGBA_F32:w=16*e.width;break;default:return}var C=w*e.height,r=a._malloc(C);if(!this._readPixels(e,r,w,l,t))return null;l=null;switch(e.colorType){case a.ColorType.RGBA_8888:l=(new Uint8Array(a.HEAPU8.buffer,r,C)).slice();break;case a.ColorType.RGBA_F32:l=(new Float32Array(a.HEAPU8.buffer,r,C)).slice()}a._free(r);return l};a.Canvas.prototype.clear=function(e){e=Q(e);this._clear(e)};a.Canvas.prototype.clipRRect=function(e,l,t){e=da(e);this._clipRRect(e,l,t)};a.Canvas.prototype.clipRect=
function(e,l,t){e=T(e);this._clipRect(e,l,t)};a.Canvas.prototype.concat=function(e){e=I(e);this._concat(e)};a.Canvas.prototype.drawArc=function(e,l,t,w,C){e=T(e);this._drawArc(e,l,t,w,C)};a.Canvas.prototype.drawAtlas=function(e,l,t,w,C,r){if(e&&w&&l&&t&&l.length===t.length){C||(C=a.BlendMode.SrcOver);var F;l.build?F=l.build():F=p(l,"HEAPF32");if(t.build){var M=t.build();var P=t.length}else M=p(t,"HEAPF32"),P=t.length/4;var W=0;r&&(r.build?W=r.build():W=p(h(r),"HEAPU32"));this._drawAtlas(e,M,F,W,P,
C,w);F&&!l.build&&U(F,l);M&&!t.build&&U(M,t);W&&!r.build&&U(W,r)}};a.Canvas.prototype.drawColor=function(e,l){e=Q(e);void 0!==l?this._drawColor(e,l):this._drawColor(e)};a.Canvas.prototype.drawColorComponents=function(e,l,t,w,C){e=A(e,l,t,w);void 0!==C?this._drawColor(e,C):this._drawColor(e)};a.Canvas.prototype.drawDRRect=function(e,l,t){e=da(e,jc);l=da(l,Tc);this._drawDRRect(e,l,t)};a.Canvas.prototype.drawImageNine=function(e,l,t,w){l=p(l,"HEAP32",kc);t=T(t);this._drawImageNine(e,l,t,w)};a.Canvas.prototype.drawImageRect=
function(e,l,t,w,C){l=T(l,Fa);t=T(t,Pc);this._drawImageRect(e,l,t,w,!!C)};a.Canvas.prototype.drawOval=function(e,l){e=T(e);this._drawOval(e,l)};a.Canvas.prototype.drawPoints=function(e,l,t){if(l._ck){var w=l.byteOffset;var C=l.length/2}else w=u(l,"HEAPF32"),C=l.length;this._drawPoints(e,w,C,t);U(w,l)};a.Canvas.prototype.drawRRect=function(e,l){e=da(e);this._drawRRect(e,l)};a.Canvas.prototype.drawRect=function(e,l){e=T(e);this._drawRect(e,l)};a.Canvas.prototype.drawShadow=function(e,l,t,w,C,r,F){var M=
p(C,"HEAPF32"),P=p(r,"HEAPF32");this._drawShadow(e,l,t,w,M,P,F);U(M,C);U(P,r)};a.Canvas.prototype.getLocalToDevice=function(){this._getLocalToDevice(Ga);return N(Ga)};a.Canvas.prototype.findMarkedCTM=function(e){return this._findMarkedCTM(e,Ga)?N(Ga):null};a.Canvas.prototype.getTotalMatrix=function(){this._getTotalMatrix(jb);for(var e=Array(9),l=0;9>l;l++)e[l]=a.HEAPF32[jb/4+l];return e};a.Canvas.prototype.readPixels=function(e,l,t,w,C,r,F,M){C=C||a.AlphaType.Unpremul;r=r||a.ColorType.RGBA_8888;F=
F||a.ColorSpace.SRGB;var P=4;r===a.ColorType.RGBA_F16&&(P=8);M=M||P*t;var W=w*M;P=a._malloc(W);if(!this._readPixels({width:t,height:w,colorType:r,alphaType:C,colorSpace:F},P,M,e,l))return a._free(P),null;e=(new Uint8Array(a.HEAPU8.buffer,P,W)).slice();a._free(P);return e};a.Canvas.prototype.saveLayer=function(e,l,t,w){l=T(l);return this._saveLayer(e||null,l,t||null,w||0)};a.Canvas.prototype.writePixels=function(e,l,t,w,C,r,F,M){if(e.byteLength%(l*t))throw"pixels length must be a multiple of the srcWidth * srcHeight";
var P=e.byteLength/(l*t);r=r||a.AlphaType.Unpremul;F=F||a.ColorType.RGBA_8888;M=M||a.ColorSpace.SRGB;var W=P*l;P=p(e,"HEAPU8");l=this._writePixels({width:l,height:t,colorType:F,alphaType:r,colorSpace:M},P,W,w,C);U(P,e);return l};a.ColorFilter.MakeBlend=function(e,l){e=Q(e);return a.ColorFilter._MakeBlend(e,l)};a.ColorFilter.MakeMatrix=function(e){if(!e||20!==e.length)throw"invalid color matrix";var l=p(e,"HEAPF32"),t=a.ColorFilter._makeMatrix(l);U(l,e);return t};a.ImageFilter.MakeMatrixTransform=
function(e,l,t){e=E(e);return a.ImageFilter._MakeMatrixTransform(e,l,t)};a.Paint.prototype.getColor=function(){this._getColor(kb);return R(kb)};a.Paint.prototype.setColor=function(e,l){l=l||null;e=Q(e);this._setColor(e,l)};a.Paint.prototype.setColorComponents=function(e,l,t,w,C){C=C||null;e=A(e,l,t,w);this._setColor(e,C)};a.PictureRecorder.prototype.beginRecording=function(e){e=T(e);return this._beginRecording(e)};a.Surface.prototype.makeImageSnapshot=function(e){e=p(e,"HEAP32",kc);return this._makeImageSnapshot(e)};
a.Surface.prototype.requestAnimationFrame=function(e,l){this.Qg||(this.Qg=this.getCanvas());requestAnimationFrame(function(){void 0!==this.tg&&a.setCurrentContext(this.tg);e(this.Qg);this.flush(l)}.bind(this))};a.Surface.prototype.drawOnce=function(e,l){this.Qg||(this.Qg=this.getCanvas());requestAnimationFrame(function(){void 0!==this.tg&&a.setCurrentContext(this.tg);e(this.Qg);this.flush(l);this.dispose()}.bind(this))};a.PathEffect.MakeDash=function(e,l){l||(l=0);if(!e.length||1===e.length%2)throw"Intervals array must have even length";
var t=p(e,"HEAPF32");l=a.PathEffect._MakeDash(t,e.length,l);U(t,e);return l};a.Shader.Color=function(e,l){l=l||null;e=Q(e);return a.Shader._Color(e,l)};a.Shader.MakeLinearGradient=function(e,l,t,w,C,r,F,M){M=M||null;var P=z(t),W=p(w,"HEAPF32");F=F||0;r=E(r);e=a._MakeLinearGradientShader(e,l,P.ig,P.Wg,W,P.count,C,F,r,M);U(P.ig,t);w&&U(W,w);return e};a.Shader.MakeRadialGradient=function(e,l,t,w,C,r,F,M){M=M||null;var P=z(t),W=p(w,"HEAPF32");F=F||0;r=E(r);e=a._MakeRadialGradientShader(e,l,P.ig,P.Wg,
W,P.count,C,F,r,M);U(P.ig,t);w&&U(W,w);return e};a.Shader.MakeSweepGradient=function(e,l,t,w,C,r,F,M,P,W){W=W||null;var ba=z(t),ma=p(w,"HEAPF32");F=F||0;M=M||0;P=P||360;r=E(r);e=a._MakeSweepGradientShader(e,l,ba.ig,ba.Wg,ma,ba.count,C,M,P,F,r,W);U(ba.ig,t);w&&U(ma,w);return e};a.Shader.MakeTwoPointConicalGradient=function(e,l,t,w,C,r,F,M,P,W){W=W||null;var ba=z(C),ma=p(r,"HEAPF32");P=P||0;M=E(M);e=a._MakeTwoPointConicalGradientShader(e,l,t,w,ba.ig,ba.Wg,ma,ba.count,F,P,M,W);U(ba.ig,C);r&&U(ma,r);
return e};a.Vertices.prototype.bounds=function(e){this._bounds(Fa);var l=Ha.toTypedArray();return e?(e.set(l),e):l.slice()};a.Xf&&a.Xf.forEach(function(e){e()})};a.computeTonalColors=function(g){var n=p(g.ambient,"HEAPF32"),x=p(g.spot,"HEAPF32");this._computeTonalColors(n,x);var B={ambient:R(n),spot:R(x)};U(n,g.ambient);U(x,g.spot);return B};a.LTRBRect=function(g,n,x,B){return Float32Array.of(g,n,x,B)};a.XYWHRect=function(g,n,x,B){return Float32Array.of(g,n,g+x,n+B)};a.LTRBiRect=function(g,n,x,B){return Int32Array.of(g,
n,x,B)};a.XYWHiRect=function(g,n,x,B){return Int32Array.of(g,n,g+x,n+B)};a.RRectXY=function(g,n,x){return Float32Array.of(g[0],g[1],g[2],g[3],n,x,n,x,n,x,n,x)};a.MakeAnimatedImageFromEncoded=function(g){g=new Uint8Array(g);var n=a._malloc(g.byteLength);a.HEAPU8.set(g,n);return(g=a._decodeAnimatedImage(n,g.byteLength))?g:null};a.MakeImageFromEncoded=function(g){g=new Uint8Array(g);var n=a._malloc(g.byteLength);a.HEAPU8.set(g,n);return(g=a._decodeImage(n,g.byteLength))?g:null};var mb=null;a.MakeImageFromCanvasImageSource=
function(g){var n=g.width,x=g.height;mb||(mb=document.createElement("canvas"));mb.width=n;mb.height=x;var B=mb.getContext("2d");B.drawImage(g,0,0);g=B.getImageData(0,0,n,x);return a.MakeImage(g.data,n,x,a.AlphaType.Unpremul,a.ColorType.RGBA_8888,a.ColorSpace.SRGB)};a.MakeImage=function(g,n,x,B,L,V){var e=g.length/(n*x);x={width:n,height:x,alphaType:B,colorType:L,colorSpace:V};B=p(g,"HEAPU8");return a._MakeImage(x,B,g.length,n*e)};a.MakeVertices=function(g,n,x,B,L,V){var e=L&&L.length||0,l=0;x&&x.length&&
(l|=1);B&&B.length&&(l|=2);void 0===V||V||(l|=4);g=new a._VerticesBuilder(g,n.length,e,l);u(n,"HEAPF32",g.positions());g.texCoords()&&u(x,"HEAPF32",g.texCoords());if(g.colors()){if(B.build)throw"Color builder not accepted by MakeVertices, use array of ints";p(h(B),"HEAPU32",g.colors())}g.indices()&&p(L,"HEAPU16",g.indices());return g.detach()};(function(g){g.Xf=g.Xf||[];g.Xf.push(function(){function n(r){if(!r||!r.length)return[];for(var F=[],M=0;M<r.length;M+=5){var P=g.LTRBRect(r[M],r[M+1],r[M+
2],r[M+3]);P.direction=0===r[M+4]?g.TextDirection.RTL:g.TextDirection.LTR;F.push(P)}g._free(r.byteOffset);return F}function x(r){r=r||{};void 0===r.weight&&(r.weight=g.FontWeight.Normal);r.width=r.width||g.FontWidth.Normal;r.slant=r.slant||g.FontSlant.Upright;return r}function B(r){if(!r||!r.length)return 0;for(var F=[],M=0;M<r.length;M++){var P=L(r[M]);F.push(P)}return p(F,"HEAPU32")}function L(r){if(l[r])return l[r];var F=la(r)+1,M=g._malloc(F);na(r,v,M,F);return l[r]=M}function V(r){r._colorPtr=
Q(r.color);r._foregroundColorPtr=0;r._backgroundColorPtr=0;r._decorationColorPtr=0;r.foregroundColor&&(r._foregroundColorPtr=Q(r.foregroundColor,t));r.backgroundColor&&(r._backgroundColorPtr=Q(r.backgroundColor,w));r.decorationColor&&(r._decorationColorPtr=Q(r.decorationColor,C));Array.isArray(r.fontFamilies)&&r.fontFamilies.length?(r._fontFamiliesPtr=B(r.fontFamilies),r._fontFamiliesLen=r.fontFamilies.length):(r._fontFamiliesPtr=0,r._fontFamiliesLen=0)}function e(r){g._free(r._fontFamiliesPtr)}g.Paragraph.prototype.getRectsForRange=
function(r,F,M,P){r=this._getRectsForRange(r,F,M,P);return n(r)};g.Paragraph.prototype.getRectsForPlaceholders=function(){var r=this._getRectsForPlaceholders();return n(r)};g.TypefaceFontProvider.prototype.registerFont=function(r,F){r=g.FontMgr.RefDefault().MakeTypefaceFromData(r);if(!r)return null;F=L(F);this._registerFont(r,F)};g.ParagraphStyle=function(r){r.disableHinting=r.disableHinting||!1;if(r.ellipsis){var F=r.ellipsis;r._ellipsisPtr=L(F);r._ellipsisLen=la(F)+1}else r._ellipsisPtr=0,r._ellipsisLen=
0;r.heightMultiplier=r.heightMultiplier||0;r.maxLines=r.maxLines||0;r.textAlign=r.textAlign||g.TextAlign.Start;r.textDirection=r.textDirection||g.TextDirection.LTR;r.textStyle=g.TextStyle(r.textStyle);F=(F=r.strutStyle)||{};F.strutEnabled=F.strutEnabled||!1;F.strutEnabled&&Array.isArray(F.fontFamilies)&&F.fontFamilies.length?(F._fontFamiliesPtr=B(F.fontFamilies),F._fontFamiliesLen=F.fontFamilies.length):(F._fontFamiliesPtr=0,F._fontFamiliesLen=0);F.fontStyle=x(F.fontStyle);F.fontSize=F.fontSize||
0;F.heightMultiplier=F.heightMultiplier||0;F.leading=F.leading||0;F.forceStrutHeight=F.forceStrutHeight||!1;r.strutStyle=F;return r};g.TextStyle=function(r){r.color||(r.color=g.BLACK);r.decoration=r.decoration||0;r.decorationThickness=r.decorationThickness||0;r.decorationStyle=r.decorationStyle||g.DecorationStyle.Solid;r.textBaseline=r.textBaseline||g.TextBaseline.Alphabetic;r.fontSize=r.fontSize||0;r.letterSpacing=r.letterSpacing||0;r.wordSpacing=r.wordSpacing||0;r.heightMultiplier=r.heightMultiplier||
0;if(r.locale){var F=r.locale;r._localePtr=L(F);r._localeLen=la(F)+1}else r._localePtr=0,r._localeLen=0;r.fontStyle=x(r.fontStyle);if(r.shadows){F=r.shadows;var M=F.map(function(ba){return ba.color||g.BLACK}),P=F.map(function(ba){return ba.offset||[0,0]}),W=F.map(function(ba){return ba.blurRadius||0});r._shadowLen=F.length;r._shadowColorsPtr=z(M).ig;r._shadowOffsetsPtr=u(P,"HEAPF32");r._shadowBlurRadiiPtr=p(W,"HEAPF32")}else r._shadowLen=0,r._shadowColorsPtr=0,r._shadowOffsetsPtr=0,r._shadowBlurRadiiPtr=
0;r.fontFeatures?(F=r.fontFeatures,M=F.map(function(ba){return ba.name}),P=F.map(function(ba){return ba.value}),r._fontFeatureLen=F.length,r._fontFeatureNamesPtr=B(M),r._fontFeatureValuesPtr=p(P,"HEAPU32")):(r._fontFeatureLen=0,r._fontFeatureNamesPtr=0,r._fontFeatureValuesPtr=0);return r};var l={},t=g._malloc(16),w=g._malloc(16),C=g._malloc(16);g.ParagraphBuilder.Make=function(r,F){V(r.textStyle);F=g.ParagraphBuilder._Make(r,F);e(r.textStyle);return F};g.ParagraphBuilder.MakeFromFontProvider=function(r,
F){V(r.textStyle);F=g.ParagraphBuilder._MakeFromFontProvider(r,F);e(r.textStyle);return F};g.ParagraphBuilder.prototype.pushStyle=function(r){V(r);this._pushStyle(r);e(r)};g.ParagraphBuilder.prototype.pushPaintStyle=function(r,F,M){V(r);this._pushPaintStyle(r,F,M);e(r)};g.ParagraphBuilder.prototype.addPlaceholder=function(r,F,M,P,W){M=M||g.PlaceholderAlignment.Baseline;P=P||g.TextBaseline.Alphabetic;this._addPlaceholder(r||0,F||0,M,P,W||0)}})})(f);a.MakeManagedAnimation=function(g,n,x){if(!a._MakeManagedAnimation)throw"Not compiled with MakeManagedAnimation";
x||(x="");if(!n)return a._MakeManagedAnimation(g,0,0,0,0,x);for(var B=[],L=[],V=[],e=Object.keys(n||{}),l=0;l<e.length;l++){var t=e[l],w=new Uint8Array(n[t]),C=a._malloc(w.byteLength);a.HEAPU8.set(w,C);L.push(C);V.push(w.byteLength);w=la(t)+1;C=a._malloc(w);na(t,v,C,w);B.push(C)}n=p(B,"HEAPU32");L=p(L,"HEAPU32");V=p(V,"HEAPU32");g=a._MakeManagedAnimation(g,e.length,n,L,V,x);a._free(n);a._free(L);a._free(V);return g};(function(g){g.Xf=g.Xf||[];g.Xf.push(function(){g.Animation.prototype.render=function(n,
x){x=T(x);this._render(n,x)};g.ManagedAnimation&&(g.ManagedAnimation.prototype.render=function(n,x){x=T(x);this._render(n,x)},g.ManagedAnimation.prototype.seek=function(n,x){this._seek(n,Fa);n=Ha.toTypedArray();return x?(x.set(n),x):n.slice()},g.ManagedAnimation.prototype.seekFrame=function(n,x){this._seekFrame(n,Fa);n=Ha.toTypedArray();return x?(x.set(n),x):n.slice()},g.ManagedAnimation.prototype.setColor=function(n,x){x=Q(x);this._setColor(n,x)})})})(f);a.MakeParticles=function(g,n){if(!a._MakeParticles)throw"Not compiled with MakeParticles";
if(!n)return a._MakeParticles(g,0,0,0,0);for(var x=[],B=[],L=[],V=Object.keys(n||{}),e=0;e<V.length;e++){var l=V[e],t=new Uint8Array(n[l]),w=a._malloc(t.byteLength);a.HEAPU8.set(t,w);B.push(w);L.push(t.byteLength);t=la(l)+1;w=a._malloc(t);na(l,v,w,t);x.push(w)}n=p(x,"HEAPU32");B=p(B,"HEAPU32");L=p(L,"HEAPU32");g=a._MakeParticles(g,V.length,n,B,L);a._free(n);a._free(B);a._free(L);return g};a.Xf=a.Xf||[];a.Xf.push(function(){a.ParticleEffect.prototype.effectUniforms=function(){var g=this._effectUniformPtr(),
n=this.getEffectUniformFloatCount();return!g||0>=n?new Float32Array:new Float32Array(a.HEAPU8.buffer,g,n)};a.ParticleEffect.prototype.particleUniforms=function(){var g=this._particleUniformPtr(),n=this.getParticleUniformFloatCount();return!g||0>=n?new Float32Array:new Float32Array(a.HEAPU8.buffer,g,n)}});a.Xf=a.Xf||[];a.Xf.push(function(){a.Path.prototype.op=function(g,n){return this._op(g,n)?this:null};a.Path.prototype.simplify=function(){return this._simplify()?this:null}});a.Xf=a.Xf||[];a.Xf.push(function(){a.Canvas.prototype.drawText=
function(g,n,x,B,L){if("string"===typeof g){var V=la(g),e=a._malloc(V+1);na(g,v,e,V+1);this._drawSimpleText(e,V,n,x,L,B);a._free(e)}else this._drawShapedText(g,n,x,B)};a.Font.prototype.getGlyphBounds=function(g,n,x){var B=p(g,"HEAPU16"),L=a._malloc(16*g.length);this._getGlyphWidthBounds(B,g.length,0,L,n||null);n=new Float32Array(a.HEAPU8.buffer,L,4*g.length);U(B,g);if(x)return x.set(n),a._free(L),x;g=Float32Array.from(n);a._free(L);return g};a.Font.prototype.getGlyphIDs=function(g,n,x){n||(n=g.length);
var B=la(g)+1,L=a._malloc(B);na(g,v,L,B);g=a._malloc(2*n);n=this._getGlyphIDs(L,B-1,n,g);a._free(L);if(0>n)return a._free(g),null;L=new Uint16Array(a.HEAPU8.buffer,g,n);if(x)return x.set(L),a._free(g),x;x=Uint32Array.from(L);a._free(g);return x};a.Font.prototype.getGlyphWidths=function(g,n,x){var B=p(g,"HEAPU16"),L=a._malloc(4*g.length);this._getGlyphWidthBounds(B,g.length,L,0,n||null);n=new Float32Array(a.HEAPU8.buffer,L,g.length);U(B,g);if(x)return x.set(n),a._free(L),x;g=Float32Array.from(n);a._free(L);
return g};a.Font.prototype.getWidths=function(g){var n=g.length+1,x=la(g)+1,B=a._malloc(x);na(g,v,B,x);g=a._malloc(4*n);if(!this._getWidths(B,x,n,g))return a._free(B),a._free(g),null;n=new Float32Array(a.HEAPU8.buffer,g,n);n=Array.from(n);a._free(B);a._free(g);return n};a.FontMgr.FromData=function(){if(!arguments.length)return null;var g=arguments;1===g.length&&Array.isArray(g[0])&&(g=arguments[0]);if(!g.length)return null;for(var n=[],x=[],B=0;B<g.length;B++){var L=new Uint8Array(g[B]),V=p(L,"HEAPU8");
n.push(V);x.push(L.byteLength)}n=p(n,"HEAPU32");x=p(x,"HEAPU32");g=a.FontMgr._fromData(n,x,g.length);a._free(n);a._free(x);return g};a.FontMgr.prototype.MakeTypefaceFromData=function(g){g=new Uint8Array(g);var n=p(g,"HEAPU8");return(g=this._makeTypefaceFromData(n,g.byteLength))?g:null};a.ShapedText.prototype.getBounds=function(g){this._getBounds(Fa);var n=Ha.toTypedArray();return g?(g.set(n),g):n.slice()};a.TextBlob.MakeOnPath=function(g,n,x,B){if(g&&g.length&&n&&n.countPoints()){if(1===n.countPoints())return this.MakeFromText(g,
x);B||(B=0);var L=x.getWidths(g),V=new a.RSXFormBuilder;n=new a.PathMeasure(n,!1,1);for(var e=0;e<g.length;e++){var l=L[e];B+=l/2;if(B>n.getLength()){if(!n.nextContour()){g=g.substring(0,e);break}B=l/2}var t=n.getPosTan(B),w=t[2],C=t[3];V.push(w,C,t[0]-l/2*w,t[1]-l/2*C);B+=l/2}g=this.MakeFromRSXform(g,V,x);V.delete();n.delete();return g}};a.TextBlob.MakeFromRSXform=function(g,n,x){var B=la(g)+1,L=a._malloc(B);na(g,v,L,B);g=0;n.build?g=n.build():g=p(n,"HEAPF32");n=a.TextBlob._MakeFromRSXform(L,B-1,
g,x);a._free(L);return n?n:null};a.TextBlob.MakeFromRSXformGlyphs=function(g,n,x){var B=p(g,"HEAPU16"),L=0;n.build?L=n.build():L=p(n,"HEAPF32");n=a.TextBlob._MakeFromRSXformGlyphs(B,2*g.length,L,x);U(B,g);return n?n:null};a.TextBlob.MakeFromGlyphs=function(g,n){var x=p(g,"HEAPU16");n=a.TextBlob._MakeFromGlyphs(x,2*g.length,n);U(x,g);return n?n:null};a.TextBlob.MakeFromText=function(g,n){var x=la(g)+1,B=a._malloc(x);na(g,v,B,x);g=a.TextBlob._MakeFromText(B,x-1,n);a._free(B);return g?g:null};a.MallocGlyphIDs=
function(g){return a.Malloc(Uint16Array,g)}});a.Xf=a.Xf||[];a.Xf.push(function(){a.MakePicture=function(g){g=new Uint8Array(g);var n=a._malloc(g.byteLength);a.HEAPU8.set(g,n);return(g=a._MakePicture(n,g.byteLength))?g:null};a.Picture.prototype.saveAsFile=function(g){var n=this.serialize();if(n){var x=a.getDataBytes(n);wa(x,g);n.delete()}}});a.Xf=a.Xf||[];a.Xf.push(function(){a.RuntimeEffect.prototype.makeShader=function(g,n,x){var B=p(g,"HEAPF32");x=E(x);return this._makeShader(B,4*g.length,!!n,x)};
a.RuntimeEffect.prototype.makeShaderWithChildren=function(g,n,x,B){var L=p(g,"HEAPF32");B=E(B);for(var V=[],e=0;e<x.length;e++)V.push(x[e].Sf.Wf);x=p(V,"HEAPU32");return this._makeShaderWithChildren(L,4*g.length,!!n,x,V.length,B)}});(function(){function g(J){for(var k=0;k<J.length;k++)if(void 0!==J[k]&&!Number.isFinite(J[k]))return!1;return!0}function n(J){var k=a.getColorComponents(J);J=k[0];var q=k[1],y=k[2];k=k[3];if(1===k)return J=J.toString(16).toLowerCase(),q=q.toString(16).toLowerCase(),y=
y.toString(16).toLowerCase(),J=1===J.length?"0"+J:J,q=1===q.length?"0"+q:q,y=1===y.length?"0"+y:y,"#"+J+q+y;k=0===k||1===k?k:k.toFixed(8);return"rgba("+J+", "+q+", "+y+", "+k+")"}function x(J){return a.parseColorString(J,ba)}function B(J){J=ma.exec(J);if(!J)return null;var k=parseFloat(J[4]),q=16;switch(J[5]){case "em":case "rem":q=16*k;break;case "pt":q=4*k/3;break;case "px":q=k;break;case "pc":q=16*k;break;case "in":q=96*k;break;case "cm":q=96*k/2.54;break;case "mm":q=96/25.4*k;break;case "q":q=
96/25.4/4*k;break;case "%":q=16/75*k}return{style:J[1],variant:J[2],weight:J[3],sizePx:q,family:J[6].trim()}}function L(J){this.Tf=J;this.Vf=new a.Paint;this.Vf.setAntiAlias(!0);this.Vf.setStrokeMiter(10);this.Vf.setStrokeCap(a.StrokeCap.Butt);this.Vf.setStrokeJoin(a.StrokeJoin.Miter);this.eh="10px monospace";this.ug=new a.Font(null,10);this.ug.setSubpixel(!0);this.hg=this.og=a.BLACK;this.Dg=0;this.Tg=a.TRANSPARENT;this.Fg=this.Eg=0;this.Ug=this.qg=1;this.Sg=0;this.Cg=[];this.Uf=a.BlendMode.SrcOver;
this.vg=a.FilterQuality.Low;this.Rg=!0;this.Vf.setStrokeWidth(this.Ug);this.Vf.setBlendMode(this.Uf);this.Zf=new a.Path;this.$f=a.Matrix.identity();this.Ch=[];this.Jg=[];this.rg=function(){this.Zf.delete();this.Vf.delete();this.ug.delete();this.Jg.forEach(function(k){k.rg()})};Object.defineProperty(this,"currentTransform",{enumerable:!0,get:function(){return{a:this.$f[0],c:this.$f[1],e:this.$f[2],b:this.$f[3],d:this.$f[4],f:this.$f[5]}},set:function(k){k.a&&this.setTransform(k.a,k.b,k.c,k.d,k.e,k.f)}});
Object.defineProperty(this,"fillStyle",{enumerable:!0,get:function(){return c(this.hg)?n(this.hg):this.hg},set:function(k){"string"===typeof k?this.hg=x(k):k.Bg&&(this.hg=k)}});Object.defineProperty(this,"font",{enumerable:!0,get:function(){return this.eh},set:function(k){var q=B(k),y=q.family;q.typeface=oa[y]?oa[y][(q.style||"normal")+"|"+(q.variant||"normal")+"|"+(q.weight||"normal")]||oa[y]["*"]:null;q&&(this.ug.setSize(q.sizePx),this.ug.setTypeface(q.typeface),this.eh=k)}});Object.defineProperty(this,
"globalAlpha",{enumerable:!0,get:function(){return this.qg},set:function(k){!isFinite(k)||0>k||1<k||(this.qg=k)}});Object.defineProperty(this,"globalCompositeOperation",{enumerable:!0,get:function(){switch(this.Uf){case a.BlendMode.SrcOver:return"source-over";case a.BlendMode.DstOver:return"destination-over";case a.BlendMode.Src:return"copy";case a.BlendMode.Dst:return"destination";case a.BlendMode.Clear:return"clear";case a.BlendMode.SrcIn:return"source-in";case a.BlendMode.DstIn:return"destination-in";
case a.BlendMode.SrcOut:return"source-out";case a.BlendMode.DstOut:return"destination-out";case a.BlendMode.SrcATop:return"source-atop";case a.BlendMode.DstATop:return"destination-atop";case a.BlendMode.Xor:return"xor";case a.BlendMode.Plus:return"lighter";case a.BlendMode.Multiply:return"multiply";case a.BlendMode.Screen:return"screen";case a.BlendMode.Overlay:return"overlay";case a.BlendMode.Darken:return"darken";case a.BlendMode.Lighten:return"lighten";case a.BlendMode.ColorDodge:return"color-dodge";
case a.BlendMode.ColorBurn:return"color-burn";case a.BlendMode.HardLight:return"hard-light";case a.BlendMode.SoftLight:return"soft-light";case a.BlendMode.Difference:return"difference";case a.BlendMode.Exclusion:return"exclusion";case a.BlendMode.Hue:return"hue";case a.BlendMode.Saturation:return"saturation";case a.BlendMode.Color:return"color";case a.BlendMode.Luminosity:return"luminosity"}},set:function(k){switch(k){case "source-over":this.Uf=a.BlendMode.SrcOver;break;case "destination-over":this.Uf=
a.BlendMode.DstOver;break;case "copy":this.Uf=a.BlendMode.Src;break;case "destination":this.Uf=a.BlendMode.Dst;break;case "clear":this.Uf=a.BlendMode.Clear;break;case "source-in":this.Uf=a.BlendMode.SrcIn;break;case "destination-in":this.Uf=a.BlendMode.DstIn;break;case "source-out":this.Uf=a.BlendMode.SrcOut;break;case "destination-out":this.Uf=a.BlendMode.DstOut;break;case "source-atop":this.Uf=a.BlendMode.SrcATop;break;case "destination-atop":this.Uf=a.BlendMode.DstATop;break;case "xor":this.Uf=
a.BlendMode.Xor;break;case "lighter":this.Uf=a.BlendMode.Plus;break;case "plus-lighter":this.Uf=a.BlendMode.Plus;break;case "plus-darker":throw"plus-darker is not supported";case "multiply":this.Uf=a.BlendMode.Multiply;break;case "screen":this.Uf=a.BlendMode.Screen;break;case "overlay":this.Uf=a.BlendMode.Overlay;break;case "darken":this.Uf=a.BlendMode.Darken;break;case "lighten":this.Uf=a.BlendMode.Lighten;break;case "color-dodge":this.Uf=a.BlendMode.ColorDodge;break;case "color-burn":this.Uf=a.BlendMode.ColorBurn;
break;case "hard-light":this.Uf=a.BlendMode.HardLight;break;case "soft-light":this.Uf=a.BlendMode.SoftLight;break;case "difference":this.Uf=a.BlendMode.Difference;break;case "exclusion":this.Uf=a.BlendMode.Exclusion;break;case "hue":this.Uf=a.BlendMode.Hue;break;case "saturation":this.Uf=a.BlendMode.Saturation;break;case "color":this.Uf=a.BlendMode.Color;break;case "luminosity":this.Uf=a.BlendMode.Luminosity;break;default:return}this.Vf.setBlendMode(this.Uf)}});Object.defineProperty(this,"imageSmoothingEnabled",
{enumerable:!0,get:function(){return this.Rg},set:function(k){this.Rg=!!k}});Object.defineProperty(this,"imageSmoothingQuality",{enumerable:!0,get:function(){switch(this.vg){case a.FilterQuality.Low:return"low";case a.FilterQuality.Medium:return"medium";case a.FilterQuality.High:return"high"}},set:function(k){switch(k){case "low":this.vg=a.FilterQuality.Low;break;case "medium":this.vg=a.FilterQuality.Medium;break;case "high":this.vg=a.FilterQuality.High}}});Object.defineProperty(this,"lineCap",{enumerable:!0,
get:function(){switch(this.Vf.getStrokeCap()){case a.StrokeCap.Butt:return"butt";case a.StrokeCap.Round:return"round";case a.StrokeCap.Square:return"square"}},set:function(k){switch(k){case "butt":this.Vf.setStrokeCap(a.StrokeCap.Butt);break;case "round":this.Vf.setStrokeCap(a.StrokeCap.Round);break;case "square":this.Vf.setStrokeCap(a.StrokeCap.Square)}}});Object.defineProperty(this,"lineDashOffset",{enumerable:!0,get:function(){return this.Sg},set:function(k){isFinite(k)&&(this.Sg=k)}});Object.defineProperty(this,
"lineJoin",{enumerable:!0,get:function(){switch(this.Vf.getStrokeJoin()){case a.StrokeJoin.Miter:return"miter";case a.StrokeJoin.Round:return"round";case a.StrokeJoin.Bevel:return"bevel"}},set:function(k){switch(k){case "miter":this.Vf.setStrokeJoin(a.StrokeJoin.Miter);break;case "round":this.Vf.setStrokeJoin(a.StrokeJoin.Round);break;case "bevel":this.Vf.setStrokeJoin(a.StrokeJoin.Bevel)}}});Object.defineProperty(this,"lineWidth",{enumerable:!0,get:function(){return this.Vf.getStrokeWidth()},set:function(k){0>=
k||!k||(this.Ug=k,this.Vf.setStrokeWidth(k))}});Object.defineProperty(this,"miterLimit",{enumerable:!0,get:function(){return this.Vf.getStrokeMiter()},set:function(k){0>=k||!k||this.Vf.setStrokeMiter(k)}});Object.defineProperty(this,"shadowBlur",{enumerable:!0,get:function(){return this.Dg},set:function(k){0>k||!isFinite(k)||(this.Dg=k)}});Object.defineProperty(this,"shadowColor",{enumerable:!0,get:function(){return n(this.Tg)},set:function(k){this.Tg=x(k)}});Object.defineProperty(this,"shadowOffsetX",
{enumerable:!0,get:function(){return this.Eg},set:function(k){isFinite(k)&&(this.Eg=k)}});Object.defineProperty(this,"shadowOffsetY",{enumerable:!0,get:function(){return this.Fg},set:function(k){isFinite(k)&&(this.Fg=k)}});Object.defineProperty(this,"strokeStyle",{enumerable:!0,get:function(){return n(this.og)},set:function(k){"string"===typeof k?this.og=x(k):k.Bg&&(this.og=k)}});this.arc=function(k,q,y,D,G,H){r(this.Zf,k,q,y,y,0,D,G,H)};this.arcTo=function(k,q,y,D,G){t(this.Zf,k,q,y,D,G)};this.beginPath=
function(){this.Zf.delete();this.Zf=new a.Path};this.bezierCurveTo=function(k,q,y,D,G,H){var O=this.Zf;g([k,q,y,D,G,H])&&(O.isEmpty()&&O.moveTo(k,q),O.cubicTo(k,q,y,D,G,H))};this.clearRect=function(k,q,y,D){this.Vf.setStyle(a.PaintStyle.Fill);this.Vf.setBlendMode(a.BlendMode.Clear);this.Tf.drawRect(a.XYWHRect(k,q,y,D),this.Vf);this.Vf.setBlendMode(this.Uf)};this.clip=function(k,q){"string"===typeof k?(q=k,k=this.Zf):k&&k.lh&&(k=k.bg);k||(k=this.Zf);k=k.copy();q&&"evenodd"===q.toLowerCase()?k.setFillType(a.FillType.EvenOdd):
k.setFillType(a.FillType.Winding);this.Tf.clipPath(k,a.ClipOp.Intersect,!0);k.delete()};this.closePath=function(){w(this.Zf)};this.createImageData=function(){if(1===arguments.length){var k=arguments[0];return new e(new Uint8ClampedArray(4*k.width*k.height),k.width,k.height)}if(2===arguments.length){k=arguments[0];var q=arguments[1];return new e(new Uint8ClampedArray(4*k*q),k,q)}throw"createImageData expects 1 or 2 arguments, got "+arguments.length;};this.createLinearGradient=function(k,q,y,D){if(g(arguments)){var G=
new l(k,q,y,D);this.Jg.push(G);return G}};this.createPattern=function(k,q){k=new P(k,q);this.Jg.push(k);return k};this.createRadialGradient=function(k,q,y,D,G,H){if(g(arguments)){var O=new W(k,q,y,D,G,H);this.Jg.push(O);return O}};this.Mh=function(){var k=this.dh();this.Rg?k.setFilterQuality(this.vg):k.setFilterQuality(a.FilterQuality.None);return k};this.drawImage=function(k){var q=this.Mh();if(3===arguments.length||5===arguments.length)var y=a.XYWHRect(arguments[1],arguments[2],arguments[3]||k.width(),
arguments[4]||k.height()),D=a.XYWHRect(0,0,k.width(),k.height());else if(9===arguments.length)y=a.XYWHRect(arguments[5],arguments[6],arguments[7],arguments[8]),D=a.XYWHRect(arguments[1],arguments[2],arguments[3],arguments[4]);else throw"invalid number of args for drawImage, need 3, 5, or 9; got "+arguments.length;this.Tf.drawImageRect(k,D,y,q,!1);q.dispose()};this.ellipse=function(k,q,y,D,G,H,O,aa){r(this.Zf,k,q,y,D,G,H,O,aa)};this.dh=function(){var k=this.Vf.copy();k.setStyle(a.PaintStyle.Fill);
if(c(this.hg)){var q=a.multiplyByAlpha(this.hg,this.qg);k.setColor(q)}else q=this.hg.Bg(this.$f),k.setColor(a.Color(0,0,0,this.qg)),k.setShader(q);k.dispose=function(){this.delete()};return k};this.fill=function(k,q){"string"===typeof k?(q=k,k=this.Zf):k&&k.lh&&(k=k.bg);if("evenodd"===q)this.Zf.setFillType(a.FillType.EvenOdd);else{if("nonzero"!==q&&q)throw"invalid fill rule";this.Zf.setFillType(a.FillType.Winding)}k||(k=this.Zf);q=this.dh();var y=this.Gg(q);y&&(this.Tf.save(),this.zg(),this.Tf.drawPath(k,
y),this.Tf.restore(),y.dispose());this.Tf.drawPath(k,q);q.dispose()};this.fillRect=function(k,q,y,D){var G=this.dh(),H=this.Gg(G);H&&(this.Tf.save(),this.zg(),this.Tf.drawRect(a.XYWHRect(k,q,y,D),H),this.Tf.restore(),H.dispose());this.Tf.drawRect(a.XYWHRect(k,q,y,D),G);G.dispose()};this.fillText=function(k,q,y){var D=this.dh();k=a.TextBlob.MakeFromText(k,this.ug);var G=this.Gg(D);G&&(this.Tf.save(),this.zg(),this.Tf.drawTextBlob(k,q,y,G),this.Tf.restore(),G.dispose());this.Tf.drawTextBlob(k,q,y,D);
k.delete();D.dispose()};this.getImageData=function(k,q,y,D){return(k=this.Tf.readPixels(k,q,y,D))?new e(new Uint8ClampedArray(k.buffer),y,D):null};this.getLineDash=function(){return this.Cg.slice()};this.Dh=function(k){var q=a.Matrix.invert(this.$f);a.Matrix.mapPoints(q,k);return k};this.isPointInPath=function(k,q,y){var D=arguments;if(3===D.length)var G=this.Zf;else if(4===D.length)G=D[0],k=D[1],q=D[2],y=D[3];else throw"invalid arg count, need 3 or 4, got "+D.length;if(!isFinite(k)||!isFinite(q))return!1;
y=y||"nonzero";if("nonzero"!==y&&"evenodd"!==y)return!1;D=this.Dh([k,q]);k=D[0];q=D[1];G.setFillType("nonzero"===y?a.FillType.Winding:a.FillType.EvenOdd);return G.contains(k,q)};this.isPointInStroke=function(k,q){var y=arguments;if(2===y.length)var D=this.Zf;else if(3===y.length)D=y[0],k=y[1],q=y[2];else throw"invalid arg count, need 2 or 3, got "+y.length;if(!isFinite(k)||!isFinite(q))return!1;y=this.Dh([k,q]);k=y[0];q=y[1];D=D.copy();D.setFillType(a.FillType.Winding);D.stroke({width