/* MIT License Copyright (c) 2012 - 2021 @jonobr1 / http://jono.fyi Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ var Two=(()=>{var ye=Object.defineProperty;var Gi=Object.getOwnPropertyDescriptor;var qi=Object.getOwnPropertyNames;var Ki=Object.prototype.hasOwnProperty;var $i=(i,t,e)=>t in i?ye(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e;var Ce=(i,t)=>{for(var e in t)ye(i,e,{get:t[e],enumerable:!0})},Ji=(i,t,e,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of qi(t))!Ki.call(i,r)&&r!==e&&ye(i,r,{get:()=>t[r],enumerable:!(s=Gi(t,r))||s.enumerable});return i};var Zi=i=>Ji(ye({},"__esModule",{value:!0}),i);var x=(i,t,e)=>($i(i,typeof t!="symbol"?t+"":t,e),e);var Ks={};Ce(Ks,{default:()=>I});var v={move:"M",line:"L",curve:"C",arc:"A",close:"Z"};var Be={};Ce(Be,{HALF_PI:()=>Z,NumArray:()=>yt,TWO_PI:()=>J,decomposeMatrix:()=>Rt,getComputedMatrix:()=>Pe,getPoT:()=>Ie,lerp:()=>at,mod:()=>st,setMatrix:()=>Oe,toFixed:()=>$});var W;typeof window<"u"?W=window:typeof global<"u"?W=global:typeof self<"u"&&(W=self);var li,J=Math.PI*2,Z=Math.PI*.5;function Rt(i,t,e,s,r,n){let a;return arguments.length<=1?(a=i.a,t=i.b,e=i.c,s=i.d,r=i.e,n=i.f):a=i,{translateX:r,translateY:n,scaleX:Math.sqrt(a*a+t*t),scaleY:Math.sqrt(e*e+s*s),rotation:180*Math.atan2(t,a)/Math.PI}}function Oe(i){li=i}function Pe(i,t){t=t&&t.identity()||new li;let e=i,s=[];for(;e&&e._matrix;)s.push(e._matrix),e=e.parent;s.reverse();for(let r=0;rNt,getAnchorsFromArcData:()=>es,getComponentOnCubicBezier:()=>zt,getControlPoints:()=>ui,getCurveBoundingBox:()=>je,getCurveFromPoints:()=>Ve,getCurveLength:()=>Ne,getReflection:()=>be,integrate:()=>ci,subdivide:()=>re});var p=class{_events={};_bound=!1;constructor(){}addEventListener(t,e){return(this._events[t]||(this._events[t]=[])).push(e),this._bound=!0,this}on(){return this.addEventListener.apply(this,arguments)}bind(){return this.addEventListener.apply(this,arguments)}removeEventListener(t,e){if(!this._events)return this;if(!t&&!e)return this._events={},this._bound=!1,this;let s=t?[t]:Object.keys(this._events);for(let r=0,n=s.length;r=4){let n=arguments[0]-arguments[2],a=arguments[1]-arguments[3];return Math.atan2(a,n)}let s=t.x-e.x,r=t.y-e.y;return Math.atan2(r,s)}static distanceBetween(t,e){return Math.sqrt(bt.distanceBetweenSquared(t,e))}static distanceBetweenSquared(t,e){let s=t.x-e.x,r=t.y-e.y;return s*s+r*r}set(t,e){return this.x=t,this.y=e,this}copy(t){return this.x=t.x,this.y=t.y,this}clear(){return this.x=0,this.y=0,this}clone(){return new bt(this.x,this.y)}add(t,e){return arguments.length<=0?this:(arguments.length<=1?typeof t=="number"?(this.x+=t,this.y+=t):t&&typeof t.x=="number"&&typeof t.y=="number"&&(this.x+=t.x,this.y+=t.y):(this.x+=t,this.y+=e),this)}addSelf(t){return this.add.apply(this,arguments)}sub(t,e){return arguments.length<=0?this:(arguments.length<=1?typeof t=="number"?(this.x-=t,this.y-=t):t&&typeof t.x=="number"&&typeof t.y=="number"&&(this.x-=t.x,this.y-=t.y):(this.x-=t,this.y-=e),this)}subtract(){return this.sub.apply(this,arguments)}subSelf(t){return this.sub.apply(this,arguments)}subtractSelf(t){return this.sub.apply(this,arguments)}multiply(t,e){return arguments.length<=0?this:(arguments.length<=1?typeof t=="number"?(this.x*=t,this.y*=t):t&&typeof t.x=="number"&&typeof t.y=="number"&&(this.x*=t.x,this.y*=t.y):(this.x*=t,this.y*=e),this)}multiplySelf(t){return this.multiply.apply(this,arguments)}multiplyScalar(t){return this.multiply(t)}divide(t,e){return arguments.length<=0?this:(arguments.length<=1?typeof t=="number"?(this.x/=t,this.y/=t):t&&typeof t.x=="number"&&typeof t.y=="number"&&(this.x/=t.x,this.y/=t.y):(this.x/=t,this.y/=e),isNaN(this.x)&&(this.x=0),isNaN(this.y)&&(this.y=0),this)}divideSelf(t){return this.divide.apply(this,arguments)}divideScalar(t){return this.divide(t)}negate(){return this.multiply(-1)}dot(t){return this.x*t.x+this.y*t.y}length(){return Math.sqrt(this.lengthSquared())}lengthSquared(){return this.x*this.x+this.y*this.y}normalize(){return this.divideScalar(this.length())}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let e=this.x-t.x,s=this.y-t.y;return e*e+s*s}setLength(t){return this.normalize().multiplyScalar(t)}equals(t,e){return e=typeof e>"u"?1e-4:e,this.distanceTo(t)"u"?1e-4:t,this.length()>1,f=s&1?n[h++]*i(o):0;for(;h=0&&t<4294967296}var E={isNaN:function(i){return typeof i=="number"&&i!==+i},isElement:function(i){return!!(i&&i.nodeType===1)},isObject:function(i){let t=typeof i;return t==="function"||t==="object"&&!!i},extend:function(i){let t=di.call(arguments,1);for(let e=0;e0&&this.set(o)}static Multiply(t,e,s){if(e.length<=3){let S=t,F,B,L,M=e[0]||0,V=e[1]||0,j=e[2]||0;return F=S[0]*M+S[1]*V+S[2]*j,B=S[3]*M+S[4]*V+S[5]*j,L=S[6]*M+S[7]*V+S[8]*j,[F,B,L]}let r=t[0],n=t[1],a=t[2],o=t[3],h=t[4],l=t[5],f=t[6],c=t[7],d=t[8],_=e[0],u=e[1],y=e[2],b=e[3],m=e[4],g=e[5],k=e[6],R=e[7],A=e[8];return s=s||new yt(9),s[0]=r*_+n*b+a*k,s[1]=r*u+n*m+a*R,s[2]=r*y+n*g+a*A,s[3]=o*_+h*b+l*k,s[4]=o*u+h*m+l*R,s[5]=o*y+h*g+l*A,s[6]=f*_+c*b+d*k,s[7]=f*u+c*m+d*R,s[8]=f*y+c*g+d*A,s}set(t,e,s,r,n,a,o,h,l){if(typeof e>"u"){let f=t;t=f[0],e=f[1],s=f[2],r=f[3],n=f[4],a=f[5],o=f[6],h=f[7],l=f[8]}return this.elements[0]=t,this.elements[1]=e,this.elements[2]=s,this.elements[3]=r,this.elements[4]=n,this.elements[5]=a,this.elements[6]=o,this.elements[7]=h,this.elements[8]=l,this.trigger(p.Types.change)}copy(t){return this.elements[0]=t.elements[0],this.elements[1]=t.elements[1],this.elements[2]=t.elements[2],this.elements[3]=t.elements[3],this.elements[4]=t.elements[4],this.elements[5]=t.elements[5],this.elements[6]=t.elements[6],this.elements[7]=t.elements[7],this.elements[8]=t.elements[8],this.manual=t.manual,this.trigger(p.Types.change)}identity(){return this.elements[0]=gt.Identity[0],this.elements[1]=gt.Identity[1],this.elements[2]=gt.Identity[2],this.elements[3]=gt.Identity[3],this.elements[4]=gt.Identity[4],this.elements[5]=gt.Identity[5],this.elements[6]=gt.Identity[6],this.elements[7]=gt.Identity[7],this.elements[8]=gt.Identity[8],this.trigger(p.Types.change)}multiply(t,e,s,r,n,a,o,h,l){if(typeof e>"u")return this.elements[0]*=t,this.elements[1]*=t,this.elements[2]*=t,this.elements[3]*=t,this.elements[4]*=t,this.elements[5]*=t,this.elements[6]*=t,this.elements[7]*=t,this.elements[8]*=t,this.trigger(p.Types.change);if(typeof s>"u"&&(s=1),typeof r>"u"){t=t||0,e=e||0,s=s||0,n=this.elements;let z=n[0]*t+n[1]*e+n[2]*s,it=n[3]*t+n[4]*e+n[5]*s,ht=n[6]*t+n[7]*e+n[8]*s;return[z,it,ht]}let f=this.elements,c=[t,e,s,r,n,a,o,h,l],d=f[0],_=f[1],u=f[2],y=f[3],b=f[4],m=f[5],g=f[6],k=f[7],R=f[8],A=c[0],S=c[1],F=c[2],B=c[3],L=c[4],M=c[5],V=c[6],j=c[7],X=c[8];return this.elements[0]=d*A+_*B+u*V,this.elements[1]=d*S+_*L+u*j,this.elements[2]=d*F+_*M+u*X,this.elements[3]=y*A+b*B+m*V,this.elements[4]=y*S+b*L+m*j,this.elements[5]=y*F+b*M+m*X,this.elements[6]=g*A+k*B+R*V,this.elements[7]=g*S+k*L+R*j,this.elements[8]=g*F+k*M+R*X,this.trigger(p.Types.change)}inverse(t){let e=this.elements;t=t||new gt;let s=e[0],r=e[1],n=e[2],a=e[3],o=e[4],h=e[5],l=e[6],f=e[7],c=e[8],d=c*o-h*f,_=-c*a+h*l,u=f*a-o*l,y=s*d+r*_+n*u;return y?(y=1/y,t.elements[0]=d*y,t.elements[1]=(-c*r+n*f)*y,t.elements[2]=(h*r-n*o)*y,t.elements[3]=_*y,t.elements[4]=(c*s-n*l)*y,t.elements[5]=(-h*s+n*a)*y,t.elements[6]=u*y,t.elements[7]=(-f*s+r*l)*y,t.elements[8]=(o*s-r*a)*y,t):null}scale(t,e){return arguments.length<=1&&(e=t),this.multiply(t,0,0,0,e,0,0,0,1)}rotate(t){let e=ns(t),s=as(t);return this.multiply(e,-s,0,s,e,0,0,0,1)}translate(t,e){return this.multiply(1,0,t,0,1,e,0,0,1)}skewX(t){let e=gi(t);return this.multiply(1,e,0,0,1,0,0,0,1)}skewY(t){let e=gi(t);return this.multiply(1,0,0,e,1,0,0,0,1)}toString(t){return Ue.length=0,this.toTransformArray(t,Ue),Ue.map($).join(" ")}toTransformArray(t,e){let s=this.elements,r=!!e,n=s[0],a=s[1],o=s[2],h=s[3],l=s[4],f=s[5];if(t){let c=s[6],d=s[7],_=s[8];if(r){e[0]=n,e[1]=h,e[2]=c,e[3]=a,e[4]=l,e[5]=d,e[6]=o,e[7]=f,e[8]=_;return}return[n,h,c,a,l,d,o,f,_]}if(r){e[0]=n,e[1]=h,e[2]=a,e[3]=l,e[4]=o,e[5]=f;return}return[n,h,a,l,o,f]}toArray(t,e){let s=this.elements,r=!!e,n=s[0],a=s[1],o=s[2],h=s[3],l=s[4],f=s[5];if(t){let c=s[6],d=s[7],_=s[8];if(r){e[0]=n,e[1]=a,e[2]=o,e[3]=h,e[4]=l,e[5]=f,e[6]=c,e[7]=d,e[8]=_;return}return[n,a,o,h,l,f,c,d,_]}if(r){e[0]=n,e[1]=a,e[2]=o,e[3]=h,e[4]=l,e[5]=f;return}return[n,a,o,h,l,f]}toObject(){return{elements:this.toArray(!0),manual:!!this.manual}}clone(){return new gt().copy(this)}},xt=gt;x(xt,"Identity",[1,0,0,0,1,0,0,0,1]);Oe(xt);var ot=class extends St{_flagMatrix=!0;_flagScale=!1;_matrix=null;_worldMatrix=null;_position=null;_rotation=0;_scale=1;_skewX=0;_skewY=0;constructor(){super();for(let t in xe)Object.defineProperty(this,t,xe[t]);this._renderer.flagMatrix=pi.bind(this),this.isShape=!0,this.id=G.Identifier+G.uniqueId(),this.matrix=new xt,this.worldMatrix=new xt,this.position=new w,this.rotation=0,this.scale=1,this.skewX=0,this.skewY=0}get renderer(){return this._renderer}set renderer(t){this._renderer=t}get translation(){return xe.position.get.apply(this,arguments)}set translation(t){xe.position.set.apply(this,arguments)}addTo(t){return t.add(this),this}remove(){return this.parent?(this.parent.remove(this),this):this}clone(t){let e=new ot;return e.position.copy(this.position),e.rotation=this.rotation,e.scale=this.scale,e.skewX=this.skewX,e.skewY=this.skewY,this.matrix.manual&&e.matrix.copy(this.matrix),t&&t.add(e),e._update()}_update(t){return!this._matrix.manual&&this._flagMatrix&&(this._matrix.identity().translate(this.position.x,this.position.y),this._scale instanceof w?this._matrix.scale(this._scale.x,this._scale.y):this._matrix.scale(this._scale),this._matrix.rotate(this.rotation),this._matrix.skewX(this.skewX),this._matrix.skewY(this.skewY)),t&&this.parent&&this.parent._update&&this.parent._update(),this}flagReset(){return this._flagMatrix=this._flagScale=!1,super.flagReset.call(this),this}},xe={position:{enumerable:!0,get:function(){return this._position},set:function(i){this._position&&this._position.unbind(p.Types.change,this._renderer.flagMatrix),this._position=i,this._position.bind(p.Types.change,this._renderer.flagMatrix),pi.call(this)}},rotation:{enumerable:!0,get:function(){return this._rotation},set:function(i){this._rotation=i,this._flagMatrix=!0}},scale:{enumerable:!0,get:function(){return this._scale},set:function(i){this._scale instanceof w&&this._scale.unbind(p.Types.change,this._renderer.flagMatrix),this._scale=i,this._scale instanceof w&&this._scale.bind(p.Types.change,this._renderer.flagMatrix),this._flagMatrix=!0,this._flagScale=!0}},skewX:{enumerable:!0,get:function(){return this._skewX},set:function(i){this._skewX=i,this._flagMatrix=!0}},skewY:{enumerable:!0,get:function(){return this._skewY},set:function(i){this._skewY=i,this._flagMatrix=!0}},matrix:{enumerable:!0,get:function(){return this._matrix},set:function(i){this._matrix=i,this._flagMatrix=!0}},worldMatrix:{enumerable:!0,get:function(){return Pe(this,this._worldMatrix),this._worldMatrix},set:function(i){this._worldMatrix=i}}};function pi(){this._flagMatrix=!0}var lt=class extends Array{_events=new p;get _bound(){return this._events._bound}set _bound(t){this._events._bound=t}addEventListener(){return this._events.addEventListener.apply(this,arguments)}on(){return this._events.on.apply(this,arguments)}bind(){return this._events.bind.apply(this,arguments)}removeEventListener(){return this._events.removeEventListener.apply(this,arguments)}off(){return this._events.off.apply(this,arguments)}unbind(){return this._events.unbind.apply(this,arguments)}dispatchEvent(){return this._events.dispatchEvent.apply(this,arguments)}trigger(){return this._events.trigger.apply(this,arguments)}listen(){return this._events.listen.apply(this,arguments)}ignore(){return this._events.ignore.apply(this,arguments)}constructor(){super(),arguments[0]&&Array.isArray(arguments[0])?arguments[0].length>0&&this.push.apply(this,arguments[0]):arguments.length>0&&this.push.apply(this,arguments)}pop(){let t=super.pop.apply(this,arguments);return this.trigger(p.Types.remove,[t]),t}shift(){let t=super.shift.apply(this,arguments);return this.trigger(p.Types.remove,[t]),t}push(){let t=super.push.apply(this,arguments);return this.trigger(p.Types.insert,arguments),t}unshift(){let t=super.unshift.apply(this,arguments);return this.trigger(p.Types.insert,arguments),t}splice(){let t=super.splice.apply(this,arguments);if(this.trigger(p.Types.remove,t),arguments.length>2){let e=this.slice(arguments[0],arguments[0]+arguments.length-2);this.trigger(p.Types.insert,e),this.trigger(p.Types.order)}return t}sort(){return super.sort.apply(this,arguments),this.trigger(p.Types.order),this}reverse(){return super.reverse.apply(this,arguments),this.trigger(p.Types.order),this}indexOf(){return super.indexOf.apply(this,arguments)}map(t,e){let s=[];for(let r=0;r=0&&e.push(r),r.children)for(let n=0;n=0&&this.children.splice(r,1),this.children.push(s)}return this}remove(t){let e=arguments.length,s=this.parent;if(e<=0&&s)return s.remove(this),this;t instanceof Array?t=t.slice():t=Array.prototype.slice.call(arguments);for(let r=0;r=0&&this.children.splice(a,1)}return this}getBoundingClientRect(t){let e,s,r,n,a,o;this._update(!0);let h=1/0,l=-1/0,f=1/0,c=-1/0,d=/texture|gradient/i;s=t?this.matrix:this.worldMatrix;for(let _=0;_o+e?(s.beginning=1,s.ending=1):lo&&ho&&l0&&e(this._children)),this._children=new ne(i),this._children.bind(p.Types.insert,t),this._children.bind(p.Types.remove,e),this._children.bind(p.Types.order,s),i.length>0&&t(i)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(i){this._mask=i,this._flagMask=!0,E.isObject(i)&&!i.clip&&(i.clip=!0)}}};function yi(i,t){let e=i.parent,s;if(e===t){r();return}if(e&&e.children.ids[i.id]&&(s=Array.prototype.indexOf.call(e.children,i),e.children.splice(s,1),n()),t){r();return}n(),e._flagAdditions&&e.additions.length===0&&(e._flagAdditions=!1),e._flagSubtractions&&e.subtractions.length===0&&(e._flagSubtractions=!1),delete i.parent;function r(){t.subtractions.length>0&&(s=Array.prototype.indexOf.call(t.subtractions,i),s>=0&&t.subtractions.splice(s,1)),t.additions.length>0&&(s=Array.prototype.indexOf.call(t.additions,i),s>=0&&t.additions.splice(s,1)),i.parent=t,t.additions.push(i),t._flagAdditions=!0}function n(){s=Array.prototype.indexOf.call(e.additions,i),s>=0&&e.additions.splice(s,1),s=Array.prototype.indexOf.call(e.subtractions,i),s<0&&(e.subtractions.push(i),e._flagSubtractions=!0)}}var We=[],Xe=Math.max,os=Math.min,bi=Math.abs,ke=Math.sin,Ae=Math.cos,ls=Math.acos,Se=Math.sqrt,Q={isHidden:/(undefined|none|transparent)/i,alignments:{left:"start",middle:"center",right:"end"},baselines:{top:"top",middle:"middle",bottom:"bottom",baseline:"alphabetic"},shim:function(i,t){return i.tagName=i.nodeName=t||"canvas",i.nodeType=1,i.getAttribute=function(e){return this[e]},i.setAttribute=function(e,s){return this[e]=s,this},i},group:{renderChild:function(i){Q[i._renderer.type].render.call(i,this.ctx,!0,this.clip)},render:function(i){if(!this._visible)return this;this._update();let t=this._matrix.elements,e=this.parent;this._renderer.opacity=this._opacity*(e&&e._renderer?e._renderer.opacity:1);let s=this._mask,r=Re(t),n=!r||!!s;if(this._renderer.context||(this._renderer.context={}),this._renderer.context.ctx=i,n&&(i.save(),r||i.transform(t[0],t[3],t[1],t[4],t[2],t[5])),s&&Q[s._renderer.type].render.call(s,i,!0),this._opacity>0&&this._scale!==0)for(let a=0;a0&&(i.lineDashOffset=nt.offset||0,i.setLineDash(nt)),i.beginPath();let Ct,Qt,te,ee,ie,se,kt;for(let Y=0;Y=y&&d&&(k=R,V=g.controls&&g.controls.right||w.zero,j=k.controls&&k.controls.left||w.zero,g._relative?(F=V.x+g.x,B=V.y+g.y):(F=V.x,B=V.y),k._relative?(A=j.x+k.x,S=j.y+k.y):(A=j.x,S=j.y),X=k.x,z=k.y,i.bezierCurveTo(F,B,A,S,X,z));break;case v.line:i.lineTo(X,z);break;case v.move:R=g,i.moveTo(X,z);break}return d&&i.closePath(),!ht&&!e&&(Q.isHidden.test(a)||(_t=a._renderer&&a._renderer.offset,_t&&(i.save(),i.translate(-a._renderer.offset.x,-a._renderer.offset.y),i.scale(a._renderer.scale.x,a._renderer.scale.y)),i.fill(),_t&&i.restore()),Q.isHidden.test(r)||(_t=r._renderer&&r._renderer.offset,_t&&(i.save(),i.translate(-r._renderer.offset.x,-r._renderer.offset.y),i.scale(r._renderer.scale.x,r._renderer.scale.y),i.lineWidth=n/r._renderer.scale.x),i.stroke(),_t&&i.restore())),tt||i.restore(),ht&&!e&&i.clip(),nt&&nt.length>0&&i.setLineDash(We),this.flagReset()}},points:{render:function(i,t,e){let s,r,n,a,o,h,l,f,c,d,_,u,y,b,m,g;if(g=this.parent&&this.parent._renderer?this.parent._renderer.opacity:1,o=this._opacity*(g||1),h=this._visible,!t&&(!h||o===0))return this;this._update(),s=this._matrix.elements,r=this._stroke,n=this._linewidth,a=this._fill,f=this._renderer.collection,c=f.length,y=Re(s),m=this.dashes,l=this._size,y||(i.save(),i.transform(s[0],s[3],s[1],s[4],s[2],s[5])),a&&(typeof a=="string"?i.fillStyle=a:(Q[a._renderer.type].render.call(a,i,this),i.fillStyle=a._renderer.effect)),r&&(typeof r=="string"?i.strokeStyle=r:(Q[r._renderer.type].render.call(r,i,this),i.strokeStyle=r._renderer.effect),n&&(i.lineWidth=n)),typeof o=="number"&&(i.globalAlpha=o),m&&m.length>0&&(i.lineDashOffset=m.offset||0,i.setLineDash(m)),i.beginPath();let k=l*.5,R;this._sizeAttenuation||(R=this.worldMatrix.elements,R=Rt(R[0],R[3],R[1],R[4],R[2],R[5]),k/=Math.max(R.scaleX,R.scaleY));for(let A=0;A0&&i.setLineDash(We),this.flagReset()}},text:{render:function(i,t,e){let s=this.parent&&this.parent._renderer?this.parent._renderer.opacity:1,r=this._opacity*s,n=this._visible,a=this._mask,o=this._clip;if(!t&&(!n||o||r===0))return this;this._update();let h=this._matrix.elements,l=this._stroke,f=this._linewidth,c=this._fill,d=this._decoration,_=this._direction,u=Re(h),y=c._renderer&&c._renderer.offset&&l._renderer&&l._renderer.offset,b=this.dashes,m=Q.alignments[this._alignment]||this._alignment,g=Q.baselines[this._baseline]||this._baseline,k,R,A,S,F,B,L,M,V,j,X;if(u||(i.save(),i.transform(h[0],h[3],h[1],h[4],h[2],h[5])),a&&Q[a._renderer.type].render.call(a,i,!0),y||(i.font=[this._style,this._weight,this._size+"px/"+this._leading+"px",this._family].join(" ")),i.textAlign=m,i.textBaseline=g,i.direction=_,c&&(typeof c=="string"?i.fillStyle=c:(Q[c._renderer.type].render.call(c,i,this),i.fillStyle=c._renderer.effect)),l&&(typeof l=="string"?i.strokeStyle=l:(Q[l._renderer.type].render.call(l,i,this),i.strokeStyle=l._renderer.effect),f&&(i.lineWidth=f)),typeof r=="number"&&(i.globalAlpha=r),b&&b.length>0&&(i.lineDashOffset=b.offset||0,i.setLineDash(b)),!o&&!e&&(Q.isHidden.test(c)||(c._renderer&&c._renderer.offset?(B=c._renderer.scale.x,L=c._renderer.scale.y,i.save(),i.translate(-c._renderer.offset.x,-c._renderer.offset.y),i.scale(B,L),k=this._size/c._renderer.scale.y,R=this._leading/c._renderer.scale.y,i.font=[this._style,this._weight,k+"px/",R+"px",this._family].join(" "),A=c._renderer.offset.x/c._renderer.scale.x,S=c._renderer.offset.y/c._renderer.scale.y,i.fillText(this.value,A,S),i.restore()):i.fillText(this.value,0,0)),Q.isHidden.test(l)||(l._renderer&&l._renderer.offset?(B=l._renderer.scale.x,L=l._renderer.scale.y,i.save(),i.translate(-l._renderer.offset.x,-l._renderer.offset.y),i.scale(B,L),k=this._size/l._renderer.scale.y,R=this._leading/l._renderer.scale.y,i.font=[this._style,this._weight,k+"px/",R+"px",this._family].join(" "),A=l._renderer.offset.x/l._renderer.scale.x,S=l._renderer.offset.y/l._renderer.scale.y,F=f/l._renderer.scale.x,i.lineWidth=F,i.strokeText(this.value,A,S),i.restore()):i.strokeText(this.value,0,0))),/(underline|strikethrough)/i.test(d)){let z=i.measureText(this.value),it=1;switch(d){case"underline":V=z.actualBoundingBoxDescent,X=z.actualBoundingBoxDescent;break;case"strikethrough":V=0,X=0,it=.5;break}switch(g){case"top":V+=this._size*it,X+=this._size*it;break;case"baseline":case"bottom":V-=this._size*it,X-=this._size*it;break}switch(m){case"left":case"start":M=0,j=z.width;break;case"right":case"end":M=-z.width,j=0;break;default:M=-z.width/2,j=z.width/2}i.lineWidth=Math.max(Math.floor(this._size/15),1),i.strokeStyle=i.fillStyle,i.beginPath(),i.moveTo(M,V),i.lineTo(j,X),i.stroke()}return u||i.restore(),o&&!e&&i.clip(),b&&b.length>0&&i.setLineDash(We),this.flagReset()}},"linear-gradient":{render:function(i,t){if(!!t){if(this._update(),!this._renderer.effect||this._flagEndPoints||this._flagStops||this._flagUnits){let e,s=this.left._x,r=this.left._y,n=this.right._x,a=this.right._y;/objectBoundingBox/i.test(this._units)&&(e=t.getBoundingClientRect(!0),s=(s-.5)*e.width,r=(r-.5)*e.height,n=(n-.5)*e.width,a=(a-.5)*e.height),this._renderer.effect=i.createLinearGradient(s,r,n,a);for(let o=0;o1){let z=Se(g);s=z*s,r=z*r,b=s*s,m=r*r}let k=b*y+m*u,R=(b*m-k)/k,A=Se(Xe(0,R));n===a&&(A=-A);let S=A*s*_/r,F=-A*r*d/s,B=Ae(o)*S-ke(o)*F+(t+h)/2,L=ke(o)*S+Ae(o)*F+(e+l)/2,M=xi(1,0,(d-S)/s,(_-F)/r),V=xi((d-S)/s,(_-F)/r,(-d-S)/s,(-_-F)/r)%J,j=M+V;hs(i,B,L,s,r,M,j,a===0,o)}},vt=class extends p{constructor(t){super();let e=t.smoothing!==!1;this.domElement=t.domElement||document.createElement("canvas"),this.ctx=this.domElement.getContext("2d"),this.overdraw=t.overdraw||!1,typeof this.ctx.imageSmoothingEnabled<"u"&&(this.ctx.imageSmoothingEnabled=e),this.scene=new q,this.scene.parent=this}setSize(t,e,s){return this.width=t,this.height=e,this.ratio=typeof s>"u"?Ut(this.ctx):s,this.domElement.width=t*this.ratio,this.domElement.height=e*this.ratio,this.domElement.style&&E.extend(this.domElement.style,{width:t+"px",height:e+"px"}),this.trigger(p.Types.resize,t,e,s)}render(){let t=this.ratio===1;return t||(this.ctx.save(),this.ctx.scale(this.ratio,this.ratio)),this.overdraw||this.ctx.clearRect(0,0,this.width,this.height),Q.group.render.call(this.scene,this.ctx),t||this.ctx.restore(),this}};x(vt,"Utils",Q);function hs(i,t,e,s,r,n,a,o,h){let l=a-n,f=Nt.Tolerance.epsilon,c=Math.abs(l)=s)return s-r>=0;r+=a}return!1}function Wt(i,t){let e=i._length;if(t<=0)return 0;if(t>=e)return i._lengths.length-1;for(let s=0,r=0;s=t)return t-=r,Math.max(s-1,0)+t/i._lengths[s];r+=i._lengths[s]}return-1}function Ee(i,t,e){let s,r,n,a,o,h,l,f,c=t.controls&&t.controls.right,d=i.controls&&i.controls.left;return s=t.x,o=t.y,r=(c||t).x,h=(c||t).y,n=(d||i).x,l=(d||i).y,a=i.x,f=i.y,c&&t._relative&&(r+=t.x,h+=t.y),d&&i._relative&&(n+=i.x,l+=i.y),Ne(s,o,r,h,n,l,a,f,e)}function Ye(i,t,e){let s,r,n,a,o,h,l,f,c=t.controls&&t.controls.right,d=i.controls&&i.controls.left;return s=t.x,o=t.y,r=(c||t).x,h=(c||t).y,n=(d||i).x,l=(d||i).y,a=i.x,f=i.y,c&&t._relative&&(r+=t.x,h+=t.y),d&&i._relative&&(n+=i.x,l+=i.y),re(s,o,r,h,n,l,a,f,e)}var Mt=class extends St{_flagOffset=!0;_flagOpacity=!0;_flagColor=!0;_offset=0;_opacity=1;_color="#fff";constructor(t,e,s){super();for(let r in vi)Object.defineProperty(this,r,vi[r]);this._renderer.type="stop",this.offset=typeof t=="number"?t:Mt.Index<=0?0:1,this.opacity=typeof s=="number"?s:1,this.color=typeof e=="string"?e:Mt.Index<=0?"#fff":"#000",Mt.Index=(Mt.Index+1)%2}clone(t){let e=new Mt;return E.each(Mt.Properties,function(s){e[s]=this[s]},this),t&&t.stops&&t.stops.push(e),e}toObject(){let t={};return E.each(Mt.Properties,function(e){t[e]=this[e]},this),t}flagReset(){return this._flagOffset=this._flagColor=this._flagOpacity=!1,super.flagReset.call(this),this}},ct=Mt;x(ct,"Index",0),x(ct,"Properties",["offset","opacity","color"]);var vi={offset:{enumerable:!0,get:function(){return this._offset},set:function(i){this._offset=i,this._flagOffset=!0,this.parent&&(this.parent._flagStops=!0)}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(i){this._opacity=i,this._flagOpacity=!0,this.parent&&(this.parent._flagStops=!0)}},color:{enumerable:!0,get:function(){return this._color},set:function(i){this._color=i,this._flagColor=!0,this.parent&&(this.parent._flagStops=!0)}}};var ae=class extends St{_flagStops=!1;_flagSpread=!1;_flagUnits=!1;_spread="";_units="";constructor(t){super();for(let e in wi)Object.defineProperty(this,e,wi[e]);this._renderer.type="gradient",this.id=G.Identifier+G.uniqueId(),this.classList=[],this._renderer.flagStops=fs.bind(this),this._renderer.bindStops=cs.bind(this),this._renderer.unbindStops=us.bind(this),this.spread="pad",this.units="objectBoundingBox",t&&(this.stops=t)}clone(t){let e=this.stops.map(function(r){return r.clone()}),s=new ae(e);return E.each(ae.Properties,function(r){s[r]=this[r]},this),t&&t.add(s),s}toObject(){let t={stops:this.stops.map(function(e){return e.toObject()})};return E.each(ae.Properties,function(e){t[e]=this[e]},this),t}_update(){return(this._flagSpread||this._flagStops)&&this.trigger(p.Types.change),this}flagReset(){return this._flagSpread=this._flagUnits=this._flagStops=!1,super.flagReset.call(this),this}},H=ae;x(H,"Stop",ct),x(H,"Properties",["spread","stops","renderer","units"]);var wi={spread:{enumerable:!0,get:function(){return this._spread},set:function(i){this._spread=i,this._flagSpread=!0}},units:{enumerable:!0,get:function(){return this._units},set:function(i){this._units=i,this._flagUnits=!0}},stops:{enumerable:!0,get:function(){return this._stops},set:function(i){let t=this._renderer.bindStops,e=this._renderer.unbindStops;this._stops&&this._stops.unbind(p.Types.insert,t).unbind(p.Types.remove,e),this._stops=new lt((i||[]).slice(0)),this._stops.bind(p.Types.insert,t).bind(p.Types.remove,e),t(this._stops)}}};function fs(){this._flagStops=!0}function cs(i){let t=i.length;for(;t--;)i[t].bind(p.Types.change,this._renderer.flagStops),i[t].parent=this;this._renderer.flagStops()}function us(i){let t=i.length;for(;t--;)i[t].unbind(p.Types.change,this._renderer.flagStops),delete i[t].parent;this._renderer.flagStops()}var Ge=class extends H{_flagEndPoints=!1;_left=null;_right=null;constructor(t,e,s,r,n){super(n);for(let a in ki)Object.defineProperty(this,a,ki[a]);this._renderer.type="linear-gradient",this._renderer.flagEndPoints=ds.bind(this),this.left=new w,this.right=new w,typeof t=="number"&&(this.left.x=t),typeof e=="number"&&(this.left.y=e),typeof s=="number"&&(this.right.x=s),typeof r=="number"&&(this.right.y=r)}clone(t){let e=this.stops.map(function(r){return r.clone()}),s=new Ge(this.left._x,this.left._y,this.right._x,this.right._y,e);return E.each(H.Properties,function(r){s[r]=this[r]},this),t&&t.add(s),s}toObject(){let t=super.toObject.call(this);return t.left=this.left.toObject(),t.right=this.right.toObject(),t}_update(){return(this._flagEndPoints||this._flagSpread||this._flagStops)&&this.trigger(p.Types.change),this}flagReset(){return this._flagEndPoints=!1,super.flagReset.call(this),this}},U=Ge;x(U,"Properties",["left","right"]),x(U,"Stop",ct);var ki={left:{enumerable:!0,get:function(){return this._left},set:function(i){this._left instanceof w&&this._left.unbind(p.Types.change,this._renderer.flagEndPoints),this._left=i,this._left.bind(p.Types.change,this._renderer.flagEndPoints),this._flagEndPoints=!0}},right:{enumerable:!0,get:function(){return this._right},set:function(i){this._right instanceof w&&this._right.unbind(p.Types.change,this._renderer.flagEndPoints),this._right=i,this._right.bind(p.Types.change,this._renderer.flagEndPoints),this._flagEndPoints=!0}}};function ds(){this._flagEndPoints=!0}var oe=class extends H{_flagRadius=!1;_flagCenter=!1;_flagFocal=!1;_radius=0;_center=null;_focal=null;constructor(t,e,s,r,n,a){super(r);for(let o in Ai)Object.defineProperty(this,o,Ai[o]);this._renderer.type="radial-gradient",this._renderer.flagCenter=_s.bind(this),this._renderer.flagFocal=gs.bind(this),this.center=new w,this.radius=typeof s=="number"?s:1,this.focal=new w,typeof t=="number"&&(this.center.x=t),typeof e=="number"&&(this.center.y=e),this.focal.copy(this.center),typeof n=="number"&&(this.focal.x=n),typeof a=="number"&&(this.focal.y=a)}clone(t){let e=this.stops.map(function(r){return r.clone()}),s=new oe(this.center._x,this.center._y,this._radius,e,this.focal._x,this.focal._y);return E.each(H.Properties.concat(oe.Properties),function(r){s[r]=this[r]},this),t&&t.add(s),s}toObject(){let t=super.toObject.call(this);return E.each(oe.Properties,function(e){t[e]=this[e]},this),t.center=this.center.toObject(),t.focal=this.focal.toObject(),t}_update(){return(this._flagRadius||this._flatCenter||this._flagFocal||this._flagSpread||this._flagStops)&&this.trigger(p.Types.change),this}flagReset(){return this._flagRadius=this._flagCenter=this._flagFocal=!1,super.flagReset.call(this),this}},D=oe;x(D,"Stop",ct),x(D,"Properties",["center","radius","focal"]);var Ai={radius:{enumerable:!0,get:function(){return this._radius},set:function(i){this._radius=i,this._flagRadius=!0}},center:{enumerable:!0,get:function(){return this._center},set:function(i){this._center&&this._center.unbind(p.Types.change,this._renderer.flagCenter),this._center=i,this._center.bind(p.Types.change,this._renderer.flagCenter),this._flagCenter=!0}},focal:{enumerable:!0,get:function(){return this._focal},set:function(i){this._focal&&this._focal.unbind(p.Types.change,this._renderer.flagFocal),this._focal=i,this._focal.bind(p.Types.change,this._renderer.flagFocal),this._flagFocal=!0}}};function _s(){this._flagCenter=!0}function gs(){this._flagFocal=!0}var Fe,Ri={video:/\.(mp4|webm|ogg)$/i,image:/\.(jpe?g|png|gif|tiff|webp)$/i,effect:/texture|gradient/i};W.document&&(Fe=document.createElement("a"));var rt=class extends St{_flagSrc=!1;_flagImage=!1;_flagVideo=!1;_flagLoaded=!1;_flagRepeat=!1;_flagOffset=!1;_flagScale=!1;_src="";_image=null;_loaded=!1;_repeat="no-repeat";_scale=1;_offset=null;constructor(t,e){super(),this._renderer={};for(let s in Si)Object.defineProperty(this,s,Si[s]);if(this._renderer.type="texture",this._renderer.flagOffset=ps.bind(this),this._renderer.flagScale=ms.bind(this),this.id=G.Identifier+G.uniqueId(),this.classList=[],this.loaded=!1,this.repeat="no-repeat",this.offset=new w,typeof e=="function"){let s=function(){this.unbind(p.Types.load,s),typeof e=="function"&&e()}.bind(this);this.bind(p.Types.load,s)}if(typeof t=="string")this.src=t;else if(typeof t=="object"){let s=Object.prototype.toString.call(t);(s==="[object HTMLImageElement]"||s==="[object HTMLCanvasElement]"||s==="[object HTMLVideoElement]"||s==="[object Image]")&&(this.image=t)}this._update()}static getAbsoluteURL(t){return Fe?(Fe.href=t,Fe.href):t}static loadHeadlessBuffer(t,e){t.image.onload=e,t.image.src=t.src}static getTag(t){return t&&t.nodeName&&t.nodeName.toLowerCase()||"img"}static getImage(t){let e=rt.getAbsoluteURL(t);if(rt.ImageRegistry.contains(e))return rt.ImageRegistry.get(e);let s;return ft.Image?(s=new ft.Image,vt.Utils.shim(s,"img")):W.document?Ri.video.test(e)?s=document.createElement("video"):s=document.createElement("img"):console.warn("Two.js: no prototypical image defined for Two.Texture"),s.crossOrigin="anonymous",s.referrerPolicy="no-referrer",s}static load(t,e){let s=t.image,r=rt.getTag(s);t._flagImage&&(/canvas/i.test(r)?rt.Register.canvas(t,e):(t._src=!ft.isHeadless&&s.getAttribute("two-src")||s.src,rt.Register[r](t,e))),t._flagSrc&&(s||(s=rt.getImage(t.src),t.image=s),r=rt.getTag(s),rt.Register[r](t,e))}clone(){let t=new rt(this.src);return t.repeat=this.repeat,t.offset.copy(this.origin),t.scale=this.scale,t}toObject(){return{src:this.src,repeat:this.repeat,origin:this.origin.toObject(),scale:typeof this.scale=="number"?this.scale:this.scale.toObject()}}_update(){return(this._flagSrc||this._flagImage)&&(this.trigger(p.Types.change),(this._flagSrc||this._flagImage)&&(this.loaded=!1,rt.load(this,function(){this.loaded=!0,this.trigger(p.Types.change).trigger(p.Types.load)}.bind(this)))),this._image&&this._image.readyState>=4&&(this._flagVideo=!0),this}flagReset(){return this._flagSrc=this._flagImage=this._flagLoaded=this._flagRepeat=this._flagVideo=this._flagScale=this._flagOffset=!1,super.flagReset.call(this),this}},N=rt;x(N,"Properties",["src","loaded","repeat","scale","offset","image"]),x(N,"RegularExpressions",Ri),x(N,"ImageRegistry",new Et),x(N,"Register",{canvas:function(t,e){t._src="#"+t.id,rt.ImageRegistry.add(t.src,t.image),typeof e=="function"&&e()},img:function(t,e){let s=t.image,r=function(a){!ft.isHeadless&&s.removeEventListener&&typeof s.removeEventListener=="function"&&(s.removeEventListener("load",r,!1),s.removeEventListener("error",n,!1)),typeof e=="function"&&e()},n=function(a){throw!ft.isHeadless&&typeof s.removeEventListener=="function"&&(s.removeEventListener("load",r,!1),s.removeEventListener("error",n,!1)),new et("unable to load "+t.src)};typeof s.width=="number"&&s.width>0&&typeof s.height=="number"&&s.height>0?r():!ft.isHeadless&&typeof s.addEventListener=="function"&&(s.addEventListener("load",r,!1),s.addEventListener("error",n,!1)),t._src=rt.getAbsoluteURL(t._src),!(!ft.isHeadless&&s&&s.getAttribute("two-src"))&&(ft.isHeadless||s.setAttribute("two-src",t.src),rt.ImageRegistry.add(t.src,s),ft.isHeadless?rt.loadHeadlessBuffer(t,r):t.image.src=t.src)},video:function(t,e){if(ft.isHeadless)throw new et("video textures are not implemented in headless environments.");let s=function(n){t.image.removeEventListener("canplaythrough",s,!1),t.image.removeEventListener("error",r,!1),t.image.width=t.image.videoWidth,t.image.height=t.image.videoHeight,typeof e=="function"&&e()},r=function(n){throw t.image.removeEventListener("canplaythrough",s,!1),t.image.removeEventListener("error",r,!1),new et("unable to load "+t.src)};t._src=rt.getAbsoluteURL(t._src),t.image.getAttribute("two-src")||(t.image.setAttribute("two-src",t.src),rt.ImageRegistry.add(t.src,t.image)),t.image.readyState>=4?s():(t.image.addEventListener("canplaythrough",s,!1),t.image.addEventListener("error",r,!1),t.image.src=t.src,t.image.load())}});var Si={src:{enumerable:!0,get:function(){return this._src},set:function(i){this._src=i,this._flagSrc=!0}},loaded:{enumerable:!0,get:function(){return this._loaded},set:function(i){this._loaded=i,this._flagLoaded=!0}},repeat:{enumerable:!0,get:function(){return this._repeat},set:function(i){this._repeat=i,this._flagRepeat=!0}},image:{enumerable:!0,get:function(){return this._image},set:function(i){let t=N.getTag(i),e;switch(t){case"canvas":e="#"+i.id;break;default:e=i.src}N.ImageRegistry.contains(e)?this._image=N.ImageRegistry.get(i.src):this._image=i,this._flagImage=!0}},offset:{enumerable:!0,get:function(){return this._offset},set:function(i){this._offset&&this._offset.unbind(p.Types.change,this._renderer.flagOffset),this._offset=i,this._offset.bind(p.Types.change,this._renderer.flagOffset),this._flagOffset=!0}},scale:{enumerable:!0,get:function(){return this._scale},set:function(i){this._scale instanceof w&&this._scale.unbind(p.Types.change,this._renderer.flagScale),this._scale=i,this._scale instanceof w&&this._scale.bind(p.Types.change,this._renderer.flagScale),this._flagScale=!0}}};function ps(){this._flagOffset=!0}function ms(){this._flagScale=!0}var Xt=Math.min,Ht=Math.max,ys=Math.ceil,bs=Math.floor,xs=new w,Yt=class extends ot{_flagVertices=!0;_flagLength=!0;_flagFill=!0;_flagStroke=!0;_flagLinewidth=!0;_flagOpacity=!0;_flagVisible=!0;_flagCap=!0;_flagJoin=!0;_flagMiter=!0;_flagMask=!1;_flagClip=!1;_length=0;_fill="#fff";_stroke="#000";_linewidth=1;_opacity=1;_visible=!0;_cap="round";_join="round";_miter=4;_closed=!0;_curved=!1;_automatic=!0;_beginning=0;_ending=1;_mask=null;_clip=!1;_dashes=null;constructor(t,e,s,r){super();for(let n in Ei)Object.defineProperty(this,n,Ei[n]);this._renderer.type="path",this._renderer.flagVertices=qe.bind(this),this._renderer.bindVertices=Ke.bind(this),this._renderer.unbindVertices=$e.bind(this),this._renderer.flagFill=Je.bind(this),this._renderer.flagStroke=Ze.bind(this),this._renderer.vertices=[],this._renderer.collection=[],this.closed=!!e,this.curved=!!s,this.beginning=0,this.ending=1,this.fill="#fff",this.stroke="#000",this.linewidth=1,this.opacity=1,this.className="",this.visible=!0,this.cap="butt",this.join="miter",this.miter=4,this.vertices=t,this.automatic=!r,this.dashes=[],this.dashes.offset=0}clone(t){let e=new Yt;for(let s=0;s0||this.stroke&&!/(transparent|none)/i.test(this.stroke))if(this.matrix.manual){let{scaleX:d,scaleY:_}=Rt(e.elements[0],e.elements[3],e.elements[1],e.elements[4],e.elements[2],e.elements[5]);typeof d=="number"&&typeof _=="number"&&(s=Math.max(d,_)*(this.linewidth||0)/2)}else s*=typeof this.scale=="number"?this.scale:Math.max(this.scale.x,this.scale.y);if(r<=0)return{width:0,height:0};for(n=0;n=g){this._closed?(s=st(tt,k),r=st(tt-1,k),tt===0&&(s=r,r=tt)):(s=tt,r=Math.min(Math.max(tt-1,0),R)),A=this.vertices[s],S=this.vertices[r],g-=nt,this._lengths[tt]!==0?t=g/this._lengths[tt]:t=0;break}nt+=this._lengths[tt]}if(A===null||S===null)return null;if(A){if(!S)return A}else return S;m=S.controls&&S.controls.right,b=A.controls&&A.controls.left,o=S.x,d=S.y,h=(m||S).x,_=(m||S).y,l=(b||A).x,u=(b||A).y,f=A.x,y=A.y,m&&S.relative&&(h+=S.x,_+=S.y),b&&A.relative&&(l+=A.x,u+=A.y),a=zt(t,o,h,l,f),c=zt(t,d,_,u,y);let F=at(o,h,t),B=at(d,_,t),L=at(h,l,t),M=at(_,u,t),V=at(l,f,t),j=at(u,y,t),X=at(F,L,t),z=at(B,M,t),it=at(L,V,t),ht=at(M,j,t);return E.isObject(e)?(e.x=a,e.y=c,e instanceof T&&(e.controls.left.x=X,e.controls.left.y=z,e.controls.right.x=it,e.controls.right.y=ht,(typeof e.relative!="boolean"||e.relative)&&(e.controls.left.x-=a,e.controls.left.y-=c,e.controls.right.x-=a,e.controls.right.y-=c)),e.t=t,e):(n=new T(a,c,X-a,z-c,it-a,ht-c,this._curved?v.curve:v.line),n.t=t,n)}plot(){if(this.curved)return Ve(this._collection,this.closed),this;for(let t=0;t0&&(n[n.length-1].command=v.line),r=o;return}a=Ye(o,r,t),n=n.concat(a),E.each(a,function(l,f){f<=0&&r.command===v.move?l.command=v.move:l.command=v.line}),h>=e&&(this._closed&&this._automatic?(r=o,a=Ye(o,r,t),n=n.concat(a),E.each(a,function(l,f){f<=0&&r.command===v.move?l.command=v.move:l.command=v.line})):s&&n.push(new T(o.x,o.y)),n[n.length-1].command=s?v.close:v.line),r=o},this),this._automatic=!1,this._curved=!1,this.vertices=n,this}_updateLength(t,e){e||this._update();let s=this.vertices.length,r=s-1,n=!1,a=this.vertices[r],o=0;return typeof this._lengths>"u"&&(this._lengths=[]),E.each(this.vertices,function(h,l){if(l<=0&&!n||h.command===v.move){a=h,this._lengths[l]=0;return}this._lengths[l]=Ee(h,a,t),o+=this._lengths[l],l>=r&&n&&(a=this.vertices[(l+1)%s],this._lengths[l+1]=Ee(h,a,t),o+=this._lengths[l+1]),a=h},this),this._length=o,this._flagLength=!1,this}_update(){if(this._flagVertices){this._automatic&&this.plot(),this._flagLength&&this._updateLength(void 0,!0);let t=this._collection.length,e=this._closed,s=Math.min(this._beginning,this._ending),r=Math.max(this._beginning,this._ending),n=Wt(this,s*this._length),a=Wt(this,r*this._length),o=ys(n),h=bs(a),l,f,c,d,_,u;for(this._renderer.vertices.length=0,u=0;uh&&!f?(_=this._renderer.collection[u].copy(this._collection[u]),this.getPointAt(r,_),_.command=this._renderer.collection[u].command,this._renderer.vertices.push(_),f=_,c=this._collection[u-1],c&&c.controls&&(_.relative?_.controls.right.clear():_.controls.right.copy(_),c.relative?this._renderer.collection[u-1].controls.right.copy(c.controls.right).lerp(w.zero,1-_.t):this._renderer.collection[u-1].controls.right.copy(c.controls.right).lerp(c,1-_.t))):u>=o&&u<=h&&(_=this._renderer.collection[u].copy(this._collection[u]),this._renderer.vertices.push(_),u===h&&He(this,r)?(f=_,!e&&f.controls&&(f.relative?f.controls.right.clear():f.controls.right.copy(f))):u===o&&He(this,s)&&(l=_,l.command=v.move,!e&&l.controls&&(l.relative?l.controls.left.clear():l.controls.left.copy(l))));o>0&&!l&&(u=o-1,_=this._renderer.collection[u].copy(this._collection[u]),this.getPointAt(s,_),_.command=v.move,this._renderer.vertices.unshift(_),d=this._collection[u+1],d&&d.controls&&(_.controls.left.clear(),d.relative?this._renderer.collection[u+1].controls.left.copy(d.controls.left).lerp(w.zero,_.t):(xs.copy(d),this._renderer.collection[u+1].controls.left.copy(d.controls.left).lerp(d,_.t))))}return ot.prototype._update.apply(this,arguments),this}flagReset(){return this._flagVertices=this._flagLength=this._flagFill=this._flagStroke=this._flagLinewidth=this._flagOpacity=this._flagVisible=this._flagCap=this._flagJoin=this._flagMiter=this._flagClip=!1,ot.prototype.flagReset.call(this),this}},O=Yt;x(O,"Properties",["fill","stroke","linewidth","opacity","visible","cap","join","miter","closed","curved","automatic","beginning","ending"]),x(O,"Utils",{getCurveLength:Ee});var Ei={linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(i){this._linewidth=i,this._flagLinewidth=!0}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(i){this._opacity=i,this._flagOpacity=!0}},visible:{enumerable:!0,get:function(){return this._visible},set:function(i){this._visible=i,this._flagVisible=!0}},cap:{enumerable:!0,get:function(){return this._cap},set:function(i){this._cap=i,this._flagCap=!0}},join:{enumerable:!0,get:function(){return this._join},set:function(i){this._join=i,this._flagJoin=!0}},miter:{enumerable:!0,get:function(){return this._miter},set:function(i){this._miter=i,this._flagMiter=!0}},fill:{enumerable:!0,get:function(){return this._fill},set:function(i){(this._fill instanceof H||this._fill instanceof U||this._fill instanceof D||this._fill instanceof N)&&this._fill.unbind(p.Types.change,this._renderer.flagFill),this._fill=i,this._flagFill=!0,(this._fill instanceof H||this._fill instanceof U||this._fill instanceof D||this._fill instanceof N)&&this._fill.bind(p.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(i){(this._stroke instanceof H||this._stroke instanceof U||this._stroke instanceof D||this._stroke instanceof N)&&this._stroke.unbind(p.Types.change,this._renderer.flagStroke),this._stroke=i,this._flagStroke=!0,(this._stroke instanceof H||this._stroke instanceof U||this._stroke instanceof D||this._stroke instanceof N)&&this._stroke.bind(p.Types.change,this._renderer.flagStroke)}},length:{get:function(){return this._flagLength&&this._updateLength(),this._length}},closed:{enumerable:!0,get:function(){return this._closed},set:function(i){this._closed=!!i,this._flagVertices=!0}},curved:{enumerable:!0,get:function(){return this._curved},set:function(i){this._curved=!!i,this._flagVertices=!0}},automatic:{enumerable:!0,get:function(){return this._automatic},set:function(i){if(i===this._automatic)return;this._automatic=!!i;let t=this._automatic?"ignore":"listen";E.each(this.vertices,function(e){e[t]()})}},beginning:{enumerable:!0,get:function(){return this._beginning},set:function(i){this._beginning=i,this._flagVertices=!0}},ending:{enumerable:!0,get:function(){return this._ending},set:function(i){this._ending=i,this._flagVertices=!0}},vertices:{enumerable:!0,get:function(){return this._collection},set:function(i){let t=this._renderer.bindVertices,e=this._renderer.unbindVertices;this._collection&&this._collection.unbind(p.Types.insert,t).unbind(p.Types.remove,e),i instanceof lt?this._collection=i:this._collection=new lt(i||[]),this._collection.bind(p.Types.insert,t).bind(p.Types.remove,e),t(this._collection)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(i){this._mask=i,this._flagMask=!0,E.isObject(i)&&!i.clip&&(i.clip=!0)}},clip:{enumerable:!0,get:function(){return this._clip},set:function(i){this._clip=i,this._flagClip=!0}},dashes:{enumerable:!0,get:function(){return this._dashes},set:function(i){typeof i.offset!="number"&&(i.offset=this.dashes&&this._dashes.offset||0),this._dashes=i}}};function qe(){this._flagVertices=!0,this._flagLength=!0,this.parent&&(this.parent._flagLength=!0)}function Ke(i){let t=i.length;for(;t--;)i[t].bind(p.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()}function $e(i){let t=i.length;for(;t--;)i[t].unbind(p.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()}function Je(){this._flagFill=!0}function Ze(){this._flagStroke=!0}var Qe=class extends O{constructor(t,e,s,r){let n=[new T,new T,new T,new T];super(n,!0,!1,!0);for(let a in Fi)Object.defineProperty(this,a,Fi[a]);this.width=typeof s=="number"?s:1,this.height=typeof r=="number"?r:1,this.origin=new w,typeof t=="number"&&(this.translation.x=t),typeof e=="number"&&(this.translation.y=e),this._update()}_flagWidth=0;_flagHeight=0;_width=0;_height=0;_origin=null;_update(){if(this._flagVertices||this._flagWidth||this._flagHeight){let t=this._width/2,e=this._height/2;!this._closed&&this.vertices.length===4&&this.vertices.push(new T),this.vertices[0].set(-t,-e).sub(this._origin).command=v.move,this.vertices[1].set(t,-e).sub(this._origin).command=v.line,this.vertices[2].set(t,e).sub(this._origin).command=v.line,this.vertices[3].set(-t,e).sub(this._origin).command=v.line,this.vertices[4]&&(this.vertices[4].set(-t,-e).sub(this._origin).command=v.line)}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=!1,super.flagReset.call(this),this}clone(t){let e=new Qe(0,0,this.width,this.height);e.translation.copy(this.translation),e.rotation=this.rotation,e.scale=this.scale,e.skewX=this.skewX,e.skewY=this.skewY,this.matrix.manual&&e.matrix.copy(this.matrix);for(let s=0;s0&&(E.isNaN(this._lastFrame)&&(this._lastFrame=o-1),a=E.performance.now()-this._startTime,d=this._lastFrame+1,h=1e3*(d-this._firstFrame)/this._frameRate,this._loop?a=a%h:a=Math.min(a,h),l=at(this._firstFrame,d,a/h),l=Math.floor(l),l!==this._index&&(this._index=l,l>=this._lastFrame-1&&this._onLastFrame&&this._onLastFrame()));let _=this._index%e,u=Math.floor(this._index/e),y=-r*_+(f-r)/2,b=-n*u+(c-n)/2;y!==t.offset.x&&(t.offset.x=y),b!==t.offset.y&&(t.offset.y=b)}return super._update.call(this),this}flagReset(){return this._flagTexture=this._flagColumns=this._flagRows=this._flagFrameRate=!1,super.flagReset.call(this),this}},Lt=ti;x(Lt,"Properties",["texture","columns","rows","frameRate","index"]);var Ti={texture:{enumerable:!0,get:function(){return this._texture},set:function(i){this._texture=i,this._flagTexture=!0}},columns:{enumerable:!0,get:function(){return this._columns},set:function(i){this._columns=i,this._flagColumns=!0}},rows:{enumerable:!0,get:function(){return this._rows},set:function(i){this._rows=i,this._flagRows=!0}},frameRate:{enumerable:!0,get:function(){return this._frameRate},set:function(i){this._frameRate=i,this._flagFrameRate=!0}},index:{enumerable:!0,get:function(){return this._index},set:function(i){this._index=i,this._flagIndex=!0}}};var ei=Math.cos,ii=Math.sin,le=class extends O{_flagRadius=!1;_radius=0;constructor(t,e,s,r){let n=r?Math.max(r,2):4,a=[];for(let o=0;o2&&(t-=1);let e=4/3*Math.tan(Math.PI/(t*2)),s=this._radius,r=s*e;for(let n=0;n2&&(t-=1);let e=4/3*Math.tan(Math.PI/(this.vertices.length*2)),s=this._width/2,r=this._height/2;for(let n=0;n"u"&&typeof s=="number"&&typeof r=="number"&&(n=Math.floor(Math.min(s,r)/12));let a=[];for(let o=0;o<10;o++)a.push(new T(0,0,0,0,0,0,o===0?v.move:v.curve));super(a);for(let o in Oi)Object.defineProperty(this,o,Oi[o]);this.closed=!0,this.automatic=!1,this._renderer.flagRadius=vs.bind(this),typeof s=="number"&&(this.width=s),typeof r=="number"&&(this.height=r),typeof n=="number"&&(this.radius=n),this._update(),typeof t=="number"&&(this.translation.x=t),typeof e=="number"&&(this.translation.y=e)}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight||this._flagRadius){let t=this._width,e=this._height,s,r;this._radius instanceof w?(s=this._radius.x,r=this._radius.y):(s=this._radius,r=this._radius);let n,a=t/2,o=e/2;n=this.vertices[0],n.x=-(a-s),n.y=-o,n=this.vertices[1],n.x=a-s,n.y=-o,n.controls.left.clear(),n.controls.right.x=s,n.controls.right.y=0,n=this.vertices[2],n.x=a,n.y=-(o-r),n.controls.right.clear(),n.controls.left.clear(),n=this.vertices[3],n.x=a,n.y=o-r,n.controls.left.clear(),n.controls.right.x=0,n.controls.right.y=r,n=this.vertices[4],n.x=a-s,n.y=o,n.controls.right.clear(),n.controls.left.clear(),n=this.vertices[5],n.x=-(a-s),n.y=o,n.controls.left.clear(),n.controls.right.x=-s,n.controls.right.y=0,n=this.vertices[6],n.x=-a,n.y=o-r,n.controls.left.clear(),n.controls.right.clear(),n=this.vertices[7],n.x=-a,n.y=-(o-r),n.controls.left.clear(),n.controls.right.x=0,n.controls.right.y=-r,n=this.vertices[8],n.x=-(a-s),n.y=-o,n.controls.left.clear(),n.controls.right.clear(),n=this.vertices[9],n.copy(this.vertices[8])}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=this._flagRadius=!1,super.flagReset.call(this),this}clone(t){let e=this.width,s=this.height,r=this.radius,n=new fe(0,0,e,s,r);n.translation.copy(this.translation),n.rotation=this.rotation,n.scale=this.scale,n.skewX=this.skewX,n.skewY=this.skewY,this.matrix.manual&&n.matrix.copy(this.matrix);for(let a=0;a"u"||typeof a>"u"||(t[n]=a.replace(/\s/,""))}return t}function Ts(i){let t={},e=Ms(i),s=Math.max(e.length,i.style.length);for(let r=0;r=0&&t.splice(r,1)}return t}function Cs(i,t){let e=t.split(/[\s,]/),s=-parseFloat(e[0]),r=-parseFloat(e[1]),n=parseFloat(e[2]),a=parseFloat(e[3]);if(s&&r)for(let c=0;c"u"&&/none/i.test(s.display))||typeof s.visibility>"u"&&/hidden/i.test(s.visibility);for(h in s)switch(l=s[h],h){case"gradientTransform":if(/none/i.test(l)||(o=i.gradientTransform&&i.gradientTransform.baseVal&&i.gradientTransform.baseVal.length>0?i.gradientTransform.baseVal[0].matrix:i.getCTM?i.getCTM():null,o===null))break;switch(d=Rt(o),t._renderer.type){case"linear-gradient":ji(d,t.left),ji(d,t.right);break;case"radial-gradient":t.center.x+=d.translateX,t.center.y+=d.translateY,t.focal.x+=d.translateX,t.focal.y+=d.translateY,t.radius*=Math.max(d.scaleX,d.scaleY);break}break;case"transform":if(/none/i.test(l)||(o=i.transform&&i.transform.baseVal&&i.transform.baseVal.length>0?i.transform.baseVal[0].matrix:i.getCTM?i.getCTM():null,o===null))break;G.AutoCalculateImportedMatrices?(d=Rt(o),t.translation.set(d.translateX,d.translateY),t.rotation=Math.PI*(d.rotation/180),t.scale=new w(d.scaleX,d.scaleY),_=parseFloat((s.x+"").replace("px")),u=parseFloat((s.y+"").replace("px")),_&&(t.translation.x=_),u&&(t.translation.y=u)):(o=i.getCTM(),t._matrix.manual=!0,t._matrix.set(o.a,o.b,o.c,o.d,o.e,o.f));break;case"visible":if(t instanceof q){t._visible=l;break}t.visible=l;break;case"stroke-linecap":if(t instanceof q){t._cap=l;break}t.cap=l;break;case"stroke-linejoin":if(t instanceof q){t._join=l;break}t.join=l;break;case"stroke-miterlimit":if(t instanceof q){t._miter=l;break}t.miter=l;break;case"stroke-width":if(t instanceof q){t._linewidth=parseFloat(l);break}t.linewidth=parseFloat(l);break;case"opacity":case"stroke-opacity":case"fill-opacity":if(t instanceof q){t._opacity=parseFloat(l);break}t.opacity=parseFloat(l);break;case"clip-path":if(Ft.cssBackgroundImage.test(l)&&(y=l.replace(Ft.cssBackgroundImage,"$1"),K.defs.current&&K.defs.current.contains(y)&&(m=K.defs.current.get(y),m&&m.childNodes.length>0)))switch(m=m.childNodes[0],g=ce(m.nodeName),t.mask=K[g].call(this,m,{}),t._renderer.type){case"text":case"path":t.position.add(t.mask.position),t.mask.position.clear();break}break;case"fill":case"stroke":f=(t instanceof q?"_":"")+h,Ft.cssBackgroundImage.test(l)?(y=l.replace(Ft.cssBackgroundImage,"$1"),K.defs.current&&K.defs.current.contains(y)?(m=K.defs.current.get(y),m.object||(g=ce(m.nodeName),m.object=K[g].call(this,m,{})),m=m.object):(b=Os(this),m=b.getById(y)),t[f]=m):t[f]=l;break;case"id":t.id=l;break;case"class":case"className":t.classList=l.split(" "),t._flagClassName=!0;break;case"x":case"y":if(k=t instanceof H,R=t instanceof U,A=t instanceof D,k||R||A)break;l.match("[a-z%]$")&&!l.endsWith("px")&&(S=new et("only pixel values are supported with the "+h+" attribute."),console.warn(S.name,S.message)),t.translation[h]=parseFloat(l);break;case"font-family":t instanceof ut&&(t.family=l);break;case"font-size":t instanceof ut&&(t.size=l);break;case"font-weight":t instanceof ut&&(t.weight=l);break;case"font-style":t instanceof ut&&(t.style=l);break;case"text-decoration":t instanceof ut&&(t.decoration=l);break;case"line-height":t instanceof ut&&(t.leading=l);break}return Object.keys(i.dataset).length&&(t.dataset=i.dataset),s}function Ls(i,t){for(let e=0,s=i.childNodes.length;e with no href."),console.warn(e.name,e.message),null;let r=s.slice(1);if(!K.defs.current.contains(r))return e=new et("unable to find element for reference "+s+"."),console.warn(e.name,e.message),null;let a=K.defs.current.get(r).cloneNode(!0);for(let h=0;h1&&(m=1);break;case"m":case"l":case"t":u.length>2&&(m=2);break;case"s":case"q":u.length>4&&(m=4);break;case"c":u.length>6&&(m=6);break;case"a":u.length>7&&(m=7);break}if(m){for(g=0,k=u.length,A=0;g0)switch(y){case"m":R="l";break;case"M":R="L";break}S.push(R+u.slice(g,g+m).join(" ")),A++}f=Array.prototype.concat.apply(f,S)}else f.push(d)}),E.each(f,function(d,_){let u,y,b,m=d[0],g=m.toLowerCase();l=d.slice(1).trim().match(Ft.path),n=m===g;let k,R,A,S,F,B,L,M,V,j,X,z,it,ht,tt,_t,nt;switch(g){case"z":if(_>=c)r=!0;else{y=o.x,b=o.y,u=new T(y,b,void 0,void 0,void 0,void 0,v.close);for(let Tt=s.length-1;Tt>=0;Tt--){let Ct=s[Tt];if(/m/i.test(Ct.command)){o=Ct;break}}}break;case"m":case"l":h=void 0,y=parseFloat(l[0]),b=parseFloat(l[1]),u=new T(y,b,void 0,void 0,void 0,void 0,/m/i.test(g)?v.move:v.line),n&&u.addSelf(o),o=u;break;case"h":case"v":j=/h/i.test(g)?"x":"y",X=/x/i.test(j)?"y":"x",u=new T(void 0,void 0,void 0,void 0,void 0,void 0,v.line),u[j]=parseFloat(l[0]),u[X]=o[X],n&&(u[j]+=o[j]),o=u;break;case"c":case"s":k=o.x,R=o.y,h||(h=new w),/c/i.test(g)?(A=parseFloat(l[0]),S=parseFloat(l[1]),F=parseFloat(l[2]),B=parseFloat(l[3]),L=parseFloat(l[4]),M=parseFloat(l[5])):(V=be(o,h,n),A=V.x,S=V.y,F=parseFloat(l[0]),B=parseFloat(l[1]),L=parseFloat(l[2]),M=parseFloat(l[3])),n&&(A+=k,S+=R,F+=k,B+=R,L+=k,M+=R),o.controls.right.set(A-o.x,S-o.y),u=new T(L,M,F-L,B-M,void 0,void 0,v.curve),o=u,h=u.controls.left;break;case"t":case"q":k=o.x,R=o.y,h||(h=new w),/q/i.test(g)?(A=parseFloat(l[0]),S=parseFloat(l[1]),F=parseFloat(l[0]),B=parseFloat(l[1]),L=parseFloat(l[2]),M=parseFloat(l[3])):(V=be(o,h,n),A=V.x,S=V.y,F=V.x,B=V.y,L=parseFloat(l[0]),M=parseFloat(l[1])),n&&(A+=k,S+=R,F+=k,B+=R,L+=k,M+=R),o.controls.right.set((A-o.x)*.33,(S-o.y)*.33),u=new T(L,M,F-L,B-M,void 0,void 0,v.curve),o=u,h=u.controls.left;break;case"a":k=o.x,R=o.y,it=parseFloat(l[0]),ht=parseFloat(l[1]),tt=parseFloat(l[2]),_t=parseFloat(l[3]),nt=parseFloat(l[4]),L=parseFloat(l[5]),M=parseFloat(l[6]),n&&(L+=k,M+=R),z=new T(L,M),z.command=v.arc,z.rx=it,z.ry=ht,z.xAxisRotation=tt,z.largeArcFlag=_t,z.sweepFlag=nt,u=z,o=z,h=void 0;break}u&&(Array.isArray(u)?s=s.concat(u):s.push(u))})}e=new O(s,r,void 0,!0).noStroke(),e.fill="black";let a=e.getBoundingClientRect(!0);return a.centroid={x:a.left+a.width/2,y:a.top+a.height/2},E.each(e.vertices,function(o){o.subSelf(a.centroid)}),wt.call(this,i,e,t),e.translation.addSelf(a.centroid),e},circle:function(i,t){let e=parseFloat(i.getAttribute("cx")),s=parseFloat(i.getAttribute("cy")),r=parseFloat(i.getAttribute("r")),n=new Ot(0,0,r).noStroke();return n.fill="black",wt.call(this,i,n,t),n.translation.x=e,n.translation.y=s,n},ellipse:function(i,t){let e=parseFloat(i.getAttribute("cx")),s=parseFloat(i.getAttribute("cy")),r=parseFloat(i.getAttribute("rx")),n=parseFloat(i.getAttribute("ry")),a=new Pt(0,0,r,n).noStroke();return a.fill="black",wt.call(this,i,a,t),a.translation.x=e,a.translation.y=s,a},rect:function(i,t){let e=parseFloat(i.getAttribute("rx")),s=parseFloat(i.getAttribute("ry"));if(!E.isNaN(e)||!E.isNaN(s))return K["rounded-rect"](i);let r=parseFloat(i.getAttribute("width")),n=parseFloat(i.getAttribute("height")),a=r/2,o=n/2,h=new pt(0,0,r,n).noStroke();return h.fill="black",wt.call(this,i,h,t),h.translation.x+=a,h.translation.y+=o,h},"rounded-rect":function(i,t){let e=parseFloat(i.getAttribute("rx"))||0,s=parseFloat(i.getAttribute("ry"))||0,r=parseFloat(i.getAttribute("width")),n=parseFloat(i.getAttribute("height")),a=r/2,o=n/2,h=new w(e,s),l=new It(0,0,r,n,h).noStroke();return l.fill="black",wt.call(this,i,l,t),l.translation.x+=a,l.translation.y+=o,l},line:function(i,t){let e=parseFloat(i.getAttribute("x1")),s=parseFloat(i.getAttribute("y1")),r=parseFloat(i.getAttribute("x2")),n=parseFloat(i.getAttribute("y2")),a=new jt(e,s,r,n).noFill();return wt.call(this,i,a,t),a},lineargradient:function(i,t){let e=i.getAttribute("gradientUnits"),s=i.getAttribute("spreadMethod");e||(e="objectBoundingBox"),s||(s="pad");let r=parseFloat(i.getAttribute("x1")||0),n=parseFloat(i.getAttribute("y1")||0),a=parseFloat(i.getAttribute("x2")||0),o=parseFloat(i.getAttribute("y2")||0),h=(a+r)/2,l=(o+n)/2;/userSpaceOnUse/i.test(e)&&(r-=h,n-=l,a-=h,o-=l);let f=[];for(let d=0;d1?g[1]:void 0),b===null?(g=m?m.match(/stop-opacity:\s?([0-9.-]*)/):!1,b=g&&g.length>1?parseFloat(g[1]):1):b=parseFloat(b),f.push(new ct(u,y,b))}let c=new U(r,n,a,o,f);return c.spread=s,c.units=e,wt.call(this,i,c,t),c},radialgradient:function(i,t){let e=i.getAttribute("gradientUnits"),s=i.getAttribute("spreadMethod");e||(e="objectBoundingBox"),s||(s="pad");let r=parseFloat(i.getAttribute("cx"))||0,n=parseFloat(i.getAttribute("cy"))||0,a=parseFloat(i.getAttribute("r")),o=parseFloat(i.getAttribute("fx")),h=parseFloat(i.getAttribute("fy"));E.isNaN(o)&&(o=r),E.isNaN(h)&&(h=n);let l=Math.abs(r+o)/2,f=Math.abs(n+h)/2;/userSpaceOnUse/i.test(e)&&(r-=l,n-=f,o-=l,h-=f);let c=[];for(let _=0;_1?k[1]:void 0),m===null?(k=g?g.match(/stop-opacity:\s?([0-9.-]*)/):!1,m=k&&k.length>1?parseFloat(k[1]):1):m=parseFloat(m),c.push(new ct(y,b,m))}let d=new D(r,n,a,c,o,h);return d.spread=s,d.units=e,wt.call(this,i,d,t),d},text:function(i,t){let e=Ss(i.getAttribute("text-anchor"))||"left",s=Es(i)||"baseline",r=i.textContent,n=new ut(r);return wt.call(this,i,n,t),n.alignment=e,n.baseline=s,n},clippath:function(i,t){return K.defs.current&&!K.defs.current.contains(i.id)&&K.defs.current.add(i.id,i),null},image:function(i,t){let e,s=i.getAttribute("href")||i.getAttribute("xlink:href");if(!s)return e=new et("encountered with no href."),console.warn(e.name,e.message),null;let r=parseFloat(i.getAttribute("x"))||0,n=parseFloat(i.getAttribute("y"))||0,a=parseFloat(i.getAttribute("width")),o=parseFloat(i.getAttribute("height")),h=new Lt(s,r,n);return E.isNaN(a)||(h.width=a),E.isNaN(o)||(h.height=o),wt.call(this,i,h,t),h}};function ai(i,t){let e=new XMLHttpRequest;return e.open("GET",i),e.onreadystatechange=function(){e.readyState===4&&e.status===200&&t(e.responseText)},e.send(),e}var Te=class extends pt{_flagTextures=!1;_flagFrameRate=!1;_flagIndex=!1;_amount=1;_duration=0;_index=0;_startTime=0;_playing=!1;_firstFrame=0;_lastFrame=0;_loop=!0;_textures=null;_frameRate=0;_origin=null;constructor(t,e,s,r){super(e,s,0,0);for(let n in Vi)Object.defineProperty(this,n,Vi[n]);this._renderer.flagTextures=Ps.bind(this),this._renderer.bindTextures=Is.bind(this),this._renderer.unbindTextures=Bs.bind(this),this.noStroke(),this.noFill(),Array.isArray(t)?this.textures=t.map(zi.bind(this)):this.textures=[zi(t)],this.origin=new w,this._update(),typeof r=="number"?this.frameRate=r:this.frameRate=Te.DefaultFrameRate,this.index=0}play(t,e,s){return this._playing=!0,this._firstFrame=0,this._lastFrame=this.amount-1,this._startTime=E.performance.now(),typeof t=="number"&&(this._firstFrame=t),typeof e=="number"&&(this._lastFrame=e),typeof s=="function"?this._onLastFrame=s:delete this._onLastFrame,this._index!==this._firstFrame&&(this._startTime-=1e3*Math.abs(this._index-this._firstFrame)/this._frameRate),this}pause(){return this._playing=!1,this}stop(){return this._playing=!1,this._index=this._firstFrame,this}clone(t){let e=new Te(this.textures,this.translation.x,this.translation.y,this.frameRate);return e._loop=this._loop,this._playing&&e.play(),t&&t.add(e),e}toObject(){let t=super.toObject.call(this);return t.textures=this.textures.map(function(e){return e.toObject()}),t.frameRate=this.frameRate,t.index=this.index,t._firstFrame=this._firstFrame,t._lastFrame=this._lastFrame,t._loop=this._loop,t}_update(){let t=this._textures,e,s,r,n,a,o,h,l;return t&&(this._flagTextures&&(this._amount=t.length),this._flagFrameRate&&(this._duration=1e3*this._amount/this._frameRate),this._playing&&this._frameRate>0?(n=this._amount,E.isNaN(this._lastFrame)&&(this._lastFrame=n-1),r=E.performance.now()-this._startTime,l=this._lastFrame+1,a=1e3*(l-this._firstFrame)/this._frameRate,this._loop?r=r%a:r=Math.min(r,a),h=at(this._firstFrame,l,r/a),h=Math.floor(h),h!==this._index&&(this._index=h,o=t[this._index],o.loaded&&(e=o.image.width,s=o.image.height,this.width!==e&&(this.width=e),this.height!==s&&(this.height=s),this.fill=o,h>=this._lastFrame-1&&this._onLastFrame&&this._onLastFrame()))):(this._flagIndex||!(this.fill instanceof N))&&(o=t[this._index],o.loaded&&(e=o.image.width,s=o.image.height,this.width!==e&&(this.width=e),this.height!==s&&(this.height=s)),this.fill=o)),super._update.call(this),this}flagReset(){return this._flagTextures=this._flagFrameRate=!1,super.flagReset.call(this),this}},Vt=Te;x(Vt,"Properties",["textures","frameRate","index"]),x(Vt,"DefaultFrameRate",30);var Vi={frameRate:{enumerable:!0,get:function(){return this._frameRate},set:function(i){this._frameRate=i,this._flagFrameRate=!0}},index:{enumerable:!0,get:function(){return this._index},set:function(i){this._index=i,this._flagIndex=!0}},textures:{enumerable:!0,get:function(){return this._textures},set:function(i){let t=this._renderer.bindTextures,e=this._renderer.unbindTextures;this._textures&&this._textures.unbind(p.Types.insert,t).unbind(p.Types.remove,e),this._textures=new lt((i||[]).slice(0)),this._textures.bind(p.Types.insert,t).bind(p.Types.remove,e),t(this._textures)}}};function Ps(){this._flagTextures=!0}function Is(i){let t=i.length;for(;t--;)i[t].bind(p.Types.change,this._renderer.flagTextures);this._renderer.flagTextures()}function Bs(i){let t=i.length;for(;t--;)i[t].unbind(p.Types.change,this._renderer.flagTextures);this._renderer.flagTextures()}function zi(i){if(i instanceof N)return i;if(typeof i=="string")return new N(i)}var ue=class extends O{_flagStartAngle=!1;_flagEndAngle=!1;_flagInnerRadius=!1;_flagOuterRadius=!1;_startAngle=0;_endAngle=J;_innerRadius=0;_outerRadius=0;constructor(t,e,s,r,n,a,o){let h=o||G.Resolution*3,l=[];for(let f=0;f0,o=this.vertices,h=a?o.length/2:o.length,l,f=0,c,d,_,u,y,b,m,g,k;for(n?h--:a||(h-=2),c=0,d=h-1;c=n&&l<=a&&(h=this._collection[l],this._renderer.collection.push(h),this._renderer.vertices[o*2+0]=h.x,this._renderer.vertices[o*2+1]=h.y,o++)}return super._update.apply(this,arguments),this}flagReset(){return this._flagVertices=this._flagLength=this._flagFill=this._flagStroke=this._flagLinewidth=this._flagOpacity=this._flagVisible=this._flagSize=this._flagSizeAttenuation=!1,super.flagReset.call(this),this}},Kt=qt;x(Kt,"Properties",["fill","stroke","linewidth","opacity","visible","size","sizeAttenuation","beginning","ending"]);var Di={linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(i){this._linewidth=i,this._flagLinewidth=!0}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(i){this._opacity=i,this._flagOpacity=!0}},visible:{enumerable:!0,get:function(){return this._visible},set:function(i){this._visible=i,this._flagVisible=!0}},size:{enumerable:!0,get:function(){return this._size},set:function(i){this._size=i,this._flagSize=!0}},sizeAttenuation:{enumerable:!0,get:function(){return this._sizeAttenuation},set:function(i){this._sizeAttenuation=i,this._flagSizeAttenuation=!0}},fill:{enumerable:!0,get:function(){return this._fill},set:function(i){(this._fill instanceof H||this._fill instanceof U||this._fill instanceof D||this._fill instanceof N)&&this._fill.unbind(p.Types.change,this._renderer.flagFill),this._fill=i,this._flagFill=!0,(this._fill instanceof H||this._fill instanceof U||this._fill instanceof D||this._fill instanceof N)&&this._fill.bind(p.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(i){(this._stroke instanceof H||this._stroke instanceof U||this._stroke instanceof D||this._stroke instanceof N)&&this._stroke.unbind(p.Types.change,this._renderer.flagStroke),this._stroke=i,this._flagStroke=!0,(this._stroke instanceof H||this._stroke instanceof U||this._stroke instanceof D||this._stroke instanceof N)&&this._stroke.bind(p.Types.change,this._renderer.flagStroke)}},length:{get:function(){return this._flagLength&&this._updateLength(),this._length}},beginning:{enumerable:!0,get:function(){return this._beginning},set:function(i){this._beginning=i,this._flagVertices=!0}},ending:{enumerable:!0,get:function(){return this._ending},set:function(i){this._ending=i,this._flagVertices=!0}},vertices:{enumerable:!0,get:function(){return this._collection},set:function(i){let t=this._renderer.bindVertices,e=this._renderer.unbindVertices;this._collection&&this._collection.unbind(p.Types.insert,t).unbind(p.Types.remove,e),i instanceof lt?this._collection=i:this._collection=new lt(i||[]),this._collection.bind(p.Types.insert,t).bind(p.Types.remove,e),t(this._collection)}},dashes:{enumerable:!0,get:function(){return this._dashes},set:function(i){typeof i.offset!="number"&&(i.offset=this.dashes&&this._dashes.offset||0),this._dashes=i}}};var Vs=Math.cos,zs=Math.sin,de=class extends O{_flagWidth=!1;_flagHeight=!1;_flagSides=!1;_radius=0;_width=0;_height=0;_sides=0;constructor(t,e,s,r){r=Math.max(r||0,3),super();for(let n in Wi)Object.defineProperty(this,n,Wi[n]);this.closed=!0,this.automatic=!1,typeof s=="number"&&(this.radius=s),typeof r=="number"&&(this.sides=r),this._update(),typeof t=="number"&&(this.translation.x=t),typeof e=="number"&&(this.translation.y=e)}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight||this._flagSides){let t=this._sides,e=t+1,s=this.vertices.length;s>t&&(this.vertices.splice(t-1,s-t),s=t);for(let r=0;r=s?this.vertices.push(new T(o,h)):this.vertices[r].set(o,h),this.vertices[r].command=r===0?v.move:v.line}}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=this._flagSides=!1,super.flagReset.call(this),this}clone(t){let e=new de(0,0,0,this.sides);e.translation.copy(this.translation),e.rotation=this.rotation,e.scale=this.scale,e.skewX=this.skewX,e.skewY=this.skewY,e.width=this.width,e.height=this.height,this.matrix.manual&&e.matrix.copy(this.matrix);for(let s=0;st&&(this.vertices.splice(t-1,s-t),s=t);for(let r=0;r=s?this.vertices.push(new T(h,l)):this.vertices[r].set(h,l),this.vertices[r].command=r===0?v.move:v.line}}return super._update.call(this),this}flagReset(){return this._flagInnerRadius=this._flagOuterRadius=this._flagSides=!1,super.flagReset.call(this),this}clone(t){let e=this.innerRadius,s=this.outerRadius,r=this.sides,n=new _e(0,0,e,s,r);n.translation.copy(this.translation),n.rotation=this.rotation,n.scale=this.scale,n.skewX=this.skewX,n.skewY=this.skewY,this.matrix.manual&&n.matrix.copy(this.matrix);for(let a=0;a0&&C.setAttributes(s,t),s},setAttributes:function(i,t){let e=Object.keys(t);for(let s=0;s=s&&t&&(o.command===v.curve&&(c=r,g=o.controls&&o.controls.right||o,k=c.controls&&c.controls.left||c,o.relative?(d=$(g.x+o.x),_=$(g.y+o.y)):(d=$(g.x),_=$(g.y)),c.relative?(u=$(k.x+c.x),y=$(k.y+c.y)):(u=$(k.x),y=$(k.y)),L=$(c.x),M=$(c.y),f+=" C "+d+" "+_+" "+u+" "+y+" "+L+" "+M),o.command!==v.close&&(f+=" Z")),n+=f+" "}return n},pointsToString:function(i,t){let e="",s=t*.5;for(let r=0;r"u"&&(i.defs._flagUpdate=!0,delete this._renderer.hasFillEffect)),this._stroke&&this._stroke._renderer&&(this._renderer.hasStrokeEffect=!0,this._stroke._update(),C[this._stroke._renderer.type].render.call(this._stroke,i,!0)),this._flagStroke&&(t.stroke=this._stroke&&this._stroke.id?"url(#"+this._stroke.id+")":this._stroke,this._renderer.hasStrokeEffect&&typeof this._stroke.id>"u"&&(i.defs._flagUpdate=!0,delete this._renderer.hasStrokeEffect)),this._flagLinewidth&&(t["stroke-width"]=this._linewidth),this._flagOpacity&&(t["stroke-opacity"]=this._opacity,t["fill-opacity"]=this._opacity),this._flagClassName&&(t.class=this.classList.join(" ")),this._flagVisible&&(t.visibility=this._visible?"visible":"hidden"),this._flagCap&&(t["stroke-linecap"]=this._cap),this._flagJoin&&(t["stroke-linejoin"]=this._join),this._flagMiter&&(t["stroke-miterlimit"]=this._miter),this.dashes&&this.dashes.length>0&&(t["stroke-dasharray"]=this.dashes.join(" "),t["stroke-dashoffset"]=this.dashes.offset||0),this._renderer.elem?C.setAttributes(this._renderer.elem,t):(t.id=this._id,this._renderer.elem=C.createElement("path",t),i.appendChild(this._renderer.elem)),this._flagClip){let s=C.getClip(this,i),r=this._renderer.elem;this._clip?(r.removeAttribute("id"),s.setAttribute("id",this.id),s.appendChild(r)):(s.removeAttribute("id"),r.setAttribute("id",this.id),this.parent._renderer.elem.appendChild(r))}return this._flagMask&&(this._mask?(C[this._mask._renderer.type].render.call(this._mask,i),this._renderer.elem.setAttribute("clip-path","url(#"+this._mask.id+")")):this._renderer.elem.removeAttribute("clip-path")),this.flagReset()}},points:{render:function(i){if(this._opacity===0&&!this._flagOpacity)return this;this._update();let t={};if((this._matrix.manual||this._flagMatrix)&&(t.transform="matrix("+this._matrix.toString()+")"),this._flagId&&(t.id=this._id),this._flagVertices||this._flagSize||this._flagSizeAttenuation){let s=this._size;if(!this._sizeAttenuation){let n=this.worldMatrix.elements,a=Rt(n[0],n[3],n[1],n[4],n[2],n[5]);s/=Math.max(a.scaleX,a.scaleY)}let r=C.pointsToString(this._renderer.collection,s);t.d=r}return this._fill&&this._fill._renderer&&(this._renderer.hasFillEffect=!0,this._fill._update(),C[this._fill._renderer.type].render.call(this._fill,i,!0)),this._flagFill&&(t.fill=this._fill&&this._fill.id?"url(#"+this._fill.id+")":this._fill,this._renderer.hasFillEffect&&typeof this._fill.id>"u"&&(i.defs._flagUpdate=!0,delete this._renderer.hasFillEffect)),this._stroke&&this._stroke._renderer&&(this._renderer.hasStrokeEffect=!0,this._stroke._update(),C[this._stroke._renderer.type].render.call(this._stroke,i,!0)),this._flagStroke&&(t.stroke=this._stroke&&this._stroke.id?"url(#"+this._stroke.id+")":this._stroke,this._renderer.hasStrokeEffect&&typeof this._stroke.id>"u"&&(i.defs._flagUpdate=!0,delete this._renderer.hasStrokeEffect)),this._flagLinewidth&&(t["stroke-width"]=this._linewidth),this._flagOpacity&&(t["stroke-opacity"]=this._opacity,t["fill-opacity"]=this._opacity),this._flagClassName&&(t.class=this.classList.join(" ")),this._flagVisible&&(t.visibility=this._visible?"visible":"hidden"),this.dashes&&this.dashes.length>0&&(t["stroke-dasharray"]=this.dashes.join(" "),t["stroke-dashoffset"]=this.dashes.offset||0),this._renderer.elem?C.setAttributes(this._renderer.elem,t):(t.id=this._id,this._renderer.elem=C.createElement("path",t),i.appendChild(this._renderer.elem)),this.flagReset()}},text:{render:function(i){this._update();let t={};if((this._matrix.manual||this._flagMatrix)&&(t.transform="matrix("+this._matrix.toString()+")"),this._flagId&&(t.id=this._id),this._flagFamily&&(t["font-family"]=this._family),this._flagSize&&(t["font-size"]=this._size),this._flagLeading&&(t["line-height"]=this._leading),this._flagAlignment&&(t["text-anchor"]=C.alignments[this._alignment]||this._alignment),this._flagBaseline&&(t["dominant-baseline"]=C.baselines[this._baseline]||this._baseline),this._flagStyle&&(t["font-style"]=this._style),this._flagWeight&&(t["font-weight"]=this._weight),this._flagDecoration&&(t["text-decoration"]=this._decoration),this._flagDirection&&(t.direction=this._direction),this._fill&&this._fill._renderer&&(this._renderer.hasFillEffect=!0,this._fill._update(),C[this._fill._renderer.type].render.call(this._fill,i,!0)),this._flagFill&&(t.fill=this._fill&&this._fill.id?"url(#"+this._fill.id+")":this._fill,this._renderer.hasFillEffect&&typeof this._fill.id>"u"&&(i.defs._flagUpdate=!0,delete this._renderer.hasFillEffect)),this._stroke&&this._stroke._renderer&&(this._renderer.hasStrokeEffect=!0,this._stroke._update(),C[this._stroke._renderer.type].render.call(this._stroke,i,!0)),this._flagStroke&&(t.stroke=this._stroke&&this._stroke.id?"url(#"+this._stroke.id+")":this._stroke,this._renderer.hasStrokeEffect&&typeof this._stroke.id>"u"&&(i.defs._flagUpdate=!0,delete this._renderer.hasStrokeEffect)),this._flagLinewidth&&(t["stroke-width"]=this._linewidth),this._flagOpacity&&(t.opacity=this._opacity),this._flagClassName&&(t.class=this.classList.join(" ")),this._flagVisible&&(t.visibility=this._visible?"visible":"hidden"),this.dashes&&this.dashes.length>0&&(t["stroke-dasharray"]=this.dashes.join(" "),t["stroke-dashoffset"]=this.dashes.offset||0),this._renderer.elem?C.setAttributes(this._renderer.elem,t):(t.id=this._id,this._renderer.elem=C.createElement("text",t),i.appendChild(this._renderer.elem)),this._flagClip){let s=C.getClip(this,i),r=this._renderer.elem;this._clip?(r.removeAttribute("id"),s.setAttribute("id",this.id),s.appendChild(r)):(s.removeAttribute("id"),r.setAttribute("id",this.id),this.parent._renderer.elem.appendChild(r))}return this._flagMask&&(this._mask?(C[this._mask._renderer.type].render.call(this._mask,i),this._renderer.elem.setAttribute("clip-path","url(#"+this._mask.id+")")):this._renderer.elem.removeAttribute("clip-path")),this._flagValue&&(this._renderer.elem.textContent=this._value),this.flagReset()}},"linear-gradient":{render:function(i,t){t||this._update();let e={};if(this._flagId&&(e.id=this._id),this._flagEndPoints&&(e.x1=this.left._x,e.y1=this.left._y,e.x2=this.right._x,e.y2=this.right._y),this._flagSpread&&(e.spreadMethod=this._spread),this._flagUnits&&(e.gradientUnits=this._units),this._renderer.elem?C.setAttributes(this._renderer.elem,e):(e.id=this._id,this._renderer.elem=C.createElement("linearGradient",e)),this._renderer.elem.parentNode===null&&i.defs.appendChild(this._renderer.elem),this._flagStops){let s=this._renderer.elem.childNodes.length!==this.stops.length;if(s)for(;this._renderer.elem.lastChild;)this._renderer.elem.removeChild(this._renderer.elem.lastChild);for(let r=0;r0&&(e.x*=-1),e.y>0&&(e.y*=-1)),(this._flagScale||this._flagLoaded||this._flagRepeat)&&(e.width=0,e.height=0,r)){switch(s.width=e.width=r.width,s.height=e.height=r.height,this._repeat){case"no-repeat":e.width+=1,e.height+=1;break}this._scale instanceof w?(e.width*=this._scale.x,e.height*=this._scale.y):(e.width*=this._scale,e.height*=this._scale)}return(this._flagScale||this._flagLoaded)&&(this._renderer.image?C.setAttributes(this._renderer.image,s):this._renderer.image=C.createElement("image",s)),this._renderer.elem?Object.keys(e).length!==0&&C.setAttributes(this._renderer.elem,e):(e.id=this._id,e.patternUnits="userSpaceOnUse",this._renderer.elem=C.createElement("pattern",e)),this._renderer.elem.parentNode===null&&i.defs.appendChild(this._renderer.elem),this._renderer.elem&&this._renderer.image&&!this._renderer.appended&&(this._renderer.elem.appendChild(this._renderer.image),this._renderer.appended=!0),this.flagReset()}}},ge=class extends p{constructor(t){super(),this.domElement=t.domElement||C.createElement("svg"),this.scene=new q,this.scene.parent=this,this.defs=C.createElement("defs"),this.defs._flagUpdate=!1,this.domElement.appendChild(this.defs),this.domElement.defs=this.defs,this.domElement.style.overflow="hidden"}setSize(t,e){return this.width=t,this.height=e,C.setAttributes(this.domElement,{width:t,height:e}),this.trigger(p.Types.resize,t,e)}render(){return C.group.render.call(this.scene,this.domElement),C.defs.update(this.domElement),this}};x(ge,"Utils",C);var mt={create:function(i,t,e){let s=i.createShader(i[e]);if(i.shaderSource(s,t),i.compileShader(s),!i.getShaderParameter(s,i.COMPILE_STATUS)){let n=i.getShaderInfoLog(s);throw i.deleteShader(s),new et("unable to compile shader "+s+": "+n)}return s},types:{vertex:"VERTEX_SHADER",fragment:"FRAGMENT_SHADER"},path:{vertex:` precision mediump float; attribute vec2 a_position; uniform mat3 u_matrix; uniform vec2 u_resolution; uniform vec4 u_rect; varying vec2 v_textureCoords; void main() { vec2 rectCoords = (a_position * (u_rect.zw - u_rect.xy)) + u_rect.xy; vec2 projected = (u_matrix * vec3(rectCoords, 1.0)).xy; vec2 normal = projected / u_resolution; vec2 clipspace = (normal * 2.0) - 1.0; gl_Position = vec4(clipspace * vec2(1.0, -1.0), 0.0, 1.0); v_textureCoords = a_position; } `,fragment:` precision mediump float; uniform sampler2D u_image; varying vec2 v_textureCoords; void main() { vec4 texel = texture2D(u_image, v_textureCoords); if (texel.a == 0.0) { discard; } gl_FragColor = texel; } `},points:{vertex:` precision mediump float; attribute vec2 a_position; uniform float u_size; uniform mat3 u_matrix; uniform vec2 u_resolution; varying vec2 v_textureCoords; void main() { vec2 projected = (u_matrix * vec3(a_position, 1.0)).xy; vec2 normal = projected / u_resolution; vec2 clipspace = (normal * 2.0) - 1.0; gl_PointSize = u_size; gl_Position = vec4(clipspace * vec2(1.0, -1.0), 0.0, 1.0); v_textureCoords = a_position; } `,fragment:` precision mediump float; uniform sampler2D u_image; void main() { vec4 texel = texture2D(u_image, gl_PointCoord); if (texel.a == 0.0) { discard; } gl_FragColor = texel; } `}};var Me=xt.Multiply,Ws=[1,0,0,0,1,0,0,0,1],Bt=new yt(9),Xs=vt.Utils,Hi=new w,oi=new yt([0,0,1,0,0,1,0,1,1,0,1,1]),P={precision:.9,isHidden:/(undefined|none|transparent)/i,canvas:W.document?W.document.createElement("canvas"):{getContext:function(){}},alignments:{left:"start",middle:"center",right:"end"},matrix:new xt,group:{removeChild:function(i,t){if(i.children)for(let e=0;e0&&(g.lineDashOffset=X.offset||0,g.setLineDash(X));let nt,Tt,Ct,Qt,te,ee,ie,se;g.save(),g.scale(R.x,R.y),g.translate(tt,_t),g.beginPath();for(let kt=0;kt=it&&j&&(r=nt,c=Y.controls&&Y.controls.right||w.zero,d=r.controls&&r.controls.left||w.zero,Y._relative?(o=c.x+Y.x,h=c.y+Y.y):(o=c.x,h=c.y),r._relative?(n=d.x+r.x,a=d.y+r.y):(n=d.x,a=d.y),_=r.x,u=r.y,g.bezierCurveTo(o,h,n,a,_,u));break;case v.line:g.lineTo(_,u);break;case v.move:nt=Y,g.moveTo(_,u);break}}j&&g.closePath(),P.isHidden.test(F)||(y=F._renderer&&F._renderer.offset,y&&(g.save(),g.translate(-F._renderer.offset.x,-F._renderer.offset.y),g.scale(F._renderer.scale.x,F._renderer.scale.y)),g.fill(),y&&g.restore()),P.isHidden.test(A)||(y=A._renderer&&A._renderer.offset,y&&(g.save(),g.translate(-A._renderer.offset.x,-A._renderer.offset.y),g.scale(A._renderer.scale.x,A._renderer.scale.y),g.lineWidth=S/A._renderer.scale.x),g.stroke(),y&&g.restore()),g.restore()},getBoundingClientRect:function(i,t,e){let s=1/0,r=-1/0,n=1/0,a=-1/0,o,h;i.forEach(function(l){let f=l.x,c=l.y,d=l.controls,_,u,y,b,m,g;n=Math.min(c,n),s=Math.min(f,s),r=Math.max(f,r),a=Math.max(c,a),l.controls&&(m=d.left,g=d.right,!(!m||!g)&&(_=l._relative?m.x+f:m.x,u=l._relative?m.y+c:m.y,y=l._relative?g.x+f:g.x,b=l._relative?g.y+c:g.y,!(!_||!u||!y||!b)&&(n=Math.min(u,b,n),s=Math.min(_,y,s),r=Math.max(_,y,r),a=Math.max(u,b,a))))}),typeof t=="number"&&(n-=t,s-=t,r+=t,a+=t),o=r-s,h=a-n,e.top=n,e.left=s,e.right=r,e.bottom=a,e.width=o,e.height=h,e.centroid||(e.centroid={}),e.centroid.x=-s,e.centroid.y=-n},render:function(i,t,e){if(!this._visible||!this._opacity)return this;this._update();let s=e||this.parent,r=t[this._renderer.type],n=s._matrix.manual||s._flagMatrix,a=this._matrix.manual||this._flagMatrix,o=this._renderer.parent!==s,h=this._flagVertices||this._flagFill||this._fill instanceof U&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagEndPoints)||this._fill instanceof D&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagRadius||this._fill._flagCenter||this._fill._flagFocal)||this._fill instanceof N&&(this._fill._flagLoaded&&this._fill.loaded||this._fill._flagImage||this._fill._flagVideo||this._fill._flagRepeat||this._fill._flagOffset||this._fill._flagScale)||this._stroke instanceof U&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagEndPoints)||this._stroke instanceof D&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagRadius||this._stroke._flagCenter||this._stroke._flagFocal)||this._stroke instanceof N&&(this._stroke._flagLoaded&&this._stroke.loaded||this._stroke._flagImage||this._stroke._flagVideo||this._stroke._flagRepeat||this._stroke._flagOffset||this._fill._flagScale)||this._flagStroke||this._flagLinewidth||this._flagOpacity||s._flagOpacity||this._flagVisible||this._flagCap||this._flagJoin||this._flagMiter||this._flagScale||this.dashes&&this.dashes.length>0||!this._renderer.texture;if((n||a||o)&&(this._renderer.matrix||(this._renderer.matrix=new yt(9)),this._matrix.toTransformArray(!0,Bt),Me(Bt,s._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof w||(this._renderer.scale=new w),this._scale instanceof w?(this._renderer.scale.x=this._scale.x*s._renderer.scale.x,this._renderer.scale.y=this._scale.y*s._renderer.scale.y):(this._renderer.scale.x=this._scale*s._renderer.scale.x,this._renderer.scale.y=this._scale*s._renderer.scale.y),o&&(this._renderer.parent=s)),this._mask&&(i.clear(i.STENCIL_BUFFER_BIT),i.enable(i.STENCIL_TEST),i.stencilFunc(i.ALWAYS,1,0),i.stencilOp(i.KEEP,i.KEEP,i.REPLACE),i.colorMask(!1,!1,!1,!1),P[this._mask._renderer.type].render.call(this._mask,i,t,this),i.stencilFunc(i.EQUAL,1,255),i.stencilOp(i.KEEP,i.KEEP,i.KEEP),i.colorMask(!0,!0,!0,!0)),h?(this._renderer.rect||(this._renderer.rect={}),this._renderer.opacity=this._opacity*s._renderer.opacity,P.path.getBoundingClientRect(this._renderer.vertices,this._linewidth,this._renderer.rect),P.updateTexture.call(P,i,this)):(this._fill&&this._fill._update&&this._fill._update(),this._stroke&&this._stroke._update&&this._stroke._update()),this._clip&&!e||!this._renderer.texture)return this;t.current!==r&&(i.useProgram(r),i.bindBuffer(i.ARRAY_BUFFER,t.buffers.position),i.vertexAttribPointer(r.position,2,i.FLOAT,!1,0,0),i.enableVertexAttribArray(r.position),i.bufferData(i.ARRAY_BUFFER,oi,i.STATIC_DRAW),t.resolution.flagged||i.uniform2f(i.getUniformLocation(r,"u_resolution"),t.resolution.width,t.resolution.height),t.current=r),t.resolution.flagged&&i.uniform2f(i.getUniformLocation(r,"u_resolution"),t.resolution.width,t.resolution.height),i.bindTexture(i.TEXTURE_2D,this._renderer.texture);let l=this._renderer.rect;return i.uniformMatrix3fv(r.matrix,!1,this._renderer.matrix),i.uniform4f(r.rect,l.left,l.top,l.right,l.bottom),i.drawArrays(i.TRIANGLES,0,6),this._mask&&i.disable(i.STENCIL_TEST),this.flagReset()}},points:{updateCanvas:function(i,t){let e,s=this.canvas,r=this.ctx,n=i.renderer.ratio,a=t._stroke,o=t._linewidth,h=t._fill,l=t._renderer.opacity||t._opacity,f=t.dashes,c=t._size*n,d=c;P.isHidden.test(a)||(d+=o),s.width=Ie(d),s.height=s.width;let _=d/s.width,u=s.width/2,y=s.height/2;r.clearRect(0,0,s.width,s.height),h&&(typeof h=="string"?r.fillStyle=h:(P[h._renderer.type].render.call(h,r,t),r.fillStyle=h._renderer.effect)),a&&(typeof a=="string"?r.strokeStyle=a:(P[a._renderer.type].render.call(a,r,t),r.strokeStyle=a._renderer.effect),o&&(r.lineWidth=o/_)),typeof l=="number"&&(r.globalAlpha=l),f&&f.length>0&&(r.lineDashOffset=f.offset||0,r.setLineDash(f)),r.save(),r.translate(u,y),r.scale(P.precision,P.precision),r.beginPath(),r.arc(0,0,c/_*.5,0,J),r.restore(),closed&&r.closePath(),P.isHidden.test(h)||(e=h._renderer&&h._renderer.offset,e&&(r.save(),r.translate(-h._renderer.offset.x,-h._renderer.offset.y),r.scale(h._renderer.scale.x,h._renderer.scale.y)),r.fill(),e&&r.restore()),P.isHidden.test(a)||(e=a._renderer&&a._renderer.offset,e&&(r.save(),r.translate(-a._renderer.offset.x,-a._renderer.offset.y),r.scale(a._renderer.scale.x,a._renderer.scale.y),r.lineWidth=o/a._renderer.scale.x),r.stroke(),e&&r.restore())},render:function(i,t,e){if(!this._visible||!this._opacity)return this;this._update();let s=this._size,r=e||this.parent,n=t[this._renderer.type],a=this._sizeAttenuation,o=this._stroke,h=this._linewidth,l=r._matrix.manual||r._flagMatrix,f=this._matrix.manual||this._flagMatrix,c=this._renderer.parent!==r,d=this._renderer.vertices,_=this._renderer.collection.length,u=this._flagVertices,y=this._flagFill||this._fill instanceof U&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagEndPoints)||this._fill instanceof D&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagRadius||this._fill._flagCenter||this._fill._flagFocal)||this._fill instanceof N&&(this._fill._flagLoaded&&this._fill.loaded||this._fill._flagImage||this._fill._flagVideo||this._fill._flagRepeat||this._fill._flagOffset||this._fill._flagScale)||this._stroke instanceof U&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagEndPoints)||this._stroke instanceof D&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagRadius||this._stroke._flagCenter||this._stroke._flagFocal)||this._stroke instanceof N&&(this._stroke._flagLoaded&&this._stroke.loaded||this._stroke._flagImage||this._stroke._flagVideo||this._stroke._flagRepeat||this._stroke._flagOffset||this._fill._flagScale)||this._flagStroke||this._flagLinewidth||this._flagOpacity||r._flagOpacity||this._flagVisible||this._flagScale||this.dashes&&this.dashes.length>0||!this._renderer.texture;if((l||f||c)&&(this._renderer.matrix||(this._renderer.matrix=new yt(9)),this._matrix.toTransformArray(!0,Bt),Me(Bt,r._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof w||(this._renderer.scale=new w),this._scale instanceof w?(this._renderer.scale.x=this._scale.x*r._renderer.scale.x,this._renderer.scale.y=this._scale.y*r._renderer.scale.y):(this._renderer.scale.x=this._scale*r._renderer.scale.x,this._renderer.scale.y=this._scale*r._renderer.scale.y),c&&(this._renderer.parent=r)),u){let b=this._renderer.positionBuffer;b&&i.deleteBuffer(b),this._renderer.positionBuffer=i.createBuffer(),i.bindBuffer(i.ARRAY_BUFFER,this._renderer.positionBuffer),i.vertexAttribPointer(n.position,2,i.FLOAT,!1,0,0),i.enableVertexAttribArray(n.position),i.bufferData(i.ARRAY_BUFFER,d,i.STATIC_DRAW)}return y?(this._renderer.opacity=this._opacity*r._renderer.opacity,P.updateTexture.call(P,i,this)):(this._fill&&this._fill._update&&this._fill._update(),this._stroke&&this._stroke._update&&this._stroke._update()),this._clip&&!e||!this._renderer.texture?this:(P.isHidden.test(o)||(s+=h),s/=P.precision,a&&(s*=Math.max(this._renderer.scale.x,this._renderer.scale.y)),t.current!==n&&(i.useProgram(n),t.resolution.flagged||i.uniform2f(i.getUniformLocation(n,"u_resolution"),t.resolution.width,t.resolution.height),t.current=n),t.resolution.flagged&&i.uniform2f(i.getUniformLocation(n,"u_resolution"),t.resolution.width,t.resolution.height),i.bindTexture(i.TEXTURE_2D,this._renderer.texture),i.uniformMatrix3fv(n.matrix,!1,this._renderer.matrix),i.uniform1f(n.size,s*t.resolution.ratio),i.drawArrays(i.POINTS,0,_),this.flagReset())}},text:{updateCanvas:function(i,t){let e=this.canvas,s=this.ctx,r=i.renderer.ratio,n=Hi.copy(t._renderer.scale).multiply(r),a=t._stroke,o=t._linewidth,h=t._fill,l=t._renderer.opacity||t._opacity,f=t.dashes,c=t._decoration,d=t._direction;e.width=Math.max(Math.ceil(t._renderer.rect.width*n.x),1),e.height=Math.max(Math.ceil(t._renderer.rect.height*n.y),1);let _=t._renderer.rect.centroid,u=_.x,y=_.y,b,m,g,k,R,A,S,F,B,L,M,V=h._renderer&&h._renderer.offset&&a._renderer&&a._renderer.offset;if(s.clearRect(0,0,e.width,e.height),V||(s.font=[t._style,t._weight,t._size+"px/"+t._leading+"px",t._family].join(" ")),s.textAlign="center",s.textBaseline="middle",s.textDirection=d,h&&(typeof h=="string"?s.fillStyle=h:(P[h._renderer.type].render.call(h,s,t),s.fillStyle=h._renderer.effect)),a&&(typeof a=="string"?s.strokeStyle=a:(P[a._renderer.type].render.call(a,s,t),s.strokeStyle=a._renderer.effect),o&&(s.lineWidth=o)),typeof l=="number"&&(s.globalAlpha=l),f&&f.length>0&&(s.lineDashOffset=f.offset||0,s.setLineDash(f)),s.save(),s.scale(n.x,n.y),s.translate(u,y),P.isHidden.test(h)||(h._renderer&&h._renderer.offset?(A=h._renderer.scale.x,S=h._renderer.scale.y,s.save(),s.translate(-h._renderer.offset.x,-h._renderer.offset.y),s.scale(A,S),b=t._size/h._renderer.scale.y,m=t._leading/h._renderer.scale.y,s.font=[t._style,t._weight,b+"px/",m+"px",t._family].join(" "),g=h._renderer.offset.x/h._renderer.scale.x,k=h._renderer.offset.y/h._renderer.scale.y,s.fillText(t.value,g,k),s.restore()):s.fillText(t.value,0,0)),P.isHidden.test(a)||(a._renderer&&a._renderer.offset?(A=a._renderer.scale.x,S=a._renderer.scale.y,s.save(),s.translate(-a._renderer.offset.x,-a._renderer.offset.y),s.scale(A,S),b=t._size/a._renderer.scale.y,m=t._leading/a._renderer.scale.y,s.font=[t._style,t._weight,b+"px/",m+"px",t._family].join(" "),g=a._renderer.offset.x/a._renderer.scale.x,k=a._renderer.offset.y/a._renderer.scale.y,R=o/a._renderer.scale.x,s.lineWidth=R,s.strokeText(t.value,g,k),s.restore()):s.strokeText(t.value,0,0)),/(underline|strikethrough)/i.test(c)){let j=s.measureText(t.value);switch(c){case"underline":B=j.actualBoundingBoxDescent,M=j.actualBoundingBoxDescent;break;case"strikethrough":B=0,M=0;break}F=-j.width/2,L=j.width/2,s.lineWidth=Math.max(Math.floor(t._size/15),1),s.strokeStyle=s.fillStyle,s.beginPath(),s.moveTo(F,B),s.lineTo(L,M),s.stroke()}s.restore()},getBoundingClientRect:function(i,t){let e=P.ctx;e.font=[i._style,i._weight,i._size+"px/"+i._leading+"px",i._family].join(" "),e.textAlign="center",e.textBaseline=vt.Utils.baselines[i._baseline]||i._baseline;let s=e.measureText(i._value),r=s.width,n=1.15*(s.actualBoundingBoxAscent+s.actualBoundingBoxDescent);this._linewidth&&!P.isHidden.test(this._stroke)&&(r+=this._linewidth*2,n+=this._linewidth*2);let a=r/2,o=n/2;switch(P.alignments[i._alignment]||i._alignment){case P.alignments.left:i.direction==="ltr"?(t.left=0,t.right=r):(t.left=-r,t.right=0);break;case P.alignments.right:i.direction==="ltr"?(t.left=-r,t.right=0):(t.left=0,t.right=r);break;default:t.left=-a,t.right=a}switch(i._baseline){case"bottom":t.top=-n,t.bottom=0;break;case"top":t.top=0,t.bottom=n;break;case"baseline":t.top=-o*1.5,t.bottom=o*.5;break;default:t.top=-o,t.bottom=o}t.width=r,t.height=n,t.centroid||(t.centroid={}),t.centroid.x=a,t.centroid.y=o},render:function(i,t,e){if(!this._visible||!this._opacity)return this;this._update();let s=e||this.parent,r=t[this._renderer.type],n=s._matrix.manual||s._flagMatrix,a=this._matrix.manual||this._flagMatrix,o=this._renderer.parent!==s,h=this._flagVertices||this._flagFill||this._fill instanceof U&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagEndPoints)||this._fill instanceof D&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagRadius||this._fill._flagCenter||this._fill._flagFocal)||this._fill instanceof N&&(this._fill._flagLoaded&&this._fill.loaded||this._fill._flagImage||this._fill._flagVideo||this._fill._flagRepeat||this._fill._flagOffset||this._fill._flagScale)||this._stroke instanceof U&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagEndPoints)||this._stroke instanceof D&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagRadius||this._stroke._flagCenter||this._stroke._flagFocal)||this._stroke instanceof N&&(this._stroke._flagLoaded&&this._stroke.loaded||this._stroke._flagImage||this._stroke._flagVideo||this._stroke._flagRepeat||this._stroke._flagOffset||this._fill._flagScale)||this._flagStroke||this._flagLinewidth||this._flagOpacity||s._flagOpacity||this._flagVisible||this._flagScale||this._flagValue||this._flagFamily||this._flagSize||this._flagLeading||this._flagAlignment||this._flagBaseline||this._flagStyle||this._flagWeight||this._flagDecoration||this.dashes&&this.dashes.length>0||!this._renderer.texture;if((n||a||o)&&(this._renderer.matrix||(this._renderer.matrix=new yt(9)),this._matrix.toTransformArray(!0,Bt),Me(Bt,s._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof w||(this._renderer.scale=new w),this._scale instanceof w?(this._renderer.scale.x=this._scale.x*s._renderer.scale.x,this._renderer.scale.y=this._scale.y*s._renderer.scale.y):(this._renderer.scale.x=this._scale*s._renderer.scale.x,this._renderer.scale.y=this._scale*s._renderer.scale.y),o&&(this._renderer.parent=s)),this._mask&&(i.clear(i.STENCIL_BUFFER_BIT),i.enable(i.STENCIL_TEST),i.stencilFunc(i.ALWAYS,1,0),i.stencilOp(i.KEEP,i.KEEP,i.REPLACE),i.colorMask(!1,!1,!1,!1),P[this._mask._renderer.type].render.call(this._mask,i,t,this),i.stencilFunc(i.EQUAL,1,255),i.stencilOp(i.KEEP,i.KEEP,i.KEEP),i.colorMask(!0,!0,!0,!0)),h?(this._renderer.rect||(this._renderer.rect={}),this._renderer.opacity=this._opacity*s._renderer.opacity,P.text.getBoundingClientRect(this,this._renderer.rect),P.updateTexture.call(P,i,this)):(this._fill&&this._fill._update&&this._fill._update(),this._stroke&&this._stroke._update&&this._stroke._update()),this._clip&&!e||!this._renderer.texture)return this;t.current!==r&&(i.useProgram(r),i.bindBuffer(i.ARRAY_BUFFER,t.buffers.position),i.vertexAttribPointer(r.position,2,i.FLOAT,!1,0,0),i.enableVertexAttribArray(r.position),i.bufferData(i.ARRAY_BUFFER,oi,i.STATIC_DRAW),t.resolution.flagged||i.uniform2f(i.getUniformLocation(r,"u_resolution"),t.resolution.width,t.resolution.height),t.current=r),t.resolution.flagged&&i.uniform2f(i.getUniformLocation(r,"u_resolution"),t.resolution.width,t.resolution.height),i.bindTexture(i.TEXTURE_2D,this._renderer.texture);let l=this._renderer.rect;return i.uniformMatrix3fv(r.matrix,!1,this._renderer.matrix),i.uniform4f(r.rect,l.left,l.top,l.right,l.bottom),i.drawArrays(i.TRIANGLES,0,6),this._mask&&i.disable(i.STENCIL_TEST),this.flagReset()}},"linear-gradient":{render:function(i,t){if(!(!i.canvas.getContext("2d")||!t)){if(this._update(),!this._renderer.effect||this._flagEndPoints||this._flagStops||this._flagUnits){let e,s=this.left._x,r=this.left._y,n=this.right._x,a=this.right._y;/objectBoundingBox/i.test(this._units)&&(e=t.getBoundingClientRect(!0),s=(s-.5)*e.width,r=(r-.5)*e.height,n=(n-.5)*e.width,a=(a-.5)*e.height),this._renderer.effect=i.createLinearGradient(s,r,n,a);for(let o=0;o"u"?Ut(a):s,this.domElement.width=t*this.ratio,this.domElement.height=e*this.ratio,E.isObject(this.domElement.style)&&E.extend(this.domElement.style,{width:t+"px",height:e+"px"}),this._renderer.matrix[0]=this._renderer.matrix[4]=this._renderer.scale=this.ratio,this._flagMatrix=!0,r=t*this.ratio,n=e*this.ratio,a.viewport(0,0,r,n),this.programs.resolution.width=r,this.programs.resolution.height=n,this.programs.resolution.ratio=this.ratio,this.programs.resolution.flagged=!0,this.trigger(p.Types.resize,t,e,s)}render(){let t=this.ctx;return this.overdraw||t.clear(t.COLOR_BUFFER_BIT),P.group.render.call(this.scene,t,this.programs),this._flagMatrix=!1,this.programs.resolution.flagged=!0,this}};x(pe,"Utils",P);var Hs=E.extend({Error:et,getRatio:Ut,read:K,xhr:ai},E,ft,ze,Be),Zt=class{_events=new p;get _bound(){return this._events._bound}set _bound(t){this._events._bound=t}addEventListener(){return this._events.addEventListener.apply(this,arguments)}on(){return this._events.addEventListener.apply(this,arguments)}bind(){return this._events.addEventListener.apply(this,arguments)}removeEventListener(){return this._events.removeEventListener.apply(this,arguments)}off(){return this._events.removeEventListener.apply(this,arguments)}unbind(){return this._events.removeEventListener.apply(this,arguments)}dispatchEvent(){return this._events.dispatchEvent.apply(this,arguments)}trigger(){return this._events.dispatchEvent.apply(this,arguments)}listen(){return this._events.listen.apply(this,arguments)}ignore(){return this._events.ignore.apply(this,arguments)}type="";renderer=null;scene=null;width=0;height=0;frameCount=0;timeDelta=0;playing=!1;constructor(t){let e=E.defaults(t||{},{fullscreen:!1,fitted:!1,width:640,height:480,type:Zt.Types.svg,autostart:!1});if(E.each(e,function(s,r){/fullscreen/i.test(r)||/autostart/i.test(r)||(this[r]=s)},this),E.isElement(e.domElement)){let s=e.domElement.tagName.toLowerCase();/^(CanvasRenderer-canvas|WebGLRenderer-canvas|SVGRenderer-svg)$/.test(this.type+"-"+s)||(this.type=Zt.Types[s])}this.renderer=new Zt[this.type](this),this.setPlaying(e.autostart),this.frameCount=0,e.fullscreen?(this.fit=Ys.bind(this),this.fit.domElement=window,this.fit.attached=!0,E.extend(document.body.style,{overflow:"hidden",margin:0,padding:0,top:0,left:0,right:0,bottom:0,position:"fixed"}),E.extend(this.renderer.domElement.style,{display:"block",top:0,left:0,right:0,bottom:0,position:"fixed"}),dt.bind(this.fit.domElement,"resize",this.fit),this.fit()):e.fitted?(this.fit=Gs.bind(this),E.extend(this.renderer.domElement.style,{display:"block"})):E.isElement(e.domElement)||(this.renderer.setSize(e.width,e.height,this.ratio),this.width=e.width,this.height=e.height),this.renderer.bind(p.Types.resize,qs.bind(this)),this.scene=this.renderer.scene,Zt.Instances.push(this),e.autostart&&me.init()}appendTo(t){return t.appendChild(this.renderer.domElement),this.fit&&(this.fit.domElement!==window&&(this.fit.domElement=t,this.fit.attached=!1),this.update()),this}play(){return this.playing=!0,me.init(),this.trigger(p.Types.play)}pause(){return this.playing=!1,this.trigger(p.Types.pause)}setPlaying(t){this.playing=t}release(t){let e,s,r;if(!E.isObject(t))return this.release(this.scene);if(typeof t.unbind=="function"&&t.unbind(),t.vertices)for(typeof t.vertices.unbind=="function"&&t.vertices.unbind(),e=0;e