@pixi/graphics
Advanced tools
Comparing version 6.4.2 to 6.5.0-rc
/*! | ||
* @pixi/graphics - v6.4.2 | ||
* Compiled Thu, 02 Jun 2022 15:39:26 UTC | ||
* @pixi/graphics - v6.5.0-rc | ||
* Compiled Thu, 14 Jul 2022 18:30:46 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}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); | ||
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,f=n-h-1,d=h,y=h+1;i=[t[d],t[c]],t[c]=i[0],t[d]=i[1],r=[t[y],t[f]],t[f]=r[0],t[y]=r[1]}}}}var f={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])}}},d={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,f=p.height/2;e=p.x+c,r=p.y+f,n=c-(h=a=Math.max(0,Math.min(p.radius,Math.min(c,f)))),s=f-a}if(h>=0&&a>=0&&n>=0&&s>=0){var d=Math.ceil(2.3*Math.sqrt(h+a)),y=8*d+(n?4:0)+(s?4:0);if(o.length=y,0!==y){if(0===d)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*d+(n?2:0)+2,b=g,m=y,_=e+(I=n+h),x=e-I,P=r+(E=s);if(o[v++]=_,o[v++]=P,o[--g]=P,o[--g]=x,s){var S=r-E;o[b++]=x,o[b++]=S,o[--m]=S,o[--m]=_}for(var w=1;w<d;w++){var M=Math.PI/2*(w/d);_=e+(I=n+Math.cos(M)*h),x=e-I,P=r+(E=s+Math.sin(M)*a),S=r-E;o[v++]=_,o[v++]=P,o[--g]=P,o[--g]=x,o[b++]=x,o[b++]=S,o[--m]=S,o[--m]=_}var I,E;_=e+(I=n),x=e-I,P=r+(E=s+a),S=r-E;o[v++]=_,o[v++]=P,o[--m]=S,o[--m]=_,n&&(o[v++]=x,o[v++]=P,o[--m]=S,o[--m]=x)}}else o.length=0},triangulate:function(t,e){var r=t.points,n=e.points,s=e.indices;if(0!==r.length){var h,a,o=n.length/2,l=o;if(t.type!==i.SHAPES.RREC){var u=t.shape;h=u.x,a=u.y}else{var p=t.shape;h=p.x+p.width/2,a=p.y+p.height/2}var c=t.matrix;n.push(t.matrix?c.a*h+c.c*a+c.tx:h,t.matrix?c.b*h+c.d*a+c.ty:a),o++,n.push(r[0],r[1]);for(var f=2;f<r.length;f+=2)n.push(r[f],r[f+1]),s.push(o++,l,o);s.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,f=0,d=0,y=0;d<=20;++d)o=v(t,i,y=d/20),l=v(e,r,y),u=v(i,n,y),p=v(r,s,y),c=v(o,u,y),f=v(l,p,y),0===d&&a[a.length-2]===c&&a[a.length-1]===f||a.push(c,f);return a}var b={build:function(t){if(N.nextRoundedRectBehavior)d.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(N.nextRoundedRectBehavior)d.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,f=e+r*s+l;return a.push(u,p),a.push(c,f),2}function _(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,f=p-u,d=Math.abs(f),y=Math.sqrt(o*o+l*l),v=1+(15*d*Math.sqrt(y)/Math.PI>>0),g=f/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 x(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 f=.5*(l.x+u.x),d=.5*(u.y+l.y);s.unshift(f,d),s.push(f,d)}var y=r.points,v=s.length/2,g=s.length,b=y.length/2,x=a.width/2,P=x*x,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*=x,C*=x;var O=a.alignment,N=2*(1-O),U=2*O;p||(a.cap===t.LINE_CAP.ROUND?g+=_(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*=x,C*=x,R=-(E-T),L=I-A,R/=B=Math.sqrt(R*R+L*L),L/=B,R*=x,L*=x;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,V=(q*W-F*X)/k,Y=(J-I)*(J-I)+(V-E)*(V-E),Q=I+(J-I)*N,Z=E+(V-E)*N,K=I-(J-I)*U,$=E-(V-E)*U,tt=G?N:U;Y<=Math.min(j*j+F*F,z*z+q*q)+tt*tt*P?a.join===t.LINE_JOIN.BEVEL||Y/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+=_(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+=_(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?_(I,E,I+D*U,E+C*U,I+R*U,E+L*U,y,!0)+2:_(I,E,I-D*N,E-C*N,I-R*N,E-L*N,y,!1)+2:a.join===t.LINE_JOIN.MITER&&Y/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*=x,C*=x,y.push(I-D*N,E-C*N),y.push(I+D*U,E+C*U),p||(a.cap===t.LINE_CAP.ROUND?g+=_(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,f=l*l+u*u,d=a*l+o*u,y=n*Math.sqrt(c)/p,v=n*Math.sqrt(f)/p,g=y*d/c,b=v*d/f,m=y*u+v*o,_=y*l+v*a,x=o*(v+g),P=a*(v+g),S=u*(y+b),w=l*(y+b);return{cx:m+t,cy:_+e,radius:n,startAngle:Math.atan2(P-_,x-m),endAngle:Math.atan2(w-_,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)),f=p/(2*c),d=2*f,y=Math.cos(f),v=Math.sin(f),g=c-1,b=g%1/g,m=0;m<=g;++m){var _=f+h+d*(m+b*m),x=Math.cos(_),P=-Math.sin(_);u.push((y*x+v*P)*s+r,(y*-P+v*x)*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,f=0,d=0,y=0,v=0,g=0,b=0,m=t,_=e,x=1;x<=10;++x)g=m-(y=(d=(f=(c=1-(l=x/10))*c)*c)*t+3*f*l*i+3*c*(u=l*l)*n+(p=u*l)*h),b=_-(v=d*e+3*f*l*r+3*c*u*s+p*a),m=y,_=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,f=0,d=0,y=0,v=0;a.push(l,u);for(var g=1,b=0;g<=p;++g)d=(f=(c=1-(b=g/p))*c)*c,v=(y=b*b)*b,a.push(d*l+3*f*b*e+3*c*y*r+v*s,d*u+3*f*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,f=2*Math.sqrt(u+p+c),d=Math.sqrt(u),y=2*u*d,v=2*Math.sqrt(c),g=p/d;return(y*f+d*p*(f-v)+(4*c*u-p*p)*Math.log((2*d+g+f)/(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 f=c/l;u=h+(e-h)*f,p=a+(i-a)*f,s.push(u+(e+(r-e)*f-u)*f,p+(i+(n-i)*f-p)*f)}},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]=f,P[i.SHAPES.CIRC]=d,P[i.SHAPES.ELIP]=d,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=function(t){function i(){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(i,t),Object.defineProperty(i.prototype,"bounds",{get:function(){return this.updateBatches(),this.boundsDirty!==this.dirty&&(this.boundsDirty=this.dirty,this.calculateBounds()),this._bounds},enumerable:!1,configurable:!0}),i.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},i.prototype.clear=function(){return this.graphicsData.length>0&&(this.invalidate(),this.clearDirty++,this.graphicsData.length=0),this},i.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},i.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},i.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},i.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},i.prototype.updateBatches=function(){if(this.graphicsData.length){if(this.validateBatching()){this.cacheDirty=this.dirty;var t=this.uvs,e=this.graphicsData,i=null,r=null;this.batches.length>0&&(r=(i=this.batches[this.batches.length-1]).style);for(var s=this.shapeIndex;s<e.length;s++){this.shapeIndex++;var h=e[s],a=h.fillStyle,o=h.lineStyle;E[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,f=this.points.length/2;p.wrapMode=n.WRAP_MODES.REPEAT,0===l?this.processFill(h):this.processLine(h);var d=this.points.length/2-f;0!==d&&(i&&!this._compareStyles(r,u)&&(i.end(c,f),i=null),i||((i=A.pop()||new I).begin(u,c,f),this.batches.push(i),r=u),this.addUvs(this.points,t,u.texture,f,d,u.matrix))}}}var y=this.indices.length,v=this.points.length/2;if(i&&i.end(y,v),0!==this.batches.length){var g=v>65535;this.indicesUint16&&this.indices.length===this.indicesUint16.length&&g===this.indicesUint16.BYTES_PER_ELEMENT>2?this.indicesUint16.set(this.indices):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},i.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))},i.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},i.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}},i.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*i.BATCHABLE_SIZE},i.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 f=this.batches[i],d=f.style,y=d.texture.baseTexture;u!==!!d.native&&(p=(u=!!d.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+=f.size,c+=f.size,l=y._batchLocation,this.addColors(r,d.color,d.alpha,f.attribSize,f.attribStart),this.addTextureIds(s,l,f.attribSize,f.attribStart)}e.BaseTexture._globalBatch=t,this.packAttributes()},i.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)},i.prototype.processFill=function(t){t.holes.length?f.triangulate(t,this):E[t.type].triangulate(t,this)},i.prototype.processLine=function(t){x(t,this);for(var e=0;e<t.holes.length;e++)x(t.holes[e],this)},i.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)}},i.prototype.calculateBounds=function(){var t=this._bounds;t.clear(),t.addVertexData(this.points,0,this.points.length),t.pad(this.boundsPadding,this.boundsPadding)},i.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}},i.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},i.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},i.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)},i.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),f=Math.floor(t[i+1]+s),d=i+2;d<h;d+=2)c=Math.min(c,Math.floor(t[d]+s)),f=Math.min(f,Math.floor(t[d+1]+s));u-=c,p-=f;for(d=i;d<h;d+=2)t[d]=(t[d]+u)*o,t[d+1]=(t[d+1]+p)*l},i.BATCHABLE_SIZE=100,i}(e.BatchGeometry),L=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),B=new Float32Array(3),O={},N=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 L,i._matrix=null,i._holeMode=!1,i.state=e.State.for2d(),i._geometry=t||new R,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;e.updateBatches(),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(!O[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;O[n]=new e.Shader(l,o)}r=O[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,B),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],f=o[p+1];l[u++]=i*c+n*f+h,l[u++]=s*f+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),U={buildPoly:f,buildCircle:d,buildRectangle:y,buildRoundedRectangle:b,buildLine:x,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=N,t.GraphicsData=D,t.GraphicsGeometry=R,t.LineStyle=L,t.graphicsUtils=U,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.4.2 | ||
* Compiled Thu, 02 Jun 2022 15:39:26 UTC | ||
* @pixi/graphics - v6.5.0-rc | ||
* Compiled Thu, 14 Jul 2022 18:30:46 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}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; | ||
"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,f=s-h-1,d=h,y=h+1;i=[t[d],t[c]],t[c]=i[0],t[d]=i[1],r=[t[y],t[f]],t[f]=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])}}},f={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,f=p.height/2;e=p.x+c,i=p.y+f,s=c-(h=a=Math.max(0,Math.min(p.radius,Math.min(c,f)))),n=f-a}if(h>=0&&a>=0&&s>=0&&n>=0){var d=Math.ceil(2.3*Math.sqrt(h+a)),y=8*d+(s?4:0)+(n?4:0);if(o.length=y,0!==y){if(0===d)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*d+(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<d;w++){var M=Math.PI/2*(w/d);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=t.points,s=e.points,n=e.indices;if(0!==i.length){var h,a,o=s.length/2,l=o;if(t.type!==r.SHAPES.RREC){var u=t.shape;h=u.x,a=u.y}else{var p=t.shape;h=p.x+p.width/2,a=p.y+p.height/2}var c=t.matrix;s.push(t.matrix?c.a*h+c.c*a+c.tx:h,t.matrix?c.b*h+c.d*a+c.ty:a),o++,s.push(i[0],i[1]);for(var f=2;f<i.length;f+=2)s.push(i[f],i[f+1]),n.push(o++,l,o);n.push(l+1,l,o)}}},d={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,f=0,d=0,v=0;d<=20;++d)o=y(t,i,v=d/20),l=y(e,r,v),u=y(i,s,v),p=y(r,n,v),c=y(o,u,v),f=y(l,p,v),0===d&&a[a.length-2]===c&&a[a.length-1]===f||a.push(c,f);return a}var g={build:function(t){if(N.nextRoundedRectBehavior)f.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(N.nextRoundedRectBehavior)f.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,f=e+r*n+l;return a.push(u,p),a.push(c,f),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,f=p-u,d=Math.abs(f),y=Math.sqrt(o*o+l*l),v=1+(15*d*Math.sqrt(y)/Math.PI>>0),g=f/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),f=.5*(l.y+o.y);s.unshift(c,f),s.push(c,f)}var d=e.points,y=s.length/2,v=s.length,g=d.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,d,!0)+2:h.cap===exports.LINE_CAP.SQUARE&&(v+=b(P,w,D,I,N,O,!0,d))),d.push(P-D*N,w-I*N),d.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)d.push(M-D*N,E-I*N),d.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,V=(q*G-j*W)/z,Y=(J-M)*(J-M)+(V-E)*(V-E),Q=M+(J-M)*N,X=E+(V-E)*N,Z=M-(J-M)*O,K=E-(V-E)*O,$=k?N:O;Y<=Math.min(H*H+j*j,F*F+q*q)+$*$*_?h.join===exports.LINE_JOIN.BEVEL||Y/_>S?(k?(d.push(Q,X),d.push(M+D*O,E+I*O),d.push(Q,X),d.push(M+C*O,E+R*O)):(d.push(M-D*N,E-I*N),d.push(Z,K),d.push(M-C*N,E-R*N),d.push(Z,K)),v+=2):h.join===exports.LINE_JOIN.ROUND?k?(d.push(Q,X),d.push(M+D*O,E+I*O),v+=x(M,E,M+D*O,E+I*O,M+C*O,E+R*O,d,!0)+4,d.push(Q,X),d.push(M+C*O,E+R*O)):(d.push(M-D*N,E-I*N),d.push(Z,K),v+=x(M,E,M-D*N,E-I*N,M-C*N,E-R*N,d,!1)+4,d.push(M-C*N,E-R*N),d.push(Z,K)):(d.push(Q,X),d.push(Z,K)):(d.push(M-D*N,E-I*N),d.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,d,!0)+2:x(M,E,M-D*N,E-I*N,M-C*N,E-R*N,d,!1)+2:h.join===exports.LINE_JOIN.MITER&&Y/_<=S&&(k?(d.push(Z,K),d.push(Z,K)):(d.push(Q,X),d.push(Q,X)),v+=2),d.push(M-C*N,E-R*N),d.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,d.push(M-D*N,E-I*N),d.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,d,!1)+2:h.cap===exports.LINE_CAP.SQUARE&&(v+=b(M,E,D,I,N,O,!1,d)));var tt=e.indices,et=a.epsilon*a.epsilon;for(U=g;U<v+g-2;++U)P=d[2*U],w=d[2*U+1],M=d[2*(U+1)],E=d[2*(U+1)+1],A=d[2*(U+2)],T=d[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,f=l*l+u*u,d=a*l+o*u,y=s*Math.sqrt(c)/p,v=s*Math.sqrt(f)/p,g=y*d/c,b=v*d/f,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)),f=p/(2*c),d=2*f,y=Math.cos(f),v=Math.sin(f),g=c-1,b=g%1/g,x=0;x<=g;++x){var m=f+h+d*(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,f=0,d=0,y=0,v=0,g=0,b=0,x=t,m=e,_=1;_<=10;++_)g=x-(y=(d=(f=(c=1-(l=_/10))*c)*c)*t+3*f*l*i+3*c*(u=l*l)*s+(p=u*l)*h),b=m-(v=d*e+3*f*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,f=0,d=0,y=0,v=0;o.push(l,u);for(var g=1,b=0;g<=p;++g)d=(f=(c=1-(b=g/p))*c)*c,v=(y=b*b)*b,o.push(d*l+3*f*b*e+3*c*y*r+v*n,d*u+3*f*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,f=2*Math.sqrt(u+p+c),d=Math.sqrt(u),y=2*u*d,v=2*Math.sqrt(c),g=p/d;return(y*f+d*p*(f-v)+(4*c*u-p*p)*Math.log((2*d+g+f)/(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 f=c/l;u=h+(e-h)*f,p=o+(i-o)*f,n.push(u+(e+(r-e)*f-u)*f,p+(i+(s-i)*f-p)*f)}},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]=f,_[r.SHAPES.ELIP]=f,_[r.SHAPES.RECT]=d,_[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=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.updateBatches(),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(){if(this.graphicsData.length){if(this.validateBatching()){this.cacheDirty=this.dirty;var t=this.uvs,e=this.graphicsData,i=null,r=null;this.batches.length>0&&(r=(i=this.batches[this.batches.length-1]).style);for(var s=this.shapeIndex;s<e.length;s++){this.shapeIndex++;var h=e[s],a=h.fillStyle,o=h.lineStyle;E[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,f=this.points.length/2;p.wrapMode=n.WRAP_MODES.REPEAT,0===l?this.processFill(h):this.processLine(h);var d=this.points.length/2-f;0!==d&&(i&&!this._compareStyles(r,u)&&(i.end(c,f),i=null),i||((i=A.pop()||new M).begin(u,c,f),this.batches.push(i),r=u),this.addUvs(this.points,t,u.texture,f,d,u.matrix))}}}var y=this.indices.length,v=this.points.length/2;if(i&&i.end(y,v),0!==this.batches.length){var g=v>65535;this.indicesUint16&&this.indices.length===this.indicesUint16.length&&g===this.indicesUint16.BYTES_PER_ELEMENT>2?this.indicesUint16.set(this.indices):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},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 f=this.batches[e],d=f.style,y=d.texture.baseTexture;u!==!!d.native&&(p=(u=!!d.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+=f.size,c+=f.size,l=y._batchLocation,this.addColors(r,d.color,d.alpha,f.attribSize,f.attribStart),this.addTextureIds(s,l,f.attribSize,f.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;t.clear(),t.addVertexData(this.points,0,this.points.length),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),f=Math.floor(t[i+1]+n),d=i+2;d<h;d+=2)c=Math.min(c,Math.floor(t[d]+n)),f=Math.min(f,Math.floor(t[d+1]+n));u-=c,p-=f;for(d=i;d<h;d+=2)t[d]=(t[d]+u)*o,t[d+1]=(t[d+1]+p)*l},e.BATCHABLE_SIZE=100,e}(i.BatchGeometry),R=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),L=new Float32Array(3),B={},N=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 R,r._matrix=null,r._holeMode=!1,r.state=i.State.for2d(),r._geometry=e||new C,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;e.updateBatches(),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(!B[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;B[s]=new i.Shader(l,o)}e=B[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,L),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],f=o[p+1];l[u++]=i*c+s*f+h,l[u++]=n*f+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),O={buildPoly:c,buildCircle:f,buildRectangle:d,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=N,exports.GraphicsData=D,exports.GraphicsGeometry=C,exports.LineStyle=R,exports.graphicsUtils=O; | ||
//# sourceMappingURL=graphics.min.js.map |
/*! | ||
* @pixi/graphics - v6.4.2 | ||
* Compiled Thu, 02 Jun 2022 15:39:26 UTC | ||
* @pixi/graphics - v6.5.0-rc | ||
* Compiled Thu, 14 Jul 2022 18:30:46 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 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}; | ||
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,Polygon as p,Rectangle as c,RoundedRectangle as f,Circle as d,Ellipse as y,Matrix 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 S,Container as M}from"@pixi/display";var P,T;!function(t){t.MITER="miter",t.BEVEL="bevel",t.ROUND="round"}(P||(P={})),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}(),E=function(t,e){return E=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])},E(t,e)};function C(t,e){function i(){this.constructor=t}E(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}function R(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,f=n-h-1,d=h,y=h+1;i=[t[d],t[c]],t[c]=i[0],t[d]=i[1],r=[t[y],t[f]],t[f]=r[0],t[y]=r[1]}}}}var I={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){R(i,!1);for(var h=[],a=0;a<r.length;a++){var o=r[a];R(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,f=p.height/2;e=p.x+c,i=p.y+f,r=c-(s=h=Math.max(0,Math.min(p.radius,Math.min(c,f)))),n=f-h}if(s>=0&&h>=0&&r>=0&&n>=0){var d=Math.ceil(2.3*Math.sqrt(s+h)),y=8*d+(r?4:0)+(n?4:0);if(a.length=y,0!==y){if(0===d)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*d+(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 S=i-D;a[b++]=_,a[b++]=S,a[--m]=S,a[--m]=x}for(var M=1;M<d;M++){var P=Math.PI/2*(M/d);x=e+(T=r+Math.cos(P)*s),_=e-T,w=i+(D=n+Math.sin(P)*h),S=i-D;a[v++]=x,a[v++]=w,a[--g]=w,a[--g]=_,a[b++]=_,a[b++]=S,a[--m]=S,a[--m]=x}var T,D;x=e+(T=r),_=e-T,w=i+(D=n+h),S=i-D;a[v++]=x,a[v++]=w,a[--m]=S,a[--m]=x,r&&(a[v++]=_,a[v++]=w,a[--m]=S,a[--m]=_)}}else a.length=0},triangulate:function(t,e){var i=t.points,r=e.points,n=e.indices;if(0!==i.length){var s,h,a=r.length/2,l=a;if(t.type!==o.RREC){var u=t.shape;s=u.x,h=u.y}else{var p=t.shape;s=p.x+p.width/2,h=p.y+p.height/2}var c=t.matrix;r.push(t.matrix?c.a*s+c.c*h+c.tx:s,t.matrix?c.b*s+c.d*h+c.ty:h),a++,r.push(i[0],i[1]);for(var f=2;f<i.length;f+=2)r.push(i[f],i[f+1]),n.push(a++,l,a);n.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 U(t,e,i){return t+(e-t)*i}function O(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,f=0,d=0,y=0;d<=20;++d)o=U(t,i,y=d/20),l=U(e,r,y),u=U(i,n,y),p=U(r,s,y),c=U(o,u,y),f=U(l,p,y),0===d&&a[a.length-2]===c&&a[a.length-1]===f||a.push(c,f);return a}var j={build:function(t){if(et.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?(O(r,n+a,r,n,r+a,n,i),O(r+s-a,n,r+s,n,r+s,n+a,i),O(r+s,n+h-a,r+s,n+h,r+s-a,n+h,i),O(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(et.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 N(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,f=e+r*s+l;return a.push(u,p),a.push(c,f),2}function F(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,f=p-u,d=Math.abs(f),y=Math.sqrt(o*o+l*l),v=1+(15*d*Math.sqrt(y)/Math.PI>>0),g=f/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),f=.5*(a.y+h.y);r.unshift(c,f),r.push(c,f)}var d=e.points,y=r.length/2,v=r.length,g=d.length/2,b=s.width/2,m=b*b,x=s.miterLimit*s.miterLimit,_=r[0],w=r[1],S=r[2],M=r[3],A=0,E=0,C=-(w-M),R=_-S,I=0,B=0,L=Math.sqrt(C*C+R*R);C/=L,R/=L,C*=b,R*=b;var U=s.alignment,O=2*(1-U),j=2*U;u||(s.cap===T.ROUND?v+=F(_-C*(O-j)*.5,w-R*(O-j)*.5,_-C*O,w-R*O,_+C*j,w+R*j,d,!0)+2:s.cap===T.SQUARE&&(v+=N(_,w,C,R,O,j,!0,d))),d.push(_-C*O,w-R*O),d.push(_+C*j,w+R*j);for(var z=1;z<y-1;++z){_=r[2*(z-1)],w=r[2*(z-1)+1],S=r[2*z],M=r[2*z+1],A=r[2*(z+1)],E=r[2*(z+1)+1],C=-(w-M),R=_-S,C/=L=Math.sqrt(C*C+R*R),R/=L,C*=b,R*=b,I=-(M-E),B=S-A,I/=L=Math.sqrt(I*I+B*B),B/=L,I*=b,B*=b;var q=S-_,k=w-M,H=S-A,G=E-M,W=k*H-G*q,Y=W<0;if(Math.abs(W)<.1)d.push(S-C*O,M-R*O),d.push(S+C*j,M+R*j);else{var V=(-C+_)*(-R+M)-(-C+S)*(-R+w),Q=(-I+A)*(-B+M)-(-I+S)*(-B+E),X=(q*Q-H*V)/W,Z=(G*V-k*Q)/W,J=(X-S)*(X-S)+(Z-M)*(Z-M),K=S+(X-S)*O,$=M+(Z-M)*O,tt=S-(X-S)*j,et=M-(Z-M)*j,it=Y?O:j;J<=Math.min(q*q+k*k,H*H+G*G)+it*it*m?s.join===P.BEVEL||J/m>x?(Y?(d.push(K,$),d.push(S+C*j,M+R*j),d.push(K,$),d.push(S+I*j,M+B*j)):(d.push(S-C*O,M-R*O),d.push(tt,et),d.push(S-I*O,M-B*O),d.push(tt,et)),v+=2):s.join===P.ROUND?Y?(d.push(K,$),d.push(S+C*j,M+R*j),v+=F(S,M,S+C*j,M+R*j,S+I*j,M+B*j,d,!0)+4,d.push(K,$),d.push(S+I*j,M+B*j)):(d.push(S-C*O,M-R*O),d.push(tt,et),v+=F(S,M,S-C*O,M-R*O,S-I*O,M-B*O,d,!1)+4,d.push(S-I*O,M-B*O),d.push(tt,et)):(d.push(K,$),d.push(tt,et)):(d.push(S-C*O,M-R*O),d.push(S+C*j,M+R*j),s.join===P.ROUND?v+=Y?F(S,M,S+C*j,M+R*j,S+I*j,M+B*j,d,!0)+2:F(S,M,S-C*O,M-R*O,S-I*O,M-B*O,d,!1)+2:s.join===P.MITER&&J/m<=x&&(Y?(d.push(tt,et),d.push(tt,et)):(d.push(K,$),d.push(K,$)),v+=2),d.push(S-I*O,M-B*O),d.push(S+I*j,M+B*j),v+=2)}}_=r[2*(y-2)],w=r[2*(y-2)+1],S=r[2*(y-1)],C=-(w-(M=r[2*(y-1)+1])),R=_-S,C/=L=Math.sqrt(C*C+R*R),R/=L,C*=b,R*=b,d.push(S-C*O,M-R*O),d.push(S+C*j,M+R*j),u||(s.cap===T.ROUND?v+=F(S-C*(O-j)*.5,M-R*(O-j)*.5,S-C*O,M-R*O,S+C*j,M+R*j,d,!1)+2:s.cap===T.SQUARE&&(v+=N(S,M,C,R,O,j,!1,d)));var rt=e.indices,nt=D.epsilon*D.epsilon;for(z=g;z<v+g-2;++z)_=d[2*z],w=d[2*z+1],S=d[2*(z+1)],M=d[2*(z+1)+1],A=d[2*(z+2)],E=d[2*(z+2)+1],Math.abs(_*(M-E)+S*(E-w)+A*(w-M))<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,f=l*l+u*u,d=a*l+o*u,y=n*Math.sqrt(c)/p,v=n*Math.sqrt(f)/p,g=y*d/c,b=v*d/f,m=y*u+v*o,x=y*l+v*a,_=o*(v+g),w=a*(v+g),S=u*(y+b),M=l*(y+b);return{cx:m+t,cy:x+e,radius:n,startAngle:Math.atan2(w-x,_-m),endAngle:Math.atan2(M-x,S-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),f=2*c,d=Math.cos(c),y=Math.sin(c),v=p-1,g=v%1/v,b=0;b<=v;++b){var m=c+s+f*(b+g*b),x=Math.cos(m),_=-Math.sin(m);o.push((d*x+y*_)*n+i,(d*-_+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,f=0,d=0,y=0,v=0,g=0,b=0,m=t,x=e,_=1;_<=10;++_)g=m-(y=(d=(f=(c=1-(l=_/10))*c)*c)*t+3*f*l*i+3*c*(u=l*l)*n+(p=u*l)*h),b=x-(v=d*e+3*f*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,f=0,d=0,y=0;a.push(o,l);for(var v=1,g=0;v<=u;++v)f=(c=(p=1-(g=v/u))*p)*p,y=(d=g*g)*g,a.push(f*o+3*c*g*e+3*p*d*r+y*s,f*l+3*c*g*i+3*p*d*n+y*h)},t}(),G=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,f=2*Math.sqrt(u+p+c),d=Math.sqrt(u),y=2*u*d,v=2*Math.sqrt(c),g=p/d;return(y*f+d*p*(f-v)+(4*c*u-p*p)*Math.log((2*d+g+f)/(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}(),W=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}(),Y=((q={})[o.POLY]=I,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=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 S,e.boundsDirty=-1,e}return C(n,t),Object.defineProperty(n.prototype,"bounds",{get:function(){return this.updateBatches(),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(){if(this.graphicsData.length){if(this.validateBatching()){this.cacheDirty=this.dirty;var t=this.uvs,e=this.graphicsData,i=null,r=null;this.batches.length>0&&(r=(i=this.batches[this.batches.length-1]).style);for(var n=this.shapeIndex;n<e.length;n++){this.shapeIndex++;var s=e[n],h=s.fillStyle,a=s.lineStyle;Y[s.type].build(s),s.matrix&&this.transformPoints(s.points,s.matrix),(h.visible||a.visible)&&this.processHoles(s.holes);for(var o=0;o<2;o++){var l=0===o?h:a;if(l.visible){var u=l.texture.baseTexture,p=this.indices.length,c=this.points.length/2;u.wrapMode=x.REPEAT,0===o?this.processFill(s):this.processLine(s);var f=this.points.length/2-c;0!==f&&(i&&!this._compareStyles(r,l)&&(i.end(p,c),i=null),i||((i=V.pop()||new W).begin(l,p,c),this.batches.push(i),r=l),this.addUvs(this.points,t,l.texture,c,f,l.matrix))}}}var d=this.indices.length,y=this.points.length/2;if(i&&i.end(d,y),0!==this.batches.length){var v=y>65535;this.indicesUint16&&this.indices.length===this.indicesUint16.length&&v===this.indicesUint16.BYTES_PER_ELEMENT>2?this.indicesUint16.set(this.indices):this.indicesUint16=v?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,f=0;this.drawCalls.push(a);for(n=0;n<this.batches.length;n++){var d=this.batches[n],y=d.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=f,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+=d.size,f+=d.size,u=v._batchLocation,this.addColors(s,y.color,y.alpha,d.attribSize,d.attribStart),this.addTextureIds(h,u,d.attribSize,d.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?I.triangulate(t,this):Y[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];Y[i.type].build(i),i.matrix&&this.transformPoints(i.points,i.matrix)}},n.prototype.calculateBounds=function(){var t=this._bounds;t.clear(),t.addVertexData(this.points,0,this.points.length),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),f=Math.floor(t[i+1]+s),d=i+2;d<h;d+=2)c=Math.min(c,Math.floor(t[d]+s)),f=Math.min(f,Math.floor(t[d+1]+s));u-=c,p-=f;for(d=i;d<h;d+=2)t[d]=(t[d]+u)*o,t[d+1]=(t[d+1]+p)*l},n.BATCHABLE_SIZE=100,n}(n),K=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=P.MITER,e.miterLimit=10,e}return C(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),$=new Float32Array(3),tt={},et=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 K,i._matrix=null,i._holeMode=!1,i.state=a.for2d(),i._geometry=t||new J,i._geometry.refCount++,i._transformID=-1,i.tint=16777215,i.blendMode=w.NORMAL,i}return C(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:P.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 p,this.currentPath.closeStroke=!1,this.currentPath.points.push(t[e-2],t[e-1]))}else this.currentPath=new p,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),G.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 c(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 d(t,e,i))},i.prototype.drawEllipse=function(t,e,i,r){return this.drawShape(new y(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 p(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;e.updateBatches(),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(!tt[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 v,default:s.from({uSamplers:n},!0)},l=t.plugins[i]._shader.program;tt[i]=new h(l,o)}e=tt[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,$),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],f=o[p+1];l[u++]=i*c+n*f+h,l[u++]=s*f+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}(M),it={buildPoly:I,buildCircle:B,buildRectangle:L,buildRoundedRectangle:j,buildLine:z,ArcUtils:k,BezierUtils:H,QuadraticUtils:G,BatchPart:W,FILL_COMMANDS:Y,BATCH_POOL:V,DRAW_CALL_POOL:Q};export{A as FillStyle,D as GRAPHICS_CURVES,et as Graphics,X as GraphicsData,J as GraphicsGeometry,T as LINE_CAP,P as LINE_JOIN,K as LineStyle,it as graphicsUtils}; | ||
//# sourceMappingURL=graphics.min.js.map |
@@ -18,3 +18,3 @@ /// <reference path="./global.d.ts" /> | ||
import type { Rectangle } from '@pixi/math'; | ||
import { Renderer } from '@pixi/core'; | ||
import type { Renderer } from '@pixi/core'; | ||
import type { RoundedRectangle } from '@pixi/math'; | ||
@@ -720,5 +720,4 @@ import { Shader } from '@pixi/core'; | ||
* 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 | ||
*/ | ||
updateBatches(allow32Indices?: boolean): void; | ||
updateBatches(): void; | ||
/** | ||
@@ -725,0 +724,0 @@ * Affinity check |
{ | ||
"name": "@pixi/graphics", | ||
"version": "6.4.2", | ||
"version": "6.5.0-rc", | ||
"main": "dist/cjs/graphics.js", | ||
@@ -41,10 +41,10 @@ "module": "dist/esm/graphics.js", | ||
"peerDependencies": { | ||
"@pixi/constants": "6.4.2", | ||
"@pixi/core": "6.4.2", | ||
"@pixi/display": "6.4.2", | ||
"@pixi/math": "6.4.2", | ||
"@pixi/sprite": "6.4.2", | ||
"@pixi/utils": "6.4.2" | ||
"@pixi/constants": "6.5.0-rc", | ||
"@pixi/core": "6.5.0-rc", | ||
"@pixi/display": "6.5.0-rc", | ||
"@pixi/math": "6.5.0-rc", | ||
"@pixi/sprite": "6.5.0-rc", | ||
"@pixi/utils": "6.5.0-rc" | ||
}, | ||
"gitHead": "a87bb87036d5fb9119ee92fd9c3da23b5bb9424b" | ||
"gitHead": "16005f83e7a6d87831ce84f8a6d460606a331ef6" | ||
} |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1744662
10126
2