canvaskit-wasm
Version:
A WASM version of Skia's Canvas API
109 lines (106 loc) • 123 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 aa,ca;f.ready=new Promise(function(a,b){aa=a;ca=b});
(function(a){a.Hf=a.Hf||[];a.Hf.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.ef=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},g=b*c*4,l=a._malloc(g);if(d=this._getRasterDirectSurface(d,
l,4*b))d.ef=null,d.$g=b,d.Wg=c,d.Zg=g,d.zg=l,d.getCanvas().clear(a.TRANSPARENT);return d};a.SkSurface.prototype.flush=function(b){this._flush();if(this.ef){var c=new Uint8ClampedArray(a.HEAPU8.buffer,this.zg,this.Zg);c=new ImageData(c,this.$g,this.Wg);b?this.ef.getContext("2d").putImageData(c,0,0,b[0],b[1],b[2]-b[0],b[3]-b[1]):this.ef.getContext("2d").putImageData(c,0,0)}};a.SkSurface.prototype.dispose=function(){this.zg&&a._free(this.zg);this.delete()};a.currentContext=a.currentContext||function(){};
a.setCurrentContext=a.setCurrentContext||function(){}})})(f);
(function(a){a.Hf=a.Hf||[];a.Hf.push(function(){function b(c,d,g){return c&&c.hasOwnProperty(d)?c[d]:g}a.GetWebGLContext=function(c,d){if(!c)throw"null canvas passed into makeWebGLContext";var g={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)};g.majorVersion=d&&d.majorVersion?d.majorVersion:"undefined"!==typeof WebGL2RenderingContext?2:1;if(g.explicitSwapControl)throw"explicitSwapControl is not supported";if(c=1<g.majorVersion?c.getContext("webgl2",g):c.getContext("webgl",g)){d=da(ea);var l={mh:d,attributes:g,version:g.majorVersion,Ng:c};c.canvas&&(c.canvas.Ug=
l);ea[d]=l;("undefined"===typeof g.eh||g.eh)&&ia(l);g=d}else g=0;if(!g)return 0;la(g);return g};a.MakeWebGLCanvasSurface=function(c,d,g){d=d||null;var l=c,p="undefined"!==typeof OffscreenCanvas&&l instanceof OffscreenCanvas;if(!("undefined"!==typeof HTMLCanvasElement&&l instanceof HTMLCanvasElement||p||(l=document.getElementById(c),l)))throw"Canvas with id "+c+" was not found";c=this.GetWebGLContext(l,g);g=l.Ug.version;if(!c||0>c)throw"failed to create webgl context: err "+c;p=this.MakeGrContext(c);
d=this.MakeOnScreenGLSurface(p,l.width,l.height,d);if(!d)return d=l.cloneNode(!0),l.parentNode.replaceChild(d,l),d.classList.add("ck-replaced"),a.MakeSWCanvasSurface(d);d.Gf=c;d.grContext=p;d.openGLversion=g;return d};a.MakeCanvasSurface=a.MakeWebGLCanvasSurface})})(f);
(function(a){function b(m){return Math.round(Math.max(0,Math.min(m||0,255)))}function c(m){return m?m.constructor===Float32Array&&4===m.length:!1}function d(m){return(b(255*m[3])<<24|b(255*m[0])<<16|b(255*m[1])<<8|b(255*m[2])<<0)>>>0}function g(m){if(m instanceof Float32Array){for(var v=Math.floor(m.length/4),I=new Uint32Array(v),J=0;J<v;J++)I[J]=d(m.slice(4*J,4*(J+1)));return I}if(m instanceof Uint32Array)return m;if(m instanceof Array&&m[0]instanceof Float32Array)return m.map(d)}function l(m){if(void 0===
m)return 1;var v=parseFloat(m);return m&&-1!==m.indexOf("%")?v/100:v}function p(m,v,I){if(!m||!m.length)return 0;if(m._ck)return m.byteOffset;var J=a[v].BYTES_PER_ELEMENT;I||(I=a._malloc(m.length*J));a[v].set(m,I/J);return I}function r(m,v,I){if(!m||!m.length)return 0;var J=a[v].BYTES_PER_ELEMENT;I||(I=a._malloc(m.length*m[0].length*J));v=a[v];var ba=0;J=I/J;for(var ua=0;ua<m.length;ua++)for(var e=0;e<m[0].length;e++)v[J+ba]=m[ua][e],ba++;return I}function y(m){var v={yf:0,count:m.length,jg:a.ColorType.RGBA_F32};
if(m instanceof Float32Array)v.yf=p(m,"HEAPF32"),v.count=m.length/4;else if(m instanceof Uint32Array)v.yf=p(m,"HEAPU32"),v.jg=a.ColorType.RGBA_8888;else if(m instanceof Array&&m[0]instanceof Float32Array)v.yf=r(m,"HEAPF32");else throw"Invalid argument to copyFlexibleColorArray, Not a color array "+typeof m;return v}function B(m){if(!m)return 0;if(m.length){if(6!==m.length&&9!==m.length)throw"invalid matrix size";var v=p(m,"HEAPF32",Ca);6===m.length&&a.HEAPF32.set(zb,6+v/4);return v}v=bc.toTypedArray();
v[0]=m.m11;v[1]=m.m21;v[2]=m.m41;v[3]=m.m12;v[4]=m.m22;v[5]=m.m42;v[6]=m.m14;v[7]=m.m24;v[8]=m.m44;return Ca}function F(m){if(!m)return 0;var v=cc.toTypedArray();if(m.length){if(16!==m.length&&6!==m.length&&9!==m.length)throw"invalid matrix size";if(16===m.length)return p(m,"HEAPF32",Da);v.fill(0);v[0]=m[0];v[1]=m[1];v[3]=m[2];v[4]=m[3];v[5]=m[4];v[7]=m[5];v[12]=m[6];v[13]=m[7];v[15]=m[8];6===m.length&&(v[12]=0,v[13]=0,v[15]=1);return Da}v[0]=m.m11;v[1]=m.m21;v[2]=m.m31;v[3]=m.m41;v[4]=m.m12;v[5]=
m.m22;v[6]=m.m32;v[7]=m.m42;v[8]=m.m13;v[9]=m.m23;v[10]=m.m33;v[11]=m.m43;v[12]=m.m14;v[13]=m.m24;v[14]=m.m34;v[15]=m.m44;return Da}function L(m){for(var v=Array(16),I=0;16>I;I++)v[I]=a.HEAPF32[m/4+I];return v}function N(m,v){return p(m,"HEAPF32",v||gb)}function x(m,v,I,J){var ba=dc.toTypedArray();ba[0]=m;ba[1]=v;ba[2]=I;ba[3]=J;return gb}function M(m){for(var v=new Float32Array(4),I=0;4>I;I++)v[I]=a.HEAPF32[m/4+I];return v}function S(m,v){return p(m,"HEAPF32",v||Ta)}function Z(m,v){return p(m,"HEAPF32",
v||ec)}function T(m,v){v&&!v._ck&&a._free(m)}a.Color=function(m,v,I,J){void 0===J&&(J=1);return a.Color4f(b(m)/255,b(v)/255,b(I)/255,J)};a.ColorAsInt=function(m,v,I,J){void 0===J&&(J=255);return(b(J)<<24|b(m)<<16|b(v)<<8|b(I)<<0&268435455)>>>0};a.Color4f=function(m,v,I,J){void 0===J&&(J=1);return Float32Array.of(m,v,I,J)};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(m){return[Math.floor(255*m[0]),Math.floor(255*m[1]),Math.floor(255*m[2]),m[3]]};a.parseColorString=function(m,v){m=m.toLowerCase();if(m.startsWith("#")){v=255;switch(m.length){case 9:v=parseInt(m.slice(7,9),16);case 7:var I=parseInt(m.slice(1,3),16);var J=parseInt(m.slice(3,5),16);var ba=parseInt(m.slice(5,7),16);break;case 5:v=17*parseInt(m.slice(4,5),16);case 4:I=17*parseInt(m.slice(1,2),16),J=17*parseInt(m.slice(2,3),16),ba=17*parseInt(m.slice(3,4),16)}return a.Color(I,
J,ba,v/255)}return m.startsWith("rgba")?(m=m.slice(5,-1),m=m.split(","),a.Color(+m[0],+m[1],+m[2],l(m[3]))):m.startsWith("rgb")?(m=m.slice(4,-1),m=m.split(","),a.Color(+m[0],+m[1],+m[2],l(m[3]))):m.startsWith("gray(")||m.startsWith("hsl")||!v||(m=v[m],void 0===m)?a.BLACK:m};a.multiplyByAlpha=function(m,v){m=m.slice();m[3]=Math.max(0,Math.min(m[3]*v,1));return m};var ja=!(new Function("try {return this===window;}catch(e){ return false;}"))(),zb=Float32Array.of(0,0,1),Ca=0,bc,Da=0,cc,gb=0,dc,hb,Ta=
0,Jc,Kc=0,Lc,fc=0,Mc,ec=0,Nc,Oc=0,hc={};a.Mf=function(){this.Ff=[];this.mf=null;Object.defineProperty(this,"length",{enumerable:!0,get:function(){return this.Ff.length/4}})};a.Mf.prototype.push=function(m,v,I,J){this.mf||this.Ff.push(m,v,I,J)};a.Mf.prototype.set=function(m,v,I,J,ba){0>m||m>=this.Ff.length/4||(m*=4,this.mf?(m=this.mf/4+m,a.HEAPF32[m]=v,a.HEAPF32[m+1]=I,a.HEAPF32[m+2]=J,a.HEAPF32[m+3]=ba):(this.Ff[m]=v,this.Ff[m+1]=I,this.Ff[m+2]=J,this.Ff[m+3]=ba))};a.Mf.prototype.build=function(){return this.mf?
this.mf:this.mf=p(this.Ff,"HEAPF32")};a.Mf.prototype.delete=function(){this.mf&&(a._free(this.mf),this.mf=null)};a.cg=function(){this.ig=[];this.mf=null;Object.defineProperty(this,"length",{enumerable:!0,get:function(){return this.ig.length}})};a.cg.prototype.push=function(m){this.mf||this.ig.push(m)};a.cg.prototype.set=function(m,v){0>m||m>=this.ig.length||(m*=4,this.mf?a.HEAPU32[this.mf/4+m]=v:this.ig[m]=v)};a.cg.prototype.build=function(){return this.mf?this.mf:this.mf=p(this.ig,"HEAPU32")};a.cg.prototype.delete=
function(){this.mf&&(a._free(this.mf),this.mf=null)};a.SkRectBuilder=a.Mf;a.RSXFormBuilder=a.Mf;a.SkColorBuilder=a.cg;a.Malloc=function(m,v){var I=a._malloc(v*m.BYTES_PER_ELEMENT);return{_ck:!0,length:v,byteOffset:I,Lf:null,subarray:function(J,ba){J=this.toTypedArray().subarray(J,ba);J._ck=!0;return J},toTypedArray:function(){if(this.Lf&&this.Lf.length)return this.Lf;this.Lf=new m(a.HEAPU8.buffer,I,v);this.Lf._ck=!0;return this.Lf}}};a.Free=function(m){a._free(m.byteOffset);m.byteOffset=0;m.toTypedArray=
null;m.Lf=null};a.onRuntimeInitialized=function(){function m(e,k,q,u,A){for(var D=0;D<e.length;D++)k[D*q+(D*A+u+q)%q]=e[D];return k}function v(e){for(var k=e*e,q=Array(k);k--;)q[k]=0==k%(e+1)?1:0;return q}function I(){for(var e=0,k=0;k<arguments.length-1;k+=2)e+=arguments[k]*arguments[k+1];return e}function J(e,k,q){for(var u=Array(e.length),A=0;A<q;A++)for(var D=0;D<q;D++){for(var O=0,Q=0;Q<q;Q++)O+=e[q*A+Q]*k[q*Q+D];u[A*q+D]=O}return u}function ba(e,k){for(var q=J(k[0],k[1],e),u=2;u<k.length;)q=
J(q,k[u],e),u++;return q}dc=a.Malloc(Float32Array,4);gb=dc.byteOffset;cc=a.Malloc(Float32Array,16);Da=cc.byteOffset;bc=a.Malloc(Float32Array,9);Ca=bc.byteOffset;Mc=a.Malloc(Float32Array,12);ec=Mc.byteOffset;Nc=a.Malloc(Float32Array,12);Oc=Nc.byteOffset;hb=a.Malloc(Float32Array,4);Ta=hb.byteOffset;Jc=a.Malloc(Float32Array,4);Kc=Jc.byteOffset;Lc=a.Malloc(Int32Array,4);fc=Lc.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 v(3)};a.SkMatrix.invert=function(e){var k=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 k?[(e[4]*e[8]-e[5]*e[7])/k,(e[2]*e[7]-e[1]*e[8])/k,(e[1]*e[5]-e[2]*e[4])/k,(e[5]*e[6]-e[3]*e[8])/k,(e[0]*e[8]-e[2]*e[6])/k,(e[2]*e[3]-e[0]*e[5])/k,(e[3]*e[7]-e[4]*e[6])/k,(e[1]*e[6]-e[0]*e[7])/k,(e[0]*e[4]-e[1]*e[3])/k]:null};a.SkMatrix.mapPoints=function(e,k){for(var q=0;q<k.length;q+=
2){var u=k[q],A=k[q+1],D=e[6]*u+e[7]*A+e[8],O=e[3]*u+e[4]*A+e[5];k[q]=(e[0]*u+e[1]*A+e[2])/D;k[q+1]=O/D}return k};a.SkMatrix.multiply=function(){return ba(3,arguments)};a.SkMatrix.rotated=function(e,k,q){k=k||0;q=q||0;var u=Math.sin(e);e=Math.cos(e);return[e,-u,I(u,q,1-e,k),u,e,I(-u,k,1-e,q),0,0,1]};a.SkMatrix.scaled=function(e,k,q,u){q=q||0;u=u||0;var A=m([e,k],v(3),3,0,1);return m([q-e*q,u-k*u],A,3,2,0)};a.SkMatrix.skewed=function(e,k,q,u){q=q||0;u=u||0;var A=m([e,k],v(3),3,1,-1);return m([-e*q,
-k*u],A,3,2,0)};a.SkMatrix.translated=function(e,k){return m(arguments,v(3),3,2,0)};a.SkVector={};a.SkVector.dot=function(e,k){return e.map(function(q,u){return q*k[u]}).reduce(function(q,u){return q+u})};a.SkVector.lengthSquared=function(e){return a.SkVector.dot(e,e)};a.SkVector.length=function(e){return Math.sqrt(a.SkVector.lengthSquared(e))};a.SkVector.mulScalar=function(e,k){return e.map(function(q){return q*k})};a.SkVector.add=function(e,k){return e.map(function(q,u){return q+k[u]})};a.SkVector.sub=
function(e,k){return e.map(function(q,u){return q-k[u]})};a.SkVector.dist=function(e,k){return a.SkVector.length(a.SkVector.sub(e,k))};a.SkVector.normalize=function(e){return a.SkVector.mulScalar(e,1/a.SkVector.length(e))};a.SkVector.cross=function(e,k){return[e[1]*k[2]-e[2]*k[1],e[2]*k[0]-e[0]*k[2],e[0]*k[1]-e[1]*k[0]]};a.SkM44={};a.SkM44.identity=function(){return v(4)};a.SkM44.translated=function(e){return m(e,v(4),4,3,0)};a.SkM44.scaled=function(e){return m(e,v(4),4,0,1)};a.SkM44.rotated=function(e,
k){return a.SkM44.rotatedUnitSinCos(a.SkVector.normalize(e),Math.sin(k),Math.cos(k))};a.SkM44.rotatedUnitSinCos=function(e,k,q){var u=e[0],A=e[1];e=e[2];var D=1-q;return[D*u*u+q,D*u*A-k*e,D*u*e+k*A,0,D*u*A+k*e,D*A*A+q,D*A*e-k*u,0,D*u*e-k*A,D*A*e+k*u,D*e*e+q,0,0,0,0,1]};a.SkM44.lookat=function(e,k,q){k=a.SkVector.normalize(a.SkVector.sub(k,e));q=a.SkVector.normalize(q);q=a.SkVector.normalize(a.SkVector.cross(k,q));var u=a.SkM44.identity();m(q,u,4,0,0);m(a.SkVector.cross(q,k),u,4,1,0);m(a.SkVector.mulScalar(k,
-1),u,4,2,0);m(e,u,4,3,0);e=a.SkM44.invert(u);return null===e?a.SkM44.identity():e};a.SkM44.perspective=function(e,k,q){var u=1/(k-e);q/=2;q=Math.cos(q)/Math.sin(q);return[q,0,0,0,0,q,0,0,0,0,(k+e)*u,2*k*e*u,0,0,-1,1]};a.SkM44.rc=function(e,k,q){return e[4*k+q]};a.SkM44.multiply=function(){return ba(4,arguments)};a.SkM44.invert=function(e){var k=e[0],q=e[4],u=e[8],A=e[12],D=e[1],O=e[5],Q=e[9],R=e[13],U=e[2],ha=e[6],ka=e[10],oa=e[14],G=e[3],h=e[7],n=e[11];e=e[15];var w=k*O-q*D,z=k*Q-u*D,C=k*R-A*D,
E=q*Q-u*O,K=q*R-A*O,X=u*R-A*Q,fa=U*h-ha*G,pa=U*n-ka*G,qa=U*e-oa*G,Ua=ha*n-ka*h,Va=ha*e-oa*h,Wa=ka*e-oa*n,Pc=w*Wa-z*Va+C*Ua+E*qa-K*pa+X*fa,ra=1/Pc;if(0===Pc||Infinity===ra)return null;w*=ra;z*=ra;C*=ra;E*=ra;K*=ra;X*=ra;fa*=ra;pa*=ra;qa*=ra;Ua*=ra;Va*=ra;Wa*=ra;k=[O*Wa-Q*Va+R*Ua,Q*qa-D*Wa-R*pa,D*Va-O*qa+R*fa,O*pa-D*Ua-Q*fa,u*Va-q*Wa-A*Ua,k*Wa-u*qa+A*pa,q*qa-k*Va-A*fa,k*Ua-q*pa+u*fa,h*X-n*K+e*E,n*C-G*X-e*z,G*K-h*C+e*w,h*z-G*E-n*w,ka*K-ha*X-oa*E,U*X-ka*C+oa*z,ha*C-U*K-oa*w,U*E-ha*z+ka*w];return k.every(function(Qc){return Infinity!==
Qc&&-Infinity!==Qc})?k:null};a.SkM44.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.SkM44.mustInvert=function(e){e=a.SkM44.invert(e);if(null===e)throw"Matrix not invertible";return e};a.SkM44.setupCamera=function(e,k,q){var u=a.SkM44.lookat(q.eye,q.coa,q.up);q=a.SkM44.perspective(q.near,q.far,q.angle);k=[(e[2]-e[0])/2,(e[3]-e[1])/2,k];e=a.SkM44.multiply(a.SkM44.translated([(e[0]+e[2])/2,(e[1]+e[3])/2,0]),a.SkM44.scaled(k));return a.SkM44.multiply(e,
q,u,a.SkM44.mustInvert(e))};a.SkColorMatrix={};a.SkColorMatrix.identity=function(){var e=new Float32Array(20);e[0]=1;e[6]=1;e[12]=1;e[18]=1;return e};a.SkColorMatrix.scaled=function(e,k,q,u){var A=new Float32Array(20);A[0]=e;A[6]=k;A[12]=q;A[18]=u;return A};var ua=[[6,7,11,12],[0,10,2,12],[0,1,5,6]];a.SkColorMatrix.rotated=function(e,k,q){var u=a.SkColorMatrix.identity();e=ua[e];u[e[0]]=q;u[e[1]]=k;u[e[2]]=-k;u[e[3]]=q;return u};a.SkColorMatrix.postTranslate=function(e,k,q,u,A){e[4]+=k;e[9]+=q;e[14]+=
u;e[19]+=A;return e};a.SkColorMatrix.concat=function(e,k){for(var q=new Float32Array(20),u=0,A=0;20>A;A+=5){for(var D=0;4>D;D++)q[u++]=e[A]*k[D]+e[A+1]*k[D+5]+e[A+2]*k[D+10]+e[A+3]*k[D+15];q[u++]=e[A]*k[4]+e[A+1]*k[9]+e[A+2]*k[14]+e[A+3]*k[19]+e[A+4]}return q};a.SkPath.MakeFromCmds=function(e){for(var k=0,q=0;q<e.length;q++)k+=e[q].length;if(hc[k])var u=hc[k];else u=new Float32Array(k),hc[k]=u;var A=0;for(q=0;q<e.length;q++)for(var D=0;D<e[q].length;D++)u[A]=e[q][D],A++;e=[p(u,"HEAPF32"),k];k=a.SkPath._MakeFromCmds(e[0],
e[1]);a._free(e[0]);return k};a.MakePathFromCmds=a.SkPath.MakeFromCmds;a.SkPath.MakeFromVerbsPointsWeights=function(e,k,q){var u=p(e,"HEAPU8"),A=p(k,"HEAPF32"),D=p(q,"HEAPF32"),O=a.SkPath._MakeFromVerbsPointsWeights(u,e.length,A,k.length,D,q&&q.length||0);T(u,e);T(A,k);T(D,q);return O};a.SkPath.prototype.addArc=function(e,k,q){e=S(e);this._addArc(e,k,q);return this};a.SkPath.prototype.addOval=function(e,k,q){void 0===q&&(q=1);e=S(e);this._addOval(e,!!k,q);return this};a.SkPath.prototype.addPath=function(){var e=
Array.prototype.slice.call(arguments),k=e[0],q=!1;"boolean"===typeof e[e.length-1]&&(q=e.pop());if(1===e.length)this._addPath(k,1,0,0,0,1,0,0,0,1,q);else if(2===e.length)e=e[1],this._addPath(k,e[0],e[1],e[2],e[3],e[4],e[5],e[6]||0,e[7]||0,e[8]||1,q);else if(7===e.length||10===e.length)this._addPath(k,e[1],e[2],e[3],e[4],e[5],e[6],e[7]||0,e[8]||0,e[9]||1,q);else return null;return this};a.SkPath.prototype.addPoly=function(e,k){if(e._ck){var q=e.byteOffset;var u=e.length/2}else q=r(e,"HEAPF32"),u=e.length;
this._addPoly(q,u,k);T(q,e);return this};a.SkPath.prototype.addRect=function(e,k){e=S(e);this._addRect(e,!!k);return this};a.SkPath.prototype.addRRect=function(e,k){e=Z(e);this._addRRect(e,!!k);return this};a.SkPath.prototype.addVerbsPointsWeights=function(e,k,q){var u=p(e,"HEAPU8"),A=p(k,"HEAPF32"),D=p(q,"HEAPF32");this._addVerbsPointsWeights(u,e.length,A,k.length,D,q&&q.length||0);T(u,e);T(A,k);T(D,q)};a.SkPath.prototype.arc=function(e,k,q,u,A,D){e=a.LTRBRect(e-q,k-q,e+q,k+q);A=(A-u)/Math.PI*180-
360*!!D;D=new a.SkPath;D.addArc(e,u/Math.PI*180,A);this.addPath(D,!0);D.delete();return this};a.SkPath.prototype.arcToOval=function(e,k,q,u){e=S(e);this._arcToOval(e,k,q,u);return this};a.SkPath.prototype.arcToRotated=function(e,k,q,u,A,D,O){this._arcToRotated(e,k,q,!!u,!!A,D,O);return this};a.SkPath.prototype.arcToTangent=function(e,k,q,u,A){this._arcToTangent(e,k,q,u,A);return this};a.SkPath.prototype.close=function(){this._close();return this};a.SkPath.prototype.conicTo=function(e,k,q,u,A){this._conicTo(e,
k,q,u,A);return this};a.SkPath.prototype.computeTightBounds=function(e){this._computeTightBounds(Ta);var k=hb.toTypedArray();return e?(e.set(k),e):k.slice()};a.SkPath.prototype.cubicTo=function(e,k,q,u,A,D){this._cubicTo(e,k,q,u,A,D);return this};a.SkPath.prototype.dash=function(e,k,q){return this._dash(e,k,q)?this:null};a.SkPath.prototype.getBounds=function(e){this._getBounds(Ta);var k=hb.toTypedArray();return e?(e.set(k),e):k.slice()};a.SkPath.prototype.lineTo=function(e,k){this._lineTo(e,k);return this};
a.SkPath.prototype.moveTo=function(e,k){this._moveTo(e,k);return this};a.SkPath.prototype.offset=function(e,k){this._transform(1,0,e,0,1,k,0,0,1);return this};a.SkPath.prototype.quadTo=function(e,k,q,u){this._quadTo(e,k,q,u);return this};a.SkPath.prototype.rArcTo=function(e,k,q,u,A,D,O){this._rArcTo(e,k,q,u,A,D,O);return this};a.SkPath.prototype.rConicTo=function(e,k,q,u,A){this._rConicTo(e,k,q,u,A);return this};a.SkPath.prototype.rCubicTo=function(e,k,q,u,A,D){this._rCubicTo(e,k,q,u,A,D);return this};
a.SkPath.prototype.rLineTo=function(e,k){this._rLineTo(e,k);return this};a.SkPath.prototype.rMoveTo=function(e,k){this._rMoveTo(e,k);return this};a.SkPath.prototype.rQuadTo=function(e,k,q,u){this._rQuadTo(e,k,q,u);return this};a.SkPath.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.SkPath.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.SkPath.prototype.trim=function(e,k,q){return this._trim(e,k,!!q)?this:null};a.SkImage.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.SkImage.prototype.makeShader=function(e,k,q){q=B(q);return this._makeShader(e,k,q)};a.SkImage.prototype.readPixels=function(e,k,q){switch(e.colorType){case a.ColorType.RGBA_8888:var u=4*e.width;break;case a.ColorType.RGBA_F32:u=16*e.width;break;default:return}var A=u*e.height,D=a._malloc(A);if(!this._readPixels(e,D,u,k,q))return null;k=null;switch(e.colorType){case a.ColorType.RGBA_8888:k=
(new Uint8Array(a.HEAPU8.buffer,D,A)).slice();break;case a.ColorType.RGBA_F32:k=(new Float32Array(a.HEAPU8.buffer,D,A)).slice()}a._free(D);return k};a.SkCanvas.prototype.clear=function(e){e=N(e);this._clear(e)};a.SkCanvas.prototype.clipRRect=function(e,k,q){e=Z(e);this._clipRRect(e,k,q)};a.SkCanvas.prototype.clipRect=function(e,k,q){e=S(e);this._clipRect(e,k,q)};a.SkCanvas.prototype.concat=function(e){e=F(e);this._concat(e)};a.SkCanvas.prototype.concat44=a.SkCanvas.prototype.concat;a.SkCanvas.prototype.drawArc=
function(e,k,q,u,A){e=S(e);this._drawArc(e,k,q,u,A)};a.SkCanvas.prototype.drawAtlas=function(e,k,q,u,A,D){if(e&&u&&k&&q&&k.length===q.length){A||(A=a.BlendMode.SrcOver);var O;k.build?O=k.build():O=p(k,"HEAPF32");if(q.build){var Q=q.build();var R=q.length}else Q=p(q,"HEAPF32"),R=q.length/4;var U=0;D&&(D.build?U=D.build():U=p(g(D),"HEAPU32"));this._drawAtlas(e,Q,O,U,R,A,u);O&&!k.build&&T(O,k);Q&&!q.build&&T(Q,q);U&&!D.build&&T(U,D)}};a.SkCanvas.prototype.drawColor=function(e,k){e=N(e);void 0!==k?this._drawColor(e,
k):this._drawColor(e)};a.SkCanvas.prototype.drawColorComponents=function(e,k,q,u,A){e=x(e,k,q,u);void 0!==A?this._drawColor(e,A):this._drawColor(e)};a.SkCanvas.prototype.drawDRRect=function(e,k,q){e=Z(e,ec);k=Z(k,Oc);this._drawDRRect(e,k,q)};a.SkCanvas.prototype.drawImageNine=function(e,k,q,u){k=p(k,"HEAP32",fc);q=S(q);this._drawImageNine(e,k,q,u)};a.SkCanvas.prototype.drawImageRect=function(e,k,q,u,A){k=S(k,Ta);q=S(q,Kc);this._drawImageRect(e,k,q,u,!!A)};a.SkCanvas.prototype.drawOval=function(e,
k){e=S(e);this._drawOval(e,k)};a.SkCanvas.prototype.drawPoints=function(e,k,q){if(k._ck){var u=k.byteOffset;var A=k.length/2}else u=r(k,"HEAPF32"),A=k.length;this._drawPoints(e,u,A,q);T(u,k)};a.SkCanvas.prototype.drawRRect=function(e,k){e=Z(e);this._drawRRect(e,k)};a.SkCanvas.prototype.drawRect=function(e,k){e=S(e);this._drawRect(e,k)};a.SkCanvas.prototype.drawShadow=function(e,k,q,u,A,D,O){var Q=p(A,"HEAPF32"),R=p(D,"HEAPF32");this._drawShadow(e,k,q,u,Q,R,O);T(Q,A);T(R,D)};a.SkCanvas.prototype.getLocalToDevice=
function(){this._getLocalToDevice(Da);return L(Da)};a.SkCanvas.prototype.findMarkedCTM=function(e){return this._findMarkedCTM(e,Da)?L(Da):null};a.SkCanvas.prototype.getTotalMatrix=function(){this._getTotalMatrix(Ca);for(var e=Array(9),k=0;9>k;k++)e[k]=a.HEAPF32[Ca/4+k];return e};a.SkCanvas.prototype.readPixels=function(e,k,q,u,A,D,O,Q){A=A||a.AlphaType.Unpremul;D=D||a.ColorType.RGBA_8888;O=O||a.SkColorSpace.SRGB;var R=4;D===a.ColorType.RGBA_F16&&(R=8);Q=Q||R*q;var U=u*Q;R=a._malloc(U);if(!this._readPixels({width:q,
height:u,colorType:D,alphaType:A,colorSpace:O},R,Q,e,k))return a._free(R),null;e=(new Uint8Array(a.HEAPU8.buffer,R,U)).slice();a._free(R);return e};a.SkCanvas.prototype.saveLayer=function(e,k,q,u){k=S(k);return this._saveLayer(e||null,k,q||null,u||0)};a.SkCanvas.prototype.writePixels=function(e,k,q,u,A,D,O,Q){if(e.byteLength%(k*q))throw"pixels length must be a multiple of the srcWidth * srcHeight";var R=e.byteLength/(k*q);D=D||a.AlphaType.Unpremul;O=O||a.ColorType.RGBA_8888;Q=Q||a.SkColorSpace.SRGB;
var U=R*k;R=p(e,"HEAPU8");k=this._writePixels({width:k,height:q,colorType:O,alphaType:D,colorSpace:Q},R,U,u,A);T(R,e);return k};a.SkColorFilter.MakeBlend=function(e,k){e=N(e);return a.SkColorFilter._MakeBlend(e,k)};a.SkColorFilter.MakeMatrix=function(e){if(!e||20!==e.length)throw"invalid color matrix";var k=p(e,"HEAPF32"),q=a.SkColorFilter._makeMatrix(k);T(k,e);return q};a.SkImageFilter.MakeMatrixTransform=function(e,k,q){e=B(e);return a.SkImageFilter._MakeMatrixTransform(e,k,q)};a.SkPaint.prototype.getColor=
function(){this._getColor(gb);return M(gb)};a.SkPaint.prototype.setColor=function(e,k){k=k||null;e=N(e);this._setColor(e,k)};a.SkPaint.prototype.setColorComponents=function(e,k,q,u,A){A=A||null;e=x(e,k,q,u);this._setColor(e,A)};a.SkPictureRecorder.prototype.beginRecording=function(e){e=S(e);return this._beginRecording(e)};a.SkSurface.prototype.captureFrameAsSkPicture=function(e){var k=new a.SkPictureRecorder,q=k.beginRecording(a.LTRBRect(0,0,this.width(),this.height()));e(q);e=k.finishRecordingAsPicture();
k.delete();return e};a.SkSurface.prototype.makeImageSnapshot=function(e){e=p(e,"HEAP32",fc);return this._makeImageSnapshot(e)};a.SkSurface.prototype.requestAnimationFrame=function(e,k){this.dg||(this.dg=this.getCanvas());requestAnimationFrame(function(){void 0!==this.Gf&&a.setCurrentContext(this.Gf);e(this.dg);this.flush(k)}.bind(this))};a.SkSurface.prototype.drawOnce=function(e,k){this.dg||(this.dg=this.getCanvas());requestAnimationFrame(function(){void 0!==this.Gf&&a.setCurrentContext(this.Gf);
e(this.dg);this.flush(k);this.dispose()}.bind(this))};a.SkPathEffect.MakeDash=function(e,k){k||(k=0);if(!e.length||1===e.length%2)throw"Intervals array must have even length";var q=p(e,"HEAPF32");k=a.SkPathEffect._MakeDash(q,e.length,k);T(q,e);return k};a.SkShader.Color=function(e,k){k=k||null;e=N(e);return a.SkShader._Color(e,k)};a.SkShader.MakeLinearGradient=function(e,k,q,u,A,D,O,Q){Q=Q||null;var R=y(q),U=p(u,"HEAPF32");O=O||0;D=B(D);e=a._MakeLinearGradientShader(e,k,R.yf,R.jg,U,R.count,A,O,D,
Q);T(R.yf,q);u&&T(U,u);return e};a.SkShader.MakeRadialGradient=function(e,k,q,u,A,D,O,Q){Q=Q||null;var R=y(q),U=p(u,"HEAPF32");O=O||0;D=B(D);e=a._MakeRadialGradientShader(e,k,R.yf,R.jg,U,R.count,A,O,D,Q);T(R.yf,q);u&&T(U,u);return e};a.SkShader.MakeSweepGradient=function(e,k,q,u,A,D,O,Q,R,U){U=U||null;var ha=y(q),ka=p(u,"HEAPF32");O=O||0;Q=Q||0;R=R||360;D=B(D);e=a._MakeSweepGradientShader(e,k,ha.yf,ha.jg,ka,ha.count,A,Q,R,O,D,U);T(ha.yf,q);u&&T(ka,u);return e};a.SkShader.MakeTwoPointConicalGradient=
function(e,k,q,u,A,D,O,Q,R,U){U=U||null;var ha=y(A),ka=p(D,"HEAPF32");R=R||0;Q=B(Q);e=a._MakeTwoPointConicalGradientShader(e,k,q,u,ha.yf,ha.jg,ka,ha.count,O,R,Q,U);T(ha.yf,A);D&&T(ka,D);return e};a.SkVertices.prototype.bounds=function(e){this._bounds(Ta);var k=hb.toTypedArray();return e?(e.set(k),e):k.slice()};a.Lh=a.SkPathEffect.MakeDash;a.Jh=a.SkShader.MakeLinearGradient;a.Kh=a.SkShader.MakeRadialGradient;a.Mh=a.SkShader.MakeTwoPointConicalGradient;a.Hf&&a.Hf.forEach(function(e){e()})};a.computeTonalColors=
function(m){var v=p(m.ambient,"HEAPF32"),I=p(m.spot,"HEAPF32");this._computeTonalColors(v,I);var J={ambient:M(v),spot:M(I)};T(v,m.ambient);T(I,m.spot);return J};a.LTRBRect=function(m,v,I,J){return Float32Array.of(m,v,I,J)};a.XYWHRect=function(m,v,I,J){return Float32Array.of(m,v,m+I,v+J)};a.LTRBiRect=function(m,v,I,J){return Int32Array.of(m,v,I,J)};a.XYWHiRect=function(m,v,I,J){return Int32Array.of(m,v,m+I,v+J)};a.RRectXY=function(m,v,I){return Float32Array.of(m[0],m[1],m[2],m[3],v,I,v,I,v,I,v,I)};
a.MakeAnimatedImageFromEncoded=function(m){m=new Uint8Array(m);var v=a._malloc(m.byteLength);a.HEAPU8.set(m,v);return(m=a._decodeAnimatedImage(v,m.byteLength))?m:null};a.MakeImageFromEncoded=function(m){m=new Uint8Array(m);var v=a._malloc(m.byteLength);a.HEAPU8.set(m,v);return(m=a._decodeImage(v,m.byteLength))?m:null};var ib=null;a.MakeImageFromCanvasImageSource=function(m){var v=m.width,I=m.height;ib||(ib=document.createElement("canvas"));ib.width=v;ib.height=I;var J=ib.getContext("2d");J.drawImage(m,
0,0);m=J.getImageData(0,0,v,I);return a.MakeImage(m.data,v,I,a.AlphaType.Unpremul,a.ColorType.RGBA_8888,a.SkColorSpace.SRGB)};a.MakeImage=function(m,v,I,J,ba,ua){var e=m.length/(v*I);I={width:v,height:I,alphaType:J,colorType:ba,colorSpace:ua};J=p(m,"HEAPU8");return a._MakeImage(I,J,m.length,v*e)};a.MakeSkVertices=function(m,v,I,J,ba,ua){var e=ba&&ba.length||0,k=0;I&&I.length&&(k|=1);J&&J.length&&(k|=2);void 0===ua||ua||(k|=4);m=new a._SkVerticesBuilder(m,v.length,e,k);r(v,"HEAPF32",m.positions());
m.texCoords()&&r(I,"HEAPF32",m.texCoords());if(m.colors()){if(J.build)throw"Color builder not accepted by MakeSkVertices, use array of ints";p(g(J),"HEAPU32",m.colors())}m.indices()&&p(ba,"HEAPU16",m.indices());return m.detach()};(function(){function m(G){for(var h=0;h<G.length;h++)if(void 0!==G[h]&&!Number.isFinite(G[h]))return!1;return!0}function v(G){var h=a.getColorComponents(G);G=h[0];var n=h[1],w=h[2];h=h[3];if(1===h)return G=G.toString(16).toLowerCase(),n=n.toString(16).toLowerCase(),w=w.toString(16).toLowerCase(),
G=1===G.length?"0"+G:G,n=1===n.length?"0"+n:n,w=1===w.length?"0"+w:w,"#"+G+n+w;h=0===h||1===h?h:h.toFixed(8);return"rgba("+G+", "+n+", "+w+", "+h+")"}function I(G){return a.parseColorString(G,ha)}function J(G){G=ka.exec(G);if(!G)return null;var h=parseFloat(G[4]),n=16;switch(G[5]){case "em":case "rem":n=16*h;break;case "pt":n=4*h/3;break;case "px":n=h;break;case "pc":n=16*h;break;case "in":n=96*h;break;case "cm":n=96*h/2.54;break;case "mm":n=96/25.4*h;break;case "q":n=96/25.4/4*h;break;case "%":n=
16/75*h}return{style:G[1],variant:G[2],weight:G[3],sizePx:n,family:G[6].trim()}}function ba(G){this.ef=G;this.gf=new a.SkPaint;this.gf.setAntiAlias(!0);this.gf.setStrokeMiter(10);this.gf.setStrokeCap(a.StrokeCap.Butt);this.gf.setStrokeJoin(a.StrokeJoin.Miter);this.rg="10px monospace";this.If=new a.SkFont(null,10);this.If.setSubpixel(!0);this.uf=this.Bf=a.BLACK;this.Rf=0;this.gg=a.TRANSPARENT;this.Tf=this.Sf=0;this.hg=this.Df=1;this.fg=0;this.Qf=[];this.ff=a.BlendMode.SrcOver;this.Jf=a.FilterQuality.Low;
this.eg=!0;this.gf.setStrokeWidth(this.hg);this.gf.setBlendMode(this.ff);this.jf=new a.SkPath;this.lf=a.SkMatrix.identity();this.Og=[];this.Xf=[];this.Ef=function(){this.jf.delete();this.gf.delete();this.If.delete();this.Xf.forEach(function(h){h.Ef()})};Object.defineProperty(this,"currentTransform",{enumerable:!0,get:function(){return{a:this.lf[0],c:this.lf[1],e:this.lf[2],b:this.lf[3],d:this.lf[4],f:this.lf[5]}},set:function(h){h.a&&this.setTransform(h.a,h.b,h.c,h.d,h.e,h.f)}});Object.defineProperty(this,
"fillStyle",{enumerable:!0,get:function(){return c(this.uf)?v(this.uf):this.uf},set:function(h){"string"===typeof h?this.uf=I(h):h.Pf&&(this.uf=h)}});Object.defineProperty(this,"font",{enumerable:!0,get:function(){return this.rg},set:function(h){var n=J(h),w=n.family;n.typeface=oa[w]?oa[w][(n.style||"normal")+"|"+(n.variant||"normal")+"|"+(n.weight||"normal")]||oa[w]["*"]:null;n&&(this.If.setSize(n.sizePx),this.If.setTypeface(n.typeface),this.rg=h)}});Object.defineProperty(this,"globalAlpha",{enumerable:!0,
get:function(){return this.Df},set:function(h){!isFinite(h)||0>h||1<h||(this.Df=h)}});Object.defineProperty(this,"globalCompositeOperation",{enumerable:!0,get:function(){switch(this.ff){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(h){switch(h){case "source-over":this.ff=a.BlendMode.SrcOver;break;case "destination-over":this.ff=a.BlendMode.DstOver;break;case "copy":this.ff=
a.BlendMode.Src;break;case "destination":this.ff=a.BlendMode.Dst;break;case "clear":this.ff=a.BlendMode.Clear;break;case "source-in":this.ff=a.BlendMode.SrcIn;break;case "destination-in":this.ff=a.BlendMode.DstIn;break;case "source-out":this.ff=a.BlendMode.SrcOut;break;case "destination-out":this.ff=a.BlendMode.DstOut;break;case "source-atop":this.ff=a.BlendMode.SrcATop;break;case "destination-atop":this.ff=a.BlendMode.DstATop;break;case "xor":this.ff=a.BlendMode.Xor;break;case "lighter":this.ff=
a.BlendMode.Plus;break;case "plus-lighter":this.ff=a.BlendMode.Plus;break;case "plus-darker":throw"plus-darker is not supported";case "multiply":this.ff=a.BlendMode.Multiply;break;case "screen":this.ff=a.BlendMode.Screen;break;case "overlay":this.ff=a.BlendMode.Overlay;break;case "darken":this.ff=a.BlendMode.Darken;break;case "lighten":this.ff=a.BlendMode.Lighten;break;case "color-dodge":this.ff=a.BlendMode.ColorDodge;break;case "color-burn":this.ff=a.BlendMode.ColorBurn;break;case "hard-light":this.ff=
a.BlendMode.HardLight;break;case "soft-light":this.ff=a.BlendMode.SoftLight;break;case "difference":this.ff=a.BlendMode.Difference;break;case "exclusion":this.ff=a.BlendMode.Exclusion;break;case "hue":this.ff=a.BlendMode.Hue;break;case "saturation":this.ff=a.BlendMode.Saturation;break;case "color":this.ff=a.BlendMode.Color;break;case "luminosity":this.ff=a.BlendMode.Luminosity;break;default:return}this.gf.setBlendMode(this.ff)}});Object.defineProperty(this,"imageSmoothingEnabled",{enumerable:!0,get:function(){return this.eg},
set:function(h){this.eg=!!h}});Object.defineProperty(this,"imageSmoothingQuality",{enumerable:!0,get:function(){switch(this.Jf){case a.FilterQuality.Low:return"low";case a.FilterQuality.Medium:return"medium";case a.FilterQuality.High:return"high"}},set:function(h){switch(h){case "low":this.Jf=a.FilterQuality.Low;break;case "medium":this.Jf=a.FilterQuality.Medium;break;case "high":this.Jf=a.FilterQuality.High}}});Object.defineProperty(this,"lineCap",{enumerable:!0,get:function(){switch(this.gf.getStrokeCap()){case a.StrokeCap.Butt:return"butt";
case a.StrokeCap.Round:return"round";case a.StrokeCap.Square:return"square"}},set:function(h){switch(h){case "butt":this.gf.setStrokeCap(a.StrokeCap.Butt);break;case "round":this.gf.setStrokeCap(a.StrokeCap.Round);break;case "square":this.gf.setStrokeCap(a.StrokeCap.Square)}}});Object.defineProperty(this,"lineDashOffset",{enumerable:!0,get:function(){return this.fg},set:function(h){isFinite(h)&&(this.fg=h)}});Object.defineProperty(this,"lineJoin",{enumerable:!0,get:function(){switch(this.gf.getStrokeJoin()){case a.StrokeJoin.Miter:return"miter";
case a.StrokeJoin.Round:return"round";case a.StrokeJoin.Bevel:return"bevel"}},set:function(h){switch(h){case "miter":this.gf.setStrokeJoin(a.StrokeJoin.Miter);break;case "round":this.gf.setStrokeJoin(a.StrokeJoin.Round);break;case "bevel":this.gf.setStrokeJoin(a.StrokeJoin.Bevel)}}});Object.defineProperty(this,"lineWidth",{enumerable:!0,get:function(){return this.gf.getStrokeWidth()},set:function(h){0>=h||!h||(this.hg=h,this.gf.setStrokeWidth(h))}});Object.defineProperty(this,"miterLimit",{enumerable:!0,
get:function(){return this.gf.getStrokeMiter()},set:function(h){0>=h||!h||this.gf.setStrokeMiter(h)}});Object.defineProperty(this,"shadowBlur",{enumerable:!0,get:function(){return this.Rf},set:function(h){0>h||!isFinite(h)||(this.Rf=h)}});Object.defineProperty(this,"shadowColor",{enumerable:!0,get:function(){return v(this.gg)},set:function(h){this.gg=I(h)}});Object.defineProperty(this,"shadowOffsetX",{enumerable:!0,get:function(){return this.Sf},set:function(h){isFinite(h)&&(this.Sf=h)}});Object.defineProperty(this,
"shadowOffsetY",{enumerable:!0,get:function(){return this.Tf},set:function(h){isFinite(h)&&(this.Tf=h)}});Object.defineProperty(this,"strokeStyle",{enumerable:!0,get:function(){return v(this.Bf)},set:function(h){"string"===typeof h?this.Bf=I(h):h.Pf&&(this.Bf=h)}});this.arc=function(h,n,w,z,C,E){D(this.jf,h,n,w,w,0,z,C,E)};this.arcTo=function(h,n,w,z,C){q(this.jf,h,n,w,z,C)};this.beginPath=function(){this.jf.delete();this.jf=new a.SkPath};this.bezierCurveTo=function(h,n,w,z,C,E){var K=this.jf;m([h,
n,w,z,C,E])&&(K.isEmpty()&&K.moveTo(h,n),K.cubicTo(h,n,w,z,C,E))};this.clearRect=function(h,n,w,z){this.gf.setStyle(a.PaintStyle.Fill);this.gf.setBlendMode(a.BlendMode.Clear);this.ef.drawRect(a.XYWHRect(h,n,w,z),this.gf);this.gf.setBlendMode(this.ff)};this.clip=function(h,n){"string"===typeof h?(n=h,h=this.jf):h&&h.yg&&(h=h.nf);h||(h=this.jf);h=h.copy();n&&"evenodd"===n.toLowerCase()?h.setFillType(a.FillType.EvenOdd):h.setFillType(a.FillType.Winding);this.ef.clipPath(h,a.ClipOp.Intersect,!0);h.delete()};
this.closePath=function(){u(this.jf)};this.createImageData=function(){if(1===arguments.length){var h=arguments[0];return new e(new Uint8ClampedArray(4*h.width*h.height),h.width,h.height)}if(2===arguments.length){h=arguments[0];var n=arguments[1];return new e(new Uint8ClampedArray(4*h*n),h,n)}throw"createImageData expects 1 or 2 arguments, got "+arguments.length;};this.createLinearGradient=function(h,n,w,z){if(m(arguments)){var C=new k(h,n,w,z);this.Xf.push(C);return C}};this.createPattern=function(h,
n){h=new R(h,n);this.Xf.push(h);return h};this.createRadialGradient=function(h,n,w,z,C,E){if(m(arguments)){var K=new U(h,n,w,z,C,E);this.Xf.push(K);return K}};this.Yg=function(){var h=this.qg();this.eg?h.setFilterQuality(this.Jf):h.setFilterQuality(a.FilterQuality.None);return h};this.drawImage=function(h){var n=this.Yg();if(3===arguments.length||5===arguments.length)var w=a.XYWHRect(arguments[1],arguments[2],arguments[3]||h.width(),arguments[4]||h.height()),z=a.XYWHRect(0,0,h.width(),h.height());
else if(9===arguments.length)w=a.XYWHRect(arguments[5],arguments[6],arguments[7],arguments[8]),z=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.ef.drawImageRect(h,z,w,n,!1);n.dispose()};this.ellipse=function(h,n,w,z,C,E,K,X){D(this.jf,h,n,w,z,C,E,K,X)};this.qg=function(){var h=this.gf.copy();h.setStyle(a.PaintStyle.Fill);if(c(this.uf)){var n=a.multiplyByAlpha(this.uf,this.Df);h.setColor(n)}else n=
this.uf.Pf(this.lf),h.setColor(a.Color(0,0,0,this.Df)),h.setShader(n);h.dispose=function(){this.delete()};return h};this.fill=function(h,n){"string"===typeof h?(n=h,h=this.jf):h&&h.yg&&(h=h.nf);if("evenodd"===n)this.jf.setFillType(a.FillType.EvenOdd);else{if("nonzero"!==n&&n)throw"invalid fill rule";this.jf.setFillType(a.FillType.Winding)}h||(h=this.jf);n=this.qg();var w=this.Uf(n);w&&(this.ef.save(),this.Nf(),this.ef.drawPath(h,w),this.ef.restore(),w.dispose());this.ef.drawPath(h,n);n.dispose()};
this.fillRect=function(h,n,w,z){var C=this.qg(),E=this.Uf(C);E&&(this.ef.save(),this.Nf(),this.ef.drawRect(a.XYWHRect(h,n,w,z),E),this.ef.restore(),E.dispose());this.ef.drawRect(a.XYWHRect(h,n,w,z),C);C.dispose()};this.fillText=function(h,n,w){var z=this.qg();h=a.SkTextBlob.MakeFromText(h,this.If);var C=this.Uf(z);C&&(this.ef.save(),this.Nf(),this.ef.drawTextBlob(h,n,w,C),this.ef.restore(),C.dispose());this.ef.drawTextBlob(h,n,w,z);h.delete();z.dispose()};this.getImageData=function(h,n,w,z){return(h=
this.ef.readPixels(h,n,w,z))?new e(new Uint8ClampedArray(h.buffer),w,z):null};this.getLineDash=function(){return this.Qf.slice()};this.Pg=function(h){var n=a.SkMatrix.invert(this.lf);a.SkMatrix.mapPoints(n,h);return h};this.isPointInPath=function(h,n,w){var z=arguments;if(3===z.length)var C=this.jf;else if(4===z.length)C=z[0],h=z[1],n=z[2],w=z[3];else throw"invalid arg count, need 3 or 4, got "+z.length;if(!isFinite(h)||!isFinite(n))return!1;w=w||"nonzero";if("nonzero"!==w&&"evenodd"!==w)return!1;
z=this.Pg([h,n]);h=z[0];n=z[1];C.setFillType("nonzero"===w?a.FillType.Winding:a.FillType.EvenOdd);return C.contains(h,n)};this.isPointInStroke=function(h,n){var w=arguments;if(2===w.length)var z=this.jf;else if(3===w.length)z=w[0],h=w[1],n=w[2];else throw"invalid arg count, need 2 or 3, got "+w.length;if(!isFinite(h)||!isFinite(n))return!1;w=this.Pg([h,n]);h=w[0];n=w[1];z=z.copy();z.setFillType(a.FillType.Winding);z.stroke({width:this.lineWidth,miter_limit:this.miterLimit,cap:this.gf.getStrokeCap(),
join:this.gf.getStrokeJoin(),precision:.3});w=z.contains(h,n);z.delete();return w};this.lineTo=function(h,n){O(this.jf,h,n)};this.measureText=function(h){return{width:this.If.measureText(h)}};this.moveTo=function(h,n){var w=this.jf;m([h,n])&&w.moveTo(h,n)};this.putImageData=function(h,n,w,z,C,E,K){if(m([n,w,z,C,E,K]))if(void 0===z)this.ef.writePixels(h.data,h.width,h.height,n,w);else if(z=z||0,C=C||0,E=E||h.width,K=K||h.height,0>E&&(z+=E,E=Math.abs(E)),0>K&&(C+=K,K=Math.abs(K)),0>z&&(E+=z,z=0),0>
C&&(K+=C,C=0),!(0>=E||0>=K)){h=a.MakeImage(h.data,h.width,h.height,a.AlphaType.Unpremul,a.ColorType.RGBA_8888,a.SkColorSpace.SRGB);var X=a.XYWHRect(z,C,E,K);n=a.XYWHRect(n+z,w+C,E,K);w=a.SkMatrix.invert(this.lf);this.ef.save();this.ef.concat(w);this.ef.drawImageRect(h,X,n,null,!1);this.ef.restore();h.delete()}};this.quadraticCurveTo=function(h,n,w,z){var C=this.jf;m([h,n,w,z])&&(C.isEmpty()&&C.moveTo(h,n),C.quadTo(h,n,w,z))};this.rect=function(h,n,w,z){var C=this.jf;h=a.XYWHRect(h,n,w,z);m(h)&&C.addRect(h)};
this.resetTransform=function(){this.jf.transform(this.lf);var h=a.SkMatrix.invert(this.lf);this.ef.concat(h);this.lf=this.ef.getTotalMatrix()};this.restore=function(){var h=this.Og.pop();if(h){var n=a.SkMatrix.multiply(this.lf,a.SkMatrix.invert(h.bh));this.jf.transform(n);this.gf.delete();this.gf=h.uh;this.Qf=h.sh;this.hg=h.Eh;this.Bf=h.Dh;this.uf=h.fs;this.Sf=h.Bh;this.Tf=h.Ch;this.Rf=h.yh;this.gg=h.Ah;this.Df=h.ih;this.ff=h.jh;this.fg=h.th;this.eg=h.qh;this.Jf=h.rh;this.rg=h.gh;this.ef.restore();
this.lf=this.ef.getTotalMatrix()}};this.rotate=function(h){if(isFinite(h)){var n=a.SkMatrix.rotated(-h);this.jf.transform(n);this.ef.rotate(h/Math.PI*180,0,0);this.lf=this.ef.getTotalMatrix()}};this.save=function(){if(this.uf.Of){var h=this.uf.Of();this.Xf.push(h)}else h=this.uf;if(this.Bf.Of){var n=this.Bf.Of();this.Xf.push(n)}else n=this.Bf;this.Og.push({bh:this.lf.slice(),sh:this.Qf.slice(),Eh:this.hg,Dh:n,fs:h,Bh:this.Sf,Ch:this.Tf,yh:this.Rf,Ah:this.gg,ih:this.Df,th:this.fg,jh:this.ff,qh:this.eg,
rh:this.Jf,uh:this.gf.copy(),gh:this.rg});this.ef.save()};this.scale=function(h,n){if(m(arguments)){var w=a.SkMatrix.scaled(1/h,1/n);this.jf.transform(w);this.ef.scale(h,n);this.lf=this.ef.getTotalMatrix()}};this.setLineDash=function(h){for(var n=0;n<h.length;n++)if(!isFinite(h[n])||0>h[n])return;1===h.length%2&&Array.prototype.push.apply(h,h);this.Qf=h};this.setTransform=function(h,n,w,z,C,E){m(arguments)&&(this.resetTransform(),this.transform(h,n,w,z,C,E))};this.Nf=function(){var h=a.SkMatrix.invert(this.lf);
this.ef.concat(h);this.ef.concat(a.SkMatrix.translated(this.Sf,this.Tf));this.ef.concat(this.lf)};this.Uf=function(h){var n=a.multiplyByAlpha(this.gg,this.Df);if(!a.getColorComponents(n)[3]||!(this.Rf||this.Tf||this.Sf))return null;h=h.copy();h.setColor(n);var w=a.SkMaskFilter.MakeBlur(a.BlurStyle.Normal,this.Rf/2,!1);h.setMaskFilter(w);h.dispose=function(){w.delete();this.delete()};return h};this.Ag=function(){var h=this.gf.copy();h.setStyle(a.PaintStyle.Stroke);if(c(this.Bf)){var n=a.multiplyByAlpha(this.Bf,
this.Df);h.setColor(n)}else n=this.Bf.Pf(this.lf),h.setColor(a.Color(0,0,0,this.Df)),h.setShader(n);h.setStrokeWidth(this.hg);if(this.Qf.length){var w=a.SkPathEffect.MakeDash(this.Qf,this.fg);h.setPathEffect(w)}h.dispose=function(){w&&w.delete();this.delete()};return h};this.stroke=function(h){h=h?h.nf:this.jf;var n=this.Ag(),w=this.Uf(n);w&&(this.ef.save(),this.Nf(),this.ef.drawPath(h,w),this.ef.restore(),w.dispose());this.ef.drawPath(h,n);n.dispose()};this.strokeRect=function(h,n,w,z){var C=this.Ag(),
E=this.Uf(C);E&&(this.ef.save(),this.Nf(),this.ef.drawRect(a.XYWHRect(h,n,w,z),E),this.ef.restore(),E.dispose());this.ef.drawRect(a.XYWHRect(h,n,w,z),C);C.dispose()};this.strokeText=function(h,n,w){var z=this.Ag();h=a.SkTextBlob.MakeFromText(h,this.If);var C=this.Uf(z);C&&(this.ef.save(),this.Nf(),this.ef.drawTextBlob(h,n,w,C),this.ef.restore(),C.dispose());this.ef.drawTextBlob(h,n,w,z);h.delete();z.dispose()};this.translate=function(h,n){if(m(arguments)){var w=a.SkMatrix.translated(-h,-n);this.jf.transform(w);
this.ef.translate(h,n);this.lf=this.ef.getTotalMatrix()}};this.transform=function(h,n,w,z,C,E){h=[h,w,C,n,z,E,0,0,1];n=a.SkMatrix.invert(h);this.jf.transform(n);this.ef.concat(h);this.lf=this.ef.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 ua(G){this.Bg=G;this.Gf=new ba(G.getCanvas());
this.sg=[];this.Vg=a.SkFontMgr.RefDefault();this.decodeImage=function(h){h=a.MakeImageFromEncoded(h);if(!h)throw"Invalid input";this.sg.push(h);return h};this.loadFont=function(h,n){h=this.Vg.MakeTypefaceFromData(h);if(!h)return null;this.sg.push(h);var w=(n.style||"normal")+"|"+(n.variant||"normal")+"|"+(n.weight||"normal");n=n.family;oa[n]||(oa[n]={"*":h});oa[n][w]=h};this.makePath2D=function(h){h=new Q(h);this.sg.push(h.nf);return h};this.getContext=function(h){return"2d"===h?this.Gf:null};this.toDataURL=
function(h,n){this.Bg.flush();var w=this.Bg.makeImageSnapshot();if(w){h=h||"image/png";var z=a.ImageFormat.PNG;"image/jpeg"===h&&(z=a.ImageFormat.JPEG);if(n=w.encodeToData(z,n||.92)){n=a.getSkDataBytes(n);h="data:"+h+";base64,";if(ja)n=Buffer.from(n).toString("base64");else{w=0;z=n.length;for(var C="",E;w<z;)E=n.slice(w,Math.min(w+32768,z)),C+=String.fromCharCode.apply(null,E),w+=32768;n=btoa(C)}return h+n}}};this.dispose=function(){this.Gf.Ef();this.sg.forEach(function(h){h.delete()});this.Bg.dispose()}}
function e(G,h,n){if(!h||0===n)throw"invalid dimensions, width and height must be non-zero";if(G.length%4)throw"arr must be a multiple of 4";n=n||G.length/(4*h);Object.defineProperty(this,"data",{value:G,writable:!1});Object.defineProperty(this,"height",{value:n,writable:!1});Object.defineProperty(this,"width",{value:h,writable:!1})}function k(G,h,n,w){this.qf=null;this.xf=[];this.sf=[];this.addColorStop=function(z,C){if(0>z||1<z||!isFinite(z))throw"offset must be between 0 and 1 inclusively";C=I(C);
var E=this.sf.indexOf(z);if(-1!==E)this.xf[E]=C;else{for(E=0;E<this.sf.length&&!(this.sf[E]>z);E++);this.sf.splice(E,0,z);this.xf.splice(E,0,C)}};this.Of=function(){var z=new k(G,h,n,w);z.xf=this.xf.slice();z.sf=this.sf.slice();return z};this.Ef=function(){this.qf&&(this.qf.delete(),this.qf=null)};this.Pf=function(z){var C=[G,h,n,w];a.SkMatrix.mapPoints(z,C);z=C[0];var E=C[1],K=C[2];C=C[3];this.Ef();return this.qf=a.SkShader.MakeLinearGradient([z,E],[K,C],this.xf,this.sf,a.TileMode.Clamp)}}function q(G,
h,n,w,z,C){if(m([h,n,w,z,C])){if(0>C)throw"radii cannot be negative";G.isEmpty()&&G.moveTo(h,n);G.arcToTangent(h,n,w,z,C)}}function u(G){if(!G.isEmpty()){var h=G.getBounds();(h[3]-h[1]||h[2]-h[0])&&G.close()}}function A(G,h,n,w,z,C,E){E=(E-C)/Math.PI*180;C=C/Math.PI*180;h=a.LTRBRect(h-w,n-z,h+w,n+z);1E-5>Math.abs(Math.abs(E)-360)?(n=E/2,G.arcToOval(h,C,n,!1),G.arcToOval(h,C+n,n,!1)):G.arcToOval(h,C,E,!1)}function D(G,h,n,w,z,C,E,K,X){if(m([h,n,w,z,C,E,K])){if(0>w||0>z)throw"radii cannot be negative";
var fa=2*Math.PI,pa=E%fa;0>pa&&(pa+=fa);var qa=pa-E;E=pa;K+=qa;!X&&K-E>=fa?K=E+fa:X&&E-K>=fa?K=E-fa:!X&&E>K?K=E+(fa-(E-K)%fa):X&&E<K&&(K=E-(fa-(K-E)%fa));C?(X=a.SkMatrix.rotated(C,h,n),C=a.SkMatrix.rotated(-C,h,n),G.transform(C),A(G,h,n,w,z,E,K),G.transform(X)):A(G,h,n,w,z,E,K)}}function O(G,h,n){m([h,n])&&(G.isEmpty()&&G.moveTo(h,n),G.lineTo(h,n))}function Q(G){this.nf=null;"string"===typeof G?this.nf=a.MakePathFromSVGString(G):G&&G.yg?this.nf=G.nf.copy():this.nf=new a.SkPath;this.yg=function(){return this.nf};
this.addPath=function(h,n){n||(n={a:1,c:0,e:0,b:0,d:1,f:0});this.nf.addPath(h.nf,[n.a,n.c,n.e,n.b,n.d,n.f])};this.arc=function(h,n,w,z,C,E){D(this.nf,h,n,w,w,0,z,C,E)};this.arcTo=function(h,n,w,z,C){q(this.nf,h,n,w,z,C)};this.bezierCurveTo=function(h,n,w,z,C,E){var K=this.nf;m([h,n,w,z,C,E])&&(K.isEmpty()&&K.moveTo(h,n),K.cubicTo(h,n,w,z,C,E))};this.closePath=function(){u(this.nf)};this.ellipse=function(h,n,w,z,C,E,K,X){D(this.nf,h,n,w,z,C,E,K,X)};this.lineTo=function(h,n){O(this.nf,h,n)};this.moveTo=
function(h,n){var w=this.nf;m([h,n])&&w.moveTo(h,n)};this.quadraticCurveTo=function(h,n,w,z){var C=this.nf;m([h,n,w,z])&&(C.isEmpty()&&C.moveTo(h,n),C.quadTo(h,n,w,z))};this.rect=function(h,n,w,z){var C=this.nf;h=a.XYWHRect(h,n,w,z);m(h)&&C.addRect(h)}}function R(G,h){this.qf=null;this.Xg=G;this._transform=a.SkMatrix.identity();""===h&&(h="repeat");switch(h){case "repeat-x":this.Vf=a.TileMode.Repeat;this.Wf=a.TileMode.Decal;break;case "repeat-y":this.Vf=a.TileMode.Decal;this.Wf=a.TileMode.Repeat;
break;case "repeat":this.Wf=this.Vf=a.TileMode.Repeat;break;case "no-repeat":this.Wf=this.Vf=a.TileMode.Decal;break;default:throw"invalid repetition mode "+h;}this.setTransform=function(n){n=[n.a,n.c,n.e,n.b,n.d,n.f,0,0,1];m(n)&&(this._transform=n)};this.Of=function(){var n=new R;n.Vf=this.Vf;n.Wf=this.Wf;return n};this.Ef=function(){this.qf&&(this.qf.delete(),this.qf=null)};this.Pf=function(){this.Ef();return this.qf=this.Xg.makeShader(this.Vf,this.Wf,this._transform)}}function U(G,h,n,w,z,C){this.qf=
null;this.xf=[];this.sf=[];this.addColorStop=function(E,K){if(0>E||1<E||!isFinite(E))throw"offset must be between 0 and 1 inclusively";K=I(K);var X=this.sf.indexOf(E);if(-1!==X)this.xf[X]=K;else{for(X=0;X<this.sf.length&&!(this.sf[X]>E);X++);this.sf.splice(X,0,E);this.xf.splice(X,0,K)}};this.Of=function(){var E=new U(G,h,n,w,z,C);E.xf=this.xf.slice();E.sf=this.sf.slice();return E};this.Ef=function(){this.qf&&(this.qf.delete(),this.qf=null)};this.Pf=function(E){var K=[G,h,w,z];a.SkMatrix.mapPoints(E,
K);var X=K[0],fa=K[1],pa=K[2];K=K[3];var qa=(Math.abs(E[0])+Math.