modern-canvas 0.4.10 → 0.4.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -8357,9 +8357,11 @@ class SceneTree extends MainLoop {
8357
8357
  this.emit("processed");
8358
8358
  }
8359
8359
  _render(renderer) {
8360
+ this.emit("rendering");
8360
8361
  renderer.program.uniforms.projectionMatrix = this.root.toProjectionArray(true);
8361
8362
  this.renderStack.render(renderer);
8362
8363
  this._renderScreen(renderer);
8364
+ this.emit("rendered");
8363
8365
  }
8364
8366
  _renderScreen(renderer) {
8365
8367
  renderer.state.reset();
package/dist/index.d.cts CHANGED
@@ -1559,6 +1559,8 @@ declare class Viewport extends Node implements Rectangulable {
1559
1559
  interface SceneTreeEventMap extends MainLoopEventMap {
1560
1560
  processing: () => void;
1561
1561
  processed: () => void;
1562
+ rendering: () => void;
1563
+ rendered: () => void;
1562
1564
  nodeProcessing: (node: Node) => void;
1563
1565
  nodeProcessed: (node: Node) => void;
1564
1566
  }
package/dist/index.d.mts CHANGED
@@ -1559,6 +1559,8 @@ declare class Viewport extends Node implements Rectangulable {
1559
1559
  interface SceneTreeEventMap extends MainLoopEventMap {
1560
1560
  processing: () => void;
1561
1561
  processed: () => void;
1562
+ rendering: () => void;
1563
+ rendered: () => void;
1562
1564
  nodeProcessing: (node: Node) => void;
1563
1565
  nodeProcessed: (node: Node) => void;
1564
1566
  }
package/dist/index.d.ts CHANGED
@@ -1559,6 +1559,8 @@ declare class Viewport extends Node implements Rectangulable {
1559
1559
  interface SceneTreeEventMap extends MainLoopEventMap {
1560
1560
  processing: () => void;
1561
1561
  processed: () => void;
1562
+ rendering: () => void;
1563
+ rendered: () => void;
1562
1564
  nodeProcessing: (node: Node) => void;
1563
1565
  nodeProcessed: (node: Node) => void;
1564
1566
  }
package/dist/index.js CHANGED
@@ -668,7 +668,7 @@ void main(void) {
668
668
  coord = unmapCoord(coord);
669
669
  gl_FragColor = texture2D(sampler, coord);
670
670
  }`})),ra([k()],u.PixelateEffect.prototype,"size",2),u.PixelateEffect=ra([re("PixelateEffect")],u.PixelateEffect);function Qh(r,A,e=2){const t=A&&A.length,i=t?A[0]*e:r.length;let s=sa(r,0,i,e,!0);const n=[];if(!s||s.next===s.prev)return n;let o,a,l;if(t&&(s=_h(r,A,s,e)),r.length>80*e){o=1/0,a=1/0;let g=-1/0,c=-1/0;for(let f=e;f<i;f+=e){const I=r[f],d=r[f+1];I<o&&(o=I),d<a&&(a=d),I>g&&(g=I),d>c&&(c=d)}l=Math.max(g-o,c-a),l=l!==0?32767/l:0}return di(s,n,e,o,a,l,0),n}function sa(r,A,e,t,i){let s;if(i===Fh(r,A,e,t)>0)for(let n=A;n<e;n+=t)s=la(n/t|0,r[n],r[n+1],s);else for(let n=e-t;n>=A;n-=t)s=la(n/t|0,r[n],r[n+1],s);return s&&NA(s,s.next)&&(Ei(s),s=s.next),s}function EA(r,A){if(!r)return r;A||(A=r);let e=r,t;do if(t=!1,!e.steiner&&(NA(e,e.next)||ye(e.prev,e,e.next)===0)){if(Ei(e),e=A=e.prev,e===e.next)break;t=!0}else e=e.next;while(t||e!==A);return A}function di(r,A,e,t,i,s,n){if(!r)return;!n&&s&&Mh(r,t,i,s);let o=r;for(;r.prev!==r.next;){const a=r.prev,l=r.next;if(s?mh(r,t,i,s):yh(r)){A.push(a.i,r.i,l.i),Ei(r),r=l.next,o=l.next;continue}if(r=l,r===o){n?n===1?(r=wh(EA(r),A),di(r,A,e,t,i,s,2)):n===2&&vh(r,A,e,t,i,s):di(EA(r),A,e,t,i,s,1);break}}}function yh(r){const A=r.prev,e=r,t=r.next;if(ye(A,e,t)>=0)return!1;const i=A.x,s=e.x,n=t.x,o=A.y,a=e.y,l=t.y,g=Math.min(i,s,n),c=Math.min(o,a,l),f=Math.max(i,s,n),I=Math.max(o,a,l);let d=t.next;for(;d!==A;){if(d.x>=g&&d.x<=f&&d.y>=c&&d.y<=I&&Ii(i,o,s,a,n,l,d.x,d.y)&&ye(d.prev,d,d.next)>=0)return!1;d=d.next}return!0}function mh(r,A,e,t){const i=r.prev,s=r,n=r.next;if(ye(i,s,n)>=0)return!1;const o=i.x,a=s.x,l=n.x,g=i.y,c=s.y,f=n.y,I=Math.min(o,a,l),d=Math.min(g,c,f),C=Math.max(o,a,l),B=Math.max(g,c,f),R=bs(I,d,A,e,t),S=bs(C,B,A,e,t);let _=r.prevZ,M=r.nextZ;for(;_&&_.z>=R&&M&&M.z<=S;){if(_.x>=I&&_.x<=C&&_.y>=d&&_.y<=B&&_!==i&&_!==n&&Ii(o,g,a,c,l,f,_.x,_.y)&&ye(_.prev,_,_.next)>=0||(_=_.prevZ,M.x>=I&&M.x<=C&&M.y>=d&&M.y<=B&&M!==i&&M!==n&&Ii(o,g,a,c,l,f,M.x,M.y)&&ye(M.prev,M,M.next)>=0))return!1;M=M.nextZ}for(;_&&_.z>=R;){if(_.x>=I&&_.x<=C&&_.y>=d&&_.y<=B&&_!==i&&_!==n&&Ii(o,g,a,c,l,f,_.x,_.y)&&ye(_.prev,_,_.next)>=0)return!1;_=_.prevZ}for(;M&&M.z<=S;){if(M.x>=I&&M.x<=C&&M.y>=d&&M.y<=B&&M!==i&&M!==n&&Ii(o,g,a,c,l,f,M.x,M.y)&&ye(M.prev,M,M.next)>=0)return!1;M=M.nextZ}return!0}function wh(r,A){let e=r;do{const t=e.prev,i=e.next.next;!NA(t,i)&&oa(t,e,e.next,i)&&Bi(t,i)&&Bi(i,t)&&(A.push(t.i,e.i,i.i),Ei(e),Ei(e.next),e=r=i),e=e.next}while(e!==r);return EA(e)}function vh(r,A,e,t,i,s){let n=r;do{let o=n.next.next;for(;o!==n.prev;){if(n.i!==o.i&&kh(n,o)){let a=aa(n,o);n=EA(n,n.next),a=EA(a,a.next),di(n,A,e,t,i,s,0),di(a,A,e,t,i,s,0);return}o=o.next}n=n.next}while(n!==r)}function _h(r,A,e,t){const i=[];for(let s=0,n=A.length;s<n;s++){const o=A[s]*t,a=s<n-1?A[s+1]*t:r.length,l=sa(r,o,a,t,!1);l===l.next&&(l.steiner=!0),i.push(Uh(l))}i.sort(Dh);for(let s=0;s<i.length;s++)e=bh(i[s],e);return e}function Dh(r,A){let e=r.x-A.x;if(e===0&&(e=r.y-A.y,e===0)){const t=(r.next.y-r.y)/(r.next.x-r.x),i=(A.next.y-A.y)/(A.next.x-A.x);e=t-i}return e}function bh(r,A){const e=xh(r,A);if(!e)return A;const t=aa(e,r);return EA(t,t.next),EA(e,e.next)}function xh(r,A){let e=A;const t=r.x,i=r.y;let s=-1/0,n;if(NA(r,e))return e;do{if(NA(r,e.next))return e.next;if(i<=e.y&&i>=e.next.y&&e.next.y!==e.y){const c=e.x+(i-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(c<=t&&c>s&&(s=c,n=e.x<e.next.x?e:e.next,c===t))return n}e=e.next}while(e!==A);if(!n)return null;const o=n,a=n.x,l=n.y;let g=1/0;e=n;do{if(t>=e.x&&e.x>=a&&t!==e.x&&na(i<l?t:s,i,a,l,i<l?s:t,i,e.x,e.y)){const c=Math.abs(i-e.y)/(t-e.x);Bi(e,r)&&(c<g||c===g&&(e.x>n.x||e.x===n.x&&Sh(n,e)))&&(n=e,g=c)}e=e.next}while(e!==o);return n}function Sh(r,A){return ye(r.prev,r,A.prev)<0&&ye(A.next,r,r.next)<0}function Mh(r,A,e,t){let i=r;do i.z===0&&(i.z=bs(i.x,i.y,A,e,t)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==r);i.prevZ.nextZ=null,i.prevZ=null,Rh(i)}function Rh(r){let A,e=1;do{let t=r,i;r=null;let s=null;for(A=0;t;){A++;let n=t,o=0;for(let l=0;l<e&&(o++,n=n.nextZ,!!n);l++);let a=e;for(;o>0||a>0&&n;)o!==0&&(a===0||!n||t.z<=n.z)?(i=t,t=t.nextZ,o--):(i=n,n=n.nextZ,a--),s?s.nextZ=i:r=i,i.prevZ=s,s=i;t=n}s.nextZ=null,e*=2}while(A>1);return r}function bs(r,A,e,t,i){return r=(r-e)*i|0,A=(A-t)*i|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,A=(A|A<<8)&16711935,A=(A|A<<4)&252645135,A=(A|A<<2)&858993459,A=(A|A<<1)&1431655765,r|A<<1}function Uh(r){let A=r,e=r;do(A.x<e.x||A.x===e.x&&A.y<e.y)&&(e=A),A=A.next;while(A!==r);return e}function na(r,A,e,t,i,s,n,o){return(i-n)*(A-o)>=(r-n)*(s-o)&&(r-n)*(t-o)>=(e-n)*(A-o)&&(e-n)*(s-o)>=(i-n)*(t-o)}function Ii(r,A,e,t,i,s,n,o){return!(r===n&&A===o)&&na(r,A,e,t,i,s,n,o)}function kh(r,A){return r.next.i!==A.i&&r.prev.i!==A.i&&!Ph(r,A)&&(Bi(r,A)&&Bi(A,r)&&Nh(r,A)&&(ye(r.prev,r,A.prev)||ye(r,A.prev,A))||NA(r,A)&&ye(r.prev,r,r.next)>0&&ye(A.prev,A,A.next)>0)}function ye(r,A,e){return(A.y-r.y)*(e.x-A.x)-(A.x-r.x)*(e.y-A.y)}function NA(r,A){return r.x===A.x&&r.y===A.y}function oa(r,A,e,t){const i=Ar(ye(r,A,e)),s=Ar(ye(r,A,t)),n=Ar(ye(e,t,r)),o=Ar(ye(e,t,A));return!!(i!==s&&n!==o||i===0&&tr(r,e,A)||s===0&&tr(r,t,A)||n===0&&tr(e,r,t)||o===0&&tr(e,A,t))}function tr(r,A,e){return A.x<=Math.max(r.x,e.x)&&A.x>=Math.min(r.x,e.x)&&A.y<=Math.max(r.y,e.y)&&A.y>=Math.min(r.y,e.y)}function Ar(r){return r>0?1:r<0?-1:0}function Ph(r,A){let e=r;do{if(e.i!==r.i&&e.next.i!==r.i&&e.i!==A.i&&e.next.i!==A.i&&oa(e,e.next,r,A))return!0;e=e.next}while(e!==r);return!1}function Bi(r,A){return ye(r.prev,r,r.next)<0?ye(r,A,r.next)>=0&&ye(r,r.prev,A)>=0:ye(r,A,r.prev)<0||ye(r,r.next,A)<0}function Nh(r,A){let e=r,t=!1;const i=(r.x+A.x)/2,s=(r.y+A.y)/2;do e.y>s!=e.next.y>s&&e.next.y!==e.y&&i<(e.next.x-e.x)*(s-e.y)/(e.next.y-e.y)+e.x&&(t=!t),e=e.next;while(e!==r);return t}function aa(r,A){const e=xs(r.i,r.x,r.y),t=xs(A.i,A.x,A.y),i=r.next,s=A.prev;return r.next=A,A.prev=r,e.next=i,i.prev=e,t.next=e,e.prev=t,s.next=t,t.prev=s,t}function la(r,A,e,t){const i=xs(r,A,e);return t?(i.next=t.next,i.prev=t,t.next.prev=i,t.next=i):(i.prev=i,i.next=i),i}function Ei(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function xs(r,A,e){return{i:r,x:A,y:e,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function Fh(r,A,e,t){let i=0;for(let s=A,n=e-t;s<e;s+=t)i+=(r[n]-r[s])*(r[s+1]+r[n+1]),n=s;return i}function Th(r,A,e,t={}){const{radius:i=1}=t;r.moveTo(A,e),r.arc(A,e,i,0,Math.PI*2)}const Lh={arcs:"bevel",bevel:"bevel",miter:"miter","miter-clip":"miter",round:"round"};function Ss(r,A){const{fill:e="#000",stroke:t="none",strokeWidth:i=t==="none"?0:1,strokeLinecap:s="round",strokeLinejoin:n="miter",strokeMiterlimit:o=0,strokeDasharray:a=[],strokeDashoffset:l=0,shadowOffsetX:g=0,shadowOffsetY:c=0,shadowBlur:f=0,shadowColor:I="rgba(0, 0, 0, 0)"}=A;r.fillStyle=e,r.strokeStyle=t,r.lineWidth=i,r.lineCap=s,r.lineJoin=Lh[n],r.miterLimit=o,r.setLineDash(a),r.lineDashOffset=l,r.shadowOffsetX=g,r.shadowOffsetY=c,r.shadowBlur=f,r.shadowColor=I}class G{constructor(A=0,e=0){this.x=A,this.y=e}static get MAX(){return new G(1/0,1/0)}static get MIN(){return new G(-1/0,-1/0)}get array(){return[this.x,this.y]}set(A,e){return this.x=A,this.y=e,this}add(A){return this.x+=A.x,this.y+=A.y,this}sub(A){return this.x-=A.x,this.y-=A.y,this}multiply(A){return this.x*=A.x,this.y*=A.y,this}divide(A){return this.x/=A.x,this.y/=A.y,this}dot(A){return this.x*A.x+this.y*A.y}cross(A){return this.x*A.y-this.y*A.x}rotate(A,e={x:0,y:0}){const t=-A/180*Math.PI,i=this.x-e.x,s=-(this.y-e.y),n=Math.sin(t),o=Math.cos(t);return this.set(e.x+(i*o-s*n),e.y-(i*n+s*o)),this}distanceTo(A){return Math.sqrt(this.distanceToSquared(A))}distanceToSquared(A){const e=this.x-A.x,t=this.y-A.y;return e*e+t*t}lengthSquared(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.lengthSquared())}scale(A,e=A,t={x:0,y:0}){const i=A<0?t.x-this.x+t.x:this.x,s=e<0?t.y-this.y+t.y:this.y;return this.x=i*Math.abs(A),this.y=s*Math.abs(e),this}skew(A,e=0,t={x:0,y:0}){const i=this.x-t.x,s=this.y-t.y;return this.x=t.x+(i+Math.tan(A)*s),this.y=t.y+(s+Math.tan(e)*i),this}min(...A){return this.x=Math.min(this.x,...A.map(e=>e.x)),this.y=Math.min(this.y,...A.map(e=>e.y)),this}max(...A){return this.x=Math.max(this.x,...A.map(e=>e.x)),this.y=Math.max(this.y,...A.map(e=>e.y)),this}normalize(){return this.scale(1/(this.length()||1))}addVectors(A,e){return this.x=A.x+e.x,this.y=A.y+e.y,this}subVectors(A,e){return this.x=A.x-e.x,this.y=A.y-e.y,this}multiplyVectors(A,e){return this.x=A.x*e.x,this.y=A.y*e.y,this}divideVectors(A,e){return this.x=A.x/e.x,this.y=A.y/e.y,this}lerpVectors(A,e,t){return this.x=A.x+(e.x-A.x)*t,this.y=A.y+(e.y-A.y)*t,this}equals(A){return this.x===A.x&&this.y===A.y}applyMatrix3(A){const e=this.x,t=this.y,i=A.elements;return this.x=i[0]*e+i[3]*t+i[6],this.y=i[1]*e+i[4]*t+i[7],this}copy(A){return this.x=A.x,this.y=A.y,this}clone(){return new G(this.x,this.y)}}class ce{constructor(A=0,e=0,t=0,i=0){this.left=A,this.top=e,this.width=t,this.height=i}get x(){return this.left}set x(A){this.left=A}get y(){return this.top}set y(A){this.top=A}get right(){return this.left+this.width}get bottom(){return this.top+this.height}get center(){return new G((this.left+this.right)/2,(this.top+this.bottom)/2)}get array(){return[this.left,this.top,this.width,this.height]}static from(...A){if(A.length===0)return new ce;if(A.length===1)return A[0].clone();const e=A[0],t=A.slice(1).reduce((i,s)=>(i.left=Math.min(i.left,s.left),i.top=Math.min(i.top,s.top),i.right=Math.max(i.right,s.right),i.bottom=Math.max(i.bottom,s.bottom),i),{left:(e==null?void 0:e.left)??0,top:(e==null?void 0:e.top)??0,right:(e==null?void 0:e.right)??0,bottom:(e==null?void 0:e.bottom)??0});return new ce(t.left,t.top,t.right-t.left,t.bottom-t.top)}translate(A,e){return this.left+=A,this.top+=e,this}copy(A){return this.left=A.left,this.top=A.top,this.width=A.width,this.height=A.height,this}clone(){return new ce(this.left,this.top,this.width,this.height)}}class at{constructor(A=1,e=0,t=0,i=0,s=1,n=0,o=0,a=0,l=1){h(this,"elements",[]);this.set(A,e,t,i,s,n,o,a,l)}set(A,e,t,i,s,n,o,a,l){const g=this.elements;return g[0]=A,g[1]=i,g[2]=o,g[3]=e,g[4]=s,g[5]=a,g[6]=t,g[7]=n,g[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(A){const e=this.elements,t=A.elements;return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],this}multiply(A){return this.multiplyMatrices(this,A)}premultiply(A){return this.multiplyMatrices(A,this)}multiplyMatrices(A,e){const t=A.elements,i=e.elements,s=this.elements,n=t[0],o=t[3],a=t[6],l=t[1],g=t[4],c=t[7],f=t[2],I=t[5],d=t[8],C=i[0],B=i[3],R=i[6],S=i[1],_=i[4],M=i[7],w=i[2],v=i[5],D=i[8];return s[0]=n*C+o*S+a*w,s[3]=n*B+o*_+a*v,s[6]=n*R+o*M+a*D,s[1]=l*C+g*S+c*w,s[4]=l*B+g*_+c*v,s[7]=l*R+g*M+c*D,s[2]=f*C+I*S+d*w,s[5]=f*B+I*_+d*v,s[8]=f*R+I*M+d*D,this}invert(){const A=this.elements,e=A[0],t=A[1],i=A[2],s=A[3],n=A[4],o=A[5],a=A[6],l=A[7],g=A[8],c=g*n-o*l,f=o*a-g*s,I=l*s-n*a,d=e*c+t*f+i*I;if(d===0)return this.set(0,0,0,0,0,0,0,0,0);const C=1/d;return A[0]=c*C,A[1]=(i*l-g*t)*C,A[2]=(o*t-i*n)*C,A[3]=f*C,A[4]=(g*e-i*a)*C,A[5]=(i*s-o*e)*C,A[6]=I*C,A[7]=(t*a-l*e)*C,A[8]=(n*e-t*s)*C,this}transpose(){let A;const e=this.elements;return A=e[1],e[1]=e[3],e[3]=A,A=e[2],e[2]=e[6],e[6]=A,A=e[5],e[5]=e[7],e[7]=A,this}scale(A,e){return this.premultiply(Ms.makeScale(A,e)),this}rotate(A){return this.premultiply(Ms.makeRotation(-A)),this}translate(A,e){return this.premultiply(Ms.makeTranslation(A,e)),this}makeTranslation(A,e){return this.set(1,0,A,0,1,e,0,0,1),this}makeRotation(A){const e=Math.cos(A),t=Math.sin(A);return this.set(e,-t,0,t,e,0,0,0,1),this}makeScale(A,e){return this.set(A,0,0,0,e,0,0,0,1),this}fromArray(A,e=0){for(let t=0;t<9;t++)this.elements[t]=A[t+e];return this}clone(){return new this.constructor().fromArray(this.elements)}}const Ms=new at;function ga(r,A,e,t){const i=r*e+A*t,s=Math.sqrt(r*r+A*A)*Math.sqrt(e*e+t*t);let n=Math.acos(Math.max(-1,Math.min(1,i/s)));return r*t-A*e<0&&(n=-n),n}function Gh(r,A,e,t,i,s,n,o){if(A===0||e===0){r.lineTo(o.x,o.y);return}t=t*Math.PI/180,A=Math.abs(A),e=Math.abs(e);const a=(n.x-o.x)/2,l=(n.y-o.y)/2,g=Math.cos(t)*a+Math.sin(t)*l,c=-Math.sin(t)*a+Math.cos(t)*l;let f=A*A,I=e*e;const d=g*g,C=c*c,B=d/f+C/I;if(B>1){const j=Math.sqrt(B);A=j*A,e=j*e,f=A*A,I=e*e}const R=f*C+I*d,S=(f*I-R)/R;let _=Math.sqrt(Math.max(0,S));i===s&&(_=-_);const M=_*A*c/e,w=-_*e*g/A,v=Math.cos(t)*M-Math.sin(t)*w+(n.x+o.x)/2,D=Math.sin(t)*M+Math.cos(t)*w+(n.y+o.y)/2,x=ga(1,0,(g-M)/A,(c-w)/e),L=ga((g-M)/A,(c-w)/e,(-g-M)/A,(-c-w)/e)%(Math.PI*2);r.ellipse(v,D,A,e,t,x,x+L,s===0)}const _e={WHITESPACE:/[ \t\r\n]/,DIGIT:/\d/,SIGN:/[-+]/,POINT:/\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/};function Mt(r,A,e=0){let o=0,a=!0,l="",g="";const c=[];function f(B,R,S){const _=new SyntaxError(`Unexpected character "${B}" at index ${R}.`);throw _.partial=S,_}function I(){l!==""&&(g===""?c.push(Number(l)):c.push(Number(l)*10**Number(g))),l="",g=""}let d;const C=r.length;for(let B=0;B<C;B++){if(d=r[B],Array.isArray(A)&&A.includes(c.length%e)&&_e.FLAGS.test(d)){o=1,l=d,I();continue}if(o===0){if(_e.WHITESPACE.test(d))continue;if(_e.DIGIT.test(d)||_e.SIGN.test(d)){o=1,l=d;continue}if(_e.POINT.test(d)){o=2,l=d;continue}_e.COMMA.test(d)&&(a&&f(d,B,c),a=!0)}if(o===1){if(_e.DIGIT.test(d)){l+=d;continue}if(_e.POINT.test(d)){l+=d,o=2;continue}if(_e.EXP.test(d)){o=3;continue}_e.SIGN.test(d)&&l.length===1&&_e.SIGN.test(l[0])&&f(d,B,c)}if(o===2){if(_e.DIGIT.test(d)){l+=d;continue}if(_e.EXP.test(d)){o=3;continue}_e.POINT.test(d)&&l[l.length-1]==="."&&f(d,B,c)}if(o===3){if(_e.DIGIT.test(d)){g+=d;continue}if(_e.SIGN.test(d)){if(g===""){g+=d;continue}g.length===1&&_e.SIGN.test(g)&&f(d,B,c)}}_e.WHITESPACE.test(d)?(I(),o=0,a=!1):_e.COMMA.test(d)?(I(),o=0,a=!0):_e.SIGN.test(d)?(I(),o=1,l=d):_e.POINT.test(d)?(I(),o=2,l=d):f(d,B,c)}return I(),c}function FA(r,A){return r-(A-r)}function ha(r,A){const e=new G,t=new G;for(let i=0,s=r.length;i<s;i++){const n=r[i];if(n.type==="m"||n.type==="M")n.type==="m"?e.add(n):e.copy(n),A.moveTo(e.x,e.y),t.copy(e);else if(n.type==="h"||n.type==="H")n.type==="h"?e.x+=n.x:e.x=n.x,A.lineTo(e.x,e.y),t.copy(e);else if(n.type==="v"||n.type==="V")n.type==="v"?e.y+=n.y:e.y=n.y,A.lineTo(e.x,e.y),t.copy(e);else if(n.type==="l"||n.type==="L")n.type==="l"?e.add(n):e.copy(n),A.lineTo(e.x,e.y),t.copy(e);else if(n.type==="c"||n.type==="C")n.type==="c"?(A.bezierCurveTo(e.x+n.x1,e.y+n.y1,e.x+n.x2,e.y+n.y2,e.x+n.x,e.y+n.y),t.x=e.x+n.x2,t.y=e.y+n.y2,e.add(n)):(A.bezierCurveTo(n.x1,n.y1,n.x2,n.y2,n.x,n.y),t.x=n.x2,t.y=n.y2,e.copy(n));else if(n.type==="s"||n.type==="S")n.type==="s"?(A.bezierCurveTo(FA(e.x,t.x),FA(e.y,t.y),e.x+n.x2,e.y+n.y2,e.x+n.x,e.y+n.y),t.x=e.x+n.x2,t.y=e.y+n.y2,e.add(n)):(A.bezierCurveTo(FA(e.x,t.x),FA(e.y,t.y),n.x2,n.y2,n.x,n.y),t.x=n.x2,t.y=n.y2,e.copy(n));else if(n.type==="q"||n.type==="Q")n.type==="q"?(A.quadraticCurveTo(e.x+n.x1,e.y+n.y1,e.x+n.x,e.y+n.y),t.x=e.x+n.x1,t.y=e.y+n.y1,e.add(n)):(A.quadraticCurveTo(n.x1,n.y1,n.x,n.y),t.x=n.x1,t.y=n.y1,e.copy(n));else if(n.type==="t"||n.type==="T"){const o=FA(e.x,t.x),a=FA(e.y,t.y);t.x=o,t.y=a,n.type==="t"?(A.quadraticCurveTo(o,a,e.x+n.x,e.y+n.y),e.add(n)):(A.quadraticCurveTo(o,a,n.x,n.y),e.copy(n))}else if(n.type==="a"||n.type==="A"){const o=e.clone();if(n.type==="a"){if(n.x===0&&n.y===0)continue;e.add(n)}else{if(e.equals(n))continue;e.copy(n)}t.copy(e),Gh(A,n.rx,n.ry,n.angle,n.largeArcFlag,n.sweepFlag,o,e)}else n.type==="z"||n.type==="Z"?(A.startPoint&&e.copy(A.startPoint),A.closePath()):console.warn("Unsupported commands",n)}}function Oh(r){let A,e;const t=[];for(let i=0,s=r.length;i<s;i++){const n=r[i];switch(n.type){case"m":case"M":if(n.x.toFixed(4)===(e==null?void 0:e.x.toFixed(4))&&n.y.toFixed(4)===(e==null?void 0:e.y.toFixed(4)))continue;t.push(`${n.type} ${n.x} ${n.y}`),e={x:n.x,y:n.y},A={x:n.x,y:n.y};break;case"h":case"H":t.push(`${n.type} ${n.x}`),e={x:n.x,y:(e==null?void 0:e.y)??0};break;case"v":case"V":t.push(`${n.type} ${n.y}`),e={x:(e==null?void 0:e.x)??0,y:n.y};break;case"l":case"L":t.push(`${n.type} ${n.x} ${n.y}`),e={x:n.x,y:n.y};break;case"c":case"C":t.push(`${n.type} ${n.x1} ${n.y1} ${n.x2} ${n.y2} ${n.x} ${n.y}`),e={x:n.x,y:n.y};break;case"s":case"S":t.push(`${n.type} ${n.x2} ${n.y2} ${n.x} ${n.y}`),e={x:n.x,y:n.y};break;case"q":case"Q":t.push(`${n.type} ${n.x1} ${n.y1} ${n.x} ${n.y}`),e={x:n.x,y:n.y};break;case"t":case"T":t.push(`${n.type} ${n.x} ${n.y}`),e={x:n.x,y:n.y};break;case"a":case"A":t.push(`${n.type} ${n.rx} ${n.ry} ${n.angle} ${n.largeArcFlag} ${n.sweepFlag} ${n.x} ${n.y}`),e={x:n.x,y:n.y};break;case"z":case"Z":t.push(n.type),A&&(e={x:A.x,y:A.y});break}}return t.join(" ")}const Hh=/[a-df-z][^a-df-z]*/gi;function ca(r){const A=[],e=r.match(Hh);if(!e)return A;for(let t=0,i=e.length;t<i;t++){const s=e[t],n=s.charAt(0),o=s.slice(1).trim();let a;switch(n){case"m":case"M":a=Mt(o);for(let l=0,g=a.length;l<g;l+=2)l===0?A.push({type:n,x:a[l],y:a[l+1]}):A.push({type:n==="m"?"l":"L",x:a[l],y:a[l+1]});break;case"h":case"H":a=Mt(o);for(let l=0,g=a.length;l<g;l++)A.push({type:n,x:a[l]});break;case"v":case"V":a=Mt(o);for(let l=0,g=a.length;l<g;l++)A.push({type:n,y:a[l]});break;case"l":case"L":a=Mt(o);for(let l=0,g=a.length;l<g;l+=2)A.push({type:n,x:a[l],y:a[l+1]});break;case"c":case"C":a=Mt(o);for(let l=0,g=a.length;l<g;l+=6)A.push({type:n,x1:a[l],y1:a[l+1],x2:a[l+2],y2:a[l+3],x:a[l+4],y:a[l+5]});break;case"s":case"S":a=Mt(o);for(let l=0,g=a.length;l<g;l+=4)A.push({type:n,x2:a[l],y2:a[l+1],x:a[l+2],y:a[l+3]});break;case"q":case"Q":a=Mt(o);for(let l=0,g=a.length;l<g;l+=4)A.push({type:n,x1:a[l],y1:a[l+1],x:a[l+2],y:a[l+3]});break;case"t":case"T":a=Mt(o);for(let l=0,g=a.length;l<g;l+=2)A.push({type:n,x:a[l],y:a[l+1]});break;case"a":case"A":a=Mt(o,[3,4],7);for(let l=0,g=a.length;l<g;l+=7)A.push({type:n,rx:a[l],ry:a[l+1],angle:a[l+2],largeArcFlag:a[l+3],sweepFlag:a[l+4],x:a[l+5],y:a[l+6]});break;case"z":case"Z":A.push({type:n});break;default:console.warn(s)}}return A}function ua(r,A,e,t,i){const s=(t-A)*.5,n=(i-e)*.5,o=r*r,a=r*o;return(2*e-2*t+s+n)*a+(-3*e+3*t-2*s-n)*o+s*r+e}function Jh(r,A){const e=1-r;return e*e*e*A}function Kh(r,A){const e=1-r;return 3*e*e*r*A}function Yh(r,A){return 3*(1-r)*r*r*A}function Wh(r,A){return r*r*r*A}function fa(r,A,e,t,i){return Jh(r,A)+Kh(r,e)+Yh(r,t)+Wh(r,i)}function Vh(r,A={}){let{vertices:e=[],indices:t=[],holes:i=[],verticesStride:s=2,verticesOffset:n=0,indicesOffset:o=0}=A;const a=Qh(r,i,2);if(a){for(let g=0;g<a.length;g+=3)t[o++]=a[g]+n,t[o++]=a[g+1]+n,t[o++]=a[g+2]+n;let l=n*s;for(let g=0;g<r.length;g+=2)e[l]=r[g],e[l+1]=r[g+1],l+=s}return{vertices:e,indices:t}}const zh=8,ir=11920929e-14,qh=1;function Xh(r,A,e,t,i,s,n,o,a=.5,l){const c=Math.min(.99,Math.max(0,a));let f=(qh-c)/1;return f*=f,Rs(r,A,e,t,i,s,n,o,l,f,0),l.push(n,o),l}function Rs(r,A,e,t,i,s,n,o,a,l,g){if(g>zh)return;const c=(r+e)/2,f=(A+t)/2,I=(e+i)/2,d=(t+s)/2,C=(i+n)/2,B=(s+o)/2,R=(c+I)/2,S=(f+d)/2,_=(I+C)/2,M=(d+B)/2,w=(R+_)/2,v=(S+M)/2;if(g>0){let D=n-r,x=o-A;const L=Math.abs((e-n)*x-(t-o)*D),j=Math.abs((i-n)*x-(s-o)*D);if(L>ir&&j>ir){if((L+j)*(L+j)<=l*(D*D+x*x)){a.push(w,v);return}}else if(L>ir){if(L*L<=l*(D*D+x*x)){a.push(w,v);return}}else if(j>ir){if(j*j<=l*(D*D+x*x)){a.push(w,v);return}}else if(D=w-(r+n)/2,x=v-(A+o)/2,D*D+x*x<=l){a.push(w,v);return}}Rs(r,A,c,f,R,S,w,v,a,l,g+1),Rs(w,v,_,M,C,B,n,o,a,l,g+1)}const jh=8,Zh=11920929e-14,$h=1;function ec(r,A,e,t,i,s,n=.5,o){const l=Math.min(.99,Math.max(0,n));let g=($h-l)/1;return g*=g,Us(o,r,A,e,t,i,s,g,0),o.push(i,s),o}function Us(r,A,e,t,i,s,n,o,a){if(a>jh)return;const l=(A+t)/2,g=(e+i)/2,c=(t+s)/2,f=(i+n)/2,I=(l+c)/2,d=(g+f)/2;let C=s-A,B=n-e;const R=Math.abs((t-s)*B-(i-n)*C);if(R>Zh){if(R*R<=o*(C*C+B*B)){r.push(I,d);return}}else if(C=I-(A+s)/2,B=d-(e+n)/2,C*C+B*B<=o){r.push(I,d);return}Us(r,A,e,l,g,I,d,o,a+1),Us(r,I,d,c,f,s,n,o,a+1)}function tc(r,A){const e=1-r;return e*e*A}function Ac(r,A){return 2*(1-r)*r*A}function ic(r,A){return r*r*A}function da(r,A,e,t){return tc(r,A)+Ac(r,e)+ic(r,t)}const rc=1e-4,Ia=1e-4;function sc(r,A={}){const{vertices:e=[],indices:t=[],lineStyle:i={alignment:.5,cap:"butt",join:"miter",width:1,miterLimit:10},flipAlignment:s=!1,closed:n=!0}=A,o=rc;if(r.length===0)return{vertices:e,indices:t};const a=i;let l=a.alignment;if(i.alignment!==.5){let q=nc(r);s&&(q*=-1),l=(l-.5)*q+.5}const g={x:r[0],y:r[1]},c={x:r[r.length-2],y:r[r.length-1]},f=n,I=Math.abs(g.x-c.x)<o&&Math.abs(g.y-c.y)<o;if(f){r=r.slice(),I&&(r.pop(),r.pop(),c.x=r[r.length-2],c.y=r[r.length-1]);const q=(g.x+c.x)*.5,W=(c.y+g.y)*.5;r.unshift(q,W),r.push(q,W)}const d=e,C=r.length/2;let B=r.length;const R=d.length/2,S=a.width/2,_=S*S,M=a.miterLimit*a.miterLimit;let w=r[0],v=r[1],D=r[2],x=r[3],L=0,j=0,Y=-(v-x),T=w-D,$=0,P=0,X=Math.sqrt(Y*Y+T*T);Y/=X,T/=X,Y*=S,T*=S;const ee=l,J=(1-ee)*2,H=ee*2;f||(a.cap==="round"?B+=pA(w-Y*(J-H)*.5,v-T*(J-H)*.5,w-Y*J,v-T*J,w+Y*H,v+T*H,d,!0)+2:a.cap==="square"&&(B+=Ba(w,v,Y,T,J,H,!0,d))),d.push(w-Y*J,v-T*J),d.push(w+Y*H,v+T*H);for(let q=1;q<C-1;++q){w=r[(q-1)*2],v=r[(q-1)*2+1],D=r[q*2],x=r[q*2+1],L=r[(q+1)*2],j=r[(q+1)*2+1],Y=-(v-x),T=w-D,X=Math.sqrt(Y*Y+T*T),Y/=X,T/=X,Y*=S,T*=S,$=-(x-j),P=D-L,X=Math.sqrt($*$+P*P),$/=X,P/=X,$*=S,P*=S;const W=D-w,oe=v-x,te=D-L,ae=j-x,Ae=W*te+oe*ae,le=oe*te-ae*W,z=le<0;if(Math.abs(le)<.001*Math.abs(Ae)){d.push(D-Y*J,x-T*J),d.push(D+Y*H,x+T*H),Ae>=0&&(a.join==="round"?B+=pA(D,x,D-Y*J,x-T*J,D-$*J,x-P*J,d,!1)+4:B+=2,d.push(D-$*H,x-P*H),d.push(D+$*J,x+P*J));continue}const Ie=(-Y+w)*(-T+x)-(-Y+D)*(-T+v),nt=(-$+L)*(-P+x)-(-$+D)*(-P+j),ot=(W*nt-te*Ie)/le,Oe=(ae*Ie-oe*nt)/le,ge=(ot-D)*(ot-D)+(Oe-x)*(Oe-x),me=D+(ot-D)*J,He=x+(Oe-x)*J,Ve=D-(ot-D)*H,be=x-(Oe-x)*H,et=Math.min(W*W+oe*oe,te*te+ae*ae),Ft=z?J:H,Hr=et+Ft*Ft*_;ge<=Hr?a.join==="bevel"||ge/_>M?(z?(d.push(me,He),d.push(D+Y*H,x+T*H),d.push(me,He),d.push(D+$*H,x+P*H)):(d.push(D-Y*J,x-T*J),d.push(Ve,be),d.push(D-$*J,x-P*J),d.push(Ve,be)),B+=2):a.join==="round"?z?(d.push(me,He),d.push(D+Y*H,x+T*H),B+=pA(D,x,D+Y*H,x+T*H,D+$*H,x+P*H,d,!0)+4,d.push(me,He),d.push(D+$*H,x+P*H)):(d.push(D-Y*J,x-T*J),d.push(Ve,be),B+=pA(D,x,D-Y*J,x-T*J,D-$*J,x-P*J,d,!1)+4,d.push(D-$*J,x-P*J),d.push(Ve,be)):(d.push(me,He),d.push(Ve,be)):(d.push(D-Y*J,x-T*J),d.push(D+Y*H,x+T*H),a.join==="round"?z?B+=pA(D,x,D+Y*H,x+T*H,D+$*H,x+P*H,d,!0)+2:B+=pA(D,x,D-Y*J,x-T*J,D-$*J,x-P*J,d,!1)+2:a.join==="miter"&&ge/_<=M&&(z?(d.push(Ve,be),d.push(Ve,be)):(d.push(me,He),d.push(me,He)),B+=2),d.push(D-$*J,x-P*J),d.push(D+$*H,x+P*H),B+=2)}w=r[(C-2)*2],v=r[(C-2)*2+1],D=r[(C-1)*2],x=r[(C-1)*2+1],Y=-(v-x),T=w-D,X=Math.sqrt(Y*Y+T*T),Y/=X,T/=X,Y*=S,T*=S,d.push(D-Y*J,x-T*J),d.push(D+Y*H,x+T*H),f||(a.cap==="round"?B+=pA(D-Y*(J-H)*.5,x-T*(J-H)*.5,D-Y*J,x-T*J,D+Y*H,x+T*H,d,!1)+2:a.cap==="square"&&(B+=Ba(D,x,Y,T,J,H,!1,d)));const ne=Ia*Ia;for(let q=R;q<B+R-2;++q)w=d[q*2],v=d[q*2+1],D=d[(q+1)*2],x=d[(q+1)*2+1],L=d[(q+2)*2],j=d[(q+2)*2+1],!(Math.abs(w*(x-j)+D*(j-v)+L*(v-x))<ne)&&t.push(q,q+1,q+2);return{vertices:e,indices:t}}function nc(r){const A=r.length;if(A<6)return 1;let e=0;for(let t=0,i=r[A-2],s=r[A-1];t<A;t+=2){const n=r[t],o=r[t+1];e+=(n-i)*(o+s),i=n,s=o}return e<0?-1:1}function Ba(r,A,e,t,i,s,n,o){const a=r-e*i,l=A-t*i,g=r+e*s,c=A+t*s;let f,I;n?(f=t,I=-e):(f=-t,I=e);const d=a+f,C=l+I,B=g+f,R=c+I;return o.push(d,C),o.push(B,R),2}function pA(r,A,e,t,i,s,n,o){const a=e-r,l=t-A;let g=Math.atan2(a,l),c=Math.atan2(i-r,s-A);o&&g<c?g+=Math.PI*2:!o&&g>c&&(c+=Math.PI*2);let f=g;const I=c-g,d=Math.abs(I),C=Math.sqrt(a*a+l*l),B=(15*d*Math.sqrt(C)/Math.PI>>0)+1,R=I/B;if(f+=R,o){n.push(r,A),n.push(e,t);for(let S=1,_=f;S<B;S++,_+=R)n.push(r,A),n.push(r+Math.sin(_)*C,A+Math.cos(_)*C);n.push(r,A),n.push(i,s)}else{n.push(e,t),n.push(r,A);for(let S=1,_=f;S<B;S++,_+=R)n.push(r+Math.sin(_)*C,A+Math.cos(_)*C),n.push(r,A);n.push(i,s),n.push(r,A)}return B*2}class TA{constructor(){h(this,"arcLengthDivision",200);h(this,"_arcLengths")}getPointAt(A,e=new G){return this.getPoint(this.getUToTMapping(A),e)}isClockwise(){const A=this.getPoint(1),e=this.getPoint(.5),t=this.getPoint(1);return(e.x-A.x)*(t.y-e.y)-(e.y-A.y)*(t.x-e.x)<0}getControlPointRefs(){return[]}applyTransform(A){return this.getControlPointRefs().forEach(e=>{e.applyMatrix3(A)}),this}getUnevenPointArray(A=5,e=[]){const t=new G;for(let i=0,s=Math.max(1,A)-1;i<=s;i++)this.getPoint(i/s,t),e.push(t.x,t.y);return e}getSpacedPointArray(A=5,e=[]){const t=new G;for(let i=0,s=Math.max(1,A)-1;i<=s;i++)this.getPointAt(i/s,t),e.push(t.x,t.y);return e}getAdaptivePointArray(A=[]){return this.getUnevenPointArray(5,A)}_pointArrayToPoint(A,e=[]){for(let t=0,i=A.length;t<i;t+=2){const s=A[t],n=A[t+1];e.push(new G(s,n))}return e}getSpacedPoints(A,e=[]){const t=this.getSpacedPointArray(A);return this._pointArrayToPoint(t,e),e}getUnevenPoints(A,e=[]){const t=this.getUnevenPointArray(A);return this._pointArrayToPoint(t,e),e}getAdaptivePoints(A=[]){const e=this.getAdaptivePointArray();return this._pointArrayToPoint(e,A),A}getPoints(A,e=[]){let t;return A?t=this.getUnevenPointArray(A):t=this.getAdaptivePointArray(),this._pointArrayToPoint(t,e),e}getLength(){const A=this.getLengths();return A[A.length-1]}getLengths(){return(!this._arcLengths||this._arcLengths.length!==this.arcLengthDivision+1)&&this.updateLengths(),this._arcLengths}updateLengths(){const A=this.arcLengthDivision,e=[0];for(let t=0,i=this.getPoint(0),s=1;s<=A;s++){const n=this.getPoint(s/A);t+=n.distanceTo(i),e.push(t),i=n}this._arcLengths=e}getUToTMapping(A,e){const t=this.getLengths(),i=t.length,s=e??A*t[i-1];if(i<2)return s/t[0];let n=0,o=0,a=i-1,l;for(;o<=a;)if(n=Math.floor(o+(a-o)/2),l=t[n]-s,l<0)o=n+1;else if(l>0)a=n-1;else{a=n;break}if(n=a,t[n]===s)return n/(i-1);const g=t[n],f=t[n+1]-g,I=(s-g)/f;return(n+I)/(i-1)}getTangent(A,e=new G){const i=Math.max(0,A-1e-4),s=Math.min(1,A+1e-4);return e.copy(this.getPoint(s).sub(this.getPoint(i)).normalize())}getTangentAt(A,e){return this.getTangent(this.getUToTMapping(A),e)}getNormal(A,e=new G){return this.getTangent(A,e),e.set(-e.y,e.x).normalize()}getNormalAt(A,e){return this.getNormal(this.getUToTMapping(A),e)}getTForPoint(A,e=.001){let t=0,i=1,s=(t+i)/2;for(;i-t>e;){s=(t+i)/2;const n=this.getPoint(s);if(n.distanceTo(A)<e)return s;n.x<A.x?t=s:i=s}return s}getMinMax(A=G.MAX,e=G.MIN){const t=this.getPoints();for(let i=0,s=t.length;i<s;i++){const n=t[i];A.min(n),e.max(n)}return{min:A,max:e}}getBoundingBox(){const{min:A,max:e}=this.getMinMax();return new ce(A.x,A.y,e.x-A.x,e.y-A.y)}fillTriangulate(A){return Vh(this.getAdaptivePointArray(),A)}strokeTriangulate(A){return sc(this.getAdaptivePointArray(),A)}toCommands(){const A=[],e=this.getPoints();for(let t=0,i=e.length;t<i;t++){const s=e[t];t===0?A.push({type:"M",x:s.x,y:s.y}):A.push({type:"L",x:s.x,y:s.y})}return A}toData(){return Oh(this.toCommands())}drawTo(A){return this.toCommands().forEach(e=>{switch(e.type){case"M":A.moveTo(e.x,e.y);break;case"L":A.lineTo(e.x,e.y);break}}),this}copy(A){return this.arcLengthDivision=A.arcLengthDivision,this}clone(){return new this.constructor().copy(this)}}const oc=new at,Ea=new at,pa=new at,rr=new G;class ks extends TA{constructor(A=new G,e=new G,t=new G,i=0,s=0,n=Math.PI*2,o=!1){super(),this._center=A,this._radius=e,this._diff=t,this.rotate=i,this.startAngle=s,this.endAngle=n,this.clockwise=o}get cx(){return this._center.x}set cx(A){this._center.x=A}get cy(){return this._center.y}set cy(A){this._center.y=A}get rx(){return this._radius.x}set rx(A){this._radius.x=A}get ry(){return this._radius.y}set ry(A){this._radius.y=A}get dx(){return this._diff.x}set dx(A){this._diff.x=A}get dy(){return this._diff.y}set dy(A){this._diff.y=A}isClockwise(){return this.clockwise}getPoint(A,e=new G){const t=Math.PI*2;let i=this.endAngle-this.startAngle;const s=Math.abs(i)<Number.EPSILON;for(;i<0;)i+=t;for(;i>t;)i-=t;i<Number.EPSILON&&(s?i=0:i=t),this.clockwise&&!s&&(i===t?i=-t:i=i-t);const n=this.startAngle+A*i;let o=this.cx+this.rx*Math.cos(n),a=this.cy+this.ry*Math.sin(n);if(this.rotate!==0){const l=Math.cos(this.rotate),g=Math.sin(this.rotate),c=o-this.cx,f=a-this.cy;o=c*l-f*g+this.cx,a=c*g+f*l+this.cy}return e.set(o,a)}toCommands(){const{cx:A,cy:e,rx:t,ry:i,startAngle:s,endAngle:n,clockwise:o,rotate:a}=this,l=A+t*Math.cos(s)*Math.cos(a)-i*Math.sin(s)*Math.sin(a),g=e+t*Math.cos(s)*Math.sin(a)+i*Math.sin(s)*Math.cos(a),c=Math.abs(s-n),f=c>Math.PI?1:0,I=o?1:0,d=a*180/Math.PI;if(c>=2*Math.PI){const C=s+Math.PI,B=A+t*Math.cos(C)*Math.cos(a)-i*Math.sin(C)*Math.sin(a),R=e+t*Math.cos(C)*Math.sin(a)+i*Math.sin(C)*Math.cos(a);return[{type:"M",x:l,y:g},{type:"A",rx:t,ry:i,angle:d,largeArcFlag:0,sweepFlag:I,x:B,y:R},{type:"A",rx:t,ry:i,angle:d,largeArcFlag:0,sweepFlag:I,x:l,y:g}]}else{const C=A+t*Math.cos(n)*Math.cos(a)-i*Math.sin(n)*Math.sin(a),B=e+t*Math.cos(n)*Math.sin(a)+i*Math.sin(n)*Math.cos(a);return[{type:"M",x:l,y:g},{type:"A",rx:t,ry:i,angle:d,largeArcFlag:f,sweepFlag:I,x:C,y:B}]}}drawTo(A){const{cx:e,cy:t,rx:i,ry:s,rotate:n,startAngle:o,endAngle:a,clockwise:l}=this;return A.ellipse(e,t,i,s,n,o,a,!l),this}applyTransform(A){return rr.set(this.cx,this.cy),rr.applyMatrix3(A),this.cx=rr.x,this.cy=rr.y,gc(A)?ac(this,A):lc(this,A),this}getControlPointRefs(){return[this._center]}getAdaptivePointArray(A=[]){const{cx:e,cy:t,rx:i,ry:s,dx:n,dy:o}=this;if(!(i>=0&&s>=0&&n>=0&&o>=0))return A;const a=Math.ceil(2.3*Math.sqrt(i+s)),l=a*8+(n?4:0)+(o?4:0);if(l===0)return A;const g=[];if(a===0)g[0]=g[6]=e+n,g[1]=g[3]=t+o,g[2]=g[4]=e-n,g[5]=g[7]=t-o;else{let c=0,f=a*4+(n?2:0)+2,I=f,d=l,C=n+i,B=o,R=e+C,S=e-C,_=t+B;if(g[c++]=R,g[c++]=_,g[--f]=_,g[--f]=S,o){const w=t-B;g[I++]=S,g[I++]=w,g[--d]=w,g[--d]=R}for(let w=1;w<a;w++){const v=Math.PI/2*(w/a),D=n+Math.cos(v)*i,x=o+Math.sin(v)*s,L=e+D,j=e-D,Y=t+x,T=t-x;g[c++]=L,g[c++]=Y,g[--f]=Y,g[--f]=j,g[I++]=j,g[I++]=T,g[--d]=T,g[--d]=L}C=n,B=o+s,R=e+C,S=e-C,_=t+B;const M=t-B;g[c++]=R,g[c++]=_,g[--d]=M,g[--d]=R,n&&(g[c++]=S,g[c++]=_,g[--d]=M,g[--d]=S)}return Array.prototype.push.apply(A,g),A}fillTriangulate(A={}){let{vertices:e=[],indices:t=[],verticesStride:i=2,verticesOffset:s=0,indicesOffset:n=0}=A;const o=this.getAdaptivePointArray();if(o.length===0)return{vertices:e,indices:t};let a=0,l=0;for(let f=0;f<o.length;f+=2)a+=o[f],l+=o[f+1];a/=o.length/2,l/=o.length/2;let g=s;e[g*i]=a,e[g*i+1]=l;const c=g++;for(let f=0;f<o.length;f+=2)e[g*i]=o[f],e[g*i+1]=o[f+1],f>0&&(t[n++]=g,t[n++]=c,t[n++]=g-1),g++;return t[n++]=c+1,t[n++]=c,t[n++]=g-1,{vertices:e,indices:t}}getMinMax(A=G.MAX,e=G.MIN){const{cx:t,cy:i,rx:s,ry:n,rotate:o}=this,a=Math.cos(o),l=Math.sin(o),g=Math.sqrt(s*s*a*a+n*n*l*l),c=Math.sqrt(s*s*l*l+n*n*a*a);return A.x=Math.min(A.x,t-g),A.y=Math.min(A.y,i-c),e.x=Math.max(e.x,t+g),e.y=Math.max(e.y,i+c),{min:A,max:e}}copy(A){return super.copy(A),this.cx=A.cx,this.cy=A.cy,this.rx=A.rx,this.ry=A.ry,this.dx=A.dx,this.dy=A.dy,this.startAngle=A.startAngle,this.endAngle=A.endAngle,this.clockwise=A.clockwise,this.rotate=A.rotate,this}}function ac(r,A){const e=r.rx,t=r.ry,i=Math.cos(r.rotate),s=Math.sin(r.rotate),n=new G(e*i,e*s),o=new G(-t*s,t*i),a=n.applyMatrix3(A),l=o.applyMatrix3(A),g=oc.set(a.x,l.x,0,a.y,l.y,0,0,0,1),c=Ea.copy(g).invert(),d=pa.copy(c).transpose().multiply(c).elements,C=hc(d[0],d[1],d[4]),B=Math.sqrt(C.rt1),R=Math.sqrt(C.rt2);if(r.rx=1/B,r.ry=1/R,r.rotate=Math.atan2(C.sn,C.cs),!((r.endAngle-r.startAngle)%(2*Math.PI)<Number.EPSILON)){const _=Ea.set(B,0,0,0,R,0,0,0,1),M=pa.set(C.cs,C.sn,0,-C.sn,C.cs,0,0,0,1),w=_.multiply(M).multiply(g),v=D=>{const{x,y:L}=new G(Math.cos(D),Math.sin(D)).applyMatrix3(w);return Math.atan2(L,x)};r.startAngle=v(r.startAngle),r.endAngle=v(r.endAngle),Ca(A)&&(r.clockwise=!r.clockwise)}}function lc(r,A){const e=Qa(A),t=ya(A);r.rx*=e,r.ry*=t;const i=e>Number.EPSILON?Math.atan2(A.elements[1],A.elements[0]):Math.atan2(-A.elements[3],A.elements[4]);r.rotate+=i,Ca(A)&&(r.startAngle*=-1,r.endAngle*=-1,r.clockwise=!r.clockwise)}function Ca(r){const A=r.elements;return A[0]*A[4]-A[1]*A[3]<0}function gc(r){const A=r.elements,e=A[0]*A[3]+A[1]*A[4];if(e===0)return!1;const t=Qa(r),i=ya(r);return Math.abs(e/(t*i))>Number.EPSILON}function Qa(r){const A=r.elements;return Math.sqrt(A[0]*A[0]+A[1]*A[1])}function ya(r){const A=r.elements;return Math.sqrt(A[3]*A[3]+A[4]*A[4])}function hc(r,A,e){let t,i,s,n,o;const a=r+e,l=r-e,g=Math.sqrt(l*l+4*A*A);return a>0?(t=.5*(a+g),o=1/t,i=r*o*e-A*o*A):a<0?i=.5*(a-g):(t=.5*g,i=-.5*g),l>0?s=l+g:s=l-g,Math.abs(s)>2*Math.abs(A)?(o=-2*A/s,n=1/Math.sqrt(1+o*o),s=o*n):Math.abs(A)===0?(s=1,n=0):(o=-.5*s/A,s=1/Math.sqrt(1+o*o),n=o*s),l>0&&(o=s,s=-n,n=o),{rt1:t,rt2:i,cs:s,sn:n}}class cc extends ks{constructor(A=0,e=0,t=1,i=0,s=Math.PI*2,n=!1){super(new G(A,e),new G(t,t),new G(0,0),0,i,s,n)}drawTo(A){const{cx:e,cy:t,rx:i,startAngle:s,endAngle:n,clockwise:o}=this;return A.arc(e,t,i,s,n,!o),this}getAdaptivePointArray(A=[]){const{cx:e,cy:t,rx:i,startAngle:s,endAngle:n,clockwise:o}=this;let a=Math.abs(s-n);(!o&&s>n||o&&n>s)&&(a=2*Math.PI-a);let l=Math.max(6,Math.floor(6*i**(1/3)*(a/Math.PI)));l=Math.max(l,3);let g=a/l,c=s;g*=o?1:-1;for(let f=0;f<l+1;f++){const I=Math.cos(c),d=Math.sin(c),C=e+I*i,B=t+d*i;A.push(C,B),c+=g}return A}}class pi extends TA{constructor(A=[]){super(),this.curves=A}getFlatCurves(){return this.curves.flatMap(A=>A instanceof pi?A.getFlatCurves():A)}addCurve(A){return this.curves.push(A),this}getPoint(A,e=new G){const t=A*this.getLength(),i=this.getLengths();let s=0;for(;s<i.length;){if(i[s]>=t){const n=i[s]-t,o=this.curves[s],a=o.getLength();return o.getPointAt(a===0?0:1-n/a,e)}s++}return e}updateLengths(){const A=[];for(let e=0,t=0,i=this.curves.length;e<i;e++)t+=this.curves[e].getLength(),A.push(t);this._arcLengths=A}getControlPointRefs(){return this.curves.flatMap(A=>A.getControlPointRefs())}getAdaptivePointArray(A=[]){let e;return this.curves.forEach(t=>{t.getAdaptivePointArray(A),e&&A[e-1]===A[e+1]&&A[e]===A[e+2]&&A.splice(e+1,2),e=A.length-1}),A}applyTransform(A){return this.curves.forEach(e=>e.applyTransform(A)),this}getMinMax(A=G.MAX,e=G.MIN){return this.curves.forEach(t=>t.getMinMax(A,e)),{min:A,max:e}}getBoundingBox(){const{min:A,max:e}=this.getMinMax();return new ce(A.x,A.y,e.x-A.x,e.y-A.y)}toCommands(){return this.curves.flatMap(A=>A.toCommands())}drawTo(A){var t;const e=(t=this.curves[0])==null?void 0:t.getPoint(0);return e&&A.moveTo(e.x,e.y),this.curves.forEach(i=>i.drawTo(A)),this}copy(A){return super.copy(A),this.curves=A.curves.map(e=>e.clone()),this}}class Ps extends TA{constructor(A=new G,e=new G,t=new G,i=new G){super(),this.p1=A,this.cp1=e,this.cp2=t,this.p2=i}static from(A,e,t,i,s,n,o,a){return new Ps(new G(A,e),new G(t,i),new G(s,n),new G(o,a))}getPoint(A,e=new G){const{p1:t,cp1:i,cp2:s,p2:n}=this;return e.set(fa(A,t.x,i.x,s.x,n.x),fa(A,t.y,i.y,s.y,n.y))}getAdaptivePointArray(A=[]){return Xh(this.p1.x,this.p1.y,this.cp1.x,this.cp1.y,this.cp2.x,this.cp2.y,this.p2.x,this.p2.y,.5,A)}getControlPointRefs(){return[this.p1,this.cp1,this.cp2,this.p2]}_solveQuadratic(A,e,t){const i=e*e-4*A*t;if(i<0)return[];const s=Math.sqrt(i),n=(-e+s)/(2*A),o=(-e-s)/(2*A);return[n,o].filter(a=>a>=0&&a<=1)}getMinMax(A=G.MAX,e=G.MIN){const{p1:t,cp1:i,cp2:s,p2:n}=this,o=this._solveQuadratic(3*(i.x-t.x),6*(s.x-i.x),3*(n.x-s.x)),a=this._solveQuadratic(3*(i.y-t.y),6*(s.y-i.y),3*(n.y-s.y)),l=[0,1,...o,...a];return((c,f)=>{for(const I of c)for(let d=0;d<=f;d++){const C=d/f-.5,B=Math.min(1,Math.max(0,I+C)),R=this.getPoint(B);A.x=Math.min(A.x,R.x),A.y=Math.min(A.y,R.y),e.x=Math.max(e.x,R.x),e.y=Math.max(e.y,R.y)}})(l,10),{min:A,max:e}}toCommands(){const{p1:A,cp1:e,cp2:t,p2:i}=this;return[{type:"M",x:A.x,y:A.y},{type:"C",x1:e.x,y1:e.y,x2:t.x,y2:t.y,x:i.x,y:i.y}]}drawTo(A){const{p1:e,cp1:t,cp2:i,p2:s}=this;return A.lineTo(e.x,e.y),A.bezierCurveTo(t.x,t.y,i.x,i.y,s.x,s.y),this}copy(A){return super.copy(A),this.p1.copy(A.p1),this.cp1.copy(A.cp1),this.cp2.copy(A.cp2),this.p2.copy(A.p2),this}}class uc extends ks{constructor(A=0,e=0,t=1,i=1,s=0,n=0,o=Math.PI*2,a=!1){super(new G(A,e),new G(t,i),new G,s,n,o,a)}drawTo(A){return A.ellipse(this.cx,this.cy,this.rx,this.ry,this.rotate,this.startAngle,this.endAngle,!this.clockwise),this}}class tA extends TA{constructor(A=new G,e=new G){super(),this.p1=A,this.p2=e}static from(A,e,t,i){return new tA(new G(A,e),new G(t,i))}getPoint(A,e=new G){return A===1?e.copy(this.p2):e.copy(this.p2).sub(this.p1).scale(A).add(this.p1),e}getPointAt(A,e=new G){return this.getPoint(A,e)}getTangent(A,e=new G){return e.subVectors(this.p2,this.p1).normalize()}getTangentAt(A,e=new G){return this.getTangent(A,e)}getControlPointRefs(){return[this.p1,this.p2]}getAdaptivePointArray(A=[]){return A.push(this.p1.x,this.p1.y,this.p2.x,this.p2.y),A}getMinMax(A=G.MAX,e=G.MIN){const{p1:t,p2:i}=this;return A.x=Math.min(A.x,t.x,i.x),A.y=Math.min(A.y,t.y,i.y),e.x=Math.max(e.x,t.x,i.x),e.y=Math.max(e.y,t.y,i.y),{min:A,max:e}}toCommands(){const{p1:A,p2:e}=this;return[{type:"M",x:A.x,y:A.y},{type:"L",x:e.x,y:e.y}]}drawTo(A){const{p1:e,p2:t}=this;return A.lineTo(e.x,e.y),A.lineTo(t.x,t.y),this}copy(A){return super.copy(A),this.p1.copy(A.p1),this.p2.copy(A.p2),this}}class fc extends pi{}class Ns extends TA{constructor(A=new G,e=new G,t=new G){super(),this.p1=A,this.cp=e,this.p2=t}static from(A,e,t,i,s,n){return new Ns(new G(A,e),new G(t,i),new G(s,n))}getPoint(A,e=new G){const{p1:t,cp:i,p2:s}=this;return e.set(da(A,t.x,i.x,s.x),da(A,t.y,i.y,s.y)),e}getControlPointRefs(){return[this.p1,this.cp,this.p2]}getAdaptivePointArray(A=[]){return ec(this.p1.x,this.p1.y,this.cp.x,this.cp.y,this.p2.x,this.p2.y,.5,A)}getMinMax(A=G.MAX,e=G.MIN){const{p1:t,cp:i,p2:s}=this,n=.5*(t.x+i.x),o=.5*(t.y+i.y),a=.5*(t.x+s.x),l=.5*(t.y+s.y);return A.x=Math.min(A.x,t.x,s.x,n,a),A.y=Math.min(A.y,t.y,s.y,o,l),e.x=Math.max(e.x,t.x,s.x,n,a),e.y=Math.max(e.y,t.y,s.y,o,l),{min:A,max:e}}toCommands(){const{p1:A,cp:e,p2:t}=this;return[{type:"M",x:A.x,y:A.y},{type:"Q",x1:e.x,y1:e.y,x:t.x,y:t.y}]}drawTo(A){const{p1:e,cp:t,p2:i}=this;return A.lineTo(e.x,e.y),A.quadraticCurveTo(t.x,t.y,i.x,i.y),this}copy(A){return super.copy(A),this.p1.copy(A.p1),this.cp.copy(A.cp),this.p2.copy(A.p2),this}}class dc extends fc{constructor(A=0,e=0,t=0,i=0){super(),this.x=A,this.y=e,this.width=t,this.height=i,this.update()}update(){const{x:A,y:e,width:t,height:i}=this,s=[new G(A,e),new G(A+t,e),new G(A+t,e+i),new G(A,e+i)];return this.curves=[new tA(s[0],s[1]),new tA(s[1],s[2]),new tA(s[2],s[3]),new tA(s[3],s[0])],this}drawTo(A){return A.rect(this.x,this.y,this.width,this.height),this}fillTriangulate(A={}){let{vertices:e=[],indices:t=[],verticesStride:i=2,verticesOffset:s=0,indicesOffset:n=0}=A;const{x:o,y:a,width:l,height:g}=this,c=[o,a,o+l,a,o+l,a+g,o,a+g];let f=0;s*=i,e[s+f]=c[0],e[s+f+1]=c[1],f+=i,e[s+f]=c[2],e[s+f+1]=c[3],f+=i,e[s+f]=c[6],e[s+f+1]=c[7],f+=i,e[s+f]=c[4],e[s+f+1]=c[5],f+=i;const I=s/i;return t[n++]=I,t[n++]=I+1,t[n++]=I+2,t[n++]=I+1,t[n++]=I+3,t[n++]=I+2,{vertices:e,indices:t}}copy(A){return super.copy(A),this.x=A.x,this.y=A.y,this.width=A.width,this.height=A.height,this.update(),this}}class Ic extends ks{constructor(A=0,e=0,t=1,i=1,s=1){super(),this.x=A,this.y=e,this.width=t,this.height=i,this.radius=s,this.update()}update(){const{x:A,y:e,width:t,height:i,radius:s}=this,n=t/2,o=i/2,a=A+n,l=e+o,g=Math.max(0,Math.min(s,Math.min(n,o))),c=g,f=n-g,I=o-c;return this._center=new G(a,l),this._radius=new G(g,c),this._diff=new G(f,I),this}drawTo(A){const{x:e,y:t,width:i,height:s,radius:n}=this;return A.roundRect(e,t,i,s,n),this}copy(A){return super.copy(A),this.x=A.x,this.y=A.y,this.width=A.width,this.height=A.height,this.radius=A.radius,this.update(),this}}class Bc extends TA{constructor(A=[]){super(),this.points=A}getPoint(A,e=new G){const{points:t}=this,i=(t.length-1)*A,s=Math.floor(i),n=i-s,o=t[s===0?s:s-1],a=t[s],l=t[s>t.length-2?t.length-1:s+1],g=t[s>t.length-3?t.length-1:s+2];return e.set(ua(n,o.x,a.x,l.x,g.x),ua(n,o.y,a.y,l.y,g.y)),e}getControlPointRefs(){return this.points}copy(A){super.copy(A),this.points=[];for(let e=0,t=A.points.length;e<t;e++)this.points.push(A.points[e].clone());return this}}class sr extends pi{constructor(e){super();h(this,"startPoint");h(this,"currentPoint");h(this,"autoClose",!1);e&&this.addPoints(e)}addPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,i=e.length;t<i;t++){const{x:s,y:n}=e[t];this.lineTo(s,n)}return this}addCommands(e){return ha(e,this),this}addData(e){return this.addCommands(ca(e)),this}getUnevenPointArray(e=40,t=[]){return super.getUnevenPointArray(e,t),this.autoClose&&t.length>=4&&t[0]!==t[t.length-2]&&t[1]!==t[t.length-1]&&t.push(t[0],t[1]),t}getSpacedPointArray(e=40,t=[]){return super.getSpacedPointArray(e,t),this.autoClose&&t.length>=4&&t[0]!==t[t.length-2]&&t[1]!==t[t.length-1]&&t.push(t[0],t[1]),t}_setCurrentPoint(e){return this.currentPoint=new G(e.x,e.y),this.startPoint||(this.startPoint=this.currentPoint.clone()),this}_connetLineTo(e){if(this.curves.length>0){const t=e.getPoint(0);(!this.currentPoint||!t.equals(this.currentPoint))&&this.lineTo(t.x,t.y)}return this}closePath(){const e=this.startPoint;if(e){const t=this.currentPoint;t&&!e.equals(t)&&(this.curves.push(new tA(t,e)),t.copy(e)),this.startPoint=void 0}return this}moveTo(e,t){return this.currentPoint=new G(e,t),this.startPoint=this.currentPoint.clone(),this}lineTo(e,t){const i=this.currentPoint;return i!=null&&i.equals({x:e,y:t})||this.curves.push(tA.from((i==null?void 0:i.x)??0,(i==null?void 0:i.y)??0,e,t)),this._setCurrentPoint({x:e,y:t}),this}bezierCurveTo(e,t,i,s,n,o){const a=this.currentPoint;return a!=null&&a.equals({x:n,y:o})||this.curves.push(Ps.from((a==null?void 0:a.x)??0,(a==null?void 0:a.y)??0,e,t,i,s,n,o)),this._setCurrentPoint({x:n,y:o}),this}quadraticCurveTo(e,t,i,s){const n=this.currentPoint;return n!=null&&n.equals({x:i,y:s})||this.curves.push(Ns.from((n==null?void 0:n.x)??0,(n==null?void 0:n.y)??0,e,t,i,s)),this._setCurrentPoint({x:i,y:s}),this}arc(e,t,i,s,n,o){const a=new cc(e,t,i,s,n,!o);return this._connetLineTo(a),this.curves.push(a),this._setCurrentPoint(a.getPoint(1)),this}relativeArc(e,t,i,s,n,o){var a,l;return e+=((a=this.currentPoint)==null?void 0:a.x)??0,t+=((l=this.currentPoint)==null?void 0:l.y)??0,this.arc(e,t,i,s,n,o),this}arcTo(e,t,i,s,n){return console.warn("Method arcTo not supported yet"),this}ellipse(e,t,i,s,n,o,a,l=!0){const g=new uc(e,t,i,s,n,o,a,!l);return this._connetLineTo(g),this.curves.push(g),this._setCurrentPoint(g.getPoint(1)),this}relativeEllipse(e,t,i,s,n,o,a,l){var g,c;return e+=((g=this.currentPoint)==null?void 0:g.x)??0,t+=((c=this.currentPoint)==null?void 0:c.y)??0,this.ellipse(e,t,i,s,n,o,a,l),this}rect(e,t,i,s){const n=new dc(e,t,i,s);return this._connetLineTo(n),this.curves.push(n),this._setCurrentPoint({x:e,y:t}),this}roundRect(e,t,i,s,n){const o=new Ic(e,t,i,s,n);return this._connetLineTo(o),this.curves.push(o),this._setCurrentPoint({x:e,y:t}),this}splineThru(e){const t=this.currentPoint??new G;return this.curves.push(new Bc([t].concat(e))),this._setCurrentPoint(e[e.length-1]),this}drawTo(e){var i;const t=(i=this.curves[0])==null?void 0:i.getPoint(0);return t&&e.moveTo(t.x,t.y),this.curves.forEach(s=>s.drawTo(e)),this.autoClose&&e.closePath(),this}copy(e){var t;return super.copy(e),this.autoClose=e.autoClose,this.currentPoint=(t=e.currentPoint)==null?void 0:t.clone(),this}}function Ec(r){return r.replace(/[^a-z0-9]/gi,"-").replace(/\B([A-Z])/g,"-$1").toLowerCase()}function pc(r,A,e,t){const i=A.clone().sub(r),s=t.clone().sub(e),n=e.clone().sub(r),o=i.cross(s);if(o===0)return new G((r.x+e.x)/2,(r.y+e.y)/2);const a=n.cross(s)/o;return Math.abs(a)>1?new G((r.x+e.x)/2,(r.y+e.y)/2):new G(r.x+a*i.x,r.y+a*i.y)}class Je extends pi{constructor(e,t={}){super();h(this,"currentCurve",new sr);h(this,"style");this.curves.push(this.currentCurve),this.style=t,e&&(e instanceof Je?this.addPath(e):Array.isArray(e)?this.addCommands(e):this.addData(e))}get startPoint(){return this.currentCurve.startPoint}get currentPoint(){return this.currentCurve.currentPoint}get strokeWidth(){return this.style.strokeWidth??((this.style.stroke??"none")==="none"?0:1)}addPath(e){const t=this.curves.findIndex(i=>i===this.currentCurve);return t>-1&&this.curves.splice(t,1),e instanceof Je?this.curves.push(...e.curves.filter(i=>i.curves.length).map(i=>i.clone())):e.curves.length&&this.curves.push(e),this.curves.push(this.currentCurve),this}closePath(){const e=this.startPoint;return e&&(this.currentCurve.closePath(),this.currentCurve.curves.length&&(this.currentCurve=new sr().moveTo(e.x,e.y),this.curves.push(this.currentCurve))),this}moveTo(e,t){var i;return(i=this.currentCurve.currentPoint)!=null&&i.equals({x:e,y:t})||(this.currentCurve.curves.length&&(this.currentCurve=new sr,this.curves.push(this.currentCurve)),this.currentCurve.moveTo(e,t)),this}lineTo(e,t){return this.currentCurve.lineTo(e,t),this}bezierCurveTo(e,t,i,s,n,o){return this.currentCurve.bezierCurveTo(e,t,i,s,n,o),this}quadraticCurveTo(e,t,i,s){return this.currentCurve.quadraticCurveTo(e,t,i,s),this}arc(e,t,i,s,n,o){return this.currentCurve.arc(e,t,i,s,n,o),this}arcTo(e,t,i,s,n){return this.currentCurve.arcTo(e,t,i,s,n),this}ellipse(e,t,i,s,n,o,a,l){return this.currentCurve.ellipse(e,t,i,s,n,o,a,l),this}rect(e,t,i,s){return this.currentCurve.rect(e,t,i,s),this}roundRect(e,t,i,s,n){return this.currentCurve.roundRect(e,t,i,s,n),this}reset(){return this.currentCurve=new sr,this.curves=[this.currentCurve],this.style={},this}addCommands(e){return ha(e,this),this}addData(e){return this.addCommands(ca(e)),this}splineThru(e){return this.currentCurve.splineThru(e),this}scale(e,t=e,i={x:0,y:0}){return this.getControlPointRefs().forEach(s=>{s.scale(e,t,i)}),this}skew(e,t=0,i={x:0,y:0}){return this.getControlPointRefs().forEach(s=>{s.skew(e,t,i)}),this}rotate(e,t={x:0,y:0}){return this.getControlPointRefs().forEach(i=>{i.rotate(e,t)}),this}bold(e){if(e===0)return this;const t=this.getFlatCurves(),i=[],s=[],n=[];t.forEach((a,l)=>{const g=a.getControlPointRefs(),c=a.isClockwise();n[l]=g,s[l]=c;const f=g[0],I=g[g.length-1]??f;i.push({start:c?I:f,end:c?f:I,index:l})});const o=[];return i.forEach((a,l)=>{o[l]=[],i.forEach((g,c)=>{var f;g.start&&a.end&&c!==l&&((f=g.start)!=null&&f.equals(a.end))&&o[l].push(g.index)})}),t.forEach((a,l)=>{const g=s[l];n[l].forEach(c=>{c.add(a.getNormal(a.getTForPoint(c)).scale(g?e:-e))})}),o.forEach((a,l)=>{const g=n[l];a.forEach(c=>{const f=n[c],I=pc(g[g.length-1],g[g.length-2]??g[g.length-1],f[0],f[1]??f[0]);I&&(g[g.length-1].copy(I),f[0].copy(I))})}),this}getMinMax(e=G.MAX,t=G.MIN,i=!0){const s=this.strokeWidth;return this.curves.forEach(n=>{if(n.getMinMax(e,t),i&&s>1){const o=s/2,a=n.isClockwise(),l=[];for(let g=0;g<=1;g+=1/n.arcLengthDivision){const c=n.getPoint(g),f=n.getNormal(g),I=f.clone().scale(a?o:-o),d=f.clone().scale(a?-o:o);l.push(c.clone().add(I),c.clone().add(d),c.clone().add({x:o,y:0}),c.clone().add({x:-o,y:0}),c.clone().add({x:0,y:o}),c.clone().add({x:0,y:-o}),c.clone().add({x:o,y:o}),c.clone().add({x:-o,y:-o}))}e.min(...l),t.max(...l)}}),{min:e,max:t}}getBoundingBox(e=!0){const{min:t,max:i}=this.getMinMax(void 0,void 0,e);return new ce(t.x,t.y,i.x-t.x,i.y-t.y)}drawTo(e,t={}){t={...this.style,...t};const{fill:i="#000",stroke:s="none"}=t;return e.beginPath(),e.save(),Ss(e,t),this.curves.forEach(n=>{n.drawTo(e)}),i!=="none"&&e.fill(),s!=="none"&&e.stroke(),e.restore(),this}drawControlPointsTo(e,t={}){t={...this.style,...t};const{fill:i="#000",stroke:s="none"}=t;return e.beginPath(),e.save(),Ss(e,t),this.getControlPointRefs().forEach(n=>{Th(e,n.x,n.y,{radius:4})}),i!=="none"&&e.fill(),s!=="none"&&e.stroke(),e.restore(),this}toCommands(){return this.curves.flatMap(e=>e.toCommands())}toData(){return this.curves.filter(e=>e.curves.length).map(e=>e.toData()).join(" ")}toSVGPathString(){const e={...this.style,fill:this.style.fill??"#000",stroke:this.style.stroke??"none"},t={};for(const s in e)e[s]!==void 0&&(t[Ec(s)]=e[s]);Object.assign(t,{"stroke-width":`${this.strokeWidth}px`});let i="";for(const s in t)t[s]!==void 0&&(i+=`${s}:${t[s]};`);return`<path d="${this.toData()}" style="${i}"></path>`}copy(e){return super.copy(e),this.currentCurve=e.currentCurve.clone(),this.style={...e.style},this}}class Fs{constructor(A=[]){this.paths=A}getBoundingBox(A=!0){if(!this.paths.length)return;const e=G.MAX,t=G.MIN;return this.paths.forEach(i=>i.getMinMax(e,t,A)),new ce(e.x,e.y,t.x-e.x,t.y-e.y)}toSVGString(){const{x:A,y:e,width:t,height:i}=this.getBoundingBox(),s=this.paths.map(n=>n.toSVGPathString()).join("");return`<svg viewBox="${A} ${e} ${t} ${i}" width="${t}px" height="${i}px" xmlns="http://www.w3.org/2000/svg">${s}</svg>`}toSVGUrl(){return`data:image/svg+xml;base64,${btoa(this.toSVGString())}`}toSVG(){return new DOMParser().parseFromString(this.toSVGString(),"image/svg+xml").documentElement}toCanvas(A={}){const{pixelRatio:e=2,...t}=A,{left:i,top:s,width:n,height:o}=this.getBoundingBox(),a=document.createElement("canvas");a.width=n*e,a.height=o*e,a.style.width=`${n}px`,a.style.height=`${o}px`;const l=a.getContext("2d");return l&&(l.scale(e,e),l.translate(-i,-s),this.paths.forEach(g=>{g.drawTo(l,t)})),a}}const ma="data:image/svg+xml;",wa=`${ma}base64,`,va=`${ma}charset=utf8,`;function _a(r){if(typeof r=="string"){let A;r.startsWith(wa)?(r=r.substring(wa.length,r.length),A=atob(r)):r.startsWith(va)?(r=r.substring(va.length,r.length),A=decodeURIComponent(r)):A=r;const e=new DOMParser().parseFromString(A,"text/xml"),t=e.querySelector("parsererror");if(t)throw new Error(`${t.textContent??"parser error"}
671
- ${A}`);return e.documentElement}else return r}const Cc="px",Qc=90,Da=["mm","cm","in","pt","pc","px"],ba={mm:{mm:1,cm:.1,in:1/25.4,pt:72/25.4,pc:6/25.4,px:-1},cm:{mm:10,cm:1,in:1/2.54,pt:72/2.54,pc:6/2.54,px:-1},in:{mm:25.4,cm:2.54,in:1,pt:72,pc:6,px:-1},pt:{mm:25.4/72,cm:2.54/72,in:1/72,pt:1,pc:6/72,px:-1},pc:{mm:25.4/6,cm:2.54/6,in:1/6,pt:72/6,pc:1,px:-1},px:{px:1}};function Be(r){let A="px";if(typeof r=="string"||r instanceof String)for(let t=0,i=Da.length;t<i;t++){const s=Da[t];if(r.endsWith(s)){A=s,r=r.substring(0,r.length-s.length);break}}let e;return e=ba[A][Cc],e<0&&(e=ba[A].in*Qc),e*Number.parseFloat(r)}const yc=new at,nr=new at,xa=new at,Sa=new at;function mc(r,A,e){if(!(r.hasAttribute("transform")||r.nodeName==="use"&&(r.hasAttribute("x")||r.hasAttribute("y"))))return null;const t=wc(r);return e.length>0&&t.premultiply(e[e.length-1]),A.copy(t),e.push(t),t}function wc(r){const A=new at,e=yc;if(r.nodeName==="use"&&(r.hasAttribute("x")||r.hasAttribute("y"))&&A.translate(Be(r.getAttribute("x")),Be(r.getAttribute("y"))),r.hasAttribute("transform")){const t=r.getAttribute("transform").split(")");for(let i=t.length-1;i>=0;i--){const s=t[i].trim();if(s==="")continue;const n=s.indexOf("("),o=s.length;if(n>0&&n<o){const a=s.slice(0,n),l=Mt(s.slice(n+1));switch(e.identity(),a){case"translate":if(l.length>=1){const g=l[0];let c=0;l.length>=2&&(c=l[1]),e.translate(g,c)}break;case"rotate":if(l.length>=1){let g=0,c=0,f=0;g=l[0]*Math.PI/180,l.length>=3&&(c=l[1],f=l[2]),nr.makeTranslation(-c,-f),xa.makeRotation(g),Sa.multiplyMatrices(xa,nr),nr.makeTranslation(c,f),e.multiplyMatrices(nr,Sa)}break;case"scale":l.length>=1&&e.scale(l[0],l[1]??l[0]);break;case"skewX":l.length===1&&e.set(1,Math.tan(l[0]*Math.PI/180),0,0,1,0,0,0,1);break;case"skewY":l.length===1&&e.set(1,0,0,Math.tan(l[0]*Math.PI/180),1,0,0,0,1);break;case"matrix":l.length===6&&e.set(l[0],l[2],l[4],l[1],l[3],l[5],0,0,1);break}}A.premultiply(e)}}return A}function vc(r){return new Je().arc(Be(r.getAttribute("cx")||0),Be(r.getAttribute("cy")||0),Be(r.getAttribute("r")||0),0,Math.PI*2)}function _c(r,A){if(!(!r.sheet||!r.sheet.cssRules||!r.sheet.cssRules.length))for(let e=0;e<r.sheet.cssRules.length;e++){const t=r.sheet.cssRules[e];if(t.type!==1)continue;const i=t.selectorText.split(/,/g).filter(Boolean).map(n=>n.trim()),s={};for(let n=t.style.length,o=0;o<n;o++){const a=t.style.item(o);s[a]=t.style.getPropertyValue(a)}for(let n=0;n<i.length;n++)A[i[n]]=Object.assign(A[i[n]]||{},{...s})}}function Dc(r){return new Je().ellipse(Be(r.getAttribute("cx")||0),Be(r.getAttribute("cy")||0),Be(r.getAttribute("rx")||0),Be(r.getAttribute("ry")||0),0,0,Math.PI*2)}function bc(r){return new Je().moveTo(Be(r.getAttribute("x1")||0),Be(r.getAttribute("y1")||0)).lineTo(Be(r.getAttribute("x2")||0),Be(r.getAttribute("y2")||0))}function xc(r){const A=new Je,e=r.getAttribute("d");return!e||e==="none"?null:(A.addData(e),A)}const Sc=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function Mc(r){var t;const A=new Je;let e=0;return(t=r.getAttribute("points"))==null||t.replace(Sc,(i,s,n)=>{const o=Be(s),a=Be(n);return e===0?A.moveTo(o,a):A.lineTo(o,a),e++,i}),A.currentCurve.autoClose=!0,A}const Rc=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function Uc(r){var t;const A=new Je;let e=0;return(t=r.getAttribute("points"))==null||t.replace(Rc,(i,s,n)=>{const o=Be(s),a=Be(n);return e===0?A.moveTo(o,a):A.lineTo(o,a),e++,i}),A.currentCurve.autoClose=!1,A}function kc(r){const A=Be(r.getAttribute("x")||0),e=Be(r.getAttribute("y")||0),t=Be(r.getAttribute("rx")||r.getAttribute("ry")||0),i=Be(r.getAttribute("ry")||r.getAttribute("rx")||0),s=Be(r.getAttribute("width")),n=Be(r.getAttribute("height")),o=1-.551915024494,a=new Je;return a.moveTo(A+t,e),a.lineTo(A+s-t,e),(t!==0||i!==0)&&a.bezierCurveTo(A+s-t*o,e,A+s,e+i*o,A+s,e+i),a.lineTo(A+s,e+n-i),(t!==0||i!==0)&&a.bezierCurveTo(A+s,e+n-i*o,A+s-t*o,e+n,A+s-t,e+n),a.lineTo(A+t,e+n),(t!==0||i!==0)&&a.bezierCurveTo(A+t*o,e+n,A,e+n-i*o,A,e+n-i),a.lineTo(A,e+i),(t!==0||i!==0)&&a.bezierCurveTo(A,e+i*o,A+t*o,e,A+t,e),a}function Rt(r,A,e){A=Object.assign({},A);let t={};if(r.hasAttribute("class")){const l=r.getAttribute("class").split(/\s/).filter(Boolean).map(g=>g.trim());for(let g=0;g<l.length;g++)t=Object.assign(t,e[`.${l[g]}`])}r.hasAttribute("id")&&(t=Object.assign(t,e[`#${r.getAttribute("id")}`]));for(let l=r.style.length,g=0;g<l;g++){const c=r.style.item(g),f=r.style.getPropertyValue(c);A[c]=f,t[c]=f}function i(l,g,c=s){r.hasAttribute(l)&&(A[g]=c(r.getAttribute(l))),t[l]&&(A[g]=c(t[l]))}function s(l){return l.startsWith("url")&&console.warn("url access in attributes is not implemented."),l}function n(l){return Math.max(0,Math.min(1,Be(l)))}function o(l){return Math.max(0,Be(l))}function a(l){return l.split(" ").filter(g=>g!=="").map(g=>Be(g))}return i("fill","fill"),i("fill-opacity","fillOpacity",n),i("fill-rule","fillRule"),i("opacity","opacity",n),i("stroke","stroke"),i("stroke-opacity","strokeOpacity",n),i("stroke-width","strokeWidth",o),i("stroke-linecap","strokeLinecap"),i("stroke-linejoin","strokeLinejoin"),i("stroke-miterlimit","strokeMiterlimit",o),i("stroke-dasharray","strokeDasharray",a),i("stroke-dashoffset","strokeDashoffset",Be),i("visibility","visibility"),A}function Ts(r,A,e=[],t={}){var c;if(r.nodeType!==1)return e;let i=!1,s=null,n={...A};switch(r.nodeName){case"svg":n=Rt(r,n,t);break;case"style":_c(r,t);break;case"g":n=Rt(r,n,t);break;case"path":n=Rt(r,n,t),r.hasAttribute("d")&&(s=xc(r));break;case"rect":n=Rt(r,n,t),s=kc(r);break;case"polygon":n=Rt(r,n,t),s=Mc(r);break;case"polyline":n=Rt(r,n,t),s=Uc(r);break;case"circle":n=Rt(r,n,t),s=vc(r);break;case"ellipse":n=Rt(r,n,t),s=Dc(r);break;case"line":n=Rt(r,n,t),s=bc(r);break;case"defs":i=!0;break;case"use":{n=Rt(r,n,t);const I=(r.getAttributeNS("http://www.w3.org/1999/xlink","href")||r.getAttribute("href")||"").substring(1),d=(c=r.viewportElement)==null?void 0:c.getElementById(I);d?Ts(d,n,e,t):console.warn(`'use node' references non-existent node id: ${I}`);break}default:console.warn(r);break}if(n.display==="none")return e;const o=new at,a=[],l=mc(r,o,a);s&&(s.applyTransform(o),e.push(s),s.style={...n});const g=r.childNodes;for(let f=0,I=g.length;f<I;f++){const d=g[f];i&&d.nodeName!=="style"&&d.nodeName!=="defs"||Ts(d,n,e,t)}return l&&(a.pop(),a.length>0?o.copy(a[a.length-1]):o.identity()),e}function Ma(r){return new Fs(Ts(_a(r),{}))}class Ra extends Je{constructor(){super(...arguments);h(this,"textureTransform");h(this,"fillStyle");h(this,"strokeStyle");h(this,"lineCap");h(this,"lineJoin");h(this,"lineWidth");h(this,"miterLimit");h(this,"_defaultStyle",ve.EMPTY);h(this,"_draws",[])}stroke(){let e=this._defaultStyle;this.strokeStyle&&(this.strokeStyle instanceof ve?e=this.strokeStyle:e=new ps(this.strokeStyle)),this.curves.length&&(this._draws.push({type:"stroke",path:new Je(this),texture:e,textureTransform:this.textureTransform,style:{alignment:.5,cap:this.lineCap??"butt",join:this.lineJoin??"miter",width:this.lineWidth??1,miterLimit:this.miterLimit??10}}),super.reset())}fillRect(e,t,i,s){this.rect(e,t,i,s).fill()}strokeRect(e,t,i,s){this.rect(e,t,i,s).stroke()}fill(){let e=this._defaultStyle;this.fillStyle&&(this.fillStyle instanceof ve?e=this.fillStyle:e=new ps(this.fillStyle)),this._draws.push({type:"fill",path:new Je(this),texture:e,textureTransform:this.textureTransform}),super.reset()}copy(e){return super.copy(e),this.strokeStyle=e.strokeStyle,this.fillStyle=e.fillStyle,this.textureTransform=e.textureTransform,this.lineCap=e.lineCap,this.lineJoin=e.lineJoin,this.lineWidth=e.lineWidth,this.miterLimit=e.miterLimit,this._draws=e._draws.slice(),this}reset(){return super.reset(),this.strokeStyle=void 0,this.fillStyle=void 0,this.textureTransform=void 0,this.lineCap=void 0,this.lineJoin=void 0,this.lineWidth=void 0,this.miterLimit=void 0,this._draws.length=0,this}buildUvs(e,t,i,s,n){if(s){const o=s.width,a=s.height;for(let l=t.length,g=e;g<l;g+=2){const c=t[g],f=t[g+1];let I,d;n?[I,d]=n==null?void 0:n.applyToPoint(c,f):[I,d]=[c/o,f/a],i.push(I,d)}}else for(let o=t.length,a=e;a<o;a+=2)i.push(0,0)}toBatchables(){const e=[];let t=[],i=[],s=[],n;const o=l=>{e.push({type:l,vertices:t,indices:i,uvs:s,texture:n}),t=[],i=[],s=[],n=void 0};for(let l=this._draws.length,g=0;g<l;g++){const c=this._draws[g],f=this._draws[g-1];t.length&&f&&(f==null?void 0:f.type)!==c.type&&o(f.type);const I=n;I||(n=c.texture),t.length&&I!==c.texture&&!(I!=null&&I.is(c.texture))&&o(c.type);const d=t.length;c.type==="fill"?(c.path.fillTriangulate({vertices:t,indices:i}),this.buildUvs(d,t,s,c.texture,c.textureTransform)):(c.path.strokeTriangulate({vertices:t,indices:i,lineStyle:c.style,flipAlignment:!1,closed:!0}),this.buildUvs(d,t,s,c.texture,c.textureTransform))}const a=this._draws[this._draws.length-1];return a&&t.length&&o(a.type),e}}var Pc=Object.defineProperty,Nc=Object.getOwnPropertyDescriptor,Ci=(r,A,e,t)=>{for(var i=t>1?void 0:t?Nc(A,e):A,s=r.length-1,n;s>=0;s--)(n=r[s])&&(i=(t?n(A,e,i):n(i))||i);return t&&i&&Pc(A,e,i),i};u.CanvasItem=class extends u.TimelineNode{constructor(e,t=[]){super();h(this,"_parentGlobalVisible");h(this,"_globalVisible");h(this,"_parentGlobalOpacity");h(this,"_globalOpacity");h(this,"_modulate",new $t(4294967295));h(this,"_backgroundImage");h(this,"context",new Ra);h(this,"_resetContext",!0);h(this,"_redrawing",!1);h(this,"_relayouting",!1);h(this,"_repainting",!1);h(this,"_originalBatchables",[]);h(this,"_layoutedBatchables",[]);h(this,"_batchables",[]);this.setProperties(e).append(t)}get globalVisible(){return this._globalVisible??!0}get globalOpacity(){return this._globalOpacity??1}_updateProperty(e,t,i,s){switch(super._updateProperty(e,t,i,s),e){case"modulate":this._modulate.value=t,this.requestRepaint();break;case"blendMode":this.requestRepaint();break;case"opacity":this._updateGlobalOpacity();break;case"visible":case"insideTimeRange":this._updateGlobalVisible();break}}show(){this.visible=!0}hide(){this.visible=!1}isVisibleInTree(){return this.globalOpacity>0&&this.globalVisible}canRender(){return super.canRender()&&this.isVisibleInTree()}requestRedraw(){this._redrawing=!0,this.requestUpdate()}requestRelayout(){this._relayouting=!0,this.requestUpdate()}requestRepaint(){this._repainting=!0,this.requestUpdate()}_updateGlobalVisible(){var e;this._parentGlobalVisible=(e=this.getParent())==null?void 0:e.globalVisible,this._globalVisible=(this._parentGlobalVisible??!0)&&this.visible&&this.insideTimeRange}_updateGlobalOpacity(){var t;this._parentGlobalOpacity=(t=this.getParent())==null?void 0:t.opacity;const e=bt(0,this.opacity,1)*(this._parentGlobalOpacity??1);this._globalOpacity!==e&&(this._globalOpacity=e,this.requestRepaint())}_draw(){this.emit("draw")}_redraw(){var e;return(e=this._tree)==null||e.log(this.name,"redrawing"),this._draw(),this.context.toBatchables()}_relayout(e){var t;return(t=this._tree)==null||t.log(this.name,"relayouting"),e}_repaint(e){var t;return(t=this._tree)==null||t.log(this.name,"repainting"),e.map(i=>({...i,modulate:this._modulate.toArgb(this.globalOpacity,!0),blendMode:this.blendMode}))}_process(e){super._process(e);const t=this.getParent();this._parentGlobalVisible!==(t==null?void 0:t.globalVisible)&&this.requestUpdate(),this._parentGlobalOpacity!==(t==null?void 0:t.globalOpacity)&&this.requestUpdate()}_update(){const e=this.getParent();this._parentGlobalVisible!==(e==null?void 0:e.globalVisible)&&this._updateGlobalVisible(),this._parentGlobalOpacity!==(e==null?void 0:e.globalOpacity)&&this._updateGlobalOpacity();const t=this._redrawing;let i=this._relayouting,s=this._repainting,n;t&&(this._originalBatchables=this._redraw(),i=!0),i&&(this._layoutedBatchables=this._relayout(this._originalBatchables),s=!0),s&&(n=this._repaint(this._layoutedBatchables)),t&&this._resetContext&&this.context.reset(),n&&(this._batchables=n,this._redrawing=!1,this._relayouting=!1,this._repainting=!1)}_render(e){this._batchables.forEach(t=>{var i,s;(i=t.texture)==null||i.upload(e),e.batch2D.render({...t,texture:(s=t.texture)==null?void 0:s._glTexture(e)})}),super._render(e)}},Ci([k()],u.CanvasItem.prototype,"modulate",2),Ci([k()],u.CanvasItem.prototype,"blendMode",2),Ci([Ee({default:!0})],u.CanvasItem.prototype,"visible",2),Ci([Ee({default:1})],u.CanvasItem.prototype,"opacity",2),u.CanvasItem=Ci([re("CanvasItem")],u.CanvasItem);class Fc{constructor(){h(this,"currentCall");h(this,"calls",[])}createCall(A){return{renderable:A,parentCall:this.currentCall,fn:A.render.bind(A),calls:[]}}push(A){var t;const e=this.createCall(A);return(((t=this.currentCall)==null?void 0:t.calls)??this.calls).push(e),e}render(A){this.calls.forEach(function e(t){t.fn(A,()=>{t.calls.forEach(e)})}),this.calls=[]}}var Tc=Object.defineProperty,Lc=Object.getOwnPropertyDescriptor,Qi=(r,A,e,t)=>{for(var i=t>1?void 0:t?Lc(A,e):A,s=r.length-1,n;s>=0;s--)(n=r[s])&&(i=(t?n(A,e,i):n(i))||i);return t&&i&&Tc(A,e,i),i};u.Timeline=class extends u.Node{static from(A,e=!1){const[t,i]=A?Array.isArray(A)?A:[0,A]:[];return new u.Timeline({startTime:t,endTime:i,loop:e})}constructor(A){super(),this.setProperties(A)}_updateProperty(A,e,t){switch(super._updateProperty(A,e,t),A){case"startTime":this.startTime=Math.min(e,this.endTime);break;case"endTime":this.endTime=e||Number.MAX_SAFE_INTEGER;break}}addTime(A){const e=this.startTime,t=this.endTime;let i=this.currentTime;return i=i+A,this.loop&&i>t&&(i=e+i%t),i=bt(e,i,t),this.currentTime=i,this.emit("updateCurrentTime",i,A),this}_process(A){super._process(A),this.addTime(A)}},Qi([k({default:0})],u.Timeline.prototype,"startTime",2),Qi([k({default:0})],u.Timeline.prototype,"currentTime",2),Qi([k({default:Number.MAX_SAFE_INTEGER})],u.Timeline.prototype,"endTime",2),Qi([k({default:!1})],u.Timeline.prototype,"loop",2),u.Timeline=Qi([re("Timeline")],u.Timeline);var Gc=Object.defineProperty,Ls=(r,A,e,t)=>{for(var i=void 0,s=r.length-1,n;s>=0;s--)(n=r[s])&&(i=n(A,e,i)||i);return i&&Gc(A,e,i),i};class yi extends ji{constructor(e=new u.Timeline){super();h(this,"input",new Ao);h(this,"renderStack",new Fc);h(this,"root",new u.Viewport(!0).setTree(this));h(this,"timeline");h(this,"_backgroundColor",new $t);h(this,"_currentViewport");this.timeline=e.setTree(this)}getCurrentViewport(){return this._currentViewport}setCurrentViewport(e){this._currentViewport=e}_updateProperty(e,t,i,s){switch(super._updateProperty(e,t,i,s),e){case"backgroundColor":this._backgroundColor.value=t;break}}log(...e){this.debug&&console.log("[modern-canvas]",...e)}_process(e=0){this.timeline.emit("process",e),this.emit("processing"),this.root.emit("process",e),this.emit("processed")}_render(e){e.program.uniforms.projectionMatrix=this.root.toProjectionArray(!0),this.renderStack.render(e),this._renderScreen(e)}_renderScreen(e){e.state.reset();const{pixelRatio:t}=e,{width:i,height:s}=this.root;e.framebuffer.bind(null),e.viewport.bind({x:0,y:0,width:i*t,height:s*t}),this.backgroundColor&&e.gl.clearColor(...this._backgroundColor.toArray()),e.clear(),this.backgroundColor&&e.gl.clearColor(0,0,0,0);const n=this.root.texture;n.activate(e,0),fe.draw(e),e.texture.unbind(n)}free(){super.free(),this.root.getChildren(!0).forEach(e=>this.root.removeChild(e)),this.input.removeEventListeners()}}Ls([k({default:!1})],yi.prototype,"processPaused"),Ls([k()],yi.prototype,"backgroundColor"),Ls([Ee({default:!1})],yi.prototype,"debug");var Oc=Object.getOwnPropertyDescriptor,Hc=(r,A,e,t)=>{for(var i=t>1?void 0:t?Oc(A,e):A,s=r.length-1,n;s>=0;s--)(n=r[s])&&(i=n(i)||i);return i};u.Transition=class extends u.Effect{constructor(A,e=[]){super(),this.setProperties(A).append(e)}},u.Transition=Hc([re("Transition",{effectMode:"transition",processMode:"pausable",duration:2e3})],u.Transition);var Jc=Object.defineProperty,Kc=Object.getOwnPropertyDescriptor,Yc=(r,A,e)=>A in r?Jc(r,A,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[A]=e,Wc=(r,A,e,t)=>{for(var i=t>1?void 0:t?Kc(A,e):A,s=r.length-1,n;s>=0;s--)(n=r[s])&&(i=n(i)||i);return i},Vc=(r,A,e)=>Yc(r,A+"",e);u.ShadowEffect=class extends u.Effect{constructor(){super(...arguments);h(this,"blur",new u.BlurEffect);h(this,"viewport3",new u.Viewport)}apply(e,t){this.viewport3.activateWithCopy(e,t),this.viewport3.redraw(e,()=>{fe.draw(e,u.ShadowEffect.material,{sampler:0,offset:[.001,.001],color:[0,0,0],alpha:.5})}),this.blur.apply(e,this.viewport3),t.redraw(e,()=>{this.viewport3.texture.activate(e,1),fe.draw(e,UA.instance,{sampler:1}),fe.draw(e,UA.instance,{sampler:0}),e.texture.unbind(1)})}},Vc(u.ShadowEffect,"material",new Qe({vert:`precision mediump float;
671
+ ${A}`);return e.documentElement}else return r}const Cc="px",Qc=90,Da=["mm","cm","in","pt","pc","px"],ba={mm:{mm:1,cm:.1,in:1/25.4,pt:72/25.4,pc:6/25.4,px:-1},cm:{mm:10,cm:1,in:1/2.54,pt:72/2.54,pc:6/2.54,px:-1},in:{mm:25.4,cm:2.54,in:1,pt:72,pc:6,px:-1},pt:{mm:25.4/72,cm:2.54/72,in:1/72,pt:1,pc:6/72,px:-1},pc:{mm:25.4/6,cm:2.54/6,in:1/6,pt:72/6,pc:1,px:-1},px:{px:1}};function Be(r){let A="px";if(typeof r=="string"||r instanceof String)for(let t=0,i=Da.length;t<i;t++){const s=Da[t];if(r.endsWith(s)){A=s,r=r.substring(0,r.length-s.length);break}}let e;return e=ba[A][Cc],e<0&&(e=ba[A].in*Qc),e*Number.parseFloat(r)}const yc=new at,nr=new at,xa=new at,Sa=new at;function mc(r,A,e){if(!(r.hasAttribute("transform")||r.nodeName==="use"&&(r.hasAttribute("x")||r.hasAttribute("y"))))return null;const t=wc(r);return e.length>0&&t.premultiply(e[e.length-1]),A.copy(t),e.push(t),t}function wc(r){const A=new at,e=yc;if(r.nodeName==="use"&&(r.hasAttribute("x")||r.hasAttribute("y"))&&A.translate(Be(r.getAttribute("x")),Be(r.getAttribute("y"))),r.hasAttribute("transform")){const t=r.getAttribute("transform").split(")");for(let i=t.length-1;i>=0;i--){const s=t[i].trim();if(s==="")continue;const n=s.indexOf("("),o=s.length;if(n>0&&n<o){const a=s.slice(0,n),l=Mt(s.slice(n+1));switch(e.identity(),a){case"translate":if(l.length>=1){const g=l[0];let c=0;l.length>=2&&(c=l[1]),e.translate(g,c)}break;case"rotate":if(l.length>=1){let g=0,c=0,f=0;g=l[0]*Math.PI/180,l.length>=3&&(c=l[1],f=l[2]),nr.makeTranslation(-c,-f),xa.makeRotation(g),Sa.multiplyMatrices(xa,nr),nr.makeTranslation(c,f),e.multiplyMatrices(nr,Sa)}break;case"scale":l.length>=1&&e.scale(l[0],l[1]??l[0]);break;case"skewX":l.length===1&&e.set(1,Math.tan(l[0]*Math.PI/180),0,0,1,0,0,0,1);break;case"skewY":l.length===1&&e.set(1,0,0,Math.tan(l[0]*Math.PI/180),1,0,0,0,1);break;case"matrix":l.length===6&&e.set(l[0],l[2],l[4],l[1],l[3],l[5],0,0,1);break}}A.premultiply(e)}}return A}function vc(r){return new Je().arc(Be(r.getAttribute("cx")||0),Be(r.getAttribute("cy")||0),Be(r.getAttribute("r")||0),0,Math.PI*2)}function _c(r,A){if(!(!r.sheet||!r.sheet.cssRules||!r.sheet.cssRules.length))for(let e=0;e<r.sheet.cssRules.length;e++){const t=r.sheet.cssRules[e];if(t.type!==1)continue;const i=t.selectorText.split(/,/g).filter(Boolean).map(n=>n.trim()),s={};for(let n=t.style.length,o=0;o<n;o++){const a=t.style.item(o);s[a]=t.style.getPropertyValue(a)}for(let n=0;n<i.length;n++)A[i[n]]=Object.assign(A[i[n]]||{},{...s})}}function Dc(r){return new Je().ellipse(Be(r.getAttribute("cx")||0),Be(r.getAttribute("cy")||0),Be(r.getAttribute("rx")||0),Be(r.getAttribute("ry")||0),0,0,Math.PI*2)}function bc(r){return new Je().moveTo(Be(r.getAttribute("x1")||0),Be(r.getAttribute("y1")||0)).lineTo(Be(r.getAttribute("x2")||0),Be(r.getAttribute("y2")||0))}function xc(r){const A=new Je,e=r.getAttribute("d");return!e||e==="none"?null:(A.addData(e),A)}const Sc=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function Mc(r){var t;const A=new Je;let e=0;return(t=r.getAttribute("points"))==null||t.replace(Sc,(i,s,n)=>{const o=Be(s),a=Be(n);return e===0?A.moveTo(o,a):A.lineTo(o,a),e++,i}),A.currentCurve.autoClose=!0,A}const Rc=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function Uc(r){var t;const A=new Je;let e=0;return(t=r.getAttribute("points"))==null||t.replace(Rc,(i,s,n)=>{const o=Be(s),a=Be(n);return e===0?A.moveTo(o,a):A.lineTo(o,a),e++,i}),A.currentCurve.autoClose=!1,A}function kc(r){const A=Be(r.getAttribute("x")||0),e=Be(r.getAttribute("y")||0),t=Be(r.getAttribute("rx")||r.getAttribute("ry")||0),i=Be(r.getAttribute("ry")||r.getAttribute("rx")||0),s=Be(r.getAttribute("width")),n=Be(r.getAttribute("height")),o=1-.551915024494,a=new Je;return a.moveTo(A+t,e),a.lineTo(A+s-t,e),(t!==0||i!==0)&&a.bezierCurveTo(A+s-t*o,e,A+s,e+i*o,A+s,e+i),a.lineTo(A+s,e+n-i),(t!==0||i!==0)&&a.bezierCurveTo(A+s,e+n-i*o,A+s-t*o,e+n,A+s-t,e+n),a.lineTo(A+t,e+n),(t!==0||i!==0)&&a.bezierCurveTo(A+t*o,e+n,A,e+n-i*o,A,e+n-i),a.lineTo(A,e+i),(t!==0||i!==0)&&a.bezierCurveTo(A,e+i*o,A+t*o,e,A+t,e),a}function Rt(r,A,e){A=Object.assign({},A);let t={};if(r.hasAttribute("class")){const l=r.getAttribute("class").split(/\s/).filter(Boolean).map(g=>g.trim());for(let g=0;g<l.length;g++)t=Object.assign(t,e[`.${l[g]}`])}r.hasAttribute("id")&&(t=Object.assign(t,e[`#${r.getAttribute("id")}`]));for(let l=r.style.length,g=0;g<l;g++){const c=r.style.item(g),f=r.style.getPropertyValue(c);A[c]=f,t[c]=f}function i(l,g,c=s){r.hasAttribute(l)&&(A[g]=c(r.getAttribute(l))),t[l]&&(A[g]=c(t[l]))}function s(l){return l.startsWith("url")&&console.warn("url access in attributes is not implemented."),l}function n(l){return Math.max(0,Math.min(1,Be(l)))}function o(l){return Math.max(0,Be(l))}function a(l){return l.split(" ").filter(g=>g!=="").map(g=>Be(g))}return i("fill","fill"),i("fill-opacity","fillOpacity",n),i("fill-rule","fillRule"),i("opacity","opacity",n),i("stroke","stroke"),i("stroke-opacity","strokeOpacity",n),i("stroke-width","strokeWidth",o),i("stroke-linecap","strokeLinecap"),i("stroke-linejoin","strokeLinejoin"),i("stroke-miterlimit","strokeMiterlimit",o),i("stroke-dasharray","strokeDasharray",a),i("stroke-dashoffset","strokeDashoffset",Be),i("visibility","visibility"),A}function Ts(r,A,e=[],t={}){var c;if(r.nodeType!==1)return e;let i=!1,s=null,n={...A};switch(r.nodeName){case"svg":n=Rt(r,n,t);break;case"style":_c(r,t);break;case"g":n=Rt(r,n,t);break;case"path":n=Rt(r,n,t),r.hasAttribute("d")&&(s=xc(r));break;case"rect":n=Rt(r,n,t),s=kc(r);break;case"polygon":n=Rt(r,n,t),s=Mc(r);break;case"polyline":n=Rt(r,n,t),s=Uc(r);break;case"circle":n=Rt(r,n,t),s=vc(r);break;case"ellipse":n=Rt(r,n,t),s=Dc(r);break;case"line":n=Rt(r,n,t),s=bc(r);break;case"defs":i=!0;break;case"use":{n=Rt(r,n,t);const I=(r.getAttributeNS("http://www.w3.org/1999/xlink","href")||r.getAttribute("href")||"").substring(1),d=(c=r.viewportElement)==null?void 0:c.getElementById(I);d?Ts(d,n,e,t):console.warn(`'use node' references non-existent node id: ${I}`);break}default:console.warn(r);break}if(n.display==="none")return e;const o=new at,a=[],l=mc(r,o,a);s&&(s.applyTransform(o),e.push(s),s.style={...n});const g=r.childNodes;for(let f=0,I=g.length;f<I;f++){const d=g[f];i&&d.nodeName!=="style"&&d.nodeName!=="defs"||Ts(d,n,e,t)}return l&&(a.pop(),a.length>0?o.copy(a[a.length-1]):o.identity()),e}function Ma(r){return new Fs(Ts(_a(r),{}))}class Ra extends Je{constructor(){super(...arguments);h(this,"textureTransform");h(this,"fillStyle");h(this,"strokeStyle");h(this,"lineCap");h(this,"lineJoin");h(this,"lineWidth");h(this,"miterLimit");h(this,"_defaultStyle",ve.EMPTY);h(this,"_draws",[])}stroke(){let e=this._defaultStyle;this.strokeStyle&&(this.strokeStyle instanceof ve?e=this.strokeStyle:e=new ps(this.strokeStyle)),this.curves.length&&(this._draws.push({type:"stroke",path:new Je(this),texture:e,textureTransform:this.textureTransform,style:{alignment:.5,cap:this.lineCap??"butt",join:this.lineJoin??"miter",width:this.lineWidth??1,miterLimit:this.miterLimit??10}}),super.reset())}fillRect(e,t,i,s){this.rect(e,t,i,s).fill()}strokeRect(e,t,i,s){this.rect(e,t,i,s).stroke()}fill(){let e=this._defaultStyle;this.fillStyle&&(this.fillStyle instanceof ve?e=this.fillStyle:e=new ps(this.fillStyle)),this._draws.push({type:"fill",path:new Je(this),texture:e,textureTransform:this.textureTransform}),super.reset()}copy(e){return super.copy(e),this.strokeStyle=e.strokeStyle,this.fillStyle=e.fillStyle,this.textureTransform=e.textureTransform,this.lineCap=e.lineCap,this.lineJoin=e.lineJoin,this.lineWidth=e.lineWidth,this.miterLimit=e.miterLimit,this._draws=e._draws.slice(),this}reset(){return super.reset(),this.strokeStyle=void 0,this.fillStyle=void 0,this.textureTransform=void 0,this.lineCap=void 0,this.lineJoin=void 0,this.lineWidth=void 0,this.miterLimit=void 0,this._draws.length=0,this}buildUvs(e,t,i,s,n){if(s){const o=s.width,a=s.height;for(let l=t.length,g=e;g<l;g+=2){const c=t[g],f=t[g+1];let I,d;n?[I,d]=n==null?void 0:n.applyToPoint(c,f):[I,d]=[c/o,f/a],i.push(I,d)}}else for(let o=t.length,a=e;a<o;a+=2)i.push(0,0)}toBatchables(){const e=[];let t=[],i=[],s=[],n;const o=l=>{e.push({type:l,vertices:t,indices:i,uvs:s,texture:n}),t=[],i=[],s=[],n=void 0};for(let l=this._draws.length,g=0;g<l;g++){const c=this._draws[g],f=this._draws[g-1];t.length&&f&&(f==null?void 0:f.type)!==c.type&&o(f.type);const I=n;I||(n=c.texture),t.length&&I!==c.texture&&!(I!=null&&I.is(c.texture))&&o(c.type);const d=t.length;c.type==="fill"?(c.path.fillTriangulate({vertices:t,indices:i}),this.buildUvs(d,t,s,c.texture,c.textureTransform)):(c.path.strokeTriangulate({vertices:t,indices:i,lineStyle:c.style,flipAlignment:!1,closed:!0}),this.buildUvs(d,t,s,c.texture,c.textureTransform))}const a=this._draws[this._draws.length-1];return a&&t.length&&o(a.type),e}}var Pc=Object.defineProperty,Nc=Object.getOwnPropertyDescriptor,Ci=(r,A,e,t)=>{for(var i=t>1?void 0:t?Nc(A,e):A,s=r.length-1,n;s>=0;s--)(n=r[s])&&(i=(t?n(A,e,i):n(i))||i);return t&&i&&Pc(A,e,i),i};u.CanvasItem=class extends u.TimelineNode{constructor(e,t=[]){super();h(this,"_parentGlobalVisible");h(this,"_globalVisible");h(this,"_parentGlobalOpacity");h(this,"_globalOpacity");h(this,"_modulate",new $t(4294967295));h(this,"_backgroundImage");h(this,"context",new Ra);h(this,"_resetContext",!0);h(this,"_redrawing",!1);h(this,"_relayouting",!1);h(this,"_repainting",!1);h(this,"_originalBatchables",[]);h(this,"_layoutedBatchables",[]);h(this,"_batchables",[]);this.setProperties(e).append(t)}get globalVisible(){return this._globalVisible??!0}get globalOpacity(){return this._globalOpacity??1}_updateProperty(e,t,i,s){switch(super._updateProperty(e,t,i,s),e){case"modulate":this._modulate.value=t,this.requestRepaint();break;case"blendMode":this.requestRepaint();break;case"opacity":this._updateGlobalOpacity();break;case"visible":case"insideTimeRange":this._updateGlobalVisible();break}}show(){this.visible=!0}hide(){this.visible=!1}isVisibleInTree(){return this.globalOpacity>0&&this.globalVisible}canRender(){return super.canRender()&&this.isVisibleInTree()}requestRedraw(){this._redrawing=!0,this.requestUpdate()}requestRelayout(){this._relayouting=!0,this.requestUpdate()}requestRepaint(){this._repainting=!0,this.requestUpdate()}_updateGlobalVisible(){var e;this._parentGlobalVisible=(e=this.getParent())==null?void 0:e.globalVisible,this._globalVisible=(this._parentGlobalVisible??!0)&&this.visible&&this.insideTimeRange}_updateGlobalOpacity(){var t;this._parentGlobalOpacity=(t=this.getParent())==null?void 0:t.opacity;const e=bt(0,this.opacity,1)*(this._parentGlobalOpacity??1);this._globalOpacity!==e&&(this._globalOpacity=e,this.requestRepaint())}_draw(){this.emit("draw")}_redraw(){var e;return(e=this._tree)==null||e.log(this.name,"redrawing"),this._draw(),this.context.toBatchables()}_relayout(e){var t;return(t=this._tree)==null||t.log(this.name,"relayouting"),e}_repaint(e){var t;return(t=this._tree)==null||t.log(this.name,"repainting"),e.map(i=>({...i,modulate:this._modulate.toArgb(this.globalOpacity,!0),blendMode:this.blendMode}))}_process(e){super._process(e);const t=this.getParent();this._parentGlobalVisible!==(t==null?void 0:t.globalVisible)&&this.requestUpdate(),this._parentGlobalOpacity!==(t==null?void 0:t.globalOpacity)&&this.requestUpdate()}_update(){const e=this.getParent();this._parentGlobalVisible!==(e==null?void 0:e.globalVisible)&&this._updateGlobalVisible(),this._parentGlobalOpacity!==(e==null?void 0:e.globalOpacity)&&this._updateGlobalOpacity();const t=this._redrawing;let i=this._relayouting,s=this._repainting,n;t&&(this._originalBatchables=this._redraw(),i=!0),i&&(this._layoutedBatchables=this._relayout(this._originalBatchables),s=!0),s&&(n=this._repaint(this._layoutedBatchables)),t&&this._resetContext&&this.context.reset(),n&&(this._batchables=n,this._redrawing=!1,this._relayouting=!1,this._repainting=!1)}_render(e){this._batchables.forEach(t=>{var i,s;(i=t.texture)==null||i.upload(e),e.batch2D.render({...t,texture:(s=t.texture)==null?void 0:s._glTexture(e)})}),super._render(e)}},Ci([k()],u.CanvasItem.prototype,"modulate",2),Ci([k()],u.CanvasItem.prototype,"blendMode",2),Ci([Ee({default:!0})],u.CanvasItem.prototype,"visible",2),Ci([Ee({default:1})],u.CanvasItem.prototype,"opacity",2),u.CanvasItem=Ci([re("CanvasItem")],u.CanvasItem);class Fc{constructor(){h(this,"currentCall");h(this,"calls",[])}createCall(A){return{renderable:A,parentCall:this.currentCall,fn:A.render.bind(A),calls:[]}}push(A){var t;const e=this.createCall(A);return(((t=this.currentCall)==null?void 0:t.calls)??this.calls).push(e),e}render(A){this.calls.forEach(function e(t){t.fn(A,()=>{t.calls.forEach(e)})}),this.calls=[]}}var Tc=Object.defineProperty,Lc=Object.getOwnPropertyDescriptor,Qi=(r,A,e,t)=>{for(var i=t>1?void 0:t?Lc(A,e):A,s=r.length-1,n;s>=0;s--)(n=r[s])&&(i=(t?n(A,e,i):n(i))||i);return t&&i&&Tc(A,e,i),i};u.Timeline=class extends u.Node{static from(A,e=!1){const[t,i]=A?Array.isArray(A)?A:[0,A]:[];return new u.Timeline({startTime:t,endTime:i,loop:e})}constructor(A){super(),this.setProperties(A)}_updateProperty(A,e,t){switch(super._updateProperty(A,e,t),A){case"startTime":this.startTime=Math.min(e,this.endTime);break;case"endTime":this.endTime=e||Number.MAX_SAFE_INTEGER;break}}addTime(A){const e=this.startTime,t=this.endTime;let i=this.currentTime;return i=i+A,this.loop&&i>t&&(i=e+i%t),i=bt(e,i,t),this.currentTime=i,this.emit("updateCurrentTime",i,A),this}_process(A){super._process(A),this.addTime(A)}},Qi([k({default:0})],u.Timeline.prototype,"startTime",2),Qi([k({default:0})],u.Timeline.prototype,"currentTime",2),Qi([k({default:Number.MAX_SAFE_INTEGER})],u.Timeline.prototype,"endTime",2),Qi([k({default:!1})],u.Timeline.prototype,"loop",2),u.Timeline=Qi([re("Timeline")],u.Timeline);var Gc=Object.defineProperty,Ls=(r,A,e,t)=>{for(var i=void 0,s=r.length-1,n;s>=0;s--)(n=r[s])&&(i=n(A,e,i)||i);return i&&Gc(A,e,i),i};class yi extends ji{constructor(e=new u.Timeline){super();h(this,"input",new Ao);h(this,"renderStack",new Fc);h(this,"root",new u.Viewport(!0).setTree(this));h(this,"timeline");h(this,"_backgroundColor",new $t);h(this,"_currentViewport");this.timeline=e.setTree(this)}getCurrentViewport(){return this._currentViewport}setCurrentViewport(e){this._currentViewport=e}_updateProperty(e,t,i,s){switch(super._updateProperty(e,t,i,s),e){case"backgroundColor":this._backgroundColor.value=t;break}}log(...e){this.debug&&console.log("[modern-canvas]",...e)}_process(e=0){this.timeline.emit("process",e),this.emit("processing"),this.root.emit("process",e),this.emit("processed")}_render(e){this.emit("rendering"),e.program.uniforms.projectionMatrix=this.root.toProjectionArray(!0),this.renderStack.render(e),this._renderScreen(e),this.emit("rendered")}_renderScreen(e){e.state.reset();const{pixelRatio:t}=e,{width:i,height:s}=this.root;e.framebuffer.bind(null),e.viewport.bind({x:0,y:0,width:i*t,height:s*t}),this.backgroundColor&&e.gl.clearColor(...this._backgroundColor.toArray()),e.clear(),this.backgroundColor&&e.gl.clearColor(0,0,0,0);const n=this.root.texture;n.activate(e,0),fe.draw(e),e.texture.unbind(n)}free(){super.free(),this.root.getChildren(!0).forEach(e=>this.root.removeChild(e)),this.input.removeEventListeners()}}Ls([k({default:!1})],yi.prototype,"processPaused"),Ls([k()],yi.prototype,"backgroundColor"),Ls([Ee({default:!1})],yi.prototype,"debug");var Oc=Object.getOwnPropertyDescriptor,Hc=(r,A,e,t)=>{for(var i=t>1?void 0:t?Oc(A,e):A,s=r.length-1,n;s>=0;s--)(n=r[s])&&(i=n(i)||i);return i};u.Transition=class extends u.Effect{constructor(A,e=[]){super(),this.setProperties(A).append(e)}},u.Transition=Hc([re("Transition",{effectMode:"transition",processMode:"pausable",duration:2e3})],u.Transition);var Jc=Object.defineProperty,Kc=Object.getOwnPropertyDescriptor,Yc=(r,A,e)=>A in r?Jc(r,A,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[A]=e,Wc=(r,A,e,t)=>{for(var i=t>1?void 0:t?Kc(A,e):A,s=r.length-1,n;s>=0;s--)(n=r[s])&&(i=n(i)||i);return i},Vc=(r,A,e)=>Yc(r,A+"",e);u.ShadowEffect=class extends u.Effect{constructor(){super(...arguments);h(this,"blur",new u.BlurEffect);h(this,"viewport3",new u.Viewport)}apply(e,t){this.viewport3.activateWithCopy(e,t),this.viewport3.redraw(e,()=>{fe.draw(e,u.ShadowEffect.material,{sampler:0,offset:[.001,.001],color:[0,0,0],alpha:.5})}),this.blur.apply(e,this.viewport3),t.redraw(e,()=>{this.viewport3.texture.activate(e,1),fe.draw(e,UA.instance,{sampler:1}),fe.draw(e,UA.instance,{sampler:0}),e.texture.unbind(1)})}},Vc(u.ShadowEffect,"material",new Qe({vert:`precision mediump float;
672
672
  attribute vec2 position;
673
673
  attribute vec2 uv;
674
674
  varying vec2 vUv;
package/dist/index.mjs CHANGED
@@ -8351,9 +8351,11 @@ class SceneTree extends MainLoop {
8351
8351
  this.emit("processed");
8352
8352
  }
8353
8353
  _render(renderer) {
8354
+ this.emit("rendering");
8354
8355
  renderer.program.uniforms.projectionMatrix = this.root.toProjectionArray(true);
8355
8356
  this.renderStack.render(renderer);
8356
8357
  this._renderScreen(renderer);
8358
+ this.emit("rendered");
8357
8359
  }
8358
8360
  _renderScreen(renderer) {
8359
8361
  renderer.state.reset();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "modern-canvas",
3
3
  "type": "module",
4
- "version": "0.4.10",
4
+ "version": "0.4.11",
5
5
  "packageManager": "pnpm@9.15.1",
6
6
  "description": "A JavaScript WebGL rendering engine.",
7
7
  "author": "wxm",