/**
 * @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 _}from"./chunk-AUO2K2B5.js";import{a as te}from"./chunk-EP544XEE.js";import{a as fe,b as j,f as Z,g as me}from"./chunk-JBPQP6LH.js";import{a as e,b as ie,c as ee,e as O}from"./chunk-IIT3SHXK.js";import{a as Q}from"./chunk-DLCTHPIV.js";import{a as se}from"./chunk-I2ICH2LD.js";import{a as le}from"./chunk-R6A52HT4.js";import{e as $}from"./chunk-D32DZSEC.js";var Se={ROUNDED:0,MITERED:1,BEVELED:2},G=Object.freeze(Se),ue={};function P(e,t){if(!$(e))throw new le("identifier is required.");$(ue[e])||(ue[e]=!0,console.warn(se(t,e)))}P.geometryOutlines="Entity geometry outlines are unsupported on terrain. Outlines will be disabled. To enable outlines, disable geometry terrain clamping by explicitly setting height to 0.",P.geometryZIndex="Entity geometry with zIndex are unsupported when height or extrudedHeight are defined.  zIndex will be ignored",P.geometryHeightReference="Entity corridor, ellipse, polygon or rectangle with heightReference must also have a defined height.  heightReference will be ignored",P.geometryExtrudedHeightReference="Entity corridor, ellipse, polygon or rectangle with extrudedHeightReference must also have a defined extrudedHeight.  extrudedHeightReference will be ignored";var he=P,w=[new e,new e],Te=new e,Be=new e,Ce=new e,ze=new e,Ae=new e,be=new e,Oe=new e,ve=new e,De=new e,I=new e,W=new e,R={},re=new ie;function je(e,t){let n=new Array(e.length);for(let r=0;r<e.length;r++){let o=e[r];re=t.cartesianToCartographic(o,re),n[r]=re.height,e[r]=t.scaleToGeodeticSurface(o,o)}return n}function ne(t,n,r,o){let a,l=t[0],i=t[1],c=e.angleBetween(l,i),s=Math.ceil(c/o),u=new Array(s);if(n===r){for(a=0;a<s;a++)u[a]=n;return u.push(r),u}let d=(r-n)/s;for(a=1;a<s;a++){let e=n+a*d;u[a]=e}return u[0]=n,u.push(r),u}var X=new e,Y=new e;function He(t,n,r,o){let a=new te(r,o),l=a.projectPointOntoPlane(e.add(r,t,X),X),i=a.projectPointOntoPlane(e.add(r,n,Y),Y),c=ee.angleBetween(l,i);return i.x*l.y-i.y*l.x>=0?-c:c}var Me=new e(-1,0,0),H=new j,Ve=new j,oe=new O,Ne=O.IDENTITY.clone(),Fe=new e,Ge=new fe,de=new e;function v(t,n,r,o,a,l,i,c){let s=Fe,u=Ge;H=me.eastNorthUpToFixedFrame(t,a,H),s=j.multiplyByPointAsVector(H,Me,s),s=e.normalize(s,s);let d=He(s,n,t,a);oe=O.fromRotationZ(d,oe),de.z=l,H=j.multiplyTransformation(H,j.fromRotationTranslation(oe,de,Ve),H);let w=Ne;w[0]=i;for(let g=0;g<c;g++)for(let t=0;t<r.length;t+=3)u=e.fromArray(r,t,u),u=O.multiplyByVector(w,u,u),u=j.multiplyByPoint(H,u,u),o.push(u.x,u.y,u.z);return o}var Ie=new e;function ce(t,n,r,o,a,l,i){for(let c=0;c<t.length;c+=3){let s=e.fromArray(t,c,Ie);o=v(s,n,r,o,a,l[c/3],i,1)}return o}function Le(e,t){let n=e.length,r=new Array(6*n),o=0,a=t.x+t.width/2,l=t.y+t.height/2,i=e[0];r[o++]=i.x-a,r[o++]=0,r[o++]=i.y-l;for(let c=1;c<n;c++){i=e[c];let t=i.x-a,n=i.y-l;r[o++]=t,r[o++]=0,r[o++]=n,r[o++]=t,r[o++]=0,r[o++]=n}return i=e[0],r[o++]=i.x-a,r[o++]=0,r[o++]=i.y-l,r}function ge(e,t){let n=e.length,r=new Array(3*n),o=0,a=t.x+t.width/2,l=t.y+t.height/2;for(let i=0;i<n;i++)r[o++]=e[i].x-a,r[o++]=0,r[o++]=e[i].y-l;return r}var ye=new Z,we=new e,pe=new O;function xe(t,n,r,o,a,l,i,c,s,u){let d,w,g,m=e.angleBetween(e.subtract(n,t,I),e.subtract(r,t,W)),h=o===G.BEVELED?0:Math.ceil(m/Q.toRadians(5));if(d=a?O.fromQuaternion(Z.fromAxisAngle(e.negate(t,I),m/(h+1),ye),pe):O.fromQuaternion(Z.fromAxisAngle(t,m/(h+1),ye),pe),n=e.clone(n,we),h>0){let r=u?2:1;for(let o=0;o<h;o++)n=O.multiplyByVector(d,n,n),w=e.subtract(n,t,I),w=e.normalize(w,w),a||(w=e.negate(w,w)),g=l.scaleToGeodeticSurface(n,W),i=v(g,w,c,i,l,s,1,r)}else w=e.subtract(n,t,I),w=e.normalize(w,w),a||(w=e.negate(w,w)),g=l.scaleToGeodeticSurface(n,W),i=v(g,w,c,i,l,s,1,1),r=e.clone(r,we),w=e.subtract(r,t,I),w=e.normalize(w,w),a||(w=e.negate(w,w)),g=l.scaleToGeodeticSurface(r,W),i=v(g,w,c,i,l,s,1,1);return i}R.removeDuplicatesFromShape=function(e){let t=e.length,n=[];for(let r=t-1,o=0;o<t;r=o++){let t=e[r],a=e[o];ee.equals(t,a)||n.push(a)}return n},R.angleIsGreaterThanPi=function(t,n,r,o){let a=new te(r,o),l=a.projectPointOntoPlane(e.add(r,t,X),X),i=a.projectPointOntoPlane(e.add(r,n,Y),Y);return i.x*l.y-i.y*l.x>=0};var qe=new e,Pe=new e;R.computePositions=function(t,n,r,o,a){let l=o._ellipsoid,i=je(t,l),c=o._granularity,s=o._cornerType,u=a?Le(n,r):ge(n,r),d=a?ge(n,r):void 0,g=r.height/2,m=r.width/2,h=t.length,y=[],f=a?[]:void 0,p=Te,E=Be,x=Ce,P=ze,b=Ae,B=be,O=Oe,j=ve,H=De,z=t[0],S=t[1];P=l.geodeticSurfaceNormal(z,P),p=e.subtract(S,z,p),p=e.normalize(p,p),j=e.cross(P,p,j),j=e.normalize(j,j);let T,A,D=i[0],L=i[1];a&&(f=v(z,j,d,f,l,D+g,1,1)),H=e.clone(z,H),z=S,E=e.negate(p,E);for(let k=1;k<h-1;k++){let n=a?2:1;if(S=t[k+1],z.equals(S)){he("Positions are too close and are considered equivalent with rounding error.");continue}p=e.subtract(S,z,p),p=e.normalize(p,p),P=l.geodeticSurfaceNormal(z,P);let r=e.multiplyByScalar(P,e.dot(p,P),qe);e.subtract(p,r,r),e.normalize(r,r);let o=e.multiplyByScalar(P,e.dot(E,P),Pe);if(e.subtract(E,o,o),e.normalize(o,o),Q.equalsEpsilon(Math.abs(e.dot(r,o)),1,Q.EPSILON7))y=v(H,j,u,y,l,D+g,1,1),H=z;else{x=e.add(p,E,x),x=e.normalize(x,x),x=e.cross(x,P,x),x=e.cross(P,x,x),x=e.normalize(x,x);let t=1/Math.max(.25,e.magnitude(e.cross(x,E,I))),r=R.angleIsGreaterThanPi(p,E,z,l);r?(b=e.add(z,e.multiplyByScalar(x,t*m,x),b),B=e.add(b,e.multiplyByScalar(j,m,B),B),w[0]=e.clone(H,w[0]),w[1]=e.clone(B,w[1]),T=ne(w,D+g,L+g,c),A=_.generateArc({positions:w,granularity:c,ellipsoid:l}),y=ce(A,j,u,y,l,T,1),j=e.cross(P,p,j),j=e.normalize(j,j),O=e.add(b,e.multiplyByScalar(j,m,O),O),s===G.ROUNDED||s===G.BEVELED?xe(b,B,O,s,r,l,y,u,L+g,a):(x=e.negate(x,x),y=v(z,x,u,y,l,L+g,t,n)),H=e.clone(O,H)):(b=e.add(z,e.multiplyByScalar(x,t*m,x),b),B=e.add(b,e.multiplyByScalar(j,-m,B),B),w[0]=e.clone(H,w[0]),w[1]=e.clone(B,w[1]),T=ne(w,D+g,L+g,c),A=_.generateArc({positions:w,granularity:c,ellipsoid:l}),y=ce(A,j,u,y,l,T,1),j=e.cross(P,p,j),j=e.normalize(j,j),O=e.add(b,e.multiplyByScalar(j,-m,O),O),s===G.ROUNDED||s===G.BEVELED?xe(b,B,O,s,r,l,y,u,L+g,a):y=v(z,x,u,y,l,L+g,t,n),H=e.clone(O,H)),E=e.negate(p,E)}D=L,L=i[k+1],z=S}w[0]=e.clone(H,w[0]),w[1]=e.clone(z,w[1]),T=ne(w,D+g,L+g,c),A=_.generateArc({positions:w,granularity:c,ellipsoid:l}),y=ce(A,j,u,y,l,T,1),a&&(f=v(z,j,d,f,l,L+g,1,1)),h=y.length;let N=a?h+f.length:h,V=new Float64Array(N);return V.set(y),a&&V.set(f,h),V};var lt=R;export{G as a,he as b,lt as c};