/*!For license information please see LICENSES*/(window.webpackJsonp=window.webpackJsonp||[]).push([[6],{356:function(e,t,r){"use strict";r.d(t,"a",(function(){return Y})),r.d(t,"b",(function(){return qr})),r.d(t,"c",(function(){return Dr})),r.d(t,"d",(function(){return Bt})),r.d(t,"e",(function(){return Lt})),r.d(t,"f",(function(){return _r})),r.d(t,"g",(function(){return Zr})),r.d(t,"h",(function(){return Jr})),r.d(t,"i",(function(){return Br})),r.d(t,"j",(function(){return Mr}));let n=Float32Array;function o(e,t,r){const o=new n(3);return e&&(o[0]=e),t&&(o[1]=t),r&&(o[2]=r),o}function l(a,b,e){return(e=e||new n(3))[0]=a[0]+b[0],e[1]=a[1]+b[1],e[2]=a[2]+b[2],e}function c(a,b,e){return(e=e||new n(3))[0]=a[0]*b[0],e[1]=a[1]*b[1],e[2]=a[2]*b[2],e}let f=Float32Array;function m(e){return(e=e||new f(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 d(e,t){t=t||new f(16);const r=e[0],n=e[1],o=e[2],l=e[3],c=e[4],m=e[5],d=e[6],y=e[7],h=e[8],x=e[9],v=e[10],w=e[11],F=e[12],A=e[13],E=e[14],P=e[15],T=v*P,S=E*w,R=d*P,z=E*y,I=d*w,C=v*y,M=o*P,k=E*l,U=o*w,B=v*l,O=o*y,L=d*l,D=h*A,_=F*x,$=c*A,j=F*m,W=c*x,V=h*m,N=r*A,G=F*n,H=r*x,Y=h*n,X=r*m,K=c*n,J=T*m+z*x+I*A-(S*m+R*x+C*A),Z=S*n+M*x+B*A-(T*n+k*x+U*A),Q=R*n+k*m+O*A-(z*n+M*m+L*A),ee=C*n+U*m+L*x-(I*n+B*m+O*x),te=1/(r*J+c*Z+h*Q+F*ee);return t[0]=te*J,t[1]=te*Z,t[2]=te*Q,t[3]=te*ee,t[4]=te*(S*c+R*h+C*F-(T*c+z*h+I*F)),t[5]=te*(T*r+k*h+U*F-(S*r+M*h+B*F)),t[6]=te*(z*r+M*c+L*F-(R*r+k*c+O*F)),t[7]=te*(I*r+B*c+O*h-(C*r+U*c+L*h)),t[8]=te*(D*y+j*w+W*P-(_*y+$*w+V*P)),t[9]=te*(_*l+N*w+Y*P-(D*l+G*w+H*P)),t[10]=te*($*l+G*y+X*P-(j*l+N*y+K*P)),t[11]=te*(V*l+H*y+K*w-(W*l+Y*y+X*w)),t[12]=te*($*v+V*E+_*d-(W*E+D*d+j*v)),t[13]=te*(H*E+D*o+G*v-(N*v+Y*E+_*o)),t[14]=te*(N*d+K*E+j*o-(X*E+$*o+G*d)),t[15]=te*(X*v+W*o+Y*d-(H*d+K*v+V*o)),t}function y(e,t,r){r=r||o();const n=t[0],l=t[1],c=t[2],f=n*e[3]+l*e[7]+c*e[11]+e[15];return r[0]=(n*e[0]+l*e[4]+c*e[8]+e[12])/f,r[1]=(n*e[1]+l*e[5]+c*e[9]+e[13])/f,r[2]=(n*e[2]+l*e[6]+c*e[10]+e[14])/f,r}function h(e,t,r){r=r||o();const n=t[0],l=t[1],c=t[2];return r[0]=n*e[0]+l*e[4]+c*e[8],r[1]=n*e[1]+l*e[5]+c*e[9],r[2]=n*e[2]+l*e[6]+c*e[10],r}const x=5120,v=5121,w=5122,F=5123,A=5124,E=5125,P=5126,T={};{const e=T;e[x]=Int8Array,e[5121]=Uint8Array,e[5122]=Int16Array,e[5123]=Uint16Array,e[A]=Int32Array,e[5125]=Uint32Array,e[5126]=Float32Array,e[32819]=Uint16Array,e[32820]=Uint16Array,e[33635]=Uint16Array,e[5131]=Uint16Array,e[33640]=Uint32Array,e[35899]=Uint32Array,e[35902]=Uint32Array,e[36269]=Uint32Array,e[34042]=Uint32Array}function S(e){if(e instanceof Int8Array)return x;if(e instanceof Uint8Array)return v;if(e instanceof Uint8ClampedArray)return v;if(e instanceof Int16Array)return w;if(e instanceof Uint16Array)return F;if(e instanceof Int32Array)return A;if(e instanceof Uint32Array)return E;if(e instanceof Float32Array)return P;throw new Error("unsupported typed array type")}function R(e){if(e===Int8Array)return x;if(e===Uint8Array)return v;if(e===Uint8ClampedArray)return v;if(e===Int16Array)return w;if(e===Uint16Array)return F;if(e===Int32Array)return A;if(e===Uint32Array)return E;if(e===Float32Array)return P;throw new Error("unsupported typed array type")}function z(e){const t=T[e];if(!t)throw new Error("unknown gl type");return t}const I="undefined"!=typeof SharedArrayBuffer?function(a){return a&&a.buffer&&(a.buffer instanceof ArrayBuffer||a.buffer instanceof SharedArrayBuffer)}:function(a){return a&&a.buffer&&a.buffer instanceof ArrayBuffer};function C(...e){console.error(...e)}function M(e,t){return"undefined"!=typeof WebGLRenderbuffer&&t instanceof WebGLRenderbuffer}function k(e,t){return"undefined"!=typeof WebGLTexture&&t instanceof WebGLTexture}const U=34962,B={attribPrefix:""};function O(e,t,r,n,o){e.bindBuffer(t,r),e.bufferData(t,n,o||35044)}function L(e,t,r,n){if(o=t,"undefined"!=typeof WebGLBuffer&&o instanceof WebGLBuffer)return t;var o;r=r||U;const l=e.createBuffer();return O(e,r,l,t,n),l}function D(e){return"indices"===e}function _(e){return e.length?e:e.data}const $=/coord|texture/i,j=/color|colour/i;function W(e,t){let r;if(r=$.test(e)?2:j.test(e)?4:3,t%r>0)throw new 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}function V(e,t){return e.numComponents||e.size||W(t,_(e).length)}function N(e,t){if(I(e))return e;if(I(e.data))return e.data;Array.isArray(e)&&(e={data:e});let r=e.type;return r||(r=D(t)?Uint16Array:Float32Array),new r(e.data)}function G(e,t){const r={};return Object.keys(t).forEach((function(n){if(!D(n)){const l=t[n],c=l.attrib||l.name||l.attribName||B.attribPrefix+n;if(l.value){if(!Array.isArray(l.value)&&!I(l.value))throw new Error("array.value is not array or typedarray");r[c]={value:l.value}}else{let t,f,m,d;if(l.buffer&&l.buffer instanceof WebGLBuffer)t=l.buffer,d=l.numComponents||l.size,f=l.type,m=l.normalize;else if("number"==typeof l||"number"==typeof l.data){const r=l.data||l,c=l.type||Float32Array,y=r*c.BYTES_PER_ELEMENT;f=R(c),m=void 0!==l.normalize?l.normalize:(o=c)===Int8Array||o===Uint8Array,d=l.numComponents||l.size||W(n,r),t=e.createBuffer(),e.bindBuffer(U,t),e.bufferData(U,y,l.drawType||35044)}else{const r=N(l,n);t=L(e,r,void 0,l.drawType),f=S(r),m=void 0!==l.normalize?l.normalize:function(e){return e instanceof Int8Array||e instanceof Uint8Array}(r),d=V(l,n)}r[c]={buffer:t,numComponents:d,type:f,normalize:m,stride:l.stride||0,offset:l.offset||0,divisor:void 0===l.divisor?void 0:l.divisor,drawType:l.drawType}}}var o})),e.bindBuffer(U,null),r}const H=["position","positions","a_position"];function Y(e,t,r){const n=G(e,t),o=Object.assign({},r||{});o.attribs=Object.assign({},r?r.attribs:{},n);const l=t.indices;if(l){const t=N(l,"indices");o.indices=L(e,t,34963),o.numElements=t.length,o.elementType=S(t)}else o.numElements||(o.numElements=function(e,t){let r,n;for(n=0;n0)throw new Error(`numComponents ${l} not correct for length ${o}`);return c}(t),r}function J(e,t){let cursor=0;return e.push=function(){for(let t=0;t=0?ne(n,t):r.indexOf("tan")>=0||r.indexOf("binorm")>=0?te(n,t):r.indexOf("norm")>=0&&re(n,t)})),e}function ie(e,t,r){return e=e||2,{position:{numComponents:2,data:[(t=t||0)+-1*(e*=.5),(r=r||0)+-1*e,t+1*e,r+-1*e,t+-1*e,r+1*e,t+1*e,r+1*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 ae(e,t,r,n,o){e=e||1,t=t||1,r=r||1,n=n||1,o=o||m();const l=(r+1)*(n+1),c=Z(3,l),f=Z(3,l),d=Z(2,l);for(let o=0;o<=n;o++)for(let l=0;l<=r;l++){const u=l/r,m=o/n;c.push(e*u-.5*e,0,t*m-.5*t),f.push(0,1,0),d.push(u,m)}const y=r+1,h=Z(3,r*n*2,Uint16Array);for(let e=0;e 0");n=n||0,l=l||0;const f=(o=o||Math.PI)-n,m=(c=c||2*Math.PI)-l,d=(t+1)*(r+1),y=Z(3,d),h=Z(3,d),x=Z(2,d);for(let o=0;o<=r;o++)for(let c=0;c<=t;c++){const u=c/t,d=o/r,v=m*u+l,w=f*d+n,F=Math.sin(v),A=Math.cos(v),E=Math.sin(w),P=A*E,T=Math.cos(w),S=F*E;y.push(e*P,e*T,e*S),h.push(P,T,S),x.push(1-u,d)}const v=t+1,w=Z(3,t*r*2,Uint16Array);for(let e=0;eo?(m=r,f=1,c=t):c=e+l/o*(t-e),-2!==l&&l!==o+2||(c=0,f=0),m-=r/2;for(let e=0;eo?x.push(0,1,0):0===c?x.push(0,0,0):x.push(t*E,P,r*E),v.push(e/n,1-f)}}for(let e=0;e 0");const d=(m=m||1)-(f=f||0),y=2*(o+1)*4,h=Z(3,y),x=Z(3,y),v=Z(2,y);function w(a,b,s){return a+(b-a)*s}function F(t,r,m,y,F,A){for(let E=0;E<=o;E++){const P=r/1,T=E/o,S=2*(P-.5),R=(f+T*d)*Math.PI,s=Math.sin(R),z=Math.cos(R),I=w(e,t,s),C=S*n,M=z*e,k=s*I;h.push(C,M,k);const U=l(c([0,s,z],m),y);x.push(U),v.push(P*F+A,T)}}for(let e=0;e<2;e++){const n=2*(e/1-.5);F(t,e,[1,1,1],[0,0,0],1,0),F(t,e,[0,0,0],[n,0,0],0,0),F(r,e,[1,1,1],[0,0,0],1,0),F(r,e,[0,0,0],[n,0,0],0,1)}const A=Z(3,2*o*4,Uint16Array);function E(e,t){for(let r=0;r0&&i!==t){const a=y+(i+1),b=y+i,e=y+i-x,t=y+(i+1)-x;d.push(a,b,e),d.push(a,e,t)}}y+=t+1}return{position:c,normal:f,texcoord:m,indices:d}}function he(e){return function(t){const r=e.apply(this,Array.prototype.slice.call(arguments,1));return K(t,r)}}function xe(e){return function(t){const r=e.apply(null,Array.prototype.slice.call(arguments,1));return Y(t,r)}}xe(me),he(me),xe(le),he(le),xe(ae),he(ae),xe(ue),he(ue),xe(ce),he(ce),xe(ie),he(ie),xe(de),he(de),xe(ye),he(ye),xe(be),he(be),xe(pe),he(pe);function ge(e){return!!e.texStorage2D}const ve=function(){const e={},t={};return function(r,n){return function(r){const n=r.constructor.name;if(!e[n]){for(const e in r)if("number"==typeof r[e]){const n=t[r[e]];t[r[e]]=n?`${n} | ${e}`:e}e[n]=!0}}(r),t[n]||("number"==typeof n?`0x${n.toString(16)}`:n)}}();const we={textureColor:new Uint8Array([128,192,255,255]),textureOptions:{},crossOrigin:void 0},Fe=I,Ae=function(){let e;return function(){return e=e||("undefined"!=typeof document&&document.createElement?document.createElement("canvas").getContext("2d"):null),e}}(),Ee=6406,Pe=6407,Te=6408,Se=6409,Re=6410,ze=6402,Ie=34041,Ce=33071,Me=3553,ke=34067,Ue=32879,Be=35866,Oe=34069,Le=10241,De=10240,_e=10242,$e=10243,je=3317,We=5120,Ve=5121,Ne=5122,Ge=5123,He=5124,Ye=5125,Xe=5126,Ke=5131,qe=36193,Je=33640,Ze=33319,Qe=33320,et=6403,tt=36244,nt=36248,ot=36249,it={};{const e=it;e[6406]={numColorComponents:1},e[6409]={numColorComponents:1},e[6410]={numColorComponents:2},e[Pe]={numColorComponents:3},e[Te]={numColorComponents:4},e[et]={numColorComponents:1},e[36244]={numColorComponents:1},e[Ze]={numColorComponents:2},e[33320]={numColorComponents:2},e[Pe]={numColorComponents:3},e[36248]={numColorComponents:3},e[Te]={numColorComponents:4},e[36249]={numColorComponents:4},e[6402]={numColorComponents:1},e[34041]={numColorComponents:2}}let at;function ut(e){if(!at){const e={};e[6406]={textureFormat:Ee,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[1,2,2,4],type:[Ve,Ke,qe,Xe]},e[6409]={textureFormat:Se,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[1,2,2,4],type:[Ve,Ke,qe,Xe]},e[6410]={textureFormat:Re,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[2,4,4,8],type:[Ve,Ke,qe,Xe]},e[Pe]={textureFormat:Pe,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[3,6,6,12,2],type:[Ve,Ke,qe,Xe,33635]},e[Te]={textureFormat:Te,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[4,8,8,16,2,2],type:[Ve,Ke,qe,Xe,32819,32820]},e[6402]={textureFormat:ze,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[2,4],type:[Ye,Ge]},e[33321]={textureFormat:et,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[1],type:[Ve]},e[36756]={textureFormat:et,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[1],type:[We]},e[33325]={textureFormat:et,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[4,2],type:[Xe,Ke]},e[33326]={textureFormat:et,colorRenderable:!1,textureFilterable:!1,bytesPerElement:[4],type:[Xe]},e[33330]={textureFormat:tt,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[1],type:[Ve]},e[33329]={textureFormat:tt,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[1],type:[We]},e[33332]={textureFormat:tt,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[2],type:[Ge]},e[33331]={textureFormat:tt,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[2],type:[Ne]},e[33334]={textureFormat:tt,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[4],type:[Ye]},e[33333]={textureFormat:tt,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[4],type:[He]},e[33323]={textureFormat:Ze,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[2],type:[Ve]},e[36757]={textureFormat:Ze,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[2],type:[We]},e[33327]={textureFormat:Ze,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[8,4],type:[Xe,Ke]},e[33328]={textureFormat:Ze,colorRenderable:!1,textureFilterable:!1,bytesPerElement:[8],type:[Xe]},e[33336]={textureFormat:Qe,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[2],type:[Ve]},e[33335]={textureFormat:Qe,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[2],type:[We]},e[33338]={textureFormat:Qe,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[4],type:[Ge]},e[33337]={textureFormat:Qe,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[4],type:[Ne]},e[33340]={textureFormat:Qe,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[8],type:[Ye]},e[33339]={textureFormat:Qe,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[8],type:[He]},e[32849]={textureFormat:Pe,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[3],type:[Ve]},e[35905]={textureFormat:Pe,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[3],type:[Ve]},e[36194]={textureFormat:Pe,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[3,2],type:[Ve,33635]},e[36758]={textureFormat:Pe,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[3],type:[We]},e[35898]={textureFormat:Pe,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[12,6,4],type:[Xe,Ke,35899]},e[35901]={textureFormat:Pe,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[12,6,4],type:[Xe,Ke,35902]},e[34843]={textureFormat:Pe,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[12,6],type:[Xe,Ke]},e[34837]={textureFormat:Pe,colorRenderable:!1,textureFilterable:!1,bytesPerElement:[12],type:[Xe]},e[36221]={textureFormat:nt,colorRenderable:!1,textureFilterable:!1,bytesPerElement:[3],type:[Ve]},e[36239]={textureFormat:nt,colorRenderable:!1,textureFilterable:!1,bytesPerElement:[3],type:[We]},e[36215]={textureFormat:nt,colorRenderable:!1,textureFilterable:!1,bytesPerElement:[6],type:[Ge]},e[36233]={textureFormat:nt,colorRenderable:!1,textureFilterable:!1,bytesPerElement:[6],type:[Ne]},e[36209]={textureFormat:nt,colorRenderable:!1,textureFilterable:!1,bytesPerElement:[12],type:[Ye]},e[36227]={textureFormat:nt,colorRenderable:!1,textureFilterable:!1,bytesPerElement:[12],type:[He]},e[32856]={textureFormat:Te,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[4],type:[Ve]},e[35907]={textureFormat:Te,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[4],type:[Ve]},e[36759]={textureFormat:Te,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[4],type:[We]},e[32855]={textureFormat:Te,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[4,2,4],type:[Ve,32820,Je]},e[32854]={textureFormat:Te,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[4,2],type:[Ve,32819]},e[32857]={textureFormat:Te,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[4],type:[Je]},e[34842]={textureFormat:Te,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[16,8],type:[Xe,Ke]},e[34836]={textureFormat:Te,colorRenderable:!1,textureFilterable:!1,bytesPerElement:[16],type:[Xe]},e[36220]={textureFormat:ot,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[4],type:[Ve]},e[36238]={textureFormat:ot,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[4],type:[We]},e[36975]={textureFormat:ot,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[4],type:[Je]},e[36214]={textureFormat:ot,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[8],type:[Ge]},e[36232]={textureFormat:ot,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[8],type:[Ne]},e[36226]={textureFormat:ot,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[16],type:[He]},e[36208]={textureFormat:ot,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[16],type:[Ye]},e[33189]={textureFormat:ze,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[2,4],type:[Ge,Ye]},e[33190]={textureFormat:ze,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[4],type:[Ye]},e[36012]={textureFormat:ze,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[4],type:[Xe]},e[35056]={textureFormat:Ie,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[4],type:[34042]},e[36013]={textureFormat:Ie,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[4],type:[36269]},Object.keys(e).forEach((function(t){const r=e[t];r.bytesPerElementMap={},r.bytesPerElement.forEach((function(e,t){const n=r.type[t];r.bytesPerElementMap[n]=e}))})),at=e}return at[e]}function st(e,t){const r=ut(e);if(!r)throw"unknown internal format";const n=r.bytesPerElementMap[t];if(void 0===n)throw"unknown internal format";return n}function lt(e){const t=ut(e);if(!t)throw"unknown internal format";return{format:t.textureFormat,type:t.type[0]}}function ct(e){return 0==(e&e-1)}function ft(e,t,r,n){if(!ge(e))return ct(t)&&ct(r);const o=ut(n);if(!o)throw"unknown internal format";return o.colorRenderable&&o.textureFilterable}function mt(e){const t=ut(e);if(!t)throw"unknown internal format";return t.textureFilterable}function yt(e,t,r){return Fe(t)?S(t):r||Ve}function bt(e,t,r,n,o){if(o%1!=0)throw"can't guess dimensions";if(r||n){if(n){if(!r&&(r=o/n)%1)throw"can't guess dimensions"}else if((n=o/r)%1)throw"can't guess dimensions"}else{const e=Math.sqrt(o/(t===ke?6:1));e%1==0?(r=e,n=e):(r=o,n=1)}return{width:r,height:n}}function pt(e,t){void 0!==t.colorspaceConversion&&e.pixelStorei(37443,t.colorspaceConversion),void 0!==t.premultiplyAlpha&&e.pixelStorei(37441,t.premultiplyAlpha),void 0!==t.flipY&&e.pixelStorei(37440,t.flipY)}function ht(e){e.pixelStorei(je,4),ge(e)&&(e.pixelStorei(3314,0),e.pixelStorei(32878,0),e.pixelStorei(3316,0),e.pixelStorei(3315,0),e.pixelStorei(32877,0))}function xt(e,t,r,n){var o;n.minMag&&(r.call(e,t,Le,n.minMag),r.call(e,t,De,n.minMag)),n.min&&r.call(e,t,Le,n.min),n.mag&&r.call(e,t,De,n.mag),n.wrap&&(r.call(e,t,_e,n.wrap),r.call(e,t,$e,n.wrap),(t===Ue||(o=t,"undefined"!=typeof WebGLSampler&&o instanceof WebGLSampler))&&r.call(e,t,32882,n.wrap)),n.wrapR&&r.call(e,t,32882,n.wrapR),n.wrapS&&r.call(e,t,_e,n.wrapS),n.wrapT&&r.call(e,t,$e,n.wrapT),n.minLod&&r.call(e,t,33082,n.minLod),n.maxLod&&r.call(e,t,33083,n.maxLod),n.baseLevel&&r.call(e,t,33084,n.baseLevel),n.maxLevel&&r.call(e,t,33085,n.maxLevel)}function gt(e,t,r){const n=r.target||Me;e.bindTexture(n,t),xt(e,n,e.texParameteri,r)}function vt(e,t,r,n,o,l){r=r||we.textureOptions,l=l||Te;const c=r.target||Me;if(n=n||r.width,o=o||r.height,e.bindTexture(c,t),ft(e,n,o,l))e.generateMipmap(c);else{const t=mt(l)?9729:9728;e.texParameteri(c,Le,t),e.texParameteri(c,De,t),e.texParameteri(c,_e,Ce),e.texParameteri(c,$e,Ce)}}function wt(e){return!0===e.auto||void 0===e.auto&&void 0===e.level}function Ft(e,t){return(t=t||{}).cubeFaceOrder||[Oe,34070,34071,34072,34073,34074]}function At(e,t){const r=Ft(0,t).map((function(e,t){return{face:e,ndx:t}}));return r.sort((function(a,b){return a.face-b.face})),r}function Et(e,t,element,r){const n=(r=r||we.textureOptions).target||Me,o=r.level||0;let l=element.width,c=element.height;const f=r.internalFormat||r.format||Te,m=lt(f),d=r.format||m.format,y=r.type||m.type;if(pt(e,r),e.bindTexture(n,t),n===ke){const m=element.width,h=element.height;let x,v;if(m/6===h)x=h,v=[0,0,1,0,2,0,3,0,4,0,5,0];else if(h/6===m)x=m,v=[0,0,0,1,0,2,0,3,0,4,0,5];else if(m/3==h/2)x=m/3,v=[0,0,1,0,2,0,0,1,1,1,2,1];else{if(m/2!=h/3)throw"can't figure out cube map from element: "+(element.src?element.src:element.nodeName);x=m/2,v=[0,0,1,0,0,1,1,1,0,2,1,2]}const w=Ae();w?(w.canvas.width=x,w.canvas.height=x,l=x,c=x,At(0,r).forEach((function(t){const r=v[2*t.ndx+0]*x,n=v[2*t.ndx+1]*x;w.drawImage(element,r,n,x,x,0,0,x,x),e.texImage2D(t.face,o,f,d,y,w.canvas)})),w.canvas.width=1,w.canvas.height=1):"undefined"!=typeof createImageBitmap&&(l=x,c=x,At(0,r).forEach((function(m){const h=v[2*m.ndx+0]*x,w=v[2*m.ndx+1]*x;e.texImage2D(m.face,o,f,x,x,0,d,y,null),createImageBitmap(element,h,w,x,x,{premultiplyAlpha:"none",colorSpaceConversion:"none"}).then((function(h){pt(e,r),e.bindTexture(n,t),e.texImage2D(m.face,o,f,d,y,h),wt(r)&&vt(e,t,r,l,c,f)}))})))}else if(n===Ue||n===Be){const t=Math.min(element.width,element.height),r=Math.max(element.width,element.height),l=r/t;if(l%1!=0)throw"can not compute 3D dimensions of element";const c=element.width===r?1:0,m=element.height===r?1:0;e.pixelStorei(je,1),e.pixelStorei(3314,element.width),e.pixelStorei(32878,0),e.pixelStorei(32877,0),e.texImage3D(n,o,f,t,t,t,0,d,y,null);for(let r=0;r{const o=t*n.ndx,data=r.subarray(o,o+t);e.texImage2D(n.face,m,d,l,c,0,h,x,data)}))}else o===Ue||o===Be?e.texImage3D(o,m,d,l,c,f,0,h,x,r):e.texImage2D(o,m,d,l,c,0,h,x,r);return{width:l,height:c,depth:f,type:x}}function Ut(e,t,r){const n=r.target||Me;e.bindTexture(n,t);const o=r.level||0,l=r.internalFormat||r.format||Te,c=lt(l),f=r.format||c.format,m=r.type||c.type;if(pt(e,r),n===ke)for(let t=0;t<6;++t)e.texImage2D(Oe+t,o,l,r.width,r.height,0,f,m,null);else n===Ue||n===Be?e.texImage3D(n,o,l,r.width,r.height,r.depth,0,f,m,null):e.texImage2D(n,o,l,r.width,r.height,0,f,m,null)}function Bt(e,t,r){r=r||Pt,t=t||we.textureOptions;const n=e.createTexture(),o=t.target||Me;let l=t.width||1,c=t.height||1;const f=t.internalFormat||Te;e.bindTexture(o,n),o===ke&&(e.texParameteri(o,_e,Ce),e.texParameteri(o,$e,Ce));let m=t.src;if(m)if("function"==typeof m&&(m=m(e,t)),"string"==typeof m)It(e,n,t,r);else if(Fe(m)||Array.isArray(m)&&("number"==typeof m[0]||Array.isArray(m[0])||Fe(m[0]))){const r=kt(e,n,m,t);l=r.width,c=r.height}else Array.isArray(m)&&("string"==typeof m[0]||St(m[0]))?o===ke?Ct(e,n,t,r):Mt(e,n,t,r):(Et(e,n,m,t),l=m.width,c=m.height);else Ut(e,n,t);return wt(t)&&vt(e,n,t,l,c,f),gt(e,n,t),n}function Ot(e,t,r,n,o,l){n=n||r.width,o=o||r.height,l=l||r.depth;const c=r.target||Me;e.bindTexture(c,t);const f=r.level||0,m=r.internalFormat||r.format||Te,d=lt(m),y=r.format||d.format;let h;const x=r.src;if(h=x&&(Fe(x)||Array.isArray(x)&&"number"==typeof x[0])?r.type||yt(0,x,d.type):r.type||d.type,c===ke)for(let t=0;t<6;++t)e.texImage2D(Oe+t,f,m,n,o,0,y,h,null);else c===Ue||c===Be?e.texImage3D(c,f,m,n,o,l,0,y,h,null):e.texImage2D(c,f,m,n,o,0,y,h,null)}function Lt(e,t,r){r=r||Pt;let n=0;const o=[],l={},c={};function f(){0===n&&setTimeout((function(){r(o.length?o:void 0,l,c)}),0)}return Object.keys(t).forEach((function(r){const m=t[r];let d;var y;("string"==typeof(y=m.src)||Array.isArray(y)&&"string"==typeof y[0])&&(d=function(e,t,img){c[r]=img,--n,e&&o.push(e),f()},++n),l[r]=Bt(e,m,d)})),f(),l}const Dt=C;function _t(e){return"undefined"!=typeof document&&document.getElementById?document.getElementById(e):null}const $t=33984,jt=34962,Wt=5126,Vt=5124,Nt=5125,Gt=3553,Ht=34067,Yt=32879,Xt=35866,Kt={};function qt(e,t){return Kt[t].bindPoint}function Jt(e,t){return function(r){e.uniform1i(t,r)}}function Zt(e,t){return function(r){e.uniform1iv(t,r)}}function Qt(e,t){return function(r){e.uniform2iv(t,r)}}function er(e,t){return function(r){e.uniform3iv(t,r)}}function rr(e,t){return function(r){e.uniform4iv(t,r)}}function nr(e,t,r,n){const o=qt(0,t);return ge(e)?function(t){let l,c;k(0,t)?(l=t,c=null):(l=t.texture,c=t.sampler),e.uniform1i(n,r),e.activeTexture($t+r),e.bindTexture(o,l),e.bindSampler(r,c)}:function(t){e.uniform1i(n,r),e.activeTexture($t+r),e.bindTexture(o,t)}}function or(e,t,r,n,o){const l=qt(0,t),c=new Int32Array(o);for(let e=0;e{e.callback(`${t}\n${e.errors.join("\n")}`)})),null}function yr(e,t,r,n){const o=e.createShader(r);return e.shaderSource(o,mr(t).shaderSource),e.compileShader(o),n.callback||function(e,t,r,n){n=n||Dt;const o=e.getShaderParameter(r,35713);if(!o){const o=e.getShaderInfoLog(r),{lineOffset:l,shaderSource:c}=mr(e.getShaderSource(r));n(`${function(e,t="",r=0){const n=[...t.matchAll(cr)],o=new Map(n.map(((e,r)=>{const o=parseInt(e[1]),l=n[r+1],c=l?l.index:t.length;return[o-1,t.substring(e.index,c)]})));return e.split("\n").map(((line,e)=>{const t=o.get(e);return`${e+1+r}: ${line}${t?`\n\n^^^ ${t}`:""}`})).join("\n")}(c,o,l)}\nError compiling ${ve(e,t)}: ${o}`)}return o}(e,r,o,n.errorCallback)?o:(e.deleteShader(o),null)}function pr(e,t,r){let n,o,l;if("function"==typeof t&&(r=t,t=void 0),"function"==typeof e)r=e,e=void 0;else if(e&&!Array.isArray(e)){if(e.errorCallback&&e.errors)return e;const t=e;r=t.errorCallback,e=t.attribLocations,n=t.transformFeedbackVaryings,o=t.transformFeedbackMode,l=t.callback}const c=r||Dt,f=[],m={errorCallback(e,...t){f.push(e),c(e,...t)},transformFeedbackVaryings:n,transformFeedbackMode:o,callback:l,errors:f};if(e){let r={};Array.isArray(e)?e.forEach((function(e,n){r[e]=t?t[n]:n})):r=e,m.attribLocations=r}return m}const xr=["VERTEX_SHADER","FRAGMENT_SHADER"];function gr(e,t){return t.indexOf("frag")>=0?35632:t.indexOf("vert")>=0?35633:void 0}function vr(e,t){t.forEach((function(t){e.deleteShader(t)}))}const wr=(e=0)=>new Promise((t=>setTimeout(t,e)));function Fr(e,t,r,n,o){const l=pr(r,n,o),c=[],f=[];for(let r=0;re.getProgramParameter(t,n.COMPLETION_STATUS_KHR):()=>!0;let l=0;do{await wr(l),l=1e3/60}while(!o(e,t));const c=Ar(e,t,r.errorCallback),f=c?void 0:r.errors.join("\n");if(!c){(r.errorCallback||Dt)(f),e.deleteProgram(t),t=null}r.callback(f,t)}(e,d,l),null):Ar(e,d,l.errorCallback)?d:(e.deleteProgram(d),vr(e,f),null)}function Ar(e,t,r){r=r||Dt;const n=e.getProgramParameter(t,35714);if(!n){r(`Error in program linking: ${e.getProgramInfoLog(t)}`)}return n}function Er(e,t,r,n,o){const l=pr(r,n,o),c=[];for(let r=0;r""!==s));let l=0,path="";for(;;){const e=o[l++];path+=e;const c=(s=e[0])>="0"&&s<="9",f=c?parseInt(e):e;c&&(path+=o[l++]);if(l===o.length){r[f]=t;break}{const e=o[l++],t="["===e,c=r[f]||(t?[]:{});r[f]=c,r=c,n[path]=n[path]||function(e){return function(t){Cr(e,t)}}(c),path+=e}}var s}function Rr(e,t){let r=0;function n(t,n,o){const l=n.name.endsWith("[0]"),c=n.type,f=Kt[c];if(!f)throw new Error(`unknown type: 0x${c.toString(16)}`);let m;if(f.bindPoint){const t=r;r+=n.size,m=l?f.arraySetter(e,c,t,o,n.size):f.setter(e,c,t,o,n.size)}else m=f.arraySetter&&l?f.arraySetter(e,o):f.setter(e,o);return m.location=o,m}const o={},l={},c=e.getProgramParameter(t,35718);for(let r=0;r{let n;t||(n=Or(e,r)),f(t,n)});const m=Er(e,t,l);return m?Or(e,m):null}function _r(e,t,r,n,o,l){r=void 0===r?4:r;const c=t.indices,f=t.elementType,m=void 0===n?t.numElements:n;o=void 0===o?0:o,f||c?void 0!==l?e.drawElementsInstanced(r,m,void 0===f?5123:t.elementType,o,l):e.drawElements(r,m,void 0===f?5123:t.elementType,o):void 0!==l?e.drawArraysInstanced(r,o,m,l):e.drawArrays(r,o,m)}const $r=36161,jr=34041,Wr=36064,Vr=36096,Nr=33306,Gr=33071,Hr=9729,Yr=[{format:6408,type:5121,min:Hr,wrap:Gr},{format:jr}],Xr={};Xr[34041]=Nr,Xr[6401]=36128,Xr[36168]=36128,Xr[6402]=Vr,Xr[33189]=Vr,Xr[33190]=Vr,Xr[36012]=Vr,Xr[35056]=Nr,Xr[36013]=Nr;const Kr={};Kr[32854]=!0,Kr[32855]=!0,Kr[36194]=!0,Kr[34041]=!0,Kr[33189]=!0,Kr[6401]=!0,Kr[36168]=!0;function qr(e,t,r,n){const o=36160,l=e.createFramebuffer();e.bindFramebuffer(o,l),r=r||e.drawingBufferWidth,n=n||e.drawingBufferHeight;const c=[],f={framebuffer:l,attachments:[],width:r,height:n};return(t=t||Yr).forEach((function(t,i){let l=t.attachment;const m=t.samples,d=t.format;let y=t.attachmentPoint||function(e,t){return Xr[e]||Xr[t]}(d,t.internalFormat);if(y||(y=Wr+i),function(e){return e>=Wr&&e<36096}(y)&&c.push(y),!l)if(void 0!==m||function(e){return Kr[e]}(d))l=e.createRenderbuffer(),e.bindRenderbuffer($r,l),m>1?e.renderbufferStorageMultisample($r,m,d,r,n):e.renderbufferStorage($r,d,r,n);else{const o=Object.assign({},t);o.width=r,o.height=n,void 0===o.auto&&(o.auto=!1,o.min=o.min||o.minMag||Hr,o.mag=o.mag||o.minMag||Hr,o.wrapS=o.wrapS||o.wrap||Gr,o.wrapT=o.wrapT||o.wrap||Gr),l=Bt(e,o)}if(M(0,l))e.framebufferRenderbuffer(o,y,$r,l);else{if(!k(0,l))throw new Error("unknown attachment type");void 0!==t.layer?e.framebufferTextureLayer(o,y,l,t.level||0,t.layer):e.framebufferTexture2D(o,y,t.target||3553,l,t.level||0)}f.attachments.push(l)})),e.drawBuffers&&e.drawBuffers(c),f}function Jr(e,t,r,n,o){n=n||e.drawingBufferWidth,o=o||e.drawingBufferHeight,t.width=n,t.height=o,(r=r||Yr).forEach((function(r,l){const c=t.attachments[l],f=r.format,m=r.samples;if(void 0!==m||M(0,c))e.bindRenderbuffer($r,c),m>1?e.renderbufferStorageMultisample($r,m,f,n,o):e.renderbufferStorage($r,f,n,o);else{if(!k(0,c))throw new Error("unknown attachment type");Ot(e,c,r,n,o)}}))}function Zr(canvas,e){e=e||1,e=Math.max(0,e);const t=canvas.clientWidth*e|0,r=canvas.clientHeight*e|0;return(canvas.width!==t||canvas.height!==r)&&(canvas.width=t,canvas.height=r,!0)}}}]);