1(self.rspackChunkOne=self.rspackChunkOne||[]).push([[22078],{96350(e){"use strict";e.exports=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=void 0,n=void 0,o=void 0,a=[];return function(){var l,h,c="function"==typeof(l=t)?l():l,u=new Date().getTime(),d=!i||u-i>c;i=u;for(var m=arguments.length,p=Array(m),f=0;f<m;f++)p[f]=arguments[f];if(d&&r.leading)return r.accumulate?Promise.resolve(e.call(this,[p])).then(function(e){return e[0]}):Promise.resolve(e.call.apply(e,[this].concat(p)));if(n?clearTimeout(o):((h={}).promise=new Promise(function(e,t){h.resolve=e,h.reject=t}),n=h),a.push(p),o=setTimeout(s.bind(this),c),r.accumulate){var b=a.length-1;return n.promise.then(function(e){return e[b]})}return n.promise};function s(){var t=n;clearTimeout(o),Promise.resolve(r.accumulate?e.call(this,a):e.apply(this,a[a.length-1])).then(t.resolve,t.reject),a=[],n=null}}},6612(e,t,r){var i;e=r.nmd(e),i=function(e){"use strict";var t=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},r={order:2,precision:2,period:null};function i(e,t){var r=[],i=[];
1e.forEach(function(e,n){null!==e[1]&&(i.push(e),r.push(t[n]))});var n=i.reduce(function(e,t){return e+t[1]},0)/i.length,o=i.reduce(function(e,t){var r=t[1]-n;return e+r*r},0);return 1-i.reduce(function(e,t,i){var n=r[i],o=t[1]-n[1];return e+o*o},0)/o}function n(e,t){var r=Math.pow(10,t);return Math.round(e*r)/r}var o={linear:function(e,t){for(var r=[0,0,0,0,0],o=0,a=0;a<e.length;a++)null!==e[a][1]&&(o++,r[0]+=e[a][0],r[1]+=e[a][1],r[2]+=e[a][0]*e[a][0],r[3]+=e[a][0]*e[a][1],r[4]+=e[a][1]*e[a][1]);var s=o*r[2]-r[0]*r[0],l=o*r[3]-r[0]*r[1],h=0===s?0:n(l/s,t.precision),c=n(r[1]/o-h*r[0]/o,t.precision),u=function(e){return[n(e,t.precision),n(h*e+c,t.precision)]},d=e.map(function(e){return u(e[0])});return{points:d,predict:u,equation:[h,c],r2:n(i(e,d),t.precision),string:0===c?"y = "+h+"x":"y = "+h+"x + "+c}},exponential:function(e,t){for(var r=[0,0,0,0,0,0],o=0;o<e.length;o++)null!==e[o][1]&&(r[0]+=e[o][0],r[1]+=e[o][1],r[2]+=e[o][0]*e[o][0]*e[o][1],r[3]+=e[o][1]*Math.log(e[o][1]),r[4]+=e[o][0]*e[o][1]*Math.log(e[o][1]),r[5]+=e[o][0]*e[o][1]);var a=r[1]*r[2]-r[5]*r[5],s=Math.exp((r[2]*r[3]-r[5]*r[4])/a),l=(r[1]*r[4]-r[5]*r[3])/a,h=n(s,t.precision),c=n(l,t.precision),u=function(e){return[n(e,t.precision),n(h*Math.exp(c*e),t.precision)]},d=e.map(function(e){return u(e[0])});return{points:d,predict:u,equation:[h,c],string:"y = "+h+"e^("+c+"x)",r2:n(i(e,d),t.precision)}},logarithmic:function(e,t){for(var r=[0,0,0,0],o=e.length,a=0;a<o;a++)null!==e[a][1]&&(r[0]+=Math.log(e[a][0]),r[1]+=e[a][1]*Math.log(e[a][0]),r[2]+=e[a][1],r[3]+=Math.pow(Math.log(e[a][0]),2));var s=n((o*r[1]-r[2]*r[0])/(o*r[3]-r[0]*r[0]),t.precision),l=n((r[2]-s*r[0])/o,t.precision),h=function(e){return[n(e,t.precision),n(n(l+s*Math.log(e),t.precision),t.precision)]},c=e.map(function(e){return h(e[0])});return{points:c,predict:h,equation:[l,s],string:"y = "+l+" + "+s+" ln(x)",r2:n(i(e,c),t.precision)}},power:function(e,t){for(var r=[0,0,0,0,0],o=e.length,a=0;a<o;a++)null!==e[a][1]&&(r[0]+=Math.log(e[a][0]),r[1]+=Math.log(e[a][1])*Math.log(e[a][0]),r[2]+=Math.log(e[a][1]),r[3]+=Math.pow(Math.log(e[a][0]),2));var s=(o*r[1]-r[0]*r[2])/(o*r[3]-Math.pow(r[0],2)),l=n(Math.exp((r[2]-s*r[0])/o),t.precision),h=n(s,t.precision),c=function(e){return[n(e,t.precision),n(n(l*Math.pow(e,h),t.precision),t.precision)]},u=e.map(function(e){return c(e[0])});return{points:u,predict:c,equation:[l,h],string:"y = "+l+"x^"+h,r2:n(i(e,u),t.precision)}},polynomial:function(e,t){for(var r=[],o=[],a=0,s=0,l=e.length,h=t.order+1,c=0;c<h;c++){for(var u=0;u<l;u++)null!==e[u][1]&&(a+=Math.pow(e[u][0],c)*e[u][1]);r.push(a),a=0;for(var d=[],m=0;m<h;m++){for(var p=0;p<l;p++)null!==e[p][1]&&(s+=Math.pow(e[p][0],c+m));d.push(s),s=0}o.push(d)}o.push(r);for(var f=(function(e,t){for(var r=e.length-1,i=[t],n=0;n<r;n++){for(var o=n,a=n+1;a<r;a++)Math.abs(e[n][a])>Math.abs(e[n][o])&&(o=a);for(var s=n;s<r+1;s++){var l=e[s][n];e[s][n]=e[s][o],e[s][o]=l}for(var h=n+1;h<r;h++)for(var c=r;c>=n;c--)e[c][h]-=e[c][n]*e[n][h]/e[n][n]}for(var u=r-1;u>=0;u--){for(var d=0,m=u+1;m<r;m++)d+=e[m][u]*i[m];i[u]=(e[r][u]-d)/e[u][u]}return i})(o,h).map(function(e){return n(e,t.precision)}),b=function(e){return[n(e,t.precision),n(f.reduce(function(t,r,i){return t+r*Math.pow(e,i)},0),t.precision)]},g=e.map(function(e){return b(e[0])}),v="y = ",y=f.length-1;y>=0;y--)y>1?v+=f[y]+"x^"+y+" + ":1===y?v+=f[y]+"x + ":v+=f[y];return{string:v,points:g,predict:b,equation:[].concat(function(e){if(!Array.isArray(e))return Array.from(e);for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}(f)).reverse(),r2:n(i(e,g),t.precision)}}};e.exports=Object.keys(o).reduce(function(e,i){var a,s;return t({_round:n},e,(a={},s=function(e,n){return o[i](e,t({},r,n))},i in a?Object.defineProperty(a,i,{value:s,enumerable:!0,configurable:!0,writable:!0}):a[i]=s,a))},{})},"function"==typeof define&&define.amd?define(["module"],i):i(e)},73296(e,t,r){"use strict";let i,n,o,a,s,l,h;r.r(t),r.d(t,{Viewer3d:()=>rl});var c,u,d,m,p,f,b,g=r(91987),v=r(71763),y=r(77951),w=r.n(y),x=r(96350);let F=Float32Array;function E(e,t,r){let i=new F(3);return e&&(i[0]=e),t&&(i[1]=t),r&&(i[2]=r),i}function P(e,t,r){return(r=r||new F(3))[0]=e[0]+t[0],r[1]=e[1]+t[1],r[2]=e[2]+t[2],r}function M(e,t,r){return(r=r||new F(3))[0]=e[0]-t[0],r[1]=e[1]-t[1],r[2]=e[2]-t[2],r}function A(e,t,r){r=r||new F(3);let i=e[2]*t[0]-e[0]*t[2],n=e[0]*t[1]-e[1]*t[0];return r[0]=e[1]*t[2]-e[2]*t[1],r[1]=i,r[2]=n,r}
1function S(e,t){t=t||new F(3);let r=Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);return r>1e-5?(t[0]=e[0]/r,t[1]=e[1]/r,t[2]=e[2]/r):(t[0]=0,t[1]=0,t[2]=0),t}function R(e,t,r){return(r=r||new F(3))[0]=e[0]*t[0],r[1]=e[1]*t[1],r[2]=e[2]*t[2],r}var T=Object.freeze({__proto__:null,add:P,copy:function(e,t){return(t=t||new F(3))[0]=e[0],t[1]=e[1],t[2]=e[2],t},create:E,cross:A,distance:function(e,t){let r=e[0]-t[0],i=e[1]-t[1],n=e[2]-t[2];return Math.sqrt(r*r+i*i+n*n)},distanceSq:function(e,t){let r=e[0]-t[0],i=e[1]-t[1],n=e[2]-t[2];return r*r+i*i+n*n},divide:function(e,t,r){return(r=r||new F(3))[0]=e[0]/t[0],r[1]=e[1]/t[1],r[2]=e[2]/t[2],r},divScalar:function(e,t,r){return(r=r||new F(3))[0]=e[0]/t,r[1]=e[1]/t,r[2]=e[2]/t,r},dot:function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]},lerp:function(e,t,r,i){return(i=i||new F(3))[0]=e[0]+r*(t[0]-e[0]),i[1]=e[1]+r*(t[1]-e[1]),i[2]=e[2]+r*(t[2]-e[2]),i},lerpV:function(e,t,r,i){return(i=i||new F(3))[0]=e[0]+r[0]*(t[0]-e[0]),i[1]=e[1]+r[1]*(t[1]-e[1]),i[2]=e[2]+r[2]*(t[2]-e[2]),i},length:function(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2])},lengthSq:function(e){return e[0]*e[0]+e[1]*e[1]+e[2]*e[2]},max:function(e,t,r){return(r=r||new F(3))[0]=Math.max(e[0],t[0]),r[1]=Math.max(e[1],t[1]),r[2]=Math.max(e[2],t[2]),r},min:function(e,t,r){return(r=r||new F(3))[0]=Math.min(e[0],t[0]),r[1]=Math.min(e[1],t[1]),r[2]=Math.min(e[2],t[2]),r},mulScalar:function(e,t,r){return(r=r||new F(3))[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*t,r},multiply:R,negate:function(e,t){return(t=t||new F(3))[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t},normalize:S,setDefaultType:function(e){let t=F;return F=e,t},subtract:M});let I=Float32Array;function k(e,t){return(t=t||new I(16))[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 L(e){return(e=e||new I(16))[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}function C(e,t){t=t||new I(16);let r=e[0],i=e[1],n=e[2],o=e[3],a=e[4],s=e[5],l=e[6],h=e[7],c=e[8],u=e[9],d=e[10],m=e[11],p=e[12],f=e[13],b=e[14],g=e[15],v=d*g,y=b*m,w=l*g,x=b*h,F=l*m,E=d*h,P=n*g,M=b*o,A=n*m,S=d*o,R=n*h,T=l*o,k=c*f,L=p*u,C=a*f,O=p*s,_=a*u,V=c*s,D=r*f,z=p*i,j=r*u,U=c*i,B=r*s,$=a*i,q=v*s+x*u+F*f-(y*s+w*u+E*f),G=y*i+P*u+S*f-(v*i+M*u+A*f),H=w*i+M*s+R*f-(x*i+P*s+T*f),N=E*i+A*s+T*u-(F*i+S*s+R*u),W=1/(r*q+a*G+c*H+p*N);return t[0]=W*q,t[1]=W*G,t[2]=W*H,t[3]=W*N,t[4]=W*(y*a+w*c+E*p-(v*a+x*c+F*p)),t[5]=W*(v*r+M*c+A*p-(y*r+P*c+S*p)),t[6]=W*(x*r+P*a+T*p-(w*r+M*a+R*p)),t[7]=W*(F*r+S*a+R*c-(E*r+A*a+T*c)),t[8]=W*(k*h+O*m+_*g-(L*h+C*m+V*g)),t[9]=W*(L*o+D*m+U*g-(k*o+z*m+j*g)),t[10]=W*(C*o+z*h+B*g-(O*o+D*h+$*g)),t[11]=W*(V*o+j*h+$*m-(_*o+U*h+B*m)),t[12]=W*(C*d+V*b+L*l-(_*b+k*l+O*d)),t[13]=W*(j*b+k*n+z*d-(D*d+U*b+L*n)),t[14]=W*(D*l+$*b+O*n-(B*b+C*n+z*l)),t[15]=W*(B*d+_*n+U*l-(j*l+$*d+V*n)),t}function O(e,t,r){r=r||E();let i=t[0],n=t[1],o=t[2],a=i*e[3]+n*e[7]+o*e[11]+e[15];return r[0]=(i*e[0]+n*e[4]+o*e[8]+e[12])/a,r[1]=(i*e[1]+n*e[5]+o*e[9]+e[13])/a,r[2]=(i*e[2]+n*e[6]+o*e[10]+e[14])/a,r}function _(e,t,r){r=r||E();let i=t[0],n=t[1],o=t[2];return r[0]=i*e[0]+n*e[4]+o*e[8],r[1]=i*e[1]+n*e[5]+o*e[9],r[2]=i*e[2]+n*e[6]+o*e[10],r}var V=Object.freeze({__proto__:null,axisRotate:function(e,t,r,i){i=i||new I(16);let n=t[0],o=t[1],a=t[2],s=Math.sqrt(n*n+o*o+a*a),l=(n/=s)*n,h=(o/=s)*o,c=(a/=s)*a,u=Math.cos(r),d=Math.sin(r),m=1-u,p=l+(1-l)*u,f=n*o*m+a*d,b=n*a*m-o*d,g=n*o*m-a*d,v=h+(1-h)*u,y=o*a*m+n*d,w=n*a*m+o*d,x=o*a*m-n*d,F=c+(1-c)*u,E=e[0],P=e[1],M=e[2],A=e[3],S=e[4],R=e[5],T=e[6],k=e[7],L=e[8],C=e[9],O=e[10],_=e[11];return i[0]=p*E+f*S+b*L,i[1]=p*P+f*R+b*C,i[2]=p*M+f*T+b*O,i[3]=p*A+f*k+b*_,i[4]=g*E+v*S+y*L,i[5]=g*P+v*R+y*C,i[6]=g*M+v*T+y*O,i[7]=g*A+v*k+y*_,i[8]=w*E+x*S+F*L,i[9]=w*P+x*R+F*C,i[10]=w*M+x*T+F*O,i[11]=w*A+x*k+F*_,e!==i&&(i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15]),i},axisRotation:function(e,t,r){r=r||new I(16);let i=e[0],n=e[1],o=e[2],a=Math.sqrt(i*i+n*n+o*o),s=(i/=a)*i,l=(n/=a)*n,h=(o/=a)*o,c=Math.cos(t),u=Math.sin(t),d=1-c;return r[0]=s+(1-s)*c,r[1]=i*n*d+o*u,r[2]=i*o*d-n*u,r[3]=0,r[4]=i*n*d-o*u,r[5]=l+(1-l)*c,r[6]=n*o*d+i*u,r[7]=0,r[8]=i*o*d+n*u,r[9]=n*o*d-i*u,r[10]=h+(1-h)*c,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r},copy:k,create:function(){return new I(16).fill(0)},frustum:function(e,t,r,i,n,o,a){a=a||new I(16);let s=t-e,l=i-r,h=n-o;return a[0]=2*n/s,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=2*n/l,a[6]=0,a[7]=0,a[8]=(e+t)/s,a[9]=(i+r)/l,a[10]=o/h,a[11]=-1,a[12]=0,a[13]=0,a[14]=n*o/h,a[15]=0,a}
1,getAxis:function(e,t,r){r=r||E();let i=4*t;return r[0]=e[i+0],r[1]=e[i+1],r[2]=e[i+2],r},getTranslation:function(e,t){return(t=t||E())[0]=e[12],t[1]=e[13],t[2]=e[14],t},identity:L,inverse:C,lookAt:function(e,t,r,a){return a=a||new I(16),i=i||E(),n=n||E(),S(M(e,t,o=o||E()),o),S(A(r,o,i),i),S(A(o,i,n),n),a[0]=i[0],a[1]=i[1],a[2]=i[2],a[3]=0,a[4]=n[0],a[5]=n[1],a[6]=n[2],a[7]=0,a[8]=o[0],a[9]=o[1],a[10]=o[2],a[11]=0,a[12]=e[0],a[13]=e[1],a[14]=e[2],a[15]=1,a},multiply:function(e,t,r){r=r||new I(16);let i=e[0],n=e[1],o=e[2],a=e[3],s=e[4],l=e[5],h=e[6],c=e[7],u=e[8],d=e[9],m=e[10],p=e[11],f=e[12],b=e[13],g=e[14],v=e[15],y=t[0],w=t[1],x=t[2],F=t[3],E=t[4],P=t[5],M=t[6],A=t[7],S=t[8],R=t[9],T=t[10],k=t[11],L=t[12],C=t[13],O=t[14],_=t[15];return r[0]=i*y+s*w+u*x+f*F,r[1]=n*y+l*w+d*x+b*F,r[2]=o*y+h*w+m*x+g*F,r[3]=a*y+c*w+p*x+v*F,r[4]=i*E+s*P+u*M+f*A,r[5]=n*E+l*P+d*M+b*A,r[6]=o*E+h*P+m*M+g*A,r[7]=a*E+c*P+p*M+v*A,r[8]=i*S+s*R+u*T+f*k,r[9]=n*S+l*R+d*T+b*k,r[10]=o*S+h*R+m*T+g*k,r[11]=a*S+c*R+p*T+v*k,r[12]=i*L+s*C+u*O+f*_,r[13]=n*L+l*C+d*O+b*_,r[14]=o*L+h*C+m*O+g*_,r[15]=a*L+c*C+p*O+v*_,r},negate:function(e,t){return(t=t||new I(16))[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},ortho:function(e,t,r,i,n,o,a){return(a=a||new I(16))[0]=2/(t-e),a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=2/(i-r),a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=2/(n-o),a[11]=0,a[12]=(t+e)/(e-t),a[13]=(i+r)/(r-i),a[14]=(o+n)/(n-o),a[15]=1,a},perspective:function(e,t,r,i,n){n=n||new I(16);let o=Math.tan(.5*Math.PI-.5*e),a=1/(r-i);return n[0]=o/t,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=o,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=(r+i)*a,n[11]=-1,n[12]=0,n[13]=0,n[14]=r*i*a*2,n[15]=0,n},rotateX:function(e,t,r){r=r||new I(16);let i=e[4],n=e[5],o=e[6],a=e[7],s=e[8],l=e[9],h=e[10],c=e[11],u=Math.cos(t),d=Math.sin(t);return r[4]=u*i+d*s,r[5]=u*n+d*l,r[6]=u*o+d*h,r[7]=u*a+d*c,r[8]=u*s-d*i,r[9]=u*l-d*n,r[10]=u*h-d*o,r[11]=u*c-d*a,e!==r&&(r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r},rotateY:function(e,t,r){r=r||new I(16);let i=e[0],n=e[1],o=e[2],a=e[3],s=e[8],l=e[9],h=e[10],c=e[11],u=Math.cos(t),d=Math.sin(t);return r[0]=u*i-d*s,r[1]=u*n-d*l,r[2]=u*o-d*h,r[3]=u*a-d*c,r[8]=u*s+d*i,r[9]=u*l+d*n,r[10]=u*h+d*o,r[11]=u*c+d*a,e!==r&&(r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r},rotateZ:function(e,t,r){r=r||new I(16);let i=e[0],n=e[1],o=e[2],a=e[3],s=e[4],l=e[5],h=e[6],c=e[7],u=Math.cos(t),d=Math.sin(t);return r[0]=u*i+d*s,r[1]=u*n+d*l,r[2]=u*o+d*h,r[3]=u*a+d*c,r[4]=u*s-d*i,r[5]=u*l-d*n,r[6]=u*h-d*o,r[7]=u*c-d*a,e!==r&&(r[8]=e[8],r[9]=e[9],r[10]=e[10],r[11]=e[11],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r},rotationX:function(e,t){t=t||new I(16);let r=Math.cos(e),i=Math.sin(e);return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=r,t[6]=i,t[7]=0,t[8]=0,t[9]=-i,t[10]=r,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},rotationY:function(e,t){t=t||new I(16);let r=Math.cos(e),i=Math.sin(e);return t[0]=r,t[1]=0,t[2]=-i,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=i,t[9]=0,t[10]=r,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},rotationZ:function(e,t){t=t||new I(16);let r=Math.cos(e),i=Math.sin(e);return t[0]=r,t[1]=i,t[2]=0,t[3]=0,t[4]=-i,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},scale:function(e,t,r){r=r||new I(16);let i=t[0],n=t[1],o=t[2];return r[0]=i*e[0],r[1]=i*e[1],r[2]=i*e[2],r[3]=i*e[3],r[4]=n*e[4],r[5]=n*e[5],r[6]=n*e[6],r[7]=n*e[7],r[8]=o*e[8],r[9]=o*e[9],r[10]=o*e[10],r[11]=o*e[11],e!==r&&(r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r},scaling:function(e,t){return(t=t||new I(16))[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},setAxis:function(e,t,r,i){i!==e&&(i=k(e,i));let n=4*r;return i[n+0]=t[0],i[n+1]=t[1],i[n+2]=t[2],i},setDefaultType:function(e){let t=I;return I=e,t},setTranslation:function(e,t,r){return e!==(r=r||L())&&(r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[8]=e[8],r[9]=e[9],r[10]=e[10],r[11]=e[11]),r[12]=t[0],r[13]=t[1],r[14]=t[2],r[15]=1,r},transformDirection:_,transformNormal:function(e,t,r){r=r||E();let i=C(e),n=t[0],o=t[1],a=t[2];return r[0]=n*i[0]+o*i[1]+a*i[2],r[1]=n*i[4]+o*i[5]+a*i[6],r[2]=n*i[8]+o*i[9]+a*i[10],r},transformPoint:O,translate:function(e,t,r){r=r||new I(16);let i=t[0],n=t[1],o=t[2],a=e[0],s=e[1],l=e[2],h=e[3],c=e[4],u=e[5],d=e[6],m=e[7],p=e[8],f=e[9],b=e[10],g=e[11],v=e[12],y=e[13],w=e[14],x=e[15];return e!==r&&(r[0]=a,r[1]=s,r[2]=l,r[3]=h,r[4]=c,r[5]=u,r[6]=d,r[7]=m,r[8]=p,r[9]=f,r[10]=b,r[11]=g),r[12]=a*i+c*n+p*o+v,r[13]=s*i+u*n+f*o+y,r[14]=l*i+d*n+b*o+w,r[15]=h*i+m*n+g*o+x,r},translation:function(e,t){return(t=t||new I(16))[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},transpose:function(e,t){if((t=t||new I(16))===e){let r;return r=e[1],e[1]=e[4],e[4]=r,r=e[2],e[2]=e[8],e[8]=r,r=e[3],e[3]=e[12],e[12]=r,r=e[6],e[6]=e[9],e[9]=r,r=e[7],e[7]=e[13],e[13]=r,r=e[11],e[11]=e[14],e[14]=r,t}let r=e[0],i=e[1],n=e[2],o=e[3],a=e[4],s=e[5],l=e[6],h=e[7],c=e[8],u=e[9],d=e[10],m=e[11],p=e[12],f=e[13],b=e[14],g=e[15];return t[0]=r,t[1]=a,t[2]=c,t[3]=p,t[4]=i,t[5]=s,t[6]=u,t[7]=f,t[8]=n,t[9]=l,t[10]=d,t[11]=b,t[12]=o,t[13]=h,t[14]=m,t[15]=g,t}});let D={};function z(e){if(e instanceof Int8Array)return 5120;if(e instanceof Uint8Array||e instanceof Uint8ClampedArray)return 5121;if(e instanceof Int16Array)return 5122;if(e instanceof Uint16Array)return 5123;if(e instanceof Int32Array)return 5124;if(e instanceof Uint32Array)return 5125;if(e instanceof Float32Array)return 5126;throw Error("unsupported typed array type")}function j(e){if(e===Int8Array)return 5120;if(e===Uint8Array||e===Uint8ClampedArray)return 5121;if(e===Int16Array)return 5122;if(e===Uint16Array)return 5123;if(e===Int32Array)return 5124;if(e===Uint32Array)return 5125;if(e===Float32Array)return 5126;throw Error("unsupported typed array type")}function U(e){let t=D[e];if(!t)throw Error("unknown gl type");return t}D[5120]=Int8Array,D[5121]=Uint8Array,D[5122]=Int16Array,D[5123]=Uint16Array,D[5124]=Int32Array,D[5125]=Uint32Array,D[5126]=Float32Array,D[32819]=Uint16Array,D[32820]=Uint16Array,D[33635]=Uint16Array,D[5131]=Uint16Array,D[33640]=Uint32Array,D[35899]=Uint32Array,D[35902]=Uint32Array,D[36269]=Uint32Array,D[34042]=Uint32Array;let B="u">typeof SharedArrayBuffer?function(e){return e&&e.buffer&&(e.buffer instanceof ArrayBuffer||e.buffer instanceof SharedArrayBuffer)}:function(e){return e&&e.buffer&&e.buffer instanceof ArrayBuffer};function $(e,t){Object.keys(t).forEach(function(r){t.hasOwnProperty(r)&&e.hasOwnProperty(r)&&(t[r]=e[r])})}function q(...e){console.error(...e)}let G=new Map;function H(e,t){if(!e||"object"!=typeof e)return!1;let r=G.get(t);r||(r=new WeakMap,G.set(t,r));let i=r.get(e);if(void 0===i){let n=Object.prototype.toString.call(e);i=n.substring(8,n.length-1)===t,r.set(e,i)}return i}function N(e,t){return"u">typeof WebGLTexture&&H(t,"WebGLTexture")}let W={attribPrefix:""};function X(e,t,r,i){var n;if("u">typeof WebGLBuffer&&H(t,"WebGLBuffer"))return t;r=r||34962;let o=e.createBuffer();return n=r,e.bindBuffer(n,o),e.bufferData(n,t,i||35044),o}function Y(e){return"indices"===e}function Q(e){return e.length?e:e.data}let Z=/coord|texture/i,J=/color|colour/i;function K(e,t,r){return e.numComponents||e.size||function(e,t){let r;if(t%(r=Z.test(e)?2:J.test(e)?4:3)>0)throw Error(`Can not guess numComponents for attribute '${e}'. Tried ${r} but ${t} values is not evenly divisible by ${r}. You should specify it.`);return r}(t,r||Q(e).length)}function ee(e,t){if(B(e))return e;if(B(e.data))return e.data;Array.isArray(e)&&(e={data:e});let r=e.type?et(e.type):void 0;return r||(r=Y(t)?Uint16Array:Float32Array),new r(e.data)}function et(e){return"number"==typeof e?U(e):e||Float32Array}function er(e,t){var r;return{buffer:t.buffer,numValues:24,type:"number"==typeof(r=t.type)?r:r?j(r):5126,arrayType:et(t.type)}}function ei(e,t){let r=t.data||t,i=et(t.type),n=r*i.BYTES_PER_ELEMENT,o=e.createBuffer();return e.bindBuffer(34962,o),e.bufferData(34962,n,t.drawType||35044),{buffer:o,num
1Values:r,type:j(i),arrayType:i}}function en(e,t,r){let i=ee(t,r);return{arrayType:i.constructor,buffer:X(e,i,void 0,t.drawType),type:z(i),numValues:0}}let eo=["position","positions","a_position"];function ea(e,t){let r=0;return e.push=function(){for(let t=0;t<arguments.length;++t){let i=arguments[t];if(i instanceof Array||B(i))for(let t=0;t<i.length;++t)e[r++]=i[t];else e[r++]=i}},e.reset=function(e){r=e||0},e.numComponents=t,Object.defineProperty(e,"numElements",{get:function(){return this.length/this.numComponents|0}}),e}function es(e,t,r){return ea(new(r||Float32Array)(e*t),e)}function el(e){return"indices"!==e}function eh(e,t,r){let i=e.length,n=new Float32Array(3);for(let o=0;o<i;o+=3)r(t,[e[o],e[o+1],e[o+2]],n),e[o]=n[0],e[o+1]=n[1],e[o+2]=n[2]}function ec(e,t,r){r=r||E();let i=t[0],n=t[1],o=t[2];return r[0]=i*e[0]+n*e[1]+o*e[2],r[1]=i*e[4]+n*e[5]+o*e[6],r[2]=i*e[8]+n*e[9]+o*e[10],r}function eu(e,t){return eh(e,t,_),e}function ed(e,t){return eh(e,C(t),ec),e}function em(e,t){return eh(e,t,O),e}function ep(e,t){return Object.keys(e).forEach(function(r){let i=e[r];r.indexOf("pos")>=0?em(i,t):r.indexOf("tan")>=0||r.indexOf("binorm")>=0?eu(i,t):r.indexOf("norm")>=0&&ed(i,t)}),e}function ef(e,t,r){return{position:{numComponents:2,data:[(t=t||0)+-1*(e=.5*(e||2)),(r=r||0)+-1*e,t+ +e,r+-1*e,t+-1*e,r+ +e,t+ +e,r+ +e]},normal:[0,0,1,0,0,1,0,0,1,0,0,1],texcoord:[0,0,1,0,0,1,1,1],indices:[0,1,2,2,1,3]}}function eb(e,t,r,i,n){e=e||1,t=t||1,r=r||1,i=i||1,n=n||L();let o=(r+1)*(i+1),a=es(3,o),s=es(3,o),l=es(2,o);for(let n=0;n<=i;n++)for(let o=0;o<=r;o++){let h=o/r,c=n/i;a.push(e*h-.5*e,0,t*c-.5*t),s.push(0,1,0),l.push(h,c)}let h=r+1,c=es(3,r*i*2,Uint16Array);for(let e=0;e<i;e++)for(let t=0;t<r;t++)c.push((e+0)*h+t,(e+1)*h+t,(e+0)*h+t+1),c.push((e+1)*h+t,(e+1)*h+t+1,(e+0)*h+t+1);return ep({position:a,normal:s,texcoord:l,indices:c},n)}function eg(e,t,r,i,n,o,a){if(t<=0||r<=0)throw Error("subdivisionAxis and subdivisionHeight must be > 0");i=i||0,o=o||0;let s=(n=n||Math.PI)-i,l=(a=a||2*Math.PI)-o,h=(t+1)*(r+1),c=es(3,h),u=es(3,h),d=es(2,h);for(let n=0;n<=r;n++)for(let a=0;a<=t;a++){let h=a/t,m=n/r,p=l*h+o,f=s*m+i,b=Math.sin(p),g=Math.sin(f),v=Math.cos(f),y=Math.cos(p)*g,w=b*g;c.push(e*y,e*v,e*w),u.push(y,v,w),d.push(1-h,m)}let m=t+1,p=es(3,t*r*2,Uint16Array);for(let e=0;e<t;e++)for(let t=0;t<r;t++)p.push((t+0)*m+e,(t+0)*m+e+1,(t+1)*m+e),p.push((t+1)*m+e,(t+0)*m+e+1,(t+1)*m+e+1);return{position:c,normal:u,texcoord:d,indices:p}}let ev=[[3,7,5,1],[6,2,0,4],[6,7,3,2],[0,1,5,4],[7,6,4,5],[2,3,1,0]];function ey(e){let t=(e=e||1)/2,r=[[-t,-t,-t],[+t,-t,-t],[-t,+t,-t],[+t,+t,-t],[-t,-t,+t],[+t,-t,+t],[-t,+t,+t],[+t,+t,+t]],i=[[1,0,0],[-1,0,0],[0,1,0],[0,-1,0],[0,0,1],[0,0,-1]],n=[[1,0],[0,0],[0,1],[1,1]],o=es(3,24),a=es(3,24),s=es(2,24),l=es(3,12,Uint16Array);for(let e=0;e<6;++e){let t=ev[e];for(let l=0;l<4;++l){let h=r[t[l]],c=i[e],u=n[l];o.push(h),a.push(c),s.push(u)}let h=4*e;l.push(h+0,h+1,h+2),l.push(h+0,h+2,h+3)}return{position:o,normal:a,texcoord:s,indices:l}}function ew(e,t,r,i,n,o,a){if(i<3)throw Error("radialSubdivisions must be 3 or greater");if(n<1)throw Error("verticalSubdivisions must be 1 or greater");let s=void 0===o||o,l=void 0===a||a,h=2*!!s+2*!!l,c=(i+1)*(n+1+h),u=es(3,c),d=es(3,c),m=es(2,c),p=es(3,i*(n+h/2)*2,Uint16Array),f=i+1,b=Math.atan2(e-t,r),g=Math.cos(b),v=Math.sin(b),y=s?-2:0,w=n+2*!!l;for(let o=y;o<=w;++o){let a,s=o/n,l=r*s;o<0?(l=0,s=1,a=e):o>n?(l=r,s=1,a=t):a=e+o/n*(t-e),(-2===o||o===n+2)&&(a=0,s=0),l-=r/2;for(let e=0;e<f;++e){let t=Math.sin(e*Math.PI*2/i),r=Math.cos(e*Math.PI*2/i);u.push(t*a,l,r*a),o<0?d.push(0,-1,0):o>n?d.push(0,1,0):0===a?d.push(0,0,0):d.push(t*g,v,r*g),m.push(e/i,1-s)}}for(let e=0;e<n+h;++e)if((1!==e||!s)&&(e!==n+h-2||!l))for(let t=0;t<i;++t)p.push(f*(e+0)+0+t,f*(e+0)+1+t,f*(e+1)+1+t),p.push(f*(e+0)+0+t,f*(e+1)+1+t,f*(e+1)+0+t);return{position:u,normal:d,texcoord:m,indices:p}}function ex(e,t){t=t||[];let r=[];for(let i=0;i<e.length;i+=4){let n=e[i],o=e.slice(i+1,i+4);o.push.apply(o,t);for(let e=0;e<n;++e)r.push.apply(r,o)}return r}function eF(){let e=[0,0,0,0,150,0,30,0,0,0,150,0,30,150,0,30,0,0,30,0,0,30,30,0,100,0,0,30,30,0,100,30,0,100,0,0,30,60,0,30,90,0,67,60,0,30,90,0,67,90,0,67,60,0,0,0,30,30,0,30,0,150,30,0,150,30,30,0,30,30,150,30,30,0,30,100,0,30,30,30,30,30,30,30,100,0,30,100,30,30,30,60,30,67,60,30,30,90,30,30,90,30,67,60,30,67,90,30,0,0,0,100,0,0,100,0,30,0,0,0,100,0,30,0,0,30,100,0,0,100,30,0,100,30,30,100,0,0,100,30,30,100,0,30,30,30,0,30,30,30,100,30,30,30,30,0,100,30,30,100,30,0,30,30,0,30,60,30,30,30,30,30,30,0,30,60,0,30,60,30,30,60,0,67,60,30,30,60,30,30,60,0,67,60,0,67,60,30,67,60,0,67,90,30,67,60,30,67,60,0,67,90,0,67,90,30,30,90,0,30,90,30,67,90,30,30,90,0,67,90,30,67,90,0,30,90,0,30,150,30,30,90,30,30,90,0,30,150,0,30,150,30,0,150,0,0,150,30,30,150,30,0,150,0,30,150,30,30,150,0,0,0,0,0,0,30,0,150,30,0,0,0,0,150,30,0,150,0],t=ex([18,0,0,1,18,0,0,-1,6,0,1,0,6,1,0,0,6,0,-1,0,6,1,0,0,6,0,1,0,6,1,0,0,6,0,-1,0,6,1,0,0,6,0,-1,0,6,-1,0,0]),r=ex([18,200,70,120,18,80,70,200,6,70,200,210,6,200,200,70,6,210,100,70,6,210,160,70,6,70,180,210,6,100,70,210,6,76,210,100,6,140,210,80,6,90,130,110,6,160,160,220],[255]),i=e.length/3,n={position:es(3,i),texcoord:es(2,i),normal:es(3,i),color:es(4,i,Uint8Array),indices:es(3,i/3,Uint16Array)};n.position.push(e),n.texcoord.push([.22,.19,.22,.79,.34,.19,.22,.79,.34,.79,.34,.19,.34,.19,.34,.31,.62,.19,.34,.31,.62,.31,.62,.19,.34,.43,.34,.55,.49,.43,.34,.55,.49,.55,.49,.43,0,0,1,0,0,1,0,1,1,0,1,1,0,0,1,0,0,1,0,1,1,0,1,1,0,0,1,0,0,1,0,1,1,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,0,1,1,1,0,0,1,1,1,0,0,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,0,0,1,1,1,0,0,1,1,1,0,0,0,1,1,0,1,0,0,1,0,1,1,0,0,0,1,1,1,0,0,1,1,1,0,0,0,0,1,1,1,0,0,1,1,1,0]),n.normal.push(t),n.color.push(r);for(let e=0;e<i;++e)n.indices.push(e);return n}function eE(e,t,r,i,n,o,a){if(n<=0)throw Error("subdivisionDown must be > 0");o=o||0;let s=(a=a||1)-o,l=(n+1)*8,h=es(3,l),c=es(3,l),u=es(2,l);function d(t,r,a,l,d,m){for(let p=0;p<=n;p++){let f=r/1,b=p/n,g=(o+b*s)*Math.PI,v=Math.sin(g),y=Math.cos(g),w=e+(t-e)*v,x=(f-.5)*2*i,F=y*e,E=v*w;h.push(x,F,E);let M=P(R([0,v,y],a),l);c.push(M),u.push(f*d+m,b)}}for(let e=0;e<2;e++){let i=(e/1-.5)*2;d(t,e,[1,1,1],[0,0,0],1,0),d(t,e,[0,0,0],[i,0,0],0,0),d(r,e,[1,1,1],[0,0,0],1,0),d(r,e,[0,0,0],[i,0,0],0,1)}let m=es(3,2*n*4,Uint16Array);function p(e,t){for(let r=0;r<n;++r)m.push(e+r+0,e+r+1,t+r+0),m.push(e+r+1,t+r+1,t+r+0)}let f=n+1;return p(0*f,4*f),p(5*f,7*f),p(6*f,2*f),p(3*f,+f),{position:h,normal:c,texcoord:u,indices:m}}function eP(e,t,r,i,n,o){return ew(e,e,t,r,i,n,o)}function eM(e,t,r,i,n,o){if(r<3)throw Error("radialSubdivisions must be 3 or greater");if(i<3)throw Error("verticalSubdivisions must be 3 or greater");n=n||0;let a=(o=o||2*Math.PI)-n,s=r+1,l=i+1,h=s*l,c=es(3,h),u=es(3,h),d=es(2,h),m=es(3,r*i*2,Uint16Array);for(let o=0;o<l;++o){let l=o/i,h=l*Math.PI*2,m=Math.sin(h),p=e+m*t,f=Math.cos(h),b=f*t;for(let e=0;e<s;++e){let t=e/r,i=n+t*a,o=Math.sin(i),s=Math.cos(i),h=o*p,g=s*p,v=o*m,y=s*m;c.push(h,b,g),u.push(v,f,y),d.push(t,1-l)}}for(let e=0;e<i;++e)for(let t=0;t<r;++t){let r=1+t,i=1+e;m.push(s*e+t,s*i+t,s*e+r),m.push(s*i+t,s*i+r,s*e+r)}return{position:c,normal:u,texcoord:d,indices:m}}function eA(e,t,r,i,n){if(t<3)throw Error("divisions must be at least 3");n=n||1,i=i||0;let o=(t+1)*((r=r||1)+1),a=es(3,o),s=es(3,o),l=es(2,o),h=es(3,r*t*2,Uint16Array),c=0,u=e-i,d=t+1;for(let e=0;e<=r;++e){let o=i+u*Math.pow(e/r,n);for(let i=0;i<=t;++i){let n=2*Math.PI*i/t,u=o*Math.cos(n),m=o*Math.sin(n);if(a.push(u,0,m),s.push(0,1,0),l.push(1-i/t,e/r),e>0&&i!==t){let e=c+(i+1),t=c+i,r=c+i-d,n=c+(i+1)-d;h.push(e,t,r),h.push(e,r,n)}}c+=t+1}return{position:a,normal:s,texcoord:l,indices:h}}function eS(e){return function(t){let r,i=e.apply(this,Array.prototype.slice.call(arguments,1
1));return r={},Object.keys(i).forEach(function(e){var n;let o;r[e]=(n=i[e],o="indices"===e?34963:34962,X(t,ee(n,e),o))}),i.indices?(r.numElements=i.indices.length,r.elementType=z(ee(i.indices))):r.numElements=function(e){let t,r;for(r=0;r<eo.length&&!((t=eo[r])in e);++r);r===eo.length&&(t=Object.keys(e)[0]);let i=e[t],n=Q(i).length;if(void 0===n)return 1;let o=K(i,t);if(n%o>0)throw Error(`numComponents ${o} not correct for length ${n}`);return n/o}(i),r}}function eR(e){return function(t){let r=e.apply(null,Array.prototype.slice.call(arguments,1));return function(e,t){let r,i=(r={},Object.keys(t).forEach(function(i){if(!Y(i)){let n=t[i],o=n.attrib||n.name||n.attribName||W.attribPrefix+i;if(n.value){if(!Array.isArray(n.value)&&!B(n.value))throw Error("array.value is not array or typedarray");r[o]={value:n.value}}else{let{buffer:t,type:a,numValues:s,arrayType:l}=(n.buffer&&n.buffer instanceof WebGLBuffer?er:"number"==typeof n||"number"==typeof n.data?ei:en)(e,n,i),h=void 0!==n.normalize?n.normalize:l===Int8Array||l===Uint8Array,c=K(n,i,s);r[o]={buffer:t,numComponents:c,type:a,normalize:h,stride:n.stride||0,offset:n.offset||0,divisor:void 0===n.divisor?void 0:n.divisor,drawType:n.drawType}}}}),e.bindBuffer(34962,null),r),n=Object.assign({},{});n.attribs=Object.assign({},{},i);let o=t.indices;if(o){let t=ee(o,"indices");n.indices=X(e,t,34963),n.numElements=t.length,n.elementType=z(t)}else n.numElements||(n.numElements=function(e,t){var r;let i,n;for(n=0;n<eo.length&&!((i=eo[n])in t)&&!((i=W.attribPrefix+i)in t);++n);n===eo.length&&(i=Object.keys(t)[0]);let o=t[i];if(!o.buffer)return 1;e.bindBuffer(34962,o.buffer);let a=e.getBufferParameter(34962,34660);e.bindBuffer(34962,null);let s=5120===(r=o.type)||5121===r?1:5122===r||5123===r?2:4*(5124===r||5125===r||5126===r),l=o.numComponents||o.size,h=a/s/l;if(h%1!=0)throw Error(`numComponents ${l} not correct for length ${length}`);return h}(e,n.attribs));return n}(t,r)}}let eT=["numComponents","size","type","normalize","stride","offset","attrib","name","attribName"];function eI(e,t,r,i){i=i||0;let n=e.length;for(let o=0;o<n;++o)t[r+o]=e[o]+i}function ek(e,t){let r=Q(e),i=new r.constructor(t),n=i;if(r.numComponents&&r.numElements&&ea(i,r.numComponents),e.data){var o;o=n={data:i},eT.forEach(function(t){let r=e[t];void 0!==r&&(o[t]=r)})}return n}let eL=eR(eF),eC=eS(eF),eO=eR(ey),e_=eS(ey),eV=eR(eb),eD=eS(eb),ez=eR(eg),ej=eS(eg),eU=eR(ew),eB=eS(ew),e$=eR(ef),eq=eS(ef),eG=eR(eE),eH=eS(eE);var eN=Object.freeze({__proto__:null,create3DFBufferInfo:eL,create3DFBuffers:eC,create3DFVertices:eF,createAugmentedTypedArray:es,createCubeBufferInfo:eO,createCubeBuffers:e_,createCubeVertices:ey,createPlaneBufferInfo:eV,createPlaneBuffers:eD,createPlaneVertices:eb,createSphereBufferInfo:ez,createSphereBuffers:ej,createSphereVertices:eg,createTruncatedConeBufferInfo:eU,createTruncatedConeBuffers:eB,createTruncatedConeVertices:ew,createXYQuadBufferInfo:e$,createXYQuadBuffers:eq,createXYQuadVertices:ef,createCresentBufferInfo:eG,createCresentBuffers:eH,createCresentVertices:eE,createCrescentBufferInfo:eG,createCrescentBuffers:eH,createCrescentVertices:eE,createCylinderBufferInfo:eR(eP),createCylinderBuffers:eS(eP),createCylinderVertices:eP,createTorusBufferInfo:eR(eM),createTorusBuffers:eS(eM),createTorusVertices:eM,createDiscBufferInfo:eR(eA),createDiscBuffers:eS(eA),createDiscVertices:eA,deindexVertices:function(e){let t=e.indices,r={},i=t.length;return Object.keys(e).filter(el).forEach(function(n){let o=e[n],a=o.numComponents,s=es(a,i,o.constructor);for(let e=0;e<i;++e){let r=t[e]*a;for(let e=0;e<a;++e)s.push(o[r+e])}r[n]=s}),r},flattenNormals:function(e){if(e.indices)throw Error("can not flatten normals of indexed vertices. deindex them first");let t=e.normal,r=t.length;for(let e=0;e<r;e+=9){let r=t[e+0],i=t[e+1],n=t[e+2],o=t[e+3],a=t[e+4],s=t[e+5],l=t[e+6],h=t[e+7],c=t[e+8],u=r+o+l,d=i+a+h,m=n+s+c,p=Math.sqrt(u*u+d*d+m*m);u/=p,d/=p,m/=p,t[e+0]=u,t[e+1]=d,t[e+2]=m,t[e+3]=u,t[e+4]=d,t[e+5]=m,t[e+6]=u,t[e+7]=d,t[e+8]=m}return e},makeRandomVertexColors:function(e,t){t=t||{};let r=e.position.numElements,i=es(4,r,Uint8Array),n=t.rand||function(e,t){return t<3?256*Math.random()|0:255};if(e.color=i,e.indices)for(let e=0;e<r;++e)i.push(n(e,0),n(e,1),n(e,2),n(e,3));else{let e=t.vertsPerColor||3,o=r/e;for(let t=0;t<o;++t){let r=[n(t,0),n(t,1),n(t,2),n(t,3)];for(let t=0;t<e;++t)i.push(r)}}return e},reorientDirections:eu,reorientNormals:ed,reorientPositions:em,reorientVertices:ep,concatVertices:function(e){let t,r={};for(let i=0;i<e.length;++i){let n=e[i];
1Object.keys(n).forEach(function(e){r[e]||(r[e]=[]),t||"indices"===e||(t=e);let i=n[e],o=K(i,e),a=Q(i).length/o;r[e].push(a)})}let i=r[t],n={};return Object.keys(r).forEach(function(t){let r=function(t){let r,i=0;for(let n=0;n<e.length;++n){let o=e[n][t];i+=Q(o).length,(!r||o.data)&&(r=o)}return{length:i,spec:r}}(t),o=ek(r.spec,r.length);!function(t,r,i){let n=0,o=0;for(let a=0;a<e.length;++a){let s=Q(e[a][t]);"indices"===t?(eI(s,i,o,n),n+=r[a]):eI(s,i,o),o+=s.length}}(t,i,Q(o)),n[t]=o}),n},duplicateVertices:function(e){let t={};return Object.keys(e).forEach(function(r){let i=e[r],n=Q(i),o=ek(i,n.length);eI(n,Q(o),0),t[r]=o}),t}});function eW(e){return!!e.texStorage2D}let eX=(s={},l={},function(e,t){let r=e.constructor.name;if(!s[r]){for(let t in e)if("number"==typeof e[t]){let r=l[e[t]];l[e[t]]=r?`${r} | ${t}`:t}s[r]=!0}return l[t]||("number"==typeof t?`0x${t.toString(16)}`:t)}),eY,eQ={textureColor:new Uint8Array([128,192,255,255]),textureOptions:{},crossOrigin:void 0},eZ=function(){return h=h||("u">typeof document&&document.createElement?document.createElement("canvas").getContext("2d"):null)};{let e={};e[6406]={numColorComponents:1},e[6409]={numColorComponents:1},e[6410]={numColorComponents:2},e[6407]={numColorComponents:3},e[6408]={numColorComponents:4},e[6403]={numColorComponents:1},e[36244]={numColorComponents:1},e[33319]={numColorComponents:2},e[33320]={numColorComponents:2},e[6407]={numColorComponents:3},e[36248]={numColorComponents:3},e[6408]={numColorComponents:4},e[36249]={numColorComponents:4},e[6402]={numColorComponents:1},e[34041]={numColorComponents:2}}function eJ(e){if(!a){let e={};e[6406]={textureFormat:6406,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[1,2,2,4],type:[5121,5131,36193,5126]},e[6409]={textureFormat:6409,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[1,2,2,4],type:[5121,5131,36193,5126]},e[6410]={textureFormat:6410,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[2,4,4,8],type:[5121,5131,36193,5126]},e[6407]={textureFormat:6407,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[3,6,6,12,2],type:[5121,5131,36193,5126,33635]},e[6408]={textureFormat:6408,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[4,8,8,16,2,2],type:[5121,5131,36193,5126,32819,32820]},e[6402]={textureFormat:6402,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[2,4],type:[5125,5123]},e[33321]={textureFormat:6403,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[1],type:[5121]},e[36756]={textureFormat:6403,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[1],type:[5120]},e[33325]={textureFormat:6403,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[4,2],type:[5126,5131]},e[33326]={textureFormat:6403,colorRenderable:!1,textureFilterable:!1,bytesPerElement:[4],type:[5126]},e[33330]={textureFormat:36244,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[1],type:[5121]},e[33329]={textureFormat:36244,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[1],type:[5120]},e[33332]={textureFormat:36244,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[2],type:[5123]},e[33331]={textureFormat:36244,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[2],type:[5122]},e[33334]={textureFormat:36244,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[4],type:[5125]},e[33333]={textureFormat:36244,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[4],type:[5124]},e[33323]={textureFormat:33319,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[2],type:[5121]},e[36757]={textureFormat:33319,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[2],type:[5120]},e[33327]={textureFormat:33319,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[8,4],type:[5126,5131]},e[33328]={textureFormat:33319,colorRenderable:!1,textureFilterable:!1,bytesPerElement:[8],type:[5126]},e[33336]={textureFormat:33320,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[2],type:[5121]},e[33335]={textureFormat:33320,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[2],type:[5120]},e[33338]={textureFormat:33320,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[4],type:[5123]}
1,e[33337]={textureFormat:33320,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[4],type:[5122]},e[33340]={textureFormat:33320,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[8],type:[5125]},e[33339]={textureFormat:33320,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[8],type:[5124]},e[32849]={textureFormat:6407,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[3],type:[5121]},e[35905]={textureFormat:6407,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[3],type:[5121]},e[36194]={textureFormat:6407,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[3,2],type:[5121,33635]},e[36758]={textureFormat:6407,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[3],type:[5120]},e[35898]={textureFormat:6407,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[12,6,4],type:[5126,5131,35899]},e[35901]={textureFormat:6407,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[12,6,4],type:[5126,5131,35902]},e[34843]={textureFormat:6407,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[12,6],type:[5126,5131]},e[34837]={textureFormat:6407,colorRenderable:!1,textureFilterable:!1,bytesPerElement:[12],type:[5126]},e[36221]={textureFormat:36248,colorRenderable:!1,textureFilterable:!1,bytesPerElement:[3],type:[5121]},e[36239]={textureFormat:36248,colorRenderable:!1,textureFilterable:!1,bytesPerElement:[3],type:[5120]},e[36215]={textureFormat:36248,colorRenderable:!1,textureFilterable:!1,bytesPerElement:[6],type:[5123]},e[36233]={textureFormat:36248,colorRenderable:!1,textureFilterable:!1,bytesPerElement:[6],type:[5122]},e[36209]={textureFormat:36248,colorRenderable:!1,textureFilterable:!1,bytesPerElement:[12],type:[5125]},e[36227]={textureFormat:36248,colorRenderable:!1,textureFilterable:!1,bytesPerElement:[12],type:[5124]},e[32856]={textureFormat:6408,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[4],type:[5121]},e[35907]={textureFormat:6408,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[4],type:[5121]},e[36759]={textureFormat:6408,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[4],type:[5120]},e[32855]={textureFormat:6408,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[4,2,4],type:[5121,32820,33640]},e[32854]={textureFormat:6408,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[4,2],type:[5121,32819]},e[32857]={textureFormat:6408,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[4],type:[33640]},e[34842]={textureFormat:6408,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[16,8],type:[5126,5131]},e[34836]={textureFormat:6408,colorRenderable:!1,textureFilterable:!1,bytesPerElement:[16],type:[5126]},e[36220]={textureFormat:36249,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[4],type:[5121]},e[36238]={textureFormat:36249,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[4],type:[5120]},e[36975]={textureFormat:36249,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[4],type:[33640]},e[36214]={textureFormat:36249,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[8],type:[5123]},e[36232]={textureFormat:36249,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[8],type:[5122]},e[36226]={textureFormat:36249,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[16],type:[5124]},e[36208]={textureFormat:36249,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[16],type:[5125]},e[33189]={textureFormat:6402,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[2,4],type:[5123,5125]},e[33190]={textureFormat:6402,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[4],type:[5125]},e[36012]={textureFormat:6402,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[4],type:[5126]}
1,e[35056]={textureFormat:34041,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[4],type:[34042]},e[36013]={textureFormat:34041,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[4],type:[36269]},Object.keys(e).forEach(function(t){let r=e[t];r.bytesPerElementMap={},r.bytesPerElement.forEach(function(e,t){let i=r.type[t];r.bytesPerElementMap[i]=e})});let t={bytes:8,width:4,height:4},r={bytes:16,width:4,height:4};e[33776]={textureFormat:33776,colorRenderable:!1,textureFilterable:!0,block:t},e[33777]={textureFormat:33777,colorRenderable:!1,textureFilterable:!0,block:t},e[33778]={textureFormat:33778,colorRenderable:!1,textureFilterable:!0,block:r},e[33779]={textureFormat:33779,colorRenderable:!1,textureFilterable:!0,block:r},e[35916]={textureFormat:35916,colorRenderable:!1,textureFilterable:!0,block:t},e[35917]={textureFormat:35917,colorRenderable:!1,textureFilterable:!0,block:t},e[35918]={textureFormat:35918,colorRenderable:!1,textureFilterable:!0,block:r},e[35919]={textureFormat:35919,colorRenderable:!1,textureFilterable:!0,block:r},e[36196]={textureFormat:36196,colorRenderable:!1,textureFilterable:!0,block:t},e[37488]={textureFormat:37488,colorRenderable:!1,textureFilterable:!0,block:t},e[37489]={textureFormat:37489,colorRenderable:!1,textureFilterable:!0,block:t},e[37490]={textureFormat:37490,colorRenderable:!1,textureFilterable:!0,block:r},e[37491]={textureFormat:37491,colorRenderable:!1,textureFilterable:!0,block:r},e[37492]={textureFormat:37492,colorRenderable:!1,textureFilterable:!0,block:t},e[37493]={textureFormat:37493,colorRenderable:!1,textureFilterable:!0,block:t},e[37494]={textureFormat:37494,colorRenderable:!1,textureFilterable:!0,block:t},e[37495]={textureFormat:37495,colorRenderable:!1,textureFilterable:!0,block:t},e[37496]={textureFormat:37496,colorRenderable:!1,textureFilterable:!0,block:r},e[37497]={textureFormat:37497,colorRenderable:!1,textureFilterable:!0,block:r},e[35840]={textureFormat:35840,colorRenderable:!1,textureFilterable:!0,block:{bytes:32,width:8,height:8}},e[35841]={textureFormat:35841,colorRenderable:!1,textureFilterable:!0,block:{bytes:32,width:16,height:8}},e[35842]={textureFormat:35842,colorRenderable:!1,textureFilterable:!0,block:{bytes:32,width:8,height:8}},e[35843]={textureFormat:35843,colorRenderable:!1,textureFilterable:!0,block:{bytes:32,width:16,height:8}},e[37808]={textureFormat:37808,colorRenderable:!1,textureFilterable:!0,block:{bytes:16,width:4,height:4}},e[37809]={textureFormat:37809,colorRenderable:!1,textureFilterable:!0,block:{bytes:16,width:5,height:4}},e[37810]={textureFormat:37810,colorRenderable:!1,textureFilterable:!0,block:{bytes:16,width:5,height:5}},e[37811]={textureFormat:37811,colorRenderable:!1,textureFilterable:!0,block:{bytes:16,width:6,height:5}},e[37812]={textureFormat:37812,colorRenderable:!1,textureFilterable:!0,block:{bytes:16,width:6,height:6}},e[37813]={textureFormat:37813,colorRenderable:!1,textureFilterable:!0,block:{bytes:16,width:8,height:5}},e[37814]={textureFormat:37814,colorRenderable:!1,textureFilterable:!0,block:{bytes:16,width:8,height:6}},e[37815]={textureFormat:37815,colorRenderable:!1,textureFilterable:!0,block:{bytes:16,width:8,height:8}},e[37816]={textureFormat:37816,colorRenderable:!1,textureFilterable:!0,block:{bytes:16,width:10,height:5}},e[37817]={textureFormat:37817,colorRenderable:!1,textureFilterable:!0,block:{bytes:16,width:10,height:6}},e[37818]={textureFormat:37818,colorRenderable:!1,textureFilterable:!0,block:{bytes:16,width:10,height:8}},e[37819]={textureFormat:37819,colorRenderable:!1,textureFilterable:!0,block:{bytes:16,width:10,height:10}},e[37820]={textureFormat:37820,colorRenderable:!1,textureFilterable:!0,block:{bytes:16,width:12,height:10}},e[37821]={textureFormat:37821,colorRenderable:!1,textureFilterable:!0,block:{bytes:16,width:12,height:12}},e[37840]={textureFormat:37840,colorRenderable:!1,textureFilterable:!0,block:{bytes:16,width:4,height:4}},e[37841]={textureFormat:37841,colorRenderable:!1,textureFilterable:!0,block:{bytes:16,width:5,height:4}},e[37842]={textureFormat:37842,colorRenderable:!1,textureFilterable:!0,block:{bytes:16,width:5,height:5}}
1,e[37843]={textureFormat:37843,colorRenderable:!1,textureFilterable:!0,block:{bytes:16,width:6,height:5}},e[37844]={textureFormat:37844,colorRenderable:!1,textureFilterable:!0,block:{bytes:16,width:6,height:6}},e[37845]={textureFormat:37845,colorRenderable:!1,textureFilterable:!0,block:{bytes:16,width:8,height:5}},e[37846]={textureFormat:37846,colorRenderable:!1,textureFilterable:!0,block:{bytes:16,width:8,height:6}},e[37847]={textureFormat:37847,colorRenderable:!1,textureFilterable:!0,block:{bytes:16,width:8,height:8}},e[37848]={textureFormat:37848,colorRenderable:!1,textureFilterable:!0,block:{bytes:16,width:10,height:5}},e[37849]={textureFormat:37849,colorRenderable:!1,textureFilterable:!0,block:{bytes:16,width:10,height:6}},e[37850]={textureFormat:37850,colorRenderable:!1,textureFilterable:!0,block:{bytes:16,width:10,height:8}},e[37851]={textureFormat:37851,colorRenderable:!1,textureFilterable:!0,block:{bytes:16,width:10,height:10}},e[37852]={textureFormat:37852,colorRenderable:!1,textureFilterable:!0,block:{bytes:16,width:12,height:10}},e[37853]={textureFormat:37853,colorRenderable:!1,textureFilterable:!0,block:{bytes:16,width:12,height:12}},e[36492]={textureFormat:36492,colorRenderable:!1,textureFilterable:!0,block:r},e[36493]={textureFormat:36493,colorRenderable:!1,textureFilterable:!0,block:r},e[36494]={textureFormat:36494,colorRenderable:!1,textureFilterable:!0,block:r},e[36495]={textureFormat:36495,colorRenderable:!1,textureFilterable:!0,block:r},e[36283]={textureFormat:36283,colorRenderable:!1,textureFilterable:!0,block:t},e[36284]={textureFormat:36284,colorRenderable:!1,textureFilterable:!0,block:t},e[36285]={textureFormat:36285,colorRenderable:!1,textureFilterable:!0,block:t}
1,e[36286]={textureFormat:36286,colorRenderable:!1,textureFilterable:!0,block:t},a=e}let t=a[e];if(!t)throw Error("unknown internal format");return t}function eK(e,t){let r=eJ(e).bytesPerElementMap[t];if(void 0===r)throw Error("type not supported for internal format");return r}function e0(e){let t=eJ(e);if(!t)throw Error("unknown internal format");return{format:t.textureFormat,type:t.type?.[0]??5121}}function e1(e){return!!eJ(e).block}function e3(e){return eJ(e).textureFilterable}function e2(e,t,r,i,n){if(n%1!=0)throw Error("can't guess dimensions");if(r||i){if(i){if(!r&&(r=n/i)%1)throw Error("can't guess dimensions")}else if((i=n/r)%1)throw Error("can't guess dimensions")}else{let e=Math.sqrt(n/(34067===t?6:1));e%1==0?(r=e,i=e):(r=n,i=1)}return{width:r,height:i}}function e6(e,t,r){let i,n,o;void 0!==t.colorspaceConversion&&(i=e.getParameter(37443),e.pixelStorei(37443,t.colorspaceConversion)),void 0!==t.premultiplyAlpha&&(n=e.getParameter(37441),e.pixelStorei(37441,t.premultiplyAlpha)),void 0!==t.flipY&&(o=e.getParameter(37440),e.pixelStorei(37440,t.flipY)),r(),void 0!==i&&e.pixelStorei(37443,i),void 0!==n&&e.pixelStorei(37441,n),void 0!==o&&e.pixelStorei(37440,o)}function e4(e,t,r,i){let n=t[r];return{[r]:void 0===n?e.getParameter(i):n}}function e5(e,t){return{...t,...e4(e,t,"flipY",37440),...e4(e,t,"premultiplyAlpha",37441),...e4(e,t,"colorspaceConversion",37443)}}function e8(e){e.pixelStorei(3317,4),eW(e)&&(e.pixelStorei(3314,0),e.pixelStorei(32878,0),e.pixelStorei(3316,0),e.pixelStorei(3315,0),e.pixelStorei(32877,0))}function e7(e,t,r){let i=r.target||3553;e.bindTexture(i,t);var n=e.texParameteri;r.minMag&&(n.call(e,i,10241,r.minMag),n.call(e,i,10240,r.minMag)),r.min&&n.call(e,i,10241,r.min),r.mag&&n.call(e,i,10240,r.mag),r.wrap&&(n.call(e,i,10242,r.wrap),n.call(e,i,10243,r.wrap),(32879===i||"u">typeof WebGLSampler&&H(i,"WebGLSampler"))&&n.call(e,i,32882,r.wrap)),r.wrapR&&n.call(e,i,32882,r.wrapR),r.wrapS&&n.call(e,i,10242,r.wrapS),r.wrapT&&n.call(e,i,10243,r.wrapT),void 0!==r.minLod&&n.call(e,i,33082,r.minLod),void 0!==r.maxLod&&n.call(e,i,33083,r.maxLod),void 0!==r.baseLevel&&n.call(e,i,33084,r.baseLevel),void 0!==r.maxLevel&&n.call(e,i,33085,r.maxLevel),void 0!==r.compareFunc&&n.call(e,i,34893,r.compareFunc),void 0!==r.compareMode&&n.call(e,i,34892,r.compareMode)}function e9(e,t,{options:r,width:i,height:n,internalFormat:o,lastMipLevelUploaded:a}){r=r||eQ.textureOptions,o=o||6408;let s=r.target||3553;if(i=i||r.width,n=n||r.height,e.bindTexture(s,t),a>1){let t=Math.max(1,i>>a),r=Math.max(1,n>>a),l=e3(o)?9729:9728,h=e3(o)?1===t&&1===r?9986:9729:9728;e.texParameteri(s,10240,l),e.texParameteri(s,10241,h)}else if(function(e,t,r,i){if(!eW(e))return(t&t-1)==0&&(r&r-1)==0;let n=eJ(i);return n.colorRenderable&&n.textureFilterable}(e,i,n,o))e.generateMipmap(s);else{let t=e3(o)?9729:9728;e.texParameteri(s,10241,t),e.texParameteri(s,10240,t),e.texParameteri(s,10242,33071),e.texParameteri(s,10243,33071)}}function te(e,t,r,i,n,o){e9(e,t,{options:r,width:i,height:n,internalFormat:o})}function tt(e){return!0===e.auto||void 0===e.auto&&void 0===e.level}function tr(e,t){return(t=t||{}).cubeFaceOrder||[34069,34070,34071,34072,34073,34074]}function ti(e,t){let r=tr(e,t).map(function(e,t){return{face:e,ndx:t}});return r.sort(function(e,t){return e.face-t.face}),r}function tn(e,t,r,i){let n=(i=i||eQ.textureOptions).target||3553,o=i.level||0,a=r.width,s=r.height,l=i.internalFormat||i.format||6408,h=e0(l),c=i.format||h.format,u=i.type||h.type;if(e.bindTexture(n,t),34067===n){let h,d,m=r.width,p=r.height;if(m/6===p)h=p,d=[0,0,1,0,2,0,3,0,4,0,5,0];else if(p/6===m)h=m,d=[0,0,0,1,0,2,0,3,0,4,0,5];else if(m/3==p/2)h=m/3,d=[0,0,1,0,2,0,0,1,1,1,2,1];else if(m/2==p/3)h=m/2,d=[0,0,1,0,0,1,1,1,0,2,1,2];else throw Error(`can't figure out cube map from element: ${r.src?r.src:r.nodeName}`);let f=eZ();f?(f.canvas.width=h,f.canvas.height=h,a=h,s=h,e6(e,i,()=>{ti(e,i).forEach(function(t){let i=d[2*t.ndx+0]*h,n=d[2*t.ndx+1]*h;f.drawImage(r,i,n,h,h,0,0,h,h),e.texImage2D(t.face,o,l,c,u,f.canvas)}),f.canvas.width=1,f.canvas.height=1})):"u">
1typeof createImageBitmap&&(a=h,s=h,ti(e,i).forEach(function(m){let p=d[2*m.ndx+0]*h,f=d[2*m.ndx+1]*h;e.texImage2D(m.face,o,l,h,h,0,c,u,null),createImageBitmap(r,p,f,h,h,{premultiplyAlpha:"none",colorSpaceConversion:"none"}).then(function(r){e6(e,i,()=>{e.bindTexture(n,t),e.texImage2D(m.face,o,l,c,u,r),tt(i)&&te(e,t,i,a,s,l)})})}))}else 32879===n||35866===n?e6(e,i,()=>{let t=Math.min(r.width,r.height),i=Math.max(r.width,r.height),a=i/t;if(a%1!=0)throw Error("can not compute 3D dimensions of element");let s=+(r.width===i),h=+(r.height===i);e.pixelStorei(3317,1),e.pixelStorei(3314,r.width),e.pixelStorei(32878,0),e.pixelStorei(32877,0),e.texImage3D(n,o,l,t,t,t,0,c,u,null);for(let i=0;i<a;++i){let a=i*t*s,l=i*t*h;e.pixelStorei(3316,a),e.pixelStorei(3315,l),e.texSubImage3D(n,o,0,0,i,t,t,1,c,u,r)}e8(e)}):e6(e,i,()=>{e.texImage2D(n,o,l,c,u,r)});tt(i)&&te(e,t,i,a,s,l),e7(e,t,i)}function to(){}function ta(e){return"u">typeof ImageBitmap&&e instanceof ImageBitmap||"u">typeof ImageData&&e instanceof ImageData||"u">typeof HTMLElement&&e instanceof HTMLElement}function ts(e,t,r){return ta(e)?(setTimeout(function(){r(null,e)}),e):function(e,t,r){var i;let n;if(r=r||to,t=void 0!==t?t:eQ.crossOrigin,t=void 0!==(i=t)||function(e){if("u">typeof document){let t=document.createElement("a");return t.href=e,t.hostname===location.hostname&&t.port===location.port&&t.protocol===location.protocol}{let t=new URL(location.href).origin;return new URL(e,location.href).origin===t}}(e)?i:"anonymous","u">typeof Image){n=new Image,void 0!==t&&(n.crossOrigin=t);let i=function(){n.removeEventListener("error",o),n.removeEventListener("load",a),n=null},o=function(){let t="couldn't load image: "+e;q(t),r(t,n),i()},a=function(){r(null,n),i()};n.addEventListener("error",o),n.addEventListener("load",a),n.src=e}else if("u">typeof ImageBitmap){let i,o,a=function(){r(i,o)},s={};t&&(s.mode="cors"),fetch(e,s).then(function(e){if(!e.ok)throw e;return e.blob()}).then(function(e){return createImageBitmap(e,{premultiplyAlpha:"none",colorSpaceConversion:"none"})}).then(function(e){o=e,setTimeout(a)}).catch(function(e){i=e,setTimeout(a)}),n=null}return n}(e,t,r)}function tl(e,t,r){var i;let n=(r=r||eQ.textureOptions).target||3553;if(e.bindTexture(n,t),!1===r.color)return;let o=B(i=(i=r.color)||eQ.textureColor)?i:new Uint8Array([255*i[0],255*i[1],255*i[2],255*i[3]]);if(34067===n)for(let t=0;t<6;++t)e.texImage2D(34069+t,0,6408,1,1,0,6408,5121,o);else 32879===n||35866===n?e.texImage3D(n,0,6408,1,1,1,0,6408,5121,o):e.texImage2D(n,0,6408,1,1,0,6408,5121,o)}function th(e,t,r){var i,n,o;r=r||to,t=t||eQ.textureOptions;let a=e.createTexture(),s=t.target||3553,l=t.width||1,h=t.height||1,c=0,u=t.internalFormat||6408;e.bindTexture(s,a),34067===s&&(e.texParameteri(s,10242,33071),e.texParameteri(s,10243,33071));let d=t.src;if(d)if("function"==typeof d&&(d=d(e,t)),"string"==typeof d)i=t,n=(n=r)||to,tl(e,a,i=i||eQ.textureOptions),ts((i=e5(e,i)).src,i.crossOrigin,function(t,r){t?n(t,a,r):(tn(e,a,r,i),n(null,a,r))});else if(B(d)||Array.isArray(d)&&("number"==typeof d[0]||Array.isArray(d[0])||B(d[0]))){let r=function(e,t,r,i){var n,o;let a=(i=i||eQ.textureOptions).target||3553;e.bindTexture(a,t);let s=i.level||0,l=i.internalFormat||i.format||6408,h=e0(l),c=i.format||h.format,u=i.type||(n=r,o=h.type,B(n)?z(n):o||5121);B(r)?r instanceof Uint8ClampedArray&&(r=new Uint8Array(r.buffer)):r=new(U(u))(r);let{width:d,height:m,depth:p}=function(e,t,r,i,n,o){let a=r.width,s=r.height,l=r.depth,h=e1(i);if(h){if(!a||!s)throw Error("compressed texture needs to set width and height!");l=l||1}else{let r,c=eK(i,o),u=t.byteLength/c;if(u%1)throw Error(`length wrong size for format: ${eX(eY,n)}`);if(h&&(!a||!s))throw Error("compressed texture needs to set width and height!");if(32879===e||35866===e)if(a||s||l)!a||s&&l?!s||a&&l?(a=(r=e2(eY,e,a,s,u/l)).width,s=r.height):(a=(r=e2(eY,e,a,l,u/s)).width,l=r.height):(s=(r=e2(eY,e,s,l,u/a)).width,l=r.height);else{let e=Math.cbrt(u);if(e%1!=0)throw Error(`can't guess cube size of array of numElements: ${u}`);a=e,s=e,l=e}else a=(r=e2(eY,e,a,s,u)).width,s=r.height}return{width:a,height:s,depth:l}}(a,r,i,l,c,u),f=e1(l);e8(e),e.pixelStorei(3317,i.unpackAlignment||1);let b=0;return e6(e,i,()=>{let t,n=0,{blockWidth:o,blockHeight:h,bytesPerBlock:g}=(t=eJ(l)).block?{blockWidth:t.block.width,blockHeight:t.block.height,bytesPerBlock:t.block.bytes}:{blockWidth:1,blockHeight:1,bytesPerBlock:eK(l,u)};for(;n<r.byteLength;){let t=Math.max(1,d>>b),v=Math.max(1,m>>b),y=3553===a?Math.max(1,p>>b):p,w=Math.ceil(t/o)*Math.ceil(v/h)*g*y*(34067===a?6:1);if(n+w>r.byteLength)throw Error("src size does not match number of mip levels");let x=r.subarray(n/r.BYTES_PER_ELEMENT,(n+w)/r.BYTES_PER_ELEMENT),F=s+b;if(34067===a){let r=x.length/6;
1ti(e,i).forEach(i=>{let n=r*i.ndx,o=x.subarray(n,n+r);f?e.compressedTexImage2D(i.face,F,l,t,v,0,o):e.texImage2D(i.face,F,l,t,v,0,c,u,o)})}else 32879===a||35866===a?e.texImage3D(a,F,l,t,v,y,0,c,u,x):f?e.compressedTexImage2D(a,F,l,t,v,0,x):e.texImage2D(a,F,l,t,v,0,c,u,x);if(++b,n+=w,1===t&&1===v&&1===y&&n!==r.byteLength)throw Error("src size has more data than can fit in mip levels")}}),{width:d,height:m,depth:p,type:u,lastMipLevelUploaded:s+b-1}}(e,a,d,t);l=r.width,h=r.height,c=r.lastMipLevelUploaded}else Array.isArray(d)&&("string"==typeof d[0]||ta(d[0]))?34067===s?function(e,t,r,i){let n;i=i||to;let o=r.src;if(6!==o.length)throw Error("there must be 6 urls for a cubemap");let a=r.level||0,s=r.internalFormat||r.format||6408,l=e0(s),h=r.format||l.format,c=r.type||5121,u=r.target||3553;if(34067!==u)throw Error("target must be TEXTURE_CUBE_MAP");tl(e,t,r),r=e5(e,r);let d=6,m=[],p=tr(e,r);n=o.map(function(o,l){var f;return ts(o,r.crossOrigin,(f=p[l],function(o,l){--d,o?m.push(o):l.width!==l.height?m.push("cubemap face img is not a square: "+l.src):e6(e,r,()=>{e.bindTexture(u,t),5===d?tr().forEach(function(t){e.texImage2D(t,a,s,h,c,l)}):e.texImage2D(f,a,s,h,c,l),tt(r)&&e.generateMipmap(u)}),0===d&&i(m.length?m:void 0,t,n)}))})}(e,a,t,r):function(e,t,r,i){let n;i=i||to;let o=r.src,a=r.internalFormat||r.format||6408,s=e0(a),l=r.format||s.format,h=r.type||5121,c=r.target||35866;if(32879!==c&&35866!==c)throw Error("target must be TEXTURE_3D or TEXTURE_2D_ARRAY");tl(e,t,r),r=e5(e,r);let u=o.length,d=[],m=r.level||0,p=r.width,f=r.height,b=o.length,g=!0;n=o.map(function(o,s){return ts(o,r.crossOrigin,function(o,v){--u,o?d.push(o):e6(e,r,()=>{if(e.bindTexture(c,t),g){g=!1,p=r.width||v.width,f=r.height||v.height,e.texImage3D(c,m,a,p,f,b,0,l,h,null);for(let t=0;t<b;++t)e.texSubImage3D(c,m,0,0,t,p,f,1,l,h,v)}else{let t,r=v;(v.width!==p||v.height!==f)&&(r=(t=eZ()).canvas,t.canvas.width=p,t.canvas.height=f,t.drawImage(v,0,0,p,f)),e.texSubImage3D(c,m,0,0,s,p,f,1,l,h,r),t&&r===t.canvas&&(t.canvas.width=0,t.canvas.height=0)}tt(r)&&e.generateMipmap(c)}),0===u&&i(d.length?d:void 0,t,n)})})}(e,a,t,r):(tn(e,a,d,t),l=d.width,h=d.height);else{let r,i,n,s,l,h;r=(o=t).target||3553,e.bindTexture(r,a),i=o.level||0,s=e0(n=o.internalFormat||o.format||6408),l=o.format||s.format,h=o.type||s.type,e6(e,o,()=>{if(34067===r)for(let t=0;t<6;++t)e.texImage2D(34069+t,i,n,o.width,o.height,0,l,h,null);else 32879===r||35866===r?e.texImage3D(r,i,n,o.width,o.height,o.depth,0,l,h,null):e.texImage2D(r,i,n,o.width,o.height,0,l,h,null)})}return tt(t)&&e9(e,a,{options:t,width:l,height:h,internalFormat:u,lastMipLevelUploaded:c}),e7(e,a,t),a}function tc(e){return"u">typeof document&&document.getElementById?document.getElementById(e):null}let tu={};function td(e,t){return tu[t].bindPoint}function tm(e,t){return function(r){e.uniform1i(t,r)}}function tp(e,t){return function(r){e.uniform1iv(t,r)}}function tf(e,t){return function(r){e.uniform2iv(t,r)}}function tb(e,t){return function(r){e.uniform3iv(t,r)}}function tg(e,t){return function(r){e.uniform4iv(t,r)}}function tv(e,t,r,i){let n=td(e,t);return eW(e)?function(t){let o,a;!t||N(e,t)?(o=t,a=null):(o=t.texture,a=t.sampler),e.uniform1i(i,r),e.activeTexture(33984+r),e.bindTexture(n,o),e.bindSampler(r,a)}:function(t){e.uniform1i(i,r),e.activeTexture(33984+r),e.bindTexture(n,t)}}function ty(e,t,r,i,n){let o=td(e,t),a=new Int32Array(n);for(let e=0;e<n;++e)a[e]=r+e;return eW(e)?function(t){e.uniform1iv(i,a),t.forEach(function(t,i){let n,s;e.activeTexture(33984+a[i]),!t||N(e,t)?(n=t,s=null):(n=t.texture,s=t.sampler),e.bindSampler(r,s),e.bindTexture(o,n)})}:function(t){e.uniform1iv(i,a),t.forEach(function(t,r){e.activeTexture(33984+a[r]),e.bindTexture(o,t)})}}function tw(e,t){return function(r){if(r.value)switch(e.disableVertexAttribArray(t),r.value.length){case 4:e.vertexAttrib4fv(t,r.value);break;case 3:e.vertexAttrib3fv(t,r.value);break;case 2:e.vertexAttrib2fv(t,r.value);break;case 1:e.vertexAttrib1fv(t,r.value);break;default:throw Error("the length of a float constant value must be between 1 and 4!")}else e.bindBuffer(34962,r.buffer),e.enableVertexAttribArray(t),e.vertexAttribPointer(t,r.numComponents||r.size,r.type||5126,r.normalize||!1,r.stride||0,r.offset||0),e.vertexAttribDivisor&&e.vertexAttribDivisor(t,r.divisor||0)}}function tx(e,t){return function(r){if(r.value)if(e.disableVertexAttribArray(t),4===r.value.length)e.vertexAttrib4iv(t,r.value);else throw Error("The length of an integer constant value must be 4!");else e.bindBuffer(34962,r.buffer),e.enableVertexAttribArray(t),e.vertexAttribIPointer(t,r.numComponents||r.size,r.type||5124,r.stride||0,r.offset||0),e.vertexAttribDivisor&&e.vertexAttribDivisor(t,r.divisor||0)}}function tF(e,t){return function(r){if(r.value)if(e.disableVertexAttribArray(t),4===r.value.length)e.vertexAttrib4uiv(t,r.value);else throw Error("The length of an unsigned integer constant value must be 4!");else e.bindBuffer(34962,r.buffer),e.enableVertexAttribArray(t),e.vertexAttribIPointer(t,r.numComponents||r.size,r.type||5125,r.stride||0,r.offset||0),e.vertexAttribDivisor&&e.vertexAttribDivisor(t,r.divisor||0)}}function tE(e,t,r){let i=r.size,n=r.count;return function(r){e.bindBuffer(34962,r.buffer);let o=r.size||r.numComponents||i,a=o/n,s=r.type||5126,l=tu[s].size*o,h=r.normalize||!1,c=r.offset||0,u=l/n;for(let i=0;i<n;
1++i)e.enableVertexAttribArray(t+i),e.vertexAttribPointer(t+i,a,s,h,l,c+u*i),e.vertexAttribDivisor&&e.vertexAttribDivisor(t+i,r.divisor||0)}}tu[5126]={Type:Float32Array,size:4,setter:function(e,t){return function(r){e.uniform1f(t,r)}},arraySetter:function(e,t){return function(r){e.uniform1fv(t,r)}}},tu[35664]={Type:Float32Array,size:8,setter:function(e,t){return function(r){e.uniform2fv(t,r)}},cols:2},tu[35665]={Type:Float32Array,size:12,setter:function(e,t){return function(r){e.uniform3fv(t,r)}},cols:3},tu[35666]={Type:Float32Array,size:16,setter:function(e,t){return function(r){e.uniform4fv(t,r)}},cols:4},tu[5124]={Type:Int32Array,size:4,setter:tm,arraySetter:tp},tu[35667]={Type:Int32Array,size:8,setter:tf,cols:2},tu[35668]={Type:Int32Array,size:12,setter:tb,cols:3},tu[35669]={Type:Int32Array,size:16,setter:tg,cols:4},tu[5125]={Type:Uint32Array,size:4,setter:function(e,t){return function(r){e.uniform1ui(t,r)}},arraySetter:function(e,t){return function(r){e.uniform1uiv(t,r)}}},tu[36294]={Type:Uint32Array,size:8,setter:function(e,t){return function(r){e.uniform2uiv(t,r)}},cols:2},tu[36295]={Type:Uint32Array,size:12,setter:function(e,t){return function(r){e.uniform3uiv(t,r)}},cols:3},tu[36296]={Type:Uint32Array,size:16,setter:function(e,t){return function(r){e.uniform4uiv(t,r)}},cols:4},tu[35670]={Type:Uint32Array,size:4,setter:tm,arraySetter:tp},tu[35671]={Type:Uint32Array,size:8,setter:tf,cols:2},tu[35672]={Type:Uint32Array,size:12,setter:tb,cols:3},tu[35673]={Type:Uint32Array,size:16,setter:tg,cols:4},tu[35674]={Type:Float32Array,size:32,setter:function(e,t){return function(r){e.uniformMatrix2fv(t,!1,r)}},rows:2,cols:2},tu[35675]={Type:Float32Array,size:48,setter:function(e,t){return function(r){e.uniformMatrix3fv(t,!1,r)}},rows:3,cols:3},tu[35676]={Type:Float32Array,size:64,setter:function(e,t){return function(r){e.uniformMatrix4fv(t,!1,r)}},rows:4,cols:4},tu[35685]={Type:Float32Array,size:32,setter:function(e,t){return function(r){e.uniformMatrix2x3fv(t,!1,r)}},rows:2,cols:3},tu[35686]={Type:Float32Array,size:32,setter:function(e,t){return function(r){e.uniformMatrix2x4fv(t,!1,r)}},rows:2,cols:4},tu[35687]={Type:Float32Array,size:48,setter:function(e,t){return function(r){e.uniformMatrix3x2fv(t,!1,r)}},rows:3,cols:2},tu[35688]={Type:Float32Array,size:48,setter:function(e,t){return function(r){e.uniformMatrix3x4fv(t,!1,r)}},rows:3,cols:4},tu[35689]={Type:Float32Array,size:64,setter:function(e,t){return function(r){e.uniformMatrix4x2fv(t,!1,r)}},rows:4,cols:2},tu[35690]={Type:Float32Array,size:64,setter:function(e,t){return function(r){e.uniformMatrix4x3fv(t,!1,r)}},rows:4,cols:3},tu[35678]={Type:null,size:0,setter:tv,arraySetter:ty,bindPoint:3553},tu[35680]={Type:null,size:0,setter:tv,arraySetter:ty,bindPoint:34067},tu[35679]={Type:null,size:0,setter:tv,arraySetter:ty,bindPoint:32879},tu[35682]={Type:null,size:0,setter:tv,arraySetter:ty,bindPoint:3553},tu[36289]={Type:null,size:0,setter:tv,arraySetter:ty,bindPoint:35866},tu[36292]={Type:null,size:0,setter:tv,arraySetter:ty,bindPoint:35866},tu[36293]={Type:null,size:0,setter:tv,arraySetter:ty,bindPoint:34067},tu[36298]={Type:null,size:0,setter:tv,arraySetter:ty,bindPoint:3553},tu[36299]={Type:null,size:0,setter:tv,arraySetter:ty,bindPoint:32879},tu[36300]={Type:null,size:0,setter:tv,arraySetter:ty,bindPoint:34067},tu[36303]={Type:null,size:0,setter:tv,arraySetter:ty,bindPoint:35866},tu[36306]={Type:null,size:0,setter:tv,arraySetter:ty,bindPoint:3553},tu[36307]={Type:null,size:0,setter:tv,arraySetter:ty,bindPoint:32879},tu[36308]={Type:null,size:0,setter:tv,arraySetter:ty,bindPoint:34067},tu[36311]={Type:null,size:0,setter:tv,arraySetter:ty,bindPoint:35866};let tP={};tP[5126]={size:4,setter:tw},tP[35664]={size:8,setter:tw},tP[35665]={size:12,setter:tw},tP[35666]={size:16,setter:tw},tP[5124]={size:4,setter:tx},tP[35667]={size:8,setter:tx},tP[35668]={size:12,setter:tx},tP[35669]={size:16,setter:tx},tP[5125]={size:4,setter:tF},tP[36294]={size:8,setter:tF},tP[36295]={size:12,setter:tF},tP[36296]={size:16,setter:tF},tP[35670]={size:4,setter:tx},tP[35671]={size:8,setter:tx},tP[35672]={size:12,setter:tx},tP[35673]={size:16,setter:tx},tP[35674]={size:4,setter:tE,count:2},tP[35675]={size:9,setter:tE,count:3},tP[35676]={size:16,setter:tE,count:4};let tM=/ERROR:\s*\d+:(\d+)/gi,tA=/^[ \t]*\n/;function tS(e){let t=0;return tA.test(e)&&(t=1,e=e.replace(tA,"")),{lineOffset:t,shaderSource:e}}function tR(e,t,r){let i,n,o;if("function"==typeof t&&(r=t,t=void 0),"function"==typeof e)r=e,e=void 0;else if(e&&!Array.isArray(e)){let t=e;r=t.errorCallback,e=t.attribLocations,i=t.transformFeedbackVaryings,n=t.transformFeedbackMode,o=t.callback}let a=r||q,s=[],l={errorCallback(e,...t){s.push(e),a(e,...t)},transformFeedbackVaryings:i,transformFeedbackMode:n,callback:o,errors:s};{let r={};Array.isArray(e)?e.forEach(function(e,i){r[e]=t?t[i]:i}):r=e||{},l.attribLocations=r}return l}let tT=["VERTEX_SHADER","FRAGMENT_SHADER"],tI=(e=0)=>new Promise(t=>setTimeout(t,e));async function tk(e,t){let r=e.getExtension("KHR_parallel_shader_compile"),i=r?(e,t)=>
1e.getProgramParameter(t,r.COMPLETION_STATUS_KHR):()=>!0,n=0;do await tI(n),n=1e3/60;while(!i(e,t))}function tL(e){let t=e.name;return t.startsWith("gl_")||t.startsWith("webgl_")}let tC=/(\.|\[|]|\w+)/g,tO=e=>e>="0"&&e<="9";function t_(e,t){let r=function(e,t){let r=0,i={},n={},o=e.getProgramParameter(t,35718);for(let a=0;a<o;++a){let o=e.getActiveUniform(t,a);if(tL(o))continue;let s=o.name;s.endsWith("[0]")&&(s=s.substr(0,s.length-3));let l=e.getUniformLocation(t,o.name);if(l){let t=function(t,i){let n,o=t.name.endsWith("[0]"),a=t.type,s=tu[a];if(!s)throw Error(`unknown type: 0x${a.toString(16)}`);if(s.bindPoint){let l=r;r+=t.size,n=o?s.arraySetter(e,a,l,i,t.size):s.setter(e,a,l,i,t.size)}else n=s.arraySetter&&o?s.arraySetter(e,i):s.setter(e,i);return n.location=i,n}(o,l);i[s]=t,function(e,t,r,i){let n=e.split(tC).filter(e=>""!==e),o=0,a="";for(;;){let e=n[o++];a+=e;let s=tO(e[0]),l=s?parseInt(e):e;if(s&&(a+=n[o++]),o===n.length){r[l]=t;break}{let e=n[o++],t="["===e,s=r[l]||(t?[]:{});r[l]=s,r=s,i[a]=i[a]||function(e){return function(t){!function e(t,r){for(let i in r){let n=t[i];"function"==typeof n?n(r[i]):e(t[i],r[i])}}(e,t)}}(s),a+=e}}}(s,t,n,i)}}return i}(e,t),i=function(e,t){let r={},i=e.getProgramParameter(t,35721);for(let n=0;n<i;++n){let i=e.getActiveAttrib(t,n);if(tL(i))continue;let o=e.getAttribLocation(t,i.name),a=tP[i.type],s=a.setter(e,o,a);s.location=o,r[i.name]=s}return r}(e,t),n={program:t,uniformSetters:r,attribSetters:i,uniformLocations:Object.fromEntries(Object.entries(r).map(([e,t])=>[e,t.location])),attribLocations:Object.fromEntries(Object.entries(i).map(([e,t])=>[e,t.location]))};return eW(e)&&(n.uniformBlockSpec=function(e,t){let r=e.getProgramParameter(t,35718),i=[],n=[];for(let o=0;o<r;++o){n.push(o),i.push({});let r=e.getActiveUniform(t,o);i[o].name=r.name}[["UNIFORM_TYPE","type"],["UNIFORM_SIZE","size"],["UNIFORM_BLOCK_INDEX","blockNdx"],["UNIFORM_OFFSET","offset"]].forEach(function(r){let o=r[0],a=r[1];e.getActiveUniforms(t,n,e[o]).forEach(function(e,t){i[t][a]=e})});let o={},a=e.getProgramParameter(t,35382);for(let r=0;r<a;++r){let i=e.getActiveUniformBlockName(t,r),n={index:e.getUniformBlockIndex(t,i),usedByVertexShader:e.getActiveUniformBlockParameter(t,r,35396),usedByFragmentShader:e.getActiveUniformBlockParameter(t,r,35398),size:e.getActiveUniformBlockParameter(t,r,35392),uniformIndices:e.getActiveUniformBlockParameter(t,r,35395)};n.used=n.usedByVertexShader||n.usedByFragmentShader,o[i]=n}return{blockSpecs:o,uniformData:i}}(e,t),n.transformFeedbackInfo=function(e,t){let r={},i=e.getProgramParameter(t,35971);for(let n=0;n<i;++n){let i=e.getTransformFeedbackVarying(t,n);r[i.name]={index:n,type:i.type,size:i.size}}return r}(e,t)),n}let tV=/\s|{|}|;/,tD={};tD[34041]=33306,tD[6401]=36128,tD[36168]=36128,tD[6402]=36096,tD[33189]=36096,tD[33190]=36096,tD[36012]=36096,tD[35056]=33306,tD[36013]=33306;let tz={};tz[32854]=!0,tz[32855]=!0,tz[36194]=!0,tz[34041]=!0,tz[33189]=!0,tz[6401]=!0,tz[36168]=!0;let tj={addExtensionsToContext:!0},tU=/^(.*?)_/,tB=["ANGLE_instanced_arrays","EXT_blend_minmax","EXT_color_buffer_float","EXT_color_buffer_half_float","EXT_disjoint_timer_query","EXT_disjoint_timer_query_webgl2","EXT_frag_depth","EXT_sRGB","EXT_shader_texture_lod","EXT_texture_compression_bptc","EXT_texture_compression_rgtc","EXT_texture_filter_anisotropic","OES_element_index_uint","OES_standard_derivatives","OES_texture_float","OES_texture_float_linear","OES_texture_half_float","OES_texture_half_float_linear","OES_vertex_array_object","WEBGL_color_buffer_float","WEBGL_compressed_texture_atc","WEBGL_compressed_texture_etc1","WEBGL_compressed_texture_etc","WEBGL_compressed_texture_pvrtc","WEBGL_compressed_texture_s3tc","WEBGL_compressed_texture_s3tc_srgb","WEBGL_depth_texture","WEBGL_draw_buffers"];var t$=r(6612);try{if("u">typeof document){var tq=document.createElement("style");tq.appendChild(document.createTextNode(".ls-viewer-container{display:block;position:relative;overflow:hidden;-webkit-user-select:none;user-select:none;width:100%;height:100%}.ls-viewer-container-image,.ls-viewer-container-video{cursor:default;pointer-events:none}.ls-viewer-container-vrcube{cursor:pointer;cursor:grab}.ls-viewer-container-vrcube-grabbing{cursor:move;cursor:grabbing}.ls-viewer-container-vrobject{cursor:move;cursor:grab}.ls-viewer-container-vrobject-grabbing{cursor:move;cursor:grabbing}.ls-viewer-container-loading{cursor:progress}.ls-viewer-canvas{position:absolute;opacity:0;transition:opacity .5s}.ls-viewer-video{position:absolute}")),document.head.appendChild(tq)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}class tG{constructor(e,t){this.width=e,this.height=t}get aspect(){return this.width/this.height}}
1let tH=class e{constructor(e,t,r,i){this.top=e,this.left=t,this.width=r,this.height=i}static contains(e,t){return t.x>=0&&t.x<e.width&&t.y>=0&&t.y<e.height}static fit(t,r,i){let n=t.aspect,o=r.aspect,a=0,s=0;switch(i){case"contain":a=o<n?r.width:r.height*n,s=o<n?r.width/n:r.height;break;case"cover":default:a=o<n?r.height*n:r.width,s=o<n?r.height:r.width/n;break;case"fill":a=r.width,s=r.height}return new e((r.height-s)/2,(r.width-a)/2,a,s)}static project(t,r,i,n){let o=e.fit(t,r,i),a=o.width/t.width,s=o.height/t.height;return{x:Math.round(o.left+n.x*a),y:Math.round(o.top+n.y*s)}}static unproject(t,r,i,n){let o=e.fit(t,r,i),a=o.width/t.width,s=o.height/t.height;return{x:Math.round((n.x-o.left)/a),y:Math.round((n.y-o.top)/s)}}static getStandardAspectRatio(t,r,i){if(0===t||0===r)return 0;if(i)return i;let n=t/r;return t<r?n<e.PORTRAIT_ASPECT_BOUNDARY?9/16:3/4:n<e.LANDSCAPE_ASPECT_BOUNDARY?4/3:16/9}static getStandardResolution(t,r,i){if(0===t||0===r)return new tG(0,0);let n=e.getStandardAspectRatio(t,r,i);if(i){let i=e.getStandardQuality(Math.min(t,r));return new tG(Math.round(i*n),Math.round(i))}if(t<r){let i=e.getStandardQuality(Math.max(r*n,t));return new tG(Math.round(i),Math.round(i/n))}let o=e.getStandardQuality(Math.max(t/n,r));return new tG(Math.round(o*n),Math.round(o))}static getStandardQuality(e){return e<=720?720:1080}};tH.LANDSCAPE_ASPECT_BOUNDARY=Math.sqrt(4/3*(16/9)),tH.PORTRAIT_ASPECT_BOUNDARY=Math.sqrt(3/4*(9/16));class tN{constructor(e){this.element=document.createElement("canvas"),this.element.classList.add("ls-viewer-canvas"),this.element.style.opacity="0",this.element.width=0,this.element.height=0,this.context=this.element.getContext("2d"),this.context.imageSmoothingQuality="high",this.backCanvas=document.createElement("canvas"),this.backContext=this.backCanvas.getContext("2d"),this.backContext.imageSmoothingQuality="high",this.fit=e}destroy(){this.requestAnimationId&&(cancelAnimationFrame(this.requestAnimationId),this.requestAnimationId=void 0)}show(e){e?this.element.style.display="block":this.element.style.opacity="1"}hide(e){e?this.element.style.display="none":this.element.style.opacity="0"}resize(e,t,r){let i=Math.floor(e*r),n=Math.floor(t*r);this.element.style.width=`${e}px`,this.element.style.height=`${t}px`,(this.element.width!==i||this.element.height!==n)&&(this.element.width=i,this.element.height=n,this.context.imageSmoothingQuality="high",this.backCanvas.width=i,this.backCanvas.height=n,this.backContext.imageSmoothingQuality="high",this.image&&this.draw(this.image,!1))}draw(e,t,r){if(!e)return;this.requestAnimationId&&(cancelAnimationFrame(this.requestAnimationId),this.requestAnimationId=void 0);let i=tH.fit(new tG(e.width,e.height),new tG(this.element.width,this.element.height),this.fit);t?(this.backContext.drawImage(this.element,0,0),this.context.globalAlpha=0,this.fadeLoop(e,r||0)):(this.context.globalAlpha=1,this.context.drawImage(e,i.left,i.top,i.width,i.height)),this.image=e}fadeLoop(e,t){if(this.context.globalAlpha>=1){cancelAnimationFrame(this.requestAnimationId),this.requestAnimationId=void 0;return}let r=Math.min(this.context.globalAlpha+t,1),i=tH.fit(new tG(e.width,e.height),new tG(this.element.width,this.element.height),this.fit);this.context.clearRect(0,0,this.element.width,this.element.height),this.context.globalAlpha=1,this.context.drawImage(this.backCanvas,0,0),this.context.globalAlpha=r,this.context.drawImage(e,i.left,i.top,i.width,i.height),this.requestAnimationId=requestAnimationFrame(()=>{this.fadeLoop(e,t)})}}class tW{constructor(){this.element=document.createElement("canvas"),this.element.classList.add("ls-viewer-canvas"),this.element.style.opacity="0",this.element.width=0,this.element.height=0,this.context=function(e,t){var r=e,i=t;let n=["webgl2","webgl","experimental-webgl"],o=null;for(let e=0;e<n.length;++e)if(o=r.getContext(n[e],i)){tj.addExtensionsToContext&&function(e){for(let t=0;t<tB.length;++t)!function(e,t){eX(e,0);let r=e.getExtension(t);if(r){let i={},n=tU.exec(t)[1],o="_"+n;for(let t in r){let a=r[t],s="function"==typeof a,l=s?n:o,h=t;t.endsWith(l)&&(h=t.substring(0,t.length-l.length)),void 0!==e[h]?s||e[h]===a||function(...e){console.warn(...e)}(h,e[h],a,t):s?e[h]=function(e){return function(){return e.apply(r,arguments)}}(a):(e[h]=a,i[h]=a)}i.constructor={name:r.constructor.name},eX(i,0)}}(e,tB[t])}(o);break}return o}(this.element,{preserveDrawingBuffer:!0}
1),this.context&&this.context.isContextLost()&&(this.context=void 0),function(e){var t;$(e,tj),$(e,W),$(e,eQ),e.textureColor&&(eQ.textureColor=new Uint8Array([255*(t=e.textureColor)[0],255*t[1],255*t[2],255*t[3]]))}({textureColor:[1,1,1,1]})}show(){this.element.style.opacity="1"}hide(){this.element.style.opacity="0"}resize(e,t,r){this.element.width=e*r,this.element.height=t*r,this.element.style.width=`${e}px`,this.element.style.height=`${t}px`}}class tX{static accelerate(e,t){return Math.abs(e)**(t||1.5)*(e>0?1:-1)}static clamp(e,t,r){return Math.max(Math.min(e,r),t)}static degreesToRadians(e){return Math.PI/180*e}static radiansToDegrees(e){return 180/Math.PI*e}static mod(e,t){return e-t*Math.floor(e/t)}static perspectiveWithFovX(e,t,r,i,n){let o=Math.tan(e/2),a=o/t;return this.perspectiveWithLeft(-o,o,-a,a,r,i,n)}static perspectiveWithFovY(e,t,r,i,n){let o=r*Math.tan(e/2),a=o*t;return this.perspectiveWithLeft(-a,a,-o,o,r,i,n)}static perspectiveWithLeft(e,t,r,i,n,o,a){a=a||new Float32Array(16);let s=t-e,l=i-r,h=o-n;return a[0]=2*n/s,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=2*n/l,a[6]=0,a[7]=0,a[8]=(t+e)/s,a[9]=(i+r)/l,a[10]=-o/h,a[11]=-1,a[12]=0,a[13]=0,a[14]=-o*n/h,a[15]=0,a}}let tY=class e{static initCubeFace(t,r,i){let n=[0,0,0],o=T.subtract(r,t),a=T.mulScalar([0,1,0],T.length(o)),s=T.mulScalar(T.normalize(T.cross(o,a)),T.length(o)),l=T.mulScalar(T.normalize(T.cross(a,s)),T.length(o));switch(i){case"front":r=T.add(t,l),n=T.normalize(a);break;case"right":r=T.add(t,s),n=T.normalize(a);break;case"back":r=T.subtract(t,l),n=T.normalize(a);break;case"left":r=T.subtract(t,s),n=T.normalize(a);break;case"up":r=T.add(t,a),n=T.normalize(T.mulScalar(l,-1));break;case"down":r=T.subtract(t,a),n=T.normalize(l)}return new e(r,t,n)}constructor(e,t,r){this.target=T.copy(e),this.eye=T.copy(t),this.up=T.copy(r)}get viewVector(){return T.subtract(this.target,this.eye)}get rightVector(){return T.normalize(T.cross(this.viewVector,this.up))}get viewMatrix(){return V.inverse(V.lookAt(this.eye,this.target,this.up))}clone(){return new e(T.copy(this.target),T.copy(this.eye),T.copy(this.up))}};tY.default=new tY([0,0,0],[2,2,2],[0,1,0]);class tQ{constructor(e){this.target=e.target;const t=T.normalize(T.subtract(e.eye,e.target)),r=T.dot(t,[1,0,0]),i=T.dot(t,[0,1,0]),n=T.dot(t,[0,0,1]);this.longitude=Math.atan2(r,n),this.latitude=Math.atan2(i,Math.sqrt(r*r+n*n)),0>T.dot(e.up,[0,1,0])&&(this.longitude=Math.PI+this.longitude,this.latitude=Math.PI-this.latitude),this.distance=T.length(T.subtract(e.target,e.eye))}get vector(){let e=Math.cos(this.latitude)*this.distance,t=Math.sin(this.latitude)*this.distance;return[Math.cos(this.longitude)*e,t,Math.sin(this.longitude)*e]}pointOfView(e){let t=V.rotationY(this.longitude),r=V.rotationX(-this.latitude),i=V.rotationZ(0),n=V.multiply(t,V.multiply(r,i)),o=[0,0,-1];o=V.transformPoint(n,o);let a=[0,1,0];a=V.transformPoint(n,a);let s=T.subtract(e,T.mulScalar(o,this.distance));return new tY(e,s,a)}}class tZ{async animation(e){return e.scene}async database(e){throw Error("Unavailable")}async image(e){return e.scene}async video(e){return e.scene}async vrCube(e){return e.scene}async vrObject(e){return e.scene}}class tJ{constructor(e){this.xmlDoc=e}get id(){return this.xmlDoc.getElementsByTagName("Database")[0]?.getAttribute("id")}getCameraId(e,t){return t?this.xmlDoc.querySelector(`RootCameraGroup Group[name="${t}"] Camera[name="${e}"]`)?.getAttribute("id"):this.xmlDoc.querySelector(`RootCameraGroup Camera[name="${e}"]`)?.getAttribute("id")}getCameraById(e,t){let r;return(r=e&&t?this.xmlDoc.querySelector(`RootCameraGroup Group[id="${t}"] Camera[id="${e}"]`):this.xmlDoc.querySelector(`RootCameraGroup Camera[id="${e}"]`))?this.mapElementToCamera(r):null}getCameraByName(e,t){let r;return(r=t&&e?this.xmlDoc.querySelector(`RootCameraGroup Group[name="${t}"] Camera[name="${e}"]`):this.xmlDoc.querySelector(`RootCameraGroup Camera[name="${e}"]`))?this.mapElementToCamera(r):null}getCameraGroupId(e){return this.xmlDoc.querySelector(`RootCameraGroup Group[name="${e}"]`)?.getAttribute("id")}getCameraGroupById(e){let t=this.xmlDoc.querySelector(`RootCameraGroup Group[id="${e}"]`);return t?this.mapElementToCameraGroup(t):null}getCameraGroupByName(e){let t=this.xmlDoc.querySelector(`RootCameraGroup Group[name="${e}"]`);return t?this.mapElementToCameraGroup(t):null}mapElementToCamera(e){return{id:e.getAttribute("id"),name:e.getAttribute("name"),pointOfVie
1w:new tY([parseFloat(e.querySelector("PointOfView Target").getAttribute("x")),parseFloat(e.querySelector("PointOfView Target").getAttribute("y")),parseFloat(e.querySelector("PointOfView Target").getAttribute("z"))],[parseFloat(e.querySelector("PointOfView Eye").getAttribute("x")),parseFloat(e.querySelector("PointOfView Eye").getAttribute("y")),parseFloat(e.querySelector("PointOfView Eye").getAttribute("z"))],[parseFloat(e.querySelector("PointOfView Up").getAttribute("x")),parseFloat(e.querySelector("PointOfView Up").getAttribute("y")),parseFloat(e.querySelector("PointOfView Up").getAttribute("z"))])}}mapElementToCameraGroup(e){return{id:e.getAttribute("id"),name:e.getAttribute("name"),cameras:[...e.querySelectorAll("Camera")].map(e=>this.mapElementToCamera(e))}}}let tK=class e{constructor(e){this.server=e}static buildQuery(e){return Object.entries(e).filter(([e,t])=>null!=t).map(([e,t])=>`${e}=${t}`).join("&")}static sceneParameters(e){let t=e.scene,r=t.length>1?t.find(e=>e.accessory):null,i=t.length>1?t.find(e=>e.decor):null,n=t.find(e=>e!==r&&e!==i);return{databaseId:n.database,configuration:n?.configuration,animations:n?.animations?.join("/"),accessoryDatabaseId:r?.database,decorDatabaseId:i?.database,decorDeltaAltitude:i?.translation?.y}}static renderParameters(e){let{parameters:t,view:r}=e;return{background:r.background,width:t.width,height:t.height,softwareAntialiasing:t.antialiasing,superSampling:t.superSampling}}static encoderParameters(e){let{encoder:t}=e;return{imageFormat:t.format,imageQuality:t.quality}}static async fetch(e){return fetch(e).then(e=>e.text()).then(e=>{let t=e.replace(/&/g,"&").match(this.xmlRegex);return t?t.map(e=>e.replace(this.xmlRegex,"$1")):Promise.reject()})}async animation(t){let r={...e.sceneParameters(t),animation:t.view.animation,bookmarkSet:t.view.camera.split("/")[0],bookmark:t.view.camera.split("/")[1],frames:t.view.frames,loop:!!t.view.loop,...e.renderParameters(t),...e.encoderParameters(t)},i=e.buildQuery(r);return e.fetch(`${this.server}/ImagesFromAnimation?${i}`)}async database(e){return fetch(`${this.server}/Database?databaseId=${e}`).then(e=>e.text()).then(e=>new tJ(new DOMParser().parseFromString(e,"application/xml")))}async image(t){let r={...e.sceneParameters(t),bookmarkSet:t.view.camera.split("/")[0],bookmark:t.view.camera.split("/")[1],...e.renderParameters(t),...e.encoderParameters(t)},i=e.buildQuery(r);return Promise.resolve(`${this.server}/ImageFromBookmark?${i}`)}async video(t){let r={...e.sceneParameters(t),animation:t.view.animation,bookmarkSet:t.view.camera.split("/")[0],bookmark:t.view.camera.split("/")[1],duration:t.view.duration,frames:t.view.frames,loop:!!t.view.loop,reverse:!!t.view.reverse,...e.renderParameters(t),...e.encoderParameters(t)},i=e.buildQuery(r);return Promise.resolve(`${this.server}/ImagesFromAnimation?${i}`)}async vrCube(t){let r={...e.sceneParameters(t),bookmarkSet:t.view.camera.split("/")[0],bookmark:t.view.camera.split("/")[1],...e.renderParameters(t),...e.encoderParameters(t)};r.width=Math.max(r.width,r.height),r.height=Math.max(r.width,r.height);let i=e.buildQuery(r);return e.fetch(`${this.server}/CubeFromBookmark?${i}`)}async vrObject(t){let r={...e.sceneParameters(t),bookmarkSet:t.view.camera,...e.renderParameters(t),...e.encoderParameters(t)},i=e.buildQuery(r);return e.fetch(`${this.server}/ImagesFromBookmarkSet?${i}`)}};tK.xmlRegex=/directUrl="([^"]*)"/g;class t0{constructor(e){this.server=e}static scene(e){return e.scene.map(e=>{let{accessory:t,decor:r,...i}=e;return i})}static renderParameters(e){return{...e.parameters,superSampling:e.parameters.superSampling.toString()}}static encoder(e){switch(e.encoder.format){case"jpeg":return{jpeg:{quality:e.encoder.quality}};case"png":return{png:{compression:e.encoder.compression}};case"webp":return{webp:{quality:e.encoder.quality}}}return{jpeg:{quality:80}}}static async fetchFrame(e,t){return fetch(e,{method:"POST",body:JSON.stringify(t)}).then(e=>e.json()).then(e=>e.url)}static async fetchFrameArray(e,t){return fetch(e,{method:"POST",body:JSON.stringify(t)}).then(e=>e.json()).then(e=>e.map(e=>e.url))}static async fetchHotspots(e,t){return fetch(e,{method:"POST",body:JSON.stringify(t)}).then(e=>e.json())}static async fetchHotspotsArray(e,t){return fetch(e,{method:"POST",body:JSON.stringify(t)}).then(e=>e.json())}static async fetchPick(e,t){return fetch(e,{method:"POST",body:JSON.stringify(t)}).then(e=>e.json()).then(e=>e[0])}async database(e){return fetch(`${this.server}/Database?databaseId=${e}`).then(e=>e.text()).then(e=>new tJ(new DOMParser().parseFromString(e,"application/xml")))}async image(e){let t={scene:t0.scene(e),mode:{image:{camera:e.view.camera}},renderParameters:t0.renderParameters(e),encoder:t0.encoder(e)};return t0.fetchFrame(`${this.server}/Snapshot`,t)}async vrCube(e){let t={scene:t0.scene(e),mode:{vrCube:{camera:e.view.camera}},renderParameters:t0.renderParameters(e),encoder:t0.encoder(e)};return t.renderParameters.width=Math.max(t.renderParameters.width,t.renderParameters.height),t.renderParameters.height=Math.max(t.renderParameters.width,t.renderParameters.height),t0.fetchFrameArray(`${this.server}/Snapshot`,t)}async vrObject(e){let t;t=e.view.cameraGroup?{images:{cameraGroup:e.view.cameraGroup}}:e.view.frames?{vrObject:{camera:e.view.camera,frames:e.view.frames}}:{vrObject:{camera:e.view.camera,panFrames:e.view.panFrames||1,panFrom:e.view.panFrom||0,panTo:e.view.panTo||0,panLoop:e.view.panLoop||!1,tiltFrames:e.view.tiltFrames||1,tiltFrom:e.view.tiltFrom||0,tiltTo:e.view.tiltTo||0,tiltLoop:e.view.tiltLoop||!1}};let r={scene:t0.scene(e),mode:t,renderParameters:t0.renderParameters(e),encoder:t0.encoder(e)};return t0.fetchFrameArray(`${this.server}/Snapshot`,r)}async animation(e){let t={scene:t0.scene(e),mode:{animation:{id:e.view.animation,camera:e.view.camera,fps:e.view.fps}},renderParameters:t0.renderParameters(e),encoder:t0.encoder(e)};return t0.fetchFrameArray(`${this.server}/Snapshot`,t)}async imageHotspots(e,t){let r={scene:t0.scene(e),mode:{image:{camera:e.view.camera}},renderParameters:t0.renderParameters(e),...this.hotspotsBody(t)};return await t0.fetchHotspots(`${this.server}/Hotspot`,r)}async imagePick(e,t){let r={scene:t0.scene(e),camera:e.view.camera,renderParameters:t0.renderParameters(e),positions:[t]};return await t0.fetchPick(`${this.server}/Pick`,r)}async vrCubeHotspots(e,t){let r={scene:t0.scene(e),mode:{vrCube:{camera:e.view.camera}},renderParameters:t0.renderParameters(e),...this.hotspotsBody(t)};return r.renderParameters.width=Math.max(r.renderParameters.width,r.renderParameters.height),r.renderParameters.height=Math.max(r.renderParameters.width,r.renderParameters.height),await t0.fetchHotspotsArray(`${this.server}/Hotspot`,r)}async vrObjectHotspots(e,t){let r;r=e.view.cameraGroup?{images:{cameraGroup:e.view.cameraGroup}}:e.view.frames?{vrObject:{camera:e.view.camera,frames:e.view.frames}}:{vrObject:{camera:e.view.camera,panFrames:e.view.panFrames||1,panFrom:e.view.panFrom||0,panTo:e.view.panTo||0,panLoop:e.view.panLoop||!1,tiltFrames:e.view.tiltFrames||1,tiltFrom:e.view.tiltFrom||0,tiltTo:e.view.tiltTo||0,tiltLoop:e.view.tiltLoop||!1}};let i={scene:t0.scene(e),mode:r,renderParameters:t0.renderParameters(e),...this.hotspotsBody(t)};return await t0.fetchHotspotsArray(`${this.server}/Hotspot`,i)}hotspotsBody(e){return{positions:e.every(e=>"string"!=typeof e)?e:void 0,tags:e.every(e=>"string"==typeof e)?e:void 0}}}class t1{constructor(e,t,r){switch(t){case"static":this.webrender=new tZ;break;case"v1":default:this.webrender=new tK(e),this.webrenderV2=new t0(e);break;case"v2":this.webrender=new t0(e),this.webrenderV2=new t0(e)}this.delegate=r,this.loadingId=0,this.loaded=0,this.total=0,this.databases=[],this.onLoadStart=r&&r.onLoadStart?r.onLoadStart:()=>{},this.onLoadProgress=r&&r.onLoadProgress?r.onLoadProgress:()=>{},this.onLoadEnd=r&&r.onLoadEnd?r.onLoadEnd:()=>{}}get progress(){return this.total?this.loaded/this.total:0}async loadImageSnapshot(e){this.loadingId+=1,this.loaded=0,this.total=1,this.onLoadStart(this.progress);let{loadingId:t}=this;return this.webrender.image(e).then(e=>this.loadImage(e,t)).then(e=>(this.onLoadEnd(this.progress),e))}async loadVideoSnapshot(e,t){this.loadingId+=1,this.loaded=0,this.total=1,this.onLoadStart(this.progress);let{loadingId:r}=this;return this.webrender.video(t).then(i=>this.loadVideo(e,i,!!t.view.loop,r)).then(()=>(this.onLoadEnd(this.progress),e))}async loadVRCubeSnapshot(e){this.loadingId+=1,this.loaded=0,this.total=0,this.onLoadStart(this.progress);let{loadingId:t}=this;return this.webrender.vrCube(e).then(e=>(this.total=e.length,Promise.all(e.map(e=>this.loadImage(e,t))))).then(e=>(this.onLoadEnd(this.progress),e))}async loadVRObjectSnapshot(e,t){this.loadingId+=1,this.loaded=0,this.total=0,this.onLoadStart(this.progress);let{loadingId:r}=this;return e.view.animation?e.encoder?.format==="mp4"?this.webrender.video(e).then(t=>this.loadVideoFrames(t,e.view.frames,30,r)):this.webrender.animation(e).then(i=>this.loadImageFrames(i,e.view.loop,t,r)):this.webrender.vrObject(e).then(i=>this.loadImageFrames(i,e.view.loop,t,r))}async loadImage(e,t){let r=new Image;r.crossOrigin="file:"!==location.protocol||t1.isValidHttpUrl(e)?"anonymous":null;let i=new Promise((i,n)=>{r.addEventListener("load",()=>{t===this.loadingId&&(this.loaded+=1,this.onLoadProgress(this.progress),i(r))},{once:!0}),r.addEventListener("error",r=>{t===this.loadingId&&n(`${r.type} : ${e}`)},{once:!0})});return r.src=e,i}loadImageFrames(e,t,r,i){this.total=e.length;let n=Array(e.length),o=r||0;for(let r=0,a=e.length;r<a;r+=1){let s=Math.ceil(r/2)*(r%2==0?1:-1),l=t?tX.mod(o+s,a):r;n[l]=this.loadImage(e[l],i)}return Promise.all(n).then(()=>this.onLoadEnd(this.progress)).catch(()=>{}),n}async loadVideo(e,t,r,i){e.loop=r;let n=new Promise((r,n)=>{e.addEventListener("canplaythrough",()=>{i===this.loadingId&&(this.loaded+=1,this.onLoadProgress(this.progress),r()
1)},{once:!0}),e.addEventListener("error",e=>{i===this.loadingId&&n(`${e.type} : ${t}`)},{once:!0})});return e.src=t,e.load(),n}async loadVideoFrame(e,t,r,i,n){let o=0;return new Promise((a,s)=>{let l=()=>{if(n!==this.loadingId)return;if(o!==i){o+=1;return}e.removeEventListener("seeked",l);let s=document.createElement("canvas");s.width=e.videoWidth,s.height=e.videoHeight,s.getContext("2d").drawImage(e,0,0);let h=new Image;h.src=s.toDataURL(),a(h),this.loaded+=1,this.onLoadProgress(this.progress),i!==r-1&&(e.currentTime+=1/t)};e.addEventListener("seeked",l),e.addEventListener("error",e=>{n===this.loadingId&&s(e)},{once:!0})})}loadVideoFrames(e,t,r,i){this.total=t;let n=Array(t),o=document.createElement("video");for(let e=0;e<t;e+=1)n[e]=this.loadVideoFrame(o,r,t,e,i);return o.addEventListener("canplaythrough",()=>{i===this.loadingId&&(o.currentTime=1/r/2)},{once:!0}),o.src=e,o.load(),Promise.all(n).then(()=>this.onLoadEnd(this.progress)).catch(()=>{}),n}async loadImageHotspots(e,t){return this.webrenderV2?await this.webrenderV2.imageHotspots(await this.convert(e),t):Promise.reject(Error("Hotspots only available with api V2"))}async loadVRCubeHotspots(e,t){return this.webrenderV2?await this.webrenderV2.vrCubeHotspots(await this.convert(e),t):Promise.reject(Error("Hotspots only available with api V2"))}async loadVRObjectHotspots(e,t){return this.webrenderV2?await this.webrenderV2.vrObjectHotspots(await this.convert(e),t):Promise.reject(Error("Hotspots only available with api V2"))}async loadImagePick(e,t){return this.webrenderV2?await this.webrenderV2.imagePick(await this.convert(e),t):Promise.reject(Error("Picking only available with api V2"))}async loadVRObjectPick(e,t,r,i){return this.webrenderV2?await this.webrenderV2.imagePick(await this.vrObjectFrameSnapshot(e,r,i),t):Promise.reject(Error("Picking only available with api V2"))}async loadVRCubePick(e,t,r){return this.webrenderV2?await this.webrenderV2.imagePick(await this.vrCubeFrameSnapshot(e,r),t):Promise.reject(Error("Picking only available with api V2"))}async convert(e){if(!this.webrenderV2||this.webrender instanceof t0||!e.view.camera)return e;let t=e.scene.find(e=>!e.decor&&!e.accessory);if(!t)return e;let r=this.databases.find(e=>e.id===t.database);r&&r.xmlDoc||(r=await this.webrender.database(t.database),this.databases.push(r));let i=e.view.camera.split("/"),n=2===i.length?i[0]:void 0,o=2===i.length?i[1]:i[0],a=r.getCameraId(o,n);if(a)return{...e,view:{...e.view,camera:a}};{let t=r.getCameraGroupId(o);return t?{...e,view:{...e.view,cameraGroup:t}}:e}}async vrObjectFrameSnapshot(e,t,r){if(!this.webrenderV2)return e;let i=e.scene.find(e=>!e.decor&&!e.accessory);if(!i)return e;let n=this.databases.find(e=>e.id===i.database);if(n||(n=await this.webrender.database(i.database),this.databases.push(n)),this.webrender instanceof tK){if(!e.view.camera)return e;let r=n.getCameraGroupId(e.view.camera);if(!r)return e;let i=n.getCameraGroupById(r);if(!i)return e;let o=i.cameras[t];return o?{...e,view:{...e.view,camera:o.id}}:e}if(!(this.webrender instanceof t0))return e;{let i="string"==typeof e.view.camera?e.view.camera:e.view.camera?.id;if(i){let o=n.getCameraById(i);if(!o)return e;let a=new tQ(o.pointOfView),s=2*Math.PI/r;a.longitude+=t*s%(2*Math.PI);let l=a.pointOfView(o.pointOfView.target);return{...e,view:{...e.view,camera:{id:o.id,pov:{target:{x:l.target[0],y:l.target[1],z:l.target[2]},eye:{x:l.eye[0],y:l.eye[1],z:l.eye[2]},up:{x:l.up[0],y:l.up[1],z:l.up[2]}}}}}}if(!e.view.cameraGroup)return e;{let r=n.getCameraGroupById(e.view.cameraGroup);if(!r)return e;let i=r.cameras[t];return i?{...e,view:{...e.view,camera:i.id}}:e}}}async vrCubeFrameSnapshot(e,t){let r,i=e.scene.find(e=>!e.decor&&!e.accessory);if(!i)return e;let n=this.databases.find(e=>e.id===i.database);if(n||(n=await this.webrender.database(i.database),this.databases.push(n)),!e.view.camera)return e;if(this.webrender instanceof tK){let t=e.view.camera.split("/"),i=2===t.length?t[0]:void 0,o=2===t.length?t[1]:t[0];r=n.getCameraId(o,i)}else this.webrender instanceof t0&&(r="string"==typeof e.view.camera?e.view.camera:e.view.camera.id
1);if(!r)return e;let o=n.getCameraById(r);if(!o)return e;let a=tY.initCubeFace(o.pointOfView.eye,o.pointOfView.target,t);return{...e,view:{...e.view,camera:{id:o.id,pov:{target:{x:a.target[0],y:a.target[1],z:a.target[2]},eye:{x:a.eye[0],y:a.eye[1],z:a.eye[2]},up:{x:a.up[0],y:a.up[1],z:a.up[2]}},lens:{fov:90}}},parameters:{...e.parameters,width:Math.max(e.parameters.width,e.parameters.height),height:Math.max(e.parameters.width,e.parameters.height)}}}onLoadStart(e){this.delegate&&this.delegate.onLoadStart(e)}onLoadProgress(e){this.delegate&&this.delegate.onLoadProgress(e)}onLoadEnd(e){this.delegate&&this.delegate.onLoadEnd(e)}static isValidHttpUrl(e){let t;try{t=new URL(e)}catch{return!1}return"http:"===t.protocol||"https:"===t.protocol}}class t3{constructor(){this.element=document.createElement("video"),this.element.classList.add("ls-viewer-video"),this.element.style.opacity="0",this.element.width=0,this.element.height=0,this.element.setAttribute("muted",""),this.element.setAttribute("playsinline",""),this.element.setAttribute("preload","auto")}show(){this.element.style.opacity="1"}hide(){this.element.style.opacity="0"}resize(e,t,r,i){let n=tH.fit(r,new tG(e,t),i);this.element.style.top=`${n.top}px`,this.element.style.left=`${n.left}px`,this.element.style.width=`${n.width}px`,this.element.style.height=`${n.height}px`,(r.width!==this.element.width||r.height!==this.element.height)&&(this.element.width=r.width,this.element.height=r.height)}}class t2{constructor(e,t,r){this.container=e,this.canvas=t,this.loader=r,this.hotspotList=[]}destroy(){}show(){this.canvas.show(!1),this.container.classList.add("ls-viewer-container-image")}hide(){this.canvas.hide(!1),this.container.classList.remove("ls-viewer-container-image")}async load(e,t,r,i){let n=Promise.resolve(),o=JSON.stringify(e);n=o===this.snapshotHash&&this.image?n.then(()=>this.canvas.draw(this.image,i,.05)):n.then(()=>this.loader.loadImageSnapshot(e).then(e=>{this.canvas.draw(e,i,.05),this.image=e}));let a=JSON.stringify(t);return(o!==this.snapshotHash||a!==this.hotspotsHash)&&(t.length?n=n.then(()=>this.loader.loadImageHotspots(e,t).then(e=>{this.hotspotList=e})):this.hotspotList=[]),this.hotspotsHash=a,this.snapshotHash=o,n}async pick(e,t){let r=new tG(e.parameters.width,e.parameters.height),i=tH.unproject(r,this.canvas.resolution,this.canvas.fit,t);return this.loader.loadImagePick(e,i)}hotspots(e){return this.hotspotList.map(t=>({...t,position2D:tH.project(e,this.canvas.resolution,this.canvas.fit,t.position2D)})).map(e=>({...e,visibility:tH.contains(this.canvas.resolution,e.position2D)?e.visibility:"OutOfFrustum"}))}snapshot(e,t){return this.canvas.element.toDataURL(e,t)}onMouseDown(e){}onMouseMove(e){}onMouseUp(e){}onMouseEnter(e){}onTouchStart(e){}onTouchMove(e){}onTouchEnd(e){}onDeviceOrientation(e){}}class t6{constructor(e,t){this.x=e,this.y=t}clone(){return new t6(this.x,this.y)}}class t4{static pointFromMouseEvent(e){return new t6(e.screenX,e.screenY)}static pointFromTouchEvent(e){let t=e.targetTouches[0]||e.changedTouches[0];return new t6(t.screenX,t.screenY)}}class t5{constructor(...e){3===e.length?({0:this.u,1:this.v,2:this.o}=e,this.w=T.cross(this.u,this.v)):4===e.length?{0:this.u,1:this.v,2:this.w,3:this.o}=e:(this.u=[1,0,0],this.v=[0,1,0],this.w=[0,0,1],this.o=[0,0,0])}get localToGlobalMatrix(){return[this.u[0],this.u[1],this.u[2],0,this.v[0],this.v[1],this.v[2],0,this.w[0],this.w[1],this.w[2],0,this.o[0],this.o[1],this.o[2],1]}get globalToLocalMatrix(){return V.inverse(this.localToGlobalMatrix)}}class t8{constructor(e,t,r){this.x=e,this.y=t,this.time=r}}class t7{constructor(e){this.points=[],this.onMotion=e,this.lastPoint=new t6(0,0),this.velocity=new t6(0,0),this.loop=this.loop.bind(this)}destroy(){this.animationFrameId&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=void 0)}track(e){let t=Date.now();this.points=this.points.filter(e=>t-e.time<=100),this.points.push(new t8(e.x,e.y,t)),this.lastPoint=e}start(){if(0===this.points.length)return;let e=this.points[0],t=this.points[this.points.length-1],r=t.x-e.x,i=t.y-e.y,n=t.time-e.time;this.velocity=new t6(0===n?0:r/(n/15),0===n?0:i/(n/15)),this.animationFrameId&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=void 0),this.animationFrameId=requestAnimationFrame(this.loop)}stop(){this.animationFrameId&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=void 0),this.points=[]}loop(){if(1>Math.abs(this.velocity.x)&&1>Math.abs(this.velocity.y)){this.animationFrameId=void 0,this.points=[];return}this.lastPoint.x+=this.velocity.x,this.lastPoint.y+=this.velocity.y,this.velocity.x*=.9,this.velocity.y*=.9,this.onMotion(this.lastPoint.clone()),this.animationFrameId=requestAnimationFrame(this.loop)}}class t9{constructor(e,t,r){this.isStarted=!1,this.pov=e,this.fov=tX.degreesToRadians(t),this.orientationMatrix=V.identity(),this.inertia=new t7(this.motion.bind(this)),this.onMotion=r,this.initPov=this.pov,this.initFov=this.fov,this.initOrientation=tX.degreesToRadians(window.orientation)||0,this.startPov=new tY([0,0,1],[0,0,0],[0,1,0]),this.startSize={width:0,height:0},this.previousPoint=new t6(0,0)}destroy(){this.inertia.destroy()}get orientedPov(){let e=new t5(T.normalize(T.cross(this.pov.up,this.pov.target)),[0,1,0],this.pov.eye),t=V.identity();return V.multiply(t,e.localToGlobalMatrix,t),V.multiply(t,this.orientationMatrix,t),V.multiply(t,e.globalToLocalMatrix,t),new tY(V.transformDirection(t,this.pov.target),this.pov.eye,V.transformDirection(t,this.pov.up))}reset(){this.pov=this.initPov.clone(),this.fov=this.initFov}start(e,t){this.isStarted=!0,this.startPov=this.pov,this.startSize=t,this.previousPoint=e,this.inertia.stop()}motion(e){this.isStarted&&this.inertia.track(e);let t={x:e.x-this.previousPoint.x,y:e.y-this.previousPoint.y},r=tX.accelerate(t.x,1.3)/this.startSize.width*.2*Math.PI*1.5,i=tX.accelerate(t.y,1.3)/this.startSize.height*.2*Math.PI,n=V.multiply(V.rotationY(r),V.rotationX(-i)),o=new t5(T.normalize(T.cross(this.pov.up,this.pov.target)),[0,1,0],this.pov.eye),a=V.identity();V.multiply(a,o.localToGlobalMatrix,a),V.multiply(a,n,a),V.multiply(a,o.globalToLocalMatrix,a);let s=V.transformPoint(a,this.pov.target),l=V.transformDirection(a,this.pov.up);T.cross(l,[0,0,1])[0]>=0&&(this.pov.target=s,this.pov.up=l),this.previousPoint=e,this.onMotion()}end(e,t){this.isStarted=!1,t&&(this.inertia.track(e),this.inertia.start())}orientation(e,t,r){let i=tX.degreesToRadians(window.orientation)||0,n=tX.degreesToRadians(e),o=tX.degreesToRadians(-t),a=tX.degreesToRadians(-r),s=V.rotationX(tX.degreesToRadians(90));V.rotateZ(s,this.initOrientation,s),V.rotateZ(s,n,s),V.rotateX(s,o,s),V.rotateY(s,a,s),V.rotateZ(s,-i,s),this.orientationMatrix=s,this.onMotion()}}var re=`precision mediump float; 2
3uniform float u_mix; 4uniform samplerCube u_texture; 5uniform samplerCube u_texture_back; 6 7varying vec3 direction; 8 9void main() { 10 vec4 backColor = textureCube(u_texture_back, direction); 11 vec4 color = textureCube(u_texture, direction); 12 gl_FragColor = mix(backColor, color, u_mix); 13}`,rt=`attribute vec4 position; 14 15uniform mat4 u_mvpi; 16 17varying vec3 direction; 18 19void main() { 20 direction = (u_mvpi * position).xyz; 21 gl_Position = position; 22}`;class rr{constructor(e,t,r,i,n){this.container=e,this.canvas=t,this.loader=r,this.aspectRatioOverride=n,this.images=[],this.hotspotsList=[[]];const o=new tY([0,0,1],[0,0,0],[0,1,0]),a=V.rotationX(tX.degreesToRadians(15));V.transformDirection(a,o.target,o.target),V.transformDirection(a,o.up,o.up),this.interaction=new t9(o,60,()=>{this.animationFrameId=requestAnimationFrame(this.render),this.onInteraction({pov:this.interaction.pov.clone(),fov:this.interaction.fov})}),this.onInteraction=i,this.gl=this.canvas.context,this.programInfo=function(e,t){let r=tR(void 0,void 0,void 0),i=[];if(t=t.map(function(e){if(!tV.test(e)){let t=tc(e);if(t)e=t.text;else{let t=`no element with id: ${e}`;r.errorCallback(t),i.push(t)}}return e}),i.length)return r.errorCallback(""),r.callback&&setTimeout(()=>{r.callback(` 23${r.errors.join("\n")}`)}),null;let n=r.callback;n&&(r.callback=(t,r)=>{n(t,t?void 0:t_(e,r))});let o=function(e,t,r){let i=tR(r,void 0,void 0),n=new Set(t),o=function(e,t,r){let i=e.createProgram(),{attribLocations:n,transformFeedbackVaryings:o,transformFeedbackMode:a}=tR(r);for(let r=0;r<t.length;++r){let n=t[r];if("string"==typeof n){var s;let t=tc(n),i=t?t.text:n,o=e[tT[r]];t&&t.type&&(o=((s=t.type).indexOf("frag")>=0?35632:s.indexOf("vert")>=0?35633:void 0)||o),n=e.createShader(o),e.shaderSource(n,tS(i).shaderSource),e.compileShader(n)}e.attachShader(i,n)}Object.entries(n).forEach(([t,r])=>e.bindAttribLocation(i,r,t));{let t=o;t&&(t.attribs&&(t=t.attribs),Array.isArray(t)||(t=Object.keys(t)),e.transformFeedbackVaryings(i,t,a||35981))}return e.linkProgram(i),i}(e,t,i);function a(e,t){let r=function(e,t,r){if(r=r||q,!e.getProgramParameter(t,35714)){let i=e.getProgramInfoLog(t);r(`Error in program linking: ${i}`);let n=e.getAttachedShaders(t).map(t=>(function(e,t,r,i){if(i=i||q,!e.getShaderParameter(r,35713)){let n=e.getShaderInfoLog(r),{lineOffset:o,shaderSource:a}=tS(e.getShaderSource(r)),s=`${function(e,t="",r=0){let i=[...t.matchAll(tM)],n=new Map(i.map((e,r)=>{let n=parseInt(e[1]),o=i[r+1],a=o?o.index:t.length;return[n-1,t.substring(e.index,a)]}));return e.split("\n").map((e,t)=>{let i=n.get(t);return`${t+1+r}: ${e}${i?` 24 25^^^ ${i}`:""}`}).join("\n")}(a,n,o)} 26Error compiling ${eX(e,t)}: ${n}`;return i(s),s}return""})(e,e.getShaderParameter(t,e.SHADER_TYPE),t,r));return`${i} 27${n.filter(e=>e).join("\n")}`}}(e,t,i.errorCallback);return r&&function(e,t,r){for(let i of e.getAttachedShaders(t))r.has(i)||e.deleteShader(i);e.deleteProgram(t)}(e,t,n),r}return i.callback?void tk(e,o).then(()=>{let t=a(e,o);i.callback(t,t?void 0:o)}):a(e,o)?void 0:o}(e,t,r);return o?t_(e,o):null}(this.gl,[`${rt} 28`,`${re} 29`]),this.quad=eN.createXYQuadBufferInfo(this.gl),this.uniforms={u_mvpi:V.identity(),u_mix:0,u_texture_back:th(this.gl,{target:this.gl.TEXTURE_CUBE_MAP,minMag:this.gl.LINEAR,width:1,height:1}),u_texture:th(this.gl,{target:this.gl.TEXTURE_CUBE_MAP,minMag:this.gl.LINEAR,width:1,height:1})},this.render=this.render.bind(this)}destroy(){this.interaction.destroy(),this.animationFrameId&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=void 0)}show(){this.canvas.show(),this.container.classList.add("ls-viewer-container-vrcube")}hide(){this.canvas.hide(),this.container.classList.remove("ls-viewer-container-vrcube")}get pov(){return this.interaction.pov}set pov(e){this.interaction.pov.eye.every((t,r)=>t===e.eye[r])&&this.interaction.pov.target.every((t,r)=>t===e.target[r])&&this.interaction.pov.up.every((t,r)=>t===e.up[r])||(this.interaction.pov=e.clone(),this.animationFrameId=requestAnimationFrame(this.render))}get fov(){return tX.radiansToDegrees(this.interaction.fov)}set fov(e){this.interaction.fov!==e&&(this.interaction.fov=tX.degreesToRadians(e),this.animationFrameId=requestAnimationFrame(this.render))}async load(e,t,r,i){let n=Promise.resolve();{let t=this.gl.getExtension("WEBGL_debug_renderer_info");t&&"MacIntel"===navigator.platform&&navigator.userAgent.includes("Chrome")&&this.gl.getParameter(t.UNMASKED_RENDERER_WEBGL).includes("OpenGL")&&(e.parameters.width=Math.min(e.parameters.width,1812),e.parameters.height=Math.min(e.parameters.height,1812))}let o=JSON.stringify(e);o===this.snapshotHash?n=n.then(()=>(this.animationFrameId=requestAnimationFrame(this.render),Promise.resolve())):(this.images=[],this.animationFrameId=requestAnimationFrame(this.render),n=n.then(()=>this.loader.loadVRCubeSnapshot(e).then(e=>{this.images=e,th(this.gl,{target:this.gl.TEXTURE_CUBE_MAP,min:this.gl.LINEAR_MIPMAP_LINEAR,minMag:this.gl.LINEAR,cubeFaceOrder:[this.gl.TEXTURE_CUBE_MAP_POSITIVE_Z,this.gl.TEXTURE_CUBE_MAP_POSITIVE_X,this.gl.TEXTURE_CUBE_MAP_NEGATIVE_Z,this.gl.TEXTURE_CUBE_MAP_NEGATIVE_X,this.gl.TEXTURE_CUBE_MAP_POSITIVE_Y,this.gl.TEXTURE_CUBE_MAP_NEGATIVE_Y],src:e},(e,t)=>{e||(r&&this.interaction.reset(),this.uniforms.u_mix=+!i,this.uniforms.u_texture_back=this.uniforms.u_texture,this.uniforms.u_texture=t,this.animationFrameId=requestAnimationFrame(this.render))})})));let a=JSON.stringify(t);
29return(o!==this.snapshotHash||a!==this.hotspotsHash)&&(t.length?n=n.then(()=>this.loader.loadVRCubeHotspots(e,t).then(e=>{this.hotspotsList=e})):this.hotspotsList=[[]]),this.hotspotsHash=a,this.snapshotHash=o,n}async pick(e,t){let r=this.canvas.element.clientWidth,i=this.canvas.element.clientHeight,n=t.x,o=i-t.y,a=this.modelViewProjectionMatrix,s=V.inverse(a),l=T.normalize(V.transformPoint(s,[2*n/r-1,2*o/i-1,0])),h=Math.max(Math.abs(l[0]),Math.abs(l[1]),Math.abs(l[2])),c="";c=Math.abs(l[0])===h?l[0]>0?"XPOS":"XNEG":Math.abs(l[1])===h?l[1]>0?"YPOS":"YNEG":l[2]>0?"ZPOS":"ZNEG";let u=0,d=0,m="";switch(c){case"XPOS":u=(-l[2]/Math.abs(l[0])+1)/2,d=(-l[1]/Math.abs(l[0])+1)/2,m="right";break;case"XNEG":u=(l[2]/Math.abs(l[0])+1)/2,d=(-l[1]/Math.abs(l[0])+1)/2,m="left";break;case"YPOS":u=(l[0]/Math.abs(l[1])+1)/2,d=(l[2]/Math.abs(l[1])+1)/2,m="up";break;case"YNEG":u=(l[0]/Math.abs(l[1])+1)/2,d=(-l[2]/Math.abs(l[1])+1)/2,m="down";break;case"ZPOS":u=(l[0]/Math.abs(l[2])+1)/2,d=(-l[1]/Math.abs(l[2])+1)/2,m="front";break;case"ZNEG":u=(-l[0]/Math.abs(l[2])+1)/2,d=(-l[1]/Math.abs(l[2])+1)/2,m="back"}let p={x:Math.round(u*Math.max(e.parameters.width,e.parameters.height)),y:Math.round(d*Math.max(e.parameters.width,e.parameters.height))};return this.loader.loadVRCubePick(e,p,m)}hotspots(){let e=[];
29if(0===this.hotspotsList.length)return[];let t=this.hotspotsList[0]?.length??0,r=this.modelViewProjectionMatrix;for(let i=0;i<t;i++){let t=this.hotspotsList.findIndex(e=>"OutOfFrustum"!==e[i].visibility);if(-1===t)continue;let n={...this.hotspotsList[t][i]},o=n.position2D.x/this.images[0].width,a=n.position2D.y/this.images[0].height,s=0,l=0,h=0;switch(t){case 0:this.pov.target[2]<0&&(n.visibility="OutOfFrustum"),s=2*o-1,l=1-2*a,h=1;break;case 1:this.pov.target[0]>0&&(n.visibility="OutOfFrustum"),s=1,l=1-2*a,h=1-2*o;break;case 2:this.pov.target[2]>0&&(n.visibility="OutOfFrustum"),s=1-2*o,l=1-2*a,h=-1;break;case 3:this.pov.target[0]<0&&(n.visibility="OutOfFrustum"),s=-1,l=1-2*a,h=2*o-1;break;case 4:this.pov.target[1]<0&&(n.visibility="OutOfFrustum"),s=2*o-1,l=1,h=2*a-1;break;case 5:this.pov.target[1]>0&&(n.visibility="OutOfFrustum"),s=2*o-1,l=-1,h=1-2*a}let c=T.normalize([s,l,h]),u=V.transformPoint(r,c),d=this.canvas.element.clientWidth,m=this.canvas.element.clientHeight,p=.5*d*(u[0]+1),f=.5*m*(u[1]+1),b={x:Math.round(p),y:Math.round(m-f)},g=new tG(d,m),v=tH.contains(g,b)?n.visibility:"OutOfFrustum";e.push({...n,position2D:b,visibility:v})}return e}snapshot(e,t){return this.canvas.element.toDataURL(e,t)}get modelViewProjectionMatrix(){let e=this.canvas.element.clientWidth,t=this.canvas.element.clientHeight,r=e>t?e/t:t/e,i=tH.getStandardAspectRatio(e,t,this.aspectRatioOverride),n=this.interaction.fov*(i/r),o=V.setAxis(V.identity(),[-1,0,0],0),a=e>t?tX.perspectiveWithFovY(n,e/t,.5,100):tX.perspectiveWithFovX(n,e/t,.5,100),s=this.interaction.orientedPov,l=V.inverse(V.lookAt(s.eye,s.target,s.up));return V.multiply(V.multiply(a,l),o)}render(){var e,t,r,i,n,o,a;let s,l,h;this.gl.viewport(0,0,this.gl.canvas.width,this.gl.canvas.height),this.uniforms.u_mvpi=V.inverse(this.modelViewProjectionMatrix),this.gl.useProgram(this.programInfo.program),e=this.gl,t=this.programInfo,(r=this.quad).vertexArrayObject?e.bindVertexArray(r.vertexArrayObject):(!function(e,t){for(let r in t){let i=e[r];i&&i(t[r])}}(t.attribSetters||t,r.attribs),r.indices&&e.bindBuffer(34963,r.indices)),function e(t,...r){let i=t.uniformSetters||t,n=r.length;for(let t=0;t<n;++t){let n=r[t];if(Array.isArray(n)){let t=n.length;for(let r=0;r<t;++r)e(i,n[r])}else for(let e in n){let t=i[e];t&&t(n[e])}}}(this.programInfo,this.uniforms),i=this.gl,n=this.quad,o=void 0===o?4:o,s=n.indices,l=n.elementType,h=n.numElements,a=void 0===a?0:a,l||s?i.drawElements(o,h,void 0===l?5123:n.elementType,a):i.drawArrays(o,a,h),this.uniforms.u_mix<1&&(this.uniforms.u_mix=Math.min(this.uniforms.u_mix+.05,1),this.animationFrameId=requestAnimationFrame(this.render))}onMouseDown(e){this.container.classList.add("ls-viewer-container-vrcube-grabbing"),this.interaction.start(t4.pointFromMouseEvent(e),{width:this.gl.canvas.width,height:this.gl.canvas.height})}onMouseMove(e){this.interaction.isStarted&&(this.interaction.motion(t4.pointFromMouseEvent(e)),e.preventDefault())}onMouseUp(e){this.interaction.isStarted&&(this.container.classList.remove("ls-viewer-container-vrcube-grabbing"),this.interaction.end(t4.pointFromMouseEvent(e),!0))}onMouseEnter(e){this.interaction.isStarted&&0===e.buttons&&(this.container.classList.remove("ls-viewer-container-vrcube-grabbing"),this.interaction.end(t4.pointFromMouseEvent(e),!1))}onTouchStart(e){this.container.classList.add("ls-viewer-container-vrcube-grabbing"),this.interaction.start(t4.pointFromTouchEvent(e),{width:this.gl.canvas.width,height:this.gl.canvas.height})}onTouchMove(e){this.interaction.isStarted&&(this.interaction.motion(t4.pointFromTouchEvent(e)),e.preventDefault())}onTouchEnd(e){this.interaction.isStarted&&(this.container.classList.remove("ls-viewer-container-vrcube-grabbing"),this.interaction.end(t4.pointFromTouchEvent(e),!0))}onDeviceOrientation(e){this.interaction.orientation(e.alpha,e.beta,e.gamma)}}class ri{constructor(e,t,r,i,n){this.isStarted=!1,this.position=e,this.frames=t,this.rows=r,this.loop=i,this.onMotion=n,this.inertia=new t7(this.motion.bind(this)),this.initPosition={...this.position},this.startPosition={x:0,y:0},this.startPoint=new t6(0,0),this.startSize={width:0,height:0},this.lastPoints=[],this.lastPointsNumber=20}destroy(){this.inertia.destroy()}reset(){this.position={...this.initPosition}}get positionIndex(){return this.frames*this.position.y+this.position.x}set positionIndex(e){if(this.positionIndex===e)return;let t=this.loop?tX.mod(e,this.frames*this.rows):Math.max(0,Math.min(e,this.frames*this.rows));this.position.x=tX.mod(t,this.frames),this.position.y=Math.floor(t/this.frames)}start(e,t){this.isStarted=!0,this.startPosition={...this.position},this.startPoint=e,this.startSize=t,this.lastPoints=[],this.inertia.stop()}motion(e){if(this.isStarted&&this.inertia.track(e),this.lastPoints.push({x:e.x,y:e.y}),this.lastPoints.splice(0,this.lastPoints.length-this.lastPointsNumber),1>Math.abs(t$.linear(this.lastPoints.map(e=>[e.x,e.y])).equation[0])){let t=tX.accelerate(e.x-this.startPoint.x,1.3)/this.startSize.width*(this.frames/4),r=this.startPosition.x-Math.round(t);(r=this.loop?tX.mod(r,this.frames):Math.max(0,Math.min(r,this.frames-1)))!==this.position.x&&(this.position.x=r,this.onMotion());let i=Math.min(...this.lastPoints.map(e=>e.x));Math.max(...this.lastPoints.map(e=>e.x))-i>25&&(this.startPoint.y=e.y,this.startPosition.y=this.position.y)}else{let t=tX.accelerate(e.y-this.startPoint.y,1.7)/this.startSize.height*(this.rows/4),r=this.startPosition.y+Math.round(t);(r=Math.max(0,Math.min(r,this.rows-1)))!==this.position.y&&(this.position.y=r,this.onMotion());let i=Math.min(...this.lastPoints.map(e=>e.y));Math.max(...this.lastPoints.map(e=>e.y))-i>25&&(this.startPoint.x=e.x,this.startPosition.x=this.position.x)}}end(e,t){this.isStarted=!1,t&&(this.inertia.track(e),this.inertia.start())}}
29class rn{constructor(e,t,r,i){this.container=e,this.canvas=t,this.loader=r,this.images=[],this.frames=24,this.hotspotsList=[[]],this.interaction=new ri({x:0,y:0},1,1,!1,()=>{this.canvas.draw(this.image,!0,.5),this.onInteraction({position:this.interaction.positionIndex})}),this.onInteraction=i}destroy(){this.animationFrameId&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=void 0)}show(){this.canvas.show(!1),this.container.classList.add("ls-viewer-container-vrobject")}hide(){this.canvas.hide(!1),this.container.classList.remove("ls-viewer-container-vrobject")}async goto(e){return new Promise(t=>{let r=this.interaction.positionIndex,i=()=>{if(this.interaction.positionIndex===e)t();else{let t=r>e?-1:1;this.interaction.loop&&this.interaction.frames-r+e<Math.abs(e-r)&&(t*=-1),r+=.5*t,this.position=Math.floor(r),this.animationFrameId=requestAnimationFrame(i)}};this.animationFrameId=requestAnimationFrame(i)})}get position(){return this.interaction.positionIndex}set position(e){this.interaction.positionIndex=e,this.canvas.draw(this.image,!0,.5)}get image(){return this.images[this.interaction.positionIndex]}async load(e,t,r,i){let n=Promise.resolve();r&&this.interaction.reset();let o=JSON.stringify(e);o===this.snapshotHash&&this.image?n=n.then(()=>this.canvas.draw(this.image,i,.05)):(this.images=[],n=n.then(()=>this.loader.loadVRObjectSnapshot(e,this.interaction.positionIndex).then(t=>{let n=t.length;return this.images=Array(n),this.interaction.frames=e.view.frames??e.view.panFrames??this.frames,this.interaction.rows=n/this.interaction.frames,this.interaction.loop=!!e.view.loop,r&&this.interaction.reset(),t.forEach((e,t)=>{e.then(e=>{this.images[t]=e,e===this.image&&this.canvas.draw(this.image,i,.05)}).catch(()=>{})}),t[this.interaction.positionIndex].then(()=>Promise.resolve())})));let a=JSON.stringify(t);return(o!==this.snapshotHash||a!==this.hotspotsHash)&&(t.length?n=n.then(()=>this.loader.loadVRObjectHotspots(e,t).then(e=>{this.hotspotsList=e})):this.hotspotsList=[[]]),this.hotspotsHash=a,this.snapshotHash=o,n}async pick(e,t){let r=new tG(e.parameters.width,e.parameters.height),i=tH.unproject(r,this.canvas.resolution,this.canvas.fit,t);return this.loader.loadVRObjectPick(e,i,this.position,this.frames)}hotspots(e){return(this.hotspotsList[this.interaction.positionIndex]||[]).map(t=>({...t,position2D:tH.project(e,this.canvas.resolution,this.canvas.fit,t.position2D)})).map(e=>({...e,visibility:tH.contains(this.canvas.resolution,e.position2D)?e.visibility:"OutOfFrustum"}))}snapshot(e,t){return this.canvas.element.toDataURL(e,t)}onMouseDown(e){this.container.classList.add("ls-viewer-container-vrobject-grabbing"),this.interaction.start(t4.pointFromMouseEvent(e),{width:this.canvas.element.width,height:this.canvas.element.height})}onMouseMove(e){this.interaction.isStarted&&(this.interaction.motion(t4.pointFromMouseEvent(e)),e.preventDefault())}onMouseUp(e){this.interaction.isStarted&&(this.container.classList.remove("ls-viewer-container-vrobject-grabbing"),this.interaction.end(t4.pointFromMouseEvent(e),!0))}onMouseEnter(e){this.interaction.isStarted&&0===e.buttons&&(this.container.classList.remove("ls-viewer-container-vrobject-grabbing"),this.interaction.end(t4.pointFromMouseEvent(e),!1))}onTouchStart(e){this.container.classList.add("ls-viewer-container-vrobject-grabbing"),this.interaction.start(t4.pointFromTouchEvent(e),{width:this.canvas.element.width,height:this.canvas.element.height})}onTouchMove(e){this.interaction.isStarted&&(this.interaction.motion(t4.pointFromTouchEvent(e)),e.preventDefault())}onTouchEnd(e){this.interaction.isStarted&&(this.container.classList.remove("ls-viewer-container-vrobject-grabbing"),this.interaction.end(t4.pointFromTouchEvent(e),!0))}onDeviceOrientation(e){}}class ro{constructor(e,t,r){this.container=e,this.loader=r,this.video=t}destroy(){}show(){this.video.show(),this.container.classList.add("ls-viewer-container-video")}hide(){this.video.hide(),this.container.classList.remove("ls-viewer-container-video")}async load(e){let t=JSON.stringify(e);return t===this.hash?(this.video.element.load(),Promise.resolve()):(this.hash=t,this.loader.loadVideoSnapshot(this.video.element,e))}async pick(e,t){return Promise.reject()}hotspots(e){return[]}snapshot(e,t){return"data:image/gif;base64,R0lGODlhAQABAIAAAP7//wAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw=="}async play(){return new Promise((e,t)=>
29{this.video.element.addEventListener("ended",()=>{e()},{once:!0}),this.video.element.play().catch(t),this.show()})}onMouseDown(e){}onMouseMove(e){}onMouseUp(e){}onMouseEnter(e){}onTouchStart(e){}onTouchMove(e){}onTouchEnd(e){}onDeviceOrientation(e){}}class ra{constructor(e,t){this.onDeviceOrientation=this.onDeviceOrientation.bind(this),this.onResize=this.onResize.bind(this),this.onMouseDown=this.onMouseDown.bind(this),this.onMouseMove=this.onMouseMove.bind(this),this.onMouseUp=this.onMouseUp.bind(this),this.onMouseEnter=this.onMouseEnter.bind(this),this.onTouchStart=this.onTouchStart.bind(this),this.onTouchMove=this.onTouchMove.bind(this),this.onTouchEnd=this.onTouchEnd.bind(this),this.onLoadStart=this.onLoadStart.bind(this),this.onLoadProgress=this.onLoadProgress.bind(this),this.onLoadEnd=this.onLoadEnd.bind(this),this.onLoadError=this.onLoadError.bind(this),this.onHotspotsChange=this.onHotspotsChange.bind(this),this.onVrcubeInteraction=this.onVrcubeInteraction.bind(this),this.onVrobjectInteraction=this.onVrobjectInteraction.bind(this),this.options={server:"localhost",api:"v1",autores:!0,fit:"cover",image:{},video:{},vrcube:{},vrobject:{},events:{},...t},this.options.events={onLoadStart:()=>{},onLoadProgress:()=>{},onLoadEnd:()=>{},onLoadError:()=>{},onInteraction:()=>{},onVrcubeInteraction:()=>{},onVrobjectInteraction:()=>{},onHotspotsChange:()=>{},...t.events},this.options.events.onLoadError=x(this.options.events.onLoadError,10),this.container=e,this.container.classList.add("ls-viewer-container"),this.canvas2D=new tN(this.options.fit),this.container.prepend(this.canvas2D.element),this.canvas3D=new tW,this.container.prepend(this.canvas3D.element),this.video=new t3,this.container.prepend(this.video.element),this.loader=new t1(this.options.server,this.options.api,this),this.resolution=new tG(0,0),this.parameters={width:0,height:0,antialiasing:!1,superSampling:2},this.encoder={format:"jpeg",quality:80},this.hotspots=[],this.widgetImage=new t2(e,this.canvas2D,this.loader),this.widgetVideo=new ro(e,this.video,this.loader),this.widgetVRObject=new rn(e,this.canvas2D,this.loader,this.onVrobjectInteraction),this.canvas3D.context&&(this.widgetVRCube=new rr(e,this.canvas3D,this.loader,this.onVrcubeInteraction,this.aspectRatioOverride)),this.widget=this.widgetImage,this.container.addEventListener("mousedown",this.onMouseDown),this.container.addEventListener("mouseenter",this.onMouseEnter),this.container.addEventListener("touchstart",this.onTouchStart),document.addEventListener("mousemove",this.onMouseMove,{passive:!1}),document.addEventListener("mouseup",this.onMouseUp),document.addEventListener("touchmove",this.onTouchMove,{passive:!1}),document.addEventListener("touchend",this.onTouchEnd),this.loadWidget=x(this.loadWidget,10),this.resizeObserver=new ResizeObserver(this.onResize),this.resizeObserver.observe(this.container)}destroy(){this.resizeObserver.disconnect(),this.canvas2D.destroy(),this.container.removeEventListener("mousedown",this.onMouseDown),this.container.removeEventListener("mouseenter",this.onMouseEnter),this.container.removeEventListener("touchstart",this.onTouchStart),document.removeEventListener("mousemove",this.onMouseMove),document.removeEventListener("mouseup",this.onMouseUp),document.removeEventListener("touchmove",this.onTouchMove),document.removeEventListener("touchend",this.onTouchEnd)}async load(e,t){let r=Promise.resolve();return t?.animation&&(r=r.then(()=>this.loadAnimation(t.animation))),this.view&&t?.fromPosition!==void 0&&this.viewWidget instanceof rn&&(this.view.mode,r=r.then(()=>this.viewWidget.goto(t.fromPosition))),t?.animation&&(r=r.then(()=>this.widgetVideo.play())),(r=r.then(()=>(this.scene=Array.isArray(e)?[...e]:[e],this.loadWidget(!1,!(t&&t.animation))))).catch(e=>{this.onLoadError(e)}),r}async setEncoder(e){this.encoder={...e};let t=Promise.resolve();return(t=t.then(()=>this.loadWidget(!1,!0))).catch(e=>{this.onLoadError(e)}),t}setParameters(e){if(e.width&&e.height){this.resolution=new tG(e.width,e.height);let t=this.container.clientWidth,r=this.container.clientHeight;this.canvas2D.resize(t,r,this.getCanvas2DPixelRatio(t,r))}this.parameters={...e},this.parameters.width=this.resolution.width,this.parameters.height=this.resolution.height;let t=Promise.resolve();return(t=t.then(()=>this.loadWidget(!1,!0))).catch(e=>{this.onLoadError(e)}),t}setHotspots(e){this.hotspots=e,this.loadWidget(!1,!1)}async setView(e,t){let r=Promise.resolve();return t?.animation&&(r=r.then(()=>this.loadAnimation(t.animation))),this.view&&t?.fromPosition!==void 0&&this.viewWidget instanceof rn&&(r=r.then(()=>this.viewWidget.goto(t.fromPosition))),t?.animation&&(r=r.then(()=>this.widgetVideo.play())),(r=r.then(()=>{let r=!0;return this.view={...e},this.view&&this.viewWidget instanceof rn&&t?.toPosition!==void 0&&(r=!1,this.viewWidget.position=t.toPosition),this.loadWidget(r,!(t&&t.animation))})).catch(e=>{this.onLoadError(e)}),r}setVrcube(e){this.widgetVRCube&&Object.assign(this.widgetVRCube,e)}setVrobject(e){Object.assign(this.widgetVRObject,e)}async loadAnimation(e){let t={scene:this.scene,view:{animation:e.name,camera:e.camera,duration:e.duration,loop:e.loop,reverse:e.reverse},parameters:this.parameters,encoder:{format:"mp4"}};return t.view?.background||(t.view.background="product"),this.widgetVideo.load(t).then(()=>Promise.resolve())}async playAnimation(e){return this.loadAnimation(e).then(()=>this.widgetVideo.play()).catch(e=>{this.onLoadError(e)})}stopAnimation(){this.widgetVideo.hide()}async pick(e){if(!this.scene)throw Error("No scene set");if(!this.view)throw Error("No view set");if(!this.view.camera&&!this.view.cameraGroup)throw Error("No camera set");let t={scene:this.scene,view:this.view,parameters:this.parameters,encoder:this.encoder};return await this.viewWidget.pick(t,e)}async pickHotspot(e){let t=await this.pick(e),r=Object.values(t.point),i=T.normalize(Object.values(t.normal)),n=T.add(r,T.mulScalar(i,.01));return t.point={x:n[0],y:n[1],z:n[2]},t}snapshot(e,t){return this.viewWidget.snapshot(e,t)}async loadWidget(e,t){if(!this.scene||!this.view||!this.parameters.width||!this.parameters.height)return Promise.resolve();let r=this.viewWidget;if(!r)return Promise.reject(Error("Unknown view mode"));let i={scene:this.scene,view:this.view,parameters:this.parameters,encoder:this.encoder};return i.view.background||(i.view.background="product"),r.load(i,this.hotspots,e,t).then(()=>{this.widget.hide(),this.widget=r,this.widget.show(),this.widgetVideo.hide(),this.onHotspotsChange()})}get aspectRatioOverride(){switch(this.options.aspectRatio){case"4:3":return 4/3;case"16:9":return 16/9;default:return}}get viewWidget(){switch(this.view?.mode){case"image":default:return this.widgetImage;case"video":return this.widgetVideo;case"vrcube":return this.widgetVRCube??this.widgetImage;case"vrobject":return this.widgetVRObject}}onMouseDown(e){this.widget.onMouseDown(e)}onMouseEnter(e){this.widget.onMouseEnter(e)}onMouseMove(e){this.widget.onMouseMove(e)}onMouseUp(e){this.widget.onMouseUp(e)}onTouchStart(e){this.widget.onTouchStart(e)}onTouchMove(e){this.widget.onTouchMove(e)}onTouchEnd(e){this.widget.onTouchEnd(e)}onDeviceOrientation(e){this.widget.onDeviceOrientation(e)}getCanvas2DPixelRatio(e,t){return e<=0||t<=0||this.resolution.width<=0||this.resolution.height<=0?window.devicePixelRatio:Math.min(window.devicePixelRatio,this.resolution.width/e,this.resolution.height/t)}onResize(){let e=this.container.clientWidth,t=this.container.clientHeight;this.options.autores&&(this.resolution=tH.getStandardResolution(e*window.devicePixelRatio,t*window.devicePixelRatio,this.aspectRatioOverride),this.parameters.width=this.resolution.width,this.parameters.height=this.resolution.height),this.canvas2D.resize(e,t,this.getCanvas2DPixelRatio(e,t)),this.canvas3D.resize(e,t,window.devicePixelRatio),this.video.resize(e,t,this.resolution,this.options.fit),this.loadWidget(!1,!1).then(()=>{this.onHotspotsChange()}).catch(e=>{this.onLoadError(e)})}onVrcubeInteraction(...e){this.onHotspotsChange(),this.options.events.onInteraction(...e),this.options.events.onVrcubeInteraction(...e)}onVrobjectInteraction(e){this.onHotspotsChange(),this.options.events.onInteraction(e.position),this.options.events.onVrobjectInteraction(e.position)}onHotspotsChange(){let e=this.widget.hotspots(this.resolution);e.length&&this.options.events.onHotspotsChange(e)}onLoadStart(...e){this.container.classList.add("ls-viewer-container-loading"),this.options.events.onLoadStart(...e)}onLoadProgress(...e){this.options.events.onLoadProgress(...e)}onLoadEnd(...e){this.container.classList.remove("ls-viewer-container-loading"),this.options.events.onLoadEnd(...e)}onLoadError(...e){this.container.classList.remove("ls-viewer-container-loading"),this.options.events.onLoadError(...e)}}(u=(c=b||(b={})).HotspotVisibility||(c.HotspotVisibility={})).Visible="Visible",u.Occluded="Occluded",u.Clipped="Clipped",u.OutOfFrustum="OutOfFrustum",(d=c.SunShadowQualityMode||(c.SunShadowQualityMode={})).VeryLow="veryLow",d.Low="low",d.Medium="medium",d.Fine="fine",d.Ultra="ultra",(m=c.SunShadowSmoothnessMode||(c.SunShadowSmoothnessMode={})).None="none",m.Weak="weak",m.Normal="normal",m.Fine="fine",m.UltraFine="ultraFine",m.Max="max",(p=c.SunUseCaseMode||(c.SunUseCaseMode={})).Manual="manual",p.TimeAndLoc="timeAndLoc",p.ExtractedFromEnv="extractedFromEnv",(f=c.SurfacesFilterMode||(c.SurfacesFilterMode={})).ShowOnly="showOnly",f.HideOnly="hideOnly";var rs=r(20987);let rl=({api:e="v1",className:t,encoder:r={format:"jpeg",quality:90},fit:i="cover",onInteraction:n=()=>{},onLoadEnd:o=()=>{},onLoadError:a=()=>{},onLoadProgress:s=()=>{},onLoadStart:l=()=>{},onVrcubeInteraction:h=()=>{},onVrobjectInteraction:c=()=>{},parameters:u={antialiasing:!1,superSampling:2},scene:d,server:m,style:p,transition:f,view:b,vrcube:y={},vrobject:x={}})=>{let F=(0,v.useRef)(null),E=(0,v.useRef)(null),P=(0,v.useRef)(d),M=(0,v.useRef)(b),A=(0,v.useRef)(y),S=(0,v.useRef)(x);return(0,rs.A)(()=>
29{F.current&&(E.current=new ra(F.current,{server:m,api:e,fit:i,events:{onLoadStart:l,onLoadProgress:s,onLoadEnd:o,onLoadError:a,onInteraction:n,onVrcubeInteraction:h,onVrobjectInteraction:c},vrcube:y,vrobject:x}),d&&E.current.load(d),r&&E.current.setEncoder(r),u&&E.current.setParameters(u),b&&E.current.setView(b,f))}),(0,v.useEffect)(()=>()=>{E.current?.destroy()},[]),(0,v.useEffect)(()=>{E.current&&(!w()(P.current,d)&&d&&E.current.load(d,f),!w()(A.current,y)&&y&&E.current.setVrcube(y),!w()(S.current,x)&&x&&E.current.setVrobject(x),!w()(M.current,b)&&b&&E.current.setView(b,f),P.current=d,A.current=y,S.current=x,M.current=b)},[d,b,y,x,f]),(0,g.jsx)("div",{className:t,style:p,ref:F})}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.