define(["./when-4bbc8319","./Matrix2-c6c16658","./arrayRemoveDuplicates-80a91d16","./BoundingRectangle-a97789b6","./Transforms-f15de320","./ComponentDatatype-3d0a0aac","./PolylineVolumeGeometryLibrary-87e70ef0","./RuntimeError-5b082e8f","./GeometryAttribute-8350368e","./GeometryAttributes-7827a6c2","./GeometryPipeline-0fb7cb2c","./IndexDatatype-ddbc25a7","./PolygonPipeline-ff4d4077","./VertexFormat-7b982b01","./combine-e9466e32","./WebGLConstants-508b9636","./EllipsoidTangentPlane-41514392","./AxisAlignedBoundingBox-a572809f","./IntersectionTests-a4e54d9a","./Plane-26e67b94","./PolylinePipeline-013902ec","./EllipsoidGeodesic-2e7ba57d","./EllipsoidRhumbLine-c6741351","./AttributeCompression-f7a901f9","./EncodedCartesian3-b1495e46"],(function(e,t,n,o,i,a,r,l,s,p,c,d,u,m,y,g,h,f,b,P,E,_,k,v,L){"use strict";functionV(n){consto=(n=e.defaultValue(n,e.defaultValue.EMPTY_OBJECT)).polylinePositions,i=n.shapePositions;this._positions=o,this._shape=i,this._ellipsoid=t.Ellipsoid.clone(e.defaultValue(n.ellipsoid,t.Ellipsoid.WGS84)),this._cornerType=e.defaultValue(n.cornerType,r.CornerType.ROUNDED),this._vertexFormat=m.VertexFormat.clone(e.defaultValue(n.vertexFormat,m.VertexFormat.DEFAULT)),this._granularity=e.defaultValue(n.granularity,a.CesiumMath.RADIANS_PER_DEGREE),this._workerName="createPolylineVolumeGeometry";letl=1+o.length*t.Cartesian3.packedLength;l+=1+i.length*t.Cartesian2.packedLength,this.packedLength=l+t.Ellipsoid.packedLength+m.VertexFormat.packedLength+2}V.pack=function(n,o,i){leta;i=e.defaultValue(i,0);constr=n._positions;letl=r.length;for(o[i++]=l,a=0;a<l;++a,i+=t.Cartesian3.packedLength)t.Cartesian3.pack(r[a],o,i);consts=n._shape;for(l=s.length,o[i++]=l,a=0;a<l;++a,i+=t.Cartesian2.packedLength)t.Cartesian2.pack(s[a],o,i);returnt.Ellipsoid.pack(n._ellipsoid,o,i),i+=t.Ellipsoid.packedLength,m.VertexFormat.pack(n._vertexFormat,o,i),i+=m.VertexFormat.packedLength,o[i++]=n._cornerType,o[i]=n._granularity,o};constx=t.Ellipsoid.clone(t.Ellipsoid.UNIT_SPHERE),C=newm.VertexFormat,F={polylinePositions:void0,shapePositions:void0,ellipsoid:x,vertexFormat:C,cornerType:void0,granularity:void0};V.unpack=function(n,o,i){leta;o=e.defaultValue(o,0);letr=n[o++];constl=newArray(r);for(a=0;a<r;++a,o+=t.Cartesian3.packedLength)l[a]=t.Cartesian3.unpack(n,o);r=n[o++];consts=newArray(r);for(a=0;a<r;++a,o+=t.Cartesian2.packedLength)s[a]=t.Cartesian2.unpack(n,o);constp=t.Ellipsoid.unpack(n,o,x);o+=t.Ellipsoid.packedLength;constc=m.VertexFormat.unpack(n,o,C);o+=m.VertexFormat.packedLength;constd=n[o++],u=n[o];returne.defined(i)?(i._positions=l,i._shape=s,i._ellipsoid=t.Ellipsoid.clone(p,i._ellipsoid),i._vertexFormat=m.VertexFormat.clone(c,i._vertexFormat),i._cornerType=d,i._granularity=u,i):(F.polylinePositions=l,F.shapePositions=s,F.cornerType=d,F.granularity=u,newV(F))};constA=newo.BoundingRectangle;returnV.createGeometry=function(e){constl=e._positions,m=n.arrayRemoveDuplicates(l,t.Cartesian3.equalsEpsilon);lety=e._shape;if(y=r.PolylineVolumeGeometryLibrary.removeDuplicatesFromShape(y),m.length<2||y.length<3)return;u.PolygonPipeline.computeWindingOrder2D(y)===u.WindingOrder.CLOCKWISE&&y.reverse();constg=o.BoundingRectangle.fromPoints(y,A);returnfunction(e,t,n,o){constl=newp.GeometryAttributes;o.position&&(l.position=news.GeometryAttribute({componentDatatype:a.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:e}));constm=t.length,y=e.length/3,g=(y-2*m)/(2*m),h=u.PolygonPipeline.triangulate(t),f=(g-1)*m*6+2*h.length,b=d.IndexDatatype.createTypedArray(y,f);letP,E,_,k,v,L;constV=2*m;letx=0;for(P=0;P<g-1;P++){for(E=0;E<m-1;E++)_=2*E+P*m*2,L=_+V,k=_+1,v=k+V,b[x++]=k,b[x++]=_,b[x++]=v,b[x++]=v,b[x++]=_,b[x++]=L;_=2*m-2+P*m*2,k=_+1,v=k+V,L=_+V,b[x++]=k,b[x++]=_,b[x++]=v,b[x++]=v,b[x++]=_,b[x++]=L}if(o.st||o.tangent||o.bitangent){conste=newFloat32Array(2*y),o=1/(g-1),i=1/n.height,r=n.height/2;letp,c,d=0;for(P=0;P<g;P++){for(p=P*o,c=i*(t[0].y+r),e[d++]=p,e[d++]=c,E=1;E<m;E++)c=i*(t[E].y+r),e[d++]=p,e[d++]=c,e[d++]=p,e[d++]=c;c=i*(t[0].y+r),e[d++]=p,e[d++]=c}for(E=0;E<m;E++)p=0,c=i*(t[E].y+r),e[d++]=p,e[d++]=c;for(E=0;E<m;E++)p=(g-1)*o,c=i*(t[E].y+r),e[d++]=p,e[d++]=c;l.st=news.GeometryAttribute({componentDatatype:a.ComponentDatatype.FLOAT,componentsPerAttribute:2,values:newFloat32Array(e)})}constC=y-2*m;for(P=0;P<h.length;P+=3){conste=h[P]+C,t=h[P+1]+C,n=h[P+2]+C;b[x++]=e,b[x++]=t,b[x++]=n,b[x++]=n+m,b[x++]=t+m,b[x++]=e+m}letF=news.Geometry({attributes:l,indices:b,boundingSphere:i.BoundingSphere.fromVertices(e),primitiveType:s.PrimitiveType.TRIANGLES});if(o.normal&&(F=c.GeometryPipeline.computeNormal(F)),o.tangent||o.bitangent){try{F=c.GeometryPipeline.computeTangentAndBitangent(F)}catch(e){r.oneTimeWarning("polyline-volume-tangent-bitangent","Unable to compute tangents and bitangents for polyline volume geometry")}o.tangent||(F.attributes.tangent=void0),o.bitangent||(F.attributes.bitangent=void0),o.st||(F.attributes.st=void0)}returnF}(r.PolylineVolumeGeometryLibrary.computePositions(m,y,g,e,!0),y,g,e._vertexFormat)},function(n,o){returne.defined(o)&&(n=V.unpack(n,o)),n._ellipsoid=t.Ellipsoid.clone(n._ellipsoid),V.createGeometry(n)}}));
define(["./when-4bbc8319"],(function(e){"use strict";returnfunction(t){letr;returnfunction(n){consts=n.data,a=[],i={id:s.id,result:void0,error:void0};returne.when(function(t,r,n){lets;try{returns=t(r,n),s}catch(t){returne.when.reject(t)}}(t,s.parameters,a)).then((function(e){i.result=e})).otherwise((function(e){einstanceofError?i.error={name:e.name,message:e.message,stack:e.stack}:i.error=e})).always((function(){e.defined(r)||(r=e.defaultValue(self.webkitPostMessage,self.postMessage)),s.canTransferArrayBuffer||(a.length=0);try{r(i,a)}catch(t){i.result=void0,i.error=`postMessage failed with error: ${function(t){letr;constn=t.name,s=t.message;r=e.defined(n)&&e.defined(s)?`${n}: ${s}`:t.toString();consta=t.stack;returne.defined(a)&&(r+=`\n${a}`),r}(t)}\n with responseMessage: ${JSON.stringify(i)}`,r(i)}}))}}}));