canvaskit-wasm
Version:
A WASM version of Skia's Canvas API
108 lines (105 loc) • 153 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 g;g||(g=typeof CanvasKitInit !== 'undefined' ? CanvasKitInit : {});var ca;g.ready=new Promise(function(a){ca=a});
(function(a){a.qk=a.qk||[];a.qk.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.Lj=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.SkColorSpace.SRGB},e=b*c*4,k=a._malloc(e);if(d=this._getRasterDirectSurface(d,
k,4*b))d.Lj=null,d.Jl=b,d.Fl=c,d.Il=e,d.jl=k,d.getCanvas().clear(a.TRANSPARENT);return d};a.SkSurface.prototype.flush=function(b){this._flush();if(this.Lj){var c=new Uint8ClampedArray(a.HEAPU8.buffer,this.jl,this.Il);c=new ImageData(c,this.Jl,this.Fl);b?this.Lj.getContext("2d").putImageData(c,0,0,b.fLeft,b.fTop,b.fRight-b.fLeft,b.fBottom-b.fTop):this.Lj.getContext("2d").putImageData(c,0,0)}};a.SkSurface.prototype.dispose=function(){this.jl&&a._free(this.jl);this.delete()};a.currentContext=a.currentContext||
function(){};a.setCurrentContext=a.setCurrentContext||function(){}})})(g);
(function(a){a.qk=a.qk||[];a.qk.push(function(){function b(c,d,e){return c&&c.hasOwnProperty(d)?c[d]:e}a.cm=function(c,d){if(!c)throw"null canvas passed into makeWebGLContext";var e={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)};d&&d.majorVersion&&(e.majorVersion=d.majorVersion);if(e.explicitSwapControl)throw"explicitSwapControl is not supported";this.createContext(c,!0,!0,e)};a.GetWebGLContext=function(c,d){this.cm(c,d);return a.currentContext()||0};a.MakeWebGLCanvasSurface=function(c,d,e){d=d||null;var k=c;if("CANVAS"!==k.tagName&&(k=document.getElementById(c),
!k))throw"Canvas with id "+c+" was not found";c=this.GetWebGLContext(k,e);e=k.Dl.version;if(!c||0>c)throw"failed to create webgl context: err "+c;var m=this.MakeGrContext(c);d=this.MakeOnScreenGLSurface(m,k.width,k.height,d);if(!d)return d=k.cloneNode(!0),k.parentNode.replaceChild(d,k),d.classList.add("ck-replaced"),a.MakeSWCanvasSurface(d);d.pk=c;d.grContext=m;d.openGLversion=e;return d};a.MakeCanvasSurface=a.MakeWebGLCanvasSurface})})(g);
(function(a){function b(p){return Math.round(Math.max(0,Math.min(p||0,255)))}function c(p){return p?p.constructor===Float32Array&&4===p.length:!1}function d(p){return(b(255*p[3])<<24|b(255*p[0])<<16|b(255*p[1])<<8|b(255*p[2])<<0)>>>0}function e(p){if(p instanceof Float32Array){for(var z=Math.floor(p.length/4),K=new Uint32Array(z),N=0;N<z;N++)K[N]=d(p.slice(4*N,4*(N+1)));return K}if(p instanceof Uint32Array)return p;if(p instanceof Array&&p[0]instanceof Float32Array)return p.map(d)}function k(p){if(void 0===
p)return 1;var z=parseFloat(p);return p&&-1!==p.indexOf("%")?z/100:z}function m(p,z,K){if(!p||!p.length)return 0;if(p._ck)return p.byteOffset;var N=a[z].BYTES_PER_ELEMENT;K||(K=a._malloc(p.length*N));a[z].set(p,K/N);return K}function q(p,z,K){if(!p||!p.length)return 0;var N=a[z].BYTES_PER_ELEMENT;K||(K=a._malloc(p.length*p[0].length*N));z=a[z];var ba=0;N=K/N;for(var za=0;za<p.length;za++)for(var f=0;f<p[0].length;f++)z[N+ba]=p[za][f],ba++;return K}function u(p){var z={dk:0,count:p.length,Tk:a.ColorType.RGBA_F32};
if(p instanceof Float32Array)z.dk=m(p,"HEAPF32"),z.count=p.length/4;else if(p instanceof Uint32Array)z.dk=m(p,"HEAPU32"),z.Tk=a.ColorType.RGBA_8888;else if(p instanceof Array&&p[0]instanceof Float32Array)z.dk=q(p,"HEAPF32");else throw"Invalid argument to copyFlexibleColorArray, Not a color array "+typeof p;return z}function A(p){if(!p)return 0;if(p.length){if(6!==p.length&&9!==p.length)throw"invalid matrix size";var z=m(p,"HEAPF32",ja);6===p.length&&a.HEAPF32.set(Aa,6+z/4);return z}z=fb.toTypedArray();
z[0]=p.m11;z[1]=p.m21;z[2]=p.m41;z[3]=p.m12;z[4]=p.m22;z[5]=p.m42;z[6]=p.m14;z[7]=p.m24;z[8]=p.m44;return ja}function F(p){if(!p)return 0;var z=Ec.toTypedArray();if(p.length){if(16!==p.length&&6!==p.length&&9!==p.length)throw"invalid matrix size";if(16===p.length)return m(p,"HEAPF32",Ea);z.fill(0);z[0]=p[0];z[1]=p[1];z[3]=p[2];z[4]=p[3];z[5]=p[4];z[7]=p[5];z[12]=p[6];z[13]=p[7];z[15]=p[8];6===p.length&&(z[12]=0,z[13]=0,z[15]=1);return Ea}z[0]=p.m11;z[1]=p.m21;z[2]=p.m31;z[3]=p.m41;z[4]=p.m12;z[5]=
p.m22;z[6]=p.m32;z[7]=p.m42;z[8]=p.m13;z[9]=p.m23;z[10]=p.m33;z[11]=p.m43;z[12]=p.m14;z[13]=p.m24;z[14]=p.m34;z[15]=p.m44;return Ea}function L(p){for(var z=Array(16),K=0;16>K;K++)z[K]=a.HEAPF32[p/4+K];return z}function Q(p,z){return m(p,"HEAPF32",z||yb)}function y(p,z,K,N){var ba=Fc.toTypedArray();ba[0]=p;ba[1]=z;ba[2]=K;ba[3]=N;return yb}function P(p){for(var z=new Float32Array(4),K=0;4>K;K++)z[K]=a.HEAPF32[p/4+K];return z}function R(p,z){z&&!z._ck&&a._free(p)}a.Color=function(p,z,K,N){void 0===
N&&(N=1);return a.Color4f(b(p)/255,b(z)/255,b(K)/255,N)};a.ColorAsInt=function(p,z,K,N){void 0===N&&(N=255);return(b(N)<<24|b(p)<<16|b(z)<<8|b(K)<<0&268435455)>>>0};a.Color4f=function(p,z,K,N){void 0===N&&(N=1);return Float32Array.of(p,z,K,N)};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(p){return[Math.floor(255*p[0]),Math.floor(255*
p[1]),Math.floor(255*p[2]),p[3]]};a.parseColorString=function(p,z){p=p.toLowerCase();if(p.startsWith("#")){z=255;switch(p.length){case 9:z=parseInt(p.slice(7,9),16);case 7:var K=parseInt(p.slice(1,3),16);var N=parseInt(p.slice(3,5),16);var ba=parseInt(p.slice(5,7),16);break;case 5:z=17*parseInt(p.slice(4,5),16);case 4:K=17*parseInt(p.slice(1,2),16),N=17*parseInt(p.slice(2,3),16),ba=17*parseInt(p.slice(3,4),16)}return a.Color(K,N,ba,z/255)}return p.startsWith("rgba")?(p=p.slice(5,-1),p=p.split(","),
a.Color(+p[0],+p[1],+p[2],k(p[3]))):p.startsWith("rgb")?(p=p.slice(4,-1),p=p.split(","),a.Color(+p[0],+p[1],+p[2],k(p[3]))):p.startsWith("gray(")||p.startsWith("hsl")||!z||(p=z[p],void 0===p)?a.BLACK:p};a.multiplyByAlpha=function(p,z){p=p.slice();p[3]=Math.max(0,Math.min(p[3]*z,1));return p};var ea=!(new Function("try {return this===window;}catch(e){ return false;}"))(),Aa=Float32Array.of(0,0,1),ja=0,fb,Ea=0,Ec,yb=0,Fc,Gc={};a.wk=function(){this.nk=[];this.Sj=null;Object.defineProperty(this,"length",
{enumerable:!0,get:function(){return this.nk.length/4}})};a.wk.prototype.push=function(p,z,K,N){this.Sj||this.nk.push(p,z,K,N)};a.wk.prototype.set=function(p,z,K,N,ba){0>p||p>=this.nk.length/4||(p*=4,this.Sj?(p=this.Sj/4+p,a.HEAPF32[p]=z,a.HEAPF32[p+1]=K,a.HEAPF32[p+2]=N,a.HEAPF32[p+3]=ba):(this.nk[p]=z,this.nk[p+1]=K,this.nk[p+2]=N,this.nk[p+3]=ba))};a.wk.prototype.build=function(){return this.Sj?this.Sj:this.Sj=m(this.nk,"HEAPF32")};a.wk.prototype.delete=function(){this.Sj&&(a._free(this.Sj),this.Sj=
null)};a.Mk=function(){this.Sk=[];this.Sj=null;Object.defineProperty(this,"length",{enumerable:!0,get:function(){return this.Sk.length}})};a.Mk.prototype.push=function(p){this.Sj||this.Sk.push(p)};a.Mk.prototype.set=function(p,z){0>p||p>=this.Sk.length||(p*=4,this.Sj?a.HEAPU32[this.Sj/4+p]=z:this.Sk[p]=z)};a.Mk.prototype.build=function(){return this.Sj?this.Sj:this.Sj=m(this.Sk,"HEAPU32")};a.Mk.prototype.delete=function(){this.Sj&&(a._free(this.Sj),this.Sj=null)};a.SkRectBuilder=a.wk;a.RSXFormBuilder=
a.wk;a.SkColorBuilder=a.Mk;a.Malloc=function(p,z){var K=a._malloc(z*p.BYTES_PER_ELEMENT);return{_ck:!0,length:z,byteOffset:K,vk:null,subarray:function(N,ba){N=this.toTypedArray().subarray(N,ba);N._ck=!0;return N},toTypedArray:function(){if(this.vk&&this.vk.length)return this.vk;this.vk=new p(a.HEAPU8.buffer,K,z);this.vk._ck=!0;return this.vk}}};a.Free=function(p){a._free(p.byteOffset);p.byteOffset=0;p.toTypedArray=null;p.vk=null};a.onRuntimeInitialized=function(){function p(f,n,t,w,C){for(var G=0;G<
f.length;G++)n[G*t+(G*C+w+t)%t]=f[G];return n}function z(f){for(var n=f*f,t=Array(n);n--;)t[n]=0==n%(f+1)?1:0;return t}function K(){for(var f=0,n=0;n<arguments.length-1;n+=2)f+=arguments[n]*arguments[n+1];return f}function N(f,n,t){for(var w=Array(f.length),C=0;C<t;C++)for(var G=0;G<t;G++){for(var S=0,U=0;U<t;U++)S+=f[t*C+U]*n[t*U+G];w[C*t+G]=S}return w}function ba(f,n){for(var t=N(n[0],n[1],f),w=2;w<n.length;)t=N(t,n[w],f),w++;return t}Fc=a.Malloc(Float32Array,4);yb=Fc.byteOffset;Ec=a.Malloc(Float32Array,
16);Ea=Ec.byteOffset;fb=a.Malloc(Float32Array,9);ja=fb.byteOffset;a.SkColorSpace.SRGB=a.SkColorSpace._MakeSRGB();a.SkColorSpace.DISPLAY_P3=a.SkColorSpace._MakeDisplayP3();a.SkColorSpace.ADOBE_RGB=a.SkColorSpace._MakeAdobeRGB();a.SkMatrix={};a.SkMatrix.identity=function(){return z(3)};a.SkMatrix.invert=function(f){var n=f[0]*f[4]*f[8]+f[1]*f[5]*f[6]+f[2]*f[3]*f[7]-f[2]*f[4]*f[6]-f[1]*f[3]*f[8]-f[0]*f[5]*f[7];return n?[(f[4]*f[8]-f[5]*f[7])/n,(f[2]*f[7]-f[1]*f[8])/n,(f[1]*f[5]-f[2]*f[4])/n,(f[5]*f[6]-
f[3]*f[8])/n,(f[0]*f[8]-f[2]*f[6])/n,(f[2]*f[3]-f[0]*f[5])/n,(f[3]*f[7]-f[4]*f[6])/n,(f[1]*f[6]-f[0]*f[7])/n,(f[0]*f[4]-f[1]*f[3])/n]:null};a.SkMatrix.mapPoints=function(f,n){for(var t=0;t<n.length;t+=2){var w=n[t],C=n[t+1],G=f[6]*w+f[7]*C+f[8],S=f[3]*w+f[4]*C+f[5];n[t]=(f[0]*w+f[1]*C+f[2])/G;n[t+1]=S/G}return n};a.SkMatrix.multiply=function(){return ba(3,arguments)};a.SkMatrix.rotated=function(f,n,t){n=n||0;t=t||0;var w=Math.sin(f);f=Math.cos(f);return[f,-w,K(w,t,1-f,n),w,f,K(-w,n,1-f,t),0,0,1]};
a.SkMatrix.scaled=function(f,n,t,w){t=t||0;w=w||0;var C=p([f,n],z(3),3,0,1);return p([t-f*t,w-n*w],C,3,2,0)};a.SkMatrix.skewed=function(f,n,t,w){t=t||0;w=w||0;var C=p([f,n],z(3),3,1,-1);return p([-f*t,-n*w],C,3,2,0)};a.SkMatrix.translated=function(f,n){return p(arguments,z(3),3,2,0)};a.SkVector={};a.SkVector.dot=function(f,n){return f.map(function(t,w){return t*n[w]}).reduce(function(t,w){return t+w})};a.SkVector.lengthSquared=function(f){return a.SkVector.dot(f,f)};a.SkVector.length=function(f){return Math.sqrt(a.SkVector.lengthSquared(f))};
a.SkVector.mulScalar=function(f,n){return f.map(function(t){return t*n})};a.SkVector.add=function(f,n){return f.map(function(t,w){return t+n[w]})};a.SkVector.sub=function(f,n){return f.map(function(t,w){return t-n[w]})};a.SkVector.dist=function(f,n){return a.SkVector.length(a.SkVector.sub(f,n))};a.SkVector.normalize=function(f){return a.SkVector.mulScalar(f,1/a.SkVector.length(f))};a.SkVector.cross=function(f,n){return[f[1]*n[2]-f[2]*n[1],f[2]*n[0]-f[0]*n[2],f[0]*n[1]-f[1]*n[0]]};a.SkM44={};a.SkM44.identity=
function(){return z(4)};a.SkM44.translated=function(f){return p(f,z(4),4,3,0)};a.SkM44.scaled=function(f){return p(f,z(4),4,0,1)};a.SkM44.rotated=function(f,n){return a.SkM44.rotatedUnitSinCos(a.SkVector.normalize(f),Math.sin(n),Math.cos(n))};a.SkM44.rotatedUnitSinCos=function(f,n,t){var w=f[0],C=f[1];f=f[2];var G=1-t;return[G*w*w+t,G*w*C-n*f,G*w*f+n*C,0,G*w*C+n*f,G*C*C+t,G*C*f-n*w,0,G*w*f-n*C,G*C*f+n*w,G*f*f+t,0,0,0,0,1]};a.SkM44.lookat=function(f,n,t){n=a.SkVector.normalize(a.SkVector.sub(n,f));
t=a.SkVector.normalize(t);t=a.SkVector.normalize(a.SkVector.cross(n,t));var w=a.SkM44.identity();p(t,w,4,0,0);p(a.SkVector.cross(t,n),w,4,1,0);p(a.SkVector.mulScalar(n,-1),w,4,2,0);p(f,w,4,3,0);f=a.SkM44.invert(w);return null===f?a.SkM44.identity():f};a.SkM44.perspective=function(f,n,t){var w=1/(n-f);t/=2;t=Math.cos(t)/Math.sin(t);return[t,0,0,0,0,t,0,0,0,0,(n+f)*w,2*n*f*w,0,0,-1,1]};a.SkM44.rc=function(f,n,t){return f[4*n+t]};a.SkM44.multiply=function(){return ba(4,arguments)};a.SkM44.invert=function(f){var n=
f[0],t=f[4],w=f[8],C=f[12],G=f[1],S=f[5],U=f[9],V=f[13],Y=f[2],ka=f[6],na=f[10],qa=f[14],I=f[3],l=f[7],r=f[11];f=f[15];var x=n*S-t*G,B=n*U-w*G,D=n*V-C*G,H=t*U-w*S,O=t*V-C*S,aa=w*V-C*U,ia=Y*l-ka*I,ra=Y*r-na*I,sa=Y*f-qa*I,gb=ka*r-na*l,hb=ka*f-qa*l,ib=na*f-qa*r,kd=x*ib-B*hb+D*gb+H*sa-O*ra+aa*ia,ta=1/kd;if(0===kd||Infinity===ta)return null;x*=ta;B*=ta;D*=ta;H*=ta;O*=ta;aa*=ta;ia*=ta;ra*=ta;sa*=ta;gb*=ta;hb*=ta;ib*=ta;n=[S*ib-U*hb+V*gb,U*sa-G*ib-V*ra,G*hb-S*sa+V*ia,S*ra-G*gb-U*ia,w*hb-t*ib-C*gb,n*ib-w*
sa+C*ra,t*sa-n*hb-C*ia,n*gb-t*ra+w*ia,l*aa-r*O+f*H,r*D-I*aa-f*B,I*O-l*D+f*x,l*B-I*H-r*x,na*O-ka*aa-qa*H,Y*aa-na*D+qa*B,ka*D-Y*O-qa*x,Y*H-ka*B+na*x];return n.every(function(ld){return Infinity!==ld&&-Infinity!==ld})?n:null};a.SkM44.transpose=function(f){return[f[0],f[4],f[8],f[12],f[1],f[5],f[9],f[13],f[2],f[6],f[10],f[14],f[3],f[7],f[11],f[15]]};a.SkM44.mustInvert=function(f){f=a.SkM44.invert(f);if(null===f)throw"Matrix not invertible";return f};a.SkM44.setupCamera=function(f,n,t){var w=a.SkM44.lookat(t.eye,
t.coa,t.up);t=a.SkM44.perspective(t.near,t.far,t.angle);n=[(f.fRight-f.fLeft)/2,(f.fBottom-f.fTop)/2,n];f=a.SkM44.multiply(a.SkM44.translated([(f.fLeft+f.fRight)/2,(f.fTop+f.fBottom)/2,0]),a.SkM44.scaled(n));return a.SkM44.multiply(f,t,w,a.SkM44.mustInvert(f))};a.SkColorMatrix={};a.SkColorMatrix.identity=function(){var f=new Float32Array(20);f[0]=1;f[6]=1;f[12]=1;f[18]=1;return f};a.SkColorMatrix.scaled=function(f,n,t,w){var C=new Float32Array(20);C[0]=f;C[6]=n;C[12]=t;C[18]=w;return C};var za=[[6,
7,11,12],[0,10,2,12],[0,1,5,6]];a.SkColorMatrix.rotated=function(f,n,t){var w=a.SkColorMatrix.identity();f=za[f];w[f[0]]=t;w[f[1]]=n;w[f[2]]=-n;w[f[3]]=t;return w};a.SkColorMatrix.postTranslate=function(f,n,t,w,C){f[4]+=n;f[9]+=t;f[14]+=w;f[19]+=C;return f};a.SkColorMatrix.concat=function(f,n){for(var t=new Float32Array(20),w=0,C=0;20>C;C+=5){for(var G=0;4>G;G++)t[w++]=f[C]*n[G]+f[C+1]*n[G+5]+f[C+2]*n[G+10]+f[C+3]*n[G+15];t[w++]=f[C]*n[4]+f[C+1]*n[9]+f[C+2]*n[14]+f[C+3]*n[19]+f[C+4]}return t};a.SkPath.MakeFromCmds=
function(f){for(var n=0,t=0;t<f.length;t++)n+=f[t].length;if(Gc[n])var w=Gc[n];else w=new Float32Array(n),Gc[n]=w;var C=0;for(t=0;t<f.length;t++)for(var G=0;G<f[t].length;G++)w[C]=f[t][G],C++;f=[m(w,"HEAPF32"),n];n=a.SkPath._MakeFromCmds(f[0],f[1]);a._free(f[0]);return n};a.MakePathFromCmds=a.SkPath.MakeFromCmds;a.SkPath.MakeFromVerbsPointsWeights=function(f,n,t){var w=m(f,"HEAPU8"),C=m(n,"HEAPF32"),G=m(t,"HEAPF32"),S=a.SkPath._MakeFromVerbsPointsWeights(w,f.length,C,n.length,G,t&&t.length||0);R(w,
f);R(C,n);R(G,t);return S};a.SkPath.prototype.addArc=function(f,n,t){this._addArc(f,n,t);return this};a.SkPath.prototype.addOval=function(f,n,t){void 0===t&&(t=1);this._addOval(f,!!n,t);return this};a.SkPath.prototype.addPath=function(){var f=Array.prototype.slice.call(arguments),n=f[0],t=!1;"boolean"===typeof f[f.length-1]&&(t=f.pop());if(1===f.length)this._addPath(n,1,0,0,0,1,0,0,0,1,t);else if(2===f.length)f=f[1],this._addPath(n,f[0],f[1],f[2],f[3],f[4],f[5],f[6]||0,f[7]||0,f[8]||1,t);else if(7===
f.length||10===f.length)this._addPath(n,f[1],f[2],f[3],f[4],f[5],f[6],f[7]||0,f[8]||0,f[9]||1,t);else return null;return this};a.SkPath.prototype.addPoly=function(f,n){if(f._ck){var t=f.byteOffset;var w=f.length/2}else t=q(f,"HEAPF32"),w=f.length;this._addPoly(t,w,n);R(t,f);return this};a.SkPath.prototype.addRect=function(){if(1===arguments.length||2===arguments.length){var f=arguments[0];this._addRect(f.fLeft,f.fTop,f.fRight,f.fBottom,arguments[1]||!1)}else if(4===arguments.length||5===arguments.length)f=
arguments,this._addRect(f[0],f[1],f[2],f[3],f[4]||!1);else return null;return this};a.SkPath.prototype.addRoundRect=function(){var f=arguments;if(3===f.length||6===f.length)var n=f[f.length-2];else if(4===f.length||7===f.length){n=f[f.length-3];var t=f[f.length-2];n=[n,t,n,t,n,t,n,t]}else return null;if(8!==n.length)return null;t=m(n,"HEAPF32");if(3===f.length||4===f.length){var w=f[0],C=f[f.length-1];this._addRoundRect(w.fLeft,w.fTop,w.fRight,w.fBottom,t,C)}else 6!==f.length&&7!==f.length||this._addRoundRect(f[0],
f[1],f[2],f[3],t,C);R(t,n);return this};a.SkPath.prototype.addVerbsPointsWeights=function(f,n,t){var w=m(f,"HEAPU8"),C=m(n,"HEAPF32"),G=m(t,"HEAPF32");this._addVerbsPointsWeights(w,f.length,C,n.length,G,t&&t.length||0);R(w,f);R(C,n);R(G,t)};a.SkPath.prototype.arc=function(f,n,t,w,C,G){f=a.LTRBRect(f-t,n-t,f+t,n+t);C=(C-w)/Math.PI*180-360*!!G;G=new a.SkPath;G.addArc(f,w/Math.PI*180,C);this.addPath(G,!0);G.delete();return this};a.SkPath.prototype.arcTo=function(){var f=arguments;if(5===f.length)this._arcToTangent(f[0],
f[1],f[2],f[3],f[4]);else if(4===f.length)this._arcToOval(f[0],f[1],f[2],f[3]);else if(7===f.length)this._arcToRotated(f[0],f[1],f[2],!!f[3],!!f[4],f[5],f[6]);else throw"Invalid args for arcTo. Expected 4, 5, or 7, got "+f.length;return this};a.SkPath.prototype.arcToOval=function(f,n,t,w){this._arcToOval(f,n,t,w);return this};a.SkPath.prototype.arcToRotated=function(f,n,t,w,C,G,S){this._arcToRotated(f,n,t,!!w,!!C,G,S);return this};a.SkPath.prototype.arcToTangent=function(f,n,t,w,C){this._arcToTangent(f,
n,t,w,C);return this};a.SkPath.prototype.close=function(){this._close();return this};a.SkPath.prototype.conicTo=function(f,n,t,w,C){this._conicTo(f,n,t,w,C);return this};a.SkPath.prototype.cubicTo=function(f,n,t,w,C,G){this._cubicTo(f,n,t,w,C,G);return this};a.SkPath.prototype.dash=function(f,n,t){return this._dash(f,n,t)?this:null};a.SkPath.prototype.lineTo=function(f,n){this._lineTo(f,n);return this};a.SkPath.prototype.moveTo=function(f,n){this._moveTo(f,n);return this};a.SkPath.prototype.offset=
function(f,n){this._transform(1,0,f,0,1,n,0,0,1);return this};a.SkPath.prototype.quadTo=function(f,n,t,w){this._quadTo(f,n,t,w);return this};a.SkPath.prototype.rArcTo=function(f,n,t,w,C,G,S){this._rArcTo(f,n,t,w,C,G,S);return this};a.SkPath.prototype.rConicTo=function(f,n,t,w,C){this._rConicTo(f,n,t,w,C);return this};a.SkPath.prototype.rCubicTo=function(f,n,t,w,C,G){this._rCubicTo(f,n,t,w,C,G);return this};a.SkPath.prototype.rLineTo=function(f,n){this._rLineTo(f,n);return this};a.SkPath.prototype.rMoveTo=
function(f,n){this._rMoveTo(f,n);return this};a.SkPath.prototype.rQuadTo=function(f,n,t,w){this._rQuadTo(f,n,t,w);return this};a.SkPath.prototype.stroke=function(f){f=f||{};f.width=f.width||1;f.miter_limit=f.miter_limit||4;f.cap=f.cap||a.StrokeCap.Butt;f.join=f.join||a.StrokeJoin.Miter;f.precision=f.precision||1;return this._stroke(f)?this:null};a.SkPath.prototype.transform=function(){if(1===arguments.length){var f=arguments[0];this._transform(f[0],f[1],f[2],f[3],f[4],f[5],f[6]||0,f[7]||0,f[8]||1)}else if(6===
arguments.length||9===arguments.length)f=arguments,this._transform(f[0],f[1],f[2],f[3],f[4],f[5],f[6]||0,f[7]||0,f[8]||1);else throw"transform expected to take 1 or 9 arguments. Got "+arguments.length;return this};a.SkPath.prototype.trim=function(f,n,t){return this._trim(f,n,!!t)?this:null};a.SkImage.prototype.encodeToData=function(){if(!arguments.length)return this._encodeToData();if(2===arguments.length){var f=arguments;return this._encodeToDataWithFormat(f[0],f[1])}throw"encodeToData expected to take 0 or 2 arguments. Got "+
arguments.length;};a.SkImage.prototype.makeShader=function(f,n,t){t=A(t);return this._makeShader(f,n,t)};a.SkImage.prototype.readPixels=function(f,n,t){switch(f.colorType){case a.ColorType.RGBA_8888:var w=4*f.width;break;case a.ColorType.RGBA_F32:w=16*f.width;break;default:return}var C=w*f.height,G=a._malloc(C);if(!this._readPixels(f,G,w,n,t))return null;n=null;switch(f.colorType){case a.ColorType.RGBA_8888:n=(new Uint8Array(a.HEAPU8.buffer,G,C)).slice();break;case a.ColorType.RGBA_F32:n=(new Float32Array(a.HEAPU8.buffer,
G,C)).slice()}a._free(G);return n};a.SkCanvas.prototype.clear=function(f){f=Q(f);this._clear(f)};a.SkCanvas.prototype.concat=function(f){f=F(f);this._concat(f)};a.SkCanvas.prototype.concat44=a.SkCanvas.prototype.concat;a.SkCanvas.prototype.drawAtlas=function(f,n,t,w,C,G){if(f&&w&&n&&t&&n.length===t.length){C||(C=a.BlendMode.SrcOver);var S;n.build?S=n.build():S=m(n,"HEAPF32");if(t.build){var U=t.build();var V=t.length}else U=m(t,"HEAPF32"),V=t.length/4;var Y=0;G&&(G.build?Y=G.build():Y=m(e(G),"HEAPU32"));
this._drawAtlas(f,U,S,Y,V,C,w);S&&!n.build&&R(S,n);U&&!t.build&&R(U,t);Y&&!G.build&&R(Y,G)}};a.SkCanvas.prototype.drawColor=function(f,n){f=Q(f);void 0!==n?this._drawColor(f,n):this._drawColor(f)};a.SkCanvas.prototype.drawColorComponents=function(f,n,t,w,C){f=y(f,n,t,w);void 0!==C?this._drawColor(f,C):this._drawColor(f)};a.SkCanvas.prototype.drawPoints=function(f,n,t){if(n._ck){var w=n.byteOffset;var C=n.length/2}else w=q(n,"HEAPF32"),C=n.length;this._drawPoints(f,w,C,t);R(w,n)};a.SkCanvas.prototype.drawShadow=
function(f,n,t,w,C,G,S){var U=m(C,"HEAPF32"),V=m(G,"HEAPF32");this._drawShadow(f,n,t,w,U,V,S);R(U,C);R(V,G)};a.SkCanvas.prototype.getLocalToDevice=function(){this._getLocalToDevice(Ea);return L(Ea)};a.SkCanvas.prototype.findMarkedCTM=function(f){return this._findMarkedCTM(f,Ea)?L(Ea):null};a.SkCanvas.prototype.getTotalMatrix=function(){this._getTotalMatrix(ja);for(var f=Array(9),n=0;9>n;n++)f[n]=a.HEAPF32[ja/4+n];return f};a.SkCanvas.prototype.readPixels=function(f,n,t,w,C,G,S,U){C=C||a.AlphaType.Unpremul;
G=G||a.ColorType.RGBA_8888;S=S||a.SkColorSpace.SRGB;var V=4;G===a.ColorType.RGBA_F16&&(V=8);U=U||V*t;var Y=w*U;V=a._malloc(Y);if(!this._readPixels({width:t,height:w,colorType:G,alphaType:C,colorSpace:S},V,U,f,n))return a._free(V),null;f=(new Uint8Array(a.HEAPU8.buffer,V,Y)).slice();a._free(V);return f};a.SkCanvas.prototype.writePixels=function(f,n,t,w,C,G,S,U){if(f.byteLength%(n*t))throw"pixels length must be a multiple of the srcWidth * srcHeight";var V=f.byteLength/(n*t);G=G||a.AlphaType.Unpremul;
S=S||a.ColorType.RGBA_8888;U=U||a.SkColorSpace.SRGB;var Y=V*n;V=m(f,"HEAPU8");n=this._writePixels({width:n,height:t,colorType:S,alphaType:G,colorSpace:U},V,Y,w,C);R(V,f);return n};a.SkColorFilter.MakeBlend=function(f,n){f=Q(f);return a.SkColorFilter._MakeBlend(f,n)};a.SkColorFilter.MakeMatrix=function(f){if(!f||20!==f.length)throw"invalid color matrix";var n=m(f,"HEAPF32"),t=a.SkColorFilter._makeMatrix(n);R(n,f);return t};a.SkImageFilter.MakeMatrixTransform=function(f,n,t){f=A(f);return a.SkImageFilter._MakeMatrixTransform(f,
n,t)};a.SkPaint.prototype.getColor=function(){this._getColor(yb);return P(yb)};a.SkPaint.prototype.setColor=function(f,n){n=n||null;f=Q(f);this._setColor(f,n)};a.SkPaint.prototype.setColorComponents=function(f,n,t,w,C){C=C||null;f=y(f,n,t,w);this._setColor(f,C)};a.SkSurface.prototype.captureFrameAsSkPicture=function(f){var n=new a.SkPictureRecorder,t=n.beginRecording(a.LTRBRect(0,0,this.width(),this.height()));f(t);f=n.finishRecordingAsPicture();n.delete();return f};a.SkSurface.prototype.requestAnimationFrame=
function(f,n){this.Nk||(this.Nk=this.getCanvas());window.requestAnimationFrame(function(){void 0!==this.pk&&a.setCurrentContext(this.pk);f(this.Nk);this.flush(n)}.bind(this))};a.SkSurface.prototype.drawOnce=function(f,n){this.Nk||(this.Nk=this.getCanvas());window.requestAnimationFrame(function(){void 0!==this.pk&&a.setCurrentContext(this.pk);f(this.Nk);this.flush(n);this.dispose()}.bind(this))};a.SkPathEffect.MakeDash=function(f,n){n||(n=0);if(!f.length||1===f.length%2)throw"Intervals array must have even length";
var t=m(f,"HEAPF32");n=a.SkPathEffect._MakeDash(t,f.length,n);R(t,f);return n};a.SkShader.Color=function(f,n){n=n||null;f=Q(f);return a.SkShader._Color(f,n)};a.SkShader.MakeLinearGradient=function(f,n,t,w,C,G,S,U){U=U||null;var V=u(t),Y=m(w,"HEAPF32");S=S||0;G=A(G);f=a._MakeLinearGradientShader(f,n,V.dk,V.Tk,Y,V.count,C,S,G,U);R(V.dk,t);w&&R(Y,w);return f};a.SkShader.MakeRadialGradient=function(f,n,t,w,C,G,S,U){U=U||null;var V=u(t),Y=m(w,"HEAPF32");S=S||0;G=A(G);f=a._MakeRadialGradientShader(f,n,
V.dk,V.Tk,Y,V.count,C,S,G,U);R(V.dk,t);w&&R(Y,w);return f};a.SkShader.MakeSweepGradient=function(f,n,t,w,C,G,S,U,V,Y){Y=Y||null;var ka=u(t),na=m(w,"HEAPF32");S=S||0;U=U||0;V=V||360;G=A(G);f=a._MakeSweepGradientShader(f,n,ka.dk,ka.Tk,na,ka.count,C,U,V,S,G,Y);R(ka.dk,t);w&&R(na,w);return f};a.SkShader.MakeTwoPointConicalGradient=function(f,n,t,w,C,G,S,U,V,Y){Y=Y||null;var ka=u(C),na=m(G,"HEAPF32");V=V||0;U=A(U);f=a._MakeTwoPointConicalGradientShader(f,n,t,w,ka.dk,ka.Tk,na,ka.count,S,V,U,Y);R(ka.dk,
C);G&&R(na,G);return f};a.xm=a.SkPathEffect.MakeDash;a.um=a.SkShader.MakeLinearGradient;a.wm=a.SkShader.MakeRadialGradient;a.ym=a.SkShader.MakeTwoPointConicalGradient;a.qk&&a.qk.forEach(function(f){f()})};a.computeTonalColors=function(p){var z=m(p.ambient,"HEAPF32"),K=m(p.spot,"HEAPF32");this._computeTonalColors(z,K);var N={ambient:P(z),spot:P(K)};R(z,p.ambient);R(K,p.spot);return N};a.LTRBRect=function(p,z,K,N){return{fLeft:p,fTop:z,fRight:K,fBottom:N}};a.XYWHRect=function(p,z,K,N){return{fLeft:p,
fTop:z,fRight:p+K,fBottom:z+N}};a.RRectXY=function(p,z,K){return{rect:p,rx1:z,ry1:K,rx2:z,ry2:K,rx3:z,ry3:K,rx4:z,ry4:K}};a.MakeAnimatedImageFromEncoded=function(p){p=new Uint8Array(p);var z=a._malloc(p.byteLength);a.HEAPU8.set(p,z);return(p=a._decodeAnimatedImage(z,p.byteLength))?p:null};a.MakeImageFromEncoded=function(p){p=new Uint8Array(p);var z=a._malloc(p.byteLength);a.HEAPU8.set(p,z);return(p=a._decodeImage(z,p.byteLength))?p:null};var zb=null;a.MakeImageFromCanvasImageSource=function(p){var z=
p.width,K=p.height;zb||(zb=document.createElement("canvas"));zb.width=z;zb.height=K;var N=zb.getContext("2d");N.drawImage(p,0,0);p=N.getImageData(0,0,z,K);return a.MakeImage(p.data,z,K,a.AlphaType.Unpremul,a.ColorType.RGBA_8888,a.SkColorSpace.SRGB)};a.MakeImage=function(p,z,K,N,ba,za){var f=p.length/(z*K);K={width:z,height:K,alphaType:N,colorType:ba,colorSpace:za};N=m(p,"HEAPU8");return a._MakeImage(K,N,p.length,z*f)};a.MakeSkVertices=function(p,z,K,N,ba,za){var f=ba&&ba.length||0,n=0;K&&K.length&&
(n|=1);N&&N.length&&(n|=2);void 0===za||za||(n|=4);p=new a._SkVerticesBuilder(p,z.length,f,n);q(z,"HEAPF32",p.positions());p.texCoords()&&q(K,"HEAPF32",p.texCoords());if(p.colors()){if(N.build)throw"Color builder not accepted by MakeSkVertices, use array of ints";m(e(N),"HEAPU32",p.colors())}p.indices()&&m(ba,"HEAPU16",p.indices());return p.detach()};(function(){function p(I){for(var l=0;l<I.length;l++)if(void 0!==I[l]&&!Number.isFinite(I[l]))return!1;return!0}function z(I){var l=a.getColorComponents(I);
I=l[0];var r=l[1],x=l[2];l=l[3];if(1===l)return I=I.toString(16).toLowerCase(),r=r.toString(16).toLowerCase(),x=x.toString(16).toLowerCase(),I=1===I.length?"0"+I:I,r=1===r.length?"0"+r:r,x=1===x.length?"0"+x:x,"#"+I+r+x;l=0===l||1===l?l:l.toFixed(8);return"rgba("+I+", "+r+", "+x+", "+l+")"}function K(I){return a.parseColorString(I,ka)}function N(I){I=na.exec(I);if(!I)return null;var l=parseFloat(I[4]),r=16;switch(I[5]){case "em":case "rem":r=16*l;break;case "pt":r=4*l/3;break;case "px":r=l;break;
case "pc":r=16*l;break;case "in":r=96*l;break;case "cm":r=96*l/2.54;break;case "mm":r=96/25.4*l;break;case "q":r=96/25.4/4*l;break;case "%":r=16/75*l}return{style:I[1],variant:I[2],weight:I[3],sizePx:r,family:I[6].trim()}}function ba(I){this.Lj=I;this.Nj=new a.SkPaint;this.Nj.setAntiAlias(!0);this.Nj.setStrokeMiter(10);this.Nj.setStrokeCap(a.StrokeCap.Butt);this.Nj.setStrokeJoin(a.StrokeJoin.Miter);this.Zk="10px monospace";this.rk=new a.SkFont(null,10);this.rk.setSubpixel(!0);this.$j=this.hk=a.BLACK;
this.Bk=0;this.Qk=a.TRANSPARENT;this.Dk=this.Ck=0;this.Rk=this.lk=1;this.Pk=0;this.Ak=[];this.Mj=a.BlendMode.SrcOver;this.sk=a.FilterQuality.Low;this.Ok=!0;this.Nj.setStrokeWidth(this.Rk);this.Nj.setBlendMode(this.Mj);this.Pj=new a.SkPath;this.Rj=a.SkMatrix.identity();this.wl=[];this.Hk=[];this.mk=function(){this.Pj.delete();this.Nj.delete();this.rk.delete();this.Hk.forEach(function(l){l.mk()})};Object.defineProperty(this,"currentTransform",{enumerable:!0,get:function(){return{a:this.Rj[0],c:this.Rj[1],
e:this.Rj[2],b:this.Rj[3],d:this.Rj[4],f:this.Rj[5]}},set:function(l){l.a&&this.setTransform(l.a,l.b,l.c,l.d,l.e,l.f)}});Object.defineProperty(this,"fillStyle",{enumerable:!0,get:function(){return c(this.$j)?z(this.$j):this.$j},set:function(l){"string"===typeof l?this.$j=K(l):l.zk&&(this.$j=l)}});Object.defineProperty(this,"font",{enumerable:!0,get:function(){return this.Zk},set:function(l){var r=N(l),x=r.family;r.typeface=qa[x]?qa[x][(r.style||"normal")+"|"+(r.variant||"normal")+"|"+(r.weight||"normal")]||
qa[x]["*"]:null;r&&(this.rk.setSize(r.sizePx),this.rk.setTypeface(r.typeface),this.Zk=l)}});Object.defineProperty(this,"globalAlpha",{enumerable:!0,get:function(){return this.lk},set:function(l){!isFinite(l)||0>l||1<l||(this.lk=l)}});Object.defineProperty(this,"globalCompositeOperation",{enumerable:!0,get:function(){switch(this.Mj){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(l){switch(l){case "source-over":this.Mj=a.BlendMode.SrcOver;break;case "destination-over":this.Mj=a.BlendMode.DstOver;break;case "copy":this.Mj=a.BlendMode.Src;break;case "destination":this.Mj=a.BlendMode.Dst;break;case "clear":this.Mj=a.BlendMode.Clear;break;case "source-in":this.Mj=a.BlendMode.SrcIn;break;case "destination-in":this.Mj=a.BlendMode.DstIn;break;case "source-out":this.Mj=a.BlendMode.SrcOut;break;case "destination-out":this.Mj=a.BlendMode.DstOut;break;case "source-atop":this.Mj=
a.BlendMode.SrcATop;break;case "destination-atop":this.Mj=a.BlendMode.DstATop;break;case "xor":this.Mj=a.BlendMode.Xor;break;case "lighter":this.Mj=a.BlendMode.Plus;break;case "plus-lighter":this.Mj=a.BlendMode.Plus;break;case "plus-darker":throw"plus-darker is not supported";case "multiply":this.Mj=a.BlendMode.Multiply;break;case "screen":this.Mj=a.BlendMode.Screen;break;case "overlay":this.Mj=a.BlendMode.Overlay;break;case "darken":this.Mj=a.BlendMode.Darken;break;case "lighten":this.Mj=a.BlendMode.Lighten;
break;case "color-dodge":this.Mj=a.BlendMode.ColorDodge;break;case "color-burn":this.Mj=a.BlendMode.ColorBurn;break;case "hard-light":this.Mj=a.BlendMode.HardLight;break;case "soft-light":this.Mj=a.BlendMode.SoftLight;break;case "difference":this.Mj=a.BlendMode.Difference;break;case "exclusion":this.Mj=a.BlendMode.Exclusion;break;case "hue":this.Mj=a.BlendMode.Hue;break;case "saturation":this.Mj=a.BlendMode.Saturation;break;case "color":this.Mj=a.BlendMode.Color;break;case "luminosity":this.Mj=a.BlendMode.Luminosity;
break;default:return}this.Nj.setBlendMode(this.Mj)}});Object.defineProperty(this,"imageSmoothingEnabled",{enumerable:!0,get:function(){return this.Ok},set:function(l){this.Ok=!!l}});Object.defineProperty(this,"imageSmoothingQuality",{enumerable:!0,get:function(){switch(this.sk){case a.FilterQuality.Low:return"low";case a.FilterQuality.Medium:return"medium";case a.FilterQuality.High:return"high"}},set:function(l){switch(l){case "low":this.sk=a.FilterQuality.Low;break;case "medium":this.sk=a.FilterQuality.Medium;
break;case "high":this.sk=a.FilterQuality.High}}});Object.defineProperty(this,"lineCap",{enumerable:!0,get:function(){switch(this.Nj.getStrokeCap()){case a.StrokeCap.Butt:return"butt";case a.StrokeCap.Round:return"round";case a.StrokeCap.Square:return"square"}},set:function(l){switch(l){case "butt":this.Nj.setStrokeCap(a.StrokeCap.Butt);break;case "round":this.Nj.setStrokeCap(a.StrokeCap.Round);break;case "square":this.Nj.setStrokeCap(a.StrokeCap.Square)}}});Object.defineProperty(this,"lineDashOffset",
{enumerable:!0,get:function(){return this.Pk},set:function(l){isFinite(l)&&(this.Pk=l)}});Object.defineProperty(this,"lineJoin",{enumerable:!0,get:function(){switch(this.Nj.getStrokeJoin()){case a.StrokeJoin.Miter:return"miter";case a.StrokeJoin.Round:return"round";case a.StrokeJoin.Bevel:return"bevel"}},set:function(l){switch(l){case "miter":this.Nj.setStrokeJoin(a.StrokeJoin.Miter);break;case "round":this.Nj.setStrokeJoin(a.StrokeJoin.Round);break;case "bevel":this.Nj.setStrokeJoin(a.StrokeJoin.Bevel)}}});
Object.defineProperty(this,"lineWidth",{enumerable:!0,get:function(){return this.Nj.getStrokeWidth()},set:function(l){0>=l||!l||(this.Rk=l,this.Nj.setStrokeWidth(l))}});Object.defineProperty(this,"miterLimit",{enumerable:!0,get:function(){return this.Nj.getStrokeMiter()},set:function(l){0>=l||!l||this.Nj.setStrokeMiter(l)}});Object.defineProperty(this,"shadowBlur",{enumerable:!0,get:function(){return this.Bk},set:function(l){0>l||!isFinite(l)||(this.Bk=l)}});Object.defineProperty(this,"shadowColor",
{enumerable:!0,get:function(){return z(this.Qk)},set:function(l){this.Qk=K(l)}});Object.defineProperty(this,"shadowOffsetX",{enumerable:!0,get:function(){return this.Ck},set:function(l){isFinite(l)&&(this.Ck=l)}});Object.defineProperty(this,"shadowOffsetY",{enumerable:!0,get:function(){return this.Dk},set:function(l){isFinite(l)&&(this.Dk=l)}});Object.defineProperty(this,"strokeStyle",{enumerable:!0,get:function(){return z(this.hk)},set:function(l){"string"===typeof l?this.hk=K(l):l.zk&&(this.hk=
l)}});this.arc=function(l,r,x,B,D,H){G(this.Pj,l,r,x,x,0,B,D,H)};this.arcTo=function(l,r,x,B,D){t(this.Pj,l,r,x,B,D)};this.beginPath=function(){this.Pj.delete();this.Pj=new a.SkPath};this.bezierCurveTo=function(l,r,x,B,D,H){var O=this.Pj;p([l,r,x,B,D,H])&&(O.isEmpty()&&O.moveTo(l,r),O.cubicTo(l,r,x,B,D,H))};this.clearRect=function(l,r,x,B){this.Nj.setStyle(a.PaintStyle.Fill);this.Nj.setBlendMode(a.BlendMode.Clear);this.Lj.drawRect(a.XYWHRect(l,r,x,B),this.Nj);this.Nj.setBlendMode(this.Mj)};this.clip=
function(l,r){"string"===typeof l?(r=l,l=this.Pj):l&&l.il&&(l=l.Tj);l||(l=this.Pj);l=l.copy();r&&"evenodd"===r.toLowerCase()?l.setFillType(a.FillType.EvenOdd):l.setFillType(a.FillType.Winding);this.Lj.clipPath(l,a.ClipOp.Intersect,!0);l.delete()};this.closePath=function(){w(this.Pj)};this.createImageData=function(){if(1===arguments.length){var l=arguments[0];return new f(new Uint8ClampedArray(4*l.width*l.height),l.width,l.height)}if(2===arguments.length){l=arguments[0];var r=arguments[1];return new f(new Uint8ClampedArray(4*
l*r),l,r)}throw"createImageData expects 1 or 2 arguments, got "+arguments.length;};this.createLinearGradient=function(l,r,x,B){if(p(arguments)){var D=new n(l,r,x,B);this.Hk.push(D);return D}};this.createPattern=function(l,r){l=new V(l,r);this.Hk.push(l);return l};this.createRadialGradient=function(l,r,x,B,D,H){if(p(arguments)){var O=new Y(l,r,x,B,D,H);this.Hk.push(O);return O}};this.Hl=function(){var l=this.Yk();this.Ok?l.setFilterQuality(this.sk):l.setFilterQuality(a.FilterQuality.None);return l};
this.drawImage=function(l){var r=this.Hl();if(3===arguments.length||5===arguments.length)var x=a.XYWHRect(arguments[1],arguments[2],arguments[3]||l.width(),arguments[4]||l.height()),B=a.XYWHRect(0,0,l.width(),l.height());else if(9===arguments.length)x=a.XYWHRect(arguments[5],arguments[6],arguments[7],arguments[8]),B=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.Lj.drawImageRect(l,B,x,r,
!1);r.dispose()};this.ellipse=function(l,r,x,B,D,H,O,aa){G(this.Pj,l,r,x,B,D,H,O,aa)};this.Yk=function(){var l=this.Nj.copy();l.setStyle(a.PaintStyle.Fill);if(c(this.$j)){var r=a.multiplyByAlpha(this.$j,this.lk);l.setColor(r)}else r=this.$j.zk(this.Rj),l.setColor(a.Color(0,0,0,this.lk)),l.setShader(r);l.dispose=function(){this.delete()};return l};this.fill=function(l,r){"string"===typeof l?(r=l,l=this.Pj):l&&l.il&&(l=l.Tj);if("evenodd"===r)this.Pj.setFillType(a.FillType.EvenOdd);else{if("nonzero"!==
r&&r)throw"invalid fill rule";this.Pj.setFillType(a.FillType.Winding)}l||(l=this.Pj);r=this.Yk();var x=this.Ek(r);x&&(this.Lj.save(),this.xk(),this.Lj.drawPath(l,x),this.Lj.restore(),x.dispose());this.Lj.drawPath(l,r);r.dispose()};this.fillRect=function(l,r,x,B){var D=this.Yk(),H=this.Ek(D);H&&(this.Lj.save(),this.xk(),this.Lj.drawRect(a.XYWHRect(l,r,x,B),H),this.Lj.restore(),H.dispose());this.Lj.drawRect(a.XYWHRect(l,r,x,B),D);D.dispose()};this.fillText=function(l,r,x){var B=this.Yk();l=a.SkTextBlob.MakeFromText(l,
this.rk);var D=this.Ek(B);D&&(this.Lj.save(),this.xk(),this.Lj.drawTextBlob(l,r,x,D),this.Lj.restore(),D.dispose());this.Lj.drawTextBlob(l,r,x,B);l.delete();B.dispose()};this.getImageData=function(l,r,x,B){return(l=this.Lj.readPixels(l,r,x,B))?new f(new Uint8ClampedArray(l.buffer),x,B):null};this.getLineDash=function(){return this.Ak.slice()};this.xl=function(l){var r=a.SkMatrix.invert(this.Rj);a.SkMatrix.mapPoints(r,l);return l};this.isPointInPath=function(l,r,x){var B=arguments;if(3===B.length)var D=
this.Pj;else if(4===B.length)D=B[0],l=B[1],r=B[2],x=B[3];else throw"invalid arg count, need 3 or 4, got "+B.length;if(!isFinite(l)||!isFinite(r))return!1;x=x||"nonzero";if("nonzero"!==x&&"evenodd"!==x)return!1;B=this.xl([l,r]);l=B[0];r=B[1];D.setFillType("nonzero"===x?a.FillType.Winding:a.FillType.EvenOdd);return D.contains(l,r)};this.isPointInStroke=function(l,r){var x=arguments;if(2===x.length)var B=this.Pj;else if(3===x.length)B=x[0],l=x[1],r=x[2];else throw"invalid arg count, need 2 or 3, got "+
x.length;if(!isFinite(l)||!isFinite(r))return!1;x=this.xl([l,r]);l=x[0];r=x[1];B=B.copy();B.setFillType(a.FillType.Winding);B.stroke({width:this.lineWidth,miter_limit:this.miterLimit,cap:this.Nj.getStrokeCap(),join:this.Nj.getStrokeJoin(),precision:.3});x=B.contains(l,r);B.delete();return x};this.lineTo=function(l,r){S(this.Pj,l,r)};this.measureText=function(l){return{width:this.rk.measureText(l)}};this.moveTo=function(l,r){var x=this.Pj;p([l,r])&&x.moveTo(l,r)};this.putImageData=function(l,r,x,B,
D,H,O){if(p([r,x,B,D,H,O]))if(void 0===B)this.Lj.writePixels(l.data,l.width,l.height,r,x);else if(B=B||0,D=D||0,H=H||l.width,O=O||l.height,0>H&&(B+=H,H=Math.abs(H)),0>O&&(D+=O,O=Math.abs(O)),0>B&&(H+=B,B=0),0>D&&(O+=D,D=0),!(0>=H||0>=O)){l=a.MakeImage(l.data,l.width,l.height,a.AlphaType.Unpremul,a.ColorType.RGBA_8888,a.SkColorSpace.SRGB);var aa=a.XYWHRect(B,D,H,O);r=a.XYWHRect(r+B,x+D,H,O);x=a.SkMatrix.invert(this.Rj);this.Lj.save();this.Lj.concat(x);this.Lj.drawImageRect(l,aa,r,null,!1);this.Lj.restore();
l.delete()}};this.quadraticCurveTo=function(l,r,x,B){var D=this.Pj;p([l,r,x,B])&&(D.isEmpty()&&D.moveTo(l,r),D.quadTo(l,r,x,B))};this.rect=function(l,r,x,B){var D=this.Pj;p([l,r,x,B])&&D.addRect(l,r,l+x,r+B)};this.resetTransform=function(){this.Pj.transform(this.Rj);var l=a.SkMatrix.invert(this.Rj);this.Lj.concat(l);this.Rj=this.Lj.getTotalMatrix()};this.restore=function(){var l=this.wl.pop();if(l){var r=a.SkMatrix.multiply(this.Rj,a.SkMatrix.invert(l.Ll));this.Pj.transform(r);this.Nj.delete();this.Nj=
l.dm;this.Ak=l.am;this.Rk=l.om;this.hk=l.nm;this.$j=l.fs;this.Ck=l.lm;this.Dk=l.mm;this.Bk=l.im;this.Qk=l.km;this.lk=l.Ql;this.Mj=l.Rl;this.Pk=l.bm;this.Ok=l.Zl;this.sk=l.$l;this.Zk=l.Pl;this.Lj.restore();this.Rj=this.Lj.getTotalMatrix()}};this.rotate=function(l){if(isFinite(l)){var r=a.SkMatrix.rotated(-l);this.Pj.transform(r);this.Lj.rotate(l/Math.PI*180,0,0);this.Rj=this.Lj.getTotalMatrix()}};this.save=function(){if(this.$j.yk){var l=this.$j.yk();this.Hk.push(l)}else l=this.$j;if(this.hk.yk){var r=
this.hk.yk();this.Hk.push(r)}else r=this.hk;this.wl.push({Ll:this.Rj.slice(),am:this.Ak.slice(),om:this.Rk,nm:r,fs:l,lm:this.Ck,mm:this.Dk,im:this.Bk,km:this.Qk,Ql:this.lk,bm:this.Pk,Rl:this.Mj,Zl:this.Ok,$l:this.sk,dm:this.Nj.copy(),Pl:this.Zk});this.Lj.save()};this.scale=function(l,r){if(p(arguments)){var x=a.SkMatrix.scaled(1/l,1/r);this.Pj.transform(x);this.Lj.scale(l,r);this.Rj=this.Lj.getTotalMatrix()}};this.setLineDash=function(l){for(var r=0;r<l.length;r++)if(!isFinite(l[r])||0>l[r])return;
1===l.length%2&&Array.prototype.push.apply(l,l);this.Ak=l};this.setTransform=function(l,r,x,B,D,H){p(arguments)&&(this.resetTransform(),this.transform(l,r,x,B,D,H))};this.xk=function(){var l=a.SkMatrix.invert(this.Rj);this.Lj.concat(l);this.Lj.concat(a.SkMatrix.translated(this.Ck,this.Dk));this.Lj.concat(this.Rj)};this.Ek=function(l){var r=a.multiplyByAlpha(this.Qk,this.lk);if(!a.getColorComponents(r)[3]||!(this.Bk||this.Dk||this.Ck))return null;l=l.copy();l.setColor(r);var x=a.SkMaskFilter.MakeBlur(a.BlurStyle.Normal,
this.Bk/2,!1);l.setMaskFilter(x);l.dispose=function(){x.delete();this.delete()};return l};this.kl=function(){var l=this.Nj.copy();l.setStyle(a.PaintStyle.Stroke);if(c(this.hk)){var r=a.multiplyByAlpha(this.hk,this.lk);l.setColor(r)}else r=this.hk.zk(this.Rj),l.setColor(a.Color(0,0,0,this.lk)),l.setShader(r);l.setStrokeWidth(this.Rk);if(this.Ak.length){var x=a.SkPathEffect.MakeDash(this.Ak,this.Pk);l.setPathEffect(x)}l.dispose=function(){x&&x.delete();this.delete()};return l};this.stroke=function(l){l=
l?l.Tj:this.Pj;var r=this.kl(),x=this.Ek(r);x&&(this.Lj.save(),this.xk(),this.Lj.drawPath(l,x),this.Lj.restore(),x.dispose());this.Lj.drawPath(l,r);r.dispose()};this.strokeRect=function(l,r,x,B){var D=this.kl(),H=this.Ek(D);H&&(this.Lj.save(),this.xk(),this.Lj.drawRect(a.XYWHRect(l,r,x,B),H),this.Lj.restore(),H.dispose());this.Lj.drawRect(a.XYWHRect(l,r,x,B),D);D.dispose()};this.strokeText=function(l,r,x){var B=this.kl();l=a.SkTextBlob.MakeFromText(l,this.rk);var D=this.Ek(B);D&&(this.Lj.save(),this.xk(),
this.Lj.drawTextBlob(l,r,x,D),this.Lj.restore(),D.dispose());this.Lj.drawTextBlob(l,r,x,B);l.delete();B.dispose()};this.translate=function(l,r){if(p(arguments)){var x=a.SkMatrix.translated(-l,-r);this.Pj.transform(x);this.Lj.translate(l,r);this.Rj=this.Lj.getTotalMatrix()}};this.transform=function(l,r,x,B,D,H){l=[l,x,D,r,B,H,0,0,1];r=a.SkMatrix.invert(l);this.Pj.transform(r);this.Lj.concat(l);this.Rj=this.Lj.getTotalMatrix()};this.addHitRegion=function(){};this.clearHitRegions=function(){};this.drawFocusIfNeeded=
function(){};this.removeHitRegion=function(){};this.scrollPathIntoView=function(){};Object.defineProperty(this,"canvas",{value:null,writable:!1})}function za(I){this.ll=I;this.pk=new ba(I.getCanvas());this.$k=[];this.El=a.SkFontMgr.RefDefault();this.decodeImage=function(l){l=a.MakeImageFromEncoded(l);if(!l)throw"Invalid input";this.$k.push(l);return l};this.loadFont=function(l,r){l=this.El.MakeTypefaceFromData(l);if(!l)return null;this.$k.push(l);var x=(r.style||"normal")+"|"+(r.variant||"normal")+
"|"+(r.weight||"normal");r=r.family;qa[r]||(qa[r]={"*":l});qa[r][x]=l};this.makePath2D=function(l){l=new U(l);this.$k.push(l.Tj);return l};this.getContext=function(l){return"2d"===l?this.pk:null};this.toDataURL=function(l,r){this.ll.flush();var x=this.ll.makeImageSnapshot();if(x){l=l||"image/png";var B=a.ImageFormat.PNG;"image/jpeg"===l&&(B=a.ImageFormat.JPEG);if(r=x.encodeToData(B,r||.92)){r=a.getSkDataBytes(r);l="data:"+l+";base64,";if(ea)r=Buffer.from(r).toString("base64");else{x=0;B=r.length;
for(var D="",H;x<B;)H=r.slice(x,Math.min(x+32768,B)),D+=String.fromCharCode.apply(null,H),x+=32768;r=btoa(D)}return l+r}}};this.dispose=function(){this.pk.mk();this.$k.forEach(function(l){l.delete()});this.ll.dispose()}}function f(I,l,r){if(!l||0===r)throw"invalid dimensions, width and height must be non-zero";if(I.length%4)throw"arr must be a multiple of 4";r=r||I.length/(4*l);Object.defineProperty(this,"data",{value:I,writable:!1});Object.defineProperty(this,"height",{value:r,writable:!1});Object.defineProperty(this,
"width",{value:l,writable:!1})}function n(I,l,r,x){this.Vj=null;this.ck=[];this.Yj=[];this.addColorStop=function(B,D){if(0>B||1<B||!isFinite(B))throw"offset must be between 0 and 1 inclusively";D=K(D);var H=this.Yj.indexOf(B);if(-1!==H)this.ck[H]=D;else{for(H=0;H<this.Yj.length&&!(this.Yj[H]>B);H++);this.Yj.splice(H,0,B);this.ck.splice(H,0,D)}};this.yk=function(){var B=new n(I,l,r,x);B.ck=this.ck.slice();B.Yj=this.Yj.slice();return B};this.mk=function(){this.Vj&&(this.Vj.delete(),this.Vj=null)};this.zk=
function(B){var D=[I,l,r,x];a.SkMatrix.mapPoints(B,D);B=D[0];var H=D[1],O=D[2];D=D[3];this.mk();return this.Vj=a.SkShader.MakeLinearGradient([B,H],[O,D],this.ck,this.Yj,a.TileMode.Clamp)}}function t(I,l,r,x,B,D){if(p([l,r,x,B,D])){if(0>D)throw"radii cannot be negative";I.isEmpty()&&I.moveTo(l,r);I.arcToTangent(l,r,x,B,D)}}function w(I){if(!I.isEmpty()){var l=I.getBounds();(l.fBottom-l.fTop||l.fRight-l.fLeft)&&I.close()}}function C(I,l,r,x,B,D,H){H=(H-D)/Math.PI*180;D=D/Math.PI*180;l=a.LTRBRect(l-
x,r-B,l+x,r+B);1E-5>Math.abs(Math.abs(H)-360)?(r=H/2,I.arcToOval(l,D,r,!1),I.arcToOval(l,D+r,r,!1)):I.arcToOval(l,D,H,!1)}function G(I,l,r,x,B,D,H,O,aa){if(p([l,r,x,B,D,H,O])){if(0>x||0>B)throw"radii cannot be negative";var ia=2*Math.PI,ra=H%ia;0>ra&&(ra+=ia);var sa=ra-H;H=ra;O+=sa;!aa&&O-H>=ia?O=H+ia:aa&&H-O>=ia?O=H-ia:!aa&&H>O?O=H+(ia-(H-O)%ia):aa&&H<O&&(O=H-(ia-(O-H)%ia));D?(aa=a.SkMatrix.rotated(D,l,r),D=a.SkMatrix.rotated(-D,l,r),I.transform(D),C(I,l,r,x,B,H,O),I.transform(aa)):C(I,l,r,x,B,H,
O)}}function S(I,l,r){p([l,r])&&(I.isEmpty()&&I.moveTo(l,r),I.lineTo(l,r))}function U(I){this.Tj=null;"string"===typeof I?this.Tj=a.MakePathFromSVGString(I):I&&I.il?this.Tj=I.Tj.copy():this.Tj=new a.SkPath;this.il=function(){return this.Tj};this.addPath=function(l,r){r||(r={a:1,c:0,e:0,b:0,d:1,f:0});this.Tj.addPath(l.Tj,[r.a,r.c,r.e,r.b,r.d,r.f])};this.arc=function(l,r,x,B,D,H){G(this.Tj,l,r,x,x,0,B,D,H)};this.arcTo=function(l,r,x,B,D){t(this.Tj,l,r,x,B,D)};this.bezierCurveTo=function(l,r,x,B,D,H){var O=
this.Tj;p([l,r,x,B,D,H])&&(O.isEmpty()&&O.moveTo(l,r),O.cubicTo(l,r,x,B,D,H))};this.closePath=function(){w(this.Tj)};this.ellipse=function(l,r,x,B,D,H,O,aa){G(this.Tj,l,r,x,B,D,H,O,aa)};this.lineTo=function(l,r){S(this.Tj,l,r)};this.moveTo=function(l,r){var x=this.Tj;p([l,r])&&x.moveTo(l,r)};this.quadraticCurveTo=function(l,r,x,B){var D=this.Tj;p([l,r,x,B])&&(D.isEmpty()&&D.moveTo(l,r),D.quadTo(l,r,x,B))};this.rect=function(l,r,x,B){var D=this.Tj;p([l,r,x,B])&&D.addRect(l,r,l+x,r+B)}}function V(I,
l){this.Vj=null;this.Gl=I;this._transform=a.SkMatrix.identity();""===l&&(l="repeat");switch(l){case "repeat-x":this.Fk=a.TileMode.Repeat;this.Gk=a.TileMode.Decal;break;case "repeat-y":this.Fk=a.TileMode.Decal;this.Gk=a.TileMode.Repeat;break;case "repeat":this.Gk=this.Fk=a.TileMode.Repeat;break;case "no-repeat":this.Gk=this.Fk=a.TileMode.Decal;break;default:throw"invalid repetition mode "+l;}this.setTransform=function(r){r=[r.a,r.c,r.e,r.b,r.d,r.f,0,0,1];p(r)&&(this._transform=r)};this.yk=function(){var r=
new V;r.Fk=this.Fk;r.Gk=this.Gk;return r};this.mk=function(){this.Vj&&(this.Vj.delete(),this.Vj=null)};this.zk=function(){this.mk();return this.Vj=this.Gl.makeShader(this.Fk,this.Gk,this._transform)}}function Y(I,l,r,x,B,D){this.Vj=null;this.ck=[];this.Yj=[];this.addColorStop=function(H,O){if(0>H||1<H||!isFinite(H))throw"offset must be between 0 and 1 inclusively";O=K(O);var aa=this.Yj.indexOf(H);if(-1!==aa)this.ck[aa]=O;else{for(aa=0;aa<this.Yj.length&&!(this.Yj[aa]>H);aa++);this.Yj.splice(aa,0,
H);this.ck.splice(aa,0,O)}};this.yk=function(){var H=new Y(I,l,r,x,B,D);H.ck=this.ck.slice();H.Yj=this.Yj.slice();return H};this.mk=function(){this.Vj&&(this.Vj.delete(),this.Vj=null)};this.zk=function(H){var O=[I,l,x,B];a.SkMatrix.mapPoints(H,O);var aa=O[0],ia=O[1],ra=O[2];O=O[3];var sa=(Math.abs(H[0])+Math.abs(H[4]))/2;H=r*sa;sa*=D;this.mk();return this.Vj=a.SkShader.MakeTwoPointConicalGradient([aa,ia],H,[ra,O],sa,this.ck,this.Yj,a.TileMode.Clamp)}}a._testing={};var ka={aliceblue:Float32Array.of(.941,
.973,1,1),antiquewhite:Float32Array.of(.98,.922,.843,1),aqua:Float32Array.of(0,1,1,1),aquamarine:Float32Array.of(.498,1,.831,1),azure:Float32Array.of(.941,1,1,1),beige:Float32Array.of(.961,.961,.863,1),bisque:Float32Array.of(1,.894,.769,1),black:Float32Array.of(0,0,0,1),blanchedalmond:Float32Array.of(1,.922,.804,1),blue:Float32Array.of(0,0,1,1),blueviolet:Float32Array.of(.541,.169,.886,1),brown:Float32Array.of(.647,.165,.165,1),burlywood:Float32Array.of(.871,.722,.529,1),cadetblue:Float32Array.of(.373,
.62,.627,1),chartreuse:Float32Array.of(.498,1,0,1),chocolate:Float32Array.of(.824,.412,.118,1),coral:Float32Array.of(1,.498,.314,1),cornflowerblue:Float32Array.of(.392,.584,.929,1),cornsilk:Float32Array.of(1,.973,.863,1),crimson:Float32Array.of(.863,.078,.235,1),cyan:Float32Array.of(0,1,1,1),darkblue:Float32Array.of(0,0,.545,1),darkcyan:Float32Array.of(0,.545,.545,1),darkgoldenrod:Float32Array.of(.722,.525,.043,1),darkgray:Float32Array.of(.663,.663,.663,1),darkgreen:Float32Array.of(0,.392,0,1),da