define(["exports","./Cartographic-1d953166","./PolylineVolumeGeometryLibrary-33dc94e9","./when-d186add7","./Math-7f5f2992","./FeatureDetection-4281d393","./PolylinePipeline-cea0bf86","./GeometryAttribute-95780fd1"],(function(t,e,r,a,n,o,i,l){"use strict";var s={},u=new e.t,c=new e.t,y=new e.t,d=new e.t,p=[new e.t,new e.t],m=new e.t,g=new e.t,f=new e.t,h=new e.t,w=new e.t,z=new e.t,S=new e.t,v=new e.t,x=new e.t,A=new e.t,B=new l.n,E=new o.p;function D(t,a,i,s,y){var d,p=e.t.angleBetween(e.t.subtract(a,t,u),e.t.subtract(i,t,c)),m=s===r.S.BEVELED?1:Math.ceil(p/n.e.toRadians(5))+1,g=3*m,f=new Array(g);f[g-3]=i.x,f[g-2]=i.y,f[g-1]=i.z,d=y?o.p.fromQuaternion(l.n.fromAxisAngle(e.t.negate(t,u),p/m,B),E):o.p.fromQuaternion(l.n.fromAxisAngle(t,p/m,B),E);var h=0;a=e.t.clone(a,u);for(var w=0;w<m;w++)a=o.p.multiplyByVector(d,a,a),f[h++]=a.x,f[h++]=a.y,f[h++]=a.z;return f}function b(t,r,a,n){var o=u;return n||(r=e.t.negate(r,r)),[(o=e.t.add(t,r,o)).x,o.y,o.z,a.x,a.y,a.z]}function P(t,r,a,n){for(var o=new Array(t.length),i=new Array(t.length),l=e.t.multiplyByScalar(r,a,u),s=e.t.negate(l,c),p=0,m=t.length-1,g=0;g<t.length;g+=3){var f=e.t.fromArray(t,g,y),h=e.t.add(f,s,d);o[p++]=h.x,o[p++]=h.y,o[p++]=h.z;var w=e.t.add(f,l,d);i[m--]=w.z,i[m--]=w.y,i[m--]=w.x}return n.push(o,i),n}s.addAttribute=function(t,e,r,n){var o=e.x,i=e.y,l=e.z;a.e(r)&&(t[r]=o,t[r+1]=i,t[r+2]=l),a.e(n)&&(t[n]=l,t[n-1]=i,t[n-2]=o)};var N=new e.t,O=new e.t;s.computePositions=function(t){var a=t.granularity,o=t.positions,l=t.ellipsoid,s=t.width/2,c=t.cornerType,y=t.saveAttributes,d=m,B=g,E=f,R=h,L=w,U=z,V=S,M=v,G=x,I=A,Q=[],T=y?[]:void 0,q=y?[]:void 0,C=o[0],F=o[1];B=e.t.normalize(e.t.subtract(F,C,B),B),d=l.geodeticSurfaceNormal(C,d),R=e.t.normalize(e.t.cross(d,B,R),R),y&&(T.push(R.x,R.y,R.z),q.push(d.x,d.y,d.z)),V=e.t.clone(C,V),C=F,E=e.t.negate(B,E);var J,j,k=[],H=o.length;for(J=1;J<H-1;J++){d=l.geodeticSurfaceNormal(C,d),F=o[J+1],B=e.t.normalize(e.t.subtract(F,C,B),B),L=e.t.normalize(e.t.add(B,E,L),L);var K=e.t.multiplyByScalar(d,e.t.dot(B,d),N);e.t.subtract(B,K,K),e.t.normalize(K,K);var W=e.t.multiplyByScalar(d,e.t.dot(E,d),O);if(e.t.subtract(E,W,W),e.t.normalize(W,W),!n.e.equalsEpsilon(Math.abs(e.t.dot(K,W)),1,n.e.EPSILON7)){L=e.t.cross(L,d,L),L=e.t.cross(d,L,L),L=e.t.normalize(L,L);var X=s/Math.max(.25,e.t.magnitude(e.t.cross(L,E,u))),Y=r.J.angleIsGreaterThanPi(B,E,C,l);L=e.t.multiplyByScalar(L,X,L),Y?(M=e.t.add(C,L,M),I=e.t.add(M,e.t.multiplyByScalar(R,s,I),I),G=e.t.add(M,e.t.multiplyByScalar(R,2*s,G),G),p[0]=e.t.clone(V,p[0]),p[1]=e.t.clone(I,p[1]),Q=P(i.m.generateArc({positions:p,granularity:a,ellipsoid:l}),R,s,Q),y&&(T.push(R.x,R.y,R.z),q.push(d.x,d.y,d.z)),U=e.t.clone(G,U),R=e.t.normalize(e.t.cross(d,B,R),R),G=e.t.add(M,e.t.multiplyByScalar(R,2*s,G),G),V=e.t.add(M,e.t.multiplyByScalar(R,s,V),V),c===r.S.ROUNDED||c===r.S.BEVELED?k.push({leftPositions:D(M,U,G,c,Y)}):k.push({leftPositions:b(C,e.t.negate(L,L),G,Y)})):(G=e.t.add(C,L,G),I=e.t.add(G,e.t.negate(e.t.multiplyByScalar(R,s,I),I),I),M=e.t.add(G,e.t.negate(e.t.multiplyByScalar(R,2*s,M),M),M),p[0]=e.t.clone(V,p[0]),p[1]=e.t.clone(I,p[1]),Q=P(i.m.generateArc({positions:p,granularity:a,ellipsoid:l}),R,s,Q),y&&(T.push(R.x,R.y,R.z),q.push(d.x,d.y,d.z)),U=e.t.clone(M,U),R=e.t.normalize(e.t.cross(d,B,R),R),M=e.t.add(G,e.t.negate(e.t.multiplyByScalar(R,2*s,M),M),M),V=e.t.add(G,e.t.negate(e.t.multiplyByScalar(R,s,V),V),V),c===r.S.ROUNDED||c===r.S.BEVELED?k.push({rightPositions:D(G,U,M,c,Y)}):k.push({rightPositions:b(C,L,M,Y)})),E=e.t.negate(B,E)}C=F}return d=l.geodeticSurfaceNormal(C,d),p[0]=e.t.clone(V,p[0]),p[1]=e.t.clone(C,p[1]),Q=P(i.m.generateArc({positions:p,granularity:a,ellipsoid:l}),R,s,Q),y&&(T.push(R.x,R.y,R.z),q.push(d.x,d.y,d.z)),c===r.S.ROUNDED&&(j=function(t){var a=m,n=g,o=f,i=t[1];n=e.t.fromArray(t[1],i.length-3,n),o=e.t.fromArray(t[0],0,o);var l=D(a=e.t.midpoint(n,o,a),n,o,r.S.ROUNDED,!1),s=t.length-1,u=t[s-1];return i=t[s],n=e.t.fromArray(u,u.length-3,n),o=e.t.fromArray(i,0,o),[l,D(a=e.t.midpoint(n,o,a),n,o,r.S.ROUNDED,!1)]}(Q)),{positions:Q,corners:k,lefts:T,normals:q,endPositions:j}},t.b=s}));
