@pixi/graphics
Advanced tools
Comparing version 6.3.2 to 6.4.0
/*! | ||
* @pixi/graphics - v6.3.2 | ||
* Compiled Wed, 04 May 2022 17:49:13 UTC | ||
* @pixi/graphics - v6.4.0 | ||
* Compiled Wed, 01 Jun 2022 21:14:23 UTC | ||
* | ||
@@ -8,3 +8,3 @@ * @pixi/graphics is licensed under the MIT License. | ||
*/ | ||
this.PIXI=this.PIXI||{};var _pixi_graphics=function(t,e,i,r,n,s){"use strict";var h,a;t.LINE_JOIN=void 0,(h=t.LINE_JOIN||(t.LINE_JOIN={})).MITER="miter",h.BEVEL="bevel",h.ROUND="round",t.LINE_CAP=void 0,(a=t.LINE_CAP||(t.LINE_CAP={})).BUTT="butt",a.ROUND="round",a.SQUARE="square";var o={adaptive:!0,maxLength:10,minSegments:8,maxSegments:2048,epsilon:1e-4,_segmentsCount:function(t,e){if(void 0===e&&(e=20),!this.adaptive||!t||isNaN(t))return e;var i=Math.ceil(t/this.maxLength);return i<this.minSegments?i=this.minSegments:i>this.maxSegments&&(i=this.maxSegments),i}},l=function(){function t(){this.color=16777215,this.alpha=1,this.texture=e.Texture.WHITE,this.matrix=null,this.visible=!1,this.reset()}return t.prototype.clone=function(){var e=new t;return e.color=this.color,e.alpha=this.alpha,e.texture=this.texture,e.matrix=this.matrix,e.visible=this.visible,e},t.prototype.reset=function(){this.color=16777215,this.alpha=1,this.texture=e.Texture.WHITE,this.matrix=null,this.visible=!1},t.prototype.destroy=function(){this.texture=null,this.matrix=null},t}(),u=function(t,e){return u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},u(t,e)};function p(t,e){function i(){this.constructor=t}u(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}function c(t,e){var i,r;void 0===e&&(e=!1);var n=t.length;if(!(n<6)){for(var s=0,h=0,a=t[n-2],o=t[n-1];h<n;h+=2){var l=t[h],u=t[h+1];s+=(l-a)*(u+o),a=l,o=u}if(!e&&s>0||e&&s<=0){var p=n/2;for(h=p+p%2;h<n;h+=2){var c=n-h-2,d=n-h-1,f=h,y=h+1;i=[t[f],t[c]],t[c]=i[0],t[f]=i[1],r=[t[y],t[d]],t[d]=r[0],t[y]=r[1]}}}}var d={build:function(t){t.points=t.shape.points.slice()},triangulate:function(t,e){var i=t.points,n=t.holes,s=e.points,h=e.indices;if(i.length>=6){c(i,!1);for(var a=[],o=0;o<n.length;o++){var l=n[o];c(l.points,!0),a.push(i.length/2),i=i.concat(l.points)}var u=r.earcut(i,a,2);if(!u)return;var p=s.length/2;for(o=0;o<u.length;o+=3)h.push(u[o]+p),h.push(u[o+1]+p),h.push(u[o+2]+p);for(o=0;o<i.length;o++)s.push(i[o])}}},f={build:function(t){var e,r,n,s,h,a,o=t.points;if(t.type===i.SHAPES.CIRC){var l=t.shape;e=l.x,r=l.y,h=a=l.radius,n=s=0}else if(t.type===i.SHAPES.ELIP){var u=t.shape;e=u.x,r=u.y,h=u.width,a=u.height,n=s=0}else{var p=t.shape,c=p.width/2,d=p.height/2;e=p.x+c,r=p.y+d,n=c-(h=a=Math.max(0,Math.min(p.radius,Math.min(c,d)))),s=d-a}var f=Math.ceil(2.3*Math.sqrt(h+a)),y=8*f+(n?4:0)+(s?4:0);if(o.length=y,0!==y){if(0===f)return o.length=8,o[0]=o[6]=e+n,o[1]=o[3]=r+s,o[2]=o[4]=e-n,void(o[5]=o[7]=r-s);var v=0,g=4*f+(n?2:0)+2,b=g,m=y,x=e+(I=n+h),_=e-I,P=r+(E=s);if(o[v++]=x,o[v++]=P,o[--g]=P,o[--g]=_,s){var S=r-E;o[b++]=_,o[b++]=S,o[--m]=S,o[--m]=x}for(var w=1;w<f;w++){var M=Math.PI/2*(w/f);x=e+(I=n+Math.cos(M)*h),_=e-I,P=r+(E=s+Math.sin(M)*a),S=r-E;o[v++]=x,o[v++]=P,o[--g]=P,o[--g]=_,o[b++]=_,o[b++]=S,o[--m]=S,o[--m]=x}var I,E;x=e+(I=n),_=e-I,P=r+(E=s+a),S=r-E;o[v++]=x,o[v++]=P,o[--m]=S,o[--m]=x,n&&(o[v++]=_,o[v++]=P,o[--m]=S,o[--m]=_)}},triangulate:function(t,e){var r,n,s=t.points,h=e.points,a=e.indices,o=h.length/2,l=o;if(t.type!==i.SHAPES.RREC){var u=t.shape;r=u.x,n=u.y}else{var p=t.shape;r=p.x+p.width/2,n=p.y+p.height/2}var c=t.matrix;h.push(t.matrix?c.a*r+c.c*n+c.tx:r,t.matrix?c.b*r+c.d*n+c.ty:n),o++,h.push(s[0],s[1]);for(var d=2;d<s.length;d+=2)h.push(s[d],s[d+1]),a.push(o++,l,o);a.push(l+1,l,o)}},y={build:function(t){var e=t.shape,i=e.x,r=e.y,n=e.width,s=e.height,h=t.points;h.length=0,h.push(i,r,i+n,r,i+n,r+s,i,r+s)},triangulate:function(t,e){var i=t.points,r=e.points,n=r.length/2;r.push(i[0],i[1],i[2],i[3],i[6],i[7],i[4],i[5]),e.indices.push(n,n+1,n+2,n+1,n+2,n+3)}};function v(t,e,i){return t+(e-t)*i}function g(t,e,i,r,n,s,h){void 0===h&&(h=[]);for(var a=h,o=0,l=0,u=0,p=0,c=0,d=0,f=0,y=0;f<=20;++f)o=v(t,i,y=f/20),l=v(e,r,y),u=v(i,n,y),p=v(r,s,y),c=v(o,u,y),d=v(l,p,y),0===f&&a[a.length-2]===c&&a[a.length-1]===d||a.push(c,d);return a}var b={build:function(t){if(U.nextRoundedRectBehavior)f.build(t);else{var e=t.shape,i=t.points,r=e.x,n=e.y,s=e.width,h=e.height,a=Math.max(0,Math.min(e.radius,Math.min(s,h)/2));i.length=0,a?(g(r,n+a,r,n,r+a,n,i),g(r+s-a,n,r+s,n,r+s,n+a,i),g(r+s,n+h-a,r+s,n+h,r+s-a,n+h,i),g(r+a,n+h,r,n+h,r,n+h-a,i)):i.push(r,n,r+s,n,r+s,n+h,r,n+h)}},triangulate:function(t,e){if(U.nextRoundedRectBehavior)f.triangulate(t,e);else{for(var i=t.points,n=e.points,s=e.indices,h=n.length/2,a=r.earcut(i,null,2),o=0,l=a.length;o<l;o+=3)s.push(a[o]+h),s.push(a[o+1]+h),s.push(a[o+2]+h);for(o=0,l=i.length;o<l;o++)n.push(i[o],i[++o])}}};function m(t,e,i,r,n,s,h,a){var o,l;h?(o=r,l=-i):(o=-r,l=i);var u=t-i*n+o,p=e-r*n+l,c=t+i*s+o,d=e+r*s+l;return a.push(u,p),a.push(c,d),2}function x(t,e,i,r,n,s,h,a){var o=i-t,l=r-e,u=Math.atan2(o,l),p=Math.atan2(n-t,s-e);a&&u<p?u+=2*Math.PI:!a&&u>p&&(p+=2*Math.PI);var c=u,d=p-u,f=Math.abs(d),y=Math.sqrt(o*o+l*l),v=1+(15*f*Math.sqrt(y)/Math.PI>>0),g=d/v;if(c+=g,a){h.push(t,e),h.push(i,r);for(var b=1,m=c;b<v;b++,m+=g)h.push(t,e),h.push(t+Math.sin(m)*y,e+Math.cos(m)*y);h.push(t,e),h.push(n,s)}else{h.push(i,r),h.push(t,e);for(b=1,m=c;b<v;b++,m+=g)h.push(t+Math.sin(m)*y,e+Math.cos(m)*y),h.push(t,e);h.push(n,s),h.push(t,e)}return 2*v}function _(e,r){e.lineStyle.native?function(t,e){var r=0,n=t.shape,s=t.points||n.points,h=n.type!==i.SHAPES.POLY||n.closeStroke;if(0!==s.length){var a=e.points,o=e.indices,l=s.length/2,u=a.length/2,p=u;for(a.push(s[0],s[1]),r=1;r<l;r++)a.push(s[2*r],s[2*r+1]),o.push(p,p+1),p++;h&&o.push(p,u)}}(e,r):function(e,r){var n=e.shape,s=e.points||n.points.slice(),h=r.closePointEps;if(0!==s.length){var a=e.lineStyle,l=new i.Point(s[0],s[1]),u=new i.Point(s[s.length-2],s[s.length-1]),p=n.type!==i.SHAPES.POLY||n.closeStroke,c=Math.abs(l.x-u.x)<h&&Math.abs(l.y-u.y)<h;if(p){s=s.slice(),c&&(s.pop(),s.pop(),u.set(s[s.length-2],s[s.length-1]));var d=.5*(l.x+u.x),f=.5*(u.y+l.y);s.unshift(d,f),s.push(d,f)}var y=r.points,v=s.length/2,g=s.length,b=y.length/2,_=a.width/2,P=_*_,S=a.miterLimit*a.miterLimit,w=s[0],M=s[1],I=s[2],E=s[3],A=0,D=0,T=-(M-E),C=w-I,R=0,L=0,B=Math.sqrt(T*T+C*C);T/=B,C/=B,T*=_,C*=_;var O=a.alignment,N=2*(1-O),U=2*O;p||(a.cap===t.LINE_CAP.ROUND?g+=x(w-T*(N-U)*.5,M-C*(N-U)*.5,w-T*N,M-C*N,w+T*U,M+C*U,y,!0)+2:a.cap===t.LINE_CAP.SQUARE&&(g+=m(w,M,T,C,N,U,!0,y))),y.push(w-T*N,M-C*N),y.push(w+T*U,M+C*U);for(var H=1;H<v-1;++H){w=s[2*(H-1)],M=s[2*(H-1)+1],I=s[2*H],E=s[2*H+1],A=s[2*(H+1)],D=s[2*(H+1)+1],T=-(M-E),C=w-I,T/=B=Math.sqrt(T*T+C*C),C/=B,T*=_,C*=_,R=-(E-D),L=I-A,R/=B=Math.sqrt(R*R+L*L),L/=B,R*=_,L*=_;var j=I-w,F=M-E,z=I-A,q=D-E,k=F*z-q*j,G=k<0;if(Math.abs(k)<.1)y.push(I-T*N,E-C*N),y.push(I+T*U,E+C*U);else{var W=(-T+w)*(-C+E)-(-T+I)*(-C+M),X=(-R+A)*(-L+E)-(-R+I)*(-L+D),J=(j*X-z*W)/k,Y=(q*W-F*X)/k,V=(J-I)*(J-I)+(Y-E)*(Y-E),Q=I+(J-I)*N,Z=E+(Y-E)*N,K=I-(J-I)*U,$=E-(Y-E)*U,tt=G?N:U;V<=Math.min(j*j+F*F,z*z+q*q)+tt*tt*P?a.join===t.LINE_JOIN.BEVEL||V/P>S?(G?(y.push(Q,Z),y.push(I+T*U,E+C*U),y.push(Q,Z),y.push(I+R*U,E+L*U)):(y.push(I-T*N,E-C*N),y.push(K,$),y.push(I-R*N,E-L*N),y.push(K,$)),g+=2):a.join===t.LINE_JOIN.ROUND?G?(y.push(Q,Z),y.push(I+T*U,E+C*U),g+=x(I,E,I+T*U,E+C*U,I+R*U,E+L*U,y,!0)+4,y.push(Q,Z),y.push(I+R*U,E+L*U)):(y.push(I-T*N,E-C*N),y.push(K,$),g+=x(I,E,I-T*N,E-C*N,I-R*N,E-L*N,y,!1)+4,y.push(I-R*N,E-L*N),y.push(K,$)):(y.push(Q,Z),y.push(K,$)):(y.push(I-T*N,E-C*N),y.push(I+T*U,E+C*U),a.join===t.LINE_JOIN.BEVEL||V/P>S||(a.join===t.LINE_JOIN.ROUND?g+=G?x(I,E,I+T*U,E+C*U,I+R*U,E+L*U,y,!0)+2:x(I,E,I-T*N,E-C*N,I-R*N,E-L*N,y,!1)+2:(G?(y.push(K,$),y.push(K,$)):(y.push(Q,Z),y.push(Q,Z)),g+=2)),y.push(I-R*N,E-L*N),y.push(I+R*U,E+L*U),g+=2)}}w=s[2*(v-2)],M=s[2*(v-2)+1],I=s[2*(v-1)],T=-(M-(E=s[2*(v-1)+1])),C=w-I,T/=B=Math.sqrt(T*T+C*C),C/=B,T*=_,C*=_,y.push(I-T*N,E-C*N),y.push(I+T*U,E+C*U),p||(a.cap===t.LINE_CAP.ROUND?g+=x(I-T*(N-U)*.5,E-C*(N-U)*.5,I-T*N,E-C*N,I+T*U,E+C*U,y,!1)+2:a.cap===t.LINE_CAP.SQUARE&&(g+=m(I,E,T,C,N,U,!1,y)));var et=r.indices,it=o.epsilon*o.epsilon;for(H=b;H<g+b-2;++H)w=y[2*H],M=y[2*H+1],I=y[2*(H+1)],E=y[2*(H+1)+1],A=y[2*(H+2)],D=y[2*(H+2)+1],Math.abs(w*(E-D)+I*(D-M)+A*(M-E))<it||et.push(H,H+1,H+2)}}(e,r)}var P,S=function(){function t(){}return t.curveTo=function(t,e,i,r,n,s){var h=s[s.length-2],a=s[s.length-1]-e,o=h-t,l=r-e,u=i-t,p=Math.abs(a*u-o*l);if(p<1e-8||0===n)return s[s.length-2]===t&&s[s.length-1]===e||s.push(t,e),null;var c=a*a+o*o,d=l*l+u*u,f=a*l+o*u,y=n*Math.sqrt(c)/p,v=n*Math.sqrt(d)/p,g=y*f/c,b=v*f/d,m=y*u+v*o,x=y*l+v*a,_=o*(v+g),P=a*(v+g),S=u*(y+b),w=l*(y+b);return{cx:m+t,cy:x+e,radius:n,startAngle:Math.atan2(P-x,_-m),endAngle:Math.atan2(w-x,S-m),anticlockwise:o*l>u*a}},t.arc=function(t,e,r,n,s,h,a,l,u){for(var p=a-h,c=o._segmentsCount(Math.abs(p)*s,40*Math.ceil(Math.abs(p)/i.PI_2)),d=p/(2*c),f=2*d,y=Math.cos(d),v=Math.sin(d),g=c-1,b=g%1/g,m=0;m<=g;++m){var x=d+h+f*(m+b*m),_=Math.cos(x),P=-Math.sin(x);u.push((y*_+v*P)*s+r,(y*-P+v*_)*s+n)}},t}(),w=function(){function t(){}return t.curveLength=function(t,e,i,r,n,s,h,a){for(var o=0,l=0,u=0,p=0,c=0,d=0,f=0,y=0,v=0,g=0,b=0,m=t,x=e,_=1;_<=10;++_)g=m-(y=(f=(d=(c=1-(l=_/10))*c)*c)*t+3*d*l*i+3*c*(u=l*l)*n+(p=u*l)*h),b=x-(v=f*e+3*d*l*r+3*c*u*s+p*a),m=y,x=v,o+=Math.sqrt(g*g+b*b);return o},t.curveTo=function(e,i,r,n,s,h,a){var l=a[a.length-2],u=a[a.length-1];a.length-=2;var p=o._segmentsCount(t.curveLength(l,u,e,i,r,n,s,h)),c=0,d=0,f=0,y=0,v=0;a.push(l,u);for(var g=1,b=0;g<=p;++g)f=(d=(c=1-(b=g/p))*c)*c,v=(y=b*b)*b,a.push(f*l+3*d*b*e+3*c*y*r+v*s,f*u+3*d*b*i+3*c*y*n+v*h)},t}(),M=function(){function t(){}return t.curveLength=function(t,e,i,r,n,s){var h=t-2*i+n,a=e-2*r+s,o=2*i-2*t,l=2*r-2*e,u=4*(h*h+a*a),p=4*(h*o+a*l),c=o*o+l*l,d=2*Math.sqrt(u+p+c),f=Math.sqrt(u),y=2*u*f,v=2*Math.sqrt(c),g=p/f;return(y*d+f*p*(d-v)+(4*c*u-p*p)*Math.log((2*f+g+d)/(g+v)))/(4*y)},t.curveTo=function(e,i,r,n,s){for(var h=s[s.length-2],a=s[s.length-1],l=o._segmentsCount(t.curveLength(h,a,e,i,r,n)),u=0,p=0,c=1;c<=l;++c){var d=c/l;u=h+(e-h)*d,p=a+(i-a)*d,s.push(u+(e+(r-e)*d-u)*d,p+(i+(n-i)*d-p)*d)}},t}(),I=function(){function t(){this.reset()}return t.prototype.begin=function(t,e,i){this.reset(),this.style=t,this.start=e,this.attribStart=i},t.prototype.end=function(t,e){this.attribSize=e-this.attribStart,this.size=t-this.start},t.prototype.reset=function(){this.style=null,this.size=0,this.start=0,this.attribStart=0,this.attribSize=0},t}(),E=((P={})[i.SHAPES.POLY]=d,P[i.SHAPES.CIRC]=f,P[i.SHAPES.ELIP]=f,P[i.SHAPES.RECT]=y,P[i.SHAPES.RREC]=b,P),A=[],D=[],T=function(){function t(t,e,i,r){void 0===e&&(e=null),void 0===i&&(i=null),void 0===r&&(r=null),this.points=[],this.holes=[],this.shape=t,this.lineStyle=i,this.fillStyle=e,this.matrix=r,this.type=t.type}return t.prototype.clone=function(){return new t(this.shape,this.fillStyle,this.lineStyle,this.matrix)},t.prototype.destroy=function(){this.shape=null,this.holes.length=0,this.holes=null,this.points.length=0,this.points=null,this.lineStyle=null,this.fillStyle=null},t}(),C=new i.Point,R=new s.Bounds,L=function(t){function h(){var e=t.call(this)||this;return e.closePointEps=1e-4,e.boundsPadding=0,e.uvsFloat32=null,e.indicesUint16=null,e.batchable=!1,e.points=[],e.colors=[],e.uvs=[],e.indices=[],e.textureIds=[],e.graphicsData=[],e.drawCalls=[],e.batchDirty=-1,e.batches=[],e.dirty=0,e.cacheDirty=-1,e.clearDirty=0,e.shapeIndex=0,e._bounds=new s.Bounds,e.boundsDirty=-1,e}return p(h,t),Object.defineProperty(h.prototype,"bounds",{get:function(){return this.boundsDirty!==this.dirty&&(this.boundsDirty=this.dirty,this.calculateBounds()),this._bounds},enumerable:!1,configurable:!0}),h.prototype.invalidate=function(){this.boundsDirty=-1,this.dirty++,this.batchDirty++,this.shapeIndex=0,this.points.length=0,this.colors.length=0,this.uvs.length=0,this.indices.length=0,this.textureIds.length=0;for(var t=0;t<this.drawCalls.length;t++)this.drawCalls[t].texArray.clear(),D.push(this.drawCalls[t]);this.drawCalls.length=0;for(t=0;t<this.batches.length;t++){var e=this.batches[t];e.reset(),A.push(e)}this.batches.length=0},h.prototype.clear=function(){return this.graphicsData.length>0&&(this.invalidate(),this.clearDirty++,this.graphicsData.length=0),this},h.prototype.drawShape=function(t,e,i,r){void 0===e&&(e=null),void 0===i&&(i=null),void 0===r&&(r=null);var n=new T(t,e,i,r);return this.graphicsData.push(n),this.dirty++,this},h.prototype.drawHole=function(t,e){if(void 0===e&&(e=null),!this.graphicsData.length)return null;var i=new T(t,null,null,e),r=this.graphicsData[this.graphicsData.length-1];return i.lineStyle=r.lineStyle,r.holes.push(i),this.dirty++,this},h.prototype.destroy=function(){t.prototype.destroy.call(this);for(var e=0;e<this.graphicsData.length;++e)this.graphicsData[e].destroy();this.points.length=0,this.points=null,this.colors.length=0,this.colors=null,this.uvs.length=0,this.uvs=null,this.indices.length=0,this.indices=null,this.indexBuffer.destroy(),this.indexBuffer=null,this.graphicsData.length=0,this.graphicsData=null,this.drawCalls.length=0,this.drawCalls=null,this.batches.length=0,this.batches=null,this._bounds=null},h.prototype.containsPoint=function(t){for(var e=this.graphicsData,i=0;i<e.length;++i){var r=e[i];if(r.fillStyle.visible&&(r.shape&&(r.matrix?r.matrix.applyInverse(t,C):C.copyFrom(t),r.shape.contains(C.x,C.y)))){var n=!1;if(r.holes)for(var s=0;s<r.holes.length;s++){if(r.holes[s].shape.contains(C.x,C.y)){n=!0;break}}if(!n)return!0}}return!1},h.prototype.updateBatches=function(t){if(this.graphicsData.length){if(this.validateBatching()){this.cacheDirty=this.dirty;var e=this.uvs,i=this.graphicsData,r=null,s=null;this.batches.length>0&&(s=(r=this.batches[this.batches.length-1]).style);for(var h=this.shapeIndex;h<i.length;h++){this.shapeIndex++;var a=i[h],o=a.fillStyle,l=a.lineStyle;E[a.type].build(a),a.matrix&&this.transformPoints(a.points,a.matrix),(o.visible||l.visible)&&this.processHoles(a.holes);for(var u=0;u<2;u++){var p=0===u?o:l;if(p.visible){var c=p.texture.baseTexture,d=this.indices.length,f=this.points.length/2;c.wrapMode=n.WRAP_MODES.REPEAT,0===u?this.processFill(a):this.processLine(a);var y=this.points.length/2-f;0!==y&&(r&&!this._compareStyles(s,p)&&(r.end(d,f),r=null),r||((r=A.pop()||new I).begin(p,d,f),this.batches.push(r),s=p),this.addUvs(this.points,e,p.texture,f,y,p.matrix))}}}var v=this.indices.length,g=this.points.length/2;if(r&&r.end(v,g),0!==this.batches.length){if(this.indicesUint16&&this.indices.length===this.indicesUint16.length)this.indicesUint16.set(this.indices);else{var b=g>65535&&t;this.indicesUint16=b?new Uint32Array(this.indices):new Uint16Array(this.indices)}this.batchable=this.isBatchable(),this.batchable?this.packBatches():this.buildDrawCalls()}else this.batchable=!0}}else this.batchable=!0},h.prototype._compareStyles=function(t,e){return!(!t||!e)&&(t.texture.baseTexture===e.texture.baseTexture&&(t.color+t.alpha===e.color+e.alpha&&!!t.native==!!e.native))},h.prototype.validateBatching=function(){if(this.dirty===this.cacheDirty||!this.graphicsData.length)return!1;for(var t=0,e=this.graphicsData.length;t<e;t++){var i=this.graphicsData[t],r=i.fillStyle,n=i.lineStyle;if(r&&!r.texture.baseTexture.valid)return!1;if(n&&!n.texture.baseTexture.valid)return!1}return!0},h.prototype.packBatches=function(){this.batchDirty++,this.uvsFloat32=new Float32Array(this.uvs);for(var t=this.batches,e=0,i=t.length;e<i;e++)for(var r=t[e],n=0;n<r.size;n++){var s=r.start+n;this.indicesUint16[s]=this.indicesUint16[s]-r.attribStart}},h.prototype.isBatchable=function(){if(this.points.length>131070)return!1;for(var t=this.batches,e=0;e<t.length;e++)if(t[e].style.native)return!1;return this.points.length<2*h.BATCHABLE_SIZE},h.prototype.buildDrawCalls=function(){for(var t=++e.BaseTexture._globalBatch,i=0;i<this.drawCalls.length;i++)this.drawCalls[i].texArray.clear(),D.push(this.drawCalls[i]);this.drawCalls.length=0;var r=this.colors,s=this.textureIds,h=D.pop();h||((h=new e.BatchDrawCall).texArray=new e.BatchTextureArray),h.texArray.count=0,h.start=0,h.size=0,h.type=n.DRAW_MODES.TRIANGLES;var a=0,o=null,l=0,u=!1,p=n.DRAW_MODES.TRIANGLES,c=0;this.drawCalls.push(h);for(i=0;i<this.batches.length;i++){var d=this.batches[i],f=d.style,y=f.texture.baseTexture;u!==!!f.native&&(p=(u=!!f.native)?n.DRAW_MODES.LINES:n.DRAW_MODES.TRIANGLES,o=null,a=8,t++),o!==y&&(o=y,y._batchEnabled!==t&&(8===a&&(t++,a=0,h.size>0&&((h=D.pop())||((h=new e.BatchDrawCall).texArray=new e.BatchTextureArray),this.drawCalls.push(h)),h.start=c,h.size=0,h.texArray.count=0,h.type=p),y.touched=1,y._batchEnabled=t,y._batchLocation=a,y.wrapMode=n.WRAP_MODES.REPEAT,h.texArray.elements[h.texArray.count++]=y,a++)),h.size+=d.size,c+=d.size,l=y._batchLocation,this.addColors(r,f.color,f.alpha,d.attribSize,d.attribStart),this.addTextureIds(s,l,d.attribSize,d.attribStart)}e.BaseTexture._globalBatch=t,this.packAttributes()},h.prototype.packAttributes=function(){for(var t=this.points,e=this.uvs,i=this.colors,r=this.textureIds,n=new ArrayBuffer(3*t.length*4),s=new Float32Array(n),h=new Uint32Array(n),a=0,o=0;o<t.length/2;o++)s[a++]=t[2*o],s[a++]=t[2*o+1],s[a++]=e[2*o],s[a++]=e[2*o+1],h[a++]=i[o],s[a++]=r[o];this._buffer.update(n),this._indexBuffer.update(this.indicesUint16)},h.prototype.processFill=function(t){t.holes.length?d.triangulate(t,this):E[t.type].triangulate(t,this)},h.prototype.processLine=function(t){_(t,this);for(var e=0;e<t.holes.length;e++)_(t.holes[e],this)},h.prototype.processHoles=function(t){for(var e=0;e<t.length;e++){var i=t[e];E[i.type].build(i),i.matrix&&this.transformPoints(i.points,i.matrix)}},h.prototype.calculateBounds=function(){var t=this._bounds,e=R,r=i.Matrix.IDENTITY;this._bounds.clear(),e.clear();for(var n=0;n<this.graphicsData.length;n++){var s=this.graphicsData[n],h=s.shape,a=s.type,o=s.lineStyle,l=s.matrix||i.Matrix.IDENTITY,u=0;if(o&&o.visible&&(u=o.width,a!==i.SHAPES.POLY||s.fillStyle.visible?u*=Math.max(0,o.alignment):u*=Math.max(o.alignment,1-o.alignment)),r!==l&&(e.isEmpty()||(t.addBoundsMatrix(e,r),e.clear()),r=l),a===i.SHAPES.RECT||a===i.SHAPES.RREC){var p=h;e.addFramePad(p.x,p.y,p.x+p.width,p.y+p.height,u,u)}else if(a===i.SHAPES.CIRC){var c=h;e.addFramePad(c.x,c.y,c.x,c.y,c.radius+u,c.radius+u)}else if(a===i.SHAPES.ELIP){var d=h;e.addFramePad(d.x,d.y,d.x,d.y,d.width+u,d.height+u)}else{var f=h;t.addVerticesMatrix(r,f.points,0,f.points.length,u,u)}}e.isEmpty()||t.addBoundsMatrix(e,r),t.pad(this.boundsPadding,this.boundsPadding)},h.prototype.transformPoints=function(t,e){for(var i=0;i<t.length/2;i++){var r=t[2*i],n=t[2*i+1];t[2*i]=e.a*r+e.c*n+e.tx,t[2*i+1]=e.b*r+e.d*n+e.ty}},h.prototype.addColors=function(t,e,i,n,s){void 0===s&&(s=0);var h=(e>>16)+(65280&e)+((255&e)<<16),a=r.premultiplyTint(h,i);t.length=Math.max(t.length,s+n);for(var o=0;o<n;o++)t[s+o]=a},h.prototype.addTextureIds=function(t,e,i,r){void 0===r&&(r=0),t.length=Math.max(t.length,r+i);for(var n=0;n<i;n++)t[r+n]=e},h.prototype.addUvs=function(t,e,i,r,n,s){void 0===s&&(s=null);for(var h=0,a=e.length,o=i.frame;h<n;){var l=t[2*(r+h)],u=t[2*(r+h)+1];if(s){var p=s.a*l+s.c*u+s.tx;u=s.b*l+s.d*u+s.ty,l=p}h++,e.push(l/o.width,u/o.height)}var c=i.baseTexture;(o.width<c.width||o.height<c.height)&&this.adjustUvs(e,i,a,n)},h.prototype.adjustUvs=function(t,e,i,r){for(var n=e.baseTexture,s=1e-6,h=i+2*r,a=e.frame,o=a.width/n.width,l=a.height/n.height,u=a.x/a.width,p=a.y/a.height,c=Math.floor(t[i]+s),d=Math.floor(t[i+1]+s),f=i+2;f<h;f+=2)c=Math.min(c,Math.floor(t[f]+s)),d=Math.min(d,Math.floor(t[f+1]+s));u-=c,p-=d;for(f=i;f<h;f+=2)t[f]=(t[f]+u)*o,t[f+1]=(t[f+1]+p)*l},h.BATCHABLE_SIZE=100,h}(e.BatchGeometry),B=function(e){function i(){var i=null!==e&&e.apply(this,arguments)||this;return i.width=0,i.alignment=.5,i.native=!1,i.cap=t.LINE_CAP.BUTT,i.join=t.LINE_JOIN.MITER,i.miterLimit=10,i}return p(i,e),i.prototype.clone=function(){var t=new i;return t.color=this.color,t.alpha=this.alpha,t.texture=this.texture,t.matrix=this.matrix,t.visible=this.visible,t.width=this.width,t.alignment=this.alignment,t.native=this.native,t.cap=this.cap,t.join=this.join,t.miterLimit=this.miterLimit,t},i.prototype.reset=function(){e.prototype.reset.call(this),this.color=0,this.alignment=.5,this.width=0,this.native=!1},i}(l),O=new Float32Array(3),N={},U=function(s){function h(t){void 0===t&&(t=null);var i=s.call(this)||this;return i.shader=null,i.pluginName="batch",i.currentPath=null,i.batches=[],i.batchTint=-1,i.batchDirty=-1,i.vertexData=null,i._fillStyle=new l,i._lineStyle=new B,i._matrix=null,i._holeMode=!1,i.state=e.State.for2d(),i._geometry=t||new L,i._geometry.refCount++,i._transformID=-1,i.tint=16777215,i.blendMode=n.BLEND_MODES.NORMAL,i}return p(h,s),Object.defineProperty(h.prototype,"geometry",{get:function(){return this._geometry},enumerable:!1,configurable:!0}),h.prototype.clone=function(){return this.finishPoly(),new h(this._geometry)},Object.defineProperty(h.prototype,"blendMode",{get:function(){return this.state.blendMode},set:function(t){this.state.blendMode=t},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"tint",{get:function(){return this._tint},set:function(t){this._tint=t},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"fill",{get:function(){return this._fillStyle},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"line",{get:function(){return this._lineStyle},enumerable:!1,configurable:!0}),h.prototype.lineStyle=function(t,e,i,r,n){return void 0===t&&(t=null),void 0===e&&(e=0),void 0===i&&(i=1),void 0===r&&(r=.5),void 0===n&&(n=!1),"number"==typeof t&&(t={width:t,color:e,alpha:i,alignment:r,native:n}),this.lineTextureStyle(t)},h.prototype.lineTextureStyle=function(i){i=Object.assign({width:0,texture:e.Texture.WHITE,color:i&&i.texture?16777215:0,alpha:1,matrix:null,alignment:.5,native:!1,cap:t.LINE_CAP.BUTT,join:t.LINE_JOIN.MITER,miterLimit:10},i),this.currentPath&&this.startPoly();var r=i.width>0&&i.alpha>0;return r?(i.matrix&&(i.matrix=i.matrix.clone(),i.matrix.invert()),Object.assign(this._lineStyle,{visible:r},i)):this._lineStyle.reset(),this},h.prototype.startPoly=function(){if(this.currentPath){var t=this.currentPath.points,e=this.currentPath.points.length;e>2&&(this.drawShape(this.currentPath),this.currentPath=new i.Polygon,this.currentPath.closeStroke=!1,this.currentPath.points.push(t[e-2],t[e-1]))}else this.currentPath=new i.Polygon,this.currentPath.closeStroke=!1},h.prototype.finishPoly=function(){this.currentPath&&(this.currentPath.points.length>2?(this.drawShape(this.currentPath),this.currentPath=null):this.currentPath.points.length=0)},h.prototype.moveTo=function(t,e){return this.startPoly(),this.currentPath.points[0]=t,this.currentPath.points[1]=e,this},h.prototype.lineTo=function(t,e){this.currentPath||this.moveTo(0,0);var i=this.currentPath.points,r=i[i.length-2],n=i[i.length-1];return r===t&&n===e||i.push(t,e),this},h.prototype._initCurve=function(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.currentPath?0===this.currentPath.points.length&&(this.currentPath.points=[t,e]):this.moveTo(t,e)},h.prototype.quadraticCurveTo=function(t,e,i,r){this._initCurve();var n=this.currentPath.points;return 0===n.length&&this.moveTo(0,0),M.curveTo(t,e,i,r,n),this},h.prototype.bezierCurveTo=function(t,e,i,r,n,s){return this._initCurve(),w.curveTo(t,e,i,r,n,s,this.currentPath.points),this},h.prototype.arcTo=function(t,e,i,r,n){this._initCurve(t,e);var s=this.currentPath.points,h=S.curveTo(t,e,i,r,n,s);if(h){var a=h.cx,o=h.cy,l=h.radius,u=h.startAngle,p=h.endAngle,c=h.anticlockwise;this.arc(a,o,l,u,p,c)}return this},h.prototype.arc=function(t,e,r,n,s,h){if(void 0===h&&(h=!1),n===s)return this;if(!h&&s<=n?s+=i.PI_2:h&&n<=s&&(n+=i.PI_2),0===s-n)return this;var a=t+Math.cos(n)*r,o=e+Math.sin(n)*r,l=this._geometry.closePointEps,u=this.currentPath?this.currentPath.points:null;if(u){var p=Math.abs(u[u.length-2]-a),c=Math.abs(u[u.length-1]-o);p<l&&c<l||u.push(a,o)}else this.moveTo(a,o),u=this.currentPath.points;return S.arc(a,o,t,e,r,n,s,h,u),this},h.prototype.beginFill=function(t,i){return void 0===t&&(t=0),void 0===i&&(i=1),this.beginTextureFill({texture:e.Texture.WHITE,color:t,alpha:i})},h.prototype.beginTextureFill=function(t){t=Object.assign({texture:e.Texture.WHITE,color:16777215,alpha:1,matrix:null},t),this.currentPath&&this.startPoly();var i=t.alpha>0;return i?(t.matrix&&(t.matrix=t.matrix.clone(),t.matrix.invert()),Object.assign(this._fillStyle,{visible:i},t)):this._fillStyle.reset(),this},h.prototype.endFill=function(){return this.finishPoly(),this._fillStyle.reset(),this},h.prototype.drawRect=function(t,e,r,n){return this.drawShape(new i.Rectangle(t,e,r,n))},h.prototype.drawRoundedRect=function(t,e,r,n,s){return this.drawShape(new i.RoundedRectangle(t,e,r,n,s))},h.prototype.drawCircle=function(t,e,r){return this.drawShape(new i.Circle(t,e,r))},h.prototype.drawEllipse=function(t,e,r,n){return this.drawShape(new i.Ellipse(t,e,r,n))},h.prototype.drawPolygon=function(){for(var t,e=arguments,r=[],n=0;n<arguments.length;n++)r[n]=e[n];var s=!0,h=r[0];h.points?(s=h.closeStroke,t=h.points):t=Array.isArray(r[0])?r[0]:r;var a=new i.Polygon(t);return a.closeStroke=s,this.drawShape(a),this},h.prototype.drawShape=function(t){return this._holeMode?this._geometry.drawHole(t,this._matrix):this._geometry.drawShape(t,this._fillStyle.clone(),this._lineStyle.clone(),this._matrix),this},h.prototype.clear=function(){return this._geometry.clear(),this._lineStyle.reset(),this._fillStyle.reset(),this._boundsID++,this._matrix=null,this._holeMode=!1,this.currentPath=null,this},h.prototype.isFastRect=function(){var t=this._geometry.graphicsData;return!(1!==t.length||t[0].shape.type!==i.SHAPES.RECT||t[0].matrix||t[0].holes.length||t[0].lineStyle.visible&&t[0].lineStyle.width)},h.prototype._render=function(t){this.finishPoly();var e=this._geometry,i=t.context.supports.uint32Indices;e.updateBatches(i),e.batchable?(this.batchDirty!==e.batchDirty&&this._populateBatches(),this._renderBatched(t)):(t.batch.flush(),this._renderDirect(t))},h.prototype._populateBatches=function(){var t=this._geometry,e=this.blendMode,i=t.batches.length;this.batchTint=-1,this._transformID=-1,this.batchDirty=t.batchDirty,this.batches.length=i,this.vertexData=new Float32Array(t.points);for(var n=0;n<i;n++){var s=t.batches[n],h=s.style.color,a=new Float32Array(this.vertexData.buffer,4*s.attribStart*2,2*s.attribSize),o=new Float32Array(t.uvsFloat32.buffer,4*s.attribStart*2,2*s.attribSize),l={vertexData:a,blendMode:e,indices:new Uint16Array(t.indicesUint16.buffer,2*s.start,s.size),uvs:o,_batchRGB:r.hex2rgb(h),_tintRGB:h,_texture:s.style.texture,alpha:s.style.alpha,worldAlpha:1};this.batches[n]=l}},h.prototype._renderBatched=function(t){if(this.batches.length){t.batch.setObjectRenderer(t.plugins[this.pluginName]),this.calculateVertices(),this.calculateTints();for(var e=0,i=this.batches.length;e<i;e++){var r=this.batches[e];r.worldAlpha=this.worldAlpha*r.alpha,t.plugins[this.pluginName].render(r)}}},h.prototype._renderDirect=function(t){var e=this._resolveDirectShader(t),i=this._geometry,r=this.tint,n=this.worldAlpha,s=e.uniforms,h=i.drawCalls;s.translationMatrix=this.transform.worldTransform,s.tint[0]=(r>>16&255)/255*n,s.tint[1]=(r>>8&255)/255*n,s.tint[2]=(255&r)/255*n,s.tint[3]=n,t.shader.bind(e),t.geometry.bind(i,e),t.state.set(this.state);for(var a=0,o=h.length;a<o;a++)this._renderDrawCallDirect(t,i.drawCalls[a])},h.prototype._renderDrawCallDirect=function(t,e){for(var i=e.texArray,r=e.type,n=e.size,s=e.start,h=i.count,a=0;a<h;a++)t.texture.bind(i.elements[a],a);t.geometry.draw(r,n,s)},h.prototype._resolveDirectShader=function(t){var r=this.shader,n=this.pluginName;if(!r){if(!N[n]){for(var s=t.plugins[n].MAX_TEXTURES,h=new Int32Array(s),a=0;a<s;a++)h[a]=a;var o={tint:new Float32Array([1,1,1,1]),translationMatrix:new i.Matrix,default:e.UniformGroup.from({uSamplers:h},!0)},l=t.plugins[n]._shader.program;N[n]=new e.Shader(l,o)}r=N[n]}return r},h.prototype._calculateBounds=function(){this.finishPoly();var t=this._geometry;if(t.graphicsData.length){var e=t.bounds,i=e.minX,r=e.minY,n=e.maxX,s=e.maxY;this._bounds.addFrame(this.transform,i,r,n,s)}},h.prototype.containsPoint=function(t){return this.worldTransform.applyInverse(t,h._TEMP_POINT),this._geometry.containsPoint(h._TEMP_POINT)},h.prototype.calculateTints=function(){if(this.batchTint!==this.tint){this.batchTint=this.tint;for(var t=r.hex2rgb(this.tint,O),e=0;e<this.batches.length;e++){var i=this.batches[e],n=i._batchRGB,s=(t[0]*n[0]*255<<16)+(t[1]*n[1]*255<<8)+(0|t[2]*n[2]*255);i._tintRGB=(s>>16)+(65280&s)+((255&s)<<16)}}},h.prototype.calculateVertices=function(){var t=this.transform._worldID;if(this._transformID!==t){this._transformID=t;for(var e=this.transform.worldTransform,i=e.a,r=e.b,n=e.c,s=e.d,h=e.tx,a=e.ty,o=this._geometry.points,l=this.vertexData,u=0,p=0;p<o.length;p+=2){var c=o[p],d=o[p+1];l[u++]=i*c+n*d+h,l[u++]=s*d+r*c+a}}},h.prototype.closePath=function(){var t=this.currentPath;return t&&(t.closeStroke=!0,this.finishPoly()),this},h.prototype.setMatrix=function(t){return this._matrix=t,this},h.prototype.beginHole=function(){return this.finishPoly(),this._holeMode=!0,this},h.prototype.endHole=function(){return this.finishPoly(),this._holeMode=!1,this},h.prototype.destroy=function(t){this._geometry.refCount--,0===this._geometry.refCount&&this._geometry.dispose(),this._matrix=null,this.currentPath=null,this._lineStyle.destroy(),this._lineStyle=null,this._fillStyle.destroy(),this._fillStyle=null,this._geometry=null,this.shader=null,this.vertexData=null,this.batches.length=0,this.batches=null,s.prototype.destroy.call(this,t)},h.nextRoundedRectBehavior=!1,h._TEMP_POINT=new i.Point,h}(s.Container),H={buildPoly:d,buildCircle:f,buildRectangle:y,buildRoundedRectangle:b,buildLine:_,ArcUtils:S,BezierUtils:w,QuadraticUtils:M,BatchPart:I,FILL_COMMANDS:E,BATCH_POOL:A,DRAW_CALL_POOL:D};return t.FillStyle=l,t.GRAPHICS_CURVES=o,t.Graphics=U,t.GraphicsData=T,t.GraphicsGeometry=L,t.LineStyle=B,t.graphicsUtils=H,Object.defineProperty(t,"__esModule",{value:!0}),t}({},PIXI,PIXI,PIXI.utils,PIXI,PIXI);Object.assign(this.PIXI,_pixi_graphics); | ||
this.PIXI=this.PIXI||{};var _pixi_graphics=function(t,e,i,r,n,s){"use strict";var h,a;t.LINE_JOIN=void 0,(h=t.LINE_JOIN||(t.LINE_JOIN={})).MITER="miter",h.BEVEL="bevel",h.ROUND="round",t.LINE_CAP=void 0,(a=t.LINE_CAP||(t.LINE_CAP={})).BUTT="butt",a.ROUND="round",a.SQUARE="square";var o={adaptive:!0,maxLength:10,minSegments:8,maxSegments:2048,epsilon:1e-4,_segmentsCount:function(t,e){if(void 0===e&&(e=20),!this.adaptive||!t||isNaN(t))return e;var i=Math.ceil(t/this.maxLength);return i<this.minSegments?i=this.minSegments:i>this.maxSegments&&(i=this.maxSegments),i}},l=function(){function t(){this.color=16777215,this.alpha=1,this.texture=e.Texture.WHITE,this.matrix=null,this.visible=!1,this.reset()}return t.prototype.clone=function(){var e=new t;return e.color=this.color,e.alpha=this.alpha,e.texture=this.texture,e.matrix=this.matrix,e.visible=this.visible,e},t.prototype.reset=function(){this.color=16777215,this.alpha=1,this.texture=e.Texture.WHITE,this.matrix=null,this.visible=!1},t.prototype.destroy=function(){this.texture=null,this.matrix=null},t}(),u=function(t,e){return u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},u(t,e)};function p(t,e){function i(){this.constructor=t}u(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}function c(t,e){var i,r;void 0===e&&(e=!1);var n=t.length;if(!(n<6)){for(var s=0,h=0,a=t[n-2],o=t[n-1];h<n;h+=2){var l=t[h],u=t[h+1];s+=(l-a)*(u+o),a=l,o=u}if(!e&&s>0||e&&s<=0){var p=n/2;for(h=p+p%2;h<n;h+=2){var c=n-h-2,d=n-h-1,f=h,y=h+1;i=[t[f],t[c]],t[c]=i[0],t[f]=i[1],r=[t[y],t[d]],t[d]=r[0],t[y]=r[1]}}}}var d={build:function(t){t.points=t.shape.points.slice()},triangulate:function(t,e){var i=t.points,n=t.holes,s=e.points,h=e.indices;if(i.length>=6){c(i,!1);for(var a=[],o=0;o<n.length;o++){var l=n[o];c(l.points,!0),a.push(i.length/2),i=i.concat(l.points)}var u=r.earcut(i,a,2);if(!u)return;var p=s.length/2;for(o=0;o<u.length;o+=3)h.push(u[o]+p),h.push(u[o+1]+p),h.push(u[o+2]+p);for(o=0;o<i.length;o++)s.push(i[o])}}},f={build:function(t){var e,r,n,s,h,a,o=t.points;if(t.type===i.SHAPES.CIRC){var l=t.shape;e=l.x,r=l.y,h=a=l.radius,n=s=0}else if(t.type===i.SHAPES.ELIP){var u=t.shape;e=u.x,r=u.y,h=u.width,a=u.height,n=s=0}else{var p=t.shape,c=p.width/2,d=p.height/2;e=p.x+c,r=p.y+d,n=c-(h=a=Math.max(0,Math.min(p.radius,Math.min(c,d)))),s=d-a}if(h>=0&&a>=0&&n>=0&&s>=0){var f=Math.ceil(2.3*Math.sqrt(h+a)),y=8*f+(n?4:0)+(s?4:0);if(o.length=y,0!==y){if(0===f)return o.length=8,o[0]=o[6]=e+n,o[1]=o[3]=r+s,o[2]=o[4]=e-n,void(o[5]=o[7]=r-s);var v=0,g=4*f+(n?2:0)+2,b=g,m=y,x=e+(I=n+h),_=e-I,P=r+(E=s);if(o[v++]=x,o[v++]=P,o[--g]=P,o[--g]=_,s){var S=r-E;o[b++]=_,o[b++]=S,o[--m]=S,o[--m]=x}for(var w=1;w<f;w++){var M=Math.PI/2*(w/f);x=e+(I=n+Math.cos(M)*h),_=e-I,P=r+(E=s+Math.sin(M)*a),S=r-E;o[v++]=x,o[v++]=P,o[--g]=P,o[--g]=_,o[b++]=_,o[b++]=S,o[--m]=S,o[--m]=x}var I,E;x=e+(I=n),_=e-I,P=r+(E=s+a),S=r-E;o[v++]=x,o[v++]=P,o[--m]=S,o[--m]=x,n&&(o[v++]=_,o[v++]=P,o[--m]=S,o[--m]=_)}}else o.length=0},triangulate:function(t,e){var r,n,s=t.points,h=e.points,a=e.indices,o=h.length/2,l=o;if(t.type!==i.SHAPES.RREC){var u=t.shape;r=u.x,n=u.y}else{var p=t.shape;r=p.x+p.width/2,n=p.y+p.height/2}var c=t.matrix;h.push(t.matrix?c.a*r+c.c*n+c.tx:r,t.matrix?c.b*r+c.d*n+c.ty:n),o++,h.push(s[0],s[1]);for(var d=2;d<s.length;d+=2)h.push(s[d],s[d+1]),a.push(o++,l,o);a.push(l+1,l,o)}},y={build:function(t){var e=t.shape,i=e.x,r=e.y,n=e.width,s=e.height,h=t.points;h.length=0,h.push(i,r,i+n,r,i+n,r+s,i,r+s)},triangulate:function(t,e){var i=t.points,r=e.points,n=r.length/2;r.push(i[0],i[1],i[2],i[3],i[6],i[7],i[4],i[5]),e.indices.push(n,n+1,n+2,n+1,n+2,n+3)}};function v(t,e,i){return t+(e-t)*i}function g(t,e,i,r,n,s,h){void 0===h&&(h=[]);for(var a=h,o=0,l=0,u=0,p=0,c=0,d=0,f=0,y=0;f<=20;++f)o=v(t,i,y=f/20),l=v(e,r,y),u=v(i,n,y),p=v(r,s,y),c=v(o,u,y),d=v(l,p,y),0===f&&a[a.length-2]===c&&a[a.length-1]===d||a.push(c,d);return a}var b={build:function(t){if(U.nextRoundedRectBehavior)f.build(t);else{var e=t.shape,i=t.points,r=e.x,n=e.y,s=e.width,h=e.height,a=Math.max(0,Math.min(e.radius,Math.min(s,h)/2));i.length=0,a?(g(r,n+a,r,n,r+a,n,i),g(r+s-a,n,r+s,n,r+s,n+a,i),g(r+s,n+h-a,r+s,n+h,r+s-a,n+h,i),g(r+a,n+h,r,n+h,r,n+h-a,i)):i.push(r,n,r+s,n,r+s,n+h,r,n+h)}},triangulate:function(t,e){if(U.nextRoundedRectBehavior)f.triangulate(t,e);else{for(var i=t.points,n=e.points,s=e.indices,h=n.length/2,a=r.earcut(i,null,2),o=0,l=a.length;o<l;o+=3)s.push(a[o]+h),s.push(a[o+1]+h),s.push(a[o+2]+h);for(o=0,l=i.length;o<l;o++)n.push(i[o],i[++o])}}};function m(t,e,i,r,n,s,h,a){var o,l;h?(o=r,l=-i):(o=-r,l=i);var u=t-i*n+o,p=e-r*n+l,c=t+i*s+o,d=e+r*s+l;return a.push(u,p),a.push(c,d),2}function x(t,e,i,r,n,s,h,a){var o=i-t,l=r-e,u=Math.atan2(o,l),p=Math.atan2(n-t,s-e);a&&u<p?u+=2*Math.PI:!a&&u>p&&(p+=2*Math.PI);var c=u,d=p-u,f=Math.abs(d),y=Math.sqrt(o*o+l*l),v=1+(15*f*Math.sqrt(y)/Math.PI>>0),g=d/v;if(c+=g,a){h.push(t,e),h.push(i,r);for(var b=1,m=c;b<v;b++,m+=g)h.push(t,e),h.push(t+Math.sin(m)*y,e+Math.cos(m)*y);h.push(t,e),h.push(n,s)}else{h.push(i,r),h.push(t,e);for(b=1,m=c;b<v;b++,m+=g)h.push(t+Math.sin(m)*y,e+Math.cos(m)*y),h.push(t,e);h.push(n,s),h.push(t,e)}return 2*v}function _(e,r){e.lineStyle.native?function(t,e){var r=0,n=t.shape,s=t.points||n.points,h=n.type!==i.SHAPES.POLY||n.closeStroke;if(0!==s.length){var a=e.points,o=e.indices,l=s.length/2,u=a.length/2,p=u;for(a.push(s[0],s[1]),r=1;r<l;r++)a.push(s[2*r],s[2*r+1]),o.push(p,p+1),p++;h&&o.push(p,u)}}(e,r):function(e,r){var n=e.shape,s=e.points||n.points.slice(),h=r.closePointEps;if(0!==s.length){var a=e.lineStyle,l=new i.Point(s[0],s[1]),u=new i.Point(s[s.length-2],s[s.length-1]),p=n.type!==i.SHAPES.POLY||n.closeStroke,c=Math.abs(l.x-u.x)<h&&Math.abs(l.y-u.y)<h;if(p){s=s.slice(),c&&(s.pop(),s.pop(),u.set(s[s.length-2],s[s.length-1]));var d=.5*(l.x+u.x),f=.5*(u.y+l.y);s.unshift(d,f),s.push(d,f)}var y=r.points,v=s.length/2,g=s.length,b=y.length/2,_=a.width/2,P=_*_,S=a.miterLimit*a.miterLimit,w=s[0],M=s[1],I=s[2],E=s[3],A=0,T=0,D=-(M-E),C=w-I,R=0,L=0,B=Math.sqrt(D*D+C*C);D/=B,C/=B,D*=_,C*=_;var O=a.alignment,N=2*(1-O),U=2*O;p||(a.cap===t.LINE_CAP.ROUND?g+=x(w-D*(N-U)*.5,M-C*(N-U)*.5,w-D*N,M-C*N,w+D*U,M+C*U,y,!0)+2:a.cap===t.LINE_CAP.SQUARE&&(g+=m(w,M,D,C,N,U,!0,y))),y.push(w-D*N,M-C*N),y.push(w+D*U,M+C*U);for(var H=1;H<v-1;++H){w=s[2*(H-1)],M=s[2*(H-1)+1],I=s[2*H],E=s[2*H+1],A=s[2*(H+1)],T=s[2*(H+1)+1],D=-(M-E),C=w-I,D/=B=Math.sqrt(D*D+C*C),C/=B,D*=_,C*=_,R=-(E-T),L=I-A,R/=B=Math.sqrt(R*R+L*L),L/=B,R*=_,L*=_;var j=I-w,F=M-E,z=I-A,q=T-E,k=F*z-q*j,G=k<0;if(Math.abs(k)<.1)y.push(I-D*N,E-C*N),y.push(I+D*U,E+C*U);else{var W=(-D+w)*(-C+E)-(-D+I)*(-C+M),X=(-R+A)*(-L+E)-(-R+I)*(-L+T),J=(j*X-z*W)/k,Y=(q*W-F*X)/k,V=(J-I)*(J-I)+(Y-E)*(Y-E),Q=I+(J-I)*N,Z=E+(Y-E)*N,K=I-(J-I)*U,$=E-(Y-E)*U,tt=G?N:U;V<=Math.min(j*j+F*F,z*z+q*q)+tt*tt*P?a.join===t.LINE_JOIN.BEVEL||V/P>S?(G?(y.push(Q,Z),y.push(I+D*U,E+C*U),y.push(Q,Z),y.push(I+R*U,E+L*U)):(y.push(I-D*N,E-C*N),y.push(K,$),y.push(I-R*N,E-L*N),y.push(K,$)),g+=2):a.join===t.LINE_JOIN.ROUND?G?(y.push(Q,Z),y.push(I+D*U,E+C*U),g+=x(I,E,I+D*U,E+C*U,I+R*U,E+L*U,y,!0)+4,y.push(Q,Z),y.push(I+R*U,E+L*U)):(y.push(I-D*N,E-C*N),y.push(K,$),g+=x(I,E,I-D*N,E-C*N,I-R*N,E-L*N,y,!1)+4,y.push(I-R*N,E-L*N),y.push(K,$)):(y.push(Q,Z),y.push(K,$)):(y.push(I-D*N,E-C*N),y.push(I+D*U,E+C*U),a.join===t.LINE_JOIN.ROUND?g+=G?x(I,E,I+D*U,E+C*U,I+R*U,E+L*U,y,!0)+2:x(I,E,I-D*N,E-C*N,I-R*N,E-L*N,y,!1)+2:a.join===t.LINE_JOIN.MITER&&V/P<=S&&(G?(y.push(K,$),y.push(K,$)):(y.push(Q,Z),y.push(Q,Z)),g+=2),y.push(I-R*N,E-L*N),y.push(I+R*U,E+L*U),g+=2)}}w=s[2*(v-2)],M=s[2*(v-2)+1],I=s[2*(v-1)],D=-(M-(E=s[2*(v-1)+1])),C=w-I,D/=B=Math.sqrt(D*D+C*C),C/=B,D*=_,C*=_,y.push(I-D*N,E-C*N),y.push(I+D*U,E+C*U),p||(a.cap===t.LINE_CAP.ROUND?g+=x(I-D*(N-U)*.5,E-C*(N-U)*.5,I-D*N,E-C*N,I+D*U,E+C*U,y,!1)+2:a.cap===t.LINE_CAP.SQUARE&&(g+=m(I,E,D,C,N,U,!1,y)));var et=r.indices,it=o.epsilon*o.epsilon;for(H=b;H<g+b-2;++H)w=y[2*H],M=y[2*H+1],I=y[2*(H+1)],E=y[2*(H+1)+1],A=y[2*(H+2)],T=y[2*(H+2)+1],Math.abs(w*(E-T)+I*(T-M)+A*(M-E))<it||et.push(H,H+1,H+2)}}(e,r)}var P,S=function(){function t(){}return t.curveTo=function(t,e,i,r,n,s){var h=s[s.length-2],a=s[s.length-1]-e,o=h-t,l=r-e,u=i-t,p=Math.abs(a*u-o*l);if(p<1e-8||0===n)return s[s.length-2]===t&&s[s.length-1]===e||s.push(t,e),null;var c=a*a+o*o,d=l*l+u*u,f=a*l+o*u,y=n*Math.sqrt(c)/p,v=n*Math.sqrt(d)/p,g=y*f/c,b=v*f/d,m=y*u+v*o,x=y*l+v*a,_=o*(v+g),P=a*(v+g),S=u*(y+b),w=l*(y+b);return{cx:m+t,cy:x+e,radius:n,startAngle:Math.atan2(P-x,_-m),endAngle:Math.atan2(w-x,S-m),anticlockwise:o*l>u*a}},t.arc=function(t,e,r,n,s,h,a,l,u){for(var p=a-h,c=o._segmentsCount(Math.abs(p)*s,40*Math.ceil(Math.abs(p)/i.PI_2)),d=p/(2*c),f=2*d,y=Math.cos(d),v=Math.sin(d),g=c-1,b=g%1/g,m=0;m<=g;++m){var x=d+h+f*(m+b*m),_=Math.cos(x),P=-Math.sin(x);u.push((y*_+v*P)*s+r,(y*-P+v*_)*s+n)}},t}(),w=function(){function t(){}return t.curveLength=function(t,e,i,r,n,s,h,a){for(var o=0,l=0,u=0,p=0,c=0,d=0,f=0,y=0,v=0,g=0,b=0,m=t,x=e,_=1;_<=10;++_)g=m-(y=(f=(d=(c=1-(l=_/10))*c)*c)*t+3*d*l*i+3*c*(u=l*l)*n+(p=u*l)*h),b=x-(v=f*e+3*d*l*r+3*c*u*s+p*a),m=y,x=v,o+=Math.sqrt(g*g+b*b);return o},t.curveTo=function(e,i,r,n,s,h,a){var l=a[a.length-2],u=a[a.length-1];a.length-=2;var p=o._segmentsCount(t.curveLength(l,u,e,i,r,n,s,h)),c=0,d=0,f=0,y=0,v=0;a.push(l,u);for(var g=1,b=0;g<=p;++g)f=(d=(c=1-(b=g/p))*c)*c,v=(y=b*b)*b,a.push(f*l+3*d*b*e+3*c*y*r+v*s,f*u+3*d*b*i+3*c*y*n+v*h)},t}(),M=function(){function t(){}return t.curveLength=function(t,e,i,r,n,s){var h=t-2*i+n,a=e-2*r+s,o=2*i-2*t,l=2*r-2*e,u=4*(h*h+a*a),p=4*(h*o+a*l),c=o*o+l*l,d=2*Math.sqrt(u+p+c),f=Math.sqrt(u),y=2*u*f,v=2*Math.sqrt(c),g=p/f;return(y*d+f*p*(d-v)+(4*c*u-p*p)*Math.log((2*f+g+d)/(g+v)))/(4*y)},t.curveTo=function(e,i,r,n,s){for(var h=s[s.length-2],a=s[s.length-1],l=o._segmentsCount(t.curveLength(h,a,e,i,r,n)),u=0,p=0,c=1;c<=l;++c){var d=c/l;u=h+(e-h)*d,p=a+(i-a)*d,s.push(u+(e+(r-e)*d-u)*d,p+(i+(n-i)*d-p)*d)}},t}(),I=function(){function t(){this.reset()}return t.prototype.begin=function(t,e,i){this.reset(),this.style=t,this.start=e,this.attribStart=i},t.prototype.end=function(t,e){this.attribSize=e-this.attribStart,this.size=t-this.start},t.prototype.reset=function(){this.style=null,this.size=0,this.start=0,this.attribStart=0,this.attribSize=0},t}(),E=((P={})[i.SHAPES.POLY]=d,P[i.SHAPES.CIRC]=f,P[i.SHAPES.ELIP]=f,P[i.SHAPES.RECT]=y,P[i.SHAPES.RREC]=b,P),A=[],T=[],D=function(){function t(t,e,i,r){void 0===e&&(e=null),void 0===i&&(i=null),void 0===r&&(r=null),this.points=[],this.holes=[],this.shape=t,this.lineStyle=i,this.fillStyle=e,this.matrix=r,this.type=t.type}return t.prototype.clone=function(){return new t(this.shape,this.fillStyle,this.lineStyle,this.matrix)},t.prototype.destroy=function(){this.shape=null,this.holes.length=0,this.holes=null,this.points.length=0,this.points=null,this.lineStyle=null,this.fillStyle=null},t}(),C=new i.Point,R=new s.Bounds,L=function(t){function h(){var e=t.call(this)||this;return e.closePointEps=1e-4,e.boundsPadding=0,e.uvsFloat32=null,e.indicesUint16=null,e.batchable=!1,e.points=[],e.colors=[],e.uvs=[],e.indices=[],e.textureIds=[],e.graphicsData=[],e.drawCalls=[],e.batchDirty=-1,e.batches=[],e.dirty=0,e.cacheDirty=-1,e.clearDirty=0,e.shapeIndex=0,e._bounds=new s.Bounds,e.boundsDirty=-1,e}return p(h,t),Object.defineProperty(h.prototype,"bounds",{get:function(){return this.boundsDirty!==this.dirty&&(this.boundsDirty=this.dirty,this.calculateBounds()),this._bounds},enumerable:!1,configurable:!0}),h.prototype.invalidate=function(){this.boundsDirty=-1,this.dirty++,this.batchDirty++,this.shapeIndex=0,this.points.length=0,this.colors.length=0,this.uvs.length=0,this.indices.length=0,this.textureIds.length=0;for(var t=0;t<this.drawCalls.length;t++)this.drawCalls[t].texArray.clear(),T.push(this.drawCalls[t]);this.drawCalls.length=0;for(t=0;t<this.batches.length;t++){var e=this.batches[t];e.reset(),A.push(e)}this.batches.length=0},h.prototype.clear=function(){return this.graphicsData.length>0&&(this.invalidate(),this.clearDirty++,this.graphicsData.length=0),this},h.prototype.drawShape=function(t,e,i,r){void 0===e&&(e=null),void 0===i&&(i=null),void 0===r&&(r=null);var n=new D(t,e,i,r);return this.graphicsData.push(n),this.dirty++,this},h.prototype.drawHole=function(t,e){if(void 0===e&&(e=null),!this.graphicsData.length)return null;var i=new D(t,null,null,e),r=this.graphicsData[this.graphicsData.length-1];return i.lineStyle=r.lineStyle,r.holes.push(i),this.dirty++,this},h.prototype.destroy=function(){t.prototype.destroy.call(this);for(var e=0;e<this.graphicsData.length;++e)this.graphicsData[e].destroy();this.points.length=0,this.points=null,this.colors.length=0,this.colors=null,this.uvs.length=0,this.uvs=null,this.indices.length=0,this.indices=null,this.indexBuffer.destroy(),this.indexBuffer=null,this.graphicsData.length=0,this.graphicsData=null,this.drawCalls.length=0,this.drawCalls=null,this.batches.length=0,this.batches=null,this._bounds=null},h.prototype.containsPoint=function(t){for(var e=this.graphicsData,i=0;i<e.length;++i){var r=e[i];if(r.fillStyle.visible&&(r.shape&&(r.matrix?r.matrix.applyInverse(t,C):C.copyFrom(t),r.shape.contains(C.x,C.y)))){var n=!1;if(r.holes)for(var s=0;s<r.holes.length;s++){if(r.holes[s].shape.contains(C.x,C.y)){n=!0;break}}if(!n)return!0}}return!1},h.prototype.updateBatches=function(t){if(this.graphicsData.length){if(this.validateBatching()){this.cacheDirty=this.dirty;var e=this.uvs,i=this.graphicsData,r=null,s=null;this.batches.length>0&&(s=(r=this.batches[this.batches.length-1]).style);for(var h=this.shapeIndex;h<i.length;h++){this.shapeIndex++;var a=i[h],o=a.fillStyle,l=a.lineStyle;E[a.type].build(a),a.matrix&&this.transformPoints(a.points,a.matrix),(o.visible||l.visible)&&this.processHoles(a.holes);for(var u=0;u<2;u++){var p=0===u?o:l;if(p.visible){var c=p.texture.baseTexture,d=this.indices.length,f=this.points.length/2;c.wrapMode=n.WRAP_MODES.REPEAT,0===u?this.processFill(a):this.processLine(a);var y=this.points.length/2-f;0!==y&&(r&&!this._compareStyles(s,p)&&(r.end(d,f),r=null),r||((r=A.pop()||new I).begin(p,d,f),this.batches.push(r),s=p),this.addUvs(this.points,e,p.texture,f,y,p.matrix))}}}var v=this.indices.length,g=this.points.length/2;if(r&&r.end(v,g),0!==this.batches.length){if(this.indicesUint16&&this.indices.length===this.indicesUint16.length)this.indicesUint16.set(this.indices);else{var b=g>65535&&t;this.indicesUint16=b?new Uint32Array(this.indices):new Uint16Array(this.indices)}this.batchable=this.isBatchable(),this.batchable?this.packBatches():this.buildDrawCalls()}else this.batchable=!0}}else this.batchable=!0},h.prototype._compareStyles=function(t,e){return!(!t||!e)&&(t.texture.baseTexture===e.texture.baseTexture&&(t.color+t.alpha===e.color+e.alpha&&!!t.native==!!e.native))},h.prototype.validateBatching=function(){if(this.dirty===this.cacheDirty||!this.graphicsData.length)return!1;for(var t=0,e=this.graphicsData.length;t<e;t++){var i=this.graphicsData[t],r=i.fillStyle,n=i.lineStyle;if(r&&!r.texture.baseTexture.valid)return!1;if(n&&!n.texture.baseTexture.valid)return!1}return!0},h.prototype.packBatches=function(){this.batchDirty++,this.uvsFloat32=new Float32Array(this.uvs);for(var t=this.batches,e=0,i=t.length;e<i;e++)for(var r=t[e],n=0;n<r.size;n++){var s=r.start+n;this.indicesUint16[s]=this.indicesUint16[s]-r.attribStart}},h.prototype.isBatchable=function(){if(this.points.length>131070)return!1;for(var t=this.batches,e=0;e<t.length;e++)if(t[e].style.native)return!1;return this.points.length<2*h.BATCHABLE_SIZE},h.prototype.buildDrawCalls=function(){for(var t=++e.BaseTexture._globalBatch,i=0;i<this.drawCalls.length;i++)this.drawCalls[i].texArray.clear(),T.push(this.drawCalls[i]);this.drawCalls.length=0;var r=this.colors,s=this.textureIds,h=T.pop();h||((h=new e.BatchDrawCall).texArray=new e.BatchTextureArray),h.texArray.count=0,h.start=0,h.size=0,h.type=n.DRAW_MODES.TRIANGLES;var a=0,o=null,l=0,u=!1,p=n.DRAW_MODES.TRIANGLES,c=0;this.drawCalls.push(h);for(i=0;i<this.batches.length;i++){var d=this.batches[i],f=d.style,y=f.texture.baseTexture;u!==!!f.native&&(p=(u=!!f.native)?n.DRAW_MODES.LINES:n.DRAW_MODES.TRIANGLES,o=null,a=8,t++),o!==y&&(o=y,y._batchEnabled!==t&&(8===a&&(t++,a=0,h.size>0&&((h=T.pop())||((h=new e.BatchDrawCall).texArray=new e.BatchTextureArray),this.drawCalls.push(h)),h.start=c,h.size=0,h.texArray.count=0,h.type=p),y.touched=1,y._batchEnabled=t,y._batchLocation=a,y.wrapMode=n.WRAP_MODES.REPEAT,h.texArray.elements[h.texArray.count++]=y,a++)),h.size+=d.size,c+=d.size,l=y._batchLocation,this.addColors(r,f.color,f.alpha,d.attribSize,d.attribStart),this.addTextureIds(s,l,d.attribSize,d.attribStart)}e.BaseTexture._globalBatch=t,this.packAttributes()},h.prototype.packAttributes=function(){for(var t=this.points,e=this.uvs,i=this.colors,r=this.textureIds,n=new ArrayBuffer(3*t.length*4),s=new Float32Array(n),h=new Uint32Array(n),a=0,o=0;o<t.length/2;o++)s[a++]=t[2*o],s[a++]=t[2*o+1],s[a++]=e[2*o],s[a++]=e[2*o+1],h[a++]=i[o],s[a++]=r[o];this._buffer.update(n),this._indexBuffer.update(this.indicesUint16)},h.prototype.processFill=function(t){t.holes.length?d.triangulate(t,this):E[t.type].triangulate(t,this)},h.prototype.processLine=function(t){_(t,this);for(var e=0;e<t.holes.length;e++)_(t.holes[e],this)},h.prototype.processHoles=function(t){for(var e=0;e<t.length;e++){var i=t[e];E[i.type].build(i),i.matrix&&this.transformPoints(i.points,i.matrix)}},h.prototype.calculateBounds=function(){var t=this._bounds,e=R,r=i.Matrix.IDENTITY;this._bounds.clear(),e.clear();for(var n=0;n<this.graphicsData.length;n++){var s=this.graphicsData[n],h=s.shape,a=s.type,o=s.lineStyle,l=s.matrix||i.Matrix.IDENTITY,u=0;if(o&&o.visible&&(u=o.width,a!==i.SHAPES.POLY||s.fillStyle.visible?u*=Math.max(0,o.alignment):u*=Math.max(o.alignment,1-o.alignment)),r!==l&&(e.isEmpty()||(t.addBoundsMatrix(e,r),e.clear()),r=l),a===i.SHAPES.RECT||a===i.SHAPES.RREC){var p=h;e.addFramePad(p.x,p.y,p.x+p.width,p.y+p.height,u,u)}else if(a===i.SHAPES.CIRC){var c=h;e.addFramePad(c.x,c.y,c.x,c.y,c.radius+u,c.radius+u)}else if(a===i.SHAPES.ELIP){var d=h;e.addFramePad(d.x,d.y,d.x,d.y,d.width+u,d.height+u)}else{var f=h;t.addVerticesMatrix(r,f.points,0,f.points.length,u,u)}}e.isEmpty()||t.addBoundsMatrix(e,r),t.pad(this.boundsPadding,this.boundsPadding)},h.prototype.transformPoints=function(t,e){for(var i=0;i<t.length/2;i++){var r=t[2*i],n=t[2*i+1];t[2*i]=e.a*r+e.c*n+e.tx,t[2*i+1]=e.b*r+e.d*n+e.ty}},h.prototype.addColors=function(t,e,i,n,s){void 0===s&&(s=0);var h=(e>>16)+(65280&e)+((255&e)<<16),a=r.premultiplyTint(h,i);t.length=Math.max(t.length,s+n);for(var o=0;o<n;o++)t[s+o]=a},h.prototype.addTextureIds=function(t,e,i,r){void 0===r&&(r=0),t.length=Math.max(t.length,r+i);for(var n=0;n<i;n++)t[r+n]=e},h.prototype.addUvs=function(t,e,i,r,n,s){void 0===s&&(s=null);for(var h=0,a=e.length,o=i.frame;h<n;){var l=t[2*(r+h)],u=t[2*(r+h)+1];if(s){var p=s.a*l+s.c*u+s.tx;u=s.b*l+s.d*u+s.ty,l=p}h++,e.push(l/o.width,u/o.height)}var c=i.baseTexture;(o.width<c.width||o.height<c.height)&&this.adjustUvs(e,i,a,n)},h.prototype.adjustUvs=function(t,e,i,r){for(var n=e.baseTexture,s=1e-6,h=i+2*r,a=e.frame,o=a.width/n.width,l=a.height/n.height,u=a.x/a.width,p=a.y/a.height,c=Math.floor(t[i]+s),d=Math.floor(t[i+1]+s),f=i+2;f<h;f+=2)c=Math.min(c,Math.floor(t[f]+s)),d=Math.min(d,Math.floor(t[f+1]+s));u-=c,p-=d;for(f=i;f<h;f+=2)t[f]=(t[f]+u)*o,t[f+1]=(t[f+1]+p)*l},h.BATCHABLE_SIZE=100,h}(e.BatchGeometry),B=function(e){function i(){var i=null!==e&&e.apply(this,arguments)||this;return i.width=0,i.alignment=.5,i.native=!1,i.cap=t.LINE_CAP.BUTT,i.join=t.LINE_JOIN.MITER,i.miterLimit=10,i}return p(i,e),i.prototype.clone=function(){var t=new i;return t.color=this.color,t.alpha=this.alpha,t.texture=this.texture,t.matrix=this.matrix,t.visible=this.visible,t.width=this.width,t.alignment=this.alignment,t.native=this.native,t.cap=this.cap,t.join=this.join,t.miterLimit=this.miterLimit,t},i.prototype.reset=function(){e.prototype.reset.call(this),this.color=0,this.alignment=.5,this.width=0,this.native=!1},i}(l),O=new Float32Array(3),N={},U=function(s){function h(t){void 0===t&&(t=null);var i=s.call(this)||this;return i.shader=null,i.pluginName="batch",i.currentPath=null,i.batches=[],i.batchTint=-1,i.batchDirty=-1,i.vertexData=null,i._fillStyle=new l,i._lineStyle=new B,i._matrix=null,i._holeMode=!1,i.state=e.State.for2d(),i._geometry=t||new L,i._geometry.refCount++,i._transformID=-1,i.tint=16777215,i.blendMode=n.BLEND_MODES.NORMAL,i}return p(h,s),Object.defineProperty(h.prototype,"geometry",{get:function(){return this._geometry},enumerable:!1,configurable:!0}),h.prototype.clone=function(){return this.finishPoly(),new h(this._geometry)},Object.defineProperty(h.prototype,"blendMode",{get:function(){return this.state.blendMode},set:function(t){this.state.blendMode=t},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"tint",{get:function(){return this._tint},set:function(t){this._tint=t},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"fill",{get:function(){return this._fillStyle},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"line",{get:function(){return this._lineStyle},enumerable:!1,configurable:!0}),h.prototype.lineStyle=function(t,e,i,r,n){return void 0===t&&(t=null),void 0===e&&(e=0),void 0===i&&(i=1),void 0===r&&(r=.5),void 0===n&&(n=!1),"number"==typeof t&&(t={width:t,color:e,alpha:i,alignment:r,native:n}),this.lineTextureStyle(t)},h.prototype.lineTextureStyle=function(i){i=Object.assign({width:0,texture:e.Texture.WHITE,color:i&&i.texture?16777215:0,alpha:1,matrix:null,alignment:.5,native:!1,cap:t.LINE_CAP.BUTT,join:t.LINE_JOIN.MITER,miterLimit:10},i),this.currentPath&&this.startPoly();var r=i.width>0&&i.alpha>0;return r?(i.matrix&&(i.matrix=i.matrix.clone(),i.matrix.invert()),Object.assign(this._lineStyle,{visible:r},i)):this._lineStyle.reset(),this},h.prototype.startPoly=function(){if(this.currentPath){var t=this.currentPath.points,e=this.currentPath.points.length;e>2&&(this.drawShape(this.currentPath),this.currentPath=new i.Polygon,this.currentPath.closeStroke=!1,this.currentPath.points.push(t[e-2],t[e-1]))}else this.currentPath=new i.Polygon,this.currentPath.closeStroke=!1},h.prototype.finishPoly=function(){this.currentPath&&(this.currentPath.points.length>2?(this.drawShape(this.currentPath),this.currentPath=null):this.currentPath.points.length=0)},h.prototype.moveTo=function(t,e){return this.startPoly(),this.currentPath.points[0]=t,this.currentPath.points[1]=e,this},h.prototype.lineTo=function(t,e){this.currentPath||this.moveTo(0,0);var i=this.currentPath.points,r=i[i.length-2],n=i[i.length-1];return r===t&&n===e||i.push(t,e),this},h.prototype._initCurve=function(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.currentPath?0===this.currentPath.points.length&&(this.currentPath.points=[t,e]):this.moveTo(t,e)},h.prototype.quadraticCurveTo=function(t,e,i,r){this._initCurve();var n=this.currentPath.points;return 0===n.length&&this.moveTo(0,0),M.curveTo(t,e,i,r,n),this},h.prototype.bezierCurveTo=function(t,e,i,r,n,s){return this._initCurve(),w.curveTo(t,e,i,r,n,s,this.currentPath.points),this},h.prototype.arcTo=function(t,e,i,r,n){this._initCurve(t,e);var s=this.currentPath.points,h=S.curveTo(t,e,i,r,n,s);if(h){var a=h.cx,o=h.cy,l=h.radius,u=h.startAngle,p=h.endAngle,c=h.anticlockwise;this.arc(a,o,l,u,p,c)}return this},h.prototype.arc=function(t,e,r,n,s,h){if(void 0===h&&(h=!1),n===s)return this;if(!h&&s<=n?s+=i.PI_2:h&&n<=s&&(n+=i.PI_2),0===s-n)return this;var a=t+Math.cos(n)*r,o=e+Math.sin(n)*r,l=this._geometry.closePointEps,u=this.currentPath?this.currentPath.points:null;if(u){var p=Math.abs(u[u.length-2]-a),c=Math.abs(u[u.length-1]-o);p<l&&c<l||u.push(a,o)}else this.moveTo(a,o),u=this.currentPath.points;return S.arc(a,o,t,e,r,n,s,h,u),this},h.prototype.beginFill=function(t,i){return void 0===t&&(t=0),void 0===i&&(i=1),this.beginTextureFill({texture:e.Texture.WHITE,color:t,alpha:i})},h.prototype.beginTextureFill=function(t){t=Object.assign({texture:e.Texture.WHITE,color:16777215,alpha:1,matrix:null},t),this.currentPath&&this.startPoly();var i=t.alpha>0;return i?(t.matrix&&(t.matrix=t.matrix.clone(),t.matrix.invert()),Object.assign(this._fillStyle,{visible:i},t)):this._fillStyle.reset(),this},h.prototype.endFill=function(){return this.finishPoly(),this._fillStyle.reset(),this},h.prototype.drawRect=function(t,e,r,n){return this.drawShape(new i.Rectangle(t,e,r,n))},h.prototype.drawRoundedRect=function(t,e,r,n,s){return this.drawShape(new i.RoundedRectangle(t,e,r,n,s))},h.prototype.drawCircle=function(t,e,r){return this.drawShape(new i.Circle(t,e,r))},h.prototype.drawEllipse=function(t,e,r,n){return this.drawShape(new i.Ellipse(t,e,r,n))},h.prototype.drawPolygon=function(){for(var t,e=arguments,r=[],n=0;n<arguments.length;n++)r[n]=e[n];var s=!0,h=r[0];h.points?(s=h.closeStroke,t=h.points):t=Array.isArray(r[0])?r[0]:r;var a=new i.Polygon(t);return a.closeStroke=s,this.drawShape(a),this},h.prototype.drawShape=function(t){return this._holeMode?this._geometry.drawHole(t,this._matrix):this._geometry.drawShape(t,this._fillStyle.clone(),this._lineStyle.clone(),this._matrix),this},h.prototype.clear=function(){return this._geometry.clear(),this._lineStyle.reset(),this._fillStyle.reset(),this._boundsID++,this._matrix=null,this._holeMode=!1,this.currentPath=null,this},h.prototype.isFastRect=function(){var t=this._geometry.graphicsData;return!(1!==t.length||t[0].shape.type!==i.SHAPES.RECT||t[0].matrix||t[0].holes.length||t[0].lineStyle.visible&&t[0].lineStyle.width)},h.prototype._render=function(t){this.finishPoly();var e=this._geometry,i=t.context.supports.uint32Indices;e.updateBatches(i),e.batchable?(this.batchDirty!==e.batchDirty&&this._populateBatches(),this._renderBatched(t)):(t.batch.flush(),this._renderDirect(t))},h.prototype._populateBatches=function(){var t=this._geometry,e=this.blendMode,i=t.batches.length;this.batchTint=-1,this._transformID=-1,this.batchDirty=t.batchDirty,this.batches.length=i,this.vertexData=new Float32Array(t.points);for(var n=0;n<i;n++){var s=t.batches[n],h=s.style.color,a=new Float32Array(this.vertexData.buffer,4*s.attribStart*2,2*s.attribSize),o=new Float32Array(t.uvsFloat32.buffer,4*s.attribStart*2,2*s.attribSize),l={vertexData:a,blendMode:e,indices:new Uint16Array(t.indicesUint16.buffer,2*s.start,s.size),uvs:o,_batchRGB:r.hex2rgb(h),_tintRGB:h,_texture:s.style.texture,alpha:s.style.alpha,worldAlpha:1};this.batches[n]=l}},h.prototype._renderBatched=function(t){if(this.batches.length){t.batch.setObjectRenderer(t.plugins[this.pluginName]),this.calculateVertices(),this.calculateTints();for(var e=0,i=this.batches.length;e<i;e++){var r=this.batches[e];r.worldAlpha=this.worldAlpha*r.alpha,t.plugins[this.pluginName].render(r)}}},h.prototype._renderDirect=function(t){var e=this._resolveDirectShader(t),i=this._geometry,r=this.tint,n=this.worldAlpha,s=e.uniforms,h=i.drawCalls;s.translationMatrix=this.transform.worldTransform,s.tint[0]=(r>>16&255)/255*n,s.tint[1]=(r>>8&255)/255*n,s.tint[2]=(255&r)/255*n,s.tint[3]=n,t.shader.bind(e),t.geometry.bind(i,e),t.state.set(this.state);for(var a=0,o=h.length;a<o;a++)this._renderDrawCallDirect(t,i.drawCalls[a])},h.prototype._renderDrawCallDirect=function(t,e){for(var i=e.texArray,r=e.type,n=e.size,s=e.start,h=i.count,a=0;a<h;a++)t.texture.bind(i.elements[a],a);t.geometry.draw(r,n,s)},h.prototype._resolveDirectShader=function(t){var r=this.shader,n=this.pluginName;if(!r){if(!N[n]){for(var s=t.plugins[n].MAX_TEXTURES,h=new Int32Array(s),a=0;a<s;a++)h[a]=a;var o={tint:new Float32Array([1,1,1,1]),translationMatrix:new i.Matrix,default:e.UniformGroup.from({uSamplers:h},!0)},l=t.plugins[n]._shader.program;N[n]=new e.Shader(l,o)}r=N[n]}return r},h.prototype._calculateBounds=function(){this.finishPoly();var t=this._geometry;if(t.graphicsData.length){var e=t.bounds,i=e.minX,r=e.minY,n=e.maxX,s=e.maxY;this._bounds.addFrame(this.transform,i,r,n,s)}},h.prototype.containsPoint=function(t){return this.worldTransform.applyInverse(t,h._TEMP_POINT),this._geometry.containsPoint(h._TEMP_POINT)},h.prototype.calculateTints=function(){if(this.batchTint!==this.tint){this.batchTint=this.tint;for(var t=r.hex2rgb(this.tint,O),e=0;e<this.batches.length;e++){var i=this.batches[e],n=i._batchRGB,s=(t[0]*n[0]*255<<16)+(t[1]*n[1]*255<<8)+(0|t[2]*n[2]*255);i._tintRGB=(s>>16)+(65280&s)+((255&s)<<16)}}},h.prototype.calculateVertices=function(){var t=this.transform._worldID;if(this._transformID!==t){this._transformID=t;for(var e=this.transform.worldTransform,i=e.a,r=e.b,n=e.c,s=e.d,h=e.tx,a=e.ty,o=this._geometry.points,l=this.vertexData,u=0,p=0;p<o.length;p+=2){var c=o[p],d=o[p+1];l[u++]=i*c+n*d+h,l[u++]=s*d+r*c+a}}},h.prototype.closePath=function(){var t=this.currentPath;return t&&(t.closeStroke=!0,this.finishPoly()),this},h.prototype.setMatrix=function(t){return this._matrix=t,this},h.prototype.beginHole=function(){return this.finishPoly(),this._holeMode=!0,this},h.prototype.endHole=function(){return this.finishPoly(),this._holeMode=!1,this},h.prototype.destroy=function(t){this._geometry.refCount--,0===this._geometry.refCount&&this._geometry.dispose(),this._matrix=null,this.currentPath=null,this._lineStyle.destroy(),this._lineStyle=null,this._fillStyle.destroy(),this._fillStyle=null,this._geometry=null,this.shader=null,this.vertexData=null,this.batches.length=0,this.batches=null,s.prototype.destroy.call(this,t)},h.nextRoundedRectBehavior=!1,h._TEMP_POINT=new i.Point,h}(s.Container),H={buildPoly:d,buildCircle:f,buildRectangle:y,buildRoundedRectangle:b,buildLine:_,ArcUtils:S,BezierUtils:w,QuadraticUtils:M,BatchPart:I,FILL_COMMANDS:E,BATCH_POOL:A,DRAW_CALL_POOL:T};return t.FillStyle=l,t.GRAPHICS_CURVES=o,t.Graphics=U,t.GraphicsData=D,t.GraphicsGeometry=L,t.LineStyle=B,t.graphicsUtils=H,Object.defineProperty(t,"__esModule",{value:!0}),t}({},PIXI,PIXI,PIXI.utils,PIXI,PIXI);Object.assign(this.PIXI,_pixi_graphics); | ||
//# sourceMappingURL=graphics.min.js.map |
/*! | ||
* @pixi/graphics - v6.3.2 | ||
* Compiled Wed, 04 May 2022 17:49:13 UTC | ||
* @pixi/graphics - v6.4.0 | ||
* Compiled Wed, 01 Jun 2022 21:14:23 UTC | ||
* | ||
@@ -8,3 +8,3 @@ * @pixi/graphics is licensed under the MIT License. | ||
*/ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t,e,i=require("@pixi/core"),r=require("@pixi/math"),s=require("@pixi/utils"),n=require("@pixi/constants"),h=require("@pixi/display");exports.LINE_JOIN=void 0,(t=exports.LINE_JOIN||(exports.LINE_JOIN={})).MITER="miter",t.BEVEL="bevel",t.ROUND="round",exports.LINE_CAP=void 0,(e=exports.LINE_CAP||(exports.LINE_CAP={})).BUTT="butt",e.ROUND="round",e.SQUARE="square";var a={adaptive:!0,maxLength:10,minSegments:8,maxSegments:2048,epsilon:1e-4,_segmentsCount:function(t,e){if(void 0===e&&(e=20),!this.adaptive||!t||isNaN(t))return e;var i=Math.ceil(t/this.maxLength);return i<this.minSegments?i=this.minSegments:i>this.maxSegments&&(i=this.maxSegments),i}},o=function(){function t(){this.color=16777215,this.alpha=1,this.texture=i.Texture.WHITE,this.matrix=null,this.visible=!1,this.reset()}return t.prototype.clone=function(){var e=new t;return e.color=this.color,e.alpha=this.alpha,e.texture=this.texture,e.matrix=this.matrix,e.visible=this.visible,e},t.prototype.reset=function(){this.color=16777215,this.alpha=1,this.texture=i.Texture.WHITE,this.matrix=null,this.visible=!1},t.prototype.destroy=function(){this.texture=null,this.matrix=null},t}(),l=function(t,e){return l=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},l(t,e)};function u(t,e){function i(){this.constructor=t}l(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}function p(t,e){var i,r;void 0===e&&(e=!1);var s=t.length;if(!(s<6)){for(var n=0,h=0,a=t[s-2],o=t[s-1];h<s;h+=2){var l=t[h],u=t[h+1];n+=(l-a)*(u+o),a=l,o=u}if(!e&&n>0||e&&n<=0){var p=s/2;for(h=p+p%2;h<s;h+=2){var c=s-h-2,d=s-h-1,f=h,y=h+1;i=[t[f],t[c]],t[c]=i[0],t[f]=i[1],r=[t[y],t[d]],t[d]=r[0],t[y]=r[1]}}}}var c={build:function(t){t.points=t.shape.points.slice()},triangulate:function(t,e){var i=t.points,r=t.holes,n=e.points,h=e.indices;if(i.length>=6){p(i,!1);for(var a=[],o=0;o<r.length;o++){var l=r[o];p(l.points,!0),a.push(i.length/2),i=i.concat(l.points)}var u=s.earcut(i,a,2);if(!u)return;var c=n.length/2;for(o=0;o<u.length;o+=3)h.push(u[o]+c),h.push(u[o+1]+c),h.push(u[o+2]+c);for(o=0;o<i.length;o++)n.push(i[o])}}},d={build:function(t){var e,i,s,n,h,a,o=t.points;if(t.type===r.SHAPES.CIRC){var l=t.shape;e=l.x,i=l.y,h=a=l.radius,s=n=0}else if(t.type===r.SHAPES.ELIP){var u=t.shape;e=u.x,i=u.y,h=u.width,a=u.height,s=n=0}else{var p=t.shape,c=p.width/2,d=p.height/2;e=p.x+c,i=p.y+d,s=c-(h=a=Math.max(0,Math.min(p.radius,Math.min(c,d)))),n=d-a}var f=Math.ceil(2.3*Math.sqrt(h+a)),y=8*f+(s?4:0)+(n?4:0);if(o.length=y,0!==y){if(0===f)return o.length=8,o[0]=o[6]=e+s,o[1]=o[3]=i+n,o[2]=o[4]=e-s,void(o[5]=o[7]=i-n);var v=0,g=4*f+(s?2:0)+2,b=g,x=y,m=e+(E=s+h),_=e-E,S=i+(A=n);if(o[v++]=m,o[v++]=S,o[--g]=S,o[--g]=_,n){var P=i-A;o[b++]=_,o[b++]=P,o[--x]=P,o[--x]=m}for(var w=1;w<f;w++){var M=Math.PI/2*(w/f);m=e+(E=s+Math.cos(M)*h),_=e-E,S=i+(A=n+Math.sin(M)*a),P=i-A;o[v++]=m,o[v++]=S,o[--g]=S,o[--g]=_,o[b++]=_,o[b++]=P,o[--x]=P,o[--x]=m}var E,A;m=e+(E=s),_=e-E,S=i+(A=n+a),P=i-A;o[v++]=m,o[v++]=S,o[--x]=P,o[--x]=m,s&&(o[v++]=_,o[v++]=S,o[--x]=P,o[--x]=_)}},triangulate:function(t,e){var i,s,n=t.points,h=e.points,a=e.indices,o=h.length/2,l=o;if(t.type!==r.SHAPES.RREC){var u=t.shape;i=u.x,s=u.y}else{var p=t.shape;i=p.x+p.width/2,s=p.y+p.height/2}var c=t.matrix;h.push(t.matrix?c.a*i+c.c*s+c.tx:i,t.matrix?c.b*i+c.d*s+c.ty:s),o++,h.push(n[0],n[1]);for(var d=2;d<n.length;d+=2)h.push(n[d],n[d+1]),a.push(o++,l,o);a.push(l+1,l,o)}},f={build:function(t){var e=t.shape,i=e.x,r=e.y,s=e.width,n=e.height,h=t.points;h.length=0,h.push(i,r,i+s,r,i+s,r+n,i,r+n)},triangulate:function(t,e){var i=t.points,r=e.points,s=r.length/2;r.push(i[0],i[1],i[2],i[3],i[6],i[7],i[4],i[5]),e.indices.push(s,s+1,s+2,s+1,s+2,s+3)}};function y(t,e,i){return t+(e-t)*i}function v(t,e,i,r,s,n,h){void 0===h&&(h=[]);for(var a=h,o=0,l=0,u=0,p=0,c=0,d=0,f=0,v=0;f<=20;++f)o=y(t,i,v=f/20),l=y(e,r,v),u=y(i,s,v),p=y(r,n,v),c=y(o,u,v),d=y(l,p,v),0===f&&a[a.length-2]===c&&a[a.length-1]===d||a.push(c,d);return a}var g={build:function(t){if(O.nextRoundedRectBehavior)d.build(t);else{var e=t.shape,i=t.points,r=e.x,s=e.y,n=e.width,h=e.height,a=Math.max(0,Math.min(e.radius,Math.min(n,h)/2));i.length=0,a?(v(r,s+a,r,s,r+a,s,i),v(r+n-a,s,r+n,s,r+n,s+a,i),v(r+n,s+h-a,r+n,s+h,r+n-a,s+h,i),v(r+a,s+h,r,s+h,r,s+h-a,i)):i.push(r,s,r+n,s,r+n,s+h,r,s+h)}},triangulate:function(t,e){if(O.nextRoundedRectBehavior)d.triangulate(t,e);else{for(var i=t.points,r=e.points,n=e.indices,h=r.length/2,a=s.earcut(i,null,2),o=0,l=a.length;o<l;o+=3)n.push(a[o]+h),n.push(a[o+1]+h),n.push(a[o+2]+h);for(o=0,l=i.length;o<l;o++)r.push(i[o],i[++o])}}};function b(t,e,i,r,s,n,h,a){var o,l;h?(o=r,l=-i):(o=-r,l=i);var u=t-i*s+o,p=e-r*s+l,c=t+i*n+o,d=e+r*n+l;return a.push(u,p),a.push(c,d),2}function x(t,e,i,r,s,n,h,a){var o=i-t,l=r-e,u=Math.atan2(o,l),p=Math.atan2(s-t,n-e);a&&u<p?u+=2*Math.PI:!a&&u>p&&(p+=2*Math.PI);var c=u,d=p-u,f=Math.abs(d),y=Math.sqrt(o*o+l*l),v=1+(15*f*Math.sqrt(y)/Math.PI>>0),g=d/v;if(c+=g,a){h.push(t,e),h.push(i,r);for(var b=1,x=c;b<v;b++,x+=g)h.push(t,e),h.push(t+Math.sin(x)*y,e+Math.cos(x)*y);h.push(t,e),h.push(s,n)}else{h.push(i,r),h.push(t,e);for(b=1,x=c;b<v;b++,x+=g)h.push(t+Math.sin(x)*y,e+Math.cos(x)*y),h.push(t,e);h.push(s,n),h.push(t,e)}return 2*v}function m(t,e){t.lineStyle.native?function(t,e){var i=0,s=t.shape,n=t.points||s.points,h=s.type!==r.SHAPES.POLY||s.closeStroke;if(0!==n.length){var a=e.points,o=e.indices,l=n.length/2,u=a.length/2,p=u;for(a.push(n[0],n[1]),i=1;i<l;i++)a.push(n[2*i],n[2*i+1]),o.push(p,p+1),p++;h&&o.push(p,u)}}(t,e):function(t,e){var i=t.shape,s=t.points||i.points.slice(),n=e.closePointEps;if(0!==s.length){var h=t.lineStyle,o=new r.Point(s[0],s[1]),l=new r.Point(s[s.length-2],s[s.length-1]),u=i.type!==r.SHAPES.POLY||i.closeStroke,p=Math.abs(o.x-l.x)<n&&Math.abs(o.y-l.y)<n;if(u){s=s.slice(),p&&(s.pop(),s.pop(),l.set(s[s.length-2],s[s.length-1]));var c=.5*(o.x+l.x),d=.5*(l.y+o.y);s.unshift(c,d),s.push(c,d)}var f=e.points,y=s.length/2,v=s.length,g=f.length/2,m=h.width/2,_=m*m,S=h.miterLimit*h.miterLimit,P=s[0],w=s[1],M=s[2],E=s[3],A=0,D=0,T=-(w-E),I=P-M,C=0,R=0,L=Math.sqrt(T*T+I*I);T/=L,I/=L,T*=m,I*=m;var B=h.alignment,N=2*(1-B),O=2*B;u||(h.cap===exports.LINE_CAP.ROUND?v+=x(P-T*(N-O)*.5,w-I*(N-O)*.5,P-T*N,w-I*N,P+T*O,w+I*O,f,!0)+2:h.cap===exports.LINE_CAP.SQUARE&&(v+=b(P,w,T,I,N,O,!0,f))),f.push(P-T*N,w-I*N),f.push(P+T*O,w+I*O);for(var U=1;U<y-1;++U){P=s[2*(U-1)],w=s[2*(U-1)+1],M=s[2*U],E=s[2*U+1],A=s[2*(U+1)],D=s[2*(U+1)+1],T=-(w-E),I=P-M,T/=L=Math.sqrt(T*T+I*I),I/=L,T*=m,I*=m,C=-(E-D),R=M-A,C/=L=Math.sqrt(C*C+R*R),R/=L,C*=m,R*=m;var H=M-P,j=w-E,F=M-A,q=D-E,z=j*F-q*H,k=z<0;if(Math.abs(z)<.1)f.push(M-T*N,E-I*N),f.push(M+T*O,E+I*O);else{var G=(-T+P)*(-I+E)-(-T+M)*(-I+w),W=(-C+A)*(-R+E)-(-C+M)*(-R+D),J=(H*W-F*G)/z,Y=(q*G-j*W)/z,V=(J-M)*(J-M)+(Y-E)*(Y-E),Q=M+(J-M)*N,X=E+(Y-E)*N,Z=M-(J-M)*O,K=E-(Y-E)*O,$=k?N:O;V<=Math.min(H*H+j*j,F*F+q*q)+$*$*_?h.join===exports.LINE_JOIN.BEVEL||V/_>S?(k?(f.push(Q,X),f.push(M+T*O,E+I*O),f.push(Q,X),f.push(M+C*O,E+R*O)):(f.push(M-T*N,E-I*N),f.push(Z,K),f.push(M-C*N,E-R*N),f.push(Z,K)),v+=2):h.join===exports.LINE_JOIN.ROUND?k?(f.push(Q,X),f.push(M+T*O,E+I*O),v+=x(M,E,M+T*O,E+I*O,M+C*O,E+R*O,f,!0)+4,f.push(Q,X),f.push(M+C*O,E+R*O)):(f.push(M-T*N,E-I*N),f.push(Z,K),v+=x(M,E,M-T*N,E-I*N,M-C*N,E-R*N,f,!1)+4,f.push(M-C*N,E-R*N),f.push(Z,K)):(f.push(Q,X),f.push(Z,K)):(f.push(M-T*N,E-I*N),f.push(M+T*O,E+I*O),h.join===exports.LINE_JOIN.BEVEL||V/_>S||(h.join===exports.LINE_JOIN.ROUND?v+=k?x(M,E,M+T*O,E+I*O,M+C*O,E+R*O,f,!0)+2:x(M,E,M-T*N,E-I*N,M-C*N,E-R*N,f,!1)+2:(k?(f.push(Z,K),f.push(Z,K)):(f.push(Q,X),f.push(Q,X)),v+=2)),f.push(M-C*N,E-R*N),f.push(M+C*O,E+R*O),v+=2)}}P=s[2*(y-2)],w=s[2*(y-2)+1],M=s[2*(y-1)],T=-(w-(E=s[2*(y-1)+1])),I=P-M,T/=L=Math.sqrt(T*T+I*I),I/=L,T*=m,I*=m,f.push(M-T*N,E-I*N),f.push(M+T*O,E+I*O),u||(h.cap===exports.LINE_CAP.ROUND?v+=x(M-T*(N-O)*.5,E-I*(N-O)*.5,M-T*N,E-I*N,M+T*O,E+I*O,f,!1)+2:h.cap===exports.LINE_CAP.SQUARE&&(v+=b(M,E,T,I,N,O,!1,f)));var tt=e.indices,et=a.epsilon*a.epsilon;for(U=g;U<v+g-2;++U)P=f[2*U],w=f[2*U+1],M=f[2*(U+1)],E=f[2*(U+1)+1],A=f[2*(U+2)],D=f[2*(U+2)+1],Math.abs(P*(E-D)+M*(D-w)+A*(w-E))<et||tt.push(U,U+1,U+2)}}(t,e)}var _,S=function(){function t(){}return t.curveTo=function(t,e,i,r,s,n){var h=n[n.length-2],a=n[n.length-1]-e,o=h-t,l=r-e,u=i-t,p=Math.abs(a*u-o*l);if(p<1e-8||0===s)return n[n.length-2]===t&&n[n.length-1]===e||n.push(t,e),null;var c=a*a+o*o,d=l*l+u*u,f=a*l+o*u,y=s*Math.sqrt(c)/p,v=s*Math.sqrt(d)/p,g=y*f/c,b=v*f/d,x=y*u+v*o,m=y*l+v*a,_=o*(v+g),S=a*(v+g),P=u*(y+b),w=l*(y+b);return{cx:x+t,cy:m+e,radius:s,startAngle:Math.atan2(S-m,_-x),endAngle:Math.atan2(w-m,P-x),anticlockwise:o*l>u*a}},t.arc=function(t,e,i,s,n,h,o,l,u){for(var p=o-h,c=a._segmentsCount(Math.abs(p)*n,40*Math.ceil(Math.abs(p)/r.PI_2)),d=p/(2*c),f=2*d,y=Math.cos(d),v=Math.sin(d),g=c-1,b=g%1/g,x=0;x<=g;++x){var m=d+h+f*(x+b*x),_=Math.cos(m),S=-Math.sin(m);u.push((y*_+v*S)*n+i,(y*-S+v*_)*n+s)}},t}(),P=function(){function t(){}return t.curveLength=function(t,e,i,r,s,n,h,a){for(var o=0,l=0,u=0,p=0,c=0,d=0,f=0,y=0,v=0,g=0,b=0,x=t,m=e,_=1;_<=10;++_)g=x-(y=(f=(d=(c=1-(l=_/10))*c)*c)*t+3*d*l*i+3*c*(u=l*l)*s+(p=u*l)*h),b=m-(v=f*e+3*d*l*r+3*c*u*n+p*a),x=y,m=v,o+=Math.sqrt(g*g+b*b);return o},t.curveTo=function(e,i,r,s,n,h,o){var l=o[o.length-2],u=o[o.length-1];o.length-=2;var p=a._segmentsCount(t.curveLength(l,u,e,i,r,s,n,h)),c=0,d=0,f=0,y=0,v=0;o.push(l,u);for(var g=1,b=0;g<=p;++g)f=(d=(c=1-(b=g/p))*c)*c,v=(y=b*b)*b,o.push(f*l+3*d*b*e+3*c*y*r+v*n,f*u+3*d*b*i+3*c*y*s+v*h)},t}(),w=function(){function t(){}return t.curveLength=function(t,e,i,r,s,n){var h=t-2*i+s,a=e-2*r+n,o=2*i-2*t,l=2*r-2*e,u=4*(h*h+a*a),p=4*(h*o+a*l),c=o*o+l*l,d=2*Math.sqrt(u+p+c),f=Math.sqrt(u),y=2*u*f,v=2*Math.sqrt(c),g=p/f;return(y*d+f*p*(d-v)+(4*c*u-p*p)*Math.log((2*f+g+d)/(g+v)))/(4*y)},t.curveTo=function(e,i,r,s,n){for(var h=n[n.length-2],o=n[n.length-1],l=a._segmentsCount(t.curveLength(h,o,e,i,r,s)),u=0,p=0,c=1;c<=l;++c){var d=c/l;u=h+(e-h)*d,p=o+(i-o)*d,n.push(u+(e+(r-e)*d-u)*d,p+(i+(s-i)*d-p)*d)}},t}(),M=function(){function t(){this.reset()}return t.prototype.begin=function(t,e,i){this.reset(),this.style=t,this.start=e,this.attribStart=i},t.prototype.end=function(t,e){this.attribSize=e-this.attribStart,this.size=t-this.start},t.prototype.reset=function(){this.style=null,this.size=0,this.start=0,this.attribStart=0,this.attribSize=0},t}(),E=((_={})[r.SHAPES.POLY]=c,_[r.SHAPES.CIRC]=d,_[r.SHAPES.ELIP]=d,_[r.SHAPES.RECT]=f,_[r.SHAPES.RREC]=g,_),A=[],D=[],T=function(){function t(t,e,i,r){void 0===e&&(e=null),void 0===i&&(i=null),void 0===r&&(r=null),this.points=[],this.holes=[],this.shape=t,this.lineStyle=i,this.fillStyle=e,this.matrix=r,this.type=t.type}return t.prototype.clone=function(){return new t(this.shape,this.fillStyle,this.lineStyle,this.matrix)},t.prototype.destroy=function(){this.shape=null,this.holes.length=0,this.holes=null,this.points.length=0,this.points=null,this.lineStyle=null,this.fillStyle=null},t}(),I=new r.Point,C=new h.Bounds,R=function(t){function e(){var e=t.call(this)||this;return e.closePointEps=1e-4,e.boundsPadding=0,e.uvsFloat32=null,e.indicesUint16=null,e.batchable=!1,e.points=[],e.colors=[],e.uvs=[],e.indices=[],e.textureIds=[],e.graphicsData=[],e.drawCalls=[],e.batchDirty=-1,e.batches=[],e.dirty=0,e.cacheDirty=-1,e.clearDirty=0,e.shapeIndex=0,e._bounds=new h.Bounds,e.boundsDirty=-1,e}return u(e,t),Object.defineProperty(e.prototype,"bounds",{get:function(){return this.boundsDirty!==this.dirty&&(this.boundsDirty=this.dirty,this.calculateBounds()),this._bounds},enumerable:!1,configurable:!0}),e.prototype.invalidate=function(){this.boundsDirty=-1,this.dirty++,this.batchDirty++,this.shapeIndex=0,this.points.length=0,this.colors.length=0,this.uvs.length=0,this.indices.length=0,this.textureIds.length=0;for(var t=0;t<this.drawCalls.length;t++)this.drawCalls[t].texArray.clear(),D.push(this.drawCalls[t]);this.drawCalls.length=0;for(t=0;t<this.batches.length;t++){var e=this.batches[t];e.reset(),A.push(e)}this.batches.length=0},e.prototype.clear=function(){return this.graphicsData.length>0&&(this.invalidate(),this.clearDirty++,this.graphicsData.length=0),this},e.prototype.drawShape=function(t,e,i,r){void 0===e&&(e=null),void 0===i&&(i=null),void 0===r&&(r=null);var s=new T(t,e,i,r);return this.graphicsData.push(s),this.dirty++,this},e.prototype.drawHole=function(t,e){if(void 0===e&&(e=null),!this.graphicsData.length)return null;var i=new T(t,null,null,e),r=this.graphicsData[this.graphicsData.length-1];return i.lineStyle=r.lineStyle,r.holes.push(i),this.dirty++,this},e.prototype.destroy=function(){t.prototype.destroy.call(this);for(var e=0;e<this.graphicsData.length;++e)this.graphicsData[e].destroy();this.points.length=0,this.points=null,this.colors.length=0,this.colors=null,this.uvs.length=0,this.uvs=null,this.indices.length=0,this.indices=null,this.indexBuffer.destroy(),this.indexBuffer=null,this.graphicsData.length=0,this.graphicsData=null,this.drawCalls.length=0,this.drawCalls=null,this.batches.length=0,this.batches=null,this._bounds=null},e.prototype.containsPoint=function(t){for(var e=this.graphicsData,i=0;i<e.length;++i){var r=e[i];if(r.fillStyle.visible&&(r.shape&&(r.matrix?r.matrix.applyInverse(t,I):I.copyFrom(t),r.shape.contains(I.x,I.y)))){var s=!1;if(r.holes)for(var n=0;n<r.holes.length;n++){if(r.holes[n].shape.contains(I.x,I.y)){s=!0;break}}if(!s)return!0}}return!1},e.prototype.updateBatches=function(t){if(this.graphicsData.length){if(this.validateBatching()){this.cacheDirty=this.dirty;var e=this.uvs,i=this.graphicsData,r=null,s=null;this.batches.length>0&&(s=(r=this.batches[this.batches.length-1]).style);for(var h=this.shapeIndex;h<i.length;h++){this.shapeIndex++;var a=i[h],o=a.fillStyle,l=a.lineStyle;E[a.type].build(a),a.matrix&&this.transformPoints(a.points,a.matrix),(o.visible||l.visible)&&this.processHoles(a.holes);for(var u=0;u<2;u++){var p=0===u?o:l;if(p.visible){var c=p.texture.baseTexture,d=this.indices.length,f=this.points.length/2;c.wrapMode=n.WRAP_MODES.REPEAT,0===u?this.processFill(a):this.processLine(a);var y=this.points.length/2-f;0!==y&&(r&&!this._compareStyles(s,p)&&(r.end(d,f),r=null),r||((r=A.pop()||new M).begin(p,d,f),this.batches.push(r),s=p),this.addUvs(this.points,e,p.texture,f,y,p.matrix))}}}var v=this.indices.length,g=this.points.length/2;if(r&&r.end(v,g),0!==this.batches.length){if(this.indicesUint16&&this.indices.length===this.indicesUint16.length)this.indicesUint16.set(this.indices);else{var b=g>65535&&t;this.indicesUint16=b?new Uint32Array(this.indices):new Uint16Array(this.indices)}this.batchable=this.isBatchable(),this.batchable?this.packBatches():this.buildDrawCalls()}else this.batchable=!0}}else this.batchable=!0},e.prototype._compareStyles=function(t,e){return!(!t||!e)&&(t.texture.baseTexture===e.texture.baseTexture&&(t.color+t.alpha===e.color+e.alpha&&!!t.native==!!e.native))},e.prototype.validateBatching=function(){if(this.dirty===this.cacheDirty||!this.graphicsData.length)return!1;for(var t=0,e=this.graphicsData.length;t<e;t++){var i=this.graphicsData[t],r=i.fillStyle,s=i.lineStyle;if(r&&!r.texture.baseTexture.valid)return!1;if(s&&!s.texture.baseTexture.valid)return!1}return!0},e.prototype.packBatches=function(){this.batchDirty++,this.uvsFloat32=new Float32Array(this.uvs);for(var t=this.batches,e=0,i=t.length;e<i;e++)for(var r=t[e],s=0;s<r.size;s++){var n=r.start+s;this.indicesUint16[n]=this.indicesUint16[n]-r.attribStart}},e.prototype.isBatchable=function(){if(this.points.length>131070)return!1;for(var t=this.batches,i=0;i<t.length;i++)if(t[i].style.native)return!1;return this.points.length<2*e.BATCHABLE_SIZE},e.prototype.buildDrawCalls=function(){for(var t=++i.BaseTexture._globalBatch,e=0;e<this.drawCalls.length;e++)this.drawCalls[e].texArray.clear(),D.push(this.drawCalls[e]);this.drawCalls.length=0;var r=this.colors,s=this.textureIds,h=D.pop();h||((h=new i.BatchDrawCall).texArray=new i.BatchTextureArray),h.texArray.count=0,h.start=0,h.size=0,h.type=n.DRAW_MODES.TRIANGLES;var a=0,o=null,l=0,u=!1,p=n.DRAW_MODES.TRIANGLES,c=0;this.drawCalls.push(h);for(e=0;e<this.batches.length;e++){var d=this.batches[e],f=d.style,y=f.texture.baseTexture;u!==!!f.native&&(p=(u=!!f.native)?n.DRAW_MODES.LINES:n.DRAW_MODES.TRIANGLES,o=null,a=8,t++),o!==y&&(o=y,y._batchEnabled!==t&&(8===a&&(t++,a=0,h.size>0&&((h=D.pop())||((h=new i.BatchDrawCall).texArray=new i.BatchTextureArray),this.drawCalls.push(h)),h.start=c,h.size=0,h.texArray.count=0,h.type=p),y.touched=1,y._batchEnabled=t,y._batchLocation=a,y.wrapMode=n.WRAP_MODES.REPEAT,h.texArray.elements[h.texArray.count++]=y,a++)),h.size+=d.size,c+=d.size,l=y._batchLocation,this.addColors(r,f.color,f.alpha,d.attribSize,d.attribStart),this.addTextureIds(s,l,d.attribSize,d.attribStart)}i.BaseTexture._globalBatch=t,this.packAttributes()},e.prototype.packAttributes=function(){for(var t=this.points,e=this.uvs,i=this.colors,r=this.textureIds,s=new ArrayBuffer(3*t.length*4),n=new Float32Array(s),h=new Uint32Array(s),a=0,o=0;o<t.length/2;o++)n[a++]=t[2*o],n[a++]=t[2*o+1],n[a++]=e[2*o],n[a++]=e[2*o+1],h[a++]=i[o],n[a++]=r[o];this._buffer.update(s),this._indexBuffer.update(this.indicesUint16)},e.prototype.processFill=function(t){t.holes.length?c.triangulate(t,this):E[t.type].triangulate(t,this)},e.prototype.processLine=function(t){m(t,this);for(var e=0;e<t.holes.length;e++)m(t.holes[e],this)},e.prototype.processHoles=function(t){for(var e=0;e<t.length;e++){var i=t[e];E[i.type].build(i),i.matrix&&this.transformPoints(i.points,i.matrix)}},e.prototype.calculateBounds=function(){var t=this._bounds,e=C,i=r.Matrix.IDENTITY;this._bounds.clear(),e.clear();for(var s=0;s<this.graphicsData.length;s++){var n=this.graphicsData[s],h=n.shape,a=n.type,o=n.lineStyle,l=n.matrix||r.Matrix.IDENTITY,u=0;if(o&&o.visible&&(u=o.width,a!==r.SHAPES.POLY||n.fillStyle.visible?u*=Math.max(0,o.alignment):u*=Math.max(o.alignment,1-o.alignment)),i!==l&&(e.isEmpty()||(t.addBoundsMatrix(e,i),e.clear()),i=l),a===r.SHAPES.RECT||a===r.SHAPES.RREC){var p=h;e.addFramePad(p.x,p.y,p.x+p.width,p.y+p.height,u,u)}else if(a===r.SHAPES.CIRC){var c=h;e.addFramePad(c.x,c.y,c.x,c.y,c.radius+u,c.radius+u)}else if(a===r.SHAPES.ELIP){var d=h;e.addFramePad(d.x,d.y,d.x,d.y,d.width+u,d.height+u)}else{var f=h;t.addVerticesMatrix(i,f.points,0,f.points.length,u,u)}}e.isEmpty()||t.addBoundsMatrix(e,i),t.pad(this.boundsPadding,this.boundsPadding)},e.prototype.transformPoints=function(t,e){for(var i=0;i<t.length/2;i++){var r=t[2*i],s=t[2*i+1];t[2*i]=e.a*r+e.c*s+e.tx,t[2*i+1]=e.b*r+e.d*s+e.ty}},e.prototype.addColors=function(t,e,i,r,n){void 0===n&&(n=0);var h=(e>>16)+(65280&e)+((255&e)<<16),a=s.premultiplyTint(h,i);t.length=Math.max(t.length,n+r);for(var o=0;o<r;o++)t[n+o]=a},e.prototype.addTextureIds=function(t,e,i,r){void 0===r&&(r=0),t.length=Math.max(t.length,r+i);for(var s=0;s<i;s++)t[r+s]=e},e.prototype.addUvs=function(t,e,i,r,s,n){void 0===n&&(n=null);for(var h=0,a=e.length,o=i.frame;h<s;){var l=t[2*(r+h)],u=t[2*(r+h)+1];if(n){var p=n.a*l+n.c*u+n.tx;u=n.b*l+n.d*u+n.ty,l=p}h++,e.push(l/o.width,u/o.height)}var c=i.baseTexture;(o.width<c.width||o.height<c.height)&&this.adjustUvs(e,i,a,s)},e.prototype.adjustUvs=function(t,e,i,r){for(var s=e.baseTexture,n=1e-6,h=i+2*r,a=e.frame,o=a.width/s.width,l=a.height/s.height,u=a.x/a.width,p=a.y/a.height,c=Math.floor(t[i]+n),d=Math.floor(t[i+1]+n),f=i+2;f<h;f+=2)c=Math.min(c,Math.floor(t[f]+n)),d=Math.min(d,Math.floor(t[f+1]+n));u-=c,p-=d;for(f=i;f<h;f+=2)t[f]=(t[f]+u)*o,t[f+1]=(t[f+1]+p)*l},e.BATCHABLE_SIZE=100,e}(i.BatchGeometry),L=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.width=0,e.alignment=.5,e.native=!1,e.cap=exports.LINE_CAP.BUTT,e.join=exports.LINE_JOIN.MITER,e.miterLimit=10,e}return u(e,t),e.prototype.clone=function(){var t=new e;return t.color=this.color,t.alpha=this.alpha,t.texture=this.texture,t.matrix=this.matrix,t.visible=this.visible,t.width=this.width,t.alignment=this.alignment,t.native=this.native,t.cap=this.cap,t.join=this.join,t.miterLimit=this.miterLimit,t},e.prototype.reset=function(){t.prototype.reset.call(this),this.color=0,this.alignment=.5,this.width=0,this.native=!1},e}(o),B=new Float32Array(3),N={},O=function(t){function e(e){void 0===e&&(e=null);var r=t.call(this)||this;return r.shader=null,r.pluginName="batch",r.currentPath=null,r.batches=[],r.batchTint=-1,r.batchDirty=-1,r.vertexData=null,r._fillStyle=new o,r._lineStyle=new L,r._matrix=null,r._holeMode=!1,r.state=i.State.for2d(),r._geometry=e||new R,r._geometry.refCount++,r._transformID=-1,r.tint=16777215,r.blendMode=n.BLEND_MODES.NORMAL,r}return u(e,t),Object.defineProperty(e.prototype,"geometry",{get:function(){return this._geometry},enumerable:!1,configurable:!0}),e.prototype.clone=function(){return this.finishPoly(),new e(this._geometry)},Object.defineProperty(e.prototype,"blendMode",{get:function(){return this.state.blendMode},set:function(t){this.state.blendMode=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"tint",{get:function(){return this._tint},set:function(t){this._tint=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fill",{get:function(){return this._fillStyle},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"line",{get:function(){return this._lineStyle},enumerable:!1,configurable:!0}),e.prototype.lineStyle=function(t,e,i,r,s){return void 0===t&&(t=null),void 0===e&&(e=0),void 0===i&&(i=1),void 0===r&&(r=.5),void 0===s&&(s=!1),"number"==typeof t&&(t={width:t,color:e,alpha:i,alignment:r,native:s}),this.lineTextureStyle(t)},e.prototype.lineTextureStyle=function(t){t=Object.assign({width:0,texture:i.Texture.WHITE,color:t&&t.texture?16777215:0,alpha:1,matrix:null,alignment:.5,native:!1,cap:exports.LINE_CAP.BUTT,join:exports.LINE_JOIN.MITER,miterLimit:10},t),this.currentPath&&this.startPoly();var e=t.width>0&&t.alpha>0;return e?(t.matrix&&(t.matrix=t.matrix.clone(),t.matrix.invert()),Object.assign(this._lineStyle,{visible:e},t)):this._lineStyle.reset(),this},e.prototype.startPoly=function(){if(this.currentPath){var t=this.currentPath.points,e=this.currentPath.points.length;e>2&&(this.drawShape(this.currentPath),this.currentPath=new r.Polygon,this.currentPath.closeStroke=!1,this.currentPath.points.push(t[e-2],t[e-1]))}else this.currentPath=new r.Polygon,this.currentPath.closeStroke=!1},e.prototype.finishPoly=function(){this.currentPath&&(this.currentPath.points.length>2?(this.drawShape(this.currentPath),this.currentPath=null):this.currentPath.points.length=0)},e.prototype.moveTo=function(t,e){return this.startPoly(),this.currentPath.points[0]=t,this.currentPath.points[1]=e,this},e.prototype.lineTo=function(t,e){this.currentPath||this.moveTo(0,0);var i=this.currentPath.points,r=i[i.length-2],s=i[i.length-1];return r===t&&s===e||i.push(t,e),this},e.prototype._initCurve=function(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.currentPath?0===this.currentPath.points.length&&(this.currentPath.points=[t,e]):this.moveTo(t,e)},e.prototype.quadraticCurveTo=function(t,e,i,r){this._initCurve();var s=this.currentPath.points;return 0===s.length&&this.moveTo(0,0),w.curveTo(t,e,i,r,s),this},e.prototype.bezierCurveTo=function(t,e,i,r,s,n){return this._initCurve(),P.curveTo(t,e,i,r,s,n,this.currentPath.points),this},e.prototype.arcTo=function(t,e,i,r,s){this._initCurve(t,e);var n=this.currentPath.points,h=S.curveTo(t,e,i,r,s,n);if(h){var a=h.cx,o=h.cy,l=h.radius,u=h.startAngle,p=h.endAngle,c=h.anticlockwise;this.arc(a,o,l,u,p,c)}return this},e.prototype.arc=function(t,e,i,s,n,h){if(void 0===h&&(h=!1),s===n)return this;if(!h&&n<=s?n+=r.PI_2:h&&s<=n&&(s+=r.PI_2),0===n-s)return this;var a=t+Math.cos(s)*i,o=e+Math.sin(s)*i,l=this._geometry.closePointEps,u=this.currentPath?this.currentPath.points:null;if(u){var p=Math.abs(u[u.length-2]-a),c=Math.abs(u[u.length-1]-o);p<l&&c<l||u.push(a,o)}else this.moveTo(a,o),u=this.currentPath.points;return S.arc(a,o,t,e,i,s,n,h,u),this},e.prototype.beginFill=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=1),this.beginTextureFill({texture:i.Texture.WHITE,color:t,alpha:e})},e.prototype.beginTextureFill=function(t){t=Object.assign({texture:i.Texture.WHITE,color:16777215,alpha:1,matrix:null},t),this.currentPath&&this.startPoly();var e=t.alpha>0;return e?(t.matrix&&(t.matrix=t.matrix.clone(),t.matrix.invert()),Object.assign(this._fillStyle,{visible:e},t)):this._fillStyle.reset(),this},e.prototype.endFill=function(){return this.finishPoly(),this._fillStyle.reset(),this},e.prototype.drawRect=function(t,e,i,s){return this.drawShape(new r.Rectangle(t,e,i,s))},e.prototype.drawRoundedRect=function(t,e,i,s,n){return this.drawShape(new r.RoundedRectangle(t,e,i,s,n))},e.prototype.drawCircle=function(t,e,i){return this.drawShape(new r.Circle(t,e,i))},e.prototype.drawEllipse=function(t,e,i,s){return this.drawShape(new r.Ellipse(t,e,i,s))},e.prototype.drawPolygon=function(){for(var t,e=arguments,i=[],s=0;s<arguments.length;s++)i[s]=e[s];var n=!0,h=i[0];h.points?(n=h.closeStroke,t=h.points):t=Array.isArray(i[0])?i[0]:i;var a=new r.Polygon(t);return a.closeStroke=n,this.drawShape(a),this},e.prototype.drawShape=function(t){return this._holeMode?this._geometry.drawHole(t,this._matrix):this._geometry.drawShape(t,this._fillStyle.clone(),this._lineStyle.clone(),this._matrix),this},e.prototype.clear=function(){return this._geometry.clear(),this._lineStyle.reset(),this._fillStyle.reset(),this._boundsID++,this._matrix=null,this._holeMode=!1,this.currentPath=null,this},e.prototype.isFastRect=function(){var t=this._geometry.graphicsData;return!(1!==t.length||t[0].shape.type!==r.SHAPES.RECT||t[0].matrix||t[0].holes.length||t[0].lineStyle.visible&&t[0].lineStyle.width)},e.prototype._render=function(t){this.finishPoly();var e=this._geometry,i=t.context.supports.uint32Indices;e.updateBatches(i),e.batchable?(this.batchDirty!==e.batchDirty&&this._populateBatches(),this._renderBatched(t)):(t.batch.flush(),this._renderDirect(t))},e.prototype._populateBatches=function(){var t=this._geometry,e=this.blendMode,i=t.batches.length;this.batchTint=-1,this._transformID=-1,this.batchDirty=t.batchDirty,this.batches.length=i,this.vertexData=new Float32Array(t.points);for(var r=0;r<i;r++){var n=t.batches[r],h=n.style.color,a=new Float32Array(this.vertexData.buffer,4*n.attribStart*2,2*n.attribSize),o=new Float32Array(t.uvsFloat32.buffer,4*n.attribStart*2,2*n.attribSize),l={vertexData:a,blendMode:e,indices:new Uint16Array(t.indicesUint16.buffer,2*n.start,n.size),uvs:o,_batchRGB:s.hex2rgb(h),_tintRGB:h,_texture:n.style.texture,alpha:n.style.alpha,worldAlpha:1};this.batches[r]=l}},e.prototype._renderBatched=function(t){if(this.batches.length){t.batch.setObjectRenderer(t.plugins[this.pluginName]),this.calculateVertices(),this.calculateTints();for(var e=0,i=this.batches.length;e<i;e++){var r=this.batches[e];r.worldAlpha=this.worldAlpha*r.alpha,t.plugins[this.pluginName].render(r)}}},e.prototype._renderDirect=function(t){var e=this._resolveDirectShader(t),i=this._geometry,r=this.tint,s=this.worldAlpha,n=e.uniforms,h=i.drawCalls;n.translationMatrix=this.transform.worldTransform,n.tint[0]=(r>>16&255)/255*s,n.tint[1]=(r>>8&255)/255*s,n.tint[2]=(255&r)/255*s,n.tint[3]=s,t.shader.bind(e),t.geometry.bind(i,e),t.state.set(this.state);for(var a=0,o=h.length;a<o;a++)this._renderDrawCallDirect(t,i.drawCalls[a])},e.prototype._renderDrawCallDirect=function(t,e){for(var i=e.texArray,r=e.type,s=e.size,n=e.start,h=i.count,a=0;a<h;a++)t.texture.bind(i.elements[a],a);t.geometry.draw(r,s,n)},e.prototype._resolveDirectShader=function(t){var e=this.shader,s=this.pluginName;if(!e){if(!N[s]){for(var n=t.plugins[s].MAX_TEXTURES,h=new Int32Array(n),a=0;a<n;a++)h[a]=a;var o={tint:new Float32Array([1,1,1,1]),translationMatrix:new r.Matrix,default:i.UniformGroup.from({uSamplers:h},!0)},l=t.plugins[s]._shader.program;N[s]=new i.Shader(l,o)}e=N[s]}return e},e.prototype._calculateBounds=function(){this.finishPoly();var t=this._geometry;if(t.graphicsData.length){var e=t.bounds,i=e.minX,r=e.minY,s=e.maxX,n=e.maxY;this._bounds.addFrame(this.transform,i,r,s,n)}},e.prototype.containsPoint=function(t){return this.worldTransform.applyInverse(t,e._TEMP_POINT),this._geometry.containsPoint(e._TEMP_POINT)},e.prototype.calculateTints=function(){if(this.batchTint!==this.tint){this.batchTint=this.tint;for(var t=s.hex2rgb(this.tint,B),e=0;e<this.batches.length;e++){var i=this.batches[e],r=i._batchRGB,n=(t[0]*r[0]*255<<16)+(t[1]*r[1]*255<<8)+(0|t[2]*r[2]*255);i._tintRGB=(n>>16)+(65280&n)+((255&n)<<16)}}},e.prototype.calculateVertices=function(){var t=this.transform._worldID;if(this._transformID!==t){this._transformID=t;for(var e=this.transform.worldTransform,i=e.a,r=e.b,s=e.c,n=e.d,h=e.tx,a=e.ty,o=this._geometry.points,l=this.vertexData,u=0,p=0;p<o.length;p+=2){var c=o[p],d=o[p+1];l[u++]=i*c+s*d+h,l[u++]=n*d+r*c+a}}},e.prototype.closePath=function(){var t=this.currentPath;return t&&(t.closeStroke=!0,this.finishPoly()),this},e.prototype.setMatrix=function(t){return this._matrix=t,this},e.prototype.beginHole=function(){return this.finishPoly(),this._holeMode=!0,this},e.prototype.endHole=function(){return this.finishPoly(),this._holeMode=!1,this},e.prototype.destroy=function(e){this._geometry.refCount--,0===this._geometry.refCount&&this._geometry.dispose(),this._matrix=null,this.currentPath=null,this._lineStyle.destroy(),this._lineStyle=null,this._fillStyle.destroy(),this._fillStyle=null,this._geometry=null,this.shader=null,this.vertexData=null,this.batches.length=0,this.batches=null,t.prototype.destroy.call(this,e)},e.nextRoundedRectBehavior=!1,e._TEMP_POINT=new r.Point,e}(h.Container),U={buildPoly:c,buildCircle:d,buildRectangle:f,buildRoundedRectangle:g,buildLine:m,ArcUtils:S,BezierUtils:P,QuadraticUtils:w,BatchPart:M,FILL_COMMANDS:E,BATCH_POOL:A,DRAW_CALL_POOL:D};exports.FillStyle=o,exports.GRAPHICS_CURVES=a,exports.Graphics=O,exports.GraphicsData=T,exports.GraphicsGeometry=R,exports.LineStyle=L,exports.graphicsUtils=U; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t,e,i=require("@pixi/core"),r=require("@pixi/math"),s=require("@pixi/utils"),n=require("@pixi/constants"),h=require("@pixi/display");exports.LINE_JOIN=void 0,(t=exports.LINE_JOIN||(exports.LINE_JOIN={})).MITER="miter",t.BEVEL="bevel",t.ROUND="round",exports.LINE_CAP=void 0,(e=exports.LINE_CAP||(exports.LINE_CAP={})).BUTT="butt",e.ROUND="round",e.SQUARE="square";var a={adaptive:!0,maxLength:10,minSegments:8,maxSegments:2048,epsilon:1e-4,_segmentsCount:function(t,e){if(void 0===e&&(e=20),!this.adaptive||!t||isNaN(t))return e;var i=Math.ceil(t/this.maxLength);return i<this.minSegments?i=this.minSegments:i>this.maxSegments&&(i=this.maxSegments),i}},o=function(){function t(){this.color=16777215,this.alpha=1,this.texture=i.Texture.WHITE,this.matrix=null,this.visible=!1,this.reset()}return t.prototype.clone=function(){var e=new t;return e.color=this.color,e.alpha=this.alpha,e.texture=this.texture,e.matrix=this.matrix,e.visible=this.visible,e},t.prototype.reset=function(){this.color=16777215,this.alpha=1,this.texture=i.Texture.WHITE,this.matrix=null,this.visible=!1},t.prototype.destroy=function(){this.texture=null,this.matrix=null},t}(),l=function(t,e){return l=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},l(t,e)};function u(t,e){function i(){this.constructor=t}l(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}function p(t,e){var i,r;void 0===e&&(e=!1);var s=t.length;if(!(s<6)){for(var n=0,h=0,a=t[s-2],o=t[s-1];h<s;h+=2){var l=t[h],u=t[h+1];n+=(l-a)*(u+o),a=l,o=u}if(!e&&n>0||e&&n<=0){var p=s/2;for(h=p+p%2;h<s;h+=2){var c=s-h-2,d=s-h-1,f=h,y=h+1;i=[t[f],t[c]],t[c]=i[0],t[f]=i[1],r=[t[y],t[d]],t[d]=r[0],t[y]=r[1]}}}}var c={build:function(t){t.points=t.shape.points.slice()},triangulate:function(t,e){var i=t.points,r=t.holes,n=e.points,h=e.indices;if(i.length>=6){p(i,!1);for(var a=[],o=0;o<r.length;o++){var l=r[o];p(l.points,!0),a.push(i.length/2),i=i.concat(l.points)}var u=s.earcut(i,a,2);if(!u)return;var c=n.length/2;for(o=0;o<u.length;o+=3)h.push(u[o]+c),h.push(u[o+1]+c),h.push(u[o+2]+c);for(o=0;o<i.length;o++)n.push(i[o])}}},d={build:function(t){var e,i,s,n,h,a,o=t.points;if(t.type===r.SHAPES.CIRC){var l=t.shape;e=l.x,i=l.y,h=a=l.radius,s=n=0}else if(t.type===r.SHAPES.ELIP){var u=t.shape;e=u.x,i=u.y,h=u.width,a=u.height,s=n=0}else{var p=t.shape,c=p.width/2,d=p.height/2;e=p.x+c,i=p.y+d,s=c-(h=a=Math.max(0,Math.min(p.radius,Math.min(c,d)))),n=d-a}if(h>=0&&a>=0&&s>=0&&n>=0){var f=Math.ceil(2.3*Math.sqrt(h+a)),y=8*f+(s?4:0)+(n?4:0);if(o.length=y,0!==y){if(0===f)return o.length=8,o[0]=o[6]=e+s,o[1]=o[3]=i+n,o[2]=o[4]=e-s,void(o[5]=o[7]=i-n);var v=0,g=4*f+(s?2:0)+2,b=g,x=y,m=e+(E=s+h),_=e-E,S=i+(A=n);if(o[v++]=m,o[v++]=S,o[--g]=S,o[--g]=_,n){var P=i-A;o[b++]=_,o[b++]=P,o[--x]=P,o[--x]=m}for(var w=1;w<f;w++){var M=Math.PI/2*(w/f);m=e+(E=s+Math.cos(M)*h),_=e-E,S=i+(A=n+Math.sin(M)*a),P=i-A;o[v++]=m,o[v++]=S,o[--g]=S,o[--g]=_,o[b++]=_,o[b++]=P,o[--x]=P,o[--x]=m}var E,A;m=e+(E=s),_=e-E,S=i+(A=n+a),P=i-A;o[v++]=m,o[v++]=S,o[--x]=P,o[--x]=m,s&&(o[v++]=_,o[v++]=S,o[--x]=P,o[--x]=_)}}else o.length=0},triangulate:function(t,e){var i,s,n=t.points,h=e.points,a=e.indices,o=h.length/2,l=o;if(t.type!==r.SHAPES.RREC){var u=t.shape;i=u.x,s=u.y}else{var p=t.shape;i=p.x+p.width/2,s=p.y+p.height/2}var c=t.matrix;h.push(t.matrix?c.a*i+c.c*s+c.tx:i,t.matrix?c.b*i+c.d*s+c.ty:s),o++,h.push(n[0],n[1]);for(var d=2;d<n.length;d+=2)h.push(n[d],n[d+1]),a.push(o++,l,o);a.push(l+1,l,o)}},f={build:function(t){var e=t.shape,i=e.x,r=e.y,s=e.width,n=e.height,h=t.points;h.length=0,h.push(i,r,i+s,r,i+s,r+n,i,r+n)},triangulate:function(t,e){var i=t.points,r=e.points,s=r.length/2;r.push(i[0],i[1],i[2],i[3],i[6],i[7],i[4],i[5]),e.indices.push(s,s+1,s+2,s+1,s+2,s+3)}};function y(t,e,i){return t+(e-t)*i}function v(t,e,i,r,s,n,h){void 0===h&&(h=[]);for(var a=h,o=0,l=0,u=0,p=0,c=0,d=0,f=0,v=0;f<=20;++f)o=y(t,i,v=f/20),l=y(e,r,v),u=y(i,s,v),p=y(r,n,v),c=y(o,u,v),d=y(l,p,v),0===f&&a[a.length-2]===c&&a[a.length-1]===d||a.push(c,d);return a}var g={build:function(t){if(O.nextRoundedRectBehavior)d.build(t);else{var e=t.shape,i=t.points,r=e.x,s=e.y,n=e.width,h=e.height,a=Math.max(0,Math.min(e.radius,Math.min(n,h)/2));i.length=0,a?(v(r,s+a,r,s,r+a,s,i),v(r+n-a,s,r+n,s,r+n,s+a,i),v(r+n,s+h-a,r+n,s+h,r+n-a,s+h,i),v(r+a,s+h,r,s+h,r,s+h-a,i)):i.push(r,s,r+n,s,r+n,s+h,r,s+h)}},triangulate:function(t,e){if(O.nextRoundedRectBehavior)d.triangulate(t,e);else{for(var i=t.points,r=e.points,n=e.indices,h=r.length/2,a=s.earcut(i,null,2),o=0,l=a.length;o<l;o+=3)n.push(a[o]+h),n.push(a[o+1]+h),n.push(a[o+2]+h);for(o=0,l=i.length;o<l;o++)r.push(i[o],i[++o])}}};function b(t,e,i,r,s,n,h,a){var o,l;h?(o=r,l=-i):(o=-r,l=i);var u=t-i*s+o,p=e-r*s+l,c=t+i*n+o,d=e+r*n+l;return a.push(u,p),a.push(c,d),2}function x(t,e,i,r,s,n,h,a){var o=i-t,l=r-e,u=Math.atan2(o,l),p=Math.atan2(s-t,n-e);a&&u<p?u+=2*Math.PI:!a&&u>p&&(p+=2*Math.PI);var c=u,d=p-u,f=Math.abs(d),y=Math.sqrt(o*o+l*l),v=1+(15*f*Math.sqrt(y)/Math.PI>>0),g=d/v;if(c+=g,a){h.push(t,e),h.push(i,r);for(var b=1,x=c;b<v;b++,x+=g)h.push(t,e),h.push(t+Math.sin(x)*y,e+Math.cos(x)*y);h.push(t,e),h.push(s,n)}else{h.push(i,r),h.push(t,e);for(b=1,x=c;b<v;b++,x+=g)h.push(t+Math.sin(x)*y,e+Math.cos(x)*y),h.push(t,e);h.push(s,n),h.push(t,e)}return 2*v}function m(t,e){t.lineStyle.native?function(t,e){var i=0,s=t.shape,n=t.points||s.points,h=s.type!==r.SHAPES.POLY||s.closeStroke;if(0!==n.length){var a=e.points,o=e.indices,l=n.length/2,u=a.length/2,p=u;for(a.push(n[0],n[1]),i=1;i<l;i++)a.push(n[2*i],n[2*i+1]),o.push(p,p+1),p++;h&&o.push(p,u)}}(t,e):function(t,e){var i=t.shape,s=t.points||i.points.slice(),n=e.closePointEps;if(0!==s.length){var h=t.lineStyle,o=new r.Point(s[0],s[1]),l=new r.Point(s[s.length-2],s[s.length-1]),u=i.type!==r.SHAPES.POLY||i.closeStroke,p=Math.abs(o.x-l.x)<n&&Math.abs(o.y-l.y)<n;if(u){s=s.slice(),p&&(s.pop(),s.pop(),l.set(s[s.length-2],s[s.length-1]));var c=.5*(o.x+l.x),d=.5*(l.y+o.y);s.unshift(c,d),s.push(c,d)}var f=e.points,y=s.length/2,v=s.length,g=f.length/2,m=h.width/2,_=m*m,S=h.miterLimit*h.miterLimit,P=s[0],w=s[1],M=s[2],E=s[3],A=0,T=0,D=-(w-E),I=P-M,C=0,R=0,L=Math.sqrt(D*D+I*I);D/=L,I/=L,D*=m,I*=m;var B=h.alignment,N=2*(1-B),O=2*B;u||(h.cap===exports.LINE_CAP.ROUND?v+=x(P-D*(N-O)*.5,w-I*(N-O)*.5,P-D*N,w-I*N,P+D*O,w+I*O,f,!0)+2:h.cap===exports.LINE_CAP.SQUARE&&(v+=b(P,w,D,I,N,O,!0,f))),f.push(P-D*N,w-I*N),f.push(P+D*O,w+I*O);for(var U=1;U<y-1;++U){P=s[2*(U-1)],w=s[2*(U-1)+1],M=s[2*U],E=s[2*U+1],A=s[2*(U+1)],T=s[2*(U+1)+1],D=-(w-E),I=P-M,D/=L=Math.sqrt(D*D+I*I),I/=L,D*=m,I*=m,C=-(E-T),R=M-A,C/=L=Math.sqrt(C*C+R*R),R/=L,C*=m,R*=m;var H=M-P,j=w-E,F=M-A,q=T-E,z=j*F-q*H,k=z<0;if(Math.abs(z)<.1)f.push(M-D*N,E-I*N),f.push(M+D*O,E+I*O);else{var G=(-D+P)*(-I+E)-(-D+M)*(-I+w),W=(-C+A)*(-R+E)-(-C+M)*(-R+T),J=(H*W-F*G)/z,Y=(q*G-j*W)/z,V=(J-M)*(J-M)+(Y-E)*(Y-E),Q=M+(J-M)*N,X=E+(Y-E)*N,Z=M-(J-M)*O,K=E-(Y-E)*O,$=k?N:O;V<=Math.min(H*H+j*j,F*F+q*q)+$*$*_?h.join===exports.LINE_JOIN.BEVEL||V/_>S?(k?(f.push(Q,X),f.push(M+D*O,E+I*O),f.push(Q,X),f.push(M+C*O,E+R*O)):(f.push(M-D*N,E-I*N),f.push(Z,K),f.push(M-C*N,E-R*N),f.push(Z,K)),v+=2):h.join===exports.LINE_JOIN.ROUND?k?(f.push(Q,X),f.push(M+D*O,E+I*O),v+=x(M,E,M+D*O,E+I*O,M+C*O,E+R*O,f,!0)+4,f.push(Q,X),f.push(M+C*O,E+R*O)):(f.push(M-D*N,E-I*N),f.push(Z,K),v+=x(M,E,M-D*N,E-I*N,M-C*N,E-R*N,f,!1)+4,f.push(M-C*N,E-R*N),f.push(Z,K)):(f.push(Q,X),f.push(Z,K)):(f.push(M-D*N,E-I*N),f.push(M+D*O,E+I*O),h.join===exports.LINE_JOIN.ROUND?v+=k?x(M,E,M+D*O,E+I*O,M+C*O,E+R*O,f,!0)+2:x(M,E,M-D*N,E-I*N,M-C*N,E-R*N,f,!1)+2:h.join===exports.LINE_JOIN.MITER&&V/_<=S&&(k?(f.push(Z,K),f.push(Z,K)):(f.push(Q,X),f.push(Q,X)),v+=2),f.push(M-C*N,E-R*N),f.push(M+C*O,E+R*O),v+=2)}}P=s[2*(y-2)],w=s[2*(y-2)+1],M=s[2*(y-1)],D=-(w-(E=s[2*(y-1)+1])),I=P-M,D/=L=Math.sqrt(D*D+I*I),I/=L,D*=m,I*=m,f.push(M-D*N,E-I*N),f.push(M+D*O,E+I*O),u||(h.cap===exports.LINE_CAP.ROUND?v+=x(M-D*(N-O)*.5,E-I*(N-O)*.5,M-D*N,E-I*N,M+D*O,E+I*O,f,!1)+2:h.cap===exports.LINE_CAP.SQUARE&&(v+=b(M,E,D,I,N,O,!1,f)));var tt=e.indices,et=a.epsilon*a.epsilon;for(U=g;U<v+g-2;++U)P=f[2*U],w=f[2*U+1],M=f[2*(U+1)],E=f[2*(U+1)+1],A=f[2*(U+2)],T=f[2*(U+2)+1],Math.abs(P*(E-T)+M*(T-w)+A*(w-E))<et||tt.push(U,U+1,U+2)}}(t,e)}var _,S=function(){function t(){}return t.curveTo=function(t,e,i,r,s,n){var h=n[n.length-2],a=n[n.length-1]-e,o=h-t,l=r-e,u=i-t,p=Math.abs(a*u-o*l);if(p<1e-8||0===s)return n[n.length-2]===t&&n[n.length-1]===e||n.push(t,e),null;var c=a*a+o*o,d=l*l+u*u,f=a*l+o*u,y=s*Math.sqrt(c)/p,v=s*Math.sqrt(d)/p,g=y*f/c,b=v*f/d,x=y*u+v*o,m=y*l+v*a,_=o*(v+g),S=a*(v+g),P=u*(y+b),w=l*(y+b);return{cx:x+t,cy:m+e,radius:s,startAngle:Math.atan2(S-m,_-x),endAngle:Math.atan2(w-m,P-x),anticlockwise:o*l>u*a}},t.arc=function(t,e,i,s,n,h,o,l,u){for(var p=o-h,c=a._segmentsCount(Math.abs(p)*n,40*Math.ceil(Math.abs(p)/r.PI_2)),d=p/(2*c),f=2*d,y=Math.cos(d),v=Math.sin(d),g=c-1,b=g%1/g,x=0;x<=g;++x){var m=d+h+f*(x+b*x),_=Math.cos(m),S=-Math.sin(m);u.push((y*_+v*S)*n+i,(y*-S+v*_)*n+s)}},t}(),P=function(){function t(){}return t.curveLength=function(t,e,i,r,s,n,h,a){for(var o=0,l=0,u=0,p=0,c=0,d=0,f=0,y=0,v=0,g=0,b=0,x=t,m=e,_=1;_<=10;++_)g=x-(y=(f=(d=(c=1-(l=_/10))*c)*c)*t+3*d*l*i+3*c*(u=l*l)*s+(p=u*l)*h),b=m-(v=f*e+3*d*l*r+3*c*u*n+p*a),x=y,m=v,o+=Math.sqrt(g*g+b*b);return o},t.curveTo=function(e,i,r,s,n,h,o){var l=o[o.length-2],u=o[o.length-1];o.length-=2;var p=a._segmentsCount(t.curveLength(l,u,e,i,r,s,n,h)),c=0,d=0,f=0,y=0,v=0;o.push(l,u);for(var g=1,b=0;g<=p;++g)f=(d=(c=1-(b=g/p))*c)*c,v=(y=b*b)*b,o.push(f*l+3*d*b*e+3*c*y*r+v*n,f*u+3*d*b*i+3*c*y*s+v*h)},t}(),w=function(){function t(){}return t.curveLength=function(t,e,i,r,s,n){var h=t-2*i+s,a=e-2*r+n,o=2*i-2*t,l=2*r-2*e,u=4*(h*h+a*a),p=4*(h*o+a*l),c=o*o+l*l,d=2*Math.sqrt(u+p+c),f=Math.sqrt(u),y=2*u*f,v=2*Math.sqrt(c),g=p/f;return(y*d+f*p*(d-v)+(4*c*u-p*p)*Math.log((2*f+g+d)/(g+v)))/(4*y)},t.curveTo=function(e,i,r,s,n){for(var h=n[n.length-2],o=n[n.length-1],l=a._segmentsCount(t.curveLength(h,o,e,i,r,s)),u=0,p=0,c=1;c<=l;++c){var d=c/l;u=h+(e-h)*d,p=o+(i-o)*d,n.push(u+(e+(r-e)*d-u)*d,p+(i+(s-i)*d-p)*d)}},t}(),M=function(){function t(){this.reset()}return t.prototype.begin=function(t,e,i){this.reset(),this.style=t,this.start=e,this.attribStart=i},t.prototype.end=function(t,e){this.attribSize=e-this.attribStart,this.size=t-this.start},t.prototype.reset=function(){this.style=null,this.size=0,this.start=0,this.attribStart=0,this.attribSize=0},t}(),E=((_={})[r.SHAPES.POLY]=c,_[r.SHAPES.CIRC]=d,_[r.SHAPES.ELIP]=d,_[r.SHAPES.RECT]=f,_[r.SHAPES.RREC]=g,_),A=[],T=[],D=function(){function t(t,e,i,r){void 0===e&&(e=null),void 0===i&&(i=null),void 0===r&&(r=null),this.points=[],this.holes=[],this.shape=t,this.lineStyle=i,this.fillStyle=e,this.matrix=r,this.type=t.type}return t.prototype.clone=function(){return new t(this.shape,this.fillStyle,this.lineStyle,this.matrix)},t.prototype.destroy=function(){this.shape=null,this.holes.length=0,this.holes=null,this.points.length=0,this.points=null,this.lineStyle=null,this.fillStyle=null},t}(),I=new r.Point,C=new h.Bounds,R=function(t){function e(){var e=t.call(this)||this;return e.closePointEps=1e-4,e.boundsPadding=0,e.uvsFloat32=null,e.indicesUint16=null,e.batchable=!1,e.points=[],e.colors=[],e.uvs=[],e.indices=[],e.textureIds=[],e.graphicsData=[],e.drawCalls=[],e.batchDirty=-1,e.batches=[],e.dirty=0,e.cacheDirty=-1,e.clearDirty=0,e.shapeIndex=0,e._bounds=new h.Bounds,e.boundsDirty=-1,e}return u(e,t),Object.defineProperty(e.prototype,"bounds",{get:function(){return this.boundsDirty!==this.dirty&&(this.boundsDirty=this.dirty,this.calculateBounds()),this._bounds},enumerable:!1,configurable:!0}),e.prototype.invalidate=function(){this.boundsDirty=-1,this.dirty++,this.batchDirty++,this.shapeIndex=0,this.points.length=0,this.colors.length=0,this.uvs.length=0,this.indices.length=0,this.textureIds.length=0;for(var t=0;t<this.drawCalls.length;t++)this.drawCalls[t].texArray.clear(),T.push(this.drawCalls[t]);this.drawCalls.length=0;for(t=0;t<this.batches.length;t++){var e=this.batches[t];e.reset(),A.push(e)}this.batches.length=0},e.prototype.clear=function(){return this.graphicsData.length>0&&(this.invalidate(),this.clearDirty++,this.graphicsData.length=0),this},e.prototype.drawShape=function(t,e,i,r){void 0===e&&(e=null),void 0===i&&(i=null),void 0===r&&(r=null);var s=new D(t,e,i,r);return this.graphicsData.push(s),this.dirty++,this},e.prototype.drawHole=function(t,e){if(void 0===e&&(e=null),!this.graphicsData.length)return null;var i=new D(t,null,null,e),r=this.graphicsData[this.graphicsData.length-1];return i.lineStyle=r.lineStyle,r.holes.push(i),this.dirty++,this},e.prototype.destroy=function(){t.prototype.destroy.call(this);for(var e=0;e<this.graphicsData.length;++e)this.graphicsData[e].destroy();this.points.length=0,this.points=null,this.colors.length=0,this.colors=null,this.uvs.length=0,this.uvs=null,this.indices.length=0,this.indices=null,this.indexBuffer.destroy(),this.indexBuffer=null,this.graphicsData.length=0,this.graphicsData=null,this.drawCalls.length=0,this.drawCalls=null,this.batches.length=0,this.batches=null,this._bounds=null},e.prototype.containsPoint=function(t){for(var e=this.graphicsData,i=0;i<e.length;++i){var r=e[i];if(r.fillStyle.visible&&(r.shape&&(r.matrix?r.matrix.applyInverse(t,I):I.copyFrom(t),r.shape.contains(I.x,I.y)))){var s=!1;if(r.holes)for(var n=0;n<r.holes.length;n++){if(r.holes[n].shape.contains(I.x,I.y)){s=!0;break}}if(!s)return!0}}return!1},e.prototype.updateBatches=function(t){if(this.graphicsData.length){if(this.validateBatching()){this.cacheDirty=this.dirty;var e=this.uvs,i=this.graphicsData,r=null,s=null;this.batches.length>0&&(s=(r=this.batches[this.batches.length-1]).style);for(var h=this.shapeIndex;h<i.length;h++){this.shapeIndex++;var a=i[h],o=a.fillStyle,l=a.lineStyle;E[a.type].build(a),a.matrix&&this.transformPoints(a.points,a.matrix),(o.visible||l.visible)&&this.processHoles(a.holes);for(var u=0;u<2;u++){var p=0===u?o:l;if(p.visible){var c=p.texture.baseTexture,d=this.indices.length,f=this.points.length/2;c.wrapMode=n.WRAP_MODES.REPEAT,0===u?this.processFill(a):this.processLine(a);var y=this.points.length/2-f;0!==y&&(r&&!this._compareStyles(s,p)&&(r.end(d,f),r=null),r||((r=A.pop()||new M).begin(p,d,f),this.batches.push(r),s=p),this.addUvs(this.points,e,p.texture,f,y,p.matrix))}}}var v=this.indices.length,g=this.points.length/2;if(r&&r.end(v,g),0!==this.batches.length){if(this.indicesUint16&&this.indices.length===this.indicesUint16.length)this.indicesUint16.set(this.indices);else{var b=g>65535&&t;this.indicesUint16=b?new Uint32Array(this.indices):new Uint16Array(this.indices)}this.batchable=this.isBatchable(),this.batchable?this.packBatches():this.buildDrawCalls()}else this.batchable=!0}}else this.batchable=!0},e.prototype._compareStyles=function(t,e){return!(!t||!e)&&(t.texture.baseTexture===e.texture.baseTexture&&(t.color+t.alpha===e.color+e.alpha&&!!t.native==!!e.native))},e.prototype.validateBatching=function(){if(this.dirty===this.cacheDirty||!this.graphicsData.length)return!1;for(var t=0,e=this.graphicsData.length;t<e;t++){var i=this.graphicsData[t],r=i.fillStyle,s=i.lineStyle;if(r&&!r.texture.baseTexture.valid)return!1;if(s&&!s.texture.baseTexture.valid)return!1}return!0},e.prototype.packBatches=function(){this.batchDirty++,this.uvsFloat32=new Float32Array(this.uvs);for(var t=this.batches,e=0,i=t.length;e<i;e++)for(var r=t[e],s=0;s<r.size;s++){var n=r.start+s;this.indicesUint16[n]=this.indicesUint16[n]-r.attribStart}},e.prototype.isBatchable=function(){if(this.points.length>131070)return!1;for(var t=this.batches,i=0;i<t.length;i++)if(t[i].style.native)return!1;return this.points.length<2*e.BATCHABLE_SIZE},e.prototype.buildDrawCalls=function(){for(var t=++i.BaseTexture._globalBatch,e=0;e<this.drawCalls.length;e++)this.drawCalls[e].texArray.clear(),T.push(this.drawCalls[e]);this.drawCalls.length=0;var r=this.colors,s=this.textureIds,h=T.pop();h||((h=new i.BatchDrawCall).texArray=new i.BatchTextureArray),h.texArray.count=0,h.start=0,h.size=0,h.type=n.DRAW_MODES.TRIANGLES;var a=0,o=null,l=0,u=!1,p=n.DRAW_MODES.TRIANGLES,c=0;this.drawCalls.push(h);for(e=0;e<this.batches.length;e++){var d=this.batches[e],f=d.style,y=f.texture.baseTexture;u!==!!f.native&&(p=(u=!!f.native)?n.DRAW_MODES.LINES:n.DRAW_MODES.TRIANGLES,o=null,a=8,t++),o!==y&&(o=y,y._batchEnabled!==t&&(8===a&&(t++,a=0,h.size>0&&((h=T.pop())||((h=new i.BatchDrawCall).texArray=new i.BatchTextureArray),this.drawCalls.push(h)),h.start=c,h.size=0,h.texArray.count=0,h.type=p),y.touched=1,y._batchEnabled=t,y._batchLocation=a,y.wrapMode=n.WRAP_MODES.REPEAT,h.texArray.elements[h.texArray.count++]=y,a++)),h.size+=d.size,c+=d.size,l=y._batchLocation,this.addColors(r,f.color,f.alpha,d.attribSize,d.attribStart),this.addTextureIds(s,l,d.attribSize,d.attribStart)}i.BaseTexture._globalBatch=t,this.packAttributes()},e.prototype.packAttributes=function(){for(var t=this.points,e=this.uvs,i=this.colors,r=this.textureIds,s=new ArrayBuffer(3*t.length*4),n=new Float32Array(s),h=new Uint32Array(s),a=0,o=0;o<t.length/2;o++)n[a++]=t[2*o],n[a++]=t[2*o+1],n[a++]=e[2*o],n[a++]=e[2*o+1],h[a++]=i[o],n[a++]=r[o];this._buffer.update(s),this._indexBuffer.update(this.indicesUint16)},e.prototype.processFill=function(t){t.holes.length?c.triangulate(t,this):E[t.type].triangulate(t,this)},e.prototype.processLine=function(t){m(t,this);for(var e=0;e<t.holes.length;e++)m(t.holes[e],this)},e.prototype.processHoles=function(t){for(var e=0;e<t.length;e++){var i=t[e];E[i.type].build(i),i.matrix&&this.transformPoints(i.points,i.matrix)}},e.prototype.calculateBounds=function(){var t=this._bounds,e=C,i=r.Matrix.IDENTITY;this._bounds.clear(),e.clear();for(var s=0;s<this.graphicsData.length;s++){var n=this.graphicsData[s],h=n.shape,a=n.type,o=n.lineStyle,l=n.matrix||r.Matrix.IDENTITY,u=0;if(o&&o.visible&&(u=o.width,a!==r.SHAPES.POLY||n.fillStyle.visible?u*=Math.max(0,o.alignment):u*=Math.max(o.alignment,1-o.alignment)),i!==l&&(e.isEmpty()||(t.addBoundsMatrix(e,i),e.clear()),i=l),a===r.SHAPES.RECT||a===r.SHAPES.RREC){var p=h;e.addFramePad(p.x,p.y,p.x+p.width,p.y+p.height,u,u)}else if(a===r.SHAPES.CIRC){var c=h;e.addFramePad(c.x,c.y,c.x,c.y,c.radius+u,c.radius+u)}else if(a===r.SHAPES.ELIP){var d=h;e.addFramePad(d.x,d.y,d.x,d.y,d.width+u,d.height+u)}else{var f=h;t.addVerticesMatrix(i,f.points,0,f.points.length,u,u)}}e.isEmpty()||t.addBoundsMatrix(e,i),t.pad(this.boundsPadding,this.boundsPadding)},e.prototype.transformPoints=function(t,e){for(var i=0;i<t.length/2;i++){var r=t[2*i],s=t[2*i+1];t[2*i]=e.a*r+e.c*s+e.tx,t[2*i+1]=e.b*r+e.d*s+e.ty}},e.prototype.addColors=function(t,e,i,r,n){void 0===n&&(n=0);var h=(e>>16)+(65280&e)+((255&e)<<16),a=s.premultiplyTint(h,i);t.length=Math.max(t.length,n+r);for(var o=0;o<r;o++)t[n+o]=a},e.prototype.addTextureIds=function(t,e,i,r){void 0===r&&(r=0),t.length=Math.max(t.length,r+i);for(var s=0;s<i;s++)t[r+s]=e},e.prototype.addUvs=function(t,e,i,r,s,n){void 0===n&&(n=null);for(var h=0,a=e.length,o=i.frame;h<s;){var l=t[2*(r+h)],u=t[2*(r+h)+1];if(n){var p=n.a*l+n.c*u+n.tx;u=n.b*l+n.d*u+n.ty,l=p}h++,e.push(l/o.width,u/o.height)}var c=i.baseTexture;(o.width<c.width||o.height<c.height)&&this.adjustUvs(e,i,a,s)},e.prototype.adjustUvs=function(t,e,i,r){for(var s=e.baseTexture,n=1e-6,h=i+2*r,a=e.frame,o=a.width/s.width,l=a.height/s.height,u=a.x/a.width,p=a.y/a.height,c=Math.floor(t[i]+n),d=Math.floor(t[i+1]+n),f=i+2;f<h;f+=2)c=Math.min(c,Math.floor(t[f]+n)),d=Math.min(d,Math.floor(t[f+1]+n));u-=c,p-=d;for(f=i;f<h;f+=2)t[f]=(t[f]+u)*o,t[f+1]=(t[f+1]+p)*l},e.BATCHABLE_SIZE=100,e}(i.BatchGeometry),L=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.width=0,e.alignment=.5,e.native=!1,e.cap=exports.LINE_CAP.BUTT,e.join=exports.LINE_JOIN.MITER,e.miterLimit=10,e}return u(e,t),e.prototype.clone=function(){var t=new e;return t.color=this.color,t.alpha=this.alpha,t.texture=this.texture,t.matrix=this.matrix,t.visible=this.visible,t.width=this.width,t.alignment=this.alignment,t.native=this.native,t.cap=this.cap,t.join=this.join,t.miterLimit=this.miterLimit,t},e.prototype.reset=function(){t.prototype.reset.call(this),this.color=0,this.alignment=.5,this.width=0,this.native=!1},e}(o),B=new Float32Array(3),N={},O=function(t){function e(e){void 0===e&&(e=null);var r=t.call(this)||this;return r.shader=null,r.pluginName="batch",r.currentPath=null,r.batches=[],r.batchTint=-1,r.batchDirty=-1,r.vertexData=null,r._fillStyle=new o,r._lineStyle=new L,r._matrix=null,r._holeMode=!1,r.state=i.State.for2d(),r._geometry=e||new R,r._geometry.refCount++,r._transformID=-1,r.tint=16777215,r.blendMode=n.BLEND_MODES.NORMAL,r}return u(e,t),Object.defineProperty(e.prototype,"geometry",{get:function(){return this._geometry},enumerable:!1,configurable:!0}),e.prototype.clone=function(){return this.finishPoly(),new e(this._geometry)},Object.defineProperty(e.prototype,"blendMode",{get:function(){return this.state.blendMode},set:function(t){this.state.blendMode=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"tint",{get:function(){return this._tint},set:function(t){this._tint=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fill",{get:function(){return this._fillStyle},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"line",{get:function(){return this._lineStyle},enumerable:!1,configurable:!0}),e.prototype.lineStyle=function(t,e,i,r,s){return void 0===t&&(t=null),void 0===e&&(e=0),void 0===i&&(i=1),void 0===r&&(r=.5),void 0===s&&(s=!1),"number"==typeof t&&(t={width:t,color:e,alpha:i,alignment:r,native:s}),this.lineTextureStyle(t)},e.prototype.lineTextureStyle=function(t){t=Object.assign({width:0,texture:i.Texture.WHITE,color:t&&t.texture?16777215:0,alpha:1,matrix:null,alignment:.5,native:!1,cap:exports.LINE_CAP.BUTT,join:exports.LINE_JOIN.MITER,miterLimit:10},t),this.currentPath&&this.startPoly();var e=t.width>0&&t.alpha>0;return e?(t.matrix&&(t.matrix=t.matrix.clone(),t.matrix.invert()),Object.assign(this._lineStyle,{visible:e},t)):this._lineStyle.reset(),this},e.prototype.startPoly=function(){if(this.currentPath){var t=this.currentPath.points,e=this.currentPath.points.length;e>2&&(this.drawShape(this.currentPath),this.currentPath=new r.Polygon,this.currentPath.closeStroke=!1,this.currentPath.points.push(t[e-2],t[e-1]))}else this.currentPath=new r.Polygon,this.currentPath.closeStroke=!1},e.prototype.finishPoly=function(){this.currentPath&&(this.currentPath.points.length>2?(this.drawShape(this.currentPath),this.currentPath=null):this.currentPath.points.length=0)},e.prototype.moveTo=function(t,e){return this.startPoly(),this.currentPath.points[0]=t,this.currentPath.points[1]=e,this},e.prototype.lineTo=function(t,e){this.currentPath||this.moveTo(0,0);var i=this.currentPath.points,r=i[i.length-2],s=i[i.length-1];return r===t&&s===e||i.push(t,e),this},e.prototype._initCurve=function(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.currentPath?0===this.currentPath.points.length&&(this.currentPath.points=[t,e]):this.moveTo(t,e)},e.prototype.quadraticCurveTo=function(t,e,i,r){this._initCurve();var s=this.currentPath.points;return 0===s.length&&this.moveTo(0,0),w.curveTo(t,e,i,r,s),this},e.prototype.bezierCurveTo=function(t,e,i,r,s,n){return this._initCurve(),P.curveTo(t,e,i,r,s,n,this.currentPath.points),this},e.prototype.arcTo=function(t,e,i,r,s){this._initCurve(t,e);var n=this.currentPath.points,h=S.curveTo(t,e,i,r,s,n);if(h){var a=h.cx,o=h.cy,l=h.radius,u=h.startAngle,p=h.endAngle,c=h.anticlockwise;this.arc(a,o,l,u,p,c)}return this},e.prototype.arc=function(t,e,i,s,n,h){if(void 0===h&&(h=!1),s===n)return this;if(!h&&n<=s?n+=r.PI_2:h&&s<=n&&(s+=r.PI_2),0===n-s)return this;var a=t+Math.cos(s)*i,o=e+Math.sin(s)*i,l=this._geometry.closePointEps,u=this.currentPath?this.currentPath.points:null;if(u){var p=Math.abs(u[u.length-2]-a),c=Math.abs(u[u.length-1]-o);p<l&&c<l||u.push(a,o)}else this.moveTo(a,o),u=this.currentPath.points;return S.arc(a,o,t,e,i,s,n,h,u),this},e.prototype.beginFill=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=1),this.beginTextureFill({texture:i.Texture.WHITE,color:t,alpha:e})},e.prototype.beginTextureFill=function(t){t=Object.assign({texture:i.Texture.WHITE,color:16777215,alpha:1,matrix:null},t),this.currentPath&&this.startPoly();var e=t.alpha>0;return e?(t.matrix&&(t.matrix=t.matrix.clone(),t.matrix.invert()),Object.assign(this._fillStyle,{visible:e},t)):this._fillStyle.reset(),this},e.prototype.endFill=function(){return this.finishPoly(),this._fillStyle.reset(),this},e.prototype.drawRect=function(t,e,i,s){return this.drawShape(new r.Rectangle(t,e,i,s))},e.prototype.drawRoundedRect=function(t,e,i,s,n){return this.drawShape(new r.RoundedRectangle(t,e,i,s,n))},e.prototype.drawCircle=function(t,e,i){return this.drawShape(new r.Circle(t,e,i))},e.prototype.drawEllipse=function(t,e,i,s){return this.drawShape(new r.Ellipse(t,e,i,s))},e.prototype.drawPolygon=function(){for(var t,e=arguments,i=[],s=0;s<arguments.length;s++)i[s]=e[s];var n=!0,h=i[0];h.points?(n=h.closeStroke,t=h.points):t=Array.isArray(i[0])?i[0]:i;var a=new r.Polygon(t);return a.closeStroke=n,this.drawShape(a),this},e.prototype.drawShape=function(t){return this._holeMode?this._geometry.drawHole(t,this._matrix):this._geometry.drawShape(t,this._fillStyle.clone(),this._lineStyle.clone(),this._matrix),this},e.prototype.clear=function(){return this._geometry.clear(),this._lineStyle.reset(),this._fillStyle.reset(),this._boundsID++,this._matrix=null,this._holeMode=!1,this.currentPath=null,this},e.prototype.isFastRect=function(){var t=this._geometry.graphicsData;return!(1!==t.length||t[0].shape.type!==r.SHAPES.RECT||t[0].matrix||t[0].holes.length||t[0].lineStyle.visible&&t[0].lineStyle.width)},e.prototype._render=function(t){this.finishPoly();var e=this._geometry,i=t.context.supports.uint32Indices;e.updateBatches(i),e.batchable?(this.batchDirty!==e.batchDirty&&this._populateBatches(),this._renderBatched(t)):(t.batch.flush(),this._renderDirect(t))},e.prototype._populateBatches=function(){var t=this._geometry,e=this.blendMode,i=t.batches.length;this.batchTint=-1,this._transformID=-1,this.batchDirty=t.batchDirty,this.batches.length=i,this.vertexData=new Float32Array(t.points);for(var r=0;r<i;r++){var n=t.batches[r],h=n.style.color,a=new Float32Array(this.vertexData.buffer,4*n.attribStart*2,2*n.attribSize),o=new Float32Array(t.uvsFloat32.buffer,4*n.attribStart*2,2*n.attribSize),l={vertexData:a,blendMode:e,indices:new Uint16Array(t.indicesUint16.buffer,2*n.start,n.size),uvs:o,_batchRGB:s.hex2rgb(h),_tintRGB:h,_texture:n.style.texture,alpha:n.style.alpha,worldAlpha:1};this.batches[r]=l}},e.prototype._renderBatched=function(t){if(this.batches.length){t.batch.setObjectRenderer(t.plugins[this.pluginName]),this.calculateVertices(),this.calculateTints();for(var e=0,i=this.batches.length;e<i;e++){var r=this.batches[e];r.worldAlpha=this.worldAlpha*r.alpha,t.plugins[this.pluginName].render(r)}}},e.prototype._renderDirect=function(t){var e=this._resolveDirectShader(t),i=this._geometry,r=this.tint,s=this.worldAlpha,n=e.uniforms,h=i.drawCalls;n.translationMatrix=this.transform.worldTransform,n.tint[0]=(r>>16&255)/255*s,n.tint[1]=(r>>8&255)/255*s,n.tint[2]=(255&r)/255*s,n.tint[3]=s,t.shader.bind(e),t.geometry.bind(i,e),t.state.set(this.state);for(var a=0,o=h.length;a<o;a++)this._renderDrawCallDirect(t,i.drawCalls[a])},e.prototype._renderDrawCallDirect=function(t,e){for(var i=e.texArray,r=e.type,s=e.size,n=e.start,h=i.count,a=0;a<h;a++)t.texture.bind(i.elements[a],a);t.geometry.draw(r,s,n)},e.prototype._resolveDirectShader=function(t){var e=this.shader,s=this.pluginName;if(!e){if(!N[s]){for(var n=t.plugins[s].MAX_TEXTURES,h=new Int32Array(n),a=0;a<n;a++)h[a]=a;var o={tint:new Float32Array([1,1,1,1]),translationMatrix:new r.Matrix,default:i.UniformGroup.from({uSamplers:h},!0)},l=t.plugins[s]._shader.program;N[s]=new i.Shader(l,o)}e=N[s]}return e},e.prototype._calculateBounds=function(){this.finishPoly();var t=this._geometry;if(t.graphicsData.length){var e=t.bounds,i=e.minX,r=e.minY,s=e.maxX,n=e.maxY;this._bounds.addFrame(this.transform,i,r,s,n)}},e.prototype.containsPoint=function(t){return this.worldTransform.applyInverse(t,e._TEMP_POINT),this._geometry.containsPoint(e._TEMP_POINT)},e.prototype.calculateTints=function(){if(this.batchTint!==this.tint){this.batchTint=this.tint;for(var t=s.hex2rgb(this.tint,B),e=0;e<this.batches.length;e++){var i=this.batches[e],r=i._batchRGB,n=(t[0]*r[0]*255<<16)+(t[1]*r[1]*255<<8)+(0|t[2]*r[2]*255);i._tintRGB=(n>>16)+(65280&n)+((255&n)<<16)}}},e.prototype.calculateVertices=function(){var t=this.transform._worldID;if(this._transformID!==t){this._transformID=t;for(var e=this.transform.worldTransform,i=e.a,r=e.b,s=e.c,n=e.d,h=e.tx,a=e.ty,o=this._geometry.points,l=this.vertexData,u=0,p=0;p<o.length;p+=2){var c=o[p],d=o[p+1];l[u++]=i*c+s*d+h,l[u++]=n*d+r*c+a}}},e.prototype.closePath=function(){var t=this.currentPath;return t&&(t.closeStroke=!0,this.finishPoly()),this},e.prototype.setMatrix=function(t){return this._matrix=t,this},e.prototype.beginHole=function(){return this.finishPoly(),this._holeMode=!0,this},e.prototype.endHole=function(){return this.finishPoly(),this._holeMode=!1,this},e.prototype.destroy=function(e){this._geometry.refCount--,0===this._geometry.refCount&&this._geometry.dispose(),this._matrix=null,this.currentPath=null,this._lineStyle.destroy(),this._lineStyle=null,this._fillStyle.destroy(),this._fillStyle=null,this._geometry=null,this.shader=null,this.vertexData=null,this.batches.length=0,this.batches=null,t.prototype.destroy.call(this,e)},e.nextRoundedRectBehavior=!1,e._TEMP_POINT=new r.Point,e}(h.Container),U={buildPoly:c,buildCircle:d,buildRectangle:f,buildRoundedRectangle:g,buildLine:m,ArcUtils:S,BezierUtils:P,QuadraticUtils:w,BatchPart:M,FILL_COMMANDS:E,BATCH_POOL:A,DRAW_CALL_POOL:T};exports.FillStyle=o,exports.GRAPHICS_CURVES=a,exports.Graphics=O,exports.GraphicsData=D,exports.GraphicsGeometry=R,exports.LineStyle=L,exports.graphicsUtils=U; | ||
//# sourceMappingURL=graphics.min.js.map |
/*! | ||
* @pixi/graphics - v6.3.2 | ||
* Compiled Wed, 04 May 2022 17:49:13 UTC | ||
* @pixi/graphics - v6.4.0 | ||
* Compiled Wed, 01 Jun 2022 21:14:23 UTC | ||
* | ||
@@ -8,3 +8,3 @@ * @pixi/graphics is licensed under the MIT License. | ||
*/ | ||
import{Texture as t,BaseTexture as e,BatchDrawCall as i,BatchTextureArray as r,BatchGeometry as n,UniformGroup as s,Shader as h,State as a}from"@pixi/core";import{SHAPES as o,Point as l,PI_2 as u,Matrix as p,Polygon as c,Rectangle as d,RoundedRectangle as f,Circle as y,Ellipse as v}from"@pixi/math";import{earcut as g,premultiplyTint as b,hex2rgb as m}from"@pixi/utils";import{WRAP_MODES as x,DRAW_MODES as _,BLEND_MODES as w}from"@pixi/constants";import{Bounds as M,Container as P}from"@pixi/display";var S,T;!function(t){t.MITER="miter",t.BEVEL="bevel",t.ROUND="round"}(S||(S={})),function(t){t.BUTT="butt",t.ROUND="round",t.SQUARE="square"}(T||(T={}));var D={adaptive:!0,maxLength:10,minSegments:8,maxSegments:2048,epsilon:1e-4,_segmentsCount:function(t,e){if(void 0===e&&(e=20),!this.adaptive||!t||isNaN(t))return e;var i=Math.ceil(t/this.maxLength);return i<this.minSegments?i=this.minSegments:i>this.maxSegments&&(i=this.maxSegments),i}},A=function(){function e(){this.color=16777215,this.alpha=1,this.texture=t.WHITE,this.matrix=null,this.visible=!1,this.reset()}return e.prototype.clone=function(){var t=new e;return t.color=this.color,t.alpha=this.alpha,t.texture=this.texture,t.matrix=this.matrix,t.visible=this.visible,t},e.prototype.reset=function(){this.color=16777215,this.alpha=1,this.texture=t.WHITE,this.matrix=null,this.visible=!1},e.prototype.destroy=function(){this.texture=null,this.matrix=null},e}(),C=function(t,e){return C=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},C(t,e)};function E(t,e){function i(){this.constructor=t}C(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}function I(t,e){var i,r;void 0===e&&(e=!1);var n=t.length;if(!(n<6)){for(var s=0,h=0,a=t[n-2],o=t[n-1];h<n;h+=2){var l=t[h],u=t[h+1];s+=(l-a)*(u+o),a=l,o=u}if(!e&&s>0||e&&s<=0){var p=n/2;for(h=p+p%2;h<n;h+=2){var c=n-h-2,d=n-h-1,f=h,y=h+1;i=[t[f],t[c]],t[c]=i[0],t[f]=i[1],r=[t[y],t[d]],t[d]=r[0],t[y]=r[1]}}}}var R={build:function(t){t.points=t.shape.points.slice()},triangulate:function(t,e){var i=t.points,r=t.holes,n=e.points,s=e.indices;if(i.length>=6){I(i,!1);for(var h=[],a=0;a<r.length;a++){var o=r[a];I(o.points,!0),h.push(i.length/2),i=i.concat(o.points)}var l=g(i,h,2);if(!l)return;var u=n.length/2;for(a=0;a<l.length;a+=3)s.push(l[a]+u),s.push(l[a+1]+u),s.push(l[a+2]+u);for(a=0;a<i.length;a++)n.push(i[a])}}},B={build:function(t){var e,i,r,n,s,h,a=t.points;if(t.type===o.CIRC){var l=t.shape;e=l.x,i=l.y,s=h=l.radius,r=n=0}else if(t.type===o.ELIP){var u=t.shape;e=u.x,i=u.y,s=u.width,h=u.height,r=n=0}else{var p=t.shape,c=p.width/2,d=p.height/2;e=p.x+c,i=p.y+d,r=c-(s=h=Math.max(0,Math.min(p.radius,Math.min(c,d)))),n=d-h}var f=Math.ceil(2.3*Math.sqrt(s+h)),y=8*f+(r?4:0)+(n?4:0);if(a.length=y,0!==y){if(0===f)return a.length=8,a[0]=a[6]=e+r,a[1]=a[3]=i+n,a[2]=a[4]=e-r,void(a[5]=a[7]=i-n);var v=0,g=4*f+(r?2:0)+2,b=g,m=y,x=e+(T=r+s),_=e-T,w=i+(D=n);if(a[v++]=x,a[v++]=w,a[--g]=w,a[--g]=_,n){var M=i-D;a[b++]=_,a[b++]=M,a[--m]=M,a[--m]=x}for(var P=1;P<f;P++){var S=Math.PI/2*(P/f);x=e+(T=r+Math.cos(S)*s),_=e-T,w=i+(D=n+Math.sin(S)*h),M=i-D;a[v++]=x,a[v++]=w,a[--g]=w,a[--g]=_,a[b++]=_,a[b++]=M,a[--m]=M,a[--m]=x}var T,D;x=e+(T=r),_=e-T,w=i+(D=n+h),M=i-D;a[v++]=x,a[v++]=w,a[--m]=M,a[--m]=x,r&&(a[v++]=_,a[v++]=w,a[--m]=M,a[--m]=_)}},triangulate:function(t,e){var i,r,n=t.points,s=e.points,h=e.indices,a=s.length/2,l=a;if(t.type!==o.RREC){var u=t.shape;i=u.x,r=u.y}else{var p=t.shape;i=p.x+p.width/2,r=p.y+p.height/2}var c=t.matrix;s.push(t.matrix?c.a*i+c.c*r+c.tx:i,t.matrix?c.b*i+c.d*r+c.ty:r),a++,s.push(n[0],n[1]);for(var d=2;d<n.length;d+=2)s.push(n[d],n[d+1]),h.push(a++,l,a);h.push(l+1,l,a)}},L={build:function(t){var e=t.shape,i=e.x,r=e.y,n=e.width,s=e.height,h=t.points;h.length=0,h.push(i,r,i+n,r,i+n,r+s,i,r+s)},triangulate:function(t,e){var i=t.points,r=e.points,n=r.length/2;r.push(i[0],i[1],i[2],i[3],i[6],i[7],i[4],i[5]),e.indices.push(n,n+1,n+2,n+1,n+2,n+3)}};function O(t,e,i){return t+(e-t)*i}function U(t,e,i,r,n,s,h){void 0===h&&(h=[]);for(var a=h,o=0,l=0,u=0,p=0,c=0,d=0,f=0,y=0;f<=20;++f)o=O(t,i,y=f/20),l=O(e,r,y),u=O(i,n,y),p=O(r,s,y),c=O(o,u,y),d=O(l,p,y),0===f&&a[a.length-2]===c&&a[a.length-1]===d||a.push(c,d);return a}var j={build:function(t){if(it.nextRoundedRectBehavior)B.build(t);else{var e=t.shape,i=t.points,r=e.x,n=e.y,s=e.width,h=e.height,a=Math.max(0,Math.min(e.radius,Math.min(s,h)/2));i.length=0,a?(U(r,n+a,r,n,r+a,n,i),U(r+s-a,n,r+s,n,r+s,n+a,i),U(r+s,n+h-a,r+s,n+h,r+s-a,n+h,i),U(r+a,n+h,r,n+h,r,n+h-a,i)):i.push(r,n,r+s,n,r+s,n+h,r,n+h)}},triangulate:function(t,e){if(it.nextRoundedRectBehavior)B.triangulate(t,e);else{for(var i=t.points,r=e.points,n=e.indices,s=r.length/2,h=g(i,null,2),a=0,o=h.length;a<o;a+=3)n.push(h[a]+s),n.push(h[a+1]+s),n.push(h[a+2]+s);for(a=0,o=i.length;a<o;a++)r.push(i[a],i[++a])}}};function F(t,e,i,r,n,s,h,a){var o,l;h?(o=r,l=-i):(o=-r,l=i);var u=t-i*n+o,p=e-r*n+l,c=t+i*s+o,d=e+r*s+l;return a.push(u,p),a.push(c,d),2}function N(t,e,i,r,n,s,h,a){var o=i-t,l=r-e,u=Math.atan2(o,l),p=Math.atan2(n-t,s-e);a&&u<p?u+=2*Math.PI:!a&&u>p&&(p+=2*Math.PI);var c=u,d=p-u,f=Math.abs(d),y=Math.sqrt(o*o+l*l),v=1+(15*f*Math.sqrt(y)/Math.PI>>0),g=d/v;if(c+=g,a){h.push(t,e),h.push(i,r);for(var b=1,m=c;b<v;b++,m+=g)h.push(t,e),h.push(t+Math.sin(m)*y,e+Math.cos(m)*y);h.push(t,e),h.push(n,s)}else{h.push(i,r),h.push(t,e);for(b=1,m=c;b<v;b++,m+=g)h.push(t+Math.sin(m)*y,e+Math.cos(m)*y),h.push(t,e);h.push(n,s),h.push(t,e)}return 2*v}function z(t,e){t.lineStyle.native?function(t,e){var i=0,r=t.shape,n=t.points||r.points,s=r.type!==o.POLY||r.closeStroke;if(0!==n.length){var h=e.points,a=e.indices,l=n.length/2,u=h.length/2,p=u;for(h.push(n[0],n[1]),i=1;i<l;i++)h.push(n[2*i],n[2*i+1]),a.push(p,p+1),p++;s&&a.push(p,u)}}(t,e):function(t,e){var i=t.shape,r=t.points||i.points.slice(),n=e.closePointEps;if(0!==r.length){var s=t.lineStyle,h=new l(r[0],r[1]),a=new l(r[r.length-2],r[r.length-1]),u=i.type!==o.POLY||i.closeStroke,p=Math.abs(h.x-a.x)<n&&Math.abs(h.y-a.y)<n;if(u){r=r.slice(),p&&(r.pop(),r.pop(),a.set(r[r.length-2],r[r.length-1]));var c=.5*(h.x+a.x),d=.5*(a.y+h.y);r.unshift(c,d),r.push(c,d)}var f=e.points,y=r.length/2,v=r.length,g=f.length/2,b=s.width/2,m=b*b,x=s.miterLimit*s.miterLimit,_=r[0],w=r[1],M=r[2],P=r[3],A=0,C=0,E=-(w-P),I=_-M,R=0,B=0,L=Math.sqrt(E*E+I*I);E/=L,I/=L,E*=b,I*=b;var O=s.alignment,U=2*(1-O),j=2*O;u||(s.cap===T.ROUND?v+=N(_-E*(U-j)*.5,w-I*(U-j)*.5,_-E*U,w-I*U,_+E*j,w+I*j,f,!0)+2:s.cap===T.SQUARE&&(v+=F(_,w,E,I,U,j,!0,f))),f.push(_-E*U,w-I*U),f.push(_+E*j,w+I*j);for(var z=1;z<y-1;++z){_=r[2*(z-1)],w=r[2*(z-1)+1],M=r[2*z],P=r[2*z+1],A=r[2*(z+1)],C=r[2*(z+1)+1],E=-(w-P),I=_-M,E/=L=Math.sqrt(E*E+I*I),I/=L,E*=b,I*=b,R=-(P-C),B=M-A,R/=L=Math.sqrt(R*R+B*B),B/=L,R*=b,B*=b;var q=M-_,k=w-P,H=M-A,Y=C-P,G=k*H-Y*q,V=G<0;if(Math.abs(G)<.1)f.push(M-E*U,P-I*U),f.push(M+E*j,P+I*j);else{var W=(-E+_)*(-I+P)-(-E+M)*(-I+w),Q=(-R+A)*(-B+P)-(-R+M)*(-B+C),X=(q*Q-H*W)/G,Z=(Y*W-k*Q)/G,J=(X-M)*(X-M)+(Z-P)*(Z-P),K=M+(X-M)*U,$=P+(Z-P)*U,tt=M-(X-M)*j,et=P-(Z-P)*j,it=V?U:j;J<=Math.min(q*q+k*k,H*H+Y*Y)+it*it*m?s.join===S.BEVEL||J/m>x?(V?(f.push(K,$),f.push(M+E*j,P+I*j),f.push(K,$),f.push(M+R*j,P+B*j)):(f.push(M-E*U,P-I*U),f.push(tt,et),f.push(M-R*U,P-B*U),f.push(tt,et)),v+=2):s.join===S.ROUND?V?(f.push(K,$),f.push(M+E*j,P+I*j),v+=N(M,P,M+E*j,P+I*j,M+R*j,P+B*j,f,!0)+4,f.push(K,$),f.push(M+R*j,P+B*j)):(f.push(M-E*U,P-I*U),f.push(tt,et),v+=N(M,P,M-E*U,P-I*U,M-R*U,P-B*U,f,!1)+4,f.push(M-R*U,P-B*U),f.push(tt,et)):(f.push(K,$),f.push(tt,et)):(f.push(M-E*U,P-I*U),f.push(M+E*j,P+I*j),s.join===S.BEVEL||J/m>x||(s.join===S.ROUND?v+=V?N(M,P,M+E*j,P+I*j,M+R*j,P+B*j,f,!0)+2:N(M,P,M-E*U,P-I*U,M-R*U,P-B*U,f,!1)+2:(V?(f.push(tt,et),f.push(tt,et)):(f.push(K,$),f.push(K,$)),v+=2)),f.push(M-R*U,P-B*U),f.push(M+R*j,P+B*j),v+=2)}}_=r[2*(y-2)],w=r[2*(y-2)+1],M=r[2*(y-1)],E=-(w-(P=r[2*(y-1)+1])),I=_-M,E/=L=Math.sqrt(E*E+I*I),I/=L,E*=b,I*=b,f.push(M-E*U,P-I*U),f.push(M+E*j,P+I*j),u||(s.cap===T.ROUND?v+=N(M-E*(U-j)*.5,P-I*(U-j)*.5,M-E*U,P-I*U,M+E*j,P+I*j,f,!1)+2:s.cap===T.SQUARE&&(v+=F(M,P,E,I,U,j,!1,f)));var rt=e.indices,nt=D.epsilon*D.epsilon;for(z=g;z<v+g-2;++z)_=f[2*z],w=f[2*z+1],M=f[2*(z+1)],P=f[2*(z+1)+1],A=f[2*(z+2)],C=f[2*(z+2)+1],Math.abs(_*(P-C)+M*(C-w)+A*(w-P))<nt||rt.push(z,z+1,z+2)}}(t,e)}var q,k=function(){function t(){}return t.curveTo=function(t,e,i,r,n,s){var h=s[s.length-2],a=s[s.length-1]-e,o=h-t,l=r-e,u=i-t,p=Math.abs(a*u-o*l);if(p<1e-8||0===n)return s[s.length-2]===t&&s[s.length-1]===e||s.push(t,e),null;var c=a*a+o*o,d=l*l+u*u,f=a*l+o*u,y=n*Math.sqrt(c)/p,v=n*Math.sqrt(d)/p,g=y*f/c,b=v*f/d,m=y*u+v*o,x=y*l+v*a,_=o*(v+g),w=a*(v+g),M=u*(y+b),P=l*(y+b);return{cx:m+t,cy:x+e,radius:n,startAngle:Math.atan2(w-x,_-m),endAngle:Math.atan2(P-x,M-m),anticlockwise:o*l>u*a}},t.arc=function(t,e,i,r,n,s,h,a,o){for(var l=h-s,p=D._segmentsCount(Math.abs(l)*n,40*Math.ceil(Math.abs(l)/u)),c=l/(2*p),d=2*c,f=Math.cos(c),y=Math.sin(c),v=p-1,g=v%1/v,b=0;b<=v;++b){var m=c+s+d*(b+g*b),x=Math.cos(m),_=-Math.sin(m);o.push((f*x+y*_)*n+i,(f*-_+y*x)*n+r)}},t}(),H=function(){function t(){}return t.curveLength=function(t,e,i,r,n,s,h,a){for(var o=0,l=0,u=0,p=0,c=0,d=0,f=0,y=0,v=0,g=0,b=0,m=t,x=e,_=1;_<=10;++_)g=m-(y=(f=(d=(c=1-(l=_/10))*c)*c)*t+3*d*l*i+3*c*(u=l*l)*n+(p=u*l)*h),b=x-(v=f*e+3*d*l*r+3*c*u*s+p*a),m=y,x=v,o+=Math.sqrt(g*g+b*b);return o},t.curveTo=function(e,i,r,n,s,h,a){var o=a[a.length-2],l=a[a.length-1];a.length-=2;var u=D._segmentsCount(t.curveLength(o,l,e,i,r,n,s,h)),p=0,c=0,d=0,f=0,y=0;a.push(o,l);for(var v=1,g=0;v<=u;++v)d=(c=(p=1-(g=v/u))*p)*p,y=(f=g*g)*g,a.push(d*o+3*c*g*e+3*p*f*r+y*s,d*l+3*c*g*i+3*p*f*n+y*h)},t}(),Y=function(){function t(){}return t.curveLength=function(t,e,i,r,n,s){var h=t-2*i+n,a=e-2*r+s,o=2*i-2*t,l=2*r-2*e,u=4*(h*h+a*a),p=4*(h*o+a*l),c=o*o+l*l,d=2*Math.sqrt(u+p+c),f=Math.sqrt(u),y=2*u*f,v=2*Math.sqrt(c),g=p/f;return(y*d+f*p*(d-v)+(4*c*u-p*p)*Math.log((2*f+g+d)/(g+v)))/(4*y)},t.curveTo=function(e,i,r,n,s){for(var h=s[s.length-2],a=s[s.length-1],o=D._segmentsCount(t.curveLength(h,a,e,i,r,n)),l=0,u=0,p=1;p<=o;++p){var c=p/o;l=h+(e-h)*c,u=a+(i-a)*c,s.push(l+(e+(r-e)*c-l)*c,u+(i+(n-i)*c-u)*c)}},t}(),G=function(){function t(){this.reset()}return t.prototype.begin=function(t,e,i){this.reset(),this.style=t,this.start=e,this.attribStart=i},t.prototype.end=function(t,e){this.attribSize=e-this.attribStart,this.size=t-this.start},t.prototype.reset=function(){this.style=null,this.size=0,this.start=0,this.attribStart=0,this.attribSize=0},t}(),V=((q={})[o.POLY]=R,q[o.CIRC]=B,q[o.ELIP]=B,q[o.RECT]=L,q[o.RREC]=j,q),W=[],Q=[],X=function(){function t(t,e,i,r){void 0===e&&(e=null),void 0===i&&(i=null),void 0===r&&(r=null),this.points=[],this.holes=[],this.shape=t,this.lineStyle=i,this.fillStyle=e,this.matrix=r,this.type=t.type}return t.prototype.clone=function(){return new t(this.shape,this.fillStyle,this.lineStyle,this.matrix)},t.prototype.destroy=function(){this.shape=null,this.holes.length=0,this.holes=null,this.points.length=0,this.points=null,this.lineStyle=null,this.fillStyle=null},t}(),Z=new l,J=new M,K=function(t){function n(){var e=t.call(this)||this;return e.closePointEps=1e-4,e.boundsPadding=0,e.uvsFloat32=null,e.indicesUint16=null,e.batchable=!1,e.points=[],e.colors=[],e.uvs=[],e.indices=[],e.textureIds=[],e.graphicsData=[],e.drawCalls=[],e.batchDirty=-1,e.batches=[],e.dirty=0,e.cacheDirty=-1,e.clearDirty=0,e.shapeIndex=0,e._bounds=new M,e.boundsDirty=-1,e}return E(n,t),Object.defineProperty(n.prototype,"bounds",{get:function(){return this.boundsDirty!==this.dirty&&(this.boundsDirty=this.dirty,this.calculateBounds()),this._bounds},enumerable:!1,configurable:!0}),n.prototype.invalidate=function(){this.boundsDirty=-1,this.dirty++,this.batchDirty++,this.shapeIndex=0,this.points.length=0,this.colors.length=0,this.uvs.length=0,this.indices.length=0,this.textureIds.length=0;for(var t=0;t<this.drawCalls.length;t++)this.drawCalls[t].texArray.clear(),Q.push(this.drawCalls[t]);this.drawCalls.length=0;for(t=0;t<this.batches.length;t++){var e=this.batches[t];e.reset(),W.push(e)}this.batches.length=0},n.prototype.clear=function(){return this.graphicsData.length>0&&(this.invalidate(),this.clearDirty++,this.graphicsData.length=0),this},n.prototype.drawShape=function(t,e,i,r){void 0===e&&(e=null),void 0===i&&(i=null),void 0===r&&(r=null);var n=new X(t,e,i,r);return this.graphicsData.push(n),this.dirty++,this},n.prototype.drawHole=function(t,e){if(void 0===e&&(e=null),!this.graphicsData.length)return null;var i=new X(t,null,null,e),r=this.graphicsData[this.graphicsData.length-1];return i.lineStyle=r.lineStyle,r.holes.push(i),this.dirty++,this},n.prototype.destroy=function(){t.prototype.destroy.call(this);for(var e=0;e<this.graphicsData.length;++e)this.graphicsData[e].destroy();this.points.length=0,this.points=null,this.colors.length=0,this.colors=null,this.uvs.length=0,this.uvs=null,this.indices.length=0,this.indices=null,this.indexBuffer.destroy(),this.indexBuffer=null,this.graphicsData.length=0,this.graphicsData=null,this.drawCalls.length=0,this.drawCalls=null,this.batches.length=0,this.batches=null,this._bounds=null},n.prototype.containsPoint=function(t){for(var e=this.graphicsData,i=0;i<e.length;++i){var r=e[i];if(r.fillStyle.visible&&(r.shape&&(r.matrix?r.matrix.applyInverse(t,Z):Z.copyFrom(t),r.shape.contains(Z.x,Z.y)))){var n=!1;if(r.holes)for(var s=0;s<r.holes.length;s++){if(r.holes[s].shape.contains(Z.x,Z.y)){n=!0;break}}if(!n)return!0}}return!1},n.prototype.updateBatches=function(t){if(this.graphicsData.length){if(this.validateBatching()){this.cacheDirty=this.dirty;var e=this.uvs,i=this.graphicsData,r=null,n=null;this.batches.length>0&&(n=(r=this.batches[this.batches.length-1]).style);for(var s=this.shapeIndex;s<i.length;s++){this.shapeIndex++;var h=i[s],a=h.fillStyle,o=h.lineStyle;V[h.type].build(h),h.matrix&&this.transformPoints(h.points,h.matrix),(a.visible||o.visible)&&this.processHoles(h.holes);for(var l=0;l<2;l++){var u=0===l?a:o;if(u.visible){var p=u.texture.baseTexture,c=this.indices.length,d=this.points.length/2;p.wrapMode=x.REPEAT,0===l?this.processFill(h):this.processLine(h);var f=this.points.length/2-d;0!==f&&(r&&!this._compareStyles(n,u)&&(r.end(c,d),r=null),r||((r=W.pop()||new G).begin(u,c,d),this.batches.push(r),n=u),this.addUvs(this.points,e,u.texture,d,f,u.matrix))}}}var y=this.indices.length,v=this.points.length/2;if(r&&r.end(y,v),0!==this.batches.length){if(this.indicesUint16&&this.indices.length===this.indicesUint16.length)this.indicesUint16.set(this.indices);else{var g=v>65535&&t;this.indicesUint16=g?new Uint32Array(this.indices):new Uint16Array(this.indices)}this.batchable=this.isBatchable(),this.batchable?this.packBatches():this.buildDrawCalls()}else this.batchable=!0}}else this.batchable=!0},n.prototype._compareStyles=function(t,e){return!(!t||!e)&&(t.texture.baseTexture===e.texture.baseTexture&&(t.color+t.alpha===e.color+e.alpha&&!!t.native==!!e.native))},n.prototype.validateBatching=function(){if(this.dirty===this.cacheDirty||!this.graphicsData.length)return!1;for(var t=0,e=this.graphicsData.length;t<e;t++){var i=this.graphicsData[t],r=i.fillStyle,n=i.lineStyle;if(r&&!r.texture.baseTexture.valid)return!1;if(n&&!n.texture.baseTexture.valid)return!1}return!0},n.prototype.packBatches=function(){this.batchDirty++,this.uvsFloat32=new Float32Array(this.uvs);for(var t=this.batches,e=0,i=t.length;e<i;e++)for(var r=t[e],n=0;n<r.size;n++){var s=r.start+n;this.indicesUint16[s]=this.indicesUint16[s]-r.attribStart}},n.prototype.isBatchable=function(){if(this.points.length>131070)return!1;for(var t=this.batches,e=0;e<t.length;e++)if(t[e].style.native)return!1;return this.points.length<2*n.BATCHABLE_SIZE},n.prototype.buildDrawCalls=function(){for(var t=++e._globalBatch,n=0;n<this.drawCalls.length;n++)this.drawCalls[n].texArray.clear(),Q.push(this.drawCalls[n]);this.drawCalls.length=0;var s=this.colors,h=this.textureIds,a=Q.pop();a||((a=new i).texArray=new r),a.texArray.count=0,a.start=0,a.size=0,a.type=_.TRIANGLES;var o=0,l=null,u=0,p=!1,c=_.TRIANGLES,d=0;this.drawCalls.push(a);for(n=0;n<this.batches.length;n++){var f=this.batches[n],y=f.style,v=y.texture.baseTexture;p!==!!y.native&&(c=(p=!!y.native)?_.LINES:_.TRIANGLES,l=null,o=8,t++),l!==v&&(l=v,v._batchEnabled!==t&&(8===o&&(t++,o=0,a.size>0&&((a=Q.pop())||((a=new i).texArray=new r),this.drawCalls.push(a)),a.start=d,a.size=0,a.texArray.count=0,a.type=c),v.touched=1,v._batchEnabled=t,v._batchLocation=o,v.wrapMode=x.REPEAT,a.texArray.elements[a.texArray.count++]=v,o++)),a.size+=f.size,d+=f.size,u=v._batchLocation,this.addColors(s,y.color,y.alpha,f.attribSize,f.attribStart),this.addTextureIds(h,u,f.attribSize,f.attribStart)}e._globalBatch=t,this.packAttributes()},n.prototype.packAttributes=function(){for(var t=this.points,e=this.uvs,i=this.colors,r=this.textureIds,n=new ArrayBuffer(3*t.length*4),s=new Float32Array(n),h=new Uint32Array(n),a=0,o=0;o<t.length/2;o++)s[a++]=t[2*o],s[a++]=t[2*o+1],s[a++]=e[2*o],s[a++]=e[2*o+1],h[a++]=i[o],s[a++]=r[o];this._buffer.update(n),this._indexBuffer.update(this.indicesUint16)},n.prototype.processFill=function(t){t.holes.length?R.triangulate(t,this):V[t.type].triangulate(t,this)},n.prototype.processLine=function(t){z(t,this);for(var e=0;e<t.holes.length;e++)z(t.holes[e],this)},n.prototype.processHoles=function(t){for(var e=0;e<t.length;e++){var i=t[e];V[i.type].build(i),i.matrix&&this.transformPoints(i.points,i.matrix)}},n.prototype.calculateBounds=function(){var t=this._bounds,e=J,i=p.IDENTITY;this._bounds.clear(),e.clear();for(var r=0;r<this.graphicsData.length;r++){var n=this.graphicsData[r],s=n.shape,h=n.type,a=n.lineStyle,l=n.matrix||p.IDENTITY,u=0;if(a&&a.visible&&(u=a.width,h!==o.POLY||n.fillStyle.visible?u*=Math.max(0,a.alignment):u*=Math.max(a.alignment,1-a.alignment)),i!==l&&(e.isEmpty()||(t.addBoundsMatrix(e,i),e.clear()),i=l),h===o.RECT||h===o.RREC){var c=s;e.addFramePad(c.x,c.y,c.x+c.width,c.y+c.height,u,u)}else if(h===o.CIRC){var d=s;e.addFramePad(d.x,d.y,d.x,d.y,d.radius+u,d.radius+u)}else if(h===o.ELIP){var f=s;e.addFramePad(f.x,f.y,f.x,f.y,f.width+u,f.height+u)}else{var y=s;t.addVerticesMatrix(i,y.points,0,y.points.length,u,u)}}e.isEmpty()||t.addBoundsMatrix(e,i),t.pad(this.boundsPadding,this.boundsPadding)},n.prototype.transformPoints=function(t,e){for(var i=0;i<t.length/2;i++){var r=t[2*i],n=t[2*i+1];t[2*i]=e.a*r+e.c*n+e.tx,t[2*i+1]=e.b*r+e.d*n+e.ty}},n.prototype.addColors=function(t,e,i,r,n){void 0===n&&(n=0);var s=b((e>>16)+(65280&e)+((255&e)<<16),i);t.length=Math.max(t.length,n+r);for(var h=0;h<r;h++)t[n+h]=s},n.prototype.addTextureIds=function(t,e,i,r){void 0===r&&(r=0),t.length=Math.max(t.length,r+i);for(var n=0;n<i;n++)t[r+n]=e},n.prototype.addUvs=function(t,e,i,r,n,s){void 0===s&&(s=null);for(var h=0,a=e.length,o=i.frame;h<n;){var l=t[2*(r+h)],u=t[2*(r+h)+1];if(s){var p=s.a*l+s.c*u+s.tx;u=s.b*l+s.d*u+s.ty,l=p}h++,e.push(l/o.width,u/o.height)}var c=i.baseTexture;(o.width<c.width||o.height<c.height)&&this.adjustUvs(e,i,a,n)},n.prototype.adjustUvs=function(t,e,i,r){for(var n=e.baseTexture,s=1e-6,h=i+2*r,a=e.frame,o=a.width/n.width,l=a.height/n.height,u=a.x/a.width,p=a.y/a.height,c=Math.floor(t[i]+s),d=Math.floor(t[i+1]+s),f=i+2;f<h;f+=2)c=Math.min(c,Math.floor(t[f]+s)),d=Math.min(d,Math.floor(t[f+1]+s));u-=c,p-=d;for(f=i;f<h;f+=2)t[f]=(t[f]+u)*o,t[f+1]=(t[f+1]+p)*l},n.BATCHABLE_SIZE=100,n}(n),$=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.width=0,e.alignment=.5,e.native=!1,e.cap=T.BUTT,e.join=S.MITER,e.miterLimit=10,e}return E(e,t),e.prototype.clone=function(){var t=new e;return t.color=this.color,t.alpha=this.alpha,t.texture=this.texture,t.matrix=this.matrix,t.visible=this.visible,t.width=this.width,t.alignment=this.alignment,t.native=this.native,t.cap=this.cap,t.join=this.join,t.miterLimit=this.miterLimit,t},e.prototype.reset=function(){t.prototype.reset.call(this),this.color=0,this.alignment=.5,this.width=0,this.native=!1},e}(A),tt=new Float32Array(3),et={},it=function(e){function i(t){void 0===t&&(t=null);var i=e.call(this)||this;return i.shader=null,i.pluginName="batch",i.currentPath=null,i.batches=[],i.batchTint=-1,i.batchDirty=-1,i.vertexData=null,i._fillStyle=new A,i._lineStyle=new $,i._matrix=null,i._holeMode=!1,i.state=a.for2d(),i._geometry=t||new K,i._geometry.refCount++,i._transformID=-1,i.tint=16777215,i.blendMode=w.NORMAL,i}return E(i,e),Object.defineProperty(i.prototype,"geometry",{get:function(){return this._geometry},enumerable:!1,configurable:!0}),i.prototype.clone=function(){return this.finishPoly(),new i(this._geometry)},Object.defineProperty(i.prototype,"blendMode",{get:function(){return this.state.blendMode},set:function(t){this.state.blendMode=t},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"tint",{get:function(){return this._tint},set:function(t){this._tint=t},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"fill",{get:function(){return this._fillStyle},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"line",{get:function(){return this._lineStyle},enumerable:!1,configurable:!0}),i.prototype.lineStyle=function(t,e,i,r,n){return void 0===t&&(t=null),void 0===e&&(e=0),void 0===i&&(i=1),void 0===r&&(r=.5),void 0===n&&(n=!1),"number"==typeof t&&(t={width:t,color:e,alpha:i,alignment:r,native:n}),this.lineTextureStyle(t)},i.prototype.lineTextureStyle=function(e){e=Object.assign({width:0,texture:t.WHITE,color:e&&e.texture?16777215:0,alpha:1,matrix:null,alignment:.5,native:!1,cap:T.BUTT,join:S.MITER,miterLimit:10},e),this.currentPath&&this.startPoly();var i=e.width>0&&e.alpha>0;return i?(e.matrix&&(e.matrix=e.matrix.clone(),e.matrix.invert()),Object.assign(this._lineStyle,{visible:i},e)):this._lineStyle.reset(),this},i.prototype.startPoly=function(){if(this.currentPath){var t=this.currentPath.points,e=this.currentPath.points.length;e>2&&(this.drawShape(this.currentPath),this.currentPath=new c,this.currentPath.closeStroke=!1,this.currentPath.points.push(t[e-2],t[e-1]))}else this.currentPath=new c,this.currentPath.closeStroke=!1},i.prototype.finishPoly=function(){this.currentPath&&(this.currentPath.points.length>2?(this.drawShape(this.currentPath),this.currentPath=null):this.currentPath.points.length=0)},i.prototype.moveTo=function(t,e){return this.startPoly(),this.currentPath.points[0]=t,this.currentPath.points[1]=e,this},i.prototype.lineTo=function(t,e){this.currentPath||this.moveTo(0,0);var i=this.currentPath.points,r=i[i.length-2],n=i[i.length-1];return r===t&&n===e||i.push(t,e),this},i.prototype._initCurve=function(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.currentPath?0===this.currentPath.points.length&&(this.currentPath.points=[t,e]):this.moveTo(t,e)},i.prototype.quadraticCurveTo=function(t,e,i,r){this._initCurve();var n=this.currentPath.points;return 0===n.length&&this.moveTo(0,0),Y.curveTo(t,e,i,r,n),this},i.prototype.bezierCurveTo=function(t,e,i,r,n,s){return this._initCurve(),H.curveTo(t,e,i,r,n,s,this.currentPath.points),this},i.prototype.arcTo=function(t,e,i,r,n){this._initCurve(t,e);var s=this.currentPath.points,h=k.curveTo(t,e,i,r,n,s);if(h){var a=h.cx,o=h.cy,l=h.radius,u=h.startAngle,p=h.endAngle,c=h.anticlockwise;this.arc(a,o,l,u,p,c)}return this},i.prototype.arc=function(t,e,i,r,n,s){if(void 0===s&&(s=!1),r===n)return this;if(!s&&n<=r?n+=u:s&&r<=n&&(r+=u),0===n-r)return this;var h=t+Math.cos(r)*i,a=e+Math.sin(r)*i,o=this._geometry.closePointEps,l=this.currentPath?this.currentPath.points:null;if(l){var p=Math.abs(l[l.length-2]-h),c=Math.abs(l[l.length-1]-a);p<o&&c<o||l.push(h,a)}else this.moveTo(h,a),l=this.currentPath.points;return k.arc(h,a,t,e,i,r,n,s,l),this},i.prototype.beginFill=function(e,i){return void 0===e&&(e=0),void 0===i&&(i=1),this.beginTextureFill({texture:t.WHITE,color:e,alpha:i})},i.prototype.beginTextureFill=function(e){e=Object.assign({texture:t.WHITE,color:16777215,alpha:1,matrix:null},e),this.currentPath&&this.startPoly();var i=e.alpha>0;return i?(e.matrix&&(e.matrix=e.matrix.clone(),e.matrix.invert()),Object.assign(this._fillStyle,{visible:i},e)):this._fillStyle.reset(),this},i.prototype.endFill=function(){return this.finishPoly(),this._fillStyle.reset(),this},i.prototype.drawRect=function(t,e,i,r){return this.drawShape(new d(t,e,i,r))},i.prototype.drawRoundedRect=function(t,e,i,r,n){return this.drawShape(new f(t,e,i,r,n))},i.prototype.drawCircle=function(t,e,i){return this.drawShape(new y(t,e,i))},i.prototype.drawEllipse=function(t,e,i,r){return this.drawShape(new v(t,e,i,r))},i.prototype.drawPolygon=function(){for(var t,e=arguments,i=[],r=0;r<arguments.length;r++)i[r]=e[r];var n=!0,s=i[0];s.points?(n=s.closeStroke,t=s.points):t=Array.isArray(i[0])?i[0]:i;var h=new c(t);return h.closeStroke=n,this.drawShape(h),this},i.prototype.drawShape=function(t){return this._holeMode?this._geometry.drawHole(t,this._matrix):this._geometry.drawShape(t,this._fillStyle.clone(),this._lineStyle.clone(),this._matrix),this},i.prototype.clear=function(){return this._geometry.clear(),this._lineStyle.reset(),this._fillStyle.reset(),this._boundsID++,this._matrix=null,this._holeMode=!1,this.currentPath=null,this},i.prototype.isFastRect=function(){var t=this._geometry.graphicsData;return!(1!==t.length||t[0].shape.type!==o.RECT||t[0].matrix||t[0].holes.length||t[0].lineStyle.visible&&t[0].lineStyle.width)},i.prototype._render=function(t){this.finishPoly();var e=this._geometry,i=t.context.supports.uint32Indices;e.updateBatches(i),e.batchable?(this.batchDirty!==e.batchDirty&&this._populateBatches(),this._renderBatched(t)):(t.batch.flush(),this._renderDirect(t))},i.prototype._populateBatches=function(){var t=this._geometry,e=this.blendMode,i=t.batches.length;this.batchTint=-1,this._transformID=-1,this.batchDirty=t.batchDirty,this.batches.length=i,this.vertexData=new Float32Array(t.points);for(var r=0;r<i;r++){var n=t.batches[r],s=n.style.color,h=new Float32Array(this.vertexData.buffer,4*n.attribStart*2,2*n.attribSize),a=new Float32Array(t.uvsFloat32.buffer,4*n.attribStart*2,2*n.attribSize),o={vertexData:h,blendMode:e,indices:new Uint16Array(t.indicesUint16.buffer,2*n.start,n.size),uvs:a,_batchRGB:m(s),_tintRGB:s,_texture:n.style.texture,alpha:n.style.alpha,worldAlpha:1};this.batches[r]=o}},i.prototype._renderBatched=function(t){if(this.batches.length){t.batch.setObjectRenderer(t.plugins[this.pluginName]),this.calculateVertices(),this.calculateTints();for(var e=0,i=this.batches.length;e<i;e++){var r=this.batches[e];r.worldAlpha=this.worldAlpha*r.alpha,t.plugins[this.pluginName].render(r)}}},i.prototype._renderDirect=function(t){var e=this._resolveDirectShader(t),i=this._geometry,r=this.tint,n=this.worldAlpha,s=e.uniforms,h=i.drawCalls;s.translationMatrix=this.transform.worldTransform,s.tint[0]=(r>>16&255)/255*n,s.tint[1]=(r>>8&255)/255*n,s.tint[2]=(255&r)/255*n,s.tint[3]=n,t.shader.bind(e),t.geometry.bind(i,e),t.state.set(this.state);for(var a=0,o=h.length;a<o;a++)this._renderDrawCallDirect(t,i.drawCalls[a])},i.prototype._renderDrawCallDirect=function(t,e){for(var i=e.texArray,r=e.type,n=e.size,s=e.start,h=i.count,a=0;a<h;a++)t.texture.bind(i.elements[a],a);t.geometry.draw(r,n,s)},i.prototype._resolveDirectShader=function(t){var e=this.shader,i=this.pluginName;if(!e){if(!et[i]){for(var r=t.plugins[i].MAX_TEXTURES,n=new Int32Array(r),a=0;a<r;a++)n[a]=a;var o={tint:new Float32Array([1,1,1,1]),translationMatrix:new p,default:s.from({uSamplers:n},!0)},l=t.plugins[i]._shader.program;et[i]=new h(l,o)}e=et[i]}return e},i.prototype._calculateBounds=function(){this.finishPoly();var t=this._geometry;if(t.graphicsData.length){var e=t.bounds,i=e.minX,r=e.minY,n=e.maxX,s=e.maxY;this._bounds.addFrame(this.transform,i,r,n,s)}},i.prototype.containsPoint=function(t){return this.worldTransform.applyInverse(t,i._TEMP_POINT),this._geometry.containsPoint(i._TEMP_POINT)},i.prototype.calculateTints=function(){if(this.batchTint!==this.tint){this.batchTint=this.tint;for(var t=m(this.tint,tt),e=0;e<this.batches.length;e++){var i=this.batches[e],r=i._batchRGB,n=(t[0]*r[0]*255<<16)+(t[1]*r[1]*255<<8)+(0|t[2]*r[2]*255);i._tintRGB=(n>>16)+(65280&n)+((255&n)<<16)}}},i.prototype.calculateVertices=function(){var t=this.transform._worldID;if(this._transformID!==t){this._transformID=t;for(var e=this.transform.worldTransform,i=e.a,r=e.b,n=e.c,s=e.d,h=e.tx,a=e.ty,o=this._geometry.points,l=this.vertexData,u=0,p=0;p<o.length;p+=2){var c=o[p],d=o[p+1];l[u++]=i*c+n*d+h,l[u++]=s*d+r*c+a}}},i.prototype.closePath=function(){var t=this.currentPath;return t&&(t.closeStroke=!0,this.finishPoly()),this},i.prototype.setMatrix=function(t){return this._matrix=t,this},i.prototype.beginHole=function(){return this.finishPoly(),this._holeMode=!0,this},i.prototype.endHole=function(){return this.finishPoly(),this._holeMode=!1,this},i.prototype.destroy=function(t){this._geometry.refCount--,0===this._geometry.refCount&&this._geometry.dispose(),this._matrix=null,this.currentPath=null,this._lineStyle.destroy(),this._lineStyle=null,this._fillStyle.destroy(),this._fillStyle=null,this._geometry=null,this.shader=null,this.vertexData=null,this.batches.length=0,this.batches=null,e.prototype.destroy.call(this,t)},i.nextRoundedRectBehavior=!1,i._TEMP_POINT=new l,i}(P),rt={buildPoly:R,buildCircle:B,buildRectangle:L,buildRoundedRectangle:j,buildLine:z,ArcUtils:k,BezierUtils:H,QuadraticUtils:Y,BatchPart:G,FILL_COMMANDS:V,BATCH_POOL:W,DRAW_CALL_POOL:Q};export{A as FillStyle,D as GRAPHICS_CURVES,it as Graphics,X as GraphicsData,K as GraphicsGeometry,T as LINE_CAP,S as LINE_JOIN,$ as LineStyle,rt as graphicsUtils}; | ||
import{Texture as t,BaseTexture as e,BatchDrawCall as i,BatchTextureArray as r,BatchGeometry as n,UniformGroup as s,Shader as h,State as a}from"@pixi/core";import{SHAPES as o,Point as l,PI_2 as u,Matrix as p,Polygon as c,Rectangle as d,RoundedRectangle as f,Circle as y,Ellipse as v}from"@pixi/math";import{earcut as g,premultiplyTint as b,hex2rgb as m}from"@pixi/utils";import{WRAP_MODES as x,DRAW_MODES as _,BLEND_MODES as w}from"@pixi/constants";import{Bounds as M,Container as P}from"@pixi/display";var S,T;!function(t){t.MITER="miter",t.BEVEL="bevel",t.ROUND="round"}(S||(S={})),function(t){t.BUTT="butt",t.ROUND="round",t.SQUARE="square"}(T||(T={}));var D={adaptive:!0,maxLength:10,minSegments:8,maxSegments:2048,epsilon:1e-4,_segmentsCount:function(t,e){if(void 0===e&&(e=20),!this.adaptive||!t||isNaN(t))return e;var i=Math.ceil(t/this.maxLength);return i<this.minSegments?i=this.minSegments:i>this.maxSegments&&(i=this.maxSegments),i}},A=function(){function e(){this.color=16777215,this.alpha=1,this.texture=t.WHITE,this.matrix=null,this.visible=!1,this.reset()}return e.prototype.clone=function(){var t=new e;return t.color=this.color,t.alpha=this.alpha,t.texture=this.texture,t.matrix=this.matrix,t.visible=this.visible,t},e.prototype.reset=function(){this.color=16777215,this.alpha=1,this.texture=t.WHITE,this.matrix=null,this.visible=!1},e.prototype.destroy=function(){this.texture=null,this.matrix=null},e}(),C=function(t,e){return C=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},C(t,e)};function I(t,e){function i(){this.constructor=t}C(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}function E(t,e){var i,r;void 0===e&&(e=!1);var n=t.length;if(!(n<6)){for(var s=0,h=0,a=t[n-2],o=t[n-1];h<n;h+=2){var l=t[h],u=t[h+1];s+=(l-a)*(u+o),a=l,o=u}if(!e&&s>0||e&&s<=0){var p=n/2;for(h=p+p%2;h<n;h+=2){var c=n-h-2,d=n-h-1,f=h,y=h+1;i=[t[f],t[c]],t[c]=i[0],t[f]=i[1],r=[t[y],t[d]],t[d]=r[0],t[y]=r[1]}}}}var R={build:function(t){t.points=t.shape.points.slice()},triangulate:function(t,e){var i=t.points,r=t.holes,n=e.points,s=e.indices;if(i.length>=6){E(i,!1);for(var h=[],a=0;a<r.length;a++){var o=r[a];E(o.points,!0),h.push(i.length/2),i=i.concat(o.points)}var l=g(i,h,2);if(!l)return;var u=n.length/2;for(a=0;a<l.length;a+=3)s.push(l[a]+u),s.push(l[a+1]+u),s.push(l[a+2]+u);for(a=0;a<i.length;a++)n.push(i[a])}}},B={build:function(t){var e,i,r,n,s,h,a=t.points;if(t.type===o.CIRC){var l=t.shape;e=l.x,i=l.y,s=h=l.radius,r=n=0}else if(t.type===o.ELIP){var u=t.shape;e=u.x,i=u.y,s=u.width,h=u.height,r=n=0}else{var p=t.shape,c=p.width/2,d=p.height/2;e=p.x+c,i=p.y+d,r=c-(s=h=Math.max(0,Math.min(p.radius,Math.min(c,d)))),n=d-h}if(s>=0&&h>=0&&r>=0&&n>=0){var f=Math.ceil(2.3*Math.sqrt(s+h)),y=8*f+(r?4:0)+(n?4:0);if(a.length=y,0!==y){if(0===f)return a.length=8,a[0]=a[6]=e+r,a[1]=a[3]=i+n,a[2]=a[4]=e-r,void(a[5]=a[7]=i-n);var v=0,g=4*f+(r?2:0)+2,b=g,m=y,x=e+(T=r+s),_=e-T,w=i+(D=n);if(a[v++]=x,a[v++]=w,a[--g]=w,a[--g]=_,n){var M=i-D;a[b++]=_,a[b++]=M,a[--m]=M,a[--m]=x}for(var P=1;P<f;P++){var S=Math.PI/2*(P/f);x=e+(T=r+Math.cos(S)*s),_=e-T,w=i+(D=n+Math.sin(S)*h),M=i-D;a[v++]=x,a[v++]=w,a[--g]=w,a[--g]=_,a[b++]=_,a[b++]=M,a[--m]=M,a[--m]=x}var T,D;x=e+(T=r),_=e-T,w=i+(D=n+h),M=i-D;a[v++]=x,a[v++]=w,a[--m]=M,a[--m]=x,r&&(a[v++]=_,a[v++]=w,a[--m]=M,a[--m]=_)}}else a.length=0},triangulate:function(t,e){var i,r,n=t.points,s=e.points,h=e.indices,a=s.length/2,l=a;if(t.type!==o.RREC){var u=t.shape;i=u.x,r=u.y}else{var p=t.shape;i=p.x+p.width/2,r=p.y+p.height/2}var c=t.matrix;s.push(t.matrix?c.a*i+c.c*r+c.tx:i,t.matrix?c.b*i+c.d*r+c.ty:r),a++,s.push(n[0],n[1]);for(var d=2;d<n.length;d+=2)s.push(n[d],n[d+1]),h.push(a++,l,a);h.push(l+1,l,a)}},L={build:function(t){var e=t.shape,i=e.x,r=e.y,n=e.width,s=e.height,h=t.points;h.length=0,h.push(i,r,i+n,r,i+n,r+s,i,r+s)},triangulate:function(t,e){var i=t.points,r=e.points,n=r.length/2;r.push(i[0],i[1],i[2],i[3],i[6],i[7],i[4],i[5]),e.indices.push(n,n+1,n+2,n+1,n+2,n+3)}};function O(t,e,i){return t+(e-t)*i}function U(t,e,i,r,n,s,h){void 0===h&&(h=[]);for(var a=h,o=0,l=0,u=0,p=0,c=0,d=0,f=0,y=0;f<=20;++f)o=O(t,i,y=f/20),l=O(e,r,y),u=O(i,n,y),p=O(r,s,y),c=O(o,u,y),d=O(l,p,y),0===f&&a[a.length-2]===c&&a[a.length-1]===d||a.push(c,d);return a}var j={build:function(t){if(it.nextRoundedRectBehavior)B.build(t);else{var e=t.shape,i=t.points,r=e.x,n=e.y,s=e.width,h=e.height,a=Math.max(0,Math.min(e.radius,Math.min(s,h)/2));i.length=0,a?(U(r,n+a,r,n,r+a,n,i),U(r+s-a,n,r+s,n,r+s,n+a,i),U(r+s,n+h-a,r+s,n+h,r+s-a,n+h,i),U(r+a,n+h,r,n+h,r,n+h-a,i)):i.push(r,n,r+s,n,r+s,n+h,r,n+h)}},triangulate:function(t,e){if(it.nextRoundedRectBehavior)B.triangulate(t,e);else{for(var i=t.points,r=e.points,n=e.indices,s=r.length/2,h=g(i,null,2),a=0,o=h.length;a<o;a+=3)n.push(h[a]+s),n.push(h[a+1]+s),n.push(h[a+2]+s);for(a=0,o=i.length;a<o;a++)r.push(i[a],i[++a])}}};function F(t,e,i,r,n,s,h,a){var o,l;h?(o=r,l=-i):(o=-r,l=i);var u=t-i*n+o,p=e-r*n+l,c=t+i*s+o,d=e+r*s+l;return a.push(u,p),a.push(c,d),2}function N(t,e,i,r,n,s,h,a){var o=i-t,l=r-e,u=Math.atan2(o,l),p=Math.atan2(n-t,s-e);a&&u<p?u+=2*Math.PI:!a&&u>p&&(p+=2*Math.PI);var c=u,d=p-u,f=Math.abs(d),y=Math.sqrt(o*o+l*l),v=1+(15*f*Math.sqrt(y)/Math.PI>>0),g=d/v;if(c+=g,a){h.push(t,e),h.push(i,r);for(var b=1,m=c;b<v;b++,m+=g)h.push(t,e),h.push(t+Math.sin(m)*y,e+Math.cos(m)*y);h.push(t,e),h.push(n,s)}else{h.push(i,r),h.push(t,e);for(b=1,m=c;b<v;b++,m+=g)h.push(t+Math.sin(m)*y,e+Math.cos(m)*y),h.push(t,e);h.push(n,s),h.push(t,e)}return 2*v}function z(t,e){t.lineStyle.native?function(t,e){var i=0,r=t.shape,n=t.points||r.points,s=r.type!==o.POLY||r.closeStroke;if(0!==n.length){var h=e.points,a=e.indices,l=n.length/2,u=h.length/2,p=u;for(h.push(n[0],n[1]),i=1;i<l;i++)h.push(n[2*i],n[2*i+1]),a.push(p,p+1),p++;s&&a.push(p,u)}}(t,e):function(t,e){var i=t.shape,r=t.points||i.points.slice(),n=e.closePointEps;if(0!==r.length){var s=t.lineStyle,h=new l(r[0],r[1]),a=new l(r[r.length-2],r[r.length-1]),u=i.type!==o.POLY||i.closeStroke,p=Math.abs(h.x-a.x)<n&&Math.abs(h.y-a.y)<n;if(u){r=r.slice(),p&&(r.pop(),r.pop(),a.set(r[r.length-2],r[r.length-1]));var c=.5*(h.x+a.x),d=.5*(a.y+h.y);r.unshift(c,d),r.push(c,d)}var f=e.points,y=r.length/2,v=r.length,g=f.length/2,b=s.width/2,m=b*b,x=s.miterLimit*s.miterLimit,_=r[0],w=r[1],M=r[2],P=r[3],A=0,C=0,I=-(w-P),E=_-M,R=0,B=0,L=Math.sqrt(I*I+E*E);I/=L,E/=L,I*=b,E*=b;var O=s.alignment,U=2*(1-O),j=2*O;u||(s.cap===T.ROUND?v+=N(_-I*(U-j)*.5,w-E*(U-j)*.5,_-I*U,w-E*U,_+I*j,w+E*j,f,!0)+2:s.cap===T.SQUARE&&(v+=F(_,w,I,E,U,j,!0,f))),f.push(_-I*U,w-E*U),f.push(_+I*j,w+E*j);for(var z=1;z<y-1;++z){_=r[2*(z-1)],w=r[2*(z-1)+1],M=r[2*z],P=r[2*z+1],A=r[2*(z+1)],C=r[2*(z+1)+1],I=-(w-P),E=_-M,I/=L=Math.sqrt(I*I+E*E),E/=L,I*=b,E*=b,R=-(P-C),B=M-A,R/=L=Math.sqrt(R*R+B*B),B/=L,R*=b,B*=b;var q=M-_,k=w-P,H=M-A,Y=C-P,G=k*H-Y*q,W=G<0;if(Math.abs(G)<.1)f.push(M-I*U,P-E*U),f.push(M+I*j,P+E*j);else{var V=(-I+_)*(-E+P)-(-I+M)*(-E+w),Q=(-R+A)*(-B+P)-(-R+M)*(-B+C),X=(q*Q-H*V)/G,Z=(Y*V-k*Q)/G,J=(X-M)*(X-M)+(Z-P)*(Z-P),K=M+(X-M)*U,$=P+(Z-P)*U,tt=M-(X-M)*j,et=P-(Z-P)*j,it=W?U:j;J<=Math.min(q*q+k*k,H*H+Y*Y)+it*it*m?s.join===S.BEVEL||J/m>x?(W?(f.push(K,$),f.push(M+I*j,P+E*j),f.push(K,$),f.push(M+R*j,P+B*j)):(f.push(M-I*U,P-E*U),f.push(tt,et),f.push(M-R*U,P-B*U),f.push(tt,et)),v+=2):s.join===S.ROUND?W?(f.push(K,$),f.push(M+I*j,P+E*j),v+=N(M,P,M+I*j,P+E*j,M+R*j,P+B*j,f,!0)+4,f.push(K,$),f.push(M+R*j,P+B*j)):(f.push(M-I*U,P-E*U),f.push(tt,et),v+=N(M,P,M-I*U,P-E*U,M-R*U,P-B*U,f,!1)+4,f.push(M-R*U,P-B*U),f.push(tt,et)):(f.push(K,$),f.push(tt,et)):(f.push(M-I*U,P-E*U),f.push(M+I*j,P+E*j),s.join===S.ROUND?v+=W?N(M,P,M+I*j,P+E*j,M+R*j,P+B*j,f,!0)+2:N(M,P,M-I*U,P-E*U,M-R*U,P-B*U,f,!1)+2:s.join===S.MITER&&J/m<=x&&(W?(f.push(tt,et),f.push(tt,et)):(f.push(K,$),f.push(K,$)),v+=2),f.push(M-R*U,P-B*U),f.push(M+R*j,P+B*j),v+=2)}}_=r[2*(y-2)],w=r[2*(y-2)+1],M=r[2*(y-1)],I=-(w-(P=r[2*(y-1)+1])),E=_-M,I/=L=Math.sqrt(I*I+E*E),E/=L,I*=b,E*=b,f.push(M-I*U,P-E*U),f.push(M+I*j,P+E*j),u||(s.cap===T.ROUND?v+=N(M-I*(U-j)*.5,P-E*(U-j)*.5,M-I*U,P-E*U,M+I*j,P+E*j,f,!1)+2:s.cap===T.SQUARE&&(v+=F(M,P,I,E,U,j,!1,f)));var rt=e.indices,nt=D.epsilon*D.epsilon;for(z=g;z<v+g-2;++z)_=f[2*z],w=f[2*z+1],M=f[2*(z+1)],P=f[2*(z+1)+1],A=f[2*(z+2)],C=f[2*(z+2)+1],Math.abs(_*(P-C)+M*(C-w)+A*(w-P))<nt||rt.push(z,z+1,z+2)}}(t,e)}var q,k=function(){function t(){}return t.curveTo=function(t,e,i,r,n,s){var h=s[s.length-2],a=s[s.length-1]-e,o=h-t,l=r-e,u=i-t,p=Math.abs(a*u-o*l);if(p<1e-8||0===n)return s[s.length-2]===t&&s[s.length-1]===e||s.push(t,e),null;var c=a*a+o*o,d=l*l+u*u,f=a*l+o*u,y=n*Math.sqrt(c)/p,v=n*Math.sqrt(d)/p,g=y*f/c,b=v*f/d,m=y*u+v*o,x=y*l+v*a,_=o*(v+g),w=a*(v+g),M=u*(y+b),P=l*(y+b);return{cx:m+t,cy:x+e,radius:n,startAngle:Math.atan2(w-x,_-m),endAngle:Math.atan2(P-x,M-m),anticlockwise:o*l>u*a}},t.arc=function(t,e,i,r,n,s,h,a,o){for(var l=h-s,p=D._segmentsCount(Math.abs(l)*n,40*Math.ceil(Math.abs(l)/u)),c=l/(2*p),d=2*c,f=Math.cos(c),y=Math.sin(c),v=p-1,g=v%1/v,b=0;b<=v;++b){var m=c+s+d*(b+g*b),x=Math.cos(m),_=-Math.sin(m);o.push((f*x+y*_)*n+i,(f*-_+y*x)*n+r)}},t}(),H=function(){function t(){}return t.curveLength=function(t,e,i,r,n,s,h,a){for(var o=0,l=0,u=0,p=0,c=0,d=0,f=0,y=0,v=0,g=0,b=0,m=t,x=e,_=1;_<=10;++_)g=m-(y=(f=(d=(c=1-(l=_/10))*c)*c)*t+3*d*l*i+3*c*(u=l*l)*n+(p=u*l)*h),b=x-(v=f*e+3*d*l*r+3*c*u*s+p*a),m=y,x=v,o+=Math.sqrt(g*g+b*b);return o},t.curveTo=function(e,i,r,n,s,h,a){var o=a[a.length-2],l=a[a.length-1];a.length-=2;var u=D._segmentsCount(t.curveLength(o,l,e,i,r,n,s,h)),p=0,c=0,d=0,f=0,y=0;a.push(o,l);for(var v=1,g=0;v<=u;++v)d=(c=(p=1-(g=v/u))*p)*p,y=(f=g*g)*g,a.push(d*o+3*c*g*e+3*p*f*r+y*s,d*l+3*c*g*i+3*p*f*n+y*h)},t}(),Y=function(){function t(){}return t.curveLength=function(t,e,i,r,n,s){var h=t-2*i+n,a=e-2*r+s,o=2*i-2*t,l=2*r-2*e,u=4*(h*h+a*a),p=4*(h*o+a*l),c=o*o+l*l,d=2*Math.sqrt(u+p+c),f=Math.sqrt(u),y=2*u*f,v=2*Math.sqrt(c),g=p/f;return(y*d+f*p*(d-v)+(4*c*u-p*p)*Math.log((2*f+g+d)/(g+v)))/(4*y)},t.curveTo=function(e,i,r,n,s){for(var h=s[s.length-2],a=s[s.length-1],o=D._segmentsCount(t.curveLength(h,a,e,i,r,n)),l=0,u=0,p=1;p<=o;++p){var c=p/o;l=h+(e-h)*c,u=a+(i-a)*c,s.push(l+(e+(r-e)*c-l)*c,u+(i+(n-i)*c-u)*c)}},t}(),G=function(){function t(){this.reset()}return t.prototype.begin=function(t,e,i){this.reset(),this.style=t,this.start=e,this.attribStart=i},t.prototype.end=function(t,e){this.attribSize=e-this.attribStart,this.size=t-this.start},t.prototype.reset=function(){this.style=null,this.size=0,this.start=0,this.attribStart=0,this.attribSize=0},t}(),W=((q={})[o.POLY]=R,q[o.CIRC]=B,q[o.ELIP]=B,q[o.RECT]=L,q[o.RREC]=j,q),V=[],Q=[],X=function(){function t(t,e,i,r){void 0===e&&(e=null),void 0===i&&(i=null),void 0===r&&(r=null),this.points=[],this.holes=[],this.shape=t,this.lineStyle=i,this.fillStyle=e,this.matrix=r,this.type=t.type}return t.prototype.clone=function(){return new t(this.shape,this.fillStyle,this.lineStyle,this.matrix)},t.prototype.destroy=function(){this.shape=null,this.holes.length=0,this.holes=null,this.points.length=0,this.points=null,this.lineStyle=null,this.fillStyle=null},t}(),Z=new l,J=new M,K=function(t){function n(){var e=t.call(this)||this;return e.closePointEps=1e-4,e.boundsPadding=0,e.uvsFloat32=null,e.indicesUint16=null,e.batchable=!1,e.points=[],e.colors=[],e.uvs=[],e.indices=[],e.textureIds=[],e.graphicsData=[],e.drawCalls=[],e.batchDirty=-1,e.batches=[],e.dirty=0,e.cacheDirty=-1,e.clearDirty=0,e.shapeIndex=0,e._bounds=new M,e.boundsDirty=-1,e}return I(n,t),Object.defineProperty(n.prototype,"bounds",{get:function(){return this.boundsDirty!==this.dirty&&(this.boundsDirty=this.dirty,this.calculateBounds()),this._bounds},enumerable:!1,configurable:!0}),n.prototype.invalidate=function(){this.boundsDirty=-1,this.dirty++,this.batchDirty++,this.shapeIndex=0,this.points.length=0,this.colors.length=0,this.uvs.length=0,this.indices.length=0,this.textureIds.length=0;for(var t=0;t<this.drawCalls.length;t++)this.drawCalls[t].texArray.clear(),Q.push(this.drawCalls[t]);this.drawCalls.length=0;for(t=0;t<this.batches.length;t++){var e=this.batches[t];e.reset(),V.push(e)}this.batches.length=0},n.prototype.clear=function(){return this.graphicsData.length>0&&(this.invalidate(),this.clearDirty++,this.graphicsData.length=0),this},n.prototype.drawShape=function(t,e,i,r){void 0===e&&(e=null),void 0===i&&(i=null),void 0===r&&(r=null);var n=new X(t,e,i,r);return this.graphicsData.push(n),this.dirty++,this},n.prototype.drawHole=function(t,e){if(void 0===e&&(e=null),!this.graphicsData.length)return null;var i=new X(t,null,null,e),r=this.graphicsData[this.graphicsData.length-1];return i.lineStyle=r.lineStyle,r.holes.push(i),this.dirty++,this},n.prototype.destroy=function(){t.prototype.destroy.call(this);for(var e=0;e<this.graphicsData.length;++e)this.graphicsData[e].destroy();this.points.length=0,this.points=null,this.colors.length=0,this.colors=null,this.uvs.length=0,this.uvs=null,this.indices.length=0,this.indices=null,this.indexBuffer.destroy(),this.indexBuffer=null,this.graphicsData.length=0,this.graphicsData=null,this.drawCalls.length=0,this.drawCalls=null,this.batches.length=0,this.batches=null,this._bounds=null},n.prototype.containsPoint=function(t){for(var e=this.graphicsData,i=0;i<e.length;++i){var r=e[i];if(r.fillStyle.visible&&(r.shape&&(r.matrix?r.matrix.applyInverse(t,Z):Z.copyFrom(t),r.shape.contains(Z.x,Z.y)))){var n=!1;if(r.holes)for(var s=0;s<r.holes.length;s++){if(r.holes[s].shape.contains(Z.x,Z.y)){n=!0;break}}if(!n)return!0}}return!1},n.prototype.updateBatches=function(t){if(this.graphicsData.length){if(this.validateBatching()){this.cacheDirty=this.dirty;var e=this.uvs,i=this.graphicsData,r=null,n=null;this.batches.length>0&&(n=(r=this.batches[this.batches.length-1]).style);for(var s=this.shapeIndex;s<i.length;s++){this.shapeIndex++;var h=i[s],a=h.fillStyle,o=h.lineStyle;W[h.type].build(h),h.matrix&&this.transformPoints(h.points,h.matrix),(a.visible||o.visible)&&this.processHoles(h.holes);for(var l=0;l<2;l++){var u=0===l?a:o;if(u.visible){var p=u.texture.baseTexture,c=this.indices.length,d=this.points.length/2;p.wrapMode=x.REPEAT,0===l?this.processFill(h):this.processLine(h);var f=this.points.length/2-d;0!==f&&(r&&!this._compareStyles(n,u)&&(r.end(c,d),r=null),r||((r=V.pop()||new G).begin(u,c,d),this.batches.push(r),n=u),this.addUvs(this.points,e,u.texture,d,f,u.matrix))}}}var y=this.indices.length,v=this.points.length/2;if(r&&r.end(y,v),0!==this.batches.length){if(this.indicesUint16&&this.indices.length===this.indicesUint16.length)this.indicesUint16.set(this.indices);else{var g=v>65535&&t;this.indicesUint16=g?new Uint32Array(this.indices):new Uint16Array(this.indices)}this.batchable=this.isBatchable(),this.batchable?this.packBatches():this.buildDrawCalls()}else this.batchable=!0}}else this.batchable=!0},n.prototype._compareStyles=function(t,e){return!(!t||!e)&&(t.texture.baseTexture===e.texture.baseTexture&&(t.color+t.alpha===e.color+e.alpha&&!!t.native==!!e.native))},n.prototype.validateBatching=function(){if(this.dirty===this.cacheDirty||!this.graphicsData.length)return!1;for(var t=0,e=this.graphicsData.length;t<e;t++){var i=this.graphicsData[t],r=i.fillStyle,n=i.lineStyle;if(r&&!r.texture.baseTexture.valid)return!1;if(n&&!n.texture.baseTexture.valid)return!1}return!0},n.prototype.packBatches=function(){this.batchDirty++,this.uvsFloat32=new Float32Array(this.uvs);for(var t=this.batches,e=0,i=t.length;e<i;e++)for(var r=t[e],n=0;n<r.size;n++){var s=r.start+n;this.indicesUint16[s]=this.indicesUint16[s]-r.attribStart}},n.prototype.isBatchable=function(){if(this.points.length>131070)return!1;for(var t=this.batches,e=0;e<t.length;e++)if(t[e].style.native)return!1;return this.points.length<2*n.BATCHABLE_SIZE},n.prototype.buildDrawCalls=function(){for(var t=++e._globalBatch,n=0;n<this.drawCalls.length;n++)this.drawCalls[n].texArray.clear(),Q.push(this.drawCalls[n]);this.drawCalls.length=0;var s=this.colors,h=this.textureIds,a=Q.pop();a||((a=new i).texArray=new r),a.texArray.count=0,a.start=0,a.size=0,a.type=_.TRIANGLES;var o=0,l=null,u=0,p=!1,c=_.TRIANGLES,d=0;this.drawCalls.push(a);for(n=0;n<this.batches.length;n++){var f=this.batches[n],y=f.style,v=y.texture.baseTexture;p!==!!y.native&&(c=(p=!!y.native)?_.LINES:_.TRIANGLES,l=null,o=8,t++),l!==v&&(l=v,v._batchEnabled!==t&&(8===o&&(t++,o=0,a.size>0&&((a=Q.pop())||((a=new i).texArray=new r),this.drawCalls.push(a)),a.start=d,a.size=0,a.texArray.count=0,a.type=c),v.touched=1,v._batchEnabled=t,v._batchLocation=o,v.wrapMode=x.REPEAT,a.texArray.elements[a.texArray.count++]=v,o++)),a.size+=f.size,d+=f.size,u=v._batchLocation,this.addColors(s,y.color,y.alpha,f.attribSize,f.attribStart),this.addTextureIds(h,u,f.attribSize,f.attribStart)}e._globalBatch=t,this.packAttributes()},n.prototype.packAttributes=function(){for(var t=this.points,e=this.uvs,i=this.colors,r=this.textureIds,n=new ArrayBuffer(3*t.length*4),s=new Float32Array(n),h=new Uint32Array(n),a=0,o=0;o<t.length/2;o++)s[a++]=t[2*o],s[a++]=t[2*o+1],s[a++]=e[2*o],s[a++]=e[2*o+1],h[a++]=i[o],s[a++]=r[o];this._buffer.update(n),this._indexBuffer.update(this.indicesUint16)},n.prototype.processFill=function(t){t.holes.length?R.triangulate(t,this):W[t.type].triangulate(t,this)},n.prototype.processLine=function(t){z(t,this);for(var e=0;e<t.holes.length;e++)z(t.holes[e],this)},n.prototype.processHoles=function(t){for(var e=0;e<t.length;e++){var i=t[e];W[i.type].build(i),i.matrix&&this.transformPoints(i.points,i.matrix)}},n.prototype.calculateBounds=function(){var t=this._bounds,e=J,i=p.IDENTITY;this._bounds.clear(),e.clear();for(var r=0;r<this.graphicsData.length;r++){var n=this.graphicsData[r],s=n.shape,h=n.type,a=n.lineStyle,l=n.matrix||p.IDENTITY,u=0;if(a&&a.visible&&(u=a.width,h!==o.POLY||n.fillStyle.visible?u*=Math.max(0,a.alignment):u*=Math.max(a.alignment,1-a.alignment)),i!==l&&(e.isEmpty()||(t.addBoundsMatrix(e,i),e.clear()),i=l),h===o.RECT||h===o.RREC){var c=s;e.addFramePad(c.x,c.y,c.x+c.width,c.y+c.height,u,u)}else if(h===o.CIRC){var d=s;e.addFramePad(d.x,d.y,d.x,d.y,d.radius+u,d.radius+u)}else if(h===o.ELIP){var f=s;e.addFramePad(f.x,f.y,f.x,f.y,f.width+u,f.height+u)}else{var y=s;t.addVerticesMatrix(i,y.points,0,y.points.length,u,u)}}e.isEmpty()||t.addBoundsMatrix(e,i),t.pad(this.boundsPadding,this.boundsPadding)},n.prototype.transformPoints=function(t,e){for(var i=0;i<t.length/2;i++){var r=t[2*i],n=t[2*i+1];t[2*i]=e.a*r+e.c*n+e.tx,t[2*i+1]=e.b*r+e.d*n+e.ty}},n.prototype.addColors=function(t,e,i,r,n){void 0===n&&(n=0);var s=b((e>>16)+(65280&e)+((255&e)<<16),i);t.length=Math.max(t.length,n+r);for(var h=0;h<r;h++)t[n+h]=s},n.prototype.addTextureIds=function(t,e,i,r){void 0===r&&(r=0),t.length=Math.max(t.length,r+i);for(var n=0;n<i;n++)t[r+n]=e},n.prototype.addUvs=function(t,e,i,r,n,s){void 0===s&&(s=null);for(var h=0,a=e.length,o=i.frame;h<n;){var l=t[2*(r+h)],u=t[2*(r+h)+1];if(s){var p=s.a*l+s.c*u+s.tx;u=s.b*l+s.d*u+s.ty,l=p}h++,e.push(l/o.width,u/o.height)}var c=i.baseTexture;(o.width<c.width||o.height<c.height)&&this.adjustUvs(e,i,a,n)},n.prototype.adjustUvs=function(t,e,i,r){for(var n=e.baseTexture,s=1e-6,h=i+2*r,a=e.frame,o=a.width/n.width,l=a.height/n.height,u=a.x/a.width,p=a.y/a.height,c=Math.floor(t[i]+s),d=Math.floor(t[i+1]+s),f=i+2;f<h;f+=2)c=Math.min(c,Math.floor(t[f]+s)),d=Math.min(d,Math.floor(t[f+1]+s));u-=c,p-=d;for(f=i;f<h;f+=2)t[f]=(t[f]+u)*o,t[f+1]=(t[f+1]+p)*l},n.BATCHABLE_SIZE=100,n}(n),$=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.width=0,e.alignment=.5,e.native=!1,e.cap=T.BUTT,e.join=S.MITER,e.miterLimit=10,e}return I(e,t),e.prototype.clone=function(){var t=new e;return t.color=this.color,t.alpha=this.alpha,t.texture=this.texture,t.matrix=this.matrix,t.visible=this.visible,t.width=this.width,t.alignment=this.alignment,t.native=this.native,t.cap=this.cap,t.join=this.join,t.miterLimit=this.miterLimit,t},e.prototype.reset=function(){t.prototype.reset.call(this),this.color=0,this.alignment=.5,this.width=0,this.native=!1},e}(A),tt=new Float32Array(3),et={},it=function(e){function i(t){void 0===t&&(t=null);var i=e.call(this)||this;return i.shader=null,i.pluginName="batch",i.currentPath=null,i.batches=[],i.batchTint=-1,i.batchDirty=-1,i.vertexData=null,i._fillStyle=new A,i._lineStyle=new $,i._matrix=null,i._holeMode=!1,i.state=a.for2d(),i._geometry=t||new K,i._geometry.refCount++,i._transformID=-1,i.tint=16777215,i.blendMode=w.NORMAL,i}return I(i,e),Object.defineProperty(i.prototype,"geometry",{get:function(){return this._geometry},enumerable:!1,configurable:!0}),i.prototype.clone=function(){return this.finishPoly(),new i(this._geometry)},Object.defineProperty(i.prototype,"blendMode",{get:function(){return this.state.blendMode},set:function(t){this.state.blendMode=t},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"tint",{get:function(){return this._tint},set:function(t){this._tint=t},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"fill",{get:function(){return this._fillStyle},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"line",{get:function(){return this._lineStyle},enumerable:!1,configurable:!0}),i.prototype.lineStyle=function(t,e,i,r,n){return void 0===t&&(t=null),void 0===e&&(e=0),void 0===i&&(i=1),void 0===r&&(r=.5),void 0===n&&(n=!1),"number"==typeof t&&(t={width:t,color:e,alpha:i,alignment:r,native:n}),this.lineTextureStyle(t)},i.prototype.lineTextureStyle=function(e){e=Object.assign({width:0,texture:t.WHITE,color:e&&e.texture?16777215:0,alpha:1,matrix:null,alignment:.5,native:!1,cap:T.BUTT,join:S.MITER,miterLimit:10},e),this.currentPath&&this.startPoly();var i=e.width>0&&e.alpha>0;return i?(e.matrix&&(e.matrix=e.matrix.clone(),e.matrix.invert()),Object.assign(this._lineStyle,{visible:i},e)):this._lineStyle.reset(),this},i.prototype.startPoly=function(){if(this.currentPath){var t=this.currentPath.points,e=this.currentPath.points.length;e>2&&(this.drawShape(this.currentPath),this.currentPath=new c,this.currentPath.closeStroke=!1,this.currentPath.points.push(t[e-2],t[e-1]))}else this.currentPath=new c,this.currentPath.closeStroke=!1},i.prototype.finishPoly=function(){this.currentPath&&(this.currentPath.points.length>2?(this.drawShape(this.currentPath),this.currentPath=null):this.currentPath.points.length=0)},i.prototype.moveTo=function(t,e){return this.startPoly(),this.currentPath.points[0]=t,this.currentPath.points[1]=e,this},i.prototype.lineTo=function(t,e){this.currentPath||this.moveTo(0,0);var i=this.currentPath.points,r=i[i.length-2],n=i[i.length-1];return r===t&&n===e||i.push(t,e),this},i.prototype._initCurve=function(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.currentPath?0===this.currentPath.points.length&&(this.currentPath.points=[t,e]):this.moveTo(t,e)},i.prototype.quadraticCurveTo=function(t,e,i,r){this._initCurve();var n=this.currentPath.points;return 0===n.length&&this.moveTo(0,0),Y.curveTo(t,e,i,r,n),this},i.prototype.bezierCurveTo=function(t,e,i,r,n,s){return this._initCurve(),H.curveTo(t,e,i,r,n,s,this.currentPath.points),this},i.prototype.arcTo=function(t,e,i,r,n){this._initCurve(t,e);var s=this.currentPath.points,h=k.curveTo(t,e,i,r,n,s);if(h){var a=h.cx,o=h.cy,l=h.radius,u=h.startAngle,p=h.endAngle,c=h.anticlockwise;this.arc(a,o,l,u,p,c)}return this},i.prototype.arc=function(t,e,i,r,n,s){if(void 0===s&&(s=!1),r===n)return this;if(!s&&n<=r?n+=u:s&&r<=n&&(r+=u),0===n-r)return this;var h=t+Math.cos(r)*i,a=e+Math.sin(r)*i,o=this._geometry.closePointEps,l=this.currentPath?this.currentPath.points:null;if(l){var p=Math.abs(l[l.length-2]-h),c=Math.abs(l[l.length-1]-a);p<o&&c<o||l.push(h,a)}else this.moveTo(h,a),l=this.currentPath.points;return k.arc(h,a,t,e,i,r,n,s,l),this},i.prototype.beginFill=function(e,i){return void 0===e&&(e=0),void 0===i&&(i=1),this.beginTextureFill({texture:t.WHITE,color:e,alpha:i})},i.prototype.beginTextureFill=function(e){e=Object.assign({texture:t.WHITE,color:16777215,alpha:1,matrix:null},e),this.currentPath&&this.startPoly();var i=e.alpha>0;return i?(e.matrix&&(e.matrix=e.matrix.clone(),e.matrix.invert()),Object.assign(this._fillStyle,{visible:i},e)):this._fillStyle.reset(),this},i.prototype.endFill=function(){return this.finishPoly(),this._fillStyle.reset(),this},i.prototype.drawRect=function(t,e,i,r){return this.drawShape(new d(t,e,i,r))},i.prototype.drawRoundedRect=function(t,e,i,r,n){return this.drawShape(new f(t,e,i,r,n))},i.prototype.drawCircle=function(t,e,i){return this.drawShape(new y(t,e,i))},i.prototype.drawEllipse=function(t,e,i,r){return this.drawShape(new v(t,e,i,r))},i.prototype.drawPolygon=function(){for(var t,e=arguments,i=[],r=0;r<arguments.length;r++)i[r]=e[r];var n=!0,s=i[0];s.points?(n=s.closeStroke,t=s.points):t=Array.isArray(i[0])?i[0]:i;var h=new c(t);return h.closeStroke=n,this.drawShape(h),this},i.prototype.drawShape=function(t){return this._holeMode?this._geometry.drawHole(t,this._matrix):this._geometry.drawShape(t,this._fillStyle.clone(),this._lineStyle.clone(),this._matrix),this},i.prototype.clear=function(){return this._geometry.clear(),this._lineStyle.reset(),this._fillStyle.reset(),this._boundsID++,this._matrix=null,this._holeMode=!1,this.currentPath=null,this},i.prototype.isFastRect=function(){var t=this._geometry.graphicsData;return!(1!==t.length||t[0].shape.type!==o.RECT||t[0].matrix||t[0].holes.length||t[0].lineStyle.visible&&t[0].lineStyle.width)},i.prototype._render=function(t){this.finishPoly();var e=this._geometry,i=t.context.supports.uint32Indices;e.updateBatches(i),e.batchable?(this.batchDirty!==e.batchDirty&&this._populateBatches(),this._renderBatched(t)):(t.batch.flush(),this._renderDirect(t))},i.prototype._populateBatches=function(){var t=this._geometry,e=this.blendMode,i=t.batches.length;this.batchTint=-1,this._transformID=-1,this.batchDirty=t.batchDirty,this.batches.length=i,this.vertexData=new Float32Array(t.points);for(var r=0;r<i;r++){var n=t.batches[r],s=n.style.color,h=new Float32Array(this.vertexData.buffer,4*n.attribStart*2,2*n.attribSize),a=new Float32Array(t.uvsFloat32.buffer,4*n.attribStart*2,2*n.attribSize),o={vertexData:h,blendMode:e,indices:new Uint16Array(t.indicesUint16.buffer,2*n.start,n.size),uvs:a,_batchRGB:m(s),_tintRGB:s,_texture:n.style.texture,alpha:n.style.alpha,worldAlpha:1};this.batches[r]=o}},i.prototype._renderBatched=function(t){if(this.batches.length){t.batch.setObjectRenderer(t.plugins[this.pluginName]),this.calculateVertices(),this.calculateTints();for(var e=0,i=this.batches.length;e<i;e++){var r=this.batches[e];r.worldAlpha=this.worldAlpha*r.alpha,t.plugins[this.pluginName].render(r)}}},i.prototype._renderDirect=function(t){var e=this._resolveDirectShader(t),i=this._geometry,r=this.tint,n=this.worldAlpha,s=e.uniforms,h=i.drawCalls;s.translationMatrix=this.transform.worldTransform,s.tint[0]=(r>>16&255)/255*n,s.tint[1]=(r>>8&255)/255*n,s.tint[2]=(255&r)/255*n,s.tint[3]=n,t.shader.bind(e),t.geometry.bind(i,e),t.state.set(this.state);for(var a=0,o=h.length;a<o;a++)this._renderDrawCallDirect(t,i.drawCalls[a])},i.prototype._renderDrawCallDirect=function(t,e){for(var i=e.texArray,r=e.type,n=e.size,s=e.start,h=i.count,a=0;a<h;a++)t.texture.bind(i.elements[a],a);t.geometry.draw(r,n,s)},i.prototype._resolveDirectShader=function(t){var e=this.shader,i=this.pluginName;if(!e){if(!et[i]){for(var r=t.plugins[i].MAX_TEXTURES,n=new Int32Array(r),a=0;a<r;a++)n[a]=a;var o={tint:new Float32Array([1,1,1,1]),translationMatrix:new p,default:s.from({uSamplers:n},!0)},l=t.plugins[i]._shader.program;et[i]=new h(l,o)}e=et[i]}return e},i.prototype._calculateBounds=function(){this.finishPoly();var t=this._geometry;if(t.graphicsData.length){var e=t.bounds,i=e.minX,r=e.minY,n=e.maxX,s=e.maxY;this._bounds.addFrame(this.transform,i,r,n,s)}},i.prototype.containsPoint=function(t){return this.worldTransform.applyInverse(t,i._TEMP_POINT),this._geometry.containsPoint(i._TEMP_POINT)},i.prototype.calculateTints=function(){if(this.batchTint!==this.tint){this.batchTint=this.tint;for(var t=m(this.tint,tt),e=0;e<this.batches.length;e++){var i=this.batches[e],r=i._batchRGB,n=(t[0]*r[0]*255<<16)+(t[1]*r[1]*255<<8)+(0|t[2]*r[2]*255);i._tintRGB=(n>>16)+(65280&n)+((255&n)<<16)}}},i.prototype.calculateVertices=function(){var t=this.transform._worldID;if(this._transformID!==t){this._transformID=t;for(var e=this.transform.worldTransform,i=e.a,r=e.b,n=e.c,s=e.d,h=e.tx,a=e.ty,o=this._geometry.points,l=this.vertexData,u=0,p=0;p<o.length;p+=2){var c=o[p],d=o[p+1];l[u++]=i*c+n*d+h,l[u++]=s*d+r*c+a}}},i.prototype.closePath=function(){var t=this.currentPath;return t&&(t.closeStroke=!0,this.finishPoly()),this},i.prototype.setMatrix=function(t){return this._matrix=t,this},i.prototype.beginHole=function(){return this.finishPoly(),this._holeMode=!0,this},i.prototype.endHole=function(){return this.finishPoly(),this._holeMode=!1,this},i.prototype.destroy=function(t){this._geometry.refCount--,0===this._geometry.refCount&&this._geometry.dispose(),this._matrix=null,this.currentPath=null,this._lineStyle.destroy(),this._lineStyle=null,this._fillStyle.destroy(),this._fillStyle=null,this._geometry=null,this.shader=null,this.vertexData=null,this.batches.length=0,this.batches=null,e.prototype.destroy.call(this,t)},i.nextRoundedRectBehavior=!1,i._TEMP_POINT=new l,i}(P),rt={buildPoly:R,buildCircle:B,buildRectangle:L,buildRoundedRectangle:j,buildLine:z,ArcUtils:k,BezierUtils:H,QuadraticUtils:Y,BatchPart:G,FILL_COMMANDS:W,BATCH_POOL:V,DRAW_CALL_POOL:Q};export{A as FillStyle,D as GRAPHICS_CURVES,it as Graphics,X as GraphicsData,K as GraphicsGeometry,T as LINE_CAP,S as LINE_JOIN,$ as LineStyle,rt as graphicsUtils}; | ||
//# sourceMappingURL=graphics.min.js.map |
234
index.d.ts
@@ -26,3 +26,2 @@ /// <reference path="./global.d.ts" /> | ||
* Utilities for arc curves. | ||
* | ||
* @private | ||
@@ -35,3 +34,2 @@ */ | ||
* "borrowed" from https://code.google.com/p/fxcanvas/ - thanks google! | ||
* | ||
* @private | ||
@@ -43,3 +41,4 @@ * @param x1 - The x-coordinate of the beginning of the arc | ||
* @param radius - The radius of the arc | ||
* @return - If the arc length is valid, return center of circle, radius and other info otherwise `null`. | ||
* @param points - | ||
* @returns - If the arc length is valid, return center of circle, radius and other info otherwise `null`. | ||
*/ | ||
@@ -49,6 +48,5 @@ static curveTo(x1: number, y1: number, x2: number, y2: number, radius: number, points: Array<number>): IArcLikeShape; | ||
* The arc method creates an arc/curve (used to create circles, or parts of circles). | ||
* | ||
* @private | ||
* @param startX - Start x location of arc | ||
* @param startY - Start y location of arc | ||
* @param _startX - Start x location of arc | ||
* @param _startY - Start y location of arc | ||
* @param cx - The x-coordinate of the center of the circle | ||
@@ -60,3 +58,3 @@ * @param cy - The y-coordinate of the center of the circle | ||
* @param endAngle - The ending angle, in radians | ||
* @param anticlockwise - Specifies whether the drawing should be | ||
* @param _anticlockwise - Specifies whether the drawing should be | ||
* counter-clockwise or clockwise. False is default, and indicates clockwise, while true | ||
@@ -71,3 +69,2 @@ * indicates counter-clockwise. | ||
* A structure to hold interim batch objects for Graphics. | ||
* | ||
* @memberof PIXI.graphicsUtils | ||
@@ -82,5 +79,14 @@ */ | ||
constructor(); | ||
/** Begin batch part. */ | ||
/** | ||
* Begin batch part. | ||
* @param style | ||
* @param startIndex | ||
* @param attribStart | ||
*/ | ||
begin(style: LineStyle | FillStyle, startIndex: number, attribStart: number): void; | ||
/** End batch part. */ | ||
/** | ||
* End batch part. | ||
* @param endIndex | ||
* @param endAttrib | ||
*/ | ||
end(endIndex: number, endAttrib: number): void; | ||
@@ -92,3 +98,2 @@ reset(): void; | ||
* Utilities for bezier curves | ||
* | ||
* @private | ||
@@ -101,3 +106,2 @@ */ | ||
* Therefore numerical solution is used. | ||
* | ||
* @private | ||
@@ -112,3 +116,3 @@ * @param fromX - Starting point x | ||
* @param toY - Destination point y | ||
* @return - Length of bezier curve | ||
* @returns - Length of bezier curve | ||
*/ | ||
@@ -120,3 +124,2 @@ static curveLength(fromX: number, fromY: number, cpX: number, cpY: number, cpX2: number, cpY2: number, toX: number, toY: number): number; | ||
* Ignored from docs since it is not directly exposed. | ||
* | ||
* @ignore | ||
@@ -138,3 +141,2 @@ * @param cpX - Control point x | ||
* Ignored from docs since it is not directly exposed. | ||
* | ||
* @ignore | ||
@@ -149,3 +151,2 @@ * @private | ||
* Fill style object for Graphics. | ||
* | ||
* @memberof PIXI | ||
@@ -156,3 +157,2 @@ */ | ||
* The hex color value used when coloring the Graphics object. | ||
* | ||
* @default 0xFFFFFF | ||
@@ -165,3 +165,2 @@ */ | ||
* The texture to be used for the fill. | ||
* | ||
* @default 0 | ||
@@ -172,3 +171,2 @@ */ | ||
* The transform applied to the texture. | ||
* | ||
* @default null | ||
@@ -207,3 +205,2 @@ */ | ||
* properly dereference each GraphicsGeometry and prevent memory leaks. | ||
* | ||
* @memberof PIXI | ||
@@ -219,3 +216,2 @@ */ | ||
* Temporary point to use for containsPoint. | ||
* | ||
* @private | ||
@@ -233,3 +229,2 @@ */ | ||
* Current path | ||
* | ||
* @readonly | ||
@@ -266,3 +261,2 @@ */ | ||
* this data to the GPU. Can be shared between multiple Mesh or Graphics objects. | ||
* | ||
* @readonly | ||
@@ -278,4 +272,3 @@ */ | ||
* Note that only the geometry of the object is cloned, not its transform (position,scale,etc) | ||
* | ||
* @return - A clone of the graphics object | ||
* @returns - A clone of the graphics object | ||
*/ | ||
@@ -289,3 +282,2 @@ clone(): Graphics; | ||
* be applied per-primitive. | ||
* | ||
* @default PIXI.BLEND_MODES.NORMAL | ||
@@ -298,3 +290,2 @@ */ | ||
* 0xFFFFFF will remove any tint effect. | ||
* | ||
* @default 0xFFFFFF | ||
@@ -306,3 +297,2 @@ */ | ||
* The current fill style. | ||
* | ||
* @readonly | ||
@@ -313,3 +303,2 @@ */ | ||
* The current line style. | ||
* | ||
* @readonly | ||
@@ -321,3 +310,2 @@ */ | ||
* method or the drawCircle() method. | ||
* | ||
* @param [width=0] - width of the line to draw, will update the objects stored style | ||
@@ -329,3 +317,3 @@ * @param [color=0x0] - color of the line to draw, will update the objects stored style | ||
* @param [native=false] - If true the lines will be draw using LINES instead of TRIANGLE_STRIP | ||
* @return - This Graphics object. Good for chaining method calls | ||
* @returns - This Graphics object. Good for chaining method calls | ||
*/ | ||
@@ -336,3 +324,2 @@ lineStyle(width: number, color?: number, alpha?: number, alignment?: number, native?: boolean): this; | ||
* method or the drawCircle() method. | ||
* | ||
* @param options - Line style options | ||
@@ -348,3 +335,3 @@ * @param {number} [options.width=0] - width of the line to draw, will update the objects stored style | ||
* @param {number}[options.miterLimit=10] - miter limit ratio | ||
* @return {PIXI.Graphics} This Graphics object. Good for chaining method calls | ||
* @returns {PIXI.Graphics} This Graphics object. Good for chaining method calls | ||
*/ | ||
@@ -354,4 +341,3 @@ lineStyle(options?: ILineStyleOptions): this; | ||
* Like line style but support texture for line fill. | ||
* | ||
* @param options - Collection of options for setting line style. | ||
* @param [options] - Collection of options for setting line style. | ||
* @param {number} [options.width=0] - width of the line to draw, will update the objects stored style | ||
@@ -369,8 +355,7 @@ * @param {PIXI.Texture} [options.texture=PIXI.Texture.WHITE] - Texture to use | ||
* @param {number}[options.miterLimit=10] - miter limit ratio | ||
* @return {PIXI.Graphics} This Graphics object. Good for chaining method calls | ||
* @returns {PIXI.Graphics} This Graphics object. Good for chaining method calls | ||
*/ | ||
lineTextureStyle(options: ILineStyleOptions): this; | ||
lineTextureStyle(options?: ILineStyleOptions): this; | ||
/** | ||
* Start a polygon object internally. | ||
* | ||
* @protected | ||
@@ -381,3 +366,2 @@ */ | ||
* Finish the polygon object. | ||
* | ||
* @protected | ||
@@ -388,6 +372,5 @@ */ | ||
* Moves the current drawing position to x, y. | ||
* | ||
* @param x - the X coordinate to move to | ||
* @param y - the Y coordinate to move to | ||
* @return - This Graphics object. Good for chaining method calls | ||
* @returns - This Graphics object. Good for chaining method calls | ||
*/ | ||
@@ -398,9 +381,12 @@ moveTo(x: number, y: number): this; | ||
* The current drawing position is then set to (x, y). | ||
* | ||
* @param x - the X coordinate to draw to | ||
* @param y - the Y coordinate to draw to | ||
* @return - This Graphics object. Good for chaining method calls | ||
* @returns - This Graphics object. Good for chaining method calls | ||
*/ | ||
lineTo(x: number, y: number): this; | ||
/** Initialize the curve */ | ||
/** | ||
* Initialize the curve | ||
* @param x | ||
* @param y | ||
*/ | ||
protected _initCurve(x?: number, y?: number): void; | ||
@@ -410,3 +396,2 @@ /** | ||
* Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c | ||
* | ||
* @param cpX - Control point x | ||
@@ -416,3 +401,3 @@ * @param cpY - Control point y | ||
* @param toY - Destination point y | ||
* @return - This Graphics object. Good for chaining method calls | ||
* @returns - This Graphics object. Good for chaining method calls | ||
*/ | ||
@@ -422,3 +407,2 @@ quadraticCurveTo(cpX: number, cpY: number, toX: number, toY: number): this; | ||
* Calculate the points for a bezier curve and then draws it. | ||
* | ||
* @param cpX - Control point x | ||
@@ -430,3 +414,3 @@ * @param cpY - Control point y | ||
* @param toY - Destination point y | ||
* @return This Graphics object. Good for chaining method calls | ||
* @returns This Graphics object. Good for chaining method calls | ||
*/ | ||
@@ -438,3 +422,2 @@ bezierCurveTo(cpX: number, cpY: number, cpX2: number, cpY2: number, toX: number, toY: number): this; | ||
* "borrowed" from https://code.google.com/p/fxcanvas/ - thanks google! | ||
* | ||
* @param x1 - The x-coordinate of the first tangent point of the arc | ||
@@ -445,3 +428,3 @@ * @param y1 - The y-coordinate of the first tangent point of the arc | ||
* @param radius - The radius of the arc | ||
* @return - This Graphics object. Good for chaining method calls | ||
* @returns - This Graphics object. Good for chaining method calls | ||
*/ | ||
@@ -451,3 +434,2 @@ arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): this; | ||
* The arc method creates an arc/curve (used to create circles, or parts of circles). | ||
* | ||
* @param cx - The x-coordinate of the center of the circle | ||
@@ -462,3 +444,3 @@ * @param cy - The y-coordinate of the center of the circle | ||
* indicates counter-clockwise. | ||
* @return - This Graphics object. Good for chaining method calls | ||
* @returns - This Graphics object. Good for chaining method calls | ||
*/ | ||
@@ -469,6 +451,5 @@ arc(cx: number, cy: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): this; | ||
* (such as lineTo() or drawCircle()) use when drawing. | ||
* | ||
* @param color - the color of the fill | ||
* @param alpha - the alpha of the fill | ||
* @return - This Graphics object. Good for chaining method calls | ||
* @returns - This Graphics object. Good for chaining method calls | ||
*/ | ||
@@ -478,3 +459,2 @@ beginFill(color?: number, alpha?: number): this; | ||
* Begin the texture fill | ||
* | ||
* @param options - Object object. | ||
@@ -485,3 +465,3 @@ * @param {PIXI.Texture} [options.texture=PIXI.Texture.WHITE] - Texture to fill | ||
* @param {PIXI.Matrix} [options.matrix=null] - Transform matrix | ||
* @return {PIXI.Graphics} This Graphics object. Good for chaining method calls | ||
* @returns {PIXI.Graphics} This Graphics object. Good for chaining method calls | ||
*/ | ||
@@ -491,4 +471,3 @@ beginTextureFill(options?: IFillStyleOptions): this; | ||
* Applies a fill to the lines and shapes that were added since the last call to the beginFill() method. | ||
* | ||
* @return - This Graphics object. Good for chaining method calls | ||
* @returns - This Graphics object. Good for chaining method calls | ||
*/ | ||
@@ -498,3 +477,2 @@ endFill(): this; | ||
* Draws a rectangle shape. | ||
* | ||
* @param x - The X coord of the top-left of the rectangle | ||
@@ -504,3 +482,3 @@ * @param y - The Y coord of the top-left of the rectangle | ||
* @param height - The height of the rectangle | ||
* @return - This Graphics object. Good for chaining method calls | ||
* @returns - This Graphics object. Good for chaining method calls | ||
*/ | ||
@@ -510,3 +488,2 @@ drawRect(x: number, y: number, width: number, height: number): this; | ||
* Draw a rectangle shape with rounded/beveled corners. | ||
* | ||
* @param x - The X coord of the top-left of the rectangle | ||
@@ -517,3 +494,3 @@ * @param y - The Y coord of the top-left of the rectangle | ||
* @param radius - Radius of the rectangle corners | ||
* @return - This Graphics object. Good for chaining method calls | ||
* @returns - This Graphics object. Good for chaining method calls | ||
*/ | ||
@@ -523,7 +500,6 @@ drawRoundedRect(x: number, y: number, width: number, height: number, radius: number): this; | ||
* Draws a circle. | ||
* | ||
* @param x - The X coordinate of the center of the circle | ||
* @param y - The Y coordinate of the center of the circle | ||
* @param radius - The radius of the circle | ||
* @return - This Graphics object. Good for chaining method calls | ||
* @returns - This Graphics object. Good for chaining method calls | ||
*/ | ||
@@ -533,3 +509,2 @@ drawCircle(x: number, y: number, radius: number): this; | ||
* Draws an ellipse. | ||
* | ||
* @param x - The X coordinate of the center of the ellipse | ||
@@ -539,3 +514,3 @@ * @param y - The Y coordinate of the center of the ellipse | ||
* @param height - The half height of the ellipse | ||
* @return - This Graphics object. Good for chaining method calls | ||
* @returns - This Graphics object. Good for chaining method calls | ||
*/ | ||
@@ -547,5 +522,4 @@ drawEllipse(x: number, y: number, width: number, height: number): this; | ||
* Draw any shape. | ||
* | ||
* @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - Shape to draw | ||
* @return - This Graphics object. Good for chaining method calls | ||
* @returns - This Graphics object. Good for chaining method calls | ||
*/ | ||
@@ -555,4 +529,3 @@ drawShape(shape: IShape): this; | ||
* Clears the graphics that were drawn to this Graphics object, and resets fill and line style settings. | ||
* | ||
* @return - This Graphics object. Good for chaining method calls | ||
* @returns - This Graphics object. Good for chaining method calls | ||
*/ | ||
@@ -563,3 +536,2 @@ clear(): this; | ||
* masked with gl.scissor. | ||
* | ||
* @returns - True if only 1 rect. | ||
@@ -570,3 +542,2 @@ */ | ||
* Renders the object using the WebGL renderer | ||
* | ||
* @param renderer - The renderer | ||
@@ -579,3 +550,2 @@ */ | ||
* Renders the batches using the BathedRenderer plugin | ||
* | ||
* @param renderer - The renderer | ||
@@ -586,11 +556,13 @@ */ | ||
* Renders the graphics direct | ||
* | ||
* @param renderer - The renderer | ||
*/ | ||
protected _renderDirect(renderer: Renderer): void; | ||
/** Renders specific DrawCall */ | ||
/** | ||
* Renders specific DrawCall | ||
* @param renderer | ||
* @param drawCall | ||
*/ | ||
protected _renderDrawCallDirect(renderer: Renderer, drawCall: BatchDrawCall): void; | ||
/** | ||
* Resolves shader for direct rendering | ||
* | ||
* @param renderer - The renderer | ||
@@ -603,5 +575,4 @@ */ | ||
* Tests if a point is inside this graphics object | ||
* | ||
* @param point - the point to test | ||
* @return - the result of the test | ||
* @returns - the result of the test | ||
*/ | ||
@@ -611,11 +582,7 @@ containsPoint(point: IPointData): boolean; | ||
protected calculateTints(): void; | ||
/** | ||
* If there's a transform update or a change to the shape of the | ||
* geometry, recalculate the vertices. | ||
*/ | ||
/** If there's a transform update or a change to the shape of the geometry, recalculate the vertices. */ | ||
protected calculateVertices(): void; | ||
/** | ||
* Closes the current path. | ||
* | ||
* @return - Returns itself. | ||
* @returns - Returns itself. | ||
*/ | ||
@@ -625,5 +592,4 @@ closePath(): this; | ||
* Apply a matrix to the positional data. | ||
* | ||
* @param matrix - Matrix to use for transform current shape. | ||
* @return - Returns itself. | ||
* @returns - Returns itself. | ||
*/ | ||
@@ -637,4 +603,3 @@ setMatrix(matrix: Matrix): this; | ||
* please use `moveTo` `lineTo`, `quadraticCurveTo` if you rely on pixi-legacy bundle. | ||
* | ||
* @return - Returns itself. | ||
* @returns - Returns itself. | ||
*/ | ||
@@ -644,4 +609,3 @@ beginHole(): this; | ||
* End adding holes to the last draw shape. | ||
* | ||
* @return - Returns itself. | ||
* @returns - Returns itself. | ||
*/ | ||
@@ -651,3 +615,2 @@ endHole(): this; | ||
* Destroys the Graphics object. | ||
* | ||
* @param options - Options parameter. A boolean will act as if all | ||
@@ -669,3 +632,2 @@ * options have been set to that value | ||
* Adaptive draw works with `bezierCurveTo` and `quadraticCurveTo`. | ||
* | ||
* @static | ||
@@ -676,6 +638,6 @@ * @constant | ||
* @type {object} | ||
* @property {boolean} adaptive=true - flag indicating if the resolution should be adaptive | ||
* @property {number} maxLength=10 - maximal length of a single segment of the curve (if adaptive = false, ignored) | ||
* @property {number} minSegments=8 - minimal number of segments in the curve (if adaptive = false, ignored) | ||
* @property {number} maxSegments=2048 - maximal number of segments in the curve (if adaptive = false, ignored) | ||
* @property {boolean} [adaptive=true] - flag indicating if the resolution should be adaptive | ||
* @property {number} [maxLength=10] - maximal length of a single segment of the curve (if adaptive = false, ignored) | ||
* @property {number} [minSegments=8] - minimal number of segments in the curve (if adaptive = false, ignored) | ||
* @property {number} [maxSegments=2048] - maximal number of segments in the curve (if adaptive = false, ignored) | ||
*/ | ||
@@ -686,3 +648,2 @@ export declare const GRAPHICS_CURVES: IGraphicsCurvesSettings; | ||
* A class to contain data useful for Graphics objects | ||
* | ||
* @memberof PIXI | ||
@@ -693,3 +654,2 @@ */ | ||
* The shape object to draw. | ||
* | ||
* @member {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} | ||
@@ -719,4 +679,3 @@ */ | ||
* Creates a new GraphicsData object with the same values as this one. | ||
* | ||
* @return - Cloned GraphicsData object | ||
* @returns - Cloned GraphicsData object | ||
*/ | ||
@@ -734,3 +693,2 @@ clone(): GraphicsData; | ||
* to re-tesselate using **earcut**. Consider using {@link PIXI.Mesh} for this use-case, it's much faster. | ||
* | ||
* @memberof PIXI | ||
@@ -742,8 +700,6 @@ */ | ||
* able to be batched by the renderer's batch system. | ||
\ */ | ||
\ | ||
*/ | ||
static BATCHABLE_SIZE: number; | ||
/** | ||
* Minimal distance between points that are considered different. | ||
* Affects line tesselation. | ||
*/ | ||
/** Minimal distance between points that are considered different. Affects line tesselation. */ | ||
closePointEps: number; | ||
@@ -767,3 +723,2 @@ /** Padding to add to the bounds. */ | ||
* The collection of drawn shapes. | ||
* | ||
* @member {PIXI.GraphicsData[]} | ||
@@ -774,3 +729,2 @@ */ | ||
* List of current draw calls drived from the batches. | ||
* | ||
* @member {PIXI.BatchDrawCall[]} | ||
@@ -784,3 +738,2 @@ */ | ||
* Can be converted to drawCalls or to batchable objects. | ||
* | ||
* @member {PIXI.graphicsUtils.BatchPart[]} | ||
@@ -804,15 +757,10 @@ */ | ||
* Get the current bounds of the graphic geometry. | ||
* | ||
* @readonly | ||
*/ | ||
get bounds(): Bounds; | ||
/** | ||
* Call if you changed graphicsData manually. | ||
* Empties all batch buffers. | ||
*/ | ||
/** Call if you changed graphicsData manually. Empties all batch buffers. */ | ||
protected invalidate(): void; | ||
/** | ||
* Clears the graphics that were drawn to this Graphics object, and resets fill and line style settings. | ||
* | ||
* @return - This GraphicsGeometry object. Good for chaining method calls | ||
* @returns - This GraphicsGeometry object. Good for chaining method calls | ||
*/ | ||
@@ -822,3 +770,2 @@ clear(): GraphicsGeometry; | ||
* Draws the given shape to this Graphics object. Can be any of Circle, Rectangle, Ellipse, Line or Polygon. | ||
* | ||
* @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw. | ||
@@ -828,3 +775,3 @@ * @param fillStyle - Defines style of the fill. | ||
* @param matrix - Transform applied to the points of the shape. | ||
* @return - Returns geometry for chaining. | ||
* @returns - Returns geometry for chaining. | ||
*/ | ||
@@ -834,6 +781,5 @@ drawShape(shape: IShape_2, fillStyle?: FillStyle, lineStyle?: LineStyle, matrix?: Matrix): GraphicsGeometry; | ||
* Draws the given shape to this Graphics object. Can be any of Circle, Rectangle, Ellipse, Line or Polygon. | ||
* | ||
* @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw. | ||
* @param matrix - Transform applied to the points of the shape. | ||
* @return - Returns geometry for chaining. | ||
* @returns - Returns geometry for chaining. | ||
*/ | ||
@@ -845,5 +791,4 @@ drawHole(shape: IShape_2, matrix?: Matrix): GraphicsGeometry; | ||
* Check to see if a point is contained within this geometry. | ||
* | ||
* @param point - Point to check if it's contained. | ||
* @return {Boolean} `true` if the point is contained within geometry. | ||
* @returns {boolean} `true` if the point is contained within geometry. | ||
*/ | ||
@@ -854,3 +799,2 @@ containsPoint(point: IPointData): boolean; | ||
* or used to convert to batch objects directly by the Graphics object. | ||
* | ||
* @param allow32Indices - Allow using 32-bit indices for preventing artifacts when more that 65535 vertices | ||
@@ -861,3 +805,2 @@ */ | ||
* Affinity check | ||
* | ||
* @param styleA | ||
@@ -880,7 +823,16 @@ * @param styleB | ||
protected packAttributes(): void; | ||
/** Process fill part of Graphics. */ | ||
/** | ||
* Process fill part of Graphics. | ||
* @param data | ||
*/ | ||
protected processFill(data: GraphicsData): void; | ||
/** Process line part of Graphics. */ | ||
/** | ||
* Process line part of Graphics. | ||
* @param data | ||
*/ | ||
protected processLine(data: GraphicsData): void; | ||
/** Process the holes data. */ | ||
/** | ||
* Process the holes data. | ||
* @param holes | ||
*/ | ||
protected processHoles(holes: Array<GraphicsData>): void; | ||
@@ -891,3 +843,2 @@ /** Update the local bounds of the object. Expensive to use performance-wise. */ | ||
* Transform points using matrix. | ||
* | ||
* @param points - Points to transform | ||
@@ -899,3 +850,2 @@ * @param matrix - Transform matrix | ||
* Add colors. | ||
* | ||
* @param colors - List of colors to add to | ||
@@ -908,7 +858,12 @@ * @param color - Color to add | ||
protected addColors(colors: Array<number>, color: number, alpha: number, size: number, offset?: number): void; | ||
/** Add texture id that the shader/fragment wants to use. */ | ||
/** | ||
* Add texture id that the shader/fragment wants to use. | ||
* @param textureIds | ||
* @param id | ||
* @param size | ||
* @param offset | ||
*/ | ||
protected addTextureIds(textureIds: Array<number>, id: number, size: number, offset?: number): void; | ||
/** | ||
* Generates the UVs for a shape. | ||
* | ||
* @param verts - Vertices | ||
@@ -925,3 +880,2 @@ * @param uvs - UVs | ||
* Does not work with rotated or trimmed textures | ||
* | ||
* @param uvs - array | ||
@@ -966,5 +920,3 @@ * @param texture - region | ||
/** | ||
* Batch element computed from Graphics geometry | ||
*/ | ||
/** Batch element computed from Graphics geometry */ | ||
export declare interface IGraphicsBatchElement { | ||
@@ -1009,5 +961,3 @@ vertexData: Float32Array; | ||
* Support line caps in `PIXI.LineStyle` for graphics. | ||
* | ||
* @see PIXI.Graphics#lineStyle | ||
* | ||
* @name LINE_CAP | ||
@@ -1029,6 +979,4 @@ * @memberof PIXI | ||
* Supported line joints in `PIXI.LineStyle` for graphics. | ||
* | ||
* @see PIXI.Graphics#lineStyle | ||
* @see https://graphicdesign.stackexchange.com/questions/59018/what-is-a-bevel-join-of-two-lines-exactly-illustrator | ||
* | ||
* @name LINE_JOIN | ||
@@ -1050,3 +998,2 @@ * @memberof PIXI | ||
* Represents the line style for Graphics. | ||
* | ||
* @memberof PIXI | ||
@@ -1063,3 +1010,2 @@ */ | ||
* Line cap style. | ||
* | ||
* @member {PIXI.LINE_CAP} | ||
@@ -1071,3 +1017,2 @@ * @default PIXI.LINE_CAP.BUTT | ||
* Line join style. | ||
* | ||
* @member {PIXI.LINE_JOIN} | ||
@@ -1087,3 +1032,2 @@ * @default PIXI.LINE_JOIN.MITER | ||
* Utilities for quadratic curves. | ||
* | ||
* @private | ||
@@ -1096,3 +1040,2 @@ */ | ||
* for the detailed explanation of math behind this. | ||
* | ||
* @private | ||
@@ -1105,3 +1048,3 @@ * @param fromX - x-coordinate of curve start point | ||
* @param toY - y-coordinate of curve end point | ||
* @return - Length of quadratic curve | ||
* @returns - Length of quadratic curve | ||
*/ | ||
@@ -1112,3 +1055,2 @@ static curveLength(fromX: number, fromY: number, cpX: number, cpY: number, toX: number, toY: number): number; | ||
* Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c | ||
* | ||
* @private | ||
@@ -1115,0 +1057,0 @@ * @param cpX - Control point x |
{ | ||
"name": "@pixi/graphics", | ||
"version": "6.3.2", | ||
"version": "6.4.0", | ||
"main": "dist/cjs/graphics.js", | ||
"module": "dist/esm/graphics.js", | ||
"bundle": "dist/browser/graphics.js", | ||
"types": "index.d.ts", | ||
"exports": { | ||
".": { | ||
"import": { | ||
"default": "./dist/cjs/graphics.js", | ||
"types": "./index.d.ts" | ||
}, | ||
"require": { | ||
"default": "./dist/esm/graphics.js", | ||
"types": "./index.d.ts" | ||
} | ||
} | ||
}, | ||
"description": "Draw primitive shapes such as lines, circles and rectangles to the display", | ||
@@ -28,10 +41,10 @@ "author": "Mat Groves", | ||
"peerDependencies": { | ||
"@pixi/constants": "6.3.2", | ||
"@pixi/core": "6.3.2", | ||
"@pixi/display": "6.3.2", | ||
"@pixi/math": "6.3.2", | ||
"@pixi/sprite": "6.3.2", | ||
"@pixi/utils": "6.3.2" | ||
"@pixi/constants": "6.4.0", | ||
"@pixi/core": "6.4.0", | ||
"@pixi/display": "6.4.0", | ||
"@pixi/math": "6.4.0", | ||
"@pixi/sprite": "6.4.0", | ||
"@pixi/utils": "6.4.0" | ||
}, | ||
"gitHead": "87031295631dcd7db3e24b99ed7ceb2c4f963a40" | ||
"gitHead": "e7eaa713b6e0eeb335e90384aec778f5c99c60d5" | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1767928
10238