/* MIT License Copyright (c) 2012 - 2025 @jonobr1 / http://jono.fyi Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ var Two=(()=>{var Re=Object.defineProperty;var $i=Object.getOwnPropertyDescriptor;var Ji=Object.getOwnPropertyNames;var Zi=Object.prototype.hasOwnProperty;var Qi=(i,t,e)=>t in i?Re(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e;var Ne=(i,t)=>{for(var e in t)Re(i,e,{get:t[e],enumerable:!0})},ts=(i,t,e,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Ji(t))!Zi.call(i,r)&&r!==e&&Re(i,r,{get:()=>t[r],enumerable:!(s=$i(t,r))||s.enumerable});return i};var es=i=>ts(Re({},"__esModule",{value:!0}),i);var w=(i,t,e)=>(Qi(i,typeof t!="symbol"?t+"":t,e),e);var Zs={};Ne(Zs,{default:()=>I});var at={Image:null,isHeadless:!1,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},polyfill:function(i,t){return at.shim(i),typeof t<"u"&&(at.Image=t),at.isHeadless=!0,i}};var Ye={};Ne(Ye,{Curve:()=>Zt,getAnchorsFromArcData:()=>rs,getComponentOnCubicBezier:()=>se,getControlPoints:()=>pi,getCurveBoundingBox:()=>Xe,getCurveFromPoints:()=>He,getCurveLength:()=>We,getReflection:()=>Ae,integrate:()=>_i,subdivide:()=>ye});var De={};Ne(De,{HALF_PI:()=>Z,NumArray:()=>vt,TWO_PI:()=>J,decomposeMatrix:()=>Et,getComputedMatrix:()=>je,getPoT:()=>Ue,lerp:()=>ft,mod:()=>nt,setMatrix:()=>ze,toFixed:()=>U});var Y;typeof window<"u"?Y=window:typeof global<"u"?Y=global:typeof self<"u"&&(Y=self);var ci,J=Math.PI*2,Z=Math.PI*.5;function Et(i,t,e,s,r,n){let o;return arguments.length<=1?(o=i.a,t=i.b,e=i.c,s=i.d,r=i.e,n=i.f):o=i,{translateX:r,translateY:n,scaleX:Math.sqrt(o*o+t*t),scaleY:Math.sqrt(e*e+s*s),rotation:180*Math.atan2(t,o)/Math.PI}}function ze(i){ci=i}function je(i,t){t=t&&t.identity()||new ci;let e=i,s=[];for(;e&&e._matrix;)s.push(e._matrix),e=e.parent;s.reverse();for(let r=0;r<s.length;r++){let o=s[r].elements;t.multiply(o[0],o[1],o[2],o[3],o[4],o[5],o[6],o[7],o[8],o[9])}return t}function ft(i,t,e){return e*(t-i)+i}var Ve=[2,4,8,16,32,64,128,256,512,1024,2048,4096];function Ue(i){let t=0;for(;Ve[t]&&Ve[t]<i;)t++;return Ve[t]}function nt(i,t){for(;i<0;)i+=t;return i%t}var vt=Y.Float32Array||Array,is=Math.floor;function U(i){return is(i*1e6)/1e6}var v={move:"M",line:"L",curve:"C",arc:"A",close:"Z"};var g=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<n;r++){t=s[r];let o=this._events[t];if(o){let a=[];if(e)for(let h=0,l=o.length;h<l;h++){let f=o[h];f=f.handler?f.handler:f,e!==f&&a.push(f)}this._events[t]=a}}return this}off(){return this.removeEventListener.apply(this,arguments)}unbind(){return this.removeEventListener.apply(this,arguments)}dispatchEvent(t){if(!this._events)return this;let e=Array.prototype.slice.call(arguments,1),s=this._events[t];if(s)for(let r=0;r<s.length;r++)s[r].call(this,...e);return this}trigger(){return this.dispatchEvent.apply(this,arguments)}listen(t,e,s){let r=this;t&&(n.obj=t,n.name=e,n.handler=s,t.on(e,n));function n(){s.apply(r,arguments)}return r}ignore(t,e,s){return t.off(e,s),this}};w(g,"Types",{play:"play",pause:"pause",update:"update",render:"render",resize:"resize",change:"change",remove:"remove",insert:"insert",order:"order",load:"load"}),w(g,"Methods",["addEventListener","on","removeEventListener","off","unbind","dispatchEvent","trigger","listen","ignore"]);var ui={x:{enumerable:!0,get:function(){return this._x},set:function(i){this._x!==i&&(this._x=i,this._bound&&this.dispatchEvent(g.Types.change))}},y:{enumerable:!0,get:function(){return this._y},set:function(i){this._y!==i&&(this._y=i,this._bound&&this.dispatchEvent(g.Types.change))}}},kt=class extends g{_x=0;_y=0;constructor(t=0,e=0){super();for(let s in ui)Object.defineProperty(this,s,ui[s]);this.x=t,this.y=e}static add(t,e){return new kt(t.x+e.x,t.y+e.y)}static sub(t,e){return new kt(t.x-e.x,t.y-e.y)}static subtract(t,e){return kt.sub(t,e)}static ratioBetween(t,e){return(t.x*e.x+t.y*e.y)/(t.length()*e.length())}static angleBetween(t,e){if(arguments.length>=4){let n=arguments[0]-arguments[2],o=arguments[1]-arguments[3];return Math.atan2(o,n)}let s=t.x-e.x,r=t.y-e.y;return Math.atan2(r,s)}static distanceBetween(t,e){return Math.sqrt(kt.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 kt(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)<e}lerp(t,e){let s=(t.x-this.x)*e+this.x,r=(t.y-this.y)*e+this.y;return this.set(s,r)}isZero(t){return t=typeof t>"u"?1e-4:t,this.length()<t}toString(){return this.x+", "+this.y}toObject(){return{x:U(this.x),y:U(this.y)}}rotate(t){let e=this.x,s=this.y,r=Math.cos(t),n=Math.sin(t);return this.x=e*r-s*n,this.y=e*n+s*r,this}},x=kt;w(x,"zero",new kt),w(x,"left",new kt(-1,0)),w(x,"right",new kt(1,0)),w(x,"up",new kt(0,-1)),w(x,"down",new kt(0,1));var T=class extends x{controls={left:new x,right:new x};_command=v.move;_relative=!0;_rx=0;_ry=0;_xAxisRotation=0;_largeArcFlag=0;_sweepFlag=1;constructor(t=0,e=0,s=0,r=0,n=0,o=0,a=v.move){super(t,e);for(let l in di)Object.defineProperty(this,l,di[l]);this.command=a,this.relative=!0;let h=T.makeBroadcast(this);this.controls.left.set(s,r).addEventListener(g.Types.change,h),this.controls.right.set(n,o).addEventListener(g.Types.change,h)}static makeBroadcast(t){return e;function e(){t._bound&&t.dispatchEvent(g.Types.change)}}static fromObject(t){return new T().copy(t)}copy(t){return this.x=t.x,this.y=t.y,typeof t.command=="string"&&(this.command=t.command),t.controls&&(t.controls.left&&this.controls.left.copy(t.controls.left),t.controls.right&&this.controls.right.copy(t.controls.right)),typeof t.relative=="boolean"&&(this.relative=t.relative),typeof t.rx=="number"&&(this.rx=t.rx),typeof t.ry=="number"&&(this.ry=t.ry),typeof t.xAxisRotation=="number"&&(this.xAxisRotation=t.xAxisRotation),typeof t.largeArcFlag=="number"&&(this.largeArcFlag=t.largeArcFlag),typeof t.sweepFlag=="number"&&(this.sweepFlag=t.sweepFlag),this}clone(){return new T().copy(this)}toObject(){return{x:U(this.x),y:U(this.y),command:this.command,relative:this.relative,controls:{left:this.controls.left.toObject(),right:this.controls.right.toObject()},rx:U(this.rx),ry:U(this.ry),xAxisRotation:U(this.xAxisRotation),largeArcFlag:U(this.largeArcFlag),sweepFlag:U(this.sweepFlag)}}toString(){return JSON.stringify(this.toObject())}},di={command:{enumerable:!0,get:function(){return this._command},set:function(i){this._command!==i&&(this._command=i,this._bound&&this.dispatchEvent(g.Types.change))}},relative:{enumerable:!0,get:function(){return this._relative},set:function(i){this._relative!==!!i&&(this._relative=!!i,this._bound&&this.dispatchEvent(g.Types.change))}},rx:{enumerable:!0,get:function(){return this._rx},set:function(i){this._rx!==i&&(this._rx=i,this._bound&&this.dispatchEvent(g.Types.change))}},ry:{enumerable:!0,get:function(){return this._ry},set:function(i){this._ry!==i&&(this._ry=i,this._bound&&this.dispatchEvent(g.Types.change))}},xAxisRotation:{enumerable:!0,get:function(){return this._xAxisRotation},set:function(i){this._xAxisRotation!==i&&(this._xAxisRotation=i,this._bound&&this.dispatchEvent(g.Types.change))}},largeArcFlag:{enumerable:!0,get:function(){return this._largeArcFlag},set:function(i){this._largeArcFlag!==i&&(this._largeArcFlag=i,this._bound&&this.dispatchEvent(g.Types.change))}},sweepFlag:{get:function(){return this._sweepFlag},set:function(i){this._sweepFlag!==i&&(this._sweepFlag=i,this._bound&&this.dispatchEvent(g.Types.change))}}};var ss=0,Q={nextFrameID:null,Types:{webgl:"WebGLRenderer",svg:"SVGRenderer",canvas:"CanvasRenderer"},Version:"v0.8.16",PublishDate:"2025-03-01T01:02:12.823Z",Identifier:"two-",Resolution:12,AutoCalculateImportedMatrices:!0,Instances:[],uniqueId:function(){return ss++}};var Zt={CollinearityEpsilon:Math.pow(10,-30),RecursionLimit:16,CuspLimit:0,Tolerance:{distance:.25,angle:0,epsilon:Number.EPSILON},abscissas:[[.5773502691896257],[0,.7745966692414834],[.33998104358485626,.8611363115940526],[0,.5384693101056831,.906179845938664],[.2386191860831969,.6612093864662645,.932469514203152],[0,.4058451513773972,.7415311855993945,.9491079123427585],[.1834346424956498,.525532409916329,.7966664774136267,.9602898564975363],[0,.3242534234038089,.6133714327005904,.8360311073266358,.9681602395076261],[.14887433898163122,.4333953941292472,.6794095682990244,.8650633666889845,.9739065285171717],[0,.26954315595234496,.5190961292068118,.7301520055740494,.8870625997680953,.978228658146057],[.1252334085114689,.3678314989981802,.5873179542866175,.7699026741943047,.9041172563704749,.9815606342467192],[0,.2304583159551348,.44849275103644687,.6423493394403402,.8015780907333099,.9175983992229779,.9841830547185881],[.10805494870734367,.31911236892788974,.5152486363581541,.6872929048116855,.827201315069765,.9284348836635735,.9862838086968123],[0,.20119409399743451,.3941513470775634,.5709721726085388,.7244177313601701,.8482065834104272,.937273392400706,.9879925180204854],[.09501250983763744,.2816035507792589,.45801677765722737,.6178762444026438,.755404408355003,.8656312023878318,.9445750230732326,.9894009349916499]],weights:[[1],[.8888888888888888,.5555555555555556],[.6521451548625461,.34785484513745385],[.5688888888888889,.47862867049936647,.23692688505618908],[.46791393457269104,.3607615730481386,.17132449237917036],[.4179591836734694,.3818300505051189,.27970539148927664,.1294849661688697],[.362683783378362,.31370664587788727,.22238103445337448,.10122853629037626],[.3302393550012598,.31234707704000286,.26061069640293544,.1806481606948574,.08127438836157441],[.29552422471475287,.26926671930999635,.21908636251598204,.1494513491505806,.06667134430868814],[.2729250867779006,.26280454451024665,.23319376459199048,.18629021092773426,.1255803694649046,.05566856711617366],[.24914704581340277,.2334925365383548,.20316742672306592,.16007832854334622,.10693932599531843,.04717533638651183],[.2325515532308739,.22628318026289723,.2078160475368885,.17814598076194574,.13887351021978725,.09212149983772845,.04048400476531588],[.2152638534631578,.2051984637212956,.18553839747793782,.15720316715819355,.12151857068790319,.08015808715976021,.03511946033175186],[.2025782419255613,.19843148532711158,.1861610000155622,.16626920581699392,.13957067792615432,.10715922046717194,.07036604748810812,.03075324199611727],[.1894506104550685,.18260341504492358,.16915651939500254,.14959598881657674,.12462897125553388,.09515851168249279,.062253523938647894,.027152459411754096]]};function se(i,t,e,s,r){let n=1-i;return n*n*n*t+3*n*n*i*e+3*n*i*i*s+i*i*i*r}function ye(i,t,e,s,r,n,o,a,h){h=h||Zt.RecursionLimit;let l=h+1;if(Math.abs(i-o)<.001&&Math.abs(t-a)<.001)return[new T(o,a)];let f=[];for(let c=0;c<l;c++){let d=c/l,_=se(d,i,e,r,o),u=se(d,t,s,n,a);f.push(new T(_,u))}return f}function We(i,t,e,s,r,n,o,a,h){if(i===e&&t===s&&r===o&&n===a){let b=o-i,m=a-t;return Math.sqrt(b*b+m*m)}let l=9*(e-r)+3*(o-i),f=6*(i+r)-12*e,c=3*(e-i),d=9*(s-n)+3*(a-t),_=6*(t+n)-12*s,u=3*(s-t);function y(b){let m=(l*b+f)*b+c,p=(d*b+_)*b+u;return Math.sqrt(m*m+p*p)}return _i(y,0,1,h||Zt.RecursionLimit)}function Xe(i,t,e,s,r,n,o,a){let h=[],l=[[],[]],f,c,d,_,u,y,b,m;for(let k=0;k<2;++k){if(k==0?(c=6*i-12*e+6*r,f=-3*i+9*e-9*r+3*o,d=3*e-3*i):(c=6*t-12*s+6*n,f=-3*t+9*s-9*n+3*a,d=3*s-3*t),Math.abs(f)<1e-12){if(Math.abs(c)<1e-12)continue;_=-d/c,0<_&&_<1&&h.push(_);continue}b=c*c-4*d*f,m=Math.sqrt(b),!(b<0)&&(u=(-c+m)/(2*f),0<u&&u<1&&h.push(u),y=(-c-m)/(2*f),0<y&&y<1&&h.push(y))}let p=h.length,R=p,A;for(;p--;)_=h[p],A=1-_,l[0][p]=A*A*A*i+3*A*A*_*e+3*A*_*_*r+_*_*_*o,l[1][p]=A*A*A*t+3*A*A*_*s+3*A*_*_*n+_*_*_*a;return l[0][R]=i,l[1][R]=t,l[0][R+1]=o,l[1][R+1]=a,l[0].length=l[1].length=R+2,{min:{x:Math.min.apply(0,l[0]),y:Math.min.apply(0,l[1])},max:{x:Math.max.apply(0,l[0]),y:Math.max.apply(0,l[1])}}}function _i(i,t,e,s){let r=Zt.abscissas[s-2],n=Zt.weights[s-2],o=.5*(e-t),a=o+t,h=0,l=s+1>>1,f=s&1?n[h++]*i(a):0;for(;h<l;){let c=o*r[h];f+=n[h++]*(i(a+c)+i(a-c))}return o*f}function He(i,t){let e=i.length,s=e-1;for(let r=0;r<e;r++){let n=i[r],o=t?nt(r-1,e):Math.max(r-1,0),a=t?nt(r+1,e):Math.min(r+1,s),h=i[o],l=n,f=i[a];pi(h,l,f),l.command=r===0?v.move:v.curve}}function pi(i,t,e){let s=x.angleBetween(i,t),r=x.angleBetween(e,t),n=x.distanceBetween(i,t),o=x.distanceBetween(e,t),a=(s+r)/2;return n<1e-4||o<1e-4?(typeof t.relative=="boolean"&&!t.relative&&(t.controls.left.copy(t),t.controls.right.copy(t)),t):(n*=.33,o*=.33,r<s?a+=Z:a-=Z,t.controls.left.x=Math.cos(a)*n,t.controls.left.y=Math.sin(a)*n,a-=Math.PI,t.controls.right.x=Math.cos(a)*o,t.controls.right.y=Math.sin(a)*o,typeof t.relative=="boolean"&&!t.relative&&(t.controls.left.x+=t.x,t.controls.left.y+=t.y,t.controls.right.x+=t.x,t.controls.right.y+=t.y),t)}function Ae(i,t,e){return new x(2*i.x-(t.x+i.x)-(e?i.x:0),2*i.y-(t.y+i.y)-(e?i.y:0))}function rs(i,t,e,s,r,n,o){let a=Q.Resolution,h=[];for(let l=0;l<a;l++){let f=(l+1)/a;o&&(f=1-f);let c=f*n+r,d=e*Math.cos(c),_=s*Math.sin(c),u=new T(d,_);u.command=v.line,h.push(u)}}var gi=Array.prototype.slice;function ns(i){if(i==null)return!1;let t=i.length;return typeof t=="number"&&t>=0&&t<4294967296}var F={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=gi.call(arguments,1);for(let e=0;e<t.length;e++){let s=t[e];for(let r in s)i[r]=s[r]}return i},defaults:function(i){let t=gi.call(arguments,1);for(let e=0;e<t.length;e++){let s=t[e];for(let r in s)i[r]===void 0&&(i[r]=s[r])}return i},each:function(i,t,e){let s=e||this,r=!ns(i)&&Object.keys(i),n=(r||i).length;for(let o=0;o<n;o++){let a=r?r[o]:o;t.call(s,i[a],a,i)}return i},performance:Y.performance&&Y.performance.now?Y.performance:Date};var mt={hasEventListeners:typeof Y.addEventListener=="function",bind:function(i,t,e,s){return this.hasEventListeners?i.addEventListener(t,e,!!s):i.attachEvent("on"+t,e),mt},unbind:function(i,t,e,s){return mt.hasEventListeners?i.removeEventListeners(t,e,!!s):i.detachEvent("on"+t,e),mt},getRequestAnimationFrame:function(){let i=["ms","moz","webkit","o"],t=0,e=Y.requestAnimationFrame;if(!e){for(let r=0;r<i.length;r++)e=Y[i[r]+"RequestAnimationFrame"]||e;e=e||s}function s(r,n){let o=new Date().getTime(),a=Math.max(0,16-(o-t)),h=Y.setTimeout(l,a);t=o+a;function l(){r(o+a)}return h}return e}},re=Y.document?Y.document.createElement("div"):{};re.id="help-two-load";Object.defineProperty(mt,"temp",{enumerable:!0,get:function(){return F.isElement(re)&&!Y.document.head.contains(re)&&(re.style.display="none",Y.document.head.appendChild(re)),re}});var tt=class extends Error{name="Two.js";message;constructor(t){super(),this.message=t}};var os=Y.devicePixelRatio||1;function as(i){return i.webkitBackingStorePixelRatio||i.mozBackingStorePixelRatio||i.msBackingStorePixelRatio||i.oBackingStorePixelRatio||i.backingStorePixelRatio||1}function ne(i){return os/as(i)}var Tt=class{map={};constructor(){}add(t,e){return this.map[t]=e,this}remove(t){return delete this.map[t],this}get(t){return this.map[t]}contains(t){return t in this.map}};var ct=class extends Array{#t=new g;get _events(){return this.#t}set _events(t){this.#t=t}get _bound(){return this.#t._bound}set _bound(t){this.#t._bound=t}addEventListener(){return this.#t.addEventListener.apply(this,arguments)}on(){return this.#t.on.apply(this,arguments)}bind(){return this.#t.bind.apply(this,arguments)}removeEventListener(){return this.#t.removeEventListener.apply(this,arguments)}off(){return this.#t.off.apply(this,arguments)}unbind(){return this.#t.unbind.apply(this,arguments)}dispatchEvent(){return this.#t.dispatchEvent.apply(this,arguments)}trigger(){return this.#t.trigger.apply(this,arguments)}listen(){return this.#t.listen.apply(this,arguments)}ignore(){return this.#t.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(g.Types.remove,[t]),t}shift(){let t=super.shift.apply(this,arguments);return this.trigger(g.Types.remove,[t]),t}push(){let t=super.push.apply(this,arguments);return this.trigger(g.Types.insert,arguments),t}unshift(){let t=super.unshift.apply(this,arguments);return this.trigger(g.Types.insert,arguments),t}splice(){let t=super.splice.apply(this,arguments);if(this.trigger(g.Types.remove,t),arguments.length>2){let e=this.slice(arguments[0],arguments[0]+arguments.length-2);this.trigger(g.Types.insert,e),this.trigger(g.Types.order)}return t}sort(){return super.sort.apply(this,arguments),this.trigger(g.Types.order),this}reverse(){return super.reverse.apply(this,arguments),this.trigger(g.Types.order),this}indexOf(){return super.indexOf.apply(this,arguments)}map(t,e){let s=[];for(let r=0;r<this.length;r++){let n=this[r],o;e?o=t.call(e,n,r):o=t(n,r),s.push(o)}return s}};var Ge=class extends g{_flagId=!1;_flagClassName=!1;_renderer={};_id=Q.Identifier+Q.uniqueId();_className="";classList=[];constructor(){super();for(let t in mi)Object.defineProperty(this,t,mi[t])}static fromObject(t){let e=new Ge().copy(t);return"id"in t&&(e.id=t.id),e}flagReset(){return this._flagId=this._flagClassName=!1,this}copy(t){return this.renderer.type=t.renderer.type,this.className=t.className,this}toObject(){return{renderer:{type:this.renderer.type},id:this.id,className:this.className}}},pt=Ge;w(pt,"Properties",["renderer","id","className"]);var mi={renderer:{enumerable:!1,get:function(){return this._renderer}},id:{enumerable:!0,get:function(){return this._id},set:function(i){let t=this._id;i!==this._id&&(this._id=i,this._flagId=!0,this.parent&&(delete this.parent.children.ids[t],this.parent.children.ids[this._id]=this))}},className:{enumerable:!0,get:function(){return this._className},set:function(i){this._className!==i&&(this._flagClassName=!0,this.classList=i.split(/\s+?/),this._className=i)}}};var Se,yi={video:/\.(mp4|webm|ogg)$/i,image:/\.(jpe?g|png|gif|tiff|webp)$/i,effect:/texture|gradient/i};Y.document&&(Se=document.createElement("a"));var st=class extends pt{_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();for(let s in bi)Object.defineProperty(this,s,bi[s]);if(this._renderer.type="texture",this._renderer.flagOffset=ls.bind(this),this._renderer.flagScale=hs.bind(this),this.loaded=!1,this.repeat="no-repeat",this.offset=new x,typeof e=="function"){let s=function(){this.unbind(g.Types.load,s),typeof e=="function"&&e()}.bind(this);this.bind(g.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()}fromObject(t){let e=new st().copy(t);return"id"in t&&(e.id=t.id),e}static getAbsoluteURL(t){return Se?(Se.href=t,Se.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 at.Image?(s=new at.Image,at.shim(s,"img")):Y.document?yi.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=!at.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.offset),t.scale=this.scale,t}copy(t){return this.src=t.src,this.repeat=t.repeat,this.offset=typeof t.offset=="number"||t.offset instanceof x?t.offset:new x().copy(t.offset),this.scale=typeof t.scale=="number"||t.scale instanceof x?t.scale:new x().copy(t.scale),this}toObject(){let t=super.toObject.call(this);return t.renderer.type="texture",t.src=this.src,t.repeat=this.repeat,t.offset=this.offset.toObject(),t.scale=typeof this.scale=="number"?this.scale:this.scale.toObject(),t}_update(){return(this._flagSrc||this._flagImage)&&(this.trigger(g.Types.change),(this._flagSrc||this._flagImage)&&(this.loaded=!1,st.load(this,function(){this.loaded=!0,this.trigger(g.Types.change).trigger(g.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}},V=st;w(V,"Properties",["src","loaded","repeat","scale","offset","image"]),w(V,"RegularExpressions",yi),w(V,"ImageRegistry",new Tt),w(V,"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(o){!at.isHeadless&&s.removeEventListener&&typeof s.removeEventListener=="function"&&(s.removeEventListener("load",r,!1),s.removeEventListener("error",n,!1)),typeof e=="function"&&e()},n=function(o){throw!at.isHeadless&&typeof s.removeEventListener=="function"&&(s.removeEventListener("load",r,!1),s.removeEventListener("error",n,!1)),new tt("unable to load "+t.src)};typeof s.width=="number"&&s.width>0&&typeof s.height=="number"&&s.height>0?r():!at.isHeadless&&typeof s.addEventListener=="function"&&(s.addEventListener("load",r,!1),s.addEventListener("error",n,!1)),t._src=st.getAbsoluteURL(t._src),!(!at.isHeadless&&s&&s.getAttribute("two-src"))&&(at.isHeadless||s.setAttribute("two-src",t.src),st.ImageRegistry.add(t.src,s),at.isHeadless?st.loadHeadlessBuffer(t,r):t.image.src=t.src)},video:function(t,e){if(at.isHeadless)throw new tt("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 tt("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 bi={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=V.getTag(i),e;switch(t){case"canvas":e="#"+i.id;break;default:e=i.src}V.ImageRegistry.contains(e)?this._image=V.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(g.Types.change,this._renderer.flagOffset),this._offset=i,this._offset.bind(g.Types.change,this._renderer.flagOffset),this._flagOffset=!0}},scale:{enumerable:!0,get:function(){return this._scale},set:function(i){this._scale instanceof x&&this._scale.unbind(g.Types.change,this._renderer.flagScale),this._scale=i,this._scale instanceof x&&this._scale.bind(g.Types.change,this._renderer.flagScale),this._flagScale=!0}}};function ls(){this._flagOffset=!0}function hs(){this._flagScale=!0}var Rt=class extends pt{_flagOffset=!0;_flagOpacity=!0;_flagColor=!0;_offset=0;_opacity=1;_color="#fff";constructor(t,e,s){super();for(let r in xi)Object.defineProperty(this,r,xi[r]);this._renderer.type="stop",this.offset=typeof t=="number"?t:Rt.Index<=0?0:1,this.opacity=typeof s=="number"?s:1,this.color=typeof e=="string"?e:Rt.Index<=0?"#fff":"#000",Rt.Index=(Rt.Index+1)%2}static fromObject(t){let e=new Rt().copy(t);return"id"in t&&(e.id=t.id),e}copy(t){super.copy.call(this,t);for(let e=0;e<Rt.Properties.length;e++){let s=Rt.Properties[e];s in t&&(this[s]=t[s])}return this}clone(t){let e=new Rt;return F.each(Rt.Properties,function(s){e[s]=this[s]},this),t&&t.stops&&t.stops.push(e),e}toObject(){let t=super.toObject.call(this);return t.renderer.type="stop",F.each(Rt.Properties,e=>{t[e]=this[e]},this),t}flagReset(){return this._flagOffset=this._flagColor=this._flagOpacity=!1,super.flagReset.call(this),this}},lt=Rt;w(lt,"Index",0),w(lt,"Properties",["offset","opacity","color"]);var xi={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 Vt=class extends pt{_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._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)}static fromObject(t){let e=t.stops;e&&e.length>0&&(e=e.map(r=>r instanceof lt?r:new lt().copy(r)));let s=new Vt().copy(t);return"id"in t&&(s.id=t.id),s}clone(t){let e=this.stops.map(r=>r.clone()),s=new Vt(e);return F.each(Vt.Properties,r=>{s[r]=this[r]},this),t&&t.add(s),s}copy(t){super.copy.call(this,t);for(let e=0;e<Vt.Properties.length;e++){let s=Vt.Properties[e];s in t&&(this[s]=t[s])}return this}toObject(){let t={stops:this.stops.map(e=>e.toObject())};return F.each(Vt.Properties,e=>{t[e]=this[e]},this),t}_update(){return(this._flagSpread||this._flagStops)&&this.trigger(g.Types.change),this}flagReset(){return this._flagSpread=this._flagUnits=this._flagStops=!1,super.flagReset.call(this),this}},G=Vt;w(G,"Stop",lt),w(G,"Properties",["spread","stops","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(g.Types.insert,t).unbind(g.Types.remove,e),this._stops=new ct((i||[]).slice(0)),this._stops.bind(g.Types.insert,t).bind(g.Types.remove,e),t(this._stops)}}};function fs(){this._flagStops=!0}function cs(i){let t=i.length;for(;t--;)i[t].bind(g.Types.change,this._renderer.flagStops),i[t].parent=this;this._renderer.flagStops()}function us(i){let t=i.length;for(;t--;)i[t].unbind(g.Types.change,this._renderer.flagStops),delete i[t].parent;this._renderer.flagStops()}var oe=class extends G{_flagEndPoints=!1;_left=null;_right=null;constructor(t,e,s,r,n){super(n);for(let o in vi)Object.defineProperty(this,o,vi[o]);this._renderer.type="linear-gradient",this._renderer.flagEndPoints=ds.bind(this),this.left=new x,this.right=new x,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)}static fromObject(t){let e=new oe().copy(t);return"id"in t&&(e.id=t.id),e}copy(t){super.copy.call(this,t);for(let e=0;e<oe.Properties.length;e++){let s=oe.Properties[e];s in t&&(this[s]=t[s]instanceof x?t[s]:new x().copy(t[s]))}return this}clone(t){let e=this.stops.map(function(r){return r.clone()}),s=new oe(this.left._x,this.left._y,this.right._x,this.right._y,e);return F.each(G.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(g.Types.change),this}flagReset(){return this._flagEndPoints=!1,super.flagReset.call(this),this}},W=oe;w(W,"Stop",lt),w(W,"Properties",["left","right"]);var vi={left:{enumerable:!0,get:function(){return this._left},set:function(i){this._left instanceof x&&this._left.unbind(g.Types.change,this._renderer.flagEndPoints),this._left=i,this._left.bind(g.Types.change,this._renderer.flagEndPoints),this._flagEndPoints=!0}},right:{enumerable:!0,get:function(){return this._right},set:function(i){this._right instanceof x&&this._right.unbind(g.Types.change,this._renderer.flagEndPoints),this._right=i,this._right.bind(g.Types.change,this._renderer.flagEndPoints),this._flagEndPoints=!0}}};function ds(){this._flagEndPoints=!0}var zt=class extends G{_flagRadius=!1;_flagCenter=!1;_flagFocal=!1;_radius=0;_center=null;_focal=null;constructor(t,e,s,r,n,o){super(r);for(let a in ki)Object.defineProperty(this,a,ki[a]);this._renderer.type="radial-gradient",this._renderer.flagCenter=_s.bind(this),this._renderer.flagFocal=ps.bind(this),this.center=new x,this.radius=typeof s=="number"?s:1,this.focal=new x,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 o=="number"&&(this.focal.y=o)}static fromObject(t){let e=new zt().copy(t);return"id"in t&&(e.id=t.id),e}copy(t){super.copy.call(this,t);for(let e=0;e<zt.Properties.length;e++){let s=zt.Properties[e];s in t&&(/(center|focal)i/.test(s)?this[s]=t[s]instanceof x?t[s]:new x().copy(t[s]):typeof t[s]=="number"&&(this[s]=t[MediaKeySystemAccess]))}return this}clone(t){let e=this.stops.map(function(r){return r.clone()}),s=new zt(this.center._x,this.center._y,this._radius,e,this.focal._x,this.focal._y);return F.each(G.Properties.concat(zt.Properties),function(r){s[r]=this[r]},this),t&&t.add(s),s}toObject(){let t=super.toObject.call(this);return F.each(zt.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(g.Types.change),this}flagReset(){return this._flagRadius=this._flagCenter=this._flagFocal=!1,super.flagReset.call(this),this}},X=zt;w(X,"Stop",lt),w(X,"Properties",["center","radius","focal"]);var ki={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(g.Types.change,this._renderer.flagCenter),this._center=i,this._center.bind(g.Types.change,this._renderer.flagCenter),this._flagCenter=!0}},focal:{enumerable:!0,get:function(){return this._focal},set:function(i){this._focal&&this._focal.unbind(g.Types.change,this._renderer.flagFocal),this._focal=i,this._focal.bind(g.Types.change,this._renderer.flagFocal),this._flagFocal=!0}}};function _s(){this._flagCenter=!0}function ps(){this._flagFocal=!0}function qe(i,t){if(t===0||t===1)return!0;let s=i._length*t,r=0;for(let n=0;n<i._lengths.length;n++){let o=i._lengths[n];if(r>=s)return s-r>=0;r+=o}return!1}function ae(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<i._lengths.length;s++){if(r+i._lengths[s]>=t)return t-=r,Math.max(s-1,0)+t/i._lengths[s];r+=i._lengths[s]}return-1}function Fe(i,t,e){let s,r,n,o,a,h,l,f,c=t.controls&&t.controls.right,d=i.controls&&i.controls.left;return s=t.x,a=t.y,r=(c||t).x,h=(c||t).y,n=(d||i).x,l=(d||i).y,o=i.x,f=i.y,c&&t._relative&&(r+=t.x,h+=t.y),d&&i._relative&&(n+=i.x,l+=i.y),We(s,a,r,h,n,l,o,f,e)}function Ke(i,t,e){let s,r,n,o,a,h,l,f,c=t.controls&&t.controls.right,d=i.controls&&i.controls.left;return s=t.x,a=t.y,r=(c||t).x,h=(c||t).y,n=(d||i).x,l=(d||i).y,o=i.x,f=i.y,c&&t._relative&&(r+=t.x,h+=t.y),d&&i._relative&&(n+=i.x,l+=i.y),ye(s,a,r,h,n,l,o,f,e)}function Ft(i){switch(i.renderer.type){case"texture":return V.fromObject(i);case"gradient":return G.fromObject(i);case"linear-gradient":return W.fromObject(i);case"radial-gradient":return X.fromObject(i)}return i}var gs=Math.cos,ms=Math.sin,Ri=Math.tan,$e=[],yt=class extends g{elements=new vt(9);manual=!1;constructor(t,e,s,r,n,o){super();let a=t;Array.isArray(a)||(a=Array.prototype.slice.call(arguments)),this.identity(),a.length>0&&this.set(a)}static Multiply(t,e,s){if(e.length<=3){let S=t,M,B,C,O=e[0]||0,j=e[1]||0,N=e[2]||0;return M=S[0]*O+S[1]*j+S[2]*N,B=S[3]*O+S[4]*j+S[5]*N,C=S[6]*O+S[7]*j+S[8]*N,[M,B,C]}let r=t[0],n=t[1],o=t[2],a=t[3],h=t[4],l=t[5],f=t[6],c=t[7],d=t[8],_=e[0],u=e[1],y=e[2],b=e[3],m=e[4],p=e[5],R=e[6],A=e[7],k=e[8];return s=s||new vt(9),s[0]=r*_+n*b+o*R,s[1]=r*u+n*m+o*A,s[2]=r*y+n*p+o*k,s[3]=a*_+h*b+l*R,s[4]=a*u+h*m+l*A,s[5]=a*y+h*p+l*k,s[6]=f*_+c*b+d*R,s[7]=f*u+c*m+d*A,s[8]=f*y+c*p+d*k,s}static fromObject(t){return new yt().copy(t)}set(t,e,s,r,n,o,a,h,l){if(typeof e>"u"){let f=t;t=f[0],e=f[1],s=f[2],r=f[3],n=f[4],o=f[5],a=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]=o,this.elements[6]=a,this.elements[7]=h,this.elements[8]=l,this.trigger(g.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(g.Types.change)}identity(){return this.elements[0]=yt.Identity[0],this.elements[1]=yt.Identity[1],this.elements[2]=yt.Identity[2],this.elements[3]=yt.Identity[3],this.elements[4]=yt.Identity[4],this.elements[5]=yt.Identity[5],this.elements[6]=yt.Identity[6],this.elements[7]=yt.Identity[7],this.elements[8]=yt.Identity[8],this.trigger(g.Types.change)}multiply(t,e,s,r,n,o,a,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(g.Types.change);if(typeof s>"u"&&(s=1),typeof r>"u"){t=t||0,e=e||0,s=s||0,n=this.elements;let z=n[0]*t+n[1]*e+n[2]*s,it=n[3]*t+n[4]*e+n[5]*s,dt=n[6]*t+n[7]*e+n[8]*s;return[z,it,dt]}let f=this.elements,c=[t,e,s,r,n,o,a,h,l],d=f[0],_=f[1],u=f[2],y=f[3],b=f[4],m=f[5],p=f[6],R=f[7],A=f[8],k=c[0],S=c[1],M=c[2],B=c[3],C=c[4],O=c[5],j=c[6],N=c[7],q=c[8];return this.elements[0]=d*k+_*B+u*j,this.elements[1]=d*S+_*C+u*N,this.elements[2]=d*M+_*O+u*q,this.elements[3]=y*k+b*B+m*j,this.elements[4]=y*S+b*C+m*N,this.elements[5]=y*M+b*O+m*q,this.elements[6]=p*k+R*B+A*j,this.elements[7]=p*S+R*C+A*N,this.elements[8]=p*M+R*O+A*q,this.trigger(g.Types.change)}inverse(t){let e=this.elements;t=t||new yt;let s=e[0],r=e[1],n=e[2],o=e[3],a=e[4],h=e[5],l=e[6],f=e[7],c=e[8],d=c*a-h*f,_=-c*o+h*l,u=f*o-a*l,y=s*d+r*_+n*u;return y?(y=1/y,t.elements[0]=d*y,t.elements[1]=(-c*r+n*f)*y,t.elements[2]=(h*r-n*a)*y,t.elements[3]=_*y,t.elements[4]=(c*s-n*l)*y,t.elements[5]=(-h*s+n*o)*y,t.elements[6]=u*y,t.elements[7]=(-f*s+r*l)*y,t.elements[8]=(a*s-r*o)*y,t):null}scale(t,e){return arguments.length<=1&&(e=t),this.multiply(t,0,0,0,e,0,0,0,1)}rotate(t){let e=gs(t),s=ms(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=Ri(t);return this.multiply(1,e,0,0,1,0,0,0,1)}skewY(t){let e=Ri(t);return this.multiply(1,0,0,e,1,0,0,0,1)}toString(t){return $e.length=0,this.toTransformArray(t,$e),$e.map(U).join(" ")}toTransformArray(t,e){let s=this.elements,r=!!e,n=s[0],o=s[1],a=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]=o,e[4]=l,e[5]=d,e[6]=a,e[7]=f,e[8]=_;return}return[n,h,c,o,l,d,a,f,_]}if(r){e[0]=n,e[1]=h,e[2]=o,e[3]=l,e[4]=a,e[5]=f;return}return[n,h,o,l,a,f]}toArray(t,e){let s=this.elements,r=!!e,n=s[0],o=s[1],a=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]=o,e[2]=a,e[3]=h,e[4]=l,e[5]=f,e[6]=c,e[7]=d,e[8]=_;return}return[n,o,a,h,l,f,c,d,_]}if(r){e[0]=n,e[1]=o,e[2]=a,e[3]=h,e[4]=l,e[5]=f;return}return[n,o,a,h,l,f]}toObject(){return{renderer:{type:"matrix"},elements:this.toArray(!0),manual:!!this.manual}}clone(){return new yt().copy(this)}},At=yt;w(At,"Identity",[1,0,0,0,1,0,0,0,1]);ze(At);var Te=class extends pt{_flagMatrix=!0;_flagScale=!1;_matrix=null;_worldMatrix=null;_position=null;_rotation=0;_scale=1;_skewX=0;_skewY=0;constructor(){super();for(let t in Ee)Object.defineProperty(this,t,Ee[t]);this._renderer.flagMatrix=Ai.bind(this),this.isShape=!0,this.matrix=new At,this.worldMatrix=new At,this.position=new x,this.rotation=0,this.scale=1,this.skewX=0,this.skewY=0}static fromObject(t){let e=new Te().copy(t);return"id"in t&&(e.id=t.id),e}get renderer(){return this._renderer}set renderer(t){this._renderer=t}get translation(){return Ee.position.get.apply(this,arguments)}set translation(t){Ee.position.set.apply(this,arguments)}addTo(t){return t.add(this),this}remove(){return this.parent?(this.parent.remove(this),this):this}copy(t){return super.copy.call(this,t),"position"in t&&(t.position instanceof x?this.position=t.position:this.position.copy(t.position)),"rotation"in t&&(this.rotation=t.rotation),"scale"in t&&(this.scale=typeof t.scale=="number"||t.scale instanceof x?t.scale:new x(t.scale.x,t.scale.y)),"skewX"in t&&(this.skewX=t.skewX),"skewY"in t&&(this.skewY=t.skewY),"matrix"in t&&t.matrix.manual&&(this.matrix.copy(t.matrix),this.matrix.manual=!0),this}clone(t){let e=new Te;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()}toObject(){let t=super.toObject.call(this);return t.renderer={type:"shape"},t.isShape=!0,t.translation=this.translation.toObject(),t.rotation=this.translation.rotation,t.scale=this.scale instanceof x?this.scale.toObject():this.scale,t.skewX=this.skewX,t.skewY=this.skewY,t.matrix=this.matrix.toObject(),t}_update(t){return!this._matrix.manual&&this._flagMatrix&&(this._matrix.identity().translate(this.position.x,this.position.y),this._matrix.rotate(this.rotation),this._scale instanceof x?this._matrix.scale(this._scale.x,this._scale.y):this._matrix.scale(this._scale),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}},ut=Te;w(ut,"Properties",["position","rotation","scale","skewX","skewY","matrix","worldMatrix"]);var Ee={position:{enumerable:!0,get:function(){return this._position},set:function(i){this._position&&this._position.unbind(g.Types.change,this._renderer.flagMatrix),this._position=i,this._position.bind(g.Types.change,this._renderer.flagMatrix),Ai.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 x&&this._scale.unbind(g.Types.change,this._renderer.flagMatrix),this._scale=i,this._scale instanceof x&&this._scale.bind(g.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 je(this,this._worldMatrix),this._worldMatrix},set:function(i){this._worldMatrix=i}}};function Ai(){this._flagMatrix=!0}var le=Math.min,he=Math.max,ys=Math.ceil,bs=Math.floor,xs=new x,It=class extends ut{_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 Si)Object.defineProperty(this,n,Si[n]);this._renderer.type="path",this._renderer.flagVertices=Je.bind(this),this._renderer.bindVertices=Ze.bind(this),this._renderer.unbindVertices=Qe.bind(this),this._renderer.flagFill=ti.bind(this),this._renderer.flagStroke=ei.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}static fromObject(t){let e=typeof t.fill=="string"?t.fill:Ft(t.fill),s=typeof t.stroke=="string"?t.stroke:Ft(t.stroke),r=new It().copy({...t,fill:e,stroke:s});return"id"in t&&(r.id=t.id),r}copy(t){super.copy.call(this,t),this.vertices=[];for(let e=0;e<t.vertices.length;e++){let s=t.vertices[e];s instanceof T?this.vertices.push(t.vertices[e].clone()):this.vertices.push(new T().copy(s))}for(let e=0;e<It.Properties.length;e++){let s=It.Properties[e];s in t&&(this[s]=t[s])}return this}clone(t){let e=new It;for(let s=0;s<this.vertices.length;s++)e.vertices.push(this.vertices[s].clone());for(let s=0;s<It.Properties.length;s++){let r=It.Properties[s];e[r]=this[r]}return e.className=this.className,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),t&&t.add(e),e._update()}toObject(){let t=super.toObject.call(this);return t.renderer.type="path",t.vertices=this.vertices.map(e=>e.toObject()),F.each(It.Properties,e=>{typeof this[e]<"u"&&(this[e].toObject?t[e]=this[e].toObject():t[e]=this[e])},this),t}noFill(){return this.fill="none",this}noStroke(){return this.stroke="none",this.linewidth=0,this}corner(){let t=this.getBoundingClientRect(!0),e=t.width/2,s=t.height/2,r=t.left+t.width/2,n=t.top+t.height/2;for(let o=0;o<this.vertices.length;o++){let a=this.vertices[o];a.x-=r,a.y-=n,a.x+=e,a.y+=s}return this.mask&&(this.mask.translation.x-=r,this.mask.translation.x+=e,this.mask.translation.y-=n,this.mask.translation.y+=s),this}center(){let t=this.getBoundingClientRect(!0),e=t.left+t.width/2-this.translation.x,s=t.top+t.height/2-this.translation.y;for(let r=0;r<this.vertices.length;r++){let n=this.vertices[r];n.x-=e,n.y-=s}return this.mask&&(this.mask.translation.x-=e,this.mask.translation.y-=s),this}getBoundingClientRect(t){let e,s,r,n,o,a,h=1/0,l=-1/0,f=1/0,c=-1/0;if(this._update(!0),e=t?this.matrix:this.worldMatrix,s=(this.linewidth||0)/2,r=this._renderer.vertices.length,this.linewidth>0||this.stroke&&!/(transparent|none)/i.test(this.stroke))if(this.matrix.manual){let{scaleX:d,scaleY:_}=Et(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<r;n++){a=this._renderer.vertices[n],o=this._renderer.vertices[(n+r-1)%r];let[d,_]=e.multiply(o.x,o.y),[u,y]=e.multiply(a.x,a.y);if(o.controls&&a.controls){let b=o.controls.right.x,m=o.controls.right.y;o.relative&&(b+=o.x,m+=o.y);let[p,R]=e.multiply(b,m),A=a.controls.left.x,k=a.controls.left.y;a.relative&&(A+=a.x,k+=a.y);let[S,M]=e.multiply(A,k),B=Xe(d,_,p,R,S,M,u,y);f=le(B.min.y-s,f),h=le(B.min.x-s,h),l=he(B.max.x+s,l),c=he(B.max.y+s,c)}else n<=1&&(f=le(_-s,f),h=le(d-s,h),l=he(d+s,l),c=he(_+s,c)),f=le(y-s,f),h=le(u-s,h),l=he(u+s,l),c=he(y+s,c)}return{top:f,left:h,right:l,bottom:c,width:l-h,height:c-f}}getPointAt(t,e){let s,r,n,o,a,h,l,f,c,d,_,u,y,b,m,p=this.length*Math.min(Math.max(t,0),1),R=this.vertices.length,A=R-1,k=null,S=null;for(let et=0,xt=this._lengths.length,ot=0;et<xt;et++){if(ot+this._lengths[et]>=p){this._closed?(s=nt(et,R),r=nt(et-1,R),et===0&&(s=r,r=et)):(s=et,r=Math.min(Math.max(et-1,0),A)),k=this.vertices[s],S=this.vertices[r],p-=ot,this._lengths[et]!==0?t=p/this._lengths[et]:t=0;break}ot+=this._lengths[et]}if(k===null||S===null)return null;if(k){if(!S)return k}else return S;m=S.controls&&S.controls.right,b=k.controls&&k.controls.left,a=S.x,d=S.y,h=(m||S).x,_=(m||S).y,l=(b||k).x,u=(b||k).y,f=k.x,y=k.y,m&&S.relative&&(h+=S.x,_+=S.y),b&&k.relative&&(l+=k.x,u+=k.y),o=se(t,a,h,l,f),c=se(t,d,_,u,y);let M=ft(a,h,t),B=ft(d,_,t),C=ft(h,l,t),O=ft(_,u,t),j=ft(l,f,t),N=ft(u,y,t),q=ft(M,C,t),z=ft(B,O,t),it=ft(C,j,t),dt=ft(O,N,t);return F.isObject(e)?(e.x=o,e.y=c,e instanceof T&&(e.controls.left.x=q,e.controls.left.y=z,e.controls.right.x=it,e.controls.right.y=dt,(typeof e.relative!="boolean"||e.relative)&&(e.controls.left.x-=o,e.controls.left.y-=c,e.controls.right.x-=o,e.controls.right.y-=c)),e.t=t,e):(n=new T(o,c,q-o,z-c,it-o,dt-c,this._curved?v.curve:v.line),n.t=t,n)}plot(){if(this.curved)return He(this._collection,this.closed),this;for(let t=0;t<this._collection.length;t++)this._collection[t].command=t===0?v.move:v.line;return this}subdivide(t){this._update();let e=this.vertices.length-1,s=this._closed||this.vertices[e]._command===v.close,r=this.vertices[e],n=[],o;return F.each(this.vertices,function(a,h){if(h<=0&&!s){r=a;return}if(a.command===v.move){n.push(new T(r.x,r.y)),h>0&&(n[n.length-1].command=v.line),r=a;return}o=Ke(a,r,t),n=n.concat(o),F.each(o,function(l,f){f<=0&&r.command===v.move?l.command=v.move:l.command=v.line}),h>=e&&(this._closed&&this._automatic&&(r=a,o=Ke(a,r,t),n=n.concat(o),F.each(o,function(l,f){f<=0&&r.command===v.move?l.command=v.move:l.command=v.line})),n.push(new T(a.x,a.y)),n[n.length-1].command=s?v.close:v.line),r=a},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,o=this.vertices[r],a=0;return typeof this._lengths>"u"&&(this._lengths=[]),F.each(this.vertices,function(h,l){if(l<=0&&!n||h.command===v.move){o=h,this._lengths[l]=0;return}this._lengths[l]=Fe(h,o,t),a+=this._lengths[l],l>=r&&n&&(o=this.vertices[(l+1)%s],this._lengths[l+1]=Fe(h,o,t),a+=this._lengths[l+1]),o=h},this),this._length=a,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=ae(this,s*this._length),o=ae(this,r*this._length),a=ys(n),h=bs(o),l,f,c,d,_,u;for(this._renderer.vertices.length=0,u=0;u<t;u++)this._renderer.collection.length<=u&&this._renderer.collection.push(new T),u>h&&!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(x.zero,1-_.t):this._renderer.collection[u-1].controls.right.copy(c.controls.right).lerp(c,1-_.t))):u>=a&&u<=h&&(_=this._renderer.collection[u].copy(this._collection[u]),this._renderer.vertices.push(_),u===h&&qe(this,r)?(f=_,!e&&f.controls&&(f.relative?f.controls.right.clear():f.controls.right.copy(f))):u===a&&qe(this,s)&&(l=_,l.command=v.move,!e&&l.controls&&(l.relative?l.controls.left.clear():l.controls.left.copy(l))));a>0&&!l&&(u=a-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(x.zero,_.t):(xs.copy(d),this._renderer.collection[u+1].controls.left.copy(d.controls.left).lerp(d,_.t))))}return ut.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,ut.prototype.flagReset.call(this),this}},P=It;w(P,"Properties",["fill","stroke","linewidth","opacity","visible","cap","join","miter","closed","curved","automatic","beginning","ending","dashes"]),w(P,"Utils",{getCurveLength:Fe});var Si={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 G||this._fill instanceof W||this._fill instanceof X||this._fill instanceof V)&&this._fill.unbind(g.Types.change,this._renderer.flagFill),this._fill=i,this._flagFill=!0,(this._fill instanceof G||this._fill instanceof W||this._fill instanceof X||this._fill instanceof V)&&this._fill.bind(g.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(i){(this._stroke instanceof G||this._stroke instanceof W||this._stroke instanceof X||this._stroke instanceof V)&&this._stroke.unbind(g.Types.change,this._renderer.flagStroke),this._stroke=i,this._flagStroke=!0,(this._stroke instanceof G||this._stroke instanceof W||this._stroke instanceof X||this._stroke instanceof V)&&this._stroke.bind(g.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";F.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(g.Types.insert,t).unbind(g.Types.remove,e),i instanceof ct?this._collection=i:this._collection=new ct(i||[]),this._collection.bind(g.Types.insert,t).bind(g.Types.remove,e),t(this._collection)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(i){this._mask=i,this._flagMask=!0,F.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 Je(){this._flagVertices=!0,this._flagLength=!0,this.parent&&(this.parent._flagLength=!0)}function Ze(i){let t=i.length;for(;t--;)i[t].bind(g.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()}function Qe(i){let t=i.length;for(;t--;)i[t].unbind(g.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()}function ti(){this._flagFill=!0}function ei(){this._flagStroke=!0}var fe=class extends P{constructor(t,e,s,r){let n=[new T,new T,new T,new T];super(n,!0,!1,!0),this._renderer.type="rectangle";for(let o in Fi)Object.defineProperty(this,o,Fi[o]);this.width=typeof s=="number"?s:1,this.height=typeof r=="number"?r:1,this.origin=new x,typeof t=="number"&&(this.translation.x=t),typeof e=="number"&&(this.translation.y=e),this._update()}static fromObject(t){let e=new fe().copy(t);return"id"in t&&(e.id=t.id),e}copy(t){super.copy.call(this,t);for(let e=0;e<fe.Properties.length;e++){let s=fe.Properties[e];s in t&&typeof t[s]=="number"&&(this[s]=t[s])}return this}_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 fe(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;s<P.Properties.length;s++){let r=P.Properties[s];e[r]=this[r]}return t&&t.add(e),e}toObject(){let t=super.toObject.call(this);return t.renderer.type="rectangle",t.width=this.width,t.height=this.height,t.origin=this.origin.toObject(),t}},gt=fe;w(gt,"Properties",["width","height"]);var Fi={width:{enumerable:!0,get:function(){return this._width},set:function(i){this._width=i,this._flagWidth=!0}},height:{enumerable:!0,get:function(){return this._height},set:function(i){this._height=i,this._flagHeight=!0}},origin:{enumerable:!0,get:function(){return this._origin},set:function(i){this._origin&&this._origin.unbind(g.Types.change,this._renderer.flagVertices),this._origin=i,this._origin.bind(g.Types.change,this._renderer.flagVertices),this._renderer.flagVertices()}}};var ce=class extends gt{_flagTexture=!1;_flagColumns=!1;_flagRows=!1;_flagFrameRate=!1;_flagIndex=!1;_amount=1;_duration=0;_startTime=0;_playing=!1;_firstFrame=0;_lastFrame=0;_loop=!0;_texture=null;_columns=1;_rows=1;_frameRate=0;_index=0;_origin=null;constructor(t,e,s,r,n,o){super(e,s,0,0);for(let a in Ei)Object.defineProperty(this,a,Ei[a]);this.noStroke(),this.noFill(),t instanceof V?this.texture=t:typeof t=="string"&&(this.texture=new V(t)),this.origin=new x,this._update(),typeof r=="number"&&(this.columns=r),typeof n=="number"&&(this.rows=n),typeof o=="number"&&(this.frameRate=o),this.index=0}static fromObject(t){let e=new ce().copy(t);return"id"in t&&(e.id=t.id),e}copy(t){super.copy.call(this,t);for(let e=0;e<ce.Properties.length;e++){let s=ce.Properties[e];s in t&&(this[s]=t[s])}return this}play(t,e,s){return this._playing=!0,this._firstFrame=0,this._lastFrame=this.amount-1,this._startTime=F.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=0,this}clone(t){let e=new ce(this.texture,this.translation.x,this.translation.y,this.columns,this.rows,this.frameRate);return this.playing&&e.play(this._firstFrame,this._lastFrame),e.loop=this.loop,e.firstFrame=this.firstFrame,e.lastFrame=this.lastFrame,t&&t.add(e),e}toObject(){let t=super.toObject.call(this);return t.texture=this.texture.toObject(),t.columns=this.columns,t.rows=this.rows,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._texture,e=this._columns,s=this._rows,r,n,o,a,h,l,f,c,d;if(t&&((this._flagColumns||this._flagRows)&&(this._amount=this._columns*this._rows),this._flagFrameRate&&(this._duration=1e3*this._amount/this._frameRate),this._flagTexture&&(this.fill=t),t.loaded)){f=t.image.width,c=t.image.height,r=f/e,n=c/s,a=this._amount,this.width!==r&&(this.width=r),this.height!==n&&(this.height=n),this._playing&&this._frameRate>0&&(F.isNaN(this._lastFrame)&&(this._lastFrame=a-1),o=F.performance.now()-this._startTime,d=this._lastFrame+1,h=1e3*(d-this._firstFrame)/this._frameRate,this._loop?o=o%h:o=Math.min(o,h),l=ft(this._firstFrame,d,o/h),l=Math.floor(l),l!==this._index&&(this._index=l,l>=this._lastFrame-1&&this._onLastFrame&&this._onLastFrame()));let _=this._index%e,u=Math.floor(this._index/e),y=-r*_+(f-r)/2,b=-n*u+(c-n)/2;y!==t.offset.x&&(t.offset.x=y),b!==t.offset.y&&(t.offset.y=b)}return super._update.call(this),this}flagReset(){return this._flagTexture=this._flagColumns=this._flagRows=this._flagFrameRate=!1,super.flagReset.call(this),this}},jt=ce;w(jt,"Properties",["texture","columns","rows","frameRate","index","firstFrame","lastFrame","loop"]);var Ei={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}},firstFrame:{enumerable:!0,get:function(){return this._firstFrame},set:function(i){this._firstFrame=i}},lastFrame:{enumerable:!0,get:function(){return this._lastFrame},set:function(i){this._lastFrame=i}},loop:{enumerable:!0,get:function(){return this._loop},set:function(i){this._loop=!!i}}};var be=class extends ct{#t={};get ids(){return this.#t}constructor(t){t=Array.isArray(t)?t:Array.prototype.slice.call(arguments),super(t),this.attach(t),this.on(g.Types.insert,this.attach),this.on(g.Types.remove,this.detach)}attach(t){for(let e=0;e<t.length;e++){let s=t[e];s&&s.id&&(this.ids[s.id]=s)}return this}detach(t){for(let e=0;e<t.length;e++)delete this.ids[t[e].id];return this}};var Ut=class extends P{_flagStartAngle=!1;_flagEndAngle=!1;_flagInnerRadius=!1;_flagOuterRadius=!1;_startAngle=0;_endAngle=J;_innerRadius=0;_outerRadius=0;constructor(t,e,s,r,n,o,a){let h=a||Q.Resolution*3,l=[];for(let f=0;f<h;f++)l.push(new T);super(l,!0,!1,!0),this._renderer.type="arc-segment";for(let f in Ti)Object.defineProperty(this,f,Ti[f]);typeof s=="number"&&(this.innerRadius=s),typeof r=="number"&&(this.outerRadius=r),typeof n=="number"&&(this.startAngle=n),typeof o=="number"&&(this.endAngle=o),this._update(),typeof t=="number"&&(this.translation.x=t),typeof e=="number"&&(this.translation.y=e)}static fromObject(t){let e=new Ut().copy(t);return"id"in t&&(e.id=t.id),e}copy(t){super.copy.call(this,t);for(let e=0;e<Ut.Properties.length;e++){let s=Ut.Properties[e];s in t&&typeof t[s]=="number"&&(this[s]=t[s])}return this}_update(){if(this._flagVertices||this._flagStartAngle||this._flagEndAngle||this._flagInnerRadius||this._flagOuterRadius){let t=this._startAngle,e=this._endAngle,s=this._innerRadius,r=this._outerRadius,n=nt(t,J)===nt(e,J),o=s>0,a=this.vertices,h=o?a.length/2:a.length,l,f=0,c,d,_,u,y,b,m,p,R;for(n?h--:o||(h-=2),c=0,d=h-1;c<h;c++){switch(_=c/d,u=a[f],y=_*(e-t)+t,b=(e-t)/h,m=r*Math.cos(y),p=r*Math.sin(y),c){case 0:l=v.move;break;default:l=v.curve}u.command=l,u.x=m,u.y=p,u.controls.left.clear(),u.controls.right.clear(),u.command===v.curve&&(R=r*b/Math.PI,u.controls.left.x=R*Math.cos(y-Z),u.controls.left.y=R*Math.sin(y-Z),u.controls.right.x=R*Math.cos(y+Z),u.controls.right.y=R*Math.sin(y+Z),c===1&&u.controls.left.multiplyScalar(2),c===d&&u.controls.right.multiplyScalar(2)),f++}if(o){for(n?(a[f].command=v.close,f++):(h--,d=h-1),c=0;c<h;c++)_=c/d,u=a[f],y=(1-_)*(e-t)+t,b=(e-t)/h,m=s*Math.cos(y),p=s*Math.sin(y),l=v.curve,c<=0&&(l=n?v.move:v.line),u.command=l,u.x=m,u.y=p,u.controls.left.clear(),u.controls.right.clear(),u.command===v.curve&&(R=s*b/Math.PI,u.controls.left.x=R*Math.cos(y+Z),u.controls.left.y=R*Math.sin(y+Z),u.controls.right.x=R*Math.cos(y-Z),u.controls.right.y=R*Math.sin(y-Z),c===1&&u.controls.left.multiplyScalar(2),c===d&&u.controls.right.multiplyScalar(2)),f++;a[f].copy(a[0]),a[f].command=v.line}else n||(a[f].command=v.line,a[f].x=0,a[f].y=0,f++,a[f].copy(a[0]),a[f].command=v.line)}return super._update.call(this),this}flagReset(){return super.flagReset.call(this),this._flagStartAngle=this._flagEndAngle=this._flagInnerRadius=this._flagOuterRadius=!1,this}clone(t){let e=this.innerRadius,s=this.outerRadius,r=this.startAngle,n=this.endAngle,o=this.vertices.length,a=new Ut(0,0,e,s,r,n,o);a.translation.copy(this.translation),a.rotation=this.rotation,a.scale=this.scale,a.skewX=this.skewX,a.skewY=this.skewY,this.matrix.manual&&a.matrix.copy(this.matrix);for(let h=0;h<P.Properties.length;h++){let l=P.Properties[h];a[l]=this[l]}return t&&t.add(a),a}toObject(){let t=super.toObject.call(this);t.renderer.type="arc-segment";for(let e=0;e<Ut.Properties.length;e++){let s=Ut.Properties[e];t[s]=this[s]}return t}},Dt=Ut;w(Dt,"Properties",["startAngle","endAngle","innerRadius","outerRadius"]);var Ti={startAngle:{enumerable:!0,get:function(){return this._startAngle},set:function(i){this._startAngle=i,this._flagStartAngle=!0}},endAngle:{enumerable:!0,get:function(){return this._endAngle},set:function(i){this._endAngle=i,this._flagEndAngle=!0}},innerRadius:{enumerable:!0,get:function(){return this._innerRadius},set:function(i){this._innerRadius=i,this._flagInnerRadius=!0}},outerRadius:{enumerable:!0,get:function(){return this._outerRadius},set:function(i){this._outerRadius=i,this._flagOuterRadius=!0}}};var ii=Math.cos,si=Math.sin,Wt=class extends P{_flagRadius=!1;_radius=0;constructor(t,e,s,r){let n=r?Math.max(r,2):4,o=[];for(let a=0;a<n;a++)o.push(new T(0,0,0,0,0,0));super(o,!0,!0,!0),this._renderer.type="circle";for(let a in Mi)Object.defineProperty(this,a,Mi[a]);typeof s=="number"&&(this.radius=s),this._update(),typeof t=="number"&&(this.translation.x=t),typeof e=="number"&&(this.translation.y=e)}static fromObject(t){let e=new Wt().copy(t);return"id"in t&&(e.id=t.id),e}copy(t){super.copy.call(this,t);for(let e=0;e<Wt.Properties.length;e++){let s=Wt.Properties[e];s in t&&typeof t[s]=="number"&&(this[s]=t[s])}return this}_update(){if(this._flagVertices||this._flagRadius){let t=this.vertices.length;!this._closed&&t>2&&(t-=1);let e=4/3*Math.tan(Math.PI/(t*2)),s=this._radius,r=s*e;for(let n=0;n<this.vertices.length;n++){let a=n/t*J,h=s*ii(a),l=s*si(a),f=r*ii(a-Z),c=r*si(a-Z),d=r*ii(a+Z),_=r*si(a+Z),u=this.vertices[n];u.command=n===0?v.move:v.curve,u.set(h,l),u.controls.left.set(f,c),u.controls.right.set(d,_)}}return super._update.call(this),this}flagReset(){return this._flagRadius=!1,super.flagReset.call(this),this}clone(t){let e=new Wt(0,0,this.radius,this.vertices.length);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;s<P.Properties.length;s++){let r=P.Properties[s];e[r]=this[r]}return t&&t.add(e),e}toObject(){let t=super.toObject.call(this);t.renderer.type="circle";for(let e=0;e<Wt.Properties.length;e++){let s=Wt.Properties[e];t[s]=this[s]}return t}},Mt=Wt;w(Mt,"Properties",["radius"]);var Mi={radius:{enumerable:!0,get:function(){return this._radius},set:function(i){this._radius=i,this._flagRadius=!0}}};var ri=Math.cos,ni=Math.sin,Xt=class extends P{_flagWidth=!1;_flagHeight=!1;_width=0;_height=0;constructor(t,e,s,r,n){typeof r!="number"&&typeof s=="number"&&(r=s);let o=n?Math.max(n,2):4,a=[];for(let h=0;h<o;h++)a.push(new T);super(a,!0,!0,!0),this._renderer.type="ellipse";for(let h in Oi)Object.defineProperty(this,h,Oi[h]);typeof s=="number"&&(this.width=s*2),typeof r=="number"&&(this.height=r*2),this._update(),typeof t=="number"&&(this.translation.x=t),typeof e=="number"&&(this.translation.y=e)}static fromObject(t){let e=new Xt().copy(t);return"id"in t&&(e.id=t.id),e}copy(t){super.copy.call(this,t);for(let e=0;e<Xt.Properties.length;e++){let s=Xt.Properties[e];s in t&&typeof t[s]=="number"&&(this[s]=t[s])}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight){let t=this.vertices.length;!this._closed&&t>2&&(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<this.vertices.length;n++){let a=n/t*J,h=s*ri(a),l=r*ni(a),f=s*e*ri(a-Z),c=r*e*ni(a-Z),d=s*e*ri(a+Z),_=r*e*ni(a+Z),u=this.vertices[n];u.command=n===0?v.move:v.curve,u.set(h,l),u.controls.left.set(f,c),u.controls.right.set(d,_)}}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=!1,super.flagReset.call(this),this}clone(t){let e=this.width/2,s=this.height/2,r=this.vertices.length,n=new Xt(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 o=0;o<P.Properties.length;o++){let a=P.Properties[o];n[a]=this[a]}return t&&t.add(n),n}toObject(){let t=super.toObject.call(this);t.renderer.type="ellipse";for(let e=0;e<Xt.Properties.length;e++){let s=Xt.Properties[e];t[s]=this[s]}return t}},Ot=Xt;w(Ot,"Properties",["width","height"]);var Oi={width:{enumerable:!0,get:function(){return this._width},set:function(i){this._width=i,this._flagWidth=!0}},height:{enumerable:!0,get:function(){return this._height},set:function(i){this._height=i,this._flagHeight=!0}}};var ws=Math.ceil,vs=Math.floor,Bt=class extends ut{_flagVertices=!0;_flagLength=!0;_flagFill=!0;_flagStroke=!0;_flagLinewidth=!0;_flagOpacity=!0;_flagVisible=!0;_flagSize=!0;_flagSizeAttenuation=!0;_length=0;_fill="#fff";_stroke="#000";_linewidth=1;_opacity=1;_visible=!0;_size=1;_sizeAttenuation=!1;_beginning=0;_ending=1;_dashes=null;constructor(t){super();for(let e in Pi)Object.defineProperty(this,e,Pi[e]);this._renderer.type="points",this._renderer.flagVertices=Je.bind(this),this._renderer.bindVertices=Ze.bind(this),this._renderer.unbindVertices=Qe.bind(this),this._renderer.flagFill=ti.bind(this),this._renderer.flagStroke=ei.bind(this),this._renderer.vertices=null,this._renderer.collection=null,this.sizeAttenuation=!1,this.beginning=0,this.ending=1,this.fill="#fff",this.stroke="#000",this.className="",this.visible=!0,this.vertices=t,this.dashes=[],this.dashes.offset=0}static fromObject(t){let e=typeof t.fill=="string"?t.fill:Ft(t.fill),s=typeof t.stroke=="string"?t.stroke:Ft(t.stroke),r=new Bt().copy({...t,fill:e,stroke:s});return"id"in t&&(r.id=t.id),r}copy(t){super.copy.call(this,t);for(let e=0;e<t.vertices.length;e++){let s=t.vertices[e];s instanceof T?this.vertices.push(t.vertices[e].clone()):this.vertices.push(new T().copy(s))}for(let e=0;e<Bt.Properties.length;e++){let s=Bt.Properties[e];s in t&&(this[s]=t[s])}return this}clone(t){let e=new Bt;for(let s=0;s<this.vertices.length;s++)e.vertices.push(this.vertices[s].clone());for(let s=0;s<Bt.Properties.length;s++){let r=Bt.Properties[s];e[r]=this[r]}return e.className=this.className,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),t&&t.add(e),e._update()}toObject(){let t=super.toObject.call(this);return t.renderer.type="points",t.vertices=this.vertices.map(e=>e.toObject()),F.each(Bt.Properties,function(e){typeof this[e]<"u"&&(this[e].toObject?t[e]=this[e].toObject():t[e]=this[e])},this),t}noFill=P.prototype.noFill;noStroke=P.prototype.noStroke;corner=P.prototype.corner;center=P.prototype.center;getBoundingClientRect=P.prototype.getBoundingClientRect;subdivide(t){this._update();let e=[];for(let s=0;s<this.vertices.length;s++){let r=this.vertices[s],n=this.vertices[s-1];if(!n)continue;let o=r.x,a=r.y,h=n.x,l=n.y,f=ye(o,a,o,a,h,l,h,l,t);e=e.concat(f)}return this.vertices=e,this}_updateLength=P.prototype._updateLength;_update(){if(this._flagVertices){this._flagLength&&this._updateLength(void 0,!0);let t=Math.min(this._beginning,this._ending),e=Math.max(this._beginning,this._ending),s=ae(this,t*this._length),r=ae(this,e*this._length),n=ws(s),o=vs(r),a=0,h;this._renderer.vertices=[],this._renderer.collection=[];for(let l=0;l<this._collection.length;l++)l>=n&&l<=o&&(h=this._collection[l],this._renderer.collection.push(h),this._renderer.vertices[a*2+0]=h.x,this._renderer.vertices[a*2+1]=h.y,a++)}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}},Ht=Bt;w(Ht,"Properties",["fill","stroke","linewidth","opacity","visible","size","sizeAttenuation","beginning","ending","dashes"]);var Pi={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 G||this._fill instanceof W||this._fill instanceof X||this._fill instanceof V)&&this._fill.unbind(g.Types.change,this._renderer.flagFill),this._fill=i,this._flagFill=!0,(this._fill instanceof G||this._fill instanceof W||this._fill instanceof X||this._fill instanceof V)&&this._fill.bind(g.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(i){(this._stroke instanceof G||this._stroke instanceof W||this._stroke instanceof X||this._stroke instanceof V)&&this._stroke.unbind(g.Types.change,this._renderer.flagStroke),this._stroke=i,this._flagStroke=!0,(this._stroke instanceof G||this._stroke instanceof W||this._stroke instanceof X||this._stroke instanceof V)&&this._stroke.bind(g.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(g.Types.insert,t).unbind(g.Types.remove,e),i instanceof ct?this._collection=i:this._collection=new ct(i||[]),this._collection.bind(g.Types.insert,t).bind(g.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 ks=Math.cos,Rs=Math.sin,Yt=class extends P{_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(),this._renderer.type="polygon";for(let n in Ci)Object.defineProperty(this,n,Ci[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)}static fromObject(t){let e=new Yt().copy(t);return"id"in t&&(e.id=t.id),e}copy(t){super.copy.call(this,t);for(let e=0;e<Yt.Properties.length;e++){let s=Yt.Properties[e];s in t&&typeof t[s]=="number"&&(this[s]=t[s])}return this}_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<e;r++){let n=(r+.5)/t,o=J*n+Math.PI/2,a=this._width*ks(o)/2,h=this._height*Rs(o)/2;r>=s?this.vertices.push(new T(a,h)):this.vertices[r].set(a,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 Yt(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;s<P.Properties.length;s++){let r=P.Properties[s];e[r]=this[r]}return t&&t.add(e),e}toObject(){let t=super.toObject.call(this);t.renderer.type="polygon";for(let e=0;e<Yt.Properties.length;e++){let s=Yt.Properties[e];t[s]=this[s]}return t}},Gt=Yt;w(Gt,"Properties",["width","height","sides"]);var Ci={radius:{enumerable:!0,get:function(){return this._radius},set:function(i){this._radius=i,this.width=i*2,this.height=i*2}},width:{enumerable:!0,get:function(){return this._width},set:function(i){this._width=i,this._flagWidth=!0,this._radius=Math.max(this.width,this.height)/2}},height:{enumerable:!0,get:function(){return this._height},set:function(i){this._height=i,this._flagHeight=!0,this._radius=Math.max(this.width,this.height)/2}},sides:{enumerable:!0,get:function(){return this._sides},set:function(i){this._sides=i,this._flagSides=!0}}};var qt=class extends P{_flagWidth=!1;_flagHeight=!1;_flagRadius=!1;_width=0;_height=0;_radius=12;constructor(t,e,s,r,n){typeof n>"u"&&typeof s=="number"&&typeof r=="number"&&(n=Math.floor(Math.min(s,r)/12));let o=[];for(let a=0;a<10;a++)o.push(new T(0,0,0,0,0,0,a===0?v.move:v.curve));super(o),this._renderer.type="rounded-rectangle";for(let a in Li)Object.defineProperty(this,a,Li[a]);this.closed=!0,this.automatic=!1,this._renderer.flagRadius=As.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)}static fromObject(t){let e=new qt().copy(t);return"id"in t&&(e.id=t.id),e}copy(t){super.copy.call(this,t);for(let e=0;e<qt.Properties.length;e++){let s=qt.Properties[e];if(s in t){let r=t[s];/radius/i.test(s)?this[s]=typeof r=="number"||r instanceof x?r:new x().copy(r):typeof r=="number"&&(this[s]=r)}}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight||this._flagRadius){let t=this._width,e=this._height,s,r;this._radius instanceof x?(s=this._radius.x,r=this._radius.y):(s=this._radius,r=this._radius);let n,o=t/2,a=e/2;n=this.vertices[0],n.x=-(o-s),n.y=-a,n=this.vertices[1],n.x=o-s,n.y=-a,n.controls.left.clear(),n.controls.right.x=s,n.controls.right.y=0,n=this.vertices[2],n.x=o,n.y=-(a-r),n.controls.right.clear(),n.controls.left.clear(),n=this.vertices[3],n.x=o,n.y=a-r,n.controls.left.clear(),n.controls.right.x=0,n.controls.right.y=r,n=this.vertices[4],n.x=o-s,n.y=a,n.controls.right.clear(),n.controls.left.clear(),n=this.vertices[5],n.x=-(o-s),n.y=a,n.controls.left.clear(),n.controls.right.x=-s,n.controls.right.y=0,n=this.vertices[6],n.x=-o,n.y=a-r,n.controls.left.clear(),n.controls.right.clear(),n=this.vertices[7],n.x=-o,n.y=-(a-r),n.controls.left.clear(),n.controls.right.x=0,n.controls.right.y=-r,n=this.vertices[8],n.x=-(o-s),n.y=-a,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 qt(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 o=0;o<P.Properties.length;o++){let a=P.Properties[o];n[a]=this[a]}return t&&t.add(n),n}toObject(){let t=super.toObject.call(this);t.renderer.type="rounded-rectangle";for(let e=0;e<qt.Properties.length;e++){let s=qt.Properties[e];t[s]=this[s]}return t.radius=typeof this.radius=="number"?this.radius:this.radius.toObject(),t}},Pt=qt;w(Pt,"Properties",["width","height","radius"]);var Li={width:{enumerable:!0,get:function(){return this._width},set:function(i){this._width=i,this._flagWidth=!0}},height:{enumerable:!0,get:function(){return this._height},set:function(i){this._height=i,this._flagHeight=!0}},radius:{enumerable:!0,get:function(){return this._radius},set:function(i){this._radius instanceof x&&this._radius.unbind(g.Types.change,this._renderer.flagRadius),this._radius=i,this._radius instanceof x&&this._radius.bind(g.Types.change,this._renderer.flagRadius),this._flagRadius=!0}}};function As(){this._flagRadius=!0}var Ss=Math.cos,Fs=Math.sin,Kt=class extends P{_flagInnerRadius=!1;_flagOuterRadius=!1;_flagSides=!1;_innerRadius=0;_outerRadius=0;_sides=0;constructor(t,e,s,r,n){arguments.length<=3&&(r=s,s=r/2),(typeof n!="number"||n<=0)&&(n=5),super(),this._renderer.type="star";for(let o in Ii)Object.defineProperty(this,o,Ii[o]);this.closed=!0,this.automatic=!1,typeof s=="number"&&(this.innerRadius=s),typeof r=="number"&&(this.outerRadius=r),typeof n=="number"&&(this.sides=n),this._update(),typeof t=="number"&&(this.translation.x=t),typeof e=="number"&&(this.translation.y=e)}static fromObject(t){let e=new Kt().copy(t);return"id"in t&&(e.id=t.id),e}copy(t){super.copy.call(this,t);for(let e=0;e<Kt.Properties.length;e++){let s=Kt.Properties[e];s in t&&typeof t[s]=="number"&&(this[s]=t[s])}return this}_update(){if(this._flagVertices||this._flagInnerRadius||this._flagOuterRadius||this._flagSides){let t=this._sides*2,e=t+1,s=this.vertices.length;s>t&&(this.vertices.splice(t-1,s-t),s=t);for(let r=0;r<e;r++){let n=(r+.5)/t,o=J*n,a=(r%2?this._outerRadius:this._innerRadius)/2,h=a*Ss(o),l=a*Fs(o);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 Kt(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 o=0;o<P.Properties.length;o++){let a=P.Properties[o];n[a]=this[a]}return t&&t.add(n),n}toObject(){let t=super.toObject.call(this);t.renderer.type="star";for(let e=0;e<Kt.Properties.length;e++){let s=Kt.Properties[e];t[s]=this[s]}return t}},$t=Kt;w($t,"Properties",["innerRadius","outerRadius","sides"]);var Ii={innerRadius:{enumerable:!0,get:function(){return this._innerRadius},set:function(i){this._innerRadius=i,this._flagInnerRadius=!0}},outerRadius:{enumerable:!0,get:function(){return this._outerRadius},set:function(i){this._outerRadius=i,this._flagOuterRadius=!0}},sides:{enumerable:!0,get:function(){return this._sides},set:function(i){this._sides=i,this._flagSides=!0}}};var oi,Bi=Math.min,Ni=Math.max;Y.document&&(oi=document.createElement("canvas"));var bt=class extends ut{_flagValue=!0;_flagFamily=!0;_flagSize=!0;_flagLeading=!0;_flagAlignment=!0;_flagBaseline=!0;_flagStyle=!0;_flagWeight=!0;_flagDecoration=!0;_flagFill=!0;_flagStroke=!0;_flagLinewidth=!0;_flagOpacity=!0;_flagVisible=!0;_flagMask=!1;_flagClip=!1;_flagDirection=!0;_value="";_family="sans-serif";_size=13;_leading=17;_alignment="center";_baseline="middle";_style="normal";_weight=500;_decoration="none";_direction="ltr";_fill="#000";_stroke="none";_linewidth=1;_opacity=1;_visible=!0;_mask=null;_clip=!1;_dashes=null;constructor(t,e,s,r){super();for(let n in Vi)Object.defineProperty(this,n,Vi[n]);if(this._renderer.type="text",this._renderer.flagFill=Es.bind(this),this._renderer.flagStroke=Ts.bind(this),this.value=t,typeof e=="number"&&(this.translation.x=e),typeof s=="number"&&(this.translation.y=s),this.dashes=[],this.dashes.offset=0,!F.isObject(r))return this;for(let n=0;n<bt.Properties.length;n++){let o=bt.Properties[n];o in r&&(this[o]=r[o])}}static Measure(t){if(oi){let e=oi.getContext("2d");e.font=[t._style,t._weight,`${t._size}px/${t._leading}px`,t._family].join(" ");let s=e.measureText(t.value,0,0),r=s.actualBoundingBoxDescent+s.actualBoundingBoxAscent;return{width:s.width,height:r}}else{let e=this.value.length*this.size*bt.Ratio,s=this.leading;return console.warn("Two.Text: unable to accurately measure text, so using an approximation."),{width:e,height:s}}}static fromObject(t){let e=typeof t.fill=="string"?t.fill:Ft(t.fill),s=typeof t.stroke=="string"?t.stroke:Ft(t.stroke),r=new bt().copy({...t,fill:e,stroke:s});return"id"in t&&(r.id=t.id),r}copy(t){super.copy.call(this,t);for(let e=0;e<bt.Properties.length;e++){let s=bt.Properties[e];s in t&&(this[s]=t[s])}return this}clone(t){let e=new bt(this.value);e.translation.copy(this.translation),e.rotation=this.rotation,e.scale=this.scale;for(let s=0;s<bt.Properties.length;s++){let r=bt.Properties[s];e[r]=this[r]}return this.matrix.manual&&e.matrix.copy(this.matrix),t&&t.add(e),e._update()}toObject(){let t=super.toObject.call(this);t.renderer.type="text";for(let e=0;e<bt.Properties.length;e++){let s=bt.Properties[e];t[s]=this[s]}return t}noFill(){return this.fill="none",this}noStroke(){return this.stroke="none",this.linewidth=0,this}getBoundingClientRect(t){let e,s,r,n,o;this._update(!0),e=t?this.matrix:this.worldMatrix;let{width:a,height:h}=bt.Measure(this),l=(this._linewidth||0)/2;switch(this.alignment){case"left":s=-l,r=a+l;break;case"right":s=-(a+l),r=l;break;default:s=-(a/2+l),r=a/2+l}switch(this.baseline){case"middle":n=-(h/2+l),o=h/2+l;break;default:n=-(h+l),o=l}let[f,c]=e.multiply(s,n),[d,_]=e.multiply(s,o),[u,y]=e.multiply(r,n),[b,m]=e.multiply(r,o);return n=Bi(c,_,y,m),s=Bi(f,d,u,b),r=Ni(f,d,u,b),o=Ni(c,_,y,m),{top:n,left:s,right:r,bottom:o,width:r-s,height:o-n}}flagReset(){return super.flagReset.call(this),this._flagValue=this._flagFamily=this._flagSize=this._flagLeading=this._flagAlignment=this._flagFill=this._flagStroke=this._flagLinewidth=this._flagOpacity=this._flagVisible=this._flagClip=this._flagDecoration=this._flagClassName=this._flagBaseline=this._flagWeight=this._flagStyle=this._flagDirection=!1,this}},ht=bt;w(ht,"Ratio",.6),w(ht,"Properties",["value","family","size","leading","alignment","linewidth","style","weight","decoration","direction","baseline","opacity","visible","fill","stroke","dashes"]);var Vi={value:{enumerable:!0,get:function(){return this._value},set:function(i){this._value=i,this._flagValue=!0}},family:{enumerable:!0,get:function(){return this._family},set:function(i){this._family=i,this._flagFamily=!0}},size:{enumerable:!0,get:function(){return this._size},set:function(i){this._size=i,this._flagSize=!0}},leading:{enumerable:!0,get:function(){return this._leading},set:function(i){this._leading=i,this._flagLeading=!0}},alignment:{enumerable:!0,get:function(){return this._alignment},set:function(i){this._alignment=i,this._flagAlignment=!0}},linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(i){this._linewidth=i,this._flagLinewidth=!0}},style:{enumerable:!0,get:function(){return this._style},set:function(i){this._style=i,this._flagStyle=!0}},weight:{enumerable:!0,get:function(){return this._weight},set:function(i){this._weight=i,this._flagWeight=!0}},decoration:{enumerable:!0,get:function(){return this._decoration},set:function(i){this._decoration=i,this._flagDecoration=!0}},direction:{enumerable:!0,get:function(){return this._direction},set:function(i){this._direction=i,this._flagDirection=!0}},baseline:{enumerable:!0,get:function(){return this._baseline},set:function(i){this._baseline=i,this._flagBaseline=!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}},fill:{enumerable:!0,get:function(){return this._fill},set:function(i){(this._fill instanceof G||this._fill instanceof W||this._fill instanceof X||this._fill instanceof V)&&this._fill.unbind(g.Types.change,this._renderer.flagFill),this._fill=i,this._flagFill=!0,(this._fill instanceof G||this._fill instanceof W||this._fill instanceof X||this._fill instanceof V)&&this._fill.bind(g.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(i){(this._stroke instanceof G||this._stroke instanceof W||this._stroke instanceof X||this._stroke instanceof V)&&this._stroke.unbind(g.Types.change,this._renderer.flagStroke),this._stroke=i,this._flagStroke=!0,(this._stroke instanceof G||this._stroke instanceof W||this._stroke instanceof X||this._stroke instanceof V)&&this._stroke.bind(g.Types.change,this._renderer.flagStroke)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(i){this._mask=i,this._flagMask=!0,F.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 Es(){this._flagFill=!0}function Ts(){this._flagStroke=!0}var Me=Math.min,Oe=Math.max,Qt=class extends ut{_flagAdditions=!1;_flagSubtractions=!1;_flagOrder=!1;_flagOpacity=!0;_flagBeginning=!1;_flagEnding=!1;_flagLength=!1;_flagMask=!1;_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;_length=0;_mask=null;constructor(t){super();for(let e in zi)Object.defineProperty(this,e,zi[e]);this._renderer.type="group",this.additions=[],this.subtractions=[],this.children=Array.isArray(t)?t:Array.prototype.slice.call(arguments)}static InsertChildren(t){for(let e=0;e<t.length;e++)ji.call(this,t[e],this)}static RemoveChildren(t){for(let e=0;e<t.length;e++)ji.call(this,t[e])}static OrderChildren(t){this._flagOrder=!0}static fromObject(t){let e=new Qt;for(let r=0;r<Qt.Properties.length;r++){let n=Qt.Properties[r];n in t&&(/(fill|stroke)/i.test(n)?e[n]=typeof t[n]=="string"?t[n]:Ft(t[n]):e[n]=t[n])}return"mask"in t&&(e.mask=s(t.mask)),"id"in t&&(e.id=t.id),e.children=t.children.map(s),e;function s(r){if(r&&r.renderer)switch(r.renderer.type){case"arc-segment":return Dt.fromObject(r);case"circle":return Mt.fromObject(r);case"ellipse":return Ot.fromObject(r);case"points":return Ht.fromObject(r);case"polygon":return Gt.fromObject(r);case"rectangle":return gt.fromObject(r);case"rounded-rectangle":return Pt.fromObject(r);case"star":return $t.fromObject(r);case"path":return P.fromObject(r);case"text":return ht.fromObject(r);case"group":return Qt.fromObject(r);case"shape":return ut.fromObject(r);case"element":return pt.fromObject(r)}return r}}copy(t){return super.copy.call(this,t),console.warn("Two.Group.copy is not supported yet."),this}clone(t){let e=new Qt,s=this.children.map(function(r){return r.clone()});return e.add(s),e.opacity=this.opacity,this.mask&&(e.mask=this.mask),e.translation.copy(this.translation),e.rotation=this.rotation,e.scale=this.scale,e.className=this.className,this.matrix.manual&&e.matrix.copy(this.matrix),t&&t.add(e),e._update()}toObject(){let t=super.toObject.call(this);return t.renderer.type="group",t.children=[],t.opacity=this.opacity,t.className=this.className,t.mask=this.mask?this.mask.toObject():null,F.each(this.children,(e,s)=>{t.children[s]=e.toObject()},this),t}corner(){let t=this.getBoundingClientRect(!0);for(let e=0;e<this.children.length;e++){let s=this.children[e];s.translation.x-=t.left,s.translation.y-=t.top}return this.mask&&(this.mask.translation.x-=t.left,this.mask.translation.y-=t.top),this}center(){let t=this.getBoundingClientRect(!0),e=t.left+t.width/2-this.translation.x,s=t.top+t.height/2-this.translation.y;for(let r=0;r<this.children.length;r++){let n=this.children[r];n.isShape&&(n.translation.x-=e,n.translation.y-=s)}return this.mask&&(this.mask.translation.x-=e,this.mask.translation.y-=s),this}getById(t){let e=null;function s(r){if(r.id===t)return r;if(r.children){for(let n=0;n<r.children.length;n++)if(e=s(r.children[n]),e)return e}return null}return s(this)}getByClassName(t){let e=[];function s(r){if(Array.prototype.indexOf.call(r.classList,t)>=0&&e.push(r),r.children)for(let n=0;n<r.children.length;n++){let o=r.children[n];s(o)}return e}return s(this)}getByType(t){let e=[];function s(r){if(r instanceof t&&e.push(r),r.children)for(let n=0;n<r.children.length;n++){let o=r.children[n];s(o)}return e}return s(this)}add(t){t instanceof Array?t=t.slice():t=Array.prototype.slice.call(arguments);for(let e=0;e<t.length;e++){let s=t[e];if(!(s&&s.id))continue;let r=Array.prototype.indexOf.call(this.children,s);r>=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<t.length;r++){let n=t[r];if(!n||!this.children.ids[n.id])continue;let o=this.children.indexOf(n);o>=0&&this.children.splice(o,1)}return this}getBoundingClientRect(t){let e,s,r,n,o,a;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;_<this.children.length;_++){let u=this.children[_];if(!(!u.visible||d.test(u._renderer.type))&&(e=u.getBoundingClientRect(t),r=typeof e.top!="number"||F.isNaN(e.top)||!isFinite(e.top),n=typeof e.left!="number"||F.isNaN(e.left)||!isFinite(e.left),o=typeof e.right!="number"||F.isNaN(e.right)||!isFinite(e.right),a=typeof e.bottom!="number"||F.isNaN(e.bottom)||!isFinite(e.bottom),!(r||n||o||a)))if(t){let[y,b]=s.multiply(e.left,e.top),[m,p]=s.multiply(e.right,e.top),[R,A]=s.multiply(e.left,e.bottom),[k,S]=s.multiply(e.right,e.bottom);f=Me(b,p,A,S,f),h=Me(y,m,R,k,h),l=Oe(y,m,R,k,l),c=Oe(b,p,A,S,c)}else f=Me(e.top,f),h=Me(e.left,h),l=Oe(e.right,l),c=Oe(e.bottom,c)}return{top:f,left:h,right:l,bottom:c,width:l-h,height:c-f}}noFill(){return this.children.forEach(function(t){t.noFill()}),this}noStroke(){return this.children.forEach(function(t){t.noStroke()}),this}subdivide(){let t=arguments;return this.children.forEach(function(e){e.subdivide.apply(e,t)}),this}_update(){let t,e,s;if(this._flagBeginning||this._flagEnding){let r=Math.min(this._beginning,this._ending),n=Math.max(this._beginning,this._ending),o=this.length,a=0,h=r*o,l=n*o;for(t=0;t<this.children.length;t++)s=this.children[t],e=s.length,h>a+e?(s.beginning=1,s.ending=1):l<a?(s.beginning=0,s.ending=0):h>a&&h<a+e?(s.beginning=(h-a)/e,s.ending=1):l>a&&l<a+e?(s.beginning=0,s.ending=(l-a)/e):(s.beginning=0,s.ending=1),a+=e}return super._update.apply(this,arguments)}flagReset(){return this._flagAdditions&&(this.additions.length=0,this._flagAdditions=!1),this._flagSubtractions&&(this.subtractions.length=0,this._flagSubtractions=!1),this._flagOrder=this._flagMask=this._flagOpacity=this._flagBeginning=this._flagEnding=!1,super.flagReset.call(this),this}},K=Qt;w(K,"Children",be),w(K,"Properties",["fill","stroke","linewidth","cap","join","miter","closed","curved","automatic"]);var zi={visible:{enumerable:!0,get:function(){return this._visible},set:function(i){this._flagVisible=this._visible!==i||this._flagVisible,this._visible=i}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(i){this._flagOpacity=this._opacity!==i||this._flagOpacity,this._opacity=i}},beginning:{enumerable:!0,get:function(){return this._beginning},set:function(i){this._flagBeginning=this._beginning!==i||this._flagBeginning,this._beginning=i}},ending:{enumerable:!0,get:function(){return this._ending},set:function(i){this._flagEnding=this._ending!==i||this._flagEnding,this._ending=i}},length:{enumerable:!0,get:function(){if(this._flagLength||this._length<=0){if(this._length=0,!this.children)return this._length;for(let i=0;i<this.children.length;i++){let t=this.children[i];this._length+=t.length}}return this._length}},fill:{enumerable:!0,get:function(){return this._fill},set:function(i){this._fill=i;for(let t=0;t<this.children.length;t++){let e=this.children[t];e.fill=i}}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(i){this._stroke=i;for(let t=0;t<this.children.length;t++){let e=this.children[t];e.stroke=i}}},linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(i){this._linewidth=i;for(let t=0;t<this.children.length;t++){let e=this.children[t];e.linewidth=i}}},join:{enumerable:!0,get:function(){return this._join},set:function(i){this._join=i;for(let t=0;t<this.children.length;t++){let e=this.children[t];e.join=i}}},miter:{enumerable:!0,get:function(){return this._miter},set:function(i){this._miter=i;for(let t=0;t<this.children.length;t++){let e=this.children[t];e.miter=i}}},cap:{enumerable:!0,get:function(){return this._cap},set:function(i){this._cap=i;for(let t=0;t<this.children.length;t++){let e=this.children[t];e.cap=i}}},closed:{enumerable:!0,get:function(){return this._closed},set:function(i){this._closed=i;for(let t=0;t<this.children.length;t++){let e=this.children[t];e.closed=i}}},curved:{enumerable:!0,get:function(){return this._curved},set:function(i){this._curved=i;for(let t=0;t<this.children.length;t++){let e=this.children[t];e.curved=i}}},automatic:{enumerable:!0,get:function(){return this._automatic},set:function(i){this._automatic=i;for(let t=0;t<this.children.length;t++){let e=this.children[t];e.automatic=i}}},children:{enumerable:!0,get:function(){return this._children},set:function(i){let t=K.InsertChildren.bind(this),e=K.RemoveChildren.bind(this),s=K.OrderChildren.bind(this);this._children&&(this._children.unbind(),this._children.length>0&&e(this._children)),this._children=new be(i),this._children.bind(g.Types.insert,t),this._children.bind(g.Types.remove,e),this._children.bind(g.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,F.isObject(i)&&!i.clip&&(i.clip=!0)}}};function ji(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 te=class extends P{constructor(t,e,s,r){let n=[new T(t,e),new T(s,r)];super(n);for(let o in Ui)Object.defineProperty(this,o,Ui[o]);this.vertices[0].command=v.move,this.vertices[1].command=v.line,this.automatic=!1}},Ui={left:{enumerable:!0,get:function(){return this.vertices[0]},set:function(i){if(F.isObject(i))this.vertices.splice(0,1,i);else{let t=new tt("Two.Line.x argument is not an object.");console.warn(t.name,t.message)}}},right:{enumerable:!0,get:function(){return this.vertices[1]},set:function(i){if(F.isObject(i))this.vertices.splice(1,1,i);else{let t=new tt("Two.Line.y argument is not an object.");console.warn(t.name,t.message)}}}};var Ct={path:/[+-]?(?:\d*\.\d+|\d+)(?:[eE][+-]\d+)?/g,cssBackgroundImage:/url\(['"]?#([\w\d-_]*)['"]?\)/i,unitSuffix:/[a-zA-Z%]*/i},Ms={start:"left",middle:"center",end:"right"},Di=["id","class","transform","xmlns","viewBox"],Os=["x","y","width","height","href","xlink:href"];function Ps(i){return Ms[i]}function Cs(i){let t=i.getAttribute("dominant-baseline"),e=i.getAttribute("alignment-baseline");return t||e}function xe(i){return i.replace(/svg:/gi,"").toLowerCase()}function Wi(i,t){if(t.x+=i.translateX,t.y+=i.translateY,t.x*=i.scaleX,t.y*=i.scaleY,i.rotation!==0){let e=t.length();t.x=e*Math.cos(i.rotation),t.y=e*Math.sin(i.rotation)}}function Ls(i,t){t||(t={});let e=i.split(";");for(let s=0;s<e.length;s++){let r=e[s].split(":"),n=r[0],o=r[1];if(typeof n>"u"||typeof o>"u")continue;let a=n.replace(/\s/g,""),h=o.replace(/\s/g,"");t[a]=h}return t}function Is(i){let t={},e=Bs(i),s=Math.max(e.length,i.style.length);for(let r=0;r<s;r++){let n=i.style[r],o=e[r];n&&(t[n]=i.style[n]),o&&(t[o]=i.getAttribute(o))}return t}function Bs(i){let t=i.getAttributeNames();for(let e=0;e<Di.length;e++){let s=Di[e],r=Array.prototype.indexOf.call(t,s);r>=0&&t.splice(r,1)}return t}function Ns(i,t){let e=t.split(/[\s,]/),s=-parseFloat(e[0]),r=-parseFloat(e[1]),n=parseFloat(e[2]),o=parseFloat(e[3]);if(s&&r)for(let c=0;c<i.children.length;c++){let d=i.children[c];"translation"in d?d.translation.add(s,r):"x"in d?d.x=s:"y"in d&&(d.y=r)}let a=typeof i.x=="number",h=typeof i.y=="number",l=typeof i.width=="number",f=typeof i.height=="number";return a&&(i.translation.x+=i.x),h&&(i.translation.y+=i.y),(l||f)&&(i.scale=new x(1,1)),l&&(i.scale.x=i.width/n),f&&(i.scale.y=i.height/o),i.mask=new gt(0,0,n,o),i.mask.origin.set(-n/2,-o/2),i}function St(i,t,e){let s={},r={},n={},o,a,h,l,f,c,d,_,u,y,b,m,p,R,A,k,S;if(i===null)return s;if(Y.getComputedStyle){let M=Y.getComputedStyle(i);for(o=M.length;o--;)h=M[o],l=M[h],typeof l<"u"&&(s[h]=l)}for(o=0;o<i.attributes.length;o++)c=i.attributes[o],/style/i.test(c.nodeName)?Ls(c.value,n):r[c.nodeName]=c.value;typeof s.opacity<"u"&&(s["stroke-opacity"]=s.opacity,s["fill-opacity"]=s.opacity,delete s.opacity),e&&F.defaults(s,e),F.extend(s,n,r),s.visible=!(typeof s.display>"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)||(a=i.gradientTransform&&i.gradientTransform.baseVal&&i.gradientTransform.baseVal.length>0?i.gradientTransform.baseVal[0].matrix:i.getCTM?i.getCTM():null,a===null))break;switch(d=Et(a),t._renderer.type){case"linear-gradient":Wi(d,t.left),Wi(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)||(a=i.transform&&i.transform.baseVal&&i.transform.baseVal.length>0?i.transform.baseVal[0].matrix:i.getCTM?i.getCTM():null,a===null))break;Q.AutoCalculateImportedMatrices?(d=Et(a),t.translation.set(d.translateX,d.translateY),t.rotation=Math.PI*(d.rotation/180),t.scale=new x(d.scaleX,d.scaleY),_=parseFloat((s.x+"").replace("px")),u=parseFloat((s.y+"").replace("px")),_&&(t.translation.x=_),u&&(t.translation.y=u)):(a=i.getCTM(),t._matrix.manual=!0,t._matrix.set(a.a,a.b,a.c,a.d,a.e,a.f));break;case"visible":if(t instanceof K){t._visible=l;break}t.visible=l;break;case"stroke-linecap":if(t instanceof K){t._cap=l;break}t.cap=l;break;case"stroke-linejoin":if(t instanceof K){t._join=l;break}t.join=l;break;case"stroke-miterlimit":if(t instanceof K){t._miter=l;break}t.miter=l;break;case"stroke-width":if(t instanceof K){t._linewidth=parseFloat(l);break}t.linewidth=parseFloat(l);break;case"opacity":case"stroke-opacity":case"fill-opacity":if(t instanceof K){t._opacity=parseFloat(l);break}t.opacity=parseFloat(l);break;case"clip-path":if(Ct.cssBackgroundImage.test(l)&&(y=l.replace(Ct.cssBackgroundImage,"$1"),$.defs.current&&$.defs.current.contains(y)&&(m=$.defs.current.get(y),m&&m.childNodes.length>0)))switch(m=m.childNodes[0],p=xe(m.nodeName),t.mask=$[p].call(this,m,{}),t._renderer.type){case"text":case"path":t.position.add(t.mask.position),t.mask.position.clear();break}break;case"fill":case"stroke":f=(t instanceof K?"_":"")+h,Ct.cssBackgroundImage.test(l)?(y=l.replace(Ct.cssBackgroundImage,"$1"),$.defs.current&&$.defs.current.contains(y)?(m=$.defs.current.get(y),m.object||(p=xe(m.nodeName),m.object=$[p].call(this,m,{})),m=m.object):(b=zs(this),m=b.getById(y)),t[f]=m):t[f]=l;break;case"id":t.id=l;break;case"class":case"className":t.classList=l.split(" "),t._flagClassName=!0;break;case"x":case"y":if(R=t instanceof G,A=t instanceof W,k=t instanceof X,R||A||k)break;l.match("[a-z%]$")&&!l.endsWith("px")&&(S=new tt("only pixel values are supported with the "+h+" attribute."),console.warn(S.name,S.message)),t.translation[h]=parseFloat(l);break;case"font-family":t instanceof ht&&(t.family=l);break;case"font-size":t instanceof ht&&(l.match("[a-z%]$")&&!l.endsWith("px")&&(S=new tt("only pixel values are supported with the "+h+" attribute."),console.warn(S.name,S.message)),t.size=parseFloat(l));break;case"font-weight":t instanceof ht&&(t.weight=l);break;case"font-style":t instanceof ht&&(t.style=l);break;case"text-decoration":t instanceof ht&&(t.decoration=l);break;case"line-height":t instanceof ht&&(t.leading=l);break}return Object.keys(i.dataset).length&&(t.dataset=i.dataset),s}function Vs(i,t){for(let e=0,s=i.childNodes.length;e<s;e++){let r=i.childNodes[e];!r.id||xe(i.nodeName)==="#text"||t.add(r.id,r)}}function zs(i){for(;i.parent;)i=i.parent;return i.scene}var $={svg:function(i){let t=$.defs.current=new Tt,e=i.getElementsByTagName("defs");for(let u=0;u<e.length;u++)Vs(e[u],t);let s=$.g.call(this,i),r=i.getAttribute("viewBox"),n=i.getAttribute("x"),o=i.getAttribute("y"),a=i.getAttribute("width"),h=i.getAttribute("height");s.defs=t;let l=r!==null,f=n!==null,c=o!==null,d=a!==null,_=h!==null;return f&&(s.x=parseFloat(n.replace(Ct.unitSuffix,""))),c&&(s.y=parseFloat(o.replace(Ct.unitSuffix,""))),d&&(s.width=parseFloat(a.replace(Ct.unitSuffix,""))),_&&(s.height=parseFloat(h.replace(Ct.unitSuffix,""))),l&&Ns(s,r),delete $.defs.current,s},defs:function(i){return null},use:function(i,t){let e,s=i.getAttribute("href")||i.getAttribute("xlink:href");if(!s)return e=new tt("encountered <use /> with no href."),console.warn(e.name,e.message),null;let r=s.slice(1);if(!$.defs.current.contains(r))return e=new tt("unable to find element for reference "+s+"."),console.warn(e.name,e.message),null;let o=$.defs.current.get(r).cloneNode(!0);for(let h=0;h<i.attributes.length;h++){let l=i.attributes[h],f=Os.includes(l.nodeName),c=!o.hasAttribute(l.nodeName);(f||c)&&o.setAttribute(l.nodeName,l.value)}let a=xe(o.nodeName);return $[a].call(this,o,t)},g:function(i,t){let e=new K;St.call(this,i,e,t),this.add(e);let s=Is.call(this,i);for(let r=0,n=i.childNodes.length;r<n;r++){let o=i.childNodes[r],a=o.nodeName;if(!a)return;let h=xe(a);if(h in $){let l=$[h].call(e,o,s);!!l&&!l.parent&&e.add(l)}}return e},polygon:function(i,t){let e;typeof i=="string"?e=i:e=i.getAttribute("points");let s=[];e.replace(/(-?[\d.eE-]+)[,|\s](-?[\d.eE-]+)/g,function(n,o,a){s.push(new T(parseFloat(o),parseFloat(a)))});let r=new P(s,!0);return r.stroke="none",r.fill="black",St.call(this,i,r,t),r},polyline:function(i,t){let e=$.polygon.call(this,i,t);return e.closed=!1,e},path:function(i,t){let e;typeof i=="string"?(e=i,i=null):e=i.getAttribute("d");let s=[],r=!1,n=!1;if(e){let a=new T,h,l,f=e.match(/[a-df-z][^a-df-z]*/gi),c=f.length-1;F.each(f.slice(0),function(d,_){let u=d.slice(1).trim().match(Ct.path),y=d[0],b=y.toLowerCase(),m,p,R,A,k,S=[];switch(_===0&&(f=[]),b){case"h":case"v":u.length>1&&(m=1);break;case"m":case"l":case"t":u.length>2&&(m=2);break;case"s":case"q":u.length>4&&(m=4);break;case"c":u.length>6&&(m=6);break;case"a":u.length>7&&(m=7);break}if(m){for(p=0,R=u.length,k=0;p<R;p+=m){if(A=y,k>0)switch(y){case"m":A="l";break;case"M":A="L";break}S.push(A+u.slice(p,p+m).join(" ")),k++}f=Array.prototype.concat.apply(f,S)}else f.push(d)}),F.each(f,function(d,_){let u,y,b,m=d[0],p=m.toLowerCase();l=d.slice(1).trim().match(Ct.path),n=m===p;let R,A,k,S,M,B,C,O,j,N,q,z,it,dt,et,xt,ot;switch(p){case"z":if(_>=c)r=!0;else{y=a.x,b=a.y,u=new T(y,b,void 0,void 0,void 0,void 0,v.close);for(let Lt=s.length-1;Lt>=0;Lt--){let Nt=s[Lt];if(/m/i.test(Nt.command)){a=Nt;break}}}break;case"m":case"l":h=void 0,y=parseFloat(l[0]),b=parseFloat(l[1]),u=new T(y,b,void 0,void 0,void 0,void 0,/m/i.test(p)?v.move:v.line),n&&u.addSelf(a),a=u;break;case"h":case"v":N=/h/i.test(p)?"x":"y",q=/x/i.test(N)?"y":"x",u=new T(void 0,void 0,void 0,void 0,void 0,void 0,v.line),u[N]=parseFloat(l[0]),u[q]=a[q],n&&(u[N]+=a[N]),a=u;break;case"c":case"s":R=a.x,A=a.y,h||(h=new x),/c/i.test(p)?(k=parseFloat(l[0]),S=parseFloat(l[1]),M=parseFloat(l[2]),B=parseFloat(l[3]),C=parseFloat(l[4]),O=parseFloat(l[5])):(j=Ae(a,h,n),k=j.x,S=j.y,M=parseFloat(l[0]),B=parseFloat(l[1]),C=parseFloat(l[2]),O=parseFloat(l[3])),n&&(k+=R,S+=A,M+=R,B+=A,C+=R,O+=A),a.controls.right.set(k-a.x,S-a.y),u=new T(C,O,M-C,B-O,void 0,void 0,v.curve),a=u,h=u.controls.left;break;case"t":case"q":R=a.x,A=a.y,h||(h=new x),/q/i.test(p)?(k=parseFloat(l[0]),S=parseFloat(l[1]),M=parseFloat(l[0]),B=parseFloat(l[1]),C=parseFloat(l[2]),O=parseFloat(l[3])):(j=Ae(a,h,n),k=j.x,S=j.y,M=j.x,B=j.y,C=parseFloat(l[0]),O=parseFloat(l[1])),n&&(k+=R,S+=A,M+=R,B+=A,C+=R,O+=A),a.controls.right.set((k-a.x)*.33,(S-a.y)*.33),u=new T(C,O,M-C,B-O,void 0,void 0,v.curve),a=u,h=u.controls.left;break;case"a":R=a.x,A=a.y,it=parseFloat(l[0]),dt=parseFloat(l[1]),et=parseFloat(l[2]),xt=parseFloat(l[3]),ot=parseFloat(l[4]),C=parseFloat(l[5]),O=parseFloat(l[6]),n&&(C+=R,O+=A),z=new T(C,O),z.command=v.arc,z.rx=it,z.ry=dt,z.xAxisRotation=et,z.largeArcFlag=xt,z.sweepFlag=ot,u=z,a=z,h=void 0;break}u&&(Array.isArray(u)?s=s.concat(u):s.push(u))})}e=new P(s,r,void 0,!0),e.stroke="none",e.fill="black";let o=e.getBoundingClientRect(!0);return o.centroid={x:o.left+o.width/2,y:o.top+o.height/2},F.each(e.vertices,function(a){a.subSelf(o.centroid)}),St.call(this,i,e,t),e.translation.addSelf(o.centroid),e},circle:function(i,t){let e=parseFloat(i.getAttribute("cx")),s=parseFloat(i.getAttribute("cy")),r=parseFloat(i.getAttribute("r")),n=new Mt(0,0,r);return n.stroke="none",n.fill="black",St.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")),o=new Ot(0,0,r,n);return o.stroke="none",o.fill="black",St.call(this,i,o,t),o.translation.x=e,o.translation.y=s,o},rect:function(i,t){let e=parseFloat(i.getAttribute("rx")),s=parseFloat(i.getAttribute("ry"));if(!F.isNaN(e)||!F.isNaN(s))return $["rounded-rect"](i);let r=parseFloat(i.getAttribute("width")),n=parseFloat(i.getAttribute("height")),o=r/2,a=n/2,h=new gt(0,0,r,n);return h.stroke="none",h.fill="black",St.call(this,i,h,t),h.translation.x+=o,h.translation.y+=a,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")),o=r/2,a=n/2,h=new x(e,s),l=new Pt(0,0,r,n,h);return l.stroke="none",l.fill="black",St.call(this,i,l,t),l.translation.x+=o,l.translation.y+=a,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")),o=new te(e,s,r,n).noFill();return St.call(this,i,o,t),o},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),o=parseFloat(i.getAttribute("x2")||0),a=parseFloat(i.getAttribute("y2")||0),h=(o+r)/2,l=(a+n)/2;/userSpaceOnUse/i.test(e)&&(r-=h,n-=l,o-=h,a-=l);let f=[];for(let d=0;d<i.children.length;d++){let _=i.children[d],u=_.getAttribute("offset");/%/gi.test(u)&&(u=parseFloat(u.replace(/%/gi,""))/100),u=parseFloat(u);let y=_.getAttribute("stop-color"),b=_.getAttribute("stop-opacity"),m=_.getAttribute("style"),p;y===null&&(p=m?m.match(/stop-color:\s?([#a-fA-F0-9]*)/):!1,y=p&&p.length>1?p[1]:void 0),b===null?(p=m?m.match(/stop-opacity:\s?([0-9.-]*)/):!1,b=p&&p.length>1?parseFloat(p[1]):1):b=parseFloat(b),f.push(new lt(u,y,b))}let c=new W(r,n,o,a,f);return c.spread=s,c.units=e,St.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,o=parseFloat(i.getAttribute("r")),a=parseFloat(i.getAttribute("fx")),h=parseFloat(i.getAttribute("fy"));F.isNaN(a)&&(a=r),F.isNaN(h)&&(h=n);let l=Math.abs(r+a)/2,f=Math.abs(n+h)/2;/userSpaceOnUse/i.test(e)&&(r-=l,n-=f,a-=l,h-=f);let c=[];for(let _=0;_<i.children.length;_++){let u=i.children[_],y=u.getAttribute("offset");/%/gi.test(y)&&(y=parseFloat(y.replace(/%/gi,""))/100),y=parseFloat(y);let b=u.getAttribute("stop-color"),m=u.getAttribute("stop-opacity"),p=u.getAttribute("style"),R;b===null&&(R=p?p.match(/stop-color:\s?([#a-fA-F0-9]*)/):!1,b=R&&R.length>1?R[1]:void 0),m===null?(R=p?p.match(/stop-opacity:\s?([0-9.-]*)/):!1,m=R&&R.length>1?parseFloat(R[1]):1):m=parseFloat(m),c.push(new lt(y,b,m))}let d=new X(r,n,o,c,a,h);return d.spread=s,d.units=e,St.call(this,i,d,t),d},text:function(i,t){let e=Ps(i.getAttribute("text-anchor"))||"left",s=Cs(i)||"baseline",r="";i.childNodes.length>0&&i.childNodes[0].tagName==="TSPAN"?r=i.childNodes[0].textContent:r=i.textContent;let n=new ht(r);return St.call(this,i,n,t),n.alignment=e,n.baseline=s,n},clippath:function(i,t){return $.defs.current&&!$.defs.current.contains(i.id)&&$.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 tt("encountered <image /> with no href."),console.warn(e.name,e.message),null;let r=parseFloat(i.getAttribute("x"))||0,n=parseFloat(i.getAttribute("y"))||0,o=parseFloat(i.getAttribute("width")),a=parseFloat(i.getAttribute("height")),h=new jt(s,r,n);return F.isNaN(o)||(h.width=o),F.isNaN(a)||(h.height=a),St.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 ee=class extends gt{_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 Xi)Object.defineProperty(this,n,Xi[n]);this._renderer.flagTextures=js.bind(this),this._renderer.bindTextures=Us.bind(this),this._renderer.unbindTextures=Ds.bind(this),this.noStroke(),this.noFill(),Array.isArray(t)?this.textures=t.map(Hi.bind(this)):this.textures=[Hi(t)],this.origin=new x,this._update(),typeof r=="number"?this.frameRate=r:this.frameRate=ee.DefaultFrameRate,this.index=0}static fromObject(t){let e=new ee().copy(t);return"id"in t&&(e.id=t.id),e}copy(t){super.copy.call(this,t);for(let e=0;e<ee.Properties.length;e++){let s=ee.Properties[e];s in t&&(this[s]=t[s])}return this}play(t,e,s){return this._playing=!0,this._firstFrame=0,this._lastFrame=this.amount-1,this._startTime=F.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 ee(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,o,a,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,F.isNaN(this._lastFrame)&&(this._lastFrame=n-1),r=F.performance.now()-this._startTime,l=this._lastFrame+1,o=1e3*(l-this._firstFrame)/this._frameRate,this._loop?r=r%o:r=Math.min(r,o),h=ft(this._firstFrame,l,r/o),h=Math.floor(h),h!==this._index&&(this._index=h,a=t[this._index],a.loaded&&(e=a.image.width,s=a.image.height,this.width!==e&&(this.width=e),this.height!==s&&(this.height=s),this.fill=a,h>=this._lastFrame-1&&this._onLastFrame&&this._onLastFrame()))):(this._flagIndex||!(this.fill instanceof V))&&(a=t[this._index],a.loaded&&(e=a.image.width,s=a.image.height,this.width!==e&&(this.width=e),this.height!==s&&(this.height=s)),this.fill=a)),super._update.call(this),this}flagReset(){return this._flagTextures=this._flagFrameRate=!1,super.flagReset.call(this),this}},ie=ee;w(ie,"Properties",["textures","frameRate","index","firstFrame","lastFrame","loop"]),w(ie,"DefaultFrameRate",30);var Xi={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(g.Types.insert,t).unbind(g.Types.remove,e),this._textures=new ct((i||[]).slice(0)),this._textures.bind(g.Types.insert,t).bind(g.Types.remove,e),t(this._textures)}},firstFrame:{enumerable:!0,get:function(){return this._firstFrame},set:function(i){this._firstFrame=i}},lastFrame:{enumerable:!0,get:function(){return this._lastFrame},set:function(i){this._lastFrame=i}},loop:{enumerable:!0,get:function(){return this._loop},set:function(i){this._loop=!!i}}};function js(){this._flagTextures=!0}function Us(i){let t=i.length;for(;t--;)i[t].bind(g.Types.change,this._renderer.flagTextures);this._renderer.flagTextures()}function Ds(i){let t=i.length;for(;t--;)i[t].unbind(g.Types.change,this._renderer.flagTextures);this._renderer.flagTextures()}function Hi(i){if(i instanceof V)return i;if(typeof i=="string")return new V(i)}var li=[],hi=Math.max,Ws=Math.min,Yi=Math.abs,Pe=Math.sin,Ce=Math.cos,Xs=Math.acos,Ie=Math.sqrt,H={isHidden:/(undefined|none|transparent)/i,alignments:{left:"start",middle:"center",right:"end"},baselines:{top:"top",middle:"middle",bottom:"bottom",baseline:"alphabetic"},getRendererType:function(i){return i in H?i:"path"},group:{renderChild:function(i){let t=H.getRendererType(i._renderer.type);H[t].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=Le(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){let o=H.getRendererType(s._renderer.type);H[o].render.call(s,i,!0)}if(this._opacity>0&&this._scale!==0)for(let o=0;o<this.children.length;o++){let a=this.children[o],h=H.getRendererType(a._renderer.type);H[h].render.call(a,i)}return n&&i.restore(),this.flagReset()}},path:{render:function(i,t,e){let s,r,n,o,a,h,l,f,c,d,_,u,y,b,m,p,R,A,k,S,M,B,C,O,j,N,q,z,it,dt,et,xt,ot,Lt;if(Lt=this.parent&&this.parent._renderer?this.parent._renderer.opacity:1,it=this._mask,dt=this._clip,a=this._opacity*(Lt||1),h=this._visible,!t&&(!h||dt||a===0))return this;if(this._update(),s=this._matrix.elements,r=this._stroke,n=this._linewidth,o=this._fill,l=this._cap,f=this._join,c=this._miter,d=this._closed,_=this._renderer.vertices,u=_.length,y=u-1,et=Le(s),ot=this.dashes,et||(i.save(),i.transform(s[0],s[3],s[1],s[4],s[2],s[5])),it){let D=H.getRendererType(it._renderer.type);H[D].render.call(it,i,!0)}if(o)if(typeof o=="string")i.fillStyle=o;else{let D=H.getRendererType(o._renderer.type);H[D].render.call(o,i,this),i.fillStyle=o._renderer.effect}if(r){if(typeof r=="string")i.strokeStyle=r;else{let D=H.getRendererType(r._renderer.type);H[D].render.call(r,i,this),i.strokeStyle=r._renderer.effect}n&&(i.lineWidth=n),c&&(i.miterLimit=c),f&&(i.lineJoin=f),!d&&l&&(i.lineCap=l)}typeof a=="number"&&(i.globalAlpha=a),ot&&ot.length>0&&(i.lineDashOffset=ot.offset||0,i.setLineDash(ot)),i.beginPath();let Nt,de,_e,pe,ge,me,_t;for(let D=0;D<u;D++)switch(p=_[D],q=p.x,z=p.y,p.command){case v.close:i.closePath();break;case v.arc:Nt=p.rx,de=p.ry,_e=p.xAxisRotation,pe=p.largeArcFlag,ge=p.sweepFlag,b=d?nt(D-1,u):hi(D-1,0),m=_[b],me=m.x,_t=m.y,H.renderSvgArcCommand(i,me,_t,Nt,de,pe,ge,_e,q,z);break;case v.curve:b=d?nt(D-1,u):Math.max(D-1,0),m=_[b],C=m.controls&&m.controls.right||x.zero,O=p.controls&&p.controls.left||x.zero,m._relative?(M=C.x+m.x,B=C.y+m.y):(M=C.x,B=C.y),p._relative?(k=O.x+p.x,S=O.y+p.y):(k=O.x,S=O.y),i.bezierCurveTo(M,B,k,S,q,z),D>=y&&d&&(R=A,j=p.controls&&p.controls.right||x.zero,N=R.controls&&R.controls.left||x.zero,p._relative?(M=j.x+p.x,B=j.y+p.y):(M=j.x,B=j.y),R._relative?(k=N.x+R.x,S=N.y+R.y):(k=N.x,S=N.y),q=R.x,z=R.y,i.bezierCurveTo(M,B,k,S,q,z));break;case v.line:i.lineTo(q,z);break;case v.move:A=p,i.moveTo(q,z);break}return d&&i.closePath(),!dt&&!e&&(H.isHidden.test(o)||(xt=o._renderer&&o._renderer.offset,xt&&(i.save(),i.translate(-o._renderer.offset.x,-o._renderer.offset.y),i.scale(o._renderer.scale.x,o._renderer.scale.y)),i.fill(),xt&&i.restore()),H.isHidden.test(r)||(xt=r._renderer&&r._renderer.offset,xt&&(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(),xt&&i.restore())),et||i.restore(),dt&&!e&&i.clip(),ot&&ot.length>0&&i.setLineDash(li),this.flagReset()}},points:{render:function(i,t,e){let s,r,n,o,a,h,l,f,c,d,_,u,y,b,m,p;if(p=this.parent&&this.parent._renderer?this.parent._renderer.opacity:1,a=this._opacity*(p||1),h=this._visible,!t&&(!h||a===0))return this;if(this._update(),s=this._matrix.elements,r=this._stroke,n=this._linewidth,o=this._fill,f=this._renderer.collection,c=f.length,y=Le(s),m=this.dashes,l=this._size,y||(i.save(),i.transform(s[0],s[3],s[1],s[4],s[2],s[5])),o)if(typeof o=="string")i.fillStyle=o;else{let k=H.getRendererType(o._renderer.type);H[k].render.call(o,i,this),i.fillStyle=o._renderer.effect}if(r){if(typeof r=="string")i.strokeStyle=r;else{let k=H.getRendererType(r._renderer.type);H[k].render.call(r,i,this),i.strokeStyle=r._renderer.effect}n&&(i.lineWidth=n)}typeof a=="number"&&(i.globalAlpha=a),m&&m.length>0&&(i.lineDashOffset=m.offset||0,i.setLineDash(m)),i.beginPath();let R=l*.5,A;this._sizeAttenuation||(A=this.worldMatrix.elements,A=Et(A[0],A[3],A[1],A[4],A[2],A[5]),R/=Math.max(A.scaleX,A.scaleY));for(let k=0;k<c;k++)d=f[k],_=d.x,u=d.y,i.moveTo(_+R,u),i.arc(_,u,R,0,J);return e||(H.isHidden.test(o)||(b=o._renderer&&o._renderer.offset,b&&(i.save(),i.translate(-o._renderer.offset.x,-o._renderer.offset.y),i.scale(o._renderer.scale.x,o._renderer.scale.y)),i.fill(),b&&i.restore()),H.isHidden.test(r)||(b=r._renderer&&r._renderer.offset,b&&(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(),b&&i.restore())),y||i.restore(),m&&m.length>0&&i.setLineDash(li),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,o=this._mask,a=this._clip;if(!t&&(!n||a||r===0))return this;this._update();let h=this._matrix.elements,l=this._stroke,f=this._linewidth,c=this._fill,d=this._decoration,_=this._direction,u=Le(h),y=c._renderer&&c._renderer.offset&&l._renderer&&l._renderer.offset,b=this.dashes,m=H.alignments[this._alignment]||this._alignment,p=H.baselines[this._baseline]||this._baseline,R,A,k,S,M,B,C,O,j,N,q;if(u||(i.save(),i.transform(h[0],h[3],h[1],h[4],h[2],h[5])),o){let z=H.getRendererType(o._renderer.type);H[z].render.call(o,i,!0)}if(y||(i.font=[this._style,this._weight,this._size+"px/"+this._leading+"px",this._family].join(" ")),i.textAlign=m,i.textBaseline=p,i.direction=_,c)if(typeof c=="string")i.fillStyle=c;else{let z=H.getRendererType(c._renderer.type);H[z].render.call(c,i,this),i.fillStyle=c._renderer.effect}if(l){if(typeof l=="string")i.strokeStyle=l;else{let z=H.getRendererType(l._renderer.type);H[z].render.call(l,i,this),i.strokeStyle=l._renderer.effect}f&&(i.lineWidth=f)}if(typeof r=="number"&&(i.globalAlpha=r),b&&b.length>0&&(i.lineDashOffset=b.offset||0,i.setLineDash(b)),!a&&!e&&(H.isHidden.test(c)||(c._renderer&&c._renderer.offset?(B=c._renderer.scale.x,C=c._renderer.scale.y,i.save(),i.translate(-c._renderer.offset.x,-c._renderer.offset.y),i.scale(B,C),R=this._size/c._renderer.scale.y,A=this._leading/c._renderer.scale.y,i.font=[this._style,this._weight,R+"px/",A+"px",this._family].join(" "),k=c._renderer.offset.x/c._renderer.scale.x,S=c._renderer.offset.y/c._renderer.scale.y,i.fillText(this.value,k,S),i.restore()):i.fillText(this.value,0,0)),H.isHidden.test(l)||(l._renderer&&l._renderer.offset?(B=l._renderer.scale.x,C=l._renderer.scale.y,i.save(),i.translate(-l._renderer.offset.x,-l._renderer.offset.y),i.scale(B,C),R=this._size/l._renderer.scale.y,A=this._leading/l._renderer.scale.y,i.font=[this._style,this._weight,R+"px/",A+"px",this._family].join(" "),k=l._renderer.offset.x/l._renderer.scale.x,S=l._renderer.offset.y/l._renderer.scale.y,M=f/l._renderer.scale.x,i.lineWidth=M,i.strokeText(this.value,k,S),i.restore()):i.strokeText(this.value,0,0))),/(underline|strikethrough)/i.test(d)){let z=i.measureText(this.value),it=1;switch(d){case"underline":j=z.actualBoundingBoxDescent,q=z.actualBoundingBoxDescent;break;case"strikethrough":j=0,q=0,it=.5;break}switch(p){case"top":j+=this._size*it,q+=this._size*it;break;case"baseline":case"bottom":j-=this._size*it,q-=this._size*it;break}switch(m){case"left":case"start":O=0,N=z.width;break;case"right":case"end":O=-z.width,N=0;break;default:O=-z.width/2,N=z.width/2}i.lineWidth=Math.max(Math.floor(this._size/15),1),i.strokeStyle=i.fillStyle,i.beginPath(),i.moveTo(O,j),i.lineTo(N,q),i.stroke()}return u||i.restore(),a&&!e&&i.clip(),b&&b.length>0&&i.setLineDash(li),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,o=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,o=(o-.5)*e.height),this._renderer.effect=i.createLinearGradient(s,r,n,o);for(let a=0;a<this.stops.length;a++){let h=this.stops[a];this._renderer.effect.addColorStop(h._offset,h._color)}}return this.flagReset()}}},"radial-gradient":{render:function(i,t){if(!!t){if(this._update(),!this._renderer.effect||this._flagCenter||this._flagFocal||this._flagRadius||this._flagStops||this._flagUnits){let e,s=this.center._x,r=this.center._y,n=this.focal._x,o=this.focal._y,a=this._radius;/objectBoundingBox/i.test(this._units)&&(e=t.getBoundingClientRect(!0),s=(s-.5)*e.width*.5,r=(r-.5)*e.height*.5,n=(n-.5)*e.width*.5,o=(o-.5)*e.height*.5,a*=Math.min(e.width,e.height)),this._renderer.effect=i.createRadialGradient(s,r,0,n,o,a);for(let h=0;h<this.stops.length;h++){let l=this.stops[h];this._renderer.effect.addColorStop(l._offset,l._color)}}return this.flagReset()}}},texture:{render:function(i){this._update();let t=this.image;return(!this._renderer.effect||(this._flagLoaded||this._flagImage||this._flagVideo||this._flagRepeat)&&this.loaded)&&(this._renderer.effect=i.createPattern(this.image,this._repeat)),(this._flagOffset||this._flagLoaded||this._flagScale)&&(this._renderer.offset instanceof x||(this._renderer.offset=new x),this._renderer.offset.x=-this._offset.x,this._renderer.offset.y=-this._offset.y,t&&(this._renderer.offset.x+=t.width/2,this._renderer.offset.y+=t.height/2,this._scale instanceof x?(this._renderer.offset.x*=this._scale.x,this._renderer.offset.y*=this._scale.y):(this._renderer.offset.x*=this._scale,this._renderer.offset.y*=this._scale))),(this._flagScale||this._flagLoaded)&&(this._renderer.scale instanceof x||(this._renderer.scale=new x),this._scale instanceof x?this._renderer.scale.copy(this._scale):this._renderer.scale.set(this._scale,this._scale)),this.flagReset()}},renderSvgArcCommand:function(i,t,e,s,r,n,o,a,h,l){a=a*Math.PI/180,s=Yi(s),r=Yi(r);let f=(t-h)/2,c=(e-l)/2,d=Ce(a)*f+Pe(a)*c,_=-Pe(a)*f+Ce(a)*c,u=d*d,y=_*_,b=s*s,m=r*r,p=u/b+y/m;if(p>1){let z=Ie(p);s=z*s,r=z*r,b=s*s,m=r*r}let R=b*y+m*u,A=(b*m-R)/R,k=Ie(hi(0,A));n===o&&(k=-k);let S=k*s*_/r,M=-k*r*d/s,B=Ce(a)*S-Pe(a)*M+(t+h)/2,C=Pe(a)*S+Ce(a)*M+(e+l)/2,O=Gi(1,0,(d-S)/s,(_-M)/r),j=Gi((d-S)/s,(_-M)/r,(-d-S)/s,(-_-M)/r)%J,N=O+j;Hs(i,B,C,s,r,O,N,o===0,a)}},rt=class extends g{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 K,this.scene.parent=this}setSize(t,e,s){return this.width=t,this.height=e,this.ratio=typeof s>"u"?ne(this.ctx):s,this.domElement.width=t*this.ratio,this.domElement.height=e*this.ratio,this.domElement.style&&F.extend(this.domElement.style,{width:t+"px",height:e+"px"}),this.trigger(g.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),H.group.render.call(this.scene,this.ctx),t||this.ctx.restore(),this}};w(rt,"Utils",H);function Hs(i,t,e,s,r,n,o,a,h){let l=o-n,f=Zt.Tolerance.epsilon,c=Math.abs(l)<f,d=nt(l,J);d<f&&(c?d=0:d=J),a===!0&&!c&&(d===J?d=-J:d=d-J);for(let _=0;_<Q.Resolution;_++){let u=_/(Q.Resolution-1),y=n+u*d,b=t+s*Math.cos(y),m=e+r*Math.sin(y);if(h!==0){let p=Math.cos(h),R=Math.sin(h),A=b-t,k=m-e;b=A*p-k*R+t,m=A*R+k*p+e}i.lineTo(b,m)}}function Gi(i,t,e,s){let r=i*e+t*s,n=Ie(i*i+t*t)*Ie(e*e+s*s),o=Xs(hi(-1,Ws(1,r/n)));return i*s-t*e<0&&(o=-o),o}function Le(i){return i[0]==1&&i[3]==0&&i[1]==0&&i[4]==1&&i[2]==0&&i[5]==0}var E={version:1.1,ns:"http://www.w3.org/2000/svg",xlink:"http://www.w3.org/1999/xlink",alignments:{left:"start",center:"middle",right:"end"},baselines:{top:"hanging",middle:"middle",bottom:"ideographic",baseline:"alphabetic"},createElement:function(i,t){let e=i,s=document.createElementNS(E.ns,e);return e==="svg"&&(t=F.defaults(t||{},{version:E.version})),t&&Object.keys(t).length>0&&E.setAttributes(s,t),s},setAttributes:function(i,t){let e=Object.keys(t);for(let s=0;s<e.length;s++)/href/.test(e[s])?i.setAttributeNS(E.xlink,e[s],t[e[s]]):i.setAttribute(e[s],t[e[s]]);return this},removeAttributes:function(i,t){for(let e in t)i.removeAttribute(e);return this},toString:function(i,t){let e=i.length,s=e-1,r,n="";for(let o=0;o<e;o++){let a=i[o],h=t?nt(o-1,e):Math.max(o-1,0),l=i[h],f,c,d,_,u,y,b,m,p,R,A,k,S,M,B,C=U(a.x),O=U(a.y);switch(a.command){case v.close:f=v.close;break;case v.arc:A=a.rx,k=a.ry,S=a.xAxisRotation,M=a.largeArcFlag,B=a.sweepFlag,f=v.arc+" "+A+" "+k+" "+S+" "+M+" "+B+" "+C+" "+O;break;case v.curve:b=l.controls&&l.controls.right||x.zero,m=a.controls&&a.controls.left||x.zero,l.relative?(d=U(b.x+l.x),_=U(b.y+l.y)):(d=U(b.x),_=U(b.y)),a.relative?(u=U(m.x+a.x),y=U(m.y+a.y)):(u=U(m.x),y=U(m.y)),f=(o===0?v.move:v.curve)+" "+d+" "+_+" "+u+" "+y+" "+C+" "+O;break;case v.move:r=a,f=v.move+" "+C+" "+O;break;default:f=a.command+" "+C+" "+O}o>=s&&t&&(a.command===v.curve&&(c=r,p=a.controls&&a.controls.right||a,R=c.controls&&c.controls.left||c,a.relative?(d=U(p.x+a.x),_=U(p.y+a.y)):(d=U(p.x),_=U(p.y)),c.relative?(u=U(R.x+c.x),y=U(R.y+c.y)):(u=U(R.x),y=U(R.y)),C=U(c.x),O=U(c.y),f+=" C "+d+" "+_+" "+u+" "+y+" "+C+" "+O),a.command!==v.close&&(f+=" Z")),n+=f+" "}return n},pointsToString:function(i,t){let e="",s=t*.5;for(let r=0;r<i.length;r++){let n=i[r].x,o=i[r].y-s;e+=v.move+" "+n+" "+o+" ",e+="a "+s+" "+s+" 0 1 0 0.001 0 Z"}return e},getClip:function(i,t){let e=i._renderer.clip;return e||(e=i._renderer.clip=E.createElement("clipPath",{"clip-rule":"nonzero"})),e.parentNode===null&&t.defs.appendChild(e),e},getRendererType:function(i){return i in E?i:"path"},defs:{update:function(i){let{defs:t}=i;if(t._flagUpdate){let e=Array.prototype.slice.call(t.children,0);for(let s=0;s<e.length;s++){let r=e[s],n=r.id,o=`[fill="url(#${n})"],[stroke="url(#${n})"],[clip-path="url(#${n})"]`;i.querySelector(o)||t.removeChild(r)}t._flagUpdate=!1}}},group:{appendChild:function(i){let t=i._renderer.elem;if(!t)return;let e=t.nodeName;!e||/(radial|linear)gradient/i.test(e)||i._clip||this.elem.appendChild(t)},removeChild:function(i){let t=i._renderer.elem;!t||t.parentNode!=this.elem||!t.nodeName||i._clip||this.elem.removeChild(t)},orderChild:function(i){this.elem.appendChild(i._renderer.elem)},renderChild:function(i){let t=E.getRendererType(i._renderer.type);E[t].render.call(i,this)},render:function(i){if(!this._visible&&!this._flagVisible||this._opacity===0&&!this._flagOpacity)return this;this._update(),this._renderer.elem||(this._renderer.elem=E.createElement("g",{id:this.id}),i.appendChild(this._renderer.elem));let t=this._matrix.manual||this._flagMatrix,e={domElement:i,elem:this._renderer.elem};t&&this._renderer.elem.setAttribute("transform","matrix("+this._matrix.toString()+")");for(let s=0;s<this.children.length;s++){let r=this.children[s],n=E.getRendererType(r._renderer.type);E[n].render.call(r,i)}if(this._flagId&&this._renderer.elem.setAttribute("id",this._id),this._flagOpacity&&this._renderer.elem.setAttribute("opacity",this._opacity),this._flagVisible&&this._renderer.elem.setAttribute("display",this._visible?"inline":"none"),this._flagClassName&&this._renderer.elem.setAttribute("class",this.classList.join(" ")),this._flagAdditions&&this.additions.forEach(E.group.appendChild,e),this._flagSubtractions&&this.subtractions.forEach(E.group.removeChild,e),this._flagOrder&&this.children.forEach(E.group.orderChild,e),this._flagMask)if(this._mask){let s=E.getRendererType(this._mask._renderer.type);E[s].render.call(this._mask,i),this._renderer.elem.setAttribute("clip-path","url(#"+this._mask.id+")")}else this._renderer.elem.removeAttribute("clip-path");return this.dataset&&Object.assign(this._renderer.elem.dataset,this.dataset),this.flagReset()}},path:{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){let s=E.toString(this._renderer.vertices,this._closed);t.d=s}if(this._fill&&this._fill._renderer){this._renderer.hasFillEffect=!0,this._fill._update();let s=E.getRendererType(this._fill._renderer.type);E[s].render.call(this._fill,i,!0)}if(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();let s=E.getRendererType(this._stroke._renderer.type);E[s].render.call(this._stroke,i,!0)}if(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?E.setAttributes(this._renderer.elem,t):(t.id=this._id,this._renderer.elem=E.createElement("path",t),i.appendChild(this._renderer.elem)),this._flagClip){let s=E.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))}if(this._flagMask)if(this._mask){let s=E.getRendererType(this._mask._renderer.type);E[s].render.call(this._mask,i),this._renderer.elem.setAttribute("clip-path","url(#"+this._mask.id+")")}else this._renderer.elem.removeAttribute("clip-path");return 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,o=Et(n[0],n[3],n[1],n[4],n[2],n[5]);s/=Math.max(o.scaleX,o.scaleY)}let r=E.pointsToString(this._renderer.collection,s);t.d=r}if(this._fill&&this._fill._renderer){this._renderer.hasFillEffect=!0,this._fill._update();let s=E.getRendererType(this._fill._renderer.type);E[s].render.call(this._fill,i,!0)}if(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();let s=E.getRendererType(this._stroke._renderer.type);E[s].render.call(this._stroke,i,!0)}return 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?E.setAttributes(this._renderer.elem,t):(t.id=this._id,this._renderer.elem=E.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"]=E.alignments[this._alignment]||this._alignment),this._flagBaseline&&(t["dominant-baseline"]=E.baselines[this._baseline]||this._baseline),this._flagStyle&&(t["font-style"]=this._style),this._flagWeight&&(t["font-weight"]=this._weight),this._flagDecoration&&(t["text-decoration"]=this._decoration),this._flagDirection&&(t.direction=this._direction),this._fill&&this._fill._renderer){this._renderer.hasFillEffect=!0,this._fill._update();let s=E.getRendererType(this._fill._renderer.type);E[s].render.call(this._fill,i,!0)}if(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();let s=E.getRendererType(this._stroke._renderer.type);E[s].render.call(this._stroke,i,!0)}if(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?E.setAttributes(this._renderer.elem,t):(t.id=this._id,this._renderer.elem=E.createElement("text",t),i.appendChild(this._renderer.elem)),this._flagClip){let s=E.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))}if(this._flagMask)if(this._mask){let s=E.getRendererType(this._mask._renderer.type);E[s].render.call(this._mask,i),this._renderer.elem.setAttribute("clip-path","url(#"+this._mask.id+")")}else this._renderer.elem.removeAttribute("clip-path");return 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?E.setAttributes(this._renderer.elem,e):(e.id=this._id,this._renderer.elem=E.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;r<this.stops.length;r++){let n=this.stops[r],o={};n._flagOffset&&(o.offset=100*n._offset+"%"),n._flagColor&&(o["stop-color"]=n._color),n._flagOpacity&&(o["stop-opacity"]=n._opacity),n._renderer.elem?E.setAttributes(n._renderer.elem,o):n._renderer.elem=E.createElement("stop",o),s&&this._renderer.elem.appendChild(n._renderer.elem),n.flagReset()}}return this.flagReset()}},"radial-gradient":{render:function(i,t){t||this._update();let e={};if(this._flagId&&(e.id=this._id),this._flagCenter&&(e.cx=this.center._x,e.cy=this.center._y),this._flagFocal&&(e.fx=this.focal._x,e.fy=this.focal._y),this._flagRadius&&(e.r=this._radius),this._flagSpread&&(e.spreadMethod=this._spread),this._flagUnits&&(e.gradientUnits=this._units),this._renderer.elem?E.setAttributes(this._renderer.elem,e):(e.id=this._id,this._renderer.elem=E.createElement("radialGradient",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;r<this.stops.length;r++){let n=this.stops[r],o={};n._flagOffset&&(o.offset=100*n._offset+"%"),n._flagColor&&(o["stop-color"]=n._color),n._flagOpacity&&(o["stop-opacity"]=n._opacity),n._renderer.elem?E.setAttributes(n._renderer.elem,o):n._renderer.elem=E.createElement("stop",o),s&&this._renderer.elem.appendChild(n._renderer.elem),n.flagReset()}}return this.flagReset()}},texture:{render:function(i,t){t||this._update();let e={},s={x:0,y:0},r=this.image;if(this._flagId&&(e.id=this._id),this._flagLoaded&&this.loaded)switch(r.nodeName.toLowerCase()){case"canvas":s.href=s["xlink:href"]=r.toDataURL("image/png");break;case"img":case"image":s.href=s["xlink:href"]=this.src;break}if((this._flagOffset||this._flagLoaded||this._flagScale)&&(e.x=this._offset.x,e.y=this._offset.y,r&&(e.x-=r.width/2,e.y-=r.height/2,this._scale instanceof x?(e.x*=this._scale.x,e.y*=this._scale.y):(e.x*=this._scale,e.y*=this._scale)),e.x>0&&(e.x*=-1),e.y>0&&(e.y*=-1)),(this._flagScale||this._flagLoaded||this._flagRepeat)&&(e.width=0,e.height=0,r)){switch(e.width=r.width,e.height=r.height,this._repeat){case"no-repeat":e.width+=1,e.height+=1;break}this._scale instanceof x?(e.width*=this._scale.x,e.height*=this._scale.y):(e.width*=this._scale,e.height*=this._scale),s.width=e.width,s.height=e.height}return(this._flagScale||this._flagLoaded)&&(this._renderer.image?E.setAttributes(this._renderer.image,s):this._renderer.image=E.createElement("image",s)),this._renderer.elem?Object.keys(e).length!==0&&E.setAttributes(this._renderer.elem,e):(e.id=this._id,e.patternUnits="userSpaceOnUse",this._renderer.elem=E.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()}}},we=class extends g{constructor(t){super(),this.domElement=t.domElement||E.createElement("svg"),this.scene=new K,this.scene.parent=this,this.defs=E.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,E.setAttributes(this.domElement,{width:t,height:e}),this.trigger(g.Types.resize,t,e)}render(){return E.group.render.call(this.scene,this.domElement),E.defs.update(this.domElement),this}};w(we,"Utils",E);var wt={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 tt("unable to compile shader "+s+": "+n)}return s},types:{vertex:"VERTEX_SHADER",fragment:"FRAGMENT_SHADER"},path:{vertex:` precision mediump float; attribute vec2 a_position; uniform mat3 u_matrix; uniform vec2 u_resolution; uniform vec4 u_rect; varying vec2 v_textureCoords; void main() { vec2 rectCoords = (a_position * (u_rect.zw - u_rect.xy)) + u_rect.xy; vec2 projected = (u_matrix * vec3(rectCoords, 1.0)).xy; vec2 normal = projected / u_resolution; vec2 clipspace = (normal * 2.0) - 1.0; gl_Position = vec4(clipspace * vec2(1.0, -1.0), 0.0, 1.0); v_textureCoords = a_position; } `,fragment:` precision mediump float; uniform sampler2D u_image; varying vec2 v_textureCoords; void main() { vec4 texel = texture2D(u_image, v_textureCoords); if (texel.a == 0.0) { discard; } gl_FragColor = texel; } `},points:{vertex:` precision mediump float; attribute vec2 a_position; uniform float u_size; uniform mat3 u_matrix; uniform vec2 u_resolution; varying vec2 v_textureCoords; void main() { vec2 projected = (u_matrix * vec3(a_position, 1.0)).xy; vec2 normal = projected / u_resolution; vec2 clipspace = (normal * 2.0) - 1.0; gl_PointSize = u_size; gl_Position = vec4(clipspace * vec2(1.0, -1.0), 0.0, 1.0); v_textureCoords = a_position; } `,fragment:` precision mediump float; uniform sampler2D u_image; void main() { vec4 texel = texture2D(u_image, gl_PointCoord); if (texel.a == 0.0) { discard; } gl_FragColor = texel; } `}};var Be=At.Multiply,Ys=[1,0,0,0,1,0,0,0,1],Jt=new vt(9),Gs=rt.Utils,qi=new x,fi=new vt([0,0,1,0,0,1,0,1,1,0,1,1]),L={precision:.9,isHidden:/(undefined|none|transparent)/i,canvas:Y.document?Y.document.createElement("canvas"):{getContext:function(){}},alignments:{left:"start",middle:"center",right:"end"},matrix:new At,group:{removeChild:function(i,t){if(i.children)for(let e=0;e<i.children.length;e++)L.group.removeChild(i.children[e],t);i._renderer.texture&&(t.deleteTexture(i._renderer.texture),delete i._renderer.texture),i._renderer.positionBuffer&&(t.deleteBuffer(i._renderer.positionBuffer),delete i._renderer.positionBuffer)},render:function(i,t){if(!this._visible)return;this._update();let e=this.parent,s=e._matrix&&e._matrix.manual||e._flagMatrix,r=this._matrix.manual||this._flagMatrix;if((s||r)&&(this._renderer.matrix||(this._renderer.matrix=new vt(9)),this._matrix.toTransformArray(!0,Jt),Be(Jt,e._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof x||(this._renderer.scale=new x),this._scale instanceof x?(this._renderer.scale.x=this._scale.x,this._renderer.scale.y=this._scale.y):(this._renderer.scale.x=this._scale,this._renderer.scale.y=this._scale),/renderer/i.test(e._renderer.type)||(this._renderer.scale.x*=e._renderer.scale.x,this._renderer.scale.y*=e._renderer.scale.y),s&&(this._flagMatrix=!0)),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);let o=rt.Utils.getRendererType(this._mask._renderer.type);L[o].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)}this._flagOpacity=e._flagOpacity||this._flagOpacity,this._renderer.opacity=this._opacity*(e&&e._renderer?e._renderer.opacity:1);let n;if(this._flagSubtractions)for(n=0;n<this.subtractions.length;n++)L.group.removeChild(this.subtractions[n],i);for(n=0;n<this.children.length;n++){let o=this.children[n],a=rt.Utils.getRendererType(o._renderer.type);L[a].render.call(o,i,t)}return this._mask&&i.disable(i.STENCIL_TEST),this.flagReset()}},path:{updateCanvas:function(i,t){let e,s,r,n,o,a,h,l,f,c,d,_,u,y,b=t._renderer.vertices,m=this.canvas,p=this.ctx,R=i.renderer.ratio,A=qi.copy(t._renderer.scale).multiply(R),k=t._stroke,S=t._linewidth,M=t._fill,B=t._renderer.opacity||t._opacity,C=t._cap,O=t._join,j=t._miter,N=t._closed,q=t.dashes,z=b.length,it=z-1;m.width=Math.max(Math.ceil(t._renderer.rect.width*A.x),1),m.height=Math.max(Math.ceil(t._renderer.rect.height*A.y),1);let dt=t._renderer.rect.centroid,et=dt.x,xt=dt.y;if(p.clearRect(0,0,m.width,m.height),M)if(typeof M=="string")p.fillStyle=M;else{let _t=rt.Utils.getRendererType(M._renderer.type);L[_t].render.call(M,p,t),p.fillStyle=M._renderer.effect}if(k){if(typeof k=="string")p.strokeStyle=k;else{let _t=rt.Utils.getRendererType(k._renderer.type);L[_t].render.call(k,p,t),p.strokeStyle=k._renderer.effect}S&&(p.lineWidth=S),j&&(p.miterLimit=j),O&&(p.lineJoin=O),!N&&C&&(p.lineCap=C)}typeof B=="number"&&(p.globalAlpha=B),q&&q.length>0&&(p.lineDashOffset=q.offset||0,p.setLineDash(q));let ot,Lt,Nt,de,_e,pe,ge,me;p.save(),p.scale(A.x,A.y),p.translate(et,xt),p.beginPath();for(let _t=0;_t<b.length;_t++){let D=b[_t];switch(_=D.x,u=D.y,D.command){case v.close:p.closePath();break;case v.arc:Lt=D.rx,Nt=D.ry,de=D.xAxisRotation,_e=D.largeArcFlag,pe=D.sweepFlag,e=N?nt(_t-1,z):Math.max(_t-1,0),s=b[e],ge=s.x,me=s.y,Gs.renderSvgArcCommand(p,ge,me,Lt,Nt,_e,pe,de,_,u);break;case v.curve:e=N?nt(_t-1,z):Math.max(_t-1,0),s=b[e],l=s.controls&&s.controls.right||x.zero,f=D.controls&&D.controls.left||x.zero,s._relative?(a=l.x+s.x,h=l.y+s.y):(a=l.x,h=l.y),D._relative?(n=f.x+D.x,o=f.y+D.y):(n=f.x,o=f.y),p.bezierCurveTo(a,h,n,o,_,u),_t>=it&&N&&(r=ot,c=D.controls&&D.controls.right||x.zero,d=r.controls&&r.controls.left||x.zero,D._relative?(a=c.x+D.x,h=c.y+D.y):(a=c.x,h=c.y),r._relative?(n=d.x+r.x,o=d.y+r.y):(n=d.x,o=d.y),_=r.x,u=r.y,p.bezierCurveTo(a,h,n,o,_,u));break;case v.line:p.lineTo(_,u);break;case v.move:ot=D,p.moveTo(_,u);break}}N&&p.closePath(),L.isHidden.test(M)||(y=M._renderer&&M._renderer.offset,y&&(p.save(),p.translate(-M._renderer.offset.x,-M._renderer.offset.y),p.scale(M._renderer.scale.x,M._renderer.scale.y)),p.fill(),y&&p.restore()),L.isHidden.test(k)||(y=k._renderer&&k._renderer.offset,y&&(p.save(),p.translate(-k._renderer.offset.x,-k._renderer.offset.y),p.scale(k._renderer.scale.x,k._renderer.scale.y),p.lineWidth=S/k._renderer.scale.x),p.stroke(),y&&p.restore()),p.restore()},getBoundingClientRect:function(i,t,e){let s=1/0,r=-1/0,n=1/0,o=-1/0,a,h;i.forEach(function(l){let f=l.x,c=l.y,d=l.controls,_,u,y,b,m,p;n=Math.min(c,n),s=Math.min(f,s),r=Math.max(f,r),o=Math.max(c,o),l.controls&&(m=d.left,p=d.right,!(!m||!p)&&(_=l._relative?m.x+f:m.x,u=l._relative?m.y+c:m.y,y=l._relative?p.x+f:p.x,b=l._relative?p.y+c:p.y,!(!_||!u||!y||!b)&&(n=Math.min(u,b,n),s=Math.min(_,y,s),r=Math.max(_,y,r),o=Math.max(u,b,o))))}),typeof t=="number"&&(n-=t,s-=t,r+=t,o+=t),a=r-s,h=o-n,e.top=n,e.left=s,e.right=r,e.bottom=o,e.width=a,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=rt.Utils.getRendererType(this._renderer.type),n=t[r],o=s._matrix.manual||s._flagMatrix,a=this._matrix.manual||this._flagMatrix,h=this._renderer.parent!==s,l=this._flagVertices||this._flagFill||this._fill instanceof W&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagEndPoints)||this._fill instanceof X&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagRadius||this._fill._flagCenter||this._fill._flagFocal)||this._fill instanceof V&&(this._fill._flagLoaded&&this._fill.loaded||this._fill._flagImage||this._fill._flagVideo||this._fill._flagRepeat||this._fill._flagOffset||this._fill._flagScale)||this._stroke instanceof W&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagEndPoints)||this._stroke instanceof X&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagRadius||this._stroke._flagCenter||this._stroke._flagFocal)||this._stroke instanceof V&&(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(o||a||h){this._renderer.matrix||(this._renderer.matrix=new vt(9)),this._matrix.toTransformArray(!0,Jt),Be(Jt,s._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof x||(this._renderer.scale=new x);let c,d;this._scale instanceof x?(c=this._scale.x*s._renderer.scale.x,d=this._scale.y*s._renderer.scale.y):(c=this._scale*s._renderer.scale.x,d=this._scale*s._renderer.scale.y),this._renderer.scale.x=c<0?-c:c,this._renderer.scale.y=d<0?-d:d,h&&(this._renderer.parent=s)}if(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);let c=rt.Utils.getRendererType(this._mask._renderer.type);L[c].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)}if(l?(this._renderer.rect||(this._renderer.rect={}),this._renderer.opacity=this._opacity*s._renderer.opacity,L.path.getBoundingClientRect(this._renderer.vertices,this._linewidth,this._renderer.rect),L.updateTexture.call(L,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!==n&&(i.useProgram(n),i.bindBuffer(i.ARRAY_BUFFER,t.buffers.position),i.vertexAttribPointer(n.position,2,i.FLOAT,!1,0,0),i.enableVertexAttribArray(n.position),i.bufferData(i.ARRAY_BUFFER,fi,i.STATIC_DRAW),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);let f=this._renderer.rect;return i.uniformMatrix3fv(n.matrix,!1,this._renderer.matrix),i.uniform4f(n.rect,f.left,f.top,f.right,f.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,o=t._stroke,a=t._linewidth,h=t._fill,l=t._renderer.opacity||t._opacity,f=t.dashes,c=t._size*n,d=c;L.isHidden.test(o)||(d+=a),s.width=Ue(d),s.height=s.width;let _=d/s.width,u=s.width/2,y=s.height/2;if(r.clearRect(0,0,s.width,s.height),h)if(typeof h=="string")r.fillStyle=h;else{let b=rt.Utils.getRendererType(h._renderer.type);L[b].render.call(h,r,t),r.fillStyle=h._renderer.effect}if(o){if(typeof o=="string")r.strokeStyle=o;else{let b=rt.Utils.getRendererType(o._renderer.type);L[b].render.call(o,r,t),r.strokeStyle=o._renderer.effect}a&&(r.lineWidth=a/_)}typeof l=="number"&&(r.globalAlpha=l),f&&f.length>0&&(r.lineDashOffset=f.offset||0,r.setLineDash(f)),r.save(),r.translate(u,y),r.scale(L.precision,L.precision),r.beginPath(),r.arc(0,0,c/_*.5,0,J),r.restore(),closed&&r.closePath(),L.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()),L.isHidden.test(o)||(e=o._renderer&&o._renderer.offset,e&&(r.save(),r.translate(-o._renderer.offset.x,-o._renderer.offset.y),r.scale(o._renderer.scale.x,o._renderer.scale.y),r.lineWidth=a/o._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],o=this._sizeAttenuation,a=this._stroke,h=this._linewidth,l=r._matrix.manual||r._flagMatrix,f=this._matrix.manual||this._flagMatrix,c=this._renderer.parent!==r,d=this._renderer.vertices,_=this._renderer.collection.length,u=this._flagVertices,y=this._flagFill||this._fill instanceof W&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagEndPoints)||this._fill instanceof X&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagRadius||this._fill._flagCenter||this._fill._flagFocal)||this._fill instanceof V&&(this._fill._flagLoaded&&this._fill.loaded||this._fill._flagImage||this._fill._flagVideo||this._fill._flagRepeat||this._fill._flagOffset||this._fill._flagScale)||this._stroke instanceof W&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagEndPoints)||this._stroke instanceof X&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagRadius||this._stroke._flagCenter||this._stroke._flagFocal)||this._stroke instanceof V&&(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 vt(9)),this._matrix.toTransformArray(!0,Jt),Be(Jt,r._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof x||(this._renderer.scale=new x);let b,m;this._scale instanceof x?(b=this._scale.x*r._renderer.scale.x,m=this._scale.y*r._renderer.scale.y):(b=this._scale*r._renderer.scale.x,m=this._scale*r._renderer.scale.y),this._renderer.scale.x=b<0?-b:b,this._renderer.scale.y=m<0?-m:m,c&&(this._renderer.parent=r)}if(u){let b=this._renderer.positionBuffer;b&&i.deleteBuffer(b),this._renderer.positionBuffer=i.createBuffer(),i.bindBuffer(i.ARRAY_BUFFER,this._renderer.positionBuffer),i.vertexAttribPointer(n.position,2,i.FLOAT,!1,0,0),i.enableVertexAttribArray(n.position),i.bufferData(i.ARRAY_BUFFER,d,i.STATIC_DRAW)}return y?(this._renderer.opacity=this._opacity*r._renderer.opacity,L.updateTexture.call(L,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:(L.isHidden.test(a)||(s+=h),s/=L.precision,o&&(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=qi.copy(t._renderer.scale).multiply(r),o=t._stroke,a=t._linewidth,h=t._fill,l=t._renderer.opacity||t._opacity,f=t.dashes,c=t._decoration,d=t._direction;e.width=Math.max(Math.ceil(t._renderer.rect.width*n.x),1),e.height=Math.max(Math.ceil(t._renderer.rect.height*n.y),1);let _=t._renderer.rect.centroid,u=_.x,y=_.y,b,m,p,R,A,k,S,M,B,C,O,j=h._renderer&&h._renderer.offset&&o._renderer&&o._renderer.offset;if(s.clearRect(0,0,e.width,e.height),j||(s.font=[t._style,t._weight,t._size+"px/"+t._leading+"px",t._family].join(" ")),s.textAlign="center",s.textBaseline="middle",s.textDirection=d,h)if(typeof h=="string")s.fillStyle=h;else{let N=rt.Utils.getRendererType(h._renderer.type);L[N].render.call(h,s,t),s.fillStyle=h._renderer.effect}if(o){if(typeof o=="string")s.strokeStyle=o;else{let N=rt.Utils.getRendererType(o._renderer.type);L[N].render.call(o,s,t),s.strokeStyle=o._renderer.effect}a&&(s.lineWidth=a)}if(typeof l=="number"&&(s.globalAlpha=l),f&&f.length>0&&(s.lineDashOffset=f.offset||0,s.setLineDash(f)),s.save(),s.scale(n.x,n.y),s.translate(u,y),L.isHidden.test(h)||(h._renderer&&h._renderer.offset?(k=h._renderer.scale.x,S=h._renderer.scale.y,s.save(),s.translate(-h._renderer.offset.x,-h._renderer.offset.y),s.scale(k,S),b=t._size/h._renderer.scale.y,m=t._leading/h._renderer.scale.y,s.font=[t._style,t._weight,b+"px/",m+"px",t._family].join(" "),p=h._renderer.offset.x/h._renderer.scale.x,R=h._renderer.offset.y/h._renderer.scale.y,s.fillText(t.value,p,R),s.restore()):s.fillText(t.value,0,0)),L.isHidden.test(o)||(o._renderer&&o._renderer.offset?(k=o._renderer.scale.x,S=o._renderer.scale.y,s.save(),s.translate(-o._renderer.offset.x,-o._renderer.offset.y),s.scale(k,S),b=t._size/o._renderer.scale.y,m=t._leading/o._renderer.scale.y,s.font=[t._style,t._weight,b+"px/",m+"px",t._family].join(" "),p=o._renderer.offset.x/o._renderer.scale.x,R=o._renderer.offset.y/o._renderer.scale.y,A=a/o._renderer.scale.x,s.lineWidth=A,s.strokeText(t.value,p,R),s.restore()):s.strokeText(t.value,0,0)),/(underline|strikethrough)/i.test(c)){let N=s.measureText(t.value);switch(c){case"underline":B=N.actualBoundingBoxDescent,O=N.actualBoundingBoxDescent;break;case"strikethrough":B=0,O=0;break}M=-N.width/2,C=N.width/2,s.lineWidth=Math.max(Math.floor(t._size/15),1),s.strokeStyle=s.fillStyle,s.beginPath(),s.moveTo(M,B),s.lineTo(C,O),s.stroke()}s.restore()},getBoundingClientRect:function(i,t){let e=L.ctx;e.font=[i._style,i._weight,i._size+"px/"+i._leading+"px",i._family].join(" "),e.textAlign="center",e.textBaseline=rt.Utils.baselines[i._baseline]||i._baseline;let s=e.measureText(i._value),r=s.width,n=1.15*(s.actualBoundingBoxAscent+s.actualBoundingBoxDescent);this._linewidth&&!L.isHidden.test(this._stroke)&&(r+=this._linewidth*2,n+=this._linewidth*2);let o=r/2,a=n/2;switch(L.alignments[i._alignment]||i._alignment){case L.alignments.left:i.direction==="ltr"?(t.left=0,t.right=r):(t.left=-r,t.right=0);break;case L.alignments.right:i.direction==="ltr"?(t.left=-r,t.right=0):(t.left=0,t.right=r);break;default:t.left=-o,t.right=o}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=-a*1.5,t.bottom=a*.5;break;default:t.top=-a,t.bottom=a}t.width=r,t.height=n,t.centroid||(t.centroid={}),t.centroid.x=o,t.centroid.y=a},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,o=this._matrix.manual||this._flagMatrix,a=this._renderer.parent!==s,h=this._flagVertices||this._flagFill||this._fill instanceof W&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagEndPoints)||this._fill instanceof X&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagRadius||this._fill._flagCenter||this._fill._flagFocal)||this._fill instanceof V&&(this._fill._flagLoaded&&this._fill.loaded||this._fill._flagImage||this._fill._flagVideo||this._fill._flagRepeat||this._fill._flagOffset||this._fill._flagScale)||this._stroke instanceof W&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagEndPoints)||this._stroke instanceof X&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagRadius||this._stroke._flagCenter||this._stroke._flagFocal)||this._stroke instanceof V&&(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||o||a){this._renderer.matrix||(this._renderer.matrix=new vt(9)),this._matrix.toTransformArray(!0,Jt),Be(Jt,s._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof x||(this._renderer.scale=new x);let f,c;this._scale instanceof x?(f=this._scale.x*s._renderer.scale.x,c=this._scale.y*s._renderer.scale.y):(f=this._scale*s._renderer.scale.x,c=this._scale*s._renderer.scale.y),this._renderer.scale.x=f<0?-f:f,this._renderer.scale.y=c<0?-c:c,a&&(this._renderer.parent=s)}if(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);let f=rt.Utils.getRendererType(this._mask._renderer.type);L[f].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)}if(h?(this._renderer.rect||(this._renderer.rect={}),this._renderer.opacity=this._opacity*s._renderer.opacity,L.text.getBoundingClientRect(this,this._renderer.rect),L.updateTexture.call(L,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,fi,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,o=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,o=(o-.5)*e.height),this._renderer.effect=i.createLinearGradient(s,r,n,o);for(let a=0;a<this.stops.length;a++){let h=this.stops[a];this._renderer.effect.addColorStop(h._offset,h._color)}}return this.flagReset()}}},"radial-gradient":{render:function(i,t){if(!(!i.canvas.getContext("2d")||!t)){if(this._update(),!this._renderer.effect||this._flagCenter||this._flagFocal||this._flagRadius||this._flagStops||this._flagUnits){let e,s=this.center._x,r=this.center._y,n=this.focal._x,o=this.focal._y,a=this._radius;/objectBoundingBox/i.test(this._units)&&(e=t.getBoundingClientRect(!0),s=(s-.5)*e.width*.5,r=(r-.5)*e.height*.5,n=(n-.5)*e.width*.5,o=(o-.5)*e.height*.5,a*=Math.min(e.width,e.height)),this._renderer.effect=i.createRadialGradient(s,r,0,n,o,a);for(let h=0;h<this.stops.length;h++){let l=this.stops[h];this._renderer.effect.addColorStop(l._offset,l._color)}}return this.flagReset()}}},texture:{render:function(i,t){if(!i.canvas.getContext("2d"))return;this._update();let e=this.image;if((this._flagLoaded||this._flagImage||this._flagVideo||this._flagRepeat)&&this.loaded)this._renderer.effect=i.createPattern(e,this._repeat);else if(!this._renderer.effect)return this.flagReset();if((this._flagOffset||this._flagLoaded||this._flagScale)&&(this._renderer.offset instanceof x||(this._renderer.offset=new x),this._renderer.offset.x=-this._offset.x,this._renderer.offset.y=-this._offset.y,e&&(this._renderer.offset.x+=e.width/2,this._renderer.offset.y+=e.height/2,this._scale instanceof x?(this._renderer.offset.x*=this._scale.x,this._renderer.offset.y*=this._scale.y):(this._renderer.offset.x*=this._scale,this._renderer.offset.y*=this._scale))),this._flagScale||this._flagLoaded){this._renderer.scale instanceof x||(this._renderer.scale=new x);let s,r;this._scale instanceof x?(s=this._scale.x,r=this._scale.y):(s=this._scale,r=this._scale),this._renderer.scale.x=s<0?-s:s,this._renderer.scale.y=r<0?-r:r}return this.flagReset()}},updateTexture:function(i,t){let e=rt.Utils.getRendererType(t._renderer.type);if(this[e].updateCanvas.call(L,i,t),this.canvas.width<=0||this.canvas.height<=0){t._renderer.texture&&i.deleteTexture(t._renderer.texture),delete t._renderer.texture;return}t._renderer.texture||(t._renderer.texture=i.createTexture()),i.bindTexture(i.TEXTURE_2D,t._renderer.texture),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,this.canvas),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR)},program:{create:function(i,t){let e,s,r;if(e=i.createProgram(),F.each(t,function(n){i.attachShader(e,n)}),i.linkProgram(e),s=i.getProgramParameter(e,i.LINK_STATUS),!s)throw r=i.getProgramInfoLog(e),i.deleteProgram(e),new tt("unable to link program: "+r);return e}},extensions:{init:function(i){let t={},e=["EXT_texture_filter_anisotropic","WEBGL_compressed_texture_s3tc","OES_texture_float_linear","WEBGL_multisampled_render_to_texture"];for(let s=0;s<e.length;s++){let r=e[s];t[r]=L.extensions.get(i,r)}return t},get:function(i,t){return i.getExtension(t)||i.getExtension(`MOZ_${t}`)||i.getExtension(`WEBKIT_${t}`)}},TextureRegistry:new Tt};L.ctx=L.canvas.getContext("2d");var ve=class extends g{constructor(t){super();let e,s,r,n;if(this.domElement=t.domElement||document.createElement("canvas"),typeof t.offscreenElement<"u"&&(L.canvas=t.offscreenElement,L.ctx=L.canvas.getContext("2d")),this.scene=new K,this.scene.parent=this,this._renderer={type:"renderer",matrix:new vt(Ys),scale:1,opacity:1},this._flagMatrix=!0,t=F.defaults(t||{},{antialias:!1,alpha:!0,premultipliedAlpha:!0,stencil:!0,preserveDrawingBuffer:!0,overdraw:!1}),this.overdraw=t.overdraw,e=this.ctx=this.domElement.getContext("webgl",t)||this.domElement.getContext("experimental-webgl",t),!this.ctx)throw new tt("unable to create a webgl context. Try using another renderer.");r=wt.create(e,wt.path.vertex,wt.types.vertex),n=wt.create(e,wt.path.fragment,wt.types.fragment),this.programs={current:null,buffers:{position:e.createBuffer()},resolution:{width:0,height:0,ratio:1,flagged:!1}},s=this.programs.path=L.program.create(e,[r,n]),this.programs.text=this.programs.path,e.extensions=L.extensions.init(e),e.renderer=this,s.position=e.getAttribLocation(s,"a_position"),s.matrix=e.getUniformLocation(s,"u_matrix"),s.rect=e.getUniformLocation(s,"u_rect");let o=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,o),e.vertexAttribPointer(s.position,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(s.position),e.bufferData(e.ARRAY_BUFFER,fi,e.STATIC_DRAW),r=wt.create(e,wt.points.vertex,wt.types.vertex),n=wt.create(e,wt.points.fragment,wt.types.fragment),s=this.programs.points=L.program.create(e,[r,n]),s.position=e.getAttribLocation(s,"a_position"),s.matrix=e.getUniformLocation(s,"u_matrix"),s.size=e.getUniformLocation(s,"u_size"),e.enable(e.BLEND),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA)}setSize(t,e,s){let r,n,o=this.ctx;return this.width=t,this.height=e,this.ratio=typeof s>"u"?ne(o):s,this.domElement.width=t*this.ratio,this.domElement.height=e*this.ratio,F.isObject(this.domElement.style)&&F.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,o.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(g.Types.resize,t,e,s)}render(){let t=this.ctx;return this.overdraw||t.clear(t.COLOR_BUFFER_BIT),L.group.render.call(this.scene,t,this.programs),this._flagMatrix=!1,this.programs.resolution.flagged=!0,this}};w(ve,"Utils",L);var qs=F.extend({Error:tt,getRatio:ne,read:$,xhr:ai},F,at,Ye,De),ue=class{_events=new g;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=F.defaults(t||{},{fullscreen:!1,fitted:!1,width:640,height:480,type:ue.Types.svg,autostart:!1});if(F.each(e,function(s,r){/fullscreen/i.test(r)||/autostart/i.test(r)||(this[r]=s)},this),F.isElement(e.domElement)){let s=e.domElement.tagName.toLowerCase();/^(CanvasRenderer-canvas|WebGLRenderer-canvas|SVGRenderer-svg)$/.test(this.type+"-"+s)||(this.type=ue.Types[s])}this.renderer=new ue[this.type](this),this.setPlaying(e.autostart),this.frameCount=0,e.fullscreen?(this.fit=Ks.bind(this),this.fit.domElement=window,this.fit.attached=!0,F.extend(document.body.style,{overflow:"hidden",margin:0,padding:0,top:0,left:0,right:0,bottom:0,position:"fixed"}),F.extend(this.renderer.domElement.style,{display:"block",top:0,left:0,right:0,bottom:0,position:"fixed"}),mt.bind(this.fit.domElement,"resize",this.fit),this.fit()):e.fitted?(this.fit=$s.bind(this),F.extend(this.renderer.domElement.style,{display:"block"})):typeof e.width=="number"&&typeof e.height=="number"&&(this.renderer.setSize(e.width,e.height,this.ratio),this.width=e.width,this.height=e.height),this.renderer.bind(g.Types.resize,Js.bind(this)),this.scene=this.renderer.scene,ue.Instances.push(this),e.autostart&&ke.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,ke.init(),this.trigger(g.Types.play)}pause(){return this.playing=!1,this.trigger(g.Types.pause)}setPlaying(t){this.playing=t}release(t){let e,s,r;if(!F.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<t.vertices.length;e++)s=t.vertices[e],typeof s.unbind=="function"&&s.unbind(),s.controls&&(s.controls.left&&typeof s.controls.left.unbind=="function"&&s.controls.left.unbind(),s.controls.right&&typeof s.controls.right.unbind=="function"&&s.controls.right.unbind());if(t.children){for(e=0;e<t.children.length;e++)r=t.children[e],this.release(r);typeof t.children.unbind=="function"&&t.children.unbind()}return t}update(){let t=!!this._lastFrame,e=F.performance.now();t&&(this.timeDelta=parseFloat((e-this._lastFrame).toFixed(3))),this._lastFrame=e,this.fit&&this.fit.domElement&&!this.fit.attached&&(mt.bind(this.fit.domElement,"resize",this.fit),this.fit.attached=!0,this.fit());let s=this.width,r=this.height,n=this.renderer;return(s!==n.width||r!==n.height)&&n.setSize(s,r,this.ratio),this.trigger(g.Types.update,this.frameCount,this.timeDelta),this.render()}render(){return this.renderer.render(),this.trigger(g.Types.render,this.frameCount++)}add(t){return t instanceof Array||(t=Array.prototype.slice.call(arguments)),this.scene.add(t),this}remove(t){return t instanceof Array||(t=Array.prototype.slice.call(arguments)),this.scene.remove(t),this}clear(){return this.scene.remove(this.scene.children),this}makeLine(t,e,s,r){let n=new te(t,e,s,r);return this.scene.add(n),n}makeArrow(t,e,s,r,n){let o=typeof n=="number"?n:10,a=Math.atan2(r-e,s-t),h=[new T(t,e,void 0,void 0,void 0,void 0,v.move),new T(s,r,void 0,void 0,void 0,void 0,v.line),new T(s-o*Math.cos(a-Math.PI/4),r-o*Math.sin(a-Math.PI/4),void 0,void 0,void 0,void 0,v.line),new T(s,r,void 0,void 0,void 0,void 0,v.move),new T(s-o*Math.cos(a+Math.PI/4),r-o*Math.sin(a+Math.PI/4),void 0,void 0,void 0,void 0,v.line)],l=new P(h,!1,!1,!0);return l.noFill(),l.cap="round",l.join="round",this.scene.add(l),l}makeRectangle(t,e,s,r){let n=new gt(t,e,s,r);return this.scene.add(n),n}makeRoundedRectangle(t,e,s,r,n){let o=new Pt(t,e,s,r,n);return this.scene.add(o),o}makeCircle(t,e,s,r){let n=new Mt(t,e,s,r);return this.scene.add(n),n}makeEllipse(t,e,s,r,n){let o=new Ot(t,e,s,r,n);return this.scene.add(o),o}makeStar(t,e,s,r,n){let o=new $t(t,e,s,r,n);return this.scene.add(o),o}makeCurve(t){let e=arguments.length;if(!Array.isArray(t)){t=[];for(let o=0;o<e;o+=2){let a=arguments[o];if(typeof a!="number")break;let h=arguments[o+1];t.push(new T(a,h))}}let s=arguments[e-1],r=new P(t,!(typeof s=="boolean"&&s),!0),n=r.getBoundingClientRect();return r.center().translation.set(n.left+n.width/2,n.top+n.height/2),this.scene.add(r),r}makePolygon(t,e,s,r){let n=new Gt(t,e,s,r);return this.scene.add(n),n}makeArcSegment(t,e,s,r,n,o,a){let h=new Dt(t,e,s,r,n,o,a);return this.scene.add(h),h}makePoints(t){let e=arguments.length,s=t;if(!Array.isArray(t)){s=[];for(let n=0;n<e;n+=2){let o=arguments[n];if(typeof o!="number")break;let a=arguments[n+1];s.push(new x(o,a))}}let r=new Ht(s);return this.scene.add(r),r}makePath(t){let e=arguments.length,s=t;if(!Array.isArray(t)){s=[];for(let a=0;a<e;a+=2){let h=arguments[a];if(typeof h!="number")break;let l=arguments[a+1];s.push(new T(h,l))}}let r=arguments[e-1],n=new P(s,!(typeof r=="boolean"&&r)),o=n.getBoundingClientRect();return typeof o.top=="number"&&typeof o.left=="number"&&typeof o.right=="number"&&typeof o.bottom=="number"&&n.center().translation.set(o.left+o.width/2,o.top+o.height/2),this.scene.add(n),n}makeText(t,e,s,r){let n=new ht(t,e,s,r);return this.add(n),n}makeLinearGradient(t,e,s,r){let n=Array.prototype.slice.call(arguments,4),o=new W(t,e,s,r,n);return this.add(o),o}makeRadialGradient(t,e,s){let r=Array.prototype.slice.call(arguments,3),n=new X(t,e,s,r);return this.add(n),n}makeSprite(t,e,s,r,n,o,a){let h=new jt(t,e,s,r,n,o);return a&&h.play(),this.add(h),h}makeImageSequence(t,e,s,r,n){let o=new ie(t,e,s,r);return n&&o.play(),this.add(o),o}makeTexture(t,e){return new V(t,e)}makeGroup(t){t instanceof Array||(t=Array.prototype.slice.call(arguments));let e=new K;return this.scene.add(e),e.add(t),e}interpret(t,e,s){let r=t.tagName.toLowerCase();if(s=typeof s<"u"?s:!0,!(r in $))return null;let n=$[r].call(this,t);return s?this.add(e&&n instanceof K?n.children:n):n.parent&&n.remove(),n}load(t,e){let s=new K,r,n,o,a=function(h){for(mt.temp.innerHTML=h,n=0;n<mt.temp.children.length;n++)r=mt.temp.children[n],o=this.interpret(r,!1,!1),o!==null&&s.add(o);if(typeof e=="function"){let l=mt.temp.children.length<=1?mt.temp.children[0]:mt.temp.children;e(s,l)}}.bind(this);return/\.svg$/i.test(t)?(ai(t,a),s):(a(t),s)}},I=ue;w(I,"nextFrameID",Q.nextFrameID),w(I,"Types",Q.Types),w(I,"Version",Q.Version),w(I,"PublishDate",Q.PublishDate),w(I,"Identifier",Q.Identifier),w(I,"Resolution",Q.Resolution),w(I,"AutoCalculateImportedMatrices",Q.AutoCalculateImportedMatrices),w(I,"Instances",Q.Instances),w(I,"uniqueId",Q.uniqueId),w(I,"Anchor",T),w(I,"Collection",ct),w(I,"Events",g),w(I,"Group",K),w(I,"Matrix",At),w(I,"Path",P),w(I,"Registry",Tt),w(I,"Element",pt),w(I,"Shape",ut),w(I,"Text",ht),w(I,"Vector",x),w(I,"Gradient",G),w(I,"ImageSequence",ie),w(I,"LinearGradient",W),w(I,"RadialGradient",X),w(I,"Sprite",jt),w(I,"Stop",lt),w(I,"Texture",V),w(I,"ArcSegment",Dt),w(I,"Circle",Mt),w(I,"Ellipse",Ot),w(I,"Line",te),w(I,"Points",Ht),w(I,"Polygon",Gt),w(I,"Rectangle",gt),w(I,"RoundedRectangle",Pt),w(I,"Star",$t),w(I,"CanvasRenderer",rt),w(I,"SVGRenderer",we),w(I,"WebGLRenderer",ve),w(I,"Commands",v),w(I,"Utils",qs);function Ks(){let i=document.body.getBoundingClientRect(),t=this.width=i.width,e=this.height=i.height;this.renderer.setSize(t,e,this.ratio)}function $s(){let i=this.renderer.domElement.parentElement;if(!i){console.warn("Two.js: Attempting to fit to parent, but no parent found.");return}let t=i.getBoundingClientRect(),e=this.width=t.width,s=this.height=t.height;this.renderer.setSize(e,s,this.ratio)}function Js(i,t){this.width=i,this.height=t,this.trigger(g.Types.resize,i,t)}var ke=mt.getRequestAnimationFrame();function Ki(){for(let i=0;i<I.Instances.length;i++){let t=I.Instances[i];t.playing&&t.update()}I.nextFrameID=ke(Ki)}ke.init=function(){Ki(),ke.init=function(){}};return es(Zs);})().default; (function(){if(typeof exports==='object'&&typeof module!=='undefined'){module.exports=Two}})()