/**
 * @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 y,b as P,d as k}from"./chunk-IIT3SHXK.js";import{a as L}from"./chunk-DLCTHPIV.js";import{a as B}from"./chunk-I2ICH2LD.js";import{b as q}from"./chunk-R6A52HT4.js";import{e as T}from"./chunk-D32DZSEC.js";function Y(t){let a=t._uSquared,i=t._ellipsoid.maximumRadius,n=t._ellipsoid.minimumRadius,e=(i-n)/i,s=Math.cos(t._startHeading),h=Math.sin(t._startHeading),r=(1-e)*Math.tan(t._start.latitude),o=1/Math.sqrt(1+r*r),d=o*r,c=Math.atan2(r,s),u=o*h,l=u*u,M=1-l,_=Math.sqrt(M),g=a/4,f=g*g,p=f*g,m=f*f,q=1+g-3*f/4+5*p/4-175*m/64,H=1-g+15*f/8-35*p/8,v=1-3*g+35*f/4,O=1-5*g,P=q*c-H*Math.sin(2*c)*g/2-v*Math.sin(4*c)*f/16-O*Math.sin(6*c)*p/48-5*Math.sin(8*c)*m/512,y=t._constants;y.a=i,y.b=n,y.f=e,y.cosineHeading=s,y.sineHeading=h,y.tanU=r,y.cosineU=o,y.sineU=d,y.sigma=c,y.sineAlpha=u,y.sineSquaredAlpha=l,y.cosineSquaredAlpha=M,y.cosineAlpha=_,y.u2Over4=g,y.u4Over16=f,y.u6Over64=p,y.u8Over256=m,y.a0=q,y.a1=H,y.a2=v,y.a3=O,y.distanceRatio=P}function Z(t,a){return t*a*(4+t*(4-3*a))/16}function N(t,a,i,n,e,s,h){let r=Z(t,i);return(1-r)*t*a*(n+r*e*(h+r*s*(2*h*h-1)))}function $(t,a,i,n,e,s,h){let r,o,d,c,u,l=(a-i)/a,M=s-n,_=Math.atan((1-l)*Math.tan(e)),g=Math.atan((1-l)*Math.tan(h)),f=Math.cos(_),p=Math.sin(_),m=Math.cos(g),q=Math.sin(g),H=f*m,v=f*q,O=p*q,P=p*m,y=M,S=L.TWO_PI,T=Math.cos(y),b=Math.sin(y);do{T=Math.cos(y),b=Math.sin(y);let t,a=v-P*T;d=Math.sqrt(m*m*b*b+a*a),o=O+H*T,r=Math.atan2(d,o),0===d?(t=0,c=1):(t=H*b/d,c=1-t*t),S=y,u=o-2*O/c,isFinite(u)||(u=0),y=M+N(l,t,c,r,d,o,u)}while(Math.abs(y-S)>L.EPSILON12);let E=c*(a*a-i*i)/(i*i),j=1+E*(4096+E*(E*(320-175*E)-768))/16384,A=E*(256+E*(E*(74-47*E)-128))/1024,I=u*u,U=A*d*(u+A*(o*(2*I-1)-A*u*(4*d*d-3)*(4*I-3)/6)/4),k=i*j*(r-U),w=Math.atan2(m*b,v-P*T),x=Math.atan2(f*b,v*T-P);t._distance=k,t._startHeading=w,t._endHeading=x,t._uSquared=E}var j=new y,x=new y;function V(t,a,i,n){let e=y.normalize(n.cartographicToCartesian(a,x),j),s=y.normalize(n.cartographicToCartesian(i,x),x);q.typeOf.number.greaterThanOrEquals("value",Math.abs(Math.abs(y.angleBetween(e,s))-Math.PI),.0125),$(t,n.maximumRadius,n.minimumRadius,a.longitude,a.latitude,i.longitude,i.latitude),t._start=P.clone(a,t._start),t._end=P.clone(i,t._end),t._start.height=0,t._end.height=0,Y(t)}function E(t,a,i){let n=B(i,k.default);this._ellipsoid=n,this._start=new P,this._end=new P,this._constants={},this._startHeading=void 0,this._endHeading=void 0,this._distance=void 0,this._uSquared=void 0,T(t)&&T(a)&&V(this,t,a,n)}Object.defineProperties(E.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},surfaceDistance:{get:function(){return q.defined("distance",this._distance),this._distance}},start:{get:function(){return this._start}},end:{get:function(){return this._end}},startHeading:{get:function(){return q.defined("distance",this._distance),this._startHeading}},endHeading:{get:function(){return q.defined("distance",this._distance),this._endHeading}}}),E.prototype.setEndPoints=function(t,a){q.defined("start",t),q.defined("end",a),V(this,t,a,this._ellipsoid)},E.prototype.interpolateUsingFraction=function(t,a){return this.interpolateUsingSurfaceDistance(this._distance*t,a)},E.prototype.interpolateUsingSurfaceDistance=function(t,a){q.defined("distance",this._distance);let i=this._constants,n=i.distanceRatio+t/i.b,e=Math.cos(2*n),s=Math.cos(4*n),h=Math.cos(6*n),r=Math.sin(2*n),o=Math.sin(4*n),d=Math.sin(6*n),c=Math.sin(8*n),u=n*n,l=n*u,M=i.u8Over256,_=i.u2Over4,g=i.u6Over64,f=i.u4Over16,p=2*l*M*e/3+n*(1-_+7*f/4-15*g/4+579*M/64-(f-15*g/4+187*M/16)*e-(5*g/4-115*M/16)*s-29*M*h/16)+(_/2-f+71*g/32-85*M/16)*r+(5*f/16-5*g/4+383*M/96)*o-u*((g-11*M/2)*r+5*M*o/2)+(29*g/96-29*M/16)*d+539*M*c/1536,m=Math.asin(Math.sin(p)*i.cosineAlpha),H=Math.atan(i.a/i.b*Math.tan(m));p-=i.sigma;let v=Math.cos(2*i.sigma+p),O=Math.sin(p),y=Math.cos(p),S=i.cosineU*y,b=i.sineU*O,E=Math.atan2(O*i.sineHeading,S-b*i.cosineHeading)-N(i.f,i.sineAlpha,i.cosineSquaredAlpha,p,O,y,v);return T(a)?(a.longitude=this._start.longitude+E,a.latitude=H,a.height=0,a):new P(this._start.longitude+E,H,0)};var ct=E;export{ct as a};