/**
 * @license
 * Cesium - https://github.com/CesiumGS/cesium
 * Version 1.126
 *
 * Copyright 2011-2022 Cesium Contributors
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * Columbus View (Pat. Pend.)
 *
 * Portions licensed separately.
 * See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
 */
import{a as M}from"./chunk-A4R6HP5H.js";import{a as W}from"./chunk-XLESIVYV.js";import"./chunk-MNEOPOLK.js";import"./chunk-I4G5DYCC.js";import{a as x,b as I,c as j}from"./chunk-2H32TJK3.js";import"./chunk-AUO2K2B5.js";import"./chunk-55B3WQ6I.js";import{a as g}from"./chunk-HZQ2LRMY.js";import"./chunk-EP544XEE.js";import"./chunk-MDIGQ5JT.js";import{a as $,b as V}from"./chunk-WV3AQKZG.js";import{a as Z}from"./chunk-K4QHJFYW.js";import"./chunk-CZ6DDD6J.js";import"./chunk-26PPBGHW.js";import"./chunk-FMJWH3RL.js";import{a as X}from"./chunk-E25VRLIZ.js";import{a as Q}from"./chunk-FZEJ65E6.js";import{b as Y,c as z,d as U}from"./chunk-SPFUTSGC.js";import{d as K}from"./chunk-E2NX4UJ2.js";import"./chunk-JBPQP6LH.js";import{a as B}from"./chunk-NLPIV6OK.js";import{a as T,c as C,d as f}from"./chunk-IIT3SHXK.js";import{a as J}from"./chunk-DLCTHPIV.js";import"./chunk-GMF7KJHC.js";import"./chunk-NYFH7JC3.js";import{a as k}from"./chunk-I2ICH2LD.js";import{a as D}from"./chunk-R6A52HT4.js";import{e as _}from"./chunk-D32DZSEC.js";function oe(e,t,n,o){let r=new Q;o.position&&(r.position=new U({componentDatatype:B.DOUBLE,componentsPerAttribute:3,values:e}));let i,a,s,p,c,l,u=t.length,h=e.length/3,m=(h-2*u)/(2*u),k=V.triangulate(t),g=(m-1)*u*6+2*k.length,f=X.createTypedArray(h,g),d=2*u,y=0;for(i=0;i<m-1;i++){for(a=0;a<u-1;a++)s=2*a+i*u*2,l=s+d,p=s+1,c=p+d,f[y++]=p,f[y++]=s,f[y++]=c,f[y++]=c,f[y++]=s,f[y++]=l;s=2*u-2+i*u*2,p=s+1,c=p+d,l=s+d,f[y++]=p,f[y++]=s,f[y++]=c,f[y++]=c,f[y++]=s,f[y++]=l}if(o.st||o.tangent||o.bitangent){let e,o,s=new Float32Array(2*h),p=1/(m-1),c=1/n.height,l=n.height/2,k=0;for(i=0;i<m;i++){for(e=i*p,o=c*(t[0].y+l),s[k++]=e,s[k++]=o,a=1;a<u;a++)o=c*(t[a].y+l),s[k++]=e,s[k++]=o,s[k++]=e,s[k++]=o;o=c*(t[0].y+l),s[k++]=e,s[k++]=o}for(a=0;a<u;a++)e=0,o=c*(t[a].y+l),s[k++]=e,s[k++]=o;for(a=0;a<u;a++)e=(m-1)*p,o=c*(t[a].y+l),s[k++]=e,s[k++]=o;r.st=new U({componentDatatype:B.FLOAT,componentsPerAttribute:2,values:new Float32Array(s)})}let _=h-2*u;for(i=0;i<k.length;i+=3){let e=k[i]+_,t=k[i+1]+_,n=k[i+2]+_;f[y++]=e,f[y++]=t,f[y++]=n,f[y++]=n+u,f[y++]=t+u,f[y++]=e+u}let v=new z({attributes:r,indices:f,boundingSphere:K.fromVertices(e),primitiveType:Y.TRIANGLES});if(o.normal&&(v=W.computeNormal(v)),o.tangent||o.bitangent){try{v=W.computeTangentAndBitangent(v)}catch{I("polyline-volume-tangent-bitangent","Unable to compute tangents and bitangents for polyline volume geometry")}o.tangent||(v.attributes.tangent=void 0),o.bitangent||(v.attributes.bitangent=void 0),o.st||(v.attributes.st=void 0)}return v}function R(e){e=k(e,k.EMPTY_OBJECT);let t=e.polylinePositions,n=e.shapePositions;if(!_(t))throw new D("options.polylinePositions is required.");if(!_(n))throw new D("options.shapePositions is required.");this._positions=t,this._shape=n,this._ellipsoid=f.clone(k(e.ellipsoid,f.default)),this._cornerType=k(e.cornerType,x.ROUNDED),this._vertexFormat=g.clone(k(e.vertexFormat,g.DEFAULT)),this._granularity=k(e.granularity,J.RADIANS_PER_DEGREE),this._workerName="createPolylineVolumeGeometry";let o=1+t.length*T.packedLength;o+=1+n.length*C.packedLength,this.packedLength=o+f.packedLength+g.packedLength+2}R.pack=function(e,t,n){if(!_(e))throw new D("value is required");if(!_(t))throw new D("array is required");n=k(n,0);let o,r=e._positions,i=r.length;for(t[n++]=i,o=0;o<i;++o,n+=T.packedLength)T.pack(r[o],t,n);let a=e._shape;for(i=a.length,t[n++]=i,o=0;o<i;++o,n+=C.packedLength)C.pack(a[o],t,n);return f.pack(e._ellipsoid,t,n),n+=f.packedLength,g.pack(e._vertexFormat,t,n),n+=g.packedLength,t[n++]=e._cornerType,t[n]=e._granularity,t};var ee=f.clone(f.UNIT_SPHERE),te=new g,v={polylinePositions:void 0,shapePositions:void 0,ellipsoid:ee,vertexFormat:te,cornerType:void 0,granularity:void 0};R.unpack=function(e,t,n){if(!_(e))throw new D("array is required");t=k(t,0);let o,r=e[t++],i=new Array(r);for(o=0;o<r;++o,t+=T.packedLength)i[o]=T.unpack(e,t);r=e[t++];let a=new Array(r);for(o=0;o<r;++o,t+=C.packedLength)a[o]=C.unpack(e,t);let s=f.unpack(e,t,ee);t+=f.packedLength;let p=g.unpack(e,t,te);t+=g.packedLength;let c=e[t++],l=e[t];return _(n)?(n._positions=i,n._shape=a,n._ellipsoid=f.clone(s,n._ellipsoid),n._vertexFormat=g.clone(p,n._vertexFormat),n._cornerType=c,n._granularity=l,n):(v.polylinePositions=i,v.shapePositions=a,v.cornerType=c,v.granularity=l,new R(v))};var ne=new M;R.createGeometry=function(e){let t=e._positions,n=Z(t,T.equalsEpsilon),o=e._shape;if(o=j.removeDuplicatesFromShape(o),n.length<2||o.length<3)return;V.computeWindingOrder2D(o)===$.CLOCKWISE&&o.reverse();let r=M.fromPoints(o,ne),i=j.computePositions(n,o,r,e,!0);return oe(i,o,r,e._vertexFormat)};var H=R;function ie(e,t){return _(t)&&(e=H.unpack(e,t)),e._ellipsoid=f.clone(e._ellipsoid),H.createGeometry(e)}var Re=ie;export{Re as default};