diff --git a/assets/index-49970ddd.js b/assets/index-49970ddd.js deleted file mode 100644 index b74091a..0000000 --- a/assets/index-49970ddd.js +++ /dev/null @@ -1,16 +0,0 @@ -var Ms=Object.defineProperty;var Ps=(t,e,r)=>e in t?Ms(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var Xt=(t,e,r)=>(Ps(t,typeof e!="symbol"?e+"":e,r),r);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))n(i);new MutationObserver(i=>{for(const a of i)if(a.type==="childList")for(const o of a.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&n(o)}).observe(document,{childList:!0,subtree:!0});function r(i){const a={};return i.integrity&&(a.integrity=i.integrity),i.referrerPolicy&&(a.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?a.credentials="include":i.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function n(i){if(i.ep)return;i.ep=!0;const a=r(i);fetch(i.href,a)}})();function Ts(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Va={exports:{}},xr={};/* -object-assign -(c) Sindre Sorhus -@license MIT -*/var Ui=Object.getOwnPropertySymbols,ws=Object.prototype.hasOwnProperty,bs=Object.prototype.propertyIsEnumerable;function Cs(t){if(t==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}function Ss(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de",Object.getOwnPropertyNames(t)[0]==="5")return!1;for(var e={},r=0;r<10;r++)e["_"+String.fromCharCode(r)]=r;var n=Object.getOwnPropertyNames(e).map(function(a){return e[a]});if(n.join("")!=="0123456789")return!1;var i={};return"abcdefghijklmnopqrst".split("").forEach(function(a){i[a]=a}),Object.keys(Object.assign({},i)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}Ss();const Ns=React;/** @license React v17.0.2 - * react-jsx-runtime.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var Rs=Ns,qa=60103;xr.Fragment=60107;if(typeof Symbol=="function"&&Symbol.for){var Yi=Symbol.for;qa=Yi("react.element"),xr.Fragment=Yi("react.fragment")}var As=Rs.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Os=Object.prototype.hasOwnProperty,ks={key:!0,ref:!0,__self:!0,__source:!0};function $a(t,e,r){var n,i={},a=null,o=null;r!==void 0&&(a=""+r),e.key!==void 0&&(a=""+e.key),e.ref!==void 0&&(o=e.ref);for(n in e)Os.call(e,n)&&!ks.hasOwnProperty(n)&&(i[n]=e[n]);if(t&&t.defaultProps)for(n in e=t.defaultProps,e)i[n]===void 0&&(i[n]=e[n]);return{$$typeof:qa,type:t,key:a,ref:o,props:i,_owner:As.current}}xr.jsx=$a;xr.jsxs=$a;Va.exports=xr;var V=Va.exports;const ae=new window.AudioContext;class Is{constructor(e){Xt(this,"analyser");Xt(this,"gainNode");Xt(this,"audioSource");Xt(this,"options");Xt(this,"visualArr");const r={size:128};this.options={...r,...e},this.analyser=ae.createAnalyser(),this.analyser.fftSize=this.options.size*2,this.gainNode=ae.createGain(),this.gainNode.connect(ae.destination),this.analyser.connect(this.gainNode),this.options.audioEl&&(this.audioSource=ae.createMediaElementSource(this.options.audioEl),this.audioSource.connect(this.analyser)),this.visualArr=new Uint8Array(this.analyser.frequencyBinCount),this.resumeAudioContext()}resumeAudioContext(){if(ae){const e=()=>{ae.state==="suspended"&&ae.resume(),document.removeEventListener("click",e)};document.addEventListener("click",e)}}destory(){var e;this.analyser.disconnect(this.gainNode),(e=this.audioSource)==null||e.disconnect(this.analyser),this.gainNode.disconnect(ae.destination)}setAudioEl(e){this.audioSource&&this.audioSource.disconnect(this.analyser),this.audioSource=ae.createMediaElementSource(e),this.audioSource.connect(this.analyser)}changeVolumn(e){this.gainNode.gain.value=e}getVisualizeValue(){return this.analyser.getByteFrequencyData(this.visualArr),this.visualArr}}const Ls="_page_5qejz_1",_s="_operationWrapper_5qejz_4",Ds="_audioWrapper_5qejz_10",Fs="_exampleWrapper_5qejz_18",Bs="_footer_5qejz_26",Gs="_github_5qejz_39",De={page:Ls,operationWrapper:_s,audioWrapper:Ds,exampleWrapper:Fs,footer:Bs,github:Gs};var Vn=function(t,e){return Vn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(r[i]=n[i])},Vn(t,e)};function z(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Vn(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var U=function(){return U=Object.assign||function(e){for(var r,n=1,i=arguments.length;n0&&a[a.length-1])&&(l[0]===6||l[0]===2)){r=0;continue}if(l[0]===3&&(!a||l[1]>a[0]&&l[1]=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function _(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,a=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)a.push(i.value)}catch(s){o={error:s}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return a}function X(t,e,r){if(r||arguments.length===2)for(var n=0,i=e.length,a;n0?(r[0]=(s*o+u*n+c*a-l*i)*2/f,r[1]=(c*o+u*i+l*n-s*a)*2/f,r[2]=(l*o+u*a+s*i-c*n)*2/f):(r[0]=(s*o+u*n+c*a-l*i)*2,r[1]=(c*o+u*i+l*n-s*a)*2,r[2]=(l*o+u*a+s*i-c*n)*2),no(t,e,r),t}function nn(t,e){return t[0]=e[12],t[1]=e[13],t[2]=e[14],t}function Ze(t,e){var r=e[0],n=e[1],i=e[2],a=e[4],o=e[5],s=e[6],c=e[8],l=e[9],u=e[10];return t[0]=Math.hypot(r,n,i),t[1]=Math.hypot(a,o,s),t[2]=Math.hypot(c,l,u),t}function an(t,e){var r=new ft(3);Ze(r,e);var n=1/r[0],i=1/r[1],a=1/r[2],o=e[0]*n,s=e[1]*i,c=e[2]*a,l=e[4]*n,u=e[5]*i,f=e[6]*a,h=e[8]*n,v=e[9]*i,p=e[10]*a,y=o+u+p,d=0;return y>0?(d=Math.sqrt(y+1)*2,t[3]=.25*d,t[0]=(f-v)/d,t[1]=(h-c)/d,t[2]=(s-l)/d):o>u&&o>p?(d=Math.sqrt(1+o-u-p)*2,t[3]=(f-v)/d,t[0]=.25*d,t[1]=(s+l)/d,t[2]=(h+c)/d):u>p?(d=Math.sqrt(1+u-o-p)*2,t[3]=(h-c)/d,t[0]=(s+l)/d,t[1]=.25*d,t[2]=(f+v)/d):(d=Math.sqrt(1+p-o-u)*2,t[3]=(s-l)/d,t[0]=(h+c)/d,t[1]=(f+v)/d,t[2]=.25*d),t}function js(t,e,r,n){var i=e[0],a=e[1],o=e[2],s=e[3],c=i+i,l=a+a,u=o+o,f=i*c,h=i*l,v=i*u,p=a*l,y=a*u,d=o*u,m=s*c,E=s*l,M=s*u,P=n[0],x=n[1],g=n[2];return t[0]=(1-(p+d))*P,t[1]=(h+M)*P,t[2]=(v-E)*P,t[3]=0,t[4]=(h-M)*x,t[5]=(1-(f+d))*x,t[6]=(y+m)*x,t[7]=0,t[8]=(v+E)*g,t[9]=(y-m)*g,t[10]=(1-(f+p))*g,t[11]=0,t[12]=r[0],t[13]=r[1],t[14]=r[2],t[15]=1,t}function cr(t,e,r,n,i){var a=e[0],o=e[1],s=e[2],c=e[3],l=a+a,u=o+o,f=s+s,h=a*l,v=a*u,p=a*f,y=o*u,d=o*f,m=s*f,E=c*l,M=c*u,P=c*f,x=n[0],g=n[1],T=n[2],w=i[0],b=i[1],C=i[2],S=(1-(y+m))*x,N=(v+P)*x,O=(p-M)*x,k=(v-P)*g,B=(1-(h+m))*g,Y=(d+E)*g,I=(p+M)*T,G=(d-E)*T,H=(1-(h+y))*T;return t[0]=S,t[1]=N,t[2]=O,t[3]=0,t[4]=k,t[5]=B,t[6]=Y,t[7]=0,t[8]=I,t[9]=G,t[10]=H,t[11]=0,t[12]=r[0]+w-(S*w+k*b+I*C),t[13]=r[1]+b-(N*w+B*b+G*C),t[14]=r[2]+C-(O*w+Y*b+H*C),t[15]=1,t}function io(t,e){var r=e[0],n=e[1],i=e[2],a=e[3],o=r+r,s=n+n,c=i+i,l=r*o,u=n*o,f=n*s,h=i*o,v=i*s,p=i*c,y=a*o,d=a*s,m=a*c;return t[0]=1-f-p,t[1]=u+m,t[2]=h-d,t[3]=0,t[4]=u-m,t[5]=1-l-p,t[6]=v+y,t[7]=0,t[8]=h+d,t[9]=v-y,t[10]=1-l-f,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function tc(t,e,r,n,i,a,o){var s=1/(r-e),c=1/(i-n),l=1/(a-o);return t[0]=a*2*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=a*2*c,t[6]=0,t[7]=0,t[8]=(r+e)*s,t[9]=(i+n)*c,t[10]=(o+a)*l,t[11]=-1,t[12]=0,t[13]=0,t[14]=o*a*2*l,t[15]=0,t}function ao(t,e,r,n,i){var a=1/Math.tan(e/2),o;return t[0]=a/r,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=a,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,i!=null&&i!==1/0?(o=1/(n-i),t[10]=(i+n)*o,t[14]=2*i*n*o):(t[10]=-1,t[14]=-2*n),t}var ec=ao;function rc(t,e,r,n,i){var a=1/Math.tan(e/2),o;return t[0]=a/r,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=a,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,i!=null&&i!==1/0?(o=1/(n-i),t[10]=i*o,t[14]=i*n*o):(t[10]=-1,t[14]=-n),t}function nc(t,e,r,n){var i=Math.tan(e.upDegrees*Math.PI/180),a=Math.tan(e.downDegrees*Math.PI/180),o=Math.tan(e.leftDegrees*Math.PI/180),s=Math.tan(e.rightDegrees*Math.PI/180),c=2/(o+s),l=2/(i+a);return t[0]=c,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=l,t[6]=0,t[7]=0,t[8]=-((o-s)*c*.5),t[9]=(i-a)*l*.5,t[10]=n/(r-n),t[11]=-1,t[12]=0,t[13]=0,t[14]=n*r/(r-n),t[15]=0,t}function oo(t,e,r,n,i,a,o){var s=1/(e-r),c=1/(n-i),l=1/(a-o);return t[0]=-2*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*c,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*l,t[11]=0,t[12]=(e+r)*s,t[13]=(i+n)*c,t[14]=(o+a)*l,t[15]=1,t}var so=oo;function co(t,e,r,n,i,a,o){var s=1/(e-r),c=1/(n-i),l=1/(a-o);return t[0]=-2*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*c,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=l,t[11]=0,t[12]=(e+r)*s,t[13]=(i+n)*c,t[14]=a*l,t[15]=1,t}function lo(t,e,r,n){var i,a,o,s,c,l,u,f,h,v,p=e[0],y=e[1],d=e[2],m=n[0],E=n[1],M=n[2],P=r[0],x=r[1],g=r[2];return Math.abs(p-P)0&&(v=1/Math.sqrt(v),u*=v,f*=v,h*=v);var p=c*h-l*f,y=l*u-s*h,d=s*f-c*u;return v=p*p+y*y+d*d,v>0&&(v=1/Math.sqrt(v),p*=v,y*=v,d*=v),t[0]=p,t[1]=y,t[2]=d,t[3]=0,t[4]=f*d-h*y,t[5]=h*p-u*d,t[6]=u*y-f*p,t[7]=0,t[8]=u,t[9]=f,t[10]=h,t[11]=0,t[12]=i,t[13]=a,t[14]=o,t[15]=1,t}function ac(t){return"mat4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+", "+t[9]+", "+t[10]+", "+t[11]+", "+t[12]+", "+t[13]+", "+t[14]+", "+t[15]+")"}function oc(t){return Math.hypot(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8],t[9],t[10],t[11],t[12],t[13],t[14],t[15])}function sc(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t[3]=e[3]+r[3],t[4]=e[4]+r[4],t[5]=e[5]+r[5],t[6]=e[6]+r[6],t[7]=e[7]+r[7],t[8]=e[8]+r[8],t[9]=e[9]+r[9],t[10]=e[10]+r[10],t[11]=e[11]+r[11],t[12]=e[12]+r[12],t[13]=e[13]+r[13],t[14]=e[14]+r[14],t[15]=e[15]+r[15],t}function uo(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t[3]=e[3]-r[3],t[4]=e[4]-r[4],t[5]=e[5]-r[5],t[6]=e[6]-r[6],t[7]=e[7]-r[7],t[8]=e[8]-r[8],t[9]=e[9]-r[9],t[10]=e[10]-r[10],t[11]=e[11]-r[11],t[12]=e[12]-r[12],t[13]=e[13]-r[13],t[14]=e[14]-r[14],t[15]=e[15]-r[15],t}function cc(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t[4]=e[4]*r,t[5]=e[5]*r,t[6]=e[6]*r,t[7]=e[7]*r,t[8]=e[8]*r,t[9]=e[9]*r,t[10]=e[10]*r,t[11]=e[11]*r,t[12]=e[12]*r,t[13]=e[13]*r,t[14]=e[14]*r,t[15]=e[15]*r,t}function lc(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t[2]=e[2]+r[2]*n,t[3]=e[3]+r[3]*n,t[4]=e[4]+r[4]*n,t[5]=e[5]+r[5]*n,t[6]=e[6]+r[6]*n,t[7]=e[7]+r[7]*n,t[8]=e[8]+r[8]*n,t[9]=e[9]+r[9]*n,t[10]=e[10]+r[10]*n,t[11]=e[11]+r[11]*n,t[12]=e[12]+r[12]*n,t[13]=e[13]+r[13]*n,t[14]=e[14]+r[14]*n,t[15]=e[15]+r[15]*n,t}function uc(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]&&t[9]===e[9]&&t[10]===e[10]&&t[11]===e[11]&&t[12]===e[12]&&t[13]===e[13]&&t[14]===e[14]&&t[15]===e[15]}function fc(t,e){var r=t[0],n=t[1],i=t[2],a=t[3],o=t[4],s=t[5],c=t[6],l=t[7],u=t[8],f=t[9],h=t[10],v=t[11],p=t[12],y=t[13],d=t[14],m=t[15],E=e[0],M=e[1],P=e[2],x=e[3],g=e[4],T=e[5],w=e[6],b=e[7],C=e[8],S=e[9],N=e[10],O=e[11],k=e[12],B=e[13],Y=e[14],I=e[15];return Math.abs(r-E)<=it*Math.max(1,Math.abs(r),Math.abs(E))&&Math.abs(n-M)<=it*Math.max(1,Math.abs(n),Math.abs(M))&&Math.abs(i-P)<=it*Math.max(1,Math.abs(i),Math.abs(P))&&Math.abs(a-x)<=it*Math.max(1,Math.abs(a),Math.abs(x))&&Math.abs(o-g)<=it*Math.max(1,Math.abs(o),Math.abs(g))&&Math.abs(s-T)<=it*Math.max(1,Math.abs(s),Math.abs(T))&&Math.abs(c-w)<=it*Math.max(1,Math.abs(c),Math.abs(w))&&Math.abs(l-b)<=it*Math.max(1,Math.abs(l),Math.abs(b))&&Math.abs(u-C)<=it*Math.max(1,Math.abs(u),Math.abs(C))&&Math.abs(f-S)<=it*Math.max(1,Math.abs(f),Math.abs(S))&&Math.abs(h-N)<=it*Math.max(1,Math.abs(h),Math.abs(N))&&Math.abs(v-O)<=it*Math.max(1,Math.abs(v),Math.abs(O))&&Math.abs(p-k)<=it*Math.max(1,Math.abs(p),Math.abs(k))&&Math.abs(y-B)<=it*Math.max(1,Math.abs(y),Math.abs(B))&&Math.abs(d-Y)<=it*Math.max(1,Math.abs(d),Math.abs(Y))&&Math.abs(m-I)<=it*Math.max(1,Math.abs(m),Math.abs(I))}var hc=Et,vc=uo;const dc=Object.freeze(Object.defineProperty({__proto__:null,add:sc,adjoint:Xs,clone:Ws,copy:Ke,create:nt,determinant:Ja,equals:fc,exactEquals:uc,frob:oc,fromQuat:io,fromQuat2:Js,fromRotation:$s,fromRotationTranslation:no,fromRotationTranslationScale:js,fromRotationTranslationScaleOrigin:cr,fromScaling:ro,fromTranslation:eo,fromValues:zs,fromXRotation:Ks,fromYRotation:Zs,fromZRotation:Qs,frustum:tc,getRotation:an,getScaling:Ze,getTranslation:nn,identity:Er,invert:jt,lookAt:lo,mul:hc,multiply:Et,multiplyScalar:cc,multiplyScalarAndAdd:lc,ortho:so,orthoNO:oo,orthoZO:co,perspective:ec,perspectiveFromFieldOfView:nc,perspectiveNO:ao,perspectiveZO:rc,rotate:Vs,rotateX:ja,rotateY:to,rotateZ:qs,scale:rn,set:qn,str:ac,sub:vc,subtract:uo,targetTo:ic,translate:ze,transpose:Qa},Symbol.toStringTag,{value:"Module"}));function q(){var t=new ft(3);return ft!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function pc(t){var e=new ft(3);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function se(t){var e=t[0],r=t[1],n=t[2];return Math.hypot(e,r,n)}function j(t,e,r){var n=new ft(3);return n[0]=t,n[1]=e,n[2]=r,n}function pe(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function qt(t,e,r,n){return t[0]=e,t[1]=r,t[2]=n,t}function $n(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t}function Hi(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t}function yc(t,e,r){return t[0]=e[0]*r[0],t[1]=e[1]*r[1],t[2]=e[2]*r[2],t}function gc(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t}function Oe(t,e){var r=e[0],n=e[1],i=e[2],a=r*r+n*n+i*i;return a>0&&(a=1/Math.sqrt(a)),t[0]=e[0]*a,t[1]=e[1]*a,t[2]=e[2]*a,t}function te(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function Jr(t,e,r){var n=e[0],i=e[1],a=e[2],o=r[0],s=r[1],c=r[2];return t[0]=i*c-a*s,t[1]=a*o-n*c,t[2]=n*s-i*o,t}function mc(t,e,r,n){var i=e[0],a=e[1],o=e[2];return t[0]=i+n*(r[0]-i),t[1]=a+n*(r[1]-a),t[2]=o+n*(r[2]-o),t}function Ut(t,e,r){var n=e[0],i=e[1],a=e[2],o=r[3]*n+r[7]*i+r[11]*a+r[15];return o=o||1,t[0]=(r[0]*n+r[4]*i+r[8]*a+r[12])/o,t[1]=(r[1]*n+r[5]*i+r[9]*a+r[13])/o,t[2]=(r[2]*n+r[6]*i+r[10]*a+r[14])/o,t}function xc(t,e,r){var n=e[0],i=e[1],a=e[2];return t[0]=n*r[0]+i*r[3]+a*r[6],t[1]=n*r[1]+i*r[4]+a*r[7],t[2]=n*r[2]+i*r[5]+a*r[8],t}function Ec(t,e,r){var n=r[0],i=r[1],a=r[2],o=r[3],s=e[0],c=e[1],l=e[2],u=i*l-a*c,f=a*s-n*l,h=n*c-i*s,v=i*h-a*f,p=a*u-n*h,y=n*f-i*u,d=o*2;return u*=d,f*=d,h*=d,v*=2,p*=2,y*=2,t[0]=s+u+v,t[1]=c+f+p,t[2]=l+h+y,t}function je(t,e){var r=t[0],n=t[1],i=t[2],a=e[0],o=e[1],s=e[2];return Math.abs(r-a)<=it*Math.max(1,Math.abs(r),Math.abs(a))&&Math.abs(n-o)<=it*Math.max(1,Math.abs(n),Math.abs(o))&&Math.abs(i-s)<=it*Math.max(1,Math.abs(i),Math.abs(s))}var fo=se;(function(){var t=q();return function(e,r,n,i,a,o){var s,c;for(r||(r=3),n||(n=0),i?c=Math.min(i*r+n,e.length):c=e.length,s=n;s0&&(o=1/Math.sqrt(o)),t[0]=r*o,t[1]=n*o,t[2]=i*o,t[3]=a*o,t}function nr(t,e,r){var n=e[0],i=e[1],a=e[2],o=e[3];return t[0]=r[0]*n+r[4]*i+r[8]*a+r[12]*o,t[1]=r[1]*n+r[5]*i+r[9]*a+r[13]*o,t[2]=r[2]*n+r[6]*i+r[10]*a+r[14]*o,t[3]=r[3]*n+r[7]*i+r[11]*a+r[15]*o,t}(function(){var t=He();return function(e,r,n,i,a,o){var s,c;for(r||(r=4),n||(n=0),i?c=Math.min(i*r+n,e.length):c=e.length,s=n;sit?(h=Math.acos(v),p=Math.sin(h),y=Math.sin((1-n)*h)/p,d=Math.sin(n*h)/p):(y=1-n,d=n),t[0]=y*i+d*c,t[1]=y*a+d*l,t[2]=y*o+d*u,t[3]=y*s+d*f,t}function Cn(t,e){var r=e[0],n=e[1],i=e[2],a=e[3],o=r*r+n*n+i*i+a*a,s=o?1/o:0;return t[0]=-r*s,t[1]=-n*s,t[2]=-i*s,t[3]=a*s,t}function wc(t,e){var r=e[0]+e[4]+e[8],n;if(r>0)n=Math.sqrt(r+1),t[3]=.5*n,n=.5/n,t[0]=(e[5]-e[7])*n,t[1]=(e[6]-e[2])*n,t[2]=(e[1]-e[3])*n;else{var i=0;e[4]>e[0]&&(i=1),e[8]>e[i*3+i]&&(i=2);var a=(i+1)%3,o=(i+2)%3;n=Math.sqrt(e[i*3+i]-e[a*3+a]-e[o*3+o]+1),t[i]=.5*n,n=.5/n,t[3]=(e[a*3+o]-e[o*3+a])*n,t[a]=(e[a*3+i]+e[i*3+a])*n,t[o]=(e[o*3+i]+e[i*3+o])*n}return t}function Ar(t,e,r,n){var i=.5*Math.PI/180;e*=i,r*=i,n*=i;var a=Math.sin(e),o=Math.cos(e),s=Math.sin(r),c=Math.cos(r),l=Math.sin(n),u=Math.cos(n);return t[0]=a*c*u-o*s*l,t[1]=o*s*u+a*c*l,t[2]=o*c*l-a*s*u,t[3]=o*c*u+a*s*l,t}var Sn=Mc,Or=Pc,Wi=Xe,on=Tc;(function(){var t=q(),e=j(1,0,0),r=j(0,1,0);return function(n,i,a){var o=te(i,a);return o<-.999999?(Jr(t,e,i),fo(t)<1e-6&&Jr(t,r,i),Oe(t,t),ir(n,t,Math.PI),n):o>.999999?(n[0]=0,n[1]=0,n[2]=0,n[3]=1,n):(Jr(t,i,a),n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=1+o,on(n,n))}})();(function(){var t=gt(),e=gt();return function(r,n,i,a,o,s){return bn(t,n,o,s),bn(e,i,a,s),bn(r,t,e,2*s*(1-s)),r}})();(function(){var t=Za();return function(e,r,n,i){return t[0]=n[0],t[3]=n[1],t[6]=n[2],t[1]=i[0],t[4]=i[1],t[7]=i[2],t[2]=-r[0],t[5]=-r[1],t[8]=-r[2],on(e,wc(e,t))}})();function bc(){var t=new ft(2);return ft!=Float32Array&&(t[0]=0,t[1]=0),t}function Cc(t,e){var r=new ft(2);return r[0]=t,r[1]=e,r}function Sc(t,e){return t[0]=e[0],t[1]=e[1],t}function Nc(t,e){var r=e[0],n=e[1],i=r*r+n*n;return i>0&&(i=1/Math.sqrt(i)),t[0]=e[0]*i,t[1]=e[1]*i,t}function Rc(t,e){return t[0]*e[0]+t[1]*e[1]}function Ac(t,e){return t[0]===e[0]&&t[1]===e[1]}(function(){var t=bc();return function(e,r,n,i,a,o){var s,c;for(r||(r=2),n||(n=0),i?c=Math.min(i*r+n,e.length):c=e.length,s=n;sr?r:t};const kt=Lc;var _c=function(t){return pn(t,"Number")};const ie=_c;var Dc=1e-5;function lr(t,e,r){return r===void 0&&(r=Dc),Math.abs(t-e)7){t[r].shift();for(var n=t[r],i=r;n.length;)e[r]="A",t.splice(i+=1,0,["C"].concat(n.splice(0,6)));t.splice(r,1)}}var ur={a:7,c:6,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,z:0};function po(t){return Array.isArray(t)&&t.every(function(e){var r=e[0].toLowerCase();return ur[r]===e.length-1&&"achlmqstvz".includes(r)})}function yo(t){return po(t)&&t.every(function(e){var r=e[0];return r===r.toUpperCase()})}function go(t){return yo(t)&&t.every(function(e){var r=e[0];return"ACLMQZ".includes(r)})}function qi(t){for(var e=t.pathValue[t.segmentStart],r=e.toLowerCase(),n=t.data;n.length>=ur[r]&&(r==="m"&&n.length>2?(t.segments.push([e].concat(n.splice(0,2))),r="l",e=e==="m"?"l":"L"):t.segments.push([e].concat(n.splice(0,ur[r]))),!!ur[r]););}function Yc(t){var e=t.index,r=t.pathValue,n=r.charCodeAt(e);if(n===48){t.param=0,t.index+=1;return}if(n===49){t.param=1,t.index+=1;return}t.err='[path-util]: invalid Arc flag "'+r[e]+'", expecting 0 or 1 at index '+e}function Hc(t){return t>=48&&t<=57||t===43||t===45||t===46}function Fe(t){return t>=48&&t<=57}function Wc(t){var e=t.max,r=t.pathValue,n=t.index,i=n,a=!1,o=!1,s=!1,c=!1,l;if(i>=e){t.err="[path-util]: Invalid path value at index "+i+', "pathValue" is missing param';return}if(l=r.charCodeAt(i),(l===43||l===45)&&(i+=1,l=r.charCodeAt(i)),!Fe(l)&&l!==46){t.err="[path-util]: Invalid path value at index "+i+', "'+r[i]+'" is not a number';return}if(l!==46){if(a=l===48,i+=1,l=r.charCodeAt(i),a&&i=5760&&e.includes(t)}function tn(t){for(var e=t.pathValue,r=t.max;t.index0;o-=1){if(Vc(i)&&(o===3||o===4)?Yc(t):Wc(t),t.err.length)return;t.data.push(t.param),tn(t),t.index=t.max||!Hc(r.charCodeAt(t.index)))break}qi(t)}var $c=function(){function t(e){this.pathValue=e,this.segments=[],this.max=e.length,this.index=0,this.param=0,this.segmentStart=0,this.data=[],this.err=""}return t}();function Kc(t){if(po(t))return[].concat(t);var e=new $c(t);for(tn(e);e.index1&&(C=Math.sqrt(C),h*=C,v*=C);var S=h*h,N=v*v,O=(a===o?-1:1)*Math.sqrt(Math.abs((S*N-S*b*b-N*w*w)/(S*b*b+N*w*w)));g=O*h*b/v+(u+p)/2,T=O*-v*w/h+(f+y)/2,P=Math.asin(((f-T)/v*Math.pow(10,9)>>0)/Math.pow(10,9)),x=Math.asin(((y-T)/v*Math.pow(10,9)>>0)/Math.pow(10,9)),P=ux&&(P-=Math.PI*2),!o&&x>P&&(x-=Math.PI*2)}var k=x-P;if(Math.abs(k)>d){var B=x,Y=p,I=y;x=P+d*(o&&x>P?1:-1),p=g+h*Math.cos(x),y=T+v*Math.sin(x),E=Pi(p,y,h,v,i,0,o,Y,I,[x,B,g,T])}k=x-P;var G=Math.cos(P),H=Math.sin(P),lt=Math.cos(x),rt=Math.sin(x),St=Math.tan(k/4),Ht=4/3*h*St,$t=4/3*v*St,Kt=[u,f],Wt=[u+Ht*H,f-$t*G],wr=[p+Ht*rt,y-$t*lt],br=[p,y];if(Wt[0]=2*Kt[0]-Wt[0],Wt[1]=2*Kt[1]-Wt[1],l)return Wt.concat(wr,br,E);E=Wt.concat(wr,br,E);for(var Cr=[],zt=0,Sr=E.length;zt=a)o={x:r,y:n};else{var s=he([t,e],[r,n],i/a),c=s[0],l=s[1];o={x:c,y:l}}return{length:a,point:o,min:{x:Math.min(t,r),y:Math.min(e,n)},max:{x:Math.max(t,r),y:Math.max(e,n)}}}function Ki(t,e){var r=t.x,n=t.y,i=e.x,a=e.y,o=r*i+n*a,s=Math.sqrt((Math.pow(r,2)+Math.pow(n,2))*(Math.pow(i,2)+Math.pow(a,2))),c=r*a-n*i<0?-1:1,l=c*Math.acos(o/s);return l}function nl(t,e,r,n,i,a,o,s,c,l){var u=Math.abs,f=Math.sin,h=Math.cos,v=Math.sqrt,p=Math.PI,y=u(r),d=u(n),m=(i%360+360)%360,E=m*(p/180);if(t===s&&e===c)return{x:t,y:e};if(y===0||d===0)return Zn(t,e,s,c,l).point;var M=(t-s)/2,P=(e-c)/2,x={x:h(E)*M+f(E)*P,y:-f(E)*M+h(E)*P},g=Math.pow(x.x,2)/Math.pow(y,2)+Math.pow(x.y,2)/Math.pow(d,2);g>1&&(y*=v(g),d*=v(g));var T=Math.pow(y,2)*Math.pow(d,2)-Math.pow(y,2)*Math.pow(x.y,2)-Math.pow(d,2)*Math.pow(x.x,2),w=Math.pow(y,2)*Math.pow(x.y,2)+Math.pow(d,2)*Math.pow(x.x,2),b=T/w;b=b<0?0:b;var C=(a!==o?1:-1)*v(b),S={x:C*(y*x.y/d),y:C*(-(d*x.x)/y)},N={x:h(E)*S.x-f(E)*S.y+(t+s)/2,y:f(E)*S.x+h(E)*S.y+(e+c)/2},O={x:(x.x-S.x)/y,y:(x.y-S.y)/d},k=Ki({x:1,y:0},O),B={x:(-x.x-S.x)/y,y:(-x.y-S.y)/d},Y=Ki(O,B);!o&&Y>0?Y-=2*p:o&&Y<0&&(Y+=2*p),Y%=2*p;var I=k+Y*l,G=y*h(I),H=d*f(I),lt={x:h(E)*G-f(E)*H+N.x,y:f(E)*G+h(E)*H+N.y};return lt}function il(t,e,r,n,i,a,o,s,c,l,u){var f,h=u.bbox,v=h===void 0?!0:h,p=u.length,y=p===void 0?!0:p,d=u.sampleSize,m=d===void 0?30:d,E=typeof l=="number",M=t,P=e,x=0,g=[M,P,x],T=[M,P],w=0,b={x:0,y:0},C=[{x:M,y:P}];E&&l<=0&&(b={x:M,y:P});for(var S=0;S<=m;S+=1){if(w=S/m,f=nl(t,e,r,n,i,a,o,s,c,w),M=f.x,P=f.y,v&&C.push({x:M,y:P}),y&&(x+=Rt(T,[M,P])),T=[M,P],E&&x>=l&&l>g[2]){var N=(x-l)/(x-g[2]);b={x:T[0]*(1-N)+g[0]*N,y:T[1]*(1-N)+g[1]*N}}g=[M,P,x]}return E&&l>=x&&(b={x:s,y:c}),{length:x,point:b,min:{x:Math.min.apply(null,C.map(function(O){return O.x})),y:Math.min.apply(null,C.map(function(O){return O.y}))},max:{x:Math.max.apply(null,C.map(function(O){return O.x})),y:Math.max.apply(null,C.map(function(O){return O.y}))}}}function al(t,e,r,n,i,a,o,s,c){var l=1-c;return{x:Math.pow(l,3)*t+3*Math.pow(l,2)*c*r+3*l*Math.pow(c,2)*i+Math.pow(c,3)*o,y:Math.pow(l,3)*e+3*Math.pow(l,2)*c*n+3*l*Math.pow(c,2)*a+Math.pow(c,3)*s}}function mo(t,e,r,n,i,a,o,s,c,l){var u,f=l.bbox,h=f===void 0?!0:f,v=l.length,p=v===void 0?!0:v,y=l.sampleSize,d=y===void 0?10:y,m=typeof c=="number",E=t,M=e,P=0,x=[E,M,P],g=[E,M],T=0,w={x:0,y:0},b=[{x:E,y:M}];m&&c<=0&&(w={x:E,y:M});for(var C=0;C<=d;C+=1){if(T=C/d,u=al(t,e,r,n,i,a,o,s,T),E=u.x,M=u.y,h&&b.push({x:E,y:M}),p&&(P+=Rt(g,[E,M])),g=[E,M],m&&P>=c&&c>x[2]){var S=(P-c)/(P-x[2]);w={x:g[0]*(1-S)+x[0]*S,y:g[1]*(1-S)+x[1]*S}}x=[E,M,P]}return m&&c>=P&&(w={x:o,y:s}),{length:P,point:w,min:{x:Math.min.apply(null,b.map(function(N){return N.x})),y:Math.min.apply(null,b.map(function(N){return N.y}))},max:{x:Math.max.apply(null,b.map(function(N){return N.x})),y:Math.max.apply(null,b.map(function(N){return N.y}))}}}function ol(t,e,r,n,i,a,o){var s=1-o;return{x:Math.pow(s,2)*t+2*s*o*r+Math.pow(o,2)*i,y:Math.pow(s,2)*e+2*s*o*n+Math.pow(o,2)*a}}function sl(t,e,r,n,i,a,o,s){var c,l=s.bbox,u=l===void 0?!0:l,f=s.length,h=f===void 0?!0:f,v=s.sampleSize,p=v===void 0?10:v,y=typeof o=="number",d=t,m=e,E=0,M=[d,m,E],P=[d,m],x=0,g={x:0,y:0},T=[{x:d,y:m}];y&&o<=0&&(g={x:d,y:m});for(var w=0;w<=p;w+=1){if(x=w/p,c=ol(t,e,r,n,i,a,x),d=c.x,m=c.y,u&&T.push({x:d,y:m}),h&&(E+=Rt(P,[d,m])),P=[d,m],y&&E>=o&&o>M[2]){var b=(E-o)/(E-M[2]);g={x:P[0]*(1-b)+M[0]*b,y:P[1]*(1-b)+M[1]*b}}M=[d,m,E]}return y&&o>=E&&(g={x:i,y:a}),{length:E,point:g,min:{x:Math.min.apply(null,T.map(function(C){return C.x})),y:Math.min.apply(null,T.map(function(C){return C.y}))},max:{x:Math.max.apply(null,T.map(function(C){return C.x})),y:Math.max.apply(null,T.map(function(C){return C.y}))}}}function xo(t,e,r){for(var n,i,a,o,s,c,l=sn(t),u=typeof e=="number",f,h=[],v,p=0,y=0,d=0,m=0,E,M=[],P=[],x=0,g={x:0,y:0},T=g,w=g,b=g,C=0,S=0,N=l.length;S=e&&(b=w),P.push(T),M.push(g),C+=x,c=v!=="Z"?E.slice(-2):[d,m],p=c[0],y=c[1];return u&&e>=C&&(b={x:p,y}),{length:C,point:b,min:{x:Math.min.apply(null,M.map(function(O){return O.x})),y:Math.min.apply(null,M.map(function(O){return O.y}))},max:{x:Math.max.apply(null,P.map(function(O){return O.x})),y:Math.max.apply(null,P.map(function(O){return O.y}))}}}function cl(t,e){return xo(t,void 0,U(U({},e),{bbox:!1,length:!0})).length}function ll(t){var e=t.length,r=e-1;return t.map(function(n,i){return t.map(function(a,o){var s=i+o,c;return o===0||t[s]&&t[s][0]==="M"?(c=t[s],["M"].concat(c.slice(-2))):(s>=e&&(s-=r),t[s])})})}function ul(t,e){var r=t.length-1,n=[],i=0,a=0,o=ll(t);return o.forEach(function(s,c){t.slice(1).forEach(function(l,u){a+=Rt(t[(c+u)%r].slice(-2),e[u%r].slice(-2))}),n[c]=a,a=0}),i=n.indexOf(Math.min.apply(null,n)),o[i]}function fl(t,e,r,n,i,a,o,s){return 3*((s-e)*(r+i)-(o-t)*(n+a)+n*(t-i)-r*(e-a)+s*(i+t/3)-o*(a+e/3))/20}function hl(t){var e=0,r=0,n=0;return Kn(t).map(function(i){var a;switch(i[0]){case"M":return e=i[1],r=i[2],0;default:var o=i.slice(1),s=o[0],c=o[1],l=o[2],u=o[3],f=o[4],h=o[5];return n=fl(e,r,s,c,l,u,f,h),a=i.slice(-2),e=a[0],r=a[1],n}}).reduce(function(i,a){return i+a},0)}function Zi(t){return hl(t)>=0}function vl(t,e,r){return xo(t,e,U(U({},r),{bbox:!1,length:!0})).point}function dl(t,e){e===void 0&&(e=.5);var r=t.slice(0,2),n=t.slice(2,4),i=t.slice(4,6),a=t.slice(6,8),o=he(r,n,e),s=he(n,i,e),c=he(i,a,e),l=he(o,s,e),u=he(s,c,e),f=he(l,u,e);return[["C"].concat(o,l,f),["C"].concat(u,c,a)]}function Qi(t){return t.map(function(e,r,n){var i=r&&n[r-1].slice(-2).concat(e.slice(1)),a=r?mo(i[0],i[1],i[2],i[3],i[4],i[5],i[6],i[7],i[8],{bbox:!1}).length:0,o;return r?o=a?dl(i):[e,e]:o=[e],{s:e,ss:o,l:a}})}function Eo(t,e,r){var n=Qi(t),i=Qi(e),a=n.length,o=i.length,s=n.filter(function(d){return d.l}).length,c=i.filter(function(d){return d.l}).length,l=n.filter(function(d){return d.l}).reduce(function(d,m){var E=m.l;return d+E},0)/s||0,u=i.filter(function(d){return d.l}).reduce(function(d,m){var E=m.l;return d+E},0)/c||0,f=r||Math.max(a,o),h=[l,u],v=[f-a,f-o],p=0,y=[n,i].map(function(d,m){return d.l===f?d.map(function(E){return E.s}):d.map(function(E,M){return p=M&&v[m]&&E.l>=h[m],v[m]-=p?1:0,p?E.ss:[E.s]}).flat()});return y[0].length===y[1].length?y:Eo(y[0],y[1],f)}function Ti(t,e,r){t.prototype=e.prototype=r,r.constructor=t}function Mo(t,e){var r=Object.create(t.prototype);for(var n in e)r[n]=e[n];return r}function Mr(){}var vr=.7,cn=1/vr,Ve="\\s*([+-]?\\d+)\\s*",dr="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",re="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",pl=/^#([0-9a-f]{3,8})$/,yl=new RegExp("^rgb\\("+[Ve,Ve,Ve]+"\\)$"),gl=new RegExp("^rgb\\("+[re,re,re]+"\\)$"),ml=new RegExp("^rgba\\("+[Ve,Ve,Ve,dr]+"\\)$"),xl=new RegExp("^rgba\\("+[re,re,re,dr]+"\\)$"),El=new RegExp("^hsl\\("+[dr,re,re]+"\\)$"),Ml=new RegExp("^hsla\\("+[dr,re,re,dr]+"\\)$"),Ji={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Ti(Mr,yn,{copy:function(t){return Object.assign(new this.constructor,this,t)},displayable:function(){return this.rgb().displayable()},hex:ji,formatHex:ji,formatHsl:Pl,formatRgb:ta,toString:ta});function ji(){return this.rgb().formatHex()}function Pl(){return Po(this).formatHsl()}function ta(){return this.rgb().formatRgb()}function yn(t){var e,r;return t=(t+"").trim().toLowerCase(),(e=pl.exec(t))?(r=e[1].length,e=parseInt(e[1],16),r===6?ea(e):r===3?new It(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):r===8?Ir(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):r===4?Ir(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=yl.exec(t))?new It(e[1],e[2],e[3],1):(e=gl.exec(t))?new It(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=ml.exec(t))?Ir(e[1],e[2],e[3],e[4]):(e=xl.exec(t))?Ir(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=El.exec(t))?ia(e[1],e[2]/100,e[3]/100,1):(e=Ml.exec(t))?ia(e[1],e[2]/100,e[3]/100,e[4]):Ji.hasOwnProperty(t)?ea(Ji[t]):t==="transparent"?new It(NaN,NaN,NaN,0):null}function ea(t){return new It(t>>16&255,t>>8&255,t&255,1)}function Ir(t,e,r,n){return n<=0&&(t=e=r=NaN),new It(t,e,r,n)}function Tl(t){return t instanceof Mr||(t=yn(t)),t?(t=t.rgb(),new It(t.r,t.g,t.b,t.opacity)):new It}function wl(t,e,r,n){return arguments.length===1?Tl(t):new It(t,e,r,n??1)}function It(t,e,r,n){this.r=+t,this.g=+e,this.b=+r,this.opacity=+n}Ti(It,wl,Mo(Mr,{brighter:function(t){return t=t==null?cn:Math.pow(cn,t),new It(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=t==null?vr:Math.pow(vr,t),new It(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:ra,formatHex:ra,formatRgb:na,toString:na}));function ra(){return"#"+Nn(this.r)+Nn(this.g)+Nn(this.b)}function na(){var t=this.opacity;return t=isNaN(t)?1:Math.max(0,Math.min(1,t)),(t===1?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(t===1?")":", "+t+")")}function Nn(t){return t=Math.max(0,Math.min(255,Math.round(t)||0)),(t<16?"0":"")+t.toString(16)}function ia(t,e,r,n){return n<=0?t=e=r=NaN:r<=0||r>=1?t=e=NaN:e<=0&&(t=NaN),new Jt(t,e,r,n)}function Po(t){if(t instanceof Jt)return new Jt(t.h,t.s,t.l,t.opacity);if(t instanceof Mr||(t=yn(t)),!t)return new Jt;if(t instanceof Jt)return t;t=t.rgb();var e=t.r/255,r=t.g/255,n=t.b/255,i=Math.min(e,r,n),a=Math.max(e,r,n),o=NaN,s=a-i,c=(a+i)/2;return s?(e===a?o=(r-n)/s+(r0&&c<1?0:o,new Jt(o,s,c,t.opacity)}function bl(t,e,r,n){return arguments.length===1?Po(t):new Jt(t,e,r,n??1)}function Jt(t,e,r,n){this.h=+t,this.s=+e,this.l=+r,this.opacity=+n}Ti(Jt,bl,Mo(Mr,{brighter:function(t){return t=t==null?cn:Math.pow(cn,t),new Jt(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=t==null?vr:Math.pow(vr,t),new Jt(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*e,i=2*r-n;return new It(Rn(t>=240?t-240:t+120,i,n),Rn(t,i,n),Rn(t<120?t+240:t-120,i,n),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl:function(){var t=this.opacity;return t=isNaN(t)?1:Math.max(0,Math.min(1,t)),(t===1?"hsl(":"hsla(")+(this.h||0)+", "+(this.s||0)*100+"%, "+(this.l||0)*100+"%"+(t===1?")":", "+t+")")}}));function Rn(t,e,r){return(t<60?e+(r-e)*t/60:t<180?r:t<240?e+(r-e)*(240-t)/60:e)*255}function le(t,e,r,n){var i=t-r,a=e-n;return Math.sqrt(i*i+a*a)}function To(t,e){var r=Math.min.apply(Math,X([],_(t),!1)),n=Math.min.apply(Math,X([],_(e),!1)),i=Math.max.apply(Math,X([],_(t),!1)),a=Math.max.apply(Math,X([],_(e),!1));return{x:r,y:n,width:i-r,height:a-n}}function Cl(t,e,r){return Math.atan(-e/t*Math.tan(r))}function Sl(t,e,r){return Math.atan(e/(t*Math.tan(r)))}function Nl(t,e,r,n,i,a){return r*Math.cos(i)*Math.cos(a)-n*Math.sin(i)*Math.sin(a)+t}function Rl(t,e,r,n,i,a){return r*Math.sin(i)*Math.cos(a)+n*Math.cos(i)*Math.sin(a)+e}function Al(t,e,r,n,i,a,o){for(var s=Cl(r,n,i),c=1/0,l=-1/0,u=[a,o],f=-Math.PI*2;f<=Math.PI*2;f+=Math.PI){var h=s+f;al&&(l=v)}for(var p=Sl(r,n,i),y=1/0,d=-1/0,m=[a,o],f=-Math.PI*2;f<=Math.PI*2;f+=Math.PI){var E=p+f;ad&&(d=M)}return{x:c,y,width:l-c,height:d-y}}var Ol=1e-4;function wo(t,e,r,n,i,a){var o=-1,s=1/0,c=[r,n],l=20;a&&a>200&&(l=a/10);for(var u=1/l,f=u/10,h=0;h<=l;h++){var v=h*u,p=[i.apply(void 0,X([],_(t.concat([v])),!1)),i.apply(void 0,X([],_(e.concat([v])),!1))],y=le(c[0],c[1],p[0],p[1]);y=0&&y=0&&c<=1&&s.push(c));else{var f=a*a-4*i*o;lr(f,0)?s.push(-a/(2*i)):f>0&&(u=Math.sqrt(f),c=(-a+u)/(2*i),l=(-a-u)/(2*i),c>=0&&c<=1&&s.push(c),l>=0&&l<=1&&s.push(l))}return s}function Il(t,e,r,n,i,a,o,s){for(var c=[t,o],l=[e,s],u=aa(t,r,i,o),f=aa(e,n,a,s),h=0;h=0?[i]:[]}function Fl(t,e,r,n,i,a){var o=sa(t,r,i)[0],s=sa(e,n,a)[0],c=[t,i],l=[e,a];return o!==void 0&&c.push(Jn(t,r,i,o)),s!==void 0&&l.push(Jn(e,n,a,s)),To(c,l)}function Bl(t,e,r,n,i,a,o,s){return wo([t,r,i],[e,n,a],o,s,Jn)}function Gl(t,e,r,n,i,a,o,s){var c=Bl(t,e,r,n,i,a,o,s);return le(c.x,c.y,o,s)}var Ul=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Yl(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var So={exports:{}};(function(t,e){(function(r,n){t.exports=n()})(Ul,function(){function r(x,g,T,w,b){n(x,g,T||0,w||x.length-1,b||a)}function n(x,g,T,w,b){for(;w>T;){if(w-T>600){var C=w-T+1,S=g-T+1,N=Math.log(C),O=.5*Math.exp(2*N/3),k=.5*Math.sqrt(N*O*(C-O)/C)*(S-C/2<0?-1:1),B=Math.max(T,Math.floor(g-S*O/C+k)),Y=Math.min(w,Math.floor(g+(C-S)*O/C+k));n(x,g,B,Y,b)}var I=x[g],G=T,H=w;for(i(x,T,g),b(x[w],I)>0&&i(x,T,w);G0;)H--}b(x[T],I)===0?i(x,T,H):(H++,i(x,H,w)),H<=g&&(T=H+1),g<=H&&(w=H-1)}}function i(x,g,T){var w=x[g];x[g]=x[T],x[T]=w}function a(x,g){return xg?1:0}var o=function(g){g===void 0&&(g=9),this._maxEntries=Math.max(4,g),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()};o.prototype.all=function(){return this._all(this.data,[])},o.prototype.search=function(g){var T=this.data,w=[];if(!E(g,T))return w;for(var b=this.toBBox,C=[];T;){for(var S=0;S=0&&C[T].children.length>this._maxEntries;)this._split(C,T),T--;this._adjustParentBBoxes(b,C,T)},o.prototype._split=function(g,T){var w=g[T],b=w.children.length,C=this._minEntries;this._chooseSplitAxis(w,C,b);var S=this._chooseSplitIndex(w,C,b),N=M(w.children.splice(S,w.children.length-S));N.height=w.height,N.leaf=w.leaf,c(w,this.toBBox),c(N,this.toBBox),T?g[T-1].children.push(N):this._splitRoot(w,N)},o.prototype._splitRoot=function(g,T){this.data=M([g,T]),this.data.height=g.height+1,this.data.leaf=!1,c(this.data,this.toBBox)},o.prototype._chooseSplitIndex=function(g,T,w){for(var b,C=1/0,S=1/0,N=T;N<=w-T;N++){var O=l(g,0,N,this.toBBox),k=l(g,N,w,this.toBBox),B=d(O,k),Y=v(O)+v(k);B=T;Y--){var I=g.children[Y];u(N,g.leaf?C(I):I),O+=p(N)}return O},o.prototype._adjustParentBBoxes=function(g,T,w){for(var b=w;b>=0;b--)u(T[b],g)},o.prototype._condense=function(g){for(var T=g.length-1,w=void 0;T>=0;T--)g[T].children.length===0?T>0?(w=g[T-1].children,w.splice(w.indexOf(g[T]),1)):this.clear():c(g[T],this.toBBox)};function s(x,g,T){if(!T)return g.indexOf(x);for(var w=0;w=x.minX&&g.maxY>=x.minY}function M(x){return{children:x,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function P(x,g,T,w,b){for(var C=[g,T];C.length;)if(T=C.pop(),g=C.pop(),!(T-g<=w)){var S=g+Math.ceil((T-g)/w/2)*w;r(x,S,g,T,b),C.push(g,S,S,T)}}return o})})(So);var Hl=So.exports,Wl=Yl(Hl),R;(function(t){t.GROUP="g",t.CIRCLE="circle",t.ELLIPSE="ellipse",t.IMAGE="image",t.RECT="rect",t.LINE="line",t.POLYLINE="polyline",t.POLYGON="polygon",t.TEXT="text",t.PATH="path",t.HTML="html",t.MESH="mesh"})(R||(R={}));var qe;(function(t){t[t.ZERO=0]="ZERO",t[t.NEGATIVE_ONE=1]="NEGATIVE_ONE"})(qe||(qe={}));var Le=function(){function t(){this.plugins=[]}return t.prototype.addRenderingPlugin=function(e){this.plugins.push(e),this.context.renderingPlugins.push(e)},t.prototype.removeAllRenderingPlugins=function(){var e=this;this.plugins.forEach(function(r){var n=e.context.renderingPlugins.indexOf(r);n>=0&&e.context.renderingPlugins.splice(n,1)})},t}(),zl=function(){function t(e){this.clipSpaceNearZ=qe.NEGATIVE_ONE,this.plugins=[],this.config=U({enableDirtyCheck:!0,enableCulling:!1,enableAutoRendering:!0,enableDirtyRectangleRendering:!0,enableDirtyRectangleRenderingDebug:!1},e)}return t.prototype.registerPlugin=function(e){var r=this.plugins.findIndex(function(n){return n===e});r===-1&&this.plugins.push(e)},t.prototype.unregisterPlugin=function(e){var r=this.plugins.findIndex(function(n){return n===e});r>-1&&this.plugins.splice(r,1)},t.prototype.getPlugins=function(){return this.plugins},t.prototype.getPlugin=function(e){return this.plugins.find(function(r){return r.name===e})},t.prototype.getConfig=function(){return this.config},t.prototype.setConfig=function(e){Object.assign(this.config,e)},t}();function Be(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function An(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t}function en(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t}function ca(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t}function Xl(t,e,r){return t[0]=Math.max(e[0],r[0]),t[1]=Math.max(e[1],r[1]),t[2]=Math.max(e[2],r[2]),t}function Vl(t,e,r){return t[0]=Math.min(e[0],r[0]),t[1]=Math.min(e[1],r[1]),t[2]=Math.min(e[2],r[2]),t}function On(t){return t===void 0?0:t>360||t<-360?t%360:t}function Tt(t,e,r){return e===void 0&&(e=0),r===void 0&&(r=0),Array.isArray(t)&&t.length===3?pc(t):ie(t)?j(t,e,r):j(t[0],t[1]||e,t[2]||r)}function ut(t){return t*(Math.PI/180)}function Gt(t){return t*(180/Math.PI)}function ql(t){return 360*t}function $l(t,e){var r=e[0],n=e[1],i=e[2],a=e[3],o=r*r,s=n*n,c=i*i,l=a*a,u=o+s+c+l,f=r*a-n*i;return f>.499995*u?(t[0]=Math.PI/2,t[1]=2*Math.atan2(n,r),t[2]=0):f<-.499995*u?(t[0]=-Math.PI/2,t[1]=2*Math.atan2(n,r),t[2]=0):(t[0]=Math.asin(2*(r*i-a*n)),t[1]=Math.atan2(2*(r*a+n*i),1-2*(c+l)),t[2]=Math.atan2(2*(r*n+i*a),1-2*(s+c))),t}function Kl(t,e){var r,n,i=Math.PI*.5,a=_(Ze(q(),e),3),o=a[0],s=a[1],c=a[2],l=Math.asin(-e[2]/o);return l-i?(r=Math.atan2(e[6]/s,e[10]/c),n=Math.atan2(e[1]/o,e[0]/o)):(n=0,r=-Math.atan2(e[4]/s,e[5]/s)):(n=0,r=Math.atan2(e[4]/s,e[5]/s)),t[0]=r,t[1]=l,t[2]=n,t}function kn(t,e){return e.length===16?Kl(t,e):$l(t,e)}function Zl(t,e,r,n,i){var a=Math.cos(t),o=Math.sin(t);return Hs(n*a,i*o,0,-n*o,i*a,0,e,r,1)}function Ql(t,e,r,n,i,a,o,s){s===void 0&&(s=!1);var c=2*a/(r-e),l=2*a/(n-i),u=(r+e)/(r-e),f=(n+i)/(n-i),h,v;return s?(h=-o/(o-a),v=-o*a/(o-a)):(h=-(o+a)/(o-a),v=-2*o*a/(o-a)),t[0]=c,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=l,t[6]=0,t[7]=0,t[8]=u,t[9]=f,t[10]=h,t[11]=-1,t[12]=0,t[13]=0,t[14]=v,t[15]=0,t}function la(t){var e=t[0],r=t[1],n=t[3],i=t[4],a=Math.sqrt(e*e+r*r),o=Math.sqrt(n*n+i*i),s=e*i-r*n;s<0&&(eW[1][2]&&(a[0]=-a[0]),W[0][2]>W[2][0]&&(a[1]=-a[1]),W[1][0]>W[0][1]&&(a[2]=-a[2]),!0}function jl(t,e){var r=e[15];if(r===0)return!1;for(var n=1/r,i=0;i<16;i++)t[i]=e[i]*n;return!0}function tu(t,e){t[0][0]=e[0],t[0][1]=e[1],t[0][2]=e[2],t[1][0]=e[4],t[1][1]=e[5],t[1][2]=e[6],t[2][0]=e[8],t[2][1]=e[9],t[2][2]=e[10]}function In(t,e,r,n,i){t[0]=e[0]*n+r[0]*i,t[1]=e[1]*n+r[1]*i,t[2]=e[2]*n+r[2]*i}var ht=function(){function t(){this.center=[0,0,0],this.halfExtents=[0,0,0],this.min=[0,0,0],this.max=[0,0,0]}return t.isEmpty=function(e){return!e||e.halfExtents[0]===0&&e.halfExtents[1]===0&&e.halfExtents[2]===0},t.prototype.update=function(e,r){Be(this.center,e),Be(this.halfExtents,r),An(this.min,this.center,this.halfExtents),en(this.max,this.center,this.halfExtents)},t.prototype.setMinMax=function(e,r){en(this.center,r,e),ca(this.center,this.center,.5),An(this.halfExtents,r,e),ca(this.halfExtents,this.halfExtents,.5),Be(this.min,e),Be(this.max,r)},t.prototype.getMin=function(){return this.min},t.prototype.getMax=function(){return this.max},t.prototype.add=function(e){if(!t.isEmpty(e)){if(t.isEmpty(this)){this.setMinMax(e.getMin(),e.getMax());return}var r=this.center,n=r[0],i=r[1],a=r[2],o=this.halfExtents,s=o[0],c=o[1],l=o[2],u=n-s,f=n+s,h=i-c,v=i+c,p=a-l,y=a+l,d=e.center,m=d[0],E=d[1],M=d[2],P=e.halfExtents,x=P[0],g=P[1],T=P[2],w=m-x,b=m+x,C=E-g,S=E+g,N=M-T,O=M+T;wf&&(f=b),Cv&&(v=S),Ny&&(y=O),r[0]=(u+f)*.5,r[1]=(h+v)*.5,r[2]=(p+y)*.5,o[0]=(f-u)*.5,o[1]=(v-h)*.5,o[2]=(y-p)*.5,this.min[0]=u,this.min[1]=h,this.min[2]=p,this.max[0]=f,this.max[1]=v,this.max[2]=y}},t.prototype.setFromTransformedAABB=function(e,r){var n=this.center,i=this.halfExtents,a=e.center,o=e.halfExtents,s=r[0],c=r[4],l=r[8],u=r[1],f=r[5],h=r[9],v=r[2],p=r[6],y=r[10],d=Math.abs(s),m=Math.abs(c),E=Math.abs(l),M=Math.abs(u),P=Math.abs(f),x=Math.abs(h),g=Math.abs(v),T=Math.abs(p),w=Math.abs(y);n[0]=r[12]+s*a[0]+c*a[1]+l*a[2],n[1]=r[13]+u*a[0]+f*a[1]+h*a[2],n[2]=r[14]+v*a[0]+p*a[1]+y*a[2],i[0]=d*o[0]+m*o[1]+E*o[2],i[1]=M*o[0]+P*o[1]+x*o[2],i[2]=g*o[0]+T*o[1]+w*o[2],An(this.min,n,i),en(this.max,n,i)},t.prototype.intersects=function(e){var r=this.getMax(),n=this.getMin(),i=e.getMax(),a=e.getMin();return n[0]<=i[0]&&r[0]>=a[0]&&n[1]<=i[1]&&r[1]>=a[1]&&n[2]<=i[2]&&r[2]>=a[2]},t.prototype.intersection=function(e){if(!this.intersects(e))return null;var r=new t,n=Xl([0,0,0],this.getMin(),e.getMin()),i=Vl([0,0,0],this.getMax(),e.getMax());return r.setMinMax(n,i),r},t.prototype.getNegativeFarPoint=function(e){return e.pnVertexFlag===273?Be([0,0,0],this.min):e.pnVertexFlag===272?[this.min[0],this.min[1],this.max[2]]:e.pnVertexFlag===257?[this.min[0],this.max[1],this.min[2]]:e.pnVertexFlag===256?[this.min[0],this.max[1],this.max[2]]:e.pnVertexFlag===17?[this.max[0],this.min[1],this.min[2]]:e.pnVertexFlag===16?[this.max[0],this.min[1],this.max[2]]:e.pnVertexFlag===1?[this.max[0],this.max[1],this.min[2]]:[this.max[0],this.max[1],this.max[2]]},t.prototype.getPositiveFarPoint=function(e){return e.pnVertexFlag===273?Be([0,0,0],this.max):e.pnVertexFlag===272?[this.max[0],this.max[1],this.min[2]]:e.pnVertexFlag===257?[this.max[0],this.min[1],this.max[2]]:e.pnVertexFlag===256?[this.max[0],this.min[1],this.min[2]]:e.pnVertexFlag===17?[this.min[0],this.max[1],this.max[2]]:e.pnVertexFlag===16?[this.min[0],this.max[1],this.min[2]]:e.pnVertexFlag===1?[this.min[0],this.min[1],this.max[2]]:[this.min[0],this.min[1],this.min[2]]},t}(),eu=function(){function t(e,r){this.distance=e||0,this.normal=r||j(0,1,0),this.updatePNVertexFlag()}return t.prototype.updatePNVertexFlag=function(){this.pnVertexFlag=(+(this.normal[0]>=0)<<8)+(+(this.normal[1]>=0)<<4)+ +(this.normal[2]>=0)},t.prototype.distanceToPoint=function(e){return te(e,this.normal)-this.distance},t.prototype.normalize=function(){var e=1/fo(this.normal);gc(this.normal,this.normal,e),this.distance*=e},t.prototype.intersectsLine=function(e,r,n){var i=this.distanceToPoint(e),a=this.distanceToPoint(r),o=i/(i-a),s=o>=0&&o<=1;return s&&n&&mc(n,e,r,o),s},t}(),ve;(function(t){t[t.OUTSIDE=4294967295]="OUTSIDE",t[t.INSIDE=0]="INSIDE",t[t.INDETERMINATE=2147483647]="INDETERMINATE"})(ve||(ve={}));var ru=function(){function t(e){if(this.planes=[],e)this.planes=e;else for(var r=0;r<6;r++)this.planes.push(new eu)}return t.prototype.extractFromVPMatrix=function(e){var r=_(e,16),n=r[0],i=r[1],a=r[2],o=r[3],s=r[4],c=r[5],l=r[6],u=r[7],f=r[8],h=r[9],v=r[10],p=r[11],y=r[12],d=r[13],m=r[14],E=r[15];qt(this.planes[0].normal,o-n,u-s,p-f),this.planes[0].distance=E-y,qt(this.planes[1].normal,o+n,u+s,p+f),this.planes[1].distance=E+y,qt(this.planes[2].normal,o+i,u+c,p+h),this.planes[2].distance=E+d,qt(this.planes[3].normal,o-i,u-c,p-h),this.planes[3].distance=E-d,qt(this.planes[4].normal,o-a,u-l,p-v),this.planes[4].distance=E-m,qt(this.planes[5].normal,o+a,u+l,p+v),this.planes[5].distance=E+m,this.planes.forEach(function(M){M.normalize(),M.updatePNVertexFlag()})},t}(),pt=function(){function t(e,r){e===void 0&&(e=0),r===void 0&&(r=0),this.x=0,this.y=0,this.x=e,this.y=r}return t.prototype.clone=function(){return new t(this.x,this.y)},t.prototype.copyFrom=function(e){this.x=e.x,this.y=e.y},t}(),ke=function(){function t(e,r,n,i){this.x=e,this.y=r,this.width=n,this.height=i,this.left=e,this.right=e+n,this.top=r,this.bottom=r+i}return t.prototype.toJSON=function(){},t}(),J="Method not implemented.",Ge="Use document.documentElement instead.",nu="Cannot append a destroyed element.",at;(function(t){t[t.ORBITING=0]="ORBITING",t[t.EXPLORING=1]="EXPLORING",t[t.TRACKING=2]="TRACKING"})(at||(at={}));var pr;(function(t){t[t.DEFAULT=0]="DEFAULT",t[t.ROTATIONAL=1]="ROTATIONAL",t[t.TRANSLATIONAL=2]="TRANSLATIONAL",t[t.CINEMATIC=3]="CINEMATIC"})(pr||(pr={}));var Pt;(function(t){t[t.ORTHOGRAPHIC=0]="ORTHOGRAPHIC",t[t.PERSPECTIVE=1]="PERSPECTIVE"})(Pt||(Pt={}));var No={UPDATED:"updated"},fa=2e-4,iu=function(){function t(){this.clipSpaceNearZ=qe.NEGATIVE_ONE,this.eventEmitter=new Ei,this.matrix=nt(),this.right=j(1,0,0),this.up=j(0,1,0),this.forward=j(0,0,1),this.position=j(0,0,1),this.focalPoint=j(0,0,0),this.distanceVector=j(0,0,-1),this.distance=1,this.azimuth=0,this.elevation=0,this.roll=0,this.relAzimuth=0,this.relElevation=0,this.relRoll=0,this.dollyingStep=0,this.maxDistance=1/0,this.minDistance=-1/0,this.zoom=1,this.rotateWorld=!1,this.fov=30,this.near=.1,this.far=1e3,this.aspect=1,this.projectionMatrix=nt(),this.projectionMatrixInverse=nt(),this.jitteredProjectionMatrix=void 0,this.enableUpdate=!0,this.type=at.EXPLORING,this.trackingMode=pr.DEFAULT,this.projectionMode=Pt.PERSPECTIVE,this.frustum=new ru,this.orthoMatrix=nt()}return t.prototype.isOrtho=function(){return this.projectionMode===Pt.ORTHOGRAPHIC},t.prototype.getProjectionMode=function(){return this.projectionMode},t.prototype.getPerspective=function(){return this.jitteredProjectionMatrix||this.projectionMatrix},t.prototype.getPerspectiveInverse=function(){return this.projectionMatrixInverse},t.prototype.getFrustum=function(){return this.frustum},t.prototype.getPosition=function(){return this.position},t.prototype.getFocalPoint=function(){return this.focalPoint},t.prototype.getDollyingStep=function(){return this.dollyingStep},t.prototype.getNear=function(){return this.near},t.prototype.getFar=function(){return this.far},t.prototype.getZoom=function(){return this.zoom},t.prototype.getOrthoMatrix=function(){return this.orthoMatrix},t.prototype.getView=function(){return this.view},t.prototype.setEnableUpdate=function(e){this.enableUpdate=e},t.prototype.setType=function(e,r){return this.type=e,this.type===at.EXPLORING?this.setWorldRotation(!0):this.setWorldRotation(!1),this._getAngles(),this.type===at.TRACKING&&r!==void 0&&this.setTrackingMode(r),this},t.prototype.setProjectionMode=function(e){return this.projectionMode=e,this},t.prototype.setTrackingMode=function(e){if(this.type!==at.TRACKING)throw new Error("Impossible to set a tracking mode if the camera is not of tracking type");return this.trackingMode=e,this},t.prototype.setWorldRotation=function(e){return this.rotateWorld=e,this._getAngles(),this},t.prototype.getViewTransform=function(){return jt(nt(),this.matrix)},t.prototype.getWorldTransform=function(){return this.matrix},t.prototype.jitterProjectionMatrix=function(e,r){var n=eo(nt(),[e,r,0]);this.jitteredProjectionMatrix=Et(nt(),n,this.projectionMatrix)},t.prototype.clearJitterProjectionMatrix=function(){this.jitteredProjectionMatrix=void 0},t.prototype.setMatrix=function(e){return this.matrix=e,this._update(),this},t.prototype.setFov=function(e){return this.setPerspective(this.near,this.far,e,this.aspect),this},t.prototype.setAspect=function(e){return this.setPerspective(this.near,this.far,this.fov,e),this},t.prototype.setNear=function(e){return this.projectionMode===Pt.PERSPECTIVE?this.setPerspective(e,this.far,this.fov,this.aspect):this.setOrthographic(this.left,this.rright,this.top,this.bottom,e,this.far),this},t.prototype.setFar=function(e){return this.projectionMode===Pt.PERSPECTIVE?this.setPerspective(this.near,e,this.fov,this.aspect):this.setOrthographic(this.left,this.rright,this.top,this.bottom,this.near,e),this},t.prototype.setViewOffset=function(e,r,n,i,a,o){return this.aspect=e/r,this.view===void 0&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=r,this.view.offsetX=n,this.view.offsetY=i,this.view.width=a,this.view.height=o,this.projectionMode===Pt.PERSPECTIVE?this.setPerspective(this.near,this.far,this.fov,this.aspect):this.setOrthographic(this.left,this.rright,this.top,this.bottom,this.near,this.far),this},t.prototype.clearViewOffset=function(){return this.view!==void 0&&(this.view.enabled=!1),this.projectionMode===Pt.PERSPECTIVE?this.setPerspective(this.near,this.far,this.fov,this.aspect):this.setOrthographic(this.left,this.rright,this.top,this.bottom,this.near,this.far),this},t.prototype.setZoom=function(e){return this.zoom=e,this.projectionMode===Pt.ORTHOGRAPHIC?this.setOrthographic(this.left,this.rright,this.top,this.bottom,this.near,this.far):this.projectionMode===Pt.PERSPECTIVE&&this.setPerspective(this.near,this.far,this.fov,this.aspect),this},t.prototype.setZoomByViewportPoint=function(e,r){var n=this.canvas.viewport2Canvas({x:r[0],y:r[1]}),i=n.x,a=n.y,o=this.roll;this.rotate(0,0,-o),this.setPosition(i,a),this.setFocalPoint(i,a),this.setZoom(e),this.rotate(0,0,o);var s=this.canvas.viewport2Canvas({x:r[0],y:r[1]}),c=s.x,l=s.y,u=j(c-i,l-a,0),f=te(u,this.right)/se(this.right),h=te(u,this.up)/se(this.up);return this.pan(-f,-h),this},t.prototype.setPerspective=function(e,r,n,i){var a;this.projectionMode=Pt.PERSPECTIVE,this.fov=n,this.near=e,this.far=r,this.aspect=i;var o=this.near*Math.tan(ut(.5*this.fov))/this.zoom,s=2*o,c=this.aspect*s,l=-.5*c;if(!((a=this.view)===null||a===void 0)&&a.enabled){var u=this.view.fullWidth,f=this.view.fullHeight;l+=this.view.offsetX*c/u,o-=this.view.offsetY*s/f,c*=this.view.width/u,s*=this.view.height/f}return Ql(this.projectionMatrix,l,l+c,o,o-s,e,this.far,this.clipSpaceNearZ===qe.ZERO),rn(this.projectionMatrix,this.projectionMatrix,j(1,-1,1)),jt(this.projectionMatrixInverse,this.projectionMatrix),this.triggerUpdate(),this},t.prototype.setOrthographic=function(e,r,n,i,a,o){var s;this.projectionMode=Pt.ORTHOGRAPHIC,this.rright=r,this.left=e,this.top=n,this.bottom=i,this.near=a,this.far=o;var c=(this.rright-this.left)/(2*this.zoom),l=(this.top-this.bottom)/(2*this.zoom),u=(this.rright+this.left)/2,f=(this.top+this.bottom)/2,h=u-c,v=u+c,p=f+l,y=f-l;if(!((s=this.view)===null||s===void 0)&&s.enabled){var d=(this.rright-this.left)/this.view.fullWidth/this.zoom,m=(this.top-this.bottom)/this.view.fullHeight/this.zoom;h+=d*this.view.offsetX,v=h+d*this.view.width,p-=m*this.view.offsetY,y=p-m*this.view.height}return this.clipSpaceNearZ===qe.NEGATIVE_ONE?so(this.projectionMatrix,h,v,y,p,a,o):co(this.projectionMatrix,h,v,y,p,a,o),rn(this.projectionMatrix,this.projectionMatrix,j(1,-1,1)),jt(this.projectionMatrixInverse,this.projectionMatrix),this._getOrthoMatrix(),this.triggerUpdate(),this},t.prototype.setPosition=function(e,r,n){r===void 0&&(r=this.position[1]),n===void 0&&(n=this.position[2]);var i=Tt(e,r,n);return this._setPosition(i),this.setFocalPoint(this.focalPoint),this.triggerUpdate(),this},t.prototype.setFocalPoint=function(e,r,n){r===void 0&&(r=this.focalPoint[1]),n===void 0&&(n=this.focalPoint[2]);var i=j(0,1,0);if(this.focalPoint=Tt(e,r,n),this.trackingMode===pr.CINEMATIC){var a=Hi(q(),this.focalPoint,this.position);e=a[0],r=a[1],n=a[2];var o=se(a),s=Gt(Math.asin(r/o)),c=90+Gt(Math.atan2(n,e)),l=nt();to(l,l,ut(c)),ja(l,l,ut(s)),i=Ut(q(),[0,1,0],l)}return jt(this.matrix,lo(nt(),this.position,this.focalPoint,i)),this._getAxes(),this._getDistance(),this._getAngles(),this.triggerUpdate(),this},t.prototype.getDistance=function(){return this.distance},t.prototype.getDistanceVector=function(){return this.distanceVector},t.prototype.setDistance=function(e){if(this.distance===e||e<0)return this;this.distance=e,this.distance=L.kEms&&e=me.kUnitType&&this.getType()<=me.kClampType},t}(),uu=function(t){z(e,t);function e(r){var n=t.call(this)||this;return n.colorSpace=r,n}return e.prototype.getType=function(){return me.kColorType},e.prototype.to=function(r){return this},e}(gn),ee;(function(t){t[t.Constant=0]="Constant",t[t.LinearGradient=1]="LinearGradient",t[t.RadialGradient=2]="RadialGradient"})(ee||(ee={}));var Lr=function(t){z(e,t);function e(r,n){var i=t.call(this)||this;return i.type=r,i.value=n,i}return e.prototype.clone=function(){return new e(this.type,this.value)},e.prototype.buildCSSText=function(r,n,i){return i},e.prototype.getType=function(){return me.kColorType},e}(gn),Ct=function(t){z(e,t);function e(r){var n=t.call(this)||this;return n.value=r,n}return e.prototype.clone=function(){return new e(this.value)},e.prototype.getType=function(){return me.kKeywordType},e.prototype.buildCSSText=function(r,n,i){return i+this.value},e}(gn),fu=Lt(function(t){return t===void 0&&(t=""),t.replace(/-([a-z])/g,function(e){return e[1].toUpperCase()})}),da=function(t){return t.split("").map(function(e,r){return e.toUpperCase()===e?"".concat(r!==0?"-":"").concat(e.toLowerCase()):e}).join("")};function hu(t){if(!t)throw new Error}function We(t){return typeof t=="function"}function vu(t){return typeof t=="symbol"}var du={d:{alias:"path"},strokeDasharray:{alias:"lineDash"},strokeWidth:{alias:"lineWidth"},textAnchor:{alias:"textAlign"},src:{alias:"img"}},ri=Lt(function(t){var e=fu(t),r=du[e];return e=(r==null?void 0:r.alias)||e,e}),pu=function(t,e){e===void 0&&(e="");var r="";return Number.isFinite(t)?(hu(Number.isNaN(t)),r="NaN"):t>0?r="infinity":r="-infinity",r+=e},ni=function(t){return lu(cu(t))},vt=function(t){z(e,t);function e(r,n){n===void 0&&(n=L.kNumber);var i=t.call(this)||this,a;return typeof n=="string"?a=su(n):a=n,i.unit=a,i.value=r,i}return e.prototype.clone=function(){return new e(this.value,this.unit)},e.prototype.equals=function(r){var n=r;return this.value===n.value&&this.unit===n.unit},e.prototype.getType=function(){return me.kUnitType},e.prototype.convertTo=function(r){if(this.unit===r)return new e(this.value,this.unit);var n=ni(this.unit);if(n!==ni(r)||n===L.kUnknown)return null;var i=va(this.unit)/va(r);return new e(this.value*i,r)},e.prototype.buildCSSText=function(r,n,i){var a;switch(this.unit){case L.kUnknown:break;case L.kInteger:a=Number(this.value).toFixed(0);break;case L.kNumber:case L.kPercentage:case L.kEms:case L.kRems:case L.kPixels:case L.kDegrees:case L.kRadians:case L.kGradians:case L.kMilliseconds:case L.kSeconds:case L.kTurns:{var o=-999999,s=999999,c=this.value,l=ei(this.unit);if(cs){var u=ei(this.unit);!Number.isFinite(c)||Number.isNaN(c)?a=pu(c,u):a=c+(u||"")}else a="".concat(c).concat(l)}}return i+=a,i},e}(gn),dt=new vt(0,"px");new vt(1,"px");var ce=new vt(0,"deg"),wi=function(t){z(e,t);function e(r,n,i,a,o){a===void 0&&(a=1),o===void 0&&(o=!1);var s=t.call(this,"rgb")||this;return s.r=r,s.g=n,s.b=i,s.alpha=a,s.isNone=o,s}return e.prototype.clone=function(){return new e(this.r,this.g,this.b,this.alpha)},e.prototype.buildCSSText=function(r,n,i){return i+"rgba(".concat(this.r,",").concat(this.g,",").concat(this.b,",").concat(this.alpha,")")},e}(uu),tt=new Ct("unset"),yu=new Ct("initial"),gu=new Ct("inherit"),Ln={"":tt,unset:tt,initial:yu,inherit:gu},ii=function(t){return Ln[t]||(Ln[t]=new Ct(t)),Ln[t]},ai=new wi(0,0,0,0,!0),Ro=new wi(0,0,0,0),mu=Lt(function(t,e,r,n){return new wi(t,e,r,n)}),ot=function(t,e){return e===void 0&&(e=L.kNumber),new vt(t,e)},ln=new vt(50,"%"),oi;(function(t){t[t.Standard=0]="Standard"})(oi||(oi={}));var Qe;(function(t){t[t.ADDED=0]="ADDED",t[t.REMOVED=1]="REMOVED",t[t.Z_INDEX_CHANGED=2]="Z_INDEX_CHANGED"})(Qe||(Qe={}));var Ao={absolutePath:[],hasArc:!1,segments:[],polygons:[],polylines:[],curve:null,totalLength:0,rect:new ke(0,0,0,0)},D;(function(t){t.COORDINATE="",t.COLOR="",t.PAINT="",t.NUMBER="",t.ANGLE="",t.OPACITY_VALUE="",t.SHADOW_BLUR="",t.LENGTH="",t.PERCENTAGE="",t.LENGTH_PERCENTAGE=" | ",t.LENGTH_PERCENTAGE_12="[ | ]{1,2}",t.LENGTH_PERCENTAGE_14="[ | ]{1,4}",t.LIST_OF_POINTS="",t.PATH="",t.FILTER="",t.Z_INDEX="",t.OFFSET_DISTANCE="",t.DEFINED_PATH="",t.MARKER="",t.TRANSFORM="",t.TRANSFORM_ORIGIN="",t.TEXT="",t.TEXT_TRANSFORM=""})(D||(D={}));function xu(t){var e=t.type,r=t.value;return e==="hex"?"#".concat(r):e==="literal"?r:e==="rgb"?"rgb(".concat(r.join(","),")"):"rgba(".concat(r.join(","),")")}var Eu=function(){var t={linearGradient:/^(linear\-gradient)/i,repeatingLinearGradient:/^(repeating\-linear\-gradient)/i,radialGradient:/^(radial\-gradient)/i,repeatingRadialGradient:/^(repeating\-radial\-gradient)/i,conicGradient:/^(conic\-gradient)/i,sideOrCorner:/^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,extentKeywords:/^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,positionKeywords:/^(left|center|right|top|bottom)/i,pixelValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,percentageValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,emValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,angleValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,startCall:/^\(/,endCall:/^\)/,comma:/^,/,hexColor:/^\#([0-9a-fA-F]+)/,literalColor:/^([a-zA-Z]+)/,rgbColor:/^rgb/i,rgbaColor:/^rgba/i,number:/^(([0-9]*\.[0-9]+)|([0-9]+\.?))/},e="";function r(I){throw new Error(e+": "+I)}function n(){var I=i();return e.length>0&&r("Invalid input not EOF"),I}function i(){return M(a)}function a(){return o("linear-gradient",t.linearGradient,c)||o("repeating-linear-gradient",t.repeatingLinearGradient,c)||o("radial-gradient",t.radialGradient,f)||o("repeating-radial-gradient",t.repeatingRadialGradient,f)||o("conic-gradient",t.conicGradient,f)}function o(I,G,H){return s(G,function(lt){var rt=H();return rt&&(B(t.comma)||r("Missing comma before color stops")),{type:I,orientation:rt,colorStops:M(P)}})}function s(I,G){var H=B(I);if(H){B(t.startCall)||r("Missing (");var lt=G(H);return B(t.endCall)||r("Missing )"),lt}}function c(){return l()||u()}function l(){return k("directional",t.sideOrCorner,1)}function u(){return k("angular",t.angleValue,1)}function f(){var I,G=h(),H;return G&&(I=[],I.push(G),H=e,B(t.comma)&&(G=h(),G?I.push(G):e=H)),I}function h(){var I=v()||p();if(I)I.at=d();else{var G=y();if(G){I=G;var H=d();H&&(I.at=H)}else{var lt=m();lt&&(I={type:"default-radial",at:lt})}}return I}function v(){var I=k("shape",/^(circle)/i,0);return I&&(I.style=O()||y()),I}function p(){var I=k("shape",/^(ellipse)/i,0);return I&&(I.style=S()||y()),I}function y(){return k("extent-keyword",t.extentKeywords,1)}function d(){if(k("position",/^at/,0)){var I=m();return I||r("Missing positioning value"),I}}function m(){var I=E();if(I.x||I.y)return{type:"position",value:I}}function E(){return{x:S(),y:S()}}function M(I){var G=I(),H=[];if(G)for(H.push(G);B(t.comma);)G=I(),G?H.push(G):r("One extra comma");return H}function P(){var I=x();return I||r("Expected color definition"),I.length=S(),I}function x(){return T()||b()||w()||g()}function g(){return k("literal",t.literalColor,0)}function T(){return k("hex",t.hexColor,1)}function w(){return s(t.rgbColor,function(){return{type:"rgb",value:M(C)}})}function b(){return s(t.rgbaColor,function(){return{type:"rgba",value:M(C)}})}function C(){return B(t.number)[1]}function S(){return k("%",t.percentageValue,1)||N()||O()}function N(){return k("position-keyword",t.positionKeywords,1)}function O(){return k("px",t.pixelValue,1)||k("em",t.emValue,1)}function k(I,G,H){var lt=B(G);if(lt)return{type:I,value:lt[H]}}function B(I){var G=/^[\n\r\t\s]+/.exec(e);G&&Y(G[0].length);var H=I.exec(e);return H&&Y(H[0].length),H}function Y(I){e=e.substring(I)}return function(I){return e=I,n()}}();function Mu(t,e,r){var n=ut(r.value),i=0,a=0,o=i+t/2,s=a+e/2,c=Math.abs(t*Math.cos(n))+Math.abs(e*Math.sin(n)),l=o-Math.cos(n)*c/2,u=s-Math.sin(n)*c/2,f=o+Math.cos(n)*c/2,h=s+Math.sin(n)*c/2;return{x1:l,y1:u,x2:f,y2:h}}function Pu(t,e,r,n,i){var a=r.value,o=n.value;r.unit===L.kPercentage&&(a=r.value/100*t),n.unit===L.kPercentage&&(o=n.value/100*e);var s=Math.max(Rt([0,0],[a,o]),Rt([0,e],[a,o]),Rt([t,e],[a,o]),Rt([t,0],[a,o]));return i&&(i instanceof vt?s=i.value:i instanceof Ct&&(i.value==="closest-side"?s=Math.min(a,t-a,o,e-o):i.value==="farthest-side"?s=Math.max(a,t-a,o,e-o):i.value==="closest-corner"&&(s=Math.min(Rt([0,0],[a,o]),Rt([0,e],[a,o]),Rt([t,e],[a,o]),Rt([t,0],[a,o]))))),{x:a,y:o,r:s}}var Tu=/^l\s*\(\s*([\d.]+)\s*\)\s*(.*)/i,wu=/^r\s*\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)\s*(.*)/i,bu=/^p\s*\(\s*([axyn])\s*\)\s*(.*)/i,Oo=/[\d.]+:(#[^\s]+|[^\)]+\))/gi;function Cu(t){var e,r,n,i=t.length;t[i-1].length=(e=t[i-1].length)!==null&&e!==void 0?e:{type:"%",value:"100"},i>1&&(t[0].length=(r=t[0].length)!==null&&r!==void 0?r:{type:"%",value:"0"});for(var a=0,o=Number(t[0].length.value),s=1;s-1||t.indexOf("radial")>-1){var r=Eu(t);return r.map(function(s){var c=s.type,l=s.orientation,u=s.colorStops;Cu(u);var f=u.map(function(M){return{offset:ot(Number(M.length.value),"%"),color:xu(M)}});if(c==="linear-gradient")return new Lr(ee.LinearGradient,{angle:l?Nu(l):ce,steps:f});if(c==="radial-gradient"&&(l||(l=[{type:"shape",value:"circle"}]),l[0].type==="shape"&&l[0].value==="circle")){var h=Ru(l[0].at),v=h.cx,p=h.cy,y=void 0;if(l[0].style){var d=l[0].style,m=d.type,E=d.value;m==="extent-keyword"?y=ii(E):y=ot(E,m)}return new Lr(ee.RadialGradient,{cx:v,cy:p,size:y,steps:f})}})}var n=t[0];if(t[1]==="("||t[2]==="("){if(n==="l"){var i=Tu.exec(t);if(i){var a=((e=i[2].match(Oo))===null||e===void 0?void 0:e.map(function(s){return s.split(":")}))||[];return[new Lr(ee.LinearGradient,{angle:ot(parseFloat(i[1]),"deg"),steps:a.map(function(s){var c=_(s,2),l=c[0],u=c[1];return{offset:ot(Number(l)*100,"%"),color:u}})})]}}else if(n==="r"){var o=Ou(t);if(o)if(bt(o))t=o;else return[new Lr(ee.RadialGradient,o)]}else if(n==="p")return ku(t)}});function Ou(t){var e,r=wu.exec(t);if(r){var n=((e=r[4].match(Oo))===null||e===void 0?void 0:e.map(function(i){return i.split(":")}))||[];return{cx:ot(50,"%"),cy:ot(50,"%"),steps:n.map(function(i){var a=_(i,2),o=a[0],s=a[1];return{offset:ot(Number(o)*100,"%"),color:s}})}}return null}function ku(t){var e=bu.exec(t);if(e){var r=e[1],n=e[2];switch(r){case"a":r="repeat";break;case"x":r="repeat-x";break;case"y":r="repeat-y";break;case"n":r="no-repeat";break;default:r="no-repeat"}return{image:n,repetition:r}}return null}function yr(t){return t&&!!t.image}function un(t){return t&&!F(t.r)&&!F(t.g)&&!F(t.b)}var $e=Lt(function(t){if(yr(t))return U({repetition:"repeat"},t);if(F(t)&&(t=""),t==="transparent")return Ro;t==="currentColor"&&(t="black");var e=Au(t);if(e)return e;var r=yn(t),n=[0,0,0,0];return r!==null&&(n[0]=r.r||0,n[1]=r.g||0,n[2]=r.b||0,n[3]=r.opacity),mu.apply(void 0,X([],_(n),!1))});function Iu(t,e){if(!(!un(t)||!un(e)))return[[Number(t.r),Number(t.g),Number(t.b),Number(t.alpha)],[Number(e.r),Number(e.g),Number(e.b),Number(e.alpha)],function(r){var n=r.slice();if(n[3])for(var i=0;i<3;i++)n[i]=Math.round(kt(n[i],0,255));return n[3]=kt(n[3],0,1),"rgba(".concat(n.join(","),")")}]}function mn(t,e){if(F(e))return ot(0,"px");if(e="".concat(e).trim().toLowerCase(),isFinite(Number(e))){if("px".search(t)>=0)return ot(Number(e),"px");if("deg".search(t)>=0)return ot(Number(e),"deg")}var r=[];e=e.replace(t,function(i){return r.push(i),"U"+i});var n="U("+t.source+")";return r.map(function(i){return ot(Number(e.replace(new RegExp("U"+i,"g"),"").replace(new RegExp(n,"g"),"*0")),i)})[0]}var Lu=Lt(function(t){return mn(new RegExp("px","g"),t)}),Je=function(t){return ie(t)||isFinite(Number(t))?ot(Number(t)||0,"px"):mn(new RegExp("px|%|em|rem","g"),t)},ko=Lt(function(t){return mn(new RegExp("deg|rad|grad|turn","g"),t)});function _u(t,e,r,n,i){i===void 0&&(i=0);var a="",o=t.value||0,s=e.value||0,c=ni(t.unit),l=t.convertTo(c),u=e.convertTo(c);return l&&u?(o=l.value,s=u.value,a=ei(t.unit)):(vt.isLength(t.unit)||vt.isLength(e.unit))&&(o=Nt(t,i,r),s=Nt(e,i,r),a="px"),[o,s,function(f){return n&&(f=Math.max(f,0)),f+a}]}function At(t){var e=0;return t.unit===L.kDegrees?e=t.value:t.unit===L.kRadians?e=Gt(Number(t.value)):t.unit===L.kTurns&&(e=ql(Number(t.value))),e}function _n(t,e){var r;return Array.isArray(t)?r=t.map(function(n){return Number(n)}):bt(t)?r=t.split(" ").map(function(n){return Number(n)}):ie(t)&&(r=[t]),e===2?r.length===1?[r[0],r[0]]:[r[0],r[1]]:r.length===1?[r[0],r[0],r[0],r[0]]:r.length===2?[r[0],r[1],r[0],r[1]]:r.length===3?[r[0],r[1],r[2],r[1]]:[r[0],r[1],r[2],r[3]]}function Io(t){return bt(t)?t.split(" ").map(function(e){return Je(e)}):t.map(function(e){return Je(e.toString())})}function Nt(t,e,r){if(t.value===0)return 0;if(t.unit===L.kPixels)return Number(t.value);if(t.unit===L.kPercentage&&r){var n=r.nodeName===R.GROUP?r.getLocalBounds():r.geometry.contentBounds;return t.value/100*n.halfExtents[e]*2}return 0}var Du=function(t){return mn(/deg|rad|grad|turn|px|%/g,t)},Fu=["blur","brightness","drop-shadow","contrast","grayscale","sepia","saturate","hue-rotate","invert"];function Lo(t){if(t===void 0&&(t=""),t=t.toLowerCase().trim(),t==="none")return[];for(var e=/\s*([\w-]+)\(([^)]*)\)/g,r=[],n,i=0;n=e.exec(t);){if(n.index!==i)return[];if(i=n.index+n[0].length,Fu.indexOf(n[1])>-1&&r.push({name:n[1],params:n[2].split(" ").map(function(a){return Du(a)||$e(a)})}),e.lastIndex===t.length)return r}return[]}function _o(t){return t.toString()}var Pr=Lt(function(t){return typeof t=="number"?ot(t):/^\s*[-+]?(\d*\.)?\d+\s*$/.test(t)?ot(Number(t)):ot(0)});function bi(t,e){return[t,e,_o]}function Ci(t,e){return function(r,n){return[r,n,function(i){return _o(kt(i,t,e))}]}}function Do(t,e){if(t.length===e.length)return[t,e,function(r){return r}]}function si(t){return t.parsedStyle.path.totalLength===0&&(t.parsedStyle.path.totalLength=cl(t.parsedStyle.path.absolutePath)),t.parsedStyle.path.totalLength}function Bu(t){for(var e=0;e0&&r.push(n),{polygons:e,polylines:r}}function fn(t,e){return t[0]===e[0]&&t[1]===e[1]}function Yu(t,e){for(var r=[],n=[],i=[],a=0;aMath.PI/2?Math.PI-l:l,u=u>Math.PI/2?Math.PI-u:u;var f={xExtra:Math.cos(c/2-l)*(e/2*(1/Math.sin(c/2)))-e/2||0,yExtra:Math.cos(u-c/2)*(e/2*(1/Math.sin(c/2)))-e/2||0};return f}function pa(t,e){return[e[0]+(e[0]-t[0]),e[1]+(e[1]-t[1])]}var ya=function(t,e){var r=t.x*e.x+t.y*e.y,n=Math.sqrt((Math.pow(t.x,2)+Math.pow(t.y,2))*(Math.pow(e.x,2)+Math.pow(e.y,2))),i=t.x*e.y-t.y*e.x<0?-1:1,a=i*Math.acos(r/n);return a},ga=function(t,e,r,n,i,a,o,s){e=Math.abs(e),r=Math.abs(r),n=ho(n,360);var c=ut(n);if(t.x===o.x&&t.y===o.y)return{x:t.x,y:t.y,ellipticalArcAngle:0};if(e===0||r===0)return{x:0,y:0,ellipticalArcAngle:0};var l=(t.x-o.x)/2,u=(t.y-o.y)/2,f={x:Math.cos(c)*l+Math.sin(c)*u,y:-Math.sin(c)*l+Math.cos(c)*u},h=Math.pow(f.x,2)/Math.pow(e,2)+Math.pow(f.y,2)/Math.pow(r,2);h>1&&(e=Math.sqrt(h)*e,r=Math.sqrt(h)*r);var v=Math.pow(e,2)*Math.pow(r,2)-Math.pow(e,2)*Math.pow(f.y,2)-Math.pow(r,2)*Math.pow(f.x,2),p=Math.pow(e,2)*Math.pow(f.y,2)+Math.pow(r,2)*Math.pow(f.x,2),y=v/p;y=y<0?0:y;var d=(i!==a?1:-1)*Math.sqrt(y),m={x:d*(e*f.y/r),y:d*(-(r*f.x)/e)},E={x:Math.cos(c)*m.x-Math.sin(c)*m.y+(t.x+o.x)/2,y:Math.sin(c)*m.x+Math.cos(c)*m.y+(t.y+o.y)/2},M={x:(f.x-m.x)/e,y:(f.y-m.y)/r},P=ya({x:1,y:0},M),x={x:(-f.x-m.x)/e,y:(-f.y-m.y)/r},g=ya(M,x);!a&&g>0?g-=2*Math.PI:a&&g<0&&(g+=2*Math.PI),g%=2*Math.PI;var T=P+g*s,w=e*Math.cos(T),b=r*Math.sin(T),C={x:Math.cos(c)*w-Math.sin(c)*b+E.x,y:Math.sin(c)*w+Math.cos(c)*b+E.y,ellipticalArcStartAngle:P,ellipticalArcEndAngle:P+g,ellipticalArcAngle:T,ellipticalArcCenter:E,resultantRx:e,resultantRy:r};return C};function Hu(t){for(var e=[],r=null,n=null,i=null,a=0,o=t.length,s=0;s1&&(r*=Math.sqrt(v),n*=Math.sqrt(v));var p=r*r*(h*h)+n*n*(f*f),y=p?Math.sqrt((r*r*(n*n)-p)/p):1;a===o&&(y*=-1),isNaN(y)&&(y=0);var d=n?y*r*h/n:0,m=r?y*-n*f/r:0,E=(s+l)/2+Math.cos(i)*d-Math.sin(i)*m,M=(c+u)/2+Math.sin(i)*d+Math.cos(i)*m,P=[(f-d)/r,(h-m)/n],x=[(-1*f-d)/r,(-1*h-m)/n],g=xa([1,0],P),T=xa(P,x);return ci(P,x)<=-1&&(T=Math.PI),ci(P,x)>=1&&(T=0),o===0&&T>0&&(T=T-2*Math.PI),o===1&&T<0&&(T=T+2*Math.PI),{cx:E,cy:M,rx:fn(t,[l,u])?0:r,ry:fn(t,[l,u])?0:n,startAngle:g,endAngle:g+T,xRotation:i,arcFlag:a,sweepFlag:o}}var Fo=function(t){if(t===""||Array.isArray(t)&&t.length===0)return{absolutePath:[],hasArc:!1,segments:[],polygons:[],polylines:[],curve:null,totalLength:0,rect:{x:0,y:0,width:0,height:0}};var e;try{e=sn(t)}catch{e=sn(""),console.error("[g]: Invalid SVG Path definition: ".concat(t))}Bu(e);var r=Gu(e),n=Uu(e),i=n.polygons,a=n.polylines,o=Hu(e),s=Yu(o,0),c=s.x,l=s.y,u=s.width,f=s.height;return{absolutePath:e,hasArc:r,segments:o,polygons:i,polylines:a,totalLength:0,rect:{x:Number.isFinite(c)?c:0,y:Number.isFinite(l)?l:0,width:Number.isFinite(u)?u:0,height:Number.isFinite(f)?f:0}}},zu=Lt(Fo);function li(t){return bt(t)?zu(t):Fo(t)}function Xu(t,e,r){var n=t.curve,i=e.curve;(!n||n.length===0)&&(n=Kn(t.absolutePath,!1),t.curve=n),(!i||i.length===0)&&(i=Kn(e.absolutePath,!1),e.curve=i);var a=[n,i];n.length!==i.length&&(a=Eo(n,i));var o=Zi(a[0])!==Zi(a[1])?rl(a[0]):el(a[0]);return[o,ul(a[1],o),function(s){return s}]}function Bo(t,e){var r;bt(t)?r=t.split(" ").map(function(u){var f=_(u.split(","),2),h=f[0],v=f[1];return[Number(h),Number(v)]}):r=t;var n=[],i=0,a,o,s=Dl(r);r.forEach(function(u,f){r[f+1]&&(a=[0,0],a[0]=i/s,o=bo(u[0],u[1],r[f+1][0],r[f+1][1]),i+=o,a[1]=i/s,n.push(a))});var c=Math.min.apply(Math,X([],_(r.map(function(u){return u[0]})),!1)),l=Math.min.apply(Math,X([],_(r.map(function(u){return u[1]})),!1));return e&&(e.parsedStyle.defX=c,e.parsedStyle.defY=l),{points:r,totalLength:s,segments:n}}function Vu(t,e){return[t.points,e.points,function(r){return r}]}var ct=null;function Mt(t){return function(e){var r=0;return t.map(function(n){return n===ct?e[r++]:n})}}function Se(t){return t}var ui={matrix:["NNNNNN",[ct,ct,0,0,ct,ct,0,0,0,0,1,0,ct,ct,0,1],Se],matrix3d:["NNNNNNNNNNNNNNNN",Se],rotate:["A"],rotatex:["A"],rotatey:["A"],rotatez:["A"],rotate3d:["NNNA"],perspective:["L"],scale:["Nn",Mt([ct,ct,new vt(1)]),Se],scalex:["N",Mt([ct,new vt(1),new vt(1)]),Mt([ct,new vt(1)])],scaley:["N",Mt([new vt(1),ct,new vt(1)]),Mt([new vt(1),ct])],scalez:["N",Mt([new vt(1),new vt(1),ct])],scale3d:["NNN",Se],skew:["Aa",null,Se],skewx:["A",null,Mt([ct,ce])],skewy:["A",null,Mt([ce,ct])],translate:["Tt",Mt([ct,ct,dt]),Se],translatex:["T",Mt([ct,dt,dt]),Mt([ct,dt])],translatey:["T",Mt([dt,ct,dt]),Mt([dt,ct])],translatez:["L",Mt([dt,dt,ct])],translate3d:["TTL",Se]};function hn(t){if(t=(t||"none").toLowerCase().trim(),t==="none")return[];for(var e=/\s*(\w+)\(([^)]*)\)/g,r=[],n,i=0;n=e.exec(t);){if(n.index!==i)return[];i=n.index+n[0].length;var a=n[1],o=ui[a];if(!o)return[];var s=n[2].split(","),c=o[0];if(c.length"].calculator(null,null,{value:r.textTransform},e,null),r.clipPath&&this.runtime.CSSPropertySyntaxFactory[""].calculator("clipPath",o,r.clipPath,e,this.runtime),r.offsetPath&&this.runtime.CSSPropertySyntaxFactory[""].calculator("offsetPath",s,r.offsetPath,e,this.runtime),r.anchor&&(e.parsedStyle.anchor=_n(r.anchor,2)),r.transform&&(e.parsedStyle.transform=hn(r.transform)),r.transformOrigin&&(e.parsedStyle.transformOrigin=Go(r.transformOrigin)),r.markerStart&&(e.parsedStyle.markerStart=this.runtime.CSSPropertySyntaxFactory[""].calculator(null,r.markerStart,r.markerStart,null,null)),r.markerEnd&&(e.parsedStyle.markerEnd=this.runtime.CSSPropertySyntaxFactory[""].calculator(null,r.markerEnd,r.markerEnd,null,null)),r.markerMid&&(e.parsedStyle.markerMid=this.runtime.CSSPropertySyntaxFactory[""].calculator("",r.markerMid,r.markerMid,null,null)),((e.nodeName===R.CIRCLE||e.nodeName===R.ELLIPSE)&&(!F(r.cx)||!F(r.cy))||(e.nodeName===R.RECT||e.nodeName===R.IMAGE||e.nodeName===R.GROUP||e.nodeName===R.HTML||e.nodeName===R.TEXT||e.nodeName===R.MESH)&&(!F(r.x)||!F(r.y)||!F(r.z))||e.nodeName===R.LINE&&(!F(r.x1)||!F(r.y1)||!F(r.z1)||!F(r.x2)||!F(r.y2)||!F(r.z2)))&&this.runtime.CSSPropertySyntaxFactory[""].postProcessor(e,a),F(r.zIndex)||this.runtime.CSSPropertySyntaxFactory[""].postProcessor(e,a),r.path&&this.runtime.CSSPropertySyntaxFactory[""].postProcessor(e,a),r.points&&this.runtime.CSSPropertySyntaxFactory[""].postProcessor(e,a),F(r.offsetDistance)||this.runtime.CSSPropertySyntaxFactory[""].postProcessor(e,a),r.transform&&this.runtime.CSSPropertySyntaxFactory[""].postProcessor(e,a),c&&this.updateGeometry(e);return}var u=n.skipUpdateAttribute,f=n.skipParse,h=n.forceUpdateGeometry,v=n.usedAttributes,p=h,y=Object.keys(r);y.forEach(function(d){var m;u||(e.attributes[d]=r[d]),!p&&(!((m=fe[d])===null||m===void 0)&&m.l)&&(p=!0)}),f||y.forEach(function(d){e.computedStyle[d]=i.parseProperty(d,e.attributes[d],e)}),v!=null&&v.length&&(y=Array.from(new Set(y.concat(v)))),y.forEach(function(d){d in e.computedStyle&&(e.parsedStyle[d]=i.computeProperty(d,e.computedStyle[d],e))}),p&&this.updateGeometry(e),y.forEach(function(d){d in e.parsedStyle&&i.postProcessProperty(d,e,y)}),this.runtime.enableCSSParsing&&e.children.length&&y.forEach(function(d){d in e.parsedStyle&&i.isPropertyInheritable(d)&&e.children.forEach(function(m){m.internalSetAttribute(d,null,{skipUpdateAttribute:!0,skipParse:!0})})})},t.prototype.parseProperty=function(e,r,n){var i=fe[e],a=r;if((r===""||F(r))&&(r="unset"),r==="unset"||r==="initial"||r==="inherit")a=ii(r);else if(i){var o=i.k,s=i.syntax,c=s&&this.getPropertySyntax(s);o&&o.indexOf(r)>-1?a=ii(r):c&&c.parser&&(a=c.parser(r,n))}return a},t.prototype.computeProperty=function(e,r,n){var i=fe[e],a=n.id==="g-root",o=r;if(i){var s=i.syntax,c=i.inh,l=i.d;if(r instanceof Ct){var u=r.value;if(u==="unset"&&(c&&!a?u="inherit":u="initial"),u==="initial")F(l)||(r=this.parseProperty(e,We(l)?l(n.nodeName):l,n));else if(u==="inherit"){var f=this.tryToResolveProperty(n,e,{inherited:!0});if(F(f)){this.addUnresolveProperty(n,e);return}else return f}}var h=s&&this.getPropertySyntax(s);if(h&&h.calculator){var v=n.parsedStyle[e];o=h.calculator(e,v,r,n,this.runtime)}else r instanceof Ct?o=r.value:o=r}return o},t.prototype.postProcessProperty=function(e,r,n){var i=fe[e];if(i&&i.syntax){var a=i.syntax&&this.getPropertySyntax(i.syntax),o=a;o&&o.postProcessor&&o.postProcessor(r,n)}},t.prototype.addUnresolveProperty=function(e,r){var n=Ye.get(e);n||(Ye.set(e,[]),n=Ye.get(e)),n.indexOf(r)===-1&&n.push(r)},t.prototype.tryToResolveProperty=function(e,r,n){n===void 0&&(n={});var i=n.inherited;if(i&&e.parentElement&&rf(e.parentElement,r)){var a=e.parentElement.parsedStyle[r];return a==="unset"||a==="initial"||a==="inherit"?void 0:a}},t.prototype.recalc=function(e){var r=Ye.get(e);if(r&&r.length){var n={};r.forEach(function(i){n[i]=e.attributes[i]}),this.processProperties(e,n),Ye.delete(e)}},t.prototype.updateGeometry=function(e){var r=e.nodeName,n=this.runtime.geometryUpdaterFactory[r];if(n){var i=e.geometry;i.contentBounds||(i.contentBounds=new ht),i.renderBounds||(i.renderBounds=new ht);var a=e.parsedStyle,o=n.update(a,e),s=o.width,c=o.height,l=o.depth,u=l===void 0?0:l,f=o.offsetX,h=f===void 0?0:f,v=o.offsetY,p=v===void 0?0:v,y=o.offsetZ,d=y===void 0?0:y,m=[Math.abs(s)/2,Math.abs(c)/2,u/2],E=a,M=E.stroke,P=E.lineWidth,x=E.increasedLineWidthForHitTesting,g=E.shadowType,T=E.shadowColor,w=E.filter,b=w===void 0?[]:w,C=E.transformOrigin,S=a.anchor;r===R.TEXT?delete a.anchor:r===R.MESH&&(a.anchor[2]=.5);var N=[(1-(S&&S[0]||0)*2)*s/2+h,(1-(S&&S[1]||0)*2)*c/2+p,(1-(S&&S[2]||0)*2)*m[2]+d];i.contentBounds.update(N,m);var O=r===R.POLYLINE||r===R.POLYGON||r===R.PATH?Math.SQRT2:.5,k=M&&!M.isNone;if(k){var B=((P||0)+(x||0))*O;m[0]+=B,m[1]+=B}if(i.renderBounds.update(N,m),T&&g&&g!=="inner"){var Y=i.renderBounds,I=Y.min,G=Y.max,H=a,lt=H.shadowBlur,rt=H.shadowOffsetX,St=H.shadowOffsetY,Ht=lt||0,$t=rt||0,Kt=St||0,Wt=I[0]-Ht+$t,wr=G[0]+Ht+$t,br=I[1]-Ht+Kt,Cr=G[1]+Ht+Kt;I[0]=Math.min(I[0],Wt),G[0]=Math.max(G[0],wr),I[1]=Math.min(I[1],br),G[1]=Math.max(G[1],Cr),i.renderBounds.setMinMax(I,G)}b.forEach(function(Li){var _i=Li.name,Nr=Li.params;if(_i==="blur"){var Di=Nr[0].value;i.renderBounds.update(i.renderBounds.center,en(i.renderBounds.halfExtents,i.renderBounds.halfExtents,[Di,Di,0]))}else if(_i==="drop-shadow"){var Fi=Nr[0].value,Bi=Nr[1].value,Rr=Nr[2].value,Gi=i.renderBounds,be=Gi.min,Ce=Gi.max,gs=be[0]-Rr+Fi,ms=Ce[0]+Rr+Fi,xs=be[1]-Rr+Bi,Es=Ce[1]+Rr+Bi;be[0]=Math.min(be[0],gs),Ce[0]=Math.max(Ce[0],ms),be[1]=Math.min(be[1],xs),Ce[1]=Math.max(Ce[1],Es),i.renderBounds.setMinMax(be,Ce)}}),S=a.anchor;var zt=s<0,Sr=c<0,Tn=(zt?-1:1)*(C?Nt(C[0],0,e):0),wn=(Sr?-1:1)*(C?Nt(C[1],1,e):0);Tn=Tn-(zt?-1:1)*(S&&S[0]||0)*i.contentBounds.halfExtents[0]*2,wn=wn-(Sr?-1:1)*(S&&S[1]||0)*i.contentBounds.halfExtents[1]*2,e.setOrigin(Tn,wn),this.runtime.sceneGraphService.dirtifyToRoot(e)}},t.prototype.isPropertyInheritable=function(e){var r=fe[e];return r?r.inh:!1},t}(),af=function(){function t(){this.parser=ko,this.parserWithCSSDisabled=null,this.mixer=bi}return t.prototype.calculator=function(e,r,n,i){return At(n)},t}(),of=function(){function t(){}return t.prototype.calculator=function(e,r,n,i,a){return n instanceof Ct&&(n=null),a.sceneGraphService.updateDisplayObjectDependency(e,r,n,i),e==="clipPath"&&i.forEach(function(o){o.childNodes.length===0&&a.sceneGraphService.dirtifyToRoot(o)}),n},t}(),sf=function(){function t(){this.parser=$e,this.parserWithCSSDisabled=$e,this.mixer=Iu}return t.prototype.calculator=function(e,r,n,i){return n instanceof Ct?n.value==="none"?ai:Ro:n},t}(),cf=function(){function t(){this.parser=Lo}return t.prototype.calculator=function(e,r,n){return n instanceof Ct?[]:n},t}();function Ta(t){var e=t.parsedStyle.fontSize;return F(e)?null:e}var Ni=function(){function t(){this.parser=Je,this.parserWithCSSDisabled=null,this.mixer=bi}return t.prototype.calculator=function(e,r,n,i,a){var o;if(ie(n))return n;if(vt.isRelativeUnit(n.unit)){var s=a.styleValueRegistry;if(n.unit===L.kPercentage)return 0;if(n.unit===L.kEms){if(i.parentNode){var c=Ta(i.parentNode);if(c)return c*=n.value,c;s.addUnresolveProperty(i,e)}else s.addUnresolveProperty(i,e);return 0}else if(n.unit===L.kRems){if(!((o=i==null?void 0:i.ownerDocument)===null||o===void 0)&&o.documentElement){var c=Ta(i.ownerDocument.documentElement);if(c)return c*=n.value,c;s.addUnresolveProperty(i,e)}else s.addUnresolveProperty(i,e);return 0}}else return n.value},t}(),lf=function(){function t(){this.mixer=Do}return t.prototype.parser=function(e){var r=Io(ie(e)?[e]:e),n;return r.length===1?n=[r[0],r[0]]:n=[r[0],r[1]],n},t.prototype.calculator=function(e,r,n){return n.map(function(i){return i.value})},t}(),uf=function(){function t(){this.mixer=Do}return t.prototype.parser=function(e){var r=Io(ie(e)?[e]:e),n;return r.length===1?n=[r[0],r[0],r[0],r[0]]:r.length===2?n=[r[0],r[1],r[0],r[1]]:r.length===3?n=[r[0],r[1],r[2],r[1]]:n=[r[0],r[1],r[2],r[3]],n},t.prototype.calculator=function(e,r,n){return n.map(function(i){return i.value})},t}(),er=nt();function Ri(t,e){var r=e.parsedStyle.defX||0,n=e.parsedStyle.defY||0;return e.resetLocalTransform(),e.setLocalPosition(r,n),t.forEach(function(i){var a=i.t,o=i.d;if(a==="scale"){var s=(o==null?void 0:o.map(function(E){return E.value}))||[1,1];e.scaleLocal(s[0],s[1],1)}else if(a==="scalex"){var s=(o==null?void 0:o.map(function(M){return M.value}))||[1];e.scaleLocal(s[0],1,1)}else if(a==="scaley"){var s=(o==null?void 0:o.map(function(M){return M.value}))||[1];e.scaleLocal(1,s[0],1)}else if(a==="scalez"){var s=(o==null?void 0:o.map(function(M){return M.value}))||[1];e.scaleLocal(1,1,s[0])}else if(a==="scale3d"){var s=(o==null?void 0:o.map(function(M){return M.value}))||[1,1,1];e.scaleLocal(s[0],s[1],s[2])}else if(a==="translate"){var c=o||[dt,dt];e.translateLocal(c[0].value,c[1].value,0)}else if(a==="translatex"){var c=o||[dt];e.translateLocal(c[0].value,0,0)}else if(a==="translatey"){var c=o||[dt];e.translateLocal(0,c[0].value,0)}else if(a==="translatez"){var c=o||[dt];e.translateLocal(0,0,c[0].value)}else if(a==="translate3d"){var c=o||[dt,dt,dt];e.translateLocal(c[0].value,c[1].value,c[2].value)}else if(a==="rotate"){var l=o||[ce];e.rotateLocal(0,0,At(l[0]))}else if(a==="rotatex"){var l=o||[ce];e.rotateLocal(At(l[0]),0,0)}else if(a==="rotatey"){var l=o||[ce];e.rotateLocal(0,At(l[0]),0)}else if(a==="rotatez"){var l=o||[ce];e.rotateLocal(0,0,At(l[0]))}else if(a!=="rotate3d")if(a==="skew"){var u=(o==null?void 0:o.map(function(E){return E.value}))||[0,0];e.setLocalSkew(ut(u[0]),ut(u[1]))}else if(a==="skewx"){var u=(o==null?void 0:o.map(function(M){return M.value}))||[0];e.setLocalSkew(ut(u[0]),e.getLocalSkew()[1])}else if(a==="skewy"){var u=(o==null?void 0:o.map(function(M){return M.value}))||[0];e.setLocalSkew(e.getLocalSkew()[0],ut(u[0]))}else if(a==="matrix"){var f=_(o.map(function(E){return E.value}),6),h=f[0],v=f[1],p=f[2],y=f[3],d=f[4],m=f[5];e.setLocalTransform(qn(er,h,v,0,0,p,y,0,0,0,0,1,0,d+r,m+n,0,1))}else a==="matrix3d"&&(qn.apply(dc,X([er],_(o.map(function(E){return E.value})),!1)),er[12]+=r,er[13]+=n,e.setLocalTransform(er))}),e.getLocalTransform()}var ff=function(t){z(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.postProcessor=function(r,n){var i,a,o;switch(r.nodeName){case R.CIRCLE:case R.ELLIPSE:var s=r.parsedStyle,c=s.cx,l=s.cy,u=s.cz;F(c)||(i=c),F(l)||(a=l),F(u)||(o=u);break;case R.LINE:var f=r.parsedStyle,h=f.x1,v=f.x2,p=f.y1,y=f.y2,d=Math.min(h,v),m=Math.min(p,y);i=d,a=m,o=0;break;case R.RECT:case R.IMAGE:case R.GROUP:case R.HTML:case R.TEXT:case R.MESH:F(r.parsedStyle.x)||(i=r.parsedStyle.x),F(r.parsedStyle.y)||(a=r.parsedStyle.y),F(r.parsedStyle.z)||(o=r.parsedStyle.z);break}r.nodeName!==R.PATH&&r.nodeName!==R.POLYLINE&&r.nodeName!==R.POLYGON&&(r.parsedStyle.defX=i||0,r.parsedStyle.defY=a||0);var E=!F(i)||!F(a)||!F(o);if(E&&n.indexOf("transform")===-1){var M=r.parsedStyle.transform;if(M&&M.length)Ri(M,r);else{var P=_(r.getLocalPosition(),3),x=P[0],g=P[1],T=P[2];r.setLocalPosition(F(i)?x:i,F(a)?g:a,F(o)?T:o)}}},e}(Ni),hf=function(){function t(){}return t.prototype.calculator=function(e,r,n,i){n instanceof Ct&&(n=null);var a=n==null?void 0:n.cloneNode(!0);return a&&(a.style.isMarker=!0),a},t}(),vf=function(){function t(){this.mixer=bi,this.parser=Pr,this.parserWithCSSDisabled=null}return t.prototype.calculator=function(e,r,n){return n.value},t}(),df=function(){function t(){this.parser=Pr,this.parserWithCSSDisabled=null,this.mixer=Ci(0,1)}return t.prototype.calculator=function(e,r,n){return n.value},t.prototype.postProcessor=function(e){var r=e.parsedStyle,n=r.offsetPath,i=r.offsetDistance;if(n){var a=n.nodeName;if(a===R.LINE||a===R.PATH||a===R.POLYLINE){var o=n.getPoint(i);o&&(e.parsedStyle.defX=o.x,e.parsedStyle.defY=o.y,e.setLocalPosition(o.x,o.y))}}},t}(),pf=function(){function t(){this.parser=Pr,this.parserWithCSSDisabled=null,this.mixer=Ci(0,1)}return t.prototype.calculator=function(e,r,n){return n.value},t}(),yf=function(){function t(){this.parser=li,this.parserWithCSSDisabled=li,this.mixer=Xu}return t.prototype.calculator=function(e,r,n){return n instanceof Ct&&n.value==="unset"?{absolutePath:[],hasArc:!1,segments:[],polygons:[],polylines:[],curve:null,totalLength:0,rect:new ke(0,0,0,0)}:n},t.prototype.postProcessor=function(e,r){if(e.parsedStyle.defX=e.parsedStyle.path.rect.x,e.parsedStyle.defY=e.parsedStyle.path.rect.y,e.nodeName===R.PATH&&r.indexOf("transform")===-1){var n=e.parsedStyle,i=n.defX,a=i===void 0?0:i,o=n.defY,s=o===void 0?0:o;e.setLocalPosition(a,s)}},t}(),gf=function(){function t(){this.parser=Bo,this.mixer=Vu}return t.prototype.postProcessor=function(e,r){if((e.nodeName===R.POLYGON||e.nodeName===R.POLYLINE)&&r.indexOf("transform")===-1){var n=e.parsedStyle,i=n.defX,a=n.defY;e.setLocalPosition(i,a)}},t}(),mf=function(t){z(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.mixer=Ci(0,1/0),r}return e}(Ni),xf=function(){function t(){}return t.prototype.calculator=function(e,r,n,i){return n instanceof Ct?n.value==="unset"?"":n.value:"".concat(n)},t.prototype.postProcessor=function(e){e.nodeValue="".concat(e.parsedStyle.text)||""},t}(),Ef=function(){function t(){}return t.prototype.calculator=function(e,r,n,i){var a=i.getAttribute("text");if(a){var o=a;n.value==="capitalize"?o=a.charAt(0).toUpperCase()+a.slice(1):n.value==="lowercase"?o=a.toLowerCase():n.value==="uppercase"&&(o=a.toUpperCase()),i.parsedStyle.text=o}return n.value},t}(),Gn={},Mf=0;function Pf(t,e){if(t){var r=typeof t=="string"?t:t.id||Mf++;Gn[r]&&Gn[r].destroy(),Gn[r]=e}}var Tr=typeof window<"u"&&typeof window.document<"u";function Tf(t){return!!t.getAttribute}function wf(t,e){for(var r=0,n=t.length;r>>1;Uo(t[i],e)<0?r=i+1:n=i}return r}function Uo(t,e){var r=Number(t.parsedStyle.zIndex),n=Number(e.parsedStyle.zIndex);if(r===n){var i=t.parentNode;if(i){var a=i.childNodes||[];return a.indexOf(t)-a.indexOf(e)}}return r-n}function Yo(t){var e,r=t;do{var n=(e=r.parsedStyle)===null||e===void 0?void 0:e.clipPath;if(n)return r;r=r.parentElement}while(r!==null);return null}var wa="px";function bf(t,e,r){Tr&&t.style&&(t.style.width=e+wa,t.style.height=r+wa)}function Ho(t,e){if(Tr)return document.defaultView.getComputedStyle(t,null).getPropertyValue(e)}function Cf(t){var e=Ho(t,"width");return e==="auto"?t.offsetWidth:parseFloat(e)}function Sf(t){var e=Ho(t,"height");return e==="auto"?t.offsetHeight:parseFloat(e)}var Nf=1,Rf={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},fi=typeof performance=="object"&&performance.now?performance:Date;function _e(t,e,r){var n=!1,i=!1,a=!!e&&!e.isNone,o=!!r&&!r.isNone;return t==="visiblepainted"||t==="painted"||t==="auto"?(n=a,i=o):t==="visiblefill"||t==="fill"?n=!0:t==="visiblestroke"||t==="stroke"?i=!0:(t==="visible"||t==="all")&&(n=!0,i=!0),[n,i]}var Af=1,Of=function(){return Af++},ne=typeof self=="object"&&self.self==self?self:typeof global=="object"&&global.global==global?global:{},kf=Date.now(),If=function(){return ne.performance&&typeof ne.performance.now=="function"?ne.performance.now():Date.now()-kf},ar={},ba=Date.now(),Lf=function(t){if(typeof t!="function")throw new TypeError(t+" is not a function");var e=Date.now(),r=e-ba,n=r>16?0:16-r,i=Of();return ar[i]=t,Object.keys(ar).length>1||setTimeout(function(){ba=e;var a=ar;ar={},Object.keys(a).forEach(function(o){return a[o](If())})},n),i},_f=function(t){delete ar[t]},Df=["","webkit","moz","ms","o"],Wo=function(t){return typeof t!="string"?Lf:t===""?ne.requestAnimationFrame:ne[t+"RequestAnimationFrame"]},Ff=function(t){return typeof t!="string"?_f:t===""?ne.cancelAnimationFrame:ne[t+"CancelAnimationFrame"]||ne[t+"CancelRequestAnimationFrame"]},Bf=function(t,e){for(var r=0;t[r]!==void 0;){if(e(t[r]))return t[r];r=r+1}},zo=Bf(Df,function(t){return!!Wo(t)}),Xo=Wo(zo),Vo=Ff(zo);ne.requestAnimationFrame=Xo;ne.cancelAnimationFrame=Vo;var Gf=function(){function t(){this.callbacks=[]}return t.prototype.getCallbacksNum=function(){return this.callbacks.length},t.prototype.tapPromise=function(e,r){this.callbacks.push(r)},t.prototype.promise=function(){for(var e=[],r=0;r=0;c--){var l=s[c].trim();!Hf.test(l)&&Yf.indexOf(l)<0&&(l='"'.concat(l,'"')),s[c]=l}return"".concat(n," ").concat(i," ").concat(a," ").concat(o," ").concat(s.join(","))}var zf=function(){function t(){this.parser=hn,this.parserWithCSSDisabled=hn,this.mixer=ef}return t.prototype.calculator=function(e,r,n,i){return n instanceof Ct?[]:n},t.prototype.postProcessor=function(e){var r=e.parsedStyle.transform;Ri(r,e)},t}(),Xf=function(){function t(){this.parser=Go}return t}(),Vf=function(){function t(){this.parser=Pr}return t.prototype.calculator=function(e,r,n,i){return n.value},t.prototype.postProcessor=function(e){if(e.parentNode){var r=e.parentNode,n=r.renderable,i=r.sortable;n&&(n.dirty=!0),i&&(i.dirty=!0,i.dirtyReason=Qe.Z_INDEX_CHANGED)}},t}(),qf=function(){function t(){}return t.prototype.update=function(e,r){var n=e.r,i=n*2,a=n*2;return{width:i,height:a}},t}(),$f=function(){function t(){}return t.prototype.update=function(e,r){var n=e.rx,i=e.ry,a=n*2,o=i*2;return{width:a,height:o}},t}(),Kf=function(){function t(){}return t.prototype.update=function(e){var r=e.x1,n=e.y1,i=e.x2,a=e.y2,o=Math.min(r,i),s=Math.max(r,i),c=Math.min(n,a),l=Math.max(n,a),u=s-o,f=l-c;return{width:u,height:f}},t}(),Zf=function(){function t(){}return t.prototype.update=function(e){var r=e.path,n=r.rect,i=n.width,a=n.height;return{width:i,height:a}},t}(),Qf=function(){function t(){}return t.prototype.update=function(e){if(e.points&&Mi(e.points.points)){var r=e.points.points,n=Math.min.apply(Math,X([],_(r.map(function(l){return l[0]})),!1)),i=Math.max.apply(Math,X([],_(r.map(function(l){return l[0]})),!1)),a=Math.min.apply(Math,X([],_(r.map(function(l){return l[1]})),!1)),o=Math.max.apply(Math,X([],_(r.map(function(l){return l[1]})),!1)),s=i-n,c=o-a;return{width:s,height:c}}return{width:0,height:0}},t}(),Jf=function(){function t(){}return t.prototype.update=function(e,r){var n=e.img,i=e.width,a=i===void 0?0:i,o=e.height,s=o===void 0?0:o,c=a,l=s;return n&&!bt(n)&&(c||(c=n.width,e.width=c),l||(l=n.height,e.height=l)),{width:c,height:l}},t}(),jf=function(){function t(e){this.globalRuntime=e}return t.prototype.isReadyToMeasure=function(e,r){var n=e.text,i=e.textAlign,a=e.textBaseline,o=e.fontSize,s=e.fontStyle,c=e.fontWeight,l=e.fontVariant,u=e.lineWidth;return n&&o&&s&&c&&l&&i&&a&&!F(u)},t.prototype.update=function(e,r){var n,i,a=e.text,o=e.textAlign,s=e.lineWidth,c=e.textBaseline,l=e.dx,u=e.dy;if(!this.isReadyToMeasure(e,r))return e.metrics={font:"",width:0,height:0,lines:[],lineWidths:[],lineHeight:0,maxLineWidth:0,fontProperties:{ascent:0,descent:0,fontSize:0},lineMetrics:[]},{width:0,height:0,x:0,y:0,offsetX:0,offsetY:0};var f=(((i=(n=r==null?void 0:r.ownerDocument)===null||n===void 0?void 0:n.defaultView)===null||i===void 0?void 0:i.getConfig())||{}).offscreenCanvas,h=this.globalRuntime.textService.measureText(a,e,f);e.metrics=h;var v=h.width,p=h.height,y=h.lineHeight,d=h.fontProperties,m=[v/2,p/2,0],E=[0,1],M=0;o==="center"||o==="middle"?(M=s/2,E=[.5,1]):(o==="right"||o==="end")&&(M=s,E=[1,1]);var P=0;return c==="middle"?P=m[1]:c==="top"||c==="hanging"?P=m[1]*2:c==="alphabetic"?P=this.globalRuntime.enableCSSParsing?y-d.ascent:0:(c==="bottom"||c==="ideographic")&&(P=0),l&&(M+=l),u&&(P+=u),e.anchor=[E[0],E[1],0],{width:m[0]*2,height:m[1]*2,offsetX:M,offsetY:P}},t}();function th(t){return!!t.type}var xn=function(){function t(e){this.eventPhase=t.prototype.NONE,this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.defaultPrevented=!1,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new pt,this.page=new pt,this.canvas=new pt,this.viewport=new pt,this.composed=!1,this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=e}return Object.defineProperty(t.prototype,"name",{get:function(){return this.type},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"layerX",{get:function(){return this.layer.x},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"layerY",{get:function(){return this.layer.y},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pageX",{get:function(){return this.page.x},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pageY",{get:function(){return this.page.y},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"x",{get:function(){return this.canvas.x},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"y",{get:function(){return this.canvas.y},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"canvasX",{get:function(){return this.canvas.x},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"canvasY",{get:function(){return this.canvas.y},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"viewportX",{get:function(){return this.viewport.x},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"viewportY",{get:function(){return this.viewport.y},enumerable:!1,configurable:!0}),t.prototype.composedPath=function(){return this.manager&&(!this.path||this.path[0]!==this.target)&&(this.path=this.target?this.manager.propagationPath(this.target):[]),this.path},Object.defineProperty(t.prototype,"propagationPath",{get:function(){return this.composedPath()},enumerable:!1,configurable:!0}),t.prototype.preventDefault=function(){this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault(),this.defaultPrevented=!0},t.prototype.stopImmediatePropagation=function(){this.propagationImmediatelyStopped=!0},t.prototype.stopPropagation=function(){this.propagationStopped=!0},t.prototype.initEvent=function(){},t.prototype.initUIEvent=function(){},t.prototype.clone=function(){throw new Error(J)},t}(),qo=function(t){z(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.client=new pt,r.movement=new pt,r.offset=new pt,r.global=new pt,r.screen=new pt,r}return Object.defineProperty(e.prototype,"clientX",{get:function(){return this.client.x},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"clientY",{get:function(){return this.client.y},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"movementX",{get:function(){return this.movement.x},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"movementY",{get:function(){return this.movement.y},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"offsetX",{get:function(){return this.offset.x},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"offsetY",{get:function(){return this.offset.y},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"globalX",{get:function(){return this.global.x},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"globalY",{get:function(){return this.global.y},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"screenX",{get:function(){return this.screen.x},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"screenY",{get:function(){return this.screen.y},enumerable:!1,configurable:!0}),e.prototype.getModifierState=function(r){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(r)},e.prototype.initMouseEvent=function(){throw new Error(J)},e}(xn),hi=function(t){z(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.width=0,r.height=0,r.isPrimary=!1,r}return e.prototype.getCoalescedEvents=function(){return this.type==="pointermove"||this.type==="mousemove"||this.type==="touchmove"?[this]:[]},e.prototype.getPredictedEvents=function(){throw new Error("getPredictedEvents is not supported!")},e.prototype.clone=function(){return this.manager.clonePointerEvent(this)},e}(qo),vi=function(t){z(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.clone=function(){return this.manager.cloneWheelEvent(this)},e}(qo),mt=function(t){z(e,t);function e(r,n){var i=t.call(this,null)||this;return i.type=r,i.detail=n,Object.assign(i,n),i}return e}(xn),Ca=":",$o=function(){function t(){this.emitter=new Ei}return t.prototype.on=function(e,r,n){return this.addEventListener(e,r,n),this},t.prototype.addEventListener=function(e,r,n){var i=Vi(n)&&n||jr(n)&&n.capture,a=jr(n)&&n.once,o=We(r)?void 0:r,s=!1,c="";if(e.indexOf(Ca)>-1){var l=_(e.split(Ca),2),u=l[0],f=l[1];e=f,c=u,s=!0}if(e=i?"".concat(e,"capture"):e,r=We(r)?r:r.handleEvent,s){var h=r;r=function(){for(var v,p=[],y=0;y0},e.prototype.isDefaultNamespace=function(r){throw new Error(J)},e.prototype.lookupNamespaceURI=function(r){throw new Error(J)},e.prototype.lookupPrefix=function(r){throw new Error(J)},e.prototype.normalize=function(){throw new Error(J)},e.prototype.isEqualNode=function(r){return this===r},e.prototype.isSameNode=function(r){return this.isEqualNode(r)},Object.defineProperty(e.prototype,"parent",{get:function(){return this.parentNode},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"parentElement",{get:function(){return null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"nextSibling",{get:function(){return null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"previousSibling",{get:function(){return null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"firstChild",{get:function(){return this.childNodes.length>0?this.childNodes[0]:null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lastChild",{get:function(){return this.childNodes.length>0?this.childNodes[this.childNodes.length-1]:null},enumerable:!1,configurable:!0}),e.prototype.compareDocumentPosition=function(r){var n;if(r===this)return 0;for(var i=r,a=this,o=[i],s=[a];(n=i.parentNode)!==null&&n!==void 0?n:a.parentNode;)i=i.parentNode?(o.push(i.parentNode),i.parentNode):i,a=a.parentNode?(s.push(a.parentNode),a.parentNode):a;if(i!==a)return e.DOCUMENT_POSITION_DISCONNECTED|e.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC|e.DOCUMENT_POSITION_PRECEDING;var c=o.length>s.length?o:s,l=c===o?s:o;if(c[c.length-l.length]===l[0])return c===o?e.DOCUMENT_POSITION_CONTAINED_BY|e.DOCUMENT_POSITION_FOLLOWING:e.DOCUMENT_POSITION_CONTAINS|e.DOCUMENT_POSITION_PRECEDING;for(var u=c.length-l.length,f=l.length-1;f>=0;f--){var h=l[f],v=c[u+f];if(v!==h){var p=h.parentNode.childNodes;return p.indexOf(h)0&&n;)n=n.parentNode,r--;return n},e.prototype.forEach=function(r,n){n===void 0&&(n=!1),r(this)||(n?this.childNodes.slice():this.childNodes).forEach(function(i){i.forEach(r)})},e.DOCUMENT_POSITION_DISCONNECTED=1,e.DOCUMENT_POSITION_PRECEDING=2,e.DOCUMENT_POSITION_FOLLOWING=4,e.DOCUMENT_POSITION_CONTAINS=8,e.DOCUMENT_POSITION_CONTAINED_BY=16,e.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC=32,e}($o),eh=2048,rh=function(){function t(e,r){var n=this;this.globalRuntime=e,this.context=r,this.emitter=new Ei,this.cursor="default",this.mappingTable={},this.mappingState={trackingData:{}},this.eventPool=new Map,this.tmpMatrix=nt(),this.tmpVec3=q(),this.onPointerDown=function(i){var a=n.createPointerEvent(i);if(n.dispatchEvent(a,"pointerdown"),a.pointerType==="touch")n.dispatchEvent(a,"touchstart");else if(a.pointerType==="mouse"||a.pointerType==="pen"){var o=a.button===2;n.dispatchEvent(a,o?"rightdown":"mousedown")}var s=n.trackingData(i.pointerId);s.pressTargetsByButton[i.button]=a.composedPath(),n.freeEvent(a)},this.onPointerUp=function(i){var a,o=fi.now(),s=n.createPointerEvent(i,void 0,void 0,n.context.config.alwaysTriggerPointerEventOnCanvas?n.rootTarget:void 0);if(n.dispatchEvent(s,"pointerup"),s.pointerType==="touch")n.dispatchEvent(s,"touchend");else if(s.pointerType==="mouse"||s.pointerType==="pen"){var c=s.button===2;n.dispatchEvent(s,c?"rightup":"mouseup")}var l=n.trackingData(i.pointerId),u=n.findMountedTarget(l.pressTargetsByButton[i.button]),f=u;if(u&&!s.composedPath().includes(u)){for(var h=u;h&&!s.composedPath().includes(h);){if(s.currentTarget=h,n.notifyTarget(s,"pointerupoutside"),s.pointerType==="touch")n.notifyTarget(s,"touchendoutside");else if(s.pointerType==="mouse"||s.pointerType==="pen"){var c=s.button===2;n.notifyTarget(s,c?"rightupoutside":"mouseupoutside")}yt.isNode(h)&&(h=h.parentNode)}delete l.pressTargetsByButton[i.button],f=h}if(f){var v=n.clonePointerEvent(s,"click");v.target=f,v.path=[],l.clicksByButton[i.button]||(l.clicksByButton[i.button]={clickCount:0,target:v.target,timeStamp:o});var p=l.clicksByButton[i.button];p.target===v.target&&o-p.timeStamp<200?++p.clickCount:p.clickCount=1,p.target=v.target,p.timeStamp=o,v.detail=p.clickCount,!((a=s.detail)===null||a===void 0)&&a.preventClick||(!n.context.config.useNativeClickEvent&&(v.pointerType==="mouse"||v.pointerType==="touch")&&n.dispatchEvent(v,"click"),n.dispatchEvent(v,"pointertap")),n.freeEvent(v)}n.freeEvent(s)},this.onPointerMove=function(i){var a=n.createPointerEvent(i,void 0,void 0,n.context.config.alwaysTriggerPointerEventOnCanvas?n.rootTarget:void 0),o=a.pointerType==="mouse"||a.pointerType==="pen",s=n.trackingData(i.pointerId),c=n.findMountedTarget(s.overTargets);if(s.overTargets&&c!==a.target){var l=i.type==="mousemove"?"mouseout":"pointerout",u=n.createPointerEvent(i,l,c||void 0);if(n.dispatchEvent(u,"pointerout"),o&&n.dispatchEvent(u,"mouseout"),!a.composedPath().includes(c)){var f=n.createPointerEvent(i,"pointerleave",c||void 0);for(f.eventPhase=f.AT_TARGET;f.target&&!a.composedPath().includes(f.target);)f.currentTarget=f.target,n.notifyTarget(f),o&&n.notifyTarget(f,"mouseleave"),yt.isNode(f.target)&&(f.target=f.target.parentNode);n.freeEvent(f)}n.freeEvent(u)}if(c!==a.target){var h=i.type==="mousemove"?"mouseover":"pointerover",v=n.clonePointerEvent(a,h);n.dispatchEvent(v,"pointerover"),o&&n.dispatchEvent(v,"mouseover");for(var p=c&&yt.isNode(c)&&c.parentNode;p&&p!==(yt.isNode(n.rootTarget)&&n.rootTarget.parentNode)&&p!==a.target;)p=p.parentNode;var y=!p||p===(yt.isNode(n.rootTarget)&&n.rootTarget.parentNode);if(y){var d=n.clonePointerEvent(a,"pointerenter");for(d.eventPhase=d.AT_TARGET;d.target&&d.target!==c&&d.target!==(yt.isNode(n.rootTarget)&&n.rootTarget.parentNode);)d.currentTarget=d.target,n.notifyTarget(d),o&&n.notifyTarget(d,"mouseenter"),yt.isNode(d.target)&&(d.target=d.target.parentNode);n.freeEvent(d)}n.freeEvent(v)}n.dispatchEvent(a,"pointermove"),a.pointerType==="touch"&&n.dispatchEvent(a,"touchmove"),o&&(n.dispatchEvent(a,"mousemove"),n.cursor=n.getCursor(a.target)),s.overTargets=a.composedPath(),n.freeEvent(a)},this.onPointerOut=function(i){var a=n.trackingData(i.pointerId);if(a.overTargets){var o=i.pointerType==="mouse"||i.pointerType==="pen",s=n.findMountedTarget(a.overTargets),c=n.createPointerEvent(i,"pointerout",s||void 0);n.dispatchEvent(c),o&&n.dispatchEvent(c,"mouseout");var l=n.createPointerEvent(i,"pointerleave",s||void 0);for(l.eventPhase=l.AT_TARGET;l.target&&l.target!==(yt.isNode(n.rootTarget)&&n.rootTarget.parentNode);)l.currentTarget=l.target,n.notifyTarget(l),o&&n.notifyTarget(l,"mouseleave"),yt.isNode(l.target)&&(l.target=l.target.parentNode);a.overTargets=null,n.freeEvent(c),n.freeEvent(l)}n.cursor=null},this.onPointerOver=function(i){var a=n.trackingData(i.pointerId),o=n.createPointerEvent(i),s=o.pointerType==="mouse"||o.pointerType==="pen";n.dispatchEvent(o,"pointerover"),s&&n.dispatchEvent(o,"mouseover"),o.pointerType==="mouse"&&(n.cursor=n.getCursor(o.target));var c=n.clonePointerEvent(o,"pointerenter");for(c.eventPhase=c.AT_TARGET;c.target&&c.target!==(yt.isNode(n.rootTarget)&&n.rootTarget.parentNode);)c.currentTarget=c.target,n.notifyTarget(c),s&&n.notifyTarget(c,"mouseenter"),yt.isNode(c.target)&&(c.target=c.target.parentNode);a.overTargets=o.composedPath(),n.freeEvent(o),n.freeEvent(c)},this.onPointerUpOutside=function(i){var a=n.trackingData(i.pointerId),o=n.findMountedTarget(a.pressTargetsByButton[i.button]),s=n.createPointerEvent(i);if(o){for(var c=o;c;)s.currentTarget=c,n.notifyTarget(s,"pointerupoutside"),s.pointerType==="touch"||(s.pointerType==="mouse"||s.pointerType==="pen")&&n.notifyTarget(s,s.button===2?"rightupoutside":"mouseupoutside"),yt.isNode(c)&&(c=c.parentNode);delete a.pressTargetsByButton[i.button]}n.freeEvent(s)},this.onWheel=function(i){var a=n.createWheelEvent(i);n.dispatchEvent(a),n.freeEvent(a)},this.onClick=function(i){if(n.context.config.useNativeClickEvent){var a=n.createPointerEvent(i);n.dispatchEvent(a),n.freeEvent(a)}},this.onPointerCancel=function(i){var a=n.createPointerEvent(i,void 0,void 0,n.context.config.alwaysTriggerPointerEventOnCanvas?n.rootTarget:void 0);n.dispatchEvent(a),n.freeEvent(a)}}return t.prototype.init=function(){this.rootTarget=this.context.renderingContext.root.parentNode,this.addEventMapping("pointerdown",this.onPointerDown),this.addEventMapping("pointerup",this.onPointerUp),this.addEventMapping("pointermove",this.onPointerMove),this.addEventMapping("pointerout",this.onPointerOut),this.addEventMapping("pointerleave",this.onPointerOut),this.addEventMapping("pointercancel",this.onPointerCancel),this.addEventMapping("pointerover",this.onPointerOver),this.addEventMapping("pointerupoutside",this.onPointerUpOutside),this.addEventMapping("wheel",this.onWheel),this.addEventMapping("click",this.onClick)},t.prototype.destroy=function(){this.emitter.removeAllListeners(),this.mappingTable={},this.mappingState={},this.eventPool.clear()},t.prototype.client2Viewport=function(e){var r=this.context.contextService.getBoundingClientRect();return new pt(e.x-((r==null?void 0:r.left)||0),e.y-((r==null?void 0:r.top)||0))},t.prototype.viewport2Client=function(e){var r=this.context.contextService.getBoundingClientRect();return new pt(e.x+((r==null?void 0:r.left)||0),e.y+((r==null?void 0:r.top)||0))},t.prototype.viewport2Canvas=function(e){var r=e.x,n=e.y,i=this.rootTarget.defaultView,a=i.getCamera(),o=this.context.config,s=o.width,c=o.height,l=a.getPerspectiveInverse(),u=a.getWorldTransform(),f=Et(this.tmpMatrix,u,l),h=qt(this.tmpVec3,r/s*2-1,(1-n/c)*2-1,0);return Ut(h,h,f),new pt(h[0],h[1])},t.prototype.canvas2Viewport=function(e){var r=this.rootTarget.defaultView,n=r.getCamera(),i=n.getPerspective(),a=n.getViewTransform(),o=Et(this.tmpMatrix,i,a),s=qt(this.tmpVec3,e.x,e.y,0);Ut(this.tmpVec3,this.tmpVec3,o);var c=this.context.config,l=c.width,u=c.height;return new pt((s[0]+1)/2*l,(1-(s[1]+1)/2)*u)},t.prototype.setPickHandler=function(e){this.pickHandler=e},t.prototype.addEventMapping=function(e,r){this.mappingTable[e]||(this.mappingTable[e]=[]),this.mappingTable[e].push({fn:r,priority:0}),this.mappingTable[e].sort(function(n,i){return n.priority-i.priority})},t.prototype.mapEvent=function(e){if(this.rootTarget){var r=this.mappingTable[e.type];if(r)for(var n=0,i=r.length;n=1;i--)if(e.currentTarget=n[i],this.notifyTarget(e,r),e.propagationStopped||e.propagationImmediatelyStopped)return;if(e.eventPhase=e.AT_TARGET,e.currentTarget=e.target,this.notifyTarget(e,r),!(e.propagationStopped||e.propagationImmediatelyStopped)){var a=n.indexOf(e.currentTarget);e.eventPhase=e.BUBBLING_PHASE;for(var i=a+1;ia||n>o?null:!s&&this.pickHandler(e)||this.rootTarget||null},t.prototype.isNativeEventFromCanvas=function(e){var r,n=this.context.contextService.getDomElement(),i=(r=e.nativeEvent)===null||r===void 0?void 0:r.target;if(i){if(i===n)return!0;if(n&&n.contains)return n.contains(i)}return e.nativeEvent.composedPath?e.nativeEvent.composedPath().indexOf(n)>-1:!1},t.prototype.getExistedHTML=function(e){var r,n;if(e.nativeEvent.composedPath)try{for(var i=de(e.nativeEvent.composedPath()),a=i.next();!a.done;a=i.next()){var o=a.value,s=this.globalRuntime.nativeHTMLMap.get(o);if(s)return s}}catch(c){r={error:c}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return null},t.prototype.pickTarget=function(e){return this.hitTest({clientX:e.clientX,clientY:e.clientY,viewportX:e.viewportX,viewportY:e.viewportY,x:e.canvasX,y:e.canvasY})},t.prototype.createPointerEvent=function(e,r,n,i){var a=this.allocateEvent(hi);this.copyPointerData(e,a),this.copyMouseData(e,a),this.copyData(e,a),a.nativeEvent=e.nativeEvent,a.originalEvent=e;var o=this.getExistedHTML(a);return a.target=n??(o||this.isNativeEventFromCanvas(a)&&this.pickTarget(a)||i),typeof r=="string"&&(a.type=r),a},t.prototype.createWheelEvent=function(e){var r=this.allocateEvent(vi);this.copyWheelData(e,r),this.copyMouseData(e,r),this.copyData(e,r),r.nativeEvent=e.nativeEvent,r.originalEvent=e;var n=this.getExistedHTML(r);return r.target=n||this.isNativeEventFromCanvas(r)&&this.pickTarget(r),r},t.prototype.trackingData=function(e){return this.mappingState.trackingData[e]||(this.mappingState.trackingData[e]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[e]},t.prototype.cloneWheelEvent=function(e){var r=this.allocateEvent(vi);return r.nativeEvent=e.nativeEvent,r.originalEvent=e.originalEvent,this.copyWheelData(e,r),this.copyMouseData(e,r),this.copyData(e,r),r.target=e.target,r.path=e.composedPath().slice(),r.type=e.type,r},t.prototype.clonePointerEvent=function(e,r){var n=this.allocateEvent(hi);return n.nativeEvent=e.nativeEvent,n.originalEvent=e.originalEvent,this.copyPointerData(e,n),this.copyMouseData(e,n),this.copyData(e,n),n.target=e.target,n.path=e.composedPath().slice(),n.type=r??n.type,n},t.prototype.copyPointerData=function(e,r){r.pointerId=e.pointerId,r.width=e.width,r.height=e.height,r.isPrimary=e.isPrimary,r.pointerType=e.pointerType,r.pressure=e.pressure,r.tangentialPressure=e.tangentialPressure,r.tiltX=e.tiltX,r.tiltY=e.tiltY,r.twist=e.twist},t.prototype.copyMouseData=function(e,r){r.altKey=e.altKey,r.button=e.button,r.buttons=e.buttons,r.ctrlKey=e.ctrlKey,r.metaKey=e.metaKey,r.shiftKey=e.shiftKey,r.client.copyFrom(e.client),r.movement.copyFrom(e.movement),r.canvas.copyFrom(e.canvas),r.screen.copyFrom(e.screen),r.global.copyFrom(e.global),r.offset.copyFrom(e.offset)},t.prototype.copyWheelData=function(e,r){r.deltaMode=e.deltaMode,r.deltaX=e.deltaX,r.deltaY=e.deltaY,r.deltaZ=e.deltaZ},t.prototype.copyData=function(e,r){r.isTrusted=e.isTrusted,r.timeStamp=fi.now(),r.type=e.type,r.detail=e.detail,r.view=e.view,r.page.copyFrom(e.page),r.viewport.copyFrom(e.viewport)},t.prototype.allocateEvent=function(e){this.eventPool.has(e)||this.eventPool.set(e,[]);var r=this.eventPool.get(e).pop()||new e(this);return r.eventPhase=r.NONE,r.currentTarget=null,r.path=[],r.target=null,r},t.prototype.freeEvent=function(e){if(e.manager!==this)throw new Error("It is illegal to free an event not managed by this EventBoundary!");var r=e.constructor;this.eventPool.has(r)||this.eventPool.set(r,[]),this.eventPool.get(r).push(e)},t.prototype.notifyTarget=function(e,r){r=r??e.type;var n=e.eventPhase===e.CAPTURING_PHASE||e.eventPhase===e.AT_TARGET?"".concat(r,"capture"):r;this.notifyListeners(e,n),e.eventPhase===e.AT_TARGET&&this.notifyListeners(e,r)},t.prototype.notifyListeners=function(e,r){var n=e.currentTarget.emitter,i=n._events[r];if(i)if("fn"in i)i.once&&n.removeListener(r,i.fn,void 0,!0),i.fn.call(e.currentTarget||i.context,e);else for(var a=0;a=0;n--){var i=e[n];if(i===this.rootTarget||yt.isNode(i)&&i.parentNode===r)r=e[n];else break}return r},t.prototype.getCursor=function(e){for(var r=e;r;){var n=Tf(r)&&r.getAttribute("cursor");if(n)return n;r=yt.isNode(r)&&r.parentNode}},t}(),nh=function(){function t(){}return t.prototype.getOrCreateCanvas=function(e,r){if(this.canvas)return this.canvas;if(e||A.offscreenCanvas)this.canvas=e||A.offscreenCanvas,this.context=this.canvas.getContext("2d",r);else try{this.canvas=new window.OffscreenCanvas(0,0),this.context=this.canvas.getContext("2d",r),(!this.context||!this.context.measureText)&&(this.canvas=document.createElement("canvas"),this.context=this.canvas.getContext("2d"))}catch{this.canvas=document.createElement("canvas"),this.context=this.canvas.getContext("2d",r)}return this.canvas.width=10,this.canvas.height=10,this.canvas},t.prototype.getOrCreateContext=function(e,r){return this.context?this.context:(this.getOrCreateCanvas(e,r),this.context)},t}(),ge;(function(t){t[t.CAMERA_CHANGED=0]="CAMERA_CHANGED",t[t.DISPLAY_OBJECT_CHANGED=1]="DISPLAY_OBJECT_CHANGED",t[t.NONE=2]="NONE"})(ge||(ge={}));var ih=function(){function t(e,r){this.globalRuntime=e,this.context=r,this.inited=!1,this.stats={total:0,rendered:0},this.zIndexCounter=0,this.hooks={init:new xt,initAsync:new Gf,dirtycheck:new Un,cull:new Un,beginFrame:new xt,beforeRender:new xt,render:new xt,afterRender:new xt,endFrame:new xt,destroy:new xt,pick:new Uf,pickSync:new Un,pointerDown:new xt,pointerUp:new xt,pointerMove:new xt,pointerOut:new xt,pointerOver:new xt,pointerWheel:new xt,pointerCancel:new xt,click:new xt}}return t.prototype.init=function(e){var r=this,n=U(U({},this.globalRuntime),this.context);this.context.renderingPlugins.forEach(function(i){i.apply(n,r.globalRuntime)}),this.hooks.init.call(),this.hooks.initAsync.getCallbacksNum()===0?(this.inited=!0,e()):this.hooks.initAsync.promise().then(function(){r.inited=!0,e()})},t.prototype.getStats=function(){return this.stats},t.prototype.disableDirtyRectangleRendering=function(){var e=this.context.config.renderer,r=e.getConfig().enableDirtyRectangleRendering;return!r||this.context.renderingContext.renderReasons.has(ge.CAMERA_CHANGED)},t.prototype.render=function(e,r){var n=this;this.stats.total=0,this.stats.rendered=0,this.zIndexCounter=0;var i=this.context.renderingContext;if(this.globalRuntime.sceneGraphService.syncHierarchy(i.root),this.globalRuntime.sceneGraphService.triggerPendingEvents(),i.renderReasons.size&&this.inited){i.dirtyRectangleRenderingDisabled=this.disableDirtyRectangleRendering();var a=i.renderReasons.size===1&&i.renderReasons.has(ge.CAMERA_CHANGED),o=!e.disableRenderHooks||!(e.disableRenderHooks&&a);o&&this.renderDisplayObject(i.root,e,i),this.hooks.beginFrame.call(),o&&i.renderListCurrentFrame.forEach(function(s){n.hooks.beforeRender.call(s),n.hooks.render.call(s),n.hooks.afterRender.call(s)}),this.hooks.endFrame.call(),i.renderListCurrentFrame=[],i.renderReasons.clear(),r()}},t.prototype.renderDisplayObject=function(e,r,n){var i=this,a=r.renderer.getConfig(),o=a.enableDirtyCheck,s=a.enableCulling;this.globalRuntime.enableCSSParsing&&this.globalRuntime.styleValueRegistry.recalc(e);var c=e.renderable,l=o?c.dirty||n.dirtyRectangleRenderingDisabled?e:null:e;if(l){var u=s?this.hooks.cull.call(l,this.context.camera):l;u&&(this.stats.rendered++,n.renderListCurrentFrame.push(u))}e.renderable.dirty=!1,e.sortable.renderOrder=this.zIndexCounter++,this.stats.total++;var f=e.sortable;f.dirty&&(this.sort(e,f),f.dirty=!1,f.dirtyChildren=[],f.dirtyReason=void 0),(f.sorted||e.childNodes).forEach(function(h){i.renderDisplayObject(h,r,n)})},t.prototype.sort=function(e,r){r.sorted&&r.dirtyReason!==Qe.Z_INDEX_CHANGED?r.dirtyChildren.forEach(function(n){var i=e.childNodes.indexOf(n);if(i===-1){var a=r.sorted.indexOf(n);a>=0&&r.sorted.splice(a,1)}else if(r.sorted.length===0)r.sorted.push(n);else{var o=wf(r.sorted,n);r.sorted.splice(o,0,n)}}):r.sorted=e.childNodes.slice().sort(Uo)},t.prototype.destroy=function(){this.inited=!1,this.hooks.destroy.call(),this.globalRuntime.sceneGraphService.clearPendingEvents()},t.prototype.dirtify=function(){this.context.renderingContext.renderReasons.add(ge.DISPLAY_OBJECT_CHANGED)},t}(),ah=/\[\s*(.*)=(.*)\s*\]/,oh=function(){function t(){}return t.prototype.selectOne=function(e,r){var n=this;if(e.startsWith("."))return r.find(function(s){return((s==null?void 0:s.classList)||[]).indexOf(n.getIdOrClassname(e))>-1});if(e.startsWith("#"))return r.find(function(s){return s.id===n.getIdOrClassname(e)});if(e.startsWith("[")){var i=this.getAttribute(e),a=i.name,o=i.value;return a?r.find(function(s){return r!==s&&(a==="name"?s.name===o:n.attributeToString(s,a)===o)}):null}else return r.find(function(s){return r!==s&&s.nodeName===e})},t.prototype.selectAll=function(e,r){var n=this;if(e.startsWith("."))return r.findAll(function(s){return r!==s&&((s==null?void 0:s.classList)||[]).indexOf(n.getIdOrClassname(e))>-1});if(e.startsWith("#"))return r.findAll(function(s){return r!==s&&s.id===n.getIdOrClassname(e)});if(e.startsWith("[")){var i=this.getAttribute(e),a=i.name,o=i.value;return a?r.findAll(function(s){return r!==s&&(a==="name"?s.name===o:n.attributeToString(s,a)===o)}):[]}else return r.findAll(function(s){return r!==s&&s.nodeName===e})},t.prototype.is=function(e,r){if(e.startsWith("."))return r.className===this.getIdOrClassname(e);if(e.startsWith("#"))return r.id===this.getIdOrClassname(e);if(e.startsWith("[")){var n=this.getAttribute(e),i=n.name,a=n.value;return i==="name"?r.name===a:this.attributeToString(r,i)===a}else return r.nodeName===e},t.prototype.getIdOrClassname=function(e){return e.substring(1)},t.prototype.getAttribute=function(e){var r=e.match(ah),n="",i="";return r&&r.length>2&&(n=r[1].replace(/"/g,""),i=r[2].replace(/"/g,"")),{name:n,value:i}},t.prototype.attributeToString=function(e,r){if(!e.getAttribute)return"";var n=e.getAttribute(r);return F(n)?"":n.toString?n.toString():""},t}(),Ie=function(t){z(e,t);function e(r,n,i,a,o,s,c,l){var u=t.call(this,null)||this;return u.relatedNode=n,u.prevValue=i,u.newValue=a,u.attrName=o,u.attrChange=s,u.prevParsedValue=c,u.newParsedValue=l,u.type=r,u}return e.ADDITION=2,e.MODIFICATION=1,e.REMOVAL=3,e}(xn),$;(function(t){t.REPARENT="reparent",t.DESTROY="destroy",t.ATTR_MODIFIED="DOMAttrModified",t.INSERTED="DOMNodeInserted",t.REMOVED="removed",t.MOUNTED="DOMNodeInsertedIntoDocument",t.UNMOUNTED="DOMNodeRemovedFromDocument",t.BOUNDS_CHANGED="bounds-changed",t.CULLED="culled"})($||($={}));function Sa(t){var e=t.renderable;e&&(e.renderBoundsDirty=!0,e.boundsDirty=!0)}var sh=new Ie($.REPARENT,null,"","","",0,"",""),ch=function(){function t(e){var r=this;this.runtime=e,this.pendingEvents=[],this.boundsChangedEvent=new mt($.BOUNDS_CHANGED),this.rotate=function(){var n=gt();return function(i,a,o,s){o===void 0&&(o=0),s===void 0&&(s=0),typeof a=="number"&&(a=j(a,o,s));var c=i.transformable;if(i.parentNode===null||!i.parentNode.transformable)r.rotateLocal(i,a);else{var l=gt();Ar(l,a[0],a[1],a[2]);var u=r.getRotation(i),f=r.getRotation(i.parentNode);Or(n,f),Cn(n,n),Xe(l,n,l),Xe(c.localRotation,l,u),on(c.localRotation,c.localRotation),r.dirtifyLocal(i,c)}}}(),this.rotateLocal=function(){var n=gt();return function(i,a,o,s){o===void 0&&(o=0),s===void 0&&(s=0),typeof a=="number"&&(a=j(a,o,s));var c=i.transformable;Ar(n,a[0],a[1],a[2]),Wi(c.localRotation,c.localRotation,n),r.dirtifyLocal(i,c)}}(),this.setEulerAngles=function(){var n=gt();return function(i,a,o,s){o===void 0&&(o=0),s===void 0&&(s=0),typeof a=="number"&&(a=j(a,o,s));var c=i.transformable;if(i.parentNode===null||!i.parentNode.transformable)r.setLocalEulerAngles(i,a);else{Ar(c.localRotation,a[0],a[1],a[2]);var l=r.getRotation(i.parentNode);Or(n,Cn(gt(),l)),Wi(c.localRotation,c.localRotation,n),r.dirtifyLocal(i,c)}}}(),this.translateLocal=function(){return function(n,i,a,o){a===void 0&&(a=0),o===void 0&&(o=0),typeof i=="number"&&(i=j(i,a,o));var s=n.transformable;je(i,q())||(Ec(i,i,s.localRotation),$n(s.localPosition,s.localPosition,i),r.dirtifyLocal(n,s))}}(),this.setPosition=function(){var n=nt(),i=q();return function(a,o){var s=a.transformable;if(i[0]=o[0],i[1]=o[1],i[2]=o[2]||0,!je(r.getPosition(a),i)){if(pe(s.position,i),a.parentNode===null||!a.parentNode.transformable)pe(s.localPosition,i);else{var c=a.parentNode.transformable;Ke(n,c.worldTransform),jt(n,n),Ut(s.localPosition,i,n)}r.dirtifyLocal(a,s)}}}(),this.setLocalPosition=function(){var n=q();return function(i,a){var o=i.transformable;n[0]=a[0],n[1]=a[1],n[2]=a[2]||0,!je(o.localPosition,n)&&(pe(o.localPosition,n),r.dirtifyLocal(i,o))}}(),this.translate=function(){var n=q(),i=q(),a=q();return function(o,s,c,l){c===void 0&&(c=0),l===void 0&&(l=0),typeof s=="number"&&(s=qt(i,s,c,l)),!je(s,n)&&($n(a,r.getPosition(o),s),r.setPosition(o,a))}}(),this.setRotation=function(){var n=gt();return function(i,a,o,s,c){var l=i.transformable;if(typeof a=="number"&&(a=Sn(a,o,s,c)),i.parentNode===null||!i.parentNode.transformable)r.setLocalRotation(i,a);else{var u=r.getRotation(i.parentNode);Or(n,u),Cn(n,n),Xe(l.localRotation,n,a),on(l.localRotation,l.localRotation),r.dirtifyLocal(i,l)}}},this.displayObjectDependencyMap=new WeakMap,this.calcLocalTransform=function(){var n=nt(),i=q(),a=Sn(0,0,0,1);return function(o){var s=o.localSkew[0]!==0||o.localSkew[1]!==0;if(s){if(cr(o.localTransform,o.localRotation,o.localPosition,j(1,1,1),o.origin),o.localSkew[0]!==0||o.localSkew[1]!==0){var c=Er(n);c[4]=Math.tan(o.localSkew[0]),c[1]=Math.tan(o.localSkew[1]),Et(o.localTransform,o.localTransform,c)}var l=cr(n,a,i,o.localScale,o.origin);Et(o.localTransform,o.localTransform,l)}else cr(o.localTransform,o.localRotation,o.localPosition,o.localScale,o.origin)}}()}return t.prototype.matches=function(e,r){return this.runtime.sceneGraphSelector.is(e,r)},t.prototype.querySelector=function(e,r){return this.runtime.sceneGraphSelector.selectOne(e,r)},t.prototype.querySelectorAll=function(e,r){return this.runtime.sceneGraphSelector.selectAll(e,r)},t.prototype.attach=function(e,r,n){var i,a,o=!1;e.parentNode&&(o=e.parentNode!==r,this.detach(e)),e.parentNode=r,F(n)?e.parentNode.childNodes.push(e):e.parentNode.childNodes.splice(n,0,e);var s=r.sortable;(!((i=s==null?void 0:s.sorted)===null||i===void 0)&&i.length||!((a=e.style)===null||a===void 0)&&a.zIndex)&&(s.dirtyChildren.indexOf(e)===-1&&s.dirtyChildren.push(e),s.dirty=!0,s.dirtyReason=Qe.ADDED);var c=e.transformable;c&&this.dirtifyWorld(e,c),c.frozen&&this.unfreezeParentToRoot(e),o&&e.dispatchEvent(sh)},t.prototype.detach=function(e){var r,n;if(e.parentNode){var i=e.transformable,a=e.parentNode.sortable;(!((r=a==null?void 0:a.sorted)===null||r===void 0)&&r.length||!((n=e.style)===null||n===void 0)&&n.zIndex)&&(a.dirtyChildren.indexOf(e)===-1&&a.dirtyChildren.push(e),a.dirty=!0,a.dirtyReason=Qe.REMOVED);var o=e.parentNode.childNodes.indexOf(e);o>-1&&e.parentNode.childNodes.splice(o,1),i&&this.dirtifyWorld(e,i),e.parentNode=null}},t.prototype.getOrigin=function(e){return e.transformable.origin},t.prototype.setOrigin=function(e,r,n,i){n===void 0&&(n=0),i===void 0&&(i=0),typeof r=="number"&&(r=[r,n,i]);var a=e.transformable;if(!(r[0]===a.origin[0]&&r[1]===a.origin[1]&&r[2]===a.origin[2])){var o=a.origin;o[0]=r[0],o[1]=r[1],o[2]=r[2]||0,this.dirtifyLocal(e,a)}},t.prototype.setLocalEulerAngles=function(e,r,n,i){n===void 0&&(n=0),i===void 0&&(i=0),typeof r=="number"&&(r=j(r,n,i));var a=e.transformable;Ar(a.localRotation,r[0],r[1],r[2]),this.dirtifyLocal(e,a)},t.prototype.scaleLocal=function(e,r){var n=e.transformable;yc(n.localScale,n.localScale,j(r[0],r[1],r[2]||1)),this.dirtifyLocal(e,n)},t.prototype.setLocalScale=function(e,r){var n=e.transformable,i=j(r[0],r[1],r[2]||n.localScale[2]);je(i,n.localScale)||(pe(n.localScale,i),this.dirtifyLocal(e,n))},t.prototype.setLocalRotation=function(e,r,n,i,a){typeof r=="number"&&(r=Sn(r,n,i,a));var o=e.transformable;Or(o.localRotation,r),this.dirtifyLocal(e,o)},t.prototype.setLocalSkew=function(e,r,n){typeof r=="number"&&(r=Cc(r,n));var i=e.transformable;Sc(i.localSkew,r),this.dirtifyLocal(e,i)},t.prototype.dirtifyLocal=function(e,r){r.localDirtyFlag||(r.localDirtyFlag=!0,r.dirtyFlag||this.dirtifyWorld(e,r))},t.prototype.dirtifyWorld=function(e,r){r.dirtyFlag||this.unfreezeParentToRoot(e),this.dirtifyWorldInternal(e,r),this.dirtifyToRoot(e,!0)},t.prototype.triggerPendingEvents=function(){var e=this,r=new Set,n=function(i,a){i.isConnected&&!r.has(i.entity)&&(e.boundsChangedEvent.detail=a,e.boundsChangedEvent.target=i,i.isMutationObserved?i.dispatchEvent(e.boundsChangedEvent):i.ownerDocument.defaultView.dispatchEvent(e.boundsChangedEvent,!0),r.add(i.entity))};this.pendingEvents.forEach(function(i){var a=_(i,2),o=a[0],s=a[1];s.affectChildren?o.forEach(function(c){n(c,s)}):n(o,s)}),this.clearPendingEvents(),r.clear()},t.prototype.clearPendingEvents=function(){this.pendingEvents=[]},t.prototype.dirtifyToRoot=function(e,r){r===void 0&&(r=!1);var n=e;for(n.renderable&&(n.renderable.dirty=!0);n;)Sa(n),n=n.parentNode;r&&e.forEach(function(i){Sa(i)}),this.informDependentDisplayObjects(e),this.pendingEvents.push([e,{affectChildren:r}])},t.prototype.updateDisplayObjectDependency=function(e,r,n,i){if(r&&r!==n){var a=this.displayObjectDependencyMap.get(r);if(a&&a[e]){var o=a[e].indexOf(i);a[e].splice(o,1)}}if(n){var s=this.displayObjectDependencyMap.get(n);s||(this.displayObjectDependencyMap.set(n,{}),s=this.displayObjectDependencyMap.get(n)),s[e]||(s[e]=[]),s[e].push(i)}},t.prototype.informDependentDisplayObjects=function(e){var r=this,n=this.displayObjectDependencyMap.get(e);n&&Object.keys(n).forEach(function(i){n[i].forEach(function(a){r.dirtifyToRoot(a,!0),a.dispatchEvent(new Ie($.ATTR_MODIFIED,a,r,r,i,Ie.MODIFICATION,r,r)),a.isCustomElement&&a.isConnected&&a.attributeChangedCallback&&a.attributeChangedCallback(i,r,r)})})},t.prototype.getPosition=function(e){var r=e.transformable;return nn(r.position,this.getWorldTransform(e,r))},t.prototype.getRotation=function(e){var r=e.transformable;return an(r.rotation,this.getWorldTransform(e,r))},t.prototype.getScale=function(e){var r=e.transformable;return Ze(r.scaling,this.getWorldTransform(e,r))},t.prototype.getWorldTransform=function(e,r){return r===void 0&&(r=e.transformable),!r.localDirtyFlag&&!r.dirtyFlag||(e.parentNode&&e.parentNode.transformable&&this.getWorldTransform(e.parentNode),this.sync(e,r)),r.worldTransform},t.prototype.getLocalPosition=function(e){return e.transformable.localPosition},t.prototype.getLocalRotation=function(e){return e.transformable.localRotation},t.prototype.getLocalScale=function(e){return e.transformable.localScale},t.prototype.getLocalSkew=function(e){return e.transformable.localSkew},t.prototype.getLocalTransform=function(e){var r=e.transformable;return r.localDirtyFlag&&(this.calcLocalTransform(r),r.localDirtyFlag=!1),r.localTransform},t.prototype.setLocalTransform=function(e,r){var n=nn(q(),r),i=an(gt(),r),a=Ze(q(),r);this.setLocalScale(e,a),this.setLocalPosition(e,n),this.setLocalRotation(e,i)},t.prototype.resetLocalTransform=function(e){this.setLocalScale(e,[1,1,1]),this.setLocalPosition(e,[0,0,0]),this.setLocalEulerAngles(e,[0,0,0]),this.setLocalSkew(e,[0,0])},t.prototype.getTransformedGeometryBounds=function(e,r,n){r===void 0&&(r=!1);var i=this.getGeometryBounds(e,r);if(ht.isEmpty(i))return null;var a=n||new ht;return a.setFromTransformedAABB(i,this.getWorldTransform(e)),a},t.prototype.getGeometryBounds=function(e,r){r===void 0&&(r=!1);var n=e.geometry,i=r?n.renderBounds:n.contentBounds||null;return i||new ht},t.prototype.getBounds=function(e,r){var n=this;r===void 0&&(r=!1);var i=e.renderable;if(!i.boundsDirty&&!r&&i.bounds)return i.bounds;if(!i.renderBoundsDirty&&r&&i.renderBounds)return i.renderBounds;var a=r?i.renderBounds:i.bounds,o=this.getTransformedGeometryBounds(e,r,a),s=e.childNodes;if(s.forEach(function(u){var f=n.getBounds(u,r);f&&(o?o.add(f):(o=a||new ht,o.update(f.center,f.halfExtents)))}),r){var c=Yo(e);if(c){var l=c.parsedStyle.clipPath.getBounds(r);o?l&&(o=l.intersection(o)):o=l}}return o||(o=new ht),o&&(r?i.renderBounds=o:i.bounds=o),r?i.renderBoundsDirty=!1:i.boundsDirty=!1,o},t.prototype.getLocalBounds=function(e){if(e.parentNode){var r=nt();e.parentNode.transformable&&(r=jt(nt(),this.getWorldTransform(e.parentNode)));var n=this.getBounds(e);if(!ht.isEmpty(n)){var i=new ht;return i.setFromTransformedAABB(n,r),i}}return this.getBounds(e)},t.prototype.getBoundingClientRect=function(e){var r,n,i,a=this.getGeometryBounds(e);ht.isEmpty(a)||(i=new ht,i.setFromTransformedAABB(a,this.getWorldTransform(e)));var o=(n=(r=e.ownerDocument)===null||r===void 0?void 0:r.defaultView)===null||n===void 0?void 0:n.getContextService().getBoundingClientRect();if(i){var s=_(i.getMin(),2),c=s[0],l=s[1],u=_(i.getMax(),2),f=u[0],h=u[1];return new ke(c+((o==null?void 0:o.left)||0),l+((o==null?void 0:o.top)||0),f-c,h-l)}return new ke((o==null?void 0:o.left)||0,(o==null?void 0:o.top)||0,0,0)},t.prototype.dirtifyWorldInternal=function(e,r){var n=this;if(!r.dirtyFlag){r.dirtyFlag=!0,r.frozen=!1,e.childNodes.forEach(function(a){var o=a.transformable;o.dirtyFlag||n.dirtifyWorldInternal(a,o)});var i=e.renderable;i&&(i.renderBoundsDirty=!0,i.boundsDirty=!0,i.dirty=!0)}},t.prototype.syncHierarchy=function(e){var r=e.transformable;if(!r.frozen){r.frozen=!0,(r.localDirtyFlag||r.dirtyFlag)&&this.sync(e,r);for(var n=e.childNodes,i=0;ic;--v){for(var d=0;d=l){r.isOverflowing=!0;break}d=0,p[y]="";continue}if(d>0&&d+b>h){if(y+1>=l){if(r.isOverflowing=!0,M>0&&M<=h){for(var C=p[y].length,S=0,N=C,O=0;Oh){N=O;break}S+=k}p[y]=(p[y]||"").slice(0,N)+v}break}if(y++,d=0,p[y]="",this.isBreakingSpace(g))continue;this.canBreakInLastChar(g)||(p=this.trimToBreakable(p),d=this.sumTextWidthByCache(p[y]||"",m)),this.shouldBreakByKinsokuShorui(g,w)&&(p=this.trimByKinsokuShorui(p),d+=E(T||""))}d+=b,p[y]=(p[y]||"")+g}return p.join(` -`)},t.prototype.isBreakingSpace=function(e){return typeof e!="string"?!1:Ne.BreakingSpaces.indexOf(e.charCodeAt(0))>=0},t.prototype.isNewline=function(e){return typeof e!="string"?!1:Ne.Newlines.indexOf(e.charCodeAt(0))>=0},t.prototype.trimToBreakable=function(e){var r=X([],_(e),!1),n=r[r.length-2],i=this.findBreakableIndex(n);if(i===-1||!n)return r;var a=n.slice(i,i+1),o=this.isBreakingSpace(a),s=i+1,c=i+(o?0:1);return r[r.length-1]+=n.slice(s,n.length),r[r.length-2]=n.slice(0,c),r},t.prototype.canBreakInLastChar=function(e){return!(e&&Na.test(e))},t.prototype.sumTextWidthByCache=function(e,r){return e.split("").reduce(function(n,i){if(!r[i])throw Error("cannot count the word without cache");return n+r[i]},0)},t.prototype.findBreakableIndex=function(e){for(var r=e.length-1;r>=0;r--)if(!Na.test(e[r]))return r;return-1},t.prototype.getFromCache=function(e,r,n,i){var a=n[e];if(typeof a!="number"){var o=e.length*r;a=i.measureText(e).width+o,n[e]=a}return a},t}(),A={},Eh=function(){var t,e=new Jf,r=new Qf;return t={},t[R.CIRCLE]=new qf,t[R.ELLIPSE]=new $f,t[R.RECT]=e,t[R.IMAGE]=e,t[R.GROUP]=e,t[R.LINE]=new Kf,t[R.TEXT]=new jf(A),t[R.POLYLINE]=r,t[R.POLYGON]=r,t[R.PATH]=new Zf,t[R.HTML]=null,t[R.MESH]=null,t}(),Mh=function(){var t,e=new sf,r=new Ni;return t={},t[D.PERCENTAGE]=null,t[D.NUMBER]=new vf,t[D.ANGLE]=new af,t[D.DEFINED_PATH]=new of,t[D.PAINT]=e,t[D.COLOR]=e,t[D.FILTER]=new cf,t[D.LENGTH]=r,t[D.LENGTH_PERCENTAGE]=r,t[D.LENGTH_PERCENTAGE_12]=new lf,t[D.LENGTH_PERCENTAGE_14]=new uf,t[D.COORDINATE]=new ff,t[D.OFFSET_DISTANCE]=new df,t[D.OPACITY_VALUE]=new pf,t[D.PATH]=new yf,t[D.LIST_OF_POINTS]=new gf,t[D.SHADOW_BLUR]=new mf,t[D.TEXT]=new xf,t[D.TEXT_TRANSFORM]=new Ef,t[D.TRANSFORM]=new zf,t[D.TRANSFORM_ORIGIN]=new Xf,t[D.Z_INDEX]=new Vf,t[D.MARKER]=new hf,t}(),Ph=function(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}};A.CameraContribution=iu;A.AnimationTimeline=null;A.EasingFunction=null;A.offscreenCanvasCreator=new nh;A.nativeHTMLMap=new WeakMap;A.sceneGraphSelector=new oh;A.sceneGraphService=new ch(A);A.textService=new xh(A);A.geometryUpdaterFactory=Eh;A.CSSPropertySyntaxFactory=Mh;A.styleValueRegistry=new nf(A);A.layoutRegistry=null;A.globalThis=Ph();A.enableCSSParsing=!0;A.enableDataset=!1;A.enableStyleSyntax=!0;var Th=0,Ra=new Ie($.INSERTED,null,"","","",0,"",""),Aa=new Ie($.REMOVED,null,"","","",0,"",""),wh=new mt($.DESTROY),bh=function(t){z(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.entity=Th++,r.renderable={bounds:void 0,boundsDirty:!0,renderBounds:void 0,renderBoundsDirty:!0,dirtyRenderBounds:void 0,dirty:!1},r.cullable={strategy:oi.Standard,visibilityPlaneMask:-1,visible:!0,enable:!0},r.transformable={dirtyFlag:!1,localDirtyFlag:!1,frozen:!1,localPosition:[0,0,0],localRotation:[0,0,0,1],localScale:[1,1,1],localTransform:[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],localSkew:[0,0],position:[0,0,0],rotation:[0,0,0,1],scaling:[1,1,1],worldTransform:[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],origin:[0,0,0]},r.sortable={dirty:!1,sorted:void 0,renderOrder:0,dirtyChildren:[],dirtyReason:void 0},r.geometry={contentBounds:void 0,renderBounds:void 0},r.rBushNode={aabb:void 0},r.namespaceURI="g",r.scrollLeft=0,r.scrollTop=0,r.clientTop=0,r.clientLeft=0,r.destroyed=!1,r.style={},r.computedStyle=A.enableCSSParsing?{anchor:tt,opacity:tt,fillOpacity:tt,strokeOpacity:tt,fill:tt,stroke:tt,transform:tt,transformOrigin:tt,visibility:tt,pointerEvents:tt,lineWidth:tt,lineCap:tt,lineJoin:tt,increasedLineWidthForHitTesting:tt,fontSize:tt,fontFamily:tt,fontStyle:tt,fontWeight:tt,fontVariant:tt,textAlign:tt,textBaseline:tt,textTransform:tt,zIndex:tt,filter:tt,shadowType:tt}:null,r.parsedStyle={},r.attributes={},r}return Object.defineProperty(e.prototype,"className",{get:function(){return this.getAttribute("class")||""},set:function(r){this.setAttribute("class",r)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"classList",{get:function(){return this.className.split(" ").filter(function(r){return r!==""})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"tagName",{get:function(){return this.nodeName},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"children",{get:function(){return this.childNodes},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"childElementCount",{get:function(){return this.childNodes.length},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"firstElementChild",{get:function(){return this.firstChild},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lastElementChild",{get:function(){return this.lastChild},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"parentElement",{get:function(){return this.parentNode},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"nextSibling",{get:function(){if(this.parentNode){var r=this.parentNode.childNodes.indexOf(this);return this.parentNode.childNodes[r+1]||null}return null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"previousSibling",{get:function(){if(this.parentNode){var r=this.parentNode.childNodes.indexOf(this);return this.parentNode.childNodes[r-1]||null}return null},enumerable:!1,configurable:!0}),e.prototype.cloneNode=function(r){throw new Error(J)},e.prototype.appendChild=function(r,n){var i;if(r.destroyed)throw new Error(nu);return A.sceneGraphService.attach(r,this,n),!((i=this.ownerDocument)===null||i===void 0)&&i.defaultView&&this.ownerDocument.defaultView.mountChildren(r),Ra.relatedNode=this,r.dispatchEvent(Ra),r},e.prototype.insertBefore=function(r,n){if(!n)this.appendChild(r);else{r.parentElement&&r.parentElement.removeChild(r);var i=this.childNodes.indexOf(n);i===-1?this.appendChild(r):this.appendChild(r,i)}return r},e.prototype.replaceChild=function(r,n){var i=this.childNodes.indexOf(n);return this.removeChild(n),this.appendChild(r,i),n},e.prototype.removeChild=function(r){var n;return Aa.relatedNode=this,r.dispatchEvent(Aa),!((n=r.ownerDocument)===null||n===void 0)&&n.defaultView&&r.ownerDocument.defaultView.unmountChildren(r),A.sceneGraphService.detach(r),r},e.prototype.removeChildren=function(){for(var r=this.childNodes.length-1;r>=0;r--){var n=this.childNodes[r];this.removeChild(n)}},e.prototype.destroyChildren=function(){for(var r=this.childNodes.length-1;r>=0;r--){var n=this.childNodes[r];n.childNodes.length&&n.destroyChildren(),n.destroy()}},e.prototype.matches=function(r){return A.sceneGraphService.matches(r,this)},e.prototype.getElementById=function(r){return A.sceneGraphService.querySelector("#".concat(r),this)},e.prototype.getElementsByName=function(r){return A.sceneGraphService.querySelectorAll('[name="'.concat(r,'"]'),this)},e.prototype.getElementsByClassName=function(r){return A.sceneGraphService.querySelectorAll(".".concat(r),this)},e.prototype.getElementsByTagName=function(r){return A.sceneGraphService.querySelectorAll(r,this)},e.prototype.querySelector=function(r){return A.sceneGraphService.querySelector(r,this)},e.prototype.querySelectorAll=function(r){return A.sceneGraphService.querySelectorAll(r,this)},e.prototype.closest=function(r){var n=this;do{if(A.sceneGraphService.matches(r,n))return n;n=n.parentElement}while(n!==null);return null},e.prototype.find=function(r){var n=this,i=null;return this.forEach(function(a){return a!==n&&r(a)?(i=a,!0):!1}),i},e.prototype.findAll=function(r){var n=this,i=[];return this.forEach(function(a){a!==n&&r(a)&&i.push(a)}),i},e.prototype.after=function(){for(var r=this,n=[],i=0;i1){var i=r[0].currentPoint,a=r[1].currentPoint,o=r[1].startTangent;n=[],o?(n.push([i[0]-o[0],i[1]-o[1]]),n.push([i[0],i[1]])):(n.push([a[0],a[1]]),n.push([i[0],i[1]]))}return n},e.prototype.getEndTangent=function(){var r=this.parsedStyle.path.segments,n=r.length,i=[];if(n>1){var a=r[n-2].currentPoint,o=r[n-1].currentPoint,s=r[n-1].endTangent;i=[],s?(i.push([o[0]-s[0],o[1]-s[1]]),i.push([o[0],o[1]])):(i.push([a[0],a[1]]),i.push([o[0],o[1]]))}return i},e}(_t),Qo=function(t){z(e,t);function e(r){var n=this;r===void 0&&(r={});var i=r.style,a=Yt(r,["style"]);n=t.call(this,U({type:R.POLYGON,style:A.enableCSSParsing?U({points:"",miterLimit:"",isClosed:!0},i):U({},i),initialParsedStyle:A.enableCSSParsing?null:{points:{points:[],totalLength:0,segments:[]},miterLimit:4,isClosed:!0}},a))||this,n.markerStartAngle=0,n.markerEndAngle=0,n.markerMidList=[];var o=n.parsedStyle,s=o.markerStart,c=o.markerEnd,l=o.markerMid;return s&&K(s)&&(n.markerStartAngle=s.getLocalEulerAngles(),n.appendChild(s)),l&&K(l)&&n.placeMarkerMid(l),c&&K(c)&&(n.markerEndAngle=c.getLocalEulerAngles(),n.appendChild(c)),n.transformMarker(!0),n.transformMarker(!1),n}return e.prototype.attributeChangedCallback=function(r,n,i,a,o){r==="points"?(this.transformMarker(!0),this.transformMarker(!1),this.placeMarkerMid(this.parsedStyle.markerMid)):r==="markerStartOffset"||r==="markerEndOffset"?(this.transformMarker(!0),this.transformMarker(!1)):r==="markerStart"?(a&&K(a)&&(this.markerStartAngle=0,a.remove()),o&&K(o)&&(this.markerStartAngle=o.getLocalEulerAngles(),this.appendChild(o),this.transformMarker(!0))):r==="markerEnd"?(a&&K(a)&&(this.markerEndAngle=0,a.remove()),o&&K(o)&&(this.markerEndAngle=o.getLocalEulerAngles(),this.appendChild(o),this.transformMarker(!1))):r==="markerMid"&&this.placeMarkerMid(o)},e.prototype.transformMarker=function(r){var n=this.parsedStyle,i=n.markerStart,a=n.markerEnd,o=n.markerStartOffset,s=n.markerEndOffset,c=n.points,l=n.defX,u=n.defY,f=(c||{}).points,h=r?i:a;if(!(!h||!K(h)||!f)){var v=0,p,y,d,m,E,M;if(d=f[0][0]-l,m=f[0][1]-u,r)p=f[1][0]-f[0][0],y=f[1][1]-f[0][1],E=o||0,M=this.markerStartAngle;else{var P=f.length;this.parsedStyle.isClosed?(p=f[P-1][0]-f[0][0],y=f[P-1][1]-f[0][1]):(d=f[P-1][0]-l,m=f[P-1][1]-u,p=f[P-2][0]-f[P-1][0],y=f[P-2][1]-f[P-1][1]),E=s||0,M=this.markerEndAngle}v=Math.atan2(y,p),h.setLocalEulerAngles(v*180/Math.PI+M),h.setLocalPosition(d+Math.cos(v)*E,m+Math.sin(v)*E)}},e.prototype.placeMarkerMid=function(r){var n=this.parsedStyle,i=n.points,a=n.defX,o=n.defY,s=(i||{}).points;if(this.markerMidList.forEach(function(h){h.remove()}),this.markerMidList=[],r&&K(r)&&s)for(var c=1;c<(this.parsedStyle.isClosed?s.length:s.length-1);c++){var l=s[c][0]-a,u=s[c][1]-o,f=c===1?r:r.cloneNode(!0);this.markerMidList.push(f),this.appendChild(f),f.setLocalPosition(l,u)}},e}(_t),kh=function(t){z(e,t);function e(r){r===void 0&&(r={});var n=r.style,i=Yt(r,["style"]);return t.call(this,U({type:R.POLYLINE,style:A.enableCSSParsing?U({points:"",miterLimit:"",isClosed:!1},n):U({},n),initialParsedStyle:A.enableCSSParsing?null:{points:{points:[],totalLength:0,segments:[]},miterLimit:4,isClosed:!1}},i))||this}return e.prototype.getTotalLength=function(){return this.parsedStyle.points.totalLength},e.prototype.getPointAtLength=function(r,n){return n===void 0&&(n=!1),this.getPoint(r/this.getTotalLength(),n)},e.prototype.getPoint=function(r,n){n===void 0&&(n=!1);var i=this.parsedStyle,a=i.defX,o=i.defY,s=i.points,c=s.points,l=s.segments,u=0,f=0;l.forEach(function(d,m){r>=d[0]&&r<=d[1]&&(u=(r-d[0])/(d[1]-d[0]),f=m)});var h=Co(c[f][0],c[f][1],c[f+1][0],c[f+1][1],u),v=h.x,p=h.y,y=Ut(q(),j(v-a,p-o,0),n?this.getWorldTransform():this.getLocalTransform());return new pt(y[0],y[1])},e.prototype.getStartTangent=function(){var r=this.parsedStyle.points.points,n=[];return n.push([r[1][0],r[1][1]]),n.push([r[0][0],r[0][1]]),n},e.prototype.getEndTangent=function(){var r=this.parsedStyle.points.points,n=r.length-1,i=[];return i.push([r[n-1][0],r[n-1][1]]),i.push([r[n][0],r[n][1]]),i},e}(Qo),Jo=function(t){z(e,t);function e(r){r===void 0&&(r={});var n=r.style,i=Yt(r,["style"]);return t.call(this,U({type:R.RECT,style:A.enableCSSParsing?U({x:"",y:"",width:"",height:"",radius:""},n):U({},n)},i))||this}return e}(_t),jo=function(t){z(e,t);function e(r){r===void 0&&(r={});var n=r.style,i=Yt(r,["style"]);return t.call(this,U({type:R.TEXT,style:A.enableCSSParsing?U({x:"",y:"",text:"",fontSize:"",fontFamily:"",fontStyle:"",fontWeight:"",fontVariant:"",textAlign:"",textBaseline:"",textTransform:"",fill:"black",letterSpacing:"",lineHeight:"",miterLimit:"",wordWrap:!1,wordWrapWidth:0,leading:0,dx:"",dy:""},n):U({fill:"black"},n),initialParsedStyle:A.enableCSSParsing?{}:{x:0,y:0,fontSize:16,fontFamily:"sans-serif",fontStyle:"normal",fontWeight:"normal",fontVariant:"normal",lineHeight:0,letterSpacing:0,textBaseline:"alphabetic",textAlign:"start",wordWrap:!1,wordWrapWidth:0,leading:0,dx:0,dy:0}},i))||this}return e.prototype.getComputedTextLength=function(){var r;return((r=this.parsedStyle.metrics)===null||r===void 0?void 0:r.maxLineWidth)||0},e.prototype.getLineBoundingRects=function(){var r;return((r=this.parsedStyle.metrics)===null||r===void 0?void 0:r.lineMetrics)||[]},e.prototype.isOverflowing=function(){return!!this.parsedStyle.isOverflowing},e}(_t),Ih=function(){function t(){this.registry={},this.define(R.CIRCLE,xe),this.define(R.ELLIPSE,Ah),this.define(R.RECT,Jo),this.define(R.IMAGE,Zo),this.define(R.LINE,Ai),this.define(R.GROUP,di),this.define(R.PATH,En),this.define(R.POLYGON,Qo),this.define(R.POLYLINE,kh),this.define(R.TEXT,jo),this.define(R.HTML,Oh)}return t.prototype.define=function(e,r){this.registry[e]=r},t.prototype.get=function(e){return this.registry[e]},t}(),Lh=function(t){z(e,t);function e(){var r=t.call(this)||this;r.defaultView=null,r.ownerDocument=null,r.nodeName="document";try{r.timeline=new A.AnimationTimeline(r)}catch{}var n={};return Si.forEach(function(i){var a=i.n,o=i.inh,s=i.d;o&&s&&(n[a]=We(s)?s(R.GROUP):s)}),r.documentElement=new di({id:"g-root",style:n}),r.documentElement.ownerDocument=r,r.documentElement.parentNode=r,r.childNodes=[r.documentElement],r}return Object.defineProperty(e.prototype,"children",{get:function(){return this.childNodes},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"childElementCount",{get:function(){return this.childNodes.length},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"firstElementChild",{get:function(){return this.firstChild},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lastElementChild",{get:function(){return this.lastChild},enumerable:!1,configurable:!0}),e.prototype.createElement=function(r,n){if(r==="svg")return this.documentElement;var i=this.defaultView.customElements.get(r);i||(console.warn("Unsupported tagName: ",r),i=r==="tspan"?jo:di);var a=new i(n);return a.ownerDocument=this,a},e.prototype.createElementNS=function(r,n,i){return this.createElement(n,i)},e.prototype.cloneNode=function(r){throw new Error(J)},e.prototype.destroy=function(){try{this.documentElement.destroyChildren(),this.timeline.destroy()}catch{}},e.prototype.elementsFromBBox=function(r,n,i,a){var o=this.defaultView.context.rBushRoot,s=o.search({minX:r,minY:n,maxX:i,maxY:a}),c=[];return s.forEach(function(l){var u=l.displayObject,f=u.parsedStyle.pointerEvents,h=["auto","visiblepainted","visiblefill","visiblestroke","visible"].includes(f);(!h||h&&u.isVisible())&&!u.isCulled()&&u.isInteractive()&&c.push(u)}),c.sort(function(l,u){return u.sortable.renderOrder-l.sortable.renderOrder}),c},e.prototype.elementFromPointSync=function(r,n){var i=this.defaultView.canvas2Viewport({x:r,y:n}),a=i.x,o=i.y,s=this.defaultView.getConfig(),c=s.width,l=s.height;if(a<0||o<0||a>c||o>l)return null;var u=this.defaultView.viewport2Client({x:a,y:o}),f=u.x,h=u.y,v=this.defaultView.getRenderingService().hooks.pickSync.call({topmost:!0,position:{x:r,y:n,viewportX:a,viewportY:o,clientX:f,clientY:h},picked:[]}).picked;return v&&v[0]||this.documentElement},e.prototype.elementFromPoint=function(r,n){return fr(this,void 0,void 0,function(){var i,a,o,s,c,l,u,f,h,v;return hr(this,function(p){switch(p.label){case 0:return i=this.defaultView.canvas2Viewport({x:r,y:n}),a=i.x,o=i.y,s=this.defaultView.getConfig(),c=s.width,l=s.height,a<0||o<0||a>c||o>l?[2,null]:(u=this.defaultView.viewport2Client({x:a,y:o}),f=u.x,h=u.y,[4,this.defaultView.getRenderingService().hooks.pick.promise({topmost:!0,position:{x:r,y:n,viewportX:a,viewportY:o,clientX:f,clientY:h},picked:[]})]);case 1:return v=p.sent().picked,[2,v&&v[0]||this.documentElement]}})})},e.prototype.elementsFromPointSync=function(r,n){var i=this.defaultView.canvas2Viewport({x:r,y:n}),a=i.x,o=i.y,s=this.defaultView.getConfig(),c=s.width,l=s.height;if(a<0||o<0||a>c||o>l)return[];var u=this.defaultView.viewport2Client({x:a,y:o}),f=u.x,h=u.y,v=this.defaultView.getRenderingService().hooks.pickSync.call({topmost:!1,position:{x:r,y:n,viewportX:a,viewportY:o,clientX:f,clientY:h},picked:[]}).picked;return v[v.length-1]!==this.documentElement&&v.push(this.documentElement),v},e.prototype.elementsFromPoint=function(r,n){return fr(this,void 0,void 0,function(){var i,a,o,s,c,l,u,f,h,v;return hr(this,function(p){switch(p.label){case 0:return i=this.defaultView.canvas2Viewport({x:r,y:n}),a=i.x,o=i.y,s=this.defaultView.getConfig(),c=s.width,l=s.height,a<0||o<0||a>c||o>l?[2,[]]:(u=this.defaultView.viewport2Client({x:a,y:o}),f=u.x,h=u.y,[4,this.defaultView.getRenderingService().hooks.pick.promise({topmost:!1,position:{x:r,y:n,viewportX:a,viewportY:o,clientX:f,clientY:h},picked:[]})]);case 1:return v=p.sent().picked,v[v.length-1]!==this.documentElement&&v.push(this.documentElement),[2,v]}})})},e.prototype.appendChild=function(r,n){throw new Error(Ge)},e.prototype.insertBefore=function(r,n){throw new Error(Ge)},e.prototype.removeChild=function(r,n){throw new Error(Ge)},e.prototype.replaceChild=function(r,n,i){throw new Error(Ge)},e.prototype.append=function(){throw new Error(Ge)},e.prototype.prepend=function(){throw new Error(Ge)},e.prototype.getElementById=function(r){return this.documentElement.getElementById(r)},e.prototype.getElementsByName=function(r){return this.documentElement.getElementsByName(r)},e.prototype.getElementsByTagName=function(r){return this.documentElement.getElementsByTagName(r)},e.prototype.getElementsByClassName=function(r){return this.documentElement.getElementsByClassName(r)},e.prototype.querySelector=function(r){return this.documentElement.querySelector(r)},e.prototype.querySelectorAll=function(r){return this.documentElement.querySelectorAll(r)},e.prototype.find=function(r){return this.documentElement.find(r)},e.prototype.findAll=function(r){return this.documentElement.findAll(r)},e}(yt),_h=function(){function t(e){this.strategies=e}return t.prototype.apply=function(e){var r=e.camera,n=e.renderingService,i=e.renderingContext,a=this.strategies;n.hooks.cull.tap(t.tag,function(o){if(o){var s=o.cullable;return a.length===0?s.visible=i.unculledEntities.indexOf(o.entity)>-1:s.visible=a.every(function(c){return c.isVisible(r,o)}),!o.isCulled()&&o.isVisible()?o:(o.dispatchEvent(new mt($.CULLED)),null)}return o}),n.hooks.afterRender.tap(t.tag,function(o){o.cullable.visibilityPlaneMask=-1})},t.tag="Culling",t}(),Dh=function(){function t(){var e=this;this.autoPreventDefault=!1,this.rootPointerEvent=new hi(null),this.rootWheelEvent=new vi(null),this.onPointerMove=function(r){var n,i,a,o,s=(o=(a=e.context.renderingContext.root)===null||a===void 0?void 0:a.ownerDocument)===null||o===void 0?void 0:o.defaultView;if(!(s.supportsTouchEvents&&r.pointerType==="touch")){var c=e.normalizeToPointerEvent(r,s);try{for(var l=de(c),u=l.next();!u.done;u=l.next()){var f=u.value,h=e.bootstrapEvent(e.rootPointerEvent,f,s,r);e.context.eventService.mapEvent(h)}}catch(v){n={error:v}}finally{try{u&&!u.done&&(i=l.return)&&i.call(l)}finally{if(n)throw n.error}}e.setCursor(e.context.eventService.cursor)}},this.onClick=function(r){var n,i,a,o,s=(o=(a=e.context.renderingContext.root)===null||a===void 0?void 0:a.ownerDocument)===null||o===void 0?void 0:o.defaultView,c=e.normalizeToPointerEvent(r,s);try{for(var l=de(c),u=l.next();!u.done;u=l.next()){var f=u.value,h=e.bootstrapEvent(e.rootPointerEvent,f,s,r);e.context.eventService.mapEvent(h)}}catch(v){n={error:v}}finally{try{u&&!u.done&&(i=l.return)&&i.call(l)}finally{if(n)throw n.error}}e.setCursor(e.context.eventService.cursor)}}return t.prototype.apply=function(e){var r=this;this.context=e;var n=e.renderingService,i=this.context.renderingContext.root.ownerDocument.defaultView;this.context.eventService.setPickHandler(function(a){var o=r.context.renderingService.hooks.pickSync.call({position:a,picked:[],topmost:!0}).picked;return o[0]||null}),n.hooks.pointerWheel.tap(t.tag,function(a){var o=r.normalizeWheelEvent(a);r.context.eventService.mapEvent(o)}),n.hooks.pointerDown.tap(t.tag,function(a){var o,s;if(!(i.supportsTouchEvents&&a.pointerType==="touch")){var c=r.normalizeToPointerEvent(a,i);if(r.autoPreventDefault&&c[0].isNormalized){var l=a.cancelable||!("cancelable"in a);l&&a.preventDefault()}try{for(var u=de(c),f=u.next();!f.done;f=u.next()){var h=f.value,v=r.bootstrapEvent(r.rootPointerEvent,h,i,a);r.context.eventService.mapEvent(v)}}catch(p){o={error:p}}finally{try{f&&!f.done&&(s=u.return)&&s.call(u)}finally{if(o)throw o.error}}r.setCursor(r.context.eventService.cursor)}}),n.hooks.pointerUp.tap(t.tag,function(a){var o,s;if(!(i.supportsTouchEvents&&a.pointerType==="touch")){var c=r.context.contextService.getDomElement(),l="outside";try{l=c&&a.target&&a.target!==c&&c.contains&&!c.contains(a.target)?"outside":""}catch{}var u=r.normalizeToPointerEvent(a,i);try{for(var f=de(u),h=f.next();!h.done;h=f.next()){var v=h.value,p=r.bootstrapEvent(r.rootPointerEvent,v,i,a);p.type+=l,r.context.eventService.mapEvent(p)}}catch(y){o={error:y}}finally{try{h&&!h.done&&(s=f.return)&&s.call(f)}finally{if(o)throw o.error}}r.setCursor(r.context.eventService.cursor)}}),n.hooks.pointerMove.tap(t.tag,this.onPointerMove),n.hooks.pointerOver.tap(t.tag,this.onPointerMove),n.hooks.pointerOut.tap(t.tag,this.onPointerMove),n.hooks.click.tap(t.tag,this.onClick),n.hooks.pointerCancel.tap(t.tag,function(a){var o,s,c=r.normalizeToPointerEvent(a,i);try{for(var l=de(c),u=l.next();!u.done;u=l.next()){var f=u.value,h=r.bootstrapEvent(r.rootPointerEvent,f,i,a);r.context.eventService.mapEvent(h)}}catch(v){o={error:v}}finally{try{u&&!u.done&&(s=l.return)&&s.call(l)}finally{if(o)throw o.error}}r.setCursor(r.context.eventService.cursor)})},t.prototype.getViewportXY=function(e){var r,n,i=e.offsetX,a=e.offsetY,o=e.clientX,s=e.clientY;if(this.context.config.supportsCSSTransform&&!F(i)&&!F(a))r=i,n=a;else{var c=this.context.eventService.client2Viewport(new pt(o,s));r=c.x,n=c.y}return{x:r,y:n}},t.prototype.bootstrapEvent=function(e,r,n,i){e.view=n,e.originalEvent=null,e.nativeEvent=i,e.pointerId=r.pointerId,e.width=r.width,e.height=r.height,e.isPrimary=r.isPrimary,e.pointerType=r.pointerType,e.pressure=r.pressure,e.tangentialPressure=r.tangentialPressure,e.tiltX=r.tiltX,e.tiltY=r.tiltY,e.twist=r.twist,this.transferMouseData(e,r);var a=this.getViewportXY(r),o=a.x,s=a.y;e.viewport.x=o,e.viewport.y=s;var c=this.context.eventService.viewport2Canvas(e.viewport),l=c.x,u=c.y;return e.canvas.x=l,e.canvas.y=u,e.global.copyFrom(e.canvas),e.offset.copyFrom(e.canvas),e.isTrusted=i.isTrusted,e.type==="pointerleave"&&(e.type="pointerout"),e.type.startsWith("mouse")&&(e.type=e.type.replace("mouse","pointer")),e.type.startsWith("touch")&&(e.type=Rf[e.type]||e.type),e},t.prototype.normalizeWheelEvent=function(e){var r=this.rootWheelEvent;this.transferMouseData(r,e),r.deltaMode=e.deltaMode,r.deltaX=e.deltaX,r.deltaY=e.deltaY,r.deltaZ=e.deltaZ;var n=this.getViewportXY(e),i=n.x,a=n.y;r.viewport.x=i,r.viewport.y=a;var o=this.context.eventService.viewport2Canvas(r.viewport),s=o.x,c=o.y;return r.canvas.x=s,r.canvas.y=c,r.global.copyFrom(r.canvas),r.offset.copyFrom(r.canvas),r.nativeEvent=e,r.type=e.type,r},t.prototype.transferMouseData=function(e,r){e.isTrusted=r.isTrusted,e.srcElement=r.srcElement,e.timeStamp=fi.now(),e.type=r.type,e.altKey=r.altKey,e.metaKey=r.metaKey,e.shiftKey=r.shiftKey,e.ctrlKey=r.ctrlKey,e.button=r.button,e.buttons=r.buttons,e.client.x=r.clientX,e.client.y=r.clientY,e.movement.x=r.movementX,e.movement.y=r.movementY,e.page.x=r.pageX,e.page.y=r.pageY,e.screen.x=r.screenX,e.screen.y=r.screenY,e.relatedTarget=null},t.prototype.setCursor=function(e){this.context.contextService.applyCursorStyle(e||this.context.config.cursor||"default")},t.prototype.normalizeToPointerEvent=function(e,r){var n=[];if(r.isTouchEvent(e))for(var i=0;i-1,s=0,c=i.length;s=1?Math.ceil(S):1,b=s||Cf(a)||a.width/S,C=c||Sf(a)||a.height/S),o&&(A.offscreenCanvas=o),n.devicePixelRatio=S,n.requestAnimationFrame=p??Xo.bind(A.globalThis),n.cancelAnimationFrame=y??Vo.bind(A.globalThis),n.supportsTouchEvents=E??"ontouchstart"in A.globalThis,n.supportsPointerEvents=m??!!A.globalThis.PointerEvent,n.isTouchEvent=T??function(N){return n.supportsTouchEvents&&N instanceof A.globalThis.TouchEvent},n.isMouseEvent=w??function(N){return!A.globalThis.MouseEvent||N instanceof A.globalThis.MouseEvent&&(!n.supportsPointerEvents||!(N instanceof A.globalThis.PointerEvent))},n.initRenderingContext({container:i,canvas:a,width:b,height:C,renderer:u,offscreenCanvas:o,devicePixelRatio:S,cursor:h||"default",background:f||"transparent",createImage:d,document:v,supportsCSSTransform:M,useNativeClickEvent:x,alwaysTriggerPointerEventOnCanvas:g}),n.initDefaultCamera(b,C,u.clipSpaceNearZ),n.initRenderer(u,!0),n}return e.prototype.initRenderingContext=function(r){this.context.config=r,this.context.renderingContext={root:this.document.documentElement,renderListCurrentFrame:[],unculledEntities:[],renderReasons:new Set,force:!1,dirty:!1}},e.prototype.initDefaultCamera=function(r,n,i){var a=this,o=new A.CameraContribution;o.clipSpaceNearZ=i,o.setType(at.EXPLORING,pr.DEFAULT).setPosition(r/2,n/2,ka).setFocalPoint(r/2,n/2,0).setOrthographic(r/-2,r/2,n/2,n/-2,Uh,Yh),o.canvas=this,o.eventEmitter.on(No.UPDATED,function(){a.context.renderingContext.renderReasons.add(ge.CAMERA_CHANGED)}),this.context.camera=o},e.prototype.getConfig=function(){return this.context.config},e.prototype.getRoot=function(){return this.document.documentElement},e.prototype.getCamera=function(){return this.context.camera},e.prototype.getContextService=function(){return this.context.contextService},e.prototype.getEventService=function(){return this.context.eventService},e.prototype.getRenderingService=function(){return this.context.renderingService},e.prototype.getRenderingContext=function(){return this.context.renderingContext},e.prototype.getStats=function(){return this.getRenderingService().getStats()},Object.defineProperty(e.prototype,"ready",{get:function(){var r=this;return this.readyPromise||(this.readyPromise=new Promise(function(n){r.resolveReadyPromise=function(){n(r)}}),this.inited&&this.resolveReadyPromise()),this.readyPromise},enumerable:!1,configurable:!0}),e.prototype.destroy=function(r,n){if(r===void 0&&(r=!0),n===void 0&&(n=!1),n||this.dispatchEvent(new mt(wt.BEFORE_DESTROY)),this.frameId){var i=this.getConfig().cancelAnimationFrame||cancelAnimationFrame;i(this.frameId)}var a=this.getRoot();this.unmountChildren(a),r&&(this.document.destroy(),this.getEventService().destroy()),this.getRenderingService().destroy(),this.getContextService().destroy(),r&&this.context.rBushRoot&&(this.context.rBushRoot.clear(),this.context.rBushRoot=null,this.context.renderingContext.root=null),n||this.dispatchEvent(new mt(wt.AFTER_DESTROY))},e.prototype.changeSize=function(r,n){this.resize(r,n)},e.prototype.resize=function(r,n){var i=this.context.config;i.width=r,i.height=n,this.getContextService().resize(r,n);var a=this.context.camera,o=a.getProjectionMode();a.setPosition(r/2,n/2,ka).setFocalPoint(r/2,n/2,0),o===Pt.ORTHOGRAPHIC?a.setOrthographic(r/-2,r/2,n/2,n/-2,a.getNear(),a.getFar()):a.setAspect(r/n),this.dispatchEvent(new mt(wt.RESIZE,{width:r,height:n}))},e.prototype.appendChild=function(r,n){return this.document.documentElement.appendChild(r,n)},e.prototype.insertBefore=function(r,n){return this.document.documentElement.insertBefore(r,n)},e.prototype.removeChild=function(r){return this.document.documentElement.removeChild(r)},e.prototype.removeChildren=function(){this.document.documentElement.removeChildren()},e.prototype.destroyChildren=function(){this.document.documentElement.destroyChildren()},e.prototype.render=function(){var r=this;this.dispatchEvent(Hh);var n=this.getRenderingService();n.render(this.getConfig(),function(){r.dispatchEvent(Wh)}),this.dispatchEvent(zh)},e.prototype.run=function(){var r=this,n=function(){r.render(),r.frameId=r.requestAnimationFrame(n)};n()},e.prototype.initRenderer=function(r,n){var i=this;if(n===void 0&&(n=!1),!r)throw new Error("Renderer is required.");this.inited=!1,this.readyPromise=void 0,this.context.rBushRoot=new Wl,this.context.renderingPlugins=[],this.context.renderingPlugins.push(new Dh,new Gh,new _h([new Bh])),this.loadRendererContainerModule(r),this.context.contextService=new this.context.ContextService(U(U({},A),this.context)),this.context.renderingService=new ih(A,this.context),this.context.eventService=new rh(A,this.context),this.context.eventService.init(),this.context.contextService.init?(this.context.contextService.init(),this.initRenderingService(r,n,!0)):this.context.contextService.initAsync().then(function(){i.initRenderingService(r,n)})},e.prototype.initRenderingService=function(r,n,i){var a=this;n===void 0&&(n=!1),i===void 0&&(i=!1),this.context.renderingService.init(function(){a.inited=!0,n?(i?a.requestAnimationFrame(function(){a.dispatchEvent(new mt(wt.READY))}):a.dispatchEvent(new mt(wt.READY)),a.readyPromise&&a.resolveReadyPromise()):a.dispatchEvent(new mt(wt.RENDERER_CHANGED)),n||a.getRoot().forEach(function(o){var s=o.renderable;s&&(s.renderBoundsDirty=!0,s.boundsDirty=!0,s.dirty=!0)}),a.mountChildren(a.getRoot()),r.getConfig().enableAutoRendering&&a.run()})},e.prototype.loadRendererContainerModule=function(r){var n=this,i=r.getPlugins();i.forEach(function(a){a.context=n.context,a.init(A)})},e.prototype.setRenderer=function(r){var n=this.getConfig();if(n.renderer!==r){var i=n.renderer;n.renderer=r,this.destroy(!1,!0),X([],_(i==null?void 0:i.getPlugins()),!1).reverse().forEach(function(a){a.destroy(A)}),this.initRenderer(r)}},e.prototype.setCursor=function(r){var n=this.getConfig();n.cursor=r,this.getContextService().applyCursorStyle(r)},e.prototype.unmountChildren=function(r){var n=this;r.childNodes.forEach(function(i){n.unmountChildren(i)}),this.inited&&(r.isMutationObserved?r.dispatchEvent(Hn):(Hn.target=r,this.dispatchEvent(Hn,!0)),r!==this.document.documentElement&&(r.ownerDocument=null),r.isConnected=!1),r.isCustomElement&&r.disconnectedCallback&&r.disconnectedCallback()},e.prototype.mountChildren=function(r){var n=this;this.inited?r.isConnected||(r.ownerDocument=this.document,r.isConnected=!0,r.isMutationObserved?r.dispatchEvent(Yn):(Yn.target=r,this.dispatchEvent(Yn,!0))):console.warn("[g]: You are trying to call `canvas.appendChild` before canvas' initialization finished. You can either await `canvas.ready` or listen to `CanvasEvent.READY` manually.","appended child: ",r.nodeName),r.childNodes.forEach(function(i){n.mountChildren(i)}),r.isCustomElement&&r.connectedCallback&&r.connectedCallback()},e.prototype.client2Viewport=function(r){return this.getEventService().client2Viewport(r)},e.prototype.viewport2Client=function(r){return this.getEventService().viewport2Client(r)},e.prototype.viewport2Canvas=function(r){return this.getEventService().viewport2Canvas(r)},e.prototype.canvas2Viewport=function(r){return this.getEventService().canvas2Viewport(r)},e.prototype.getPointByClient=function(r,n){return this.client2Viewport({x:r,y:n})},e.prototype.getClientByPoint=function(r,n){return this.viewport2Client({x:r,y:n})},e}($o);function Xh(t,e){var r=e.r;t.arc(r,r,r,0,Math.PI*2,!1)}function Vh(t,e){var r=e.rx,n=e.ry,i=r,a=n;if(t.ellipse)t.ellipse(i,a,i,a,0,0,Math.PI*2,!1);else{var o=i>a?i:a,s=i>a?1:i/a,c=i>a?a/i:1;t.save(),t.scale(s,c),t.arc(o,o,o,0,Math.PI*2)}}function qh(t,e){var r=e.x1,n=e.y1,i=e.x2,a=e.y2,o=e.defX,s=o===void 0?0:o,c=e.defY,l=c===void 0?0:c,u=e.markerStart,f=e.markerEnd,h=e.markerStartOffset,v=e.markerEndOffset,p=0,y=0,d=0,m=0,E=0,M,P;u&&K(u)&&h&&(M=i-r,P=a-n,E=Math.atan2(P,M),p=Math.cos(E)*(h||0),y=Math.sin(E)*(h||0)),f&&K(f)&&v&&(M=r-i,P=n-a,E=Math.atan2(P,M),d=Math.cos(E)*(v||0),m=Math.sin(E)*(v||0)),t.moveTo(r-s+p,n-l+y),t.lineTo(i-s+d,a-l+m)}function $h(t,e){var r=e.defX,n=r===void 0?0:r,i=e.defY,a=i===void 0?0:i,o=e.markerStart,s=e.markerEnd,c=e.markerStartOffset,l=e.markerEndOffset,u=e.path,f=u.absolutePath,h=u.segments,v=0,p=0,y=0,d=0,m=0,E,M;if(o&&K(o)&&c){var P=_(o.parentNode.getStartTangent(),2),x=P[0],g=P[1];E=x[0]-g[0],M=x[1]-g[1],m=Math.atan2(M,E),v=Math.cos(m)*(c||0),p=Math.sin(m)*(c||0)}if(s&&K(s)&&l){var T=_(s.parentNode.getEndTangent(),2),x=T[0],g=T[1];E=x[0]-g[0],M=x[1]-g[1],m=Math.atan2(M,E),y=Math.cos(m)*(l||0),d=Math.sin(m)*(l||0)}for(var w=0;wG?I:G,$t=I>G?1:I/G,Kt=I>G?G/I:1;t.translate(B-n,Y-a),t.rotate(rt),t.scale($t,Kt),t.arc(0,0,Ht,H,lt,!!(1-St)),t.scale(1/$t,1/Kt),t.rotate(-rt),t.translate(-(B-n),-(Y-a))}O&&t.lineTo(b[6]-n+y,b[7]-a+d);break}case"Z":t.closePath();break}}}function Kh(t,e){var r=e.defX,n=r===void 0?0:r,i=e.defY,a=i===void 0?0:i,o=e.markerStart,s=e.markerEnd,c=e.markerStartOffset,l=e.markerEndOffset,u=e.points.points,f=u.length,h=u[0][0]-n,v=u[0][1]-a,p=u[f-1][0]-n,y=u[f-1][1]-a,d=0,m=0,E=0,M=0,P=0,x,g;o&&K(o)&&c&&(x=u[1][0]-u[0][0],g=u[1][1]-u[0][1],P=Math.atan2(g,x),d=Math.cos(P)*(c||0),m=Math.sin(P)*(c||0)),s&&K(s)&&l&&(x=u[f-1][0]-u[0][0],g=u[f-1][1]-u[0][1],P=Math.atan2(g,x),E=Math.cos(P)*(l||0),M=Math.sin(P)*(l||0)),t.moveTo(h+(d||E),v+(m||M));for(var T=1;T0?1:-1,l=i>0?1:-1,u=c+l===0,f=_(r.map(function(d){return kt(d,0,Math.min(Math.abs(a)/2,Math.abs(o)/2))}),4),h=f[0],v=f[1],p=f[2],y=f[3];t.moveTo(c*h,0),t.lineTo(a-c*v,0),v!==0&&t.arc(a-c*v,l*v,v,-l*Math.PI/2,c>0?0:Math.PI,u),t.lineTo(a,o-l*p),p!==0&&t.arc(a-c*p,o-l*p,p,c>0?0:Math.PI,l>0?Math.PI/2:1.5*Math.PI,u),t.lineTo(c*y,o),y!==0&&t.arc(c*y,o-l*y,y,l>0?Math.PI/2:-Math.PI/2,c>0?Math.PI:0,u),t.lineTo(0,l*h),h!==0&&t.arc(c*h,l*h,h,c>0?Math.PI:0,l>0?Math.PI*1.5:Math.PI/2,u)}}var Jh=function(t){z(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.name="canvas-path-generator",r}return e.prototype.init=function(){var r,n=(r={},r[R.CIRCLE]=Xh,r[R.ELLIPSE]=Vh,r[R.RECT]=Qh,r[R.LINE]=qh,r[R.POLYLINE]=Zh,r[R.POLYGON]=Kh,r[R.PATH]=$h,r[R.TEXT]=void 0,r[R.GROUP]=void 0,r[R.IMAGE]=void 0,r[R.HTML]=void 0,r[R.MESH]=void 0,r);this.context.pathGeneratorFactory=n},e.prototype.destroy=function(){delete this.context.pathGeneratorFactory},e}(Le),jh=q(),tv=q(),ev=q(),rv=nt(),nv=function(){function t(){var e=this;this.isHit=function(r,n,i,a){var o=e.context.pointInPathPickerFactory[r.nodeName];if(o){var s=jt(rv,i),c=Ut(tv,qt(ev,n[0],n[1],0),s),l=r.getGeometryBounds().halfExtents,u=r.parsedStyle.anchor;if(c[0]+=(u&&u[0]||0)*l[0]*2,c[1]+=(u&&u[1]||0)*l[1]*2,o(r,new pt(c[0],c[1]),a,e.isPointInPath,e.context,e.runtime))return!0}return!1},this.isPointInPath=function(r,n){var i=e.runtime.offscreenCanvasCreator.getOrCreateContext(e.context.config.offscreenCanvas),a=e.context.pathGeneratorFactory[r.nodeName];return a&&(i.beginPath(),a(i,r.parsedStyle),i.closePath()),i.isPointInPath(n.x,n.y)}}return t.prototype.apply=function(e,r){var n=this,i,a=e.renderingService,o=e.renderingContext;this.context=e,this.runtime=r;var s=(i=o.root)===null||i===void 0?void 0:i.ownerDocument;a.hooks.pick.tapPromise(t.tag,function(c){return fr(n,void 0,void 0,function(){return hr(this,function(l){return[2,this.pick(s,c)]})})}),a.hooks.pickSync.tap(t.tag,function(c){return n.pick(s,c)})},t.prototype.pick=function(e,r){var n,i,a=r.topmost,o=r.position,s=o.x,c=o.y,l=qt(jh,s,c,0),u=e.elementsFromBBox(l[0],l[1],l[0],l[1]),f=[];try{for(var h=de(u),v=h.next();!v.done;v=h.next()){var p=v.value,y=p.getWorldTransform(),d=this.isHit(p,l,y,!1);if(d){var m=Yo(p);if(m){var E=m.parsedStyle.clipPath,M=this.isHit(E,l,E.getWorldTransform(),!0);if(M){if(a)return r.picked=[p],r;f.push(p)}}else{if(a)return r.picked=[p],r;f.push(p)}}}}catch(P){n={error:P}}finally{try{v&&!v.done&&(i=h.return)&&i.call(h)}finally{if(n)throw n.error}}return r.picked=f,r},t.tag="CanvasPicker",t}();function iv(t,e,r){var n=t.parsedStyle,i=n.r,a=n.fill,o=n.stroke,s=n.lineWidth,c=n.increasedLineWidthForHitTesting,l=n.pointerEvents,u=((s||0)+(c||0))/2,f=le(i,i,e.x,e.y),h=_(_e(l,a,o),2),v=h[0],p=h[1];return v&&p||r?f<=i+u:v?f<=i:p?f>=i-u&&f<=i+u:!1}function Fr(t,e,r,n){return t/(r*r)+e/(n*n)}function av(t,e,r){var n=t.parsedStyle,i=n.rx,a=n.ry,o=n.fill,s=n.stroke,c=n.lineWidth,l=n.increasedLineWidthForHitTesting,u=n.pointerEvents,f=e.x,h=e.y,v=_(_e(u,o,s),2),p=v[0],y=v[1],d=((c||0)+(l||0))/2,m=(f-i)*(f-i),E=(h-a)*(h-a);return p&&y||r?Fr(m,E,i+d,a+d)<=1:p?Fr(m,E,i,a)<=1:y?Fr(m,E,i-d,a-d)>=1&&Fr(m,E,i+d,a+d)<=1:!1}function Ae(t,e,r,n,i,a){return i>=t&&i<=t+r&&a>=e&&a<=e+n}function ov(t,e,r,n,i,a,o){var s=i/2;return Ae(t-s,e-s,r,i,a,o)||Ae(t+r-s,e-s,i,n,a,o)||Ae(t+s,e+n-s,r,i,a,o)||Ae(t-s,e+s,i,n,a,o)}function Br(t,e,r,n,i,a,o,s){var c=(Math.atan2(s-e,o-t)+Math.PI*2)%(Math.PI*2),l={x:t+r*Math.cos(c),y:e+r*Math.sin(c)};return le(l.x,l.y,o,s)<=a/2}function ye(t,e,r,n,i,a,o){var s=Math.min(t,r),c=Math.max(t,r),l=Math.min(e,n),u=Math.max(e,n),f=i/2;return a>=s-f&&a<=c+f&&o>=l-f&&o<=u+f?kl(t,e,r,n,a,o)<=i/2:!1}function ts(t,e,r,n,i){var a=t.length;if(a<2)return!1;for(var o=0;o0!=Wn(s[1]-r)>0&&Wn(e-(r-o[1])*(o[0]-s[0])/(o[1]-s[1])-o[0])<0&&(n=!n)}return n}function Ia(t,e,r){for(var n=!1,i=0;iP&&b>x,y&&(y.resetTransform?y.resetTransform():y.setTransform(1,0,0,1,0,0),n.clearFullScreen&&n.clearRect(y,0,0,m*d,E*d,i.background))});var p=function(y,d){y.isVisible()&&!y.isCulled()&&(n.renderDisplayObject(y,d,n.context,n.restoreStack,r),n.saveDirtyAABB(y));var m=y.sortable.sorted||y.childNodes;m.forEach(function(E){p(E,d)})};o.hooks.endFrame.tap(t.tag,function(){var y=u.getContext(),d=u.getDPR();if(ro(n.dprMatrix,[d,d,1]),Et(n.vpMatrix,n.dprMatrix,a.getOrthoMatrix()),n.clearFullScreen)p(s.root,y);else{var m=n.safeMergeAABB.apply(n,X([n.mergeDirtyAABBs(n.renderQueue)],_(n.removedRBushNodeAABBs.map(function(rt){var St=rt.minX,Ht=rt.minY,$t=rt.maxX,Kt=rt.maxY,Wt=new ht;return Wt.setMinMax([St,Ht,0],[$t,Kt,0]),Wt})),!1));if(n.removedRBushNodeAABBs=[],ht.isEmpty(m)){n.renderQueue=[];return}var E=n.convertAABB2Rect(m),M=E.x,P=E.y,x=E.width,g=E.height,T=Ut(n.vec3a,[M,P,0],n.vpMatrix),w=Ut(n.vec3b,[M+x,P,0],n.vpMatrix),b=Ut(n.vec3c,[M,P+g,0],n.vpMatrix),C=Ut(n.vec3d,[M+x,P+g,0],n.vpMatrix),S=Math.min(T[0],w[0],C[0],b[0]),N=Math.min(T[1],w[1],C[1],b[1]),O=Math.max(T[0],w[0],C[0],b[0]),k=Math.max(T[1],w[1],C[1],b[1]),B=Math.floor(S),Y=Math.floor(N),I=Math.ceil(O-S),G=Math.ceil(k-N);y.save(),n.clearRect(y,B,Y,I,G,i.background),y.beginPath(),y.rect(B,Y,I,G),y.clip(),y.setTransform(n.vpMatrix[0],n.vpMatrix[1],n.vpMatrix[4],n.vpMatrix[5],n.vpMatrix[12],n.vpMatrix[13]);var H=i.renderer.getConfig().enableDirtyRectangleRenderingDebug;H&&f.dispatchEvent(new mt(wt.DIRTY_RECTANGLE,{dirtyRect:{x:B,y:Y,width:I,height:G}}));var lt=n.searchDirtyObjects(m);lt.sort(function(rt,St){return rt.sortable.renderOrder-St.sortable.renderOrder}).forEach(function(rt){rt&&rt.isVisible()&&!rt.isCulled()&&n.renderDisplayObject(rt,y,n.context,n.restoreStack,r)}),y.restore(),n.renderQueue.forEach(function(rt){n.saveDirtyAABB(rt)}),n.renderQueue=[]}n.restoreStack.forEach(function(){y.restore()}),n.restoreStack=[]}),o.hooks.render.tap(t.tag,function(y){n.clearFullScreen||n.renderQueue.push(y)})},t.prototype.clearRect=function(e,r,n,i,a,o){e.clearRect(r,n,i,a),o&&(e.fillStyle=o,e.fillRect(r,n,i,a))},t.prototype.renderDisplayObject=function(e,r,n,i,a){var o=e.nodeName,s=i[i.length-1];s&&!(e.compareDocumentPosition(s)&Node.DOCUMENT_POSITION_CONTAINS)&&(r.restore(),i.pop());var c=this.context.styleRendererFactory[o],l=this.pathGeneratorFactory[o],u=e.parsedStyle.clipPath;if(u){this.applyWorldTransform(r,u);var f=this.pathGeneratorFactory[u.nodeName];f&&(r.save(),i.push(e),r.beginPath(),f(r,u.parsedStyle),r.closePath(),r.clip())}c&&(this.applyWorldTransform(r,e),r.save(),this.applyAttributesToContext(r,e)),l&&(r.beginPath(),l(r,e.parsedStyle),e.nodeName!==R.LINE&&e.nodeName!==R.PATH&&e.nodeName!==R.POLYLINE&&r.closePath()),c&&(c.render(r,e.parsedStyle,e,n,this,a),r.restore()),e.renderable.dirty=!1},t.prototype.convertAABB2Rect=function(e){var r=e.getMin(),n=e.getMax(),i=2,a=Math.floor(r[0])-i,o=Math.floor(r[1])-i,s=Math.ceil(n[0])+i,c=Math.ceil(n[1])+i,l=s-a,u=c-o;return{x:a,y:o,width:l,height:u}},t.prototype.mergeDirtyAABBs=function(e){var r=new ht;return e.forEach(function(n){var i=n.getRenderBounds();r.add(i);var a=n.renderable.dirtyRenderBounds;a&&r.add(a)}),r},t.prototype.searchDirtyObjects=function(e){var r=_(e.getMin(),2),n=r[0],i=r[1],a=_(e.getMax(),2),o=a[0],s=a[1],c=this.rBush.search({minX:n,minY:i,maxX:o,maxY:s});return c.map(function(l){var u=l.displayObject;return u})},t.prototype.saveDirtyAABB=function(e){var r=e.renderable;r.dirtyRenderBounds||(r.dirtyRenderBounds=new ht);var n=e.getRenderBounds();n&&r.dirtyRenderBounds.update(n.center,n.halfExtents)},t.prototype.applyAttributesToContext=function(e,r){var n=r.parsedStyle,i=n.stroke,a=n.fill,o=n.opacity,s=n.lineDash,c=n.lineDashOffset;s&&e.setLineDash(s),F(c)||(e.lineDashOffset=c),F(o)||(e.globalAlpha*=o),!F(i)&&!Array.isArray(i)&&!i.isNone&&(e.strokeStyle=r.attributes.stroke),!F(a)&&!Array.isArray(a)&&!a.isNone&&(e.fillStyle=r.attributes.fill)},t.prototype.applyWorldTransform=function(e,r,n){var i=0,a=0,o=(r.parsedStyle||{}).anchor,s=o&&o[0]||0,c=o&&o[1]||0;if(s!==0||c!==0){var l=r.geometry.contentBounds,u=l&&l.halfExtents[0]*2||0,f=l&&l.halfExtents[1]*2||0;i=-(s*u),a=-(c*f)}n?(Ke(this.tmpMat4,r.getLocalTransform()),this.vec3a[0]=i,this.vec3a[1]=a,this.vec3a[2]=0,ze(this.tmpMat4,this.tmpMat4,this.vec3a),Et(this.tmpMat4,n,this.tmpMat4),Et(this.tmpMat4,this.vpMatrix,this.tmpMat4)):(Ke(this.tmpMat4,r.getWorldTransform()),this.vec3a[0]=i,this.vec3a[1]=a,this.vec3a[2]=0,ze(this.tmpMat4,this.tmpMat4,this.vec3a),Et(this.tmpMat4,this.vpMatrix,this.tmpMat4)),e.setTransform(this.tmpMat4[0],this.tmpMat4[1],this.tmpMat4[4],this.tmpMat4[5],this.tmpMat4[12],this.tmpMat4[13])},t.prototype.safeMergeAABB=function(){for(var e=[],r=0;r0,T=s.alpha===0,w=!!(M&&M.length),b=!F(m)&&E>0,C=n.nodeName,S=d==="inner",N=g&&b&&(C===R.PATH||C===R.LINE||C===R.POLYLINE||T||S);x&&(e.globalAlpha=l*u,N||vn(n,e,b),this.fill(e,n,s,c,i,a,o),N||this.clearShadowAndFilter(e,w,b)),g&&(e.globalAlpha=l*h,e.lineWidth=v,F(P)||(e.miterLimit=P),F(p)||(e.lineCap=p),F(y)||(e.lineJoin=y),N&&(S&&(e.globalCompositeOperation="source-atop"),vn(n,e,!0),S&&(this.stroke(e,n,f,i,a,o),e.globalCompositeOperation="source-over",this.clearShadowAndFilter(e,w,!0))),this.stroke(e,n,f,i,a,o))},t.prototype.clearShadowAndFilter=function(e,r,n){if(n&&(e.shadowColor="transparent",e.shadowBlur=0),r){var i=e.filter;!F(i)&&i.indexOf("drop-shadow")>-1&&(e.filter=i.replace(/drop-shadow\([^)]*\)/,"").trim()||"none")}},t.prototype.fill=function(e,r,n,i,a,o,s){var c=this;Array.isArray(n)?n.forEach(function(l){e.fillStyle=c.getColor(l,r,e),i?e.fill(i):e.fill()}):(yr(n)&&(e.fillStyle=this.getPattern(n,r,e,a,o,s)),i?e.fill(i):e.fill())},t.prototype.stroke=function(e,r,n,i,a,o){var s=this;Array.isArray(n)?n.forEach(function(c){e.strokeStyle=s.getColor(c,r,e),e.stroke()}):(yr(n)&&(e.strokeStyle=this.getPattern(n,r,e,i,a,o)),e.stroke())},t.prototype.getPattern=function(e,r,n,i,a,o){var s,c;if(e.image.nodeName==="rect"){var l=e.image.parsedStyle,u=l.width,f=l.height;c=i.contextService.getDPR();var h=i.config.offscreenCanvas;s=o.offscreenCanvasCreator.getOrCreateCanvas(h),s.width=u*c,s.height=f*c;var v=o.offscreenCanvasCreator.getOrCreateContext(h),p=[];e.image.forEach(function(d){a.renderDisplayObject(d,v,i,p,o)}),p.forEach(function(){v.restore()})}var y=this.imagePool.getOrCreatePatternSync(e,n,s,c,function(){r.renderable.dirty=!0,i.renderingService.dirtify()});return y},t.prototype.getColor=function(e,r,n){var i;if(e.type===ee.LinearGradient||e.type===ee.RadialGradient){var a=r.getGeometryBounds(),o=a&&a.halfExtents[0]*2||1,s=a&&a.halfExtents[1]*2||1;i=this.imagePool.getOrCreateGradient(U(U({type:e.type},e.value),{width:o,height:s}),n)}return i},t}();function vn(t,e,r){var n=t.parsedStyle,i=n.filter,a=n.shadowColor,o=n.shadowBlur,s=n.shadowOffsetX,c=n.shadowOffsetY;i&&i.length&&(e.filter=t.style.filter),r&&(e.shadowColor=a.toString(),e.shadowBlur=o||0,e.shadowOffsetX=s||0,e.shadowOffsetY=c||0)}var xv=function(){function t(e){this.imagePool=e}return t.prototype.render=function(e,r,n){var i=r.width,a=r.height,o=r.img,s=r.shadowColor,c=r.shadowBlur,l,u=i,f=a;if(bt(o)?l=this.imagePool.getImageSync(o):(u||(u=o.width),f||(f=o.height),l=o),l){var h=!F(s)&&c>0;vn(n,e,h);try{e.drawImage(l,0,0,u,f)}catch{}}},t}(),Ev=function(){function t(){}return t.prototype.render=function(e,r,n,i,a,o){var s=r,c=s.lineWidth,l=s.textAlign,u=s.textBaseline,f=s.lineJoin,h=s.miterLimit,v=s.letterSpacing,p=s.stroke,y=s.fill,d=s.fillOpacity,m=s.strokeOpacity,E=s.opacity,M=s.metrics,P=s.dx,x=s.dy,g=s.shadowColor,T=s.shadowBlur,w=M.font,b=M.lines,C=M.height,S=M.lineHeight,N=M.lineMetrics;e.font=w,e.lineWidth=c,e.textAlign=l==="middle"?"center":l;var O=u;!o.enableCSSParsing&&O==="alphabetic"&&(O="bottom"),e.lineJoin=f,F(h)||(e.miterLimit=h);var k=0;u==="middle"?k=-C/2-S/2:u==="bottom"||u==="alphabetic"||u==="ideographic"?k=-C:(u==="top"||u==="hanging")&&(k=-S);var B=P||0;k+=x||0,b.length===1&&(O==="bottom"?(O="middle",k-=.5*C):O==="top"&&(O="middle",k+=.5*C)),e.textBaseline=O;var Y=!F(g)&&T>0;vn(n,e,Y);for(var I=0;I=1?Math.ceil(i):1,this.dpr=i,this.$canvas&&(this.$canvas.width=this.dpr*e,this.$canvas.height=this.dpr*r,bf(this.$canvas,e,r)),this.renderingContext.renderReasons.add(ge.CAMERA_CHANGED)},t.prototype.applyCursorStyle=function(e){this.$container&&this.$container.style&&(this.$container.style.cursor=e)},t.prototype.toDataURL=function(e){return e===void 0&&(e={}),fr(this,void 0,void 0,function(){var r,n;return hr(this,function(i){return r=e.type,n=e.encoderOptions,[2,this.context.canvas.toDataURL(r,n)]})})},t}(),Ov=function(t){z(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.name="canvas-context-register",r}return e.prototype.init=function(){this.context.ContextService=Av},e.prototype.destroy=function(){delete this.context.ContextService},e}(Le),Pe=function(t){z(e,t);function e(r){var n=t.call(this,r)||this;return n.registerPlugin(new Ov),n.registerPlugin(new Rv),n.registerPlugin(new Jh),n.registerPlugin(new Mv),n.registerPlugin(new Tv),n.registerPlugin(new gv),n.registerPlugin(new Cv),n}return e}(zl);const rs="https://dogefs.s3.ladydaily.com/~/source/unsplash/photo-1459749411175-04bf5292ceea?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=320&h=320&q=80";function Te(t,{x:e,y:r,r:n,shadowColor:i}){const a=i?{shadowColor:i,shadowBlur:16}:{},o=new xe({style:{cx:e,cy:r,r:n,fill:"#262626",...a}}),s=new Zo({id:"audioImg",style:{x:e-n,y:r-n,width:2*n,height:2*n,transformOrigin:"center",clipPath:new xe({style:{cx:e,cy:r,r:n}}),img:rs}});t==null||t.appendChild(o),t==null||t.appendChild(s);const c=s==null?void 0:s.animate([{transform:"rotate(0)"},{transform:"rotate(360deg)"}],{duration:12e3,iterations:1/0});return setTimeout(()=>{c==null||c.pause()}),s}const Z=150,Q=150,et=80;function we(t,e,r,n){React.useEffect(()=>{setTimeout(()=>{var a;const i=(a=e.current)==null?void 0:a.getAnimations();if(i&&i.length){const o=i[0];r?o.play():o.pause()}})},[r]),React.useEffect(()=>{var a;const i=(a=t.current)==null?void 0:a.document.querySelector("#audioImg");i&&i.setAttribute("img",n)},[n])}function kv(t){const i="#e9dcf7",a=React.useRef(),o=React.useRef(),s=React.useRef([]);function c(l){return l.reduce((f,h,v)=>(v%2&&f.push(h),f),[])}return React.useEffect(()=>{var l;(l=t.data)!=null&&l.length&&c(t.data).map((f,h)=>{s.current[h].attr("height",f*f/65025*50+4)})},[t.data]),React.useEffect(()=>{a.current=new Ee({container:"SLine",width:2*Z,height:2*Q,renderer:new Pe}),o.current=Te(a.current,{x:Z,y:Q,r:et,shadowColor:i}),s.current=Array.from({length:64},(l,u)=>{var d;const f=u*5.625-150,h=Math.cos(f*Math.PI/180),v=Math.sin(f*Math.PI/180),p=et+10,y=new Jo({style:{width:4,height:4,radius:4/2,x:Z+h*p,y:Q+v*p,fill:i}});return y.setOrigin(Z+h*p,Q+v*p),y.rotate(f-90),(d=a.current)==null||d.appendChild(y),y})},[]),we(a,o,t.isPlaying,t.audioImg),V.jsx("div",{id:"SLine",className:"s-canvas-wrapper"})}function Mn(t,e=5,r=.8){if(e<3||e>13||e%2===0)throw new Error("num value muse be singular, num >= 3, num <= 13");return t.map((n,i)=>{const a=i%e,o=(e-1)/2-a,s=t[i+o];return~~(s?s*r**Math.abs(o):n)})}function Iv(t,e,r){return`M ${t-r}, ${e} - a ${r}, ${r} 0 1, 0 ${r*2}, 0 - a ${r}, ${r} 0 1, 0 ${-r*2}, 0`}const pi=Math.PI,yi=2*pi,Re=1e-6,Lv=yi-Re;function gi(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function ns(){return new gi}gi.prototype=ns.prototype={constructor:gi,moveTo:function(t,e){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)},closePath:function(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(t,e){this._+="L"+(this._x1=+t)+","+(this._y1=+e)},quadraticCurveTo:function(t,e,r,n){this._+="Q"+ +t+","+ +e+","+(this._x1=+r)+","+(this._y1=+n)},bezierCurveTo:function(t,e,r,n,i,a){this._+="C"+ +t+","+ +e+","+ +r+","+ +n+","+(this._x1=+i)+","+(this._y1=+a)},arcTo:function(t,e,r,n,i){t=+t,e=+e,r=+r,n=+n,i=+i;var a=this._x1,o=this._y1,s=r-t,c=n-e,l=a-t,u=o-e,f=l*l+u*u;if(i<0)throw new Error("negative radius: "+i);if(this._x1===null)this._+="M"+(this._x1=t)+","+(this._y1=e);else if(f>Re)if(!(Math.abs(u*s-c*l)>Re)||!i)this._+="L"+(this._x1=t)+","+(this._y1=e);else{var h=r-a,v=n-o,p=s*s+c*c,y=h*h+v*v,d=Math.sqrt(p),m=Math.sqrt(f),E=i*Math.tan((pi-Math.acos((p+f-y)/(2*d*m)))/2),M=E/m,P=E/d;Math.abs(M-1)>Re&&(this._+="L"+(t+M*l)+","+(e+M*u)),this._+="A"+i+","+i+",0,0,"+ +(u*h>l*v)+","+(this._x1=t+P*s)+","+(this._y1=e+P*c)}},arc:function(t,e,r,n,i,a){t=+t,e=+e,r=+r,a=!!a;var o=r*Math.cos(n),s=r*Math.sin(n),c=t+o,l=e+s,u=1^a,f=a?n-i:i-n;if(r<0)throw new Error("negative radius: "+r);this._x1===null?this._+="M"+c+","+l:(Math.abs(this._x1-c)>Re||Math.abs(this._y1-l)>Re)&&(this._+="L"+c+","+l),r&&(f<0&&(f=f%yi+yi),f>Lv?this._+="A"+r+","+r+",0,1,"+u+","+(t-o)+","+(e-s)+"A"+r+","+r+",0,1,"+u+","+(this._x1=c)+","+(this._y1=l):f>Re&&(this._+="A"+r+","+r+",0,"+ +(f>=pi)+","+u+","+(this._x1=t+r*Math.cos(i))+","+(this._y1=e+r*Math.sin(i))))},rect:function(t,e,r,n){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)+"h"+ +r+"v"+ +n+"h"+-r+"Z"},toString:function(){return this._}};function Ue(t){return function(){return t}}function _v(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function is(t){this._context=t}is.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e);break}}};function Dv(t){return new is(t)}function Fv(t){return t[0]}function Bv(t){return t[1]}function gr(t,e){var r=Ue(!0),n=null,i=Dv,a=null;t=typeof t=="function"?t:t===void 0?Fv:Ue(t),e=typeof e=="function"?e:e===void 0?Bv:Ue(e);function o(s){var c,l=(s=_v(s)).length,u,f=!1,h;for(n==null&&(a=i(h=ns())),c=0;c<=l;++c)!(c{v%2&&f.push(h)}),Mn(f,5,.75)}function l(u,f=0){const h=u*5.625-150,v=Math.cos(h*Math.PI/180),p=Math.sin(h*Math.PI/180),y=et+4+f;return[Z+v*y,Q+p*y]}return React.useEffect(()=>{var u;if((u=t.data)!=null&&u.length){const f=[[],[],[],[]];c(t.data).map((h,v)=>{f[v%4].push(l(v,h*h/65025*42+4))}),f.map((h,v)=>{var y;const p=gr().x(d=>d[0]).y(d=>d[1]).curve(mr)(h);p&&((y=s.current[v])==null||y.attr("path",p))})}},[t.data]),React.useEffect(()=>{a.current=new Ee({container:"SPath",width:2*Z,height:2*Q,renderer:new Pe}),o.current=Te(a.current,{x:Z,y:Q,r:et,shadowColor:i[0]});const u=Array.from({length:64/4},(h,v)=>l(v*4)),f=gr().x(h=>h[0]).y(h=>h[1]).curve(mr)(u);Array.from({length:4},(h,v)=>{var p;if(f){const y=new En({style:{stroke:i[v],lineWidth:1,path:f}});(p=a.current)==null||p.appendChild(y),s.current.push(y)}})},[]),we(a,o,t.isPlaying,t.audioImg),V.jsx("div",{id:"SPath",className:"s-canvas-wrapper"})}function Uv(t){const n=["#90E3F5","#5C8AF4","#BEABF0","#E1A2E1"],i=React.useRef(),a=React.useRef(),o=React.useRef([]);function s(l){let u=[];return l.map((f,h)=>{h%2&&u.push(f)}),Mn(u,5,.75)}function c(l,u=0){const f=l*5.625-150,h=Math.cos(f*Math.PI/180),v=Math.sin(f*Math.PI/180),p=et+u;return[Z+h*p,Q+v*p]}return React.useEffect(()=>{var l;if((l=t.data)!=null&&l.length){const u=[[],[],[],[]];s(t.data).map((f,h)=>{u[h%4].push(c(h,f*f/65025*60))}),u.map((f,h)=>{const v=gr().x(p=>p[0]).y(p=>p[1]).curve(mr)(f);v&&o.current[h].attr("path",v)})}},[t.data]),React.useEffect(()=>{i.current=new Ee({container:"SPathFill",width:2*Z,height:2*Q,renderer:new Pe});const l=Array.from({length:64/4},(f,h)=>c(h*4)),u=gr().x(f=>f[0]).y(f=>f[1]).curve(mr)(l);Array.from({length:4},(f,h)=>{var v;if(u){const p=new En({style:{stroke:n[h],lineWidth:2,path:u,fill:"rgba(255,255,255,0.2)"}});(v=i.current)==null||v.appendChild(p),o.current.push(p)}}),a.current=Te(i.current,{x:Z,y:Q,r:et,shadowColor:"#ffffff"})},[]),we(i,a,t.isPlaying,t.audioImg),V.jsx("div",{id:"SPathFill",className:"s-canvas-wrapper"})}function ss(){const[t,e]=React.useState(()=>document.visibilityState==="visible");return React.useEffect(()=>{const r=()=>e(document.visibilityState==="visible");return document.addEventListener("visibilitychange",r),()=>{document.removeEventListener("visibilitychange",r)}}),t}class xi{constructor(e,r){Xt(this,"timerId");Xt(this,"remaining");Xt(this,"start");Xt(this,"callback");Xt(this,"complete");this.complete=!1,this.remaining=r,this.callback=()=>{this.complete=!0,e()},this.start=Date.now(),this.timerId=setTimeout(this.callback,this.remaining)}pause(){clearTimeout(this.timerId),this.remaining-=Date.now()-this.start}play(){clearTimeout(this.timerId),this.remaining>0&&(this.start=Date.now(),this.timerId=setTimeout(this.callback,this.remaining))}}function Yv(t){const e="#fff",r="#fa7",s=React.useRef(),c=React.useRef(),l=React.useRef([]),u=React.useRef([]),f=()=>{const d=u.current||[],m=d.sort((g,T)=>T-g).slice(0,10),E=~~(Math.random()*10),M=m[E],P=d.findIndex(g=>g===M);return~P?P*360/d.length:1};React.useEffect(()=>{u.current=t.data||[]},[t.data]),React.useEffect(()=>{if(!s.current){s.current=new Ee({container:"SCircle",width:2*Z,height:2*Q,renderer:new Pe}),c.current=Te(s.current,{x:Z,y:Q,r:et,shadowColor:"#fcc8d9"});const d=()=>{var M,P;const m=new xe({style:{cx:Z,cy:Q,stroke:e,lineWidth:2,opacity:1,r:et}}),E=new xe({style:{r:5,fill:e,shadowColor:r,shadowBlur:5,opacity:0}});return(M=s.current)==null||M.appendChild(m),(P=s.current)==null||P.appendChild(E),[m,E]};Array.from({length:3},(m,E)=>{const[M,P]=d();l.current.push({circle:M,dot:P})})}t.isPlaying?h(!0):h(!1)},[t.isPlaying]),we(s,c,t.isPlaying,t.audioImg);function h(d=!0){var E,M,P,x;const m=d?"play":"pause";for(let g=0;g{v(l.current[g].circle)},g*2e3));const w=(P=l.current[g].dot.getAnimations())==null?void 0:P[0];w?w[m]():l.current[g].dot._timer?(x=l.current[g].dot._timer)==null||x[m]():d&&(l.current[g].dot._timer=new xi(()=>{p(l.current[g].dot)},g*2e3))}}function v(d){const m=d.animate([{transform:"scale(1)",opacity:.8},{transform:"scale(2)",opacity:0}],{duration:6e3});m&&(m.onfinish=()=>{m.cancel(),v(d)})}function p(d){const m=-135+f(),E=Math.cos(m*Math.PI/180),M=Math.sin(m*Math.PI/180);d.setAttribute("cx",Z+E*et),d.setAttribute("cy",Q+M*et),d.setAttribute("transformOrigin",`${-E*et+5}px ${-M*et+5}px`);const P=d.animate([{transform:"rotate(0) translate(0, 0)",opacity:0,offset:.01},{opacity:.9,offset:.02},{transform:`rotate(360deg) translate(${E*et}, ${M*et})`,opacity:0}],{duration:2e3*3});P&&(P.onfinish=()=>{P.cancel(),p(d)})}const y=ss();return React.useEffect(()=>{t.isPlaying&&h(y)},[y]),V.jsx("div",{id:"SCircle",className:"s-canvas-wrapper"})}function Hv(t){const n="#e9dcf7",i=React.useRef(),a=React.useRef(),o=React.useRef(),s=React.useRef([]);function c(u){let f=[];return u.map((h,v)=>{v%2&&f.push(h)}),Mn(f,3,.5)}function l(u,f=0){const h=u*5.625-150,v=Math.cos(h*Math.PI/180),p=Math.sin(h*Math.PI/180),y=et+10+f;return[Z+v*y,Q+p*y]}return React.useEffect(()=>{var u,f;if((u=t.data)!=null&&u.length){const h=[],v=c(t.data);v.map((y,d)=>{const m=l(d,y*y/65025*60),E=l(d,-y*y/65025*12);h[d]=m,h[v.length+d]=E,s.current[d].attr("x1",m[0]),s.current[d].attr("y1",m[1]),s.current[d].attr("x2",E[0]),s.current[d].attr("y2",E[1])});const p=gr().x(y=>y[0]).y(y=>y[1]).curve(mr)(h);p&&((f=o.current)==null||f.attr("path",p))}},[t.data]),React.useEffect(()=>{i.current=new Ee({container:"SPathDouble",width:2*Z,height:2*Q,renderer:new Pe}),a.current=Te(i.current,{x:Z,y:Q,r:et,shadowColor:n}),o.current=new En({style:{stroke:n,lineWidth:1,path:Iv(Z,Q,et+10)}}),i.current.appendChild(o.current),s.current=Array.from({length:64},(u,f)=>{var v;const h=new Ai({style:{x1:Z,y1:Q-et,x2:Z,y2:Q-et,stroke:n,lineWidth:1}});return(v=i.current)==null||v.appendChild(h),h})},[]),we(i,a,t.isPlaying,t.audioImg),V.jsx("div",{id:"SPathDouble",className:"s-canvas-wrapper"})}function Wv(t){const i="#e9dcf7",o=React.useRef(),s=React.useRef(),c=React.useRef([]),l=React.useRef([]);function u(h){return h.reduce((v,p,y)=>y%2?[...v,p]:v,[])}function f(h,v=0){const p=h*5.625-150,y=Math.cos(p*Math.PI/180),d=Math.sin(p*Math.PI/180),m=et+10+v;return[Z+y*m,Q+d*m,y,d]}return React.useEffect(()=>{var h;(h=t.data)!=null&&h.length&&u(t.data).map((v,p)=>{const[y,d]=f(p,v*v/65025*24+4);c.current[p].attr("cx",y),c.current[p].attr("cy",d),l.current[p].attr("x2",y),l.current[p].attr("y2",d)})},[t.data]),React.useEffect(()=>{o.current=new Ee({container:"SDot",width:2*Z,height:2*Q,renderer:new Pe}),s.current=Te(o.current,{x:Z,y:Q,r:et,shadowColor:i}),Array.from({length:64},(h,v)=>{var x,g;const[p,y,d,m]=f(v),E=~~(v*(360/64)+210),M=new xe({style:{cx:p,cy:y,r:2,fill:i}}),P=new Ai({style:{x1:p,y1:y,x2:p,y2:y,lineWidth:2*1.4,stroke:`l(${E}) 0.3:rgba(255,255,255,0) 1:${i}`}});(x=o.current)==null||x.appendChild(M),(g=o.current)==null||g.appendChild(P),c.current.push(M),l.current.push(P)})},[]),we(o,s,t.isPlaying,t.audioImg),V.jsx("div",{id:"SDot",className:"s-canvas-wrapper"})}function zv(t){const n="#e9dcf7",i=React.useRef(),a=React.useRef(),o=React.useRef([]);function s(c){let l=[];return c.map((u,f)=>{f%2&&l.push(u)}),Mn(l,5,.75)}return React.useEffect(()=>{var c;if((c=t.data)!=null&&c.length){const l=s(t.data),u=64/8;l.map((f,h)=>{var v,p;if(h%u===0){const y=h/u,d=f/8,m=y*(360/8)-150,E=Math.cos(m*Math.PI/180),M=Math.sin(m*Math.PI/180);(v=o.current[y])==null||v.attr("cx",Z+E*d),(p=o.current[y])==null||p.attr("cy",Q+M*d)}})}},[t.data]),React.useEffect(()=>{i.current=new Ee({container:"SCircleMultiple",width:2*Z,height:2*Q,renderer:new Pe}),o.current=Array.from({length:8},(c,l)=>{var f;const u=new xe({style:{cx:Z,cy:Q,r:et+8,stroke:n,strokeWidth:1,shadowColor:"#ffaa44",shadowBlur:2}});return(f=i.current)==null||f.appendChild(u),u}),a.current=Te(i.current,{x:Z,y:Q,r:et,shadowColor:n})},[]),we(i,a,t.isPlaying,t.audioImg),V.jsx("div",{id:"SCircleMultiple",className:"s-canvas-wrapper"})}function Xv(t){const c=React.useRef(),l=React.useRef(),u=React.useRef([]),f=React.useRef(-1),h=React.useRef();React.useEffect(()=>{if(t.isPlaying&&t.data&&t.data.length){if(h.current)return;h.current=setTimeout(()=>{const d=t.data?t.data.reduce((x,g,T)=>T%2?[...x,g]:x,[]):[],m=d.sort((x,g)=>g-x).slice(0,10),E=~~(Math.random()*10),M=m[E],P=d.findIndex(x=>x===M);f.current=P,h.current=void 0,clearTimeout(h.current)},300)}},[t.isPlaying,t.data]),React.useEffect(()=>{c.current||(c.current=new Ee({container:"SParticle",width:2*Z,height:2*Q,renderer:new Pe}),l.current=Te(c.current,{x:Z,y:Q,r:et,shadowColor:"#fcc8d9"}),Array.from({length:48},(d,m)=>{Array.from({length:8},(E,M)=>{var S;const P=m*7.5-150+(Math.random()-.5)*10,x=Math.cos(P*Math.PI/180),g=Math.sin(P*Math.PI/180),T=et+0,w=Z+x*T,b=Q+g*T,C=new xe({style:{cx:w,cy:b,r:.64,fill:"#fff",opacity:0,transformOrigin:`${-x*et+.64}px ${-g*et+.64}px`}});C.dataset.deg=P,C.dataset.index1=m,(S=c.current)==null||S.appendChild(C),u.current.push(C)})})),t.isPlaying?v(!0):v(!1)},[t.isPlaying]),we(c,l,t.isPlaying,t.audioImg);function v(d=!0){var E,M;const m=d?"play":"pause";for(let P=0;P{p(u.current[P])},Math.random()*4e3))}}function p(d){const m=~~d.dataset.deg,E=~~d.dataset.index1,M=Math.cos(m*Math.PI/180),P=Math.sin(m*Math.PI/180),g=E>=f.current-1&&E<=f.current+1?64:20,T=Array.from({length:4},(b,C)=>{const S=.2*(C+1),N=m+Math.sin(S*20)*6,O=Math.cos(N*Math.PI/180),k=Math.sin(N*Math.PI/180);return{transform:`translate(${O*g*S}, ${k*g*S})`,offset:S}}),w=d.animate([{transform:"translate(0, 0)",opacity:1},...T,{transform:`translate(${M*g}, ${P*g})`,opacity:0}],{duration:4e3});w&&(w.onfinish=()=>{w.cancel(),p(d)})}const y=ss();return React.useEffect(()=>{t.isPlaying&&v(y)},[y]),V.jsx("div",{id:"SParticle",className:"s-canvas-wrapper"})}const Vv=` -`;function qv(t){const e=t.trim().slice(1,-1),r=e.indexOf(":");return[e.substring(0,r).trim(),e.substring(r+1).trim()]}function $v(t){if(typeof t!="string")throw new TypeError("expect first argument to be a string");let e=t.split(Vv);const r=/\[(\d*\:\d*\.?\d*)\]/,n=/(.+)/,i=r,a=new RegExp(r.source+n.source),o=[],s=[],c={};for(let u=0;a.test(e[u])===!1;u++)o.push(e[u]);o.reduce((u,f)=>{const[h,v]=qv(f);return u[h]=v,u},c),e.splice(0,o.length);const l=new RegExp(a.source+"|"+i.source);e=e.filter(u=>l.test(u));for(let u=0,f=e.length;u1&&(m=E[1],d=y.replace(`(${m})`,""));const[,M]=v;s.push({start:_a(p),text:d,translateText:m,end:_a(M)})}}return c.scripts=s,c}function _a(t){const e=t.split(":"),r=parseInt(e[0],10),n=parseFloat(e[1]);if(r>0){const i=r*60+n;return parseFloat(i.toFixed(2))}return n}let ue=-1,Qt=null;const Kv=React.forwardRef((t,e)=>{React.useImperativeHandle(e,()=>({onUpdateTime:n}));const r=React.useRef(null),n=a=>{if(!(~ue&&t.lrcContent[ue]&&t.lrcContent[ue].start<=a&&t.lrcContent[ue].end>=a)){ue=-1;for(let o=0;o=t.lrcContent[o].start&&a<=t.lrcContent[o].end){ue=o;break}if(~ue){const o=t.lrcContent[ue],s=o.end-o.start,c=(a-o.start)/s*100;i(o.text,s,c)}else i("",0)}};function i(a,o,s=0){r.current&&(r.current.innerHTML=a,Qt=r.current.animate([{backgroundSize:`${s}% 100%`},{backgroundSize:"100% 100%"}],{duration:o*1e3,easing:"cubic-bezier(0.34, 0.08, 0.41, 0.82)"}))}return React.useEffect(()=>{i("",0),Qt==null||Qt.pause()},[t.lrcContent]),React.useEffect(()=>{t.isPlaying?Qt==null||Qt.play():Qt==null||Qt.pause()},[t.isPlaying]),V.jsx("div",{ref:r,className:"lyric-content"})}),Da=new Is,Zv=[kv,Hv,Gv,Uv,Wv,Yv,zv,Xv];function Qv(){const t=React.useRef(null);React.useEffect(()=>{Da.setAudioEl(t.current)},[]);const[e,r]=React.useState("Please load a music..."),[n,i]=React.useState(),[a,o]=React.useState([]),[s,c]=React.useState(rs),[l,u]=React.useState(!1),[f,h]=React.useState([]),[v,p]=React.useState([]),y=React.useRef(null),d=React.useRef(null);let m,E=React.useRef();function M(N){m||(m=N);const O=N-m;(O===0||O>0)&&(o([...Da.getVisualizeValue()]),m=N),E.current=requestAnimationFrame(M)}function P(){u(!0),E.current=requestAnimationFrame(M)}function x(){u(!1),E.current&&cancelAnimationFrame(E.current)}async function g(){try{const N=await(await fetch("https://api.injahow.cn/meting/?type=playlist&id=8577182717")).json();N&&N.length>0&&h(N)}catch{}}React.useEffect(()=>{g()},[]);async function T(){var N;try{let O="",k="",B="";if(f&&f.length>0){const Y=~~[Math.random()*f.length],{name:I,url:G,artist:H,pic:lt,lrc:rt}=f[Y];S(rt);const{url:St}=await fetch(lt,{method:"HEAD"});O=`${I} - ${H}`,k=G,B=St.split("?")[0]+"?param=400y400"}else throw new Error("Can not get play list");r(O),i(k),c(B),x()}catch(O){console.error(O),(N=t.current)==null||N.pause(),x(),alert("API busy...")}}function w(){var N;(N=y.current)==null||N.click()}function b(N){const O=N.target.files[0],k=URL.createObjectURL(O);r(O.name),i(k)}function C(){var O,k;const N=(O=t.current)==null?void 0:O.currentTime;typeof N<"u"&&((k=d.current)==null||k.onUpdateTime(N))}async function S(N){try{const O=await(await fetch(N)).text(),k=$v(O);k.scripts&&k.scripts.length>0?p(k.scripts):p([])}catch(O){console.error(O),p([])}}return V.jsxs(V.Fragment,{children:[V.jsxs("main",{className:De.page,children:[V.jsxs("div",{className:De.operationWrapper,children:[V.jsx("button",{className:"btn m10",onClick:T,children:"Random an online music"}),V.jsx("button",{className:"btn m10",onClick:w,children:"Choose a local muisc"}),V.jsx("div",{className:"strong-text m10",style:{minWidth:"200px"},children:e}),V.jsx("input",{type:"file",style:{display:"none"},ref:y,onChange:b})]}),V.jsxs("div",{className:De.audioWrapper,children:[V.jsx("audio",{controls:!0,onPlay:P,onPause:x,ref:t,src:n,crossOrigin:"anonymous",onTimeUpdate:C}),V.jsx("div",{className:"lyric-wrapper",children:V.jsx(Kv,{isPlaying:l,lrcContent:v,ref:d})})]}),V.jsxs("div",{className:De.exampleWrapper,children:[Zv.map((N,O)=>V.jsxs("div",{className:"s-model",children:[V.jsx("div",{className:"img-bg-wrapper",children:V.jsx("img",{src:s})}),V.jsx(N,{isPlaying:l,data:a,audioImg:s})]},O)),Array.from({length:5}).map((N,O)=>V.jsx("div",{className:"s-module-fake"},O))]})]}),V.jsxs("footer",{className:De.footer,children:["©",V.jsx("a",{href:"mailto://kfd_personal@163.com",children:"Leon.D"}),V.jsxs("a",{className:De.github,href:"https://github.com/leon-kfd/g-music-visualizer",target:"_blank",children:[V.jsx("svg",{viewBox:"0 0 1024 1024",width:"20",height:"20",children:V.jsx("path",{d:"M960 512c0 97.76-28.704 185.216-85.664 263.264-56.96 78.016-130.496 131.84-220.64 161.856-10.304 1.824-18.368 0.448-22.848-4.032a22.4 22.4 0 0 1-7.2-17.504v-122.88c0-37.632-10.304-65.44-30.464-82.912a409.856 409.856 0 0 0 59.616-10.368 222.752 222.752 0 0 0 54.72-22.816c18.848-10.784 34.528-23.36 47.104-38.592 12.544-15.232 22.848-35.904 30.912-61.44 8.096-25.568 12.128-54.688 12.128-87.904 0-47.072-15.232-86.976-46.208-120.16 14.368-35.456 13.024-74.912-4.48-118.848-10.752-3.616-26.432-1.344-47.072 6.272s-38.56 16.16-53.824 25.568l-21.984 13.888c-36.32-10.304-73.536-15.232-112.096-15.232s-75.776 4.928-112.096 15.232a444.48 444.48 0 0 0-24.672-15.68c-10.336-6.272-26.464-13.888-48.896-22.432-21.952-8.96-39.008-11.232-50.24-8.064-17.024 43.936-18.368 83.424-4.032 118.848-30.496 33.632-46.176 73.536-46.176 120.608 0 33.216 4.032 62.336 12.128 87.456 8.032 25.12 18.368 45.76 30.496 61.44 12.544 15.68 28.224 28.704 47.072 39.04 18.848 10.304 37.216 17.92 54.72 22.816a409.6 409.6 0 0 0 59.648 10.368c-15.712 13.856-25.12 34.048-28.704 60.064a99.744 99.744 0 0 1-26.464 8.512 178.208 178.208 0 0 1-33.184 2.688c-13.024 0-25.568-4.032-38.144-12.544-12.544-8.512-23.296-20.64-32.256-36.32a97.472 97.472 0 0 0-28.256-30.496c-11.232-8.064-21.088-12.576-28.704-13.92l-11.648-1.792c-8.096 0-13.92 0.928-17.056 2.688-3.136 1.792-4.032 4.032-2.688 6.72s3.136 5.408 5.376 8.096 4.928 4.928 7.616 7.168l4.032 2.688c8.544 4.032 17.056 11.232 25.568 21.984 8.544 10.752 14.368 20.64 18.4 29.6l5.824 13.44c4.928 14.816 13.44 26.912 25.568 35.872 12.096 8.992 25.088 14.816 39.008 17.504 13.888 2.688 27.36 4.032 40.352 4.032s23.776-0.448 32.288-2.24l13.472-2.24c0 14.784 0 32.288 0.416 52.032 0 19.744 0.48 30.496 0.48 31.392a22.624 22.624 0 0 1-7.648 17.472c-4.928 4.48-12.992 5.824-23.296 4.032-90.144-30.048-163.68-83.84-220.64-161.888C92.256 697.216 64 609.312 64 512c0-81.152 20.192-156.064 60.096-224.672s94.176-122.88 163.232-163.232C355.936 84.192 430.816 64 512 64s156.064 20.192 224.672 60.096 122.88 94.176 163.232 163.232C939.808 355.488 960 430.848 960 512",fill:"#585862"})}),V.jsx("span",{children:" Github"})]})]})]})}const Jv=React.createContext({});function jv(){const[t,e]=React.useState({mainColor:"#262626"});return V.jsx(Jv.Provider,{value:{state:t,setState:e},children:V.jsx("div",{className:"App",children:V.jsx(Qv,{})})})}var zn=function(t){z(e,t);function e(r,n,i,a){var o=t.call(this,r)||this;return o.currentTime=i,o.timelineTime=a,o.target=n,o.type="finish",o.bubbles=!1,o.currentTarget=n,o.defaultPrevented=!1,o.eventPhase=o.AT_TARGET,o.timeStamp=Date.now(),o.currentTime=i,o.timelineTime=a,o}return e}(xn),td=0,ed=function(){function t(e,r){var n;this.currentTimePending=!1,this._idle=!0,this._paused=!1,this._finishedFlag=!0,this._currentTime=0,this._playbackRate=1,this._inTimeline=!0,this.effect=e,e.animation=this,this.timeline=r,this.id="".concat(td++),this._inEffect=!!this.effect.update(0),this._totalDuration=Number((n=this.effect)===null||n===void 0?void 0:n.getComputedTiming().endTime),this._holdTime=0,this._paused=!1,this.oldPlayState="idle",this.updatePromises()}return Object.defineProperty(t.prototype,"pending",{get:function(){return this._startTime===null&&!this._paused&&this.playbackRate!==0||this.currentTimePending},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"playState",{get:function(){return this._idle?"idle":this._isFinished?"finished":this._paused?"paused":"running"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ready",{get:function(){var e=this;return this.readyPromise||(this.timeline.animationsWithPromises.indexOf(this)===-1&&this.timeline.animationsWithPromises.push(this),this.readyPromise=new Promise(function(r,n){e.resolveReadyPromise=function(){r(e)},e.rejectReadyPromise=function(){n(new Error)}}),this.pending||this.resolveReadyPromise()),this.readyPromise},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"finished",{get:function(){var e=this;return this.finishedPromise||(this.timeline.animationsWithPromises.indexOf(this)===-1&&this.timeline.animationsWithPromises.push(this),this.finishedPromise=new Promise(function(r,n){e.resolveFinishedPromise=function(){r(e)},e.rejectFinishedPromise=function(){n(new Error)}}),this.playState==="finished"&&this.resolveFinishedPromise()),this.finishedPromise},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"currentTime",{get:function(){return this.updatePromises(),this._idle||this.currentTimePending?null:this._currentTime},set:function(e){var r;e=Number(e),!isNaN(e)&&(this.timeline.restart(),!this._paused&&this._startTime!==null&&(this._startTime=Number((r=this.timeline)===null||r===void 0?void 0:r.currentTime)-e/this.playbackRate),this.currentTimePending=!1,this._currentTime!==e&&(this._idle&&(this._idle=!1,this._paused=!0),this.tickCurrentTime(e,!0),this.timeline.applyDirtiedAnimation(this)))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"startTime",{get:function(){return this._startTime},set:function(e){if(e!==null){if(this.updatePromises(),e=Number(e),isNaN(e)||this._paused||this._idle)return;this._startTime=e,this.tickCurrentTime((Number(this.timeline.currentTime)-this._startTime)*this.playbackRate),this.timeline.applyDirtiedAnimation(this),this.updatePromises()}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"playbackRate",{get:function(){return this._playbackRate},set:function(e){if(e!==this._playbackRate){this.updatePromises();var r=this.currentTime;this._playbackRate=e,this.startTime=null,this.playState!=="paused"&&this.playState!=="idle"&&(this._finishedFlag=!1,this._idle=!1,this.ensureAlive(),this.timeline.applyDirtiedAnimation(this)),r!==null&&(this.currentTime=r),this.updatePromises()}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_isFinished",{get:function(){return!this._idle&&(this._playbackRate>0&&Number(this._currentTime)>=this._totalDuration||this._playbackRate<0&&Number(this._currentTime)<=0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"totalDuration",{get:function(){return this._totalDuration},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_needsTick",{get:function(){return this.pending||this.playState==="running"||!this._finishedFlag},enumerable:!1,configurable:!0}),t.prototype.updatePromises=function(){var e=this.oldPlayState,r=this.pending?"pending":this.playState;return this.readyPromise&&r!==e&&(r==="idle"?(this.rejectReadyPromise(),this.readyPromise=void 0):e==="pending"?this.resolveReadyPromise():r==="pending"&&(this.readyPromise=void 0)),this.finishedPromise&&r!==e&&(r==="idle"?(this.rejectFinishedPromise(),this.finishedPromise=void 0):r==="finished"?this.resolveFinishedPromise():e==="finished"&&(this.finishedPromise=void 0)),this.oldPlayState=r,this.readyPromise||this.finishedPromise},t.prototype.play=function(){this.updatePromises(),this._paused=!1,(this._isFinished||this._idle)&&(this.rewind(),this._startTime=null),this._finishedFlag=!1,this._idle=!1,this.ensureAlive(),this.timeline.applyDirtiedAnimation(this),this.timeline.animations.indexOf(this)===-1&&this.timeline.animations.push(this),this.updatePromises()},t.prototype.pause=function(){this.updatePromises(),this.currentTime&&(this._holdTime=this.currentTime),!this._isFinished&&!this._paused&&!this._idle?this.currentTimePending=!0:this._idle&&(this.rewind(),this._idle=!1),this._startTime=null,this._paused=!0,this.updatePromises()},t.prototype.finish=function(){this.updatePromises(),!this._idle&&(this.currentTime=this._playbackRate>0?this._totalDuration:0,this._startTime=this._totalDuration-this.currentTime,this.currentTimePending=!1,this.timeline.applyDirtiedAnimation(this),this.updatePromises())},t.prototype.cancel=function(){var e=this;if(this.updatePromises(),!!this._inEffect&&(this._inEffect=!1,this._idle=!0,this._paused=!1,this._finishedFlag=!0,this._currentTime=0,this._startTime=null,this.effect.update(null),this.timeline.applyDirtiedAnimation(this),this.updatePromises(),this.oncancel)){var r=new zn(null,this,this.currentTime,null);setTimeout(function(){e.oncancel(r)})}},t.prototype.reverse=function(){this.updatePromises();var e=this.currentTime;this.playbackRate*=-1,this.play(),e!==null&&(this.currentTime=e),this.updatePromises()},t.prototype.updatePlaybackRate=function(e){this.playbackRate=e},t.prototype.targetAnimations=function(){var e,r=(e=this.effect)===null||e===void 0?void 0:e.target;return r.getAnimations()},t.prototype.markTarget=function(){var e=this.targetAnimations();e.indexOf(this)===-1&&e.push(this)},t.prototype.unmarkTarget=function(){var e=this.targetAnimations(),r=e.indexOf(this);r!==-1&&e.splice(r,1)},t.prototype.tick=function(e,r){!this._idle&&!this._paused&&(this._startTime===null?r&&(this.startTime=e-this._currentTime/this.playbackRate):this._isFinished||this.tickCurrentTime((e-this._startTime)*this.playbackRate)),r&&(this.currentTimePending=!1,this.fireEvents(e))},t.prototype.rewind=function(){if(this.playbackRate>=0)this.currentTime=0;else if(this._totalDuration<1/0)this.currentTime=this._totalDuration;else throw new Error("Unable to rewind negative playback rate animation with infinite duration")},t.prototype.persist=function(){throw new Error(J)},t.prototype.addEventListener=function(e,r,n){throw new Error(J)},t.prototype.removeEventListener=function(e,r,n){throw new Error(J)},t.prototype.dispatchEvent=function(e){throw new Error(J)},t.prototype.commitStyles=function(){throw new Error(J)},t.prototype.ensureAlive=function(){var e,r;this.playbackRate<0&&this.currentTime===0?this._inEffect=!!(!((e=this.effect)===null||e===void 0)&&e.update(-1)):this._inEffect=!!(!((r=this.effect)===null||r===void 0)&&r.update(this.currentTime)),!this._inTimeline&&(this._inEffect||!this._finishedFlag)&&(this._inTimeline=!0,this.timeline.animations.push(this))},t.prototype.tickCurrentTime=function(e,r){e!==this._currentTime&&(this._currentTime=e,this._isFinished&&!r&&(this._currentTime=this._playbackRate>0?this._totalDuration:0),this.ensureAlive())},t.prototype.fireEvents=function(e){var r=this;if(this._isFinished){if(!this._finishedFlag){if(this.onfinish){var n=new zn(null,this,this.currentTime,e);setTimeout(function(){r.onfinish&&r.onfinish(n)})}this._finishedFlag=!0}}else{if(this.onframe&&this.playState==="running"){var i=new zn(null,this,this.currentTime,e);this.onframe(i)}this._finishedFlag=!1}},t}(),rd=4,nd=.001,id=1e-7,ad=10,sr=11,Gr=1/(sr-1),od=typeof Float32Array=="function",cs=function(t,e){return 1-3*e+3*t},ls=function(t,e){return 3*e-6*t},us=function(t){return 3*t},dn=function(t,e,r){return((cs(e,r)*t+ls(e,r))*t+us(e))*t},fs=function(t,e,r){return 3*cs(e,r)*t*t+2*ls(e,r)*t+us(e)},sd=function(t,e,r,n,i){var a,o,s=0;do o=e+(r-e)/2,a=dn(o,n,i)-t,a>0?r=o:e=o;while(Math.abs(a)>id&&++s=nd?cd(s,h,t,r):v===0?h:sd(s,c,c+Gr,t,r)};return function(s){return s===0||s===1?s:dn(o(s),e,n)}},ld=function(t){return t=t.replace(/([A-Z])/g,function(e){return"-".concat(e.toLowerCase())}),t.charAt(0)==="-"?t.substring(1):t},Ur=function(t){return Math.pow(t,2)},Yr=function(t){return Math.pow(t,3)},Hr=function(t){return Math.pow(t,4)},Wr=function(t){return Math.pow(t,5)},zr=function(t){return Math.pow(t,6)},Xr=function(t){return 1-Math.cos(t*Math.PI/2)},Vr=function(t){return 1-Math.sqrt(1-t*t)},qr=function(t){return t*t*(3*t-2)},$r=function(t){for(var e,r=4;t<((e=Math.pow(2,--r))-1)/11;);return 1/Math.pow(4,3-r)-7.5625*Math.pow((e*3-2)/22-t,2)},Kr=function(t,e){e===void 0&&(e=[]);var r=_(e,2),n=r[0],i=n===void 0?1:n,a=r[1],o=a===void 0?.5:a,s=kt(Number(i),1,10),c=kt(Number(o),.1,2);return t===0||t===1?t:-s*Math.pow(2,10*(t-1))*Math.sin((t-1-c/(Math.PI*2)*Math.asin(1/s))*(Math.PI*2)/c)},rr=function(t,e,r){e===void 0&&(e=[]);var n=_(e,4),i=n[0],a=i===void 0?1:i,o=n[1],s=o===void 0?100:o,c=n[2],l=c===void 0?10:c,u=n[3],f=u===void 0?0:u;a=kt(a,.1,1e3),s=kt(s,.1,1e3),l=kt(l,.1,1e3),f=kt(f,.1,1e3);var h=Math.sqrt(s/a),v=l/(2*Math.sqrt(s*a)),p=v<1?h*Math.sqrt(1-v*v):0,y=1,d=v<1?(v*h+-f)/p:-f+h,m=r?r*t/1e3:t;return v<1?m=Math.exp(-m*v*h)*(y*Math.cos(p*m)+d*Math.sin(p*m)):m=(y+d*m)*Math.exp(-m*h),t===0||t===1?t:1-m},Xn=function(t,e){e===void 0&&(e=[]);var r=_(e,2),n=r[0],i=n===void 0?10:n,a=r[1],o=a=="start"?Math.ceil:Math.floor;return o(kt(t,0,1)*i)/i},Fa=function(t,e){e===void 0&&(e=[]);var r=_(e,4),n=r[0],i=r[1],a=r[2],o=r[3];return Oi(n,i,a,o)(t)},Zr=Oi(.42,0,1,1),Dt=function(t){return function(e,r,n){return r===void 0&&(r=[]),1-t(1-e,r,n)}},Ft=function(t){return function(e,r,n){return r===void 0&&(r=[]),e<.5?t(e*2,r,n)/2:1-t(e*-2+2,r,n)/2}},Bt=function(t){return function(e,r,n){return r===void 0&&(r=[]),e<.5?(1-t(1-e*2,r,n))/2:(t(e*2-1,r,n)+1)/2}},Ba={steps:Xn,"step-start":function(t){return Xn(t,[1,"start"])},"step-end":function(t){return Xn(t,[1,"end"])},linear:function(t){return t},"cubic-bezier":Fa,ease:function(t){return Fa(t,[.25,.1,.25,1])},in:Zr,out:Dt(Zr),"in-out":Ft(Zr),"out-in":Bt(Zr),"in-quad":Ur,"out-quad":Dt(Ur),"in-out-quad":Ft(Ur),"out-in-quad":Bt(Ur),"in-cubic":Yr,"out-cubic":Dt(Yr),"in-out-cubic":Ft(Yr),"out-in-cubic":Bt(Yr),"in-quart":Hr,"out-quart":Dt(Hr),"in-out-quart":Ft(Hr),"out-in-quart":Bt(Hr),"in-quint":Wr,"out-quint":Dt(Wr),"in-out-quint":Ft(Wr),"out-in-quint":Bt(Wr),"in-expo":zr,"out-expo":Dt(zr),"in-out-expo":Ft(zr),"out-in-expo":Bt(zr),"in-sine":Xr,"out-sine":Dt(Xr),"in-out-sine":Ft(Xr),"out-in-sine":Bt(Xr),"in-circ":Vr,"out-circ":Dt(Vr),"in-out-circ":Ft(Vr),"out-in-circ":Bt(Vr),"in-back":qr,"out-back":Dt(qr),"in-out-back":Ft(qr),"out-in-back":Bt(qr),"in-bounce":$r,"out-bounce":Dt($r),"in-out-bounce":Ft($r),"out-in-bounce":Bt($r),"in-elastic":Kr,"out-elastic":Dt(Kr),"in-out-elastic":Ft(Kr),"out-in-elastic":Bt(Kr),spring:rr,"spring-in":rr,"spring-out":Dt(rr),"spring-in-out":Ft(rr),"spring-out-in":Bt(rr)},ud=function(t){return ld(t).replace(/^ease-/,"").replace(/(\(|\s).+/,"").toLowerCase().trim()},fd=function(t){return Ba[ud(t)]||Ba.linear},hd=function(t){return t},vd=1,dd=.5,Ga=0;function Ua(t,e){return function(r){if(r>=1)return 1;var n=1/t;return r+=e*n,r-r%n}}var Qr="\\s*(-?\\d+\\.?\\d*|-?\\.\\d+)\\s*",pd=new RegExp("cubic-bezier\\("+Qr+","+Qr+","+Qr+","+Qr+"\\)"),yd=/steps\(\s*(\d+)\s*\)/,gd=/steps\(\s*(\d+)\s*,\s*(start|middle|end)\s*\)/;function ki(t){var e=pd.exec(t);if(e)return Oi.apply(void 0,X([],_(e.slice(1).map(Number)),!1));var r=yd.exec(t);if(r)return Ua(Number(r[1]),Ga);var n=gd.exec(t);return n?Ua(Number(n[1]),{start:vd,middle:dd,end:Ga}[n[2]]):fd(t)}function md(t){return Math.abs(xd(t)/(t.playbackRate||1))}function xd(t){var e;return t.duration===0||t.iterations===0?0:(t.duration==="auto"?0:Number(t.duration))*((e=t.iterations)!==null&&e!==void 0?e:1)}var hs=0,Ii=1,Pn=2,vs=3;function Ed(t,e,r){if(e===null)return hs;var n=r.endTime;return e=Math.min(r.delay+t+r.endDelay,n)?Pn:vs}function Md(t,e,r,n,i){switch(n){case Ii:return e==="backwards"||e==="both"?0:null;case vs:return r-i;case Pn:return e==="forwards"||e==="both"?t:null;case hs:return null}}function Pd(t,e,r,n,i){var a=i;return t===0?e!==Ii&&(a+=r):a+=n/t,a}function Td(t,e,r,n,i,a){var o=t===1/0?e%1:t%1;return o===0&&r===Pn&&n!==0&&(i!==0||a===0)&&(o=1),o}function wd(t,e,r,n){return t===Pn&&e===1/0?1/0:r===1?Math.floor(n)-1:Math.floor(n)}function bd(t,e,r){var n=t;if(t!=="normal"&&t!=="reverse"){var i=e;t==="alternate-reverse"&&(i+=1),n="normal",i!==1/0&&i%2!==0&&(n="reverse")}return n==="normal"?r:1-r}function Cd(t,e,r){var n=Ed(t,e,r),i=Md(t,r.fill,e,n,r.delay);if(i===null)return null;var a=r.duration==="auto"?0:r.duration,o=Pd(a,n,r.iterations,i,r.iterationStart),s=Td(o,r.iterationStart,n,r.iterations,i,a),c=wd(n,r.iterations,s,o),l=bd(r.direction,c,s);return r.currentIteration=c,r.progress=l,r.easingFunction(l)}function Sd(t,e,r){var n=Nd(t,e),i=Rd(n,r);return function(a,o){if(o!==null)i.filter(function(c){return o>=c.applyFrom&&o1)throw new Error("Keyframe offsets must be between 0 and 1.");l.computedOffset=f}}else if(u==="composite"&&["replace","add","accumulate","auto"].indexOf(f)===-1)throw new Error("".concat(f," compositing is not supported"));l[u]=f}return l.offset===void 0&&(l.offset=null),l.easing===void 0&&(l.easing=(e==null?void 0:e.easing)||"linear"),l.composite===void 0&&(l.composite="auto"),l}),n=!0,i=-1/0,a=0;a=0&&Number(c.offset)<=1});function s(){var c,l,u=r.length;r[u-1].computedOffset=Number((c=r[u-1].offset)!==null&&c!==void 0?c:1),u>1&&(r[0].computedOffset=Number((l=r[0].offset)!==null&&l!==void 0?l:0));for(var f=0,h=Number(r[0].computedOffset),v=1;ve in t?ws(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var Xt=(t,e,r)=>(Ts(t,typeof e!="symbol"?e+"":e,r),r);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))n(i);new MutationObserver(i=>{for(const a of i)if(a.type==="childList")for(const o of a.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&n(o)}).observe(document,{childList:!0,subtree:!0});function r(i){const a={};return i.integrity&&(a.integrity=i.integrity),i.referrerPolicy&&(a.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?a.credentials="include":i.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function n(i){if(i.ep)return;i.ep=!0;const a=r(i);fetch(i.href,a)}})();var bs=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Va(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var qa={exports:{}},xr={};/* +object-assign +(c) Sindre Sorhus +@license MIT +*/var Ui=Object.getOwnPropertySymbols,Cs=Object.prototype.hasOwnProperty,Ss=Object.prototype.propertyIsEnumerable;function Ns(t){if(t==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}function Rs(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de",Object.getOwnPropertyNames(t)[0]==="5")return!1;for(var e={},r=0;r<10;r++)e["_"+String.fromCharCode(r)]=r;var n=Object.getOwnPropertyNames(e).map(function(a){return e[a]});if(n.join("")!=="0123456789")return!1;var i={};return"abcdefghijklmnopqrst".split("").forEach(function(a){i[a]=a}),Object.keys(Object.assign({},i)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}Rs();const As=React;/** @license React v17.0.2 + * react-jsx-runtime.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Os=As,$a=60103;xr.Fragment=60107;if(typeof Symbol=="function"&&Symbol.for){var Yi=Symbol.for;$a=Yi("react.element"),xr.Fragment=Yi("react.fragment")}var ks=Os.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Is=Object.prototype.hasOwnProperty,Ls={key:!0,ref:!0,__self:!0,__source:!0};function Ka(t,e,r){var n,i={},a=null,o=null;r!==void 0&&(a=""+r),e.key!==void 0&&(a=""+e.key),e.ref!==void 0&&(o=e.ref);for(n in e)Is.call(e,n)&&!Ls.hasOwnProperty(n)&&(i[n]=e[n]);if(t&&t.defaultProps)for(n in e=t.defaultProps,e)i[n]===void 0&&(i[n]=e[n]);return{$$typeof:$a,type:t,key:a,ref:o,props:i,_owner:ks.current}}xr.jsx=Ka;xr.jsxs=Ka;qa.exports=xr;var V=qa.exports;const ae=new window.AudioContext;class _s{constructor(e){Xt(this,"analyser");Xt(this,"gainNode");Xt(this,"audioSource");Xt(this,"options");Xt(this,"visualArr");const r={size:128};this.options={...r,...e},this.analyser=ae.createAnalyser(),this.analyser.fftSize=this.options.size*2,this.gainNode=ae.createGain(),this.gainNode.connect(ae.destination),this.analyser.connect(this.gainNode),this.options.audioEl&&(this.audioSource=ae.createMediaElementSource(this.options.audioEl),this.audioSource.connect(this.analyser)),this.visualArr=new Uint8Array(this.analyser.frequencyBinCount),this.resumeAudioContext()}resumeAudioContext(){if(ae){const e=()=>{ae.state==="suspended"&&ae.resume(),document.removeEventListener("click",e)};document.addEventListener("click",e)}}destory(){var e;this.analyser.disconnect(this.gainNode),(e=this.audioSource)==null||e.disconnect(this.analyser),this.gainNode.disconnect(ae.destination)}setAudioEl(e){this.audioSource&&this.audioSource.disconnect(this.analyser),this.audioSource=ae.createMediaElementSource(e),this.audioSource.connect(this.analyser)}changeVolumn(e){this.gainNode.gain.value=e}getVisualizeValue(){return this.analyser.getByteFrequencyData(this.visualArr),this.visualArr}}const Ds="_page_5qejz_1",Fs="_operationWrapper_5qejz_4",Bs="_audioWrapper_5qejz_10",Gs="_exampleWrapper_5qejz_18",Us="_footer_5qejz_26",Ys="_github_5qejz_39",De={page:Ds,operationWrapper:Fs,audioWrapper:Bs,exampleWrapper:Gs,footer:Us,github:Ys};var Vn=function(t,e){return Vn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(r[i]=n[i])},Vn(t,e)};function W(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Vn(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var U=function(){return U=Object.assign||function(e){for(var r,n=1,i=arguments.length;n0&&a[a.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!a||c[1]>a[0]&&c[1]=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function _(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,a=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)a.push(i.value)}catch(s){o={error:s}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return a}function X(t,e,r){if(r||arguments.length===2)for(var n=0,i=e.length,a;n0?(r[0]=(s*o+u*n+l*a-c*i)*2/f,r[1]=(l*o+u*i+c*n-s*a)*2/f,r[2]=(c*o+u*a+s*i-l*n)*2/f):(r[0]=(s*o+u*n+l*a-c*i)*2,r[1]=(l*o+u*i+c*n-s*a)*2,r[2]=(c*o+u*a+s*i-l*n)*2),io(t,e,r),t}function nn(t,e){return t[0]=e[12],t[1]=e[13],t[2]=e[14],t}function Ze(t,e){var r=e[0],n=e[1],i=e[2],a=e[4],o=e[5],s=e[6],l=e[8],c=e[9],u=e[10];return t[0]=Math.hypot(r,n,i),t[1]=Math.hypot(a,o,s),t[2]=Math.hypot(l,c,u),t}function an(t,e){var r=new ft(3);Ze(r,e);var n=1/r[0],i=1/r[1],a=1/r[2],o=e[0]*n,s=e[1]*i,l=e[2]*a,c=e[4]*n,u=e[5]*i,f=e[6]*a,h=e[8]*n,v=e[9]*i,p=e[10]*a,y=o+u+p,d=0;return y>0?(d=Math.sqrt(y+1)*2,t[3]=.25*d,t[0]=(f-v)/d,t[1]=(h-l)/d,t[2]=(s-c)/d):o>u&&o>p?(d=Math.sqrt(1+o-u-p)*2,t[3]=(f-v)/d,t[0]=.25*d,t[1]=(s+c)/d,t[2]=(h+l)/d):u>p?(d=Math.sqrt(1+u-o-p)*2,t[3]=(h-l)/d,t[0]=(s+c)/d,t[1]=.25*d,t[2]=(f+v)/d):(d=Math.sqrt(1+p-o-u)*2,t[3]=(s-c)/d,t[0]=(h+l)/d,t[1]=(f+v)/d,t[2]=.25*d),t}function el(t,e,r,n){var i=e[0],a=e[1],o=e[2],s=e[3],l=i+i,c=a+a,u=o+o,f=i*l,h=i*c,v=i*u,p=a*c,y=a*u,d=o*u,m=s*l,x=s*c,M=s*u,P=n[0],E=n[1],g=n[2];return t[0]=(1-(p+d))*P,t[1]=(h+M)*P,t[2]=(v-x)*P,t[3]=0,t[4]=(h-M)*E,t[5]=(1-(f+d))*E,t[6]=(y+m)*E,t[7]=0,t[8]=(v+x)*g,t[9]=(y-m)*g,t[10]=(1-(f+p))*g,t[11]=0,t[12]=r[0],t[13]=r[1],t[14]=r[2],t[15]=1,t}function lr(t,e,r,n,i){var a=e[0],o=e[1],s=e[2],l=e[3],c=a+a,u=o+o,f=s+s,h=a*c,v=a*u,p=a*f,y=o*u,d=o*f,m=s*f,x=l*c,M=l*u,P=l*f,E=n[0],g=n[1],w=n[2],T=i[0],b=i[1],C=i[2],S=(1-(y+m))*E,N=(v+P)*E,O=(p-M)*E,k=(v-P)*g,B=(1-(h+m))*g,Y=(d+x)*g,I=(p+M)*w,G=(d-x)*w,H=(1-(h+y))*w;return t[0]=S,t[1]=N,t[2]=O,t[3]=0,t[4]=k,t[5]=B,t[6]=Y,t[7]=0,t[8]=I,t[9]=G,t[10]=H,t[11]=0,t[12]=r[0]+T-(S*T+k*b+I*C),t[13]=r[1]+b-(N*T+B*b+G*C),t[14]=r[2]+C-(O*T+Y*b+H*C),t[15]=1,t}function ao(t,e){var r=e[0],n=e[1],i=e[2],a=e[3],o=r+r,s=n+n,l=i+i,c=r*o,u=n*o,f=n*s,h=i*o,v=i*s,p=i*l,y=a*o,d=a*s,m=a*l;return t[0]=1-f-p,t[1]=u+m,t[2]=h-d,t[3]=0,t[4]=u-m,t[5]=1-c-p,t[6]=v+y,t[7]=0,t[8]=h+d,t[9]=v-y,t[10]=1-c-f,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function rl(t,e,r,n,i,a,o){var s=1/(r-e),l=1/(i-n),c=1/(a-o);return t[0]=a*2*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=a*2*l,t[6]=0,t[7]=0,t[8]=(r+e)*s,t[9]=(i+n)*l,t[10]=(o+a)*c,t[11]=-1,t[12]=0,t[13]=0,t[14]=o*a*2*c,t[15]=0,t}function oo(t,e,r,n,i){var a=1/Math.tan(e/2),o;return t[0]=a/r,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=a,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,i!=null&&i!==1/0?(o=1/(n-i),t[10]=(i+n)*o,t[14]=2*i*n*o):(t[10]=-1,t[14]=-2*n),t}var nl=oo;function il(t,e,r,n,i){var a=1/Math.tan(e/2),o;return t[0]=a/r,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=a,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,i!=null&&i!==1/0?(o=1/(n-i),t[10]=i*o,t[14]=i*n*o):(t[10]=-1,t[14]=-n),t}function al(t,e,r,n){var i=Math.tan(e.upDegrees*Math.PI/180),a=Math.tan(e.downDegrees*Math.PI/180),o=Math.tan(e.leftDegrees*Math.PI/180),s=Math.tan(e.rightDegrees*Math.PI/180),l=2/(o+s),c=2/(i+a);return t[0]=l,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=c,t[6]=0,t[7]=0,t[8]=-((o-s)*l*.5),t[9]=(i-a)*c*.5,t[10]=n/(r-n),t[11]=-1,t[12]=0,t[13]=0,t[14]=n*r/(r-n),t[15]=0,t}function so(t,e,r,n,i,a,o){var s=1/(e-r),l=1/(n-i),c=1/(a-o);return t[0]=-2*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*l,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*c,t[11]=0,t[12]=(e+r)*s,t[13]=(i+n)*l,t[14]=(o+a)*c,t[15]=1,t}var lo=so;function co(t,e,r,n,i,a,o){var s=1/(e-r),l=1/(n-i),c=1/(a-o);return t[0]=-2*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*l,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=c,t[11]=0,t[12]=(e+r)*s,t[13]=(i+n)*l,t[14]=a*c,t[15]=1,t}function uo(t,e,r,n){var i,a,o,s,l,c,u,f,h,v,p=e[0],y=e[1],d=e[2],m=n[0],x=n[1],M=n[2],P=r[0],E=r[1],g=r[2];return Math.abs(p-P)0&&(v=1/Math.sqrt(v),u*=v,f*=v,h*=v);var p=l*h-c*f,y=c*u-s*h,d=s*f-l*u;return v=p*p+y*y+d*d,v>0&&(v=1/Math.sqrt(v),p*=v,y*=v,d*=v),t[0]=p,t[1]=y,t[2]=d,t[3]=0,t[4]=f*d-h*y,t[5]=h*p-u*d,t[6]=u*y-f*p,t[7]=0,t[8]=u,t[9]=f,t[10]=h,t[11]=0,t[12]=i,t[13]=a,t[14]=o,t[15]=1,t}function sl(t){return"mat4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+", "+t[9]+", "+t[10]+", "+t[11]+", "+t[12]+", "+t[13]+", "+t[14]+", "+t[15]+")"}function ll(t){return Math.hypot(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8],t[9],t[10],t[11],t[12],t[13],t[14],t[15])}function cl(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t[3]=e[3]+r[3],t[4]=e[4]+r[4],t[5]=e[5]+r[5],t[6]=e[6]+r[6],t[7]=e[7]+r[7],t[8]=e[8]+r[8],t[9]=e[9]+r[9],t[10]=e[10]+r[10],t[11]=e[11]+r[11],t[12]=e[12]+r[12],t[13]=e[13]+r[13],t[14]=e[14]+r[14],t[15]=e[15]+r[15],t}function fo(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t[3]=e[3]-r[3],t[4]=e[4]-r[4],t[5]=e[5]-r[5],t[6]=e[6]-r[6],t[7]=e[7]-r[7],t[8]=e[8]-r[8],t[9]=e[9]-r[9],t[10]=e[10]-r[10],t[11]=e[11]-r[11],t[12]=e[12]-r[12],t[13]=e[13]-r[13],t[14]=e[14]-r[14],t[15]=e[15]-r[15],t}function ul(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t[4]=e[4]*r,t[5]=e[5]*r,t[6]=e[6]*r,t[7]=e[7]*r,t[8]=e[8]*r,t[9]=e[9]*r,t[10]=e[10]*r,t[11]=e[11]*r,t[12]=e[12]*r,t[13]=e[13]*r,t[14]=e[14]*r,t[15]=e[15]*r,t}function fl(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t[2]=e[2]+r[2]*n,t[3]=e[3]+r[3]*n,t[4]=e[4]+r[4]*n,t[5]=e[5]+r[5]*n,t[6]=e[6]+r[6]*n,t[7]=e[7]+r[7]*n,t[8]=e[8]+r[8]*n,t[9]=e[9]+r[9]*n,t[10]=e[10]+r[10]*n,t[11]=e[11]+r[11]*n,t[12]=e[12]+r[12]*n,t[13]=e[13]+r[13]*n,t[14]=e[14]+r[14]*n,t[15]=e[15]+r[15]*n,t}function hl(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]&&t[9]===e[9]&&t[10]===e[10]&&t[11]===e[11]&&t[12]===e[12]&&t[13]===e[13]&&t[14]===e[14]&&t[15]===e[15]}function vl(t,e){var r=t[0],n=t[1],i=t[2],a=t[3],o=t[4],s=t[5],l=t[6],c=t[7],u=t[8],f=t[9],h=t[10],v=t[11],p=t[12],y=t[13],d=t[14],m=t[15],x=e[0],M=e[1],P=e[2],E=e[3],g=e[4],w=e[5],T=e[6],b=e[7],C=e[8],S=e[9],N=e[10],O=e[11],k=e[12],B=e[13],Y=e[14],I=e[15];return Math.abs(r-x)<=it*Math.max(1,Math.abs(r),Math.abs(x))&&Math.abs(n-M)<=it*Math.max(1,Math.abs(n),Math.abs(M))&&Math.abs(i-P)<=it*Math.max(1,Math.abs(i),Math.abs(P))&&Math.abs(a-E)<=it*Math.max(1,Math.abs(a),Math.abs(E))&&Math.abs(o-g)<=it*Math.max(1,Math.abs(o),Math.abs(g))&&Math.abs(s-w)<=it*Math.max(1,Math.abs(s),Math.abs(w))&&Math.abs(l-T)<=it*Math.max(1,Math.abs(l),Math.abs(T))&&Math.abs(c-b)<=it*Math.max(1,Math.abs(c),Math.abs(b))&&Math.abs(u-C)<=it*Math.max(1,Math.abs(u),Math.abs(C))&&Math.abs(f-S)<=it*Math.max(1,Math.abs(f),Math.abs(S))&&Math.abs(h-N)<=it*Math.max(1,Math.abs(h),Math.abs(N))&&Math.abs(v-O)<=it*Math.max(1,Math.abs(v),Math.abs(O))&&Math.abs(p-k)<=it*Math.max(1,Math.abs(p),Math.abs(k))&&Math.abs(y-B)<=it*Math.max(1,Math.abs(y),Math.abs(B))&&Math.abs(d-Y)<=it*Math.max(1,Math.abs(d),Math.abs(Y))&&Math.abs(m-I)<=it*Math.max(1,Math.abs(m),Math.abs(I))}var dl=Et,pl=fo;const yl=Object.freeze(Object.defineProperty({__proto__:null,add:cl,adjoint:qs,clone:Xs,copy:Ke,create:nt,determinant:ja,equals:vl,exactEquals:hl,frob:ll,fromQuat:ao,fromQuat2:tl,fromRotation:Zs,fromRotationTranslation:io,fromRotationTranslationScale:el,fromRotationTranslationScaleOrigin:lr,fromScaling:no,fromTranslation:ro,fromValues:Vs,fromXRotation:Qs,fromYRotation:Js,fromZRotation:js,frustum:rl,getRotation:an,getScaling:Ze,getTranslation:nn,identity:Er,invert:jt,lookAt:uo,mul:dl,multiply:Et,multiplyScalar:ul,multiplyScalarAndAdd:fl,ortho:lo,orthoNO:so,orthoZO:co,perspective:nl,perspectiveFromFieldOfView:al,perspectiveNO:oo,perspectiveZO:il,rotate:$s,rotateX:to,rotateY:eo,rotateZ:Ks,scale:rn,set:qn,str:sl,sub:pl,subtract:fo,targetTo:ol,translate:We,transpose:Ja},Symbol.toStringTag,{value:"Module"}));function q(){var t=new ft(3);return ft!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function gl(t){var e=new ft(3);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function se(t){var e=t[0],r=t[1],n=t[2];return Math.hypot(e,r,n)}function j(t,e,r){var n=new ft(3);return n[0]=t,n[1]=e,n[2]=r,n}function pe(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function qt(t,e,r,n){return t[0]=e,t[1]=r,t[2]=n,t}function $n(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t}function Hi(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t}function ml(t,e,r){return t[0]=e[0]*r[0],t[1]=e[1]*r[1],t[2]=e[2]*r[2],t}function xl(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t}function Oe(t,e){var r=e[0],n=e[1],i=e[2],a=r*r+n*n+i*i;return a>0&&(a=1/Math.sqrt(a)),t[0]=e[0]*a,t[1]=e[1]*a,t[2]=e[2]*a,t}function te(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function Jr(t,e,r){var n=e[0],i=e[1],a=e[2],o=r[0],s=r[1],l=r[2];return t[0]=i*l-a*s,t[1]=a*o-n*l,t[2]=n*s-i*o,t}function El(t,e,r,n){var i=e[0],a=e[1],o=e[2];return t[0]=i+n*(r[0]-i),t[1]=a+n*(r[1]-a),t[2]=o+n*(r[2]-o),t}function Ut(t,e,r){var n=e[0],i=e[1],a=e[2],o=r[3]*n+r[7]*i+r[11]*a+r[15];return o=o||1,t[0]=(r[0]*n+r[4]*i+r[8]*a+r[12])/o,t[1]=(r[1]*n+r[5]*i+r[9]*a+r[13])/o,t[2]=(r[2]*n+r[6]*i+r[10]*a+r[14])/o,t}function Ml(t,e,r){var n=e[0],i=e[1],a=e[2];return t[0]=n*r[0]+i*r[3]+a*r[6],t[1]=n*r[1]+i*r[4]+a*r[7],t[2]=n*r[2]+i*r[5]+a*r[8],t}function Pl(t,e,r){var n=r[0],i=r[1],a=r[2],o=r[3],s=e[0],l=e[1],c=e[2],u=i*c-a*l,f=a*s-n*c,h=n*l-i*s,v=i*h-a*f,p=a*u-n*h,y=n*f-i*u,d=o*2;return u*=d,f*=d,h*=d,v*=2,p*=2,y*=2,t[0]=s+u+v,t[1]=l+f+p,t[2]=c+h+y,t}function je(t,e){var r=t[0],n=t[1],i=t[2],a=e[0],o=e[1],s=e[2];return Math.abs(r-a)<=it*Math.max(1,Math.abs(r),Math.abs(a))&&Math.abs(n-o)<=it*Math.max(1,Math.abs(n),Math.abs(o))&&Math.abs(i-s)<=it*Math.max(1,Math.abs(i),Math.abs(s))}var ho=se;(function(){var t=q();return function(e,r,n,i,a,o){var s,l;for(r||(r=3),n||(n=0),i?l=Math.min(i*r+n,e.length):l=e.length,s=n;s0&&(o=1/Math.sqrt(o)),t[0]=r*o,t[1]=n*o,t[2]=i*o,t[3]=a*o,t}function nr(t,e,r){var n=e[0],i=e[1],a=e[2],o=e[3];return t[0]=r[0]*n+r[4]*i+r[8]*a+r[12]*o,t[1]=r[1]*n+r[5]*i+r[9]*a+r[13]*o,t[2]=r[2]*n+r[6]*i+r[10]*a+r[14]*o,t[3]=r[3]*n+r[7]*i+r[11]*a+r[15]*o,t}(function(){var t=He();return function(e,r,n,i,a,o){var s,l;for(r||(r=4),n||(n=0),i?l=Math.min(i*r+n,e.length):l=e.length,s=n;sit?(h=Math.acos(v),p=Math.sin(h),y=Math.sin((1-n)*h)/p,d=Math.sin(n*h)/p):(y=1-n,d=n),t[0]=y*i+d*l,t[1]=y*a+d*c,t[2]=y*o+d*u,t[3]=y*s+d*f,t}function Cn(t,e){var r=e[0],n=e[1],i=e[2],a=e[3],o=r*r+n*n+i*i+a*a,s=o?1/o:0;return t[0]=-r*s,t[1]=-n*s,t[2]=-i*s,t[3]=a*s,t}function Cl(t,e){var r=e[0]+e[4]+e[8],n;if(r>0)n=Math.sqrt(r+1),t[3]=.5*n,n=.5/n,t[0]=(e[5]-e[7])*n,t[1]=(e[6]-e[2])*n,t[2]=(e[1]-e[3])*n;else{var i=0;e[4]>e[0]&&(i=1),e[8]>e[i*3+i]&&(i=2);var a=(i+1)%3,o=(i+2)%3;n=Math.sqrt(e[i*3+i]-e[a*3+a]-e[o*3+o]+1),t[i]=.5*n,n=.5/n,t[3]=(e[a*3+o]-e[o*3+a])*n,t[a]=(e[a*3+i]+e[i*3+a])*n,t[o]=(e[o*3+i]+e[i*3+o])*n}return t}function Ar(t,e,r,n){var i=.5*Math.PI/180;e*=i,r*=i,n*=i;var a=Math.sin(e),o=Math.cos(e),s=Math.sin(r),l=Math.cos(r),c=Math.sin(n),u=Math.cos(n);return t[0]=a*l*u-o*s*c,t[1]=o*s*u+a*l*c,t[2]=o*l*c-a*s*u,t[3]=o*l*u+a*s*c,t}var Sn=wl,Or=Tl,zi=Xe,on=bl;(function(){var t=q(),e=j(1,0,0),r=j(0,1,0);return function(n,i,a){var o=te(i,a);return o<-.999999?(Jr(t,e,i),ho(t)<1e-6&&Jr(t,r,i),Oe(t,t),ir(n,t,Math.PI),n):o>.999999?(n[0]=0,n[1]=0,n[2]=0,n[3]=1,n):(Jr(t,i,a),n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=1+o,on(n,n))}})();(function(){var t=gt(),e=gt();return function(r,n,i,a,o,s){return bn(t,n,o,s),bn(e,i,a,s),bn(r,t,e,2*s*(1-s)),r}})();(function(){var t=Qa();return function(e,r,n,i){return t[0]=n[0],t[3]=n[1],t[6]=n[2],t[1]=i[0],t[4]=i[1],t[7]=i[2],t[2]=-r[0],t[5]=-r[1],t[8]=-r[2],on(e,Cl(e,t))}})();function Sl(){var t=new ft(2);return ft!=Float32Array&&(t[0]=0,t[1]=0),t}function Nl(t,e){var r=new ft(2);return r[0]=t,r[1]=e,r}function Rl(t,e){return t[0]=e[0],t[1]=e[1],t}function Al(t,e){var r=e[0],n=e[1],i=r*r+n*n;return i>0&&(i=1/Math.sqrt(i)),t[0]=e[0]*i,t[1]=e[1]*i,t}function Ol(t,e){return t[0]*e[0]+t[1]*e[1]}function kl(t,e){return t[0]===e[0]&&t[1]===e[1]}(function(){var t=Sl();return function(e,r,n,i,a,o){var s,l;for(r||(r=2),n||(n=0),i?l=Math.min(i*r+n,e.length):l=e.length,s=n;sr?r:t};const kt=Dl;var Fl=function(t){return pn(t,"Number")};const ie=Fl;var Bl=1e-5;function cr(t,e,r){return r===void 0&&(r=Bl),Math.abs(t-e)7){t[r].shift();for(var n=t[r],i=r;n.length;)e[r]="A",t.splice(i+=1,0,["C"].concat(n.splice(0,6)));t.splice(r,1)}}var ur={a:7,c:6,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,z:0};function yo(t){return Array.isArray(t)&&t.every(function(e){var r=e[0].toLowerCase();return ur[r]===e.length-1&&"achlmqstvz".includes(r)})}function go(t){return yo(t)&&t.every(function(e){var r=e[0];return r===r.toUpperCase()})}function mo(t){return go(t)&&t.every(function(e){var r=e[0];return"ACLMQZ".includes(r)})}function qi(t){for(var e=t.pathValue[t.segmentStart],r=e.toLowerCase(),n=t.data;n.length>=ur[r]&&(r==="m"&&n.length>2?(t.segments.push([e].concat(n.splice(0,2))),r="l",e=e==="m"?"l":"L"):t.segments.push([e].concat(n.splice(0,ur[r]))),!!ur[r]););}function zl(t){var e=t.index,r=t.pathValue,n=r.charCodeAt(e);if(n===48){t.param=0,t.index+=1;return}if(n===49){t.param=1,t.index+=1;return}t.err='[path-util]: invalid Arc flag "'+r[e]+'", expecting 0 or 1 at index '+e}function Wl(t){return t>=48&&t<=57||t===43||t===45||t===46}function Fe(t){return t>=48&&t<=57}function Xl(t){var e=t.max,r=t.pathValue,n=t.index,i=n,a=!1,o=!1,s=!1,l=!1,c;if(i>=e){t.err="[path-util]: Invalid path value at index "+i+', "pathValue" is missing param';return}if(c=r.charCodeAt(i),(c===43||c===45)&&(i+=1,c=r.charCodeAt(i)),!Fe(c)&&c!==46){t.err="[path-util]: Invalid path value at index "+i+', "'+r[i]+'" is not a number';return}if(c!==46){if(a=c===48,i+=1,c=r.charCodeAt(i),a&&i=5760&&e.includes(t)}function tn(t){for(var e=t.pathValue,r=t.max;t.index0;o-=1){if($l(i)&&(o===3||o===4)?zl(t):Xl(t),t.err.length)return;t.data.push(t.param),tn(t),t.index=t.max||!Wl(r.charCodeAt(t.index)))break}qi(t)}var Zl=function(){function t(e){this.pathValue=e,this.segments=[],this.max=e.length,this.index=0,this.param=0,this.segmentStart=0,this.data=[],this.err=""}return t}();function Ql(t){if(yo(t))return[].concat(t);var e=new Zl(t);for(tn(e);e.index1&&(C=Math.sqrt(C),h*=C,v*=C);var S=h*h,N=v*v,O=(a===o?-1:1)*Math.sqrt(Math.abs((S*N-S*b*b-N*T*T)/(S*b*b+N*T*T)));g=O*h*b/v+(u+p)/2,w=O*-v*T/h+(f+y)/2,P=Math.asin(((f-w)/v*Math.pow(10,9)>>0)/Math.pow(10,9)),E=Math.asin(((y-w)/v*Math.pow(10,9)>>0)/Math.pow(10,9)),P=uE&&(P-=Math.PI*2),!o&&E>P&&(E-=Math.PI*2)}var k=E-P;if(Math.abs(k)>d){var B=E,Y=p,I=y;E=P+d*(o&&E>P?1:-1),p=g+h*Math.cos(E),y=w+v*Math.sin(E),x=Pi(p,y,h,v,i,0,o,Y,I,[E,B,g,w])}k=E-P;var G=Math.cos(P),H=Math.sin(P),ct=Math.cos(E),rt=Math.sin(E),St=Math.tan(k/4),Ht=4/3*h*St,$t=4/3*v*St,Kt=[u,f],zt=[u+Ht*H,f-$t*G],Tr=[p+Ht*rt,y-$t*ct],br=[p,y];if(zt[0]=2*Kt[0]-zt[0],zt[1]=2*Kt[1]-zt[1],c)return zt.concat(Tr,br,x);x=zt.concat(Tr,br,x);for(var Cr=[],Wt=0,Sr=x.length;Wt=a)o={x:r,y:n};else{var s=he([t,e],[r,n],i/a),l=s[0],c=s[1];o={x:l,y:c}}return{length:a,point:o,min:{x:Math.min(t,r),y:Math.min(e,n)},max:{x:Math.max(t,r),y:Math.max(e,n)}}}function Ki(t,e){var r=t.x,n=t.y,i=e.x,a=e.y,o=r*i+n*a,s=Math.sqrt((Math.pow(r,2)+Math.pow(n,2))*(Math.pow(i,2)+Math.pow(a,2))),l=r*a-n*i<0?-1:1,c=l*Math.acos(o/s);return c}function ac(t,e,r,n,i,a,o,s,l,c){var u=Math.abs,f=Math.sin,h=Math.cos,v=Math.sqrt,p=Math.PI,y=u(r),d=u(n),m=(i%360+360)%360,x=m*(p/180);if(t===s&&e===l)return{x:t,y:e};if(y===0||d===0)return Zn(t,e,s,l,c).point;var M=(t-s)/2,P=(e-l)/2,E={x:h(x)*M+f(x)*P,y:-f(x)*M+h(x)*P},g=Math.pow(E.x,2)/Math.pow(y,2)+Math.pow(E.y,2)/Math.pow(d,2);g>1&&(y*=v(g),d*=v(g));var w=Math.pow(y,2)*Math.pow(d,2)-Math.pow(y,2)*Math.pow(E.y,2)-Math.pow(d,2)*Math.pow(E.x,2),T=Math.pow(y,2)*Math.pow(E.y,2)+Math.pow(d,2)*Math.pow(E.x,2),b=w/T;b=b<0?0:b;var C=(a!==o?1:-1)*v(b),S={x:C*(y*E.y/d),y:C*(-(d*E.x)/y)},N={x:h(x)*S.x-f(x)*S.y+(t+s)/2,y:f(x)*S.x+h(x)*S.y+(e+l)/2},O={x:(E.x-S.x)/y,y:(E.y-S.y)/d},k=Ki({x:1,y:0},O),B={x:(-E.x-S.x)/y,y:(-E.y-S.y)/d},Y=Ki(O,B);!o&&Y>0?Y-=2*p:o&&Y<0&&(Y+=2*p),Y%=2*p;var I=k+Y*c,G=y*h(I),H=d*f(I),ct={x:h(x)*G-f(x)*H+N.x,y:f(x)*G+h(x)*H+N.y};return ct}function oc(t,e,r,n,i,a,o,s,l,c,u){var f,h=u.bbox,v=h===void 0?!0:h,p=u.length,y=p===void 0?!0:p,d=u.sampleSize,m=d===void 0?30:d,x=typeof c=="number",M=t,P=e,E=0,g=[M,P,E],w=[M,P],T=0,b={x:0,y:0},C=[{x:M,y:P}];x&&c<=0&&(b={x:M,y:P});for(var S=0;S<=m;S+=1){if(T=S/m,f=ac(t,e,r,n,i,a,o,s,l,T),M=f.x,P=f.y,v&&C.push({x:M,y:P}),y&&(E+=Rt(w,[M,P])),w=[M,P],x&&E>=c&&c>g[2]){var N=(E-c)/(E-g[2]);b={x:w[0]*(1-N)+g[0]*N,y:w[1]*(1-N)+g[1]*N}}g=[M,P,E]}return x&&c>=E&&(b={x:s,y:l}),{length:E,point:b,min:{x:Math.min.apply(null,C.map(function(O){return O.x})),y:Math.min.apply(null,C.map(function(O){return O.y}))},max:{x:Math.max.apply(null,C.map(function(O){return O.x})),y:Math.max.apply(null,C.map(function(O){return O.y}))}}}function sc(t,e,r,n,i,a,o,s,l){var c=1-l;return{x:Math.pow(c,3)*t+3*Math.pow(c,2)*l*r+3*c*Math.pow(l,2)*i+Math.pow(l,3)*o,y:Math.pow(c,3)*e+3*Math.pow(c,2)*l*n+3*c*Math.pow(l,2)*a+Math.pow(l,3)*s}}function xo(t,e,r,n,i,a,o,s,l,c){var u,f=c.bbox,h=f===void 0?!0:f,v=c.length,p=v===void 0?!0:v,y=c.sampleSize,d=y===void 0?10:y,m=typeof l=="number",x=t,M=e,P=0,E=[x,M,P],g=[x,M],w=0,T={x:0,y:0},b=[{x,y:M}];m&&l<=0&&(T={x,y:M});for(var C=0;C<=d;C+=1){if(w=C/d,u=sc(t,e,r,n,i,a,o,s,w),x=u.x,M=u.y,h&&b.push({x,y:M}),p&&(P+=Rt(g,[x,M])),g=[x,M],m&&P>=l&&l>E[2]){var S=(P-l)/(P-E[2]);T={x:g[0]*(1-S)+E[0]*S,y:g[1]*(1-S)+E[1]*S}}E=[x,M,P]}return m&&l>=P&&(T={x:o,y:s}),{length:P,point:T,min:{x:Math.min.apply(null,b.map(function(N){return N.x})),y:Math.min.apply(null,b.map(function(N){return N.y}))},max:{x:Math.max.apply(null,b.map(function(N){return N.x})),y:Math.max.apply(null,b.map(function(N){return N.y}))}}}function lc(t,e,r,n,i,a,o){var s=1-o;return{x:Math.pow(s,2)*t+2*s*o*r+Math.pow(o,2)*i,y:Math.pow(s,2)*e+2*s*o*n+Math.pow(o,2)*a}}function cc(t,e,r,n,i,a,o,s){var l,c=s.bbox,u=c===void 0?!0:c,f=s.length,h=f===void 0?!0:f,v=s.sampleSize,p=v===void 0?10:v,y=typeof o=="number",d=t,m=e,x=0,M=[d,m,x],P=[d,m],E=0,g={x:0,y:0},w=[{x:d,y:m}];y&&o<=0&&(g={x:d,y:m});for(var T=0;T<=p;T+=1){if(E=T/p,l=lc(t,e,r,n,i,a,E),d=l.x,m=l.y,u&&w.push({x:d,y:m}),h&&(x+=Rt(P,[d,m])),P=[d,m],y&&x>=o&&o>M[2]){var b=(x-o)/(x-M[2]);g={x:P[0]*(1-b)+M[0]*b,y:P[1]*(1-b)+M[1]*b}}M=[d,m,x]}return y&&o>=x&&(g={x:i,y:a}),{length:x,point:g,min:{x:Math.min.apply(null,w.map(function(C){return C.x})),y:Math.min.apply(null,w.map(function(C){return C.y}))},max:{x:Math.max.apply(null,w.map(function(C){return C.x})),y:Math.max.apply(null,w.map(function(C){return C.y}))}}}function Eo(t,e,r){for(var n,i,a,o,s,l,c=sn(t),u=typeof e=="number",f,h=[],v,p=0,y=0,d=0,m=0,x,M=[],P=[],E=0,g={x:0,y:0},w=g,T=g,b=g,C=0,S=0,N=c.length;S=e&&(b=T),P.push(w),M.push(g),C+=E,l=v!=="Z"?x.slice(-2):[d,m],p=l[0],y=l[1];return u&&e>=C&&(b={x:p,y}),{length:C,point:b,min:{x:Math.min.apply(null,M.map(function(O){return O.x})),y:Math.min.apply(null,M.map(function(O){return O.y}))},max:{x:Math.max.apply(null,P.map(function(O){return O.x})),y:Math.max.apply(null,P.map(function(O){return O.y}))}}}function uc(t,e){return Eo(t,void 0,U(U({},e),{bbox:!1,length:!0})).length}function fc(t){var e=t.length,r=e-1;return t.map(function(n,i){return t.map(function(a,o){var s=i+o,l;return o===0||t[s]&&t[s][0]==="M"?(l=t[s],["M"].concat(l.slice(-2))):(s>=e&&(s-=r),t[s])})})}function hc(t,e){var r=t.length-1,n=[],i=0,a=0,o=fc(t);return o.forEach(function(s,l){t.slice(1).forEach(function(c,u){a+=Rt(t[(l+u)%r].slice(-2),e[u%r].slice(-2))}),n[l]=a,a=0}),i=n.indexOf(Math.min.apply(null,n)),o[i]}function vc(t,e,r,n,i,a,o,s){return 3*((s-e)*(r+i)-(o-t)*(n+a)+n*(t-i)-r*(e-a)+s*(i+t/3)-o*(a+e/3))/20}function dc(t){var e=0,r=0,n=0;return Kn(t).map(function(i){var a;switch(i[0]){case"M":return e=i[1],r=i[2],0;default:var o=i.slice(1),s=o[0],l=o[1],c=o[2],u=o[3],f=o[4],h=o[5];return n=vc(e,r,s,l,c,u,f,h),a=i.slice(-2),e=a[0],r=a[1],n}}).reduce(function(i,a){return i+a},0)}function Zi(t){return dc(t)>=0}function pc(t,e,r){return Eo(t,e,U(U({},r),{bbox:!1,length:!0})).point}function yc(t,e){e===void 0&&(e=.5);var r=t.slice(0,2),n=t.slice(2,4),i=t.slice(4,6),a=t.slice(6,8),o=he(r,n,e),s=he(n,i,e),l=he(i,a,e),c=he(o,s,e),u=he(s,l,e),f=he(c,u,e);return[["C"].concat(o,c,f),["C"].concat(u,l,a)]}function Qi(t){return t.map(function(e,r,n){var i=r&&n[r-1].slice(-2).concat(e.slice(1)),a=r?xo(i[0],i[1],i[2],i[3],i[4],i[5],i[6],i[7],i[8],{bbox:!1}).length:0,o;return r?o=a?yc(i):[e,e]:o=[e],{s:e,ss:o,l:a}})}function Mo(t,e,r){var n=Qi(t),i=Qi(e),a=n.length,o=i.length,s=n.filter(function(d){return d.l}).length,l=i.filter(function(d){return d.l}).length,c=n.filter(function(d){return d.l}).reduce(function(d,m){var x=m.l;return d+x},0)/s||0,u=i.filter(function(d){return d.l}).reduce(function(d,m){var x=m.l;return d+x},0)/l||0,f=r||Math.max(a,o),h=[c,u],v=[f-a,f-o],p=0,y=[n,i].map(function(d,m){return d.l===f?d.map(function(x){return x.s}):d.map(function(x,M){return p=M&&v[m]&&x.l>=h[m],v[m]-=p?1:0,p?x.ss:[x.s]}).flat()});return y[0].length===y[1].length?y:Mo(y[0],y[1],f)}function wi(t,e,r){t.prototype=e.prototype=r,r.constructor=t}function Po(t,e){var r=Object.create(t.prototype);for(var n in e)r[n]=e[n];return r}function Mr(){}var vr=.7,ln=1/vr,Ve="\\s*([+-]?\\d+)\\s*",dr="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",re="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",gc=/^#([0-9a-f]{3,8})$/,mc=new RegExp("^rgb\\("+[Ve,Ve,Ve]+"\\)$"),xc=new RegExp("^rgb\\("+[re,re,re]+"\\)$"),Ec=new RegExp("^rgba\\("+[Ve,Ve,Ve,dr]+"\\)$"),Mc=new RegExp("^rgba\\("+[re,re,re,dr]+"\\)$"),Pc=new RegExp("^hsl\\("+[dr,re,re]+"\\)$"),wc=new RegExp("^hsla\\("+[dr,re,re,dr]+"\\)$"),Ji={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};wi(Mr,yn,{copy:function(t){return Object.assign(new this.constructor,this,t)},displayable:function(){return this.rgb().displayable()},hex:ji,formatHex:ji,formatHsl:Tc,formatRgb:ta,toString:ta});function ji(){return this.rgb().formatHex()}function Tc(){return wo(this).formatHsl()}function ta(){return this.rgb().formatRgb()}function yn(t){var e,r;return t=(t+"").trim().toLowerCase(),(e=gc.exec(t))?(r=e[1].length,e=parseInt(e[1],16),r===6?ea(e):r===3?new It(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):r===8?Ir(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):r===4?Ir(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=mc.exec(t))?new It(e[1],e[2],e[3],1):(e=xc.exec(t))?new It(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=Ec.exec(t))?Ir(e[1],e[2],e[3],e[4]):(e=Mc.exec(t))?Ir(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=Pc.exec(t))?ia(e[1],e[2]/100,e[3]/100,1):(e=wc.exec(t))?ia(e[1],e[2]/100,e[3]/100,e[4]):Ji.hasOwnProperty(t)?ea(Ji[t]):t==="transparent"?new It(NaN,NaN,NaN,0):null}function ea(t){return new It(t>>16&255,t>>8&255,t&255,1)}function Ir(t,e,r,n){return n<=0&&(t=e=r=NaN),new It(t,e,r,n)}function bc(t){return t instanceof Mr||(t=yn(t)),t?(t=t.rgb(),new It(t.r,t.g,t.b,t.opacity)):new It}function Cc(t,e,r,n){return arguments.length===1?bc(t):new It(t,e,r,n??1)}function It(t,e,r,n){this.r=+t,this.g=+e,this.b=+r,this.opacity=+n}wi(It,Cc,Po(Mr,{brighter:function(t){return t=t==null?ln:Math.pow(ln,t),new It(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=t==null?vr:Math.pow(vr,t),new It(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:ra,formatHex:ra,formatRgb:na,toString:na}));function ra(){return"#"+Nn(this.r)+Nn(this.g)+Nn(this.b)}function na(){var t=this.opacity;return t=isNaN(t)?1:Math.max(0,Math.min(1,t)),(t===1?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(t===1?")":", "+t+")")}function Nn(t){return t=Math.max(0,Math.min(255,Math.round(t)||0)),(t<16?"0":"")+t.toString(16)}function ia(t,e,r,n){return n<=0?t=e=r=NaN:r<=0||r>=1?t=e=NaN:e<=0&&(t=NaN),new Jt(t,e,r,n)}function wo(t){if(t instanceof Jt)return new Jt(t.h,t.s,t.l,t.opacity);if(t instanceof Mr||(t=yn(t)),!t)return new Jt;if(t instanceof Jt)return t;t=t.rgb();var e=t.r/255,r=t.g/255,n=t.b/255,i=Math.min(e,r,n),a=Math.max(e,r,n),o=NaN,s=a-i,l=(a+i)/2;return s?(e===a?o=(r-n)/s+(r0&&l<1?0:o,new Jt(o,s,l,t.opacity)}function Sc(t,e,r,n){return arguments.length===1?wo(t):new Jt(t,e,r,n??1)}function Jt(t,e,r,n){this.h=+t,this.s=+e,this.l=+r,this.opacity=+n}wi(Jt,Sc,Po(Mr,{brighter:function(t){return t=t==null?ln:Math.pow(ln,t),new Jt(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=t==null?vr:Math.pow(vr,t),new Jt(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*e,i=2*r-n;return new It(Rn(t>=240?t-240:t+120,i,n),Rn(t,i,n),Rn(t<120?t+240:t-120,i,n),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl:function(){var t=this.opacity;return t=isNaN(t)?1:Math.max(0,Math.min(1,t)),(t===1?"hsl(":"hsla(")+(this.h||0)+", "+(this.s||0)*100+"%, "+(this.l||0)*100+"%"+(t===1?")":", "+t+")")}}));function Rn(t,e,r){return(t<60?e+(r-e)*t/60:t<180?r:t<240?e+(r-e)*(240-t)/60:e)*255}function ce(t,e,r,n){var i=t-r,a=e-n;return Math.sqrt(i*i+a*a)}function To(t,e){var r=Math.min.apply(Math,X([],_(t),!1)),n=Math.min.apply(Math,X([],_(e),!1)),i=Math.max.apply(Math,X([],_(t),!1)),a=Math.max.apply(Math,X([],_(e),!1));return{x:r,y:n,width:i-r,height:a-n}}function Nc(t,e,r){return Math.atan(-e/t*Math.tan(r))}function Rc(t,e,r){return Math.atan(e/(t*Math.tan(r)))}function Ac(t,e,r,n,i,a){return r*Math.cos(i)*Math.cos(a)-n*Math.sin(i)*Math.sin(a)+t}function Oc(t,e,r,n,i,a){return r*Math.sin(i)*Math.cos(a)+n*Math.cos(i)*Math.sin(a)+e}function kc(t,e,r,n,i,a,o){for(var s=Nc(r,n,i),l=1/0,c=-1/0,u=[a,o],f=-Math.PI*2;f<=Math.PI*2;f+=Math.PI){var h=s+f;ac&&(c=v)}for(var p=Rc(r,n,i),y=1/0,d=-1/0,m=[a,o],f=-Math.PI*2;f<=Math.PI*2;f+=Math.PI){var x=p+f;ad&&(d=M)}return{x:l,y,width:c-l,height:d-y}}var Ic=1e-4;function bo(t,e,r,n,i,a){var o=-1,s=1/0,l=[r,n],c=20;a&&a>200&&(c=a/10);for(var u=1/c,f=u/10,h=0;h<=c;h++){var v=h*u,p=[i.apply(void 0,X([],_(t.concat([v])),!1)),i.apply(void 0,X([],_(e.concat([v])),!1))],y=ce(l[0],l[1],p[0],p[1]);y=0&&y=0&&l<=1&&s.push(l));else{var f=a*a-4*i*o;cr(f,0)?s.push(-a/(2*i)):f>0&&(u=Math.sqrt(f),l=(-a+u)/(2*i),c=(-a-u)/(2*i),l>=0&&l<=1&&s.push(l),c>=0&&c<=1&&s.push(c))}return s}function _c(t,e,r,n,i,a,o,s){for(var l=[t,o],c=[e,s],u=aa(t,r,i,o),f=aa(e,n,a,s),h=0;h=0?[i]:[]}function Gc(t,e,r,n,i,a){var o=sa(t,r,i)[0],s=sa(e,n,a)[0],l=[t,i],c=[e,a];return o!==void 0&&l.push(Jn(t,r,i,o)),s!==void 0&&c.push(Jn(e,n,a,s)),To(l,c)}function Uc(t,e,r,n,i,a,o,s){return bo([t,r,i],[e,n,a],o,s,Jn)}function Yc(t,e,r,n,i,a,o,s){var l=Uc(t,e,r,n,i,a,o,s);return ce(l.x,l.y,o,s)}var Hc=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function zc(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var No={exports:{}};(function(t,e){(function(r,n){t.exports=n()})(Hc,function(){function r(E,g,w,T,b){n(E,g,w||0,T||E.length-1,b||a)}function n(E,g,w,T,b){for(;T>w;){if(T-w>600){var C=T-w+1,S=g-w+1,N=Math.log(C),O=.5*Math.exp(2*N/3),k=.5*Math.sqrt(N*O*(C-O)/C)*(S-C/2<0?-1:1),B=Math.max(w,Math.floor(g-S*O/C+k)),Y=Math.min(T,Math.floor(g+(C-S)*O/C+k));n(E,g,B,Y,b)}var I=E[g],G=w,H=T;for(i(E,w,g),b(E[T],I)>0&&i(E,w,T);G0;)H--}b(E[w],I)===0?i(E,w,H):(H++,i(E,H,T)),H<=g&&(w=H+1),g<=H&&(T=H-1)}}function i(E,g,w){var T=E[g];E[g]=E[w],E[w]=T}function a(E,g){return Eg?1:0}var o=function(g){g===void 0&&(g=9),this._maxEntries=Math.max(4,g),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()};o.prototype.all=function(){return this._all(this.data,[])},o.prototype.search=function(g){var w=this.data,T=[];if(!x(g,w))return T;for(var b=this.toBBox,C=[];w;){for(var S=0;S=0&&C[w].children.length>this._maxEntries;)this._split(C,w),w--;this._adjustParentBBoxes(b,C,w)},o.prototype._split=function(g,w){var T=g[w],b=T.children.length,C=this._minEntries;this._chooseSplitAxis(T,C,b);var S=this._chooseSplitIndex(T,C,b),N=M(T.children.splice(S,T.children.length-S));N.height=T.height,N.leaf=T.leaf,l(T,this.toBBox),l(N,this.toBBox),w?g[w-1].children.push(N):this._splitRoot(T,N)},o.prototype._splitRoot=function(g,w){this.data=M([g,w]),this.data.height=g.height+1,this.data.leaf=!1,l(this.data,this.toBBox)},o.prototype._chooseSplitIndex=function(g,w,T){for(var b,C=1/0,S=1/0,N=w;N<=T-w;N++){var O=c(g,0,N,this.toBBox),k=c(g,N,T,this.toBBox),B=d(O,k),Y=v(O)+v(k);B=w;Y--){var I=g.children[Y];u(N,g.leaf?C(I):I),O+=p(N)}return O},o.prototype._adjustParentBBoxes=function(g,w,T){for(var b=T;b>=0;b--)u(w[b],g)},o.prototype._condense=function(g){for(var w=g.length-1,T=void 0;w>=0;w--)g[w].children.length===0?w>0?(T=g[w-1].children,T.splice(T.indexOf(g[w]),1)):this.clear():l(g[w],this.toBBox)};function s(E,g,w){if(!w)return g.indexOf(E);for(var T=0;T=E.minX&&g.maxY>=E.minY}function M(E){return{children:E,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function P(E,g,w,T,b){for(var C=[g,w];C.length;)if(w=C.pop(),g=C.pop(),!(w-g<=T)){var S=g+Math.ceil((w-g)/T/2)*T;r(E,S,g,w,b),C.push(g,S,S,w)}}return o})})(No);var Wc=No.exports,Xc=zc(Wc),R;(function(t){t.GROUP="g",t.CIRCLE="circle",t.ELLIPSE="ellipse",t.IMAGE="image",t.RECT="rect",t.LINE="line",t.POLYLINE="polyline",t.POLYGON="polygon",t.TEXT="text",t.PATH="path",t.HTML="html",t.MESH="mesh"})(R||(R={}));var qe;(function(t){t[t.ZERO=0]="ZERO",t[t.NEGATIVE_ONE=1]="NEGATIVE_ONE"})(qe||(qe={}));var Le=function(){function t(){this.plugins=[]}return t.prototype.addRenderingPlugin=function(e){this.plugins.push(e),this.context.renderingPlugins.push(e)},t.prototype.removeAllRenderingPlugins=function(){var e=this;this.plugins.forEach(function(r){var n=e.context.renderingPlugins.indexOf(r);n>=0&&e.context.renderingPlugins.splice(n,1)})},t}(),Vc=function(){function t(e){this.clipSpaceNearZ=qe.NEGATIVE_ONE,this.plugins=[],this.config=U({enableDirtyCheck:!0,enableCulling:!1,enableAutoRendering:!0,enableDirtyRectangleRendering:!0,enableDirtyRectangleRenderingDebug:!1},e)}return t.prototype.registerPlugin=function(e){var r=this.plugins.findIndex(function(n){return n===e});r===-1&&this.plugins.push(e)},t.prototype.unregisterPlugin=function(e){var r=this.plugins.findIndex(function(n){return n===e});r>-1&&this.plugins.splice(r,1)},t.prototype.getPlugins=function(){return this.plugins},t.prototype.getPlugin=function(e){return this.plugins.find(function(r){return r.name===e})},t.prototype.getConfig=function(){return this.config},t.prototype.setConfig=function(e){Object.assign(this.config,e)},t}();function Be(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function An(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t}function en(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t}function la(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t}function qc(t,e,r){return t[0]=Math.max(e[0],r[0]),t[1]=Math.max(e[1],r[1]),t[2]=Math.max(e[2],r[2]),t}function $c(t,e,r){return t[0]=Math.min(e[0],r[0]),t[1]=Math.min(e[1],r[1]),t[2]=Math.min(e[2],r[2]),t}function On(t){return t===void 0?0:t>360||t<-360?t%360:t}function wt(t,e,r){return e===void 0&&(e=0),r===void 0&&(r=0),Array.isArray(t)&&t.length===3?gl(t):ie(t)?j(t,e,r):j(t[0],t[1]||e,t[2]||r)}function ut(t){return t*(Math.PI/180)}function Gt(t){return t*(180/Math.PI)}function Kc(t){return 360*t}function Zc(t,e){var r=e[0],n=e[1],i=e[2],a=e[3],o=r*r,s=n*n,l=i*i,c=a*a,u=o+s+l+c,f=r*a-n*i;return f>.499995*u?(t[0]=Math.PI/2,t[1]=2*Math.atan2(n,r),t[2]=0):f<-.499995*u?(t[0]=-Math.PI/2,t[1]=2*Math.atan2(n,r),t[2]=0):(t[0]=Math.asin(2*(r*i-a*n)),t[1]=Math.atan2(2*(r*a+n*i),1-2*(l+c)),t[2]=Math.atan2(2*(r*n+i*a),1-2*(s+l))),t}function Qc(t,e){var r,n,i=Math.PI*.5,a=_(Ze(q(),e),3),o=a[0],s=a[1],l=a[2],c=Math.asin(-e[2]/o);return c-i?(r=Math.atan2(e[6]/s,e[10]/l),n=Math.atan2(e[1]/o,e[0]/o)):(n=0,r=-Math.atan2(e[4]/s,e[5]/s)):(n=0,r=Math.atan2(e[4]/s,e[5]/s)),t[0]=r,t[1]=c,t[2]=n,t}function kn(t,e){return e.length===16?Qc(t,e):Zc(t,e)}function Jc(t,e,r,n,i){var a=Math.cos(t),o=Math.sin(t);return Ws(n*a,i*o,0,-n*o,i*a,0,e,r,1)}function jc(t,e,r,n,i,a,o,s){s===void 0&&(s=!1);var l=2*a/(r-e),c=2*a/(n-i),u=(r+e)/(r-e),f=(n+i)/(n-i),h,v;return s?(h=-o/(o-a),v=-o*a/(o-a)):(h=-(o+a)/(o-a),v=-2*o*a/(o-a)),t[0]=l,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=c,t[6]=0,t[7]=0,t[8]=u,t[9]=f,t[10]=h,t[11]=-1,t[12]=0,t[13]=0,t[14]=v,t[15]=0,t}function ca(t){var e=t[0],r=t[1],n=t[3],i=t[4],a=Math.sqrt(e*e+r*r),o=Math.sqrt(n*n+i*i),s=e*i-r*n;s<0&&(ez[1][2]&&(a[0]=-a[0]),z[0][2]>z[2][0]&&(a[1]=-a[1]),z[1][0]>z[0][1]&&(a[2]=-a[2]),!0}function eu(t,e){var r=e[15];if(r===0)return!1;for(var n=1/r,i=0;i<16;i++)t[i]=e[i]*n;return!0}function ru(t,e){t[0][0]=e[0],t[0][1]=e[1],t[0][2]=e[2],t[1][0]=e[4],t[1][1]=e[5],t[1][2]=e[6],t[2][0]=e[8],t[2][1]=e[9],t[2][2]=e[10]}function In(t,e,r,n,i){t[0]=e[0]*n+r[0]*i,t[1]=e[1]*n+r[1]*i,t[2]=e[2]*n+r[2]*i}var ht=function(){function t(){this.center=[0,0,0],this.halfExtents=[0,0,0],this.min=[0,0,0],this.max=[0,0,0]}return t.isEmpty=function(e){return!e||e.halfExtents[0]===0&&e.halfExtents[1]===0&&e.halfExtents[2]===0},t.prototype.update=function(e,r){Be(this.center,e),Be(this.halfExtents,r),An(this.min,this.center,this.halfExtents),en(this.max,this.center,this.halfExtents)},t.prototype.setMinMax=function(e,r){en(this.center,r,e),la(this.center,this.center,.5),An(this.halfExtents,r,e),la(this.halfExtents,this.halfExtents,.5),Be(this.min,e),Be(this.max,r)},t.prototype.getMin=function(){return this.min},t.prototype.getMax=function(){return this.max},t.prototype.add=function(e){if(!t.isEmpty(e)){if(t.isEmpty(this)){this.setMinMax(e.getMin(),e.getMax());return}var r=this.center,n=r[0],i=r[1],a=r[2],o=this.halfExtents,s=o[0],l=o[1],c=o[2],u=n-s,f=n+s,h=i-l,v=i+l,p=a-c,y=a+c,d=e.center,m=d[0],x=d[1],M=d[2],P=e.halfExtents,E=P[0],g=P[1],w=P[2],T=m-E,b=m+E,C=x-g,S=x+g,N=M-w,O=M+w;Tf&&(f=b),Cv&&(v=S),Ny&&(y=O),r[0]=(u+f)*.5,r[1]=(h+v)*.5,r[2]=(p+y)*.5,o[0]=(f-u)*.5,o[1]=(v-h)*.5,o[2]=(y-p)*.5,this.min[0]=u,this.min[1]=h,this.min[2]=p,this.max[0]=f,this.max[1]=v,this.max[2]=y}},t.prototype.setFromTransformedAABB=function(e,r){var n=this.center,i=this.halfExtents,a=e.center,o=e.halfExtents,s=r[0],l=r[4],c=r[8],u=r[1],f=r[5],h=r[9],v=r[2],p=r[6],y=r[10],d=Math.abs(s),m=Math.abs(l),x=Math.abs(c),M=Math.abs(u),P=Math.abs(f),E=Math.abs(h),g=Math.abs(v),w=Math.abs(p),T=Math.abs(y);n[0]=r[12]+s*a[0]+l*a[1]+c*a[2],n[1]=r[13]+u*a[0]+f*a[1]+h*a[2],n[2]=r[14]+v*a[0]+p*a[1]+y*a[2],i[0]=d*o[0]+m*o[1]+x*o[2],i[1]=M*o[0]+P*o[1]+E*o[2],i[2]=g*o[0]+w*o[1]+T*o[2],An(this.min,n,i),en(this.max,n,i)},t.prototype.intersects=function(e){var r=this.getMax(),n=this.getMin(),i=e.getMax(),a=e.getMin();return n[0]<=i[0]&&r[0]>=a[0]&&n[1]<=i[1]&&r[1]>=a[1]&&n[2]<=i[2]&&r[2]>=a[2]},t.prototype.intersection=function(e){if(!this.intersects(e))return null;var r=new t,n=qc([0,0,0],this.getMin(),e.getMin()),i=$c([0,0,0],this.getMax(),e.getMax());return r.setMinMax(n,i),r},t.prototype.getNegativeFarPoint=function(e){return e.pnVertexFlag===273?Be([0,0,0],this.min):e.pnVertexFlag===272?[this.min[0],this.min[1],this.max[2]]:e.pnVertexFlag===257?[this.min[0],this.max[1],this.min[2]]:e.pnVertexFlag===256?[this.min[0],this.max[1],this.max[2]]:e.pnVertexFlag===17?[this.max[0],this.min[1],this.min[2]]:e.pnVertexFlag===16?[this.max[0],this.min[1],this.max[2]]:e.pnVertexFlag===1?[this.max[0],this.max[1],this.min[2]]:[this.max[0],this.max[1],this.max[2]]},t.prototype.getPositiveFarPoint=function(e){return e.pnVertexFlag===273?Be([0,0,0],this.max):e.pnVertexFlag===272?[this.max[0],this.max[1],this.min[2]]:e.pnVertexFlag===257?[this.max[0],this.min[1],this.max[2]]:e.pnVertexFlag===256?[this.max[0],this.min[1],this.min[2]]:e.pnVertexFlag===17?[this.min[0],this.max[1],this.max[2]]:e.pnVertexFlag===16?[this.min[0],this.max[1],this.min[2]]:e.pnVertexFlag===1?[this.min[0],this.min[1],this.max[2]]:[this.min[0],this.min[1],this.min[2]]},t}(),nu=function(){function t(e,r){this.distance=e||0,this.normal=r||j(0,1,0),this.updatePNVertexFlag()}return t.prototype.updatePNVertexFlag=function(){this.pnVertexFlag=(+(this.normal[0]>=0)<<8)+(+(this.normal[1]>=0)<<4)+ +(this.normal[2]>=0)},t.prototype.distanceToPoint=function(e){return te(e,this.normal)-this.distance},t.prototype.normalize=function(){var e=1/ho(this.normal);xl(this.normal,this.normal,e),this.distance*=e},t.prototype.intersectsLine=function(e,r,n){var i=this.distanceToPoint(e),a=this.distanceToPoint(r),o=i/(i-a),s=o>=0&&o<=1;return s&&n&&El(n,e,r,o),s},t}(),ve;(function(t){t[t.OUTSIDE=4294967295]="OUTSIDE",t[t.INSIDE=0]="INSIDE",t[t.INDETERMINATE=2147483647]="INDETERMINATE"})(ve||(ve={}));var iu=function(){function t(e){if(this.planes=[],e)this.planes=e;else for(var r=0;r<6;r++)this.planes.push(new nu)}return t.prototype.extractFromVPMatrix=function(e){var r=_(e,16),n=r[0],i=r[1],a=r[2],o=r[3],s=r[4],l=r[5],c=r[6],u=r[7],f=r[8],h=r[9],v=r[10],p=r[11],y=r[12],d=r[13],m=r[14],x=r[15];qt(this.planes[0].normal,o-n,u-s,p-f),this.planes[0].distance=x-y,qt(this.planes[1].normal,o+n,u+s,p+f),this.planes[1].distance=x+y,qt(this.planes[2].normal,o+i,u+l,p+h),this.planes[2].distance=x+d,qt(this.planes[3].normal,o-i,u-l,p-h),this.planes[3].distance=x-d,qt(this.planes[4].normal,o-a,u-c,p-v),this.planes[4].distance=x-m,qt(this.planes[5].normal,o+a,u+c,p+v),this.planes[5].distance=x+m,this.planes.forEach(function(M){M.normalize(),M.updatePNVertexFlag()})},t}(),pt=function(){function t(e,r){e===void 0&&(e=0),r===void 0&&(r=0),this.x=0,this.y=0,this.x=e,this.y=r}return t.prototype.clone=function(){return new t(this.x,this.y)},t.prototype.copyFrom=function(e){this.x=e.x,this.y=e.y},t}(),ke=function(){function t(e,r,n,i){this.x=e,this.y=r,this.width=n,this.height=i,this.left=e,this.right=e+n,this.top=r,this.bottom=r+i}return t.prototype.toJSON=function(){},t}(),J="Method not implemented.",Ge="Use document.documentElement instead.",au="Cannot append a destroyed element.",at;(function(t){t[t.ORBITING=0]="ORBITING",t[t.EXPLORING=1]="EXPLORING",t[t.TRACKING=2]="TRACKING"})(at||(at={}));var pr;(function(t){t[t.DEFAULT=0]="DEFAULT",t[t.ROTATIONAL=1]="ROTATIONAL",t[t.TRANSLATIONAL=2]="TRANSLATIONAL",t[t.CINEMATIC=3]="CINEMATIC"})(pr||(pr={}));var Pt;(function(t){t[t.ORTHOGRAPHIC=0]="ORTHOGRAPHIC",t[t.PERSPECTIVE=1]="PERSPECTIVE"})(Pt||(Pt={}));var Ro={UPDATED:"updated"},fa=2e-4,ou=function(){function t(){this.clipSpaceNearZ=qe.NEGATIVE_ONE,this.eventEmitter=new Ei,this.matrix=nt(),this.right=j(1,0,0),this.up=j(0,1,0),this.forward=j(0,0,1),this.position=j(0,0,1),this.focalPoint=j(0,0,0),this.distanceVector=j(0,0,-1),this.distance=1,this.azimuth=0,this.elevation=0,this.roll=0,this.relAzimuth=0,this.relElevation=0,this.relRoll=0,this.dollyingStep=0,this.maxDistance=1/0,this.minDistance=-1/0,this.zoom=1,this.rotateWorld=!1,this.fov=30,this.near=.1,this.far=1e3,this.aspect=1,this.projectionMatrix=nt(),this.projectionMatrixInverse=nt(),this.jitteredProjectionMatrix=void 0,this.enableUpdate=!0,this.type=at.EXPLORING,this.trackingMode=pr.DEFAULT,this.projectionMode=Pt.PERSPECTIVE,this.frustum=new iu,this.orthoMatrix=nt()}return t.prototype.isOrtho=function(){return this.projectionMode===Pt.ORTHOGRAPHIC},t.prototype.getProjectionMode=function(){return this.projectionMode},t.prototype.getPerspective=function(){return this.jitteredProjectionMatrix||this.projectionMatrix},t.prototype.getPerspectiveInverse=function(){return this.projectionMatrixInverse},t.prototype.getFrustum=function(){return this.frustum},t.prototype.getPosition=function(){return this.position},t.prototype.getFocalPoint=function(){return this.focalPoint},t.prototype.getDollyingStep=function(){return this.dollyingStep},t.prototype.getNear=function(){return this.near},t.prototype.getFar=function(){return this.far},t.prototype.getZoom=function(){return this.zoom},t.prototype.getOrthoMatrix=function(){return this.orthoMatrix},t.prototype.getView=function(){return this.view},t.prototype.setEnableUpdate=function(e){this.enableUpdate=e},t.prototype.setType=function(e,r){return this.type=e,this.type===at.EXPLORING?this.setWorldRotation(!0):this.setWorldRotation(!1),this._getAngles(),this.type===at.TRACKING&&r!==void 0&&this.setTrackingMode(r),this},t.prototype.setProjectionMode=function(e){return this.projectionMode=e,this},t.prototype.setTrackingMode=function(e){if(this.type!==at.TRACKING)throw new Error("Impossible to set a tracking mode if the camera is not of tracking type");return this.trackingMode=e,this},t.prototype.setWorldRotation=function(e){return this.rotateWorld=e,this._getAngles(),this},t.prototype.getViewTransform=function(){return jt(nt(),this.matrix)},t.prototype.getWorldTransform=function(){return this.matrix},t.prototype.jitterProjectionMatrix=function(e,r){var n=ro(nt(),[e,r,0]);this.jitteredProjectionMatrix=Et(nt(),n,this.projectionMatrix)},t.prototype.clearJitterProjectionMatrix=function(){this.jitteredProjectionMatrix=void 0},t.prototype.setMatrix=function(e){return this.matrix=e,this._update(),this},t.prototype.setFov=function(e){return this.setPerspective(this.near,this.far,e,this.aspect),this},t.prototype.setAspect=function(e){return this.setPerspective(this.near,this.far,this.fov,e),this},t.prototype.setNear=function(e){return this.projectionMode===Pt.PERSPECTIVE?this.setPerspective(e,this.far,this.fov,this.aspect):this.setOrthographic(this.left,this.rright,this.top,this.bottom,e,this.far),this},t.prototype.setFar=function(e){return this.projectionMode===Pt.PERSPECTIVE?this.setPerspective(this.near,e,this.fov,this.aspect):this.setOrthographic(this.left,this.rright,this.top,this.bottom,this.near,e),this},t.prototype.setViewOffset=function(e,r,n,i,a,o){return this.aspect=e/r,this.view===void 0&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=r,this.view.offsetX=n,this.view.offsetY=i,this.view.width=a,this.view.height=o,this.projectionMode===Pt.PERSPECTIVE?this.setPerspective(this.near,this.far,this.fov,this.aspect):this.setOrthographic(this.left,this.rright,this.top,this.bottom,this.near,this.far),this},t.prototype.clearViewOffset=function(){return this.view!==void 0&&(this.view.enabled=!1),this.projectionMode===Pt.PERSPECTIVE?this.setPerspective(this.near,this.far,this.fov,this.aspect):this.setOrthographic(this.left,this.rright,this.top,this.bottom,this.near,this.far),this},t.prototype.setZoom=function(e){return this.zoom=e,this.projectionMode===Pt.ORTHOGRAPHIC?this.setOrthographic(this.left,this.rright,this.top,this.bottom,this.near,this.far):this.projectionMode===Pt.PERSPECTIVE&&this.setPerspective(this.near,this.far,this.fov,this.aspect),this},t.prototype.setZoomByViewportPoint=function(e,r){var n=this.canvas.viewport2Canvas({x:r[0],y:r[1]}),i=n.x,a=n.y,o=this.roll;this.rotate(0,0,-o),this.setPosition(i,a),this.setFocalPoint(i,a),this.setZoom(e),this.rotate(0,0,o);var s=this.canvas.viewport2Canvas({x:r[0],y:r[1]}),l=s.x,c=s.y,u=j(l-i,c-a,0),f=te(u,this.right)/se(this.right),h=te(u,this.up)/se(this.up);return this.pan(-f,-h),this},t.prototype.setPerspective=function(e,r,n,i){var a;this.projectionMode=Pt.PERSPECTIVE,this.fov=n,this.near=e,this.far=r,this.aspect=i;var o=this.near*Math.tan(ut(.5*this.fov))/this.zoom,s=2*o,l=this.aspect*s,c=-.5*l;if(!((a=this.view)===null||a===void 0)&&a.enabled){var u=this.view.fullWidth,f=this.view.fullHeight;c+=this.view.offsetX*l/u,o-=this.view.offsetY*s/f,l*=this.view.width/u,s*=this.view.height/f}return jc(this.projectionMatrix,c,c+l,o,o-s,e,this.far,this.clipSpaceNearZ===qe.ZERO),rn(this.projectionMatrix,this.projectionMatrix,j(1,-1,1)),jt(this.projectionMatrixInverse,this.projectionMatrix),this.triggerUpdate(),this},t.prototype.setOrthographic=function(e,r,n,i,a,o){var s;this.projectionMode=Pt.ORTHOGRAPHIC,this.rright=r,this.left=e,this.top=n,this.bottom=i,this.near=a,this.far=o;var l=(this.rright-this.left)/(2*this.zoom),c=(this.top-this.bottom)/(2*this.zoom),u=(this.rright+this.left)/2,f=(this.top+this.bottom)/2,h=u-l,v=u+l,p=f+c,y=f-c;if(!((s=this.view)===null||s===void 0)&&s.enabled){var d=(this.rright-this.left)/this.view.fullWidth/this.zoom,m=(this.top-this.bottom)/this.view.fullHeight/this.zoom;h+=d*this.view.offsetX,v=h+d*this.view.width,p-=m*this.view.offsetY,y=p-m*this.view.height}return this.clipSpaceNearZ===qe.NEGATIVE_ONE?lo(this.projectionMatrix,h,v,y,p,a,o):co(this.projectionMatrix,h,v,y,p,a,o),rn(this.projectionMatrix,this.projectionMatrix,j(1,-1,1)),jt(this.projectionMatrixInverse,this.projectionMatrix),this._getOrthoMatrix(),this.triggerUpdate(),this},t.prototype.setPosition=function(e,r,n){r===void 0&&(r=this.position[1]),n===void 0&&(n=this.position[2]);var i=wt(e,r,n);return this._setPosition(i),this.setFocalPoint(this.focalPoint),this.triggerUpdate(),this},t.prototype.setFocalPoint=function(e,r,n){r===void 0&&(r=this.focalPoint[1]),n===void 0&&(n=this.focalPoint[2]);var i=j(0,1,0);if(this.focalPoint=wt(e,r,n),this.trackingMode===pr.CINEMATIC){var a=Hi(q(),this.focalPoint,this.position);e=a[0],r=a[1],n=a[2];var o=se(a),s=Gt(Math.asin(r/o)),l=90+Gt(Math.atan2(n,e)),c=nt();eo(c,c,ut(l)),to(c,c,ut(s)),i=Ut(q(),[0,1,0],c)}return jt(this.matrix,uo(nt(),this.position,this.focalPoint,i)),this._getAxes(),this._getDistance(),this._getAngles(),this.triggerUpdate(),this},t.prototype.getDistance=function(){return this.distance},t.prototype.getDistanceVector=function(){return this.distanceVector},t.prototype.setDistance=function(e){if(this.distance===e||e<0)return this;this.distance=e,this.distance=L.kEms&&e=me.kUnitType&&this.getType()<=me.kClampType},t}(),hu=function(t){W(e,t);function e(r){var n=t.call(this)||this;return n.colorSpace=r,n}return e.prototype.getType=function(){return me.kColorType},e.prototype.to=function(r){return this},e}(gn),ee;(function(t){t[t.Constant=0]="Constant",t[t.LinearGradient=1]="LinearGradient",t[t.RadialGradient=2]="RadialGradient"})(ee||(ee={}));var Lr=function(t){W(e,t);function e(r,n){var i=t.call(this)||this;return i.type=r,i.value=n,i}return e.prototype.clone=function(){return new e(this.type,this.value)},e.prototype.buildCSSText=function(r,n,i){return i},e.prototype.getType=function(){return me.kColorType},e}(gn),Ct=function(t){W(e,t);function e(r){var n=t.call(this)||this;return n.value=r,n}return e.prototype.clone=function(){return new e(this.value)},e.prototype.getType=function(){return me.kKeywordType},e.prototype.buildCSSText=function(r,n,i){return i+this.value},e}(gn),vu=Lt(function(t){return t===void 0&&(t=""),t.replace(/-([a-z])/g,function(e){return e[1].toUpperCase()})}),da=function(t){return t.split("").map(function(e,r){return e.toUpperCase()===e?"".concat(r!==0?"-":"").concat(e.toLowerCase()):e}).join("")};function du(t){if(!t)throw new Error}function ze(t){return typeof t=="function"}function pu(t){return typeof t=="symbol"}var yu={d:{alias:"path"},strokeDasharray:{alias:"lineDash"},strokeWidth:{alias:"lineWidth"},textAnchor:{alias:"textAlign"},src:{alias:"img"}},ri=Lt(function(t){var e=vu(t),r=yu[e];return e=(r==null?void 0:r.alias)||e,e}),gu=function(t,e){e===void 0&&(e="");var r="";return Number.isFinite(t)?(du(Number.isNaN(t)),r="NaN"):t>0?r="infinity":r="-infinity",r+=e},ni=function(t){return fu(uu(t))},vt=function(t){W(e,t);function e(r,n){n===void 0&&(n=L.kNumber);var i=t.call(this)||this,a;return typeof n=="string"?a=cu(n):a=n,i.unit=a,i.value=r,i}return e.prototype.clone=function(){return new e(this.value,this.unit)},e.prototype.equals=function(r){var n=r;return this.value===n.value&&this.unit===n.unit},e.prototype.getType=function(){return me.kUnitType},e.prototype.convertTo=function(r){if(this.unit===r)return new e(this.value,this.unit);var n=ni(this.unit);if(n!==ni(r)||n===L.kUnknown)return null;var i=va(this.unit)/va(r);return new e(this.value*i,r)},e.prototype.buildCSSText=function(r,n,i){var a;switch(this.unit){case L.kUnknown:break;case L.kInteger:a=Number(this.value).toFixed(0);break;case L.kNumber:case L.kPercentage:case L.kEms:case L.kRems:case L.kPixels:case L.kDegrees:case L.kRadians:case L.kGradians:case L.kMilliseconds:case L.kSeconds:case L.kTurns:{var o=-999999,s=999999,l=this.value,c=ei(this.unit);if(ls){var u=ei(this.unit);!Number.isFinite(l)||Number.isNaN(l)?a=gu(l,u):a=l+(u||"")}else a="".concat(l).concat(c)}}return i+=a,i},e}(gn),dt=new vt(0,"px");new vt(1,"px");var le=new vt(0,"deg"),Ti=function(t){W(e,t);function e(r,n,i,a,o){a===void 0&&(a=1),o===void 0&&(o=!1);var s=t.call(this,"rgb")||this;return s.r=r,s.g=n,s.b=i,s.alpha=a,s.isNone=o,s}return e.prototype.clone=function(){return new e(this.r,this.g,this.b,this.alpha)},e.prototype.buildCSSText=function(r,n,i){return i+"rgba(".concat(this.r,",").concat(this.g,",").concat(this.b,",").concat(this.alpha,")")},e}(hu),tt=new Ct("unset"),mu=new Ct("initial"),xu=new Ct("inherit"),Ln={"":tt,unset:tt,initial:mu,inherit:xu},ii=function(t){return Ln[t]||(Ln[t]=new Ct(t)),Ln[t]},ai=new Ti(0,0,0,0,!0),Ao=new Ti(0,0,0,0),Eu=Lt(function(t,e,r,n){return new Ti(t,e,r,n)}),ot=function(t,e){return e===void 0&&(e=L.kNumber),new vt(t,e)},cn=new vt(50,"%"),oi;(function(t){t[t.Standard=0]="Standard"})(oi||(oi={}));var Qe;(function(t){t[t.ADDED=0]="ADDED",t[t.REMOVED=1]="REMOVED",t[t.Z_INDEX_CHANGED=2]="Z_INDEX_CHANGED"})(Qe||(Qe={}));var Oo={absolutePath:[],hasArc:!1,segments:[],polygons:[],polylines:[],curve:null,totalLength:0,rect:new ke(0,0,0,0)},D;(function(t){t.COORDINATE="",t.COLOR="",t.PAINT="",t.NUMBER="",t.ANGLE="",t.OPACITY_VALUE="",t.SHADOW_BLUR="",t.LENGTH="",t.PERCENTAGE="",t.LENGTH_PERCENTAGE=" | ",t.LENGTH_PERCENTAGE_12="[ | ]{1,2}",t.LENGTH_PERCENTAGE_14="[ | ]{1,4}",t.LIST_OF_POINTS="",t.PATH="",t.FILTER="",t.Z_INDEX="",t.OFFSET_DISTANCE="",t.DEFINED_PATH="",t.MARKER="",t.TRANSFORM="",t.TRANSFORM_ORIGIN="",t.TEXT="",t.TEXT_TRANSFORM=""})(D||(D={}));function Mu(t){var e=t.type,r=t.value;return e==="hex"?"#".concat(r):e==="literal"?r:e==="rgb"?"rgb(".concat(r.join(","),")"):"rgba(".concat(r.join(","),")")}var Pu=function(){var t={linearGradient:/^(linear\-gradient)/i,repeatingLinearGradient:/^(repeating\-linear\-gradient)/i,radialGradient:/^(radial\-gradient)/i,repeatingRadialGradient:/^(repeating\-radial\-gradient)/i,conicGradient:/^(conic\-gradient)/i,sideOrCorner:/^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,extentKeywords:/^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,positionKeywords:/^(left|center|right|top|bottom)/i,pixelValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,percentageValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,emValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,angleValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,startCall:/^\(/,endCall:/^\)/,comma:/^,/,hexColor:/^\#([0-9a-fA-F]+)/,literalColor:/^([a-zA-Z]+)/,rgbColor:/^rgb/i,rgbaColor:/^rgba/i,number:/^(([0-9]*\.[0-9]+)|([0-9]+\.?))/},e="";function r(I){throw new Error(e+": "+I)}function n(){var I=i();return e.length>0&&r("Invalid input not EOF"),I}function i(){return M(a)}function a(){return o("linear-gradient",t.linearGradient,l)||o("repeating-linear-gradient",t.repeatingLinearGradient,l)||o("radial-gradient",t.radialGradient,f)||o("repeating-radial-gradient",t.repeatingRadialGradient,f)||o("conic-gradient",t.conicGradient,f)}function o(I,G,H){return s(G,function(ct){var rt=H();return rt&&(B(t.comma)||r("Missing comma before color stops")),{type:I,orientation:rt,colorStops:M(P)}})}function s(I,G){var H=B(I);if(H){B(t.startCall)||r("Missing (");var ct=G(H);return B(t.endCall)||r("Missing )"),ct}}function l(){return c()||u()}function c(){return k("directional",t.sideOrCorner,1)}function u(){return k("angular",t.angleValue,1)}function f(){var I,G=h(),H;return G&&(I=[],I.push(G),H=e,B(t.comma)&&(G=h(),G?I.push(G):e=H)),I}function h(){var I=v()||p();if(I)I.at=d();else{var G=y();if(G){I=G;var H=d();H&&(I.at=H)}else{var ct=m();ct&&(I={type:"default-radial",at:ct})}}return I}function v(){var I=k("shape",/^(circle)/i,0);return I&&(I.style=O()||y()),I}function p(){var I=k("shape",/^(ellipse)/i,0);return I&&(I.style=S()||y()),I}function y(){return k("extent-keyword",t.extentKeywords,1)}function d(){if(k("position",/^at/,0)){var I=m();return I||r("Missing positioning value"),I}}function m(){var I=x();if(I.x||I.y)return{type:"position",value:I}}function x(){return{x:S(),y:S()}}function M(I){var G=I(),H=[];if(G)for(H.push(G);B(t.comma);)G=I(),G?H.push(G):r("One extra comma");return H}function P(){var I=E();return I||r("Expected color definition"),I.length=S(),I}function E(){return w()||b()||T()||g()}function g(){return k("literal",t.literalColor,0)}function w(){return k("hex",t.hexColor,1)}function T(){return s(t.rgbColor,function(){return{type:"rgb",value:M(C)}})}function b(){return s(t.rgbaColor,function(){return{type:"rgba",value:M(C)}})}function C(){return B(t.number)[1]}function S(){return k("%",t.percentageValue,1)||N()||O()}function N(){return k("position-keyword",t.positionKeywords,1)}function O(){return k("px",t.pixelValue,1)||k("em",t.emValue,1)}function k(I,G,H){var ct=B(G);if(ct)return{type:I,value:ct[H]}}function B(I){var G=/^[\n\r\t\s]+/.exec(e);G&&Y(G[0].length);var H=I.exec(e);return H&&Y(H[0].length),H}function Y(I){e=e.substring(I)}return function(I){return e=I,n()}}();function wu(t,e,r){var n=ut(r.value),i=0,a=0,o=i+t/2,s=a+e/2,l=Math.abs(t*Math.cos(n))+Math.abs(e*Math.sin(n)),c=o-Math.cos(n)*l/2,u=s-Math.sin(n)*l/2,f=o+Math.cos(n)*l/2,h=s+Math.sin(n)*l/2;return{x1:c,y1:u,x2:f,y2:h}}function Tu(t,e,r,n,i){var a=r.value,o=n.value;r.unit===L.kPercentage&&(a=r.value/100*t),n.unit===L.kPercentage&&(o=n.value/100*e);var s=Math.max(Rt([0,0],[a,o]),Rt([0,e],[a,o]),Rt([t,e],[a,o]),Rt([t,0],[a,o]));return i&&(i instanceof vt?s=i.value:i instanceof Ct&&(i.value==="closest-side"?s=Math.min(a,t-a,o,e-o):i.value==="farthest-side"?s=Math.max(a,t-a,o,e-o):i.value==="closest-corner"&&(s=Math.min(Rt([0,0],[a,o]),Rt([0,e],[a,o]),Rt([t,e],[a,o]),Rt([t,0],[a,o]))))),{x:a,y:o,r:s}}var bu=/^l\s*\(\s*([\d.]+)\s*\)\s*(.*)/i,Cu=/^r\s*\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)\s*(.*)/i,Su=/^p\s*\(\s*([axyn])\s*\)\s*(.*)/i,ko=/[\d.]+:(#[^\s]+|[^\)]+\))/gi;function Nu(t){var e,r,n,i=t.length;t[i-1].length=(e=t[i-1].length)!==null&&e!==void 0?e:{type:"%",value:"100"},i>1&&(t[0].length=(r=t[0].length)!==null&&r!==void 0?r:{type:"%",value:"0"});for(var a=0,o=Number(t[0].length.value),s=1;s-1||t.indexOf("radial")>-1){var r=Pu(t);return r.map(function(s){var l=s.type,c=s.orientation,u=s.colorStops;Nu(u);var f=u.map(function(M){return{offset:ot(Number(M.length.value),"%"),color:Mu(M)}});if(l==="linear-gradient")return new Lr(ee.LinearGradient,{angle:c?Au(c):le,steps:f});if(l==="radial-gradient"&&(c||(c=[{type:"shape",value:"circle"}]),c[0].type==="shape"&&c[0].value==="circle")){var h=Ou(c[0].at),v=h.cx,p=h.cy,y=void 0;if(c[0].style){var d=c[0].style,m=d.type,x=d.value;m==="extent-keyword"?y=ii(x):y=ot(x,m)}return new Lr(ee.RadialGradient,{cx:v,cy:p,size:y,steps:f})}})}var n=t[0];if(t[1]==="("||t[2]==="("){if(n==="l"){var i=bu.exec(t);if(i){var a=((e=i[2].match(ko))===null||e===void 0?void 0:e.map(function(s){return s.split(":")}))||[];return[new Lr(ee.LinearGradient,{angle:ot(parseFloat(i[1]),"deg"),steps:a.map(function(s){var l=_(s,2),c=l[0],u=l[1];return{offset:ot(Number(c)*100,"%"),color:u}})})]}}else if(n==="r"){var o=Iu(t);if(o)if(bt(o))t=o;else return[new Lr(ee.RadialGradient,o)]}else if(n==="p")return Lu(t)}});function Iu(t){var e,r=Cu.exec(t);if(r){var n=((e=r[4].match(ko))===null||e===void 0?void 0:e.map(function(i){return i.split(":")}))||[];return{cx:ot(50,"%"),cy:ot(50,"%"),steps:n.map(function(i){var a=_(i,2),o=a[0],s=a[1];return{offset:ot(Number(o)*100,"%"),color:s}})}}return null}function Lu(t){var e=Su.exec(t);if(e){var r=e[1],n=e[2];switch(r){case"a":r="repeat";break;case"x":r="repeat-x";break;case"y":r="repeat-y";break;case"n":r="no-repeat";break;default:r="no-repeat"}return{image:n,repetition:r}}return null}function yr(t){return t&&!!t.image}function un(t){return t&&!F(t.r)&&!F(t.g)&&!F(t.b)}var $e=Lt(function(t){if(yr(t))return U({repetition:"repeat"},t);if(F(t)&&(t=""),t==="transparent")return Ao;t==="currentColor"&&(t="black");var e=ku(t);if(e)return e;var r=yn(t),n=[0,0,0,0];return r!==null&&(n[0]=r.r||0,n[1]=r.g||0,n[2]=r.b||0,n[3]=r.opacity),Eu.apply(void 0,X([],_(n),!1))});function _u(t,e){if(!(!un(t)||!un(e)))return[[Number(t.r),Number(t.g),Number(t.b),Number(t.alpha)],[Number(e.r),Number(e.g),Number(e.b),Number(e.alpha)],function(r){var n=r.slice();if(n[3])for(var i=0;i<3;i++)n[i]=Math.round(kt(n[i],0,255));return n[3]=kt(n[3],0,1),"rgba(".concat(n.join(","),")")}]}function mn(t,e){if(F(e))return ot(0,"px");if(e="".concat(e).trim().toLowerCase(),isFinite(Number(e))){if("px".search(t)>=0)return ot(Number(e),"px");if("deg".search(t)>=0)return ot(Number(e),"deg")}var r=[];e=e.replace(t,function(i){return r.push(i),"U"+i});var n="U("+t.source+")";return r.map(function(i){return ot(Number(e.replace(new RegExp("U"+i,"g"),"").replace(new RegExp(n,"g"),"*0")),i)})[0]}var Du=Lt(function(t){return mn(new RegExp("px","g"),t)}),Je=function(t){return ie(t)||isFinite(Number(t))?ot(Number(t)||0,"px"):mn(new RegExp("px|%|em|rem","g"),t)},Io=Lt(function(t){return mn(new RegExp("deg|rad|grad|turn","g"),t)});function Fu(t,e,r,n,i){i===void 0&&(i=0);var a="",o=t.value||0,s=e.value||0,l=ni(t.unit),c=t.convertTo(l),u=e.convertTo(l);return c&&u?(o=c.value,s=u.value,a=ei(t.unit)):(vt.isLength(t.unit)||vt.isLength(e.unit))&&(o=Nt(t,i,r),s=Nt(e,i,r),a="px"),[o,s,function(f){return n&&(f=Math.max(f,0)),f+a}]}function At(t){var e=0;return t.unit===L.kDegrees?e=t.value:t.unit===L.kRadians?e=Gt(Number(t.value)):t.unit===L.kTurns&&(e=Kc(Number(t.value))),e}function _n(t,e){var r;return Array.isArray(t)?r=t.map(function(n){return Number(n)}):bt(t)?r=t.split(" ").map(function(n){return Number(n)}):ie(t)&&(r=[t]),e===2?r.length===1?[r[0],r[0]]:[r[0],r[1]]:r.length===1?[r[0],r[0],r[0],r[0]]:r.length===2?[r[0],r[1],r[0],r[1]]:r.length===3?[r[0],r[1],r[2],r[1]]:[r[0],r[1],r[2],r[3]]}function Lo(t){return bt(t)?t.split(" ").map(function(e){return Je(e)}):t.map(function(e){return Je(e.toString())})}function Nt(t,e,r){if(t.value===0)return 0;if(t.unit===L.kPixels)return Number(t.value);if(t.unit===L.kPercentage&&r){var n=r.nodeName===R.GROUP?r.getLocalBounds():r.geometry.contentBounds;return t.value/100*n.halfExtents[e]*2}return 0}var Bu=function(t){return mn(/deg|rad|grad|turn|px|%/g,t)},Gu=["blur","brightness","drop-shadow","contrast","grayscale","sepia","saturate","hue-rotate","invert"];function _o(t){if(t===void 0&&(t=""),t=t.toLowerCase().trim(),t==="none")return[];for(var e=/\s*([\w-]+)\(([^)]*)\)/g,r=[],n,i=0;n=e.exec(t);){if(n.index!==i)return[];if(i=n.index+n[0].length,Gu.indexOf(n[1])>-1&&r.push({name:n[1],params:n[2].split(" ").map(function(a){return Bu(a)||$e(a)})}),e.lastIndex===t.length)return r}return[]}function Do(t){return t.toString()}var Pr=Lt(function(t){return typeof t=="number"?ot(t):/^\s*[-+]?(\d*\.)?\d+\s*$/.test(t)?ot(Number(t)):ot(0)});function bi(t,e){return[t,e,Do]}function Ci(t,e){return function(r,n){return[r,n,function(i){return Do(kt(i,t,e))}]}}function Fo(t,e){if(t.length===e.length)return[t,e,function(r){return r}]}function si(t){return t.parsedStyle.path.totalLength===0&&(t.parsedStyle.path.totalLength=uc(t.parsedStyle.path.absolutePath)),t.parsedStyle.path.totalLength}function Uu(t){for(var e=0;e0&&r.push(n),{polygons:e,polylines:r}}function fn(t,e){return t[0]===e[0]&&t[1]===e[1]}function zu(t,e){for(var r=[],n=[],i=[],a=0;aMath.PI/2?Math.PI-c:c,u=u>Math.PI/2?Math.PI-u:u;var f={xExtra:Math.cos(l/2-c)*(e/2*(1/Math.sin(l/2)))-e/2||0,yExtra:Math.cos(u-l/2)*(e/2*(1/Math.sin(l/2)))-e/2||0};return f}function pa(t,e){return[e[0]+(e[0]-t[0]),e[1]+(e[1]-t[1])]}var ya=function(t,e){var r=t.x*e.x+t.y*e.y,n=Math.sqrt((Math.pow(t.x,2)+Math.pow(t.y,2))*(Math.pow(e.x,2)+Math.pow(e.y,2))),i=t.x*e.y-t.y*e.x<0?-1:1,a=i*Math.acos(r/n);return a},ga=function(t,e,r,n,i,a,o,s){e=Math.abs(e),r=Math.abs(r),n=vo(n,360);var l=ut(n);if(t.x===o.x&&t.y===o.y)return{x:t.x,y:t.y,ellipticalArcAngle:0};if(e===0||r===0)return{x:0,y:0,ellipticalArcAngle:0};var c=(t.x-o.x)/2,u=(t.y-o.y)/2,f={x:Math.cos(l)*c+Math.sin(l)*u,y:-Math.sin(l)*c+Math.cos(l)*u},h=Math.pow(f.x,2)/Math.pow(e,2)+Math.pow(f.y,2)/Math.pow(r,2);h>1&&(e=Math.sqrt(h)*e,r=Math.sqrt(h)*r);var v=Math.pow(e,2)*Math.pow(r,2)-Math.pow(e,2)*Math.pow(f.y,2)-Math.pow(r,2)*Math.pow(f.x,2),p=Math.pow(e,2)*Math.pow(f.y,2)+Math.pow(r,2)*Math.pow(f.x,2),y=v/p;y=y<0?0:y;var d=(i!==a?1:-1)*Math.sqrt(y),m={x:d*(e*f.y/r),y:d*(-(r*f.x)/e)},x={x:Math.cos(l)*m.x-Math.sin(l)*m.y+(t.x+o.x)/2,y:Math.sin(l)*m.x+Math.cos(l)*m.y+(t.y+o.y)/2},M={x:(f.x-m.x)/e,y:(f.y-m.y)/r},P=ya({x:1,y:0},M),E={x:(-f.x-m.x)/e,y:(-f.y-m.y)/r},g=ya(M,E);!a&&g>0?g-=2*Math.PI:a&&g<0&&(g+=2*Math.PI),g%=2*Math.PI;var w=P+g*s,T=e*Math.cos(w),b=r*Math.sin(w),C={x:Math.cos(l)*T-Math.sin(l)*b+x.x,y:Math.sin(l)*T+Math.cos(l)*b+x.y,ellipticalArcStartAngle:P,ellipticalArcEndAngle:P+g,ellipticalArcAngle:w,ellipticalArcCenter:x,resultantRx:e,resultantRy:r};return C};function Wu(t){for(var e=[],r=null,n=null,i=null,a=0,o=t.length,s=0;s1&&(r*=Math.sqrt(v),n*=Math.sqrt(v));var p=r*r*(h*h)+n*n*(f*f),y=p?Math.sqrt((r*r*(n*n)-p)/p):1;a===o&&(y*=-1),isNaN(y)&&(y=0);var d=n?y*r*h/n:0,m=r?y*-n*f/r:0,x=(s+c)/2+Math.cos(i)*d-Math.sin(i)*m,M=(l+u)/2+Math.sin(i)*d+Math.cos(i)*m,P=[(f-d)/r,(h-m)/n],E=[(-1*f-d)/r,(-1*h-m)/n],g=xa([1,0],P),w=xa(P,E);return li(P,E)<=-1&&(w=Math.PI),li(P,E)>=1&&(w=0),o===0&&w>0&&(w=w-2*Math.PI),o===1&&w<0&&(w=w+2*Math.PI),{cx:x,cy:M,rx:fn(t,[c,u])?0:r,ry:fn(t,[c,u])?0:n,startAngle:g,endAngle:g+w,xRotation:i,arcFlag:a,sweepFlag:o}}var Bo=function(t){if(t===""||Array.isArray(t)&&t.length===0)return{absolutePath:[],hasArc:!1,segments:[],polygons:[],polylines:[],curve:null,totalLength:0,rect:{x:0,y:0,width:0,height:0}};var e;try{e=sn(t)}catch{e=sn(""),console.error("[g]: Invalid SVG Path definition: ".concat(t))}Uu(e);var r=Yu(e),n=Hu(e),i=n.polygons,a=n.polylines,o=Wu(e),s=zu(o,0),l=s.x,c=s.y,u=s.width,f=s.height;return{absolutePath:e,hasArc:r,segments:o,polygons:i,polylines:a,totalLength:0,rect:{x:Number.isFinite(l)?l:0,y:Number.isFinite(c)?c:0,width:Number.isFinite(u)?u:0,height:Number.isFinite(f)?f:0}}},Vu=Lt(Bo);function ci(t){return bt(t)?Vu(t):Bo(t)}function qu(t,e,r){var n=t.curve,i=e.curve;(!n||n.length===0)&&(n=Kn(t.absolutePath,!1),t.curve=n),(!i||i.length===0)&&(i=Kn(e.absolutePath,!1),e.curve=i);var a=[n,i];n.length!==i.length&&(a=Mo(n,i));var o=Zi(a[0])!==Zi(a[1])?ic(a[0]):nc(a[0]);return[o,hc(a[1],o),function(s){return s}]}function Go(t,e){var r;bt(t)?r=t.split(" ").map(function(u){var f=_(u.split(","),2),h=f[0],v=f[1];return[Number(h),Number(v)]}):r=t;var n=[],i=0,a,o,s=Bc(r);r.forEach(function(u,f){r[f+1]&&(a=[0,0],a[0]=i/s,o=Co(u[0],u[1],r[f+1][0],r[f+1][1]),i+=o,a[1]=i/s,n.push(a))});var l=Math.min.apply(Math,X([],_(r.map(function(u){return u[0]})),!1)),c=Math.min.apply(Math,X([],_(r.map(function(u){return u[1]})),!1));return e&&(e.parsedStyle.defX=l,e.parsedStyle.defY=c),{points:r,totalLength:s,segments:n}}function $u(t,e){return[t.points,e.points,function(r){return r}]}var lt=null;function Mt(t){return function(e){var r=0;return t.map(function(n){return n===lt?e[r++]:n})}}function Se(t){return t}var ui={matrix:["NNNNNN",[lt,lt,0,0,lt,lt,0,0,0,0,1,0,lt,lt,0,1],Se],matrix3d:["NNNNNNNNNNNNNNNN",Se],rotate:["A"],rotatex:["A"],rotatey:["A"],rotatez:["A"],rotate3d:["NNNA"],perspective:["L"],scale:["Nn",Mt([lt,lt,new vt(1)]),Se],scalex:["N",Mt([lt,new vt(1),new vt(1)]),Mt([lt,new vt(1)])],scaley:["N",Mt([new vt(1),lt,new vt(1)]),Mt([new vt(1),lt])],scalez:["N",Mt([new vt(1),new vt(1),lt])],scale3d:["NNN",Se],skew:["Aa",null,Se],skewx:["A",null,Mt([lt,le])],skewy:["A",null,Mt([le,lt])],translate:["Tt",Mt([lt,lt,dt]),Se],translatex:["T",Mt([lt,dt,dt]),Mt([lt,dt])],translatey:["T",Mt([dt,lt,dt]),Mt([dt,lt])],translatez:["L",Mt([dt,dt,lt])],translate3d:["TTL",Se]};function hn(t){if(t=(t||"none").toLowerCase().trim(),t==="none")return[];for(var e=/\s*(\w+)\(([^)]*)\)/g,r=[],n,i=0;n=e.exec(t);){if(n.index!==i)return[];i=n.index+n[0].length;var a=n[1],o=ui[a];if(!o)return[];var s=n[2].split(","),l=o[0];if(l.length"].calculator(null,null,{value:r.textTransform},e,null),r.clipPath&&this.runtime.CSSPropertySyntaxFactory[""].calculator("clipPath",o,r.clipPath,e,this.runtime),r.offsetPath&&this.runtime.CSSPropertySyntaxFactory[""].calculator("offsetPath",s,r.offsetPath,e,this.runtime),r.anchor&&(e.parsedStyle.anchor=_n(r.anchor,2)),r.transform&&(e.parsedStyle.transform=hn(r.transform)),r.transformOrigin&&(e.parsedStyle.transformOrigin=Uo(r.transformOrigin)),r.markerStart&&(e.parsedStyle.markerStart=this.runtime.CSSPropertySyntaxFactory[""].calculator(null,r.markerStart,r.markerStart,null,null)),r.markerEnd&&(e.parsedStyle.markerEnd=this.runtime.CSSPropertySyntaxFactory[""].calculator(null,r.markerEnd,r.markerEnd,null,null)),r.markerMid&&(e.parsedStyle.markerMid=this.runtime.CSSPropertySyntaxFactory[""].calculator("",r.markerMid,r.markerMid,null,null)),((e.nodeName===R.CIRCLE||e.nodeName===R.ELLIPSE)&&(!F(r.cx)||!F(r.cy))||(e.nodeName===R.RECT||e.nodeName===R.IMAGE||e.nodeName===R.GROUP||e.nodeName===R.HTML||e.nodeName===R.TEXT||e.nodeName===R.MESH)&&(!F(r.x)||!F(r.y)||!F(r.z))||e.nodeName===R.LINE&&(!F(r.x1)||!F(r.y1)||!F(r.z1)||!F(r.x2)||!F(r.y2)||!F(r.z2)))&&this.runtime.CSSPropertySyntaxFactory[""].postProcessor(e,a),F(r.zIndex)||this.runtime.CSSPropertySyntaxFactory[""].postProcessor(e,a),r.path&&this.runtime.CSSPropertySyntaxFactory[""].postProcessor(e,a),r.points&&this.runtime.CSSPropertySyntaxFactory[""].postProcessor(e,a),F(r.offsetDistance)||this.runtime.CSSPropertySyntaxFactory[""].postProcessor(e,a),r.transform&&this.runtime.CSSPropertySyntaxFactory[""].postProcessor(e,a),l&&this.updateGeometry(e);return}var u=n.skipUpdateAttribute,f=n.skipParse,h=n.forceUpdateGeometry,v=n.usedAttributes,p=h,y=Object.keys(r);y.forEach(function(d){var m;u||(e.attributes[d]=r[d]),!p&&(!((m=fe[d])===null||m===void 0)&&m.l)&&(p=!0)}),f||y.forEach(function(d){e.computedStyle[d]=i.parseProperty(d,e.attributes[d],e)}),v!=null&&v.length&&(y=Array.from(new Set(y.concat(v)))),y.forEach(function(d){d in e.computedStyle&&(e.parsedStyle[d]=i.computeProperty(d,e.computedStyle[d],e))}),p&&this.updateGeometry(e),y.forEach(function(d){d in e.parsedStyle&&i.postProcessProperty(d,e,y)}),this.runtime.enableCSSParsing&&e.children.length&&y.forEach(function(d){d in e.parsedStyle&&i.isPropertyInheritable(d)&&e.children.forEach(function(m){m.internalSetAttribute(d,null,{skipUpdateAttribute:!0,skipParse:!0})})})},t.prototype.parseProperty=function(e,r,n){var i=fe[e],a=r;if((r===""||F(r))&&(r="unset"),r==="unset"||r==="initial"||r==="inherit")a=ii(r);else if(i){var o=i.k,s=i.syntax,l=s&&this.getPropertySyntax(s);o&&o.indexOf(r)>-1?a=ii(r):l&&l.parser&&(a=l.parser(r,n))}return a},t.prototype.computeProperty=function(e,r,n){var i=fe[e],a=n.id==="g-root",o=r;if(i){var s=i.syntax,l=i.inh,c=i.d;if(r instanceof Ct){var u=r.value;if(u==="unset"&&(l&&!a?u="inherit":u="initial"),u==="initial")F(c)||(r=this.parseProperty(e,ze(c)?c(n.nodeName):c,n));else if(u==="inherit"){var f=this.tryToResolveProperty(n,e,{inherited:!0});if(F(f)){this.addUnresolveProperty(n,e);return}else return f}}var h=s&&this.getPropertySyntax(s);if(h&&h.calculator){var v=n.parsedStyle[e];o=h.calculator(e,v,r,n,this.runtime)}else r instanceof Ct?o=r.value:o=r}return o},t.prototype.postProcessProperty=function(e,r,n){var i=fe[e];if(i&&i.syntax){var a=i.syntax&&this.getPropertySyntax(i.syntax),o=a;o&&o.postProcessor&&o.postProcessor(r,n)}},t.prototype.addUnresolveProperty=function(e,r){var n=Ye.get(e);n||(Ye.set(e,[]),n=Ye.get(e)),n.indexOf(r)===-1&&n.push(r)},t.prototype.tryToResolveProperty=function(e,r,n){n===void 0&&(n={});var i=n.inherited;if(i&&e.parentElement&&af(e.parentElement,r)){var a=e.parentElement.parsedStyle[r];return a==="unset"||a==="initial"||a==="inherit"?void 0:a}},t.prototype.recalc=function(e){var r=Ye.get(e);if(r&&r.length){var n={};r.forEach(function(i){n[i]=e.attributes[i]}),this.processProperties(e,n),Ye.delete(e)}},t.prototype.updateGeometry=function(e){var r=e.nodeName,n=this.runtime.geometryUpdaterFactory[r];if(n){var i=e.geometry;i.contentBounds||(i.contentBounds=new ht),i.renderBounds||(i.renderBounds=new ht);var a=e.parsedStyle,o=n.update(a,e),s=o.width,l=o.height,c=o.depth,u=c===void 0?0:c,f=o.offsetX,h=f===void 0?0:f,v=o.offsetY,p=v===void 0?0:v,y=o.offsetZ,d=y===void 0?0:y,m=[Math.abs(s)/2,Math.abs(l)/2,u/2],x=a,M=x.stroke,P=x.lineWidth,E=x.increasedLineWidthForHitTesting,g=x.shadowType,w=x.shadowColor,T=x.filter,b=T===void 0?[]:T,C=x.transformOrigin,S=a.anchor;r===R.TEXT?delete a.anchor:r===R.MESH&&(a.anchor[2]=.5);var N=[(1-(S&&S[0]||0)*2)*s/2+h,(1-(S&&S[1]||0)*2)*l/2+p,(1-(S&&S[2]||0)*2)*m[2]+d];i.contentBounds.update(N,m);var O=r===R.POLYLINE||r===R.POLYGON||r===R.PATH?Math.SQRT2:.5,k=M&&!M.isNone;if(k){var B=((P||0)+(E||0))*O;m[0]+=B,m[1]+=B}if(i.renderBounds.update(N,m),w&&g&&g!=="inner"){var Y=i.renderBounds,I=Y.min,G=Y.max,H=a,ct=H.shadowBlur,rt=H.shadowOffsetX,St=H.shadowOffsetY,Ht=ct||0,$t=rt||0,Kt=St||0,zt=I[0]-Ht+$t,Tr=G[0]+Ht+$t,br=I[1]-Ht+Kt,Cr=G[1]+Ht+Kt;I[0]=Math.min(I[0],zt),G[0]=Math.max(G[0],Tr),I[1]=Math.min(I[1],br),G[1]=Math.max(G[1],Cr),i.renderBounds.setMinMax(I,G)}b.forEach(function(Li){var _i=Li.name,Nr=Li.params;if(_i==="blur"){var Di=Nr[0].value;i.renderBounds.update(i.renderBounds.center,en(i.renderBounds.halfExtents,i.renderBounds.halfExtents,[Di,Di,0]))}else if(_i==="drop-shadow"){var Fi=Nr[0].value,Bi=Nr[1].value,Rr=Nr[2].value,Gi=i.renderBounds,be=Gi.min,Ce=Gi.max,xs=be[0]-Rr+Fi,Es=Ce[0]+Rr+Fi,Ms=be[1]-Rr+Bi,Ps=Ce[1]+Rr+Bi;be[0]=Math.min(be[0],xs),Ce[0]=Math.max(Ce[0],Es),be[1]=Math.min(be[1],Ms),Ce[1]=Math.max(Ce[1],Ps),i.renderBounds.setMinMax(be,Ce)}}),S=a.anchor;var Wt=s<0,Sr=l<0,wn=(Wt?-1:1)*(C?Nt(C[0],0,e):0),Tn=(Sr?-1:1)*(C?Nt(C[1],1,e):0);wn=wn-(Wt?-1:1)*(S&&S[0]||0)*i.contentBounds.halfExtents[0]*2,Tn=Tn-(Sr?-1:1)*(S&&S[1]||0)*i.contentBounds.halfExtents[1]*2,e.setOrigin(wn,Tn),this.runtime.sceneGraphService.dirtifyToRoot(e)}},t.prototype.isPropertyInheritable=function(e){var r=fe[e];return r?r.inh:!1},t}(),sf=function(){function t(){this.parser=Io,this.parserWithCSSDisabled=null,this.mixer=bi}return t.prototype.calculator=function(e,r,n,i){return At(n)},t}(),lf=function(){function t(){}return t.prototype.calculator=function(e,r,n,i,a){return n instanceof Ct&&(n=null),a.sceneGraphService.updateDisplayObjectDependency(e,r,n,i),e==="clipPath"&&i.forEach(function(o){o.childNodes.length===0&&a.sceneGraphService.dirtifyToRoot(o)}),n},t}(),cf=function(){function t(){this.parser=$e,this.parserWithCSSDisabled=$e,this.mixer=_u}return t.prototype.calculator=function(e,r,n,i){return n instanceof Ct?n.value==="none"?ai:Ao:n},t}(),uf=function(){function t(){this.parser=_o}return t.prototype.calculator=function(e,r,n){return n instanceof Ct?[]:n},t}();function wa(t){var e=t.parsedStyle.fontSize;return F(e)?null:e}var Ni=function(){function t(){this.parser=Je,this.parserWithCSSDisabled=null,this.mixer=bi}return t.prototype.calculator=function(e,r,n,i,a){var o;if(ie(n))return n;if(vt.isRelativeUnit(n.unit)){var s=a.styleValueRegistry;if(n.unit===L.kPercentage)return 0;if(n.unit===L.kEms){if(i.parentNode){var l=wa(i.parentNode);if(l)return l*=n.value,l;s.addUnresolveProperty(i,e)}else s.addUnresolveProperty(i,e);return 0}else if(n.unit===L.kRems){if(!((o=i==null?void 0:i.ownerDocument)===null||o===void 0)&&o.documentElement){var l=wa(i.ownerDocument.documentElement);if(l)return l*=n.value,l;s.addUnresolveProperty(i,e)}else s.addUnresolveProperty(i,e);return 0}}else return n.value},t}(),ff=function(){function t(){this.mixer=Fo}return t.prototype.parser=function(e){var r=Lo(ie(e)?[e]:e),n;return r.length===1?n=[r[0],r[0]]:n=[r[0],r[1]],n},t.prototype.calculator=function(e,r,n){return n.map(function(i){return i.value})},t}(),hf=function(){function t(){this.mixer=Fo}return t.prototype.parser=function(e){var r=Lo(ie(e)?[e]:e),n;return r.length===1?n=[r[0],r[0],r[0],r[0]]:r.length===2?n=[r[0],r[1],r[0],r[1]]:r.length===3?n=[r[0],r[1],r[2],r[1]]:n=[r[0],r[1],r[2],r[3]],n},t.prototype.calculator=function(e,r,n){return n.map(function(i){return i.value})},t}(),er=nt();function Ri(t,e){var r=e.parsedStyle.defX||0,n=e.parsedStyle.defY||0;return e.resetLocalTransform(),e.setLocalPosition(r,n),t.forEach(function(i){var a=i.t,o=i.d;if(a==="scale"){var s=(o==null?void 0:o.map(function(x){return x.value}))||[1,1];e.scaleLocal(s[0],s[1],1)}else if(a==="scalex"){var s=(o==null?void 0:o.map(function(M){return M.value}))||[1];e.scaleLocal(s[0],1,1)}else if(a==="scaley"){var s=(o==null?void 0:o.map(function(M){return M.value}))||[1];e.scaleLocal(1,s[0],1)}else if(a==="scalez"){var s=(o==null?void 0:o.map(function(M){return M.value}))||[1];e.scaleLocal(1,1,s[0])}else if(a==="scale3d"){var s=(o==null?void 0:o.map(function(M){return M.value}))||[1,1,1];e.scaleLocal(s[0],s[1],s[2])}else if(a==="translate"){var l=o||[dt,dt];e.translateLocal(l[0].value,l[1].value,0)}else if(a==="translatex"){var l=o||[dt];e.translateLocal(l[0].value,0,0)}else if(a==="translatey"){var l=o||[dt];e.translateLocal(0,l[0].value,0)}else if(a==="translatez"){var l=o||[dt];e.translateLocal(0,0,l[0].value)}else if(a==="translate3d"){var l=o||[dt,dt,dt];e.translateLocal(l[0].value,l[1].value,l[2].value)}else if(a==="rotate"){var c=o||[le];e.rotateLocal(0,0,At(c[0]))}else if(a==="rotatex"){var c=o||[le];e.rotateLocal(At(c[0]),0,0)}else if(a==="rotatey"){var c=o||[le];e.rotateLocal(0,At(c[0]),0)}else if(a==="rotatez"){var c=o||[le];e.rotateLocal(0,0,At(c[0]))}else if(a!=="rotate3d")if(a==="skew"){var u=(o==null?void 0:o.map(function(x){return x.value}))||[0,0];e.setLocalSkew(ut(u[0]),ut(u[1]))}else if(a==="skewx"){var u=(o==null?void 0:o.map(function(M){return M.value}))||[0];e.setLocalSkew(ut(u[0]),e.getLocalSkew()[1])}else if(a==="skewy"){var u=(o==null?void 0:o.map(function(M){return M.value}))||[0];e.setLocalSkew(e.getLocalSkew()[0],ut(u[0]))}else if(a==="matrix"){var f=_(o.map(function(x){return x.value}),6),h=f[0],v=f[1],p=f[2],y=f[3],d=f[4],m=f[5];e.setLocalTransform(qn(er,h,v,0,0,p,y,0,0,0,0,1,0,d+r,m+n,0,1))}else a==="matrix3d"&&(qn.apply(yl,X([er],_(o.map(function(x){return x.value})),!1)),er[12]+=r,er[13]+=n,e.setLocalTransform(er))}),e.getLocalTransform()}var vf=function(t){W(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.postProcessor=function(r,n){var i,a,o;switch(r.nodeName){case R.CIRCLE:case R.ELLIPSE:var s=r.parsedStyle,l=s.cx,c=s.cy,u=s.cz;F(l)||(i=l),F(c)||(a=c),F(u)||(o=u);break;case R.LINE:var f=r.parsedStyle,h=f.x1,v=f.x2,p=f.y1,y=f.y2,d=Math.min(h,v),m=Math.min(p,y);i=d,a=m,o=0;break;case R.RECT:case R.IMAGE:case R.GROUP:case R.HTML:case R.TEXT:case R.MESH:F(r.parsedStyle.x)||(i=r.parsedStyle.x),F(r.parsedStyle.y)||(a=r.parsedStyle.y),F(r.parsedStyle.z)||(o=r.parsedStyle.z);break}r.nodeName!==R.PATH&&r.nodeName!==R.POLYLINE&&r.nodeName!==R.POLYGON&&(r.parsedStyle.defX=i||0,r.parsedStyle.defY=a||0);var x=!F(i)||!F(a)||!F(o);if(x&&n.indexOf("transform")===-1){var M=r.parsedStyle.transform;if(M&&M.length)Ri(M,r);else{var P=_(r.getLocalPosition(),3),E=P[0],g=P[1],w=P[2];r.setLocalPosition(F(i)?E:i,F(a)?g:a,F(o)?w:o)}}},e}(Ni),df=function(){function t(){}return t.prototype.calculator=function(e,r,n,i){n instanceof Ct&&(n=null);var a=n==null?void 0:n.cloneNode(!0);return a&&(a.style.isMarker=!0),a},t}(),pf=function(){function t(){this.mixer=bi,this.parser=Pr,this.parserWithCSSDisabled=null}return t.prototype.calculator=function(e,r,n){return n.value},t}(),yf=function(){function t(){this.parser=Pr,this.parserWithCSSDisabled=null,this.mixer=Ci(0,1)}return t.prototype.calculator=function(e,r,n){return n.value},t.prototype.postProcessor=function(e){var r=e.parsedStyle,n=r.offsetPath,i=r.offsetDistance;if(n){var a=n.nodeName;if(a===R.LINE||a===R.PATH||a===R.POLYLINE){var o=n.getPoint(i);o&&(e.parsedStyle.defX=o.x,e.parsedStyle.defY=o.y,e.setLocalPosition(o.x,o.y))}}},t}(),gf=function(){function t(){this.parser=Pr,this.parserWithCSSDisabled=null,this.mixer=Ci(0,1)}return t.prototype.calculator=function(e,r,n){return n.value},t}(),mf=function(){function t(){this.parser=ci,this.parserWithCSSDisabled=ci,this.mixer=qu}return t.prototype.calculator=function(e,r,n){return n instanceof Ct&&n.value==="unset"?{absolutePath:[],hasArc:!1,segments:[],polygons:[],polylines:[],curve:null,totalLength:0,rect:new ke(0,0,0,0)}:n},t.prototype.postProcessor=function(e,r){if(e.parsedStyle.defX=e.parsedStyle.path.rect.x,e.parsedStyle.defY=e.parsedStyle.path.rect.y,e.nodeName===R.PATH&&r.indexOf("transform")===-1){var n=e.parsedStyle,i=n.defX,a=i===void 0?0:i,o=n.defY,s=o===void 0?0:o;e.setLocalPosition(a,s)}},t}(),xf=function(){function t(){this.parser=Go,this.mixer=$u}return t.prototype.postProcessor=function(e,r){if((e.nodeName===R.POLYGON||e.nodeName===R.POLYLINE)&&r.indexOf("transform")===-1){var n=e.parsedStyle,i=n.defX,a=n.defY;e.setLocalPosition(i,a)}},t}(),Ef=function(t){W(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.mixer=Ci(0,1/0),r}return e}(Ni),Mf=function(){function t(){}return t.prototype.calculator=function(e,r,n,i){return n instanceof Ct?n.value==="unset"?"":n.value:"".concat(n)},t.prototype.postProcessor=function(e){e.nodeValue="".concat(e.parsedStyle.text)||""},t}(),Pf=function(){function t(){}return t.prototype.calculator=function(e,r,n,i){var a=i.getAttribute("text");if(a){var o=a;n.value==="capitalize"?o=a.charAt(0).toUpperCase()+a.slice(1):n.value==="lowercase"?o=a.toLowerCase():n.value==="uppercase"&&(o=a.toUpperCase()),i.parsedStyle.text=o}return n.value},t}(),Gn={},wf=0;function Tf(t,e){if(t){var r=typeof t=="string"?t:t.id||wf++;Gn[r]&&Gn[r].destroy(),Gn[r]=e}}var wr=typeof window<"u"&&typeof window.document<"u";function bf(t){return!!t.getAttribute}function Cf(t,e){for(var r=0,n=t.length;r>>1;Yo(t[i],e)<0?r=i+1:n=i}return r}function Yo(t,e){var r=Number(t.parsedStyle.zIndex),n=Number(e.parsedStyle.zIndex);if(r===n){var i=t.parentNode;if(i){var a=i.childNodes||[];return a.indexOf(t)-a.indexOf(e)}}return r-n}function Ho(t){var e,r=t;do{var n=(e=r.parsedStyle)===null||e===void 0?void 0:e.clipPath;if(n)return r;r=r.parentElement}while(r!==null);return null}var Ta="px";function Sf(t,e,r){wr&&t.style&&(t.style.width=e+Ta,t.style.height=r+Ta)}function zo(t,e){if(wr)return document.defaultView.getComputedStyle(t,null).getPropertyValue(e)}function Nf(t){var e=zo(t,"width");return e==="auto"?t.offsetWidth:parseFloat(e)}function Rf(t){var e=zo(t,"height");return e==="auto"?t.offsetHeight:parseFloat(e)}var Af=1,Of={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},fi=typeof performance=="object"&&performance.now?performance:Date;function _e(t,e,r){var n=!1,i=!1,a=!!e&&!e.isNone,o=!!r&&!r.isNone;return t==="visiblepainted"||t==="painted"||t==="auto"?(n=a,i=o):t==="visiblefill"||t==="fill"?n=!0:t==="visiblestroke"||t==="stroke"?i=!0:(t==="visible"||t==="all")&&(n=!0,i=!0),[n,i]}var kf=1,If=function(){return kf++},ne=typeof self=="object"&&self.self==self?self:typeof global=="object"&&global.global==global?global:{},Lf=Date.now(),_f=function(){return ne.performance&&typeof ne.performance.now=="function"?ne.performance.now():Date.now()-Lf},ar={},ba=Date.now(),Df=function(t){if(typeof t!="function")throw new TypeError(t+" is not a function");var e=Date.now(),r=e-ba,n=r>16?0:16-r,i=If();return ar[i]=t,Object.keys(ar).length>1||setTimeout(function(){ba=e;var a=ar;ar={},Object.keys(a).forEach(function(o){return a[o](_f())})},n),i},Ff=function(t){delete ar[t]},Bf=["","webkit","moz","ms","o"],Wo=function(t){return typeof t!="string"?Df:t===""?ne.requestAnimationFrame:ne[t+"RequestAnimationFrame"]},Gf=function(t){return typeof t!="string"?Ff:t===""?ne.cancelAnimationFrame:ne[t+"CancelAnimationFrame"]||ne[t+"CancelRequestAnimationFrame"]},Uf=function(t,e){for(var r=0;t[r]!==void 0;){if(e(t[r]))return t[r];r=r+1}},Xo=Uf(Bf,function(t){return!!Wo(t)}),Vo=Wo(Xo),qo=Gf(Xo);ne.requestAnimationFrame=Vo;ne.cancelAnimationFrame=qo;var Yf=function(){function t(){this.callbacks=[]}return t.prototype.getCallbacksNum=function(){return this.callbacks.length},t.prototype.tapPromise=function(e,r){this.callbacks.push(r)},t.prototype.promise=function(){for(var e=[],r=0;r=0;l--){var c=s[l].trim();!Wf.test(c)&&zf.indexOf(c)<0&&(c='"'.concat(c,'"')),s[l]=c}return"".concat(n," ").concat(i," ").concat(a," ").concat(o," ").concat(s.join(","))}var Vf=function(){function t(){this.parser=hn,this.parserWithCSSDisabled=hn,this.mixer=nf}return t.prototype.calculator=function(e,r,n,i){return n instanceof Ct?[]:n},t.prototype.postProcessor=function(e){var r=e.parsedStyle.transform;Ri(r,e)},t}(),qf=function(){function t(){this.parser=Uo}return t}(),$f=function(){function t(){this.parser=Pr}return t.prototype.calculator=function(e,r,n,i){return n.value},t.prototype.postProcessor=function(e){if(e.parentNode){var r=e.parentNode,n=r.renderable,i=r.sortable;n&&(n.dirty=!0),i&&(i.dirty=!0,i.dirtyReason=Qe.Z_INDEX_CHANGED)}},t}(),Kf=function(){function t(){}return t.prototype.update=function(e,r){var n=e.r,i=n*2,a=n*2;return{width:i,height:a}},t}(),Zf=function(){function t(){}return t.prototype.update=function(e,r){var n=e.rx,i=e.ry,a=n*2,o=i*2;return{width:a,height:o}},t}(),Qf=function(){function t(){}return t.prototype.update=function(e){var r=e.x1,n=e.y1,i=e.x2,a=e.y2,o=Math.min(r,i),s=Math.max(r,i),l=Math.min(n,a),c=Math.max(n,a),u=s-o,f=c-l;return{width:u,height:f}},t}(),Jf=function(){function t(){}return t.prototype.update=function(e){var r=e.path,n=r.rect,i=n.width,a=n.height;return{width:i,height:a}},t}(),jf=function(){function t(){}return t.prototype.update=function(e){if(e.points&&Mi(e.points.points)){var r=e.points.points,n=Math.min.apply(Math,X([],_(r.map(function(c){return c[0]})),!1)),i=Math.max.apply(Math,X([],_(r.map(function(c){return c[0]})),!1)),a=Math.min.apply(Math,X([],_(r.map(function(c){return c[1]})),!1)),o=Math.max.apply(Math,X([],_(r.map(function(c){return c[1]})),!1)),s=i-n,l=o-a;return{width:s,height:l}}return{width:0,height:0}},t}(),th=function(){function t(){}return t.prototype.update=function(e,r){var n=e.img,i=e.width,a=i===void 0?0:i,o=e.height,s=o===void 0?0:o,l=a,c=s;return n&&!bt(n)&&(l||(l=n.width,e.width=l),c||(c=n.height,e.height=c)),{width:l,height:c}},t}(),eh=function(){function t(e){this.globalRuntime=e}return t.prototype.isReadyToMeasure=function(e,r){var n=e.text,i=e.textAlign,a=e.textBaseline,o=e.fontSize,s=e.fontStyle,l=e.fontWeight,c=e.fontVariant,u=e.lineWidth;return n&&o&&s&&l&&c&&i&&a&&!F(u)},t.prototype.update=function(e,r){var n,i,a=e.text,o=e.textAlign,s=e.lineWidth,l=e.textBaseline,c=e.dx,u=e.dy;if(!this.isReadyToMeasure(e,r))return e.metrics={font:"",width:0,height:0,lines:[],lineWidths:[],lineHeight:0,maxLineWidth:0,fontProperties:{ascent:0,descent:0,fontSize:0},lineMetrics:[]},{width:0,height:0,x:0,y:0,offsetX:0,offsetY:0};var f=(((i=(n=r==null?void 0:r.ownerDocument)===null||n===void 0?void 0:n.defaultView)===null||i===void 0?void 0:i.getConfig())||{}).offscreenCanvas,h=this.globalRuntime.textService.measureText(a,e,f);e.metrics=h;var v=h.width,p=h.height,y=h.lineHeight,d=h.fontProperties,m=[v/2,p/2,0],x=[0,1],M=0;o==="center"||o==="middle"?(M=s/2,x=[.5,1]):(o==="right"||o==="end")&&(M=s,x=[1,1]);var P=0;return l==="middle"?P=m[1]:l==="top"||l==="hanging"?P=m[1]*2:l==="alphabetic"?P=this.globalRuntime.enableCSSParsing?y-d.ascent:0:(l==="bottom"||l==="ideographic")&&(P=0),c&&(M+=c),u&&(P+=u),e.anchor=[x[0],x[1],0],{width:m[0]*2,height:m[1]*2,offsetX:M,offsetY:P}},t}();function rh(t){return!!t.type}var xn=function(){function t(e){this.eventPhase=t.prototype.NONE,this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.defaultPrevented=!1,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new pt,this.page=new pt,this.canvas=new pt,this.viewport=new pt,this.composed=!1,this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=e}return Object.defineProperty(t.prototype,"name",{get:function(){return this.type},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"layerX",{get:function(){return this.layer.x},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"layerY",{get:function(){return this.layer.y},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pageX",{get:function(){return this.page.x},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pageY",{get:function(){return this.page.y},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"x",{get:function(){return this.canvas.x},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"y",{get:function(){return this.canvas.y},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"canvasX",{get:function(){return this.canvas.x},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"canvasY",{get:function(){return this.canvas.y},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"viewportX",{get:function(){return this.viewport.x},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"viewportY",{get:function(){return this.viewport.y},enumerable:!1,configurable:!0}),t.prototype.composedPath=function(){return this.manager&&(!this.path||this.path[0]!==this.target)&&(this.path=this.target?this.manager.propagationPath(this.target):[]),this.path},Object.defineProperty(t.prototype,"propagationPath",{get:function(){return this.composedPath()},enumerable:!1,configurable:!0}),t.prototype.preventDefault=function(){this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault(),this.defaultPrevented=!0},t.prototype.stopImmediatePropagation=function(){this.propagationImmediatelyStopped=!0},t.prototype.stopPropagation=function(){this.propagationStopped=!0},t.prototype.initEvent=function(){},t.prototype.initUIEvent=function(){},t.prototype.clone=function(){throw new Error(J)},t}(),$o=function(t){W(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.client=new pt,r.movement=new pt,r.offset=new pt,r.global=new pt,r.screen=new pt,r}return Object.defineProperty(e.prototype,"clientX",{get:function(){return this.client.x},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"clientY",{get:function(){return this.client.y},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"movementX",{get:function(){return this.movement.x},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"movementY",{get:function(){return this.movement.y},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"offsetX",{get:function(){return this.offset.x},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"offsetY",{get:function(){return this.offset.y},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"globalX",{get:function(){return this.global.x},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"globalY",{get:function(){return this.global.y},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"screenX",{get:function(){return this.screen.x},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"screenY",{get:function(){return this.screen.y},enumerable:!1,configurable:!0}),e.prototype.getModifierState=function(r){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(r)},e.prototype.initMouseEvent=function(){throw new Error(J)},e}(xn),hi=function(t){W(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.width=0,r.height=0,r.isPrimary=!1,r}return e.prototype.getCoalescedEvents=function(){return this.type==="pointermove"||this.type==="mousemove"||this.type==="touchmove"?[this]:[]},e.prototype.getPredictedEvents=function(){throw new Error("getPredictedEvents is not supported!")},e.prototype.clone=function(){return this.manager.clonePointerEvent(this)},e}($o),vi=function(t){W(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.clone=function(){return this.manager.cloneWheelEvent(this)},e}($o),mt=function(t){W(e,t);function e(r,n){var i=t.call(this,null)||this;return i.type=r,i.detail=n,Object.assign(i,n),i}return e}(xn),Ca=":",Ko=function(){function t(){this.emitter=new Ei}return t.prototype.on=function(e,r,n){return this.addEventListener(e,r,n),this},t.prototype.addEventListener=function(e,r,n){var i=Vi(n)&&n||jr(n)&&n.capture,a=jr(n)&&n.once,o=ze(r)?void 0:r,s=!1,l="";if(e.indexOf(Ca)>-1){var c=_(e.split(Ca),2),u=c[0],f=c[1];e=f,l=u,s=!0}if(e=i?"".concat(e,"capture"):e,r=ze(r)?r:r.handleEvent,s){var h=r;r=function(){for(var v,p=[],y=0;y0},e.prototype.isDefaultNamespace=function(r){throw new Error(J)},e.prototype.lookupNamespaceURI=function(r){throw new Error(J)},e.prototype.lookupPrefix=function(r){throw new Error(J)},e.prototype.normalize=function(){throw new Error(J)},e.prototype.isEqualNode=function(r){return this===r},e.prototype.isSameNode=function(r){return this.isEqualNode(r)},Object.defineProperty(e.prototype,"parent",{get:function(){return this.parentNode},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"parentElement",{get:function(){return null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"nextSibling",{get:function(){return null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"previousSibling",{get:function(){return null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"firstChild",{get:function(){return this.childNodes.length>0?this.childNodes[0]:null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lastChild",{get:function(){return this.childNodes.length>0?this.childNodes[this.childNodes.length-1]:null},enumerable:!1,configurable:!0}),e.prototype.compareDocumentPosition=function(r){var n;if(r===this)return 0;for(var i=r,a=this,o=[i],s=[a];(n=i.parentNode)!==null&&n!==void 0?n:a.parentNode;)i=i.parentNode?(o.push(i.parentNode),i.parentNode):i,a=a.parentNode?(s.push(a.parentNode),a.parentNode):a;if(i!==a)return e.DOCUMENT_POSITION_DISCONNECTED|e.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC|e.DOCUMENT_POSITION_PRECEDING;var l=o.length>s.length?o:s,c=l===o?s:o;if(l[l.length-c.length]===c[0])return l===o?e.DOCUMENT_POSITION_CONTAINED_BY|e.DOCUMENT_POSITION_FOLLOWING:e.DOCUMENT_POSITION_CONTAINS|e.DOCUMENT_POSITION_PRECEDING;for(var u=l.length-c.length,f=c.length-1;f>=0;f--){var h=c[f],v=l[u+f];if(v!==h){var p=h.parentNode.childNodes;return p.indexOf(h)0&&n;)n=n.parentNode,r--;return n},e.prototype.forEach=function(r,n){n===void 0&&(n=!1),r(this)||(n?this.childNodes.slice():this.childNodes).forEach(function(i){i.forEach(r)})},e.DOCUMENT_POSITION_DISCONNECTED=1,e.DOCUMENT_POSITION_PRECEDING=2,e.DOCUMENT_POSITION_FOLLOWING=4,e.DOCUMENT_POSITION_CONTAINS=8,e.DOCUMENT_POSITION_CONTAINED_BY=16,e.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC=32,e}(Ko),nh=2048,ih=function(){function t(e,r){var n=this;this.globalRuntime=e,this.context=r,this.emitter=new Ei,this.cursor="default",this.mappingTable={},this.mappingState={trackingData:{}},this.eventPool=new Map,this.tmpMatrix=nt(),this.tmpVec3=q(),this.onPointerDown=function(i){var a=n.createPointerEvent(i);if(n.dispatchEvent(a,"pointerdown"),a.pointerType==="touch")n.dispatchEvent(a,"touchstart");else if(a.pointerType==="mouse"||a.pointerType==="pen"){var o=a.button===2;n.dispatchEvent(a,o?"rightdown":"mousedown")}var s=n.trackingData(i.pointerId);s.pressTargetsByButton[i.button]=a.composedPath(),n.freeEvent(a)},this.onPointerUp=function(i){var a,o=fi.now(),s=n.createPointerEvent(i,void 0,void 0,n.context.config.alwaysTriggerPointerEventOnCanvas?n.rootTarget:void 0);if(n.dispatchEvent(s,"pointerup"),s.pointerType==="touch")n.dispatchEvent(s,"touchend");else if(s.pointerType==="mouse"||s.pointerType==="pen"){var l=s.button===2;n.dispatchEvent(s,l?"rightup":"mouseup")}var c=n.trackingData(i.pointerId),u=n.findMountedTarget(c.pressTargetsByButton[i.button]),f=u;if(u&&!s.composedPath().includes(u)){for(var h=u;h&&!s.composedPath().includes(h);){if(s.currentTarget=h,n.notifyTarget(s,"pointerupoutside"),s.pointerType==="touch")n.notifyTarget(s,"touchendoutside");else if(s.pointerType==="mouse"||s.pointerType==="pen"){var l=s.button===2;n.notifyTarget(s,l?"rightupoutside":"mouseupoutside")}yt.isNode(h)&&(h=h.parentNode)}delete c.pressTargetsByButton[i.button],f=h}if(f){var v=n.clonePointerEvent(s,"click");v.target=f,v.path=[],c.clicksByButton[i.button]||(c.clicksByButton[i.button]={clickCount:0,target:v.target,timeStamp:o});var p=c.clicksByButton[i.button];p.target===v.target&&o-p.timeStamp<200?++p.clickCount:p.clickCount=1,p.target=v.target,p.timeStamp=o,v.detail=p.clickCount,!((a=s.detail)===null||a===void 0)&&a.preventClick||(!n.context.config.useNativeClickEvent&&(v.pointerType==="mouse"||v.pointerType==="touch")&&n.dispatchEvent(v,"click"),n.dispatchEvent(v,"pointertap")),n.freeEvent(v)}n.freeEvent(s)},this.onPointerMove=function(i){var a=n.createPointerEvent(i,void 0,void 0,n.context.config.alwaysTriggerPointerEventOnCanvas?n.rootTarget:void 0),o=a.pointerType==="mouse"||a.pointerType==="pen",s=n.trackingData(i.pointerId),l=n.findMountedTarget(s.overTargets);if(s.overTargets&&l!==a.target){var c=i.type==="mousemove"?"mouseout":"pointerout",u=n.createPointerEvent(i,c,l||void 0);if(n.dispatchEvent(u,"pointerout"),o&&n.dispatchEvent(u,"mouseout"),!a.composedPath().includes(l)){var f=n.createPointerEvent(i,"pointerleave",l||void 0);for(f.eventPhase=f.AT_TARGET;f.target&&!a.composedPath().includes(f.target);)f.currentTarget=f.target,n.notifyTarget(f),o&&n.notifyTarget(f,"mouseleave"),yt.isNode(f.target)&&(f.target=f.target.parentNode);n.freeEvent(f)}n.freeEvent(u)}if(l!==a.target){var h=i.type==="mousemove"?"mouseover":"pointerover",v=n.clonePointerEvent(a,h);n.dispatchEvent(v,"pointerover"),o&&n.dispatchEvent(v,"mouseover");for(var p=l&&yt.isNode(l)&&l.parentNode;p&&p!==(yt.isNode(n.rootTarget)&&n.rootTarget.parentNode)&&p!==a.target;)p=p.parentNode;var y=!p||p===(yt.isNode(n.rootTarget)&&n.rootTarget.parentNode);if(y){var d=n.clonePointerEvent(a,"pointerenter");for(d.eventPhase=d.AT_TARGET;d.target&&d.target!==l&&d.target!==(yt.isNode(n.rootTarget)&&n.rootTarget.parentNode);)d.currentTarget=d.target,n.notifyTarget(d),o&&n.notifyTarget(d,"mouseenter"),yt.isNode(d.target)&&(d.target=d.target.parentNode);n.freeEvent(d)}n.freeEvent(v)}n.dispatchEvent(a,"pointermove"),a.pointerType==="touch"&&n.dispatchEvent(a,"touchmove"),o&&(n.dispatchEvent(a,"mousemove"),n.cursor=n.getCursor(a.target)),s.overTargets=a.composedPath(),n.freeEvent(a)},this.onPointerOut=function(i){var a=n.trackingData(i.pointerId);if(a.overTargets){var o=i.pointerType==="mouse"||i.pointerType==="pen",s=n.findMountedTarget(a.overTargets),l=n.createPointerEvent(i,"pointerout",s||void 0);n.dispatchEvent(l),o&&n.dispatchEvent(l,"mouseout");var c=n.createPointerEvent(i,"pointerleave",s||void 0);for(c.eventPhase=c.AT_TARGET;c.target&&c.target!==(yt.isNode(n.rootTarget)&&n.rootTarget.parentNode);)c.currentTarget=c.target,n.notifyTarget(c),o&&n.notifyTarget(c,"mouseleave"),yt.isNode(c.target)&&(c.target=c.target.parentNode);a.overTargets=null,n.freeEvent(l),n.freeEvent(c)}n.cursor=null},this.onPointerOver=function(i){var a=n.trackingData(i.pointerId),o=n.createPointerEvent(i),s=o.pointerType==="mouse"||o.pointerType==="pen";n.dispatchEvent(o,"pointerover"),s&&n.dispatchEvent(o,"mouseover"),o.pointerType==="mouse"&&(n.cursor=n.getCursor(o.target));var l=n.clonePointerEvent(o,"pointerenter");for(l.eventPhase=l.AT_TARGET;l.target&&l.target!==(yt.isNode(n.rootTarget)&&n.rootTarget.parentNode);)l.currentTarget=l.target,n.notifyTarget(l),s&&n.notifyTarget(l,"mouseenter"),yt.isNode(l.target)&&(l.target=l.target.parentNode);a.overTargets=o.composedPath(),n.freeEvent(o),n.freeEvent(l)},this.onPointerUpOutside=function(i){var a=n.trackingData(i.pointerId),o=n.findMountedTarget(a.pressTargetsByButton[i.button]),s=n.createPointerEvent(i);if(o){for(var l=o;l;)s.currentTarget=l,n.notifyTarget(s,"pointerupoutside"),s.pointerType==="touch"||(s.pointerType==="mouse"||s.pointerType==="pen")&&n.notifyTarget(s,s.button===2?"rightupoutside":"mouseupoutside"),yt.isNode(l)&&(l=l.parentNode);delete a.pressTargetsByButton[i.button]}n.freeEvent(s)},this.onWheel=function(i){var a=n.createWheelEvent(i);n.dispatchEvent(a),n.freeEvent(a)},this.onClick=function(i){if(n.context.config.useNativeClickEvent){var a=n.createPointerEvent(i);n.dispatchEvent(a),n.freeEvent(a)}},this.onPointerCancel=function(i){var a=n.createPointerEvent(i,void 0,void 0,n.context.config.alwaysTriggerPointerEventOnCanvas?n.rootTarget:void 0);n.dispatchEvent(a),n.freeEvent(a)}}return t.prototype.init=function(){this.rootTarget=this.context.renderingContext.root.parentNode,this.addEventMapping("pointerdown",this.onPointerDown),this.addEventMapping("pointerup",this.onPointerUp),this.addEventMapping("pointermove",this.onPointerMove),this.addEventMapping("pointerout",this.onPointerOut),this.addEventMapping("pointerleave",this.onPointerOut),this.addEventMapping("pointercancel",this.onPointerCancel),this.addEventMapping("pointerover",this.onPointerOver),this.addEventMapping("pointerupoutside",this.onPointerUpOutside),this.addEventMapping("wheel",this.onWheel),this.addEventMapping("click",this.onClick)},t.prototype.destroy=function(){this.emitter.removeAllListeners(),this.mappingTable={},this.mappingState={},this.eventPool.clear()},t.prototype.client2Viewport=function(e){var r=this.context.contextService.getBoundingClientRect();return new pt(e.x-((r==null?void 0:r.left)||0),e.y-((r==null?void 0:r.top)||0))},t.prototype.viewport2Client=function(e){var r=this.context.contextService.getBoundingClientRect();return new pt(e.x+((r==null?void 0:r.left)||0),e.y+((r==null?void 0:r.top)||0))},t.prototype.viewport2Canvas=function(e){var r=e.x,n=e.y,i=this.rootTarget.defaultView,a=i.getCamera(),o=this.context.config,s=o.width,l=o.height,c=a.getPerspectiveInverse(),u=a.getWorldTransform(),f=Et(this.tmpMatrix,u,c),h=qt(this.tmpVec3,r/s*2-1,(1-n/l)*2-1,0);return Ut(h,h,f),new pt(h[0],h[1])},t.prototype.canvas2Viewport=function(e){var r=this.rootTarget.defaultView,n=r.getCamera(),i=n.getPerspective(),a=n.getViewTransform(),o=Et(this.tmpMatrix,i,a),s=qt(this.tmpVec3,e.x,e.y,0);Ut(this.tmpVec3,this.tmpVec3,o);var l=this.context.config,c=l.width,u=l.height;return new pt((s[0]+1)/2*c,(1-(s[1]+1)/2)*u)},t.prototype.setPickHandler=function(e){this.pickHandler=e},t.prototype.addEventMapping=function(e,r){this.mappingTable[e]||(this.mappingTable[e]=[]),this.mappingTable[e].push({fn:r,priority:0}),this.mappingTable[e].sort(function(n,i){return n.priority-i.priority})},t.prototype.mapEvent=function(e){if(this.rootTarget){var r=this.mappingTable[e.type];if(r)for(var n=0,i=r.length;n=1;i--)if(e.currentTarget=n[i],this.notifyTarget(e,r),e.propagationStopped||e.propagationImmediatelyStopped)return;if(e.eventPhase=e.AT_TARGET,e.currentTarget=e.target,this.notifyTarget(e,r),!(e.propagationStopped||e.propagationImmediatelyStopped)){var a=n.indexOf(e.currentTarget);e.eventPhase=e.BUBBLING_PHASE;for(var i=a+1;ia||n>o?null:!s&&this.pickHandler(e)||this.rootTarget||null},t.prototype.isNativeEventFromCanvas=function(e){var r,n=this.context.contextService.getDomElement(),i=(r=e.nativeEvent)===null||r===void 0?void 0:r.target;if(i){if(i===n)return!0;if(n&&n.contains)return n.contains(i)}return e.nativeEvent.composedPath?e.nativeEvent.composedPath().indexOf(n)>-1:!1},t.prototype.getExistedHTML=function(e){var r,n;if(e.nativeEvent.composedPath)try{for(var i=de(e.nativeEvent.composedPath()),a=i.next();!a.done;a=i.next()){var o=a.value,s=this.globalRuntime.nativeHTMLMap.get(o);if(s)return s}}catch(l){r={error:l}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return null},t.prototype.pickTarget=function(e){return this.hitTest({clientX:e.clientX,clientY:e.clientY,viewportX:e.viewportX,viewportY:e.viewportY,x:e.canvasX,y:e.canvasY})},t.prototype.createPointerEvent=function(e,r,n,i){var a=this.allocateEvent(hi);this.copyPointerData(e,a),this.copyMouseData(e,a),this.copyData(e,a),a.nativeEvent=e.nativeEvent,a.originalEvent=e;var o=this.getExistedHTML(a);return a.target=n??(o||this.isNativeEventFromCanvas(a)&&this.pickTarget(a)||i),typeof r=="string"&&(a.type=r),a},t.prototype.createWheelEvent=function(e){var r=this.allocateEvent(vi);this.copyWheelData(e,r),this.copyMouseData(e,r),this.copyData(e,r),r.nativeEvent=e.nativeEvent,r.originalEvent=e;var n=this.getExistedHTML(r);return r.target=n||this.isNativeEventFromCanvas(r)&&this.pickTarget(r),r},t.prototype.trackingData=function(e){return this.mappingState.trackingData[e]||(this.mappingState.trackingData[e]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[e]},t.prototype.cloneWheelEvent=function(e){var r=this.allocateEvent(vi);return r.nativeEvent=e.nativeEvent,r.originalEvent=e.originalEvent,this.copyWheelData(e,r),this.copyMouseData(e,r),this.copyData(e,r),r.target=e.target,r.path=e.composedPath().slice(),r.type=e.type,r},t.prototype.clonePointerEvent=function(e,r){var n=this.allocateEvent(hi);return n.nativeEvent=e.nativeEvent,n.originalEvent=e.originalEvent,this.copyPointerData(e,n),this.copyMouseData(e,n),this.copyData(e,n),n.target=e.target,n.path=e.composedPath().slice(),n.type=r??n.type,n},t.prototype.copyPointerData=function(e,r){r.pointerId=e.pointerId,r.width=e.width,r.height=e.height,r.isPrimary=e.isPrimary,r.pointerType=e.pointerType,r.pressure=e.pressure,r.tangentialPressure=e.tangentialPressure,r.tiltX=e.tiltX,r.tiltY=e.tiltY,r.twist=e.twist},t.prototype.copyMouseData=function(e,r){r.altKey=e.altKey,r.button=e.button,r.buttons=e.buttons,r.ctrlKey=e.ctrlKey,r.metaKey=e.metaKey,r.shiftKey=e.shiftKey,r.client.copyFrom(e.client),r.movement.copyFrom(e.movement),r.canvas.copyFrom(e.canvas),r.screen.copyFrom(e.screen),r.global.copyFrom(e.global),r.offset.copyFrom(e.offset)},t.prototype.copyWheelData=function(e,r){r.deltaMode=e.deltaMode,r.deltaX=e.deltaX,r.deltaY=e.deltaY,r.deltaZ=e.deltaZ},t.prototype.copyData=function(e,r){r.isTrusted=e.isTrusted,r.timeStamp=fi.now(),r.type=e.type,r.detail=e.detail,r.view=e.view,r.page.copyFrom(e.page),r.viewport.copyFrom(e.viewport)},t.prototype.allocateEvent=function(e){this.eventPool.has(e)||this.eventPool.set(e,[]);var r=this.eventPool.get(e).pop()||new e(this);return r.eventPhase=r.NONE,r.currentTarget=null,r.path=[],r.target=null,r},t.prototype.freeEvent=function(e){if(e.manager!==this)throw new Error("It is illegal to free an event not managed by this EventBoundary!");var r=e.constructor;this.eventPool.has(r)||this.eventPool.set(r,[]),this.eventPool.get(r).push(e)},t.prototype.notifyTarget=function(e,r){r=r??e.type;var n=e.eventPhase===e.CAPTURING_PHASE||e.eventPhase===e.AT_TARGET?"".concat(r,"capture"):r;this.notifyListeners(e,n),e.eventPhase===e.AT_TARGET&&this.notifyListeners(e,r)},t.prototype.notifyListeners=function(e,r){var n=e.currentTarget.emitter,i=n._events[r];if(i)if("fn"in i)i.once&&n.removeListener(r,i.fn,void 0,!0),i.fn.call(e.currentTarget||i.context,e);else for(var a=0;a=0;n--){var i=e[n];if(i===this.rootTarget||yt.isNode(i)&&i.parentNode===r)r=e[n];else break}return r},t.prototype.getCursor=function(e){for(var r=e;r;){var n=bf(r)&&r.getAttribute("cursor");if(n)return n;r=yt.isNode(r)&&r.parentNode}},t}(),ah=function(){function t(){}return t.prototype.getOrCreateCanvas=function(e,r){if(this.canvas)return this.canvas;if(e||A.offscreenCanvas)this.canvas=e||A.offscreenCanvas,this.context=this.canvas.getContext("2d",r);else try{this.canvas=new window.OffscreenCanvas(0,0),this.context=this.canvas.getContext("2d",r),(!this.context||!this.context.measureText)&&(this.canvas=document.createElement("canvas"),this.context=this.canvas.getContext("2d"))}catch{this.canvas=document.createElement("canvas"),this.context=this.canvas.getContext("2d",r)}return this.canvas.width=10,this.canvas.height=10,this.canvas},t.prototype.getOrCreateContext=function(e,r){return this.context?this.context:(this.getOrCreateCanvas(e,r),this.context)},t}(),ge;(function(t){t[t.CAMERA_CHANGED=0]="CAMERA_CHANGED",t[t.DISPLAY_OBJECT_CHANGED=1]="DISPLAY_OBJECT_CHANGED",t[t.NONE=2]="NONE"})(ge||(ge={}));var oh=function(){function t(e,r){this.globalRuntime=e,this.context=r,this.inited=!1,this.stats={total:0,rendered:0},this.zIndexCounter=0,this.hooks={init:new xt,initAsync:new Yf,dirtycheck:new Un,cull:new Un,beginFrame:new xt,beforeRender:new xt,render:new xt,afterRender:new xt,endFrame:new xt,destroy:new xt,pick:new Hf,pickSync:new Un,pointerDown:new xt,pointerUp:new xt,pointerMove:new xt,pointerOut:new xt,pointerOver:new xt,pointerWheel:new xt,pointerCancel:new xt,click:new xt}}return t.prototype.init=function(e){var r=this,n=U(U({},this.globalRuntime),this.context);this.context.renderingPlugins.forEach(function(i){i.apply(n,r.globalRuntime)}),this.hooks.init.call(),this.hooks.initAsync.getCallbacksNum()===0?(this.inited=!0,e()):this.hooks.initAsync.promise().then(function(){r.inited=!0,e()})},t.prototype.getStats=function(){return this.stats},t.prototype.disableDirtyRectangleRendering=function(){var e=this.context.config.renderer,r=e.getConfig().enableDirtyRectangleRendering;return!r||this.context.renderingContext.renderReasons.has(ge.CAMERA_CHANGED)},t.prototype.render=function(e,r){var n=this;this.stats.total=0,this.stats.rendered=0,this.zIndexCounter=0;var i=this.context.renderingContext;if(this.globalRuntime.sceneGraphService.syncHierarchy(i.root),this.globalRuntime.sceneGraphService.triggerPendingEvents(),i.renderReasons.size&&this.inited){i.dirtyRectangleRenderingDisabled=this.disableDirtyRectangleRendering();var a=i.renderReasons.size===1&&i.renderReasons.has(ge.CAMERA_CHANGED),o=!e.disableRenderHooks||!(e.disableRenderHooks&&a);o&&this.renderDisplayObject(i.root,e,i),this.hooks.beginFrame.call(),o&&i.renderListCurrentFrame.forEach(function(s){n.hooks.beforeRender.call(s),n.hooks.render.call(s),n.hooks.afterRender.call(s)}),this.hooks.endFrame.call(),i.renderListCurrentFrame=[],i.renderReasons.clear(),r()}},t.prototype.renderDisplayObject=function(e,r,n){var i=this,a=r.renderer.getConfig(),o=a.enableDirtyCheck,s=a.enableCulling;this.globalRuntime.enableCSSParsing&&this.globalRuntime.styleValueRegistry.recalc(e);var l=e.renderable,c=o?l.dirty||n.dirtyRectangleRenderingDisabled?e:null:e;if(c){var u=s?this.hooks.cull.call(c,this.context.camera):c;u&&(this.stats.rendered++,n.renderListCurrentFrame.push(u))}e.renderable.dirty=!1,e.sortable.renderOrder=this.zIndexCounter++,this.stats.total++;var f=e.sortable;f.dirty&&(this.sort(e,f),f.dirty=!1,f.dirtyChildren=[],f.dirtyReason=void 0),(f.sorted||e.childNodes).forEach(function(h){i.renderDisplayObject(h,r,n)})},t.prototype.sort=function(e,r){r.sorted&&r.dirtyReason!==Qe.Z_INDEX_CHANGED?r.dirtyChildren.forEach(function(n){var i=e.childNodes.indexOf(n);if(i===-1){var a=r.sorted.indexOf(n);a>=0&&r.sorted.splice(a,1)}else if(r.sorted.length===0)r.sorted.push(n);else{var o=Cf(r.sorted,n);r.sorted.splice(o,0,n)}}):r.sorted=e.childNodes.slice().sort(Yo)},t.prototype.destroy=function(){this.inited=!1,this.hooks.destroy.call(),this.globalRuntime.sceneGraphService.clearPendingEvents()},t.prototype.dirtify=function(){this.context.renderingContext.renderReasons.add(ge.DISPLAY_OBJECT_CHANGED)},t}(),sh=/\[\s*(.*)=(.*)\s*\]/,lh=function(){function t(){}return t.prototype.selectOne=function(e,r){var n=this;if(e.startsWith("."))return r.find(function(s){return((s==null?void 0:s.classList)||[]).indexOf(n.getIdOrClassname(e))>-1});if(e.startsWith("#"))return r.find(function(s){return s.id===n.getIdOrClassname(e)});if(e.startsWith("[")){var i=this.getAttribute(e),a=i.name,o=i.value;return a?r.find(function(s){return r!==s&&(a==="name"?s.name===o:n.attributeToString(s,a)===o)}):null}else return r.find(function(s){return r!==s&&s.nodeName===e})},t.prototype.selectAll=function(e,r){var n=this;if(e.startsWith("."))return r.findAll(function(s){return r!==s&&((s==null?void 0:s.classList)||[]).indexOf(n.getIdOrClassname(e))>-1});if(e.startsWith("#"))return r.findAll(function(s){return r!==s&&s.id===n.getIdOrClassname(e)});if(e.startsWith("[")){var i=this.getAttribute(e),a=i.name,o=i.value;return a?r.findAll(function(s){return r!==s&&(a==="name"?s.name===o:n.attributeToString(s,a)===o)}):[]}else return r.findAll(function(s){return r!==s&&s.nodeName===e})},t.prototype.is=function(e,r){if(e.startsWith("."))return r.className===this.getIdOrClassname(e);if(e.startsWith("#"))return r.id===this.getIdOrClassname(e);if(e.startsWith("[")){var n=this.getAttribute(e),i=n.name,a=n.value;return i==="name"?r.name===a:this.attributeToString(r,i)===a}else return r.nodeName===e},t.prototype.getIdOrClassname=function(e){return e.substring(1)},t.prototype.getAttribute=function(e){var r=e.match(sh),n="",i="";return r&&r.length>2&&(n=r[1].replace(/"/g,""),i=r[2].replace(/"/g,"")),{name:n,value:i}},t.prototype.attributeToString=function(e,r){if(!e.getAttribute)return"";var n=e.getAttribute(r);return F(n)?"":n.toString?n.toString():""},t}(),Ie=function(t){W(e,t);function e(r,n,i,a,o,s,l,c){var u=t.call(this,null)||this;return u.relatedNode=n,u.prevValue=i,u.newValue=a,u.attrName=o,u.attrChange=s,u.prevParsedValue=l,u.newParsedValue=c,u.type=r,u}return e.ADDITION=2,e.MODIFICATION=1,e.REMOVAL=3,e}(xn),$;(function(t){t.REPARENT="reparent",t.DESTROY="destroy",t.ATTR_MODIFIED="DOMAttrModified",t.INSERTED="DOMNodeInserted",t.REMOVED="removed",t.MOUNTED="DOMNodeInsertedIntoDocument",t.UNMOUNTED="DOMNodeRemovedFromDocument",t.BOUNDS_CHANGED="bounds-changed",t.CULLED="culled"})($||($={}));function Sa(t){var e=t.renderable;e&&(e.renderBoundsDirty=!0,e.boundsDirty=!0)}var ch=new Ie($.REPARENT,null,"","","",0,"",""),uh=function(){function t(e){var r=this;this.runtime=e,this.pendingEvents=[],this.boundsChangedEvent=new mt($.BOUNDS_CHANGED),this.rotate=function(){var n=gt();return function(i,a,o,s){o===void 0&&(o=0),s===void 0&&(s=0),typeof a=="number"&&(a=j(a,o,s));var l=i.transformable;if(i.parentNode===null||!i.parentNode.transformable)r.rotateLocal(i,a);else{var c=gt();Ar(c,a[0],a[1],a[2]);var u=r.getRotation(i),f=r.getRotation(i.parentNode);Or(n,f),Cn(n,n),Xe(c,n,c),Xe(l.localRotation,c,u),on(l.localRotation,l.localRotation),r.dirtifyLocal(i,l)}}}(),this.rotateLocal=function(){var n=gt();return function(i,a,o,s){o===void 0&&(o=0),s===void 0&&(s=0),typeof a=="number"&&(a=j(a,o,s));var l=i.transformable;Ar(n,a[0],a[1],a[2]),zi(l.localRotation,l.localRotation,n),r.dirtifyLocal(i,l)}}(),this.setEulerAngles=function(){var n=gt();return function(i,a,o,s){o===void 0&&(o=0),s===void 0&&(s=0),typeof a=="number"&&(a=j(a,o,s));var l=i.transformable;if(i.parentNode===null||!i.parentNode.transformable)r.setLocalEulerAngles(i,a);else{Ar(l.localRotation,a[0],a[1],a[2]);var c=r.getRotation(i.parentNode);Or(n,Cn(gt(),c)),zi(l.localRotation,l.localRotation,n),r.dirtifyLocal(i,l)}}}(),this.translateLocal=function(){return function(n,i,a,o){a===void 0&&(a=0),o===void 0&&(o=0),typeof i=="number"&&(i=j(i,a,o));var s=n.transformable;je(i,q())||(Pl(i,i,s.localRotation),$n(s.localPosition,s.localPosition,i),r.dirtifyLocal(n,s))}}(),this.setPosition=function(){var n=nt(),i=q();return function(a,o){var s=a.transformable;if(i[0]=o[0],i[1]=o[1],i[2]=o[2]||0,!je(r.getPosition(a),i)){if(pe(s.position,i),a.parentNode===null||!a.parentNode.transformable)pe(s.localPosition,i);else{var l=a.parentNode.transformable;Ke(n,l.worldTransform),jt(n,n),Ut(s.localPosition,i,n)}r.dirtifyLocal(a,s)}}}(),this.setLocalPosition=function(){var n=q();return function(i,a){var o=i.transformable;n[0]=a[0],n[1]=a[1],n[2]=a[2]||0,!je(o.localPosition,n)&&(pe(o.localPosition,n),r.dirtifyLocal(i,o))}}(),this.translate=function(){var n=q(),i=q(),a=q();return function(o,s,l,c){l===void 0&&(l=0),c===void 0&&(c=0),typeof s=="number"&&(s=qt(i,s,l,c)),!je(s,n)&&($n(a,r.getPosition(o),s),r.setPosition(o,a))}}(),this.setRotation=function(){var n=gt();return function(i,a,o,s,l){var c=i.transformable;if(typeof a=="number"&&(a=Sn(a,o,s,l)),i.parentNode===null||!i.parentNode.transformable)r.setLocalRotation(i,a);else{var u=r.getRotation(i.parentNode);Or(n,u),Cn(n,n),Xe(c.localRotation,n,a),on(c.localRotation,c.localRotation),r.dirtifyLocal(i,c)}}},this.displayObjectDependencyMap=new WeakMap,this.calcLocalTransform=function(){var n=nt(),i=q(),a=Sn(0,0,0,1);return function(o){var s=o.localSkew[0]!==0||o.localSkew[1]!==0;if(s){if(lr(o.localTransform,o.localRotation,o.localPosition,j(1,1,1),o.origin),o.localSkew[0]!==0||o.localSkew[1]!==0){var l=Er(n);l[4]=Math.tan(o.localSkew[0]),l[1]=Math.tan(o.localSkew[1]),Et(o.localTransform,o.localTransform,l)}var c=lr(n,a,i,o.localScale,o.origin);Et(o.localTransform,o.localTransform,c)}else lr(o.localTransform,o.localRotation,o.localPosition,o.localScale,o.origin)}}()}return t.prototype.matches=function(e,r){return this.runtime.sceneGraphSelector.is(e,r)},t.prototype.querySelector=function(e,r){return this.runtime.sceneGraphSelector.selectOne(e,r)},t.prototype.querySelectorAll=function(e,r){return this.runtime.sceneGraphSelector.selectAll(e,r)},t.prototype.attach=function(e,r,n){var i,a,o=!1;e.parentNode&&(o=e.parentNode!==r,this.detach(e)),e.parentNode=r,F(n)?e.parentNode.childNodes.push(e):e.parentNode.childNodes.splice(n,0,e);var s=r.sortable;(!((i=s==null?void 0:s.sorted)===null||i===void 0)&&i.length||!((a=e.style)===null||a===void 0)&&a.zIndex)&&(s.dirtyChildren.indexOf(e)===-1&&s.dirtyChildren.push(e),s.dirty=!0,s.dirtyReason=Qe.ADDED);var l=e.transformable;l&&this.dirtifyWorld(e,l),l.frozen&&this.unfreezeParentToRoot(e),o&&e.dispatchEvent(ch)},t.prototype.detach=function(e){var r,n;if(e.parentNode){var i=e.transformable,a=e.parentNode.sortable;(!((r=a==null?void 0:a.sorted)===null||r===void 0)&&r.length||!((n=e.style)===null||n===void 0)&&n.zIndex)&&(a.dirtyChildren.indexOf(e)===-1&&a.dirtyChildren.push(e),a.dirty=!0,a.dirtyReason=Qe.REMOVED);var o=e.parentNode.childNodes.indexOf(e);o>-1&&e.parentNode.childNodes.splice(o,1),i&&this.dirtifyWorld(e,i),e.parentNode=null}},t.prototype.getOrigin=function(e){return e.transformable.origin},t.prototype.setOrigin=function(e,r,n,i){n===void 0&&(n=0),i===void 0&&(i=0),typeof r=="number"&&(r=[r,n,i]);var a=e.transformable;if(!(r[0]===a.origin[0]&&r[1]===a.origin[1]&&r[2]===a.origin[2])){var o=a.origin;o[0]=r[0],o[1]=r[1],o[2]=r[2]||0,this.dirtifyLocal(e,a)}},t.prototype.setLocalEulerAngles=function(e,r,n,i){n===void 0&&(n=0),i===void 0&&(i=0),typeof r=="number"&&(r=j(r,n,i));var a=e.transformable;Ar(a.localRotation,r[0],r[1],r[2]),this.dirtifyLocal(e,a)},t.prototype.scaleLocal=function(e,r){var n=e.transformable;ml(n.localScale,n.localScale,j(r[0],r[1],r[2]||1)),this.dirtifyLocal(e,n)},t.prototype.setLocalScale=function(e,r){var n=e.transformable,i=j(r[0],r[1],r[2]||n.localScale[2]);je(i,n.localScale)||(pe(n.localScale,i),this.dirtifyLocal(e,n))},t.prototype.setLocalRotation=function(e,r,n,i,a){typeof r=="number"&&(r=Sn(r,n,i,a));var o=e.transformable;Or(o.localRotation,r),this.dirtifyLocal(e,o)},t.prototype.setLocalSkew=function(e,r,n){typeof r=="number"&&(r=Nl(r,n));var i=e.transformable;Rl(i.localSkew,r),this.dirtifyLocal(e,i)},t.prototype.dirtifyLocal=function(e,r){r.localDirtyFlag||(r.localDirtyFlag=!0,r.dirtyFlag||this.dirtifyWorld(e,r))},t.prototype.dirtifyWorld=function(e,r){r.dirtyFlag||this.unfreezeParentToRoot(e),this.dirtifyWorldInternal(e,r),this.dirtifyToRoot(e,!0)},t.prototype.triggerPendingEvents=function(){var e=this,r=new Set,n=function(i,a){i.isConnected&&!r.has(i.entity)&&(e.boundsChangedEvent.detail=a,e.boundsChangedEvent.target=i,i.isMutationObserved?i.dispatchEvent(e.boundsChangedEvent):i.ownerDocument.defaultView.dispatchEvent(e.boundsChangedEvent,!0),r.add(i.entity))};this.pendingEvents.forEach(function(i){var a=_(i,2),o=a[0],s=a[1];s.affectChildren?o.forEach(function(l){n(l,s)}):n(o,s)}),this.clearPendingEvents(),r.clear()},t.prototype.clearPendingEvents=function(){this.pendingEvents=[]},t.prototype.dirtifyToRoot=function(e,r){r===void 0&&(r=!1);var n=e;for(n.renderable&&(n.renderable.dirty=!0);n;)Sa(n),n=n.parentNode;r&&e.forEach(function(i){Sa(i)}),this.informDependentDisplayObjects(e),this.pendingEvents.push([e,{affectChildren:r}])},t.prototype.updateDisplayObjectDependency=function(e,r,n,i){if(r&&r!==n){var a=this.displayObjectDependencyMap.get(r);if(a&&a[e]){var o=a[e].indexOf(i);a[e].splice(o,1)}}if(n){var s=this.displayObjectDependencyMap.get(n);s||(this.displayObjectDependencyMap.set(n,{}),s=this.displayObjectDependencyMap.get(n)),s[e]||(s[e]=[]),s[e].push(i)}},t.prototype.informDependentDisplayObjects=function(e){var r=this,n=this.displayObjectDependencyMap.get(e);n&&Object.keys(n).forEach(function(i){n[i].forEach(function(a){r.dirtifyToRoot(a,!0),a.dispatchEvent(new Ie($.ATTR_MODIFIED,a,r,r,i,Ie.MODIFICATION,r,r)),a.isCustomElement&&a.isConnected&&a.attributeChangedCallback&&a.attributeChangedCallback(i,r,r)})})},t.prototype.getPosition=function(e){var r=e.transformable;return nn(r.position,this.getWorldTransform(e,r))},t.prototype.getRotation=function(e){var r=e.transformable;return an(r.rotation,this.getWorldTransform(e,r))},t.prototype.getScale=function(e){var r=e.transformable;return Ze(r.scaling,this.getWorldTransform(e,r))},t.prototype.getWorldTransform=function(e,r){return r===void 0&&(r=e.transformable),!r.localDirtyFlag&&!r.dirtyFlag||(e.parentNode&&e.parentNode.transformable&&this.getWorldTransform(e.parentNode),this.sync(e,r)),r.worldTransform},t.prototype.getLocalPosition=function(e){return e.transformable.localPosition},t.prototype.getLocalRotation=function(e){return e.transformable.localRotation},t.prototype.getLocalScale=function(e){return e.transformable.localScale},t.prototype.getLocalSkew=function(e){return e.transformable.localSkew},t.prototype.getLocalTransform=function(e){var r=e.transformable;return r.localDirtyFlag&&(this.calcLocalTransform(r),r.localDirtyFlag=!1),r.localTransform},t.prototype.setLocalTransform=function(e,r){var n=nn(q(),r),i=an(gt(),r),a=Ze(q(),r);this.setLocalScale(e,a),this.setLocalPosition(e,n),this.setLocalRotation(e,i)},t.prototype.resetLocalTransform=function(e){this.setLocalScale(e,[1,1,1]),this.setLocalPosition(e,[0,0,0]),this.setLocalEulerAngles(e,[0,0,0]),this.setLocalSkew(e,[0,0])},t.prototype.getTransformedGeometryBounds=function(e,r,n){r===void 0&&(r=!1);var i=this.getGeometryBounds(e,r);if(ht.isEmpty(i))return null;var a=n||new ht;return a.setFromTransformedAABB(i,this.getWorldTransform(e)),a},t.prototype.getGeometryBounds=function(e,r){r===void 0&&(r=!1);var n=e.geometry,i=r?n.renderBounds:n.contentBounds||null;return i||new ht},t.prototype.getBounds=function(e,r){var n=this;r===void 0&&(r=!1);var i=e.renderable;if(!i.boundsDirty&&!r&&i.bounds)return i.bounds;if(!i.renderBoundsDirty&&r&&i.renderBounds)return i.renderBounds;var a=r?i.renderBounds:i.bounds,o=this.getTransformedGeometryBounds(e,r,a),s=e.childNodes;if(s.forEach(function(u){var f=n.getBounds(u,r);f&&(o?o.add(f):(o=a||new ht,o.update(f.center,f.halfExtents)))}),r){var l=Ho(e);if(l){var c=l.parsedStyle.clipPath.getBounds(r);o?c&&(o=c.intersection(o)):o=c}}return o||(o=new ht),o&&(r?i.renderBounds=o:i.bounds=o),r?i.renderBoundsDirty=!1:i.boundsDirty=!1,o},t.prototype.getLocalBounds=function(e){if(e.parentNode){var r=nt();e.parentNode.transformable&&(r=jt(nt(),this.getWorldTransform(e.parentNode)));var n=this.getBounds(e);if(!ht.isEmpty(n)){var i=new ht;return i.setFromTransformedAABB(n,r),i}}return this.getBounds(e)},t.prototype.getBoundingClientRect=function(e){var r,n,i,a=this.getGeometryBounds(e);ht.isEmpty(a)||(i=new ht,i.setFromTransformedAABB(a,this.getWorldTransform(e)));var o=(n=(r=e.ownerDocument)===null||r===void 0?void 0:r.defaultView)===null||n===void 0?void 0:n.getContextService().getBoundingClientRect();if(i){var s=_(i.getMin(),2),l=s[0],c=s[1],u=_(i.getMax(),2),f=u[0],h=u[1];return new ke(l+((o==null?void 0:o.left)||0),c+((o==null?void 0:o.top)||0),f-l,h-c)}return new ke((o==null?void 0:o.left)||0,(o==null?void 0:o.top)||0,0,0)},t.prototype.dirtifyWorldInternal=function(e,r){var n=this;if(!r.dirtyFlag){r.dirtyFlag=!0,r.frozen=!1,e.childNodes.forEach(function(a){var o=a.transformable;o.dirtyFlag||n.dirtifyWorldInternal(a,o)});var i=e.renderable;i&&(i.renderBoundsDirty=!0,i.boundsDirty=!0,i.dirty=!0)}},t.prototype.syncHierarchy=function(e){var r=e.transformable;if(!r.frozen){r.frozen=!0,(r.localDirtyFlag||r.dirtyFlag)&&this.sync(e,r);for(var n=e.childNodes,i=0;il;--v){for(var d=0;d=c){r.isOverflowing=!0;break}d=0,p[y]="";continue}if(d>0&&d+b>h){if(y+1>=c){if(r.isOverflowing=!0,M>0&&M<=h){for(var C=p[y].length,S=0,N=C,O=0;Oh){N=O;break}S+=k}p[y]=(p[y]||"").slice(0,N)+v}break}if(y++,d=0,p[y]="",this.isBreakingSpace(g))continue;this.canBreakInLastChar(g)||(p=this.trimToBreakable(p),d=this.sumTextWidthByCache(p[y]||"",m)),this.shouldBreakByKinsokuShorui(g,T)&&(p=this.trimByKinsokuShorui(p),d+=x(w||""))}d+=b,p[y]=(p[y]||"")+g}return p.join(` +`)},t.prototype.isBreakingSpace=function(e){return typeof e!="string"?!1:Ne.BreakingSpaces.indexOf(e.charCodeAt(0))>=0},t.prototype.isNewline=function(e){return typeof e!="string"?!1:Ne.Newlines.indexOf(e.charCodeAt(0))>=0},t.prototype.trimToBreakable=function(e){var r=X([],_(e),!1),n=r[r.length-2],i=this.findBreakableIndex(n);if(i===-1||!n)return r;var a=n.slice(i,i+1),o=this.isBreakingSpace(a),s=i+1,l=i+(o?0:1);return r[r.length-1]+=n.slice(s,n.length),r[r.length-2]=n.slice(0,l),r},t.prototype.canBreakInLastChar=function(e){return!(e&&Na.test(e))},t.prototype.sumTextWidthByCache=function(e,r){return e.split("").reduce(function(n,i){if(!r[i])throw Error("cannot count the word without cache");return n+r[i]},0)},t.prototype.findBreakableIndex=function(e){for(var r=e.length-1;r>=0;r--)if(!Na.test(e[r]))return r;return-1},t.prototype.getFromCache=function(e,r,n,i){var a=n[e];if(typeof a!="number"){var o=e.length*r;a=i.measureText(e).width+o,n[e]=a}return a},t}(),A={},Ph=function(){var t,e=new th,r=new jf;return t={},t[R.CIRCLE]=new Kf,t[R.ELLIPSE]=new Zf,t[R.RECT]=e,t[R.IMAGE]=e,t[R.GROUP]=e,t[R.LINE]=new Qf,t[R.TEXT]=new eh(A),t[R.POLYLINE]=r,t[R.POLYGON]=r,t[R.PATH]=new Jf,t[R.HTML]=null,t[R.MESH]=null,t}(),wh=function(){var t,e=new cf,r=new Ni;return t={},t[D.PERCENTAGE]=null,t[D.NUMBER]=new pf,t[D.ANGLE]=new sf,t[D.DEFINED_PATH]=new lf,t[D.PAINT]=e,t[D.COLOR]=e,t[D.FILTER]=new uf,t[D.LENGTH]=r,t[D.LENGTH_PERCENTAGE]=r,t[D.LENGTH_PERCENTAGE_12]=new ff,t[D.LENGTH_PERCENTAGE_14]=new hf,t[D.COORDINATE]=new vf,t[D.OFFSET_DISTANCE]=new yf,t[D.OPACITY_VALUE]=new gf,t[D.PATH]=new mf,t[D.LIST_OF_POINTS]=new xf,t[D.SHADOW_BLUR]=new Ef,t[D.TEXT]=new Mf,t[D.TEXT_TRANSFORM]=new Pf,t[D.TRANSFORM]=new Vf,t[D.TRANSFORM_ORIGIN]=new qf,t[D.Z_INDEX]=new $f,t[D.MARKER]=new df,t}(),Th=function(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}};A.CameraContribution=ou;A.AnimationTimeline=null;A.EasingFunction=null;A.offscreenCanvasCreator=new ah;A.nativeHTMLMap=new WeakMap;A.sceneGraphSelector=new lh;A.sceneGraphService=new uh(A);A.textService=new Mh(A);A.geometryUpdaterFactory=Ph;A.CSSPropertySyntaxFactory=wh;A.styleValueRegistry=new of(A);A.layoutRegistry=null;A.globalThis=Th();A.enableCSSParsing=!0;A.enableDataset=!1;A.enableStyleSyntax=!0;var bh=0,Ra=new Ie($.INSERTED,null,"","","",0,"",""),Aa=new Ie($.REMOVED,null,"","","",0,"",""),Ch=new mt($.DESTROY),Sh=function(t){W(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.entity=bh++,r.renderable={bounds:void 0,boundsDirty:!0,renderBounds:void 0,renderBoundsDirty:!0,dirtyRenderBounds:void 0,dirty:!1},r.cullable={strategy:oi.Standard,visibilityPlaneMask:-1,visible:!0,enable:!0},r.transformable={dirtyFlag:!1,localDirtyFlag:!1,frozen:!1,localPosition:[0,0,0],localRotation:[0,0,0,1],localScale:[1,1,1],localTransform:[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],localSkew:[0,0],position:[0,0,0],rotation:[0,0,0,1],scaling:[1,1,1],worldTransform:[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],origin:[0,0,0]},r.sortable={dirty:!1,sorted:void 0,renderOrder:0,dirtyChildren:[],dirtyReason:void 0},r.geometry={contentBounds:void 0,renderBounds:void 0},r.rBushNode={aabb:void 0},r.namespaceURI="g",r.scrollLeft=0,r.scrollTop=0,r.clientTop=0,r.clientLeft=0,r.destroyed=!1,r.style={},r.computedStyle=A.enableCSSParsing?{anchor:tt,opacity:tt,fillOpacity:tt,strokeOpacity:tt,fill:tt,stroke:tt,transform:tt,transformOrigin:tt,visibility:tt,pointerEvents:tt,lineWidth:tt,lineCap:tt,lineJoin:tt,increasedLineWidthForHitTesting:tt,fontSize:tt,fontFamily:tt,fontStyle:tt,fontWeight:tt,fontVariant:tt,textAlign:tt,textBaseline:tt,textTransform:tt,zIndex:tt,filter:tt,shadowType:tt}:null,r.parsedStyle={},r.attributes={},r}return Object.defineProperty(e.prototype,"className",{get:function(){return this.getAttribute("class")||""},set:function(r){this.setAttribute("class",r)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"classList",{get:function(){return this.className.split(" ").filter(function(r){return r!==""})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"tagName",{get:function(){return this.nodeName},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"children",{get:function(){return this.childNodes},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"childElementCount",{get:function(){return this.childNodes.length},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"firstElementChild",{get:function(){return this.firstChild},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lastElementChild",{get:function(){return this.lastChild},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"parentElement",{get:function(){return this.parentNode},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"nextSibling",{get:function(){if(this.parentNode){var r=this.parentNode.childNodes.indexOf(this);return this.parentNode.childNodes[r+1]||null}return null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"previousSibling",{get:function(){if(this.parentNode){var r=this.parentNode.childNodes.indexOf(this);return this.parentNode.childNodes[r-1]||null}return null},enumerable:!1,configurable:!0}),e.prototype.cloneNode=function(r){throw new Error(J)},e.prototype.appendChild=function(r,n){var i;if(r.destroyed)throw new Error(au);return A.sceneGraphService.attach(r,this,n),!((i=this.ownerDocument)===null||i===void 0)&&i.defaultView&&this.ownerDocument.defaultView.mountChildren(r),Ra.relatedNode=this,r.dispatchEvent(Ra),r},e.prototype.insertBefore=function(r,n){if(!n)this.appendChild(r);else{r.parentElement&&r.parentElement.removeChild(r);var i=this.childNodes.indexOf(n);i===-1?this.appendChild(r):this.appendChild(r,i)}return r},e.prototype.replaceChild=function(r,n){var i=this.childNodes.indexOf(n);return this.removeChild(n),this.appendChild(r,i),n},e.prototype.removeChild=function(r){var n;return Aa.relatedNode=this,r.dispatchEvent(Aa),!((n=r.ownerDocument)===null||n===void 0)&&n.defaultView&&r.ownerDocument.defaultView.unmountChildren(r),A.sceneGraphService.detach(r),r},e.prototype.removeChildren=function(){for(var r=this.childNodes.length-1;r>=0;r--){var n=this.childNodes[r];this.removeChild(n)}},e.prototype.destroyChildren=function(){for(var r=this.childNodes.length-1;r>=0;r--){var n=this.childNodes[r];n.childNodes.length&&n.destroyChildren(),n.destroy()}},e.prototype.matches=function(r){return A.sceneGraphService.matches(r,this)},e.prototype.getElementById=function(r){return A.sceneGraphService.querySelector("#".concat(r),this)},e.prototype.getElementsByName=function(r){return A.sceneGraphService.querySelectorAll('[name="'.concat(r,'"]'),this)},e.prototype.getElementsByClassName=function(r){return A.sceneGraphService.querySelectorAll(".".concat(r),this)},e.prototype.getElementsByTagName=function(r){return A.sceneGraphService.querySelectorAll(r,this)},e.prototype.querySelector=function(r){return A.sceneGraphService.querySelector(r,this)},e.prototype.querySelectorAll=function(r){return A.sceneGraphService.querySelectorAll(r,this)},e.prototype.closest=function(r){var n=this;do{if(A.sceneGraphService.matches(r,n))return n;n=n.parentElement}while(n!==null);return null},e.prototype.find=function(r){var n=this,i=null;return this.forEach(function(a){return a!==n&&r(a)?(i=a,!0):!1}),i},e.prototype.findAll=function(r){var n=this,i=[];return this.forEach(function(a){a!==n&&r(a)&&i.push(a)}),i},e.prototype.after=function(){for(var r=this,n=[],i=0;i1){var i=r[0].currentPoint,a=r[1].currentPoint,o=r[1].startTangent;n=[],o?(n.push([i[0]-o[0],i[1]-o[1]]),n.push([i[0],i[1]])):(n.push([a[0],a[1]]),n.push([i[0],i[1]]))}return n},e.prototype.getEndTangent=function(){var r=this.parsedStyle.path.segments,n=r.length,i=[];if(n>1){var a=r[n-2].currentPoint,o=r[n-1].currentPoint,s=r[n-1].endTangent;i=[],s?(i.push([o[0]-s[0],o[1]-s[1]]),i.push([o[0],o[1]])):(i.push([a[0],a[1]]),i.push([o[0],o[1]]))}return i},e}(_t),Jo=function(t){W(e,t);function e(r){var n=this;r===void 0&&(r={});var i=r.style,a=Yt(r,["style"]);n=t.call(this,U({type:R.POLYGON,style:A.enableCSSParsing?U({points:"",miterLimit:"",isClosed:!0},i):U({},i),initialParsedStyle:A.enableCSSParsing?null:{points:{points:[],totalLength:0,segments:[]},miterLimit:4,isClosed:!0}},a))||this,n.markerStartAngle=0,n.markerEndAngle=0,n.markerMidList=[];var o=n.parsedStyle,s=o.markerStart,l=o.markerEnd,c=o.markerMid;return s&&K(s)&&(n.markerStartAngle=s.getLocalEulerAngles(),n.appendChild(s)),c&&K(c)&&n.placeMarkerMid(c),l&&K(l)&&(n.markerEndAngle=l.getLocalEulerAngles(),n.appendChild(l)),n.transformMarker(!0),n.transformMarker(!1),n}return e.prototype.attributeChangedCallback=function(r,n,i,a,o){r==="points"?(this.transformMarker(!0),this.transformMarker(!1),this.placeMarkerMid(this.parsedStyle.markerMid)):r==="markerStartOffset"||r==="markerEndOffset"?(this.transformMarker(!0),this.transformMarker(!1)):r==="markerStart"?(a&&K(a)&&(this.markerStartAngle=0,a.remove()),o&&K(o)&&(this.markerStartAngle=o.getLocalEulerAngles(),this.appendChild(o),this.transformMarker(!0))):r==="markerEnd"?(a&&K(a)&&(this.markerEndAngle=0,a.remove()),o&&K(o)&&(this.markerEndAngle=o.getLocalEulerAngles(),this.appendChild(o),this.transformMarker(!1))):r==="markerMid"&&this.placeMarkerMid(o)},e.prototype.transformMarker=function(r){var n=this.parsedStyle,i=n.markerStart,a=n.markerEnd,o=n.markerStartOffset,s=n.markerEndOffset,l=n.points,c=n.defX,u=n.defY,f=(l||{}).points,h=r?i:a;if(!(!h||!K(h)||!f)){var v=0,p,y,d,m,x,M;if(d=f[0][0]-c,m=f[0][1]-u,r)p=f[1][0]-f[0][0],y=f[1][1]-f[0][1],x=o||0,M=this.markerStartAngle;else{var P=f.length;this.parsedStyle.isClosed?(p=f[P-1][0]-f[0][0],y=f[P-1][1]-f[0][1]):(d=f[P-1][0]-c,m=f[P-1][1]-u,p=f[P-2][0]-f[P-1][0],y=f[P-2][1]-f[P-1][1]),x=s||0,M=this.markerEndAngle}v=Math.atan2(y,p),h.setLocalEulerAngles(v*180/Math.PI+M),h.setLocalPosition(d+Math.cos(v)*x,m+Math.sin(v)*x)}},e.prototype.placeMarkerMid=function(r){var n=this.parsedStyle,i=n.points,a=n.defX,o=n.defY,s=(i||{}).points;if(this.markerMidList.forEach(function(h){h.remove()}),this.markerMidList=[],r&&K(r)&&s)for(var l=1;l<(this.parsedStyle.isClosed?s.length:s.length-1);l++){var c=s[l][0]-a,u=s[l][1]-o,f=l===1?r:r.cloneNode(!0);this.markerMidList.push(f),this.appendChild(f),f.setLocalPosition(c,u)}},e}(_t),Lh=function(t){W(e,t);function e(r){r===void 0&&(r={});var n=r.style,i=Yt(r,["style"]);return t.call(this,U({type:R.POLYLINE,style:A.enableCSSParsing?U({points:"",miterLimit:"",isClosed:!1},n):U({},n),initialParsedStyle:A.enableCSSParsing?null:{points:{points:[],totalLength:0,segments:[]},miterLimit:4,isClosed:!1}},i))||this}return e.prototype.getTotalLength=function(){return this.parsedStyle.points.totalLength},e.prototype.getPointAtLength=function(r,n){return n===void 0&&(n=!1),this.getPoint(r/this.getTotalLength(),n)},e.prototype.getPoint=function(r,n){n===void 0&&(n=!1);var i=this.parsedStyle,a=i.defX,o=i.defY,s=i.points,l=s.points,c=s.segments,u=0,f=0;c.forEach(function(d,m){r>=d[0]&&r<=d[1]&&(u=(r-d[0])/(d[1]-d[0]),f=m)});var h=So(l[f][0],l[f][1],l[f+1][0],l[f+1][1],u),v=h.x,p=h.y,y=Ut(q(),j(v-a,p-o,0),n?this.getWorldTransform():this.getLocalTransform());return new pt(y[0],y[1])},e.prototype.getStartTangent=function(){var r=this.parsedStyle.points.points,n=[];return n.push([r[1][0],r[1][1]]),n.push([r[0][0],r[0][1]]),n},e.prototype.getEndTangent=function(){var r=this.parsedStyle.points.points,n=r.length-1,i=[];return i.push([r[n-1][0],r[n-1][1]]),i.push([r[n][0],r[n][1]]),i},e}(Jo),jo=function(t){W(e,t);function e(r){r===void 0&&(r={});var n=r.style,i=Yt(r,["style"]);return t.call(this,U({type:R.RECT,style:A.enableCSSParsing?U({x:"",y:"",width:"",height:"",radius:""},n):U({},n)},i))||this}return e}(_t),ts=function(t){W(e,t);function e(r){r===void 0&&(r={});var n=r.style,i=Yt(r,["style"]);return t.call(this,U({type:R.TEXT,style:A.enableCSSParsing?U({x:"",y:"",text:"",fontSize:"",fontFamily:"",fontStyle:"",fontWeight:"",fontVariant:"",textAlign:"",textBaseline:"",textTransform:"",fill:"black",letterSpacing:"",lineHeight:"",miterLimit:"",wordWrap:!1,wordWrapWidth:0,leading:0,dx:"",dy:""},n):U({fill:"black"},n),initialParsedStyle:A.enableCSSParsing?{}:{x:0,y:0,fontSize:16,fontFamily:"sans-serif",fontStyle:"normal",fontWeight:"normal",fontVariant:"normal",lineHeight:0,letterSpacing:0,textBaseline:"alphabetic",textAlign:"start",wordWrap:!1,wordWrapWidth:0,leading:0,dx:0,dy:0}},i))||this}return e.prototype.getComputedTextLength=function(){var r;return((r=this.parsedStyle.metrics)===null||r===void 0?void 0:r.maxLineWidth)||0},e.prototype.getLineBoundingRects=function(){var r;return((r=this.parsedStyle.metrics)===null||r===void 0?void 0:r.lineMetrics)||[]},e.prototype.isOverflowing=function(){return!!this.parsedStyle.isOverflowing},e}(_t),_h=function(){function t(){this.registry={},this.define(R.CIRCLE,xe),this.define(R.ELLIPSE,kh),this.define(R.RECT,jo),this.define(R.IMAGE,Qo),this.define(R.LINE,Ai),this.define(R.GROUP,di),this.define(R.PATH,En),this.define(R.POLYGON,Jo),this.define(R.POLYLINE,Lh),this.define(R.TEXT,ts),this.define(R.HTML,Ih)}return t.prototype.define=function(e,r){this.registry[e]=r},t.prototype.get=function(e){return this.registry[e]},t}(),Dh=function(t){W(e,t);function e(){var r=t.call(this)||this;r.defaultView=null,r.ownerDocument=null,r.nodeName="document";try{r.timeline=new A.AnimationTimeline(r)}catch{}var n={};return Si.forEach(function(i){var a=i.n,o=i.inh,s=i.d;o&&s&&(n[a]=ze(s)?s(R.GROUP):s)}),r.documentElement=new di({id:"g-root",style:n}),r.documentElement.ownerDocument=r,r.documentElement.parentNode=r,r.childNodes=[r.documentElement],r}return Object.defineProperty(e.prototype,"children",{get:function(){return this.childNodes},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"childElementCount",{get:function(){return this.childNodes.length},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"firstElementChild",{get:function(){return this.firstChild},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lastElementChild",{get:function(){return this.lastChild},enumerable:!1,configurable:!0}),e.prototype.createElement=function(r,n){if(r==="svg")return this.documentElement;var i=this.defaultView.customElements.get(r);i||(console.warn("Unsupported tagName: ",r),i=r==="tspan"?ts:di);var a=new i(n);return a.ownerDocument=this,a},e.prototype.createElementNS=function(r,n,i){return this.createElement(n,i)},e.prototype.cloneNode=function(r){throw new Error(J)},e.prototype.destroy=function(){try{this.documentElement.destroyChildren(),this.timeline.destroy()}catch{}},e.prototype.elementsFromBBox=function(r,n,i,a){var o=this.defaultView.context.rBushRoot,s=o.search({minX:r,minY:n,maxX:i,maxY:a}),l=[];return s.forEach(function(c){var u=c.displayObject,f=u.parsedStyle.pointerEvents,h=["auto","visiblepainted","visiblefill","visiblestroke","visible"].includes(f);(!h||h&&u.isVisible())&&!u.isCulled()&&u.isInteractive()&&l.push(u)}),l.sort(function(c,u){return u.sortable.renderOrder-c.sortable.renderOrder}),l},e.prototype.elementFromPointSync=function(r,n){var i=this.defaultView.canvas2Viewport({x:r,y:n}),a=i.x,o=i.y,s=this.defaultView.getConfig(),l=s.width,c=s.height;if(a<0||o<0||a>l||o>c)return null;var u=this.defaultView.viewport2Client({x:a,y:o}),f=u.x,h=u.y,v=this.defaultView.getRenderingService().hooks.pickSync.call({topmost:!0,position:{x:r,y:n,viewportX:a,viewportY:o,clientX:f,clientY:h},picked:[]}).picked;return v&&v[0]||this.documentElement},e.prototype.elementFromPoint=function(r,n){return fr(this,void 0,void 0,function(){var i,a,o,s,l,c,u,f,h,v;return hr(this,function(p){switch(p.label){case 0:return i=this.defaultView.canvas2Viewport({x:r,y:n}),a=i.x,o=i.y,s=this.defaultView.getConfig(),l=s.width,c=s.height,a<0||o<0||a>l||o>c?[2,null]:(u=this.defaultView.viewport2Client({x:a,y:o}),f=u.x,h=u.y,[4,this.defaultView.getRenderingService().hooks.pick.promise({topmost:!0,position:{x:r,y:n,viewportX:a,viewportY:o,clientX:f,clientY:h},picked:[]})]);case 1:return v=p.sent().picked,[2,v&&v[0]||this.documentElement]}})})},e.prototype.elementsFromPointSync=function(r,n){var i=this.defaultView.canvas2Viewport({x:r,y:n}),a=i.x,o=i.y,s=this.defaultView.getConfig(),l=s.width,c=s.height;if(a<0||o<0||a>l||o>c)return[];var u=this.defaultView.viewport2Client({x:a,y:o}),f=u.x,h=u.y,v=this.defaultView.getRenderingService().hooks.pickSync.call({topmost:!1,position:{x:r,y:n,viewportX:a,viewportY:o,clientX:f,clientY:h},picked:[]}).picked;return v[v.length-1]!==this.documentElement&&v.push(this.documentElement),v},e.prototype.elementsFromPoint=function(r,n){return fr(this,void 0,void 0,function(){var i,a,o,s,l,c,u,f,h,v;return hr(this,function(p){switch(p.label){case 0:return i=this.defaultView.canvas2Viewport({x:r,y:n}),a=i.x,o=i.y,s=this.defaultView.getConfig(),l=s.width,c=s.height,a<0||o<0||a>l||o>c?[2,[]]:(u=this.defaultView.viewport2Client({x:a,y:o}),f=u.x,h=u.y,[4,this.defaultView.getRenderingService().hooks.pick.promise({topmost:!1,position:{x:r,y:n,viewportX:a,viewportY:o,clientX:f,clientY:h},picked:[]})]);case 1:return v=p.sent().picked,v[v.length-1]!==this.documentElement&&v.push(this.documentElement),[2,v]}})})},e.prototype.appendChild=function(r,n){throw new Error(Ge)},e.prototype.insertBefore=function(r,n){throw new Error(Ge)},e.prototype.removeChild=function(r,n){throw new Error(Ge)},e.prototype.replaceChild=function(r,n,i){throw new Error(Ge)},e.prototype.append=function(){throw new Error(Ge)},e.prototype.prepend=function(){throw new Error(Ge)},e.prototype.getElementById=function(r){return this.documentElement.getElementById(r)},e.prototype.getElementsByName=function(r){return this.documentElement.getElementsByName(r)},e.prototype.getElementsByTagName=function(r){return this.documentElement.getElementsByTagName(r)},e.prototype.getElementsByClassName=function(r){return this.documentElement.getElementsByClassName(r)},e.prototype.querySelector=function(r){return this.documentElement.querySelector(r)},e.prototype.querySelectorAll=function(r){return this.documentElement.querySelectorAll(r)},e.prototype.find=function(r){return this.documentElement.find(r)},e.prototype.findAll=function(r){return this.documentElement.findAll(r)},e}(yt),Fh=function(){function t(e){this.strategies=e}return t.prototype.apply=function(e){var r=e.camera,n=e.renderingService,i=e.renderingContext,a=this.strategies;n.hooks.cull.tap(t.tag,function(o){if(o){var s=o.cullable;return a.length===0?s.visible=i.unculledEntities.indexOf(o.entity)>-1:s.visible=a.every(function(l){return l.isVisible(r,o)}),!o.isCulled()&&o.isVisible()?o:(o.dispatchEvent(new mt($.CULLED)),null)}return o}),n.hooks.afterRender.tap(t.tag,function(o){o.cullable.visibilityPlaneMask=-1})},t.tag="Culling",t}(),Bh=function(){function t(){var e=this;this.autoPreventDefault=!1,this.rootPointerEvent=new hi(null),this.rootWheelEvent=new vi(null),this.onPointerMove=function(r){var n,i,a,o,s=(o=(a=e.context.renderingContext.root)===null||a===void 0?void 0:a.ownerDocument)===null||o===void 0?void 0:o.defaultView;if(!(s.supportsTouchEvents&&r.pointerType==="touch")){var l=e.normalizeToPointerEvent(r,s);try{for(var c=de(l),u=c.next();!u.done;u=c.next()){var f=u.value,h=e.bootstrapEvent(e.rootPointerEvent,f,s,r);e.context.eventService.mapEvent(h)}}catch(v){n={error:v}}finally{try{u&&!u.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}e.setCursor(e.context.eventService.cursor)}},this.onClick=function(r){var n,i,a,o,s=(o=(a=e.context.renderingContext.root)===null||a===void 0?void 0:a.ownerDocument)===null||o===void 0?void 0:o.defaultView,l=e.normalizeToPointerEvent(r,s);try{for(var c=de(l),u=c.next();!u.done;u=c.next()){var f=u.value,h=e.bootstrapEvent(e.rootPointerEvent,f,s,r);e.context.eventService.mapEvent(h)}}catch(v){n={error:v}}finally{try{u&&!u.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}e.setCursor(e.context.eventService.cursor)}}return t.prototype.apply=function(e){var r=this;this.context=e;var n=e.renderingService,i=this.context.renderingContext.root.ownerDocument.defaultView;this.context.eventService.setPickHandler(function(a){var o=r.context.renderingService.hooks.pickSync.call({position:a,picked:[],topmost:!0}).picked;return o[0]||null}),n.hooks.pointerWheel.tap(t.tag,function(a){var o=r.normalizeWheelEvent(a);r.context.eventService.mapEvent(o)}),n.hooks.pointerDown.tap(t.tag,function(a){var o,s;if(!(i.supportsTouchEvents&&a.pointerType==="touch")){var l=r.normalizeToPointerEvent(a,i);if(r.autoPreventDefault&&l[0].isNormalized){var c=a.cancelable||!("cancelable"in a);c&&a.preventDefault()}try{for(var u=de(l),f=u.next();!f.done;f=u.next()){var h=f.value,v=r.bootstrapEvent(r.rootPointerEvent,h,i,a);r.context.eventService.mapEvent(v)}}catch(p){o={error:p}}finally{try{f&&!f.done&&(s=u.return)&&s.call(u)}finally{if(o)throw o.error}}r.setCursor(r.context.eventService.cursor)}}),n.hooks.pointerUp.tap(t.tag,function(a){var o,s;if(!(i.supportsTouchEvents&&a.pointerType==="touch")){var l=r.context.contextService.getDomElement(),c="outside";try{c=l&&a.target&&a.target!==l&&l.contains&&!l.contains(a.target)?"outside":""}catch{}var u=r.normalizeToPointerEvent(a,i);try{for(var f=de(u),h=f.next();!h.done;h=f.next()){var v=h.value,p=r.bootstrapEvent(r.rootPointerEvent,v,i,a);p.type+=c,r.context.eventService.mapEvent(p)}}catch(y){o={error:y}}finally{try{h&&!h.done&&(s=f.return)&&s.call(f)}finally{if(o)throw o.error}}r.setCursor(r.context.eventService.cursor)}}),n.hooks.pointerMove.tap(t.tag,this.onPointerMove),n.hooks.pointerOver.tap(t.tag,this.onPointerMove),n.hooks.pointerOut.tap(t.tag,this.onPointerMove),n.hooks.click.tap(t.tag,this.onClick),n.hooks.pointerCancel.tap(t.tag,function(a){var o,s,l=r.normalizeToPointerEvent(a,i);try{for(var c=de(l),u=c.next();!u.done;u=c.next()){var f=u.value,h=r.bootstrapEvent(r.rootPointerEvent,f,i,a);r.context.eventService.mapEvent(h)}}catch(v){o={error:v}}finally{try{u&&!u.done&&(s=c.return)&&s.call(c)}finally{if(o)throw o.error}}r.setCursor(r.context.eventService.cursor)})},t.prototype.getViewportXY=function(e){var r,n,i=e.offsetX,a=e.offsetY,o=e.clientX,s=e.clientY;if(this.context.config.supportsCSSTransform&&!F(i)&&!F(a))r=i,n=a;else{var l=this.context.eventService.client2Viewport(new pt(o,s));r=l.x,n=l.y}return{x:r,y:n}},t.prototype.bootstrapEvent=function(e,r,n,i){e.view=n,e.originalEvent=null,e.nativeEvent=i,e.pointerId=r.pointerId,e.width=r.width,e.height=r.height,e.isPrimary=r.isPrimary,e.pointerType=r.pointerType,e.pressure=r.pressure,e.tangentialPressure=r.tangentialPressure,e.tiltX=r.tiltX,e.tiltY=r.tiltY,e.twist=r.twist,this.transferMouseData(e,r);var a=this.getViewportXY(r),o=a.x,s=a.y;e.viewport.x=o,e.viewport.y=s;var l=this.context.eventService.viewport2Canvas(e.viewport),c=l.x,u=l.y;return e.canvas.x=c,e.canvas.y=u,e.global.copyFrom(e.canvas),e.offset.copyFrom(e.canvas),e.isTrusted=i.isTrusted,e.type==="pointerleave"&&(e.type="pointerout"),e.type.startsWith("mouse")&&(e.type=e.type.replace("mouse","pointer")),e.type.startsWith("touch")&&(e.type=Of[e.type]||e.type),e},t.prototype.normalizeWheelEvent=function(e){var r=this.rootWheelEvent;this.transferMouseData(r,e),r.deltaMode=e.deltaMode,r.deltaX=e.deltaX,r.deltaY=e.deltaY,r.deltaZ=e.deltaZ;var n=this.getViewportXY(e),i=n.x,a=n.y;r.viewport.x=i,r.viewport.y=a;var o=this.context.eventService.viewport2Canvas(r.viewport),s=o.x,l=o.y;return r.canvas.x=s,r.canvas.y=l,r.global.copyFrom(r.canvas),r.offset.copyFrom(r.canvas),r.nativeEvent=e,r.type=e.type,r},t.prototype.transferMouseData=function(e,r){e.isTrusted=r.isTrusted,e.srcElement=r.srcElement,e.timeStamp=fi.now(),e.type=r.type,e.altKey=r.altKey,e.metaKey=r.metaKey,e.shiftKey=r.shiftKey,e.ctrlKey=r.ctrlKey,e.button=r.button,e.buttons=r.buttons,e.client.x=r.clientX,e.client.y=r.clientY,e.movement.x=r.movementX,e.movement.y=r.movementY,e.page.x=r.pageX,e.page.y=r.pageY,e.screen.x=r.screenX,e.screen.y=r.screenY,e.relatedTarget=null},t.prototype.setCursor=function(e){this.context.contextService.applyCursorStyle(e||this.context.config.cursor||"default")},t.prototype.normalizeToPointerEvent=function(e,r){var n=[];if(r.isTouchEvent(e))for(var i=0;i-1,s=0,l=i.length;s=1?Math.ceil(S):1,b=s||Nf(a)||a.width/S,C=l||Rf(a)||a.height/S),o&&(A.offscreenCanvas=o),n.devicePixelRatio=S,n.requestAnimationFrame=p??Vo.bind(A.globalThis),n.cancelAnimationFrame=y??qo.bind(A.globalThis),n.supportsTouchEvents=x??"ontouchstart"in A.globalThis,n.supportsPointerEvents=m??!!A.globalThis.PointerEvent,n.isTouchEvent=w??function(N){return n.supportsTouchEvents&&N instanceof A.globalThis.TouchEvent},n.isMouseEvent=T??function(N){return!A.globalThis.MouseEvent||N instanceof A.globalThis.MouseEvent&&(!n.supportsPointerEvents||!(N instanceof A.globalThis.PointerEvent))},n.initRenderingContext({container:i,canvas:a,width:b,height:C,renderer:u,offscreenCanvas:o,devicePixelRatio:S,cursor:h||"default",background:f||"transparent",createImage:d,document:v,supportsCSSTransform:M,useNativeClickEvent:E,alwaysTriggerPointerEventOnCanvas:g}),n.initDefaultCamera(b,C,u.clipSpaceNearZ),n.initRenderer(u,!0),n}return e.prototype.initRenderingContext=function(r){this.context.config=r,this.context.renderingContext={root:this.document.documentElement,renderListCurrentFrame:[],unculledEntities:[],renderReasons:new Set,force:!1,dirty:!1}},e.prototype.initDefaultCamera=function(r,n,i){var a=this,o=new A.CameraContribution;o.clipSpaceNearZ=i,o.setType(at.EXPLORING,pr.DEFAULT).setPosition(r/2,n/2,ka).setFocalPoint(r/2,n/2,0).setOrthographic(r/-2,r/2,n/2,n/-2,Hh,zh),o.canvas=this,o.eventEmitter.on(Ro.UPDATED,function(){a.context.renderingContext.renderReasons.add(ge.CAMERA_CHANGED)}),this.context.camera=o},e.prototype.getConfig=function(){return this.context.config},e.prototype.getRoot=function(){return this.document.documentElement},e.prototype.getCamera=function(){return this.context.camera},e.prototype.getContextService=function(){return this.context.contextService},e.prototype.getEventService=function(){return this.context.eventService},e.prototype.getRenderingService=function(){return this.context.renderingService},e.prototype.getRenderingContext=function(){return this.context.renderingContext},e.prototype.getStats=function(){return this.getRenderingService().getStats()},Object.defineProperty(e.prototype,"ready",{get:function(){var r=this;return this.readyPromise||(this.readyPromise=new Promise(function(n){r.resolveReadyPromise=function(){n(r)}}),this.inited&&this.resolveReadyPromise()),this.readyPromise},enumerable:!1,configurable:!0}),e.prototype.destroy=function(r,n){if(r===void 0&&(r=!0),n===void 0&&(n=!1),n||this.dispatchEvent(new mt(Tt.BEFORE_DESTROY)),this.frameId){var i=this.getConfig().cancelAnimationFrame||cancelAnimationFrame;i(this.frameId)}var a=this.getRoot();this.unmountChildren(a),r&&(this.document.destroy(),this.getEventService().destroy()),this.getRenderingService().destroy(),this.getContextService().destroy(),r&&this.context.rBushRoot&&(this.context.rBushRoot.clear(),this.context.rBushRoot=null,this.context.renderingContext.root=null),n||this.dispatchEvent(new mt(Tt.AFTER_DESTROY))},e.prototype.changeSize=function(r,n){this.resize(r,n)},e.prototype.resize=function(r,n){var i=this.context.config;i.width=r,i.height=n,this.getContextService().resize(r,n);var a=this.context.camera,o=a.getProjectionMode();a.setPosition(r/2,n/2,ka).setFocalPoint(r/2,n/2,0),o===Pt.ORTHOGRAPHIC?a.setOrthographic(r/-2,r/2,n/2,n/-2,a.getNear(),a.getFar()):a.setAspect(r/n),this.dispatchEvent(new mt(Tt.RESIZE,{width:r,height:n}))},e.prototype.appendChild=function(r,n){return this.document.documentElement.appendChild(r,n)},e.prototype.insertBefore=function(r,n){return this.document.documentElement.insertBefore(r,n)},e.prototype.removeChild=function(r){return this.document.documentElement.removeChild(r)},e.prototype.removeChildren=function(){this.document.documentElement.removeChildren()},e.prototype.destroyChildren=function(){this.document.documentElement.destroyChildren()},e.prototype.render=function(){var r=this;this.dispatchEvent(Wh);var n=this.getRenderingService();n.render(this.getConfig(),function(){r.dispatchEvent(Xh)}),this.dispatchEvent(Vh)},e.prototype.run=function(){var r=this,n=function(){r.render(),r.frameId=r.requestAnimationFrame(n)};n()},e.prototype.initRenderer=function(r,n){var i=this;if(n===void 0&&(n=!1),!r)throw new Error("Renderer is required.");this.inited=!1,this.readyPromise=void 0,this.context.rBushRoot=new Xc,this.context.renderingPlugins=[],this.context.renderingPlugins.push(new Bh,new Yh,new Fh([new Uh])),this.loadRendererContainerModule(r),this.context.contextService=new this.context.ContextService(U(U({},A),this.context)),this.context.renderingService=new oh(A,this.context),this.context.eventService=new ih(A,this.context),this.context.eventService.init(),this.context.contextService.init?(this.context.contextService.init(),this.initRenderingService(r,n,!0)):this.context.contextService.initAsync().then(function(){i.initRenderingService(r,n)})},e.prototype.initRenderingService=function(r,n,i){var a=this;n===void 0&&(n=!1),i===void 0&&(i=!1),this.context.renderingService.init(function(){a.inited=!0,n?(i?a.requestAnimationFrame(function(){a.dispatchEvent(new mt(Tt.READY))}):a.dispatchEvent(new mt(Tt.READY)),a.readyPromise&&a.resolveReadyPromise()):a.dispatchEvent(new mt(Tt.RENDERER_CHANGED)),n||a.getRoot().forEach(function(o){var s=o.renderable;s&&(s.renderBoundsDirty=!0,s.boundsDirty=!0,s.dirty=!0)}),a.mountChildren(a.getRoot()),r.getConfig().enableAutoRendering&&a.run()})},e.prototype.loadRendererContainerModule=function(r){var n=this,i=r.getPlugins();i.forEach(function(a){a.context=n.context,a.init(A)})},e.prototype.setRenderer=function(r){var n=this.getConfig();if(n.renderer!==r){var i=n.renderer;n.renderer=r,this.destroy(!1,!0),X([],_(i==null?void 0:i.getPlugins()),!1).reverse().forEach(function(a){a.destroy(A)}),this.initRenderer(r)}},e.prototype.setCursor=function(r){var n=this.getConfig();n.cursor=r,this.getContextService().applyCursorStyle(r)},e.prototype.unmountChildren=function(r){var n=this;r.childNodes.forEach(function(i){n.unmountChildren(i)}),this.inited&&(r.isMutationObserved?r.dispatchEvent(Hn):(Hn.target=r,this.dispatchEvent(Hn,!0)),r!==this.document.documentElement&&(r.ownerDocument=null),r.isConnected=!1),r.isCustomElement&&r.disconnectedCallback&&r.disconnectedCallback()},e.prototype.mountChildren=function(r){var n=this;this.inited?r.isConnected||(r.ownerDocument=this.document,r.isConnected=!0,r.isMutationObserved?r.dispatchEvent(Yn):(Yn.target=r,this.dispatchEvent(Yn,!0))):console.warn("[g]: You are trying to call `canvas.appendChild` before canvas' initialization finished. You can either await `canvas.ready` or listen to `CanvasEvent.READY` manually.","appended child: ",r.nodeName),r.childNodes.forEach(function(i){n.mountChildren(i)}),r.isCustomElement&&r.connectedCallback&&r.connectedCallback()},e.prototype.client2Viewport=function(r){return this.getEventService().client2Viewport(r)},e.prototype.viewport2Client=function(r){return this.getEventService().viewport2Client(r)},e.prototype.viewport2Canvas=function(r){return this.getEventService().viewport2Canvas(r)},e.prototype.canvas2Viewport=function(r){return this.getEventService().canvas2Viewport(r)},e.prototype.getPointByClient=function(r,n){return this.client2Viewport({x:r,y:n})},e.prototype.getClientByPoint=function(r,n){return this.viewport2Client({x:r,y:n})},e}(Ko);function qh(t,e){var r=e.r;t.arc(r,r,r,0,Math.PI*2,!1)}function $h(t,e){var r=e.rx,n=e.ry,i=r,a=n;if(t.ellipse)t.ellipse(i,a,i,a,0,0,Math.PI*2,!1);else{var o=i>a?i:a,s=i>a?1:i/a,l=i>a?a/i:1;t.save(),t.scale(s,l),t.arc(o,o,o,0,Math.PI*2)}}function Kh(t,e){var r=e.x1,n=e.y1,i=e.x2,a=e.y2,o=e.defX,s=o===void 0?0:o,l=e.defY,c=l===void 0?0:l,u=e.markerStart,f=e.markerEnd,h=e.markerStartOffset,v=e.markerEndOffset,p=0,y=0,d=0,m=0,x=0,M,P;u&&K(u)&&h&&(M=i-r,P=a-n,x=Math.atan2(P,M),p=Math.cos(x)*(h||0),y=Math.sin(x)*(h||0)),f&&K(f)&&v&&(M=r-i,P=n-a,x=Math.atan2(P,M),d=Math.cos(x)*(v||0),m=Math.sin(x)*(v||0)),t.moveTo(r-s+p,n-c+y),t.lineTo(i-s+d,a-c+m)}function Zh(t,e){var r=e.defX,n=r===void 0?0:r,i=e.defY,a=i===void 0?0:i,o=e.markerStart,s=e.markerEnd,l=e.markerStartOffset,c=e.markerEndOffset,u=e.path,f=u.absolutePath,h=u.segments,v=0,p=0,y=0,d=0,m=0,x,M;if(o&&K(o)&&l){var P=_(o.parentNode.getStartTangent(),2),E=P[0],g=P[1];x=E[0]-g[0],M=E[1]-g[1],m=Math.atan2(M,x),v=Math.cos(m)*(l||0),p=Math.sin(m)*(l||0)}if(s&&K(s)&&c){var w=_(s.parentNode.getEndTangent(),2),E=w[0],g=w[1];x=E[0]-g[0],M=E[1]-g[1],m=Math.atan2(M,x),y=Math.cos(m)*(c||0),d=Math.sin(m)*(c||0)}for(var T=0;TG?I:G,$t=I>G?1:I/G,Kt=I>G?G/I:1;t.translate(B-n,Y-a),t.rotate(rt),t.scale($t,Kt),t.arc(0,0,Ht,H,ct,!!(1-St)),t.scale(1/$t,1/Kt),t.rotate(-rt),t.translate(-(B-n),-(Y-a))}O&&t.lineTo(b[6]-n+y,b[7]-a+d);break}case"Z":t.closePath();break}}}function Qh(t,e){var r=e.defX,n=r===void 0?0:r,i=e.defY,a=i===void 0?0:i,o=e.markerStart,s=e.markerEnd,l=e.markerStartOffset,c=e.markerEndOffset,u=e.points.points,f=u.length,h=u[0][0]-n,v=u[0][1]-a,p=u[f-1][0]-n,y=u[f-1][1]-a,d=0,m=0,x=0,M=0,P=0,E,g;o&&K(o)&&l&&(E=u[1][0]-u[0][0],g=u[1][1]-u[0][1],P=Math.atan2(g,E),d=Math.cos(P)*(l||0),m=Math.sin(P)*(l||0)),s&&K(s)&&c&&(E=u[f-1][0]-u[0][0],g=u[f-1][1]-u[0][1],P=Math.atan2(g,E),x=Math.cos(P)*(c||0),M=Math.sin(P)*(c||0)),t.moveTo(h+(d||x),v+(m||M));for(var w=1;w0?1:-1,c=i>0?1:-1,u=l+c===0,f=_(r.map(function(d){return kt(d,0,Math.min(Math.abs(a)/2,Math.abs(o)/2))}),4),h=f[0],v=f[1],p=f[2],y=f[3];t.moveTo(l*h,0),t.lineTo(a-l*v,0),v!==0&&t.arc(a-l*v,c*v,v,-c*Math.PI/2,l>0?0:Math.PI,u),t.lineTo(a,o-c*p),p!==0&&t.arc(a-l*p,o-c*p,p,l>0?0:Math.PI,c>0?Math.PI/2:1.5*Math.PI,u),t.lineTo(l*y,o),y!==0&&t.arc(l*y,o-c*y,y,c>0?Math.PI/2:-Math.PI/2,l>0?Math.PI:0,u),t.lineTo(0,c*h),h!==0&&t.arc(l*h,c*h,h,l>0?Math.PI:0,c>0?Math.PI*1.5:Math.PI/2,u)}}var tv=function(t){W(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.name="canvas-path-generator",r}return e.prototype.init=function(){var r,n=(r={},r[R.CIRCLE]=qh,r[R.ELLIPSE]=$h,r[R.RECT]=jh,r[R.LINE]=Kh,r[R.POLYLINE]=Jh,r[R.POLYGON]=Qh,r[R.PATH]=Zh,r[R.TEXT]=void 0,r[R.GROUP]=void 0,r[R.IMAGE]=void 0,r[R.HTML]=void 0,r[R.MESH]=void 0,r);this.context.pathGeneratorFactory=n},e.prototype.destroy=function(){delete this.context.pathGeneratorFactory},e}(Le),ev=q(),rv=q(),nv=q(),iv=nt(),av=function(){function t(){var e=this;this.isHit=function(r,n,i,a){var o=e.context.pointInPathPickerFactory[r.nodeName];if(o){var s=jt(iv,i),l=Ut(rv,qt(nv,n[0],n[1],0),s),c=r.getGeometryBounds().halfExtents,u=r.parsedStyle.anchor;if(l[0]+=(u&&u[0]||0)*c[0]*2,l[1]+=(u&&u[1]||0)*c[1]*2,o(r,new pt(l[0],l[1]),a,e.isPointInPath,e.context,e.runtime))return!0}return!1},this.isPointInPath=function(r,n){var i=e.runtime.offscreenCanvasCreator.getOrCreateContext(e.context.config.offscreenCanvas),a=e.context.pathGeneratorFactory[r.nodeName];return a&&(i.beginPath(),a(i,r.parsedStyle),i.closePath()),i.isPointInPath(n.x,n.y)}}return t.prototype.apply=function(e,r){var n=this,i,a=e.renderingService,o=e.renderingContext;this.context=e,this.runtime=r;var s=(i=o.root)===null||i===void 0?void 0:i.ownerDocument;a.hooks.pick.tapPromise(t.tag,function(l){return fr(n,void 0,void 0,function(){return hr(this,function(c){return[2,this.pick(s,l)]})})}),a.hooks.pickSync.tap(t.tag,function(l){return n.pick(s,l)})},t.prototype.pick=function(e,r){var n,i,a=r.topmost,o=r.position,s=o.x,l=o.y,c=qt(ev,s,l,0),u=e.elementsFromBBox(c[0],c[1],c[0],c[1]),f=[];try{for(var h=de(u),v=h.next();!v.done;v=h.next()){var p=v.value,y=p.getWorldTransform(),d=this.isHit(p,c,y,!1);if(d){var m=Ho(p);if(m){var x=m.parsedStyle.clipPath,M=this.isHit(x,c,x.getWorldTransform(),!0);if(M){if(a)return r.picked=[p],r;f.push(p)}}else{if(a)return r.picked=[p],r;f.push(p)}}}}catch(P){n={error:P}}finally{try{v&&!v.done&&(i=h.return)&&i.call(h)}finally{if(n)throw n.error}}return r.picked=f,r},t.tag="CanvasPicker",t}();function ov(t,e,r){var n=t.parsedStyle,i=n.r,a=n.fill,o=n.stroke,s=n.lineWidth,l=n.increasedLineWidthForHitTesting,c=n.pointerEvents,u=((s||0)+(l||0))/2,f=ce(i,i,e.x,e.y),h=_(_e(c,a,o),2),v=h[0],p=h[1];return v&&p||r?f<=i+u:v?f<=i:p?f>=i-u&&f<=i+u:!1}function Fr(t,e,r,n){return t/(r*r)+e/(n*n)}function sv(t,e,r){var n=t.parsedStyle,i=n.rx,a=n.ry,o=n.fill,s=n.stroke,l=n.lineWidth,c=n.increasedLineWidthForHitTesting,u=n.pointerEvents,f=e.x,h=e.y,v=_(_e(u,o,s),2),p=v[0],y=v[1],d=((l||0)+(c||0))/2,m=(f-i)*(f-i),x=(h-a)*(h-a);return p&&y||r?Fr(m,x,i+d,a+d)<=1:p?Fr(m,x,i,a)<=1:y?Fr(m,x,i-d,a-d)>=1&&Fr(m,x,i+d,a+d)<=1:!1}function Ae(t,e,r,n,i,a){return i>=t&&i<=t+r&&a>=e&&a<=e+n}function lv(t,e,r,n,i,a,o){var s=i/2;return Ae(t-s,e-s,r,i,a,o)||Ae(t+r-s,e-s,i,n,a,o)||Ae(t+s,e+n-s,r,i,a,o)||Ae(t-s,e+s,i,n,a,o)}function Br(t,e,r,n,i,a,o,s){var l=(Math.atan2(s-e,o-t)+Math.PI*2)%(Math.PI*2),c={x:t+r*Math.cos(l),y:e+r*Math.sin(l)};return ce(c.x,c.y,o,s)<=a/2}function ye(t,e,r,n,i,a,o){var s=Math.min(t,r),l=Math.max(t,r),c=Math.min(e,n),u=Math.max(e,n),f=i/2;return a>=s-f&&a<=l+f&&o>=c-f&&o<=u+f?Lc(t,e,r,n,a,o)<=i/2:!1}function es(t,e,r,n,i){var a=t.length;if(a<2)return!1;for(var o=0;o0!=zn(s[1]-r)>0&&zn(e-(r-o[1])*(o[0]-s[0])/(o[1]-s[1])-o[0])<0&&(n=!n)}return n}function Ia(t,e,r){for(var n=!1,i=0;iP&&b>E,y&&(y.resetTransform?y.resetTransform():y.setTransform(1,0,0,1,0,0),n.clearFullScreen&&n.clearRect(y,0,0,m*d,x*d,i.background))});var p=function(y,d){y.isVisible()&&!y.isCulled()&&(n.renderDisplayObject(y,d,n.context,n.restoreStack,r),n.saveDirtyAABB(y));var m=y.sortable.sorted||y.childNodes;m.forEach(function(x){p(x,d)})};o.hooks.endFrame.tap(t.tag,function(){var y=u.getContext(),d=u.getDPR();if(no(n.dprMatrix,[d,d,1]),Et(n.vpMatrix,n.dprMatrix,a.getOrthoMatrix()),n.clearFullScreen)p(s.root,y);else{var m=n.safeMergeAABB.apply(n,X([n.mergeDirtyAABBs(n.renderQueue)],_(n.removedRBushNodeAABBs.map(function(rt){var St=rt.minX,Ht=rt.minY,$t=rt.maxX,Kt=rt.maxY,zt=new ht;return zt.setMinMax([St,Ht,0],[$t,Kt,0]),zt})),!1));if(n.removedRBushNodeAABBs=[],ht.isEmpty(m)){n.renderQueue=[];return}var x=n.convertAABB2Rect(m),M=x.x,P=x.y,E=x.width,g=x.height,w=Ut(n.vec3a,[M,P,0],n.vpMatrix),T=Ut(n.vec3b,[M+E,P,0],n.vpMatrix),b=Ut(n.vec3c,[M,P+g,0],n.vpMatrix),C=Ut(n.vec3d,[M+E,P+g,0],n.vpMatrix),S=Math.min(w[0],T[0],C[0],b[0]),N=Math.min(w[1],T[1],C[1],b[1]),O=Math.max(w[0],T[0],C[0],b[0]),k=Math.max(w[1],T[1],C[1],b[1]),B=Math.floor(S),Y=Math.floor(N),I=Math.ceil(O-S),G=Math.ceil(k-N);y.save(),n.clearRect(y,B,Y,I,G,i.background),y.beginPath(),y.rect(B,Y,I,G),y.clip(),y.setTransform(n.vpMatrix[0],n.vpMatrix[1],n.vpMatrix[4],n.vpMatrix[5],n.vpMatrix[12],n.vpMatrix[13]);var H=i.renderer.getConfig().enableDirtyRectangleRenderingDebug;H&&f.dispatchEvent(new mt(Tt.DIRTY_RECTANGLE,{dirtyRect:{x:B,y:Y,width:I,height:G}}));var ct=n.searchDirtyObjects(m);ct.sort(function(rt,St){return rt.sortable.renderOrder-St.sortable.renderOrder}).forEach(function(rt){rt&&rt.isVisible()&&!rt.isCulled()&&n.renderDisplayObject(rt,y,n.context,n.restoreStack,r)}),y.restore(),n.renderQueue.forEach(function(rt){n.saveDirtyAABB(rt)}),n.renderQueue=[]}n.restoreStack.forEach(function(){y.restore()}),n.restoreStack=[]}),o.hooks.render.tap(t.tag,function(y){n.clearFullScreen||n.renderQueue.push(y)})},t.prototype.clearRect=function(e,r,n,i,a,o){e.clearRect(r,n,i,a),o&&(e.fillStyle=o,e.fillRect(r,n,i,a))},t.prototype.renderDisplayObject=function(e,r,n,i,a){var o=e.nodeName,s=i[i.length-1];s&&!(e.compareDocumentPosition(s)&Node.DOCUMENT_POSITION_CONTAINS)&&(r.restore(),i.pop());var l=this.context.styleRendererFactory[o],c=this.pathGeneratorFactory[o],u=e.parsedStyle.clipPath;if(u){this.applyWorldTransform(r,u);var f=this.pathGeneratorFactory[u.nodeName];f&&(r.save(),i.push(e),r.beginPath(),f(r,u.parsedStyle),r.closePath(),r.clip())}l&&(this.applyWorldTransform(r,e),r.save(),this.applyAttributesToContext(r,e)),c&&(r.beginPath(),c(r,e.parsedStyle),e.nodeName!==R.LINE&&e.nodeName!==R.PATH&&e.nodeName!==R.POLYLINE&&r.closePath()),l&&(l.render(r,e.parsedStyle,e,n,this,a),r.restore()),e.renderable.dirty=!1},t.prototype.convertAABB2Rect=function(e){var r=e.getMin(),n=e.getMax(),i=2,a=Math.floor(r[0])-i,o=Math.floor(r[1])-i,s=Math.ceil(n[0])+i,l=Math.ceil(n[1])+i,c=s-a,u=l-o;return{x:a,y:o,width:c,height:u}},t.prototype.mergeDirtyAABBs=function(e){var r=new ht;return e.forEach(function(n){var i=n.getRenderBounds();r.add(i);var a=n.renderable.dirtyRenderBounds;a&&r.add(a)}),r},t.prototype.searchDirtyObjects=function(e){var r=_(e.getMin(),2),n=r[0],i=r[1],a=_(e.getMax(),2),o=a[0],s=a[1],l=this.rBush.search({minX:n,minY:i,maxX:o,maxY:s});return l.map(function(c){var u=c.displayObject;return u})},t.prototype.saveDirtyAABB=function(e){var r=e.renderable;r.dirtyRenderBounds||(r.dirtyRenderBounds=new ht);var n=e.getRenderBounds();n&&r.dirtyRenderBounds.update(n.center,n.halfExtents)},t.prototype.applyAttributesToContext=function(e,r){var n=r.parsedStyle,i=n.stroke,a=n.fill,o=n.opacity,s=n.lineDash,l=n.lineDashOffset;s&&e.setLineDash(s),F(l)||(e.lineDashOffset=l),F(o)||(e.globalAlpha*=o),!F(i)&&!Array.isArray(i)&&!i.isNone&&(e.strokeStyle=r.attributes.stroke),!F(a)&&!Array.isArray(a)&&!a.isNone&&(e.fillStyle=r.attributes.fill)},t.prototype.applyWorldTransform=function(e,r,n){var i=0,a=0,o=(r.parsedStyle||{}).anchor,s=o&&o[0]||0,l=o&&o[1]||0;if(s!==0||l!==0){var c=r.geometry.contentBounds,u=c&&c.halfExtents[0]*2||0,f=c&&c.halfExtents[1]*2||0;i=-(s*u),a=-(l*f)}n?(Ke(this.tmpMat4,r.getLocalTransform()),this.vec3a[0]=i,this.vec3a[1]=a,this.vec3a[2]=0,We(this.tmpMat4,this.tmpMat4,this.vec3a),Et(this.tmpMat4,n,this.tmpMat4),Et(this.tmpMat4,this.vpMatrix,this.tmpMat4)):(Ke(this.tmpMat4,r.getWorldTransform()),this.vec3a[0]=i,this.vec3a[1]=a,this.vec3a[2]=0,We(this.tmpMat4,this.tmpMat4,this.vec3a),Et(this.tmpMat4,this.vpMatrix,this.tmpMat4)),e.setTransform(this.tmpMat4[0],this.tmpMat4[1],this.tmpMat4[4],this.tmpMat4[5],this.tmpMat4[12],this.tmpMat4[13])},t.prototype.safeMergeAABB=function(){for(var e=[],r=0;r0,w=s.alpha===0,T=!!(M&&M.length),b=!F(m)&&x>0,C=n.nodeName,S=d==="inner",N=g&&b&&(C===R.PATH||C===R.LINE||C===R.POLYLINE||w||S);E&&(e.globalAlpha=c*u,N||vn(n,e,b),this.fill(e,n,s,l,i,a,o),N||this.clearShadowAndFilter(e,T,b)),g&&(e.globalAlpha=c*h,e.lineWidth=v,F(P)||(e.miterLimit=P),F(p)||(e.lineCap=p),F(y)||(e.lineJoin=y),N&&(S&&(e.globalCompositeOperation="source-atop"),vn(n,e,!0),S&&(this.stroke(e,n,f,i,a,o),e.globalCompositeOperation="source-over",this.clearShadowAndFilter(e,T,!0))),this.stroke(e,n,f,i,a,o))},t.prototype.clearShadowAndFilter=function(e,r,n){if(n&&(e.shadowColor="transparent",e.shadowBlur=0),r){var i=e.filter;!F(i)&&i.indexOf("drop-shadow")>-1&&(e.filter=i.replace(/drop-shadow\([^)]*\)/,"").trim()||"none")}},t.prototype.fill=function(e,r,n,i,a,o,s){var l=this;Array.isArray(n)?n.forEach(function(c){e.fillStyle=l.getColor(c,r,e),i?e.fill(i):e.fill()}):(yr(n)&&(e.fillStyle=this.getPattern(n,r,e,a,o,s)),i?e.fill(i):e.fill())},t.prototype.stroke=function(e,r,n,i,a,o){var s=this;Array.isArray(n)?n.forEach(function(l){e.strokeStyle=s.getColor(l,r,e),e.stroke()}):(yr(n)&&(e.strokeStyle=this.getPattern(n,r,e,i,a,o)),e.stroke())},t.prototype.getPattern=function(e,r,n,i,a,o){var s,l;if(e.image.nodeName==="rect"){var c=e.image.parsedStyle,u=c.width,f=c.height;l=i.contextService.getDPR();var h=i.config.offscreenCanvas;s=o.offscreenCanvasCreator.getOrCreateCanvas(h),s.width=u*l,s.height=f*l;var v=o.offscreenCanvasCreator.getOrCreateContext(h),p=[];e.image.forEach(function(d){a.renderDisplayObject(d,v,i,p,o)}),p.forEach(function(){v.restore()})}var y=this.imagePool.getOrCreatePatternSync(e,n,s,l,function(){r.renderable.dirty=!0,i.renderingService.dirtify()});return y},t.prototype.getColor=function(e,r,n){var i;if(e.type===ee.LinearGradient||e.type===ee.RadialGradient){var a=r.getGeometryBounds(),o=a&&a.halfExtents[0]*2||1,s=a&&a.halfExtents[1]*2||1;i=this.imagePool.getOrCreateGradient(U(U({type:e.type},e.value),{width:o,height:s}),n)}return i},t}();function vn(t,e,r){var n=t.parsedStyle,i=n.filter,a=n.shadowColor,o=n.shadowBlur,s=n.shadowOffsetX,l=n.shadowOffsetY;i&&i.length&&(e.filter=t.style.filter),r&&(e.shadowColor=a.toString(),e.shadowBlur=o||0,e.shadowOffsetX=s||0,e.shadowOffsetY=l||0)}var Mv=function(){function t(e){this.imagePool=e}return t.prototype.render=function(e,r,n){var i=r.width,a=r.height,o=r.img,s=r.shadowColor,l=r.shadowBlur,c,u=i,f=a;if(bt(o)?c=this.imagePool.getImageSync(o):(u||(u=o.width),f||(f=o.height),c=o),c){var h=!F(s)&&l>0;vn(n,e,h);try{e.drawImage(c,0,0,u,f)}catch{}}},t}(),Pv=function(){function t(){}return t.prototype.render=function(e,r,n,i,a,o){var s=r,l=s.lineWidth,c=s.textAlign,u=s.textBaseline,f=s.lineJoin,h=s.miterLimit,v=s.letterSpacing,p=s.stroke,y=s.fill,d=s.fillOpacity,m=s.strokeOpacity,x=s.opacity,M=s.metrics,P=s.dx,E=s.dy,g=s.shadowColor,w=s.shadowBlur,T=M.font,b=M.lines,C=M.height,S=M.lineHeight,N=M.lineMetrics;e.font=T,e.lineWidth=l,e.textAlign=c==="middle"?"center":c;var O=u;!o.enableCSSParsing&&O==="alphabetic"&&(O="bottom"),e.lineJoin=f,F(h)||(e.miterLimit=h);var k=0;u==="middle"?k=-C/2-S/2:u==="bottom"||u==="alphabetic"||u==="ideographic"?k=-C:(u==="top"||u==="hanging")&&(k=-S);var B=P||0;k+=E||0,b.length===1&&(O==="bottom"?(O="middle",k-=.5*C):O==="top"&&(O="middle",k+=.5*C)),e.textBaseline=O;var Y=!F(g)&&w>0;vn(n,e,Y);for(var I=0;I=1?Math.ceil(i):1,this.dpr=i,this.$canvas&&(this.$canvas.width=this.dpr*e,this.$canvas.height=this.dpr*r,Sf(this.$canvas,e,r)),this.renderingContext.renderReasons.add(ge.CAMERA_CHANGED)},t.prototype.applyCursorStyle=function(e){this.$container&&this.$container.style&&(this.$container.style.cursor=e)},t.prototype.toDataURL=function(e){return e===void 0&&(e={}),fr(this,void 0,void 0,function(){var r,n;return hr(this,function(i){return r=e.type,n=e.encoderOptions,[2,this.context.canvas.toDataURL(r,n)]})})},t}(),Iv=function(t){W(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.name="canvas-context-register",r}return e.prototype.init=function(){this.context.ContextService=kv},e.prototype.destroy=function(){delete this.context.ContextService},e}(Le),Pe=function(t){W(e,t);function e(r){var n=t.call(this,r)||this;return n.registerPlugin(new Iv),n.registerPlugin(new Ov),n.registerPlugin(new tv),n.registerPlugin(new wv),n.registerPlugin(new bv),n.registerPlugin(new xv),n.registerPlugin(new Nv),n}return e}(Vc);const ns="https://dogefs.s3.ladydaily.com/~/source/unsplash/photo-1459749411175-04bf5292ceea?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=320&h=320&q=80";function we(t,{x:e,y:r,r:n,shadowColor:i}){const a=i?{shadowColor:i,shadowBlur:16}:{},o=new xe({style:{cx:e,cy:r,r:n,fill:"#262626",...a}}),s=new Qo({id:"audioImg",style:{x:e-n,y:r-n,width:2*n,height:2*n,transformOrigin:"center",clipPath:new xe({style:{cx:e,cy:r,r:n}}),img:ns}});t==null||t.appendChild(o),t==null||t.appendChild(s);const l=s==null?void 0:s.animate([{transform:"rotate(0)"},{transform:"rotate(360deg)"}],{duration:12e3,iterations:1/0});return setTimeout(()=>{l==null||l.pause()}),s}const Z=150,Q=150,et=80;function Te(t,e,r,n){React.useEffect(()=>{setTimeout(()=>{var a;const i=(a=e.current)==null?void 0:a.getAnimations();if(i&&i.length){const o=i[0];r?o.play():o.pause()}})},[r]),React.useEffect(()=>{var a;const i=(a=t.current)==null?void 0:a.document.querySelector("#audioImg");i&&i.setAttribute("img",n)},[n])}function Lv(t){const i="#e9dcf7",a=React.useRef(),o=React.useRef(),s=React.useRef([]);function l(c){return c.reduce((f,h,v)=>(v%2&&f.push(h),f),[])}return React.useEffect(()=>{var c;(c=t.data)!=null&&c.length&&l(t.data).map((f,h)=>{s.current[h].attr("height",f*f/65025*50+4)})},[t.data]),React.useEffect(()=>{a.current=new Ee({container:"SLine",width:2*Z,height:2*Q,renderer:new Pe}),o.current=we(a.current,{x:Z,y:Q,r:et,shadowColor:i}),s.current=Array.from({length:64},(c,u)=>{var d;const f=u*5.625-150,h=Math.cos(f*Math.PI/180),v=Math.sin(f*Math.PI/180),p=et+10,y=new jo({style:{width:4,height:4,radius:4/2,x:Z+h*p,y:Q+v*p,fill:i}});return y.setOrigin(Z+h*p,Q+v*p),y.rotate(f-90),(d=a.current)==null||d.appendChild(y),y})},[]),Te(a,o,t.isPlaying,t.audioImg),V.jsx("div",{id:"SLine",className:"s-canvas-wrapper"})}function Mn(t,e=5,r=.8){if(e<3||e>13||e%2===0)throw new Error("num value muse be singular, num >= 3, num <= 13");return t.map((n,i)=>{const a=i%e,o=(e-1)/2-a,s=t[i+o];return~~(s?s*r**Math.abs(o):n)})}function _v(t,e,r){return`M ${t-r}, ${e} + a ${r}, ${r} 0 1, 0 ${r*2}, 0 + a ${r}, ${r} 0 1, 0 ${-r*2}, 0`}const pi=Math.PI,yi=2*pi,Re=1e-6,Dv=yi-Re;function gi(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function is(){return new gi}gi.prototype=is.prototype={constructor:gi,moveTo:function(t,e){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)},closePath:function(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(t,e){this._+="L"+(this._x1=+t)+","+(this._y1=+e)},quadraticCurveTo:function(t,e,r,n){this._+="Q"+ +t+","+ +e+","+(this._x1=+r)+","+(this._y1=+n)},bezierCurveTo:function(t,e,r,n,i,a){this._+="C"+ +t+","+ +e+","+ +r+","+ +n+","+(this._x1=+i)+","+(this._y1=+a)},arcTo:function(t,e,r,n,i){t=+t,e=+e,r=+r,n=+n,i=+i;var a=this._x1,o=this._y1,s=r-t,l=n-e,c=a-t,u=o-e,f=c*c+u*u;if(i<0)throw new Error("negative radius: "+i);if(this._x1===null)this._+="M"+(this._x1=t)+","+(this._y1=e);else if(f>Re)if(!(Math.abs(u*s-l*c)>Re)||!i)this._+="L"+(this._x1=t)+","+(this._y1=e);else{var h=r-a,v=n-o,p=s*s+l*l,y=h*h+v*v,d=Math.sqrt(p),m=Math.sqrt(f),x=i*Math.tan((pi-Math.acos((p+f-y)/(2*d*m)))/2),M=x/m,P=x/d;Math.abs(M-1)>Re&&(this._+="L"+(t+M*c)+","+(e+M*u)),this._+="A"+i+","+i+",0,0,"+ +(u*h>c*v)+","+(this._x1=t+P*s)+","+(this._y1=e+P*l)}},arc:function(t,e,r,n,i,a){t=+t,e=+e,r=+r,a=!!a;var o=r*Math.cos(n),s=r*Math.sin(n),l=t+o,c=e+s,u=1^a,f=a?n-i:i-n;if(r<0)throw new Error("negative radius: "+r);this._x1===null?this._+="M"+l+","+c:(Math.abs(this._x1-l)>Re||Math.abs(this._y1-c)>Re)&&(this._+="L"+l+","+c),r&&(f<0&&(f=f%yi+yi),f>Dv?this._+="A"+r+","+r+",0,1,"+u+","+(t-o)+","+(e-s)+"A"+r+","+r+",0,1,"+u+","+(this._x1=l)+","+(this._y1=c):f>Re&&(this._+="A"+r+","+r+",0,"+ +(f>=pi)+","+u+","+(this._x1=t+r*Math.cos(i))+","+(this._y1=e+r*Math.sin(i))))},rect:function(t,e,r,n){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)+"h"+ +r+"v"+ +n+"h"+-r+"Z"},toString:function(){return this._}};function Ue(t){return function(){return t}}function Fv(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function as(t){this._context=t}as.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e);break}}};function Bv(t){return new as(t)}function Gv(t){return t[0]}function Uv(t){return t[1]}function gr(t,e){var r=Ue(!0),n=null,i=Bv,a=null;t=typeof t=="function"?t:t===void 0?Gv:Ue(t),e=typeof e=="function"?e:e===void 0?Uv:Ue(e);function o(s){var l,c=(s=Fv(s)).length,u,f=!1,h;for(n==null&&(a=i(h=is())),l=0;l<=c;++l)!(l{v%2&&f.push(h)}),Mn(f,5,.75)}function c(u,f=0){const h=u*5.625-150,v=Math.cos(h*Math.PI/180),p=Math.sin(h*Math.PI/180),y=et+4+f;return[Z+v*y,Q+p*y]}return React.useEffect(()=>{var u;if((u=t.data)!=null&&u.length){const f=[[],[],[],[]];l(t.data).map((h,v)=>{f[v%4].push(c(v,h*h/65025*42+4))}),f.map((h,v)=>{var y;const p=gr().x(d=>d[0]).y(d=>d[1]).curve(mr)(h);p&&((y=s.current[v])==null||y.attr("path",p))})}},[t.data]),React.useEffect(()=>{a.current=new Ee({container:"SPath",width:2*Z,height:2*Q,renderer:new Pe}),o.current=we(a.current,{x:Z,y:Q,r:et,shadowColor:i[0]});const u=Array.from({length:64/4},(h,v)=>c(v*4)),f=gr().x(h=>h[0]).y(h=>h[1]).curve(mr)(u);Array.from({length:4},(h,v)=>{var p;if(f){const y=new En({style:{stroke:i[v],lineWidth:1,path:f}});(p=a.current)==null||p.appendChild(y),s.current.push(y)}})},[]),Te(a,o,t.isPlaying,t.audioImg),V.jsx("div",{id:"SPath",className:"s-canvas-wrapper"})}function Hv(t){const n=["#90E3F5","#5C8AF4","#BEABF0","#E1A2E1"],i=React.useRef(),a=React.useRef(),o=React.useRef([]);function s(c){let u=[];return c.map((f,h)=>{h%2&&u.push(f)}),Mn(u,5,.75)}function l(c,u=0){const f=c*5.625-150,h=Math.cos(f*Math.PI/180),v=Math.sin(f*Math.PI/180),p=et+u;return[Z+h*p,Q+v*p]}return React.useEffect(()=>{var c;if((c=t.data)!=null&&c.length){const u=[[],[],[],[]];s(t.data).map((f,h)=>{u[h%4].push(l(h,f*f/65025*60))}),u.map((f,h)=>{const v=gr().x(p=>p[0]).y(p=>p[1]).curve(mr)(f);v&&o.current[h].attr("path",v)})}},[t.data]),React.useEffect(()=>{i.current=new Ee({container:"SPathFill",width:2*Z,height:2*Q,renderer:new Pe});const c=Array.from({length:64/4},(f,h)=>l(h*4)),u=gr().x(f=>f[0]).y(f=>f[1]).curve(mr)(c);Array.from({length:4},(f,h)=>{var v;if(u){const p=new En({style:{stroke:n[h],lineWidth:2,path:u,fill:"rgba(255,255,255,0.2)"}});(v=i.current)==null||v.appendChild(p),o.current.push(p)}}),a.current=we(i.current,{x:Z,y:Q,r:et,shadowColor:"#ffffff"})},[]),Te(i,a,t.isPlaying,t.audioImg),V.jsx("div",{id:"SPathFill",className:"s-canvas-wrapper"})}function ls(){const[t,e]=React.useState(()=>document.visibilityState==="visible");return React.useEffect(()=>{const r=()=>e(document.visibilityState==="visible");return document.addEventListener("visibilitychange",r),()=>{document.removeEventListener("visibilitychange",r)}}),t}class xi{constructor(e,r){Xt(this,"timerId");Xt(this,"remaining");Xt(this,"start");Xt(this,"callback");Xt(this,"complete");this.complete=!1,this.remaining=r,this.callback=()=>{this.complete=!0,e()},this.start=Date.now(),this.timerId=setTimeout(this.callback,this.remaining)}pause(){clearTimeout(this.timerId),this.remaining-=Date.now()-this.start}play(){clearTimeout(this.timerId),this.remaining>0&&(this.start=Date.now(),this.timerId=setTimeout(this.callback,this.remaining))}}function zv(t){const e="#fff",r="#fa7",s=React.useRef(),l=React.useRef(),c=React.useRef([]),u=React.useRef([]),f=()=>{const d=u.current||[],m=d.sort((g,w)=>w-g).slice(0,10),x=~~(Math.random()*10),M=m[x],P=d.findIndex(g=>g===M);return~P?P*360/d.length:1};React.useEffect(()=>{u.current=t.data||[]},[t.data]),React.useEffect(()=>{if(!s.current){s.current=new Ee({container:"SCircle",width:2*Z,height:2*Q,renderer:new Pe}),l.current=we(s.current,{x:Z,y:Q,r:et,shadowColor:"#fcc8d9"});const d=()=>{var M,P;const m=new xe({style:{cx:Z,cy:Q,stroke:e,lineWidth:2,opacity:1,r:et}}),x=new xe({style:{r:5,fill:e,shadowColor:r,shadowBlur:5,opacity:0}});return(M=s.current)==null||M.appendChild(m),(P=s.current)==null||P.appendChild(x),[m,x]};Array.from({length:3},(m,x)=>{const[M,P]=d();c.current.push({circle:M,dot:P})})}t.isPlaying?h(!0):h(!1)},[t.isPlaying]),Te(s,l,t.isPlaying,t.audioImg);function h(d=!0){var x,M,P,E;const m=d?"play":"pause";for(let g=0;g{v(c.current[g].circle)},g*2e3));const T=(P=c.current[g].dot.getAnimations())==null?void 0:P[0];T?T[m]():c.current[g].dot._timer?(E=c.current[g].dot._timer)==null||E[m]():d&&(c.current[g].dot._timer=new xi(()=>{p(c.current[g].dot)},g*2e3))}}function v(d){const m=d.animate([{transform:"scale(1)",opacity:.8},{transform:"scale(2)",opacity:0}],{duration:6e3});m&&(m.onfinish=()=>{m.cancel(),v(d)})}function p(d){const m=-135+f(),x=Math.cos(m*Math.PI/180),M=Math.sin(m*Math.PI/180);d.setAttribute("cx",Z+x*et),d.setAttribute("cy",Q+M*et),d.setAttribute("transformOrigin",`${-x*et+5}px ${-M*et+5}px`);const P=d.animate([{transform:"rotate(0) translate(0, 0)",opacity:0,offset:.01},{opacity:.9,offset:.02},{transform:`rotate(360deg) translate(${x*et}, ${M*et})`,opacity:0}],{duration:2e3*3});P&&(P.onfinish=()=>{P.cancel(),p(d)})}const y=ls();return React.useEffect(()=>{t.isPlaying&&h(y)},[y]),V.jsx("div",{id:"SCircle",className:"s-canvas-wrapper"})}function Wv(t){const n="#e9dcf7",i=React.useRef(),a=React.useRef(),o=React.useRef(),s=React.useRef([]);function l(u){let f=[];return u.map((h,v)=>{v%2&&f.push(h)}),Mn(f,3,.5)}function c(u,f=0){const h=u*5.625-150,v=Math.cos(h*Math.PI/180),p=Math.sin(h*Math.PI/180),y=et+10+f;return[Z+v*y,Q+p*y]}return React.useEffect(()=>{var u,f;if((u=t.data)!=null&&u.length){const h=[],v=l(t.data);v.map((y,d)=>{const m=c(d,y*y/65025*60),x=c(d,-y*y/65025*12);h[d]=m,h[v.length+d]=x,s.current[d].attr("x1",m[0]),s.current[d].attr("y1",m[1]),s.current[d].attr("x2",x[0]),s.current[d].attr("y2",x[1])});const p=gr().x(y=>y[0]).y(y=>y[1]).curve(mr)(h);p&&((f=o.current)==null||f.attr("path",p))}},[t.data]),React.useEffect(()=>{i.current=new Ee({container:"SPathDouble",width:2*Z,height:2*Q,renderer:new Pe}),a.current=we(i.current,{x:Z,y:Q,r:et,shadowColor:n}),o.current=new En({style:{stroke:n,lineWidth:1,path:_v(Z,Q,et+10)}}),i.current.appendChild(o.current),s.current=Array.from({length:64},(u,f)=>{var v;const h=new Ai({style:{x1:Z,y1:Q-et,x2:Z,y2:Q-et,stroke:n,lineWidth:1}});return(v=i.current)==null||v.appendChild(h),h})},[]),Te(i,a,t.isPlaying,t.audioImg),V.jsx("div",{id:"SPathDouble",className:"s-canvas-wrapper"})}function Xv(t){const i="#e9dcf7",o=React.useRef(),s=React.useRef(),l=React.useRef([]),c=React.useRef([]);function u(h){return h.reduce((v,p,y)=>y%2?[...v,p]:v,[])}function f(h,v=0){const p=h*5.625-150,y=Math.cos(p*Math.PI/180),d=Math.sin(p*Math.PI/180),m=et+10+v;return[Z+y*m,Q+d*m,y,d]}return React.useEffect(()=>{var h;(h=t.data)!=null&&h.length&&u(t.data).map((v,p)=>{const[y,d]=f(p,v*v/65025*24+4);l.current[p].attr("cx",y),l.current[p].attr("cy",d),c.current[p].attr("x2",y),c.current[p].attr("y2",d)})},[t.data]),React.useEffect(()=>{o.current=new Ee({container:"SDot",width:2*Z,height:2*Q,renderer:new Pe}),s.current=we(o.current,{x:Z,y:Q,r:et,shadowColor:i}),Array.from({length:64},(h,v)=>{var E,g;const[p,y,d,m]=f(v),x=~~(v*(360/64)+210),M=new xe({style:{cx:p,cy:y,r:2,fill:i}}),P=new Ai({style:{x1:p,y1:y,x2:p,y2:y,lineWidth:2*1.4,stroke:`l(${x}) 0.3:rgba(255,255,255,0) 1:${i}`}});(E=o.current)==null||E.appendChild(M),(g=o.current)==null||g.appendChild(P),l.current.push(M),c.current.push(P)})},[]),Te(o,s,t.isPlaying,t.audioImg),V.jsx("div",{id:"SDot",className:"s-canvas-wrapper"})}function Vv(t){const n="#e9dcf7",i=React.useRef(),a=React.useRef(),o=React.useRef([]);function s(l){let c=[];return l.map((u,f)=>{f%2&&c.push(u)}),Mn(c,5,.75)}return React.useEffect(()=>{var l;if((l=t.data)!=null&&l.length){const c=s(t.data),u=64/8;c.map((f,h)=>{var v,p;if(h%u===0){const y=h/u,d=f/8,m=y*(360/8)-150,x=Math.cos(m*Math.PI/180),M=Math.sin(m*Math.PI/180);(v=o.current[y])==null||v.attr("cx",Z+x*d),(p=o.current[y])==null||p.attr("cy",Q+M*d)}})}},[t.data]),React.useEffect(()=>{i.current=new Ee({container:"SCircleMultiple",width:2*Z,height:2*Q,renderer:new Pe}),o.current=Array.from({length:8},(l,c)=>{var f;const u=new xe({style:{cx:Z,cy:Q,r:et+8,stroke:n,strokeWidth:1,shadowColor:"#ffaa44",shadowBlur:2}});return(f=i.current)==null||f.appendChild(u),u}),a.current=we(i.current,{x:Z,y:Q,r:et,shadowColor:n})},[]),Te(i,a,t.isPlaying,t.audioImg),V.jsx("div",{id:"SCircleMultiple",className:"s-canvas-wrapper"})}function qv(t){const l=React.useRef(),c=React.useRef(),u=React.useRef([]),f=React.useRef(-1),h=React.useRef();React.useEffect(()=>{if(t.isPlaying&&t.data&&t.data.length){if(h.current)return;h.current=setTimeout(()=>{const d=t.data?t.data.reduce((E,g,w)=>w%2?[...E,g]:E,[]):[],m=d.sort((E,g)=>g-E).slice(0,10),x=~~(Math.random()*10),M=m[x],P=d.findIndex(E=>E===M);f.current=P,h.current=void 0,clearTimeout(h.current)},300)}},[t.isPlaying,t.data]),React.useEffect(()=>{l.current||(l.current=new Ee({container:"SParticle",width:2*Z,height:2*Q,renderer:new Pe}),c.current=we(l.current,{x:Z,y:Q,r:et,shadowColor:"#fcc8d9"}),Array.from({length:48},(d,m)=>{Array.from({length:8},(x,M)=>{var S;const P=m*7.5-150+(Math.random()-.5)*10,E=Math.cos(P*Math.PI/180),g=Math.sin(P*Math.PI/180),w=et+0,T=Z+E*w,b=Q+g*w,C=new xe({style:{cx:T,cy:b,r:.64,fill:"#fff",opacity:0,transformOrigin:`${-E*et+.64}px ${-g*et+.64}px`}});C.dataset.deg=P,C.dataset.index1=m,(S=l.current)==null||S.appendChild(C),u.current.push(C)})})),t.isPlaying?v(!0):v(!1)},[t.isPlaying]),Te(l,c,t.isPlaying,t.audioImg);function v(d=!0){var x,M;const m=d?"play":"pause";for(let P=0;P{p(u.current[P])},Math.random()*4e3))}}function p(d){const m=~~d.dataset.deg,x=~~d.dataset.index1,M=Math.cos(m*Math.PI/180),P=Math.sin(m*Math.PI/180),g=x>=f.current-1&&x<=f.current+1?64:20,w=Array.from({length:4},(b,C)=>{const S=.2*(C+1),N=m+Math.sin(S*20)*6,O=Math.cos(N*Math.PI/180),k=Math.sin(N*Math.PI/180);return{transform:`translate(${O*g*S}, ${k*g*S})`,offset:S}}),T=d.animate([{transform:"translate(0, 0)",opacity:1},...w,{transform:`translate(${M*g}, ${P*g})`,opacity:0}],{duration:4e3});T&&(T.onfinish=()=>{T.cancel(),p(d)})}const y=ls();return React.useEffect(()=>{t.isPlaying&&v(y)},[y]),V.jsx("div",{id:"SParticle",className:"s-canvas-wrapper"})}const $v=` +`;function Kv(t){const e=t.trim().slice(1,-1),r=e.indexOf(":");return[e.substring(0,r).trim(),e.substring(r+1).trim()]}function Zv(t){if(typeof t!="string")throw new TypeError("expect first argument to be a string");let e=t.split($v);const r=/\[(\d*\:\d*\.?\d*)\]/,n=/(.+)/,i=r,a=new RegExp(r.source+n.source),o=[],s=[],l={};for(let u=0;a.test(e[u])===!1;u++)o.push(e[u]);o.reduce((u,f)=>{const[h,v]=Kv(f);return u[h]=v,u},l),e.splice(0,o.length);const c=new RegExp(a.source+"|"+i.source);e=e.filter(u=>c.test(u));for(let u=0,f=e.length;u1&&(m=x[1],d=y.replace(`(${m})`,""));const[,M]=v;s.push({start:_a(p),text:d,translateText:m,end:_a(M)})}}return l.scripts=s,l}function _a(t){const e=t.split(":"),r=parseInt(e[0],10),n=parseFloat(e[1]);if(r>0){const i=r*60+n;return parseFloat(i.toFixed(2))}return n}let ue=-1,Qt=null;const Qv=React.forwardRef((t,e)=>{React.useImperativeHandle(e,()=>({onUpdateTime:n}));const r=React.useRef(null),n=a=>{if(!(~ue&&t.lrcContent[ue]&&t.lrcContent[ue].start<=a&&t.lrcContent[ue].end>=a)){ue=-1;for(let o=0;o=t.lrcContent[o].start&&a<=t.lrcContent[o].end){ue=o;break}if(~ue){const o=t.lrcContent[ue],s=o.end-o.start,l=(a-o.start)/s*100;i(o.text,s,l)}else i("",0)}};function i(a,o,s=0){r.current&&(r.current.innerHTML=a,Qt=r.current.animate([{backgroundSize:`${s}% 100%`},{backgroundSize:"100% 100%"}],{duration:o*1e3,easing:"cubic-bezier(0.34, 0.08, 0.41, 0.82)"}))}return React.useEffect(()=>{i("",0),Qt==null||Qt.pause()},[t.lrcContent]),React.useEffect(()=>{t.isPlaying?Qt==null||Qt.play():Qt==null||Qt.pause()},[t.isPlaying]),V.jsx("div",{ref:r,className:"lyric-content"})}),Da=new _s,Jv=[Lv,Wv,Yv,Hv,Xv,zv,Vv,qv];function jv(){const t=React.useRef(null);React.useEffect(()=>{Da.setAudioEl(t.current)},[]);const[e,r]=React.useState("Please load a music..."),[n,i]=React.useState(),[a,o]=React.useState([]),[s,l]=React.useState(ns),[c,u]=React.useState(!1),[f,h]=React.useState([]),[v,p]=React.useState([]),y=React.useRef(null),d=React.useRef(null);let m,x=React.useRef();function M(N){m||(m=N);const O=N-m;(O===0||O>0)&&(o([...Da.getVisualizeValue()]),m=N),x.current=requestAnimationFrame(M)}function P(){u(!0),x.current=requestAnimationFrame(M)}function E(){u(!1),x.current&&cancelAnimationFrame(x.current)}async function g(){try{const N=await(await fetch("https://api.injahow.cn/meting/?type=playlist&id=8577182717")).json();N&&N.length>0&&h(N)}catch{}}React.useEffect(()=>{g()},[]);async function w(){var N;try{let O="",k="",B="";if(f&&f.length>0){const Y=~~[Math.random()*f.length],{name:I,url:G,artist:H,pic:ct,lrc:rt}=f[Y];S(rt);const{url:St}=await fetch(ct,{method:"HEAD"});O=`${I} - ${H}`,k=G,B=St.split("?")[0]+"?param=400y400"}else throw new Error("Can not get play list");r(O),i(k),l(B),E()}catch(O){console.error(O),(N=t.current)==null||N.pause(),E(),alert("API busy...")}}function T(){var N;(N=y.current)==null||N.click()}function b(N){const O=N.target.files[0],k=URL.createObjectURL(O);r(O.name),i(k)}function C(){var O,k;const N=(O=t.current)==null?void 0:O.currentTime;typeof N<"u"&&((k=d.current)==null||k.onUpdateTime(N))}async function S(N){try{const O=await(await fetch(N)).text(),k=Zv(O);k.scripts&&k.scripts.length>0?p(k.scripts):p([])}catch(O){console.error(O),p([])}}return V.jsxs(V.Fragment,{children:[V.jsxs("main",{className:De.page,children:[V.jsxs("div",{className:De.operationWrapper,children:[V.jsx("button",{className:"btn m10",onClick:w,children:"Random an online music"}),V.jsx("button",{className:"btn m10",onClick:T,children:"Choose a local muisc"}),V.jsx("div",{className:"strong-text m10",style:{minWidth:"200px"},children:e}),V.jsx("input",{type:"file",style:{display:"none"},ref:y,onChange:b})]}),V.jsxs("div",{className:De.audioWrapper,children:[V.jsx("audio",{controls:!0,onPlay:P,onPause:E,ref:t,src:n,crossOrigin:"anonymous",onTimeUpdate:C}),V.jsx("div",{className:"lyric-wrapper",children:V.jsx(Qv,{isPlaying:c,lrcContent:v,ref:d})})]}),V.jsxs("div",{className:De.exampleWrapper,children:[Jv.map((N,O)=>V.jsxs("div",{className:"s-model",children:[V.jsx("div",{className:"img-bg-wrapper",children:V.jsx("img",{src:s})}),V.jsx(N,{isPlaying:c,data:a,audioImg:s})]},O)),Array.from({length:5}).map((N,O)=>V.jsx("div",{className:"s-module-fake"},O))]})]}),V.jsxs("footer",{className:De.footer,children:["©",V.jsx("a",{href:"mailto://kfd_personal@163.com",children:"Leon.D"}),V.jsxs("a",{className:De.github,href:"https://github.com/leon-kfd/g-music-visualizer",target:"_blank",children:[V.jsx("svg",{viewBox:"0 0 1024 1024",width:"20",height:"20",children:V.jsx("path",{d:"M960 512c0 97.76-28.704 185.216-85.664 263.264-56.96 78.016-130.496 131.84-220.64 161.856-10.304 1.824-18.368 0.448-22.848-4.032a22.4 22.4 0 0 1-7.2-17.504v-122.88c0-37.632-10.304-65.44-30.464-82.912a409.856 409.856 0 0 0 59.616-10.368 222.752 222.752 0 0 0 54.72-22.816c18.848-10.784 34.528-23.36 47.104-38.592 12.544-15.232 22.848-35.904 30.912-61.44 8.096-25.568 12.128-54.688 12.128-87.904 0-47.072-15.232-86.976-46.208-120.16 14.368-35.456 13.024-74.912-4.48-118.848-10.752-3.616-26.432-1.344-47.072 6.272s-38.56 16.16-53.824 25.568l-21.984 13.888c-36.32-10.304-73.536-15.232-112.096-15.232s-75.776 4.928-112.096 15.232a444.48 444.48 0 0 0-24.672-15.68c-10.336-6.272-26.464-13.888-48.896-22.432-21.952-8.96-39.008-11.232-50.24-8.064-17.024 43.936-18.368 83.424-4.032 118.848-30.496 33.632-46.176 73.536-46.176 120.608 0 33.216 4.032 62.336 12.128 87.456 8.032 25.12 18.368 45.76 30.496 61.44 12.544 15.68 28.224 28.704 47.072 39.04 18.848 10.304 37.216 17.92 54.72 22.816a409.6 409.6 0 0 0 59.648 10.368c-15.712 13.856-25.12 34.048-28.704 60.064a99.744 99.744 0 0 1-26.464 8.512 178.208 178.208 0 0 1-33.184 2.688c-13.024 0-25.568-4.032-38.144-12.544-12.544-8.512-23.296-20.64-32.256-36.32a97.472 97.472 0 0 0-28.256-30.496c-11.232-8.064-21.088-12.576-28.704-13.92l-11.648-1.792c-8.096 0-13.92 0.928-17.056 2.688-3.136 1.792-4.032 4.032-2.688 6.72s3.136 5.408 5.376 8.096 4.928 4.928 7.616 7.168l4.032 2.688c8.544 4.032 17.056 11.232 25.568 21.984 8.544 10.752 14.368 20.64 18.4 29.6l5.824 13.44c4.928 14.816 13.44 26.912 25.568 35.872 12.096 8.992 25.088 14.816 39.008 17.504 13.888 2.688 27.36 4.032 40.352 4.032s23.776-0.448 32.288-2.24l13.472-2.24c0 14.784 0 32.288 0.416 52.032 0 19.744 0.48 30.496 0.48 31.392a22.624 22.624 0 0 1-7.648 17.472c-4.928 4.48-12.992 5.824-23.296 4.032-90.144-30.048-163.68-83.84-220.64-161.888C92.256 697.216 64 609.312 64 512c0-81.152 20.192-156.064 60.096-224.672s94.176-122.88 163.232-163.232C355.936 84.192 430.816 64 512 64s156.064 20.192 224.672 60.096 122.88 94.176 163.232 163.232C939.808 355.488 960 430.848 960 512",fill:"#585862"})}),V.jsx("span",{children:" Github"})]})]})]})}const td=React.createContext({});function ed(){const[t,e]=React.useState({mainColor:"#262626"});return V.jsx(td.Provider,{value:{state:t,setState:e},children:V.jsx("div",{className:"App",children:V.jsx(jv,{})})})}var cs={exports:{}};(function(t,e){(function(r,n){t.exports=n()})(bs,function(){var r=function(){function n(v){return o.appendChild(v.dom),v}function i(v){for(var p=0;pl+1e3&&(u.update(1e3*c/(v-l),100),l=v,c=0,h)){var p=performance.memory;h.update(p.usedJSHeapSize/1048576,p.jsHeapSizeLimit/1048576)}return v},update:function(){s=this.end()},domElement:o,setMode:i}};return r.Panel=function(n,i,a){var o=1/0,s=0,l=Math.round,c=l(window.devicePixelRatio||1),u=80*c,f=48*c,h=3*c,v=2*c,p=3*c,y=15*c,d=74*c,m=30*c,x=document.createElement("canvas");x.width=u,x.height=f,x.style.cssText="width:80px;height:48px";var M=x.getContext("2d");return M.font="bold "+9*c+"px Helvetica,Arial,sans-serif",M.textBaseline="top",M.fillStyle=a,M.fillRect(0,0,u,f),M.fillStyle=i,M.fillText(n,h,v),M.fillRect(p,y,d,m),M.fillStyle=a,M.globalAlpha=.9,M.fillRect(p,y,d,m),{dom:x,update:function(P,E){o=Math.min(o,P),s=Math.max(s,P),M.fillStyle=a,M.globalAlpha=1,M.fillRect(0,0,u,y),M.fillStyle=i,M.fillText(l(P)+" "+n+" ("+l(o)+"-"+l(s)+")",h,v),M.drawImage(x,p+c,y,d-c,m,p,y,d-c,m),M.fillRect(p+d-c,y,c,m),M.fillStyle=a,M.globalAlpha=.9,M.fillRect(p+d-c,y,c,l((1-P/E)*m))}}},r})})(cs);var rd=cs.exports;const nd=Va(rd);var Wn=function(t){W(e,t);function e(r,n,i,a){var o=t.call(this,r)||this;return o.currentTime=i,o.timelineTime=a,o.target=n,o.type="finish",o.bubbles=!1,o.currentTarget=n,o.defaultPrevented=!1,o.eventPhase=o.AT_TARGET,o.timeStamp=Date.now(),o.currentTime=i,o.timelineTime=a,o}return e}(xn),id=0,ad=function(){function t(e,r){var n;this.currentTimePending=!1,this._idle=!0,this._paused=!1,this._finishedFlag=!0,this._currentTime=0,this._playbackRate=1,this._inTimeline=!0,this.effect=e,e.animation=this,this.timeline=r,this.id="".concat(id++),this._inEffect=!!this.effect.update(0),this._totalDuration=Number((n=this.effect)===null||n===void 0?void 0:n.getComputedTiming().endTime),this._holdTime=0,this._paused=!1,this.oldPlayState="idle",this.updatePromises()}return Object.defineProperty(t.prototype,"pending",{get:function(){return this._startTime===null&&!this._paused&&this.playbackRate!==0||this.currentTimePending},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"playState",{get:function(){return this._idle?"idle":this._isFinished?"finished":this._paused?"paused":"running"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ready",{get:function(){var e=this;return this.readyPromise||(this.timeline.animationsWithPromises.indexOf(this)===-1&&this.timeline.animationsWithPromises.push(this),this.readyPromise=new Promise(function(r,n){e.resolveReadyPromise=function(){r(e)},e.rejectReadyPromise=function(){n(new Error)}}),this.pending||this.resolveReadyPromise()),this.readyPromise},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"finished",{get:function(){var e=this;return this.finishedPromise||(this.timeline.animationsWithPromises.indexOf(this)===-1&&this.timeline.animationsWithPromises.push(this),this.finishedPromise=new Promise(function(r,n){e.resolveFinishedPromise=function(){r(e)},e.rejectFinishedPromise=function(){n(new Error)}}),this.playState==="finished"&&this.resolveFinishedPromise()),this.finishedPromise},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"currentTime",{get:function(){return this.updatePromises(),this._idle||this.currentTimePending?null:this._currentTime},set:function(e){var r;e=Number(e),!isNaN(e)&&(this.timeline.restart(),!this._paused&&this._startTime!==null&&(this._startTime=Number((r=this.timeline)===null||r===void 0?void 0:r.currentTime)-e/this.playbackRate),this.currentTimePending=!1,this._currentTime!==e&&(this._idle&&(this._idle=!1,this._paused=!0),this.tickCurrentTime(e,!0),this.timeline.applyDirtiedAnimation(this)))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"startTime",{get:function(){return this._startTime},set:function(e){if(e!==null){if(this.updatePromises(),e=Number(e),isNaN(e)||this._paused||this._idle)return;this._startTime=e,this.tickCurrentTime((Number(this.timeline.currentTime)-this._startTime)*this.playbackRate),this.timeline.applyDirtiedAnimation(this),this.updatePromises()}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"playbackRate",{get:function(){return this._playbackRate},set:function(e){if(e!==this._playbackRate){this.updatePromises();var r=this.currentTime;this._playbackRate=e,this.startTime=null,this.playState!=="paused"&&this.playState!=="idle"&&(this._finishedFlag=!1,this._idle=!1,this.ensureAlive(),this.timeline.applyDirtiedAnimation(this)),r!==null&&(this.currentTime=r),this.updatePromises()}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_isFinished",{get:function(){return!this._idle&&(this._playbackRate>0&&Number(this._currentTime)>=this._totalDuration||this._playbackRate<0&&Number(this._currentTime)<=0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"totalDuration",{get:function(){return this._totalDuration},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_needsTick",{get:function(){return this.pending||this.playState==="running"||!this._finishedFlag},enumerable:!1,configurable:!0}),t.prototype.updatePromises=function(){var e=this.oldPlayState,r=this.pending?"pending":this.playState;return this.readyPromise&&r!==e&&(r==="idle"?(this.rejectReadyPromise(),this.readyPromise=void 0):e==="pending"?this.resolveReadyPromise():r==="pending"&&(this.readyPromise=void 0)),this.finishedPromise&&r!==e&&(r==="idle"?(this.rejectFinishedPromise(),this.finishedPromise=void 0):r==="finished"?this.resolveFinishedPromise():e==="finished"&&(this.finishedPromise=void 0)),this.oldPlayState=r,this.readyPromise||this.finishedPromise},t.prototype.play=function(){this.updatePromises(),this._paused=!1,(this._isFinished||this._idle)&&(this.rewind(),this._startTime=null),this._finishedFlag=!1,this._idle=!1,this.ensureAlive(),this.timeline.applyDirtiedAnimation(this),this.timeline.animations.indexOf(this)===-1&&this.timeline.animations.push(this),this.updatePromises()},t.prototype.pause=function(){this.updatePromises(),this.currentTime&&(this._holdTime=this.currentTime),!this._isFinished&&!this._paused&&!this._idle?this.currentTimePending=!0:this._idle&&(this.rewind(),this._idle=!1),this._startTime=null,this._paused=!0,this.updatePromises()},t.prototype.finish=function(){this.updatePromises(),!this._idle&&(this.currentTime=this._playbackRate>0?this._totalDuration:0,this._startTime=this._totalDuration-this.currentTime,this.currentTimePending=!1,this.timeline.applyDirtiedAnimation(this),this.updatePromises())},t.prototype.cancel=function(){var e=this;if(this.updatePromises(),!!this._inEffect&&(this._inEffect=!1,this._idle=!0,this._paused=!1,this._finishedFlag=!0,this._currentTime=0,this._startTime=null,this.effect.update(null),this.timeline.applyDirtiedAnimation(this),this.updatePromises(),this.oncancel)){var r=new Wn(null,this,this.currentTime,null);setTimeout(function(){e.oncancel(r)})}},t.prototype.reverse=function(){this.updatePromises();var e=this.currentTime;this.playbackRate*=-1,this.play(),e!==null&&(this.currentTime=e),this.updatePromises()},t.prototype.updatePlaybackRate=function(e){this.playbackRate=e},t.prototype.targetAnimations=function(){var e,r=(e=this.effect)===null||e===void 0?void 0:e.target;return r.getAnimations()},t.prototype.markTarget=function(){var e=this.targetAnimations();e.indexOf(this)===-1&&e.push(this)},t.prototype.unmarkTarget=function(){var e=this.targetAnimations(),r=e.indexOf(this);r!==-1&&e.splice(r,1)},t.prototype.tick=function(e,r){!this._idle&&!this._paused&&(this._startTime===null?r&&(this.startTime=e-this._currentTime/this.playbackRate):this._isFinished||this.tickCurrentTime((e-this._startTime)*this.playbackRate)),r&&(this.currentTimePending=!1,this.fireEvents(e))},t.prototype.rewind=function(){if(this.playbackRate>=0)this.currentTime=0;else if(this._totalDuration<1/0)this.currentTime=this._totalDuration;else throw new Error("Unable to rewind negative playback rate animation with infinite duration")},t.prototype.persist=function(){throw new Error(J)},t.prototype.addEventListener=function(e,r,n){throw new Error(J)},t.prototype.removeEventListener=function(e,r,n){throw new Error(J)},t.prototype.dispatchEvent=function(e){throw new Error(J)},t.prototype.commitStyles=function(){throw new Error(J)},t.prototype.ensureAlive=function(){var e,r;this.playbackRate<0&&this.currentTime===0?this._inEffect=!!(!((e=this.effect)===null||e===void 0)&&e.update(-1)):this._inEffect=!!(!((r=this.effect)===null||r===void 0)&&r.update(this.currentTime)),!this._inTimeline&&(this._inEffect||!this._finishedFlag)&&(this._inTimeline=!0,this.timeline.animations.push(this))},t.prototype.tickCurrentTime=function(e,r){e!==this._currentTime&&(this._currentTime=e,this._isFinished&&!r&&(this._currentTime=this._playbackRate>0?this._totalDuration:0),this.ensureAlive())},t.prototype.fireEvents=function(e){var r=this;if(this._isFinished){if(!this._finishedFlag){if(this.onfinish){var n=new Wn(null,this,this.currentTime,e);setTimeout(function(){r.onfinish&&r.onfinish(n)})}this._finishedFlag=!0}}else{if(this.onframe&&this.playState==="running"){var i=new Wn(null,this,this.currentTime,e);this.onframe(i)}this._finishedFlag=!1}},t}(),od=4,sd=.001,ld=1e-7,cd=10,sr=11,Gr=1/(sr-1),ud=typeof Float32Array=="function",us=function(t,e){return 1-3*e+3*t},fs=function(t,e){return 3*e-6*t},hs=function(t){return 3*t},dn=function(t,e,r){return((us(e,r)*t+fs(e,r))*t+hs(e))*t},vs=function(t,e,r){return 3*us(e,r)*t*t+2*fs(e,r)*t+hs(e)},fd=function(t,e,r,n,i){var a,o,s=0;do o=e+(r-e)/2,a=dn(o,n,i)-t,a>0?r=o:e=o;while(Math.abs(a)>ld&&++s=sd?hd(s,h,t,r):v===0?h:fd(s,l,l+Gr,t,r)};return function(s){return s===0||s===1?s:dn(o(s),e,n)}},vd=function(t){return t=t.replace(/([A-Z])/g,function(e){return"-".concat(e.toLowerCase())}),t.charAt(0)==="-"?t.substring(1):t},Ur=function(t){return Math.pow(t,2)},Yr=function(t){return Math.pow(t,3)},Hr=function(t){return Math.pow(t,4)},zr=function(t){return Math.pow(t,5)},Wr=function(t){return Math.pow(t,6)},Xr=function(t){return 1-Math.cos(t*Math.PI/2)},Vr=function(t){return 1-Math.sqrt(1-t*t)},qr=function(t){return t*t*(3*t-2)},$r=function(t){for(var e,r=4;t<((e=Math.pow(2,--r))-1)/11;);return 1/Math.pow(4,3-r)-7.5625*Math.pow((e*3-2)/22-t,2)},Kr=function(t,e){e===void 0&&(e=[]);var r=_(e,2),n=r[0],i=n===void 0?1:n,a=r[1],o=a===void 0?.5:a,s=kt(Number(i),1,10),l=kt(Number(o),.1,2);return t===0||t===1?t:-s*Math.pow(2,10*(t-1))*Math.sin((t-1-l/(Math.PI*2)*Math.asin(1/s))*(Math.PI*2)/l)},rr=function(t,e,r){e===void 0&&(e=[]);var n=_(e,4),i=n[0],a=i===void 0?1:i,o=n[1],s=o===void 0?100:o,l=n[2],c=l===void 0?10:l,u=n[3],f=u===void 0?0:u;a=kt(a,.1,1e3),s=kt(s,.1,1e3),c=kt(c,.1,1e3),f=kt(f,.1,1e3);var h=Math.sqrt(s/a),v=c/(2*Math.sqrt(s*a)),p=v<1?h*Math.sqrt(1-v*v):0,y=1,d=v<1?(v*h+-f)/p:-f+h,m=r?r*t/1e3:t;return v<1?m=Math.exp(-m*v*h)*(y*Math.cos(p*m)+d*Math.sin(p*m)):m=(y+d*m)*Math.exp(-m*h),t===0||t===1?t:1-m},Xn=function(t,e){e===void 0&&(e=[]);var r=_(e,2),n=r[0],i=n===void 0?10:n,a=r[1],o=a=="start"?Math.ceil:Math.floor;return o(kt(t,0,1)*i)/i},Fa=function(t,e){e===void 0&&(e=[]);var r=_(e,4),n=r[0],i=r[1],a=r[2],o=r[3];return Oi(n,i,a,o)(t)},Zr=Oi(.42,0,1,1),Dt=function(t){return function(e,r,n){return r===void 0&&(r=[]),1-t(1-e,r,n)}},Ft=function(t){return function(e,r,n){return r===void 0&&(r=[]),e<.5?t(e*2,r,n)/2:1-t(e*-2+2,r,n)/2}},Bt=function(t){return function(e,r,n){return r===void 0&&(r=[]),e<.5?(1-t(1-e*2,r,n))/2:(t(e*2-1,r,n)+1)/2}},Ba={steps:Xn,"step-start":function(t){return Xn(t,[1,"start"])},"step-end":function(t){return Xn(t,[1,"end"])},linear:function(t){return t},"cubic-bezier":Fa,ease:function(t){return Fa(t,[.25,.1,.25,1])},in:Zr,out:Dt(Zr),"in-out":Ft(Zr),"out-in":Bt(Zr),"in-quad":Ur,"out-quad":Dt(Ur),"in-out-quad":Ft(Ur),"out-in-quad":Bt(Ur),"in-cubic":Yr,"out-cubic":Dt(Yr),"in-out-cubic":Ft(Yr),"out-in-cubic":Bt(Yr),"in-quart":Hr,"out-quart":Dt(Hr),"in-out-quart":Ft(Hr),"out-in-quart":Bt(Hr),"in-quint":zr,"out-quint":Dt(zr),"in-out-quint":Ft(zr),"out-in-quint":Bt(zr),"in-expo":Wr,"out-expo":Dt(Wr),"in-out-expo":Ft(Wr),"out-in-expo":Bt(Wr),"in-sine":Xr,"out-sine":Dt(Xr),"in-out-sine":Ft(Xr),"out-in-sine":Bt(Xr),"in-circ":Vr,"out-circ":Dt(Vr),"in-out-circ":Ft(Vr),"out-in-circ":Bt(Vr),"in-back":qr,"out-back":Dt(qr),"in-out-back":Ft(qr),"out-in-back":Bt(qr),"in-bounce":$r,"out-bounce":Dt($r),"in-out-bounce":Ft($r),"out-in-bounce":Bt($r),"in-elastic":Kr,"out-elastic":Dt(Kr),"in-out-elastic":Ft(Kr),"out-in-elastic":Bt(Kr),spring:rr,"spring-in":rr,"spring-out":Dt(rr),"spring-in-out":Ft(rr),"spring-out-in":Bt(rr)},dd=function(t){return vd(t).replace(/^ease-/,"").replace(/(\(|\s).+/,"").toLowerCase().trim()},pd=function(t){return Ba[dd(t)]||Ba.linear},yd=function(t){return t},gd=1,md=.5,Ga=0;function Ua(t,e){return function(r){if(r>=1)return 1;var n=1/t;return r+=e*n,r-r%n}}var Qr="\\s*(-?\\d+\\.?\\d*|-?\\.\\d+)\\s*",xd=new RegExp("cubic-bezier\\("+Qr+","+Qr+","+Qr+","+Qr+"\\)"),Ed=/steps\(\s*(\d+)\s*\)/,Md=/steps\(\s*(\d+)\s*,\s*(start|middle|end)\s*\)/;function ki(t){var e=xd.exec(t);if(e)return Oi.apply(void 0,X([],_(e.slice(1).map(Number)),!1));var r=Ed.exec(t);if(r)return Ua(Number(r[1]),Ga);var n=Md.exec(t);return n?Ua(Number(n[1]),{start:gd,middle:md,end:Ga}[n[2]]):pd(t)}function Pd(t){return Math.abs(wd(t)/(t.playbackRate||1))}function wd(t){var e;return t.duration===0||t.iterations===0?0:(t.duration==="auto"?0:Number(t.duration))*((e=t.iterations)!==null&&e!==void 0?e:1)}var ds=0,Ii=1,Pn=2,ps=3;function Td(t,e,r){if(e===null)return ds;var n=r.endTime;return e=Math.min(r.delay+t+r.endDelay,n)?Pn:ps}function bd(t,e,r,n,i){switch(n){case Ii:return e==="backwards"||e==="both"?0:null;case ps:return r-i;case Pn:return e==="forwards"||e==="both"?t:null;case ds:return null}}function Cd(t,e,r,n,i){var a=i;return t===0?e!==Ii&&(a+=r):a+=n/t,a}function Sd(t,e,r,n,i,a){var o=t===1/0?e%1:t%1;return o===0&&r===Pn&&n!==0&&(i!==0||a===0)&&(o=1),o}function Nd(t,e,r,n){return t===Pn&&e===1/0?1/0:r===1?Math.floor(n)-1:Math.floor(n)}function Rd(t,e,r){var n=t;if(t!=="normal"&&t!=="reverse"){var i=e;t==="alternate-reverse"&&(i+=1),n="normal",i!==1/0&&i%2!==0&&(n="reverse")}return n==="normal"?r:1-r}function Ad(t,e,r){var n=Td(t,e,r),i=bd(t,r.fill,e,n,r.delay);if(i===null)return null;var a=r.duration==="auto"?0:r.duration,o=Cd(a,n,r.iterations,i,r.iterationStart),s=Sd(o,r.iterationStart,n,r.iterations,i,a),l=Nd(n,r.iterations,s,o),c=Rd(r.direction,l,s);return r.currentIteration=l,r.progress=c,r.easingFunction(c)}function Od(t,e,r){var n=kd(t,e),i=Id(n,r);return function(a,o){if(o!==null)i.filter(function(l){return o>=l.applyFrom&&o1)throw new Error("Keyframe offsets must be between 0 and 1.");c.computedOffset=f}}else if(u==="composite"&&["replace","add","accumulate","auto"].indexOf(f)===-1)throw new Error("".concat(f," compositing is not supported"));c[u]=f}return c.offset===void 0&&(c.offset=null),c.easing===void 0&&(c.easing=(e==null?void 0:e.easing)||"linear"),c.composite===void 0&&(c.composite="auto"),c}),n=!0,i=-1/0,a=0;a=0&&Number(l.offset)<=1});function s(){var l,c,u=r.length;r[u-1].computedOffset=Number((l=r[u-1].offset)!==null&&l!==void 0?l:1),u>1&&(r[0].computedOffset=Number((c=r[0].offset)!==null&&c!==void 0?c:0));for(var f=0,h=Number(r[0].computedOffset),v=1;vG Music Visualizer - - +