/*@license
 AsyGL: Render Bezier patches and triangles via subdivision with WebGL.
  Copyright 2019-26: John C. Bowman and Supakorn "Jamie" Rassameemasmuang
  University of Alberta

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
/* license for gl-matrix: 
Copyright (c) 2015-2025, Brandon Jones, Colin MacKenzie IV.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.*/
(()=>{"use strict";var t={409:(t,e,n)=>{n.r(e),n.d(e,{add:()=>L,adjoint:()=>m,clone:()=>s,copy:()=>o,create:()=>i,determinant:()=>d,equals:()=>_,exactEquals:()=>O,frob:()=>I,fromMat2d:()=>R,fromMat4:()=>a,fromQuat:()=>A,fromRotation:()=>x,fromScaling:()=>w,fromTranslation:()=>b,fromValues:()=>h,identity:()=>u,invert:()=>f,mul:()=>V,multiply:()=>M,multiplyScalar:()=>P,multiplyScalarAndAdd:()=>S,normalFromMat4:()=>E,projection:()=>T,rotate:()=>p,scale:()=>g,set:()=>l,str:()=>y,sub:()=>Y,subtract:()=>N,translate:()=>v,transpose:()=>c});var r=n(823);function i(){var t=new r.ARRAY_TYPE(9);return r.ARRAY_TYPE!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t}function a(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[4],t[4]=e[5],t[5]=e[6],t[6]=e[8],t[7]=e[9],t[8]=e[10],t}function s(t){var e=new r.ARRAY_TYPE(9);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}function o(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}function h(t,e,n,i,a,s,o,h,l){var u=new r.ARRAY_TYPE(9);return u[0]=t,u[1]=e,u[2]=n,u[3]=i,u[4]=a,u[5]=s,u[6]=o,u[7]=h,u[8]=l,u}function l(t,e,n,r,i,a,s,o,h,l){return t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=s,t[6]=o,t[7]=h,t[8]=l,t}function u(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t}function c(t,e){if(t===e){var n=e[1],r=e[2],i=e[5];t[1]=e[3],t[2]=e[6],t[3]=n,t[5]=e[7],t[6]=r,t[7]=i}else t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8];return t}function f(t,e){var n=e[0],r=e[1],i=e[2],a=e[3],s=e[4],o=e[5],h=e[6],l=e[7],u=e[8],c=u*s-o*l,f=-u*a+o*h,m=l*a-s*h,d=n*c+r*f+i*m;return d?(d=1/d,t[0]=c*d,t[1]=(-u*r+i*l)*d,t[2]=(o*r-i*s)*d,t[3]=f*d,t[4]=(u*n-i*h)*d,t[5]=(-o*n+i*a)*d,t[6]=m*d,t[7]=(-l*n+r*h)*d,t[8]=(s*n-r*a)*d,t):null}function m(t,e){var n=e[0],r=e[1],i=e[2],a=e[3],s=e[4],o=e[5],h=e[6],l=e[7],u=e[8];return t[0]=s*u-o*l,t[1]=i*l-r*u,t[2]=r*o-i*s,t[3]=o*h-a*u,t[4]=n*u-i*h,t[5]=i*a-n*o,t[6]=a*l-s*h,t[7]=r*h-n*l,t[8]=n*s-r*a,t}function d(t){var e=t[0],n=t[1],r=t[2],i=t[3],a=t[4],s=t[5],o=t[6],h=t[7],l=t[8];return e*(l*a-s*h)+n*(-l*i+s*o)+r*(h*i-a*o)}function M(t,e,n){var r=e[0],i=e[1],a=e[2],s=e[3],o=e[4],h=e[5],l=e[6],u=e[7],c=e[8],f=n[0],m=n[1],d=n[2],M=n[3],v=n[4],p=n[5],g=n[6],b=n[7],x=n[8];return t[0]=f*r+m*s+d*l,t[1]=f*i+m*o+d*u,t[2]=f*a+m*h+d*c,t[3]=M*r+v*s+p*l,t[4]=M*i+v*o+p*u,t[5]=M*a+v*h+p*c,t[6]=g*r+b*s+x*l,t[7]=g*i+b*o+x*u,t[8]=g*a+b*h+x*c,t}function v(t,e,n){var r=e[0],i=e[1],a=e[2],s=e[3],o=e[4],h=e[5],l=e[6],u=e[7],c=e[8],f=n[0],m=n[1];return t[0]=r,t[1]=i,t[2]=a,t[3]=s,t[4]=o,t[5]=h,t[6]=f*r+m*s+l,t[7]=f*i+m*o+u,t[8]=f*a+m*h+c,t}function p(t,e,n){var r=e[0],i=e[1],a=e[2],s=e[3],o=e[4],h=e[5],l=e[6],u=e[7],c=e[8],f=Math.sin(n),m=Math.cos(n);return t[0]=m*r+f*s,t[1]=m*i+f*o,t[2]=m*a+f*h,t[3]=m*s-f*r,t[4]=m*o-f*i,t[5]=m*h-f*a,t[6]=l,t[7]=u,t[8]=c,t}function g(t,e,n){var r=n[0],i=n[1];return t[0]=r*e[0],t[1]=r*e[1],t[2]=r*e[2],t[3]=i*e[3],t[4]=i*e[4],t[5]=i*e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t}function b(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=e[0],t[7]=e[1],t[8]=1,t}function x(t,e){var n=Math.sin(e),r=Math.cos(e);return t[0]=r,t[1]=n,t[2]=0,t[3]=-n,t[4]=r,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t}function w(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=e[1],t[5]=0,t[6]=0,t[7]=0,t[8]=1,t}function R(t,e){return t[0]=e[0],t[1]=e[1],t[2]=0,t[3]=e[2],t[4]=e[3],t[5]=0,t[6]=e[4],t[7]=e[5],t[8]=1,t}function A(t,e){var n=e[0],r=e[1],i=e[2],a=e[3],s=n+n,o=r+r,h=i+i,l=n*s,u=r*s,c=r*o,f=i*s,m=i*o,d=i*h,M=a*s,v=a*o,p=a*h;return t[0]=1-c-d,t[3]=u-p,t[6]=f+v,t[1]=u+p,t[4]=1-l-d,t[7]=m-M,t[2]=f-v,t[5]=m+M,t[8]=1-l-c,t}function E(t,e){var n=e[0],r=e[1],i=e[2],a=e[3],s=e[4],o=e[5],h=e[6],l=e[7],u=e[8],c=e[9],f=e[10],m=e[11],d=e[12],M=e[13],v=e[14],p=e[15],g=n*o-r*s,b=n*h-i*s,x=n*l-a*s,w=r*h-i*o,R=r*l-a*o,A=i*l-a*h,E=u*M-c*d,T=u*v-f*d,y=u*p-m*d,I=c*v-f*M,L=c*p-m*M,N=f*p-m*v,P=g*N-b*L+x*I+w*y-R*T+A*E;return P?(P=1/P,t[0]=(o*N-h*L+l*I)*P,t[1]=(h*y-s*N-l*T)*P,t[2]=(s*L-o*y+l*E)*P,t[3]=(i*L-r*N-a*I)*P,t[4]=(n*N-i*y+a*T)*P,t[5]=(r*y-n*L-a*E)*P,t[6]=(M*A-v*R+p*w)*P,t[7]=(v*x-d*A-p*b)*P,t[8]=(d*R-M*x+p*g)*P,t):null}function T(t,e,n){return t[0]=2/e,t[1]=0,t[2]=0,t[3]=0,t[4]=-2/n,t[5]=0,t[6]=-1,t[7]=1,t[8]=1,t}function y(t){return"mat3("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+")"}function I(t){return Math.hypot(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8])}function L(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t[4]=e[4]+n[4],t[5]=e[5]+n[5],t[6]=e[6]+n[6],t[7]=e[7]+n[7],t[8]=e[8]+n[8],t}function N(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t[4]=e[4]-n[4],t[5]=e[5]-n[5],t[6]=e[6]-n[6],t[7]=e[7]-n[7],t[8]=e[8]-n[8],t}function P(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*n,t}function S(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t[2]=e[2]+n[2]*r,t[3]=e[3]+n[3]*r,t[4]=e[4]+n[4]*r,t[5]=e[5]+n[5]*r,t[6]=e[6]+n[6]*r,t[7]=e[7]+n[7]*r,t[8]=e[8]+n[8]*r,t}function O(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]}function _(t,e){var n=t[0],i=t[1],a=t[2],s=t[3],o=t[4],h=t[5],l=t[6],u=t[7],c=t[8],f=e[0],m=e[1],d=e[2],M=e[3],v=e[4],p=e[5],g=e[6],b=e[7],x=e[8];return Math.abs(n-f)<=r.EPSILON*Math.max(1,Math.abs(n),Math.abs(f))&&Math.abs(i-m)<=r.EPSILON*Math.max(1,Math.abs(i),Math.abs(m))&&Math.abs(a-d)<=r.EPSILON*Math.max(1,Math.abs(a),Math.abs(d))&&Math.abs(s-M)<=r.EPSILON*Math.max(1,Math.abs(s),Math.abs(M))&&Math.abs(o-v)<=r.EPSILON*Math.max(1,Math.abs(o),Math.abs(v))&&Math.abs(h-p)<=r.EPSILON*Math.max(1,Math.abs(h),Math.abs(p))&&Math.abs(l-g)<=r.EPSILON*Math.max(1,Math.abs(l),Math.abs(g))&&Math.abs(u-b)<=r.EPSILON*Math.max(1,Math.abs(u),Math.abs(b))&&Math.abs(c-x)<=r.EPSILON*Math.max(1,Math.abs(c),Math.abs(x))}var V=M,Y=N},684:(t,e,n)=>{n.r(e),n.d(e,{add:()=>k,adjoint:()=>f,clone:()=>a,copy:()=>s,create:()=>i,determinant:()=>m,equals:()=>K,exactEquals:()=>Q,frob:()=>G,fromQuat:()=>V,fromQuat2:()=>L,fromRotation:()=>A,fromRotationTranslation:()=>I,fromRotationTranslationScale:()=>O,fromRotationTranslationScaleOrigin:()=>_,fromScaling:()=>R,fromTranslation:()=>w,fromValues:()=>o,fromXRotation:()=>E,fromYRotation:()=>T,fromZRotation:()=>y,frustum:()=>Y,getRotation:()=>S,getScaling:()=>P,getTranslation:()=>N,identity:()=>l,invert:()=>c,lookAt:()=>X,mul:()=>J,multiply:()=>d,multiplyScalar:()=>$,multiplyScalarAndAdd:()=>Z,ortho:()=>C,orthoNO:()=>F,orthoZO:()=>z,perspective:()=>U,perspectiveFromFieldOfView:()=>q,perspectiveNO:()=>D,perspectiveZO:()=>B,rotate:()=>p,rotateX:()=>g,rotateY:()=>b,rotateZ:()=>x,scale:()=>v,set:()=>h,str:()=>W,sub:()=>tt,subtract:()=>j,targetTo:()=>H,translate:()=>M,transpose:()=>u});var r=n(823);function i(){var t=new r.ARRAY_TYPE(16);return r.ARRAY_TYPE!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t}function a(t){var e=new r.ARRAY_TYPE(16);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function s(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],t}function o(t,e,n,i,a,s,o,h,l,u,c,f,m,d,M,v){var p=new r.ARRAY_TYPE(16);return p[0]=t,p[1]=e,p[2]=n,p[3]=i,p[4]=a,p[5]=s,p[6]=o,p[7]=h,p[8]=l,p[9]=u,p[10]=c,p[11]=f,p[12]=m,p[13]=d,p[14]=M,p[15]=v,p}function h(t,e,n,r,i,a,s,o,h,l,u,c,f,m,d,M,v){return t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=s,t[6]=o,t[7]=h,t[8]=l,t[9]=u,t[10]=c,t[11]=f,t[12]=m,t[13]=d,t[14]=M,t[15]=v,t}function l(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function u(t,e){if(t===e){var n=e[1],r=e[2],i=e[3],a=e[6],s=e[7],o=e[11];t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=n,t[6]=e[9],t[7]=e[13],t[8]=r,t[9]=a,t[11]=e[14],t[12]=i,t[13]=s,t[14]=o}else t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15];return t}function c(t,e){var n=e[0],r=e[1],i=e[2],a=e[3],s=e[4],o=e[5],h=e[6],l=e[7],u=e[8],c=e[9],f=e[10],m=e[11],d=e[12],M=e[13],v=e[14],p=e[15],g=n*o-r*s,b=n*h-i*s,x=n*l-a*s,w=r*h-i*o,R=r*l-a*o,A=i*l-a*h,E=u*M-c*d,T=u*v-f*d,y=u*p-m*d,I=c*v-f*M,L=c*p-m*M,N=f*p-m*v,P=g*N-b*L+x*I+w*y-R*T+A*E;return P?(P=1/P,t[0]=(o*N-h*L+l*I)*P,t[1]=(i*L-r*N-a*I)*P,t[2]=(M*A-v*R+p*w)*P,t[3]=(f*R-c*A-m*w)*P,t[4]=(h*y-s*N-l*T)*P,t[5]=(n*N-i*y+a*T)*P,t[6]=(v*x-d*A-p*b)*P,t[7]=(u*A-f*x+m*b)*P,t[8]=(s*L-o*y+l*E)*P,t[9]=(r*y-n*L-a*E)*P,t[10]=(d*R-M*x+p*g)*P,t[11]=(c*x-u*R-m*g)*P,t[12]=(o*T-s*I-h*E)*P,t[13]=(n*I-r*T+i*E)*P,t[14]=(M*b-d*w-v*g)*P,t[15]=(u*w-c*b+f*g)*P,t):null}function f(t,e){var n=e[0],r=e[1],i=e[2],a=e[3],s=e[4],o=e[5],h=e[6],l=e[7],u=e[8],c=e[9],f=e[10],m=e[11],d=e[12],M=e[13],v=e[14],p=e[15];return t[0]=o*(f*p-m*v)-c*(h*p-l*v)+M*(h*m-l*f),t[1]=-(r*(f*p-m*v)-c*(i*p-a*v)+M*(i*m-a*f)),t[2]=r*(h*p-l*v)-o*(i*p-a*v)+M*(i*l-a*h),t[3]=-(r*(h*m-l*f)-o*(i*m-a*f)+c*(i*l-a*h)),t[4]=-(s*(f*p-m*v)-u*(h*p-l*v)+d*(h*m-l*f)),t[5]=n*(f*p-m*v)-u*(i*p-a*v)+d*(i*m-a*f),t[6]=-(n*(h*p-l*v)-s*(i*p-a*v)+d*(i*l-a*h)),t[7]=n*(h*m-l*f)-s*(i*m-a*f)+u*(i*l-a*h),t[8]=s*(c*p-m*M)-u*(o*p-l*M)+d*(o*m-l*c),t[9]=-(n*(c*p-m*M)-u*(r*p-a*M)+d*(r*m-a*c)),t[10]=n*(o*p-l*M)-s*(r*p-a*M)+d*(r*l-a*o),t[11]=-(n*(o*m-l*c)-s*(r*m-a*c)+u*(r*l-a*o)),t[12]=-(s*(c*v-f*M)-u*(o*v-h*M)+d*(o*f-h*c)),t[13]=n*(c*v-f*M)-u*(r*v-i*M)+d*(r*f-i*c),t[14]=-(n*(o*v-h*M)-s*(r*v-i*M)+d*(r*h-i*o)),t[15]=n*(o*f-h*c)-s*(r*f-i*c)+u*(r*h-i*o),t}function m(t){var e=t[0],n=t[1],r=t[2],i=t[3],a=t[4],s=t[5],o=t[6],h=t[7],l=t[8],u=t[9],c=t[10],f=t[11],m=t[12],d=t[13],M=t[14],v=t[15];return(e*s-n*a)*(c*v-f*M)-(e*o-r*a)*(u*v-f*d)+(e*h-i*a)*(u*M-c*d)+(n*o-r*s)*(l*v-f*m)-(n*h-i*s)*(l*M-c*m)+(r*h-i*o)*(l*d-u*m)}function d(t,e,n){var r=e[0],i=e[1],a=e[2],s=e[3],o=e[4],h=e[5],l=e[6],u=e[7],c=e[8],f=e[9],m=e[10],d=e[11],M=e[12],v=e[13],p=e[14],g=e[15],b=n[0],x=n[1],w=n[2],R=n[3];return t[0]=b*r+x*o+w*c+R*M,t[1]=b*i+x*h+w*f+R*v,t[2]=b*a+x*l+w*m+R*p,t[3]=b*s+x*u+w*d+R*g,b=n[4],x=n[5],w=n[6],R=n[7],t[4]=b*r+x*o+w*c+R*M,t[5]=b*i+x*h+w*f+R*v,t[6]=b*a+x*l+w*m+R*p,t[7]=b*s+x*u+w*d+R*g,b=n[8],x=n[9],w=n[10],R=n[11],t[8]=b*r+x*o+w*c+R*M,t[9]=b*i+x*h+w*f+R*v,t[10]=b*a+x*l+w*m+R*p,t[11]=b*s+x*u+w*d+R*g,b=n[12],x=n[13],w=n[14],R=n[15],t[12]=b*r+x*o+w*c+R*M,t[13]=b*i+x*h+w*f+R*v,t[14]=b*a+x*l+w*m+R*p,t[15]=b*s+x*u+w*d+R*g,t}function M(t,e,n){var r,i,a,s,o,h,l,u,c,f,m,d,M=n[0],v=n[1],p=n[2];return e===t?(t[12]=e[0]*M+e[4]*v+e[8]*p+e[12],t[13]=e[1]*M+e[5]*v+e[9]*p+e[13],t[14]=e[2]*M+e[6]*v+e[10]*p+e[14],t[15]=e[3]*M+e[7]*v+e[11]*p+e[15]):(r=e[0],i=e[1],a=e[2],s=e[3],o=e[4],h=e[5],l=e[6],u=e[7],c=e[8],f=e[9],m=e[10],d=e[11],t[0]=r,t[1]=i,t[2]=a,t[3]=s,t[4]=o,t[5]=h,t[6]=l,t[7]=u,t[8]=c,t[9]=f,t[10]=m,t[11]=d,t[12]=r*M+o*v+c*p+e[12],t[13]=i*M+h*v+f*p+e[13],t[14]=a*M+l*v+m*p+e[14],t[15]=s*M+u*v+d*p+e[15]),t}function v(t,e,n){var r=n[0],i=n[1],a=n[2];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]*i,t[5]=e[5]*i,t[6]=e[6]*i,t[7]=e[7]*i,t[8]=e[8]*a,t[9]=e[9]*a,t[10]=e[10]*a,t[11]=e[11]*a,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function p(t,e,n,i){var a,s,o,h,l,u,c,f,m,d,M,v,p,g,b,x,w,R,A,E,T,y,I,L,N=i[0],P=i[1],S=i[2],O=Math.hypot(N,P,S);return O<r.EPSILON?null:(N*=O=1/O,P*=O,S*=O,a=Math.sin(n),o=1-(s=Math.cos(n)),h=e[0],l=e[1],u=e[2],c=e[3],f=e[4],m=e[5],d=e[6],M=e[7],v=e[8],p=e[9],g=e[10],b=e[11],x=N*N*o+s,w=P*N*o+S*a,R=S*N*o-P*a,A=N*P*o-S*a,E=P*P*o+s,T=S*P*o+N*a,y=N*S*o+P*a,I=P*S*o-N*a,L=S*S*o+s,t[0]=h*x+f*w+v*R,t[1]=l*x+m*w+p*R,t[2]=u*x+d*w+g*R,t[3]=c*x+M*w+b*R,t[4]=h*A+f*E+v*T,t[5]=l*A+m*E+p*T,t[6]=u*A+d*E+g*T,t[7]=c*A+M*E+b*T,t[8]=h*y+f*I+v*L,t[9]=l*y+m*I+p*L,t[10]=u*y+d*I+g*L,t[11]=c*y+M*I+b*L,e!==t&&(t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t)}function g(t,e,n){var r=Math.sin(n),i=Math.cos(n),a=e[4],s=e[5],o=e[6],h=e[7],l=e[8],u=e[9],c=e[10],f=e[11];return e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=a*i+l*r,t[5]=s*i+u*r,t[6]=o*i+c*r,t[7]=h*i+f*r,t[8]=l*i-a*r,t[9]=u*i-s*r,t[10]=c*i-o*r,t[11]=f*i-h*r,t}function b(t,e,n){var r=Math.sin(n),i=Math.cos(n),a=e[0],s=e[1],o=e[2],h=e[3],l=e[8],u=e[9],c=e[10],f=e[11];return e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=a*i-l*r,t[1]=s*i-u*r,t[2]=o*i-c*r,t[3]=h*i-f*r,t[8]=a*r+l*i,t[9]=s*r+u*i,t[10]=o*r+c*i,t[11]=h*r+f*i,t}function x(t,e,n){var r=Math.sin(n),i=Math.cos(n),a=e[0],s=e[1],o=e[2],h=e[3],l=e[4],u=e[5],c=e[6],f=e[7];return e!==t&&(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]),t[0]=a*i+l*r,t[1]=s*i+u*r,t[2]=o*i+c*r,t[3]=h*i+f*r,t[4]=l*i-a*r,t[5]=u*i-s*r,t[6]=c*i-o*r,t[7]=f*i-h*r,t}function w(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=e[0],t[13]=e[1],t[14]=e[2],t[15]=1,t}function R(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e[1],t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e[2],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function A(t,e,n){var i,a,s,o=n[0],h=n[1],l=n[2],u=Math.hypot(o,h,l);return u<r.EPSILON?null:(o*=u=1/u,h*=u,l*=u,i=Math.sin(e),s=1-(a=Math.cos(e)),t[0]=o*o*s+a,t[1]=h*o*s+l*i,t[2]=l*o*s-h*i,t[3]=0,t[4]=o*h*s-l*i,t[5]=h*h*s+a,t[6]=l*h*s+o*i,t[7]=0,t[8]=o*l*s+h*i,t[9]=h*l*s-o*i,t[10]=l*l*s+a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t)}function E(t,e){var n=Math.sin(e),r=Math.cos(e);return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=r,t[6]=n,t[7]=0,t[8]=0,t[9]=-n,t[10]=r,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function T(t,e){var n=Math.sin(e),r=Math.cos(e);return t[0]=r,t[1]=0,t[2]=-n,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=n,t[9]=0,t[10]=r,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function y(t,e){var n=Math.sin(e),r=Math.cos(e);return t[0]=r,t[1]=n,t[2]=0,t[3]=0,t[4]=-n,t[5]=r,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function I(t,e,n){var r=e[0],i=e[1],a=e[2],s=e[3],o=r+r,h=i+i,l=a+a,u=r*o,c=r*h,f=r*l,m=i*h,d=i*l,M=a*l,v=s*o,p=s*h,g=s*l;return t[0]=1-(m+M),t[1]=c+g,t[2]=f-p,t[3]=0,t[4]=c-g,t[5]=1-(u+M),t[6]=d+v,t[7]=0,t[8]=f+p,t[9]=d-v,t[10]=1-(u+m),t[11]=0,t[12]=n[0],t[13]=n[1],t[14]=n[2],t[15]=1,t}function L(t,e){var n=new r.ARRAY_TYPE(3),i=-e[0],a=-e[1],s=-e[2],o=e[3],h=e[4],l=e[5],u=e[6],c=e[7],f=i*i+a*a+s*s+o*o;return f>0?(n[0]=2*(h*o+c*i+l*s-u*a)/f,n[1]=2*(l*o+c*a+u*i-h*s)/f,n[2]=2*(u*o+c*s+h*a-l*i)/f):(n[0]=2*(h*o+c*i+l*s-u*a),n[1]=2*(l*o+c*a+u*i-h*s),n[2]=2*(u*o+c*s+h*a-l*i)),I(t,e,n),t}function N(t,e){return t[0]=e[12],t[1]=e[13],t[2]=e[14],t}function P(t,e){var n=e[0],r=e[1],i=e[2],a=e[4],s=e[5],o=e[6],h=e[8],l=e[9],u=e[10];return t[0]=Math.hypot(n,r,i),t[1]=Math.hypot(a,s,o),t[2]=Math.hypot(h,l,u),t}function S(t,e){var n=new r.ARRAY_TYPE(3);P(n,e);var i=1/n[0],a=1/n[1],s=1/n[2],o=e[0]*i,h=e[1]*a,l=e[2]*s,u=e[4]*i,c=e[5]*a,f=e[6]*s,m=e[8]*i,d=e[9]*a,M=e[10]*s,v=o+c+M,p=0;return v>0?(p=2*Math.sqrt(v+1),t[3]=.25*p,t[0]=(f-d)/p,t[1]=(m-l)/p,t[2]=(h-u)/p):o>c&&o>M?(p=2*Math.sqrt(1+o-c-M),t[3]=(f-d)/p,t[0]=.25*p,t[1]=(h+u)/p,t[2]=(m+l)/p):c>M?(p=2*Math.sqrt(1+c-o-M),t[3]=(m-l)/p,t[0]=(h+u)/p,t[1]=.25*p,t[2]=(f+d)/p):(p=2*Math.sqrt(1+M-o-c),t[3]=(h-u)/p,t[0]=(m+l)/p,t[1]=(f+d)/p,t[2]=.25*p),t}function O(t,e,n,r){var i=e[0],a=e[1],s=e[2],o=e[3],h=i+i,l=a+a,u=s+s,c=i*h,f=i*l,m=i*u,d=a*l,M=a*u,v=s*u,p=o*h,g=o*l,b=o*u,x=r[0],w=r[1],R=r[2];return t[0]=(1-(d+v))*x,t[1]=(f+b)*x,t[2]=(m-g)*x,t[3]=0,t[4]=(f-b)*w,t[5]=(1-(c+v))*w,t[6]=(M+p)*w,t[7]=0,t[8]=(m+g)*R,t[9]=(M-p)*R,t[10]=(1-(c+d))*R,t[11]=0,t[12]=n[0],t[13]=n[1],t[14]=n[2],t[15]=1,t}function _(t,e,n,r,i){var a=e[0],s=e[1],o=e[2],h=e[3],l=a+a,u=s+s,c=o+o,f=a*l,m=a*u,d=a*c,M=s*u,v=s*c,p=o*c,g=h*l,b=h*u,x=h*c,w=r[0],R=r[1],A=r[2],E=i[0],T=i[1],y=i[2],I=(1-(M+p))*w,L=(m+x)*w,N=(d-b)*w,P=(m-x)*R,S=(1-(f+p))*R,O=(v+g)*R,_=(d+b)*A,V=(v-g)*A,Y=(1-(f+M))*A;return t[0]=I,t[1]=L,t[2]=N,t[3]=0,t[4]=P,t[5]=S,t[6]=O,t[7]=0,t[8]=_,t[9]=V,t[10]=Y,t[11]=0,t[12]=n[0]+E-(I*E+P*T+_*y),t[13]=n[1]+T-(L*E+S*T+V*y),t[14]=n[2]+y-(N*E+O*T+Y*y),t[15]=1,t}function V(t,e){var n=e[0],r=e[1],i=e[2],a=e[3],s=n+n,o=r+r,h=i+i,l=n*s,u=r*s,c=r*o,f=i*s,m=i*o,d=i*h,M=a*s,v=a*o,p=a*h;return t[0]=1-c-d,t[1]=u+p,t[2]=f-v,t[3]=0,t[4]=u-p,t[5]=1-l-d,t[6]=m+M,t[7]=0,t[8]=f+v,t[9]=m-M,t[10]=1-l-c,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function Y(t,e,n,r,i,a,s){var o=1/(n-e),h=1/(i-r),l=1/(a-s);return t[0]=2*a*o,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=2*a*h,t[6]=0,t[7]=0,t[8]=(n+e)*o,t[9]=(i+r)*h,t[10]=(s+a)*l,t[11]=-1,t[12]=0,t[13]=0,t[14]=s*a*2*l,t[15]=0,t}function D(t,e,n,r,i){var a,s=1/Math.tan(e/2);return t[0]=s/n,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=s,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,null!=i&&i!==1/0?(a=1/(r-i),t[10]=(i+r)*a,t[14]=2*i*r*a):(t[10]=-1,t[14]=-2*r),t}var U=D;function B(t,e,n,r,i){var a,s=1/Math.tan(e/2);return t[0]=s/n,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=s,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,null!=i&&i!==1/0?(a=1/(r-i),t[10]=i*a,t[14]=i*r*a):(t[10]=-1,t[14]=-r),t}function q(t,e,n,r){var i=Math.tan(e.upDegrees*Math.PI/180),a=Math.tan(e.downDegrees*Math.PI/180),s=Math.tan(e.leftDegrees*Math.PI/180),o=Math.tan(e.rightDegrees*Math.PI/180),h=2/(s+o),l=2/(i+a);return t[0]=h,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=l,t[6]=0,t[7]=0,t[8]=-(s-o)*h*.5,t[9]=(i-a)*l*.5,t[10]=r/(n-r),t[11]=-1,t[12]=0,t[13]=0,t[14]=r*n/(n-r),t[15]=0,t}function F(t,e,n,r,i,a,s){var o=1/(e-n),h=1/(r-i),l=1/(a-s);return t[0]=-2*o,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*h,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*l,t[11]=0,t[12]=(e+n)*o,t[13]=(i+r)*h,t[14]=(s+a)*l,t[15]=1,t}var C=F;function z(t,e,n,r,i,a,s){var o=1/(e-n),h=1/(r-i),l=1/(a-s);return t[0]=-2*o,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*h,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=l,t[11]=0,t[12]=(e+n)*o,t[13]=(i+r)*h,t[14]=a*l,t[15]=1,t}function X(t,e,n,i){var a,s,o,h,u,c,f,m,d,M,v=e[0],p=e[1],g=e[2],b=i[0],x=i[1],w=i[2],R=n[0],A=n[1],E=n[2];return Math.abs(v-R)<r.EPSILON&&Math.abs(p-A)<r.EPSILON&&Math.abs(g-E)<r.EPSILON?l(t):(f=v-R,m=p-A,d=g-E,a=x*(d*=M=1/Math.hypot(f,m,d))-w*(m*=M),s=w*(f*=M)-b*d,o=b*m-x*f,(M=Math.hypot(a,s,o))?(a*=M=1/M,s*=M,o*=M):(a=0,s=0,o=0),h=m*o-d*s,u=d*a-f*o,c=f*s-m*a,(M=Math.hypot(h,u,c))?(h*=M=1/M,u*=M,c*=M):(h=0,u=0,c=0),t[0]=a,t[1]=h,t[2]=f,t[3]=0,t[4]=s,t[5]=u,t[6]=m,t[7]=0,t[8]=o,t[9]=c,t[10]=d,t[11]=0,t[12]=-(a*v+s*p+o*g),t[13]=-(h*v+u*p+c*g),t[14]=-(f*v+m*p+d*g),t[15]=1,t)}function H(t,e,n,r){var i=e[0],a=e[1],s=e[2],o=r[0],h=r[1],l=r[2],u=i-n[0],c=a-n[1],f=s-n[2],m=u*u+c*c+f*f;m>0&&(u*=m=1/Math.sqrt(m),c*=m,f*=m);var d=h*f-l*c,M=l*u-o*f,v=o*c-h*u;return(m=d*d+M*M+v*v)>0&&(d*=m=1/Math.sqrt(m),M*=m,v*=m),t[0]=d,t[1]=M,t[2]=v,t[3]=0,t[4]=c*v-f*M,t[5]=f*d-u*v,t[6]=u*M-c*d,t[7]=0,t[8]=u,t[9]=c,t[10]=f,t[11]=0,t[12]=i,t[13]=a,t[14]=s,t[15]=1,t}function W(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 G(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 k(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t[4]=e[4]+n[4],t[5]=e[5]+n[5],t[6]=e[6]+n[6],t[7]=e[7]+n[7],t[8]=e[8]+n[8],t[9]=e[9]+n[9],t[10]=e[10]+n[10],t[11]=e[11]+n[11],t[12]=e[12]+n[12],t[13]=e[13]+n[13],t[14]=e[14]+n[14],t[15]=e[15]+n[15],t}function j(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t[4]=e[4]-n[4],t[5]=e[5]-n[5],t[6]=e[6]-n[6],t[7]=e[7]-n[7],t[8]=e[8]-n[8],t[9]=e[9]-n[9],t[10]=e[10]-n[10],t[11]=e[11]-n[11],t[12]=e[12]-n[12],t[13]=e[13]-n[13],t[14]=e[14]-n[14],t[15]=e[15]-n[15],t}function $(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*n,t[9]=e[9]*n,t[10]=e[10]*n,t[11]=e[11]*n,t[12]=e[12]*n,t[13]=e[13]*n,t[14]=e[14]*n,t[15]=e[15]*n,t}function Z(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t[2]=e[2]+n[2]*r,t[3]=e[3]+n[3]*r,t[4]=e[4]+n[4]*r,t[5]=e[5]+n[5]*r,t[6]=e[6]+n[6]*r,t[7]=e[7]+n[7]*r,t[8]=e[8]+n[8]*r,t[9]=e[9]+n[9]*r,t[10]=e[10]+n[10]*r,t[11]=e[11]+n[11]*r,t[12]=e[12]+n[12]*r,t[13]=e[13]+n[13]*r,t[14]=e[14]+n[14]*r,t[15]=e[15]+n[15]*r,t}function Q(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 K(t,e){var n=t[0],i=t[1],a=t[2],s=t[3],o=t[4],h=t[5],l=t[6],u=t[7],c=t[8],f=t[9],m=t[10],d=t[11],M=t[12],v=t[13],p=t[14],g=t[15],b=e[0],x=e[1],w=e[2],R=e[3],A=e[4],E=e[5],T=e[6],y=e[7],I=e[8],L=e[9],N=e[10],P=e[11],S=e[12],O=e[13],_=e[14],V=e[15];return Math.abs(n-b)<=r.EPSILON*Math.max(1,Math.abs(n),Math.abs(b))&&Math.abs(i-x)<=r.EPSILON*Math.max(1,Math.abs(i),Math.abs(x))&&Math.abs(a-w)<=r.EPSILON*Math.max(1,Math.abs(a),Math.abs(w))&&Math.abs(s-R)<=r.EPSILON*Math.max(1,Math.abs(s),Math.abs(R))&&Math.abs(o-A)<=r.EPSILON*Math.max(1,Math.abs(o),Math.abs(A))&&Math.abs(h-E)<=r.EPSILON*Math.max(1,Math.abs(h),Math.abs(E))&&Math.abs(l-T)<=r.EPSILON*Math.max(1,Math.abs(l),Math.abs(T))&&Math.abs(u-y)<=r.EPSILON*Math.max(1,Math.abs(u),Math.abs(y))&&Math.abs(c-I)<=r.EPSILON*Math.max(1,Math.abs(c),Math.abs(I))&&Math.abs(f-L)<=r.EPSILON*Math.max(1,Math.abs(f),Math.abs(L))&&Math.abs(m-N)<=r.EPSILON*Math.max(1,Math.abs(m),Math.abs(N))&&Math.abs(d-P)<=r.EPSILON*Math.max(1,Math.abs(d),Math.abs(P))&&Math.abs(M-S)<=r.EPSILON*Math.max(1,Math.abs(M),Math.abs(S))&&Math.abs(v-O)<=r.EPSILON*Math.max(1,Math.abs(v),Math.abs(O))&&Math.abs(p-_)<=r.EPSILON*Math.max(1,Math.abs(p),Math.abs(_))&&Math.abs(g-V)<=r.EPSILON*Math.max(1,Math.abs(g),Math.abs(V))}var J=d,tt=j},796:(t,e,n)=>{n.r(e),n.d(e,{add:()=>l,ceil:()=>m,clone:()=>a,copy:()=>o,create:()=>i,cross:()=>L,dist:()=>C,distance:()=>x,div:()=>F,divide:()=>f,dot:()=>I,equals:()=>D,exactEquals:()=>Y,floor:()=>d,forEach:()=>W,fromValues:()=>s,inverse:()=>T,len:()=>X,length:()=>R,lerp:()=>N,max:()=>v,min:()=>M,mul:()=>q,multiply:()=>c,negate:()=>E,normalize:()=>y,random:()=>P,round:()=>p,scale:()=>g,scaleAndAdd:()=>b,set:()=>h,sqrDist:()=>z,sqrLen:()=>H,squaredDistance:()=>w,squaredLength:()=>A,str:()=>V,sub:()=>B,subtract:()=>u,transformMat4:()=>S,transformQuat:()=>O,zero:()=>_});var r=n(823);function i(){var t=new r.ARRAY_TYPE(4);return r.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}function a(t){var e=new r.ARRAY_TYPE(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}function s(t,e,n,i){var a=new r.ARRAY_TYPE(4);return a[0]=t,a[1]=e,a[2]=n,a[3]=i,a}function o(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function h(t,e,n,r,i){return t[0]=e,t[1]=n,t[2]=r,t[3]=i,t}function l(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t}function u(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t}function c(t,e,n){return t[0]=e[0]*n[0],t[1]=e[1]*n[1],t[2]=e[2]*n[2],t[3]=e[3]*n[3],t}function f(t,e,n){return t[0]=e[0]/n[0],t[1]=e[1]/n[1],t[2]=e[2]/n[2],t[3]=e[3]/n[3],t}function m(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t[2]=Math.ceil(e[2]),t[3]=Math.ceil(e[3]),t}function d(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t[2]=Math.floor(e[2]),t[3]=Math.floor(e[3]),t}function M(t,e,n){return t[0]=Math.min(e[0],n[0]),t[1]=Math.min(e[1],n[1]),t[2]=Math.min(e[2],n[2]),t[3]=Math.min(e[3],n[3]),t}function v(t,e,n){return t[0]=Math.max(e[0],n[0]),t[1]=Math.max(e[1],n[1]),t[2]=Math.max(e[2],n[2]),t[3]=Math.max(e[3],n[3]),t}function p(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t[2]=Math.round(e[2]),t[3]=Math.round(e[3]),t}function g(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t}function b(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t[2]=e[2]+n[2]*r,t[3]=e[3]+n[3]*r,t}function x(t,e){var n=e[0]-t[0],r=e[1]-t[1],i=e[2]-t[2],a=e[3]-t[3];return Math.hypot(n,r,i,a)}function w(t,e){var n=e[0]-t[0],r=e[1]-t[1],i=e[2]-t[2],a=e[3]-t[3];return n*n+r*r+i*i+a*a}function R(t){var e=t[0],n=t[1],r=t[2],i=t[3];return Math.hypot(e,n,r,i)}function A(t){var e=t[0],n=t[1],r=t[2],i=t[3];return e*e+n*n+r*r+i*i}function E(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t}function T(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t[3]=1/e[3],t}function y(t,e){var n=e[0],r=e[1],i=e[2],a=e[3],s=n*n+r*r+i*i+a*a;return s>0&&(s=1/Math.sqrt(s)),t[0]=n*s,t[1]=r*s,t[2]=i*s,t[3]=a*s,t}function I(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]}function L(t,e,n,r){var i=n[0]*r[1]-n[1]*r[0],a=n[0]*r[2]-n[2]*r[0],s=n[0]*r[3]-n[3]*r[0],o=n[1]*r[2]-n[2]*r[1],h=n[1]*r[3]-n[3]*r[1],l=n[2]*r[3]-n[3]*r[2],u=e[0],c=e[1],f=e[2],m=e[3];return t[0]=c*l-f*h+m*o,t[1]=-u*l+f*s-m*a,t[2]=u*h-c*s+m*i,t[3]=-u*o+c*a-f*i,t}function N(t,e,n,r){var i=e[0],a=e[1],s=e[2],o=e[3];return t[0]=i+r*(n[0]-i),t[1]=a+r*(n[1]-a),t[2]=s+r*(n[2]-s),t[3]=o+r*(n[3]-o),t}function P(t,e){var n,i,a,s,o,h;e=e||1;do{o=(n=2*r.RANDOM()-1)*n+(i=2*r.RANDOM()-1)*i}while(o>=1);do{h=(a=2*r.RANDOM()-1)*a+(s=2*r.RANDOM()-1)*s}while(h>=1);var l=Math.sqrt((1-o)/h);return t[0]=e*n,t[1]=e*i,t[2]=e*a*l,t[3]=e*s*l,t}function S(t,e,n){var r=e[0],i=e[1],a=e[2],s=e[3];return t[0]=n[0]*r+n[4]*i+n[8]*a+n[12]*s,t[1]=n[1]*r+n[5]*i+n[9]*a+n[13]*s,t[2]=n[2]*r+n[6]*i+n[10]*a+n[14]*s,t[3]=n[3]*r+n[7]*i+n[11]*a+n[15]*s,t}function O(t,e,n){var r=e[0],i=e[1],a=e[2],s=n[0],o=n[1],h=n[2],l=n[3],u=l*r+o*a-h*i,c=l*i+h*r-s*a,f=l*a+s*i-o*r,m=-s*r-o*i-h*a;return t[0]=u*l+m*-s+c*-h-f*-o,t[1]=c*l+m*-o+f*-s-u*-h,t[2]=f*l+m*-h+u*-o-c*-s,t[3]=e[3],t}function _(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=0,t}function V(t){return"vec4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"}function Y(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]}function D(t,e){var n=t[0],i=t[1],a=t[2],s=t[3],o=e[0],h=e[1],l=e[2],u=e[3];return Math.abs(n-o)<=r.EPSILON*Math.max(1,Math.abs(n),Math.abs(o))&&Math.abs(i-h)<=r.EPSILON*Math.max(1,Math.abs(i),Math.abs(h))&&Math.abs(a-l)<=r.EPSILON*Math.max(1,Math.abs(a),Math.abs(l))&&Math.abs(s-u)<=r.EPSILON*Math.max(1,Math.abs(s),Math.abs(u))}var U,B=u,q=c,F=f,C=x,z=w,X=R,H=A,W=(U=i(),function(t,e,n,r,i,a){var s,o;for(e||(e=4),n||(n=0),o=r?Math.min(r*e+n,t.length):t.length,s=n;s<o;s+=e)U[0]=t[s],U[1]=t[s+1],U[2]=t[s+2],U[3]=t[s+3],i(U,U,a),t[s]=U[0],t[s+1]=U[1],t[s+2]=U[2],t[s+3]=U[3];return t})},823:(t,e,n)=>{n.r(e),n.d(e,{ARRAY_TYPE:()=>i,EPSILON:()=>r,RANDOM:()=>a,equals:()=>l,setMatrixArrayType:()=>s,toRadian:()=>h});var r=1e-6,i="undefined"!=typeof Float32Array?Float32Array:Array,a=Math.random;function s(t){i=t}var o=Math.PI/180;function h(t){return t*o}function l(t,e){return Math.abs(t-e)<=r*Math.max(1,Math.abs(t),Math.abs(e))}Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)})}},e={};function n(r){var i=e[r];if(void 0!==i)return i.exports;var a=e[r]={exports:{}};return t[r](a,a.exports,n),a.exports}n.d=(t,e)=>{for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},(()=>{var t=n(684),e=n(409),r=n(796);const i={canvasWidth:0,canvasHeight:0,absolute:!1,minBound:[0,0,0],maxBound:[0,0,0],orthographic:!1,angleOfView:0,initialZoom:0,viewportShift:[0,0],viewportMargin:[0,0],background:[],zoomFactor:0,zoomPinchFactor:0,zoomPinchCap:0,zoomStep:0,shiftHoldDistance:0,shiftWaitTime:0,vibrateTime:0,ibl:!1,webgl2:!1,imageURL:"",image:"",Transform:[],Centers:[],canvasWidth0:0,canvasHeight0:0,zoom0:0,embedded:!1,canvas:null};globalThis.document.asy=i;const a=i;let s,o,h,l,u,c,f,m=[],d=[],M=[],v=0,p=2;const g=1/3,b=Math.acos(-1),x=b/180,w=Math.ceil(1-Math.log2(Number.EPSILON));let R,A,E,T,y,I,L,N,P,S,O,_,V,Y,D,U,B,q,F,C,z=t.create(),X=t.create(),H=t.create(),W=t.create(),G=e.create(),k=e.create(),j=t.create(),$=t.create(),Z={x:0,y:0,z:0},Q={x:0,y:0},K={xmin:0,xmax:0,ymin:0,ymax:0,zmin:0,zmax:0},J=!0,tt=0,et=!1,nt=null,rt=null,it=[],at=[],st=[],ot=[],ht=null,lt=null,ut=null,ct=Math.min,ft=Math.max;class mt{constructor(t,e,n,r,i,a){this.diffuse=t,this.emissive=e,this.specular=n,this.shininess=r,this.metallic=i,this.fresnel0=a}setUniform(t,e){let n=n=>s.getUniformLocation(t,"Materials["+e+"]."+n);s.uniform4fv(n("diffuse"),new Float32Array(this.diffuse)),s.uniform4fv(n("emissive"),new Float32Array(this.emissive)),s.uniform4fv(n("specular"),new Float32Array(this.specular)),s.uniform4f(n("parameters"),this.shininess,this.metallic,this.fresnel0,0)}}class dt{constructor(t,e){this.direction=t,this.color=e}setUniform(t,e){const n=n=>s.getUniformLocation(t,"Lights["+e+"]."+n);s.uniform3fv(n("direction"),new Float32Array(this.direction)),s.uniform3fv(n("color"),new Float32Array(this.color))}}function Mt(t=!1){const e=s.getParameter(s.MAX_VERTEX_UNIFORM_VECTORS);u=Math.floor((e-14)/4),p=ct(ft(p,M.length),u);const n=["NORMAL"],r=["NORMAL","COLOR","TRANSPARENT"];t&&(n.push("USE_IBL"),r.push("USE_IBL")),_e=Ht(["WIDTH"]),Ve=Ht(n),Ye=Ht(["NORMAL","COLOR"]),De=Ht(r)}function vt(){s.deleteProgram(De),s.deleteProgram(Ye),s.deleteProgram(Ve),s.deleteProgram(_e)}function pt(){const t=window.top.document,e=a.webgl2?t.asygl2[o]:t.asygl[o],n={gl:s,nlights:d.length,Nmaterials:p,maxMaterials:u,pixelShader:_e,materialShader:Ve,colorShader:Ye,transparentShader:De};Object.assign(e,n)}function gt(t,e){let n;return a.webgl2&&(n=t.getContext("webgl2",{alpha:e}),a.embedded&&!n)?(a.webgl2=!1,a.ibl=!1,bt(!1),null):(n||(a.webgl2=!1,a.ibl=!1,n=t.getContext("webgl",{alpha:e})),n||alert("Could not initialize WebGL"),n)}function bt(t=!0){if(a.ibl&&(a.webgl2=!0),o=a.background[3]<1,a.embedded){const e=window.top.document;t&&(l=a.canvas.getContext("2d")),h=a.webgl2?e.offscreen2:e.offscreen,h||(h=e.createElement("canvas"),a.webgl2?e.offscreen2=h:e.offscreen=h),a.webgl2?e.asygl2||(e.asygl2=Array(2)):e.asygl||(e.asygl=Array(2)),function(){let t=window.top.document;const e=a.webgl2?t.asygl2:t.asygl;if(e[o]&&e[o].gl)!function(){const t=window.top.document;let e=a.webgl2?t.asygl2[o]:t.asygl[o];s=e.gl,v=e.nlights,p=e.Nmaterials,u=e.maxMaterials,_e=e.pixelShader,Ve=e.materialShader,Ye=e.colorShader,De=e.transparentShader}(),(d.length!=v||ct(M.length,u)>p)&&(Mt(),pt());else{const e=gt(h,o);if(!e)return;s=e,Mt(),a.webgl2?t.asygl2[o]={}:t.asygl[o]={},pt()}}()}else s=gt(a.canvas,o),Mt();_=s.getExtension("OES_element_index_uint"),V=s.TRIANGLES,Y=new At(s.POINTS),D=new At(s.LINES),U=new At,B=new At,q=new At,F=new At}function xt(t,e,n,r=[]){let i=a.webgl2?"300 es":"100",s=Array(...r),o=[["nlights",0==tt?d.length:0],["Nmaterials",p]],h=[["int","Nlights",ft(d.length,1)]];a.webgl2&&s.push("WEBGL2"),a.ibl&&o.push(["ROUGHNESS_STEP_COUNT",8..toFixed(2)]);const l=o.map(t=>`#define ${t[0]} ${t[1]}`).join("\n"),u=s.map(t=>`#define ${t}`).join("\n"),c=h.map(t=>`const ${t[0]} ${t[1]}=${t[2]};`).join("\n"),f=`#version ${i}\n${[].map(t=>`#extension ${t}: enable`).join("\n")}\n${u}\n${c}\n${l}\n\n\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n  \n${e}\n  `;let m=t.createShader(n);return t.shaderSource(m,f),t.compileShader(m),t.getShaderParameter(m,t.COMPILE_STATUS)?m:(alert(t.getShaderInfoLog(m)),null)}function wt(t,e,n,r=s.ARRAY_BUFFER){return t.length>0&&(0==e&&(e=s.createBuffer(),n=!0),s.bindBuffer(r,e),n&&s.bufferData(r,t,s.STATIC_DRAW)),e}function Rt(t,e,n=t.indices){if(0==t.indices.length)return;let r=e!=_e;!function(t,e){let n=e==_e;s.useProgram(e),s.enableVertexAttribArray(qt),n&&s.enableVertexAttribArray(Xt);let r=!n&&d.length>0;if(r&&s.enableVertexAttribArray(Ft),s.enableVertexAttribArray(Ct),e.projViewMatUniform=s.getUniformLocation(e,"projViewMat"),e.viewMatUniform=s.getUniformLocation(e,"viewMat"),e.normMatUniform=s.getUniformLocation(e,"normMat"),e.orthographicUniform=s.getUniformLocation(e,"orthographic"),(e==Ye||e==De)&&s.enableVertexAttribArray(zt),r)for(let t=0;t<d.length;++t)d[t].setUniform(e,t);for(let n=0;n<t.materials.length;++n)t.materials[n].setUniform(e,n);s.uniformMatrix4fv(e.projViewMatUniform,!1,W),s.uniformMatrix4fv(e.viewMatUniform,!1,H),s.uniformMatrix3fv(e.normMatUniform,!1,G),s.uniform1i(e.orthographicUniform,1,a.orthographic)}(t,e),null!=lt&&(s.activeTexture(s.TEXTURE0),s.bindTexture(s.TEXTURE_2D,ut),s.uniform1i(s.getUniformLocation(e,"reflBRDFSampler"),0),s.activeTexture(s.TEXTURE1),s.bindTexture(s.TEXTURE_2D,lt),s.uniform1i(s.getUniformLocation(e,"diffuseSampler"),1),s.activeTexture(s.TEXTURE2),s.bindTexture(s.TEXTURE_2D,ht),s.uniform1i(s.getUniformLocation(e,"reflImgSampler"),2));let i=J||t.partial||!t.rendered;t.verticesBuffer=wt(new Float32Array(t.vertices),t.verticesBuffer,i),s.vertexAttribPointer(qt,3,s.FLOAT,!1,r?24:16,0),r?d.length>0&&s.vertexAttribPointer(Ft,3,s.FLOAT,!1,24,12):s.vertexAttribPointer(Xt,1,s.FLOAT,!1,16,12),t.materialsBuffer=wt(new Int16Array(t.materialIndices),t.materialsBuffer,i),s.vertexAttribPointer(Ct,1,s.SHORT,!1,2,0),e!=Ye&&e!=De||(t.colorsBuffer=wt(new Float32Array(t.colors),t.colorsBuffer,i),s.vertexAttribPointer(zt,4,s.FLOAT,!0,0,0)),t.indicesBuffer=wt(_?new Uint32Array(n):new Uint16Array(n),t.indicesBuffer,i,s.ELEMENT_ARRAY_BUFFER),t.rendered=!0,s.drawElements(r?tt?s.LINES:t.type:s.POINTS,n.length,_?s.UNSIGNED_INT:s.UNSIGNED_SHORT,0)}class At{constructor(t=V){this.type=t,this.verticesBuffer=0,this.materialsBuffer=0,this.colorsBuffer=0,this.indicesBuffer=0,this.rendered=!1,this.partial=!1,this.vertices=[],this.materialIndices=[],this.colors=[],this.indices=[],this.materials=[],this.materialTable=[],this.nvertices=0,this.clear()}clear(){this.vertices.length=0,this.materialIndices=[],this.colors=[],this.indices=[],this.nvertices=0,this.materials=[],this.materialTable=[]}vertex(t,e){return this.vertices.push(t[0]),this.vertices.push(t[1]),this.vertices.push(t[2]),this.vertices.push(e[0]),this.vertices.push(e[1]),this.vertices.push(e[2]),this.materialIndices.push(C),this.nvertices++}Vertex(t,e,n=[0,0,0,0]){return this.vertices.push(t[0]),this.vertices.push(t[1]),this.vertices.push(t[2]),this.vertices.push(e[0]),this.vertices.push(e[1]),this.vertices.push(e[2]),this.materialIndices.push(C),this.colors.push(n[0]),this.colors.push(n[1]),this.colors.push(n[2]),this.colors.push(n[3]),this.nvertices++}vertex0(t,e){return this.vertices.push(t[0]),this.vertices.push(t[1]),this.vertices.push(t[2]),this.vertices.push(e),this.materialIndices.push(C),this.nvertices++}iVertex(t,e,n,r,i=[0,0,0,0]){let a=6*t;this.vertices[a]=e[0],this.vertices[a+1]=e[1],this.vertices[a+2]=e[2],this.vertices[a+3]=n[0],this.vertices[a+4]=n[1],this.vertices[a+5]=n[2],this.materialIndices[t]=C;let s=4*t;this.colors[s]=i[0],this.colors[s+1]=i[1],this.colors[s+2]=i[2],this.colors[s+3]=i[3],r&&this.indices.push(t)}append(t){Et(this.vertices,t.vertices),Et(this.materialIndices,t.materialIndices),Et(this.colors,t.colors),function(t,e,n){let r=t.length,i=e.length;t.length+=e.length;for(let a=0;a<i;++a)t[r+a]=e[a]+n}(this.indices,t.indices,this.nvertices),this.nvertices+=t.nvertices}}function Et(t,e){let n=t.length,r=e.length;t.length+=r;for(let i=0;i<r;++i)t[n+i]=e[i]}class Tt{constructor(){this.data=new At,this.Onscreen=!1,this.m=[]}offscreen(t){let e=W,n=t[0],r=n[0],i=n[1],a=n[2],s=1/(e[3]*r+e[7]*i+e[11]*a+e[15]);this.x=this.X=(e[0]*r+e[4]*i+e[8]*a+e[12])*s,this.y=this.Y=(e[1]*r+e[5]*i+e[9]*a+e[13])*s;for(let n=1,r=t.length;n<r;++n){let r=t[n],i=r[0],a=r[1],s=r[2],o=1/(e[3]*i+e[7]*a+e[11]*s+e[15]),h=(e[0]*i+e[4]*a+e[8]*s+e[12])*o,l=(e[1]*i+e[5]*a+e[9]*s+e[13])*o;h<this.x?this.x=h:h>this.X&&(this.X=h),l<this.y?this.y=l:l>this.Y&&(this.Y=l)}return(this.X<-1.01||this.x>1.01||this.Y<-1.01||this.y>1.01)&&(this.Onscreen=!1,!0)}T(t){let e=this.c[0],n=this.c[1],r=this.c[2],i=t[0]-e,a=t[1]-n,s=t[2]-r;return[i*G[0]+a*G[3]+s*G[6]+e,i*G[1]+a*G[4]+s*G[7]+n,i*G[2]+a*G[5]+s*G[8]+r]}Tcorners(t,e){return[this.T(t),this.T([t[0],t[1],e[2]]),this.T([t[0],e[1],t[2]]),this.T([t[0],e[1],e[2]]),this.T([e[0],t[1],t[2]]),this.T([e[0],t[1],e[2]]),this.T([e[0],e[1],t[2]]),this.T(e)]}setMaterial(t,e){null==t.materialTable[this.MaterialIndex]&&(t.materials.length>=p&&(t.partial=!0,e()),t.materialTable[this.MaterialIndex]=t.materials.length,t.materials.push(M[this.MaterialIndex])),C=t.materialTable[this.MaterialIndex]}render(){let t,e;if(this.setMaterialIndex(),this.transform){t=this.transform(this.controlpoints);let e=It(t);this.epsilon=e*Number.EPSILON;let n=Math.sqrt(1e3*Number.EPSILON*e);[this.Min,this.Max]=this.Bounds(t,n)}else t=this.controlpoints;var n,r;if(0==this.CenterIndex?(n=this.Min,r=this.Max,e=[n,[n[0],n[1],r[2]],[n[0],r[1],n[2]],[n[0],r[1],r[2]],[r[0],n[1],n[2]],[r[0],n[1],r[2]],[r[0],r[1],n[2]],r]):(this.c=a.Centers[this.CenterIndex-1],e=this.Tcorners(this.Min,this.Max)),this.offscreen(e))return this.data.clear(),void this.notRendered();let i;if(0==this.CenterIndex){if(!J&&this.Onscreen)return void this.append();i=t}else{let e=t.length;i=Array(e);for(let n=0;n<e;++n)i[n]=this.T(t[n])}let s=a.orthographic?1:this.Min[2]/a.maxBound[2],o=.75*Math.hypot(s*(K.xmax-K.xmin),s*(K.ymax-K.ymin))/S;this.res2=o*o,this.Epsilon=.1*o,this.data.clear(),this.notRendered(),this.Onscreen=!0,this.process(i)}}function yt(t,e){let n=t[0],r=t.length;for(let i=1;i<r;++i)n=e(n,t[i]);return n}function It(t){let e=t[0],n=0,r=t.length;for(let i=1;i<r;++i)n=ft(n,$t([t[i][0]-e[0],t[i][1]-e[1],t[i][2]-e[2]]));return n}class Lt extends Tt{constructor(t,e,n,r=null,i=null,a=null){super(),this.controlpoints=t,this.CenterIndex=e,this.MaterialIndex=n,this.Color=r,this.geometryTransform=i,this.colorTransform=a;const s=t.length;if(r){let t=r[0][3]+r[1][3]+r[2][3];this.transparent=16==s||4==s?t+r[3][3]<4:t<3}else this.transparent=M[n].diffuse[3]<1;if(r&&(this.color=[...r]),this.vertex=this.transparent?this.data.Vertex.bind(this.data):this.data.vertex.bind(this.data),this.transform=i,null==i){let e=It(t),n=Math.sqrt(1e3*Number.EPSILON*e);this.epsilon=e*Number.EPSILON,[this.Min,this.Max]=this.Bounds(t,n)}}setMaterialIndex(){this.transparent?this.setMaterial(q,Xe):this.color?this.setMaterial(B,Ce):this.setMaterial(U,Fe)}cornerbound(t,e){let n=e(t[0],t[3]);return n=e(n,t[12]),e(n,t[15])}controlbound(t,e){let n=e(t[1],t[2]);return n=e(n,t[4]),n=e(n,t[5]),n=e(n,t[6]),n=e(n,t[7]),n=e(n,t[8]),n=e(n,t[9]),n=e(n,t[10]),n=e(n,t[11]),n=e(n,t[13]),e(n,t[14])}bound(t,e,n,r,i){if(n=e(n,this.cornerbound(t,e)),e(-1,1)*(n-this.controlbound(t,e))>=-r||0==i)return n;--i,r*=2;const a=new Wt(t[0],t[1],t[2],t[3]),s=new Wt(t[4],t[5],t[6],t[7]),o=new Wt(t[8],t[9],t[10],t[11]),h=new Wt(t[12],t[13],t[14],t[15]),l=new Wt(t[0],t[4],t[8],t[12]),u=new Wt(a.m0,s.m0,o.m0,h.m0),c=new Wt(a.m3,s.m3,o.m3,h.m3),f=new Wt(a.m5,s.m5,o.m5,h.m5),m=new Wt(a.m4,s.m4,o.m4,h.m4),d=new Wt(a.m2,s.m2,o.m2,h.m2),M=new Wt(t[3],t[7],t[11],t[15]),v=[t[0],a.m0,a.m3,a.m5,l.m0,u.m0,c.m0,f.m0,l.m3,u.m3,c.m3,f.m3,l.m5,u.m5,c.m5,f.m5];n=this.bound(v,e,n,r,i);const p=[l.m5,u.m5,c.m5,f.m5,l.m4,u.m4,c.m4,f.m4,l.m2,u.m2,c.m2,f.m2,t[12],h.m0,h.m3,h.m5];n=this.bound(p,e,n,r,i);const g=[f.m5,m.m5,d.m5,M.m5,f.m4,m.m4,d.m4,M.m4,f.m2,m.m2,d.m2,M.m2,h.m5,h.m4,h.m2,t[15]];n=this.bound(g,e,n,r,i);const b=[a.m5,a.m4,a.m2,t[3],f.m0,m.m0,d.m0,M.m0,f.m3,m.m3,d.m3,M.m3,f.m5,m.m5,d.m5,M.m5];return this.bound(b,e,n,r,i)}cornerboundtri(t,e){let n=e(t[0],t[6]);return e(n,t[9])}controlboundtri(t,e){let n=e(t[1],t[2]);return n=e(n,t[3]),n=e(n,t[4]),n=e(n,t[5]),n=e(n,t[7]),e(n,t[8])}boundtri(t,e,n,r,i){if(n=e(n,this.cornerboundtri(t,e)),e(-1,1)*(n-this.controlboundtri(t,e))>=-r||0==i)return n;--i,r*=2;let a=new kt(t),s=[a.l003,a.l102,a.l012,a.l201,a.l111,a.l021,a.l300,a.l210,a.l120,a.l030];n=this.boundtri(s,e,n,r,i);let o=[a.l300,a.r102,a.r012,a.r201,a.r111,a.r021,a.r300,a.r210,a.r120,a.r030];n=this.boundtri(o,e,n,r,i);let h=[a.l030,a.u102,a.u012,a.u201,a.u111,a.u021,a.r030,a.u210,a.u120,a.u030];n=this.boundtri(h,e,n,r,i);let l=[a.r030,a.u201,a.r021,a.u102,a.c111,a.r012,a.l030,a.l120,a.l210,a.l300];return this.boundtri(l,e,n,r,i)}Bound(t,e,n){let r=Array(3),i=t.length,a=Array(i);for(let s=0;s<3;++s){for(let e=0;e<i;++e)a[e]=t[e][s];r[s]=16==i?this.bound(a,e,a[0],n,w):10==i?this.boundtri(a,e,a[0],n,w):yt(a,e)}return[r[0],r[1],r[2]]}Bounds(t,e){return[this.Bound(t,ct,e),this.Bound(t,ft,e)]}processTriangle(t){let e=t[0],n=t[1],r=t[2],i=jt(Qt([n[0]-e[0],n[1]-e[1],n[2]-e[2]],[r[0]-e[0],r[1]-e[1],r[2]-e[2]]));if(!this.offscreen([e,n,r])){let t,a,s;this.color?(t=this.data.Vertex(e,i,this.color[0]),a=this.data.Vertex(n,i,this.color[1]),s=this.data.Vertex(r,i,this.color[2])):(t=this.vertex(e,i),a=this.vertex(n,i),s=this.vertex(r,i)),0==tt?(this.data.indices.push(t),this.data.indices.push(a),this.data.indices.push(s)):(this.data.indices.push(t),this.data.indices.push(a),this.data.indices.push(a),this.data.indices.push(s),this.data.indices.push(s),this.data.indices.push(t)),this.append()}}processQuad(t){let e=t[0],n=t[1],r=t[2],i=t[3],a=Qt([n[0]-e[0],n[1]-e[1],n[2]-e[2]],[r[0]-n[0],r[1]-n[1],r[2]-n[2]]),s=Qt([r[0]-i[0],r[1]-i[1],r[2]-i[2]],[i[0]-e[0],i[1]-e[1],i[2]-e[2]]),o=jt([a[0]+s[0],a[1]+s[1],a[2]+s[2]]);if(!this.offscreen([e,n,r,i])){let t,a,s,h;this.color?(t=this.data.Vertex(e,o,this.color[0]),a=this.data.Vertex(n,o,this.color[1]),s=this.data.Vertex(r,o,this.color[2]),h=this.data.Vertex(i,o,this.color[3])):(t=this.vertex(e,o),a=this.vertex(n,o),s=this.vertex(r,o),h=this.vertex(i,o)),0==tt?(this.data.indices.push(t),this.data.indices.push(a),this.data.indices.push(s),this.data.indices.push(t),this.data.indices.push(s),this.data.indices.push(h)):(this.data.indices.push(t),this.data.indices.push(a),this.data.indices.push(a),this.data.indices.push(s),this.data.indices.push(s),this.data.indices.push(h),this.data.indices.push(h),this.data.indices.push(t)),this.append()}}curve(t,e,n,r,i){new Ot([t[e],t[n],t[r],t[i]],0,C,this.Min,this.Max).render()}process(t){if(this.transparent&&1!=tt&&(C=this.color?-1-C:1+C),10==t.length)return this.process3(t);if(3==t.length)return this.processTriangle(t);if(4==t.length)return this.processQuad(t);if(this.color&&this.colorTransform&&(this.color=this.colorTransform(this.Color,t)),1==tt)return this.curve(t,0,4,8,12),this.curve(t,12,13,14,15),this.curve(t,15,11,7,3),void this.curve(t,3,2,1,0);let e=t[0],n=t[3],r=t[12],i=t[15],a=this.normal(n,t[2],t[1],e,t[4],t[8],r);$t(a)<this.epsilon&&(a=this.normal(n,t[2],t[1],e,t[13],t[14],i),$t(a)<this.epsilon&&(a=this.normal(i,t[11],t[7],n,t[4],t[8],r)));let s=this.normal(e,t[4],t[8],r,t[13],t[14],i);$t(s)<this.epsilon&&(s=this.normal(e,t[4],t[8],r,t[11],t[7],n),$t(s)<this.epsilon&&(s=this.normal(n,t[2],t[1],e,t[13],t[14],i)));let o=this.normal(r,t[13],t[14],i,t[11],t[7],n);$t(o)<this.epsilon&&(o=this.normal(r,t[13],t[14],i,t[2],t[1],e),$t(o)<this.epsilon&&(o=this.normal(e,t[4],t[8],r,t[11],t[7],n)));let h=this.normal(i,t[11],t[7],n,t[2],t[1],e);if($t(h)<this.epsilon&&(h=this.normal(i,t[11],t[7],n,t[4],t[8],r),$t(h)<this.epsilon&&(h=this.normal(r,t[13],t[14],i,t[2],t[1],e))),this.color){let l=this.color[0],u=this.color[1],c=this.color[2],f=this.color[3],m=this.data.Vertex(e,a,l),d=this.data.Vertex(r,s,u),M=this.data.Vertex(i,o,c),v=this.data.Vertex(n,h,f);this.Render(t,m,d,M,v,e,r,i,n,!1,!1,!1,!1,l,u,c,f)}else{let l=this.vertex(e,a),u=this.vertex(r,s),c=this.vertex(i,o),f=this.vertex(n,h);this.Render(t,l,u,c,f,e,r,i,n,!1,!1,!1,!1)}this.data.indices.length>0&&this.append()}append(){this.transparent?q.append(this.data):this.color?B.append(this.data):U.append(this.data)}notRendered(){this.transparent?q.rendered=!1:this.color?B.rendered=!1:U.rendered=!1}Render(t,e,n,r,i,a,s,o,h,l,u,c,f,m=null,d=null,M=null,v=null){let p=this.Distance(t);if(p[0]<this.res2&&p[1]<this.res2)this.offscreen([a,s,o])||(0==tt?(this.data.indices.push(e),this.data.indices.push(n),this.data.indices.push(r)):(this.data.indices.push(e),this.data.indices.push(n),this.data.indices.push(n),this.data.indices.push(r))),this.offscreen([a,o,h])||(0==tt?(this.data.indices.push(e),this.data.indices.push(r),this.data.indices.push(i)):(this.data.indices.push(r),this.data.indices.push(i),this.data.indices.push(i),this.data.indices.push(e)));else{if(this.offscreen(t))return;let g=t[0],b=t[3],x=t[12],w=t[15];if(p[0]<this.res2){let p=new Gt(g,t[1],t[2],b),R=new Gt(t[4],t[5],t[6],t[7]),A=new Gt(t[8],t[9],t[10],t[11]),E=new Gt(x,t[13],t[14],w),T=[g,p.m0,p.m3,p.m5,t[4],R.m0,R.m3,R.m5,t[8],A.m0,A.m3,A.m5,x,E.m0,E.m3,E.m5],y=[p.m5,p.m4,p.m2,b,R.m5,R.m4,R.m2,t[7],A.m5,A.m4,A.m2,t[11],E.m5,E.m4,E.m2,w],I=this.normal(T[12],T[13],T[14],T[15],T[11],T[7],T[3]);$t(I)<=this.epsilon&&(I=this.normal(T[12],T[13],T[14],T[15],T[2],T[1],T[0]),$t(I)<=this.epsilon&&(I=this.normal(T[0],T[4],T[8],T[12],T[11],T[7],T[3])));let L=this.normal(y[3],y[2],y[1],y[0],y[4],y[8],y[12]);$t(L)<=this.epsilon&&(L=this.normal(y[3],y[2],y[1],y[0],y[13],y[14],y[15]),$t(L)<=this.epsilon&&(L=this.normal(y[15],y[11],y[7],y[3],y[4],y[8],y[12])));let N=this.Epsilon,P=[.5*(s[0]+o[0]),.5*(s[1]+o[1]),.5*(s[2]+o[2])];if(!u)if(u=ne(x,t[13],t[14],w)<this.res2){let t=jt(this.differential(y[12],y[8],y[4],y[0]));P=[P[0]-N*t[0],P[1]-N*t[1],P[2]-N*t[2]]}else P=T[15];let S=[.5*(h[0]+a[0]),.5*(h[1]+a[1]),.5*(h[2]+a[2])];if(!f)if(f=ne(g,t[1],t[2],b)<this.res2){let t=jt(this.differential(T[3],T[7],T[11],T[15]));S=[S[0]-N*t[0],S[1]-N*t[1],S[2]-N*t[2]]}else S=y[0];if(m){let t=Array(4),p=Array(4);for(let e=0;e<4;++e)t[e]=.5*(d[e]+M[e]),p[e]=.5*(v[e]+m[e]);let g=this.data.Vertex(P,I,t),b=this.data.Vertex(S,L,p);this.Render(T,e,n,g,b,a,s,P,S,l,u,!1,f,m,d,t,p),this.Render(y,b,g,r,i,S,P,o,h,!1,u,c,f,p,t,M,v)}else{let t=this.vertex(P,I),m=this.vertex(S,L);this.Render(T,e,n,t,m,a,s,P,S,l,u,!1,f),this.Render(y,m,t,r,i,S,P,o,h,!1,u,c,f)}return}if(p[1]<this.res2){let p=new Gt(g,t[4],t[8],x),R=new Gt(t[1],t[5],t[9],t[13]),A=new Gt(t[2],t[6],t[10],t[14]),E=new Gt(b,t[7],t[11],w),T=[g,t[1],t[2],b,p.m0,R.m0,A.m0,E.m0,p.m3,R.m3,A.m3,E.m3,p.m5,R.m5,A.m5,E.m5],y=[p.m5,R.m5,A.m5,E.m5,p.m4,R.m4,A.m4,E.m4,p.m2,R.m2,A.m2,E.m2,x,t[13],t[14],w],I=this.normal(T[0],T[4],T[8],T[12],T[13],T[14],T[15]);$t(I)<=this.epsilon&&(I=this.normal(T[0],T[4],T[8],T[12],T[11],T[7],T[3]),$t(I)<=this.epsilon&&(I=this.normal(T[3],T[2],T[1],T[0],T[13],T[14],T[15])));let L=this.normal(y[15],y[11],y[7],y[3],y[2],y[1],y[0]);$t(L)<=this.epsilon&&(L=this.normal(y[15],y[11],y[7],y[3],y[4],y[8],y[12]),$t(L)<=this.epsilon&&(L=this.normal(y[12],y[13],y[14],y[15],y[2],y[1],y[0])));let N=this.Epsilon,P=[.5*(a[0]+s[0]),.5*(a[1]+s[1]),.5*(a[2]+s[2])];if(!l)if(l=ne(g,t[4],t[8],x)<this.res2){let t=jt(this.differential(y[0],y[1],y[2],y[3]));P=[P[0]-N*t[0],P[1]-N*t[1],P[2]-N*t[2]]}else P=T[12];let S=[.5*(o[0]+h[0]),.5*(o[1]+h[1]),.5*(o[2]+h[2])];if(!c)if(c=ne(w,t[11],t[7],b)<this.res2){let t=jt(this.differential(T[15],T[14],T[13],T[12]));S=[S[0]-N*t[0],S[1]-N*t[1],S[2]-N*t[2]]}else S=y[3];if(m){let t=Array(4),p=Array(4);for(let e=0;e<4;++e)t[e]=.5*(m[e]+d[e]),p[e]=.5*(M[e]+v[e]);let g=this.data.Vertex(P,I,t),b=this.data.Vertex(S,L,p);this.Render(T,e,g,b,i,a,P,S,h,l,!1,c,f,m,t,p,v),this.Render(y,g,n,r,b,P,s,o,S,l,u,c,!1,t,d,M,p)}else{let t=this.vertex(P,I),m=this.vertex(S,L);this.Render(T,e,t,m,i,a,P,S,h,l,!1,c,f),this.Render(y,t,n,r,m,P,s,o,S,l,u,c,!1)}return}let R=new Gt(g,t[1],t[2],b),A=new Gt(t[4],t[5],t[6],t[7]),E=new Gt(t[8],t[9],t[10],t[11]),T=new Gt(x,t[13],t[14],w),y=new Gt(g,t[4],t[8],x),I=new Gt(R.m0,A.m0,E.m0,T.m0),L=new Gt(R.m3,A.m3,E.m3,T.m3),N=new Gt(R.m5,A.m5,E.m5,T.m5),P=new Gt(R.m4,A.m4,E.m4,T.m4),S=new Gt(R.m2,A.m2,E.m2,T.m2),O=new Gt(b,t[7],t[11],w),_=[g,R.m0,R.m3,R.m5,y.m0,I.m0,L.m0,N.m0,y.m3,I.m3,L.m3,N.m3,y.m5,I.m5,L.m5,N.m5],V=[y.m5,I.m5,L.m5,N.m5,y.m4,I.m4,L.m4,N.m4,y.m2,I.m2,L.m2,N.m2,x,T.m0,T.m3,T.m5],Y=[N.m5,P.m5,S.m5,O.m5,N.m4,P.m4,S.m4,O.m4,N.m2,P.m2,S.m2,O.m2,T.m5,T.m4,T.m2,w],D=[R.m5,R.m4,R.m2,b,N.m0,P.m0,S.m0,O.m0,N.m3,P.m3,S.m3,O.m3,N.m5,P.m5,S.m5,O.m5],U=_[15],B=this.normal(_[0],_[4],_[8],_[12],_[13],_[14],_[15]);$t(B)<this.epsilon&&(B=this.normal(_[0],_[4],_[8],_[12],_[11],_[7],_[3]),$t(B)<this.epsilon&&(B=this.normal(_[3],_[2],_[1],_[0],_[13],_[14],_[15])));let q=this.normal(V[12],V[13],V[14],V[15],V[11],V[7],V[3]);$t(q)<this.epsilon&&(q=this.normal(V[12],V[13],V[14],V[15],V[2],V[1],V[0]),$t(q)<this.epsilon&&(q=this.normal(V[0],V[4],V[8],V[12],V[11],V[7],V[3])));let F=this.normal(Y[15],Y[11],Y[7],Y[3],Y[2],Y[1],Y[0]);$t(F)<this.epsilon&&(F=this.normal(Y[15],Y[11],Y[7],Y[3],Y[4],Y[8],Y[12]),$t(F)<this.epsilon&&(F=this.normal(Y[12],Y[13],Y[14],Y[15],Y[2],Y[1],Y[0])));let C=this.normal(D[3],D[2],D[1],D[0],D[4],D[8],D[12]);$t(C)<this.epsilon&&(C=this.normal(D[3],D[2],D[1],D[0],D[13],D[14],D[15]),$t(C)<this.epsilon&&(C=this.normal(D[15],D[11],D[7],D[3],D[4],D[8],D[12])));let z=this.normal(Y[3],Y[2],Y[1],U,Y[4],Y[8],Y[12]),X=this.Epsilon,H=[.5*(a[0]+s[0]),.5*(a[1]+s[1]),.5*(a[2]+s[2])];if(!l)if(l=ne(g,t[4],t[8],x)<this.res2){let t=jt(this.differential(V[0],V[1],V[2],V[3]));H=[H[0]-X*t[0],H[1]-X*t[1],H[2]-X*t[2]]}else H=_[12];let W=[.5*(s[0]+o[0]),.5*(s[1]+o[1]),.5*(s[2]+o[2])];if(!u)if(u=ne(x,t[13],t[14],w)<this.res2){let t=jt(this.differential(Y[12],Y[8],Y[4],Y[0]));W=[W[0]-X*t[0],W[1]-X*t[1],W[2]-X*t[2]]}else W=V[15];let G=[.5*(o[0]+h[0]),.5*(o[1]+h[1]),.5*(o[2]+h[2])];if(!c)if(c=ne(w,t[11],t[7],b)<this.res2){let t=jt(this.differential(D[15],D[14],D[13],D[12]));G=[G[0]-X*t[0],G[1]-X*t[1],G[2]-X*t[2]]}else G=Y[3];let k=[.5*(h[0]+a[0]),.5*(h[1]+a[1]),.5*(h[2]+a[2])];if(!f)if(f=ne(g,t[1],t[2],b)<this.res2){let t=jt(this.differential(_[3],_[7],_[11],_[15]));k=[k[0]-X*t[0],k[1]-X*t[1],k[2]-X*t[2]]}else k=D[0];if(m){let t=Array(4),p=Array(4),g=Array(4),b=Array(4),x=Array(4);for(let e=0;e<4;++e)t[e]=.5*(m[e]+d[e]),p[e]=.5*(d[e]+M[e]),g[e]=.5*(M[e]+v[e]),b[e]=.5*(v[e]+m[e]),x[e]=.5*(t[e]+g[e]);let w=this.data.Vertex(H,B,t),R=this.data.Vertex(W,q,p),A=this.data.Vertex(G,F,g),E=this.data.Vertex(k,C,b),T=this.data.Vertex(U,z,x);this.Render(_,e,w,T,E,a,H,U,k,l,!1,!1,f,m,t,x,b),this.Render(V,w,n,R,T,H,s,W,U,l,u,!1,!1,t,d,p,x),this.Render(Y,T,R,r,A,U,W,o,G,!1,u,c,!1,x,p,M,g),this.Render(D,E,T,A,i,k,U,G,h,!1,!1,c,f,b,x,g,v)}else{let t=this.vertex(H,B),m=this.vertex(W,q),d=this.vertex(G,F),M=this.vertex(k,C),v=this.vertex(U,z);this.Render(_,e,t,v,M,a,H,U,k,l,!1,!1,f),this.Render(V,t,n,m,v,H,s,W,U,l,u,!1,!1),this.Render(Y,v,m,r,d,U,W,o,G,!1,u,c,!1),this.Render(D,M,v,d,i,k,U,G,h,!1,!1,c,f)}}}process3(t){if(1==tt)return this.curve(t,0,1,3,6),this.curve(t,6,7,8,9),void this.curve(t,9,5,2,0);let e=t[0],n=t[6],r=t[9],i=this.normal(r,t[5],t[2],e,t[1],t[3],n),a=this.normal(e,t[1],t[3],n,t[7],t[8],r),s=this.normal(n,t[7],t[8],r,t[5],t[2],e);if(this.color){let o=this.color[0],h=this.color[1],l=this.color[2],u=this.data.Vertex(e,i,o),c=this.data.Vertex(n,a,h),f=this.data.Vertex(r,s,l);this.Render3(t,u,c,f,e,n,r,!1,!1,!1,o,h,l)}else{let o=this.vertex(e,i),h=this.vertex(n,a),l=this.vertex(r,s);this.Render3(t,o,h,l,e,n,r,!1,!1,!1)}this.data.indices.length>0&&this.append()}Render3(t,e,n,r,i,a,s,o,h,l,u=null,c=null,f=null){if(this.Distance3(t)<this.res2)this.offscreen([i,a,s])||(0==tt?(this.data.indices.push(e),this.data.indices.push(n),this.data.indices.push(r)):(this.data.indices.push(e),this.data.indices.push(n),this.data.indices.push(n),this.data.indices.push(r),this.data.indices.push(r),this.data.indices.push(e)));else{if(this.offscreen(t))return;let m=t[0],d=t[1],M=t[2],v=t[3],p=t[4],g=t[5],b=t[6],x=t[7],w=t[8],R=t[9],A=[.5*(R[0]+g[0]),.5*(R[1]+g[1]),.5*(R[2]+g[2])],E=[.5*(R[0]+w[0]),.5*(R[1]+w[1]),.5*(R[2]+w[2])],T=[.5*(g[0]+M[0]),.5*(g[1]+M[1]),.5*(g[2]+M[2])],y=[.5*(w[0]+p[0]),.5*(w[1]+p[1]),.5*(w[2]+p[2])],I=[.5*(w[0]+x[0]),.5*(w[1]+x[1]),.5*(w[2]+x[2])],L=[.5*(M[0]+p[0]),.5*(M[1]+p[1]),.5*(M[2]+p[2])],N=[.5*(M[0]+m[0]),.5*(M[1]+m[1]),.5*(M[2]+m[2])],P=[.5*(p[0]+v[0]),.5*(p[1]+v[1]),.5*(p[2]+v[2])],S=[.5*(x[0]+b[0]),.5*(x[1]+b[1]),.5*(x[2]+b[2])],O=[.5*(m[0]+d[0]),.5*(m[1]+d[1]),.5*(m[2]+d[2])],_=[.5*(d[0]+v[0]),.5*(d[1]+v[1]),.5*(d[2]+v[2])],V=[.5*(v[0]+b[0]),.5*(v[1]+b[1]),.5*(v[2]+b[2])],Y=[.5*(A[0]+T[0]),.5*(A[1]+T[1]),.5*(A[2]+T[2])],D=[.5*(E[0]+I[0]),.5*(E[1]+I[1]),.5*(E[2]+I[2])],U=[.5*(T[0]+N[0]),.5*(T[1]+N[1]),.5*(T[2]+N[2])],B=[.5*y[0]+.25*(p[0]+d[0]),.5*y[1]+.25*(p[1]+d[1]),.5*y[2]+.25*(p[2]+d[2])],q=[.5*(I[0]+S[0]),.5*(I[1]+S[1]),.5*(I[2]+S[2])],F=[.5*L[0]+.25*(p[0]+x[0]),.5*L[1]+.25*(p[1]+x[1]),.5*L[2]+.25*(p[2]+x[2])],C=[.25*(g[0]+p[0])+.5*P[0],.25*(g[1]+p[1])+.5*P[1],.25*(g[2]+p[2])+.5*P[2]],z=[.5*(O[0]+_[0]),.5*(O[1]+_[1]),.5*(O[2]+_[2])],X=[.5*(_[0]+V[0]),.5*(_[1]+V[1]),.5*(_[2]+V[2])],H=[.5*(F[0]+z[0]),.5*(F[1]+z[1]),.5*(F[2]+z[2])],W=[.5*(F[0]+X[0]),.5*(F[1]+X[1]),.5*(F[2]+X[2])],G=[.5*(z[0]+X[0]),.5*(z[1]+X[1]),.5*(z[2]+X[2])],k=[.5*(C[0]+q[0]),.5*(C[1]+q[1]),.5*(C[2]+q[2])],j=[.5*(D[0]+C[0]),.5*(D[1]+C[1]),.5*(D[2]+C[2])],$=[.5*(D[0]+q[0]),.5*(D[1]+q[1]),.5*(D[2]+q[2])],Z=[.5*(Y[0]+B[0]),.5*(Y[1]+B[1]),.5*(Y[2]+B[2])],Q=[.5*(U[0]+B[0]),.5*(U[1]+B[1]),.5*(U[2]+B[2])],K=[.5*(Y[0]+U[0]),.5*(Y[1]+U[1]),.5*(Y[2]+U[2])],J=[m,O,N,z,[.5*(L[0]+O[0]),.5*(L[1]+O[1]),.5*(L[2]+O[2])],U,G,H,Q,K],tt=[G,X,W,V,[.5*(P[0]+S[0]),.5*(P[1]+S[1]),.5*(P[2]+S[2])],k,b,S,q,$],et=[K,Z,Y,j,[.5*(A[0]+y[0]),.5*(A[1]+y[1]),.5*(A[2]+y[2])],A,$,D,E,R],nt=[$,j,k,Z,[.25*(T[0]+I[0]+_[0]+p[0]),.25*(T[1]+I[1]+_[1]+p[1]),.25*(T[2]+I[2]+_[2]+p[2])],W,K,Q,H,G],rt=this.normal(G,W,k,$,j,Z,K),it=this.normal($,j,Z,K,Q,H,G),at=this.normal(K,Q,H,G,W,k,$),st=this.Epsilon,ot=[.5*(a[0]+s[0]),.5*(a[1]+s[1]),.5*(a[2]+s[2])];if(!o)if(o=ne(b,x,w,R)<this.res2){let t=jt(this.sumdifferential(nt[0],nt[2],nt[5],nt[9],nt[1],nt[3],nt[6]));ot=[ot[0]-st*t[0],ot[1]-st*t[1],ot[2]-st*t[2]]}else ot=$;let ht=[.5*(s[0]+i[0]),.5*(s[1]+i[1]),.5*(s[2]+i[2])];if(!h)if(h=ne(m,M,g,R)<this.res2){let t=jt(this.sumdifferential(nt[6],nt[3],nt[1],nt[0],nt[7],nt[8],nt[9]));ht=[ht[0]-st*t[0],ht[1]-st*t[1],ht[2]-st*t[2]]}else ht=K;let lt=[.5*(i[0]+a[0]),.5*(i[1]+a[1]),.5*(i[2]+a[2])];if(!l)if(l=ne(m,d,v,b)<this.res2){let t=jt(this.sumdifferential(nt[9],nt[8],nt[7],nt[6],nt[5],nt[2],nt[0]));lt=[lt[0]-st*t[0],lt[1]-st*t[1],lt[2]-st*t[2]]}else lt=G;if(u){let t=Array(4),m=Array(4),d=Array(4);for(let e=0;e<4;++e)t[e]=.5*(c[e]+f[e]),m[e]=.5*(f[e]+u[e]),d[e]=.5*(u[e]+c[e]);let M=this.data.Vertex(ot,rt,t),v=this.data.Vertex(ht,it,m),p=this.data.Vertex(lt,at,d);this.Render3(J,e,p,v,i,lt,ht,!1,h,l,u,d,m),this.Render3(tt,p,n,M,lt,a,ot,o,!1,l,d,c,t),this.Render3(et,v,M,r,ht,ot,s,o,h,!1,m,t,f),this.Render3(nt,M,v,p,ot,ht,lt,!1,!1,!1,t,m,d)}else{let t=this.vertex(ot,rt),u=this.vertex(ht,it),c=this.vertex(lt,at);this.Render3(J,e,c,u,i,lt,ht,!1,h,l),this.Render3(tt,c,n,t,lt,a,ot,o,!1,l),this.Render3(et,u,t,r,ht,ot,s,o,h,!1),this.Render3(nt,t,u,c,ot,ht,lt,!1,!1,!1)}}}Distance(t){let e=t[0],n=t[3],r=t[12],i=t[15],a=re(e,r,n,i);a=ft(a,ne(e,t[4],t[8],r)),a=ft(a,ne(t[1],t[5],t[9],t[13])),a=ft(a,ne(n,t[7],t[11],i)),a=ft(a,ne(t[2],t[6],t[10],t[14]));let s=re(e,n,r,i);return s=ft(s,ne(e,t[1],t[2],n)),s=ft(s,ne(t[4],t[5],t[6],t[7])),s=ft(s,ne(t[8],t[9],t[10],t[11])),s=ft(s,ne(r,t[13],t[14],i)),[a,s]}Distance3(t){let e=t[0],n=t[4],r=t[6],i=t[9],a=$t([(e[0]+r[0]+i[0])*g-n[0],(e[1]+r[1]+i[1])*g-n[1],(e[2]+r[2]+i[2])*g-n[2]]);return a=ft(a,ne(e,t[1],t[3],r)),a=ft(a,ne(e,t[2],t[5],i)),ft(a,ne(r,t[7],t[8],i))}differential(t,e,n,r){let i=[3*(e[0]-t[0]),3*(e[1]-t[1]),3*(e[2]-t[2])];return $t(i)>this.epsilon?i:(i=te(t,e,n),$t(i)>this.epsilon?i:ee(t,e,n,r))}sumdifferential(t,e,n,r,i,a,s){let o=this.differential(t,e,n,r),h=this.differential(t,i,a,s);return[o[0]+h[0],o[1]+h[1],o[2]+h[2]]}normal(t,e,n,r,i,a,s){let o=3*(i[0]-r[0]),h=3*(i[1]-r[1]),l=3*(i[2]-r[2]),u=3*(n[0]-r[0]),c=3*(n[1]-r[1]),f=3*(n[2]-r[2]),m=[h*f-l*c,l*u-o*f,o*c-h*u];if($t(m)>this.epsilon)return m;let d=[u,c,f],M=[o,h,l],v=te(r,n,e),p=te(r,i,a),g=Qt(p,d),b=Qt(M,v);if(m=[g[0]+b[0],g[1]+b[1],g[2]+b[2]],$t(m)>this.epsilon)return m;let x=ee(r,n,e,t),w=ee(r,i,a,s);g=Qt(M,x),b=Qt(w,d);let R=Qt(p,v);return m=[g[0]+b[0]+R[0],g[1]+b[1]+R[1],g[2]+b[2]+R[2]],$t(m)>this.epsilon?m:(g=Qt(w,v),b=Qt(p,x),m=[g[0]+b[0],g[1]+b[1],g[2]+b[2]],$t(m)>this.epsilon?m:Qt(w,x))}}function Nt(t,e,n,r){return[r-t+3*(e-n),2*(t+n)-4*e,e-t]}function Pt(t){return 0<=t&&t<=1}class St{constructor(t,e,n){const r=1e3*Number.EPSILON,i=r*r;if(Math.abs(t)<=r*Math.abs(e)+i*Math.abs(n))Math.abs(e)>r*Math.abs(n)?(this.roots=1,this.t1=-n/e):0==n?(this.roots=1,this.t1=0):this.roots=0;else{let i=.5*e/t,a=e*i;if(Math.abs(a)<=r*Math.abs(n)){let e=-n/t;e>=0?(this.roots=2,this.t2=Math.sqrt(e),this.t1=-this.t2):this.roots=0}else{let t=-2*n/a;if(t>-1){this.roots=2;let e=i*function(t){return t/(Math.sqrt(1+t)+1)}(t),n=-e-2*i;n<=e?(this.t1=n,this.t2=e):(this.t1=e,this.t2=n)}else-1==t?(this.roots=1,this.t1=this.t2=-i):this.roots=0}}}}class Ot extends Tt{constructor(t,e,n,r=null,i=null,a=null){super(),this.controlpoints=t,this.CenterIndex=e,this.MaterialIndex=n,this.transform=a,null==a&&([this.Min,this.Max]=this.Bounds(t,0))}Bounds(t,e){let n=Array(3),r=Array(3),i=t.length,a=Array(i);for(let e=0;e<3;++e){for(let n=0;n<i;++n)a[n]=t[n][e];let s,o;if(s=o=a[0],4==i){s=ct(s,a[3]),o=ft(o,a[3]);let t=Nt(a[0],a[1],a[2],a[3]),e=new St(t[0],t[1],t[2]);if(0!=e.roots&&Pt(e.t1)){let t=Kt(a[0],a[1],a[2],a[3],e.t1);s=ct(s,t),o=ft(o,t)}if(2==e.roots&&Pt(e.t2)){let t=Kt(a[0],a[1],a[2],a[3],e.t2);s=ct(s,t),o=ft(o,t)}}else{let t=a[1];s=ct(s,t),o=ft(o,t)}n[e]=s,r[e]=o}return[[n[0],n[1],n[2]],[r[0],r[1],r[2]]]}setMaterialIndex(){this.setMaterial(D,qe)}processLine(t){let e=t[0],n=t[1];if(!this.offscreen([e,n])){let t=[0,0,1];this.data.indices.push(this.data.vertex(e,t)),this.data.indices.push(this.data.vertex(n,t)),this.append()}}process(t){if(2==t.length)return this.processLine(t);let e=t[0],n=t[1],r=t[2],i=t[3],a=this.normal(Jt(e,n),te(e,n,r)),s=this.normal(Jt(r,i),te(i,r,n)),o=this.data.vertex(e,a),h=this.data.vertex(i,s);this.Render(t,o,h),this.data.indices.length>0&&this.append()}append(){D.append(this.data)}notRendered(){D.rendered=!1}Render(t,e,n){let r=t[0],i=t[1],a=t[2],s=t[3];if(ne(r,i,a,s)<this.res2)this.offscreen([r,s])||(this.data.indices.push(e),this.data.indices.push(n));else{if(this.offscreen(t))return;let o=[.5*(r[0]+i[0]),.5*(r[1]+i[1]),.5*(r[2]+i[2])],h=[.5*(i[0]+a[0]),.5*(i[1]+a[1]),.5*(i[2]+a[2])],l=[.5*(a[0]+s[0]),.5*(a[1]+s[1]),.5*(a[2]+s[2])],u=[.5*(o[0]+h[0]),.5*(o[1]+h[1]),.5*(o[2]+h[2])],c=[.5*(h[0]+l[0]),.5*(h[1]+l[1]),.5*(h[2]+l[2])],f=[.5*(u[0]+c[0]),.5*(u[1]+c[1]),.5*(u[2]+c[2])],m=[r,o,u,f],d=[f,c,l,s],M=this.normal(function(t,e,n,r){return[n[0]+r[0]-t[0]-e[0],n[1]+r[1]-t[1]-e[1],n[2]+r[2]-t[2]-e[2]]}(r,i,a,s),function(t,e,n,r){return[3*t[0]-5*e[0]+n[0]+r[0],3*t[1]-5*e[1]+n[1]+r[1],3*t[2]-5*e[2]+n[2]+r[2]]}(r,i,a,s)),v=this.data.vertex(f,M);this.Render(m,e,v),this.Render(d,v,n)}}normal(t,e){let n=Zt(t,t),r=Zt(t,e);return[n*e[0]-r*t[0],n*e[1]-r*t[1],n*e[2]-r*t[2]]}}class _t extends Tt{constructor(t,e,n,r=null){super(),this.controlpoint=t,this.width=e,this.MaterialIndex=n,this.CenterIndex=0,this.Min=t,this.Max=t,this.transform=r,this.controlpoints=[t]}setMaterialIndex(){this.setMaterial(Y,Be)}Bounds(t,e){return[this.controlpoints[0],this.controlpoints[0]]}process(t){this.data.indices.push(this.data.vertex0(t[0],this.width)),this.append()}append(){Y.append(this.data)}notRendered(){Y.rendered=!1}}class Vt extends Tt{constructor(t,e,n=null){super(),this.CenterIndex=t,this.MaterialIndex=e,this.transparent=!1;const r=window;this.controlpoints=r.Positions,this.Normals=r.Normals,this.Colors=r.Colors,this.Indices=r.Indices,this.transparent=M[this.MaterialIndex].diffuse[3]<1}Bound(t,e){let n=Array(3),r=t.length,i=Array(r);for(let a=0;a<3;++a){for(let e=0;e<r;++e)i[e]=t[e][a];n[a]=yt(i,e)}return[n[0],n[1],n[2]]}Bounds(t,e){return[this.Bounds(t,ct),this.Bounds(t,ft)]}setMaterialIndex(){this.transparent?this.setMaterial(q,Xe):this.setMaterial(F,ze)}process(t){this.data.vertices.length=6*t.length,C=this.Colors.length>0?-1-C:1+C;for(let e=0,n=this.Indices.length;e<n;++e){let n=this.Indices[e],r=n[0],i=t[r[0]],a=t[r[1]],s=t[r[2]],o=!this.offscreen([i,a,s]),h=n.length>1?n[1]:r;if(h&&0!=h.length||(h=r),this.Colors.length>0){let t=n.length>2?n[2]:r;t&&0!=t.length||(t=r);let e=this.Colors[t[0]],l=this.Colors[t[1]],u=this.Colors[t[2]];this.transparent=this.transparent||e[3]+l[3]+u[3]<3,0==tt?(this.data.iVertex(r[0],i,this.Normals[h[0]],o,e),this.data.iVertex(r[1],a,this.Normals[h[1]],o,l),this.data.iVertex(r[2],s,this.Normals[h[2]],o,u)):(this.data.iVertex(r[0],i,this.Normals[h[0]],o,e),this.data.iVertex(r[1],a,this.Normals[h[1]],o,l),this.data.iVertex(r[1],a,this.Normals[h[1]],o,l),this.data.iVertex(r[2],s,this.Normals[h[2]],o,u),this.data.iVertex(r[2],s,this.Normals[h[2]],o,u),this.data.iVertex(r[0],i,this.Normals[h[0]],o,e))}else 0==tt?(this.data.iVertex(r[0],i,this.Normals[h[0]],o),this.data.iVertex(r[1],a,this.Normals[h[1]],o),this.data.iVertex(r[2],s,this.Normals[h[2]],o)):(this.data.iVertex(r[0],i,this.Normals[h[0]],o),this.data.iVertex(r[1],a,this.Normals[h[1]],o),this.data.iVertex(r[1],a,this.Normals[h[1]],o),this.data.iVertex(r[2],s,this.Normals[h[2]],o),this.data.iVertex(r[2],s,this.Normals[h[2]],o),this.data.iVertex(r[0],i,this.Normals[h[0]],o))}this.data.nvertices=t.length,this.data.indices.length>0&&this.append()}append(){this.transparent?q.append(this.data):F.append(this.data)}notRendered(){this.transparent?q.rendered=!1:F.rendered=!1}}function Yt(){L=-Math.tan(.5*a.angleOfView)*a.maxBound[2],Z.x=Z.y=0,Z.z=.5*(a.minBound[2]+a.maxBound[2]),A=R=a.zoom0,K.zmin=a.minBound[2],K.zmax=a.maxBound[2],Q.x=Q.y=0,Ge(),J=!0,We()}function Dt(){return window.top.asyWebApplication}function Ut(t){window.parent.asyProjection=t}function Bt(){var e;t.identity(z),Yt(),null===(e=Dt())||void 0===e||e.setProjection(""),Ut(!1)}let qt=0,Ft=1,Ct=2,zt=3,Xt=4;function Ht(t=[]){let e=xt(s,"#ifdef WEBGL2\n#define IN in\n#define OUT out\n#else\n#define IN attribute\n#define OUT varying\n#endif\n\nIN vec3 position;\n#ifdef WIDTH\nIN float width;\n#endif\n#ifdef NORMAL\nIN vec3 normal;\n#endif\n\nIN float materialIndex;\n\n#ifdef WEBGL2\nflat out int MaterialIndex;\n#ifdef COLOR\nOUT vec4 Color;\n#endif\n\n#else\nOUT vec4 diffuse;\nOUT vec3 specular;\nOUT float roughness,metallic,fresnel0;\nOUT vec4 emissive;\n\nstruct Material {\n  vec4 diffuse,emissive,specular;\n  vec4 parameters;\n};\n\nuniform Material Materials[Nmaterials];\n#endif\n\n#ifdef COLOR\nIN vec4 color;\n#endif\n\nuniform bool orthographic;\nuniform mat3 normMat;\nuniform mat4 viewMat;\nuniform mat4 projViewMat;\n\n#ifdef NORMAL\nOUT vec3 ViewPosition;\nOUT vec3 Normal;\n#endif\n\nvoid main(void)\n{\n  vec4 v=vec4(position,1.0);\n  gl_Position=projViewMat*v;\n\n#ifdef NORMAL\n  ViewPosition=orthographic ? vec3(0.0,0.0,-1.0) : (viewMat*v).xyz;\n  Normal=normalize(normal*normMat);\n#endif\n\n#ifdef WEBGL2\n  MaterialIndex=int(materialIndex);\n#ifdef COLOR\n  Color=color;\n#endif\n#else\n#ifdef NORMAL\n  Material m;\n#ifdef TRANSPARENT\n  m=Materials[int(abs(materialIndex))-1];\n  emissive=m.emissive;\n  if(materialIndex >= 0.0)\n    diffuse=m.diffuse;\n  else {\n    diffuse=color;\n#if nlights == 0\n    emissive += color;\n#endif\n  }\n#else\n  m=Materials[int(materialIndex)];\n  emissive=m.emissive;\n#ifdef COLOR\n  diffuse=color;\n#if nlights == 0\n    emissive += color;\n#endif\n#else\n  diffuse=m.diffuse;\n#endif // COLOR\n#endif // TRANSPARENT\n  specular=m.specular.rgb;\n  vec4 parameters=m.parameters;\n  roughness=1.0-parameters[0];\n  metallic=parameters[1];\n  fresnel0=parameters[2];\n#else\n  emissive=Materials[int(materialIndex)].emissive;\n#endif // NORMAL\n#endif // WEBGL2\n\n#ifdef WIDTH\n  gl_PointSize=width;\n#endif\n}\n",s.VERTEX_SHADER,t),n=xt(s,"#ifdef WEBGL2\n#define IN in\nout vec4 outValue;\n#define OUTVALUE outValue\n#else\n#define IN varying\n#define OUTVALUE gl_FragColor\n#endif\n\n#ifdef WEBGL2\nflat in int MaterialIndex;\n\nstruct Material {\n  vec4 diffuse,emissive,specular;\n  vec4 parameters;\n};\n\nuniform Material Materials[Nmaterials];\n\nvec4 diffuse;\nvec3 specular;\nfloat roughness,metallic,fresnel0;\nvec4 emissive;\n\n#ifdef COLOR\nin vec4 Color;\n#endif\n\n#else\nIN vec4 diffuse;\nIN vec3 specular;\nIN float roughness,metallic,fresnel0;\nIN vec4 emissive;\n#endif\n\n#ifdef NORMAL\n\nIN vec3 ViewPosition;\nIN vec3 Normal;\n\nvec3 normal;\n\nstruct Light {\n  vec3 direction;\n  vec3 color;\n};\n\nuniform Light Lights[Nlights];\n\n#ifdef USE_IBL\nuniform sampler2D reflBRDFSampler;\nuniform sampler2D diffuseSampler;\nuniform sampler2D reflImgSampler;\n\nconst float pi=acos(-1.0);\nconst float piInv=1.0/pi;\nconst float twopi=2.0*pi;\nconst float twopiInv=1.0/twopi;\n\n// (x,y,z) -> (r,theta,phi);\n// theta -> [0,pi]: colatitude\n// phi -> [-pi,pi]: longitude\nvec3 cart2sphere(vec3 cart)\n{\n  float x=cart.x;\n  float y=cart.z;\n  float z=cart.y;\n\n  float r=length(cart);\n  float theta=r > 0.0 ? acos(z/r) : 0.0;\n  float phi=atan(y,x);\n\n  return vec3(r,theta,phi);\n}\n\nvec2 normalizedAngle(vec3 cartVec)\n{\n  vec3 sphericalVec=cart2sphere(cartVec);\n  sphericalVec.y=sphericalVec.y*piInv;\n  sphericalVec.z=0.75-sphericalVec.z*twopiInv;\n  return sphericalVec.zy;\n}\n\nvec3 IBLColor(vec3 viewDir)\n{\n  vec3 IBLDiffuse=diffuse.rgb*texture(diffuseSampler,normalizedAngle(normal)).rgb;\n  vec3 reflectVec=normalize(reflect(-viewDir,normal));\n  vec2 reflCoord=normalizedAngle(reflectVec);\n  vec3 IBLRefl=textureLod(reflImgSampler,reflCoord,roughness*ROUGHNESS_STEP_COUNT).rgb;\n  vec2 IBLbrdf=texture(reflBRDFSampler,vec2(dot(normal,viewDir),roughness)).rg;\n  float specularMultiplier=fresnel0*IBLbrdf.x+IBLbrdf.y;\n  vec3 dielectric=IBLDiffuse+specularMultiplier*IBLRefl;\n  vec3 metal=diffuse.rgb*IBLRefl;\n  return mix(dielectric,metal,metallic);\n}\n#else\nfloat Roughness2;\nfloat NDF_TRG(vec3 h)\n{\n  float ndoth=max(dot(normal,h),0.0);\n  float alpha2=Roughness2*Roughness2;\n  float denom=ndoth*ndoth*(alpha2-1.0)+1.0;\n  return denom != 0.0 ? alpha2/(denom*denom) : 0.0;\n}\n\nfloat GGX_Geom(vec3 v)\n{\n  float ndotv=max(dot(v,normal),0.0);\n  float ap=1.0+Roughness2;\n  float k=0.125*ap*ap;\n  return ndotv/((ndotv*(1.0-k))+k);\n}\n\nfloat Geom(vec3 v, vec3 l)\n{\n  return GGX_Geom(v)*GGX_Geom(l);\n}\n\nfloat Fresnel(vec3 h, vec3 v, float fresnel0)\n{\n  float a=1.0-max(dot(h,v),0.0);\n  float b=a*a;\n  return fresnel0+(1.0-fresnel0)*b*b*a;\n}\n\n// physical based shading using UE4 model.\nvec3 BRDF(vec3 viewDirection, vec3 lightDirection)\n{\n  vec3 lambertian=diffuse.rgb;\n  vec3 h=normalize(lightDirection+viewDirection);\n\n  float omegain=max(dot(viewDirection,normal),0.0);\n  float omegaln=max(dot(lightDirection,normal),0.0);\n\n  float D=NDF_TRG(h);\n  float G=Geom(viewDirection,lightDirection);\n  float F=Fresnel(h,viewDirection,fresnel0);\n\n  float denom=4.0*omegain*omegaln;\n  float rawReflectance=denom > 0.0 ? (D*G)/denom : 0.0;\n\n  vec3 dielectric=mix(lambertian,rawReflectance*specular,F);\n  vec3 metal=rawReflectance*diffuse.rgb;\n\n  return mix(dielectric,metal,metallic);\n}\n#endif\n\n#endif\n\nvoid main(void)\n{\n#ifdef WEBGL2\n#ifdef NORMAL\n  Material m;\n#ifdef TRANSPARENT\n  m=Materials[abs(MaterialIndex)-1];\n  emissive=m.emissive;\n  if(MaterialIndex >= 0)\n    diffuse=m.diffuse;\n  else {\n    diffuse=Color;\n#if nlights == 0\n    emissive += Color;\n#endif\n  }\n#else\n  m=Materials[MaterialIndex];\n  emissive=m.emissive;\n#ifdef COLOR\n  diffuse=Color;\n#if nlights == 0\n    emissive += Color;\n#endif\n#else\n  diffuse=m.diffuse;\n#endif // COLOR\n#endif // TRANSPARENT\n  specular=m.specular.rgb;\n  vec4 parameters=m.parameters;\n  roughness=1.0-parameters[0];\n  metallic=parameters[1];\n  fresnel0=parameters[2];\n#else\n  emissive=Materials[MaterialIndex].emissive;\n#endif // NORMAL\n#endif // WEBGL2\n\n#if defined(NORMAL) && nlights > 0\n  normal=normalize(Normal);\n  normal=gl_FrontFacing ? normal : -normal;\n  vec3 viewDir=-normalize(ViewPosition);\n\nvec3 color;\n#ifdef USE_IBL\n  color=IBLColor(viewDir);\n#else\n  Roughness2=roughness*roughness;\n  color=emissive.rgb;\n  for(int i=0; i < nlights; ++i) {\n    Light Li=Lights[i];\n    vec3 L=Li.direction;\n    float cosTheta=max(dot(normal,L),0.0);\n    vec3 radiance=cosTheta*Li.color;\n    color += BRDF(viewDir,L)*radiance;\n  }\n#endif\n  OUTVALUE=vec4(color,diffuse.a);\n#else\n  OUTVALUE=emissive;\n#endif\n}\n",s.FRAGMENT_SHADER,t),r=s.createProgram();return s.attachShader(r,e),s.attachShader(r,n),s.bindAttribLocation(r,qt,"position"),s.bindAttribLocation(r,Ft,"normal"),s.bindAttribLocation(r,Ct,"materialIndex"),s.bindAttribLocation(r,zt,"color"),s.bindAttribLocation(r,Xt,"width"),s.linkProgram(r),s.getProgramParameter(r,s.LINK_STATUS)||alert("Could not initialize shaders"),r}class Wt{constructor(t,e,n,r){this.m0=.5*(t+e);const i=.5*(e+n);this.m2=.5*(n+r),this.m3=.5*(this.m0+i),this.m4=.5*(i+this.m2),this.m5=.5*(this.m3+this.m4)}}class Gt{constructor(t,e,n,r){this.m0=[.5*(t[0]+e[0]),.5*(t[1]+e[1]),.5*(t[2]+e[2])];const i=.5*(e[0]+n[0]),a=.5*(e[1]+n[1]),s=.5*(e[2]+n[2]);this.m2=[.5*(n[0]+r[0]),.5*(n[1]+r[1]),.5*(n[2]+r[2])],this.m3=[.5*(this.m0[0]+i),.5*(this.m0[1]+a),.5*(this.m0[2]+s)],this.m4=[.5*(i+this.m2[0]),.5*(a+this.m2[1]),.5*(s+this.m2[2])],this.m5=[.5*(this.m3[0]+this.m4[0]),.5*(this.m3[1]+this.m4[1]),.5*(this.m3[2]+this.m4[2])]}}class kt{constructor(t){this.l003=t[0];const e=t[1],n=t[2],r=t[3],i=t[4],a=t[5];this.r300=t[6];const s=t[7],o=t[8];this.u030=t[9],this.u021=.5*(this.u030+a),this.u120=.5*(this.u030+o);const h=.5*(a+n),l=.5*(o+i),u=.5*(o+s),c=.5*(n+i);this.l012=.5*(n+this.l003);const f=.5*(i+r);this.r210=.5*(s+this.r300),this.l102=.5*(this.l003+e);const m=.5*(e+r);this.r201=.5*(r+this.r300),this.u012=.5*(this.u021+h),this.u210=.5*(this.u120+u),this.l021=.5*(h+this.l012);const d=.5*l+.25*(i+e);this.r120=.5*(u+this.r210);const M=.5*c+.25*(i+s),v=.25*(a+i)+.5*f;this.l201=.5*(this.l102+m),this.r102=.5*(m+this.r201),this.l210=.5*(M+this.l201),this.r012=.5*(M+this.r102),this.l300=.5*(this.l201+this.r102),this.r021=.5*(v+this.r120),this.u201=.5*(this.u210+v),this.r030=.5*(this.u210+this.r120),this.u102=.5*(this.u012+d),this.l120=.5*(this.l021+d),this.l030=.5*(this.u012+this.l021),this.l111=.5*(c+this.l102),this.r111=.5*(f+this.r210),this.u111=.5*(this.u021+l),this.c111=.25*(h+u+m+i)}}function jt(t){const e=1/(Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2])||1);return[t[0]*e,t[1]*e,t[2]*e]}function $t(t){return t[0]*t[0]+t[1]*t[1]+t[2]*t[2]}function Zt(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function Qt(t,e){return[t[1]*e[2]-t[2]*e[1],t[2]*e[0]-t[0]*e[2],t[0]*e[1]-t[1]*e[0]]}function Kt(t,e,n,r,i){let a=1-i,s=a*a;return s*a*t+i*(3*(s*e+i*a*n)+i*i*r)}function Jt(t,e){return[e[0]-t[0],e[1]-t[1],e[2]-t[2]]}function te(t,e,n){return[3*(t[0]+n[0])-6*e[0],3*(t[1]+n[1])-6*e[1],3*(t[2]+n[2])-6*e[2]]}function ee(t,e,n,r){return[r[0]-t[0]+3*(e[0]-n[0]),r[1]-t[1]+3*(e[1]-n[1]),r[2]-t[2]+3*(e[2]-n[2])]}function ne(t,e,n,r){let i=[g*(r[0]-t[0]),g*(r[1]-t[1]),g*(r[2]-t[2])];return ft($t([e[0]-i[0]-t[0],e[1]-i[1]-t[1],e[2]-i[2]-t[2]]),$t([r[0]-i[0]-n[0],r[1]-i[1]-n[1],r[2]-i[2]-n[2]]))}function re(t,e,n,r){const i=[e[0]-t[0],e[1]-t[1],e[2]-t[2]],a=[r[0]-n[0],r[1]-n[1],r[2]-n[2]];return ft($t(Qt(i,jt(a))),$t(Qt(a,jt(i))))/9}function ie(t){we||Re(),et=!0,nt=t.clientX,rt=t.clientY}let ae,se,oe=!1;function he(t){return Math.hypot(t[0].pageX-t[1].pageX,t[0].pageY-t[1].pageY)}let le=null;function ue(t){t.preventDefault(),we||Re();let e=t.targetTouches;Pe=Se=oe=!1,Ne||(1!=e.length||et||(se=(new Date).getTime(),le=e[0].identifier,nt=e[0].pageX,rt=e[0].pageY),2!=e.length||et||(le=e[0].identifier,ae=he(e),oe=!0))}function ce(t){et=!1}function fe(e,n,r,i,a){if(e==r&&n==i)return;const{angle:s,axis:o}=function(t,e){const n=ge(t),r=ge(e),i=Zt(n,r);return{angle:i>1?0:i<-1?b:Math.acos(i),axis:jt(Qt(n,r))}}([e,-n],[r,-i]);t.fromRotation($,2*a*O*s/R,o),t.multiply(z,$,z)}function me(t,e,n,r){let i=1/R;Q.x+=(n-t)*i*c,Q.y-=(r-e)*i*f}function de(t,e,n,r){a.orthographic?me(t,e,n,r):(Z.x+=(n-t)*(K.xmax-K.xmin),Z.y-=(r-e)*(K.ymax-K.ymin))}function Me(){var n,r;n=H,r=z,t.fromTranslation($,[Z.x,Z.y,Z.z]),t.invert(j,$),t.multiply(n,r,j),t.multiply(n,$,n),t.translate(H,H,[Z.x,Z.y,0]),e.fromMat4(k,H),e.invert(G,k),t.multiply(W,X,H)}function ve(){let t=Math.sqrt(Number.MAX_VALUE),e=1/t;R<=e&&(R=e),R>=t&&(R=t),(1.5*R<A||R>1.5*A)&&(J=!0,A=R)}function pe(t){let e=a.zoomStep*f*t;const n=Math.log(.1*Number.MAX_VALUE)/Math.log(a.zoomFactor);Math.abs(e)<n&&(R*=a.zoomFactor**e,ve())}function ge(t){let e=t[0],n=t[1],r=Math.hypot(e,n);if(r>1){const t=1/r;e*=t,n*=t}return[e,n,Math.sqrt(ft(1-n*n-e*e,0))]}function be(t,e,n,r){pe(e-r)}function xe(t,e,n,r=1){let i;switch(n){case 1:i=fe;break;case 2:i=me;break;case 3:i=be;break;case 4:i=de;break;default:i=(t,e,n,r)=>{}}i((nt-c)/c,(rt-f)/f,(t-c)/c,(e-f)/f,r),nt=t,rt=e,Ge(),We()}let we=0;function Re(){we=1,a.canvas.addEventListener("wheel",Ie,!1)}function Ae(){let t,e,n;[t,e,n]=function(){let t=Array(3),e=Array(3),n=Array(3),r=Z.x,i=Z.y,s=.5*(K.zmin+K.zmax);for(let o=0;o<3;++o){let h=0,l=0,u=0,c=4*o;for(let t=0;t<4;++t){let e=4*t,n=z[e],o=z[e+1],f=z[e+2],m=z[e+3],d=a.Transform[c+t];h+=d*(m-r*n-i*o),u+=d*o,l+=d*(m-r*n-i*o+s*f)}t[o]=h,e[o]=u,n[o]=l}return[t,e,n]}();let r=a.orthographic?"  orthographic(":"  perspective(",i="".padStart(r.length),s="currentprojection=\n"+r+"camera=("+t+"),\n"+i+"up=("+e+"),\n"+i+"target=("+n+"),\n"+i+"zoom="+R*a.initialZoom/a.zoom0;return a.orthographic||(s+=",\n"+i+"angle="+2*Math.atan(Math.tan(.5*a.angleOfView)/R)/x),0==E&&0==T||(s+=",\n"+i+"viewportshift=("+E+","+T+")"),a.orthographic||(s+=",\n"+i+"autoadjust=false"),s+=");\n",Ut(!0),s}function Ee(e){if(we||Re(),a.embedded&&we&&27==e.keyCode)return we=0,void a.canvas.removeEventListener("wheel",Ie,!1);let n=e.key,r=null;switch(n){case"x":r=[1,0,0];break;case"y":r=[0,1,0];break;case"z":r=[0,0,1];break;case"h":Bt();break;case"m":++tt,3==tt&&(tt=0),2!=tt&&(a.embedded||vt(),Mt(a.ibl)),J=!0,We();break;case"+":case"=":case">":R*=a.zoomFactor,ye();break;case"-":case"_":case"<":R/=a.zoomFactor,ye();break;case"c":Dt()||prompt("Ctrl+c Enter to copy currentprojection to clipboard; then append to asy file:",Ae());break;case"b":Mn?(on.remove(),Mn=!1):function(){Mn=!0;const t=document;on=t.createElement("input"),sn=1/nn,on.type="range",on.min="0",on.max="1",on.step="0.001",on.value=(ln*sn).toString(),on.className="slider",on.style.position="fixed",on.onkeydown=()=>!1,on.oninput=()=>{const t=parseFloat(on.value);ln=(tn+nn)*t,an>=tn+en&&!mn&&(mn=!0,requestAnimationFrame(dn))},on.onchange=()=>{mn=!1},t.body.prepend(on)}()}"ArrowRight"==n&&"forward"!=hn?(hn="forward",an>=tn+en&&!mn&&(mn=!0,requestAnimationFrame(dn))):"ArrowLeft"==n&&"backward"!=hn&&(hn="backward",an>=tn+en&&!mn&&(mn=!0,requestAnimationFrame(dn))),null!==r&&(t.rotate(z,z,.1,r),Me(),We())}function Te(t){let e=t.key;("ArrowRight"==e&&"forward"==hn||"ArrowLeft"==e&&"backward"==hn)&&(an>=tn+en&&(mn=!1),hn=null)}function ye(){ve(),Ge(),We()}function Ie(t){t.preventDefault(),t.deltaY<0?R*=a.zoomFactor:R/=a.zoomFactor,ye()}function Le(t){if(!et)return;let e,n=t.clientX,r=t.clientY;e=t.getModifierState("Control")?2:t.getModifierState("Shift")?3:t.getModifierState("Alt")?4:1,xe(n,r,e)}let Ne=!1,Pe=!1,Se=!1;function Oe(t){if(t.preventDefault(),Ne)return;let e=t.targetTouches;if(!oe&&1==e.length&&le==e[0].identifier){let t=e[0].pageX,n=e[0].pageY,r=t-nt,i=n-rt,s=r*r+i*i<=a.shiftHoldDistance*a.shiftHoldDistance;s&&!Pe&&!Se&&(new Date).getTime()-se>a.shiftWaitTime&&(navigator.vibrate&&window.navigator.vibrate(a.vibrateTime),Pe=!0),Pe?xe(t,n,2):s||(Se=!0,xe(e[0].pageX,e[0].pageY,1,.5))}if(oe&&!Pe&&2==e.length&&le==e[0].identifier){let t=he(e),n=t-ae;Ne=!0,n*=a.zoomPinchFactor,n>a.zoomPinchCap&&(n=a.zoomPinchCap),n<-a.zoomPinchCap&&(n=-a.zoomPinchCap),pe(n/S),ae=t,Pe=Se=Ne=!1,Ge(),We()}}let _e,Ve,Ye,De,Ue=[];function Be(){Rt(Y,_e),Y.clear()}function qe(){Rt(D,Ve),D.clear()}function Fe(){Rt(U,Ve),U.clear()}function Ce(){Rt(B,Ye),B.clear()}function ze(){Rt(F,De),F.rendered=!1,F.clear()}function Xe(){let t=q.indices;if(tt>0)return Rt(q,De,t),void q.clear();if(t.length>0){!function(t){let e=H[2],n=H[6],r=H[10];Ue.length=t.length;for(let i=0;i<t.length;++i){let a=6*i;Ue[i]=e*t[a]+n*t[a+1]+r*t[a+2]}}(q.vertices);const e=t.length/3,n=[...Array(e).keys()];n.sort(function(e,n){let r=3*e;const i=t[r],a=t[r+1],s=t[r+2];let o=3*n;const h=t[o],l=t[o+1],u=t[o+2];return Ue[i]+Ue[a]+Ue[s]<Ue[h]+Ue[l]+Ue[u]?-1:1});const r=Array(t.length);for(let i=0;i<e;++i){const e=3*n[i];r[3*i]=t[e],r[3*i+1]=t[e+1],r[3*i+2]=t[e+2]}s.depthMask(!1),Rt(q,De,r),q.rendered=!1,s.depthMask(!0)}q.clear()}function He(){Be(),qe(),Fe(),Ce(),ze(),Xe(),requestAnimationFrame(He)}function We(){a.embedded&&(h.width=a.canvasWidth,h.height=a.canvasHeight,ke()),s.clearColor(a.background[0],a.background[1],a.background[2],a.background[3]),s.clear(s.COLOR_BUFFER_BIT|s.DEPTH_BUFFER_BIT),Je=performance.now();for(const t of m)t.render();He(),a.embedded&&(l.clearRect(0,0,a.canvasWidth,a.canvasHeight),l.drawImage(h,0,0)),0==tt&&(J=!1)}function Ge(){var e;!function(t,e,n,r){let i=t/e;E=(n/t+a.viewportShift[0])*R,T=(r/e+a.viewportShift[1])*R;let s=1/R;if(a.orthographic){let t=a.maxBound[0]-a.minBound[0],e=a.maxBound[1]-a.minBound[1];if(t<e*i){let t=.5*e*i*s,n=2*t*E,r=e*s*T;K.xmin=-t-n,K.xmax=t-n,K.ymin=a.minBound[1]*s-r,K.ymax=a.maxBound[1]*s-r}else{let e=.5*t*s/i,n=t*s*E,r=2*e*T;K.xmin=a.minBound[0]*s-n,K.xmax=a.maxBound[0]*s-n,K.ymin=-e-r,K.ymax=e-r}}else{let t=L*s,e=t*i,n=2*e*E,r=2*t*T;K.xmin=-e-n,K.xmax=e-n,K.ymin=-t-r,K.ymax=t-r}}(a.canvasWidth,a.canvasHeight,Q.x,Q.y),(a.orthographic?t.ortho:t.frustum)(X,K.xmin,K.xmax,K.ymin,K.ymax,-K.zmax,-K.zmin),Me(),null===(e=Dt())||void 0===e||e.setProjection(Ae())}function ke(){s.viewportWidth=a.canvasWidth,s.viewportHeight=a.canvasHeight,s.viewport(.5*(a.canvas.width-a.canvasWidth),.5*(a.canvas.height-a.canvasHeight),a.canvasWidth,a.canvasHeight),s.scissor(0,0,a.canvas.width,a.canvas.height)}function je(){var t;if(a.zoom0=a.initialZoom,""===(null===(t=Dt())||void 0===t?void 0:t.getProjection())&&Ut(!1),a.absolute&&!a.embedded)a.canvasWidth=a.canvasWidth0*window.devicePixelRatio,a.canvasHeight=a.canvasHeight0*window.devicePixelRatio;else{let t=a.canvasWidth0/a.canvasHeight0;a.canvasWidth=ft(window.innerWidth-10,10),a.canvasHeight=ft(window.innerHeight-10,10),!a.orthographic&&!window.parent.asyProjection&&a.canvasWidth<a.canvasHeight*t&&(a.zoom0*=a.canvasWidth/(a.canvasHeight*t))}a.canvas.width=a.canvasWidth,a.canvas.height=a.canvasHeight,window.innerWidth,window.innerHeight;let e=1/a.zoom0;var n,r;a.viewportShift[0]*=e,a.viewportShift[1]*=e,n=a.canvasWidth,r=a.canvasHeight,n>y&&(n=y),r>I&&(r=I),Q.x*=n/a.canvasWidth,Q.y*=r/a.canvasHeight,a.canvasWidth=n,a.canvasHeight=r,a.embedded&&(a.canvas.width=h.width=a.canvasWidth,a.canvas.height=h.height=a.canvasHeight),S=Math.hypot(a.canvasWidth,a.canvasHeight),c=.5*a.canvas.width,f=.5*a.canvas.height,O=1+8*Math.hypot(a.viewportMargin[0],a.viewportMargin[1])/S,ke(),Ge(),J=!0,Yt()}class $e{constructor(t,e=null){if(this.center=t,e){const t=e[0],n=e[1];this.ct=Math.cos(t),this.st=Math.sin(t),this.cp=Math.cos(n),this.sp=Math.sin(n)}}T0(t){return[t[0]+this.center[0],t[1]+this.center[1],t[2]+this.center[2]]}T(t){let e=t[0],n=t[1],r=t[2],i=e*this.ct+r*this.st;return[i*this.cp-n*this.sp+this.center[0],i*this.sp+n*this.cp+this.center[1],-e*this.st+r*this.ct+this.center[2]]}}function Ze(t){return t.map(function(t){let e=[t[0],t[1],t[2],1],n=r.create();return r.transformMat4(n,e,N),[n[0],n[1],n[2]]})}function Qe(t,e,n){return t.map(function(t){return n(t,e)})}function Ke(t,e,n){return t.map(function(t){return n(t[0],t[1],e)})}let Je,tn=null,en=0,nn=0,rn=[];let an,sn,on,hn=null,ln=0,un=1,cn=null,fn=!1,mn=!1;function dn(t){an=t,cn||(cn=t);const e=t-cn;cn=t,"forward"==hn?ln+=e*un:"backward"==hn&&(ln=ft(0,ln-e*un)),on&&(on.value=(ln*sn).toString()),J=!0,We(),(fn&&!mn?t<tn+en:mn)?requestAnimationFrame(dn):cn=null}let Mn=!1,vn=4/3*(Math.sqrt(2)-1);async function pn(t){return(await fetch(t)).arrayBuffer()}function gn(t){return t.getBytes().filter((t,e)=>e%4!=3)}function bn(t,e,n=s.RGB16F){let r=t.width(),i=t.height(),a=s.createTexture();return s.activeTexture(s.TEXTURE0+e),s.bindTexture(s.TEXTURE_2D,a),s.pixelStorei(s.UNPACK_ALIGNMENT,1),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,s.LINEAR),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,s.LINEAR),s.texImage2D(s.TEXTURE_2D,0,n,r,i,0,s.RGB,s.FLOAT,gn(t)),a}globalThis.window.webGLStart=function(){a.canvas=document.getElementById("Asymptote"),a.embedded=window.top.document!=document,bt(),s.enable(s.BLEND),s.blendFunc(s.SRC_ALPHA,s.ONE_MINUS_SRC_ALPHA),s.enable(s.DEPTH_TEST),s.enable(s.SCISSOR_TEST),a.canvas.onmousedown=ie,document.onmouseup=ce,document.onmousemove=Le,a.canvas.onkeydown=Ee,a.embedded||Re(),a.canvas.addEventListener("touchstart",ue,!1),a.canvas.addEventListener("touchend",ce,!1),a.canvas.addEventListener("touchcancel",ce,!1),a.canvas.addEventListener("touchleave",ce,!1),a.canvas.addEventListener("touchmove",Oe,!1),document.addEventListener("keydown",Ee,!1),document.addEventListener("keyup",Te,!1),a.canvasWidth0=a.canvasWidth,a.canvasHeight0=a.canvasHeight,t.identity(z),0!=window.innerWidth&&0!=window.innerHeight&&je(),window.addEventListener("resize",je,!1),a.ibl&&(Module.onRuntimeInitialized=async()=>{await async function(){const t=a.imageURL+a.image+"/",e=[pn(a.imageURL+"refl.exr").then(t=>{let e=new Module.EXRLoader(t);ut=bn(e,0)}),pn(t+"diffuse.exr").then(t=>{let e=new Module.EXRLoader(t);lt=bn(e,1)})],n=[pn(t+"refl0.exr")];for(let e=1;e<=8;++e)n.push(pn(t+"refl"+e+"w.exr"));const r=Promise.all(n).then(t=>{let e=s.createTexture();s.activeTexture(s.TEXTURE0+2),s.pixelStorei(s.UNPACK_ALIGNMENT,1),s.bindTexture(s.TEXTURE_2D,e),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAX_LEVEL,t.length-1),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,s.LINEAR_MIPMAP_LINEAR),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,s.LINEAR),s.texParameterf(s.TEXTURE_2D,s.TEXTURE_MIN_LOD,0),s.texParameterf(s.TEXTURE_2D,s.TEXTURE_MAX_LOD,8);for(let e=0;e<t.length;++e){let n=new Module.EXRLoader(t[e]);s.texImage2D(s.TEXTURE_2D,e,s.RGB16F,n.width(),n.height(),0,s.RGB,s.FLOAT,gn(n))}ht=e});e.push(r),await Promise.all(e)}(),a.embedded||vt(),Mt(a.ibl),Yt()}),Bt(),tn=performance.now(),requestAnimationFrame(dn)},globalThis.window.light=function(t,e){d.push(new dt(t,e))},globalThis.window.material=function(t,e,n,r,i,a){M.push(new mt(t,e,n,r,i,a))},globalThis.window.patch=function(t,e,n,i){m.push(new Lt(t,e,n,i,function(){if(0==rn.length)return;let t=rn.filter(t=>null!=t.geometryTransform);return function(e){let n=Ze(e);const i=tn+ln;for(const{geometryTransform:e,durationInv:r,autoplay:a}of t)n=Qe(n,ct(((a?Je:i)-tn)*r,1),e);return function(t){return t.map(function(t){let e=[t[0],t[1],t[2],1],n=r.create();return r.transformMat4(n,e,P),[n[0],n[1],n[2]]})}(n)}}(),function(){if(0==rn.length)return;let t=rn.filter(t=>null!=t.colorTransform);return function(e,n){let r=Ze([n[0],n[12],n[15],n[3]]);const i=tn+ln;for(const{colorTransform:n,durationInv:a,autoplay:s}of t){const t=ct(((s?Je:i)-tn)*a,1);e=Ke([[r[0],e[0]],[r[1],e[1]],[r[2],e[2]],[r[3],e[3]]],t,n)}return e}}()))},globalThis.window.curve=function(t,e,n){m.push(new Ot(t,e,n))},globalThis.window.pixel=function(t,e,n){m.push(new _t(t,e,n))},globalThis.window.triangles=function(t,e){m.push(new Vt(t,e)),it.length=0,at.length=0,st.length=0,ot.length=0},globalThis.window.sphere=function(t,e,n,r,i){let a,s,o,h,l,u,c=.524670512339254,f=.595936986722291,d=.954967051233925,M=.0820155480083437,v=.996685028842544,p=.0549670512339254,g=.998880711874577,b=.0405017186586849,x=[[[1,0,0],[1,0,c],[f,0,d],[M,0,v],[1,vn,0],[1,vn,c],[f,vn*f,d],[M,vn*M,v],[vn,1,0],[vn,1,c],[vn*f,f,d],[vn*M,M,v],[0,1,0],[0,1,c],[0,f,d],[0,M,v]],[[M,0,v],[M,vn*M,v],[p,0,g],[vn*M,M,v],[b,b,1],[.05*vn,0,1],[0,M,v],[0,p,g],[0,.05*vn,1],[0,0,1]]],w=new $e(t,i);function R(t){let e=Array(t.length);for(let n=0;n<t.length;++n){let r=t[n];e[n]=l([a*r[0],s*r[1],o*r[2]])}return e}i?(h=1,u=0,l=w.T.bind(w)):(h=-1,u=-e,l=w.T0.bind(w));for(let t=-1;t<=1;t+=2){a=t*e;for(let t=-1;t<=1;t+=2){s=t*e;for(let t=h;t<=1;t+=2){o=t*e;for(let t=0;t<2;++t)m.push(new Lt(R(x[t]),n,r))}}}},globalThis.window.disk=function(t,e,n,r,i){let a=1-2*vn/3,s=[[1,0,0],[1,-vn,0],[vn,-1,0],[0,-1,0],[1,vn,0],[a,0,0],[0,-a,0],[-vn,-1,0],[vn,1,0],[0,a,0],[-a,0,0],[-1,-vn,0],[0,1,0],[-vn,1,0],[-1,vn,0],[-1,0,0]],o=new $e(t,i);m.push(new Lt(function(t){let n=Array(t.length);for(let r=0;r<t.length;++r){let i=t[r];n[r]=o.T([e*i[0],e*i[1],0])}return n}(s),n,r))},globalThis.window.cylinder=function(t,e,n,r,i,a,s){let o,h,l=[[1,0,0],[1,0,1/3],[1,0,2/3],[1,0,1],[1,vn,0],[1,vn,1/3],[1,vn,2/3],[1,vn,1],[vn,1,0],[vn,1,1/3],[vn,1,2/3],[vn,1,1],[0,1,0],[0,1,1/3],[0,1,2/3],[0,1,1]],u=new $e(t,a);function c(t){let e=Array(t.length);for(let r=0;r<t.length;++r){let i=t[r];e[r]=u.T([o*i[0],h*i[1],n*i[2]])}return e}for(let t=-1;t<=1;t+=2){o=t*e;for(let t=-1;t<=1;t+=2)h=t*e,m.push(new Lt(c(l),r,i))}if(s){let e=u.T([0,0,n]);m.push(new Ot([t,e],r,i))}},globalThis.window.tube=function(t,e,n,r,i){let a=function(t,e,n,r,i){class a{constructor(t,e,n){this.p=t,this.r=e,this.t=n,this.s=Qt(this.t,this.r)}}let s=Number.EPSILON*ft($t(t),$t(e),$t(n),$t(r));function o(i){if(1==i){let i=[r[0]-n[0],r[1]-n[1],r[2]-n[2]];return $t(i)>s?jt(i):(i=[2*n[0]-e[0]-r[0],2*n[1]-e[1]-r[1],2*n[2]-e[2]-r[2]],$t(i)>s?jt(i):[r[0]-t[0]+3*(e[0]-n[0]),r[1]-t[1]+3*(e[1]-n[1]),r[2]-t[2]+3*(e[2]-n[2])])}let a=[r[0]-t[0]+3*(e[0]-n[0]),r[1]-t[1]+3*(e[1]-n[1]),r[2]-t[2]+3*(e[2]-n[2])],o=[2*(t[0]+n[0])-4*e[0],2*(t[1]+n[1])-4*e[1],2*(t[2]+n[2])-4*e[2]],h=[e[0]-t[0],e[1]-t[1],e[2]-t[2]],l=i*i,u=[a[0]*l+o[0]*i+h[0],a[1]*l+o[1]*i+h[1],a[2]*l+o[2]*i+h[2]];return $t(u)>s?jt(u):(l=2*i,u=[a[0]*l+o[0],a[1]*l+o[1],a[2]*l+o[2]],$t(u)>s?jt(u):jt(a))}let h=Array(i.length),l=[e[0]-t[0],e[1]-t[1],e[2]-t[2]];$t(l)<s&&(l=[t[0]-2*e[0]+n[0],t[1]-2*e[1]+n[1],t[2]-2*e[2]+n[2]],$t(l)<s&&(l=[r[0]-t[0]+3*(e[0]-n[0]),r[1]-t[1]+3*(e[1]-n[1]),r[2]-t[2]+3*(e[2]-n[2])])),l=jt(l);let u=function(t){let e=Qt(t,[0,1,0]),n=Number.EPSILON*$t(t);return $t(e)>n?jt(e):(e=Qt(t,[0,0,1]),$t(e)>n?jt(e):[1,0,0])}(l);h[0]=new a(t,u,l);for(let s=1;s<i.length;++s){let l=h[s-1],u=i[s],c=1-u,f=c*c,m=f*c,d=3*u;f*=d,c*=d*u;let M=u*u*u,v=[m*t[0]+f*e[0]+c*n[0]+M*r[0],m*t[1]+f*e[1]+c*n[1]+M*r[1],m*t[2]+f*e[2]+c*n[2]+M*r[2]],p=[v[0]-l.p[0],v[1]-l.p[1],v[2]-l.p[2]];if(0!=p[0]||0!=p[1]||0!=p[2]){let t=l.r,e=jt(p),n=l.t,r=Zt(e,n),i=[n[0]-2*r*e[0],n[1]-2*r*e[1],n[2]-2*r*e[2]];n=o(u);let c=2*Zt(e,t),f=[t[0]-c*e[0],t[1]-c*e[1],t[2]-c*e[2]],m=jt([n[0]-i[0],n[1]-i[1],n[2]-i[2]]),d=2*Zt(m,f);f=[f[0]-d*m[0],f[1]-d*m[1],f[2]-d*m[2]],h[s]=new a(v,jt(f),jt(n))}else h[s]=h[s-1]}return h}(t[0],t[1],t[2],t[3],[0,1/3,2/3,1]),s=vn*e,o=[[e,0],[e,s],[s,e],[0,e]];function h(e,i,s,h){let l=Array(16);for(let n=0;n<4;++n){let r=a[n],u=r.r[0],c=r.s[0],f=u*e+c*i,m=u*s+c*h;u=r.r[1],c=r.s[1];let d=u*e+c*i,M=u*s+c*h;u=r.r[2],c=r.s[2];let v=u*e+c*i,p=u*s+c*h,g=t[n],b=g[0];const x=g[1],w=g[2];for(let t=0;t<4;++t){let e=o[t],r=e[0],i=e[1];l[4*n+t]=[f*r+m*i+b,d*r+M*i+x,v*r+p*i+w]}}m.push(new Lt(l,n,r))}h(1,0,0,1),h(0,-1,1,0),h(-1,0,0,-1),h(0,1,-1,0),i&&m.push(new Ot(t,n,r))},globalThis.window.Positions=it,globalThis.window.Normals=at,globalThis.window.Colors=st,globalThis.window.Indices=ot,globalThis.window.initTransform=function(){N=t.create(),t.transpose(N,document.asy.Transform),P=t.create(),t.invert(P,N)},globalThis.window.beginTransform=function(t,e,n,r){const i=1e3*n;i>en&&r&&(en=i),n>nn&&(nn=i),r?fn=!0:mn=!0,rn.push({geometryTransform:t,colorTransform:e,durationInv:i>0?1/i:0,autoplay:r})},globalThis.window.endTransform=function(){rn.pop()},globalThis.window.interp=function(t,e,n){return[t[0]*(1-n)+e[0]*n,t[1]*(1-n)+e[1]*n,t[2]*(1-n)+e[2]*n,t[3]*(1-n)+e[3]*n]}})(),(()=>{var t={};n.r(t),n.d(t,{LDU:()=>y,add:()=>I,adjoint:()=>p,clone:()=>u,copy:()=>c,create:()=>l,determinant:()=>g,equals:()=>P,exactEquals:()=>N,frob:()=>T,fromRotation:()=>R,fromScaling:()=>A,fromValues:()=>m,identity:()=>f,invert:()=>v,mul:()=>_,multiply:()=>b,multiplyScalar:()=>S,multiplyScalarAndAdd:()=>O,rotate:()=>x,scale:()=>w,set:()=>d,str:()=>E,sub:()=>V,subtract:()=>L,transpose:()=>M});var e={};n.r(e),n.d(e,{add:()=>K,clone:()=>D,copy:()=>U,create:()=>Y,determinant:()=>z,equals:()=>rt,exactEquals:()=>nt,frob:()=>Q,fromRotation:()=>k,fromScaling:()=>j,fromTranslation:()=>$,fromValues:()=>q,identity:()=>B,invert:()=>C,mul:()=>it,multiply:()=>X,multiplyScalar:()=>tt,multiplyScalarAndAdd:()=>et,rotate:()=>H,scale:()=>W,set:()=>F,str:()=>Z,sub:()=>at,subtract:()=>J,translate:()=>G});var r={};n.r(r),n.d(r,{add:()=>dt,angle:()=>Xt,bezier:()=>Yt,ceil:()=>gt,clone:()=>lt,copy:()=>ft,create:()=>ht,cross:()=>Ot,dist:()=>Kt,distance:()=>Tt,div:()=>Qt,divide:()=>pt,dot:()=>St,equals:()=>kt,exactEquals:()=>Gt,floor:()=>bt,forEach:()=>ne,fromValues:()=>ct,hermite:()=>Vt,inverse:()=>Nt,len:()=>te,length:()=>ut,lerp:()=>_t,max:()=>wt,min:()=>xt,mul:()=>Zt,multiply:()=>vt,negate:()=>Lt,normalize:()=>Pt,random:()=>Dt,rotateX:()=>Ft,rotateY:()=>Ct,rotateZ:()=>zt,round:()=>Rt,scale:()=>At,scaleAndAdd:()=>Et,set:()=>mt,sqrDist:()=>Jt,sqrLen:()=>ee,squaredDistance:()=>yt,squaredLength:()=>It,str:()=>Wt,sub:()=>$t,subtract:()=>Mt,transformMat3:()=>Bt,transformMat4:()=>Ut,transformQuat:()=>qt,zero:()=>Ht});var i={};n.r(i),n.d(i,{add:()=>Ve,calculateW:()=>me,clone:()=>Pe,conjugate:()=>xe,copy:()=>Oe,create:()=>ie,dot:()=>Ue,equals:()=>We,exactEquals:()=>He,exp:()=>de,fromEuler:()=>Re,fromMat3:()=>we,fromValues:()=>Se,getAngle:()=>he,getAxisAngle:()=>oe,identity:()=>ae,invert:()=>be,len:()=>Fe,length:()=>qe,lerp:()=>Be,ln:()=>Me,mul:()=>Ye,multiply:()=>le,normalize:()=>Xe,pow:()=>ve,random:()=>ge,rotateX:()=>ue,rotateY:()=>ce,rotateZ:()=>fe,rotationTo:()=>Ge,scale:()=>De,set:()=>_e,setAxes:()=>je,setAxisAngle:()=>se,slerp:()=>pe,sqlerp:()=>ke,sqrLen:()=>ze,squaredLength:()=>Ce,str:()=>Ae});var a={};n.r(a),n.d(a,{add:()=>bn,clone:()=>Ze,conjugate:()=>yn,copy:()=>rn,create:()=>$e,dot:()=>An,equals:()=>Vn,exactEquals:()=>_n,fromMat4:()=>nn,fromRotation:()=>en,fromRotationTranslation:()=>Je,fromRotationTranslationValues:()=>Ke,fromTranslation:()=>tn,fromValues:()=>Qe,getDual:()=>hn,getReal:()=>on,getTranslation:()=>cn,identity:()=>an,invert:()=>Tn,len:()=>Ln,length:()=>In,lerp:()=>En,mul:()=>wn,multiply:()=>xn,normalize:()=>Sn,rotateAroundAxis:()=>gn,rotateByQuatAppend:()=>vn,rotateByQuatPrepend:()=>pn,rotateX:()=>mn,rotateY:()=>dn,rotateZ:()=>Mn,scale:()=>Rn,set:()=>sn,setDual:()=>un,setReal:()=>ln,sqrLen:()=>Pn,squaredLength:()=>Nn,str:()=>On,translate:()=>fn});var s={};n.r(s),n.d(s,{add:()=>Fn,angle:()=>mr,ceil:()=>Hn,clone:()=>Dn,copy:()=>Bn,create:()=>Yn,cross:()=>ar,dist:()=>Rr,distance:()=>Qn,div:()=>wr,divide:()=>Xn,dot:()=>ir,equals:()=>pr,exactEquals:()=>vr,floor:()=>Wn,forEach:()=>Tr,fromValues:()=>Un,inverse:()=>nr,len:()=>gr,length:()=>Jn,lerp:()=>sr,max:()=>kn,min:()=>Gn,mul:()=>xr,multiply:()=>zn,negate:()=>er,normalize:()=>rr,random:()=>or,rotate:()=>fr,round:()=>jn,scale:()=>$n,scaleAndAdd:()=>Zn,set:()=>qn,sqrDist:()=>Ar,sqrLen:()=>Er,squaredDistance:()=>Kn,squaredLength:()=>tr,str:()=>Mr,sub:()=>br,subtract:()=>Cn,transformMat2:()=>hr,transformMat2d:()=>lr,transformMat3:()=>ur,transformMat4:()=>cr,zero:()=>dr});var o={};n.r(o),n.d(o,{glMatrix:()=>h,mat2:()=>t,mat2d:()=>e,mat3:()=>st,mat4:()=>ot,quat:()=>i,quat2:()=>a,vec2:()=>s,vec3:()=>r,vec4:()=>re});var h=n(823);function l(){var t=new h.ARRAY_TYPE(4);return h.ARRAY_TYPE!=Float32Array&&(t[1]=0,t[2]=0),t[0]=1,t[3]=1,t}function u(t){var e=new h.ARRAY_TYPE(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}function c(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function f(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t}function m(t,e,n,r){var i=new h.ARRAY_TYPE(4);return i[0]=t,i[1]=e,i[2]=n,i[3]=r,i}function d(t,e,n,r,i){return t[0]=e,t[1]=n,t[2]=r,t[3]=i,t}function M(t,e){if(t===e){var n=e[1];t[1]=e[2],t[2]=n}else t[0]=e[0],t[1]=e[2],t[2]=e[1],t[3]=e[3];return t}function v(t,e){var n=e[0],r=e[1],i=e[2],a=e[3],s=n*a-i*r;return s?(s=1/s,t[0]=a*s,t[1]=-r*s,t[2]=-i*s,t[3]=n*s,t):null}function p(t,e){var n=e[0];return t[0]=e[3],t[1]=-e[1],t[2]=-e[2],t[3]=n,t}function g(t){return t[0]*t[3]-t[2]*t[1]}function b(t,e,n){var r=e[0],i=e[1],a=e[2],s=e[3],o=n[0],h=n[1],l=n[2],u=n[3];return t[0]=r*o+a*h,t[1]=i*o+s*h,t[2]=r*l+a*u,t[3]=i*l+s*u,t}function x(t,e,n){var r=e[0],i=e[1],a=e[2],s=e[3],o=Math.sin(n),h=Math.cos(n);return t[0]=r*h+a*o,t[1]=i*h+s*o,t[2]=r*-o+a*h,t[3]=i*-o+s*h,t}function w(t,e,n){var r=e[0],i=e[1],a=e[2],s=e[3],o=n[0],h=n[1];return t[0]=r*o,t[1]=i*o,t[2]=a*h,t[3]=s*h,t}function R(t,e){var n=Math.sin(e),r=Math.cos(e);return t[0]=r,t[1]=n,t[2]=-n,t[3]=r,t}function A(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=e[1],t}function E(t){return"mat2("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"}function T(t){return Math.hypot(t[0],t[1],t[2],t[3])}function y(t,e,n,r){return t[2]=r[2]/r[0],n[0]=r[0],n[1]=r[1],n[3]=r[3]-t[2]*n[1],[t,e,n]}function I(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t}function L(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t}function N(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]}function P(t,e){var n=t[0],r=t[1],i=t[2],a=t[3],s=e[0],o=e[1],l=e[2],u=e[3];return Math.abs(n-s)<=h.EPSILON*Math.max(1,Math.abs(n),Math.abs(s))&&Math.abs(r-o)<=h.EPSILON*Math.max(1,Math.abs(r),Math.abs(o))&&Math.abs(i-l)<=h.EPSILON*Math.max(1,Math.abs(i),Math.abs(l))&&Math.abs(a-u)<=h.EPSILON*Math.max(1,Math.abs(a),Math.abs(u))}function S(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t}function O(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t[2]=e[2]+n[2]*r,t[3]=e[3]+n[3]*r,t}var _=b,V=L;function Y(){var t=new h.ARRAY_TYPE(6);return h.ARRAY_TYPE!=Float32Array&&(t[1]=0,t[2]=0,t[4]=0,t[5]=0),t[0]=1,t[3]=1,t}function D(t){var e=new h.ARRAY_TYPE(6);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e}function U(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}function B(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t}function q(t,e,n,r,i,a){var s=new h.ARRAY_TYPE(6);return s[0]=t,s[1]=e,s[2]=n,s[3]=r,s[4]=i,s[5]=a,s}function F(t,e,n,r,i,a,s){return t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=s,t}function C(t,e){var n=e[0],r=e[1],i=e[2],a=e[3],s=e[4],o=e[5],h=n*a-r*i;return h?(h=1/h,t[0]=a*h,t[1]=-r*h,t[2]=-i*h,t[3]=n*h,t[4]=(i*o-a*s)*h,t[5]=(r*s-n*o)*h,t):null}function z(t){return t[0]*t[3]-t[1]*t[2]}function X(t,e,n){var r=e[0],i=e[1],a=e[2],s=e[3],o=e[4],h=e[5],l=n[0],u=n[1],c=n[2],f=n[3],m=n[4],d=n[5];return t[0]=r*l+a*u,t[1]=i*l+s*u,t[2]=r*c+a*f,t[3]=i*c+s*f,t[4]=r*m+a*d+o,t[5]=i*m+s*d+h,t}function H(t,e,n){var r=e[0],i=e[1],a=e[2],s=e[3],o=e[4],h=e[5],l=Math.sin(n),u=Math.cos(n);return t[0]=r*u+a*l,t[1]=i*u+s*l,t[2]=r*-l+a*u,t[3]=i*-l+s*u,t[4]=o,t[5]=h,t}function W(t,e,n){var r=e[0],i=e[1],a=e[2],s=e[3],o=e[4],h=e[5],l=n[0],u=n[1];return t[0]=r*l,t[1]=i*l,t[2]=a*u,t[3]=s*u,t[4]=o,t[5]=h,t}function G(t,e,n){var r=e[0],i=e[1],a=e[2],s=e[3],o=e[4],h=e[5],l=n[0],u=n[1];return t[0]=r,t[1]=i,t[2]=a,t[3]=s,t[4]=r*l+a*u+o,t[5]=i*l+s*u+h,t}function k(t,e){var n=Math.sin(e),r=Math.cos(e);return t[0]=r,t[1]=n,t[2]=-n,t[3]=r,t[4]=0,t[5]=0,t}function j(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=e[1],t[4]=0,t[5]=0,t}function $(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=e[0],t[5]=e[1],t}function Z(t){return"mat2d("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+")"}function Q(t){return Math.hypot(t[0],t[1],t[2],t[3],t[4],t[5],1)}function K(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t[4]=e[4]+n[4],t[5]=e[5]+n[5],t}function J(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t[4]=e[4]-n[4],t[5]=e[5]-n[5],t}function tt(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*n,t[5]=e[5]*n,t}function et(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t[2]=e[2]+n[2]*r,t[3]=e[3]+n[3]*r,t[4]=e[4]+n[4]*r,t[5]=e[5]+n[5]*r,t}function nt(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]}function rt(t,e){var n=t[0],r=t[1],i=t[2],a=t[3],s=t[4],o=t[5],l=e[0],u=e[1],c=e[2],f=e[3],m=e[4],d=e[5];return Math.abs(n-l)<=h.EPSILON*Math.max(1,Math.abs(n),Math.abs(l))&&Math.abs(r-u)<=h.EPSILON*Math.max(1,Math.abs(r),Math.abs(u))&&Math.abs(i-c)<=h.EPSILON*Math.max(1,Math.abs(i),Math.abs(c))&&Math.abs(a-f)<=h.EPSILON*Math.max(1,Math.abs(a),Math.abs(f))&&Math.abs(s-m)<=h.EPSILON*Math.max(1,Math.abs(s),Math.abs(m))&&Math.abs(o-d)<=h.EPSILON*Math.max(1,Math.abs(o),Math.abs(d))}var it=X,at=J,st=n(409),ot=n(684);function ht(){var t=new h.ARRAY_TYPE(3);return h.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function lt(t){var e=new h.ARRAY_TYPE(3);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function ut(t){var e=t[0],n=t[1],r=t[2];return Math.hypot(e,n,r)}function ct(t,e,n){var r=new h.ARRAY_TYPE(3);return r[0]=t,r[1]=e,r[2]=n,r}function ft(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function mt(t,e,n,r){return t[0]=e,t[1]=n,t[2]=r,t}function dt(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t}function Mt(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t}function vt(t,e,n){return t[0]=e[0]*n[0],t[1]=e[1]*n[1],t[2]=e[2]*n[2],t}function pt(t,e,n){return t[0]=e[0]/n[0],t[1]=e[1]/n[1],t[2]=e[2]/n[2],t}function gt(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t[2]=Math.ceil(e[2]),t}function bt(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t[2]=Math.floor(e[2]),t}function xt(t,e,n){return t[0]=Math.min(e[0],n[0]),t[1]=Math.min(e[1],n[1]),t[2]=Math.min(e[2],n[2]),t}function wt(t,e,n){return t[0]=Math.max(e[0],n[0]),t[1]=Math.max(e[1],n[1]),t[2]=Math.max(e[2],n[2]),t}function Rt(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t[2]=Math.round(e[2]),t}function At(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t}function Et(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t[2]=e[2]+n[2]*r,t}function Tt(t,e){var n=e[0]-t[0],r=e[1]-t[1],i=e[2]-t[2];return Math.hypot(n,r,i)}function yt(t,e){var n=e[0]-t[0],r=e[1]-t[1],i=e[2]-t[2];return n*n+r*r+i*i}function It(t){var e=t[0],n=t[1],r=t[2];return e*e+n*n+r*r}function Lt(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t}function Nt(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t}function Pt(t,e){var n=e[0],r=e[1],i=e[2],a=n*n+r*r+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 St(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function Ot(t,e,n){var r=e[0],i=e[1],a=e[2],s=n[0],o=n[1],h=n[2];return t[0]=i*h-a*o,t[1]=a*s-r*h,t[2]=r*o-i*s,t}function _t(t,e,n,r){var i=e[0],a=e[1],s=e[2];return t[0]=i+r*(n[0]-i),t[1]=a+r*(n[1]-a),t[2]=s+r*(n[2]-s),t}function Vt(t,e,n,r,i,a){var s=a*a,o=s*(2*a-3)+1,h=s*(a-2)+a,l=s*(a-1),u=s*(3-2*a);return t[0]=e[0]*o+n[0]*h+r[0]*l+i[0]*u,t[1]=e[1]*o+n[1]*h+r[1]*l+i[1]*u,t[2]=e[2]*o+n[2]*h+r[2]*l+i[2]*u,t}function Yt(t,e,n,r,i,a){var s=1-a,o=s*s,h=a*a,l=o*s,u=3*a*o,c=3*h*s,f=h*a;return t[0]=e[0]*l+n[0]*u+r[0]*c+i[0]*f,t[1]=e[1]*l+n[1]*u+r[1]*c+i[1]*f,t[2]=e[2]*l+n[2]*u+r[2]*c+i[2]*f,t}function Dt(t,e){e=e||1;var n=2*h.RANDOM()*Math.PI,r=2*h.RANDOM()-1,i=Math.sqrt(1-r*r)*e;return t[0]=Math.cos(n)*i,t[1]=Math.sin(n)*i,t[2]=r*e,t}function Ut(t,e,n){var r=e[0],i=e[1],a=e[2],s=n[3]*r+n[7]*i+n[11]*a+n[15];return s=s||1,t[0]=(n[0]*r+n[4]*i+n[8]*a+n[12])/s,t[1]=(n[1]*r+n[5]*i+n[9]*a+n[13])/s,t[2]=(n[2]*r+n[6]*i+n[10]*a+n[14])/s,t}function Bt(t,e,n){var r=e[0],i=e[1],a=e[2];return t[0]=r*n[0]+i*n[3]+a*n[6],t[1]=r*n[1]+i*n[4]+a*n[7],t[2]=r*n[2]+i*n[5]+a*n[8],t}function qt(t,e,n){var r=n[0],i=n[1],a=n[2],s=n[3],o=e[0],h=e[1],l=e[2],u=i*l-a*h,c=a*o-r*l,f=r*h-i*o,m=i*f-a*c,d=a*u-r*f,M=r*c-i*u,v=2*s;return u*=v,c*=v,f*=v,m*=2,d*=2,M*=2,t[0]=o+u+m,t[1]=h+c+d,t[2]=l+f+M,t}function Ft(t,e,n,r){var i=[],a=[];return i[0]=e[0]-n[0],i[1]=e[1]-n[1],i[2]=e[2]-n[2],a[0]=i[0],a[1]=i[1]*Math.cos(r)-i[2]*Math.sin(r),a[2]=i[1]*Math.sin(r)+i[2]*Math.cos(r),t[0]=a[0]+n[0],t[1]=a[1]+n[1],t[2]=a[2]+n[2],t}function Ct(t,e,n,r){var i=[],a=[];return i[0]=e[0]-n[0],i[1]=e[1]-n[1],i[2]=e[2]-n[2],a[0]=i[2]*Math.sin(r)+i[0]*Math.cos(r),a[1]=i[1],a[2]=i[2]*Math.cos(r)-i[0]*Math.sin(r),t[0]=a[0]+n[0],t[1]=a[1]+n[1],t[2]=a[2]+n[2],t}function zt(t,e,n,r){var i=[],a=[];return i[0]=e[0]-n[0],i[1]=e[1]-n[1],i[2]=e[2]-n[2],a[0]=i[0]*Math.cos(r)-i[1]*Math.sin(r),a[1]=i[0]*Math.sin(r)+i[1]*Math.cos(r),a[2]=i[2],t[0]=a[0]+n[0],t[1]=a[1]+n[1],t[2]=a[2]+n[2],t}function Xt(t,e){var n=t[0],r=t[1],i=t[2],a=e[0],s=e[1],o=e[2],h=Math.sqrt(n*n+r*r+i*i)*Math.sqrt(a*a+s*s+o*o),l=h&&St(t,e)/h;return Math.acos(Math.min(Math.max(l,-1),1))}function Ht(t){return t[0]=0,t[1]=0,t[2]=0,t}function Wt(t){return"vec3("+t[0]+", "+t[1]+", "+t[2]+")"}function Gt(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]}function kt(t,e){var n=t[0],r=t[1],i=t[2],a=e[0],s=e[1],o=e[2];return Math.abs(n-a)<=h.EPSILON*Math.max(1,Math.abs(n),Math.abs(a))&&Math.abs(r-s)<=h.EPSILON*Math.max(1,Math.abs(r),Math.abs(s))&&Math.abs(i-o)<=h.EPSILON*Math.max(1,Math.abs(i),Math.abs(o))}var jt,$t=Mt,Zt=vt,Qt=pt,Kt=Tt,Jt=yt,te=ut,ee=It,ne=(jt=ht(),function(t,e,n,r,i,a){var s,o;for(e||(e=3),n||(n=0),o=r?Math.min(r*e+n,t.length):t.length,s=n;s<o;s+=e)jt[0]=t[s],jt[1]=t[s+1],jt[2]=t[s+2],i(jt,jt,a),t[s]=jt[0],t[s+1]=jt[1],t[s+2]=jt[2];return t}),re=n(796);function ie(){var t=new h.ARRAY_TYPE(4);return h.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function ae(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t}function se(t,e,n){n*=.5;var r=Math.sin(n);return t[0]=r*e[0],t[1]=r*e[1],t[2]=r*e[2],t[3]=Math.cos(n),t}function oe(t,e){var n=2*Math.acos(e[3]),r=Math.sin(n/2);return r>h.EPSILON?(t[0]=e[0]/r,t[1]=e[1]/r,t[2]=e[2]/r):(t[0]=1,t[1]=0,t[2]=0),n}function he(t,e){var n=Ue(t,e);return Math.acos(2*n*n-1)}function le(t,e,n){var r=e[0],i=e[1],a=e[2],s=e[3],o=n[0],h=n[1],l=n[2],u=n[3];return t[0]=r*u+s*o+i*l-a*h,t[1]=i*u+s*h+a*o-r*l,t[2]=a*u+s*l+r*h-i*o,t[3]=s*u-r*o-i*h-a*l,t}function ue(t,e,n){n*=.5;var r=e[0],i=e[1],a=e[2],s=e[3],o=Math.sin(n),h=Math.cos(n);return t[0]=r*h+s*o,t[1]=i*h+a*o,t[2]=a*h-i*o,t[3]=s*h-r*o,t}function ce(t,e,n){n*=.5;var r=e[0],i=e[1],a=e[2],s=e[3],o=Math.sin(n),h=Math.cos(n);return t[0]=r*h-a*o,t[1]=i*h+s*o,t[2]=a*h+r*o,t[3]=s*h-i*o,t}function fe(t,e,n){n*=.5;var r=e[0],i=e[1],a=e[2],s=e[3],o=Math.sin(n),h=Math.cos(n);return t[0]=r*h+i*o,t[1]=i*h-r*o,t[2]=a*h+s*o,t[3]=s*h-a*o,t}function me(t,e){var n=e[0],r=e[1],i=e[2];return t[0]=n,t[1]=r,t[2]=i,t[3]=Math.sqrt(Math.abs(1-n*n-r*r-i*i)),t}function de(t,e){var n=e[0],r=e[1],i=e[2],a=e[3],s=Math.sqrt(n*n+r*r+i*i),o=Math.exp(a),h=s>0?o*Math.sin(s)/s:0;return t[0]=n*h,t[1]=r*h,t[2]=i*h,t[3]=o*Math.cos(s),t}function Me(t,e){var n=e[0],r=e[1],i=e[2],a=e[3],s=Math.sqrt(n*n+r*r+i*i),o=s>0?Math.atan2(s,a)/s:0;return t[0]=n*o,t[1]=r*o,t[2]=i*o,t[3]=.5*Math.log(n*n+r*r+i*i+a*a),t}function ve(t,e,n){return Me(t,e),De(t,t,n),de(t,t),t}function pe(t,e,n,r){var i,a,s,o,l,u=e[0],c=e[1],f=e[2],m=e[3],d=n[0],M=n[1],v=n[2],p=n[3];return(a=u*d+c*M+f*v+m*p)<0&&(a=-a,d=-d,M=-M,v=-v,p=-p),1-a>h.EPSILON?(i=Math.acos(a),s=Math.sin(i),o=Math.sin((1-r)*i)/s,l=Math.sin(r*i)/s):(o=1-r,l=r),t[0]=o*u+l*d,t[1]=o*c+l*M,t[2]=o*f+l*v,t[3]=o*m+l*p,t}function ge(t){var e=h.RANDOM(),n=h.RANDOM(),r=h.RANDOM(),i=Math.sqrt(1-e),a=Math.sqrt(e);return t[0]=i*Math.sin(2*Math.PI*n),t[1]=i*Math.cos(2*Math.PI*n),t[2]=a*Math.sin(2*Math.PI*r),t[3]=a*Math.cos(2*Math.PI*r),t}function be(t,e){var n=e[0],r=e[1],i=e[2],a=e[3],s=n*n+r*r+i*i+a*a,o=s?1/s:0;return t[0]=-n*o,t[1]=-r*o,t[2]=-i*o,t[3]=a*o,t}function xe(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3],t}function we(t,e){var n,r=e[0]+e[4]+e[8];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[3*i+i]&&(i=2);var a=(i+1)%3,s=(i+2)%3;n=Math.sqrt(e[3*i+i]-e[3*a+a]-e[3*s+s]+1),t[i]=.5*n,n=.5/n,t[3]=(e[3*a+s]-e[3*s+a])*n,t[a]=(e[3*a+i]+e[3*i+a])*n,t[s]=(e[3*s+i]+e[3*i+s])*n}return t}function Re(t,e,n,r){var i=.5*Math.PI/180;e*=i,n*=i,r*=i;var a=Math.sin(e),s=Math.cos(e),o=Math.sin(n),h=Math.cos(n),l=Math.sin(r),u=Math.cos(r);return t[0]=a*h*u-s*o*l,t[1]=s*o*u+a*h*l,t[2]=s*h*l-a*o*u,t[3]=s*h*u+a*o*l,t}function Ae(t){return"quat("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"}var Ee,Te,ye,Ie,Le,Ne,Pe=re.clone,Se=re.fromValues,Oe=re.copy,_e=re.set,Ve=re.add,Ye=le,De=re.scale,Ue=re.dot,Be=re.lerp,qe=re.length,Fe=qe,Ce=re.squaredLength,ze=Ce,Xe=re.normalize,He=re.exactEquals,We=re.equals,Ge=(Ee=ht(),Te=ct(1,0,0),ye=ct(0,1,0),function(t,e,n){var r=St(e,n);return r<-.999999?(Ot(Ee,Te,e),te(Ee)<1e-6&&Ot(Ee,ye,e),Pt(Ee,Ee),se(t,Ee,Math.PI),t):r>.999999?(t[0]=0,t[1]=0,t[2]=0,t[3]=1,t):(Ot(Ee,e,n),t[0]=Ee[0],t[1]=Ee[1],t[2]=Ee[2],t[3]=1+r,Xe(t,t))}),ke=(Ie=ie(),Le=ie(),function(t,e,n,r,i,a){return pe(Ie,e,i,a),pe(Le,n,r,a),pe(t,Ie,Le,2*a*(1-a)),t}),je=(Ne=st.create(),function(t,e,n,r){return Ne[0]=n[0],Ne[3]=n[1],Ne[6]=n[2],Ne[1]=r[0],Ne[4]=r[1],Ne[7]=r[2],Ne[2]=-e[0],Ne[5]=-e[1],Ne[8]=-e[2],Xe(t,we(t,Ne))});function $e(){var t=new h.ARRAY_TYPE(8);return h.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[4]=0,t[5]=0,t[6]=0,t[7]=0),t[3]=1,t}function Ze(t){var e=new h.ARRAY_TYPE(8);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e}function Qe(t,e,n,r,i,a,s,o){var l=new h.ARRAY_TYPE(8);return l[0]=t,l[1]=e,l[2]=n,l[3]=r,l[4]=i,l[5]=a,l[6]=s,l[7]=o,l}function Ke(t,e,n,r,i,a,s){var o=new h.ARRAY_TYPE(8);o[0]=t,o[1]=e,o[2]=n,o[3]=r;var l=.5*i,u=.5*a,c=.5*s;return o[4]=l*r+u*n-c*e,o[5]=u*r+c*t-l*n,o[6]=c*r+l*e-u*t,o[7]=-l*t-u*e-c*n,o}function Je(t,e,n){var r=.5*n[0],i=.5*n[1],a=.5*n[2],s=e[0],o=e[1],h=e[2],l=e[3];return t[0]=s,t[1]=o,t[2]=h,t[3]=l,t[4]=r*l+i*h-a*o,t[5]=i*l+a*s-r*h,t[6]=a*l+r*o-i*s,t[7]=-r*s-i*o-a*h,t}function tn(t,e){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t[4]=.5*e[0],t[5]=.5*e[1],t[6]=.5*e[2],t[7]=0,t}function en(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=0,t[5]=0,t[6]=0,t[7]=0,t}function nn(t,e){var n=ie();ot.getRotation(n,e);var r=new h.ARRAY_TYPE(3);return ot.getTranslation(r,e),Je(t,n,r),t}function rn(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}function an(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t[6]=0,t[7]=0,t}function sn(t,e,n,r,i,a,s,o,h){return t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=s,t[6]=o,t[7]=h,t}var on=Oe;function hn(t,e){return t[0]=e[4],t[1]=e[5],t[2]=e[6],t[3]=e[7],t}var ln=Oe;function un(t,e){return t[4]=e[0],t[5]=e[1],t[6]=e[2],t[7]=e[3],t}function cn(t,e){var n=e[4],r=e[5],i=e[6],a=e[7],s=-e[0],o=-e[1],h=-e[2],l=e[3];return t[0]=2*(n*l+a*s+r*h-i*o),t[1]=2*(r*l+a*o+i*s-n*h),t[2]=2*(i*l+a*h+n*o-r*s),t}function fn(t,e,n){var r=e[0],i=e[1],a=e[2],s=e[3],o=.5*n[0],h=.5*n[1],l=.5*n[2],u=e[4],c=e[5],f=e[6],m=e[7];return t[0]=r,t[1]=i,t[2]=a,t[3]=s,t[4]=s*o+i*l-a*h+u,t[5]=s*h+a*o-r*l+c,t[6]=s*l+r*h-i*o+f,t[7]=-r*o-i*h-a*l+m,t}function mn(t,e,n){var r=-e[0],i=-e[1],a=-e[2],s=e[3],o=e[4],h=e[5],l=e[6],u=e[7],c=o*s+u*r+h*a-l*i,f=h*s+u*i+l*r-o*a,m=l*s+u*a+o*i-h*r,d=u*s-o*r-h*i-l*a;return ue(t,e,n),r=t[0],i=t[1],a=t[2],s=t[3],t[4]=c*s+d*r+f*a-m*i,t[5]=f*s+d*i+m*r-c*a,t[6]=m*s+d*a+c*i-f*r,t[7]=d*s-c*r-f*i-m*a,t}function dn(t,e,n){var r=-e[0],i=-e[1],a=-e[2],s=e[3],o=e[4],h=e[5],l=e[6],u=e[7],c=o*s+u*r+h*a-l*i,f=h*s+u*i+l*r-o*a,m=l*s+u*a+o*i-h*r,d=u*s-o*r-h*i-l*a;return ce(t,e,n),r=t[0],i=t[1],a=t[2],s=t[3],t[4]=c*s+d*r+f*a-m*i,t[5]=f*s+d*i+m*r-c*a,t[6]=m*s+d*a+c*i-f*r,t[7]=d*s-c*r-f*i-m*a,t}function Mn(t,e,n){var r=-e[0],i=-e[1],a=-e[2],s=e[3],o=e[4],h=e[5],l=e[6],u=e[7],c=o*s+u*r+h*a-l*i,f=h*s+u*i+l*r-o*a,m=l*s+u*a+o*i-h*r,d=u*s-o*r-h*i-l*a;return fe(t,e,n),r=t[0],i=t[1],a=t[2],s=t[3],t[4]=c*s+d*r+f*a-m*i,t[5]=f*s+d*i+m*r-c*a,t[6]=m*s+d*a+c*i-f*r,t[7]=d*s-c*r-f*i-m*a,t}function vn(t,e,n){var r=n[0],i=n[1],a=n[2],s=n[3],o=e[0],h=e[1],l=e[2],u=e[3];return t[0]=o*s+u*r+h*a-l*i,t[1]=h*s+u*i+l*r-o*a,t[2]=l*s+u*a+o*i-h*r,t[3]=u*s-o*r-h*i-l*a,o=e[4],h=e[5],l=e[6],u=e[7],t[4]=o*s+u*r+h*a-l*i,t[5]=h*s+u*i+l*r-o*a,t[6]=l*s+u*a+o*i-h*r,t[7]=u*s-o*r-h*i-l*a,t}function pn(t,e,n){var r=e[0],i=e[1],a=e[2],s=e[3],o=n[0],h=n[1],l=n[2],u=n[3];return t[0]=r*u+s*o+i*l-a*h,t[1]=i*u+s*h+a*o-r*l,t[2]=a*u+s*l+r*h-i*o,t[3]=s*u-r*o-i*h-a*l,o=n[4],h=n[5],l=n[6],u=n[7],t[4]=r*u+s*o+i*l-a*h,t[5]=i*u+s*h+a*o-r*l,t[6]=a*u+s*l+r*h-i*o,t[7]=s*u-r*o-i*h-a*l,t}function gn(t,e,n,r){if(Math.abs(r)<h.EPSILON)return rn(t,e);var i=Math.hypot(n[0],n[1],n[2]);r*=.5;var a=Math.sin(r),s=a*n[0]/i,o=a*n[1]/i,l=a*n[2]/i,u=Math.cos(r),c=e[0],f=e[1],m=e[2],d=e[3];t[0]=c*u+d*s+f*l-m*o,t[1]=f*u+d*o+m*s-c*l,t[2]=m*u+d*l+c*o-f*s,t[3]=d*u-c*s-f*o-m*l;var M=e[4],v=e[5],p=e[6],g=e[7];return t[4]=M*u+g*s+v*l-p*o,t[5]=v*u+g*o+p*s-M*l,t[6]=p*u+g*l+M*o-v*s,t[7]=g*u-M*s-v*o-p*l,t}function bn(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t[4]=e[4]+n[4],t[5]=e[5]+n[5],t[6]=e[6]+n[6],t[7]=e[7]+n[7],t}function xn(t,e,n){var r=e[0],i=e[1],a=e[2],s=e[3],o=n[4],h=n[5],l=n[6],u=n[7],c=e[4],f=e[5],m=e[6],d=e[7],M=n[0],v=n[1],p=n[2],g=n[3];return t[0]=r*g+s*M+i*p-a*v,t[1]=i*g+s*v+a*M-r*p,t[2]=a*g+s*p+r*v-i*M,t[3]=s*g-r*M-i*v-a*p,t[4]=r*u+s*o+i*l-a*h+c*g+d*M+f*p-m*v,t[5]=i*u+s*h+a*o-r*l+f*g+d*v+m*M-c*p,t[6]=a*u+s*l+r*h-i*o+m*g+d*p+c*v-f*M,t[7]=s*u-r*o-i*h-a*l+d*g-c*M-f*v-m*p,t}var wn=xn;function Rn(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t}var An=Ue;function En(t,e,n,r){var i=1-r;return An(e,n)<0&&(r=-r),t[0]=e[0]*i+n[0]*r,t[1]=e[1]*i+n[1]*r,t[2]=e[2]*i+n[2]*r,t[3]=e[3]*i+n[3]*r,t[4]=e[4]*i+n[4]*r,t[5]=e[5]*i+n[5]*r,t[6]=e[6]*i+n[6]*r,t[7]=e[7]*i+n[7]*r,t}function Tn(t,e){var n=Nn(e);return t[0]=-e[0]/n,t[1]=-e[1]/n,t[2]=-e[2]/n,t[3]=e[3]/n,t[4]=-e[4]/n,t[5]=-e[5]/n,t[6]=-e[6]/n,t[7]=e[7]/n,t}function yn(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}var In=qe,Ln=In,Nn=Ce,Pn=Nn;function Sn(t,e){var n=Nn(e);if(n>0){n=Math.sqrt(n);var r=e[0]/n,i=e[1]/n,a=e[2]/n,s=e[3]/n,o=e[4],h=e[5],l=e[6],u=e[7],c=r*o+i*h+a*l+s*u;t[0]=r,t[1]=i,t[2]=a,t[3]=s,t[4]=(o-r*c)/n,t[5]=(h-i*c)/n,t[6]=(l-a*c)/n,t[7]=(u-s*c)/n}return t}function On(t){return"quat2("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+")"}function _n(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]}function Vn(t,e){var n=t[0],r=t[1],i=t[2],a=t[3],s=t[4],o=t[5],l=t[6],u=t[7],c=e[0],f=e[1],m=e[2],d=e[3],M=e[4],v=e[5],p=e[6],g=e[7];return Math.abs(n-c)<=h.EPSILON*Math.max(1,Math.abs(n),Math.abs(c))&&Math.abs(r-f)<=h.EPSILON*Math.max(1,Math.abs(r),Math.abs(f))&&Math.abs(i-m)<=h.EPSILON*Math.max(1,Math.abs(i),Math.abs(m))&&Math.abs(a-d)<=h.EPSILON*Math.max(1,Math.abs(a),Math.abs(d))&&Math.abs(s-M)<=h.EPSILON*Math.max(1,Math.abs(s),Math.abs(M))&&Math.abs(o-v)<=h.EPSILON*Math.max(1,Math.abs(o),Math.abs(v))&&Math.abs(l-p)<=h.EPSILON*Math.max(1,Math.abs(l),Math.abs(p))&&Math.abs(u-g)<=h.EPSILON*Math.max(1,Math.abs(u),Math.abs(g))}function Yn(){var t=new h.ARRAY_TYPE(2);return h.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0),t}function Dn(t){var e=new h.ARRAY_TYPE(2);return e[0]=t[0],e[1]=t[1],e}function Un(t,e){var n=new h.ARRAY_TYPE(2);return n[0]=t,n[1]=e,n}function Bn(t,e){return t[0]=e[0],t[1]=e[1],t}function qn(t,e,n){return t[0]=e,t[1]=n,t}function Fn(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t}function Cn(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t}function zn(t,e,n){return t[0]=e[0]*n[0],t[1]=e[1]*n[1],t}function Xn(t,e,n){return t[0]=e[0]/n[0],t[1]=e[1]/n[1],t}function Hn(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t}function Wn(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t}function Gn(t,e,n){return t[0]=Math.min(e[0],n[0]),t[1]=Math.min(e[1],n[1]),t}function kn(t,e,n){return t[0]=Math.max(e[0],n[0]),t[1]=Math.max(e[1],n[1]),t}function jn(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t}function $n(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t}function Zn(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t}function Qn(t,e){var n=e[0]-t[0],r=e[1]-t[1];return Math.hypot(n,r)}function Kn(t,e){var n=e[0]-t[0],r=e[1]-t[1];return n*n+r*r}function Jn(t){var e=t[0],n=t[1];return Math.hypot(e,n)}function tr(t){var e=t[0],n=t[1];return e*e+n*n}function er(t,e){return t[0]=-e[0],t[1]=-e[1],t}function nr(t,e){return t[0]=1/e[0],t[1]=1/e[1],t}function rr(t,e){var n=e[0],r=e[1],i=n*n+r*r;return i>0&&(i=1/Math.sqrt(i)),t[0]=e[0]*i,t[1]=e[1]*i,t}function ir(t,e){return t[0]*e[0]+t[1]*e[1]}function ar(t,e,n){var r=e[0]*n[1]-e[1]*n[0];return t[0]=t[1]=0,t[2]=r,t}function sr(t,e,n,r){var i=e[0],a=e[1];return t[0]=i+r*(n[0]-i),t[1]=a+r*(n[1]-a),t}function or(t,e){e=e||1;var n=2*h.RANDOM()*Math.PI;return t[0]=Math.cos(n)*e,t[1]=Math.sin(n)*e,t}function hr(t,e,n){var r=e[0],i=e[1];return t[0]=n[0]*r+n[2]*i,t[1]=n[1]*r+n[3]*i,t}function lr(t,e,n){var r=e[0],i=e[1];return t[0]=n[0]*r+n[2]*i+n[4],t[1]=n[1]*r+n[3]*i+n[5],t}function ur(t,e,n){var r=e[0],i=e[1];return t[0]=n[0]*r+n[3]*i+n[6],t[1]=n[1]*r+n[4]*i+n[7],t}function cr(t,e,n){var r=e[0],i=e[1];return t[0]=n[0]*r+n[4]*i+n[12],t[1]=n[1]*r+n[5]*i+n[13],t}function fr(t,e,n,r){var i=e[0]-n[0],a=e[1]-n[1],s=Math.sin(r),o=Math.cos(r);return t[0]=i*o-a*s+n[0],t[1]=i*s+a*o+n[1],t}function mr(t,e){var n=t[0],r=t[1],i=e[0],a=e[1],s=Math.sqrt(n*n+r*r)*Math.sqrt(i*i+a*a),o=s&&(n*i+r*a)/s;return Math.acos(Math.min(Math.max(o,-1),1))}function dr(t){return t[0]=0,t[1]=0,t}function Mr(t){return"vec2("+t[0]+", "+t[1]+")"}function vr(t,e){return t[0]===e[0]&&t[1]===e[1]}function pr(t,e){var n=t[0],r=t[1],i=e[0],a=e[1];return Math.abs(n-i)<=h.EPSILON*Math.max(1,Math.abs(n),Math.abs(i))&&Math.abs(r-a)<=h.EPSILON*Math.max(1,Math.abs(r),Math.abs(a))}var gr=Jn,br=Cn,xr=zn,wr=Xn,Rr=Qn,Ar=Kn,Er=tr,Tr=function(){var t=Yn();return function(e,n,r,i,a,s){var o,h;for(n||(n=2),r||(r=0),h=i?Math.min(i*n+r,e.length):e.length,o=r;o<h;o+=n)t[0]=e[o],t[1]=e[o+1],a(t,t,s),e[o]=t[0],e[o+1]=t[1];return e}}();globalThis.glmat=o})()})();