UNPKG

@xeokit/xeokit-convert-xkt10

Version:

JavaScript utilities to create .XKT files

2 lines 159 kB
/*! For license information please see xeokit-convert.cjs.js.LICENSE.txt */ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.convert2xkt=t():e.convert2xkt=t()}(global,(()=>(()=>{"use strict";var e={231:e=>{e.exports=require("fs")}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={exports:{}};return e[n](i,i.exports,r),i.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return(()=>{r.r(n),r.d(n,{XKTModel:()=>Le,XKT_INFO:()=>f,buildBoxGeometry:()=>wr,buildBoxLinesGeometry:()=>br,buildCylinderGeometry:()=>Mr,buildGridGeometry:()=>Ir,buildPlaneGeometry:()=>Tr,buildSphereGeometry:()=>Ar,buildTorusGeometry:()=>Sr,buildVectorTextGeometry:()=>Lr,convert2xkt:()=>Dr,parseCityJSONIntoXKTModel:()=>dt,parseGLTFIntoXKTModel:()=>Tt,parseGLTFJSONIntoXKTModel:()=>kt,parseIFCIntoXKTModel:()=>Xt,parseLASIntoXKTModel:()=>Yt,parseMetaModelIntoXKTModel:()=>Ht,parsePCDIntoXKTModel:()=>$t,parsePLYIntoXKTModel:()=>ir,parseSTLIntoXKTModel:()=>hr,writeXKTModelToArrayBuffer:()=>je});const e=require("@loaders.gl/polyfills");var t,o,i,a,s,u,c,l,h,f={xktVersion:10},d=Float64Array,p=new d(16),m=new d(16),y=new d(4),g={MIN_DOUBLE:-Number.MAX_SAFE_INTEGER,MAX_DOUBLE:Number.MAX_SAFE_INTEGER,DEGTORAD:.0174532925,RADTODEG:57.295779513,vec2:function(e){return new d(e||2)},vec3:function(e){return new d(e||3)},vec4:function(e){return new d(e||4)},mat3:function(e){return new d(e||9)},mat3ToMat4:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new d(16);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=0,t[4]=e[3],t[5]=e[4],t[6]=e[5],t[7]=0,t[8]=e[6],t[9]=e[7],t[10]=e[8],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},mat4:function(e){return new d(e||16)},mat4ToMat3:function(e,t){},createUUID:function(){for(var e=[],t=0;t<256;t++)e[t]=(t<16?"0":"")+t.toString(16);return function(){var t=4294967295*Math.random()|0,r=4294967295*Math.random()|0,n=4294967295*Math.random()|0,o=4294967295*Math.random()|0;return"".concat(e[255&t]+e[t>>8&255]+e[t>>16&255]+e[t>>24&255],"-").concat(e[255&r]).concat(e[r>>8&255],"-").concat(e[r>>16&15|64]).concat(e[r>>24&255],"-").concat(e[63&n|128]).concat(e[n>>8&255],"-").concat(e[n>>16&255]).concat(e[n>>24&255]).concat(e[255&o]).concat(e[o>>8&255]).concat(e[o>>16&255]).concat(e[o>>24&255])}}(),clamp:function(e,t,r){return Math.max(t,Math.min(r,e))},fmod:function(e,t){if(e<t)return console.error("math.fmod : Attempting to find modulus within negative range - would be infinite loop - ignoring"),e;for(;t<=e;)e-=t;return e},negateVec4:function(e,t){return t||(t=e),t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t},addVec4:function(e,t,r){return r||(r=e),r[0]=e[0]+t[0],r[1]=e[1]+t[1],r[2]=e[2]+t[2],r[3]=e[3]+t[3],r},addVec4Scalar:function(e,t,r){return r||(r=e),r[0]=e[0]+t,r[1]=e[1]+t,r[2]=e[2]+t,r[3]=e[3]+t,r},addVec3:function(e,t,r){return r||(r=e),r[0]=e[0]+t[0],r[1]=e[1]+t[1],r[2]=e[2]+t[2],r},addVec3Scalar:function(e,t,r){return r||(r=e),r[0]=e[0]+t,r[1]=e[1]+t,r[2]=e[2]+t,r},subVec4:function(e,t,r){return r||(r=e),r[0]=e[0]-t[0],r[1]=e[1]-t[1],r[2]=e[2]-t[2],r[3]=e[3]-t[3],r},subVec3:function(e,t,r){return r||(r=e),r[0]=e[0]-t[0],r[1]=e[1]-t[1],r[2]=e[2]-t[2],r},subVec2:function(e,t,r){return r||(r=e),r[0]=e[0]-t[0],r[1]=e[1]-t[1],r},subVec4Scalar:function(e,t,r){return r||(r=e),r[0]=e[0]-t,r[1]=e[1]-t,r[2]=e[2]-t,r[3]=e[3]-t,r},subScalarVec4:function(e,t,r){return r||(r=e),r[0]=t-e[0],r[1]=t-e[1],r[2]=t-e[2],r[3]=t-e[3],r},mulVec4:function(e,t,r){return r||(r=e),r[0]=e[0]*t[0],r[1]=e[1]*t[1],r[2]=e[2]*t[2],r[3]=e[3]*t[3],r},mulVec4Scalar:function(e,t,r){return r||(r=e),r[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*t,r[3]=e[3]*t,r},mulVec3Scalar:function(e,t,r){return r||(r=e),r[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*t,r},mulVec2Scalar:function(e,t,r){return r||(r=e),r[0]=e[0]*t,r[1]=e[1]*t,r},divVec3:function(e,t,r){return r||(r=e),r[0]=e[0]/t[0],r[1]=e[1]/t[1],r[2]=e[2]/t[2],r},divVec4:function(e,t,r){return r||(r=e),r[0]=e[0]/t[0],r[1]=e[1]/t[1],r[2]=e[2]/t[2],r[3]=e[3]/t[3],r},divScalarVec3:function(e,t,r){return r||(r=t),r[0]=e/t[0],r[1]=e/t[1],r[2]=e/t[2],r},divVec3Scalar:function(e,t,r){return r||(r=e),r[0]=e[0]/t,r[1]=e[1]/t,r[2]=e[2]/t,r},divVec4Scalar:function(e,t,r){return r||(r=e),r[0]=e[0]/t,r[1]=e[1]/t,r[2]=e[2]/t,r[3]=e[3]/t,r},divScalarVec4:function(e,t,r){return r||(r=t),r[0]=e/t[0],r[1]=e/t[1],r[2]=e/t[2],r[3]=e/t[3],r},dotVec4:function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]},cross3Vec4:function(e,t){var r=e[0],n=e[1],o=e[2],i=t[0],a=t[1],s=t[2];return[n*s-o*a,o*i-r*s,r*a-n*i,0]},cross3Vec3:function(e,t,r){r||(r=e);var n=e[0],o=e[1],i=e[2],a=t[0],s=t[1],u=t[2];return r[0]=o*u-i*s,r[1]=i*a-n*u,r[2]=n*s-o*a,r},sqLenVec4:function(e){return g.dotVec4(e,e)},lenVec4:function(e){return Math.sqrt(g.sqLenVec4(e))},dotVec3:function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]},dotVec2:function(e,t){return e[0]*t[0]+e[1]*t[1]},sqLenVec3:function(e){return g.dotVec3(e,e)},sqLenVec2:function(e){return g.dotVec2(e,e)},lenVec3:function(e){return Math.sqrt(g.sqLenVec3(e))},distVec3:(c=new d(3),function(e,t){return g.lenVec3(g.subVec3(e,t,c))}),lenVec2:function(e){return Math.sqrt(g.sqLenVec2(e))},distVec2:function(){var e=new d(2);return function(t,r){return g.lenVec2(g.subVec2(t,r,e))}}(),rcpVec3:function(e,t){return g.divScalarVec3(1,e,t)},normalizeVec4:function(e,t){var r=1/g.lenVec4(e);return g.mulVec4Scalar(e,r,t)},normalizeVec3:function(e,t){var r=1/g.lenVec3(e);return g.mulVec3Scalar(e,r,t)},normalizeVec2:function(e,t){var r=1/g.lenVec2(e);return g.mulVec2Scalar(e,r,t)},angleVec3:function(e,t){var r=g.dotVec3(e,t)/Math.sqrt(g.sqLenVec3(e)*g.sqLenVec3(t));return r=r<-1?-1:r>1?1:r,Math.acos(r)},vec3FromMat4Scale:(u=new d(3),function(e,t){return u[0]=e[0],u[1]=e[1],u[2]=e[2],t[0]=g.lenVec3(u),u[0]=e[4],u[1]=e[5],u[2]=e[6],t[1]=g.lenVec3(u),u[0]=e[8],u[1]=e[9],u[2]=e[10],t[2]=g.lenVec3(u),t}),vecToArray:function(){function e(e){return Math.round(1e5*e)/1e5}return function(t){for(var r=0,n=(t=Array.prototype.slice.call(t)).length;r<n;r++)t[r]=e(t[r]);return t}}(),xyzArrayToObject:function(e){return{x:e[0],y:e[1],z:e[2]}},xyzObjectToArray:function(e,t){return(t=t||new d(3))[0]=e.x,t[1]=e.y,t[2]=e.z,t},dupMat4:function(e){return e.slice(0,16)},mat4To3:function(e){return[e[0],e[1],e[2],e[4],e[5],e[6],e[8],e[9],e[10]]},m4s:function(e){return[e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e]},setMat4ToZeroes:function(){return g.m4s(0)},setMat4ToOnes:function(){return g.m4s(1)},diagonalMat4v:function(e){return new d([e[0],0,0,0,0,e[1],0,0,0,0,e[2],0,0,0,0,e[3]])},diagonalMat4c:function(e,t,r,n){return g.diagonalMat4v([e,t,r,n])},diagonalMat4s:function(e){return g.diagonalMat4c(e,e,e,e)},identityMat4:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new d(16);return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},identityMat3:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new d(9);return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e},isIdentityMat4:function(e){return 1===e[0]&&0===e[1]&&0===e[2]&&0===e[3]&&0===e[4]&&1===e[5]&&0===e[6]&&0===e[7]&&0===e[8]&&0===e[9]&&1===e[10]&&0===e[11]&&0===e[12]&&0===e[13]&&0===e[14]&&1===e[15]},negateMat4:function(e,t){return t||(t=e),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},addMat4:function(e,t,r){return r||(r=e),r[0]=e[0]+t[0],r[1]=e[1]+t[1],r[2]=e[2]+t[2],r[3]=e[3]+t[3],r[4]=e[4]+t[4],r[5]=e[5]+t[5],r[6]=e[6]+t[6],r[7]=e[7]+t[7],r[8]=e[8]+t[8],r[9]=e[9]+t[9],r[10]=e[10]+t[10],r[11]=e[11]+t[11],r[12]=e[12]+t[12],r[13]=e[13]+t[13],r[14]=e[14]+t[14],r[15]=e[15]+t[15],r},addMat4Scalar:function(e,t,r){return r||(r=e),r[0]=e[0]+t,r[1]=e[1]+t,r[2]=e[2]+t,r[3]=e[3]+t,r[4]=e[4]+t,r[5]=e[5]+t,r[6]=e[6]+t,r[7]=e[7]+t,r[8]=e[8]+t,r[9]=e[9]+t,r[10]=e[10]+t,r[11]=e[11]+t,r[12]=e[12]+t,r[13]=e[13]+t,r[14]=e[14]+t,r[15]=e[15]+t,r},addScalarMat4:function(e,t,r){return g.addMat4Scalar(t,e,r)},subMat4:function(e,t,r){return r||(r=e),r[0]=e[0]-t[0],r[1]=e[1]-t[1],r[2]=e[2]-t[2],r[3]=e[3]-t[3],r[4]=e[4]-t[4],r[5]=e[5]-t[5],r[6]=e[6]-t[6],r[7]=e[7]-t[7],r[8]=e[8]-t[8],r[9]=e[9]-t[9],r[10]=e[10]-t[10],r[11]=e[11]-t[11],r[12]=e[12]-t[12],r[13]=e[13]-t[13],r[14]=e[14]-t[14],r[15]=e[15]-t[15],r},subMat4Scalar:function(e,t,r){return r||(r=e),r[0]=e[0]-t,r[1]=e[1]-t,r[2]=e[2]-t,r[3]=e[3]-t,r[4]=e[4]-t,r[5]=e[5]-t,r[6]=e[6]-t,r[7]=e[7]-t,r[8]=e[8]-t,r[9]=e[9]-t,r[10]=e[10]-t,r[11]=e[11]-t,r[12]=e[12]-t,r[13]=e[13]-t,r[14]=e[14]-t,r[15]=e[15]-t,r},subScalarMat4:function(e,t,r){return r||(r=t),r[0]=e-t[0],r[1]=e-t[1],r[2]=e-t[2],r[3]=e-t[3],r[4]=e-t[4],r[5]=e-t[5],r[6]=e-t[6],r[7]=e-t[7],r[8]=e-t[8],r[9]=e-t[9],r[10]=e-t[10],r[11]=e-t[11],r[12]=e-t[12],r[13]=e-t[13],r[14]=e-t[14],r[15]=e-t[15],r},mulMat4:function(e,t,r){r||(r=e);var n=e[0],o=e[1],i=e[2],a=e[3],s=e[4],u=e[5],c=e[6],l=e[7],h=e[8],f=e[9],d=e[10],p=e[11],v=e[12],m=e[13],y=e[14],g=e[15],x=t[0],w=t[1],b=t[2],M=t[3],I=t[4],T=t[5],A=t[6],S=t[7],O=t[8],L=t[9],E=t[10],P=t[11],j=t[12],G=t[13],_=t[14],D=t[15];return r[0]=x*n+w*s+b*h+M*v,r[1]=x*o+w*u+b*f+M*m,r[2]=x*i+w*c+b*d+M*y,r[3]=x*a+w*l+b*p+M*g,r[4]=I*n+T*s+A*h+S*v,r[5]=I*o+T*u+A*f+S*m,r[6]=I*i+T*c+A*d+S*y,r[7]=I*a+T*l+A*p+S*g,r[8]=O*n+L*s+E*h+P*v,r[9]=O*o+L*u+E*f+P*m,r[10]=O*i+L*c+E*d+P*y,r[11]=O*a+L*l+E*p+P*g,r[12]=j*n+G*s+_*h+D*v,r[13]=j*o+G*u+_*f+D*m,r[14]=j*i+G*c+_*d+D*y,r[15]=j*a+G*l+_*p+D*g,r},mulMat3:function(e,t,r){r||(r=new d(9));var n=e[0],o=e[3],i=e[6],a=e[1],s=e[4],u=e[7],c=e[2],l=e[5],h=e[8],f=t[0],p=t[3],v=t[6],m=t[1],y=t[4],g=t[7],x=t[2],w=t[5],b=t[8];return r[0]=n*f+o*m+i*x,r[3]=n*p+o*y+i*w,r[6]=n*v+o*g+i*b,r[1]=a*f+s*m+u*x,r[4]=a*p+s*y+u*w,r[7]=a*v+s*g+u*b,r[2]=c*f+l*m+h*x,r[5]=c*p+l*y+h*w,r[8]=c*v+l*g+h*b,r},mulMat4Scalar:function(e,t,r){return r||(r=e),r[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*t,r[3]=e[3]*t,r[4]=e[4]*t,r[5]=e[5]*t,r[6]=e[6]*t,r[7]=e[7]*t,r[8]=e[8]*t,r[9]=e[9]*t,r[10]=e[10]*t,r[11]=e[11]*t,r[12]=e[12]*t,r[13]=e[13]*t,r[14]=e[14]*t,r[15]=e[15]*t,r},mulMat4v4:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:g.vec4(),n=t[0],o=t[1],i=t[2],a=t[3];return r[0]=e[0]*n+e[4]*o+e[8]*i+e[12]*a,r[1]=e[1]*n+e[5]*o+e[9]*i+e[13]*a,r[2]=e[2]*n+e[6]*o+e[10]*i+e[14]*a,r[3]=e[3]*n+e[7]*o+e[11]*i+e[15]*a,r},transposeMat4:function(e,t){var r=e[4],n=e[14],o=e[8],i=e[13],a=e[12],s=e[9];if(!t||e===t){var u=e[1],c=e[2],l=e[3],h=e[6],f=e[7],d=e[11];return e[1]=r,e[2]=o,e[3]=a,e[4]=u,e[6]=s,e[7]=i,e[8]=c,e[9]=h,e[11]=n,e[12]=l,e[13]=f,e[14]=d,e}return t[0]=e[0],t[1]=r,t[2]=o,t[3]=a,t[4]=e[1],t[5]=e[5],t[6]=s,t[7]=i,t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=n,t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15],t},transposeMat3:function(e,t){if(t===e){var r=e[1],n=e[2],o=e[5];t[1]=e[3],t[2]=e[6],t[3]=r,t[5]=e[7],t[6]=n,t[7]=o}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},determinantMat4:function(e){var t=e[0],r=e[1],n=e[2],o=e[3],i=e[4],a=e[5],s=e[6],u=e[7],c=e[8],l=e[9],h=e[10],f=e[11],d=e[12],p=e[13],v=e[14],m=e[15];return d*l*s*o-c*p*s*o-d*a*h*o+i*p*h*o+c*a*v*o-i*l*v*o-d*l*n*u+c*p*n*u+d*r*h*u-t*p*h*u-c*r*v*u+t*l*v*u+d*a*n*f-i*p*n*f-d*r*s*f+t*p*s*f+i*r*v*f-t*a*v*f-c*a*n*m+i*l*n*m+c*r*s*m-t*l*s*m-i*r*h*m+t*a*h*m},inverseMat4:function(e,t){t||(t=e);var r=e[0],n=e[1],o=e[2],i=e[3],a=e[4],s=e[5],u=e[6],c=e[7],l=e[8],h=e[9],f=e[10],d=e[11],p=e[12],v=e[13],m=e[14],y=e[15],g=r*s-n*a,x=r*u-o*a,w=r*c-i*a,b=n*u-o*s,M=n*c-i*s,I=o*c-i*u,T=l*v-h*p,A=l*m-f*p,S=l*y-d*p,O=h*m-f*v,L=h*y-d*v,E=f*y-d*m,P=1/(g*E-x*L+w*O+b*S-M*A+I*T);return t[0]=(s*E-u*L+c*O)*P,t[1]=(-n*E+o*L-i*O)*P,t[2]=(v*I-m*M+y*b)*P,t[3]=(-h*I+f*M-d*b)*P,t[4]=(-a*E+u*S-c*A)*P,t[5]=(r*E-o*S+i*A)*P,t[6]=(-p*I+m*w-y*x)*P,t[7]=(l*I-f*w+d*x)*P,t[8]=(a*L-s*S+c*T)*P,t[9]=(-r*L+n*S-i*T)*P,t[10]=(p*M-v*w+y*g)*P,t[11]=(-l*M+h*w-d*g)*P,t[12]=(-a*O+s*A-u*T)*P,t[13]=(r*O-n*A+o*T)*P,t[14]=(-p*b+v*x-m*g)*P,t[15]=(l*b-h*x+f*g)*P,t},traceMat4:function(e){return e[0]+e[5]+e[10]+e[15]},translationMat4v:function(e,t){var r=t||g.identityMat4();return r[12]=e[0],r[13]=e[1],r[14]=e[2],r},translationMat3v:function(e,t){var r=t||g.identityMat3();return r[6]=e[0],r[7]=e[1],r},translationMat4c:(s=new d(3),function(e,t,r,n){return s[0]=e,s[1]=t,s[2]=r,g.translationMat4v(s,n)}),translationMat4s:function(e,t){return g.translationMat4c(e,e,e,t)},translateMat4v:function(e,t){return g.translateMat4c(e[0],e[1],e[2],t)},OLDtranslateMat4c:function(e,t,r,n){var o=n[12];n[0]+=o*e,n[4]+=o*t,n[8]+=o*r;var i=n[13];n[1]+=i*e,n[5]+=i*t,n[9]+=i*r;var a=n[14];n[2]+=a*e,n[6]+=a*t,n[10]+=a*r;var s=n[15];return n[3]+=s*e,n[7]+=s*t,n[11]+=s*r,n},translateMat4c:function(e,t,r,n){var o=n[3];n[0]+=o*e,n[1]+=o*t,n[2]+=o*r;var i=n[7];n[4]+=i*e,n[5]+=i*t,n[6]+=i*r;var a=n[11];n[8]+=a*e,n[9]+=a*t,n[10]+=a*r;var s=n[15];return n[12]+=s*e,n[13]+=s*t,n[14]+=s*r,n},rotationMat4v:function(e,t,r){var n,o,i,a,s,u,c=g.normalizeVec4([t[0],t[1],t[2],0],[]),l=Math.sin(e),h=Math.cos(e),f=1-h,d=c[0],p=c[1],v=c[2];return n=d*p,o=p*v,i=v*d,a=d*l,s=p*l,u=v*l,(r=r||g.mat4())[0]=f*d*d+h,r[1]=f*n+u,r[2]=f*i-s,r[3]=0,r[4]=f*n-u,r[5]=f*p*p+h,r[6]=f*o+a,r[7]=0,r[8]=f*i+s,r[9]=f*o-a,r[10]=f*v*v+h,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r},rotationMat4c:function(e,t,r,n,o){return g.rotationMat4v(e,[t,r,n],o)},scalingMat4v:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:g.identityMat4();return t[0]=e[0],t[5]=e[1],t[10]=e[2],t},scalingMat3v:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:g.identityMat3();return t[0]=e[0],t[4]=e[1],t},scalingMat4c:function(){var e=new d(3);return function(t,r,n,o){return e[0]=t,e[1]=r,e[2]=n,g.scalingMat4v(e,o)}}(),scaleMat4c:function(e,t,r,n){return n[0]*=e,n[4]*=t,n[8]*=r,n[1]*=e,n[5]*=t,n[9]*=r,n[2]*=e,n[6]*=t,n[10]*=r,n[3]*=e,n[7]*=t,n[11]*=r,n},scaleMat4v:function(e,t){var r=e[0],n=e[1],o=e[2];return t[0]*=r,t[4]*=n,t[8]*=o,t[1]*=r,t[5]*=n,t[9]*=o,t[2]*=r,t[6]*=n,t[10]*=o,t[3]*=r,t[7]*=n,t[11]*=o,t},scalingMat4s:function(e){return g.scalingMat4c(e,e,e)},rotationTranslationMat4:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:g.mat4(),n=e[0],o=e[1],i=e[2],a=e[3],s=n+n,u=o+o,c=i+i,l=n*s,h=n*u,f=n*c,d=o*u,p=o*c,v=i*c,m=a*s,y=a*u,x=a*c;return r[0]=1-(d+v),r[1]=h+x,r[2]=f-y,r[3]=0,r[4]=h-x,r[5]=1-(l+v),r[6]=p+m,r[7]=0,r[8]=f+y,r[9]=p-m,r[10]=1-(l+d),r[11]=0,r[12]=t[0],r[13]=t[1],r[14]=t[2],r[15]=1,r},mat4ToEuler:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:g.vec4(),n=g.clamp,o=e[0],i=e[4],a=e[8],s=e[1],u=e[5],c=e[9],l=e[2],h=e[6],f=e[10];return"XYZ"===t?(r[1]=Math.asin(n(a,-1,1)),Math.abs(a)<.99999?(r[0]=Math.atan2(-c,f),r[2]=Math.atan2(-i,o)):(r[0]=Math.atan2(h,u),r[2]=0)):"YXZ"===t?(r[0]=Math.asin(-n(c,-1,1)),Math.abs(c)<.99999?(r[1]=Math.atan2(a,f),r[2]=Math.atan2(s,u)):(r[1]=Math.atan2(-l,o),r[2]=0)):"ZXY"===t?(r[0]=Math.asin(n(h,-1,1)),Math.abs(h)<.99999?(r[1]=Math.atan2(-l,f),r[2]=Math.atan2(-i,u)):(r[1]=0,r[2]=Math.atan2(s,o))):"ZYX"===t?(r[1]=Math.asin(-n(l,-1,1)),Math.abs(l)<.99999?(r[0]=Math.atan2(h,f),r[2]=Math.atan2(s,o)):(r[0]=0,r[2]=Math.atan2(-i,u))):"YZX"===t?(r[2]=Math.asin(n(s,-1,1)),Math.abs(s)<.99999?(r[0]=Math.atan2(-c,u),r[1]=Math.atan2(-l,o)):(r[0]=0,r[1]=Math.atan2(a,f))):"XZY"===t&&(r[2]=Math.asin(-n(i,-1,1)),Math.abs(i)<.99999?(r[0]=Math.atan2(h,u),r[1]=Math.atan2(a,o)):(r[0]=Math.atan2(-c,f),r[1]=0)),r},composeMat4:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:g.mat4();return g.quaternionToRotationMat4(t,n),g.scaleMat4v(r,n),g.translateMat4v(e,n),n},decomposeMat4:function(){var e=new d(3),t=new d(16);return function(r,n,o,i){e[0]=r[0],e[1]=r[1],e[2]=r[2];var a=g.lenVec3(e);e[0]=r[4],e[1]=r[5],e[2]=r[6];var s=g.lenVec3(e);e[8]=r[8],e[9]=r[9],e[10]=r[10];var u=g.lenVec3(e);g.determinantMat4(r)<0&&(a=-a),n[0]=r[12],n[1]=r[13],n[2]=r[14],t.set(r);var c=1/a,l=1/s,h=1/u;return t[0]*=c,t[1]*=c,t[2]*=c,t[4]*=l,t[5]*=l,t[6]*=l,t[8]*=h,t[9]*=h,t[10]*=h,g.mat4ToQuaternion(t,o),i[0]=a,i[1]=s,i[2]=u,this}}(),lookAtMat4v:function(e,t,r,n){n||(n=g.mat4());var o,i,a,s,u,c,l,h,f,d,p=e[0],v=e[1],m=e[2],y=r[0],x=r[1],w=r[2],b=t[0],M=t[1],I=t[2];return p===b&&v===M&&m===I?g.identityMat4():(o=p-b,i=v-M,a=m-I,s=x*(a*=d=1/Math.sqrt(o*o+i*i+a*a))-w*(i*=d),u=w*(o*=d)-y*a,c=y*i-x*o,(d=Math.sqrt(s*s+u*u+c*c))?(s*=d=1/d,u*=d,c*=d):(s=0,u=0,c=0),l=i*c-a*u,h=a*s-o*c,f=o*u-i*s,(d=Math.sqrt(l*l+h*h+f*f))?(l*=d=1/d,h*=d,f*=d):(l=0,h=0,f=0),n[0]=s,n[1]=l,n[2]=o,n[3]=0,n[4]=u,n[5]=h,n[6]=i,n[7]=0,n[8]=c,n[9]=f,n[10]=a,n[11]=0,n[12]=-(s*p+u*v+c*m),n[13]=-(l*p+h*v+f*m),n[14]=-(o*p+i*v+a*m),n[15]=1,n)},lookAtMat4c:function(e,t,r,n,o,i,a,s,u){return g.lookAtMat4v([e,t,r],[n,o,i],[a,s,u],[])},orthoMat4c:function(e,t,r,n,o,i,a){a||(a=g.mat4());var s=t-e,u=n-r,c=i-o;return a[0]=2/s,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=2/u,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=-2/c,a[11]=0,a[12]=-(e+t)/s,a[13]=-(n+r)/u,a[14]=-(i+o)/c,a[15]=1,a},frustumMat4v:function(e,t,r){r||(r=g.mat4());var n=[e[0],e[1],e[2],0],o=[t[0],t[1],t[2],0];g.addVec4(o,n,p),g.subVec4(o,n,m);var i=2*n[2],a=m[0],s=m[1],u=m[2];return r[0]=i/a,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=i/s,r[6]=0,r[7]=0,r[8]=p[0]/a,r[9]=p[1]/s,r[10]=-p[2]/u,r[11]=-1,r[12]=0,r[13]=0,r[14]=-i*o[2]/u,r[15]=0,r},frustumMat4:function(e,t,r,n,o,i,a){a||(a=g.mat4());var s=t-e,u=n-r,c=i-o;return a[0]=2*o/s,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=2*o/u,a[6]=0,a[7]=0,a[8]=(t+e)/s,a[9]=(n+r)/u,a[10]=-(i+o)/c,a[11]=-1,a[12]=0,a[13]=0,a[14]=-i*o*2/c,a[15]=0,a},perspectiveMat4:function(e,t,r,n,o){var i=[],a=[];return i[2]=r,a[2]=n,a[1]=i[2]*Math.tan(e/2),i[1]=-a[1],a[0]=a[1]*t,i[0]=-a[0],g.frustumMat4v(i,a,o)},transformPoint3:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:g.vec3(),n=t[0],o=t[1],i=t[2];return r[0]=e[0]*n+e[4]*o+e[8]*i+e[12],r[1]=e[1]*n+e[5]*o+e[9]*i+e[13],r[2]=e[2]*n+e[6]*o+e[10]*i+e[14],r},transformPoint4:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:g.vec4();return r[0]=e[0]*t[0]+e[4]*t[1]+e[8]*t[2]+e[12]*t[3],r[1]=e[1]*t[0]+e[5]*t[1]+e[9]*t[2]+e[13]*t[3],r[2]=e[2]*t[0]+e[6]*t[1]+e[10]*t[2]+e[14]*t[3],r[3]=e[3]*t[0]+e[7]*t[1]+e[11]*t[2]+e[15]*t[3],r},transformPoints3:function(e,t,r){for(var n,o,i,a,s,u=r||[],c=t.length,l=e[0],h=e[1],f=e[2],d=e[3],p=e[4],v=e[5],m=e[6],y=e[7],g=e[8],x=e[9],w=e[10],b=e[11],M=e[12],I=e[13],T=e[14],A=e[15],S=0;S<c;++S)n=(a=t[S])[0],o=a[1],i=a[2],(s=u[S]||(u[S]=[0,0,0]))[0]=l*n+p*o+g*i+M,s[1]=h*n+v*o+x*i+I,s[2]=f*n+m*o+w*i+T,s[3]=d*n+y*o+b*i+A;return u.length=c,u},transformPositions3:function(e,t){var r,n,o,i,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t,s=t.length,u=e[0],c=e[1],l=e[2],h=e[3],f=e[4],d=e[5],p=e[6],v=e[7],m=e[8],y=e[9],g=e[10],x=e[11],w=e[12],b=e[13],M=e[14],I=e[15];for(r=0;r<s;r+=3)n=t[r+0],o=t[r+1],i=t[r+2],a[r+0]=u*n+f*o+m*i+w,a[r+1]=c*n+d*o+y*i+b,a[r+2]=l*n+p*o+g*i+M,a[r+3]=h*n+v*o+x*i+I;return a},transformPositions4:function(e,t){var r,n,o,i,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t,s=t.length,u=e[0],c=e[1],l=e[2],h=e[3],f=e[4],d=e[5],p=e[6],v=e[7],m=e[8],y=e[9],g=e[10],x=e[11],w=e[12],b=e[13],M=e[14],I=e[15];for(r=0;r<s;r+=4)n=t[r+0],o=t[r+1],i=t[r+2],a[r+0]=u*n+f*o+m*i+w,a[r+1]=c*n+d*o+y*i+b,a[r+2]=l*n+p*o+g*i+M,a[r+3]=h*n+v*o+x*i+I;return a},transformVec3:function(e,t,r){var n=t[0],o=t[1],i=t[2];return(r=r||this.vec3())[0]=e[0]*n+e[4]*o+e[8]*i,r[1]=e[1]*n+e[5]*o+e[9]*i,r[2]=e[2]*n+e[6]*o+e[10]*i,r},transformVec4:function(e,t,r){var n=t[0],o=t[1],i=t[2],a=t[3];return(r=r||g.vec4())[0]=e[0]*n+e[4]*o+e[8]*i+e[12]*a,r[1]=e[1]*n+e[5]*o+e[9]*i+e[13]*a,r[2]=e[2]*n+e[6]*o+e[10]*i+e[14]*a,r[3]=e[3]*n+e[7]*o+e[11]*i+e[15]*a,r},rotateVec3X:function(e,t,r,n){var o=[],i=[];return o[0]=e[0]-t[0],o[1]=e[1]-t[1],o[2]=e[2]-t[2],i[0]=o[0],i[1]=o[1]*Math.cos(r)-o[2]*Math.sin(r),i[2]=o[1]*Math.sin(r)+o[2]*Math.cos(r),n[0]=i[0]+t[0],n[1]=i[1]+t[1],n[2]=i[2]+t[2],n},rotateVec3Y:function(e,t,r,n){var o=[],i=[];return o[0]=e[0]-t[0],o[1]=e[1]-t[1],o[2]=e[2]-t[2],i[0]=o[2]*Math.sin(r)+o[0]*Math.cos(r),i[1]=o[1],i[2]=o[2]*Math.cos(r)-o[0]*Math.sin(r),n[0]=i[0]+t[0],n[1]=i[1]+t[1],n[2]=i[2]+t[2],n},rotateVec3Z:function(e,t,r,n){var o=[],i=[];return o[0]=e[0]-t[0],o[1]=e[1]-t[1],o[2]=e[2]-t[2],i[0]=o[0]*Math.cos(r)-o[1]*Math.sin(r),i[1]=o[0]*Math.sin(r)+o[1]*Math.cos(r),i[2]=o[2],n[0]=i[0]+t[0],n[1]=i[1]+t[1],n[2]=i[2]+t[2],n},projectVec4:function(e,t){var r=1/e[3];return(t=t||g.vec2())[0]=v[0]*r,t[1]=v[1]*r,t},unprojectVec3:(o=new d(16),i=new d(16),a=new d(16),function(e,t,r,n){return this.transformVec3(this.mulMat4(this.inverseMat4(t,o),this.inverseMat4(r,i),a),e,n)}),lerpVec3:function(e,t,r,n,o,i){var a=i||g.vec3(),s=(e-t)/(r-t);return a[0]=n[0]+s*(o[0]-n[0]),a[1]=n[1]+s*(o[1]-n[1]),a[2]=n[2]+s*(o[2]-n[2]),a},flatten:function(e){var t,r,n,o,i,a=[];for(t=0,r=e.length;t<r;t++)for(n=0,o=(i=e[t]).length;n<o;n++)a.push(i[n]);return a},identityQuaternion:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:g.vec4();return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e},eulerToQuaternion:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:g.vec4(),n=e[0]*g.DEGTORAD/2,o=e[1]*g.DEGTORAD/2,i=e[2]*g.DEGTORAD/2,a=Math.cos(n),s=Math.cos(o),u=Math.cos(i),c=Math.sin(n),l=Math.sin(o),h=Math.sin(i);return"XYZ"===t?(r[0]=c*s*u+a*l*h,r[1]=a*l*u-c*s*h,r[2]=a*s*h+c*l*u,r[3]=a*s*u-c*l*h):"YXZ"===t?(r[0]=c*s*u+a*l*h,r[1]=a*l*u-c*s*h,r[2]=a*s*h-c*l*u,r[3]=a*s*u+c*l*h):"ZXY"===t?(r[0]=c*s*u-a*l*h,r[1]=a*l*u+c*s*h,r[2]=a*s*h+c*l*u,r[3]=a*s*u-c*l*h):"ZYX"===t?(r[0]=c*s*u-a*l*h,r[1]=a*l*u+c*s*h,r[2]=a*s*h-c*l*u,r[3]=a*s*u+c*l*h):"YZX"===t?(r[0]=c*s*u+a*l*h,r[1]=a*l*u+c*s*h,r[2]=a*s*h-c*l*u,r[3]=a*s*u-c*l*h):"XZY"===t&&(r[0]=c*s*u-a*l*h,r[1]=a*l*u-c*s*h,r[2]=a*s*h+c*l*u,r[3]=a*s*u+c*l*h),r},mat4ToQuaternion:function(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:g.vec4(),n=e[0],o=e[4],i=e[8],a=e[1],s=e[5],u=e[9],c=e[2],l=e[6],h=e[10],f=n+s+h;return f>0?(t=.5/Math.sqrt(f+1),r[3]=.25/t,r[0]=(l-u)*t,r[1]=(i-c)*t,r[2]=(a-o)*t):n>s&&n>h?(t=2*Math.sqrt(1+n-s-h),r[3]=(l-u)/t,r[0]=.25*t,r[1]=(o+a)/t,r[2]=(i+c)/t):s>h?(t=2*Math.sqrt(1+s-n-h),r[3]=(i-c)/t,r[0]=(o+a)/t,r[1]=.25*t,r[2]=(u+l)/t):(t=2*Math.sqrt(1+h-n-s),r[3]=(a-o)/t,r[0]=(i+c)/t,r[1]=(u+l)/t,r[2]=.25*t),r},vec3PairToQuaternion:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:g.vec4(),n=Math.sqrt(g.dotVec3(e,e)*g.dotVec3(t,t)),o=n+g.dotVec3(e,t);return o<1e-8*n?(o=0,Math.abs(e[0])>Math.abs(e[2])?(r[0]=-e[1],r[1]=e[0],r[2]=0):(r[0]=0,r[1]=-e[2],r[2]=e[1])):g.cross3Vec3(e,t,r),r[3]=o,g.normalizeQuaternion(r)},angleAxisToQuaternion:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:g.vec4(),r=e[3]/2,n=Math.sin(r);return t[0]=n*e[0],t[1]=n*e[1],t[2]=n*e[2],t[3]=Math.cos(r),t},quaternionToEuler:function(){var e=new d(16);return function(t,r,n){return n=n||g.vec3(),g.quaternionToRotationMat4(t,e),g.mat4ToEuler(e,r,n),n}}(),mulQuaternions:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:g.vec4(),n=e[0],o=e[1],i=e[2],a=e[3],s=t[0],u=t[1],c=t[2],l=t[3];return r[0]=a*s+n*l+o*c-i*u,r[1]=a*u+o*l+i*s-n*c,r[2]=a*c+i*l+n*u-o*s,r[3]=a*l-n*s-o*u-i*c,r},vec3ApplyQuaternion:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:g.vec3(),n=t[0],o=t[1],i=t[2],a=e[0],s=e[1],u=e[2],c=e[3],l=c*n+s*i-u*o,h=c*o+u*n-a*i,f=c*i+a*o-s*n,d=-a*n-s*o-u*i;return r[0]=l*c+d*-a+h*-u-f*-s,r[1]=h*c+d*-s+f*-a-l*-u,r[2]=f*c+d*-u+l*-s-h*-a,r},quaternionToMat4:function(e,t){t=g.identityMat4(t);var r=e[0],n=e[1],o=e[2],i=e[3],a=2*r,s=2*n,u=2*o,c=a*i,l=s*i,h=u*i,f=a*r,d=s*r,p=u*r,v=s*n,m=u*n,y=u*o;return t[0]=1-(v+y),t[1]=d+h,t[2]=p-l,t[4]=d-h,t[5]=1-(f+y),t[6]=m+c,t[8]=p+l,t[9]=m-c,t[10]=1-(f+v),t},quaternionToRotationMat4:function(e,t){var r=e[0],n=e[1],o=e[2],i=e[3],a=r+r,s=n+n,u=o+o,c=r*a,l=r*s,h=r*u,f=n*s,d=n*u,p=o*u,v=i*a,m=i*s,y=i*u;return t[0]=1-(f+p),t[4]=l-y,t[8]=h+m,t[1]=l+y,t[5]=1-(c+p),t[9]=d-v,t[2]=h-m,t[6]=d+v,t[10]=1-(c+f),t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},normalizeQuaternion:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e,r=g.lenVec4([e[0],e[1],e[2],e[3]]);return t[0]=e[0]/r,t[1]=e[1]/r,t[2]=e[2]/r,t[3]=e[3]/r,t},conjugateQuaternion:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e;return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3],t},inverseQuaternion:function(e,t){return g.normalizeQuaternion(g.conjugateQuaternion(e,t))},quaternionToAngleAxis:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:g.vec4(),r=(e=g.normalizeQuaternion(e,y))[3],n=2*Math.acos(r),o=Math.sqrt(1-r*r);return o<.001?(t[0]=e[0],t[1]=e[1],t[2]=e[2]):(t[0]=e[0]/o,t[1]=e[1]/o,t[2]=e[2]/o),t[3]=n,t},AABB3:function(e){return new d(e||6)},AABB2:function(e){return new d(e||4)},OBB3:function(e){return new d(e||32)},OBB2:function(e){return new d(e||16)},Sphere3:function(e,t,r,n){return new d([e,t,r,n])},transformOBB3:function(e,t){var r,n,o,i,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t,s=t.length,u=e[0],c=e[1],l=e[2],h=e[3],f=e[4],d=e[5],p=e[6],v=e[7],m=e[8],y=e[9],g=e[10],x=e[11],w=e[12],b=e[13],M=e[14],I=e[15];for(r=0;r<s;r+=4)n=t[r+0],o=t[r+1],i=t[r+2],a[r+0]=u*n+f*o+m*i+w,a[r+1]=c*n+d*o+y*i+b,a[r+2]=l*n+p*o+g*i+M,a[r+3]=h*n+v*o+x*i+I;return a},containsAABB3:function(e,t){return e[0]<=t[0]&&t[3]<=e[3]&&e[1]<=t[1]&&t[4]<=e[4]&&e[2]<=t[2]&&t[5]<=e[5]},getAABB3Diag:function(){var e=new d(3),t=new d(3),r=new d(3);return function(n){return e[0]=n[0],e[1]=n[1],e[2]=n[2],t[0]=n[3],t[1]=n[4],t[2]=n[5],g.subVec3(t,e,r),Math.abs(g.lenVec3(r))}}(),getAABB3DiagPoint:function(){var e=new d(3),t=new d(3),r=new d(3);return function(n,o){e[0]=n[0],e[1]=n[1],e[2]=n[2],t[0]=n[3],t[1]=n[4],t[2]=n[5];var i=g.subVec3(t,e,r),a=o[0]-n[0],s=n[3]-o[0],u=o[1]-n[1],c=n[4]-o[1],l=o[2]-n[2],h=n[5]-o[2];return i[0]+=a>s?a:s,i[1]+=u>c?u:c,i[2]+=l>h?l:h,Math.abs(g.lenVec3(i))}}(),getAABB3Center:function(e,t){var r=t||g.vec3();return r[0]=(e[0]+e[3])/2,r[1]=(e[1]+e[4])/2,r[2]=(e[2]+e[5])/2,r},getAABB2Center:function(e,t){var r=t||g.vec2();return r[0]=(e[2]+e[0])/2,r[1]=(e[3]+e[1])/2,r},collapseAABB3:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:g.AABB3();return e[0]=g.MAX_DOUBLE,e[1]=g.MAX_DOUBLE,e[2]=g.MAX_DOUBLE,e[3]=-g.MAX_DOUBLE,e[4]=-g.MAX_DOUBLE,e[5]=-g.MAX_DOUBLE,e},AABB3ToOBB3:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:g.OBB3();return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=1,t[4]=e[3],t[5]=e[1],t[6]=e[2],t[7]=1,t[8]=e[3],t[9]=e[4],t[10]=e[2],t[11]=1,t[12]=e[0],t[13]=e[4],t[14]=e[2],t[15]=1,t[16]=e[0],t[17]=e[1],t[18]=e[5],t[19]=1,t[20]=e[3],t[21]=e[1],t[22]=e[5],t[23]=1,t[24]=e[3],t[25]=e[4],t[26]=e[5],t[27]=1,t[28]=e[0],t[29]=e[4],t[30]=e[5],t[31]=1,t},positions3ToAABB3:(t=new d(3),function(e,r,n){r=r||g.AABB3();for(var o,i,a,s=g.MAX_DOUBLE,u=g.MAX_DOUBLE,c=g.MAX_DOUBLE,l=-g.MAX_DOUBLE,h=-g.MAX_DOUBLE,f=-g.MAX_DOUBLE,d=0,p=e.length;d<p;d+=3)n?(t[0]=e[d+0],t[1]=e[d+1],t[2]=e[d+2],g.decompressPosition(t,n,t),o=t[0],i=t[1],a=t[2]):(o=e[d+0],i=e[d+1],a=e[d+2]),o<s&&(s=o),i<u&&(u=i),a<c&&(c=a),o>l&&(l=o),i>h&&(h=i),a>f&&(f=a);return r[0]=s,r[1]=u,r[2]=c,r[3]=l,r[4]=h,r[5]=f,r}),OBB3ToAABB3:function(e){for(var t,r,n,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:g.AABB3(),i=g.MAX_DOUBLE,a=g.MAX_DOUBLE,s=g.MAX_DOUBLE,u=-g.MAX_DOUBLE,c=-g.MAX_DOUBLE,l=-g.MAX_DOUBLE,h=0,f=e.length;h<f;h+=4)(t=e[h+0])<i&&(i=t),(r=e[h+1])<a&&(a=r),(n=e[h+2])<s&&(s=n),t>u&&(u=t),r>c&&(c=r),n>l&&(l=n);return o[0]=i,o[1]=a,o[2]=s,o[3]=u,o[4]=c,o[5]=l,o},points3ToAABB3:function(e){for(var t,r,n,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:g.AABB3(),i=g.MAX_DOUBLE,a=g.MAX_DOUBLE,s=g.MAX_DOUBLE,u=-g.MAX_DOUBLE,c=-g.MAX_DOUBLE,l=-g.MAX_DOUBLE,h=0,f=e.length;h<f;h++)(t=e[h][0])<i&&(i=t),(r=e[h][1])<a&&(a=r),(n=e[h][2])<s&&(s=n),t>u&&(u=t),r>c&&(c=r),n>l&&(l=n);return o[0]=i,o[1]=a,o[2]=s,o[3]=u,o[4]=c,o[5]=l,o},points3ToSphere3:function(){var e=new d(3);return function(t,r){r=r||g.vec4();var n,o=0,i=0,a=0,s=t.length;for(n=0;n<s;n++)o+=t[n][0],i+=t[n][1],a+=t[n][2];r[0]=o/s,r[1]=i/s,r[2]=a/s;var u,c=0;for(n=0;n<s;n++)(u=Math.abs(g.lenVec3(g.subVec3(t[n],r,e))))>c&&(c=u);return r[3]=c,r}}(),positions3ToSphere3:function(){var e=new d(3),t=new d(3);return function(r,n){n=n||g.vec4();var o,i=0,a=0,s=0,u=r.length,c=0;for(o=0;o<u;o+=3)i+=r[o],a+=r[o+1],s+=r[o+2];var l,h=u/3;for(n[0]=i/h,n[1]=a/h,n[2]=s/h,o=0;o<u;o+=3)e[0]=r[o],e[1]=r[o+1],e[2]=r[o+2],(l=Math.abs(g.lenVec3(g.subVec3(e,n,t))))>c&&(c=l);return n[3]=c,n}}(),OBB3ToSphere3:function(){var e=new d(3),t=new d(3);return function(r,n){n=n||g.vec4();var o,i=0,a=0,s=0,u=r.length,c=u/4;for(o=0;o<u;o+=4)i+=r[o+0],a+=r[o+1],s+=r[o+2];n[0]=i/c,n[1]=a/c,n[2]=s/c;var l,h=0;for(o=0;o<u;o+=4)e[0]=r[o+0],e[1]=r[o+1],e[2]=r[o+2],(l=Math.abs(g.lenVec3(g.subVec3(e,n,t))))>h&&(h=l);return n[3]=h,n}}(),getSphere3Center:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:g.vec3();return t[0]=e[0],t[1]=e[1],t[2]=e[2],t},expandAABB3:function(e,t){return e[0]>t[0]&&(e[0]=t[0]),e[1]>t[1]&&(e[1]=t[1]),e[2]>t[2]&&(e[2]=t[2]),e[3]<t[3]&&(e[3]=t[3]),e[4]<t[4]&&(e[4]=t[4]),e[5]<t[5]&&(e[5]=t[5]),e},expandAABB3Point3:function(e,t){return e[0]>t[0]&&(e[0]=t[0]),e[1]>t[1]&&(e[1]=t[1]),e[2]>t[2]&&(e[2]=t[2]),e[3]<t[0]&&(e[3]=t[0]),e[4]<t[1]&&(e[4]=t[1]),e[5]<t[2]&&(e[5]=t[2]),e},triangleNormal:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:g.vec3(),o=t[0]-e[0],i=t[1]-e[1],a=t[2]-e[2],s=r[0]-e[0],u=r[1]-e[1],c=r[2]-e[2],l=i*c-a*u,h=a*s-o*c,f=o*u-i*s,d=Math.sqrt(l*l+h*h+f*f);return 0===d?(n[0]=0,n[1]=0,n[2]=0):(n[0]=l/d,n[1]=h/d,n[2]=f/d),n}};function x(e,t,r,n){var o=e[t]/(Math.abs(e[t])+Math.abs(e[t+1])+Math.abs(e[t+2])),i=e[t+1]/(Math.abs(e[t])+Math.abs(e[t+1])+Math.abs(e[t+2]));if(e[t+2]<0){var a=(1-Math.abs(i))*(o>=0?1:-1),s=(1-Math.abs(o))*(i>=0?1:-1);o=a,i=s}return new Int8Array([Math[r](127.5*o+(o<0?-1:0)),Math[n](127.5*i+(i<0?-1:0))])}function w(e){var t=e[0],r=e[1];t/=t<0?127:128,r/=r<0?127:128;var n=1-Math.abs(t)-Math.abs(r);n<0&&(t=(1-Math.abs(r))*(t>=0?1:-1),r=(1-Math.abs(t))*(r>=0?1:-1));var o=Math.sqrt(t*t+r*r+n*n);return[t/o,r/o,n/o]}function b(e,t,r){return e[t]*r[0]+e[t+1]*r[1]+e[t+2]*r[2]}var M,I,T,A,S,O,L,E,P,j,G,_,D,k,V,N,B,C={quantizePositions:function(e,t,r,n){for(var o=r[0],i=r[1],a=r[2],s=65535,u=s/(r[3]-o),c=s/(r[4]-i),l=s/(r[5]-a),h=function(e){return e>=0?e:0},f=0;f<t;f+=3)n[f+0]=Math.floor(h(e[f+0]-o)*u),n[f+1]=Math.floor(h(e[f+1]-i)*c),n[f+2]=Math.floor(h(e[f+2]-a)*l)},compressPosition:function(e,t,r){var n=new Float32Array([t[3]!==t[0]?65535/(t[3]-t[0]):0,t[4]!==t[1]?65535/(t[4]-t[1]):0,t[5]!==t[2]?65535/(t[5]-t[2]):0]);r[0]=Math.floor((e[0]-t[0])*n[0]),r[1]=Math.floor((e[1]-t[1])*n[1]),r[2]=Math.floor((e[2]-t[2])*n[2])},createPositionsDecodeMatrix:(l=g.mat4(),h=g.mat4(),function(e,t){t=t||g.mat4();var r=e[0],n=e[1],o=e[2],i=e[3]-r,a=e[4]-n,s=e[5]-o,u=65535;return g.identityMat4(l),g.translationMat4v(e,l),g.identityMat4(h),g.scalingMat4v([i/u,a/u,s/u],h),g.mulMat4(l,h,t),t}),transformAndOctEncodeNormals:function(e,t,r,n,o){var i,a,s,u,c,l=g.vec3(),h=g.vec3();for(c=0;c<r;c+=3)l[0]=t[c],l[1]=t[c+1],l[2]=t[c+2],g.transformVec3(e,l,h),g.normalizeVec3(h,h),a=i=x(h,0,"floor","floor"),s=u=b(h,0,w(i)),(s=b(h,0,w(i=x(h,0,"ceil","floor"))))>u&&(a=i,u=s),(s=b(h,0,w(i=x(h,0,"floor","ceil"))))>u&&(a=i,u=s),(s=b(h,0,w(i=x(h,0,"ceil","ceil"))))>u&&(a=i,u=s),n[o+c+0]=a[0],n[o+c+1]=a[1],n[o+c+2]=0;return o+r},octEncodeNormals:function(e,t,r,n){for(var o,i,a,s,u=0;u<t;u+=3)i=o=x(e,u,"floor","floor"),a=s=b(e,u,w(o)),(a=b(e,u,w(o=x(e,u,"ceil","floor"))))>s&&(i=o,s=a),(a=b(e,u,w(o=x(e,u,"floor","ceil"))))>s&&(i=o,s=a),(a=b(e,u,w(o=x(e,u,"ceil","ceil"))))>s&&(i=o,s=a),r[n+u+0]=i[0],r[n+u+1]=i[1],r[n+u+2]=0;return n+t}},F=(M=[],I=[],T=[],A=[],S=[],O=0,L=new Uint16Array(3),E=new Uint16Array(3),P=new Uint16Array(3),j=g.vec3(),G=g.vec3(),_=g.vec3(),D=g.vec3(),k=g.vec3(),V=g.vec3(),N=g.vec3(),B=g.vec3(),function(e,t,r,n){!function(e,t){var r,n,o,i,a,s,u={},c=Math.pow(10,4),l=0;for(a=0,s=e.length;a<s;a+=3)r=e[a],n=e[a+1],o=e[a+2],void 0===u[i=Math.round(r*c)+"_"+Math.round(n*c)+"_"+Math.round(o*c)]&&(u[i]=l/3,M[l++]=r,M[l++]=n,M[l++]=o),I[a/3]=u[i];for(a=0,s=t.length;a<s;a++)A[a]=I[t[a]],T[A[a]]=t[a]}(e,t),function(e,t){O=0;for(var r=0,n=e;r<n;r+=3){var o=3*A[r],i=3*A[r+1],a=3*A[r+2];t?(L[0]=M[o],L[1]=M[o+1],L[2]=M[o+2],E[0]=M[i],E[1]=M[i+1],E[2]=M[i+2],P[0]=M[a],P[1]=M[a+1],P[2]=M[a+2],g.decompressPosition(L,t,j),g.decompressPosition(E,t,G),g.decompressPosition(P,t,_)):(j[0]=M[o],j[1]=M[o+1],j[2]=M[o+2],G[0]=M[i],G[1]=M[i+1],G[2]=M[i+2],_[0]=M[a],_[1]=M[a+1],_[2]=M[a+2]),g.subVec3(_,G,D),g.subVec3(j,G,k),g.cross3Vec3(D,k,V),g.normalizeVec3(V,N);var s=S[O]||(S[O]={normal:g.vec3()});s.normal[0]=N[0],s.normal[1]=N[1],s.normal[2]=N[2],O++}}(t.length,r);for(var o,i,a,s,u,c,l,h,f,d,p,v=[],m=Math.cos(g.DEGTORAD*n),y={},x=!1,w=0,b=t.length;w<b;w+=3)for(var C=w/3,F=0;F<3;F++)o=A[w+F],i=A[w+(F+1)%3],void 0===y[u=(a=Math.min(o,i))+","+(s=Math.max(o,i))]?y[u]={index1:a,index2:s,face1:C,face2:void 0}:y[u].face2=C;for(u in y){if(void 0!==(c=y[u]).face2){l=S[c.face1].normal,h=S[c.face2].normal,B[0]=-h[0],B[1]=-h[1],B[2]=-h[2],f=Math.abs(g.dotVec3(l,h));var z=Math.abs(g.dotVec3(l,B));if(f>m&&z>m)continue}d=T[c.index1],p=T[c.index2],(!x&&d>65535||p>65535)&&(x=!0),v.push(d),v.push(p)}return x?new Uint32Array(v):new Uint16Array(v)}),z=function(e,t,r,n){function o(e,r){for(var n,o,i=0;i<3;i++)if((n=t[3*e+i])!==(o=t[3*r+i]))return o-n;return 0}for(var i=e.slice().sort(o),a=null,s=0,u=i.length;s<u;s++)0!=s&&0==o(i[s],i[s-1])||(a=i[s]),r[i[s]]=a;for(var c=0,l=e.length;c<l;c+=3){var h=r[e[c]],f=r[e[c+1]],d=r[e[c+2]],p=h,v=f,m=d;if(h>f&&h>d?f>d?(p=h,v=f,m=d):(p=h,v=d,m=f):f>h&&f>d?h>d?(p=f,v=h,m=d):(p=f,v=d,m=h):d>h&&d>f&&(h>f?(p=d,v=h,m=f):(p=d,v=f,m=h)),n[c+0]=[p,v],n[c+1]=[v,m],p>m){var y=m;m=p,p=y}n[c+2]=[m,p]}function g(e,t){for(var r,n,o=0;o<2;o++)if(r=e[o],(n=t[o])!==r)return n-r;return 0}(n=n.slice(0,e.length)).sort(g);for(var x=0,w=0;w<n.length;w++)if(0===w||0!==g(n[w],n[w-1])){if(0!==w&&2!==x)return!1;x=1}else x++;return!(n.length>0&&2!==x)};function U(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function R(e,t,r){return t&&U(e.prototype,t),r&&U(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}var X=R((function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.meshId=t.meshId,this.meshIndex=t.meshIndex,this.matrix=t.matrix,this.geometry=t.geometry,this.color=t.color||new Uint8Array([1,1,1]),this.metallic=null!==t.metallic&&void 0!==t.metallic?t.metallic:0,this.roughness=null!==t.roughness&&void 0!==t.roughness?t.roughness:1,this.opacity=void 0!==t.opacity&&null!==t.opacity?t.opacity:1,this.textureSet=t.textureSet,this.entity=null}));function K(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var q=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.geometryId=t.geometryId,this.primitiveType=t.primitiveType,this.geometryIndex=t.geometryIndex,this.numInstances=0,this.positions=t.positions,this.positionsQuantized=new Uint16Array(t.positions.length),this.normals=t.normals,this.normalsOctEncoded=null,this.colorsCompressed=t.colorsCompressed,this.uvs=t.uvs,this.uvsCompressed=t.uvsCompressed,this.indices=t.indices,this.edgeIndices=t.edgeIndices,this.solid=!1}var t,r;return t=e,(r=[{key:"reused",get:function(){return this.numInstances>1}}])&&K(t.prototype,r),Object.defineProperty(t,"prototype",{writable:!1}),e}();function Z(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Y(e,t,r){return t&&Z(e.prototype,t),r&&Z(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}var Q=Y((function e(t,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.entityId=t,this.entityIndex=null,this.meshes=r,this.aabb=g.AABB3(),this.hasReusedGeometries=!1}));function W(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function J(e,t,r){return t&&W(e.prototype,t),r&&W(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}var H=J((function e(t,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.aabb=t,this.entities=r}));function $(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function ee(e,t,r){return t&&$(e.prototype,t),r&&$(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}var te=ee((function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.aabb=t,this.entities=null,this.left=null,this.right=null}));function re(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function ne(e,t,r){return t&&re(e.prototype,t),r&&re(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}var oe=ne((function e(t,r,n,o,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.metaObjectId=t,this.propertySetIds=r,this.metaObjectType=n,this.metaObjectName=o,this.parentMetaObjectId=i}));function ie(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function ae(e,t,r){return t&&ie(e.prototype,t),r&&ie(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}var se=ae((function e(t,r,n,o){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.propertySetId=t,this.propertySetType=r,this.propertySetName=n,this.properties=o}));function ue(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function ce(e,t,r){return t&&ue(e.prototype,t),r&&ue(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}var le=ce((function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.textureId=t.textureId,this.textureIndex=t.textureIndex,this.imageData=t.imageData,this.channel=null,this.width=t.width,this.height=t.height,this.src=t.src}));function he(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function fe(e,t,r){return t&&he(e.prototype,t),r&&he(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}var de=fe((function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.textureSetId=t.textureSetId,this.textureSetIndex=t.textureSetIndex,this.materialType=t.materialType,this.materialIndex=t.materialIndex,this.numInstances=0,this.colorTexture=t.colorTexture,this.metallicRoughnessTexture=t.metallicRoughnessTexture,this.normalsTexture=t.normalsTexture,this.emissiveTexture=t.emissiveTexture,this.occlusionTexture=t.occlusionTexture}));const pe=require("@loaders.gl/core"),ve=require("@loaders.gl/textures"),me=require("@loaders.gl/images");function ye(e){return ye="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ye(e)}function ge(){ge=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function s(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,r){return e[t]=r}}function u(e,t,r,n){var o=t&&t.prototype instanceof h?t:h,i=Object.create(o.prototype),a=new I(n||[]);return i._invoke=function(e,t,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var s=w(a,r);if(s){if(s===l)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=c(e,t,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===l)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}(e,r,a),i}function c(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var l={};function h(){}function f(){}function d(){}var p={};s(p,o,(function(){return this}));var v=Object.getPrototypeOf,m=v&&v(v(T([])));m&&m!==t&&r.call(m,o)&&(p=m);var y=d.prototype=h.prototype=Object.create(p);function g(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function n(o,i,a,s){var u=c(e[o],e,i);if("throw"!==u.type){var l=u.arg,h=l.value;return h&&"object"==ye(h)&&r.call(h,"__await")?t.resolve(h.__await).then((function(e){n("next",e,a,s)}),(function(e){n("throw",e,a,s)})):t.resolve(h).then((function(e){l.value=e,a(l)}),(function(e){return n("throw",e,a,s)}))}s(u.arg)}var o;this._invoke=function(e,r){function i(){return new t((function(t,o){n(e,r,t,o)}))}return o=o?o.then(i,i):i()}}function w(e,t){var r=e.iterator[t.method];if(void 0===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,w(e,t),"throw"===t.method))return l;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var n=c(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,l;var o=n.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,l):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,l)}function b(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function M(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(b,this),this.reset(!0)}function T(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,i=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:A}}function A(){return{value:void 0,done:!0}}return f.prototype=d,s(y,"constructor",d),s(d,"constructor",f),f.displayName=s(d,a,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===f||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,s(e,a,"GeneratorFunction")),e.prototype=Object.create(y),e},e.awrap=function(e){return{__await:e}},g(x.prototype),s(x.prototype,i,(function(){return this})),e.AsyncIterator=x,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new x(u(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},g(y),s(y,a,"Generator"),s(y,o,(function(){return this})),s(y,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=T,I.prototype={constructor:I,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(M),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return a.type="throw",a.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(s&&u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,l):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),l},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),M(r),l}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;M(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:T(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},e}function xe(e,t,r,n,o,i,a){try{var s=e[i](a),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,o)}function we(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function be(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var Me=g.vec4([0,0,0,1]),Ie=g.vec4([0,0,0,1]),Te=g.mat4(),Ae=g.mat4(),Se=new Float64Array(3),Oe={0:{useSRGB:!0,qualityLevel:50,encodeUASTC:!0,mipmaps:!0},3:{useSRGB:!0,encodeUASTC:!0,qualityLevel:10,mipmaps:!1},1:{useSRGB:!1,encodeUASTC:!0,qualityLevel:50,mipmaps:!0},2:{useSRGB:!1,encodeUASTC:!0,qualityLevel:10,mipmaps:!1},4:{useSRGB:!1,encodeUASTC:!0,qualityLevel:10,mipmaps:!1}},Le=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};we(this,e),this.modelId=t.modelId||"default",this.projectId=t.projectId||"",this.revisionId=t.revisionId||"",this.author=t.author||"",this.createdAt=t.createdAt||"",this.creatingApplication=t.creatingApplication||"",this.schema=t.schema||"",this.xktVersion=f.xktVersion,this.edgeThreshold=t.edgeThreshold||10,this.minTileSize=t.minTileSize||1e3,this.propertySets={},this.propertySetsList=[],this.metaObjects={},this.metaObjectsList=[],this.reusedGeometriesDecodeMatrix=new Float32Array(16),this.geometries={},this.geometriesList=[],this.textures={},this.texturesList=[],this.textureSets={},this.textureSetsList=[],this.meshes={},this.meshesList=[],this.entities={},this.entitiesList=[],this.tilesList=[],this.aabb=g.AABB3(),this.finalized=!1}var t,r,n,o;return t=e,r=[{key:"createPropertySet",value:function(e){if(!e)throw"Parameters expected: params";if(null===e.propertySetId||void 0===e.propertySetId)throw"Parameter expected: params.propertySetId";if(null===e.properties||void 0===e.properties)throw"Parameter expected: params.properties";if(this.finalized)console.error("XKTModel has been finalized, can't add more property sets");else if(!this.propertySets[e.propertySetId]){var t=e.propertySetId,r=e.propertySetType||"Default",n=e.propertySetName||e.propertySetId,o=e.properties||[],i=new se(t,r,n,o);return this.propertySets[t]=i,this.propertySetsList.push(i),i}}},{key:"createMetaObject",value:function(e){if(!e)throw"Parameters expected: params";if(null===e.metaObjectId||void 0===e.metaObjectId)throw"Parameter expected: params.metaObjectId";if(this.finalized)console.error("XKTModel has been finalized, can't add more meta objects");else if(!this.metaObjects[e.metaObjectId]){var t=e.metaObjectId,r=e.propertySetIds,n=e.metaObjectType||"Default",o=e.metaObjectName||e.metaObjectId,i=e.parentMetaObjectId,a=new oe(t,r,n,o,i);return this.metaObjects[t]=a,this.metaObjectsList.push(a),i||this._rootMetaObject||(this._rootMetaObject=a),a}}},{key:"createTexture",value:function(e){if(!e)throw"Parameters expected: params";if(null===e.textureId||void 0===e.textureId)throw"Parameter expected: params.textureId";if(!e.imageData&&!e.src)throw"Parameter expected: params.imageData or params.src";if(this.finalized)console.error("XKTModel has been finalized, can't add more textures");else{if(!this.textures[e.textureId]){if(e.src){var t=e.src.split(".").pop();if("jpg"!==t&&"jpeg"!==t&&"png"!==t)return void console