import{aasw,basz,iasS}from"./chunk-7YEOLR2L.js";import{aasy}from"./chunk-QHHYYTCM.js";import{aasC,casT,easx}from"./chunk-RH3GFHG2.js";import{aash}from"./chunk-FRWNWNYJ.js";import{aasu,basa}from"./chunk-RTY3VPG6.js";import{easb}from"./chunk-LRNH5AEO.js";varc={SCALAR:"SCALAR",VEC2:"VEC2",VEC3:"VEC3",VEC4:"VEC4",MAT2:"MAT2",MAT3:"MAT3",MAT4:"MAT4"};c.getMathType=function(e){switch(e){casec.SCALAR:returnNumber;casec.VEC2:returnT;casec.VEC3:returnC;casec.VEC4:returnw;casec.MAT2:returnS;casec.MAT3:returnx;casec.MAT4:returnz;default:thrownewu("attributeType is not a valid value.")}};c.getNumberOfComponents=function(e){switch(e){casec.SCALAR:return1;casec.VEC2:return2;casec.VEC3:return3;casec.VEC4:casec.MAT2:return4;casec.MAT3:return9;casec.MAT4:return16;default:thrownewu("attributeType is not a valid value.")}};c.getAttributeLocationCount=function(e){switch(e){casec.SCALAR:casec.VEC2:casec.VEC3:casec.VEC4:return1;casec.MAT2:return2;casec.MAT3:return3;casec.MAT4:return4;default:thrownewu("attributeType is not a valid value.")}};c.getGlslType=function(e){switch(a.typeOf.string("attributeType",e),e){casec.SCALAR:return"float";casec.VEC2:return"vec2";casec.VEC3:return"vec3";casec.VEC4:return"vec4";casec.MAT2:return"mat2";casec.MAT3:return"mat3";casec.MAT4:return"mat4";default:thrownewu("attributeType is not a valid value.")}};varN=Object.freeze(c);varV=1/256,D=256,r={};r.octEncodeInRange=function(e,t,n){a.defined("vector",e),a.defined("result",n);leto=C.magnitudeSquared(e);if(Math.abs(o-1)>h.EPSILON6)thrownewu("vector must be normalized.");if(n.x=e.x/(Math.abs(e.x)+Math.abs(e.y)+Math.abs(e.z)),n.y=e.y/(Math.abs(e.x)+Math.abs(e.y)+Math.abs(e.z)),e.z<0){leti=n.x,d=n.y;n.x=(1-Math.abs(d))*h.signNotZero(i),n.y=(1-Math.abs(i))*h.signNotZero(d)}returnn.x=h.toSNorm(n.x,t),n.y=h.toSNorm(n.y,t),n};r.octEncode=function(e,t){returnr.octEncodeInRange(e,255,t)};varA=newT,F=newUint8Array(1);functionE(e){returnF[0]=e,F[0]}r.octEncodeToCartesian4=function(e,t){returnr.octEncodeInRange(e,65535,A),t.x=E(A.x*V),t.y=E(A.x),t.z=E(A.y*V),t.w=E(A.y),t};r.octDecodeInRange=function(e,t,n,o){if(a.defined("result",o),e<0||e>n||t<0||t>n)thrownewu(`x and y must be unsigned normalized integers between 0 and ${n}`);if(o.x=h.fromSNorm(e,n),o.y=h.fromSNorm(t,n),o.z=1-(Math.abs(o.x)+Math.abs(o.y)),o.z<0){leti=o.x;o.x=(1-Math.abs(o.y))*h.signNotZero(i),o.y=(1-Math.abs(i))*h.signNotZero(o.y)}returnC.normalize(o,o)};r.octDecode=function(e,t,n){returnr.octDecodeInRange(e,t,255,n)};r.octDecodeFromCartesian4=function(e,t){a.typeOf.object("encoded",e),a.typeOf.object("result",t);letn=e.x,o=e.y,i=e.z,d=e.w;if(n<0||n>255||o<0||o>255||i<0||i>255||d<0||d>255)thrownewu("x, y, z, and w must be unsigned normalized integers between 0 and 255");letf=n*D+o,s=i*D+d;returnr.octDecodeInRange(f,s,65535,t)};r.octPackFloat=function(e){returna.defined("encoded",e),256*e.x+e.y};varl=newT;r.octEncodeFloat=function(e){returnr.octEncode(e,l),r.octPackFloat(l)};r.octDecodeFloat=function(e,t){a.defined("value",e);letn=e/256,o=Math.floor(n),i=(n-o)*256;returnr.octDecode(o,i,t)};r.octPack=function(e,t,n,o){a.defined("v1",e),a.defined("v2",t),a.defined("v3",n),a.defined("result",o);leti=r.octEncodeFloat(e),d=r.octEncodeFloat(t),f=r.octEncode(n,l);returno.x=65536*f.x+i,o.y=65536*f.y+d,o};r.octUnpack=function(e,t,n,o){a.defined("packed",e),a.defined("v1",t),a.defined("v2",n),a.defined("v3",o);leti=e.x/65536,d=Math.floor(i),f=(i-d)*65536;i=e.y/65536;lets=Math.floor(i),m=(i-s)*65536;r.octDecodeFloat(f,t),r.octDecodeFloat(m,n),r.octDecode(d,s,o)};r.compressTextureCoordinates=function(e){a.defined("textureCoordinates",e);lett=e.x*4095|0,n=e.y*4095|0;return4096*t+n};r.decompressTextureCoordinates=function(e,t){a.defined("compressed",e),a.defined("result",t);letn=e/4096,o=Math.floor(n);returnt.x=o/4095,t.y=(e-o*4096)/4095,t};functiong(e){returne>>1^-(e&1)}r.zigZagDeltaDecode=function(e,t,n){a.defined("uBuffer",e),a.defined("vBuffer",t),a.typeOf.number.equals("uBuffer.length","vBuffer.length