import{aas$}from"./chunk-HMHR6SIB.js";import{aasb}from"./chunk-FG3CL3AH.js";import{aasU}from"./chunk-YFQNY2YN.js";import{aasE}from"./chunk-NT26NNVH.js";import{casz,dasL}from"./chunk-NW2YE576.js";import{aasD,dasy}from"./chunk-2NIQ5ECB.js";import{basG}from"./chunk-7YEOLR2L.js";import{aask}from"./chunk-QHHYYTCM.js";import{dasB}from"./chunk-RH3GFHG2.js";import{aasv}from"./chunk-TA3RE4KQ.js";import{aasF,basI}from"./chunk-RTY3VPG6.js";import{easa}from"./chunk-LRNH5AEO.js";functionw(e,n,t){e=v(e,0),n=v(n,0),t=v(t,0),this.value=newFloat32Array([e,n,t])}Object.defineProperties(w.prototype,{componentDatatype:{get:function(){returnk.FLOAT}},componentsPerAttribute:{get:function(){return3}},normalize:{get:function(){return!1}}});w.fromCartesian3=function(e){returnI.defined("offset",e),neww(e.x,e.y,e.z)};w.toValue=function(e,n){returnI.defined("offset",e),a(n)||(n=newFloat32Array([e.x,e.y,e.z])),n[0]=e.x,n[1]=e.y,n[2]=e.z,n};varj=w;functionK(e,n,t){leti=!t,r=e.length,c;if(!i&&r>1){leto=e[0].modelMatrix;for(c=1;c<r;++c)if(!G.equals(o,e[c].modelMatrix)){i=!0;break}}if(i)for(c=0;c<r;++c)a(e[c].geometry)&&b.transformToWorldCoordinates(e[c]);elseG.multiplyTransformation(n,e[0].modelMatrix,n)}functionP(e,n){lett=e.attributes,i=t.position,r=i.values.length/i.componentsPerAttribute;t.batchId=newL({componentDatatype:k.FLOAT,componentsPerAttribute:1,values:newFloat32Array(r)});letc=t.batchId.values;for(leto=0;o<r;++o)c[o]=n}functionN(e){letn=e.length;for(lett=0;t<n;++t){leti=e[t];a(i.geometry)?P(i.geometry,t):a(i.westHemisphereGeometry)&&a(i.eastHemisphereGeometry)&&(P(i.westHemisphereGeometry,t),P(i.eastHemisphereGeometry,t))}}functionQ(e){letn=e.instances,t=e.projection,i=e.elementIndexUintSupported,r=e.scene3DOnly,c=e.vertexCacheOptimize,o=e.compressVertices,g=e.modelMatrix,s,u,m,p=n.length;for(s=0;s<p;++s)if(a(n[s].geometry)){m=n[s].geometry.primitiveType;break}for(s=1;s<p;++s)if(a(n[s].geometry)&&n[s].geometry.primitiveType!==m)thrownewF("All instance geometries must have the same primitiveType.");if(K(n,g,r),!r)for(s=0;s<p;++s)a(n[s].geometry)&&b.splitLongitude(n[s]);if(N(n),c)for(s=0;s<p;++s){letf=n[s];a(f.geometry)?(b.reorderForPostVertexCache(f.geometry),b.reorderForPreVertexCache(f.geometry)):a(f.westHemisphereGeometry)&&a(f.eastHemisphereGeometry)&&(b.reorderForPostVertexCache(f.westHemisphereGeometry),b.reorderForPreVertexCache(f.westHemisphereGeometry),b.reorderForPostVertexCache(f.eastHemisphereGeometry),b.reorderForPreVertexCache(f.eastHemisphereGeometry))}letl=b.combineInstances(n);for(p=l.length,s=0;s<p;++s){u=l[s];letf=u.attributes;if(r)for(letdinf)f.hasOwnProperty(d)&&f[d].componentDatatype===k.DOUBLE&&b.encodeAttribute(u,d,`${d}3DHigh`,`${d}3DLow`);elsefor(letdinf)if(f.hasOwnProperty(d)&&f[d].componentDatatype===k.DOUBLE){leth=`${d}3D`,x=`${d}2D`;b.projectTo2D(u,d,h,x,t),a(u.boundingSphere)&&d==="position"&&(u.boundingSphereCV=y.fromVertices(u.attributes.position2D.values)),b.encodeAttribute(u,h,`${h}High`,`${h}Low`),b.encodeAttribute(u,x,`${x}High`,`${x}Low`)}o&&b.compressVertices(u)}if(!i){letf=[];for(p=l.length,s=0;s<p;++s)u=l[s],f=f.concat(b.fitToUnsignedShortIndices(u));l=f}returnl}functionT(e,n,t,i){letr,c,o,g=i.length-1;if(g>=0){letu=i[g];r=u.offset+u.count,o=u.index,c=t[o].indices.length}elser=0,o=0,c=t[o].indices.length;lets=e.length;for(letu=0;u<s;++u){letp=e[u][n];if(!a(p))continue;letl=p.indices.length;r+l>c&&(r=0,c=t[++o].indices.length),i.push({index:o,offset:r,count:l}),r+=l}}functionX(e,n){lett=[];returnT(e,"geometry",n,t),T(e,"westHemisphereGeometry",n,t),T(e,"eastHemisphereGeometry",n,t),t}varS={};S.combineGeometry=function(e){letn,t,i=e.instances,r=i.length,c,o,g=!1;r>0&&(n=Q(e),n.length>0&&(t=b.createAttributeLocations(n[0]),e.createPickOffsets&&(c=X(i,n))),a(i[0].attributes)&&a(i[0].attributes.offset)&&(o=newArray(r),g=!0));lets=newArray(r),u=newArray(r);for(letm=0;m<r;++m){letp=i[m],l=p.geometry;a(l)&&(s[m]=l.boundingSphere,u[m]=l.boundingSphereCV,g&&(o[m]=p.geometry.offsetAttribute));letf=p.eastHemisphereGeometry