diff --git a/build/two.js b/build/two.js index badb6f6a..fbbb4c45 100644 --- a/build/two.js +++ b/build/two.js @@ -738,7 +738,7 @@ var Two = (() => { canvas: "CanvasRenderer" }, Version: "v0.8.13", - PublishDate: "2024-02-20T20:04:05.976Z", + PublishDate: "2024-02-22T06:23:43.441Z", Identifier: "two-", Resolution: 12, AutoCalculateImportedMatrices: true, @@ -6121,15 +6121,15 @@ var Two = (() => { function getTagName(tag) { return tag.replace(/svg:/ig, "").toLowerCase(); } - function applyTransformsToVector(transforms, vector2) { - vector2.x += transforms.translateX; - vector2.y += transforms.translateY; - vector2.x *= transforms.scaleX; - vector2.y *= transforms.scaleY; + function applyTransformsToVector(transforms, vector3) { + vector3.x += transforms.translateX; + vector3.y += transforms.translateY; + vector3.x *= transforms.scaleX; + vector3.y *= transforms.scaleY; if (transforms.rotation !== 0) { - const l = vector2.length(); - vector2.x = l * Math.cos(transforms.rotation); - vector2.y = l * Math.sin(transforms.rotation); + const l = vector3.length(); + vector3.x = l * Math.cos(transforms.rotation); + vector3.y = l * Math.sin(transforms.rotation); } } function extractCSSText(text, styles) { @@ -9026,6 +9026,7 @@ var Two = (() => { var identity = [1, 0, 0, 0, 1, 0, 0, 0, 1]; var transformation = new NumArray(9); var CanvasUtils = Renderer.Utils; + var vector2 = new Vector(); var quad = new NumArray([ 0, 0, @@ -9129,13 +9130,14 @@ var Two = (() => { } }, path: { - updateCanvas: function(elem) { + updateCanvas: function(gl, elem) { let prev, a, c, ux, uy, vx, vy, ar, bl, br, cl, x, y; let isOffset; const commands = elem._renderer.vertices; const canvas3 = this.canvas; const ctx = this.ctx; - const scale = elem._renderer.scale; + const ratio = gl.renderer.ratio; + const scale = vector2.copy(elem._renderer.scale).multiply(ratio); const stroke = elem._stroke; const linewidth = elem._linewidth; const fill = elem._fill; @@ -9448,16 +9450,17 @@ var Two = (() => { } }, points: { - updateCanvas: function(elem) { + updateCanvas: function(gl, elem) { let isOffset; const canvas3 = this.canvas; const ctx = this.ctx; + const ratio = gl.renderer.ratio; const stroke = elem._stroke; const linewidth = elem._linewidth; const fill = elem._fill; const opacity = elem._renderer.opacity || elem._opacity; const dashes = elem.dashes; - const size = elem._size; + const size = elem._size * ratio; let dimension = size; if (!webgl.isHidden.test(stroke)) { dimension += linewidth; @@ -9631,12 +9634,13 @@ var Two = (() => { } }, text: { - updateCanvas: function(elem) { + updateCanvas: function(gl, elem) { const canvas3 = this.canvas; const ctx = this.ctx; - const scale = elem._renderer.scale; + const ratio = gl.renderer.ratio; + const scale = vector2.copy(elem._renderer.scale).multiply(ratio); const stroke = elem._stroke; - const linewidth = elem._linewidth * scale; + const linewidth = elem._linewidth; const fill = elem._fill; const opacity = elem._renderer.opacity || elem._opacity; const dashes = elem.dashes; @@ -10016,7 +10020,7 @@ var Two = (() => { } }, updateTexture: function(gl, elem) { - this[elem._renderer.type].updateCanvas.call(webgl, elem); + this[elem._renderer.type].updateCanvas.call(webgl, gl, elem); if (this.canvas.width <= 0 || this.canvas.height <= 0) { if (elem._renderer.texture) { gl.deleteTexture(elem._renderer.texture); @@ -10028,10 +10032,11 @@ var Two = (() => { elem._renderer.texture = gl.createTexture(); } gl.bindTexture(gl.TEXTURE_2D, elem._renderer.texture); + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, this.canvas); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR); - gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, this.canvas); }, program: { create: function(gl, shaders2) { @@ -10050,6 +10055,25 @@ var Two = (() => { return program; } }, + extensions: { + init: function(gl) { + const extensions = {}; + const names = [ + "EXT_texture_filter_anisotropic", + "WEBGL_compressed_texture_s3tc", + "OES_texture_float_linear", + "WEBGL_multisampled_render_to_texture" + ]; + for (let i = 0; i < names.length; i++) { + const name = names[i]; + extensions[name] = webgl.extensions.get(gl, name); + } + return extensions; + }, + get: function(gl, name) { + return gl.getExtension(name) || gl.getExtension(`MOZ_${name}`) || gl.getExtension(`WEBKIT_${name}`); + } + }, TextureRegistry: new Registry() }; webgl.ctx = webgl.canvas.getContext("2d"); @@ -10102,6 +10126,8 @@ var Two = (() => { }; program = this.programs.path = webgl.program.create(gl, [vs, fs]); this.programs.text = this.programs.path; + gl.extensions = webgl.extensions.init(gl); + gl.renderer = this; program.position = gl.getAttribLocation(program, "a_position"); program.matrix = gl.getUniformLocation(program, "u_matrix"); program.rect = gl.getUniformLocation(program, "u_rect"); diff --git a/build/two.min.js b/build/two.min.js index ff62ead9..42534b6d 100644 --- a/build/two.min.js +++ b/build/two.min.js @@ -21,7 +21,7 @@ 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 me=Object.defineProperty;var Yi=Object.getOwnPropertyDescriptor;var qi=Object.getOwnPropertyNames;var Gi=Object.prototype.hasOwnProperty;var Ki=(i,t,e)=>t in i?me(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e;var Me=(i,t)=>{for(var e in t)me(i,e,{get:t[e],enumerable:!0})},$i=(i,t,e,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of qi(t))!Gi.call(i,r)&&r!==e&&me(i,r,{get:()=>t[r],enumerable:!(s=Yi(t,r))||s.enumerable});return i};var Ji=i=>$i(me({},"__esModule",{value:!0}),i);var v=(i,t,e)=>(Ki(i,typeof t!="symbol"?t+"":t,e),e);var Gs={};Me(Gs,{default:()=>P});var w={move:"M",line:"L",curve:"C",arc:"A",close:"Z"};var Ie={};Me(Ie,{HALF_PI:()=>J,NumArray:()=>yt,TWO_PI:()=>$,decomposeMatrix:()=>St,getComputedMatrix:()=>Oe,getPoT:()=>Pe,lerp:()=>nt,mod:()=>it,setMatrix:()=>Le,toFixed:()=>K});var H;typeof window<"u"?H=window:typeof global<"u"?H=global:typeof self<"u"&&(H=self);var li,$=Math.PI*2,J=Math.PI*.5;function St(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 Le(i){li=i}function Oe(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;rjt,getAnchorsFromArcData:()=>ts,getComponentOnCubicBezier:()=>Ut,getControlPoints:()=>ui,getCurveBoundingBox:()=>Ne,getCurveFromPoints:()=>je,getCurveLength:()=>Be,getReflection:()=>ye,integrate:()=>ci,subdivide:()=>se});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 R={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 E=t,M,B,C,T=e[0]||0,j=e[1]||0,z=e[2]||0;return M=E[0]*T+E[1]*j+E[2]*z,B=E[3]*T+E[4]*j+E[5]*z,C=E[6]*T+E[7]*j+E[8]*z,[M,B,C]}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],m=e[2],b=e[3],g=e[4],y=e[5],x=e[6],S=e[7],A=e[8];return s=s||new yt(9),s[0]=r*_+n*b+a*x,s[1]=r*u+n*g+a*S,s[2]=r*m+n*y+a*A,s[3]=o*_+h*b+l*x,s[4]=o*u+h*g+l*S,s[5]=o*m+h*y+l*A,s[6]=f*_+c*b+d*x,s[7]=f*u+c*g+d*S,s[8]=f*m+c*y+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 V=n[0]*t+n[1]*e+n[2]*s,ct=n[3]*t+n[4]*e+n[5]*s,ut=n[6]*t+n[7]*e+n[8]*s;return[V,ct,ut]}let f=this.elements,c=[t,e,s,r,n,a,o,h,l],d=f[0],_=f[1],u=f[2],m=f[3],b=f[4],g=f[5],y=f[6],x=f[7],S=f[8],A=c[0],E=c[1],M=c[2],B=c[3],C=c[4],T=c[5],j=c[6],z=c[7],X=c[8];return this.elements[0]=d*A+_*B+u*j,this.elements[1]=d*E+_*C+u*z,this.elements[2]=d*M+_*T+u*X,this.elements[3]=m*A+b*B+g*j,this.elements[4]=m*E+b*C+g*z,this.elements[5]=m*M+b*T+g*X,this.elements[6]=y*A+x*B+S*j,this.elements[7]=y*E+x*C+S*z,this.elements[8]=y*M+x*T+S*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,m=s*d+r*_+n*u;return m?(m=1/m,t.elements[0]=d*m,t.elements[1]=(-c*r+n*f)*m,t.elements[2]=(h*r-n*o)*m,t.elements[3]=_*m,t.elements[4]=(c*s-n*l)*m,t.elements[5]=(-h*s+n*a)*m,t.elements[6]=u*m,t.elements[7]=(-f*s+r*l)*m,t.elements[8]=(o*s-r*a)*m,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=rs(t),s=ns(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 ze.length=0,this.toTransformArray(t,ze),ze.map(K).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;v(xt,"Identity",[1,0,0,0,1,0,0,0,1]);Le(xt);var at=class extends Rt{_flagMatrix=!0;_flagScale=!1;_matrix=null;_worldMatrix=null;_position=null;_rotation=0;_scale=1;_skewX=0;_skewY=0;constructor(){super();for(let t in be)Object.defineProperty(this,t,be[t]);this._renderer.flagMatrix=pi.bind(this),this.isShape=!0,this.id=Y.Identifier+Y.uniqueId(),this.matrix=new xt,this.worldMatrix=new xt,this.position=new k,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 be.position.get.apply(this,arguments)}set translation(t){be.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 at;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 k?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}},be={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 k&&this._scale.unbind(p.Types.change,this._renderer.flagMatrix),this._scale=i,this._scale instanceof k&&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 Oe(this,this._worldMatrix),this._worldMatrix},set:function(i){this._worldMatrix=i}}};function pi(){this._flagMatrix=!0}var ot=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 re(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,R.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 De=[],He=Math.max,as=Math.min,bi=Math.abs,we=Math.sin,ke=Math.cos,os=Math.acos,Se=Math.sqrt,tt={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){tt[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=Ae(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&&tt[s._renderer.type].render.call(s,i,!0),this._opacity>0&&this._scale!==0)for(let a=0;a0&&(i.lineDashOffset=rt.offset||0,i.setLineDash(rt)),i.beginPath();let Ct,te,ee,ie,kt,Q,oi;for(let Lt=0;Lt=m&&d&&(x=S,j=y.controls&&y.controls.right||k.zero,z=x.controls&&x.controls.left||k.zero,y._relative?(M=j.x+y.x,B=j.y+y.y):(M=j.x,B=j.y),x._relative?(A=z.x+x.x,E=z.y+x.y):(A=z.x,E=z.y),X=x.x,V=x.y,i.bezierCurveTo(M,B,A,E,X,V));break;case w.line:i.lineTo(X,V);break;case w.move:S=y,i.moveTo(X,V);break}return d&&i.closePath(),!ut&&!e&&(tt.isHidden.test(a)||(dt=a._renderer&&a._renderer.offset,dt&&(i.save(),i.translate(-a._renderer.offset.x,-a._renderer.offset.y),i.scale(a._renderer.scale.x,a._renderer.scale.y)),i.fill(),dt&&i.restore()),tt.isHidden.test(r)||(dt=r._renderer&&r._renderer.offset,dt&&(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(),dt&&i.restore())),Z||i.restore(),ut&&!e&&i.clip(),rt&&rt.length>0&&i.setLineDash(De),this.flagReset()}},points:{render:function(i,t,e){let s,r,n,a,o,h,l,f,c,d,_,u,m,b,g,y;if(y=this.parent&&this.parent._renderer?this.parent._renderer.opacity:1,o=this._opacity*(y||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,m=Ae(s),g=this.dashes,l=this._size,m||(i.save(),i.transform(s[0],s[3],s[1],s[4],s[2],s[5])),a&&(typeof a=="string"?i.fillStyle=a:(tt[a._renderer.type].render.call(a,i,this),i.fillStyle=a._renderer.effect)),r&&(typeof r=="string"?i.strokeStyle=r:(tt[r._renderer.type].render.call(r,i,this),i.strokeStyle=r._renderer.effect),n&&(i.lineWidth=n)),typeof o=="number"&&(i.globalAlpha=o),g&&g.length>0&&(i.lineDashOffset=g.offset||0,i.setLineDash(g)),i.beginPath();let x=l*.5,S;this._sizeAttenuation||(S=this.worldMatrix.elements,S=St(S[0],S[3],S[1],S[4],S[2],S[5]),x/=Math.max(S.scaleX,S.scaleY));for(let A=0;A0&&i.setLineDash(De),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,_=Ae(h),u=c._renderer&&c._renderer.offset&&l._renderer&&l._renderer.offset,m=this.dashes,b=tt.alignments[this._alignment]||this._alignment,g=tt.baselines[this._baseline]||this._baseline,y,x,S,A,E,M,B,C,T,j,z;if(_||(i.save(),i.transform(h[0],h[3],h[1],h[4],h[2],h[5])),a&&tt[a._renderer.type].render.call(a,i,!0),u||(i.font=[this._style,this._weight,this._size+"px/"+this._leading+"px",this._family].join(" ")),i.textAlign=b,i.textBaseline=g,c&&(typeof c=="string"?i.fillStyle=c:(tt[c._renderer.type].render.call(c,i,this),i.fillStyle=c._renderer.effect)),l&&(typeof l=="string"?i.strokeStyle=l:(tt[l._renderer.type].render.call(l,i,this),i.strokeStyle=l._renderer.effect),f&&(i.lineWidth=f)),typeof r=="number"&&(i.globalAlpha=r),m&&m.length>0&&(i.lineDashOffset=m.offset||0,i.setLineDash(m)),!o&&!e&&(tt.isHidden.test(c)||(c._renderer&&c._renderer.offset?(M=c._renderer.scale.x,B=c._renderer.scale.y,i.save(),i.translate(-c._renderer.offset.x,-c._renderer.offset.y),i.scale(M,B),y=this._size/c._renderer.scale.y,x=this._leading/c._renderer.scale.y,i.font=[this._style,this._weight,y+"px/",x+"px",this._family].join(" "),S=c._renderer.offset.x/c._renderer.scale.x,A=c._renderer.offset.y/c._renderer.scale.y,i.fillText(this.value,S,A),i.restore()):i.fillText(this.value,0,0)),tt.isHidden.test(l)||(l._renderer&&l._renderer.offset?(M=l._renderer.scale.x,B=l._renderer.scale.y,i.save(),i.translate(-l._renderer.offset.x,-l._renderer.offset.y),i.scale(M,B),y=this._size/l._renderer.scale.y,x=this._leading/l._renderer.scale.y,i.font=[this._style,this._weight,y+"px/",x+"px",this._family].join(" "),S=l._renderer.offset.x/l._renderer.scale.x,A=l._renderer.offset.y/l._renderer.scale.y,E=f/l._renderer.scale.x,i.lineWidth=E,i.strokeText(this.value,S,A),i.restore()):i.strokeText(this.value,0,0))),/(underline|strikethrough)/i.test(d)){let X=i.measureText(this.value),V=1;switch(d){case"underline":T=X.actualBoundingBoxDescent,z=X.actualBoundingBoxDescent;break;case"strikethrough":T=0,z=0,V=.5;break}switch(g){case"top":T+=this._size*V,z+=this._size*V;break;case"baseline":case"bottom":T-=this._size*V,z-=this._size*V;break}switch(b){case"left":case"start":C=0,j=X.width;break;case"right":case"end":C=-X.width,j=0;break;default:C=-X.width/2,j=X.width/2}i.lineWidth=Math.max(Math.floor(this._size/15),1),i.strokeStyle=i.fillStyle,i.beginPath(),i.moveTo(C,T),i.lineTo(j,z),i.stroke()}return _||i.restore(),o&&!e&&i.clip(),m&&m.length>0&&i.setLineDash(De),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 V=Se(y);s=V*s,r=V*r,b=s*s,g=r*r}let x=b*m+g*u,S=(b*g-x)/x,A=Se(He(0,S));n===a&&(A=-A);let E=A*s*_/r,M=-A*r*d/s,B=ke(o)*E-we(o)*M+(t+h)/2,C=we(o)*E+ke(o)*M+(e+l)/2,T=xi(1,0,(d-E)/s,(_-M)/r),j=xi((d-E)/s,(_-M)/r,(-d-E)/s,(-_-M)/r)%$,z=T+j;ls(i,B,C,s,r,T,z,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"?Dt(this.ctx):s,this.domElement.width=t*this.ratio,this.domElement.height=e*this.ratio,this.domElement.style&&R.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),tt.group.render.call(this.scene,this.ctx),t||this.ctx.restore(),this}};v(vt,"Utils",tt);function ls(i,t,e,s,r,n,a,o,h){let l=a-n,f=jt.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 Re(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),Be(s,o,r,h,n,l,a,f,e)}function Xe(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),se(s,o,r,h,n,l,a,f,e)}var Mt=class extends Rt{_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 R.each(Mt.Properties,function(s){e[s]=this[s]},this),t&&t.stops&&t.stops.push(e),e}toObject(){let t={};return R.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}},ht=Mt;v(ht,"Index",0),v(ht,"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 ne=class extends Rt{_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=Y.Identifier+Y.uniqueId(),this.classList=[],this._renderer.flagStops=hs.bind(this),this._renderer.bindStops=fs.bind(this),this._renderer.unbindStops=cs.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 ne(e);return R.each(ne.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 R.each(ne.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}},W=ne;v(W,"Stop",ht),v(W,"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 ot((i||[]).slice(0)),this._stops.bind(p.Types.insert,t).bind(p.Types.remove,e),t(this._stops)}}};function hs(){this._flagStops=!0}function fs(i){let t=i.length;for(;t--;)i[t].bind(p.Types.change,this._renderer.flagStops),i[t].parent=this;this._renderer.flagStops()}function cs(i){let t=i.length;for(;t--;)i[t].unbind(p.Types.change,this._renderer.flagStops),delete i[t].parent;this._renderer.flagStops()}var Ye=class extends W{_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=us.bind(this),this.left=new k,this.right=new k,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 Ye(this.left._x,this.left._y,this.right._x,this.right._y,e);return R.each(W.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=Ye;v(U,"Properties",["left","right"]),v(U,"Stop",ht);var ki={left:{enumerable:!0,get:function(){return this._left},set:function(i){this._left instanceof k&&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 k&&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 us(){this._flagEndPoints=!0}var ae=class extends W{_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=ds.bind(this),this._renderer.flagFocal=_s.bind(this),this.center=new k,this.radius=typeof s=="number"?s:1,this.focal=new k,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 ae(this.center._x,this.center._y,this._radius,e,this.focal._x,this.focal._y);return R.each(W.Properties.concat(ae.Properties),function(r){s[r]=this[r]},this),t&&t.add(s),s}toObject(){let t=super.toObject.call(this);return R.each(ae.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=ae;v(D,"Stop",ht),v(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 ds(){this._flagCenter=!0}function _s(){this._flagFocal=!0}var Ee,Si={video:/\.(mp4|webm|ogg)$/i,image:/\.(jpe?g|png|gif|tiff|webp)$/i,effect:/texture|gradient/i};H.document&&(Ee=document.createElement("a"));var st=class extends Rt{_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 Ri)Object.defineProperty(this,s,Ri[s]);if(this._renderer.type="texture",this._renderer.flagOffset=gs.bind(this),this._renderer.flagScale=ps.bind(this),this.id=Y.Identifier+Y.uniqueId(),this.classList=[],this.loaded=!1,this.repeat="no-repeat",this.offset=new k,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 Ee?(Ee.href=t,Ee.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=st.getAbsoluteURL(t);if(st.ImageRegistry.contains(e))return st.ImageRegistry.get(e);let s;return lt.Image?(s=new lt.Image,vt.Utils.shim(s,"img")):H.document?Si.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=st.getTag(s);t._flagImage&&(/canvas/i.test(r)?st.Register.canvas(t,e):(t._src=!lt.isHeadless&&s.getAttribute("two-src")||s.src,st.Register[r](t,e))),t._flagSrc&&(s||(s=st.getImage(t.src),t.image=s),r=st.getTag(s),st.Register[r](t,e))}clone(){let t=new st(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,st.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=st;v(N,"Properties",["src","loaded","repeat","scale","offset","image"]),v(N,"RegularExpressions",Si),v(N,"ImageRegistry",new Et),v(N,"Register",{canvas:function(t,e){t._src="#"+t.id,st.ImageRegistry.add(t.src,t.image),typeof e=="function"&&e()},img:function(t,e){let s=t.image,r=function(a){!lt.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!lt.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():!lt.isHeadless&&typeof s.addEventListener=="function"&&(s.addEventListener("load",r,!1),s.addEventListener("error",n,!1)),t._src=st.getAbsoluteURL(t._src),!(!lt.isHeadless&&s&&s.getAttribute("two-src"))&&(lt.isHeadless||s.setAttribute("two-src",t.src),st.ImageRegistry.add(t.src,s),lt.isHeadless?st.loadHeadlessBuffer(t,r):t.image.src=t.src)},video:function(t,e){if(lt.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=st.getAbsoluteURL(t._src),t.image.getAttribute("two-src")||(t.image.setAttribute("two-src",t.src),st.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 Ri={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 k&&this._scale.unbind(p.Types.change,this._renderer.flagScale),this._scale=i,this._scale instanceof k&&this._scale.bind(p.Types.change,this._renderer.flagScale),this._flagScale=!0}}};function gs(){this._flagOffset=!0}function ps(){this._flagScale=!0}var Xt=Math.min,Yt=Math.max,ms=Math.ceil,ys=Math.floor,bs=new k,qt=class extends at{_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=Ge.bind(this),this._renderer.unbindVertices=Ke.bind(this),this._renderer.flagFill=$e.bind(this),this._renderer.flagStroke=Je.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 qt;for(let s=0;s0||this.stroke&&!/(transparent|none)/i.test(this.stroke))if(this.matrix.manual){let{scaleX:d,scaleY:_}=St(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=y){this._closed?(s=it(Z,x),r=it(Z-1,x),Z===0&&(s=r,r=Z)):(s=Z,r=Math.min(Math.max(Z-1,0),S)),A=this.vertices[s],E=this.vertices[r],y-=rt,this._lengths[Z]!==0?t=y/this._lengths[Z]:t=0;break}rt+=this._lengths[Z]}if(A===null||E===null)return null;if(A){if(!E)return A}else return E;g=E.controls&&E.controls.right,b=A.controls&&A.controls.left,o=E.x,d=E.y,h=(g||E).x,_=(g||E).y,l=(b||A).x,u=(b||A).y,f=A.x,m=A.y,g&&E.relative&&(h+=E.x,_+=E.y),b&&A.relative&&(l+=A.x,u+=A.y),a=Ut(t,o,h,l,f),c=Ut(t,d,_,u,m);let M=nt(o,h,t),B=nt(d,_,t),C=nt(h,l,t),T=nt(_,u,t),j=nt(l,f,t),z=nt(u,m,t),X=nt(M,C,t),V=nt(B,T,t),ct=nt(C,j,t),ut=nt(T,z,t);return R.isObject(e)?(e.x=a,e.y=c,e instanceof F&&(e.controls.left.x=X,e.controls.left.y=V,e.controls.right.x=ct,e.controls.right.y=ut,(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 F(a,c,X-a,V-c,ct-a,ut-c,this._curved?w.curve:w.line),n.t=t,n)}plot(){if(this.curved)return je(this._collection,this.closed),this;for(let t=0;t0&&(n[n.length-1].command=w.line),r=o;return}a=Xe(o,r,t),n=n.concat(a),R.each(a,function(l,f){f<=0&&r.command===w.move?l.command=w.move:l.command=w.line}),h>=e&&(this._closed&&this._automatic?(r=o,a=Xe(o,r,t),n=n.concat(a),R.each(a,function(l,f){f<=0&&r.command===w.move?l.command=w.move:l.command=w.line})):s&&n.push(new F(o.x,o.y)),n[n.length-1].command=s?w.close:w.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=[]),R.each(this.vertices,function(h,l){if(l<=0&&!n||h.command===w.move){a=h,this._lengths[l]=0;return}this._lengths[l]=Re(h,a,t),o+=this._lengths[l],l>=r&&n&&(a=this.vertices[(l+1)%s],this._lengths[l+1]=Re(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=ms(n),h=ys(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(k.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&&We(this,r)?(f=_,!e&&f.controls&&(f.relative?f.controls.right.clear():f.controls.right.copy(f))):u===o&&We(this,s)&&(l=_,l.command=w.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=w.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(k.zero,_.t):(bs.copy(d),this._renderer.collection[u+1].controls.left.copy(d.controls.left).lerp(d,_.t))))}return at.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,at.prototype.flagReset.call(this),this}},O=qt;v(O,"Properties",["fill","stroke","linewidth","opacity","visible","cap","join","miter","closed","curved","automatic","beginning","ending"]),v(O,"Utils",{getCurveLength:Re});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 W||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 W||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 W||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 W||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";R.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 ot?this._collection=i:this._collection=new ot(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,R.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 Ge(i){let t=i.length;for(;t--;)i[t].bind(p.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()}function Ke(i){let t=i.length;for(;t--;)i[t].unbind(p.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()}function $e(){this._flagFill=!0}function Je(){this._flagStroke=!0}var Ze=class extends O{constructor(t,e,s,r){let n=[new F,new F,new F,new F];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 k,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 F),this.vertices[0].set(-t,-e).sub(this._origin).command=w.move,this.vertices[1].set(t,-e).sub(this._origin).command=w.line,this.vertices[2].set(t,e).sub(this._origin).command=w.line,this.vertices[3].set(-t,e).sub(this._origin).command=w.line,this.vertices[4]&&(this.vertices[4].set(-t,-e).sub(this._origin).command=w.line)}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=!1,super.flagReset.call(this),this}clone(t){let e=new Ze(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&&(R.isNaN(this._lastFrame)&&(this._lastFrame=o-1),a=R.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=nt(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),m=-r*_+(f-r)/2,b=-n*u+(c-n)/2;m!==t.offset.x&&(t.offset.x=m),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}},Ot=Qe;v(Ot,"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 ti=Math.cos,ei=Math.sin,oe=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 F(0,0,0,0,0,0,o===0?w.move:w.curve));super(a);for(let o in Oi)Object.defineProperty(this,o,Oi[o]);this.closed=!0,this.automatic=!1,this._renderer.flagRadius=xs.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 k?(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 he(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 Fs(i){let t={},e=Ts(i),s=Math.max(e.length,i.style.length);for(let r=0;r=0&&t.splice(r,1)}return t}function Ms(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=St(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;Y.AutoCalculateImportedMatrices?(d=St(o),t.translation.set(d.translateX,d.translateY),t.rotation=Math.PI*(d.rotation/180),t.scale=new k(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)&&(m=l.replace(Ft.cssBackgroundImage,"$1"),G.defs.current&&G.defs.current.contains(m)&&(g=G.defs.current.get(m),g&&g.childNodes.length>0)))switch(g=g.childNodes[0],y=fe(g.nodeName),t.mask=G[y].call(this,g,{}),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)?(m=l.replace(Ft.cssBackgroundImage,"$1"),G.defs.current&&G.defs.current.contains(m)?(g=G.defs.current.get(m),g.object||(y=fe(g.nodeName),g.object=G[y].call(this,g,{})),g=g.object):(b=Ls(this),g=b.getById(m)),t[f]=g):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(x=t instanceof W,S=t instanceof U,A=t instanceof D,x||S||A)break;l.match("[a-z%]$")&&!l.endsWith("px")&&(E=new et("only pixel values are supported with the "+h+" attribute."),console.warn(E.name,E.message)),t.translation[h]=parseFloat(l);break;case"font-family":t instanceof ft&&(t.family=l);break;case"font-size":t instanceof ft&&(t.size=l);break;case"font-weight":t instanceof ft&&(t.weight=l);break;case"font-style":t instanceof ft&&(t.style=l);break;case"text-decoration":t instanceof ft&&(t.decoration=l);break;case"line-height":t instanceof ft&&(t.leading=l);break}return Object.keys(i.dataset).length&&(t.dataset=i.dataset),s}function Cs(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(!G.defs.current.contains(r))return e=new et("unable to find element for reference "+s+"."),console.warn(e.name,e.message),null;let a=G.defs.current.get(r).cloneNode(!0);for(let h=0;h1&&(g=1);break;case"m":case"l":case"t":u.length>2&&(g=2);break;case"s":case"q":u.length>4&&(g=4);break;case"c":u.length>6&&(g=6);break;case"a":u.length>7&&(g=7);break}if(g){for(y=0,x=u.length,A=0;y0)switch(m){case"m":S="l";break;case"M":S="L";break}E.push(S+u.slice(y,y+g).join(" ")),A++}f=Array.prototype.concat.apply(f,E)}else f.push(d)}),R.each(f,function(d,_){let u,m,b,g=d[0],y=g.toLowerCase();l=d.slice(1).trim().match(Ft.path),n=g===y;let x,S,A,E,M,B,C,T,j,z,X,V,ct,ut,Z,dt,rt;switch(y){case"z":if(_>=c)r=!0;else{m=o.x,b=o.y,u=new F(m,b,void 0,void 0,void 0,void 0,w.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,m=parseFloat(l[0]),b=parseFloat(l[1]),u=new F(m,b,void 0,void 0,void 0,void 0,/m/i.test(y)?w.move:w.line),n&&u.addSelf(o),o=u;break;case"h":case"v":z=/h/i.test(y)?"x":"y",X=/x/i.test(z)?"y":"x",u=new F(void 0,void 0,void 0,void 0,void 0,void 0,w.line),u[z]=parseFloat(l[0]),u[X]=o[X],n&&(u[z]+=o[z]),o=u;break;case"c":case"s":x=o.x,S=o.y,h||(h=new k),/c/i.test(y)?(A=parseFloat(l[0]),E=parseFloat(l[1]),M=parseFloat(l[2]),B=parseFloat(l[3]),C=parseFloat(l[4]),T=parseFloat(l[5])):(j=ye(o,h,n),A=j.x,E=j.y,M=parseFloat(l[0]),B=parseFloat(l[1]),C=parseFloat(l[2]),T=parseFloat(l[3])),n&&(A+=x,E+=S,M+=x,B+=S,C+=x,T+=S),o.controls.right.set(A-o.x,E-o.y),u=new F(C,T,M-C,B-T,void 0,void 0,w.curve),o=u,h=u.controls.left;break;case"t":case"q":x=o.x,S=o.y,h||(h=new k),/q/i.test(y)?(A=parseFloat(l[0]),E=parseFloat(l[1]),M=parseFloat(l[0]),B=parseFloat(l[1]),C=parseFloat(l[2]),T=parseFloat(l[3])):(j=ye(o,h,n),A=j.x,E=j.y,M=j.x,B=j.y,C=parseFloat(l[0]),T=parseFloat(l[1])),n&&(A+=x,E+=S,M+=x,B+=S,C+=x,T+=S),o.controls.right.set((A-o.x)*.33,(E-o.y)*.33),u=new F(C,T,M-C,B-T,void 0,void 0,w.curve),o=u,h=u.controls.left;break;case"a":x=o.x,S=o.y,ct=parseFloat(l[0]),ut=parseFloat(l[1]),Z=parseFloat(l[2]),dt=parseFloat(l[3]),rt=parseFloat(l[4]),C=parseFloat(l[5]),T=parseFloat(l[6]),n&&(C+=x,T+=S),V=new F(C,T),V.command=w.arc,V.rx=ct,V.ry=ut,V.xAxisRotation=Z,V.largeArcFlag=dt,V.sweepFlag=rt,u=V,o=V,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},R.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 Pt(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 It(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(!R.isNaN(e)||!R.isNaN(s))return G["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 k(e,s),l=new Bt(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 Vt(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?y[1]:void 0),b===null?(y=g?g.match(/stop-opacity:\s?([0-9.-]*)/):!1,b=y&&y.length>1?parseFloat(y[1]):1):b=parseFloat(b),f.push(new ht(u,m,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"));R.isNaN(o)&&(o=r),R.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?x[1]:void 0),g===null?(x=y?y.match(/stop-opacity:\s?([0-9.-]*)/):!1,g=x&&x.length>1?parseFloat(x[1]):1):g=parseFloat(g),c.push(new ht(m,b,g))}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=Rs(i)||"baseline",r=i.textContent,n=new ft(r);return wt.call(this,i,n,t),n.alignment=e,n.baseline=s,n},clippath:function(i,t){return G.defs.current&&!G.defs.current.contains(i.id)&&G.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 Ot(s,r,n);return R.isNaN(a)||(h.width=a),R.isNaN(o)||(h.height=o),wt.call(this,i,h,t),h}};function ni(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 Fe=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=Os.bind(this),this._renderer.bindTextures=Ps.bind(this),this._renderer.unbindTextures=Is.bind(this),this.noStroke(),this.noFill(),Array.isArray(t)?this.textures=t.map(zi.bind(this)):this.textures=[zi(t)],this.origin=new k,this._update(),typeof r=="number"?this.frameRate=r:this.frameRate=Fe.DefaultFrameRate,this.index=0}play(t,e,s){return this._playing=!0,this._firstFrame=0,this._lastFrame=this.amount-1,this._startTime=R.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 Fe(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,R.isNaN(this._lastFrame)&&(this._lastFrame=n-1),r=R.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=nt(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}},zt=Fe;v(zt,"Properties",["textures","frameRate","index"]),v(zt,"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 ot((i||[]).slice(0)),this._textures.bind(p.Types.insert,t).bind(p.Types.remove,e),t(this._textures)}}};function Os(){this._flagTextures=!0}function Ps(i){let t=i.length;for(;t--;)i[t].bind(p.Types.change,this._renderer.flagTextures);this._renderer.flagTextures()}function Is(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 ce=class extends O{_flagStartAngle=!1;_flagEndAngle=!1;_flagInnerRadius=!1;_flagOuterRadius=!1;_startAngle=0;_endAngle=$;_innerRadius=0;_outerRadius=0;constructor(t,e,s,r,n,a,o){let h=o||Y.Resolution*3,l=[];for(let f=0;f0,o=this.vertices,h=a?o.length/2:o.length,l,f=0,c,d,_,u,m,b,g,y,x;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}},$t=Kt;v($t,"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 W||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 W||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 W||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 W||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 ot?this._collection=i:this._collection=new ot(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 js=Math.cos,Vs=Math.sin,ue=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 Hi)Object.defineProperty(this,n,Hi[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 F(o,h)):this.vertices[r].set(o,h),this.vertices[r].command=r===0?w.move:w.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 ue(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 F(h,l)):this.vertices[r].set(h,l),this.vertices[r].command=r===0?w.move:w.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 de(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&&L.setAttributes(s,t),s},setAttributes:function(i,t){let e=Object.keys(t);for(let s=0;s=s&&t&&(o.command===w.curve&&(c=r,y=o.controls&&o.controls.right||o,x=c.controls&&c.controls.left||c,o.relative?(d=K(y.x+o.x),_=K(y.y+o.y)):(d=K(y.x),_=K(y.y)),c.relative?(u=K(x.x+c.x),m=K(x.y+c.y)):(u=K(x.x),m=K(x.y)),C=K(c.x),T=K(c.y),f+=" C "+d+" "+_+" "+u+" "+m+" "+C+" "+T),o.command!==w.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(),L[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?L.setAttributes(this._renderer.elem,t):(t.id=this._id,this._renderer.elem=L.createElement("path",t),i.appendChild(this._renderer.elem)),this._flagClip){let s=L.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?(L[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=St(n[0],n[3],n[1],n[4],n[2],n[5]);s/=Math.max(a.scaleX,a.scaleY)}let r=L.pointsToString(this._renderer.collection,s);t.d=r}return this._fill&&this._fill._renderer&&(this._renderer.hasFillEffect=!0,this._fill._update(),L[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(),L[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?L.setAttributes(this._renderer.elem,t):(t.id=this._id,this._renderer.elem=L.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"]=L.alignments[this._alignment]||this._alignment),this._flagBaseline&&(t["dominant-baseline"]=L.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._fill&&this._fill._renderer&&(this._renderer.hasFillEffect=!0,this._fill._update(),L[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(),L[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?L.setAttributes(this._renderer.elem,t):(t.id=this._id,this._renderer.elem=L.createElement("text",t),i.appendChild(this._renderer.elem)),this._flagClip){let s=L.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?(L[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?L.setAttributes(this._renderer.elem,e):(e.id=this._id,this._renderer.elem=L.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 k?(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?L.setAttributes(this._renderer.image,s):this._renderer.image=L.createElement("image",s)),this._renderer.elem?Object.keys(e).length!==0&&L.setAttributes(this._renderer.elem,e):(e.id=this._id,e.patternUnits="userSpaceOnUse",this._renderer.elem=L.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()}}},_e=class extends p{constructor(t){super(),this.domElement=t.domElement||L.createElement("svg"),this.scene=new q,this.scene.parent=this,this.defs=L.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,L.setAttributes(this.domElement,{width:t,height:e}),this.trigger(p.Types.resize,t,e)}render(){return L.group.render.call(this.scene,this.domElement),L.defs.update(this.domElement),this}};v(_e,"Utils",L);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:` +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:()=>nt,mod:()=>it,setMatrix:()=>Oe,toFixed:()=>$});var X;typeof window<"u"?X=window:typeof global<"u"?X=global:typeof self<"u"&&(X=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 S={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 E=t,F,B,C,M=e[0]||0,j=e[1]||0,V=e[2]||0;return F=E[0]*M+E[1]*j+E[2]*V,B=E[3]*M+E[4]*j+E[5]*V,C=E[6]*M+E[7]*j+E[8]*V,[F,B,C]}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],m=e[2],b=e[3],y=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*y+a*R,s[2]=r*m+n*g+a*A,s[3]=o*_+h*b+l*k,s[4]=o*u+h*y+l*R,s[5]=o*m+h*g+l*A,s[6]=f*_+c*b+d*k,s[7]=f*u+c*y+d*R,s[8]=f*m+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,ut=n[3]*t+n[4]*e+n[5]*s,lt=n[6]*t+n[7]*e+n[8]*s;return[z,ut,lt]}let f=this.elements,c=[t,e,s,r,n,a,o,h,l],d=f[0],_=f[1],u=f[2],m=f[3],b=f[4],y=f[5],g=f[6],k=f[7],R=f[8],A=c[0],E=c[1],F=c[2],B=c[3],C=c[4],M=c[5],j=c[6],V=c[7],W=c[8];return this.elements[0]=d*A+_*B+u*j,this.elements[1]=d*E+_*C+u*V,this.elements[2]=d*F+_*M+u*W,this.elements[3]=m*A+b*B+y*j,this.elements[4]=m*E+b*C+y*V,this.elements[5]=m*F+b*M+y*W,this.elements[6]=g*A+k*B+R*j,this.elements[7]=g*E+k*C+R*V,this.elements[8]=g*F+k*M+R*W,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,m=s*d+r*_+n*u;return m?(m=1/m,t.elements[0]=d*m,t.elements[1]=(-c*r+n*f)*m,t.elements[2]=(h*r-n*o)*m,t.elements[3]=_*m,t.elements[4]=(c*s-n*l)*m,t.elements[5]=(-h*s+n*a)*m,t.elements[6]=u*m,t.elements[7]=(-f*s+r*l)*m,t.elements[8]=(o*s-r*a)*m,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 at=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 at;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 ot=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,S.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=rt.offset||0,i.setLineDash(rt)),i.beginPath();let Ct,Qt,te,ee,ie,se,kt;for(let Y=0;Y=m&&d&&(k=R,j=g.controls&&g.controls.right||w.zero,V=k.controls&&k.controls.left||w.zero,g._relative?(F=j.x+g.x,B=j.y+g.y):(F=j.x,B=j.y),k._relative?(A=V.x+k.x,E=V.y+k.y):(A=V.x,E=V.y),W=k.x,z=k.y,i.bezierCurveTo(F,B,A,E,W,z));break;case v.line:i.lineTo(W,z);break;case v.move:R=g,i.moveTo(W,z);break}return d&&i.closePath(),!lt&&!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(),lt&&!e&&i.clip(),rt&&rt.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,m,b,y,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,m=Re(s),y=this.dashes,l=this._size,m||(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),y&&y.length>0&&(i.lineDashOffset=y.offset||0,i.setLineDash(y)),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,_=Re(h),u=c._renderer&&c._renderer.offset&&l._renderer&&l._renderer.offset,m=this.dashes,b=Q.alignments[this._alignment]||this._alignment,y=Q.baselines[this._baseline]||this._baseline,g,k,R,A,E,F,B,C,M,j,V;if(_||(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),u||(i.font=[this._style,this._weight,this._size+"px/"+this._leading+"px",this._family].join(" ")),i.textAlign=b,i.textBaseline=y,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),m&&m.length>0&&(i.lineDashOffset=m.offset||0,i.setLineDash(m)),!o&&!e&&(Q.isHidden.test(c)||(c._renderer&&c._renderer.offset?(F=c._renderer.scale.x,B=c._renderer.scale.y,i.save(),i.translate(-c._renderer.offset.x,-c._renderer.offset.y),i.scale(F,B),g=this._size/c._renderer.scale.y,k=this._leading/c._renderer.scale.y,i.font=[this._style,this._weight,g+"px/",k+"px",this._family].join(" "),R=c._renderer.offset.x/c._renderer.scale.x,A=c._renderer.offset.y/c._renderer.scale.y,i.fillText(this.value,R,A),i.restore()):i.fillText(this.value,0,0)),Q.isHidden.test(l)||(l._renderer&&l._renderer.offset?(F=l._renderer.scale.x,B=l._renderer.scale.y,i.save(),i.translate(-l._renderer.offset.x,-l._renderer.offset.y),i.scale(F,B),g=this._size/l._renderer.scale.y,k=this._leading/l._renderer.scale.y,i.font=[this._style,this._weight,g+"px/",k+"px",this._family].join(" "),R=l._renderer.offset.x/l._renderer.scale.x,A=l._renderer.offset.y/l._renderer.scale.y,E=f/l._renderer.scale.x,i.lineWidth=E,i.strokeText(this.value,R,A),i.restore()):i.strokeText(this.value,0,0))),/(underline|strikethrough)/i.test(d)){let W=i.measureText(this.value),z=1;switch(d){case"underline":M=W.actualBoundingBoxDescent,V=W.actualBoundingBoxDescent;break;case"strikethrough":M=0,V=0,z=.5;break}switch(y){case"top":M+=this._size*z,V+=this._size*z;break;case"baseline":case"bottom":M-=this._size*z,V-=this._size*z;break}switch(b){case"left":case"start":C=0,j=W.width;break;case"right":case"end":C=-W.width,j=0;break;default:C=-W.width/2,j=W.width/2}i.lineWidth=Math.max(Math.floor(this._size/15),1),i.strokeStyle=i.fillStyle,i.beginPath(),i.moveTo(C,M),i.lineTo(j,V),i.stroke()}return _||i.restore(),o&&!e&&i.clip(),m&&m.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,y=r*r}let k=b*m+y*u,R=(b*y-k)/k,A=Se(Xe(0,R));n===a&&(A=-A);let E=A*s*_/r,F=-A*r*d/s,B=Ae(o)*E-ke(o)*F+(t+h)/2,C=ke(o)*E+Ae(o)*F+(e+l)/2,M=xi(1,0,(d-E)/s,(_-F)/r),j=xi((d-E)/s,(_-F)/r,(-d-E)/s,(-_-F)/r)%J,V=M+j;hs(i,B,C,s,r,M,V,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&&S.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 S.each(Mt.Properties,function(s){e[s]=this[s]},this),t&&t.stops&&t.stops.push(e),e}toObject(){let t={};return S.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}},ft=Mt;x(ft,"Index",0),x(ft,"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 S.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 S.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",ft),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 ot((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 S.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",ft);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 S.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 S.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",ft),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};X.document&&(Fe=document.createElement("a"));var st=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=st.getAbsoluteURL(t);if(st.ImageRegistry.contains(e))return st.ImageRegistry.get(e);let s;return ht.Image?(s=new ht.Image,vt.Utils.shim(s,"img")):X.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=st.getTag(s);t._flagImage&&(/canvas/i.test(r)?st.Register.canvas(t,e):(t._src=!ht.isHeadless&&s.getAttribute("two-src")||s.src,st.Register[r](t,e))),t._flagSrc&&(s||(s=st.getImage(t.src),t.image=s),r=st.getTag(s),st.Register[r](t,e))}clone(){let t=new st(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,st.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=st;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,st.ImageRegistry.add(t.src,t.image),typeof e=="function"&&e()},img:function(t,e){let s=t.image,r=function(a){!ht.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!ht.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():!ht.isHeadless&&typeof s.addEventListener=="function"&&(s.addEventListener("load",r,!1),s.addEventListener("error",n,!1)),t._src=st.getAbsoluteURL(t._src),!(!ht.isHeadless&&s&&s.getAttribute("two-src"))&&(ht.isHeadless||s.setAttribute("two-src",t.src),st.ImageRegistry.add(t.src,s),ht.isHeadless?st.loadHeadlessBuffer(t,r):t.image.src=t.src)},video:function(t,e){if(ht.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=st.getAbsoluteURL(t._src),t.image.getAttribute("two-src")||(t.image.setAttribute("two-src",t.src),st.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 at{_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=it(tt,k),r=it(tt-1,k),tt===0&&(s=r,r=tt)):(s=tt,r=Math.min(Math.max(tt-1,0),R)),A=this.vertices[s],E=this.vertices[r],g-=rt,this._lengths[tt]!==0?t=g/this._lengths[tt]:t=0;break}rt+=this._lengths[tt]}if(A===null||E===null)return null;if(A){if(!E)return A}else return E;y=E.controls&&E.controls.right,b=A.controls&&A.controls.left,o=E.x,d=E.y,h=(y||E).x,_=(y||E).y,l=(b||A).x,u=(b||A).y,f=A.x,m=A.y,y&&E.relative&&(h+=E.x,_+=E.y),b&&A.relative&&(l+=A.x,u+=A.y),a=zt(t,o,h,l,f),c=zt(t,d,_,u,m);let F=nt(o,h,t),B=nt(d,_,t),C=nt(h,l,t),M=nt(_,u,t),j=nt(l,f,t),V=nt(u,m,t),W=nt(F,C,t),z=nt(B,M,t),ut=nt(C,j,t),lt=nt(M,V,t);return S.isObject(e)?(e.x=a,e.y=c,e instanceof T&&(e.controls.left.x=W,e.controls.left.y=z,e.controls.right.x=ut,e.controls.right.y=lt,(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,W-a,z-c,ut-a,lt-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),S.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),S.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=[]),S.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 at.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,at.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";S.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 ot?this._collection=i:this._collection=new ot(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,S.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&&(S.isNaN(this._lastFrame)&&(this._lastFrame=o-1),a=S.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=nt(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),m=-r*_+(f-r)/2,b=-n*u+(c-n)/2;m!==t.offset.x&&(t.offset.x=m),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)&&(m=l.replace(Ft.cssBackgroundImage,"$1"),K.defs.current&&K.defs.current.contains(m)&&(y=K.defs.current.get(m),y&&y.childNodes.length>0)))switch(y=y.childNodes[0],g=ce(y.nodeName),t.mask=K[g].call(this,y,{}),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)?(m=l.replace(Ft.cssBackgroundImage,"$1"),K.defs.current&&K.defs.current.contains(m)?(y=K.defs.current.get(m),y.object||(g=ce(y.nodeName),y.object=K[g].call(this,y,{})),y=y.object):(b=Os(this),y=b.getById(m)),t[f]=y):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")&&(E=new et("only pixel values are supported with the "+h+" attribute."),console.warn(E.name,E.message)),t.translation[h]=parseFloat(l);break;case"font-family":t instanceof ct&&(t.family=l);break;case"font-size":t instanceof ct&&(t.size=l);break;case"font-weight":t instanceof ct&&(t.weight=l);break;case"font-style":t instanceof ct&&(t.style=l);break;case"text-decoration":t instanceof ct&&(t.decoration=l);break;case"line-height":t instanceof ct&&(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&&(y=1);break;case"m":case"l":case"t":u.length>2&&(y=2);break;case"s":case"q":u.length>4&&(y=4);break;case"c":u.length>6&&(y=6);break;case"a":u.length>7&&(y=7);break}if(y){for(g=0,k=u.length,A=0;g0)switch(m){case"m":R="l";break;case"M":R="L";break}E.push(R+u.slice(g,g+y).join(" ")),A++}f=Array.prototype.concat.apply(f,E)}else f.push(d)}),S.each(f,function(d,_){let u,m,b,y=d[0],g=y.toLowerCase();l=d.slice(1).trim().match(Ft.path),n=y===g;let k,R,A,E,F,B,C,M,j,V,W,z,ut,lt,tt,_t,rt;switch(g){case"z":if(_>=c)r=!0;else{m=o.x,b=o.y,u=new T(m,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,m=parseFloat(l[0]),b=parseFloat(l[1]),u=new T(m,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":V=/h/i.test(g)?"x":"y",W=/x/i.test(V)?"y":"x",u=new T(void 0,void 0,void 0,void 0,void 0,void 0,v.line),u[V]=parseFloat(l[0]),u[W]=o[W],n&&(u[V]+=o[V]),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]),E=parseFloat(l[1]),F=parseFloat(l[2]),B=parseFloat(l[3]),C=parseFloat(l[4]),M=parseFloat(l[5])):(j=be(o,h,n),A=j.x,E=j.y,F=parseFloat(l[0]),B=parseFloat(l[1]),C=parseFloat(l[2]),M=parseFloat(l[3])),n&&(A+=k,E+=R,F+=k,B+=R,C+=k,M+=R),o.controls.right.set(A-o.x,E-o.y),u=new T(C,M,F-C,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]),E=parseFloat(l[1]),F=parseFloat(l[0]),B=parseFloat(l[1]),C=parseFloat(l[2]),M=parseFloat(l[3])):(j=be(o,h,n),A=j.x,E=j.y,F=j.x,B=j.y,C=parseFloat(l[0]),M=parseFloat(l[1])),n&&(A+=k,E+=R,F+=k,B+=R,C+=k,M+=R),o.controls.right.set((A-o.x)*.33,(E-o.y)*.33),u=new T(C,M,F-C,B-M,void 0,void 0,v.curve),o=u,h=u.controls.left;break;case"a":k=o.x,R=o.y,ut=parseFloat(l[0]),lt=parseFloat(l[1]),tt=parseFloat(l[2]),_t=parseFloat(l[3]),rt=parseFloat(l[4]),C=parseFloat(l[5]),M=parseFloat(l[6]),n&&(C+=k,M+=R),z=new T(C,M),z.command=v.arc,z.rx=ut,z.ry=lt,z.xAxisRotation=tt,z.largeArcFlag=_t,z.sweepFlag=rt,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},S.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(!S.isNaN(e)||!S.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=y?y.match(/stop-opacity:\s?([0-9.-]*)/):!1,b=g&&g.length>1?parseFloat(g[1]):1):b=parseFloat(b),f.push(new ft(u,m,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"));S.isNaN(o)&&(o=r),S.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),y===null?(k=g?g.match(/stop-opacity:\s?([0-9.-]*)/):!1,y=k&&k.length>1?parseFloat(k[1]):1):y=parseFloat(y),c.push(new ft(m,b,y))}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 ct(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 S.isNaN(a)||(h.width=a),S.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=S.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,S.isNaN(this._lastFrame)&&(this._lastFrame=n-1),r=S.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=nt(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 ot((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,m,b,y,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 ot?this._collection=i:this._collection=new ot(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&&L.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),m=$(k.y+c.y)):(u=$(k.x),m=$(k.y)),C=$(c.x),M=$(c.y),f+=" C "+d+" "+_+" "+u+" "+m+" "+C+" "+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(),L[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?L.setAttributes(this._renderer.elem,t):(t.id=this._id,this._renderer.elem=L.createElement("path",t),i.appendChild(this._renderer.elem)),this._flagClip){let s=L.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?(L[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=L.pointsToString(this._renderer.collection,s);t.d=r}return this._fill&&this._fill._renderer&&(this._renderer.hasFillEffect=!0,this._fill._update(),L[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(),L[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?L.setAttributes(this._renderer.elem,t):(t.id=this._id,this._renderer.elem=L.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"]=L.alignments[this._alignment]||this._alignment),this._flagBaseline&&(t["dominant-baseline"]=L.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._fill&&this._fill._renderer&&(this._renderer.hasFillEffect=!0,this._fill._update(),L[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(),L[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?L.setAttributes(this._renderer.elem,t):(t.id=this._id,this._renderer.elem=L.createElement("text",t),i.appendChild(this._renderer.elem)),this._flagClip){let s=L.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?(L[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?L.setAttributes(this._renderer.elem,e):(e.id=this._id,this._renderer.elem=L.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?L.setAttributes(this._renderer.image,s):this._renderer.image=L.createElement("image",s)),this._renderer.elem?Object.keys(e).length!==0&&L.setAttributes(this._renderer.elem,e):(e.id=this._id,e.patternUnits="userSpaceOnUse",this._renderer.elem=L.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||L.createElement("svg"),this.scene=new q,this.scene.parent=this,this.defs=L.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,L.setAttributes(this.domElement,{width:t,height:e}),this.trigger(p.Types.resize,t,e)}render(){return L.group.render.call(this.scene,this.domElement),L.defs.update(this.domElement),this}};x(ge,"Utils",L);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; @@ -84,6 +84,6 @@ var Two=(()=>{var me=Object.defineProperty;var Yi=Object.getOwnPropertyDescripto } gl_FragColor = texel; } - `}};var Te=xt.Multiply,Ds=[1,0,0,0,1,0,0,0,1],Nt=new yt(9),Hs=vt.Utils,ai=new yt([0,0,1,0,0,1,0,1,1,0,1,1]),I={precision:.9,isHidden:/(undefined|none|transparent)/i,canvas:H.document?H.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=j.offset||0,g.setLineDash(j));let Z,dt,rt,Tt,Ct,te,ee,ie;g.save(),g.scale(y.x,y.y),g.translate(ct,ut),g.beginPath();for(let kt=0;kt=X&&T&&(s=Z,f=Q.controls&&Q.controls.right||k.zero,c=s.controls&&s.controls.left||k.zero,Q._relative?(a=f.x+Q.x,o=f.y+Q.y):(a=f.x,o=f.y),s._relative?(r=c.x+s.x,n=c.y+s.y):(r=c.x,n=c.y),d=s.x,_=s.y,g.bezierCurveTo(a,o,r,n,d,_));break;case w.line:g.lineTo(d,_);break;case w.move:Z=Q,g.moveTo(d,_);break}}T&&g.closePath(),I.isHidden.test(A)||(u=A._renderer&&A._renderer.offset,u&&(g.save(),g.translate(-A._renderer.offset.x,-A._renderer.offset.y),g.scale(A._renderer.scale.x,A._renderer.scale.y)),g.fill(),u&&g.restore()),I.isHidden.test(x)||(u=x._renderer&&x._renderer.offset,u&&(g.save(),g.translate(-x._renderer.offset.x,-x._renderer.offset.y),g.scale(x._renderer.scale.x,x._renderer.scale.y),g.lineWidth=S/x._renderer.scale.x),g.stroke(),u&&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,m,b,g,y;n=Math.min(c,n),s=Math.min(f,s),r=Math.max(f,r),a=Math.max(c,a),l.controls&&(g=d.left,y=d.right,!(!g||!y)&&(_=l._relative?g.x+f:g.x,u=l._relative?g.y+c:g.y,m=l._relative?y.x+f:y.x,b=l._relative?y.y+c:y.y,!(!_||!u||!m||!b)&&(n=Math.min(u,b,n),s=Math.min(_,m,s),r=Math.max(_,m,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,Nt),Te(Nt,s._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof k||(this._renderer.scale=new k),this._scale instanceof k?(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),I[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,I.path.getBoundingClientRect(this._renderer.vertices,this._linewidth,this._renderer.rect),I.updateTexture.call(I,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,ai,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){let t,e=this.canvas,s=this.ctx,r=i._stroke,n=i._linewidth,a=i._fill,o=i._renderer.opacity||i._opacity,h=i.dashes,l=i._size,f=l;I.isHidden.test(r)||(f+=n),e.width=Pe(f),e.height=e.width;let c=f/e.width,d=e.width/2,_=e.height/2;s.clearRect(0,0,e.width,e.height),a&&(typeof a=="string"?s.fillStyle=a:(I[a._renderer.type].render.call(a,s,i),s.fillStyle=a._renderer.effect)),r&&(typeof r=="string"?s.strokeStyle=r:(I[r._renderer.type].render.call(r,s,i),s.strokeStyle=r._renderer.effect),n&&(s.lineWidth=n/c)),typeof o=="number"&&(s.globalAlpha=o),h&&h.length>0&&(s.lineDashOffset=h.offset||0,s.setLineDash(h)),s.save(),s.translate(d,_),s.scale(I.precision,I.precision),s.beginPath(),s.arc(0,0,l/c*.5,0,$),s.restore(),closed&&s.closePath(),I.isHidden.test(a)||(t=a._renderer&&a._renderer.offset,t&&(s.save(),s.translate(-a._renderer.offset.x,-a._renderer.offset.y),s.scale(a._renderer.scale.x,a._renderer.scale.y)),s.fill(),t&&s.restore()),I.isHidden.test(r)||(t=r._renderer&&r._renderer.offset,t&&(s.save(),s.translate(-r._renderer.offset.x,-r._renderer.offset.y),s.scale(r._renderer.scale.x,r._renderer.scale.y),s.lineWidth=n/r._renderer.scale.x),s.stroke(),t&&s.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,m=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,Nt),Te(Nt,r._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof k||(this._renderer.scale=new k),this._scale instanceof k?(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 m?(this._renderer.opacity=this._opacity*r._renderer.opacity,I.updateTexture.call(I,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:(I.isHidden.test(o)||(s+=h),s/=I.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){let t=this.canvas,e=this.ctx,s=i._renderer.scale,r=i._stroke,n=i._linewidth*s,a=i._fill,o=i._renderer.opacity||i._opacity,h=i.dashes,l=i._decoration;t.width=Math.max(Math.ceil(i._renderer.rect.width*s.x),1),t.height=Math.max(Math.ceil(i._renderer.rect.height*s.y),1);let f=i._renderer.rect.centroid,c=f.x,d=f.y,_,u,m,b,g,y,x,S,A,E,M,B=a._renderer&&a._renderer.offset&&r._renderer&&r._renderer.offset;if(e.clearRect(0,0,t.width,t.height),B||(e.font=[i._style,i._weight,i._size+"px/"+i._leading+"px",i._family].join(" ")),e.textAlign="center",e.textBaseline="middle",a&&(typeof a=="string"?e.fillStyle=a:(I[a._renderer.type].render.call(a,e,i),e.fillStyle=a._renderer.effect)),r&&(typeof r=="string"?e.strokeStyle=r:(I[r._renderer.type].render.call(r,e,i),e.strokeStyle=r._renderer.effect),n&&(e.lineWidth=n)),typeof o=="number"&&(e.globalAlpha=o),h&&h.length>0&&(e.lineDashOffset=h.offset||0,e.setLineDash(h)),e.save(),e.scale(s.x,s.y),e.translate(c,d),I.isHidden.test(a)||(a._renderer&&a._renderer.offset?(y=a._renderer.scale.x,x=a._renderer.scale.y,e.save(),e.translate(-a._renderer.offset.x,-a._renderer.offset.y),e.scale(y,x),_=i._size/a._renderer.scale.y,u=i._leading/a._renderer.scale.y,e.font=[i._style,i._weight,_+"px/",u+"px",i._family].join(" "),m=a._renderer.offset.x/a._renderer.scale.x,b=a._renderer.offset.y/a._renderer.scale.y,e.fillText(i.value,m,b),e.restore()):e.fillText(i.value,0,0)),I.isHidden.test(r)||(r._renderer&&r._renderer.offset?(y=r._renderer.scale.x,x=r._renderer.scale.y,e.save(),e.translate(-r._renderer.offset.x,-r._renderer.offset.y),e.scale(y,x),_=i._size/r._renderer.scale.y,u=i._leading/r._renderer.scale.y,e.font=[i._style,i._weight,_+"px/",u+"px",i._family].join(" "),m=r._renderer.offset.x/r._renderer.scale.x,b=r._renderer.offset.y/r._renderer.scale.y,g=n/r._renderer.scale.x,e.lineWidth=g,e.strokeText(i.value,m,b),e.restore()):e.strokeText(i.value,0,0)),/(underline|strikethrough)/i.test(l)){let C=e.measureText(i.value);switch(l){case"underline":A=C.actualBoundingBoxDescent,M=C.actualBoundingBoxDescent;break;case"strikethrough":A=0,M=0;break}S=-C.width/2,E=C.width/2,e.lineWidth=Math.max(Math.floor(i._size/15),1),e.strokeStyle=e.fillStyle,e.beginPath(),e.moveTo(S,A),e.lineTo(E,M),e.stroke()}e.restore()},getBoundingClientRect:function(i,t){let e=I.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&&!I.isHidden.test(this._stroke)&&(r+=this._linewidth*2,n+=this._linewidth*2);let a=r/2,o=n/2;switch(I.alignments[i._alignment]||i._alignment){case I.alignments.left:t.left=0,t.right=r;break;case I.alignments.right:t.left=-r,t.right=0;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,Nt),Te(Nt,s._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof k||(this._renderer.scale=new k),this._scale instanceof k?(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),I[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,I.text.getBoundingClientRect(this,this._renderer.rect),I.updateTexture.call(I,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,ai,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"?Dt(a):s,this.domElement.width=t*this.ratio,this.domElement.height=e*this.ratio,R.isObject(this.domElement.style)&&R.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),I.group.render.call(this.scene,t,this.programs),this._flagMatrix=!1,this.programs.resolution.flagged=!0,this}};v(ge,"Utils",I);var Ws=R.extend({Error:et,getRatio:Dt,read:G,xhr:ni},R,lt,Ve,Ie),Qt=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=R.defaults(t||{},{fullscreen:!1,fitted:!1,width:640,height:480,type:Qt.Types.svg,autostart:!1});if(R.each(e,function(s,r){/fullscreen/i.test(r)||/autostart/i.test(r)||(this[r]=s)},this),R.isElement(e.domElement)){let s=e.domElement.tagName.toLowerCase();/^(CanvasRenderer-canvas|WebGLRenderer-canvas|SVGRenderer-svg)$/.test(this.type+"-"+s)||(this.type=Qt.Types[s])}this.renderer=new Qt[this.type](this),this.setPlaying(e.autostart),this.frameCount=0,e.fullscreen?(this.fit=Xs.bind(this),this.fit.domElement=window,this.fit.attached=!0,R.extend(document.body.style,{overflow:"hidden",margin:0,padding:0,top:0,left:0,right:0,bottom:0,position:"fixed"}),R.extend(this.renderer.domElement.style,{display:"block",top:0,left:0,right:0,bottom:0,position:"fixed"}),_t.bind(this.fit.domElement,"resize",this.fit),this.fit()):e.fitted?(this.fit=Ys.bind(this),R.extend(this.renderer.domElement.style,{display:"block"})):R.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,Qt.Instances.push(this),e.autostart&&pe.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,pe.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(!R.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;e0&&(g.lineDashOffset=W.offset||0,g.setLineDash(W));let rt,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=ut&&V&&(r=rt,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:rt=Y,g.moveTo(_,u);break}}V&&g.closePath(),P.isHidden.test(F)||(m=F._renderer&&F._renderer.offset,m&&(g.save(),g.translate(-F._renderer.offset.x,-F._renderer.offset.y),g.scale(F._renderer.scale.x,F._renderer.scale.y)),g.fill(),m&&g.restore()),P.isHidden.test(A)||(m=A._renderer&&A._renderer.offset,m&&(g.save(),g.translate(-A._renderer.offset.x,-A._renderer.offset.y),g.scale(A._renderer.scale.x,A._renderer.scale.y),g.lineWidth=E/A._renderer.scale.x),g.stroke(),m&&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,m,b,y,g;n=Math.min(c,n),s=Math.min(f,s),r=Math.max(f,r),a=Math.max(c,a),l.controls&&(y=d.left,g=d.right,!(!y||!g)&&(_=l._relative?y.x+f:y.x,u=l._relative?y.y+c:y.y,m=l._relative?g.x+f:g.x,b=l._relative?g.y+c:g.y,!(!_||!u||!m||!b)&&(n=Math.min(u,b,n),s=Math.min(_,m,s),r=Math.max(_,m,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,m=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,m),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,m=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 m?(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;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 d=t._renderer.rect.centroid,_=d.x,u=d.y,m,b,y,g,k,R,A,E,F,B,C,M=h._renderer&&h._renderer.offset&&a._renderer&&a._renderer.offset;if(s.clearRect(0,0,e.width,e.height),M||(s.font=[t._style,t._weight,t._size+"px/"+t._leading+"px",t._family].join(" ")),s.textAlign="center",s.textBaseline="middle",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),P.isHidden.test(h)||(h._renderer&&h._renderer.offset?(R=h._renderer.scale.x,A=h._renderer.scale.y,s.save(),s.translate(-h._renderer.offset.x,-h._renderer.offset.y),s.scale(R,A),m=t._size/h._renderer.scale.y,b=t._leading/h._renderer.scale.y,s.font=[t._style,t._weight,m+"px/",b+"px",t._family].join(" "),y=h._renderer.offset.x/h._renderer.scale.x,g=h._renderer.offset.y/h._renderer.scale.y,s.fillText(t.value,y,g),s.restore()):s.fillText(t.value,0,0)),P.isHidden.test(a)||(a._renderer&&a._renderer.offset?(R=a._renderer.scale.x,A=a._renderer.scale.y,s.save(),s.translate(-a._renderer.offset.x,-a._renderer.offset.y),s.scale(R,A),m=t._size/a._renderer.scale.y,b=t._leading/a._renderer.scale.y,s.font=[t._style,t._weight,m+"px/",b+"px",t._family].join(" "),y=a._renderer.offset.x/a._renderer.scale.x,g=a._renderer.offset.y/a._renderer.scale.y,k=o/a._renderer.scale.x,s.lineWidth=k,s.strokeText(t.value,y,g),s.restore()):s.strokeText(t.value,0,0)),/(underline|strikethrough)/i.test(c)){let j=s.measureText(t.value);switch(c){case"underline":F=j.actualBoundingBoxDescent,C=j.actualBoundingBoxDescent;break;case"strikethrough":F=0,C=0;break}E=-j.width/2,B=j.width/2,s.lineWidth=Math.max(Math.floor(t._size/15),1),s.strokeStyle=s.fillStyle,s.beginPath(),s.moveTo(E,F),s.lineTo(B,C),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:t.left=0,t.right=r;break;case P.alignments.right:t.left=-r,t.right=0;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,S.isObject(this.domElement.style)&&S.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=S.extend({Error:et,getRatio:Ut,read:K,xhr:ai},S,ht,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=S.defaults(t||{},{fullscreen:!1,fitted:!1,width:640,height:480,type:Zt.Types.svg,autostart:!1});if(S.each(e,function(s,r){/fullscreen/i.test(r)||/autostart/i.test(r)||(this[r]=s)},this),S.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,S.extend(document.body.style,{overflow:"hidden",margin:0,padding:0,top:0,left:0,right:0,bottom:0,position:"fixed"}),S.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),S.extend(this.renderer.domElement.style,{display:"block"})):S.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(!S.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