isat.js 1.5 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481
  1. /*jslint plusplus: true */
  2. /*globals getgravc: true, dpper: true, dspace: true
  3. */
  4. /*global mag: true, dot: true, sign: true
  5. */
  6. /*global document: true
  7. */
  8. /*global nm2m: true, ft2m: true, jday : true
  9. */
  10. /*global opsmode: true
  11. */
  12. /*global
  13. alert: true,
  14. debug: true,
  15. window: true
  16. */
  17. /*global gstime: true, opsmode:true, xke:true, j2:true */
  18. /*globals days2mdh: true */
  19. /*global mag: true, small: true, infinite: true, twopi: true, angl: true,
  20. halfpi: true, newtonnu: true, cross: true, dot: true, sign: true,
  21. UNDEFINED: true,
  22. */
  23. /*globals getgravc: true, dpper: true, dspace: true */
  24. /*global getgravc: true, initl: true, dscom: true, dpper: true, dsinit: true,
  25. sgp4: true
  26. */
  27. /*global twoline2rv: true, sgp4: true, invjday: true, rv2coe: true,
  28. tumin: true, mu: true, radiusearthkm: true, xke: true,
  29. j2: true, j3: true, j4: true, j3oj2: true, opsmode: true,
  30. input: true,
  31. document: true,
  32. getgravc: true,
  33. alert: true,
  34. outfile: true,
  35. fprintf1: true,
  36. sprintf: true,
  37. debug: true,
  38. */
  39. /*global
  40. getgravc: true,
  41. debug: true,
  42. days2mdh: true,
  43. jday: true,
  44. input: true, // reads from HTML by id="prompt string"
  45. sgp4init: true,
  46. tumin: true, mu: true, radiusearthkm:true, xke: true, j2: true, j3: true, j4: true, j3oj2: true,
  47. */
  48. // -----------------------------------------------------------------------------
  49. //
  50. // isat
  51. //
  52. // This is the combined code of the translated Miura's MATLAB for minification.
  53. //
  54. // -----------------------------------------------------------------------------
  55. // angl.js
  56. //
  57. ! function() {
  58. var e, t, r;
  59. ! function(i) {
  60. function n(e, t) { return w.call(e, t) }
  61. function o(e, t) { var r, i, n, o, a, s, l, u, c, h, d = t && t.split("/"),
  62. m = g.map,
  63. p = m && m["*"] || {}; if (e && "." === e.charAt(0))
  64. if (t) { for (d = d.slice(0, d.length - 1), e = d.concat(e.split("/")), u = 0; u < e.length; u += 1)
  65. if (h = e[u], "." === h) e.splice(u, 1), u -= 1;
  66. else if (".." === h) { if (1 === u && (".." === e[2] || ".." === e[0])) break;
  67. u > 0 && (e.splice(u - 1, 2), u -= 2) } e = e.join("/") } else 0 === e.indexOf("./") && (e = e.substring(2)); if ((d || p) && m) { for (r = e.split("/"), u = r.length; u > 0; u -= 1) { if (i = r.slice(0, u).join("/"), d)
  68. for (c = d.length; c > 0; c -= 1)
  69. if (n = m[d.slice(0, c).join("/")], n && (n = n[i])) { o = n, a = u; break }
  70. if (o) break;!s && p && p[i] && (s = p[i], l = u) }!o && s && (o = s, a = l), o && (r.splice(0, a, o), e = r.join("/")) } return e }
  71. function a(e, t) { return function() { return m.apply(i, C.call(arguments, 0).concat([e, t])) } }
  72. function s(e) { return function(t) { return o(t, e) } }
  73. function l(e) { return function(t) { v[e] = t } }
  74. function u(e) { if (n(y, e)) { var t = y[e];
  75. delete y[e], _[e] = !0, d.apply(i, t) } if (!n(v, e) && !n(_, e)) throw new Error("No " + e); return v[e] }
  76. function c(e) { var t, r = e ? e.indexOf("!") : -1; return r > -1 && (t = e.substring(0, r), e = e.substring(r + 1, e.length)), [t, e] }
  77. function h(e) { return function() { return g && g.config && g.config[e] || {} } } var d, m, p, f, v = {},
  78. y = {},
  79. g = {},
  80. _ = {},
  81. w = Object.prototype.hasOwnProperty,
  82. C = [].slice;
  83. p = function(e, t) { var r, i = c(e),
  84. n = i[0]; return e = i[1], n && (n = o(n, t), r = u(n)), n ? e = r && r.normalize ? r.normalize(e, s(t)) : o(e, t) : (e = o(e, t), i = c(e), n = i[0], e = i[1], n && (r = u(n))), { f: n ? n + "!" + e : e, n: e, pr: n, p: r } }, f = { require: function(e) { return a(e) }, exports: function(e) { var t = v[e]; return "undefined" != typeof t ? t : v[e] = {} }, module: function(e) { return { id: e, uri: "", exports: v[e], config: h(e) } } }, d = function(e, t, r, o) { var s, c, h, d, m, g, w = []; if (o = o || e, "function" == typeof r) { for (t = !t.length && r.length ? ["require", "exports", "module"] : t, m = 0; m < t.length; m += 1)
  85. if (d = p(t[m], o), c = d.f, "require" === c) w[m] = f.require(e);
  86. else if ("exports" === c) w[m] = f.exports(e), g = !0;
  87. else if ("module" === c) s = w[m] = f.module(e);
  88. else if (n(v, c) || n(y, c) || n(_, c)) w[m] = u(c);
  89. else { if (!d.p) throw new Error(e + " missing " + c);
  90. d.p.load(d.n, a(o, !0), l(c), {}), w[m] = v[c] } h = r.apply(v[e], w), e && (s && s.exports !== i && s.exports !== v[e] ? v[e] = s.exports : h === i && g || (v[e] = h)) } else e && (v[e] = r) }, e = t = m = function(e, t, r, n, o) { return "string" == typeof e ? f[e] ? f[e](t) : u(p(e, t).f) : (e.splice || (g = e, t.splice ? (e = t, t = r, r = null) : e = i), t = t || function() {}, "function" == typeof r && (r = n, n = o), n ? d(i, e, t, r) : setTimeout(function() { d(i, e, t, r) }, 4), m) }, m.config = function(e) { return g = e, g.deps && m(g.deps, g.callback), m }, r = function(e, t, r) { t.splice || (r = t, t = []), n(v, e) || n(y, e) || (y[e] = [e, t, r]) }, r.amd = { jQuery: !0 } }(), r("Core/defined", [], function() { "use strict"; var e = function(e) { return void 0 !== e }; return e }), r("Core/freezeObject", ["./defined"], function(e) { "use strict"; var t = Object.freeze; return e(t) || (t = function(e) { return e }), t }), r("Core/defaultValue", ["./freezeObject"], function(e) { "use strict"; var t = function(e, t) { return void 0 !== e ? e : t }; return t.EMPTY_OBJECT = e({}), t }), r("Core/DeveloperError", ["./defined"], function(e) { "use strict"; var t = function(e) { this.name = "DeveloperError", this.message = e; var t = new Error;
  91. this.stack = t.stack }; return t.prototype.toString = function() { var t = this.name + ": " + this.message; return e(this.stack) && (t += "\n" + this.stack.toString()), t }, t }), r("Core/Cartesian3", ["./defaultValue", "./defined", "./DeveloperError", "./freezeObject"], function(e, t, r, i) { "use strict"; var n = function(t, r, i) { this.x = e(t, 0), this.y = e(r, 0), this.z = e(i, 0) };
  92. n.fromSpherical = function(i, o) { if (!t(i)) throw new r("spherical is required");
  93. t(o) || (o = new n); var a = i.clock,
  94. s = i.cone,
  95. l = e(i.magnitude, 1),
  96. u = l * Math.sin(s); return o.x = u * Math.cos(a), o.y = u * Math.sin(a), o.z = l * Math.cos(s), o }, n.fromArray = function(i, o, a) { if (!t(i)) throw new r("values is required."); if (o + 3 > i.length) throw new r("offset + 3 is greater than the length of the array."); return o = e(o, 0), t(a) || (a = new n), a.x = i[o + 0], a.y = i[o + 1], a.z = i[o + 2], a }, n.fromElements = function(e, r, i, o) { return t(o) ? (o.x = e, o.y = r, o.z = i, o) : new n(e, r, i) }, n.clone = function(e, r) { return t(e) ? t(r) ? (r.x = e.x, r.y = e.y, r.z = e.z, r) : new n(e.x, e.y, e.z) : void 0 }, n.fromCartesian4 = n.clone, n.packedLength = 3, n.pack = function(i, n, o) { if (!t(i)) throw new r("value is required"); if (!t(n)) throw new r("array is required");
  97. o = e(o, 0), n[o++] = i.x, n[o++] = i.y, n[o] = i.z }, n.unpack = function(i, o, a) { if (!t(i)) throw new r("array is required"); return o = e(o, 0), t(a) || (a = new n), a.x = i[o++], a.y = i[o++], a.z = i[o], a }, n.getMaximumComponent = function(e) { if (!t(e)) throw new r("cartesian is required"); return Math.max(e.x, e.y, e.z) }, n.getMinimumComponent = function(e) { if (!t(e)) throw new r("cartesian is required"); return Math.min(e.x, e.y, e.z) }, n.magnitudeSquared = function(e) { if (!t(e)) throw new r("cartesian is required"); return e.x * e.x + e.y * e.y + e.z * e.z }, n.magnitude = function(e) { return Math.sqrt(n.magnitudeSquared(e)) }; var o = new n;
  98. n.distance = function(e, i) { if (!t(e) || !t(i)) throw new r("left and right are required."); return n.subtract(e, i, o), n.magnitude(o) }, n.normalize = function(e, i) { if (!t(e)) throw new r("cartesian is required"); var o = n.magnitude(e); return t(i) ? (i.x = e.x / o, i.y = e.y / o, i.z = e.z / o, i) : new n(e.x / o, e.y / o, e.z / o) }, n.dot = function(e, i) { if (!t(e)) throw new r("left is required"); if (!t(i)) throw new r("right is required"); return e.x * i.x + e.y * i.y + e.z * i.z }, n.multiplyComponents = function(e, i, o) { if (!t(e)) throw new r("left is required"); if (!t(i)) throw new r("right is required"); return t(o) ? (o.x = e.x * i.x, o.y = e.y * i.y, o.z = e.z * i.z, o) : new n(e.x * i.x, e.y * i.y, e.z * i.z) }, n.add = function(e, i, o) { if (!t(e)) throw new r("left is required"); if (!t(i)) throw new r("right is required"); return t(o) ? (o.x = e.x + i.x, o.y = e.y + i.y, o.z = e.z + i.z, o) : new n(e.x + i.x, e.y + i.y, e.z + i.z) }, n.subtract = function(e, i, o) { if (!t(e)) throw new r("left is required"); if (!t(i)) throw new r("right is required"); return t(o) ? (o.x = e.x - i.x, o.y = e.y - i.y, o.z = e.z - i.z, o) : new n(e.x - i.x, e.y - i.y, e.z - i.z) }, n.multiplyByScalar = function(e, i, o) { if (!t(e)) throw new r("cartesian is required"); if ("number" != typeof i) throw new r("scalar is required and must be a number."); return t(o) ? (o.x = e.x * i, o.y = e.y * i, o.z = e.z * i, o) : new n(e.x * i, e.y * i, e.z * i) }, n.divideByScalar = function(e, i, o) { if (!t(e)) throw new r("cartesian is required"); if ("number" != typeof i) throw new r("scalar is required and must be a number."); return t(o) ? (o.x = e.x / i, o.y = e.y / i, o.z = e.z / i, o) : new n(e.x / i, e.y / i, e.z / i) }, n.negate = function(e, i) { if (!t(e)) throw new r("cartesian is required"); return t(i) ? (i.x = -e.x, i.y = -e.y, i.z = -e.z, i) : new n(-e.x, -e.y, -e.z) }, n.abs = function(e, i) { if (!t(e)) throw new r("cartesian is required"); return t(i) ? (i.x = Math.abs(e.x), i.y = Math.abs(e.y), i.z = Math.abs(e.z), i) : new n(Math.abs(e.x), Math.abs(e.y), Math.abs(e.z)) }; var a = new n;
  99. n.lerp = function(e, i, o, s) { if (!t(e)) throw new r("start is required."); if (!t(i)) throw new r("end is required."); if ("number" != typeof o) throw new r("t is required and must be a number."); return n.multiplyByScalar(i, o, a), s = n.multiplyByScalar(e, 1 - o, s), n.add(a, s, s) }; var s = new n,
  100. l = new n;
  101. n.angleBetween = function(e, i) { if (!t(e)) throw new r("left is required"); if (!t(i)) throw new r("right is required");
  102. n.normalize(e, s), n.normalize(i, l); var o = n.dot(s, l),
  103. a = n.cross(s, l, s).magnitude(); return Math.atan2(a, o) }; var u = new n; return n.mostOrthogonalAxis = function(e, i) { if (!t(e)) throw new r("cartesian is required."); var o = n.normalize(e, u); return n.abs(o, o), i = o.x <= o.y ? o.x <= o.z ? n.clone(n.UNIT_X, i) : n.clone(n.UNIT_Z, i) : o.y <= o.z ? n.clone(n.UNIT_Y, i) : n.clone(n.UNIT_Z, i) }, n.equals = function(e, r) { return e === r || t(e) && t(r) && e.x === r.x && e.y === r.y && e.z === r.z }, n.equalsEpsilon = function(e, i, n) { if ("number" != typeof n) throw new r("epsilon is required and must be a number."); return e === i || t(e) && t(i) && Math.abs(e.x - i.x) <= n && Math.abs(e.y - i.y) <= n && Math.abs(e.z - i.z) <= n }, n.cross = function(e, i, o) { if (!t(e)) throw new r("left is required"); if (!t(i)) throw new r("right is required"); var a = e.x,
  104. s = e.y,
  105. l = e.z,
  106. u = i.x,
  107. c = i.y,
  108. h = i.z,
  109. d = s * h - l * c,
  110. m = l * u - a * h,
  111. p = a * c - s * u; return t(o) ? (o.x = d, o.y = m, o.z = p, o) : new n(d, m, p) }, n.ZERO = i(new n(0, 0, 0)), n.UNIT_X = i(new n(1, 0, 0)), n.UNIT_Y = i(new n(0, 1, 0)), n.UNIT_Z = i(new n(0, 0, 1)), n.prototype.getMaximumComponent = function() { return n.getMaximumComponent(this) }, n.prototype.getMinimumComponent = function() { return n.getMinimumComponent(this) }, n.prototype.clone = function(e) { return n.clone(this, e) }, n.prototype.magnitudeSquared = function() { return n.magnitudeSquared(this) }, n.prototype.magnitude = function() { return n.magnitude(this) }, n.prototype.normalize = function(e) { return n.normalize(this, e) }, n.prototype.dot = function(e) { return n.dot(this, e) }, n.prototype.multiplyComponents = function(e, t) { return n.multiplyComponents(this, e, t) }, n.prototype.add = function(e, t) { return n.add(this, e, t) }, n.prototype.subtract = function(e, t) { return n.subtract(this, e, t) }, n.prototype.multiplyByScalar = function(e, t) { return n.multiplyByScalar(this, e, t) }, n.prototype.divideByScalar = function(e, t) { return n.divideByScalar(this, e, t) }, n.prototype.negate = function(e) { return n.negate(this, e) }, n.prototype.abs = function(e) { return n.abs(this, e) }, n.prototype.lerp = function(e, t, r) { return n.lerp(this, e, t, r) }, n.prototype.angleBetween = function(e) { return n.angleBetween(this, e) }, n.prototype.mostOrthogonalAxis = function(e) { return n.mostOrthogonalAxis(this, e) }, n.prototype.equals = function(e) { return n.equals(this, e) }, n.prototype.equalsEpsilon = function(e, t) { return n.equalsEpsilon(this, e, t) }, n.prototype.toString = function() { return "(" + this.x + ", " + this.y + ", " + this.z + ")" }, n.prototype.cross = function(e, t) { return n.cross(this, e, t) }, n }), r("Core/Enumeration", ["./defined"], function(e) { "use strict"; var t = function(t, r, i) { if (this.value = t, this.name = r, e(i))
  112. for (var n in i) i.hasOwnProperty(n) && (this[n] = i[n]) }; return t.prototype.valueOf = function() { return this.value }, t.prototype.toString = function() { return this.name }, t }), r("Core/Intersect", ["./Enumeration"], function(e) { "use strict"; var t = { OUTSIDE: new e(-1, "OUTSIDE"), INTERSECTING: new e(0, "INTERSECTING"), INSIDE: new e(1, "INSIDE") }; return t }), r("Core/AxisAlignedBoundingBox", ["./defaultValue", "./defined", "./DeveloperError", "./Cartesian3", "./Intersect"], function(e, t, r, i, n) { "use strict"; var o = function(r, n, o) { this.minimum = i.clone(e(r, i.ZERO)), this.maximum = i.clone(e(n, i.ZERO)), t(o) ? o = i.clone(o) : (o = i.add(this.minimum, this.maximum), i.multiplyByScalar(o, .5, o)), this.center = o };
  113. o.fromPoints = function(e, r) { if (t(r) || (r = new o), !t(e) || 0 === e.length) return r.minimum = i.clone(i.ZERO, r.minimum), r.maximum = i.clone(i.ZERO, r.maximum), r.center = i.clone(i.ZERO, r.center), r; for (var n = e[0].x, a = e[0].y, s = e[0].z, l = e[0].x, u = e[0].y, c = e[0].z, h = e.length, d = 1; h > d; d++) { var m = e[d],
  114. p = m.x,
  115. f = m.y,
  116. v = m.z;
  117. n = Math.min(p, n), l = Math.max(p, l), a = Math.min(f, a), u = Math.max(f, u), s = Math.min(v, s), c = Math.max(v, c) } var y = r.minimum;
  118. y.x = n, y.y = a, y.z = s; var g = r.maximum;
  119. g.x = l, g.y = u, g.z = c; var _ = i.add(y, g, r.center); return i.multiplyByScalar(_, .5, _), r }, o.clone = function(e, r) { return t(e) ? t(r) ? (r.minimum = i.clone(e.minimum, r.minimum), r.maximum = i.clone(e.maximum, r.maximum), r.center = i.clone(e.center, r.center), r) : new o(e.minimum, e.maximum) : void 0 }, o.equals = function(e, r) { return e === r || t(e) && t(r) && i.equals(e.center, r.center) && i.equals(e.minimum, r.minimum) && i.equals(e.maximum, r.maximum) }; var a = new i; return o.intersect = function(e, o) { if (!t(e)) throw new r("box is required."); if (!t(o)) throw new r("plane is required.");
  120. a = i.subtract(e.maximum, e.minimum, a); var s = i.multiplyByScalar(a, .5, a),
  121. l = s.x * Math.abs(o.x) + s.y * Math.abs(o.y) + s.z * Math.abs(o.z),
  122. u = i.dot(e.center, o) + o.w; return u - l > 0 ? n.INSIDE : 0 > u + l ? n.OUTSIDE : n.INTERSECTING }, o.prototype.clone = function(e) { return o.clone(this, e) }, o.prototype.intersect = function(e) { return o.intersect(this, e) }, o.prototype.equals = function(e) { return o.equals(this, e) }, o }), r("ThirdParty/mersenne-twister", [], function() { var e = function(e) { void 0 == e && (e = (new Date).getTime()), this.N = 624, this.M = 397, this.MATRIX_A = 2567483615, this.UPPER_MASK = 2147483648, this.LOWER_MASK = 2147483647, this.mt = new Array(this.N), this.mti = this.N + 1, this.init_genrand(e) }; return e.prototype.init_genrand = function(e) { for (this.mt[0] = e >>> 0, this.mti = 1; this.mti < this.N; this.mti++) { var e = this.mt[this.mti - 1] ^ this.mt[this.mti - 1] >>> 30;
  123. this.mt[this.mti] = (1812433253 * ((4294901760 & e) >>> 16) << 16) + 1812433253 * (65535 & e) + this.mti, this.mt[this.mti] >>>= 0 } }, e.prototype.genrand_int32 = function() { var e, t = new Array(0, this.MATRIX_A); if (this.mti >= this.N) { var r; for (this.mti == this.N + 1 && this.init_genrand(5489), r = 0; r < this.N - this.M; r++) e = this.mt[r] & this.UPPER_MASK | this.mt[r + 1] & this.LOWER_MASK, this.mt[r] = this.mt[r + this.M] ^ e >>> 1 ^ t[1 & e]; for (; r < this.N - 1; r++) e = this.mt[r] & this.UPPER_MASK | this.mt[r + 1] & this.LOWER_MASK, this.mt[r] = this.mt[r + (this.M - this.N)] ^ e >>> 1 ^ t[1 & e];
  124. e = this.mt[this.N - 1] & this.UPPER_MASK | this.mt[0] & this.LOWER_MASK, this.mt[this.N - 1] = this.mt[this.M - 1] ^ e >>> 1 ^ t[1 & e], this.mti = 0 } return e = this.mt[this.mti++], e ^= e >>> 11, e ^= 2636928640 & e << 7, e ^= 4022730752 & e << 15, e ^= e >>> 18, e >>> 0 }, e.prototype.random = function() { return this.genrand_int32() * (1 / 4294967296) }, e }), r("Core/Math", ["./defaultValue", "./defined", "./DeveloperError", "../ThirdParty/mersenne-twister"], function(e, t, r, i) { "use strict"; var n = {};
  125. n.EPSILON1 = .1, n.EPSILON2 = .01, n.EPSILON3 = .001, n.EPSILON4 = 1e-4, n.EPSILON5 = 1e-5, n.EPSILON6 = 1e-6, n.EPSILON7 = 1e-7, n.EPSILON8 = 1e-8, n.EPSILON9 = 1e-9, n.EPSILON10 = 1e-10, n.EPSILON11 = 1e-11, n.EPSILON12 = 1e-12, n.EPSILON13 = 1e-13, n.EPSILON14 = 1e-14, n.EPSILON15 = 1e-15, n.EPSILON16 = 1e-16, n.EPSILON17 = 1e-17, n.EPSILON18 = 1e-18, n.EPSILON19 = 1e-19, n.EPSILON20 = 1e-20, n.GRAVITATIONALPARAMETER = 3986004418e5, n.SOLAR_RADIUS = 6995e5, n.SIXTY_FOUR_KILOBYTES = 65536, n.sign = function(e) { return e > 0 ? 1 : 0 > e ? -1 : 0 }, n.sinh = function(e) { var t = Math.pow(Math.E, e),
  126. r = Math.pow(Math.E, -1 * e); return .5 * (t - r) }, n.cosh = function(e) { var t = Math.pow(Math.E, e),
  127. r = Math.pow(Math.E, -1 * e); return .5 * (t + r) }, n.lerp = function(e, t, r) { return (1 - r) * e + r * t }, n.PI = Math.PI, n.ONE_OVER_PI = 1 / Math.PI, n.PI_OVER_TWO = .5 * Math.PI, n.PI_OVER_THREE = Math.PI / 3, n.PI_OVER_FOUR = Math.PI / 4, n.PI_OVER_SIX = Math.PI / 6, n.THREE_PI_OVER_TWO = .5 * 3 * Math.PI, n.TWO_PI = 2 * Math.PI, n.ONE_OVER_TWO_PI = 1 / (2 * Math.PI), n.RADIANS_PER_DEGREE = Math.PI / 180, n.DEGREES_PER_RADIAN = 180 / Math.PI, n.RADIANS_PER_ARCSECOND = n.RADIANS_PER_DEGREE / 3600, n.toRadians = function(e) { return e * n.RADIANS_PER_DEGREE }, n.toDegrees = function(e) { return e * n.DEGREES_PER_RADIAN }, n.convertLongitudeRange = function(e) { var t = n.TWO_PI,
  128. r = e - Math.floor(e / t) * t; return r < -Math.PI ? r + t : r >= Math.PI ? r - t : r }, n.negativePiToPi = function(e) { for (var t = n.EPSILON10, r = n.PI, i = n.TWO_PI; - (r + t) > e;) e += i; if (-r > e) return -r; for (; e > r + t;) e -= i; return e > r ? r : e }, n.zeroToTwoPi = function(e) { var t = e % n.TWO_PI; return 0 > t ? (t + n.TWO_PI) % n.TWO_PI : t }, n.equalsEpsilon = function(t, r, i) { return i = e(i, 0), Math.abs(t - r) <= i }; var o = [1];
  129. n.factorial = function(e) { if ("number" != typeof e || 0 > e) throw new r("A number greater than or equal to 0 is required."); var t = o.length; if (e >= t)
  130. for (var i = o[t - 1], n = t; e >= n; n++) o.push(i * n); return o[e] }, n.incrementWrap = function(t, i, n) { if (n = e(n, 0), n >= i) throw new r("Maximum value must be greater than minimum value."); return ++t, t > i && (t = n), t }, n.isPowerOfTwo = function(t) { if ("number" != typeof t || 0 > t) throw new r("A number greater than or equal to 0 is required."); var i = e(t, 0); return 0 !== i && 0 === (i & i - 1) }, n.clamp = function(e, t, r) { return t > e ? t : e > r ? r : e }; var a = new i; return n.setRandomNumberSeed = function(e) { if (!t(e)) throw new r("seed is required.");
  131. a = new i(e) }, n.nextRandomNumber = function() { return a.random() }, n }), r("Core/Cartographic", ["./defaultValue", "./defined", "./DeveloperError", "./freezeObject", "./Math"], function(e, t, r, i, n) { "use strict"; var o = function(t, r, i) { this.longitude = e(t, 0), this.latitude = e(r, 0), this.height = e(i, 0) }; return o.fromDegrees = function(r, i, a, s) { return r = n.toRadians(e(r, 0)), i = n.toRadians(e(i, 0)), a = e(a, 0), t(s) ? (s.longitude = r, s.latitude = i, s.height = a, s) : new o(r, i, a) }, o.clone = function(e, r) { return t(e) ? t(r) ? (r.longitude = e.longitude, r.latitude = e.latitude, r.height = e.height, r) : new o(e.longitude, e.latitude, e.height) : void 0 }, o.equals = function(e, r) { return e === r || t(e) && t(r) && e.longitude === r.longitude && e.latitude === r.latitude && e.height === r.height }, o.equalsEpsilon = function(e, i, n) { if ("number" != typeof n) throw new r("epsilon is required and must be a number."); return e === i || t(e) && t(i) && Math.abs(e.longitude - i.longitude) <= n && Math.abs(e.latitude - i.latitude) <= n && Math.abs(e.height - i.height) <= n }, o.toString = function(e) { if (!t(e)) throw new r("cartographic is required"); return "(" + e.longitude + ", " + e.latitude + ", " + e.height + ")" }, o.ZERO = i(new o(0, 0, 0)), o.prototype.clone = function(e) { return o.clone(this, e) }, o.prototype.equals = function(e) { return o.equals(this, e) }, o.prototype.equalsEpsilon = function(e, t) { return o.equalsEpsilon(this, e, t) }, o.prototype.toString = function() { return o.toString(this) }, o }), r("Core/Ellipsoid", ["./freezeObject", "./defaultValue", "./defined", "./DeveloperError", "./Math", "./Cartesian3", "./Cartographic"], function(e, t, r, i, n, o, a) { "use strict"; var s = function(e, r, a) { if (e = t(e, 0), r = t(r, 0), a = t(a, 0), 0 > e || 0 > r || 0 > a) throw new i("All radii components must be greater than or equal to zero.");
  132. this._radii = new o(e, r, a), this._radiiSquared = new o(e * e, r * r, a * a), this._radiiToTheFourth = new o(e * e * e * e, r * r * r * r, a * a * a * a), this._oneOverRadii = new o(0 === e ? 0 : 1 / e, 0 === r ? 0 : 1 / r, 0 === a ? 0 : 1 / a), this._oneOverRadiiSquared = new o(0 === e ? 0 : 1 / (e * e), 0 === r ? 0 : 1 / (r * r), 0 === a ? 0 : 1 / (a * a)), this._minimumRadius = Math.min(e, r, a), this._maximumRadius = Math.max(e, r, a), this._centerToleranceSquared = n.EPSILON1 };
  133. s.clone = function(e, t) { if (!r(e)) return void 0; var i = e._radii; return r(t) ? (o.clone(i, t._radii), o.clone(e._radiiSquared, t._radiiSquared), o.clone(e._radiiToTheFourth, t._radiiToTheFourth), o.clone(e._oneOverRadii, t._oneOverRadii), o.clone(e._oneOverRadiiSquared, t._oneOverRadiiSquared), t._minimumRadius = e._minimumRadius, t._maximumRadius = e._maximumRadius, t._centerToleranceSquared = e._centerToleranceSquared, t) : new s(i.x, i.y, i.z) }, s.fromCartesian3 = function(e) { return r(e) ? new s(e.x, e.y, e.z) : new s }, s.WGS84 = e(new s(6378137, 6378137, 6356752.314245179)), s.UNIT_SPHERE = e(new s(1, 1, 1)), s.prototype.getRadii = function() { return this._radii }, s.prototype.getRadiiSquared = function() { return this._radiiSquared }, s.prototype.getRadiiToTheFourth = function() { return this._radiiToTheFourth }, s.prototype.getOneOverRadii = function() { return this._oneOverRadii }, s.prototype.getOneOverRadiiSquared = function() { return this._oneOverRadiiSquared }, s.prototype.getMinimumRadius = function() { return this._minimumRadius }, s.prototype.getMaximumRadius = function() { return this._maximumRadius }, s.prototype.clone = function(e) { return s.clone(this, e) }, s.prototype.geocentricSurfaceNormal = o.normalize, s.prototype.geodeticSurfaceNormalCartographic = function(e, t) { if (!r(e)) throw new i("cartographic is required."); var n = e.longitude,
  134. a = e.latitude,
  135. s = Math.cos(a),
  136. l = s * Math.cos(n),
  137. u = s * Math.sin(n),
  138. c = Math.sin(a); return r(t) || (t = new o), t.x = l, t.y = u, t.z = c, o.normalize(t, t) }, s.prototype.geodeticSurfaceNormal = function(e, t) { return t = o.multiplyComponents(e, this._oneOverRadiiSquared, t), o.normalize(t, t) }; var l = new o,
  139. u = new o;
  140. s.prototype.cartographicToCartesian = function(e, t) { var r = l,
  141. i = u;
  142. this.geodeticSurfaceNormalCartographic(e, r), o.multiplyComponents(this._radiiSquared, r, i); var n = Math.sqrt(o.dot(r, i)); return o.divideByScalar(i, n, i), o.multiplyByScalar(r, e.height, r), o.add(i, r, t) }, s.prototype.cartographicArrayToCartesianArray = function(e, t) { if (!r(e)) throw new i("cartographics is required."); var n = e.length;
  143. r(t) ? t.length = n : t = new Array(n); for (var o = 0; n > o; o++) t[o] = this.cartographicToCartesian(e[o], t[o]); return t }; var c = new o,
  144. h = new o,
  145. d = new o;
  146. s.prototype.cartesianToCartographic = function(e, t) { var i = this.scaleToGeodeticSurface(e, h); if (!r(i)) return void 0; var s = this.geodeticSurfaceNormal(i, c),
  147. l = o.subtract(e, i, d),
  148. u = Math.atan2(s.y, s.x),
  149. m = Math.asin(s.z),
  150. p = n.sign(o.dot(l, e)) * o.magnitude(l); return r(t) ? (t.longitude = u, t.latitude = m, t.height = p, t) : new a(u, m, p) }, s.prototype.cartesianArrayToCartographicArray = function(e, t) { if (!r(e)) throw new i("cartesians is required."); var n = e.length;
  151. r(t) ? t.length = n : t = new Array(n); for (var o = 0; n > o; ++o) t[o] = this.cartesianToCartographic(e[o], t[o]); return t }; var m, p = new o; return s.prototype.scaleToGeodeticSurface = function(e, t) { if (!r(e)) throw new i("cartesian is required."); var a = e.x,
  152. s = e.y,
  153. l = e.z,
  154. u = this._oneOverRadii,
  155. c = u.x,
  156. h = u.y,
  157. d = u.z,
  158. f = a * a * c * c,
  159. v = s * s * h * h,
  160. y = l * l * d * d,
  161. g = f + v + y,
  162. _ = Math.sqrt(1 / g),
  163. w = o.multiplyByScalar(e, _, m); if (g < this._centerToleranceSquared) return isFinite(_) ? o.clone(w, t) : void 0; var C = this._oneOverRadiiSquared,
  164. x = C.x,
  165. S = C.y,
  166. E = C.z,
  167. b = p;
  168. b.x = 2 * w.x * x, b.y = 2 * w.y * S, b.z = 2 * w.z * E; var T, A, M, P, D, I, O, R, L, z, N, F = (1 - _) * o.magnitude(e) / (.5 * o.magnitude(b)),
  169. B = 0;
  170. do { F -= B, M = 1 / (1 + F * x), P = 1 / (1 + F * S), D = 1 / (1 + F * E), I = M * M, O = P * P, R = D * D, L = I * M, z = O * P, N = R * D, T = f * I + v * O + y * R - 1, A = f * L * x + v * z * S + y * N * E; var V = -2 * A;
  171. B = T / V } while (Math.abs(T) > n.EPSILON12); return r(t) ? (t.x = a * M, t.y = s * P, t.z = l * D, t) : new o(a * M, s * P, l * D) }, s.prototype.scaleToGeocentricSurface = function(e, t) { if (!r(e)) throw new i("cartesian is required."); var n = e.x,
  172. a = e.y,
  173. s = e.z,
  174. l = this._oneOverRadiiSquared,
  175. u = 1 / Math.sqrt(n * n * l.x + a * a * l.y + s * s * l.z); return o.multiplyByScalar(e, u, t) }, s.prototype.transformPositionToScaledSpace = function(e, t) { return o.multiplyComponents(e, this._oneOverRadii, t) }, s.prototype.equals = function(e) { return this === e || r(e) && o.equals(this._radii, e._radii) }, s.prototype.toString = function() { return this._radii.toString() }, s }), r("Core/GeographicProjection", ["./defaultValue", "./defined", "./Cartesian3", "./Cartographic", "./Ellipsoid"], function(e, t, r, i, n) { "use strict"; var o = function(t) { this._ellipsoid = e(t, n.WGS84), this._semimajorAxis = this._ellipsoid.getMaximumRadius(), this._oneOverSemimajorAxis = 1 / this._semimajorAxis }; return o.prototype.getEllipsoid = function() { return this._ellipsoid }, o.prototype.project = function(e, i) { var n = this._semimajorAxis,
  176. o = e.longitude * n,
  177. a = e.latitude * n,
  178. s = e.height; return t(i) ? (i.x = o, i.y = a, i.z = s, i) : new r(o, a, s) }, o.prototype.unproject = function(e, r) { var n = this._oneOverSemimajorAxis,
  179. o = e.x * n,
  180. a = e.y * n,
  181. s = e.z; return t(r) ? (r.longitude = o, r.latitude = a, r.height = s, r) : new i(o, a, s) }, o }), r("Core/BoundingRectangle", ["./defaultValue", "./defined", "./DeveloperError", "./Cartographic", "./GeographicProjection", "./Intersect"], function(e, t, r, i, n, o) { "use strict"; var a = function(t, r, i, n) { this.x = e(t, 0), this.y = e(r, 0), this.width = e(i, 0), this.height = e(n, 0) };
  182. a.fromPoints = function(e, r) { if (t(r) || (r = new a), !t(e) || 0 === e.length) return r.x = 0, r.y = 0, r.width = 0, r.height = 0, r; for (var i = e.length, n = e[0].x, o = e[0].y, s = e[0].x, l = e[0].y, u = 1; i > u; u++) { var c = e[u],
  183. h = c.x,
  184. d = c.y;
  185. n = Math.min(h, n), s = Math.max(h, s), o = Math.min(d, o), l = Math.max(d, l) } return r.x = n, r.y = o, r.width = s - n, r.height = l - o, r }; var s = new n,
  186. l = new i,
  187. u = new i; return a.fromExtent = function(r, i, n) { if (t(n) || (n = new a), !t(r)) return n.x = 0, n.y = 0, n.width = 0, n.height = 0, n;
  188. i = e(i, s); var o = i.project(r.getSouthwest(l)),
  189. c = i.project(r.getNortheast(u)); return c.subtract(o, c), n.x = o.x, n.y = o.y, n.width = c.x, n.height = c.y, n }, a.clone = function(e, r) { return t(e) ? t(r) ? (r.x = e.x, r.y = e.y, r.width = e.width, r.height = e.height, r) : new a(e.x, e.y, e.width, e.height) : void 0 }, a.union = function(e, i, n) { if (!t(e)) throw new r("left is required."); if (!t(i)) throw new r("right is required.");
  190. t(n) || (n = new a); var o = Math.min(e.x, i.x),
  191. s = Math.min(e.y, i.y),
  192. l = Math.max(e.x + e.width, i.x + i.width),
  193. u = Math.max(e.y + e.height, i.y + i.height); return n.x = o, n.y = s, n.width = l - o, n.height = u - s, n }, a.expand = function(e, i, n) { if (!t(e)) throw new r("rectangle is required."); if (!t(i)) throw new r("point is required.");
  194. n = a.clone(e, n); var o = i.x - n.x,
  195. s = i.y - n.y; return o > n.width ? n.width = o : 0 > o && (n.width -= o, n.x = i.x), s > n.height ? n.height = s : 0 > s && (n.height -= s, n.y = i.y), n }, a.intersect = function(e, i) { if (!t(e)) throw new r("left is required."); if (!t(i)) throw new r("right is required."); var n = e.x,
  196. a = e.y,
  197. s = i.x,
  198. l = i.y; return n > s + i.width || n + e.width < s || a + e.height < l || a > l + i.height ? o.OUTSIDE : o.INTERSECTING }, a.equals = function(e, r) { return e === r || t(e) && t(r) && e.x === r.x && e.y === r.y && e.width === r.width && e.height === r.height }, a.prototype.clone = function(e) { return a.clone(this, e) }, a.prototype.union = function(e, t) { return a.union(this, e, t) }, a.prototype.expand = function(e, t) { return a.expand(this, e, t) }, a.prototype.intersect = function(e) { return a.intersect(this, e) }, a.prototype.equals = function(e) { return a.equals(this, e) }, a }), r("Core/Cartesian4", ["./defaultValue", "./defined", "./DeveloperError", "./freezeObject"], function(e, t, r, i) { "use strict"; var n = function(t, r, i, n) { this.x = e(t, 0), this.y = e(r, 0), this.z = e(i, 0), this.w = e(n, 0) };
  199. n.fromArray = function(i, o, a) { if (!t(i)) throw new r("values is required."); if (o + 4 > i.length) throw new r("offset + 4 is greater than the length of the array."); return o = e(o, 0), t(a) || (a = new n), a.x = i[o + 0], a.y = i[o + 1], a.z = i[o + 2], a.w = i[o + 3], a }, n.fromElements = function(e, r, i, o, a) { return t(a) ? (a.x = e, a.y = r, a.z = i, a.w = o, a) : new n(e, r, i, o) }, n.clone = function(e, r) { return t(e) ? t(r) ? (r.x = e.x, r.y = e.y, r.z = e.z, r.w = e.w, r) : new n(e.x, e.y, e.z, e.w) : void 0 }, n.packedLength = 4, n.pack = function(i, n, o) { if (!t(i)) throw new r("value is required"); if (!t(n)) throw new r("array is required");
  200. o = e(o, 0), n[o++] = i.x, n[o++] = i.y, n[o++] = i.z, n[o] = i.w }, n.unpack = function(i, o, a) { if (!t(i)) throw new r("array is required"); return o = e(o, 0), t(a) || (a = new n), a.x = i[o++], a.y = i[o++], a.z = i[o++], a.w = i[o], a }, n.getMaximumComponent = function(e) { if (!t(e)) throw new r("cartesian is required"); return Math.max(e.x, e.y, e.z, e.w) }, n.getMinimumComponent = function(e) { if (!t(e)) throw new r("cartesian is required"); return Math.min(e.x, e.y, e.z, e.w) }, n.magnitudeSquared = function(e) { if (!t(e)) throw new r("cartesian is required"); return e.x * e.x + e.y * e.y + e.z * e.z + e.w * e.w }, n.magnitude = function(e) { return Math.sqrt(n.magnitudeSquared(e)) }; var o = new n;
  201. n.distance = function(e, i) { if (!t(e) || !t(i)) throw new r("left and right are required."); return n.subtract(e, i, o), n.magnitude(o) }, n.normalize = function(e, i) { if (!t(e)) throw new r("cartesian is required"); var o = n.magnitude(e); return t(i) ? (i.x = e.x / o, i.y = e.y / o, i.z = e.z / o, i.w = e.w / o, i) : new n(e.x / o, e.y / o, e.z / o, e.w / o) }, n.dot = function(e, i) { if (!t(e)) throw new r("left is required"); if (!t(i)) throw new r("right is required"); return e.x * i.x + e.y * i.y + e.z * i.z + e.w * i.w }, n.multiplyComponents = function(e, i, o) { if (!t(e)) throw new r("left is required"); if (!t(i)) throw new r("right is required"); return t(o) ? (o.x = e.x * i.x, o.y = e.y * i.y, o.z = e.z * i.z, o.w = e.w * i.w, o) : new n(e.x * i.x, e.y * i.y, e.z * i.z, e.w * i.w) }, n.add = function(e, i, o) { if (!t(e)) throw new r("left is required"); if (!t(i)) throw new r("right is required"); return t(o) ? (o.x = e.x + i.x, o.y = e.y + i.y, o.z = e.z + i.z, o.w = e.w + i.w, o) : new n(e.x + i.x, e.y + i.y, e.z + i.z, e.w + i.w) }, n.subtract = function(e, i, o) { if (!t(e)) throw new r("left is required"); if (!t(i)) throw new r("right is required"); return t(o) ? (o.x = e.x - i.x, o.y = e.y - i.y, o.z = e.z - i.z, o.w = e.w - i.w, o) : new n(e.x - i.x, e.y - i.y, e.z - i.z, e.w - i.w) }, n.multiplyByScalar = function(e, i, o) { if (!t(e)) throw new r("cartesian is required"); if ("number" != typeof i) throw new r("scalar is required and must be a number."); return t(o) ? (o.x = e.x * i, o.y = e.y * i, o.z = e.z * i, o.w = e.w * i, o) : new n(e.x * i, e.y * i, e.z * i, e.w * i) }, n.divideByScalar = function(e, i, o) { if (!t(e)) throw new r("cartesian is required"); if ("number" != typeof i) throw new r("scalar is required and must be a number."); return t(o) ? (o.x = e.x / i, o.y = e.y / i, o.z = e.z / i, o.w = e.w / i, o) : new n(e.x / i, e.y / i, e.z / i, e.w / i) }, n.negate = function(e, i) { if (!t(e)) throw new r("cartesian is required"); return t(i) ? (i.x = -e.x, i.y = -e.y, i.z = -e.z, i.w = -e.w, i) : new n(-e.x, -e.y, -e.z, -e.w) }, n.abs = function(e, i) { if (!t(e)) throw new r("cartesian is required"); return t(i) ? (i.x = Math.abs(e.x), i.y = Math.abs(e.y), i.z = Math.abs(e.z), i.w = Math.abs(e.w), i) : new n(Math.abs(e.x), Math.abs(e.y), Math.abs(e.z), Math.abs(e.w)) }; var a = new n;
  202. n.lerp = function(e, i, o, s) { if (!t(e)) throw new r("start is required."); if (!t(i)) throw new r("end is required."); if ("number" != typeof o) throw new r("t is required and must be a number."); return n.multiplyByScalar(i, o, a), s = n.multiplyByScalar(e, 1 - o, s), n.add(a, s, s) }; var s = new n; return n.mostOrthogonalAxis = function(e, i) { if (!t(e)) throw new r("cartesian is required."); var o = n.normalize(e, s); return n.abs(o, o), i = o.x <= o.y ? o.x <= o.z ? o.x <= o.w ? n.clone(n.UNIT_X, i) : n.clone(n.UNIT_W, i) : o.z <= o.w ? n.clone(n.UNIT_Z, i) : n.clone(n.UNIT_W, i) : o.y <= o.z ? o.y <= o.w ? n.clone(n.UNIT_Y, i) : n.clone(n.UNIT_W, i) : o.z <= o.w ? n.clone(n.UNIT_Z, i) : n.clone(n.UNIT_W, i) }, n.equals = function(e, r) { return e === r || t(e) && t(r) && e.x === r.x && e.y === r.y && e.z === r.z && e.w === r.w }, n.equalsEpsilon = function(e, i, n) { if ("number" != typeof n) throw new r("epsilon is required and must be a number."); return e === i || t(e) && t(i) && Math.abs(e.x - i.x) <= n && Math.abs(e.y - i.y) <= n && Math.abs(e.z - i.z) <= n && Math.abs(e.w - i.w) <= n }, n.ZERO = i(new n(0, 0, 0, 0)), n.UNIT_X = i(new n(1, 0, 0, 0)), n.UNIT_Y = i(new n(0, 1, 0, 0)), n.UNIT_Z = i(new n(0, 0, 1, 0)), n.UNIT_W = i(new n(0, 0, 0, 1)), n.prototype.getMaximumComponent = function() { return n.getMaximumComponent(this) }, n.prototype.getMinimumComponent = function() { return n.getMinimumComponent(this) }, n.prototype.clone = function(e) { return n.clone(this, e) }, n.prototype.magnitudeSquared = function() { return n.magnitudeSquared(this) }, n.prototype.magnitude = function() { return n.magnitude(this) }, n.prototype.normalize = function(e) { return n.normalize(this, e) }, n.prototype.dot = function(e) { return n.dot(this, e) }, n.prototype.multiplyComponents = function(e, t) { return n.multiplyComponents(this, e, t) }, n.prototype.add = function(e, t) { return n.add(this, e, t) }, n.prototype.subtract = function(e, t) { return n.subtract(this, e, t) }, n.prototype.multiplyByScalar = function(e, t) { return n.multiplyByScalar(this, e, t) }, n.prototype.divideByScalar = function(e, t) { return n.divideByScalar(this, e, t) }, n.prototype.negate = function(e) { return n.negate(this, e) }, n.prototype.abs = function(e) { return n.abs(this, e) }, n.prototype.lerp = function(e, t, r) { return n.lerp(this, e, t, r) }, n.prototype.mostOrthogonalAxis = function(e) { return n.mostOrthogonalAxis(this, e) }, n.prototype.equals = function(e) { return n.equals(this, e) }, n.prototype.equalsEpsilon = function(e, t) { return n.equalsEpsilon(this, e, t) }, n.prototype.toString = function() { return "(" + this.x + ", " + this.y + ", " + this.z + ", " + this.w + ")" }, n }), r("Core/Interval", ["./defaultValue"], function(e) { "use strict"; var t = function(t, r) { this.start = e(t, 0), this.stop = e(r, 0) }; return t }), r("Core/Matrix3", ["./Cartesian3", "./defaultValue", "./defined", "./DeveloperError", "./freezeObject"], function(e, t, r, i, n) {
  203. "use strict";
  204. var o = function(e, r, i, n, o, a, s, l, u) { this[0] = t(e, 0), this[1] = t(n, 0), this[2] = t(s, 0), this[3] = t(r, 0), this[4] = t(o, 0), this[5] = t(l, 0), this[6] = t(i, 0), this[7] = t(a, 0), this[8] = t(u, 0) };
  205. return o.clone = function(e, t) { return r(e) ? r(t) ? (t[0] = e[0], t[1] = e[1], t[2] = e[2], t[3] = e[3], t[4] = e[4], t[5] = e[5], t[6] = e[6], t[7] = e[7], t[8] = e[8], t) : new o(e[0], e[3], e[6], e[1], e[4], e[7], e[2], e[5], e[8]) : void 0 }, o.fromColumnMajorArray = function(e, t) { if (!r(e)) throw new i("values parameter is required"); return o.clone(e, t) }, o.fromRowMajorArray = function(e, t) { if (!r(e)) throw new i("values is required."); return r(t) ? (t[0] = e[0], t[1] = e[3], t[2] = e[6], t[3] = e[1], t[4] = e[4], t[5] = e[7], t[6] = e[2], t[7] = e[5], t[8] = e[8], t) : new o(e[0], e[1], e[2], e[3], e[4], e[5], e[6], e[7], e[8]) }, o.fromQuaternion = function(e, t) { if (!r(e)) throw new i("quaternion is required"); var n = e.x * e.x,
  206. a = e.x * e.y,
  207. s = e.x * e.z,
  208. l = e.x * e.w,
  209. u = e.y * e.y,
  210. c = e.y * e.z,
  211. h = e.y * e.w,
  212. d = e.z * e.z,
  213. m = e.z * e.w,
  214. p = e.w * e.w,
  215. f = n - u - d + p,
  216. v = 2 * (a + m),
  217. y = 2 * (s - h),
  218. g = 2 * (a - m),
  219. _ = -n + u - d + p,
  220. w = 2 * (c + l),
  221. C = 2 * (s + h),
  222. x = 2 * (c - l),
  223. S = -n - u + d + p; return r(t) ? (t[0] = f, t[1] = g, t[2] = C, t[3] = v, t[4] = _, t[5] = x, t[6] = y, t[7] = w, t[8] = S, t) : new o(f, v, y, g, _, w, C, x, S) }, o.fromScale = function(e, t) { if (!r(e)) throw new i("scale is required."); return r(t) ? (t[0] = e.x, t[1] = 0, t[2] = 0, t[3] = 0, t[4] = e.y, t[5] = 0, t[6] = 0, t[7] = 0, t[8] = e.z, t) : new o(e.x, 0, 0, 0, e.y, 0, 0, 0, e.z) }, o.fromUniformScale = function(e, t) { if ("number" != typeof e) throw new i("scale is required."); return r(t) ? (t[0] = e, t[1] = 0, t[2] = 0, t[3] = 0, t[4] = e, t[5] = 0, t[6] = 0, t[7] = 0, t[8] = e, t) : new o(e, 0, 0, 0, e, 0, 0, 0, e) }, o.fromRotationX = function(e, t) { if (!r(e)) throw new i("angle is required."); var n = Math.cos(e),
  224. a = Math.sin(e); return r(t) ? (t[0] = 1, t[1] = 0, t[2] = 0, t[3] = 0, t[4] = n, t[5] = a, t[6] = 0, t[7] = -a, t[8] = n, t) : new o(1, 0, 0, 0, n, -a, 0, a, n) }, o.fromRotationY = function(e, t) { if (!r(e)) throw new i("angle is required."); var n = Math.cos(e),
  225. a = Math.sin(e); return r(t) ? (t[0] = n, t[1] = 0, t[2] = -a, t[3] = 0, t[4] = 1, t[5] = 0, t[6] = a, t[7] = 0, t[8] = n, t) : new o(n, 0, a, 0, 1, 0, -a, 0, n) }, o.fromRotationZ = function(e, t) { if (!r(e)) throw new i("angle is required."); var n = Math.cos(e),
  226. a = Math.sin(e); return r(t) ? (t[0] = n, t[1] = a, t[2] = 0, t[3] = -a, t[4] = n, t[5] = 0, t[6] = 0, t[7] = 0, t[8] = 1, t) : new o(n, -a, 0, a, n, 0, 0, 0, 1) }, o.toArray = function(e, t) { if (!r(e)) throw new i("matrix is required"); return r(t) ? (t[0] = e[0], t[1] = e[1], t[2] = e[2], t[3] = e[3], t[4] = e[4], t[5] = e[5], t[6] = e[6], t[7] = e[7], t[8] = e[8], t) : [e[0], e[1], e[2], e[3], e[4], e[5], e[6], e[7], e[8]] }, o.getElementIndex = function(e, t) {
  227. if ("number" != typeof t || 0 > t || t > 2) throw new i("row is required and must be 0, 1, or 2.");
  228. if ("number" != typeof e || 0 > e || e > 2) throw new i("column is required and must be 0, 1, or 2.");
  229. return 3 * e + t
  230. }, o.getColumn = function(t, n, o) { if (!r(t)) throw new i("matrix is required."); if ("number" != typeof n || 0 > n || n > 2) throw new i("index is required and must be 0, 1, or 2."); var a = 3 * n,
  231. s = t[a],
  232. l = t[a + 1],
  233. u = t[a + 2]; return r(o) ? (o.x = s, o.y = l, o.z = u, o) : new e(s, l, u) }, o.setColumn = function(e, t, n, a) { if (!r(e)) throw new i("matrix is required"); if (!r(n)) throw new i("cartesian is required"); if ("number" != typeof t || 0 > t || t > 2) throw new i("index is required and must be 0, 1, or 2.");
  234. a = o.clone(e, a); var s = 3 * t; return a[s] = n.x, a[s + 1] = n.y, a[s + 2] = n.z, a }, o.getRow = function(t, n, o) { if (!r(t)) throw new i("matrix is required."); if ("number" != typeof n || 0 > n || n > 2) throw new i("index is required and must be 0, 1, or 2."); var a = t[n],
  235. s = t[n + 3],
  236. l = t[n + 6]; return r(o) ? (o.x = a, o.y = s, o.z = l, o) : new e(a, s, l) }, o.setRow = function(e, t, n, a) { if (!r(e)) throw new i("matrix is required"); if (!r(n)) throw new i("cartesian is required"); if ("number" != typeof t || 0 > t || t > 2) throw new i("index is required and must be 0, 1, or 2."); return a = o.clone(e, a), a[t] = n.x, a[t + 3] = n.y, a[t + 6] = n.z, a }, o.multiply = function(e, t, n) { if (!r(e)) throw new i("left is required"); if (!r(t)) throw new i("right is required"); var a = e[0] * t[0] + e[3] * t[1] + e[6] * t[2],
  237. s = e[1] * t[0] + e[4] * t[1] + e[7] * t[2],
  238. l = e[2] * t[0] + e[5] * t[1] + e[8] * t[2],
  239. u = e[0] * t[3] + e[3] * t[4] + e[6] * t[5],
  240. c = e[1] * t[3] + e[4] * t[4] + e[7] * t[5],
  241. h = e[2] * t[3] + e[5] * t[4] + e[8] * t[5],
  242. d = e[0] * t[6] + e[3] * t[7] + e[6] * t[8],
  243. m = e[1] * t[6] + e[4] * t[7] + e[7] * t[8],
  244. p = e[2] * t[6] + e[5] * t[7] + e[8] * t[8]; return r(n) ? (n[0] = a, n[1] = s, n[2] = l, n[3] = u, n[4] = c, n[5] = h, n[6] = d, n[7] = m, n[8] = p, n) : new o(a, u, d, s, c, m, l, h, p) }, o.multiplyByVector = function(t, n, o) { if (!r(t)) throw new i("matrix is required"); if (!r(n)) throw new i("cartesian is required"); var a = n.x,
  245. s = n.y,
  246. l = n.z,
  247. u = t[0] * a + t[3] * s + t[6] * l,
  248. c = t[1] * a + t[4] * s + t[7] * l,
  249. h = t[2] * a + t[5] * s + t[8] * l; return r(o) ? (o.x = u, o.y = c, o.z = h, o) : new e(u, c, h) }, o.multiplyByScalar = function(e, t, n) { if (!r(e)) throw new i("matrix is required"); if ("number" != typeof t) throw new i("scalar is required and must be a number"); return r(n) ? (n[0] = e[0] * t, n[1] = e[1] * t, n[2] = e[2] * t, n[3] = e[3] * t, n[4] = e[4] * t, n[5] = e[5] * t, n[6] = e[6] * t, n[7] = e[7] * t, n[8] = e[8] * t, n) : new o(e[0] * t, e[3] * t, e[6] * t, e[1] * t, e[4] * t, e[7] * t, e[2] * t, e[5] * t, e[8] * t) }, o.negate = function(e, t) { if (!r(e)) throw new i("matrix is required"); return r(t) ? (t[0] = -e[0], t[1] = -e[1], t[2] = -e[2], t[3] = -e[3], t[4] = -e[4], t[5] = -e[5], t[6] = -e[6], t[7] = -e[7], t[8] = -e[8], t) : new o(-e[0], -e[3], -e[6], -e[1], -e[4], -e[7], -e[2], -e[5], -e[8]) }, o.transpose = function(e, t) { if (!r(e)) throw new i("matrix is required"); var n = e[0],
  250. a = e[3],
  251. s = e[6],
  252. l = e[1],
  253. u = e[4],
  254. c = e[7],
  255. h = e[2],
  256. d = e[5],
  257. m = e[8]; return r(t) ? (t[0] = n, t[1] = a, t[2] = s, t[3] = l, t[4] = u, t[5] = c, t[6] = h, t[7] = d, t[8] = m, t) : new o(n, l, h, a, u, d, s, c, m) }, o.equals = function(e, t) { return e === t || r(e) && r(t) && e[0] === t[0] && e[1] === t[1] && e[2] === t[2] && e[3] === t[3] && e[4] === t[4] && e[5] === t[5] && e[6] === t[6] && e[7] === t[7] && e[8] === t[8] }, o.equalsEpsilon = function(e, t, n) { if ("number" != typeof n) throw new i("epsilon is required and must be a number"); return e === t || r(e) && r(t) && Math.abs(e[0] - t[0]) <= n && Math.abs(e[1] - t[1]) <= n && Math.abs(e[2] - t[2]) <= n && Math.abs(e[3] - t[3]) <= n && Math.abs(e[4] - t[4]) <= n && Math.abs(e[5] - t[5]) <= n && Math.abs(e[6] - t[6]) <= n && Math.abs(e[7] - t[7]) <= n && Math.abs(e[8] - t[8]) <= n }, o.IDENTITY = n(new o(1, 0, 0, 0, 1, 0, 0, 0, 1)), o.COLUMN0ROW0 = 0, o.COLUMN0ROW1 = 1, o.COLUMN0ROW2 = 2, o.COLUMN1ROW0 = 3, o.COLUMN1ROW1 = 4, o.COLUMN1ROW2 = 5, o.COLUMN2ROW0 = 6, o.COLUMN2ROW1 = 7, o.COLUMN2ROW2 = 8, o.prototype.clone = function(e) { return o.clone(this, e) }, o.prototype.toArray = function(e) { return o.toArray(this, e) }, o.prototype.getColumn = function(e, t) { return o.getColumn(this, e, t) }, o.prototype.setColumn = function(e, t, r) { return o.setColumn(this, e, t, r) }, o.prototype.getRow = function(e, t) { return o.getRow(this, e, t) }, o.prototype.setRow = function(e, t, r) { return o.setRow(this, e, t, r) }, o.prototype.multiply = function(e, t) { return o.multiply(this, e, t) }, o.prototype.multiplyByVector = function(e, t) { return o.multiplyByVector(this, e, t) }, o.prototype.multiplyByScalar = function(e, t) { return o.multiplyByScalar(this, e, t) }, o.prototype.negate = function(e) { return o.negate(this, e) }, o.prototype.transpose = function(e) { return o.transpose(this, e) }, o.prototype.equals = function(e) { return o.equals(this, e) }, o.prototype.equalsEpsilon = function(e, t) { return o.equalsEpsilon(this, e, t) }, o.prototype.toString = function() { return "(" + this[0] + ", " + this[3] + ", " + this[6] + ")\n" + "(" + this[1] + ", " + this[4] + ", " + this[7] + ")\n" + "(" + this[2] + ", " + this[5] + ", " + this[8] + ")" }, o
  258. }), r("Core/RuntimeError", ["./defined"], function(e) { "use strict"; var t = function(e) { this.name = "RuntimeError", this.message = e; var t = new Error;
  259. this.stack = t.stack }; return t.prototype.toString = function() { var t = this.name + ": " + this.message; return e(this.stack) && (t += "\n" + this.stack.toString()), t }, t }), r("Core/Matrix4", ["./Cartesian3", "./Cartesian4", "./defaultValue", "./defined", "./DeveloperError", "./freezeObject", "./Math", "./Matrix3", "./RuntimeError"], function(e, t, r, i, n, o, a, s, l) { "use strict"; var u = function(e, t, i, n, o, a, s, l, u, c, h, d, m, p, f, v) { this[0] = r(e, 0), this[1] = r(o, 0), this[2] = r(u, 0), this[3] = r(m, 0), this[4] = r(t, 0), this[5] = r(a, 0), this[6] = r(c, 0), this[7] = r(p, 0), this[8] = r(i, 0), this[9] = r(s, 0), this[10] = r(h, 0), this[11] = r(f, 0), this[12] = r(n, 0), this[13] = r(l, 0), this[14] = r(d, 0), this[15] = r(v, 0) };
  260. u.clone = function(e, t) { return i(e) ? i(t) ? (t[0] = e[0], t[1] = e[1], t[2] = e[2], t[3] = e[3], t[4] = e[4], t[5] = e[5], t[6] = e[6], t[7] = e[7], t[8] = e[8], t[9] = e[9], t[10] = e[10], t[11] = e[11], t[12] = e[12], t[13] = e[13], t[14] = e[14], t[15] = e[15], t) : new u(e[0], e[4], e[8], e[12], e[1], e[5], e[9], e[13], e[2], e[6], e[10], e[14], e[3], e[7], e[11], e[15]) : void 0 }, u.fromColumnMajorArray = function(e, t) { if (!i(e)) throw new n("values parameter is required"); return u.clone(e, t) }, u.fromRowMajorArray = function(e, t) { if (!i(e)) throw new n("values is required."); return i(t) ? (t[0] = e[0], t[1] = e[4], t[2] = e[8], t[3] = e[12], t[4] = e[1], t[5] = e[5], t[6] = e[9], t[7] = e[13], t[8] = e[2], t[9] = e[6], t[10] = e[10], t[11] = e[14], t[12] = e[3], t[13] = e[7], t[14] = e[11], t[15] = e[15], t) : new u(e[0], e[1], e[2], e[3], e[4], e[5], e[6], e[7], e[8], e[9], e[10], e[11], e[12], e[13], e[14], e[15]) }, u.fromRotationTranslation = function(e, t, r) { if (!i(e)) throw new n("rotation is required."); if (!i(t)) throw new n("translation is required."); return i(r) ? (r[0] = e[0], r[1] = e[1], r[2] = e[2], r[3] = 0, r[4] = e[3], r[5] = e[4], r[6] = e[5], r[7] = 0, r[8] = e[6], r[9] = e[7], r[10] = e[8], r[11] = 0, r[12] = t.x, r[13] = t.y, r[14] = t.z, r[15] = 1, r) : new u(e[0], e[3], e[6], t.x, e[1], e[4], e[7], t.y, e[2], e[5], e[8], t.z, 0, 0, 0, 1) }, u.fromTranslation = function(e, t) { return u.fromRotationTranslation(s.IDENTITY, e, t) }, u.fromScale = function(e, t) { if (!i(e)) throw new n("scale is required."); return i(t) ? (t[0] = e.x, t[1] = 0, t[2] = 0, t[3] = 0, t[4] = 0, t[5] = e.y, t[6] = 0, t[7] = 0, t[8] = 0, t[9] = 0, t[10] = e.z, t[11] = 0, t[12] = 0, t[13] = 0, t[14] = 0, t[15] = 1, t) : new u(e.x, 0, 0, 0, 0, e.y, 0, 0, 0, 0, e.z, 0, 0, 0, 0, 1) }, u.fromUniformScale = function(e, t) { if ("number" != typeof e) throw new n("scale is required."); return i(t) ? (t[0] = e, t[1] = 0, t[2] = 0, t[3] = 0, t[4] = 0, t[5] = e, t[6] = 0, t[7] = 0, t[8] = 0, t[9] = 0, t[10] = e, t[11] = 0, t[12] = 0, t[13] = 0, t[14] = 0, t[15] = 1, t) : new u(e, 0, 0, 0, 0, e, 0, 0, 0, 0, e, 0, 0, 0, 0, 1) }; var c = new e,
  261. h = new e,
  262. d = new e;
  263. u.fromCamera = function(t, r) { if (!i(t)) throw new n("camera is required."); var o = t.eye,
  264. a = t.target,
  265. s = t.up; if (!i(o)) throw new n("camera.eye is required."); if (!i(a)) throw new n("camera.target is required."); if (!i(s)) throw new n("camera.up is required.");
  266. e.subtract(a, o, c).normalize(c), e.cross(c, s, h).normalize(h), e.cross(h, c, d).normalize(d); var l = h.x,
  267. m = h.y,
  268. p = h.z,
  269. f = c.x,
  270. v = c.y,
  271. y = c.z,
  272. g = d.x,
  273. _ = d.y,
  274. w = d.z,
  275. C = o.x,
  276. x = o.y,
  277. S = o.z,
  278. E = l * -C + m * -x + p * -S,
  279. b = g * -C + _ * -x + w * -S,
  280. T = f * C + v * x + y * S; return i(r) ? (r[0] = l, r[1] = g, r[2] = -f, r[3] = 0, r[4] = m, r[5] = _, r[6] = -v, r[7] = 0, r[8] = p, r[9] = w, r[10] = -y, r[11] = 0, r[12] = E, r[13] = b, r[14] = T, r[15] = 1, r) : new u(l, m, p, E, g, _, w, b, -f, -v, -y, T, 0, 0, 0, 1) }, u.computePerspectiveFieldOfView = function(e, t, r, o, a) { if (0 >= e || e > Math.PI) throw new n("fovY must be in [0, PI)."); if (0 >= t) throw new n("aspectRatio must be greater than zero."); if (0 >= r) throw new n("near must be greater than zero."); if (0 >= o) throw new n("far must be greater than zero."); var s = Math.tan(.5 * e),
  281. l = 1 / s,
  282. c = l / t,
  283. h = (o + r) / (r - o),
  284. d = 2 * o * r / (r - o); return i(a) ? (a[0] = c, a[1] = 0, a[2] = 0, a[3] = 0, a[4] = 0, a[5] = l, a[6] = 0, a[7] = 0, a[8] = 0, a[9] = 0, a[10] = h, a[11] = -1, a[12] = 0, a[13] = 0, a[14] = d, a[15] = 0, a) : new u(c, 0, 0, 0, 0, l, 0, 0, 0, 0, h, d, 0, 0, -1, 0) }, u.computeOrthographicOffCenter = function(e, t, r, o, a, s, l) { if (!i(e)) throw new n("left is required."); if (!i(t)) throw new n("right is required."); if (!i(r)) throw new n("bottom is required."); if (!i(o)) throw new n("top is required."); if (!i(a)) throw new n("near is required."); if (!i(s)) throw new n("far is required."); var c = 1 / (t - e),
  285. h = 1 / (o - r),
  286. d = 1 / (s - a),
  287. m = -(t + e) * c,
  288. p = -(o + r) * h,
  289. f = -(s + a) * d; return c *= 2, h *= 2, d *= -2, i(l) ? (l[0] = c, l[1] = 0, l[2] = 0, l[3] = 0, l[4] = 0, l[5] = h, l[6] = 0, l[7] = 0, l[8] = 0, l[9] = 0, l[10] = d, l[11] = 0, l[12] = m, l[13] = p, l[14] = f, l[15] = 1, l) : new u(c, 0, 0, m, 0, h, 0, p, 0, 0, d, f, 0, 0, 0, 1) }, u.computePerspectiveOffCenter = function(e, t, r, o, a, s, l) { if (!i(e)) throw new n("left is required."); if (!i(t)) throw new n("right is required."); if (!i(r)) throw new n("bottom is required."); if (!i(o)) throw new n("top is required."); if (!i(a)) throw new n("near is required."); if (!i(s)) throw new n("far is required."); var c = 2 * a / (t - e),
  290. h = 2 * a / (o - r),
  291. d = (t + e) / (t - e),
  292. m = (o + r) / (o - r),
  293. p = -(s + a) / (s - a),
  294. f = -1,
  295. v = -2 * s * a / (s - a); return i(l) ? (l[0] = c, l[1] = 0, l[2] = 0, l[3] = 0, l[4] = 0, l[5] = h, l[6] = 0, l[7] = 0, l[8] = d, l[9] = m, l[10] = p, l[11] = f, l[12] = 0, l[13] = 0, l[14] = v, l[15] = 0, l) : new u(c, 0, d, 0, 0, h, m, 0, 0, 0, p, v, 0, 0, f, 0) }, u.computeInfinitePerspectiveOffCenter = function(e, t, r, o, a, s) { if (!i(e)) throw new n("left is required."); if (!i(t)) throw new n("right is required."); if (!i(r)) throw new n("bottom is required."); if (!i(o)) throw new n("top is required."); if (!i(a)) throw new n("near is required."); var l = 2 * a / (t - e),
  296. c = 2 * a / (o - r),
  297. h = (t + e) / (t - e),
  298. d = (o + r) / (o - r),
  299. m = -1,
  300. p = -1,
  301. f = -2 * a; return i(s) ? (s[0] = l, s[1] = 0, s[2] = 0, s[3] = 0, s[4] = 0, s[5] = c, s[6] = 0, s[7] = 0, s[8] = h, s[9] = d, s[10] = m, s[11] = p, s[12] = 0, s[13] = 0, s[14] = f, s[15] = 0, s) : new u(l, 0, h, 0, 0, c, d, 0, 0, 0, m, f, 0, 0, p, 0) }, u.computeViewportTransformation = function(e, t, n, o) { e = r(e, r.EMPTY_OBJECT); var a = r(e.x, 0),
  302. s = r(e.y, 0),
  303. l = r(e.width, 0),
  304. c = r(e.height, 0);
  305. t = r(t, 0), n = r(n, 1); var h = .5 * l,
  306. d = .5 * c,
  307. m = .5 * (n - t),
  308. p = h,
  309. f = d,
  310. v = m,
  311. y = a + h,
  312. g = s + d,
  313. _ = t + m,
  314. w = 1; return i(o) ? (o[0] = p, o[1] = 0, o[2] = 0, o[3] = 0, o[4] = 0, o[5] = f, o[6] = 0, o[7] = 0, o[8] = 0, o[9] = 0, o[10] = v, o[11] = 0, o[12] = y, o[13] = g, o[14] = _, o[15] = w, o) : new u(p, 0, 0, y, 0, f, 0, g, 0, 0, v, _, 0, 0, 0, w) }, u.toArray = function(e, t) { if (!i(e)) throw new n("matrix is required"); return i(t) ? (t[0] = e[0], t[1] = e[1], t[2] = e[2], t[3] = e[3], t[4] = e[4], t[5] = e[5], t[6] = e[6], t[7] = e[7], t[8] = e[8], t[9] = e[9], t[10] = e[10], t[11] = e[11], t[12] = e[12], t[13] = e[13], t[14] = e[14], t[15] = e[15], t) : [e[0], e[1], e[2], e[3], e[4], e[5], e[6], e[7], e[8], e[9], e[10], e[11], e[12], e[13], e[14], e[15]] }, u.getElementIndex = function(e, t) { if ("number" != typeof t || 0 > t || t > 3) throw new n("row is required and must be 0, 1, 2, or 3."); if ("number" != typeof e || 0 > e || e > 3) throw new n("column is required and must be 0, 1, 2, or 3."); return 4 * e + t }, u.getColumn = function(e, r, o) { if (!i(e)) throw new n("matrix is required."); if ("number" != typeof r || 0 > r || r > 3) throw new n("index is required and must be 0, 1, 2, or 3."); var a = 4 * r,
  315. s = e[a],
  316. l = e[a + 1],
  317. u = e[a + 2],
  318. c = e[a + 3]; return i(o) ? (o.x = s, o.y = l, o.z = u, o.w = c, o) : new t(s, l, u, c) }, u.setColumn = function(e, t, r, o) { if (!i(e)) throw new n("matrix is required"); if (!i(r)) throw new n("cartesian is required"); if ("number" != typeof t || 0 > t || t > 3) throw new n("index is required and must be 0, 1, 2, or 3.");
  319. o = u.clone(e, o); var a = 4 * t; return o[a] = r.x, o[a + 1] = r.y, o[a + 2] = r.z, o[a + 3] = r.w, o }, u.getRow = function(e, r, o) { if (!i(e)) throw new n("matrix is required."); if ("number" != typeof r || 0 > r || r > 3) throw new n("index is required and must be 0, 1, 2, or 3."); var a = e[r],
  320. s = e[r + 4],
  321. l = e[r + 8],
  322. u = e[r + 12]; return i(o) ? (o.x = a, o.y = s, o.z = l, o.w = u, o) : new t(a, s, l, u) }, u.setRow = function(e, t, r, o) { if (!i(e)) throw new n("matrix is required"); if (!i(r)) throw new n("cartesian is required"); if ("number" != typeof t || 0 > t || t > 3) throw new n("index is required and must be 0, 1, 2, or 3."); return o = u.clone(e, o), o[t] = r.x, o[t + 4] = r.y, o[t + 8] = r.z, o[t + 12] = r.w, o }, u.multiply = function(e, t, r) { if (!i(e)) throw new n("left is required"); if (!i(t)) throw new n("right is required"); var o = e[0],
  323. a = e[1],
  324. s = e[2],
  325. l = e[3],
  326. c = e[4],
  327. h = e[5],
  328. d = e[6],
  329. m = e[7],
  330. p = e[8],
  331. f = e[9],
  332. v = e[10],
  333. y = e[11],
  334. g = e[12],
  335. _ = e[13],
  336. w = e[14],
  337. C = e[15],
  338. x = t[0],
  339. S = t[1],
  340. E = t[2],
  341. b = t[3],
  342. T = t[4],
  343. A = t[5],
  344. M = t[6],
  345. P = t[7],
  346. D = t[8],
  347. I = t[9],
  348. O = t[10],
  349. R = t[11],
  350. L = t[12],
  351. z = t[13],
  352. N = t[14],
  353. F = t[15],
  354. B = o * x + c * S + p * E + g * b,
  355. V = a * x + h * S + f * E + _ * b,
  356. q = s * x + d * S + v * E + w * b,
  357. k = l * x + m * S + y * E + C * b,
  358. U = o * T + c * A + p * M + g * P,
  359. W = a * T + h * A + f * M + _ * P,
  360. G = s * T + d * A + v * M + w * P,
  361. H = l * T + m * A + y * M + C * P,
  362. j = o * D + c * I + p * O + g * R,
  363. Y = a * D + h * I + f * O + _ * R,
  364. X = s * D + d * I + v * O + w * R,
  365. Z = l * D + m * I + y * O + C * R,
  366. K = o * L + c * z + p * N + g * F,
  367. J = a * L + h * z + f * N + _ * F,
  368. Q = s * L + d * z + v * N + w * F,
  369. $ = l * L + m * z + y * N + C * F; return i(r) ? (r[0] = B, r[1] = V, r[2] = q, r[3] = k, r[4] = U, r[5] = W, r[6] = G, r[7] = H, r[8] = j, r[9] = Y, r[10] = X, r[11] = Z, r[12] = K, r[13] = J, r[14] = Q, r[15] = $, r) : new u(B, U, j, K, V, W, Y, J, q, G, X, Q, k, H, Z, $) }, u.multiplyByTranslation = function(e, t, r) { if (!i(e)) throw new n("matrix is required"); if (!i(t)) throw new n("translation is required"); var o = t.x,
  370. a = t.y,
  371. s = t.z,
  372. l = o * e[0] + a * e[4] + s * e[8] + e[12],
  373. c = o * e[1] + a * e[5] + s * e[9] + e[13],
  374. h = o * e[2] + a * e[6] + s * e[10] + e[14]; return i(r) ? (r[0] = e[0], r[1] = e[1], r[2] = e[2], r[3] = e[3], r[4] = e[4], r[5] = e[5], r[6] = e[6], r[7] = e[7], r[8] = e[8], r[9] = e[9], r[10] = e[10], r[11] = e[11], r[12] = l, r[13] = c, r[14] = h, r[15] = e[15], r) : new u(e[0], e[4], e[8], l, e[1], e[5], e[9], c, e[2], e[6], e[10], h, e[3], e[7], e[11], e[15]) }, u.multiplyByUniformScale = function(e, t, r) { if (!i(e)) throw new n("matrix is required"); if ("number" != typeof t) throw new n("scale is required"); return 1 === t ? u.clone(e, r) : i(r) ? (r[0] = t * e[0], r[1] = t * e[1], r[2] = t * e[2], r[3] = 0, r[4] = t * e[4], r[5] = t * e[5], r[6] = t * e[6], r[7] = 0, r[8] = t * e[8], r[9] = t * e[9], r[10] = t * e[10], r[11] = 0, r[12] = e[12], r[13] = e[13], r[14] = e[14], r[15] = 1, r) : new u(t * e[0], t * e[4], t * e[8], e[12], t * e[1], t * e[5], t * e[9], e[13], t * e[2], t * e[6], t * e[10], e[14], 0, 0, 0, 1) }, u.multiplyByVector = function(e, r, o) { if (!i(e)) throw new n("matrix is required"); if (!i(r)) throw new n("cartesian is required"); var a = r.x,
  375. s = r.y,
  376. l = r.z,
  377. u = r.w,
  378. c = e[0] * a + e[4] * s + e[8] * l + e[12] * u,
  379. h = e[1] * a + e[5] * s + e[9] * l + e[13] * u,
  380. d = e[2] * a + e[6] * s + e[10] * l + e[14] * u,
  381. m = e[3] * a + e[7] * s + e[11] * l + e[15] * u; return i(o) ? (o.x = c, o.y = h, o.z = d, o.w = m, o) : new t(c, h, d, m) }; var m = new t(0, 0, 0, 1); return u.multiplyByPoint = function(e, t, r) { if (!i(t)) throw new n("cartesian is required"); return m.x = t.x, m.y = t.y, m.z = t.z, u.multiplyByVector(e, m, r) }, u.multiplyByScalar = function(e, t, r) { if (!i(e)) throw new n("matrix is required"); if ("number" != typeof t) throw new n("scalar is required and must be a number"); return i(r) ? (r[0] = e[0] * t, r[1] = e[1] * t, r[2] = e[2] * t, r[3] = e[3] * t, r[4] = e[4] * t, r[5] = e[5] * t, r[6] = e[6] * t, r[7] = e[7] * t, r[8] = e[8] * t, r[9] = e[9] * t, r[10] = e[10] * t, r[11] = e[11] * t, r[12] = e[12] * t, r[13] = e[13] * t, r[14] = e[14] * t, r[15] = e[15] * t, r) : new u(e[0] * t, e[4] * t, e[8] * t, e[12] * t, e[1] * t, e[5] * t, e[9] * t, e[13] * t, e[2] * t, e[6] * t, e[10] * t, e[14] * t, e[3] * t, e[7] * t, e[11] * t, e[15] * t) }, u.negate = function(e, t) { if (!i(e)) throw new n("matrix is required"); return i(t) ? (t[0] = -e[0], t[1] = -e[1], t[2] = -e[2], t[3] = -e[3], t[4] = -e[4], t[5] = -e[5], t[6] = -e[6], t[7] = -e[7], t[8] = -e[8], t[9] = -e[9], t[10] = -e[10], t[11] = -e[11], t[12] = -e[12], t[13] = -e[13], t[14] = -e[14], t[15] = -e[15], t) : new u(-e[0], -e[4], -e[8], -e[12], -e[1], -e[5], -e[9], -e[13], -e[2], -e[6], -e[10], -e[14], -e[3], -e[7], -e[11], -e[15]) }, u.transpose = function(e, t) { if (!i(e)) throw new n("matrix is required"); if (!i(t)) return new u(e[0], e[1], e[2], e[3], e[4], e[5], e[6], e[7], e[8], e[9], e[10], e[11], e[12], e[13], e[14], e[15]); var r = e[1],
  382. o = e[2],
  383. a = e[3],
  384. s = e[6],
  385. l = e[7],
  386. c = e[11]; return t[0] = e[0], t[1] = e[4], t[2] = e[8], t[3] = e[12], t[4] = r, t[5] = e[5], t[6] = e[9], t[7] = e[13], t[8] = o, t[9] = s, t[10] = e[10], t[11] = e[14], t[12] = a, t[13] = l, t[14] = c, t[15] = e[15], t }, u.equals = function(e, t) { return e === t || i(e) && i(t) && e[0] === t[0] && e[1] === t[1] && e[2] === t[2] && e[3] === t[3] && e[4] === t[4] && e[5] === t[5] && e[6] === t[6] && e[7] === t[7] && e[8] === t[8] && e[9] === t[9] && e[10] === t[10] && e[11] === t[11] && e[12] === t[12] && e[13] === t[13] && e[14] === t[14] && e[15] === t[15] }, u.equalsEpsilon = function(e, t, r) { if ("number" != typeof r) throw new n("epsilon is required and must be a number"); return e === t || i(e) && i(t) && Math.abs(e[0] - t[0]) <= r && Math.abs(e[1] - t[1]) <= r && Math.abs(e[2] - t[2]) <= r && Math.abs(e[3] - t[3]) <= r && Math.abs(e[4] - t[4]) <= r && Math.abs(e[5] - t[5]) <= r && Math.abs(e[6] - t[6]) <= r && Math.abs(e[7] - t[7]) <= r && Math.abs(e[8] - t[8]) <= r && Math.abs(e[9] - t[9]) <= r && Math.abs(e[10] - t[10]) <= r && Math.abs(e[11] - t[11]) <= r && Math.abs(e[12] - t[12]) <= r && Math.abs(e[13] - t[13]) <= r && Math.abs(e[14] - t[14]) <= r && Math.abs(e[15] - t[15]) <= r }, u.getTranslation = function(t, r) { if (!i(t)) throw new n("matrix is required"); return i(r) ? (r.x = t[12], r.y = t[13], r.z = t[14], r) : new e(t[12], t[13], t[14]) }, u.getRotation = function(e, t) { if (!i(e)) throw new n("matrix is required"); return i(t) ? (t[0] = e[0], t[1] = e[1], t[2] = e[2], t[3] = e[4], t[4] = e[5], t[5] = e[6], t[6] = e[8], t[7] = e[9], t[8] = e[10], t) : new s(e[0], e[4], e[8], e[1], e[5], e[9], e[2], e[6], e[10]) }, u.inverse = function(e, t) { if (!i(e)) throw new n("matrix is required"); var r = e[0],
  387. o = e[4],
  388. s = e[8],
  389. c = e[12],
  390. h = e[1],
  391. d = e[5],
  392. m = e[9],
  393. p = e[13],
  394. f = e[2],
  395. v = e[6],
  396. y = e[10],
  397. g = e[14],
  398. _ = e[3],
  399. w = e[7],
  400. C = e[11],
  401. x = e[15],
  402. S = y * x,
  403. E = g * C,
  404. b = v * x,
  405. T = g * w,
  406. A = v * C,
  407. M = y * w,
  408. P = f * x,
  409. D = g * _,
  410. I = f * C,
  411. O = y * _,
  412. R = f * w,
  413. L = v * _,
  414. z = S * d + T * m + A * p - (E * d + b * m + M * p),
  415. N = E * h + P * m + O * p - (S * h + D * m + I * p),
  416. F = b * h + D * d + R * p - (T * h + P * d + L * p),
  417. B = M * h + I * d + L * m - (A * h + O * d + R * m),
  418. V = E * o + b * s + M * c - (S * o + T * s + A * c),
  419. q = S * r + D * s + I * c - (E * r + P * s + O * c),
  420. k = T * r + P * o + L * c - (b * r + D * o + R * c),
  421. U = A * r + O * o + R * s - (M * r + I * o + L * s);
  422. S = s * p, E = c * m, b = o * p, T = c * d, A = o * m, M = s * d, P = r * p, D = c * h, I = r * m, O = s * h, R = r * d, L = o * h; var W = S * w + T * C + A * x - (E * w + b * C + M * x),
  423. G = E * _ + P * C + O * x - (S * _ + D * C + I * x),
  424. H = b * _ + D * w + R * x - (T * _ + P * w + L * x),
  425. j = M * _ + I * w + L * C - (A * _ + O * w + R * C),
  426. Y = b * y + M * g + E * v - (A * g + S * v + T * y),
  427. X = I * g + S * f + D * y - (P * y + O * g + E * f),
  428. Z = P * v + L * g + T * f - (R * g + b * f + D * v),
  429. K = R * y + A * f + O * v - (I * v + L * y + M * f),
  430. J = r * z + o * N + s * F + c * B; if (Math.abs(J) < a.EPSILON20) throw new l("matrix is not invertible because its determinate is zero."); return J = 1 / J, i(t) ? (t[0] = z * J, t[1] = N * J, t[2] = F * J, t[3] = B * J, t[4] = V * J, t[5] = q * J, t[6] = k * J, t[7] = U * J, t[8] = W * J, t[9] = G * J, t[10] = H * J, t[11] = j * J, t[12] = Y * J, t[13] = X * J, t[14] = Z * J, t[15] = K * J, t) : new u(z * J, V * J, W * J, Y * J, N * J, q * J, G * J, X * J, F * J, k * J, H * J, Z * J, B * J, U * J, j * J, K * J) }, u.inverseTransformation = function(e, t) { if (!i(e)) throw new n("matrix is required"); var r = e[0],
  431. o = e[1],
  432. a = e[2],
  433. s = e[4],
  434. l = e[5],
  435. c = e[6],
  436. h = e[8],
  437. d = e[9],
  438. m = e[10],
  439. p = e[12],
  440. f = e[13],
  441. v = e[14],
  442. y = -r * p - o * f - a * v,
  443. g = -s * p - l * f - c * v,
  444. _ = -h * p - d * f - m * v; return i(t) ? (t[0] = r, t[1] = s, t[2] = h, t[3] = 0, t[4] = o, t[5] = l, t[6] = d, t[7] = 0, t[8] = a, t[9] = c, t[10] = m, t[11] = 0, t[12] = y, t[13] = g, t[14] = _, t[15] = 1, t) : new u(r, o, a, y, s, l, c, g, h, d, m, _, 0, 0, 0, 1) }, u.IDENTITY = o(new u(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)), u.COLUMN0ROW0 = 0, u.COLUMN0ROW1 = 1, u.COLUMN0ROW2 = 2, u.COLUMN0ROW3 = 3, u.COLUMN1ROW0 = 4, u.COLUMN1ROW1 = 5, u.COLUMN1ROW2 = 6, u.COLUMN1ROW3 = 7, u.COLUMN2ROW0 = 8, u.COLUMN2ROW1 = 9, u.COLUMN2ROW2 = 10, u.COLUMN2ROW3 = 11, u.COLUMN3ROW0 = 12, u.COLUMN3ROW1 = 13, u.COLUMN3ROW2 = 14, u.COLUMN3ROW3 = 15, u.prototype.clone = function(e) { return u.clone(this, e) }, u.prototype.toArray = function(e) { return u.toArray(this, e) }, u.prototype.getColumn = function(e, t) { return u.getColumn(this, e, t) }, u.prototype.setColumn = function(e, t, r) { return u.setColumn(this, e, t, r) }, u.prototype.getRow = function(e, t) { return u.getRow(this, e, t) }, u.prototype.setRow = function(e, t, r) { return u.setRow(this, e, t, r) }, u.prototype.multiply = function(e, t) { return u.multiply(this, e, t) }, u.prototype.multiplyByTranslation = function(e, t) { return u.multiplyByTranslation(this, e, t) }, u.prototype.multiplyByUniformScale = function(e, t) { return u.multiplyByUniformScale(this, e, t) }, u.prototype.multiplyByVector = function(e, t) { return u.multiplyByVector(this, e, t) }, u.prototype.multiplyByPoint = function(e, t) { return u.multiplyByPoint(this, e, t) }, u.prototype.multiplyByScalar = function(e, t) { return u.multiplyByScalar(this, e, t) }, u.prototype.negate = function(e) { return u.negate(this, e) }, u.prototype.transpose = function(e) { return u.transpose(this, e) }, u.prototype.equals = function(e) { return u.equals(this, e) }, u.prototype.equalsEpsilon = function(e, t) { return u.equalsEpsilon(this, e, t) }, u.prototype.toString = function() { return "(" + this[0] + ", " + this[4] + ", " + this[8] + ", " + this[12] + ")\n" + "(" + this[1] + ", " + this[5] + ", " + this[9] + ", " + this[13] + ")\n" + "(" + this[2] + ", " + this[6] + ", " + this[10] + ", " + this[14] + ")\n" + "(" + this[3] + ", " + this[7] + ", " + this[11] + ", " + this[15] + ")" }, u.prototype.getTranslation = function(e) { return u.getTranslation(this, e) }, u.prototype.getRotation = function(e) { return u.getRotation(this, e) }, u.prototype.inverse = function(e) { return u.inverse(this, e) }, u.prototype.inverseTransformation = function(e) { return u.inverseTransformation(this, e) }, u }), r("Core/BoundingSphere", ["./defaultValue", "./defined", "./DeveloperError", "./Cartesian3", "./Cartesian4", "./Cartographic", "./Ellipsoid", "./GeographicProjection", "./Intersect", "./Interval", "./Matrix4"], function(e, t, r, i, n, o, a, s, l, u, c) { "use strict"; var h = function(t, r) { this.center = i.clone(e(t, i.ZERO)), this.radius = e(r, 0) },
  445. d = new i,
  446. m = new i,
  447. p = new i,
  448. f = new i,
  449. v = new i,
  450. y = new i,
  451. g = new i,
  452. _ = new i,
  453. w = new i,
  454. C = new i,
  455. x = new i,
  456. S = new i;
  457. h.fromPoints = function(e, r) { if (t(r) || (r = new h), !t(e) || 0 === e.length) return r.center = i.ZERO.clone(r.center), r.radius = 0, r; for (var n = i.clone(e[0], g), o = i.clone(n, d), a = i.clone(n, m), s = i.clone(n, p), l = i.clone(n, f), u = i.clone(n, v), c = i.clone(n, y), E = e.length, b = 1; E > b; b++) { i.clone(e[b], n); var T = n.x,
  458. A = n.y,
  459. M = n.z;
  460. T < o.x && i.clone(n, o), T > l.x && i.clone(n, l), A < a.y && i.clone(n, a), A > u.y && i.clone(n, u), M < s.z && i.clone(n, s), M > c.z && i.clone(n, c) } var P = i.magnitudeSquared(i.subtract(l, o, _)),
  461. D = i.magnitudeSquared(i.subtract(u, a, _)),
  462. I = i.magnitudeSquared(i.subtract(c, s, _)),
  463. O = o,
  464. R = l,
  465. L = P;
  466. D > L && (L = D, O = a, R = u), I > L && (L = I, O = s, R = c); var z = w;
  467. z.x = .5 * (O.x + R.x), z.y = .5 * (O.y + R.y), z.z = .5 * (O.z + R.z); var N = i.magnitudeSquared(i.subtract(R, z, _)),
  468. F = Math.sqrt(N),
  469. B = C;
  470. B.x = o.x, B.y = a.y, B.z = s.z; var V = x;
  471. V.x = l.x, V.y = u.y, V.z = c.z; var q = i.multiplyByScalar(i.add(B, V, _), .5, S),
  472. k = 0; for (b = 0; E > b; b++) { i.clone(e[b], n); var U = i.magnitude(i.subtract(n, q, _));
  473. U > k && (k = U); var W = i.magnitudeSquared(i.subtract(n, z, _)); if (W > N) { var G = Math.sqrt(W);
  474. F = .5 * (F + G), N = F * F; var H = G - F;
  475. z.x = (F * z.x + H * n.x) / G, z.y = (F * z.y + H * n.y) / G, z.z = (F * z.z + H * n.z) / G } } return k > F ? (i.clone(z, r.center), r.radius = F) : (i.clone(q, r.center), r.radius = k), r }; var E = new s,
  476. b = new i,
  477. T = new i,
  478. A = new o,
  479. M = new o;
  480. h.fromExtent2D = function(e, t, r) { return h.fromExtentWithHeights2D(e, t, 0, 0, r) }, h.fromExtentWithHeights2D = function(r, n, o, a, s) { if (t(s) || (s = new h), !t(r)) return s.center = i.ZERO.clone(s.center), s.radius = 0, s;
  481. n = e(n, E), r.getSouthwest(A), A.height = o, r.getNortheast(M), M.height = a; var l = n.project(A, b),
  482. u = n.project(M, T),
  483. c = u.x - l.x,
  484. d = u.y - l.y,
  485. m = u.z - l.z;
  486. s.radius = .5 * Math.sqrt(c * c + d * d + m * m); var p = s.center; return p.x = l.x + .5 * c, p.y = l.y + .5 * d, p.z = l.z + .5 * m, s }; var P = [];
  487. h.fromExtent3D = function(r, i, n, o) { i = e(i, a.WGS84), n = e(n, 0); var s; return t(r) && (s = r.subsample(i, n, P)), h.fromPoints(s, o) }, h.fromVertices = function(e, n, o, a) { if (t(a) || (a = new h), !t(e) || 0 === e.length) return a.center = i.ZERO.clone(a.center), a.radius = 0, a; if (t(n) || (n = i.ZERO), t(o) || (o = 3), 3 > o) throw new r("stride must be 3 or greater."); var s = g;
  488. s.x = e[0] + n.x, s.y = e[1] + n.y, s.z = e[2] + n.z; for (var l = i.clone(s, d), u = i.clone(s, m), c = i.clone(s, p), E = i.clone(s, f), b = i.clone(s, v), T = i.clone(s, y), A = e.length, M = 0; A > M; M += o) { var P = e[M] + n.x,
  489. D = e[M + 1] + n.y,
  490. I = e[M + 2] + n.z;
  491. s.x = P, s.y = D, s.z = I, P < l.x && i.clone(s, l), P > E.x && i.clone(s, E), D < u.y && i.clone(s, u), D > b.y && i.clone(s, b), I < c.z && i.clone(s, c), I > T.z && i.clone(s, T) } var O = i.magnitudeSquared(i.subtract(E, l, _)),
  492. R = i.magnitudeSquared(i.subtract(b, u, _)),
  493. L = i.magnitudeSquared(i.subtract(T, c, _)),
  494. z = l,
  495. N = E,
  496. F = O;
  497. R > F && (F = R, z = u, N = b), L > F && (F = L, z = c, N = T); var B = w;
  498. B.x = .5 * (z.x + N.x), B.y = .5 * (z.y + N.y), B.z = .5 * (z.z + N.z); var V = i.magnitudeSquared(i.subtract(N, B, _)),
  499. q = Math.sqrt(V),
  500. k = C;
  501. k.x = l.x, k.y = u.y, k.z = c.z; var U = x;
  502. U.x = E.x, U.y = b.y, U.z = T.z; var W = i.multiplyByScalar(i.add(k, U, _), .5, S),
  503. G = 0; for (M = 0; A > M; M += o) { s.x = e[M] + n.x, s.y = e[M + 1] + n.y, s.z = e[M + 2] + n.z; var H = i.magnitude(i.subtract(s, W, _));
  504. H > G && (G = H); var j = i.magnitudeSquared(i.subtract(s, B, _)); if (j > V) { var Y = Math.sqrt(j);
  505. q = .5 * (q + Y), V = q * q; var X = Y - q;
  506. B.x = (q * B.x + X * s.x) / Y, B.y = (q * B.y + X * s.y) / Y, B.z = (q * B.z + X * s.z) / Y } } return G > q ? (i.clone(B, a.center), a.radius = q) : (i.clone(W, a.center), a.radius = G), a }, h.fromCornerPoints = function(e, n, o) { if (!t(e) || !t(n)) throw new r("corner and oppositeCorner are required.");
  507. t(o) || (o = new h); var a = o.center; return i.add(e, n, a), i.multiplyByScalar(a, .5, a), o.radius = i.distance(a, n), o }, h.fromEllipsoid = function(e, n) { if (!t(e)) throw new r("ellipsoid is required."); return t(n) || (n = new h), i.clone(i.ZERO, n.center), n.radius = e.getMaximumRadius(), n }, h.clone = function(e, r) { return t(e) ? t(r) ? (r.center = i.clone(e.center, r.center), r.radius = e.radius, r) : new h(e.center, e.radius) : void 0 }; var D = new i,
  508. I = new i;
  509. h.union = function(e, n, o) { if (!t(e)) throw new r("left is required."); if (!t(n)) throw new r("right is required.");
  510. t(o) || (o = new h); var a = e.center,
  511. s = n.center;
  512. i.add(a, s, I); var l = i.multiplyByScalar(I, .5, I),
  513. u = i.subtract(a, l, D).magnitude() + e.radius,
  514. c = i.subtract(s, l, D).magnitude() + n.radius; return o.radius = Math.max(u, c), i.clone(l, o.center), o }; var O = new i;
  515. h.expand = function(e, n, o) { if (!t(e)) throw new r("sphere is required."); if (!t(n)) throw new r("point is required.");
  516. o = h.clone(e, o); var a = i.subtract(n, o.center, O).magnitude(); return a > o.radius && (o.radius = a), o }, h.intersect = function(e, n) { if (!t(e)) throw new r("sphere is required."); if (!t(n)) throw new r("plane is required."); var o = e.center,
  517. a = e.radius,
  518. s = i.dot(n, o) + n.w; return -a > s ? l.OUTSIDE : a > s ? l.INTERSECTING : l.INSIDE }; var R = n.UNIT_W.clone();
  519. h.transform = function(e, n, o) { if (!t(e)) throw new r("sphere is required."); if (!t(n)) throw new r("transform is required."); return t(o) || (o = new h), c.multiplyByPoint(n, e.center, R), i.clone(R, o.center), o.radius = e.radius, o }; var L = new i;
  520. h.getPlaneDistances = function(e, n, o, a) { if (!t(e)) throw new r("sphere is required."); if (!t(n)) throw new r("position is required."); if (!t(o)) throw new r("direction is required.");
  521. t(a) || (a = new u); var s = i.subtract(e.center, n, L),
  522. l = i.multiplyByScalar(o, o.dot(s), L),
  523. c = l.magnitude(); return a.start = c - e.radius, a.stop = c + e.radius, a }; for (var z = new i, N = new i, F = new i, B = new i, V = new i, q = new o, k = new Array(8), U = 0; 8 > U; ++U) k[U] = new i; var W = new s; return h.projectTo2D = function(n, o, a) { if (!t(n)) throw new r("sphere is required.");
  524. o = e(o, W); var s = o.getEllipsoid(),
  525. l = n.center,
  526. u = n.radius,
  527. c = s.geodeticSurfaceNormal(l, z),
  528. d = i.cross(i.UNIT_Z, c, N);
  529. i.normalize(d, d); var m = i.cross(c, d, F);
  530. i.normalize(m, m), i.multiplyByScalar(c, u, c), i.multiplyByScalar(m, u, m), i.multiplyByScalar(d, u, d); var p = i.negate(m, V),
  531. f = i.negate(d, B),
  532. v = k,
  533. y = v[0];
  534. i.add(c, m, y), i.add(y, d, y), y = v[1], i.add(c, m, y), i.add(y, f, y), y = v[2], i.add(c, p, y), i.add(y, f, y), y = v[3], i.add(c, p, y), i.add(y, d, y), i.negate(c, c), y = v[4], i.add(c, m, y), i.add(y, d, y), y = v[5], i.add(c, m, y), i.add(y, f, y), y = v[6], i.add(c, p, y), i.add(y, f, y), y = v[7], i.add(c, p, y), i.add(y, d, y); for (var g = v.length, _ = 0; g > _; ++_) { var w = v[_];
  535. i.add(l, w, w); var C = s.cartesianToCartographic(w, q);
  536. o.project(C, w) } a = h.fromPoints(v, a), l = a.center; var x = l.x,
  537. S = l.y,
  538. E = l.z; return l.x = E, l.y = x, l.z = S, a }, h.equals = function(e, r) { return e === r || t(e) && t(r) && i.equals(e.center, r.center) && e.radius === r.radius }, h.prototype.clone = function(e) { return h.clone(this, e) }, h.prototype.union = function(e, t) { return h.union(this, e, t) }, h.prototype.expand = function(e, t) { return h.expand(this, e, t) }, h.prototype.intersect = function(e) { return h.intersect(this, e) }, h.prototype.transform = function(e, t) { return h.transform(this, e, t) }, h.prototype.getPlaneDistances = function(e, t, r) { return h.getPlaneDistances(this, e, t, r) }, h.prototype.projectTo2D = function(e, t) { return h.projectTo2D(this, e, t) }, h.prototype.equals = function(e) { return h.equals(this, e) }, h }), r("Core/Fullscreen", ["./defined"], function(e) { "use strict"; var t, r = { requestFullscreen: void 0, exitFullscreen: void 0, fullscreenEnabled: void 0, fullscreenElement: void 0, fullscreenchange: void 0, fullscreenerror: void 0 },
  539. i = {}; return i.supportsFullscreen = function() { if (e(t)) return t;
  540. t = !1; var i = document.body; if ("function" == typeof i.requestFullscreen) return r.requestFullscreen = "requestFullscreen", r.exitFullscreen = "exitFullscreen", r.fullscreenEnabled = "fullscreenEnabled", r.fullscreenElement = "fullscreenElement", r.fullscreenchange = "fullscreenchange", r.fullscreenerror = "fullscreenerror", t = !0; for (var n, o = ["webkit", "moz", "o", "ms", "khtml"], a = 0, s = o.length; s > a; ++a) { var l = o[a];
  541. n = l + "RequestFullscreen", "function" == typeof i[n] ? (r.requestFullscreen = n, t = !0) : (n = l + "RequestFullScreen", "function" == typeof i[n] && (r.requestFullscreen = n, t = !0)), n = l + "ExitFullscreen", "function" == typeof document[n] ? r.exitFullscreen = n : (n = l + "CancelFullScreen", "function" == typeof document[n] && (r.exitFullscreen = n)), n = l + "FullscreenEnabled", e(document[n]) ? r.fullscreenEnabled = n : (n = l + "FullScreenEnabled", e(document[n]) && (r.fullscreenEnabled = n)), n = l + "FullscreenElement", e(document[n]) ? r.fullscreenElement = n : (n = l + "FullScreenElement", e(document[n]) && (r.fullscreenElement = n)), n = l + "fullscreenchange", e(document["on" + n]) && (r.fullscreenchange = n), n = l + "fullscreenerror", e(document["on" + n]) && (r.fullscreenerror = n) } return t }, i.requestFullscreen = function(e) { i.supportsFullscreen() && e[r.requestFullscreen]() }, i.exitFullscreen = function() { i.supportsFullscreen() && document[r.exitFullscreen]() }, i.isFullscreenEnabled = function() { return i.supportsFullscreen() ? document[r.fullscreenEnabled] : void 0 }, i.getFullscreenElement = function() { return i.supportsFullscreen() ? document[r.fullscreenElement] : void 0 }, i.isFullscreen = function() { return i.supportsFullscreen() ? null !== i.getFullscreenElement() : void 0 }, i.getFullscreenChangeEventName = function() { return i.supportsFullscreen() ? r.fullscreenchange : void 0 }, i.getFullscreenErrorEventName = function() { return i.supportsFullscreen() ? r.fullscreenerror : void 0 }, i }), r("Core/FeatureDetection", ["./defined", "./Fullscreen"], function(e, t) { "use strict";
  542. function r(e) { for (var t = e.split("."), r = 0, i = t.length; i > r; ++r) t[r] = parseInt(t[r], 10) }
  543. function i() { if (!e(h)) { var t = / Chrome\/([\.0-9]+)/.exec(navigator.userAgent);
  544. null === t ? h = !1 : (h = !0, d = r(t[1])) } return h }
  545. function n() { return i() && d }
  546. function o() { if (!e(m))
  547. if (i() || !/ Safari\/[\.0-9]+/.test(navigator.userAgent)) m = !1;
  548. else { var t = / Version\/([\.0-9]+)/.exec(navigator.userAgent);
  549. null === t ? m = !1 : (m = !0, p = r(t[1])) }
  550. return m }
  551. function a() { return o() && p }
  552. function s() { if (!e(f)) { var t = / AppleWebKit\/([\.0-9]+)(\+?)/.exec(navigator.userAgent);
  553. null === t ? f = !1 : (f = !0, v = r(t[1]), v.isNightly = !!t[2]) } return f }
  554. function l() { return s() && v }
  555. function u() { if (!e(y)) { var t = / MSIE ([\.0-9]+)/.exec(navigator.userAgent);
  556. null === t ? y = !1 : (y = !0, g = r(t[1])) } return y }
  557. function c() { return u() && g } var h, d, m, p, f, v, y, g, _, w = { isChrome: i, chromeVersion: n, isSafari: o, safariVersion: a, isWebkit: s, webkitVersion: l, isInternetExplorer: u, internetExplorerVersion: c }; return w.supportsCrossOriginImagery = function() { return e(_) || (_ = o() && l()[0] < 536 ? !1 : "withCredentials" in new XMLHttpRequest), _ }, w.supportsFullscreen = function() { return t.supportsFullscreen() }, w.supportsTypedArrays = function() { return "undefined" != typeof ArrayBuffer }, w }), r("Core/ComponentDatatype", ["./defined", "./DeveloperError", "./FeatureDetection", "./Enumeration"], function(e, t, r, i) {
  558. "use strict";
  559. if (!r.supportsTypedArrays()) return {};
  560. var n = { BYTE: new i(5120, "BYTE", { sizeInBytes: Int8Array.BYTES_PER_ELEMENT }), UNSIGNED_BYTE: new i(5121, "UNSIGNED_BYTE", { sizeInBytes: Uint8Array.BYTES_PER_ELEMENT }), SHORT: new i(5122, "SHORT", { sizeInBytes: Int16Array.BYTES_PER_ELEMENT }), UNSIGNED_SHORT: new i(5123, "UNSIGNED_SHORT", { sizeInBytes: Uint16Array.BYTES_PER_ELEMENT }), FLOAT: new i(5126, "FLOAT", { sizeInBytes: Float32Array.BYTES_PER_ELEMENT }), DOUBLE: new i(5130, "DOUBLE", { sizeInBytes: Float64Array.BYTES_PER_ELEMENT }) };
  561. return n.validate = function(t) { return e(t) && e(t.value) && (t.value === n.BYTE.value || t.value === n.UNSIGNED_BYTE.value || t.value === n.SHORT.value || t.value === n.UNSIGNED_SHORT.value || t.value === n.FLOAT.value || t.value === n.DOUBLE.value) }, n.createTypedArray = function(r, i) { if (!e(r)) throw new t("componentDatatype is required."); if (!e(i)) throw new t("valuesOrLength is required."); switch (r.value) {
  562. case n.BYTE.value:
  563. return new Int8Array(i);
  564. case n.UNSIGNED_BYTE.value:
  565. return new Uint8Array(i);
  566. case n.SHORT.value:
  567. return new Int16Array(i);
  568. case n.UNSIGNED_SHORT.value:
  569. return new Uint16Array(i);
  570. case n.FLOAT.value:
  571. return new Float32Array(i);
  572. case n.DOUBLE.value:
  573. return new Float64Array(i);
  574. default:
  575. throw new t("componentDatatype is not a valid enumeration value.") } }, n.createArrayBufferView = function(r, i, o) {
  576. if (!e(r)) throw new t("componentDatatype is required.");
  577. if (!e(i)) throw new t("buffer is required.");
  578. switch (r.value) {
  579. case n.BYTE.value:
  580. return new Int8Array(i, o);
  581. case n.UNSIGNED_BYTE.value:
  582. return new Uint8Array(i, o);
  583. case n.SHORT.value:
  584. return new Int16Array(i, o);
  585. case n.UNSIGNED_SHORT.value:
  586. return new Uint16Array(i, o);
  587. case n.FLOAT.value:
  588. return new Float32Array(i, o);
  589. case n.DOUBLE.value:
  590. return new Float64Array(i, o);
  591. default:
  592. throw new t("componentDatatype is not a valid enumeration value.")
  593. }
  594. }, n
  595. }), r("Core/PrimitiveType", ["./Enumeration"], function(e) { "use strict"; var t = { POINTS: new e(0, "POINTS"), LINES: new e(1, "LINES"), LINE_LOOP: new e(2, "LINE_LOOP"), LINE_STRIP: new e(3, "LINE_STRIP"), TRIANGLES: new e(4, "TRIANGLES"), TRIANGLE_STRIP: new e(5, "TRIANGLE_STRIP"), TRIANGLE_FAN: new e(6, "TRIANGLE_FAN"), validate: function(e) { return e.value === t.POINTS.value || e.value === t.LINES.value || e.value === t.LINE_LOOP.value || e.value === t.LINE_STRIP.value || e.value === t.TRIANGLES.value || e.value === t.TRIANGLE_STRIP.value || e.value === t.TRIANGLE_FAN.value } }; return t }), r("Core/GeometryAttribute", ["./defaultValue", "./defined", "./DeveloperError"], function(e, t, r) { "use strict"; var i = function(i) { if (i = e(i, e.EMPTY_OBJECT), !t(i.componentDatatype)) throw new r("options.componentDatatype is required."); if (!t(i.componentsPerAttribute)) throw new r("options.componentsPerAttribute is required."); if (i.componentsPerAttribute < 1 || i.componentsPerAttribute > 4) throw new r("options.componentsPerAttribute must be between 1 and 4."); if (!t(i.values)) throw new r("options.values is required.");
  596. this.componentDatatype = i.componentDatatype, this.componentsPerAttribute = i.componentsPerAttribute, this.normalize = e(i.normalize, !1), this.values = i.values }; return i }), r("Core/GeometryAttributes", ["./defaultValue"], function(e) { "use strict"; var t = function(t) { t = e(t, e.EMPTY_OBJECT), this.position = t.position, this.normal = t.normal, this.st = t.st, this.binormal = t.binormal, this.tangent = t.tangent }; return t }), r("Core/VertexFormat", ["./defaultValue", "./freezeObject"], function(e, t) { "use strict"; var r = function(t) { t = e(t, e.EMPTY_OBJECT), this.position = e(t.position, !1), this.normal = e(t.normal, !1), this.st = e(t.st, !1), this.binormal = e(t.binormal, !1), this.tangent = e(t.tangent, !1) }; return r.POSITION_ONLY = t(new r({ position: !0 })), r.POSITION_AND_NORMAL = t(new r({ position: !0, normal: !0 })), r.POSITION_NORMAL_AND_ST = t(new r({ position: !0, normal: !0, st: !0 })), r.POSITION_AND_ST = t(new r({ position: !0, st: !0 })), r.ALL = t(new r({ position: !0, normal: !0, st: !0, binormal: !0, tangent: !0 })), r.DEFAULT = r.POSITION_NORMAL_AND_ST, r }), r("Core/Geometry", ["./defaultValue", "./defined", "./DeveloperError", "./BoundingSphere"], function(e, t, r) { "use strict"; var i = function(i) { if (i = e(i, e.EMPTY_OBJECT), !t(i.attributes)) throw new r("options.attributes is required."); if (!t(i.primitiveType)) throw new r("options.primitiveType is required.");
  597. this.attributes = i.attributes, this.indices = i.indices, this.primitiveType = i.primitiveType, this.boundingSphere = i.boundingSphere }; return i.computeNumberOfVertices = function(e) { if (!t(e)) throw new r("geometry is required."); var i = -1; for (var n in e.attributes)
  598. if (e.attributes.hasOwnProperty(n) && t(e.attributes[n]) && t(e.attributes[n].values)) { var o = e.attributes[n],
  599. a = o.values.length / o.componentsPerAttribute; if (i !== a && -1 !== i) throw new r("All attribute lists must have the same number of attributes.");
  600. i = a }
  601. return i }, i }), r("Core/BoxGeometry", ["./defined", "./DeveloperError", "./Cartesian3", "./ComponentDatatype", "./PrimitiveType", "./defaultValue", "./BoundingSphere", "./GeometryAttribute", "./GeometryAttributes", "./VertexFormat", "./Geometry"], function(e, t, r, i, n, o, a, s, l, u, c) { "use strict"; var h = new r,
  602. d = function(i) { i = o(i, o.EMPTY_OBJECT); var n = i.minimumCorner,
  603. a = i.maximumCorner; if (!e(n)) throw new t("options.minimumCorner is required."); if (!e(a)) throw new t("options.maximumCorner is required"); var s = o(i.vertexFormat, u.DEFAULT);
  604. this._minimumCorner = r.clone(n), this._maximumCorner = r.clone(a), this._vertexFormat = s, this._workerName = "createBoxGeometry" }; return d.fromDimensions = function(r) { r = o(r, o.EMPTY_OBJECT); var i = r.dimensions; if (!e(i)) throw new t("options.dimensions is required."); if (i.x < 0 || i.y < 0 || i.z < 0) throw new t("All dimensions components must be greater than or equal to zero."); var n = i.multiplyByScalar(.5),
  605. a = n.negate(),
  606. s = n,
  607. l = { minimumCorner: a, maximumCorner: s, vertexFormat: r.vertexFormat }; return new d(l) }, d.createGeometry = function(e) { var t, o, u = e._minimumCorner,
  608. d = e._maximumCorner,
  609. m = e._vertexFormat,
  610. p = new l; if (m.position && (m.st || m.normal || m.binormal || m.tangent)) { if (m.position && (o = new Float64Array(72), o[0] = u.x, o[1] = u.y, o[2] = d.z, o[3] = d.x, o[4] = u.y, o[5] = d.z, o[6] = d.x, o[7] = d.y, o[8] = d.z, o[9] = u.x, o[10] = d.y, o[11] = d.z, o[12] = u.x, o[13] = u.y, o[14] = u.z, o[15] = d.x, o[16] = u.y, o[17] = u.z, o[18] = d.x, o[19] = d.y, o[20] = u.z, o[21] = u.x, o[22] = d.y, o[23] = u.z, o[24] = d.x, o[25] = u.y, o[26] = u.z, o[27] = d.x, o[28] = d.y, o[29] = u.z, o[30] = d.x, o[31] = d.y, o[32] = d.z, o[33] = d.x, o[34] = u.y, o[35] = d.z, o[36] = u.x, o[37] = u.y, o[38] = u.z, o[39] = u.x, o[40] = d.y, o[41] = u.z, o[42] = u.x, o[43] = d.y, o[44] = d.z, o[45] = u.x, o[46] = u.y, o[47] = d.z, o[48] = u.x, o[49] = d.y, o[50] = u.z, o[51] = d.x, o[52] = d.y, o[53] = u.z, o[54] = d.x, o[55] = d.y, o[56] = d.z, o[57] = u.x, o[58] = d.y, o[59] = d.z, o[60] = u.x, o[61] = u.y, o[62] = u.z, o[63] = d.x, o[64] = u.y, o[65] = u.z, o[66] = d.x, o[67] = u.y, o[68] = d.z, o[69] = u.x, o[70] = u.y, o[71] = d.z, p.position = new s({ componentDatatype: i.DOUBLE, componentsPerAttribute: 3, values: o })), m.normal) { var f = new Float32Array(72);
  611. f[0] = 0, f[1] = 0, f[2] = 1, f[3] = 0, f[4] = 0, f[5] = 1, f[6] = 0, f[7] = 0, f[8] = 1, f[9] = 0, f[10] = 0, f[11] = 1, f[12] = 0, f[13] = 0, f[14] = -1, f[15] = 0, f[16] = 0, f[17] = -1, f[18] = 0, f[19] = 0, f[20] = -1, f[21] = 0, f[22] = 0, f[23] = -1, f[24] = 1, f[25] = 0, f[26] = 0, f[27] = 1, f[28] = 0, f[29] = 0, f[30] = 1, f[31] = 0, f[32] = 0, f[33] = 1, f[34] = 0, f[35] = 0, f[36] = -1, f[37] = 0, f[38] = 0, f[39] = -1, f[40] = 0, f[41] = 0, f[42] = -1, f[43] = 0, f[44] = 0, f[45] = -1, f[46] = 0, f[47] = 0, f[48] = 0, f[49] = 1, f[50] = 0, f[51] = 0, f[52] = 1, f[53] = 0, f[54] = 0, f[55] = 1, f[56] = 0, f[57] = 0, f[58] = 1, f[59] = 0, f[60] = 0, f[61] = -1, f[62] = 0, f[63] = 0, f[64] = -1, f[65] = 0, f[66] = 0, f[67] = -1, f[68] = 0, f[69] = 0, f[70] = -1, f[71] = 0, p.normal = new s({ componentDatatype: i.FLOAT, componentsPerAttribute: 3, values: f }) } if (m.st) { var v = new Float32Array(48);
  612. v[0] = 0, v[1] = 0, v[2] = 1, v[3] = 0, v[4] = 1, v[5] = 1, v[6] = 0, v[7] = 1, v[8] = 1, v[9] = 0, v[10] = 0, v[11] = 0, v[12] = 0, v[13] = 1, v[14] = 1, v[15] = 1, v[16] = 0, v[17] = 0, v[18] = 1, v[19] = 0, v[20] = 1, v[21] = 1, v[22] = 0, v[23] = 1, v[24] = 1, v[25] = 0, v[26] = 0, v[27] = 0, v[28] = 0, v[29] = 1, v[30] = 1, v[31] = 1, v[32] = 1, v[33] = 0, v[34] = 0, v[35] = 0, v[36] = 0, v[37] = 1, v[38] = 1, v[39] = 1, v[40] = 0, v[41] = 0, v[42] = 1, v[43] = 0, v[44] = 1, v[45] = 1, v[46] = 0, v[47] = 1, p.st = new s({ componentDatatype: i.FLOAT, componentsPerAttribute: 2, values: v }) } if (m.tangent) { var y = new Float32Array(72);
  613. y[0] = 1, y[1] = 0, y[2] = 0, y[3] = 1, y[4] = 0, y[5] = 0, y[6] = 1, y[7] = 0, y[8] = 0, y[9] = 1, y[10] = 0, y[11] = 0, y[12] = -1, y[13] = 0, y[14] = 0, y[15] = -1, y[16] = 0, y[17] = 0, y[18] = -1, y[19] = 0, y[20] = 0, y[21] = -1, y[22] = 0, y[23] = 0, y[24] = 0, y[25] = 1, y[26] = 0, y[27] = 0, y[28] = 1, y[29] = 0, y[30] = 0, y[31] = 1, y[32] = 0, y[33] = 0, y[34] = 1, y[35] = 0, y[36] = 0, y[37] = -1, y[38] = 0, y[39] = 0, y[40] = -1, y[41] = 0, y[42] = 0, y[43] = -1, y[44] = 0, y[45] = 0, y[46] = -1, y[47] = 0, y[48] = -1, y[49] = 0, y[50] = 0, y[51] = -1, y[52] = 0, y[53] = 0, y[54] = -1, y[55] = 0, y[56] = 0, y[57] = -1, y[58] = 0, y[59] = 0, y[60] = 1, y[61] = 0, y[62] = 0, y[63] = 1, y[64] = 0, y[65] = 0, y[66] = 1, y[67] = 0, y[68] = 0, y[69] = 1, y[70] = 0, y[71] = 0, p.tangent = new s({ componentDatatype: i.FLOAT, componentsPerAttribute: 3, values: y }) } if (m.binormal) { var g = new Float32Array(72);
  614. g[0] = 0, g[1] = 1, g[2] = 0, g[3] = 0, g[4] = 1, g[5] = 0, g[6] = 0, g[7] = 1, g[8] = 0, g[9] = 0, g[10] = 1, g[11] = 0, g[12] = 0, g[13] = 1, g[14] = 0, g[15] = 0, g[16] = 1, g[17] = 0, g[18] = 0, g[19] = 1, g[20] = 0, g[21] = 0, g[22] = 1, g[23] = 0, g[24] = 0, g[25] = 0, g[26] = 1, g[27] = 0, g[28] = 0, g[29] = 1, g[30] = 0, g[31] = 0, g[32] = 1, g[33] = 0, g[34] = 0, g[35] = 1, g[36] = 0, g[37] = 0, g[38] = 1, g[39] = 0, g[40] = 0, g[41] = 1, g[42] = 0, g[43] = 0, g[44] = 1, g[45] = 0, g[46] = 0, g[47] = 1, g[48] = 0, g[49] = 0, g[50] = 1, g[51] = 0, g[52] = 0, g[53] = 1, g[54] = 0, g[55] = 0, g[56] = 1, g[57] = 0, g[58] = 0, g[59] = 1, g[60] = 0, g[61] = 0, g[62] = 1, g[63] = 0, g[64] = 0, g[65] = 1, g[66] = 0, g[67] = 0, g[68] = 1, g[69] = 0, g[70] = 0, g[71] = 1, p.binormal = new s({ componentDatatype: i.FLOAT, componentsPerAttribute: 3, values: g }) } t = new Uint16Array(36), t[0] = 0, t[1] = 1, t[2] = 2, t[3] = 0, t[4] = 2, t[5] = 3, t[6] = 6, t[7] = 5, t[8] = 4, t[9] = 7, t[10] = 6, t[11] = 4, t[12] = 8, t[13] = 9, t[14] = 10, t[15] = 8, t[16] = 10, t[17] = 11, t[18] = 14, t[19] = 13, t[20] = 12, t[21] = 15, t[22] = 14, t[23] = 12, t[24] = 18, t[25] = 17, t[26] = 16, t[27] = 19, t[28] = 18, t[29] = 16, t[30] = 20, t[31] = 21, t[32] = 22, t[33] = 20, t[34] = 22, t[35] = 23 } else o = new Float64Array(24), o[0] = u.x, o[1] = u.y, o[2] = u.z, o[3] = d.x, o[4] = u.y, o[5] = u.z, o[6] = d.x, o[7] = d.y, o[8] = u.z, o[9] = u.x, o[10] = d.y, o[11] = u.z, o[12] = u.x, o[13] = u.y, o[14] = d.z, o[15] = d.x, o[16] = u.y, o[17] = d.z, o[18] = d.x, o[19] = d.y, o[20] = d.z, o[21] = u.x, o[22] = d.y, o[23] = d.z, p.position = new s({ componentDatatype: i.DOUBLE, componentsPerAttribute: 3, values: o }), t = new Uint16Array(36), t[0] = 4, t[1] = 5, t[2] = 6, t[3] = 4, t[4] = 6, t[5] = 7, t[6] = 1, t[7] = 0, t[8] = 3, t[9] = 1, t[10] = 3, t[11] = 2, t[12] = 1, t[13] = 6, t[14] = 5, t[15] = 1, t[16] = 2, t[17] = 6, t[18] = 2, t[19] = 3, t[20] = 7, t[21] = 2, t[22] = 7, t[23] = 6, t[24] = 3, t[25] = 0, t[26] = 4, t[27] = 3, t[28] = 4, t[29] = 7, t[30] = 0, t[31] = 1, t[32] = 5, t[33] = 0, t[34] = 5, t[35] = 4; var _ = r.subtract(d, u, h),
  615. w = .5 * _.magnitude(); return new c({ attributes: p, indices: t, primitiveType: n.TRIANGLES, boundingSphere: new a(r.ZERO, w) }) }, d }), r("Core/BoxOutlineGeometry", ["./defined", "./DeveloperError", "./Cartesian3", "./ComponentDatatype", "./PrimitiveType", "./defaultValue", "./BoundingSphere", "./Geometry", "./GeometryAttribute", "./GeometryAttributes"], function(e, t, r, i, n, o, a, s, l, u) { "use strict"; var c = new r,
  616. h = function(r) { r = o(r, o.EMPTY_OBJECT); var i = r.minimumCorner,
  617. n = r.maximumCorner; if (!e(i)) throw new t("options.minimumCorner is required."); if (!e(n)) throw new t("options.maximumCorner is required");
  618. this._min = i, this._max = n, this._workerName = "createBoxOutlineGeometry" }; return h.fromDimensions = function(r) { r = o(r, o.EMPTY_OBJECT); var i = r.dimensions; if (!e(i)) throw new t("options.dimensions is required."); if (i.x < 0 || i.y < 0 || i.z < 0) throw new t("All dimensions components must be greater than or equal to zero."); var n = i.multiplyByScalar(.5),
  619. a = n.negate(),
  620. s = n,
  621. l = { minimumCorner: a, maximumCorner: s }; return new h(l) }, h.createGeometry = function(e) { var t = e._min,
  622. o = e._max,
  623. h = new u,
  624. d = new Uint16Array(24),
  625. m = new Float64Array(24);
  626. m[0] = t.x, m[1] = t.y, m[2] = t.z, m[3] = o.x, m[4] = t.y, m[5] = t.z, m[6] = o.x, m[7] = o.y, m[8] = t.z, m[9] = t.x, m[10] = o.y, m[11] = t.z, m[12] = t.x, m[13] = t.y, m[14] = o.z, m[15] = o.x, m[16] = t.y, m[17] = o.z, m[18] = o.x, m[19] = o.y, m[20] = o.z, m[21] = t.x, m[22] = o.y, m[23] = o.z, h.position = new l({ componentDatatype: i.DOUBLE, componentsPerAttribute: 3, values: m }), d[0] = 4, d[1] = 5, d[2] = 5, d[3] = 6, d[4] = 6, d[5] = 7, d[6] = 7, d[7] = 4, d[8] = 0, d[9] = 1, d[10] = 1, d[11] = 2, d[12] = 2, d[13] = 3, d[14] = 3, d[15] = 0, d[16] = 0, d[17] = 4, d[18] = 1, d[19] = 5, d[20] = 2, d[21] = 6, d[22] = 3, d[23] = 7; var p = r.subtract(o, t, c),
  627. f = .5 * p.magnitude(); return new s({ attributes: h, indices: d, primitiveType: n.LINES, boundingSphere: new a(r.ZERO, f) }) }, h }), r("Core/Cartesian2", ["./defaultValue", "./defined", "./DeveloperError", "./freezeObject"], function(e, t, r, i) { "use strict"; var n = function(t, r) { this.x = e(t, 0), this.y = e(r, 0) };
  628. n.fromArray = function(i, o, a) { if (!t(i)) throw new r("values is required."); if (o + 2 > i.length) throw new r("offset + 2 is greater than the length of the array."); return o = e(o, 0), t(a) || (a = new n), a.x = i[o + 0], a.y = i[o + 1], a }, n.fromElements = function(e, r, i) { return t(i) ? (i.x = e, i.y = r, i) : new n(e, r) }, n.clone = function(e, r) { return t(e) ? t(r) ? (r.x = e.x, r.y = e.y, r) : new n(e.x, e.y) : void 0 }, n.fromCartesian3 = n.clone, n.fromCartesian4 = n.clone, n.packedLength = 2, n.pack = function(i, n, o) { if (!t(i)) throw new r("value is required"); if (!t(n)) throw new r("array is required");
  629. o = e(o, 0), n[o++] = i.x, n[o] = i.y }, n.unpack = function(i, o, a) { if (!t(i)) throw new r("array is required"); return o = e(o, 0), t(a) || (a = new n), a.x = i[o++], a.y = i[o], a }, n.getMaximumComponent = function(e) { if (!t(e)) throw new r("cartesian is required"); return Math.max(e.x, e.y) }, n.getMinimumComponent = function(e) { if (!t(e)) throw new r("cartesian is required"); return Math.min(e.x, e.y) }, n.magnitudeSquared = function(e) { if (!t(e)) throw new r("cartesian is required"); return e.x * e.x + e.y * e.y }, n.magnitude = function(e) { return Math.sqrt(n.magnitudeSquared(e)) }; var o = new n;
  630. n.distance = function(e, i) { if (!t(e) || !t(i)) throw new r("left and right are required."); return n.subtract(e, i, o), n.magnitude(o) }, n.normalize = function(e, i) { if (!t(e)) throw new r("cartesian is required"); var o = n.magnitude(e); return t(i) ? (i.x = e.x / o, i.y = e.y / o, i) : new n(e.x / o, e.y / o) }, n.dot = function(e, i) { if (!t(e)) throw new r("left is required"); if (!t(i)) throw new r("right is required"); return e.x * i.x + e.y * i.y }, n.multiplyComponents = function(e, i, o) { if (!t(e)) throw new r("left is required"); if (!t(i)) throw new r("right is required"); return t(o) ? (o.x = e.x * i.x, o.y = e.y * i.y, o) : new n(e.x * i.x, e.y * i.y) }, n.add = function(e, i, o) { if (!t(e)) throw new r("left is required"); if (!t(i)) throw new r("right is required"); return t(o) ? (o.x = e.x + i.x, o.y = e.y + i.y, o) : new n(e.x + i.x, e.y + i.y) }, n.subtract = function(e, i, o) { if (!t(e)) throw new r("left is required"); if (!t(i)) throw new r("right is required"); return t(o) ? (o.x = e.x - i.x, o.y = e.y - i.y, o) : new n(e.x - i.x, e.y - i.y) }, n.multiplyByScalar = function(e, i, o) { if (!t(e)) throw new r("cartesian is required"); if ("number" != typeof i) throw new r("scalar is required and must be a number."); return t(o) ? (o.x = e.x * i, o.y = e.y * i, o) : new n(e.x * i, e.y * i) }, n.divideByScalar = function(e, i, o) { if (!t(e)) throw new r("cartesian is required"); if ("number" != typeof i) throw new r("scalar is required and must be a number."); return t(o) ? (o.x = e.x / i, o.y = e.y / i, o) : new n(e.x / i, e.y / i) }, n.negate = function(e, i) { if (!t(e)) throw new r("cartesian is required"); return t(i) ? (i.x = -e.x, i.y = -e.y, i) : new n(-e.x, -e.y) }, n.abs = function(e, i) { if (!t(e)) throw new r("cartesian is required"); return t(i) ? (i.x = Math.abs(e.x), i.y = Math.abs(e.y), i) : new n(Math.abs(e.x), Math.abs(e.y)) }; var a = new n;
  631. n.lerp = function(e, i, o, s) { if (!t(e)) throw new r("start is required."); if (!t(i)) throw new r("end is required."); if ("number" != typeof o) throw new r("t is required and must be a number."); return n.multiplyByScalar(i, o, a), s = n.multiplyByScalar(e, 1 - o, s), n.add(a, s, s) }; var s = new n,
  632. l = new n;
  633. n.angleBetween = function(e, i) { if (!t(e)) throw new r("left is required"); if (!t(i)) throw new r("right is required"); return n.normalize(e, s), n.normalize(i, l), Math.acos(n.dot(s, l)) }; var u = new n; return n.mostOrthogonalAxis = function(e, i) { if (!t(e)) throw new r("cartesian is required."); var o = n.normalize(e, u); return n.abs(o, o), i = o.x <= o.y ? n.clone(n.UNIT_X, i) : n.clone(n.UNIT_Y, i) }, n.equals = function(e, r) { return e === r || t(e) && t(r) && e.x === r.x && e.y === r.y }, n.equalsEpsilon = function(e, i, n) { if ("number" != typeof n) throw new r("epsilon is required and must be a number."); return e === i || t(e) && t(i) && Math.abs(e.x - i.x) <= n && Math.abs(e.y - i.y) <= n }, n.ZERO = i(new n(0, 0)), n.UNIT_X = i(new n(1, 0)), n.UNIT_Y = i(new n(0, 1)), n.prototype.getMaximumComponent = function() { return n.getMaximumComponent(this) }, n.prototype.getMinimumComponent = function() { return n.getMinimumComponent(this) }, n.prototype.clone = function(e) { return n.clone(this, e) }, n.prototype.magnitudeSquared = function() { return n.magnitudeSquared(this) }, n.prototype.magnitude = function() { return n.magnitude(this) }, n.prototype.normalize = function(e) { return n.normalize(this, e) }, n.prototype.dot = function(e) { return n.dot(this, e) }, n.prototype.multiplyComponents = function(e, t) { return n.multiplyComponents(this, e, t) }, n.prototype.add = function(e, t) { return n.add(this, e, t) }, n.prototype.subtract = function(e, t) { return n.subtract(this, e, t) }, n.prototype.multiplyByScalar = function(e, t) { return n.multiplyByScalar(this, e, t) }, n.prototype.divideByScalar = function(e, t) { return n.divideByScalar(this, e, t) }, n.prototype.negate = function(e) { return n.negate(this, e) }, n.prototype.abs = function(e) { return n.abs(this, e) }, n.prototype.lerp = function(e, t, r) { return n.lerp(this, e, t, r) }, n.prototype.angleBetween = function(e) { return n.angleBetween(this, e) }, n.prototype.mostOrthogonalAxis = function(e) { return n.mostOrthogonalAxis(this, e) }, n.prototype.equals = function(e) { return n.equals(this, e) }, n.prototype.equalsEpsilon = function(e, t) { return n.equalsEpsilon(this, e, t) }, n.prototype.toString = function() { return "(" + this.x + ", " + this.y + ")" }, n }), r("Core/TridiagonalSystemSolver", ["./defined", "./DeveloperError"], function(e, t) { "use strict"; var r = {}; return r.solve = function(r, i, n, o) { if (!(e(r) && r instanceof Array)) throw new t("The array lower is required."); if (!(e(i) && i instanceof Array)) throw new t("The array diagonal is required."); if (!(e(n) && n instanceof Array)) throw new t("The array upper is required."); if (!(e(o) && o instanceof Array)) throw new t("The array right is required."); if (i.length !== o.length) throw new t("diagonal and right must have the same lengths."); if (r.length !== n.length) throw new t("lower and upper must have the same lengths."); if (r.length !== i.length - 1) throw new t("lower and upper must be one less than the length of diagonal."); var a = [],
  634. s = [],
  635. l = [];
  636. a.length = n.length, s.length = l.length = o.length, a[0] = n[0] / i[0], s[0] = o[0].multiplyByScalar(1 / i[0]); for (var u, c = 1; c < a.length; ++c) u = 1 / (i[c] - a[c - 1] * r[c - 1]), a[c] = n[c] * u, s[c] = o[c].subtract(s[c - 1].multiplyByScalar(r[c - 1])), s[c] = s[c].multiplyByScalar(u); for (u = 1 / (i[c] - a[c - 1] * r[c - 1]), s[c] = o[c].subtract(s[c - 1].multiplyByScalar(r[c - 1])), s[c] = s[c].multiplyByScalar(u), l[l.length - 1] = s[s.length - 1], c = l.length - 2; c >= 0; --c) l[c] = s[c].subtract(l[c + 1].multiplyByScalar(a[c])); return l }, r }), r("Core/HermiteSpline", ["./defaultValue", "./defined", "./DeveloperError", "./Matrix4", "./Cartesian4", "./TridiagonalSystemSolver"], function(e, t, r, i, n, o) { "use strict";
  637. function a(t, r) { var i = e(t._lastTimeIndex, 0); if (r >= t._points[i].time) { if (i + 1 < t._points.length && r < t._points[i + 1].time) return i; if (i + 2 < t._points.length && r < t._points[i + 2].time) return t._lastTimeIndex = i + 1, t._lastTimeIndex } else if (i - 1 >= 0 && r >= t._points[i - 1].time) return t._lastTimeIndex = i - 1, t._lastTimeIndex; for (i = 0; i < t._points.length - 1 && !(r >= t._points[i].time && r < t._points[i + 1].time); ++i); return i === t._points.length - 1 && (i = t._points.length - 2), t._lastTimeIndex = i, t._lastTimeIndex }
  638. function s(e) { var t = [],
  639. r = [],
  640. i = [],
  641. n = [];
  642. t.length = i.length = e._points.length - 1, r.length = n.length = e._points.length; var a; for (t[0] = r[0] = 1, i[0] = 0, n[0] = e._points[0].tangent, a = 1; a < t.length - 1; ++a) t[a] = i[a] = 1, r[a] = 4, n[a] = e._points[a + 1].point.subtract(e._points[a - 1].point).multiplyByScalar(3);
  643. t[a] = 0, i[a] = 1, r[a] = 4, n[a] = e._points[a + 1].point.subtract(e._points[a - 1].point).multiplyByScalar(3), r[a + 1] = 1, n[a + 1] = e._points[a + 1].tangent; var s = o.solve(t, r, i, n); for (a = 0; a < e._points.length; ++a) e._points[a].tangent = s[a] }
  644. function l(e) { var t = [],
  645. r = [],
  646. i = [],
  647. n = [];
  648. t.length = i.length = e._points.length - 1, r.length = n.length = e._points.length; var a; for (t[0] = i[0] = 1, r[0] = 2, n[0] = e._points[1].point.subtract(e._points[0].point).multiplyByScalar(3), a = 1; a < t.length; ++a) t[a] = i[a] = 1, r[a] = 4, n[a] = e._points[a + 1].point.subtract(e._points[a - 1].point).multiplyByScalar(3);
  649. r[a] = 2, n[a] = e._points[a].point.subtract(e._points[a - 1].point).multiplyByScalar(3); var s = o.solve(t, r, i, n); for (a = 0; a < e._points.length; ++a) e._points[a].tangent = s[a] } var u = function(e) { if (!t(e) || !(e instanceof Array) || e.length < 3) throw new r("controlPoints is required. It must be an array with at least a length of 3.");
  650. this._points = e, this._lastTimeIndex = 0, t(this._points[0].tangent) && t(this._points[this._points.length - 1].tangent) ? t(this._points[0].tangent) && !t(this._points[1].tangent) && t(this._points[this._points.length - 1].tangent) && !t(this._points[this._points.length - 2].tangent) && s(this) : l(this) }; return u.hermiteCoefficientMatrix = new i(2, -3, 0, 1, -2, 3, 0, 0, 1, -2, 1, 0, 1, -1, 0, 0), u.prototype.getControlPoints = function() { return this._points }, u.prototype.evaluate = function(e) { if (!t(e)) throw new r("time is required."); if (e < this._points[0].time || e > this._points[this._points.length - 1].time) throw new r("time is out of range."); var i = a(this, e),
  651. o = (e - this._points[i].time) / (this._points[i + 1].time - this._points[i].time),
  652. s = new n(0, o * o, o);
  653. s.x = s.y * o; var l = u.hermiteCoefficientMatrix.multiplyByPoint(s),
  654. c = this._points[i].point.multiplyByScalar(l.x),
  655. h = this._points[i + 1].point.multiplyByScalar(l.y),
  656. d = this._points[i].tangent.multiplyByScalar(l.z),
  657. m = this._points[i + 1].tangent.multiplyByScalar(l.w); return c.add(h.add(d.add(m))) }, u }), r("Core/CatmullRomSpline", ["./defaultValue", "./defined", "./DeveloperError", "./Matrix4", "./Cartesian3", "./HermiteSpline"], function(e, t, r, i, n, o) { "use strict";
  658. function a(t, r) { var i = e(t._lastTimeIndex, 0); if (r >= t._points[i].time) { if (i + 1 < t._points.length && r < t._points[i + 1].time) return i; if (i + 2 < t._points.length && r < t._points[i + 2].time) return t._lastTimeIndex = i + 1, t._lastTimeIndex } else if (i - 1 >= 0 && r >= t._points[i - 1].time) return t._lastTimeIndex = i - 1, t._lastTimeIndex; for (i = 0; i < t._points.length - 1 && !(r >= t._points[i].time && r < t._points[i + 1].time); ++i); return i === t._points.length - 1 && (i = t._points.length - 2), t._lastTimeIndex = i, t._lastTimeIndex } var s = function(e, i, o) { if (!t(e) || !(e instanceof Array) || e.length < 3) throw new r("controlPoints is required and must be an array of objects with point and time properties, with a length of at least 3."); if (this._points = e, this._lastTimeIndex = 0, t(i)) this._ti = n.clone(i);
  659. else { var a = n.clone(e[0].point),
  660. s = n.clone(e[1].point),
  661. l = n.clone(e[2].point);
  662. this._ti = s.multiplyByScalar(2).subtract(l).subtract(a).multiplyByScalar(.5) } if (t(o)) this._to = n.clone(o);
  663. else { var u = e.length - 1,
  664. c = n.clone(e[u].point),
  665. h = n.clone(e[u - 1].point),
  666. d = n.clone(e[u - 2].point);
  667. this._to = c.subtract(h.multiplyByScalar(2)).add(d).multiplyByScalar(.5) } }; return s.catmullRomCoefficientMatrix = new i(-.5, 1, -.5, 0, 1.5, -2.5, 0, 1, -1.5, 2, .5, 0, .5, -.5, 0, 0), s.prototype.getControlPoints = function() { return this._points }, s.prototype.getStartTangent = function() { return this._ti }, s.prototype.getEndTangent = function() { return this._to }, s.prototype.evaluate = function(e) { if (!t(e)) throw new r("time is required."); if (e < this._points[0].time || e > this._points[this._points.length - 1].time) throw new r("time is out of range."); var i = a(this, e),
  668. l = (e - this._points[i].time) / (this._points[i + 1].time - this._points[i].time),
  669. u = new n(0, l * l, l);
  670. u.x = u.y * l; var c, h, d, m, p; return 0 === i ? (c = this._points[0].point, h = this._points[1].point, d = this._ti, m = this._points[2].point.subtract(c).multiplyByScalar(.5), p = o.hermiteCoefficientMatrix.multiplyByPoint(u)) : i === this._points.length - 2 ? (c = this._points[i].point, h = this._points[i + 1].point, d = h.subtract(this._points[i - 1].point).multiplyByScalar(.5), m = this._to, p = o.hermiteCoefficientMatrix.multiplyByPoint(u)) : (c = this._points[i - 1].point, h = this._points[i].point, d = this._points[i + 1].point, m = this._points[i + 2].point, p = s.catmullRomCoefficientMatrix.multiplyByPoint(u)), c = c.multiplyByScalar(p.x), h = h.multiplyByScalar(p.y), d = d.multiplyByScalar(p.z), m = m.multiplyByScalar(p.w), c.add(h.add(d.add(m))) }, s }), r("Core/IndexDatatype", ["./Enumeration", "./defined", "./DeveloperError", "./FeatureDetection", "./Math"], function(e, t, r, i, n) { "use strict"; if (!i.supportsTypedArrays()) return {}; var o = { UNSIGNED_BYTE: new e(5121, "UNSIGNED_BYTE", { sizeInBytes: Uint8Array.BYTES_PER_ELEMENT }), UNSIGNED_SHORT: new e(5123, "UNSIGNED_SHORT", { sizeInBytes: Uint16Array.BYTES_PER_ELEMENT }), UNSIGNED_INT: new e(5125, "UNSIGNED_INT", { sizeInBytes: Uint32Array.BYTES_PER_ELEMENT }) }; return o.validate = function(e) { return t(e) && t(e.value) && (e.value === o.UNSIGNED_BYTE.value || e.value === o.UNSIGNED_SHORT.value || e.value === o.UNSIGNED_INT.value) }, o.createTypedArray = function(e, i) { if (!t(e)) throw new r("numberOfVertices is required."); return e > n.SIXTY_FOUR_KILOBYTES ? new Uint32Array(i) : new Uint16Array(i) }, o }), r("Core/Quaternion", ["./Cartesian3", "./defaultValue", "./defined", "./DeveloperError", "./freezeObject", "./Math", "./Matrix3"], function(e, t, r, i, n, o, a) { "use strict"; var s, l = function(e, r, i, n) { this.x = t(e, 0), this.y = t(r, 0), this.z = t(i, 0), this.w = t(n, 0) };
  671. l.fromAxisAngle = function(t, n, o) { if (!r(t)) throw new i("axis is required."); if ("number" != typeof n) throw new i("angle is required and must be a number."); var a = n / 2,
  672. u = Math.sin(a);
  673. s = e.normalize(t, s); var c = s.x * u,
  674. h = s.y * u,
  675. d = s.z * u,
  676. m = Math.cos(a); return r(o) ? (o.x = c, o.y = h, o.z = d, o.w = m, o) : new l(c, h, d, m) }; var u = [1, 2, 0],
  677. c = new Array(3);
  678. l.fromRotationMatrix = function(e, t) { if (!r(e)) throw new i("matrix is required."); var n, o, s, h, d, m = e[a.COLUMN0ROW0],
  679. p = e[a.COLUMN1ROW1],
  680. f = e[a.COLUMN2ROW2],
  681. v = m + p + f; if (v > 0) n = Math.sqrt(v + 1), d = .5 * n, n = .5 / n, o = (e[a.COLUMN2ROW1] - e[a.COLUMN1ROW2]) * n, s = (e[a.COLUMN0ROW2] - e[a.COLUMN2ROW0]) * n, h = (e[a.COLUMN1ROW0] - e[a.COLUMN0ROW1]) * n;
  682. else { var y = u,
  683. g = 0;
  684. p > m && (g = 1), f > m && f > p && (g = 2); var _ = y[g],
  685. w = y[_];
  686. n = Math.sqrt(e[a.getElementIndex(g, g)] - e[a.getElementIndex(_, _)] - e[a.getElementIndex(w, w)] + 1); var C = c;
  687. C[g] = .5 * n, n = .5 / n, d = (e[a.getElementIndex(w, _)] - e[a.getElementIndex(_, w)]) * n, C[_] = (e[a.getElementIndex(_, g)] + e[a.getElementIndex(g, _)]) * n, C[w] = (e[a.getElementIndex(w, g)] + e[a.getElementIndex(g, w)]) * n, o = C[0], s = C[1], h = C[2] } return r(t) ? (t.x = o, t.y = s, t.z = h, t.w = d, t) : new l(o, s, h, d) }; var h = new e,
  688. d = new e,
  689. m = new l,
  690. p = new l,
  691. f = new l;
  692. l.packedLength = 4, l.pack = function(e, n, o) { if (!r(e)) throw new i("value is required"); if (!r(n)) throw new i("array is required");
  693. o = t(o, 0), n[o++] = e.x, n[o++] = e.y, n[o++] = e.z, n[o] = e.w }, l.unpack = function(e, n, o) { if (!r(e)) throw new i("array is required"); return n = t(n, 0), r(o) || (o = new l), o.x = e[n], o.y = e[n + 1], o.z = e[n + 2], o.w = e[n + 3], o }, l.packedInterpolationLength = 3, l.convertPackedArrayForInterpolation = function(e, t, r, i) { l.unpack(e, 4 * r, f), f.conjugate(f); for (var n = 0, o = r - t + 1; o > n; n++) { var a = 3 * n;
  694. l.unpack(e, 4 * (t + n), m), m.multiply(f, m), m.w < 0 && m.negate(m), m.getAxis(h); var s = m.getAngle();
  695. i[a] = h.x * s, i[a + 1] = h.y * s, i[a + 2] = h.z * s } }, l.unpackInterpolationResult = function(e, t, i, n, o) { r(o) || (o = new l), d.x = e[0], d.y = e[1], d.z = e[2]; var a = d.magnitude(); return l.unpack(t, 4 * n, p), 0 === a ? l.clone(l.IDENTITY, m) : l.fromAxisAngle(d, a, m), m.multiply(p, o) }, l.clone = function(e, t) { return r(e) ? r(t) ? (t.x = e.x, t.y = e.y, t.z = e.z, t.w = e.w, t) : new l(e.x, e.y, e.z, e.w) : void 0 }, l.conjugate = function(e, t) { if (!r(e)) throw new i("quaternion is required"); return r(t) ? (t.x = -e.x, t.y = -e.y, t.z = -e.z, t.w = e.w, t) : new l(-e.x, -e.y, -e.z, e.w) }, l.magnitudeSquared = function(e) { if (!r(e)) throw new i("quaternion is required"); return e.x * e.x + e.y * e.y + e.z * e.z + e.w * e.w }, l.magnitude = function(e) { if (!r(e)) throw new i("quaternion is required"); return Math.sqrt(l.magnitudeSquared(e)) }, l.normalize = function(e, t) { var i = 1 / l.magnitude(e),
  696. n = e.x * i,
  697. o = e.y * i,
  698. a = e.z * i,
  699. s = e.w * i; return r(t) ? (t.x = n, t.y = o, t.z = a, t.w = s, t) : new l(n, o, a, s) }, l.inverse = function(e, t) { var r = l.magnitudeSquared(e); return t = l.conjugate(e, t), l.multiplyByScalar(t, 1 / r, t) }, l.add = function(e, t, n) { if (!r(e)) throw new i("left is required"); if (!r(t)) throw new i("right is required"); return r(n) ? (n.x = e.x + t.x, n.y = e.y + t.y, n.z = e.z + t.z, n.w = e.w + t.w, n) : new l(e.x + t.x, e.y + t.y, e.z + t.z, e.w + t.w) }, l.subtract = function(e, t, n) { if (!r(e)) throw new i("left is required"); if (!r(t)) throw new i("right is required"); return r(n) ? (n.x = e.x - t.x, n.y = e.y - t.y, n.z = e.z - t.z, n.w = e.w - t.w, n) : new l(e.x - t.x, e.y - t.y, e.z - t.z, e.w - t.w) }, l.negate = function(e, t) { if (!r(e)) throw new i("quaternion is required"); return r(t) ? (t.x = -e.x, t.y = -e.y, t.z = -e.z, t.w = -e.w, t) : new l(-e.x, -e.y, -e.z, -e.w) }, l.dot = function(e, t) { if (!r(e)) throw new i("left is required"); if (!r(t)) throw new i("right is required"); return e.x * t.x + e.y * t.y + e.z * t.z + e.w * t.w }, l.multiply = function(e, t, n) { if (!r(e)) throw new i("left is required"); if (!r(t)) throw new i("right is required"); var o = e.x,
  700. a = e.y,
  701. s = e.z,
  702. u = e.w,
  703. c = t.x,
  704. h = t.y,
  705. d = t.z,
  706. m = t.w,
  707. p = u * c + o * m + a * d - s * h,
  708. f = u * h - o * d + a * m + s * c,
  709. v = u * d + o * h - a * c + s * m,
  710. y = u * m - o * c - a * h - s * d; return r(n) ? (n.x = p, n.y = f, n.z = v, n.w = y, n) : new l(p, f, v, y) }, l.multiplyByScalar = function(e, t, n) { if (!r(e)) throw new i("quaternion is required"); if ("number" != typeof t) throw new i("scalar is required and must be a number."); return r(n) ? (n.x = e.x * t, n.y = e.y * t, n.z = e.z * t, n.w = e.w * t, n) : new l(e.x * t, e.y * t, e.z * t, e.w * t) }, l.divideByScalar = function(e, t, n) { if (!r(e)) throw new i("quaternion is required"); if ("number" != typeof t) throw new i("scalar is required and must be a number."); return r(n) ? (n.x = e.x / t, n.y = e.y / t, n.z = e.z / t, n.w = e.w / t, n) : new l(e.x / t, e.y / t, e.z / t, e.w / t) }, l.getAxis = function(t, n) { if (!r(t)) throw new i("quaternion is required"); var a = t.w; if (Math.abs(a - 1) < o.EPSILON6) return r(n) ? (n.x = n.y = n.z = 0, n) : new e; var s = 1 / Math.sqrt(1 - a * a); return r(n) ? (n.x = t.x * s, n.y = t.y * s, n.z = t.z * s, n) : new e(t.x * s, t.y * s, t.z * s) }, l.getAngle = function(e) { if (!r(e)) throw new i("quaternion is required"); return Math.abs(e.w - 1) < o.EPSILON6 ? 0 : 2 * Math.acos(e.w) }; var v;
  711. l.lerp = function(e, t, n, o) { if (!r(e)) throw new i("start is required."); if (!r(t)) throw new i("end is required."); if ("number" != typeof n) throw new i("t is required and must be a number."); return v = l.multiplyByScalar(t, n, v), o = l.multiplyByScalar(e, 1 - n, o), l.add(v, o, o) }; var y, g, _; return l.slerp = function(e, t, n, a) { if (!r(e)) throw new i("start is required."); if (!r(t)) throw new i("end is required."); if ("number" != typeof n) throw new i("t is required and must be a number."); var s = l.dot(e, t),
  712. u = t; if (0 > s && (s = -s, u = y = l.negate(t, y)), 1 - s < o.EPSILON6) return l.lerp(e, u, n); var c = Math.acos(s); return g = l.multiplyByScalar(e, Math.sin((1 - n) * c), g), _ = l.multiplyByScalar(u, Math.sin(n * c), _), a = l.add(g, _, a), l.multiplyByScalar(a, 1 / Math.sin(c), a) }, l.equals = function(e, t) { return e === t || r(e) && r(t) && e.x === t.x && e.y === t.y && e.z === t.z && e.w === t.w }, l.equalsEpsilon = function(e, t, n) { if ("number" != typeof n) throw new i("epsilon is required and must be a number."); return e === t || r(e) && r(t) && Math.abs(e.x - t.x) <= n && Math.abs(e.y - t.y) <= n && Math.abs(e.z - t.z) <= n && Math.abs(e.w - t.w) <= n }, l.ZERO = n(new l(0, 0, 0, 0)), l.IDENTITY = n(new l(0, 0, 0, 1)), l.prototype.clone = function(e) { return l.clone(this, e) }, l.prototype.conjugate = function(e) { return l.conjugate(this, e) }, l.prototype.magnitudeSquared = function() { return l.magnitudeSquared(this) }, l.prototype.magnitude = function() { return l.magnitude(this) }, l.prototype.normalize = function(e) { return l.normalize(this, e) }, l.prototype.inverse = function(e) { return l.inverse(this, e) }, l.prototype.add = function(e, t) { return l.add(this, e, t) }, l.prototype.subtract = function(e, t) { return l.subtract(this, e, t) }, l.prototype.negate = function(e) { return l.negate(this, e) }, l.prototype.dot = function(e) { return l.dot(this, e) }, l.prototype.multiply = function(e, t) { return l.multiply(this, e, t) }, l.prototype.multiplyByScalar = function(e, t) { return l.multiplyByScalar(this, e, t) }, l.prototype.divideByScalar = function(e, t) { return l.divideByScalar(this, e, t) }, l.prototype.getAxis = function(e) { return l.getAxis(this, e) }, l.prototype.getAngle = function() { return l.getAngle(this) }, l.prototype.lerp = function(e, t, r) { return l.lerp(this, e, t, r) }, l.prototype.slerp = function(e, t, r) { return l.slerp(this, e, t, r) }, l.prototype.equals = function(e) { return l.equals(this, e) }, l.prototype.equalsEpsilon = function(e, t) { return l.equalsEpsilon(this, e, t) }, l.prototype.toString = function() { return "(" + this.x + ", " + this.y + ", " + this.z + ", " + this.w + ")" }, l }), r("Core/EllipseGeometryLibrary", ["./Cartesian3", "./Ellipsoid", "./Math", "./Matrix3", "./Quaternion"], function(e, t, r, i, n) { "use strict";
  713. function o(t, r, o, a, h, d, m, p, f, v) { var y = t + r;
  714. e.multiplyByScalar(a, Math.cos(y), s), e.multiplyByScalar(o, Math.sin(y), l), e.add(s, l, s); var g = Math.cos(t);
  715. g *= g; var _ = Math.sin(t);
  716. _ *= _; var w = d / Math.sqrt(m * g + h * _),
  717. C = w / p; return n.fromAxisAngle(s, C, u), i.fromQuaternion(u, c), i.multiplyByVector(c, f, v), e.normalize(v, v), e.multiplyByScalar(v, p, v), v } var a = {},
  718. s = new e,
  719. l = new e,
  720. u = new n,
  721. c = new i,
  722. h = new e,
  723. d = new e,
  724. m = new e,
  725. p = new e;
  726. a.raisePositionsToHeight = function(t, r, i) { for (var n = r.ellipsoid, o = r.height, a = r.extrudedHeight, s = i ? 2 * (t.length / 3) : t.length / 3, l = new Float64Array(3 * s), u = p, c = t.length, f = i ? c : 0, v = 0; c > v; v += 3) { var y, g = v + 1,
  727. _ = v + 2,
  728. w = e.fromArray(t, v, h);
  729. w = n.scaleToGeodeticSurface(w, w), y = w.clone(d), u = n.geodeticSurfaceNormal(w, u); var C = e.multiplyByScalar(u, o, m);
  730. w = e.add(w, C, w), i && (C = e.multiplyByScalar(u, a, C), y = e.add(y, C, y), l[v + f] = y.x, l[g + f] = y.y, l[_ + f] = y.z), l[v] = w.x, l[g] = w.y, l[_] = w.z } return l }; var f = new e,
  731. v = new e,
  732. y = new e; return a.computeEllipsePositions = function(t, i, n) { var a = t.semiMinorAxis,
  733. s = t.semiMajorAxis,
  734. l = t.rotation,
  735. u = t.center,
  736. c = t.granularity,
  737. p = 2.31,
  738. g = a * a,
  739. _ = s * s,
  740. w = s * a,
  741. C = u.magnitude(),
  742. x = e.normalize(u, f),
  743. S = e.cross(e.UNIT_Z, u, v);
  744. S = e.normalize(S, S); var E, b, T, A, M, P = e.cross(x, S, y),
  745. D = 1 + Math.ceil(r.PI_OVER_TWO / c),
  746. I = p / (D - 1),
  747. O = 2 * D * (D + 1),
  748. R = i ? new Array(3 * O) : void 0,
  749. L = 0,
  750. z = h,
  751. N = d,
  752. F = n ? [] : void 0,
  753. B = n ? [] : void 0,
  754. V = r.PI_OVER_TWO; for (E = 0; D > E && V > 0; ++E) { if (z = o(V, l, P, S, g, w, _, C, x, z), N = o(Math.PI - V, l, P, S, g, w, _, C, x, N), i) { for (R[L++] = z.x, R[L++] = z.y, R[L++] = z.z, T = 2 * E + 2, b = 1; T - 1 > b; ++b) A = b / (T - 1), M = e.lerp(z, N, A, m), R[L++] = M.x, R[L++] = M.y, R[L++] = M.z;
  755. R[L++] = N.x, R[L++] = N.y, R[L++] = N.z } n && (B.unshift(z.x, z.y, z.z), 0 !== E && F.push(N.x, N.y, N.z)), V = r.PI_OVER_TWO - (E + 1) * I } for (D = E, E = D; E > 0; --E) { if (V = r.PI_OVER_TWO - (E - 1) * I, z = o(-V, l, P, S, g, w, _, C, x, z), N = o(V + Math.PI, l, P, S, g, w, _, C, x, N), i) { for (R[L++] = z.x, R[L++] = z.y, R[L++] = z.z, T = 2 * (E - 1) + 2, b = 1; T - 1 > b; ++b) A = b / (T - 1), M = e.lerp(z, N, A, m), R[L++] = M.x, R[L++] = M.y, R[L++] = M.z;
  756. R[L++] = N.x, R[L++] = N.y, R[L++] = N.z } n && (B.unshift(z.x, z.y, z.z), 1 !== E && F.push(N.x, N.y, N.z)) } var q = {}; return i && (R.length !== L && (O = L / 3, R.length = L), q.positions = R, q.numPts = D), n && (q.outerPositions = B.concat(F)), q }, a }), r("Core/barycentricCoordinates", ["./Cartesian3", "./defined", "./DeveloperError"], function(e, t, r) {
  757. "use strict";
  758. var i = new e,
  759. n = new e,
  760. o = new e,
  761. a = function(a, s, l, u, c) {
  762. if (!(t(a) && t(s) && t(l) && t(u))) throw new r("point, p0, p1, and p2 are required.");
  763. t(c) || (c = new e);
  764. var h = l.subtract(s, i),
  765. d = u.subtract(s, n),
  766. m = a.subtract(s, o),
  767. p = h.dot(h),
  768. f = h.dot(d),
  769. v = h.dot(m),
  770. y = d.dot(d),
  771. g = d.dot(m),
  772. _ = 1 / (p * y - f * f);
  773. return c.y = (y * v - f * g) * _, c.z = (p * g - f * v) * _, c.x = 1 - c.y - c.z, c
  774. };
  775. return a
  776. }), r("Core/EncodedCartesian3", ["./Cartesian3", "./defined", "./DeveloperError"], function(e, t, r) { "use strict"; var i = function() { this.high = e.ZERO.clone(), this.low = e.ZERO.clone() };
  777. i.encode = function(e, i) { if (!t(e)) throw new r("value is required");
  778. t(i) || (i = { high: 0, low: 0 }); var n; return e >= 0 ? (n = 65536 * Math.floor(e / 65536), i.high = n, i.low = e - n) : (n = 65536 * Math.floor(-e / 65536), i.high = -n, i.low = e + n), i }; var n = { high: 0, low: 0 };
  779. i.fromCartesian = function(e, o) { if (!t(e)) throw new r("cartesian is required");
  780. t(o) || (o = new i); var a = o.high,
  781. s = o.low; return i.encode(e.x, n), a.x = n.high, s.x = n.low, i.encode(e.y, n), a.y = n.high, s.y = n.low, i.encode(e.z, n), a.z = n.high, s.z = n.low, o }; var o = new i; return i.writeElements = function(e, n, a) { if (!t(e)) throw new r("cartesian is required"); if (!t(n)) throw new r("cartesianArray is required"); if ("number" != typeof a || 0 > a) throw new r("index must be a number greater than or equal to 0.");
  782. i.fromCartesian(e, o); var s = o.high,
  783. l = o.low;
  784. n[a] = s.x, n[a + 1] = s.y, n[a + 2] = s.z, n[a + 3] = l.x, n[a + 4] = l.y, n[a + 5] = l.z }, i }), r("Core/QuadraticRealPolynomial", ["./DeveloperError", "./Math"], function(e, t) { "use strict";
  785. function r(e, r, i) { var n = e + r; return t.sign(e) !== t.sign(r) && Math.abs(n / Math.max(Math.abs(e), Math.abs(r))) < i ? 0 : n } var i = {}; return i.discriminant = function(t, r, i) { if ("number" != typeof t) throw new e("a is a required number."); if ("number" != typeof r) throw new e("b is a required number."); if ("number" != typeof i) throw new e("c is a required number."); var n = r * r - 4 * t * i; return n }, i.realRoots = function(i, n, o) { if ("number" != typeof i) throw new e("a is a required number."); if ("number" != typeof n) throw new e("b is a required number."); if ("number" != typeof o) throw new e("c is a required number."); var a; if (0 === i) return 0 === n ? [] : [-o / n]; if (0 === n) { if (0 === o) return [0, 0]; var s = Math.abs(o),
  786. l = Math.abs(i); if (l > s && s / l < t.EPSILON14) return [0, 0]; if (s > l && l / s < t.EPSILON14) return []; if (a = -o / i, 0 > a) return []; var u = Math.sqrt(a); return [-u, u] } if (0 === o) return a = -n / i, 0 > a ? [a, 0] : [0, a]; var c = n * n,
  787. h = 4 * i * o,
  788. d = r(c, -h, t.EPSILON14); if (0 > d) return []; var m = -.5 * r(n, t.sign(n) * Math.sqrt(d), t.EPSILON14); return n > 0 ? [m / i, o / m] : [o / m, m / i] }, i }), r("Core/CubicRealPolynomial", ["./DeveloperError", "./QuadraticRealPolynomial"], function(e, t) { "use strict";
  789. function r(e, t, r, i) { var n, o, a = e,
  790. s = t / 3,
  791. l = r / 3,
  792. u = i,
  793. c = a * l,
  794. h = s * u,
  795. d = s * s,
  796. m = l * l,
  797. p = a * l - d,
  798. f = a * u - s * l,
  799. v = s * u - m,
  800. y = 4 * p * v - f * f; if (0 > y) { var g, _, w;
  801. d * h >= c * m ? (g = a, _ = p, w = -2 * s * p + a * f) : (g = u, _ = v, w = -u * f + 2 * l * v); var C = 0 > w ? -1 : 1,
  802. x = -C * Math.abs(g) * Math.sqrt(-y);
  803. o = -w + x; var S = o / 2,
  804. E = 0 > S ? -Math.pow(-S, 1 / 3) : Math.pow(S, 1 / 3),
  805. b = o === x ? -E : -_ / E; return n = 0 >= _ ? E + b : -w / (E * E + b * b + _), d * h >= c * m ? [(n - s) / a] : [-u / (n + l)] } var T = p,
  806. A = -2 * s * p + a * f,
  807. M = v,
  808. P = -u * f + 2 * l * v,
  809. D = Math.sqrt(y),
  810. I = Math.sqrt(3) / 2,
  811. O = Math.abs(Math.atan2(a * D, -A) / 3);
  812. n = 2 * Math.sqrt(-T); var R = Math.cos(O);
  813. o = n * R; var L = n * (-R / 2 - I * Math.sin(O)),
  814. z = o + L > 2 * s ? o - s : L - s,
  815. N = a,
  816. F = z / N;
  817. O = Math.abs(Math.atan2(u * D, -P) / 3), n = 2 * Math.sqrt(-M), R = Math.cos(O), o = n * R, L = n * (-R / 2 - I * Math.sin(O)); var B = -u,
  818. V = 2 * l > o + L ? o + l : L + l,
  819. q = B / V,
  820. k = N * V,
  821. U = -z * V - N * B,
  822. W = z * B,
  823. G = (l * U - s * W) / (-s * U + l * k); return G >= F ? q >= F ? q >= G ? [F, G, q] : [F, q, G] : [q, F, G] : q >= F ? [G, F, q] : q >= G ? [G, q, F] : [q, G, F] } var i = {}; return i.discriminant = function(t, r, i, n) { if ("number" != typeof t) throw new e("a is a required number."); if ("number" != typeof r) throw new e("b is a required number."); if ("number" != typeof i) throw new e("c is a required number."); if ("number" != typeof n) throw new e("d is a required number."); var o = t * t,
  824. a = r * r,
  825. s = i * i,
  826. l = n * n,
  827. u = 18 * t * r * i * n + a * s - 27 * o * l - 4 * (t * s * i + a * r * n); return u }, i.realRoots = function(i, n, o, a) { if ("number" != typeof i) throw new e("a is a required number."); if ("number" != typeof n) throw new e("b is a required number."); if ("number" != typeof o) throw new e("c is a required number."); if ("number" != typeof a) throw new e("d is a required number."); var s, l; if (0 === i) return t.realRoots(n, o, a); if (0 === n) { if (0 === o) { if (0 === a) return [0, 0, 0];
  828. l = -a / i; var u = 0 > l ? -Math.pow(-l, 1 / 3) : Math.pow(l, 1 / 3); return [u, u, u] } return 0 === a ? (s = t.realRoots(i, 0, o), 0 === s.Length ? [0] : [s[0], 0, s[1]]) : r(i, 0, o, a) } return 0 === o ? 0 === a ? (l = -n / i, 0 > l ? [l, 0, 0] : [0, 0, l]) : r(i, n, 0, a) : 0 === a ? (s = t.realRoots(i, n, o), 0 === s.length ? [0] : s[1] <= 0 ? [s[0], s[1], 0] : s[0] >= 0 ? [0, s[0], s[1]] : [s[0], 0, s[1]]) : r(i, n, o, a) }, i }), r("Core/QuarticRealPolynomial", ["./DeveloperError", "./Math", "./CubicRealPolynomial", "./QuadraticRealPolynomial"], function(e, t, r, i) { "use strict";
  829. function n(e, n, o, a) { var s = e * e,
  830. l = n - 3 * s / 8,
  831. u = o - n * e / 2 + s * e / 8,
  832. c = a - o * e / 4 + n * s / 16 - 3 * s * s / 256,
  833. h = r.realRoots(1, 2 * l, l * l - 4 * c, -u * u); if (h.length > 0) { var d = -e / 4,
  834. m = h[h.length - 1]; if (Math.abs(m) < t.EPSILON14) { var p = i.realRoots(1, l, c); if (2 === p.length) { var f, v = p[0],
  835. y = p[1]; if (v >= 0 && y >= 0) { var g = Math.sqrt(v),
  836. _ = Math.sqrt(y); return [d - _, d - g, d + g, d + _] } if (v >= 0 && 0 > y) return f = Math.sqrt(v), [d - f, d + f]; if (0 > v && y >= 0) return f = Math.sqrt(y), [d - f, d + f] } return [] } if (m > 0) { var w = Math.sqrt(m),
  837. C = (l + m - u / w) / 2,
  838. x = (l + m + u / w) / 2,
  839. S = i.realRoots(1, w, C),
  840. E = i.realRoots(1, -w, x); return 0 !== S.length ? (S[0] += d, S[1] += d, 0 !== E.length ? (E[0] += d, E[1] += d, S[1] <= E[0] ? [S[0], S[1], E[0], E[1]] : E[1] <= S[0] ? [E[0], E[1], S[0], S[1]] : S[0] >= E[0] && S[1] <= E[1] ? [E[0], S[0], S[1], E[1]] : E[0] >= S[0] && E[1] <= S[1] ? [S[0], E[0], E[1], S[1]] : S[0] > E[0] && S[0] < E[1] ? [E[0], S[0], E[1], S[1]] : [S[0], E[0], S[1], E[1]]) : S) : 0 !== E.length ? (E[0] += d, E[1] += d, E) : [] } } return [] }
  841. function o(e, n, o, a) { var s = o * o,
  842. l = n * n,
  843. u = e * e,
  844. c = -2 * n,
  845. h = o * e + l - 4 * a,
  846. d = u * a - o * n * e + s,
  847. m = r.realRoots(1, c, h, d); if (m.length > 0) { var p, f, v = m[0],
  848. y = n - v,
  849. g = y * y,
  850. _ = e / 2,
  851. w = y / 2,
  852. C = g - 4 * a,
  853. x = g + 4 * Math.abs(a),
  854. S = u - 4 * v,
  855. E = u + 4 * Math.abs(v); if (0 > v || S * x > C * E) { var b = Math.sqrt(S);
  856. p = b / 2, f = 0 === b ? 0 : (e * w - o) / b } else { var T = Math.sqrt(C);
  857. p = 0 === T ? 0 : (e * w - o) / T, f = T / 2 } var A, M;
  858. 0 === _ && 0 === p ? (A = 0, M = 0) : t.sign(_) === t.sign(p) ? (A = _ + p, M = v / A) : (M = _ - p, A = v / M); var P, D;
  859. 0 === w && 0 === f ? (P = 0, D = 0) : t.sign(w) === t.sign(f) ? (P = w + f, D = a / P) : (D = w - f, P = a / D); var I = i.realRoots(1, A, P),
  860. O = i.realRoots(1, M, D); if (0 !== I.length) return 0 !== O.length ? I[1] <= O[0] ? [I[0], I[1], O[0], O[1]] : O[1] <= I[0] ? [O[0], O[1], I[0], I[1]] : I[0] >= O[0] && I[1] <= O[1] ? [O[0], I[0], I[1], O[1]] : O[0] >= I[0] && O[1] <= I[1] ? [I[0], O[0], O[1], I[1]] : I[0] > O[0] && I[0] < O[1] ? [O[0], I[0], O[1], I[1]] : [I[0], O[0], I[1], O[1]] : I; if (0 !== O.length) return O } return [] } var a = {}; return a.discriminant = function(t, r, i, n, o) { if ("number" != typeof t) throw new e("a is a required number."); if ("number" != typeof r) throw new e("b is a required number."); if ("number" != typeof i) throw new e("c is a required number."); if ("number" != typeof n) throw new e("d is a required number."); if ("number" != typeof o) throw new e("e is a required number."); var a = t * t,
  861. s = a * t,
  862. l = r * r,
  863. u = l * r,
  864. c = i * i,
  865. h = c * i,
  866. d = n * n,
  867. m = d * n,
  868. p = o * o,
  869. f = p * o,
  870. v = l * c * d - 4 * u * m - 4 * t * h * d + 18 * t * r * i * m - 27 * a * d * d + 256 * s * f + o * (18 * u * i * n - 4 * l * h + 16 * t * c * c - 80 * t * r * c * n - 6 * t * l * d + 144 * a * i * d) + p * (144 * t * l * i - 27 * l * l - 128 * a * c - 192 * a * r * n); return v }, a.realRoots = function(i, a, s, l, u) { if ("number" != typeof i) throw new e("a is a required number."); if ("number" != typeof a) throw new e("b is a required number."); if ("number" != typeof s) throw new e("c is a required number."); if ("number" != typeof l) throw new e("d is a required number."); if ("number" != typeof u) throw new e("e is a required number."); if (Math.abs(i) < t.EPSILON15) return r.realRoots(a, s, l, u); var c = a / i,
  871. h = s / i,
  872. d = l / i,
  873. m = u / i,
  874. p = 0 > c ? 1 : 0; switch (p += 0 > h ? p + 1 : p, p += 0 > d ? p + 1 : p, p += 0 > m ? p + 1 : p) {
  875. case 0:
  876. return n(c, h, d, m);
  877. case 1:
  878. return o(c, h, d, m);
  879. case 2:
  880. return o(c, h, d, m);
  881. case 3:
  882. return n(c, h, d, m);
  883. case 4:
  884. return n(c, h, d, m);
  885. case 5:
  886. return o(c, h, d, m);
  887. case 6:
  888. return n(c, h, d, m);
  889. case 7:
  890. return n(c, h, d, m);
  891. case 8:
  892. return o(c, h, d, m);
  893. case 9:
  894. return n(c, h, d, m);
  895. case 10:
  896. return n(c, h, d, m);
  897. case 11:
  898. return o(c, h, d, m);
  899. case 12:
  900. return n(c, h, d, m);
  901. case 13:
  902. return n(c, h, d, m);
  903. case 14:
  904. return n(c, h, d, m);
  905. case 15:
  906. return n(c, h, d, m);
  907. default:
  908. return void 0 } }, a }), r("Core/IntersectionTests", ["./defined", "./DeveloperError", "./Math", "./Cartesian3", "./Cartographic", "./Matrix3", "./QuadraticRealPolynomial", "./QuarticRealPolynomial"], function(e, t, r, i, n, o, a, s) { "use strict";
  909. function l(e, t, i) { var n = e + t; return r.sign(e) !== r.sign(t) && Math.abs(n / Math.max(Math.abs(e), Math.abs(t))) < i ? 0 : n }
  910. function u(e, t, n, u, c) { var h, d = u * u,
  911. m = c * c,
  912. p = (e[o.COLUMN1ROW1] - e[o.COLUMN2ROW2]) * m,
  913. f = c * (u * l(e[o.COLUMN1ROW0], e[o.COLUMN0ROW1], r.EPSILON15) + t.y),
  914. v = e[o.COLUMN0ROW0] * d + e[o.COLUMN2ROW2] * m + u * t.x + n,
  915. y = m * l(e[o.COLUMN2ROW1], e[o.COLUMN1ROW2], r.EPSILON15),
  916. g = c * (u * l(e[o.COLUMN2ROW0], e[o.COLUMN0ROW2]) + t.z),
  917. _ = []; if (0 === g && 0 === y) { if (h = a.realRoots(p, f, v), 0 === h.length) return _; var w = h[0],
  918. C = Math.sqrt(Math.max(1 - w * w, 0)); if (_.push(new i(u, c * w, c * -C)), _.push(new i(u, c * w, c * C)), 2 === h.length) { var x = h[1],
  919. S = Math.sqrt(Math.max(1 - x * x, 0));
  920. _.push(new i(u, c * x, c * -S)), _.push(new i(u, c * x, c * S)) } return _ } var E = g * g,
  921. b = y * y,
  922. T = p * p,
  923. A = g * y,
  924. M = T + b,
  925. P = 2 * (f * p + A),
  926. D = 2 * v * p + f * f - b + E,
  927. I = 2 * (v * f - A),
  928. O = v * v - E; if (0 === M && 0 === P && 0 === D && 0 === I) return _;
  929. h = s.realRoots(M, P, D, I, O); var R = h.length; if (0 === R) return _; for (var L = 0; R > L; ++L) { var z, N = h[L],
  930. F = N * N,
  931. B = Math.max(1 - F, 0),
  932. V = Math.sqrt(B);
  933. z = r.sign(p) === r.sign(v) ? l(p * F + v, f * N, r.EPSILON12) : r.sign(v) === r.sign(f * N) ? l(p * F, f * N + v, r.EPSILON12) : l(p * F + f * N, v, r.EPSILON12); var q = l(y * N, g, r.EPSILON15),
  934. k = z * q;
  935. 0 > k ? _.push(new i(u, c * N, c * V)) : k > 0 ? _.push(new i(u, c * N, c * -V)) : 0 !== V ? (_.push(new i(u, c * N, c * -V)), _.push(new i(u, c * N, c * V)), ++L) : _.push(new i(u, c * N, c * V)) } return _ } var c = {};
  936. c.rayPlane = function(n, o, a) { if (!e(n)) throw new t("ray is required."); if (!e(o)) throw new t("plane is required."); var s = n.origin,
  937. l = n.direction,
  938. u = o.normal,
  939. c = i.dot(u, l); if (Math.abs(c) < r.EPSILON15) return void 0; var h = (-o.distance - i.dot(u, s)) / c; return 0 > h ? void 0 : (a = l.multiplyByScalar(h, a), i.add(s, a)) }, c.rayEllipsoid = function(r, i) { if (!e(r)) throw new t("ray is required."); if (!e(i)) throw new t("ellipsoid is required."); var n, o, a, s, l, u = i.getOneOverRadii(),
  940. c = u.multiplyComponents(r.origin),
  941. h = u.multiplyComponents(r.direction),
  942. d = c.magnitudeSquared(),
  943. m = c.dot(h); if (d > 1) { if (m >= 0) return void 0; var p = m * m; if (n = d - 1, o = h.magnitudeSquared(), a = o * n, a > p) return void 0; if (p > a) { s = m * m - a, l = -m + Math.sqrt(s); var f = l / o,
  944. v = n / l; return v > f ? { start: f, stop: v } : { start: v, stop: f } } var y = Math.sqrt(n / o); return { start: y, stop: y } } return 1 > d ? (n = d - 1, o = h.magnitudeSquared(), a = o * n, s = m * m - a, l = -m + Math.sqrt(s), { start: 0, stop: l / o }) : 0 > m ? (o = h.magnitudeSquared(), { start: 0, stop: -m / o }) : void 0 }, c.grazingAltitudeLocation = function(a, s) { if (!e(a)) throw new t("ray is required."); if (!e(s)) throw new t("ellipsoid is required."); var l = a.origin,
  945. c = a.direction,
  946. h = s.geodeticSurfaceNormal(l); if (i.dot(c, h) >= 0) return l; var d, m, p = e(this.rayEllipsoid(a, s)),
  947. f = s.transformPositionToScaledSpace(c),
  948. v = f.normalize(),
  949. y = f.mostOrthogonalAxis(),
  950. g = y.cross(v).normalize(),
  951. _ = v.cross(g).normalize(),
  952. w = new o(v.x, g.x, _.x, v.y, g.y, _.y, v.z, g.z, _.z),
  953. C = w.transpose(),
  954. x = o.fromScale(s.getRadii()),
  955. S = o.fromScale(s.getOneOverRadii()),
  956. E = new o(0, c.z, -c.y, -c.z, 0, c.x, c.y, -c.x, 0),
  957. b = C.multiply(S).multiply(E),
  958. T = b.multiply(x).multiply(w),
  959. A = b.multiplyByVector(l),
  960. M = u(T, A.negate(), 0, 0, 1),
  961. P = M.length; if (P > 0) { for (var D = i.ZERO, I = Number.NEGATIVE_INFINITY, O = 0; P > O; ++O) { d = x.multiplyByVector(w.multiplyByVector(M[O])); var R = d.subtract(l).normalize(),
  962. L = R.dot(c);
  963. L > I && (I = L, D = d) } var z = s.cartesianToCartographic(D); return I = r.clamp(I, 0, 1), m = D.subtract(l).magnitude() * Math.sqrt(1 - I * I), m = p ? -m : m, s.cartographicToCartesian(new n(z.longitude, z.latitude, m)) } return void 0 }; var h = new i; return c.lineSegmentPlane = function(n, o, a, s) { if (!e(n)) throw new t("endPoint0 is required."); if (!e(o)) throw new t("endPoint1 is required."); if (!e(a)) throw new t("plane is required."); var l = i.subtract(o, n, h),
  964. u = a.normal,
  965. c = i.dot(u, l); if (Math.abs(c) < r.EPSILON6) return void 0; var d = i.dot(u, n),
  966. m = -(a.distance + d) / c; return 0 > m || m > 1 ? void 0 : (e(s) || (s = new i), i.multiplyByScalar(l, m, s), i.add(n, s, s), s) }, c.trianglePlaneIntersection = function(r, n, o, a) { if (!(e(r) && e(n) && e(o) && e(a))) throw new t("p0, p1, p2, and plane are required."); var s = a.normal,
  967. l = a.distance,
  968. u = i.dot(s, r) + l < 0,
  969. h = i.dot(s, n) + l < 0,
  970. d = i.dot(s, o) + l < 0,
  971. m = 0;
  972. m += u ? 1 : 0, m += h ? 1 : 0, m += d ? 1 : 0; var p, f; if ((1 === m || 2 === m) && (p = new i, f = new i), 1 === m) { if (u) return c.lineSegmentPlane(r, n, a, p), c.lineSegmentPlane(r, o, a, f), { positions: [r, n, o, p, f], indices: [0, 3, 4, 1, 2, 4, 1, 4, 3] }; if (h) return c.lineSegmentPlane(n, o, a, p), c.lineSegmentPlane(n, r, a, f), { positions: [r, n, o, p, f], indices: [1, 3, 4, 2, 0, 4, 2, 4, 3] }; if (d) return c.lineSegmentPlane(o, r, a, p), c.lineSegmentPlane(o, n, a, f), { positions: [r, n, o, p, f], indices: [2, 3, 4, 0, 1, 4, 0, 4, 3] } } else if (2 === m) { if (!u) return c.lineSegmentPlane(n, r, a, p), c.lineSegmentPlane(o, r, a, f), { positions: [r, n, o, p, f], indices: [1, 2, 4, 1, 4, 3, 0, 3, 4] }; if (!h) return c.lineSegmentPlane(o, n, a, p), c.lineSegmentPlane(r, n, a, f), { positions: [r, n, o, p, f], indices: [2, 0, 4, 2, 4, 3, 1, 3, 4] }; if (!d) return c.lineSegmentPlane(r, o, a, p), c.lineSegmentPlane(n, o, a, f), { positions: [r, n, o, p, f], indices: [0, 1, 4, 0, 4, 3, 2, 3, 4] } } return void 0 }, c }), r("Core/Plane", ["./Cartesian3", "./defined", "./DeveloperError"], function(e, t, r) { "use strict"; var i = function(i, n) { if (!t(i)) throw new r("normal is required."); if (!t(n)) throw new r("distance is required.");
  973. this.normal = e.clone(i), this.distance = n }; return i.fromPointNormal = function(n, o, a) { if (!t(n)) throw new r("point is required."); if (!t(o)) throw new r("normal is required."); var s = -e.dot(o, n); return t(a) ? (e.clone(o, a.normal), a.distance = s, a) : new i(o, s) }, i.getPointDistance = function(i, n) { if (!t(i)) throw new r("plane is required."); if (!t(n)) throw new r("point is required."); return e.dot(i.normal, n) + i.distance }, i.prototype.getPointDistance = function(e) { return i.getPointDistance(this, e) }, i }), r("Core/Tipsify", ["./defaultValue", "./defined", "./DeveloperError"], function(e, t, r) { "use strict"; var i = {}; return i.calculateACMR = function(i) { i = e(i, e.EMPTY_OBJECT); var n = i.indices,
  974. o = i.maximumIndex,
  975. a = e(i.cacheSize, 24); if (!t(n)) throw new r("indices is required."); var s = n.length; if (3 > s || 0 !== s % 3) throw new r("indices length must be a multiple of three."); if (0 >= o) throw new r("maximumIndex must be greater than zero."); if (3 > a) throw new r("cacheSize must be greater than two."); if (!t(o)) { o = 0; for (var l = 0, u = n[l]; s > l;) u > o && (o = u), ++l, u = n[l] } for (var c = [], h = 0; o + 1 > h; h++) c[h] = 0; for (var d = a + 1, m = 0; s > m; ++m) d - c[n[m]] > a && (c[n[m]] = d, ++d); return (d - a + 1) / (s / 3) }, i.tipsify = function(i) {
  976. function n(e, t, r, i) { for (; t.length >= 1;) { var n = t[t.length - 1]; if (t.splice(t.length - 1, 1), e[n].numLiveTriangles > 0) return n } for (; i > a;) { if (e[a].numLiveTriangles > 0) return ++a, a - 1;++a } return -1 }
  977. function o(e, t, r, i, o, a, s) { for (var l, u = -1, c = -1, h = 0; h < r.length;) { var d = r[h];
  978. i[d].numLiveTriangles && (l = 0, o - i[d].timeStamp + 2 * i[d].numLiveTriangles <= t && (l = o - i[d].timeStamp), (l > c || -1 === c) && (c = l, u = d)), ++h } return -1 === u ? n(i, a, e, s) : u } i = e(i, e.EMPTY_OBJECT); var a, s = i.indices,
  979. l = i.maximumIndex,
  980. u = e(i.cacheSize, 24); if (!t(s)) throw new r("indices is required."); var c = s.length; if (3 > c || 0 !== c % 3) throw new r("indices length must be a multiple of three."); if (0 >= l) throw new r("maximumIndex must be greater than zero."); if (3 > u) throw new r("cacheSize must be greater than two."); var h = 0,
  981. d = 0,
  982. m = s[d],
  983. p = c; if (t(l)) h = l + 1;
  984. else { for (; p > d;) m > h && (h = m), ++d, m = s[d]; if (-1 === h) return 0;++h } for (var f = [], v = 0; h > v; v++) f[v] = { numLiveTriangles: 0, timeStamp: 0, vertexTriangles: [] };
  985. d = 0; for (var y = 0; p > d;) f[s[d]].vertexTriangles.push(y), ++f[s[d]].numLiveTriangles, f[s[d + 1]].vertexTriangles.push(y), ++f[s[d + 1]].numLiveTriangles, f[s[d + 2]].vertexTriangles.push(y), ++f[s[d + 2]].numLiveTriangles, ++y, d += 3; var g = 0,
  986. _ = u + 1;
  987. a = 1; var w, C, x = [],
  988. S = [],
  989. E = 0,
  990. b = [],
  991. T = c / 3,
  992. A = []; for (v = 0; T > v; v++) A[v] = !1; for (var M, P; - 1 !== g;) { x = [], C = f[g], P = C.vertexTriangles.length; for (var D = 0; P > D; ++D)
  993. if (y = C.vertexTriangles[D], !A[y]) { A[y] = !0, d = y + y + y; for (var I = 0; 3 > I; ++I) M = s[d], x.push(M), S.push(M), b[E] = M, ++E, w = f[M], --w.numLiveTriangles, _ - w.timeStamp > u && (w.timeStamp = _, ++_), ++d }
  994. g = o(s, u, x, f, _, S, h) } return b }, i }), r("Core/GeometryPipeline", ["./barycentricCoordinates", "./defaultValue", "./defined", "./DeveloperError", "./Cartesian2", "./Cartesian3", "./Cartesian4", "./Cartographic", "./EncodedCartesian3", "./Intersect", "./IntersectionTests", "./Math", "./Matrix3", "./Matrix4", "./Plane", "./GeographicProjection", "./ComponentDatatype", "./IndexDatatype", "./PrimitiveType", "./Tipsify", "./BoundingSphere", "./Geometry", "./GeometryAttribute"], function(e, t, r, i, n, o, a, s, l, u, c, h, d, m, p, f, v, y, g, _, w, C, x) {
  995. "use strict";
  996. function S(e, t, r, i, n) { e[t++] = r, e[t++] = i, e[t++] = i, e[t++] = n, e[t++] = n, e[t] = r }
  997. function E(e) { for (var t = e.length, r = 6 * (t / 3), i = y.createTypedArray(t, r), n = 0, o = 0; t > o; o += 3, n += 6) S(i, n, e[o], e[o + 1], e[o + 2]); return i }
  998. function b(e) { var t = e.length; if (t >= 3) { var r = 6 * (t - 2),
  999. i = y.createTypedArray(t, r);
  1000. S(i, 0, e[0], e[1], e[2]); for (var n = 6, o = 3; t > o; ++o, n += 6) S(i, n, e[o - 1], e[o], e[o - 2]); return i } return new Uint16Array }
  1001. function T(e) { if (e.length > 0) { for (var t = e.length - 1, r = 6 * (t - 1), i = y.createTypedArray(t, r), n = e[0], o = 0, a = 1; t > a; ++a, o += 6) S(i, o, n, e[a], e[a + 1]); return i } return new Uint16Array }
  1002. function A(e) { var t = {}; for (var i in e)
  1003. if (e.hasOwnProperty(i) && r(e[i]) && r(e[i].values)) { var n = e[i];
  1004. t[i] = new x({ componentDatatype: n.componentDatatype, componentsPerAttribute: n.componentsPerAttribute, normalize: n.normalize, values: [] }) }
  1005. return t }
  1006. function M(e, t, i) { for (var n in t)
  1007. if (t.hasOwnProperty(n) && r(t[n]) && r(t[n].values))
  1008. for (var o = t[n], a = 0; a < o.componentsPerAttribute; ++a) e[n].values.push(o.values[i * o.componentsPerAttribute + a]) }
  1009. function P(e, t) { if (r(t))
  1010. for (var i = t.values, n = i.length, a = 0; n > a; a += 3) o.fromArray(i, a, Z), m.multiplyByPoint(e, Z, Z), i[a] = Z.x, i[a + 1] = Z.y, i[a + 2] = Z.z }
  1011. function D(e, t) { if (r(t))
  1012. for (var i = t.values, n = i.length, a = 0; n > a; a += 3) o.fromArray(i, a, Z), d.multiplyByVector(e, Z, Z), i[a] = Z.x, i[a + 1] = Z.y, i[a + 2] = Z.z }
  1013. function I(e) { var t, i = e.length,
  1014. n = {},
  1015. o = e[0].geometry.attributes; for (t in o)
  1016. if (o.hasOwnProperty(t) && r(o[t]) && r(o[t].values)) { for (var a = o[t], s = a.values.length, l = !0, u = 1; i > u; ++u) { var c = e[u].geometry.attributes[t]; if (!r(c) || a.componentDatatype.value !== c.componentDatatype.value || a.componentsPerAttribute !== c.componentsPerAttribute || a.normalize !== c.normalize) { l = !1; break } s += c.values.length } l && (n[t] = new x({ componentDatatype: a.componentDatatype, componentsPerAttribute: a.componentsPerAttribute, normalize: a.normalize, values: v.createTypedArray(a.componentDatatype, s) })) }
  1017. return n }
  1018. function O(e) { if (r(e.indices)) return e; var t = C.computeNumberOfVertices(e); if (3 > t) throw new i("The number of vertices must be at least three."); if (0 !== t % 3) throw new i("The number of vertices must be a multiple of three."); for (var n = y.createTypedArray(t, t), o = 0; t > o; ++o) n[o] = o; return e.indices = n, e }
  1019. function R(e) { var t = C.computeNumberOfVertices(e); if (3 > t) throw new i("The number of vertices must be at least three."); var r = y.createTypedArray(t, 3 * (t - 2));
  1020. r[0] = 1, r[1] = 0, r[2] = 2; for (var n = 3, o = 3; t > o; ++o) r[n++] = o - 1, r[n++] = 0, r[n++] = o; return e.indices = r, e.primitiveType = g.TRIANGLES, e }
  1021. function L(e) { var t = C.computeNumberOfVertices(e); if (3 > t) throw new i("The number of vertices must be at least 3."); var r = y.createTypedArray(t, 3 * (t - 2));
  1022. r[0] = 0, r[1] = 1, r[2] = 2, t > 3 && (r[3] = 0, r[4] = 2, r[5] = 3); for (var n = 6, o = 3; t - 1 > o; o += 2) r[n++] = o, r[n++] = o - 1, r[n++] = o + 1, t > o + 2 && (r[n++] = o, r[n++] = o + 1, r[n++] = o + 2); return e.indices = r, e.primitiveType = g.TRIANGLES, e }
  1023. function z(e) { if (r(e.indices)) return e; var t = C.computeNumberOfVertices(e); if (2 > t) throw new i("The number of vertices must be at least two."); if (0 !== t % 2) throw new i("The number of vertices must be a multiple of 2."); for (var n = y.createTypedArray(t, t), o = 0; t > o; ++o) n[o] = o; return e.indices = n, e }
  1024. function N(e) { var t = C.computeNumberOfVertices(e); if (2 > t) throw new i("The number of vertices must be at least two."); var r = y.createTypedArray(t, 2 * (t - 1));
  1025. r[0] = 0, r[1] = 1; for (var n = 2, o = 2; t > o; ++o) r[n++] = o - 1, r[n++] = o; return e.indices = r, e.primitiveType = g.LINES, e }
  1026. function F(e) { var t = C.computeNumberOfVertices(e); if (2 > t) throw new i("The number of vertices must be at least two."); var r = y.createTypedArray(t, 2 * t);
  1027. r[0] = 0, r[1] = 1; for (var n = 2, o = 2; t > o; ++o) r[n++] = o - 1, r[n++] = o; return r[n++] = t - 1, r[n] = 0, e.indices = r, e.primitiveType = g.LINES, e }
  1028. function B(e) { switch (e.primitiveType.value) {
  1029. case g.TRIANGLE_FAN.value:
  1030. return R(e);
  1031. case g.TRIANGLE_STRIP.value:
  1032. return L(e);
  1033. case g.TRIANGLES.value:
  1034. return O(e);
  1035. case g.LINE_STRIP.value:
  1036. return N(e);
  1037. case g.LINE_LOOP.value:
  1038. return F(e);
  1039. case g.LINES.value:
  1040. return z(e) } return e }
  1041. function V(e, t) { Math.abs(e.y) < h.EPSILON11 && (e.y = t ? -h.EPSILON11 : h.EPSILON11) }
  1042. function q(e, t, r, i) { e.add(t.subtract(e, ot).multiplyByScalar(e.y / (e.y - t.y), ot), r), o.clone(r, i), V(r, !0), V(i, !1) }
  1043. function k(e, t, r) { if (e.x >= 0 || t.x >= 0 || r.x >= 0) return void 0; var i = e.y < 0,
  1044. n = t.y < 0,
  1045. o = r.y < 0;
  1046. V(e, i), V(t, n), V(r, o); var a = 0;
  1047. a += i ? 1 : 0, a += n ? 1 : 0, a += o ? 1 : 0; var s = ct.indices;
  1048. 1 === a ? (s[1] = 3, s[2] = 4, s[5] = 6, s[7] = 6, s[8] = 5, i ? (q(e, t, at, lt), q(e, r, st, ut), s[0] = 0, s[3] = 1, s[4] = 2, s[6] = 1) : n ? (q(t, r, at, lt), q(t, e, st, ut), s[0] = 1, s[3] = 2, s[4] = 0, s[6] = 2) : o && (q(r, e, at, lt), q(r, t, st, ut), s[0] = 2, s[3] = 0, s[4] = 1, s[6] = 0)) : 2 === a && (s[2] = 4, s[4] = 4, s[5] = 3, s[7] = 5, s[8] = 6, i ? n ? o || (q(r, e, at, lt), q(r, t, st, ut), s[0] = 0, s[1] = 1, s[3] = 0, s[6] = 2) : (q(t, r, at, lt), q(t, e, st, ut), s[0] = 2, s[1] = 0, s[3] = 2, s[6] = 1) : (q(e, t, at, lt), q(e, r, st, ut), s[0] = 1, s[1] = 2, s[3] = 1, s[6] = 0)); var l = ct.positions; return l[0] = e, l[1] = t, l[2] = r, ct.length = 3, (1 === a || 2 === a) && (l[3] = at, l[4] = st, l[5] = lt, l[6] = ut, ct.length = 7), ct }
  1049. function U(t, i, a, s, l, u, c, h) { if (r(l) || r(u) || r(c) || r(h)) { var d, m, p, f, v, y, g, _, w, C, x, S, E, b, T, A, M, P, D = s.positions,
  1050. I = D[0],
  1051. O = D[1],
  1052. R = D[2];
  1053. r(l) && (d = o.fromArray(l, 3 * t), m = o.fromArray(l, 3 * i), p = o.fromArray(l, 3 * a)), r(u) && (f = o.fromArray(u, 3 * t), v = o.fromArray(u, 3 * i), y = o.fromArray(u, 3 * a)), r(c) && (g = o.fromArray(c, 3 * t), _ = o.fromArray(c, 3 * i), w = o.fromArray(c, 3 * a)), r(h) && (C = n.fromArray(h, 2 * t), x = n.fromArray(h, 2 * i), S = n.fromArray(h, 2 * a)); for (var L = 3; L < D.length; ++L) { var z = D[L],
  1054. N = e(z, I, O, R); if (r(l)) { E = o.multiplyByScalar(d, N.x, E), b = o.multiplyByScalar(m, N.y, b), T = o.multiplyByScalar(p, N.z, T); var F = o.add(E, b);
  1055. o.add(F, T, F), o.normalize(F, F), l.push(F.x, F.y, F.z) } if (r(u)) { E = o.multiplyByScalar(f, N.x, E), b = o.multiplyByScalar(v, N.y, b), T = o.multiplyByScalar(y, N.z, T); var B = o.add(E, b);
  1056. o.add(B, T, B), o.normalize(B, B), u.push(B.x, B.y, B.z) } if (r(c)) { E = o.multiplyByScalar(g, N.x, E), b = o.multiplyByScalar(_, N.y, b), T = o.multiplyByScalar(w, N.z, T); var V = o.add(E, b);
  1057. o.add(V, T, V), o.normalize(V, V), c.push(V.x, V.y, V.z) } if (r(h)) { A = n.multiplyByScalar(C, N.x, A), M = n.multiplyByScalar(x, N.y, M), P = n.multiplyByScalar(S, N.z, P); var q = n.add(A, M);
  1058. n.add(q, P, q), h.push(q.x, q.y) } } } }
  1059. function W(e) { for (var t = e.attributes, i = t.position.values, n = r(t.normal) ? t.normal.values : void 0, a = r(t.binormal) ? t.binormal.values : void 0, s = r(t.tangent) ? t.tangent.values : void 0, l = r(t.st) ? t.st.values : void 0, u = e.indices, c = Array.prototype.slice.call(i, 0), h = r(n) ? Array.prototype.slice.call(n, 0) : void 0, d = r(a) ? Array.prototype.slice.call(a, 0) : void 0, m = r(s) ? Array.prototype.slice.call(s, 0) : void 0, p = r(l) ? Array.prototype.slice.call(l, 0) : void 0, f = [], g = u.length, _ = 0; g > _; _ += 3) { var w = u[_],
  1060. x = u[_ + 1],
  1061. S = u[_ + 2],
  1062. E = o.fromArray(i, 3 * w),
  1063. b = o.fromArray(i, 3 * x),
  1064. T = o.fromArray(i, 3 * S),
  1065. A = k(E, b, T); if (r(A))
  1066. if (c[3 * w + 1] = A.positions[0].y, c[3 * x + 1] = A.positions[1].y, c[3 * S + 1] = A.positions[2].y, A.length > 3) { for (var M = c.length / 3, P = 0; P < A.indices.length; ++P) { var D = A.indices[P];
  1067. 3 > D ? f.push(u[_ + D]) : f.push(D - 3 + M) } for (var I = 3; I < A.positions.length; ++I) { var O = A.positions[I];
  1068. c.push(O.x, O.y, O.z) } U(w, x, S, A, h, d, m, p) } else f.push(w, x, S);
  1069. else f.push(w, x, S) } e.attributes.position.values = new Float64Array(c), r(h) && (t.normal.values = v.createTypedArray(t.normal.componentDatatype, h)), r(d) && (t.binormal.values = v.createTypedArray(t.binormal.componentDatatype, d)), r(m) && (t.tangent.values = v.createTypedArray(t.tangent.componentDatatype, m)), r(p) && (t.st.values = v.createTypedArray(t.st.componentDatatype, p)); var R = C.computeNumberOfVertices(e);
  1070. e.indices = y.createTypedArray(R, f) }
  1071. function G(e) { for (var t = e.attributes, i = t.position.values, n = e.indices, a = Array.prototype.slice.call(i, 0), s = [], l = p.fromPointNormal(o.ZERO, o.UNIT_Y), u = n.length, d = 0; u > d; d += 2) { var m = n[d],
  1072. f = n[d + 1],
  1073. v = o.fromArray(i, 3 * m),
  1074. g = o.fromArray(i, 3 * f); if (Math.abs(v.y) < h.EPSILON6 && (v.y = v.y < 0 ? -h.EPSILON6 : h.EPSILON6, a[3 * m + 1] = v.y), Math.abs(g.y) < h.EPSILON6 && (g.y = g.y < 0 ? -h.EPSILON6 : h.EPSILON6, a[3 * f + 1] = g.y), s.push(m), v.x < 0 || g.x < 0) { var _ = c.lineSegmentPlane(v, g, l); if (r(_)) { var w = o.multiplyByScalar(o.UNIT_Y, 5 * h.EPSILON9);
  1075. v.y < 0 && o.negate(w, w); var x = a.length / 3;
  1076. s.push(x, x + 1); var S = o.add(_, w);
  1077. a.push(S.x, S.y, S.z), o.negate(w, w), o.add(_, w, S), a.push(S.x, S.y, S.z) } } s.push(f) } e.attributes.position.values = new Float64Array(a); var E = C.computeNumberOfVertices(e);
  1078. e.indices = y.createTypedArray(E, s) }
  1079. var H = {};
  1080. H.toWireframe = function(e) { if (!r(e)) throw new i("geometry is required."); var t = e.indices; if (r(t)) { switch (e.primitiveType.value) {
  1081. case g.TRIANGLES.value:
  1082. e.indices = E(t); break;
  1083. case g.TRIANGLE_STRIP.value:
  1084. e.indices = b(t); break;
  1085. case g.TRIANGLE_FAN.value:
  1086. e.indices = T(t); break;
  1087. default:
  1088. throw new i("geometry.primitiveType must be TRIANGLES, TRIANGLE_STRIP, or TRIANGLE_FAN.") } e.primitiveType = g.LINES } return e }, H.createLineSegmentsForVectors = function(e, n, o) { if (!r(e)) throw new i("geometry is required."); if (!r(e.attributes.position)) throw new i("geometry.attributes.position is required."); if (n = t(n, "normal"), !r(e.attributes[n])) throw new i("geometry.attributes must have an attribute with the same name as the attributeName parameter, " + n + ".");
  1089. o = t(o, 1e4); for (var a = e.attributes.position.values, s = e.attributes[n].values, l = a.length, u = new Float64Array(2 * l), c = 0, h = 0; l > h; h += 3) u[c++] = a[h], u[c++] = a[h + 1], u[c++] = a[h + 2], u[c++] = a[h] + s[h] * o, u[c++] = a[h + 1] + s[h + 1] * o, u[c++] = a[h + 2] + s[h + 2] * o; var d, m = e.boundingSphere; return r(m) && (d = new w(m.center, m.radius + o)), new C({ attributes: { position: new x({ componentDatatype: v.DOUBLE, componentsPerAttribute: 3, values: u }) }, primitiveType: g.LINES, boundingSphere: d }) }, H.createAttributeIndices = function(e) { if (!r(e)) throw new i("geometry is required."); var t, n = ["position", "positionHigh", "positionLow", "position3DHigh", "position3DLow", "position2DHigh", "position2DLow", "pickColor", "normal", "st", "binormal", "tangent"],
  1090. o = e.attributes,
  1091. a = {},
  1092. s = 0,
  1093. l = n.length; for (t = 0; l > t; ++t) { var u = n[t];
  1094. r(o[u]) && (a[u] = s++) } for (var c in o) o.hasOwnProperty(c) && !r(a[c]) && (a[c] = s++); return a }, H.reorderForPreVertexCache = function(e) { if (!r(e)) throw new i("geometry is required."); var t = C.computeNumberOfVertices(e),
  1095. n = e.indices; if (r(n)) { for (var o = new Int32Array(t), a = 0; t > a; a++) o[a] = -1; for (var s, l = n, u = l.length, c = y.createTypedArray(t, u), h = 0, d = 0, m = 0; u > h;) s = o[l[h]], -1 !== s ? c[d] = s : (s = l[h], o[s] = m, c[d] = m, ++m), ++h, ++d;
  1096. e.indices = c; var p = e.attributes; for (var f in p)
  1097. if (p.hasOwnProperty(f) && r(p[f]) && r(p[f].values)) { for (var g = p[f], _ = g.values, w = 0, x = g.componentsPerAttribute, S = v.createTypedArray(g.componentDatatype, _.length); t > w;) { var E = o[w]; for (a = 0; x > a; a++) S[x * E + a] = _[x * w + a];++w } g.values = S } } return e }, H.reorderForPostVertexCache = function(e, t) { if (!r(e)) throw new i("geometry is required."); var n = e.indices; if (e.primitiveType.value === g.TRIANGLES.value && r(n)) { for (var o = n.length, a = 0, s = 0; o > s; s++) n[s] > a && (a = n[s]);
  1098. e.indices = _.tipsify({ indices: n, maximumIndex: a, cacheSize: t }) } return e }, H.fitToUnsignedShortIndices = function(e) { if (!r(e)) throw new i("geometry is required."); if (r(e.indices) && e.primitiveType.value !== g.TRIANGLES.value && e.primitiveType.value !== g.LINES.value && e.primitiveType.value !== g.POINTS.value) throw new i("geometry.primitiveType must equal to PrimitiveType.TRIANGLES, PrimitiveType.LINES, or PrimitiveType.POINTS."); var t = [],
  1099. n = C.computeNumberOfVertices(e); if (r(e.indices) && n > h.SIXTY_FOUR_KILOBYTES) { var o, a = [],
  1100. s = [],
  1101. l = 0,
  1102. u = A(e.attributes),
  1103. c = e.indices,
  1104. d = c.length;
  1105. e.primitiveType.value === g.TRIANGLES.value ? o = 3 : e.primitiveType.value === g.LINES.value ? o = 2 : e.primitiveType.value === g.POINTS.value && (o = 1); for (var m = 0; d > m; m += o) { for (var p = 0; o > p; ++p) { var f = c[m + p],
  1106. v = a[f];
  1107. r(v) || (v = l++, a[f] = v, M(u, e.attributes, f)), s.push(v) } l + o > h.SIXTY_FOUR_KILOBYTES && (t.push(new C({ attributes: u, indices: s, primitiveType: e.primitiveType, boundingSphere: e.boundingSphere })), a = [], s = [], l = 0, u = A(e.attributes)) } 0 !== s.length && t.push(new C({ attributes: u, indices: s, primitiveType: e.primitiveType, boundingSphere: e.boundingSphere })) } else t.push(e); return t };
  1108. var j = new o,
  1109. Y = new s;
  1110. H.projectTo2D = function(e, t) { if (!r(e)) throw new i("geometry is required."); if (r(e.attributes.position)) { t = r(t) ? t : new f; for (var n = t.getEllipsoid(), a = e.attributes.position.values, s = new Float64Array(a.length), l = 0, u = 0; u < a.length; u += 3) { var c = o.fromArray(a, u, j),
  1111. h = n.cartesianToCartographic(c, Y),
  1112. d = t.project(h, j);
  1113. s[l++] = d.x, s[l++] = d.y, s[l++] = d.z } e.attributes.position3D = e.attributes.position, e.attributes.position2D = new x({ componentDatatype: v.DOUBLE, componentsPerAttribute: 3, values: s }), delete e.attributes.position } return e };
  1114. var X = { high: 0, low: 0 };
  1115. H.encodeAttribute = function(e, t, n, o) { if (!r(e)) throw new i("geometry is required."); if (!r(t)) throw new i("attributeName is required."); if (!r(n)) throw new i("attributeHighName is required."); if (!r(o)) throw new i("attributeLowName is required."); var a = e.attributes[t]; if (!r(a)) throw new i("geometry must have attribute matching the attributeName argument: " + t + "."); if (a.componentDatatype.value !== v.DOUBLE.value) throw new i("The attribute componentDatatype must be ComponentDatatype.DOUBLE."); for (var s = a.values, u = s.length, c = new Float32Array(u), h = new Float32Array(u), d = 0; u > d; ++d) l.encode(s[d], X), c[d] = X.high, h[d] = X.low; var m = a.componentsPerAttribute; return e.attributes[n] = new x({ componentDatatype: v.FLOAT, componentsPerAttribute: m, values: c }), e.attributes[o] = new x({ componentDatatype: v.FLOAT, componentsPerAttribute: m, values: h }), delete e.attributes[t], e };
  1116. var Z = new o,
  1117. K = new m,
  1118. J = new d;
  1119. H.transformToWorldCoordinates = function(e) { if (!r(e)) throw new i("instance is required."); var t = e.modelMatrix; if (m.equals(t, m.IDENTITY)) return e; var n = e.geometry.attributes;
  1120. P(t, n.position), (r(n.normal) || r(n.binormal) || r(n.tangent)) && (m.inverse(t, K), m.transpose(K, K), m.getRotation(K, J), D(J, n.normal), D(J, n.binormal), D(J, n.tangent)); var a = e.geometry.boundingSphere; return r(a) && (m.multiplyByPoint(t, a.center, a.center), a.center = o.fromCartesian4(a.center)), e.modelMatrix = m.IDENTITY.clone(), e }, H.combine = function(e) { if (!r(e) || e.length < 1) throw new i("instances is required and must have length greater than zero."); var t, n, a, s, l = e.length,
  1121. u = e[0].modelMatrix,
  1122. c = r(e[0].geometry.indices),
  1123. h = e[0].geometry.primitiveType; for (n = 1; l > n; ++n) { if (!m.equals(e[n].modelMatrix, u)) throw new i("All instances must have the same modelMatrix."); if (r(e[n].geometry.indices) !== c) throw new i("All instance geometries must have an indices or not have one."); if (e[n].geometry.primitiveType.value !== h.value) throw new i("All instance geometries must have the same primitiveType.") } var d, p, f, v = I(e); for (t in v)
  1124. if (v.hasOwnProperty(t))
  1125. for (d = v[t].values, s = 0, n = 0; l > n; ++n)
  1126. for (p = e[n].geometry.attributes[t].values, f = p.length, a = 0; f > a; ++a) d[s++] = p[a]; var _; if (c) { var x = 0; for (n = 0; l > n; ++n) x += e[n].geometry.indices.length; var S = C.computeNumberOfVertices(new C({ attributes: v, primitiveType: g.POINTS })),
  1127. E = y.createTypedArray(S, x),
  1128. b = 0,
  1129. T = 0; for (n = 0; l > n; ++n) { var A = e[n].geometry.indices,
  1130. M = A.length; for (s = 0; M > s; ++s) E[b++] = T + A[s];
  1131. T += C.computeNumberOfVertices(e[n].geometry) } _ = E } var P, D = new o,
  1132. O = 0; for (n = 0; l > n; ++n) { if (P = e[n].geometry.boundingSphere, !r(P)) { D = void 0; break } o.add(P.center, D, D) } if (r(D))
  1133. for (o.divideByScalar(D, l, D), n = 0; l > n; ++n) { P = e[n].geometry.boundingSphere; var R = o.magnitude(o.subtract(P.center, D)) + P.radius;
  1134. R > O && (O = R) }
  1135. return new C({ attributes: v, indices: _, primitiveType: h, boundingSphere: r(D) ? new w(D, O) : void 0 }) };
  1136. var Q = new o,
  1137. $ = new o,
  1138. et = new o,
  1139. tt = new o;
  1140. H.computeNormal = function(e) {
  1141. if (!r(e)) throw new i("geometry is required.");
  1142. var t = e.attributes,
  1143. n = e.indices;
  1144. if (!r(t.position) || !r(t.position.values)) throw new i("geometry.attributes.position.values is required.");
  1145. if (!r(n)) throw new i("geometry.indices is required.");
  1146. if (n.length < 2 || 0 !== n.length % 3) throw new i("geometry.indices length must be greater than 0 and be a multiple of 3.");
  1147. if (e.primitiveType.value !== g.TRIANGLES.value) throw new i("geometry.primitiveType must be PrimitiveType.TRIANGLES.");
  1148. for (var a = e.attributes.position.values, s = e.attributes.position.values.length / 3, l = n.length, u = new Array(s), c = new Array(l / 3), h = new Array(l), d = 0; s > d; d++) u[d] = { indexOffset: 0, count: 0, currentCount: 0 };
  1149. var m = 0;
  1150. for (d = 0; l > d; d += 3) { var p = n[d],
  1151. f = n[d + 1],
  1152. y = n[d + 2],
  1153. _ = 3 * p,
  1154. w = 3 * f,
  1155. C = 3 * y;
  1156. $.x = a[_], $.y = a[_ + 1], $.z = a[_ + 2], et.x = a[w], et.y = a[w + 1], et.z = a[w + 2], tt.x = a[C], tt.y = a[C + 1], tt.z = a[C + 2], u[p].count++, u[f].count++, u[y].count++, et.subtract($, et), tt.subtract($, tt), c[m] = et.cross(tt), m++ }
  1157. var S = 0;
  1158. for (d = 0; s > d; d++) u[d].indexOffset += S, S += u[d].count;
  1159. m = 0;
  1160. var E;
  1161. for (d = 0; l > d; d += 3) { E = u[n[d]]; var b = E.indexOffset + E.currentCount;
  1162. h[b] = m, E.currentCount++, E = u[n[d + 1]], b = E.indexOffset + E.currentCount, h[b] = m, E.currentCount++, E = u[n[d + 2]], b = E.indexOffset + E.currentCount, h[b] = m, E.currentCount++, m++ }
  1163. var T = new Float32Array(3 * s);
  1164. for (d = 0; s > d; d++) { var A = 3 * d; if (E = u[d], E.count > 0) { for (o.ZERO.clone(Q), m = 0; m < E.count; m++) Q.add(c[h[E.indexOffset + m]], Q);
  1165. Q.normalize(Q), T[A] = Q.x, T[A + 1] = Q.y, T[A + 2] = Q.z } else T[A] = 0, T[A + 1] = 0, T[A + 2] = 1 }
  1166. return e.attributes.normal = new x({ componentDatatype: v.FLOAT, componentsPerAttribute: 3, values: T }), e
  1167. };
  1168. var rt = new o,
  1169. it = new o,
  1170. nt = new o;
  1171. H.computeBinormalAndTangent = function(e) { if (!r(e)) throw new i("geometry is required."); var t = e.attributes,
  1172. n = e.indices; if (!r(t.position) || !r(t.position.values)) throw new i("geometry.attributes.position.values is required."); if (!r(t.normal) || !r(t.normal.values)) throw new i("geometry.attributes.normal.values is required."); if (!r(t.st) || !r(t.st.values)) throw new i("geometry.attributes.st.values is required."); if (!r(n)) throw new i("geometry.indices is required."); if (n.length < 2 || 0 !== n.length % 3) throw new i("geometry.indices length must be greater than 0 and be a multiple of 3."); if (e.primitiveType.value !== g.TRIANGLES.value) throw new i("geometry.primitiveType must be PrimitiveType.TRIANGLES."); for (var a = e.attributes.position.values, s = e.attributes.normal.values, l = e.attributes.st.values, u = e.attributes.position.values.length / 3, c = n.length, h = new Array(3 * u), d = 0; d < h.length; d++) h[d] = 0; var m, p, f; for (d = 0; c > d; d += 3) { var y = n[d],
  1173. _ = n[d + 1],
  1174. w = n[d + 2];
  1175. m = 3 * y, p = 3 * _, f = 3 * w; var C = 2 * y,
  1176. S = 2 * _,
  1177. E = 2 * w,
  1178. b = a[m],
  1179. T = a[m + 1],
  1180. A = a[m + 2],
  1181. M = l[C],
  1182. P = l[C + 1],
  1183. D = l[S + 1] - P,
  1184. I = l[E + 1] - P,
  1185. O = 1 / ((l[S] - M) * I - (l[E] - M) * D),
  1186. R = (I * (a[p] - b) - D * (a[f] - b)) * O,
  1187. L = (I * (a[p + 1] - T) - D * (a[f + 1] - T)) * O,
  1188. z = (I * (a[p + 2] - A) - D * (a[f + 2] - A)) * O;
  1189. h[m] += R, h[m + 1] += L, h[m + 2] += z, h[p] += R, h[p + 1] += L, h[p + 2] += z, h[f] += R, h[f + 1] += L, h[f + 2] += z } var N = new Float32Array(3 * u),
  1190. F = new Float32Array(3 * u); for (d = 0; u > d; d++) { m = 3 * d, p = m + 1, f = m + 2; var B = o.fromArray(s, m, rt),
  1191. V = o.fromArray(h, m, nt),
  1192. q = B.dot(V);
  1193. B.multiplyByScalar(q, it), V.subtract(it, V).normalize(V), F[m] = V.x, F[p] = V.y, F[f] = V.z, B.cross(V, V).normalize(V), N[m] = V.x, N[p] = V.y, N[f] = V.z } return e.attributes.tangent = new x({ componentDatatype: v.FLOAT, componentsPerAttribute: 3, values: F }), e.attributes.binormal = new x({ componentDatatype: v.FLOAT, componentsPerAttribute: 3, values: N }), e };
  1194. var ot = new o,
  1195. at = new o,
  1196. st = new o,
  1197. lt = new o,
  1198. ut = new o,
  1199. ct = { positions: new Array(7), indices: new Array(9) };
  1200. return H.wrapLongitude = function(e) { if (!r(e)) throw new i("geometry is required."); var t = e.boundingSphere; if (r(t)) { var n = t.center.x - t.radius; if (n > 0 || w.intersect(t, a.UNIT_Y) !== u.INTERSECTING) return e } return B(e), e.primitiveType.value === g.TRIANGLES.value ? W(e) : e.primitiveType.value === g.LINES.value && G(e), e }, H
  1201. }), r("Core/GeometryInstanceAttribute", ["./defaultValue", "./defined", "./DeveloperError"], function(e, t, r) { "use strict"; var i = function(i) { if (i = e(i, e.EMPTY_OBJECT), !t(i.componentDatatype)) throw new r("options.componentDatatype is required."); if (!t(i.componentsPerAttribute)) throw new r("options.componentsPerAttribute is required."); if (i.componentsPerAttribute < 1 || i.componentsPerAttribute > 4) throw new r("options.componentsPerAttribute must be between 1 and 4."); if (!t(i.value)) throw new r("options.value is required.");
  1202. this.componentDatatype = i.componentDatatype, this.componentsPerAttribute = i.componentsPerAttribute, this.normalize = e(i.normalize, !1), this.value = i.value }; return i }), r("Core/GeometryInstance", ["./defaultValue", "./defined", "./DeveloperError", "./Matrix4", "./Geometry", "./GeometryInstanceAttribute"], function(e, t, r, i) { "use strict"; var n = function(n) { if (n = e(n, e.EMPTY_OBJECT), !t(n.geometry)) throw new r("options.geometry is required.");
  1203. this.geometry = n.geometry, this.modelMatrix = i.clone(e(n.modelMatrix, i.IDENTITY)), this.id = n.id, this.attributes = e(n.attributes, {}) }; return n }), r("Core/EllipseGeometry", ["./defaultValue", "./defined", "./BoundingSphere", "./Cartesian2", "./Cartesian3", "./Cartographic", "./ComponentDatatype", "./IndexDatatype", "./DeveloperError", "./Ellipsoid", "./EllipseGeometryLibrary", "./GeographicProjection", "./Geometry", "./GeometryPipeline", "./GeometryInstance", "./GeometryAttribute", "./GeometryAttributes", "./Math", "./Matrix3", "./PrimitiveType", "./Quaternion", "./VertexFormat"], function(e, t, r, i, n, o, a, s, l, u, c, h, d, m, p, f, v, y, g, _, w, C) { "use strict";
  1204. function x(e, t, r) { var i = t.vertexFormat,
  1205. o = t.center,
  1206. s = t.semiMajorAxis,
  1207. l = t.ellipsoid,
  1208. u = t.stRotation,
  1209. d = r ? 2 * (e.length / 3) : e.length / 3,
  1210. m = i.st ? new Float32Array(2 * d) : void 0,
  1211. p = i.normal ? new Float32Array(3 * d) : void 0,
  1212. y = i.tangent ? new Float32Array(3 * d) : void 0,
  1213. _ = i.binormal ? new Float32Array(3 * d) : void 0,
  1214. C = 0,
  1215. x = z,
  1216. S = N,
  1217. E = F,
  1218. b = new h(l),
  1219. T = b.project(l.cartesianToCartographic(o, B), V),
  1220. A = l.scaleToGeodeticSurface(o, M);
  1221. l.geodeticSurfaceNormal(A, A); for (var I = w.fromAxisAngle(A, u, L), q = g.fromQuaternion(I, R), k = e.length, U = r ? k : 0, W = 2 * (U / 3), G = 0; k > G; G += 3) { var H = G + 1,
  1222. j = G + 2,
  1223. Y = n.fromArray(e, G, M); if (i.st) { var X = g.multiplyByVector(q, Y, P),
  1224. Z = b.project(l.cartesianToCartographic(X, B), D);
  1225. Z = n.subtract(Z, T, Z), O.x = (Z.x + s) / (2 * s), O.y = (Z.y + s) / (2 * s), r && (m[C + W] = O.x, m[C + 1 + W] = O.y), m[C++] = O.x, m[C++] = O.y } x = l.geodeticSurfaceNormal(Y, x), (i.normal || i.tangent || i.binormal) && ((i.tangent || i.binormal) && (S = n.cross(n.UNIT_Z, x, S), g.multiplyByVector(q, S, S)), i.normal && (p[G] = x.x, p[H] = x.y, p[j] = x.z, r && (p[G + U] = -x.x, p[H + U] = -x.y, p[j + U] = -x.z)), i.tangent && (y[G] = S.x, y[H] = S.y, y[j] = S.z, r && (y[G + U] = -S.x, y[H + U] = -S.y, y[j + U] = -S.z)), i.binormal && (E = n.cross(x, S, E), _[G] = E.x, _[H] = E.y, _[j] = E.z, r && (_[G + U] = E.x, _[H + U] = E.y, _[j + U] = E.z))) } var K = new v; if (i.position) { var J = c.raisePositionsToHeight(e, t, r);
  1226. K.position = new f({ componentDatatype: a.DOUBLE, componentsPerAttribute: 3, values: J }) } return i.st && (K.st = new f({ componentDatatype: a.FLOAT, componentsPerAttribute: 2, values: m })), i.normal && (K.normal = new f({ componentDatatype: a.FLOAT, componentsPerAttribute: 3, values: p })), i.tangent && (K.tangent = new f({ componentDatatype: a.FLOAT, componentsPerAttribute: 3, values: y })), i.binormal && (K.binormal = new f({ componentDatatype: a.FLOAT, componentsPerAttribute: 3, values: _ })), K }
  1227. function S(e) { var t, r, i, n, o, a = new Array(2 * e * (e + 1)),
  1228. s = 0; for (n = 1; e > n; ++n) { for (i = n * (n + 1), t = (n - 1) * n, a[s++] = i++, a[s++] = t, a[s++] = i, r = 2 * n, o = 0; r - 1 > o; ++o) a[s++] = i, a[s++] = t++, a[s++] = t, a[s++] = i++, a[s++] = t, a[s++] = i;
  1229. a[s++] = i++, a[s++] = t, a[s++] = i } for (r = 2 * e, ++i, ++t, n = 0; r - 1 > n; ++n) a[s++] = i, a[s++] = t++, a[s++] = t, a[s++] = i++, a[s++] = t, a[s++] = i; for (++t, ++i, n = e - 1; n > 0; --n) { for (a[s++] = t++, a[s++] = t, a[s++] = i, r = 2 * n, o = 0; r - 1 > o; ++o) a[s++] = i, a[s++] = t++, a[s++] = t, a[s++] = i++, a[s++] = t, a[s++] = i;
  1230. a[s++] = t++, a[s++] = t++, a[s++] = i++ } return a }
  1231. function E(e) { var t = e.center;
  1232. q = n.multiplyByScalar(e.ellipsoid.geodeticSurfaceNormal(t, q), e.height, q), q = n.add(t, q, q); var i = new r(q, e.semiMajorAxis),
  1233. o = c.computeEllipsePositions(e, !0, !1),
  1234. a = o.positions,
  1235. l = o.numPts,
  1236. u = x(a, e, !1),
  1237. h = S(l); return h = s.createTypedArray(a.length / 3, h), { boundingSphere: i, attributes: u, indices: h } }
  1238. function b(e, t) { var r = t.vertexFormat,
  1239. i = t.center,
  1240. o = t.semiMajorAxis,
  1241. s = t.ellipsoid,
  1242. l = t.height,
  1243. u = t.extrudedHeight,
  1244. c = t.stRotation,
  1245. d = 2 * (e.length / 3),
  1246. m = new Float64Array(3 * d),
  1247. p = r.st ? new Float32Array(2 * d) : void 0,
  1248. y = r.normal ? new Float32Array(3 * d) : void 0,
  1249. _ = r.tangent ? new Float32Array(3 * d) : void 0,
  1250. C = r.binormal ? new Float32Array(3 * d) : void 0,
  1251. x = 0,
  1252. S = z,
  1253. E = N,
  1254. b = F,
  1255. T = new h(s),
  1256. A = T.project(s.cartesianToCartographic(i, B), V),
  1257. q = s.scaleToGeodeticSurface(i, M);
  1258. s.geodeticSurfaceNormal(q, q); for (var k = w.fromAxisAngle(q, c, L), U = g.fromQuaternion(k, R), W = e.length, G = 2 * (W / 3), H = 0; W > H; H += 3) { var j, Y = H + 1,
  1259. X = H + 2,
  1260. Z = n.fromArray(e, H, M); if (r.st) { var K = g.multiplyByVector(U, Z, P),
  1261. J = T.project(s.cartesianToCartographic(K, B), D);
  1262. J = n.subtract(J, A, J), O.x = (J.x + o) / (2 * o), O.y = (J.y + o) / (2 * o), p[x + G] = O.x, p[x + 1 + G] = O.y, p[x++] = O.x, p[x++] = O.y } Z = s.scaleToGeodeticSurface(Z, Z), j = Z.clone(P), S = s.geodeticSurfaceNormal(Z, S); var Q = n.multiplyByScalar(S, l, I); if (Z = n.add(Z, Q, Z), Q = n.multiplyByScalar(S, u, Q), j = n.add(j, Q, j), r.position && (m[H + W] = j.x, m[Y + W] = j.y, m[X + W] = j.z, m[H] = Z.x, m[Y] = Z.y, m[X] = Z.z), r.normal || r.tangent || r.binormal) { b = S.clone(b); var $ = n.fromArray(e, (H + 3) % W, I);
  1263. $ = $.subtract(Z, $); var et = j.subtract(Z, D);
  1264. S = et.cross($, S).normalize(S), r.normal && (y[H] = S.x, y[Y] = S.y, y[X] = S.z, y[H + W] = S.x, y[Y + W] = S.y, y[X + W] = S.z), r.tangent && (E = n.cross(b, S, E).normalize(E), _[H] = E.x, _[Y] = E.y, _[X] = E.z, _[H + W] = E.x, _[H + 1 + W] = E.y, _[H + 2 + W] = E.z), r.binormal && (C[H] = b.x, C[Y] = b.y, C[X] = b.z, C[H + W] = b.x, C[Y + W] = b.y, C[X + W] = b.z) } } var tt = new v; return r.position && (tt.position = new f({ componentDatatype: a.DOUBLE, componentsPerAttribute: 3, values: m })), r.st && (tt.st = new f({ componentDatatype: a.FLOAT, componentsPerAttribute: 2, values: p })), r.normal && (tt.normal = new f({ componentDatatype: a.FLOAT, componentsPerAttribute: 3, values: y })), r.tangent && (tt.tangent = new f({ componentDatatype: a.FLOAT, componentsPerAttribute: 3, values: _ })), r.binormal && (tt.binormal = new f({ componentDatatype: a.FLOAT, componentsPerAttribute: 3, values: C })), tt }
  1265. function T(e) { for (var t, r, i, n, o = e.length / 3, a = s.createTypedArray(o, 6 * o), l = 0, u = 0; o - 1 > u; u++) t = u, i = u + o, r = t + 1, n = r + o, a[l++] = t, a[l++] = i, a[l++] = r, a[l++] = r, a[l++] = i, a[l++] = n; return t = o - 1, i = u + o, r = 0, n = r + o, a[l++] = t, a[l++] = i, a[l++] = r, a[l++] = r, a[l++] = i, a[l++] = n, a }
  1266. function A(e) { var t = e.center,
  1267. i = e.ellipsoid,
  1268. o = e.semiMajorAxis,
  1269. a = n.multiplyByScalar(i.geodeticSurfaceNormal(t, M), e.height, M);
  1270. k.center = n.add(t, a, k.center), k.radius = o, a = n.multiplyByScalar(i.geodeticSurfaceNormal(t, a), e.extrudedHeight, a), U.center = n.add(t, a, U.center), U.radius = o; var l = c.computeEllipsePositions(e, !0, !0),
  1271. u = l.positions,
  1272. h = l.numPts,
  1273. f = l.outerPositions,
  1274. v = r.union(k, U),
  1275. y = x(u, e, !0),
  1276. g = S(h),
  1277. w = g.length;
  1278. g.length = 2 * w; for (var C = u.length / 3, E = 0; w > E; E += 3) g[E + w] = g[E + 2] + C, g[E + 1 + w] = g[E + 1] + C, g[E + 2 + w] = g[E] + C; var A = s.createTypedArray(2 * C / 3, g),
  1279. P = new d({ attributes: y, indices: A, primitiveType: _.TRIANGLES }),
  1280. D = b(f, e);
  1281. g = T(f); var I = s.createTypedArray(2 * f.length / 3, g),
  1282. O = new d({ attributes: D, indices: I, primitiveType: _.TRIANGLES }),
  1283. R = m.combine([new p({ geometry: P }), new p({ geometry: O })]); return { boundingSphere: v, attributes: R.attributes, indices: R.indices } } var M = new n,
  1284. P = new n,
  1285. D = new n,
  1286. I = new n,
  1287. O = new i,
  1288. R = new g,
  1289. L = new w,
  1290. z = new n,
  1291. N = new n,
  1292. F = new n,
  1293. B = new o,
  1294. V = new n,
  1295. q = new n,
  1296. k = new r,
  1297. U = new r,
  1298. W = function(r) { r = e(r, e.EMPTY_OBJECT); var i = r.center,
  1299. o = r.semiMajorAxis,
  1300. a = r.semiMinorAxis,
  1301. s = e(r.granularity, y.RADIANS_PER_DEGREE),
  1302. c = e(r.height, 0),
  1303. h = r.extrudedHeight,
  1304. d = t(h) && !y.equalsEpsilon(c, h, 1); if (!t(i)) throw new l("center is required."); if (!t(o)) throw new l("semiMajorAxis is required."); if (!t(a)) throw new l("semiMinorAxis is required."); if (0 >= o || 0 >= a) throw new l("Semi-major and semi-minor axes must be greater than zero."); if (a > o) throw new l("semiMajorAxis must be larger than the semiMajorAxis."); if (0 >= s) throw new l("granularity must be greater than zero.");
  1305. this._center = n.clone(i), this._semiMajorAxis = o, this._semiMinorAxis = a, this._ellipsoid = e(r.ellipsoid, u.WGS84), this._rotation = e(r.rotation, 0), this._stRotation = e(r.stRotation, 0), this._height = c, this._granularity = s, this._vertexFormat = e(r.vertexFormat, C.DEFAULT), this._extrudedHeight = h, this._extrude = d, this._workerName = "createEllipseGeometry" }; return W.createGeometry = function(e) { var t, r = { center: e._center, semiMajorAxis: e._semiMajorAxis, semiMinorAxis: e._semiMinorAxis, ellipsoid: e._ellipsoid, rotation: e._rotation, height: e._height, extrudedHeight: e._extrudedHeight, granularity: e._granularity, vertexFormat: e._vertexFormat, stRotation: e._stRotation }; return e._extrude ? (r.extrudedHeight = Math.min(e._extrudedHeight, e._height), r.height = Math.max(e._extrudedHeight, e._height), t = A(r)) : t = E(r), new d({ attributes: t.attributes, indices: t.indices, primitiveType: _.TRIANGLES, boundingSphere: t.boundingSphere }) }, W }), r("Core/CircleGeometry", ["./defaultValue", "./defined", "./DeveloperError", "./EllipseGeometry"], function(e, t, r, i) { "use strict"; var n = function(n) { n = e(n, e.EMPTY_OBJECT); var o = n.radius; if (!t(o)) throw new r("radius is required."); if (0 >= o) throw new r("radius must be greater than zero."); var a = { center: n.center, semiMajorAxis: o, semiMinorAxis: o, ellipsoid: n.ellipsoid, height: n.height, extrudedHeight: n.extrudedHeight, granularity: n.granularity, vertexFormat: n.vertexFormat, stRotation: n.stRotation };
  1306. this._ellipseGeometry = new i(a), this._workerName = "createCircleGeometry" }; return n.createGeometry = function(e) { return i.createGeometry(e._ellipseGeometry) }, n }), r("Core/EllipseOutlineGeometry", ["./defaultValue", "./defined", "./BoundingSphere", "./Cartesian3", "./ComponentDatatype", "./IndexDatatype", "./DeveloperError", "./Ellipsoid", "./EllipseGeometryLibrary", "./Geometry", "./GeometryAttribute", "./GeometryAttributes", "./Math", "./PrimitiveType"], function(e, t, r, i, n, o, a, s, l, u, c, h, d, m) { "use strict";
  1307. function p(e) { var t = e.center;
  1308. y = i.multiplyByScalar(e.ellipsoid.geodeticSurfaceNormal(t, y), e.height, y), y = i.add(t, y, y); for (var a = new r(y, e.semiMajorAxis), s = l.computeEllipsePositions(e, !1, !0).outerPositions, u = new h({ position: new c({ componentDatatype: n.DOUBLE, componentsPerAttribute: 3, values: l.raisePositionsToHeight(s, e, !1) }) }), d = s.length / 3, m = o.createTypedArray(d, 2 * d), p = 0, f = 0; d - 1 > f; f++) m[p++] = f, m[p++] = f + 1; return m[p++] = d - 1, m[p++] = 0, { boundingSphere: a, attributes: u, indices: m } }
  1309. function f(t) { var a = e(t.numberOfVerticalLines, 16);
  1310. a = Math.max(a, 0); var s = t.center,
  1311. u = t.ellipsoid,
  1312. d = t.semiMajorAxis,
  1313. m = i.multiplyByScalar(u.geodeticSurfaceNormal(s, v), t.height, v);
  1314. g.center = i.add(s, m, g.center), g.radius = d, m = i.multiplyByScalar(u.geodeticSurfaceNormal(s, m), t.extrudedHeight, m), _.center = i.add(s, m, _.center), _.radius = d; var p = l.computeEllipsePositions(t, !1, !0).outerPositions,
  1315. f = new h({ position: new c({ componentDatatype: n.DOUBLE, componentsPerAttribute: 3, values: l.raisePositionsToHeight(p, t, !0) }) });
  1316. p = f.position.values; var y = r.union(g, _),
  1317. w = p.length / 3,
  1318. C = o.createTypedArray(w, 2 * w + 2 * a);
  1319. w /= 2; for (var x = 0, S = 0; w - 1 > S; S++) C[x++] = S, C[x++] = S + 1, C[x++] = S + w, C[x++] = S + w + 1;
  1320. C[x++] = w - 1, C[x++] = 0, C[x++] = w + w - 1, C[x++] = w; var E; if (a > 0) { var b = Math.min(a, w);
  1321. E = Math.round(w / b) } var T = Math.min(E * a, w); if (a > 0)
  1322. for (S = 0; T > S; S += E) C[x++] = S, C[x++] = S + w; return { boundingSphere: y, attributes: f, indices: C } } var v = new i,
  1323. y = new i,
  1324. g = new r,
  1325. _ = new r,
  1326. w = function(r) { r = e(r, e.EMPTY_OBJECT); var n = r.center,
  1327. o = r.semiMajorAxis,
  1328. l = r.semiMinorAxis,
  1329. u = e(r.granularity, d.RADIANS_PER_DEGREE),
  1330. c = e(r.height, 0),
  1331. h = r.extrudedHeight,
  1332. m = t(h) && !d.equalsEpsilon(c, h, 1); if (!t(n)) throw new a("center is required."); if (!t(o)) throw new a("semiMajorAxis is required."); if (!t(l)) throw new a("semiMinorAxis is required."); if (0 >= o || 0 >= l) throw new a("Semi-major and semi-minor axes must be greater than zero."); if (l > o) throw new a("semiMajorAxis must be larger than the semiMajorAxis."); if (0 >= u) throw new a("granularity must be greater than zero.");
  1333. this._center = i.clone(n), this._semiMajorAxis = o, this._semiMinorAxis = l, this._ellipsoid = e(r.ellipsoid, s.WGS84), this._rotation = e(r.rotation, 0), this._height = c, this._granularity = u, this._extrudedHeight = h, this._extrude = m, this._numberOfVerticalLines = Math.max(e(r.numberOfVerticalLines, 16), 0), this._workerName = "createEllipseOutlineGeometry" }; return w.createGeometry = function(e) { var t, r = { center: e._center, semiMajorAxis: e._semiMajorAxis, semiMinorAxis: e._semiMinorAxis, ellipsoid: e._ellipsoid, rotation: e._rotation, height: e._height, extrudedHeight: e._extrudedHeight, granularity: e._granularity, numberOfVerticalLines: e._numberOfVerticalLines }; return e._extrude ? (r.extrudedHeight = Math.min(e._extrudedHeight, e._height), r.height = Math.max(e._extrudedHeight, e._height), t = f(r)) : t = p(r), new u({ attributes: t.attributes, indices: t.indices, primitiveType: m.LINES, boundingSphere: t.boundingSphere }) }, w }), r("Core/CircleOutlineGeometry", ["./defaultValue", "./defined", "./DeveloperError", "./EllipseOutlineGeometry"], function(e, t, r, i) { "use strict"; var n = function(n) { n = e(n, e.EMPTY_OBJECT); var o = n.radius; if (!t(o)) throw new r("radius is required."); if (0 >= o) throw new r("radius must be greater than zero."); var a = { center: n.center, semiMajorAxis: o, semiMinorAxis: o, ellipsoid: n.ellipsoid, height: n.height, extrudedHeight: n.extrudedHeight, granularity: n.granularity, numberOfVerticalLines: n.numberOfVerticalLines };
  1334. this._ellipseGeometry = new i(a), this._workerName = "createCircleOutlineGeometry" }; return n.createGeometry = function(e) { return i.createGeometry(e._ellipseGeometry) }, n }), r("Core/binarySearch", ["./defined", "./DeveloperError"], function(e, t) { "use strict"; var r = function(r, i, n) { if (!e(r)) throw new t("array is required."); if (!e(i)) throw new t("itemToFind is required."); if (!e(n)) throw new t("comparator is required."); for (var o, a, s = 0, l = r.length - 1; l >= s;)
  1335. if (o = ~~((s + l) / 2), a = n(r[o], i), 0 > a) s = o + 1;
  1336. else { if (!(a > 0)) return o;
  1337. l = o - 1 }
  1338. return ~(l + 1) }; return r }), r("Core/TimeConstants", [], function() { "use strict"; var e = { SECONDS_PER_MILLISECOND: .001, SECONDS_PER_MINUTE: 60, MINUTES_PER_HOUR: 60, HOURS_PER_DAY: 24, SECONDS_PER_HOUR: 3600, MINUTES_PER_DAY: 1440, SECONDS_PER_DAY: 86400, DAYS_PER_JULIAN_CENTURY: 36525, PICOSECOND: 1e-9, MODIFIED_JULIAN_DATE_DIFFERENCE: 2400000.5 }; return e }), r("Core/LeapSecond", ["./defined", "./DeveloperError"], function(e, t) { "use strict"; var r = function(r, i) { if (!e(r)) throw new t("date is required."); if (null === i || isNaN(i)) throw new t("offset is required and must be a number.");
  1339. this.julianDate = r, this.offset = i }; return r.setLeapSeconds = function(e) { if (!Array.isArray(e)) throw new t("leapSeconds is required and must be an array.");
  1340. r._leapSeconds = e, r._leapSeconds.sort(r.compareLeapSecondDate) }, r.getLeapSeconds = function() { return r._leapSeconds }, r.prototype.equals = function(e) { return this.julianDate.equals(e.julianDate) && this.offset === e.offset }, r.compareLeapSecondDate = function(e, t) { return e.julianDate.compareTo(t.julianDate) }, r._leapSeconds = [], r }), r("Core/TimeStandard", [], function() { "use strict"; var e = { UTC: 0, TAI: 1 }; return e }), r("Core/isLeapYear", ["./DeveloperError"], function(e) { "use strict";
  1341. function t(t) { if (null === t || isNaN(t)) throw new e("year is required and must be a number."); return 0 === t % 4 && 0 !== t % 100 || 0 === t % 400 } return t }), r("ThirdParty/sprintf", [], function() {
  1342. function e() { var e = /%%|%(\d+\$)?([-+\'#0 ]*)(\*\d+\$|\*|\d+)?(\.(\*\d+\$|\*|\d+))?([scboxXuideEfFgG])/g,
  1343. t = arguments,
  1344. r = 0,
  1345. i = t[r++],
  1346. n = function(e, t, r, i) { r || (r = " "); var n = e.length >= t ? "" : Array(1 + t - e.length >>> 0).join(r); return i ? e + n : n + e },
  1347. o = function(e, t, r, i, o, a) { var s = i - e.length; return s > 0 && (e = r || !o ? n(e, i, a, r) : e.slice(0, t.length) + n("", s, "0", !0) + e.slice(t.length)), e },
  1348. a = function(e, t, r, i, a, s, l) { var u = e >>> 0; return r = r && u && { 2: "0b", 8: "0", 16: "0x" }[t] || "", e = r + n(u.toString(t), s || 0, "0", !1), o(e, r, i, a, l) },
  1349. s = function(e, t, r, i, n, a) { return null != i && (e = e.slice(0, i)), o(e, "", t, r, n, a) },
  1350. l = function(e, i, l, u, c, h, d) { var m, p, f, v, y; if ("%%" == e) return "%"; for (var g = !1, _ = "", w = !1, C = !1, x = " ", S = l.length, E = 0; l && S > E; E++) switch (l.charAt(E)) {
  1351. case " ":
  1352. _ = " "; break;
  1353. case "+":
  1354. _ = "+"; break;
  1355. case "-":
  1356. g = !0; break;
  1357. case "'":
  1358. x = l.charAt(E + 1); break;
  1359. case "0":
  1360. w = !0; break;
  1361. case "#":
  1362. C = !0 }
  1363. if (u = u ? "*" == u ? +t[r++] : "*" == u.charAt(0) ? +t[u.slice(1, -1)] : +u : 0, 0 > u && (u = -u, g = !0), !isFinite(u)) throw new Error("sprintf: (minimum-)width must be finite"); switch (h = h ? "*" == h ? +t[r++] : "*" == h.charAt(0) ? +t[h.slice(1, -1)] : +h : "fFeE".indexOf(d) > -1 ? 6 : "d" == d ? 0 : void 0, y = i ? t[i.slice(0, -1)] : t[r++], d) {
  1364. case "s":
  1365. return s(String(y), g, u, h, w, x);
  1366. case "c":
  1367. return s(String.fromCharCode(+y), g, u, h, w);
  1368. case "b":
  1369. return a(y, 2, C, g, u, h, w);
  1370. case "o":
  1371. return a(y, 8, C, g, u, h, w);
  1372. case "x":
  1373. return a(y, 16, C, g, u, h, w);
  1374. case "X":
  1375. return a(y, 16, C, g, u, h, w).toUpperCase();
  1376. case "u":
  1377. return a(y, 10, C, g, u, h, w);
  1378. case "i":
  1379. case "d":
  1380. return m = +y || 0, m = Math.round(m - m % 1), p = 0 > m ? "-" : _, y = p + n(String(Math.abs(m)), h, "0", !1), o(y, p, g, u, w);
  1381. case "e":
  1382. case "E":
  1383. case "f":
  1384. case "F":
  1385. case "g":
  1386. case "G":
  1387. return m = +y, p = 0 > m ? "-" : _, f = ["toExponential", "toFixed", "toPrecision"]["efg".indexOf(d.toLowerCase())], v = ["toString", "toUpperCase"]["eEfFgG".indexOf(d) % 2], y = p + Math.abs(m)[f](h), o(y, p, g, u, w)[v]();
  1388. default:
  1389. return e } }; return i.replace(e, l) } return e }), r("Core/JulianDate", ["./DeveloperError", "./binarySearch", "./defined", "./TimeConstants", "./LeapSecond", "./TimeStandard", "./isLeapYear", "../ThirdParty/sprintf"], function(e, t, r, i, n, o, a, s) { "use strict";
  1390. function l(e) { v.julianDate = e; var r = n.getLeapSeconds(),
  1391. i = t(r, v, n.compareLeapSecondDate);
  1392. 0 > i && (i = ~i), i >= r.length && (i = r.length - 1); var o = r[i].offset; if (i > 0) { var a = e.getSecondsDifference(r[i].julianDate);
  1393. a > o && (i--, o = r[i].offset) } e.addSeconds(o, e) }
  1394. function u(e, r) { v.julianDate = e; var i = n.getLeapSeconds(),
  1395. o = t(i, v, n.compareLeapSecondDate); if (0 > o && (o = ~o), 0 === o) return e.addSeconds(-i[0].offset, r); if (o >= i.length) return e.addSeconds(-i[o - 1].offset, r); var a = e.getSecondsDifference(i[o].julianDate); return 0 === a ? e.addSeconds(-i[o].offset, r) : 1 >= a ? void 0 : e.addSeconds(-i[--o].offset, r) }
  1396. function c(e, t, n) { var a = 0 | t / i.SECONDS_PER_DAY; return e += a, t -= i.SECONDS_PER_DAY * a, 0 > t && (e--, t += i.SECONDS_PER_DAY), r(n) ? (n._julianDayNumber = e, n._secondsOfDay = t, n) : new A(e, t, o.TAI) }
  1397. function h(e, t, r, n, o, a, s) { var l = 0 | (t - 14) / 12,
  1398. u = e + 4800 + l,
  1399. c = (0 | 1461 * u / 4) + (0 | 367 * (t - 2 - 12 * l) / 12) - (0 | 3 * ((u + 100) / 100) / 4) + r - 32075;
  1400. n -= 12, 0 > n && (n += 24); var h = a + (n * i.SECONDS_PER_HOUR + o * i.SECONDS_PER_MINUTE + s * i.SECONDS_PER_MILLISECOND); return h >= 43200 && (c -= 1), [c, h] }
  1401. function d(e) { return h(e.getUTCFullYear(), e.getUTCMonth() + 1, e.getUTCDate(), e.getUTCHours(), e.getUTCMinutes(), e.getUTCSeconds(), e.getUTCMilliseconds()) } var m = function(e, t, r, i, n, o, a, s) { this.year = e, this.month = t, this.day = r, this.hour = i, this.minute = n, this.second = o, this.millisecond = a, this.isLeapSecond = s },
  1402. p = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31],
  1403. f = 29,
  1404. v = { julianDate: void 0 },
  1405. y = /^(\d{4})$/,
  1406. g = /^(\d{4})-(\d{2})$/,
  1407. _ = /^(\d{4})-?(\d{3})$/,
  1408. w = /^(\d{4})-?W(\d{2})-?(\d{1})?$/,
  1409. C = /^(\d{4})-?(\d{2})-?(\d{2})$/,
  1410. x = /([Z+\-])?(\d{2})?:?(\d{2})?$/,
  1411. S = /^(\d{2})(\.\d+)?/.source + x.source,
  1412. E = /^(\d{2}):?(\d{2})(\.\d+)?/.source + x.source,
  1413. b = /^(\d{2}):?(\d{2}):?(\d{2})(\.\d+)?/.source + x.source,
  1414. T = "Valid ISO 8601 date string required.",
  1415. A = function(t, n, a) { this._julianDayNumber = void 0, this._secondsOfDay = void 0; var s, u; if (r(t) || r(n) || r(a)) { if (r(a)) { if (a !== o.UTC && a !== o.TAI) throw new e("timeStandard is not a known TimeStandard.") } else a = o.UTC; if (null === t || isNaN(t)) throw new e("julianDayNumber is required."); if (null === n || isNaN(n)) throw new e("julianSecondsOfDay is required.");
  1416. s = 0 | t, u = n + (t - s) * i.SECONDS_PER_DAY } else { var h = new Date,
  1417. m = d(h);
  1418. s = m[0], u = m[1], a = o.UTC } c(s, u, this), a === o.UTC && l(this) };
  1419. A.clone = function(e, t) { return r(e) ? r(t) ? (t._julianDayNumber = e._julianDayNumber, t._secondsOfDay = e._secondsOfDay, t) : new A(e._julianDayNumber, e._secondsOfDay, o.TAI) : void 0 }, A.fromDate = function(t, r) { if (!(t instanceof Date) || isNaN(t.getTime())) throw new e("date must be a valid JavaScript Date."); var i = d(t); return new A(i[0], i[1], r) }, A.fromIso8601 = function(t) { if ("string" != typeof t) throw new e(T);
  1420. t = t.replace(",", "."); var i, n, s, l = t.split("T"),
  1421. u = 1,
  1422. c = 1,
  1423. d = 0,
  1424. m = 0,
  1425. v = 0,
  1426. x = 0,
  1427. M = l[0],
  1428. P = l[1]; if (!r(M)) throw new e(T); var D; if (l = M.match(C), null !== l) { if (D = M.split("-").length - 1, D > 0 && 2 !== D) throw new e(T);
  1429. i = +l[1], u = +l[2], c = +l[3] } else if (l = M.match(g), null !== l) i = +l[1], u = +l[2];
  1430. else if (l = M.match(y), null !== l) i = +l[1];
  1431. else { var I; if (l = M.match(_), null !== l) { if (i = +l[1], I = +l[2], s = a(i), 1 > I || s && I > 366 || !s && I > 365) throw new e(T) } else { if (l = M.match(w), null === l) throw new e(T);
  1432. i = +l[1]; var O = +l[2],
  1433. R = +l[3] || 0; if (D = M.split("-").length - 1, D > 0 && (!r(l[3]) && 1 !== D || r(l[3]) && 2 !== D)) throw new e(T); var L = new Date(Date.UTC(i, 0, 4));
  1434. I = 7 * O + R - L.getUTCDay() - 3 } n = new Date(Date.UTC(i, 0, 1)), n.setUTCDate(I), u = n.getUTCMonth() + 1, c = n.getUTCDate() } if (s = a(i), 1 > u || u > 12 || 1 > c || (2 !== u || !s) && c > p[u - 1] || s && 2 === u && c > f) throw new e(T); var z; if (r(P)) { if (l = P.match(b), null !== l) { if (D = P.split(":").length - 1, D > 0 && 2 !== D && 3 !== D) throw new e(T);
  1435. d = +l[1], m = +l[2], v = +l[3], x = 1e3 * +(l[4] || 0), z = 5 } else if (l = P.match(E), null !== l) { if (D = P.split(":").length - 1, D > 0 && 1 !== D) throw new e(T);
  1436. d = +l[1], m = +l[2], v = 60 * +(l[3] || 0), z = 4 } else { if (l = P.match(S), null === l) throw new e(T);
  1437. d = +l[1], m = 60 * +(l[2] || 0), z = 3 } if (m >= 60 || v >= 61 || d > 24 || 24 === d && (m > 0 || v > 0 || x > 0)) throw new e(T); var N = l[z],
  1438. F = +l[z + 1],
  1439. B = +(l[z + 2] || 0); switch (N) {
  1440. case "+":
  1441. d -= F, m -= B; break;
  1442. case "-":
  1443. d += F, m += B; break;
  1444. case "Z":
  1445. break;
  1446. default:
  1447. m += new Date(Date.UTC(i, u - 1, c, d, m)).getTimezoneOffset() } } else m += new Date(Date.UTC(i, u - 1, c)).getTimezoneOffset(); var V = 60 === v; for (V && v--; m >= 60;) m -= 60, d++; for (; d >= 24;) d -= 24, c++; for (n = s && 2 === u ? f : p[u - 1]; c > n;) c -= n, u++, u > 12 && (u -= 12, i++), n = s && 2 === u ? f : p[u - 1]; for (; 0 > m;) m += 60, d--; for (; 0 > d;) d += 24, c--; for (; 1 > c;) u--, 1 > u && (u += 12, i--), n = s && 2 === u ? f : p[u - 1], c += n; var q = h(i, u, c, d, m, v, x),
  1448. k = new A(q[0], q[1], o.UTC); return V && k.addSeconds(1, k), k }, A.fromTotalDays = function(t, r) { if (null === t || isNaN(t)) throw new e("totalDays is required."); return new A(t, 0, r) }, A.compare = function(e, t) { var r = e._julianDayNumber - t._julianDayNumber; return 0 !== r ? r : e._secondsOfDay - t._secondsOfDay }, A.equals = function(e, t) { return e === t || r(e) && r(t) && e._julianDayNumber === t._julianDayNumber && e._secondsOfDay === t._secondsOfDay }, A.prototype.clone = function(e) { return A.clone(this, e) }, A.prototype.getTotalDays = function() { return this._julianDayNumber + this._secondsOfDay / i.SECONDS_PER_DAY }, A.prototype.getJulianDayNumber = function() { return this._julianDayNumber }, A.prototype.getJulianTimeFraction = function() { return this._secondsOfDay / i.SECONDS_PER_DAY }, A.prototype.getSecondsOfDay = function() { return this._secondsOfDay }; var M = new A(0, 0, o.TAI); return A.prototype.toGregorianDate = function() { var e = !1,
  1449. t = u(this, M);
  1450. r(t) || (this.addSeconds(-1, M), t = u(M, M), e = !0); var n = t._julianDayNumber,
  1451. o = t._secondsOfDay;
  1452. o >= 43200 && (n += 1); var a = 0 | n + 68569,
  1453. s = 0 | 4 * a / 146097;
  1454. a = 0 | a - (0 | (146097 * s + 3) / 4); var l = 0 | 4e3 * (a + 1) / 1461001;
  1455. a = 0 | a - (0 | 1461 * l / 4) + 31; var c = 0 | 80 * a / 2447,
  1456. h = 0 | a - (0 | 2447 * c / 80);
  1457. a = 0 | c / 11; var d = 0 | c + 2 - 12 * a,
  1458. p = 0 | 100 * (s - 49) + l + a,
  1459. f = 0 | o / i.SECONDS_PER_HOUR,
  1460. v = o - f * i.SECONDS_PER_HOUR,
  1461. y = 0 | v / i.SECONDS_PER_MINUTE;
  1462. v -= y * i.SECONDS_PER_MINUTE; var g = 0 | v,
  1463. _ = (v - g) / i.SECONDS_PER_MILLISECOND; return f += 12, f > 23 && (f -= 24), e && (g += 1), new m(p, d, h, f, y, g, _, e) }, A.prototype.toDate = function() { var e = this.toGregorianDate(),
  1464. t = e.second; return e.isLeapSecond && (t -= 1), new Date(Date.UTC(e.year, e.month - 1, e.day, e.hour, e.minute, t, e.millisecond)) }, A.prototype.toIso8601 = function(e) { var t, i = this.toGregorianDate(); return r(e) || 0 === i.millisecond ? r(e) && 0 !== e ? (t = (.01 * i.millisecond).toFixed(e).replace(".", "").slice(0, e), s("%04d-%02d-%02dT%02d:%02d:%02d.%sZ", i.year, i.month, i.day, i.hour, i.minute, i.second, t)) : s("%04d-%02d-%02dT%02d:%02d:%02dZ", i.year, i.month, i.day, i.hour, i.minute, i.second) : (t = (.01 * i.millisecond).toString().replace(".", ""), s("%04d-%02d-%02dT%02d:%02d:%02d.%sZ", i.year, i.month, i.day, i.hour, i.minute, i.second, t)) }, A.prototype.getSecondsDifference = function(e) { var t = this,
  1465. r = e,
  1466. n = (r._julianDayNumber - t._julianDayNumber) * i.SECONDS_PER_DAY; return n + (r._secondsOfDay - t._secondsOfDay) }, A.prototype.getMinutesDifference = function(e) { return this.getSecondsDifference(e) / i.SECONDS_PER_MINUTE }, A.prototype.getDaysDifference = function(e) { var t = this,
  1467. r = e,
  1468. n = r._julianDayNumber - t._julianDayNumber,
  1469. o = (r._secondsOfDay - t._secondsOfDay) / i.SECONDS_PER_DAY; return n + o }, A.prototype.getTaiMinusUtc = function() { v.julianDate = this; var e = n.getLeapSeconds(),
  1470. r = t(e, v, n.compareLeapSecondDate); return 0 > r && (r = ~r, --r, 0 > r && (r = 0)), e[r].offset }, A.prototype.addSeconds = function(t, r) { if (null === t || isNaN(t)) throw new e("seconds is required and must be a number."); return c(this._julianDayNumber, this._secondsOfDay + t, r) }, A.prototype.addMinutes = function(t) { if (null === t || isNaN(t)) throw new e("duration is required and must be a number."); var r = this._secondsOfDay + t * i.SECONDS_PER_MINUTE; return new A(this._julianDayNumber, r, o.TAI) }, A.prototype.addHours = function(t) { if (null === t || isNaN(t)) throw new e("duration is required and must be a number."); var r = this._secondsOfDay + t * i.SECONDS_PER_HOUR; return new A(this._julianDayNumber, r, o.TAI) }, A.prototype.addDays = function(t) { if (null === t || isNaN(t)) throw new e("duration is required and must be a number."); var r = this._julianDayNumber + t; return new A(r, this._secondsOfDay, o.TAI) }, A.prototype.lessThan = function(e) { return A.compare(this, e) < 0 }, A.prototype.lessThanOrEquals = function(e) { return A.compare(this, e) <= 0 }, A.prototype.greaterThan = function(e) { return A.compare(this, e) > 0 }, A.prototype.greaterThanOrEquals = function(e) { return A.compare(this, e) >= 0 }, A.prototype.compareTo = function(e) { return A.compare(this, e) }, A.prototype.equals = function(e) { return A.equals(this, e) }, A.prototype.equalsEpsilon = function(t, r) { if (null === r || isNaN(r)) throw new e("epsilon is required and must be number."); return Math.abs(this.getSecondsDifference(t)) <= r }, 0 === n._leapSeconds.length && (n._leapSeconds = [new n(new A(2441317, 43210, o.TAI), 10), new n(new A(2441499, 43211, o.TAI), 11), new n(new A(2441683, 43212, o.TAI), 12), new n(new A(2442048, 43213, o.TAI), 13), new n(new A(2442413, 43214, o.TAI), 14), new n(new A(2442778, 43215, o.TAI), 15), new n(new A(2443144, 43216, o.TAI), 16), new n(new A(2443509, 43217, o.TAI), 17), new n(new A(2443874, 43218, o.TAI), 18), new n(new A(2444239, 43219, o.TAI), 19), new n(new A(2444786, 43220, o.TAI), 20), new n(new A(2445151, 43221, o.TAI), 21), new n(new A(2445516, 43222, o.TAI), 22), new n(new A(2446247, 43223, o.TAI), 23), new n(new A(2447161, 43224, o.TAI), 24), new n(new A(2447892, 43225, o.TAI), 25), new n(new A(2448257, 43226, o.TAI), 26), new n(new A(2448804, 43227, o.TAI), 27), new n(new A(2449169, 43228, o.TAI), 28), new n(new A(2449534, 43229, o.TAI), 29), new n(new A(2450083, 43230, o.TAI), 30), new n(new A(2450630, 43231, o.TAI), 31), new n(new A(2451179, 43232, o.TAI), 32), new n(new A(2453736, 43233, o.TAI), 33), new n(new A(2454832, 43234, o.TAI), 34), new n(new A(2456109, 43235, o.TAI), 35)]), A }), r("Core/ClockStep", ["./Enumeration"], function(e) { "use strict"; var t = { TICK_DEPENDENT: new e(0, "TICK_DEPENDENT"), SYSTEM_CLOCK_MULTIPLIER: new e(1, "SYSTEM_CLOCK_MULTIPLIER"), SYSTEM_CLOCK: new e(2, "SYSTEM_CLOCK") }; return t }), r("Core/ClockRange", ["./Enumeration"], function(e) { "use strict"; var t = { UNBOUNDED: new e(0, "UNBOUNDED"), CLAMPED: new e(1, "CLAMPED"), LOOP_STOP: new e(2, "LOOP_STOP") }; return t }), r("Core/Event", ["./DeveloperError"], function(e) { "use strict"; var t = function() { this._listeners = [], this._scopes = [] }; return t.prototype.getNumberOfListeners = function() { return this._listeners.length }, t.prototype.addEventListener = function(t, r) { if ("function" != typeof t) throw new e("listener is required and must be a function.");
  1471. this._listeners.push(t), this._scopes.push(r); var i = this; return function() { i.removeEventListener(t, r) } }, t.prototype.removeEventListener = function(t, r) { if ("function" != typeof t) throw new e("listener is required and must be a function."); for (var i = this._listeners, n = this._scopes, o = -1, a = 0; a < i.length; a++)
  1472. if (i[a] === t && n[a] === r) { o = a; break }
  1473. if (-1 === o) throw new e("listener is not subscribed.");
  1474. i.splice(o, 1), this._scopes.splice(o, 1) }, t.prototype.raiseEvent = function() { for (var e = this._listeners, t = this._scopes, r = e.length - 1; r > -1; r--) e[r].apply(t[r], arguments) }, t }), r("Core/Clock", ["./defined", "./DeveloperError", "./JulianDate", "./ClockStep", "./ClockRange", "./Event", "./defaultValue"], function(e, t, r, i, n, o, a) { "use strict"; var s = function(s) { s = a(s, a.EMPTY_OBJECT); var l = s.startTime,
  1475. u = !e(l),
  1476. c = s.stopTime,
  1477. h = !e(c),
  1478. d = s.currentTime,
  1479. m = !e(d); if (u && h && m ? (d = new r, l = d.clone(), c = d.addDays(1)) : u && h ? (l = d.clone(), c = d.addDays(1)) : u && m ? (l = c.addDays(-1), d = l.clone()) : m && h ? (d = l.clone(), c = l.addDays(1)) : m ? d = l.clone() : h ? c = d.addDays(1) : u && (l = d.clone()), l.greaterThan(c)) throw new t("startTime must come before stopTime.");
  1480. this.startTime = l, this.stopTime = c, this.currentTime = d, this.multiplier = a(s.multiplier, 1), this.clockStep = a(s.clockStep, i.SYSTEM_CLOCK_MULTIPLIER), this.clockRange = a(s.clockRange, n.UNBOUNDED), this.shouldAnimate = a(s.shouldAnimate, !0), this.onTick = new o, this._lastSystemTime = Date.now() }; return s.prototype.tick = function() { var e = Date.now(),
  1481. t = this.currentTime,
  1482. o = this.startTime,
  1483. a = this.stopTime,
  1484. s = this.multiplier; if (this.shouldAnimate)
  1485. if (this.clockStep === i.SYSTEM_CLOCK) t = new r;
  1486. else { if (this.clockStep === i.TICK_DEPENDENT) t = t.addSeconds(s);
  1487. else { var l = e - this._lastSystemTime;
  1488. t = t.addSeconds(s * (l / 1e3)) } if (this.clockRange === n.CLAMPED) t.lessThan(o) ? t = o : t.greaterThan(a) && (t = a);
  1489. else if (this.clockRange === n.LOOP_STOP)
  1490. for (t.lessThan(o) && (t = o.clone()); t.greaterThan(a);) t = o.addSeconds(a.getSecondsDifference(t)) }
  1491. return this.currentTime = t, this._lastSystemTime = e, this.onTick.raiseEvent(this), t }, s }), r("Core/Color", ["./defaultValue", "./defined", "./freezeObject", "./DeveloperError", "./FeatureDetection", "./Math"], function(e, t, r, i, n, o) {
  1492. "use strict";
  1493. function a(e, t, r) { return 0 > r && (r += 1), r > 1 && (r -= 1), 1 > 6 * r ? e + 6 * (t - e) * r : 1 > 2 * r ? t : 2 > 3 * r ? e + 6 * (t - e) * (2 / 3 - r) : e }
  1494. var s = function(t, r, i, n) { this.red = e(t, 1), this.green = e(r, 1), this.blue = e(i, 1), this.alpha = e(n, 1) };
  1495. s.fromBytes = function(t, r, i, n) { return t = s.byteToFloat(e(t, 255)), r = s.byteToFloat(e(r, 255)), i = s.byteToFloat(e(i, 255)), n = s.byteToFloat(e(n, 255)), new s(t, r, i, n) };
  1496. var l, u, c;
  1497. n.supportsTypedArrays() && (l = new ArrayBuffer(4), u = new Uint32Array(l), c = new Uint8Array(l)), s.fromRgba = function(e) { return u[0] = e, s.fromBytes(c[0], c[1], c[2], c[3]) }, s.fromHsl = function(t, r, i, n) { t = e(t, 0) % 1, r = e(r, 0), i = e(i, 0), n = e(n, 1); var o = i,
  1498. l = i,
  1499. u = i; if (0 !== r) { var c;
  1500. c = .5 > i ? i * (1 + r) : i + r - i * r; var h = 2 * i - c;
  1501. o = a(h, c, t + 1 / 3), l = a(h, c, t), u = a(h, c, t - 1 / 3) } return new s(o, l, u, n) }, s.fromRandom = function(r, n) {
  1502. r = e(r, e.EMPTY_OBJECT);
  1503. var a = r.red;
  1504. if (!t(a)) { var l = e(r.minimumRed, 0),
  1505. u = e(r.maximumRed, 1); if (l > u) throw new i("minimumRed must be less than or equal to maximumRed");
  1506. a = l + o.nextRandomNumber() * (u - l) }
  1507. var c = r.green;
  1508. if (!t(c)) { var h = e(r.minimumGreen, 0),
  1509. d = e(r.maximumGreen, 1); if (h > d) throw new i("minimumGreen must be less than or equal to maximumGreen");
  1510. c = h + o.nextRandomNumber() * (d - h) }
  1511. var m = r.blue;
  1512. if (!t(m)) {
  1513. var p = e(r.minimumBlue, 0),
  1514. f = e(r.maximumBlue, 1);
  1515. if (p > f) throw new i("minimumBlue must be less than or equal to maximumBlue");
  1516. m = p + o.nextRandomNumber() * (f - p)
  1517. }
  1518. var v = r.alpha;
  1519. if (!t(v)) { var y = e(r.minimumAlpha, 0),
  1520. g = e(r.maximumAlpha, 1); if (y > g) throw new i("minimumAlpha must be less than or equal to maximumAlpha");
  1521. v = y + o.nextRandomNumber() * (g - y) }
  1522. return t(n) ? (n.red = a, n.green = c, n.blue = m, n.alpha = v, n) : new s(a, c, m, v)
  1523. };
  1524. var h = /^#([0-9a-f])([0-9a-f])([0-9a-f])$/i,
  1525. d = /^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i,
  1526. m = /^rgba?\(\s*([0-9.]+%?)\s*,\s*([0-9.]+%?)\s*,\s*([0-9.]+%?)(?:\s*,\s*([0-9.]+))?\s*\)$/i,
  1527. p = /^hsla?\(\s*([0-9.]+)\s*,\s*([0-9.]+%)\s*,\s*([0-9.]+%)(?:\s*,\s*([0-9.]+))?\s*\)$/i;
  1528. return s.fromCssColorString = function(r) { if (!t(r)) throw new i("color is required"); var n = s[r.toUpperCase()]; if (t(n)) return n.clone(); var o = h.exec(r); return null !== o ? new s(parseInt(o[1], 16) / 15, parseInt(o[2], 16) / 15, parseInt(o[3], 16) / 15) : (o = d.exec(r), null !== o ? new s(parseInt(o[1], 16) / 255, parseInt(o[2], 16) / 255, parseInt(o[3], 16) / 255) : (o = m.exec(r), null !== o ? new s(parseFloat(o[1]) / ("%" === o[1].substr(-1) ? 100 : 255), parseFloat(o[2]) / ("%" === o[2].substr(-1) ? 100 : 255), parseFloat(o[3]) / ("%" === o[3].substr(-1) ? 100 : 255), parseFloat(e(o[4], "1.0"))) : (o = p.exec(r), null !== o ? s.fromHsl(parseFloat(o[1]) / 360, parseFloat(o[2]) / 100, parseFloat(o[3]) / 100, parseFloat(e(o[4], "1.0"))) : void 0))) }, s.packedLength = 4, s.pack = function(r, n, o) { if (!t(r)) throw new i("value is required"); if (!t(n)) throw new i("array is required");
  1529. o = e(o, 0), n[o++] = r.red, n[o++] = r.green, n[o++] = r.blue, n[o] = r.alpha }, s.unpack = function(r, n, o) { if (!t(r)) throw new i("array is required"); return n = e(n, 0), t(o) || (o = new s), o.red = r[n++], o.green = r[n++], o.blue = r[n++], o.alpha = r[n], o }, s.byteToFloat = function(e) { return e / 255 }, s.floatToByte = function(e) { return 1 === e ? 255 : 0 | 256 * e }, s.clone = function(e, r) { return t(e) ? t(r) ? (r.red = e.red, r.green = e.green, r.blue = e.blue, r.alpha = e.alpha, r) : new s(e.red, e.green, e.blue, e.alpha) : void 0 }, s.equals = function(e, r) { return e === r || t(e) && t(r) && e.red === r.red && e.green === r.green && e.blue === r.blue && e.alpha === r.alpha }, s.prototype.clone = function(e) { return s.clone(this, e) }, s.prototype.equals = function(e) { return s.equals(this, e) }, s.prototype.equalsEpsilon = function(e, r) { return this === e || t(e) && Math.abs(this.red - e.red) <= r && Math.abs(this.green - e.green) <= r && Math.abs(this.blue - e.blue) <= r && Math.abs(this.alpha - e.alpha) <= r }, s.prototype.toString = function() { return "(" + this.red + ", " + this.green + ", " + this.blue + ", " + this.alpha + ")" }, s.prototype.toCssColorString = function() { var e = s.floatToByte(this.red),
  1530. t = s.floatToByte(this.green),
  1531. r = s.floatToByte(this.blue); return 1 === this.alpha ? "rgb(" + e + "," + t + "," + r + ")" : "rgba(" + e + "," + t + "," + r + "," + this.alpha + ")" }, s.prototype.toBytes = function() { var e = s.floatToByte(this.red),
  1532. t = s.floatToByte(this.green),
  1533. r = s.floatToByte(this.blue),
  1534. i = s.floatToByte(this.alpha); return [e, t, r, i] }, s.prototype.toRgba = function() { return c[0] = s.floatToByte(this.red), c[1] = s.floatToByte(this.green), c[2] = s.floatToByte(this.blue), c[3] = s.floatToByte(this.alpha), u[0] }, s.ALICEBLUE = r(s.fromCssColorString("#F0F8FF")), s.ANTIQUEWHITE = r(s.fromCssColorString("#FAEBD7")), s.AQUA = r(s.fromCssColorString("#00FFFF")), s.AQUAMARINE = r(s.fromCssColorString("#7FFFD4")), s.AZURE = r(s.fromCssColorString("#F0FFFF")), s.BEIGE = r(s.fromCssColorString("#F5F5DC")), s.BISQUE = r(s.fromCssColorString("#FFE4C4")), s.BLACK = r(s.fromCssColorString("#000000")), s.BLANCHEDALMOND = r(s.fromCssColorString("#FFEBCD")), s.BLUE = r(s.fromCssColorString("#0000FF")), s.BLUEVIOLET = r(s.fromCssColorString("#8A2BE2")), s.BROWN = r(s.fromCssColorString("#A52A2A")), s.BURLYWOOD = r(s.fromCssColorString("#DEB887")), s.CADETBLUE = r(s.fromCssColorString("#5F9EA0")), s.CHARTREUSE = r(s.fromCssColorString("#7FFF00")), s.CHOCOLATE = r(s.fromCssColorString("#D2691E")), s.CORAL = r(s.fromCssColorString("#FF7F50")), s.CORNFLOWERBLUE = r(s.fromCssColorString("#6495ED")), s.CORNSILK = r(s.fromCssColorString("#FFF8DC")), s.CRIMSON = r(s.fromCssColorString("#DC143C")), s.CYAN = r(s.fromCssColorString("#00FFFF")), s.DARKBLUE = r(s.fromCssColorString("#00008B")), s.DARKCYAN = r(s.fromCssColorString("#008B8B")), s.DARKGOLDENROD = r(s.fromCssColorString("#B8860B")), s.DARKGRAY = r(s.fromCssColorString("#A9A9A9")), s.DARKGREEN = r(s.fromCssColorString("#006400")), s.DARKGREY = s.DARKGRAY, s.DARKKHAKI = r(s.fromCssColorString("#BDB76B")), s.DARKMAGENTA = r(s.fromCssColorString("#8B008B")), s.DARKOLIVEGREEN = r(s.fromCssColorString("#556B2F")), s.DARKORANGE = r(s.fromCssColorString("#FF8C00")), s.DARKORCHID = r(s.fromCssColorString("#9932CC")), s.DARKRED = r(s.fromCssColorString("#8B0000")), s.DARKSALMON = r(s.fromCssColorString("#E9967A")), s.DARKSEAGREEN = r(s.fromCssColorString("#8FBC8F")), s.DARKSLATEBLUE = r(s.fromCssColorString("#483D8B")), s.DARKSLATEGRAY = r(s.fromCssColorString("#2F4F4F")), s.DARKSLATEGREY = s.DARKSLATEGRAY, s.DARKTURQUOISE = r(s.fromCssColorString("#00CED1")), s.DARKVIOLET = r(s.fromCssColorString("#9400D3")), s.DEEPPINK = r(s.fromCssColorString("#FF1493")), s.DEEPSKYBLUE = r(s.fromCssColorString("#00BFFF")), s.DIMGRAY = r(s.fromCssColorString("#696969")), s.DIMGREY = s.DIMGRAY, s.DODGERBLUE = r(s.fromCssColorString("#1E90FF")), s.FIREBRICK = r(s.fromCssColorString("#B22222")), s.FLORALWHITE = r(s.fromCssColorString("#FFFAF0")), s.FORESTGREEN = r(s.fromCssColorString("#228B22")), s.FUSCHIA = r(s.fromCssColorString("#FF00FF")), s.GAINSBORO = r(s.fromCssColorString("#DCDCDC")), s.GHOSTWHITE = r(s.fromCssColorString("#F8F8FF")), s.GOLD = r(s.fromCssColorString("#FFD700")), s.GOLDENROD = r(s.fromCssColorString("#DAA520")), s.GRAY = r(s.fromCssColorString("#808080")), s.GREEN = r(s.fromCssColorString("#008000")), s.GREENYELLOW = r(s.fromCssColorString("#ADFF2F")), s.GREY = s.GRAY, s.HONEYDEW = r(s.fromCssColorString("#F0FFF0")), s.HOTPINK = r(s.fromCssColorString("#FF69B4")), s.INDIANRED = r(s.fromCssColorString("#CD5C5C")), s.INDIGO = r(s.fromCssColorString("#4B0082")), s.IVORY = r(s.fromCssColorString("#FFFFF0")), s.KHAKI = r(s.fromCssColorString("#F0E68C")), s.LAVENDER = r(s.fromCssColorString("#E6E6FA")), s.LAVENDAR_BLUSH = r(s.fromCssColorString("#FFF0F5")), s.LAWNGREEN = r(s.fromCssColorString("#7CFC00")), s.LEMONCHIFFON = r(s.fromCssColorString("#FFFACD")), s.LIGHTBLUE = r(s.fromCssColorString("#ADD8E6")), s.LIGHTCORAL = r(s.fromCssColorString("#F08080")), s.LIGHTCYAN = r(s.fromCssColorString("#E0FFFF")), s.LIGHTGOLDENRODYELLOW = r(s.fromCssColorString("#FAFAD2")), s.LIGHTGRAY = r(s.fromCssColorString("#D3D3D3")), s.LIGHTGREEN = r(s.fromCssColorString("#90EE90")), s.LIGHTGREY = s.LIGHTGRAY, s.LIGHTPINK = r(s.fromCssColorString("#FFB6C1")), s.LIGHTSEAGREEN = r(s.fromCssColorString("#20B2AA")), s.LIGHTSKYBLUE = r(s.fromCssColorString("#87CEFA")), s.LIGHTSLATEGRAY = r(s.fromCssColorString("#778899")), s.LIGHTSLATEGREY = s.LIGHTSLATEGRAY, s.LIGHTSTEELBLUE = r(s.fromCssColorString("#B0C4DE")), s.LIGHTYELLOW = r(s.fromCssColorString("#FFFFE0")), s.LIME = r(s.fromCssColorString("#00FF00")), s.LIMEGREEN = r(s.fromCssColorString("#32CD32")), s.LINEN = r(s.fromCssColorString("#FAF0E6")), s.MAGENTA = r(s.fromCssColorString("#FF00FF")), s.MAROON = r(s.fromCssColorString("#800000")), s.MEDIUMAQUAMARINE = r(s.fromCssColorString("#66CDAA")), s.MEDIUMBLUE = r(s.fromCssColorString("#0000CD")), s.MEDIUMORCHID = r(s.fromCssColorString("#BA55D3")), s.MEDIUMPURPLE = r(s.fromCssColorString("#9370DB")), s.MEDIUMSEAGREEN = r(s.fromCssColorString("#3CB371")), s.MEDIUMSLATEBLUE = r(s.fromCssColorString("#7B68EE")), s.MEDIUMSPRINGGREEN = r(s.fromCssColorString("#00FA9A")), s.MEDIUMTURQUOISE = r(s.fromCssColorString("#48D1CC")), s.MEDIUMVIOLETRED = r(s.fromCssColorString("#C71585")), s.MIDNIGHTBLUE = r(s.fromCssColorString("#191970")), s.MINTCREAM = r(s.fromCssColorString("#F5FFFA")), s.MISTYROSE = r(s.fromCssColorString("#FFE4E1")), s.MOCCASIN = r(s.fromCssColorString("#FFE4B5")), s.NAVAJOWHITE = r(s.fromCssColorString("#FFDEAD")), s.NAVY = r(s.fromCssColorString("#000080")), s.OLDLACE = r(s.fromCssColorString("#FDF5E6")), s.OLIVE = r(s.fromCssColorString("#808000")), s.OLIVEDRAB = r(s.fromCssColorString("#6B8E23")), s.ORANGE = r(s.fromCssColorString("#FFA500")), s.ORANGERED = r(s.fromCssColorString("#FF4500")), s.ORCHID = r(s.fromCssColorString("#DA70D6")), s.PALEGOLDENROD = r(s.fromCssColorString("#EEE8AA")), s.PALEGREEN = r(s.fromCssColorString("#98FB98")), s.PALETURQUOISE = r(s.fromCssColorString("#AFEEEE")), s.PALEVIOLETRED = r(s.fromCssColorString("#DB7093")), s.PAPAYAWHIP = r(s.fromCssColorString("#FFEFD5")), s.PEACHPUFF = r(s.fromCssColorString("#FFDAB9")), s.PERU = r(s.fromCssColorString("#CD853F")), s.PINK = r(s.fromCssColorString("#FFC0CB")), s.PLUM = r(s.fromCssColorString("#DDA0DD")), s.POWDERBLUE = r(s.fromCssColorString("#B0E0E6")), s.PURPLE = r(s.fromCssColorString("#800080")), s.RED = r(s.fromCssColorString("#FF0000")), s.ROSYBROWN = r(s.fromCssColorString("#BC8F8F")), s.ROYALBLUE = r(s.fromCssColorString("#4169E1")), s.SADDLEBROWN = r(s.fromCssColorString("#8B4513")), s.SALMON = r(s.fromCssColorString("#FA8072")), s.SANDYBROWN = r(s.fromCssColorString("#F4A460")), s.SEAGREEN = r(s.fromCssColorString("#2E8B57")), s.SEASHELL = r(s.fromCssColorString("#FFF5EE")), s.SIENNA = r(s.fromCssColorString("#A0522D")), s.SILVER = r(s.fromCssColorString("#C0C0C0")), s.SKYBLUE = r(s.fromCssColorString("#87CEEB")), s.SLATEBLUE = r(s.fromCssColorString("#6A5ACD")), s.SLATEGRAY = r(s.fromCssColorString("#708090")), s.SLATEGREY = s.SLATEGRAY, s.SNOW = r(s.fromCssColorString("#FFFAFA")), s.SPRINGGREEN = r(s.fromCssColorString("#00FF7F")), s.STEELBLUE = r(s.fromCssColorString("#4682B4")), s.TAN = r(s.fromCssColorString("#D2B48C")), s.TEAL = r(s.fromCssColorString("#008080")), s.THISTLE = r(s.fromCssColorString("#D8BFD8")), s.TOMATO = r(s.fromCssColorString("#FF6347")), s.TURQUOISE = r(s.fromCssColorString("#40E0D0")), s.VIOLET = r(s.fromCssColorString("#EE82EE")), s.WHEAT = r(s.fromCssColorString("#F5DEB3")), s.WHITE = r(s.fromCssColorString("#FFFFFF")), s.WHITESMOKE = r(s.fromCssColorString("#F5F5F5")), s.YELLOW = r(s.fromCssColorString("#FFFF00")), s.YELLOWGREEN = r(s.fromCssColorString("#9ACD32")), s
  1535. }), r("Core/ColorGeometryInstanceAttribute", ["./defaultValue", "./defined", "./Color", "./ComponentDatatype", "./DeveloperError"], function(e, t, r, i, n) { "use strict"; var o = function(t, n, o, a) { t = e(t, 1), n = e(n, 1), o = e(o, 1), a = e(a, 1), this.componentDatatype = i.UNSIGNED_BYTE, this.componentsPerAttribute = 4, this.normalize = !0, this.value = new Uint8Array([r.floatToByte(t), r.floatToByte(n), r.floatToByte(o), r.floatToByte(a)]) }; return o.fromColor = function(e) { if (!t(e)) throw new n("color is required."); return new o(e.red, e.green, e.blue, e.alpha) }, o.toValue = function(e) { if (!t(e)) throw new n("color is required."); return new Uint8Array(e.toBytes()) }, o }), r("Core/CornerType", ["../Core/Enumeration"], function(e) { "use strict"; var t = { ROUNDED: new e(0, "ROUNDED"), MITERED: new e(1, "MITERED"), BEVELED: new e(2, "BEVELED") }; return t }), r("ThirdParty/Uri", [], function() {
  1536. function e(t) { if (t instanceof e) this.scheme = t.scheme, this.authority = t.authority, this.path = t.path, this.query = t.query, this.fragment = t.fragment;
  1537. else if (t) { var r = i.exec(t);
  1538. this.scheme = r[1], this.authority = r[2], this.path = r[3], this.query = r[4], this.fragment = r[5] } }
  1539. function t(e) { var t = unescape(e); return o.test(t) ? t : e.toUpperCase() }
  1540. function r(e, t, r, i) { return (t || "") + r.toLowerCase() + (i || "") } e.prototype.scheme = null, e.prototype.authority = null, e.prototype.path = "", e.prototype.query = null, e.prototype.fragment = null; var i = new RegExp("^(?:([^:/?#]+):)?(?://([^/?#]*))?([^?#]*)(?:\\?([^#]*))?(?:#(.*))?$");
  1541. e.prototype.getScheme = function() { return this.scheme }, e.prototype.getAuthority = function() { return this.authority }, e.prototype.getPath = function() { return this.path }, e.prototype.getQuery = function() { return this.query }, e.prototype.getFragment = function() { return this.fragment }, e.prototype.isAbsolute = function() { return !!this.scheme && !this.fragment }, e.prototype.isSameDocumentAs = function(e) { return e.scheme == this.scheme && e.authority == this.authority && e.path == this.path && e.query == this.query }, e.prototype.equals = function(e) { return this.isSameDocumentAs(e) && e.fragment == this.fragment }, e.prototype.normalize = function() { this.removeDotSegments(), this.scheme && (this.scheme = this.scheme.toLowerCase()), this.authority && (this.authority = this.authority.replace(a, r).replace(n, t)), this.path && (this.path = this.path.replace(n, t)), this.query && (this.query = this.query.replace(n, t)), this.fragment && (this.fragment = this.fragment.replace(n, t)) }; var n = /%[0-9a-z]{2}/gi,
  1542. o = /[a-zA-Z0-9\-\._~]/,
  1543. a = /(.*@)?([^@:]*)(:.*)?/;
  1544. e.prototype.resolve = function(t) { var r = new e; return this.scheme ? (r.scheme = this.scheme, r.authority = this.authority, r.path = this.path, r.query = this.query) : (r.scheme = t.scheme, this.authority ? (r.authority = this.authority, r.path = this.path, r.query = this.query) : (r.authority = t.authority, "" == this.path ? (r.path = t.path, r.query = this.query || t.query) : ("/" == this.path.charAt(0) ? (r.path = this.path, r.removeDotSegments()) : (r.path = t.authority && "" == t.path ? "/" + this.path : t.path.substring(0, t.path.lastIndexOf("/") + 1) + this.path, r.removeDotSegments()), r.query = this.query))), r.fragment = this.fragment, r }, e.prototype.removeDotSegments = function() { var e, t = this.path.split("/"),
  1545. r = [],
  1546. i = "" == t[0]; for (i && t.shift(), "" == t[0] ? t.shift() : null; t.length;) e = t.shift(), ".." == e ? r.pop() : "." != e && r.push(e);
  1547. ("." == e || ".." == e) && r.push(""), i && r.unshift(""), this.path = r.join("/") }, e.resolve = function(t, r) { var i = s[t] || (s[t] = new e(t)),
  1548. n = s[r] || (s[r] = new e(r)); return i.resolve(n).toString() }; var s = {}; return e.prototype.toString = function() { var e = ""; return this.scheme && (e += this.scheme + ":"), this.authority && (e += "//" + this.authority), e += this.path, this.query && (e += "?" + this.query), this.fragment && (e += "#" + this.fragment), e }, e }), r("Core/buildModuleUrl", ["require", "./defined", "./DeveloperError", "../ThirdParty/Uri"], function(e, t, r, i) { "use strict";
  1549. function n() { for (var e = document.getElementsByTagName("script"), t = 0, r = e.length; r > t; ++t) { var i = e[t].getAttribute("src"),
  1550. n = h.exec(i); if (null !== n) return n[1] } return void 0 }
  1551. function o() { if (t(l)) return l; var e; if (e = "undefined" != typeof CESIUM_BASE_URL ? CESIUM_BASE_URL : n(), !t(e)) throw new r("Unable to determine isatCesium base URL automatically, try defining a global variable called CESIUM_BASE_URL."); return l = new i(e).resolve(new i(document.location.href)) }
  1552. function a(t) { return e.toUrl("../" + t) }
  1553. function s(e) { return new i(e).resolve(o()).toString() } var l, u, c, h = /((?:.*\/)|^)cesium[\w-]*\.js(?:\W|$)/i,
  1554. d = function(r) { t(u) || (u = t(e.toUrl) ? a : s), t(c) || (c = document.createElement("a")); var i = u(r); return c.href = i, c.href = c.href, c.href }; return d._cesiumScriptRegex = h, d }), r("Core/Iau2006XysSample", [], function() { "use strict"; var e = function(e, t, r) { this.x = e, this.y = t, this.s = r }; return e }), r("Core/clone", ["./defaultValue"], function(e) { "use strict"; var t = function(r, i) { if (null === r || "object" != typeof r) return r;
  1555. i = e(i, !1); var n = new r.constructor; for (var o in r)
  1556. if (r.hasOwnProperty(o)) { var a = r[o];
  1557. i && (a = t(a, i)), n[o] = a }
  1558. return n }; return t }), r("Core/RequestErrorEvent", ["./defined"], function(e) { "use strict"; var t = function(e, t) { this.statusCode = e, this.response = t }; return t.prototype.toString = function() { var t = "Request has failed."; return e(this.statusCode) && (t += " Status Code: " + this.statusCode), t }, t }),
  1559. function(e) { "use strict";
  1560. e("ThirdParty/when", [], function() {
  1561. function e(e, r, i, n) { return t(e).then(r, i, n) }
  1562. function t(e) { var t, r; return e instanceof i ? t = e : s(e) ? (r = a(), e.then(function(e) { r.resolve(e) }, function(e) { r.reject(e) }, function(e) { r.progress(e) }), t = r.promise) : t = n(e), t }
  1563. function r(t) { return e(t, o) }
  1564. function i(e) { this.then = e }
  1565. function n(e) { var r = new i(function(r) { try { return t(r ? r(e) : e) } catch (i) { return o(i) } }); return r }
  1566. function o(e) { var r = new i(function(r, i) { try { return i ? t(i(e)) : o(e) } catch (n) { return o(n) } }); return r }
  1567. function a() {
  1568. function e(e, t, r) { return d(e, t, r) }
  1569. function r(e) { return p(e) }
  1570. function n(e) { return p(o(e)) }
  1571. function s(e) { return m(e) } var l, u, c, h, d, m, p; return u = new i(e), l = { then: e, resolve: r, reject: n, progress: s, promise: u, resolver: { resolve: r, reject: n, progress: s } }, c = [], h = [], d = function(e, t, r) { var i, n; return i = a(), n = "function" == typeof r ? function(e) { try { i.progress(r(e)) } catch (t) { i.progress(t) } } : function(e) { i.progress(e) }, c.push(function(r) { r.then(e, t).then(i.resolve, i.reject, n) }), h.push(n), i.promise }, m = function(e) { return f(h, e), e }, p = function(e) { return e = t(e), d = e.then, p = t, m = y, f(c, e), h = c = C, e }, l }
  1572. function s(e) { return e && "function" == typeof e.then }
  1573. function l(t, r, i, n, o) { return v(2, arguments), e(t, function(t) {
  1574. function s(e) { f(e) }
  1575. function l(e) { p(e) } var u, c, h, d, m, p, f, v, g, _; if (g = t.length >>> 0, u = Math.max(0, Math.min(r, g)), h = [], c = g - u + 1, d = [], m = a(), u)
  1576. for (v = m.progress, f = function(e) { d.push(e), --c || (p = f = y, m.reject(d)) }, p = function(e) { h.push(e), --u || (p = f = y, m.resolve(h)) }, _ = 0; g > _; ++_) _ in t && e(t[_], l, s, v);
  1577. else m.resolve(h); return m.then(i, n, o) }) }
  1578. function u(e, t, r, i) {
  1579. function n(e) { return t ? t(e[0]) : e[0] } return l(e, 1, n, r, i) }
  1580. function c(e, t, r, i) { return v(1, arguments), d(e, g).then(t, r, i) }
  1581. function h() { return d(arguments, g) }
  1582. function d(t, r) { return e(t, function(t) { var i, n, o, s, l, u; if (o = n = t.length >>> 0, i = [], u = a(), o)
  1583. for (s = function(t, n) { e(t, r).then(function(e) { i[n] = e, --o || u.resolve(i) }, u.reject) }, l = 0; n > l; l++) l in t ? s(t[l], l) : --o;
  1584. else u.resolve(i); return u.promise }) }
  1585. function m(t, r) { var i = w.call(arguments, 1); return e(t, function(t) { var n; return n = t.length, i[0] = function(t, i, o) { return e(t, function(t) { return e(i, function(e) { return r(t, e, o, n) }) }) }, _.apply(t, i) }) }
  1586. function p(t, r, i) { var n = arguments.length > 2; return e(t, function(e) { return e = n ? i : e, r.resolve(e), e }, function(e) { return r.reject(e), o(e) }, r.progress) }
  1587. function f(e, t) { for (var r, i = 0; r = e[i++];) r(t) }
  1588. function v(e, t) { for (var r, i = t.length; i > e;)
  1589. if (r = t[--i], null != r && "function" != typeof r) throw new Error("arg " + i + " must be a function") }
  1590. function y() {}
  1591. function g(e) { return e } var _, w, C; return e.defer = a, e.resolve = t, e.reject = r, e.join = h, e.all = c, e.map = d, e.reduce = m, e.any = u, e.some = l, e.chain = p, e.isPromise = s, i.prototype = { always: function(e, t) { return this.then(e, e, t) }, otherwise: function(e) { return this.then(C, e) }, yield: function(e) { return this.then(function() { return e }) }, spread: function(e) { return this.then(function(t) { return c(t, function(t) { return e.apply(C, t) }) }) } }, w = [].slice, _ = [].reduce || function(e) { var t, r, i, n, o; if (o = 0, t = Object(this), n = t.length >>> 0, r = arguments, r.length <= 1)
  1592. for (;;) { if (o in t) { i = t[o++]; break } if (++o >= n) throw new TypeError } else i = r[1]; for (; n > o; ++o) o in t && (i = e(i, t[o], o, t)); return i }, e }) }("function" == typeof r && r.amd ? r : function(e) { "object" == typeof exports ? module.exports = e() : this.when = e() }), r("Core/loadWithXhr", ["./defined", "./DeveloperError", "./RequestErrorEvent", "../ThirdParty/when"], function(e, t, r, i) { "use strict"; var n = function(r, o, a) { if (!e(r)) throw new t("url is required."); return i(r, function(e) { var t = i.defer(); return n.load(e, o, a, t), t.promise }) }; return n.load = function(t, i, n, o) { var a = new XMLHttpRequest; if (a.open("GET", t, !0), e(n))
  1593. for (var s in n) n.hasOwnProperty(s) && a.setRequestHeader(s, n[s]);
  1594. e(i) && (a.responseType = i), a.onload = function() { 200 === a.status ? o.resolve(a.response) : o.reject(new r(a.status, a.response)) }, a.onerror = function() { o.reject(new r) }, a.send() }, n.defaultLoad = n.load, n }), r("Core/loadText", ["./loadWithXhr"], function(e) { "use strict"; var t = function(t, r) { return e(t, void 0, r) }; return t }), r("Core/loadJson", ["./clone", "./defined", "./loadText", "./DeveloperError"], function(e, t, r, i) { "use strict"; var n = function(n, o) { if (!t(n)) throw new i("url is required."); return t(o) && !t(o.Accept) && (o = e(o), o.Accept = "application/json,*/*;q=0.01"), r(n, o).then(function(e) { return JSON.parse(e) }) }; return n }), r("Core/Iau2006XysData", ["./buildModuleUrl", "./defaultValue", "./defined", "./Iau2006XysSample", "./JulianDate", "./loadJson", "./TimeStandard", "../ThirdParty/when"], function(e, t, r, i, n, o, a, s) { "use strict";
  1595. function l(e, t, r) { var i = h; return i._julianDayNumber = t, i._secondsOfDay = r, e._sampleZeroDateTT.getDaysDifference(i) }
  1596. function u(t, i) { if (t._chunkDownloadsInProgress[i]) return t._chunkDownloadsInProgress[i]; var n = s.defer();
  1597. t._chunkDownloadsInProgress[i] = n; var a, l = t._xysFileUrlTemplate; return a = r(l) ? l.replace("{0}", i) : e("Assets/IAU2006_XYS/IAU2006_XYS_" + i + ".json"), s(o(a), function(e) { t._chunkDownloadsInProgress[i] = !1; for (var r = t._samples, o = e.samples, a = 3 * i * t._samplesPerXysFile, s = 0, l = o.length; l > s; ++s) r[a + s] = o[s];
  1598. n.resolve() }), n.promise } var c = function(e) { e = t(e, t.EMPTY_OBJECT), this._xysFileUrlTemplate = e.xysFileUrlTemplate, this._interpolationOrder = t(e.interpolationOrder, 9), this._sampleZeroJulianEphemerisDate = t(e.sampleZeroJulianEphemerisDate, 2442396.5), this._sampleZeroDateTT = new n(this._sampleZeroJulianEphemerisDate, 0, a.TAI), this._stepSizeDays = t(e.stepSizeDays, 1), this._samplesPerXysFile = t(e.samplesPerXysFile, 1e3), this._totalSamples = t(e.totalSamples, 27426), this._samples = new Array(3 * this._totalSamples), this._chunkDownloadsInProgress = []; for (var r = this._interpolationOrder, i = this._denominators = new Array(r + 1), o = this._xTable = new Array(r + 1), s = Math.pow(this._stepSizeDays, r), l = 0; r >= l; ++l) { i[l] = s, o[l] = l * this._stepSizeDays; for (var u = 0; r >= u; ++u) u !== l && (i[l] *= l - u);
  1599. i[l] = 1 / i[l] } this._work = new Array(r + 1), this._coef = new Array(r + 1) },
  1600. h = new n(0, 0, a.TAI); return c.prototype.preload = function(e, t, r, i) { var n = l(this, e, t),
  1601. o = l(this, r, i),
  1602. a = 0 | n / this._stepSizeDays - this._interpolationOrder / 2;
  1603. 0 > a && (a = 0); var c = o / this._stepSizeDays - this._interpolationOrder / 2 | 0 + this._interpolationOrder;
  1604. c >= this._totalSamples && (c = this._totalSamples - 1); for (var h = 0 | a / this._samplesPerXysFile, d = 0 | c / this._samplesPerXysFile, m = [], p = h; d >= p; ++p) m.push(u(this, p)); return s.all(m) }, c.prototype.computeXysRadians = function(e, t, n) { var o = l(this, e, t); if (0 > o) return void 0; var a = 0 | o / this._stepSizeDays; if (a >= this._totalSamples) return void 0; var s = this._interpolationOrder,
  1605. c = a - (0 | s / 2);
  1606. 0 > c && (c = 0); var h = c + s;
  1607. h >= this._totalSamples && (h = this._totalSamples - 1, c = h - s, 0 > c && (c = 0)); var d = !1,
  1608. m = this._samples; if (r(m[3 * c]) || (u(this, 0 | c / this._samplesPerXysFile), d = !0), r(m[3 * h]) || (u(this, 0 | h / this._samplesPerXysFile), d = !0), d) return void 0;
  1609. r(n) ? (n.x = 0, n.y = 0, n.s = 0) : n = new i(0, 0, 0); var p, f, v = o - c * this._stepSizeDays,
  1610. y = this._work,
  1611. g = this._denominators,
  1612. _ = this._coef,
  1613. w = this._xTable; for (p = 0; s >= p; ++p) y[p] = v - w[p]; for (p = 0; s >= p; ++p) { for (_[p] = 1, f = 0; s >= f; ++f) f !== p && (_[p] *= y[f]);
  1614. _[p] *= g[p]; var C = 3 * (c + p);
  1615. n.x += _[p] * m[C++], n.y += _[p] * m[C++], n.s += _[p] * m[C] } return n }, c }), r("Core/EarthOrientationParametersSample", [], function() { "use strict"; var e = function(e, t, r, i, n) { this.xPoleWander = e, this.yPoleWander = t, this.xPoleOffset = r, this.yPoleOffset = i, this.ut1MinusUtc = n }; return e }), r("Core/EarthOrientationParameters", ["./binarySearch", "./defaultValue", "./defined", "./freezeObject", "./loadJson", "./EarthOrientationParametersSample", "./JulianDate", "./LeapSecond", "./RuntimeError", "./TimeConstants", "./TimeStandard", "../ThirdParty/when"], function(e, t, r, i, n, o, a, s, l, u, c, h) { "use strict";
  1616. function d(e, t) { return a.compare(e.julianDate, t) }
  1617. function m(t, i) { if (!r(i.columnNames)) return t._dataError = "Error in loaded EOP data: The columnNames property is required.", void 0; if (!r(i.samples)) return t._dataError = "Error in loaded EOP data: The samples property is required.", void 0; var n = i.columnNames.indexOf("modifiedJulianDateUtc"),
  1618. o = i.columnNames.indexOf("xPoleWanderRadians"),
  1619. l = i.columnNames.indexOf("yPoleWanderRadians"),
  1620. h = i.columnNames.indexOf("ut1MinusUtcSeconds"),
  1621. m = i.columnNames.indexOf("xCelestialPoleOffsetRadians"),
  1622. p = i.columnNames.indexOf("yCelestialPoleOffsetRadians"),
  1623. f = i.columnNames.indexOf("taiMinusUtcSeconds"); if (0 > n || 0 > o || 0 > l || 0 > h || 0 > m || 0 > p || 0 > f) return t._dataError = "Error in loaded EOP data: The columnNames property must include modifiedJulianDateUtc, xPoleWanderRadians, yPoleWanderRadians, ut1MinusUtcSeconds, xCelestialPoleOffsetRadians, yCelestialPoleOffsetRadians, and taiMinusUtcSeconds columns", void 0; var v = t._samples = i.samples,
  1624. y = t._dates = [];
  1625. t._dateColumn = n, t._xPoleWanderRadiansColumn = o, t._yPoleWanderRadiansColumn = l, t._ut1MinusUtcSecondsColumn = h, t._xCelestialPoleOffsetRadiansColumn = m, t._yCelestialPoleOffsetRadiansColumn = p, t._taiMinusUtcSecondsColumn = f, t._columnCount = i.columnNames.length, t._lastIndex = void 0; for (var g, _ = t._addNewLeapSeconds, w = 0, C = v.length; C > w; w += t._columnCount) { var x = v[w + n],
  1626. S = v[w + f],
  1627. E = x + u.MODIFIED_JULIAN_DATE_DIFFERENCE,
  1628. b = new a(E, S, c.TAI); if (y.push(b), _) { if (S !== g && r(g)) { var T = s.getLeapSeconds(),
  1629. A = e(T, b, d); if (0 > A) { var M = new s(b, S);
  1630. T.splice(~A, 0, M) } } g = S } } }
  1631. function p(e, t, r, i, n) { var o = r * i;
  1632. n.xPoleWander = t[o + e._xPoleWanderRadiansColumn], n.yPoleWander = t[o + e._yPoleWanderRadiansColumn], n.xPoleOffset = t[o + e._xCelestialPoleOffsetRadiansColumn], n.yPoleOffset = t[o + e._yCelestialPoleOffsetRadiansColumn], n.ut1MinusUtc = t[o + e._ut1MinusUtcSecondsColumn] }
  1633. function f(e, t, r) { return t + e * (r - t) }
  1634. function v(e, t, r, i, n, o, a) { var s = e._columnCount; if (o > t.length - 1) return a.xPoleWander = 0, a.yPoleWander = 0, a.xPoleOffset = 0, a.yPoleOffset = 0, a.ut1MinusUtc = 0, a; var l = t[n],
  1635. u = t[o]; if (l.equals(u) || i.equals(l)) return p(e, r, n, s, a), a; if (i.equals(u)) return p(e, r, o, s, a), a; var c = l.getSecondsDifference(i) / l.getSecondsDifference(u),
  1636. h = n * s,
  1637. d = o * s,
  1638. m = r[h + e._ut1MinusUtcSecondsColumn],
  1639. v = r[d + e._ut1MinusUtcSecondsColumn],
  1640. y = v - m; if (y > .5 || -.5 > y) { var g = r[h + e._taiMinusUtcSecondsColumn],
  1641. _ = r[d + e._taiMinusUtcSecondsColumn];
  1642. g !== _ && (u.equals(i) ? m = v : v -= _ - g) } return a.xPoleWander = f(c, r[h + e._xPoleWanderRadiansColumn], r[d + e._xPoleWanderRadiansColumn]), a.yPoleWander = f(c, r[h + e._yPoleWanderRadiansColumn], r[d + e._yPoleWanderRadiansColumn]), a.xPoleOffset = f(c, r[h + e._xCelestialPoleOffsetRadiansColumn], r[d + e._xCelestialPoleOffsetRadiansColumn]), a.yPoleOffset = f(c, r[h + e._yCelestialPoleOffsetRadiansColumn], r[d + e._yCelestialPoleOffsetRadiansColumn]), a.ut1MinusUtc = f(c, m, v), a } var y = function(e) { if (e = t(e, t.EMPTY_OBJECT), this._dates = void 0, this._samples = void 0, this._dateColumn = -1, this._xPoleWanderRadiansColumn = -1, this._yPoleWanderRadiansColumn = -1, this._ut1MinusUtcSecondsColumn = -1, this._xCelestialPoleOffsetRadiansColumn = -1, this._yCelestialPoleOffsetRadiansColumn = -1, this._taiMinusUtcSecondsColumn = -1, this._columnCount = 0, this._lastIndex = -1, this._downloadPromise = void 0, this._dataError = void 0, this._addNewLeapSeconds = t(e.addNewLeapSeconds, !0), r(e.data)) m(this, e.data);
  1643. else if (r(e.url)) { var i = this;
  1644. this._downloadPromise = h(n(e.url), function(e) { m(i, e) }, function() { i._dataError = "An error occurred while retrieving the EOP data from the URL " + e.url + "." }) } else m(this, { columnNames: ["dateIso8601", "modifiedJulianDateUtc", "xPoleWanderRadians", "yPoleWanderRadians", "ut1MinusUtcSeconds", "lengthOfDayCorrectionSeconds", "xCelestialPoleOffsetRadians", "yCelestialPoleOffsetRadians", "taiMinusUtcSeconds"], samples: [] }) }; return y.NONE = i({ getPromiseToLoad: function() { return h() }, compute: function(e, t) { return r(t) ? (t.xPoleWander = 0, t.yPoleWander = 0, t.xPoleOffset = 0, t.yPoleOffset = 0, t.ut1MinusUtc = 0) : t = new o(0, 0, 0, 0, 0), t } }), y.prototype.getPromiseToLoad = function() { return h(this._downloadPromise) }, y.prototype.compute = function(t, i) { if (!r(this._samples)) { if (r(this._dataError)) throw new l(this._dataError); return void 0 } if (r(i) || (i = new o(0, 0, 0, 0, 0)), 0 === this._samples.length) return i.xPoleWander = 0, i.yPoleWander = 0, i.xPoleOffset = 0, i.yPoleOffset = 0, i.ut1MinusUtc = 0, i; var n = this._dates,
  1645. s = this._lastIndex,
  1646. u = 0,
  1647. c = 0; if (r(s)) { var h = n[s],
  1648. d = n[s + 1],
  1649. m = h.lessThanOrEquals(t),
  1650. p = !r(d),
  1651. f = p || d.greaterThanOrEquals(t); if (m && f) return u = s, !p && d.equals(t) && ++u, c = u + 1, v(this, n, this._samples, t, u, c, i), i } var y = e(n, t, a.compare, this._dateColumn); return y >= 0 ? (y < n.length - 1 && n[y + 1].equals(t) && ++y, u = y, c = y) : (c = ~y, u = c - 1, 0 > u && (u = 0)), this._lastIndex = u, v(this, n, this._samples, t, u, c, i), i }, y }), r("Core/Transforms", ["./defaultValue", "./defined", "./DeveloperError", "./Iau2006XysData", "./Iau2006XysSample", "./Math", "./Matrix3", "./Matrix4", "./Cartesian2", "./Cartesian3", "./Cartesian4", "./TimeConstants", "./Ellipsoid", "./EarthOrientationParameters", "./EarthOrientationParametersSample", "../ThirdParty/when"], function(e, t, r, i, n, o, a, s, l, u, c, h, d, m, p, f) { "use strict"; var v = {},
  1652. y = new u,
  1653. g = new u,
  1654. _ = new u;
  1655. v.eastNorthUpToFixedFrame = function(i, n, a) { if (!t(i)) throw new r("origin is required."); if (o.equalsEpsilon(i.x, 0, o.EPSILON14) && o.equalsEpsilon(i.y, 0, o.EPSILON14)) { var l = o.sign(i.z); return t(a) ? (a[0] = 0, a[1] = 1, a[2] = 0, a[3] = 0, a[4] = -l, a[5] = 0, a[6] = 0, a[7] = 0, a[8] = 0, a[9] = 0, a[10] = l, a[11] = 0, a[12] = i.x, a[13] = i.y, a[14] = i.z, a[15] = 1, a) : new s(0, -l, 0, i.x, 1, 0, 0, i.y, 0, 0, l, i.z, 0, 0, 0, 1) } var c = y,
  1656. h = g,
  1657. m = _; return n = e(n, d.WGS84), n.geodeticSurfaceNormal(i, c), h.x = -i.y, h.y = i.x, h.z = 0, u.normalize(h, h), c.cross(h, m), t(a) ? (a[0] = h.x, a[1] = h.y, a[2] = h.z, a[3] = 0, a[4] = m.x, a[5] = m.y, a[6] = m.z, a[7] = 0, a[8] = c.x, a[9] = c.y, a[10] = c.z, a[11] = 0, a[12] = i.x, a[13] = i.y, a[14] = i.z, a[15] = 1, a) : new s(h.x, m.x, c.x, i.x, h.y, m.y, c.y, i.y, h.z, m.z, c.z, i.z, 0, 0, 0, 1) }; var w = new u,
  1658. C = new u,
  1659. x = new u;
  1660. v.northEastDownToFixedFrame = function(i, n, a) { if (!t(i)) throw new r("origin is required."); if (o.equalsEpsilon(i.x, 0, o.EPSILON14) && o.equalsEpsilon(i.y, 0, o.EPSILON14)) { var l = o.sign(i.z); return t(a) ? (a[0] = -l, a[1] = 0, a[2] = 0, a[3] = 0, a[4] = 0, a[5] = 1, a[6] = 0, a[7] = 0, a[8] = 0, a[9] = 0, a[10] = -l, a[11] = 0, a[12] = i.x, a[13] = i.y, a[14] = i.z, a[15] = 1, a) : new s(-l, 0, 0, i.x, 0, 1, 0, i.y, 0, 0, -l, i.z, 0, 0, 0, 1) } var c = w,
  1661. h = C,
  1662. m = x; return n = e(n, d.WGS84), n.geodeticSurfaceNormal(i, c), h.x = -i.y, h.y = i.x, h.z = 0, u.normalize(h, h), c.cross(h, m), t(a) ? (a[0] = m.x, a[1] = m.y, a[2] = m.z, a[3] = 0, a[4] = h.x, a[5] = h.y, a[6] = h.z, a[7] = 0, a[8] = -c.x, a[9] = -c.y, a[10] = -c.z, a[11] = 0, a[12] = i.x, a[13] = i.y, a[14] = i.z, a[15] = 1, a) : new s(m.x, h.x, -c.x, i.x, m.y, h.y, -c.y, i.y, m.z, h.z, -c.z, i.z, 0, 0, 0, 1) }; var S = 24110.54841,
  1663. E = 8640184.812866,
  1664. b = .093104,
  1665. T = -62e-7,
  1666. A = 1.1772758384668e-19,
  1667. M = 72921158553e-15,
  1668. P = o.TWO_PI / 86400;
  1669. v.computeTemeToPseudoFixedMatrix = function(e, i) { if (!t(e)) throw new r("date is required."); var n, s = e.addSeconds(-e.getTaiMinusUtc()),
  1670. l = s.getJulianDayNumber(),
  1671. u = s.getSecondsOfDay(),
  1672. c = l - 2451545;
  1673. n = u >= 43200 ? (c + .5) / h.DAYS_PER_JULIAN_CENTURY : (c - .5) / h.DAYS_PER_JULIAN_CENTURY; var d = S + n * (E + n * (b + n * T)),
  1674. m = d * P % o.TWO_PI,
  1675. p = M + A * (l - 2451545.5),
  1676. f = (u + .5 * h.SECONDS_PER_DAY) % h.SECONDS_PER_DAY,
  1677. v = m + p * f,
  1678. y = Math.cos(v),
  1679. g = Math.sin(v); return t(i) ? (i[0] = y, i[1] = -g, i[2] = 0, i[3] = g, i[4] = y, i[5] = 0, i[6] = 0, i[7] = 0, i[8] = 1, i) : new a(y, g, 0, -g, y, 0, 0, 0, 1) }, v.iau2006XysData = new i, v.earthOrientationParameters = m.NONE; var D = 32.184,
  1680. I = 2451545;
  1681. v.preloadIcrfFixed = function(e) { var t = e.start.getJulianDayNumber(),
  1682. r = e.start.getSecondsOfDay() + D,
  1683. i = e.stop.getJulianDayNumber(),
  1684. n = e.stop.getSecondsOfDay() + D,
  1685. o = v.iau2006XysData.preload(t, r, i, n),
  1686. a = v.earthOrientationParameters.getPromiseToLoad(); return f.all([o, a]) }, v.computeIcrfToFixedMatrix = function(e, i) { if (!t(e)) throw new r("date is required."); var n = v.computeFixedToIcrfMatrix(e, i); return t(n) ? n.transpose(i) : void 0 }; var O = new n(0, 0, 0),
  1687. R = new p(0, 0, 0, 0, 0, 0),
  1688. L = new a,
  1689. z = new a;
  1690. v.computeFixedToIcrfMatrix = function(e, i) { if (!t(e)) throw new r("date is required."); var n = v.earthOrientationParameters.compute(e, R); if (!t(n)) return void 0; var s = e.getJulianDayNumber(),
  1691. l = e.getSecondsOfDay() + D,
  1692. u = v.iau2006XysData.computeXysRadians(s, l, O); if (!t(u)) return void 0; var c = u.x + n.xPoleOffset,
  1693. d = u.y + n.yPoleOffset,
  1694. m = 1 / (1 + Math.sqrt(1 - c * c - d * d)),
  1695. p = L;
  1696. p[0] = 1 - m * c * c, p[3] = -m * c * d, p[6] = c, p[1] = -m * c * d, p[4] = 1 - m * d * d, p[7] = d, p[2] = -c, p[5] = -d, p[8] = 1 - m * (c * c + d * d); var f = a.fromRotationZ(-u.s, z),
  1697. y = p.multiply(f, L),
  1698. g = e.getJulianDayNumber(),
  1699. _ = e.getSecondsOfDay() - e.getTaiMinusUtc() + n.ut1MinusUtc,
  1700. w = g - 2451545,
  1701. C = _ / h.SECONDS_PER_DAY,
  1702. x = .779057273264 + C + .00273781191135448 * (w + C);
  1703. x = x % 1 * o.TWO_PI; var S = a.fromRotationZ(x, z),
  1704. E = y.multiply(S, L),
  1705. b = Math.cos(n.xPoleWander),
  1706. T = Math.cos(n.yPoleWander),
  1707. A = Math.sin(n.xPoleWander),
  1708. M = Math.sin(n.yPoleWander),
  1709. P = s - I + l / h.SECONDS_PER_DAY;
  1710. P /= 36525; var N = -47e-6 * P * o.RADIANS_PER_DEGREE / 3600,
  1711. F = Math.cos(N),
  1712. B = Math.sin(N),
  1713. V = z; return V[0] = b * F, V[1] = b * B, V[2] = A, V[3] = -T * B + M * A * F, V[4] = T * F + M * A * B, V[5] = -M * b, V[6] = -M * B - T * A * F, V[7] = M * F - T * A * B, V[8] = T * b, E.multiply(V, i) }; var N = new c; return v.pointToWindowCoordinates = function(e, i, n, o) { if (!t(e)) throw new r("modelViewProjectionMatrix is required."); if (!t(i)) throw new r("viewportTransformation is required."); if (!t(n)) throw new r("point is required."); var a = N; return s.multiplyByPoint(e, n, a), c.multiplyByScalar(a, 1 / a.w, a), s.multiplyByVector(i, a, a), l.fromCartesian4(a, o) }, v }), r("Core/Ray", ["./DeveloperError", "./defaultValue", "./Cartesian3"], function(e, t, r) { "use strict"; var i = function(e, i) { i = r.clone(t(i, r.ZERO)), i.equals(r.ZERO) || r.normalize(i, i), this.origin = r.clone(t(e, r.ZERO)), this.direction = i }; return i.prototype.getPoint = function(t, i) { if ("number" != typeof t) throw new e("t is a required number"); return i = r.multiplyByScalar(this.direction, t, i), r.add(this.origin, i, i) }, i }), r("Core/EllipsoidTangentPlane", ["./defaultValue", "./defined", "./DeveloperError", "./Transforms", "./AxisAlignedBoundingBox", "./IntersectionTests", "./Cartesian2", "./Cartesian3", "./Ellipsoid", "./Ray", "./Plane"], function(e, t, r, i, n, o, a, s, l, u, c) {
  1714. "use strict";
  1715. var h = function(n, o) {
  1716. if (!t(n)) throw new r("origin is required.");
  1717. if (o = e(o, l.WGS84), n = o.scaleToGeodeticSurface(n), !t(n)) throw new r("origin must not be at the center of the ellipsoid.");
  1718. var a = i.eastNorthUpToFixedFrame(n, o);
  1719. this._ellipsoid = o, this._origin = s.clone(n), this._xAxis = s.fromCartesian4(a.getColumn(0)), this._yAxis = s.fromCartesian4(a.getColumn(1));
  1720. var u = s.fromCartesian4(a.getColumn(2)),
  1721. h = -s.dot(n, n);
  1722. this._plane = new c(u, h)
  1723. },
  1724. d = new n;
  1725. h.fromPoints = function(e, i) { if (!t(e)) throw new r("cartesians is required."); var o = n.fromPoints(e, d); return new h(o.center, i) }, h.prototype.getEllipsoid = function() { return this._ellipsoid }, h.prototype.getOrigin = function() { return this._origin };
  1726. var m = new u,
  1727. p = new s;
  1728. h.prototype.projectPointOntoPlane = function(e, i) { if (!t(e)) throw new r("cartesian is required."); var n = m;
  1729. n.origin = e, s.normalize(e, n.direction); var l = o.rayPlane(n, this._plane, p); if (t(l)) { var u = l.subtract(this._origin, l),
  1730. c = this._xAxis.dot(u),
  1731. h = this._yAxis.dot(u); return t(i) ? (i.x = c, i.y = h, i) : new a(c, h) } return void 0 }, h.prototype.projectPointsOntoPlane = function(e, i) { if (!t(e)) throw new r("cartesians is required.");
  1732. t(i) || (i = []); for (var n = 0, o = e.length, a = 0; o > a; a++) { var s = this.projectPointOntoPlane(e[a], i[n]);
  1733. t(s) && (i[n] = s, n++) } return i.length = n, i };
  1734. var f = new s;
  1735. return h.prototype.projectPointsOntoEllipsoid = function(e, i) { if (!t(e)) throw new r("cartesians is required."); var n = e.length;
  1736. t(i) ? i.length = n : i = new Array(n); for (var o = this._ellipsoid, a = this._origin, l = this._xAxis, u = this._yAxis, c = f, h = 0; n > h; ++h) { var d = e[h];
  1737. l.multiplyByScalar(d.x, c); var m = i[h] = s.add(a, c, i[h]);
  1738. u.multiplyByScalar(d.y, c), s.add(m, c, m), o.scaleToGeocentricSurface(m, m) } return i }, h
  1739. }), r("Core/EllipsoidGeodesic", ["./freezeObject", "./defaultValue", "./defined", "./DeveloperError", "./Ellipsoid", "./Math", "./Cartesian3", "./Cartographic"], function(e, t, r, i, n, o, a, s) { "use strict";
  1740. function l(e) { var t = e._uSquared,
  1741. r = e._ellipsoid.getMaximumRadius(),
  1742. i = e._ellipsoid.getMinimumRadius(),
  1743. n = (r - i) / r,
  1744. o = Math.cos(e._startHeading),
  1745. a = Math.sin(e._startHeading),
  1746. s = (1 - n) * Math.tan(e._start.latitude),
  1747. l = 1 / Math.sqrt(1 + s * s),
  1748. u = l * s,
  1749. c = Math.atan2(s, o),
  1750. h = l * a,
  1751. d = h * h,
  1752. m = 1 - d,
  1753. p = Math.sqrt(m),
  1754. f = t / 4,
  1755. v = f * f,
  1756. y = v * f,
  1757. g = v * v,
  1758. _ = 1 + f - 3 * v / 4 + 5 * y / 4 - 175 * g / 64,
  1759. w = 1 - f + 15 * v / 8 - 35 * y / 8,
  1760. C = 1 - 3 * f + 35 * v / 4,
  1761. x = 1 - 5 * f,
  1762. S = _ * c - w * Math.sin(2 * c) * f / 2 - C * Math.sin(4 * c) * v / 16 - x * Math.sin(6 * c) * y / 48 - 5 * Math.sin(8 * c) * g / 512,
  1763. E = e._constants;
  1764. E.a = r, E.b = i, E.f = n, E.cosineHeading = o, E.sineHeading = a, E.tanU = s, E.cosineU = l, E.sineU = u, E.sigma = c, E.sineAlpha = h, E.sineSquaredAlpha = d, E.cosineSquaredAlpha = m, E.cosineAlpha = p, E.u2Over4 = f, E.u4Over16 = v, E.u6Over64 = y, E.u8Over256 = g, E.a0 = _, E.a1 = w, E.a2 = C, E.a3 = x, E.distanceRatio = S }
  1765. function u(e, t) { return e * t * (4 + e * (4 - 3 * t)) / 16 }
  1766. function c(e, t, r, i, n, o, a) { var s = u(e, r); return (1 - s) * e * t * (i + s * n * (a + s * o * (2 * a * a - 1))) }
  1767. function h(e, t, r, i, n, a, s) { var l, u, h, d, m, p = (t - r) / t,
  1768. f = a - i,
  1769. v = Math.atan((1 - p) * Math.tan(n)),
  1770. y = Math.atan((1 - p) * Math.tan(s)),
  1771. g = Math.cos(v),
  1772. _ = Math.sin(v),
  1773. w = Math.cos(y),
  1774. C = Math.sin(y),
  1775. x = g * w,
  1776. S = g * C,
  1777. E = _ * C,
  1778. b = _ * w,
  1779. T = f,
  1780. A = o.TWO_PI,
  1781. M = Math.cos(T),
  1782. P = Math.sin(T);
  1783. do { M = Math.cos(T), P = Math.sin(T); var D = S - b * M;
  1784. h = Math.sqrt(w * w * P * P + D * D), u = E + x * M, l = Math.atan2(h, u); var I;
  1785. 0 === h ? (I = 0, d = 1) : (I = x * P / h, d = 1 - I * I), A = T, m = u - 2 * E / d, isNaN(m) && (m = 0), T = f + c(p, I, d, l, h, u, m) } while (Math.abs(T - A) > o.EPSILON12); var O = d * (t * t - r * r) / (r * r),
  1786. R = 1 + O * (4096 + O * (O * (320 - 175 * O) - 768)) / 16384,
  1787. L = O * (256 + O * (O * (74 - 47 * O) - 128)) / 1024,
  1788. z = m * m,
  1789. N = L * h * (m + L * (u * (2 * z - 1) - L * m * (4 * h * h - 3) * (4 * z - 3) / 6) / 4),
  1790. F = r * R * (l - N),
  1791. B = Math.atan2(w * P, S - b * M),
  1792. V = Math.atan2(g * P, S * M - b);
  1793. e._distance = F, e._startHeading = B, e._endHeading = V, e._uSquared = O }
  1794. function d(e, t, r, n) { var o = n.cartographicToCartesian(t, p).normalize(m),
  1795. a = n.cartographicToCartesian(r, p).normalize(p); if (Math.abs(Math.abs(o.angleBetween(a)) - Math.PI) < .0125) throw new i("geodesic position is not unique");
  1796. h(e, n.getMaximumRadius(), n.getMinimumRadius(), t.longitude, t.latitude, r.longitude, r.latitude), t.height = 0, r.height = 0, e._start = s.clone(t, e._start), e._end = s.clone(r, e._end), l(e) } var m = new a,
  1797. p = new a,
  1798. f = function(e, i, o) { var a = t(o, n.WGS84);
  1799. this._ellipsoid = a, this._start = new s, this._end = new s, this._constants = {}, this._startHeading = void 0, this._endHeading = void 0, this._distance = void 0, this._uSquared = void 0, r(e) && r(i) && d(this, e, i, a) }; return f.prototype.getSurfaceDistance = function() { if (!r(this._distance)) throw new i("start and end must be set before calling funciton getSurfaceDistance"); return this._distance }, f.prototype.setEndPoints = function(e, t) { if (!r(e)) throw new i("start cartographic position is required"); if (!r(t)) throw new i("end cartgraphic position is required");
  1800. d(this, e, t, this._ellipsoid) }, f.prototype.getStart = function() { return this._start }, f.prototype.getEnd = function() { return this._end }, f.prototype.getStartHeading = function() { if (!r(this._distance)) throw new i("start and end must be set before calling funciton getStartHeading"); return this._startHeading }, f.prototype.getEndHeading = function() { if (!r(this._distance)) throw new i("start and end must be set before calling funciton getEndHeading"); return this._endHeading }, f.prototype.interpolateUsingFraction = function(e, t) { return this.interpolateUsingSurfaceDistance(this._distance * e, t) }, f.prototype.interpolateUsingSurfaceDistance = function(e, t) { if (!r(this._distance)) throw new i("start and end must be set before calling funciton interpolateUsingSurfaceDistance"); var n = this._constants,
  1801. o = n.distanceRatio + e / n.b,
  1802. a = Math.cos(2 * o),
  1803. l = Math.cos(4 * o),
  1804. u = Math.cos(6 * o),
  1805. h = Math.sin(2 * o),
  1806. d = Math.sin(4 * o),
  1807. m = Math.sin(6 * o),
  1808. p = Math.sin(8 * o),
  1809. f = o * o,
  1810. v = o * f,
  1811. y = n.u8Over256,
  1812. g = n.u2Over4,
  1813. _ = n.u6Over64,
  1814. w = n.u4Over16,
  1815. C = 2 * v * y * a / 3 + o * (1 - g + 7 * w / 4 - 15 * _ / 4 + 579 * y / 64 - (w - 15 * _ / 4 + 187 * y / 16) * a - (5 * _ / 4 - 115 * y / 16) * l - 29 * y * u / 16) + (g / 2 - w + 71 * _ / 32 - 85 * y / 16) * h + (5 * w / 16 - 5 * _ / 4 + 383 * y / 96) * d - f * ((_ - 11 * y / 2) * h + 5 * y * d / 2) + (29 * _ / 96 - 29 * y / 16) * m + 539 * y * p / 1536,
  1816. x = Math.asin(Math.sin(C) * n.cosineAlpha),
  1817. S = Math.atan(n.a / n.b * Math.tan(x));
  1818. C -= n.sigma; var E = Math.cos(2 * n.sigma + C),
  1819. b = Math.sin(C),
  1820. T = Math.cos(C),
  1821. A = n.cosineU * T,
  1822. M = n.sineU * b,
  1823. P = Math.atan2(b * n.sineHeading, A - M * n.cosineHeading),
  1824. D = P - c(n.f, n.sineAlpha, n.cosineSquaredAlpha, C, b, T, E); return r(t) ? (t.longitude = this._start.longitude + D, t.latitude = S, t.height = 0, t) : new s(this._start.longitude + D, S, 0) }, f }), r("Core/PolylinePipeline", ["./defaultValue", "./defined", "./DeveloperError", "./Cartographic", "./Cartesian3", "./Cartesian4", "./Ellipsoid", "./EllipsoidGeodesic", "./IntersectionTests", "./Math", "./Matrix4", "./Plane"], function(e, t, r, i, n, o, a, s, l, u, c, h) { "use strict";
  1825. function d(e, t, r, i) { var o = n.angleBetween(e, t),
  1826. a = Math.ceil(o / r),
  1827. s = new Array(3 * a),
  1828. l = i.cartesianToCartographic(e, S),
  1829. u = i.cartesianToCartographic(t, E);
  1830. T.setEndPoints(l, u); var c = T.getSurfaceDistance() / a,
  1831. h = 0;
  1832. l.height = 0; var d = i.cartographicToCartesian(l, b);
  1833. s[h++] = d.x, s[h++] = d.y, s[h++] = d.z; for (var m = 1; a > m; m++) { var p = T.interpolateUsingSurfaceDistance(m * c, E);
  1834. d = i.cartographicToCartesian(p, b), s[h++] = d.x, s[h++] = d.y, s[h++] = d.z } return s }
  1835. function m(e, t, r) { var i = A; return r.geodeticSurfaceNormal(e, i), n.multiplyByScalar(i, t, i), n.add(e, i, e), e } var p = {},
  1836. f = new c,
  1837. v = new o,
  1838. y = new o,
  1839. g = new h(n.ZERO, 0),
  1840. _ = new o,
  1841. w = new h(n.ZERO, 0),
  1842. C = new n,
  1843. x = new n,
  1844. S = new i,
  1845. E = new i,
  1846. b = new n,
  1847. T = new s,
  1848. A = new n,
  1849. M = new n; return p.wrapLongitude = function(r, i) { var a = [],
  1850. s = []; if (t(r) && r.length > 0) { i = e(i, c.IDENTITY); var u = c.inverseTransformation(i, f),
  1851. d = c.multiplyByPoint(u, n.ZERO, v),
  1852. m = c.multiplyByVector(u, o.UNIT_Y, y),
  1853. p = h.fromPointNormal(d, m, g),
  1854. S = c.multiplyByVector(u, o.UNIT_X, _),
  1855. E = h.fromPointNormal(d, S, w),
  1856. b = 1;
  1857. a.push(n.clone(r[0])); for (var T = a[0], A = r.length, M = 1; A > M; ++M) { var P = r[M]; if (h.getPointDistance(E, T) < 0 || h.getPointDistance(E, P) < 0) { var D = l.lineSegmentPlane(T, P, p, C); if (t(D)) { var I = n.multiplyByScalar(m, 5e-9, x);
  1858. h.getPointDistance(p, T) < 0 && n.negate(I, I), a.push(n.add(D, I)), s.push(b + 1), n.negate(I, I), a.push(n.add(D, I)), b = 1 } } a.push(n.clone(r[M])), b++, T = P } s.push(b) } return { positions: a, lengths: s } }, p.removeDuplicates = function(e) { if (!t(e)) throw new r("positions is required."); var i = e.length; if (2 > i) return e.slice(0); var o = [];
  1859. o.push(e[0]); for (var a = 1; i > a; ++a) { var s = e[a - 1],
  1860. l = e[a];
  1861. n.equals(s, l) || o.push(l) } return o }, p.scaleToSurface = function(i, n, o) { if (!t(i)) throw new r("positions is required");
  1862. n = e(n, u.RADIANS_PER_DEGREE), o = e(o, a.WGS84); for (var s = i.length, l = [], c = 0; s - 1 > c; c++) { var h = i[c],
  1863. m = i[c + 1];
  1864. l = l.concat(d(h, m, n, o)) } var p = i[s - 1],
  1865. f = o.cartesianToCartographic(p, S);
  1866. f.height = 0; var v = o.cartographicToCartesian(f, b); return l.push(v.x, v.y, v.z), l }, p.scaleToGeodeticHeight = function(i, o, s, l) { if (!t(i)) throw new r("positions must be defined."); if (!t(o)) throw new r("height must be defined");
  1867. s = e(s, a.WGS84); var u, c, h = i.length,
  1868. d = M; if (t(l)) { if (l.length !== i.length) throw new r("result.length must be equal to positions.length");
  1869. c = l } else c = new Array(i.length); if (0 === o) { for (u = 0; h > u; u += 3) d = s.scaleToGeodeticSurface(n.fromArray(i, u, d), d), c[u] = d.x, c[u + 1] = d.y, c[u + 2] = d.z; return c } var p; if (Array.isArray(o)) { if (o.length !== h / 3) throw new r("height.length must be equal to positions.length"); for (u = 0; h > u; u += 3) p = o[u / 3], d = n.fromArray(i, u, d), d = m(d, p, s), c[u] = d.x, c[u + 1] = d.y, c[u + 2] = d.z } else
  1870. for (p = o, u = 0; h > u; u += 3) d = n.fromArray(i, u, d), d = m(d, p, s), c[u] = d.x, c[u + 1] = d.y, c[u + 2] = d.z; return c }, p }), r("Core/CorridorGeometry", ["./defined", "./DeveloperError", "./Cartesian2", "./Cartesian3", "./CornerType", "./ComponentDatatype", "./Ellipsoid", "./EllipsoidTangentPlane", "./Geometry", "./IndexDatatype", "./Math", "./Matrix3", "./PolylinePipeline", "./PrimitiveType", "./Quaternion", "./defaultValue", "./BoundingSphere", "./GeometryAttribute", "./GeometryAttributes", "./VertexFormat"], function(e, t, r, i, n, o, a, s, l, u, c, h, d, m, p, f, v, y, g, _) { "use strict";
  1871. function w(e, t, n, o) { var a = new s(n, o),
  1872. l = a.projectPointOntoPlane(n, Y),
  1873. u = a.projectPointOntoPlane(i.add(n, e, X), X),
  1874. c = a.projectPointOntoPlane(i.add(n, t, Z), Z); return c = r.subtract(c, l, c), u = r.subtract(u, l, u), c.x * u.y - c.y * u.x >= 0 }
  1875. function C(t, r, i, n) { var o = r.x,
  1876. a = r.y,
  1877. s = r.z;
  1878. e(i) && (t[i] = o, t[i + 1] = a, t[i + 2] = s), e(n) && (t[n] = s, t[n - 1] = a, t[n - 2] = o) }
  1879. function x(e, t, r, n, o, a) { var s = e.normals,
  1880. l = e.tangents,
  1881. u = e.binormals,
  1882. c = i.cross(r, t, W).normalize(W);
  1883. a.normal && C(s, t, n, o), a.binormal && C(u, r, n, o), a.tangent && C(l, c, n, o) }
  1884. function S(e, t, r, o, a) { var s = i.angleBetween(t.subtract(e, W), r.subtract(e, G)),
  1885. l = o.value === n.BEVELED.value ? 1 : Math.ceil(s / c.toRadians(5)) + 1,
  1886. u = 3 * l,
  1887. d = new Array(u);
  1888. d[u - 3] = r.x, d[u - 2] = r.y, d[u - 1] = r.z; var m;
  1889. m = a ? h.fromQuaternion(p.fromAxisAngle(e, s / l, K), J) : h.fromQuaternion(p.fromAxisAngle(e.negate(W), s / l, K), J); var f = 0;
  1890. t = t.clone(W); for (var v = 0; l > v; v++) t = m.multiplyByVector(t, t), d[f++] = t.x, d[f++] = t.y, d[f++] = t.z; return d }
  1891. function E(e, t, r) { var o = R,
  1892. a = L,
  1893. s = z,
  1894. l = e[1];
  1895. a = i.fromArray(e[1], l.length - 3, a), s = i.fromArray(e[0], 0, s), o = a.add(s, o).multiplyByScalar(.5, o); var u = S(o, a, s, n.ROUNDED, !1, r),
  1896. c = e.length - 1,
  1897. h = e[c - 1];
  1898. l = e[c], a = i.fromArray(h, h.length - 3, a), s = i.fromArray(l, 0, s), o = a.add(s, o).multiplyByScalar(.5, o); var d = S(o, a, s, n.ROUNDED, !1, r); return [u, d] }
  1899. function b(e, t, r, n, o) { var a = W; return o ? a = i.add(e, r, a) : (r = r.negate(r), a = i.add(e, r, a)), [a.x, a.y, a.z, n.x, n.y, n.z] }
  1900. function T(t, r, n, a, s, l, h) { var d, m, p, f = new g,
  1901. _ = 0,
  1902. w = 0,
  1903. S = 0; for (m = 0; m < t.length; m += 2) p = t[m].length - 3, _ += p, S += 2 * p, w += t[m + 1].length - 3; for (_ += 3, w += 3, m = 0; m < r.length; m++) { d = r[m]; var E = r[m].leftPositions;
  1904. e(E) ? (p = E.length, _ += p, S += p) : (p = r[m].rightPositions.length, w += p, S += p) } var b, T = e(l);
  1905. T && (b = l[0].length - 3, _ += b, w += b, b /= 3, S += 6 * b); var A, M, P, D, I, O, F = _ + w,
  1906. V = new Float64Array(F),
  1907. q = s.normal ? new Float32Array(F) : void 0,
  1908. k = s.tangent ? new Float32Array(F) : void 0,
  1909. U = s.binormal ? new Float32Array(F) : void 0,
  1910. H = { normals: q, tangents: k, binormals: U },
  1911. j = 0,
  1912. Y = F - 1,
  1913. X = R,
  1914. Z = L,
  1915. K = b / 2,
  1916. J = u.createTypedArray(F / 3, S),
  1917. Q = 0; if (T) { O = z, I = N; var $ = l[0]; for (X = i.fromArray(a, 0, X), Z = i.fromArray(n, 0, Z), m = 0; K > m; m++) O = i.fromArray($, 3 * (K - 1 - m), O), I = i.fromArray($, 3 * (K + m), I), C(V, I, j), C(V, O, void 0, Y), x(H, X, Z, j, Y, s), M = j / 3, D = M + 1, A = (Y - 2) / 3, P = A - 1, J[Q++] = A, J[Q++] = M, J[Q++] = P, J[Q++] = P, J[Q++] = M, J[Q++] = D, j += 3, Y -= 3 } var et = 0,
  1918. tt = 0,
  1919. rt = t[et++],
  1920. it = t[et++];
  1921. V.set(rt, j), V.set(it, Y - it.length + 1), Z = i.fromArray(n, tt, Z); var nt, ot; for (p = it.length - 3, m = 0; p > m; m += 3) nt = h.geodeticSurfaceNormal(i.fromArray(rt, m, W), W), ot = h.geodeticSurfaceNormal(i.fromArray(it, p - m, G), G), X = nt.add(ot, X).normalize(X), x(H, X, Z, j, Y, s), M = j / 3, D = M + 1, A = (Y - 2) / 3, P = A - 1, J[Q++] = A, J[Q++] = M, J[Q++] = P, J[Q++] = P, J[Q++] = M, J[Q++] = D, j += 3, Y -= 3; for (nt = h.geodeticSurfaceNormal(i.fromArray(rt, p, W), W), ot = h.geodeticSurfaceNormal(i.fromArray(it, p, G), G), X = nt.add(ot, X).normalize(X), tt += 3, m = 0; m < r.length; m++) { var at;
  1922. d = r[m]; var st, lt, ut = d.leftPositions,
  1923. ct = d.rightPositions,
  1924. ht = B,
  1925. dt = z,
  1926. mt = N; if (X = i.fromArray(a, tt, X), e(ut)) { for (x(H, X, Z, void 0, Y, s), Y -= 3, st = D, lt = P, at = 0; at < ut.length / 3; at++) ht = i.fromArray(ut, 3 * at, ht), J[Q++] = st, J[Q++] = lt - at - 1, J[Q++] = lt - at, C(V, ht, void 0, Y), dt = i.fromArray(V, 3 * (lt - at - 1), dt), mt = i.fromArray(V, 3 * st, mt), Z = dt.subtract(mt, Z).normalize(Z), x(H, X, Z, void 0, Y, s), Y -= 3;
  1927. ht = i.fromArray(V, 3 * st, ht), dt = i.fromArray(V, 3 * lt, dt).subtract(ht, dt), mt = i.fromArray(V, 3 * (lt - at), mt).subtract(ht, mt), Z = dt.add(mt, Z).normalize(Z), x(H, X, Z, j, void 0, s), j += 3 } else { for (x(H, X, Z, j, void 0, s), j += 3, st = P, lt = D, at = 0; at < ct.length / 3; at++) ht = i.fromArray(ct, 3 * at, ht), J[Q++] = st, J[Q++] = lt + at, J[Q++] = lt + at + 1, C(V, ht, j), dt = i.fromArray(V, 3 * st, dt), mt = i.fromArray(V, 3 * (lt + at), mt), Z = dt.subtract(mt, Z).normalize(Z), x(H, X, Z, j, void 0, s), j += 3;
  1928. ht = i.fromArray(V, 3 * st, ht), dt = i.fromArray(V, 3 * (lt + at), dt).subtract(ht, dt), mt = i.fromArray(V, 3 * lt, mt).subtract(ht, mt), Z = mt.add(dt, Z).negate(Z).normalize(Z), x(H, X, Z, void 0, Y, s), Y -= 3 } for (rt = t[et++], it = t[et++], rt.splice(0, 3), it.splice(it.length - 3, 3), V.set(rt, j), V.set(it, Y - it.length + 1), p = it.length - 3, tt += 3, Z = i.fromArray(n, tt, Z), at = 0; at < it.length; at += 3) nt = h.geodeticSurfaceNormal(i.fromArray(rt, at, W), W), ot = h.geodeticSurfaceNormal(i.fromArray(it, p - at, G), G), X = nt.add(ot, X).normalize(X), x(H, X, Z, j, Y, s), D = j / 3, M = D - 1, P = (Y - 2) / 3, A = P + 1, J[Q++] = A, J[Q++] = M, J[Q++] = P, J[Q++] = P, J[Q++] = M, J[Q++] = D, j += 3, Y -= 3;
  1929. j -= 3, Y += 3 } if (X = i.fromArray(a, a.length - 3, X), x(H, X, Z, j, Y, s), T) { j += 3, Y -= 3, O = z, I = N; var pt = l[1]; for (m = 0; K > m; m++) O = i.fromArray(pt, 3 * (b - m - 1), O), I = i.fromArray(pt, 3 * m, I), C(V, O, void 0, Y), C(V, I, j), x(H, X, Z, j, Y, s), D = j / 3, M = D - 1, P = (Y - 2) / 3, A = P + 1, J[Q++] = A, J[Q++] = M, J[Q++] = P, J[Q++] = P, J[Q++] = M, J[Q++] = D, j += 3, Y -= 3 } if (f.position = new y({ componentDatatype: o.DOUBLE, componentsPerAttribute: 3, values: V }), s.st) { var ft, vt, yt = new Float32Array(2 * (F / 3)),
  1930. gt = 0; if (T) { _ /= 3, w /= 3; var _t = Math.PI / (b + 1);
  1931. vt = 1 / (_ - b + 1), ft = 1 / (w - b + 1); var wt, Ct = b / 2; for (m = Ct + 1; b + 1 > m; m++) wt = c.PI_OVER_TWO + _t * m, yt[gt++] = ft * (1 + Math.cos(wt)), yt[gt++] = .5 * (1 + Math.sin(wt)); for (m = 1; w - b + 1 > m; m++) yt[gt++] = m * ft, yt[gt++] = 0; for (m = b; m > Ct; m--) wt = c.PI_OVER_TWO - m * _t, yt[gt++] = 1 - ft * (1 + Math.cos(wt)), yt[gt++] = .5 * (1 + Math.sin(wt)); for (m = Ct; m > 0; m--) wt = c.PI_OVER_TWO - _t * m, yt[gt++] = 1 - vt * (1 + Math.cos(wt)), yt[gt++] = .5 * (1 + Math.sin(wt)); for (m = _ - b; m > 0; m--) yt[gt++] = m * vt, yt[gt++] = 1; for (m = 1; Ct + 1 > m; m++) wt = c.PI_OVER_TWO + _t * m, yt[gt++] = vt * (1 + Math.cos(wt)), yt[gt++] = .5 * (1 + Math.sin(wt)) } else { for (_ /= 3, w /= 3, vt = 1 / (_ - 1), ft = 1 / (w - 1), m = 0; w > m; m++) yt[gt++] = m * ft, yt[gt++] = 0; for (m = _; m > 0; m--) yt[gt++] = (m - 1) * vt, yt[gt++] = 1 } f.st = new y({ componentDatatype: o.FLOAT, componentsPerAttribute: 2, values: yt }) } return s.normal && (f.normal = new y({ componentDatatype: o.FLOAT, componentsPerAttribute: 3, values: H.normals })), s.tangent && (f.tangent = new y({ componentDatatype: o.FLOAT, componentsPerAttribute: 3, values: H.tangents })), s.binormal && (f.binormal = new y({ componentDatatype: o.FLOAT, componentsPerAttribute: 3, values: H.binormals })), { attributes: f, indices: J, boundingSphere: v.fromVertices(V) } }
  1932. function A(e, t, r, n) { for (var o = new Array(e.length), a = new Array(e.length), s = t.multiplyByScalar(r, W), l = s.negate(G), u = 0, c = e.length - 1, h = 0; h < e.length; h += 3) { var d = i.fromArray(e, h, H),
  1933. m = d.add(l, j);
  1934. o[u++] = m.x, o[u++] = m.y, o[u++] = m.z; var p = d.add(s, j);
  1935. a[c--] = p.z, a[c--] = p.y, a[c--] = p.x } return n.push(o, a), n }
  1936. function M(e) { var t = e.granularity,
  1937. r = e.positions,
  1938. o = e.width / 2,
  1939. a = e.ellipsoid,
  1940. s = e.cornerType,
  1941. l = R,
  1942. u = L,
  1943. h = z,
  1944. m = N,
  1945. p = F,
  1946. f = B,
  1947. v = V,
  1948. y = q,
  1949. g = k,
  1950. _ = U,
  1951. C = [],
  1952. x = [],
  1953. M = [],
  1954. P = r[0],
  1955. D = r[1];
  1956. u = i.subtract(D, P, u).normalize(u), l = a.geodeticSurfaceNormal(P, l), m = l.cross(u, m).normalize(m), x.push(m.x, m.y, m.z), M.push(l.x, l.y, l.z), v = i.clone(P, v), P = D, h = u.negate(h); var I, G, H = [],
  1957. j = r.length; for (G = 1; j - 1 > G; G++) { l = a.geodeticSurfaceNormal(P, l), D = r[G + 1], u = i.subtract(D, P, u).normalize(u), p = u.add(h, p).normalize(p); var Y = !i.equalsEpsilon(p.negate(W), l, c.EPSILON2); if (Y) { p = p.cross(l, p), p = l.cross(p, p); var X = o / Math.max(.25, i.cross(p, h, W).magnitude()),
  1958. Z = w(u, h, P, a);
  1959. p = p.multiplyByScalar(X, p, p), Z ? (y = i.add(P, p, y), _ = y.add(m.multiplyByScalar(o, _), _), g = y.add(m.multiplyByScalar(2 * o, g), g), O[0] = i.clone(v, O[0]), O[1] = i.clone(_, O[1]), I = d.scaleToSurface(O, t, a), C = A(I, m, o, C), x.push(m.x, m.y, m.z), M.push(l.x, l.y, l.z), f = g.clone(f), m = l.cross(u, m).normalize(m), g = y.add(m.multiplyByScalar(2 * o, g), g), v = y.add(m.multiplyByScalar(o, v), v), s.value === n.ROUNDED.value || s.value === n.BEVELED.value ? H.push({ leftPositions: S(y, f, g, s, Z, a) }) : H.push({ leftPositions: b(P, f, p.negate(p), g, Z, t, a) })) : (g = i.add(P, p, g), _ = g.add(m.multiplyByScalar(o, _).negate(_), _), y = g.add(m.multiplyByScalar(2 * o, y).negate(y), y), O[0] = i.clone(v, O[0]), O[1] = i.clone(_, O[1]), I = d.scaleToSurface(O, t, a), C = A(I, m, o, C), x.push(m.x, m.y, m.z), M.push(l.x, l.y, l.z), f = y.clone(f), m = l.cross(u, m).normalize(m), y = g.add(m.multiplyByScalar(2 * o, y).negate(y), y), v = g.add(m.multiplyByScalar(o, v).negate(v), v), s.value === n.ROUNDED.value || s.value === n.BEVELED.value ? H.push({ rightPositions: S(g, f, y, s, Z, a) }) : H.push({ rightPositions: b(P, f, p, y, Z, t, a) })), h = u.negate(h) } P = D } l = a.geodeticSurfaceNormal(P, l), O[0] = i.clone(v, O[0]), O[1] = i.clone(P, O[1]), I = d.scaleToSurface(O, t, a), C = A(I, m, o, C), x.push(m.x, m.y, m.z), M.push(l.x, l.y, l.z); var K; return s.value === n.ROUNDED.value && (K = E(C, o, a)), T(C, H, x, M, e.vertexFormat, K, a) }
  1960. function P(e, t) { if (!(t.normal || t.binormal || t.tangent || t.st)) return e; var r, n, o = e.position.values;
  1961. (t.normal || t.binormal) && (r = e.normal.values, n = e.binormal.values); var a, s = e.position.values.length / 18,
  1962. l = 3 * s,
  1963. u = 2 * s,
  1964. c = 2 * l; if (t.normal || t.binormal || t.tangent) { var h = t.normal ? new Float32Array(6 * l) : void 0,
  1965. d = t.binormal ? new Float32Array(6 * l) : void 0,
  1966. m = t.tangent ? new Float32Array(6 * l) : void 0,
  1967. p = R,
  1968. f = L,
  1969. v = z,
  1970. y = N,
  1971. g = F,
  1972. _ = B,
  1973. w = c; for (a = 0; l > a; a += 3) { var x = w + c;
  1974. p = i.fromArray(o, a, p), f = i.fromArray(o, a + l, f), v = i.fromArray(o, (a + 3) % l, v), f = f.subtract(p, f), v = v.subtract(p, v), y = f.cross(v, y).normalize(y), t.normal && (C(h, y, x), C(h, y, x + 3), C(h, y, w), C(h, y, w + 3)), (t.tangent || t.binormal) && (_ = i.fromArray(r, a, _), t.binormal && (C(d, _, x), C(d, _, x + 3), C(d, _, w), C(d, _, w + 3)), t.tangent && (g = _.cross(y, g).normalize(g), C(m, g, x), C(m, g, x + 3), C(m, g, w), C(m, g, w + 3))), w += 6 } if (t.normal) { for (h.set(r), a = 0; l > a; a += 3) h[a + l] = -r[a], h[a + l + 1] = -r[a + 1], h[a + l + 2] = -r[a + 2];
  1975. e.normal.values = h } else e.normal = void 0; if (t.binormal ? (d.set(n), d.set(n, l), e.binormal.values = d) : e.binormal = void 0, t.tangent) { var S = e.tangent.values;
  1976. m.set(S), m.set(S, l), e.tangent.values = m } } if (t.st) { var E = e.st.values,
  1977. b = new Float32Array(6 * u);
  1978. b.set(E), b.set(E, u); for (var T = 2 * u, A = 0; 2 > A; A++) { for (b[T++] = E[0], b[T++] = E[1], a = 2; u > a; a += 2) { var M = E[a],
  1979. P = E[a + 1];
  1980. b[T++] = M, b[T++] = P, b[T++] = M, b[T++] = P } b[T++] = E[0], b[T++] = E[1] } e.st.values = b } return e }
  1981. function D(e, t, r) { r[t++] = e[0], r[t++] = e[1], r[t++] = e[2]; for (var i = 3; i < e.length; i += 3) { var n = e[i],
  1982. o = e[i + 1],
  1983. a = e[i + 2];
  1984. r[t++] = n, r[t++] = o, r[t++] = a, r[t++] = n, r[t++] = o, r[t++] = a } return r[t++] = e[0], r[t++] = e[1], r[t++] = e[2], r }
  1985. function I(e) { var t = e.vertexFormat;
  1986. e.vertexFormat = new _({ position: t.positon, normal: t.normal || t.binormal, tangent: t.tangent, binormal: t.normal || t.binormal, st: t.st }); var r = M(e),
  1987. i = e.height,
  1988. n = e.extrudedHeight,
  1989. o = e.ellipsoid,
  1990. a = r.attributes,
  1991. s = r.indices,
  1992. l = r.boundingSphere,
  1993. c = a.position.values,
  1994. h = c.length,
  1995. m = new Float64Array(6 * h),
  1996. p = new Float64Array(h);
  1997. p.set(c); var f = new Float64Array(4 * h);
  1998. c = d.scaleToGeodeticHeight(c, i, o, c), f = D(c, 0, f), p = d.scaleToGeodeticHeight(p, n, o, p), f = D(p, 2 * h, f), m.set(c), m.set(p, h), m.set(f, 2 * h), l = v.fromVertices(c, void 0, 3, l), a.position.values = m, h /= 3; var y, g = s.length,
  1999. w = h + h,
  2000. C = u.createTypedArray(m.length / 3, 2 * g + 3 * w);
  2001. C.set(s); var x = g; for (y = 0; g > y; y += 3) { var S = s[y],
  2002. E = s[y + 1],
  2003. b = s[y + 2];
  2004. C[x++] = b + h, C[x++] = E + h, C[x++] = S + h } a = P(a, t); var T, A, I, O; for (y = 0; w > y; y += 2) T = y + w, A = T + w, I = T + 1, O = A + 1, C[x++] = T, C[x++] = A, C[x++] = I, C[x++] = I, C[x++] = A, C[x++] = O; return { attributes: a, indices: C, boundingSphere: l } } var O = [new i, new i],
  2005. R = new i,
  2006. L = new i,
  2007. z = new i,
  2008. N = new i,
  2009. F = new i,
  2010. B = new i,
  2011. V = new i,
  2012. q = new i,
  2013. k = new i,
  2014. U = new i,
  2015. W = new i,
  2016. G = new i,
  2017. H = new i,
  2018. j = new i,
  2019. Y = new i,
  2020. X = new i,
  2021. Z = new i;
  2022. new i; var K = new p,
  2023. J = new h,
  2024. Q = function(r) { r = f(r, f.EMPTY_OBJECT); var i = r.positions; if (!e(i)) throw new t("options.positions is required."); var o = r.width; if (!e(o)) throw new t("options.width is required.");
  2025. this._positions = i, this._width = o, this._ellipsoid = f(r.ellipsoid, a.WGS84), this._height = f(r.height, 0), this._extrudedHeight = f(r.extrudedHeight, this._height), this._cornerType = f(r.cornerType, n.ROUNDED), this._vertexFormat = f(r.vertexFormat, _.DEFAULT), this._granularity = f(r.granularity, c.RADIANS_PER_DEGREE), this._workerName = "createCorridorGeometry" }; return Q.createGeometry = function(e) { var r = e._positions,
  2026. i = e._height,
  2027. n = e._extrudedHeight,
  2028. o = i !== n,
  2029. a = d.removeDuplicates(r); if (a.length < 2) throw new t("Count of unique positions must be greater than 1."); var s, u = e._ellipsoid,
  2030. c = e._vertexFormat,
  2031. h = { ellipsoid: u, vertexFormat: c, positions: a, width: e._width, cornerType: e._cornerType, granularity: e._granularity }; if (o) { var p = Math.max(i, n);
  2032. n = Math.min(i, n), i = p, h.height = i, h.extrudedHeight = n, s = I(h) } else s = M(h), s.attributes.position.values = c.position ? new Float64Array(d.scaleToGeodeticHeight(s.attributes.position.values, i, u, s.attributes.position.values)) : void 0; var f = s.attributes; return new l({ attributes: f, indices: s.indices, primitiveType: m.TRIANGLES, boundingSphere: s.boundingSphere }) }, Q }), r("Core/CylinderGeometryLibrary", ["./Math"], function(e) { "use strict"; var t = {}; return t.computePositions = function(t, r, i, n, o) { var a, s = .5 * t,
  2033. l = -s,
  2034. u = n + n,
  2035. c = o ? 2 * u : u,
  2036. h = new Float64Array(3 * c),
  2037. d = 0,
  2038. m = 0,
  2039. p = o ? 3 * u : 0,
  2040. f = o ? 3 * (u + n) : 3 * n; for (a = 0; n > a; a++) { var v = a / n * e.TWO_PI,
  2041. y = Math.cos(v),
  2042. g = Math.sin(v),
  2043. _ = y * i,
  2044. w = g * i,
  2045. C = y * r,
  2046. x = g * r;
  2047. h[m + p] = _, h[m + p + 1] = w, h[m + p + 2] = l, h[m + f] = C, h[m + f + 1] = x, h[m + f + 2] = s, m += 3, o && (h[d++] = _, h[d++] = w, h[d++] = l, h[d++] = C, h[d++] = x, h[d++] = s) } return h }, t }), r("Core/CylinderGeometry", ["./defaultValue", "./defined", "./DeveloperError", "./Cartesian2", "./Cartesian3", "./CylinderGeometryLibrary", "./Math", "./ComponentDatatype", "./IndexDatatype", "./PrimitiveType", "./BoundingSphere", "./Geometry", "./GeometryAttribute", "./GeometryAttributes", "./VertexFormat"], function(e, t, r, i, n, o, a, s, l, u, c, h, d, m, p) { "use strict"; var f = new i,
  2048. v = new n,
  2049. y = new n,
  2050. g = new n,
  2051. _ = new n,
  2052. w = function(i) { i = e(i, e.EMPTY_OBJECT); var n = i.length,
  2053. o = i.topRadius,
  2054. a = i.bottomRadius,
  2055. s = e(i.vertexFormat, p.DEFAULT),
  2056. l = e(i.slices, 128); if (!t(n) || 0 >= n) throw new r("options.length must be greater than 0."); if (!t(o) || 0 > o) throw new r("options.topRadius must be greater than 0."); if (!t(a) || 0 > a) throw new r("options.bottomRadius must be greater than 0."); if (0 === a && 0 === o) throw new r("bottomRadius and topRadius cannot both equal 0."); if (3 > l) throw new r("options.slices must be greater that 3.");
  2057. this._length = n, this._topRadius = o, this._bottomRadius = a, this._vertexFormat = s, this._slices = l, this._workerName = "createCylinderGeometry" }; return w.createGeometry = function(e) { var t, r = e._length,
  2058. i = e._topRadius,
  2059. p = e._bottomRadius,
  2060. w = e._vertexFormat,
  2061. C = e._slices,
  2062. x = C + C,
  2063. S = C + x,
  2064. E = x + x,
  2065. b = o.computePositions(r, i, p, C, !0),
  2066. T = w.st ? new Float32Array(2 * E) : void 0,
  2067. A = w.normal ? new Float32Array(3 * E) : void 0,
  2068. M = w.tangent ? new Float32Array(3 * E) : void 0,
  2069. P = w.binormal ? new Float32Array(3 * E) : void 0,
  2070. D = w.normal || w.tangent || w.binormal; if (D) { var I = w.tangent || w.binormal,
  2071. O = 0,
  2072. R = 0,
  2073. L = 0,
  2074. z = v;
  2075. z.z = 0; var N = g,
  2076. F = y; for (t = 0; C > t; t++) { var B = t / C * a.TWO_PI,
  2077. V = Math.cos(B),
  2078. q = Math.sin(B);
  2079. D && (z.x = V, z.y = q, I && (N = n.cross(n.UNIT_Z, z, N).normalize(N)), w.normal && (A[O++] = V, A[O++] = q, A[O++] = 0, A[O++] = V, A[O++] = q, A[O++] = 0), w.tangent && (M[R++] = N.x, M[R++] = N.y, M[R++] = N.z, M[R++] = N.x, M[R++] = N.y, M[R++] = N.z), w.binormal && (F = n.cross(z, N, F).normalize(F), P[L++] = F.x, P[L++] = F.y, P[L++] = F.z, P[L++] = F.x, P[L++] = F.y, P[L++] = F.z)) } for (t = 0; C > t; t++) w.normal && (A[O++] = 0, A[O++] = 0, A[O++] = -1), w.tangent && (M[R++] = 1, M[R++] = 0, M[R++] = 0), w.binormal && (P[L++] = 0, P[L++] = -1, P[L++] = 0); for (t = 0; C > t; t++) w.normal && (A[O++] = 0, A[O++] = 0, A[O++] = 1), w.tangent && (M[R++] = 1, M[R++] = 0, M[R++] = 0), w.binormal && (P[L++] = 0, P[L++] = 1, P[L++] = 0) } var k = 12 * C - 12,
  2080. U = l.createTypedArray(E, k),
  2081. W = 0,
  2082. G = 0; for (t = 0; C - 1 > t; t++) U[W++] = G, U[W++] = G + 2, U[W++] = G + 3, U[W++] = G, U[W++] = G + 3, U[W++] = G + 1, G += 2; for (U[W++] = x - 2, U[W++] = 0, U[W++] = 1, U[W++] = x - 2, U[W++] = 1, U[W++] = x - 1, t = 1; C - 1 > t; t++) U[W++] = x + t + 1, U[W++] = x + t, U[W++] = x; for (t = 1; C - 1 > t; t++) U[W++] = S, U[W++] = S + t, U[W++] = S + t + 1; var H = 0; if (w.st) { var j = Math.max(i, p); for (t = 0; E > t; t++) { var Y = n.fromArray(b, 3 * t, _);
  2083. T[H++] = (Y.x + j) / (2 * j), T[H++] = (Y.y + j) / (2 * j) } } var X = new m;
  2084. w.position && (X.position = new d({ componentDatatype: s.DOUBLE, componentsPerAttribute: 3, values: b })), w.normal && (X.normal = new d({ componentDatatype: s.FLOAT, componentsPerAttribute: 3, values: A })), w.tangent && (X.tangent = new d({ componentDatatype: s.FLOAT, componentsPerAttribute: 3, values: M })), w.binormal && (X.binormal = new d({ componentDatatype: s.FLOAT, componentsPerAttribute: 3, values: P })), w.st && (X.st = new d({ componentDatatype: s.FLOAT, componentsPerAttribute: 2, values: T })), f.x = .5 * r, f.y = Math.max(p, i); var Z = new c(n.ZERO, f.magnitude()); return new h({ attributes: X, indices: U, primitiveType: u.TRIANGLES, boundingSphere: Z }) }, w }), r("Core/CylinderOutlineGeometry", ["./defaultValue", "./defined", "./DeveloperError", "./Cartesian2", "./Cartesian3", "./CylinderGeometryLibrary", "./Math", "./ComponentDatatype", "./IndexDatatype", "./PrimitiveType", "./BoundingSphere", "./Geometry", "./GeometryAttribute", "./GeometryAttributes"], function(e, t, r, i, n, o, a, s, l, u, c, h, d, m) { "use strict"; var p = new i,
  2085. f = function(i) { i = e(i, e.EMPTY_OBJECT); var n = i.length,
  2086. o = i.topRadius,
  2087. a = i.bottomRadius,
  2088. s = e(i.slices, 128),
  2089. l = Math.max(e(i.numberOfVerticalLines, 16), 0); if (!t(n) || 0 >= n) throw new r("options.length must be greater than 0."); if (!t(o) || 0 > o) throw new r("options.topRadius must be greater than 0."); if (!t(a) || 0 > a) throw new r("options.bottomRadius must be greater than 0."); if (0 === a && 0 === o) throw new r("bottomRadius and topRadius cannot both equal 0."); if (3 > s) throw new r("options.slices must be greater that 3.");
  2090. this._length = n, this._topRadius = o, this._bottomRadius = a, this._slices = s, this._numberOfVerticalLines = l, this._workerName = "createCylinderOutlineGeometry" }; return f.createGeometry = function(e) { var t, r = e._length,
  2091. i = e._topRadius,
  2092. a = e._bottomRadius,
  2093. f = e._slices,
  2094. v = e._numberOfVerticalLines,
  2095. y = 2 * f,
  2096. g = o.computePositions(r, i, a, f, !1),
  2097. _ = 2 * f; if (v > 0) { var w = Math.min(v, f);
  2098. t = Math.round(f / w), _ += w } for (var C = l.createTypedArray(y, 2 * _), x = 0, S = 0; f - 1 > S; S++) C[x++] = S, C[x++] = S + 1, C[x++] = S + f, C[x++] = S + 1 + f; if (C[x++] = f - 1, C[x++] = 0, C[x++] = f + f - 1, C[x++] = f, v > 0)
  2099. for (S = 0; f > S; S += t) C[x++] = S, C[x++] = S + f; var E = new m;
  2100. E.position = new d({ componentDatatype: s.DOUBLE, componentsPerAttribute: 3, values: g }), p.x = .5 * r, p.y = Math.max(a, i); var b = new c(n.ZERO, p.magnitude()); return new h({ attributes: E, indices: C, primitiveType: u.LINES, boundingSphere: b }) }, f }), r("Core/DefaultProxy", [], function() { "use strict"; var e = function(e) { this.proxy = e }; return e.prototype.getURL = function(e) { return this.proxy + "?" + encodeURIComponent(e) }, e }), r("Core/EllipsoidGeometry", ["./defaultValue", "./DeveloperError", "./Cartesian3", "./Math", "./Ellipsoid", "./ComponentDatatype", "./IndexDatatype", "./PrimitiveType", "./BoundingSphere", "./Geometry", "./GeometryAttribute", "./GeometryAttributes", "./VertexFormat"], function(e, t, r, i, n, o, a, s, l, u, c, h, d) { "use strict"; var m = new r,
  2101. p = new r,
  2102. f = new r,
  2103. v = new r,
  2104. y = new r(1, 1, 1),
  2105. g = Math.cos,
  2106. _ = Math.sin,
  2107. w = function(i) { i = e(i, e.EMPTY_OBJECT); var n = e(i.radii, y),
  2108. o = e(i.stackPartitions, 64),
  2109. a = e(i.slicePartitions, 64),
  2110. s = e(i.vertexFormat, d.DEFAULT); if (3 > a) throw new t("options.slicePartitions cannot be less than three."); if (3 > o) throw new t("options.stackPartitions cannot be less than three.");
  2111. this._radii = r.clone(n), this._stackPartitions = o, this._slicePartitions = a, this._vertexFormat = s, this._workerName = "createEllipsoidGeometry" }; return w.createGeometry = function(e) { var t, d, y = e._radii,
  2112. w = n.fromCartesian3(y),
  2113. C = e._stackPartitions,
  2114. x = e._slicePartitions,
  2115. S = e._vertexFormat,
  2116. E = 2 + (C - 1) * x,
  2117. b = new Float64Array(3 * E),
  2118. T = 6 * x * (C - 1),
  2119. A = a.createTypedArray(E, T),
  2120. M = S.normal ? new Float32Array(3 * E) : void 0,
  2121. P = S.tangent ? new Float32Array(3 * E) : void 0,
  2122. D = S.binormal ? new Float32Array(3 * E) : void 0,
  2123. I = S.st ? new Float32Array(2 * E) : void 0,
  2124. O = new Array(x),
  2125. R = new Array(x); for (t = 0; x > t; t++) { var L = i.TWO_PI * t / x;
  2126. O[t] = g(L), R[t] = _(L) } var z = 0; for (b[z++] = 0, b[z++] = 0, b[z++] = y.z, t = 1; C > t; t++) { var N = Math.PI * t / C,
  2127. F = _(N),
  2128. B = y.x * F,
  2129. V = y.y * F,
  2130. q = y.z * g(N); for (d = 0; x > d; d++) b[z++] = O[d] * B, b[z++] = R[d] * V, b[z++] = q } b[z++] = 0, b[z++] = 0, b[z++] = -y.z; var k = new h;
  2131. S.position && (k.position = new c({ componentDatatype: o.DOUBLE, componentsPerAttribute: 3, values: b })); var U = 0,
  2132. W = 0,
  2133. G = 0,
  2134. H = 0; if (S.st || S.normal || S.tangent || S.binormal) { for (t = 0; E > t; t++) { var j = r.fromArray(b, 3 * t, m),
  2135. Y = w.geodeticSurfaceNormal(j, p); if (S.st && (I[U++] = Math.atan2(Y.y, Y.x) / i.TWO_PI + .5, I[U++] = Math.asin(Y.z) / Math.PI + .5), S.normal && (M[W++] = Y.x, M[W++] = Y.y, M[W++] = Y.z), S.tangent || S.binormal) { var X = f; if (0 === t || t === E - 1 ? (r.cross(r.UNIT_X, Y, X), r.normalize(X, X)) : (r.cross(r.UNIT_Z, Y, X), r.normalize(X, X)), S.tangent && (P[G++] = X.x, P[G++] = X.y, P[G++] = X.z), S.binormal) { var Z = r.cross(Y, X, v);
  2136. r.normalize(Z, Z), D[H++] = Z.x, D[H++] = Z.y, D[H++] = Z.z } } } S.st && (k.st = new c({ componentDatatype: o.FLOAT, componentsPerAttribute: 2, values: I })), S.normal && (k.normal = new c({ componentDatatype: o.FLOAT, componentsPerAttribute: 3, values: M })), S.tangent && (k.tangent = new c({ componentDatatype: o.FLOAT, componentsPerAttribute: 3, values: P })), S.binormal && (k.binormal = new c({ componentDatatype: o.FLOAT, componentsPerAttribute: 3, values: D })) } for (z = 0, t = 1; x > t; t++) A[z++] = 0, A[z++] = t, A[z++] = t + 1; for (A[z++] = 0, A[z++] = x, A[z++] = 1, t = 0; C - 2 > t; t++) { var K = t * x + 1,
  2137. J = (t + 1) * x + 1; for (d = 0; x - 1 > d; d++) A[z++] = J + d, A[z++] = J + d + 1, A[z++] = K + d + 1, A[z++] = J + d, A[z++] = K + d + 1, A[z++] = K + d;
  2138. A[z++] = J + x - 1, A[z++] = J, A[z++] = K, A[z++] = J + x - 1, A[z++] = K, A[z++] = K + x - 1 } var Q = E - 1; for (t = Q - 1; t > Q - x; t--) A[z++] = Q, A[z++] = t, A[z++] = t - 1; return A[z++] = Q, A[z++] = Q - x, A[z++] = Q - 1, new u({ attributes: k, indices: A, primitiveType: s.TRIANGLES, boundingSphere: l.fromEllipsoid(w) }) }, w }), r("Core/EllipsoidOutlineGeometry", ["./defaultValue", "./DeveloperError", "./Cartesian3", "./Math", "./Ellipsoid", "./ComponentDatatype", "./IndexDatatype", "./PrimitiveType", "./BoundingSphere", "./Geometry", "./GeometryAttribute", "./GeometryAttributes"], function(e, t, r, i, n, o, a, s, l, u, c, h) { "use strict"; var d = new r(1, 1, 1),
  2139. m = Math.cos,
  2140. p = Math.sin,
  2141. f = function(i) { i = e(i, e.EMPTY_OBJECT); var n = e(i.radii, d),
  2142. o = e(i.stackPartitions, 10),
  2143. a = e(i.slicePartitions, 8),
  2144. s = e(i.subdivisions, 128); if (1 > o) throw new t("options.stackPartitions cannot be less than 1"); if (0 > a) throw new t("options.slicePartitions cannot be less than 0"); if (0 > s) throw new t("options.subdivisions must be greater than or equal to zero.");
  2145. this._radii = r.clone(n), this._stackPartitions = o, this._slicePartitions = a, this._subdivisions = s, this._workerName = "createEllipsoidOutlineGeometry" }; return f.createGeometry = function(e) { var t, r, d, f, v, y, g = e._radii,
  2146. _ = n.fromCartesian3(g),
  2147. w = e._stackPartitions,
  2148. C = e._slicePartitions,
  2149. x = e._subdivisions,
  2150. S = x * (w + C - 1),
  2151. E = S - C + 2,
  2152. b = new Float64Array(3 * E),
  2153. T = a.createTypedArray(E, 2 * S),
  2154. A = 0,
  2155. M = new Array(x),
  2156. P = new Array(x); for (t = 0; x > t; t++) d = i.TWO_PI * t / x, M[t] = m(d), P[t] = p(d); for (t = 1; w > t; t++)
  2157. for (f = Math.PI * t / w, v = m(f), y = p(f), r = 0; x > r; r++) b[A++] = g.x * M[r] * y, b[A++] = g.y * P[r] * y, b[A++] = g.z * v; for (M.length = C, P.length = C, t = 0; C > t; t++) d = i.TWO_PI * t / C, M[t] = m(d), P[t] = p(d); for (b[A++] = 0, b[A++] = 0, b[A++] = g.z, t = 1; x > t; t++)
  2158. for (f = Math.PI * t / x, v = m(f), y = p(f), r = 0; C > r; r++) b[A++] = g.x * M[r] * y, b[A++] = g.y * P[r] * y, b[A++] = g.z * v; for (b[A++] = 0, b[A++] = 0, b[A++] = -g.z, A = 0, t = 0; w - 1 > t; ++t) { var D = t * x; for (r = 0; x - 1 > r; ++r) T[A++] = D + r, T[A++] = D + r + 1;
  2159. T[A++] = D + x - 1, T[A++] = D } var I = x * (w - 1); for (r = 1; C + 1 > r; ++r) T[A++] = I, T[A++] = I + r; for (t = 0; x - 2 > t; ++t) { var O = t * C + 1 + I,
  2160. R = (t + 1) * C + 1 + I; for (r = 0; C - 1 > r; ++r) T[A++] = R + r, T[A++] = O + r;
  2161. T[A++] = R + C - 1, T[A++] = O + C - 1 } var L = b.length / 3 - 1; for (r = L - 1; r > L - C - 1; --r) T[A++] = L, T[A++] = r; var z = new h({ position: new c({ componentDatatype: o.DOUBLE, componentsPerAttribute: 3, values: b }) }); return new u({ attributes: z, indices: T, primitiveType: s.LINES, boundingSphere: l.fromEllipsoid(_) }) }, f }), r("Core/EllipsoidalOccluder", ["./defaultValue", "./defined", "./DeveloperError", "./Cartesian3", "./BoundingSphere"], function(e, t, r, i, n) {
  2162. "use strict";
  2163. function o(e, t, r) { var i = e.transformPositionToScaledSpace(t, d),
  2164. n = i.magnitudeSquared(),
  2165. o = Math.sqrt(n),
  2166. a = i.divideByScalar(o, m);
  2167. n = Math.max(1, n), o = Math.max(1, o); var s = a.dot(r),
  2168. l = a.cross(r).magnitude(),
  2169. u = 1 / o,
  2170. c = Math.sqrt(n - 1) * u; return 1 / (s * u - l * c) }
  2171. function a(e, t, r) { return 0 >= t || t === 1 / 0 || t !== t ? void 0 : e.multiplyByScalar(t, r) }
  2172. function s(e, t) { return e.transformPositionToScaledSpace(t, p), p.normalize(p) }
  2173. var l = function(e, n) { if (!t(e)) throw new r("ellipsoid is required.");
  2174. this._ellipsoid = e, this._cameraPosition = new i, this._cameraPositionInScaledSpace = new i, this._distanceToLimbInScaledSpaceSquared = 0, t(n) && this.setCameraPosition(n) };
  2175. l.prototype.getEllipsoid = function() { return this._ellipsoid }, l.prototype.setCameraPosition = function(e) {
  2176. var t = this._ellipsoid,
  2177. r = t.transformPositionToScaledSpace(e, this._cameraPositionInScaledSpace),
  2178. n = i.magnitudeSquared(r) - 1;
  2179. i.clone(e, this._cameraPosition), this._cameraPositionInScaledSpace = r, this._distanceToLimbInScaledSpaceSquared = n
  2180. }, l.prototype.getCameraPosition = function() { return this._cameraPosition };
  2181. var u = new i;
  2182. l.prototype.isPointVisible = function(e) { var t = this._ellipsoid,
  2183. r = t.transformPositionToScaledSpace(e, u); return this.isScaledSpacePointVisible(r) }, l.prototype.isScaledSpacePointVisible = function(e) { var t = this._cameraPositionInScaledSpace,
  2184. r = this._distanceToLimbInScaledSpaceSquared,
  2185. n = i.subtract(e, t, u),
  2186. o = -n.dot(t),
  2187. a = o > r && o * o / n.magnitudeSquared() > r; return !a }, l.prototype.computeHorizonCullingPoint = function(e, i, n) { if (!t(e)) throw new r("directionToPoint is required"); if (!t(i)) throw new r("positions is required"); for (var l = this._ellipsoid, u = s(l, e), c = 0, h = 0, d = i.length; d > h; ++h) { var m = i[h],
  2188. p = o(l, m, u);
  2189. c = Math.max(c, p) } return a(u, c, n) };
  2190. var c = new i;
  2191. l.prototype.computeHorizonCullingPointFromVertices = function(n, l, u, h, d) { if (!t(n)) throw new r("directionToPoint is required"); if (!t(l)) throw new r("vertices is required"); if (!t(u)) throw new r("stride is required");
  2192. h = e(h, i.ZERO); for (var m = this._ellipsoid, p = s(m, n), f = 0, v = 0, y = l.length; y > v; v += u) { c.x = l[v] + h.x, c.y = l[v + 1] + h.y, c.z = l[v + 2] + h.z; var g = o(m, c, p);
  2193. f = Math.max(f, g) } return a(p, f, d) };
  2194. var h = [];
  2195. l.prototype.computeHorizonCullingPointFromExtent = function(e, i, o) { if (!t(e)) throw new r("extent is required."); var a = e.subsample(i, 0, h),
  2196. s = n.fromPoints(a); return s.center.magnitude() < .1 * i.getMinimumRadius() ? void 0 : this.computeHorizonCullingPoint(s.center, a, o) };
  2197. var d = new i,
  2198. m = new i,
  2199. p = new i;
  2200. return l
  2201. }), r("Core/EventHelper", ["./defined", "./DeveloperError"], function(e, t) { "use strict"; var r = function() { this._removalFunctions = [] }; return r.prototype.add = function(r, i, n) { if (!e(r)) throw new t("event is required");
  2202. this._removalFunctions.push(r.addEventListener(i, n)) }, r.prototype.removeAll = function() { for (var e = this._removalFunctions, t = 0, r = e.length; r > t; ++t) e[t]();
  2203. e.length = 0 }, r }), r("Core/Extent", ["./freezeObject", "./defaultValue", "./defined", "./Ellipsoid", "./Cartographic", "./DeveloperError", "./Math"], function(e, t, r, i, n, o, a) { "use strict"; var s = function(e, r, i, n) { this.west = t(e, 0), this.south = t(r, 0), this.east = t(i, 0), this.north = t(n, 0) };
  2204. s.fromDegrees = function(e, i, n, o, l) { return e = a.toRadians(t(e, 0)), i = a.toRadians(t(i, 0)), n = a.toRadians(t(n, 0)), o = a.toRadians(t(o, 0)), r(l) ? (l.west = e, l.south = i, l.east = n, l.north = o, l) : new s(e, i, n, o) }, s.fromCartographicArray = function(e, t) { if (!r(e)) throw new o("cartographics is required."); for (var i = Number.MAX_VALUE, n = -Number.MAX_VALUE, a = Number.MAX_VALUE, l = -Number.MAX_VALUE, u = 0, c = e.length; c > u; u++) { var h = e[u];
  2205. i = Math.min(i, h.longitude), n = Math.max(n, h.longitude), a = Math.min(a, h.latitude), l = Math.max(l, h.latitude) } return r(t) ? (t.west = i, t.south = a, t.east = n, t.north = l, t) : new s(i, a, n, l) }, s.clone = function(e, t) { return r(e) ? r(t) ? (t.west = e.west, t.south = e.south, t.east = e.east, t.north = e.north, t) : new s(e.west, e.south, e.east, e.north) : void 0 }, s.prototype.clone = function(e) { return s.clone(this, e) }, s.prototype.equals = function(e) { return s.equals(this, e) }, s.equals = function(e, t) { return e === t || r(e) && r(t) && e.west === t.west && e.south === t.south && e.east === t.east && e.north === t.north }, s.prototype.equalsEpsilon = function(e, t) { if ("number" != typeof t) throw new o("epsilon is required and must be a number."); return r(e) && Math.abs(this.west - e.west) <= t && Math.abs(this.south - e.south) <= t && Math.abs(this.east - e.east) <= t && Math.abs(this.north - e.north) <= t }, s.prototype.validate = function() { var e = this.north; if ("number" != typeof e) throw new o("north is required to be a number."); if (e < -a.PI_OVER_TWO || e > a.PI_OVER_TWO) throw new o("north must be in the interval [-Pi/2, Pi/2]."); var t = this.south; if ("number" != typeof t) throw new o("south is required to be a number."); if (t < -a.PI_OVER_TWO || t > a.PI_OVER_TWO) throw new o("south must be in the interval [-Pi/2, Pi/2]."); var r = this.west; if ("number" != typeof r) throw new o("west is required to be a number."); if (r < -Math.PI || r > Math.PI) throw new o("west must be in the interval [-Pi, Pi]."); var i = this.east; if ("number" != typeof i) throw new o("east is required to be a number."); if (i < -Math.PI || i > Math.PI) throw new o("east must be in the interval [-Pi, Pi].") }, s.prototype.getSouthwest = function(e) { return r(e) ? (e.longitude = this.west, e.latitude = this.south, e.height = 0, e) : new n(this.west, this.south) }, s.prototype.getNorthwest = function(e) { return r(e) ? (e.longitude = this.west, e.latitude = this.north, e.height = 0, e) : new n(this.west, this.north) }, s.prototype.getNortheast = function(e) { return r(e) ? (e.longitude = this.east, e.latitude = this.north, e.height = 0, e) : new n(this.east, this.north) }, s.prototype.getSoutheast = function(e) { return r(e) ? (e.longitude = this.east, e.latitude = this.south, e.height = 0, e) : new n(this.east, this.south) }, s.prototype.getCenter = function(e) { return r(e) ? (e.longitude = .5 * (this.west + this.east), e.latitude = .5 * (this.south + this.north), e.height = 0, e) : new n(.5 * (this.west + this.east), .5 * (this.south + this.north)) }, s.prototype.intersectWith = function(e, t) { if (!r(e)) throw new o("otherExtent is required."); var i = Math.max(this.west, e.west),
  2206. n = Math.max(this.south, e.south),
  2207. a = Math.min(this.east, e.east),
  2208. l = Math.min(this.north, e.north); return r(t) ? (t.west = i, t.south = n, t.east = a, t.north = l, t) : new s(i, n, a, l) }, s.prototype.contains = function(e) { if (!r(e)) throw new o("cartographic is required."); return e.longitude >= this.west && e.longitude <= this.east && e.latitude >= this.south && e.latitude <= this.north }, s.prototype.isEmpty = function() { return this.west >= this.east || this.south >= this.north }; var l = new n; return s.prototype.subsample = function(e, n, o) { e = t(e, i.WGS84), n = t(n, 0), r(o) || (o = []); var s = 0,
  2209. u = this.north,
  2210. c = this.south,
  2211. h = this.east,
  2212. d = this.west,
  2213. m = l;
  2214. m.height = n, m.longitude = d, m.latitude = u, o[s] = e.cartographicToCartesian(m, o[s]), s++, m.longitude = h, o[s] = e.cartographicToCartesian(m, o[s]), s++, m.latitude = c, o[s] = e.cartographicToCartesian(m, o[s]), s++, m.longitude = d, o[s] = e.cartographicToCartesian(m, o[s]), s++, m.latitude = 0 > u ? u : c > 0 ? c : 0; for (var p = 1; 8 > p; ++p) { var f = -Math.PI + p * a.PI_OVER_TWO;
  2215. f > d && h > f && (m.longitude = f, o[s] = e.cartographicToCartesian(m, o[s]), s++) } return 0 === m.latitude && (m.longitude = d, o[s] = e.cartographicToCartesian(m, o[s]), s++, m.longitude = h, o[s] = e.cartographicToCartesian(m, o[s]), s++), o.length = s, o }, s.MAX_VALUE = e(new s(-Math.PI, -a.PI_OVER_TWO, Math.PI, a.PI_OVER_TWO)), s }), r("Core/Matrix2", ["./Cartesian2", "./defaultValue", "./defined", "./DeveloperError", "./freezeObject"], function(e, t, r, i, n) { "use strict"; var o = function(e, r, i, n) { this[0] = t(e, 0), this[1] = t(i, 0), this[2] = t(r, 0), this[3] = t(n, 0) }; return o.clone = function(e, t) { return r(e) ? r(t) ? (t[0] = e[0], t[1] = e[1], t[2] = e[2], t[3] = e[3], t) : new o(e[0], e[2], e[1], e[3]) : void 0 }, o.fromColumnMajorArray = function(e, t) { if (!r(e)) throw new i("values parameter is required"); return o.clone(e, t) }, o.fromRowMajorArray = function(e, t) { if (!r(e)) throw new i("values is required."); return r(t) ? (t[0] = e[0], t[1] = e[2], t[2] = e[1], t[3] = e[3], t) : new o(e[0], e[1], e[2], e[3]) }, o.fromScale = function(e, t) { if (!r(e)) throw new i("scale is required."); return r(t) ? (t[0] = e.x, t[1] = 0, t[2] = 0, t[3] = e.y, t) : new o(e.x, 0, 0, e.y) }, o.fromUniformScale = function(e, t) { if ("number" != typeof e) throw new i("scale is required."); return r(t) ? (t[0] = e, t[1] = 0, t[2] = 0, t[3] = e, t) : new o(e, 0, 0, e) }, o.fromRotation = function(e, t) { if (!r(e)) throw new i("angle is required."); var n = Math.cos(e),
  2216. a = Math.sin(e); return r(t) ? (t[0] = n, t[1] = a, t[2] = -a, t[3] = n, t) : new o(n, -a, a, n) }, o.toArray = function(e, t) { if (!r(e)) throw new i("matrix is required"); return r(t) ? (t[0] = e[0], t[1] = e[1], t[2] = e[2], t[3] = e[3], t) : [e[0], e[1], e[2], e[3]] }, o.getElementIndex = function(e, t) { if ("number" != typeof t || 0 > t || t > 1) throw new i("row is required and must be 0 or 1."); if ("number" != typeof e || 0 > e || e > 1) throw new i("column is required and must be 0 or 1."); return 2 * e + t }, o.getColumn = function(t, n, o) { if (!r(t)) throw new i("matrix is required."); if ("number" != typeof n || 0 > n || n > 1) throw new i("index is required and must be 0 or 1."); var a = 2 * n,
  2217. s = t[a],
  2218. l = t[a + 1]; return r(o) ? (o.x = s, o.y = l, o) : new e(s, l) }, o.setColumn = function(e, t, n, a) { if (!r(e)) throw new i("matrix is required"); if (!r(n)) throw new i("cartesian is required"); if ("number" != typeof t || 0 > t || t > 1) throw new i("index is required and must be 0 or 1.");
  2219. a = o.clone(e, a); var s = 2 * t; return a[s] = n.x, a[s + 1] = n.y, a }, o.getRow = function(t, n, o) { if (!r(t)) throw new i("matrix is required."); if ("number" != typeof n || 0 > n || n > 1) throw new i("index is required and must be 0 or 1."); var a = t[n],
  2220. s = t[n + 2]; return r(o) ? (o.x = a, o.y = s, o) : new e(a, s) }, o.setRow = function(e, t, n, a) { if (!r(e)) throw new i("matrix is required"); if (!r(n)) throw new i("cartesian is required"); if ("number" != typeof t || 0 > t || t > 1) throw new i("index is required and must be 0 or 1."); return a = o.clone(e, a), a[t] = n.x, a[t + 2] = n.y, a }, o.multiply = function(e, t, n) { if (!r(e)) throw new i("left is required"); if (!r(t)) throw new i("right is required"); var a = e[0] * t[0] + e[2] * t[1],
  2221. s = e[0] * t[2] + e[2] * t[3],
  2222. l = e[1] * t[0] + e[3] * t[1],
  2223. u = e[1] * t[2] + e[3] * t[3]; return r(n) ? (n[0] = a, n[1] = l, n[2] = s, n[3] = u, n) : new o(a, s, l, u) }, o.multiplyByVector = function(t, n, o) { if (!r(t)) throw new i("matrix is required"); if (!r(n)) throw new i("cartesian is required"); var a = t[0] * n.x + t[2] * n.y,
  2224. s = t[1] * n.x + t[3] * n.y; return r(o) ? (o.x = a, o.y = s, o) : new e(a, s) }, o.multiplyByScalar = function(e, t, n) { if (!r(e)) throw new i("matrix is required"); if ("number" != typeof t) throw new i("scalar is required and must be a number"); return r(n) ? (n[0] = e[0] * t, n[1] = e[1] * t, n[2] = e[2] * t, n[3] = e[3] * t, n) : new o(e[0] * t, e[2] * t, e[1] * t, e[3] * t) }, o.negate = function(e, t) { if (!r(e)) throw new i("matrix is required"); return r(t) ? (t[0] = -e[0], t[1] = -e[1], t[2] = -e[2], t[3] = -e[3], t) : new o(-e[0], -e[2], -e[1], -e[3]) }, o.transpose = function(e, t) { if (!r(e)) throw new i("matrix is required"); var n = e[0],
  2225. a = e[2],
  2226. s = e[1],
  2227. l = e[3]; return r(t) ? (t[0] = n, t[1] = a, t[2] = s, t[3] = l, t) : new o(n, s, a, l) }, o.equals = function(e, t) { return e === t || r(e) && r(t) && e[0] === t[0] && e[1] === t[1] && e[2] === t[2] && e[3] === t[3] }, o.equalsEpsilon = function(e, t, n) { if ("number" != typeof n) throw new i("epsilon is required and must be a number"); return e === t || r(e) && r(t) && Math.abs(e[0] - t[0]) <= n && Math.abs(e[1] - t[1]) <= n && Math.abs(e[2] - t[2]) <= n && Math.abs(e[3] - t[3]) <= n }, o.IDENTITY = n(new o(1, 0, 0, 1)), o.COLUMN0ROW0 = 0, o.COLUMN0ROW1 = 1, o.COLUMN1ROW0 = 2, o.COLUMN1ROW1 = 3, o.prototype.clone = function(e) { return o.clone(this, e) }, o.prototype.toArray = function(e) { return o.toArray(this, e) }, o.prototype.getColumn = function(e, t) { return o.getColumn(this, e, t) }, o.prototype.setColumn = function(e, t, r) { return o.setColumn(this, e, t, r) }, o.prototype.getRow = function(e, t) { return o.getRow(this, e, t) }, o.prototype.setRow = function(e, t, r) { return o.setRow(this, e, t, r) }, o.prototype.multiply = function(e, t) { return o.multiply(this, e, t) }, o.prototype.multiplyByVector = function(e, t) { return o.multiplyByVector(this, e, t) }, o.prototype.multiplyByScalar = function(e, t) { return o.multiplyByScalar(this, e, t) }, o.prototype.negate = function(e) { return o.negate(this, e) }, o.prototype.transpose = function(e) { return o.transpose(this, e) }, o.prototype.equals = function(e) { return o.equals(this, e) }, o.prototype.equalsEpsilon = function(e, t) { return o.equalsEpsilon(this, e, t) }, o.prototype.toString = function() { return "(" + this[0] + ", " + this[2] + ")\n" + "(" + this[1] + ", " + this[3] + ")" }, o }), r("Core/ExtentGeometry", ["./defaultValue", "./defined", "./BoundingSphere", "./Cartesian2", "./Cartesian3", "./Cartographic", "./ComponentDatatype", "./IndexDatatype", "./DeveloperError", "./Ellipsoid", "./Extent", "./Geometry", "./GeometryInstance", "./GeometryPipeline", "./GeographicProjection", "./GeometryAttribute", "./GeometryAttributes", "./Math", "./Matrix2", "./Matrix3", "./PrimitiveType", "./Quaternion", "./VertexFormat"], function(e, t, r, i, n, o, a, s, l, u, c, h, d, m, p, f, v, y, g, _, w, C, x) { "use strict";
  2228. function S(e, t) { return e < -y.PI_OVER_TWO || e > y.PI_OVER_TWO ? !1 : t > y.PI || t < -y.PI ? !1 : !0 }
  2229. function E(e, r, i, n, o) { var a = e.radiiSquared;
  2230. O = z.latitude - e.granYCos * r + i * e.granXSin; var s = et(O),
  2231. l = tt(O),
  2232. u = a.z * l;
  2233. R = z.longitude + r * e.granYSin + i * e.granXCos; var c = s * et(R),
  2234. h = s * tt(R),
  2235. d = a.x * c,
  2236. m = a.y * h,
  2237. p = rt(d * c + m * h + u * l),
  2238. f = d / p,
  2239. v = m / p,
  2240. y = u / p;
  2241. t(n) && (W.x = f + c * n, W.y = v + h * n, W.z = y + l * n), t(o) && (Y.x = f + c * o, Y.y = v + h * o, Y.z = y + l * o) }
  2242. function b(e, t) { var r = new h({ attributes: new v, primitiveType: w.TRIANGLES }); return e.position && (r.attributes.position = new f({ componentDatatype: a.DOUBLE, componentsPerAttribute: 3, values: t.positions })), e.normal && (r.attributes.normal = new f({ componentDatatype: a.FLOAT, componentsPerAttribute: 3, values: t.normals })), e.tangent && (r.attributes.tangent = new f({ componentDatatype: a.FLOAT, componentsPerAttribute: 3, values: t.tangents })), e.binormal && (r.attributes.binormal = new f({ componentDatatype: a.FLOAT, componentsPerAttribute: 3, values: t.binormals })), r }
  2243. function T(e, t, r, i, o) { var a = e.length,
  2244. s = t.normal ? new Float32Array(a) : void 0,
  2245. l = t.tangent ? new Float32Array(a) : void 0,
  2246. u = t.binormal ? new Float32Array(a) : void 0,
  2247. c = 0,
  2248. h = i ? a / 2 : 0;
  2249. a = i && o ? a / 2 : a; for (var d = 0; a > d; d += 3) { var m = n.fromArray(e, d, W),
  2250. p = c + 1,
  2251. f = c + 2;
  2252. (t.normal || t.tangent || t.binormal) && (G = r.geodeticSurfaceNormal(m, G), (t.tangent || t.binormal) && (n.cross(n.UNIT_Z, G, H), _.multiplyByVector(k, H, H), n.normalize(H, H), t.binormal && n.cross(G, H, j).normalize(j)), i && (t.normal && (s[c] = G.x, s[p] = G.y, s[f] = G.z), t.tangent && (l[c] = H.x, l[p] = H.y, l[f] = H.z), t.binormal && (u[c] = j.x, u[p] = j.y, u[f] = j.z)), o && (t.normal && (s[c + h] = -G.x, s[p + h] = -G.y, s[f + h] = -G.z), t.tangent && (l[c + h] = -H.x, l[p + h] = -H.y, l[f + h] = -H.z), t.binormal && (u[c + h] = j.x, u[p + h] = j.y, u[f + h] = j.z))), c += 3 } return b(t, { positions: e, normals: s, tangents: l, binormals: u }) }
  2253. function A(e, t, r) { for (var i = e.length, o = t.normal ? new Float32Array(i) : void 0, a = t.tangent ? new Float32Array(i) : void 0, s = t.binormal ? new Float32Array(i) : void 0, l = 0, u = !0, c = i / 2, h = 0; c > h; h += 3) { var d = n.fromArray(e, h, W),
  2254. m = l + 1,
  2255. p = l + 2; if (t.normal || t.tangent || t.binormal) { var f = n.fromArray(e, h + 3, K); if (u) { var v = n.fromArray(e, h + c, J);
  2256. f = f.subtract(d, f), v = v.subtract(d, v), G = v.cross(f, G).normalize(G), u = !1 } f.equalsEpsilon(d, y.EPSILON10) && (u = !0), (t.tangent || t.binormal) && (j = r.geodeticSurfaceNormal(d, j), t.tangent && (H = n.cross(j, G, H).normalize(H))), t.normal && (o[l] = G.x, o[m] = G.y, o[p] = G.z, o[l + c] = G.x, o[m + c] = G.y, o[p + c] = G.z), t.tangent && (a[l] = H.x, a[m] = H.y, a[p] = H.z, a[l + c] = H.x, a[m + c] = H.y, a[p + c] = H.z), t.binormal && (s[l] = j.x, s[m] = j.y, s[p] = j.z, s[l + c] = j.x, s[m + c] = j.y, s[p + c] = j.z) } l += 3 } return b(t, { positions: e, normals: o, tangents: a, binormals: s }) }
  2257. function M(e, r, i, n, o) { return Q.x = (R - B.west) * n.lonScalar - .5, Q.y = (O - B.south) * n.latScalar - .5, g.multiplyByVector(V, Q, Q), Q.x += .5, Q.y += .5, t(o) && (i[r + o] = Q.x, i[r + 1 + o] = Q.y), i[r++] = Q.x, i[r++] = Q.y, r }
  2258. function P(e, t, r) { return e[t + r] = Y.x, e[t++] = W.x, e[t + r] = Y.y, e[t++] = W.y, e[t + r] = Y.z, e[t++] = W.z, e }
  2259. function D(e, t) { for (var i = t.ellipsoid, n = t.size, o = t.height, l = t.width, u = t.surfaceHeight, c = 0, h = e.position ? new Float64Array(3 * n) : void 0, d = e.st ? new Float32Array(2 * n) : void 0, m = 0, p = 0; o > p; ++p)
  2260. for (var v = 0; l > v; ++v) E(t, p, v, u), h[m++] = W.x, h[m++] = W.y, h[m++] = W.z, e.st && (Q.x = (R - B.west) * t.lonScalar - .5, Q.y = (O - B.south) * t.latScalar - .5, g.multiplyByVector(V, Q, Q), Q.x += .5, Q.y += .5, d[c++] = Q.x, d[c++] = Q.y); for (var y = T(h, e, i, !0, !1), _ = 6 * (l - 1) * (o - 1), w = s.createTypedArray(n, _), C = 0, x = 0, S = 0; o - 1 > S; ++S) { for (var b = 0; l - 1 > b; ++b) { var A = C,
  2261. M = A + l,
  2262. P = M + 1,
  2263. D = A + 1;
  2264. w[x++] = A, w[x++] = M, w[x++] = D, w[x++] = D, w[x++] = M, w[x++] = P, ++C }++C } return y.indices = w, e.st && (y.attributes.st = new f({ componentDatatype: a.FLOAT, componentsPerAttribute: 2, values: d })), { boundingSphere: r.fromExtent3D(t.extent, i, u), geometry: y } }
  2265. function I(t, i) { var o = i.surfaceHeight,
  2266. l = i.extrudedHeight,
  2267. u = Math.min(l, o),
  2268. c = Math.max(l, o); if (y.equalsEpsilon(u, c, .1)) return D(t, i); var h, p = i.height,
  2269. v = i.width,
  2270. g = i.size,
  2271. _ = i.ellipsoid,
  2272. w = e(i.closeTop, !0),
  2273. C = e(i.closeBottom, !0),
  2274. x = 2 * v + 2 * p - 4,
  2275. S = 2 * (x + 4),
  2276. b = new Float64Array(3 * S),
  2277. I = t.st ? new Float32Array(2 * S) : void 0,
  2278. O = 0,
  2279. R = 0,
  2280. L = 0,
  2281. z = 3 * (S / 2); for (h = 0; p > h; h++) E(i, h, O, c, u), b = P(b, R, z), R += 3, t.st && (L = M(t, L, I, i, S)); for (h = p - 1, O = 0; v > O; O++) E(i, h, O, c, u), b = P(b, R, z), R += 3, t.st && (L = M(t, L, I, i, S)); for (O = v - 1, h = p - 1; h >= 0; h--) E(i, h, O, c, u), b = P(b, R, z), R += 3, t.st && (L = M(t, L, I, i, S)); for (h = 0, O = v - 1; O >= 0; O--) E(i, h, O, c, u), b = P(b, R, z), R += 3, t.st && (L = M(t, L, I, i, S)); var N = A(b, t, _);
  2282. t.st && (N.attributes.st = new f({ componentDatatype: a.FLOAT, componentsPerAttribute: 2, values: I })); var F, B, V, q, k, U = s.createTypedArray(S, 6 * x),
  2283. G = b.length / 6,
  2284. H = 0; for (k = 0; G - 1 > k; k++) { F = k, q = F + 1; var j = n.fromArray(b, 3 * F, K),
  2285. Q = n.fromArray(b, 3 * q, J);
  2286. j.equalsEpsilon(Q, y.EPSILON10) || (B = F + G, V = B + 1, U[H++] = F, U[H++] = B, U[H++] = q, U[H++] = q, U[H++] = B, U[H++] = V) } if (N.indices = U, C || w) { var $, et, tt = 0,
  2287. rt = 0;
  2288. w && (tt += g, rt += 6 * (v - 1) * (p - 1), $ = c), C && (tt += g, rt += 6 * (v - 1) * (p - 1), et = u); var it = new Float64Array(3 * tt),
  2289. nt = t.st ? new Float32Array(2 * tt) : void 0,
  2290. ot = s.createTypedArray(tt, rt); for (R = 0, L = 0, z = C && w ? 3 * g : 0, h = 0; p > h; ++h)
  2291. for (O = 0; v > O; ++O) E(i, h, O, $, et), C && (it[R + z] = Y.x, it[R + 1 + z] = Y.y, it[R + 2 + z] = Y.z), w && (it[R] = W.x, it[R + 1] = W.y, it[R + 2] = W.z), t.st && (L = M(t, L, nt, i, 2 * g)), R += 3; var at = T(it, t, _, w, C);
  2292. t.st && (at.attributes.st = new f({ componentDatatype: a.FLOAT, componentsPerAttribute: 2, values: nt })); var st = 0; for (H = 0, z /= 3, k = 0; p - 1 > k; ++k) { for (var lt = 0; v - 1 > lt; ++lt) F = H, B = F + v, V = B + 1, q = F + 1, C && (ot[st++] = q + z, ot[st++] = B + z, ot[st++] = F + z, ot[st++] = V + z, ot[st++] = B + z, ot[st++] = q + z), w && (ot[st++] = F, ot[st++] = B, ot[st++] = q, ot[st++] = q, ot[st++] = B, ot[st++] = V), ++H;++H } at.indices = ot, N = m.combine([new d({ geometry: at }), new d({ geometry: N })]) } var ut = r.fromExtent3D(i.extent, _, c, Z),
  2293. ct = r.fromExtent3D(i.extent, _, u, X),
  2294. ht = r.union(ut, ct); return { boundingSphere: ht, geometry: N } } var O, R, L = new n,
  2295. z = new o,
  2296. N = new o,
  2297. F = new n,
  2298. B = new c,
  2299. V = new g,
  2300. q = new g,
  2301. k = new _,
  2302. U = new p,
  2303. W = new n,
  2304. G = new n,
  2305. H = new n,
  2306. j = new n,
  2307. Y = new n,
  2308. X = new r,
  2309. Z = new r,
  2310. K = new n,
  2311. J = new n,
  2312. Q = new i,
  2313. $ = new C,
  2314. et = Math.cos,
  2315. tt = Math.sin,
  2316. rt = Math.sqrt,
  2317. it = function(r) { r = e(r, e.EMPTY_OBJECT); var i = r.extent,
  2318. n = e(r.granularity, y.RADIANS_PER_DEGREE),
  2319. o = e(r.ellipsoid, u.WGS84),
  2320. a = e(r.height, 0),
  2321. s = r.rotation,
  2322. c = r.stRotation,
  2323. h = e(r.vertexFormat, x.DEFAULT); if (!t(i)) throw new l("extent is required.");
  2324. i.validate(), this._extent = i, this._granularity = n, this._ellipsoid = o, this._surfaceHeight = a, this._rotation = s, this._stRotation = c, this._vertexFormat = h, this._extrudedHeight = r.extrudedHeight, this._closeTop = r.closeTop, this._closeBottom = r.closeBottom, this._workerName = "createExtentGeometry" }; return it.createGeometry = function(e) { var r = e._extent,
  2325. i = e._granularity,
  2326. o = e._ellipsoid,
  2327. a = e._surfaceHeight,
  2328. s = e._rotation,
  2329. u = e._stRotation,
  2330. d = e._vertexFormat,
  2331. m = e._extrudedHeight,
  2332. p = e._closeTop,
  2333. f = e._closeBottom,
  2334. y = Math.ceil((r.east - r.west) / i) + 1,
  2335. w = Math.ceil((r.north - r.south) / i) + 1,
  2336. x = (r.east - r.west) / (y - 1),
  2337. E = (r.north - r.south) / (w - 1),
  2338. b = o.getRadiiSquared();
  2339. c.clone(r, B), r.getNorthwest(z), r.getCenter(N); var T = E,
  2340. A = x,
  2341. M = 0,
  2342. P = 0; if (t(s)) { var O = et(s);
  2343. T *= O, A *= O; var R = tt(s);
  2344. M = E * R, P = x * R, U.project(z, L), U.project(N, F), L.subtract(F, L), g.fromRotation(s, q), q.multiplyByVector(L, L), L.add(F, L), U.unproject(L, z); var W = z.latitude,
  2345. G = W + (y - 1) * P,
  2346. H = W - T * (w - 1),
  2347. j = W - T * (w - 1) + (y - 1) * P,
  2348. Y = Math.max(W, G, H, j),
  2349. X = Math.min(W, G, H, j),
  2350. Z = z.longitude,
  2351. J = Z + (y - 1) * A,
  2352. Q = Z + (w - 1) * M,
  2353. rt = Z + (w - 1) * M + (y - 1) * A,
  2354. it = Math.max(Z, J, Q, rt),
  2355. nt = Math.min(Z, J, Q, rt); if (!(S(Y, nt) && S(Y, it) && S(X, nt) && S(X, it))) throw new l("Rotated extent is invalid.");
  2356. B.north = Y, B.south = X, B.east = it, B.west = nt } var ot = 1 / (B.east - B.west),
  2357. at = 1 / (B.north - B.south),
  2358. st = y * w; if (t(u)) { g.fromRotation(-u, V); var lt = o.cartographicToCartesian(N, K);
  2359. n.normalize(lt, lt), C.fromAxisAngle(lt, -u, $), _.fromQuaternion($, k) } else g.clone(g.IDENTITY, V), _.clone(_.IDENTITY, k); var ut, ct = { granYCos: T, granYSin: M, granXCos: A, granXSin: P, radiiSquared: b, ellipsoid: o, lonScalar: ot, latScalar: at, extent: r, width: y, height: w, surfaceHeight: a, size: st, extrudedHeight: m, closeTop: p, closeBottom: f };
  2360. ut = t(m) ? I(d, ct) : D(d, ct); var ht = ut.boundingSphere; return ut = ut.geometry, new h({ attributes: new v(ut.attributes), indices: ut.indices, primitiveType: ut.primitiveType, boundingSphere: ht }) }, it }), r("Core/ExtentOutlineGeometry", ["./defaultValue", "./defined", "./BoundingSphere", "./Cartesian3", "./Cartographic", "./ComponentDatatype", "./IndexDatatype", "./DeveloperError", "./Ellipsoid", "./GeographicProjection", "./Geometry", "./GeometryAttribute", "./GeometryAttributes", "./Math", "./Matrix2", "./PrimitiveType"], function(e, t, r, i, n, o, a, s, l, u, c, h, d, m, p, f) { "use strict";
  2361. function v(e, t) { return e < -m.PI_OVER_TWO || e > m.PI_OVER_TWO ? !1 : t > m.PI || t < -m.PI ? !1 : !0 }
  2362. function y(e, r, i, n, o) { var a = e.radiiSquared;
  2363. w = S.latitude - e.granYCos * r + i * e.granXSin; var s = O(w),
  2364. l = R(w),
  2365. u = a.z * l;
  2366. C = S.longitude + r * e.granYSin + i * e.granXCos; var c = s * O(C),
  2367. h = s * R(C),
  2368. d = a.x * c,
  2369. m = a.y * h,
  2370. p = L(d * c + m * h + u * l),
  2371. f = d / p,
  2372. v = m / p,
  2373. y = u / p;
  2374. t(n) && (M.x = f + c * n, M.y = v + h * n, M.z = y + l * n), t(o) && (P.x = f + c * o, P.y = v + h * o, P.z = y + l * o) }
  2375. function g(e) { var t, i = e.extent,
  2376. n = e.ellipsoid,
  2377. o = e.size,
  2378. s = e.height,
  2379. l = e.width,
  2380. u = e.surfaceHeight,
  2381. c = new Float64Array(3 * o),
  2382. h = 0,
  2383. d = 0; for (t = 0; l > t; t++) y(e, d, t, u), c[h++] = M.x, c[h++] = M.y, c[h++] = M.z; for (t = l - 1, d = 1; s > d; d++) y(e, d, t, u), c[h++] = M.x, c[h++] = M.y, c[h++] = M.z; for (d = s - 1, t = l - 2; t >= 0; t--) y(e, d, t, u), c[h++] = M.x, c[h++] = M.y, c[h++] = M.z; for (t = 0, d = s - 2; d > 0; d--) y(e, d, t, u), c[h++] = M.x, c[h++] = M.y, c[h++] = M.z; for (var m = 2 * (c.length / 3), p = a.createTypedArray(c.length / 3, m), f = 0, v = 0; v < c.length / 3 - 1; v++) p[f++] = v, p[f++] = v + 1; return p[f++] = c.length / 3 - 1, p[f++] = 0, { boundingSphere: r.fromExtent3D(i, n, u), positions: c, indices: p } }
  2384. function _(e, t) { var i = e.surfaceHeight,
  2385. n = Math.min(t, i),
  2386. o = Math.max(t, i); if (m.equalsEpsilon(n, o, .1)) return g(e); var s, l = e.extent,
  2387. u = e.height,
  2388. c = e.width,
  2389. h = 3 * e.size,
  2390. d = e.ellipsoid,
  2391. p = 0,
  2392. f = 0,
  2393. v = new Float64Array(2 * h); for (s = 0; c > s; s++) y(e, f, s, o, n), v[p + h] = P.x, v[p + h + 1] = P.y, v[p + h + 2] = P.z, v[p++] = M.x, v[p++] = M.y, v[p++] = M.z; for (s = c - 1, f = 1; u > f; f++) y(e, f, s, o, n), v[p + h] = P.x, v[p + h + 1] = P.y, v[p + h + 2] = P.z, v[p++] = M.x, v[p++] = M.y, v[p++] = M.z; for (f = u - 1, s = c - 2; s >= 0; s--) y(e, f, s, o, n), v[p + h] = P.x, v[p + h + 1] = P.y, v[p + h + 2] = P.z, v[p++] = M.x, v[p++] = M.y, v[p++] = M.z; for (s = 0, f = u - 2; f > 0; f--) y(e, f, s, o, n), v[p + h] = P.x, v[p + h + 1] = P.y, v[p + h + 2] = P.z, v[p++] = M.x, v[p++] = M.y, v[p++] = M.z; for (var _ = 2 * (v.length / 3) + 8, w = a.createTypedArray(v.length / 3, _), C = v.length / 6, x = 0, S = 0; C - 1 > S; S++) w[x++] = S, w[x++] = S + 1, w[x++] = S + C, w[x++] = S + C + 1;
  2394. w[x++] = C - 1, w[x++] = 0, w[x++] = C + C - 1, w[x++] = C, w[x++] = 0, w[x++] = C, w[x++] = c - 1, w[x++] = C + c - 1, w[x++] = c + u - 2, w[x++] = c + u - 2 + C, w[x++] = 2 * c + u - 3, w[x++] = 2 * c + u - 3 + C; var E = r.fromExtent3D(l, d, o, I),
  2395. b = r.fromExtent3D(l, d, n, D),
  2396. T = r.union(E, b); return { boundingSphere: T, positions: v, indices: w } } var w, C, x = new i,
  2397. S = new n,
  2398. E = new n,
  2399. b = new i,
  2400. T = new p,
  2401. A = new u,
  2402. M = new i,
  2403. P = new i,
  2404. D = new r,
  2405. I = new r,
  2406. O = Math.cos,
  2407. R = Math.sin,
  2408. L = Math.sqrt,
  2409. z = function(r) { r = e(r, e.EMPTY_OBJECT); var i = r.extent,
  2410. n = e(r.granularity, m.RADIANS_PER_DEGREE),
  2411. o = e(r.ellipsoid, l.WGS84),
  2412. a = e(r.height, 0),
  2413. u = r.rotation; if (!t(i)) throw new s("extent is required.");
  2414. i.validate(), this._extent = i, this._granularity = n, this._ellipsoid = o, this._surfaceHeight = a, this._rotation = u, this._extrudedHeight = r.extrudedHeight, this._workerName = "createExtentOutlineGeometry" }; return z.createGeometry = function(e) { var r = e._extent,
  2415. i = e._granularity,
  2416. n = e._ellipsoid,
  2417. a = e._surfaceHeight,
  2418. l = e._rotation,
  2419. u = e._extrudedHeight,
  2420. m = Math.ceil((r.east - r.west) / i) + 1,
  2421. y = Math.ceil((r.north - r.south) / i) + 1,
  2422. w = (r.east - r.west) / (m - 1),
  2423. C = (r.north - r.south) / (y - 1),
  2424. M = n.getRadiiSquared();
  2425. r.getNorthwest(S), r.getCenter(E); var P = C,
  2426. D = w,
  2427. I = 0,
  2428. L = 0; if (t(l)) { var z = O(l);
  2429. P *= z, D *= z; var N = R(l);
  2430. I = C * N, L = w * N, A.project(S, x), A.project(E, b), x.subtract(b, x), p.fromRotation(l, T), T.multiplyByVector(x, x), x.add(b, x), A.unproject(x, S); var F = S.latitude,
  2431. B = F + (m - 1) * L,
  2432. V = F - P * (y - 1),
  2433. q = F - P * (y - 1) + (m - 1) * L,
  2434. k = Math.max(F, B, V, q),
  2435. U = Math.min(F, B, V, q),
  2436. W = S.longitude,
  2437. G = W + (m - 1) * D,
  2438. H = W + (y - 1) * I,
  2439. j = W + (y - 1) * I + (m - 1) * D,
  2440. Y = Math.max(W, G, H, j),
  2441. X = Math.min(W, G, H, j); if (!(v(k, X) && v(k, Y) && v(U, X) && v(U, Y))) throw new s("Rotated extent is invalid.") } var Z, K = 2 * m + 2 * y - 4,
  2442. J = { granYCos: P, granYSin: I, granXCos: D, granXSin: L, radiiSquared: M, ellipsoid: n, extent: r, width: m, height: y, surfaceHeight: a, size: K };
  2443. Z = t(u) ? _(J, u) : g(J); var Q = new d({ position: new h({ componentDatatype: o.DOUBLE, componentsPerAttribute: 3, values: Z.positions }) }); return new c({ attributes: Q, indices: Z.indices, primitiveType: f.LINES, boundingSphere: Z.boundingSphere }) }, z }), r("Core/FAR", [], function() { "use strict"; var e = 5906376272e3; return e }), r("Core/HeightmapTessellator", ["./defaultValue", "./defined", "./freezeObject", "./DeveloperError", "./Cartesian3", "./Ellipsoid", "./Math"], function(e, t, r, i, n, o, a) { "use strict"; var s = {}; return s.DEFAULT_STRUCTURE = r({ heightScale: 1, heightOffset: 0, elementsPerHeight: 1, stride: 1, elementMultiplier: 256, isBigEndian: !1 }), s.computeVertices = function(r) { if (!t(r) || !t(r.heightmap)) throw new i("description.heightmap is required."); if (!t(r.width) || !t(r.height)) throw new i("description.width and description.height are required."); if (!t(r.vertices)) throw new i("description.vertices is required."); if (!t(r.nativeExtent)) throw new i("description.nativeExtent is required."); if (!t(r.skirtHeight)) throw new i("description.skirtHeight is required."); var l, u, c, h, d = Math.cos,
  2444. m = Math.sin,
  2445. p = Math.sqrt,
  2446. f = Math.atan,
  2447. v = Math.exp,
  2448. y = a.PI_OVER_TWO,
  2449. g = a.toRadians,
  2450. _ = r.vertices,
  2451. w = r.heightmap,
  2452. C = r.width,
  2453. x = r.height,
  2454. S = r.skirtHeight,
  2455. E = e(r.isGeographic, !0),
  2456. b = e(r.ellipsoid, o.WGS84),
  2457. T = 1 / b.getMaximumRadius(),
  2458. A = r.nativeExtent,
  2459. M = r.extent;
  2460. t(M) ? (l = M.west, u = M.south, c = M.east, h = M.north) : E ? (l = g(A.west), u = g(A.south), c = g(A.east), h = g(A.north)) : (l = A.west * T, u = y - 2 * f(v(-A.south * T)), c = A.east * T, h = y - 2 * f(v(-A.north * T))); var P = e(r.relativeToCenter, n.ZERO),
  2461. D = e(r.structure, s.DEFAULT_STRUCTURE),
  2462. I = e(D.heightScale, s.DEFAULT_STRUCTURE.heightScale),
  2463. O = e(D.heightOffset, s.DEFAULT_STRUCTURE.heightOffset),
  2464. R = e(D.elementsPerHeight, s.DEFAULT_STRUCTURE.elementsPerHeight),
  2465. L = e(D.stride, s.DEFAULT_STRUCTURE.stride),
  2466. z = e(D.elementMultiplier, s.DEFAULT_STRUCTURE.elementMultiplier),
  2467. N = e(D.isBigEndian, s.DEFAULT_STRUCTURE.isBigEndian),
  2468. F = (A.east - A.west) / (C - 1),
  2469. B = (A.north - A.south) / (x - 1),
  2470. V = b.getRadiiSquared(),
  2471. q = V.x,
  2472. k = V.y,
  2473. U = V.z,
  2474. W = 0,
  2475. G = 65536,
  2476. H = -65536,
  2477. j = 0,
  2478. Y = x,
  2479. X = 0,
  2480. Z = C;
  2481. S > 0 && (--j, ++Y, --X, ++Z); for (var K = j; Y > K; ++K) { var J = K;
  2482. 0 > J && (J = 0), J >= x && (J = x - 1); var Q = A.north - B * J;
  2483. Q = E ? g(Q) : y - 2 * f(v(-Q * T)); for (var $ = d(Q), et = m(Q), tt = U * et, rt = (Q - u) / (h - u), it = X; Z > it; ++it) { var nt = it;
  2484. 0 > nt && (nt = 0), nt >= C && (nt = C - 1); var ot = A.west + F * nt;
  2485. E ? ot = g(ot) : ot *= T; var at, st = J * C * L + nt * L; if (1 === R) at = w[st];
  2486. else { at = 0; var lt; if (N)
  2487. for (lt = 0; R > lt; ++lt) at = at * z + w[st + lt];
  2488. else
  2489. for (lt = R - 1; lt >= 0; --lt) at = at * z + w[st + lt] } at = at * I + O, H = Math.max(H, at), G = Math.min(G, at), (it !== nt || K !== J) && (at -= S); var ut = $ * d(ot),
  2490. ct = $ * m(ot),
  2491. ht = q * ut,
  2492. dt = k * ct,
  2493. mt = p(ht * ut + dt * ct + tt * et),
  2494. pt = 1 / mt,
  2495. ft = ht * pt,
  2496. vt = dt * pt,
  2497. yt = tt * pt;
  2498. _[W++] = ft + ut * at - P.x, _[W++] = vt + ct * at - P.y, _[W++] = yt + et * at - P.z, _[W++] = at; var gt = (ot - l) / (c - l);
  2499. _[W++] = gt, _[W++] = rt } } return { maximumHeight: H, minimumHeight: G } }, s }), r("Core/HermitePolynomialApproximation", ["./defined", "./Math"], function(e, t) { "use strict";
  2500. function r(e, t, i, n, o, a) { var s, l, u, c = 0; if (n > 0) { for (l = 0; o > l; l++) { for (s = !1, u = 0; u < a.length && !s; u++) l === a[u] && (s = !0);
  2501. s || (a.push(l), c += r(e, t, i, n - 1, o, a), a.splice(a.length - 1, 1)) } return c } for (c = 1, l = 0; o > l; l++) { for (s = !1, u = 0; u < a.length && !s; u++) l === a[u] && (s = !0);
  2502. s || (c *= e - i[t[l]]) } return c } var i = t.factorial,
  2503. n = { type: "Hermite" }; return n.getRequiredDataPoints = function(e) { return Math.max(e + 1, 2) }, n.interpolateOrderZero = function(t, n, o, a, s) { e(s) || (s = new Array(a)); var l, u, c, h, d, m, p = n.length,
  2504. f = new Array(a); for (l = 0; a > l; l++) { s[l] = 0; var v = new Array(p); for (f[l] = v, u = 0; p > u; u++) v[u] = [] } var y = p,
  2505. g = new Array(y); for (l = 0; y > l; l++) g[l] = l; var _ = p - 1; for (h = 0; a > h; h++) { for (u = 0; y > u; u++) m = g[u] * a + h, f[h][0].push(o[m]); for (l = 1; y > l; l++) { var w = !1; for (u = 0; y - l > u; u++) { var C, x = n[g[u]],
  2506. S = n[g[u + l]];
  2507. 0 >= S - x ? (m = g[u] * a + a * l + h, C = o[m], f[h][l].push(C / i(l))) : (C = f[h][l - 1][u + 1] - f[h][l - 1][u], f[h][l].push(C / (S - x))), w = w || 0 !== C } w || (_ = l - 1) } } for (c = 0, d = 0; d >= c; c++)
  2508. for (l = c; _ >= l; l++) { var E = r(t, g, n, c, l, []); for (h = 0; a > h; h++) { var b = f[h][l][0];
  2509. s[h + c * a] += b * E } }
  2510. return s }, n }), r("Core/InterpolationAlgorithm", ["./DeveloperError"], function(e) { "use strict"; var t = {}; return t.type = void 0, t.getRequiredDataPoints = function() { throw new e("This function defines an interface and should not be called directly.") }, t.interpolateOrderZero = function() { throw new e("This function defines an interface and should not be called directly.") }, t }), r("Core/TimeInterval", ["./defined", "./DeveloperError", "./freezeObject", "./JulianDate", "./TimeStandard"], function(e, t, r, i, n) { "use strict"; var o = function(r, n, o, a, s) { if (!e(r)) throw new t("start must be specified."); if (!e(n)) throw new t("stop must be specified.");
  2511. e(o) || (o = !0), e(a) || (a = !0); var l = i.compare(n, r);
  2512. this.start = r, this.stop = n, this.data = s, this.isStartIncluded = o, this.isStopIncluded = a, this.isEmpty = 0 > l || 0 === l && (!o || !a) }; return o.fromIso8601 = function(e, t, r, n) { var a = e.split("/"),
  2513. s = i.fromIso8601(a[0]),
  2514. l = i.fromIso8601(a[1]); return new o(s, l, t, r, n) }, o.equals = function(t, r) { return t === r || e(t) && e(r) && (t.isEmpty && r.isEmpty || t.isStartIncluded === r.isStartIncluded && t.isStopIncluded === r.isStopIncluded && t.start.equals(r.start) && t.stop.equals(r.stop)) }, o.equalsEpsilon = function(r, i, n) { if ("number" != typeof n) throw new t("epsilon is required and must be a number."); return r === i || e(r) && e(i) && (r.isEmpty && i.isEmpty || r.isStartIncluded === i.isStartIncluded && r.isStopIncluded === i.isStopIncluded && r.start.equalsEpsilon(i.start, n) && r.stop.equalsEpsilon(i.stop, n)) }, o.prototype.clone = function() { return new o(this.start, this.stop, this.isStartIncluded, this.isStopIncluded, this.data) }, o.EMPTY = r(new o(new i(0, 0, n.TAI), new i(0, 0, n.TAI), !1, !1)), o.prototype.intersect = function(t, r) { if (!e(t)) return o.EMPTY; var i, n, a, s = t.start,
  2515. l = t.stop,
  2516. u = t.isStartIncluded,
  2517. c = t.isStopIncluded,
  2518. h = this.start,
  2519. d = this.stop,
  2520. m = this.isStartIncluded,
  2521. p = this.isStopIncluded; return s.greaterThanOrEquals(h) && d.greaterThanOrEquals(s) ? (n = !s.equals(h) && u || m && u, a = p && c, i = e(r) ? r(this.data, t.data) : this.data, d.greaterThanOrEquals(l) ? (a = a || !l.equals(d) && c, new o(s, l, n, a, i)) : (a = a || p, new o(s, d, n, a, i))) : s.lessThanOrEquals(h) && h.lessThanOrEquals(l) ? (n = s.equals(h) === !1 && m || m && u, a = p && c, i = e(r) ? r(this.data, t.data) : this.data, d.greaterThanOrEquals(l) ? (a = a || l.equals(d) === !1 && c, new o(h, l, n, a, i)) : (a = a || p, new o(h, d, n, a, i))) : o.EMPTY }, o.prototype.contains = function(e) { if (this.isEmpty) return !1; var t = i.compare(this.start, e); if (0 === t) return this.isStartIncluded; var r = i.compare(e, this.stop); return 0 === r ? this.isStopIncluded : 0 > t && 0 > r }, o.prototype.equals = function(e) { return o.equals(this, e) }, o.prototype.equalsEpsilon = function(e, t) { return o.equalsEpsilon(this, e, t) }, o }), r("Core/Iso8601", ["./freezeObject", "./JulianDate", "./TimeInterval"], function(e, t, r) { "use strict"; var i = e(t.fromIso8601("0000-01-01T00:00:00Z")),
  2522. n = e(t.fromIso8601("9999-12-31T24:00:00Z")),
  2523. o = e(new r(i, n, !0, !0)),
  2524. a = { MINIMUM_VALUE: i, MAXIMUM_VALUE: n, MAXIMUM_INTERVAL: o }; return a }), r("Core/KeyboardEventModifier", ["./Enumeration"], function(e) { "use strict"; var t = { SHIFT: new e(0, "SHIFT"), CTRL: new e(1, "CTRL"), ALT: new e(2, "ALT") }; return t }), r("Core/LagrangePolynomialApproximation", ["./defined"], function(e) { "use strict"; var t = { type: "Lagrange" }; return t.getRequiredDataPoints = function(e) { return Math.max(e + 1, 2) }, t.interpolateOrderZero = function(t, r, i, n, o) { e(o) || (o = new Array(n)); var a, s, l = r.length; for (a = 0; n > a; a++) o[a] = 0; for (a = 0; l > a; a++) { var u = 1; for (s = 0; l > s; s++)
  2525. if (s !== a) { var c = r[a] - r[s];
  2526. u *= (t - r[s]) / c }
  2527. for (s = 0; n > s; s++) o[s] += u * i[a * n + s] } return o }, t }), r("Core/LinearApproximation", ["./defined", "./DeveloperError"], function(e, t) { "use strict"; var r = { type: "Linear" }; return r.getRequiredDataPoints = function(e) { if (1 !== e) throw new t("Linear interpolation can only generate a first degree polynomial."); return 2 }, r.interpolateOrderZero = function(r, i, n, o, a) { if (2 !== i.length) throw new t("The xTable provided to the linear interpolator must have exactly two elements."); if (0 >= o) throw new t("There must be at least 1 dependent variable for each independent variable.");
  2528. e(a) || (a = new Array(o)); var s, l, u, c = i[0],
  2529. h = i[1]; if (c === h) throw new t("Divide by zero error: xTable[0] and xTable[1] are equal"); for (s = 0; o > s; s++) l = n[s], u = n[s + o], a[s] = ((u - l) * r + h * l - c * u) / (h - c); return a }, r }), r("Core/NearFarScalar", ["./defaultValue", "./defined", "./DeveloperError"], function(e, t) { "use strict"; var r = function(t, r, i, n) { this.near = e(t, 0), this.nearValue = e(r, 0), this.far = e(i, 1), this.farValue = e(n, 0) }; return r.clone = function(e, i) { return t(e) ? t(i) ? (i.near = e.near, i.nearValue = e.nearValue, i.far = e.far, i.farValue = e.farValue, i) : new r(e.near, e.nearValue, e.far, e.farValue) : void 0 }, r.equals = function(e, r) { return e === r || t(e) && t(r) && e.near === r.near && e.nearValue === r.nearValue && e.far === r.far && e.farValue === r.farValue }, r }), r("Core/Visibility", ["./Enumeration"], function(e) { "use strict"; var t = { NONE: new e(-1, "NONE"), PARTIAL: new e(0, "PARTIAL"), FULL: new e(1, "FULL") }; return t }), r("Core/Occluder", ["./defaultValue", "./defined", "./DeveloperError", "./Math", "./Cartesian3", "./Visibility", "./Ellipsoid", "./BoundingSphere"], function(e, t, r, i, n, o, a, s) {
  2530. "use strict";
  2531. var l = function(e, t) { if (!e) throw new r("occluderBoundingSphere is required."); if (!t) throw new r("camera position is required.");
  2532. this._occluderPosition = e.center.clone(), this._occluderRadius = e.radius, this._horizonDistance = 0, this._horizonPlaneNormal = void 0, this._horizonPlanePosition = void 0, this._cameraPosition = void 0, this.setCameraPosition(t) };
  2533. l.prototype.getPosition = function() { return this._occluderPosition }, l.prototype.getRadius = function() {
  2534. return this._occluderRadius
  2535. }, l.prototype.setCameraPosition = function(e) { e = n.clone(e); var t, r, i, o = this._occluderPosition.subtract(e),
  2536. a = o.magnitudeSquared(),
  2537. s = this._occluderRadius * this._occluderRadius; if (a > s) { t = Math.sqrt(a - s), a = 1 / Math.sqrt(a), r = o.multiplyByScalar(a); var l = t * t * a;
  2538. i = e.add(r.multiplyByScalar(l)) } else t = Number.MAX_VALUE;
  2539. this._horizonDistance = t, this._horizonPlaneNormal = r, this._horizonPlanePosition = i, this._cameraPosition = e };
  2540. var u = new n;
  2541. l.prototype.isPointVisible = function(e) { if (this._horizonDistance !== Number.MAX_VALUE) { var t = n.subtract(e, this._occluderPosition, u),
  2542. r = this._occluderRadius; if (r = t.magnitudeSquared() - r * r, r > 0) return r = Math.sqrt(r) + this._horizonDistance, t = n.subtract(e, this._cameraPosition, t), r * r > t.magnitudeSquared() } return !1 }, l.prototype.isBoundingSphereVisible = function(e) { var t = e.center.clone(),
  2543. r = e.radius; if (this._horizonDistance !== Number.MAX_VALUE) { var i = n.subtract(t, this._occluderPosition, u),
  2544. o = this._occluderRadius - r; if (o = i.magnitudeSquared() - o * o, r < this._occluderRadius) return o > 0 ? (o = Math.sqrt(o) + this._horizonDistance, i = n.subtract(t, this._cameraPosition, i), o * o + r * r > i.magnitudeSquared()) : !1; if (o > 0) { i = t.subtract(this._cameraPosition); var a = i.magnitudeSquared(),
  2545. s = this._occluderRadius * this._occluderRadius,
  2546. l = r * r; return (this._horizonDistance * this._horizonDistance + s) * l > a * s ? !0 : (o = Math.sqrt(o) + this._horizonDistance, o * o + l > a) } return !0 } return !1 }, l.prototype.getVisibility = function(e) { var t = e.center.clone(),
  2547. r = e.radius; if (r > this._occluderRadius) return o.FULL; if (this._horizonDistance !== Number.MAX_VALUE) { var i = t.subtract(this._occluderPosition),
  2548. n = this._occluderRadius - r,
  2549. a = i.magnitudeSquared(); if (n = a - n * n, n > 0) { n = Math.sqrt(n) + this._horizonDistance, i = t.subtract(this._cameraPosition); var s = i.magnitudeSquared(); return s > n * n + r * r ? o.NONE : (n = this._occluderRadius + r, n = a - n * n, n > 0 ? (n = Math.sqrt(n) + this._horizonDistance, n * n + r * r > s ? o.FULL : o.PARTIAL) : (i = t.subtract(this._horizonPlanePosition), i.dot(this._horizonPlaneNormal) > -r ? o.PARTIAL : o.FULL)) } } return o.NONE }, l.getOccludeePoint = function(e, t, i) { if (!e) throw new r("occluderBoundingSphere is required."); if (!i) throw new r("positions is required."); if (0 === i.length) throw new r("positions must contain at least one element"); var o = n.clone(t),
  2550. a = e.center.clone(),
  2551. s = e.radius,
  2552. u = i.length; if (a.equals(t)) throw new r("occludeePosition must be different than occluderBoundingSphere.center"); var c = o.subtract(a).normalize(),
  2553. h = -c.dot(a),
  2554. d = l._anyRotationVector(a, c, h),
  2555. m = l._horizonToPlaneNormalDotProduct(e, c, h, d, i[0]); if (!m) return void 0; for (var p, f = 1; u > f; ++f) { if (p = l._horizonToPlaneNormalDotProduct(e, c, h, d, i[f]), !p) return void 0;
  2556. m > p && (m = p) } if (.0017453283658983088 > m) return void 0; var v = s / m; return a.add(c.multiplyByScalar(v)) };
  2557. var c = [];
  2558. return l.computeOccludeePointFromExtent = function(i, o) { if (!t(i)) throw new r("extent is required.");
  2559. o = e(o, a.WGS84); var u = i.subsample(o, 0, c),
  2560. h = s.fromPoints(u),
  2561. d = n.ZERO; return d.equals(h.center) ? void 0 : l.getOccludeePoint(new s(d, o.getMinimumRadius()), h.center, u) }, l._anyRotationVector = function(e, t, r) { var i = t.clone().abs(),
  2562. o = i.x > i.y ? 0 : 1;
  2563. (0 === o && i.z > i.x || 1 === o && i.z > i.y) && (o = 2); var a = new n;
  2564. 0 === o ? (i.x = e.x, i.y = e.y + 1, i.z = e.z + 1, a = n.UNIT_X) : 1 === o ? (i.x = e.x + 1, i.y = e.y, i.z = e.z + 1, a = n.UNIT_Y) : (i.x = e.x + 1, i.y = e.y + 1, i.z = e.z, a = n.UNIT_Z); var s = (t.dot(i) + r) / -t.dot(a); return i.add(a.multiplyByScalar(s)).subtract(e).normalize() }, l._rotationVector = function(e, t, r, n, o) { var a = n.subtract(e); if (a = a.normalize(), t.dot(a) < .9999999847691291) { var s = t.cross(a),
  2565. l = s.magnitude(); if (l > i.EPSILON13) return s.normalize() } return o }, l._horizonToPlaneNormalDotProduct = function(e, t, r, i, o) { var a = n.clone(o),
  2566. s = e.center.clone(),
  2567. l = e.radius,
  2568. u = s.subtract(a),
  2569. c = u.magnitudeSquared(),
  2570. h = l * l; if (h > c) return !1; var d = c - h,
  2571. m = Math.sqrt(d),
  2572. p = Math.sqrt(c),
  2573. f = 1 / p,
  2574. v = m * f,
  2575. y = v * m;
  2576. u = u.normalize(); var g = a.add(u.multiplyByScalar(y)),
  2577. _ = Math.sqrt(d - y * y),
  2578. w = this._rotationVector(s, t, r, a, i),
  2579. C = new n(w.x * w.x * u.x + (w.x * w.y - w.z) * u.y + (w.x * w.z + w.y) * u.z, (w.x * w.y + w.z) * u.x + w.y * w.y * u.y + (w.y * w.z - w.x) * u.z, (w.x * w.z - w.y) * u.x + (w.y * w.z + w.x) * u.y + w.z * w.z * u.z);
  2580. C = C.normalize(); var x = C.multiplyByScalar(_);
  2581. w = g.add(x).subtract(s).normalize(); var S = t.dot(w);
  2582. w = g.subtract(x).subtract(s).normalize(); var E = t.dot(w); return E > S ? S : E }, l
  2583. }), r("Core/OrientationInterpolator", ["./defined", "./DeveloperError"], function(e, t) { "use strict";
  2584. function r(e, t) { var r = e._lastTimeIndex || 0; if (t >= e._points[r].time) { if (r + 1 < e._points.length && t < e._points[r + 1].time) return r; if (r + 2 < e._points.length && t < e._points[r + 2].time) return e._lastTimeIndex = r + 1, e._lastTimeIndex } else if (r - 1 >= 0 && t >= e._points[r - 1].time) return e._lastTimeIndex = r - 1, e._lastTimeIndex; for (r = 0; r < e._points.length - 1 && !(t >= e._points[r].time && t < e._points[r + 1].time); ++r); return r === e._points.length - 1 && (r = e._points.length - 2), e._lastTimeIndex = r, e._lastTimeIndex } var i = function(r) { if (!e(r) || !(r instanceof Array) || r.length < 2) throw new t("controlPoints is required. It must be an array with at least a length of 3.");
  2585. this._points = r, this._lastTimeIndex = 0 }; return i.prototype.getControlPoints = function() { return this._points }, i.prototype.evaluate = function(i) { if (!e(i)) throw new t("time is required."); if (i < this._points[0].time || i > this._points[this._points.length - 1].time) throw new t("time is out of range."); var n = r(this, i),
  2586. o = (i - this._points[n].time) / (this._points[n + 1].time - this._points[n].time); return this._points[n].orientation.slerp(this._points[n + 1].orientation, o) }, i }), r("Core/Packable", ["../Core/DeveloperError"], function(e) { "use strict";
  2587. function t() { throw new e("This type should not be instantiated directly.") } var r = { packedLength: void 0, pack: t, unpack: t }; return r }), r("Core/PackableForInterpolation", ["../Core/DeveloperError"], function(e) { "use strict";
  2588. function t() { throw new e("This type should not be instantiated directly.") } var r = { packedInterpolationLength: void 0, convertPackedArrayForInterpolation: t, unpackInterpolationResult: t }; return r }), r("Core/PolygonGeometryLibrary", ["./defaultValue", "./defined", "./Cartesian3", "./Ellipsoid"], function(e, t, r, i) { "use strict";
  2589. function n(e, t, i, n) { return r.subtract(t, e, a), r.multiplyByScalar(a, i / n, a), r.add(e, a, a), [a.x, a.y, a.z] } var o = {},
  2590. a = new r;
  2591. o.subdivideLine = function(e, t, i) { var o = r.distance(e, t),
  2592. a = r.angleBetween(e, t),
  2593. s = a / i,
  2594. l = Math.ceil(Math.log(s) / Math.log(2));
  2595. 1 > l && (l = 0); var u = Math.pow(2, l),
  2596. c = o / u,
  2597. h = new Array(3 * u),
  2598. d = 0;
  2599. h[d++] = e.x, h[d++] = e.y, h[d++] = e.z; for (var m = 1; u > m; m++) { var p = n(e, t, m * c, o);
  2600. h[d++] = p[0], h[d++] = p[1], h[d++] = p[2] } return h }; var s = new r,
  2601. l = new r,
  2602. u = new r; return o.scaleToGeodeticHeightExtruded = function(n, o, a, c) { c = e(c, i.WGS84); var h = s,
  2603. d = l,
  2604. m = u; if (t(n) && t(n.attributes) && t(n.attributes.position))
  2605. for (var p = n.attributes.position.values, f = p.length / 2, v = 0; f > v; v += 3) r.fromArray(p, v, m), c.scaleToGeodeticSurface(m, m), c.geodeticSurfaceNormal(m, h), r.multiplyByScalar(h, o, d), r.add(m, d, d), p[v] = d.x, p[v + 1] = d.y, p[v + 2] = d.z, r.multiplyByScalar(h, a, d), r.add(m, d, d), p[v + f] = d.x, p[v + 1 + f] = d.y, p[v + 2 + f] = d.z; return n }, o }), r("Core/pointInsideTriangle", ["./barycentricCoordinates", "./Cartesian3", "./DeveloperError"], function(e, t) { "use strict"; var r = new t,
  2606. i = function(t, i, n, o) { return e(t, i, n, o, r), r.x > 0 && r.y > 0 && r.z > 0 }; return i }), r("Core/Queue", [], function() { "use strict"; var e = function() { this._array = [], this._offset = 0, this.length = 0 }; return e.prototype.enqueue = function(e) { this._array.push(e), this.length++ }, e.prototype.dequeue = function() { if (0 === this.length) return void 0; var e = this._array,
  2607. t = this._offset,
  2608. r = e[t]; return e[t] = void 0, t++, t > 10 && 2 * t > e.length && (this._array = e.slice(t), t = 0), this._offset = t, this.length--, r }, e.prototype.contains = function(e) { return -1 !== this._array.indexOf(e) }, e.prototype.clear = function() { this._array.length = this._offset = this.length = 0 }, e.prototype.sort = function(e) { this._offset > 0 && (this._array = this._array.slice(this._offset), this._offset = 0), this._array.sort(e) }, e }), r("Core/WindingOrder", ["./Enumeration"], function(e) { "use strict"; var t = { CLOCKWISE: new e(2304, "CLOCKWISE"), COUNTER_CLOCKWISE: new e(2305, "COUNTER_CLOCKWISE"), validate: function(e) { return e === t.CLOCKWISE || e === t.COUNTER_CLOCKWISE } }; return t }), r("Core/PolygonPipeline", ["./DeveloperError", "./Math", "./Cartesian2", "./Cartesian3", "./defined", "./Geometry", "./GeometryAttribute", "./Ellipsoid", "./EllipsoidTangentPlane", "./defaultValue", "./pointInsideTriangle", "./ComponentDatatype", "./PrimitiveType", "./Queue", "./WindingOrder"], function(e, t, r, i, n, o, a, s, l, u, c, h, d, m, p) { "use strict";
  2609. function f(e, t, r) { var i = t.subtract(e),
  2610. n = r.subtract(t); return i.x * n.y - i.y * n.x >= 0 }
  2611. function v(e) { for (var t = e[0].x, r = 0, i = 0; i < e.length; i++) e[i].x > t && (t = e[i].x, r = i); return r }
  2612. function y(e) { for (var t = e[0][0].x, r = 0, i = 0; i < e.length; i++) { var n = e[i][v(e[i])].x;
  2613. n > t && (t = n, r = i) } return r }
  2614. function g(e) { for (var t = [], r = 0; r < e.length; r++) { var i = e[(r - 1 + e.length) % e.length],
  2615. n = e[r],
  2616. o = e[(r + 1) % e.length];
  2617. f(i, n, o) || t.push(n) } return t }
  2618. function _(e, t) { for (var r = 0; r < e.length; r++)
  2619. if (t.equals(e[r])) return r; return -1 }
  2620. function w(e, t, n) { n = u(n, []); var o = Number.MAX_VALUE,
  2621. a = v(t),
  2622. s = new r(t[a].x, e.y);
  2623. n.push(a), n.push((a + 1) % t.length); for (var l = t[0].x, c = l, h = 1; h < t.length; ++h) t[h].x < l ? l = t[h].x : t[h].x > c && (c = t[h].x);
  2624. c += c - l; var d = new i(c, e.y, 0); for (h = 0; h < t.length; h++) { var m = t[h],
  2625. p = t[(h + 1) % t.length]; if ((m.x >= e.x || p.x >= e.x) && (m.y >= e.y && p.y <= e.y || m.y <= e.y && p.y >= e.y)) { var f = (p.y - m.y) * (d.x - e.x) - (p.x - m.x) * (d.y - e.y); if (0 !== f) { f = 1 / f; var y = ((p.x - m.x) * (e.y - m.y) - (p.y - m.y) * (e.x - m.x)) * f,
  2626. g = ((d.x - e.x) * (e.y - m.y) - (d.y - e.y) * (e.x - m.x)) * f; if (y >= 0 && 1 >= y && g >= 0 && 1 >= g) { var _ = new r(e.x + y * (d.x - e.x), e.y + y * (d.y - e.y)),
  2627. w = _.subtract(e);
  2628. f = w.magnitudeSquared(), o > f && (s = _, o = f, n[0] = h, n[1] = (h + 1) % t.length) } } } } return s }
  2629. function C(e, t) { var i = y(t),
  2630. n = t[i],
  2631. o = v(n),
  2632. a = n[o],
  2633. s = [],
  2634. l = w(a, e, s),
  2635. u = _(e, l); if (-1 !== u) return u; var h = e[s[0]].subtract(a).magnitudeSquared(),
  2636. d = e[s[1]].subtract(a).magnitudeSquared(),
  2637. m = d > h ? e[s[0]] : e[s[1]],
  2638. p = g(e),
  2639. f = p.indexOf(m); - 1 !== f && p.splice(f, 1); for (var C = [], x = 0; x < p.length; x++) { var S = p[x];
  2640. c(S, a, l, m) && C.push(S) } var E = Number.MAX_VALUE; if (C.length > 0) { var b = new r(1, 0, 0); for (x = 0; x < C.length; x++) { var T = C[x].subtract(a),
  2641. A = b.magnitude() * T.magnitude(); if (0 !== A) { var M = Math.abs(Math.acos(b.dot(T) / A));
  2642. E > M && (E = M, m = C[x]) } } } return e.indexOf(m) }
  2643. function x(e, t, r) { for (var i = W.computeWindingOrder2D(e), n = 0; n < t.length; n++) { var o = t[n];
  2644. o[0].equals(o[o.length - 1]) || o.push(o[0]); var a = W.computeWindingOrder2D(o);
  2645. a === i && o.reverse() } var s = l.fromPoints(e, r),
  2646. u = s.projectPointsOntoPlane(e),
  2647. c = []; for (n = 0; n < t.length; n++) c.push(s.projectPointsOntoPlane(t[n])); var h = C(u, c),
  2648. d = y(c),
  2649. m = v(c[d]),
  2650. p = t[d],
  2651. f = []; for (n = 0; n < e.length; n++) f.push(e[n]); var g, _ = []; if (0 !== m)
  2652. for (g = 0; g <= p.length; g++) { var w = (g + m) % p.length;
  2653. 0 !== w && _.push(p[w]) } else
  2654. for (g = 0; g < p.length; g++) _.push(p[(g + m) % p.length]); var x = f.lastIndexOf(e[h]);
  2655. _.push(e[x]); var S = f.slice(0, x + 1),
  2656. E = f.slice(x + 1); return f = S.concat(_, E), t.splice(d, 1), f }
  2657. function S(e) { var t = "0." + Math.sin(B).toString().substr(5);
  2658. B += .2; var r = Math.floor(t * e); return r === e && r--, r }
  2659. function E(e, t, r) { return b(e, t, r) && b(t, e, r) && !L(r[e].position, r[t].position, r) && !r[e].position.equals(r[t].position) }
  2660. function b(e, t, r) { M(e, r); var n = r[e],
  2661. o = r[t],
  2662. a = A(e, r, V),
  2663. s = A(e, r, q),
  2664. l = r[a].position.subtract(n.position),
  2665. u = r[s].position.subtract(n.position),
  2666. c = o.position.subtract(n.position); return l = new i(l.x, l.y, 0), u = new i(u.x, u.y, 0), c = new i(c.x, c.y, 0), P(l, c) ? T(l, c) : P(u, c) ? T(u, c) : D(l, u) ? R(l, u, c) ? !0 : !1 : I(l, u) ? O(l, u, c) ? !1 : !0 : void 0 }
  2667. function T(e, t) { return t.magnitude() < e.magnitude() }
  2668. function A(e, t, r) { var i = e + r; return 0 > i && (i = t.length - 1), i === t.length && (i = 0), M(i, t), i }
  2669. function M(t, r) { var n = t - 1,
  2670. o = t + 1;
  2671. 0 > n && (n = r.length - 1), o === r.length && (o = 0); var a = r[n].position.subtract(r[t].position),
  2672. s = r[o].position.subtract(r[t].position); if (a = new i(a.x, a.y, 0), s = new i(s.x, s.y, 0), 0 === a.cross(s).z) { var l = new e("Superfluous vertex found."); throw l.vertexIndex = t, l } }
  2673. function P(e, t) { return 0 === e.cross(t).z }
  2674. function D(e, t) { return e.cross(t).z < 0 }
  2675. function I(e, t) { return e.cross(t).z > 0 }
  2676. function O(e, t, r) { return e.cross(r).z > 0 && r.cross(t).z > 0 }
  2677. function R(e, t, r) { return e.cross(r).z < 0 && r.cross(t).z < 0 }
  2678. function L(e, t, i) { for (var n = 0; n < i.length; n++) { var o, a = i[n].position; if (o = n < i.length - 1 ? i[n + 1].position : i[0].position, !(e.equals(a) || t.equals(o) || e.equals(o) || t.equals(a))) { var s = (t.y - e.y) / (t.x - e.x),
  2679. l = (o.y - a.y) / (o.x - a.x); if (!(s === l || isNaN(s) && isNaN(l))) { var u;
  2680. u = isNaN(s) ? e.x : isNaN(l) ? a.x : (e.y - a.y - s * e.x + l * a.x) / (l - s); var c = s * u + e.y - s * e.x,
  2681. h = new r(u, c); if (!(h.equals(e) || h.equals(t) || h.equals(a) || h.equals(o))) { var d = N(u, e.x, t.x) && N(c, e.y, t.y) && N(u, a.x, o.x) && N(c, a.y, o.y); if (d) return !0 } } } } return !1 }
  2682. function z(e) { var t = e[0].position,
  2683. r = e[1].position,
  2684. n = e[2].position,
  2685. o = r.subtract(t),
  2686. a = n.subtract(t); return o = new i(o.x, o.y, 0), a = new i(a.x, a.y, 0), 0 === o.cross(a).z }
  2687. function N(e, t, r) { return (e > t || e > r) && (t > e || r > e) || t === r && t === e }
  2688. function F(t) { var r = t.length; if (3 === r) return z(t) ? [] : [t[0].index, t[1].index, t[2].index]; if (t.length < 3) throw new e("Invalid polygon: must have at least three vertices."); for (var i = !1, n = 0; !i;) { var o = 10 * t.length; if (n > o) throw new e("Tried " + o + " times to find a valid cut and couldn't.");
  2689. n++; for (var a = S(t.length), s = a + 1; Math.abs(a - s) < 2 || Math.abs(a - s) > t.length - 2;) s = S(t.length); if (a > s) { var l = a;
  2690. a = s, s = l } try { if (E(a, s, t)) { var u = t.splice(a, s - a + 1, t[a], t[s]); return F(t).concat(F(u)) } } catch (c) { if (c.hasOwnProperty("vertexIndex")) return t.splice(c.vertexIndex, 1), F(t); throw c } } } var B = 0,
  2691. V = -1,
  2692. q = 1,
  2693. k = new i,
  2694. U = new i,
  2695. W = { removeDuplicates: function(t) { if (!n(t)) throw new e("positions is required."); var r = t.length; if (3 > r) throw new e("At least three positions are required."); for (var o = [], a = r - 1, s = 0; r > s; a = s++) { var l = t[a],
  2696. u = t[s];
  2697. i.equals(l, u) || o.push(u) } return o }, computeArea2D: function(t) { if (!n(t)) throw new e("positions is required."); var r = t.length; if (3 > r) throw new e("At least three positions are required."); for (var i = 0, o = r - 1, a = 0; r > a; o = a++) { var s = t[o],
  2698. l = t[a];
  2699. i += s.x * l.y - l.x * s.y } return .5 * i }, computeWindingOrder2D: function(e) { var t = W.computeArea2D(e); return t >= 0 ? p.COUNTER_CLOCKWISE : p.CLOCKWISE }, triangulate: function(t) { if (!n(t)) throw new e("positions is required."); var r = t.length; if (3 > r) throw new e("At least three positions are required."); for (var i = [], o = 0; r > o; ++o) i[o] = { position: t[o], index: o }; return F(i) }, resetSeed: function(e) { B = u(e, 0) }, computeSubdivision: function(r, s, l) { if (!n(r)) throw new e("positions is required."); if (!n(s)) throw new e("indices is required."); if (s.length < 3) throw new e("At least three indices are required."); if (0 !== s.length % 3) throw new e("The number of indices must be divisable by three."); if (l = u(l, t.RADIANS_PER_DEGREE), 0 >= l) throw new e("granularity must be greater than zero."); for (var c = new m, p = s.length, f = 0; p > f; f += 3) c.enqueue({ i0: s[f], i1: s[f + 1], i2: s[f + 2] }); for (var v, y = r.slice(0), g = [], _ = {}; c.length > 0;) { var w, C, x = c.dequeue(),
  2700. S = y[x.i0],
  2701. E = y[x.i1],
  2702. b = y[x.i2],
  2703. T = i.angleBetween(S, E),
  2704. A = i.angleBetween(E, b),
  2705. M = i.angleBetween(b, S),
  2706. P = Math.max(T, Math.max(A, M));
  2707. P > l ? T === P ? (w = Math.min(x.i0, x.i1).toString() + " " + Math.max(x.i0, x.i1).toString(), v = _[w], v || (C = i.add(S, E), i.multiplyByScalar(C, .5, C), y.push(C), v = y.length - 1, _[w] = v), c.enqueue({ i0: x.i0, i1: v, i2: x.i2 }), c.enqueue({ i0: v, i1: x.i1, i2: x.i2 })) : A === P ? (w = Math.min(x.i1, x.i2).toString() + " " + Math.max(x.i1, x.i2).toString(), v = _[w], v || (C = i.add(E, b), i.multiplyByScalar(C, .5, C), y.push(C), v = y.length - 1, _[w] = v), c.enqueue({ i0: x.i1, i1: v, i2: x.i0 }), c.enqueue({ i0: v, i1: x.i2, i2: x.i0 })) : M === P && (w = Math.min(x.i2, x.i0).toString() + " " + Math.max(x.i2, x.i0).toString(), v = _[w], v || (C = i.add(b, S), i.multiplyByScalar(C, .5, C), y.push(C), v = y.length - 1, _[w] = v), c.enqueue({ i0: x.i2, i1: v, i2: x.i1 }), c.enqueue({ i0: v, i1: x.i0, i2: x.i1 })) : (g.push(x.i0), g.push(x.i1), g.push(x.i2)) } var D = y.length,
  2708. I = new Array(3 * D),
  2709. O = 0; for (v = 0; D > v; v++) { var R = y[v];
  2710. I[O++] = R.x, I[O++] = R.y, I[O++] = R.z } return new o({ attributes: { position: new a({ componentDatatype: h.DOUBLE, componentsPerAttribute: 3, values: I }) }, indices: g, primitiveType: d.TRIANGLES }) }, scaleToGeodeticHeight: function(e, t, r) { r = u(r, s.WGS84); var o = k,
  2711. a = U; if (t = u(t, 0), n(e) && n(e.attributes) && n(e.attributes.position))
  2712. for (var l = e.attributes.position.values, c = l.length, h = 0; c > h; h += 3) a = i.fromArray(l, h, a), r.scaleToGeodeticSurface(a, a), r.geodeticSurfaceNormal(a, o), i.multiplyByScalar(o, t, o), i.add(a, o, a), l[h] = a.x, l[h + 1] = a.y, l[h + 2] = a.z; return e }, eliminateHoles: function(t, r, o) { if (!n(t)) throw new e("outerRing is required."); if (0 === t.length) throw new e("outerRing must not be empty."); if (!n(r)) throw new e("innerRings is required.");
  2713. o = u(o, s.WGS84); for (var a = [], l = 0; l < r.length; l++) { for (var c = [], h = 0; h < r[l].length; h++) c.push(i.clone(r[l][h]));
  2714. a.push(c) } for (var d = t; a.length > 0;) d = x(d, a, o); return d } }; return W }), r("Core/PolygonGeometry", ["./defaultValue", "./BoundingRectangle", "./BoundingSphere", "./Cartesian2", "./Cartesian3", "./ComponentDatatype", "./defined", "./DeveloperError", "./Ellipsoid", "./EllipsoidTangentPlane", "./Geometry", "./GeometryAttribute", "./GeometryAttributes", "./GeometryInstance", "./GeometryPipeline", "./IndexDatatype", "./Math", "./Matrix3", "./PolygonGeometryLibrary", "./PolygonPipeline", "./PrimitiveType", "./Quaternion", "./Queue", "./VertexFormat", "./WindingOrder"], function(e, t, r, i, n, o, a, s, l, u, c, h, d, m, p, f, v, y, g, _, w, C, x, S, E) { "use strict";
  2715. function b(e, t, r, i) { for (var o = C.fromAxisAngle(e._plane.normal, r, O), s = y.fromQuaternion(o, R), l = Number.POSITIVE_INFINITY, u = Number.NEGATIVE_INFINITY, c = Number.POSITIVE_INFINITY, h = Number.NEGATIVE_INFINITY, d = t.length, m = 0; d > m; ++m) { var p = n.clone(t[m], I);
  2716. y.multiplyByVector(s, p, p); var f = e.projectPointOntoPlane(p, D);
  2717. a(f) && (l = Math.min(l, f.x), u = Math.max(u, f.x), c = Math.min(c, f.y), h = Math.max(h, f.y)) } return i.x = l, i.y = c, i.width = u - l, i.height = h - c, i }
  2718. function T(e, t, r) { var i = _.removeDuplicates(t); if (i.length < 3) throw new s("Duplicate positions result in not enough positions to form a polygon."); var n = u.fromPoints(i, e),
  2719. o = n.projectPointsOntoPlane(i, L),
  2720. a = _.computeWindingOrder2D(o);
  2721. a === E.CLOCKWISE && (o.reverse(), i.reverse()); var l = _.triangulate(o); return new m({ geometry: _.computeSubdivision(i, l, r) }) }
  2722. function A(e, t, r, a, s, l, c) { if (e.st || e.normal || e.tangent || e.binormal) { var d = _.removeDuplicates(r),
  2723. m = u.fromPoints(d, a),
  2724. p = b(m, r, s, z),
  2725. f = W;
  2726. f.x = p.x, f.y = p.y; var g = t.attributes.position.values,
  2727. w = g.length,
  2728. x = e.st ? new Float32Array(2 * (w / 3)) : void 0,
  2729. S = e.normal ? new Float32Array(w) : void 0,
  2730. E = e.tangent ? new Float32Array(w) : void 0,
  2731. T = e.binormal ? new Float32Array(w) : void 0,
  2732. A = 0,
  2733. M = 0,
  2734. P = F,
  2735. D = B,
  2736. I = V,
  2737. O = !0,
  2738. R = C.fromAxisAngle(m._plane.normal, s, j),
  2739. L = y.fromQuaternion(R, Y),
  2740. q = w / 2,
  2741. X = w / 3;
  2742. l && (w /= 2); for (var Z = 0; w > Z; Z += 3) { var K = n.fromArray(g, Z, H); if (e.st) { var J = y.multiplyByVector(L, K, N),
  2743. Q = m.projectPointOntoPlane(J, G);
  2744. i.subtract(Q, f, Q), l && (x[A + X] = Q.x / p.width, x[A + 1 + X] = Q.y / p.height), x[A] = Q.x / p.width, x[A + 1] = Q.y / p.height, A += 2 } if (e.normal || e.tangent || e.binormal) { var $ = M + 1,
  2745. et = M + 2; if (c) { if (w > Z + 3) { var tt = n.fromArray(g, Z + 3, k); if (O) { var rt = n.fromArray(g, Z + w, U);
  2746. tt.subtract(K, tt), rt.subtract(K, rt), P = n.cross(rt, tt, P).normalize(P), O = !1 } tt.equalsEpsilon(K, v.EPSILON10) && (O = !0) }(e.tangent || e.binormal) && (I = a.geodeticSurfaceNormal(K, I), e.tangent && (D = n.cross(I, P, D).normalize(D))) } else P = a.geodeticSurfaceNormal(K, P), (e.tangent || e.binormal) && (D = n.cross(n.UNIT_Z, P, D), D = y.multiplyByVector(L, D, D).normalize(D), e.binormal && (I = n.cross(P, D, I).normalize(I)));
  2747. e.normal && (l && !c ? (S[M + q] = -P.x, S[$ + q] = -P.y, S[et + q] = -P.z) : (S[M + q] = P.x, S[$ + q] = P.y, S[et + q] = P.z), S[M] = P.x, S[$] = P.y, S[et] = P.z), e.tangent && (l && !c ? (E[M + q] = -D.x, E[$ + q] = -D.y, E[et + q] = -D.z) : (E[M + q] = D.x, E[$ + q] = D.y, E[et + q] = D.z), E[M] = D.x, E[$] = D.y, E[et] = D.z), e.binormal && (l && (T[M + q] = I.x, T[$ + q] = I.y, T[et + q] = I.z), T[M] = I.x, T[$] = I.y, T[et] = I.z), M += 3 } } e.st && (t.attributes.st = new h({ componentDatatype: o.FLOAT, componentsPerAttribute: 2, values: x })), e.normal && (t.attributes.normal = new h({ componentDatatype: o.FLOAT, componentsPerAttribute: 3, values: S })), e.tangent && (t.attributes.tangent = new h({ componentDatatype: o.FLOAT, componentsPerAttribute: 3, values: E })), e.binormal && (t.attributes.binormal = new h({ componentDatatype: o.FLOAT, componentsPerAttribute: 3, values: T })) } return t }
  2748. function M(e, t) { var r, i, a, s, l, u, m, p, y, _ = [],
  2749. C = e.length; for (m = 0; C > m; m++) p = e[m], y = e[(m + 1) % C], r = g.subdivideLine(p, y, t), r.push(y.x, y.y, y.z), _ = _.concat(r);
  2750. _ = _.concat(_), C = _.length; var x = f.createTypedArray(C / 3, C - 6 * e.length); for (i = 0, C /= 6, m = 0; C > m; m++) a = m, s = a + 1, p = n.fromArray(_, 3 * a, k), y = n.fromArray(_, 3 * s, U), n.equalsEpsilon(p, y, v.EPSILON6) || (l = a + C, u = l + 1, x[i++] = a, x[i++] = l, x[i++] = s, x[i++] = s, x[i++] = l, x[i++] = u); return new c({ attributes: new d({ position: new h({ componentDatatype: o.DOUBLE, componentsPerAttribute: 3, values: _ }) }), indices: x, primitiveType: w.TRIANGLES }) }
  2751. function P(e, t, r, i) { var n = T(e, t, r).geometry,
  2752. a = n.attributes.position.values,
  2753. s = n.indices,
  2754. l = a.concat(a),
  2755. u = l.length / 3,
  2756. p = f.createTypedArray(u, 2 * s.length);
  2757. p.set(s); var v, y = s.length,
  2758. g = u / 2; for (v = 0; y > v; v += 3) { var w = p[v] + g,
  2759. C = p[v + 1] + g,
  2760. x = p[v + 2] + g;
  2761. p[v + y] = x, p[v + 1 + y] = C, p[v + 2 + y] = w } var S = new c({ attributes: new d({ position: new h({ componentDatatype: o.DOUBLE, componentsPerAttribute: 3, values: l }) }), indices: p, primitiveType: n.primitiveType }),
  2762. b = { topAndBottom: new m({ geometry: S }) };
  2763. b.walls = []; var A = i.outerRing,
  2764. P = _.computeWindingOrder2D(A);
  2765. P === E.CLOCKWISE && (A = A.reverse()); var D = M(A, r);
  2766. b.walls.push(new m({ geometry: D })); var I = i.holes; for (v = 0; v < I.length; v++) { var O = I[v];
  2767. P = _.computeWindingOrder2D(O), P !== E.CLOCKWISE && (O = O.reverse()), D = M(O, r), b.walls.push(new m({ geometry: D })) } return b } var D = new i,
  2768. I = new n,
  2769. O = new C,
  2770. R = new y,
  2771. L = [],
  2772. z = new t,
  2773. N = new n,
  2774. F = new n,
  2775. B = new n,
  2776. V = new n,
  2777. q = new r,
  2778. k = new n,
  2779. U = new n,
  2780. W = new i,
  2781. G = new i,
  2782. H = new n,
  2783. j = new C,
  2784. Y = new y,
  2785. X = function(t) { t = e(t, e.EMPTY_OBJECT); var r = e(t.vertexFormat, S.DEFAULT),
  2786. i = e(t.ellipsoid, l.WGS84),
  2787. n = e(t.granularity, v.RADIANS_PER_DEGREE),
  2788. o = e(t.stRotation, 0),
  2789. u = e(t.height, 0),
  2790. c = e(t.extrudedHeight, void 0),
  2791. h = a(c) && !v.equalsEpsilon(u, c, v.EPSILON6); if (h) { var d = c;
  2792. c = Math.min(d, u), u = Math.max(d, u) } var m = t.polygonHierarchy; if (!a(m)) throw new s("options.polygonHierarchy is required.");
  2793. this._vertexFormat = r, this._ellipsoid = i, this._granularity = n, this._stRotation = o, this._height = u, this._extrudedHeight = c, this._extrude = h, this._polygonHierarchy = m, this._workerName = "createPolygonGeometry" }; return X.fromPositions = function(t) { if (t = e(t, e.EMPTY_OBJECT), !a(t.positions)) throw new s("options.positions is required."); var r = { polygonHierarchy: { positions: t.positions }, height: t.height, extrudedHeight: t.extrudedHeight, vertexFormat: t.vertexFormat, stRotation: t.stRotation, ellipsoid: t.ellipsoid, granularity: t.granularity }; return new X(r) }, X.createGeometry = function(e) { var t, i, o, l, u = e._vertexFormat,
  2794. h = e._ellipsoid,
  2795. d = e._granularity,
  2796. m = e._stRotation,
  2797. v = e._height,
  2798. y = e._extrudedHeight,
  2799. w = e._extrude,
  2800. C = e._polygonHierarchy,
  2801. S = [],
  2802. E = new x;
  2803. E.enqueue(C), C = []; for (var b; 0 !== E.length;) { var M = E.dequeue(),
  2804. D = M.positions; if (D.length < 3) throw new s("At least three positions are required."); var I = M.holes ? M.holes.length : 0; if (0 === I) C.push({ outerRing: D, holes: [] }), S.push(M.positions);
  2805. else { var O = []; for (b = 0; I > b; b++) { var R = M.holes[b];
  2806. O.push(R.positions); var L = 0;
  2807. a(R.holes) && (L = R.holes.length); for (var z = 0; L > z; z++) E.enqueue(R.holes[z]) } C.push({ outerRing: D, holes: O }); var B = _.eliminateHoles(D, O);
  2808. S.push(B) } } l = S[0], t = r.fromPoints(l); var V, k = []; if (w) { for (b = 0; b < S.length; b++)
  2809. if (V = P(h, S[b], d, C[b]), a(V)) { o = V.topAndBottom, o.geometry = g.scaleToGeodeticHeightExtruded(o.geometry, v, y, h), o.geometry = A(u, o.geometry, l, h, m, !0, !1), k.push(o), i = V.walls; for (var U = 0; U < i.length; U++) { var W = i[U];
  2810. W.geometry = g.scaleToGeodeticHeightExtruded(W.geometry, v, y, h), W.geometry = A(u, W.geometry, l, h, m, !0, !0), k.push(W) } } } else
  2811. for (b = 0; b < S.length; b++) V = T(h, S[b], d), a(V) && (V.geometry = _.scaleToGeodeticHeight(V.geometry, v, h), V.geometry = A(u, V.geometry, l, h, m, !1, !1), k.push(V));
  2812. V = p.combine(k); var G = t.center;
  2813. F = h.geodeticSurfaceNormal(G, F), N = n.multiplyByScalar(F, v, N), G = n.add(G, N, G), w && (q = t.clone(q), G = q.center, N = n.multiplyByScalar(F, y, N), G = n.add(h.scaleToGeodeticSurface(G, G), N, G), t = r.union(t, q, t)), V.attributes.position.values = new Float64Array(V.attributes.position.values), V.indices = f.createTypedArray(V.attributes.position.values.length / 3, V.indices); var H = V.attributes; return u.position || delete H.position, new c({ attributes: H, indices: V.indices, primitiveType: V.primitiveType, boundingSphere: t }) }, X }), r("Core/PolygonOutlineGeometry", ["./defaultValue", "./defined", "./BoundingSphere", "./Cartesian3", "./ComponentDatatype", "./DeveloperError", "./Ellipsoid", "./EllipsoidTangentPlane", "./Geometry", "./GeometryAttribute", "./GeometryAttributes", "./GeometryInstance", "./GeometryPipeline", "./IndexDatatype", "./Math", "./PolygonGeometryLibrary", "./PolygonPipeline", "./PrimitiveType", "./Queue", "./WindingOrder"], function(e, t, r, i, n, o, a, s, l, u, c, h, d, m, p, f, v, y, g, _) { "use strict";
  2814. function w(e, t, r) { var i = v.removeDuplicates(t); if (i.length < 3) throw new o("Duplicate positions result in not enough positions to form a polygon."); var a = s.fromPoints(i, e),
  2815. d = a.projectPointsOntoPlane(i, x),
  2816. p = v.computeWindingOrder2D(d);
  2817. p === _.CLOCKWISE && (d.reverse(), i.reverse()); var g, w = [],
  2818. C = i.length; for (g = 0; C - 1 > g; g++) w = w.concat(f.subdivideLine(i[g], i[g + 1], r));
  2819. w = w.concat(f.subdivideLine(i[C - 1], i[0], r)), C = w.length / 3; var S = 2 * C,
  2820. E = m.createTypedArray(w.length / 3, S),
  2821. b = 0; for (g = 0; C - 1 > g; g++) E[b++] = g, E[b++] = g + 1; return E[b++] = C - 1, E[b++] = 0, new h({ geometry: new l({ attributes: new c({ position: new u({ componentDatatype: n.DOUBLE, componentsPerAttribute: 3, values: new Float64Array(w) }) }), indices: E, primitiveType: y.LINES }) }) }
  2822. function C(e, t, r) { var i = v.removeDuplicates(t); if (i.length < 3) throw new o("Duplicate positions result in not enough positions to form a polygon."); var a = s.fromPoints(i, e),
  2823. d = a.projectPointsOntoPlane(i, x),
  2824. p = v.computeWindingOrder2D(d);
  2825. p === _.CLOCKWISE && (d.reverse(), i.reverse()); var g, w = [],
  2826. C = i.length,
  2827. S = new Array(C); for (S[0] = 0, g = 0; C - 1 > g; g++) w = w.concat(f.subdivideLine(i[g], i[g + 1], r)), S[g + 1] = w.length / 3;
  2828. w = w.concat(f.subdivideLine(i[C - 1], i[0], r)), C = w.length / 3; var E = 2 * (2 * C + S.length),
  2829. b = m.createTypedArray(w.length / 3, E),
  2830. T = 0; for (g = 0; C - 1 > g; g++) b[T++] = g, b[T++] = g + 1, b[T++] = g + C, b[T++] = g + 1 + C; for (b[T++] = C - 1, b[T++] = 0, b[T++] = C + C - 1, b[T++] = C, g = 0; g < S.length; g++) { var A = S[g];
  2831. b[T++] = A, b[T++] = A + C } return w = w.concat(w), new h({ geometry: new l({ attributes: new c({ position: new u({ componentDatatype: n.DOUBLE, componentsPerAttribute: 3, values: new Float64Array(w) }) }), indices: b, primitiveType: y.LINES }) }) } var x = [],
  2832. S = new i,
  2833. E = new i,
  2834. b = new r,
  2835. T = function(r) { r = e(r, e.EMPTY_OBJECT); var i = e(r.ellipsoid, a.WGS84),
  2836. n = e(r.granularity, p.RADIANS_PER_DEGREE),
  2837. s = e(r.height, 0),
  2838. l = e(r.extrudedHeight, void 0),
  2839. u = t(l) && !p.equalsEpsilon(s, l, p.EPSILON6); if (u) { var c = l;
  2840. l = Math.min(c, s), s = Math.max(c, s) } var h = r.polygonHierarchy; if (!t(h)) throw new o("options.polygonHierarchy is required.");
  2841. this._ellipsoid = i, this._granularity = n, this._height = s, this._extrudedHeight = l, this._extrude = u, this._polygonHierarchy = h, this._workerName = "createPolygonOutlineGeometry" }; return T.fromPositions = function(r) { if (r = e(r, e.EMPTY_OBJECT), !t(r.positions)) throw new o("options.positions is required."); var i = { polygonHierarchy: { positions: r.positions }, height: r.height, extrudedHeight: r.extrudedHeight, ellipsoid: r.ellipsoid, granularity: r.granularity }; return new T(i) }, T.createGeometry = function(e) { var n, a, s = e._ellipsoid,
  2842. u = e._granularity,
  2843. c = e._height,
  2844. h = e._extrudedHeight,
  2845. m = e._extrude,
  2846. p = e._polygonHierarchy,
  2847. y = [],
  2848. _ = new g;
  2849. _.enqueue(p); for (var x; 0 !== _.length;) { var T = _.dequeue(),
  2850. A = T.positions; if (A.length < 3) throw new o("At least three positions are required."); var M = T.holes ? T.holes.length : 0; for (x = 0; M > x; x++) { var P = T.holes[x];
  2851. y.push(P.positions); var D = 0;
  2852. t(P.holes) && (D = P.holes.length); for (var I = 0; D > I; I++) _.enqueue(P.holes[I]) } y.push(A) } a = y[0], n = r.fromPoints(a); var O, R = []; if (m)
  2853. for (x = 0; x < y.length; x++) O = C(s, y[x], u), t(O) && (O.geometry = f.scaleToGeodeticHeightExtruded(O.geometry, c, h, s), R.push(O));
  2854. else
  2855. for (x = 0; x < y.length; x++) O = w(s, y[x], u), t(O) && (O.geometry = v.scaleToGeodeticHeight(O.geometry, c, s), R.push(O));
  2856. O = d.combine(R); var L = n.center; return E = s.geodeticSurfaceNormal(L, E), S = i.multiplyByScalar(E, c, S), L = i.add(L, S, L), m && (b = n.clone(b), L = b.center, S = i.multiplyByScalar(E, h, S), L = i.add(L, S, L), n = r.union(n, b, n)), new l({ attributes: O.attributes, indices: O.indices, primitiveType: O.primitiveType, boundingSphere: n }) }, T }), r("Core/ReferenceFrame", ["./Enumeration"], function(e) { "use strict"; var t = { FIXED: new e(0, "FIXED"), INERTIAL: new e(1, "INERTIAL") }; return t }), r("Core/destroyObject", ["./defaultValue", "./DeveloperError"], function(e, t) { "use strict";
  2857. function r() { return !0 } var i = function(i, n) {
  2858. function o() { throw new t(n) } n = e(n, "This object was destroyed, i.e., destroy() was called."); for (var a in i) "function" == typeof i[a] && (i[a] = o); return i.isDestroyed = r, void 0 }; return i }), r("Core/ScreenSpaceEventType", ["./Enumeration"], function(e) { "use strict"; var t = { LEFT_DOWN: new e(0, "LEFT_DOWN"), LEFT_UP: new e(1, "LEFT_UP"), LEFT_CLICK: new e(2, "LEFT_CLICK"), LEFT_DOUBLE_CLICK: new e(3, "LEFT_DOUBLE_CLICK"), RIGHT_DOWN: new e(5, "RIGHT_DOWN"), RIGHT_UP: new e(6, "RIGHT_UP"), RIGHT_CLICK: new e(7, "RIGHT_CLICK"), RIGHT_DOUBLE_CLICK: new e(8, "RIGHT_DOUBLE_CLICK"), MIDDLE_DOWN: new e(10, "MIDDLE_DOWN"), MIDDLE_UP: new e(11, "MIDDLE_UP"), MIDDLE_CLICK: new e(12, "MIDDLE_CLICK"), MIDDLE_DOUBLE_CLICK: new e(13, "MIDDLE_DOUBLE_CLICK"), MOUSE_MOVE: new e(15, "MOUSE_MOVE"), WHEEL: new e(16, "WHEEL"), PINCH_START: new e(17, "PINCH_START"), PINCH_END: new e(18, "PINCH_END"), PINCH_MOVE: new e(19, "PINCH_MOVE") }; return t }), r("Core/ScreenSpaceEventHandler", ["./DeveloperError", "./defined", "./destroyObject", "./Cartesian2", "./ScreenSpaceEventType", "./KeyboardEventModifier", "./defaultValue"], function(e, t, r, i, n, o, a) {
  2859. "use strict";
  2860. function s(e, t) { if (e._element === document) return { x: t.clientX, y: t.clientY }; var r = e._element.getBoundingClientRect(); return { x: t.clientX - r.left, y: t.clientY - r.top } }
  2861. function l(e) { return e.shiftKey ? o.SHIFT : e.ctrlKey ? o.CTRL : e.altKey ? o.ALT : void 0 }
  2862. function u(e, r) { var o = s(e, r); if (e._lastMouseX = o.x, e._lastMouseY = o.y, e._totalPixels = 0, !e._seenAnyTouchEvents) { var a, u = l(r);
  2863. 0 === r.button ? (e._leftMouseButtonDown = !0, a = e.getInputAction(n.LEFT_DOWN, u)) : 1 === r.button ? (e._middleMouseButtonDown = !0, a = e.getInputAction(n.MIDDLE_DOWN, u)) : 2 === r.button && (e._rightMouseButtonDown = !0, a = e.getInputAction(n.RIGHT_DOWN, u)), t(a) && a({ position: new i(o.x, o.y) }), r.preventDefault() } }
  2864. function c(e, r) { var o, a, u = l(r); if (!e._seenAnyTouchEvents) { 0 === r.button ? (e._leftMouseButtonDown = !1, o = e.getInputAction(n.LEFT_UP, u), a = e.getInputAction(n.LEFT_CLICK, u)) : 1 === r.button ? (e._middleMouseButtonDown = !1, o = e.getInputAction(n.MIDDLE_UP, u), a = e.getInputAction(n.MIDDLE_CLICK, u)) : 2 === r.button && (e._rightMouseButtonDown = !1, o = e.getInputAction(n.RIGHT_UP, u), a = e.getInputAction(n.RIGHT_CLICK, u)); var c = s(e, r),
  2865. h = e._lastMouseX - c.x,
  2866. d = e._lastMouseY - c.y;
  2867. e._totalPixels += Math.sqrt(h * h + d * d), t(o) && o({ position: new i(c.x, c.y) }), t(a) && e._totalPixels < e._clickPixelTolerance && a({ position: new i(c.x, c.y) }) } }
  2868. function h(e, r) { var o = s(e, r); if (!e._seenAnyTouchEvents) { var a = e._lastMouseX - o.x,
  2869. u = e._lastMouseY - o.y;
  2870. e._totalPixels += Math.sqrt(a * a + u * u); var c = { startPosition: new i(e._lastMouseX, e._lastMouseY), endPosition: new i(o.x, o.y), motion: new i },
  2871. h = l(r),
  2872. d = e.getInputAction(n.MOUSE_MOVE, h);
  2873. t(d) && d(c), e._lastMouseX = c.endPosition.x, e._lastMouseY = c.endPosition.y, (e._leftMouseButtonDown || e._middleMouseButtonDown || e._rightMouseButtonDown) && r.preventDefault() } }
  2874. function d(e, r) { var o, a, u = r.touches.length;
  2875. e._seenAnyTouchEvents = !0; var c, h = l(r);
  2876. o = s(e, r.touches[0]), 1 === u ? (e._lastMouseX = o.x, e._lastMouseY = o.y, e._totalPixels = 0, e._leftMouseButtonDown = !0, c = e.getInputAction(n.LEFT_DOWN, h), t(c) && c({ position: new i(o.x, o.y) }), r.preventDefault()) : e._leftMouseButtonDown && (e._leftMouseButtonDown = !1, c = e.getInputAction(n.LEFT_UP, h), t(c) && c({ position: new i(o.x, o.y) })), 2 === u ? (e._isPinching = !0, a = s(e, r.touches[1]), e._touchID1 = r.touches[0].identifier, e._touchID2 = r.touches[1].identifier, e._lastMouseX = o.x, e._lastMouseY = o.y, e._lastTouch2X = a.x, e._lastTouch2Y = a.y, c = e.getInputAction(n.PINCH_START, h), t(c) && c({ position1: new i(o.x, o.y), position2: new i(a.x, a.y) })) : e._isPinching && (e._isPinching = !1, c = e.getInputAction(n.PINCH_END, h), t(c) && c()) }
  2877. function m(e, r) { var o, a, u = r.touches.length,
  2878. c = r.changedTouches.length,
  2879. h = l(r); if (e._leftMouseButtonDown && (e._leftMouseButtonDown = !1, o = e.getInputAction(n.LEFT_UP, h), a = e.getInputAction(n.LEFT_CLICK, h), c > 0)) { var m = s(e, r.changedTouches[0]),
  2880. p = e._lastMouseX - m.x,
  2881. f = e._lastMouseY - m.y;
  2882. e._totalPixels += Math.sqrt(p * p + f * f), t(o) && o({ position: new i(m.x, m.y) }), t(a) && e._totalPixels < e._clickPixelTolerance && a({ position: new i(m.x, m.y) }) } e._isPinching && (e._isPinching = !1, o = e.getInputAction(n.PINCH_END, h), o && o()), (1 === u || 2 === u) && d(e, r) }
  2883. function p(e, r) {
  2884. var o, a, u, c, h = l(r);
  2885. if (e._leftMouseButtonDown && 1 === r.touches.length) {
  2886. o = s(e, r.touches[0]);
  2887. var d = e._lastMouseX - o.x,
  2888. m = e._lastMouseY - o.y;
  2889. e._totalPixels += Math.sqrt(d * d + m * m), c = { startPosition: new i(e._lastMouseX, e._lastMouseY), endPosition: new i(o.x, o.y), motion: new i }, u = e.getInputAction(n.MOUSE_MOVE, h), t(u) && u(c), e._lastMouseX = c.endPosition.x, e._lastMouseY = c.endPosition.y, (e._leftMouseButtonDown || e._middleMouseButtonDown || e._rightMouseButtonDown) && r.preventDefault()
  2890. }
  2891. if (e._isPinching && 2 === r.touches.length) { if (r.touches[0].identifier === e._touchID2 ? (o = s(e, r.touches[1]), a = s(e, r.touches[0])) : (o = s(e, r.touches[0]), a = s(e, r.touches[1])), u = e.getInputAction(n.PINCH_MOVE, h), t(u)) { var p = a.x - o.x,
  2892. f = a.y - o.y,
  2893. v = .25 * Math.sqrt(p * p + f * f),
  2894. y = e._lastTouch2X - e._lastMouseX,
  2895. g = e._lastTouch2Y - e._lastMouseY,
  2896. _ = .25 * Math.sqrt(y * y + g * g),
  2897. w = .125 * (a.y + o.y),
  2898. C = .125 * (e._lastTouch2Y + e._lastMouseY),
  2899. x = Math.atan2(f, p),
  2900. S = Math.atan2(g, y);
  2901. c = { distance: { startPosition: new i(0, _), endPosition: new i(0, v), motion: new i }, angleAndHeight: { startPosition: new i(S, C), endPosition: new i(x, w), motion: new i } }, u(c) } e._lastMouseX = o.x, e._lastMouseY = o.y, e._lastTouch2X = a.x, e._lastTouch2Y = a.y }
  2902. }
  2903. function f(e, r) { var i = r.detail ? -120 * r.detail : r.wheelDelta,
  2904. o = l(r),
  2905. a = n.WHEEL,
  2906. s = e.getInputAction(a, o);
  2907. t(s) && (r.preventDefault(), s(i)) }
  2908. function v(e, r) { var o, a = l(r),
  2909. u = s(e, r);
  2910. 0 === r.button ? o = e.getInputAction(n.LEFT_DOUBLE_CLICK, a) : 1 === r.button ? o = e.getInputAction(n.MIDDLE_DOUBLE_CLICK, a) : 2 === r.button && (o = e.getInputAction(n.RIGHT_DOUBLE_CLICK, a)), t(o) && o({ position: new i(u.x, u.y) }) }
  2911. function y(e) { var r = e,
  2912. i = !0;
  2913. e._callbacks = [], t(e._element.disableRootEvents) && (i = !1), e._callbacks.push({ name: "mousedown", onDoc: !1, action: function(e) { u(r, e) } }), e._callbacks.push({ name: "mouseup", onDoc: i, action: function(e) { c(r, e) } }), e._callbacks.push({ name: "mousemove", onDoc: i, action: function(e) { h(r, e) } }), e._callbacks.push({ name: "dblclick", onDoc: !1, action: function(e) { v(r, e) } }), e._callbacks.push({ name: "touchstart", onDoc: !1, action: function(e) { d(r, e) } }), e._callbacks.push({ name: "touchend", onDoc: i, action: function(e) { m(r, e) } }), e._callbacks.push({ name: "touchmove", onDoc: i, action: function(e) { p(r, e) } }), e._callbacks.push({ name: "mousewheel", onDoc: !1, action: function(e) { f(r, e) } }), e._callbacks.push({ name: "DOMMouseScroll", onDoc: !1, action: function(e) { f(r, e) } }); for (var n = 0; n < e._callbacks.length; n++) { var o = e._callbacks[n];
  2914. o.onDoc ? document.addEventListener(o.name, o.action, !1) : e._element.addEventListener(o.name, o.action, !1) } }
  2915. var g = function(e) { this._mouseEvents = {}; for (var t in n) n.hasOwnProperty(t) && (this._mouseEvents[t] = void 0);
  2916. this._modifiedMouseEvents = {}; for (var r in o)
  2917. if (o.hasOwnProperty(r)) { this._modifiedMouseEvents[r] = {}; for (t in n) n.hasOwnProperty(t) && (this._modifiedMouseEvents[r][t] = void 0) }
  2918. this._leftMouseButtonDown = !1, this._middleMouseButtonDown = !1, this._rightMouseButtonDown = !1, this._isPinching = !1, this._seenAnyTouchEvents = !1, this._lastMouseX = 0, this._lastMouseY = 0, this._lastTouch2X = 0, this._lastTouch2Y = 0, this._totalPixels = 0, this._touchID1 = 0, this._touchID2 = 0, this._clickPixelTolerance = 5, this._element = a(e, document), y(this) };
  2919. return g.prototype.setInputAction = function(r, i, n) { if (!t(r)) throw new e("action is required."); if (!t(i)) throw new e("type is required."); var o;
  2920. o = t(n) && t(n.name) ? this._modifiedMouseEvents[n.name] : this._mouseEvents, t(i) && t(i.name) && t(o) && (o[i.name] = r) }, g.prototype.getInputAction = function(r, i) { if (!t(r)) throw new e("type is required."); var n; return n = t(i) && t(i.name) ? this._modifiedMouseEvents[i.name] : this._mouseEvents, t(r) && t(r.name) && t(n) ? n[r.name] : void 0 }, g.prototype.removeInputAction = function(r, i) { if (!t(r)) throw new e("type is required."); var n;
  2921. n = t(i) && t(i.name) ? this._modifiedMouseEvents[i.name] : this._mouseEvents, t(r) && t(r.name) && t(n) && t(n[r.name]) && delete n[r.name] }, g.prototype._unregister = function() { for (var e = 0; e < this._callbacks.length; e++) { var t = this._callbacks[e];
  2922. t.onDoc ? document.removeEventListener(t.name, t.action, !1) : this._element.removeEventListener(t.name, t.action, !1) } }, g.prototype.isDestroyed = function() { return !1 }, g.prototype.destroy = function() { return this._unregister(), r(this) }, g
  2923. }), r("Core/Shapes", ["./defaultValue", "./defined", "./DeveloperError", "./Math", "./Cartesian3", "./Quaternion", "./Matrix3"], function(e, t, r, i, n, o, a) { "use strict";
  2924. function s(e, t, r, i, n, s, l, u, c, h, d, m, p, f, v, y, g, _) { for (var w, C, x, S, E, b, T, A, M = 0; _ > M; M++, p += v, ++g) { C = v > 0 ? m[p] + f : f - m[p], S = C + d, E = -Math.cos(S), T = c.multiplyByScalar(E), E = Math.sin(S), A = h.multiplyByScalar(E), T = T.add(A), E = Math.cos(C), E *= E, b = Math.sin(C), b *= b, x = n / Math.sqrt(i * E + r * b), w = x / t, E = Math.sin(w / 2); var P = new o(T.x * E, T.y * E, T.z * E, Math.cos(w / 2)).normalize(),
  2925. D = a.fromQuaternion(P),
  2926. I = D.multiplyByVector(u),
  2927. O = I.normalize();
  2928. I = O.multiplyByScalar(l), y[g] = I } } var l = { computeCircleBoundary: function(n, o, a, s) { if (!t(n) || !t(o) || !t(a)) throw new r("ellipsoid, center, and radius are required."); if (0 >= a) throw new r("radius must be greater than zero."); if (s = e(s, i.RADIANS_PER_DEGREE), 0 >= s) throw new r("granularity must be greater than zero."); return this.computeEllipseBoundary(n, o, a, a, 0, s) }, computeEllipseBoundary: function(o, a, l, u, c, h) { if (!(t(o) && t(a) && t(l) && t(u))) throw new r("ellipsoid, center, semiMajorAxis, and semiMinorAxis are required."); if (0 >= l || 0 >= u) throw new r("Semi-major and semi-minor axes must be greater than zero."); if (c = c || 0, h = e(h, i.RADIANS_PER_DEGREE), 0 >= h) throw new r("granularity must be greater than zero."); if (u > l) { var d = l;
  2929. l = u, u = d } for (var m = 2.31, p = l * l, f = u * u, v = l * u, y = 1 - f / p, g = Math.sqrt(y), _ = n.clone(a), w = _.magnitude(), C = new n(0, 0, 1), x = 1 / w, S = _.multiplyByScalar(x), E = C.cross(_).normalize(), b = S.cross(E), T = 1 + Math.ceil(i.PI_OVER_TWO / h), A = m / (T - 1), M = [], P = 0, D = 0, I = 0; T > I; I++, D += A, ++P)
  2930. if (M[P] = D - g * Math.sin(D), M[P] >= i.PI_OVER_TWO) { M[P] = i.PI_OVER_TWO, T = I + 1; break }
  2931. var O = []; return s(o, _.magnitude(), p, f, v, g, w, S, E, b, c, M, 0, 0, 1, O, 0, T - 1), s(o, _.magnitude(), p, f, v, g, w, S, E, b, c, M, T - 1, Math.PI, -1, O, T - 1, T - 1), s(o, _.magnitude(), p, f, v, g, w, S, E, b, c, M, 0, Math.PI, 1, O, 2 * T - 2, T - 1), s(o, _.magnitude(), p, f, v, g, w, S, E, b, c, M, T - 1, i.TWO_PI, -1, O, 3 * T - 3, T), O.push(O[0].clone()), O } }; return l }), r("Core/ShowGeometryInstanceAttribute", ["./defaultValue", "./defined", "./ComponentDatatype", "./DeveloperError"], function(e, t, r, i) { "use strict"; var n = function(t) { t = e(t, !0), this.componentDatatype = r.UNSIGNED_BYTE, this.componentsPerAttribute = 1, this.normalize = !0, this.value = n.toValue(t) }; return n.toValue = function(e) { if (!t(e)) throw new i("show is required."); return new Uint8Array([e]) }, n }), r("Core/Simon1994PlanetaryPositions", ["./Cartesian3", "./defined", "./DeveloperError", "./JulianDate", "./Math", "./Matrix3", "./TimeConstants", "./TimeStandard"], function(e, t, r, i, n, o, a, s) { "use strict";
  2932. function l(e) { var t = 6.239996 + .0172019696544 * e; return .001657 * Math.sin(t + .01671 * Math.sin(t)) }
  2933. function u(e, t) { t = e.addSeconds(w, t); var r = t.getTotalDays() - C; return t = t.addSeconds(l(r), t) }
  2934. function c(i, o, a, s, l, u, c, m) { if (0 > a && (a = -a, l += n.PI), 0 > a || a > n.PI) throw new r("The inclination is out of range. Inclination must be greater than or equal to zero and less than or equal to Pi radians."); var p = i * (1 - o),
  2935. v = s - l,
  2936. y = l,
  2937. g = d(u - s, o),
  2938. _ = h(o, 0); if ("Hyperbolic" === _ && Math.abs(n.NegativePiToPi(g)) >= Math.acos(-1 / o)) throw new r("The true anomaly of the hyperbolic orbit lies outside of the bounds of the hyperbola.");
  2939. f(v, a, y, P); var w = p * (1 + o),
  2940. C = Math.cos(g),
  2941. x = Math.sin(g),
  2942. S = 1 + o * C; if (S <= n.Epsilon10) throw new r("elements cannot be converted to cartesian"); var E = w / S; return t(m) ? (m.x = E * C, m.y = E * x, m.z = 0) : m = new e(E * C, E * x, 0), P.multiplyByVector(m, m) }
  2943. function h(e, t) { if (0 > e) throw new r("eccentricity cannot be negative."); return t >= e ? "Circular" : 1 - t > e ? "Elliptical" : 1 + t >= e ? "Parabolic" : "Hyperbolic" }
  2944. function d(e, t) { if (0 > t || t >= 1) throw new r("eccentricity out of range."); var i = m(e, t); return p(i, t) }
  2945. function m(e, t) { if (0 > t || t >= 1) throw new r("eccentricity out of range."); var i = Math.floor(e / n.TWO_PI);
  2946. e -= i * n.TWO_PI; var o, a = e + t * Math.sin(e) / (1 - Math.sin(e + t) + Math.sin(e)),
  2947. s = Number.MAX_VALUE; for (o = 0; D > o && Math.abs(s - a) > I; ++o) { s = a; var l = s - t * Math.sin(s) - e,
  2948. u = 1 - t * Math.cos(s);
  2949. a = s - l / u } if (o >= D) throw new r("Kepler equation did not converge"); return s = a + i * n.TWO_PI }
  2950. function p(e, t) { if (0 > t || t >= 1) throw new r("eccentricity out of range."); var i = Math.floor(e / n.TWO_PI);
  2951. e -= i * n.TWO_PI; var o = Math.cos(e) - t,
  2952. a = Math.sin(e) * Math.sqrt(1 - t * t),
  2953. s = Math.atan2(a, o); return s = n.zeroToTwoPi(s), 0 > e && (s -= n.TWO_PI), s += i * n.TWO_PI }
  2954. function f(e, i, a, s) { if (0 > i || i > n.PI) throw new r("inclination out of range"); var l = Math.cos(e),
  2955. u = Math.sin(e),
  2956. c = Math.cos(i),
  2957. h = Math.sin(i),
  2958. d = Math.cos(a),
  2959. m = Math.sin(a); return t(s) ? (s[0] = d * l - m * u * c, s[1] = m * l + d * u * c, s[2] = u * h, s[3] = -d * u - m * l * c, s[4] = -m * u + d * l * c, s[5] = l * h, s[6] = m * h, s[7] = -d * h, s[8] = c) : s = new o(d * l - m * u * c, -d * u - m * l * c, m * h, m * l + d * u * c, -m * u + d * l * c, -d * h, u * h, l * h, c), s }
  2960. function v(e, t) { u(e, Pt); var r = Pt.getJulianDayNumber() - x.getJulianDayNumber() + (Pt.getSecondsOfDay() - x.getSecondsOfDay()) / a.SECONDS_PER_DAY,
  2961. i = r / (10 * a.DAYS_PER_JULIAN_CENTURY),
  2962. n = .3595362 * i,
  2963. o = O + W * Math.cos(z * n) + J * Math.sin(z * n) + G * Math.cos(N * n) + Q * Math.sin(N * n) + H * Math.cos(F * n) + $ * Math.sin(F * n) + j * Math.cos(B * n) + et * Math.sin(B * n) + Y * Math.cos(V * n) + tt * Math.sin(V * n) + X * Math.cos(q * n) + rt * Math.sin(q * n) + Z * Math.cos(k * n) + it * Math.sin(k * n) + K * Math.cos(U * n) + nt * Math.sin(U * n),
  2964. s = R + L * i + mt * Math.cos(ot * n) + Ct * Math.sin(ot * n) + pt * Math.cos(at * n) + xt * Math.sin(at * n) + ft * Math.cos(st * n) + St * Math.sin(st * n) + vt * Math.cos(lt * n) + Et * Math.sin(lt * n) + yt * Math.cos(ut * n) + bt * Math.sin(ut * n) + gt * Math.cos(ct * n) + Tt * Math.sin(ct * n) + _t * Math.cos(ht * n) + At * Math.sin(ht * n) + wt * Math.cos(dt * n) + Mt * Math.sin(dt * n),
  2965. l = .0167086342 - .0004203654 * i,
  2966. h = 102.93734808 * T + 11612.3529 * A * i,
  2967. d = 469.97289 * A * i,
  2968. m = 174.87317577 * T - 8679.27034 * A * i; return c(o, l, d, h, m, s, E, t) }
  2969. function y(e, t) { u(e, Pt); var r = Pt.getJulianDayNumber() - x.getJulianDayNumber() + (Pt.getSecondsOfDay() - x.getSecondsOfDay()) / a.SECONDS_PER_DAY,
  2970. i = r / a.DAYS_PER_JULIAN_CENTURY,
  2971. n = i * i,
  2972. o = n * i,
  2973. s = o * i,
  2974. l = 383397.7725 + .004 * i,
  2975. h = .055545526 - 1.6e-8 * i,
  2976. d = 5.15668983 * T,
  2977. m = -8e-5 * i + .02966 * n - 42e-6 * o - 1.3e-7 * s,
  2978. p = 83.35324312 * T,
  2979. f = 14643420.2669 * i - 38.2702 * n - .045047 * o + 21301e-8 * s,
  2980. v = 125.04455501 * T,
  2981. y = -6967919.3631 * i + 6.3602 * n + .007625 * o - 3586e-8 * s,
  2982. g = 218.31664563 * T,
  2983. _ = 1732559343.4847 * i - 6.391 * n + .006588 * o - 3169e-8 * s,
  2984. w = 297.85019547 * T + A * (1602961601.209 * i - 6.3706 * n + .006593 * o - 3169e-8 * s),
  2985. C = 93.27209062 * T + A * (1739527262.8478 * i - 12.7512 * n - .001037 * o + 417e-8 * s),
  2986. E = 134.96340251 * T + A * (1717915923.2178 * i + 31.8792 * n + .051635 * o - 2447e-7 * s),
  2987. M = 357.52910918 * T + A * (129596581.0481 * i - .5532 * n + 136e-6 * o - 1149e-8 * s),
  2988. P = 310.17137918 * T - A * (6967051.436 * i + 6.2068 * n + .007618 * o - 3219e-8 * s),
  2989. D = 2 * w,
  2990. I = 4 * w,
  2991. O = 6 * w,
  2992. R = 2 * E,
  2993. L = 3 * E,
  2994. z = 4 * E,
  2995. N = 2 * C;
  2996. l += 3400.4 * Math.cos(D) - 635.6 * Math.cos(D - E) - 235.6 * Math.cos(E) + 218.1 * Math.cos(D - M) + 181 * Math.cos(D + E), h += .014216 * Math.cos(D - E) + .008551 * Math.cos(D - R) - .001383 * Math.cos(E) + .001356 * Math.cos(D + E) - .001147 * Math.cos(I - L) - 914e-6 * Math.cos(I - R) + 869e-6 * Math.cos(D - M - E) - 627e-6 * Math.cos(D) - 394e-6 * Math.cos(I - z) + 282e-6 * Math.cos(D - M - R) - 279e-6 * Math.cos(w - E) - 236e-6 * Math.cos(R) + 231e-6 * Math.cos(I) + 229e-6 * Math.cos(O - z) - 201e-6 * Math.cos(R - N), m += 486.26 * Math.cos(D - N) - 40.13 * Math.cos(D) + 37.51 * Math.cos(N) + 25.73 * Math.cos(R - N) + 19.97 * Math.cos(D - M - N), f += -55609 * Math.sin(D - E) - 34711 * Math.sin(D - R) - 9792 * Math.sin(E) + 9385 * Math.sin(I - L) + 7505 * Math.sin(I - R) + 5318 * Math.sin(D + E) + 3484 * Math.sin(I - z) - 3417 * Math.sin(D - M - E) - 2530 * Math.sin(O - z) - 2376 * Math.sin(D) - 2075 * Math.sin(D - L) - 1883 * Math.sin(R) - 1736 * Math.sin(O - 5 * E) + 1626 * Math.sin(M) - 1370 * Math.sin(O - L), y += -5392 * Math.sin(D - N) - 540 * Math.sin(M) - 441 * Math.sin(D) + 423 * Math.sin(N) - 288 * Math.sin(R - N), _ += -3332.9 * Math.sin(D) + 1197.4 * Math.sin(D - E) - 662.5 * Math.sin(M) + 396.3 * Math.sin(E) - 218 * Math.sin(D - M); var F = 2 * P,
  2997. B = 3 * P;
  2998. m += 46.997 * Math.cos(P) * i - .614 * Math.cos(D - N + P) * i + .614 * Math.cos(D - N - P) * i - .0297 * Math.cos(F) * n - .0335 * Math.cos(P) * n + .0012 * Math.cos(D - N + F) * n - 16e-5 * Math.cos(P) * o + 4e-5 * Math.cos(B) * o + 4e-5 * Math.cos(F) * o; var V = 2.116 * Math.sin(P) * i - .111 * Math.sin(D - N - P) * i - .0015 * Math.sin(P) * n;
  2999. f += V, _ += V, y += -520.77 * Math.sin(P) * i + 13.66 * Math.sin(D - N + P) * i + 1.12 * Math.sin(D - P) * i - 1.06 * Math.sin(N - P) * i + .66 * Math.sin(F) * n + .371 * Math.sin(P) * n - .035 * Math.sin(D - N + F) * n - .015 * Math.sin(D - N + P) * n + .0014 * Math.sin(P) * o - .0011 * Math.sin(B) * o - 9e-4 * Math.sin(F) * o, l *= b; var q = d + m * A,
  3000. k = p + f * A,
  3001. U = g + _ * A,
  3002. W = v + y * A; return c(l, h, q, k, W, U, S, t) }
  3003. function g(e, t) { var r = y(e); return t = r.multiplyByScalar(It, t) } var _ = {},
  3004. w = 32.184,
  3005. C = 2451545,
  3006. x = i.fromTotalDays(2451545, s.TAI),
  3007. S = 398600435e6,
  3008. E = 328900.56 * 1.012300034 * S,
  3009. b = 1e3,
  3010. T = n.RADIANS_PER_DEGREE,
  3011. A = n.RADIANS_PER_ARCSECOND,
  3012. M = 14959787e4,
  3013. P = new o,
  3014. D = 50,
  3015. I = n.EPSILON8,
  3016. O = 1.0000010178 * M,
  3017. R = 100.46645683 * T,
  3018. L = 1295977422.83429 * A,
  3019. z = 16002,
  3020. N = 21863,
  3021. F = 32004,
  3022. B = 10931,
  3023. V = 14529,
  3024. q = 16368,
  3025. k = 15318,
  3026. U = 32794,
  3027. W = 64e-7 * M,
  3028. G = -152 * 1e-7 * M,
  3029. H = 62e-7 * M,
  3030. j = -8e-7 * M,
  3031. Y = 32e-7 * M,
  3032. X = -41 * 1e-7 * M,
  3033. Z = 19e-7 * M,
  3034. K = -11 * 1e-7 * M,
  3035. J = -150 * 1e-7 * M,
  3036. Q = -46 * 1e-7 * M,
  3037. $ = 68 * 1e-7 * M,
  3038. et = 54e-7 * M,
  3039. tt = 14e-7 * M,
  3040. rt = 24e-7 * M,
  3041. it = -28 * 1e-7 * M,
  3042. nt = 22e-7 * M,
  3043. ot = 10,
  3044. at = 16002,
  3045. st = 21863,
  3046. lt = 10931,
  3047. ut = 1473,
  3048. ct = 32004,
  3049. ht = 4387,
  3050. dt = 73,
  3051. mt = -325 * 1e-7,
  3052. pt = -322 * 1e-7,
  3053. ft = -79 * 1e-7,
  3054. vt = 232 * 1e-7,
  3055. yt = -52 * 1e-7,
  3056. gt = 97e-7,
  3057. _t = 55e-7,
  3058. wt = -41 * 1e-7,
  3059. Ct = -105 * 1e-7,
  3060. xt = -137 * 1e-7,
  3061. St = 258e-7,
  3062. Et = 35e-7,
  3063. bt = -116 * 1e-7,
  3064. Tt = -88 * 1e-7,
  3065. At = -112 * 1e-7,
  3066. Mt = -80 * 1e-7,
  3067. Pt = new i,
  3068. Dt = .012300034,
  3069. It = -1 * (Dt / (Dt + 1)),
  3070. Ot = new o(1.0000000000000002, 5.619723173785822e-16, 4.690511510146299e-19, -5.154129427414611e-16, .9174820620691819, -.39777715593191376, -2.23970096136568e-16, .39777715593191376, .9174820620691819),
  3071. Rt = new e; return _.ComputeSunPositionInEarthInertialFrame = function(e, r) { return t(e) || (e = new i), Rt = v(e, Rt), r = Rt.negate(r), g(e, Rt), r.subtract(Rt, r), Ot.multiplyByVector(r, r), r }, _.ComputeMoonPositionInEarthInertialFrame = function(e, r) { return t(e) || (e = new i), r = y(e, r), Ot.multiplyByVector(r, r), r }, _ }), r("Core/SimplePolylineGeometry", ["./defined", "./DeveloperError", "./ComponentDatatype", "./IndexDatatype", "./PrimitiveType", "./defaultValue", "./BoundingSphere", "./Geometry", "./GeometryAttribute", "./GeometryAttributes"], function(e, t, r, i, n, o, a, s, l, u) { "use strict"; var c = function(r) { r = o(r, o.EMPTY_OBJECT); var i = r.positions; if (!e(i) || i.length < 2) throw new t("At least two positions are required.");
  3072. this._positions = i, this._workerName = "createSimplePolylineGeometry" }; return c.createGeometry = function(e) { var t, o = e._positions,
  3073. c = 0,
  3074. h = o.length,
  3075. d = new Float64Array(3 * h); for (t = 0; h > t; ++t) { var m = o[t];
  3076. d[c++] = m.x, d[c++] = m.y, d[c++] = m.z } var p = new u;
  3077. p.position = new l({ componentDatatype: r.DOUBLE, componentsPerAttribute: 3, values: d }); var f = 2 * (h - 1),
  3078. v = i.createTypedArray(h, f); for (c = 0, t = 0; h - 1 > t; ++t) v[c++] = t, v[c++] = t + 1; return new s({ attributes: p, indices: v, primitiveType: n.LINES, boundingSphere: a.fromPoints(o) }) }, c }), r("Core/SphereGeometry", ["./defaultValue", "./Cartesian3", "./EllipsoidGeometry"], function(e, t, r) { "use strict"; var i = function(i) { var n = e(i.radius, 1),
  3079. o = new t(n, n, n),
  3080. a = { radii: o, stackPartitions: i.stackPartitions, slicePartitions: i.slicePartitions, vertexFormat: i.vertexFormat };
  3081. this._ellipsoidGeometry = new r(a), this._workerName = "createSphereGeometry" }; return i.createGeometry = function(e) { return r.createGeometry(e._ellipsoidGeometry) }, i }), r("Core/SphereOutlineGeometry", ["./defaultValue", "./Cartesian3", "./EllipsoidOutlineGeometry"], function(e, t, r) { "use strict"; var i = function(i) { var n = e(i.radius, 1),
  3082. o = new t(n, n, n),
  3083. a = { radii: o, stackPartitions: i.stackPartitions, slicePartitions: i.slicePartitions, subdivisions: i.subdivisions };
  3084. this._ellipsoidGeometry = new r(a), this._workerName = "createSphereOutlineGeometry" }; return i.createGeometry = function(e) { return r.createGeometry(e._ellipsoidGeometry) }, i }), r("Core/Spherical", ["./DeveloperError", "./defaultValue", "./defined"], function(e, t, r) { "use strict"; var i = function(e, r, i) { this.clock = t(e, 0), this.cone = t(r, 0), this.magnitude = t(i, 1) }; return i.fromCartesian3 = function(t, n) { if (!r(t)) throw new e("cartesian3 is required"); var o = t.x,
  3085. a = t.y,
  3086. s = t.z,
  3087. l = o * o + a * a; return r(n) || (n = new i), n.clock = Math.atan2(a, o), n.cone = Math.atan2(Math.sqrt(l), s), n.magnitude = Math.sqrt(l + s * s), n }, i.clone = function(e, t) { return r(e) ? r(t) ? (t.clock = e.clock, t.cone = e.cone, t.magnitude = e.magnitude, t) : new i(e.clock, e.cone, e.magnitude) : void 0 }, i.normalize = function(t, n) { if (!r(t)) throw new e("spherical is required"); return r(n) ? (n.clock = t.clock, n.cone = t.cone, n.magnitude = 1, n) : new i(t.clock, t.cone, 1) }, i.equals = function(e, t) { return e === t || r(e) && r(t) && e.clock === t.clock && e.cone === t.cone && e.magnitude === t.magnitude }, i.equalsEpsilon = function(e, i, n) { return n = t(n, 0), e === i || r(e) && r(i) && Math.abs(e.clock - i.clock) <= n && Math.abs(e.cone - i.cone) <= n && Math.abs(e.magnitude - i.magnitude) <= n }, i.toString = function(e) { return "(" + e.clock + ", " + e.cone + ", " + e.magnitude + ")" }, i.prototype.clone = function(e) { return i.clone(this, e) }, i.prototype.normalize = function(e) { return i.normalize(this, e) }, i.prototype.equals = function(e) { return i.equals(this, e) }, i.prototype.equalsEpsilon = function(e, t) { return i.equalsEpsilon(this, e, t) }, i.prototype.toString = function() { return i.toString(this) }, i }), r("Core/isCrossOriginUrl", ["./defined"], function(e) { "use strict"; var t, r = function(r) { e(t) || (t = document.createElement("a")), t.href = window.location.href; var i = t.host,
  3088. n = t.protocol; return t.href = r, t.href = t.href, n !== t.protocol || i !== t.host }; return r }), r("Core/TaskProcessor", ["require", "./buildModuleUrl", "./defaultValue", "./defined", "./destroyObject", "./isCrossOriginUrl", "../ThirdParty/when", "../ThirdParty/Uri"], function(e, t, r, i, n, o, a, s) { "use strict";
  3089. function l(e, t) {--e._activeTasks; var r = t.data,
  3090. n = r.id,
  3091. o = e._deferreds,
  3092. a = o[n];
  3093. i(r.error) ? a.reject(r.error) : a.resolve(r.result), delete o[n] }
  3094. function u() { if (i(h)) return h; if (h = t("Workers/cesiumWorkerBootstrapper.js"), o(h)) { var e, r = 'importScripts("' + h + '");'; try { e = new Blob([r], { type: "application/javascript" }) } catch (n) { var a = window.BlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder || window.MSBlobBuilder,
  3095. s = new a;
  3096. s.append(r), e = s.getBlob("application/javascript") } var l = window.URL || window.webkitURL;
  3097. h = l.createObjectURL(e) } return h }
  3098. function c(n) { var o = u(),
  3099. a = new Worker(o);
  3100. a.postMessage = r(a.webkitPostMessage, a.postMessage); var c = { loaderConfig: {}, workerModule: d._workerModulePrefix + n._workerName }; if (i(e.toUrl)) { var h = new s("..").resolve(new s(t("Workers/cesiumWorkerBootstrapper.js"))).toString();
  3101. c.loaderConfig.baseUrl = h } else c.loaderConfig.paths = { Workers: t("Workers") };
  3102. a.postMessage(c), a.onmessage = function(e) { l(n, e) }, n._worker = a } var h, d = function(e, t) { this._workerName = e, this._maximumActiveTasks = r(t, 5), this._activeTasks = 0, this._deferreds = {}, this._nextID = 0 }; return d.prototype.scheduleTask = function(e, t) { if (i(this._worker) || c(this), this._activeTasks >= this._maximumActiveTasks) return void 0;++this._activeTasks; var r = this._nextID++,
  3103. n = a.defer(); return this._deferreds[r] = n, this._worker.postMessage({ id: r, parameters: e }, t), n.promise }, d.prototype.isDestroyed = function() { return !1 }, d.prototype.destroy = function() { return i(this._worker) && this._worker.terminate(), n(this) }, d._defaultWorkerModulePrefix = "Workers/", d._workerModulePrefix = d._defaultWorkerModulePrefix, d }), r("Core/TimeIntervalCollection", ["./defined", "./DeveloperError", "./binarySearch", "./TimeInterval", "./JulianDate"], function(e, t, r, i, n) { "use strict";
  3104. function o(e, t) { return n.compare(e.start, t.start) }
  3105. function a(t, r, i, n) { for (var o = 0, a = 0, l = new s, u = t._intervals, c = r._intervals; o < u.length && a < c.length;) { var h = u[o],
  3106. d = c[a]; if (h.stop.lessThan(d.start)) ++o;
  3107. else if (d.stop.lessThan(h.start)) ++a;
  3108. else { if (e(n) || e(i) && i(h, d) || !e(i) && d.data === h.data) { var m = h.intersect(d, n);
  3109. m.isEmpty || l.addInterval(m, i) } h.stop.lessThan(d.stop) || h.stop.equals(d.stop) && !h.isStopIncluded && d.isStopIncluded ? ++o : ++a } } return l } var s = function() { this._intervals = [] }; return s.prototype.get = function(e) { if (isNaN(e)) throw new t("index must be a number."); return this._intervals[e] }, s.prototype.getStart = function() { var e = this._intervals; return 0 === e.length ? void 0 : e[0].start }, s.prototype.getStop = function() { var e = this._intervals,
  3110. t = e.length; return 0 === t ? void 0 : e[t - 1].stop }, s.prototype.getLength = function() { return this._intervals.length }, s.prototype.clear = function() { this._intervals = [] }, s.prototype.isEmpty = function() { return 0 === this._intervals.length }, s.prototype.findIntervalContainingDate = function(e) { var t = this.indexOf(e); return t >= 0 ? this._intervals[t] : void 0 }, s.prototype.findDataForIntervalContainingDate = function(e) { var t = this.indexOf(e); return t >= 0 ? this._intervals[t].data : void 0 }, s.prototype.contains = function(e) { return this.indexOf(e) >= 0 }, s.prototype.indexOf = function(n) { if (!e(n)) throw new t("date required"); var a = this._intervals,
  3111. s = r(a, new i(n, n, !0, !0), o); return s >= 0 ? a[s].isStartIncluded ? s : s > 0 && a[s - 1].stop.equals(n) && a[s - 1].isStopIncluded ? s - 1 : ~s : (s = ~s, s > 0 && s - 1 < a.length && a[s - 1].contains(n) ? s - 1 : ~s) }, s.prototype.findInterval = function(t, r, i, n) { for (var o, a = this._intervals, s = 0, l = a.length; l > s; s++)
  3112. if (o = a[s], !(e(t) && !o.start.equals(t) || e(r) && !o.stop.equals(r) || e(i) && o.isStartIncluded !== i || e(n) && o.isStopIncluded !== n)) return a[s]; return void 0 }, s.prototype.addInterval = function(a, s) { if (!e(a)) throw new t("interval is required"); if (!a.isEmpty) { var l, u, c = this._intervals; if (0 === c.length || a.start.greaterThan(c[c.length - 1].stop)) return c.push(a), void 0; for (u = r(c, a, o), 0 > u ? u = ~u : u > 0 && a.isStartIncluded && c[u - 1].isStartIncluded && c[u - 1].start.equals(a.start) ? --u : u < c.length && !a.isStartIncluded && c[u].isStartIncluded && c[u].start.equals(a.start) && ++u, u > 0 && (l = n.compare(c[u - 1].stop, a.start), (l > 0 || 0 === l && (c[u - 1].isStopIncluded || a.isStartIncluded)) && ((e(s) ? s(c[u - 1].data, a.data) : c[u - 1].data === a.data) ? (a = a.stop.greaterThan(c[u - 1].stop) ? new i(c[u - 1].start, a.stop, c[u - 1].isStartIncluded, a.isStopIncluded, a.data) : new i(c[u - 1].start, c[u - 1].stop, c[u - 1].isStartIncluded, c[u - 1].isStopIncluded || a.stop.equals(c[u - 1].stop) && a.isStopIncluded, a.data), c.splice(u - 1, 1), --u) : (l = n.compare(c[u - 1].stop, a.stop), l > 0 || 0 === l && c[u - 1].isStopIncluded && !a.isStopIncluded ? c.splice(u - 1, 1, new i(c[u - 1].start, a.start, c[u - 1].isStartIncluded, !a.isStartIncluded, c[u - 1].data), new i(a.stop, c[u - 1].stop, !a.isStopIncluded, c[u - 1].isStopIncluded, c[u - 1].data)) : c[u - 1] = new i(c[u - 1].start, a.start, c[u - 1].isStartIncluded, !a.isStartIncluded, c[u - 1].data)))); u < c.length && (l = n.compare(a.stop, c[u].start), l > 0 || 0 === l && (a.isStopIncluded || c[u].isStartIncluded));)
  3113. if (e(s) ? s(c[u].data, a.data) : c[u].data === a.data) a = new i(a.start, c[u].stop.greaterThan(a.stop) ? c[u].stop : a.stop, a.isStartIncluded, c[u].stop.greaterThan(a.stop) ? c[u].isStopIncluded : a.isStopIncluded, a.data), c.splice(u, 1);
  3114. else { if (c[u] = new i(a.stop, c[u].stop, !a.isStopIncluded, c[u].isStopIncluded, c[u].data), !c[u].isEmpty) break;
  3115. c.splice(u, 1) }
  3116. c.splice(u, 0, a) } }, s.prototype.removeInterval = function(n) { if (!e(n)) throw new t("interval is required"); if (n.isEmpty) return !1; var a = !1,
  3117. s = this._intervals,
  3118. l = r(s, n, o);
  3119. 0 > l && (l = ~l); var u = n.start,
  3120. c = n.stop,
  3121. h = n.isStartIncluded,
  3122. d = n.isStopIncluded; if (l > 0) { var m = s[l - 1],
  3123. p = m.stop;
  3124. (p.greaterThan(u) || p.equals(u) && m.isStopIncluded && h) && (a = !0, (p.greaterThan(c) || m.isStopIncluded && !d && p.equals(c)) && s.splice(l, 0, new i(c, p, !d, m.isStopIncluded, m.data)), s[l - 1] = new i(m.start, u, m.isStartIncluded, !h, m.data)) } var f = s[l]; for (l < s.length && !h && f.isStartIncluded && u.equals(f.start) && (a = !0, s.splice(l, 0, new i(f.start, f.start, !0, !0, f.data)), ++l, f = s[l]); l < s.length && c.greaterThan(f.stop);) a = !0, s.splice(l, 1); return l < s.length && c.equals(f.stop) && (a = !0, !d && f.isStopIncluded ? l + 1 < s.length && s[l + 1].start.equals(c) && f.data === s[l + 1].data ? (s.splice(l, 1), s[l] = f = new i(f.start, f.stop, !0, f.isStopIncluded, f.data)) : s[l] = f = new i(c, c, !0, !0, f.data) : s.splice(l, 1)), l < s.length && (c.greaterThan(f.start) || c.equals(f.start) && d && f.isStartIncluded) && (a = !0, s[l] = new i(c, f.stop, !d, f.isStopIncluded, f.data)), a }, s.prototype.intersect = function(r, i, n) { if (!e(r)) throw new t("timeIntervalCollection is required."); return a(this, r, i, n) }, s.prototype.intersectInterval = function(r, i, n) { if (!e(r)) throw new t("interval is required."); var o = new s; return o.addInterval(r), a(this, o, i, n) }, s }), r("Core/WallGeometryLibrary", ["./defined", "./Cartographic", "./Cartesian3", "./DeveloperError", "./EllipsoidTangentPlane", "./PolygonPipeline", "./PolylinePipeline", "./Math", "./WindingOrder"], function(e, t, r, i, n, o, a, s, l) { "use strict";
  3125. function u(e, t, i, n, o) { var a, s = r.angleBetween(e, t),
  3126. l = Math.ceil(s / o),
  3127. u = new Array(l); if (i === n) { for (a = 0; l > a; a++) u[a] = i; return u } var c = n - i,
  3128. h = c / l; for (a = 1; l > a; a++) { var d = i + a * h;
  3129. u[a] = d } return u[0] = i, u }
  3130. function c(e, t) { return s.equalsEpsilon(e.latitude, t.latitude, s.EPSILON6) && s.equalsEpsilon(e.longitude, t.longitude, s.EPSILON6) }
  3131. function h(t, r, i, n) { var o = e(n),
  3132. a = e(i),
  3133. s = [],
  3134. l = [],
  3135. u = o ? [] : void 0,
  3136. h = r.length; if (2 > h) return r.slice(0); var d = r[0];
  3137. s.push(d); var f = t.cartesianToCartographic(d, m);
  3138. a && (f.height = i[0]), l.push(f.height), o && u.push(n[0]); for (var v = 1; h > v; ++v) { var y = r[v],
  3139. g = t.cartesianToCartographic(y, p);
  3140. a && (g.height = i[v]), c(f, g) ? f.height < g.height && (l[v - 1] = g.height) : (s.push(y), l.push(g.height), o && u.push(n[v])), f = g.clone(f) } return { positions: s, topHeights: l, bottomHeights: u } } var d = {},
  3141. m = new t,
  3142. p = new t; return d.computePositions = function(t, r, s, c, d, m) { var p = h(t, r, s, c); if (r = p.positions, s = p.topHeights, c = p.bottomHeights, r.length < 2) throw new i("unique positions must be greater than or equal to 2"); var f = e(c); if (r.length >= 3) { var v = n.fromPoints(r, t),
  3143. y = v.projectPointsOntoPlane(r);
  3144. o.computeWindingOrder2D(y) === l.CLOCKWISE && (r.reverse(), s.reverse(), f && c.reverse()) } var g, _ = r.length,
  3145. w = [],
  3146. C = f ? [] : void 0,
  3147. x = []; for (g = 0; _ - 1 > g; g++) { var S = r[g],
  3148. E = r[g + 1],
  3149. b = s[g],
  3150. T = s[g + 1];
  3151. w = w.concat(u(S, E, b, T, d)), m && w.push(T), f && (S = r[g], E = r[g + 1], b = c[g], T = c[g + 1], C = C.concat(u(S, E, b, T, d)), m && C.push(T)), m && (x = x.concat(a.scaleToSurface([S, E], d, t))) } m || (x = a.scaleToSurface(r, d, t), w.push(s[_ - 1]), f && C.push(c[_ - 1])); var A = f ? a.scaleToGeodeticHeight(x, C, t) : x.slice(0),
  3152. M = a.scaleToGeodeticHeight(x, w, t); return { newWallPositions: x, bottomPositions: A, topPositions: M } }, d }), r("Core/WallGeometry", ["./defaultValue", "./defined", "./BoundingSphere", "./Cartesian3", "./ComponentDatatype", "./IndexDatatype", "./DeveloperError", "./Ellipsoid", "./Geometry", "./GeometryAttribute", "./GeometryAttributes", "./Math", "./PrimitiveType", "./VertexFormat", "./WallGeometryLibrary"], function(e, t, r, i, n, o, a, s, l, u, c, h, d, m, p) { "use strict"; var f = new i,
  3153. v = new i,
  3154. y = new i,
  3155. g = new i,
  3156. _ = new i,
  3157. w = new i,
  3158. C = new i,
  3159. x = new i,
  3160. S = function(r) { r = e(r, e.EMPTY_OBJECT); var i = r.positions,
  3161. n = r.maximumHeights,
  3162. o = r.minimumHeights; if (!t(i)) throw new a("positions is required."); if (t(n) && n.length !== i.length) throw new a("positions and maximumHeights must have the same length."); if (t(o) && o.length !== i.length) throw new a("positions and minimumHeights must have the same length."); var l = e(r.vertexFormat, m.DEFAULT),
  3163. u = e(r.granularity, h.RADIANS_PER_DEGREE),
  3164. c = e(r.ellipsoid, s.WGS84);
  3165. this._positions = i, this._minimumHeights = o, this._maximumHeights = n, this._vertexFormat = l, this._granularity = u, this._ellipsoid = c, this._workerName = "createWallGeometry" }; return S.fromConstantHeights = function(r) { r = e(r, e.EMPTY_OBJECT); var i = r.positions; if (!t(i)) throw new a("options.positions is required."); var n, o, s = r.minimumHeight,
  3166. l = r.maximumHeight,
  3167. u = t(s),
  3168. c = t(l); if (u || c) { var h = i.length;
  3169. n = u ? new Array(h) : void 0, o = c ? new Array(h) : void 0; for (var d = 0; h > d; ++d) u && (n[d] = s), c && (o[d] = l) } var m = { positions: i, maximumHeights: o, minimumHeights: n, ellipsoid: r.ellipsoid, vertexFormat: r.vertexFormat }; return new S(m) }, S.createGeometry = function(e) { var t = e._positions,
  3170. a = e._minimumHeights,
  3171. s = e._maximumHeights,
  3172. m = e._vertexFormat,
  3173. S = e._granularity,
  3174. E = e._ellipsoid,
  3175. b = p.computePositions(E, t, s, a, S, !0),
  3176. T = b.newWallPositions,
  3177. A = b.bottomPositions,
  3178. M = b.topPositions,
  3179. P = T.length,
  3180. D = 2 * P,
  3181. I = m.position ? new Float64Array(D) : void 0,
  3182. O = m.normal ? new Float32Array(D) : void 0,
  3183. R = m.tangent ? new Float32Array(D) : void 0,
  3184. L = m.binormal ? new Float32Array(D) : void 0,
  3185. z = m.st ? new Float32Array(2 * (D / 3)) : void 0,
  3186. N = 0,
  3187. F = 0,
  3188. B = 0,
  3189. V = 0,
  3190. q = 0,
  3191. k = x,
  3192. U = C,
  3193. W = w,
  3194. G = !0;
  3195. P /= 3; var H; for (H = 0; P > H; ++H) { var j = 3 * H,
  3196. Y = i.fromArray(M, j, f),
  3197. X = i.fromArray(A, j, v); if (m.position && (I[N++] = X.x, I[N++] = X.y, I[N++] = X.z, I[N++] = Y.x, I[N++] = Y.y, I[N++] = Y.z), m.normal || m.tangent || m.binormal) { var Z, K, J = i.fromArray(T, j, v); if (P > H + 1 && (Z = i.fromArray(T, j + 3, y), K = i.fromArray(M, j + 3, _)), G) { var Q = K.subtract(Y, g),
  3198. $ = J.subtract(Y, f);
  3199. k = i.cross($, Q, k).normalize(k), G = !1 } Z.equalsEpsilon(J, h.EPSILON6) ? G = !0 : (m.tangent && (U = Z.subtract(J, U).normalize(U)), m.binormal && (W = i.cross(k, U, W).normalize(W))), m.normal && (O[F++] = k.x, O[F++] = k.y, O[F++] = k.z, O[F++] = k.x, O[F++] = k.y, O[F++] = k.z), m.tangent && (R[V++] = U.x, R[V++] = U.y, R[V++] = U.z, R[V++] = U.x, R[V++] = U.y, R[V++] = U.z), m.binormal && (L[B++] = W.x, L[B++] = W.y, L[B++] = W.z, L[B++] = W.x, L[B++] = W.y, L[B++] = W.z) } if (m.st) { var et = H / (P - 1);
  3200. z[q++] = et, z[q++] = 0, z[q++] = et, z[q++] = 1 } } var tt = new c;
  3201. m.position && (tt.position = new u({ componentDatatype: n.DOUBLE, componentsPerAttribute: 3, values: I })), m.normal && (tt.normal = new u({ componentDatatype: n.FLOAT, componentsPerAttribute: 3, values: O })), m.tangent && (tt.tangent = new u({ componentDatatype: n.FLOAT, componentsPerAttribute: 3, values: R })), m.binormal && (tt.binormal = new u({ componentDatatype: n.FLOAT, componentsPerAttribute: 3, values: L })), m.st && (tt.st = new u({ componentDatatype: n.FLOAT, componentsPerAttribute: 2, values: z })); var rt = D / 3;
  3202. D -= 6; var it = o.createTypedArray(rt, D),
  3203. nt = 0; for (H = 0; rt - 2 > H; H += 2) { var ot = H,
  3204. at = H + 2,
  3205. st = i.fromArray(I, 3 * ot, f),
  3206. lt = i.fromArray(I, 3 * at, v); if (!i.equalsEpsilon(st, lt, h.EPSILON6)) { var ut = H + 1,
  3207. ct = H + 3;
  3208. it[nt++] = ut, it[nt++] = ot, it[nt++] = ct, it[nt++] = ct, it[nt++] = ot, it[nt++] = at } } return new l({ attributes: tt, indices: it, primitiveType: d.TRIANGLES, boundingSphere: new r.fromVertices(I) }) }, S }), r("Core/WallOutlineGeometry", ["./defaultValue", "./defined", "./BoundingSphere", "./Cartesian3", "./Cartographic", "./ComponentDatatype", "./IndexDatatype", "./DeveloperError", "./Ellipsoid", "./Geometry", "./GeometryAttribute", "./GeometryAttributes", "./Math", "./PrimitiveType", "./WallGeometryLibrary"], function(e, t, r, i, n, o, a, s, l, u, c, h, d, m, p) { "use strict"; var f = new i,
  3209. v = new i,
  3210. y = function(r) { r = e(r, e.EMPTY_OBJECT); var i = r.positions,
  3211. n = r.maximumHeights,
  3212. o = r.minimumHeights; if (!t(i)) throw new s("positions is required."); if (t(n) && n.length !== i.length) throw new s("positions and maximumHeights must have the same length."); if (t(o) && o.length !== i.length) throw new s("positions and minimumHeights must have the same length."); var a = e(r.granularity, d.RADIANS_PER_DEGREE),
  3213. u = e(r.ellipsoid, l.WGS84);
  3214. this._positions = i, this._minimumHeights = o, this._maximumHeights = n, this._granularity = a, this._ellipsoid = u, this._workerName = "createWallOutlineGeometry" }; return y.fromConstantHeights = function(r) { r = e(r, e.EMPTY_OBJECT); var i = r.positions; if (!t(i)) throw new s("options.positions is required."); var n, o, a = r.minimumHeight,
  3215. l = r.maximumHeight,
  3216. u = t(a),
  3217. c = t(l); if (u || c) { var h = i.length;
  3218. n = u ? new Array(h) : void 0, o = c ? new Array(h) : void 0; for (var d = 0; h > d; ++d) u && (n[d] = a), c && (o[d] = l) } var m = { positions: i, maximumHeights: o, minimumHeights: n, ellipsoid: r.ellipsoid }; return new y(m) }, y.createGeometry = function(e) { var t = e._positions,
  3219. n = e._minimumHeights,
  3220. s = e._maximumHeights,
  3221. l = e._granularity,
  3222. y = e._ellipsoid,
  3223. g = p.computePositions(y, t, s, n, l, !1),
  3224. _ = g.newWallPositions,
  3225. w = g.bottomPositions,
  3226. C = g.topPositions,
  3227. x = _.length,
  3228. S = 2 * x,
  3229. E = new Float64Array(S),
  3230. b = 0;
  3231. x /= 3; var T; for (T = 0; x > T; ++T) { var A = 3 * T,
  3232. M = i.fromArray(C, A, f),
  3233. P = i.fromArray(w, A, v);
  3234. E[b++] = P.x, E[b++] = P.y, E[b++] = P.z, E[b++] = M.x, E[b++] = M.y, E[b++] = M.z } var D = new h({ position: new c({ componentDatatype: o.DOUBLE, componentsPerAttribute: 3, values: E }) }),
  3235. I = S / 3;
  3236. S = 2 * I - 4 + I; var O = a.createTypedArray(I, S),
  3237. R = 0; for (T = 0; I - 2 > T; T += 2) { var L = T,
  3238. z = T + 2,
  3239. N = i.fromArray(E, 3 * L, f),
  3240. F = i.fromArray(E, 3 * z, v); if (!i.equalsEpsilon(N, F, d.EPSILON6)) { var B = T + 1,
  3241. V = T + 3;
  3242. O[R++] = B, O[R++] = L, O[R++] = B, O[R++] = V, O[R++] = L, O[R++] = z } } return O[R++] = I - 2, O[R++] = I - 1, new u({ attributes: D, indices: O, primitiveType: m.LINES, boundingSphere: new r.fromVertices(E) }) }, y }), r("Core/WebMercatorProjection", ["./defaultValue", "./defined", "./Cartesian3", "./Cartographic", "./Math", "./Ellipsoid"], function(e, t, r, i, n, o) { "use strict"; var a = function(t) { this._ellipsoid = e(t, o.WGS84), this._semimajorAxis = this._ellipsoid.getMaximumRadius(), this._oneOverSemimajorAxis = 1 / this._semimajorAxis }; return a.mercatorAngleToGeodeticLatitude = function(e) { return n.PI_OVER_TWO - 2 * Math.atan(Math.exp(-e)) }, a.geodeticLatitudeToMercatorAngle = function(e) { e > a.MaximumLatitude ? e = a.MaximumLatitude : e < -a.MaximumLatitude && (e = -a.MaximumLatitude); var t = Math.sin(e); return .5 * Math.log((1 + t) / (1 - t)) }, a.MaximumLatitude = a.mercatorAngleToGeodeticLatitude(Math.PI), a.prototype.getEllipsoid = function() { return this._ellipsoid }, a.prototype.project = function(e, i) { var n = this._semimajorAxis,
  3243. o = e.longitude * n,
  3244. s = a.geodeticLatitudeToMercatorAngle(e.latitude) * n,
  3245. l = e.height; return t(i) ? (i.x = o, i.y = s, i.z = l, i) : new r(o, s, l) }, a.prototype.unproject = function(e, r) { var n = this._oneOverSemimajorAxis,
  3246. o = e.x * n,
  3247. s = a.mercatorAngleToGeodeticLatitude(e.y * n),
  3248. l = e.z; return t(r) ? (r.longitude = o, r.latitude = s, r.height = l, r) : new i(o, s, l) }, a }), r("Core/cancelAnimationFrame", ["./defined"], function(e) { "use strict"; var t = window.cancelAnimationFrame;! function() { if (!e(t))
  3249. for (var r = ["webkit", "moz", "ms", "o"], i = 0, n = r.length; n > i && !e(t);) t = window[r[i] + "CancelAnimationFrame"], e(t) || (t = window[r[i] + "CancelRequestAnimationFrame"]), ++i;
  3250. e(t) || (t = clearTimeout) }(); var r = function(e) { t(e) }; return r }), r("Core/combine", ["./DeveloperError", "./defaultValue", "./defined"], function(e, t, r) {
  3251. "use strict";
  3252. var i = function(e, r, i) { r = t(r, !0), i = t(i, !0); for (var o = {}, a = 0; a < e.length; a++) n(o, e[a], r, i); return o },
  3253. n = function(t, i, o, a) {
  3254. for (var s in i)
  3255. if (i.hasOwnProperty(s))
  3256. if (t.hasOwnProperty(s) && r(t[s])) {
  3257. if (!a) throw new e("Duplicate member: " + s);
  3258. o && "object" == typeof t[s] && "object" == typeof i[s] && n(t[s], i[s], o, a)
  3259. } else t[s] = i[s]
  3260. };
  3261. return i
  3262. }), r("Core/createGuid", [], function() { "use strict"; var e = function() { return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(e) { var t = 0 | 16 * Math.random(),
  3263. r = "x" === e ? t : 8 | 3 & t; return r.toString(16) }) }; return e }), r("Core/defineProperties", ["./defined"], function(e) { "use strict"; var t = function() { try { return "x" in Object.defineProperty({}, "x", {}) } catch (e) { return !1 } }(),
  3264. r = Object.defineProperties; return t && e(r) || (r = function(e) { return e }), r }), r("Core/getImagePixels", ["./defined"], function(e) { "use strict"; var t = {},
  3265. r = function(r, i, n) { e(i) || (i = r.width), e(n) || (n = r.height); var o = t[i];
  3266. e(o) || (o = {}, t[i] = o); var a = o[n]; if (!e(a)) { var s = document.createElement("canvas");
  3267. s.width = i, s.height = n, a = s.getContext("2d"), a.globalCompositeOperation = "copy", o[n] = a } return a.drawImage(r, 0, 0, i, n), a.getImageData(0, 0, i, n).data }; return r }), r("Core/jsonp", ["./defaultValue", "./defined", "./DeveloperError", "../ThirdParty/when"], function(e, t, r, i) { "use strict";
  3268. function n(e, t, r) { e.push(encodeURIComponent(t) + "=" + encodeURIComponent(r)) } var o = function(a, s) { if (!t(a)) throw new r("url is required.");
  3269. s = e(s, e.EMPTY_OBJECT); var l, u = i.defer();
  3270. do l = "jsonp" + Math.random().toString().substring(2, 8); while (t(window[l]));
  3271. window[l] = function(e) { u.resolve(e); try { delete window[l] } catch (t) { window[l] = void 0 } }; var c = e(s.callbackParameterName, "callback"),
  3272. h = [];
  3273. n(h, c, l); var d = e(s.parameters, e.EMPTY_OBJECT); for (var m in d) d.hasOwnProperty(m) && n(h, m, d[m]);
  3274. h.length > 0 && (a += -1 === a.indexOf("?") ? "?" : "&", a += h.join("&")); var p = s.proxy; return t(p) && (a = p.getURL(a)), o.loadAndExecuteScript(a, l, u), u.promise }; return o.loadAndExecuteScript = function(e, t, r) { var i = document.createElement("script");
  3275. i.async = !0, i.src = e; var n = document.getElementsByTagName("head")[0];
  3276. i.onload = function() { i.onload = void 0, n.removeChild(i) }, i.onerror = function(e) { r.reject(e) }, n.appendChild(i) }, o.defaultLoadAndExecuteScript = o.loadAndExecuteScript, o }), r("Core/loadArrayBuffer", ["./loadWithXhr"], function(e) { "use strict"; var t = function(t, r) { return e(t, "arraybuffer", r) }; return t }), r("Core/loadBlob", ["./loadWithXhr"], function(e) { "use strict"; var t = function(t, r) { return e(t, "blob", r) }; return t }), r("Core/loadImage", ["./defaultValue", "./defined", "./DeveloperError", "./isCrossOriginUrl", "../ThirdParty/when"], function(e, t, r, i, n) { "use strict"; var o = /^data:/,
  3277. a = function(s, l) { if (!t(s)) throw new r("url is required."); return l = e(l, !0), n(s, function(e) { var t;
  3278. t = o.test(e) || !l ? !1 : i(e); var r = n.defer(); return a.createImage(e, t, r), r.promise }) }; return a.createImage = function(e, t, r) { var i = new Image;
  3279. i.onload = function() { r.resolve(i) }, i.onerror = function(e) { r.reject(e) }, t && (i.crossOrigin = ""), i.src = e }, a.defaultCreateImage = a.createImage, a }), r("Core/loadImageViaBlob", ["./loadBlob", "./loadImage"], function(e, t) { "use strict"; var r = /^data:/,
  3280. i = function(i) { return r.test(i) ? t(i) : e(i).then(function(e) { var r = window.URL.createObjectURL(e); return t(r, !1).then(function(t) { return t.blob = e, window.URL.revokeObjectURL(r), t }, function(e) { return window.URL.revokeObjectURL(r), e }) }) },
  3281. n = function() { try { var e = new XMLHttpRequest; return e.open("GET", "#", !0), e.responseType = "blob", "blob" === e.responseType } catch (t) { return !1 } }(); return n ? i : t }), r("Core/loadXML", ["./defined", "./DeveloperError", "./RequestErrorEvent", "../ThirdParty/when"], function(e, t, r, i) { "use strict"; var n = function(r, o) { if (!e(r)) throw new t("url is required."); return i(r, function(e) { var t = i.defer(); return n.loadXML(e, o, t), t.promise }) }; return n.loadXML = function(t, i, n) { var o = new XMLHttpRequest; if (o.overrideMimeType("text/xml"), o.open("GET", t, !0), e(i))
  3282. for (var a in i) i.hasOwnProperty(a) && o.setRequestHeader(a, i[a]);
  3283. o.onload = function() { 200 === o.status ? n.resolve(o.responseXML) : n.reject(new r(o.status, o.response)) }, o.onerror = function() { n.reject(new r) }, o.send() }, n.defaultLoadXML = n.loadXML, n }), r("Core/requestAnimationFrame", ["./defined"], function(e) { "use strict"; var t = window.requestAnimationFrame;! function() { if (!e(t))
  3284. for (var r = ["webkit", "moz", "ms", "o"], i = 0, n = r.length; n > i && !e(t);) t = window[r[i] + "RequestAnimationFrame"], ++i; if (!e(t)) { var o = 0;
  3285. t = function(e) { var t = Date.now(),
  3286. r = Math.max(16 - (t - o), 0); return o = t + r, setTimeout(function() { e(o) }, r) } } }(); var r = function(e) { return t(e) }; return r }), r("Core/throttleRequestByServer", ["./defaultValue", "./defined", "../ThirdParty/when"], function(e, t, r) { "use strict";
  3287. function i(e) { return t(o) || (o = document.createElement("a")), o.href = e, o.hostname + "%" + o.port }
  3288. function n(t, n) { var o = i(t),
  3289. l = e(s[o], 0); return l > a ? void 0 : (s[o] = l + 1, r(n(t), function(e) { return s[o]--, e }, function(e) { return s[o]--, r.reject(e) })) } var o, a = 6,
  3290. s = {}; return n }), r("Core/wrapFunction", ["./DeveloperError"], function(e) { "use strict"; var t = function(t, r, i) { if ("function" != typeof r) throw new e("oldFunction is required to be a function."); if ("function" != typeof i) throw new e("oldFunction is required to be a function."); return function() { i.apply(t, arguments), r.apply(t, arguments) } }; return t }), r("ThirdParty/measureText", [], function() { var e = function(e, t) { return document.defaultView.getComputedStyle(e, null).getPropertyValue(t) },
  3291. t = function(t, r, i, n) { var o = t.measureText(r),
  3292. a = e(t.canvas, "font-family"),
  3293. s = e(t.canvas, "font-size").replace("px", ""),
  3294. l = !/\S/.test(r);
  3295. o.fontsize = s; var u = document.createElement("div");
  3296. u.style.position = "absolute", u.style.opacity = 0, u.style.font = s + "px " + a, u.innerHTML = r + "<br/>" + r, document.body.appendChild(u), o.leading = 1.2 * s; var c = e(u, "height"); if (c = c.replace("px", ""), c >= 2 * s && (o.leading = 0 | c / 2), document.body.removeChild(u), l) o.ascent = 0, o.descent = 0, o.bounds = { minx: 0, maxx: o.width, miny: 0, maxy: 0 }, o.height = 0;
  3297. else { var h = document.createElement("canvas"),
  3298. d = 100;
  3299. h.width = o.width + d, h.height = 3 * s, h.style.opacity = 1, h.style.fontFamily = a, h.style.fontSize = s; var m = h.getContext("2d");
  3300. m.font = s + "px " + a; var p = h.width,
  3301. f = h.height,
  3302. v = f / 2;
  3303. m.fillStyle = "white", m.fillRect(-1, -1, p + 2, f + 2), i && (m.strokeStyle = "black", m.lineWidth = t.lineWidth, m.strokeText(r, d / 2, v)), n && (m.fillStyle = "black", m.fillText(r, d / 2, v)); for (var y = m.getImageData(0, 0, p, f).data, g = 0, _ = 4 * p, w = y.length; ++g < w && 255 === y[g];); var C = 0 | g / _; for (g = w - 1; --g > 0 && 255 === y[g];); var x = 0 | g / _; for (g = 0; w > g && 255 === y[g];) g += _, g >= w && (g = g - w + 4); var S = 0 | g % _ / 4,
  3304. E = 1; for (g = w - 3; g >= 0 && 255 === y[g];) g -= _, 0 > g && (g = w - 3 - 4 * E++); var b = 0 | g % _ / 4 + 1;
  3305. o.ascent = v - C, o.descent = x - v, o.bounds = { minx: S - d / 2, maxx: b - d / 2, miny: 0, maxy: x - C }, o.height = 1 + (x - C) } return o }; return t }), r("Core/writeTextToCanvas", ["./defaultValue", "./defined", "./DeveloperError", "./Color", "../ThirdParty/measureText"], function(e, t, r, i, n) { "use strict"; var o = function(o, a) { if (!t(o)) throw new r("text is required."); if ("" === o) return void 0;
  3306. a = e(a, e.EMPTY_OBJECT); var s = e(a.font, "10px sans-serif"),
  3307. l = document.createElement("canvas");
  3308. l.width = l.height = 1, l.style.font = s; var u = l.getContext("2d");
  3309. u.font = s, u.textBaseline = e(a.textBaseline, "bottom"), l.style.visibility = "hidden", document.body.appendChild(l); var c = e(a.stroke, !1),
  3310. h = e(a.fill, !0),
  3311. d = 2 * e(a.strokeWidth, 1);
  3312. u.lineWidth = d; var m = n(u, o, c, h);
  3313. l.dimensions = m, document.body.removeChild(l), l.style.visibility = ""; var p = m.height - m.ascent;
  3314. l.width = m.width, l.height = m.height; var f = l.height - p; if (u.font = s, c) { var v = e(a.strokeColor, i.BLACK);
  3315. u.strokeStyle = v.toCssColorString(), u.lineWidth = d, u.strokeText(o, 0, f) } if (h) { var y = e(a.fillColor, i.WHITE);
  3316. u.fillStyle = y.toCssColorString(), u.fillText(o, 0, f) } return l }; return o }), r("DynamicScene/ConstantProperty", ["../Core/defaultValue", "../Core/defined", "../Core/DeveloperError", "../Core/Enumeration"], function(e, t, r, i) { "use strict";
  3317. function n(e, t) { return e.clone(t) }
  3318. function o(e) { return e } var a = function(a, s) { if (!t(a)) throw new r("value is required."); if (!("object" != typeof a || Array.isArray(a) || a instanceof i)) { if ("function" != typeof a.clone && "function" != typeof s) throw new r("clone is a required function.");
  3319. s = e(s, n) } this._value = a, this._clone = e(s, o) }; return a.prototype.getValue = function(e, t) { return this._clone(this._value, t) }, a }), r("DynamicScene/ColorMaterialProperty", ["../Core/Color", "../Core/defined", "./ConstantProperty"], function(e, t, r) { "use strict"; var i = function() { this.color = new r(e.WHITE) }; return i.prototype.getType = function() { return "Color" }, i.prototype.getValue = function(e, r) { return t(r) || (r = {}), r.color = t(this.color) ? this.color.getValue(e, r.color) : void 0, r }, i }), r("DynamicScene/DynamicObject", ["../Core/createGuid", "../Core/defaultValue", "../Core/defined", "../Core/DeveloperError", "../Core/JulianDate", "../Core/TimeInterval"], function(e, t, r, i, n, o) { "use strict"; var a = function(t) { this._cachedAvailabilityDate = void 0, this._cachedAvailabilityValue = void 0, r(t) || (t = e()), this.id = t, this.availability = void 0, this.position = void 0, this.orientation = void 0, this.billboard = void 0, this.cone = void 0, this.ellipsoid = void 0, this.ellipse = void 0, this.label = void 0, this.path = void 0, this.point = void 0, this.polygon = void 0, this.polyline = void 0, this.pyramid = void 0, this.vertexPositions = void 0, this.vector = void 0, this.viewFrom = void 0 }; return a.prototype.isAvailable = function(e) { if (!r(e)) throw new i("time is required."); var t = this.availability; if (!r(t)) return !0; if (n.equals(this._cachedAvailabilityDate, e)) return this._cachedAvailabilityValue; var o = t.contains(e); return this._cachedAvailabilityDate = n.clone(e, this._cachedAvailabilityDate), this._cachedAvailabilityValue = o, o }, a.prototype.merge = function(e) { if (!r(e)) throw new i("other is required"); for (var n in e) e.hasOwnProperty(n) && (this[n] = t(this[n], e[n])) }, a.mergeProperties = function(e, i) { e.position = t(e.position, i.position), e.orientation = t(e.orientation, i.orientation), e.vertexPositions = t(e.vertexPositions, i.vertexPositions), e.viewFrom = t(e.viewFrom, i.viewFrom); var n = i.availability;
  3320. r(n) && e._setAvailability(n) }, a.undefineProperties = function(e) { e.position = void 0, e.orientation = void 0, e.vertexPositions = void 0, e.viewFrom = void 0, e._setAvailability(void 0) }, a.prototype._setAvailability = function(e) { var t = !o.equals(this.availability, e); return this.availability = e, this._cachedAvailabilityDate = void 0, this._cachedAvailabilityValue = void 0, t }, a }), r("DynamicScene/DynamicBillboard", ["../Core/defaultValue", "../Core/defined"], function(e, t) { "use strict"; var r = function() { this.image = void 0, this.scale = void 0, this.rotation = void 0, this.alignedAxis = void 0, this.horizontalOrigin = void 0, this.verticalOrigin = void 0, this.color = void 0, this.eyeOffset = void 0, this.pixelOffset = void 0, this.show = void 0 }; return r.mergeProperties = function(i, n) { var o = n.billboard; if (t(o)) { var a = i.billboard;
  3321. t(a) || (i.billboard = a = new r), a.color = e(a.color, o.color), a.eyeOffset = e(a.eyeOffset, o.eyeOffset), a.horizontalOrigin = e(a.horizontalOrigin, o.horizontalOrigin), a.image = e(a.image, o.image), a.pixelOffset = e(a.pixelOffset, o.pixelOffset), a.scale = e(a.scale, o.scale), a.rotation = e(a.rotation, o.rotation), a.alignedAxis = e(a.alignedAxis, o.alignedAxis), a.show = e(a.show, o.show), a.verticalOrigin = e(a.verticalOrigin, o.verticalOrigin) } }, r.undefineProperties = function(e) { e.billboard = void 0 }, r }), r("DynamicScene/DynamicClock", ["../Core/Iso8601", "../Core/ClockRange", "../Core/ClockStep", "../Core/defined"], function(e, t, r, i) { "use strict"; var n = function() { this.startTime = e.MAXIMUM_INTERVAL.start, this.stopTime = e.MAXIMUM_INTERVAL.stop, this.currentTime = e.MAXIMUM_INTERVAL.start, this.clockRange = t.LOOP_STOP, this.clockStep = r.SYSTEM_CLOCK_MULTIPLIER, this.multiplier = 1 }; return n.prototype.clone = function(e) { return i(e) || (e = new n), e.startTime = this.startTime, e.stopTime = this.stopTime, e.clockRange = this.clockRange, e.clockStep = this.clockStep, e.multiplier = this.multiplier, e.currentTime = this.currentTime, e }, n.mergeProperties = function(e, t) { var r = t.clock; if (i(r)) { var o = e.clock;
  3322. i(o) || (o = new n, e.clock = o), o.startTime = r.startTime, o.stopTime = r.stopTime, o.currentTime = r.currentTime, o.clockRange = r.clockRange, o.clockStep = r.clockStep, o.multiplier = r.multiplier } }, n.undefineProperties = function(e) { e.clock = void 0 }, n }), r("DynamicScene/DynamicEllipse", ["../Core/defaultValue", "../Core/defined", "../Core/Cartesian3", "../Core/Ellipsoid", "../Core/Shapes"], function(e, t, r, i, n) { "use strict"; var o = function() { this.semiMajorAxis = void 0, this.semiMinorAxis = void 0, this.bearing = void 0, this._lastPosition = void 0, this._lastSemiMajorAxis = void 0, this._lastSemiMinorAxis = void 0, this._lastBearing = void 0, this._cachedVertexPositions = void 0 }; return o.mergeProperties = function(r, i) { var n = i.ellipse; if (t(n)) { var a = r.ellipse;
  3323. t(a) || (r.ellipse = a = new o), a.bearing = e(a.bearing, n.bearing), a.semiMajorAxis = e(a.semiMajorAxis, n.semiMajorAxis), a.semiMinorAxis = e(a.semiMinorAxis, n.semiMinorAxis) } }, o.undefineProperties = function(e) { e.ellipse = void 0 }, o.prototype.getValue = function(e, o) { var a = this.semiMajorAxis,
  3324. s = this.semiMinorAxis; if (!t(o) || !t(a) || !t(s)) return void 0; var l = a.getValue(e),
  3325. u = s.getValue(e),
  3326. c = 0,
  3327. h = this.bearing; if (t(h) && (c = h.getValue(e)), !t(l) || !t(u) || 0 === l || 0 === u) return void 0; var d = this._lastPosition,
  3328. m = this._lastSemiMajorAxis,
  3329. p = this._lastSemiMinorAxis,
  3330. f = this._lastBearing; return c === f && m === l && p === u && r.equals(d, o) || (this._cachedVertexPositions = n.computeEllipseBoundary(i.WGS84, o, l, u, c), this._lastPosition = r.clone(o, this._lastPosition), this._lastBearing = c, this._lastSemiMajorAxis = l, this._lastSemiMinorAxis = u), this._cachedVertexPositions }, o }), r("DynamicScene/DynamicEllipsoid", ["../Core/defaultValue", "../Core/defined"], function(e, t) { "use strict"; var r = function() { this.show = void 0, this.radii = void 0, this.material = void 0 }; return r.mergeProperties = function(i, n) { var o = n.ellipsoid; if (t(o)) { var a = i.ellipsoid;
  3331. t(a) || (i.ellipsoid = a = new r), a.show = e(a.show, o.show), a.radii = e(a.radii, o.radii), a.material = e(a.material, o.material) } }, r.undefineProperties = function(e) { e.ellipsoid = void 0 }, r }), r("DynamicScene/DynamicCone", ["../Core/defaultValue", "../Core/defined"], function(e, t) { "use strict"; var r = function() { this.minimumClockAngle = void 0, this.maximumClockAngle = void 0, this.innerHalfAngle = void 0, this.outerHalfAngle = void 0, this.capMaterial = void 0, this.innerMaterial = void 0, this.outerMaterial = void 0, this.silhouetteMaterial = void 0, this.intersectionColor = void 0, this.intersectionWidth = void 0, this.showIntersection = void 0, this.radius = void 0, this.show = void 0 }; return r.mergeProperties = function(i, n) { var o = n.cone; if (t(o)) { var a = i.cone;
  3332. t(a) || (i.cone = a = new r), a.show = e(a.show, o.show), a.innerHalfAngle = e(a.innerHalfAngle, o.innerHalfAngle), a.outerHalfAngle = e(a.outerHalfAngle, o.outerHalfAngle), a.minimumClockAngle = e(a.minimumClockAngle, o.minimumClockAngle), a.maximumClockAngle = e(a.maximumClockAngle, o.maximumClockAngle), a.radius = e(a.radius, o.radius), a.showIntersection = e(a.showIntersection, o.showIntersection), a.intersectionColor = e(a.intersectionColor, o.intersectionColor), a.intersectionWidth = e(a.intersectionWidth, o.intersectionWidth), a.capMaterial = e(a.capMaterial, o.capMaterial), a.innerMaterial = e(a.innerMaterial, o.innerMaterial), a.outerMaterial = e(a.outerMaterial, o.outerMaterial), a.silhouetteMaterial = e(a.silhouetteMaterial, o.silhouetteMaterial) } }, r.undefineProperties = function(e) { e.cone = void 0 }, r }), r("DynamicScene/DynamicLabel", ["../Core/defaultValue", "../Core/defined"], function(e, t) { "use strict"; var r = function() { this.text = void 0, this.font = void 0, this.style = void 0, this.fillColor = void 0, this.outlineColor = void 0, this.outlineWidth = void 0, this.horizontalOrigin = void 0, this.verticalOrigin = void 0, this.eyeOffset = void 0, this.pixelOffset = void 0, this.scale = void 0, this.show = void 0 }; return r.mergeProperties = function(i, n) { var o = n.label; if (t(o)) { var a = i.label;
  3333. t(a) || (i.label = a = new r), a.text = e(a.text, o.text), a.font = e(a.font, o.font), a.show = e(a.show, o.show), a.style = e(a.style, o.style), a.fillColor = e(a.fillColor, o.fillColor), a.outlineColor = e(a.outlineColor, o.outlineColor), a.outlineWidth = e(a.outlineWidth, o.outlineWidth), a.scale = e(a.scale, o.scale), a.horizontalOrigin = e(a.horizontalOrigin, o.horizontalOrigin), a.verticalOrigin = e(a.verticalOrigin, o.verticalOrigin), a.eyeOffset = e(a.eyeOffset, o.eyeOffset), a.pixelOffset = e(a.pixelOffset, o.pixelOffset) } }, r.undefineProperties = function(e) { e.label = void 0 }, r }), r("DynamicScene/DynamicPath", ["../Core/defaultValue", "../Core/defined"], function(e, t) { "use strict"; var r = function() { this.color = void 0, this.outlineColor = void 0, this.outlineWidth = void 0, this.show = void 0, this.width = void 0, this.resolution = void 0, this.leadTime = void 0, this.trailTime = void 0 }; return r.mergeProperties = function(i, n) { var o = n.path; if (t(o)) { var a = i.path;
  3334. t(a) || (i.path = a = new r), a.color = e(a.color, o.color), a.width = e(a.width, o.width), a.resolution = e(a.resolution, o.resolution), a.outlineColor = e(a.outlineColor, o.outlineColor), a.outlineWidth = e(a.outlineWidth, o.outlineWidth), a.show = e(a.show, o.show), a.leadTime = e(a.leadTime, o.leadTime), a.trailTime = e(a.trailTime, o.trailTime) } }, r.undefineProperties = function(e) { e.path = void 0 }, r }), r("DynamicScene/DynamicPoint", ["../Core/defined", "../Core/defaultValue"], function(e, t) { "use strict"; var r = function() { this.color = void 0, this.pixelSize = void 0, this.outlineColor = void 0, this.outlineWidth = void 0, this.show = void 0 }; return r.mergeProperties = function(i, n) { var o = n.point; if (e(o)) { var a = i.point;
  3335. e(a) || (i.point = a = new r), a.color = t(a.color, o.color), a.pixelSize = t(a.pixelSize, o.pixelSize), a.outlineColor = t(a.outlineColor, o.outlineColor), a.outlineWidth = t(a.outlineWidth, o.outlineWidth), a.show = t(a.show, o.show) } }, r.undefineProperties = function(e) { e.point = void 0 }, r }), r("DynamicScene/DynamicPolygon", ["../Core/defaultValue", "../Core/defined"], function(e, t) { "use strict"; var r = function() { this.show = void 0, this.material = void 0 }; return r.mergeProperties = function(i, n) { var o = n.polygon; if (t(o)) { var a = i.polygon;
  3336. t(a) || (i.polygon = a = new r), a.show = e(a.show, o.show), a.material = e(a.material, o.material) } }, r.undefineProperties = function(e) { e.polygon = void 0 }, r }), r("DynamicScene/DynamicPolyline", ["../Core/defaultValue", "../Core/defined"], function(e, t) { "use strict"; var r = function() { this.color = void 0, this.outlineColor = void 0, this.outlineWidth = void 0, this.show = void 0, this.width = void 0 }; return r.mergeProperties = function(i, n) { var o = n.polyline; if (t(o)) { var a = i.polyline;
  3337. t(a) || (i.polyline = a = new r), a.color = e(a.color, o.color), a.width = e(a.width, o.width), a.outlineColor = e(a.outlineColor, o.outlineColor), a.outlineWidth = e(a.outlineWidth, o.outlineWidth), a.show = e(a.show, o.show) } }, r.undefineProperties = function(e) { e.polyline = void 0 }, r }), r("DynamicScene/DynamicPyramid", ["../Core/defaultValue", "../Core/defined"], function(e, t) { "use strict"; var r = function() { this.show = void 0, this.directions = void 0, this.radius = void 0, this.showIntersection = void 0, this.intersectionColor = void 0, this.intersectionWidth = void 0, this.material = void 0 }; return r.mergeProperties = function(i, n) { var o = n.pyramid; if (t(o)) { var a = i.pyramid;
  3338. t(a) || (i.pyramid = a = new r), a.show = e(a.show, o.show), a.directions = e(a.directions, o.directions), a.radius = e(a.radius, o.radius), a.showIntersection = e(a.showIntersection, o.showIntersection), a.intersectionColor = e(a.intersectionColor, o.intersectionColor), a.intersectionWidth = e(a.intersectionWidth, o.intersectionWidth), a.material = e(a.material, o.material) } }, r.undefineProperties = function(e) { e.pyramid = void 0 }, r }), r("DynamicScene/DynamicVector", ["../Core/defaultValue", "../Core/defined"], function(e, t) { "use strict"; var r = function() { this.color = void 0, this.show = void 0, this.width = void 0, this.direction = void 0, this.length = void 0 }; return r.mergeProperties = function(i, n) { var o = n.vector; if (t(o)) { var a = i.vector;
  3339. t(a) || (i.vector = a = new r), a.color = e(a.color, o.color), a.width = e(a.width, o.width), a.direction = e(a.direction, o.direction), a.length = e(a.length, o.length), a.show = e(a.show, o.show) } }, r.undefineProperties = function(e) { e.vector = void 0 }, r }), r("DynamicScene/CompositeDynamicObjectCollection", ["../Core/defaultValue", "../Core/defined", "../Core/Event", "../Core/Iso8601", "../Core/TimeInterval", "../Core/DeveloperError", "./DynamicObject", "./DynamicBillboard", "./DynamicClock", "./DynamicEllipse", "./DynamicEllipsoid", "./DynamicCone", "./DynamicLabel", "./DynamicPath", "./DynamicPoint", "./DynamicPolygon", "./DynamicPolyline", "./DynamicPyramid", "./DynamicVector"], function(e, t, r, i, n, o, a, s, l, u, c, h, d, m, p, f, v, y, g) { "use strict";
  3340. function _(e, t) { var r = e._hash[t]; return r || (r = new a(t), e._hash[t] = r, e._array.push(r)), r }
  3341. function w(e) { var t = e._array;
  3342. e._hash = {}, e._array = [], t.length > 0 && e.objectsRemoved.raiseEvent(e, t) } var C = function(t, i, n) { this._hash = {}, this._array = [], this._collections = [], this.mergeFunctions = e(i, C.mergers), this.cleanFunctions = e(n, C.cleaners), this.objectPropertiesChanged = new r, this.objectsRemoved = new r, this.setCollections(t) }; return C.mergers = [l.mergeProperties, s.mergeProperties, u.mergeProperties, c.mergeProperties, h.mergeProperties, d.mergeProperties, m.mergeProperties, p.mergeProperties, f.mergeProperties, v.mergeProperties, y.mergeProperties, g.mergeProperties, a.mergeProperties], C.cleaners = [s.undefineProperties, u.undefineProperties, c.undefineProperties, h.undefineProperties, d.undefineProperties, m.undefineProperties, p.undefineProperties, f.undefineProperties, v.undefineProperties, y.undefineProperties, g.undefineProperties, a.undefineProperties, l.undefineProperties], C.prototype.computeAvailability = function() { for (var e = i.MAXIMUM_VALUE, t = i.MINIMUM_VALUE, r = this._collections, o = 0, a = r.length; a > o; ++o) { var s = r[o],
  3343. l = s.computeAvailability(),
  3344. u = l.start,
  3345. c = l.stop;
  3346. u.lessThan(e) && !u.equals(i.MINIMUM_VALUE) && (e = l.start), c.greaterThan(t) && !c.equals(i.MAXIMUM_VALUE) && (t = l.stop) } return i.MAXIMUM_VALUE.equals(e) && (e = i.MINIMUM_VALUE), i.MINIMUM_VALUE.equals(t) && (t = i.MAXIMUM_VALUE), new n(e, t, !0, !0) }, C.prototype.getCollections = function() { return this._collections.slice(0) }, C.prototype.setCollections = function(e) { e = t(e) ? e : []; var r = this._collections; if (e !== r) { var i, n; for (n = r.length - 1; n > -1; n--) i = r[n], i.compositeCollection = void 0, i.objectPropertiesChanged.removeEventListener(C.prototype._onObjectPropertiesChanged, this);
  3347. r = this._collections = e, w(this); var o = this.mergeFunctions; for (n = r.length - 1; n > -1; n--) { i = r[n], i.compositeCollection = this, i.objectPropertiesChanged.addEventListener(C.prototype._onObjectPropertiesChanged, this); for (var a = i.getObjects(), s = a.length - 1; s > -1; s--)
  3348. for (var l = a[s], u = _(this, l.id), c = o.length - 1; c > -1; c--) { var h = o[c];
  3349. h(u, l) } } } }, C.prototype.getObject = function(e) { if (!t(e)) throw new o("id is required."); return this._hash[e] }, C.prototype.getObjects = function() { return this._array }, C.prototype.clear = function() { this.setCollections([]) }, C.prototype._onObjectPropertiesChanged = function(e, r) { for (var i, n, o = this.mergeFunctions, a = this.cleanFunctions, s = this._collections, l = [], u = r.length - 1; u > -1; u--) { if (i = r[u], n = this.getObject(i.id), t(n))
  3350. for (var c = a.length - 1; c > -1; c--) { var h = a[c];
  3351. h(n) } else n = _(this, i.id);
  3352. l.push(n); for (var d = s.length - 1; d > -1; d--) { var m = s[d],
  3353. p = m.getObject(i.id); if (t(p))
  3354. for (var f = o.length - 1; f > -1; f--) { var v = o[f];
  3355. v(n, p) } } } l.length > 0 && this.objectPropertiesChanged.raiseEvent(this, l) }, C }), r("DynamicScene/CompositeMaterialProperty", ["../Core/defined", "../Core/defineProperties", "../Core/DeveloperError", "../Core/TimeIntervalCollection"], function(e, t, r, i) { "use strict"; var n = function() { this._intervals = new i }; return t(n.prototype, { intervals: { get: function() { return this._intervals } } }), n.prototype.getType = function(t) { if (!e(t)) throw new r("time is required"); var i = this._intervals.findDataForIntervalContainingDate(t); return e(i) ? i.getType(t) : void 0 }, n.prototype.getValue = function(t, i) { if (!e(t)) throw new r("time is required"); var n = this._intervals.findDataForIntervalContainingDate(t); return e(n) ? n.getValue(t, i) : void 0 }, n }), r("DynamicScene/CompositePositionProperty", ["../Core/defaultValue", "../Core/defined", "../Core/defineProperties", "../Core/DeveloperError", "../Core/TimeIntervalCollection", "../Core/ReferenceFrame"], function(e, t, r, i, n, o) { "use strict"; var a = function(t) { this._intervals = new n, this._referenceFrame = e(t, o.FIXED) }; return r(a.prototype, { intervals: { get: function() { return this._intervals } }, referenceFrame: { get: function() { return this._referenceFrame }, set: function(e) { this._referenceFrame = e } } }), a.prototype.getValue = function(e, t) { return this.getValueInReferenceFrame(e, o.FIXED, t) }, a.prototype.getValueInReferenceFrame = function(e, r, n) { if (!t(e)) throw new i("time is required."); if (!t(r)) throw new i("referenceFrame is required."); var o = this._intervals.findDataForIntervalContainingDate(e); return t(o) ? o.getValueInReferenceFrame(e, r, n) : void 0 }, a }), r("DynamicScene/CompositeProperty", ["../Core/defined", "../Core/defineProperties", "../Core/DeveloperError", "../Core/TimeIntervalCollection"], function(e, t, r, i) { "use strict"; var n = function() { this._intervals = new i }; return t(n.prototype, { intervals: { get: function() { return this._intervals } } }), n.prototype.getValue = function(t, i) { if (!e(t)) throw new r("time is required"); var n = this._intervals.findDataForIntervalContainingDate(t); return e(n) ? n.getValue(t, i) : void 0 }, n }), r("DynamicScene/PositionProperty", ["../Core/Cartesian3", "../Core/defined", "../Core/defineProperties", "../Core/DeveloperError", "../Core/Matrix3", "../Core/ReferenceFrame", "../Core/Transforms"], function(e, t, r, i, n, o, a) { "use strict";
  3356. function s() { throw new i("This type should not be instantiated directly.") } var l = s;
  3357. r(l.prototype, { referenceFrame: { get: s } }), l.prototype.getValue = s, l.prototype.getValueInReferenceFrame = s; var u = new n; return l.convertToReferenceFrame = function(r, i, n, s, l) { if (n === s) return e.clone(i, l); var c = a.computeIcrfToFixedMatrix(r, u); return t(c) || (c = a.computeTemeToPseudoFixedMatrix(r, u)), n === o.INERTIAL ? c.multiplyByVector(i, l) : n === o.FIXED ? c.transpose(u).multiplyByVector(i, l) : void 0 }, l }), r("DynamicScene/ConstantPositionProperty", ["./ConstantProperty", "./PositionProperty", "../Core/Cartesian3", "../Core/defaultValue", "../Core/defined", "../Core/defineProperties", "../Core/DeveloperError", "../Core/ReferenceFrame"], function(e, t, r, i, n, o, a, s) { "use strict"; var l = function(t, n) { this._property = new e(t, r.clone), this._referenceFrame = i(n, s.FIXED) }; return o(l.prototype, { referenceFrame: { get: function() { return this._referenceFrame } } }), l.prototype.getValue = function(e, t) { return this.getValueInReferenceFrame(e, s.FIXED, t) }, l.prototype.getValueInReferenceFrame = function(e, r, i) { if (!n(e)) throw new a("time is required."); if (!n(r)) throw new a("referenceFrame is required."); var o = this._property.getValue(e, i); return t.convertToReferenceFrame(e, o, this._referenceFrame, r, o) }, l }), r("Scene/HorizontalOrigin", ["../Core/Enumeration"], function(e) { "use strict"; var t = { CENTER: new e(0, "CENTER"), LEFT: new e(1, "LEFT"), RIGHT: new e(-1, "RIGHT") }; return t }), r("Scene/LabelStyle", ["../Core/Enumeration"], function(e) { "use strict"; var t = { FILL: new e(0, "FILL"), OUTLINE: new e(1, "OUTLINE"), FILL_AND_OUTLINE: new e(2, "FILL_AND_OUTLINE") }; return t }), r("Scene/VerticalOrigin", ["../Core/Enumeration"], function(e) { "use strict"; var t = { CENTER: new e(0, "CENTER"), BOTTOM: new e(1, "BOTTOM"), TOP: new e(-1, "TOP") }; return t }), r("DynamicScene/DynamicDirectionsProperty", ["../Core/defined", "../Core/TimeInterval", "../Core/TimeIntervalCollection", "../Core/Cartesian3", "../Core/Spherical", "../Core/Iso8601"], function(e, t, r, i, n, o) { "use strict";
  3358. function a(t) { var r, o, a = [],
  3359. s = t.unitSpherical; if (e(s)) { for (r = 0, o = s.length; o > r; r += 2) a.push(new n(s[r], s[r + 1]));
  3360. this.spherical = a } if (s = t.unitCartesian, e(s)) { for (r = 0, o = s.length; o > r; r += 3) a.push(new i(s[r], s[r + 1], s[r + 2], !0));
  3361. this.cartesian = a } }
  3362. function s(r, i, n) { var s = i.interval;
  3363. s = e(s) ? t.fromIso8601(s) : o.MAXIMUM_INTERVAL.clone(), e(n) && (s = s.intersect(n)); var l = r._propertyIntervals,
  3364. u = l.findInterval(s.start, s.stop);
  3365. e(u) || (u = s, l.addInterval(u)), u.data = new a(i) } a.prototype.getValue = function() { var t = this.spherical; if (!e(t)) { t = [], this.spherical = t; for (var r = this.cartesian, i = 0, o = r.length; o > i; i++) t.push(n.fromCartesian3(r[i])) } return t }; var l = function() { this._propertyIntervals = new r }; return l.prototype.processCzmlIntervals = function(e, t, r) { if (Array.isArray(e))
  3366. for (var i = 0, n = e.length; n > i; i++) s(this, e[i], t, r);
  3367. else s(this, e, t, r) }, l.prototype.getValue = function(t) { var r = this._propertyIntervals.findIntervalContainingDate(t); return e(r) ? r.data.getValue() : void 0 }, l }), r("DynamicScene/GridMaterialProperty", ["../Core/Cartesian2", "../Core/Color", "../Core/defined", "./ConstantProperty"], function(e, t, r, i) { "use strict"; var n = function() { this.color = new i(t.WHITE), this.cellAlpha = new i(.1), this.lineCount = new i(new e(8, 8)), this.lineThickness = new i(new e(1, 1)) }; return n.prototype.getType = function() { return "Grid" }, n.prototype.getValue = function(e, t) { return r(t) || (t = {}), t.color = r(this.color) ? this.color.getValue(e, t.color) : void 0, t.cellAlpha = r(this.cellAlpha) ? this.cellAlpha.getValue(e) : void 0, t.lineCount = r(this.lineCount) ? this.lineCount.getValue(e, t.lineCount) : void 0, t.lineThickness = r(this.lineThickness) ? this.lineThickness.getValue(e, t.lineThickness) : void 0, t }, n }), r("DynamicScene/ImageMaterialProperty", ["../Core/Cartesian2", "../Core/defined", "./ConstantProperty"], function(e, t, r) { "use strict"; var i = function() { this.image = void 0, this.repeat = new r(new e(1, 1)) }; return i.prototype.getType = function() { return "Image" }, i.prototype.getValue = function(e, r) { return t(r) || (r = {}), r.image = t(this.image) ? this.image.getValue(e) : void 0, r.repeat = t(this.repeat) ? this.repeat.getValue(e, r.repeat) : void 0, r }, i }), r("DynamicScene/DynamicObjectCollection", ["../Core/defined", "../Core/Event", "../Core/TimeInterval", "../Core/Iso8601", "../Core/DeveloperError", "./DynamicObject"], function(e, t, r, i, n, o) { "use strict"; var a = function() { this._hash = {}, this._array = [], this.compositeCollection = void 0, this.objectPropertiesChanged = new t, this.objectsRemoved = new t }; return a.prototype.computeAvailability = function() { for (var t = i.MAXIMUM_VALUE, n = i.MINIMUM_VALUE, o = this._array, a = 0, s = o.length; s > a; a++) { var l = o[a],
  3368. u = l.availability; if (e(u)) { var c = u.start,
  3369. h = u.stop;
  3370. c.lessThan(t) && !c.equals(i.MINIMUM_VALUE) && (t = l.availability.start), h.greaterThan(n) && !h.equals(i.MAXIMUM_VALUE) && (n = l.availability.stop) } } return i.MAXIMUM_VALUE.equals(t) && (t = i.MINIMUM_VALUE), i.MINIMUM_VALUE.equals(n) && (n = i.MAXIMUM_VALUE), new r(t, n, !0, !0) }, a.prototype.getObject = function(t) { if (!e(t)) throw new n("id is required."); return this._hash[t] }, a.prototype.removeObject = function(t) { if (!e(t)) throw new n("id is required."); var r = this._hash[t],
  3371. i = e(r); return i && (this._hash[t] = void 0, this._array.splice(this._array.indexOf(r), 1), this.objectsRemoved.raiseEvent(this, [r])), i }, a.prototype.getObjects = function() { return this._array }, a.prototype.getOrCreateObject = function(t) { if (!e(t)) throw new n("id is required."); var r = this._hash[t]; return r || (r = new o(t), this._hash[t] = r, this._array.push(r)), r }, a.prototype.clear = function() { var e = this._array;
  3372. this._hash = {}, this._array = [], e.length > 0 && this.objectsRemoved.raiseEvent(this, e) }, a }), r("DynamicScene/ReferenceProperty", ["../Core/defaultValue", "../Core/defined", "../Core/DeveloperError"], function(e, t, r) { "use strict";
  3373. function i(r) { var i = r._targetProperty; if (!t(i)) { var n = e(r._dynamicObjectCollection.compositeCollection, r._dynamicObjectCollection),
  3374. o = n.getObject(r._targetObjectId);
  3375. t(o) && (i = o[r._targetPropertyName], r._targetProperty = i, r._targetObject = o) } return i } var n = function(e, i, n) { if (!t(e)) throw new r("dynamicObjectCollection is required."); if (!t(i)) throw new r("targetObjectId is required."); if (!t(n)) throw new r("targetPropertyName is required.");
  3376. this._targetProperty = void 0, this._dynamicObjectCollection = e, this._targetObjectId = i, this._targetObject = void 0, this._targetPropertyName = n }; return n.fromString = function(e, i) { if (!t(e)) throw new r("dynamicObjectCollection is required."); if (!t(i)) throw new r("referenceString is required."); var o = i.split("."); if (2 !== o.length) throw new r("referenceString must contain a single . delineating the target object ID and property name."); return new n(e, o[0], o[1]) }, n.prototype.getValue = function(e, n) { if (!t(e)) throw new r("time is required."); var o = i(this); return t(o) && this._targetObject.isAvailable(e) ? o.getValue(e, n) : void 0 }, n }), r("DynamicScene/DynamicVertexPositionsProperty", ["../Core/defined", "../Core/TimeInterval", "../Core/TimeIntervalCollection", "../Core/Cartesian3", "../Core/Cartographic", "../Core/Iso8601", "../Core/Ellipsoid", "./ReferenceProperty"], function(e, t, r, i, n, o, a, s) {
  3377. "use strict";
  3378. function l(t) { var r, o, a, s = []; if (a = t.cartesian, e(a)) { for (r = 0, o = a.length; o > r; r += 3) s.push(new i(a[r], a[r + 1], a[r + 2]));
  3379. this.cartesian = s } else if (a = t.cartographicRadians, e(a)) { for (r = 0, o = a.length; o > r; r += 3) s.push(new n(a[r], a[r + 1], a[r + 2]));
  3380. this.cartographic = s } else if (a = t.cartographicDegrees, e(a)) { for (r = 0, o = a.length; o > r; r += 3) s.push(n.fromDegrees(a[r], a[r + 1], a[r + 2]));
  3381. this.cartographic = s } }
  3382. var u = a.WGS84;
  3383. l.prototype.getValue = function() {
  3384. return e(this.cartesian) || (this.cartesian = u.cartographicArrayToCartesianArray(this.cartographic)), this.cartesian
  3385. };
  3386. var c = function() { this._propertyIntervals = new r };
  3387. return c.prototype.processCzmlIntervals = function(e, t, r) { if (Array.isArray(e))
  3388. for (var i = 0, n = e.length; n > i; i++) this._addCzmlInterval(e[i], t, r);
  3389. else this._addCzmlInterval(e, t, r) }, c.prototype.getValue = function(t) { var r = this._propertyIntervals.findIntervalContainingDate(t); if (!e(r)) return void 0; var i = r.data; if (Array.isArray(i)) { for (var n = [], o = 0, a = i.length; a > o; o++) { var s = i[o].getValue(t);
  3390. e(s) && n.push(s) } return n } return i.getValue() }, c.prototype._addCzmlInterval = function(r, i, n) { var a = r.interval;
  3391. a = e(a) ? t.fromIso8601(a) : o.MAXIMUM_INTERVAL.clone(), e(i) && (a = a.intersect(i)); var u = this._propertyIntervals,
  3392. c = u.findInterval(a.start, a.stop);
  3393. e(c) || (c = a, u.addInterval(c)); var h = r.references; if (e(h)) { for (var d = [], m = 0, p = h.length; p > m; m++) d.push(s.fromString(n, h[m]));
  3394. c.data = d } else c.data = new l(r) }, c
  3395. }), r("DynamicScene/SampledProperty", ["../Core/binarySearch", "../Core/defaultValue", "../Core/defined", "../Core/defineProperties", "../Core/DeveloperError", "../Core/JulianDate", "../Core/LinearApproximation"], function(e, t, r, i, n, o, a) { "use strict";
  3396. function s(e, t, r) { var i, n = e.length,
  3397. o = r.length,
  3398. a = n + o; if (e.length = a, n !== t) { var s = n - 1; for (i = a - 1; i >= t; i--) e[i] = e[s--] } for (i = 0; o > i; i++) e[t++] = r[i] }
  3399. function l(e, t) { return e instanceof o ? e : "string" == typeof e ? o.fromIso8601(e) : t.addSeconds(e) } var u = { packedLength: 1, pack: function(e, r, i) { i = t(i, 0), r[i] = e }, unpack: function(e, r) { return r = t(r, 0), e[r] } },
  3400. c = function(t, i, n, a, u) { for (var c, h, d, m, p, f, v, y, g = 0; g < a.length;)
  3401. if (v = l(a[g], t), d = e(i, v, o.compare), 0 > d) { for (d = ~d, p = [], m = d * u, f = [], h = void 0, y = i[d]; g < a.length && (v = l(a[g], t), !(r(h) && o.compare(h, v) >= 0 || r(y) && o.compare(v, y) >= 0));) { for (p.push(v), g += 1, c = 0; u > c; c++) f.push(a[g]), g += 1;
  3402. h = v } s(n, m, f), s(i, d, p) } else { for (c = 0; u > c; c++) g++, n[d * u + c] = a[g];
  3403. g++ } },
  3404. h = function(e) { if (!r(e)) throw new n("type is required."); var i = e;
  3405. i === Number && (i = u); var o = t(i.packedInterpolationLength, i.packedLength);
  3406. this._type = e, this._innerType = i, this._interpolationDegree = 1, this._interpolationAlgorithm = a, this._numberOfPoints = 0, this._times = [], this._values = [], this._xTable = [], this._yTable = [], this._packedInterpolationLength = o, this._updateTableLength = !0, this._interpolationResult = new Array(o) }; return i(h.prototype, { type: { get: function() { return this._type } }, interpolationDegree: { get: function() { return this._interpolationDegree }, set: function(e) { this._interpolationDegree = e, this._updateTableLength = !0 } }, interpolationAlgorithm: { get: function() { return this._interpolationAlgorithm }, set: function(e) { this._interpolationAlgorithm = e, this._updateTableLength = !0 } } }), h.prototype.getValue = function(t, i) { if (!r(t)) throw new n("time is required."); var a = this._innerType,
  3407. s = this._times,
  3408. l = this._values,
  3409. u = e(s, t, o.compare); if (0 > u) { var c = this._xTable,
  3410. h = this._yTable,
  3411. d = this._interpolationAlgorithm,
  3412. m = this._packedInterpolationLength; if (this._updateTableLength) { this._updateTableLength = !1; var p = Math.min(d.getRequiredDataPoints(this._interpolationDegree), s.length);
  3413. p !== this._numberOfPoints && (this._numberOfPoints = p, c.length = p, h.length = p * m) } var f = this._numberOfPoints - 1; if (1 > f) return void 0;
  3414. u = ~u, u >= s.length && (u = s.length - 1); var v = 0,
  3415. y = s.length - 1,
  3416. g = y - v + 1; if (f + 1 > g);
  3417. else { var _ = u - (0 | f / 2) - 1;
  3418. v > _ && (_ = v); var w = _ + f;
  3419. w > y && (w = y, _ = w - f, v > _ && (_ = v)), v = _, y = w } for (var C = y - v + 1, x = 0; C > x; ++x) c[x] = s[y].getSecondsDifference(s[v + x]); if (r(a.convertPackedArrayForInterpolation)) a.convertPackedArrayForInterpolation(l, v, y, h);
  3420. else
  3421. for (var S = 0, E = a.packedLength, b = v * E, T = (y + 1) * E; T > b;) h[S] = l[b], b++, S++; var A = s[y].getSecondsDifference(t),
  3422. M = d.interpolateOrderZero(A, c, h, m, this._interpolationResult); return r(a.unpackInterpolationResult) ? a.unpackInterpolationResult(M, l, v, y, i) : a.unpack(M, 0, i) } return a.unpack(this._values, u * a.packedLength, i) }, h.prototype.addSample = function(e, t) { if (!r(e)) throw new n("time is required."); if (!r(t)) throw new n("value is required."); var i = this._innerType,
  3423. o = [e];
  3424. i.pack(t, o, 1), c(void 0, this._times, this._values, o, i.packedLength), this._updateTableLength = !0 }, h.prototype.addSamples = function(e, t) { if (!r(e)) throw new n("times is required."); if (!r(t)) throw new n("values is required."); if (e.length !== t.length) throw new n("times and values must be the same length."); for (var i = this._innerType, o = e.length, a = [], s = 0; o > s; s++) a.push(e[s]), i.pack(t[s], a, a.length);
  3425. c(void 0, this._times, this._values, a, i.packedLength), this._updateTableLength = !0 }, h.prototype.addSamplesPackedArray = function(e, t) { if (!r(e)) throw new n("packedSamples is required.");
  3426. c(t, this._times, this._values, e, this._innerType.packedLength), this._updateTableLength = !0 }, h._mergeNewSamples = c, h }), r("DynamicScene/SampledPositionProperty", ["../Core/Cartesian3", "../Core/defaultValue", "../Core/defined", "../Core/defineProperties", "../Core/DeveloperError", "../Core/ReferenceFrame", "./PositionProperty", "./SampledProperty"], function(e, t, r, i, n, o, a, s) { "use strict"; var l = function(r) { this._property = new s(e), this._referenceFrame = t(r, o.FIXED) }; return i(l.prototype, { referenceFrame: { get: function() { return this._referenceFrame } }, interpolationDegree: { get: function() { return this._property.interpolationDegree }, set: function(e) { this._property.interpolationDegree = e } }, interpolationAlgorithm: { get: function() { return this._property.interpolationAlgorithm }, set: function(e) { this._property.interpolationAlgorithm = e } } }), l.prototype.getValue = function(e, t) { return this.getValueInReferenceFrame(e, o.FIXED, t) }, l.prototype.getValueInReferenceFrame = function(e, t, i) { if (!r(e)) throw new n("time is required."); if (!r(t)) throw new n("referenceFrame is required."); return i = this._property.getValue(e, i), r(i) ? a.convertToReferenceFrame(e, i, this._referenceFrame, t, i) : i }, l.prototype.addSample = function(e, t) { this._property.addSample(e, t) }, l.prototype.addSamples = function(e, t) { this._property.addSamples(e, t) }, l.prototype.addSamplesPackedArray = function(e, t) { this._property.addSamplesPackedArray(e, t) }, l }), r("DynamicScene/TimeIntervalCollectionPositionProperty", ["../Core/defaultValue", "../Core/defined", "../Core/defineProperties", "../Core/DeveloperError", "../Core/ReferenceFrame", "../Core/TimeIntervalCollection", "./PositionProperty"], function(e, t, r, i, n, o, a) { "use strict"; var s = function(t) { this._intervals = new o, this._referenceFrame = e(t, n.FIXED) }; return r(s.prototype, { intervals: { get: function() { return this._intervals } }, referenceFrame: { get: function() { return this._referenceFrame } } }), s.prototype.getValue = function(e, t) { return this.getValueInReferenceFrame(e, n.FIXED, t) }, s.prototype.getValueInReferenceFrame = function(e, r, n) { if (!t(e)) throw new i("time is required."); if (!t(r)) throw new i("referenceFrame is required."); var o = this._intervals.findDataForIntervalContainingDate(e); return t(o) ? a.convertToReferenceFrame(e, o, this._referenceFrame, r, n) : void 0 }, s }), r("DynamicScene/TimeIntervalCollectionProperty", ["../Core/defined", "../Core/defineProperties", "../Core/DeveloperError", "../Core/Enumeration", "../Core/TimeIntervalCollection"], function(e, t, r, i, n) { "use strict"; var o = function(e) { this._intervals = new n, this._clone = e }; return t(o.prototype, { intervals: { get: function() { return this._intervals } } }), o.prototype.getValue = function(t, n) { if (!e(t)) throw new r("time is required"); var o = this._intervals.findDataForIntervalContainingDate(t); if (e(o) && "object" == typeof o && !Array.isArray(o) && !(o instanceof i)) { if ("function" == typeof o.clone) return o.clone(n); if (!e(this._clone)) throw new r("This value requires a clone function be specified for the TimeIntervalCollectionProperty constructor."); return this._clone(o, n) } return o }, o }), r("DynamicScene/CzmlDataSource", ["../Core/Cartesian2", "../Core/Cartesian3", "../Core/Cartographic", "../Core/Color", "../Core/ClockRange", "../Core/ClockStep", "../Core/createGuid", "../Core/defaultValue", "../Core/defined", "../Core/DeveloperError", "../Core/Ellipsoid", "../Core/Event", "../Core/HermitePolynomialApproximation", "../Core/Iso8601", "../Core/JulianDate", "../Core/LagrangePolynomialApproximation", "../Core/LinearApproximation", "../Core/loadJson", "../Core/Math", "../Core/Quaternion", "../Core/ReferenceFrame", "../Core/RuntimeError", "../Core/Spherical", "../Core/TimeInterval", "../Scene/HorizontalOrigin", "../Scene/LabelStyle", "../Scene/VerticalOrigin", "./CompositeMaterialProperty", "./CompositePositionProperty", "./CompositeProperty", "./ConstantPositionProperty", "./ConstantProperty", "./DynamicBillboard", "./DynamicClock", "./ColorMaterialProperty", "./DynamicCone", "./DynamicLabel", "./DynamicDirectionsProperty", "./DynamicEllipse", "./DynamicEllipsoid", "./GridMaterialProperty", "./ImageMaterialProperty", "./DynamicObjectCollection", "./DynamicPath", "./DynamicPoint", "./DynamicPolyline", "./DynamicPolygon", "./DynamicPyramid", "./DynamicVector", "./DynamicVertexPositionsProperty", "./SampledPositionProperty", "./SampledProperty", "./TimeIntervalCollectionPositionProperty", "./TimeIntervalCollectionProperty", "../ThirdParty/Uri", "../ThirdParty/when"], function(e, t, r, i, n, o, a, s, l, u, c, h, d, m, p, f, v, y, g, _, w, C, x, S, E, b, T, A, M, P, D, I, O, R, L, z, N, F, B, V, q, k, U, W, G, H, j, Y, X, Z, K, J, Q, $, et, tt) { "use strict";
  3427. function rt(e) { var t = e.rgbaf; if (l(t)) return t; var r = e.rgba; if (!l(r)) return void 0; if (r.length === i.length) return [i.byteToFloat(r[0]), i.byteToFloat(r[1]), i.byteToFloat(r[2]), i.byteToFloat(r[3])]; var n = r.length;
  3428. t = new Array(n); for (var o = 0; n > o; o += 5) t[o] = r[o], t[o + 1] = i.byteToFloat(r[o + 1]), t[o + 2] = i.byteToFloat(r[o + 2]), t[o + 3] = i.byteToFloat(r[o + 3]), t[o + 4] = i.byteToFloat(r[o + 4]); return t }
  3429. function it(e, t) { var r = s(e.image, e); if (l(t)) { var i = new et(document.location.href);
  3430. t = new et(t), r = new et(r).resolve(t.resolve(i)).toString() } return r }
  3431. function nt(e) { if (l(e.cartesian)) return e.cartesian; if (l(e.unitCartesian)) return e.unitCartesian; var r, i, n, o = e.unitSpherical; if (l(o)) { if (i = o.length, 2 === i) Lt.clock = o[0], Lt.cone = o[1], t.fromSpherical(Lt, Rt), n = [Rt.x, Rt.y, Rt.z];
  3432. else { var a = 0; for (n = new Array(4 * (i / 3)), r = 0; i > r; r += 4) n[r] = o[a++], Lt.clock = o[a++], Lt.cone = o[a++], t.fromSpherical(Lt, Rt), n[r + 1] = Rt.x, n[r + 2] = Rt.y, n[r + 3] = Rt.z } return n } var s = e.cartographicRadians; if (l(s)) { if (3 === s.length) zt.longitude = s[0], zt.latitude = s[1], zt.height = s[2], c.WGS84.cartographicToCartesian(zt, Rt), n = [Rt.x, Rt.y, Rt.z];
  3433. else
  3434. for (i = s.length, n = new Array(i), r = 0; i > r; r += 4) zt.longitude = s[r + 1], zt.latitude = s[r + 2], zt.height = s[r + 3], c.WGS84.cartographicToCartesian(zt, Rt), n[r] = s[r], n[r + 1] = Rt.x, n[r + 2] = Rt.y, n[r + 3] = Rt.z; return n } var u = e.cartographicDegrees; if (!l(u)) throw new C(JSON.stringify(e) + " is not a valid CZML interval."); if (3 === u.length) zt.longitude = g.toRadians(u[0]), zt.latitude = g.toRadians(u[1]), zt.height = u[2], c.WGS84.cartographicToCartesian(zt, Rt), n = [Rt.x, Rt.y, Rt.z];
  3435. else
  3436. for (i = u.length, n = new Array(i), r = 0; i > r; r += 4) zt.longitude = g.toRadians(u[r + 1]), zt.latitude = g.toRadians(u[r + 2]), zt.height = u[r + 3], c.WGS84.cartographicToCartesian(zt, Rt), n[r] = u[r], n[r + 1] = Rt.x, n[r + 2] = Rt.y, n[r + 3] = Rt.z; return n }
  3437. function ot(r, n, o) { switch (r) {
  3438. case Boolean:
  3439. return s(n.boolean, n);
  3440. case e:
  3441. return n.cartesian2;
  3442. case t:
  3443. return nt(n);
  3444. case i:
  3445. return rt(n);
  3446. case E:
  3447. return E[s(n.horizontalOrigin, n)];
  3448. case Image:
  3449. return it(n, o);
  3450. case b:
  3451. return b[s(n.labelStyle, n)];
  3452. case Number:
  3453. return s(n.number, n);
  3454. case String:
  3455. return s(n.string, n);
  3456. case _:
  3457. return n.unitQuaternion;
  3458. case T:
  3459. return T[s(n.verticalOrigin, n)];
  3460. default:
  3461. throw new u(r) } }
  3462. function at(e, t) { var r = Nt[e.interpolationAlgorithm];
  3463. l(r) && (t.interpolationAlgorithm = r), l(e.interpolationDegree) && (t.interpolationDegree = e.interpolationDegree) }
  3464. function st(e, t, r, i, n, o) { var a, u = i.interval;
  3465. l(u) ? (a = S.fromIso8601(u), l(n) && (a = a.intersect(n))) : l(n) && (a = n); var c = ot(e, i, o),
  3466. h = l(a) && !a.equals(m.MAXIMUM_INTERVAL),
  3467. d = s(e.packedLength, 1),
  3468. f = s(c.length, 1),
  3469. v = "string" != typeof c && f > d; if (!v && !h) return t[r] = l(e.unpack) ? new I(e.unpack(c, 0)) : new I(c), !0; var y = !1,
  3470. g = t[r]; if (v && !h) return g instanceof J || (g = new J(e), t[r] = g, y = !0), g.addSamplesPackedArray(c, p.fromIso8601(i.epoch)), at(i, g), y; var _; if (!v && h) return a = a.clone(), a.data = l(e.unpack) ? e.unpack(c, 0) : c, l(g) || (g = new $, t[r] = g, y = !0), g instanceof $ ? g.intervals.addInterval(a) : g instanceof P ? (a.data = new I(a.data), g.intervals.addInterval(a)) : (_ = m.MAXIMUM_INTERVAL.clone(), _.data = g, y = !0, g = new P, t[r] = g, g.intervals.addInterval(_), a.data = new I(a.data), g.intervals.addInterval(a)), y;
  3471. l(g) || (y = !0, g = new P, t[r] = g), g instanceof P || (_ = m.MAXIMUM_INTERVAL.clone(), _.data = g, y = !0, g = new P, t[r] = g, g.intervals.addInterval(_)); var w = g.intervals; return _ = w.findInterval(a.start, a.stop, a.isStartIncluded, a.isStopIncluded), l(_) && _.data instanceof J || (_ = a.clone(), _.data = new J(e), w.addInterval(_)), _.data.addSamplesPackedArray(c, p.fromIso8601(i.epoch)), at(i, _.data), y }
  3472. function lt(e, t, r, i, n, o) { if (!l(i)) return !1; var a = !1; if (Array.isArray(i))
  3473. for (var s = 0, u = i.length; u > s; s++) a = st(e, t, r, i[s], n, o) || a;
  3474. else a = st(e, t, r, i, n, o) || a; return a }
  3475. function ut(e, r, i, n) { var o, a = i.interval;
  3476. l(a) ? (o = S.fromIso8601(a), l(n) && (o = o.intersect(n))) : l(n) && (o = n); var u = w[s(i.referenceFrame, "FIXED")],
  3477. c = nt(i),
  3478. h = l(o) && !o.equals(m.MAXIMUM_INTERVAL),
  3479. d = t.packedLength,
  3480. f = s(c.length, 1),
  3481. v = "string" != typeof c && f > d; if (!v && !h) return e[r] = new D(t.unpack(c), u), !0; var y = !1,
  3482. g = e[r]; if (v && !h) return g instanceof J && g.referenceFrame === u || (g = new K(u), e[r] = g, y = !0), g.addSamplesPackedArray(c, p.fromIso8601(i.epoch)), at(i, g), y; var _; if (!v && h) return o = o.clone(), o.data = t.unpack(c), l(g) || (g = new Q(u), e[r] = g, y = !0), g instanceof Q && g.referenceFrame === u ? g.intervals.addInterval(o) : g instanceof M ? (o.data = new D(o.data, u), g.intervals.addInterval(o)) : (_ = m.MAXIMUM_INTERVAL.clone(), _.data = g, y = !0, g = new M(g.referenceFrame), e[r] = g, g.intervals.addInterval(_), o.data = new D(o.data, u), g.intervals.addInterval(o)), y;
  3483. l(g) ? g instanceof M || (_ = m.MAXIMUM_INTERVAL.clone(), _.data = g, y = !0, g = new M(g.referenceFrame), e[r] = g, g.intervals.addInterval(_)) : (y = !0, g = new M(u), e[r] = g); var C = g.intervals; return _ = C.findInterval(o.start, o.stop, o.isStartIncluded, o.isStopIncluded), l(_) && _.data instanceof K && _.data.referenceFrame === u || (_ = o.clone(), _.data = new K(u), C.addInterval(_)), _.data.addSamplesPackedArray(c, p.fromIso8601(i.epoch)), at(i, _.data), y }
  3484. function ct(e, t, r, i, n) { if (!l(r)) return !1; var o = !1; if (Array.isArray(r))
  3485. for (var a = 0, s = r.length; s > a; a++) o = ut(e, t, r[a], i, n) || o;
  3486. else o = ut(e, t, r, i, n) || o; return o }
  3487. function ht(e, t, r) { return l(t) || l(r) ? (e instanceof Ft || (e = new Ft), lt(Number, e, "_x", t), lt(Number, e, "_y", r), e) : e }
  3488. function dt(e, t, r, n, o) { var a, u = r.interval;
  3489. l(u) ? (a = S.fromIso8601(u), l(n) && (a = a.intersect(n))) : l(n) && (a = n), a = s(a, m.MAXIMUM_INTERVAL); var c = !1,
  3490. h = e[t];
  3491. l(h) || (h = new A, e[t] = h, c = !0); var d, p = h.intervals,
  3492. f = p.findInterval(a.start, a.stop);
  3493. l(f) ? d = f.data : (f = a.clone(), p.addInterval(f)); var v; return l(r.solidColor) ? (d instanceof L || (d = new L), v = r.solidColor, lt(i, d, "color", v.color)) : l(r.grid) ? (d instanceof q || (d = new q), v = r.grid, lt(i, d, "color", v.color, void 0, o), lt(Number, d, "cellAlpha", v.cellAlpha, void 0, o), d.lineThickness = ht(d.lineThickness, v.rowThickness, v.columnThickness), d.lineCount = ht(d.lineCount, v.rowCount, v.columnCount)) : l(r.image) && (d instanceof k || (d = new k), v = r.image, lt(Image, d, "image", v.image, void 0, o), d.repeat = ht(d.repeat, v.horizontalRepeat, v.verticalRepeat)), f.data = d, c }
  3494. function mt(e, t, r, i, n) { if (!l(r)) return !1; var o = !1; if (Array.isArray(r))
  3495. for (var a = 0, s = r.length; s > a; a++) o = dt(e, t, r[a], i, n) || o;
  3496. else o = dt(e, t, r, i, n) || o; return o }
  3497. function pt(e, t, r, i) { var n = t.position; return l(n) ? ct(e, "position", n, void 0, i) : !1 }
  3498. function ft(e, r, i, n) { var o = r.viewFrom; return l(o) ? lt(t, e, "viewFrom", o, void 0, n) : !1 }
  3499. function vt(e, t, r, i) { var n = t.orientation; return l(n) ? lt(_, e, "orientation", n, void 0, i) : !1 }
  3500. function yt(e, t, r) { var i = t.vertexPositions; if (!l(i)) return !1; var n = e.vertexPositions,
  3501. o = !l(e.vertexPositions); return o && (e.vertexPositions = n = new Z), n.processCzmlIntervals(i, void 0, r), o }
  3502. function gt(e, t) { var r = t.availability; if (!l(r)) return !1; var i = !1,
  3503. n = S.fromIso8601(r); return l(n) && (i = e._setAvailability(n)), i }
  3504. function _t(r, n, o, a) { var s = n.billboard; if (!l(s)) return !1; var u = s.interval;
  3505. l(u) && (u = S.fromIso8601(u)); var c = r.billboard,
  3506. h = !l(c); return h && (r.billboard = c = new O), h = lt(i, c, "color", s.color, u, a) || h, h = lt(t, c, "eyeOffset", s.eyeOffset, u, a) || h, h = lt(E, c, "horizontalOrigin", s.horizontalOrigin, u, a) || h, h = lt(Image, c, "image", s.image, u, a) || h, h = lt(e, c, "pixelOffset", s.pixelOffset, u, a) || h, h = lt(Number, c, "scale", s.scale, u, a) || h, h = lt(Number, c, "rotation", s.rotation, u, a) || h, h = lt(t, c, "alignedAxis", s.alignedAxis, u, a) || h, h = lt(Boolean, c, "show", s.show, u, a) || h, h = lt(T, c, "verticalOrigin", s.verticalOrigin, u, a) || h }
  3507. function wt(e, t) { var r = !1,
  3508. i = t.clock; if (l(i) && "document" === e.id) { var a = e.clock; if (l(a) || (a = new R, e.clock = a, r = !0), l(i.interval)) { var s = S.fromIso8601(i.interval);
  3509. l(s) && (a.startTime = s.start, a.stopTime = s.stop) } l(i.currentTime) && (a.currentTime = p.fromIso8601(i.currentTime)), l(i.range) && (a.clockRange = n[i.range]), l(i.step) && (a.clockStep = o[i.step]), l(i.multiplier) && (a.multiplier = i.multiplier) } return r }
  3510. function Ct(e, t, r, n) { var o = t.cone; if (!l(o)) return !1; var a = o.interval;
  3511. l(a) && (a = S.fromIso8601(a)); var s = e.cone,
  3512. u = !l(s); return u && (e.cone = s = new z), u = lt(Boolean, s, "show", o.show, a, n) || u, u = lt(Number, s, "radius", o.radius, a, n) || u, u = lt(Boolean, s, "showIntersection", o.showIntersection, a, n) || u, u = lt(i, s, "intersectionColor", o.intersectionColor, a, n) || u, u = lt(Number, s, "intersectionWidth", o.intersectionWidth, a, n) || u, u = lt(Number, s, "innerHalfAngle", o.innerHalfAngle, a, n) || u, u = lt(Number, s, "outerHalfAngle", o.outerHalfAngle, a, n) || u, u = lt(Number, s, "minimumClockAngle", o.minimumClockAngle, a, n) || u, u = lt(Number, s, "maximumClockAngle", o.maximumClockAngle, a, n) || u, u = mt(s, "capMaterial", o.capMaterial, a, n), u = mt(s, "innerMaterial", o.innerMaterial, a, n), u = mt(s, "outerMaterial", o.outerMaterial, a, n), u = mt(s, "silhouetteMaterial", o.silhouetteMaterial, a, n) }
  3513. function xt(e, t, r, i) { var n = t.ellipse; if (!l(n)) return !1; var o = n.interval;
  3514. l(o) && (o = S.fromIso8601(o)); var a = e.ellipse,
  3515. s = !l(a); return s && (e.ellipse = a = new B), s = lt(Number, a, "bearing", n.bearing, o, i) || s, s = lt(Number, a, "semiMajorAxis", n.semiMajorAxis, o, i) || s, s = lt(Number, a, "semiMinorAxis", n.semiMinorAxis, o, i) || s }
  3516. function St(e, r, i, n) { var o = r.ellipsoid; if (!l(o)) return !1; var a = o.interval;
  3517. l(a) && (a = S.fromIso8601(a)); var s = e.ellipsoid,
  3518. u = !l(s); return u && (e.ellipsoid = s = new V), u = lt(Boolean, s, "show", o.show, a, n) || u, u = lt(t, s, "radii", o.radii, a, n) || u, u = mt(s, "material", o.material, a, n) }
  3519. function Et(r, n, o, a) { var s = n.label; if (!l(s)) return !1; var u = s.interval;
  3520. l(u) && (u = S.fromIso8601(u)); var c = r.label,
  3521. h = !l(c); return h && (r.label = c = new N), h = lt(i, c, "fillColor", s.fillColor, u, a) || h, h = lt(i, c, "outlineColor", s.outlineColor, u, a) || h, h = lt(Number, c, "outlineWidth", s.outlineWidth, u, a) || h, h = lt(t, c, "eyeOffset", s.eyeOffset, u, a) || h, h = lt(E, c, "horizontalOrigin", s.horizontalOrigin, u, a) || h, h = lt(String, c, "text", s.text, u, a) || h, h = lt(e, c, "pixelOffset", s.pixelOffset, u, a) || h, h = lt(Number, c, "scale", s.scale, u, a) || h, h = lt(Boolean, c, "show", s.show, u, a) || h, h = lt(T, c, "verticalOrigin", s.verticalOrigin, u, a) || h, h = lt(String, c, "font", s.font, u, a) || h, h = lt(b, c, "style", s.style, u, a) || h }
  3522. function bt(e, t, r, n) { var o = t.path; if (!l(o)) return !1; var a = o.interval;
  3523. l(a) && (a = S.fromIso8601(a)); var s = e.path,
  3524. u = !l(s); return u && (e.path = s = new W), u = lt(i, s, "color", o.color, a, n) || u, u = lt(Number, s, "width", o.width, a, n) || u, u = lt(i, s, "outlineColor", o.outlineColor, a, n) || u, u = lt(Number, s, "outlineWidth", o.outlineWidth, a, n) || u, u = lt(Boolean, s, "show", o.show, a, n) || u, u = lt(Number, s, "resolution", o.resolution, a, n) || u, u = lt(Number, s, "leadTime", o.leadTime, a, n) || u, u = lt(Number, s, "trailTime", o.trailTime, a, n) || u }
  3525. function Tt(e, t, r, n) { var o = t.point; if (!l(o)) return !1; var a = o.interval;
  3526. l(a) && (a = S.fromIso8601(a)); var s = e.point,
  3527. u = !l(s); return u && (e.point = s = new G), u = lt(i, s, "color", o.color, a, n) || u, u = lt(Number, s, "pixelSize", o.pixelSize, a, n) || u, u = lt(i, s, "outlineColor", o.outlineColor, a, n) || u, u = lt(Number, s, "outlineWidth", o.outlineWidth, a, n) || u, u = lt(Boolean, s, "show", o.show, a, n) || u }
  3528. function At(e, t, r, i) { var n = t.polygon; if (!l(n)) return !1; var o = n.interval;
  3529. l(o) && (o = S.fromIso8601(o)); var a = e.polygon,
  3530. s = !l(a); return s && (e.polygon = a = new j), s = lt(Boolean, a, "show", n.show, o, i) || s, s = mt(a, "material", n.material, o, i) }
  3531. function Mt(e, t, r, n) { var o = t.polyline; if (!l(o)) return !1; var a = o.interval;
  3532. l(a) && (a = S.fromIso8601(a)); var s = e.polyline,
  3533. u = !l(s); return u && (e.polyline = s = new H), u = lt(i, s, "color", o.color, a, n) || u, u = lt(Number, s, "width", o.width, a, n) || u, u = lt(i, s, "outlineColor", o.outlineColor, a, n) || u, u = lt(Number, s, "outlineWidth", o.outlineWidth, a, n) || u, u = lt(Boolean, s, "show", o.show, a, n) || u }
  3534. function Pt(e, t, r, n) { var o = t.pyramid; if (!l(o)) return !1; var a = o.interval;
  3535. l(a) && (a = S.fromIso8601(a)); var s = e.pyramid,
  3536. u = !l(s); if (u && (e.pyramid = s = new Y), u = lt(Boolean, s, "show", o.show, a, n) || u, u = lt(Number, s, "radius", o.radius, a, n) || u, u = lt(Boolean, s, "showIntersection", o.showIntersection, a, n) || u, u = lt(i, s, "intersectionColor", o.intersectionColor, a, n) || u, u = lt(Number, s, "intersectionWidth", o.intersectionWidth, a, n) || u, u = mt(s, "material", o.material, a, n), l(o.directions)) { var c = s.directions;
  3537. l(c) || (s.directions = c = new F, u = !0), c.processCzmlIntervals(o.directions, a) } return u }
  3538. function Dt(e, r, n, o) { var a = r.vector; if (!l(a)) return !1; var s = a.interval;
  3539. l(s) && (s = S.fromIso8601(s)); var u = e.vector,
  3540. c = !l(u); return c && (e.vector = u = new X), c = lt(i, u, "color", a.color, s, o) || c, c = lt(Boolean, u, "show", a.show, s, o) || c, c = lt(Number, u, "width", a.width, s, o) || c, c = lt(t, u, "direction", a.direction, s, o) || c, c = lt(Number, u, "length", a.length, s, o) || c }
  3541. function It(e, t, r, i, n, o) { var s = e.id; if (l(s) || (s = a()), e["delete"] === !0) t.removeObject(s);
  3542. else
  3543. for (var u = t.getOrCreateObject(s), c = n.length - 1; c > -1; c--) n[c](u, e, t, o) && !l(i[s]) && (i[s] = !0, r.push(u)) }
  3544. function Ot(e, t, r) { var i = e._dynamicObjectCollection;
  3545. Bt._processCzml(t, i, r); var a, s = i.computeAvailability(),
  3546. u = i.getObject("document"); if (l(u) && l(u.clock)) a = new R, a.startTime = u.clock.startTime, a.stopTime = u.clock.stopTime, a.clockRange = u.clock.clockRange, a.clockStep = u.clock.clockStep, a.multiplier = u.clock.multiplier, a.currentTime = u.clock.currentTime;
  3547. else if (!s.start.equals(m.MINIMUM_VALUE)) { a = new R, a.startTime = s.start, a.stopTime = s.stop, a.clockRange = n.LOOP_STOP; var c = a.startTime.getSecondsDifference(a.stopTime),
  3548. h = Math.round(c / 120);
  3549. a.multiplier = h, a.currentTime = a.startTime, a.clockStep = o.SYSTEM_CLOCK_MULTIPLIER } return a } var Rt = new t,
  3550. Lt = new x,
  3551. zt = new r,
  3552. Nt = { HERMITE: d, LAGRANGE: f, LINEAR: v },
  3553. Ft = function() { this._x = new I(0), this._y = new I(0) };
  3554. Ft.prototype.getValue = function(t, r) { return l(r) || (r = new e), r.x = this._x.getValue(t), r.y = this._y.getValue(t), r }; var Bt = function() { this._changed = new h, this._error = new h, this._clock = void 0, this._dynamicObjectCollection = new U, this._timeVarying = !0 }; return Bt.updaters = [wt, _t, xt, St, Ct, Et, bt, Tt, At, Mt, Pt, Dt, pt, ft, vt, yt, gt], Bt.prototype.getChangedEvent = function() { return this._changed }, Bt.prototype.getErrorEvent = function() { return this._error }, Bt.prototype.getClock = function() { return this._clock }, Bt.prototype.getDynamicObjectCollection = function() { return this._dynamicObjectCollection }, Bt.prototype.getIsTimeVarying = function() { return this._timeVarying }, Bt.prototype.process = function(e, t) { if (!l(e)) throw new u("czml is required.");
  3555. this._clock = Ot(this, e, t) }, Bt.prototype.load = function(e, t) { if (!l(e)) throw new u("czml is required.");
  3556. this._dynamicObjectCollection.clear(), this._clock = Ot(this, e, t) }, Bt.prototype.processUrl = function(e) { if (!l(e)) throw new u("url is required."); var t = this; return tt(y(e), function(r) { t.process(r, e) }, function(e) { return t._error.raiseEvent(t, e), tt.reject(e) }) }, Bt.prototype.loadUrl = function(e) { if (!l(e)) throw new u("url is required."); var t = this; return tt(y(e), function(r) { t.load(r, e) }, function(e) { return t._error.raiseEvent(t, e), tt.reject(e) }) }, Bt._processCzml = function(e, t, r, i) { var n = [],
  3557. o = {}; if (i = l(i) ? i : Bt.updaters, Array.isArray(e))
  3558. for (var a = 0, s = e.length; s > a; a++) It(e[a], t, n, o, i, r);
  3559. else It(e, t, n, o, i, r); return n.length > 0 && t.objectPropertiesChanged.raiseEvent(t, n), n }, Bt }), r("DynamicScene/DataSource", ["../Core/DeveloperError"], function(e) { "use strict";
  3560. function t() { throw new e("This type should not be instantiated directly.") } var r = t; return r.prototype.getChangedEvent = t, r.prototype.getErrorEvent = t, r.prototype.getClock = t, r.prototype.getDynamicObjectCollection = t, r.prototype.getIsTimeVarying = t, r }), r("DynamicScene/DataSourceCollection", ["../Core/DeveloperError", "../Core/defined", "../Core/destroyObject", "../Core/Event"], function(e, t, r, i) { "use strict"; var n = function() { this._dataSources = [], this.dataSourceAdded = new i, this.dataSourceRemoved = new i }; return n.prototype.add = function(r) { if (!t(r)) throw new e("dataSource is required.");
  3561. this._dataSources.push(r), this.dataSourceAdded.raiseEvent(this, r) }, n.prototype.remove = function(e, t) { var r = this._dataSources.indexOf(e); return -1 !== r ? (this._dataSources.splice(r, 1), this.dataSourceRemoved.raiseEvent(this, e), "function" == typeof e.destroy && t && e.destroy(), !0) : !1 }, n.prototype.removeAll = function(e) { for (var t = this._dataSources, r = t.length - 1; r >= 0; r--) this.remove(t[r], e) }, n.prototype.contains = function(e) { return -1 !== this.indexOf(e) }, n.prototype.indexOf = function(e) { return this._dataSources.indexOf(e) }, n.prototype.get = function(r) { if (!t(r)) throw new e("index is required."); return this._dataSources[r] }, n.prototype.getLength = function() { return this._dataSources.length }, n.prototype.isDestroyed = function() { return !1 }, n.prototype.destroy = function() { return this.removeAll(!0), r(this) }, n }), r("Renderer/BlendEquation", ["../Core/Enumeration"], function(e) { "use strict"; var t = { ADD: new e(32774, "ADD"), SUBTRACT: new e(32778, "SUBTRACT"), REVERSE_SUBTRACT: new e(32779, "REVERSE_SUBTRACT"), validate: function(e) { return e === t.ADD || e === t.SUBTRACT || e === t.REVERSE_SUBTRACT } }; return t }), r("Renderer/BlendFunction", ["../Core/Enumeration"], function(e) { "use strict"; var t = { ZERO: new e(0, "ZERO"), ONE: new e(1, "ONE"), SOURCE_COLOR: new e(768, "SOURCE_COLOR"), ONE_MINUS_SOURCE_COLOR: new e(769, "ONE_MINUS_SOURCE_COLOR"), DESTINATION_COLOR: new e(774, "DESTINATION_COLOR"), ONE_MINUS_DESTINATION_COLOR: new e(775, "ONE_MINUS_DESTINATION_COLOR"), SOURCE_ALPHA: new e(770, "SOURCE_ALPHA"), ONE_MINUS_SOURCE_ALPHA: new e(771, "ONE_MINUS_SOURCE_ALPHA"), DESTINATION_ALPHA: new e(772, "DESTINATION_ALPHA"), ONE_MINUS_DESTINATION_ALPHA: new e(773, "ONE_MINUS_DESTINATION_ALPHA"), CONSTANT_COLOR: new e(32769, "CONSTANT_COLOR"), ONE_MINUS_CONSTANT_COLOR: new e(32770, "ONE_MINUS_CONSTANT_COLOR"), CONSTANT_ALPHA: new e(32771, "CONSTANT_ALPHA"), ONE_MINUS_CONSTANT_ALPHA: new e(32772, "ONE_MINUS_CONSTANT_ALPHA"), SOURCE_ALPHA_SATURATE: new e(776, "SOURCE_ALPHA_SATURATE"), validate: function(e) { return e === t.ZERO || e === t.ONE || e === t.SOURCE_COLOR || e === t.ONE_MINUS_SOURCE_COLOR || e === t.DESTINATION_COLOR || e === t.ONE_MINUS_DESTINATION_COLOR || e === t.SOURCE_ALPHA || e === t.ONE_MINUS_SOURCE_ALPHA || e === t.DESTINATION_ALPHA || e === t.ONE_MINUS_DESTINATION_ALPHA || e === t.CONSTANT_COLOR || e === t.ONE_MINUS_CONSTANT_COLOR || e === t.CONSTANT_ALPHA || e === t.ONE_MINUS_CONSTANT_ALPHA || e === t.SOURCE_ALPHA_SATURATE } }; return t }), r("Renderer/BlendingState", ["./BlendEquation", "./BlendFunction"], function(e, t) { "use strict"; var r = { DISABLED: { enabled: !1 }, ALPHA_BLEND: { enabled: !0, equationRgb: e.ADD, equationAlpha: e.ADD, functionSourceRgb: t.SOURCE_ALPHA, functionSourceAlpha: t.SOURCE_ALPHA, functionDestinationRgb: t.ONE_MINUS_SOURCE_ALPHA, functionDestinationAlpha: t.ONE_MINUS_SOURCE_ALPHA }, PRE_MULTIPLIED_ALPHA_BLEND: { enabled: !0, equationRgb: e.ADD, equationAlpha: e.ADD, functionSourceRgb: t.ONE, functionSourceAlpha: t.ONE, functionDestinationRgb: t.ONE_MINUS_SOURCE_ALPHA, functionDestinationAlpha: t.ONE_MINUS_SOURCE_ALPHA }, ADDITIVE_BLEND: { enabled: !0, equationRgb: e.ADD, equationAlpha: e.ADD, functionSourceRgb: t.SOURCE_ALPHA, functionSourceAlpha: t.SOURCE_ALPHA, functionDestinationRgb: t.ONE, functionDestinationAlpha: t.ONE } }; return r }), r("Renderer/BufferUsage", ["../Core/Enumeration"], function(e) { "use strict"; var t = { STREAM_DRAW: new e(35040, "STREAM_DRAW"), STATIC_DRAW: new e(35044, "STATIC_DRAW"), DYNAMIC_DRAW: new e(35048, "DYNAMIC_DRAW"), validate: function(e) { return e === t.STREAM_DRAW || e === t.STATIC_DRAW || e === t.DYNAMIC_DRAW } }; return t }), r("Renderer/CommandLists", [], function() { "use strict"; var e = function() { this.colorList = [], this.pickList = [], this.overlayList = [] }; return e.prototype.empty = function() { return 0 === this.colorList.length && 0 === this.pickList.length && 0 === this.overlayList.length }, e.prototype.removeAll = function() { this.colorList.length = 0, this.pickList.length = 0, this.overlayList.length = 0 }, e }), r("Renderer/DrawCommand", [], function() { "use strict"; var e = function() { this.boundingVolume = void 0, this.cull = !0, this.modelMatrix = void 0, this.primitiveType = void 0, this.vertexArray = void 0, this.count = void 0, this.offset = void 0, this.shaderProgram = void 0, this.uniformMap = void 0, this.renderState = void 0, this.framebuffer = void 0, this.executeInClosestFrustum = !1, this.owner = void 0, this.debugShowBoundingVolume = !1, this.debugOverlappingFrustums = 0 }; return e.prototype.execute = function(e, t) { e.draw(this, t) }, e }), r("Renderer/VertexArrayFacade", ["../Core/ComponentDatatype", "../Core/defaultValue", "../Core/defined", "../Core/destroyObject", "../Core/DeveloperError", "../Core/Math", "./BufferUsage"], function(e, t, r, i, n, o, a) {
  3562. "use strict";
  3563. function s(e, t) { if (t.needsCommit && t.vertexSizeInBytes > 0) { t.needsCommit = !1; var i = t.vertexBuffer,
  3564. n = e._size * t.vertexSizeInBytes,
  3565. o = r(i); if (!o || i.getSizeInBytes() < n) return o && i.destroy(), t.vertexBuffer = e._context.createVertexBuffer(t.arrayBuffer, t.usage), t.vertexBuffer.setVertexArrayDestroyable(!1), !0;
  3566. t.vertexBuffer.copyFromArrayView(t.arrayBuffer) } return !1 }
  3567. function l(e, t, r) { if (e.needsCommit && e.vertexSizeInBytes > 0) { var i = e.vertexSizeInBytes * t,
  3568. n = e.vertexSizeInBytes * r;
  3569. e.vertexBuffer.copyFromArrayView(new Uint8Array(e.arrayBuffer, i, n), i) } }
  3570. function u(e) { var t = e.vaByPurpose; if (r(t)) { for (var i in t)
  3571. if (t.hasOwnProperty(i))
  3572. for (var n = t[i], o = n.length, a = 0; o > a; ++a) n[a].va.destroy();
  3573. e.vaByPurpose = void 0 } }
  3574. var c = function(e, t, i) {
  3575. function o(e, t) { return t.componentDatatype.sizeInBytes - e.componentDatatype.sizeInBytes } if (!e) throw new n("context is required."); if (!t || 0 === t.length) throw new n("At least one attribute is required."); var s = c._verifyAttributes(t);
  3576. i = i || 0; for (var l, u, h, d, m = {}, p = [], f = s.length, v = 0; f > v; ++v) { var y = s[v];
  3577. y.vertexBuffer ? p.push(y) : (h = y.purpose, l = m[h], r(l) || (l = m[h] = {}), d = y.usage.toString(), u = l[d], r(u) || (u = l[d] = []), u.push(y)) } this._buffersByPurposeAndUsage = {}, this._allBuffers = []; for (h in m)
  3578. if (m.hasOwnProperty(h)) { l = m[h]; var g = this._buffersByPurposeAndUsage[h];
  3579. r(g) || (g = this._buffersByPurposeAndUsage[h] = {}); for (d in l)
  3580. if (l.hasOwnProperty(d)) { u = l[d], u.sort(o); var _, w = c._vertexSizeInBytes(u); switch (d) {
  3581. case a.STATIC_DRAW.toString():
  3582. _ = a.STATIC_DRAW; break;
  3583. case a.STREAM_DRAW.toString():
  3584. _ = a.STREAM_DRAW; break;
  3585. case a.DYNAMIC_DRAW.toString():
  3586. _ = a.DYNAMIC_DRAW } var C = { purpose: h, vertexSizeInBytes: w, vertexBuffer: void 0, usage: _, needsCommit: !1, arrayBuffer: void 0, arrayViews: c._createArrayViews(u, w) };
  3587. g[d] = C, this._allBuffers.push(C) } }
  3588. this._size = 0, this._precreated = p, this._context = e, this.writers = void 0, this.vaByPurpose = void 0, this.resize(i) };
  3589. c._verifyAttributes = function(i) { for (var o = [], s = 0; s < i.length; ++s) { var l = i[s],
  3590. u = { index: t(l.index, s), enabled: t(l.enabled, !0), componentsPerAttribute: l.componentsPerAttribute, componentDatatype: l.componentDatatype || e.FLOAT, normalize: l.normalize || !1, purpose: t(l.purpose, "all"), vertexBuffer: l.vertexBuffer, usage: l.usage || a.STATIC_DRAW }; if (o.push(u), 1 !== u.componentsPerAttribute && 2 !== u.componentsPerAttribute && 3 !== u.componentsPerAttribute && 4 !== u.componentsPerAttribute) throw new n("attribute.componentsPerAttribute must be in the range [1, 4]."); var c = u.componentDatatype; if (!e.validate(c)) throw new n("Attribute must have a valid componentDatatype or not specify it."); if (!a.validate(u.usage)) throw new n("Attribute must have a valid usage or not specify it.") } for (var h = new Array(o.length), d = 0; d < o.length; ++d) { var m = o[d],
  3591. p = m.index,
  3592. f = m.purpose; if ("all" !== f) { var v = h[p]; if (v === !0) throw new n("Index " + p + " is used by more than one attribute."); if (r(v)) { if (v[f]) throw new n("Index " + p + " is used by more than one attribute with the same purpose.") } else v = h[p] = {};
  3593. v[f] = !0 } else { if (h[p]) throw new n("Index " + p + " is used by more than one attribute.");
  3594. h[p] = !0 } } return o }, c._vertexSizeInBytes = function(e) { for (var t = 0, r = e.length, i = 0; r > i; ++i) { var n = e[i];
  3595. t += n.componentsPerAttribute * n.componentDatatype.sizeInBytes } var o = r > 0 ? e[0].componentDatatype.sizeInBytes : 0,
  3596. a = o > 0 ? t % o : 0,
  3597. s = 0 === a ? 0 : o - a; return t += s }, c._createArrayViews = function(e, t) { for (var r = [], i = 0, n = e.length, o = 0; n > o; ++o) { var a = e[o],
  3598. s = a.componentDatatype;
  3599. r.push({ index: a.index, enabled: a.enabled, componentsPerAttribute: a.componentsPerAttribute, componentDatatype: s, normalize: a.normalize, offsetInBytes: i, vertexSizeInComponentType: t / s.sizeInBytes, view: void 0 }), i += a.componentsPerAttribute * s.sizeInBytes } return r }, c.prototype.resize = function(e) {
  3600. this._size = e;
  3601. var t = this._allBuffers;
  3602. this.writers = {};
  3603. for (var i = 0, n = t.length; n > i; ++i) { var o = t[i];
  3604. c._resize(o, this._size); var a = this.writers[o.purpose];
  3605. r(a) || (a = this.writers[o.purpose] = []), c._appendWriters(a, o) } u(this)
  3606. }, c._resize = function(t, r) { if (t.vertexSizeInBytes > 0) { var i = new ArrayBuffer(r * t.vertexSizeInBytes); if (t.arrayBuffer)
  3607. for (var n = new Uint8Array(i), o = new Uint8Array(t.arrayBuffer), a = o.length, s = 0; a > s; ++s) n[s] = o[s]; for (var l = t.arrayViews, u = l.length, c = 0; u > c; ++c) { var h = l[c];
  3608. h.view = e.createArrayBufferView(h.componentDatatype, i, h.offsetInBytes) } t.arrayBuffer = i } };
  3609. var h = [function(e, t, r) { return function(i, n) { t[i * r] = n, e.needsCommit = !0 } }, function(e, t, r) { return function(i, n, o) { var a = i * r;
  3610. t[a] = n, t[a + 1] = o, e.needsCommit = !0 } }, function(e, t, r) { return function(i, n, o, a) { var s = i * r;
  3611. t[s] = n, t[s + 1] = o, t[s + 2] = a, e.needsCommit = !0 } }, function(e, t, r) { return function(i, n, o, a, s) { var l = i * r;
  3612. t[l] = n, t[l + 1] = o, t[l + 2] = a, t[l + 3] = s, e.needsCommit = !0 } }];
  3613. return c._appendWriters = function(e, t) { for (var r = t.arrayViews, i = r.length, n = 0; i > n; ++n) { var o = r[n];
  3614. e[o.index] = h[o.componentsPerAttribute - 1](t, o.view, o.vertexSizeInComponentType) } }, c.prototype.commit = function(e) { for (var t, i = !1, n = this._allBuffers, a = 0, l = n.length; l > a; ++a) t = n[a], i = s(this, t) || i; if (i || !r(this.vaByPurpose)) { var h = this._buffersByPurposeAndUsage;
  3615. u(this), this.vaByPurpose = {}; for (var d in h)
  3616. if (h.hasOwnProperty(d)) { for (var m = h[d], p = [], f = Math.ceil(this._size / o.SIXTY_FOUR_KILOBYTES), v = 0; f > v; ++v) { var y = [],
  3617. g = h.all; if (g !== m)
  3618. for (var _ in g)
  3619. if (g.hasOwnProperty(_)) { var w = g[_];
  3620. c._appendAttributes(y, w, v * w.vertexSizeInBytes * o.SIXTY_FOUR_KILOBYTES) }
  3621. for (var C in m) m.hasOwnProperty(C) && (t = m[C], c._appendAttributes(y, t, v * t.vertexSizeInBytes * o.SIXTY_FOUR_KILOBYTES));
  3622. y = y.concat(this._precreated), p.push({ va: this._context.createVertexArray(y, e), indicesCount: 1.5 * (v !== f - 1 ? o.SIXTY_FOUR_KILOBYTES : this._size % o.SIXTY_FOUR_KILOBYTES) }) } this.vaByPurpose[d] = p } } }, c._appendAttributes = function(e, t, r) { for (var i = t.arrayViews, n = i.length, o = 0; n > o; ++o) { var a = i[o];
  3623. e.push({ index: a.index, enabled: a.enabled, componentsPerAttribute: a.componentsPerAttribute, componentDatatype: a.componentDatatype, normalize: a.normalize, vertexBuffer: t.vertexBuffer, offsetInBytes: r + a.offsetInBytes, strideInBytes: t.vertexSizeInBytes }) } }, c.prototype.subCommit = function(e, t) { if (0 > e || e >= this._size) throw new n("offsetInVertices must be greater than or equal to zero and less than the vertex array size."); if (e + t > this._size) throw new n("offsetInVertices + lengthInVertices cannot exceed the vertex array size."); for (var r = this._allBuffers, i = 0, o = r.length; o > i; ++i) l(r[i], e, t) }, c.prototype.endSubCommits = function() { for (var e = this._allBuffers, t = 0, r = e.length; r > t; ++t) e[t].needsCommit = !1 }, c.prototype.isDestroyed = function() { return !1 }, c.prototype.destroy = function() { for (var e = this._allBuffers, t = 0, r = e.length; r > t; ++t) { var n = e[t];
  3624. n.vertexBuffer = n.vertexBuffer && n.vertexBuffer.destroy() } return u(this), i(this) }, c
  3625. }), r("Renderer/createShaderSource", ["../Core/defaultValue", "../Core/defined", "../Core/DeveloperError"], function(e, t, r) { "use strict";
  3626. function i(i) { i = e(i, e.EMPTY_OBJECT); var n = i.defines,
  3627. o = i.sources,
  3628. a = i.pickColorQualifier; if (t(a) && "uniform" !== a && "varying" !== a) throw new r("options.pickColorQualifier must be 'uniform' or 'varying'."); var s, l, u = ""; if (t(n) && n.length > 0)
  3629. for (l = n.length, s = 0; l > s; ++s) 0 !== n[s].length && (u += "#define " + n[s] + "\n"); if (t(o) && o.length > 0)
  3630. for (l = o.length, s = 0; l > s; ++s) u += "\n#line 0\n" + o[s]; if (t(a)) { var c = u.replace(/void\s+main\s*\(\s*(?:void)?\s*\)/g, "void czm_old_main()"),
  3631. h = a + " vec4 czm_pickColor; \n" + "void main() \n" + "{ \n" + " czm_old_main(); \n" + " if (gl_FragColor.a == 0.0) { \n" + " discard; \n" + " } \n" + " gl_FragColor = czm_pickColor; \n" + "}";
  3632. u = c + "\n" + h } return u } return i }), r("Scene/SceneMode", ["../Core/Enumeration"], function(e) { "use strict"; var t = { SCENE2D: new e(0, "SCENE2D", { morphTime: 0 }), COLUMBUS_VIEW: new e(1, "COLUMBUS_VIEW", { morphTime: 0 }), SCENE3D: new e(2, "SCENE3D", { morphTime: 1 }), MORPHING: new e(3, "MORPHING") }; return t }), r("Scene/SceneTransforms", ["../Core/defaultValue", "../Core/defined", "../Core/DeveloperError", "../Core/Cartographic", "../Core/Cartesian2", "../Core/Cartesian3", "../Core/Cartesian4", "../Core/Matrix4", "../Core/BoundingRectangle", "../Core/Math", "./SceneMode"], function(e, t, r, i, n, o, a, s, l, u, c) { "use strict"; var h = {},
  3633. d = new o,
  3634. m = new a;
  3635. h.wgs84ToWindowCoordinates = function(e, i, n) { if (!t(e)) throw new r("scene is required."); if (!t(i)) throw new r("position is required."); if (h.computeActualWgs84Position(e.getFrameState(), i, d), !t(d)) return n = void 0, void 0; var o = e.getUniformState().getViewProjection(); return o.multiplyByPoint(d, m), h.clipToWindowCoordinates(e.getCanvas(), m, n) }; var p = new o,
  3636. f = new i;
  3637. h.computeActualWgs84Position = function(e, r, i) { var n = e.mode; if (n === c.SCENE3D) return o.clone(r, i); var a = e.scene2D.projection; if (a.getEllipsoid().cartesianToCartographic(r, f), !t(f)) return i = void 0; if (a.project(f, p), n === c.COLUMBUS_VIEW) return o.fromElements(p.z, p.x, p.y, i); if (n === c.SCENE2D) return o.fromElements(0, p.x, p.y, i); var s = e.morphTime; return o.fromElements(u.lerp(p.z, r.x, s), u.lerp(p.x, r.y, s), u.lerp(p.y, r.z, s), i) }; var v = new o,
  3638. y = new a,
  3639. g = new l,
  3640. _ = new s; return h.clipToWindowCoordinates = function(e, t, r) { return v.x = t.x / t.w, v.y = t.y / t.w, v.z = t.z / t.w, g.width = e.clientWidth, g.height = e.clientHeight, s.computeViewportTransformation(g, 0, 1, _), _.multiplyByPoint(v, y), n.fromCartesian4(y, r) }, h }), r("Scene/Billboard", ["../Core/defaultValue", "../Core/defined", "../Core/DeveloperError", "../Core/Color", "../Core/Cartesian2", "../Core/Cartesian3", "../Core/Cartesian4", "../Core/NearFarScalar", "./HorizontalOrigin", "./VerticalOrigin", "./SceneMode", "./SceneTransforms"], function(e, t, r, i, n, o, a, s, l, u, c, h) { "use strict";
  3641. function d(e, r) { var i = e._billboardCollection;
  3642. t(i) && (i._updateBillboard(e, r), e._dirty = !0) } var m = {},
  3643. p = function(a, s) { if (a = e(a, m), t(a.scaleByDistance) && a.scaleByDistance.far <= a.scaleByDistance.near) throw new r("scaleByDistance.far must be greater than scaleByDistance.near.");
  3644. this._show = e(a.show, !0), this._position = o.clone(e(a.position, o.ZERO)), this._actualPosition = this._position.clone(), this._pixelOffset = n.clone(e(a.pixelOffset, n.ZERO)), this._eyeOffset = o.clone(e(a.eyeOffset, o.ZERO)), this._verticalOrigin = e(a.verticalOrigin, u.CENTER), this._horizontalOrigin = e(a.horizontalOrigin, l.CENTER), this._scale = e(a.scale, 1), this._imageIndex = e(a.imageIndex, -1), this._color = i.clone(e(a.color, i.WHITE)), this._rotation = e(a.rotation, 0), this._alignedAxis = o.clone(e(a.alignedAxis, o.ZERO)), this._width = a.width, this._height = a.height, this._scaleByDistance = a.scaleByDistance, this._pickId = void 0, this._pickIdThis = a._pickIdThis, this._billboardCollection = s, this._dirty = !1, this._index = -1 },
  3645. f = p.SHOW_INDEX = 0,
  3646. v = p.POSITION_INDEX = 1,
  3647. y = p.PIXEL_OFFSET_INDEX = 2,
  3648. g = p.EYE_OFFSET_INDEX = 3,
  3649. _ = p.HORIZONTAL_ORIGIN_INDEX = 4,
  3650. w = p.VERTICAL_ORIGIN_INDEX = 5,
  3651. C = p.SCALE_INDEX = 6,
  3652. x = p.IMAGE_INDEX_INDEX = 7,
  3653. S = p.COLOR_INDEX = 8,
  3654. E = p.ROTATION_INDEX = 9,
  3655. b = p.ALIGNED_AXIS_INDEX = 10,
  3656. T = p.SCALE_BY_DISTANCE_INDEX = 11;
  3657. p.NUMBER_OF_PROPERTIES = 12, p.prototype.getPickId = function(r) { return t(this._pickId) || (this._pickId = r.createPickId(e(this._pickIdThis, this))), this._pickId }, p.prototype.getShow = function() { return this._show }, p.prototype.setShow = function(e) { if (!t(e)) throw new r("value is required.");
  3658. e !== this._show && (this._show = e, d(this, f)) }, p.prototype.getPosition = function() { return this._position }, p.prototype.setPosition = function(e) { if (!t(e)) throw new r("value is required."); var i = this._position;
  3659. o.equals(i, e) || (o.clone(e, i), o.clone(e, this._actualPosition), d(this, v)) }, p.prototype._getActualPosition = function() { return this._actualPosition }, p.prototype._setActualPosition = function(e) { o.clone(e, this._actualPosition), d(this, v) }, p.prototype.getPixelOffset = function() { return this._pixelOffset }, p.prototype.setPixelOffset = function(e) { if (!t(e)) throw new r("value is required."); var i = this._pixelOffset;
  3660. n.equals(i, e) || (n.clone(e, i), d(this, y)) }, p.prototype.getScaleByDistance = function() { return this._scaleByDistance }, p.prototype.setScaleByDistance = function(e) { if (!s.equals(this._scaleByDistance, e)) { if (e.far <= e.near) throw new r("far distance must be greater than near distance.");
  3661. d(this, T), this._scaleByDistance = s.clone(e, this._scaleByDistance) } }, p.prototype.getEyeOffset = function() { return this._eyeOffset }, p.prototype.setEyeOffset = function(e) { if (!t(e)) throw new r("value is required."); var i = this._eyeOffset;
  3662. o.equals(i, e) || (o.clone(e, i), d(this, g)) }, p.prototype.getHorizontalOrigin = function() { return this._horizontalOrigin }, p.prototype.setHorizontalOrigin = function(e) { if (!t(e)) throw new r("value is required.");
  3663. this._horizontalOrigin !== e && (this._horizontalOrigin = e, d(this, _)) }, p.prototype.getVerticalOrigin = function() { return this._verticalOrigin }, p.prototype.setVerticalOrigin = function(e) { if (!t(e)) throw new r("value is required.");
  3664. this._verticalOrigin !== e && (this._verticalOrigin = e, d(this, w)) }, p.prototype.getScale = function() { return this._scale }, p.prototype.setScale = function(e) { if (!t(e)) throw new r("value is required.");
  3665. this._scale !== e && (this._scale = e, d(this, C)) }, p.prototype.getImageIndex = function() { return this._imageIndex }, p.prototype.setImageIndex = function(e) { if ("number" != typeof e) throw new r("value is required and must be a number.");
  3666. this._imageIndex !== e && (this._imageIndex = e, d(this, x)) }, p.prototype.getColor = function() { return this._color }, p.prototype.setColor = function(e) { if (!t(e)) throw new r("value is required."); var n = this._color;
  3667. i.equals(n, e) || (i.clone(e, n), d(this, S)) }, p.prototype.getRotation = function() { return this._rotation }, p.prototype.setRotation = function(e) { if (!t(e)) throw new r("value is required.");
  3668. this._rotation !== e && (this._rotation = e, d(this, E)) }, p.prototype.getAlignedAxis = function() { return this._alignedAxis }, p.prototype.setAlignedAxis = function(e) { if (!t(e)) throw new r("value is required."); var i = this._alignedAxis;
  3669. o.equals(i, e) || (o.clone(e, i), d(this, b)) }, p.prototype.getWidth = function() { return this._width }, p.prototype.setWidth = function(e) { this._width !== e && (this._width = e, d(this, x)) }, p.prototype.getHeight = function() { return this._height }, p.prototype.setHeight = function(e) { this._height !== e && (this._height = e, d(this, x)) }; var A = new a; return p._computeActualPosition = function(e, t, r) { return t.mode === c.SCENE3D ? e : (r.multiplyByPoint(e, A), h.computeActualWgs84Position(t, A)) }, p._computeScreenSpacePosition = function(e, t, r, i, o, a) { var s = a.camera,
  3670. l = s.getViewMatrix(),
  3671. u = s.frustum.getProjectionMatrix(),
  3672. c = l.multiply(e),
  3673. d = c.multiplyByPoint(t),
  3674. m = r.multiplyComponents(d.normalize());
  3675. d.x += r.x + m.x, d.y += r.y + m.y, d.z += m.z; var p = u.multiplyByVector(d),
  3676. f = h.clipToWindowCoordinates(o.getCanvas(), p),
  3677. v = o.getUniformState(),
  3678. y = i.multiplyByScalar(v.getHighResolutionSnapScale()); return f.x += y.x, f.y += y.y, new n(f.x, f.y) }, p.prototype.computeScreenSpacePosition = function(e, i) { var n = this._billboardCollection; if (!t(n)) throw new r("Billboard must be in a collection. Was it removed?"); if (!t(e)) throw new r("context is required."); if (!t(i)) throw new r("frameState is required."); var o = n.modelMatrix; return p._computeScreenSpacePosition(o, this._actualPosition, this._eyeOffset, this._pixelOffset, e, i) }, p.prototype.equals = function(e) { return this === e || t(e) && this._show === e._show && this._imageIndex === e._imageIndex && this._scale === e._scale && this._verticalOrigin === e._verticalOrigin && this._horizontalOrigin === e._horizontalOrigin && o.equals(this._position, e._position) && i.equals(this._color, e._color) && n.equals(this._pixelOffset, e._pixelOffset) && o.equals(this._eyeOffset, e._eyeOffset) && s.equals(this._scaleByDistance, e._scaleByDistance) }, p.prototype._destroy = function() { this._pickId = this._pickId && this._pickId.destroy(), this._billboardCollection = void 0 }, p }), r("Shaders/BillboardCollectionVS", [], function() { "use strict"; return "attribute vec3 positionHigh;\nattribute vec3 positionLow;\nattribute vec2 direction;\nattribute vec4 textureCoordinatesAndImageSize;\nattribute vec3 originAndShow;\nattribute vec2 pixelOffset;\nattribute vec4 eyeOffsetAndScale;\nattribute vec4 rotationAndAlignedAxis;\nattribute vec4 scaleByDistance;\n#ifdef RENDER_FOR_PICK\nattribute vec4 pickColor;\n#else\nattribute vec4 color;\n#endif\nconst vec2 czm_highResolutionSnapScale = vec2(1.0, 1.0);\nvarying vec2 v_textureCoordinates;\n#ifdef RENDER_FOR_PICK\nvarying vec4 v_pickColor;\n#else\nvarying vec4 v_color;\n#endif\nvoid main()\n{\nvec3 eyeOffset = eyeOffsetAndScale.xyz;\nfloat scale = eyeOffsetAndScale.w;\nvec2 textureCoordinates = textureCoordinatesAndImageSize.xy;\nvec2 imageSize = textureCoordinatesAndImageSize.zw;\nvec2 origin = originAndShow.xy;\nfloat show = originAndShow.z;\nvec4 p = czm_translateRelativeToEye(positionHigh, positionLow);\nvec4 positionEC = czm_modelViewRelativeToEye * p;\npositionEC = czm_eyeOffset(positionEC, eyeOffset);\npositionEC.xyz *= show;\n#ifdef EYE_DISTANCE_SCALING\nfloat lengthSq;\nif (czm_sceneMode == czm_sceneMode2D)\n{\nlengthSq = czm_eyeHeight2D.y;\n}\nelse\n{\nlengthSq = dot(positionEC.xyz, positionEC.xyz);\n}\nfloat scaleAtMin = scaleByDistance.y;\nfloat scaleAtMax = scaleByDistance.w;\nfloat nearDistanceSq = scaleByDistance.x * scaleByDistance.x;\nfloat farDistanceSq = scaleByDistance.z * scaleByDistance.z;\nlengthSq = clamp(lengthSq, nearDistanceSq, farDistanceSq);\nfloat t = (lengthSq - nearDistanceSq) / (farDistanceSq - nearDistanceSq);\nt = pow(t, 0.15);\nscale *= mix(scaleAtMin, scaleAtMax, t);\n#endif\nvec4 positionWC = czm_eyeToWindowCoordinates(positionEC);\nvec2 halfSize = imageSize * scale * czm_highResolutionSnapScale;\nhalfSize *= ((direction * 2.0) - 1.0);\npositionWC.xy += (origin * abs(halfSize));\n#ifdef ROTATION\nfloat rotation = rotationAndAlignedAxis.x;\nvec3 alignedAxis = rotationAndAlignedAxis.yzw;\nif (!all(equal(rotationAndAlignedAxis, vec4(0.0))))\n{\nfloat angle = rotation;\nif (!all(equal(alignedAxis, vec3(0.0))))\n{\nvec3 pos = positionEC.xyz + czm_encodedCameraPositionMCHigh + czm_encodedCameraPositionMCLow;\nvec3 normal = normalize(cross(alignedAxis, pos));\nvec4 tangent = vec4(normalize(cross(pos, normal)), 0.0);\ntangent = czm_modelViewProjection * tangent;\nangle += sign(-tangent.x) * acos(tangent.y / length(tangent.xy));\n}\nfloat cosTheta = cos(angle);\nfloat sinTheta = sin(angle);\nmat2 rotationMatrix = mat2(cosTheta, sinTheta, -sinTheta, cosTheta);\nhalfSize = rotationMatrix * halfSize;\n}\n#endif\npositionWC.xy += halfSize;\npositionWC.xy += (pixelOffset * czm_highResolutionSnapScale);\ngl_Position = czm_viewportOrthographic * vec4(positionWC.xy, -positionWC.z, 1.0);\nv_textureCoordinates = textureCoordinates;\n#ifdef RENDER_FOR_PICK\nv_pickColor = pickColor;\n#else\nv_color = color;\n#endif\n}\n" }), r("Shaders/BillboardCollectionFS", [], function() { "use strict"; return "uniform sampler2D u_atlas;\nvarying vec2 v_textureCoordinates;\n#ifdef RENDER_FOR_PICK\nvarying vec4 v_pickColor;\n#else\nvarying vec4 v_color;\n#endif\nvoid main()\n{\n#ifdef RENDER_FOR_PICK\nvec4 vertexColor = vec4(1.0, 1.0, 1.0, 1.0);\n#else\nvec4 vertexColor = v_color;\n#endif\nvec4 color = texture2D(u_atlas, v_textureCoordinates) * vertexColor;\nif (color.a == 0.0)\n{\ndiscard;\n}\n#ifdef RENDER_FOR_PICK\ngl_FragColor = v_pickColor;\n#else\ngl_FragColor = color;\n#endif\n}\n" }), r("Scene/BillboardCollection", ["../Core/defined", "../Core/DeveloperError", "../Core/Color", "../Core/defaultValue", "../Core/destroyObject", "../Core/Cartesian2", "../Core/Cartesian3", "../Core/EncodedCartesian3", "../Core/Matrix4", "../Core/ComponentDatatype", "../Core/IndexDatatype", "../Core/PrimitiveType", "../Core/BoundingSphere", "../Renderer/BlendingState", "../Renderer/BufferUsage", "../Renderer/CommandLists", "../Renderer/DrawCommand", "../Renderer/VertexArrayFacade", "../Renderer/createShaderSource", "./SceneMode", "./Billboard", "./HorizontalOrigin", "../Shaders/BillboardCollectionVS", "../Shaders/BillboardCollectionFS"], function(e, t, r, i, n, o, a, s, l, u, c, h, d, m, p, f, v, y, g, _, w, C, x, S) { "use strict";
  3679. function E(e) { if (e._billboardsRemoved) { e._billboardsRemoved = !1; for (var t = [], r = e._billboards, i = r.length, n = 0, o = 0; i > n; ++n) { var a = r[n];
  3680. a && (a._index = o++, t.push(a)) } e._billboards = t } }
  3681. function b(t) { var r = 16384,
  3682. i = t.cache.billboardCollection_directionsVertexBuffer; if (e(i)) return i; for (var n = new Uint8Array(2 * 4 * r), o = 0, a = 0; r > o; ++o) n[a++] = 0, n[a++] = 0, n[a++] = 255, n[a++] = 0, n[a++] = 255, n[a++] = 255, n[a++] = 0, n[a++] = 255; return i = t.createVertexBuffer(n, p.STATIC_DRAW), i.setVertexArrayDestroyable(!1), t.cache.billboardCollection_directionsVertexBuffer = i, i }
  3683. function T(t) { var r = 16384,
  3684. i = t.cache.billboardCollection_indexBuffer; if (e(i)) return i; for (var n = 6 * r, o = new Uint16Array(n), a = 0, s = 0; n > a; a += 6, s += 4) o[a + 0] = s + 0, o[a + 1] = s + 1, o[a + 2] = s + 2, o[a + 3] = s + 0, o[a + 4] = s + 2, o[a + 5] = s + 3; return i = t.createIndexBuffer(o, p.STATIC_DRAW, c.UNSIGNED_SHORT), i.setVertexArrayDestroyable(!1), t.cache.billboardCollection_indexBuffer = i, i }
  3685. function A(e, t, r) { var i = b(e); return new y(e, [{ index: et.positionHigh, componentsPerAttribute: 3, componentDatatype: u.FLOAT, usage: r[U] }, { index: et.positionLow, componentsPerAttribute: 3, componentDatatype: u.FLOAT, usage: r[U] }, { index: et.pixelOffset, componentsPerAttribute: 2, componentDatatype: u.FLOAT, usage: r[W] }, { index: et.eyeOffsetAndScale, componentsPerAttribute: 4, componentDatatype: u.FLOAT, usage: r[Y] }, { index: et.textureCoordinatesAndImageSize, componentsPerAttribute: 4, componentDatatype: u.FLOAT, usage: r[X] }, { index: et.pickColor, componentsPerAttribute: 4, normalize: !0, componentDatatype: u.UNSIGNED_BYTE, usage: p.STATIC_DRAW, purpose: it }, { index: et.color, componentsPerAttribute: 4, normalize: !0, componentDatatype: u.UNSIGNED_BYTE, usage: r[Z], purpose: rt }, { index: et.originAndShow, componentsPerAttribute: 3, componentDatatype: u.BYTE, usage: r[k] }, { index: et.direction, vertexBuffer: i, componentsPerAttribute: 2, normalize: !0, componentDatatype: u.UNSIGNED_BYTE }, { index: et.rotationAndAlignedAxis, componentsPerAttribute: 4, componentDatatype: u.FLOAT, usage: r[K] }, { index: et.scaleByDistance, componentsPerAttribute: 4, componentDatatype: u.FLOAT, usage: r[Q] }], 4 * t) }
  3686. function M(e, t, r, i, n) { var o = 4 * n._index,
  3687. a = n._getActualPosition();
  3688. e._mode === _.SCENE3D && e._baseVolume.expand(a, e._baseVolume), s.fromCartesian(a, at); var l = i[tt],
  3689. u = l[et.positionHigh],
  3690. c = at.high;
  3691. u(o + 0, c.x, c.y, c.z), u(o + 1, c.x, c.y, c.z), u(o + 2, c.x, c.y, c.z), u(o + 3, c.x, c.y, c.z); var h = l[et.positionLow],
  3692. d = at.low;
  3693. h(o + 0, d.x, d.y, d.z), h(o + 1, d.x, d.y, d.z), h(o + 2, d.x, d.y, d.z), h(o + 3, d.x, d.y, d.z) }
  3694. function P(e, t, r, i, n) { var o = 4 * n._index,
  3695. a = n.getPixelOffset();
  3696. e._maxPixelOffset = Math.max(e._maxPixelOffset, a.x, a.y); var s = i[tt],
  3697. l = s[et.pixelOffset];
  3698. l(o + 0, a.x, a.y), l(o + 1, a.x, a.y), l(o + 2, a.x, a.y), l(o + 3, a.x, a.y) }
  3699. function D(e, t, r, i, n) { var o = 4 * n._index,
  3700. a = n.getEyeOffset(),
  3701. s = n.getScale();
  3702. e._maxEyeOffset = Math.max(e._maxEyeOffset, Math.abs(a.x), Math.abs(a.y), Math.abs(a.z)), e._maxScale = Math.max(e._maxScale, s); var l = i[tt],
  3703. u = l[et.eyeOffsetAndScale];
  3704. u(o + 0, a.x, a.y, a.z, s), u(o + 1, a.x, a.y, a.z, s), u(o + 2, a.x, a.y, a.z, s), u(o + 3, a.x, a.y, a.z, s) }
  3705. function I(e, t, i, n, o) { var a = 4 * o._index,
  3706. s = n[it],
  3707. l = s[et.pickColor],
  3708. u = o.getPickId(t).color,
  3709. c = r.floatToByte(u.red),
  3710. h = r.floatToByte(u.green),
  3711. d = r.floatToByte(u.blue),
  3712. m = r.floatToByte(u.alpha);
  3713. l(a + 0, c, h, d, m), l(a + 1, c, h, d, m), l(a + 2, c, h, d, m), l(a + 3, c, h, d, m) }
  3714. function O(e, t, i, n, o) { var a = 4 * o._index,
  3715. s = n[rt],
  3716. l = s[et.color],
  3717. u = o.getColor(),
  3718. c = r.floatToByte(u.red),
  3719. h = r.floatToByte(u.green),
  3720. d = r.floatToByte(u.blue),
  3721. m = r.floatToByte(u.alpha);
  3722. l(a + 0, c, h, d, m), l(a + 1, c, h, d, m), l(a + 2, c, h, d, m), l(a + 3, c, h, d, m) }
  3723. function R(e, t, r, i, n) { var o = 4 * n._index,
  3724. a = n.getHorizontalOrigin().value,
  3725. s = n.getVerticalOrigin().value,
  3726. l = n.getShow();
  3727. 0 === n.getColor().alpha && (l = !1), e._allHorizontalCenter = e._allHorizontalCenter && a === C.CENTER.value; var u = i[tt],
  3728. c = u[et.originAndShow];
  3729. c(o + 0, a, s, l), c(o + 1, a, s, l), c(o + 2, a, s, l), c(o + 3, a, s, l) }
  3730. function L(r, n, o, a, s) { var l = 4 * s._index,
  3731. u = 0,
  3732. c = 0,
  3733. h = 0,
  3734. d = 0,
  3735. m = s.getImageIndex(); if (-1 !== m) { var p = o[m]; if (!e(p)) throw new t("Invalid billboard image index: " + m);
  3736. u = p.x, c = p.y, h = p.width, d = p.height } var f = u + h,
  3737. v = c + d,
  3738. y = r._textureAtlas.getTexture().getDimensions(),
  3739. g = .5 * i(s.getWidth(), y.x * h),
  3740. _ = .5 * i(s.getHeight(), y.y * d);
  3741. r._maxSize = Math.max(r._maxSize, g, _); var w = a[tt],
  3742. C = w[et.textureCoordinatesAndImageSize];
  3743. C(l + 0, u, c, g, _), C(l + 1, f, c, g, _), C(l + 2, f, v, g, _), C(l + 3, u, v, g, _) }
  3744. function z(e, t, r, i, n) { var o = 4 * n._index,
  3745. s = n.getRotation(),
  3746. l = n.getAlignedAxis();
  3747. 0 === s && a.equals(l, a.ZERO) || (e._shaderRotation = !0); var u = l.x,
  3748. c = l.y,
  3749. h = l.z,
  3750. d = i[tt],
  3751. m = d[et.rotationAndAlignedAxis];
  3752. m(o + 0, s, u, c, h), m(o + 1, s, u, c, h), m(o + 2, s, u, c, h), m(o + 3, s, u, c, h) }
  3753. function N(t, r, i, n, o) { var a = 4 * o._index,
  3754. s = n[tt],
  3755. l = s[et.scaleByDistance],
  3756. u = 0,
  3757. c = 0,
  3758. h = 0,
  3759. d = 0,
  3760. m = o.getScaleByDistance();
  3761. e(m) && (u = m.near, c = m.nearValue, h = m.far, d = m.farValue, (1 !== c || 1 !== d) && (t._shaderScaleByDistance = !0)), l(a + 0, u, c, h, d), l(a + 1, u, c, h, d), l(a + 2, u, c, h, d), l(a + 3, u, c, h, d) }
  3762. function F(e, t, r, i, n) { M(e, t, r, i, n), P(e, t, r, i, n), D(e, t, r, i, n), I(e, t, r, i, n), O(e, t, r, i, n), R(e, t, r, i, n), L(e, t, r, i, n), z(e, t, r, i, n), N(e, t, r, i, n) }
  3763. function B(t, r, i, n, o, a) { var s;
  3764. s = n.mode === _.SCENE3D ? t._baseVolume : t._baseVolume2D; for (var l = [], u = 0; i > u; ++u) { var c = r[u],
  3765. h = c.getPosition(),
  3766. m = w._computeActualPosition(h, n, o);
  3767. e(m) && (c._setActualPosition(m), a ? l.push(m) : s.expand(m, s)) } a && d.fromPoints(l, s) }
  3768. function V(e, t) { var r = t.mode,
  3769. i = t.scene2D.projection,
  3770. n = e._billboards,
  3771. o = e._billboardsToUpdate,
  3772. a = e._modelMatrix;
  3773. e._mode !== r || e._projection !== i || r !== _.SCENE3D && !a.equals(e.modelMatrix) ? (e._mode = r, e._projection = i, e.modelMatrix.clone(a), e._createVertexArray = !0, (r === _.SCENE3D || r === _.SCENE2D || r === _.COLUMBUS_VIEW) && B(e, n, n.length, t, a, !0)) : r === _.MORPHING ? B(e, n, n.length, t, a, !0) : (r === _.SCENE2D || r === _.COLUMBUS_VIEW) && B(e, o, e._billboardsToUpdateIndex, t, a, !1) }
  3774. function q(e, t, r, i) { var n, o, a, s = r.camera,
  3775. l = s.frustum,
  3776. u = s.getPositionWC().subtract(i.center, lt),
  3777. c = s.getDirectionWC().multiplyByScalar(u.dot(s.getDirectionWC()), ut),
  3778. h = Math.max(0, c.magnitude() - i.radius),
  3779. d = t.getCanvas();
  3780. st.x = d.clientWidth, st.y = d.clientHeight; var m = l.getPixelSize(st, h);
  3781. n = Math.max(m.x, m.y), o = 2 * n * e._maxScale * e._maxSize, e._allHorizontalCenter && (o *= .5), a = n * e._maxPixelOffset + e._maxEyeOffset, i.radius += o + a } var k = w.SHOW_INDEX,
  3782. U = w.POSITION_INDEX,
  3783. W = w.PIXEL_OFFSET_INDEX,
  3784. G = w.EYE_OFFSET_INDEX,
  3785. H = w.HORIZONTAL_ORIGIN_INDEX,
  3786. j = w.VERTICAL_ORIGIN_INDEX,
  3787. Y = w.SCALE_INDEX,
  3788. X = w.IMAGE_INDEX_INDEX,
  3789. Z = w.COLOR_INDEX,
  3790. K = w.ROTATION_INDEX,
  3791. J = w.ALIGNED_AXIS_INDEX,
  3792. Q = w.SCALE_BY_DISTANCE_INDEX,
  3793. $ = w.NUMBER_OF_PROPERTIES,
  3794. et = { positionHigh: 0, positionLow: 1, pixelOffset: 2, eyeOffsetAndScale: 3, textureCoordinatesAndImageSize: 4, originAndShow: 5, direction: 6, pickColor: 7, color: 7, rotationAndAlignedAxis: 8, scaleByDistance: 9 },
  3795. tt = "all",
  3796. rt = "color",
  3797. it = "pick",
  3798. nt = [],
  3799. ot = function() { this._textureAtlas = void 0, this._textureAtlasGUID = void 0, this._destroyTextureAtlas = !0, this._sp = void 0, this._rs = void 0, this._vaf = void 0, this._spPick = void 0, this._billboards = [], this._billboardsToUpdate = [], this._billboardsToUpdateIndex = 0, this._billboardsRemoved = !1, this._createVertexArray = !1, this._shaderRotation = !1, this._compiledShaderRotation = !1, this._compiledShaderRotationPick = !1, this._shaderScaleByDistance = !1, this._compiledShaderScaleByDistance = !1, this._compiledShaderScaleByDistancePick = !1, this._propertiesChanged = new Uint32Array($), this._maxSize = 0, this._maxEyeOffset = 0, this._maxScale = 1, this._maxPixelOffset = 0, this._allHorizontalCenter = !0, this._baseVolume = new d, this._baseVolume2D = new d, this._boundingVolume = new d, this._colorCommands = [], this._pickCommands = [], this._commandLists = new f, this.modelMatrix = l.IDENTITY.clone(), this._modelMatrix = l.IDENTITY.clone(), this._mode = _.SCENE3D, this._projection = void 0, this._buffersUsage = [p.STATIC_DRAW, p.STATIC_DRAW, p.STATIC_DRAW, p.STATIC_DRAW, p.STATIC_DRAW, p.STATIC_DRAW, p.STATIC_DRAW, p.STATIC_DRAW, p.STATIC_DRAW, p.STATIC_DRAW, p.STATIC_DRAW, p.STATIC_DRAW]; var e = this;
  3800. this._uniforms = { u_atlas: function() { return e._textureAtlas.getTexture() } } };
  3801. ot.prototype.add = function(e) { var t = new w(e, this); return t._index = this._billboards.length, this._billboards.push(t), this._createVertexArray = !0, t }, ot.prototype.remove = function(e) { return this.contains(e) ? (this._billboards[e._index] = null, this._billboardsRemoved = !0, this._createVertexArray = !0, e._destroy(), !0) : !1 }, ot.prototype.removeAll = function() { this._destroyBillboards(), this._billboards = [], this._billboardsToUpdate = [], this._billboardsToUpdateIndex = 0, this._billboardsRemoved = !1, this._createVertexArray = !0 }, ot.prototype._updateBillboard = function(e, t) { e._dirty || (this._billboardsToUpdate[this._billboardsToUpdateIndex++] = e), ++this._propertiesChanged[t] }, ot.prototype.contains = function(t) { return e(t) && t._billboardCollection === this }, ot.prototype.get = function(r) { if (!e(r)) throw new t("index is required."); return E(this), this._billboards[r] }, ot.prototype.getLength = function() { return E(this), this._billboards.length }, ot.prototype.getTextureAtlas = function() { return this._textureAtlas }, ot.prototype.setTextureAtlas = function(e) { this._textureAtlas !== e && (this._textureAtlas = this._destroyTextureAtlas && this._textureAtlas && this._textureAtlas.destroy(), this._textureAtlas = e, this._createVertexArray = !0) }, ot.prototype.getDestroyTextureAtlas = function() { return this._destroyTextureAtlas }, ot.prototype.setDestroyTextureAtlas = function(e) { this._destroyTextureAtlas = e }, ot.prototype.computeNewBuffersUsage = function() { for (var e = this._buffersUsage, t = !1, r = this._propertiesChanged, i = 0; $ > i; ++i) { var n = 0 === r[i] ? p.STATIC_DRAW : p.STREAM_DRAW;
  3802. t = t || e[i] !== n, e[i] = n } return t }; var at = new s,
  3803. st = new o,
  3804. lt = new a,
  3805. ut = new a; return ot.prototype.update = function(t, r, i) { var n = this._textureAtlas; if (e(n)) { var o = n.getTextureCoordinates(); if (0 !== o.length) { E(this), V(this, r); var a = this._billboards,
  3806. s = a.length,
  3807. u = this._billboardsToUpdate,
  3808. c = this._billboardsToUpdateIndex,
  3809. p = this._propertiesChanged,
  3810. f = n.getGUID(),
  3811. y = this._createVertexArray || this._textureAtlasGUID !== f;
  3812. this._textureAtlasGUID = f; var w, C = r.passes,
  3813. b = C.pick; if (y || !b && this.computeNewBuffersUsage()) { this._createVertexArray = !1; for (var I = 0; $ > I; ++I) p[I] = 0; if (this._vaf = this._vaf && this._vaf.destroy(), s > 0) { this._vaf = A(t, s, this._buffersUsage), w = this._vaf.writers; for (var B = 0; s > B; ++B) { var tt = this._billboards[B];
  3814. tt._dirty = !1, F(this, t, o, w, tt) } this._vaf.commit(T(t)) } this._billboardsToUpdateIndex = 0 } else if (c > 0) { var ot = []; if (p[U] && ot.push(M), p[W] && ot.push(P), (p[G] || p[Y]) && ot.push(D), p[X] && ot.push(L), p[Z] && ot.push(O), (p[H] || p[j] || p[k]) && ot.push(R), (p[K] || p[J]) && ot.push(z), p[Q] && ot.push(N), w = this._vaf.writers, c / s > .1) { for (var at = 0; c > at; ++at) { var st = u[at];
  3815. st._dirty = !1; for (var lt = 0; lt < ot.length; ++lt) ot[lt](this, t, o, w, st) } this._vaf.commit(T(t)) } else { for (var ut = 0; c > ut; ++ut) { var ct = u[ut];
  3816. ct._dirty = !1; for (var ht = 0; ht < ot.length; ++ht) ot[ht](this, t, o, w, ct);
  3817. this._vaf.subCommit(4 * ct._index, 4) } this._vaf.endSubCommits() } this._billboardsToUpdateIndex = 0 } if (c > 1.5 * s && (u.length = s), e(this._vaf) && e(this._vaf.vaByPurpose)) { var dt, mt = l.IDENTITY;
  3818. r.mode === _.SCENE3D ? (mt = this.modelMatrix, dt = d.clone(this._baseVolume, this._boundingVolume)) : dt = d.clone(this._baseVolume2D, this._boundingVolume), q(this, t, r, dt); var pt, ft, vt, yt, gt = this._commandLists; if (gt.colorList = nt, gt.pickList = nt, C.color) { var _t = this._colorCommands; for (gt.colorList = _t, e(this._rs) || (this._rs = t.createRenderState({ depthTest: { enabled: !0 }, blending: m.ALPHA_BLEND })), (!e(this._sp) || this._shaderRotation && !this._compiledShaderRotation || this._shaderScaleByDistance && !this._compiledShaderScaleByDistance) && (this._sp = t.getShaderCache().replaceShaderProgram(this._sp, g({ defines: [this._shaderRotation ? "ROTATION" : "", this._shaderScaleByDistance ? "EYE_DISTANCE_SCALING" : ""], sources: [x] }), S, et), this._compiledShaderRotation = this._shaderRotation, this._compiledShaderScaleByDistance = this._shaderScaleByDistance), pt = this._vaf.vaByPurpose[rt], ft = pt.length, _t.length = ft, yt = 0; ft > yt; ++yt) vt = _t[yt], e(vt) || (vt = _t[yt] = new v), vt.boundingVolume = dt, vt.modelMatrix = mt, vt.primitiveType = h.TRIANGLES, vt.count = pt[yt].indicesCount, vt.shaderProgram = this._sp, vt.uniformMap = this._uniforms, vt.vertexArray = pt[yt].va, vt.renderState = this._rs, vt.owner = this } if (b) { var wt = this._pickCommands; for (gt.pickList = wt, (!e(this._spPick) || this._shaderRotation && !this._compiledShaderRotationPick || this._shaderScaleByDistance && !this._compiledShaderScaleByDistancePick) && (this._spPick = t.getShaderCache().replaceShaderProgram(this._spPick, g({ defines: ["RENDER_FOR_PICK", this._shaderRotation ? "ROTATION" : "", this._shaderScaleByDistance ? "EYE_DISTANCE_SCALING" : ""], sources: [x] }), g({ defines: ["RENDER_FOR_PICK"], sources: [S] }), et), this._compiledShaderRotationPick = this._shaderRotation, this._compiledShaderScaleByDistancePick = this._shaderScaleByDistance), pt = this._vaf.vaByPurpose[it], ft = pt.length, wt.length = ft, yt = 0; ft > yt; ++yt) vt = wt[yt], e(vt) || (vt = wt[yt] = new v), vt.boundingVolume = dt, vt.modelMatrix = mt, vt.primitiveType = h.TRIANGLES, vt.count = pt[yt].indicesCount, vt.shaderProgram = this._spPick, vt.uniformMap = this._uniforms, vt.vertexArray = pt[yt].va, vt.renderState = this._rs, vt.owner = this } gt.empty() || i.push(gt) } } } }, ot.prototype.isDestroyed = function() { return !1 }, ot.prototype.destroy = function() { return this._textureAtlas = this._destroyTextureAtlas && this._textureAtlas && this._textureAtlas.destroy(), this._sp = this._sp && this._sp.release(), this._spPick = this._spPick && this._spPick.release(), this._vaf = this._vaf && this._vaf.destroy(), this._destroyBillboards(), n(this) }, ot.prototype._destroyBillboards = function() { for (var e = this._billboards, t = e.length, r = 0; t > r; ++r) e[r] && e[r]._destroy() }, ot }), r("Renderer/TextureAtlasBuilder", ["../Core/Event", "../Core/defined", "../Core/DeveloperError", "../Core/loadImage"], function(e, t, r, i) { "use strict";
  3819. function n() { this.imageLoaded = new e, this.index = -1, this.loaded = !1 } var o = function(e) { if (!t(e)) throw new r("textureAtlas is required.");
  3820. this.textureAtlas = e, this._idHash = {} }; return o.prototype.addTextureFromUrl = function(e, n) { if (!t(e)) throw new r("url is required."); if (!t(n)) throw new r("textureAvailableCallback is required.");
  3821. this.addTextureFromFunction(e, function(e, t) { i(e).then(t) }, n) }, o.prototype.addTextureFromFunction = function(e, i, o) { if (!t(e)) throw new r("id is required."); if (!t(i)) throw new r("getImageCallback is required."); if (!t(o)) throw new r("textureAvailableCallback is required."); var a = this._idHash[e]; if (t(a)) return a.loaded ? o(a.index) : a.imageLoaded.addEventListener(o), void 0;
  3822. this._idHash[e] = a = new n, a.imageLoaded.addEventListener(o); var s = this;
  3823. i(e, function(t) { if (!s.textureAtlas.isDestroyed()) { var r = a.index = s.textureAtlas.addImage(t);
  3824. a.loaded = !0, a.imageLoaded.raiseEvent(r, e), a.imageLoaded = void 0 } }) }, o }), r("DynamicScene/DynamicBillboardVisualizer", ["../Core/DeveloperError", "../Core/defined", "../Core/destroyObject", "../Core/Color", "../Core/Cartesian2", "../Core/Cartesian3", "../Scene/BillboardCollection", "../Scene/HorizontalOrigin", "../Scene/VerticalOrigin", "../Renderer/TextureAtlasBuilder"], function(e, t, r, i, n, o, a, s, l, u) {
  3825. "use strict";
  3826. function c(e, r, i) { return function(n) { var o = e._billboardVisualizerIndex; if (t(o)) { var a = r.get(o);
  3827. a._visualizerUrl === i && (a._visualizerTextureAvailable = !0, a.setImageIndex(n)) } } }
  3828. function h(e, r, a) { var u = a.billboard; if (t(u)) { var h = a.position; if (t(h)) { var d = u.image; if (t(d)) { var y, g = u.show,
  3829. _ = a._billboardVisualizerIndex,
  3830. w = a.isAvailable(r) && (!t(g) || g.getValue(r)); if (!w) return t(_) && (y = e._billboardCollection.get(_), y.setShow(!1), y.setImageIndex(-1), y._visualizerUrl = void 0, y._visualizerTextureAvailable = !1, a._billboardVisualizerIndex = void 0, e._unusedIndexes.push(_)), void 0; if (t(_)) y = e._billboardCollection.get(_);
  3831. else { var C = e._unusedIndexes,
  3832. x = C.length;
  3833. x > 0 ? (_ = C.pop(), y = e._billboardCollection.get(_)) : (_ = e._billboardCollection.getLength(), y = e._billboardCollection.add()), a._billboardVisualizerIndex = _, y.dynamicObject = a, y._visualizerUrl = void 0, y._visualizerTextureAvailable = !1, y.setColor(i.WHITE), y.setEyeOffset(o.ZERO), y.setPixelOffset(n.ZERO), y.setScale(1), y.setHorizontalOrigin(s.CENTER), y.setVerticalOrigin(l.CENTER) } var S = d.getValue(r); if (S !== y._visualizerUrl && (y._visualizerUrl = S, y._visualizerTextureAvailable = !1, e._textureAtlasBuilder.addTextureFromUrl(S, c(a, e._billboardCollection, S))), y.setShow(y._visualizerTextureAvailable), y._visualizerTextureAvailable) { m = h.getValue(r, m), t(m) && y.setPosition(m); var E = u.color; if (t(E) && (p = E.getValue(r, p), t(p) && y.setColor(p)), E = u.eyeOffset, t(E) && (f = E.getValue(r, f), t(f) && y.setEyeOffset(f)), E = u.pixelOffset, t(E) && (v = E.getValue(r, v), t(v) && y.setPixelOffset(v)), E = u.scale, t(E)) { var b = E.getValue(r);
  3834. t(b) && y.setScale(b) } if (E = u.rotation, t(E)) { var T = E.getValue(r);
  3835. t(T) && y.setRotation(T) } if (E = u.alignedAxis, t(E)) { var A = E.getValue(r);
  3836. t(A) && y.setAlignedAxis(A) } if (E = u.horizontalOrigin, t(E)) { var M = E.getValue(r);
  3837. t(M) && y.setHorizontalOrigin(M) } if (E = u.verticalOrigin, t(E)) { var P = E.getValue(r);
  3838. t(P) && y.setVerticalOrigin(P) } } } } } }
  3839. var d = function(r, i) {
  3840. if (!t(r)) throw new e("scene is required.");
  3841. this._scene = r, this._unusedIndexes = [], this._dynamicObjectCollection = void 0;
  3842. var n = this._billboardCollection = new a,
  3843. o = this._textureAtlas = r.getContext().createTextureAtlas();
  3844. this._textureAtlasBuilder = new u(o), n.setTextureAtlas(o), r.getPrimitives().add(n), this.setDynamicObjectCollection(i)
  3845. };
  3846. d.prototype.getScene = function() { return this._scene }, d.prototype.getDynamicObjectCollection = function() { return this._dynamicObjectCollection }, d.prototype.setDynamicObjectCollection = function(e) { var r = this._dynamicObjectCollection;
  3847. r !== e && (t(r) && (r.objectsRemoved.removeEventListener(d.prototype._onObjectsRemoved, this), this.removeAllPrimitives()), this._dynamicObjectCollection = e, t(e) && e.objectsRemoved.addEventListener(d.prototype._onObjectsRemoved, this)) }, d.prototype.update = function(r) { if (!t(r)) throw new e("time is requied."); if (t(this._dynamicObjectCollection))
  3848. for (var i = this._dynamicObjectCollection.getObjects(), n = 0, o = i.length; o > n; n++) h(this, r, i[n]) }, d.prototype.removeAllPrimitives = function() { if (t(this._dynamicObjectCollection)) { this._unusedIndexes = [], this._billboardCollection.removeAll(); for (var e = this._dynamicObjectCollection.getObjects(), r = e.length - 1; r > -1; r--) e[r]._billboardVisualizerIndex = void 0 } }, d.prototype.isDestroyed = function() { return !1 }, d.prototype.destroy = function() { return this.removeAllPrimitives(), this._scene.getPrimitives().remove(this._billboardCollection), r(this) };
  3849. var m, p, f, v;
  3850. return d.prototype._onObjectsRemoved = function(e, r) { for (var i = this._billboardCollection, n = this._unusedIndexes, o = r.length - 1; o > -1; o--) { var a = r[o],
  3851. s = a._billboardVisualizerIndex; if (t(s)) { var l = i.get(s);
  3852. l.setShow(!1), l.setImageIndex(-1), l._visualizerUrl = void 0, l._visualizerTextureAvailable = !1, a._billboardVisualizerIndex = void 0, n.push(s) } } }, d
  3853. }), r("Renderer/CullFace", ["../Core/Enumeration"], function(e) { "use strict"; var t = { FRONT: new e(1028, "FRONT"), BACK: new e(1029, "BACK"), FRONT_AND_BACK: new e(1032, "FRONT_AND_BACK"), validate: function(e) { return e === t.FRONT || e === t.BACK || e === t.FRONT_AND_BACK } }; return t }), r("Renderer/MipmapHint", ["../Core/Enumeration"], function(e) { "use strict"; var t = { DONT_CARE: new e(4352, "DONT_CARE"), FASTEST: new e(4353, "FASTEST"), NICEST: new e(4354, "NICEST"), validate: function(e) { return e === t.DONT_CARE || e === t.FASTEST || e === t.NICEST } }; return t }), r("Renderer/PixelDatatype", ["../Core/Enumeration"], function(e) { "use strict"; var t = { UNSIGNED_BYTE: new e(5121, "UNSIGNED_BYTE"), UNSIGNED_SHORT: new e(5123, "UNSIGNED_SHORT"), UNSIGNED_INT: new e(5125, "UNSIGNED_INT"), FLOAT: new e(5126, "FLOAT"), UNSIGNED_INT_24_8_WEBGL: new e(34042, "UNSIGNED_INT_24_8_WEBGL"), UNSIGNED_SHORT_4_4_4_4: new e(32819, "UNSIGNED_SHORT_4_4_4_4"), UNSIGNED_SHORT_5_5_5_1: new e(32820, "UNSIGNED_SHORT_5_5_5_1"), UNSIGNED_SHORT_5_6_5: new e(33635, "UNSIGNED_SHORT_5_6_5"), validate: function(e) { return e === t.UNSIGNED_BYTE || e === t.UNSIGNED_SHORT || e === t.UNSIGNED_INT || e === t.FLOAT || e === t.UNSIGNED_INT_24_8_WEBGL || e === t.UNSIGNED_SHORT_4_4_4_4 || e === t.UNSIGNED_SHORT_5_5_5_1 || e === t.UNSIGNED_SHORT_5_6_5 } }; return t }), r("Renderer/PixelFormat", ["../Core/Enumeration"], function(e) { "use strict"; var t = { DEPTH_COMPONENT: new e(6402, "DEPTH_COMPONENT"), DEPTH_STENCIL: new e(34041, "DEPTH_STENCIL"), ALPHA: new e(6406, "ALPHA"), RGB: new e(6407, "RGB"), RGBA: new e(6408, "RGBA"), LUMINANCE: new e(6409, "LUMINANCE"), LUMINANCE_ALPHA: new e(6410, "LUMINANCE_ALPHA"), validate: function(e) { return e === t.DEPTH_COMPONENT || e === t.DEPTH_STENCIL || e === t.ALPHA || e === t.RGB || e === t.RGBA || e === t.LUMINANCE || e === t.LUMINANCE_ALPHA }, isColorFormat: function(e) { return e === t.ALPHA || e === t.RGB || e === t.RGBA || e === t.LUMINANCE || e === t.LUMINANCE_ALPHA }, isDepthFormat: function(e) { return e === t.DEPTH_COMPONENT || e === t.DEPTH_STENCIL } }; return t }), r("Renderer/TextureMagnificationFilter", ["../Core/Enumeration"], function(e) { "use strict"; var t = { NEAREST: new e(9728, "NEAREST"), LINEAR: new e(9729, "LINEAR"), validate: function(e) { return e === t.NEAREST || e === t.LINEAR } }; return t }), r("Renderer/TextureMinificationFilter", ["../Core/Enumeration"], function(e) { "use strict"; var t = { NEAREST: new e(9728, "NEAREST"), LINEAR: new e(9729, "LINEAR"), NEAREST_MIPMAP_NEAREST: new e(9984, "NEAREST_MIPMAP_NEAREST"), LINEAR_MIPMAP_NEAREST: new e(9985, "LINEAR_MIPMAP_NEAREST"), NEAREST_MIPMAP_LINEAR: new e(9986, "NEAREST_MIPMAP_LINEAR"), LINEAR_MIPMAP_LINEAR: new e(9987, "LINEAR_MIPMAP_LINEAR"), validate: function(e) { return e === t.NEAREST || e === t.LINEAR || e === t.NEAREST_MIPMAP_NEAREST || e === t.LINEAR_MIPMAP_NEAREST || e === t.NEAREST_MIPMAP_LINEAR || e === t.LINEAR_MIPMAP_LINEAR } }; return t }), r("Renderer/TextureWrap", ["../Core/Enumeration"], function(e) { "use strict"; var t = { CLAMP: new e(33071, "CLAMP"), REPEAT: new e(10497, "REPEAT"), MIRRORED_REPEAT: new e(33648, "MIRRORED_REPEAT"), validate: function(e) { return e === t.CLAMP || e === t.REPEAT || e === t.MIRRORED_REPEAT } }; return t }), r("Renderer/Texture", ["../Core/Cartesian2", "../Core/defaultValue", "../Core/defined", "../Core/destroyObject", "../Core/DeveloperError", "../Core/Math", "./MipmapHint", "./PixelDatatype", "./PixelFormat", "./TextureMagnificationFilter", "./TextureMinificationFilter", "./TextureWrap"], function(e, t, r, i, n, o, a, s, l, u, c, h) { "use strict"; var d = function(t, r, i, n, o, a, s, l, u, c) { this._gl = t, this._textureFilterAnisotropic = r, this._textureTarget = i, this._texture = n, this._pixelFormat = o, this._pixelDatatype = a, this._width = s, this._height = l, this._dimensions = new e(s, l), this._preMultiplyAlpha = u, this._flipY = c, this._sampler = void 0, this.setSampler() }; return d.prototype.copyFrom = function(e, i, o) { if (!r(e)) throw new n("source is required."); if (l.isDepthFormat(this._pixelFormat)) throw new n("Cannot call copyFrom when the texture pixel format is DEPTH_COMPONENT or DEPTH_STENCIL."); if (i = t(i, 0), o = t(o, 0), 0 > i) throw new n("xOffset must be greater than or equal to zero."); if (0 > o) throw new n("yOffset must be greater than or equal to zero."); var a = e.width,
  3854. s = e.height; if (i + a > this._width) throw new n("xOffset + source.width must be less than or equal to getWidth()."); if (o + s > this._height) throw new n("yOffset + source.height must be less than or equal to getHeight()."); var u = this._gl,
  3855. c = this._textureTarget;
  3856. u.pixelStorei(u.UNPACK_PREMULTIPLY_ALPHA_WEBGL, this._preMultiplyAlpha), u.pixelStorei(u.UNPACK_FLIP_Y_WEBGL, this._flipY), u.activeTexture(u.TEXTURE0), u.bindTexture(c, this._texture), e.arrayBufferView ? u.texSubImage2D(c, 0, i, o, a, s, +this._pixelFormat, +this._pixelDatatype, e.arrayBufferView) : u.texSubImage2D(c, 0, i, o, this._pixelFormat, this._pixelDatatype, e), u.bindTexture(c, null) }, d.prototype.copyFromFramebuffer = function(e, r, i, o, a, u) { if (l.isDepthFormat(this._pixelFormat)) throw new n("Cannot call copyFromFramebuffer when the texture pixel format is DEPTH_COMPONENT or DEPTH_STENCIL."); if (this._pixelDatatype === s.FLOAT) throw new n("Cannot call copyFromFramebuffer when the texture pixel data type is FLOAT."); if (e = t(e, 0), r = t(r, 0), i = t(i, 0), o = t(o, 0), a = t(a, this._width), u = t(u, this._height), 0 > e) throw new n("xOffset must be greater than or equal to zero."); if (0 > r) throw new n("yOffset must be greater than or equal to zero."); if (0 > i) throw new n("framebufferXOffset must be greater than or equal to zero."); if (0 > o) throw new n("framebufferYOffset must be greater than or equal to zero."); if (e + a > this._width) throw new n("xOffset + width must be less than or equal to getWidth()."); if (r + u > this._height) throw new n("yOffset + height must be less than or equal to getHeight()."); var c = this._gl,
  3857. h = this._textureTarget;
  3858. c.activeTexture(c.TEXTURE0), c.bindTexture(h, this._texture), c.copyTexSubImage2D(h, 0, e, r, i, o, a, u), c.bindTexture(h, null) }, d.prototype.generateMipmap = function(e) { if (l.isDepthFormat(this._pixelFormat)) throw new n("Cannot call generateMipmap when the texture pixel format is DEPTH_COMPONENT or DEPTH_STENCIL."); if (this._width > 1 && !o.isPowerOfTwo(this._width)) throw new n("width must be a power of two to call generateMipmap()."); if (this._height > 1 && !o.isPowerOfTwo(this._height)) throw new n("height must be a power of two to call generateMipmap()."); if (e = t(e, a.DONT_CARE), !a.validate(e)) throw new n("hint is invalid."); var r = this._gl,
  3859. i = this._textureTarget;
  3860. r.hint(r.GENERATE_MIPMAP_HINT, e), r.activeTexture(r.TEXTURE0), r.bindTexture(i, this._texture), r.generateMipmap(i), r.bindTexture(i, null) }, d.prototype.getSampler = function() { return this._sampler }, d.prototype.setSampler = function(e) { if (!r(e)) { var t = c.LINEAR,
  3861. i = u.LINEAR;
  3862. this._pixelDatatype === s.FLOAT && (t = c.NEAREST, i = u.NEAREST), e = { wrapS: h.CLAMP, wrapT: h.CLAMP, minificationFilter: t, magnificationFilter: i, maximumAnisotropy: 1 } } if (this._pixelDatatype === s.FLOAT) { if (e.minificationFilter !== c.NEAREST && e.minificationFilter !== c.NEAREST_MIPMAP_NEAREST) throw new n("Only NEAREST and NEAREST_MIPMAP_NEAREST minification filters are supported for floating point textures."); if (e.magnificationFilter !== u.NEAREST) throw new n("Only the NEAREST magnification filter is supported for floating point textures.") } var o = this._gl,
  3863. a = this._textureTarget;
  3864. o.activeTexture(o.TEXTURE0), o.bindTexture(a, this._texture), o.texParameteri(a, o.TEXTURE_MIN_FILTER, e.minificationFilter), o.texParameteri(a, o.TEXTURE_MAG_FILTER, e.magnificationFilter), o.texParameteri(a, o.TEXTURE_WRAP_S, e.wrapS), o.texParameteri(a, o.TEXTURE_WRAP_T, e.wrapT), this._textureFilterAnisotropic && o.texParameteri(a, this._textureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT, e.maximumAnisotropy), o.bindTexture(a, null), this._sampler = { wrapS: e.wrapS, wrapT: e.wrapT, minificationFilter: e.minificationFilter, magnificationFilter: e.magnificationFilter, maximumAnisotropy: e.maximumAnisotropy } }, d.prototype.getPixelFormat = function() { return this._pixelFormat }, d.prototype.getPixelDatatype = function() { return this._pixelDatatype }, d.prototype.getDimensions = function() { return this._dimensions }, d.prototype.getPreMultiplyAlpha = function() { return this._preMultiplyAlpha }, d.prototype.getFlipY = function() { return this._flipY }, d.prototype.getWidth = function() { return this._width }, d.prototype.getHeight = function() { return this._height }, d.prototype._getTexture = function() { return this._texture }, d.prototype._getTarget = function() { return this._textureTarget }, d.prototype.isDestroyed = function() { return !1 }, d.prototype.destroy = function() { return this._gl.deleteTexture(this._texture), i(this) }, d }), r("Renderer/CubeMapFace", ["../Core/defaultValue", "../Core/DeveloperError", "./PixelDatatype"], function(e, t, r) { "use strict"; var i = function(e, t, r, i, n, o, a, s, l) { this._gl = e, this._texture = t, this._textureTarget = r, this._targetFace = i, this._pixelFormat = n, this._pixelDatatype = o, this._size = a, this._preMultiplyAlpha = s, this._flipY = l }; return i.prototype.copyFrom = function(r, i, n) { if (!r) throw new t("source is required.");
  3865. i = e(i, 0), n = e(n, 0); var o = r.width,
  3866. a = r.height; if (0 > i) throw new t("xOffset must be greater than or equal to zero."); if (0 > n) throw new t("yOffset must be greater than or equal to zero."); if (i + o > this._size) throw new t("xOffset + source.width must be less than or equal to getWidth()."); if (n + a > this._size) throw new t("yOffset + source.height must be less than or equal to getHeight()."); var s = this._gl,
  3867. l = this._textureTarget;
  3868. s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL, this._preMultiplyAlpha), s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL, this._flipY), s.activeTexture(s.TEXTURE0), s.bindTexture(l, this._texture), r.arrayBufferView ? s.texSubImage2D(this._targetFace, 0, i, n, o, a, +this._pixelFormat, +this._pixelDatatype, r.arrayBufferView) : s.texSubImage2D(this._targetFace, 0, i, n, +this._pixelFormat, +this._pixelDatatype, r), s.bindTexture(l, null) }, i.prototype.copyFromFramebuffer = function(i, n, o, a, s, l) { if (i = e(i, 0), n = e(n, 0), o = e(o, 0), a = e(a, 0), s = e(s, this._size), l = e(l, this._size), 0 > i) throw new t("xOffset must be greater than or equal to zero."); if (0 > n) throw new t("yOffset must be greater than or equal to zero."); if (0 > o) throw new t("framebufferXOffset must be greater than or equal to zero."); if (0 > a) throw new t("framebufferYOffset must be greater than or equal to zero."); if (i + s > this._size) throw new t("xOffset + source.width must be less than or equal to getWidth()."); if (n + l > this._size) throw new t("yOffset + source.height must be less than or equal to getHeight()."); if (this._pixelDatatype === r.FLOAT) throw new t("Cannot call copyFromFramebuffer when the texture pixel data type is FLOAT."); var u = this._gl,
  3869. c = this._textureTarget;
  3870. u.activeTexture(u.TEXTURE0), u.bindTexture(c, this._texture), u.copyTexSubImage2D(this._targetFace, 0, i, n, o, a, s, l), u.bindTexture(c, null) }, i.prototype.getPixelFormat = function() { return this._pixelFormat }, i.prototype.getPixelDatatype = function() { return this._pixelDatatype }, i.prototype._getTexture = function() { return this._texture }, i.prototype._getTarget = function() { return this._targetFace }, i }), r("Renderer/CubeMap", ["../Core/defined", "../Core/DeveloperError", "../Core/destroyObject", "../Core/Math", "./MipmapHint", "./PixelDatatype", "./TextureMagnificationFilter", "./TextureMinificationFilter", "./TextureWrap", "./CubeMapFace"], function(e, t, r, i, n, o, a, s, l, u) { "use strict"; var c = function(e, t, r, i, n, o, a, s, l) { this._gl = e, this._textureFilterAnisotropic = t, this._textureTarget = r, this._texture = i, this._pixelFormat = n, this._pixelDatatype = o, this._size = a, this._preMultiplyAlpha = s, this._flipY = l, this._sampler = void 0, this._positiveX = new u(e, i, r, e.TEXTURE_CUBE_MAP_POSITIVE_X, n, o, a, s, l), this._negativeX = new u(e, i, r, e.TEXTURE_CUBE_MAP_NEGATIVE_X, n, o, a, s, l), this._positiveY = new u(e, i, r, e.TEXTURE_CUBE_MAP_POSITIVE_Y, n, o, a, s, l), this._negativeY = new u(e, i, r, e.TEXTURE_CUBE_MAP_NEGATIVE_Y, n, o, a, s, l), this._positiveZ = new u(e, i, r, e.TEXTURE_CUBE_MAP_POSITIVE_Z, n, o, a, s, l), this._negativeZ = new u(e, i, r, e.TEXTURE_CUBE_MAP_NEGATIVE_Z, n, o, a, s, l), this.setSampler() }; return c.prototype.getPositiveX = function() { return this._positiveX }, c.prototype.getNegativeX = function() { return this._negativeX }, c.prototype.getPositiveY = function() { return this._positiveY }, c.prototype.getNegativeY = function() { return this._negativeY }, c.prototype.getPositiveZ = function() { return this._positiveZ }, c.prototype.getNegativeZ = function() { return this._negativeZ }, c.prototype.generateMipmap = function(e) { if (this._size > 1 && !i.isPowerOfTwo(this._size)) throw new t("width and height must be a power of two to call generateMipmap()."); if (e = e || n.DONT_CARE, !n.validate(e)) throw new t("hint is invalid."); var r = this._gl,
  3871. o = this._textureTarget;
  3872. r.hint(r.GENERATE_MIPMAP_HINT, e), r.activeTexture(r.TEXTURE0), r.bindTexture(o, this._texture), r.generateMipmap(o), r.bindTexture(o, null) }, c.prototype.setSampler = function(r) { if (!e(r)) { var i = s.LINEAR,
  3873. n = a.LINEAR;
  3874. this._pixelDatatype === o.FLOAT && (i = s.NEAREST, n = a.NEAREST), r = { wrapS: l.CLAMP, wrapT: l.CLAMP, minificationFilter: i, magnificationFilter: n, maximumAnisotropy: 1 } } if (this._pixelDatatype === o.FLOAT) { if (r.minificationFilter !== s.NEAREST && r.minificationFilter !== s.NEAREST_MIPMAP_NEAREST) throw new t("Only NEAREST and NEAREST_MIPMAP_NEAREST minification filters are supported for floating point textures."); if (r.magnificationFilter !== a.NEAREST) throw new t("Only the NEAREST magnification filter is supported for floating point textures.") } var u = this._gl,
  3875. c = this._textureTarget;
  3876. u.activeTexture(u.TEXTURE0), u.bindTexture(c, this._texture), u.texParameteri(c, u.TEXTURE_MIN_FILTER, r.minificationFilter), u.texParameteri(c, u.TEXTURE_MAG_FILTER, r.magnificationFilter), u.texParameteri(c, u.TEXTURE_WRAP_S, r.wrapS), u.texParameteri(c, u.TEXTURE_WRAP_T, r.wrapT), this._textureFilterAnisotropic && u.texParameteri(c, this._textureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT, r.maximumAnisotropy), u.bindTexture(c, null), this._sampler = { wrapS: r.wrapS, wrapT: r.wrapT, minificationFilter: r.minificationFilter, magnificationFilter: r.magnificationFilter, maximumAnisotropy: r.maximumAnisotropy } }, c.prototype.getSampler = function() { return this._sampler }, c.prototype.getPixelFormat = function() { return this._pixelFormat }, c.prototype.getPixelDatatype = function() { return this._pixelDatatype }, c.prototype.getWidth = function() { return this._size }, c.prototype.getHeight = function() { return this._size }, c.prototype.getPreMultiplyAlpha = function() { return this._preMultiplyAlpha }, c.prototype.getFlipY = function() { return this._flipY }, c.prototype._getTexture = function() { return this._texture }, c.prototype._getTarget = function() { return this._textureTarget }, c.prototype.isDestroyed = function() { return !1 }, c.prototype.destroy = function() { return this._gl.deleteTexture(this._texture), this._positiveX = r(this._positiveX), this._negativeX = r(this._negativeX), this._positiveY = r(this._positiveY), this._negativeY = r(this._negativeY), this._positiveZ = r(this._positiveZ), this._negativeZ = r(this._negativeZ), r(this) }, c }), r("Shaders/Materials/AsphaltMaterial", [], function() { "use strict"; return "uniform vec4 asphaltColor;\nuniform float bumpSize;\nuniform float roughness;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nvec4 color = asphaltColor;\nvec2 st = materialInput.st;\nvec2 F = czm_cellular(st / bumpSize);\ncolor.rgb -= (F.x / F.y) * 0.1;\nfloat noise = czm_snoise(st / bumpSize);\nnoise = pow(noise, 5.0) * roughness;\ncolor.rgb += noise;\nmaterial.diffuse = color.rgb;\nmaterial.alpha = color.a;\nreturn material;\n}\n" }), r("Shaders/Materials/BlobMaterial", [], function() { "use strict"; return "uniform vec4 lightColor;\nuniform vec4 darkColor;\nuniform float frequency;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nvec2 F = czm_cellular(materialInput.st * frequency);\nfloat t = 1.0 - F.x * F.x;\nvec4 color = mix(lightColor, darkColor, t);\nmaterial.diffuse = color.rgb;\nmaterial.alpha = color.a;\nreturn material;\n}\n" }), r("Shaders/Materials/BrickMaterial", [], function() { "use strict"; return "uniform vec4 brickColor;\nuniform vec4 mortarColor;\nuniform vec2 brickSize;\nuniform vec2 brickPct;\nuniform float brickRoughness;\nuniform float mortarRoughness;\n#define Integral(x, p) ((floor(x) * p) + max(fract(x) - (1.0 - p), 0.0))\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nvec2 st = materialInput.st;\nvec2 position = st / brickSize;\nif(fract(position.y * 0.5) > 0.5) {\nposition.x += 0.5;\n}\nvec2 filterWidth = vec2(0.02);\nvec2 useBrick = (Integral(position + filterWidth, brickPct) -\nIntegral(position, brickPct)) / filterWidth;\nfloat useBrickFinal = useBrick.x * useBrick.y;\nvec4 color = mix(mortarColor, brickColor, useBrickFinal);\nvec2 brickScaled = vec2(st.x / 0.1, st.y / 0.006);\nfloat brickNoise = abs(czm_snoise(brickScaled) * brickRoughness / 5.0);\ncolor.rg += brickNoise * useBrickFinal;\nvec2 mortarScaled = st / 0.005;\nfloat mortarNoise = max(czm_snoise(mortarScaled) * mortarRoughness, 0.0);\ncolor.rgb += mortarNoise * (1.0 - useBrickFinal);\nmaterial.diffuse = color.rgb;\nmaterial.alpha = color.a;\nreturn material;\n}\n" }), r("Shaders/Materials/BumpMapMaterial", [], function() { "use strict"; return "uniform sampler2D image;\nuniform float strength;\nuniform vec2 repeat;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nvec2 st = materialInput.st;\nvec2 centerPixel = fract(repeat * st);\nfloat centerBump = texture2D(image, centerPixel).channel;\nfloat imageWidth = float(imageDimensions.x);\nvec2 rightPixel = fract(repeat * (st + vec2(1.0 / imageWidth, 0.0)));\nfloat rightBump = texture2D(image, rightPixel).channel;\nfloat imageHeight = float(imageDimensions.y);\nvec2 leftPixel = fract(repeat * (st + vec2(0.0, 1.0 / imageHeight)));\nfloat topBump = texture2D(image, leftPixel).channel;\nvec3 normalTangentSpace = normalize(vec3(centerBump - rightBump, centerBump - topBump, clamp(1.0 - strength, 0.1, 1.0)));\nvec3 normalEC = materialInput.tangentToEyeMatrix * normalTangentSpace;\nmaterial.normal = normalEC;\nmaterial.diffuse = vec3(0.01);\nreturn material;\n}\n" }), r("Shaders/Materials/CementMaterial", [], function() { "use strict"; return "uniform vec4 cementColor;\nuniform float grainScale;\nuniform float roughness;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nfloat noise = czm_snoise(materialInput.st / grainScale);\nnoise = pow(noise, 5.0) * roughness;\nvec4 color = cementColor;\ncolor.rgb += noise;\nmaterial.diffuse = color.rgb;\nmaterial.alpha = color.a;\nreturn material;\n}\n" }), r("Shaders/Materials/CheckerboardMaterial", [], function() { "use strict"; return "uniform vec4 lightColor;\nuniform vec4 darkColor;\nuniform vec2 repeat;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nvec2 st = materialInput.st;\nfloat b = mod(floor(repeat.s * st.s) + floor(repeat.t * st.t), 2.0);\nfloat scaledWidth = fract(repeat.s * st.s);\nscaledWidth = abs(scaledWidth - floor(scaledWidth + 0.5));\nfloat scaledHeight = fract(repeat.t * st.t);\nscaledHeight = abs(scaledHeight - floor(scaledHeight + 0.5));\nfloat value = min(scaledWidth, scaledHeight);\nvec4 currentColor = mix(lightColor, darkColor, b);\nvec4 color = czm_antialias(lightColor, darkColor, currentColor, value, 0.03);\nmaterial.diffuse = color.rgb;\nmaterial.alpha = color.a;\nreturn material;\n}\n" }), r("Shaders/Materials/DotMaterial", [], function() { "use strict"; return "uniform vec4 lightColor;\nuniform vec4 darkColor;\nuniform vec2 repeat;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nfloat b = smoothstep(0.3, 0.32, length(fract(repeat * materialInput.st) - 0.5));\nvec4 color = mix(lightColor, darkColor, b);\nmaterial.diffuse = color.rgb;\nmaterial.alpha = color.a;\nreturn material;\n}\n" }), r("Shaders/Materials/FacetMaterial", [], function() { "use strict"; return "uniform vec4 lightColor;\nuniform vec4 darkColor;\nuniform float frequency;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nvec2 F = czm_cellular(materialInput.st * frequency);\nfloat t = 0.1 + (F.y - F.x);\nvec4 color = mix(lightColor, darkColor, t);\nmaterial.diffuse = color.rgb;\nmaterial.alpha = color.a;\nreturn material;\n}\n" }), r("Shaders/Materials/FresnelMaterial", [], function() { "use strict"; return "czm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nvec3 normalWC = normalize(czm_inverseViewRotation * material.normal);\nvec3 positionWC = normalize(czm_inverseViewRotation * materialInput.positionToEyeEC);\nfloat cosAngIncidence = max(dot(normalWC, positionWC), 0.0);\nmaterial.diffuse = mix(reflection.diffuse, refraction.diffuse, cosAngIncidence);\nreturn material;\n}\n" }), r("Shaders/Materials/GrassMaterial", [], function() { "use strict"; return "uniform vec4 grassColor;\nuniform vec4 dirtColor;\nuniform float patchiness;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nvec2 st = materialInput.st;\nfloat noise1 = (czm_snoise(st * patchiness * 1.0)) * 1.0;\nfloat noise2 = (czm_snoise(st * patchiness * 2.0)) * 0.5;\nfloat noise3 = (czm_snoise(st * patchiness * 4.0)) * 0.25;\nfloat noise = sin(noise1 + noise2 + noise3) * 0.1;\nvec4 color = mix(grassColor, dirtColor, noise);\nfloat verticalNoise = czm_snoise(vec2(st.x * 100.0, st.y * 20.0)) * 0.02;\nfloat horizontalNoise = czm_snoise(vec2(st.x * 20.0, st.y * 100.0)) * 0.02;\nfloat stripeNoise = min(verticalNoise, horizontalNoise);\ncolor.rgb += stripeNoise;\nmaterial.diffuse = color.rgb;\nmaterial.alpha = color.a;\nreturn material;\n}\n" }), r("Shaders/Materials/GridMaterial", [], function() { "use strict"; return "#ifdef GL_OES_standard_derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\nuniform vec4 color;\nuniform float cellAlpha;\nuniform vec2 lineCount;\nuniform vec2 lineThickness;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nvec2 st = materialInput.st;\nfloat scaledWidth = fract(lineCount.s * st.s);\nscaledWidth = abs(scaledWidth - floor(scaledWidth + 0.5));\nfloat scaledHeight = fract(lineCount.t * st.t);\nscaledHeight = abs(scaledHeight - floor(scaledHeight + 0.5));\nfloat value;\n#ifdef GL_OES_standard_derivatives\nconst float fuzz = 1.2;\nvec2 thickness = lineThickness - 1.0;\nvec2 dx = abs(dFdx(st));\nvec2 dy = abs(dFdy(st));\nvec2 dF = vec2(max(dx.s, dy.s), max(dx.t, dy.t)) * lineCount;\nvalue = min(\nsmoothstep(dF.s * thickness.s, dF.s * (fuzz + thickness.s), scaledWidth),\nsmoothstep(dF.t * thickness.t, dF.t * (fuzz + thickness.t), scaledHeight));\n#else\nconst float fuzz = 0.05;\nvec2 range = 0.5 - (lineThickness * 0.05);\nvalue = min(\n1.0 - smoothstep(range.s, range.s + fuzz, scaledWidth),\n1.0 - smoothstep(range.t, range.t + fuzz, scaledHeight));\n#endif\nfloat dRim = 1.0 - dot(materialInput.normalEC, normalize(materialInput.positionToEyeEC));\nfloat sRim = smoothstep(0.8, 1.0, dRim);\nvalue *= (1.0 - sRim);\nvec3 halfColor = color.rgb * 0.5;\nmaterial.diffuse = halfColor;\nmaterial.emission = halfColor;\nmaterial.alpha = color.a * (1.0 - ((1.0 - cellAlpha) * value));\nreturn material;\n}\n" }), r("Shaders/Materials/NormalMapMaterial", [], function() { "use strict"; return "uniform sampler2D image;\nuniform float strength;\nuniform vec2 repeat;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nvec4 textureValue = texture2D(image, fract(repeat * materialInput.st));\nvec3 normalTangentSpace = textureValue.channels;\nnormalTangentSpace.xy = normalTangentSpace.xy * 2.0 - 1.0;\nnormalTangentSpace.z = clamp(1.0 - strength, 0.1, 1.0);\nnormalTangentSpace = normalize(normalTangentSpace);\nvec3 normalEC = materialInput.tangentToEyeMatrix * normalTangentSpace;\nmaterial.normal = normalEC;\nreturn material;\n}\n" }), r("Shaders/Materials/ReflectionMaterial", [], function() { "use strict"; return "uniform samplerCube cubeMap;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nvec3 normalWC = normalize(czm_inverseViewRotation * material.normal);\nvec3 positionWC = normalize(czm_inverseViewRotation * materialInput.positionToEyeEC);\nvec3 reflectedWC = reflect(positionWC, normalWC);\nmaterial.diffuse = textureCube(cubeMap, reflectedWC).channels;\nreturn material;\n}\n" }), r("Shaders/Materials/RefractionMaterial", [], function() { "use strict"; return "uniform samplerCube cubeMap;\nuniform float indexOfRefractionRatio;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nvec3 normalWC = normalize(czm_inverseViewRotation * material.normal);\nvec3 positionWC = normalize(czm_inverseViewRotation * materialInput.positionToEyeEC);\nvec3 refractedWC = refract(positionWC, -normalWC, indexOfRefractionRatio);\nmaterial.diffuse = textureCube(cubeMap, refractedWC).channels;\nreturn material;\n}\n" }), r("Shaders/Materials/StripeMaterial", [], function() { "use strict"; return "uniform vec4 lightColor;\nuniform vec4 darkColor;\nuniform float offset;\nuniform float repeat;\nuniform bool horizontal;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nfloat coord = mix(materialInput.st.s, materialInput.st.t, float(horizontal));\nfloat value = fract((coord - offset) * (repeat * 0.5));\nfloat dist = min(value, min(abs(value - 0.5), 1.0 - value));\nvec4 currentColor = mix(lightColor, darkColor, step(0.5, value));\nvec4 color = czm_antialias(lightColor, darkColor, currentColor, dist);\nmaterial.diffuse = color.rgb;\nmaterial.alpha = color.a;\nreturn material;\n}\n" }), r("Shaders/Materials/TieDyeMaterial", [], function() { "use strict"; return "uniform vec4 lightColor;\nuniform vec4 darkColor;\nuniform float frequency;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nvec3 scaled = materialInput.str * frequency;\nfloat t = abs(czm_snoise(scaled));\nvec4 color = mix(lightColor, darkColor, t);\nmaterial.diffuse = color.rgb;\nmaterial.alpha = color.a;\nreturn material;\n}\n" }), r("Shaders/Materials/Water", [], function() { "use strict"; return "uniform sampler2D specularMap;\nuniform sampler2D normalMap;\nuniform vec4 baseWaterColor;\nuniform vec4 blendColor;\nuniform float frequency;\nuniform float animationSpeed;\nuniform float amplitude;\nuniform float specularIntensity;\nuniform float fadeFactor;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nfloat time = czm_frameNumber * animationSpeed;\nfloat fade = max(1.0, (length(materialInput.positionToEyeEC) / 10000000000.0) * frequency * fadeFactor);\nfloat specularMapValue = texture2D(specularMap, materialInput.st).r;\nvec4 noise = czm_getWaterNoise(normalMap, materialInput.st * frequency, time, 0.0);\nvec3 normalTangentSpace = noise.xyz * vec3(1.0, 1.0, (1.0 / amplitude));\nnormalTangentSpace.xy /= fade;\nnormalTangentSpace = mix(vec3(0.0, 0.0, 50.0), normalTangentSpace, specularMapValue);\nnormalTangentSpace = normalize(normalTangentSpace);\nfloat tsPerturbationRatio = clamp(dot(normalTangentSpace, vec3(0.0, 0.0, 1.0)), 0.0, 1.0);\nmaterial.alpha = specularMapValue;\nmaterial.diffuse = mix(blendColor.rgb, baseWaterColor.rgb, specularMapValue);\nmaterial.diffuse += (0.1 * tsPerturbationRatio);\nmaterial.normal = normalize(materialInput.tangentToEyeMatrix * normalTangentSpace);\nmaterial.specular = specularIntensity;\nmaterial.shininess = 10.0;\nreturn material;\n}\n" }), r("Shaders/Materials/WoodMaterial", [], function() { "use strict"; return "uniform vec4 lightWoodColor;\nuniform vec4 darkWoodColor;\nuniform float ringFrequency;\nuniform vec2 noiseScale;\nuniform float grainFrequency;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nvec2 st = materialInput.st;\nvec2 noisevec;\nnoisevec.x = czm_snoise(st * noiseScale.x);\nnoisevec.y = czm_snoise(st * noiseScale.y);\nvec2 location = st + noisevec;\nfloat dist = sqrt(location.x * location.x + location.y * location.y);\ndist *= ringFrequency;\nfloat r = fract(dist + noisevec[0] + noisevec[1]) * 2.0;\nif(r > 1.0)\nr = 2.0 - r;\nvec4 color = mix(lightWoodColor, darkWoodColor, r);\nr = abs(czm_snoise(vec2(st.x * grainFrequency, st.y * grainFrequency * 0.02))) * 0.2;\ncolor.rgb += lightWoodColor.rgb * r;\nmaterial.diffuse = color.rgb;\nmaterial.alpha = color.a;\nreturn material;\n}\n" }), r("Shaders/Materials/RimLightingMaterial", [], function() { "use strict"; return "uniform vec4 color;\nuniform vec4 rimColor;\nuniform float width;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nfloat d = 1.0 - dot(materialInput.normalEC, normalize(materialInput.positionToEyeEC));\nfloat s = smoothstep(1.0 - width, 1.0, d);\nmaterial.diffuse = color.rgb;\nmaterial.emission = rimColor.rgb * s;\nmaterial.alpha = mix(color.a, rimColor.a, s);\nreturn material;\n}\n" }), r("Shaders/Materials/ErosionMaterial", [], function() { "use strict"; return "uniform vec4 color;\nuniform float time;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nfloat alpha = 1.0;\nif (time != 1.0)\n{\nfloat t = 0.5 + (0.5 * czm_snoise(materialInput.str / (1.0 / 10.0)));\nif (t > time)\n{\nalpha = 0.0;\n}\n}\nmaterial.diffuse = color.rgb;\nmaterial.alpha = color.a * alpha;\nreturn material;\n}\n" }), r("Shaders/Materials/FadeMaterial", [], function() {
  3877. "use strict";
  3878. return "uniform vec4 fadeInColor;\nuniform vec4 fadeOutColor;\nuniform float maximumDistance;\nuniform bool repeat;\nuniform vec2 fadeDirection;\nuniform vec2 time;\nfloat getTime(float t, float coord)\n{\nfloat scalar = 1.0 / maximumDistance;\nfloat q = distance(t, coord) * scalar;\nif (repeat)\n{\nfloat r = distance(t, coord + 1.0) * scalar;\nfloat s = distance(t, coord - 1.0) * scalar;\nq = min(min(r, s), q);\n}\nreturn clamp(q, 0.0, 1.0);\n}\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nvec2 st = materialInput.st;\nfloat s = getTime(time.x, st.s) * fadeDirection.s;\nfloat t = getTime(time.y, st.t) * fadeDirection.t;\nfloat u = length(vec2(s, t));\nvec4 color = mix(fadeInColor, fadeOutColor, u);\nmaterial.emission = color.rgb;\nmaterial.alpha = color.a;\nreturn material;\n}\n"
  3879. }), r("Shaders/Materials/PolylineArrowMaterial", [], function() { "use strict"; return "#extension GL_OES_standard_derivatives : enable\nuniform vec4 color;\nvarying float v_width;\nfloat getPointOnLine(vec2 p0, vec2 p1, float x)\n{\nfloat slope = (p0.y - p1.y) / (p0.x - p1.x);\nreturn slope * (x - p0.x) + p0.y;\n}\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nvec2 st = materialInput.st;\nfloat base = 1.0 - abs(fwidth(st.s)) * 10.0;\nvec2 center = vec2(1.0, 0.5);\nfloat ptOnUpperLine = getPointOnLine(vec2(base, 1.0), center, st.s);\nfloat ptOnLowerLine = getPointOnLine(vec2(base, 0.0), center, st.s);\nfloat halfWidth = 0.15;\nfloat s = step(0.5 - halfWidth, st.t);\ns *= 1.0 - step(0.5 + halfWidth, st.t);\ns *= 1.0 - step(base, st.s);\nfloat t = step(base, materialInput.st.s);\nt *= 1.0 - step(ptOnUpperLine, st.t);\nt *= step(ptOnLowerLine, st.t);\nfloat dist;\nif (st.s < base)\n{\nfloat d1 = abs(st.t - (0.5 - halfWidth));\nfloat d2 = abs(st.t - (0.5 + halfWidth));\ndist = min(d1, d2);\n}\nelse\n{\nfloat d1 = czm_infinity;\nif (st.t < 0.5 - halfWidth && st.t > 0.5 + halfWidth)\n{\nd1 = abs(st.s - base);\n}\nfloat d2 = abs(st.t - ptOnUpperLine);\nfloat d3 = abs(st.t - ptOnLowerLine);\ndist = min(min(d1, d2), d3);\n}\nvec4 outsideColor = vec4(0.0);\nvec4 currentColor = mix(outsideColor, color, clamp(s + t, 0.0, 1.0));\nvec4 outColor = czm_antialias(outsideColor, color, currentColor, dist);\nmaterial.diffuse = outColor.rgb;\nmaterial.alpha = outColor.a;\nreturn material;\n}\n" }), r("Shaders/Materials/PolylineGlowMaterial", [], function() { "use strict"; return "uniform vec4 color;\nuniform float glowPower;\nvarying float v_width;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nvec2 st = materialInput.st;\nfloat glow = glowPower / abs(st.t - 0.5);\nmaterial.emission = max(vec3(glow - 1.0 + color.rgb), color.rgb);\nmaterial.alpha = clamp(0.0, 1.0, glow) * color.a;\nreturn material;\n}\n" }), r("Shaders/Materials/PolylineOutlineMaterial", [], function() { "use strict"; return "uniform vec4 color;\nuniform vec4 outlineColor;\nuniform float outlineWidth;\nvarying float v_width;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nvec2 st = materialInput.st;\nfloat halfInteriorWidth = 0.5 * (v_width - outlineWidth) / v_width;\nfloat b = step(0.5 - halfInteriorWidth, st.t);\nb *= 1.0 - step(0.5 + halfInteriorWidth, st.t);\nfloat d1 = abs(st.t - (0.5 - halfInteriorWidth));\nfloat d2 = abs(st.t - (0.5 + halfInteriorWidth));\nfloat dist = min(d1, d2);\nvec4 currentColor = mix(outlineColor, color, b);\nvec4 outColor = czm_antialias(outlineColor, color, currentColor, dist);\nmaterial.diffuse = outColor.rgb;\nmaterial.alpha = outColor.a;\nreturn material;\n}\n" }), r("Scene/Material", ["../ThirdParty/when", "../Core/loadImage", "../Core/DeveloperError", "../Core/createGuid", "../Core/clone", "../Core/Color", "../Core/combine", "../Core/defaultValue", "../Core/defined", "../Core/destroyObject", "../Core/Cartesian2", "../Core/Matrix2", "../Core/Matrix3", "../Core/Matrix4", "../Renderer/Texture", "../Renderer/CubeMap", "../Shaders/Materials/AsphaltMaterial", "../Shaders/Materials/BlobMaterial", "../Shaders/Materials/BrickMaterial", "../Shaders/Materials/BumpMapMaterial", "../Shaders/Materials/CementMaterial", "../Shaders/Materials/CheckerboardMaterial", "../Shaders/Materials/DotMaterial", "../Shaders/Materials/FacetMaterial", "../Shaders/Materials/FresnelMaterial", "../Shaders/Materials/GrassMaterial", "../Shaders/Materials/GridMaterial", "../Shaders/Materials/NormalMapMaterial", "../Shaders/Materials/ReflectionMaterial", "../Shaders/Materials/RefractionMaterial", "../Shaders/Materials/StripeMaterial", "../Shaders/Materials/TieDyeMaterial", "../Shaders/Materials/Water", "../Shaders/Materials/WoodMaterial", "../Shaders/Materials/RimLightingMaterial", "../Shaders/Materials/ErosionMaterial", "../Shaders/Materials/FadeMaterial", "../Shaders/Materials/PolylineArrowMaterial", "../Shaders/Materials/PolylineGlowMaterial", "../Shaders/Materials/PolylineOutlineMaterial"], function(e, t, r, i, n, o, a, s, l, u, c, h, d, m, p, f, v, y, g, _, w, C, x, S, E, b, T, A, M, P, D, I, O, R, L, z, N, F, B, V) { "use strict";
  3880. function q(e, t) { e = s(e, s.EMPTY_OBJECT), t._context = e.context, t._strict = s(e.strict, !1), t._count = s(e.count, 0), t._template = n(s(e.fabric, s.EMPTY_OBJECT)), t._template.uniforms = n(s(t._template.uniforms, s.EMPTY_OBJECT)), t._template.materials = n(s(t._template.materials, s.EMPTY_OBJECT)), t.type = l(t._template.type) ? t._template.type : i(), t.shaderSource = "", t.materials = {}, t.uniforms = {}, t._uniforms = {}; var r = $._materialCache.getMaterial(t.type); if (l(r)) { var o = n(r, !0);
  3881. t._template = a([t._template, o]) } G(t), l(r) || $._materialCache.addMaterial(t.type, t._template), H(t), j(t), K(t) }
  3882. function k(e, t, r, i) { if (l(e))
  3883. for (var n in e)
  3884. if (e.hasOwnProperty(n)) { var o = -1 !== t.indexOf(n);
  3885. (i && !o || !i && o) && r(n, t) } }
  3886. function U(e, t) { for (var i = "fabric: property name '" + e + "' is not valid. It should be ", n = 0; n < t.length; n++) { var o = "'" + t[n] + "'";
  3887. i += n === t.length - 1 ? "or " + o + "." : o + ", " } throw new r(i) }
  3888. function W(e) { var t = "fabric: uniforms and materials cannot share the same property '" + e + "'"; throw new r(t) }
  3889. function G(e) { var t = e._template,
  3890. i = t.uniforms,
  3891. n = t.materials,
  3892. o = t.components; if (l(o) && l(t.source)) throw new r("fabric: cannot have source and components in the same template.");
  3893. k(t, et, U, !0), k(o, tt, U, !0); var a = []; for (var s in n) n.hasOwnProperty(s) && a.push(s);
  3894. k(i, a, W, !1) }
  3895. function H(e) { var t = e._template.components,
  3896. r = e._template.source; if (l(r)) e.shaderSource += r + "\n";
  3897. else { if (e.shaderSource += "czm_material czm_getMaterial(czm_materialInput materialInput)\n{\n", e.shaderSource += "czm_material material = czm_getDefaultMaterial(materialInput);\n", l(t))
  3898. for (var i in t) t.hasOwnProperty(i) && (e.shaderSource += "material." + i + " = " + t[i] + ";\n");
  3899. e.shaderSource += "return material;\n}\n" } }
  3900. function j(e) { var t = e._template.uniforms; for (var r in t) t.hasOwnProperty(r) && Y(e, r) }
  3901. function Y(e, t) { var i = e._strict,
  3902. n = e._template.uniforms,
  3903. o = n[t],
  3904. a = Z(o); if (!l(a)) throw new r("fabric: uniform '" + t + "' has invalid type."); if ("channels" === a) { if (0 === J(e, t, o, !1) && i) throw new r("strict: shader source does not use channels '" + t + "'.") } else { if (-1 !== a.indexOf("sampler") && !l(e._context)) throw new r("image: context is not defined"); if ("sampler2D" === a) { var s = t + "Dimensions";
  3905. Q(e, s) > 0 && (n[s] = { type: "ivec3", x: 1, y: 1 }, Y(e, s)) } var u = "uniform " + a + " " + t + ";\n"; - 1 === e.shaderSource.indexOf(u) && (e.shaderSource = u + e.shaderSource); var c = t + "_" + e._count++; if (1 === J(e, t, c) && i) throw new r("strict: shader source does not use uniform '" + t + "'.");
  3906. e.uniforms[t] = o, e._uniforms[c] = X(e, t, a) } }
  3907. function X(e, t, i) { return function() { var n = e.uniforms,
  3908. o = n[t],
  3909. a = Z(o); if ("sampler2D" === i && (a === i || o instanceof p)) { a === i && (o = $._textureCache.registerTexture2DToMaterial(e, t, o)); var s = t + "Dimensions"; if (n.hasOwnProperty(s)) { var u = n[s];
  3910. u.x = o._width, u.y = o._height } } else if ("samplerCube" === i && (a === i || o instanceof f)) a === i && (o = $._textureCache.registerCubeMapToMaterial(e, t, o));
  3911. else if (-1 !== i.indexOf("mat") && (a === i || o instanceof rt[i])) a === i && (o = rt[i].fromColumnMajorArray(o));
  3912. else if (!l(a) || i !== a) throw new r("fabric: uniform '" + t + "' has invalid value."); return n[t] = o, n[t] } }
  3913. function Z(e) { var t = e.type; if (!l(t)) { var r = typeof e; if ("number" === r) t = "float";
  3914. else if ("boolean" === r) t = "bool";
  3915. else if ("string" === r) t = /^([rgba]){1,4}$/i.test(e) ? "channels" : e === $.DefaultCubeMapId ? "samplerCube" : "sampler2D";
  3916. else if ("object" === r)
  3917. if (Array.isArray(e))(4 === e.length || 9 === e.length || 16 === e.length) && (t = "mat" + Math.sqrt(e.length));
  3918. else { var i = 0; for (var n in e) e.hasOwnProperty(n) && (i += 1);
  3919. i >= 2 && 4 >= i ? t = "vec" + i : 6 === i && (t = "samplerCube") } } return t }
  3920. function K(e) { var t = e._context,
  3921. i = e._strict,
  3922. n = e._template.materials; for (var o in n)
  3923. if (n.hasOwnProperty(o)) { var s = new $({ context: t, strict: i, fabric: n[o], count: e._count });
  3924. e._count = s._count, e._uniforms = a([e._uniforms, s._uniforms]), e.materials[o] = s; var l = "czm_getMaterial",
  3925. u = l + "_" + e._count++;
  3926. J(s, l, u), e.shaderSource = s.shaderSource + e.shaderSource; var c = u + "(materialInput)"; if (0 === J(e, o, c) && i) throw new r("strict: shader source does not use material '" + o + "'.") } }
  3927. function J(e, t, r, i) { i = s(i, !0); var n = 0,
  3928. o = "a-zA-Z0-9_",
  3929. a = "([" + o + "])?",
  3930. l = "([" + o + (i ? "." : "") + "])?",
  3931. u = new RegExp(l + t + a, "g"); return e.shaderSource = e.shaderSource.replace(u, function(e, t, i) { return t || i ? e : (n += 1, r) }), n }
  3932. function Q(e, t, r) { return J(e, t, t, r) } var $ = function(e) { this.type = void 0, this.shaderSource = void 0, this.materials = void 0, this.uniforms = void 0, this._uniforms = void 0, this._context = void 0, this._strict = void 0, this._template = void 0, this._count = void 0, q(e, this), Object.defineProperty(this, "type", { value: this.type, writable: !1 }), l($._uniformList[this.type]) || ($._uniformList[this.type] = Object.keys(this._uniforms)) };
  3933. $._uniformList = {}, $.fromType = function(e, t) { if (!l($._materialCache.getMaterial(t))) throw new r("material with type '" + t + "' does not exist."); return new $({ context: e, fabric: { type: t } }) }, $.prototype.isDestroyed = function() { return !1 }, $.prototype.destroy = function() { var e = this.materials,
  3934. t = this.uniforms; for (var r in t)
  3935. if (t.hasOwnProperty(r)) { var i = t[r];
  3936. (i instanceof p || i instanceof f) && $._textureCache.releaseTexture(this, i) }
  3937. for (var n in e) e.hasOwnProperty(n) && e[n].destroy(); return u(this) }; var et = ["type", "materials", "uniforms", "components", "source"],
  3938. tt = ["diffuse", "specular", "shininess", "normal", "emission", "alpha"],
  3939. rt = { mat2: h, mat3: d, mat4: m }; return $._textureCache = { _pathsToMaterials: {}, _pathsToTextures: {}, _updateMaterialsOnLoad: function(e, t) { this._pathsToTextures[t] = e; for (var r = this._pathsToMaterials[t], i = 0; i < r.length; i++) { var n = r[i],
  3940. o = n.material,
  3941. a = n.property;
  3942. this.releaseTexture(o, o.uniforms[a]), o.uniforms[a] = e } }, releaseTexture: function(e, t) { var r = this._pathsToTextures; for (var i in r)
  3943. if (r[i] === t)
  3944. for (var n = this._pathsToMaterials[i], o = 0; o < n.length; o++)
  3945. if (n[o].material === e) { n.splice(o, 1); var a = n.length;
  3946. 0 === a && (t.destroy(), delete r.path, delete n.path) } }, registerCubeMapToMaterial: function(r, i, n) { var o, a = this; if (n === $.DefaultCubeMapId) o = r._context.getDefaultCubeMap();
  3947. else { var u = n.positiveX + n.negativeX + n.positiveY + n.negativeY + n.positiveZ + n.negativeZ; if (this._pathsToMaterials[u] = s(this._pathsToMaterials[u], []), this._pathsToMaterials[u].push({ material: r, property: i }), o = this._pathsToTextures[u], !l(o)) { var c = r.uniforms[i],
  3948. h = c instanceof f;
  3949. o = h ? c : r._context.getDefaultCubeMap(), 1 === this._pathsToMaterials[u].length && e.all([t(n.positiveX), t(n.negativeX), t(n.positiveY), t(n.negativeY), t(n.positiveZ), t(n.negativeZ)]).then(function(e) { o = r._context.createCubeMap({ source: { positiveX: e[0], negativeX: e[1], positiveY: e[2], negativeY: e[3], positiveZ: e[4], negativeZ: e[5] } }), a._updateMaterialsOnLoad(o, u) }) } } return o }, registerTexture2DToMaterial: function(r, i, n) { var o, a = this; if (n === $.DefaultImageId) o = r._context.getDefaultTexture();
  3950. else { var u = n; if (this._pathsToMaterials[u] = s(this._pathsToMaterials[u], []), this._pathsToMaterials[u].push({ material: r, property: i }), o = this._pathsToTextures[u], !l(o)) { var c = r.uniforms[i],
  3951. h = c instanceof p;
  3952. o = h ? c : r._context.getDefaultTexture(), 1 === this._pathsToMaterials[u].length && e(t(u), function(e) { o = r._context.createTexture2D({ source: e }), a._updateMaterialsOnLoad(o, u) }) } } return o } }, $._materialCache = { _materials: {}, addMaterial: function(e, t) { this._materials[e] = t }, getMaterial: function(e) { return this._materials[e] } }, $.DefaultImageId = "czm_defaultImage", $.DefaultCubeMapId = "czm_defaultCubeMap", $.ColorType = "Color", $._materialCache.addMaterial($.ColorType, { type: $.ColorType, uniforms: { color: new o(1, 0, 0, .5) }, components: { diffuse: "color.rgb", alpha: "color.a" } }), $.ImageType = "Image", $._materialCache.addMaterial($.ImageType, { type: $.ImageType, uniforms: { image: $.DefaultImageId, repeat: new c(1, 1) }, components: { diffuse: "texture2D(image, fract(repeat * materialInput.st)).rgb", alpha: "texture2D(image, fract(repeat * materialInput.st)).a" } }), $.DiffuseMapType = "DiffuseMap", $._materialCache.addMaterial($.DiffuseMapType, { type: $.DiffuseMapType, uniforms: { image: $.DefaultImageId, channels: "rgb", repeat: new c(1, 1) }, components: { diffuse: "texture2D(image, fract(repeat * materialInput.st)).channels" } }), $.AlphaMapType = "AlphaMap", $._materialCache.addMaterial($.AlphaMapType, { type: $.AlphaMapType, uniforms: { image: $.DefaultImageId, channel: "a", repeat: new c(1, 1) }, components: { alpha: "texture2D(image, fract(repeat * materialInput.st)).channel" } }), $.SpecularMapType = "SpecularMap", $._materialCache.addMaterial($.SpecularMapType, { type: $.SpecularMapType, uniforms: { image: $.DefaultImageId, channel: "r", repeat: new c(1, 1) }, components: { specular: "texture2D(image, fract(repeat * materialInput.st)).channel" } }), $.EmissionMapType = "EmissionMap", $._materialCache.addMaterial($.EmissionMapType, { type: $.EmissionMapType, uniforms: { image: $.DefaultImageId, channels: "rgb", repeat: new c(1, 1) }, components: { emission: "texture2D(image, fract(repeat * materialInput.st)).channels" } }), $.BumpMapType = "BumpMap", $._materialCache.addMaterial($.BumpMapType, { type: $.BumpMapType, uniforms: { image: $.DefaultImageId, channel: "r", strength: .8, repeat: new c(1, 1) }, source: _ }), $.NormalMapType = "NormalMap", $._materialCache.addMaterial($.NormalMapType, { type: $.NormalMapType, uniforms: { image: $.DefaultImageId, channels: "rgb", strength: .8, repeat: new c(1, 1) }, source: A }), $.ReflectionType = "Reflection", $._materialCache.addMaterial($.ReflectionType, { type: $.ReflectionType, uniforms: { cubeMap: $.DefaultCubeMapId, channels: "rgb" }, source: M }), $.RefractionType = "Refraction", $._materialCache.addMaterial($.RefractionType, { type: $.RefractionType, uniforms: { cubeMap: $.DefaultCubeMapId, channels: "rgb", indexOfRefractionRatio: .9 }, source: P }), $.FresnelType = "Fresnel", $._materialCache.addMaterial($.FresnelType, { type: $.FresnelType, materials: { reflection: { type: $.ReflectionType }, refraction: { type: $.RefractionType } }, source: E }), $.BrickType = "Brick", $._materialCache.addMaterial($.BrickType, { type: $.BrickType, uniforms: { brickColor: new o(.6, .3, .1, 1), mortarColor: new o(.8, .8, .7, 1), brickSize: new c(.3, .15), brickPct: new c(.9, .85), brickRoughness: .2, mortarRoughness: .1 }, source: g }), $.WoodType = "Wood", $._materialCache.addMaterial($.WoodType, { type: $.WoodType, uniforms: { lightWoodColor: new o(.6, .3, .1, 1), darkWoodColor: new o(.4, .2, .07, 1), ringFrequency: 3, noiseScale: new c(.7, .5), grainFrequency: 27 }, source: R }), $.AsphaltType = "Asphalt", $._materialCache.addMaterial($.AsphaltType, { type: $.AsphaltType, uniforms: { asphaltColor: new o(.15, .15, .15, 1), bumpSize: .02, roughness: .2 }, source: v }), $.CementType = "Cement", $._materialCache.addMaterial($.CementType, { type: $.CementType, uniforms: { cementColor: new o(.95, .95, .85, 1), grainScale: .01, roughness: .3 }, source: w }), $.GrassType = "Grass", $._materialCache.addMaterial($.GrassType, { type: $.GrassType, uniforms: { grassColor: new o(.25, .4, .1, 1), dirtColor: new o(.1, .1, .1, 1), patchiness: 1.5 }, source: b }), $.GridType = "Grid", $._materialCache.addMaterial($.GridType, { type: $.GridType, uniforms: { color: new o(0, 1, 0, 1), cellAlpha: .1, lineCount: new c(8, 8), lineThickness: new c(1, 1) }, source: T }), $.StripeType = "Stripe", $._materialCache.addMaterial($.StripeType, { type: $.StripeType, uniforms: { horizontal: !0, lightColor: new o(1, 1, 1, .5), darkColor: new o(0, 0, 1, .5), offset: 0, repeat: 5 }, source: D }), $.CheckerboardType = "Checkerboard", $._materialCache.addMaterial($.CheckerboardType, { type: $.CheckerboardType, uniforms: { lightColor: new o(1, 1, 1, .5), darkColor: new o(0, 0, 0, .5), repeat: new c(5, 5) }, source: C }), $.DotType = "Dot", $._materialCache.addMaterial($.DotType, { type: $.DotType, uniforms: { lightColor: new o(1, 1, 0, .75), darkColor: new o(0, 1, 1, .75), repeat: new c(5, 5) }, source: x }), $.TyeDyeType = "TieDye", $._materialCache.addMaterial($.TyeDyeType, { type: $.TyeDyeType, uniforms: { lightColor: new o(1, 1, 0, .75), darkColor: new o(1, 0, 0, .75), frequency: 5 }, source: I }), $.FacetType = "Facet", $._materialCache.addMaterial($.FacetType, { type: $.FacetType, uniforms: { lightColor: new o(.25, .25, .25, .75), darkColor: new o(.75, .75, .75, .75), frequency: 10 }, source: S }), $.BlobType = "Blob", $._materialCache.addMaterial($.BlobType, { type: $.BlobType, uniforms: { lightColor: new o(1, 1, 1, .5), darkColor: new o(0, 0, 1, .5), frequency: 10 }, source: y }), $.WaterType = "Water", $._materialCache.addMaterial($.WaterType, { type: $.WaterType, uniforms: { baseWaterColor: { red: .2, green: .3, blue: .6, alpha: 1 }, blendColor: { red: 0, green: 1, blue: .699, alpha: 1 }, specularMap: $.DefaultImageId, normalMap: $.DefaultImageId, frequency: 10, animationSpeed: .01, amplitude: 1, specularIntensity: .5, fadeFactor: 1 }, source: O }), $.RimLightingType = "RimLighting", $._materialCache.addMaterial($.RimLightingType, { type: $.RimLightingType, uniforms: { color: new o(1, 0, 0, .7), rimColor: new o(1, 1, 1, .4), width: .3 }, source: L }), $.ErosionType = "Erosion", $._materialCache.addMaterial($.ErosionType, { type: $.ErosionType, uniforms: { color: new o(1, 0, 0, .5), time: 1 }, source: z }), $.FadeType = "Fade", $._materialCache.addMaterial($.FadeType, { type: $.FadeType, uniforms: { fadeInColor: new o(1, 0, 0, 1), fadeOutColor: new o(0, 0, 0, 0), maximumDistance: .5, repeat: !0, fadeDirection: { x: !0, y: !0 }, time: new c(.5, .5) }, source: N }), $.PolylineArrowType = "PolylineArrow", $._materialCache.addMaterial($.PolylineArrowType, { type: $.PolylineArrowType, uniforms: { color: new o(1, 1, 1, 1) }, source: F }), $.PolylineGlowType = "PolylineGlow", $._materialCache.addMaterial($.PolylineGlowType, { type: $.PolylineGlowType, uniforms: { color: new o(0, .5, 1, 1), glowPower: .1 }, source: B }), $.PolylineOutlineType = "PolylineOutline", $._materialCache.addMaterial($.PolylineOutlineType, { type: $.PolylineOutlineType, uniforms: { color: new o(1, 1, 1, 1), outlineColor: new o(1, 0, 0, 1), outlineWidth: 1 }, source: V }), $ }), r("Shaders/EllipsoidVS", [], function() { "use strict"; return "attribute vec3 position;\nuniform vec3 u_radii;\nvarying vec3 v_positionEC;\nvoid main()\n{\nvec4 p = vec4(u_radii * position, 1.0);\nv_positionEC = (czm_modelView * p).xyz;\ngl_Position = czm_modelViewProjection * p;\ngl_Position.z = clamp(gl_Position.z, gl_DepthRange.near, gl_DepthRange.far);\n}\n" }), r("Shaders/EllipsoidFS", [], function() { "use strict"; return "uniform vec3 u_radii;\nuniform vec3 u_oneOverEllipsoidRadiiSquared;\nvarying vec3 v_positionEC;\nvec4 computeEllipsoidColor(czm_ray ray, float intersection, float side)\n{\nvec3 positionEC = czm_pointAlongRay(ray, intersection);\nvec3 positionMC = (czm_inverseModelView * vec4(positionEC, 1.0)).xyz;\nvec3 geodeticNormal = normalize(czm_geodeticSurfaceNormal(positionMC, vec3(0.0), u_oneOverEllipsoidRadiiSquared));\nvec3 sphericalNormal = normalize(positionMC / u_radii);\nvec3 normalMC = geodeticNormal * side;\nvec3 normalEC = normalize(czm_normal * normalMC);\nvec2 st = czm_ellipsoidWgs84TextureCoordinates(sphericalNormal);\nvec3 positionToEyeEC = -positionEC;\nczm_materialInput materialInput;\nmaterialInput.s = st.s;\nmaterialInput.st = st;\nmaterialInput.str = (positionMC + u_radii) / u_radii;\nmaterialInput.normalEC = normalEC;\nmaterialInput.tangentToEyeMatrix = czm_eastNorthUpToEyeCoordinates(positionMC, normalEC);\nmaterialInput.positionToEyeEC = positionToEyeEC;\nczm_material material = czm_getMaterial(materialInput);\nreturn czm_phong(normalize(positionToEyeEC), material);\n}\nvoid main()\n{\nfloat maxRadius = max(u_radii.x, max(u_radii.y, u_radii.z)) * 1.5;\nvec3 direction = normalize(v_positionEC);\nvec3 ellipsoidCenter = czm_modelView[3].xyz;\nfloat t1 = -1.0;\nfloat t2 = -1.0;\nfloat b = -2.0 * dot(direction, ellipsoidCenter);\nfloat c = dot(ellipsoidCenter, ellipsoidCenter) - maxRadius * maxRadius;\nfloat discriminant = b * b - 4.0 * c;\nif (discriminant >= 0.0) {\nt1 = (-b - sqrt(discriminant)) * 0.5;\nt2 = (-b + sqrt(discriminant)) * 0.5;\n}\nif (t1 < 0.0 && t2 < 0.0) {\ndiscard;\n}\nfloat t = min(t1, t2);\nif (t < 0.0) {\nt = 0.0;\n}\nczm_ellipsoid ellipsoid = czm_ellipsoidNew(ellipsoidCenter, u_radii);\nczm_ray ray = czm_ray(t * direction, direction);\nczm_raySegment intersection = czm_rayEllipsoidIntersectionInterval(ray, ellipsoid);\nif (czm_isEmpty(intersection))\n{\ndiscard;\n}\nvec4 outsideFaceColor = (intersection.start != 0.0) ? computeEllipsoidColor(ray, intersection.start, 1.0) : vec4(0.0);\nvec4 insideFaceColor = (outsideFaceColor.a < 1.0) ? computeEllipsoidColor(ray, intersection.stop, -1.0) : vec4(0.0);\ngl_FragColor = mix(insideFaceColor, outsideFaceColor, outsideFaceColor.a);\ngl_FragColor.a = 1.0 - (1.0 - insideFaceColor.a) * (1.0 - outsideFaceColor.a);\n}\n" }), r("Scene/EllipsoidPrimitive", ["../Core/BoxGeometry", "../Core/Cartesian3", "../Core/Cartesian4", "../Core/combine", "../Core/defined", "../Core/DeveloperError", "../Core/destroyObject", "../Core/Matrix4", "../Core/BoundingSphere", "../Core/PrimitiveType", "../Renderer/CullFace", "../Renderer/BlendingState", "../Renderer/BufferUsage", "../Renderer/CommandLists", "../Renderer/DrawCommand", "../Renderer/createShaderSource", "./Material", "./SceneMode", "../Shaders/EllipsoidVS", "../Shaders/EllipsoidFS"], function(e, t, r, i, n, o, a, s, l, u, c, h, d, m, p, f, v, y, g, _) { "use strict";
  3953. function w(r) { var i = r.cache.ellipsoidPrimitive_vertexArray; if (n(i)) return i; var o = e.createGeometry(e.fromDimensions({ dimensions: new t(2, 2, 2) })); return i = r.createVertexArrayFromGeometry({ geometry: o, attributeIndices: C, bufferUsage: d.STATIC_DRAW }), r.cache.ellipsoidPrimitive_vertexArray = i, i } var C = { position: 0 },
  3954. x = function() { this.center = t.ZERO.clone(), this.radii = void 0, this._radii = new t, this._oneOverEllipsoidRadiiSquared = new t, this._boundingSphere = new l, this.modelMatrix = s.IDENTITY.clone(), this._computedModelMatrix = s.IDENTITY.clone(), this.show = !0, this.material = v.fromType(void 0, v.ColorType), this._material = void 0, this._sp = void 0, this._rs = void 0, this._va = void 0, this._pickSP = void 0, this._pickId = void 0, this._colorCommand = new p, this._colorCommand.owner = this, this._pickCommand = new p, this._pickCommand.owner = this, this._commandLists = new m; var e = this;
  3955. this._uniforms = { u_radii: function() { return e.radii }, u_oneOverEllipsoidRadiiSquared: function() { return e._oneOverEllipsoidRadiiSquared } }, this._pickUniforms = { czm_pickColor: function() { return e._pickId.color } } }; return x.prototype.update = function(e, r, a) { if (this.show && r.mode === y.SCENE3D && n(this.center) && n(this.radii)) { if (!n(this.material)) throw new o("this.material must be defined.");
  3956. n(this._rs) || (this._rs = e.createRenderState({ cull: { enabled: !0, face: c.FRONT }, depthTest: { enabled: !0 }, depthMask: !1, blending: h.ALPHA_BLEND })), n(this._va) || (this._va = w(e)); var l = this.radii; if (!t.equals(this._radii, l)) { t.clone(l, this._radii); var d = this._oneOverEllipsoidRadiiSquared;
  3957. d.x = 1 / (l.x * l.x), d.y = 1 / (l.y * l.y), d.z = 1 / (l.z * l.z), this._boundingSphere.radius = t.getMaximumComponent(l) } s.multiplyByTranslation(this.modelMatrix, this.center, this._computedModelMatrix); var m = this._commandLists;
  3958. m.removeAll(); var p = this._material !== this.material; if (this._material = this.material, r.passes.color) { var v = this._colorCommand; if (p) { var x = f({ sources: [this.material.shaderSource, _] });
  3959. this._sp = e.getShaderCache().replaceShaderProgram(this._sp, g, x, C), v.primitiveType = u.TRIANGLES, v.vertexArray = this._va, v.renderState = this._rs, v.shaderProgram = this._sp, v.uniformMap = i([this._uniforms, this.material._uniforms], !1, !1), v.executeInClosestFrustum = !0 } v.boundingVolume = this._boundingSphere, v.modelMatrix = this._computedModelMatrix, m.colorList.push(v) } if (r.passes.pick) { var S = this._pickCommand; if (n(this._pickId) || (this._pickId = e.createPickId(this)), p || !n(this._pickSP)) { var E = f({ sources: [this.material.shaderSource, _], pickColorQualifier: "uniform" });
  3960. this._pickSP = e.getShaderCache().replaceShaderProgram(this._pickSP, g, E, C), S.primitiveType = u.TRIANGLES, S.vertexArray = this._va, S.renderState = this._rs, S.shaderProgram = this._pickSP, S.uniformMap = i([this._uniforms, this._pickUniforms, this.material._uniforms], !1, !1), S.executeInClosestFrustum = !0 } S.boundingVolume = this._boundingSphere, S.modelMatrix = this._computedModelMatrix, m.pickList.push(S) } a.push(m) } }, x.prototype.isDestroyed = function() { return !1 }, x.prototype.destroy = function() { return this._sp = this._sp && this._sp.release(), this._pickSP = this._pickSP && this._pickSP.release(), this._pickId = this._pickId && this._pickId.destroy(), a(this) }, x }), r("DynamicScene/MaterialProperty", ["../Core/defined", "../Core/DeveloperError", "../Scene/Material"], function(e, t, r) { "use strict";
  3961. function i() { throw new t("This type should not be instantiated directly.") } var n = i; return n.prototype.getType = i, n.prototype.getValue = i, n.getValue = function(t, i, n, o) { if (e(n)) { var a = n.getType(t);
  3962. e(o) && o.type === a || (o = r.fromType(i, a)), n.getValue(t, o.uniforms) } return o }, n }), r("DynamicScene/DynamicEllipsoidVisualizer", ["../Core/defaultValue", "../Core/defined", "../Core/DeveloperError", "../Core/destroyObject", "../Core/Matrix3", "../Core/Matrix4", "../Scene/EllipsoidPrimitive", "../Scene/Material", "./MaterialProperty"], function(e, t, r, i, n, o, a, s, l) { "use strict";
  3963. function u(r, i, u) { var h = r._scene.getContext(),
  3964. p = u.ellipsoid; if (t(p)) { var f = p.radii; if (t(f)) { var v = u.position; if (t(v)) { var y = u.orientation; if (t(y)) { var g, _ = p.show,
  3965. w = u._ellipsoidVisualizerIndex,
  3966. C = u.isAvailable(i) && (!t(_) || _.getValue(i)); if (!C) return t(w) && (g = r._ellipsoidCollection[w], g.show = !1, u._ellipsoidVisualizerIndex = void 0, r._unusedIndexes.push(w)), void 0; if (t(w)) g = r._ellipsoidCollection[w];
  3967. else { var x = r._unusedIndexes,
  3968. S = x.length;
  3969. S > 0 ? (w = x.pop(), g = r._ellipsoidCollection[w]) : (w = r._ellipsoidCollection.length, g = new a, r._ellipsoidCollection.push(g), r._primitives.add(g)), u._ellipsoidVisualizerIndex = w, g.dynamicObject = u, g.material = s.fromType(h, s.ColorType) } g.show = !0, g.radii = f.getValue(i, g.radii), d = e(v.getValue(i, d), g._visualizerPosition), m = e(y.getValue(i, m), g._visualizerOrientation), !t(d) || !t(m) || d.equals(g._visualizerPosition) && m.equals(g._visualizerOrientation) || (o.fromRotationTranslation(n.fromQuaternion(m, c), d, g.modelMatrix), g._visualizerPosition = d.clone(g._visualizerPosition), g._visualizerOrientation = m.clone(g._visualizerOrientation)), g.material = l.getValue(i, h, p.material, g.material) } } } } } var c = new n,
  3970. h = function(e, i) { if (!t(e)) throw new r("scene is required.");
  3971. this._scene = e, this._unusedIndexes = [], this._primitives = e.getPrimitives(), this._ellipsoidCollection = [], this._dynamicObjectCollection = void 0, this.setDynamicObjectCollection(i) };
  3972. h.prototype.getScene = function() { return this._scene }, h.prototype.getDynamicObjectCollection = function() { return this._dynamicObjectCollection }, h.prototype.setDynamicObjectCollection = function(e) { var r = this._dynamicObjectCollection;
  3973. r !== e && (t(r) && (r.objectsRemoved.removeEventListener(h.prototype._onObjectsRemoved, this), this.removeAllPrimitives()), this._dynamicObjectCollection = e, t(e) && e.objectsRemoved.addEventListener(h.prototype._onObjectsRemoved, this)) }, h.prototype.update = function(e) { if (!t(e)) throw new r("time is requied."); if (t(this._dynamicObjectCollection))
  3974. for (var i = this._dynamicObjectCollection.getObjects(), n = 0, o = i.length; o > n; n++) u(this, e, i[n]) }, h.prototype.removeAllPrimitives = function() { var e, r; for (e = 0, r = this._ellipsoidCollection.length; r > e; e++) this._primitives.remove(this._ellipsoidCollection[e]); if (t(this._dynamicObjectCollection)) { var i = this._dynamicObjectCollection.getObjects(); for (e = i.length - 1; e > -1; e--) i[e]._ellipsoidVisualizerIndex = void 0 } this._unusedIndexes = [], this._ellipsoidCollection = [] }, h.prototype.isDestroyed = function() { return !1 }, h.prototype.destroy = function() { return this.removeAllPrimitives(), i(this) }; var d, m; return h.prototype._onObjectsRemoved = function(e, r) { for (var i = this._ellipsoidCollection, n = this._unusedIndexes, o = r.length - 1; o > -1; o--) { var a = r[o],
  3975. s = a._ellipsoidVisualizerIndex; if (t(s)) { var l = i[s];
  3976. l.show = !1, n.push(s), a._ellipsoidVisualizerIndex = void 0 } } }, h }), r("Shaders/SensorVolume", [], function() { "use strict"; return "uniform vec4 u_intersectionColor;\nuniform float u_intersectionWidth;\nbool inSensorShadow(vec3 coneVertexWC, czm_ellipsoid ellipsoidEC, vec3 pointWC)\n{\nvec3 D = ellipsoidEC.inverseRadii;\nvec3 q = D * coneVertexWC;\nfloat qMagnitudeSquared = dot(q, q);\nfloat test = qMagnitudeSquared - 1.0;\nvec3 temp = D * pointWC - q;\nfloat d = dot(temp, q);\nreturn (d < -test) && (d / length(temp) < -sqrt(test));\n}\nvec4 getIntersectionColor()\n{\nreturn u_intersectionColor;\n}\nfloat getIntersectionWidth()\n{\nreturn u_intersectionWidth;\n}\nvec2 sensor2dTextureCoordinates(float sensorRadius, vec3 pointMC)\n{\nfloat t = pointMC.z / sensorRadius;\nfloat s = 1.0 + (atan(pointMC.y, pointMC.x) / czm_twoPi);\ns = s - floor(s);\nreturn vec2(s, t);\n}\n" }), r("Shaders/CustomSensorVolumeVS", [], function() { "use strict"; return "attribute vec4 position;\nattribute vec3 normal;\nvarying vec3 v_positionWC;\nvarying vec3 v_positionEC;\nvarying vec3 v_normalEC;\nvoid main()\n{\ngl_Position = czm_modelViewProjection * position;\nv_positionWC = (czm_model * position).xyz;\nv_positionEC = (czm_modelView * position).xyz;\nv_normalEC = czm_normal * normal;\n}\n" }), r("Shaders/CustomSensorVolumeFS", [], function() { "use strict"; return "#ifdef GL_OES_standard_derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\nuniform bool u_showIntersection;\nuniform bool u_showThroughEllipsoid;\nuniform float u_sensorRadius;\nuniform float u_normalDirection;\nvarying vec3 v_positionWC;\nvarying vec3 v_positionEC;\nvarying vec3 v_normalEC;\nvec4 getColor(float sensorRadius, vec3 pointEC)\n{\nczm_materialInput materialInput;\nvec3 pointMC = (czm_inverseModelView * vec4(pointEC, 1.0)).xyz;\nmaterialInput.st = sensor2dTextureCoordinates(sensorRadius, pointMC);\nmaterialInput.str = pointMC / sensorRadius;\nvec3 positionToEyeEC = -v_positionEC;\nmaterialInput.positionToEyeEC = positionToEyeEC;\nvec3 normalEC = normalize(v_normalEC);\nmaterialInput.normalEC = u_normalDirection * normalEC;\nczm_material material = czm_getMaterial(materialInput);\nreturn mix(czm_phong(normalize(positionToEyeEC), material), vec4(material.diffuse, material.alpha), 0.4);\n}\nbool isOnBoundary(float value, float epsilon)\n{\nfloat width = getIntersectionWidth();\nfloat tolerance = width * epsilon;\n#ifdef GL_OES_standard_derivatives\nfloat delta = max(abs(dFdx(value)), abs(dFdy(value)));\nfloat pixels = width * delta;\nfloat temp = abs(value);\nreturn temp < tolerance && temp < pixels || (delta < 10.0 * tolerance && temp - delta < tolerance && temp < pixels);\n#else\nreturn abs(value) < tolerance;\n#endif\n}\nvec4 shade(bool isOnBoundary)\n{\nif (u_showIntersection && isOnBoundary)\n{\nreturn getIntersectionColor();\n}\nreturn getColor(u_sensorRadius, v_positionEC);\n}\nfloat ellipsoidSurfaceFunction(czm_ellipsoid ellipsoid, vec3 point)\n{\nvec3 scaled = ellipsoid.inverseRadii * point;\nreturn dot(scaled, scaled) - 1.0;\n}\nvoid main()\n{\nvec3 sensorVertexWC = czm_model[3].xyz;\nvec3 sensorVertexEC = czm_modelView[3].xyz;\nczm_ellipsoid ellipsoid = czm_getWgs84EllipsoidEC();\nfloat ellipsoidValue = ellipsoidSurfaceFunction(ellipsoid, v_positionWC);\nif (!u_showThroughEllipsoid)\n{\nif (ellipsoidValue < 0.0)\n{\ndiscard;\n}\nif (inSensorShadow(sensorVertexWC, ellipsoid, v_positionWC))\n{\ndiscard;\n}\n}\nif (distance(v_positionEC, sensorVertexEC) > u_sensorRadius)\n{\ndiscard;\n}\nbool isOnEllipsoid = isOnBoundary(ellipsoidValue, czm_epsilon3);\ngl_FragColor = shade(isOnEllipsoid);\n}\n" }), r("Scene/CustomSensorVolume", ["../Core/defaultValue", "../Core/defined", "../Core/DeveloperError", "../Core/Color", "../Core/combine", "../Core/destroyObject", "../Core/FAR", "../Core/Cartesian3", "../Core/Matrix4", "../Core/ComponentDatatype", "../Core/PrimitiveType", "../Core/BoundingSphere", "../Renderer/BufferUsage", "../Renderer/BlendingState", "../Renderer/CommandLists", "../Renderer/DrawCommand", "../Renderer/createShaderSource", "../Renderer/CullFace", "./Material", "../Shaders/SensorVolume", "../Shaders/CustomSensorVolumeVS", "../Shaders/CustomSensorVolumeFS", "./SceneMode"], function(e, t, r, i, n, o, a, s, l, u, c, h, d, m, p, f, v, y, g, _, w, C, x) {
  3977. "use strict";
  3978. function S(e) { for (var t = e._directions, r = t.length, i = new Float32Array(3 * r), n = isFinite(e.radius) ? e.radius : a, o = [s.ZERO], l = r - 2, u = r - 1, c = 0; r > c; l = u++, u = c++) { var d = s.fromSpherical(t[l]),
  3979. m = s.fromSpherical(t[u]),
  3980. p = s.fromSpherical(t[c]),
  3981. f = Math.max(s.angleBetween(d, m), s.angleBetween(m, p)),
  3982. v = n / Math.cos(.5 * f),
  3983. y = m.multiplyByScalar(v);
  3984. i[3 * u + 0] = y.x, i[3 * u + 1] = y.y, i[3 * u + 2] = y.z, o.push(y) } return h.fromPoints(o, e._frontFaceColorCommand.boundingVolume), i }
  3985. function E(e, t) {
  3986. for (var r = S(e), i = e._directions.length, n = new Float32Array(18 * i), o = 0, a = i - 1, l = 0; i > l; a = l++) {
  3987. var c = new s(r[3 * a + 0], r[3 * a + 1], r[3 * a + 2]),
  3988. h = new s(r[3 * l + 0], r[3 * l + 1], r[3 * l + 2]),
  3989. d = h.cross(c).normalize();
  3990. n[o++] = 0, n[o++] = 0, n[o++] = 0, n[o++] = d.x, n[o++] = d.y, n[o++] = d.z, n[o++] = h.x, n[o++] = h.y, n[o++] = h.z, n[o++] = d.x, n[o++] = d.y, n[o++] = d.z, n[o++] = c.x, n[o++] = c.y, n[o++] = c.z, n[o++] = d.x, n[o++] = d.y, n[o++] = d.z
  3991. }
  3992. var m = t.createVertexBuffer(new Float32Array(n), e.bufferUsage),
  3993. p = 6 * Float32Array.BYTES_PER_ELEMENT,
  3994. f = [{ index: b.position, vertexBuffer: m, componentsPerAttribute: 3, componentDatatype: u.FLOAT, offsetInBytes: 0, strideInBytes: p }, { index: b.normal, vertexBuffer: m, componentsPerAttribute: 3, componentDatatype: u.FLOAT, offsetInBytes: 3 * Float32Array.BYTES_PER_ELEMENT, strideInBytes: p }];
  3995. return t.createVertexArray(f)
  3996. }
  3997. var b = { position: 0, normal: 1 },
  3998. T = function(r) { r = e(r, e.EMPTY_OBJECT), this._pickId = void 0, this._pickIdThis = e(r._pickIdThis, this), this._frontFaceColorCommand = new f, this._backFaceColorCommand = new f, this._pickCommand = new f, this._commandLists = new p, this._frontFaceColorCommand.primitiveType = c.TRIANGLES, this._frontFaceColorCommand.boundingVolume = new h, this._frontFaceColorCommand.owner = this, this._backFaceColorCommand.primitiveType = this._frontFaceColorCommand.primitiveType, this._backFaceColorCommand.boundingVolume = this._frontFaceColorCommand.boundingVolume, this._backFaceColorCommand.owner = this, this._pickCommand.primitiveType = this._frontFaceColorCommand.primitiveType, this._pickCommand.boundingVolume = this._frontFaceColorCommand.boundingVolume, this._pickCommand.owner = this, this.show = e(r.show, !0), this.showIntersection = e(r.showIntersection, !0), this.showThroughEllipsoid = e(r.showThroughEllipsoid, !1), this._showThroughEllipsoid = this.showThroughEllipsoid, this.modelMatrix = l.clone(e(r.modelMatrix, l.IDENTITY)), this.bufferUsage = e(r.bufferUsage, d.STATIC_DRAW), this._bufferUsage = this.bufferUsage, this.radius = e(r.radius, Number.POSITIVE_INFINITY), this._directions = void 0, this._directionsDirty = !1, this.setDirections(r.directions), this.material = t(r.material) ? r.material : g.fromType(void 0, g.ColorType), this._material = void 0, this.intersectionColor = i.clone(e(r.intersectionColor, i.WHITE)), this.intersectionWidth = e(r.intersectionWidth, 5); var n = this;
  3999. this._uniforms = { u_showThroughEllipsoid: function() { return n.showThroughEllipsoid }, u_showIntersection: function() { return n.showIntersection }, u_sensorRadius: function() { return isFinite(n.radius) ? n.radius : a }, u_intersectionColor: function() { return n.intersectionColor }, u_intersectionWidth: function() { return n.intersectionWidth }, u_normalDirection: function() { return 1 } }, this._mode = x.SCENE3D };
  4000. return T.prototype.setDirections = function(e) { this._directions = e, this._directionsDirty = !0 }, T.prototype.getDirections = function() { return this._directions }, T.prototype.update = function(e, i, o) { if (this._mode = i.mode, this.show && this._mode === x.SCENE3D) { if (this.radius < 0) throw new r("this.radius must be greater than or equal to zero."); if (!t(this.material)) throw new r("this.material must be defined."); if (this._showThroughEllipsoid !== this.showThroughEllipsoid || !t(this._frontFaceColorCommand.renderState)) { this._showThroughEllipsoid = this.showThroughEllipsoid; var a = e.createRenderState({ depthTest: { enabled: !this.showThroughEllipsoid }, depthMask: !1, blending: m.ALPHA_BLEND, cull: { enabled: !0, face: y.BACK } });
  4001. this._frontFaceColorCommand.renderState = a, a = e.createRenderState({ depthTest: { enabled: !this.showThroughEllipsoid }, depthMask: !1, blending: m.ALPHA_BLEND, cull: { enabled: !0, face: y.FRONT } }), this._backFaceColorCommand.renderState = a, a = e.createRenderState({ depthTest: { enabled: !this.showThroughEllipsoid }, depthMask: !1, blending: m.ALPHA_BLEND }), this._pickCommand.renderState = a } if (this._directionsDirty || this._bufferUsage !== this.bufferUsage) { this._directionsDirty = !1, this._bufferUsage = this.bufferUsage, this._va = this._va && this._va.destroy(); var s = this._directions;
  4002. s && s.length >= 3 && (this._frontFaceColorCommand.vertexArray = E(this, e), this._backFaceColorCommand.vertexArray = this._frontFaceColorCommand.vertexArray, this._pickCommand.vertexArray = this._frontFaceColorCommand.vertexArray) } if (t(this._frontFaceColorCommand.vertexArray)) { var l = i.passes;
  4003. this._commandLists.removeAll(), this._frontFaceColorCommand.modelMatrix = this.modelMatrix, this._backFaceColorCommand.modelMatrix = this._frontFaceColorCommand.modelMatrix, this._pickCommand.modelMatrix = this._frontFaceColorCommand.modelMatrix; var u = this._material !== this.material; if (this._material = this.material, l.color) { var c = this._frontFaceColorCommand,
  4004. h = this._backFaceColorCommand; if (u || !t(c.shaderProgram)) { var d = v({ sources: [_, this._material.shaderSource, C] });
  4005. c.shaderProgram = e.getShaderCache().replaceShaderProgram(c.shaderProgram, w, d, b), c.uniformMap = n([this._uniforms, this._material._uniforms], !1, !1), h.shaderProgram = c.shaderProgram, h.uniformMap = n([this._uniforms, this._material._uniforms], !1, !1), h.uniformMap.u_normalDirection = function() { return -1 } } this._commandLists.colorList.push(h), this._commandLists.colorList.push(c) } if (l.pick) { var p = this._pickCommand; if (t(this._pickId) || (this._pickId = e.createPickId(this._pickIdThis)), u || !t(p.shaderProgram)) { var f = v({ sources: [_, this._material.shaderSource, C], pickColorQualifier: "uniform" });
  4006. p.shaderProgram = e.getShaderCache().replaceShaderProgram(p.shaderProgram, w, f, b); var g = this;
  4007. p.uniformMap = n([this._uniforms, this._material._uniforms, { czm_pickColor: function() { return g._pickId.color } }], !1, !1) } this._commandLists.pickList.push(p) } this._commandLists.empty() || o.push(this._commandLists) } } }, T.prototype.isDestroyed = function() { return !1 }, T.prototype.destroy = function() { return this._frontFaceColorCommand.vertexArray = this._frontFaceColorCommand.vertexArray && this._frontFaceColorCommand.vertexArray.destroy(), this._frontFaceColorCommand.shaderProgram = this._frontFaceColorCommand.shaderProgram && this._frontFaceColorCommand.shaderProgram.release(), this._pickCommand.shaderProgram = this._pickCommand.shaderProgram && this._pickCommand.shaderProgram.release(), this._pickId = this._pickId && this._pickId.destroy(), o(this) }, T
  4008. }), r("DynamicScene/DynamicConeVisualizerUsingCustomSensor", ["../Core/Cartesian3", "../Core/Color", "../Core/defined", "../Core/destroyObject", "../Core/DeveloperError", "../Core/Quaternion", "../Core/Math", "../Core/Matrix3", "../Core/Matrix4", "../Core/Spherical", "../Scene/CustomSensorVolume", "../Scene/Material", "./MaterialProperty"], function(e, t, r, i, n, o, a, s, l, u, c, h, d) { "use strict";
  4009. function m(e, t, i, n) { var o = t[e];
  4010. r(o) || (t[e] = o = new u), o.clock = i, o.cone = n, o.magnitude = 1 }
  4011. function p(e, t, r, i, n) { var o, s = 0,
  4012. l = a.toRadians(2); if (0 === e && t === a.TWO_PI)
  4013. for (o = 0; o < a.TWO_PI; o += l) m(s++, n, o, i);
  4014. else { for (o = e; t > o; o += l) m(s++, n, o, i); if (m(s++, n, t, i), r) { for (o = t; o > e; o -= l) m(s++, n, o, r);
  4015. m(s++, n, e, r) } else m(s++, n, t, 0) } return n.length = s, n }
  4016. function f(e, i, n) { var o = e._scene.getContext(),
  4017. u = n.cone; if (r(u)) { var m = n.position; if (r(m)) { var f = n.orientation; if (r(f)) { var y, w = u.show,
  4018. C = n._coneVisualizerIndex,
  4019. x = n.isAvailable(i) && (!r(w) || w.getValue(i)); if (!x) return r(C) && (y = e._coneCollection[C], y.show = !1, n._coneVisualizerIndex = void 0, e._unusedIndexes.push(C)), void 0; if (r(C)) y = e._coneCollection[C];
  4020. else { var S = e._unusedIndexes,
  4021. E = S.length;
  4022. E > 0 ? (C = S.pop(), y = e._coneCollection[C]) : (C = e._coneCollection.length, y = new c, y._directionsScratch = [], e._coneCollection.push(y), e._primitives.add(y)), n._coneVisualizerIndex = C, y.dynamicObject = n, y.material = h.fromType(o, h.ColorType), y.intersectionColor = t.YELLOW.clone(), y.intersectionWidth = 5, y.radius = Number.POSITIVE_INFINITY, y.showIntersection = !0 } y.show = !0; var b, T = u.minimumClockAngle;
  4023. r(T) && (b = T.getValue(i)), r(b) || (b = 0); var A;
  4024. T = u.maximumClockAngle, r(T) && (A = T.getValue(i)), r(A) || (A = a.TWO_PI); var M;
  4025. T = u.innerHalfAngle, r(T) && (M = T.getValue(i)), r(M) || (M = 0); var P; if (T = u.outerHalfAngle, r(T) && (P = T.getValue(i)), r(P) || (P = Math.PI), (b !== y.minimumClockAngle || A !== y.maximumClockAngle || M !== y.innerHalfAngle || P !== y.outerHalfAngle) && (y.setDirections(p(b, A, M, P, y._directionsScratch)), y.innerHalfAngle = M, y.maximumClockAngle = A, y.outerHalfAngle = P, y.minimumClockAngle = b), T = u.radius, r(T)) { var D = T.getValue(i);
  4026. r(D) && (y.radius = D) } var I = m.getValue(i, g),
  4027. O = f.getValue(i, _); if (!r(I) || !r(O) || I.equals(y._visualizerPosition) && O.equals(y._visualizerOrientation) || (l.fromRotationTranslation(s.fromQuaternion(O, v), I, y.modelMatrix), y._visualizerPosition = I.clone(y._visualizerPosition), y._visualizerOrientation = O.clone(y._visualizerOrientation)), y.material = d.getValue(i, o, u.outerMaterial, y.material), T = u.intersectionColor, r(T) && T.getValue(i, y.intersectionColor), T = u.intersectionWidth, r(T)) { var R = T.getValue(i);
  4028. r(R) && (y.intersectionWidth = R) } } } } } var v = new s,
  4029. y = function(e, t) { if (!r(e)) throw new n("scene is required.");
  4030. this._scene = e, this._unusedIndexes = [], this._primitives = e.getPrimitives(), this._coneCollection = [], this._dynamicObjectCollection = void 0, this.setDynamicObjectCollection(t) };
  4031. y.prototype.getScene = function() { return this._scene }, y.prototype.getDynamicObjectCollection = function() { return this._dynamicObjectCollection }, y.prototype.setDynamicObjectCollection = function(e) { var t = this._dynamicObjectCollection;
  4032. t !== e && (r(t) && (t.objectsRemoved.removeEventListener(y.prototype._onObjectsRemoved, this), this.removeAllPrimitives()), this._dynamicObjectCollection = e, r(e) && e.objectsRemoved.addEventListener(y.prototype._onObjectsRemoved, this)) }, y.prototype.update = function(e) { if (!r(e)) throw new n("time is requied."); if (r(this._dynamicObjectCollection))
  4033. for (var t = this._dynamicObjectCollection.getObjects(), i = 0, o = t.length; o > i; i++) f(this, e, t[i]) }, y.prototype.removeAllPrimitives = function() { var e, t; for (e = 0, t = this._coneCollection.length; t > e; e++) this._primitives.remove(this._coneCollection[e]); if (r(this._dynamicObjectCollection)) { var i = this._dynamicObjectCollection.getObjects(); for (e = i.length - 1; e > -1; e--) i[e]._coneVisualizerIndex = void 0 } this._unusedIndexes = [], this._coneCollection = [] }, y.prototype.isDestroyed = function() { return !1 }, y.prototype.destroy = function() { return this.removeAllPrimitives(), i(this) }; var g = new e,
  4034. _ = new o; return y.prototype._onObjectsRemoved = function(e, t) { for (var i = this._coneCollection, n = this._unusedIndexes, o = t.length - 1; o > -1; o--) { var a = t[o],
  4035. s = a._coneVisualizerIndex; if (r(s)) { var l = i[s];
  4036. l.show = !1, n.push(s), a._coneVisualizerIndex = void 0 } } }, y }), r("Scene/Label", ["../Core/defaultValue", "../Core/DeveloperError", "../Core/Cartesian2", "../Core/Cartesian3", "../Core/Color", "../Core/defined", "./Billboard", "./LabelStyle", "./HorizontalOrigin", "./VerticalOrigin"], function(e, t, r, i, n, o, a, s, l, u) { "use strict";
  4037. function c(e) { e._rebindAllGlyphs || e._repositionAllGlyphs || e._labelCollection._labelsToUpdate.push(e), e._rebindAllGlyphs = !0 }
  4038. function h(e) { e._rebindAllGlyphs || e._repositionAllGlyphs || e._labelCollection._labelsToUpdate.push(e), e._repositionAllGlyphs = !0 } var d = function(t, o) { t = e(t, e.EMPTY_OBJECT), this._text = e(t.text, ""), this._show = e(t.show, !0), this._font = e(t.font, "30px sans-serif"), this._fillColor = n.clone(e(t.fillColor, n.WHITE)), this._outlineColor = n.clone(e(t.outlineColor, n.BLACK)), this._outlineWidth = e(t.outlineWidth, 1), this._style = e(t.style, s.FILL), this._verticalOrigin = e(t.verticalOrigin, u.BOTTOM), this._horizontalOrigin = e(t.horizontalOrigin, l.LEFT), this._pixelOffset = r.clone(e(t.pixelOffset, r.ZERO)), this._eyeOffset = i.clone(e(t.eyeOffset, i.ZERO)), this._position = i.clone(e(t.position, i.ZERO)), this._scale = e(t.scale, 1), this._labelCollection = o, this._glyphs = [], this._rebindAllGlyphs = !0, this._repositionAllGlyphs = !0 }; return d.prototype.getShow = function() { return this._show }, d.prototype.setShow = function(e) { if (!o(e)) throw new t("value is required."); if (e !== this._show) { this._show = e; for (var r = this._glyphs, i = 0, n = r.length; n > i; i++) { var a = r[i];
  4039. o(a.billboard) && a.billboard.setShow(e) } } }, d.prototype.getPosition = function() { return this._position }, d.prototype.setPosition = function(e) { if (!o(e)) throw new t("value is required."); var r = this._position; if (!i.equals(r, e)) { i.clone(e, r); for (var n = this._glyphs, a = 0, s = n.length; s > a; a++) { var l = n[a];
  4040. o(l.billboard) && l.billboard.setPosition(e) } } }, d.prototype.getText = function() { return this._text }, d.prototype.setText = function(e) { if (!o(e)) throw new t("value is required.");
  4041. e !== this._text && (this._text = e, c(this)) }, d.prototype.getFont = function() { return this._font }, d.prototype.setFont = function(e) { if (!o(e)) throw new t("value is required.");
  4042. this._font !== e && (this._font = e, c(this)) }, d.prototype.getFillColor = function() { return this._fillColor }, d.prototype.setFillColor = function(e) { if (!o(e)) throw new t("value is required."); var r = this._fillColor;
  4043. n.equals(r, e) || (n.clone(e, r), c(this)) }, d.prototype.getOutlineColor = function() { return this._outlineColor }, d.prototype.setOutlineColor = function(e) { if (!o(e)) throw new t("value is required."); var r = this._outlineColor;
  4044. n.equals(r, e) || (n.clone(e, r), c(this)) }, d.prototype.getOutlineWidth = function() { return this._outlineWidth }, d.prototype.setOutlineWidth = function(e) { if (!o(e)) throw new t("value is required.");
  4045. this._outlineWidth !== e && (this._outlineWidth = e, c(this)) }, d.prototype.getStyle = function() { return this._style }, d.prototype.setStyle = function(e) { if (!o(e)) throw new t("value is required.");
  4046. this._style !== e && (this._style = e, c(this)) }, d.prototype.getPixelOffset = function() { return this._pixelOffset }, d.prototype.setPixelOffset = function(e) { if (!o(e)) throw new t("value is required."); var i = this._pixelOffset;
  4047. r.equals(i, e) || (r.clone(e, i), h(this)) }, d.prototype.getEyeOffset = function() { return this._eyeOffset }, d.prototype.setEyeOffset = function(e) { if (!o(e)) throw new t("value is required."); var r = this._eyeOffset; if (!i.equals(r, e)) { i.clone(e, r); for (var n = this._glyphs, a = 0, s = n.length; s > a; a++) { var l = n[a];
  4048. o(l.billboard) && l.billboard.setEyeOffset(e) } } }, d.prototype.getHorizontalOrigin = function() { return this._horizontalOrigin }, d.prototype.setHorizontalOrigin = function(e) { if (!o(e)) throw new t("value is required.");
  4049. this._horizontalOrigin !== e && (this._horizontalOrigin = e, h(this)) }, d.prototype.getVerticalOrigin = function() { return this._verticalOrigin }, d.prototype.setVerticalOrigin = function(e) { if (!o(e)) throw new t("value is required.");
  4050. this._verticalOrigin !== e && (this._verticalOrigin = e, h(this)) }, d.prototype.getScale = function() { return this._scale }, d.prototype.setScale = function(e) { if (!o(e)) throw new t("value is required."); if (this._scale !== e) { this._scale = e; for (var r = this._glyphs, i = 0, n = r.length; n > i; i++) { var a = r[i];
  4051. o(a.billboard) && a.billboard.setScale(e) } h(this) } }, d.prototype.computeScreenSpacePosition = function(e, r) { if (!o(e)) throw new t("context is required."); if (!o(r)) throw new t("frameState is required."); var i = this._labelCollection,
  4052. n = i.modelMatrix,
  4053. s = a._computeActualPosition(this._position, r, n); return a._computeScreenSpacePosition(n, s, this._eyeOffset, this._pixelOffset, e, r) }, d.prototype.equals = function(e) { return this === e || o(e) && this._show === e._show && this._scale === e._scale && this._style === e._style && this._verticalOrigin === e._verticalOrigin && this._horizontalOrigin === e._horizontalOrigin && this._text === e._text && this._font === e._font && i.equals(this._position, e._position) && n.equals(this._fillColor, e._fillColor) && n.equals(this._outlineColor, e._outlineColor) && r.equals(this._pixelOffset, e._pixelOffset) && i.equals(this._eyeOffset, e._eyeOffset) }, d.prototype.isDestroyed = function() { return !1 }, d }), r("Scene/LabelCollection", ["../Core/DeveloperError", "../Core/defined", "../Core/destroyObject", "../Core/Cartesian2", "../Core/Matrix4", "../Core/writeTextToCanvas", "./BillboardCollection", "./Label", "./LabelStyle", "./HorizontalOrigin", "./VerticalOrigin"], function(e, t, r, i, n, o, a, s, l, u, c) { "use strict";
  4054. function h() { this.textureInfo = void 0, this.dimensions = void 0, this.billboard = void 0 }
  4055. function d(e, t, r) { this.labelCollection = e, this.index = t, this.dimensions = r }
  4056. function m(e, t, r, i, n, a, s) { return g.font = t, g.fillColor = r, g.strokeColor = i, g.strokeWidth = n, g.textBaseline = s === c.BOTTOM ? "bottom" : s === c.TOP ? "top" : "middle", g.fill = a === l.FILL || a === l.FILL_AND_OUTLINE, g.stroke = a === l.OUTLINE || a === l.FILL_AND_OUTLINE, o(e, g) }
  4057. function p(e, r) { r.textureInfo = void 0, r.dimensions = void 0; var i = r.billboard;
  4058. t(i) && (i.setShow(!1), i.setImageIndex(-1), e._spareBillboards.push(i), r.billboard = void 0) }
  4059. function f(e, r) { var i, n, o, a = r._text,
  4060. s = a.length,
  4061. l = r._glyphs,
  4062. c = l.length; if (c > s)
  4063. for (n = s; c > n; ++n) p(e, l[n]);
  4064. l.length = s; var f = e._glyphTextureCache,
  4065. v = e._textureAtlas; for (o = 0; s > o; ++o) { var y = a.charAt(o),
  4066. g = r._font,
  4067. _ = r._fillColor,
  4068. w = r._outlineColor,
  4069. C = r._outlineWidth,
  4070. x = r._style,
  4071. S = r._verticalOrigin,
  4072. E = JSON.stringify([y, g, _.toRgba(), w.toRgba(), C, +x, +S]),
  4073. b = f[E]; if (!t(b)) { var T = m(y, g, _, w, C, x, S),
  4074. A = -1;
  4075. T.width > 0 && T.height > 0 && (A = v.addImage(T)), b = new d(e, A, T.dimensions), f[E] = b } if (i = l[o], t(i) ? -1 === b.index ? p(e, i) : t(i.textureInfo) && (i.textureInfo = void 0) : (i = new h, l[o] = i), i.textureInfo = b, i.dimensions = b.dimensions, -1 !== b.index) { var M = i.billboard;
  4076. t(M) || (i.billboard = M = e._spareBillboards.length > 0 ? e._spareBillboards.pop() : e._billboardCollection.add(), M.setShow(r._show), M.setPosition(r._position), M.setEyeOffset(r._eyeOffset), M.setHorizontalOrigin(u.LEFT), M.setVerticalOrigin(r._verticalOrigin), M.setScale(r._scale), M._pickIdThis = r), i.billboard.setImageIndex(b.index) } } r._repositionAllGlyphs = !0 }
  4077. function v(e) { var r, i, n = e._glyphs,
  4078. o = 0,
  4079. a = 0,
  4080. s = 0,
  4081. l = n.length; for (s = 0; l > s; ++s) r = n[s], i = r.dimensions, o += i.width, a = Math.max(a, i.height); var h = e._scale,
  4082. d = e._horizontalOrigin,
  4083. m = 0;
  4084. d === u.CENTER ? m -= o / 2 * h : d === u.RIGHT && (m -= o * h); var p = e._pixelOffset;
  4085. _.x = p.x + m, _.y = 0; var f = e._verticalOrigin; for (s = 0; l > s; ++s) r = n[s], i = r.dimensions, f === c.BOTTOM || i.height === a ? _.y = p.y - i.descent * h : f === c.TOP ? _.y = p.y - (a - i.height) * h - i.descent * h : f === c.CENTER && (_.y = p.y - (a - i.height) / 2 * h - i.descent * h), t(r.billboard) && r.billboard.setPixelOffset(_), _.x += i.width * h }
  4086. function y(e, t) { for (var i = t._glyphs, n = 0, o = i.length; o > n; ++n) p(e, i[n]);
  4087. t._labelCollection = void 0, r(t) } var g = {},
  4088. _ = new i,
  4089. w = function() { this._textureAtlas = void 0, this._billboardCollection = new a, this._billboardCollection.setDestroyTextureAtlas(!1), this._spareBillboards = [], this._glyphTextureCache = {}, this._labels = [], this._labelsToUpdate = [], this._totalGlyphCount = 0, this.modelMatrix = n.IDENTITY.clone() }; return w.prototype.add = function(e) { var t = new s(e, this); return this._labels.push(t), this._labelsToUpdate.push(t), t }, w.prototype.remove = function(e) { if (t(e) && e._labelCollection === this) { var r = this._labels.indexOf(e); if (-1 !== r) return this._labels.splice(r, 1), y(this, e), !0 } return !1 }, w.prototype.removeAll = function() { for (var e = this._labels, t = 0, r = e.length; r > t; ++t) y(this, e[t]);
  4090. e.length = 0 }, w.prototype.contains = function(e) { return t(e) && e._labelCollection === this }, w.prototype.get = function(r) { if (!t(r)) throw new e("index is required."); return this._labels[r] }, w.prototype.getLength = function() { return this._labels.length }, w.prototype.update = function(e, r, i) { var n = this._billboardCollection;
  4091. n.modelMatrix = this.modelMatrix, t(this._textureAtlas) || (this._textureAtlas = e.createTextureAtlas(), n.setTextureAtlas(this._textureAtlas)); for (var o = this._labelsToUpdate, a = 0, s = o.length; s > a; ++a) { var l = o[a]; if (!l.isDestroyed()) { var u = l._glyphs.length;
  4092. l._rebindAllGlyphs && (f(this, l), l._rebindAllGlyphs = !1), l._repositionAllGlyphs && (v(l), l._repositionAllGlyphs = !1); var c = l._glyphs.length - u;
  4093. this._totalGlyphCount += c } } o.length = 0, this._billboardCollection.update(e, r, i) }, w.prototype.isDestroyed = function() { return !1 }, w.prototype.destroy = function() { return this.removeAll(), this._billboardCollection = this._billboardCollection.destroy(), this._textureAtlas = this._textureAtlas && this._textureAtlas.destroy(), r(this) }, w }), r("DynamicScene/DynamicLabelVisualizer", ["../Core/DeveloperError", "../Core/defined", "../Core/destroyObject", "../Core/Color", "../Core/Cartesian2", "../Core/Cartesian3", "../Scene/LabelCollection", "../Scene/LabelStyle", "../Scene/HorizontalOrigin", "../Scene/VerticalOrigin"], function(e, t, r, i, n, o, a, s, l, u) { "use strict";
  4094. function c(e, r, a) { var c = a.label; if (t(c)) { var h = c.text; if (t(h)) { var y = a.position; if (t(y)) { var g, _ = c.show,
  4095. w = a._labelVisualizerIndex,
  4096. C = a.isAvailable(r) && (!t(_) || _.getValue(r)); if (!C) return t(w) && (g = e._labelCollection.get(w), g.setShow(!1), e._unusedIndexes.push(w), a._labelVisualizerIndex = void 0), void 0; if (t(w)) g = e._labelCollection.get(w);
  4097. else { var x = e._unusedIndexes,
  4098. S = x.length;
  4099. S > 0 ? (w = x.pop(), g = e._labelCollection.get(w)) : (w = e._labelCollection.getLength(), g = e._labelCollection.add()), a._labelVisualizerIndex = w, g.dynamicObject = a, g.setText(""), g.setScale(1), g.setFont("30px sans-serif"), g.setFillColor(i.WHITE), g.setOutlineColor(i.BLACK), g.setOutlineWidth(1), g.setStyle(s.FILL), g.setPixelOffset(n.ZERO), g.setEyeOffset(o.ZERO), g.setHorizontalOrigin(l.CENTER), g.setVerticalOrigin(u.CENTER) } g.setShow(C); var E = h.getValue(r);
  4100. t(E) && g.setText(E), d = y.getValue(r, d), t(d) && g.setPosition(d); var b = c.scale; if (t(b)) { var T = b.getValue(r);
  4101. t(T) && g.setScale(T) } if (b = c.font, t(b)) { var A = b.getValue(r);
  4102. t(A) && g.setFont(A) } if (b = c.fillColor, t(b) && (m = b.getValue(r, m), t(m) && g.setFillColor(m)), b = c.outlineColor, t(b) && (p = b.getValue(r, p), t(p) && g.setOutlineColor(p)), b = c.outlineWidth, t(b)) { var M = b.getValue(r);
  4103. t(M) && g.setOutlineWidth(M) } if (b = c.style, t(b)) { var P = b.getValue(r);
  4104. t(P) && g.setStyle(P) } if (b = c.pixelOffset, t(b) && (v = b.getValue(r, v), t(v) && g.setPixelOffset(v)), b = c.eyeOffset, t(b) && (f = b.getValue(r, f), t(f) && g.setEyeOffset(f)), b = c.horizontalOrigin, t(b)) { var D = b.getValue(r);
  4105. t(D) && g.setHorizontalOrigin(D) } if (b = c.verticalOrigin, t(b)) { var I = b.getValue(r);
  4106. t(I) && g.setVerticalOrigin(I) } } } } } var h = function(r, i) { if (!t(r)) throw new e("scene is required.");
  4107. this._scene = r, this._unusedIndexes = [], this._dynamicObjectCollection = void 0; var n = this._labelCollection = new a;
  4108. r.getPrimitives().add(n), this.setDynamicObjectCollection(i) };
  4109. h.prototype.getScene = function() { return this._scene }, h.prototype.getDynamicObjectCollection = function() { return this._dynamicObjectCollection }, h.prototype.setDynamicObjectCollection = function(e) { var r = this._dynamicObjectCollection;
  4110. r !== e && (t(r) && (r.objectsRemoved.removeEventListener(h.prototype._onObjectsRemoved, this), this.removeAllPrimitives()), this._dynamicObjectCollection = e, t(e) && e.objectsRemoved.addEventListener(h.prototype._onObjectsRemoved, this)) }, h.prototype.update = function(r) { if (!t(r)) throw new e("time is requied."); if (t(this._dynamicObjectCollection))
  4111. for (var i = this._dynamicObjectCollection.getObjects(), n = 0, o = i.length; o > n; n++) c(this, r, i[n]) }, h.prototype.removeAllPrimitives = function() { if (this._unusedIndexes = [], this._labelCollection.removeAll(), t(this._dynamicObjectCollection))
  4112. for (var e = this._dynamicObjectCollection.getObjects(), r = e.length - 1; r > -1; r--) e[r]._labelVisualizerIndex = void 0 }, h.prototype.isDestroyed = function() { return !1 }, h.prototype.destroy = function() { return this.removeAllPrimitives(), this._scene.getPrimitives().remove(this._labelCollection), r(this) }; var d, m, p, f, v; return h.prototype._onObjectsRemoved = function(e, r) { for (var i = this._labelCollection, n = this._unusedIndexes, o = r.length - 1; o > -1; o--) { var a = r[o],
  4113. s = a._labelVisualizerIndex; if (t(s)) { var l = i.get(s);
  4114. l.setShow(!1), n.push(s), a._labelVisualizerIndex = void 0 } } }, h }), r("Scene/Polyline", ["../Core/defaultValue", "../Core/defined", "../Core/DeveloperError", "../Core/BoundingSphere", "../Core/Color", "../Core/PolylinePipeline", "../Core/Matrix4", "./Material"], function(e, t, r, i, n, o, a, s) { "use strict";
  4115. function l(e, r) {++e._propertiesChanged[r]; var i = e._polylineCollection;
  4116. t(i) && (i._updatePolyline(e, r), e._dirty = !0) } var u = {},
  4117. c = function(r, l) { r = e(r, u), this._show = e(r.show, !0), this._width = e(r.width, 1), this._material = r.material, t(this._material) || (this._material = s.fromType(void 0, s.ColorType), this._material.uniforms.color = new n(1, 1, 1, 1)); var c = r.positions;
  4118. t(c) || (c = []), this._positions = c; var h;
  4119. t(this._polylineCollection) && (h = a.clone(this._polylineCollection.modelMatrix)), this._modelMatrix = h, this._segments = o.wrapLongitude(c, h), this._actualLength = void 0, this._propertiesChanged = new Uint32Array(v), this._polylineCollection = l, this._dirty = !1, this._pickId = void 0, this._pickIdThis = r._pickIdThis, this._boundingVolume = i.fromPoints(this._positions), this._boundingVolume2D = new i },
  4120. h = c.SHOW_INDEX = 0,
  4121. d = c.WIDTH_INDEX = 1,
  4122. m = c.POSITION_INDEX = 2,
  4123. p = c.MATERIAL_INDEX = 3,
  4124. f = c.POSITION_SIZE_INDEX = 4,
  4125. v = c.NUMBER_OF_PROPERTIES = 5; return c.prototype.getShow = function() { return this._show }, c.prototype.setShow = function(e) { if (!t(e)) throw new r("value is required.");
  4126. e !== this._show && (this._show = e, l(this, h)) }, c.prototype.getPositions = function() { return this._positions }, c.prototype.setPositions = function(e) { if (!t(e)) throw new r("value is required.");
  4127. this._positions.length !== e.length && l(this, f), this._positions = e, this._boundingVolume = i.fromPoints(this._positions, this._boundingVolume), l(this, m), this.update() }, c.prototype.update = function() { var e = a.IDENTITY;
  4128. t(this._polylineCollection) && (e = this._polylineCollection.modelMatrix); var r = this._segments.positions.length,
  4129. i = this._segments.lengths,
  4130. n = this._propertiesChanged[m] > 0 || this._propertiesChanged[f] > 0; if ((!e.equals(this._modelMatrix) || n) && (this._segments = o.wrapLongitude(this._positions, e)), this._modelMatrix = e, this._segments.positions.length !== r) l(this, f);
  4131. else
  4132. for (var s = i.length, u = 0; s > u; ++u)
  4133. if (i[u] !== this._segments.lengths[u]) { l(this, f); break } }, c.prototype.getMaterial = function() { return this._material }, c.prototype.setMaterial = function(e) { if (!t(e)) throw new r("material is required.");
  4134. this._material = e, l(this, p) }, c.prototype.getWidth = function() { return this._width }, c.prototype.setWidth = function(e) { if (!t(e)) throw new r("value is required."); var i = this._width;
  4135. e !== i && (this._width = e, l(this, d)) }, c.prototype.getPickId = function(r) { return t(this._pickId) || (this._pickId = r.createPickId(e(this._pickIdThis, this))), this._pickId }, c.prototype._clean = function() { this._dirty = !1; for (var e = this._propertiesChanged, t = 0; v - 1 > t; ++t) e[t] = 0 }, c.prototype._destroy = function() { this._pickId = this._pickId && this._pickId.destroy(), this._material = this._material && this._material.destroy(), this._polylineCollection = void 0 }, c }), r("Shaders/PolylineVS", [], function() { "use strict"; return "attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute vec3 position2DHigh;\nattribute vec3 position2DLow;\nattribute vec3 prevPosition3DHigh;\nattribute vec3 prevPosition3DLow;\nattribute vec3 prevPosition2DHigh;\nattribute vec3 prevPosition2DLow;\nattribute vec3 nextPosition3DHigh;\nattribute vec3 nextPosition3DLow;\nattribute vec3 nextPosition2DHigh;\nattribute vec3 nextPosition2DLow;\nattribute vec4 texCoordExpandWidthAndShow;\nattribute vec4 pickColor;\nvarying vec2 v_textureCoordinates;\nvarying float v_width;\nvarying vec4 czm_pickColor;\nconst vec2 czm_highResolutionSnapScale = vec2(1.0, 1.0);\nvoid clipLineSegmentToNearPlane(\nvec3 p0,\nvec3 p1,\nout vec4 positionWC,\nout bool clipped,\nout bool culledByNearPlane)\n{\nculledByNearPlane = false;\nclipped = false;\nvec3 p1ToP0 = p1 - p0;\nfloat magnitude = length(p1ToP0);\nvec3 direction = normalize(p1ToP0);\nfloat endPoint0Distance = -(czm_currentFrustum.x + p0.z);\nfloat denominator = -direction.z;\nif (endPoint0Distance < 0.0 && abs(denominator) < czm_epsilon7)\n{\nculledByNearPlane = true;\n}\nelse if (endPoint0Distance < 0.0 && abs(denominator) > czm_epsilon7)\n{\nfloat t = (czm_currentFrustum.x + p0.z) / denominator;\nif (t < 0.0 || t > magnitude)\n{\nculledByNearPlane = true;\n}\nelse\n{\np0 = p0 + t * direction;\nclipped = true;\n}\n}\npositionWC = czm_eyeToWindowCoordinates(vec4(p0, 1.0));\n}\nvoid main()\n{\nfloat texCoord = texCoordExpandWidthAndShow.x;\nfloat expandDir = texCoordExpandWidthAndShow.y;\nfloat width = abs(texCoordExpandWidthAndShow.z) + 0.5;\nbool usePrev = texCoordExpandWidthAndShow.z < 0.0;\nfloat show = texCoordExpandWidthAndShow.w;\nvec4 p, prev, next;\nif (czm_morphTime == 1.0)\n{\np = czm_translateRelativeToEye(position3DHigh.xyz, position3DLow.xyz);\nprev = czm_translateRelativeToEye(prevPosition3DHigh.xyz, prevPosition3DLow.xyz);\nnext = czm_translateRelativeToEye(nextPosition3DHigh.xyz, nextPosition3DLow.xyz);\n}\nelse if (czm_morphTime == 0.0)\n{\np = czm_translateRelativeToEye(position2DHigh.zxy, position2DLow.zxy);\nprev = czm_translateRelativeToEye(prevPosition2DHigh.zxy, prevPosition2DLow.zxy);\nnext = czm_translateRelativeToEye(nextPosition2DHigh.zxy, nextPosition2DLow.zxy);\n}\nelse\n{\np = czm_columbusViewMorph(\nczm_translateRelativeToEye(position2DHigh.zxy, position2DLow.zxy),\nczm_translateRelativeToEye(position3DHigh.xyz, position3DLow.xyz),\nczm_morphTime);\nprev = czm_columbusViewMorph(\nczm_translateRelativeToEye(prevPosition2DHigh.zxy, prevPosition2DLow.zxy),\nczm_translateRelativeToEye(prevPosition3DHigh.xyz, prevPosition3DLow.xyz),\nczm_morphTime);\nnext = czm_columbusViewMorph(\nczm_translateRelativeToEye(nextPosition2DHigh.zxy, nextPosition2DLow.zxy),\nczm_translateRelativeToEye(nextPosition3DHigh.xyz, nextPosition3DLow.xyz),\nczm_morphTime);\n}\nvec4 endPointWC, p0, p1;\nbool culledByNearPlane, clipped;\nvec4 positionEC = czm_modelViewRelativeToEye * p;\nvec4 prevEC = czm_modelViewRelativeToEye * prev;\nvec4 nextEC = czm_modelViewRelativeToEye * next;\nclipLineSegmentToNearPlane(prevEC.xyz, positionEC.xyz, p0, clipped, culledByNearPlane);\nclipLineSegmentToNearPlane(nextEC.xyz, positionEC.xyz, p1, clipped, culledByNearPlane);\nclipLineSegmentToNearPlane(positionEC.xyz, usePrev ? prevEC.xyz : nextEC.xyz, endPointWC, clipped, culledByNearPlane);\nif (culledByNearPlane)\n{\ngl_Position = czm_projection * vec4(0.0, 0.0, 0.0, 1.0);\nreturn;\n}\nvec2 prevWC = normalize(p0.xy - endPointWC.xy);\nvec2 nextWC = normalize(p1.xy - endPointWC.xy);\nfloat expandWidth = width * 0.5;\nvec2 direction;\nif (czm_equalsEpsilon(normalize(prev.xyz - p.xyz), vec3(0.0), czm_epsilon1) || czm_equalsEpsilon(prevWC, -nextWC, czm_epsilon1))\n{\ndirection = vec2(-nextWC.y, nextWC.x);\n}\nelse if (czm_equalsEpsilon(normalize(next.xyz - p.xyz), vec3(0.0), czm_epsilon1) || clipped)\n{\ndirection = vec2(prevWC.y, -prevWC.x);\n}\nelse\n{\nvec2 normal = vec2(-nextWC.y, nextWC.x);\ndirection = normalize((nextWC + prevWC) * 0.5);\nif (dot(direction, normal) < 0.0)\n{\ndirection = -direction;\n}\nfloat sinAngle = abs(direction.x * nextWC.y - direction.y * nextWC.x);\nexpandWidth = clamp(expandWidth / sinAngle, 0.0, width * 2.0);\n}\nvec2 offset = direction * expandDir * expandWidth * czm_highResolutionSnapScale;\nvec4 positionWC = vec4(endPointWC.xy + offset, -endPointWC.z, 1.0);\ngl_Position = czm_viewportOrthographic * positionWC * show;\nv_textureCoordinates = vec2(texCoord, clamp(expandDir, 0.0, 1.0));\nv_width = width;\nczm_pickColor = pickColor;\n}\n" }), r("Shaders/PolylineFS", [], function() { "use strict"; return "varying vec2 v_textureCoordinates;\nvoid main()\n{\nczm_materialInput materialInput;\nmaterialInput.s = v_textureCoordinates.s;\nmaterialInput.st = v_textureCoordinates;\nmaterialInput.str = vec3(v_textureCoordinates, 0.0);\nczm_material material = czm_getMaterial(materialInput);\ngl_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n}\n" }), r("Scene/PolylineCollection", ["../Core/defined", "../Core/DeveloperError", "../Core/Color", "../Core/combine", "../Core/destroyObject", "../Core/Cartesian3", "../Core/Cartesian4", "../Core/EncodedCartesian3", "../Core/Matrix4", "../Core/Math", "../Core/ComponentDatatype", "../Core/IndexDatatype", "../Core/PrimitiveType", "../Core/BoundingSphere", "../Core/Intersect", "../Renderer/BlendingState", "../Renderer/BufferUsage", "../Renderer/CommandLists", "../Renderer/DrawCommand", "../Renderer/createShaderSource", "./Material", "./SceneMode", "./Polyline", "../Shaders/PolylineVS", "../Shaders/PolylineFS"], function(e, t, r, i, n, o, a, s, l, u, c, h, d, m, p, f, v, y, g, _, w, C, x, S, E) {
  4136. "use strict";
  4137. function b(t, r, i, n, o, a, s) { for (var l = o.length, u = i.length, c = 0, h = !0, p = 0; l > p; ++p)
  4138. for (var f = o[p], v = f.buckets, y = v.length, _ = 0; y > _; ++_) { for (var w, x, S, E = v[_], b = E.offset, T = s ? E.bucket.shaderProgram : E.bucket.pickShaderProgram, A = E.bucket.polylines, P = A.length, D = 0, I = 0; P > I; ++I) { var O = A[I],
  4139. R = M(O._material);
  4140. R !== w && (e(w) && (c >= u ? (S = new g, S.owner = t, i.push(S)) : S = i[c], ++c, S.boundingVolume = m.clone(j, S.boundingVolume), S.modelMatrix = n, S.primitiveType = d.TRIANGLES, S.shaderProgram = T, S.vertexArray = f.va, S.renderState = a, S.uniformMap = x._uniforms, S.count = D, S.offset = b, b += D, D = 0, h = !0), x = O._material, w = R); for (var L = O._locatorBuckets, z = L.length, N = 0; z > N; ++N) { var F = L[N];
  4141. F.locator === E && (D += F.count) } var B;
  4142. r.mode === C.SCENE3D ? B = O._boundingVolume : r.mode === C.COLUMBUS_VIEW ? B = O._boundingVolume2D : r.mode === C.SCENE2D ? e(O._boundingVolume2D) && (B = m.clone(O._boundingVolume2D, Y), B.center.x = 0) : e(O._boundingVolume) && e(O._boundingVolume2D) && (B = m.union(O._boundingVolume, O._boundingVolume2D, Y)), h ? (h = !1, m.clone(B, j)) : m.union(B, j, j) } e(w) && D > 0 && (c >= u ? (S = new g, S.owner = t, i.push(S)) : S = i[c], ++c, S.boundingVolume = m.clone(j, S.boundingVolume), S.modelMatrix = n, S.primitiveType = d.TRIANGLES, S.shaderProgram = T, S.vertexArray = f.va, S.renderState = a, S.uniformMap = x._uniforms, S.count = D, S.offset = b, h = !0), w = void 0 } i.length = c }
  4143. function T(e) {
  4144. for (var t = e._buffersUsage, r = !1, i = e._propertiesChanged, n = 0; U - 2 > n; ++n) {
  4145. var o = t[n];
  4146. i[n] ? o.bufferUsage !== v.STREAM_DRAW ? (r = !0, o.bufferUsage = v.STREAM_DRAW, o.frameCount = 100) : o.frameCount = 100 : o.bufferUsage !== v.STATIC_DRAW && (0 === o.frameCount ? (r = !0, o.bufferUsage = v.STATIC_DRAW) : o.frameCount--)
  4147. }
  4148. return r
  4149. }
  4150. function A(t, r) { t._createVertexArray = !1, O(t), R(t), P(t); var i, n, o = [
  4151. []
  4152. ],
  4153. a = o[0],
  4154. s = [0],
  4155. l = 0,
  4156. d = [
  4157. []
  4158. ],
  4159. m = 0,
  4160. p = t._polylineBuckets; for (i in p) p.hasOwnProperty(i) && (n = p[i], n.updateShader(r), m += n.lengthOfPositions); if (m > 0) { var f, y = t._mode,
  4161. g = new Float32Array(3 * 6 * m),
  4162. _ = new Uint8Array(4 * m),
  4163. w = new Float32Array(4 * m),
  4164. x = 0,
  4165. S = 0,
  4166. E = 0; for (i in p)
  4167. if (p.hasOwnProperty(i)) { n = p[i], n.write(g, _, w, x, S, E, r), y === C.MORPHING && (e(f) || (f = new Float32Array(3 * 6 * m)), n.writeForMorph(f, x)); var b = n.lengthOfPositions;
  4168. x += 3 * 6 * b, S += 4 * b, E += 4 * b, l = n.updateIndices(o, s, d, l) }
  4169. var T = t._buffersUsage[V].bufferUsage,
  4170. A = t._buffersUsage[F].bufferUsage,
  4171. M = t._buffersUsage[B].bufferUsage,
  4172. D = A === v.STREAM_DRAW || M === v.STREAM_DRAW ? v.STREAM_DRAW : v.STATIC_DRAW;
  4173. t._positionBuffer = r.createVertexBuffer(g, T); var I;
  4174. e(f) && (I = r.createVertexBuffer(f, T)), t._pickColorBuffer = r.createVertexBuffer(_, v.STATIC_DRAW), t._texCoordExpandWidthAndShowBuffer = r.createVertexBuffer(w, D); for (var L = 4 * Uint8Array.BYTES_PER_ELEMENT, z = 3 * Float32Array.BYTES_PER_ELEMENT, N = 4 * Float32Array.BYTES_PER_ELEMENT, q = 0, k = o.length, U = 0; k > U; ++U)
  4175. if (a = o[U], a.length > 0) { var G = new Uint16Array(a),
  4176. H = r.createIndexBuffer(G, v.STATIC_DRAW, h.UNSIGNED_SHORT);
  4177. q += s[U]; var j, Y, Z, K, J = 6 * (U * z * u.SIXTY_FOUR_KILOBYTES - q * z),
  4178. Q = z + J,
  4179. $ = z + Q,
  4180. et = z + $,
  4181. tt = z + et,
  4182. rt = z + tt,
  4183. it = U * L * u.SIXTY_FOUR_KILOBYTES - q * L,
  4184. nt = U * N * u.SIXTY_FOUR_KILOBYTES - q * N,
  4185. ot = [{ index: W.position3DHigh, componentsPerAttribute: 3, componentDatatype: c.FLOAT, offsetInBytes: J, strideInBytes: 6 * z }, { index: W.position3DLow, componentsPerAttribute: 3, componentDatatype: c.FLOAT, offsetInBytes: Q, strideInBytes: 6 * z }, { index: W.position2DHigh, componentsPerAttribute: 3, componentDatatype: c.FLOAT, offsetInBytes: J, strideInBytes: 6 * z }, { index: W.position2DLow, componentsPerAttribute: 3, componentDatatype: c.FLOAT, offsetInBytes: Q, strideInBytes: 6 * z }, { index: W.prevPosition3DHigh, componentsPerAttribute: 3, componentDatatype: c.FLOAT, offsetInBytes: $, strideInBytes: 6 * z }, { index: W.prevPosition3DLow, componentsPerAttribute: 3, componentDatatype: c.FLOAT, offsetInBytes: et, strideInBytes: 6 * z }, { index: W.prevPosition2DHigh, componentsPerAttribute: 3, componentDatatype: c.FLOAT, offsetInBytes: $, strideInBytes: 6 * z }, { index: W.prevPosition2DLow, componentsPerAttribute: 3, componentDatatype: c.FLOAT, offsetInBytes: et, strideInBytes: 6 * z }, { index: W.nextPosition3DHigh, componentsPerAttribute: 3, componentDatatype: c.FLOAT, offsetInBytes: tt, strideInBytes: 6 * z }, { index: W.nextPosition3DLow, componentsPerAttribute: 3, componentDatatype: c.FLOAT, offsetInBytes: rt, strideInBytes: 6 * z }, { index: W.nextPosition2DHigh, componentsPerAttribute: 3, componentDatatype: c.FLOAT, offsetInBytes: tt, strideInBytes: 6 * z }, { index: W.nextPosition2DLow, componentsPerAttribute: 3, componentDatatype: c.FLOAT, offsetInBytes: rt, strideInBytes: 6 * z }, { index: W.texCoordExpandWidthAndShow, componentsPerAttribute: 4, componentDatatype: c.FLOAT, vertexBuffer: t._texCoordExpandWidthAndShowBuffer, offsetInBytes: nt }, { index: W.pickColor, componentsPerAttribute: 4, componentDatatype: c.UNSIGNED_BYTE, vertexBuffer: t._pickColorBuffer, offsetInBytes: it, normalize: !0 }];
  4186. y === C.SCENE3D ? (j = t._positionBuffer, Y = "vertexBuffer", Z = X, K = "value") : y === C.SCENE2D || y === C.COLUMBUS_VIEW ? (j = X, Y = "value", Z = t._positionBuffer, K = "vertexBuffer") : (j = I, Y = "vertexBuffer", Z = t._positionBuffer, K = "vertexBuffer"), ot[0][Y] = j, ot[1][Y] = j, ot[2][K] = Z, ot[3][K] = Z, ot[4][Y] = j, ot[5][Y] = j, ot[6][K] = Z, ot[7][K] = Z, ot[8][Y] = j, ot[9][Y] = j, ot[10][K] = Z, ot[11][K] = Z; var at = r.createVertexArray(ot, H);
  4187. t._vertexArrays.push({ va: at, buckets: d[U] }) } } }
  4188. function M(e) { var t = w._uniformList[e.type],
  4189. r = t.length;
  4190. Z.length = 2 * r; for (var i = 0, n = 0; r > n; ++n) { var o = t[n];
  4191. Z[i] = o, Z[i + 1] = e._uniforms[o](), i += 2 } return e.type + ":" + JSON.stringify(Z) }
  4192. function P(t) { for (var r = t._mode, i = t._projection, n = t._modelMatrix, o = t._polylineBuckets = {}, a = t._polylines, s = a.length, l = 0; s > l; ++l) { var u = a[l]; if (u.getPositions().length > 1) { u.update(); var c = u.getMaterial(),
  4193. h = o[c.type];
  4194. e(h) || (h = o[c.type] = new K(c, r, i, n)), h.addPolyline(u) } } }
  4195. function D(e, t) { var r = t.mode,
  4196. i = t.scene2D.projection;
  4197. e._mode === r && e._projection === i && e._modelMatrix.equals(e.modelMatrix) || (e._mode = r, e._projection = i, e._modelMatrix = e.modelMatrix.clone(), e._createVertexArray = !0) }
  4198. function I(t) { if (t._polylinesRemoved) { t._polylinesRemoved = !1; for (var r = [], i = t._polylines.length, n = 0, o = 0; i > n; ++n) { var a = t._polylines[n];
  4199. e(a) && (a._index = o++, r.push(a)) } t._polylines = r } }
  4200. function O(t) { for (var r = t._polylines, i = r.length, n = 0; i > n; ++n)
  4201. if (e(r[n])) { var o = r[n]._bucket;
  4202. e(o) && (o.shaderProgram = o.shaderProgram && o.shaderProgram.release()) } }
  4203. function R(e) { for (var t = e._vertexArrays.length, r = 0; t > r; ++r) e._vertexArrays[r].va.destroy();
  4204. e._vertexArrays.length = 0 }
  4205. function L(t) { for (var r = t._polylines, i = r.length, n = 0; i > n; ++n) e(r[n]) && r[n]._destroy() }
  4206. function z(e, t, r) { this.count = e, this.offset = t, this.bucket = r }
  4207. function N(e) { return o.dot(o.UNIT_X, e._boundingVolume.center) < 0 || e._boundingVolume.intersect(a.UNIT_Y) === p.INTERSECTING }
  4208. var F = x.SHOW_INDEX,
  4209. B = x.WIDTH_INDEX,
  4210. V = x.POSITION_INDEX,
  4211. q = x.MATERIAL_INDEX,
  4212. k = x.POSITION_SIZE_INDEX,
  4213. U = x.NUMBER_OF_PROPERTIES,
  4214. W = { texCoordExpandWidthAndShow: 0, position3DHigh: 1, position3DLow: 2, position2DHigh: 3, position2DLow: 4, prevPosition3DHigh: 5, prevPosition3DLow: 6, prevPosition2DHigh: 7, prevPosition2DLow: 8, nextPosition3DHigh: 9, nextPosition3DLow: 10, nextPosition2DHigh: 11, nextPosition2DLow: 12, pickColor: 13 },
  4215. G = function() { this.modelMatrix = l.IDENTITY.clone(), this._modelMatrix = l.IDENTITY.clone(), this._rs = void 0, this._commandLists = new y, this._colorCommands = [], this._pickCommands = [], this._polylinesUpdated = !1, this._polylinesRemoved = !1, this._createVertexArray = !1, this._propertiesChanged = new Uint32Array(U), this._polylines = [], this._polylineBuckets = {}, this._buffersUsage = [{ bufferUsage: v.STATIC_DRAW, frameCount: 0 }, { bufferUsage: v.STATIC_DRAW, frameCount: 0 }, { bufferUsage: v.STATIC_DRAW, frameCount: 0 }], this._mode = void 0, this._polylinesToUpdate = [], this._vertexArrays = [], this._positionBuffer = void 0, this._pickColorBuffer = void 0, this._texCoordExpandWidthAndShowBuffer = void 0 };
  4216. G.prototype.add = function(e) { var t = new x(e, this); return t._index = this._polylines.length, this._polylines.push(t), this._createVertexArray = !0, t }, G.prototype.remove = function(t) { if (this.contains(t)) { if (this._polylines[t._index] = void 0, this._polylinesRemoved = !0, this._createVertexArray = !0, e(t._bucket)) { var r = t._bucket;
  4217. r.shaderProgram = r.shaderProgram && r.shaderProgram.release(), r.pickShaderProgram = r.pickShaderProgram && r.pickShaderProgram.release() } return t._destroy(), !0 } return !1 }, G.prototype.removeAll = function() { O(this), L(this), this._polylineBuckets = {}, this._polylinesRemoved = !1, this._polylines.length = 0, this._polylinesToUpdate.length = 0, this._createVertexArray = !0 }, G.prototype.contains = function(t) { return e(t) && t._polylineCollection === this }, G.prototype.get = function(r) { if (!e(r)) throw new t("index is required."); return I(this), this._polylines[r] }, G.prototype.getLength = function() { return I(this), this._polylines.length };
  4218. var H = [];
  4219. G.prototype.update = function(t, r, i) { if (I(this), 0 !== this._polylines.length) { D(this, r); var n, o = this._propertiesChanged; if (this._createVertexArray || T(this)) A(this, t);
  4220. else if (this._polylinesUpdated) { var a = this._polylinesToUpdate; if (this._mode !== C.SCENE3D)
  4221. for (var s = a.length, u = 0; s > u; ++u) n = a[u], n.update(); if (o[k] || o[q]) A(this, t);
  4222. else
  4223. for (var c = a.length, h = this._polylineBuckets, d = 0; c > d; ++d) { n = a[d], o = n._propertiesChanged; var m = n._bucket,
  4224. p = 0; for (var v in h)
  4225. if (h.hasOwnProperty(v)) { if (h[v] === m) {
  4226. (o[V] || o[F] || o[B]) && m.writeUpdate(p, n, this._positionBuffer, this._texCoordExpandWidthAndShowBuffer); break } p += h[v].lengthOfPositions }
  4227. n._clean() } a.length = 0, this._polylinesUpdated = !1 } for (var y = 0; U > y; ++y) o[y] = 0; var g = l.IDENTITY;
  4228. r.mode === C.SCENE3D && (g = this.modelMatrix); var _ = r.passes,
  4229. w = 0 !== r.morphTime,
  4230. x = this._commandLists; if (x.colorList = H, x.pickList = H, e(this._rs) && this._rs.depthTest.enabled === w || (this._rs = t.createRenderState({ blending: f.ALPHA_BLEND, depthMask: !w, depthTest: { enabled: w } })), _.color) { var S = this._colorCommands;
  4231. x.colorList = S, b(this, r, S, g, this._vertexArrays, this._rs, !0) } if (_.pick) { var E = this._pickCommands;
  4232. x.pickList = E, b(this, r, E, g, this._vertexArrays, this._rs, !1) } this._commandLists.empty() || i.push(this._commandLists) } };
  4233. var j = new m,
  4234. Y = new m;
  4235. G.prototype.isDestroyed = function() { return !1 }, G.prototype.destroy = function() { return R(this), O(this), L(this), n(this) };
  4236. var X = [0, 0, 0],
  4237. Z = [];
  4238. G.prototype._updatePolyline = function(e, t) { this._polylinesUpdated = !0, this._polylinesToUpdate.push(e), ++this._propertiesChanged[t] };
  4239. var K = function(e, t, r, i) { this.polylines = [], this.lengthOfPositions = 0, this.material = e, this.shaderProgram = void 0, this.pickShaderProgram = void 0, this.mode = t, this.projection = r, this.ellipsoid = r.getEllipsoid(), this.modelMatrix = i };
  4240. K.prototype.addPolyline = function(e) { var t = this.polylines;
  4241. t.push(e), e._actualLength = this.getPolylinePositionsLength(e), this.lengthOfPositions += e._actualLength, e._bucket = this }, K.prototype.updateShader = function(t) { if (!e(this.shaderProgram)) { var r = _({ sources: [this.material.shaderSource, E] }),
  4242. i = _({ sources: [r], pickColorQualifier: "varying" });
  4243. this.shaderProgram = t.getShaderCache().getShaderProgram(S, r, W), this.pickShaderProgram = t.getShaderCache().getShaderProgram(S, i, W) } }, K.prototype.getPolylinePositionsLength = function(e) { var t; if (this.mode === C.SCENE3D || !N(e)) return t = e.getPositions().length, 4 * t - 4; var r = 0,
  4244. i = e._segments.lengths;
  4245. t = i.length; for (var n = 0; t > n; ++n) r += 4 * i[n] - 4; return r };
  4246. var J = new o,
  4247. Q = new o,
  4248. $ = new o,
  4249. et = new o;
  4250. K.prototype.write = function(e, t, i, n, a, l, u) { for (var c = this.mode, h = this.polylines, d = h.length, m = 0; d > m; ++m)
  4251. for (var p, f = h[m], v = f.getWidth(), y = f.getShow() && v > 0, g = this.getSegments(f), _ = g.positions, w = g.lengths, x = _.length, S = f.getPickId(u).color, E = 0, b = 0, T = 0; x > T; ++T) { 0 === T ? (p = et, o.subtract(_[0], _[1], p), o.add(_[0], p, p)) : p = _[T - 1], Q.x = p.x, Q.y = p.y, Q.z = c !== C.SCENE2D ? p.z : 0, p = _[T], J.x = p.x, J.y = p.y, J.z = c !== C.SCENE2D ? p.z : 0, T === x - 1 ? (p = et, o.subtract(_[x - 1], _[x - 2], p), o.add(_[x - 1], p, p)) : p = _[T + 1], $.x = p.x, $.y = p.y, $.z = c !== C.SCENE2D ? p.z : 0; var A = w[E];
  4252. T === b + A && (b += A, ++E); for (var M = 0 === T - b, P = T === b + w[E] - 1, D = M ? 2 : 0, I = P ? 2 : 4, O = D; I > O; ++O) { s.writeElements(J, e, n), s.writeElements(Q, e, n + 6), s.writeElements($, e, n + 12), t[a] = r.floatToByte(S.red), t[a + 1] = r.floatToByte(S.green), t[a + 2] = r.floatToByte(S.blue), t[a + 3] = r.floatToByte(S.alpha); var R = 0 > O - 2 ? -1 : 1;
  4253. i[l] = T / (x - 1), i[l + 1] = 2 * (O % 2) - 1, i[l + 2] = R * v, i[l + 3] = y, n += 18, a += 4, l += 4 } } };
  4254. var tt = new o,
  4255. rt = new o,
  4256. it = new o,
  4257. nt = new o;
  4258. K.prototype.writeForMorph = function(e, t) { for (var r = this.modelMatrix, i = this.polylines, n = i.length, a = 0; n > a; ++a)
  4259. for (var u = i[a], c = u._segments.positions, h = u._segments.lengths, d = c.length, m = 0, p = 0, f = 0; d > f; ++f) { var v;
  4260. 0 === f ? (v = nt, o.subtract(c[0], c[1], v), o.add(c[0], v, v)) : v = c[f - 1], v = l.multiplyByPoint(r, v, rt); var y, g = l.multiplyByPoint(r, c[f], tt);
  4261. f === d - 1 ? (y = nt, o.subtract(c[d - 1], c[d - 2], y), o.add(c[d - 1], y, y)) : y = c[f + 1], y = l.multiplyByPoint(r, y, it); var _ = h[m];
  4262. f === p + _ && (p += _, ++m); for (var w = 0 === f - p, C = f === p + h[m] - 1, x = w ? 2 : 0, S = C ? 2 : 4, E = x; S > E; ++E) s.writeElements(g, e, t), s.writeElements(v, e, t + 6), s.writeElements(y, e, t + 12), t += 18 } };
  4263. var ot = new Array(1);
  4264. K.prototype.updateIndices = function(e, t, r, i) { var n = r.length - 1,
  4265. o = new z(0, i, this);
  4266. r[n].push(o); var a = 0,
  4267. s = e[e.length - 1],
  4268. l = 0;
  4269. s.length > 0 && (l = s[s.length - 1] + 1); for (var c = this.polylines, h = c.length, d = 0; h > d; ++d) { var m = c[d];
  4270. m._locatorBuckets = []; var p; if (this.mode === C.SCENE3D) { p = ot; var f = m.getPositions().length; if (!(f > 0)) continue;
  4271. p[0] = f } else p = m._segments.lengths; var v = p.length; if (v > 0) { for (var y = 0, g = 0; v > g; ++g)
  4272. for (var _ = p[g] - 1, w = 0; _ > w; ++w) l + 4 >= u.SIXTY_FOUR_KILOBYTES - 1 && (m._locatorBuckets.push({ locator: o, count: y }), y = 0, t.push(4), s = [], e.push(s), l = 0, o.count = a, a = 0, i = 0, o = new z(0, 0, this), r[++n] = [o]), s.push(l, l + 2, l + 1), s.push(l + 1, l + 2, l + 3), y += 6, a += 6, i += 6, l += 4;
  4273. m._locatorBuckets.push({ locator: o, count: y }), l + 4 >= u.SIXTY_FOUR_KILOBYTES - 1 && (t.push(0), s = [], e.push(s), l = 0, o.count = a, i = 0, a = 0, o = new z(0, 0, this), r[++n] = [o]) } m._clean() } return o.count = a, i }, K.prototype.getPolylineStartIndex = function(e) { for (var t = this.polylines, r = 0, i = t.length, n = 0; i > n; ++n) { var o = t[n]; if (o === e) break;
  4274. r += o._actualLength } return r };
  4275. var at = { positions: void 0, lengths: void 0 },
  4276. st = new Array(1);
  4277. return K.prototype.getSegments = function(e) { var t = e.getPositions(); if (this.mode === C.SCENE3D) return st[0] = t.length, at.positions = t, at.lengths = st, at;
  4278. N(e) && (t = e._segments.positions); for (var r, i, n = this.ellipsoid, a = this.projection, s = [], l = this.modelMatrix, u = t.length, c = 0; u > c; ++c) r = t[c], i = l.multiplyByPoint(r), s.push(a.project(n.cartesianToCartographic(o.fromCartesian4(i)))); if (s.length > 0) { e._boundingVolume2D = m.fromPoints(s, e._boundingVolume2D); var h = e._boundingVolume2D.center;
  4279. e._boundingVolume2D.center = new o(h.z, h.x, h.y) } return at.positions = s, at.lengths = e._segments.lengths, at }, K.prototype.writeUpdate = function(e, t, r, i) { var n = this.mode,
  4280. a = t._actualLength; if (a) { e += this.getPolylineStartIndex(t); var l, u = new Float32Array(3 * 6 * a),
  4281. c = new Float32Array(4 * a),
  4282. h = 0,
  4283. d = 0,
  4284. m = this.getSegments(t),
  4285. p = m.positions,
  4286. f = m.lengths,
  4287. v = 0,
  4288. y = 0,
  4289. g = t.getWidth(),
  4290. _ = t.getShow() && g > 0;
  4291. a = p.length; for (var w = 0; a > w; ++w) { 0 === w ? (l = et, o.subtract(p[0], p[1], l), o.add(p[0], l, l)) : l = p[w - 1], Q.x = l.x, Q.y = l.y, Q.z = n !== C.SCENE2D ? l.z : 0, l = p[w], J.x = l.x, J.y = l.y, J.z = n !== C.SCENE2D ? l.z : 0, w === a - 1 ? (l = et, o.subtract(p[a - 1], p[a - 2], l), o.add(p[a - 1], l, l)) : l = p[w + 1], $.x = l.x, $.y = l.y, $.z = n !== C.SCENE2D ? l.z : 0; var x = f[v];
  4292. w === y + x && (y += x, ++v); for (var S = 0 === w - y, E = w === y + f[v] - 1, b = S ? 2 : 0, T = E ? 2 : 4, A = b; T > A; ++A) { s.writeElements(J, u, h), s.writeElements(Q, u, h + 6), s.writeElements($, u, h + 12); var M = 0 > A - 2 ? -1 : 1;
  4293. c[d] = w / (a - 1), c[d + 1] = 2 * (A % 2) - 1, c[d + 2] = M * g, c[d + 3] = _, h += 18, d += 4 } } r.copyFromArrayView(u, 18 * Float32Array.BYTES_PER_ELEMENT * e), i.copyFromArrayView(c, 4 * Float32Array.BYTES_PER_ELEMENT * e) } }, G
  4294. }), r("DynamicScene/DynamicPathVisualizer", ["../Core/defined", "../Core/DeveloperError", "../Core/destroyObject", "../Core/Cartesian3", "../Core/Matrix3", "../Core/Matrix4", "../Core/Color", "../Core/Transforms", "../Core/ReferenceFrame", "./SampledPositionProperty", "./CompositePositionProperty", "./TimeIntervalCollectionPositionProperty", "../Scene/Material", "../Scene/SceneMode", "../Scene/PolylineCollection"], function(e, t, r, i, n, o, a, s, l, u, c, h, d, m, p) { "use strict";
  4295. function f(t, r, i, n, o, a, s, l) { var u, c = t._property._times,
  4296. h = s;
  4297. u = t.getValueInReferenceFrame(r, o, l[h]), e(u) && (l[h++] = u); for (var d, m, p, f = !e(n) || n.lessThanOrEquals(r) || n.greaterThanOrEquals(i), v = 0, y = c.length, g = c[v], _ = i, w = !1; y > v;) { if (!f && g.greaterThanOrEquals(n) && (u = t.getValueInReferenceFrame(n, o, l[h]), e(u) && (l[h++] = u), f = !0), g.greaterThan(r) && g.lessThan(_) && !g.equals(n) && (u = t.getValueInReferenceFrame(g, o, l[h]), e(u) && (l[h++] = u)), y - 1 > v) { if (!w) { var C = c[v + 1],
  4298. x = g.getSecondsDifference(C);
  4299. w = x > a, w && (d = Math.floor(x / a), m = 0, p = x / Math.max(d, 2), d = Math.max(d - 2, 1)) } if (w && d > m) { g = g.addSeconds(p), m++; continue } } w = !1, v++, g = c[v] } return u = t.getValueInReferenceFrame(i, o, l[h]), e(u) && (l[h++] = u), h }
  4300. function v(t, r, i, n, o, a, s, l) { for (var u, c = 0, h = s, d = r, m = !e(n) || n.lessThanOrEquals(r) || n.greaterThanOrEquals(i); d.lessThan(i);) !m && d.greaterThanOrEquals(n) && (m = !0, u = t.getValueInReferenceFrame(n, o, l[h]), e(u) && (l[h] = u, h++)), u = t.getValueInReferenceFrame(d, o, l[h]), e(u) && (l[h] = u, h++), c++, d = r.addSeconds(a * c); return u = t.getValueInReferenceFrame(i, o, l[h]), e(u) && (l[h] = u, h++), h }
  4301. function y(t, r, i, n, o, a, s, l) { for (var u = s, c = t.getIntervals(), h = 0; h < c.getLength(); h++) { var d = c.get(0); if (d.start.lessThanOrEquals(i)) { var m = t.getValueInReferenceFrame(i, o, l[u]);
  4302. e(m) && (l[u] = m, u++) } } return u }
  4303. function g(e, t, r, i, n, o, a, s) { for (var l = a, d = e.getIntervals(), m = 0; m < d.getLength(); m++) { var p = d.get(0); if (p.start.lessThanOrEquals(r)) { var _ = p.data;
  4304. l = _ instanceof u ? f(_, p.start, p.stop, i, n, o, l, s) : _ instanceof c ? g(_, p.start, p.stop, i, n, o, l, s) : _ instanceof h ? y(_, p.start, p.stop, i, n, o, l, s) : v(_, p.start, p.stop, i, n, o, l, s) } } return l }
  4305. function _(t, r, i, n, o, a, s) { e(s) || (s = []); var l = 0; return l = t instanceof u ? f(t, r, i, n, o, a, 0, s) : t instanceof c ? g(t, r, i, n, o, a, 0, s) : t instanceof h ? g(t, r, i, n, o, a, 0, s) : v(t, r, i, n, o, a, 0, s), s.length = l, s } var w = new n,
  4306. C = function(e, t) { this._unusedIndexes = [], this._polylineCollection = new p, this._scene = e, this._referenceFrame = t, e.getPrimitives().add(this._polylineCollection) };
  4307. C.prototype.update = function(t) { if (this._referenceFrame === l.INERTIAL) { var r = s.computeIcrfToFixedMatrix(t, w);
  4308. e(r) || (r = s.computeTemeToPseudoFixedMatrix(t, w)), o.fromRotationTranslation(r, i.ZERO, this._polylineCollection.modelMatrix) } }, C.prototype.updateObject = function(t, r) { var i = r.path; if (e(i)) { var n = r.position; if (e(n)) { var o, s, l, u, c = i.show,
  4309. h = r._pathVisualizerIndex,
  4310. m = !e(c) || c.getValue(t); if (m) { s = i.leadTime; var p;
  4311. e(s) && (p = s.getValue(t)), s = i.trailTime; var f;
  4312. e(s) && (f = s.getValue(t)); var v = r.availability,
  4313. y = e(v),
  4314. g = e(p),
  4315. w = e(f);
  4316. m = y || g && w, m && (w && (l = t.addSeconds(-f)), !y || w && !v.start.greaterThan(l) || (l = v.start), g && (u = t.addSeconds(p)), !y || g && !v.stop.lessThan(u) || (u = v.stop), m = l.lessThan(u)) } if (!m) return e(h) && (o = this._polylineCollection.get(h), o.setShow(!1), r._pathVisualizerIndex = void 0, this._unusedIndexes.push(h)), void 0; var C; if (e(h)) o = this._polylineCollection.get(h), C = o.getMaterial().uniforms;
  4317. else { var x = this._unusedIndexes,
  4318. S = x.length;
  4319. S > 0 ? (h = x.pop(), o = this._polylineCollection.get(h)) : (h = this._polylineCollection.getLength(), o = this._polylineCollection.add()), r._pathVisualizerIndex = h, o.dynamicObject = r, o.setWidth(1); var E = o.getMaterial();
  4320. e(E) && E.type === d.PolylineOutlineType || (E = d.fromType(this._scene.getContext(), d.PolylineOutlineType), o.setMaterial(E)), C = E.uniforms, a.clone(a.WHITE, C.color), a.clone(a.BLACK, C.outlineColor), C.outlineWidth = 0 } o.setShow(!0); var b = 60; if (s = i.resolution, e(s) && (b = s.getValue(t)), o.setPositions(_(n, l, u, t, this._referenceFrame, b, o.getPositions())), s = i.color, e(s) && (C.color = s.getValue(t, C.color)), s = i.outlineColor, e(s) && (C.outlineColor = s.getValue(t, C.outlineColor)), s = i.outlineWidth, e(s) && (C.outlineWidth = s.getValue(t)), s = i.width, e(s)) { var T = s.getValue(t);
  4321. e(T) && o.setWidth(T) } } } }, C.prototype.removeObject = function(t) { var r = t._pathVisualizerIndex; if (e(r)) { var i = this._polylineCollection.get(r);
  4322. i.setShow(!1), this._unusedIndexes.push(r), t._pathVisualizerIndex = void 0 } }, C.prototype.destroy = function() { return this._scene.getPrimitives().remove(this._polylineCollection), r(this) }; var x = function(r, i) { if (!e(r)) throw new t("scene is required.");
  4323. this._scene = r, this._updaters = {}, this._dynamicObjectCollection = void 0, this.setDynamicObjectCollection(i) }; return x.prototype.getScene = function() { return this._scene }, x.prototype.getDynamicObjectCollection = function() { return this._dynamicObjectCollection }, x.prototype.setDynamicObjectCollection = function(t) { var r = this._dynamicObjectCollection;
  4324. r !== t && (e(r) && (r.objectsRemoved.removeEventListener(x.prototype._onObjectsRemoved, this), this.removeAllPrimitives()), this._dynamicObjectCollection = t, e(t) && t.objectsRemoved.addEventListener(x.prototype._onObjectsRemoved, this)) }, x.prototype.update = function(r) { if (!e(r)) throw new t("time is requied."); if (e(this._dynamicObjectCollection)) { var i = this._updaters; for (var n in i) i.hasOwnProperty(n) && i[n].update(r); for (var o = this._dynamicObjectCollection.getObjects(), a = 0, s = o.length; s > a; a++) { var u = o[a]; if (e(u.path)) { var c = u.position; if (e(c)) { var h = u._pathUpdater,
  4325. d = l.FIXED;
  4326. this._scene.mode === m.SCENE3D && (d = c.referenceFrame); var p = this._updaters[d];
  4327. h === p && e(p) ? p.updateObject(r, u) : (e(h) && h.removeObject(u), e(p) || (p = new C(this._scene, d), p.update(r), this._updaters[d] = p), u._pathUpdater = p, e(p) && p.updateObject(r, u)) } } } } }, x.prototype.removeAllPrimitives = function() { var t = this._updaters; for (var r in t) t.hasOwnProperty(r) && t[r].destroy(); if (this._updaters = {}, e(this._dynamicObjectCollection))
  4328. for (var i = this._dynamicObjectCollection.getObjects(), n = i.length - 1; n > -1; n--) i[n]._pathUpdater = void 0, i[n]._pathVisualizerIndex = void 0 }, x.prototype.isDestroyed = function() { return !1 }, x.prototype.destroy = function() { return this.removeAllPrimitives(), r(this) }, x.prototype._onObjectsRemoved = function(t, r) { for (var i = r.length - 1; i > -1; i--) { var n = r[i],
  4329. o = n._pathUpdater;
  4330. e(o) && o.removeObject(n) } }, x }), r("DynamicScene/DynamicPointVisualizer", ["../Core/Color", "../Core/defaultValue", "../Core/defined", "../Core/destroyObject", "../Core/DeveloperError", "../Scene/BillboardCollection", "../Renderer/TextureAtlasBuilder"], function(e, t, r, i, n, o, a) { "use strict";
  4331. function s(i, n, o) { var a = o.point; if (r(a)) { var s = o.position; if (r(s)) { var l, d = a.show,
  4332. m = o._pointVisualizerIndex,
  4333. p = o.isAvailable(n) && (!r(d) || d.getValue(n)); if (!p) return r(m) && (l = i._billboardCollection.get(m), l.setShow(!1), l.setImageIndex(-1), o._pointVisualizerIndex = void 0, i._unusedIndexes.push(m)), void 0; var f = !1; if (r(m)) l = i._billboardCollection.get(m);
  4334. else { var v = i._unusedIndexes,
  4335. y = v.length;
  4336. y > 0 ? (m = v.pop(), l = i._billboardCollection.get(m)) : (m = i._billboardCollection.getLength(), l = i._billboardCollection.add()), o._pointVisualizerIndex = m, l.dynamicObject = o, l._visualizerColor = e.WHITE.clone(l._visualizerColor), l._visualizerOutlineColor = e.BLACK.clone(l._visualizerOutlineColor), l._visualizerOutlineWidth = 0, l._visualizerPixelSize = 1, f = !0 } l.setShow(!0), c = s.getValue(n, c), r(c) && l.setPosition(c); var g = a.color; if (r(g) && (u = g.getValue(n, u), e.equals(l._visualizerColor, u) || (e.clone(u, l._visualizerColor), f = !0)), g = a.outlineColor, r(g) && (h = g.getValue(n, h), e.equals(l._visualizerOutlineColor, h) || (e.clone(h, l._visualizerOutlineColor), f = !0)), g = a.outlineWidth, r(g)) { var _ = g.getValue(n);
  4337. l._visualizerOutlineWidth !== _ && (l._visualizerOutlineWidth = _, f = !0) } if (g = a.pixelSize, r(g)) { var w = g.getValue(n);
  4338. l._visualizerPixelSize !== w && (l._visualizerPixelSize = w, f = !0) } if (f) { var C = t(l._visualizerColor, e.WHITE).toCssColorString(),
  4339. x = t(l._visualizerOutlineColor, e.BLACK).toCssColorString(),
  4340. S = t(l._visualizerPixelSize, 3),
  4341. E = t(l._visualizerOutlineWidth, 2),
  4342. b = JSON.stringify([C, S, x, E]);
  4343. i._textureAtlasBuilder.addTextureFromFunction(b, function(e, t) { var r = document.createElement("canvas"),
  4344. i = S + 2 * E;
  4345. r.height = r.width = i; var n = r.getContext("2d");
  4346. n.clearRect(0, 0, i, i), 0 !== E && (n.beginPath(), n.arc(i / 2, i / 2, i / 2, 0, 2 * Math.PI, !0), n.closePath(), n.fillStyle = x, n.fill()), n.beginPath(), n.arc(i / 2, i / 2, S / 2, 0, 2 * Math.PI, !0), n.closePath(), n.fillStyle = C, n.fill(), t(r) }, function(e) { l.setImageIndex(e) }) } } } } var l = function(e, t) { if (!r(e)) throw new n("scene is required.");
  4347. this._scene = e, this._unusedIndexes = [], this._dynamicObjectCollection = void 0; var i = this._billboardCollection = new o,
  4348. s = this._textureAtlas = e.getContext().createTextureAtlas();
  4349. this._textureAtlasBuilder = new a(s), i.setTextureAtlas(s), e.getPrimitives().add(i), this.setDynamicObjectCollection(t) };
  4350. l.prototype.getScene = function() { return this._scene }, l.prototype.getDynamicObjectCollection = function() { return this._dynamicObjectCollection }, l.prototype.setDynamicObjectCollection = function(e) { var t = this._dynamicObjectCollection;
  4351. t !== e && (r(t) && (t.objectsRemoved.removeEventListener(l.prototype._onObjectsRemoved, this), this.removeAllPrimitives()), this._dynamicObjectCollection = e, r(e) && e.objectsRemoved.addEventListener(l.prototype._onObjectsRemoved, this)) }, l.prototype.update = function(e) { if (!r(e)) throw new n("time is requied."); if (r(this._dynamicObjectCollection))
  4352. for (var t = this._dynamicObjectCollection.getObjects(), i = 0, o = t.length; o > i; i++) s(this, e, t[i]) }, l.prototype.removeAllPrimitives = function() { if (this._unusedIndexes = [], this._billboardCollection.removeAll(), r(this._dynamicObjectCollection))
  4353. for (var e = this._dynamicObjectCollection.getObjects(), t = e.length - 1; t > -1; t--) e[t]._pointVisualizerIndex = void 0 }, l.prototype.isDestroyed = function() { return !1 }, l.prototype.destroy = function() { return this.removeAllPrimitives(), this._scene.getPrimitives().remove(this._billboardCollection), i(this) }; var u, c, h; return l.prototype._onObjectsRemoved = function(e, t) { for (var i = this._billboardCollection, n = this._unusedIndexes, o = t.length - 1; o > -1; o--) { var a = t[o],
  4354. s = a._pointVisualizerIndex; if (r(s)) { var l = i.get(s);
  4355. l.setShow(!1), l.setImageIndex(-1), a._pointVisualizerIndex = void 0, n.push(s) } } }, l }), r("Scene/Appearance", ["../Core/defaultValue", "../Core/defined", "../Renderer/BlendingState", "../Renderer/CullFace", "../Renderer/createShaderSource"], function(e, t, r, i, n) { "use strict"; var o = function(t) { t = e(t, e.EMPTY_OBJECT), this.material = t.material, this.vertexShaderSource = t.vertexShaderSource, this.fragmentShaderSource = t.fragmentShaderSource, this.renderState = t.renderState, this.translucent = e(t.translucent, !0), this.closed = e(t.closed, !1) }; return o.prototype.getFragmentShaderSource = function() { return n({ defines: [this.flat ? "FLAT" : "", this.faceForward ? "FACE_FORWARD" : ""], sources: [t(this.material) ? this.material.shaderSource : "", this.fragmentShaderSource] }) }, o.getDefaultRenderState = function(e, t) { var n = { depthTest: { enabled: !0 } }; return e && (n.depthMask = !1, n.blending = r.ALPHA_BLEND), t && (n.cull = { enabled: !0, face: i.BACK }), n }, o }), r("Shaders/Appearances/BasicMaterialAppearanceVS", [], function() { "use strict"; return "attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute vec3 normal;\nvarying vec3 v_positionEC;\nvarying vec3 v_normalEC;\nvoid main()\n{\nvec4 p = czm_computePosition();\nv_positionEC = (czm_modelViewRelativeToEye * p).xyz;\nv_normalEC = czm_normal * normal;\ngl_Position = czm_modelViewProjectionRelativeToEye * p;\n}\n" }), r("Shaders/Appearances/BasicMaterialAppearanceFS", [], function() { "use strict"; return "varying vec3 v_positionEC;\nvarying vec3 v_normalEC;\nvoid main()\n{\nvec3 positionToEyeEC = -v_positionEC;\nvec3 normalEC;\n#ifdef FACE_FORWARD\nnormalEC = normalize(faceforward(v_normalEC, vec3(0.0, 0.0, 1.0), -v_normalEC));\n#else\nnormalEC = normalize(v_normalEC);\n#endif\nczm_materialInput materialInput;\nmaterialInput.normalEC = normalEC;\nmaterialInput.positionToEyeEC = positionToEyeEC;\nczm_material material = czm_getMaterial(materialInput);\n#ifdef FLAT\ngl_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n#else\ngl_FragColor = czm_phong(normalize(positionToEyeEC), material);\n#endif\n}\n" }), r("Shaders/Appearances/TexturedMaterialAppearanceVS", [], function() { "use strict"; return "attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute vec3 normal;\nattribute vec2 st;\nvarying vec3 v_positionEC;\nvarying vec3 v_normalEC;\nvarying vec2 v_st;\nvoid main()\n{\nvec4 p = czm_computePosition();\nv_positionEC = (czm_modelViewRelativeToEye * p).xyz;\nv_normalEC = czm_normal * normal;\nv_st = st;\ngl_Position = czm_modelViewProjectionRelativeToEye * p;\n}\n" }), r("Shaders/Appearances/TexturedMaterialAppearanceFS", [], function() { "use strict"; return "varying vec3 v_positionEC;\nvarying vec3 v_normalEC;\nvarying vec2 v_st;\nvoid main()\n{\nvec3 positionToEyeEC = -v_positionEC;\nvec3 normalEC;\n#ifdef FACE_FORWARD\nnormalEC = normalize(faceforward(v_normalEC, vec3(0.0, 0.0, 1.0), -v_normalEC));\n#else\nnormalEC = normalize(v_normalEC);\n#endif\nczm_materialInput materialInput;\nmaterialInput.normalEC = normalEC;\nmaterialInput.positionToEyeEC = positionToEyeEC;\nmaterialInput.st = v_st;\nczm_material material = czm_getMaterial(materialInput);\n#ifdef FLAT\ngl_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n#else\ngl_FragColor = czm_phong(normalize(positionToEyeEC), material);\n#endif\n}\n" }), r("Shaders/Appearances/AllMaterialAppearanceVS", [], function() { "use strict"; return "attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute vec3 normal;\nattribute vec3 tangent;\nattribute vec3 binormal;\nattribute vec2 st;\nvarying vec3 v_positionEC;\nvarying vec3 v_normalEC;\nvarying vec3 v_tangentEC;\nvarying vec3 v_binormalEC;\nvarying vec2 v_st;\nvoid main()\n{\nvec4 p = czm_computePosition();\nv_positionEC = (czm_modelViewRelativeToEye * p).xyz;\nv_normalEC = czm_normal * normal;\nv_tangentEC = czm_normal * tangent;\nv_binormalEC = czm_normal * binormal;\nv_st = st;\ngl_Position = czm_modelViewProjectionRelativeToEye * p;\n}\n" }), r("Shaders/Appearances/AllMaterialAppearanceFS", [], function() { "use strict"; return "varying vec3 v_positionEC;\nvarying vec3 v_normalEC;\nvarying vec3 v_tangentEC;\nvarying vec3 v_binormalEC;\nvarying vec2 v_st;\nvoid main()\n{\nvec3 positionToEyeEC = -v_positionEC;\nmat3 tangentToEyeMatrix = czm_tangentToEyeSpaceMatrix(v_normalEC, v_tangentEC, v_binormalEC);\nvec3 normalEC;\n#ifdef FACE_FORWARD\nnormalEC = normalize(faceforward(v_normalEC, vec3(0.0, 0.0, 1.0), -v_normalEC));\n#else\nnormalEC = normalize(v_normalEC);\n#endif\nczm_materialInput materialInput;\nmaterialInput.normalEC = normalEC;\nmaterialInput.tangentToEyeMatrix = tangentToEyeMatrix;\nmaterialInput.positionToEyeEC = positionToEyeEC;\nmaterialInput.st = v_st;\nczm_material material = czm_getMaterial(materialInput);\n#ifdef FLAT\ngl_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n#else\ngl_FragColor = czm_phong(normalize(positionToEyeEC), material);\n#endif\n}\n" }), r("Scene/MaterialAppearance", ["../Core/defaultValue", "../Core/defined", "../Core/freezeObject", "../Core/VertexFormat", "./Material", "./Appearance", "../Shaders/Appearances/BasicMaterialAppearanceVS", "../Shaders/Appearances/BasicMaterialAppearanceFS", "../Shaders/Appearances/TexturedMaterialAppearanceVS", "../Shaders/Appearances/TexturedMaterialAppearanceFS", "../Shaders/Appearances/AllMaterialAppearanceVS", "../Shaders/Appearances/AllMaterialAppearanceFS"], function(e, t, r, i, n, o, a, s, l, u, c, h) { "use strict"; var d = function(r) { r = e(r, e.EMPTY_OBJECT); var i = e(r.translucent, !0),
  4356. a = e(r.closed, !1),
  4357. s = e(r.materialSupport, d.MaterialSupport.TEXTURED);
  4358. this.material = t(r.material) ? r.material : n.fromType(void 0, n.ColorType), this.vertexShaderSource = e(r.vertexShaderSource, s.vertexShaderSource), this.fragmentShaderSource = e(r.fragmentShaderSource, s.fragmentShaderSource), this.renderState = e(r.renderState, o.getDefaultRenderState(i, a)), this.materialSupport = s, this.vertexFormat = s.vertexFormat, this.flat = e(r.flat, !1), this.faceForward = e(r.faceForward, !1), this.translucent = i, this.closed = a }; return d.prototype.getFragmentShaderSource = o.prototype.getFragmentShaderSource, d.MaterialSupport = { BASIC: r({ vertexFormat: i.POSITION_AND_NORMAL, vertexShaderSource: a, fragmentShaderSource: s }), TEXTURED: r({ vertexFormat: i.POSITION_NORMAL_AND_ST, vertexShaderSource: l, fragmentShaderSource: u }), ALL: r({ vertexFormat: i.ALL, vertexShaderSource: c, fragmentShaderSource: h }) }, d }), r("Shaders/Appearances/EllipsoidSurfaceAppearanceVS", [], function() { "use strict"; return "attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute vec2 st;\nvarying vec3 v_positionMC;\nvarying vec3 v_positionEC;\nvarying vec2 v_st;\nvoid main()\n{\nvec4 p = czm_computePosition();\nv_positionMC = position3DHigh + position3DLow;\nv_positionEC = (czm_modelViewRelativeToEye * p).xyz;\nv_st = st;\ngl_Position = czm_modelViewProjectionRelativeToEye * p;\n}\n" }), r("Shaders/Appearances/EllipsoidSurfaceAppearanceFS", [], function() { "use strict"; return "varying vec3 v_positionMC;\nvarying vec3 v_positionEC;\nvarying vec2 v_st;\nvoid main()\n{\nczm_materialInput materialInput;\nvec3 normalEC = czm_normal3D * czm_geodeticSurfaceNormal(v_positionMC, vec3(0.0), vec3(1.0));\n#ifdef FACE_FORWARD\nnormalEC = normalize(faceforward(normalEC, vec3(0.0, 0.0, 1.0), -normalEC));\n#else\nnormalEC = normalize(normalEC);\n#endif\nmaterialInput.s = v_st.s;\nmaterialInput.st = v_st;\nmaterialInput.str = vec3(v_st, 0.0);\nmaterialInput.normalEC = normalEC;\nmaterialInput.tangentToEyeMatrix = czm_eastNorthUpToEyeCoordinates(v_positionMC, materialInput.normalEC);\nvec3 positionToEyeEC = -v_positionEC;\nmaterialInput.positionToEyeEC = positionToEyeEC;\nczm_material material = czm_getMaterial(materialInput);\n#ifdef FLAT\ngl_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n#else\ngl_FragColor = czm_phong(normalize(positionToEyeEC), material);\n#endif\n}\n" }), r("Scene/EllipsoidSurfaceAppearance", ["../Core/defaultValue", "../Core/defined", "../Core/VertexFormat", "./Material", "./Appearance", "./MaterialAppearance", "../Shaders/Appearances/EllipsoidSurfaceAppearanceVS", "../Shaders/Appearances/EllipsoidSurfaceAppearanceFS"], function(e, t, r, i, n, o, a, s) {
  4359. "use strict";
  4360. var l = function(r) { r = e(r, e.EMPTY_OBJECT); var o = e(r.translucent, !0),
  4361. u = e(r.aboveGround, !1);
  4362. this.material = t(r.material) ? r.material : i.fromType(void 0, i.ColorType), this.vertexShaderSource = e(r.vertexShaderSource, a), this.fragmentShaderSource = e(r.fragmentShaderSource, s), this.renderState = e(r.renderState, n.getDefaultRenderState(o, !u)), this.vertexFormat = l.VERTEX_FORMAT, this.flat = e(r.flat, !1), this.faceForward = e(r.faceForward, !1), this.translucent = o, this.closed = !u, this.aboveGround = u };
  4363. return l.VERTEX_FORMAT = r.POSITION_AND_ST, l.prototype.getFragmentShaderSource = n.prototype.getFragmentShaderSource, l
  4364. }), r("Renderer/VertexLayout", ["../Core/Enumeration"], function(e) { "use strict"; var t = { SEPARATE: new e(0, "SEPARATE"), INTERLEAVED: new e(1, "INTERLEAVED"), validate: function(e) { return e === t.SEPARATE || e === t.INTERLEAVED } }; return t }), r("Scene/PrimitivePipeline", ["../Core/defined", "../Core/defaultValue", "../Core/Color", "../Core/ComponentDatatype", "../Core/DeveloperError", "../Core/FeatureDetection", "../Core/Geometry", "../Core/GeometryAttribute", "../Core/GeometryPipeline", "../Core/Matrix4"], function(e, t, r, i, n, o, a, s, l, u) { "use strict";
  4365. function c(e, t, r) { var i, n = !r,
  4366. o = e.length; if (!n && o > 1) { var a = e[0].modelMatrix; for (i = 1; o > i; ++i)
  4367. if (!u.equals(a, e[i].modelMatrix)) { n = !0; break } } if (n)
  4368. for (i = 0; o > i; ++i) l.transformToWorldCoordinates(e[i]);
  4369. else u.clone(e[0].modelMatrix, t) }
  4370. function h(e, t) { for (var n = e.length, o = 0; n > o; ++o) { var a = e[o],
  4371. l = a.geometry,
  4372. u = l.attributes,
  4373. c = u.position,
  4374. h = 4 * (c.values.length / c.componentsPerAttribute);
  4375. u.pickColor = new s({ componentDatatype: i.UNSIGNED_BYTE, componentsPerAttribute: 4, normalize: !0, values: new Uint8Array(h) }); for (var d = t[o], m = r.floatToByte(d.red), p = r.floatToByte(d.green), f = r.floatToByte(d.blue), v = r.floatToByte(d.alpha), y = u.pickColor.values, g = 0; h > g; g += 4) y[g] = m, y[g + 1] = p, y[g + 2] = f, y[g + 3] = v } }
  4376. function d(t) { var r, i = t.length,
  4377. n = [],
  4378. o = t[0].attributes; for (r in o)
  4379. if (o.hasOwnProperty(r)) { for (var a = o[r], s = !0, l = 1; i > l; ++l) { var u = t[l].attributes[r]; if (!e(u) || a.componentDatatype.value !== u.componentDatatype.value || a.componentsPerAttribute !== u.componentsPerAttribute || a.normalize !== u.normalize) { s = !1; break } } s && n.push(r) }
  4380. return n }
  4381. function m(e, t) { for (var r = e.length, n = 0; r > n; ++n)
  4382. for (var o = e[n], l = o.attributes, u = o.geometry, c = a.computeNumberOfVertices(u), h = t.length, d = 0; h > d; ++d) { for (var m = t[d], p = l[m], f = p.componentDatatype, v = p.value, y = v.length, g = i.createTypedArray(f, c * y), _ = 0; c > _; ++_) g.set(v, _ * y);
  4383. u.attributes[m] = new s({ componentDatatype: f, componentsPerAttribute: y, normalize: p.normalize, values: g }) } }
  4384. function p(e) { var t, r = e.instances,
  4385. i = e.pickIds,
  4386. o = e.projection,
  4387. a = e.elementIndexUintSupported,
  4388. s = e.allow3DOnly,
  4389. u = e.vertexCacheOptimize,
  4390. p = e.modelMatrix,
  4391. f = r.length,
  4392. v = r[0].geometry.primitiveType; for (t = 1; f > t; ++t)
  4393. if (r[t].geometry.primitiveType.value !== v.value) throw new n("All instance geometries must have the same primitiveType."); if (c(r, p, s), !s)
  4394. for (t = 0; f > t; ++t) l.wrapLongitude(r[t].geometry);
  4395. h(r, i); var y = d(r); if (m(r, y), u)
  4396. for (t = 0; f > t; ++t) l.reorderForPostVertexCache(r[t].geometry), l.reorderForPreVertexCache(r[t].geometry); var g = l.combine(r); return s ? l.encodeAttribute(g, "position", "position3DHigh", "position3DLow") : (l.projectTo2D(g, o), l.encodeAttribute(g, "position3D", "position3DHigh", "position3DLow"), l.encodeAttribute(g, "position2D", "position2DHigh", "position2DLow")), a ? [g] : l.fitToUnsignedShortIndices(g) }
  4397. function f(e, t, r) { for (var n = [], o = e.attributes, a = r.length, s = 0; a > s; ++s) { var l = r[s],
  4398. u = o[l],
  4399. c = u.componentDatatype;
  4400. c.value === i.DOUBLE.value && (c = i.FLOAT); var h = i.createTypedArray(c, u.values);
  4401. n.push({ index: t[l], componentDatatype: c, componentsPerAttribute: u.componentsPerAttribute, normalize: u.normalize, values: h }), delete o[l] } return n }
  4402. function v(r, i, n) { for (var o = [], s = d(r), l = r.length, u = {}, c = {}, h = 0; l > h; ++h)
  4403. for (var m = r[h], p = a.computeNumberOfVertices(m.geometry), f = s.length, v = 0; f > v; ++v)
  4404. for (var y = s[v], g = n[y], _ = p; _ > 0;) { for (var w, C = t(c[y], 0), x = i[C], S = x.length, E = 0; S > E && (w = x[E], w.index !== g); ++E);
  4405. e(o[h]) || (o[h] = {}), e(o[h][y]) || (o[h][y] = { dirty: !1, value: m.attributes[y].value, indices: [] }); var b, T = w.values.length / w.componentsPerAttribute,
  4406. A = t(u[y], 0);
  4407. T > A + _ ? (b = _, o[h][y].indices.push({ attribute: w, offset: A, count: b }), u[y] = A + _) : (b = T - A, o[h][y].indices.push({ attribute: w, offset: A, count: b }), u[y] = 0, c[y] = C + 1), _ -= b }
  4408. return o }
  4409. function y(e) { return { type: e.constructor.name, buffer: e.buffer } }
  4410. function g(e) { return new w[e.type](e.buffer) } if (!o.supportsTypedArrays()) return {}; var _ = {};
  4411. _.combineGeometry = function(e) { for (var t = { instances: e.instances, pickIds: e.pickIds, ellipsoid: e.ellipsoid, projection: e.projection, elementIndexUintSupported: e.elementIndexUintSupported, allow3DOnly: e.allow3DOnly, vertexCacheOptimize: e.vertexCacheOptimize, modelMatrix: u.clone(e.modelMatrix) }, r = p(t), i = l.createAttributeIndices(r[0]), n = t.instances, o = d(n), a = [], s = r.length, c = 0; s > c; ++c) { var h = r[c];
  4412. a.push(f(h, i, o)) } var m = v(n, a, i); return { geometries: r, modelMatrix: t.modelMatrix, attributeIndices: i, vaAttributes: a, vaAttributeIndices: m } }; var w = { Int8Array: Int8Array, Uint8Array: Uint8Array, Int16Array: Int16Array, Uint16Array: Uint16Array, Int32Array: Int32Array, Uint32Array: Uint32Array, Float32Array: Float32Array, Float64Array: Float64Array }; return _.transferGeometry = function(t, r) { var i, n = t.attributes; for (var o in n) n.hasOwnProperty(o) && e(n[o]) && e(n[o].values) && (i = n[o].values, r.indexOf(n[o].values.buffer) < 0 && r.push(i.buffer), e(i.type) || (n[o].values = y(i)));
  4413. e(t.indices) && (i = t.indices, r.push(i.buffer), e(i.type) || (t.indices = y(t.indices))) }, _.transferGeometries = function(e, t) { for (var r = e.length, i = 0; r > i; ++i) _.transferGeometry(e[i], t) }, _.transferPerInstanceAttributes = function(e, t) { for (var r = e.length, i = 0; r > i; ++i)
  4414. for (var n = e[i], o = n.length, a = 0; o > a; ++a) { var s = n[a].values;
  4415. t.push(s.buffer), n[a].values = y(s) } }, _.transferInstances = function(e, t) { for (var r = e.length, i = 0; r > i; ++i) { var n = e[i];
  4416. _.transferGeometry(n.geometry, t) } }, _.receiveGeometry = function(t) { var r = t.attributes; for (var i in r) r.hasOwnProperty(i) && e(r[i]) && e(r[i].values) && (r[i].values = g(r[i].values));
  4417. e(t.indices) && (t.indices = g(t.indices)) }, _.receiveGeometries = function(e) { for (var t = e.length, r = 0; t > r; ++r) _.receiveGeometry(e[r]) }, _.receivePerInstanceAttributes = function(e) { for (var t = e.length, r = 0; t > r; ++r)
  4418. for (var i = e[r], n = i.length, o = 0; n > o; ++o) i[o].values = g(i[o].values) }, _.receiveInstances = function(e) { for (var t = e.length, r = 0; t > r; ++r) { var i = e[r];
  4419. _.receiveGeometry(i.geometry) } }, _ }), r("Scene/PrimitiveState", ["../Core/Enumeration"], function(e) { "use strict"; var t = { READY: new e(0, "READY"), CREATING: new e(1, "CREATING"), CREATED: new e(2, "CREATED"), COMBINING: new e(3, "COMBINING"), COMBINED: new e(4, "COMBINED"), COMPLETE: new e(5, "COMPLETE"), FAILED: new e(6, "FAILED") }; return t }), r("Scene/Primitive", ["../Core/defaultValue", "../Core/defined", "../Core/DeveloperError", "../Core/destroyObject", "../Core/Matrix4", "../Core/BoundingSphere", "../Core/Geometry", "../Core/GeometryAttribute", "../Core/GeometryAttributes", "../Core/GeometryInstance", "../Core/GeometryInstanceAttribute", "../Core/ComponentDatatype", "../Core/TaskProcessor", "../Core/GeographicProjection", "../Core/Queue", "../Core/clone", "../Renderer/BufferUsage", "../Renderer/VertexLayout", "../Renderer/CommandLists", "../Renderer/DrawCommand", "../Renderer/createShaderSource", "../Renderer/CullFace", "./PrimitivePipeline", "./PrimitiveState", "./SceneMode", "../ThirdParty/when"], function(e, t, r, i, n, o, a, s, l, u, c, h, d, m, p, f, v, y, g, _, w, C, x, S, E, b) { "use strict";
  4420. function T(e) { return new s({ componentDatatype: e.componentDatatype, componentsPerAttribute: e.componentsPerAttribute, normalize: e.normalize, values: new e.values.constructor(e.values) }) }
  4421. function A(e) { var r = e.attributes,
  4422. i = new l; for (var n in r) r.hasOwnProperty(n) && t(r[n]) && (i[n] = T(r[n])); var s; if (t(e.indices)) { var u = e.indices;
  4423. s = new u.constructor(u) } return new a({ attributes: i, indices: s, primitiveType: e.primitiveType, boundingSphere: o.clone(e.boundingSphere) }) }
  4424. function M(e) { return new c({ componentDatatype: e.componentDatatype, componentsPerAttribute: e.componentsPerAttribute, normalize: e.normalize, value: new e.value.constructor(e.value) }) }
  4425. function P(e, t) { var r = e.attributes,
  4426. i = {}; for (var o in r) r.hasOwnProperty(o) && (i[o] = M(r[o])); return new u({ geometry: t, modelMatrix: n.clone(e.modelMatrix), attributes: i }) }
  4427. function D(e, t) { var r;
  4428. r = e._allow3DOnly ? "" : "attribute vec3 position2DHigh;\nattribute vec3 position2DLow;\n"; var i = "\nvec4 czm_computePosition()\n{\n"; return i += e._allow3DOnly ? " return czm_translateRelativeToEye(position3DHigh, position3DLow);\n" : " vec4 p;\n if (czm_morphTime == 1.0)\n {\n p = czm_translateRelativeToEye(position3DHigh, position3DLow);\n }\n else if (czm_morphTime == 0.0)\n {\n p = czm_translateRelativeToEye(position2DHigh.zxy, position2DLow.zxy);\n }\n else\n {\n p = czm_columbusViewMorph(\n czm_translateRelativeToEye(position2DHigh.zxy, position2DLow.zxy),\n czm_translateRelativeToEye(position3DHigh, position3DLow),\n czm_morphTime);\n }\n return p;\n", i += "}\n\n", r + t + i }
  4429. function I(e) { var t = e.replace(/void\s+main\s*\(\s*(?:void)?\s*\)/g, "void czm_old_main()"),
  4430. r = "attribute vec4 pickColor; \nvarying vec4 czm_pickColor; \nvoid main() \n{ \n czm_old_main(); \n czm_pickColor = pickColor; \n}"; return t + "\n" + r }
  4431. function O(e, r) { if (!t(e._attributeIndices.show)) return r; var i = r.replace(/void\s+main\s*\(\s*(?:void)?\s*\)/g, "void czm_non_show_main()"),
  4432. n = "attribute float show;\nvoid main() \n{ \n czm_non_show_main(); \n gl_Position *= show; \n}"; return i + "\n" + n }
  4433. function R(e, i) { var n = e.getVertexAttributes(); for (var o in n)
  4434. if (n.hasOwnProperty(o) && !t(i[o])) throw new r("Appearance/Geometry mismatch. The appearance requires vertex shader attribute input '" + o + "', which was not computed as part of the Geometry. Use the appearance's vertexFormat property when constructing the geometry.") }
  4435. function L(e, t) { return function() { return t[e].value } }
  4436. function z(e, i, n) { return function(o) { if (!t(o) || !t(o.length) || o.length < 1 || o.length > 4) throw new r("value must be and array with length between 1 and 4."); var a = i[e];
  4437. a.value = o, a.dirty || (n.push(a), a.dirty = !0) } } var N = function(t) { t = e(t, e.EMPTY_OBJECT), this.geometryInstances = t.geometryInstances, this.appearance = t.appearance, this._appearance = void 0, this._material = void 0, this.asynchronous = e(t.asynchronous, !0), this.modelMatrix = n.IDENTITY.clone(), this.show = !0, this.state = S.READY, this._createdGeometries = [], this._geometries = [], this._vaAttributes = void 0, this._error = void 0, this._vertexCacheOptimize = e(t.vertexCacheOptimize, !0), this._releaseGeometryInstances = e(t.releaseGeometryInstances, !0), this._allow3DOnly = e(t.allow3DOnly, !1), this._boundingSphere = void 0, this._boundingSphere2D = void 0, this._perInstanceAttributeIndices = void 0, this._instanceIds = [], this._lastPerInstanceAttributeIndex = 0, this._dirtyAttributes = [], this._va = [], this._attributeIndices = void 0, this._primitiveType = void 0, this._frontFaceRS = void 0, this._backFaceRS = void 0, this._sp = void 0, this._pickSP = void 0, this._pickIds = [], this._commandLists = new g },
  4438. F = new d("taskDispatcher", Number.POSITIVE_INFINITY); return N.prototype.update = function(r, i, a) { if (this.show && (t(this.geometryInstances) || 0 !== this._va.length) && t(this.appearance) && (i.mode === E.SCENE3D || !this._allow3DOnly) && (i.passes.color || i.passes.pick)) { var s, l, u, c, d, p, g, T, M, L, z, N, B, V, q, k = i.scene2D.projection,
  4439. U = this._commandLists.colorList,
  4440. W = this._commandLists.pickList,
  4441. G = this; if (this.state !== S.COMPLETE && this.state !== S.COMBINED)
  4442. if (this.asynchronous) { if (this.state === S.FAILED) throw this._error; if (this.state === S.READY) { z = Array.isArray(this.geometryInstances) ? this.geometryInstances : [this.geometryInstances], p = z.length; var H = []; for (g = 0; p > g; ++g) u = z[g].geometry, this._instanceIds.push(z[g].id), t(u.attributes) && t(u.primitiveType) ? this._createdGeometries.push({ geometry: A(u), index: g }) : H.push(F.scheduleTask({ task: u._workerName, geometry: u, index: g }));
  4443. this.state = S.CREATING, b.all(H, function(e) { G._geometries = e, G.state = S.CREATED }, function(e) { G._error = e, G.state = S.FAILED }) } else if (this.state === S.CREATED) { for (z = Array.isArray(this.geometryInstances) ? this.geometryInstances : [this.geometryInstances], N = new Array(z.length), B = this._geometries.concat(this._createdGeometries), p = B.length, g = 0; p > g; ++g) u = B[g], M = u.index, N[M] = P(z[M], u.geometry);
  4444. p = N.length; var j = []; for (x.transferInstances(N, j), V = [], g = 0; p > g; ++g) q = r.createPickId(e(z[g].id, this)), this._pickIds.push(q), V.push(q.color);
  4445. L = F.scheduleTask({ task: "combineGeometry", instances: N, pickIds: V, ellipsoid: k.getEllipsoid(), isGeographic: k instanceof m, elementIndexUintSupported: r.getElementIndexUint(), allow3DOnly: this._allow3DOnly, vertexCacheOptimize: this._vertexCacheOptimize, modelMatrix: this.modelMatrix }, j), this.state = S.COMBINING, b(L, function(e) { x.receiveGeometries(e.geometries), x.receivePerInstanceAttributes(e.vaAttributes), G._geometries = e.geometries, G._attributeIndices = e.attributeIndices, G._vaAttributes = e.vaAttributes, G._perInstanceAttributeIndices = e.vaAttributeIndices, n.clone(e.modelMatrix, G.modelMatrix), G.state = S.COMBINED }, function(e) { G._error = e, G.state = S.FAILED }) } } else { for (z = Array.isArray(this.geometryInstances) ? this.geometryInstances : [this.geometryInstances], p = z.length, B = this._createdGeometries, g = 0; p > g; ++g) u = z[g].geometry, this._instanceIds.push(z[g].id), t(u.attributes) && t(u.primitiveType) ? B.push({ geometry: A(u), index: g }) : B.push({ geometry: u.constructor.createGeometry(u), index: g }); for (N = new Array(z.length), p = B.length, g = 0; p > g; ++g) u = B[g], M = u.index, N[M] = P(z[M], u.geometry); for (V = [], g = 0; p > g; ++g) q = r.createPickId(e(z[g].id, this)), this._pickIds.push(q), V.push(q.color); var Y = x.combineGeometry({ instances: N, pickIds: V, ellipsoid: k.getEllipsoid(), isGeographic: k, elementIndexUintSupported: r.getElementIndexUint(), allow3DOnly: this._allow3DOnly, vertexCacheOptimize: this._vertexCacheOptimize, modelMatrix: this.modelMatrix });
  4446. this._geometries = Y.geometries, this._attributeIndices = Y.attributeIndices, this._vaAttributes = Y.vaAttributes, this._perInstanceAttributeIndices = Y.vaAttributeIndices, n.clone(Y.modelMatrix, this.modelMatrix), this.state = S.COMBINED }
  4447. if (this.state === S.COMBINED) { B = this._geometries; var X = this._attributeIndices,
  4448. Z = this._vaAttributes;
  4449. this._boundingSphere = o.clone(B[0].boundingSphere), !this._allow3DOnly && t(this._boundingSphere) && (this._boundingSphere2D = o.projectTo2D(this._boundingSphere, k)); var K = []; for (p = B.length, g = 0; p > g; ++g) { u = B[g], c = Z[g]; var J = c.length; for (T = 0; J > T; ++T) d = c[T], d.vertexBuffer = r.createVertexBuffer(d.values, v.DYNAMIC_DRAW), delete d.values;
  4450. K.push(r.createVertexArrayFromGeometry({ geometry: u, attributeIndices: X, bufferUsage: v.STATIC_DRAW, vertexLayout: y.INTERLEAVED, vertexArrayAttributes: c })) } this._va = K, this._primitiveType = B[0].primitiveType, this._releaseGeometryInstances && (this.geometryInstances = void 0), this._geomtries = void 0, this._createdGeometries = void 0, this.state = S.COMPLETE } if (this.state === S.COMPLETE) { var Q = this.appearance,
  4451. $ = Q.material,
  4452. et = !1,
  4453. tt = !1; if (this._appearance !== Q ? (this._appearance = Q, this._material = $, et = !0, tt = !0) : this._material !== $ && (this._material = $, tt = !0), et)
  4454. if (Q.closed && Q.translucent) { var rt = f(Q.renderState, !1);
  4455. rt.cull = { enabled: !0, face: C.BACK }, this._frontFaceRS = r.createRenderState(rt), rt.cull.face = C.FRONT, this._backFaceRS = r.createRenderState(rt) } else this._frontFaceRS = r.createRenderState(Q.renderState); if (tt) { var it = r.getShaderCache(),
  4456. nt = D(this, Q.vertexShaderSource);
  4457. nt = O(this, nt); var ot = Q.getFragmentShaderSource(),
  4458. at = w({ sources: [ot], pickColorQualifier: "varying" });
  4459. this._sp = it.replaceShaderProgram(this._sp, nt, ot, this._attributeIndices), this._pickSP = it.replaceShaderProgram(this._pickSP, I(nt), at, this._attributeIndices), R(this._sp, this._attributeIndices), R(this._pickSP, this._attributeIndices) } if (et || tt) { var st = t($) ? $._uniforms : void 0;
  4460. t(this._backFaceRS) ? (U.length = 2 * this._va.length, W.length = 2 * this._va.length) : (U.length = this._va.length, W.length = this._va.length), p = U.length; var lt = 0; for (g = 0; p > g; ++g) t(this._backFaceRS) && (s = U[g], t(s) || (s = U[g] = new _), s.owner = this, s.primitiveType = this._primitiveType, s.vertexArray = this._va[lt], s.renderState = this._backFaceRS, s.shaderProgram = this._sp, s.uniformMap = st, l = W[g], t(l) || (l = W[g] = new _), l.owner = this, l.primitiveType = this._primitiveType, l.vertexArray = this._va[lt], l.renderState = this._backFaceRS, l.shaderProgram = this._pickSP, l.uniformMap = st, ++g), s = U[g], t(s) || (s = U[g] = new _), s.owner = this, s.primitiveType = this._primitiveType, s.vertexArray = this._va[lt], s.renderState = this._frontFaceRS, s.shaderProgram = this._sp, s.uniformMap = st, l = W[g], t(l) || (l = W[g] = new _), l.owner = this, l.primitiveType = this._primitiveType, l.vertexArray = this._va[lt], l.renderState = this._frontFaceRS, l.shaderProgram = this._pickSP, l.uniformMap = st, ++lt } if (this._dirtyAttributes.length > 0) { for (c = this._dirtyAttributes, p = c.length, g = 0; p > g; ++g) { d = c[g]; var ut = d.value,
  4461. ct = d.indices,
  4462. ht = ct.length; for (T = 0; ht > T; ++T) { M = ct[T]; for (var dt = M.offset, mt = M.count, pt = M.attribute, ft = pt.componentDatatype, vt = pt.componentsPerAttribute, yt = h.createTypedArray(ft, mt * vt), gt = 0; mt > gt; ++gt) yt.set(ut, gt * vt); var _t = dt * vt * ft.sizeInBytes;
  4463. pt.vertexBuffer.copyFromArrayView(yt, _t) } d.dirty = !1 } c.length = 0 } var wt; for (i.mode === E.SCENE3D ? wt = this._boundingSphere : i.mode === E.COLUMBUS_VIEW ? wt = this._boundingSphere2D : i.mode === E.SCENE2D && t(this._boundingSphere2D) ? (wt = o.clone(this._boundingSphere2D), wt.center.x = 0) : t(this._boundingSphere) && t(this._boundingSphere2D) && (wt = o.union(this._boundingSphere, this._boundingSphere2D)), p = U.length, g = 0; p > g; ++g) U[g].modelMatrix = this.modelMatrix, W[g].modelMatrix = this.modelMatrix, U[g].boundingVolume = wt, W[g].boundingVolume = wt;
  4464. a.push(this._commandLists) } } }, N.prototype.getGeometryInstanceAttributes = function(e) { if (!t(e)) throw new r("id is required"); if (!t(this._perInstanceAttributeIndices)) throw new r("must call update before calling getGeometryInstanceAttributes"); for (var i = -1, n = this._lastPerInstanceAttributeIndex, o = this._instanceIds, a = o.length, s = 0; a > s; ++s) { var l = (n + s) % a; if (e === o[l]) { i = l; break } } if (-1 === i) return void 0; var u = this._perInstanceAttributeIndices[i],
  4465. c = {}; for (var h in u) u.hasOwnProperty(h) && Object.defineProperty(c, h, { get: L(h, u), set: z(h, u, this._dirtyAttributes) }); return this._lastPerInstanceAttributeIndex = i, c }, N.prototype.isDestroyed = function() { return !1 }, N.prototype.destroy = function() { var e, t;
  4466. this._sp = this._sp && this._sp.release(), this._pickSP = this._pickSP && this._pickSP.release(); var r = this._va; for (e = r.length, t = 0; e > t; ++t) r[t].destroy();
  4467. this._va = void 0; var n = this._pickIds; for (e = n.length, t = 0; e > t; ++t) n[t].destroy(); return this._pickIds = void 0, i(this) }, N }), r("Scene/Polygon", ["../Core/DeveloperError", "../Core/defaultValue", "../Core/defined", "../Core/Color", "../Core/destroyObject", "../Core/Math", "../Core/Ellipsoid", "../Core/GeometryInstance", "../Core/PolygonGeometry", "../Core/PolygonPipeline", "../Core/Queue", "./EllipsoidSurfaceAppearance", "./Primitive", "./Material"], function(e, t, r, i, n, o, a, s, l, u, c, h, d, m) { "use strict"; var p = function(e) { e = t(e, t.EMPTY_OBJECT), this.ellipsoid = t(e.ellipsoid, a.WGS84), this._ellipsoid = void 0, this.granularity = t(e.granularity, o.RADIANS_PER_DEGREE), this._granularity = void 0, this.height = t(e.height, 0), this._height = void 0, this.textureRotationAngle = t(e.textureRotationAngle, 0), this._textureRotationAngle = void 0, this.show = t(e.show, !0); var r = m.fromType(void 0, m.ColorType);
  4468. r.uniforms.color = new i(1, 1, 0, .5), this.material = t(e.material, r), this.asynchronous = t(e.asynchronous, !0), this._positions = e.positions, this._polygonHierarchy = e.polygonHierarchy, this._createPrimitive = !1, this._primitive = void 0 }; return p.prototype.getPositions = function() { return this._positions }, p.prototype.setPositions = function(t) { if (r(t) && t.length < 3) throw new e("At least three positions are required.");
  4469. this._positions = t, this._polygonHierarchy = void 0, this._createPrimitive = !0 }, p.prototype.configureFromPolygonHierarchy = function(e) { this._positions = void 0, this._polygonHierarchy = e, this._createPrimitive = !0 }, p.prototype.update = function(t, i, n) { if (!r(this.ellipsoid)) throw new e("this.ellipsoid must be defined."); if (!r(this.material)) throw new e("this.material must be defined."); if (this.granularity < 0) throw new e("this.granularity and scene2D/scene3D overrides must be greater than zero."); if (this.show && (this._createPrimitive || r(this._primitive))) { if (this._createPrimitive || this._ellipsoid !== this.ellipsoid || this._granularity !== this.granularity || this._height !== this.height || this._textureRotationAngle !== this.textureRotationAngle) { if (this._createPrimitive = !1, this._ellipsoid = this.ellipsoid, this._granularity = this.granularity, this._height = this.height, this._textureRotationAngle = this.textureRotationAngle, this._primitive = this._primitive && this._primitive.destroy(), !r(this._positions) && !r(this._polygonHierarchy)) return; var o;
  4470. o = r(this._positions) ? new s({ geometry: l.fromPositions({ positions: this._positions, height: this.height, vertexFormat: h.VERTEX_FORMAT, stRotation: this.textureRotationAngle, ellipsoid: this.ellipsoid, granularity: this.granularity }), id: this }) : new s({ geometry: new l({ polygonHierarchy: this._polygonHierarchy, height: this.height, vertexFormat: h.VERTEX_FORMAT, stRotation: this.textureRotationAngle, ellipsoid: this.ellipsoid, granularity: this.granularity }), id: this }), this._primitive = new d({ geometryInstances: o, appearance: new h({ aboveGround: this.height > 0 }), asynchronous: this.asynchronous }) } this._primitive.appearance.material = this.material, this._primitive.update(t, i, n) } }, p.prototype.isDestroyed = function() { return !1 }, p.prototype.destroy = function() { return this._primitive = this._primitive && this._primitive.destroy(), n(this) }, p }), r("DynamicScene/DynamicPolygonVisualizer", ["../Core/Cartesian3", "../Core/defined", "../Core/DeveloperError", "../Core/destroyObject", "../Scene/Polygon", "../Scene/Material", "./MaterialProperty"], function(e, t, r, i, n, o, a) { "use strict";
  4471. function s(e, r, i) { var s = i.polygon; if (t(s)) { var l, c = s.show,
  4472. h = i.ellipse,
  4473. d = i.position,
  4474. m = i.vertexPositions,
  4475. p = i._polygonVisualizerIndex,
  4476. f = i.isAvailable(r) && (!t(c) || c.getValue(r)),
  4477. v = t(m); if (!(f && (v || t(h) && t(d)))) return t(p) && (l = e._polygonCollection[p], l.show = !1, i._polygonVisualizerIndex = void 0, e._unusedIndexes.push(p)), void 0; var y = e._scene.getContext(); if (t(p)) l = e._polygonCollection[p];
  4478. else { var g = e._unusedIndexes,
  4479. _ = g.length;
  4480. _ > 0 ? (p = g.pop(), l = e._polygonCollection[p]) : (p = e._polygonCollection.length, l = new n, e._polygonCollection.push(l), e._primitives.add(l)), i._polygonVisualizerIndex = p, l.dynamicObject = i, l.material = o.fromType(y, o.ColorType) } l.show = !0; var w;
  4481. w = v ? m.getValue(r) : h.getValue(r, d.getValue(r, u)), l._visualizerPositions !== w && t(w) && w.length > 3 && (l.setPositions(w), l._visualizerPositions = w), l.material = a.getValue(r, y, s.material, l.material) } } var l = function(e, i) { if (!t(e)) throw new r("scene is required.");
  4482. this._scene = e, this._unusedIndexes = [], this._primitives = e.getPrimitives(), this._polygonCollection = [], this._dynamicObjectCollection = void 0, this.setDynamicObjectCollection(i) };
  4483. l.prototype.getScene = function() { return this._scene }, l.prototype.getDynamicObjectCollection = function() { return this._dynamicObjectCollection }, l.prototype.setDynamicObjectCollection = function(e) { var r = this._dynamicObjectCollection;
  4484. r !== e && (t(r) && (r.objectsRemoved.removeEventListener(l.prototype._onObjectsRemoved, this), this.removeAllPrimitives()), this._dynamicObjectCollection = e, t(e) && e.objectsRemoved.addEventListener(l.prototype._onObjectsRemoved, this)) }, l.prototype.update = function(e) { if (!t(e)) throw new r("time is requied."); if (t(this._dynamicObjectCollection))
  4485. for (var i = this._dynamicObjectCollection.getObjects(), n = 0, o = i.length; o > n; n++) s(this, e, i[n]) }, l.prototype.removeAllPrimitives = function() { var e, r; for (e = 0, r = this._polygonCollection.length; r > e; e++) this._primitives.remove(this._polygonCollection[e]); if (t(this._dynamicObjectCollection)) { var i = this._dynamicObjectCollection.getObjects(); for (e = i.length - 1; e > -1; e--) i[e]._polygonVisualizerIndex = void 0 } this._unusedIndexes = [], this._polygonCollection = [] }, l.prototype.isDestroyed = function() { return !1 }, l.prototype.destroy = function() { return this.removeAllPrimitives(), i(this) }; var u = new e; return l.prototype._onObjectsRemoved = function(e, r) { for (var i = this._polygonCollection, n = this._unusedIndexes, o = r.length - 1; o > -1; o--) { var a = r[o],
  4486. s = a._polygonVisualizerIndex; if (t(s)) { var l = i[s];
  4487. l.show = !1, n.push(s), a._polygonVisualizerIndex = void 0 } } }, l }), r("DynamicScene/DynamicPolylineVisualizer", ["../Core/DeveloperError", "../Core/defined", "../Core/destroyObject", "../Core/Cartesian3", "../Core/Color", "../Scene/Material", "../Scene/PolylineCollection"], function(e, t, r, i, n, o, a) { "use strict";
  4488. function s(e, r, i) { var a = i.polyline; if (t(a)) { var s, l = a.show,
  4489. c = i.ellipse,
  4490. h = i.position,
  4491. d = i.vertexPositions,
  4492. m = i._polylineVisualizerIndex,
  4493. p = i.isAvailable(r) && (!t(l) || l.getValue(r)); if (!(p && (t(d) || t(c) && t(h)))) return t(m) && (s = e._polylineCollection.get(m), s.setShow(!1), i._polylineVisualizerIndex = void 0, e._unusedIndexes.push(m)), void 0; var f; if (t(m)) s = e._polylineCollection.get(m), f = s.getMaterial().uniforms;
  4494. else { var v = e._unusedIndexes,
  4495. y = v.length;
  4496. y > 0 ? (m = v.pop(), s = e._polylineCollection.get(m)) : (m = e._polylineCollection.getLength(), s = e._polylineCollection.add()), i._polylineVisualizerIndex = m, s.dynamicObject = i, s.setWidth(1); var g = s.getMaterial();
  4497. t(g) && g.type === o.PolylineOutlineType || (g = o.fromType(e._scene.getContext(), o.PolylineOutlineType), s.setMaterial(g)), f = g.uniforms, n.clone(n.WHITE, f.color), n.clone(n.BLACK, f.outlineColor), f.outlineWidth = 0 } s.setShow(!0); var _;
  4498. _ = t(c) ? c.getValue(r, h.getValue(r, u)) : d.getValue(r), t(_) && s._visualizerPositions !== _ && (s.setPositions(_), s._visualizerPositions = _); var w = a.color; if (t(w) && (f.color = w.getValue(r, f.color)), w = a.outlineColor, t(w) && (f.outlineColor = w.getValue(r, f.outlineColor)), w = a.outlineWidth, t(w) && (f.outlineWidth = w.getValue(r)), w = a.width, t(w)) { var C = w.getValue(r);
  4499. t(C) && s.setWidth(C) } } } var l = function(r, i) { if (!t(r)) throw new e("scene is required.");
  4500. this._scene = r, this._unusedIndexes = [], this._primitives = r.getPrimitives(); var n = this._polylineCollection = new a;
  4501. r.getPrimitives().add(n), this._dynamicObjectCollection = void 0, this.setDynamicObjectCollection(i) };
  4502. l.prototype.getScene = function() { return this._scene }, l.prototype.getDynamicObjectCollection = function() { return this._dynamicObjectCollection }, l.prototype.setDynamicObjectCollection = function(e) { var r = this._dynamicObjectCollection;
  4503. r !== e && (t(r) && (r.objectsRemoved.removeEventListener(l.prototype._onObjectsRemoved, this), this.removeAllPrimitives()), this._dynamicObjectCollection = e, t(e) && e.objectsRemoved.addEventListener(l.prototype._onObjectsRemoved, this)) }, l.prototype.update = function(r) { if (!t(r)) throw new e("time is requied."); if (t(this._dynamicObjectCollection))
  4504. for (var i = this._dynamicObjectCollection.getObjects(), n = 0, o = i.length; o > n; n++) s(this, r, i[n]) }, l.prototype.removeAllPrimitives = function() { var e; if (this._polylineCollection.removeAll(), t(this._dynamicObjectCollection)) { var r = this._dynamicObjectCollection.getObjects(); for (e = r.length - 1; e > -1; e--) r[e]._polylineVisualizerIndex = void 0 } this._unusedIndexes = [] }, l.prototype.isDestroyed = function() { return !1 }, l.prototype.destroy = function() { return this.removeAllPrimitives(), this._scene.getPrimitives().remove(this._polylineCollection), r(this) }; var u = new i; return l.prototype._onObjectsRemoved = function(e, r) { for (var i = this._polylineCollection, n = this._unusedIndexes, o = r.length - 1; o > -1; o--) { var a = r[o],
  4505. s = a._polylineVisualizerIndex; if (t(s)) { var l = i.get(s);
  4506. l.setShow(!1), n.push(s), a._polylineVisualizerIndex = void 0 } } }, l }), r("DynamicScene/DynamicPyramidVisualizer", ["../Core/defaultValue", "../Core/defined", "../Core/DeveloperError", "../Core/destroyObject", "../Core/Color", "../Core/Matrix3", "../Core/Matrix4", "../Scene/CustomSensorVolume", "../Scene/Material", "./MaterialProperty"], function(e, t, r, i, n, o, a, s, l, u) { "use strict";
  4507. function c(r, i, c) { var d = r._scene.getContext(),
  4508. f = c.pyramid; if (t(f)) { var v = f.directions; if (t(v)) { var y = c.position; if (t(y)) { var g = c.orientation; if (t(g)) { var _, w = f.show,
  4509. C = c._pyramidVisualizerIndex,
  4510. x = c.isAvailable(i) && (!t(w) || w.getValue(i)); if (!x) return t(C) && (_ = r._pyramidCollection[C], _.show = !1, c._pyramidVisualizerIndex = void 0, r._unusedIndexes.push(C)), void 0; if (t(C)) _ = r._pyramidCollection[C];
  4511. else { var S = r._unusedIndexes,
  4512. E = S.length;
  4513. E > 0 ? (C = S.pop(), _ = r._pyramidCollection[C]) : (C = r._pyramidCollection.length, _ = new s, r._pyramidCollection.push(_), r._primitives.add(_)), c._pyramidVisualizerIndex = C, _.dynamicObject = c, _.radius = Number.POSITIVE_INFINITY, _.showIntersection = !0, _.intersectionColor = n.YELLOW, _.intersectionWidth = 5, _.material = l.fromType(d, l.ColorType) } _.show = !0; var b = v.getValue(i);
  4514. t(b) && _._visualizerDirections !== b && (_.setDirections(b), _._visualizerDirections = b), m = e(y.getValue(i, m), _._visualizerPosition), p = e(g.getValue(i, p), _._visualizerOrientation), !t(m) || !t(p) || m.equals(_._visualizerPosition) && p.equals(_._visualizerOrientation) || (a.fromRotationTranslation(o.fromQuaternion(p, h), m, _.modelMatrix), m.clone(_._visualizerPosition), p.clone(_._visualizerOrientation)), _.material = u.getValue(i, d, f.material, _.material); var T = f.intersectionColor; if (t(T)) { var A = T.getValue(i, A);
  4515. t(A) && (_.intersectionColor = A) } if (T = f.intersectionWidth, t(T)) { var M = T.getValue(i, M);
  4516. t(M) && (_.intersectionWidth = M) } if (T = f.radius, t(T)) { var P = T.getValue(i, P);
  4517. t(P) && (_.radius = P) } } } } } } var h = new o,
  4518. d = function(e, i) { if (!t(e)) throw new r("scene is required.");
  4519. this._scene = e, this._unusedIndexes = [], this._primitives = e.getPrimitives(), this._pyramidCollection = [], this._dynamicObjectCollection = void 0, this.setDynamicObjectCollection(i) };
  4520. d.prototype.getScene = function() { return this._scene }, d.prototype.getDynamicObjectCollection = function() { return this._dynamicObjectCollection }, d.prototype.setDynamicObjectCollection = function(e) { var r = this._dynamicObjectCollection;
  4521. r !== e && (t(r) && (r.objectsRemoved.removeEventListener(d.prototype._onObjectsRemoved, this), this.removeAllPrimitives()), this._dynamicObjectCollection = e, t(e) && e.objectsRemoved.addEventListener(d.prototype._onObjectsRemoved, this)) }, d.prototype.update = function(e) { if (!t(e)) throw new r("time is requied."); if (t(this._dynamicObjectCollection))
  4522. for (var i = this._dynamicObjectCollection.getObjects(), n = 0, o = i.length; o > n; n++) c(this, e, i[n]) }, d.prototype.removeAllPrimitives = function() { var e, r; for (e = 0, r = this._pyramidCollection.length; r > e; e++) this._primitives.remove(this._pyramidCollection[e]); if (t(this._dynamicObjectCollection)) { var i = this._dynamicObjectCollection.getObjects(); for (e = i.length - 1; e > -1; e--) i[e]._pyramidVisualizerIndex = void 0 } this._unusedIndexes = [], this._pyramidCollection = [] }, d.prototype.isDestroyed = function() { return !1 }, d.prototype.destroy = function() { return this.removeAllPrimitives(), i(this) }; var m, p; return d.prototype._onObjectsRemoved = function(e, r) { for (var i = this._pyramidCollection, n = this._unusedIndexes, o = r.length - 1; o > -1; o--) { var a = r[o],
  4523. s = a._pyramidVisualizerIndex; if (t(s)) { var l = i[s];
  4524. l.show = !1, n.push(s), a._pyramidVisualizerIndex = void 0 } } }, d }), r("DynamicScene/VisualizerCollection", ["../Core/defaultValue", "../Core/defined", "../Core/destroyObject"], function(e, t, r) { "use strict"; var i = function(e, r) { this._visualizers = t(e) ? e : [], this._dynamicObjectCollection = void 0, this.setDynamicObjectCollection(r) }; return i.prototype.getVisualizers = function() { return this._visualizers.slice(0) }, i.prototype.setVisualizers = function(r, i) { i = e(i, !0); var n, o = this._visualizers; if (i)
  4525. for (n = o.length - 1; n > -1; n--) { var a = o[n]; - 1 === r.indexOf(a) && a.destroy() } t(r) || (r = []), this._visualizers = r; var s = this._dynamicObjectCollection; for (n = r.length - 1; n > -1; n--) r[n].setDynamicObjectCollection(s) }, i.prototype.getDynamicObjectCollection = function() { return this._dynamicObjectCollection }, i.prototype.setDynamicObjectCollection = function(e) { var t = this._dynamicObjectCollection; if (t !== e) { this._dynamicObjectCollection = e; for (var r = this._visualizers, i = r.length - 1; i > -1; i--) r[i].setDynamicObjectCollection(e) } }, i.prototype.update = function(e) { for (var t = this._visualizers, r = t.length - 1; r > -1; r--) t[r].update(e) }, i.prototype.removeAllPrimitives = function() { for (var e = this._visualizers, t = e.length - 1; t > -1; t--) e[t].removeAllPrimitives() }, i.prototype.isDestroyed = function() { return !1 }, i.prototype.destroy = function(t) { if (t = e(t, !0), this.removeAllPrimitives(), t)
  4526. for (var i = this._visualizers, n = i.length - 1; n > -1; n--) i[n].destroy(); return r(this) }, i }), r("DynamicScene/DataSourceDisplay", ["../Core/defaultValue", "../Core/defined", "../Core/destroyObject", "../Core/DeveloperError", "../Core/EventHelper", "./DynamicBillboardVisualizer", "./DynamicEllipsoidVisualizer", "./DynamicConeVisualizerUsingCustomSensor", "./DynamicLabelVisualizer", "./DynamicPathVisualizer", "./DynamicPointVisualizer", "./DynamicPolygonVisualizer", "./DynamicPolylineVisualizer", "./DynamicPyramidVisualizer", "./VisualizerCollection"], function(e, t, r, i, n, o, a, s, l, u, c, h, d, m, p) {
  4527. "use strict";
  4528. var f = [o, a, s, l, c, h, d, m, u],
  4529. v = function(r, o, a) {
  4530. if (!t(r)) throw new i("scene is required.");
  4531. if (!t(o)) throw new i("dataSourceCollection is required.");
  4532. this._eventHelper = new n, this._eventHelper.add(o.dataSourceAdded, this._onDataSourceAdded, this), this._eventHelper.add(o.dataSourceRemoved, this._onDataSourceRemoved, this), this._dataSourceCollection = o, this._scene = r, this._timeVaryingSources = [], this._staticSourcesToUpdate = [], this._visualizersTypes = e(a, f).slice(0);
  4533. for (var s = 0, l = o.getLength(); l > s; s++) this._onDataSourceAdded(o, o.get(s))
  4534. };
  4535. return v.prototype.getScene = function() { return this._scene }, v.prototype.getVisualizerTypes = function() { return this._visualizersTypes.slice(0) }, v.prototype.getDataSources = function() { return this._dataSourceCollection }, v.prototype.isDestroyed = function() { return !1 }, v.prototype.destroy = function() { this._eventHelper.removeAll(); for (var e = this._dataSourceCollection, t = 0, i = e.getLength(); i > t; ++t) this._onDataSourceRemoved(this._dataSourceCollection, e.get(t)); return r(this) }, v.prototype.update = function(e) { if (!t(e)) throw new i("time is required."); var r, n = this._timeVaryingSources,
  4536. o = n.length; for (r = 0; o > r; r++) n[r]._visualizerCollection.update(e); var a = this._staticSourcesToUpdate; if (o = a.length, o > 0) { for (r = 0; o > r; r++) a[r]._visualizerCollection.update(e);
  4537. a.length = 0 } }, v.prototype._onDataSourceAdded = function(e, t) { for (var r = this._visualizersTypes, i = r.length, n = new Array(i), o = this._scene, a = 0; i > a; a++) n[a] = new r[a](o); var s = new p(n, t.getDynamicObjectCollection());
  4538. t._visualizerCollection = s, t.getChangedEvent().addEventListener(this._onDataSourceChanged, this), this._onDataSourceChanged(t) }, v.prototype._onDataSourceRemoved = function(e, t) { t.getChangedEvent().removeEventListener(this._onDataSourceChanged, this); var r = this._timeVaryingSources.indexOf(t); - 1 !== r && this._timeVaryingSources.splice(r, 1); var i = this._staticSourcesToUpdate.indexOf(t); - 1 !== i && this._staticSourcesToUpdate.splice(i, 1), t._visualizerCollection.destroy(), t._visualizerCollection = void 0 }, v.prototype._onDataSourceChanged = function(e) { var t = this._timeVaryingSources.indexOf(e),
  4539. r = this._staticSourcesToUpdate.indexOf(e);
  4540. e.getIsTimeVarying() ? (-1 === t && this._timeVaryingSources.push(e), -1 !== r && this._staticSourcesToUpdate.splice(r, 1)) : (-1 === r && this._staticSourcesToUpdate.push(e), -1 !== t && this._timeVaryingSources.splice(r, 1)) }, v
  4541. }), r("Scene/CameraColumbusViewMode", ["../Core/Enumeration"], function(e) { "use strict"; var t = { FREE: new e(0, "FREE"), LOCKED: new e(1, "LOCKED") }; return t }), r("DynamicScene/DynamicObjectView", ["../Core/defaultValue", "../Core/defined", "../Core/DeveloperError", "../Core/Math", "../Core/Cartesian2", "../Core/Cartesian3", "../Core/Cartesian4", "../Core/Cartographic", "../Core/Quaternion", "../Core/Matrix3", "../Core/Matrix4", "../Core/Ellipsoid", "../Core/Transforms", "../Scene/CameraColumbusViewMode", "../Scene/SceneMode"], function(e, t, r, i, n, o, a, s, l, u, c, h, d, m, p) { "use strict";
  4542. function f(e, r, i, a, s, l, u, c) { var h, d = e.scene,
  4543. m = d.mode !== e._mode;
  4544. m ? (e._mode = d.mode, e._screenSpaceCameraController.enableTranslate = !1, h = a.magnitude()) : h = i ? a.magnitude() : r.position.z; var p = s.getValue(l, e._lastCartesian); if (t(p)) { var f = u.cartesianToCartographic(p, e._lastCartographic);
  4545. f.height = h, i || m ? (r.controller.setPositionCartographic(f), r.up.z = 0, o.normalize(r.up, r.up), r.right.z = 0, o.normalize(r.right, r.right), n.clone(r.right, e._first2dUp)) : r.position = c.project(f), e._lastDistance = r.frustum.right - r.frustum.left, n.clone(r.right, e._last2dUp) } }
  4546. function v(e, r, n, a, s, l, c) { g(e, r, n, a); var m = s.getValue(l, e._lastCartesian); if (t(m)) { var p = !1,
  4547. f = l.addSeconds(.01),
  4548. v = s.getValue(f, S); if (t(v) && !o.equalsEpsilon(m, v, i.EPSILON6)) { var y, T = d.computeFixedToIcrfMatrix(l, w),
  4549. A = d.computeFixedToIcrfMatrix(f, C);!t(T) || t(A) ? (y = d.computeTemeToPseudoFixedMatrix(l, x), T = u.transpose(y, w), A = d.computeTemeToPseudoFixedMatrix(f, C), u.transpose(A, A)) : y = u.transpose(T, x); var M = E;
  4550. o.normalize(m, M), o.normalize(v, v), u.multiplyByVector(T, M, M), u.multiplyByVector(A, v, v); var P = o.cross(M, v, b); if (!o.equalsEpsilon(P, o.ZERO, i.EPSILON6)) { var D = o.cross(P, M, S);
  4551. u.multiplyByVector(y, D, D), u.multiplyByVector(y, P, P), u.multiplyByVector(y, M, M), o.normalize(D, D), o.normalize(P, P), o.normalize(M, M); var I = _;
  4552. I[0] = D.x, I[1] = D.y, I[2] = D.z, I[3] = 0, I[4] = P.x, I[5] = P.y, I[6] = P.z, I[7] = 0, I[8] = M.x, I[9] = M.y, I[10] = M.z, I[11] = 0, I[12] = m.x, I[13] = m.y, I[14] = m.z, I[15] = 0, r.transform = I, p = !0 } } p || (r.transform = d.eastNorthUpToFixedFrame(m, c, _)), e._screenSpaceCameraController.setEllipsoid(h.UNIT_SPHERE); var O = r.position;
  4553. o.clone(O, e._lastOffset), e._lastDistance = o.magnitude(O) } }
  4554. function y(e, r, i, n, a, s, l, u) { g(e, r, i, n); var c = a.getValue(s, e._lastCartesian); if (t(c)) { var d = l.cartesianToCartographic(c, e._lastCartographic),
  4555. p = u.project(d);
  4556. T.x = p.z, T.y = p.x, T.z = p.y; var f = r.transform;
  4557. f.setColumn(3, T, f); var v = e._screenSpaceCameraController;
  4558. v.enableTranslate = !1, v.setEllipsoid(h.UNIT_SPHERE), v.columbusViewMode = m.LOCKED, r.controller.constrainedAxis = o.UNIT_Z; var y = r.position;
  4559. o.clone(y, e._lastOffset), e._lastDistance = o.magnitude(y) } }
  4560. function g(e, t, r, a) { var s = e.scene; if (t.controller.constrainedAxis = o.UNIT_Z, r) t.controller.lookAt(a, o.ZERO, o.UNIT_Z);
  4561. else if (s.mode !== e._mode) { e._mode = s.mode; var c = e._first2dUp,
  4562. h = e._last2dUp; if (!n.equals(c, h)) { var d = Math.acos(c.x);
  4563. c.y < 0 && (d = i.TWO_PI - d); var m = Math.acos(h.x);
  4564. h.y < 0 && (m = i.TWO_PI - m), h.x = 0, h.y = 0, c.x = 0, c.y = 0; var p = d - m,
  4565. f = l.fromAxisAngle(o.UNIT_Z, p, A);
  4566. u.fromQuaternion(f, M).multiplyByVector(a, a) } a.normalize(a).multiplyByScalar(e._lastDistance, a), t.controller.lookAt(a, o.ZERO, o.UNIT_Z) } } var _ = new c,
  4567. w = new u,
  4568. C = new u,
  4569. x = new u,
  4570. S = new o,
  4571. E = new o,
  4572. b = new o,
  4573. T = new a(0, 0, 0, 1),
  4574. A = new l,
  4575. M = new u,
  4576. P = new o(1e4, -1e4, 1e4),
  4577. D = new o,
  4578. I = function(t, r, i) { this.dynamicObject = t, this.scene = r, this._lastScene = void 0, this.ellipsoid = e(i, h.WGS84), this._lastDynamicObject = void 0, this._mode = void 0, this._lastCartesian = new o, this._lastCartographic = new s, this._lastDistance = void 0, this._lastOffset = new o, this._offsetScratch = new o, this._first2dUp = new n, this._last2dUp = new n }; return I.prototype.update = function(e) { if (!t(e)) throw new r("time is required."); var i = this.scene; if (!t(i)) throw new r("DynamicObjectView.scene is required.");
  4579. i !== this._lastScene && (this._lastScene = i, this._screenSpaceCameraController = i.getScreenSpaceCameraController()); var n = this.dynamicObject; if (!t(n)) throw new r("DynamicObjectView.dynamicObject is required."); var a = this.ellipsoid; if (!t(a)) throw new r("DynamicObjectView.ellipsoid is required."); var s = this.dynamicObject.position; if (!t(s)) throw new r("dynamicObject.position is required."); var l = n !== this._lastDynamicObject,
  4580. u = this._offsetScratch; if (l) { this._lastDynamicObject = n; var c = this.dynamicObject.viewFrom;
  4581. (!t(c) || t(c.getValue(e, u))) && o.clone(P, u); var h = this._first2dUp,
  4582. d = this._last2dUp;
  4583. h.x = h.y = 0, d.x = d.y = 0, o.clone(u, this._lastOffset), this._lastDistance = u.magnitude(), o.equals(u.normalize(D), o.UNIT_Z) && (u.y -= .01) } else t(this._lastOffset) ? u = this._lastOffset : o.clone(P, u); var m = i.mode;
  4584. m === p.SCENE2D ? f(this, i.getCamera(), l, u, s, e, a, i.scene2D.projection) : m === p.SCENE3D ? v(this, i.getCamera(), l, u, s, e, a) : m === p.COLUMBUS_VIEW && y(this, i.getCamera(), l, u, s, e, a, i.scene2D.projection) }, I }), r("DynamicScene/DynamicVectorVisualizer", ["../Core/DeveloperError", "../Core/defined", "../Core/destroyObject", "../Core/Cartesian3", "../Core/Color", "../Scene/Material", "../Scene/PolylineCollection"], function(e, t, r, i, n, o, a) { "use strict";
  4585. function s(e, r, a) { var s = a.vector; if (t(s)) { var l, u = s.show,
  4586. c = a.position,
  4587. h = s.direction,
  4588. d = s.length,
  4589. m = a._vectorVisualizerIndex,
  4590. p = a.isAvailable(r) && (!t(u) || u.getValue(r)); if (!(p && t(h) && t(c) && t(d))) return t(m) && (l = e._polylineCollection.get(m), l.setShow(!1), a._vectorVisualizerIndex = void 0, e._unusedIndexes.push(m)), void 0; var f; if (t(m)) l = e._polylineCollection.get(m), f = l.getMaterial().uniforms;
  4591. else { var v = e._unusedIndexes;
  4592. v.length > 0 ? (m = v.pop(), l = e._polylineCollection.get(m)) : (m = e._polylineCollection.getLength(), l = e._polylineCollection.add(), l._visualizerPositions = [new i, new i]), a._vectorVisualizerIndex = m, l.dynamicObject = a, l.setWidth(1); var y = l.getMaterial();
  4593. t(y) && y.type === o.PolylineArrowType || (y = o.fromType(e._scene.getContext(), o.PolylineArrowType), l.setMaterial(y)), f = y.uniforms, n.clone(n.WHITE, f.color) } l.setShow(!0); var g = l._visualizerPositions,
  4594. _ = c.getValue(r, g[0]),
  4595. w = h.getValue(r, g[1]),
  4596. C = d.getValue(r);
  4597. t(_) && t(w) && t(C) && (i.add(_, w.normalize(w).multiplyByScalar(C, w), w), l.setPositions(g)); var x = s.color; if (t(x) && (f.color = x.getValue(r, f.color)), x = s.width, t(x)) { var S = x.getValue(r);
  4598. t(S) && l.setWidth(S) } } } var l = function(r, i) { if (!t(r)) throw new e("scene is required.");
  4599. this._scene = r, this._unusedIndexes = [], this._primitives = r.getPrimitives(); var n = this._polylineCollection = new a;
  4600. r.getPrimitives().add(n), this._dynamicObjectCollection = void 0, this.setDynamicObjectCollection(i) }; return l.prototype.getScene = function() { return this._scene }, l.prototype.getDynamicObjectCollection = function() { return this._dynamicObjectCollection }, l.prototype.setDynamicObjectCollection = function(e) { var r = this._dynamicObjectCollection;
  4601. r !== e && (t(r) && (r.objectsRemoved.removeEventListener(l.prototype._onObjectsRemoved, this), this.removeAllPrimitives()), this._dynamicObjectCollection = e, t(e) && e.objectsRemoved.addEventListener(l.prototype._onObjectsRemoved, this)) }, l.prototype.update = function(r) { if (!t(r)) throw new e("time is requied."); if (t(this._dynamicObjectCollection))
  4602. for (var i = this._dynamicObjectCollection.getObjects(), n = 0, o = i.length; o > n; n++) s(this, r, i[n]) }, l.prototype.removeAllPrimitives = function() { var e; if (this._polylineCollection.removeAll(), t(this._dynamicObjectCollection)) { var r = this._dynamicObjectCollection.getObjects(); for (e = r.length - 1; e > -1; e--) r[e]._vectorVisualizerIndex = void 0 } this._unusedIndexes = [] }, l.prototype.isDestroyed = function() { return !1 }, l.prototype.destroy = function() { return this.removeAllPrimitives(), this._scene.getPrimitives().remove(this._polylineCollection), r(this) }, l.prototype._onObjectsRemoved = function(e, r) { for (var i = this._polylineCollection, n = this._unusedIndexes, o = r.length - 1; o > -1; o--) { var a = r[o],
  4603. s = a._vectorVisualizerIndex; if (t(s)) { var l = i.get(s);
  4604. l.setShow(!1), n.push(s), a._vectorVisualizerIndex = void 0 } } }, l }), r("ThirdParty/topojson", [], function() { var e = function() {
  4605. function e(e, t) {
  4606. function r(t) { var r = e.arcs[t],
  4607. i = r[0],
  4608. n = [0, 0]; return r.forEach(function(e) { n[0] += e[0], n[1] += e[1] }), [i, n] } var i = {},
  4609. n = {},
  4610. o = {};
  4611. t.forEach(function(e) { var t = r(e);
  4612. (i[t[0]] || (i[t[0]] = [])).push(e), (i[t[1]] || (i[t[1]] = [])).push(~e) }), t.forEach(function(e) { var t, i, a = r(e),
  4613. s = a[0],
  4614. l = a[1]; if (t = o[s])
  4615. if (delete o[t.end], t.push(e), t.end = l, i = n[l]) { delete n[i.start]; var u = i === t ? t : t.concat(i);
  4616. n[u.start = t.start] = o[u.end = i.end] = u } else if (i = o[l]) { delete n[i.start], delete o[i.end]; var u = t.concat(i.map(function(e) { return ~e }).reverse());
  4617. n[u.start = t.start] = o[u.end = i.start] = u } else n[t.start] = o[t.end] = t;
  4618. else if (t = n[l])
  4619. if (delete n[t.start], t.unshift(e), t.start = s, i = o[s]) { delete o[i.end]; var c = i === t ? t : i.concat(t);
  4620. n[c.start = i.start] = o[c.end = t.end] = c } else if (i = n[s]) { delete n[i.start], delete o[i.end]; var c = i.map(function(e) { return ~e }).reverse().concat(t);
  4621. n[c.start = i.end] = o[c.end = t.end] = c } else n[t.start] = o[t.end] = t;
  4622. else if (t = n[s])
  4623. if (delete n[t.start], t.unshift(~e), t.start = l, i = o[l]) { delete o[i.end]; var c = i === t ? t : i.concat(t);
  4624. n[c.start = i.start] = o[c.end = t.end] = c } else if (i = n[l]) { delete n[i.start], delete o[i.end]; var c = i.map(function(e) { return ~e }).reverse().concat(t);
  4625. n[c.start = i.end] = o[c.end = t.end] = c } else n[t.start] = o[t.end] = t;
  4626. else if (t = o[l])
  4627. if (delete o[t.end], t.push(~e), t.end = s, i = o[s]) { delete n[i.start]; var u = i === t ? t : t.concat(i);
  4628. n[u.start = t.start] = o[u.end = i.end] = u } else if (i = n[s]) { delete n[i.start], delete o[i.end]; var u = t.concat(i.map(function(e) { return ~e }).reverse());
  4629. n[u.start = t.start] = o[u.end = i.start] = u } else n[t.start] = o[t.end] = t;
  4630. else t = [e], n[t.start = s] = o[t.end = l] = t }); var a = []; for (var s in o) a.push(o[s]); return a }
  4631. function t(t, r, i) {
  4632. function o(e) { 0 > e && (e = ~e), (h[e] || (h[e] = [])).push(c) }
  4633. function a(e) { e.forEach(o) }
  4634. function s(e) { e.forEach(a) }
  4635. function l(e) { "GeometryCollection" === e.type ? e.geometries.forEach(l) : e.type in d && (c = e, d[e.type](e.arcs)) } var u = []; if (arguments.length > 1) { var c, h = [],
  4636. d = { LineString: a, MultiLineString: s, Polygon: s, MultiPolygon: function(e) { e.forEach(s) } };
  4637. l(r), h.forEach(arguments.length < 3 ? function(e, t) { u.push(t) } : function(e, t) { i(e[0], e[e.length - 1]) && u.push(t) }) } else
  4638. for (var m = 0, p = t.arcs.length; p > m; ++m) u.push(m); return n(t, { type: "MultiLineString", arcs: e(t, u) }) }
  4639. function r(e, t) { return "GeometryCollection" === t.type ? { type: "FeatureCollection", features: t.geometries.map(function(t) { return i(e, t) }) } : i(e, t) }
  4640. function i(e, t) { var r = { type: "Feature", id: t.id, properties: t.properties || {}, geometry: n(e, t) }; return null == t.id && delete r.id, r }
  4641. function n(e, t) {
  4642. function r(e, t) { t.length && t.pop(); for (var r, i = p[0 > e ? ~e : e], n = 0, a = i.length, s = 0, l = 0; a > n; ++n) t.push([(s += (r = i[n])[0]) * c + d, (l += r[1]) * h + m]);
  4643. 0 > e && o(t, a) }
  4644. function i(e) { return [e[0] * c + d, e[1] * h + m] }
  4645. function n(e) { for (var t = [], i = 0, n = e.length; n > i; ++i) r(e[i], t); return t.length < 2 && t.push(t[0]), t }
  4646. function a(e) { for (var t = n(e); t.length < 4;) t.push(t[0]); return t }
  4647. function s(e) { return e.map(a) }
  4648. function l(e) { var t = e.type; return "GeometryCollection" === t ? { type: t, geometries: e.geometries.map(l) } : t in f ? { type: t, coordinates: f[t](e) } : null } var u = e.transform,
  4649. c = u.scale[0],
  4650. h = u.scale[1],
  4651. d = u.translate[0],
  4652. m = u.translate[1],
  4653. p = e.arcs,
  4654. f = { Point: function(e) { return i(e.coordinates) }, MultiPoint: function(e) { return e.coordinates.map(i) }, LineString: function(e) { return n(e.arcs) }, MultiLineString: function(e) { return e.arcs.map(n) }, Polygon: function(e) { return s(e.arcs) }, MultiPolygon: function(e) { return e.arcs.map(s) } }; return l(t) }
  4655. function o(e, t) { for (var r, i = e.length, n = i - t; n < --i;) r = e[n], e[n++] = e[i], e[i] = r }
  4656. function a(e, t) { for (var r = 0, i = e.length; i > r;) { var n = r + i >>> 1;
  4657. e[n] < t ? r = n + 1 : i = n } return r }
  4658. function s(e) {
  4659. function t(e, t) { e.forEach(function(e) { 0 > e && (e = ~e); var r = n[e];
  4660. r ? r.push(t) : n[e] = [t] }) }
  4661. function r(e, r) { e.forEach(function(e) { t(e, r) }) }
  4662. function i(e, t) { "GeometryCollection" === e.type ? e.geometries.forEach(function(e) { i(e, t) }) : e.type in s && s[e.type](e.arcs, t) } var n = {},
  4663. o = e.map(function() { return [] }),
  4664. s = { LineString: t, MultiLineString: r, Polygon: r, MultiPolygon: function(e, t) { e.forEach(function(e) { r(e, t) }) } };
  4665. e.forEach(i); for (var l in n)
  4666. for (var u = n[l], c = u.length, h = 0; c > h; ++h)
  4667. for (var d = h + 1; c > d; ++d) { var m, p = u[h],
  4668. f = u[d];
  4669. (m = o[p])[l = a(m, f)] !== f && m.splice(l, 0, f), (m = o[f])[l = a(m, p)] !== p && m.splice(l, 0, p) }
  4670. return o } return { version: "1.1.4", mesh: t, feature: r, neighbors: s } }(); return e }), r("DynamicScene/GeoJsonDataSource", ["../Core/createGuid", "../Core/Cartographic", "../Core/Color", "../Core/defined", "../Core/DeveloperError", "../Core/RuntimeError", "../Core/Ellipsoid", "../Core/Event", "../Core/loadJson", "./ConstantProperty", "./DynamicObject", "./DynamicPoint", "./DynamicPolyline", "./DynamicPolygon", "./ColorMaterialProperty", "./DynamicObjectCollection", "../ThirdParty/when", "../ThirdParty/topojson"], function(e, t, r, i, n, o, a, s, l, u, c, h, d, m, p, f, v, y) { "use strict";
  4671. function g(t, r) { var n = t.id; if (i(n) && "Feature" === t.type) { for (var o = 2, a = n; i(r.getObject(a));) a = n + "_" + o, o++;
  4672. n = a } else n = e(); var s = r.getOrCreateObject(n); return s.geoJson = t, s }
  4673. function _(e, t) { for (var r = new Array(e.length), i = 0; i < e.length; i++) r[i] = t(e[i]); return r }
  4674. function w(e, t, r, n, a) { if (!i(t.geometry)) throw new o("feature.geometry is required."); if (null === t.geometry) g(t, e._dynamicObjectCollection);
  4675. else { var s = t.geometry.type,
  4676. l = O[s]; if (!i(l)) throw new o("Unknown geometry type: " + s);
  4677. l(e, t, t.geometry, n, a) } }
  4678. function C(e, t, r, i, n) { for (var o = t.features, a = 0, s = o.length; s > a; a++) w(e, o[a], void 0, i, n) }
  4679. function x(e, t, r, n, a) { for (var s = r.geometries, l = 0, u = s.length; u > l; l++) { var c = s[l],
  4680. h = c.type,
  4681. d = O[h]; if (!i(d)) throw new o("Unknown geometry type: " + h);
  4682. d(e, t, c, n, a) } }
  4683. function S(e, t, r, i) { var n = g(t, e._dynamicObjectCollection);
  4684. n.merge(e.defaultPoint), n.position = new u(i(r.coordinates)) }
  4685. function E(e, t, r, i) { for (var n = r.coordinates, o = 0; o < n.length; o++) { var a = g(t, e._dynamicObjectCollection);
  4686. a.merge(e.defaultPoint), a.position = new u(i(n[o])) } }
  4687. function b(e, t, r, i) { var n = g(t, e._dynamicObjectCollection);
  4688. n.merge(e.defaultLine), n.vertexPositions = new u(_(r.coordinates, i)) }
  4689. function T(e, t, r, i) { for (var n = r.coordinates, o = 0; o < n.length; o++) { var a = g(t, e._dynamicObjectCollection);
  4690. a.merge(e.defaultLine), a.vertexPositions = new u(_(n[o], i)) } }
  4691. function A(e, t, r, i) { var n = g(t, e._dynamicObjectCollection);
  4692. n.merge(e.defaultPolygon), n.vertexPositions = new u(_(r.coordinates[0], i)) }
  4693. function M(e, t, r, i, n) { for (var o in r.objects)
  4694. if (r.objects.hasOwnProperty(o)) { var a = y.feature(r, r.objects[o]),
  4695. s = I[a.type];
  4696. s(e, a, a, i, n) } }
  4697. function P(e, t, r, i) { for (var n = r.coordinates, o = 0; o < n.length; o++) { var a = n[o],
  4698. s = g(t, e._dynamicObjectCollection);
  4699. s.merge(e.defaultPolygon), s.vertexPositions = new u(_(a[0], i)) } }
  4700. function D(e) { var r = t.fromDegrees(e[0], e[1], e[2]); return a.WGS84.cartographicToCartesian(r) } var I = { Feature: w, FeatureCollection: C, GeometryCollection: x, LineString: b, MultiLineString: T, MultiPoint: E, MultiPolygon: P, Point: S, Polygon: A, Topology: M },
  4701. O = { GeometryCollection: x, LineString: b, MultiLineString: T, MultiPoint: E, MultiPolygon: P, Point: S, Polygon: A, Topology: M },
  4702. R = function() { var e = new c("GeoJsonDataSource.defaultPoint"),
  4703. t = new h;
  4704. t.color = new u(r.YELLOW), t.pixelSize = new u(10), t.outlineColor = new u(r.BLACK), t.outlineWidth = new u(1), e.point = t; var i = new c("GeoJsonDataSource.defaultLine"),
  4705. n = new d;
  4706. n.color = new u(r.YELLOW), n.width = new u(2), n.outlineColor = new u(r.BLACK), n.outlineWidth = new u(1), i.polyline = n; var o = new c("GeoJsonDataSource.defaultPolygon");
  4707. n = new d, n.color = new u(r.YELLOW), n.width = new u(1), n.outlineColor = new u(r.BLACK), n.outlineWidth = new u(0), o.polyline = n; var a = new m;
  4708. o.polygon = a; var l = new p;
  4709. l.color = new u(new r(1, 1, 0, .1)), a.material = l, this._changed = new s, this._error = new s, this._dynamicObjectCollection = new f, this.defaultPoint = e, this.defaultLine = i, this.defaultPolygon = o }; return R.prototype.getChangedEvent = function() { return this._changed }, R.prototype.getErrorEvent = function() { return this._error }, R.prototype.getClock = function() { return void 0 }, R.prototype.getDynamicObjectCollection = function() { return this._dynamicObjectCollection }, R.prototype.getIsTimeVarying = function() { return !1 }, R.prototype.loadUrl = function(e) { if (!i(e)) throw new n("url is required."); var t = this; return v(l(e), function(r) { return t.load(r, e) }, function(e) { return t._error.raiseEvent(t, e), v.reject(e) }) }, R.prototype.load = function(e, t) { if (!i(e)) throw new n("geoJson is required."); var r = I[e.type]; if (!i(r)) throw new n("Unsupported GeoJSON object type: " + e.type); var a = D,
  4710. s = e.crs; if (i(s)) { if (null === s) throw new o("crs is null."); if (!i(s.properties)) throw new o("crs.properties is undefined."); var l = s.properties; if ("name" === s.type) { if (a = R.crsNames[l.name], !i(a)) throw new o("Unknown crs name: " + l.name) } else if ("link" === s.type) { var u = R.crsLinkHrefs[l.href]; if (i(u) || (u = R.crsLinkTypes[l.type]), !i(u)) throw new o("Unable to resolve crs link: " + JSON.stringify(l));
  4711. a = u(l) } else { if ("EPSG" !== s.type) throw new o("Unknown crs type: " + s.type); if (a = R.crsNames["EPSG:" + l.code], !i(a)) throw new o("Unknown crs EPSG code: " + l.code) } } this._dynamicObjectCollection.clear(); var c = this; return v(a, function(i) { r(c, e, e, i, t), c._changed.raiseEvent(c) }, function(e) { return c._error.raiseEvent(c, e), v.reject(e) }) }, R.crsNames = { "urn:ogc:def:crs:OGC:1.3:CRS84": D, "EPSG:4326": D }, R.crsLinkHrefs = {}, R.crsLinkTypes = {}, R }), r("DynamicScene/Property", ["../Core/DeveloperError"], function(e) { "use strict";
  4712. function t() { throw new e("This type should not be instantiated directly.") } var r = t; return r.prototype.getValue = t, r }), r("Renderer/Buffer", ["../Core/DeveloperError", "../Core/destroyObject"], function(e, t) { "use strict"; var r = function(e, t, r, i, n) { this._gl = e, this._bufferTarget = t, this._sizeInBytes = r, this._usage = i, this._buffer = n, this._vertexArrayDestroyable = !0 }; return r.prototype.copyFromArrayView = function(t, r) { if (!t) throw new e("arrayView is required."); if (r = r || 0, r + t.byteLength > this._sizeInBytes) throw new e("This buffer is not large enough."); var i = this._gl,
  4713. n = this._bufferTarget;
  4714. i.bindBuffer(n, this._buffer), i.bufferSubData(n, r, t), i.bindBuffer(n, null) }, r.prototype._getBuffer = function() { return this._buffer }, r.prototype.getSizeInBytes = function() { return this._sizeInBytes }, r.prototype.getUsage = function() { return this._usage }, r.prototype.getVertexArrayDestroyable = function() { return this._vertexArrayDestroyable }, r.prototype.setVertexArrayDestroyable = function(e) { this._vertexArrayDestroyable = e }, r.prototype.isDestroyed = function() { return !1 }, r.prototype.destroy = function() { return this._gl.deleteBuffer(this._buffer), t(this) }, r }), r("Renderer/ClearCommand", ["../Core/Color", "../Core/freezeObject"], function(e, t) { "use strict"; var r = function() { this.color = void 0, this.depth = void 0, this.stencil = void 0, this.renderState = void 0, this.framebuffer = void 0, this.owner = void 0 },
  4715. i = new r; return i.color = new e(0, 0, 0, 0), i.depth = 1, i.stencil = 0, r.ALL = t(i), r.prototype.execute = function(e, t) { e.clear(this, t) }, r }), r("Renderer/Framebuffer", ["../Core/DeveloperError", "../Core/destroyObject", "./PixelFormat"], function(e, t, r) { "use strict";
  4716. function i(e, t, r) { e._bind(); var i = e._gl;
  4717. r ? i.framebufferTexture2D(i.FRAMEBUFFER, t, r._getTarget(), r._getTexture(), 0) : i.framebufferTexture2D(i.FRAMEBUFFER, t, i.TEXTURE_2D, null, 0), e._unBind() }
  4718. function n(e, t, r) { e._bind(); var i = e._gl;
  4719. r ? i.framebufferRenderbuffer(i.FRAMEBUFFER, t, i.RENDERBUFFER, r._getRenderbuffer()) : i.framebufferRenderbuffer(i.FRAMEBUFFER, t, i.RENDERBUFFER, null), e._unBind() }
  4720. function o(e, t) { e.destroyAttachments && t && t.destroy && t.destroy() } var a = function(t, r) { if (this._gl = t, this._framebuffer = t.createFramebuffer(), this._colorTexture = void 0, this._colorRenderbuffer = void 0, this._depthTexture = void 0, this._depthRenderbuffer = void 0, this._stencilRenderbuffer = void 0, this._depthStencilTexture = void 0, this._depthStencilRenderbuffer = void 0, this.destroyAttachments = !0, r) { if (r.colorTexture && r.colorRenderbuffer) throw new e("Cannot have both a color texture and color renderbuffer attachment."); if (r.depthTexture && r.depthRenderbuffer) throw new e("Cannot have both a depth texture and depth renderbuffer attachment."); if (r.depthStencilTexture && r.depthStencilRenderbuffer) throw new e("Cannot have both a depth-stencil texture and depth-stencil renderbuffer attachment."); var i = r.depthTexture || r.depthRenderbuffer,
  4721. n = r.depthStencilTexture || r.depthStencilRenderbuffer; if (i && n) throw new e("Cannot have both a depth and depth-stencil attachment."); if (r.stencilRenderbuffer && n) throw new e("Cannot have both a stencil and depth-stencil attachment."); if (i && r.stencilRenderbuffer) throw new e("Cannot have both a depth and stencil attachment.");
  4722. r.colorTexture && this.setColorTexture(r.colorTexture), r.colorRenderbuffer && this.setColorRenderbuffer(r.colorRenderbuffer), r.depthTexture && this.setDepthTexture(r.depthTexture), r.depthRenderbuffer && this.setDepthRenderbuffer(r.depthRenderbuffer), r.stencilRenderbuffer && this.setStencilRenderbuffer(r.stencilRenderbuffer), r.depthStencilTexture && this.setDepthStencilTexture(r.depthStencilTexture), r.depthStencilRenderbuffer && this.setDepthStencilRenderbuffer(r.depthStencilRenderbuffer) } }; return a.prototype._bind = function() { var e = this._gl;
  4723. e.bindFramebuffer(e.FRAMEBUFFER, this._framebuffer) }, a.prototype._unBind = function() { var e = this._gl;
  4724. e.bindFramebuffer(e.FRAMEBUFFER, null) }, a.prototype.setColorTexture = function(t) { if (t && !r.isColorFormat(t.getPixelFormat())) throw new e("The color-texture pixel-format must be a color format.");
  4725. i(this, this._gl.COLOR_ATTACHMENT0, t), o(this, this._colorTexture), this._colorTexture = t }, a.prototype.getColorTexture = function() { return this._colorTexture }, a.prototype.setColorRenderbuffer = function(e) { n(this, this._gl.COLOR_ATTACHMENT0, e), o(this, this._colorRenderbuffer), this._colorRenderbuffer = e }, a.prototype.getColorRenderbuffer = function() { return this._colorRenderbuffer }, a.prototype.setDepthTexture = function(t) { if (t && t.getPixelFormat() !== r.DEPTH_COMPONENT) throw new e("The depth-texture pixel-format must be DEPTH_COMPONENT.");
  4726. i(this, this._gl.DEPTH_ATTACHMENT, t), o(this, this._depthTexture), this._depthTexture = t }, a.prototype.getDepthTexture = function() { return this._depthTexture }, a.prototype.setDepthRenderbuffer = function(e) { n(this, this._gl.DEPTH_ATTACHMENT, e), o(this, this._depthRenderbuffer), this._depthRenderbuffer = e }, a.prototype.getDepthRenderbuffer = function() { return this._depthRenderbuffer }, a.prototype.setStencilRenderbuffer = function(e) { n(this, this._gl.STENCIL_ATTACHMENT, e), o(this, this._stencilRenderbuffer), this._stencilRenderbuffer = e }, a.prototype.getStencilRenderbuffer = function() { return this._stencilRenderbuffer }, a.prototype.setDepthStencilTexture = function(t) { if (t && t.getPixelFormat() !== r.DEPTH_STENCIL) throw new e("The depth-stencil pixel-format must be DEPTH_STENCIL.");
  4727. i(this, this._gl.DEPTH_STENCIL_ATTACHMENT, t), o(this, this._depthStencilTexture), this._depthStencilTexture = t }, a.prototype.getDepthStencilTexture = function() { return this._depthStencilTexture }, a.prototype.setDepthStencilRenderbuffer = function(e) { n(this, this._gl.DEPTH_STENCIL_ATTACHMENT, e), o(this, this._depthStencilRenderbuffer), this._depthStencilRenderbuffer = e }, a.prototype.getDepthStencilRenderbuffer = function() { return this._depthStencilRenderbuffer }, a.prototype.hasDepthAttachment = function() { return !!(this.getDepthTexture() || this.getDepthRenderbuffer() || this.getDepthStencilTexture() || this.getDepthStencilRenderbuffer()) }, a.prototype.isDestroyed = function() { return !1 }, a.prototype.destroy = function() { return this.destroyAttachments && (this._colorTexture = this._colorTexture && this._colorTexture.destroy && this._colorTexture.destroy(), this._colorRenderbuffer = this._colorRenderbuffer && this._colorRenderbuffer.destroy(), this._depthTexture = this._depthTexture && this._depthTexture.destroy(), this._depthRenderbuffer = this._depthRenderbuffer && this._depthRenderbuffer.destroy(), this._stencilRenderbuffer = this._stencilRenderbuffer && this._stencilRenderbuffer.destroy(), this._depthStencilTexture = this._depthStencilTexture && this._depthStencilTexture.destroy(), this._depthStencilRenderbuffer = this._depthStencilRenderbuffer && this._depthStencilRenderbuffer.destroy()), this._gl.deleteFramebuffer(this._framebuffer), t(this) }, a }), r("Renderer/PassState", [], function() { "use strict"; var e = function(e) { this.context = e, this.framebuffer = void 0, this.blendingEnabled = void 0, this.scissorTest = void 0 }; return e }), r("Renderer/RenderbufferFormat", ["../Core/Enumeration"], function(e) { "use strict"; var t = { RGBA4: new e(32854, "RGBA4"), RGB5_A1: new e(32855, "RGB5_A1"), RGB565: new e(36194, "RGB565"), DEPTH_COMPONENT16: new e(33189, "DEPTH_COMPONENT16"), STENCIL_INDEX8: new e(36168, "STENCIL_INDEX8"), DEPTH_STENCIL: new e(34041, "DEPTH_STENCIL"), validate: function(e) { return e === t.RGBA4 || e === t.RGB5_A1 || e === t.RGB565 || e === t.DEPTH_COMPONENT16 || e === t.STENCIL_INDEX8 || e === t.DEPTH_STENCIL } }; return t }), r("Renderer/PickFramebuffer", ["../Core/defaultValue", "../Core/defined", "../Core/destroyObject", "../Core/Color", "../Core/BoundingRectangle", "./PassState", "./RenderbufferFormat"], function(e, t, r, i, n, o, a) { "use strict"; var s = function(e) { var t = new o(e);
  4728. t.blendingEnabled = !1, t.scissorTest = { enabled: !0, rectangle: new n }, this._context = e, this._fb = void 0, this._passState = t, this._width = 0, this._height = 0 };
  4729. s.prototype.begin = function(e) { var r = this._context,
  4730. i = r.getCanvas().clientWidth,
  4731. o = r.getCanvas().clientHeight; return n.clone(e, this._passState.scissorTest.rectangle), t(this._fb) && this._width === i && this._height === o || (this._width = i, this._height = o, this._fb = this._fb && this._fb.destroy(), this._fb = r.createFramebuffer({ colorTexture: r.createTexture2D({ width: i, height: o }), depthRenderbuffer: r.createRenderbuffer({ format: a.DEPTH_COMPONENT16 }) }), this._passState.framebuffer = this._fb), this._passState }; var l = new i; return s.prototype.end = function(r) { for (var n = e(r.width, 1), o = e(r.height, 1), a = this._context, s = a.readPixels({ x: r.x, y: r.y, width: n, height: o, framebuffer: this._fb }), u = Math.max(n, o), c = u * u, h = Math.floor(.5 * n), d = Math.floor(.5 * o), m = 0, p = 0, f = 0, v = -1, y = 0; c > y; ++y) { if (m >= -h && h >= m && p >= -d && d >= p) { var g = 4 * ((d - p) * n + m + h);
  4732. l.red = i.byteToFloat(s[g]), l.green = i.byteToFloat(s[g + 1]), l.blue = i.byteToFloat(s[g + 2]), l.alpha = i.byteToFloat(s[g + 3]); var _ = a.getObjectByPickColor(l); if (t(_)) return _ } if (m === p || 0 > m && -m === p || m > 0 && m === 1 - p) { var w = f;
  4733. f = -v, v = w } m += f, p += v } return void 0 }, s.prototype.isDestroyed = function() { return !1 }, s.prototype.destroy = function() { return this._fb = this._fb && this._fb.destroy(), r(this) }, s }), r("Renderer/Renderbuffer", ["../Core/destroyObject"], function(e) { "use strict";
  4734. function t(t, r, i, n) { var o = t.createRenderbuffer();
  4735. t.bindRenderbuffer(t.RENDERBUFFER, o), t.renderbufferStorage(t.RENDERBUFFER, r, i, n), t.bindRenderbuffer(t.RENDERBUFFER, null), this.getFormat = function() { return r }, this.getWidth = function() { return i }, this.getHeight = function() { return n }, this._getRenderbuffer = function() { return o }, this.isDestroyed = function() { return !1 }, this.destroy = function() { return t.deleteRenderbuffer(o), e(this) } } return t }), r("Renderer/DepthFunction", ["../Core/Enumeration"], function(e) { "use strict"; var t = { NEVER: new e(512, "NEVER"), LESS: new e(513, "LESS"), EQUAL: new e(514, "EQUAL"), LESS_OR_EQUAL: new e(515, "LEQUAL"), GREATER: new e(516, "GREATER"), NOT_EQUAL: new e(517, "NOTEQUAL"), GREATER_OR_EQUAL: new e(518, "GEQUAL"), ALWAYS: new e(519, "ALWAYS"), validate: function(e) { return e === t.NEVER || e === t.LESS || e === t.EQUAL || e === t.LESS_OR_EQUAL || e === t.GREATER || e === t.NOT_EQUAL || e === t.GREATER_OR_EQUAL || e === t.ALWAYS } }; return t }), r("Renderer/StencilFunction", ["../Core/Enumeration"], function(e) { "use strict"; var t = { NEVER: new e(512, "NEVER"), LESS: new e(513, "LESS"), EQUAL: new e(514, "EQUAL"), LESS_OR_EQUAL: new e(515, "LESS_OR_EQUAL"), GREATER: new e(516, "GREATER"), NOT_EQUAL: new e(517, "NOT_EQUAL"), GREATER_OR_EQUAL: new e(518, "GREATER_OR_EQUAL"), ALWAYS: new e(519, "ALWAYS"), validate: function(e) { return e === t.NEVER || e === t.LESS || e === t.EQUAL || e === t.LESS_OR_EQUAL || e === t.GREATER || e === t.NOT_EQUAL || e === t.GREATER_OR_EQUAL || e === t.ALWAYS } }; return t }), r("Renderer/StencilOperation", ["../Core/Enumeration"], function(e) { "use strict"; var t = { ZERO: new e(0, "ZERO"), KEEP: new e(7680, "KEEP"), REPLACE: new e(7681, "REPLACE"), INCREMENT: new e(7682, "INCREMENT"), DECREMENT: new e(7683, "DECREMENT"), INVERT: new e(5386, "INVERT"), INCREMENT_WRAP: new e(34055, "INCREMENT_WRAP"), DECREMENT_WRAP: new e(34056, "DECREMENT_WRAP"), validate: function(e) { return e === t.ZERO || e === t.KEEP || e === t.REPLACE || e === t.INCREMENT || e === t.DECREMENT || e === t.INVERT || e === t.INCREMENT_WRAP || e === t.DECREMENT_WRAP } }; return t }), r("Renderer/RenderState", ["../Core/Color", "../Core/defaultValue", "../Core/defined", "../Core/DeveloperError", "../Core/BoundingRectangle", "../Core/RuntimeError", "../Core/WindingOrder", "./CullFace", "./DepthFunction", "./BlendEquation", "./BlendFunction", "./StencilFunction", "./StencilOperation"], function(e, t, r, i, n, o, a, s, l, u, c, h, d) {
  4736. "use strict";
  4737. function m(e, t, r) { r ? e.enable(t) : e.disable(t) }
  4738. function p(e, t) { e.frontFace(t.frontFace) }
  4739. function f(e, t) { var r = t.cull,
  4740. i = r.enabled;
  4741. m(e, e.CULL_FACE, i), i && e.cullFace(r.face) }
  4742. function v(e, t) { e.lineWidth(t.lineWidth) }
  4743. function y(e, t) { var r = t.polygonOffset,
  4744. i = r.enabled;
  4745. m(e, e.POLYGON_OFFSET_FILL, i), i && e.polygonOffset(r.factor, r.units) }
  4746. function g(e, t, i) { var n = t.scissorTest,
  4747. o = r(i.scissorTest) ? i.scissorTest.enabled : n.enabled; if (m(e, e.SCISSOR_TEST, o), o) { var a = r(i.scissorTest) ? i.scissorTest.rectangle : n.rectangle;
  4748. e.scissor(a.x, a.y, a.width, a.height) } }
  4749. function _(e, t) { var r = t.depthRange;
  4750. e.depthRange(r.near, r.far) }
  4751. function w(e, t) { var r = t.depthTest,
  4752. i = r.enabled;
  4753. m(e, e.DEPTH_TEST, i), i && e.depthFunc(r.func) }
  4754. function C(e, t) { var r = t.colorMask;
  4755. e.colorMask(r.red, r.green, r.blue, r.alpha) }
  4756. function x(e, t) { e.depthMask(t.depthMask) }
  4757. function S(e, t) { e.stencilMask(t.stencilMask) }
  4758. function E(e, t, i) { var n = t.blending,
  4759. o = r(i.blendingEnabled) ? i.blendingEnabled : n.enabled; if (m(e, e.BLEND, o), o) { var a = n.color,
  4760. s = n.equationRgb,
  4761. l = n.equationAlpha,
  4762. u = n.functionSourceRgb,
  4763. c = n.functionDestinationRgb,
  4764. h = n.functionSourceAlpha,
  4765. d = n.functionDestinationAlpha;
  4766. e.blendColor(a.red, a.green, a.blue, a.alpha), e.blendEquationSeparate(s, l), e.blendFuncSeparate(u, c, h, d) } }
  4767. function b(e, t) { var r = t.stencilTest,
  4768. i = r.enabled; if (m(e, e.STENCIL_TEST, i), i) { var n = r.frontFunction,
  4769. o = r.backFunction,
  4770. a = r.reference,
  4771. s = r.mask;
  4772. e.stencilFunc(r.frontFunction, r.reference, r.mask), e.stencilFuncSeparate(e.BACK, o, a, s), e.stencilFuncSeparate(e.FRONT, n, a, s); var l = r.frontOperation,
  4773. u = l.fail,
  4774. c = l.zFail,
  4775. h = l.zPass;
  4776. e.stencilOpSeparate(e.FRONT, u, c, h); var d = r.backOperation,
  4777. p = d.fail,
  4778. f = d.zFail,
  4779. v = d.zPass;
  4780. e.stencilOpSeparate(e.BACK, p, f, v) } }
  4781. function T(e, t) { var r = t.sampleCoverage,
  4782. i = r.enabled;
  4783. m(e, e.SAMPLE_COVERAGE, i), i && e.sampleCoverage(r.value, r.invert) }
  4784. function A(e, t) { m(e, e.DITHER, t.dither) }
  4785. function M(e, t, i) { var n = t.viewport; if (!r(n)) { var o = i.context.getCanvas();
  4786. n = I, n.width = o.clientWidth, n.height = o.clientHeight } i.context.getUniformState().setViewport(n), e.viewport(n.x, n.y, n.width, n.height) }
  4787. function P(e, t) {
  4788. var r = [];
  4789. return e.frontFace !== t.frontFace && r.push(p), (e.cull.enabled !== t.cull.enabled || e.cull.face !== t.cull.face) && r.push(f), e.lineWidth !== t.lineWidth && r.push(v), (e.polygonOffset.enabled !== t.polygonOffset.enabled || e.polygonOffset.factor !== t.polygonOffset.factor || e.polygonOffset.units !== t.polygonOffset.units) && r.push(y), r.push(g), (e.depthRange.near !== t.depthRange.near || e.depthRange.far !== t.depthRange.far) && r.push(_), (e.depthTest.enabled !== t.depthTest.enabled || e.depthTest.func !== t.depthTest.func) && r.push(w), (e.colorMask.red !== t.colorMask.red || e.colorMask.green !== t.colorMask.green || e.colorMask.blue !== t.colorMask.blue || e.colorMask.alpha !== t.colorMask.alpha) && r.push(C), e.depthMask !== t.depthMask && r.push(x), r.push(E), e.stencilMask !== t.stencilMask && r.push(S), (e.stencilTest.enabled !== t.stencilTest.enabled || e.stencilTest.frontFunction !== t.stencilTest.frontFunction || e.stencilTest.backFunction !== t.stencilTest.backFunction || e.stencilTest.reference !== t.stencilTest.reference || e.stencilTest.mask !== t.stencilTest.mask || e.stencilTest.frontOperation.fail !== t.stencilTest.frontOperation.fail || e.stencilTest.frontOperation.zFail !== t.stencilTest.frontOperation.zFail || e.stencilTest.backOperation.fail !== t.stencilTest.backOperation.fail || e.stencilTest.backOperation.zFail !== t.stencilTest.backOperation.zFail || e.stencilTest.backOperation.zPass !== t.stencilTest.backOperation.zPass) && r.push(b), (e.sampleCoverage.enabled !== t.sampleCoverage.enabled || e.sampleCoverage.value !== t.sampleCoverage.value || e.sampleCoverage.invert !== t.sampleCoverage.invert) && r.push(T), e.dither !== t.dither && r.push(A), r.push(M), r
  4790. }
  4791. var D = function(m, p) { var f = t(p, {}),
  4792. v = t(f.cull, {}),
  4793. y = t(f.polygonOffset, {}),
  4794. g = t(f.scissorTest, {}),
  4795. _ = t(g.rectangle, {}),
  4796. w = t(f.depthRange, {}),
  4797. C = t(f.depthTest, {}),
  4798. x = t(f.colorMask, {}),
  4799. S = t(f.blending, {}),
  4800. E = t(S.color, {}),
  4801. b = t(f.stencilTest, {}),
  4802. T = t(b.frontOperation, {}),
  4803. A = t(b.backOperation, {}),
  4804. M = t(f.sampleCoverage, {}),
  4805. P = f.viewport; if (this.frontFace = t(f.frontFace, a.COUNTER_CLOCKWISE), this.cull = { enabled: t(v.enabled, !1), face: t(v.face, s.BACK) }, this.lineWidth = t(f.lineWidth, 1), this.polygonOffset = { enabled: t(y.enabled, !1), factor: t(y.factor, 0), units: t(y.units, 0) }, this.scissorTest = { enabled: t(g.enabled, !1), rectangle: n.clone(_) }, this.depthRange = { near: t(w.near, 0), far: t(w.far, 1) }, this.depthTest = { enabled: t(C.enabled, !1), func: t(C.func, l.LESS) }, this.colorMask = { red: t(x.red, !0), green: t(x.green, !0), blue: t(x.blue, !0), alpha: t(x.alpha, !0) }, this.depthMask = t(f.depthMask, !0), this.stencilMask = t(f.stencilMask, -1), this.blending = { enabled: t(S.enabled, !1), color: new e(t(E.red, 0), t(E.green, 0), t(E.blue, 0), t(E.alpha, 0)), equationRgb: t(S.equationRgb, u.ADD), equationAlpha: t(S.equationAlpha, u.ADD), functionSourceRgb: t(S.functionSourceRgb, c.ONE), functionSourceAlpha: t(S.functionSourceAlpha, c.ONE), functionDestinationRgb: t(S.functionDestinationRgb, c.ZERO), functionDestinationAlpha: t(S.functionDestinationAlpha, c.ZERO) }, this.stencilTest = { enabled: t(b.enabled, !1), frontFunction: t(b.frontFunction, h.ALWAYS), backFunction: t(b.backFunction, h.ALWAYS), reference: t(b.reference, 0), mask: t(b.mask, -1), frontOperation: { fail: t(T.fail, d.KEEP), zFail: t(T.zFail, d.KEEP), zPass: t(T.zPass, d.KEEP) }, backOperation: { fail: t(A.fail, d.KEEP), zFail: t(A.zFail, d.KEEP), zPass: t(A.zPass, d.KEEP) } }, this.sampleCoverage = { enabled: t(M.enabled, !1), value: t(M.value, 1), invert: t(M.invert, !1) }, this.dither = t(f.dither, !0), this.viewport = r(P) ? new n(P.x, P.y, r(P.width) ? P.width : m.getCanvas().clientWidth, r(P.height) ? P.height : m.getCanvas().clientHeight) : void 0, !a.validate(this.frontFace)) throw new i("Invalid renderState.frontFace."); if (!s.validate(this.cull.face)) throw new i("Invalid renderState.cull.face."); if (this.lineWidth < m.getMinimumAliasedLineWidth() || this.lineWidth > m.getMaximumAliasedLineWidth()) throw new o("renderState.lineWidth is out of range. Check getMinimumAliasedLineWidth() and getMaximumAliasedLineWidth()."); if (this.scissorTest.rectangle.width < 0 || this.scissorTest.rectangle.height < 0) throw new i("renderState.scissorTest.rectangle.width and renderState.scissorTest.rectangle.height must be greater than or equal to zero."); if (this.depthRange.near > this.depthRange.far) throw new i("renderState.depthRange.near can not be greater than renderState.depthRange.far."); if (this.depthRange.near < 0) throw new i("renderState.depthRange.near must be greater than or equal to zero."); if (this.depthRange.far > 1) throw new i("renderState.depthRange.far must be less than or equal to one."); if (!l.validate(this.depthTest.func)) throw new i("Invalid renderState.depthTest.func."); if (this.blending.color.red < 0 || this.blending.color.red > 1 || this.blending.color.green < 0 || this.blending.color.green > 1 || this.blending.color.blue < 0 || this.blending.color.blue > 1 || this.blending.color.alpha < 0 || this.blending.color.alpha > 1) throw new i("renderState.blending.color components must be greater than or equal to zero and less than or equal to one."); if (!u.validate(this.blending.equationRgb)) throw new i("Invalid renderState.blending.equationRgb."); if (!u.validate(this.blending.equationAlpha)) throw new i("Invalid renderState.blending.equationAlpha."); if (!c.validate(this.blending.functionSourceRgb)) throw new i("Invalid renderState.blending.functionSourceRgb."); if (!c.validate(this.blending.functionSourceAlpha)) throw new i("Invalid renderState.blending.functionSourceAlpha."); if (!c.validate(this.blending.functionDestinationRgb)) throw new i("Invalid renderState.blending.functionDestinationRgb."); if (!c.validate(this.blending.functionDestinationAlpha)) throw new i("Invalid renderState.blending.functionDestinationAlpha."); if (!h.validate(this.stencilTest.frontFunction)) throw new i("Invalid renderState.stencilTest.frontFunction."); if (!h.validate(this.stencilTest.backFunction)) throw new i("Invalid renderState.stencilTest.backFunction."); if (!d.validate(this.stencilTest.frontOperation.fail)) throw new i("Invalid renderState.stencilTest.frontOperation.fail."); if (!d.validate(this.stencilTest.frontOperation.zFail)) throw new i("Invalid renderState.stencilTest.frontOperation.zFail."); if (!d.validate(this.stencilTest.frontOperation.zPass)) throw new i("Invalid renderState.stencilTest.frontOperation.zPass."); if (!d.validate(this.stencilTest.backOperation.fail)) throw new i("Invalid renderState.stencilTest.backOperation.fail."); if (!d.validate(this.stencilTest.backOperation.zFail)) throw new i("Invalid renderState.stencilTest.backOperation.zFail."); if (!d.validate(this.stencilTest.backOperation.zPass)) throw new i("Invalid renderState.stencilTest.backOperation.zPass."); if (r(this.viewport)) { if (this.viewport.width < 0) throw new i("renderState.viewport.width must be greater than or equal to zero."); if (this.viewport.width > m.getMaximumViewportWidth()) throw new o("renderState.viewport.width must be less than or equal to the maximum viewport width (" + this.getMaximumViewportWidth().toString() + "). Check getMaximumViewportWidth()."); if (this.viewport.height < 0) throw new i("renderState.viewport.height must be greater than or equal to zero."); if (this.viewport.height > m.getMaximumViewportHeight()) throw new o("renderState.viewport.height must be less than or equal to the maximum viewport height (" + this.getMaximumViewportHeight().toString() + "). Check getMaximumViewportHeight().") } this.id = 0, this._applyFunctions = [] },
  4806. I = new n;
  4807. return D.apply = function(e, t, r) { p(e, t), f(e, t), v(e, t), y(e, t), g(e, t, r), _(e, t), w(e, t), C(e, t), x(e, t), S(e, t), E(e, t, r), b(e, t), T(e, t), A(e, t), M(e, t, r) }, D.partialApply = function(e, t, i, n) { var o = i._applyFunctions[t.id];
  4808. r(o) || (o = P(t, i), i._applyFunctions[t.id] = o); for (var a = o.length, s = 0; a > s; ++s) o[s](e, i, n) }, D
  4809. }), r("Renderer/ShaderCache", ["../Core/defined", "../Core/destroyObject"], function(e, t) { "use strict"; var r = function(e) { this._context = e, this._shaders = {}, this._shadersToRelease = {} }; return r.prototype.replaceShaderProgram = function(t, r, i, n) { return e(t) && t.release(), this.getShaderProgram(r, i, n) }, r.prototype.getShaderProgram = function(e, t, r) { var i, n = e + t + JSON.stringify(r); if (this._shaders[n]) i = this._shaders[n];
  4810. else { var o = this._context.createShaderProgram(e, t, r);
  4811. i = { cache: this, shaderProgram: o, keyword: n, count: 0 }, o._cachedShader = i, this._shaders[n] = i } return ++i.count, i.shaderProgram }, r.prototype.destroyReleasedShaderPrograms = function() { var e = this._shadersToRelease; for (var t in e)
  4812. if (e.hasOwnProperty(t)) { var r = e[t];
  4813. 0 === r.count && (delete this._shaders[r.keyword], r.shaderProgram.destroy()) }
  4814. this._shadersToRelease = {} }, r.prototype.releaseShaderProgram = function(e) { if (e) { var t = e._cachedShader;
  4815. t && 0 === --t.count && (this._shadersToRelease[t.keyword] = t) } return void 0 }, r.prototype.isDestroyed = function() { return !1 }, r.prototype.destroy = function() { var e = this._shaders; for (var r in e) e.hasOwnProperty(r) && e[r].shaderProgram.destroy(); return t(this) }, r }), r("Renderer/UniformDatatype", ["../Core/Enumeration"], function(e) { "use strict"; var t = { FLOAT: new e(5126, "FLOAT", { getGLSL: function() { return "float" } }), FLOAT_VECTOR2: new e(35664, "FLOAT_VECTOR2", { getGLSL: function() { return "vec2" } }), FLOAT_VECTOR3: new e(35665, "FLOAT_VECTOR3", { getGLSL: function() { return "vec3" } }), FLOAT_VECTOR4: new e(35666, "FLOAT_VECTOR4", { getGLSL: function() { return "vec4" } }), INT: new e(5124, "INT", { getGLSL: function() { return "int" } }), INT_VECTOR2: new e(35667, "INT_VECTOR2", { getGLSL: function() { return "ivec2" } }), INT_VECTOR3: new e(35668, "INT_VECTOR3", { getGLSL: function() { return "ivec3" } }), INT_VECTOR4: new e(35669, "INT_VECTOR4", { getGLSL: function() { return "ivec4" } }), BOOL: new e(35670, "BOOL", { getGLSL: function() { return "bool" } }), BOOL_VECTOR2: new e(35671, "BOOL_VECTOR2", { getGLSL: function() { return "bvec2" } }), BOOL_VECTOR3: new e(35672, "BOOL_VECTOR3", { getGLSL: function() { return "bvec3" } }), BOOL_VECTOR4: new e(35673, "BOOL_VECTOR4", { getGLSL: function() { return "bvec4" } }), FLOAT_MATRIX2: new e(35674, "FLOAT_MATRIX2", { getGLSL: function() { return "mat2" } }), FLOAT_MATRIX3: new e(35675, "FLOAT_MATRIX3", { getGLSL: function() { return "mat3" } }), FLOAT_MATRIX4: new e(35676, "FLOAT_MATRIX4", { getGLSL: function() { return "mat4" } }), SAMPLER_2D: new e(35678, "SAMPLER_2D", { getGLSL: function() { return "sampler2D" } }), SAMPLER_CUBE: new e(35680, "SAMPLER_CUBE", { getGLSL: function() { return "samplerCube" } }) }; return t }), r("Shaders/Builtin/Structs", [], function() { "use strict"; return "struct czm_materialInput\n{\nfloat s;\nvec2 st;\nvec3 str;\nvec3 normalEC;\nmat3 tangentToEyeMatrix;\nvec3 positionToEyeEC;\n};\nstruct czm_material\n{\nvec3 diffuse;\nfloat specular;\nfloat shininess;\nvec3 normal;\nvec3 emission;\nfloat alpha;\n};\nstruct czm_ray\n{\nvec3 origin;\nvec3 direction;\n};\nstruct czm_raySegment\n{\nfloat start;\nfloat stop;\n};\nconst czm_raySegment czm_emptyRaySegment = czm_raySegment(-czm_infinity, -czm_infinity);\nconst czm_raySegment czm_fullRaySegment = czm_raySegment(0.0, czm_infinity);\nstruct czm_ellipsoid\n{\nvec3 center;\nvec3 radii;\nvec3 inverseRadii;\nvec3 inverseRadiiSquared;\n};\n" }), r("Shaders/Builtin/Constants", [], function() { "use strict"; return "const float czm_pi = 3.141592653589793;\nconst float czm_oneOverPi = 0.3183098861837907;\nconst float czm_piOverTwo = 1.5707963267948966;\nconst float czm_piOverThree = 1.0471975511965976;\nconst float czm_piOverFour = 0.7853981633974483;\nconst float czm_piOverSix = 0.5235987755982988;\nconst float czm_threePiOver2 = 4.71238898038469;\nconst float czm_twoPi = 6.283185307179586;\nconst float czm_oneOverTwoPi = 0.15915494309189535;\nconst float czm_radiansPerDegree = 0.017453292519943295;\nconst float czm_degreesPerRadian = 57.29577951308232;\nconst float czm_solarRadius = 699500000.0;\nconst float czm_infinity = 5906376272000.0;\nconst float czm_epsilon1 = 0.1;\nconst float czm_epsilon2 = 0.01;\nconst float czm_epsilon3 = 0.001;\nconst float czm_epsilon4 = 0.0001;\nconst float czm_epsilon5 = 0.00001;\nconst float czm_epsilon6 = 0.000001;\nconst float czm_epsilon7 = 0.0000001;\nconst float czm_webMercatorMaxLatitude = 1.4844222297453324;\nconst float czm_sceneMode2D = 0.0;\nconst float czm_sceneModeColumbusView = 1.0;\nconst float czm_sceneMode3D = 2.0;\nconst float czm_sceneModeMorphing = 3.0;\n" }), r("Shaders/Builtin/Functions/RGBToXYZ", [], function() { "use strict"; return "vec3 czm_RGBToXYZ(vec3 rgb)\n{\nconst mat3 RGB2XYZ = mat3(0.4124, 0.2126, 0.0193,\n0.3576, 0.7152, 0.1192,\n0.1805, 0.0722, 0.9505);\nvec3 xyz = RGB2XYZ * rgb;\nvec3 Yxy;\nYxy.r = xyz.g;\nfloat temp = dot(vec3(1.0), xyz);\nYxy.gb = xyz.rg / temp;\nreturn Yxy;\n}\n" }), r("Shaders/Builtin/Functions/XYZToRGB", [], function() { "use strict"; return "vec3 czm_XYZToRGB(vec3 Yxy)\n{\nconst mat3 XYZ2RGB = mat3( 3.2405, -0.9693, 0.0556,\n-1.5371, 1.8760, -0.2040,\n-0.4985, 0.0416, 1.0572);\nvec3 xyz;\nxyz.r = Yxy.r * Yxy.g / Yxy.b;\nxyz.g = Yxy.r;\nxyz.b = Yxy.r * (1.0 - Yxy.g - Yxy.b) / Yxy.b;\nreturn XYZ2RGB * xyz;\n}\n" }), r("Shaders/Builtin/Functions/antialias", [], function() { "use strict"; return "vec4 czm_antialias(vec4 color1, vec4 color2, vec4 currentColor, float dist, float fuzzFactor)\n{\nfloat val1 = clamp(dist / fuzzFactor, 0.0, 1.0);\nfloat val2 = clamp((dist - 0.5) / fuzzFactor, 0.0, 1.0);\nval1 = val1 * (1.0 - val2);\nval1 = val1 * val1 * (3.0 - (2.0 * val1));\nval1 = pow(val1, 0.5);\nvec4 midColor = (color1 + color2) * 0.5;\nreturn mix(midColor, currentColor, val1);\n}\nvec4 czm_antialias(vec4 color1, vec4 color2, vec4 currentColor, float dist)\n{\nreturn czm_antialias(color1, color2, currentColor, dist, 0.1);\n}\n" }), r("Shaders/Builtin/Functions/cellular", [], function() { "use strict"; return "vec3 _czm_permute289(vec3 x)\n{\nreturn mod((34.0 * x + 1.0) * x, 289.0);\n}\nvec2 czm_cellular(vec2 P)\n{\n#define K 0.142857142857\n#define Ko 0.428571428571\n#define jitter 1.0\nvec2 Pi = mod(floor(P), 289.0);\nvec2 Pf = fract(P);\nvec3 oi = vec3(-1.0, 0.0, 1.0);\nvec3 of = vec3(-0.5, 0.5, 1.5);\nvec3 px = _czm_permute289(Pi.x + oi);\nvec3 p = _czm_permute289(px.x + Pi.y + oi);\nvec3 ox = fract(p*K) - Ko;\nvec3 oy = mod(floor(p*K),7.0)*K - Ko;\nvec3 dx = Pf.x + 0.5 + jitter*ox;\nvec3 dy = Pf.y - of + jitter*oy;\nvec3 d1 = dx * dx + dy * dy;\np = _czm_permute289(px.y + Pi.y + oi);\nox = fract(p*K) - Ko;\noy = mod(floor(p*K),7.0)*K - Ko;\ndx = Pf.x - 0.5 + jitter*ox;\ndy = Pf.y - of + jitter*oy;\nvec3 d2 = dx * dx + dy * dy;\np = _czm_permute289(px.z + Pi.y + oi);\nox = fract(p*K) - Ko;\noy = mod(floor(p*K),7.0)*K - Ko;\ndx = Pf.x - 1.5 + jitter*ox;\ndy = Pf.y - of + jitter*oy;\nvec3 d3 = dx * dx + dy * dy;\nvec3 d1a = min(d1, d2);\nd2 = max(d1, d2);\nd2 = min(d2, d3);\nd1 = min(d1a, d2);\nd2 = max(d1a, d2);\nd1.xy = (d1.x < d1.y) ? d1.xy : d1.yx;\nd1.xz = (d1.x < d1.z) ? d1.xz : d1.zx;\nd1.yz = min(d1.yz, d2.yz);\nd1.y = min(d1.y, d1.z);\nd1.y = min(d1.y, d2.x);\nreturn sqrt(d1.xy);\n}\n" }), r("Shaders/Builtin/Functions/columbusViewMorph", [], function() { "use strict"; return "vec4 czm_columbusViewMorph(vec4 position2D, vec4 position3D, float time)\n{\nvec3 p = mix(position2D.xyz, position3D.xyz, time);\nreturn vec4(p, 1.0);\n}\n" }), r("Shaders/Builtin/Functions/computePosition", [], function() { "use strict"; return "vec4 czm_computePosition();\n" }), r("Shaders/Builtin/Functions/eastNorthUpToEyeCoordinates", [], function() { "use strict"; return "mat3 czm_eastNorthUpToEyeCoordinates(vec3 positionMC, vec3 normalEC)\n{\nvec3 tangentMC = normalize(vec3(-positionMC.y, positionMC.x, 0.0));\nvec3 tangentEC = normalize(czm_normal3D * tangentMC);\nvec3 bitangentEC = normalize(cross(normalEC, tangentEC));\nreturn mat3(\ntangentEC.x, tangentEC.y, tangentEC.z,\nbitangentEC.x, bitangentEC.y, bitangentEC.z,\nnormalEC.x, normalEC.y, normalEC.z);\n}\n" }), r("Shaders/Builtin/Functions/ellipsoidContainsPoint", [], function() { "use strict"; return "bool czm_ellipsoidContainsPoint(czm_ellipsoid ellipsoid, vec3 point)\n{\nvec3 scaled = ellipsoid.inverseRadii * (czm_inverseModelView * vec4(point, 1.0)).xyz;\nreturn (dot(scaled, scaled) <= 1.0);\n}\n" }), r("Shaders/Builtin/Functions/ellipsoidNew", [], function() { "use strict"; return "czm_ellipsoid czm_ellipsoidNew(vec3 center, vec3 radii)\n{\nvec3 inverseRadii = vec3(1.0 / radii.x, 1.0 / radii.y, 1.0 / radii.z);\nvec3 inverseRadiiSquared = inverseRadii * inverseRadii;\nczm_ellipsoid temp = czm_ellipsoid(center, radii, inverseRadii, inverseRadiiSquared);\nreturn temp;\n}\n" }), r("Shaders/Builtin/Functions/ellipsoidWgs84TextureCoordinates", [], function() { "use strict"; return "vec2 czm_ellipsoidWgs84TextureCoordinates(vec3 normal)\n{\nreturn vec2(atan(normal.y, normal.x) * czm_oneOverTwoPi + 0.5, asin(normal.z) * czm_oneOverPi + 0.5);\n}\n" }), r("Shaders/Builtin/Functions/equalsEpsilon", [], function() { "use strict"; return "bool czm_equalsEpsilon(vec4 left, vec4 right, float epsilon) {\nreturn all(lessThanEqual(abs(left - right), vec4(epsilon)));\n}\nbool czm_equalsEpsilon(vec3 left, vec3 right, float epsilon) {\nreturn all(lessThanEqual(abs(left - right), vec3(epsilon)));\n}\nbool czm_equalsEpsilon(vec2 left, vec2 right, float epsilon) {\nreturn all(lessThanEqual(abs(left - right), vec2(epsilon)));\n}\nbool czm_equalsEpsilon(float left, float right, float epsilon) {\nreturn (abs(left - right) <= epsilon);\n}\n" }), r("Shaders/Builtin/Functions/eyeOffset", [], function() { "use strict"; return "vec4 czm_eyeOffset(vec4 positionEC, vec3 eyeOffset)\n{\nvec4 p = positionEC;\nvec4 zEyeOffset = normalize(p) * eyeOffset.z;\np.xy += eyeOffset.xy + zEyeOffset.xy;\np.z += zEyeOffset.z;\nreturn p;\n}\n" }), r("Shaders/Builtin/Functions/eyeToWindowCoordinates", [], function() { "use strict"; return "vec4 czm_eyeToWindowCoordinates(vec4 positionEC)\n{\nvec4 q = czm_projection * positionEC;\nq.xyz /= q.w;\nq.xyz = (czm_viewportTransformation * vec4(q.xyz, 1.0)).xyz;\nreturn q;\n}\n" }), r("Shaders/Builtin/Functions/geodeticSurfaceNormal", [], function() { "use strict"; return "vec3 czm_geodeticSurfaceNormal(vec3 positionOnEllipsoid, vec3 ellipsoidCenter, vec3 oneOverEllipsoidRadiiSquared)\n{\nreturn normalize((positionOnEllipsoid - ellipsoidCenter) * oneOverEllipsoidRadiiSquared);\n}\n" }), r("Shaders/Builtin/Functions/getDefaultMaterial", [], function() { "use strict"; return "czm_material czm_getDefaultMaterial(czm_materialInput materialInput)\n{\nczm_material material;\nmaterial.diffuse = vec3(0.0);\nmaterial.specular = 0.0;\nmaterial.shininess = 1.0;\nmaterial.normal = materialInput.normalEC;\nmaterial.emission = vec3(0.0);\nmaterial.alpha = 1.0;\nreturn material;\n}\n" }), r("Shaders/Builtin/Functions/getWaterNoise", [], function() { "use strict"; return "vec4 czm_getWaterNoise(sampler2D normalMap, vec2 uv, float time, float angleInRadians)\n{\nfloat cosAngle = cos(angleInRadians);\nfloat sinAngle = sin(angleInRadians);\nvec2 s0 = vec2(1.0/17.0, 0.0);\nvec2 s1 = vec2(-1.0/29.0, 0.0);\nvec2 s2 = vec2(1.0/101.0, 1.0/59.0);\nvec2 s3 = vec2(-1.0/109.0, -1.0/57.0);\ns0 = vec2((cosAngle * s0.x) - (sinAngle * s0.y), (sinAngle * s0.x) + (cosAngle * s0.y));\ns1 = vec2((cosAngle * s1.x) - (sinAngle * s1.y), (sinAngle * s1.x) + (cosAngle * s1.y));\ns2 = vec2((cosAngle * s2.x) - (sinAngle * s2.y), (sinAngle * s2.x) + (cosAngle * s2.y));\ns3 = vec2((cosAngle * s3.x) - (sinAngle * s3.y), (sinAngle * s3.x) + (cosAngle * s3.y));\nvec2 uv0 = (uv/103.0) + (time * s0);\nvec2 uv1 = uv/107.0 + (time * s1) + vec2(0.23);\nvec2 uv2 = uv/vec2(897.0, 983.0) + (time * s2) + vec2(0.51);\nvec2 uv3 = uv/vec2(991.0, 877.0) + (time * s3) + vec2(0.71);\nuv0 = fract(uv0);\nuv1 = fract(uv1);\nuv2 = fract(uv2);\nuv3 = fract(uv3);\nvec4 noise = (texture2D(normalMap, uv0)) +\n(texture2D(normalMap, uv1)) +\n(texture2D(normalMap, uv2)) +\n(texture2D(normalMap, uv3));\nreturn ((noise / 4.0) - 0.5) * 2.0;\n}\n" }), r("Shaders/Builtin/Functions/getWgs84EllipsoidEC", [], function() { "use strict"; return "czm_ellipsoid czm_getWgs84EllipsoidEC()\n{\nvec3 radii = vec3(6378137.0, 6378137.0, 6356752.314245);\nvec3 inverseRadii = vec3(1.0 / radii.x, 1.0 / radii.y, 1.0 / radii.z);\nvec3 inverseRadiiSquared = inverseRadii * inverseRadii;\nczm_ellipsoid temp = czm_ellipsoid(czm_view[3].xyz, radii, inverseRadii, inverseRadiiSquared);\nreturn temp;\n}\n" }), r("Shaders/Builtin/Functions/hue", [], function() { "use strict"; return "vec3 czm_hue(vec3 rgb, float adjustment)\n{\nconst mat3 toYIQ = mat3(0.299, 0.587, 0.114,\n0.595716, -0.274453, -0.321263,\n0.211456, -0.522591, 0.311135);\nconst mat3 toRGB = mat3(1.0, 0.9563, 0.6210,\n1.0, -0.2721, -0.6474,\n1.0, -1.107, 1.7046);\nvec3 yiq = toYIQ * rgb;\nfloat hue = atan(yiq.z, yiq.y) + adjustment;\nfloat chroma = sqrt(yiq.z * yiq.z + yiq.y * yiq.y);\nvec3 color = vec3(yiq.x, chroma * cos(hue), chroma * sin(hue));\nreturn toRGB * color;\n}\n" }), r("Shaders/Builtin/Functions/isEmpty", [], function() { "use strict"; return "bool czm_isEmpty(czm_raySegment interval)\n{\nreturn (interval.stop < 0.0);\n}\n" }), r("Shaders/Builtin/Functions/isFull", [], function() { "use strict"; return "bool czm_isFull(czm_raySegment interval)\n{\nreturn (interval.start == 0.0 && interval.stop == czm_infinity);\n}\n" }), r("Shaders/Builtin/Functions/latitudeToWebMercatorFraction", [], function() { "use strict"; return "float czm_latitudeToWebMercatorFraction(float latitude, float southMercatorYLow, float southMercatorYHigh, float oneOverMercatorHeight)\n{\nfloat sinLatitude = sin(latitude);\nfloat mercatorY = 0.5 * log((1.0 + sinLatitude) / (1.0 - sinLatitude));\nfloat t1 = 0.0 - southMercatorYLow;\nfloat e = t1 - 0.0;\nfloat t2 = ((-southMercatorYLow - e) + (0.0 - (t1 - e))) + mercatorY - southMercatorYHigh;\nfloat highDifference = t1 + t2;\nfloat lowDifference = t2 - (highDifference - t1);\nreturn highDifference * oneOverMercatorHeight + lowDifference * oneOverMercatorHeight;\n}\n" }), r("Shaders/Builtin/Functions/luminance", [], function() { "use strict"; return "float czm_luminance(vec3 rgb)\n{\nconst vec3 W = vec3(0.2125, 0.7154, 0.0721);\nreturn dot(rgb, W);\n}\n" }), r("Shaders/Builtin/Functions/modelToWindowCoordinates", [], function() { "use strict"; return "vec4 czm_modelToWindowCoordinates(vec4 position)\n{\nvec4 q = czm_modelViewProjection * position;\nq.xyz /= q.w;\nq.xyz = (czm_viewportTransformation * vec4(q.xyz, 1.0)).xyz;\nreturn q;\n}\n" }), r("Shaders/Builtin/Functions/multiplyWithColorBalance", [], function() { "use strict"; return "vec3 czm_multiplyWithColorBalance(vec3 left, vec3 right)\n{\nconst vec3 W = vec3(0.2125, 0.7154, 0.0721);\nvec3 target = left * right;\nfloat leftLuminance = dot(left, W);\nfloat rightLuminance = dot(right, W);\nfloat targetLuminance = dot(target, W);\nreturn ((leftLuminance + rightLuminance) / (2.0 * targetLuminance)) * target;\n}\n" }), r("Shaders/Builtin/Functions/phong", [], function() { "use strict"; return "float getLambertDiffuse(vec3 lightDirectionEC, vec3 normalEC)\n{\nreturn max(dot(lightDirectionEC, normalEC), 0.0);\n}\nfloat getLambertDiffuseOfMaterial(vec3 lightDirectionEC, czm_material material)\n{\nreturn getLambertDiffuse(lightDirectionEC, material.normal);\n}\nfloat getSpecular(vec3 lightDirectionEC, vec3 toEyeEC, vec3 normalEC, float shininess)\n{\nvec3 toReflectedLight = reflect(-lightDirectionEC, normalEC);\nfloat specular = max(dot(toReflectedLight, toEyeEC), 0.0);\nreturn pow(specular, shininess);\n}\nfloat getSpecularOfMaterial(vec3 lightDirectionEC, vec3 toEyeEC, czm_material material)\n{\nreturn getSpecular(lightDirectionEC, toEyeEC, material.normal, material.shininess);\n}\nvec4 czm_phong(vec3 toEye, czm_material material)\n{\nfloat diffuse = getLambertDiffuseOfMaterial(vec3(0.0, 0.0, 1.0), material) + getLambertDiffuseOfMaterial(vec3(0.0, 1.0, 0.0), material);\nfloat specular = getSpecularOfMaterial(czm_sunDirectionEC, toEye, material) + getSpecularOfMaterial(czm_moonDirectionEC, toEye, material);\nvec3 ambient = vec3(0.0);\nvec3 color = ambient + material.emission;\ncolor += material.diffuse * diffuse;\ncolor += material.specular * specular;\nreturn vec4(color, material.alpha);\n}\n" }), r("Shaders/Builtin/Functions/pointAlongRay", [], function() { "use strict"; return "vec3 czm_pointAlongRay(czm_ray ray, float time)\n{\nreturn ray.origin + (time * ray.direction);\n}\n" }), r("Shaders/Builtin/Functions/rayEllipsoidIntersectionInterval", [], function() { "use strict"; return "czm_raySegment czm_rayEllipsoidIntersectionInterval(czm_ray ray, czm_ellipsoid ellipsoid)\n{\nvec3 q = ellipsoid.inverseRadii * (czm_inverseModelView * vec4(ray.origin, 1.0)).xyz;\nvec3 w = ellipsoid.inverseRadii * (czm_inverseModelView * vec4(ray.direction, 0.0)).xyz;\nq = q - ellipsoid.inverseRadii * (czm_inverseModelView * vec4(ellipsoid.center, 1.0)).xyz;\nfloat q2 = dot(q, q);\nfloat qw = dot(q, w);\nif (q2 > 1.0)\n{\nif (qw >= 0.0)\n{\nreturn czm_emptyRaySegment;\n}\nelse\n{\nfloat qw2 = qw * qw;\nfloat difference = q2 - 1.0;\nfloat w2 = dot(w, w);\nfloat product = w2 * difference;\nif (qw2 < product)\n{\nreturn czm_emptyRaySegment;\n}\nelse if (qw2 > product)\n{\nfloat discriminant = qw * qw - product;\nfloat temp = -qw + sqrt(discriminant);\nfloat root0 = temp / w2;\nfloat root1 = difference / temp;\nif (root0 < root1)\n{\nczm_raySegment i = czm_raySegment(root0, root1);\nreturn i;\n}\nelse\n{\nczm_raySegment i = czm_raySegment(root1, root0);\nreturn i;\n}\n}\nelse\n{\nfloat root = sqrt(difference / w2);\nczm_raySegment i = czm_raySegment(root, root);\nreturn i;\n}\n}\n}\nelse if (q2 < 1.0)\n{\nfloat difference = q2 - 1.0;\nfloat w2 = dot(w, w);\nfloat product = w2 * difference;\nfloat discriminant = qw * qw - product;\nfloat temp = -qw + sqrt(discriminant);\nczm_raySegment i = czm_raySegment(0.0, temp / w2);\nreturn i;\n}\nelse\n{\nif (qw < 0.0)\n{\nfloat w2 = dot(w, w);\nczm_raySegment i = czm_raySegment(0.0, -qw / w2);\nreturn i;\n}\nelse\n{\nreturn czm_emptyRaySegment;\n}\n}\n}\n" }), r("Shaders/Builtin/Functions/saturation", [], function() { "use strict"; return "vec3 czm_saturation(vec3 rgb, float adjustment)\n{\nconst vec3 W = vec3(0.2125, 0.7154, 0.0721);\nvec3 intensity = vec3(dot(rgb, W));\nreturn mix(intensity, rgb, adjustment);\n}\n" }), r("Shaders/Builtin/Functions/snoise", [], function() { "use strict"; return "vec4 _czm_mod289(vec4 x)\n{\nreturn x - floor(x * (1.0 / 289.0)) * 289.0;\n}\nvec3 _czm_mod289(vec3 x)\n{\nreturn x - floor(x * (1.0 / 289.0)) * 289.0;\n}\nvec2 _czm_mod289(vec2 x)\n{\nreturn x - floor(x * (1.0 / 289.0)) * 289.0;\n}\nfloat _czm_mod289(float x)\n{\nreturn x - floor(x * (1.0 / 289.0)) * 289.0;\n}\nvec4 _czm_permute(vec4 x)\n{\nreturn _czm_mod289(((x*34.0)+1.0)*x);\n}\nvec3 _czm_permute(vec3 x)\n{\nreturn _czm_mod289(((x*34.0)+1.0)*x);\n}\nfloat _czm_permute(float x)\n{\nreturn _czm_mod289(((x*34.0)+1.0)*x);\n}\nvec4 _czm_taylorInvSqrt(vec4 r)\n{\nreturn 1.79284291400159 - 0.85373472095314 * r;\n}\nfloat _czm_taylorInvSqrt(float r)\n{\nreturn 1.79284291400159 - 0.85373472095314 * r;\n}\nvec4 _czm_grad4(float j, vec4 ip)\n{\nconst vec4 ones = vec4(1.0, 1.0, 1.0, -1.0);\nvec4 p,s;\np.xyz = floor( fract (vec3(j) * ip.xyz) * 7.0) * ip.z - 1.0;\np.w = 1.5 - dot(abs(p.xyz), ones.xyz);\ns = vec4(lessThan(p, vec4(0.0)));\np.xyz = p.xyz + (s.xyz*2.0 - 1.0) * s.www;\nreturn p;\n}\nfloat czm_snoise(vec2 v)\n{\nconst vec4 C = vec4(0.211324865405187,\n0.366025403784439,\n-0.577350269189626,\n0.024390243902439);\nvec2 i = floor(v + dot(v, C.yy) );\nvec2 x0 = v - i + dot(i, C.xx);\nvec2 i1;\ni1 = (x0.x > x0.y) ? vec2(1.0, 0.0) : vec2(0.0, 1.0);\nvec4 x12 = x0.xyxy + C.xxzz;\nx12.xy -= i1;\ni = _czm_mod289(i);\nvec3 p = _czm_permute( _czm_permute( i.y + vec3(0.0, i1.y, 1.0 )) + i.x + vec3(0.0, i1.x, 1.0 ));\nvec3 m = max(0.5 - vec3(dot(x0,x0), dot(x12.xy,x12.xy), dot(x12.zw,x12.zw)), 0.0);\nm = m*m ;\nm = m*m ;\nvec3 x = 2.0 * fract(p * C.www) - 1.0;\nvec3 h = abs(x) - 0.5;\nvec3 ox = floor(x + 0.5);\nvec3 a0 = x - ox;\nm *= 1.79284291400159 - 0.85373472095314 * ( a0*a0 + h*h );\nvec3 g;\ng.x = a0.x * x0.x + h.x * x0.y;\ng.yz = a0.yz * x12.xz + h.yz * x12.yw;\nreturn 130.0 * dot(m, g);\n}\nfloat czm_snoise(vec3 v)\n{\nconst vec2 C = vec2(1.0/6.0, 1.0/3.0) ;\nconst vec4 D = vec4(0.0, 0.5, 1.0, 2.0);\nvec3 i = floor(v + dot(v, C.yyy) );\nvec3 x0 = v - i + dot(i, C.xxx) ;\nvec3 g = step(x0.yzx, x0.xyz);\nvec3 l = 1.0 - g;\nvec3 i1 = min( g.xyz, l.zxy );\nvec3 i2 = max( g.xyz, l.zxy );\nvec3 x1 = x0 - i1 + C.xxx;\nvec3 x2 = x0 - i2 + C.yyy;\nvec3 x3 = x0 - D.yyy;\ni = _czm_mod289(i);\nvec4 p = _czm_permute( _czm_permute( _czm_permute(\ni.z + vec4(0.0, i1.z, i2.z, 1.0 ))\n+ i.y + vec4(0.0, i1.y, i2.y, 1.0 ))\n+ i.x + vec4(0.0, i1.x, i2.x, 1.0 ));\nfloat n_ = 0.142857142857;\nvec3 ns = n_ * D.wyz - D.xzx;\nvec4 j = p - 49.0 * floor(p * ns.z * ns.z);\nvec4 x_ = floor(j * ns.z);\nvec4 y_ = floor(j - 7.0 * x_ );\nvec4 x = x_ *ns.x + ns.yyyy;\nvec4 y = y_ *ns.x + ns.yyyy;\nvec4 h = 1.0 - abs(x) - abs(y);\nvec4 b0 = vec4( x.xy, y.xy );\nvec4 b1 = vec4( x.zw, y.zw );\nvec4 s0 = floor(b0)*2.0 + 1.0;\nvec4 s1 = floor(b1)*2.0 + 1.0;\nvec4 sh = -step(h, vec4(0.0));\nvec4 a0 = b0.xzyw + s0.xzyw*sh.xxyy ;\nvec4 a1 = b1.xzyw + s1.xzyw*sh.zzww ;\nvec3 p0 = vec3(a0.xy,h.x);\nvec3 p1 = vec3(a0.zw,h.y);\nvec3 p2 = vec3(a1.xy,h.z);\nvec3 p3 = vec3(a1.zw,h.w);\nvec4 norm = _czm_taylorInvSqrt(vec4(dot(p0,p0), dot(p1,p1), dot(p2, p2), dot(p3,p3)));\np0 *= norm.x;\np1 *= norm.y;\np2 *= norm.z;\np3 *= norm.w;\nvec4 m = max(0.6 - vec4(dot(x0,x0), dot(x1,x1), dot(x2,x2), dot(x3,x3)), 0.0);\nm = m * m;\nreturn 42.0 * dot( m*m, vec4( dot(p0,x0), dot(p1,x1),\ndot(p2,x2), dot(p3,x3) ) );\n}\nfloat czm_snoise(vec4 v)\n{\nconst vec4 C = vec4( 0.138196601125011,\n0.276393202250021,\n0.414589803375032,\n-0.447213595499958);\n#define F4 0.309016994374947451\nvec4 i = floor(v + dot(v, vec4(F4)) );\nvec4 x0 = v - i + dot(i, C.xxxx);\nvec4 i0;\nvec3 isX = step( x0.yzw, x0.xxx );\nvec3 isYZ = step( x0.zww, x0.yyz );\ni0.x = isX.x + isX.y + isX.z;\ni0.yzw = 1.0 - isX;\ni0.y += isYZ.x + isYZ.y;\ni0.zw += 1.0 - isYZ.xy;\ni0.z += isYZ.z;\ni0.w += 1.0 - isYZ.z;\nvec4 i3 = clamp( i0, 0.0, 1.0 );\nvec4 i2 = clamp( i0-1.0, 0.0, 1.0 );\nvec4 i1 = clamp( i0-2.0, 0.0, 1.0 );\nvec4 x1 = x0 - i1 + C.xxxx;\nvec4 x2 = x0 - i2 + C.yyyy;\nvec4 x3 = x0 - i3 + C.zzzz;\nvec4 x4 = x0 + C.wwww;\ni = _czm_mod289(i);\nfloat j0 = _czm_permute( _czm_permute( _czm_permute( _czm_permute(i.w) + i.z) + i.y) + i.x);\nvec4 j1 = _czm_permute( _czm_permute( _czm_permute( _czm_permute (\ni.w + vec4(i1.w, i2.w, i3.w, 1.0 ))\n+ i.z + vec4(i1.z, i2.z, i3.z, 1.0 ))\n+ i.y + vec4(i1.y, i2.y, i3.y, 1.0 ))\n+ i.x + vec4(i1.x, i2.x, i3.x, 1.0 ));\nvec4 ip = vec4(1.0/294.0, 1.0/49.0, 1.0/7.0, 0.0) ;\nvec4 p0 = _czm_grad4(j0, ip);\nvec4 p1 = _czm_grad4(j1.x, ip);\nvec4 p2 = _czm_grad4(j1.y, ip);\nvec4 p3 = _czm_grad4(j1.z, ip);\nvec4 p4 = _czm_grad4(j1.w, ip);\nvec4 norm = _czm_taylorInvSqrt(vec4(dot(p0,p0), dot(p1,p1), dot(p2, p2), dot(p3,p3)));\np0 *= norm.x;\np1 *= norm.y;\np2 *= norm.z;\np3 *= norm.w;\np4 *= _czm_taylorInvSqrt(dot(p4,p4));\nvec3 m0 = max(0.6 - vec3(dot(x0,x0), dot(x1,x1), dot(x2,x2)), 0.0);\nvec2 m1 = max(0.6 - vec2(dot(x3,x3), dot(x4,x4) ), 0.0);\nm0 = m0 * m0;\nm1 = m1 * m1;\nreturn 49.0 * ( dot(m0*m0, vec3( dot( p0, x0 ), dot( p1, x1 ), dot( p2, x2 )))\n+ dot(m1*m1, vec2( dot( p3, x3 ), dot( p4, x4 ) ) ) ) ;\n}\n" }), r("Shaders/Builtin/Functions/tangentToEyeSpaceMatrix", [], function() { "use strict"; return "mat3 czm_tangentToEyeSpaceMatrix(vec3 normalEC, vec3 tangentEC, vec3 binormalEC)\n{\nvec3 normal = normalize(normalEC);\nvec3 tangent = normalize(tangentEC);\nvec3 binormal = normalize(binormalEC);\nreturn mat3(tangent.x, tangent.y, tangent.z,\nbinormal.x, binormal.y, binormal.z,\nnormal.x, normal.y, normal.z);\n}\n" }), r("Shaders/Builtin/Functions/translateRelativeToEye", [], function() { "use strict"; return "vec4 czm_translateRelativeToEye(vec3 high, vec3 low)\n{\nvec3 highDifference = high - czm_encodedCameraPositionMCHigh;\nvec3 lowDifference = low - czm_encodedCameraPositionMCLow;\nreturn vec4(highDifference + lowDifference, 1.0);\n}\n" }), r("Shaders/Builtin/Functions/transpose", [], function() { "use strict"; return "mat2 czm_transpose(mat2 matrix)\n{\nreturn mat2(\nmatrix[0][0], matrix[1][0],\nmatrix[0][1], matrix[1][1]);\n}\nmat3 czm_transpose(mat3 matrix)\n{\nreturn mat3(\nmatrix[0][0], matrix[1][0], matrix[2][0],\nmatrix[0][1], matrix[1][1], matrix[2][1],\nmatrix[0][2], matrix[1][2], matrix[2][2]);\n}\nmat4 czm_transpose(mat4 matrix)\n{\nreturn mat4(\nmatrix[0][0], matrix[1][0], matrix[2][0], matrix[3][0],\nmatrix[0][1], matrix[1][1], matrix[2][1], matrix[3][1],\nmatrix[0][2], matrix[1][2], matrix[2][2], matrix[3][2],\nmatrix[0][3], matrix[1][3], matrix[2][3], matrix[3][3]);\n}\n" }), r("Shaders/Builtin/Functions/windowToEyeCoordinates", [], function() { "use strict"; return "vec4 czm_windowToEyeCoordinates(vec4 fragmentCoordinate)\n{\nfloat x = 2.0 * (fragmentCoordinate.x - czm_viewport.x) / czm_viewport.z - 1.0;\nfloat y = 2.0 * (fragmentCoordinate.y - czm_viewport.y) / czm_viewport.w - 1.0;\nfloat z = (fragmentCoordinate.z - czm_viewportTransformation[3][2]) / czm_viewportTransformation[2][2];\nvec4 q = vec4(x, y, z, 1.0);\nq /= fragmentCoordinate.w;\nq = czm_inverseProjection * q;\nreturn q;\n}\n" }), r("Renderer/ShaderProgram", ["../Core/defined", "../Core/DeveloperError", "../Core/FeatureDetection", "../Core/RuntimeError", "../Core/destroyObject", "../Core/Matrix2", "../Core/Matrix3", "../Core/Matrix4", "./UniformDatatype", "../Shaders/Builtin/Structs", "../Shaders/Builtin/Constants", "../Shaders/Builtin/Functions/RGBToXYZ", "../Shaders/Builtin/Functions/XYZToRGB", "../Shaders/Builtin/Functions/antialias", "../Shaders/Builtin/Functions/cellular", "../Shaders/Builtin/Functions/columbusViewMorph", "../Shaders/Builtin/Functions/computePosition", "../Shaders/Builtin/Functions/eastNorthUpToEyeCoordinates", "../Shaders/Builtin/Functions/ellipsoidContainsPoint", "../Shaders/Builtin/Functions/ellipsoidNew", "../Shaders/Builtin/Functions/ellipsoidWgs84TextureCoordinates", "../Shaders/Builtin/Functions/equalsEpsilon", "../Shaders/Builtin/Functions/eyeOffset", "../Shaders/Builtin/Functions/eyeToWindowCoordinates", "../Shaders/Builtin/Functions/geodeticSurfaceNormal", "../Shaders/Builtin/Functions/getDefaultMaterial", "../Shaders/Builtin/Functions/getWaterNoise", "../Shaders/Builtin/Functions/getWgs84EllipsoidEC", "../Shaders/Builtin/Functions/hue", "../Shaders/Builtin/Functions/isEmpty", "../Shaders/Builtin/Functions/isFull", "../Shaders/Builtin/Functions/latitudeToWebMercatorFraction", "../Shaders/Builtin/Functions/luminance", "../Shaders/Builtin/Functions/modelToWindowCoordinates", "../Shaders/Builtin/Functions/multiplyWithColorBalance", "../Shaders/Builtin/Functions/phong", "../Shaders/Builtin/Functions/pointAlongRay", "../Shaders/Builtin/Functions/rayEllipsoidIntersectionInterval", "../Shaders/Builtin/Functions/saturation", "../Shaders/Builtin/Functions/snoise", "../Shaders/Builtin/Functions/tangentToEyeSpaceMatrix", "../Shaders/Builtin/Functions/translateRelativeToEye", "../Shaders/Builtin/Functions/transpose", "../Shaders/Builtin/Functions/windowToEyeCoordinates"], function(e, t, r, i, n, o, a, s, l, u, c, h, d, m, p, f, v, y, g, _, w, C, x, S, E, b, T, A, M, P, D, I, O, R, L, z, N, F, B, V, q, k, U, W) {
  4816. "use strict";
  4817. function G(e, t) { switch (t) {
  4818. case e.FLOAT:
  4819. return function() { return l.FLOAT };
  4820. case e.FLOAT_VEC2:
  4821. return function() { return l.FLOAT_VECTOR2 };
  4822. case e.FLOAT_VEC3:
  4823. return function() { return l.FLOAT_VECTOR3 };
  4824. case e.FLOAT_VEC4:
  4825. return function() { return l.FLOAT_VECTOR4 };
  4826. case e.INT:
  4827. return function() { return l.INT };
  4828. case e.INT_VEC2:
  4829. return function() { return l.INT_VECTOR2 };
  4830. case e.INT_VEC3:
  4831. return function() { return l.INT_VECTOR3 };
  4832. case e.INT_VEC4:
  4833. return function() { return l.INT_VECTOR4 };
  4834. case e.BOOL:
  4835. return function() { return l.BOOL };
  4836. case e.BOOL_VEC2:
  4837. return function() { return l.BOOL_VECTOR2 };
  4838. case e.BOOL_VEC3:
  4839. return function() { return l.BOOL_VECTOR3 };
  4840. case e.BOOL_VEC4:
  4841. return function() { return l.BOOL_VECTOR4 };
  4842. case e.FLOAT_MAT2:
  4843. return function() { return l.FLOAT_MATRIX2 };
  4844. case e.FLOAT_MAT3:
  4845. return function() { return l.FLOAT_MATRIX3 };
  4846. case e.FLOAT_MAT4:
  4847. return function() { return l.FLOAT_MATRIX4 };
  4848. case e.SAMPLER_2D:
  4849. return function() { return l.SAMPLER_2D };
  4850. case e.SAMPLER_CUBE:
  4851. return function() { return l.SAMPLER_CUBE };
  4852. default:
  4853. throw new i("Unrecognized uniform type: " + t) } }
  4854. function H(e) { var t = e.indexOf("#version"); if (-1 !== t) { var r = e.indexOf("\n", t); if (-1 !== t) { var i = e.substring(t, r + 1),
  4855. n = e.substring(0, t) + "//" + e.substring(t); return { version: i, source: n } } } return { version: "", source: e } }
  4856. function j(e) { var t = "",
  4857. r = st; for (var i in r) r.hasOwnProperty(i) && -1 !== e.indexOf(i) && (t += r[i] + " \n"); return t }
  4858. function Y() { return "#ifdef GL_FRAGMENT_PRECISION_HIGH \n precision highp float; \n#else \n precision mediump float; \n#endif \n\n" }
  4859. function X(e, t) { var r = e[t],
  4860. i = "uniform " + r.getDatatype().getGLSL() + " " + t,
  4861. n = r.getSize(); return i += 1 === n ? ";" : "[" + n.toString() + "];" }
  4862. function Z(e) { var t = "",
  4863. r = it; for (var i in r) r.hasOwnProperty(i) && -1 !== e.indexOf(i) && (t += X(r, i) + " \n"); return t }
  4864. function K(t, r, n, o, a) { var s = H(n),
  4865. l = H(o),
  4866. h = j(s.source) + "\n#line 0\n" + s.source,
  4867. d = s.version + c + u + Z(h) + h,
  4868. m = j(l.source) + "\n#line 0\n" + l.source,
  4869. p = l.version + Y() + c + u + Z(m) + m,
  4870. f = t.createShader(t.VERTEX_SHADER);
  4871. t.shaderSource(f, d), t.compileShader(f); var v = t.getShaderInfoLog(f); if (r && v && v.length && console.log("[GL] Vertex shader compile log: " + v), !t.getShaderParameter(f, t.COMPILE_STATUS)) throw t.deleteShader(f), console.error("[GL] Vertex shader compile log: " + v), new i("Vertex shader failed to compile. Compile log: " + v); var y = t.createShader(t.FRAGMENT_SHADER);
  4872. t.shaderSource(y, p), t.compileShader(y); var g = t.getShaderInfoLog(y); if (r && g && g.length && console.log("[GL] Fragment shader compile log: " + g), !t.getShaderParameter(y, t.COMPILE_STATUS)) throw t.deleteShader(f), t.deleteShader(y), console.error("[GL] Fragment shader compile log: " + g), new i("Fragment shader failed to compile. Compile log: " + g); var _ = t.createProgram(); if (t.attachShader(_, f), t.attachShader(_, y), t.deleteShader(f), t.deleteShader(y), e(a))
  4873. for (var w in a) a.hasOwnProperty(w) && t.bindAttribLocation(_, a[w], w);
  4874. t.linkProgram(_); var C = t.getProgramInfoLog(_); if (r && C && C.length && console.log("[GL] Shader program link log: " + C), !t.getProgramParameter(_, t.LINK_STATUS)) throw t.deleteProgram(_), console.error("[GL] Shader program link log: " + C), new i("Program failed to link. Link log: " + C); return _ }
  4875. function J(e, t, r) { for (var i = {}, n = 0; r > n; ++n) { var o = e.getActiveAttrib(t, n),
  4876. a = e.getAttribLocation(t, o.name);
  4877. i[o.name] = { name: o.name, type: o.type, index: a } } return i }
  4878. function Q(e, t) { for (var r = {}, i = [], n = [], o = e.getProgramParameter(t, e.ACTIVE_UNIFORMS), a = 0; o > a; ++a) { var s = e.getActiveUniform(t, a),
  4879. l = "[0]",
  4880. u = -1 !== s.name.indexOf(l, s.name.length - l.length) ? s.name.slice(0, s.name.length - 3) : s.name; if (0 !== u.indexOf("gl_"))
  4881. if (s.name.indexOf("[") < 0) { var c = e.getUniformLocation(t, u),
  4882. h = e.getUniform(t, c),
  4883. d = new nt(e, s, u, c, h);
  4884. r[u] = d, d._setSampler ? n.push(d) : i.push(d) } else { var m, p, f, v, y = u.indexOf("["); if (y >= 0) { if (m = r[u.slice(0, y)], "undefined" == typeof m) continue;
  4885. p = m._getLocations(), p.length <= 1 && (f = m.value, v = e.getUniformLocation(t, u), p.push(v), f.push(e.getUniform(t, v))) } else { p = [], f = []; for (var g = 0; g < s.size; ++g) v = e.getUniformLocation(t, u + "[" + g + "]"), p.push(v), f.push(e.getUniform(t, v));
  4886. m = new ot(e, s, u, p, f), r[u] = m, m._setSampler ? n.push(m) : i.push(m) } } } return { allUniforms: r, uniforms: i, samplerUniforms: n } }
  4887. function $(e) { var t = [],
  4888. r = {}; for (var i in e)
  4889. if (e.hasOwnProperty(i)) { var n = it[i];
  4890. n ? t.push({ uniform: e[i], automaticUniform: n }) : r[i] = e[i] }
  4891. return { automaticUniforms: t, manualUniforms: r } }
  4892. var et, tt, rt, it = { czm_viewport: { getSize: function() { return 1 }, getDatatype: function() { return l.FLOAT_VECTOR4 }, getValue: function(e) { var t = e.getViewport(); return { x: t.x, y: t.y, z: t.width, w: t.height } } }, czm_viewportOrthographic: { getSize: function() { return 1 }, getDatatype: function() { return l.FLOAT_MATRIX4 }, getValue: function(e) { return e.getViewportOrthographic() } }, czm_viewportTransformation: { getSize: function() { return 1 }, getDatatype: function() { return l.FLOAT_MATRIX4 }, getValue: function(e) { return e.getViewportTransformation() } }, czm_model: { getSize: function() { return 1 }, getDatatype: function() { return l.FLOAT_MATRIX4 }, getValue: function(e) { return e.getModel() } }, czm_inverseModel: { getSize: function() { return 1 }, getDatatype: function() { return l.FLOAT_MATRIX4 }, getValue: function(e) { return e.getInverseModel() } }, czm_view: { getSize: function() { return 1 }, getDatatype: function() { return l.FLOAT_MATRIX4 }, getValue: function(e) { return e.getView() } }, czm_view3D: { getSize: function() { return 1 }, getDatatype: function() { return l.FLOAT_MATRIX4 }, getValue: function(e) { return e.getView3D() } }, czm_viewRotation: { getSize: function() { return 1 }, getDatatype: function() { return l.FLOAT_MATRIX3 }, getValue: function(e) { return e.getViewRotation() } }, czm_viewRotation3D: { getSize: function() { return 1 }, getDatatype: function() { return l.FLOAT_MATRIX3 }, getValue: function(e) { return e.getViewRotation3D() } }, czm_inverseView: { getSize: function() { return 1 }, getDatatype: function() { return l.FLOAT_MATRIX4 }, getValue: function(e) { return e.getInverseView() } }, czm_inverseView3D: { getSize: function() { return 1 }, getDatatype: function() { return l.FLOAT_MATRIX4 }, getValue: function(e) { return e.getInverseView3D() } }, czm_inverseViewRotation: { getSize: function() { return 1 }, getDatatype: function() { return l.FLOAT_MATRIX3 }, getValue: function(e) { return e.getInverseViewRotation() } }, czm_inverseViewRotation3D: { getSize: function() { return 1 }, getDatatype: function() { return l.FLOAT_MATRIX3 }, getValue: function(e) { return e.getInverseViewRotation3D() } }, czm_projection: { getSize: function() { return 1 }, getDatatype: function() { return l.FLOAT_MATRIX4 }, getValue: function(e) { return e.getProjection() } }, czm_inverseProjection: { getSize: function() { return 1 }, getDatatype: function() { return l.FLOAT_MATRIX4 }, getValue: function(e) { return e.getInverseProjection() } }, czm_infiniteProjection: { getSize: function() { return 1 }, getDatatype: function() { return l.FLOAT_MATRIX4 }, getValue: function(e) { return e.getInfiniteProjection() } }, czm_modelView: { getSize: function() { return 1 }, getDatatype: function() { return l.FLOAT_MATRIX4 }, getValue: function(e) { return e.getModelView() } }, czm_modelView3D: { getSize: function() { return 1 }, getDatatype: function() { return l.FLOAT_MATRIX4 }, getValue: function(e) { return e.getModelView3D() } }, czm_modelViewRelativeToEye: { getSize: function() { return 1 }, getDatatype: function() { return l.FLOAT_MATRIX4 }, getValue: function(e) { return e.getModelViewRelativeToEye() } }, czm_inverseModelView: { getSize: function() { return 1 }, getDatatype: function() { return l.FLOAT_MATRIX4 }, getValue: function(e) { return e.getInverseModelView() } }, czm_inverseModelView3D: { getSize: function() { return 1 }, getDatatype: function() { return l.FLOAT_MATRIX4 }, getValue: function(e) { return e.getInverseModelView3D() } }, czm_viewProjection: { getSize: function() { return 1 }, getDatatype: function() { return l.FLOAT_MATRIX4 }, getValue: function(e) { return e.getViewProjection() } }, czm_modelViewProjection: { getSize: function() { return 1 }, getDatatype: function() { return l.FLOAT_MATRIX4 }, getValue: function(e) { return e.getModelViewProjection() } }, czm_modelViewProjectionRelativeToEye: { getSize: function() { return 1 }, getDatatype: function() { return l.FLOAT_MATRIX4 }, getValue: function(e) { return e.getModelViewProjectionRelativeToEye() } }, czm_modelViewInfiniteProjection: { getSize: function() { return 1 }, getDatatype: function() { return l.FLOAT_MATRIX4 }, getValue: function(e) { return e.getModelViewInfiniteProjection() } }, czm_normal: { getSize: function() { return 1 }, getDatatype: function() { return l.FLOAT_MATRIX3 }, getValue: function(e) { return e.getNormal() } }, czm_normal3D: { getSize: function() { return 1 }, getDatatype: function() { return l.FLOAT_MATRIX3 }, getValue: function(e) { return e.getNormal3D() } }, czm_inverseNormal: { getSize: function() { return 1 }, getDatatype: function() { return l.FLOAT_MATRIX3 }, getValue: function(e) { return e.getInverseNormal() } }, czm_inverseNormal3D: { getSize: function() { return 1 }, getDatatype: function() { return l.FLOAT_MATRIX3 }, getValue: function(e) { return e.getInverseNormal3D() } }, czm_entireFrustum: { getSize: function() { return 1 }, getDatatype: function() { return l.FLOAT_VECTOR2 }, getValue: function(e) { return e.getEntireFrustum() } }, czm_eyeHeight2D: { getSize: function() { return 1 }, getDatatype: function() { return l.FLOAT_VECTOR2 }, getValue: function(e) { return e.getEyeHeight2D() } }, czm_currentFrustum: { getSize: function() { return 1 }, getDatatype: function() { return l.FLOAT_VECTOR2 }, getValue: function(e) { return e.getCurrentFrustum() } }, czm_pixelSizeInMeters: { getSize: function() { return 1 }, getDatatype: function() { return l.FLOAT }, getValue: function(e) { return e.getPixelSize() } }, czm_sunPositionWC: { getSize: function() { return 1 }, getDatatype: function() { return l.FLOAT_VECTOR3 }, getValue: function(e) { return e.getSunPositionWC() } }, czm_sunPositionColumbusView: { getSize: function() { return 1 }, getDatatype: function() { return l.FLOAT_VECTOR3 }, getValue: function(e) { return e.getSunPositionColumbusView() } }, czm_sunDirectionEC: { getSize: function() { return 1 }, getDatatype: function() { return l.FLOAT_VECTOR3 }, getValue: function(e) { return e.getSunDirectionEC() } }, czm_sunDirectionWC: { getSize: function() { return 1 }, getDatatype: function() { return l.FLOAT_VECTOR3 }, getValue: function(e) { return e.getSunDirectionWC() } }, czm_moonDirectionEC: { getSize: function() { return 1 }, getDatatype: function() { return l.FLOAT_VECTOR3 }, getValue: function(e) { return e.getMoonDirectionEC() } }, czm_encodedCameraPositionMCHigh: { getSize: function() { return 1 }, getDatatype: function() { return l.FLOAT_VECTOR3 }, getValue: function(e) { return e.getEncodedCameraPositionMCHigh() } }, czm_encodedCameraPositionMCLow: { getSize: function() { return 1 }, getDatatype: function() { return l.FLOAT_VECTOR3 }, getValue: function(e) { return e.getEncodedCameraPositionMCLow() } }, czm_viewerPositionWC: { getSize: function() { return 1 }, getDatatype: function() { return l.FLOAT_VECTOR3 }, getValue: function(e) { return e.getInverseView().getTranslation() } }, czm_frameNumber: { getSize: function() { return 1 }, getDatatype: function() { return l.FLOAT }, getValue: function(e) { return e.getFrameState().frameNumber } }, czm_morphTime: { getSize: function() { return 1 }, getDatatype: function() { return l.FLOAT }, getValue: function(e) { return e.getFrameState().morphTime } }, czm_sceneMode: { getSize: function() { return 1 }, getDatatype: function() { return l.FLOAT }, getValue: function(e) { return e.getFrameState().mode.value } }, czm_temeToPseudoFixed: { getSize: function() { return 1 }, getDatatype: function() { return l.FLOAT_MATRIX3 }, getValue: function(e) { return e.getTemeToPseudoFixedMatrix() } } };
  4893. r.supportsTypedArrays() && (et = new Float32Array(4), tt = new Float32Array(9), rt = new Float32Array(16));
  4894. var nt = function(r, n, l, u, c) { this.value = c, this.getName = function() { return l }, this.getDatatype = G(r, n.type), this._getLocation = function() { return u }, this._set = function() { switch (n.type) {
  4895. case r.FLOAT:
  4896. return function() { r.uniform1f(u, this.value) };
  4897. case r.FLOAT_VEC2:
  4898. return function() { var e = this.value;
  4899. r.uniform2f(u, e.x, e.y) };
  4900. case r.FLOAT_VEC3:
  4901. return function() { var e = this.value;
  4902. r.uniform3f(u, e.x, e.y, e.z) };
  4903. case r.FLOAT_VEC4:
  4904. return function() { var i = this.value; if (e(i.red)) r.uniform4f(u, i.red, i.green, i.blue, i.alpha);
  4905. else { if (!e(i.x)) throw new t('Invalid vec4 value for uniform "' + n.name + '".');
  4906. r.uniform4f(u, i.x, i.y, i.z, i.w) } };
  4907. case r.SAMPLER_2D:
  4908. case r.SAMPLER_CUBE:
  4909. return void 0;
  4910. case r.INT:
  4911. case r.BOOL:
  4912. return function() { r.uniform1i(u, this.value) };
  4913. case r.INT_VEC2:
  4914. case r.BOOL_VEC2:
  4915. return function() { var e = this.value;
  4916. r.uniform2i(u, e.x, e.y) };
  4917. case r.INT_VEC3:
  4918. case r.BOOL_VEC3:
  4919. return function() { var e = this.value;
  4920. r.uniform3i(u, e.x, e.y, e.z) };
  4921. case r.INT_VEC4:
  4922. case r.BOOL_VEC4:
  4923. return function() { var e = this.value;
  4924. r.uniform4i(u, e.x, e.y, e.z, e.w) };
  4925. case r.FLOAT_MAT2:
  4926. return function() { r.uniformMatrix2fv(u, !1, o.toArray(this.value, et)) };
  4927. case r.FLOAT_MAT3:
  4928. return function() { r.uniformMatrix3fv(u, !1, a.toArray(this.value, tt)) };
  4929. case r.FLOAT_MAT4:
  4930. return function() { r.uniformMatrix4fv(u, !1, s.toArray(this.value, rt)) };
  4931. default:
  4932. throw new i("Unrecognized uniform type: " + n.type + ' for uniform "' + n.name + '".') } }(), (n.type === r.SAMPLER_2D || n.type === r.SAMPLER_CUBE) && (this._setSampler = function(e) { return r.activeTexture(r.TEXTURE0 + e), r.bindTexture(this.value._getTarget(), this.value._getTexture()), r.uniform1i(u, e), e + 1 }, this._clearSampler = function(e) { return r.activeTexture(r.TEXTURE0 + e), r.bindTexture(this.value._getTarget(), null), e + 1 }) },
  4933. ot = function(r, n, l, u, c) { this.value = c; var h = u;
  4934. this.getName = function() { return l }, this.getDatatype = G(r, n.type), this._getLocations = function() { return h }, this._set = function() { switch (n.type) {
  4935. case r.FLOAT:
  4936. return function() { for (var e = 0; e < h.length; ++e) r.uniform1f(h[e], this.value[e]) };
  4937. case r.FLOAT_VEC2:
  4938. return function() { for (var e = 0; e < h.length; ++e) { var t = this.value[e];
  4939. r.uniform2f(h[e], t.x, t.y) } };
  4940. case r.FLOAT_VEC3:
  4941. return function() { for (var e = 0; e < h.length; ++e) { var t = this.value[e];
  4942. r.uniform3f(h[e], t.x, t.y, t.z) } };
  4943. case r.FLOAT_VEC4:
  4944. return function() { for (var i = 0; i < h.length; ++i) { var n = this.value[i]; if (e(n.red)) r.uniform4f(h[i], n.red, n.green, n.blue, n.alpha);
  4945. else { if (!e(n.x)) throw new t("Invalid vec4 value.");
  4946. r.uniform4f(h[i], n.x, n.y, n.z, n.w) } } };
  4947. case r.SAMPLER_2D:
  4948. case r.SAMPLER_CUBE:
  4949. return void 0;
  4950. case r.INT:
  4951. case r.BOOL:
  4952. return function() { for (var e = 0; e < h.length; ++e) r.uniform1i(h[e], this.value[e]) };
  4953. case r.INT_VEC2:
  4954. case r.BOOL_VEC2:
  4955. return function() { for (var e = 0; e < h.length; ++e) { var t = this.value[e];
  4956. r.uniform2i(h[e], t.x, t.y) } };
  4957. case r.INT_VEC3:
  4958. case r.BOOL_VEC3:
  4959. return function() { for (var e = 0; e < h.length; ++e) { var t = this.value[e];
  4960. r.uniform3i(h[e], t.x, t.y, t.z) } };
  4961. case r.INT_VEC4:
  4962. case r.BOOL_VEC4:
  4963. return function() { for (var e = 0; e < h.length; ++e) { var t = this.value[e];
  4964. r.uniform4i(h[e], t.x, t.y, t.z, t.w) } };
  4965. case r.FLOAT_MAT2:
  4966. return function() { for (var e = 0; e < h.length; ++e) r.uniformMatrix2fv(h[e], !1, o.toArray(this.value[e], et)) };
  4967. case r.FLOAT_MAT3:
  4968. return function() { for (var e = 0; e < h.length; ++e) r.uniformMatrix3fv(h[e], !1, a.toArray(this.value[e], tt)) };
  4969. case r.FLOAT_MAT4:
  4970. return function() { for (var e = 0; e < h.length; ++e) r.uniformMatrix4fv(h[e], !1, s.toArray(this.value[e], rt)) };
  4971. default:
  4972. throw new i("Unrecognized uniform type: " + n.type) } }(), (n.type === r.SAMPLER_2D || n.type === r.SAMPLER_CUBE) && (this._setSampler = function(e) { for (var t = 0; t < h.length; ++t) { var i = this.value[t],
  4973. n = e + t;
  4974. r.activeTexture(r.TEXTURE0 + n), r.bindTexture(i._getTarget(), i._getTexture()), r.uniform1i(h[t], n) } return e + h.length }, this._clearSampler = function(e) { for (var t = 0; t < h.length; ++t) r.activeTexture(r.TEXTURE0 + e + t), r.bindTexture(this.value[t]._getTarget(), null); return e + h.length }) },
  4975. at = function(e, t, r, i, n) { var o = K(e, t, r, i, n),
  4976. a = e.getProgramParameter(o, e.ACTIVE_ATTRIBUTES),
  4977. s = Q(e, o),
  4978. l = $(s.allUniforms);
  4979. this._gl = e, this._program = o, this._numberOfVertexAttributes = a, this._vertexAttributes = J(e, o, a), this._allUniforms = s.allUniforms, this._uniforms = s.uniforms, this._samplerUniforms = s.samplerUniforms, this._automaticUniforms = l.automaticUniforms, this._manualUniforms = l.manualUniforms, this.vertexShaderSource = r, this.fragmentShaderSource = i },
  4980. st = { czm_RGBToXYZ: h, czm_XYZToRGB: d, czm_antialias: m, czm_cellular: p, czm_columbusViewMorph: f, czm_computePosition: v, czm_eastNorthUpToEyeCoordinates: y, czm_ellipsoidContainsPoint: g, czm_ellipsoidNew: _, czm_ellipsoidWgs84TextureCoordinates: w, czm_equalsEpsilon: C, czm_eyeOffset: x, czm_eyeToWindowCoordinates: S, czm_geodeticSurfaceNormal: E, czm_getDefaultMaterial: b, czm_getWaterNoise: T, czm_getWgs84EllipsoidEC: A, czm_hue: M, czm_isEmpty: P, czm_isFull: D, czm_latitudeToWebMercatorFraction: I, czm_luminance: O, czm_modelToWindowCoordinates: R, czm_multiplyWithColorBalance: L, czm_phong: z, czm_pointAlongRay: N, czm_rayEllipsoidIntersectionInterval: F, czm_saturation: B, czm_snoise: V, czm_tangentToEyeSpaceMatrix: q, czm_translateRelativeToEye: k, czm_transpose: U, czm_windowToEyeCoordinates: W };
  4981. return at.prototype.getVertexAttributes = function() { return this._vertexAttributes }, at.prototype.getNumberOfVertexAttributes = function() { return this._numberOfVertexAttributes }, at.prototype.getAllUniforms = function() { return this._allUniforms }, at.prototype.getManualUniforms = function() { return this._manualUniforms }, at.prototype._bind = function() { this._gl.useProgram(this._program) }, at.prototype._unBind = function() { this._gl.useProgram(null); for (var e = this._samplerUniforms, t = 0, r = e.length, i = 0; r > i; ++i) t = e[i]._clearSampler(t) }, at.prototype._setUniforms = function(e, r, i) { var n, o, a = this._uniforms,
  4982. s = this._samplerUniforms,
  4983. l = this._manualUniforms,
  4984. u = this._automaticUniforms; if (e)
  4985. for (var c in l) l.hasOwnProperty(c) && (l[c].value = e[c]()); for (n = u.length, o = 0; n > o; ++o) u[o].uniform.value = u[o].automaticUniform.getValue(r); for (n = a.length, o = 0; n > o; ++o) a[o]._set(); var h = 0; for (n = s.length, o = 0; n > o; ++o) h = s[o]._setSampler(h); if (i) { var d = this._gl,
  4986. m = this._program; if (d.validateProgram(m), !d.getProgramParameter(m, d.VALIDATE_STATUS)) throw new t("Program validation failed. Link log: " + d.getProgramInfoLog(m)) } }, at.prototype.isDestroyed = function() { return !1 }, at.prototype.destroy = function() { return this._gl.deleteProgram(this._program), n(this) }, at.prototype.release = function() { return this._cachedShader ? this._cachedShader.cache.releaseShaderProgram(this) : this.destroy() }, at
  4987. }), r("Renderer/TextureAtlas", ["../Core/BoundingRectangle", "../Core/Cartesian2", "../Core/createGuid", "../Core/defaultValue", "../Core/defined", "../Core/destroyObject", "../Core/DeveloperError", "./PixelFormat"], function(e, t, r, i, n, o, a, s) { "use strict";
  4988. function l(e, r, n, o, a) { this.bottomLeft = i(e, t.ZERO), this.topRight = i(r, t.ZERO), this.childNode1 = n, this.childNode2 = o, this.imageIndex = a }
  4989. function u(e, r) { var i = e.getNumberOfImages(),
  4990. o = 2; if (i > 0) { var a = e._texture.getWidth(),
  4991. s = e._texture.getHeight(),
  4992. u = o * (a + r.width + e._borderWidthInPixels),
  4993. c = o * (s + r.height + e._borderWidthInPixels),
  4994. h = a / u,
  4995. d = s / c,
  4996. m = new l(new t(a + e._borderWidthInPixels, 0), new t(u, s)),
  4997. p = new l(new t, new t(u, s), e._root, m),
  4998. f = new l(new t(0, s + e._borderWidthInPixels), new t(u, c)),
  4999. v = new l(new t, new t(u, c), p, f);
  5000. e._root = v; for (var y = 0; y < e._textureCoordinates.length; y++) { var g = e._textureCoordinates[y];
  5001. n(g) && (g.x *= h, g.y *= d, g.width *= h, g.height *= d) } var _ = e._context.createTexture2D({ width: u, height: c, pixelFormat: e._pixelFormat }),
  5002. w = e._context.createFramebuffer({ colorTexture: e._texture });
  5003. w._bind(), _.copyFromFramebuffer(0, 0, 0, 0, a, s), w._unBind(), w.destroy(), e._texture = _ } else { var C = o * (r.width + e._borderWidthInPixels),
  5004. x = o * (r.height + e._borderWidthInPixels);
  5005. e._texture = e._texture && e._texture.destroy(), e._texture = e._context.createTexture2D({ width: C, height: x, pixelFormat: e._pixelFormat }), e._root = new l(new t, new t(C, x)) } }
  5006. function c(e, r, i) { if (!n(r)) return void 0; if (!n(r.childNode1) && !n(r.childNode2)) { if (n(r.imageIndex)) return void 0; var o = r.topRight.x - r.bottomLeft.x,
  5007. a = r.topRight.y - r.bottomLeft.y,
  5008. s = o - i.width,
  5009. u = a - i.height; if (0 > s || 0 > u) return void 0; if (0 === s && 0 === u) return r; if (s > u) { r.childNode1 = new l(new t(r.bottomLeft.x, r.bottomLeft.y), new t(r.bottomLeft.x + i.width, r.topRight.y)); var h = r.bottomLeft.x + i.width + e._borderWidthInPixels;
  5010. h < r.topRight.x && (r.childNode2 = new l(new t(h, r.bottomLeft.y), new t(r.topRight.x, r.topRight.y))) } else { r.childNode1 = new l(new t(r.bottomLeft.x, r.bottomLeft.y), new t(r.topRight.x, r.bottomLeft.y + i.height)); var d = r.bottomLeft.y + i.height + e._borderWidthInPixels;
  5011. d < r.topRight.y && (r.childNode2 = new l(new t(r.bottomLeft.x, d), new t(r.topRight.x, r.topRight.y))) } return c(e, r.childNode1, i) } return c(e, r.childNode1, i) || c(e, r.childNode2, i) }
  5012. function h(t, r, i) { if (!n(r)) throw new a("image is required."); var o = c(t, t._root, r); if (n(o)) { o.imageIndex = i; var s = t._texture.getWidth(),
  5013. l = t._texture.getHeight(),
  5014. d = o.topRight.x - o.bottomLeft.x,
  5015. m = o.topRight.y - o.bottomLeft.y;
  5016. t._textureCoordinates[i] = new e(o.bottomLeft.x / s, o.bottomLeft.y / l, d / s, m / l), t._texture.copyFrom(r, o.bottomLeft.x, o.bottomLeft.y) } else u(t, r), h(t, r, i) } var d = new t(16, 16),
  5017. m = function(e) { e = i(e, i.EMPTY_OBJECT); var o = e.context; if (!n(o)) throw new a("context is required."); var u = i(e.borderWidthInPixels, 1); if (0 > u) throw new a("borderWidthInPixels must be greater than or equal to zero."); var c = i(e.initialSize, d); if (c.x < 1 || c.y < 1) throw new a("initialSize must be greater than zero.");
  5018. this._context = o, this._pixelFormat = i(e.pixelFormat, s.RGBA), this._borderWidthInPixels = u, this._textureCoordinates = [], this._guid = r(), this._texture = this._context.createTexture2D({ width: c.x, height: c.y, pixelFormat: this._pixelFormat }), this._root = new l(new t, new t(c.x, c.y)); var h = e.images;
  5019. n(h) && h.length > 0 && this.addImages(h); var m = e.image;
  5020. n(m) && this.addImage(m) }; return m.prototype.addImage = function(e) { var t = this.getNumberOfImages(); return h(this, e, t), this._guid = r(), t }, m.prototype.addImages = function(e) { if (!n(e) || e.length < 1) throw new a("images is required and must have length greater than zero."); var t, i = [],
  5021. o = e.length,
  5022. s = this.getNumberOfImages(); for (t = 0; o > t; ++t) i.push({ image: e[t], index: t + s }); for (i.sort(function(e, t) { return Math.max(t.image.height, t.image.width) - Math.max(e.image.height, e.image.width) }), t = 0; o > t; ++t) { var l = i[t];
  5023. h(this, l.image, l.index) } return this._guid = r(), s }, m.prototype.addSubRegions = function(t, i) { for (var n = this.addImage(t), o = this._texture.getWidth(), a = this._texture.getHeight(), s = this.getNumberOfImages(), l = i.length, u = this._textureCoordinates[n], c = 0; l > c; ++c) { var h = i[c];
  5024. this._textureCoordinates.push(new e(u.x + h.x / o, u.y + h.y / a, h.width / o, h.height / a)) } return this._guid = r(), s }, m.prototype.getBorderWidthInPixels = function() { return this._borderWidthInPixels }, m.prototype.getTextureCoordinates = function() { return this._textureCoordinates }, m.prototype.getTexture = function() { return this._texture }, m.prototype.getNumberOfImages = function() { return this._textureCoordinates.length }, m.prototype.getGUID = function() { return this._guid }, m.prototype.isDestroyed = function() { return !1 }, m.prototype.destroy = function() { return this._texture = this._texture && this._texture.destroy(), o(this) }, m }), r("Renderer/UniformState", ["../Core/Matrix3", "../Core/Matrix4", "../Core/Cartesian2", "../Core/Cartesian3", "../Core/Cartesian4", "../Core/Cartographic", "../Core/defined", "../Core/Math", "../Core/EncodedCartesian3", "../Core/BoundingRectangle", "../Core/Transforms", "../Core/Simon1994PlanetaryPositions", "../Scene/SceneMode"], function(e, t, r, i, n, o, a, s, l, u, c, h, d) {
  5025. "use strict";
  5026. function m(e, r) { t.clone(r, e._view), t.getRotation(r, e._viewRotation), e._view3DDirty = !0, e._inverseView3DDirty = !0, e._modelViewDirty = !0, e._modelView3DDirty = !0, e._modelViewRelativeToEyeDirty = !0, e._inverseModelViewDirty = !0, e._inverseModelView3DDirty = !0, e._viewProjectionDirty = !0, e._modelViewProjectionDirty = !0, e._modelViewProjectionRelativeToEyeDirty = !0, e._modelViewInfiniteProjectionDirty = !0, e._normalDirty = !0, e._inverseNormalDirty = !0, e._normal3DDirty = !0, e._inverseNormal3DDirty = !0 }
  5027. function p(e, r) { t.clone(r, e._inverseView), t.getRotation(r, e._inverseViewRotation) }
  5028. function f(e, r) { t.clone(r, e._projection), e._inverseProjectionDirty = !0, e._viewProjectionDirty = !0, e._modelViewProjectionDirty = !0, e._modelViewProjectionRelativeToEyeDirty = !0 }
  5029. function v(e, r) { t.clone(r, e._infiniteProjection), e._modelViewInfiniteProjectionDirty = !0 }
  5030. function y(e, t) { i.clone(t.getPositionWC(), e._cameraPosition), i.clone(t.getDirectionWC(), e._cameraDirection), i.clone(t.getRightWC(), e._cameraRight), i.clone(t.getUpWC(), e._cameraUp), e._encodedCameraPositionMCDirty = !0 }
  5031. function g(t, r) { a(c.computeIcrfToFixedMatrix(r.time, F)) || (F = c.computeTemeToPseudoFixedMatrix(r.time, F)); var n = h.ComputeSunPositionInEarthInertialFrame(r.time, t._sunPositionWC);
  5032. e.multiplyByVector(F, n, n), i.normalize(n, t._sunDirectionWC), n = e.multiplyByVector(t.getViewRotation3D(), n, t._sunDirectionEC), i.normalize(n, n), n = h.ComputeMoonPositionInEarthInertialFrame(r.time, t._moonDirectionEC), e.multiplyByVector(F, n, n), e.multiplyByVector(t.getViewRotation3D(), n, n), i.normalize(n, n); var o = r.scene2D.projection,
  5033. s = o.getEllipsoid(),
  5034. l = s.cartesianToCartographic(t._sunPositionWC, B);
  5035. o.project(l, t._sunPositionColumbusView) }
  5036. function _(e) { if (e._viewportDirty) { var r = e._viewport;
  5037. t.computeOrthographicOffCenter(r.x, r.x + r.width, r.y, r.y + r.height, 0, 1, e._viewportOrthographicMatrix), t.computeViewportTransformation(r, 0, 1, e._viewportTransformation), e._viewportDirty = !1 } }
  5038. function w(e) { e._inverseProjectionDirty && (e._inverseProjectionDirty = !1, t.inverse(e._projection, e._inverseProjection)) }
  5039. function C(e) { e._modelViewDirty && (e._modelViewDirty = !1, t.multiply(e._view, e._model, e._modelView)) }
  5040. function x(e) { e._modelView3DDirty && (e._modelView3DDirty = !1, t.multiply(e.getView3D(), e._model, e._modelView3D)) }
  5041. function S(e) { if (e._modelViewRelativeToEyeDirty) { e._modelViewRelativeToEyeDirty = !1; var t = e.getModelView(),
  5042. r = e._modelViewRelativeToEye;
  5043. r[0] = t[0], r[1] = t[1], r[2] = t[2], r[3] = t[3], r[4] = t[4], r[5] = t[5], r[6] = t[6], r[7] = t[7], r[8] = t[8], r[9] = t[9], r[10] = t[10], r[11] = t[11], r[12] = 0, r[13] = 0, r[14] = 0, r[15] = t[15] } }
  5044. function E(e) { e._inverseModelViewDirty && (e._inverseModelViewDirty = !1, t.inverse(e.getModelView(), e._inverseModelView)) }
  5045. function b(e) { e._inverseModelView3DDirty && (e._inverseModelView3DDirty = !1, t.inverse(e.getModelView3D(), e._inverseModelView3D)) }
  5046. function T(e) { e._viewProjectionDirty && (e._viewProjectionDirty = !1, t.multiply(e._projection, e._view, e._viewProjection)) }
  5047. function A(e) { e._modelViewProjectionDirty && (e._modelViewProjectionDirty = !1, t.multiply(e._projection, e.getModelView(), e._modelViewProjection)) }
  5048. function M(e) { e._modelViewProjectionRelativeToEyeDirty && (e._modelViewProjectionRelativeToEyeDirty = !1, t.multiply(e._projection, e.getModelViewRelativeToEye(), e._modelViewProjectionRelativeToEye)) }
  5049. function P(e) { e._modelViewInfiniteProjectionDirty && (e._modelViewInfiniteProjectionDirty = !1, t.multiply(e._infiniteProjection, e.getModelView(), e._modelViewInfiniteProjection)) }
  5050. function D(e) { e._normalDirty && (e._normalDirty = !1, t.transpose(e.getInverseModelView(), V), t.getRotation(V, e._normal)) }
  5051. function I(e) { e._normal3DDirty && (e._normal3DDirty = !1, t.transpose(e.getInverseModelView3D(), V), t.getRotation(V, e._normal3D)) }
  5052. function O(e) { e._inverseNormalDirty && (e._inverseNormalDirty = !1, t.getRotation(e.getInverseModelView(), e._inverseNormal)) }
  5053. function R(e) { e._inverseNormal3DDirty && (e._inverseNormal3DDirty = !1, t.getRotation(e.getInverseModelView3D(), e._inverseNormal3D)) }
  5054. function L(e) { e._encodedCameraPositionMCDirty && (e._encodedCameraPositionMCDirty = !1, e.getInverseModel().multiplyByPoint(e._cameraPosition, q), l.fromCartesian(q, e._encodedCameraPositionMC)) }
  5055. function z(e, r, n, o, l, u, h, m) { var p = k;
  5056. p.x = e.y, p.y = e.z, p.z = e.x; var f = U;
  5057. f.x = n.y, f.y = n.z, f.z = n.x; var v = W;
  5058. v.x = o.y, v.y = o.z, v.z = o.x; var y = G;
  5059. y.x = r.y, y.y = r.z, y.z = r.x, u === d.SCENE2D && (p.z = .5 * l); var g = h.unproject(p, H);
  5060. g.longitude = s.clamp(g.longitude, -Math.PI, Math.PI), g.latitude = s.clamp(g.latitude, -s.PI_OVER_TWO, s.PI_OVER_TWO); var _ = h.getEllipsoid(),
  5061. w = _.cartographicToCartesian(g, j),
  5062. C = c.eastNorthUpToFixedFrame(w, _, Y); return C.multiplyByVector(f, f), C.multiplyByVector(v, v), C.multiplyByVector(y, y), a(m) || (m = new t), m[0] = f.x, m[1] = v.x, m[2] = -y.x, m[3] = 0, m[4] = f.y, m[5] = v.y, m[6] = -y.y, m[7] = 0, m[8] = f.z, m[9] = v.z, m[10] = -y.z, m[11] = 0, m[12] = -i.dot(f, w), m[13] = -i.dot(v, w), m[14] = i.dot(y, w), m[15] = 1, m }
  5063. var N = function() { this._viewport = new u, this._viewportDirty = !1, this._viewportOrthographicMatrix = t.IDENTITY.clone(), this._viewportTransformation = t.IDENTITY.clone(), this._model = t.IDENTITY.clone(), this._view = t.IDENTITY.clone(), this._inverseView = t.IDENTITY.clone(), this._projection = t.IDENTITY.clone(), this._infiniteProjection = t.IDENTITY.clone(), this._entireFrustum = new r, this._currentFrustum = new r, this._pixelSize = 0, this._frameState = void 0, this._temeToPseudoFixed = e.IDENTITY.clone(), this._view3DDirty = !0, this._view3D = new t, this._inverseView3DDirty = !0, this._inverseView3D = new t, this._inverseModelDirty = !0, this._inverseModel = new t, this._viewRotation = new e, this._inverseViewRotation = new e, this._viewRotation3D = new e, this._inverseViewRotation3D = new e, this._inverseProjectionDirty = !0, this._inverseProjection = new t, this._modelViewDirty = !0, this._modelView = new t, this._modelView3DDirty = !0, this._modelView3D = new t, this._modelViewRelativeToEyeDirty = !0, this._modelViewRelativeToEye = new t, this._inverseModelViewDirty = !0, this._inverseModelView = new t, this._inverseModelView3DDirty = !0, this._inverseModelView3D = new t, this._viewProjectionDirty = !0, this._viewProjection = new t, this._modelViewProjectionDirty = !0, this._modelViewProjection = new t, this._modelViewProjectionRelativeToEyeDirty = !0, this._modelViewProjectionRelativeToEye = new t, this._modelViewInfiniteProjectionDirty = !0, this._modelViewInfiniteProjection = new t, this._normalDirty = !0, this._normal = new e, this._normal3DDirty = !0, this._normal3D = new e, this._inverseNormalDirty = !0, this._inverseNormal = new e, this._inverseNormal3DDirty = !0, this._inverseNormal3D = new e, this._encodedCameraPositionMCDirty = !0, this._encodedCameraPositionMC = new l, this._cameraPosition = new i, this._sunPositionWC = new i, this._sunPositionColumbusView = new i, this._sunDirectionWC = new i, this._sunDirectionEC = new i, this._moonDirectionEC = new i, this._mode = void 0, this._mapProjection = void 0, this._cameraDirection = new i, this._cameraRight = new i, this._cameraUp = new i, this._frustum2DWidth = 0, this._eyeHeight2D = new r },
  5064. F = new e,
  5065. B = new o;
  5066. N.prototype.updateFrustum = function(e) { f(this, e.getProjectionMatrix()), a(e.getInfiniteProjectionMatrix) && v(this, e.getInfiniteProjectionMatrix()), this._currentFrustum.x = e.near, this._currentFrustum.y = e.far }, N.prototype.update = function(e) { this._mode = e.mode, this._mapProjection = e.scene2D.projection; var t = e.camera;
  5067. m(this, t.getViewMatrix()), p(this, t.getInverseViewMatrix()), y(this, t), e.mode === d.SCENE2D ? (this._frustum2DWidth = t.frustum.right - t.frustum.left, this._eyeHeight2D.x = .5 * this._frustum2DWidth, this._eyeHeight2D.y = this._eyeHeight2D.x * this._eyeHeight2D.x) : (this._frustum2DWidth = 0, this._eyeHeight2D.x = 0, this._eyeHeight2D.y = 0), g(this, e); var r = t.frustum.getPixelSize(e.canvasDimensions);
  5068. this._pixelSize = Math.max(r.x, r.y), this._entireFrustum.x = t.frustum.near, this._entireFrustum.y = t.frustum.far, this.updateFrustum(t.frustum), this._frameState = e, this._temeToPseudoFixed = c.computeTemeToPseudoFixedMatrix(e.time) }, N.prototype.setViewport = function(e) { u.equals(e, this._viewport) || (u.clone(e, this._viewport), this._viewportDirty = !0) }, N.prototype.getViewport = function() { return this._viewport }, N.prototype.getViewportOrthographic = function() { return _(this), this._viewportOrthographicMatrix }, N.prototype.getViewportTransformation = function() { return _(this), this._viewportTransformation }, N.prototype.setModel = function(e) { t.clone(e, this._model), this._modelView3DDirty = !0, this._inverseModelView3DDirty = !0, this._inverseModelDirty = !0, this._modelViewDirty = !0, this._modelViewRelativeToEyeDirty = !0, this._inverseModelViewDirty = !0, this._modelViewProjectionDirty = !0, this._modelViewProjectionRelativeToEyeDirty = !0, this._modelViewInfiniteProjectionDirty = !0, this._normalDirty = !0, this._inverseNormalDirty = !0, this._normal3DDirty = !0, this._inverseNormal3DDirty = !0, this._encodedCameraPositionMCDirty = !0 }, N.prototype.getModel = function() { return this._model }, N.prototype.getInverseModel = function() { return this._inverseModelDirty && (this._inverseModelDirty = !1, this._model.inverse(this._inverseModel)), this._inverseModel }, N.prototype.getView = function() { return this._view }, N.prototype.getView3D = function() { return this._view3DDirty && (this._mode === d.SCENE3D ? t.clone(this._view, this._view3D) : z(this._cameraPosition, this._cameraDirection, this._cameraRight, this._cameraUp, this._frustum2DWidth, this._mode, this._mapProjection, this._view3D), t.getRotation(this._view3D, this._viewRotation3D), this._view3DDirty = !1), this._view3D }, N.prototype.getViewRotation = function() { return this._viewRotation }, N.prototype.getViewRotation3D = function() { return this.getView3D(), this._viewRotation3D }, N.prototype.getInverseView = function() { return this._inverseView }, N.prototype.getInverseView3D = function() { return this._inverseView3DDirty && (t.inverseTransformation(this.getView3D(), this._inverseView3D), t.getRotation(this._inverseView3D, this._inverseViewRotation3D), this._inverseView3DDirty = !1), this._inverseView3D }, N.prototype.getInverseViewRotation = function() {
  5069. return this._inverseViewRotation
  5070. }, N.prototype.getInverseViewRotation3D = function() { return this.getInverseView3D(), this._inverseViewRotation3D }, N.prototype.getProjection = function() { return this._projection }, N.prototype.getInverseProjection = function() { return w(this), this._inverseProjection }, N.prototype.getInfiniteProjection = function() { return this._infiniteProjection }, N.prototype.getModelView = function() { return C(this), this._modelView }, N.prototype.getModelView3D = function() { return x(this), this._modelView3D }, N.prototype.getModelViewRelativeToEye = function() { return S(this), this._modelViewRelativeToEye }, N.prototype.getInverseModelView = function() { return E(this), this._inverseModelView }, N.prototype.getInverseModelView3D = function() { return b(this), this._inverseModelView3D }, N.prototype.getViewProjection = function() { return T(this), this._viewProjection }, N.prototype.getModelViewProjection = function() { return A(this), this._modelViewProjection }, N.prototype.getModelViewProjectionRelativeToEye = function() { return M(this), this._modelViewProjectionRelativeToEye }, N.prototype.getModelViewInfiniteProjection = function() { return P(this), this._modelViewInfiniteProjection };
  5071. var V = new t;
  5072. N.prototype.getNormal = function() { return D(this), this._normal }, N.prototype.getNormal3D = function() { return I(this), this._normal3D }, N.prototype.getInverseNormal = function() { return O(this), this._inverseNormal }, N.prototype.getInverseNormal3D = function() { return R(this), this._inverseNormal3D }, N.prototype.getEntireFrustum = function() { return this._entireFrustum }, N.prototype.getCurrentFrustum = function() { return this._currentFrustum }, N.prototype.getEyeHeight2D = function() { return this._eyeHeight2D }, N.prototype.getPixelSize = function() { return this._pixelSize }, N.prototype.getSunPositionWC = function() { return this._sunPositionWC }, N.prototype.getSunPositionColumbusView = function() { return this._sunPositionColumbusView }, N.prototype.getSunDirectionWC = function() { return this._sunDirectionWC }, N.prototype.getSunDirectionEC = function() { return this._sunDirectionEC }, N.prototype.getMoonDirectionEC = function() { return this._moonDirectionEC };
  5073. var q = new i;
  5074. N.prototype.getEncodedCameraPositionMCHigh = function() { return L(this), this._encodedCameraPositionMC.high }, N.prototype.getEncodedCameraPositionMCLow = function() { return L(this), this._encodedCameraPositionMC.low }, N.prototype.getFrameState = function() { return this._frameState }, N.prototype.getTemeToPseudoFixedMatrix = function() { return this._temeToPseudoFixed }, N.prototype.getHighResolutionSnapScale = function() { return 1 };
  5075. var k = new i,
  5076. U = new n,
  5077. W = new n,
  5078. G = new n,
  5079. H = new o,
  5080. j = new i,
  5081. Y = new t;
  5082. return N
  5083. }), r("Renderer/VertexArray", ["../Core/defaultValue", "../Core/defined", "../Core/destroyObject", "../Core/DeveloperError", "../Core/ComponentDatatype"], function(e, t, r, i, n) { "use strict";
  5084. function o(t, r, o) { if (!r.vertexBuffer && !r.value) throw new i("attribute must have a vertexBuffer or a value."); if (r.vertexBuffer && r.value) throw new i("attribute cannot have both a vertexBuffer and a value. It must have either a vertexBuffer property defining per-vertex data or a value property defining data for all vertices."); var a = r.value ? r.value.length : r.componentsPerAttribute; if (1 !== a && 2 !== a && 3 !== a && 4 !== a) { if (r.value) throw new i("attribute.value.length must be in the range [1, 4]."); throw new i("attribute.componentsPerAttribute must be in the range [1, 4].") } if (r.componentDatatype) { var s = r.componentDatatype; if (!n.validate(s)) throw new i("attribute must have a valid componentDatatype or not specify it.") } if (r.strideInBytes && r.strideInBytes > 255) throw new i("attribute must have a strideInBytes less than or equal to 255 or not specify it."); var l = { index: e(r.index, o), enabled: e(r.enabled, !0), vertexBuffer: r.vertexBuffer, value: r.value ? r.value.slice(0) : void 0, componentsPerAttribute: a, componentDatatype: r.componentDatatype || n.FLOAT, normalize: r.normalize || !1, offsetInBytes: r.offsetInBytes || 0, strideInBytes: r.strideInBytes || 0 }; if (l.vertexBuffer) l.vertexAttrib = function(e) { e.bindBuffer(e.ARRAY_BUFFER, this.vertexBuffer._getBuffer()), e.vertexAttribPointer(this.index, this.componentsPerAttribute, this.componentDatatype.value, this.normalize, this.strideInBytes, this.offsetInBytes), e.enableVertexAttribArray(this.index) }, l.disableVertexAttribArray = function(e) { e.disableVertexAttribArray(this.index) };
  5085. else { switch (l.componentsPerAttribute) {
  5086. case 1:
  5087. l.vertexAttrib = function(e) { e.vertexAttrib1fv(this.index, this.value) }; break;
  5088. case 2:
  5089. l.vertexAttrib = function(e) { e.vertexAttrib2fv(this.index, this.value) }; break;
  5090. case 3:
  5091. l.vertexAttrib = function(e) { e.vertexAttrib3fv(this.index, this.value) }; break;
  5092. case 4:
  5093. l.vertexAttrib = function(e) { e.vertexAttrib4fv(this.index, this.value) } } l.disableVertexAttribArray = function() {} } t.push(l) }
  5094. function a(e, r, i) { for (var n = 0; n < r.length; ++n) { var o = r[n];
  5095. o.enabled && o.vertexAttrib(e) } t(i) && e.bindBuffer(e.ELEMENT_ARRAY_BUFFER, i._getBuffer()) } var s = function(e, r, n, s) { var l = []; if (t(n))
  5096. for (var u = 0; u < n.length; ++u) o(l, n[u], u); for (var c = {}, h = 0; h < l.length; ++h) { var d = l[h].index; if (c[d]) throw new i("Index " + d + " is used by more than one attribute.");
  5097. c[d] = !0 } var m;
  5098. null !== r && (m = r.createVertexArrayOES(), r.bindVertexArrayOES(m), a(e, l, s), r.bindVertexArrayOES(null)), this._gl = e, this._vaoExtension = r, this._vao = m, this._attributes = l, this._indexBuffer = s }; return s.prototype.getAttribute = function(e) { if (!t(e)) throw new i("index is required."); return this._attributes[e] }, s.prototype.getNumberOfAttributes = function() { return this._attributes.length }, s.prototype.getIndexBuffer = function() { return this._indexBuffer }, s.prototype._bind = function() { t(this._vao) ? this._vaoExtension.bindVertexArrayOES(this._vao) : a(this._gl, this._attributes, this._indexBuffer) }, s.prototype._unBind = function() { if (t(this._vao)) this._vaoExtension.bindVertexArrayOES(null);
  5099. else { for (var e = this._attributes, r = this._gl, i = 0; i < e.length; ++i) { var n = e[i];
  5100. n.enabled && n.disableVertexAttribArray(r) } this._indexBuffer && r.bindBuffer(r.ELEMENT_ARRAY_BUFFER, null) } }, s.prototype._getNumberOfVertices = function() { if (this._attributes.length > 0) { var e = this._attributes[0],
  5101. t = e.strideInBytes || e.componentsPerAttribute * e.componentDatatype.sizeInBytes; return e.vertexBuffer.getSizeInBytes() / t } return 0 }, s.prototype.isDestroyed = function() { return !1 }, s.prototype.destroy = function() { for (var e = this._attributes, i = 0; i < e.length; ++i) { var n = e[i].vertexBuffer;
  5102. n && !n.isDestroyed() && n.getVertexArrayDestroyable() && n.destroy() } var o = this._indexBuffer; return o && !o.isDestroyed() && o.getVertexArrayDestroyable() && o.destroy(), t(this._vao) && this._vaoExtension.deleteVertexArrayOES(this._vao), r(this) }, s }), r("Renderer/Context", ["../Core/defaultValue", "../Core/defined", "../Core/DeveloperError", "../Core/destroyObject", "../Core/Color", "../Core/ComponentDatatype", "../Core/IndexDatatype", "../Core/RuntimeError", "../Core/PrimitiveType", "../Core/Geometry", "../Core/createGuid", "../Core/Matrix4", "../Core/Math", "./Buffer", "./BufferUsage", "./CubeMap", "./Framebuffer", "./PixelDatatype", "./PixelFormat", "./PickFramebuffer", "./Renderbuffer", "./RenderbufferFormat", "./RenderState", "./ShaderCache", "./ShaderProgram", "./Texture", "./TextureAtlas", "./TextureMagnificationFilter", "./TextureMinificationFilter", "./TextureWrap", "./UniformState", "./VertexArray", "./VertexLayout", "./ClearCommand", "./PassState"], function(e, t, r, i, n, o, a, s, l, u, c, h, d, m, p, f, v, y, g, _, w, C, x, S, E, b, T, A, M, P, D, I, O, R, L) {
  5103. "use strict";
  5104. function z(e, t) { var r = "OpenGL Error: "; switch (t) {
  5105. case e.INVALID_ENUM:
  5106. r += "Invalid enumeration"; break;
  5107. case e.INVALID_VALUE:
  5108. r += "Invalid value"; break;
  5109. case e.INVALID_OPERATION:
  5110. r += "Invalid operation"; break;
  5111. case e.OUT_OF_MEMORY:
  5112. r += "Out of memory"; break;
  5113. case e.CONTEXT_LOST_WEBGL:
  5114. r += "Context lost"; break;
  5115. default:
  5116. r += "Unknown" } return r }
  5117. function N(e, t, r, i) { for (var n = z(e, i) + ": " + t.name + "(", o = 0; o < r.length; ++o) 0 !== o && (n += ", "), n += r[o]; return n += ");" }
  5118. function F(e, t, r) { var i = e.getError(); if (i !== e.NO_ERROR) throw new s(N(e, t, r, i)) }
  5119. function B(e, t) {
  5120. function r(r) { return function() { var i = r.apply(e, arguments); return t(e, r, arguments), i } } if (!t) return e; var i = {}; for (var n in e) { var o = e[n];
  5121. i[n] = "function" == typeof o ? r(o) : o } return i }
  5122. function V(e, t, i, n) { var o; if ("number" == typeof i) o = i;
  5123. else { if ("object" != typeof i || "number" != typeof i.byteLength) throw new r("typedArrayOrSizeInBytes must be either a typed array or a number.");
  5124. o = i.byteLength } if (0 >= o) throw new r("typedArrayOrSizeInBytes must be greater than zero."); if (!p.validate(n)) throw new r("usage is invalid."); var a = e.createBuffer(); return e.bindBuffer(t, a), e.bufferData(t, i, n), e.bindBuffer(t, null), new m(e, t, o, n, a) }
  5125. function q(e, t, r) { var i = e._currentRenderState;
  5126. i !== t && (e._currentRenderState = t, x.partialApply(e._gl, i, t, r)) }
  5127. function k(e) { return e.values.length / e.componentsPerAttribute }
  5128. function U(e) { return e.componentDatatype.sizeInBytes * e.componentsPerAttribute }
  5129. function W(e) { var r, i, n, a = []; for (i in e) e.hasOwnProperty(i) && t(e[i]) && t(e[i].values) && (a.push(i), e[i].componentDatatype.value === o.DOUBLE.value && (e[i].componentDatatype = o.FLOAT, e[i].values = o.createTypedArray(o.FLOAT, e[i].values))); var l, u = a.length; if (u > 0)
  5130. for (l = k(e[a[0]]), r = 1; u > r; ++r) { var c = k(e[a[r]]); if (c !== l) throw new s("Each attribute list must have the same number of vertices. Attribute " + a[r] + " has a different number of vertices " + "(" + c.toString() + ")" + " than attribute " + a[0] + " (" + l.toString() + ").") } a.sort(function(t, r) { return e[r].componentDatatype.sizeInBytes - e[t].componentDatatype.sizeInBytes }); var h = 0,
  5131. d = {}; for (r = 0; u > r; ++r) i = a[r], n = e[i], d[i] = h, h += U(n); if (h > 0) { var m = e[a[0]].componentDatatype.sizeInBytes,
  5132. p = h % m;
  5133. 0 !== p && (h += m - p); var f = l * h,
  5134. v = new ArrayBuffer(f),
  5135. y = {}; for (r = 0; u > r; ++r) { i = a[r]; var g = e[i].componentDatatype.sizeInBytes;
  5136. y[i] = { pointer: o.createTypedArray(e[i].componentDatatype, v), index: d[i] / g, strideInComponentType: h / g } } for (r = 0; l > r; ++r)
  5137. for (var _ = 0; u > _; ++_) { i = a[_], n = e[i]; for (var w = n.values, C = y[i], x = C.pointer, S = n.componentsPerAttribute, E = 0; S > E; ++E) x[C.index + E] = w[r * S + E];
  5138. C.index += C.strideInComponentType }
  5139. return { buffer: v, offsetsInBytes: d, vertexSizeInBytes: h } } return void 0 }
  5140. function G(e, t, r) { this._pickObjects = e, this.key = t, this.color = r }
  5141. var H = function(e, i) { if (!window.WebGLRenderingContext) throw new s("The browser does not support WebGL. Visit http://get.webgl.org."); if (!t(e)) throw new r("canvas is required."); if (this._canvas = e, t(i) || (i = {}), t(i.alpha) || (i.alpha = !1), this._originalGLContext = e.getContext("webgl", i) || e.getContext("experimental-webgl", i), !this._originalGLContext) throw new s("The browser supports WebGL, but initialization failed.");
  5142. this._id = c(), this._validateFB = !1, this._validateSP = !1, this._logShaderCompilation = !1, this._throwOnWebGLError = !1, this._shaderCache = new S(this); var o = this._gl = this._originalGLContext;
  5143. this._version = o.getParameter(o.VERSION), this._shadingLanguageVersion = o.getParameter(o.SHADING_LANGUAGE_VERSION), this._vendor = o.getParameter(o.VENDOR), this._renderer = o.getParameter(o.RENDERER), this._redBits = o.getParameter(o.RED_BITS), this._greenBits = o.getParameter(o.GREEN_BITS), this._blueBits = o.getParameter(o.BLUE_BITS), this._alphaBits = o.getParameter(o.ALPHA_BITS), this._depthBits = o.getParameter(o.DEPTH_BITS), this._stencilBits = o.getParameter(o.STENCIL_BITS), this._maximumCombinedTextureImageUnits = o.getParameter(o.MAX_COMBINED_TEXTURE_IMAGE_UNITS), this._maximumCubeMapSize = o.getParameter(o.MAX_CUBE_MAP_TEXTURE_SIZE), this._maximumFragmentUniformVectors = o.getParameter(o.MAX_FRAGMENT_UNIFORM_VECTORS), this._maximumTextureImageUnits = o.getParameter(o.MAX_TEXTURE_IMAGE_UNITS), this._maximumRenderbufferSize = o.getParameter(o.MAX_RENDERBUFFER_SIZE), this._maximumTextureSize = o.getParameter(o.MAX_TEXTURE_SIZE), this._maximumVaryingVectors = o.getParameter(o.MAX_VARYING_VECTORS), this._maximumVertexAttributes = o.getParameter(o.MAX_VERTEX_ATTRIBS), this._maximumVertexTextureImageUnits = o.getParameter(o.MAX_VERTEX_TEXTURE_IMAGE_UNITS), this._maximumVertexUniformVectors = o.getParameter(o.MAX_VERTEX_UNIFORM_VECTORS), this._aliasedLineWidthRange = o.getParameter(o.ALIASED_LINE_WIDTH_RANGE), this._aliasedPointSizeRange = o.getParameter(o.ALIASED_POINT_SIZE_RANGE), this._maximumViewportDimensions = o.getParameter(o.MAX_VIEWPORT_DIMS), this._antialias = o.getContextAttributes().antialias, this._standardDerivatives = o.getExtension("OES_standard_derivatives"), this._elementIndexUint = o.getExtension("OES_element_index_uint"), this._depthTexture = o.getExtension("WEBKIT_WEBGL_depth_texture") || o.getExtension("MOZ_WEBGL_depth_texture"), this._textureFloat = o.getExtension("OES_texture_float"); var a = o.getExtension("EXT_texture_filter_anisotropic") || o.getExtension("WEBKIT_EXT_texture_filter_anisotropic") || o.getExtension("MOZ_EXT_texture_filter_anisotropic");
  5144. this._textureFilterAnisotropic = a, this._maximumTextureFilterAnisotropy = a ? o.getParameter(a.MAX_TEXTURE_MAX_ANISOTROPY_EXT) : 1, this._vertexArrayObject = o.getExtension("OES_vertex_array_object"); var l = o.getParameter(o.COLOR_CLEAR_VALUE);
  5145. this._clearColor = new n(l[0], l[1], l[2], l[3]), this._clearDepth = o.getParameter(o.DEPTH_CLEAR_VALUE), this._clearStencil = o.getParameter(o.STENCIL_CLEAR_VALUE); var u = new D,
  5146. h = new L(this),
  5147. d = this.createRenderState();
  5148. this._defaultPassState = h, this._defaultRenderState = d, this._defaultTexture = void 0, this._defaultCubeMap = void 0, this._us = u, this._currentFramebuffer = void 0, this._currentSp = void 0, this._currentRenderState = d, this._pickObjects = {}, this._nextPickColor = new Uint32Array(1), this.cache = {}, x.apply(o, d, h) };
  5149. H.prototype.getId = function() { return this._id }, H.prototype.getCanvas = function() { return this._canvas }, H.prototype.getShaderCache = function() { return this._shaderCache }, H.prototype.getUniformState = function() { return this._us }, H.prototype.getVersion = function() { return this._version }, H.prototype.getShadingLanguageVersion = function() { return this._shadingLanguageVersion }, H.prototype.getVendor = function() { return this._vendor }, H.prototype.getRenderer = function() { return this._renderer }, H.prototype.getRedBits = function() { return this._redBits }, H.prototype.getGreenBits = function() { return this._greenBits }, H.prototype.getBlueBits = function() { return this._blueBits }, H.prototype.getAlphaBits = function() { return this._alphaBits }, H.prototype.getDepthBits = function() { return this._depthBits }, H.prototype.getStencilBits = function() { return this._stencilBits }, H.prototype.getMaximumCombinedTextureImageUnits = function() { return this._maximumCombinedTextureImageUnits }, H.prototype.getMaximumCubeMapSize = function() { return this._maximumCubeMapSize }, H.prototype.getMaximumFragmentUniformVectors = function() { return this._maximumFragmentUniformVectors }, H.prototype.getMaximumTextureImageUnits = function() { return this._maximumTextureImageUnits }, H.prototype.getMaximumRenderbufferSize = function() { return this._maximumRenderbufferSize }, H.prototype.getMaximumTextureSize = function() { return this._maximumTextureSize }, H.prototype.getMaximumVaryingVectors = function() { return this._maximumVaryingVectors }, H.prototype.getMaximumVertexAttributes = function() { return this._maximumVertexAttributes }, H.prototype.getMaximumVertexTextureImageUnits = function() { return this._maximumVertexTextureImageUnits }, H.prototype.getMaximumVertexUniformVectors = function() { return this._maximumVertexUniformVectors }, H.prototype.getMinimumAliasedLineWidth = function() { return this._aliasedLineWidthRange[0] }, H.prototype.getMaximumAliasedLineWidth = function() { return this._aliasedLineWidthRange[1] }, H.prototype.getMinimumAliasedPointSize = function() { return this._aliasedPointSizeRange[0] }, H.prototype.getMaximumAliasedPointSize = function() { return this._aliasedPointSizeRange[1] }, H.prototype.getMaximumViewportWidth = function() { return this._maximumViewportDimensions[0] }, H.prototype.getMaximumViewportHeight = function() { return this._maximumViewportDimensions[1] }, H.prototype.getAntialias = function() { return this._antialias }, H.prototype.getStandardDerivatives = function() { return !!this._standardDerivatives }, H.prototype.getElementIndexUint = function() { return !!this._elementIndexUint }, H.prototype.getDepthTexture = function() { return !!this._depthTexture }, H.prototype.getFloatingPointTexture = function() { return !!this._textureFloat }, H.prototype.getTextureFilterAnisotropic = function() { return !!this._textureFilterAnisotropic }, H.prototype.getMaximumTextureFilterAnisotropy = function() { return this._maximumTextureFilterAnisotropy }, H.prototype.getVertexArrayObject = function() { return !!this._vertexArrayObject }, H.prototype.getValidateFramebuffer = function() { return this._validateFB }, H.prototype.setValidateFramebuffer = function(e) { this._validateFB = e }, H.prototype.getValidateShaderProgram = function() { return this._validateSP }, H.prototype.setValidateShaderProgram = function(e) { this._validateSP = e }, H.prototype.getThrowOnWebGLError = function() { return this._throwOnWebGLError }, H.prototype.setThrowOnWebGLError = function(e) { this._throwOnWebGLError = e, this._gl = B(this._originalGLContext, e ? F : null) }, H.prototype.getLogShaderCompilation = function() { return this._logShaderCompilation }, H.prototype.setLogShaderCompilation = function(e) { this._logShaderCompilation = e }, H.prototype.getDefaultTexture = function() { return void 0 === this._defaultTexture && (this._defaultTexture = this.createTexture2D({ source: { width: 1, height: 1, arrayBufferView: new Uint8Array([255, 255, 255, 255]) } })), this._defaultTexture }, H.prototype.getDefaultCubeMap = function() { if (void 0 === this._defaultCubeMap) { var e = { width: 1, height: 1, arrayBufferView: new Uint8Array([255, 255, 255, 255]) };
  5150. this._defaultCubeMap = this.createCubeMap({ source: { positiveX: e, negativeX: e, positiveY: e, negativeY: e, positiveZ: e, negativeZ: e } }) } return this._defaultCubeMap }, H.prototype.createShaderProgram = function(e, t, r) { return new E(this._gl, this._logShaderCompilation, e, t, r) }, H.prototype.createVertexBuffer = function(e, t) { return V(this._gl, this._gl.ARRAY_BUFFER, e, t) }, H.prototype.createIndexBuffer = function(e, t, i) { if (!a.validate(i)) throw new r("Invalid indexDatatype."); if (i.value === a.UNSIGNED_INT.value && !this.getElementIndexUint()) throw new s("IndexDatatype.UNSIGNED_INT requires OES_element_index_uint, which is not supported on this system."); var n = i.sizeInBytes,
  5151. o = this._gl,
  5152. l = V(o, o.ELEMENT_ARRAY_BUFFER, e, t),
  5153. u = l.getSizeInBytes() / n; return l.getIndexDatatype = function() { return i }, l.getBytesPerIndex = function() { return n }, l.getNumberOfIndices = function() { return u }, l }, H.prototype.createVertexArray = function(e, t) { return new I(this._gl, this._vertexArrayObject, e, t) }, H.prototype.createTexture2D = function(i) { if (!i) throw new r("description is required."); var n = i.source,
  5154. o = t(n) ? n.width : i.width,
  5155. a = t(n) ? n.height : i.height; if (!t(o) || !t(a)) throw new r("description requires a source field to create an initialized texture or width and height fields to create a blank texture."); if (0 >= o) throw new r("Width must be greater than zero."); if (o > this._maximumTextureSize) throw new r("Width must be less than or equal to the maximum texture size (" + this._maximumTextureSize + "). Check getMaximumTextureSize()."); if (0 >= a) throw new r("Height must be greater than zero."); if (a > this._maximumTextureSize) throw new r("Height must be less than or equal to the maximum texture size (" + this._maximumTextureSize + "). Check getMaximumTextureSize()."); var l = e(i.pixelFormat, g.RGBA); if (!g.validate(l)) throw new r("Invalid description.pixelFormat."); var u = e(i.pixelDatatype, y.UNSIGNED_BYTE); if (!y.validate(u)) throw new r("Invalid description.pixelDatatype."); if (u === y.FLOAT && !this.getFloatingPointTexture()) throw new s("When description.pixelDatatype is FLOAT, this WebGL implementation must support the OES_texture_float extension."); if (l === g.DEPTH_COMPONENT && u !== y.UNSIGNED_SHORT && u !== y.UNSIGNED_INT) throw new r("When description.pixelFormat is DEPTH_COMPONENT, description.pixelDatatype must be UNSIGNED_SHORT or UNSIGNED_INT."); if (l === g.DEPTH_STENCIL && u !== y.UNSIGNED_INT_24_8_WEBGL) throw new r("When description.pixelFormat is DEPTH_STENCIL, description.pixelDatatype must be UNSIGNED_INT_24_8_WEBGL."); if (g.isDepthFormat(l)) { if (n) throw new r("When description.pixelFormat is DEPTH_COMPONENT or DEPTH_STENCIL, source cannot be provided."); if (!this.getDepthTexture()) throw new s("When description.pixelFormat is DEPTH_COMPONENT or DEPTH_STENCIL, this WebGL implementation must support WEBGL_depth_texture. Check getDepthTexture().") } var c = i.preMultiplyAlpha || l === g.RGB || l === g.LUMINANCE,
  5156. h = e(i.flipY, !0),
  5157. d = this._gl,
  5158. m = d.TEXTURE_2D,
  5159. p = d.createTexture(); return d.activeTexture(d.TEXTURE0), d.bindTexture(m, p), n ? (d.pixelStorei(d.UNPACK_PREMULTIPLY_ALPHA_WEBGL, c), d.pixelStorei(d.UNPACK_FLIP_Y_WEBGL, h), n.arrayBufferView ? d.texImage2D(m, 0, l, o, a, 0, l, u, n.arrayBufferView) : d.texImage2D(m, 0, l, l, u, n)) : d.texImage2D(m, 0, l, o, a, 0, l, u, null), d.bindTexture(m, null), new b(d, this._textureFilterAnisotropic, m, p, l, u, o, a, c, h) }, H.prototype.createTexture2DFromFramebuffer = function(t, i, n, o, a) { if (t = e(t, g.RGB), i = e(i, 0), n = e(n, 0), o = e(o, this._canvas.clientWidth), a = e(a, this._canvas.clientHeight), !g.validate(t)) throw new r("Invalid pixelFormat."); if (g.isDepthFormat(t)) throw new r("pixelFormat cannot be DEPTH_COMPONENT or DEPTH_STENCIL."); if (0 > i) throw new r("framebufferXOffset must be greater than or equal to zero."); if (0 > n) throw new r("framebufferYOffset must be greater than or equal to zero."); if (i + o > this._canvas.clientWidth) throw new r("framebufferXOffset + width must be less than or equal to getCanvas().clientWidth"); if (n + a > this._canvas.clientHeight) throw new r("framebufferYOffset + height must be less than or equal to getCanvas().clientHeight."); var s = this._gl,
  5160. l = s.TEXTURE_2D,
  5161. u = s.createTexture(); return s.activeTexture(s.TEXTURE0), s.bindTexture(l, u), s.copyTexImage2D(l, 0, t, i, n, o, a, 0), s.bindTexture(l, null), new b(s, this._textureFilterAnisotropic, l, u, t, void 0, o, a) }, H.prototype.createTextureAtlas = function(e) { return e = e || {}, e.context = this, new T(e) }, H.prototype.createCubeMap = function(i) {
  5162. function n(e, t) { t.arrayBufferView ? _.texImage2D(e, 0, d, h, h, 0, d, m, t.arrayBufferView) : _.texImage2D(e, 0, d, d, m, t) } if (!i) throw new r("description is required."); var o, a, l = i.source; if (l) { var u = [l.positiveX, l.negativeX, l.positiveY, l.negativeY, l.positiveZ, l.negativeZ]; if (!(u[0] && u[1] && u[2] && u[3] && u[4] && u[5])) throw new r("description.source requires positiveX, negativeX, positiveY, negativeY, positiveZ, and negativeZ faces.");
  5163. o = u[0].width, a = u[0].height; for (var c = 1; 6 > c; ++c)
  5164. if (Number(u[c].width) !== o || Number(u[c].height) !== a) throw new r("Each face in description.source must have the same width and height.") } else o = i.width, a = i.height; if (!t(o) || !t(a)) throw new r("description requires a source field to create an initialized cube map or width and height fields to create a blank cube map."); if (o !== a) throw new r("Width must equal height."); var h = o; if (0 >= h) throw new r("Width and height must be greater than zero."); if (h > this._maximumCubeMapSize) throw new r("Width and height must be less than or equal to the maximum cube map size (" + this._maximumCubeMapSize + "). Check getMaximumCubeMapSize()."); var d = e(i.pixelFormat, g.RGBA); if (!g.validate(d)) throw new r("Invalid description.pixelFormat."); if (g.isDepthFormat(d)) throw new r("description.pixelFormat cannot be DEPTH_COMPONENT or DEPTH_STENCIL."); var m = e(i.pixelDatatype, y.UNSIGNED_BYTE); if (!y.validate(m)) throw new r("Invalid description.pixelDatatype."); if (m === y.FLOAT && !this.getFloatingPointTexture()) throw new s("When description.pixelDatatype is FLOAT, this WebGL implementation must support the OES_texture_float extension."); var p = i.preMultiplyAlpha || d === g.RGB || d === g.LUMINANCE,
  5165. v = e(i.flipY, !0),
  5166. _ = this._gl,
  5167. w = _.TEXTURE_CUBE_MAP,
  5168. C = _.createTexture(); return _.activeTexture(_.TEXTURE0), _.bindTexture(w, C), l ? (_.pixelStorei(_.UNPACK_PREMULTIPLY_ALPHA_WEBGL, p), _.pixelStorei(_.UNPACK_FLIP_Y_WEBGL, v), n(_.TEXTURE_CUBE_MAP_POSITIVE_X, l.positiveX), n(_.TEXTURE_CUBE_MAP_NEGATIVE_X, l.negativeX), n(_.TEXTURE_CUBE_MAP_POSITIVE_Y, l.positiveY), n(_.TEXTURE_CUBE_MAP_NEGATIVE_Y, l.negativeY), n(_.TEXTURE_CUBE_MAP_POSITIVE_Z, l.positiveZ), n(_.TEXTURE_CUBE_MAP_NEGATIVE_Z, l.negativeZ)) : (_.texImage2D(_.TEXTURE_CUBE_MAP_POSITIVE_X, 0, d, h, h, 0, d, m, null), _.texImage2D(_.TEXTURE_CUBE_MAP_NEGATIVE_X, 0, d, h, h, 0, d, m, null), _.texImage2D(_.TEXTURE_CUBE_MAP_POSITIVE_Y, 0, d, h, h, 0, d, m, null), _.texImage2D(_.TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, d, h, h, 0, d, m, null), _.texImage2D(_.TEXTURE_CUBE_MAP_POSITIVE_Z, 0, d, h, h, 0, d, m, null), _.texImage2D(_.TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, d, h, h, 0, d, m, null)), _.bindTexture(w, null), new f(_, this._textureFilterAnisotropic, w, C, d, m, h, p, v) }, H.prototype.createFramebuffer = function(e) { return new v(this._gl, e) }, H.prototype.createRenderbuffer = function(i) { i = e(i, e.EMPTY_OBJECT); var n = e(i.format, C.RGBA4),
  5169. o = t(i.width) ? i.width : this._canvas.clientWidth,
  5170. a = t(i.height) ? i.height : this._canvas.clientHeight,
  5171. s = this._gl; if (!C.validate(n)) throw new r("Invalid format."); if (0 >= o) throw new r("Width must be greater than zero."); if (o > this.getMaximumRenderbufferSize()) throw new r("Width must be less than or equal to the maximum renderbuffer size (" + this.getMaximumRenderbufferSize() + "). Check getMaximumRenderbufferSize()."); if (0 >= a) throw new r("Height must be greater than zero."); if (a > this.getMaximumRenderbufferSize()) throw new r("Height must be less than or equal to the maximum renderbuffer size (" + this.getMaximumRenderbufferSize() + "). Check getMaximumRenderbufferSize()."); return new w(s, n, o, a) };
  5172. var j = 0,
  5173. Y = {};
  5174. H.prototype.createRenderState = function(e) { var r = JSON.stringify(e),
  5175. i = Y[r]; if (t(i)) return i; var n = new x(this, e),
  5176. o = JSON.stringify(n); return i = Y[o], t(i) || (n.id = j++, i = n, Y[o] = i), Y[r] = i, i }, H.prototype.createSampler = function(e) { var i = { wrapS: e.wrapS || P.CLAMP, wrapT: e.wrapT || P.CLAMP, minificationFilter: e.minificationFilter || M.LINEAR, magnificationFilter: e.magnificationFilter || A.LINEAR, maximumAnisotropy: t(e.maximumAnisotropy) ? e.maximumAnisotropy : 1 }; if (!P.validate(i.wrapS)) throw new r("Invalid sampler.wrapS."); if (!P.validate(i.wrapT)) throw new r("Invalid sampler.wrapT."); if (!M.validate(i.minificationFilter)) throw new r("Invalid sampler.minificationFilter."); if (!A.validate(i.magnificationFilter)) throw new r("Invalid sampler.magnificationFilter."); if (i.maximumAnisotropy < 1) throw new r("sampler.maximumAnisotropy must be greater than or equal to one."); return i }, H.prototype._validateFramebuffer = function() { if (this._validateFB) { var e = this._gl,
  5177. t = e.checkFramebufferStatus(e.FRAMEBUFFER); if (t !== e.FRAMEBUFFER_COMPLETE) { var i; switch (t) {
  5178. case e.FRAMEBUFFER_INCOMPLETE_ATTACHMENT:
  5179. i = "Framebuffer is not complete. Incomplete attachment: at least one attachment point with a renderbuffer or texture attached has its attached object no longer in existence or has an attached image with a width or height of zero, or the color attachment point has a non-color-renderable image attached, or the depth attachment point has a non-depth-renderable image attached, or the stencil attachment point has a non-stencil-renderable image attached. Color-renderable formats include GL_RGBA4, GL_RGB5_A1, and GL_RGB565. GL_DEPTH_COMPONENT16 is the only depth-renderable format. GL_STENCIL_INDEX8 is the only stencil-renderable format."; break;
  5180. case e.FRAMEBUFFER_INCOMPLETE_DIMENSIONS:
  5181. i = "Framebuffer is not complete. Incomplete dimensions: not all attached images have the same width and height."; break;
  5182. case e.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:
  5183. i = "Framebuffer is not complete. Missing attachment: no images are attached to the framebuffer."; break;
  5184. case e.FRAMEBUFFER_UNSUPPORTED:
  5185. i = "Framebuffer is not complete. Unsupported: the combination of internal formats of the attached images violates an implementation-dependent set of restrictions." } throw new r(i) } } };
  5186. var X = new R;
  5187. return H.prototype.clear = function(r, i) { r = e(r, X), i = e(i, this._defaultPassState); var o = this._gl,
  5188. a = 0,
  5189. s = r.color,
  5190. l = r.depth,
  5191. u = r.stencil;
  5192. t(s) && (n.equals(this._clearColor, s) || (n.clone(s, this._clearColor), o.clearColor(s.red, s.green, s.blue, s.alpha)), a |= o.COLOR_BUFFER_BIT), t(l) && (l !== this._clearDepth && (this._clearDepth = l, o.clearDepth(l)), a |= o.DEPTH_BUFFER_BIT), t(u) && (u !== this._clearStencil && (this._clearStencil = u, o.clearStencil(u)), a |= o.STENCIL_BUFFER_BIT); var c = e(r.renderState, this._defaultRenderState);
  5193. q(this, c, i); var h = e(r.framebuffer, i.framebuffer);
  5194. t(h) && (h._bind(), this._validateFramebuffer(h)), o.clear(a), t(h) && h._unBind() }, H.prototype.draw = function(t, r) { r = e(r, this._defaultPassState), this.beginDraw(t, r), this.continueDraw(t), this.endDraw() }, H.prototype.beginDraw = function(i, n) { if (!t(i)) throw new r("command is required."); if (!t(i.shaderProgram)) throw new r("command.shaderProgram is required."); var o = e(i.framebuffer, n.framebuffer),
  5195. a = i.shaderProgram,
  5196. s = t(i.renderState) ? i.renderState : this._defaultRenderState; if (t(o) && s.depthTest && s.depthTest.enabled && !o.hasDepthAttachment()) throw new r("The depth test can not be enabled (command.renderState.depthTest.enabled) because the framebuffer (command.framebuffer) does not have a depth or depth-stencil renderbuffer.");
  5197. q(this, s, n), t(o) && (o._bind(), this._validateFramebuffer(o)), a._bind(), this._currentFramebuffer = o, this._currentSp = a }, H.prototype.continueDraw = function(i) { var n = this._currentSp; if (!t(n)) throw new r("beginDraw must be called before continueDraw."); if (!t(i)) throw new r("command is required."); var o = i.primitiveType; if (!l.validate(o)) throw new r("command.primitiveType is required and must be valid."); if (!t(i.vertexArray)) throw new r("command.vertexArray is required."); var a = i.vertexArray,
  5198. s = a.getIndexBuffer(),
  5199. u = i.offset,
  5200. c = i.count,
  5201. d = t(s); if (d ? (u = (u || 0) * s.getBytesPerIndex(), c = c || s.getNumberOfIndices()) : (u = u || 0, c = c || a._getNumberOfVertices()), 0 > u) throw new r("command.offset must be omitted or greater than or equal to zero.");
  5202. c > 0 && (this._us.setModel(e(i.modelMatrix, h.IDENTITY)), n._setUniforms(i.uniformMap, this._us, this._validateSP), a._bind(), d ? this._gl.drawElements(o.value, c, s.getIndexDatatype().value, u) : this._gl.drawArrays(o.value, u, c), a._unBind()) }, H.prototype.endDraw = function() { t(this._currentFramebuffer) && (this._currentFramebuffer._unBind(), this._currentFramebuffer = void 0), this._currentSp._unBind(), this._currentSp = void 0 }, H.prototype.readPixels = function(e) { e = e || {}; var t = Math.max(e.x || 0, 0),
  5203. i = Math.max(e.y || 0, 0),
  5204. n = e.width || this._canvas.clientWidth,
  5205. o = e.height || this._canvas.clientHeight,
  5206. a = e.framebuffer || null; if (0 >= n) throw new r("readState.width must be greater than zero."); if (0 >= o) throw new r("readState.height must be greater than zero."); var s = new Uint8Array(4 * n * o);
  5207. a && (a._bind(), this._validateFramebuffer(a)); var l = this._gl; return l.readPixels(t, i, n, o, l.RGBA, l.UNSIGNED_BYTE, s), a && a._unBind(), s }, H.prototype.createVertexArrayFromGeometry = function(r) { var i, n, s, l = e(r, e.EMPTY_OBJECT),
  5208. c = e(l.geometry, e.EMPTY_OBJECT),
  5209. h = e(l.bufferUsage, p.DYNAMIC_DRAW),
  5210. m = e(l.attributeIndices, e.EMPTY_OBJECT),
  5211. f = t(l.vertexLayout) && l.vertexLayout === O.INTERLEAVED,
  5212. v = l.vertexArrayAttributes,
  5213. y = t(v) ? v : [],
  5214. g = c.attributes; if (f) { var _ = W(g); if (t(_)) { s = this.createVertexBuffer(_.buffer, h); var w = _.offsetsInBytes,
  5215. C = _.vertexSizeInBytes; for (i in g) g.hasOwnProperty(i) && t(g[i]) && (n = g[i], t(n.values) ? y.push({ index: m[i], vertexBuffer: s, componentDatatype: n.componentDatatype, componentsPerAttribute: n.componentsPerAttribute, normalize: n.normalize, offsetInBytes: w[i], strideInBytes: C }) : y.push({ index: m[i], value: n.value, componentDatatype: n.componentDatatype, normalize: n.normalize })) } } else
  5216. for (i in g)
  5217. if (g.hasOwnProperty(i) && t(g[i])) { n = g[i]; var x = n.componentDatatype;
  5218. x.value === o.DOUBLE.value && (x = o.FLOAT), s = void 0, t(n.values) && (s = this.createVertexBuffer(o.createTypedArray(x, n.values), h)), y.push({ index: m[i], vertexBuffer: s, value: n.value, componentDatatype: x, componentsPerAttribute: n.componentsPerAttribute, normalize: n.normalize }) } var S, E = c.indices; return t(E) && (S = u.computeNumberOfVertices(c) > d.SIXTY_FOUR_KILOBYTES && this.getElementIndexUint() ? this.createIndexBuffer(new Uint32Array(E), h, a.UNSIGNED_INT) : this.createIndexBuffer(new Uint16Array(E), h, a.UNSIGNED_SHORT)), this.createVertexArray(y, S) }, H.prototype.createPickFramebuffer = function() { return new _(this) }, H.prototype.getObjectByPickColor = function(e) { if (!t(e)) throw new r("pickColor is required."); return this._pickObjects[e.toRgba()] }, G.prototype.destroy = function() { return delete this._pickObjects[this.key], void 0 }, H.prototype.createPickId = function(e) { if (!t(e)) throw new r("object is required.");++this._nextPickColor[0]; var i = this._nextPickColor[0]; if (0 === i) throw new s("Out of unique Pick IDs."); return this._pickObjects[i] = e, new G(this._pickObjects, i, n.fromRgba(i)) }, H.prototype.isDestroyed = function() { return !1 }, H.prototype.destroy = function() {
  5219. var e = this.cache;
  5220. for (var r in e)
  5221. if (e.hasOwnProperty(r)) { var n = e[r];
  5222. t(n.destroy) && n.destroy() }
  5223. return this._shaderCache = this._shaderCache.destroy(), this._defaultTexture = this._defaultTexture && this._defaultTexture.destroy(), this._defaultCubeMap = this._defaultCubeMap && this._defaultCubeMap.destroy(), i(this)
  5224. }, H
  5225. }), r("Renderer/loadCubeMap", ["../Core/defined", "../Core/DeveloperError", "../Core/loadImage", "../ThirdParty/when"], function(e, t, r, i) { "use strict"; var n = function(n, o, a) { if (!e(n)) throw new t("context is required."); if (!(e(o) && e(o.positiveX) && e(o.negativeX) && e(o.positiveY) && e(o.negativeY) && e(o.positiveZ) && e(o.negativeZ))) throw new t("urls is required and must have positiveX, negativeX, positiveY, negativeY, positiveZ, and negativeZ properties."); var s = [r(o.positiveX, a), r(o.negativeX, a), r(o.positiveY, a), r(o.negativeY, a), r(o.positiveZ, a), r(o.negativeZ, a)]; return i.all(s, function(e) { return n.createCubeMap({ source: { positiveX: e[0], negativeX: e[1], positiveY: e[2], negativeY: e[3], positiveZ: e[4], negativeZ: e[5] } }) }) }; return n }), r("ThirdParty/Tween", [], function() { var e = e || function() { var e = []; return { REVISION: "7", getAll: function() { return e }, removeAll: function() { e = [] }, add: function(t) { e.push(t) }, remove: function(t) { var r = e.indexOf(t); - 1 !== r && e.splice(r, 1) }, update: function(t) { if (0 === e.length) return !1; var r = 0,
  5226. i = e.length; for (t = void 0 !== t ? t : Date.now(); i > r;) e[r].update(t) ? r++ : (e.splice(r, 1), i--); return !0 } } }(); return e.Tween = function(t) { var r = t,
  5227. i = {},
  5228. n = {},
  5229. o = 1e3,
  5230. a = 0,
  5231. s = null,
  5232. l = e.Easing.Linear.None,
  5233. u = e.Interpolation.Linear,
  5234. c = [],
  5235. h = null,
  5236. d = !1,
  5237. m = null,
  5238. p = null;
  5239. this.to = function(e, t) { return void 0 !== t && (o = t), n = e, this }, this.start = function(t) { e.add(this), d = !1, s = void 0 !== t ? t : Date.now(), s += a; for (var o in n)
  5240. if (null !== r[o]) { if (n[o] instanceof Array) { if (0 === n[o].length) continue;
  5241. n[o] = [r[o]].concat(n[o]) } i[o] = r[o] }
  5242. return this }, this.stop = function() { return e.remove(this), this }, this.delay = function(e) { return a = e, this }, this.easing = function(e) { return l = e, this }, this.interpolation = function(e) { return u = e, this }, this.chain = function() { return c = arguments, this }, this.onStart = function(e) { return h = e, this }, this.onUpdate = function(e) { return m = e, this }, this.onComplete = function(e) { return p = e, this }, this.update = function(e) { if (s > e) return !0;
  5243. d === !1 && (null !== h && h.call(r), d = !0); var t = (e - s) / o;
  5244. t = t > 1 ? 1 : t; var a = l(t); for (var f in i) { var v = i[f],
  5245. y = n[f];
  5246. r[f] = y instanceof Array ? u(y, a) : v + (y - v) * a } if (null !== m && m.call(r, a), 1 == t) { null !== p && p.call(r); for (var g = 0, _ = c.length; _ > g; g++) c[g].start(e); return !1 } return !0 } }, e.Easing = { Linear: { None: function(e) { return e } }, Quadratic: { In: function(e) { return e * e }, Out: function(e) { return e * (2 - e) }, InOut: function(e) { return (e *= 2) < 1 ? .5 * e * e : -.5 * (--e * (e - 2) - 1) } }, Cubic: { In: function(e) { return e * e * e }, Out: function(e) { return --e * e * e + 1 }, InOut: function(e) { return (e *= 2) < 1 ? .5 * e * e * e : .5 * ((e -= 2) * e * e + 2) } }, Quartic: { In: function(e) { return e * e * e * e }, Out: function(e) { return 1 - --e * e * e * e }, InOut: function(e) { return (e *= 2) < 1 ? .5 * e * e * e * e : -.5 * ((e -= 2) * e * e * e - 2) } }, Quintic: { In: function(e) { return e * e * e * e * e }, Out: function(e) { return --e * e * e * e * e + 1 }, InOut: function(e) { return (e *= 2) < 1 ? .5 * e * e * e * e * e : .5 * ((e -= 2) * e * e * e * e + 2) } }, Sinusoidal: { In: function(e) { return 1 - Math.cos(e * Math.PI / 2) }, Out: function(e) { return Math.sin(e * Math.PI / 2) }, InOut: function(e) { return .5 * (1 - Math.cos(Math.PI * e)) } }, Exponential: { In: function(e) { return 0 === e ? 0 : Math.pow(1024, e - 1) }, Out: function(e) { return 1 === e ? 1 : 1 - Math.pow(2, -10 * e) }, InOut: function(e) { return 0 === e ? 0 : 1 === e ? 1 : (e *= 2) < 1 ? .5 * Math.pow(1024, e - 1) : .5 * (-Math.pow(2, -10 * (e - 1)) + 2) } }, Circular: { In: function(e) { return 1 - Math.sqrt(1 - e * e) }, Out: function(e) { return Math.sqrt(1 - --e * e) }, InOut: function(e) { return (e *= 2) < 1 ? -.5 * (Math.sqrt(1 - e * e) - 1) : .5 * (Math.sqrt(1 - (e -= 2) * e) + 1) } }, Elastic: { In: function(e) { var t, r = .1,
  5247. i = .4; return 0 === e ? 0 : 1 === e ? 1 : (!r || 1 > r ? (r = 1, t = i / 4) : t = i * Math.asin(1 / r) / (2 * Math.PI), -(r * Math.pow(2, 10 * (e -= 1)) * Math.sin((e - t) * 2 * Math.PI / i))) }, Out: function(e) { var t, r = .1,
  5248. i = .4; return 0 === e ? 0 : 1 === e ? 1 : (!r || 1 > r ? (r = 1, t = i / 4) : t = i * Math.asin(1 / r) / (2 * Math.PI), r * Math.pow(2, -10 * e) * Math.sin((e - t) * 2 * Math.PI / i) + 1) }, InOut: function(e) { var t, r = .1,
  5249. i = .4; return 0 === e ? 0 : 1 === e ? 1 : (!r || 1 > r ? (r = 1, t = i / 4) : t = i * Math.asin(1 / r) / (2 * Math.PI), (e *= 2) < 1 ? -.5 * r * Math.pow(2, 10 * (e -= 1)) * Math.sin((e - t) * 2 * Math.PI / i) : .5 * r * Math.pow(2, -10 * (e -= 1)) * Math.sin((e - t) * 2 * Math.PI / i) + 1) } }, Back: { In: function(e) { var t = 1.70158; return e * e * ((t + 1) * e - t) }, Out: function(e) { var t = 1.70158; return --e * e * ((t + 1) * e + t) + 1 }, InOut: function(e) { var t = 2.5949095; return (e *= 2) < 1 ? .5 * e * e * ((t + 1) * e - t) : .5 * ((e -= 2) * e * ((t + 1) * e + t) + 2) } }, Bounce: { In: function(t) { return 1 - e.Easing.Bounce.Out(1 - t) }, Out: function(e) { return 1 / 2.75 > e ? 7.5625 * e * e : 2 / 2.75 > e ? 7.5625 * (e -= 1.5 / 2.75) * e + .75 : 2.5 / 2.75 > e ? 7.5625 * (e -= 2.25 / 2.75) * e + .9375 : 7.5625 * (e -= 2.625 / 2.75) * e + .984375 }, InOut: function(t) { return .5 > t ? .5 * e.Easing.Bounce.In(2 * t) : .5 * e.Easing.Bounce.Out(2 * t - 1) + .5 } } }, e.Interpolation = { Linear: function(t, r) { var i = t.length - 1,
  5250. n = i * r,
  5251. o = Math.floor(n),
  5252. a = e.Interpolation.Utils.Linear; return 0 > r ? a(t[0], t[1], n) : r > 1 ? a(t[i], t[i - 1], i - n) : a(t[o], t[o + 1 > i ? i : o + 1], n - o) }, Bezier: function(t, r) { var i, n = 0,
  5253. o = t.length - 1,
  5254. a = Math.pow,
  5255. s = e.Interpolation.Utils.Bernstein; for (i = 0; o >= i; i++) n += a(1 - r, o - i) * a(r, i) * t[i] * s(o, i); return n }, CatmullRom: function(t, r) { var i = t.length - 1,
  5256. n = i * r,
  5257. o = Math.floor(n),
  5258. a = e.Interpolation.Utils.CatmullRom; return t[0] === t[i] ? (0 > r && (o = Math.floor(n = i * (1 + r))), a(t[(o - 1 + i) % i], t[o], t[(o + 1) % i], t[(o + 2) % i], n - o)) : 0 > r ? t[0] - (a(t[0], t[0], t[1], t[1], -n) - t[0]) : r > 1 ? t[i] - (a(t[i], t[i], t[i - 1], t[i - 1], n - i) - t[i]) : a(t[o ? o - 1 : 0], t[o], t[o + 1 > i ? i : o + 1], t[o + 2 > i ? i : o + 2], n - o) }, Utils: { Linear: function(e, t, r) { return (t - e) * r + e }, Bernstein: function(t, r) { var i = e.Interpolation.Utils.Factorial; return i(t) / i(r) / i(t - r) }, Factorial: function() { var e = [1]; return function(t) { var r, i = 1; if (e[t]) return e[t]; for (r = t; r > 1; r--) i *= r; return e[t] = i } }(), CatmullRom: function(e, t, r, i, n) { var o = .5 * (r - e),
  5259. a = .5 * (i - t),
  5260. s = n * n,
  5261. l = n * s; return (2 * t - 2 * r + o + a) * l + (-3 * t + 3 * r - 2 * o - a) * s + o * n + t } } }, e }), r("Scene/AnimationCollection", ["../Core/defined", "../Core/DeveloperError", "../Core/clone", "../ThirdParty/Tween", "../Core/defaultValue"], function(e, t, r, i, n) { "use strict"; var o = function() {}; return o.prototype.add = function(o) { if (o = n(o, n.EMPTY_OBJECT), !e(o.duration)) throw new t("duration is required."); if (o.duration > 0) { var a = n(o.delayDuration, 0),
  5262. s = n(o.easingFunction, i.Easing.Linear.None),
  5263. l = r(o.startValue),
  5264. u = new i.Tween(l); return u.onCancel = o.onCancel, u.to(o.stopValue, o.duration), u.delay(a), u.easing(s), "function" == typeof o.onUpdate && u.onUpdate(function() { o.onUpdate(l) }), u.onComplete(n(o.onComplete, null)), u.start(), { _tween: u } } "function" == typeof o.onComplete && o.onComplete() }, o.prototype.addAlpha = function(r, o, a, s) { if (!e(r)) throw new t("material is required."); var l = []; for (var u in r.uniforms) r.uniforms.hasOwnProperty(u) && e(r.uniforms[u]) && e(r.uniforms[u].alpha) && l.push(u); if (0 === l.length) throw new t("material has no properties with alpha components.");
  5265. o = n(o, 0), a = n(a, 1), s = n(s, n.EMPTY_OBJECT); var c = n(s.duration, 3e3),
  5266. h = n(s.delayDuration, 0),
  5267. d = n(s.easingFunction, i.Easing.Linear.None),
  5268. m = { alpha: o },
  5269. p = new i.Tween(m); return p.to({ alpha: a }, c), p.delay(h), p.easing(d), p.onUpdate(function() { for (var e = l.length, t = 0; e > t; ++t) r.uniforms[l[t]].alpha = m.alpha }), p.onComplete(n(s.onComplete, null)), p.start(), { _tween: p } }, o.prototype.addProperty = function(r, o, a, s, l) { if (!e(r)) throw new t("object is required."); if (!e(o)) throw new t("property is required."); if (!e(r[o])) throw new t("object must have the specified property.");
  5270. l = n(l, n.EMPTY_OBJECT); var u = n(l.duration, 3e3),
  5271. c = n(l.delayDuration, 0),
  5272. h = n(l.easingFunction, i.Easing.Linear.None),
  5273. d = { value: a },
  5274. m = new i.Tween(d); return m.to({ value: s }, u), m.delay(c), m.easing(h), m.onUpdate(function() { r[o] = d.value }), m.onComplete(n(l.onComplete, null)), m.start(), { _tween: m } }, o.prototype.addOffsetIncrement = function(r, o) { if (!e(r)) throw new t("material is required."); if (!e(r.uniforms.offset)) throw new t("material must have an offset property.");
  5275. o = n(o, n.EMPTY_OBJECT); var a = n(o.duration, 3e3),
  5276. s = n(o.delayDuration, 0),
  5277. l = n(o.easingFunction, i.Easing.Linear.None),
  5278. u = { offset: r.uniforms.offset },
  5279. c = new i.Tween(u); return c.to({ offset: r.uniforms.offset + 1 }, a), c.delay(s), c.easing(l), c.onUpdate(function() { r.uniforms.offset = u.offset }), c.onComplete(function() { c.to({ offset: r.uniforms.offset + 1 }, a), c.start() }), c.start(), { _tween: c } }, o.prototype.remove = function(t) { if (e(t)) { var r = i.getAll().length; return i.remove(t._tween), i.getAll().length === r - 1 } return !1 }, o.prototype.removeAll = function() { for (var e = i.getAll(), t = e.length, r = -1; ++r < t;) { var n = e[r]; "function" == typeof n.onCancel && n.onCancel() } i.removeAll() }, o.prototype.contains = function(t) { return e(t) ? -1 !== i.getAll().indexOf(t._tween) : !1 }, o.prototype.update = function() { i.update() }, o }), r("Scene/Credit", ["../Core/defined", "../Core/DeveloperError"], function(e, t) { "use strict"; var r = function(r, i, n) { var o = e(n),
  5280. a = e(i),
  5281. s = e(r); if (!s && !a && !o) throw new t("text, imageUrl or link is required");
  5282. s || a || (r = n), this._text = r, this._imageUrl = i, this._link = n, this._hasLink = o, this._hasImage = a }; return r.prototype.hasImage = function() { return this._hasImage }, r.prototype.hasLink = function() { return this._hasLink }, r.prototype.getText = function() { return this._text }, r.prototype.getImageUrl = function() { return this._imageUrl }, r.prototype.getLink = function() { return this._link }, r.equals = function(t, r) { var i = !e(t),
  5283. n = !e(r); return t === r || (i && n || !i && !n) && t._text === r._text && t._imageUrl === r._imageUrl && t._link === r._link }, r.prototype.equals = function(e) { return r.equals(this, e) }, r }), r("Scene/TerrainProvider", ["../Core/defined", "../Core/DeveloperError", "../Core/ComponentDatatype", "../Renderer/BufferUsage", "../Core/IndexDatatype"], function(e, t, r, i, n) { "use strict";
  5284. function o(e, t, r, i, n) { return e[t++] = r, e[t++] = i, e[t++] = i, e[t++] = n, e[t++] = n, e[t++] = r, t }
  5285. function a(e) { for (var t = e.length, r = new Uint16Array(2 * t), i = 0, n = 0; t > n; n += 3) i = o(r, i, e[n], e[n + 1], e[n + 2]); return r } var s = function() { throw new t("This type should not be instantiated directly.") };
  5286. s.attributeIndices = { position3DAndHeight: 0, textureCoordinates: 1 }; var l = []; return s.getRegularGridIndices = function(t, r) { var i = l[t];
  5287. e(i) || (l[t] = i = []); var n = i[r]; if (!e(n)) { n = i[r] = new Uint16Array(6 * (t - 1) * (r - 1)); for (var o = 0, a = 0, s = 0; r - 1 > s; ++s) { for (var u = 0; t - 1 > u; ++u) { var c = o,
  5288. h = c + t,
  5289. d = h + 1,
  5290. m = c + 1;
  5291. n[a++] = c, n[a++] = h, n[a++] = m, n[a++] = m, n[a++] = h, n[a++] = d, ++o }++o } } return n }, s.createTileEllipsoidGeometryFromBuffers = function(t, o, a, l) { var u = r.FLOAT,
  5292. c = o.vertices,
  5293. h = t.createVertexBuffer(c, i.STATIC_DRAW),
  5294. d = 5 * u.sizeInBytes,
  5295. m = 3;
  5296. l && (d += u.sizeInBytes, ++m); var p = [{ index: s.attributeIndices.position3DAndHeight, vertexBuffer: h, componentDatatype: u, componentsPerAttribute: m, offsetInBytes: 0, strideInBytes: d }, { index: s.attributeIndices.textureCoordinates, vertexBuffer: h, componentDatatype: u, componentsPerAttribute: 2, offsetInBytes: m * u.sizeInBytes, strideInBytes: d }],
  5297. f = o.indices.indexBuffers || {},
  5298. v = f[t.getId()]; if (!e(v) || v.isDestroyed()) { var y = o.indices;
  5299. v = t.createIndexBuffer(y, i.STATIC_DRAW, n.UNSIGNED_SHORT), v.setVertexArrayDestroyable(!1), v.referenceCount = 1, f[t.getId()] = v, o.indices.indexBuffers = f } else ++v.referenceCount;
  5300. a.vertexArray = t.createVertexArray(p, v) }, s.createWireframeVertexArray = function(e, t, r) { var o = a(r.indices),
  5301. s = e.createIndexBuffer(o, i.STATIC_DRAW, n.UNSIGNED_SHORT); return e.createVertexArray(t._attributes, s) }, s.heightmapTerrainQuality = .25, s.getEstimatedLevelZeroGeometricErrorForAHeightmap = function(e, t, r) { return 2 * e.getMaximumRadius() * Math.PI * s.heightmapTerrainQuality / (t * r) }, s.prototype.requestTileGeometry = function() { throw new t("This type should not be instantiated directly.") }, s.prototype.getErrorEvent = function() { throw new t("This type should not be instantiated directly.") }, s.prototype.getLevelMaximumGeometricError = function() { throw new t("This type should not be instantiated directly.") }, s.prototype.getCredit = function() { throw new t("This type should not be instantiated directly.") }, s.prototype.getTilingScheme = function() { throw new t("This type should not be instantiated directly.") }, s.prototype.hasWaterMask = function() { throw new t("This type should not be instantiated directly.") }, s.prototype.isReady = function() { throw new t("This type should not be instantiated directly.") }, s }), r("Scene/ImageryState", ["../Core/Enumeration"], function(e) { "use strict"; var t = { UNLOADED: new e(0, "UNLOADED"), TRANSITIONING: new e(1, "TRANSITIONING"), RECEIVED: new e(2, "RECEIVED"), TEXTURE_LOADED: new e(3, "TEXTURE_LOADED"), READY: new e(4, "READY"), FAILED: new e(5, "FAILED"), INVALID: new e(6, "INVALID"), PLACEHOLDER: new e(7, "PLACEHOLDER") }; return t }), r("Scene/TerrainState", ["../Core/Enumeration"], function(e) { "use strict"; var t = { FAILED: new e(0, "FAILED"), UNLOADED: new e(1, "UNLOADED"), RECEIVING: new e(2, "RECEIVING"), RECEIVED: new e(3, "RECEIVED"), TRANSFORMING: new e(4, "TRANSFORMING"), TRANSFORMED: new e(5, "TRANSFORMED"), READY: new e(6, "READY") }; return t }), r("Scene/TileState", ["../Core/Enumeration"], function(e) { "use strict"; var t = { START: new e(0, "START"), LOADING: new e(1, "LOADING"), READY: new e(2, "READY") }; return t }), r("Scene/TileProviderError", ["../Core/defaultValue", "../Core/defined"], function(e, t) { "use strict"; var r = function(t, r, i, n, o, a) { this.provider = t, this.message = r, this.x = i, this.y = n, this.level = o, this.timesRetried = e(a, 0), this.retry = !1 }; return r.handleError = function(e, i, n, o, a, s, l, u) { var c = e; return t(e) ? (c.provider = i, c.message = o, c.x = a, c.y = s, c.level = l, c.retry = !1, ++c.timesRetried) : c = new r(i, o, a, s, l, 0), n.getNumberOfListeners() > 0 ? n.raiseEvent(c) : (console.log('An error occurred in "' + i.constructor.name + '":'), console.log(o)), c.retry && t(u) && u(), c }, r.handleSuccess = function(e) { t(e) && (e.timesRetried = -1) }, r }), r("Scene/TileTerrain", ["../Core/BoundingSphere", "../Core/Cartesian3", "../Core/defined", "../Core/DeveloperError", "./TerrainProvider", "./TerrainState", "./TileProviderError", "../ThirdParty/when"], function(e, t, r, i, n, o, a, s) { "use strict";
  5302. function l(e, t, i, n, l) {
  5303. function u(t) { e.data = t, e.state = o.RECEIVED }
  5304. function c() { e.state = o.FAILED; var r = "Failed to obtain terrain tile X: " + i + " Y: " + n + " Level: " + l + ".";
  5305. t._requestError = a.handleError(t._requestError, t, t.getErrorEvent(), r, i, n, l, h) }
  5306. function h() { e.data = t.requestTileGeometry(i, n, l), r(e.data) ? (e.state = o.RECEIVING, s(e.data, u, c)) : e.state = o.UNLOADED } h() }
  5307. function u(e, t, i, n, a, l) { var u = i.getTilingScheme(),
  5308. c = e.data,
  5309. h = c.createMesh(u, n, a, l);
  5310. r(h) && (e.state = o.TRANSFORMING, s(h, function(t) { e.mesh = t, e.state = o.TRANSFORMED }, function() { e.state = o.FAILED })) }
  5311. function c(e, t) { n.createTileEllipsoidGeometryFromBuffers(t, e.mesh, e, !0), e.state = o.READY } var h = function(e) { this.state = o.UNLOADED, this.data = void 0, this.mesh = void 0, this.vertexArray = void 0, this.upsampleDetails = e }; return h.prototype.freeResources = function() { if (this.state = o.UNLOADED, this.data = void 0, this.mesh = void 0, r(this.vertexArray)) { var e = this.vertexArray.getIndexBuffer();
  5312. this.vertexArray.destroy(), this.vertexArray = void 0, !e.isDestroyed() && r(e.referenceCount) && (--e.referenceCount, 0 === e.referenceCount && e.destroy()) } }, h.prototype.publishToTile = function(r) { var i = this.mesh;
  5313. t.clone(i.center, r.center), r.minimumHeight = i.minimumHeight, r.maximumHeight = i.maximumHeight, e.clone(i.boundingSphere3D, r.boundingSphere3D), t.clone(i.occludeePointInScaledSpace, r.occludeePointInScaledSpace), r.freeVertexArray(), r.vertexArray = this.vertexArray, this.vertexArray = void 0 }, h.prototype.processLoadStateMachine = function(e, t, r, i, n) { this.state === o.UNLOADED && l(this, t, r, i, n), this.state === o.RECEIVED && u(this, e, t, r, i, n), this.state === o.TRANSFORMED && c(this, e, t, r, i, n) }, h.prototype.processUpsampleStateMachine = function(e, t, n, a, l) { if (this.state === o.UNLOADED) { var h = this.upsampleDetails; if (!r(h)) throw new i("TileTerrain cannot upsample unless provided upsampleDetails."); var d = h.data,
  5314. m = h.x,
  5315. p = h.y,
  5316. f = h.level; if (this.data = d.upsample(t.getTilingScheme(), m, p, f, n, a, l), !r(this.data)) return;
  5317. this.state = o.RECEIVING; var v = this;
  5318. s(this.data, function(e) { v.data = e, v.state = o.RECEIVED }, function() { v.state = o.FAILED }) } this.state === o.RECEIVED && u(this, e, t, n, a, l), this.state === o.TRANSFORMED && c(this, e, t, n, a, l) }, h }), r("Scene/Tile", ["../Core/BoundingSphere", "../Core/Cartesian3", "../Core/Cartesian4", "../Core/defined", "../Core/DeveloperError", "./ImageryState", "./TerrainState", "./TileState", "./TileTerrain", "../Renderer/PixelDatatype", "../Renderer/PixelFormat", "../Renderer/TextureMagnificationFilter", "../Renderer/TextureMinificationFilter", "../Renderer/TextureWrap"], function(e, t, r, i, n, o, a, s, l, u, c, h, d, m) { "use strict";
  5319. function p(e, r, n) { var o = v(e);
  5320. i(o) && (e.upsampledTerrain = new l(o)), _(e) && (e.loadedTerrain = new l); for (var a = 0, s = n.getLength(); s > a; ++a) { var u = n.get(a);
  5321. u.show && u._createTileImagerySkeletons(e, r) } var c = e.tilingScheme.getEllipsoid(),
  5322. h = e.extent;
  5323. c.cartographicToCartesian(h.getSouthwest(), e.southwestCornerCartesian); var d = c.cartographicToCartesian(h.getSoutheast(), b);
  5324. c.cartographicToCartesian(h.getNortheast(), e.northeastCornerCartesian); var m = c.cartographicToCartesian(h.getNorthwest(), T);
  5325. t.UNIT_Z.cross(e.southwestCornerCartesian.negate(S), S).normalize(e.westNormal), e.northeastCornerCartesian.negate(S).cross(t.UNIT_Z, S).normalize(e.eastNormal), c.geodeticSurfaceNormal(d, S).cross(e.southwestCornerCartesian.subtract(d, E), S).normalize(e.southNormal), c.geodeticSurfaceNormal(m, S).cross(e.northeastCornerCartesian.subtract(m, E), S).normalize(e.northNormal) }
  5326. function f(e, t, r) { var n = e.loadedTerrain,
  5327. o = e.upsampledTerrain,
  5328. s = !1; if (i(n)) { if (n.processLoadStateMachine(t, r, e.x, e.y, e.level), n.state.value >= a.RECEIVED.value) { if (e.terrainData !== n.data) { e.terrainData = n.data; var l = e.terrainData.getWaterMask();
  5329. i(l) && (i(e.waterMaskTexture) && (--e.waterMaskTexture.referenceCount, 0 === e.waterMaskTexture.referenceCount && e.waterMaskTexture.destroy()), e.waterMaskTexture = w(t, l), e.waterMaskTranslationAndScale.x = 0, e.waterMaskTranslationAndScale.y = 0, e.waterMaskTranslationAndScale.z = 1, e.waterMaskTranslationAndScale.w = 1), g(e) } s = !0 } n.state === a.READY ? (n.publishToTile(e), e.loadedTerrain = void 0, e.upsampledTerrain = void 0) : n.state === a.FAILED && (e.loadedTerrain = void 0) }!s && i(o) && (o.processUpsampleStateMachine(t, r, e.x, e.y, e.level), o.state.value >= a.RECEIVED.value && e.terrainData !== o.data && (e.terrainData = o.data, r.hasWaterMask() && C(e, t), y(e)), o.state === a.READY ? (o.publishToTile(e), e.upsampledTerrain = void 0) : o.state === a.FAILED && (e.upsampledTerrain = void 0)) }
  5330. function v(e) { for (var t = e.parent; i(t) && !i(t.terrainData);) t = t.parent; return i(t) ? { data: t.terrainData, x: t.x, y: t.y, level: t.level } : void 0 }
  5331. function y(e) { if (i(e.children))
  5332. for (var t = 0; 4 > t; ++t) { var r = e.children[t]; if (r.state !== s.START) { if (i(r.terrainData) && !r.terrainData.wasCreatedByUpsampling()) continue;
  5333. i(r.upsampledTerrain) && r.upsampledTerrain.freeResources(), r.upsampledTerrain = new l({ data: e.terrainData, x: e.x, y: e.y, level: e.level }), r.state = s.LOADING } } }
  5334. function g(e) { if (i(e.children))
  5335. for (var t = 0; 4 > t; ++t) { var r = e.children[t]; if (r.state !== s.START) { if (i(r.terrainData) && !r.terrainData.wasCreatedByUpsampling()) continue;
  5336. i(r.upsampledTerrain) && r.upsampledTerrain.freeResources(), r.upsampledTerrain = new l({ data: e.terrainData, x: e.x, y: e.y, level: e.level }), e.terrainData.isChildAvailable(e.x, e.y, r.x, r.y) && (i(r.loadedTerrain) || (r.loadedTerrain = new l)), r.state = s.LOADING } } }
  5337. function _(e) { var t = e.parent; return i(t) ? i(t.terrainData) ? t.terrainData.isChildAvailable(t.x, t.y, e.x, e.y) : !1 : !0 }
  5338. function w(e, t) { var r, n = e.cache.tile_waterMaskData;
  5339. i(n) || (n = e.cache.tile_waterMaskData = { allWaterTexture: void 0, allLandTexture: void 0, sampler: void 0, destroy: function() { i(this.allWaterTexture) && this.allWaterTexture.destroy(), i(this.allLandTexture) && this.allLandTexture.destroy() } }); var o = Math.sqrt(t.length); return 1 !== o || 0 !== t[0] && 255 !== t[0] ? (r = e.createTexture2D({ pixelFormat: c.LUMINANCE, pixelDatatype: u.UNSIGNED_BYTE, source: { width: o, height: o, arrayBufferView: t } }), r.referenceCount = 0, i(n.sampler) || (n.sampler = e.createSampler({ wrapS: m.CLAMP, wrapT: m.CLAMP, minificationFilter: d.LINEAR, magnificationFilter: h.LINEAR })), r.setSampler(n.sampler)) : (i(n.allWaterTexture) || (n.allWaterTexture = e.createTexture2D({ pixelFormat: c.LUMINANCE, pixelDatatype: u.UNSIGNED_BYTE, source: { arrayBufferView: new Uint8Array([255]), width: 1, height: 1 } }), n.allWaterTexture.referenceCount = 1, n.allLandTexture = e.createTexture2D({ pixelFormat: c.LUMINANCE, pixelDatatype: u.UNSIGNED_BYTE, source: { arrayBufferView: new Uint8Array([0]), width: 1, height: 1 } }), n.allLandTexture.referenceCount = 1), r = 0 === t[0] ? n.allLandTexture : n.allWaterTexture), ++r.referenceCount, r }
  5340. function C(e) { for (var t = e.parent; i(t) && !i(t.terrainData) || t.terrainData.wasCreatedByUpsampling();) t = t.parent; if (i(t) && i(t.waterMaskTexture)) { e.waterMaskTexture = t.waterMaskTexture, ++e.waterMaskTexture.referenceCount; var r = t.extent,
  5341. n = e.extent,
  5342. o = n.east - n.west,
  5343. a = n.north - n.south,
  5344. s = o / (r.east - r.west),
  5345. l = a / (r.north - r.south);
  5346. e.waterMaskTranslationAndScale.x = s * (n.west - r.west) / o, e.waterMaskTranslationAndScale.y = l * (n.south - r.south) / a, e.waterMaskTranslationAndScale.z = s, e.waterMaskTranslationAndScale.w = l } } var x = function(o) { if (!i(o)) throw new n("description is required."); if (i(o.x) && i(o.y)) { if (o.x < 0 || o.y < 0) throw new n("description.x and description.y must be greater than or equal to zero.") } else if (!i(o.extent)) throw new n("Either description.extent is required or description.x and description.y are required."); if (!i(o.level) || o.zoom < 0) throw new n("description.level is required and must be greater than or equal to zero."); if (!i(o.tilingScheme)) throw new n("description.tilingScheme is required.");
  5347. this.tilingScheme = o.tilingScheme, this.x = o.x, this.y = o.y, this.level = o.level, this.parent = o.parent, this.children = void 0, this.extent = this.tilingScheme.tileXYToExtent(this.x, this.y, this.level), this.state = s.START, this.replacementPrevious = void 0, this.replacementNext = void 0, this.imagery = [], this.distance = 0, this.southwestCornerCartesian = new t, this.northeastCornerCartesian = new t, this.westNormal = new t, this.southNormal = new t, this.eastNormal = new t, this.northNormal = new t, this.waterMaskTexture = void 0, this.waterMaskTranslationAndScale = new r(0, 0, 1, 1), this.terrainData = void 0, this.center = new t, this.vertexArray = void 0, this.minimumHeight = 0, this.maximumHeight = 0, this.boundingSphere3D = new e, this.boundingSphere2D = new e, this.occludeePointInScaledSpace = new t, this.isRenderable = !1, this.loadedTerrain = void 0, this.upsampledTerrain = void 0 };
  5348. x.prototype.getChildren = function() { if (!i(this.children)) { var e = this.tilingScheme,
  5349. t = this.level + 1,
  5350. r = 2 * this.x,
  5351. n = 2 * this.y;
  5352. this.children = [new x({ tilingScheme: e, x: r, y: n, level: t, parent: this }), new x({ tilingScheme: e, x: r + 1, y: n, level: t, parent: this }), new x({ tilingScheme: e, x: r, y: n + 1, level: t, parent: this }), new x({ tilingScheme: e, x: r + 1, y: n + 1, level: t, parent: this })] } return this.children }, x.prototype.freeResources = function() { i(this.waterMaskTexture) && (--this.waterMaskTexture.referenceCount, 0 === this.waterMaskTexture.referenceCount && this.waterMaskTexture.destroy(), this.waterMaskTexture = void 0), this.state = s.START, this.isRenderable = !1, this.terrainData = void 0, i(this.loadedTerrain) && (this.loadedTerrain.freeResources(), this.loadedTerrain = void 0), i(this.upsampledTerrain) && (this.upsampledTerrain.freeResources(), this.upsampledTerrain = void 0); var e, t, r = this.imagery; for (e = 0, t = r.length; t > e; ++e) r[e].freeResources(); if (this.imagery.length = 0, i(this.children)) { for (e = 0, t = this.children.length; t > e; ++e) this.children[e].freeResources();
  5353. this.children = void 0 } this.freeVertexArray() }, x.prototype.freeVertexArray = function() { var e;
  5354. i(this.vertexArray) && (e = this.vertexArray.getIndexBuffer(), this.vertexArray.destroy(), this.vertexArray = void 0, !e.isDestroyed() && i(e.referenceCount) && (--e.referenceCount, 0 === e.referenceCount && e.destroy())), "undefined" != typeof this.wireframeVertexArray && (e = this.wireframeVertexArray.getIndexBuffer(), this.wireframeVertexArray.destroy(), this.wireframeVertexArray = void 0, e.isDestroyed() || "undefined" == typeof e.referenceCount || (--e.referenceCount, 0 === e.referenceCount && e.destroy())) }, x.prototype.processStateMachine = function(e, t, r) { this.state === s.START && (p(this, t, r), this.state = s.LOADING), this.state === s.LOADING && f(this, e, t); for (var n = i(this.vertexArray), a = !i(this.loadedTerrain) && !i(this.upsampledTerrain), l = this.imagery, u = 0, c = l.length; c > u; ++u) { var h = l[u]; if (i(h.loadingImagery)) { if (h.loadingImagery.state === o.PLACEHOLDER) { var d = h.loadingImagery.imageryLayer; if (d.getImageryProvider().isReady()) { h.freeResources(), l.splice(u, 1), d._createTileImagerySkeletons(this, t, u), --u, c = l.length; continue } } var m = h.processStateMachine(this, e);
  5355. a = a && m, n = n && (m || i(h.readyImagery)) } } u === c && (n && (this.isRenderable = !0), a && (this.state = s.READY)) }; var S = new t,
  5356. E = new t,
  5357. b = new t,
  5358. T = new t; return x }), r("Scene/TilingScheme", ["../Core/defined", "../Core/DeveloperError", "./Tile"], function(e, t, r) { "use strict"; var i = function() { throw new t("This type should not be instantiated directly. Instead, use WebMercatorTilingScheme or GeographicTilingScheme.") }; return i.prototype.getEllipsoid = function() { throw new t("This type should not be instantiated directly.") }, i.prototype.getExtent = function() { throw new t("This type should not be instantiated directly.") }, i.prototype.getProjection = function() { throw new t("This type should not be instantiated directly.") }, i.prototype.getNumberOfXTilesAtLevel = function() { throw new t("This type should not be instantiated directly.") }, i.prototype.getNumberOfYTilesAtLevel = function() { throw new t("This type should not be instantiated directly.") }, i.prototype.createLevelZeroTiles = function() { throw new t("This type should not be instantiated directly.") }, i.prototype.extentToNativeExtent = function() { throw new t("This type should not be instantiated directly.") }, i.prototype.tileXYToNativeExtent = function() { throw new t("This type should not be instantiated directly.") }, i.prototype.tileXYToExtent = function() { throw new t("This type should not be instantiated directly.") }, i.prototype.positionToTileXY = function() { throw new t("This type should not be instantiated directly.") }, i.createRectangleOfLevelZeroTiles = function(i, n, o) { if (!e(i)) throw new t("tilingScheme is required."); if (!e(n)) throw new t("numberOfLevelZeroTilesX is required."); if (!e(o)) throw new t("numberOfLevelZeroTilesY is required."); for (var a = new Array(n * o), s = 0, l = 0; o > l; ++l)
  5359. for (var u = 0; n > u; ++u) a[s++] = new r({ tilingScheme: i, x: u, y: l, level: 0 }); return a }, i }), r("Scene/GeographicTilingScheme", ["../Core/defaultValue", "../Core/defined", "../Core/DeveloperError", "../Core/Math", "../Core/Cartesian2", "../Core/Ellipsoid", "../Core/Extent", "../Core/GeographicProjection", "./TilingScheme"], function(e, t, r, i, n, o, a, s, l) { "use strict"; var u = function(t) { t = e(t, {}), this._ellipsoid = e(t.ellipsoid, o.WGS84), this._extent = e(t.extent, a.MAX_VALUE), this._projection = new s(this._ellipsoid), this._numberOfLevelZeroTilesX = e(t.numberOfLevelZeroTilesX, 2), this._numberOfLevelZeroTilesY = e(t.numberOfLevelZeroTilesY, 1) }; return u.prototype.getEllipsoid = function() { return this._ellipsoid }, u.prototype.getExtent = function() { return this._extent }, u.prototype.getProjection = function() { return this._projection }, u.prototype.getNumberOfXTilesAtLevel = function(e) { return this._numberOfLevelZeroTilesX << e }, u.prototype.getNumberOfYTilesAtLevel = function(e) { return this._numberOfLevelZeroTilesY << e }, u.prototype.createLevelZeroTiles = function() { return l.createRectangleOfLevelZeroTiles(this, this._numberOfLevelZeroTilesX, this._numberOfLevelZeroTilesY) }, u.prototype.extentToNativeExtent = function(e, n) { if (!t(e)) throw new r("extent is required."); var o = i.toDegrees(e.west),
  5360. s = i.toDegrees(e.south),
  5361. l = i.toDegrees(e.east),
  5362. u = i.toDegrees(e.north); return t(n) ? (n.west = o, n.south = s, n.east = l, n.north = u, n) : new a(o, s, l, u) }, u.prototype.tileXYToNativeExtent = function(e, t, r, n) { var o = this.tileXYToExtent(e, t, r, n); return o.west = i.toDegrees(o.west), o.south = i.toDegrees(o.south), o.east = i.toDegrees(o.east), o.north = i.toDegrees(o.north), o }, u.prototype.tileXYToExtent = function(e, r, i, n) { var o = this._extent,
  5363. s = this.getNumberOfXTilesAtLevel(i),
  5364. l = this.getNumberOfYTilesAtLevel(i),
  5365. u = (o.east - o.west) / s,
  5366. c = e * u + o.west,
  5367. h = (e + 1) * u + o.west,
  5368. d = (o.north - o.south) / l,
  5369. m = o.north - r * d,
  5370. p = o.north - (r + 1) * d; return t(n) || (n = new a(c, p, h, m)), n.west = c, n.south = p, n.east = h, n.north = m, n }, u.prototype.positionToTileXY = function(e, r, i) { var o = this._extent; if (e.latitude > o.north || e.latitude < o.south || e.longitude < o.west || e.longitude > o.east) return void 0; var a = this.getNumberOfXTilesAtLevel(r),
  5371. s = this.getNumberOfYTilesAtLevel(r),
  5372. l = (o.east - o.west) / a,
  5373. u = (o.north - o.south) / s,
  5374. c = 0 | (e.longitude - o.west) / l;
  5375. c >= a && (c = a - 1); var h = 0 | (o.north - e.latitude) / u; return h >= s && (h = s - 1), t(i) ? (i.x = c, i.y = h, i) : new n(c, h) }, u }), r("Scene/TerrainMesh", [], function() { "use strict"; var e = function(e, t, r, i, n, o, a) { this.center = e, this.vertices = t, this.indices = r, this.minimumHeight = i, this.maximumHeight = n, this.boundingSphere3D = o, this.occludeePointInScaledSpace = a }; return e }), r("Scene/HeightmapTerrainData", ["../Core/defaultValue", "../Core/defined", "../Core/DeveloperError", "../Core/HeightmapTessellator", "../Core/Math", "../Core/TaskProcessor", "./GeographicTilingScheme", "./TerrainMesh", "./TerrainProvider", "../ThirdParty/when"], function(e, t, r, i, n, o, a, s, l, u) {
  5376. "use strict";
  5377. function c(e, t, r, i, n, o, a) { var s = 1,
  5378. l = e._width,
  5379. u = e._height,
  5380. c = o * (l - 1),
  5381. h = c + l - 1,
  5382. d = a * (u - 1),
  5383. m = d + u - 1,
  5384. p = 1 << s;
  5385. c /= p, h /= p, d /= p, m /= p; var f = r * (l - 1),
  5386. v = i * (u - 1);
  5387. c -= f, h -= f, d -= v, m -= v; var g, _, w = 0 | c,
  5388. C = 0 | h,
  5389. x = 0 | d,
  5390. S = 0 | m,
  5391. E = C - w + 1,
  5392. b = S - x + 1,
  5393. T = e._buffer,
  5394. A = e._structure,
  5395. M = E * b,
  5396. P = M * A.stride,
  5397. D = new T.constructor(P),
  5398. I = 0,
  5399. O = A.stride; if (O > 1)
  5400. for (_ = x; S >= _; ++_)
  5401. for (g = w; C >= g; ++g)
  5402. for (var R = (_ * l + g) * O, L = 0; O > L; ++L) D[I++] = T[R + L];
  5403. else
  5404. for (_ = x; S >= _; ++_)
  5405. for (g = w; C >= g; ++g) D[I++] = T[_ * l + g]; return new y({ buffer: D, width: E, height: b, childTileMask: 0, structure: e._structure, createdByUpsampling: !0 }) }
  5406. function h(e, t, r, i, o, a, s, l) { var u, c, h, p, f = e._width,
  5407. g = e._height,
  5408. _ = e._structure,
  5409. w = _.stride,
  5410. C = e._buffer,
  5411. x = new C.constructor(f * g * w),
  5412. S = t.tileXYToExtent(r, i, o),
  5413. E = t.tileXYToExtent(a, s, l); if (w > 1) { var b = _.elementsPerHeight,
  5414. T = _.elementMultiplier,
  5415. A = _.isBigEndian,
  5416. M = Math.pow(T, b - 1); for (c = 0; g > c; ++c)
  5417. for (h = n.lerp(E.north, E.south, c / (g - 1)), u = 0; f > u; ++u) { p = n.lerp(E.west, E.east, u / (f - 1)); var P = m(C, b, T, w, A, S, f, g, p, h);
  5418. v(x, b, T, M, w, A, c * f + u, P) } } else
  5419. for (c = 0; g > c; ++c)
  5420. for (h = n.lerp(E.north, E.south, c / (g - 1)), u = 0; f > u; ++u) p = n.lerp(E.west, E.east, u / (f - 1)), x[c * f + u] = d(C, S, f, g, p, h); return new y({ buffer: x, width: f, height: g, childTileMask: 0, structure: e._structure, createdByUpsampling: !0 }) }
  5421. function d(e, t, r, i, n, o) { var a = (n - t.west) * (r - 1) / (t.east - t.west),
  5422. s = (o - t.south) * (i - 1) / (t.north - t.south),
  5423. l = 0 | a,
  5424. u = l + 1;
  5425. u >= r && (u = r - 1, l = r - 2); var c = 0 | s,
  5426. h = c + 1;
  5427. h >= i && (h = i - 1, c = i - 2); var d = a - l,
  5428. m = s - c;
  5429. c = i - 1 - c, h = i - 1 - h; var f = e[c * r + l],
  5430. v = e[c * r + u],
  5431. y = e[h * r + l],
  5432. g = e[h * r + u]; return p(d, m, f, v, y, g) }
  5433. function m(e, t, r, i, n, o, a, s, l, u) { var c = (l - o.west) * (a - 1) / (o.east - o.west),
  5434. h = (u - o.south) * (s - 1) / (o.north - o.south),
  5435. d = 0 | c,
  5436. m = d + 1;
  5437. m >= a && (m = a - 1, d = a - 2); var v = 0 | h,
  5438. y = v + 1;
  5439. y >= s && (y = s - 1, v = s - 2); var g = c - d,
  5440. _ = h - v;
  5441. v = s - 1 - v, y = s - 1 - y; var w = f(e, t, r, i, n, v * a + d),
  5442. C = f(e, t, r, i, n, v * a + m),
  5443. x = f(e, t, r, i, n, y * a + d),
  5444. S = f(e, t, r, i, n, y * a + m); return p(g, _, w, C, x, S) }
  5445. function p(e, t, r, i, n, o) { return e > t ? r + e * (i - r) + t * (o - i) : r + e * (o - n) + t * (n - r) }
  5446. function f(e, t, r, i, n, o) { o *= i; var a, s = 0; if (n)
  5447. for (a = 0; t > a; ++a) s = s * r + e[o + a];
  5448. else
  5449. for (a = t - 1; a >= 0; --a) s = s * r + e[o + a]; return s }
  5450. function v(e, t, r, i, n, o, a, s) { a *= n; var l; if (o)
  5451. for (l = 0; t > l; ++l) e[a + l] = 0 | s / i, s -= e[a + l] * i, i /= r;
  5452. else
  5453. for (l = t - 1; l >= 0; --l) e[a + l] = 0 | s / i, s -= e[a + l] * i, i /= r }
  5454. var y = function(n) { if (!t(n) || !t(n.buffer)) throw new r("description.buffer is required."); if (!t(n.width)) throw new r("description.width is required."); if (!t(n.height)) throw new r("description.height is required.");
  5455. this._buffer = n.buffer, this._width = n.width, this._height = n.height, this._childTileMask = e(n.childTileMask, 15); var o = i.DEFAULT_STRUCTURE,
  5456. a = n.structure;
  5457. t(a) ? a !== o && (a.heightScale = e(a.heightScale, o.heightScale), a.heightOffset = e(a.heightOffset, o.heightOffset), a.elementsPerHeight = e(a.elementsPerHeight, o.elementsPerHeight), a.stride = e(a.stride, o.stride), a.elementMultiplier = e(a.elementMultiplier, o.elementMultiplier), a.isBigEndian = e(a.isBigEndian, o.isBigEndian)) : a = o, this._structure = a, this._createdByUpsampling = e(n.createdByUpsampling, !1), this._waterMask = n.waterMask },
  5458. g = new o("createVerticesFromHeightmap");
  5459. return y.prototype.createMesh = function(e, i, n, o) { if (!t(e)) throw new r("tilingScheme is required."); if (!t(i)) throw new r("x is required."); if (!t(n)) throw new r("y is required."); if (!t(o)) throw new r("level is required."); var c = e.getEllipsoid(),
  5460. h = e.tileXYToNativeExtent(i, n, o),
  5461. d = e.tileXYToExtent(i, n, o),
  5462. m = c.cartographicToCartesian(d.getCenter()),
  5463. p = this._structure,
  5464. f = l.getEstimatedLevelZeroGeometricErrorForAHeightmap(c, this._width, e.getNumberOfXTilesAtLevel(0)),
  5465. v = f / (1 << o),
  5466. y = g.scheduleTask({ heightmap: this._buffer, structure: p, width: this._width, height: this._height, nativeExtent: h, extent: d, relativeToCenter: m, ellipsoid: c, skirtHeight: Math.min(4 * v, 1e3), isGeographic: e instanceof a }); return t(y) ? u(y, function(e) { return new s(m, new Float32Array(e.vertices), l.getRegularGridIndices(e.gridWidth, e.gridHeight), e.minimumHeight, e.maximumHeight, e.boundingSphere3D, e.occludeePointInScaledSpace) }) : void 0 }, y.prototype.interpolateHeight = function(e, t, r) {
  5467. var i, n = this._width,
  5468. o = this._height,
  5469. a = this._structure,
  5470. s = a.stride;
  5471. if (s > 1) { var l = a.elementsPerHeight,
  5472. u = a.elementMultiplier,
  5473. c = a.isBigEndian;
  5474. i = m(this._buffer, l, u, s, c, e, n, o, t, r) } else i = d(this._buffer, e, n, o, t, r);
  5475. return i * a.heightScale + a.heightOffset
  5476. }, y.prototype.upsample = function(e, i, n, o, a, s, l) { if (!t(e)) throw new r("tilingScheme is required."); if (!t(i)) throw new r("thisX is required."); if (!t(n)) throw new r("thisY is required."); if (!t(o)) throw new r("thisLevel is required."); if (!t(a)) throw new r("descendantX is required."); if (!t(s)) throw new r("descendantY is required."); if (!t(l)) throw new r("descendantLevel is required."); var u = l - o; if (u > 1) throw new r("Upsampling through more than one level at a time is not currently supported."); var d; return d = 1 === this._width % 2 && 1 === this._height % 2 ? c(this, e, i, n, o, a, s, l) : h(this, e, i, n, o, a, s, l) }, y.prototype.isChildAvailable = function(e, i, n, o) { if (!t(e)) throw new r("thisX is required."); if (!t(i)) throw new r("thisY is required."); if (!t(n)) throw new r("childX is required."); if (!t(o)) throw new r("childY is required."); var a = 2; return n !== 2 * e && ++a, o !== 2 * i && (a -= 2), 0 !== (this._childTileMask & 1 << a) }, y.prototype.getWaterMask = function() { return this._waterMask }, y.prototype.wasCreatedByUpsampling = function() { return this._createdByUpsampling }, y
  5477. }), r("Scene/ArcGisImageServerTerrainProvider", ["../Core/defaultValue", "../Core/defined", "../Core/loadImage", "../Core/getImagePixels", "../Core/throttleRequestByServer", "../Core/writeTextToCanvas", "../Core/DeveloperError", "../Core/Math", "../Core/Ellipsoid", "../Core/Event", "./Credit", "./TerrainProvider", "./GeographicTilingScheme", "./HeightmapTerrainData", "../ThirdParty/when"], function(e, t, r, i, n, o, a, s, l, u, c, h, d, m, p) { "use strict"; var f = function(r) { if (!t(r) || !t(r.url)) throw new a("description.url is required.");
  5478. this._url = r.url, this._token = r.token, this._tilingScheme = r.tilingScheme, t(this._tilingScheme) || (this._tilingScheme = new d({ ellipsoid: e(r.ellipsoid, l.WGS84) })), this._heightmapWidth = 65, this._levelZeroMaximumGeometricError = h.getEstimatedLevelZeroGeometricErrorForAHeightmap(this._tilingScheme.getEllipsoid(), this._heightmapWidth, this._tilingScheme.getNumberOfXTilesAtLevel(0)), this._proxy = r.proxy, this._terrainDataStructure = { heightScale: .001, heightOffset: -1e3, elementsPerHeight: 3, stride: 4, elementMultiplier: 256, isBigEndian: !0 }, this._errorEvent = new u; var i = r.credit; "string" == typeof i && (i = new c(i)), this._credit = i }; return f.prototype.requestTileGeometry = function(e, o, a) { var l = this._tilingScheme.tileXYToExtent(e, o, a),
  5479. u = (l.east - l.west) / (this._heightmapWidth - 1),
  5480. c = (l.north - l.south) / (this._heightmapWidth - 1);
  5481. l.west -= .5 * u, l.east += .5 * u, l.south -= .5 * c, l.north += .5 * c; var h = s.toDegrees(l.west) + "%2C" + s.toDegrees(l.south) + "%2C" + s.toDegrees(l.east) + "%2C" + s.toDegrees(l.north),
  5482. d = this._url + "/exportImage?interpolation=RSP_BilinearInterpolation&format=tiff&f=image&size=" + this._heightmapWidth + "%2C" + this._heightmapWidth + "&bboxSR=4326&imageSR=4326&bbox=" + h;
  5483. this._token && (d += "&token=" + this._token); var f = this._proxy;
  5484. t(f) && (d = f.getURL(d)); var v = n(d, r); if (!t(v)) return void 0; var y = this; return p(v, function(e) { return new m({ buffer: i(e), width: y._heightmapWidth, height: y._heightmapWidth, childTileMask: 15, structure: y._terrainDataStructure }) }) }, f.prototype.getErrorEvent = function() { return this._errorEvent }, f.prototype.getLevelMaximumGeometricError = function(e) { return this._levelZeroMaximumGeometricError / (1 << e) }, f.prototype.getCredit = function() { return this._credit }, f.prototype.getTilingScheme = function() { return this._tilingScheme }, f.prototype.hasWaterMask = function() { return !1 }, f.prototype.isReady = function() { return !0 }, f }), r("Scene/DiscardMissingTileImagePolicy", ["../Core/defaultValue", "../Core/defined", "../Core/loadImageViaBlob", "../Core/getImagePixels", "../Core/DeveloperError", "../ThirdParty/when"], function(e, t, r, i, n, o) { "use strict"; var a = function(a) {
  5485. function s(e) { t(e.blob) && (u._missingImageByteLength = e.blob.size); var r = i(e); if (a.disableCheckIfAllPixelsAreTransparent) { for (var n = !0, o = e.width, s = a.pixelsToCheck, l = 0, c = s.length; n && c > l; ++l) { var h = s[l],
  5486. d = 4 * h.x + h.y * o,
  5487. m = r[d + 3];
  5488. m > 0 && (n = !1) } n && (r = void 0) } u._missingImagePixels = r, u._isReady = !0 }
  5489. function l() { u._missingImagePixels = void 0, u._isReady = !0 } if (a = e(a, {}), !t(a.missingImageUrl)) throw new n("description.missingImageUrl is required."); if (!t(a.pixelsToCheck)) throw new n("description.pixelsToCheck is required.");
  5490. this._pixelsToCheck = a.pixelsToCheck, this._missingImagePixels = void 0, this._missingImageByteLength = void 0, this._isReady = !1; var u = this;
  5491. o(r(a.missingImageUrl), s, l) }; return a.prototype.isReady = function() { return this._isReady }, a.prototype.shouldDiscardImage = function(e) { if (!this._isReady) throw new n("shouldDiscardImage must not be called before the discard policy is ready."); var r = this._pixelsToCheck,
  5492. o = this._missingImagePixels; if (!t(o)) return !1; if (t(e.blob) && e.blob.size !== this._missingImageByteLength) return !1; for (var a = i(e), s = e.width, l = 0, u = r.length; u > l; ++l)
  5493. for (var c = r[l], h = 4 * c.x + c.y * s, d = 0; 4 > d; ++d) { var m = h + d; if (a[m] !== o[m]) return !1 }
  5494. return !0 }, a }), r("Scene/ImageryProvider", ["../Core/defined", "../Core/loadImage", "../Core/loadImageViaBlob", "../Core/DeveloperError", "../Core/throttleRequestByServer"], function(e, t, r, i, n) { "use strict"; var o = function() { throw this.defaultAlpha = void 0, this.defaultBrightness = void 0, this.defaultContrast = void 0, this.defaultHue = void 0, this.defaultSaturation = void 0, this.defaultGamma = void 0, new i("This type should not be instantiated directly.") }; return o.prototype.isReady = function() { throw new i("This type should not be instantiated directly.") }, o.prototype.getExtent = function() { throw new i("This type should not be instantiated directly.") }, o.prototype.getTileWidth = function() { throw new i("This type should not be instantiated directly.") }, o.prototype.getTileHeight = function() { throw new i("This type should not be instantiated directly.") }, o.prototype.getMaximumLevel = function() { throw new i("This type should not be instantiated directly.") }, o.prototype.getMinimumLevel = function() { throw new i("This type should not be instantiated directly.") }, o.prototype.getTilingScheme = function() { throw new i("This type should not be instantiated directly.") }, o.prototype.getTileDiscardPolicy = function() { throw new i("This type should not be instantiated directly.") }, o.prototype.getErrorEvent = function() { throw new i("This type should not be instantiated directly.") }, o.prototype.getCredit = function() { throw new i("This type should not be instantiated directly.") }, o.prototype.getProxy = function() { throw new i("This type should not be instantiated directly.") }, o.prototype.requestImage = function() { throw new i("This type should not be instantiated directly.") }, o.loadImage = function(i, o) { return e(i.getTileDiscardPolicy()) ? n(o, r) : n(o, t) }, o }), r("Scene/WebMercatorTilingScheme", ["../Core/defaultValue", "../Core/defined", "../Core/Ellipsoid", "../Core/Extent", "../Core/Cartesian2", "../Core/WebMercatorProjection", "./TilingScheme"], function(e, t, r, i, n, o, a) { "use strict"; var s = function(a) { if (a = e(a, {}), this._ellipsoid = e(a.ellipsoid, r.WGS84), this._numberOfLevelZeroTilesX = e(a.numberOfLevelZeroTilesX, 1), this._numberOfLevelZeroTilesY = e(a.numberOfLevelZeroTilesY, 1), this._projection = new o(this._ellipsoid), t(a.extentSouthwestInMeters) && t(a.extentNortheastInMeters)) this._extentSouthwestInMeters = a.extentSouthwestInMeters, this._extentNortheastInMeters = a.extentNortheastInMeters;
  5495. else { var s = this._ellipsoid.getMaximumRadius() * Math.PI;
  5496. this._extentSouthwestInMeters = new n(-s, -s), this._extentNortheastInMeters = new n(s, s) } var l = this._projection.unproject(this._extentSouthwestInMeters),
  5497. u = this._projection.unproject(this._extentNortheastInMeters);
  5498. this._extent = new i(l.longitude, l.latitude, u.longitude, u.latitude) }; return s.prototype.getEllipsoid = function() { return this._ellipsoid }, s.prototype.getExtent = function() { return this._extent }, s.prototype.getProjection = function() { return this._projection }, s.prototype.getNumberOfXTilesAtLevel = function(e) { return this._numberOfLevelZeroTilesX << e }, s.prototype.getNumberOfYTilesAtLevel = function(e) { return this._numberOfLevelZeroTilesY << e }, s.prototype.createLevelZeroTiles = function() { return a.createRectangleOfLevelZeroTiles(this, this._numberOfLevelZeroTilesX, this._numberOfLevelZeroTilesY) }, s.prototype.extentToNativeExtent = function(e, r) { var n = this._projection,
  5499. o = n.project(e.getSouthwest()),
  5500. a = n.project(e.getNortheast()); return t(r) ? (r.west = o.x, r.south = o.y, r.east = a.x, r.north = a.y, r) : new i(o.x, o.y, a.x, a.y) }, s.prototype.tileXYToNativeExtent = function(e, r, n, o) { var a = this.getNumberOfXTilesAtLevel(n),
  5501. s = this.getNumberOfYTilesAtLevel(n),
  5502. l = (this._extentNortheastInMeters.x - this._extentSouthwestInMeters.x) / a,
  5503. u = this._extentSouthwestInMeters.x + e * l,
  5504. c = this._extentSouthwestInMeters.x + (e + 1) * l,
  5505. h = (this._extentNortheastInMeters.y - this._extentSouthwestInMeters.y) / s,
  5506. d = this._extentNortheastInMeters.y - r * h,
  5507. m = this._extentNortheastInMeters.y - (r + 1) * h; return t(o) ? (o.west = u, o.south = m, o.east = c, o.north = d, o) : new i(u, m, c, d) }, s.prototype.tileXYToExtent = function(e, t, r, i) { var o = this.tileXYToNativeExtent(e, t, r, i),
  5508. a = this._projection,
  5509. s = a.unproject(new n(o.west, o.south)),
  5510. l = a.unproject(new n(o.east, o.north)); return o.west = s.longitude, o.south = s.latitude, o.east = l.longitude, o.north = l.latitude, o }, s.prototype.positionToTileXY = function(e, r, i) { var o = this._extent; if (e.latitude > o.north || e.latitude < o.south || e.longitude < o.west || e.longitude > o.east) return void 0; var a = this.getNumberOfXTilesAtLevel(r),
  5511. s = this.getNumberOfYTilesAtLevel(r),
  5512. l = this._extentNortheastInMeters.x - this._extentSouthwestInMeters.x,
  5513. u = l / a,
  5514. c = this._extentNortheastInMeters.y - this._extentSouthwestInMeters.y,
  5515. h = c / s,
  5516. d = this._projection,
  5517. m = d.project(e),
  5518. p = m.x - this._extentSouthwestInMeters.x,
  5519. f = this._extentNortheastInMeters.y - m.y,
  5520. v = 0 | p / u;
  5521. v >= a && (v = a - 1); var y = 0 | f / h; return y >= s && (y = s - 1), t(i) ? (i.x = v, i.y = y, i) : new n(v, y) }, s }), r("Scene/ArcGisMapServerImageryProvider", ["../Core/defaultValue", "../Core/defined", "../Core/jsonp", "../Core/writeTextToCanvas", "../Core/Cartesian2", "../Core/DeveloperError", "../Core/Event", "./DiscardMissingTileImagePolicy", "./GeographicTilingScheme", "./ImageryProvider", "./TileProviderError", "./WebMercatorTilingScheme", "./Credit", "../ThirdParty/when"], function(e, t, r, i, n, o, a, s, l, u, c, h, d, m) { "use strict";
  5522. function p(e, r, i, n) { var o; if (e._useTiles) o = e._url + "/tile/" + n + "/" + i + "/" + r;
  5523. else { var a = e._tilingScheme.tileXYToNativeExtent(r, i, n),
  5524. s = a.west + "%2C" + a.south + "%2C" + a.east + "%2C" + a.north;
  5525. o = e._url + "/export?", o += "bbox=" + s, o += "&bboxSR=4326&size=256%2C256&imageSR=4326&format=png&transparent=true&f=image" } var l = e._proxy; return t(l) && (o = l.getURL(o)), o } var f = function(i) {
  5526. function u(e) { var r = e.tileInfo; if (g._useTiles && t(r)) { if (g._tileWidth = r.rows, g._tileHeight = r.cols, 102100 === r.spatialReference.wkid) g._tilingScheme = new h;
  5527. else { if (4326 !== e.tileInfo.spatialReference.wkid) { var i = "Tile spatial reference WKID " + e.tileInfo.spatialReference.wkid + " is not supported."; return y = c.handleError(y, g, g._errorEvent, i, void 0, void 0, void 0, v), void 0 } g._tilingScheme = new l } g._maximumLevel = e.tileInfo.lods.length - 1, t(g._tileDiscardPolicy) || (g._tileDiscardPolicy = new s({ missingImageUrl: p(g, 0, 0, g._maximumLevel), pixelsToCheck: [new n(0, 0), new n(200, 20), new n(20, 200), new n(80, 110), new n(160, 130)], disableCheckIfAllPixelsAreTransparent: !0 })), g._useTiles = !0 } else g._tileWidth = 256, g._tileHeight = 256, g._tilingScheme = new l, g._useTiles = !1;
  5528. t(e.copyrightText) && e.copyrightText.length > 0 && (g._credit = new d(e.copyrightText)), g._ready = !0, c.handleSuccess(y) }
  5529. function f() { var e = "An error occurred while accessing " + g._url + ".";
  5530. y = c.handleError(y, g, g._errorEvent, e, void 0, void 0, void 0, v) }
  5531. function v() { var e = r(g._url, { parameters: { f: "json" }, proxy: g._proxy });
  5532. m(e, u, f) } if (i = e(i, {}), !t(i.url)) throw new o("description.url is required.");
  5533. this._url = i.url, this._tileDiscardPolicy = i.tileDiscardPolicy, this._proxy = i.proxy, this._tileWidth = void 0, this._tileHeight = void 0, this._maximumLevel = void 0, this._tilingScheme = void 0, this._credit = void 0, this._useTiles = e(i.usePreCachedTilesIfAvailable, !0), this._errorEvent = new a, this._ready = !1; var y, g = this;
  5534. v() }; return f.prototype.isUsingPrecachedTiles = function() { return this._useTiles }, f.prototype.getUrl = function() { return this._url }, f.prototype.getProxy = function() { return this._proxy }, f.prototype.getTileWidth = function() { if (!this._ready) throw new o("getTileWidth must not be called before the imagery provider is ready."); return this._tileWidth }, f.prototype.getTileHeight = function() { if (!this._ready) throw new o("getTileHeight must not be called before the imagery provider is ready."); return this._tileHeight }, f.prototype.getMaximumLevel = function() { if (!this._ready) throw new o("getMaximumLevel must not be called before the imagery provider is ready."); return this._maximumLevel }, f.prototype.getMinimumLevel = function() { if (!this._ready) throw new o("getMinimumLevel must not be called before the imagery provider is ready."); return 0 }, f.prototype.getTilingScheme = function() { if (!this._ready) throw new o("getTilingScheme must not be called before the imagery provider is ready."); return this._tilingScheme }, f.prototype.getExtent = function() { if (!this._ready) throw new o("getExtent must not be called before the imagery provider is ready."); return this._tilingScheme.getExtent() }, f.prototype.getTileDiscardPolicy = function() { if (!this._ready) throw new o("getTileDiscardPolicy must not be called before the imagery provider is ready."); return this._tileDiscardPolicy }, f.prototype.getErrorEvent = function() { return this._errorEvent }, f.prototype.isReady = function() { return this._ready }, f.prototype.requestImage = function(e, t, r) { if (!this._ready) throw new o("requestImage must not be called before the imagery provider is ready."); var i = p(this, e, t, r); return u.loadImage(this, i) }, f.prototype.getCredit = function() { return this._credit }, f }), r("Scene/BingMapsStyle", ["../Core/Enumeration"], function(e) { "use strict"; var t = { AERIAL: new e(0, "AERIAL", { imagerySetName: "Aerial" }), AERIAL_WITH_LABELS: new e(1, "AERIAL_WITH_LABELS", { imagerySetName: "AerialWithLabels" }), ROAD: new e(2, "ROAD", { imagerySetName: "Road" }), ORDNANCE_SURVEY: new e(3, "ORDNANCE_SURVEY", { imagerySetName: "OrdnanceSurvey" }), COLLINS_BART: new e(4, "COLLINS_BART", { imagerySetName: "CollinsBart" }) }; return t }), r("Scene/BingMapsImageryProvider", ["../Core/defaultValue", "../Core/defined", "../Core/jsonp", "../Core/Cartesian2", "../Core/DeveloperError", "../Core/Event", "./BingMapsStyle", "./DiscardMissingTileImagePolicy", "./ImageryProvider", "./TileProviderError", "./WebMercatorTilingScheme", "./Credit", "../ThirdParty/when"], function(e, t, r, i, n, o, a, s, l, u, c, h, d) { "use strict";
  5535. function m(e, r, i, n) { var o = e._imageUrlTemplate,
  5536. a = p.tileXYToQuadKey(r, i, n);
  5537. o = o.replace("{quadkey}", a); var s = e._imageUrlSubdomains,
  5538. l = (r + i + n) % s.length;
  5539. o = o.replace("{subdomain}", s[l]); var u = e._proxy; return t(u) && (o = u.getURL(o)), o } var p = function f(l) {
  5540. function p(e) { var r = e.resourceSets[0].resources[0];
  5541. w._tileWidth = r.imageWidth, w._tileHeight = r.imageHeight, w._maximumLevel = r.zoomMax - 1, w._imageUrlSubdomains = r.imageUrlSubdomains, w._imageUrlTemplate = r.imageUrl.replace("{culture}", ""), t(w._tileDiscardPolicy) || (w._tileDiscardPolicy = new s({ missingImageUrl: m(w, 0, 0, w._maximumLevel), pixelsToCheck: [new i(0, 0), new i(120, 140), new i(130, 160), new i(200, 50), new i(200, 200)], disableCheckIfAllPixelsAreTransparent: !0 })), w._ready = !0, u.handleSuccess(g) }
  5542. function v() { var e = "An error occurred while accessing " + _ + ".";
  5543. g = u.handleError(g, w, w._errorEvent, e, void 0, void 0, void 0, y) }
  5544. function y() { var e = r(_, { callbackParameterName: "jsonp", proxy: w._proxy });
  5545. d(e, p, v) } if (l = e(l, {}), !t(l.url)) throw new n("description.url is required.");
  5546. this._url = l.url, this._key = e(l.key, "AkMnCOd4RF1U7D7qgdBz3Fk1aJB3rgCCI_DO841suDGxqOg0SMICTE8Ivy5HhAf5"), this._mapStyle = e(l.mapStyle, a.AERIAL), this._tileDiscardPolicy = l.tileDiscardPolicy, this._proxy = l.proxy, this._credit = new h("Bing Imagery", f._logoData, "http://www.bing.com"), this.defaultGamma = 1, (this._mapStyle === a.AERIAL || this._mapStyle === a.AERIAL_WITH_LABELS) && (this.defaultGamma = 1.3), this._tilingScheme = new c({ numberOfLevelZeroTilesX: 2, numberOfLevelZeroTilesY: 2 }), this._tileWidth = void 0, this._tileHeight = void 0, this._maximumLevel = void 0, this._imageUrlTemplate = void 0, this._imageUrlSubdomains = void 0, this._errorEvent = new o, this._ready = !1; var g, _ = this._url + "/REST/v1/Imagery/Metadata/" + this._mapStyle.imagerySetName + "?key=" + this._key,
  5547. w = this;
  5548. y() }; return p.prototype.getUrl = function() { return this._url }, p.prototype.getProxy = function() { return this._proxy }, p.prototype.getKey = function() { return this._key }, p.prototype.getMapStyle = function() { return this._mapStyle }, p.prototype.getTileWidth = function() { if (!this._ready) throw new n("getTileWidth must not be called before the imagery provider is ready."); return this._tileWidth }, p.prototype.getTileHeight = function() { if (!this._ready) throw new n("getTileHeight must not be called before the imagery provider is ready."); return this._tileHeight }, p.prototype.getMaximumLevel = function() { if (!this._ready) throw new n("getMaximumLevel must not be called before the imagery provider is ready."); return this._maximumLevel }, p.prototype.getMinimumLevel = function() { if (!this._ready) throw new n("getMinimumLevel must not be called before the imagery provider is ready."); return 0 }, p.prototype.getTilingScheme = function() { if (!this._ready) throw new n("getTilingScheme must not be called before the imagery provider is ready."); return this._tilingScheme }, p.prototype.getExtent = function() { if (!this._ready) throw new n("getExtent must not be called before the imagery provider is ready."); return this._tilingScheme.getExtent() }, p.prototype.getTileDiscardPolicy = function() { if (!this._ready) throw new n("getTileDiscardPolicy must not be called before the imagery provider is ready."); return this._tileDiscardPolicy }, p.prototype.getErrorEvent = function() { return this._errorEvent }, p.prototype.isReady = function() { return this._ready }, p.prototype.requestImage = function(e, t, r) { if (!this._ready) throw new n("requestImage must not be called before the imagery provider is ready."); var i = m(this, e, t, r); return l.loadImage(this, i) }, p.prototype.getCredit = function() { return this._credit }, p._logoData = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAAWCAYAAACcy/8iAAAABGdBTUEAAK/INwWK6QAAAAlwSFlzAAAOwgAADsIBFShKgAAAABp0RVh0U29mdHdhcmUAUGFpbnQuTkVUIHYzLjUuMTAw9HKhAAAL+UlEQVRYR9WYeVSXZRbHFZB9kX0H2UQBWUQFFJcKl9GOVIBLWDNKc7JSUxwVbFxGBBcUaVGSpCI7ogKOWohWipKC4oqaC4KyCIoCssiOznzuD36NecypM/8095zn/F7e57n3ud/7fO997ksvpLeamppq37591U1NTbXNzc31LCwsdE1MTDQMDQ2ZUlORRb8m6urqKkZGRn0Y2mZmZgaMvujqoaulo6PThyW9e8YfQ8RhAwMDDSsrK4MBAwbYeHh4OLi5udnZ29sb47g282osUzr9iyG6AFOXADk6OloNGjTIZfDgwQMRB1tbW9RNtAGt+izdp8bz5Fnr5RAUQ19fX/VZA0yqHIIqvsk60ekWTU1NVU5F19XV1TY2bk3Y7t2ZK1K/+jrSy8vLldM2RVFHV1dXw9jYWFMGADT09PTUed9HhHfa/fr1M5sW/OKI/RuC4wqSX965bWXIHG9vb1dLS0sjdNXZQw2dPqIrwRU7BEpD5sQObkhQlI79DEjmZC/REx3R1dbW1tDS0tJEV4s5Hd7rKQcM1ZXgc3h61tbWOvxqE3jRVWNObPbqhXIfABtxsh5nz57PevTocVdjY2PD0KFDx6IwEND2DGuebWTwbMUwx4AJTgt9TVxcXJyz4kas79ph3fl4h/mj+lSHW2sXTA5nMztSxZANjdjDFGeIgaXCFs/W8jemTDgJfcBoAUZdgghATd7pYdpI9kKs0LORwbM1e8uvPfadnJ2dOSvX/vjg6ODgYEPwrWGbYvC3OcOQd5rsr0rge8sJq4sz0NC3oODM4X8hjY1Nzb6+vtOdnJyCoOmoYcOGjfLz8xstg+dAHx8fP2jvaWNj44SubOS5dfGoFRUpHsV1X7vXXdzsczQibEwYUXbDSXFqIIwZQhADsaGwhZ2R7BFAnH1wyBkAloA0IoiGADLDtj0+DSJF/GRtj85odEbh02hPT8+gxYuXRKSnZ6zOzNyz6tOtye9GRkaOPnPmzPtnz559X35zc3NnJCYmeuCfHimqTvBVBLAGkTQnSsNOnjx1tBtwY3NwcPD8zz//YvPFi5e+v3PnToFyVFZW5l+9eu27AweyP8WBsYAZjnMjJk4Y++aWtQu2bouL+DIhdkkC9iba2dmNIDgvxcdvjCwoOJ1ZXl6ep7RTVVV16saN4qOHDx9Jff318FCA+3FiAwDugk0vgvPinj17E69du/4De55S6pWVleWfOlWQfeFCYc7du9UlDx8+bHz4sLnxVMGZb8PDw8devnw5/vjx44uqq6v31tfXHzl06NB4Trsvvkg6dQOGchZQwj8/vxtwa2tr+4MHD+o6OzvbeW5B8XZV1Z3rbHxVnltaWpuY67h3v6Z8x460LSNHjgxftGjxUhyo7OjoaL18+adTnED4zFmz5ty8eesK71oY7U1NTfeQ4h47FS0tLY1ip6Gh8f7Ro7np06dPf8PL23vSpsQPl1dU3L7a2dnV0dbW3sraqtu3K69WV98rbmxqqu1CHiM9vrY0Nzc3pKSkrOjfv79vRkbGlJiYmFFFRUWrCwsL56elpQ2Dqfpywr8KWKSr61EXm17bu3d/Skho6BQiHjRkyJCg114LCUtL27mpuLjkgmza2trW9sMPh//5wQd/j6mpqa0RXRhwYd68ectu3Sq9Jn/j8P38kyezoeB7sGKC1IdJkyaFpKZ+FX/lytV8QAuGrry8/O8XLly4jJMsEzwNDQ21Bw8e2hkePuMvUFn0Xl62fEU09gvQ6RTbly79dDEx8aNE/HoFhrjANsljK0DKsIAthoDVIr3UqN6KHFYAJjq/AFxWXlG0YEHkfN6PwYY7BcZJhjwTnMCIiL/OLi6+eUXWcgrtO9J27rp/v0YJuHD//m8y2ts7hCHNe/ft3xEYODIUhwaT0/2x44wdN5wZMXly8J+vF924LHowpy07++C3ytPD5hcEKAQ9P6g+EL1BUHPUjBlvzC0puVkoa+rq6u4uW7Y8CpBDyX0LhgFFUXJWj7W6vNdCrw/FubtKS9Eih80kh58EvGHDpniS/SXmXKGCCcOACOlzFZhSW5xl448//iS+DbSy/tr1ohLw1sozp3bpxIkT38mznO7q2LjlOO1PPbJGv6+YYhjjnCOOBW7btu0jWSty/nyhAogILHgXvSAOxIP19hQdJ/wZTAGciv0sCQx0biLW68hTd+bFTQ2CowZoNYKqxjtVDQ0N5XWnuJakwzKl6fCFUod69vpXWFjYHBRG4qQD14UBTYYWwdHi/sNG336cVMBKpL6+oV7W375dVf0k4Ly8vO/lGcD3YmPXRGFrkIDFjjrbihMaBM4MQD5JSUlrZa0IutceIfK8Oz3jK39//zAJFreBsMyLAI15++3ZkRUVFUWypra2rnz58pURvHcErLbYZigB/geoUgChRgQN4btbRmZmonKzrKzs3QRhItHyxDEbQJoBXobcgR5QfXxW1oF0Uk+xPv9kwWko/UzAa9asW4zTAwmWHlsqHCKI0rQYw5RBycnJcbJWZN/+b7JuV1aWCqspUA+OHcvdN2tWxFvk8ERy+JX18RtiqO7nZF/k8YHsg9vd3d0DCYg1BNTA9i87q6eFQKsCQroT26ioqBlE7gqbPaJy1lGBk4KDXwkjZ/2gjA8U9+b+DZg06eXXtmz5NEHyU2gFUECtTVAWracBr18f/zdOwJUT1mVLBWDAS/cjBcUdSq+WtSLJyZ+lRC9duhJQhdSAlvb29jZoW3Pnzt0S8rWCPRtlTzKp48SJvNwxY8ZIg+NN7MywL+zpztXniIosJDcMyWMPnJtzq7T0nFRBrpJONr6UmZn50a5du9bt2rV7LcUoiaJ0WhyRNVLJY2JW/yM6eukKAN8Xp3sAK3KYSludkJD4PsFy6qGc4gTopgSwAUWlf2pq6kpZK7J1a/Jm2BNMnk5OSfkylvv2m9LSslzu8BOlpaX55eUVl9txTECXlZWXUFgjsT0E/y2kBe2x/1zpLacMaKlmFtDYY8mS6HC6lFSagxIpSkIfACoEjF1cRe3cy2U5OTlfREdHvw0DgqKiot8jj29xt7aeO3f+JHP75fnevfslmzZ9OBOnbGGSFvspAFM7VDkVqaL227dvj2Qpy1takpK2xvBuODXCmzTzpasKkO6K8QJNzISQkNCZOUeP7ZPrUAJEcI+PGz9+AteOHZTW7LH/X0VFVVVVjRPQkTYTmjkEBgb6E70pcXFx75Bjy47k5Oz48ccTGVBueWxsLG3cwmkBAQH+5KBcF84vvPDi0BUrVk5Zs2bNW7NnvzN95syZU6H5W+iHkhae0M4Yh5SUE0rLZ6Um+qZ0SP4bNya8uXbtulmkSxD7+wDYjVrRHxY4MRwYjvgmrerwiRMnRtDc5AlgusKa5ORtUQTH+QkG/SbpTd8un1byHawnwCWvEWcp+Zy8F72tF89u8o45O5wwpZgZMgxwzphKbMmcHb/9+O0HGDtOy5K1hsxrsU5ZQUUUeQwAbQCass6WX5dx48YPj176wdSoqKXTaSYEvAd0dURXPkSc8WsIpz0tPz8/W2jd3NzSmJ6euZo73eX3AhYRZ1Sgm3Ql0nvqsIk+GxqBzZjNeDSRBt+A09GVnKHKy6Xeh7VyzWgzJzq6Mi/FENpqMacu4HrsK6U3e6hILrNWi3UGxMf6k082v07Tc76yquoneub0qVOnSdH0J4hezA+lzoxbtSpmFalSISdMu1kE26YSGPsnUuZ3S28orgIYFa5NVQGkHHKN9bwTwwp69qyXQqTCdSMB+3nIO2qEct3TotDFpnywa+Kzydy5814qKrpxkLohRbPt5s2bF/iI2fjqq6+Gz5+/YC4fG3sePKivliuJktLG3CquJW8YZPpEyvxPonDqGeN58lvWPCkKeuO0HmnjGBoWFpSTcyyltra2hDr2kMuiU+jbXTw7Ovh8raFyn05M/HARYH04fSspgNh5MmX+0CKNiPy7SIMCaERF78fXli83TjgfL+tpPj7j+/br/PyTXx45krOVU42G6n8iOPJNbglYLhnFHfx/AVYpiusR0PLvH32Am0NxR3LWnWbHh+tpCN/Mvjx7U6BcAWoLI6TH1xEqSwqKjW5Tvya9ev0bEj8/qn9c7kYAAAAASUVORK5CYII=", p.tileXYToQuadKey = function(e, t, r) { for (var i = "", n = r; n >= 0; --n) { var o = 1 << n,
  5549. a = 0;
  5550. 0 !== (e & o) && (a |= 1), 0 !== (t & o) && (a |= 2), i += a } return i }, p.quadKeyToTileXY = function(e) { for (var t = 0, r = 0, i = e.length - 1, n = i; n >= 0; --n) { var o = 1 << n,
  5551. a = +e[i - n];
  5552. 0 !== (1 & a) && (t |= o), 0 !== (2 & a) && (r |= o) } return { x: t, y: r, level: i } }, p }), r("Scene/CameraController", ["../Core/defaultValue", "../Core/defined", "../Core/Cartesian2", "../Core/Cartesian3", "../Core/Cartesian4", "../Core/Cartographic", "../Core/DeveloperError", "../Core/Ellipsoid", "../Core/GeographicProjection", "../Core/IntersectionTests", "../Core/Math", "../Core/Matrix3", "../Core/Matrix4", "../Core/Quaternion", "../Core/Ray", "./SceneMode", "../ThirdParty/Tween"], function(e, t, r, i, n, o, a, s, l, u, c, h, d, m, p, f, v) {
  5553. "use strict";
  5554. function y(e, t) { var r = e._maxCoord.x * e.maximumTranslateFactor;
  5555. t.x > r && (t.x = r), t.x < -r && (t.x = -r); var i = e._maxCoord.y * e.maximumTranslateFactor;
  5556. t.y > i && (t.y = i), t.y < -i && (t.y = -i) }
  5557. function g(e, r) { var n, o = e._camera; if (t(r)) { var a = i.clone(o.getPositionWC(), W),
  5558. s = i.clone(o.getUpWC(), G),
  5559. l = i.clone(o.getRightWC(), H),
  5560. u = i.clone(o.getDirectionWC(), j);
  5561. n = o.transform, o.transform = r.multiply(n); var c = o.getInverseTransform();
  5562. i.clone(d.multiplyByVector(c, a, a), o.position), i.clone(d.multiplyByVector(c, s, s), o.up), i.clone(d.multiplyByVector(c, l, l), o.right), i.clone(d.multiplyByVector(c, u, u), o.direction) } return n }
  5563. function _(e, r) { if (t(r)) { var n = e._camera,
  5564. o = i.clone(n.getPositionWC(), Y),
  5565. a = i.clone(n.getUpWC(), X),
  5566. s = i.clone(n.getRightWC(), Z),
  5567. l = i.clone(n.getDirectionWC(), K);
  5568. n.transform = r, r = n.getInverseTransform(), o = i.clone(d.multiplyByVector(r, o, o), n.position), a = i.clone(d.multiplyByVector(r, a, a), n.up), s = i.clone(d.multiplyByVector(r, s, s), n.right), l = i.clone(d.multiplyByVector(r, l, l), n.direction) } }
  5569. function w(e, r, n) { var o = e._camera,
  5570. a = g(e, n),
  5571. s = o.position,
  5572. l = i.normalize(s, $); if (t(e.constrainedAxis)) { var u = l.equalsEpsilon(e.constrainedAxis, c.EPSILON2),
  5573. h = l.equalsEpsilon(e.constrainedAxis.negate(), c.EPSILON2); if (u || h)(u && 0 > r || h && r > 0) && e.rotate(o.right, r);
  5574. else { var d = i.normalize(e.constrainedAxis, et),
  5575. m = l.dot(d),
  5576. p = Math.acos(m);
  5577. r > 0 && r > p && (r = p), m = l.dot(d.negate()), p = Math.acos(m), 0 > r && -r > p && (r = -p); var f = i.cross(d, l, tt);
  5578. e.rotate(f, r) } } else e.rotate(o.right, r);
  5579. _(e, a) }
  5580. function C(e, r, i) { t(e.constrainedAxis) ? e.rotate(e.constrainedAxis, r, i) : e.rotate(e._camera.up, r, i) }
  5581. function x(e, r) { var i = e._camera.frustum; if (!(t(i.left) && t(i.right) && t(i.top) && t(i.bottom))) throw new a("The camera frustum is expected to be orthographic for 2D camera control.");
  5582. r = .5 * r; var n = i.right - r,
  5583. o = i.left + r,
  5584. s = e._maxCoord.x * e.maximumZoomFactor;
  5585. n > s && (n = s, o = -s); var l = i.top / i.right;
  5586. i.right = n, i.left = o, i.top = i.right * l, i.bottom = -i.top }
  5587. function S(e, t) { var r = e._camera;
  5588. e.move(r.direction, t) }
  5589. function E(e, t) { var n = e._camera,
  5590. o = .5 * -t.height,
  5591. a = -o,
  5592. s = n.frustum; if (a > o) { var l = s.top / s.right;
  5593. s.right = a, s.left = o, s.top = s.right * l, s.bottom = -s.top } r.clone(e._projection.project(t), n.position), i.negate(i.UNIT_Z, n.direction), i.clone(i.UNIT_Y, n.up), i.clone(i.UNIT_X, n.right) }
  5594. function b(e, t) { var r = e._camera,
  5595. n = e._projection;
  5596. r.position = n.project(t), i.negate(i.UNIT_Z, r.direction), i.clone(i.UNIT_Y, r.up), i.clone(i.UNIT_X, r.right) }
  5597. function T(e, t) { var r = e._camera,
  5598. n = e._projection.getEllipsoid();
  5599. n.cartographicToCartesian(t, r.position), i.negate(r.position, r.direction), i.normalize(r.direction, r.direction), i.cross(r.direction, i.UNIT_Z, r.right), i.cross(r.right, r.direction, r.up), i.cross(r.direction, r.up, r.right) }
  5600. function A(e, t, r, n, o) { var a = e;
  5601. o && (a = lt); var s = t.north,
  5602. l = t.south,
  5603. u = t.east,
  5604. h = t.west;
  5605. h > u && (u += c.TWO_PI); var d = rt;
  5606. d.longitude = u, d.latitude = s; var m = r.cartographicToCartesian(d, it);
  5607. d.latitude = l; var p = r.cartographicToCartesian(d, at);
  5608. d.longitude = h; var f = r.cartographicToCartesian(d, nt);
  5609. d.latitude = s; var v = r.cartographicToCartesian(d, ot),
  5610. y = i.subtract(m, f, st);
  5611. i.multiplyByScalar(y, .5, y), i.add(f, y, y), i.subtract(v, y, v), i.subtract(p, y, p), i.subtract(m, y, m), i.subtract(f, y, f); var g = r.geodeticSurfaceNormal(y, a.direction);
  5612. i.negate(g, g), i.normalize(g, g); var _ = i.cross(g, i.UNIT_Z, a.right);
  5613. i.normalize(_, _); var w = i.cross(_, g, a.up),
  5614. C = Math.max(Math.abs(w.dot(v)), Math.abs(w.dot(p)), Math.abs(w.dot(m)), Math.abs(w.dot(f))),
  5615. x = Math.max(Math.abs(_.dot(v)), Math.abs(_.dot(p)), Math.abs(_.dot(m)), Math.abs(_.dot(f))),
  5616. S = Math.tan(.5 * e.frustum.fovy),
  5617. E = e.frustum.aspectRatio * S,
  5618. b = Math.max(x / E, C / S),
  5619. T = y.magnitude() + b; return i.normalize(y, y), i.multiplyByScalar(y, T, n) }
  5620. function M(e, r, o, a, s) { var l = r.north,
  5621. u = r.south,
  5622. c = r.east,
  5623. h = r.west,
  5624. m = d.clone(e.transform, dt);
  5625. m.setColumn(3, n.UNIT_W); var p = e.getInverseTransform(),
  5626. f = ut;
  5627. f.longitude = c, f.latitude = l; var v = o.project(f),
  5628. y = i.clone(v, ct);
  5629. d.multiplyByVector(m, y, y), d.multiplyByVector(p, y, y), f.longitude = h, f.latitude = u, v = o.project(f); var g = i.clone(v, ht);
  5630. d.multiplyByVector(m, g, g), d.multiplyByVector(p, g, g); var _ = Math.tan(.5 * e.frustum.fovy),
  5631. w = e.frustum.aspectRatio * _; if (t(a) || (a = new i), a.x = .5 * (y.x - g.x) + g.x, a.y = .5 * (y.y - g.y) + g.y, a.z = .5 * Math.max((y.x - g.x) / w, (y.y - g.y) / _), !s) { var C = i.clone(i.UNIT_Z, e.direction);
  5632. i.negate(C, C), i.clone(i.UNIT_X, e.right), i.clone(i.UNIT_Y, e.up) } return a }
  5633. function P(e, r, n, o, a) { var s = r.north,
  5634. l = r.south,
  5635. u = r.east,
  5636. c = r.west,
  5637. h = mt;
  5638. h.longitude = u, h.latitude = s; var d = n.project(h, pt);
  5639. h.longitude = c, h.latitude = l; var m, p, f = n.project(h, ft),
  5640. v = .5 * Math.abs(d.x - f.x),
  5641. y = .5 * Math.abs(d.y - f.y),
  5642. g = e.frustum.right / e.frustum.top,
  5643. _ = y * g; if (v > _ ? (m = v, p = m / g) : (p = y, m = _), y = Math.max(2 * m, 2 * p), t(o) || (o = new i), o.x = .5 * (d.x - f.x) + f.x, o.y = .5 * (d.y - f.y) + f.y, a) h = n.unproject(o, h), h.height = y, o = n.project(h, o);
  5644. else { var w = e.frustum;
  5645. w.right = m, w.left = -m, w.top = p, w.bottom = -p; var C = i.clone(i.UNIT_Z, e.direction);
  5646. i.negate(C, C), i.clone(i.UNIT_X, e.right), i.clone(i.UNIT_Y, e.up) } return o }
  5647. function D(t, r, i, n) { i = e(i, s.WGS84); var o = t.getPickRay(r, vt),
  5648. a = u.rayEllipsoid(o, i); return a ? o.getPoint(a.start, n) : void 0 }
  5649. function I(e, t, r, i) { var n = e.getPickRay(t, yt),
  5650. o = n.origin;
  5651. o.z = 0; var a = r.unproject(o); return a.latitude < -c.PI_OVER_TWO || a.latitude > c.PI_OVER_TWO || a.longitude < -Math.PI || a.longitude > Math.PI ? void 0 : r.getEllipsoid().cartographicToCartesian(a, i) }
  5652. function O(e, t, r, n) { var o = e.getPickRay(t, gt),
  5653. a = -o.origin.x / o.direction.x;
  5654. o.getPoint(a, n); var s = r.unproject(new i(n.y, n.z, 0)); return s.latitude < -c.PI_OVER_TWO || s.latitude > c.PI_OVER_TWO || s.longitude < -Math.PI || s.longitude > Math.PI ? void 0 : r.getEllipsoid().cartographicToCartesian(s, n) }
  5655. function R(e, t, r) { var n = e._canvas.clientWidth,
  5656. o = e._canvas.clientHeight,
  5657. a = Math.tan(.5 * e.frustum.fovy),
  5658. s = e.frustum.aspectRatio * a,
  5659. l = e.frustum.near,
  5660. u = 2 / n * t.x - 1,
  5661. c = 2 / o * (o - t.y) - 1,
  5662. h = e.getPositionWC();
  5663. i.clone(h, r.origin); var d = i.multiplyByScalar(e.getDirectionWC(), l, _t);
  5664. i.add(h, d, d); var m = i.multiplyByScalar(e.getRightWC(), u * l * s, wt),
  5665. p = i.multiplyByScalar(e.getUpWC(), c * l * a, Ct),
  5666. f = i.add(d, m, r.direction); return i.add(f, p, f), i.subtract(f, h, f), i.normalize(f, f), r }
  5667. function L(e, t, r) { var n = e._canvas.clientWidth,
  5668. o = e._canvas.clientHeight,
  5669. a = 2 / n * t.x - 1;
  5670. a *= .5 * (e.frustum.right - e.frustum.left); var s = 2 / o * (o - t.y) - 1;
  5671. s *= .5 * (e.frustum.top - e.frustum.bottom); var l = r.origin; return i.clone(e.position, l), l.x += a, l.y += s, i.clone(e.getDirectionWC(), r.direction), r }
  5672. function z(e, t) { var r = e._camera,
  5673. i = r.position,
  5674. n = i.x < -e._maxCoord.x || i.x > e._maxCoord.x,
  5675. o = i.y < -e._maxCoord.y || i.y > e._maxCoord.y,
  5676. a = n || o,
  5677. s = r.frustum,
  5678. l = s.top,
  5679. u = s.bottom,
  5680. h = s.right,
  5681. d = s.left,
  5682. m = e._frustum,
  5683. p = h > e._frustum.right; if (a || p) { var f = i.clone();
  5684. f.x > e._maxCoord.x ? f.x = e._maxCoord.x : f.x < -e._maxCoord.x && (f.x = -e._maxCoord.x), f.y > e._maxCoord.y ? f.y = e._maxCoord.y : f.y < -e._maxCoord.y && (f.y = -e._maxCoord.y); var y = function(e) { a && (r.position = i.lerp(f, e.time)), p && (r.frustum.top = c.lerp(l, m.top, e.time), r.frustum.bottom = c.lerp(u, m.bottom, e.time), r.frustum.right = c.lerp(h, m.right, e.time), r.frustum.left = c.lerp(d, m.left, e.time)) }; return { easingFunction: v.Easing.Exponential.Out, startValue: { time: 0 }, stopValue: { time: 1 }, duration: t, onUpdate: y } } return void 0 }
  5685. function N(e, t, r, o, a, s) { var l = t.clone();
  5686. r.y > o ? l.y -= r.y - o : r.y < -o && (l.y += -o - r.y), r.z > a ? l.z -= r.z - a : r.z < -a && (l.z += -a - r.z); var u = e._camera,
  5687. c = function(e) { var r = t.lerp(l, e.time),
  5688. o = new n(r.x, r.y, r.z, 1);
  5689. u.position = i.fromCartesian4(u.getInverseTransform().multiplyByVector(o)) }; return { easingFunction: v.Easing.Exponential.Out, startValue: { time: 0 }, stopValue: { time: 1 }, duration: s, onUpdate: c } }
  5690. function F(e, t) { var r = e._camera,
  5691. o = r.position,
  5692. a = r.direction,
  5693. s = i.fromCartesian4(r.getInverseTransform().multiplyByVector(n.UNIT_X)),
  5694. l = -s.dot(o) / s.dot(a),
  5695. u = o.add(a.multiplyByScalar(l));
  5696. u = new n(u.x, u.y, u.z, 1); var c = r.transform.multiplyByVector(u),
  5697. h = new n(r.position.x, r.position.y, r.position.z, 1),
  5698. d = r.transform.multiplyByVector(h),
  5699. m = Math.tan(.5 * e._camera.frustum.fovy),
  5700. p = e._camera.frustum.aspectRatio * m,
  5701. f = d.subtract(c).magnitude(),
  5702. v = p * f,
  5703. y = m * f,
  5704. g = e._maxCoord.x,
  5705. _ = e._maxCoord.y,
  5706. w = Math.max(v - g, g),
  5707. C = Math.max(y - _, _); if (d.z < -w || d.z > w || d.y < -C || d.y > C) { var x = c.y < -w || c.y > w,
  5708. S = c.z < -C || c.z > C; if (x || S) return N(e, i.fromCartesian4(d), i.fromCartesian4(c), w, C, t) } return void 0 }
  5709. var B = function(e) { if (!t(e)) throw new a("camera is required.");
  5710. this._camera = e, this._mode = f.SCENE3D, this._projection = new l, this.defaultMoveAmount = 1e5, this.defaultLookAmount = Math.PI / 60, this.defaultRotateAmount = Math.PI / 3600, this.defaultZoomAmount = 1e5, this.constrainedAxis = void 0, this.maximumTranslateFactor = 1.5, this.maximumZoomFactor = 2.5, this._maxCoord = new i, this._frustum = void 0 },
  5711. V = new o(Math.PI, c.PI_OVER_TWO);
  5712. B.prototype.update = function(e, r) { var i = !1;
  5713. e !== this._mode && (this._mode = e, i = this._mode === f.SCENE2D); var n = r.projection; if (t(n) && n !== this._projection && (this._projection = n, this._maxCoord = n.project(V, this._maxCoord)), i) { var o = this._frustum = this._camera.frustum.clone(); if (!(t(o.left) && t(o.right) && t(o.top) && t(o.bottom))) throw new a("The camera frustum is expected to be orthographic for 2D camera control."); var s = 2,
  5714. l = o.top / o.right;
  5715. o.right = this._maxCoord.x * s, o.left = -o.right, o.top = l * o.right, o.bottom = -o.top } };
  5716. var q = new i;
  5717. B.prototype.move = function(e, r) { if (!t(e)) throw new a("direction is required."); var n = this._camera.position;
  5718. i.multiplyByScalar(e, r, q), i.add(n, q, n), this._mode === f.SCENE2D && y(this, n) }, B.prototype.moveForward = function(t) { t = e(t, this.defaultMoveAmount), this.move(this._camera.direction, t) }, B.prototype.moveBackward = function(t) {
  5719. t = e(t, this.defaultMoveAmount), this.move(this._camera.direction, -t)
  5720. }, B.prototype.moveUp = function(t) { t = e(t, this.defaultMoveAmount), this.move(this._camera.up, t) }, B.prototype.moveDown = function(t) { t = e(t, this.defaultMoveAmount), this.move(this._camera.up, -t) }, B.prototype.moveRight = function(t) { t = e(t, this.defaultMoveAmount), this.move(this._camera.right, t) }, B.prototype.moveLeft = function(t) { t = e(t, this.defaultMoveAmount), this.move(this._camera.right, -t) }, B.prototype.lookLeft = function(t) { t = e(t, this.defaultLookAmount), this.look(this._camera.up, -t) }, B.prototype.lookRight = function(t) { t = e(t, this.defaultLookAmount), this.look(this._camera.up, t) }, B.prototype.lookUp = function(t) { t = e(t, this.defaultLookAmount), this.look(this._camera.right, -t) }, B.prototype.lookDown = function(t) { t = e(t, this.defaultLookAmount), this.look(this._camera.right, t) };
  5721. var k = new m,
  5722. U = new h;
  5723. B.prototype.look = function(r, i) { if (!t(r)) throw new a("axis is required."); var n = e(i, this.defaultLookAmount),
  5724. o = h.fromQuaternion(m.fromAxisAngle(r, n, k), U),
  5725. s = this._camera.direction,
  5726. l = this._camera.up,
  5727. u = this._camera.right;
  5728. h.multiplyByVector(o, s, s), h.multiplyByVector(o, l, l), h.multiplyByVector(o, u, u) }, B.prototype.twistLeft = function(t) { t = e(t, this.defaultLookAmount), this.look(this._camera.direction, t) }, B.prototype.twistRight = function(t) { t = e(t, this.defaultLookAmount), this.look(this._camera.direction, -t) };
  5729. var W = n.UNIT_W.clone(),
  5730. G = n.ZERO.clone(),
  5731. H = n.ZERO.clone(),
  5732. j = n.ZERO.clone(),
  5733. Y = n.UNIT_W.clone(),
  5734. X = n.ZERO.clone(),
  5735. Z = n.ZERO.clone(),
  5736. K = n.ZERO.clone(),
  5737. J = new m,
  5738. Q = new h;
  5739. B.prototype.rotate = function(r, n, o) { if (!t(r)) throw new a("axis is required."); var s = this._camera,
  5740. l = e(n, this.defaultRotateAmount),
  5741. u = h.fromQuaternion(m.fromAxisAngle(r, l, J), Q),
  5742. c = g(this, o);
  5743. h.multiplyByVector(u, s.position, s.position), h.multiplyByVector(u, s.direction, s.direction), h.multiplyByVector(u, s.up, s.up), i.cross(s.direction, s.up, s.right), i.cross(s.right, s.direction, s.up), _(this, c) }, B.prototype.rotateDown = function(t, r) { t = e(t, this.defaultRotateAmount), w(this, t, r) }, B.prototype.rotateUp = function(t, r) { t = e(t, this.defaultRotateAmount), w(this, -t, r) };
  5744. var $ = new i,
  5745. et = new i,
  5746. tt = new i;
  5747. B.prototype.rotateRight = function(t, r) { t = e(t, this.defaultRotateAmount), C(this, -t, r) }, B.prototype.rotateLeft = function(t, r) { t = e(t, this.defaultRotateAmount), C(this, t, r) }, B.prototype.zoomIn = function(t) { t = e(t, this.defaultZoomAmount), this._mode === f.SCENE2D ? x(this, t) : S(this, t) }, B.prototype.zoomOut = function(t) { t = e(t, this.defaultZoomAmount), this._mode === f.SCENE2D ? x(this, -t) : S(this, -t) }, B.prototype.getMagnitude = function() { var e = this._camera; return this._mode === f.SCENE3D ? e.position.magnitude() : this._mode === f.COLUMBUS_VIEW ? Math.abs(e.position.z) : this._mode === f.SCENE2D ? Math.max(e.frustum.right - e.frustum.left, e.frustum.top - e.frustum.bottom) : void 0 }, B.prototype.setPositionCartographic = function(e) { if (!t(e)) throw new a("cartographic is required.");
  5748. this._mode === f.SCENE2D ? E(this, e) : this._mode === f.COLUMBUS_VIEW ? b(this, e) : this._mode === f.SCENE3D && T(this, e) }, B.prototype.lookAt = function(e, r, n) { if (!t(e)) throw new a("eye is required"); if (!t(r)) throw new a("target is required"); if (!t(n)) throw new a("up is required"); if (this._mode === f.SCENE2D) throw new a("lookAt is not supported in 2D mode because there is only one direction to look."); if (this._mode === f.MORPHING) throw new a("lookAt is not supported while morphing."); var o = this._camera;
  5749. o.position = i.clone(e, o.position), o.direction = i.subtract(r, e, o.direction).normalize(o.direction), o.right = i.cross(o.direction, n, o.right).normalize(o.right), o.up = i.cross(o.right, o.direction, o.up) };
  5750. var rt = new o,
  5751. it = new i,
  5752. nt = new i,
  5753. ot = new i,
  5754. at = new i,
  5755. st = new i,
  5756. lt = { direction: new i, right: new i, up: new i },
  5757. ut = new o,
  5758. ct = n.UNIT_W.clone(),
  5759. ht = n.UNIT_W.clone(),
  5760. dt = new d,
  5761. mt = new o,
  5762. pt = new i,
  5763. ft = new i;
  5764. B.prototype.getExtentCameraCoordinates = function(e, r) { if (!t(e)) throw new a("extent is required"); return this._mode === f.SCENE3D ? A(this._camera, e, this._projection.getEllipsoid(), r, !0) : this._mode === f.COLUMBUS_VIEW ? M(this._camera, e, this._projection, r, !0) : this._mode === f.SCENE2D ? P(this._camera, e, this._projection, r, !0) : void 0 }, B.prototype.viewExtent = function(r, i) { if (!t(r)) throw new a("extent is required.");
  5765. i = e(i, s.WGS84), this._mode === f.SCENE3D ? A(this._camera, r, i, this._camera.position) : this._mode === f.COLUMBUS_VIEW ? M(this._camera, r, this._projection, this._camera.position) : this._mode === f.SCENE2D && P(this._camera, r, this._projection, this._camera.position) };
  5766. var vt = new p,
  5767. yt = new p,
  5768. gt = new p;
  5769. B.prototype.pickEllipsoid = function(r, n, o) { if (!t(r)) throw new a("windowPosition is required."); return t(o) || (o = new i), n = e(n, s.WGS84), this._mode === f.SCENE3D ? o = D(this, r, n, o) : this._mode === f.SCENE2D ? o = I(this, r, this._projection, o) : this._mode === f.COLUMBUS_VIEW && (o = O(this, r, this._projection, o)), o };
  5770. var _t = new i,
  5771. wt = new i,
  5772. Ct = new i;
  5773. return B.prototype.getPickRay = function(e, r) { if (!t(e)) throw new a("windowPosition is required.");
  5774. t(r) || (r = new p); var i = this._camera,
  5775. n = i.frustum; return t(n.aspectRatio) && t(n.fovy) && t(n.near) ? R(i, e, r) : L(i, e, r) }, B.prototype.createCorrectPositionAnimation = function(e) { if (!t(e)) throw new a("duration is required."); return this._mode === f.SCENE2D ? z(this, e) : this._mode === f.COLUMBUS_VIEW ? F(this, e) : void 0 }, B
  5776. }), r("Scene/CullingVolume", ["../Core/defaultValue", "../Core/defined", "../Core/DeveloperError", "../Core/Intersect"], function(e, t, r, i) { "use strict"; var n = function(t) { this.planes = e(t, []) }; return n.prototype.getVisibility = function(e) { if (!t(e)) throw new r("boundingVolume is required."); for (var n = this.planes, o = !1, a = 0, s = n.length; s > a; ++a) { var l = e.intersect(n[a]); if (l === i.OUTSIDE) return i.OUTSIDE;
  5777. l === i.INTERSECTING && (o = !0) } return o ? i.INTERSECTING : i.INSIDE }, n }), r("Scene/PerspectiveOffCenterFrustum", ["../Core/DeveloperError", "../Core/defaultValue", "../Core/defined", "../Core/destroyObject", "../Core/Cartesian2", "../Core/Cartesian3", "../Core/Cartesian4", "../Core/Matrix4", "../Scene/CullingVolume"], function(e, t, r, i, n, o, a, s, l) { "use strict";
  5778. function u(t) { if (!(r(t.right) && r(t.left) && r(t.top) && r(t.bottom) && r(t.near) && r(t.far))) throw new e("right, left, top, bottom, near, or far parameters are not set."); var i = t.top,
  5779. n = t.bottom,
  5780. o = t.right,
  5781. a = t.left,
  5782. l = t.near,
  5783. u = t.far; if (i !== t._top || n !== t._bottom || a !== t._left || o !== t._right || l !== t._near || u !== t._far) { if (t.near <= 0 || t.near > t.far) throw new e("near must be greater than zero and less than far.");
  5784. t._left = a, t._right = o, t._top = i, t._bottom = n, t._near = l, t._far = u, t._perspectiveMatrix = s.computePerspectiveOffCenter(a, o, n, i, l, u), t._infinitePerspective = s.computeInfinitePerspectiveOffCenter(a, o, n, i, l) } } var c = function() { this.left = void 0, this._left = void 0, this.right = void 0, this._right = void 0, this.top = void 0, this._top = void 0, this.bottom = void 0, this._bottom = void 0, this.near = 1, this._near = this.near, this.far = 5e8, this._far = this.far, this._cullingVolume = new l, this._perspectiveMatrix = void 0, this._infinitePerspective = void 0 };
  5785. c.prototype.getProjectionMatrix = function() { return u(this), this._perspectiveMatrix }, c.prototype.getInfiniteProjectionMatrix = function() { return u(this), this._infinitePerspective }; var h = new o,
  5786. d = new o,
  5787. m = new o,
  5788. p = new o; return c.prototype.computeCullingVolume = function(t, i, n) { if (!r(t)) throw new e("position is required."); if (!r(i)) throw new e("direction is required."); if (!r(n)) throw new e("up is required."); var s = this._cullingVolume.planes,
  5789. l = this.top,
  5790. u = this.bottom,
  5791. c = this.right,
  5792. f = this.left,
  5793. v = this.near,
  5794. y = this.far,
  5795. g = o.cross(i, n, h),
  5796. _ = d;
  5797. o.multiplyByScalar(i, v, _), o.add(t, _, _); var w = m;
  5798. o.multiplyByScalar(i, y, w), o.add(t, w, w); var C = p;
  5799. o.multiplyByScalar(g, f, C), o.add(_, C, C), o.subtract(C, t, C), o.normalize(C, C), o.cross(C, n, C); var x = s[0]; return r(x) || (x = s[0] = new a), x.x = C.x, x.y = C.y, x.z = C.z, x.w = -o.dot(C, t), o.multiplyByScalar(g, c, C), o.add(_, C, C), o.subtract(C, t, C), o.normalize(C, C), o.cross(n, C, C), x = s[1], r(x) || (x = s[1] = new a), x.x = C.x, x.y = C.y, x.z = C.z, x.w = -o.dot(C, t), o.multiplyByScalar(n, u, C), o.add(_, C, C), o.subtract(C, t, C), o.normalize(C, C), o.cross(g, C, C), x = s[2], r(x) || (x = s[2] = new a), x.x = C.x, x.y = C.y, x.z = C.z, x.w = -o.dot(C, t), o.multiplyByScalar(n, l, C), o.add(_, C, C), o.subtract(C, t, C), o.normalize(C, C), o.cross(C, g, C), x = s[3], r(x) || (x = s[3] = new a), x.x = C.x, x.y = C.y, x.z = C.z, x.w = -o.dot(C, t), x = s[4], r(x) || (x = s[4] = new a), x.x = i.x, x.y = i.y, x.z = i.z, x.w = -o.dot(i, _), o.negate(i, C), x = s[5], r(x) || (x = s[5] = new a), x.x = C.x, x.y = C.y, x.z = C.z, x.w = -o.dot(C, w), this._cullingVolume }, c.prototype.getPixelSize = function(i, o) { if (u(this), !r(i)) throw new e("canvasDimensions is required."); var a = i.x,
  5800. s = i.y; if (0 >= a) throw new e("canvasDimensions.x must be greater than zero."); if (0 >= s) throw new e("canvasDimensions.y must be greater than zero.");
  5801. o = t(o, this.near); var l = 1 / this.near,
  5802. c = this.top * l,
  5803. h = 2 * o * c / s;
  5804. c = this.right * l; var d = 2 * o * c / a; return new n(d, h) }, c.prototype.clone = function() { var e = new c; return e.right = this.right, e.left = this.left, e.top = this.top, e.bottom = this.bottom, e.near = this.near, e.far = this.far, e }, c.prototype.equals = function(e) { return r(e) && this.right === e.right && this.left === e.left && this.top === e.top && this.bottom === e.bottom && this.near === e.near && this.far === e.far }, c }), r("Scene/PerspectiveFrustum", ["../Core/defined", "../Core/DeveloperError", "../Scene/PerspectiveOffCenterFrustum"], function(e, t, r) { "use strict";
  5805. function i(r) { if (!(e(r.fovy) && e(r.aspectRatio) && e(r.near) && e(r.far))) throw new t("fovy, aspectRatio, near, or far parameters are not set."); var i = r._offCenterFrustum; if (r.fovy !== r._fovy || r.aspectRatio !== r._aspectRatio || r.near !== r._near || r.far !== r._far) { if (r.fovy < 0 || r.fovy >= Math.PI) throw new t("fovy must be in the range [0, PI)."); if (r.aspectRatio < 0) throw new t("aspectRatio must be positive."); if (r.near < 0 || r.near > r.far) throw new t("near must be greater than zero and less than far.");
  5806. r._fovy = r.fovy, r._aspectRatio = r.aspectRatio, r._near = r.near, r._far = r.far, i.top = r.near * Math.tan(.5 * r.fovy), i.bottom = -i.top, i.right = r.aspectRatio * i.top, i.left = -i.right, i.near = r.near, i.far = r.far } } var n = function() { this._offCenterFrustum = new r, this.fovy = void 0, this._fovy = void 0, this.aspectRatio = void 0, this._aspectRatio = void 0, this.near = 1, this._near = this.near, this.far = 5e8, this._far = this.far }; return n.prototype.getProjectionMatrix = function() { return i(this), this._offCenterFrustum.getProjectionMatrix() }, n.prototype.getInfiniteProjectionMatrix = function() { return i(this), this._offCenterFrustum.getInfiniteProjectionMatrix() }, n.prototype.computeCullingVolume = function(e, t, r) { return i(this), this._offCenterFrustum.computeCullingVolume(e, t, r) }, n.prototype.getPixelSize = function(e, t) { return i(this), this._offCenterFrustum.getPixelSize(e, t) }, n.prototype.clone = function() { var e = new n; return e.fovy = this.fovy, e.aspectRatio = this.aspectRatio, e.near = this.near, e.far = this.far, e._offCenterFrustum = this._offCenterFrustum.clone(), e }, n.prototype.equals = function(t) { return e(t) ? (i(this), i(t), this.fovy === t.fovy && this.aspectRatio === t.aspectRatio && this.near === t.near && this.far === t.far && this._offCenterFrustum.equals(t._offCenterFrustum)) : !1 }, n }), r("Scene/Camera", ["../Core/defined", "../Core/DeveloperError", "../Core/Math", "../Core/Ellipsoid", "../Core/Cartesian3", "../Core/Cartesian4", "../Core/Matrix4", "./CameraController", "./PerspectiveFrustum"], function(e, t, r, i, n, o, a, s, l) { "use strict";
  5807. function u(e) { var t = e._right,
  5808. r = e._up,
  5809. i = e._direction,
  5810. n = e._position,
  5811. o = new a(t.x, t.y, t.z, -t.dot(n), r.x, r.y, r.z, -r.dot(n), -i.x, -i.y, -i.z, i.dot(n), 0, 0, 0, 1);
  5812. e._viewMatrix = o.multiply(e._invTransform), e._invViewMatrix = e._viewMatrix.inverseTransformation() }
  5813. function c(e) { var t = e._position,
  5814. i = !t.equals(e.position);
  5815. i && (t = e._position = e.position.clone()); var a = e._direction,
  5816. s = !a.equals(e.direction);
  5817. s && (a = e._direction = e.direction.clone()); var l = e._up,
  5818. c = !l.equals(e.up);
  5819. c && (l = e._up = e.up.clone()); var h = e._right,
  5820. d = !h.equals(e.right);
  5821. d && (h = e._right = e.right.clone()); var m = e._transform,
  5822. p = !m.equals(e.transform); if (p && (m = e._transform = e.transform.clone(), e._invTransform = e._transform.inverseTransformation()), (i || p) && (e._positionWC = n.fromCartesian4(m.multiplyByPoint(t))), s || c || d) { var f = a.dot(l.cross(h)); if (Math.abs(1 - f) > r.EPSILON2) { a = e._direction = a.normalize(), e.direction = a.clone(); var v = 1 / l.magnitudeSquared(),
  5823. y = l.dot(a) * v,
  5824. g = a.multiplyByScalar(y);
  5825. l = e._up = l.subtract(g).normalize(), e.up = l.clone(), h = e._right = a.cross(l), e.right = h.clone() } }(s || p) && (e._directionWC = n.fromCartesian4(m.multiplyByVector(new o(a.x, a.y, a.z, 0)))), (c || p) && (e._upWC = n.fromCartesian4(m.multiplyByVector(new o(l.x, l.y, l.z, 0)))), (d || p) && (e._rightWC = n.fromCartesian4(m.multiplyByVector(new o(h.x, h.y, h.z, 0)))), (i || s || c || d || p) && u(e) } var h = function(o) { if (!e(o)) throw new t("canvas is required.");
  5826. this.transform = a.IDENTITY.clone(), this._transform = this.transform.clone(), this._invTransform = a.IDENTITY.clone(); var c = i.WGS84.getMaximumRadius(),
  5827. h = new n(0, -2, 1).normalize().multiplyByScalar(2.5 * c);
  5828. this.position = h.clone(), this._position = h, this._positionWC = h; var d = n.ZERO.subtract(h).normalize();
  5829. this.direction = d.clone(), this._direction = d, this._directionWC = d; var m = d.cross(n.UNIT_Z).normalize(),
  5830. p = m.cross(d);
  5831. this.up = p.clone(), this._up = p, this._upWC = p, m = d.cross(p), this.right = m.clone(), this._right = m, this._rightWC = m, this.frustum = new l, this.frustum.fovy = r.toRadians(60), this.frustum.aspectRatio = o.clientWidth / o.clientHeight, this.controller = new s(this), this._viewMatrix = void 0, this._invViewMatrix = void 0, u(this), this._canvas = o }; return h.prototype.getInverseTransform = function() { return c(this), this._invTransform }, h.prototype.getViewMatrix = function() { return c(this), this._viewMatrix }, h.prototype.getInverseViewMatrix = function() { return c(this), this._invViewMatrix }, h.prototype.getPositionWC = function() { return c(this), this._positionWC }, h.prototype.getDirectionWC = function() { return c(this), this._directionWC }, h.prototype.getUpWC = function() { return c(this), this._upWC }, h.prototype.getRightWC = function() { return c(this), this._rightWC }, h.prototype.clone = function() { var e = new h(this._canvas); return e.position = this.position.clone(), e.direction = this.direction.clone(), e.up = this.up.clone(), e.right = this.right.clone(), e.transform = this.transform.clone(), e.frustum = this.frustum.clone(), e }, h.prototype.worldToCameraCoordinates = function(r, i) { if (!e(r)) throw new t("cartesian is required."); return a.multiplyByVector(this.getInverseTransform(), r, i) }, h.prototype.cameraToWorldCoordinates = function(r, i) { if (!e(r)) throw new t("cartesian is required."); return a.multiplyByVector(this.transform, r, i) }, h }), r("Scene/CameraEventType", ["../Core/Enumeration"], function(e) { "use strict"; var t = { LEFT_DRAG: new e(0, "LEFT_DRAG"), RIGHT_DRAG: new e(1, "RIGHT_DRAG"), MIDDLE_DRAG: new e(2, "MIDDLE_DRAG"), WHEEL: new e(3, "WHEEL"), PINCH: new e(4, "PINCH") }; return t }), r("Scene/CameraEventAggregator", ["../Core/defined", "../Core/DeveloperError", "../Core/destroyObject", "../Core/Math", "../Core/ScreenSpaceEventHandler", "../Core/ScreenSpaceEventType", "../Core/Cartesian2", "./CameraEventType"], function(e, t, r, i, n, o, a, s) { "use strict"; var l = function(r, l, u) { if (!e(r)) throw new t("description.canvas is required."); if (!e(l)) throw new t("moveType is required.");
  5832. this._eventHandler = new n(r), this._update = !0, this._movement = void 0, this._lastMovement = void 0, this._isDown = !1, this._pressTime = void 0, this._releaseTime = void 0; var c = this; if (l === s.PINCH) this._eventHandler.setInputAction(function() { c._isDown = !0, c._pressTime = new Date }, o.PINCH_START, u), this._eventHandler.setInputAction(function() { c._isDown = !1, c._releaseTime = new Date }, o.PINCH_END, u), this._eventHandler.setInputAction(function(e) { if (c._isDown) { c._update ? (c._movement = e, c._update = !1, c._movement.prevAngle = c._movement.angleAndHeight.startPosition.x) : (c._movement.distance.endPosition = e.distance.endPosition.clone(), c._movement.angleAndHeight.endPosition = e.angleAndHeight.endPosition.clone()); for (var t = c._movement.angleAndHeight.endPosition.x, i = c._movement.prevAngle, n = 2 * Math.PI; t >= i + Math.PI;) t -= n; for (; t < i - Math.PI;) t += n;
  5833. c._movement.angleAndHeight.endPosition.x = -t * r.clientWidth / 12, c._movement.angleAndHeight.startPosition.x = -i * r.clientWidth / 12 } }, o.PINCH_MOVE, u);
  5834. else if (l === s.WHEEL) this._eventHandler.setInputAction(function(e) { var t = 2 * i.toRadians(e);
  5835. c._update ? (c._movement = { startPosition: new a, endPosition: new a(0, t), motion: new a }, c._lastMovement = c._movement, c._update = !1) : c._movement.endPosition.y = c._movement.endPosition.y + t, c._pressTime = new Date, c._releaseTime = new Date(c._pressTime.getTime() + 5 * Math.abs(t)) }, o.WHEEL, u);
  5836. else { var h, d; if (l === s.LEFT_DRAG) h = o.LEFT_DOWN, d = o.LEFT_UP;
  5837. else if (l === s.RIGHT_DRAG) h = o.RIGHT_DOWN, d = o.RIGHT_UP;
  5838. else { if (l !== s.MIDDLE_DRAG) throw this._eventHandler = this._eventHandler && this._eventHandler.destroy(), new t("moveType must be of type CameraEventType.");
  5839. h = o.MIDDLE_DOWN, d = o.MIDDLE_UP } this._eventHandler.setInputAction(function() { c._lastMovement = null, c._isDown = !0, c._pressTime = new Date }, h, u), this._eventHandler.setInputAction(function() { c._isDown = !1, c._releaseTime = new Date }, d, u), this._eventHandler.setInputAction(function(e) { c._isDown && (c._update ? (c._lastMovement = c._movement, c._movement = e, c._update = !1) : c._movement.endPosition = e.endPosition.clone()) }, o.MOUSE_MOVE, u) } }; return l.prototype.isMoving = function() { return !this._update }, l.prototype.getMovement = function() { var e = this._movement; return this._update = !0, e }, l.prototype.getLastMovement = function() { return this._lastMovement }, l.prototype.isButtonDown = function() { return this._isDown }, l.prototype.getButtonPressTime = function() { return this._pressTime }, l.prototype.getButtonReleaseTime = function() { return this._releaseTime }, l.prototype.isDestroyed = function() { return !1 }, l.prototype.destroy = function() { return this._eventHandler = this._eventHandler && this._eventHandler.destroy(), r(this) }, l }), r("Scene/CameraFlightPath", ["../Core/Cartesian2", "../Core/Cartesian3", "../Core/clone", "../Core/defaultValue", "../Core/defined", "../Core/DeveloperError", "../Core/HermiteSpline", "../Core/Math", "../Core/Matrix3", "../Core/OrientationInterpolator", "../Core/Quaternion", "../Scene/PerspectiveFrustum", "../Scene/PerspectiveOffCenterFrustum", "../Scene/SceneMode", "../ThirdParty/Tween"], function(e, t, r, i, n, o, a, s, l, u, c, h, d, m, p) { "use strict";
  5840. function f(e, t, r) { return e.cross(t, I), I.cross(e, O), D[0] = I.x, D[1] = O.x, D[2] = -e.x, D[3] = I.y, D[4] = O.y, D[5] = -e.y, D[6] = I.z, D[7] = O.z, D[8] = -e.z, c.fromRotationMatrix(D, r) }
  5841. function v(e, t, r) { var i, n, o; if (e instanceof h) { var a = Math.tan(.5 * e.fovy); return i = e.near, n = e.near * a, o = e.aspectRatio * n, Math.max(t * i / o, r * i / n) } return e instanceof d ? (i = e.near, n = e.top, o = e.right, Math.max(t * i / o, r * i / n)) : Math.max(t, r) }
  5842. function y(e) { if (e.length > 2) return new a(e); var r = e[0],
  5843. i = e[1]; return { getControlPoints: function() { return e }, evaluate: function(e, n) { e = s.clamp(e, r.time, i.time); var o = (e - r.time) / (i.time - r.time); return t.lerp(r.point, i.point, o, n) } } }
  5844. function g(e, r, i, n, o) { var a, u, h, d = r.getMaximumRadius(),
  5845. m = e.frustum,
  5846. p = v(m, d, d),
  5847. f = i.normalize().dot(n.normalize()); if (i.magnitude() > p) u = d + .6 * (p - d), h = .35;
  5848. else { var g = i.subtract(n);
  5849. u = g.multiplyByScalar(.5).add(n).magnitude(); var _ = e.up.multiplyByScalar(g.dot(e.up)).magnitude(),
  5850. w = e.right.multiplyByScalar(g.dot(e.right)).magnitude();
  5851. u += v(m, _, w), h = s.clamp(f + 1, .25, .5) } var C, x, S, E, b = n.normalize().multiplyByScalar(u),
  5852. T = i.normalize().multiplyByScalar(u); if (n.magnitude() > p && f > .75) E = i.subtract(n).multiplyByScalar(.5).add(n), a = [{ point: i }, { point: E }, { point: n }];
  5853. else if (i.magnitude() > p && f > 0) E = i.subtract(b).multiplyByScalar(.5).add(b), a = [{ point: i }, { point: E }, { point: n }];
  5854. else { a = [{ point: i }], x = Math.acos(T.normalize().dot(b.normalize())), C = T.cross(b), C.equalsEpsilon(t.ZERO, s.EPSILON6) && (C = t.UNIT_Z); for (var A = h * x, M = x - A, P = M; P > 0; P -= A) S = l.fromQuaternion(c.fromAxisAngle(C, P)), a.push({ point: S.multiplyByVector(b) });
  5855. a.push({ point: n }) } for (var D = o / (a.length - 1), I = 0; I < a.length; ++I) a[I].time = I * D; return y(a) }
  5856. function _(e, r, i, o) { r[0].orientation = f(e.direction, e.up); for (var a, s = r.length - 1, l = 1; s > l; ++l) a = r[l], a.point.negate(R).normalize(R), R.cross(t.UNIT_Z, L).normalize(L), L.cross(R, z), a.orientation = f(R, z, N); return a = r[s], n(i) && n(o) ? a.orientation = f(i, o) : (a.point.negate(R).normalize(R), R.cross(t.UNIT_Z, L).normalize(L), L.cross(R, z), a.orientation = f(R, z, N)), new u(r) }
  5857. function w(e, t, r, i, n) { var o = e.camera,
  5858. a = e.scene2D.projection.getEllipsoid(),
  5859. s = g(o, a, o.position, t, r),
  5860. u = _(o, s.getControlPoints(), i, n),
  5861. c = function(e) { var t = e.time,
  5862. r = u.evaluate(t);
  5863. l.fromQuaternion(r, P), o.position = s.evaluate(t, o.position), o.right = P.getRow(0, o.right), o.up = P.getRow(1, o.up), o.direction = P.getRow(2, o.direction).negate(o.direction) }; return c }
  5864. function C(e, r, i, n, o) { var a, l, u = r.getMaximumRadius(),
  5865. c = e.frustum,
  5866. h = v(c, Math.PI * u, s.PI_OVER_TWO * u),
  5867. d = .5; if (i.z > h) l = .6 * h;
  5868. else { var m = i.subtract(n);
  5869. l = v(c, Math.abs(m.y), Math.abs(m.x)) } var p = n.clone();
  5870. p.z = l; var f = i.clone();
  5871. f.z = l; var g; if (n.z > h) g = i.subtract(n).multiplyByScalar(.5).add(n), a = [{ point: i }, { point: g }, { point: n }];
  5872. else if (i.z > h) g = i.subtract(p).multiplyByScalar(.5).add(p), a = [{ point: i }, { point: g }, { point: n }];
  5873. else { a = [{ point: i }]; var _ = f.subtract(p),
  5874. w = _.magnitude();
  5875. t.normalize(_, _); for (var C = d * w, x = w - C, S = x; S > 0; S -= C) a.push({ point: _.multiplyByScalar(S).add(p) });
  5876. a.push({ point: n }) } for (var E = o / (a.length - 1), b = 0; b < a.length; ++b) a[b].time = b * E; return y(a) }
  5877. function x(e, t, r, i) { t[0].orientation = f(e.direction, e.up); for (var o, a = t.length - 1, s = 1; a > s; ++s) o = t[s], o.orientation = q; return o = t[a], o.orientation = n(r) && n(i) ? f(r, i) : q, new u(t) }
  5878. function S(e, t, r, i, n) { var o = e.camera,
  5879. a = e.scene2D.projection.getEllipsoid(),
  5880. s = C(o, a, o.position.clone(), t, r),
  5881. u = x(o, s.getControlPoints(), i, n),
  5882. c = function(e) { var t = e.time,
  5883. r = u.evaluate(t);
  5884. l.fromQuaternion(r, P), o.position = s.evaluate(t, o.position), o.right = P.getRow(0, o.right), o.up = P.getRow(1, o.up), o.direction = P.getRow(2, o.direction).negate(o.direction) }; return c }
  5885. function E(e, r, i, n, o) { var a = e.camera,
  5886. s = e.scene2D.projection.getEllipsoid(),
  5887. u = a.position.clone();
  5888. u.z = a.frustum.right - a.frustum.left; var c = C(a, s, u, r, i),
  5889. h = c.getControlPoints(),
  5890. d = x(a, h, t.UNIT_Z.negate(), o),
  5891. m = a.position.z,
  5892. p = function(e) { var t = e.time,
  5893. r = d.evaluate(t);
  5894. l.fromQuaternion(r, P), a.position = c.evaluate(t, a.position); var i = a.position.z;
  5895. a.position.z = m, a.right = P.getRow(0, a.right), a.up = P.getRow(1, a.up), a.direction = P.getRow(2, a.direction).negate(a.direction); var n = a.frustum,
  5896. o = n.top / n.right,
  5897. s = .5 * (i - (n.right - n.left));
  5898. n.right += s, n.left -= s, n.top = o * n.right, n.bottom = -n.top }; return p }
  5899. function b(e) { var t = { enableTranslate: e.enableTranslate, enableZoom: e.enableZoom, enableRotate: e.enableRotate, enableTilt: e.enableTilt, enableLook: e.enableLook }; return e.enableTranslate = !1, e.enableZoom = !1, e.enableRotate = !1, e.enableTilt = !1, e.enableLook = !1, t }
  5900. function T(e, t) { e.enableTranslate = t.enableTranslate, e.enableZoom = t.enableZoom, e.enableRotate = t.enableRotate, e.enableTilt = t.enableTilt, e.enableLook = t.enableLook } var A = {},
  5901. M = new t,
  5902. P = new l,
  5903. D = new l,
  5904. I = new t,
  5905. O = new t,
  5906. R = new t,
  5907. L = new t,
  5908. z = new t,
  5909. N = new c,
  5910. F = t.UNIT_Z.negate(),
  5911. B = F.cross(t.UNIT_Y).normalize(),
  5912. V = B.cross(F),
  5913. q = f(F, V),
  5914. k = new t,
  5915. U = new t,
  5916. W = new t; return A.createAnimation = function(r, a) { a = i(a, i.EMPTY_OBJECT); var l = a.destination; if (!n(r)) throw new o("scene is required."); if (!n(l)) throw new o("destination is required."); var u = r.getFrameState(); if (u.mode === m.MORPHING) throw new o("frameState.mode cannot be SceneMode.MORPHING"); var c = a.direction,
  5917. h = a.up,
  5918. d = i(a.duration, 3e3),
  5919. f = r.getScreenSpaceCameraController(),
  5920. v = b(f),
  5921. y = function(e) { var t = function() { "function" == typeof e && e(), T(f, v) }; return t },
  5922. g = y(a.onComplete),
  5923. _ = y(a.onCancel),
  5924. C = u.camera.frustum; if (u.mode === m.SCENE2D) { if (e.equalsEpsilon(u.camera.position, l, s.EPSILON6) && s.equalsEpsilon(Math.max(C.right - C.left, C.top - C.bottom), l.z, s.EPSILON6)) return { duration: 0, onComplete: g, onCancel: _ } } else if (t.equalsEpsilon(l, u.camera.position, s.EPSILON6)) return { duration: 0, onComplete: g, onCancel: _ }; if (0 >= d) { var x = function() { var e = l; if (u.mode === m.SCENE3D ? (n(a.direction) || n(a.up) ? (k = a.direction, U = k.cross(a.up, U).normalize(U)) : (k = e.negate(k).normalize(k), U = k.cross(t.UNIT_Z, U).normalize(U)), W = i(a.up, U.cross(k, W))) : (n(a.direction) || n(a.up) ? (k = a.direction, U = k.cross(a.up, U).normalize(U)) : (k = t.UNIT_Z.negate(k), U = k.cross(t.UNIT_Y, U).normalize(U)), W = i(a.up, U.cross(k, W))), t.clone(e, u.camera.position), t.clone(k, u.camera.direction), t.clone(W, u.camera.up), t.clone(U, u.camera.right), u.mode === m.SCENE2D) { var r = u.camera.position.z,
  5925. o = C.top / C.right,
  5926. s = .5 * (r - (C.right - C.left));
  5927. C.right += s, C.left -= s, C.top = o * C.right, C.bottom = -C.top } "function" == typeof g && g() }; return { duration: 0, onComplete: x, onCancel: _ } } var A; return A = u.mode === m.SCENE3D ? w(u, l, d, c, h) : u.mode === m.SCENE2D ? E(u, l, d, c, h) : S(u, l, d, c, h), { duration: d, easingFunction: p.Easing.Sinusoidal.InOut, startValue: { time: 0 }, stopValue: { time: d }, onUpdate: A, onComplete: g, onCancel: _ } }, A.createAnimationCartographic = function(e, t) { t = i(t, i.EMPTY_OBJECT); var a = t.destination; if (!n(e)) throw new o("scene is required."); if (!n(a)) throw new o("description.destination is required."); var s = e.getFrameState(),
  5928. l = s.scene2D.projection; if (s.mode === m.SCENE3D) { var u = l.getEllipsoid();
  5929. u.cartographicToCartesian(a, M) } else { if (s.mode !== m.COLUMBUS_VIEW && s.mode !== m.SCENE2D) throw new o("frameState.mode cannot be SceneMode.MORPHING");
  5930. l.project(a, M) } var c = r(t); return c.destination = M, this.createAnimation(e, c) }, A.createAnimationExtent = function(e, t) { t = i(t, i.EMPTY_OBJECT); var a = t.destination,
  5931. s = e.getFrameState(); if (!n(s)) throw new o("frameState is required."); if (!n(a)) throw new o("description.destination is required."); if (s.mode === m.MORPHING) throw new o("frameState.mode cannot be SceneMode.MORPHING"); var l = r(t),
  5932. u = s.camera; return u.controller.getExtentCameraCoordinates(a, M), l.destination = M, this.createAnimation(e, l) }, A }), r("Scene/Imagery", ["../Core/defined", "../Core/destroyObject", "./ImageryState"], function(e, t, r) { "use strict"; var i = function(t, i, n, o, a) { if (this.imageryLayer = t, this.x = i, this.y = n, this.level = o, 0 !== o) { var s = 0 | i / 2,
  5933. l = 0 | n / 2,
  5934. u = o - 1;
  5935. this.parent = t.getImageryFromCache(s, l, u) } if (this.state = r.UNLOADED, this.imageUrl = void 0, this.image = void 0, this.texture = void 0, this.referenceCount = 0, !e(a) && t.getImageryProvider().isReady()) { var c = t.getImageryProvider().getTilingScheme();
  5936. a = c.tileXYToExtent(i, n, o) } this.extent = a }; return i.createPlaceholder = function(e) { var t = new i(e, 0, 0, 0); return t.addReference(), t.state = r.PLACEHOLDER, t }, i.prototype.addReference = function() {++this.referenceCount }, i.prototype.releaseReference = function() { return --this.referenceCount, 0 === this.referenceCount ? (this.imageryLayer.removeImageryFromCache(this), e(this.parent) && this.parent.releaseReference(), e(this.image) && e(this.image.destroy) && this.image.destroy(), e(this.texture) && e(this.texture.destroy) && this.texture.destroy(), t(this), 0) : this.referenceCount }, i }), r("Scene/TileImagery", ["../Core/defined", "./ImageryState"], function(e, t) { "use strict"; var r = function(e, t) { this.readyImagery = void 0, this.loadingImagery = e, this.textureCoordinateExtent = t, this.textureTranslationAndScale = void 0 }; return r.prototype.freeResources = function() { e(this.readyImagery) && this.readyImagery.releaseReference(), e(this.loadingImagery) && this.loadingImagery.releaseReference() }, r.prototype.processStateMachine = function(r, i) { var n = this.loadingImagery,
  5937. o = n.imageryLayer; if (n.state === t.UNLOADED && (n.state = t.TRANSITIONING, o._requestImagery(n)), n.state === t.RECEIVED && (n.state = t.TRANSITIONING, o._createTexture(i, n)), n.state === t.TEXTURE_LOADED && (n.state = t.TRANSITIONING, o._reprojectTexture(i, n)), n.state === t.READY) return e(this.readyImagery) && this.readyImagery.releaseReference(), this.readyImagery = this.loadingImagery, this.loadingImagery = void 0, this.textureTranslationAndScale = o._calculateTextureTranslationAndScale(r, this), !0; for (var a = n.parent, s = !1; e(a) && a.state !== t.READY;) s = s || a.state !== t.FAILED && a.state !== t.INVALID, a = a.parent; return this.readyImagery !== a && (e(this.readyImagery) && this.readyImagery.releaseReference(), this.readyImagery = a, e(a) && (a.addReference(), this.textureTranslationAndScale = o._calculateTextureTranslationAndScale(r, this))), s || n.state !== t.FAILED && n.state !== t.INVALID ? !1 : !0 }, r }), r("Scene/TexturePool", ["../Core/defined", "../Core/destroyObject", "../Core/DeveloperError", "../Renderer/PixelDatatype", "../Renderer/PixelFormat", "../Renderer/Texture"], function(e, t, r, i, n, o) { "use strict";
  5938. function a(t, r, i) { return e(s) || (s = function(e, t, r) { this._texture = e, this._textureTypeKey = t, this._pool = r }, Object.keys(o.prototype).forEach(function(e) { s.prototype[e] = function() { var t = this._texture; return t[e].apply(t, arguments) } }), s.prototype.destroy = function() { var t = this._pool._free[this._textureTypeKey];
  5939. e(t) || (t = this._pool._free[this._textureTypeKey] = []), t.length >= 8 ? this._texture.destroy() : t.push(this) }), new s(t, r, i) } var s, l = function() { this._free = {} }; return l.prototype.createTexture2D = function(t, o) { if (!o) throw new r("description is required."); var s = o.source,
  5940. l = e(s) ? s.width : o.width,
  5941. u = e(s) ? s.height : o.height,
  5942. c = +(o.pixelFormat || n.RGBA),
  5943. h = +(o.pixelDatatype || i.UNSIGNED_BYTE),
  5944. d = +(o.preMultiplyAlpha || c === n.RGB || c === n.LUMINANCE),
  5945. m = JSON.stringify([l, u, c, h, d]),
  5946. p = this._free[m]; if (e(p) && p.length > 0) { var f = p.pop(); return e(s) && f.copyFrom(s), f } return a(t.createTexture2D(o), m, this) }, l.prototype.isDestroyed = function() { return !1 }, l.prototype.destroy = function() { var e = this._free; return Object.keys(e).forEach(function(t) { e[t].forEach(function(e) { e._texture.destroy() }) }), t(this) }, l }), r("Shaders/ReprojectWebMercatorFS", [], function() { "use strict"; return "uniform sampler2D u_texture;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\ngl_FragColor = texture2D(u_texture, v_textureCoordinates);\n}\n" }), r("Shaders/ReprojectWebMercatorVS", [], function() { "use strict"; return "attribute vec4 position;\nuniform vec2 u_textureDimensions;\nuniform float u_northLatitude;\nuniform float u_southLatitude;\nuniform float u_southMercatorYHigh;\nuniform float u_southMercatorYLow;\nuniform float u_oneOverMercatorHeight;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\nfloat currentLatitude = mix(u_southLatitude, u_northLatitude, position.y);\nfloat fraction = czm_latitudeToWebMercatorFraction(currentLatitude, u_southMercatorYLow, u_southMercatorYHigh, u_oneOverMercatorHeight);\nv_textureCoordinates = vec2(position.x, fraction);\ngl_Position = czm_viewportOrthographic * (position * vec4(u_textureDimensions, 1.0, 1.0));\n}\n" }), r("Scene/ImageryLayer", ["../Core/defaultValue", "../Core/defined", "../Core/destroyObject", "../Core/BoundingRectangle", "../Core/ComponentDatatype", "../Core/Cartesian2", "../Core/Cartesian4", "../Core/Color", "../Core/Extent", "../Core/FeatureDetection", "../Core/Math", "../Core/PrimitiveType", "../Core/Geometry", "../Core/GeometryAttribute", "../Renderer/BufferUsage", "../Renderer/MipmapHint", "../Renderer/TextureMagnificationFilter", "../Renderer/TextureMinificationFilter", "../Renderer/TextureWrap", "../Renderer/ClearCommand", "./GeographicTilingScheme", "./Imagery", "./TileProviderError", "./ImageryState", "./TileImagery", "./TerrainProvider", "./TexturePool", "../ThirdParty/when", "../Shaders/ReprojectWebMercatorFS", "../Shaders/ReprojectWebMercatorVS"], function(e, t, r, i, n, o, a, s, l, u, c, h, d, m, p, f, v, y, g, _, w, C, x, S, E, b, T, A, M, P) {
  5947. "use strict";
  5948. function D(e, t, r) { return JSON.stringify([e, t, r]) }
  5949. function I(r, o, a, l) {
  5950. var u = o.cache.imageryLayer_reproject;
  5951. if (!t(u)) { u = o.cache.imageryLayer_reproject = { framebuffer: void 0, vertexArray: void 0, shaderProgram: void 0, renderState: void 0, sampler: void 0, destroy: function() { t(this.framebuffer) && this.framebuffer.destroy(), t(this.vertexArray) && this.vertexArray.destroy(), t(this.shaderProgram) && this.shaderProgram.release() } }, u.framebuffer = o.createFramebuffer(), u.framebuffer.destroyAttachments = !1; for (var c = new Array(131072), w = 0, C = 0; 256 > C; ++C)
  5952. for (var x = C / 255, S = 0; 256 > S; ++S) { var E = S / 255;
  5953. c[w++] = E, c[w++] = x }
  5954. var T = new d({ attributes: { position: new m({ componentDatatype: n.FLOAT, componentsPerAttribute: 2, values: c }) }, indices: b.getRegularGridIndices(256, 256), primitiveType: h.TRIANGLES }),
  5955. A = { position: 0 };
  5956. u.vertexArray = o.createVertexArrayFromGeometry({ geometry: T, attributeIndices: A, bufferUsage: p.STATIC_DRAW }), u.shaderProgram = o.getShaderCache().getShaderProgram(P, M, A); var D = o.getMaximumTextureFilterAnisotropy();
  5957. u.sampler = o.createSampler({ wrapS: g.CLAMP, wrapT: g.CLAMP, minificationFilter: y.LINEAR, magnificationFilter: v.LINEAR, maximumAnisotropy: Math.min(D, e(r._maximumAnisotropy, D)) }) } a.setSampler(u.sampler);
  5958. var I = a.getWidth(),
  5959. O = a.getHeight();
  5960. L.textureDimensions.x = I, L.textureDimensions.y = O, L.texture = a, L.northLatitude = l.north, L.southLatitude = l.south;
  5961. var R = Math.sin(l.south),
  5962. N = .5 * Math.log((1 + R) / (1 - R));
  5963. z[0] = N, L.southMercatorYHigh = z[0], L.southMercatorYLow = N - z[0], R = Math.sin(l.north);
  5964. var F = .5 * Math.log((1 + R) / (1 - R));
  5965. L.oneOverMercatorHeight = 1 / (F - N);
  5966. var B = r._texturePool.createTexture2D(o, { width: I, height: O, pixelFormat: a.getPixelFormat(), pixelDatatype: a.getPixelDatatype(), preMultiplyAlpha: a.getPreMultiplyAlpha() });
  5967. B.generateMipmap(f.NICEST), u.framebuffer.setColorTexture(B);
  5968. var V = new _;
  5969. return V.color = s.BLACK, V.framebuffer = u.framebuffer, V.execute(o), t(u.renderState) && u.renderState.viewport.width === I && u.renderState.viewport.height === O || (u.renderState = o.createRenderState({ viewport: new i(0, 0, I, O) })), o.draw({ framebuffer: u.framebuffer, shaderProgram: u.shaderProgram, renderState: u.renderState, primitiveType: h.TRIANGLES, vertexArray: u.vertexArray, uniformMap: L }), B
  5970. }
  5971. function O(e, t, r) { var i = e._imageryProvider,
  5972. n = i.getTilingScheme(),
  5973. o = n.getEllipsoid(),
  5974. a = Math.cos(r),
  5975. s = n.getExtent(),
  5976. l = o.getMaximumRadius() * (s.east - s.west) * a / (i.getTileWidth() * n.getNumberOfXTilesAtLevel(0)),
  5977. u = l / t,
  5978. c = Math.log(u) / Math.log(2),
  5979. h = Math.round(c); return 0 | h }
  5980. var R = function N(t, r) { this._imageryProvider = t, r = e(r, {}), this.alpha = e(r.alpha, e(t.defaultAlpha, 1)), this.brightness = e(r.brightness, e(t.defaultBrightness, N.DEFAULT_BRIGHTNESS)), this.contrast = e(r.contrast, e(t.defaultContrast, N.DEFAULT_CONTRAST)), this.hue = e(r.hue, e(t.defaultHue, N.DEFAULT_HUE)), this.saturation = e(r.saturation, e(t.defaultSaturation, N.DEFAULT_SATURATION)), this.gamma = e(r.gamma, e(t.defaultGamma, N.DEFAULT_GAMMA)), this.show = e(r.show, !0), this._minimumTerrainLevel = r.minimumTerrainLevel, this._maximumTerrainLevel = r.maximumTerrainLevel, this._extent = e(r.extent, l.MAX_VALUE), this._maximumAnisotropy = r.maximumAnisotropy, this._imageryCache = {}, this._texturePool = new T, this._skeletonPlaceholder = new E(C.createPlaceholder(this)), this._show = !1, this._layerIndex = -1, this._isBaseLayer = !1, this._requestImageError = void 0 };
  5981. R.DEFAULT_BRIGHTNESS = 1, R.DEFAULT_CONTRAST = 1, R.DEFAULT_HUE = 0, R.DEFAULT_SATURATION = 1, R.DEFAULT_GAMMA = 1, R.prototype.getImageryProvider = function() { return this._imageryProvider }, R.prototype.getExtent = function() { return this._extent }, R.prototype.isBaseLayer = function() { return this._isBaseLayer }, R.prototype.isDestroyed = function() { return !1 }, R.prototype.destroy = function() { return this._texturePool = this._texturePool && this._texturePool.destroy(), r(this) }, R.prototype._createTileImagerySkeletons = function(e, r, i) { if (t(this._minimumTerrainLevel) && e.level < this._minimumTerrainLevel) return !1; if (t(this._maximumTerrainLevel) && e.level > this._maximumTerrainLevel) return !1; var n = this._imageryProvider; if (t(i) || (i = e.imagery.length), !n.isReady()) return this._skeletonPlaceholder.loadingImagery.addReference(), e.imagery.splice(i, 0, this._skeletonPlaceholder), !0; var o = e.extent.intersectWith(n.getExtent()); if (o = o.intersectWith(this._extent), o.east <= o.west || o.north <= o.south) { if (!this.isBaseLayer()) return !1; var s = n.getExtent().intersectWith(this._extent),
  5982. l = e.extent;
  5983. l.south >= s.north ? o.north = o.south = s.north : l.north <= s.south && (o.north = o.south = s.south), l.west >= s.east ? o.west = o.east = s.east : l.east <= s.west && (o.west = o.east = s.west) } var u = 0;
  5984. o.south > 0 ? u = o.south : o.north < 0 && (u = o.north); var c = 1,
  5985. h = c * r.getLevelMaximumGeometricError(e.level),
  5986. d = O(this, h, u);
  5987. d = Math.max(0, d); var m = n.getMaximumLevel(); if (d > m && (d = m), t(n.getMinimumLevel)) { var p = n.getMinimumLevel();
  5988. p > d && (d = p) } var f = n.getTilingScheme(),
  5989. v = f.positionToTileXY(o.getNorthwest(), d),
  5990. y = f.positionToTileXY(o.getSoutheast(), d),
  5991. g = (e.extent.north - e.extent.south) / 512,
  5992. _ = (e.extent.east - e.extent.west) / 512,
  5993. w = f.tileXYToExtent(v.x, v.y, d);
  5994. Math.abs(w.south - e.extent.north) < _ && v.y < y.y && ++v.y, Math.abs(w.east - e.extent.west) < g && v.x < y.x && ++v.x; var C = f.tileXYToExtent(y.x, y.y, d);
  5995. Math.abs(C.north - e.extent.south) < _ && y.y > v.y && --y.y, Math.abs(C.west - e.extent.east) < g && y.x > v.x && --y.x; var x, S, b = e.extent,
  5996. T = f.tileXYToExtent(v.x, v.y, d),
  5997. A = 0,
  5998. M = 1;!this.isBaseLayer() && Math.abs(T.west - e.extent.west) >= g && (A = Math.min(1, (T.west - b.west) / (b.east - b.west))), !this.isBaseLayer() && Math.abs(T.north - e.extent.north) >= _ && (M = Math.max(0, (T.north - b.south) / (b.north - b.south))); for (var P = M, D = v.x; D <= y.x; D++) { x = A, T = f.tileXYToExtent(D, v.y, d), A = Math.min(1, (T.east - b.west) / (b.east - b.west)), D === y.x && (this.isBaseLayer() || Math.abs(T.east - e.extent.east) < g) && (A = 1), M = P; for (var I = v.y; I <= y.y; I++) { S = M, T = f.tileXYToExtent(D, I, d), M = Math.max(0, (T.south - b.south) / (b.north - b.south)), I === y.y && (this.isBaseLayer() || Math.abs(T.south - e.extent.south) < _) && (M = 0); var R = new a(x, M, A, S),
  5999. L = this.getImageryFromCache(D, I, d, T);
  6000. e.imagery.splice(i, 0, new E(L, R)), ++i } } return !0 }, R.prototype._calculateTextureTranslationAndScale = function(e, t) { var r = t.readyImagery.extent,
  6001. i = e.extent,
  6002. n = i.east - i.west,
  6003. o = i.north - i.south,
  6004. s = n / (r.east - r.west),
  6005. l = o / (r.north - r.south); return new a(s * (i.west - r.west) / n, l * (i.south - r.south) / o, s, l) }, R.prototype._requestImagery = function(e) {
  6006. function r(r) { return t(r) ? (e.image = r, e.state = S.RECEIVED, x.handleSuccess(a._requestImageError), void 0) : i() }
  6007. function i() { e.state = S.FAILED; var t = "Failed to obtain image tile X: " + e.x + " Y: " + e.y + " Level: " + e.level + ".";
  6008. a._requestImageError = x.handleError(a._requestImageError, o, o.getErrorEvent(), t, e.x, e.y, e.level, n) }
  6009. function n() { e.state = S.TRANSITIONING; var n = o.requestImage(e.x, e.y, e.level); return t(n) ? (A(n, r, i), void 0) : (e.state = S.UNLOADED, void 0) } var o = this._imageryProvider,
  6010. a = this;
  6011. n() }, R.prototype._createTexture = function(e, r) { var i = this._imageryProvider; if (t(i.getTileDiscardPolicy)) { var n = i.getTileDiscardPolicy(); if (t(n)) { if (!n.isReady()) return r.state = S.RECEIVED, void 0; if (n.shouldDiscardImage(r.image)) return r.state = S.INVALID, void 0 } } var o = this._texturePool.createTexture2D(e, { source: r.image });
  6012. r.texture = o, r.image = void 0, r.state = S.TEXTURE_LOADED }, R.prototype._reprojectTexture = function(r, i) { var n = i.texture,
  6013. o = i.extent; if (!(this._imageryProvider.getTilingScheme() instanceof w) && (o.east - o.west) / n.getWidth() > 1e-5) { var a = I(this, r, n, i.extent);
  6014. n.destroy(), i.texture = n = a } if (c.isPowerOfTwo(n.getWidth()) && c.isPowerOfTwo(n.getHeight())) { var s = r.cache.imageryLayer_mipmapSampler; if (!t(s)) { var l = r.getMaximumTextureFilterAnisotropy();
  6015. s = r.cache.imageryLayer_mipmapSampler = r.createSampler({ wrapS: g.CLAMP, wrapT: g.CLAMP, minificationFilter: y.LINEAR_MIPMAP_LINEAR, magnificationFilter: v.LINEAR, maximumAnisotropy: Math.min(l, e(this._maximumAnisotropy, l)) }) } n.generateMipmap(f.NICEST), n.setSampler(s) } else { var u = r.cache.imageryLayer_nonMipmapSampler;
  6016. t(u) || (u = r.cache.imageryLayer_nonMipmapSampler = r.createSampler({ wrapS: g.CLAMP, wrapT: g.CLAMP, minificationFilter: y.LINEAR, magnificationFilter: v.LINEAR })), n.setSampler(u) } i.state = S.READY }, R.prototype.getImageryFromCache = function(e, r, i, n) { var o = D(e, r, i),
  6017. a = this._imageryCache[o]; return t(a) || (a = new C(this, e, r, i, n), this._imageryCache[o] = a), a.addReference(), a }, R.prototype.removeImageryFromCache = function(e) { var t = D(e.x, e.y, e.level);
  6018. delete this._imageryCache[t] };
  6019. var L = { u_textureDimensions: function() { return this.textureDimensions }, u_texture: function() { return this.texture }, u_northLatitude: function() { return this.northLatitude }, u_southLatitude: function() { return this.southLatitude }, u_southMercatorYLow: function() { return this.southMercatorYLow }, u_southMercatorYHigh: function() { return this.southMercatorYHigh }, u_oneOverMercatorHeight: function() { return this.oneOverMercatorHeight }, textureDimensions: new o, texture: void 0, northLatitude: 0, southLatitude: 0, southMercatorYHigh: 0, southMercatorYLow: 0, oneOverMercatorHeight: 0 },
  6020. z = u.supportsTypedArrays() ? new Float32Array(1) : void 0;
  6021. return R
  6022. }), r("Scene/TileReplacementQueue", ["../Core/defined", "./ImageryState", "./TerrainState"], function(e, t, r) { "use strict";
  6023. function i(e, t) { var r = t.replacementPrevious,
  6024. i = t.replacementNext;
  6025. t === e._lastBeforeStartOfFrame && (e._lastBeforeStartOfFrame = i), t === e.head ? e.head = i : r.replacementNext = i, t === e.tail ? e.tail = r : i.replacementPrevious = r, t.replacementPrevious = void 0, t.replacementNext = void 0, --e.count } var n = function() { this.head = void 0, this.tail = void 0, this.count = 0, this._lastBeforeStartOfFrame = void 0 }; return n.prototype.markStartOfRenderFrame = function() { this._lastBeforeStartOfFrame = this.head }, n.prototype.trimTiles = function(n) { for (var o = this.tail, a = !0; a && e(this._lastBeforeStartOfFrame) && this.count > n && e(o);) { a = o !== this._lastBeforeStartOfFrame; for (var s = o.replacementPrevious, l = o.loadedTerrain, u = e(l) && (l.state === r.RECEIVING || l.state === r.TRANSFORMING), c = o.upsampledTerrain, h = e(c) && (c.state === r.RECEIVING || c.state === r.TRANSFORMING), d = !u && !h, m = o.imagery, p = 0, f = m.length; d && f > p; ++p) { var v = m[p];
  6026. d = !e(v.loadingImagery) || v.loadingImagery.state !== t.TRANSITIONING } d && (o.freeResources(), i(this, o)), o = s } }, n.prototype.markTileRendered = function(t) { var r = this.head; return r === t ? (t === this._lastBeforeStartOfFrame && (this._lastBeforeStartOfFrame = t.replacementNext), void 0) : (++this.count, e(r) ? ((e(t.replacementPrevious) || e(t.replacementNext)) && i(this, t), t.replacementPrevious = void 0, t.replacementNext = r, r.replacementPrevious = t, this.head = t, void 0) : (t.replacementPrevious = void 0, t.replacementNext = void 0, this.head = t, this.tail = t, void 0)) }, n }), r("Scene/CentralBodySurface", ["../Core/defaultValue", "../Core/defined", "../Core/destroyObject", "../Core/BoundingSphere", "../Core/Cartesian2", "../Core/Cartesian3", "../Core/Cartesian4", "../Core/FeatureDetection", "../Core/DeveloperError", "../Core/Ellipsoid", "../Core/EllipsoidalOccluder", "../Core/Intersect", "../Core/Matrix4", "../Core/PrimitiveType", "../Core/Queue", "../Core/WebMercatorProjection", "../Renderer/DrawCommand", "./ImageryLayer", "./ImageryState", "./SceneMode", "./TerrainProvider", "./TileReplacementQueue", "./TileState", "../ThirdParty/when"], function(e, t, r, i, n, o, a, s, l, u, c, h, d, m, p, f, v, y, g, _, w, C, x, S) { "use strict";
  6027. function E(e, r) { var i = e.loadingImagery;
  6028. t(i) || (i = e.readyImagery); var n = r.loadingImagery; return t(n) || (n = r.readyImagery), i.imageryLayer._layerIndex - n.imageryLayer._layerIndex }
  6029. function b(e) { if (e._imageryLayerCollection._update(), e._layerOrderChanged) { e._layerOrderChanged = !1; for (var r = e._tileReplacementQueue.head; t(r);) r.imagery.sort(E), r = r.replacementNext } }
  6030. function T(e, r, i) { var n = e._debug; if (!n.suspendLodUpdate) { var o, a, s = e._tilesToRenderByTextureCount; for (o = 0, a = s.length; a > o; ++o) { var l = s[o];
  6031. t(l) && (l.length = 0) } var u = e._tileTraversalQueue; if (u.clear(), n.maxDepth = 0, n.tilesVisited = 0, n.tilesCulled = 0, n.tilesRendered = 0, n.texturesRendered = 0, n.tilesWaitingForChildren = 0, e._tileLoadQueue.length = 0, e._tileReplacementQueue.markStartOfRenderFrame(), !t(e._levelZeroTiles)) { if (!e._terrainProvider.isReady()) return; var c = e._terrainProvider.getTilingScheme();
  6032. e._levelZeroTiles = c.createLevelZeroTiles() } var h = i.camera.getPositionWC(),
  6033. d = e._terrainProvider.getTilingScheme().getEllipsoid(),
  6034. m = d.cartesianToCartographic(h);
  6035. e._ellipsoidalOccluder.setCameraPosition(h); var p, f = e._levelZeroTiles; for (o = 0, a = f.length; a > o; ++o) p = f[o], e._tileReplacementQueue.markTileRendered(p), p.state !== x.READY && R(e, p), p.isRenderable && D(e, i, p) ? u.enqueue(p) : (++n.tilesCulled, p.isRenderable || ++n.tilesWaitingForChildren); for (; t(p = u.dequeue());)
  6036. if (++n.tilesVisited, e._tileReplacementQueue.markTileRendered(p), p.level > n.maxDepth && (n.maxDepth = p.level), A(e, r, i, h, m, p) < e._maxScreenSpaceError) P(e, p);
  6037. else if (O(e, i, p)) { var v = p.children; for (o = 0, a = v.length; a > o; ++o) D(e, i, v[o]) ? u.enqueue(v[o]) : ++n.tilesCulled } else ++n.tilesWaitingForChildren, P(e, p);
  6038. n.enableDebugOutput && (n.tilesVisited !== n.lastTilesVisited || n.tilesRendered !== n.lastTilesRendered || n.texturesRendered !== n.lastTexturesRendered || n.tilesCulled !== n.lastTilesCulled || n.maxDepth !== n.lastMaxDepth || n.tilesWaitingForChildren !== n.lastTilesWaitingForChildren) && (console.log("Visited " + n.tilesVisited + ", Rendered: " + n.tilesRendered + ", Textures: " + n.texturesRendered + ", Culled: " + n.tilesCulled + ", Max Depth: " + n.maxDepth + ", Waiting for children: " + n.tilesWaitingForChildren), n.lastTilesVisited = n.tilesVisited, n.lastTilesRendered = n.tilesRendered, n.lastTexturesRendered = n.texturesRendered, n.lastTilesCulled = n.tilesCulled, n.lastMaxDepth = n.maxDepth, n.lastTilesWaitingForChildren = n.tilesWaitingForChildren) } }
  6039. function A(e, t, r, i, n, o) { if (r.mode === _.SCENE2D) return M(e, t, r, i, n, o); var a = o.extent,
  6040. s = 1; if (r.mode === _.SCENE3D) { var l = 0;
  6041. a.south > 0 ? l = a.south : a.north < 0 && (l = a.north), s = Math.cos(l) } var u = s * e._terrainProvider.getLevelMaximumGeometricError(o.level),
  6042. c = Math.sqrt(I(r, i, n, o));
  6043. o.distance = c; var h = t.getCanvas(),
  6044. d = h.clientHeight,
  6045. m = r.camera,
  6046. p = m.frustum,
  6047. f = p.fovy; return u * d / (2 * c * Math.tan(.5 * f)) }
  6048. function M(e, t, r, i, n, o) { var a = r.camera,
  6049. s = a.frustum,
  6050. l = t.getCanvas(),
  6051. u = l.clientWidth,
  6052. c = l.clientHeight,
  6053. h = e._terrainProvider.getLevelMaximumGeometricError(o.level),
  6054. d = Math.max(s.top - s.bottom, s.right - s.left) / Math.max(u, c); return h / d }
  6055. function P(e, r) { for (var i = 0, n = r.imagery, o = 0, a = n.length; a > o; ++o) { var s = n[o];
  6056. t(s.readyImagery) && 0 !== s.readyImagery.imageryLayer.alpha && ++i } var l = e._tilesToRenderByTextureCount[i];
  6057. t(l) || (l = [], e._tilesToRenderByTextureCount[i] = l), l.push(r); var u = e._debug;++u.tilesRendered, u.texturesRendered += i }
  6058. function D(e, r, n) { var a = r.cullingVolume,
  6059. s = n.boundingSphere3D; if (r.mode !== _.SCENE3D && (s = k, i.fromExtentWithHeights2D(n.extent, r.scene2D.projection, n.minimumHeight, n.maximumHeight, s), s.center = new o(s.center.z, s.center.x, s.center.y), r.mode === _.MORPHING && (s = i.union(n.boundingSphere3D, s, s))), a.getVisibility(s) === h.OUTSIDE) return !1; if (r.mode === _.SCENE3D) { var l = n.occludeePointInScaledSpace; return t(l) ? e._ellipsoidalOccluder.isScaledSpacePointVisible(l) : !0 } return !0 }
  6060. function I(e, t, r, i) { var n = i.southwestCornerCartesian,
  6061. a = i.northeastCornerCartesian,
  6062. s = i.westNormal,
  6063. l = i.southNormal,
  6064. u = i.eastNormal,
  6065. c = i.northNormal,
  6066. h = i.maximumHeight;
  6067. e.mode !== _.SCENE3D && (n = e.scene2D.projection.project(i.extent.getSouthwest(), U), n.z = n.y, n.y = n.x, n.x = 0, a = e.scene2D.projection.project(i.extent.getNortheast(), W), a.z = a.y, a.y = a.x, a.x = 0, s = G, u = o.UNIT_Y, l = H, c = o.UNIT_Z, h = 0); var d, m = t.subtract(n, j),
  6068. p = m.dot(s),
  6069. f = m.dot(l),
  6070. v = t.subtract(a, j),
  6071. y = v.dot(u),
  6072. g = v.dot(c);
  6073. d = e.mode === _.SCENE3D ? r.height : t.x; var w = d - h,
  6074. C = 0; return p > 0 ? C += p * p : y > 0 && (C += y * y), f > 0 ? C += f * f : g > 0 && (C += g * g), w > 0 && (C += w * w), C }
  6075. function O(e, t, r) { for (var i = !0, n = r.getChildren(), o = 0, a = n.length; a > o; ++o) { var s = n[o];
  6076. e._tileReplacementQueue.markTileRendered(s), s.state !== x.READY && R(e, s), s.isRenderable || (i = !1) } return i }
  6077. function R(e, t) { e._tileLoadQueue.push(t) }
  6078. function L(e, t) { var r = e._tileLoadQueue,
  6079. i = e._terrainProvider,
  6080. n = e._imageryLayerCollection; if (0 !== r.length) { e._tileReplacementQueue.trimTiles(e._tileCacheSize); for (var o = Date.now(), a = e._loadQueueTimeSlice, s = o + a, l = r.length - 1, u = l; u >= 0; --u) { var c = r[u]; if (e._tileReplacementQueue.markTileRendered(c), c.processStateMachine(t, i, n), Date.now() >= s) break } } }
  6081. function z(e, t) { return e.distance - t.distance }
  6082. function N() { return { u_center3D: function() { return this.center3D }, u_tileExtent: function() { return this.tileExtent }, u_modifiedModelView: function() { return this.modifiedModelView }, u_dayTextures: function() { return this.dayTextures }, u_dayTextureTranslationAndScale: function() { return this.dayTextureTranslationAndScale }, u_dayTextureTexCoordsExtent: function() { return this.dayTextureTexCoordsExtent }, u_dayTextureAlpha: function() { return this.dayTextureAlpha }, u_dayTextureBrightness: function() { return this.dayTextureBrightness }, u_dayTextureContrast: function() { return this.dayTextureContrast }, u_dayTextureHue: function() { return this.dayTextureHue }, u_dayTextureSaturation: function() { return this.dayTextureSaturation }, u_dayTextureOneOverGamma: function() { return this.dayTextureOneOverGamma }, u_dayIntensity: function() { return this.dayIntensity }, u_southAndNorthLatitude: function() { return this.southAndNorthLatitude }, u_southMercatorYLowAndHighAndOneOverHeight: function() { return this.southMercatorYLowAndHighAndOneOverHeight }, u_waterMask: function() { return this.waterMask }, u_waterMaskTranslationAndScale: function() { return this.waterMaskTranslationAndScale }, center3D: void 0, modifiedModelView: new d, tileExtent: new a, dayTextures: [], dayTextureTranslationAndScale: [], dayTextureTexCoordsExtent: [], dayTextureAlpha: [], dayTextureBrightness: [], dayTextureContrast: [], dayTextureHue: [], dayTextureSaturation: [], dayTextureOneOverGamma: [], dayIntensity: 0, southAndNorthLatitude: new n, southMercatorYLowAndHighAndOneOverHeight: new o, waterMask: void 0, waterMaskTranslationAndScale: new a } }
  6083. function F(e, t) { for (var r in t) t.hasOwnProperty(r) && (e[r] = t[r]) }
  6084. function B(e, r, n, s, l, u, c, h) { for (var p = n.camera.getViewMatrix(), w = r.getMaximumTextureImageUnits(), C = e._tileCommands, x = e._tileCommandUniformMaps, S = -1, E = e._tilesToRenderByTextureCount, b = 0, T = E.length; T > b; ++b) { var A = E[b]; if (t(A) && 0 !== A.length) { A.sort(z); for (var M = 0, P = A.length; P > M; M++) { var D = A[M],
  6085. I = D.center,
  6086. O = Z,
  6087. R = 0,
  6088. L = 0,
  6089. B = 0,
  6090. q = 0,
  6091. k = 0; if (n.mode !== _.SCENE3D) { var U = l.project(D.extent.getSouthwest()),
  6092. W = l.project(D.extent.getNortheast()); if (O.x = U.x, O.y = U.y, O.z = W.x, O.w = W.y, n.mode !== _.MORPHING && (I = K, I.x = 0, I.y = .5 * (O.z + O.x), I.z = .5 * (O.w + O.y), O.x -= I.y, O.y -= I.z, O.z -= I.y, O.w -= I.z), l instanceof f) { R = D.extent.south, L = D.extent.north; var G = f.geodeticLatitudeToMercatorAngle(R),
  6093. H = f.geodeticLatitudeToMercatorAngle(L);
  6094. Y[0] = G, B = Y[0], q = G - Y[0], k = 1 / (H - G) } } var j = J;
  6095. j.x = I.x, j.y = I.y, j.z = I.z, j.w = 1, d.multiplyByVector(p, j, j), p.setColumn(3, j, X); var Q = D.imagery,
  6096. $ = 0,
  6097. et = Q.length;
  6098. do { var tt = 0;++S; var rt = C[S];
  6099. t(rt) || (rt = new v, rt.owner = D, rt.cull = !1, C[S] = rt, x[S] = N()), rt.owner = D, rt.debugShowBoundingVolume = D === e._debug.boundingSphereTile; var it = x[S];
  6100. F(it, u), it.center3D = D.center, a.clone(O, it.tileExtent), it.southAndNorthLatitude.x = R, it.southAndNorthLatitude.y = L, it.southMercatorYLowAndHighAndOneOverHeight.x = q, it.southMercatorYLowAndHighAndOneOverHeight.y = B, it.southMercatorYLowAndHighAndOneOverHeight.z = k, d.clone(X, it.modifiedModelView); for (var nt = !1, ot = !1, at = !1, st = !1, lt = !1, ut = !1; w > tt && et > $;) { var ct = Q[$],
  6101. ht = ct.readyImagery; if (++$, t(ht) && ht.state === g.READY && 0 !== ht.imageryLayer.alpha) { var dt = ht.imageryLayer;
  6102. t(ct.textureTranslationAndScale) || (ct.textureTranslationAndScale = dt._calculateTextureTranslationAndScale(D, ct)), it.dayTextures[tt] = ht.texture, it.dayTextureTranslationAndScale[tt] = ct.textureTranslationAndScale, it.dayTextureTexCoordsExtent[tt] = ct.textureCoordinateExtent, it.dayTextureAlpha[tt] = "function" == typeof dt.alpha ? dt.alpha(n, dt, ht.x, ht.y, ht.level) : dt.alpha, ut = ut || 1 !== it.dayTextureAlpha[tt], it.dayTextureBrightness[tt] = "function" == typeof dt.brightness ? dt.brightness(n, dt, ht.x, ht.y, ht.level) : dt.brightness, nt = nt || it.dayTextureBrightness[tt] !== y.DEFAULT_BRIGHTNESS, it.dayTextureContrast[tt] = "function" == typeof dt.contrast ? dt.contrast(n, dt, ht.x, ht.y, ht.level) : dt.contrast, ot = ot || it.dayTextureContrast[tt] !== y.DEFAULT_CONTRAST, it.dayTextureHue[tt] = "function" == typeof dt.hue ? dt.hue(n, dt, ht.x, ht.y, ht.level) : dt.hue, at = at || it.dayTextureHue[tt] !== y.DEFAULT_HUE, it.dayTextureSaturation[tt] = "function" == typeof dt.saturation ? dt.saturation(n, dt, ht.x, ht.y, ht.level) : dt.saturation, st = st || it.dayTextureSaturation[tt] !== y.DEFAULT_SATURATION, it.dayTextureOneOverGamma[tt] = "function" == typeof dt.gamma ? 1 / dt.gamma(n, dt, ht.x, ht.y, ht.level) : 1 / dt.gamma, lt = lt || it.dayTextureOneOverGamma[tt] !== 1 / y.DEFAULT_GAMMA, ++tt } } it.dayTextures.length = tt, it.waterMask = D.waterMaskTexture, a.clone(D.waterMaskTranslationAndScale, it.waterMaskTranslationAndScale), c.push(rt), rt.shaderProgram = s.getShaderProgram(r, b, nt, ot, at, st, lt, ut), rt.renderState = h, rt.primitiveType = m.TRIANGLES, rt.vertexArray = D.vertexArray, rt.uniformMap = it, e._debug.wireframe && (V(r, e, D), t(D.wireframeVertexArray) && (rt.vertexArray = D.wireframeVertexArray, rt.primitiveType = m.LINES)); var mt = D.boundingSphere3D;
  6103. n.mode !== _.SCENE3D && (mt = i.fromExtentWithHeights2D(D.extent, n.scene2D.projection, D.minimumHeight, D.maximumHeight), mt.center = new o(mt.center.z, mt.center.x, mt.center.y), n.mode === _.MORPHING && (mt = i.union(D.boundingSphere3D, mt, mt))), rt.boundingVolume = mt } while (et > $) } } } C.length = Math.max(0, S + 1) }
  6104. function V(e, r, i) { if (!t(i.wireframeVertexArray) && !t(i.meshForWireframePromise) && (i.meshForWireframePromise = i.terrainData.createMesh(r._terrainProvider.getTilingScheme(), i.x, i.y, i.level), t(i.meshForWireframePromise))) { var n = i.vertexArray;
  6105. S(i.meshForWireframePromise, function(t) { i.vertexArray === n && (i.wireframeVertexArray = w.createWireframeVertexArray(e, i.vertexArray, t)), i.meshForWireframePromise = void 0 }) } } var q = function(r) { if (!t(r.terrainProvider)) throw new l("description.terrainProvider is required."); if (!t(r.imageryLayerCollection)) throw new l("description.imageryLayerCollection is required.");
  6106. this._terrainProvider = r.terrainProvider, this._imageryLayerCollection = r.imageryLayerCollection, this._maxScreenSpaceError = e(r.maxScreenSpaceError, 2), this._imageryLayerCollection.layerAdded.addEventListener(q.prototype._onLayerAdded, this), this._imageryLayerCollection.layerRemoved.addEventListener(q.prototype._onLayerRemoved, this), this._imageryLayerCollection.layerMoved.addEventListener(q.prototype._onLayerMoved, this), this._imageryLayerCollection.layerShownOrHidden.addEventListener(q.prototype._onLayerShownOrHidden, this), this._layerOrderChanged = !1; var i = this._terrainProvider.getTilingScheme();
  6107. this._levelZeroTiles = void 0, this._tilesToRenderByTextureCount = [], this._tileCommands = [], this._tileCommandUniformMaps = [], this._tileTraversalQueue = new p, this._tileLoadQueue = [], this._tileReplacementQueue = new C, this._tileCacheSize = 100, this._loadQueueTimeSlice = 5; var n = i.getEllipsoid();
  6108. this._ellipsoidalOccluder = new c(n, o.ZERO), this._debug = { enableDebugOutput: !1, wireframe: !1, boundingSphereTile: void 0, maxDepth: 0, tilesVisited: 0, tilesCulled: 0, tilesRendered: 0, texturesRendered: 0, tilesWaitingForChildren: 0, lastMaxDepth: -1, lastTilesVisited: -1, lastTilesCulled: -1, lastTilesRendered: -1, lastTexturesRendered: -1, lastTilesWaitingForChildren: -1, suspendLodUpdate: !1 } };
  6109. q.prototype.update = function(e, t, r, i, n, o, a) { b(this), T(this, e, t), L(this, e, t), B(this, e, t, n, a, i, r, o) }, q.prototype.getTerrainProvider = function() { return this._terrainProvider }, q.prototype.setTerrainProvider = function(e) { if (this._terrainProvider !== e) { if (!t(e)) throw new l("terrainProvider is required.");
  6110. this._terrainProvider = e; var r = this._tileReplacementQueue;
  6111. r.head = void 0, r.tail = void 0, r.count = 0; var i = this._levelZeroTiles; if (t(i))
  6112. for (var n = 0; n < i.length; ++n) i[n].freeResources();
  6113. this._levelZeroTiles = void 0 } }, q.prototype._onLayerAdded = function(e) { if (t(this._levelZeroTiles) && e.show) { for (var r = this._tileReplacementQueue.head; t(r);) e._createTileImagerySkeletons(r, this._terrainProvider) && (r.state = x.LOADING), r = r.replacementNext;
  6114. this._layerOrderChanged = !0 } }, q.prototype._onLayerRemoved = function(e) { if (t(this._levelZeroTiles))
  6115. for (var r = this._tileReplacementQueue.head; t(r);) { for (var i = r.imagery, n = -1, o = 0, a = 0, s = i.length; s > a; ++a) { var l = i[a],
  6116. u = l.loadingImagery; if (t(u) || (u = l.readyImagery), u.imageryLayer === e) - 1 === n && (n = a), l.freeResources(), ++o;
  6117. else if (-1 !== n) break } - 1 !== n && i.splice(n, o), e.isBaseLayer() && (r.isRenderable = !1), r = r.replacementNext } }, q.prototype._onLayerMoved = function() { t(this._levelZeroTiles) && (this._layerOrderChanged = !0) }, q.prototype._onLayerShownOrHidden = function(e, r, i) { t(this._levelZeroTiles) && (i ? this._onLayerAdded(e, r) : this._onLayerRemoved(e, r)) }, q.prototype.isDestroyed = function() { return !1 }, q.prototype.destroy = function() { var e = this._levelZeroTiles; if (t(e))
  6118. for (var i = 0; i < e.length; ++i) e[i].freeResources(); return this._imageryLayerCollection.destroy(), r(this) }; var k = new i,
  6119. U = new o,
  6120. W = new o,
  6121. G = o.UNIT_Y.negate(),
  6122. H = o.UNIT_Z.negate(),
  6123. j = new o;
  6124. q.prototype.debugShowBoundingSphereOfTileAt = function(e) { for (var r, i, n = this._tilesToRenderByTextureCount, o = 0; o < n.length && !t(r); ++o) { var a = n[o]; if (t(a))
  6125. for (var s = 0; s < a.length; ++s)
  6126. if (i = a[s], i.extent.contains(e)) { r = i; break } } t(r) && console.log("x: " + r.x + " y: " + r.y + " level: " + r.level + " radius: " + r.boundingSphere3D.radius + " center magnitude: " + r.boundingSphere3D.center.magnitude()), this._debug.boundingSphereTile = r }, q.prototype.debugToggleLodUpdate = function() { this._debug.suspendLodUpdate = !this._debug.suspendLodUpdate }; var Y = s.supportsTypedArrays() ? new Float32Array(1) : void 0,
  6127. X = new d,
  6128. Z = new a,
  6129. K = new o,
  6130. J = new a; return q }), r("Scene/CentralBodySurfaceShaderSet", ["../Core/defined", "../Core/destroyObject", "../Core/defaultValue"], function(e, t) { "use strict";
  6131. function r(e) { this.baseVertexShaderString = void 0, this.baseFragmentShaderString = void 0, this._attributeIndices = e, this._shaders = {} }
  6132. function i(e, t, r, i, n, o, a) { var s = ""; return s += e, s += t ? "_brightness" : "", s += r ? "_contrast" : "", s += i ? "_hue" : "", s += n ? "_saturation" : "", s += o ? "_gamma" : "", s += a ? "_alpha" : "" } return r.prototype.invalidateShaders = function() { var e = this._shaders; for (var t in e) e.hasOwnProperty(t) && e[t].release();
  6133. this._shaders = {} }, r.prototype.getShaderProgram = function(t, r, n, o, a, s, l, u) { var c = i(r, n, o, a, s, l, u),
  6134. h = this._shaders[c]; if (!e(h)) { for (var d = this.baseVertexShaderString, m = (n ? "#define APPLY_BRIGHTNESS\n" : "") + (o ? "#define APPLY_CONTRAST\n" : "") + (a ? "#define APPLY_HUE\n" : "") + (s ? "#define APPLY_SATURATION\n" : "") + (l ? "#define APPLY_GAMMA\n" : "") + (u ? "#define APPLY_ALPHA\n" : "") + "#define TEXTURE_UNITS " + r + "\n" + this.baseFragmentShaderString + "\n" + "vec3 computeDayColor(vec3 initialColor, vec2 textureCoordinates)\n" + "{\n" + " vec3 color = initialColor;\n", p = 0; r > p; ++p) m += "color = sampleAndBlend(\n color,\n u_dayTextures[" + p + "],\n" + " textureCoordinates,\n" + " u_dayTextureTexCoordsExtent[" + p + "],\n" + " u_dayTextureTranslationAndScale[" + p + "],\n" + " u_dayTextureAlpha[" + p + "],\n" + " u_dayTextureBrightness[" + p + "],\n" + " u_dayTextureContrast[" + p + "],\n" + " u_dayTextureHue[" + p + "],\n" + " u_dayTextureSaturation[" + p + "],\n" + " u_dayTextureOneOverGamma[" + p + "]);\n";
  6135. m += " return color;\n}", h = t.getShaderCache().getShaderProgram(d, m, this._attributeIndices), this._shaders[c] = h } return h }, r.prototype.destroy = function() { return this.invalidateShaders(), t(this) }, r }), r("Scene/CreditDisplay", ["../Core/defaultValue", "../Core/defined", "../Core/destroyObject", "../Core/DeveloperError", "./Credit"], function(e, t, r, i, n) { "use strict";
  6136. function o(e, r, i) { if (!t(e.element)) { var n = e.getText(),
  6137. o = e.getLink(),
  6138. a = document.createElement("span"); if (e.hasLink()) { var s = document.createElement("a");
  6139. s.textContent = n, s.href = o, s.target = "_blank", a.appendChild(s) } else a.textContent = n;
  6140. a.className = "cesium-credit-text", e.element = a } if (r.hasChildNodes()) { var l = document.createElement("span");
  6141. l.textContent = i, l.className = "cesium-credit-delimiter", r.appendChild(l) } r.appendChild(e.element) }
  6142. function a(e, r) { if (!t(e.element)) { var i = e.getText(),
  6143. n = e.getLink(),
  6144. o = document.createElement("span"),
  6145. a = document.createElement("img"); if (a.src = e.getImageUrl(), a.style["vertical-align"] = "bottom", t(i) && (a.alt = i, a.title = i), e.hasLink()) { var s = document.createElement("a");
  6146. s.appendChild(a), s.href = n, s.target = "_blank", o.appendChild(s) } else o.appendChild(a);
  6147. o.className = "cesium-credit-image", e.element = o } r.appendChild(e.element) }
  6148. function s(e, t) { for (var r = e.length, i = 0; r > i; i++) { var o = e[i]; if (n.equals(o, t)) return !0 } return !1 }
  6149. function l(e) { var r = e.element; if (t(r)) { var i = r.parentNode; if (!e.hasImage()) { var n = r.previousSibling;
  6150. null === n && (n = r.nextSibling), null !== n && i.removeChild(n) } i.removeChild(r) } }
  6151. function u(e, t) { var r, i, n, a = e._displayedCredits.textCredits; for (r = 0; r < t.length; r++) n = t[r], i = a.indexOf(n), -1 === i ? o(n, e._textContainer, e._delimiter) : a.splice(i, 1); for (r = 0; r < a.length; r++) n = a[r], l(n) }
  6152. function c(e, t) { var r, i, n, o = e._displayedCredits.imageCredits; for (r = 0; r < t.length; r++) n = t[r], i = o.indexOf(n), -1 === i ? a(n, e._imageContainer) : o.splice(i, 1); for (r = 0; r < o.length; r++) n = o[r], l(n) } var h = function(r, n) { if (!t(r)) throw new i("credit container is required"); var o = document.createElement("span");
  6153. o.className = "cesium-credit-imageContainer"; var a = document.createElement("span");
  6154. a.className = "cesium-credit-textContainer", r.appendChild(o), r.appendChild(a), this._delimiter = e(n, " • "), this._container = r, this._textContainer = a, this._imageContainer = o, this._defaultImageCredits = [], this._defaultTextCredits = [], this._displayedCredits = { imageCredits: [], textCredits: [] }, this._currentFrameCredits = { imageCredits: [], textCredits: [] } }; return h.prototype.addCredit = function(e) { if (!t(e)) throw new i("credit must be defined"); if (e.hasImage()) { var r = this._currentFrameCredits.imageCredits;
  6155. s(r, e) || s(this._defaultImageCredits, e) || r.push(e) } else { var n = this._currentFrameCredits.textCredits;
  6156. s(n, e) || s(this._defaultTextCredits, e) || n.push(e) } }, h.prototype.addDefaultCredit = function(e) { if (!t(e)) throw new i("credit must be defined"); if (e.hasImage()) { var r = this._defaultImageCredits;
  6157. s(r, e) || r.push(e) } else { var n = this._defaultTextCredits;
  6158. s(n, e) || n.push(e) } }, h.prototype.removeDefaultCredit = function(e) { if (!t(e)) throw new i("credit must be defined"); var r;
  6159. e.hasImage() ? (r = this._defaultImageCredits.indexOf(e), -1 !== r && this._defaultImageCredits.splice(r, 1)) : (r = this._defaultTextCredits.indexOf(e), -1 !== r && this._defaultTextCredits.splice(r, 1)) }, h.prototype.beginFrame = function() { this._currentFrameCredits.imageCredits.length = 0, this._currentFrameCredits.textCredits.length = 0 }, h.prototype.endFrame = function() { var e = this._defaultTextCredits.concat(this._currentFrameCredits.textCredits),
  6160. t = this._defaultImageCredits.concat(this._currentFrameCredits.imageCredits);
  6161. u(this, e), c(this, t), this._displayedCredits.textCredits = e, this._displayedCredits.imageCredits = t }, h.prototype.destroy = function() { return this._container.removeChild(this._textContainer), this._container.removeChild(this._imageContainer), r(this) }, h.prototype.isDestroyed = function() { return !1 }, h }), r("Scene/EllipsoidTerrainProvider", ["../Core/defaultValue", "../Core/defined", "../Core/Ellipsoid", "../Core/Event", "./HeightmapTerrainData", "./TerrainProvider", "./GeographicTilingScheme"], function(e, t, r, i, n, o, a) { "use strict"; var s = function(s) { s = e(s, {}), this._tilingScheme = s.tilingScheme, t(this._tilingScheme) || (this._tilingScheme = new a({ ellipsoid: e(s.ellipsoid, r.WGS84) })), this._levelZeroMaximumGeometricError = o.getEstimatedLevelZeroGeometricErrorForAHeightmap(this._tilingScheme.getEllipsoid(), 64, this._tilingScheme.getNumberOfXTilesAtLevel(0)); var l = 16,
  6162. u = 16;
  6163. this._terrainData = new n({ buffer: new Uint8Array(l * u), width: 16, height: 16 }), this._errorEvent = new i }; return s.prototype.requestTileGeometry = function() { return this._terrainData }, s.prototype.getErrorEvent = function() { return this._errorEvent }, s.prototype.getLevelMaximumGeometricError = function(e) { return this._levelZeroMaximumGeometricError / (1 << e) }, s.prototype.getCredit = function() { return void 0 }, s.prototype.getTilingScheme = function() { return this._tilingScheme }, s.prototype.hasWaterMask = function() { return !1 }, s.prototype.isReady = function() { return !0 }, s }), r("Scene/ImageryLayerCollection", ["../Core/DeveloperError", "../Core/defaultValue", "../Core/defined", "../Core/destroyObject", "../Core/Event", "../Core/Math", "./ImageryLayer"], function(e, t, r, i, n, o, a) { "use strict";
  6164. function s(t, i) { if (!r(i)) throw new e("layer is required."); var n = t.indexOf(i); if (-1 === n) throw new e("layer is not in this collection."); return n }
  6165. function l(e, t, r) { var i = e._layers; if (t = o.clamp(t, 0, i.length - 1), r = o.clamp(r, 0, i.length - 1), t !== r) { var n = i[t];
  6166. i[t] = i[r], i[r] = n, e._update(), e.layerMoved.raiseEvent(n, r, t) } } var u = function() { this._layers = [], this.layerAdded = new n, this.layerRemoved = new n, this.layerMoved = new n, this.layerShownOrHidden = new n }; return u.prototype.add = function(t, i) { if (!r(t)) throw new e("layer is required."); if (r(i)) { if (0 > i) throw new e("index must be greater than or equal to zero."); if (i > this._layers.length) throw new e("index must be less than or equal to the number of layers.");
  6167. this._layers.splice(i, 0, t) } else i = this._layers.length, this._layers.push(t);
  6168. this._update(), this.layerAdded.raiseEvent(t, i) }, u.prototype.addImageryProvider = function(t, i) { if (!r(t)) throw new e("imageryProvider is required."); var n = new a(t); return this.add(n, i), n }, u.prototype.remove = function(e, r) { r = t(r, !0); var i = this._layers.indexOf(e); return -1 !== i ? (this._layers.splice(i, 1), this._update(), this.layerRemoved.raiseEvent(e, i), r && e.destroy(), !0) : !1 }, u.prototype.removeAll = function(e) { e = t(e, !0); for (var r = this._layers, i = 0, n = r.length; n > i; i++) { var o = r[i];
  6169. this.layerRemoved.raiseEvent(o, i), e && o.destroy() } this._layers = [] }, u.prototype.contains = function(e) { return -1 !== this.indexOf(e) }, u.prototype.indexOf = function(e) { return this._layers.indexOf(e) }, u.prototype.get = function(t) { if (!r(t)) throw new e("index is required.", "index"); return this._layers[t] }, u.prototype.getLength = function() { return this._layers.length }, u.prototype.raise = function(e) { var t = s(this._layers, e);
  6170. l(this, t, t + 1) }, u.prototype.lower = function(e) { var t = s(this._layers, e);
  6171. l(this, t, t - 1) }, u.prototype.raiseToTop = function(e) { var t = s(this._layers, e);
  6172. t !== this._layers.length - 1 && (this._layers.splice(t, 1), this._layers.push(e), this._update(), this.layerMoved.raiseEvent(e, this._layers.length - 1, t)) }, u.prototype.lowerToBottom = function(e) { var t = s(this._layers, e);
  6173. 0 !== t && (this._layers.splice(t, 1), this._layers.splice(0, 0, e), this._update(), this.layerMoved.raiseEvent(e, 0, t)) }, u.prototype.isDestroyed = function() { return !1 }, u.prototype.destroy = function() { return this.removeAll(!0), i(this) }, u.prototype._update = function() { for (var e, t, i = !0, n = this._layers, o = 0, a = n.length; a > o; ++o) t = n[o], t._layerIndex = o, t.show ? (t._isBaseLayer = i, i = !1) : t._isBaseLayer = !1, t.show !== t._show && (r(t._show) && (r(e) || (e = []), e.push(t)), t._show = t.show); if (r(e))
  6174. for (o = 0, a = e.length; a > o; ++o) t = e[o], this.layerShownOrHidden.raiseEvent(t, t._layerIndex, t.show) }, u }), r("Shaders/ViewportQuadVS", [], function() {
  6175. "use strict";
  6176. return "attribute vec4 position;\nattribute vec2 textureCoordinates;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\ngl_Position = position;\nv_textureCoordinates = textureCoordinates;\n}\n"
  6177. }), r("Shaders/ViewportQuadFS", [], function() { "use strict"; return "varying vec2 v_textureCoordinates;\nvoid main()\n{\nczm_materialInput materialInput;\nmaterialInput.s = v_textureCoordinates.s;\nmaterialInput.st = v_textureCoordinates;\nmaterialInput.str = vec3(v_textureCoordinates, 0.0);\nmaterialInput.normalEC = vec3(0.0, 0.0, -1.0);\nczm_material material = czm_getMaterial(materialInput);\ngl_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n}\n" }), r("Scene/ViewportQuad", ["../Core/Color", "../Core/combine", "../Core/destroyObject", "../Core/defaultValue", "../Core/defined", "../Core/DeveloperError", "../Core/BoundingRectangle", "../Core/ComponentDatatype", "../Core/PrimitiveType", "../Core/Geometry", "../Core/GeometryAttribute", "./Material", "../Renderer/BufferUsage", "../Renderer/BlendingState", "../Renderer/CommandLists", "../Renderer/DrawCommand", "../Renderer/createShaderSource", "../Shaders/ViewportQuadVS", "../Shaders/ViewportQuadFS"], function(e, t, r, i, n, o, a, s, l, u, c, h, d, m, p, f, v, y, g) { "use strict";
  6178. function _(e) { var t = e.cache.viewportQuad_vertexArray; if (n(t)) return t; var r = new u({ attributes: { position: new c({ componentDatatype: s.FLOAT, componentsPerAttribute: 2, values: [-1, -1, 1, -1, 1, 1, -1, 1] }), textureCoordinates: new c({ componentDatatype: s.FLOAT, componentsPerAttribute: 2, values: [0, 0, 1, 0, 1, 1, 0, 1] }) }, primitiveType: l.TRIANGLES }); return t = e.createVertexArrayFromGeometry({ geometry: r, attributeIndices: C, bufferUsage: d.STATIC_DRAW }), e.cache.viewportQuad_vertexArray = t, t } var w = function(t, r) { this._va = void 0, this._overlayCommand = new f, this._overlayCommand.primitiveType = l.TRIANGLE_FAN, this._overlayCommand.owner = this, this._commandLists = new p, this._commandLists.overlayList.push(this._overlayCommand), this.show = !0, n(t) || (t = new a), this.rectangle = a.clone(t), n(r) || (r = h.fromType(void 0, h.ColorType), r.uniforms.color = new e(1, 1, 1, 1)), this.material = r, this._material = void 0 },
  6179. C = { position: 0, textureCoordinates: 1 }; return w.prototype.update = function(e, t, r) { if (this.show) { if (!n(this.material)) throw new o("this.material must be defined."); if (!n(this.rectangle)) throw new o("this.rectangle must be defined.");
  6180. n(this._va) || (this._va = _(e), this._overlayCommand.vertexArray = this._va); var i = this._overlayCommand.renderState;
  6181. n(i) && a.equals(i.viewport, this.rectangle) || (this._overlayCommand.renderState = e.createRenderState({ blending: m.ALPHA_BLEND, viewport: this.rectangle })); var s = t.passes; if (s.overlay) { if (this._material !== this.material) { this._material = this.material; var l = v({ sources: [this._material.shaderSource, g] });
  6182. this._overlayCommand.shaderProgram = e.getShaderCache().replaceShaderProgram(this._overlayCommand.shaderProgram, y, l, C) } this._overlayCommand.uniformMap = this._material._uniforms, r.push(this._commandLists) } } }, w.prototype.isDestroyed = function() { return !1 }, w.prototype.destroy = function() { return this._overlayCommand.shaderProgram = this._overlayCommand.shaderProgram && this._overlayCommand.shaderProgram.release(), r(this) }, w }), r("Shaders/CentralBodyFS", [], function() { "use strict"; return "#if TEXTURE_UNITS > 0\nuniform sampler2D u_dayTextures[TEXTURE_UNITS];\nuniform vec4 u_dayTextureTranslationAndScale[TEXTURE_UNITS];\nuniform float u_dayTextureAlpha[TEXTURE_UNITS];\nuniform float u_dayTextureBrightness[TEXTURE_UNITS];\nuniform float u_dayTextureContrast[TEXTURE_UNITS];\nuniform float u_dayTextureHue[TEXTURE_UNITS];\nuniform float u_dayTextureSaturation[TEXTURE_UNITS];\nuniform float u_dayTextureOneOverGamma[TEXTURE_UNITS];\nuniform vec4 u_dayTextureTexCoordsExtent[TEXTURE_UNITS];\n#endif\n#ifdef SHOW_REFLECTIVE_OCEAN\nuniform sampler2D u_waterMask;\nuniform vec4 u_waterMaskTranslationAndScale;\nuniform float u_zoomedOutOceanSpecularIntensity;\n#endif\n#ifdef SHOW_OCEAN_WAVES\nuniform sampler2D u_oceanNormalMap;\n#endif\nvarying vec3 v_positionMC;\nvarying vec3 v_positionEC;\nvarying vec2 v_textureCoordinates;\nfloat getLambertDiffuse(vec3 lightDirectionEC, vec3 normalEC)\n{\nreturn max(dot(lightDirectionEC, normalEC), 0.0);\n}\nfloat getSpecular(vec3 lightDirectionEC, vec3 toEyeEC, vec3 normalEC, float shininess)\n{\nvec3 toReflectedLight = reflect(-lightDirectionEC, normalEC);\nfloat specular = max(dot(toReflectedLight, toEyeEC), 0.0);\nreturn pow(specular, shininess);\n}\nvec3 sampleAndBlend(\nvec3 previousColor,\nsampler2D texture,\nvec2 tileTextureCoordinates,\nvec4 textureCoordinateExtent,\nvec4 textureCoordinateTranslationAndScale,\nfloat textureAlpha,\nfloat textureBrightness,\nfloat textureContrast,\nfloat textureHue,\nfloat textureSaturation,\nfloat textureOneOverGamma)\n{\nvec2 alphaMultiplier = step(textureCoordinateExtent.st, tileTextureCoordinates);\ntextureAlpha = textureAlpha * alphaMultiplier.x * alphaMultiplier.y;\nalphaMultiplier = step(vec2(0.0), textureCoordinateExtent.pq - tileTextureCoordinates);\ntextureAlpha = textureAlpha * alphaMultiplier.x * alphaMultiplier.y;\nvec2 translation = textureCoordinateTranslationAndScale.xy;\nvec2 scale = textureCoordinateTranslationAndScale.zw;\nvec2 textureCoordinates = tileTextureCoordinates * scale + translation;\nvec4 sample = texture2D(texture, textureCoordinates);\nvec3 color = sample.rgb;\nfloat alpha = sample.a;\n#ifdef APPLY_BRIGHTNESS\ncolor = mix(vec3(0.0), color, textureBrightness);\n#endif\n#ifdef APPLY_CONTRAST\ncolor = mix(vec3(0.5), color, textureContrast);\n#endif\n#ifdef APPLY_HUE\ncolor = czm_hue(color, textureHue);\n#endif\n#ifdef APPLY_SATURATION\ncolor = czm_saturation(color, textureSaturation);\n#endif\n#ifdef APPLY_GAMMA\ncolor = pow(color, vec3(textureOneOverGamma));\n#endif\nreturn mix(previousColor, color, alpha * textureAlpha);\n}\nvec3 computeDayColor(vec3 initialColor, vec2 textureCoordinates);\nvec4 computeWaterColor(vec3 positionEyeCoordinates, vec2 textureCoordinates, mat3 enuToEye, vec3 imageryColor, float specularMapValue);\nvoid main()\n{\nvec3 initialColor = vec3(0.0, 0.0, 0.5);\nvec3 startDayColor = computeDayColor(initialColor, clamp(v_textureCoordinates, 0.0, 1.0));\n#ifdef SHOW_TILE_BOUNDARIES\nif (v_textureCoordinates.x < (1.0/256.0) || v_textureCoordinates.x > (255.0/256.0) ||\nv_textureCoordinates.y < (1.0/256.0) || v_textureCoordinates.y > (255.0/256.0))\n{\nstartDayColor = vec3(1.0, 0.0, 0.0);\n}\n#endif\nvec4 color = vec4(startDayColor, 1.0);\n#ifdef SHOW_REFLECTIVE_OCEAN\nvec2 waterMaskTranslation = u_waterMaskTranslationAndScale.xy;\nvec2 waterMaskScale = u_waterMaskTranslationAndScale.zw;\nvec2 waterMaskTextureCoordinates = v_textureCoordinates * waterMaskScale + waterMaskTranslation;\nfloat mask = texture2D(u_waterMask, waterMaskTextureCoordinates).r;\nif (mask > 0.0)\n{\nvec3 normalMC = normalize(czm_geodeticSurfaceNormal(v_positionMC, vec3(0.0), vec3(1.0)));\nvec3 normalEC = normalize(czm_normal3D * normalMC);\nmat3 enuToEye = czm_eastNorthUpToEyeCoordinates(v_positionMC, normalEC);\nvec2 ellipsoidTextureCoordinates = czm_ellipsoidWgs84TextureCoordinates(normalMC);\nvec2 ellipsoidFlippedTextureCoordinates = czm_ellipsoidWgs84TextureCoordinates(normalMC.zyx);\nvec2 textureCoordinates = mix(ellipsoidTextureCoordinates, ellipsoidFlippedTextureCoordinates, czm_morphTime * smoothstep(0.9, 0.95, normalMC.z));\ncolor = computeWaterColor(v_positionEC, textureCoordinates, enuToEye, startDayColor, mask);\n}\n#endif\ngl_FragColor = color;\n}\n#ifdef SHOW_REFLECTIVE_OCEAN\nfloat waveFade(float edge0, float edge1, float x)\n{\nfloat y = clamp((x - edge0) / (edge1 - edge0), 0.0, 1.0);\nreturn pow(1.0 - y, 5.0);\n}\nconst float oceanFrequency = 125000.0;\nconst float oceanAnimationSpeed = 0.006;\nconst float oceanAmplitude = 2.0;\nconst float oceanSpecularIntensity = 0.5;\nvec4 computeWaterColor(vec3 positionEyeCoordinates, vec2 textureCoordinates, mat3 enuToEye, vec3 imageryColor, float specularMapValue)\n{\nfloat time = czm_frameNumber * oceanAnimationSpeed;\nvec3 positionToEyeEC = -positionEyeCoordinates;\nfloat positionToEyeECLength = length(positionToEyeEC);\nvec3 normalizedpositionToEyeEC = normalize(normalize(positionToEyeEC));\nfloat waveIntensity = waveFade(70000.0, 1000000.0, positionToEyeECLength);\n#ifdef SHOW_OCEAN_WAVES\nvec4 noise = czm_getWaterNoise(u_oceanNormalMap, textureCoordinates * oceanFrequency, time, 0.0);\nvec3 normalTangentSpace = noise.xyz * vec3(1.0, 1.0, (1.0 / oceanAmplitude));\nnormalTangentSpace.xy *= waveIntensity;\nnormalTangentSpace = normalize(normalTangentSpace);\n#else\nvec3 normalTangentSpace = vec3(0.0, 0.0, 1.0);\n#endif\nvec3 normalEC = enuToEye * normalTangentSpace;\nconst vec3 waveHighlightColor = vec3(0.3, 0.45, 0.6);\nfloat diffuseIntensity = getLambertDiffuse(czm_sunDirectionEC, normalEC);\nvec3 diffuseHighlight = waveHighlightColor * diffuseIntensity;\n#ifdef SHOW_OCEAN_WAVES\nfloat tsPerturbationRatio = normalTangentSpace.z;\nvec3 nonDiffuseHighlight = mix(waveHighlightColor * 5.0 * (1.0 - tsPerturbationRatio), vec3(0.0), diffuseIntensity);\n#else\nvec3 nonDiffuseHighlight = vec3(0.0);\n#endif\nfloat specularIntensity = getSpecular(czm_sunDirectionEC, normalizedpositionToEyeEC, normalEC, 10.0) + 0.25 * getSpecular(czm_moonDirectionEC, normalizedpositionToEyeEC, normalEC, 10.0);\nfloat surfaceReflectance = mix(0.0, mix(u_zoomedOutOceanSpecularIntensity, oceanSpecularIntensity, waveIntensity), specularMapValue);\nfloat specular = specularIntensity * surfaceReflectance;\nreturn vec4(imageryColor + diffuseHighlight + nonDiffuseHighlight + specular, 1.0);\n}\n#endif\n" }), r("Shaders/CentralBodyFSDepth", [], function() { "use strict"; return "varying vec4 positionEC;\nvoid main()\n{\nczm_ellipsoid ellipsoid = czm_getWgs84EllipsoidEC();\nvec3 direction = normalize(positionEC.xyz);\nczm_ray ray = czm_ray(vec3(0.0), direction);\nczm_raySegment intersection = czm_rayEllipsoidIntersectionInterval(ray, ellipsoid);\nif (!czm_isEmpty(intersection))\n{\ngl_FragColor = vec4(1.0, 1.0, 0.0, 1.0);\n}\nelse\n{\ndiscard;\n}\n}\n" }), r("Shaders/CentralBodyFSPole", [], function() { "use strict"; return "uniform vec3 u_color;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\nczm_ellipsoid ellipsoid = czm_getWgs84EllipsoidEC();\nvec3 direction = normalize(czm_windowToEyeCoordinates(gl_FragCoord).xyz);\nczm_ray ray = czm_ray(vec3(0.0), direction);\nczm_raySegment intersection = czm_rayEllipsoidIntersectionInterval(ray, ellipsoid);\nif (!czm_isEmpty(intersection))\n{\nvec3 positionEC = czm_pointAlongRay(ray, intersection.start);\nvec3 positionMC = (czm_inverseModelView * vec4(positionEC, 1.0)).xyz;\nvec3 normalMC = normalize(czm_geodeticSurfaceNormal(positionMC, vec3(0.0), vec3(1.0)));\nvec3 normalEC = normalize(czm_normal * normalMC);\nvec3 startDayColor = u_color;\ngl_FragColor = vec4(startDayColor, 1.0);\n}\nelse\n{\ndiscard;\n}\n}\n" }), r("Shaders/CentralBodyVS", [], function() { "use strict"; return "attribute vec4 position3DAndHeight;\nattribute vec2 textureCoordinates;\nuniform vec3 u_center3D;\nuniform mat4 u_modifiedModelView;\nuniform vec4 u_tileExtent;\nuniform vec2 u_southAndNorthLatitude;\nuniform vec3 u_southMercatorYLowAndHighAndOneOverHeight;\nvarying vec3 v_positionMC;\nvarying vec3 v_positionEC;\nvarying vec2 v_textureCoordinates;\nvec4 getPosition(vec3 position3DWC);\nfloat get2DYPositionFraction();\nvec4 getPosition3DMode(vec3 position3DWC)\n{\nreturn czm_projection * (u_modifiedModelView * vec4(position3DAndHeight.xyz, 1.0));\n}\nfloat get2DMercatorYPositionFraction()\n{\nconst float maxTileWidth = 0.003068;\nfloat positionFraction = textureCoordinates.y;\nfloat southLatitude = u_southAndNorthLatitude.x;\nfloat northLatitude = u_southAndNorthLatitude.y;\nif (northLatitude - southLatitude > maxTileWidth)\n{\nfloat southMercatorYLow = u_southMercatorYLowAndHighAndOneOverHeight.x;\nfloat southMercatorYHigh = u_southMercatorYLowAndHighAndOneOverHeight.y;\nfloat oneOverMercatorHeight = u_southMercatorYLowAndHighAndOneOverHeight.z;\nfloat currentLatitude = mix(southLatitude, northLatitude, textureCoordinates.y);\ncurrentLatitude = clamp(currentLatitude, -czm_webMercatorMaxLatitude, czm_webMercatorMaxLatitude);\npositionFraction = czm_latitudeToWebMercatorFraction(currentLatitude, southMercatorYLow, southMercatorYHigh, oneOverMercatorHeight);\n}\nreturn positionFraction;\n}\nfloat get2DGeographicYPositionFraction()\n{\nreturn textureCoordinates.y;\n}\nvec4 getPositionPlanarEarth(vec3 position3DWC, float height2D)\n{\nfloat yPositionFraction = get2DYPositionFraction();\nvec4 rtcPosition2D = vec4(height2D, mix(u_tileExtent.st, u_tileExtent.pq, vec2(textureCoordinates.x, yPositionFraction)), 1.0);\nreturn czm_projection * (u_modifiedModelView * rtcPosition2D);\n}\nvec4 getPosition2DMode(vec3 position3DWC)\n{\nreturn getPositionPlanarEarth(position3DWC, 0.0);\n}\nvec4 getPositionColumbusViewMode(vec3 position3DWC)\n{\nreturn getPositionPlanarEarth(position3DWC, position3DAndHeight.w);\n}\nvec4 getPositionMorphingMode(vec3 position3DWC)\n{\nfloat yPositionFraction = get2DYPositionFraction();\nvec4 position2DWC = vec4(0.0, mix(u_tileExtent.st, u_tileExtent.pq, vec2(textureCoordinates.x, yPositionFraction)), 1.0);\nvec4 morphPosition = czm_columbusViewMorph(position2DWC, vec4(position3DWC, 1.0), czm_morphTime);\nreturn czm_modelViewProjection * morphPosition;\n}\nvoid main()\n{\nvec3 position3DWC = position3DAndHeight.xyz + u_center3D;\ngl_Position = getPosition(position3DWC);\n#ifdef SHOW_REFLECTIVE_OCEAN\nv_positionEC = (czm_modelView3D * vec4(position3DWC, 1.0)).xyz;\nv_positionMC = position3DWC;\n#endif\nv_textureCoordinates = textureCoordinates;\n}\n" }), r("Shaders/CentralBodyVSDepth", [], function() { "use strict"; return "attribute vec4 position;\nvarying vec4 positionEC;\nvoid main()\n{\npositionEC = czm_modelView * position;\ngl_Position = czm_projection * positionEC;\n}\n" }), r("Shaders/CentralBodyVSPole", [], function() { "use strict"; return "attribute vec4 position;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\nfloat x = (position.x - czm_viewport.x) / czm_viewport.z;\nfloat y = (position.y - czm_viewport.y) / czm_viewport.w;\nv_textureCoordinates = vec2(x, y);\ngl_Position = czm_viewportOrthographic * position;\n}\n" }), r("Scene/CentralBody", ["../Core/buildModuleUrl", "../Core/combine", "../Core/loadImage", "../Core/defaultValue", "../Core/defined", "../Core/destroyObject", "../Core/BoundingRectangle", "../Core/BoundingSphere", "../Core/Cartesian2", "../Core/Cartesian3", "../Core/Cartographic", "../Core/ComponentDatatype", "../Core/Ellipsoid", "../Core/Extent", "../Core/FeatureDetection", "../Core/GeographicProjection", "../Core/Geometry", "../Core/GeometryAttribute", "../Core/Intersect", "../Core/Math", "../Core/Matrix4", "../Core/Occluder", "../Core/PrimitiveType", "../Core/Transforms", "../Renderer/BufferUsage", "../Renderer/ClearCommand", "../Renderer/CommandLists", "../Renderer/DepthFunction", "../Renderer/DrawCommand", "../Renderer/createShaderSource", "./CentralBodySurface", "./CentralBodySurfaceShaderSet", "./CreditDisplay", "./EllipsoidTerrainProvider", "./ImageryLayerCollection", "./Material", "./SceneMode", "./TerrainProvider", "./ViewportQuad", "../Shaders/CentralBodyFS", "../Shaders/CentralBodyFSDepth", "../Shaders/CentralBodyFSPole", "../Shaders/CentralBodyVS", "../Shaders/CentralBodyVSDepth", "../Shaders/CentralBodyVSPole", "../ThirdParty/when"], function(e, t, r, i, n, o, a, s, l, u, c, h, d, m, p, f, v, y, g, _, w, C, x, S, E, b, T, A, M, P, D, I, O, R, L, z, N, F, B, V, q, k, U, W, G, H) { "use strict";
  6183. function j(e, t) { var r = e._ellipsoid.getRadii(),
  6184. i = t.camera.getPositionWC(),
  6185. n = e._ellipsoid.getOneOverRadii().multiplyComponents(i),
  6186. o = n.magnitude(),
  6187. a = n.normalize(),
  6188. s = u.UNIT_Z.cross(n).normalize(),
  6189. l = a.cross(s).normalize(),
  6190. c = Math.sqrt(n.magnitudeSquared() - 1),
  6191. h = a.multiplyByScalar(1 / o),
  6192. d = c / o,
  6193. m = s.multiplyByScalar(d),
  6194. p = l.multiplyByScalar(d),
  6195. f = r.multiplyComponents(h.add(p).subtract(m)),
  6196. v = r.multiplyComponents(h.add(p).add(m)),
  6197. y = r.multiplyComponents(h.subtract(p).subtract(m)),
  6198. g = r.multiplyComponents(h.subtract(p).add(m)); return J[0] = f.x, J[1] = f.y, J[2] = f.z, J[3] = y.x, J[4] = y.y, J[5] = y.z, J[6] = v.x, J[7] = v.y, J[8] = v.z, J[9] = g.x, J[10] = g.y, J[11] = g.z, J }
  6199. function Y(e, t, r, i, n, o) { var s, l = e._ellipsoid.cartographicToCartesian(new c(0, i)),
  6200. h = e._ellipsoid.cartographicToCartesian(new c(Math.PI, i)),
  6201. d = .5 * l.subtract(h).magnitude(),
  6202. m = e._ellipsoid.cartographicToCartesian(new c(0, r)),
  6203. p = t.camera.direction;
  6204. s = 1 - u.UNIT_Z.negate().dot(p) < _.EPSILON6 ? u.UNIT_X : p.cross(u.UNIT_Z).normalize(); var f = m.add(s.multiplyByScalar(d)),
  6205. v = m.add(u.UNIT_Z.cross(s).normalize().multiplyByScalar(d));
  6206. S.pointToWindowCoordinates(n, o, m, m), S.pointToWindowCoordinates(n, o, f, f), S.pointToWindowCoordinates(n, o, v, v); var y = Math.floor(Math.max(v.subtract(m).magnitude(), f.subtract(m).magnitude())),
  6207. g = y; return new a(Math.floor(m.x) - y, Math.floor(m.y) - g, 2 * y, 2 * g) }
  6208. function X(e, r, i) { var o = e._surface._terrainProvider; if (i.mode === N.SCENE3D && o.isReady()) { var a = o.getTilingScheme().getExtent(),
  6209. l = r.getUniformState().getViewProjection(),
  6210. u = Q;
  6211. u.width = r.getCanvas().clientWidth, u.height = r.getCanvas().clientHeight; var c, d, p, f, x, S, b, T = w.computeViewportTransformation(u, 0, 1, $),
  6212. A = .05,
  6213. M = e._occluder;
  6214. a.north < _.PI_OVER_TWO && (c = new m(-Math.PI, a.north, Math.PI, _.PI_OVER_TWO), d = s.fromExtent3D(c, e._ellipsoid), p = i.cullingVolume.getVisibility(d) === g.OUTSIDE, f = C.computeOccludeePointFromExtent(c, e._ellipsoid), x = f && !M.isPointVisible(f, 0) || !M.isBoundingSphereVisible(d), e._drawNorthPole = !p && !x, e._drawNorthPole && (b = Y(e, i, c.north, c.south - A, l, T), et[0] = b.x, et[1] = b.y, et[2] = b.x + b.width, et[3] = b.y, et[4] = b.x + b.width, et[5] = b.y + b.height, et[6] = b.x, et[7] = b.y + b.height, n(e._northPoleCommand.vertexArray) ? e._northPoleCommand.vertexArray.getAttribute(0).vertexBuffer.copyFromArrayView(et) : (e._northPoleCommand.boundingVolume = s.fromExtent3D(c, e._ellipsoid), S = new v({ attributes: { position: new y({ componentDatatype: h.FLOAT, componentsPerAttribute: 2, values: et }) } }), e._northPoleCommand.vertexArray = r.createVertexArrayFromGeometry({ geometry: S, attributeIndices: { position: 0 }, bufferUsage: E.STREAM_DRAW })))), a.south > -_.PI_OVER_TWO && (c = new m(-Math.PI, -_.PI_OVER_TWO, Math.PI, a.south), d = s.fromExtent3D(c, e._ellipsoid), p = i.cullingVolume.getVisibility(d) === g.OUTSIDE, f = C.computeOccludeePointFromExtent(c, e._ellipsoid), x = f && !M.isPointVisible(f) || !M.isBoundingSphereVisible(d), e._drawSouthPole = !p && !x, e._drawSouthPole && (b = Y(e, i, c.south, c.north + A, l, T), et[0] = b.x, et[1] = b.y, et[2] = b.x + b.width, et[3] = b.y, et[4] = b.x + b.width, et[5] = b.y + b.height, et[6] = b.x, et[7] = b.y + b.height, n(e._southPoleCommand.vertexArray) ? e._southPoleCommand.vertexArray.getAttribute(0).vertexBuffer.copyFromArrayView(et) : (e._southPoleCommand.boundingVolume = s.fromExtent3D(c, e._ellipsoid), S = new v({ attributes: { position: new y({ componentDatatype: h.FLOAT, componentsPerAttribute: 2, values: et }) } }), e._southPoleCommand.vertexArray = r.createVertexArrayFromGeometry({ geometry: S, attributeIndices: { position: 0 }, bufferUsage: E.STREAM_DRAW })))); var P = 0,
  6215. D = e._imageryLayerCollection.getLength() > 0 ? e._imageryLayerCollection.get(0) : void 0;
  6216. n(D) && n(D.getImageryProvider()) && n(D.getImageryProvider().getPoleIntensity) && (P = D.getImageryProvider().getPoleIntensity()); var I = { u_dayIntensity: function() { return P } },
  6217. O = e; if (!n(e._northPoleCommand.uniformMap)) { var R = t([I, { u_color: function() { return O.northPoleColor } }], !1, !1);
  6218. e._northPoleCommand.uniformMap = t([R, e._drawUniforms], !1, !1) } if (!n(e._southPoleCommand.uniformMap)) { var L = t([I, { u_color: function() { return O.southPoleColor } }], !1, !1);
  6219. e._southPoleCommand.uniformMap = t([L, e._drawUniforms], !1, !1) } } }
  6220. function Z(e, t) { var r = t.creditDisplay,
  6221. i = e._surface._terrainProvider.getCredit();
  6222. n(i) && r.addCredit(i); for (var o = e._imageryLayerCollection, a = 0, s = o.getLength(); s > a; ++a) { var l = o.get(a);
  6223. l.show && (i = l.getImageryProvider().getCredit(), n(i) && r.addCredit(i)) } } var K = function(t) { t = i(t, d.WGS84); var r = new R({ ellipsoid: t }),
  6224. n = new L;
  6225. this.terrainProvider = r, this._ellipsoid = t, this._imageryLayerCollection = n, this._surface = new D({ terrainProvider: r, imageryLayerCollection: n }), this._occluder = new C(new s(u.ZERO, t.getMinimumRadius()), u.ZERO), this._surfaceShaderSet = new I(F.attributeIndices), this._rsColor = void 0, this._rsColorWithoutDepthTest = void 0; var o = new b;
  6226. o.depth = 1, o.stencil = 0, o.owner = this, this._clearDepthCommand = o, this._depthCommand = new M, this._depthCommand.primitiveType = x.TRIANGLES, this._depthCommand.boundingVolume = new s(u.ZERO, t.getMaximumRadius()), this._depthCommand.owner = this, this._northPoleCommand = new M, this._northPoleCommand.primitiveType = x.TRIANGLE_FAN, this._northPoleCommand.owner = this, this._southPoleCommand = new M, this._southPoleCommand.primitiveType = x.TRIANGLE_FAN, this._southPoleCommand.owner = this, this._drawNorthPole = !1, this._drawSouthPole = !1, this._commandLists = new T, this.northPoleColor = new u(2 / 255, 6 / 255, 18 / 255), this.southPoleColor = new u(1, 1, 1), this.show = !0, this._mode = N.SCENE3D, this._projection = void 0, this.oceanNormalMapUrl = e("Assets/Textures/waterNormalsSmall.jpg"), this.depthTestAgainstTerrain = !1, this.tileCacheSize = 100, this._lastOceanNormalMapUrl = void 0, this._oceanNormalMap = void 0, this._zoomedOutOceanSpecularIntensity = .5, this._showingPrettyOcean = !1, this._hasWaterMask = !1; var a = this;
  6227. this._drawUniforms = { u_zoomedOutOceanSpecularIntensity: function() { return a._zoomedOutOceanSpecularIntensity }, u_oceanNormalMap: function() { return a._oceanNormalMap } } };
  6228. K.prototype.getEllipsoid = function() { return this._ellipsoid }, K.prototype.getImageryLayers = function() { return this._imageryLayerCollection }; var J = p.supportsTypedArrays() ? new Float32Array(12) : [],
  6229. Q = new a,
  6230. $ = new w,
  6231. et = p.supportsTypedArrays() ? new Float32Array(8) : []; return K.prototype.update = function(e, t, i) { if (this.show) { var o = e.getCanvas().clientWidth,
  6232. a = e.getCanvas().clientHeight; if (0 !== o && 0 !== a) { var s = t.mode,
  6233. l = t.scene2D.projection,
  6234. u = !1;
  6235. this._mode === s && n(this._rsColor) || (u = !0, s === N.SCENE3D || s === N.COLUMBUS_VIEW ? (this._rsColor = e.createRenderState({ cull: { enabled: !0 }, depthTest: { enabled: !0 } }), this._rsColorWithoutDepthTest = e.createRenderState({ cull: { enabled: !0 } }), this._depthCommand.renderState = e.createRenderState({ cull: { enabled: !0 }, depthTest: { enabled: !0, func: A.ALWAYS }, colorMask: { red: !1, green: !1, blue: !1, alpha: !1 } })) : (this._rsColor = e.createRenderState({ cull: { enabled: !0 } }), this._rsColorWithoutDepthTest = e.createRenderState({ cull: { enabled: !0 } }), this._depthCommand.renderState = e.createRenderState({ cull: { enabled: !0 } }))), this._northPoleCommand.renderState = this._rsColorWithoutDepthTest, this._southPoleCommand.renderState = this._rsColorWithoutDepthTest; var c = j(this, t); if (this._depthCommand.vertexArray) this._depthCommand.vertexArray.getAttribute(0).vertexBuffer.copyFromArrayView(c);
  6236. else { var d = new v({ attributes: { position: new y({ componentDatatype: h.FLOAT, componentsPerAttribute: 3, values: c }) }, indices: [0, 1, 2, 2, 1, 3], primitiveType: x.TRIANGLES });
  6237. this._depthCommand.vertexArray = e.createVertexArrayFromGeometry({ geometry: d, attributeIndices: { position: 0 }, bufferUsage: E.DYNAMIC_DRAW }) } var m = e.getShaderCache(); if (n(this._depthCommand.shaderProgram) || (this._depthCommand.shaderProgram = m.getShaderProgram(W, q, { position: 0 })), this._surface._terrainProvider.hasWaterMask() && this.oceanNormalMapUrl !== this._lastOceanNormalMapUrl) { this._lastOceanNormalMapUrl = this.oceanNormalMapUrl; var p = this;
  6238. H(r(this.oceanNormalMapUrl), function(t) { p._oceanNormalMap = p._oceanNormalMap && p._oceanNormalMap.destroy(), p._oceanNormalMap = e.createTexture2D({ source: t }) }) } var g = this._projection !== l,
  6239. _ = this._surface._terrainProvider.hasWaterMask(),
  6240. w = this._hasWaterMask !== _; if (!n(this._surfaceShaderSet) || !n(this._northPoleCommand.shaderProgram) || !n(this._southPoleCommand.shaderProgram) || u || g || w || n(this._oceanNormalMap) !== this._showingPrettyOcean) { var C, S = "vec4 getPosition(vec3 position3DWC) { return getPosition3DMode(position3DWC); }",
  6241. b = "vec4 getPosition(vec3 position3DWC) { return getPosition2DMode(position3DWC); }",
  6242. T = "vec4 getPosition(vec3 position3DWC) { return getPositionColumbusViewMode(position3DWC); }",
  6243. M = "vec4 getPosition(vec3 position3DWC) { return getPositionMorphingMode(position3DWC); }"; switch (s) {
  6244. case N.SCENE3D:
  6245. C = S; break;
  6246. case N.SCENE2D:
  6247. C = b; break;
  6248. case N.COLUMBUS_VIEW:
  6249. C = T; break;
  6250. case N.MORPHING:
  6251. C = M } var D, I = "float get2DYPositionFraction() { return get2DGeographicYPositionFraction(); }",
  6252. O = "float get2DYPositionFraction() { return get2DMercatorYPositionFraction(); }";
  6253. D = l instanceof f ? I : O, this._surfaceShaderSet.baseVertexShaderString = P({ defines: [_ ? "SHOW_REFLECTIVE_OCEAN" : ""], sources: [U, C, D] }); var R = _ && n(this._oceanNormalMap);
  6254. this._surfaceShaderSet.baseFragmentShaderString = P({ defines: [_ ? "SHOW_REFLECTIVE_OCEAN" : "", R ? "SHOW_OCEAN_WAVES" : ""], sources: [V] }), this._surfaceShaderSet.invalidateShaders(); var L = m.replaceShaderProgram(this._northPoleCommand.shaderProgram, G, k, F.attributeIndices);
  6255. this._northPoleCommand.shaderProgram = L, this._southPoleCommand.shaderProgram = L, this._showingPrettyOcean = n(this._oceanNormalMap), this._hasWaterMask = _ } var z = t.camera.getPositionWC();
  6256. this._occluder.setCameraPosition(z), X(this, e, t), this._mode = s, this._projection = l; var B = t.passes,
  6257. Y = this._commandLists; if (Y.removeAll(), B.color) { var K = Y.colorList;
  6258. s === N.SCENE3D && (this._drawNorthPole && K.push(this._northPoleCommand), this._drawSouthPole && K.push(this._southPoleCommand)), this._zoomedOutOceanSpecularIntensity = s === N.SCENE3D ? .5 : 0, this._surface._tileCacheSize = this.tileCacheSize, this._surface.setTerrainProvider(this.terrainProvider), this._surface.update(e, t, K, this._drawUniforms, this._surfaceShaderSet, this._rsColor, this._projection), Z(this, t), (s === N.SCENE3D || s === N.COLUMBUS_VIEW) && (this.depthTestAgainstTerrain || (K.push(this._clearDepthCommand), s === N.SCENE3D && K.push(this._depthCommand))) } B.pick && Y.pickList.push(this._depthCommand), Y.empty() || i.push(Y) } } }, K.prototype.isDestroyed = function() { return !1 }, K.prototype.destroy = function() { return this._northPoleCommand.vertexArray = this._northPoleCommand.vertexArray && this._northPoleCommand.vertexArray.destroy(), this._southPoleCommand.vertexArray = this._southPoleCommand.vertexArray && this._southPoleCommand.vertexArray.destroy(), this._surfaceShaderSet = this._surfaceShaderSet && this._surfaceShaderSet.destroy(), this._northPoleCommand.shaderProgram = this._northPoleCommand.shaderProgram && this._northPoleCommand.shaderProgram.release(), this._southPoleCommand.shaderProgram = this._northPoleCommand.shaderProgram, this._depthCommand.shaderProgram = this._depthCommand.shaderProgram && this._depthCommand.shaderProgram.release(), this._depthCommand.vertexArray = this._depthCommand.vertexArray && this._depthCommand.vertexArray.destroy(), this._surface = this._surface && this._surface.destroy(), this._oceanNormalMap = this._oceanNormalMap && this._oceanNormalMap.destroy(), o(this) }, K }), r("Scene/isatCesiumTerrainProvider", ["../Core/defaultValue", "../Core/defined", "../Core/loadArrayBuffer", "../Core/throttleRequestByServer", "../Core/writeTextToCanvas", "../Core/DeveloperError", "../Core/Event", "./Credit", "./GeographicTilingScheme", "./HeightmapTerrainData", "./TerrainProvider", "../ThirdParty/when"], function(e, t, r, i, n, o, a, s, l, u, c, h) { "use strict"; var d = function(e) { if (!t(e) || !t(e.url)) throw new o("description.url is required.");
  6259. this._url = e.url, this._proxy = e.proxy, this._tilingScheme = new l({ numberOfLevelZeroTilesX: 2, numberOfLevelZeroTilesY: 1 }), this._heightmapWidth = 65, this._levelZeroMaximumGeometricError = c.getEstimatedLevelZeroGeometricErrorForAHeightmap(this._tilingScheme.getEllipsoid(), this._heightmapWidth, this._tilingScheme.getNumberOfXTilesAtLevel(0)), this._terrainDataStructure = { heightScale: .2, heightOffset: -1e3, elementsPerHeight: 1, stride: 1, elementMultiplier: 256, isBigEndian: !1 }, this._errorEvent = new a; var r = e.credit; "string" == typeof r && (r = new s(r)), this._credit = r }; return d.prototype.requestTileGeometry = function(n, o, a, s) { var l = this._tilingScheme.getNumberOfYTilesAtLevel(a),
  6260. c = this._url + "/" + a + "/" + n + "/" + (l - o - 1) + ".terrain",
  6261. d = this._proxy;
  6262. t(d) && (c = d.getURL(c)); var m; if (s = e(s, !0)) { if (m = i(c, r), !t(m)) return void 0 } else m = r(c); var p = this; return h(m, function(e) { var t = new Uint16Array(e, 0, p._heightmapWidth * p._heightmapWidth); return new u({ buffer: t, childTileMask: new Uint8Array(e, t.byteLength, 1)[0], waterMask: new Uint8Array(e, t.byteLength + 1, e.byteLength - t.byteLength - 1), width: p._heightmapWidth, height: p._heightmapWidth, structure: p._terrainDataStructure }) }) }, d.prototype.getErrorEvent = function() { return this._errorEvent }, d.prototype.getLevelMaximumGeometricError = function(e) { return this._levelZeroMaximumGeometricError / (1 << e) }, d.prototype.getCredit = function() { return this._credit }, d.prototype.getTilingScheme = function() { return this._tilingScheme }, d.prototype.hasWaterMask = function() { return !0 }, d.prototype.isReady = function() { return !0 }, d }), r("Scene/CompositePrimitive", ["../Core/createGuid", "../Core/defined", "../Core/destroyObject", "../Core/DeveloperError"], function(e, t, r, i) { "use strict";
  6263. function n(e, t) { if (!e.contains(t)) throw new i("primitive is not in this composite."); return e._primitives.indexOf(t) } var o = function() { this._centralBody = void 0, this._primitives = [], this._guid = e(), this.destroyPrimitives = !0, this.show = !0 }; return o.prototype.getCentralBody = function() { return this._centralBody }, o.prototype.setCentralBody = function(e) { this._centralBody = this.destroyPrimitives && this._centralBody && this._centralBody.destroy(), this._centralBody = e }, o.prototype.add = function(e) { if (!t(e)) throw new i("primitive is required."); var r = e._external = e._external || {},
  6264. n = r._composites = r._composites || {};
  6265. n[this._guid] = { composite: this }, this._primitives.push(e) }, o.prototype.remove = function(e) { if (this.contains(e)) { var t = this._primitives.indexOf(e); if (-1 !== t) return this._primitives.splice(t, 1), delete e._external._composites[this._guid], this.destroyPrimitives && e.destroy(), !0 } return !1 }, o.prototype.removeAll = function() { if (this.destroyPrimitives)
  6266. for (var e = this._primitives, t = e.length, r = 0; t > r; ++r) e[r].destroy();
  6267. this._primitives = [] }, o.prototype.contains = function(e) { return !!(e && e._external && e._external._composites && e._external._composites[this._guid]) }, o.prototype.raise = function(e) { if (t(e)) { var r = n(this, e),
  6268. i = this._primitives; if (r !== i.length - 1) { var o = i[r];
  6269. i[r] = i[r + 1], i[r + 1] = o } } }, o.prototype.raiseToTop = function(e) { if (t(e)) { var r = n(this, e),
  6270. i = this._primitives;
  6271. r !== i.length - 1 && (i.splice(r, 1), i.push(e)) } }, o.prototype.lower = function(e) { if (t(e)) { var r = n(this, e),
  6272. i = this._primitives; if (0 !== r) { var o = i[r];
  6273. i[r] = i[r - 1], i[r - 1] = o } } }, o.prototype.lowerToBottom = function(e) { if (t(e)) { var r = n(this, e),
  6274. i = this._primitives;
  6275. 0 !== r && (i.splice(r, 1), i.unshift(e)) } }, o.prototype.get = function(e) { if (!t(e)) throw new i("index is required."); return this._primitives[e] }, o.prototype.getLength = function() { return this._primitives.length }, o.prototype.update = function(e, t, r) { if (this.show) { this._centralBody && this._centralBody.update(e, t, r); for (var i = this._primitives, n = i.length, o = 0; n > o; ++o) i[o].update(e, t, r) } }, o.prototype.isDestroyed = function() { return !1 }, o.prototype.destroy = function() { return this.removeAll(), this._centralBody = this.destroyPrimitives && this._centralBody && this._centralBody.destroy(), r(this) }, o }), r("Scene/DebugAppearance", ["../Core/defaultValue", "../Core/defined", "../Core/DeveloperError", "./Appearance"], function(e, t, r, i) { "use strict"; var n = function(n) { n = e(n, e.EMPTY_OBJECT); var o = n.attributeName; if (!t(o)) throw new r("options.attributeName is required."); var a, s = e(n.glslDatatype, "vec3"),
  6276. l = "v_" + o; if ("normal" === o || "binormal" === o | "tangent" === o) a = "vec4 getColor() { return vec4((" + l + " + vec3(1.0)) * 0.5, 1.0); }\n";
  6277. else switch ("st" === o && (s = "vec2"), s) {
  6278. case "float":
  6279. a = "vec4 getColor() { return vec4(vec3(" + l + "), 1.0); }\n"; break;
  6280. case "vec2":
  6281. a = "vec4 getColor() { return vec4(" + l + ", 0.0, 1.0); }\n"; break;
  6282. case "vec3":
  6283. a = "vec4 getColor() { return vec4(" + l + ", 1.0); }\n"; break;
  6284. case "vec4":
  6285. a = "vec4 getColor() { return " + l + "; }\n"; break;
  6286. default:
  6287. throw new r("options.glslDatatype must be float, vec2, vec3, or vec4.") }
  6288. var u = "attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute " + s + " " + o + ";\n" + "varying " + s + " " + l + ";\n" + "void main()\n" + "{\n" + "vec4 p = czm_translateRelativeToEye(position3DHigh, position3DLow);\n" + l + " = " + o + ";\n" + "gl_Position = czm_modelViewProjectionRelativeToEye * p;\n" + "}",
  6289. c = "varying " + s + " " + l + ";\n" + a + "\n" + "void main()\n" + "{\n" + "gl_FragColor = getColor();\n" + "}";
  6290. this.material = void 0, this.vertexShaderSource = e(n.vertexShaderSource, u), this.fragmentShaderSource = e(n.fragmentShaderSource, c), this.renderState = e(n.renderState, i.getDefaultRenderState(!1, !1)), this.attributeName = o, this.glslDatatype = s, this.translucent = e(n.translucent, !1), this.closed = e(n.closed, !1) }; return n.prototype.getFragmentShaderSource = i.prototype.getFragmentShaderSource, n }), r("Scene/ExtentPrimitive", ["../Core/DeveloperError", "../Core/defaultValue", "../Core/defined", "../Core/Color", "../Core/destroyObject", "../Core/Math", "../Core/Extent", "../Core/Ellipsoid", "../Core/GeometryInstance", "../Core/ExtentGeometry", "./EllipsoidSurfaceAppearance", "./Primitive", "./Material"], function(e, t, r, i, n, o, a, s, l, u, c, h, d) {
  6291. "use strict";
  6292. var m = function(e) { e = t(e, t.EMPTY_OBJECT), this.ellipsoid = t(e.ellipsoid, s.WGS84), this._ellipsoid = void 0, this.extent = a.clone(e.extent), this._extent = void 0, this.granularity = t(e.granularity, o.RADIANS_PER_DEGREE), this._granularity = void 0, this.height = t(e.height, 0), this._height = void 0, this.rotation = t(e.rotation, 0), this._rotation = void 0, this.textureRotationAngle = t(e.textureRotationAngle, 0), this._textureRotationAngle = void 0, this.show = t(e.show, !0); var r = d.fromType(void 0, d.ColorType);
  6293. r.uniforms.color = new i(1, 1, 0, .5), this.material = t(e.material, r), this.asynchronous = t(e.asynchronous, !0), this._primitive = void 0 };
  6294. return m.prototype.update = function(t, i, n) { if (!r(this.ellipsoid)) throw new e("this.ellipsoid must be defined."); if (!r(this.material)) throw new e("this.material must be defined."); if (this.granularity < 0) throw new e("this.granularity and scene2D/scene3D overrides must be greater than zero."); if (this.show && r(this.extent)) { if (!a.equals(this._extent, this.extent) || this._ellipsoid !== this.ellipsoid || this._granularity !== this.granularity || this._height !== this.height || this._rotation !== this.rotation || this._textureRotationAngle !== this.textureRotationAngle) { this._extent = a.clone(this.extent, this._extent), this._ellipsoid = this.ellipsoid, this._granularity = this.granularity, this._height = this.height, this._rotation = this.rotation, this._textureRotationAngle = this.textureRotationAngle; var o = new l({ geometry: new u({ extent: this.extent, vertexFormat: c.VERTEX_FORMAT, ellipsoid: this.ellipsoid, granularity: this.granularity, height: this.height, rotation: this.rotation, stRotation: this.textureRotationAngle }), id: this });
  6295. r(this._primitive) && this._primitive.destroy(), this._primitive = new h({ geometryInstances: o, appearance: new c({ aboveGround: this.height > 0 }), asynchronous: this.asynchronous }) } this._primitive.appearance.material = this.material, this._primitive.update(t, i, n) } }, m.prototype.isDestroyed = function() { return !1 }, m.prototype.destroy = function() { return this._primitive = this._primitive && this._primitive.destroy(), n(this) }, m
  6296. }), r("Scene/FrameState", ["../Core/defined", "../Core/Cartesian2", "./SceneMode"], function(e, t, r) { "use strict"; var i = function(e) { this.mode = r.SCENE3D, this.morphTime = r.SCENE3D.morphTime, this.frameNumber = 0, this.time = void 0, this.scene2D = { projection: void 0 }, this.camera = void 0, this.cullingVolume = void 0, this.occluder = void 0, this.canvasDimensions = new t, this.passes = { color: !1, pick: !1, overlay: !1 }, this.creditDisplay = e }; return i }), r("Scene/FrustumCommands", ["../Core/defaultValue"], function(e) { "use strict"; var t = function(t, r) { this.near = e(t, 0), this.far = e(r, 0), this.commands = [] }; return t }), r("Scene/GridImageryProvider", ["../Core/defaultValue", "../Core/Color", "../Core/Event", "./GeographicTilingScheme"], function(e, t, r, i) { "use strict"; var n = function(n) { n = e(n, {}), this._tilingScheme = e(n.tilingScheme, new i), this._cells = e(n.cells, 8), this._color = e(n.color, new t(1, 1, 1, .4)), this._glowColor = e(n.glowColor, new t(0, 1, 0, .05)), this._glowWidth = e(n.glowWidth, 6), this._backgroundColor = e(n.backgroundColor, new t(0, .5, 0, .2)), this._errorEvent = new r, this._tileWidth = e(n.tileWidth, 256), this._tileHeight = e(n.tileHeight, 256), this._canvasSize = e(n.canvasSize, 256), this._canvas = this._createGridCanvas() }; return n.prototype.getProxy = function() { return void 0 }, n.prototype.getTileWidth = function() { return this._tileWidth }, n.prototype.getTileHeight = function() { return this._tileHeight }, n.prototype.getMaximumLevel = function() { return void 0 }, n.prototype.getMinimumLevel = function() { return void 0 }, n.prototype.getTilingScheme = function() { return this._tilingScheme }, n.prototype.getExtent = function() { return this._tilingScheme.getExtent() }, n.prototype.getTileDiscardPolicy = function() { return void 0 }, n.prototype.getErrorEvent = function() { return this._errorEvent }, n.prototype.isReady = function() { return !0 }, n.prototype._drawGrid = function(e) { for (var t = 0, r = this._canvasSize, i = 0; i <= this._cells; ++i) { var n = i / this._cells,
  6297. o = 1 + n * (r - 1);
  6298. e.moveTo(o, t), e.lineTo(o, r), e.moveTo(t, o), e.lineTo(r, o) } e.stroke() }, n.prototype._createGridCanvas = function() { var e = document.createElement("canvas");
  6299. e.width = this._canvasSize, e.height = this._canvasSize; var t = 0,
  6300. r = this._canvasSize,
  6301. i = e.getContext("2d"),
  6302. n = this._backgroundColor.toCssColorString();
  6303. i.fillStyle = n, i.fillRect(t, t, r, r); var o = this._glowColor.toCssColorString();
  6304. i.strokeStyle = o, i.lineWidth = this._glowWidth, i.strokeRect(t, t, r, r), this._drawGrid(i), i.lineWidth = .5 * this._glowWidth, i.strokeRect(t, t, r, r), this._drawGrid(i); var a = this._color.toCssColorString(); return i.strokeStyle = a, i.lineWidth = 2, i.strokeRect(t, t, r, r), i.lineWidth = 1, this._drawGrid(i), e }, n.prototype.requestImage = function() { return this._canvas }, n.prototype.getCredit = function() { return void 0 }, n }), r("Scene/NeverTileDiscardPolicy", [], function() { "use strict"; var e = function() {}; return e.prototype.isReady = function() { return !0 }, e.prototype.shouldDiscardImage = function() { return !1 }, e }), r("Scene/OpenStreetMapImageryProvider", ["../Core/defaultValue", "../Core/defined", "../Core/DeveloperError", "../Core/Event", "../Core/writeTextToCanvas", "./ImageryProvider", "./WebMercatorTilingScheme", "./Credit"], function(e, t, r, i, n, o, a, s) { "use strict";
  6305. function l(e, r, i, n) { var o = e._url + n + "/" + r + "/" + i + "." + e._fileExtension,
  6306. a = e._proxy; return t(a) && (o = a.getURL(o)), o } var u = /\/$/,
  6307. c = new s("MapQuest, Open Street Map and contributors, CC-BY-SA"),
  6308. h = function(t) { t = e(t, {}); var r = e(t.url, "http://tile.openstreetmap.org/");
  6309. u.test(r) || (r += "/"), this._url = r, this._fileExtension = e(t.fileExtension, "png"), this._proxy = t.proxy, this._tileDiscardPolicy = t.tileDiscardPolicy, this._tilingScheme = new a, this._tileWidth = 256, this._tileHeight = 256, this._maximumLevel = e(t.maximumLevel, 18), this._extent = e(t.extent, this._tilingScheme.getExtent()), this._errorEvent = new i, this._ready = !0; var n = e(t.credit, c); "string" == typeof n && (n = new s(n)), this._credit = n }; return h.prototype.getUrl = function() { return this._url }, h.prototype.getProxy = function() { return this._proxy }, h.prototype.getTileWidth = function() { if (!this._ready) throw new r("getTileWidth must not be called before the imagery provider is ready."); return this._tileWidth }, h.prototype.getTileHeight = function() { if (!this._ready) throw new r("getTileHeight must not be called before the imagery provider is ready."); return this._tileHeight }, h.prototype.getMaximumLevel = function() { if (!this._ready) throw new r("getMaximumLevel must not be called before the imagery provider is ready."); return this._maximumLevel }, h.prototype.getMinimumLevel = function() { if (!this._ready) throw new r("getMinimumLevel must not be called before the imagery provider is ready."); return 0 }, h.prototype.getTilingScheme = function() { if (!this._ready) throw new r("getTilingScheme must not be called before the imagery provider is ready."); return this._tilingScheme }, h.prototype.getExtent = function() { if (!this._ready) throw new r("getExtent must not be called before the imagery provider is ready."); return this._extent }, h.prototype.getTileDiscardPolicy = function() { if (!this._ready) throw new r("getTileDiscardPolicy must not be called before the imagery provider is ready."); return this._tileDiscardPolicy }, h.prototype.getErrorEvent = function() { return this._errorEvent }, h.prototype.isReady = function() { return this._ready }, h.prototype.requestImage = function(e, t, i) { if (!this._ready) throw new r("requestImage must not be called before the imagery provider is ready."); var n = l(this, e, t, i); return o.loadImage(this, n) }, h.prototype.getCredit = function() { return this._credit }, h }), r("Scene/OrthographicFrustum", ["../Core/defined", "../Core/DeveloperError", "../Core/destroyObject", "../Core/Cartesian2", "../Core/Cartesian3", "../Core/Cartesian4", "../Core/Matrix4", "../Scene/CullingVolume"], function(e, t, r, i, n, o, a, s) { "use strict";
  6310. function l(r) { if (!(e(r.right) && e(r.left) && e(r.top) && e(r.bottom) && e(r.near) && e(r.far))) throw new t("right, left, top, bottom, near, or far parameters are not set."); if (r.top !== r._top || r.bottom !== r._bottom || r.left !== r._left || r.right !== r._right || r.near !== r._near || r.far !== r._far) { if (r.left > r.right) throw new t("right must be greater than left."); if (r.bottom > r.top) throw new t("top must be greater than bottom."); if (r.near <= 0 || r.near > r.far) throw new t("near must be greater than zero and less than far.");
  6311. r._left = r.left, r._right = r.right, r._top = r.top, r._bottom = r.bottom, r._near = r.near, r._far = r.far, r._orthographicMatrix = a.computeOrthographicOffCenter(r.left, r.right, r.bottom, r.top, r.near, r.far) } } var u = function() { this.left = void 0, this._left = void 0, this.right = void 0, this._right = void 0, this.top = void 0, this._top = void 0, this.bottom = void 0, this._bottom = void 0, this.near = 1, this._near = this.near, this.far = 5e8, this._far = this.far, this._cullingVolume = new s, this._orthographicMatrix = void 0 };
  6312. u.prototype.getProjectionMatrix = function() { return l(this), this._orthographicMatrix }; var c = new n,
  6313. h = new n,
  6314. d = new n; return u.prototype.computeCullingVolume = function(r, i, a) { if (!e(r)) throw new t("position is required."); if (!e(i)) throw new t("direction is required."); if (!e(a)) throw new t("up is required."); var s = this._cullingVolume.planes,
  6315. l = this.top,
  6316. u = this.bottom,
  6317. m = this.right,
  6318. p = this.left,
  6319. f = this.near,
  6320. v = this.far,
  6321. y = n.cross(i, a, c),
  6322. g = h;
  6323. n.multiplyByScalar(i, f, g), n.add(r, g, g); var _ = d;
  6324. n.multiplyByScalar(y, p, _), n.add(g, _, _); var w = s[0]; return e(w) || (w = s[0] = new o), w.x = y.x, w.y = y.y, w.z = y.z, w.w = -n.dot(y, _), n.multiplyByScalar(y, m, _), n.add(g, _, _), w = s[1], e(w) || (w = s[1] = new o), w.x = -y.x, w.y = -y.y, w.z = -y.z, w.w = -n.dot(y.negate(), _), n.multiplyByScalar(a, u, _), n.add(g, _, _), w = s[2], e(w) || (w = s[2] = new o), w.x = a.x, w.y = a.y, w.z = a.z, w.w = -n.dot(a, _), n.multiplyByScalar(a, l, _), n.add(g, _, _), w = s[3], e(w) || (w = s[3] = new o), w.x = -a.x, w.y = -a.y, w.z = -a.z, w.w = -n.dot(a.negate(), _), w = s[4], e(w) || (w = s[4] = new o), w.x = i.x, w.y = i.y, w.z = i.z, w.w = -n.dot(i, g), n.multiplyByScalar(i, v, _), n.add(r, _, _), w = s[5], e(w) || (w = s[5] = new o), w.x = -i.x, w.y = -i.y, w.z = -i.z, w.w = -n.dot(i.negate(), _), this._cullingVolume }, u.prototype.getPixelSize = function(r) { if (l(this), !e(r)) throw new t("canvasDimensions is required."); var n = r.x,
  6325. o = r.y; if (0 >= n) throw new t("canvasDimensions.x must be greater than zero."); if (0 >= o) throw new t("canvasDimensions.y must be greater than zero."); var a = this.right - this.left,
  6326. s = this.top - this.bottom,
  6327. u = a / n,
  6328. c = s / o; return new i(u, c) }, u.prototype.clone = function() { var e = new u; return e.left = this.left, e.right = this.right, e.top = this.top, e.bottom = this.bottom, e.near = this.near, e.far = this.far, e }, u.prototype.equals = function(t) { return e(t) && this.right === t.right && this.left === t.left && this.top === t.top && this.bottom === t.bottom && this.near === t.near && this.far === t.far }, u }), r("Shaders/Appearances/PerInstanceColorAppearanceVS", [], function() { "use strict"; return "attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute vec3 normal;\nattribute vec4 color;\nvarying vec3 v_positionEC;\nvarying vec3 v_normalEC;\nvarying vec4 v_color;\nvoid main()\n{\nvec4 p = czm_computePosition();\nv_positionEC = (czm_modelViewRelativeToEye * p).xyz;\nv_normalEC = czm_normal * normal;\nv_color = color;\ngl_Position = czm_modelViewProjectionRelativeToEye * p;\n}\n" }), r("Shaders/Appearances/PerInstanceColorAppearanceFS", [], function() { "use strict"; return "varying vec3 v_positionEC;\nvarying vec3 v_normalEC;\nvarying vec4 v_color;\nvoid main()\n{\nvec3 positionToEyeEC = -v_positionEC;\nvec3 normalEC;\n#ifdef FACE_FORWARD\nnormalEC = normalize(faceforward(v_normalEC, vec3(0.0, 0.0, 1.0), -v_normalEC));\n#else\nnormalEC = normalize(v_normalEC);\n#endif\nczm_materialInput materialInput;\nmaterialInput.normalEC = normalEC;\nmaterialInput.positionToEyeEC = positionToEyeEC;\nczm_material material = czm_getDefaultMaterial(materialInput);\nmaterial.diffuse = v_color.rgb;\nmaterial.alpha = v_color.a;\ngl_FragColor = czm_phong(normalize(positionToEyeEC), material);\n}\n" }), r("Shaders/Appearances/PerInstanceFlatColorAppearanceVS", [], function() { "use strict"; return "attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute vec4 color;\nvarying vec4 v_color;\nvoid main()\n{\nvec4 p = czm_computePosition();\nv_color = color;\ngl_Position = czm_modelViewProjectionRelativeToEye * p;\n}\n" }), r("Shaders/Appearances/PerInstanceFlatColorAppearanceFS", [], function() { "use strict"; return "varying vec4 v_color;\nvoid main()\n{\ngl_FragColor = v_color;\n}\n" }), r("Scene/PerInstanceColorAppearance", ["../Core/defaultValue", "../Core/VertexFormat", "./Appearance", "../Shaders/Appearances/PerInstanceColorAppearanceVS", "../Shaders/Appearances/PerInstanceColorAppearanceFS", "../Shaders/Appearances/PerInstanceFlatColorAppearanceVS", "../Shaders/Appearances/PerInstanceFlatColorAppearanceFS"], function(e, t, r, i, n, o, a) { "use strict"; var s = function(t) { t = e(t, e.EMPTY_OBJECT); var l = e(t.translucent, !0),
  6329. u = e(t.closed, !1),
  6330. c = e(t.flat, !1),
  6331. h = c ? o : i,
  6332. d = c ? a : n,
  6333. m = c ? s.FLAT_VERTEX_FORMAT : s.VERTEX_FORMAT;
  6334. this.material = void 0, this.vertexShaderSource = e(t.vertexShaderSource, h), this.fragmentShaderSource = e(t.fragmentShaderSource, d), this.renderState = e(t.renderState, r.getDefaultRenderState(l, u)), this.vertexFormat = m, this.flat = c, this.faceForward = e(t.faceForward, !1), this.translucent = l, this.closed = u }; return s.VERTEX_FORMAT = t.POSITION_AND_NORMAL, s.FLAT_VERTEX_FORMAT = t.POSITION_ONLY, s.prototype.getFragmentShaderSource = r.prototype.getFragmentShaderSource, s }), r("Scene/PerformanceDisplay", ["../Core/BoundingRectangle", "../Core/Color", "../Core/defaultValue", "../Core/defined", "../Core/destroyObject", "../Renderer/PixelFormat", "./Material", "./ViewportQuad"], function(e, t, r, i, n, o, a, s) { "use strict"; var l = t.fromCssColorString("#e52"),
  6335. u = t.fromCssColorString("#de3"),
  6336. c = t.fromCssColorString("rgba(0, 0, 30, 0.9)"),
  6337. h = new e(0, 0, 80, 40),
  6338. d = function(e) { e = r(e, r.EMPTY_OBJECT), this._fpsColor = r(e.fpsColor, l).toCssColorString(), this._frameTimeColor = r(e.frameTimeColor, u).toCssColorString(), this._backgroundColor = r(e.backgroundColor, c).toCssColorString(), this._font = r(e.font, "bold 10px Helvetica,Arial,sans-serif"), this._rectangle = r(e.rectangle, h), this._canvas = document.createElement("canvas"), this._canvas.width = this._rectangle.width, this._canvas.height = this._rectangle.height, this._canvasContext = this._canvas.getContext("2d"), this._canvasContext.font = this._font, this._canvasContext.lineWidth = 1, this._bufferLength = this._rectangle.width, this._frameTimeSamples = new Array(this._bufferLength), this._fpsSamples = new Array(this._bufferLength); for (var t = 0; t < this._bufferLength; t++) this._frameTimeSamples[t] = this._fpsSamples[t] = 0;
  6339. this._frameTimeIndex = 0, this._fpsIndex = 0, this._lastFpsSampleTime = void 0, this._frameCount = 0, this._quad = void 0, this._time = void 0, this._texture = void 0, this._viewportHeight = 0 }; return d.prototype.update = function(e, t, r) { if (!i(this._time)) return this._lastFpsSampleTime = this._time = Date.now(), void 0; var n = this._time,
  6340. l = this._time = Date.now(),
  6341. u = l - n;
  6342. this._frameTimeSamples[this._frameTimeIndex++] = u, this._frameTimeIndex >= this._bufferLength && (this._frameTimeIndex = 0), this._frameCount++; var c = this._fps,
  6343. h = l - this._lastFpsSampleTime;
  6344. h > 1e3 && (c = this._fps = 0 | 1e3 * this._frameCount / h, this._fpsSamples[this._fpsIndex++] = c, this._fpsIndex >= this._bufferLength && (this._fpsIndex = 0), this._lastFpsSampleTime = l, this._frameCount = 0); var d = this._canvasContext,
  6345. m = this._rectangle.width,
  6346. p = this._rectangle.height;
  6347. d.clearRect(0, 0, m, p), d.fillStyle = this._backgroundColor, d.fillRect(0, 0, m, p), i(c) && (d.fillStyle = this._fpsColor, d.textAlign = "left", d.fillText(c + " FPS", 1, 10)), d.fillStyle = this._frameTimeColor, d.textAlign = "right", d.fillText(u + " MS", m - 1, 10); for (var f = 0; f < this._bufferLength; f++) c = this._fpsSamples[(f + this._fpsIndex) % this._bufferLength], c > 0 && this._drawLine(this._fpsColor, f, c / 100), u = this._frameTimeSamples[(f + this._frameTimeIndex) % this._bufferLength], u > 0 && this._drawLine(this._frameTimeColor, f, u / 200);
  6348. i(this._quad) || (this._quad = new s(void 0, a.fromType(e, a.ImageType))), i(this._texture) ? this._texture.copyFrom(this._canvas) : (this._texture = e.createTexture2D({ source: this._canvas, pixelFormat: o.RGBA }), this._quad.material.uniforms.image = this._texture); var v = e.getCanvas().clientHeight; if (v !== this._viewportHeight) { this._viewportHeight = v; var y = this._quad.rectangle;
  6349. y.x = this._rectangle.x, y.y = v - p - this._rectangle.y, y.width = m, y.height = p } this._quad.update(e, t, r) }, d.prototype._drawLine = function(e, t, r) { var i = this._canvasContext,
  6350. n = this._rectangle.height,
  6351. o = n - 10;
  6352. t = .5 + t, i.beginPath(), i.strokeStyle = e, i.moveTo(t, n); var a = r * o;
  6353. a > o && (a = o); var s = n - a;
  6354. i.lineTo(t, s), i.stroke() }, d.prototype.destroy = function() { return this._quad = this._quad.destroy(), n(this) }, d }), r("Scene/RectangularPyramidSensorVolume", ["../Core/clone", "../Core/Color", "../Core/defaultValue", "../Core/defined", "../Core/destroyObject", "../Core/DeveloperError", "../Core/Math", "../Core/Matrix4", "../Renderer/BufferUsage", "./Material", "./CustomSensorVolume"], function(e, t, r, i, n, o, a, s, l, u, c) { "use strict"; var h = function(n) { n = r(n, r.EMPTY_OBJECT), this.show = r(n.show, !0), this.showIntersection = r(n.showIntersection, !0), this.showThroughEllipsoid = r(n.showThroughEllipsoid, !1), this.modelMatrix = s.clone(r(n.modelMatrix, s.IDENTITY)), this.bufferUsage = r(n.bufferUsage, l.STATIC_DRAW), this.radius = r(n.radius, Number.POSITIVE_INFINITY), this.xHalfAngle = r(n.xHalfAngle, a.PI_OVER_TWO), this._xHalfAngle = void 0, this.yHalfAngle = r(n.yHalfAngle, a.PI_OVER_TWO), this._yHalfAngle = void 0, this.material = i(n.material) ? n.material : u.fromType(void 0, u.ColorType), this.intersectionColor = t.clone(r(n.intersectionColor, t.WHITE)), this.intersectionWidth = r(n.intersectionWidth, 5); var o = e(n);
  6355. o._pickIdThis = r(n._pickIdThis, this), this._customSensor = new c(o) }; return h.prototype.update = function(e, t, r) { if (this.xHalfAngle > a.PI_OVER_TWO || this.yHalfAngle > a.PI_OVER_TWO) throw new o("this.xHalfAngle and this.yHalfAngle must each be less than or equal to 90 degrees."); var i = this._customSensor; if (i.show = this.show, i.showIntersection = this.showIntersection, i.showThroughEllipsoid = this.showThroughEllipsoid, i.modelMatrix = this.modelMatrix, i.bufferUsage = this.bufferUsage, i.radius = this.radius, i.material = this.material, i.intersectionColor = this.intersectionColor, i.intersectionWidth = this.intersectionWidth, this._xHalfAngle !== this.xHalfAngle || this._yHalfAngle !== this.yHalfAngle) { this._xHalfAngle = this.xHalfAngle, this._yHalfAngle = this.yHalfAngle; var n = Math.tan(Math.min(this.xHalfAngle, a.toRadians(89))),
  6356. s = Math.tan(Math.min(this.yHalfAngle, a.toRadians(89))),
  6357. l = Math.atan(n / s),
  6358. u = Math.atan(Math.sqrt(n * n + s * s));
  6359. i.setDirections([{ clock: l, cone: u }, { clock: a.toRadians(180) - l, cone: u }, { clock: a.toRadians(180) + l, cone: u }, { clock: -l, cone: u }]) } i.update(e, t, r) }, h.prototype.isDestroyed = function() { return !1 }, h.prototype.destroy = function() { return this._customSensor = this._customSensor && this._customSensor.destroy(), n(this) }, h }), r("Scene/ScreenSpaceCameraController", ["../Core/defined", "../Core/destroyObject", "../Core/Cartesian2", "../Core/Cartesian3", "../Core/Cartesian4", "../Core/Cartographic", "../Core/DeveloperError", "../Core/Ellipsoid", "../Core/KeyboardEventModifier", "../Core/FAR", "../Core/IntersectionTests", "../Core/Math", "../Core/Matrix4", "../Core/Ray", "../Core/Transforms", "./AnimationCollection", "./CameraEventAggregator", "./CameraEventType", "./CameraColumbusViewMode", "./SceneMode"], function(e, t, r, i, n, o, a, s, l, u, c, h, d, m, p, f, v, y, g, _) {
  6360. "use strict";
  6361. function w(e, t) { if (0 > e) return 0; var r = 25 * (1 - t); return Math.exp(-r * e) }
  6362. function C(e) { return e.startPosition.equalsEpsilon(e.endPosition, h.EPSILON14) }
  6363. function x(t, i, n, o, a) { var s = t.getButtonPressTime(),
  6364. l = t.getButtonReleaseTime(),
  6365. u = s && l && (l.getTime() - s.getTime()) / 1e3,
  6366. c = new Date,
  6367. h = l && (c.getTime() - l.getTime()) / 1e3; if (s && l && k > u) { var d = w(h, i); if (e(o[a])) o[a] = { startPosition: o[a].endPosition.clone(), endPosition: new r(o[a].endPosition.x + o[a].motion.x * d, o[a].endPosition.y + o[a].motion.y * d), motion: new r };
  6368. else { var m = t.getLastMovement(); if (!m || C(m)) return; var p = .5 * (m.endPosition.x - m.startPosition.x),
  6369. f = .5 * (m.endPosition.y - m.startPosition.y);
  6370. o[a] = { startPosition: new r(m.startPosition.x, m.startPosition.y), endPosition: new r(m.startPosition.x + p * d, m.startPosition.y + f * d), motion: new r(p, f) } } if (isNaN(o[a].endPosition.x) || isNaN(o[a].endPosition.y) || C(o[a])) return o[a] = void 0, void 0;
  6371. t.isButtonDown() || n(o, o[a]) } else o[a] = void 0 }
  6372. function S(t, r, i, n, o) { var a = 1;
  6373. e(o) && (a = h.clamp(Math.abs(o), .25, 1)); var s = t.minimumZoomDistance * a,
  6374. l = t.maximumZoomDistance,
  6375. u = n - s,
  6376. c = i * u;
  6377. c = h.clamp(c, t._minimumZoomRate, t._maximumZoomRate); var d = r.endPosition.y - r.startPosition.y,
  6378. m = d / t._canvas.clientHeight;
  6379. m = Math.min(m, t.maximumMovementRatio); var p = c * m;
  6380. p > 0 && Math.abs(n - s) < 1 || 0 > p && Math.abs(n - l) < 1 || (s > n - p ? p = n - s - 1 : n - p > l && (p = n - l), t._cameraController.zoomIn(p)) }
  6381. function E(e, t) { var r = e._cameraController,
  6382. i = r.getPickRay(t.startPosition, U).origin,
  6383. n = r.getPickRay(t.endPosition, W).origin;
  6384. r.moveRight(i.x - n.x), r.moveUp(i.y - n.y) }
  6385. function b(e, t) { S(e, t, e._zoomFactor, e._cameraController.getMagnitude()) }
  6386. function T(e, t) { var i = e._canvas.clientWidth,
  6387. n = e._canvas.clientHeight,
  6388. o = G;
  6389. o.x = 2 / i * t.startPosition.x - 1, o.y = 2 / n * (n - t.startPosition.y) - 1, r.normalize(o, o); var a = H;
  6390. a.x = 2 / i * t.endPosition.x - 1, a.y = 2 / n * (n - t.endPosition.y) - 1, r.normalize(a, a); var s = Math.acos(o.x);
  6391. o.y < 0 && (s = h.TWO_PI - s); var l = Math.acos(a.x);
  6392. a.y < 0 && (l = h.TWO_PI - l); var u = l - s;
  6393. e._cameraController.twistRight(u) }
  6394. function A(e, t) { var r = e._rotateFactor * e._rotateRateRangeAdjustment;
  6395. r > e._maximumRotateRate && (r = e._maximumRotateRate), r < e._minimumRotateRate && (r = e._minimumRotateRate); var i = (t.endPosition.x - t.startPosition.x) / e._canvas.clientWidth;
  6396. i = Math.min(i, e.maximumMovementRatio); var n = 4 * r * i * Math.PI;
  6397. e._cameraController.twistRight(n) }
  6398. function M(t) { var r = t._translateHandler,
  6399. i = t._zoomHandler,
  6400. n = t._zoomWheelHandler,
  6401. o = t._pinchHandler,
  6402. a = r.isMoving() && r.getMovement(),
  6403. s = i.isMoving() && i.getMovement(),
  6404. l = n.isMoving() && n.getMovement(),
  6405. u = o.isMoving() && o.getMovement(); if ((r.isButtonDown() || i.isButtonDown() || l) && t._animationCollection.removeAll(), t.enableTranslate && (a && E(t, r.getMovement()), !a && t.inertiaTranslate < 1 && x(r, t.inertiaTranslate, E, t, "_lastInertiaTranslateMovement")), t.enableZoom && (s ? b(t, i.getMovement()) : l ? b(t, n.getMovement()) : u && b(t, o.getMovement().distance), !s && t.inertiaZoom < 1 && x(i, t.inertiaZoom, b, t, "_lastInertiaZoomMovement"), !l && t.inertiaZoom < 1 && x(n, t.inertiaZoom, b, t, "_lastInertiaWheelZoomMovement"), !u && t.inertiaZoom < 1 && x(o, t.inertiaZoom, b, t, "_lastInertiaZoomMovement")), t.enableRotate && (t._rotateHandler.isMoving() && T(t, t._rotateHandler.getMovement()), u && A(t, o.getMovement().angleAndHeight)), !(r.isButtonDown() || i.isButtonDown() || t._lastInertiaZoomMovement || t._lastInertiaTranslateMovement || t._animationCollection.contains(t._animation))) { var c = t._cameraController.createCorrectPositionAnimation(t.bounceAnimationTime);
  6406. e(c) && (t._animation = t._animationCollection.add(c)) } return t._animationCollection.update(), !0 }
  6407. function P(e, t) { var r = e._cameraController,
  6408. n = r.getPickRay(t.startPosition, j),
  6409. o = r.getPickRay(t.endPosition, Y),
  6410. a = i.UNIT_X,
  6411. s = n.origin,
  6412. l = n.direction,
  6413. u = -a.dot(s) / a.dot(l),
  6414. c = i.multiplyByScalar(l, u, X);
  6415. i.add(s, c, c), s = o.origin, l = o.direction, u = -a.dot(s) / a.dot(l); var d = i.multiplyByScalar(l, u, Z);
  6416. i.add(s, d, d); var m = i.subtract(c, d, K),
  6417. p = m.x;
  6418. m.x = m.y, m.y = m.z, m.z = p; var f = m.magnitude();
  6419. f > h.EPSILON6 && (i.normalize(m, m), r.move(m, f)) }
  6420. function D(e, t) { var r = J;
  6421. r.x = e._canvas.clientWidth / 2, r.y = e._canvas.clientHeight / 2; var n = e._cameraController.getPickRay(r, Q),
  6422. o = i.UNIT_X,
  6423. a = n.origin,
  6424. l = n.direction,
  6425. u = -o.dot(a) / o.dot(l),
  6426. c = i.multiplyByScalar(l, u, $);
  6427. i.add(a, c, c); var h = d.fromTranslation(c, et),
  6428. m = e._ellipsoid;
  6429. e.setEllipsoid(s.UNIT_SPHERE), L(e, t, h, i.UNIT_Z), e.setEllipsoid(m) }
  6430. function I(e, t) { var r = tt;
  6431. r.x = e._canvas.clientWidth / 2, r.y = e._canvas.clientHeight / 2; var n = e._cameraController.getPickRay(r, rt),
  6432. o = i.UNIT_X,
  6433. a = n.origin,
  6434. s = n.direction,
  6435. l = -o.dot(a) / o.dot(s);
  6436. S(e, t, e._zoomFactor, l) }
  6437. function O(t) { var r = t._zoomHandler,
  6438. i = r.isMoving() && r.getMovement(),
  6439. n = t._zoomWheelHandler,
  6440. o = n.isMoving() && n.getMovement(),
  6441. a = t._pinchHandler,
  6442. s = a.isMoving() && a.getMovement(),
  6443. l = t._translateHandler,
  6444. u = l.isMoving() && l.getMovement(),
  6445. c = t._rotateHandler,
  6446. h = c.isMoving() && c.getMovement(),
  6447. d = t._spinHandler,
  6448. m = d.isMoving() && d.getMovement(),
  6449. p = t._lookHandler,
  6450. f = p.isMoving() && p.getMovement(),
  6451. v = c.isButtonDown() || d.isButtonDown() || l.isButtonDown() || r.isButtonDown() || f || o || s; if (t.columbusViewMode === g.LOCKED) t.enableRotate && (m && L(t, d.getMovement()), !v && t.inertiaSpin >= 0 && t.inertiaSpin < 1 && x(d, t.inertiaSpin, L, t, "_lastInertiaSpinMovement")), t.enableZoom && (i ? N(t, r.getMovement()) : o ? N(t, n.getMovement()) : s && N(t, a.getMovement().distance), !v && t.inertiaZoom >= 0 && t.inertiaZoom < 1 && x(r, t.inertiaZoom, N, t, "_lastInertiaZoomMovement"), !v && t.inertiaZoom >= 0 && t.inertiaZoom < 1 && x(n, t.inertiaZoom, N, t, "_lastInertiaWheelZoomMovement"), !v && t.inertiaZoom >= 0 && t.inertiaZoom < 1 && x(a, t.inertiaZoom, N, t, "_lastInertiaZoomMovement"));
  6452. else { if (v && t._animationCollection.removeAll(), t.enableTilt && (h && D(t, c.getMovement()), s && D(t, a.getMovement().angleAndHeight), !v && t.inertiaSpin >= 0 && t.inertiaSpin < 1 && x(c, t.inertiaSpin, D, t, "_lastInertiaTiltMovement"), !v && t.inertiaZoom >= 0 && t.inertiaZoom < 1 && x(a, t.inertiaZoom, I, t, "_lastInertiaZoomMovement")), t.enableTranslate && (u && P(t, l.getMovement()), !v && t.inertiaTranslate >= 0 && t.inertiaTranslate < 1 && x(l, t.inertiaTranslate, P, t, "_lastInertiaTranslateMovement")), t.enableZoom && (i ? I(t, r.getMovement()) : o ? I(t, n.getMovement()) : s && I(t, a.getMovement().distance), !v && t.inertiaZoom >= 0 && t.inertiaZoom < 1 && x(r, t.inertiaZoom, I, t, "_lastInertiaZoomMovement"), !v && t.inertiaZoom >= 0 && t.inertiaZoom < 1 && x(n, t.inertiaZoom, I, t, "_lastInertiaWheelZoomMovement"), !v && t.inertiaZoom >= 0 && t.inertiaZoom < 1 && x(a, t.inertiaZoom, I, t, "_lastInertiaZoomMovement")), t.enableLook && f && B(t, p.getMovement()), !(v || t._lastInertiaZoomMovement || t._lastInertiaTranslateMovement || t._animationCollection.contains(t._animation))) { var y = t._cameraController.createCorrectPositionAnimation(t.bounceAnimationTime);
  6453. e(y) && (t._animation = t._animationCollection.add(y)) } t._animationCollection.update() } return !0 }
  6454. function R(t, r) { e(t._cameraController.pickEllipsoid(r.startPosition, t._ellipsoid, it)) ? z(t, r) : L(t, r) }
  6455. function L(t, r, n, o, a) { var s = t._cameraController,
  6456. l = s.constrainedAxis;
  6457. e(o) && (s.constrainedAxis = o); var u = s._camera.position.magnitude(),
  6458. c = t._rotateFactor * (u - t._rotateRateRangeAdjustment);
  6459. c > t._maximumRotateRate && (c = t._maximumRotateRate), c < t._minimumRotateRate && (c = t._minimumRotateRate); var m = (r.startPosition.x - r.endPosition.x) / t._canvas.clientWidth,
  6460. p = (r.startPosition.y - r.endPosition.y) / t._canvas.clientHeight;
  6461. m = Math.min(m, t.maximumMovementRatio), p = Math.min(p, t.maximumMovementRatio); var f = 2 * c * m * Math.PI,
  6462. v = c * p * Math.PI; if (e(s.constrainedAxis) && !e(n)) { var y = s._camera,
  6463. g = y.position.normalize(),
  6464. _ = g.equalsEpsilon(s.constrainedAxis, h.EPSILON2),
  6465. w = g.equalsEpsilon(s.constrainedAxis.negate(), h.EPSILON2); if (!_ && !w) { var C;
  6466. C = i.dot(y.position, y.direction) + 1 < h.EPSILON4 ? y.up : y.direction; var x;
  6467. x = i.equalsEpsilon(s.constrainedAxis, y.position.normalize(), h.EPSILON2) ? y.right : i.cross(s.constrainedAxis, y.position).normalize(); var S = i.dot(y.right, x),
  6468. E = h.sign(S) < 0 ? -1 : 1;
  6469. S = Math.abs(S); var b = i.dot(C, s.constrainedAxis),
  6470. T = i.dot(C, x),
  6471. A = b > 0 && T > 0 || 0 > b && 0 > T ? -1 : 1;
  6472. b = Math.abs(b); var M = v;
  6473. v = E * (v * b - A * f * (1 - S)), f = E * (f * S + A * M * (1 - b)) } } if (s.rotateRight(f, n), s.rotateUp(v, n), e(a)) { var P = i.clone(s._camera.getDirectionWC(), nt),
  6474. D = n.inverseTransformation();
  6475. d.multiplyByVector(D, P, P); var I = -i.dot(P, o),
  6476. O = Math.acos(I);
  6477. O > a && (O -= a, s.rotateUp(-O, n)) } s.constrainedAxis = l }
  6478. function z(t, r) { var n = t._cameraController,
  6479. o = n.pickEllipsoid(r.startPosition, t._ellipsoid, ot),
  6480. a = n.pickEllipsoid(r.endPosition, t._ellipsoid, at); if (e(o) && e(a))
  6481. if (o = n._camera.worldToCameraCoordinates(o, o), a = n._camera.worldToCameraCoordinates(a, a), e(n.constrainedAxis)) { var s = n.constrainedAxis,
  6482. l = i.mostOrthogonalAxis(s, st);
  6483. i.cross(l, s, l), i.normalize(l, l); var u = i.cross(s, l, lt),
  6484. c = i.magnitude(o),
  6485. d = i.dot(s, o),
  6486. m = Math.acos(d / c),
  6487. p = i.multiplyByScalar(s, d, ut);
  6488. i.subtract(o, p, p), i.normalize(p, p); var f = i.magnitude(a),
  6489. v = i.dot(s, a),
  6490. y = Math.acos(v / f),
  6491. g = i.multiplyByScalar(s, v, ct);
  6492. i.subtract(a, g, g), i.normalize(g, g); var _ = Math.acos(i.dot(p, l));
  6493. i.dot(p, u) < 0 && (_ = h.TWO_PI - _); var w = Math.acos(i.dot(g, l));
  6494. i.dot(g, u) < 0 && (w = h.TWO_PI - w); var C, x = _ - w;
  6495. C = i.equalsEpsilon(s, n._camera.position, h.EPSILON2) ? n._camera.right : i.cross(s, n._camera.position); var S, E = i.cross(s, C, st),
  6496. b = i.dot(E, i.subtract(o, s, lt)),
  6497. T = i.dot(E, i.subtract(a, s, lt));
  6498. S = b > 0 && T > 0 ? y - m : b > 0 && 0 >= T ? i.dot(n._camera.position, s) > 0 ? -m - y : m + y : m - y, n.rotateRight(x), n.rotateUp(S) } else { i.normalize(o, o), i.normalize(a, a); var A = i.dot(o, a),
  6499. M = i.cross(o, a, st); if (1 > A && !M.equalsEpsilon(i.ZERO, h.EPSILON14)) { var P = Math.acos(A);
  6500. n.rotate(M, P) } } }
  6501. function N(e, t) { var r = e._cameraController._camera,
  6502. n = e._ellipsoid,
  6503. o = n.cartesianToCartographic(r.position).height,
  6504. a = i.normalize(r.position, ht);
  6505. S(e, t, e._zoomFactor, o, i.dot(a, r.direction)) }
  6506. function F(t, r) { var n = t._cameraController,
  6507. o = t._ellipsoid,
  6508. a = .25 * t.minimumZoomDistance,
  6509. l = o.cartesianToCartographic(t._cameraController._camera.position).height; if (!(l - a - 1 < h.EPSILON3 && r.endPosition.y - r.startPosition.y < 0)) { var u = dt;
  6510. u.x = t._canvas.clientWidth / 2, u.y = t._canvas.clientHeight / 2; var d, m = n.getPickRay(u, mt),
  6511. f = c.rayEllipsoid(m, o); if (e(f)) d = m.getPoint(f.start, ft);
  6512. else { var v = c.grazingAltitudeLocation(m, o); if (!e(v)) return; var y = o.cartesianToCartographic(v, pt);
  6513. y.height = 0, d = o.cartographicToCartesian(y, ft) } var g = n._camera;
  6514. d = g.worldToCameraCoordinates(d, d); var _ = p.eastNorthUpToFixedFrame(d, o, vt),
  6515. w = t._ellipsoid;
  6516. t.setEllipsoid(s.UNIT_SPHERE); var C = .25 * a / i.subtract(d, g.position).magnitude();
  6517. L(t, r, _, i.UNIT_Z, h.PI_OVER_TWO - C), t.setEllipsoid(w) } }
  6518. function B(t, r) { var i = t._cameraController,
  6519. n = yt;
  6520. n.x = r.startPosition.x, n.y = 0; var o = gt;
  6521. o.x = r.endPosition.x, o.y = 0; var a = i.getPickRay(n, _t).direction,
  6522. s = i.getPickRay(o, wt).direction,
  6523. l = 0,
  6524. u = a.dot(s);
  6525. 1 > u && (l = Math.acos(u)), l = r.startPosition.x > r.endPosition.x ? -l : l; var c = t._horizontalRotationAxis;
  6526. e(c) ? i.look(c, l) : i.lookLeft(l), n.x = 0, n.y = r.startPosition.y, o.x = 0, o.y = r.endPosition.y, a = i.getPickRay(n, _t).direction, s = i.getPickRay(o, wt).direction, l = 0, u = a.dot(s), 1 > u && (l = Math.acos(u)), l = r.startPosition.y > r.endPosition.y ? -l : l, i.lookUp(l) }
  6527. function V(e) { var t = e._spinHandler,
  6528. r = e._zoomHandler,
  6529. i = e._zoomWheelHandler,
  6530. n = e._pinchHandler,
  6531. o = t.isMoving() && t.getMovement(),
  6532. a = r.isMoving() && r.getMovement(),
  6533. s = i.isMoving() && i.getMovement(),
  6534. l = n.isMoving() && n.getMovement(),
  6535. u = e._rotateHandler,
  6536. c = u.isMoving() && u.getMovement(),
  6537. h = e._lookHandler,
  6538. d = h.isMoving() && h.getMovement(),
  6539. m = t.isButtonDown() || r.isButtonDown() || u.isButtonDown() || d || s || l; return e.enableRotate && (o && R(e, t.getMovement()), !m && e.inertiaSpin >= 0 && e.inertiaSpin < 1 && x(t, e.inertiaSpin, R, e, "_lastInertiaSpinMovement")), e.enableTilt && (c && F(e, u.getMovement()), l && F(e, n.getMovement().angleAndHeight), !m && e.inertiaSpin >= 0 && e.inertiaSpin < 1 && x(u, e.inertiaSpin, F, e, "_lastInertiaTiltMovement"), !m && e.inertiaSpin >= 0 && e.inertiaSpin < 1 && x(n, e.inertiaSpin, F, e, "_lastInertiaTiltMovement")), e.enableZoom && (a ? N(e, r.getMovement()) : s ? N(e, i.getMovement()) : l && N(e, n.getMovement().distance), !m && e.inertiaZoom >= 0 && e.inertiaZoom < 1 && x(r, e.inertiaZoom, N, e, "_lastInertiaZoomMovement"), !m && e.inertiaZoom >= 0 && e.inertiaZoom < 1 && x(i, e.inertiaZoom, N, e, "_lastInertiaWheelZoomMovement"), !m && e.inertiaZoom >= 0 && e.inertiaZoom < 1 && x(n, e.inertiaZoom, N, e, "_lastInertiaZoomMovement")), e.enableLook && d && B(e, h.getMovement()), !0 }
  6540. var q = function(t, r) { if (!e(t)) throw new a("canvas is required."); if (!e(r)) throw new a("cameraController is required.");
  6541. this.enableTranslate = !0, this.enableZoom = !0, this.enableRotate = !0, this.enableTilt = !0, this.enableLook = !0, this.inertiaSpin = .9, this.inertiaTranslate = .9, this.inertiaZoom = .8, this.maximumMovementRatio = .1, this.columbusViewMode = g.FREE, this.bounceAnimationTime = 3e3, this.minimumZoomDistance = 20, this.maximumZoomDistance = Number.POSITIVE_INFINITY, this._canvas = t, this._cameraController = r, this._ellipsoid = s.WGS84, this._spinHandler = new v(t, y.LEFT_DRAG), this._translateHandler = new v(t, y.LEFT_DRAG), this._lookHandler = new v(t, y.LEFT_DRAG, l.SHIFT), this._rotateHandler = new v(t, y.MIDDLE_DRAG), this._zoomHandler = new v(t, y.RIGHT_DRAG), this._zoomWheelHandler = new v(t, y.WHEEL), this._pinchHandler = new v(t, y.PINCH), this._lastInertiaSpinMovement = void 0, this._lastInertiaZoomMovement = void 0, this._lastInertiaTranslateMovement = void 0, this._lastInertiaWheelZoomMovement = void 0, this._lastInertiaTiltMovement = void 0, this._animationCollection = new f, this._animation = void 0, this._horizontalRotationAxis = void 0; var i = this._ellipsoid.getMaximumRadius();
  6542. this._zoomFactor = 5, this._rotateFactor = 1 / i, this._rotateRateRangeAdjustment = i, this._maximumRotateRate = 1.77, this._minimumRotateRate = 2e-4, this._translateFactor = 1, this._minimumZoomRate = 20, this._maximumZoomRate = u };
  6543. q.prototype.getEllipsoid = function() { return this._ellipsoid }, q.prototype.setEllipsoid = function(e) {
  6544. e = e || s.WGS84;
  6545. var t = e.getMaximumRadius();
  6546. this._ellipsoid = e, this._rotateFactor = 1 / t, this._rotateRateRangeAdjustment = t
  6547. };
  6548. var k = .4,
  6549. U = new m,
  6550. W = new m,
  6551. G = new r,
  6552. H = new r,
  6553. j = new m,
  6554. Y = new m,
  6555. X = new i,
  6556. Z = new i,
  6557. K = new i,
  6558. J = new r,
  6559. Q = new m,
  6560. $ = new i,
  6561. et = new d,
  6562. tt = new r,
  6563. rt = new m,
  6564. it = new i,
  6565. nt = n.ZERO.clone(),
  6566. ot = n.UNIT_W.clone(),
  6567. at = n.UNIT_W.clone(),
  6568. st = new i,
  6569. lt = new i,
  6570. ut = new i,
  6571. ct = new i,
  6572. ht = new i,
  6573. dt = new r,
  6574. mt = new m,
  6575. pt = new o,
  6576. ft = n.UNIT_W.clone(),
  6577. vt = new d,
  6578. yt = new r,
  6579. gt = new r,
  6580. _t = new m,
  6581. wt = new m;
  6582. return q.prototype.update = function(e) { e === _.SCENE2D ? M(this) : e === _.COLUMBUS_VIEW ? (this._horizontalRotationAxis = i.UNIT_Z, O(this)) : e === _.SCENE3D && (this._horizontalRotationAxis = void 0, V(this)) }, q.prototype.isDestroyed = function() { return !1 }, q.prototype.destroy = function() { return this._spinHandler = this._spinHandler && this._spinHandler.destroy(), this._translateHandler = this._translateHandler && this._translateHandler.destroy(), this._lookHandler = this._lookHandler && this._lookHandler.destroy(), this._rotateHandler = this._rotateHandler && this._rotateHandler.destroy(), this._zoomHandler = this._zoomHandler && this._zoomHandler.destroy(), this._zoomWheelHandler = this._zoomWheelHandler && this._zoomWheelHandler.destroy(), this._pinchHandler = this._pinchHandler && this._pinchHandler.destroy(), t(this) }, q
  6583. }), r("Shaders/PostProcessFilters/AdditiveBlend", [], function() { "use strict"; return "uniform sampler2D u_texture0;\nuniform sampler2D u_texture1;\nuniform vec2 u_center;\nuniform float u_radius;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\nvec4 color0 = texture2D(u_texture0, v_textureCoordinates);\nvec4 color1 = texture2D(u_texture1, v_textureCoordinates);\nfloat x = length(gl_FragCoord.xy - u_center) / u_radius;\nfloat t = smoothstep(0.5, 0.8, x);\ngl_FragColor = mix(color0 + color1, color0, t);\n}\n" }), r("Shaders/PostProcessFilters/BrightPass", [], function() { "use strict"; return "uniform sampler2D u_texture;\nuniform float u_avgLuminance;\nuniform float u_threshold;\nuniform float u_offset;\nvarying vec2 v_textureCoordinates;\nfloat key(float avg)\n{\nfloat guess = 1.5 - (1.5 / (avg * 0.1 + 1.0));\nreturn max(0.0, guess) + 0.1;\n}\nvoid main()\n{\nvec4 color = texture2D(u_texture, v_textureCoordinates);\nvec3 xyz = czm_RGBToXYZ(color.rgb);\nfloat luminance = xyz.r;\nfloat scaledLum = key(u_avgLuminance) * luminance / u_avgLuminance;\nfloat brightLum = max(scaledLum - u_threshold, 0.0);\nfloat brightness = brightLum / (u_offset + brightLum);\nxyz.r = brightness;\ngl_FragColor = vec4(czm_XYZToRGB(xyz), 1.0);\n}\n" }), r("Shaders/PostProcessFilters/GaussianBlur1D", [], function() { "use strict"; return "#define SAMPLES 8\nuniform float delta;\nuniform float sigma;\nuniform float direction;\nuniform sampler2D u_texture;\nuniform vec2 u_step;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\nvec2 st = v_textureCoordinates;\nvec2 dir = vec2(1.0 - direction, direction);\nvec3 g;\ng.x = 1.0 / (sqrt(czm_twoPi) * sigma);\ng.y = exp((-0.5 * delta * delta) / (sigma * sigma));\ng.z = g.y * g.y;\nvec4 result = texture2D(u_texture, st) * g.x;\nfor (int i = 1; i < SAMPLES; ++i)\n{\ng.xy *= g.yz;\nvec2 offset = float(i) * dir * u_step;\nresult += texture2D(u_texture, st - offset) * g.x;\nresult += texture2D(u_texture, st + offset) * g.x;\n}\ngl_FragColor = result;\n}\n" }), r("Shaders/PostProcessFilters/PassThrough", [], function() { "use strict"; return "uniform sampler2D u_texture;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\ngl_FragColor = texture2D(u_texture, v_textureCoordinates);\n}\n" }), r("Scene/SunPostProcess", ["../Core/BoundingRectangle", "../Core/Cartesian2", "../Core/Cartesian4", "../Core/Color", "../Core/ComponentDatatype", "../Core/defaultValue", "../Core/defined", "../Core/destroyObject", "../Core/Geometry", "../Core/GeometryAttribute", "../Core/Math", "../Core/Matrix4", "../Core/PrimitiveType", "../Core/Transforms", "../Renderer/BufferUsage", "../Renderer/ClearCommand", "../Renderer/DrawCommand", "../Renderer/PassState", "../Renderer/PixelDatatype", "../Renderer/PixelFormat", "../Renderer/RenderbufferFormat", "../Shaders/PostProcessFilters/AdditiveBlend", "../Shaders/PostProcessFilters/BrightPass", "../Shaders/PostProcessFilters/GaussianBlur1D", "../Shaders/PostProcessFilters/PassThrough", "../Shaders/ViewportQuadVS"], function(e, t, r, i, n, o, a, s, l, u, c, h, d, m, p, f, v, y, g, _, w, C, x, S, E, b) { "use strict";
  6584. function T(e) { var t = e.cache.viewportQuad_vertexArray; if (a(t)) return t; var r = new l({ attributes: { position: new u({ componentDatatype: n.FLOAT, componentsPerAttribute: 2, values: [-1, -1, 1, -1, 1, 1, -1, 1] }), textureCoordinates: new u({ componentDatatype: n.FLOAT, componentsPerAttribute: 2, values: [0, 0, 1, 0, 1, 1, 0, 1] }) }, primitiveType: d.TRIANGLES }); return t = e.createVertexArrayFromGeometry({ geometry: r, attributeIndices: M, bufferUsage: p.STATIC_DRAW }), e.cache.viewportQuad_vertexArray = t, t } var A = function() { this._fbo = void 0, this._downSampleFBO1 = void 0, this._downSampleFBO2 = void 0, this._clearFBO1Command = void 0, this._clearFBO2Command = void 0, this._downSampleCommand = void 0, this._brightPassCommand = void 0, this._blurXCommand = void 0, this._blurYCommand = void 0, this._blendCommand = void 0, this._fullScreenCommand = void 0, this._downSamplePassState = new y, this._downSamplePassState.scissorTest = { enable: !0, rectangle: new e }, this._upSamplePassState = new y, this._upSamplePassState.scissorTest = { enabled: !0, rectangle: new e }, this._uCenter = new t, this._uRadius = void 0 };
  6585. A.prototype.clear = function(e, t) { var r = this._clearFBO1Command;
  6586. i.clone(o(t, i.BLACK), r.color), r.execute(e), r = this._clearFBO2Command, i.clone(o(t, i.BLACK), r.color), r.execute(e) }, A.prototype.execute = function(e) { this._downSampleCommand.execute(e, this._downSamplePassState), this._brightPassCommand.execute(e, this._downSamplePassState), this._blurXCommand.execute(e, this._downSamplePassState), this._blurYCommand.execute(e, this._downSamplePassState), this._fullScreenCommand.execute(e), this._blendCommand.execute(e, this._upSamplePassState) }; var M = { position: 0, textureCoordinates: 1 },
  6587. P = new e,
  6588. D = new e,
  6589. I = new r,
  6590. O = new t,
  6591. R = new t,
  6592. L = new h; return A.prototype.update = function(e) { var r = e.getCanvas(),
  6593. n = r.clientWidth,
  6594. o = r.clientHeight,
  6595. s = this; if (!a(this._fbo)) { this._fbo = e.createFramebuffer(), this._downSampleFBO1 = e.createFramebuffer(), this._downSampleFBO2 = e.createFramebuffer(), this._clearFBO1Command = new f, this._clearFBO1Command.color = new i, this._clearFBO1Command.framebuffer = this._downSampleFBO1, this._clearFBO2Command = new f, this._clearFBO2Command.color = new i, this._clearFBO2Command.framebuffer = this._downSampleFBO2; var l = d.TRIANGLE_FAN,
  6596. u = T(e),
  6597. p = this._downSampleCommand = new v;
  6598. p.owner = this, p.primitiveType = l, p.vertexArray = u, p.shaderProgram = e.getShaderCache().getShaderProgram(b, E, M), p.uniformMap = {}, p.framebuffer = this._downSampleFBO1; var y = this._brightPassCommand = new v;
  6599. y.owner = this, y.primitiveType = l, y.vertexArray = u, y.shaderProgram = e.getShaderCache().getShaderProgram(b, x, M), y.uniformMap = { u_avgLuminance: function() { return .5 }, u_threshold: function() { return .25 }, u_offset: function() { return .1 } }, y.framebuffer = this._downSampleFBO2; var A = 1,
  6600. z = 2,
  6601. N = this._blurXCommand = new v;
  6602. N.owner = this, N.primitiveType = l, N.vertexArray = u, N.shaderProgram = e.getShaderCache().getShaderProgram(b, S, M), N.uniformMap = { delta: function() { return A }, sigma: function() { return z }, direction: function() { return 0 } }, N.framebuffer = this._downSampleFBO1; var F = this._blurYCommand = new v;
  6603. F.owner = this, F.primitiveType = l, F.vertexArray = u, F.shaderProgram = e.getShaderCache().getShaderProgram(b, S, M), F.uniformMap = { delta: function() { return A }, sigma: function() { return z }, direction: function() { return 1 } }, F.framebuffer = this._downSampleFBO2; var B = this._blendCommand = new v;
  6604. B.owner = this, B.primitiveType = l, B.vertexArray = u, B.shaderProgram = e.getShaderCache().getShaderProgram(b, C, M), B.uniformMap = { u_center: function() { return s._uCenter }, u_radius: function() { return s._uRadius } }; var V = this._fullScreenCommand = new v;
  6605. V.owner = this, V.primitiveType = l, V.vertexArray = u, V.shaderProgram = e.getShaderCache().getShaderProgram(b, E, M), V.uniformMap = {} } var q = Math.pow(2, Math.ceil(Math.log(n) / Math.log(2)) - 2),
  6606. k = Math.pow(2, Math.ceil(Math.log(o) / Math.log(2)) - 2),
  6607. U = Math.max(q, k),
  6608. W = P;
  6609. W.width = n, W.height = o; var G = D;
  6610. G.width = U, G.height = U; var H = this._fbo,
  6611. j = H.getColorTexture(); if (!a(j) || j.getWidth() !== n || j.getHeight() !== o) { H.setColorTexture(e.createTexture2D({ width: n, height: o })), e.getDepthTexture() ? H.setDepthTexture(e.createTexture2D({ width: n, height: o, pixelFormat: _.DEPTH_COMPONENT, pixelDatatype: g.UNSIGNED_SHORT })) : H.setDepthRenderbuffer(e.createRenderbuffer({ format: w.DEPTH_COMPONENT16 })), this._downSampleFBO1.setColorTexture(e.createTexture2D({ width: U, height: U })), this._downSampleFBO2.setColorTexture(e.createTexture2D({ width: U, height: U })); var Y = e.createRenderState({ viewport: G }),
  6612. X = e.createRenderState();
  6613. this._downSampleCommand.uniformMap.u_texture = function() { return H.getColorTexture() }, this._downSampleCommand.renderState = Y, this._brightPassCommand.uniformMap.u_texture = function() { return s._downSampleFBO1.getColorTexture() }, this._brightPassCommand.renderState = Y, this._blurXCommand.uniformMap.u_texture = function() { return s._downSampleFBO2.getColorTexture() }, this._blurXCommand.uniformMap.u_step = function() { return new t(1 / U, 1 / U) }, this._blurXCommand.renderState = Y, this._blurYCommand.uniformMap.u_texture = function() { return s._downSampleFBO1.getColorTexture() }, this._blurYCommand.uniformMap.u_step = function() { return new t(1 / U, 1 / U) }, this._blurYCommand.renderState = Y, this._blendCommand.uniformMap.u_texture0 = function() { return H.getColorTexture() }, this._blendCommand.uniformMap.u_texture1 = function() { return s._downSampleFBO2.getColorTexture() }, this._blendCommand.renderState = X, this._fullScreenCommand.uniformMap.u_texture = function() { return H.getColorTexture() }, this._fullScreenCommand.renderState = X } var Z = e.getUniformState(),
  6614. K = Z.getSunPositionWC(),
  6615. J = Z.getView(),
  6616. Q = Z.getViewProjection(),
  6617. $ = Z.getProjection(),
  6618. et = h.computeViewportTransformation(W, 0, 1, L),
  6619. tt = h.multiplyByPoint(J, K, I),
  6620. rt = m.pointToWindowCoordinates(Q, et, K, O);
  6621. tt.x += c.SOLAR_RADIUS; var it = m.pointToWindowCoordinates($, et, tt, tt),
  6622. nt = 2 * 30 * t.magnitude(t.subtract(it, rt, it)),
  6623. ot = R;
  6624. ot.x = nt, ot.y = nt; var at = this._upSamplePassState.scissorTest.rectangle; return at.x = Math.max(rt.x - .5 * ot.x, 0), at.y = Math.max(rt.y - .5 * ot.y, 0), at.width = Math.min(ot.x, n), at.height = Math.min(ot.y, o), t.clone(rt, this._uCenter), this._uRadius = .5 * Math.max(ot.x, ot.y), et = h.computeViewportTransformation(G, 0, 1, L), rt = m.pointToWindowCoordinates(Q, et, K, O), ot.x *= q / n, ot.y *= k / o, at = this._downSamplePassState.scissorTest.rectangle, at.x = Math.max(rt.x - .5 * ot.x, 0), at.y = Math.max(rt.y - .5 * ot.y, 0), at.width = Math.min(ot.x, n), at.height = Math.min(ot.y, o), this._downSamplePassState.context = e, this._upSamplePassState.context = e, this._fbo }, A.prototype.isDestroyed = function() { return !1 }, A.prototype.destroy = function() { return this._fbo = this._fbo && this._fbo.destroy(), this._downSampleFBO1 = this._downSampleFBO1 && this._downSampleFBO1.destroy(), this._downSampleFBO2 = this._downSampleFBO2 && this._downSampleFBO2.destroy(), this._downSampleCommand = this._downSampleCommand && this._downSampleCommand.shaderProgram && this._downSampleCommand.shaderProgram.release(), this._brightPassCommand = this._brightPassCommand && this._brightPassCommand.shaderProgram && this._brightPassCommand.shaderProgram.release(), this._blurXCommand = this._blurXCommand && this._blurXCommand.shaderProgram && this._blurXCommand.shaderProgram.release(), this._blurYCommand = this._blurYCommand && this._blurYCommand.shaderProgram && this._blurYCommand.shaderProgram.release(), this._blendCommand = this._blendCommand && this._blendCommand.shaderProgram && this._blendCommand.shaderProgram.release(), this._fullScreenCommand = this._fullScreenCommand && this._fullScreenCommand.shaderProgram && this._fullScreenCommand.shaderProgram.release(), s(this) }, A }), r("Scene/Scene", ["../Core/Math", "../Core/Color", "../Core/defaultValue", "../Core/defined", "../Core/destroyObject", "../Core/GeographicProjection", "../Core/Ellipsoid", "../Core/Occluder", "../Core/BoundingRectangle", "../Core/BoundingSphere", "../Core/Cartesian2", "../Core/Cartesian3", "../Core/Intersect", "../Core/Interval", "../Core/Matrix4", "../Core/JulianDate", "../Core/EllipsoidGeometry", "../Core/GeometryInstance", "../Core/GeometryPipeline", "../Core/ColorGeometryInstanceAttribute", "../Renderer/Context", "../Renderer/ClearCommand", "../Renderer/PassState", "./Camera", "./ScreenSpaceCameraController", "./CompositePrimitive", "./CullingVolume", "./AnimationCollection", "./SceneMode", "./FrameState", "./OrthographicFrustum", "./PerspectiveOffCenterFrustum", "./FrustumCommands", "./Primitive", "./PerInstanceColorAppearance", "./SunPostProcess", "./CreditDisplay"], function(e, t, r, i, n, o, a, s, l, u, c, h, d, m, p, f, v, y, g, _, w, C, x, S, E, b, T, A, M, P, D, I, O, R, L, z, N) { "use strict";
  6625. function F(e) { e.color = !1, e.pick = !1, e.overlay = !1 }
  6626. function B(e, t, r) { var n = e._camera,
  6627. o = e._frameState;
  6628. o.mode = e.mode, o.morphTime = e.morphTime, o.scene2D = e.scene2D, o.frameNumber = t, o.time = r, o.camera = n, o.cullingVolume = n.frustum.computeCullingVolume(n.getPositionWC(), n.getDirectionWC(), n.getUpWC()), o.occluder = void 0, o.canvasDimensions.x = e._canvas.clientWidth, o.canvasDimensions.y = e._canvas.clientHeight; var a = e._primitives.getCentralBody(); if (e.mode === M.SCENE3D && i(a)) { var l = a.getEllipsoid(),
  6629. c = new s(new u(h.ZERO, l.getMinimumRadius()), n.getPositionWC());
  6630. o.occluder = c } F(o.passes) }
  6631. function V(e, t, r, n, o) { o.length = n; for (var a = 0; n > a; ++a) { var s = Math.max(e, Math.pow(r, a) * e),
  6632. l = Math.min(t, r * s);
  6633. 0 !== a && (s *= .99); var u = o[a];
  6634. i(u) ? (u.near = s, u.far = l) : u = o[a] = new O(s, l) } }
  6635. function q(e, t, r) { e.debugShowFrustums && (t.debugOverlappingFrustums = 0); for (var n = e._frustumCommandsList, o = n.length, a = 0; o > a; ++a) { var s = n[a],
  6636. l = s.near,
  6637. u = s.far; if (!(r.start > u)) { if (r.stop < l) break; if (s.commands[s.index++] = t, e.debugShowFrustums && (t.debugOverlappingFrustums |= 1 << a), t.executeInClosestFrustum) break } } if (e.debugShowFrustums) { var c = e.debugFrustumStatistics.commandsInFrustums;
  6638. c[t.debugOverlappingFrustums] = i(c[t.debugOverlappingFrustums]) ? c[t.debugOverlappingFrustums] + 1 : 1, ++e.debugFrustumStatistics.totalCommands } }
  6639. function k(e, t) { var n = e._commandList,
  6640. o = e._frameState.cullingVolume,
  6641. a = e._camera,
  6642. s = a.getDirectionWC(),
  6643. l = a.getPositionWC();
  6644. e.debugShowFrustums && (e.debugFrustumStatistics = { totalCommands: 0, commandsInFrustums: {} }); for (var u = e._frustumCommandsList, c = u.length, h = 0; c > h; ++h) u[h].index = 0; var m, f = Number.MAX_VALUE,
  6645. v = Number.MIN_VALUE,
  6646. y = !1;
  6647. e._frameState.mode === M.SCENE3D && (m = e._frameState.occluder); for (var g = Q.planes, _ = 0; 5 > _; ++_) g[_] = o.planes[_];
  6648. o = Q; for (var w = n.length, x = 0; w > x; ++x)
  6649. for (var S = n[x][t], E = S.length, b = 0; E > b; ++b) { var T = S[b],
  6650. A = T.boundingVolume; if (i(A)) { var P = r(T.modelMatrix, p.IDENTITY),
  6651. D = A.transform(P); if (T.cull && (o.getVisibility(D) === d.OUTSIDE || i(m) && !m.isBoundingSphereVisible(D))) continue;
  6652. $ = D.getPlaneDistances(l, s, $), f = Math.min(f, $.start), v = Math.max(v, $.stop) } else $.start = a.frustum.near, $.stop = a.frustum.far, y = !(T instanceof C);
  6653. q(e, T, $) } y ? (f = a.frustum.near, v = a.frustum.far) : (f = Math.min(Math.max(f, a.frustum.near), a.frustum.far), v = Math.max(Math.min(v, a.frustum.far), f)); var I = e.farToNearRatio,
  6654. O = Math.ceil(Math.log(v / f) / Math.log(I));
  6655. f !== Number.MAX_VALUE && (O !== c || 0 !== u.length && (f < u[0].near || v > u[c - 1].far)) && (V(f, v, I, O, u), k(e, t)) }
  6656. function U(e) { var t = e.shaderProgram.fragmentShaderSource,
  6657. r = t.replace(/void\s+main\s*\(\s*(?:void)?\s*\)/g, "void czm_frustumDebug_main()"),
  6658. i = 1 & e.debugOverlappingFrustums ? "1.0" : "0.0",
  6659. n = 2 & e.debugOverlappingFrustums ? "1.0" : "0.0",
  6660. o = 4 & e.debugOverlappingFrustums ? "1.0" : "0.0",
  6661. a = "void main() \n{ \n czm_frustumDebug_main(); \n gl_FragColor.rgb *= vec3(" + i + ", " + n + ", " + o + "); \n" + "}"; return r + "\n" + a }
  6662. function W(e, t, r) { if (i(e.shaderProgram)) { var n = e.shaderProgram,
  6663. o = {},
  6664. a = n.getVertexAttributes(); for (var s in a) a.hasOwnProperty(s) && (o[s] = a[s].index);
  6665. e.shaderProgram = t.getShaderCache().getShaderProgram(n.vertexShaderSource, U(e), o), e.execute(t, r), e.shaderProgram.release(), e.shaderProgram = n } }
  6666. function G(e, t, n, o) { if ((!i(t.debugCommandFilter) || t.debugCommandFilter(e)) && (t.debugShowFrustums ? W(e, n, o) : e.execute(n, o), e.debugShowBoundingVolume && i(e.boundingVolume))) { if (!i(t._debugSphere)) { var s = v.createGeometry(new v({ ellipsoid: a.UNIT_SPHERE, vertexFormat: L.FLAT_VERTEX_FORMAT }));
  6667. t._debugSphere = new R({ geometryInstances: new y({ geometry: g.toWireframe(s), attributes: { color: new _(1, 0, 0, 1) } }), appearance: new L({ flat: !0, translucent: !1 }), asynchronous: !1 }) } var l = p.multiplyByTranslation(r(e.modelMatrix, p.IDENTITY), e.boundingVolume.center);
  6668. t._debugSphere.modelMatrix = p.multiplyByUniformScale(p.fromTranslation(h.fromArray(l, 12)), e.boundingVolume.radius); var u = [];
  6669. t._debugSphere.update(n, t._frameState, u), u[0].colorList[0].execute(n, o) } }
  6670. function H(e, t) { for (var r = t.mode === M.SCENE3D ? t.occluder : void 0, n = t.cullingVolume, o = Q.planes, a = 0; 5 > a; ++a) o[a] = n.planes[a]; return n = Q, i(e) && (!i(e.boundingVolume) || !e.cull || n.getVisibility(e.boundingVolume) !== d.OUTSIDE && (!i(r) || r.isBoundingSphereVisible(e.boundingVolume))) }
  6671. function j(e, r, n) { var o = e._frameState,
  6672. a = e._camera,
  6673. s = a.frustum.clone(),
  6674. l = e._context,
  6675. u = l.getUniformState(),
  6676. c = o.passes.color && i(e.skyBox) ? e.skyBox.update(l, o) : void 0,
  6677. h = o.passes.color && i(e.skyAtmosphere) ? e.skyAtmosphere.update(l, o) : void 0,
  6678. d = o.passes.color && i(e.sun) ? e.sun.update(l, o) : void 0,
  6679. m = H(d, o);
  6680. m && (r.framebuffer = e._sunPostProcess.update(l)); var p = e._clearColorCommand;
  6681. t.clone(n, p.color), p.execute(l, r), m && e._sunPostProcess.clear(l, e.backgroundColor), s.near = a.frustum.near, s.far = a.frustum.far, u.updateFrustum(s), i(c) && G(c, e, l, r), i(h) && G(h, e, l, r), i(d) && m && (d.execute(l, r), e._sunPostProcess.execute(l), r.framebuffer = void 0); for (var f = e._clearDepthStencilCommand, v = e._frustumCommandsList, y = v.length, g = 0; y > g; ++g) { f.execute(l, r); var _ = y - g - 1,
  6682. w = v[_];
  6683. s.near = w.near, s.far = w.far, u.updateFrustum(s); for (var C = w.commands, x = w.index, S = 0; x > S; ++S) G(C[S], e, l, r) } }
  6684. function Y(e, t) { for (var r = e._context, i = e._commandList, n = i.length, o = 0; n > o; ++o)
  6685. for (var a = i[o].overlayList, s = a.length, l = 0; s > l; ++l) a[l].execute(r, t) }
  6686. function X(e, t) { var r = e._canvas,
  6687. i = e._camera,
  6688. n = i.frustum,
  6689. o = r.clientWidth,
  6690. a = r.clientHeight,
  6691. s = 2 / o * t.x - 1;
  6692. s *= .5 * (n.right - n.left); var l = 2 / a * (a - t.y) - 1;
  6693. l *= .5 * (n.top - n.bottom); var u = i.position;
  6694. u = new h(u.z, u.x, u.y), u.y += s, u.z += l; var d = n.getPixelSize(new c(o, a)),
  6695. m = et; return m.right = .5 * d.x, m.left = -m.right, m.top = .5 * d.y, m.bottom = -m.top, m.near = n.near, m.far = n.far, m.computeCullingVolume(u, i.getDirectionWC(), i.getUpWC()) }
  6696. function Z(e, t, r, i) { var n = e._canvas,
  6697. o = e._camera,
  6698. a = o.frustum,
  6699. s = a.near,
  6700. l = n.clientWidth,
  6701. u = n.clientHeight,
  6702. h = Math.tan(.5 * a.fovy),
  6703. d = a.aspectRatio * h,
  6704. m = 2 / l * t.x - 1,
  6705. p = 2 / u * (u - t.y) - 1,
  6706. f = m * s * d,
  6707. v = p * s * h,
  6708. y = a.getPixelSize(new c(l, u)),
  6709. g = .5 * y.x * r,
  6710. _ = .5 * y.y * i,
  6711. w = tt; return w.top = v + _, w.bottom = v - _, w.right = f + g, w.left = f - g, w.near = s, w.far = a.far, w.computeCullingVolume(o.getPositionWC(), o.getDirectionWC(), o.getUpWC()) }
  6712. function K(e, t, r, i) { return e.mode === M.SCENE2D ? X(e, t, r, i) : Z(e, t, r, i) } var J = function(e, r, n) { var s = new w(e, r);
  6713. i(n) || (n = document.createElement("div"), n.style.position = "absolute", n.style.bottom = "0", n.style["text-shadow"] = "0px 0px 2px #000000", n.style.color = "#ffffff", n.style["font-size"] = "10pt", n.style["padding-right"] = "5px", e.parentNode.appendChild(n)), this._frameState = new P(new N(n)), this._passState = new x(s), this._canvas = e, this._context = s, this._primitives = new b, this._pickFramebuffer = void 0, this._camera = new S(e), this._screenSpaceCameraController = new E(e, this._camera.controller), this._animations = new A, this._shaderFrameCount = 0, this._sunPostProcess = new z, this._commandList = [], this._frustumCommandsList = [], this._clearColorCommand = new C, this._clearColorCommand.color = new t, this._clearColorCommand.owner = !0; var l = new C;
  6714. l.depth = 1, l.stencil = 1, l.owner = this, this._clearDepthStencilCommand = l, this.skyBox = void 0, this.skyAtmosphere = void 0, this.sun = void 0, this.backgroundColor = t.BLACK.clone(), this.mode = M.SCENE3D, this.scene2D = { projection: new o(a.WGS84) }, this.morphTime = 1, this.farToNearRatio = 1e3, this.debugCommandFilter = void 0, this.debugShowFrustums = !1, this.debugFrustumStatistics = void 0, this._debugSphere = void 0; var u = this._camera.frustum.near,
  6715. c = this._camera.frustum.far,
  6716. h = Math.ceil(Math.log(c / u) / Math.log(this.farToNearRatio));
  6717. V(u, c, this.farToNearRatio, h, this._frustumCommandsList), B(this, 0, new f), this.initializeFrame() };
  6718. J.prototype.getCanvas = function() { return this._canvas }, J.prototype.getContext = function() { return this._context }, J.prototype.getPrimitives = function() { return this._primitives }, J.prototype.getCamera = function() { return this._camera }, J.prototype.getScreenSpaceCameraController = function() { return this._screenSpaceCameraController }, J.prototype.getUniformState = function() { return this._context.getUniformState() }, J.prototype.getFrameState = function() { return this._frameState }, J.prototype.getAnimations = function() { return this._animations }; var Q = new T,
  6719. $ = new m;
  6720. J.prototype.initializeFrame = function() { 120 === this._shaderFrameCount++ && (this._shaderFrameCount = 0, this._context.getShaderCache().destroyReleasedShaderPrograms()), this._animations.update(), this._camera.controller.update(this.mode, this.scene2D), this._screenSpaceCameraController.update(this.mode) }, J.prototype.render = function(n) { i(n) || (n = new f); var o = this.getUniformState(),
  6721. a = this._frameState,
  6722. s = e.incrementWrap(a.frameNumber, 15e6, 1);
  6723. B(this, s, n), a.passes.color = !0, a.passes.overlay = !0, a.creditDisplay.beginFrame(), o.update(a); var l = this._context;
  6724. this._commandList.length = 0, this._primitives.update(l, a, this._commandList), k(this, "colorList"); var u = this._passState;
  6725. j(this, u, r(this.backgroundColor, t.BLACK)), Y(this, u), a.creditDisplay.endFrame() }; var et = new D,
  6726. tt = new I,
  6727. rt = 3,
  6728. it = 3,
  6729. nt = new l(0, 0, rt, it),
  6730. ot = new t(0, 0, 0, 0); return J.prototype.pick = function(e) { var t = this._context,
  6731. r = this._primitives,
  6732. n = this._frameState;
  6733. i(this._pickFramebuffer) || (this._pickFramebuffer = t.createPickFramebuffer()), B(this, n.frameNumber, n.time), n.cullingVolume = K(this, e, rt, it), n.passes.pick = !0; var o = this._commandList; return o.length = 0, r.update(t, n, o), k(this, "pickList"), nt.x = e.x - .5 * (rt - 1), nt.y = this._canvas.clientHeight - e.y - .5 * (it - 1), j(this, this._pickFramebuffer.begin(nt), ot), this._pickFramebuffer.end(nt) }, J.prototype.isDestroyed = function() { return !1 }, J.prototype.destroy = function() { return this._screenSpaceCameraController = this._screenSpaceCameraController && this._screenSpaceCameraController.destroy(), this._pickFramebuffer = this._pickFramebuffer && this._pickFramebuffer.destroy(), this._primitives = this._primitives && this._primitives.destroy(), this.skyBox = this.skyBox && this.skyBox.destroy(), this.skyAtmosphere = this.skyAtmosphere && this.skyAtmosphere.destroy(), this._debugSphere = this._debugSphere && this._debugSphere.destroy(), this.sun = this.sun && this.sun.destroy(), this._sunPostProcess = this._sunPostProcess && this._sunPostProcess.destroy(), this._context = this._context && this._context.destroy(), this._frameState.creditDisplay.destroy(), n(this) }, J }), r("Scene/SceneTransitioner", ["../Core/defaultValue", "../Core/defined", "../Core/destroyObject", "../Core/DeveloperError", "../Core/Math", "../Core/Event", "../Core/ScreenSpaceEventHandler", "../Core/ScreenSpaceEventType", "../Core/Ellipsoid", "../Core/Cartesian3", "../Core/Cartesian4", "../Core/Cartographic", "../Core/Matrix4", "../ThirdParty/Tween", "./OrthographicFrustum", "./PerspectiveFrustum", "./SceneMode"], function(e, t, r, i, n, o, a, s, l, u, c, h, d, m, p, f, v) {
  6734. "use strict";
  6735. function y(e, t) { var r = new c(e.position.x, e.position.y, e.position.z, 1),
  6736. i = new c(e.direction.x, e.direction.y, e.direction.z, 0),
  6737. n = new c(e.up.x, e.up.y, e.up.z, 0),
  6738. o = t.inverseTransformation().multiply(e.transform);
  6739. e.transform = t.clone(), e.position = u.fromCartesian4(o.multiplyByVector(r)), e.direction = u.fromCartesian4(o.multiplyByVector(i)), e.up = u.fromCartesian4(o.multiplyByVector(n)), e.right = e.direction.cross(e.up) }
  6740. function g(e, t) { if (e.completeMorphOnUserInput) { e._morphHandler = new a(e._scene.getCanvas()); var r = function() { e._morphCancelled = !0, t(e) };
  6741. e._completeMorph = r, e._morphHandler.setInputAction(r, s.LEFT_DOWN), e._morphHandler.setInputAction(r, s.MIDDLE_DOWN), e._morphHandler.setInputAction(r, s.RIGHT_DOWN), e._morphHandler.setInputAction(r, s.WHEEL) } }
  6742. function _(e) { for (var t = e._scene.getAnimations(), r = 0; r < e._currentAnimations.length; ++r) t.remove(e._currentAnimations[r]);
  6743. e._currentAnimations.length = 0, e._morphHandler = e._morphHandler && e._morphHandler.destroy() }
  6744. function w(e, t, r) { var i = e._scene,
  6745. n = i.getCamera();
  6746. y(n, d.IDENTITY); var o = n.position,
  6747. a = n.direction,
  6748. s = n.up,
  6749. l = e._ellipsoid.getMaximumRadius(),
  6750. c = e._ellipsoid.cartographicToCartesian(new h(0, 0, 10));
  6751. c = c.normalize().multiplyByScalar(2 * l); var p = u.ZERO.subtract(c).normalize(),
  6752. f = p.cross(u.UNIT_Z).normalize(),
  6753. v = f.cross(p),
  6754. g = function(e) { n.position = x(o, c, e.time), n.direction = x(a, p, e.time), n.up = x(s, v, e.time), n.right = n.direction.cross(n.up) },
  6755. _ = i.getAnimations().add({ duration: t, easingFunction: m.Easing.Quartic.Out, startValue: { time: 0 }, stopValue: { time: 1 }, onUpdate: g });
  6756. e._currentAnimations.push(_), P(e, i, 0, 1, t, r) }
  6757. function C(e, t, r) { t = .5 * t; var i = e._scene.getCamera();
  6758. T(e, t, function() { i.frustum = e._cameraCV.frustum.clone(), i.transform = e._cameraCV.transform.clone(), w(e, t, r) }) }
  6759. function x(e, t, r) { return e.lerp(t, r) }
  6760. function S(e, t, r) { var i = e._scene,
  6761. o = i.getCamera(),
  6762. a = o.position,
  6763. s = o.frustum.fovy,
  6764. l = .5 * n.RADIANS_PER_DEGREE,
  6765. u = a.magnitude() * Math.tan(.5 * s);
  6766. o.frustum.far = u / Math.tan(.5 * l) + 1e7; var c = function(e) { o.frustum.fovy = n.lerp(s, l, e.time); var t = u / Math.tan(.5 * o.frustum.fovy);
  6767. o.position = o.position.normalize().multiplyByScalar(t) },
  6768. h = i.getAnimations().add({ duration: t, easingFunction: m.Easing.Quartic.Out, startValue: { time: 0 }, stopValue: { time: 1 }, onUpdate: c, onComplete: function() { o.frustum = e._camera2D.frustum.clone(), r(e) } });
  6769. e._currentAnimations.push(h) }
  6770. function E(e, t, r) { var i = e._scene,
  6771. n = i.getCamera(),
  6772. o = e._ellipsoid.getMaximumRadius();
  6773. y(n, e._cameraCV.transform); var a = n.position.clone(),
  6774. s = n.direction.clone(),
  6775. l = n.up.clone(),
  6776. u = Math.tan(.5 * e._cameraCV.frustum.fovy),
  6777. c = e._cameraCV.frustum.aspectRatio * u,
  6778. h = o * Math.PI / c,
  6779. d = e._camera2D.position.normalize().multiplyByScalar(h),
  6780. p = e._camera2D.direction.clone(),
  6781. f = e._camera2D.up.clone(),
  6782. v = function(e) { n.position = x(a, d, e.time), n.direction = x(s, p, e.time), n.up = x(l, f, e.time), n.right = n.direction.cross(n.up) };
  6783. t = .5 * t; var g = i.getAnimations().add({ duration: t, easingFunction: m.Easing.Quartic.Out, startValue: { time: 0 }, stopValue: { time: 1 }, onUpdate: v, onComplete: function() { S(e, t, r) } });
  6784. e._currentAnimations.push(g) }
  6785. function b(e, t, r) { t = .5 * t; var i = e._ellipsoid.getMaximumRadius(),
  6786. n = Math.tan(.5 * e._camera3D.frustum.fovy),
  6787. o = e._camera3D.frustum.aspectRatio * n,
  6788. a = i * Math.PI / o,
  6789. s = {};
  6790. s.position = e._camera2D.position.normalize().multiplyByScalar(a), s.direction = e._camera2D.direction.clone(), s.up = e._camera2D.up.clone(); var l = function() { S(e, t, r) };
  6791. M(e, t, s, l) }
  6792. function T(e, t, r) { var i = e._scene,
  6793. o = i.getCamera(),
  6794. a = e._ellipsoid.getMaximumRadius(),
  6795. s = Math.tan(.5 * e._cameraCV.frustum.fovy),
  6796. l = e._cameraCV.frustum.aspectRatio * s,
  6797. u = a * Math.PI / l,
  6798. c = e._camera2D.position.normalize().multiplyByScalar(u),
  6799. h = o.frustum.top,
  6800. d = o.frustum.bottom,
  6801. p = o.frustum.right,
  6802. f = o.frustum.left,
  6803. v = e._camera2D.frustum,
  6804. y = e._cameraCV.frustum,
  6805. g = o.position.clone(),
  6806. _ = function(e) { o.position = x(g, c, e.time), o.frustum.top = n.lerp(h, v.top, e.time), o.frustum.bottom = n.lerp(d, v.bottom, e.time), o.frustum.right = n.lerp(p, v.right, e.time), o.frustum.left = n.lerp(f, v.left, e.time) },
  6807. w = (p - f) / (2 * a * Math.PI),
  6808. C = 1;
  6809. w > C && (w = 0); var S = (C - w) * t; if (S < n.EPSILON6) { if (g.equalsEpsilon(c, n.EPSILON6)) return o.position = c, o.frustum = y.clone(), r(e), void 0;
  6810. S = t, w = 0, C = 1 } var E = i.getAnimations().add({ easingFunction: m.Easing.Quartic.Out, duration: S, startValue: { time: w }, stopValue: { time: C }, onUpdate: _, onComplete: function() { o.frustum = y.clone(), r(e) } });
  6811. e._currentAnimations.push(E) }
  6812. function A(e, t, r) { var i = e._scene,
  6813. n = i.getCamera();
  6814. t = .5 * t; var o = function() { var o = n.position.clone(),
  6815. a = n.direction.clone(),
  6816. s = n.up.clone(),
  6817. l = e._cameraCV.position.clone(),
  6818. u = e._cameraCV.direction.clone(),
  6819. c = e._cameraCV.up.clone(),
  6820. h = function(e) { n.position = x(o, l, e.time), n.direction = x(a, u, e.time), n.up = x(s, c, e.time), n.right = n.direction.cross(n.up) },
  6821. d = i.getAnimations().add({ duration: t, easingFunction: m.Easing.Quartic.Out, startValue: { time: 0 }, stopValue: { time: 1 }, onUpdate: h, onComplete: function() { r(e) } });
  6822. e._currentAnimations.push(d) };
  6823. T(e, t, o) }
  6824. function M(e, t, r, i) { var n = e._scene,
  6825. o = n.getCamera();
  6826. y(o, e._cameraCV.transform); var a = o.position.clone(),
  6827. s = o.direction.clone(),
  6828. l = o.up.clone(),
  6829. u = r.position.clone(),
  6830. c = r.direction.clone(),
  6831. h = r.up.clone(),
  6832. d = function(e) { o.position = x(a, u, e.time), o.direction = x(s, c, e.time), o.up = x(l, h, e.time), o.right = o.direction.cross(o.up) },
  6833. p = n.getAnimations().add({ duration: t, easingFunction: m.Easing.Quartic.Out, startValue: { time: 0 }, stopValue: { time: 1 }, onUpdate: d, onComplete: function() { o.position = u, o.direction = c, o.up = h } });
  6834. e._currentAnimations.push(p), P(e, n, 1, 0, t, i) }
  6835. function P(e, r, i, n, o, a) { var s = { duration: o, easingFunction: m.Easing.Quartic.Out };
  6836. t(a) && (s.onComplete = function() { a(e) }); var l = r.getAnimations().addProperty(r, "morphTime", i, n, s);
  6837. e._currentAnimations.push(l) }
  6838. function D(e) { var t = e._scene,
  6839. r = t.getCanvas(),
  6840. i = r.clientHeight / r.clientWidth,
  6841. n = e._camera2D.frustum;
  6842. n.top = n.right * i, n.bottom = -n.top, i = 1 / i, n = e._cameraCV.frustum, n.aspectRatio = i, n = e._camera3D.frustum, n.aspectRatio = i; var o = t.getCamera(); switch (t.mode) {
  6843. case v.SCENE3D:
  6844. o.frustum = e._camera3D.frustum.clone(); break;
  6845. case v.COLUMBUS_VIEW:
  6846. o.frustum = e._cameraCV.frustum.clone(); break;
  6847. case v.SCENE2D:
  6848. o.frustum = e._camera2D.frustum.clone() } }
  6849. function I(e) { var r = e._scene;
  6850. r.mode = v.SCENE3D, r.morphTime = v.SCENE3D.morphTime, _(e), D(e); var i = r.getCamera();
  6851. i.transform = d.IDENTITY.clone(), (e._previousMode !== v.MORPHING || e._morphCancelled) && (e._morphCancelled = !1, i.position = e._camera3D.position.clone(), i.direction = e._camera3D.direction.clone(), i.up = e._camera3D.up.clone()); var n = t(e._completeMorph);
  6852. e._completeMorph = void 0, e.onTransitionComplete.raiseEvent(e, e._previousMode, v.SCENE3D, n) }
  6853. function O(e) { var r = e._scene;
  6854. r.mode = v.SCENE2D, r.morphTime = v.SCENE2D.morphTime, _(e), D(e); var i = r.getCamera();
  6855. i.transform = e._camera2D.transform.clone(), i.position = e._camera2D.position.clone(), i.direction = e._camera2D.direction.clone(), i.up = e._camera2D.up.clone(); var n = t(e._completeMorph);
  6856. e._completeMorph = void 0, e.onTransitionComplete.raiseEvent(e, e._previousMode, v.SCENE2D, n) }
  6857. function R(e) { var r = e._scene;
  6858. r.mode = v.COLUMBUS_VIEW, r.morphTime = v.COLUMBUS_VIEW.morphTime, _(e), D(e); var i = r.getCamera();
  6859. i.transform = e._cameraCV.transform.clone(), (e._previousModeMode !== v.MORPHING || e._morphCancelled) && (e._morphCancelled = !1, i.position = e._cameraCV.position.clone(), i.direction = e._cameraCV.direction.clone(), i.up = e._cameraCV.up.clone(), i.right = i.direction.cross(i.up)); var n = t(e._completeMorph);
  6860. e._completeMorph = void 0, e.onTransitionComplete.raiseEvent(e, e._previousMode, v.COLUMBUS_VIEW, n) }
  6861. var L = function(r, a) { if (!t(r)) throw new i("scene is required.");
  6862. this.morphDuration = 2e3, this.completeMorphOnUserInput = !0, this.onTransitionStart = new o, this.onTransitionComplete = new o, this._scene = r, this._ellipsoid = e(a, l.WGS84); var s = r.getCanvas(),
  6863. c = this._ellipsoid.getMaximumRadius(),
  6864. h = new u(0, 0, 2 * c),
  6865. m = h.negate().normalize(),
  6866. v = u.UNIT_Y,
  6867. y = new p;
  6868. y.right = c * Math.PI, y.left = -y.right, y.top = y.right * (s.clientHeight / s.clientWidth), y.bottom = -y.top; var g = new d(0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1);
  6869. this._camera2D = { position: h, direction: m, up: v, frustum: y, transform: g }, h = new u(0, -1, 1).normalize().multiplyByScalar(5 * c), m = u.ZERO.subtract(h).normalize(); var _ = m.cross(u.UNIT_Z).normalize();
  6870. v = _.cross(m), y = new f, y.fovy = n.toRadians(60), y.aspectRatio = s.clientWidth / s.clientHeight, this._cameraCV = { position: h, direction: m, up: v, frustum: y, transform: g }, h = new u(0, -2, 1).normalize().multiplyByScalar(2 * c), m = u.ZERO.subtract(h).normalize(), _ = m.cross(u.UNIT_Z).normalize(), v = _.cross(m), this._camera3D = { position: h, direction: m, up: v, frustum: y }, this._currentAnimations = [], this._morphHandler = void 0, this._morphCancelled = !1, this._completeMorph = void 0 };
  6871. return L.prototype.getScene = function() { return this._scene }, L.prototype.getEllipsoid = function() { return this._ellipsoid }, L.prototype.to2D = function() { t(this._completeMorph) && this._completeMorph(), this._previousMode = this._scene.mode, this._previousMode !== v.SCENE2D && (this.onTransitionStart.raiseEvent(this, this._previousMode, v.SCENE2D, !1), O(this)) }, L.prototype.toColumbusView = function() { t(this._completeMorph) && this._completeMorph(); var e = this._scene;
  6872. this._previousMode = e.mode, this._previousMode !== v.COLUMBUS_VIEW && (this.onTransitionStart.raiseEvent(this, this._previousMode, v.COLUMBUS_VIEW, !1), R(this)) }, L.prototype.to3D = function() { t(this._completeMorph) && this._completeMorph(); var e = this._scene;
  6873. this._previousMode = e.mode, e.mode !== v.SCENE3D && (this.onTransitionStart.raiseEvent(this, this._previousMode, v.SCENE3D, !1), I(this)) }, L.prototype.completeMorph = function() {
  6874. if (!t(this._completeMorph)) throw new i("completeMorph can only be called while morphing");
  6875. this._completeMorph()
  6876. }, L.prototype.morphTo2D = function() { t(this._completeMorph) && this._completeMorph(); var e = this._scene;
  6877. this._previousMode = e.mode, this._previousMode !== v.SCENE2D && this._previousMode !== v.MORPHING && (this.onTransitionStart.raiseEvent(this, this._previousMode, v.SCENE2D, !0), D(this), e.mode = v.MORPHING, g(this, O), this._previousMode === v.COLUMBUS_VIEW ? E(this, this.morphDuration, O) : b(this, this.morphDuration, O)) }, L.prototype.morphToColumbusView = function() { t(this._completeMorph) && this._completeMorph(); var e = this._scene;
  6878. this._previousMode = e.mode, this._previousMode !== v.COLUMBUS_VIEW && this._previousMode !== v.MORPHING && (this.onTransitionStart.raiseEvent(this, this._previousMode, v.COLUMBUS_VIEW, !0), D(this), e.mode = v.MORPHING, g(this, R), this._previousMode === v.SCENE2D ? A(this, this.morphDuration, R) : M(this, this.morphDuration, this._cameraCV, R)) }, L.prototype.morphTo3D = function() { t(this._completeMorph) && this._completeMorph(); var e = this._scene;
  6879. this._previousMode = e.mode, this._previousMode !== v.SCENE3D && this._previousMode !== v.MORPHING && (this.onTransitionStart.raiseEvent(this, this._previousMode, v.SCENE3D, !0), D(this), e.mode = v.MORPHING, g(this, I), this._previousMode === v.SCENE2D ? C(this, this.morphDuration, I) : w(this, this.morphDuration, I)) }, L.prototype.isDestroyed = function() { return !1 }, L.prototype.destroy = function() { return _(this), r(this) }, L
  6880. }), r("Scene/SensorVolumeCollection", ["../Core/defined", "../Core/destroyObject", "../Core/DeveloperError", "./CustomSensorVolume", "./RectangularPyramidSensorVolume", "./SceneMode"], function(e, t, r, i, n, o) { "use strict"; var a = function() { this._sensors = [] }; return a.prototype.addRectangularPyramid = function(e) { var t = new n(e); return this._sensors.push(t), t }, a.prototype.addCustom = function(e) { var t = new i(e); return this._sensors.push(t), t }, a.prototype.remove = function(e) { if (e) { var t = this._sensors,
  6881. r = t.indexOf(e); if (-1 !== r) return t[r].destroy(), t.splice(r, 1), !0 } return !1 }, a.prototype.removeAll = function() { for (var e = this._sensors, t = e.length, r = 0; t > r; ++r) e[r].destroy();
  6882. this._sensors = [] }, a.prototype.contains = function(e) { return e ? -1 !== this._sensors.indexOf(e) : !1 }, a.prototype.get = function(t) { if (!e(t)) throw new r("index is required."); return this._sensors[t] }, a.prototype.getLength = function() { return this._sensors.length }, a.prototype.update = function(e, t, r) { var i = t.mode; if (i === o.SCENE3D)
  6883. for (var n = this._sensors, a = n.length, s = 0; a > s; ++s) n[s].update(e, t, r) }, a.prototype.isDestroyed = function() { return !1 }, a.prototype.destroy = function() { return this.removeAll(), t(this) }, a }), r("Scene/SingleTileImageryProvider", ["../Core/defaultValue", "../Core/defined", "../Core/loadImage", "../Core/writeTextToCanvas", "../Core/DeveloperError", "../Core/Event", "../Core/Extent", "./Credit", "./GeographicTilingScheme", "./TileProviderError", "../ThirdParty/when"], function(e, t, r, i, n, o, a, s, l, u, c) { "use strict"; var h = function(i) {
  6884. function h(e) { C._image = e, C._tileWidth = e.width, C._tileHeight = e.height, C._ready = !0, u.handleSuccess(C._errorEvent) }
  6885. function d() { var e = "Failed to load image " + g + ".";
  6886. w = u.handleError(w, C, C._errorEvent, e, 0, 0, 0, m) }
  6887. function m() { c(r(g), h, d) } i = e(i, {}); var p = i.url; if (!t(p)) throw new n("url is required.");
  6888. this._url = p; var f = i.proxy;
  6889. this._proxy = f; var v = e(i.extent, a.MAX_VALUE),
  6890. y = new l({ extent: v, numberOfLevelZeroTilesX: 1, numberOfLevelZeroTilesY: 1 });
  6891. this._tilingScheme = y, this._image = void 0, this._texture = void 0, this._tileWidth = 0, this._tileHeight = 0, this._errorEvent = new o, this._ready = !1; var g = p;
  6892. t(f) && (g = f.getURL(g)); var _ = i.credit; "string" == typeof _ && (_ = new s(_)), this._credit = _; var w, C = this;
  6893. m() }; return h.prototype.getUrl = function() { return this._url }, h.prototype.getProxy = function() { return this._proxy }, h.prototype.getTileWidth = function() { if (!this._ready) throw new n("getTileWidth must not be called before the imagery provider is ready."); return this._tileWidth }, h.prototype.getTileHeight = function() { if (!this._ready) throw new n("getTileHeight must not be called before the imagery provider is ready."); return this._tileHeight }, h.prototype.getMaximumLevel = function() { if (!this._ready) throw new n("getMaximumLevel must not be called before the imagery provider is ready."); return 0 }, h.prototype.getMinimumLevel = function() { if (!this._ready) throw new n("getMinimumLevel must not be called before the imagery provider is ready."); return 0 }, h.prototype.getTilingScheme = function() { if (!this._ready) throw new n("getTilingScheme must not be called before the imagery provider is ready."); return this._tilingScheme }, h.prototype.getExtent = function() { return this._tilingScheme.getExtent() }, h.prototype.getTileDiscardPolicy = function() { if (!this._ready) throw new n("getTileDiscardPolicy must not be called before the imagery provider is ready."); return void 0 }, h.prototype.getErrorEvent = function() { return this._errorEvent }, h.prototype.isReady = function() { return this._ready }, h.prototype.requestImage = function() { if (!this._ready) throw new n("requestImage must not be called before the imagery provider is ready."); return this._image }, h.prototype.getCredit = function() { return this._credit }, h }), r("Shaders/SkyAtmosphereVS", [], function() { "use strict"; return "attribute vec4 position;\nuniform float fCameraHeight;\nuniform float fCameraHeight2;\nuniform float fOuterRadius;\nuniform float fOuterRadius2;\nuniform float fInnerRadius;\nuniform float fScale;\nuniform float fScaleDepth;\nuniform float fScaleOverScaleDepth;\nconst float Kr = 0.0025;\nconst float fKr4PI = Kr * 4.0 * czm_pi;\nconst float Km = 0.0015;\nconst float fKm4PI = Km * 4.0 * czm_pi;\nconst float ESun = 15.0;\nconst float fKmESun = Km * ESun;\nconst float fKrESun = Kr * ESun;\nconst vec3 v3InvWavelength = vec3(\n5.60204474633241,\n9.473284437923038,\n19.643802610477206);\nconst float rayleighScaleDepth = 0.25;\nconst int nSamples = 2;\nconst float fSamples = 2.0;\nvarying vec3 v_rayleighColor;\nvarying vec3 v_mieColor;\nvarying vec3 v_toCamera;\nvarying vec3 v_positionEC;\nfloat scale(float fCos)\n{\nfloat x = 1.0 - fCos;\nreturn fScaleDepth * exp(-0.00287 + x*(0.459 + x*(3.83 + x*(-6.80 + x*5.25))));\n}\nvoid main(void)\n{\nvec3 v3Pos = position.xyz;\nvec3 v3Ray = v3Pos - czm_viewerPositionWC;\nfloat fFar = length(v3Ray);\nv3Ray /= fFar;\n#ifdef SKY_FROM_SPACE\nfloat B = 2.0 * dot(czm_viewerPositionWC, v3Ray);\nfloat C = fCameraHeight2 - fOuterRadius2;\nfloat fDet = max(0.0, B*B - 4.0 * C);\nfloat fNear = 0.5 * (-B - sqrt(fDet));\nvec3 v3Start = czm_viewerPositionWC + v3Ray * fNear;\nfFar -= fNear;\nfloat fStartAngle = dot(v3Ray, v3Start) / fOuterRadius;\nfloat fStartDepth = exp(-1.0 / fScaleDepth);\nfloat fStartOffset = fStartDepth*scale(fStartAngle);\n#else\nvec3 v3Start = czm_viewerPositionWC;\nfloat fHeight = length(v3Start);\nfloat fDepth = exp(fScaleOverScaleDepth * (fInnerRadius - fCameraHeight));\nfloat fStartAngle = dot(v3Ray, v3Start) / fHeight;\nfloat fStartOffset = fDepth*scale(fStartAngle);\n#endif\nfloat fSampleLength = fFar / fSamples;\nfloat fScaledLength = fSampleLength * fScale;\nvec3 v3SampleRay = v3Ray * fSampleLength;\nvec3 v3SamplePoint = v3Start + v3SampleRay * 0.5;\nvec3 v3FrontColor = vec3(0.0, 0.0, 0.0);\nfor(int i=0; i<nSamples; i++)\n{\nfloat fHeight = length(v3SamplePoint);\nfloat fDepth = exp(fScaleOverScaleDepth * (fInnerRadius - fHeight));\nvec3 lightPosition = normalize(czm_viewerPositionWC);\nfloat fLightAngle = dot(lightPosition, v3SamplePoint) / fHeight;\nfloat fCameraAngle = dot(v3Ray, v3SamplePoint) / fHeight;\nfloat fScatter = (fStartOffset + fDepth*(scale(fLightAngle) - scale(fCameraAngle)));\nvec3 v3Attenuate = exp(-fScatter * (v3InvWavelength * fKr4PI + fKm4PI));\nv3FrontColor += v3Attenuate * (fDepth * fScaledLength);\nv3SamplePoint += v3SampleRay;\n}\nv_mieColor = v3FrontColor * fKmESun;\nv_rayleighColor = v3FrontColor * (v3InvWavelength * fKrESun);\nv_toCamera = czm_viewerPositionWC - v3Pos;\nv_positionEC = (czm_modelView * position).xyz;\ngl_Position = czm_modelViewProjection * position;\n}\n" }), r("Shaders/SkyAtmosphereFS", [], function() { "use strict"; return "const float g = -0.95;\nconst float g2 = g * g;\nvarying vec3 v_rayleighColor;\nvarying vec3 v_mieColor;\nvarying vec3 v_toCamera;\nvarying vec3 v_positionEC;\nvoid main (void)\n{\nczm_ellipsoid ellipsoid = czm_getWgs84EllipsoidEC();\nvec3 direction = normalize(v_positionEC);\nczm_ray ray = czm_ray(vec3(0.0), direction);\nczm_raySegment intersection = czm_rayEllipsoidIntersectionInterval(ray, ellipsoid);\nif (!czm_isEmpty(intersection)) {\ndiscard;\n}\nfloat fCos = dot(czm_sunDirectionWC, normalize(v_toCamera)) / length(v_toCamera);\nfloat fRayleighPhase = 0.75 * (1.0 + fCos*fCos);\nfloat fMiePhase = 1.5 * ((1.0 - g2) / (2.0 + g2)) * (1.0 + fCos*fCos) / pow(1.0 + g2 - 2.0*g*fCos, 1.5);\nconst float fExposure = 2.0;\nvec3 rgb = fRayleighPhase * v_rayleighColor + fMiePhase * v_mieColor;\nrgb = vec3(1.0) - exp(-fExposure * rgb);\nfloat l = czm_luminance(rgb);\ngl_FragColor = vec4(rgb, min(smoothstep(0.0, 0.1, l), 1.0) * smoothstep(0.0, 1.0, czm_morphTime));\n}\n" }), r("Scene/SkyAtmosphere", ["../Core/defaultValue", "../Core/defined", "../Core/EllipsoidGeometry", "../Core/destroyObject", "../Core/GeometryPipeline", "../Core/PrimitiveType", "../Core/Ellipsoid", "../Renderer/BufferUsage", "../Renderer/DrawCommand", "../Renderer/CullFace", "../Renderer/BlendingState", "../Renderer/createShaderSource", "../Scene/SceneMode", "../Shaders/SkyAtmosphereVS", "../Shaders/SkyAtmosphereFS"], function(e, t, r, i, n, o, a, s, l, u, c, h, d, m, p) { "use strict"; var f = function(t) { t = e(t, a.WGS84), this.show = !0, this._ellipsoid = t, this._command = new l, this._command.owner = this, this._spSkyFromSpace = void 0, this._spSkyFromAtmosphere = void 0, this._fCameraHeight = void 0, this._fCameraHeight2 = void 0, this._outerRadius = t.getRadii().multiplyByScalar(1.025).getMaximumComponent(); var r = t.getMaximumRadius(),
  6894. i = .25,
  6895. n = this;
  6896. this._command.uniformMap = { fCameraHeight: function() { return n._fCameraHeight }, fCameraHeight2: function() { return n._fCameraHeight2 }, fOuterRadius: function() { return n._outerRadius }, fOuterRadius2: function() { return n._outerRadius * n._outerRadius }, fInnerRadius: function() { return r }, fScale: function() { return 1 / (n._outerRadius - r) }, fScaleDepth: function() { return i }, fScaleOverScaleDepth: function() { return 1 / (n._outerRadius - r) / i } } }; return f.prototype.getEllipsoid = function() { return this._ellipsoid }, f.prototype.update = function(e, i) { if (!this.show) return void 0; if (i.mode !== d.SCENE3D && i.mode !== d.MORPHING) return void 0; if (!i.passes.color) return void 0; var a = this._command; if (!t(a.vertexArray)) { var l = r.createGeometry(new r({ radii: this._ellipsoid.getRadii().multiplyByScalar(1.025), slicePartitions: 256, stackPartitions: 256 }));
  6897. a.vertexArray = e.createVertexArrayFromGeometry({ geometry: l, attributeIndices: n.createAttributeIndices(l), bufferUsage: s.STATIC_DRAW }), a.primitiveType = o.TRIANGLES, a.renderState = e.createRenderState({ cull: { enabled: !0, face: u.FRONT }, blending: c.ALPHA_BLEND }); var f = e.getShaderCache(),
  6898. v = h({ defines: ["SKY_FROM_SPACE"], sources: [m] });
  6899. this._spSkyFromSpace = f.getShaderProgram(v, p), v = h({ defines: ["SKY_FROM_ATMOSPHERE"], sources: [m] }), this._spSkyFromAtmosphere = f.getShaderProgram(v, p) } var y = i.camera.getPositionWC(); return this._fCameraHeight2 = y.magnitudeSquared(), this._fCameraHeight = Math.sqrt(this._fCameraHeight2), a.shaderProgram = this._fCameraHeight > this._outerRadius ? this._spSkyFromSpace : this._spSkyFromAtmosphere, a }, f.prototype.isDestroyed = function() { return !1 }, f.prototype.destroy = function() { var e = this._command; return e.vertexArray = e.vertexArray && e.vertexArray.destroy(), this._spSkyFromSpace = this._spSkyFromSpace && this._spSkyFromSpace.release(), this._spSkyFromAtmosphere = this._spSkyFromAtmosphere && this._spSkyFromAtmosphere.release(), i(this) }, f }), r("Shaders/SkyBoxVS", [], function() { "use strict"; return "attribute vec3 position;\nvarying vec3 v_texCoord;\nvoid main()\n{\nvec3 p = czm_viewRotation * (czm_temeToPseudoFixed * (czm_entireFrustum.y * position));\ngl_Position = czm_projection * vec4(p, 1.0);\nv_texCoord = position.xyz;\n}\n" }), r("Shaders/SkyBoxFS", [], function() { "use strict"; return "uniform samplerCube u_cubeMap;\nvarying vec3 v_texCoord;\nvoid main()\n{\nvec3 rgb = textureCube(u_cubeMap, normalize(v_texCoord)).rgb;\ngl_FragColor = vec4(rgb, czm_morphTime);\n}\n" }), r("Scene/SkyBox", ["../Core/BoxGeometry", "../Core/Cartesian3", "../Core/defined", "../Core/destroyObject", "../Core/DeveloperError", "../Core/Matrix4", "../Core/GeometryPipeline", "../Core/VertexFormat", "../Core/PrimitiveType", "../Renderer/loadCubeMap", "../Renderer/BufferUsage", "../Renderer/DrawCommand", "../Renderer/BlendingState", "../Scene/SceneMode", "../Shaders/SkyBoxVS", "../Shaders/SkyBoxFS"], function(e, t, r, i, n, o, a, s, l, u, c, h, d, m, p, f) { "use strict"; var v = function(e) { if (!(r(e) && r(e.positiveX) && r(e.negativeX) && r(e.positiveY) && r(e.negativeY) && r(e.positiveZ) && r(e.negativeZ))) throw new n("sources is required and must have positiveX, negativeX, positiveY, negativeY, positiveZ, and negativeZ properties."); if (typeof e.positiveX != typeof e.negativeX || typeof e.positiveX != typeof e.positiveY || typeof e.positiveX != typeof e.negativeY || typeof e.positiveX != typeof e.positiveZ || typeof e.positiveX != typeof e.negativeZ) throw new n("sources properties must all be the same type.");
  6900. this._command = new h, this._command.owner = this, this._cubeMap = void 0, this._sources = e, this.show = !0 }; return v.prototype.getSources = function() { return this._sources }, v.prototype.update = function(i, n) { if (!this.show) return void 0; if (n.mode !== m.SCENE3D && n.mode !== m.MORPHING) return void 0; if (!n.passes.color) return void 0; var h = this._command; if (!r(h.vertexArray)) { var v = this._sources,
  6901. y = this; "string" == typeof v.positiveX ? u(i, this._sources).then(function(e) { y._cubeMap = e }) : this._cubeMap = i.createCubeMap({ source: v }), h.uniformMap = { u_cubeMap: function() { return y._cubeMap } }; var g = e.createGeometry(e.fromDimensions({ dimensions: new t(2, 2, 2), vertexFormat: s.POSITION_ONLY })),
  6902. _ = a.createAttributeIndices(g);
  6903. h.primitiveType = l.TRIANGLES, h.modelMatrix = o.IDENTITY.clone(), h.vertexArray = i.createVertexArrayFromGeometry({ geometry: g, attributeIndices: _, bufferUsage: c.STATIC_DRAW }), h.shaderProgram = i.getShaderCache().getShaderProgram(p, f, _), h.renderState = i.createRenderState({ blending: d.ALPHA_BLEND }) } return r(this._cubeMap) ? h : void 0 }, v.prototype.isDestroyed = function() { return !1 }, v.prototype.destroy = function() { var e = this._command; return e.vertexArray = e.vertexArray && e.vertexArray.destroy(), e.shaderProgram = e.shaderProgram && e.shaderProgram.release(), this._cubeMap = this._cubeMap && this._cubeMap.destroy(), i(this) }, v }), r("Shaders/SunVS", [], function() { "use strict"; return "attribute vec2 direction;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\nvec4 position;\nif (czm_morphTime == 1.0)\n{\nposition = vec4(czm_sunPositionWC, 1.0);\n}\nelse\n{\nposition = vec4(czm_sunPositionColumbusView.zxy, 1.0);\n}\nvec4 positionEC = czm_view * position;\nvec4 positionWC = czm_eyeToWindowCoordinates(positionEC);\nvec4 limb = czm_eyeToWindowCoordinates(positionEC + vec4(czm_solarRadius, 0.0, 0.0, 0.0));\nvec2 halfSize = vec2(length(limb.xy - positionWC.xy));\nhalfSize *= 30.0;\nhalfSize *= ((direction * 2.0) - 1.0);\ngl_Position = czm_viewportOrthographic * vec4(positionWC.xy + halfSize, -positionWC.z, 1.0);\nv_textureCoordinates = direction;\n}\n" }), r("Shaders/SunFS", [], function() { "use strict"; return "varying vec2 v_textureCoordinates;\nvoid main()\n{\nvec4 color = vec4(1.0, 1.0, 0.0, 1.0);\nfloat b = smoothstep(0.03, 0.3, length(v_textureCoordinates - vec2(0.5)));\ncolor.ba = mix(vec2(1.0), vec2(0.0), b);\ngl_FragColor = color;\n}\n" }), r("Scene/Sun", ["../Core/BoundingSphere", "../Core/Cartesian3", "../Core/ComponentDatatype", "../Core/defined", "../Core/destroyObject", "../Core/Math", "../Core/PrimitiveType", "../Renderer/BlendingState", "../Renderer/BufferUsage", "../Renderer/DrawCommand", "./SceneMode", "../Shaders/SunVS", "../Shaders/SunFS"], function(e, t, r, i, n, o, a, s, l, u, c, h, d) { "use strict"; var m = function() { this._command = new u, this._boundingVolume = new e, this._boundingVolume.radius = 30 * o.SOLAR_RADIUS, this._boundingVolume2D = new e, this._boundingVolume2D.radius = this._boundingVolume.radius, this.show = !0 }; return m.prototype.update = function(n, o) { if (!this.show) return void 0; var u = o.mode; if (u === c.SCENE2D || u === c.MORPHING) return void 0; if (!o.passes.color) return void 0; var m = this._command; if (!i(m.vertexArray)) { var p = { direction: 0 },
  6904. f = new Uint8Array(8);
  6905. f[0] = 0, f[1] = 0, f[2] = 255, f[3] = 0, f[4] = 255, f[5] = 255, f[6] = 0, f[7] = 255; var v = n.createVertexBuffer(f, l.STATIC_DRAW),
  6906. y = [{ index: p.direction, vertexBuffer: v, componentsPerAttribute: 2, normalize: !0, componentDatatype: r.UNSIGNED_BYTE }];
  6907. m.vertexArray = n.createVertexArray(y), m.primitiveType = a.TRIANGLE_FAN, m.shaderProgram = n.getShaderCache().getShaderProgram(h, d, p), m.renderState = n.createRenderState({ blending: s.ALPHA_BLEND }), m.boundingVolume = new e } var g = n.getUniformState().getSunPositionWC(),
  6908. _ = n.getUniformState().getSunPositionColumbusView(),
  6909. w = this._boundingVolume,
  6910. C = this._boundingVolume2D; return t.clone(g, w.center), C.center.x = _.z, C.center.y = _.x, C.center.z = _.y, u === c.SCENE3D ? e.clone(w, m.boundingVolume) : u === c.COLUMBUS_VIEW && e.clone(C, m.boundingVolume), m }, m.prototype.isDestroyed = function() { return !1 }, m.prototype.destroy = function() { var e = this._command; return e.vertexArray = e.vertexArray && e.vertexArray.destroy(), e.shaderProgram = e.shaderProgram && e.shaderProgram.release(), n(this) }, m }), r("Scene/TerrainData", ["../Core/DeveloperError"], function(e) { "use strict"; var t = function() { throw new e("This type should not be instantiated directly.") }; return t.prototype.interpolateHeight = function() { throw new e("This type should not be instantiated directly.") }, t.prototype.isChildAvailable = function() { throw new e("This type should not be instantiated directly.") }, t.prototype.getWaterMask = function() { throw new e("This type should not be instantiated directly.") }, t.prototype.createMesh = function() { throw new e("This type should not be instantiated directly.") }, t.prototype.upsample = function() { throw new e("This type should not be instantiated directly.") }, t.prototype.wasCreatedByUpsampling = function() { throw new e("This type should not be instantiated directly.") }, t }), r("Scene/TileCoordinatesImageryProvider", ["../Core/defaultValue", "../Core/Color", "../Core/Event", "./GeographicTilingScheme"], function(e, t, r, i) { "use strict"; var n = function(n) { n = e(n, {}), this._tilingScheme = e(n.tilingScheme, new i), this._color = e(n.color, t.YELLOW), this._errorEvent = new r, this._tileWidth = e(n.tileWidth, 256), this._tileHeight = e(n.tileHeight, 256) }; return n.prototype.getProxy = function() { return void 0 }, n.prototype.getTileWidth = function() { return this._tileWidth }, n.prototype.getTileHeight = function() { return this._tileHeight }, n.prototype.getMaximumLevel = function() { return void 0 }, n.prototype.getMinimumLevel = function() { return void 0 }, n.prototype.getTilingScheme = function() { return this._tilingScheme }, n.prototype.getExtent = function() { return this._tilingScheme.getExtent() }, n.prototype.getTileDiscardPolicy = function() { return void 0 }, n.prototype.getErrorEvent = function() { return this._errorEvent }, n.prototype.isReady = function() { return !0 }, n.prototype.requestImage = function(e, t, r) { var i = document.createElement("canvas");
  6911. i.width = 256, i.height = 256; var n = i.getContext("2d"),
  6912. o = this._color.toCssColorString();
  6913. n.strokeStyle = o, n.lineWidth = 2, n.strokeRect(1, 1, 255, 255); var a = "L" + r + "X" + e + "Y" + t; return n.font = "bold 25px Arial", n.textAlign = "center", n.fillStyle = "black", n.fillText(a, 127, 127), n.fillStyle = o, n.fillText(a, 124, 124), i }, n.prototype.getCredit = function() { return void 0 }, n }), r("Scene/TileDiscardPolicy", ["../Core/DeveloperError"], function(e) { "use strict"; var t = function() { throw new e("This type should not be instantiated directly.") }; return t.prototype.isReady = function() { throw new e("This type should not be instantiated directly.") }, t.prototype.shouldDiscardImage = function() { throw new e("This type should not be instantiated directly.") }, t }), r("Scene/TileMapServiceImageryProvider", ["../Core/defaultValue", "../Core/defined", "../Core/Cartographic", "../Core/DeveloperError", "../Core/Event", "../Core/loadXML", "../Core/writeTextToCanvas", "../Core/Extent", "./Credit", "./ImageryProvider", "./WebMercatorTilingScheme", "./GeographicTilingScheme"], function(e, t, r, i, n, o, a, s, l, u, c, h) { "use strict";
  6914. function d(e, r, i, n) { var o = e._tilingScheme.getNumberOfYTilesAtLevel(n),
  6915. a = e._url + n + "/" + r + "/" + (o - i - 1) + "." + e._fileExtension,
  6916. s = e._proxy; return t(s) && (a = s.getURL(a)), a } var m = /\/$/,
  6917. p = function(a) { if (a = e(a, {}), !t(a.url)) throw new i("description.url is required."); var u = a.url;
  6918. m.test(u) || (u += "/"), this._url = u, this._ready = !1, this._proxy = a.proxy, this._tileDiscardPolicy = a.tileDiscardPolicy, this._errorEvent = new n; var d = a.credit; "string" == typeof d && (d = new l(d)), this._credit = d; var p = this;
  6919. o(u + "tilemapresource.xml").then(function(i) { var n = i.getElementsByTagName("TileFormat")[0];
  6920. p._fileExtension = e(a.fileExtension, n.getAttribute("extension")), p._tileWidth = e(a.tileWidth, parseInt(n.getAttribute("width"), 10)), p._tileHeight = e(a.tileHeight, parseInt(n.getAttribute("height"), 10)); var o = i.getElementsByTagName("TileSet"); if (p._minimumLevel = e(a.minimumLevel, parseInt(o[0].getAttribute("order"), 10)), p._maximumLevel = e(a.maximumLevel, parseInt(o[o.length - 1].getAttribute("order"), 10)), p._extent = a.extent, t(p._extent)) p._extent = p._extent.clone();
  6921. else { var l = i.getElementsByTagName("BoundingBox")[0],
  6922. u = r.fromDegrees(parseFloat(l.getAttribute("miny")), parseFloat(l.getAttribute("minx"))),
  6923. d = r.fromDegrees(parseFloat(l.getAttribute("maxy")), parseFloat(l.getAttribute("maxx")));
  6924. p._extent = new s(u.longitude, u.latitude, d.longitude, d.latitude) } var m = a.tilingScheme; if (!t(m)) { var f = i.getElementsByTagName("TileSets")[0].getAttribute("profile");
  6925. m = "geodetic" === f ? new h : new c } p._extent.west < m.getExtent().west && (p._extent.west = m.getExtent().west), p._extent.east > m.getExtent().east && (p._extent.east = m.getExtent().east), p._extent.south < m.getExtent().south && (p._extent.south = m.getExtent().south), p._extent.north > m.getExtent().north && (p._extent.north = m.getExtent().north); var v = m.positionToTileXY(p._extent.getSouthwest(), p._minimumLevel),
  6926. y = m.positionToTileXY(p._extent.getNortheast(), p._minimumLevel),
  6927. g = (Math.abs(y.x - v.x) + 1) * (Math.abs(y.y - v.y) + 1);
  6928. g > 4 && (p._minimumLevel = 0), p._tilingScheme = m, p._ready = !0 }, function() { p._fileExtension = e(a.fileExtension, "png"), p._tileWidth = e(a.tileWidth, 256), p._tileHeight = e(a.tileHeight, 256), p._minimumLevel = e(a.minimumLevel, 0), p._maximumLevel = e(a.maximumLevel, 18), p._tilingScheme = e(a.tilingScheme, new c), p._extent = e(a.extent, p._tilingScheme.getExtent()), p._ready = !0 }) }; return p.prototype.getUrl = function() { return this._url }, p.prototype.getProxy = function() { return this._proxy }, p.prototype.getTileWidth = function() { if (!this._ready) throw new i("getTileWidth must not be called before the imagery provider is ready."); return this._tileWidth }, p.prototype.getTileHeight = function() { if (!this._ready) throw new i("getTileHeight must not be called before the imagery provider is ready."); return this._tileHeight }, p.prototype.getMinimumLevel = function() { if (!this._ready) throw new i("getMinimumLevel must not be called before the imagery provider is ready."); return this._minimumLevel }, p.prototype.getMaximumLevel = function() { if (!this._ready) throw new i("getMaximumLevel must not be called before the imagery provider is ready."); return this._maximumLevel }, p.prototype.getTilingScheme = function() { if (!this._ready) throw new i("getTilingScheme must not be called before the imagery provider is ready."); return this._tilingScheme }, p.prototype.getExtent = function() { if (!this._ready) throw new i("getExtent must not be called before the imagery provider is ready."); return this._extent }, p.prototype.getTileDiscardPolicy = function() { if (!this._ready) throw new i("getTileDiscardPolicy must not be called before the imagery provider is ready."); return this._tileDiscardPolicy }, p.prototype.getErrorEvent = function() { return this._errorEvent }, p.prototype.isReady = function() { return this._ready }, p.prototype.requestImage = function(e, t, r) { if (!this._ready) throw new i("requestImage must not be called before the imagery provider is ready."); var n = d(this, e, t, r); return u.loadImage(this, n) }, p.prototype.getCredit = function() { return this._credit }, p }), r("Scene/VRTheWorldTerrainProvider", ["../Core/defaultValue", "../Core/defined", "../Core/loadImage", "../Core/loadXML", "../Core/getImagePixels", "../Core/throttleRequestByServer", "../Core/writeTextToCanvas", "../Core/DeveloperError", "../Core/Extent", "../Core/Math", "../Core/Ellipsoid", "../Core/Event", "./Credit", "./TerrainProvider", "./TileProviderError", "./GeographicTilingScheme", "./HeightmapTerrainData", "../ThirdParty/when"], function(e, t, r, i, n, o, a, s, l, u, c, h, d, m, p, f, v, y) { "use strict";
  6929. function g(e, t) { this.extent = e, this.maxLevel = t }
  6930. function _(e, t, r, i) { for (var n = e._tilingScheme, o = e._extents, a = n.tileXYToExtent(t, r, i), s = 0, l = 0; l < o.length && 15 !== s; ++l) { var u = o[l]; if (!(u.maxLevel <= i)) { var c = u.extent,
  6931. h = c.intersectWith(a, x);
  6932. h.isEmpty() || (w(n, c, 2 * t, 2 * r, i + 1) && (s |= 4), w(n, c, 2 * t + 1, 2 * r, i + 1) && (s |= 8), w(n, c, 2 * t, 2 * r + 1, i + 1) && (s |= 1), w(n, c, 2 * t + 1, 2 * r + 1, i + 1) && (s |= 2)) } } return s }
  6933. function w(e, t, r, i, n) { var o = e.tileXYToExtent(r, i, n); return !o.intersectWith(t, x).isEmpty() } var C = function(r) {
  6934. function n(e) { var t = e.getElementsByTagName("SRS")[0].textContent; if ("EPSG:4326" !== t) return o("SRS " + t + " is not supported."), void 0;
  6935. w._tilingScheme = new f({ ellipsoid: C }); var r = e.getElementsByTagName("TileFormat")[0];
  6936. w._heightmapWidth = parseInt(r.getAttribute("width"), 10), w._heightmapHeight = parseInt(r.getAttribute("height"), 10), w._levelZeroMaximumGeometricError = m.getEstimatedLevelZeroGeometricErrorForAHeightmap(C, Math.min(w._heightmapWidth, w._heightmapHeight), w._tilingScheme.getNumberOfXTilesAtLevel(0)); for (var i = e.getElementsByTagName("DataExtent"), n = 0; n < i.length; ++n) { var a = i[n],
  6937. s = u.toRadians(parseFloat(a.getAttribute("minx"))),
  6938. c = u.toRadians(parseFloat(a.getAttribute("miny"))),
  6939. h = u.toRadians(parseFloat(a.getAttribute("maxx"))),
  6940. d = u.toRadians(parseFloat(a.getAttribute("maxy"))),
  6941. p = parseInt(a.getAttribute("maxlevel"), 10);
  6942. w._extents.push(new g(new l(s, c, h, d), p)) } w._ready = !0 }
  6943. function o(t) { var r = e(t, "An error occurred while accessing " + w._url + ".");
  6944. _ = p.handleError(_, w, w._errorEvent, r, void 0, void 0, void 0, a) }
  6945. function a() { y(i(w._url), n, o) } if (r = e(r, e.EMPTY_OBJECT), !t(r.url)) throw new s("description.url is required.");
  6946. this._url = r.url, this._url.length > 0 && "/" !== this._url[this._url.length - 1] && (this._url += "/"), this._errorEvent = new h, this._ready = !1, this._proxy = r.proxy, this._terrainDataStructure = { heightScale: .001, heightOffset: -1e3, elementsPerHeight: 3, stride: 4, elementMultiplier: 256, isBigEndian: !0 }; var v = r.credit; "string" == typeof v && (v = new d(v)), this._credit = v, this._tilingScheme = void 0, this._extents = []; var _, w = this,
  6947. C = e(r.ellipsoid, c.WGS84);
  6948. a() };
  6949. C.prototype.requestTileGeometry = function(i, a, l, u) { if (!this.isReady()) throw new s("requestTileGeometry must not be called before isReady returns true."); var c = this._tilingScheme.getNumberOfYTilesAtLevel(l),
  6950. h = this._url + l + "/" + i + "/" + (c - a - 1) + ".tif?cesium=true",
  6951. d = this._proxy;
  6952. t(d) && (h = d.getURL(h)); var m; if (u = e(u, !0)) { if (m = o(h, r), !t(m)) return void 0 } else m = r(h); var p = this; return y(m, function(e) { return new v({ buffer: n(e), width: p._heightmapWidth, height: p._heightmapHeight, childTileMask: _(p, i, a, l), structure: p._terrainDataStructure }) }) }, C.prototype.getErrorEvent = function() { return this._errorEvent }, C.prototype.getLevelMaximumGeometricError = function(e) { if (!this.isReady()) throw new s("requestTileGeometry must not be called before isReady returns true."); return this._levelZeroMaximumGeometricError / (1 << e) }, C.prototype.getCredit = function() { return this._credit }, C.prototype.getTilingScheme = function() { if (!this.isReady()) throw new s("requestTileGeometry must not be called before isReady returns true."); return this._tilingScheme }, C.prototype.hasWaterMask = function() { return !1 }, C.prototype.isReady = function() { return this._ready }; var x = new l; return C }), r("Scene/WebMapServiceImageryProvider", ["../Core/clone", "../Core/defaultValue", "../Core/defined", "../Core/freezeObject", "../Core/writeTextToCanvas", "../Core/DeveloperError", "../Core/Event", "../Core/Extent", "./Credit", "./ImageryProvider", "./GeographicTilingScheme"], function(e, t, r, i, n, o, a, s, l, u, c) { "use strict";
  6953. function h(e, t, i, n) { var o = e._url,
  6954. a = o.indexOf("?");
  6955. a >= 0 && a < o.length - 1 ? "&" !== o[o.length - 1] && (o += "&") : 0 > a && (o += "?"); var s = e._parameters; for (var l in s) s.hasOwnProperty(l) && (o += l + "=" + s[l] + "&"); if (r(s.layers) || (o += "layers=" + e._layers + "&"), r(s.srs) || (o += "srs=EPSG:4326&"), !r(s.bbox)) { var u = e._tilingScheme.tileXYToNativeExtent(t, i, n),
  6956. c = u.west + "," + u.south + "," + u.east + "," + u.north;
  6957. o += "bbox=" + c + "&" } r(s.width) || (o += "width=256&"), r(s.height) || (o += "height=256&"); var h = e._proxy; return r(h) && (o = h.getURL(o)), o } var d = function m(i) { if (i = t(i, {}), !r(i.url)) throw new o("description.url is required."); if (!r(i.layers)) throw new o("description.layers is required.");
  6958. this._url = i.url, this._tileDiscardPolicy = i.tileDiscardPolicy, this._proxy = i.proxy, this._layers = i.layers; var n = e(m.DefaultParameters); if (r(i.parameters))
  6959. for (var u in i.parameters)
  6960. if (i.parameters.hasOwnProperty(u)) { var h = u.toLowerCase();
  6961. n[h] = i.parameters[u] }
  6962. this._parameters = n, this._tileWidth = 256, this._tileHeight = 256, this._maximumLevel = i.maximumLevel; var d = t(i.extent, s.MAX_VALUE);
  6963. this._tilingScheme = new c({ extent: d }); var p = i.credit; "string" == typeof p && (p = new l(p)), this._credit = p, this._errorEvent = new a, this._ready = !0 }; return d.prototype.getUrl = function() { return this._url }, d.prototype.getProxy = function() { return this._proxy }, d.prototype.getLayers = function() { return this._layers }, d.prototype.getTileWidth = function() { if (!this._ready) throw new o("getTileWidth must not be called before the imagery provider is ready."); return this._tileWidth }, d.prototype.getTileHeight = function() { if (!this._ready) throw new o("getTileHeight must not be called before the imagery provider is ready."); return this._tileHeight }, d.prototype.getMinimumLevel = function() { if (!this._ready) throw new o("getMinimumLevel must not be called before the imagery provider is ready."); return 0 }, d.prototype.getMaximumLevel = function() { if (!this._ready) throw new o("getMaximumLevel must not be called before the imagery provider is ready."); return this._maximumLevel }, d.prototype.getTilingScheme = function() { if (!this._ready) throw new o("getTilingScheme must not be called before the imagery provider is ready."); return this._tilingScheme }, d.prototype.getExtent = function() { if (!this._ready) throw new o("getExtent must not be called before the imagery provider is ready."); return this._tilingScheme.getExtent() }, d.prototype.getTileDiscardPolicy = function() { if (!this._ready) throw new o("getTileDiscardPolicy must not be called before the imagery provider is ready."); return this._tileDiscardPolicy }, d.prototype.getErrorEvent = function() { return this._errorEvent }, d.prototype.isReady = function() { return this._ready }, d.prototype.requestImage = function(e, t, r) { if (!this._ready) throw new o("requestImage must not be called before the imagery provider is ready."); var i = h(this, e, t, r); return u.loadImage(this, i) }, d.prototype.getCredit = function() { return this._credit }, d.DefaultParameters = i({ service: "WMS", version: "1.1.1", request: "GetMap", styles: "", format: "image/jpeg" }), d }), r("Scene/createTangentSpaceDebugPrimitive", ["../Core/defaultValue", "../Core/defined", "../Core/DeveloperError", "../Core/ColorGeometryInstanceAttribute", "../Core/GeometryInstance", "../Core/GeometryPipeline", "../Core/Matrix4", "./Primitive", "./PerInstanceColorAppearance"], function(e, t, r, i, n, o, a, s, l) { "use strict";
  6964. function u(u) { u = e(u, e.EMPTY_OBJECT); var c = [],
  6965. h = u.geometry; if (!t(h)) throw new r("options.geometry is required.");
  6966. t(h.attributes) && t(h.primitiveType) || (h = h.constructor.createGeometry(h)); var d = h.attributes,
  6967. m = a.clone(e(u.modelMatrix, a.IDENTITY)),
  6968. p = e(u.length, 1e4); return t(d.normal) && c.push(new n({ geometry: o.createLineSegmentsForVectors(h, "normal", p), attributes: { color: new i(1, 0, 0, 1) }, modelMatrix: m })), t(d.binormal) && c.push(new n({ geometry: o.createLineSegmentsForVectors(h, "binormal", p), attributes: { color: new i(0, 1, 0, 1) }, modelMatrix: m })), t(d.tangent) && c.push(new n({ geometry: o.createLineSegmentsForVectors(h, "tangent", p), attributes: { color: new i(0, 0, 1, 1) }, modelMatrix: m })), c.length > 0 ? new s({ geometryInstances: c, appearance: new l({ flat: !0, translucent: !1 }) }) : void 0 } return u }), r("Scene/sampleTerrain", ["../Core/DeveloperError", "../Core/defined", "../ThirdParty/when"], function(e, t, r) {
  6969. "use strict";
  6970. function i(e) {
  6971. var t = e.positions,
  6972. r = e.tilingScheme.tileXYToExtent(e.x, e.y, e.level);
  6973. return function(e) { for (var i = 0; i < t.length; ++i) { var n = t[i];
  6974. n.height = e.interpolateHeight(r, n.longitude, n.latitude) } }
  6975. }
  6976. function n(e) { var t = e.positions; return function() { for (var e = 0; e < t.length; ++e) { var r = t[e];
  6977. r.height = void 0 } } }
  6978. var o = function(o, a, s) { if (!t(o)) throw new e("terrainProvider is required."); if (!t(a)) throw new e("level is required."); if (!t(s)) throw new e("positions is required."); var l, u = o.getTilingScheme(),
  6979. c = [],
  6980. h = {}; for (l = 0; l < s.length; ++l) { var d = u.positionToTileXY(s[l], a),
  6981. m = d.toString(); if (!h.hasOwnProperty(m)) { var p = { x: d.x, y: d.y, level: a, tilingScheme: u, terrainProvider: o, positions: [] };
  6982. h[m] = p, c.push(p) } h[m].positions.push(s[l]) } var f = []; for (l = 0; l < c.length; ++l) { var v = c[l],
  6983. y = v.terrainProvider.requestTileGeometry(v.x, v.y, v.level, !1),
  6984. g = r(y, i(v), n(v));
  6985. f.push(g) } return r.all(f, function() { return s }) };
  6986. return o
  6987. }),
  6988. function() {
  6989. function e(e) { return function() { return e } }! function(i) {
  6990. var n = this || (0, eval)("this"),
  6991. o = n.document,
  6992. a = n.navigator,
  6993. s = n.jQuery,
  6994. l = n.JSON;
  6995. ! function(e) { "function" == typeof t && "object" == typeof exports && "object" == typeof module ? e(module.exports || exports) : "function" == typeof r && r.amd ? r("ThirdParty/knockout-2.3.0", ["exports"], e) : e(n.ko = {}) }(function(t) {
  6996. function r(e, t, r, i) { c.d[e] = { init: function(e) { return c.a.f.set(e, p, {}), { controlsDescendantBindings: !0 } }, update: function(e, n, o, a, s) { o = c.a.f.get(e, p), n = c.a.c(n()), a = !r != !n; var l = !o.fb;
  6997. (l || t || a !== o.vb) && (l && (o.fb = c.a.Oa(c.e.childNodes(e), !0)), a ? (l || c.e.P(e, c.a.Oa(o.fb)), c.Ja(i ? i(s, n) : s, e)) : c.e.ba(e), o.vb = a) } }, c.g.S[e] = !1, c.e.L[e] = !0 }
  6998. function u(e, t, r) { r && t !== c.h.n(e) && c.h.W(e, t), t !== c.h.n(e) && c.q.I(c.a.Ga, null, [e, "change"]) }
  6999. var c = "undefined" != typeof t ? t : {};
  7000. c.b = function(e, t) { for (var r = e.split("."), i = c, n = 0; n < r.length - 1; n++) i = i[r[n]];
  7001. i[r[r.length - 1]] = t }, c.r = function(e, t, r) { e[t] = r }, c.version = "2.3.0", c.b("version", c.version), c.a = function() {
  7002. function e(e, t) { for (var r in e) e.hasOwnProperty(r) && t(r, e[r]) }
  7003. function t(e, t) { if ("input" !== c.a.u(e) || !e.type || "click" != t.toLowerCase()) return !1; var r = e.type; return "checkbox" == r || "radio" == r } var r = {},
  7004. u = {};
  7005. r[a && /Firefox\/2/i.test(a.userAgent) ? "KeyboardEvent" : "UIEvents"] = ["keyup", "keydown", "keypress"], r.MouseEvents = "click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave".split(" "), e(r, function(e, t) { if (t.length)
  7006. for (var r = 0, i = t.length; i > r; r++) u[t[r]] = e }); var h = { propertychange: !0 },
  7007. d = o && function() { for (var e = 3, t = o.createElement("div"), r = t.getElementsByTagName("i"); t.innerHTML = "<!--[if gt IE " + ++e + "]><i></i><![endif]-->", r[0];); return e > 4 ? e : i }(); return { Ta: ["authenticity_token", /^__RequestVerificationToken(_.*)?$/], p: function(e, t) { for (var r = 0, i = e.length; i > r; r++) t(e[r]) }, k: function(e, t) { if ("function" == typeof Array.prototype.indexOf) return Array.prototype.indexOf.call(e, t); for (var r = 0, i = e.length; i > r; r++)
  7008. if (e[r] === t) return r; return -1 }, La: function(e, t, r) { for (var i = 0, n = e.length; n > i; i++)
  7009. if (t.call(r, e[i])) return e[i]; return null }, ka: function(e, t) { var r = c.a.k(e, t);
  7010. r >= 0 && e.splice(r, 1) }, Ma: function(e) { e = e || []; for (var t = [], r = 0, i = e.length; i > r; r++) 0 > c.a.k(t, e[r]) && t.push(e[r]); return t }, Z: function(e, t) { e = e || []; for (var r = [], i = 0, n = e.length; n > i; i++) r.push(t(e[i])); return r }, Y: function(e, t) { e = e || []; for (var r = [], i = 0, n = e.length; n > i; i++) t(e[i]) && r.push(e[i]); return r }, R: function(e, t) { if (t instanceof Array) e.push.apply(e, t);
  7011. else
  7012. for (var r = 0, i = t.length; i > r; r++) e.push(t[r]); return e }, ja: function(e, t, r) { var i = e.indexOf ? e.indexOf(t) : c.a.k(e, t);
  7013. 0 > i ? r && e.push(t) : r || e.splice(i, 1) }, extend: function(e, t) { if (t)
  7014. for (var r in t) t.hasOwnProperty(r) && (e[r] = t[r]); return e }, w: e, oa: function(e) { for (; e.firstChild;) c.removeNode(e.firstChild) }, Mb: function(e) { e = c.a.N(e); for (var t = o.createElement("div"), r = 0, i = e.length; i > r; r++) t.appendChild(c.H(e[r])); return t }, Oa: function(e, t) { for (var r = 0, i = e.length, n = []; i > r; r++) { var o = e[r].cloneNode(!0);
  7015. n.push(t ? c.H(o) : o) } return n }, P: function(e, t) { if (c.a.oa(e), t)
  7016. for (var r = 0, i = t.length; i > r; r++) e.appendChild(t[r]) }, eb: function(e, t) { var r = e.nodeType ? [e] : e; if (0 < r.length) { for (var i = r[0], n = i.parentNode, o = 0, a = t.length; a > o; o++) n.insertBefore(t[o], i); for (o = 0, a = r.length; a > o; o++) c.removeNode(r[o]) } }, hb: function(e, t) { 7 > d ? e.setAttribute("selected", t) : e.selected = t }, F: function(e) { return null === e || e === i ? "" : e.trim ? e.trim() : e.toString().replace(/^[\s\xa0]+|[\s\xa0]+$/g, "") }, Wb: function(e, t) { for (var r = [], i = (e || "").split(t), n = 0, o = i.length; o > n; n++) { var a = c.a.F(i[n]); "" !== a && r.push(a) } return r }, Tb: function(e, t) { return e = e || "", t.length > e.length ? !1 : e.substring(0, t.length) === t }, yb: function(e, t) { if (t.compareDocumentPosition) return 16 == (16 & t.compareDocumentPosition(e)); for (; null != e;) { if (e == t) return !0;
  7017. e = e.parentNode } return !1 }, aa: function(e) { return c.a.yb(e, e.ownerDocument) }, pb: function(e) { return !!c.a.La(e, c.a.aa) }, u: function(e) { return e && e.tagName && e.tagName.toLowerCase() }, o: function(e, r, i) { var n = d && h[r]; if (n || "undefined" == typeof s)
  7018. if (n || "function" != typeof e.addEventListener) { if ("undefined" == typeof e.attachEvent) throw Error("Browser doesn't support addEventListener or attachEvent"); var o = function(t) { i.call(e, t) },
  7019. a = "on" + r;
  7020. e.attachEvent(a, o), c.a.C.ia(e, function() { e.detachEvent(a, o) }) } else e.addEventListener(r, i, !1);
  7021. else { if (t(e, r)) { var l = i;
  7022. i = function(e, t) { var r = this.checked;
  7023. t && (this.checked = !0 !== t.sb), l.call(this, e), this.checked = r } } s(e).bind(r, i) } }, Ga: function(e, r) { if (!e || !e.nodeType) throw Error("element must be a DOM node when calling triggerEvent"); if ("undefined" != typeof s) { var i = [];
  7024. t(e, r) && i.push({ sb: e.checked }), s(e).trigger(r, i) } else if ("function" == typeof o.createEvent) { if ("function" != typeof e.dispatchEvent) throw Error("The supplied element doesn't support dispatchEvent");
  7025. i = o.createEvent(u[r] || "HTMLEvents"), i.initEvent(r, !0, !0, n, 0, 0, 0, 0, 0, !1, !1, !1, !1, 0, e), e.dispatchEvent(i) } else { if ("undefined" == typeof e.fireEvent) throw Error("Browser doesn't support triggering events");
  7026. t(e, r) && (e.checked = !0 !== e.checked), e.fireEvent("on" + r) } }, c: function(e) { return c.T(e) ? e() : e }, ya: function(e) { return c.T(e) ? e.t() : e }, ga: function(e, t, r) { if (t) { var i = /\S+/g,
  7027. n = e.className.match(i) || [];
  7028. c.a.p(t.match(i), function(e) { c.a.ja(n, e, r) }), e.className = n.join(" ") } }, ib: function(e, t) { var r = c.a.c(t);
  7029. (null === r || r === i) && (r = ""); var n = c.e.firstChild(e);!n || 3 != n.nodeType || c.e.nextSibling(n) ? c.e.P(e, [o.createTextNode(r)]) : n.data = r, c.a.Bb(e) }, gb: function(e, t) { if (e.name = t, 7 >= d) try { e.mergeAttributes(o.createElement("<input name='" + e.name + "'/>"), !1) } catch (r) {} }, Bb: function(e) { d >= 9 && (e = 1 == e.nodeType ? e : e.parentNode, e.style && (e.style.zoom = e.style.zoom)) }, zb: function(e) { if (d) { var t = e.style.width;
  7030. e.style.width = 0, e.style.width = t } }, Qb: function(e, t) { e = c.a.c(e), t = c.a.c(t); for (var r = [], i = e; t >= i; i++) r.push(i); return r }, N: function(e) { for (var t = [], r = 0, i = e.length; i > r; r++) t.push(e[r]); return t }, Ub: 6 === d, Vb: 7 === d, ca: d, Ua: function(e, t) { for (var r = c.a.N(e.getElementsByTagName("input")).concat(c.a.N(e.getElementsByTagName("textarea"))), i = "string" == typeof t ? function(e) { return e.name === t } : function(e) { return t.test(e.name) }, n = [], o = r.length - 1; o >= 0; o--) i(r[o]) && n.push(r[o]); return n }, Nb: function(e) { return "string" == typeof e && (e = c.a.F(e)) ? l && l.parse ? l.parse(e) : new Function("return " + e)() : null }, Ca: function(e, t, r) { if (!l || !l.stringify) throw Error("Cannot find JSON.stringify(). Some browsers (e.g., IE < 8) don't support it natively, but you can overcome this by adding a script reference to json2.js, downloadable from http://www.json.org/json2.js"); return l.stringify(c.a.c(e), t, r) }, Ob: function(t, r, i) { i = i || {}; var n = i.params || {},
  7031. a = i.includeFields || this.Ta,
  7032. s = t; if ("object" == typeof t && "form" === c.a.u(t))
  7033. for (var s = t.action, l = a.length - 1; l >= 0; l--)
  7034. for (var u = c.a.Ua(t, a[l]), h = u.length - 1; h >= 0; h--) n[u[h].name] = u[h].value;
  7035. r = c.a.c(r); var d = o.createElement("form");
  7036. d.style.display = "none", d.action = s, d.method = "post"; for (var m in r) t = o.createElement("input"), t.name = m, t.value = c.a.Ca(c.a.c(r[m])), d.appendChild(t);
  7037. e(n, function(e, t) { var r = o.createElement("input");
  7038. r.name = e, r.value = t, d.appendChild(r) }), o.body.appendChild(d), i.submitter ? i.submitter(d) : d.submit(), setTimeout(function() { d.parentNode.removeChild(d) }, 0) } } }(), c.b("utils", c.a), c.b("utils.arrayForEach", c.a.p), c.b("utils.arrayFirst", c.a.La), c.b("utils.arrayFilter", c.a.Y), c.b("utils.arrayGetDistinctValues", c.a.Ma), c.b("utils.arrayIndexOf", c.a.k), c.b("utils.arrayMap", c.a.Z), c.b("utils.arrayPushAll", c.a.R), c.b("utils.arrayRemoveItem", c.a.ka), c.b("utils.extend", c.a.extend), c.b("utils.fieldsIncludedWithJsonPost", c.a.Ta), c.b("utils.getFormFields", c.a.Ua), c.b("utils.peekObservable", c.a.ya), c.b("utils.postJson", c.a.Ob), c.b("utils.parseJson", c.a.Nb), c.b("utils.registerEventHandler", c.a.o), c.b("utils.stringifyJson", c.a.Ca), c.b("utils.range", c.a.Qb), c.b("utils.toggleDomNodeCssClass", c.a.ga), c.b("utils.triggerEvent", c.a.Ga), c.b("utils.unwrapObservable", c.a.c), c.b("utils.objectForEach", c.a.w), c.b("utils.addOrRemoveItem", c.a.ja), c.b("unwrap", c.a.c), Function.prototype.bind || (Function.prototype.bind = function(e) { var t = this,
  7039. r = Array.prototype.slice.call(arguments); return e = r.shift(),
  7040. function() { return t.apply(e, r.concat(Array.prototype.slice.call(arguments))) } }), c.a.f = new function() { var e = 0,
  7041. t = "__ko__" + (new Date).getTime(),
  7042. r = {}; return { get: function(e, t) { var r = c.a.f.pa(e, !1); return r === i ? i : r[t] }, set: function(e, t, r) {
  7043. (r !== i || c.a.f.pa(e, !1) !== i) && (c.a.f.pa(e, !0)[t] = r) }, pa: function(n, o) { var a = n[t]; if (!a || "null" === a || !r[a]) { if (!o) return i;
  7044. a = n[t] = "ko" + e++, r[a] = {} } return r[a] }, clear: function(e) { var i = e[t]; return i ? (delete r[i], e[t] = null, !0) : !1 } } }, c.b("utils.domData", c.a.f), c.b("utils.domData.clear", c.a.f.clear), c.a.C = new function() {
  7045. function e(e, t) { var n = c.a.f.get(e, r); return n === i && t && (n = [], c.a.f.set(e, r, n)), n }
  7046. function t(r) { var i = e(r, !1); if (i)
  7047. for (var i = i.slice(0), n = 0; n < i.length; n++) i[n](r); if (c.a.f.clear(r), "function" == typeof s && "function" == typeof s.cleanData && s.cleanData([r]), o[r.nodeType])
  7048. for (i = r.firstChild; r = i;) i = r.nextSibling, 8 === r.nodeType && t(r) } var r = "__ko_domNodeDisposal__" + (new Date).getTime(),
  7049. n = { 1: !0, 8: !0, 9: !0 },
  7050. o = { 1: !0, 9: !0 }; return { ia: function(t, r) { if ("function" != typeof r) throw Error("Callback must be a function");
  7051. e(t, !0).push(r) }, cb: function(t, n) { var o = e(t, !1);
  7052. o && (c.a.ka(o, n), 0 == o.length && c.a.f.set(t, r, i)) }, H: function(e) { if (n[e.nodeType] && (t(e), o[e.nodeType])) { var r = [];
  7053. c.a.R(r, e.getElementsByTagName("*")); for (var i = 0, a = r.length; a > i; i++) t(r[i]) } return e }, removeNode: function(e) { c.H(e), e.parentNode && e.parentNode.removeChild(e) } } }, c.H = c.a.C.H, c.removeNode = c.a.C.removeNode, c.b("cleanNode", c.H), c.b("removeNode", c.removeNode), c.b("utils.domNodeDisposal", c.a.C), c.b("utils.domNodeDisposal.addDisposeCallback", c.a.C.ia), c.b("utils.domNodeDisposal.removeDisposeCallback", c.a.C.cb),
  7054. function() { c.a.xa = function(e) { var t; if ("undefined" != typeof s) { if (s.parseHTML) t = s.parseHTML(e) || [];
  7055. else if ((t = s.clean([e])) && t[0]) { for (e = t[0]; e.parentNode && 11 !== e.parentNode.nodeType;) e = e.parentNode;
  7056. e.parentNode && e.parentNode.removeChild(e) } } else { var r = c.a.F(e).toLowerCase(); for (t = o.createElement("div"), r = r.match(/^<(thead|tbody|tfoot)/) && [1, "<table>", "</table>"] || !r.indexOf("<tr") && [2, "<table><tbody>", "</tbody></table>"] || (!r.indexOf("<td") || !r.indexOf("<th")) && [3, "<table><tbody><tr>", "</tr></tbody></table>"] || [0, "", ""], e = "ignored<div>" + r[1] + e + r[2] + "</div>", "function" == typeof n.innerShiv ? t.appendChild(n.innerShiv(e)) : t.innerHTML = e; r[0]--;) t = t.lastChild;
  7057. t = c.a.N(t.lastChild.childNodes) } return t }, c.a.fa = function(e, t) { if (c.a.oa(e), t = c.a.c(t), null !== t && t !== i)
  7058. if ("string" != typeof t && (t = t.toString()), "undefined" != typeof s) s(e).html(t);
  7059. else
  7060. for (var r = c.a.xa(t), n = 0; n < r.length; n++) e.appendChild(r[n]) } }(), c.b("utils.parseHtmlFragment", c.a.xa), c.b("utils.setHtml", c.a.fa), c.s = function() {
  7061. function e(t, r) { if (t)
  7062. if (8 == t.nodeType) { var i = c.s.$a(t.nodeValue);
  7063. null != i && r.push({ xb: t, Kb: i }) } else if (1 == t.nodeType)
  7064. for (var i = 0, n = t.childNodes, o = n.length; o > i; i++) e(n[i], r) } var t = {}; return { va: function(e) { if ("function" != typeof e) throw Error("You can only pass a function to ko.memoization.memoize()"); var r = (0 | 4294967296 * (1 + Math.random())).toString(16).substring(1) + (0 | 4294967296 * (1 + Math.random())).toString(16).substring(1); return t[r] = e, "<!--[ko_memo:" + r + "]-->" }, mb: function(e, r) { var n = t[e]; if (n === i) throw Error("Couldn't find any memo with ID " + e + ". Perhaps it's already been unmemoized."); try { return n.apply(null, r || []), !0 } finally { delete t[e] } }, nb: function(t, r) { var i = [];
  7065. e(t, i); for (var n = 0, o = i.length; o > n; n++) { var a = i[n].xb,
  7066. s = [a];
  7067. r && c.a.R(s, r), c.s.mb(i[n].Kb, s), a.nodeValue = "", a.parentNode && a.parentNode.removeChild(a) } }, $a: function(e) { return (e = e.match(/^\[ko_memo\:(.*?)\]$/)) ? e[1] : null } } }(), c.b("memoization", c.s), c.b("memoization.memoize", c.s.va), c.b("memoization.unmemoize", c.s.mb), c.b("memoization.parseMemoText", c.s.$a), c.b("memoization.unmemoizeDomNodeAndDescendants", c.s.nb), c.Sa = { throttle: function(e, t) { e.throttleEvaluation = t; var r = null; return c.j({ read: e, write: function(i) { clearTimeout(r), r = setTimeout(function() { e(i) }, t) } }) }, notify: function(t, r) { return t.equalityComparer = "always" == r ? e(!1) : c.m.fn.equalityComparer, t } }, c.b("extenders", c.Sa), c.kb = function(e, t, r) { this.target = e, this.la = t, this.wb = r, c.r(this, "dispose", this.B) }, c.kb.prototype.B = function() { this.Hb = !0, this.wb() }, c.V = function() { this.G = {}, c.a.extend(this, c.V.fn), c.r(this, "subscribe", this.Da), c.r(this, "extend", this.extend), c.r(this, "getSubscriptionsCount", this.Db) }, c.V.fn = { Da: function(e, t, r) { r = r || "change"; var i = new c.kb(this, t ? e.bind(t) : e, function() { c.a.ka(this.G[r], i) }.bind(this)); return this.G[r] || (this.G[r] = []), this.G[r].push(i), i }, notifySubscribers: function(e, t) { t = t || "change", this.G[t] && c.q.I(function() { c.a.p(this.G[t].slice(0), function(t) { t && !0 !== t.Hb && t.la(e) }) }, this) }, Db: function() { var e = 0; return c.a.w(this.G, function(t, r) { e += r.length }), e }, extend: function(e) { var t = this; return e && c.a.w(e, function(e, r) { var i = c.Sa[e]; "function" == typeof i && (t = i(t, r)) }), t } }, c.Wa = function(e) { return null != e && "function" == typeof e.Da && "function" == typeof e.notifySubscribers }, c.b("subscribable", c.V), c.b("isSubscribable", c.Wa), c.q = function() { var e = []; return { rb: function(t) { e.push({ la: t, Ra: [] }) }, end: function() { e.pop() }, bb: function(t) { if (!c.Wa(t)) throw Error("Only subscribable things can act as dependencies"); if (0 < e.length) { var r = e[e.length - 1];!r || 0 <= c.a.k(r.Ra, t) || (r.Ra.push(t), r.la(t)) } }, I: function(t, r, i) { try { return e.push(null), t.apply(r, i || []) } finally { e.pop() } } } }();
  7068. var h = { undefined: !0, "boolean": !0, number: !0, string: !0 };
  7069. c.m = function(e) {
  7070. function t() { return 0 < arguments.length ? (t.equalityComparer && t.equalityComparer(r, arguments[0]) || (t.K(), r = arguments[0], t.J()), this) : (c.q.bb(t), r) } var r = e; return c.V.call(t), t.t = function() { return r }, t.J = function() { t.notifySubscribers(r) }, t.K = function() { t.notifySubscribers(r, "beforeChange") }, c.a.extend(t, c.m.fn), c.r(t, "peek", t.t), c.r(t, "valueHasMutated", t.J), c.r(t, "valueWillMutate", t.K), t }, c.m.fn = { equalityComparer: function(e, t) { return null === e || typeof e in h ? e === t : !1 } };
  7071. var d = c.m.Pb = "__ko_proto__";
  7072. c.m.fn[d] = c.m, c.qa = function(e, t) { return null === e || e === i || e[d] === i ? !1 : e[d] === t ? !0 : c.qa(e[d], t) }, c.T = function(e) { return c.qa(e, c.m) }, c.Xa = function(e) { return "function" == typeof e && e[d] === c.m || "function" == typeof e && e[d] === c.j && e.Eb ? !0 : !1 }, c.b("observable", c.m), c.b("isObservable", c.T), c.b("isWriteableObservable", c.Xa), c.U = function(e) { if (e = e || [], "object" != typeof e || !("length" in e)) throw Error("The argument passed when initializing an observable array must be an array, or null, or undefined."); return e = c.m(e), c.a.extend(e, c.U.fn), e }, c.U.fn = { remove: function(e) { for (var t = this.t(), r = [], i = "function" == typeof e ? e : function(t) { return t === e }, n = 0; n < t.length; n++) { var o = t[n];
  7073. i(o) && (0 === r.length && this.K(), r.push(o), t.splice(n, 1), n--) } return r.length && this.J(), r }, removeAll: function(e) { if (e === i) { var t = this.t(),
  7074. r = t.slice(0); return this.K(), t.splice(0, t.length), this.J(), r } return e ? this.remove(function(t) { return 0 <= c.a.k(e, t) }) : [] }, destroy: function(e) { var t = this.t(),
  7075. r = "function" == typeof e ? e : function(t) { return t === e };
  7076. this.K(); for (var i = t.length - 1; i >= 0; i--) r(t[i]) && (t[i]._destroy = !0);
  7077. this.J() }, destroyAll: function(t) { return t === i ? this.destroy(e(!0)) : t ? this.destroy(function(e) { return 0 <= c.a.k(t, e) }) : [] }, indexOf: function(e) { var t = this(); return c.a.k(t, e) }, replace: function(e, t) { var r = this.indexOf(e);
  7078. r >= 0 && (this.K(), this.t()[r] = t, this.J()) } }, c.a.p("pop push reverse shift sort splice unshift".split(" "), function(e) { c.U.fn[e] = function() { var t = this.t(); return this.K(), t = t[e].apply(t, arguments), this.J(), t } }), c.a.p(["slice"], function(e) { c.U.fn[e] = function() { var t = this(); return t[e].apply(t, arguments) } }), c.b("observableArray", c.U), c.j = function(t, r, n) {
  7079. function o() { c.a.p(_, function(e) { e.B() }), _ = [] }
  7080. function a() { var e = l.throttleEvaluation;
  7081. e && e >= 0 ? (clearTimeout(w), w = setTimeout(s, e)) : s() }
  7082. function s() { if (!m)
  7083. if (d && y()) g();
  7084. else { m = !0; try { var e = c.a.Z(_, function(e) { return e.target });
  7085. c.q.rb(function(t) { var r;
  7086. 0 <= (r = c.a.k(e, t)) ? e[r] = i : _.push(t.Da(a)) }); for (var t = p.call(r), n = e.length - 1; n >= 0; n--) e[n] && _.splice(n, 1)[0].B();
  7087. d = !0, l.notifySubscribers(h, "beforeChange"), h = t, l.notifySubscribers(h) } finally { c.q.end(), m = !1 } _.length || g() } }
  7088. function l() { if (0 < arguments.length) { if ("function" != typeof f) throw Error("Cannot write a value to a ko.computed unless you specify a 'write' option. If you wish to read the current value, don't pass any parameters."); return f.apply(r, arguments), this } return d || s(), c.q.bb(l), h }
  7089. function u() { return !d || 0 < _.length } var h, d = !1,
  7090. m = !1,
  7091. p = t; if (p && "object" == typeof p ? (n = p, p = n.read) : (n = n || {}, p || (p = n.read)), "function" != typeof p) throw Error("Pass a function that returns the value of the ko.computed"); var f = n.write,
  7092. v = n.disposeWhenNodeIsRemoved || n.$ || null,
  7093. y = n.disposeWhen || n.Qa || e(!1),
  7094. g = o,
  7095. _ = [],
  7096. w = null; if (r || (r = n.owner), l.t = function() { return d || s(), h }, l.Cb = function() { return _.length }, l.Eb = "function" == typeof n.write, l.B = function() { g() }, l.ta = u, c.V.call(l), c.a.extend(l, c.j.fn), c.r(l, "peek", l.t), c.r(l, "dispose", l.B), c.r(l, "isActive", l.ta), c.r(l, "getDependenciesCount", l.Cb), !0 !== n.deferEvaluation && s(), v && u()) { g = function() { c.a.C.cb(v, g), o() }, c.a.C.ia(v, g); var C = y,
  7097. y = function() { return !c.a.aa(v) || C() } } return l }, c.Gb = function(e) { return c.qa(e, c.j) }, t = c.m.Pb, c.j[t] = c.m, c.j.fn = {}, c.j.fn[t] = c.j, c.b("dependentObservable", c.j), c.b("computed", c.j), c.b("isComputed", c.Gb),
  7098. function() {
  7099. function e(n, o, a) { if (a = a || new r, n = o(n), "object" != typeof n || null === n || n === i || n instanceof Date || n instanceof String || n instanceof Number || n instanceof Boolean) return n; var s = n instanceof Array ? [] : {}; return a.save(n, s), t(n, function(t) { var r = o(n[t]); switch (typeof r) {
  7100. case "boolean":
  7101. case "number":
  7102. case "string":
  7103. case "function":
  7104. s[t] = r; break;
  7105. case "object":
  7106. case "undefined":
  7107. var l = a.get(r);
  7108. s[t] = l !== i ? l : e(r, o, a) } }), s }
  7109. function t(e, t) { if (e instanceof Array) { for (var r = 0; r < e.length; r++) t(r); "function" == typeof e.toJSON && t("toJSON") } else
  7110. for (r in e) t(r) }
  7111. function r() { this.keys = [], this.Ha = [] } c.lb = function(t) { if (0 == arguments.length) throw Error("When calling ko.toJS, pass the object you want to convert."); return e(t, function(e) { for (var t = 0; c.T(e) && 10 > t; t++) e = e(); return e }) }, c.toJSON = function(e, t, r) { return e = c.lb(e), c.a.Ca(e, t, r) }, r.prototype = { save: function(e, t) { var r = c.a.k(this.keys, e);
  7112. r >= 0 ? this.Ha[r] = t : (this.keys.push(e), this.Ha.push(t)) }, get: function(e) { return e = c.a.k(this.keys, e), e >= 0 ? this.Ha[e] : i } } }(), c.b("toJS", c.lb), c.b("toJSON", c.toJSON),
  7113. function() { c.h = { n: function(e) { switch (c.a.u(e)) {
  7114. case "option":
  7115. return !0 === e.__ko__hasDomDataOptionValue__ ? c.a.f.get(e, c.d.options.wa) : 7 >= c.a.ca ? e.getAttributeNode("value") && e.getAttributeNode("value").specified ? e.value : e.text : e.value;
  7116. case "select":
  7117. return 0 <= e.selectedIndex ? c.h.n(e.options[e.selectedIndex]) : i;
  7118. default:
  7119. return e.value } }, W: function(e, t) { switch (c.a.u(e)) {
  7120. case "option":
  7121. switch (typeof t) {
  7122. case "string":
  7123. c.a.f.set(e, c.d.options.wa, i), "__ko__hasDomDataOptionValue__" in e && delete e.__ko__hasDomDataOptionValue__, e.value = t; break;
  7124. default:
  7125. c.a.f.set(e, c.d.options.wa, t), e.__ko__hasDomDataOptionValue__ = !0, e.value = "number" == typeof t ? t : "" } break;
  7126. case "select":
  7127. "" === t && (t = i), (null === t || t === i) && (e.selectedIndex = -1); for (var r = e.options.length - 1; r >= 0; r--)
  7128. if (c.h.n(e.options[r]) == t) { e.selectedIndex = r; break }
  7129. 1 < e.size || -1 !== e.selectedIndex || (e.selectedIndex = 0); break;
  7130. default:
  7131. (null === t || t === i) && (t = ""), e.value = t } } } }(), c.b("selectExtensions", c.h), c.b("selectExtensions.readValue", c.h.n), c.b("selectExtensions.writeValue", c.h.W), c.g = function() {
  7132. function e(e, r) { for (var i = null; e != i;) i = e, e = e.replace(t, function(e, t) { return r[t] }); return e } var t = /\@ko_token_(\d+)\@/g,
  7133. r = ["true", "false", "null", "undefined"],
  7134. i = /^(?:[$_a-z][$\w]*|(.+)(\.\s*[$_a-z][$\w]*|\[.+\]))$/i; return { S: [], da: function(t) { var r = c.a.F(t); if (3 > r.length) return []; "{" === r.charAt(0) && (r = r.substring(1, r.length - 1)), t = []; for (var i, n = null, o = 0; o < r.length; o++) { var a = r.charAt(o); if (null === n) switch (a) {
  7135. case '"':
  7136. case "'":
  7137. case "/":
  7138. n = o, i = a } else if (a == i && "\\" !== r.charAt(o - 1)) { a = r.substring(n, o + 1), t.push(a); var s = "@ko_token_" + (t.length - 1) + "@",
  7139. r = r.substring(0, n) + s + r.substring(o + 1),
  7140. o = o - (a.length - s.length),
  7141. n = null } } i = n = null; for (var l = 0, u = null, o = 0; o < r.length; o++) { if (a = r.charAt(o), null === n) switch (a) {
  7142. case "{":
  7143. n = o, u = a, i = "}"; break;
  7144. case "(":
  7145. n = o, u = a, i = ")"; break;
  7146. case "[":
  7147. n = o, u = a, i = "]" } a === u ? l++ : a === i && (l--, 0 === l && (a = r.substring(n, o + 1), t.push(a), s = "@ko_token_" + (t.length - 1) + "@", r = r.substring(0, n) + s + r.substring(o + 1), o -= a.length - s.length, n = null)) } for (i = [], r = r.split(","), n = 0, o = r.length; o > n; n++) l = r[n], u = l.indexOf(":"), u > 0 && u < l.length - 1 ? (a = l.substring(u + 1), i.push({ key: e(l.substring(0, u), t), value: e(a, t) })) : i.push({ unknown: e(l, t) }); return i }, ea: function(e) { var t = "string" == typeof e ? c.g.da(e) : e,
  7148. n = [];
  7149. e = []; for (var o, a = 0; o = t[a]; a++)
  7150. if (0 < n.length && n.push(","), o.key) { var s;
  7151. e: { s = o.key; var l = c.a.F(s); switch (l.length && l.charAt(0)) {
  7152. case "'":
  7153. case '"':
  7154. break e;
  7155. default:
  7156. s = "'" + l + "'" } } o = o.value, n.push(s), n.push(":"), n.push(o), o = c.a.F(o), 0 <= c.a.k(r, c.a.F(o).toLowerCase()) ? o = !1 : (l = o.match(i), o = null === l ? !1 : l[1] ? "Object(" + l[1] + ")" + l[2] : o), o && (0 < e.length && e.push(", "), e.push(s + " : function(__ko_value) { " + o + " = __ko_value; }")) } else o.unknown && n.push(o.unknown); return t = n.join(""), 0 < e.length && (t = t + ", '_ko_property_writers' : { " + e.join("") + " } "), t }, Jb: function(e, t) { for (var r = 0; r < e.length; r++)
  7157. if (c.a.F(e[r].key) == t) return !0; return !1 }, ha: function(e, t, r, i, n) { e && c.T(e) ? !c.Xa(e) || n && e.t() === i || e(i) : (e = t()._ko_property_writers) && e[r] && e[r](i) } } }(), c.b("expressionRewriting", c.g), c.b("expressionRewriting.bindingRewriteValidators", c.g.S), c.b("expressionRewriting.parseObjectLiteral", c.g.da), c.b("expressionRewriting.preProcessBindings", c.g.ea), c.b("jsonExpressionRewriting", c.g), c.b("jsonExpressionRewriting.insertPropertyAccessorsIntoJson", c.g.ea),
  7158. function() {
  7159. function e(e) { return 8 == e.nodeType && (n ? e.text : e.nodeValue).match(a) }
  7160. function t(e) { return 8 == e.nodeType && (n ? e.text : e.nodeValue).match(s) }
  7161. function r(r, i) { for (var n = r, o = 1, a = []; n = n.nextSibling;) { if (t(n) && (o--, 0 === o)) return a;
  7162. a.push(n), e(n) && o++ } if (!i) throw Error("Cannot find closing comment tag to match: " + r.nodeValue); return null }
  7163. function i(e, t) { var i = r(e, t); return i ? 0 < i.length ? i[i.length - 1].nextSibling : e.nextSibling : null } var n = o && "<!--test-->" === o.createComment("test").text,
  7164. a = n ? /^\x3c!--\s*ko(?:\s+(.+\s*\:[\s\S]*))?\s*--\x3e$/ : /^\s*ko(?:\s+(.+\s*\:[\s\S]*))?\s*$/,
  7165. s = n ? /^\x3c!--\s*\/ko\s*--\x3e$/ : /^\s*\/ko\s*$/,
  7166. l = { ul: !0, ol: !0 };
  7167. c.e = { L: {}, childNodes: function(t) { return e(t) ? r(t) : t.childNodes }, ba: function(t) { if (e(t)) { t = c.e.childNodes(t); for (var r = 0, i = t.length; i > r; r++) c.removeNode(t[r]) } else c.a.oa(t) }, P: function(t, r) { if (e(t)) { c.e.ba(t); for (var i = t.nextSibling, n = 0, o = r.length; o > n; n++) i.parentNode.insertBefore(r[n], i) } else c.a.P(t, r) }, ab: function(t, r) { e(t) ? t.parentNode.insertBefore(r, t.nextSibling) : t.firstChild ? t.insertBefore(r, t.firstChild) : t.appendChild(r) }, Va: function(t, r, i) { i ? e(t) ? t.parentNode.insertBefore(r, i.nextSibling) : i.nextSibling ? t.insertBefore(r, i.nextSibling) : t.appendChild(r) : c.e.ab(t, r) }, firstChild: function(r) { return e(r) ? !r.nextSibling || t(r.nextSibling) ? null : r.nextSibling : r.firstChild }, nextSibling: function(r) { return e(r) && (r = i(r)), r.nextSibling && t(r.nextSibling) ? null : r.nextSibling }, ob: function(t) { return (t = e(t)) ? t[1] : null }, Za: function(r) { if (l[c.a.u(r)]) { var n = r.firstChild; if (n)
  7168. do
  7169. if (1 === n.nodeType) { var o;
  7170. o = n.firstChild; var a = null; if (o)
  7171. do
  7172. if (a) a.push(o);
  7173. else if (e(o)) { var s = i(o, !0);
  7174. s ? o = s : a = [o] } else t(o) && (a = [o]); while (o = o.nextSibling); if (o = a)
  7175. for (a = n.nextSibling, s = 0; s < o.length; s++) a ? r.insertBefore(o[s], a) : r.appendChild(o[s]) }
  7176. while (n = n.nextSibling) } } } }(), c.b("virtualElements", c.e), c.b("virtualElements.allowedBindings", c.e.L), c.b("virtualElements.emptyNode", c.e.ba), c.b("virtualElements.insertAfter", c.e.Va), c.b("virtualElements.prepend", c.e.ab), c.b("virtualElements.setDomNodeChildren", c.e.P),
  7177. function() { c.M = function() { this.Na = {} }, c.a.extend(c.M.prototype, { nodeHasBindings: function(e) { switch (e.nodeType) {
  7178. case 1:
  7179. return null != e.getAttribute("data-bind");
  7180. case 8:
  7181. return null != c.e.ob(e);
  7182. default:
  7183. return !1 } }, getBindings: function(e, t) { var r = this.getBindingsString(e, t); return r ? this.parseBindingsString(r, t, e) : null }, getBindingsString: function(e) { switch (e.nodeType) {
  7184. case 1:
  7185. return e.getAttribute("data-bind");
  7186. case 8:
  7187. return c.e.ob(e);
  7188. default:
  7189. return null } }, parseBindingsString: function(e, t, r) { try { var i; if (!(i = this.Na[e])) { var n, o = this.Na,
  7190. a = "with($context){with($data||{}){return{" + c.g.ea(e) + "}}}";
  7191. n = new Function("$context", "$element", a), i = o[e] = n } return i(t, r) } catch (s) { throw s.message = "Unable to parse bindings.\nBindings value: " + e + "\nMessage: " + s.message, s } } }), c.M.instance = new c.M }(), c.b("bindingProvider", c.M),
  7192. function() {
  7193. function e(e, r, i) { for (var n = c.e.firstChild(r); r = n;) n = c.e.nextSibling(r), t(e, r, i) }
  7194. function t(t, i, n) { var o = !0,
  7195. a = 1 === i.nodeType;
  7196. a && c.e.Za(i), (a && n || c.M.instance.nodeHasBindings(i)) && (o = r(i, null, t, n).Sb), o && e(t, i, !a) }
  7197. function r(e, t, r, n) {
  7198. function a(e) { return function() { return l[e] } }
  7199. function s() { return l } var l, u, h = 0,
  7200. d = c.a.f.get(e, o); if (!t) { if (d) throw Error("You cannot apply bindings multiple times to the same element.");
  7201. c.a.f.set(e, o, !0) } return c.j(function() { var o = r && r instanceof c.A ? r : new c.A(c.a.c(r)),
  7202. m = o.$data;!d && n && c.jb(e, o), (l = ("function" == typeof t ? t(o, e) : t) || c.M.instance.getBindings(e, o)) && (0 === h && (h = 1, c.a.w(l, function(t) { var r = c.d[t]; if (r && 8 === e.nodeType && !c.e.L[t]) throw Error("The binding '" + t + "' cannot be used with virtual elements"); if (r && "function" == typeof r.init && (r = r.init(e, a(t), s, m, o)) && r.controlsDescendantBindings) { if (u !== i) throw Error("Multiple bindings (" + u + " and " + t + ") are trying to control descendant bindings of the same element. You cannot use these bindings together on the same element.");
  7203. u = t } }), h = 2), 2 === h && c.a.w(l, function(t) { var r = c.d[t];
  7204. r && "function" == typeof r.update && r.update(e, a(t), s, m, o) })) }, null, { $: e }), { Sb: u === i } } c.d = {}, c.A = function(e, t, r) { t ? (c.a.extend(this, t), this.$parentContext = t, this.$parent = t.$data, this.$parents = (t.$parents || []).slice(0), this.$parents.unshift(this.$parent)) : (this.$parents = [], this.$root = e, this.ko = c), this.$data = e, r && (this[r] = e) }, c.A.prototype.createChildContext = function(e, t) { return new c.A(e, this, t) }, c.A.prototype.extend = function(e) { var t = c.a.extend(new c.A, this); return c.a.extend(t, e) }; var o = "__ko_boundElement";
  7205. c.jb = function(e, t) { return 2 != arguments.length ? c.a.f.get(e, "__ko_bindingContext__") : (c.a.f.set(e, "__ko_bindingContext__", t), void 0) }, c.Ka = function(e, t, i) { return 1 === e.nodeType && c.e.Za(e), r(e, t, i, !0) }, c.Ja = function(t, r) { 1 !== r.nodeType && 8 !== r.nodeType || e(t, r, !0) }, c.Ia = function(e, r) { if (r && 1 !== r.nodeType && 8 !== r.nodeType) throw Error("ko.applyBindings: first parameter should be your view model; second parameter should be a DOM node");
  7206. r = r || n.document.body, t(e, r, !0) }, c.na = function(e) { switch (e.nodeType) {
  7207. case 1:
  7208. case 8:
  7209. var t = c.jb(e); if (t) return t; if (e.parentNode) return c.na(e.parentNode) } return i }, c.ub = function(e) { return (e = c.na(e)) ? e.$data : i }, c.b("bindingHandlers", c.d), c.b("applyBindings", c.Ia), c.b("applyBindingsToDescendants", c.Ja), c.b("applyBindingsToNode", c.Ka), c.b("contextFor", c.na), c.b("dataFor", c.ub) }();
  7210. var m = { "class": "className", "for": "htmlFor" };
  7211. c.d.attr = { update: function(e, t) { var r = c.a.c(t()) || {};
  7212. c.a.w(r, function(t, r) { r = c.a.c(r); var n = !1 === r || null === r || r === i;
  7213. n && e.removeAttribute(t), 8 >= c.a.ca && t in m ? (t = m[t], n ? e.removeAttribute(t) : e[t] = r) : n || e.setAttribute(t, r.toString()), "name" === t && c.a.gb(e, n ? "" : r.toString()) }) } }, c.d.checked = { init: function(t, r, i) { c.a.o(t, "click", function() { var e; if ("checkbox" == t.type) e = t.checked;
  7214. else { if ("radio" != t.type || !t.checked) return;
  7215. e = t.value } var n = r(),
  7216. o = c.a.c(n); "checkbox" == t.type && o instanceof Array ? c.a.ja(n, t.value, t.checked) : c.g.ha(n, i, "checked", e, !0) }), "radio" != t.type || t.name || c.d.uniqueName.init(t, e(!0)) }, update: function(e, t) { var r = c.a.c(t()); "checkbox" == e.type ? e.checked = r instanceof Array ? 0 <= c.a.k(r, e.value) : r : "radio" == e.type && (e.checked = e.value == r) } }, c.d.css = { update: function(e, t) { var r = c.a.c(t()); "object" == typeof r ? c.a.w(r, function(t, r) { r = c.a.c(r), c.a.ga(e, t, r) }) : (r = String(r || ""), c.a.ga(e, e.__ko__cssValue, !1), e.__ko__cssValue = r, c.a.ga(e, r, !0)) } }, c.d.enable = { update: function(e, t) { var r = c.a.c(t());
  7217. r && e.disabled ? e.removeAttribute("disabled") : r || e.disabled || (e.disabled = !0) } }, c.d.disable = { update: function(e, t) { c.d.enable.update(e, function() { return !c.a.c(t()) }) } }, c.d.event = { init: function(e, t, r, i) { var n = t() || {};
  7218. c.a.w(n, function(n) { "string" == typeof n && c.a.o(e, n, function(e) { var o, a = t()[n]; if (a) { var s = r(); try { var l = c.a.N(arguments);
  7219. l.unshift(i), o = a.apply(i, l) } finally {!0 !== o && (e.preventDefault ? e.preventDefault() : e.returnValue = !1) }!1 === s[n + "Bubble"] && (e.cancelBubble = !0, e.stopPropagation && e.stopPropagation()) } }) }) } }, c.d.foreach = { Ya: function(e) { return function() { var t = e(),
  7220. r = c.a.ya(t); return r && "number" != typeof r.length ? (c.a.c(t), { foreach: r.data, as: r.as, includeDestroyed: r.includeDestroyed, afterAdd: r.afterAdd, beforeRemove: r.beforeRemove, afterRender: r.afterRender, beforeMove: r.beforeMove, afterMove: r.afterMove, templateEngine: c.D.sa }) : { foreach: t, templateEngine: c.D.sa } } }, init: function(e, t) { return c.d.template.init(e, c.d.foreach.Ya(t)) }, update: function(e, t, r, i, n) { return c.d.template.update(e, c.d.foreach.Ya(t), r, i, n) } }, c.g.S.foreach = !1, c.e.L.foreach = !0, c.d.hasfocus = { init: function(e, t, r) {
  7221. function i(i) { e.__ko_hasfocusUpdating = !0; var n = e.ownerDocument; if ("activeElement" in n) { var o; try { o = n.activeElement } catch (a) { o = n.body } i = o === e } n = t(), c.g.ha(n, r, "hasfocus", i, !0), e.__ko_hasfocusLastValue = i, e.__ko_hasfocusUpdating = !1 } var n = i.bind(null, !0),
  7222. o = i.bind(null, !1);
  7223. c.a.o(e, "focus", n), c.a.o(e, "focusin", n), c.a.o(e, "blur", o), c.a.o(e, "focusout", o) }, update: function(e, t) { var r = !!c.a.c(t());
  7224. e.__ko_hasfocusUpdating || e.__ko_hasfocusLastValue === r || (r ? e.focus() : e.blur(), c.q.I(c.a.Ga, null, [e, r ? "focusin" : "focusout"])) } }, c.d.hasFocus = c.d.hasfocus, c.d.html = { init: function() { return { controlsDescendantBindings: !0 } }, update: function(e, t) { c.a.fa(e, t()) } };
  7225. var p = "__ko_withIfBindingData";
  7226. r("if"), r("ifnot", !1, !0), r("with", !0, !1, function(e, t) { return e.createChildContext(t) }), c.d.options = { init: function(e) { if ("select" !== c.a.u(e)) throw Error("options binding applies only to SELECT elements"); for (; 0 < e.length;) e.remove(0); return { controlsDescendantBindings: !0 } }, update: function(e, t, r) {
  7227. function n(e, t, r) { var i = typeof t; return "function" == i ? t(e) : "string" == i ? e[t] : r }
  7228. function a(e, t) { if (d) { var r = 0 <= c.a.k(d, c.h.n(t[0]));
  7229. c.a.hb(t[0], r) } } var s = 0 == e.length,
  7230. l = !s && e.multiple ? e.scrollTop : null;
  7231. t = c.a.c(t()); var h, d, m = r(),
  7232. p = m.optionsIncludeDestroyed,
  7233. f = {}; if (e.multiple ? d = c.a.Z(e.selectedOptions || c.a.Y(e.childNodes, function(e) { return e.tagName && "option" === c.a.u(e) && e.selected }), function(e) { return c.h.n(e) }) : 0 <= e.selectedIndex && (d = [c.h.n(e.options[e.selectedIndex])]), t) { "undefined" == typeof t.length && (t = [t]); var v = c.a.Y(t, function(e) { return p || e === i || null === e || !c.a.c(e._destroy) }); "optionsCaption" in m && (h = c.a.c(m.optionsCaption), null !== h && h !== i && v.unshift(f)) } else t = [];
  7234. r = a, m.optionsAfterRender && (r = function(e, t) { a(0, t), c.q.I(m.optionsAfterRender, null, [t[0], e !== f ? e : i]) }), c.a.Aa(e, v, function(e, t, r) { return r.length && (d = r[0].selected && [c.h.n(r[0])]), t = o.createElement("option"), e === f ? (c.a.fa(t, h), c.h.W(t, i)) : (r = n(e, m.optionsValue, e), c.h.W(t, c.a.c(r)), e = n(e, m.optionsText, r), c.a.ib(t, e)), [t] }, null, r), d = null, s && "value" in m && u(e, c.a.ya(m.value), !0), c.a.zb(e), l && 20 < Math.abs(l - e.scrollTop) && (e.scrollTop = l) } }, c.d.options.wa = "__ko.optionValueDomData__", c.d.selectedOptions = {
  7235. init: function(e, t, r) { c.a.o(e, "change", function() { var i = t(),
  7236. n = [];
  7237. c.a.p(e.getElementsByTagName("option"), function(e) { e.selected && n.push(c.h.n(e)) }), c.g.ha(i, r, "selectedOptions", n) }) },
  7238. update: function(e, t) {
  7239. if ("select" != c.a.u(e)) throw Error("values binding applies only to SELECT elements");
  7240. var r = c.a.c(t());
  7241. r && "number" == typeof r.length && c.a.p(e.getElementsByTagName("option"), function(e) { var t = 0 <= c.a.k(r, c.h.n(e));
  7242. c.a.hb(e, t) })
  7243. }
  7244. }, c.d.style = { update: function(e, t) { var r = c.a.c(t() || {});
  7245. c.a.w(r, function(t, r) { r = c.a.c(r), e.style[t] = r || "" }) } }, c.d.submit = { init: function(e, t, r, i) { if ("function" != typeof t()) throw Error("The value for a submit binding must be a function");
  7246. c.a.o(e, "submit", function(r) { var n, o = t(); try { n = o.call(i, e) } finally {!0 !== n && (r.preventDefault ? r.preventDefault() : r.returnValue = !1) } }) } }, c.d.text = { update: function(e, t) { c.a.ib(e, t()) } }, c.e.L.text = !0, c.d.uniqueName = { init: function(e, t) { if (t()) { var r = "ko_unique_" + ++c.d.uniqueName.tb;
  7247. c.a.gb(e, r) } } }, c.d.uniqueName.tb = 0, c.d.value = { init: function(e, t, r) {
  7248. function i() { a = !1; var i = t(),
  7249. n = c.h.n(e);
  7250. c.g.ha(i, r, "value", n) } var n = ["change"],
  7251. o = r().valueUpdate,
  7252. a = !1;
  7253. o && ("string" == typeof o && (o = [o]), c.a.R(n, o), n = c.a.Ma(n)), !c.a.ca || "input" != e.tagName.toLowerCase() || "text" != e.type || "off" == e.autocomplete || e.form && "off" == e.form.autocomplete || -1 != c.a.k(n, "propertychange") || (c.a.o(e, "propertychange", function() { a = !0 }), c.a.o(e, "blur", function() { a && i() })), c.a.p(n, function(t) { var r = i;
  7254. c.a.Tb(t, "after") && (r = function() { setTimeout(i, 0) }, t = t.substring(5)), c.a.o(e, t, r) }) }, update: function(e, t) { var r = "select" === c.a.u(e),
  7255. i = c.a.c(t()),
  7256. n = c.h.n(e);
  7257. i !== n && (n = function() { c.h.W(e, i) }, n(), r && setTimeout(n, 0)), r && 0 < e.length && u(e, i, !1) } }, c.d.visible = { update: function(e, t) { var r = c.a.c(t()),
  7258. i = "none" != e.style.display;
  7259. r && !i ? e.style.display = "" : !r && i && (e.style.display = "none") } },
  7260. function(e) { c.d[e] = { init: function(t, r, i, n) { return c.d.event.init.call(this, t, function() { var t = {}; return t[e] = r(), t }, i, n) } } }("click"), c.v = function() {}, c.v.prototype.renderTemplateSource = function() { throw Error("Override renderTemplateSource") }, c.v.prototype.createJavaScriptEvaluatorBlock = function() { throw Error("Override createJavaScriptEvaluatorBlock") }, c.v.prototype.makeTemplateSource = function(e, t) { if ("string" == typeof e) { t = t || o; var r = t.getElementById(e); if (!r) throw Error("Cannot find template with ID " + e); return new c.l.i(r) } if (1 == e.nodeType || 8 == e.nodeType) return new c.l.Q(e); throw Error("Unknown template type: " + e) }, c.v.prototype.renderTemplate = function(e, t, r, i) { return e = this.makeTemplateSource(e, i), this.renderTemplateSource(e, t, r) }, c.v.prototype.isTemplateRewritten = function(e, t) { return !1 === this.allowTemplateRewriting ? !0 : this.makeTemplateSource(e, t).data("isRewritten") }, c.v.prototype.rewriteTemplate = function(e, t, r) { e = this.makeTemplateSource(e, r), t = t(e.text()), e.text(t), e.data("isRewritten", !0) }, c.b("templateEngine", c.v), c.Ea = function() {
  7261. function e(e, t, r, i) { e = c.g.da(e); for (var n = c.g.S, o = 0; o < e.length; o++) { var a = e[o].key; if (n.hasOwnProperty(a)) { var s = n[a]; if ("function" == typeof s) { if (a = s(e[o].value)) throw Error(a) } else if (!s) throw Error("This template engine does not support the '" + a + "' binding within its templates") } } return r = "ko.__tr_ambtns(function($context,$element){return(function(){return{ " + c.g.ea(e) + " } })()},'" + r.toLowerCase() + "')", i.createJavaScriptEvaluatorBlock(r) + t } var t = /(<([a-z]+\d*)(?:\s+(?!data-bind\s*=\s*)[a-z0-9\-]+(?:=(?:\"[^\"]*\"|\'[^\']*\'))?)*\s+)data-bind\s*=\s*(["'])([\s\S]*?)\3/gi,
  7262. r = /\x3c!--\s*ko\b\s*([\s\S]*?)\s*--\x3e/g; return { Ab: function(e, t, r) { t.isTemplateRewritten(e, r) || t.rewriteTemplate(e, function(e) { return c.Ea.Lb(e, t) }, r) }, Lb: function(i, n) { return i.replace(t, function(t, r, i, o, a) { return e(a, r, i, n) }).replace(r, function(t, r) { return e(r, "<!-- ko -->", "#comment", n) }) }, qb: function(e, t) { return c.s.va(function(r, i) { var n = r.nextSibling;
  7263. n && n.nodeName.toLowerCase() === t && c.Ka(n, e, i) }) } } }(), c.b("__tr_ambtns", c.Ea.qb),
  7264. function() { c.l = {}, c.l.i = function(e) { this.i = e }, c.l.i.prototype.text = function() { var e = c.a.u(this.i),
  7265. e = "script" === e ? "text" : "textarea" === e ? "value" : "innerHTML"; if (0 == arguments.length) return this.i[e]; var t = arguments[0]; "innerHTML" === e ? c.a.fa(this.i, t) : this.i[e] = t }, c.l.i.prototype.data = function(e) { return 1 === arguments.length ? c.a.f.get(this.i, "templateSourceData_" + e) : (c.a.f.set(this.i, "templateSourceData_" + e, arguments[1]), void 0) }, c.l.Q = function(e) { this.i = e }, c.l.Q.prototype = new c.l.i, c.l.Q.prototype.text = function() { if (0 == arguments.length) { var e = c.a.f.get(this.i, "__ko_anon_template__") || {}; return e.Fa === i && e.ma && (e.Fa = e.ma.innerHTML), e.Fa } c.a.f.set(this.i, "__ko_anon_template__", { Fa: arguments[0] }) }, c.l.i.prototype.nodes = function() { return 0 == arguments.length ? (c.a.f.get(this.i, "__ko_anon_template__") || {}).ma : (c.a.f.set(this.i, "__ko_anon_template__", { ma: arguments[0] }), void 0) }, c.b("templateSources", c.l), c.b("templateSources.domElement", c.l.i), c.b("templateSources.anonymousTemplate", c.l.Q) }(),
  7266. function() {
  7267. function e(e, t, r) { var i; for (t = c.e.nextSibling(t); e && (i = e) !== t;) e = c.e.nextSibling(i), 1 !== i.nodeType && 8 !== i.nodeType || r(i) }
  7268. function t(t, r) { if (t.length) { var i = t[0],
  7269. n = t[t.length - 1];
  7270. e(i, n, function(e) { c.Ia(r, e) }), e(i, n, function(e) { c.s.nb(e, [r]) }) } }
  7271. function r(e) { return e.nodeType ? e : 0 < e.length ? e[0] : null }
  7272. function n(e, i, n, a, s) { s = s || {}; var l = e && r(e),
  7273. l = l && l.ownerDocument,
  7274. u = s.templateEngine || o; if (c.Ea.Ab(n, u, l), n = u.renderTemplate(n, a, s, l), "number" != typeof n.length || 0 < n.length && "number" != typeof n[0].nodeType) throw Error("Template engine must return an array of DOM nodes"); switch (l = !1, i) {
  7275. case "replaceChildren":
  7276. c.e.P(e, n), l = !0; break;
  7277. case "replaceNode":
  7278. c.a.eb(e, n), l = !0; break;
  7279. case "ignoreTargetNode":
  7280. break;
  7281. default:
  7282. throw Error("Unknown renderMode: " + i) } return l && (t(n, a), s.afterRender && c.q.I(s.afterRender, null, [n, a.$data])), n } var o;
  7283. c.Ba = function(e) { if (e != i && !(e instanceof c.v)) throw Error("templateEngine must inherit from ko.templateEngine");
  7284. o = e }, c.za = function(e, t, a, s, l) { if (a = a || {}, (a.templateEngine || o) == i) throw Error("Set a template engine before calling renderTemplate"); if (l = l || "replaceChildren", s) { var u = r(s); return c.j(function() { var i = t && t instanceof c.A ? t : new c.A(c.a.c(t)),
  7285. o = "function" == typeof e ? e(i.$data, i) : e,
  7286. i = n(s, l, o, i, a); "replaceNode" == l && (s = i, u = r(s)) }, null, { Qa: function() { return !u || !c.a.aa(u) }, $: u && "replaceNode" == l ? u.parentNode : u }) } return c.s.va(function(r) { c.za(e, t, a, r, "replaceNode") }) }, c.Rb = function(e, r, o, a, s) {
  7287. function l(e, r) { t(r, h), o.afterRender && o.afterRender(r, e) }
  7288. function u(t, r) { h = s.createChildContext(c.a.c(t), o.as), h.$index = r; var i = "function" == typeof e ? e(t, h) : e; return n(null, "ignoreTargetNode", i, h, o) } var h; return c.j(function() { var e = c.a.c(r) || []; "undefined" == typeof e.length && (e = [e]), e = c.a.Y(e, function(e) { return o.includeDestroyed || e === i || null === e || !c.a.c(e._destroy) }), c.q.I(c.a.Aa, null, [a, e, u, o, l]) }, null, { $: a }) }, c.d.template = { init: function(e, t) { var r = c.a.c(t()); return "string" == typeof r || r.name || 1 != e.nodeType && 8 != e.nodeType || (r = 1 == e.nodeType ? e.childNodes : c.e.childNodes(e), r = c.a.Mb(r), new c.l.Q(e).nodes(r)), { controlsDescendantBindings: !0 } }, update: function(e, t, r, n, o) { t = c.a.c(t()), r = {}, n = !0; var a, s = null; "string" != typeof t && (r = t, t = c.a.c(r.name), "if" in r && (n = c.a.c(r["if"])), n && "ifnot" in r && (n = !c.a.c(r.ifnot)), a = c.a.c(r.data)), "foreach" in r ? s = c.Rb(t || e, n && r.foreach || [], r, e, o) : n ? (o = "data" in r ? o.createChildContext(a, r.as) : o, s = c.za(t || e, o, r, e)) : c.e.ba(e), o = s, (a = c.a.f.get(e, "__ko__templateComputedDomDataKey__")) && "function" == typeof a.B && a.B(), c.a.f.set(e, "__ko__templateComputedDomDataKey__", o && o.ta() ? o : i) } }, c.g.S.template = function(e) { return e = c.g.da(e), 1 == e.length && e[0].unknown || c.g.Jb(e, "name") ? null : "This template engine does not support anonymous templates nested within its templates" }, c.e.L.template = !0 }(), c.b("setTemplateEngine", c.Ba), c.b("renderTemplate", c.za), c.a.Pa = function() {
  7289. function e(e, t, r, i, n) { var o, a, s, l, u, c = Math.min,
  7290. h = Math.max,
  7291. d = [],
  7292. m = e.length,
  7293. p = t.length,
  7294. f = p - m || 1,
  7295. v = m + p + 1; for (o = 0; m >= o; o++)
  7296. for (l = s, d.push(s = []), u = c(p, o + f), a = h(0, o - 1); u >= a; a++) s[a] = a ? o ? e[o - 1] === t[a - 1] ? l[a - 1] : c(l[a] || v, s[a - 1] || v) + 1 : a + 1 : o + 1; for (c = [], h = [], f = [], o = m, a = p; o || a;) p = d[o][a] - 1, a && p === d[o][a - 1] ? h.push(c[c.length] = { status: r, value: t[--a], index: a }) : o && p === d[o - 1][a] ? f.push(c[c.length] = { status: i, value: e[--o], index: o }) : (c.push({ status: "retained", value: t[--a] }), --o); if (h.length && f.length) { e = 10 * m; var y; for (t = r = 0;
  7297. (n || e > t) && (y = h[r]); r++) { for (i = 0; d = f[i]; i++)
  7298. if (y.value === d.value) { y.moved = d.index, d.moved = y.index, f.splice(i, 1), t = i = 0; break }
  7299. t += i } } return c.reverse() } return function(t, r, i) { return t = t || [], r = r || [], t.length <= r.length ? e(t, r, "added", "deleted", i) : e(r, t, "deleted", "added", i) } }(), c.b("utils.compareArrays", c.a.Pa),
  7300. function() {
  7301. function e(e) { for (; e.length && !c.a.aa(e[0]);) e.splice(0, 1); if (1 < e.length) { for (var t = e[0], r = e[e.length - 1], i = [t]; t !== r;) { if (t = t.nextSibling, !t) return;
  7302. i.push(t) } Array.prototype.splice.apply(e, [0, e.length].concat(i)) } return e }
  7303. function t(t, r, n, o, a) { var s = []; return t = c.j(function() { var t = r(n, a, e(s)) || [];
  7304. 0 < s.length && (c.a.eb(s, t), o && c.q.I(o, null, [n, t, a])), s.splice(0, s.length), c.a.R(s, t) }, null, { $: t, Qa: function() { return !c.a.pb(s) } }), { O: s, j: t.ta() ? t : i } } c.a.Aa = function(r, n, o, a, s) {
  7305. function l(t, r) { w = d[r], y !== r && (S[t] = w), w.ra(y++), e(w.O), f.push(w), _.push(w) }
  7306. function u(e, t) { if (e)
  7307. for (var r = 0, i = t.length; i > r; r++) t[r] && c.a.p(t[r].O, function(i) { e(i, r, t[r].X) }) } n = n || [], a = a || {}; var h = c.a.f.get(r, "setDomNodeChildrenFromArrayMapping_lastMappingResult") === i,
  7308. d = c.a.f.get(r, "setDomNodeChildrenFromArrayMapping_lastMappingResult") || [],
  7309. m = c.a.Z(d, function(e) { return e.X }),
  7310. p = c.a.Pa(m, n, a.dontLimitMoves),
  7311. f = [],
  7312. v = 0,
  7313. y = 0,
  7314. g = [],
  7315. _ = [];
  7316. n = []; for (var w, C, x, S = [], m = [], E = 0; C = p[E]; E++) switch (x = C.moved, C.status) {
  7317. case "deleted":
  7318. x === i && (w = d[v], w.j && w.j.B(), g.push.apply(g, e(w.O)), a.beforeRemove && (n[E] = w, _.push(w))), v++; break;
  7319. case "retained":
  7320. l(E, v++); break;
  7321. case "added":
  7322. x !== i ? l(E, x) : (w = { X: C.value, ra: c.m(y++) }, f.push(w), _.push(w), h || (m[E] = w)) } u(a.beforeMove, S), c.a.p(g, a.beforeRemove ? c.H : c.removeNode); for (var b, E = 0, h = c.e.firstChild(r); w = _[E]; E++) { for (w.O || c.a.extend(w, t(r, o, w.X, s, w.ra)), v = 0; p = w.O[v]; h = p.nextSibling, b = p, v++) p !== h && c.e.Va(r, p, b);!w.Fb && s && (s(w.X, w.O, w.ra), w.Fb = !0) } u(a.beforeRemove, n), u(a.afterMove, S), u(a.afterAdd, m), c.a.f.set(r, "setDomNodeChildrenFromArrayMapping_lastMappingResult", f) } }(), c.b("utils.setDomNodeChildrenFromArrayMapping", c.a.Aa), c.D = function() { this.allowTemplateRewriting = !1 }, c.D.prototype = new c.v, c.D.prototype.renderTemplateSource = function(e) { var t = (9 > c.a.ca ? 0 : e.nodes) ? e.nodes() : null; return t ? c.a.N(t.cloneNode(!0).childNodes) : (e = e.text(), c.a.xa(e)) }, c.D.sa = new c.D, c.Ba(c.D.sa), c.b("nativeTemplateEngine", c.D),
  7323. function() { c.ua = function() { var e = this.Ib = function() { if ("undefined" == typeof s || !s.tmpl) return 0; try { if (0 <= s.tmpl.tag.tmpl.open.toString().indexOf("__")) return 2 } catch (e) {} return 1 }();
  7324. this.renderTemplateSource = function(t, r, i) { if (i = i || {}, 2 > e) throw Error("Your version of jQuery.tmpl is too old. Please upgrade to jQuery.tmpl 1.0.0pre or later."); var n = t.data("precompiled"); return n || (n = t.text() || "", n = s.template(null, "{{ko_with $item.koBindingContext}}" + n + "{{/ko_with}}"), t.data("precompiled", n)), t = [r.$data], r = s.extend({ koBindingContext: r }, i.templateOptions), r = s.tmpl(n, t, r), r.appendTo(o.createElement("div")), s.fragments = {}, r }, this.createJavaScriptEvaluatorBlock = function(e) { return "{{ko_code ((function() { return " + e + " })()) }}" }, this.addTemplate = function(e, t) { o.write("<script type='text/html' id='" + e + "'>" + t + "</script>") }, e > 0 && (s.tmpl.tag.ko_code = { open: "__.push($1 || '');" }, s.tmpl.tag.ko_with = { open: "with($1) {", close: "} " }) }, c.ua.prototype = new c.v; var e = new c.ua;
  7325. 0 < e.Ib && c.Ba(e), c.b("jqueryTmplTemplateEngine", c.ua) }()
  7326. })
  7327. }()
  7328. }(), r("ThirdParty/weakmap", ["exports"], function(e) { void
  7329. function(t, r, i) {
  7330. function n(e, t, r) { return "function" == typeof t && (r = t, t = o(r).replace(/_$/, "")), c(e, t, { configurable: !0, writable: !0, value: r }) }
  7331. function o(e) { return "function" != typeof e ? "" : "_name" in e ? e._name : "name" in e ? e.name : h.call(e).match(p)[1] }
  7332. function a(e, t) { return t._name = e, t } if ("WeakMap" in t) return e.WeakMap = t.WeakMap, void 0; var s = function() { try { return "x" in Object.defineProperty({}, "x", {}) } catch (e) { return !1 } }(),
  7333. l = Array.prototype.forEach ? Array.prototype.forEach : function(e, t) { for (var r = 0, i = this.length; i > r; ++r) e.call(t, this[r], r, this) },
  7334. u = Object.getOwnPropertyNames,
  7335. c = s ? Object.defineProperty : function(e) { return e },
  7336. h = Function.prototype.toString,
  7337. d = Object.create ? Object.create : function(e) {
  7338. function t() {} return t.prototype = e, new t },
  7339. m = Object.prototype.hasOwnProperty,
  7340. p = /^\n?function\s?(\w*)?_?\(/,
  7341. f = function() {
  7342. function e() { var e = s(),
  7343. i = {};
  7344. this.unlock = function(n) { var o = h(n); if (m.call(o, e)) return o[e](i); var a = d(null, t); return c(o, e, { value: new Function("s", "l", r)(i, a) }), a } } var t = { value: { writable: !0, value: i } },
  7345. r = "return function(k){if(k===s)return l}",
  7346. o = d(null),
  7347. s = function() { var e = Math.random().toString(36).slice(2); return e in o ? s() : o[e] = e },
  7348. l = s(),
  7349. h = function(e) { if (m.call(e, l)) return e[l]; if (!Object.isExtensible(e)) throw new TypeError("Object must be extensible"); var t = d(null); return c(e, l, { value: t }), t }; return n(Object, a("getOwnPropertyNames", function(e) { var t = u(e); return m.call(e, l) && t.splice(t.indexOf(l), 1), t })), n(e.prototype, a("get", function(e) { return this.unlock(e).value })), n(e.prototype, a("set", function(e, t) { this.unlock(e).value = t })), e }(),
  7350. v = function(e) {
  7351. function s(e) { return this === t || null == this || this === s.prototype ? new s(e) : (v(this, new f), g(this, e), void 0) }
  7352. function u(e) { p(e); var t = y(this).get(e); return t === r ? i : t }
  7353. function c(e, t) { p(e), y(this).set(e, t === i ? r : t) }
  7354. function h(e) { return p(e), y(this).get(e) !== i }
  7355. function d(e) { p(e); var t = y(this),
  7356. r = t.get(e) !== i; return t.set(e, i), r }
  7357. function m() { return y(this), "[object WeakMap]" } var p = function(e) { if (null == e || "object" != typeof e && "function" != typeof e) throw new TypeError("Invalid WeakMap key") },
  7358. v = function(t, r) { var i = e.unlock(t); if (i.value) throw new TypeError("Object is already a WeakMap");
  7359. i.value = r },
  7360. y = function(t) { var r = e.unlock(t).value; if (!r) throw new TypeError("WeakMap is not generic"); return r },
  7361. g = function(e, t) { null !== t && "object" == typeof t && "function" == typeof t.forEach && t.forEach(function(r, i) { r instanceof Array && 2 === r.length && c.call(e, t[i][0], t[i][1]) }) };
  7362. u._name = "get", c._name = "set", h._name = "has", m._name = "toString"; try { var _ = ("return " + d).replace("e_", "\\u0065"),
  7363. w = new Function("unwrap", "validate", _)(y, p) } catch (C) { var w = d } var _ = ("" + Object).split("Object"),
  7364. x = a("toString", function() { return _[0] + o(this) + _[1] });
  7365. n(x, x); var S = { __proto__: [] } instanceof Array ? function(e) { e.__proto__ = x } : function(e) { n(e, x) }; return S(s), l.call([m, u, c, h, w], function(e) { n(s.prototype, e), S(e) }), s }(new f);
  7366. e.WeakMap = v }((0, eval)("this")) }), r("ThirdParty/knockout-es5", ["./weakmap", "exports"], function(e, r) {! function(i, n) { "use strict";
  7367. function o(e, t) { if (!e) throw new Error("When calling ko.track, you must pass an object as the first parameter."); var r = this,
  7368. i = a(e, !0); return t = t || Object.getOwnPropertyNames(e), t.forEach(function(t) { if (!(t in i)) { var o = e[t],
  7369. a = o instanceof Array,
  7370. s = r.isObservable(o) ? o : a ? r.observableArray(o) : r.observable(o);
  7371. Object.defineProperty(e, t, { configurable: !0, enumerable: !0, get: s, set: r.isWriteableObservable(s) ? s : n }), i[t] = s, a && l(r, s) } }), e }
  7372. function a(e, t) { y || (y = _()); var r = y.get(e); return !r && t && (r = {}, y.set(e, r)), r }
  7373. function s(e, t, r) { var i = this,
  7374. n = { owner: e, deferEvaluation: !0 }; if ("function" == typeof r) n.read = r;
  7375. else { if ("value" in r) throw new Error('For ko.defineProperty, you must not specify a "value" for the property. You must provide a "get" function.'); if ("function" != typeof r.get) throw new Error('For ko.defineProperty, the third parameter must be either an evaluator function, or an options object containing a function called "get".');
  7376. n.read = r.get, n.write = r.set } return e[t] = i.computed(n), o.call(i, e, [t]), e }
  7377. function l(e, t) { var r = null;
  7378. e.computed(function() { r && (r.dispose(), r = null); var i = t();
  7379. i instanceof Array && (r = u(e, t, i)) }) }
  7380. function u(e, t, r) { var i = c(e, r); return i.subscribe(t) }
  7381. function c(e, t) { g || (g = _()); var r = g.get(t); if (!r) { r = new e.subscribable, g.set(t, r); var i = {};
  7382. h(t, r, i), d(e, t, r, i) } return r }
  7383. function h(e, t, r) {
  7384. ["pop", "push", "reverse", "shift", "sort", "splice", "unshift"].forEach(function(i) { var n = e[i];
  7385. e[i] = function() { var e = n.apply(this, arguments); return r.pause !== !0 && t.notifySubscribers(this), e } }) }
  7386. function d(e, t, r, i) {
  7387. ["remove", "removeAll", "destroy", "destroyAll", "replace"].forEach(function(n) { Object.defineProperty(t, n, { enumerable: !1, value: function() { var o;
  7388. i.pause = !0; try { o = e.observableArray.fn[n].apply(e.observableArray(t), arguments) } finally { i.pause = !1 } return r.notifySubscribers(t), o } }) }) }
  7389. function m(e, t) { if (!e) return null; var r = a(e, !1); return r && r[t] || null }
  7390. function p(e, t) { var r = m(e, t);
  7391. r && r.valueHasMutated() }
  7392. function f(e) { e.track = o, e.getObservable = m, e.valueHasMutated = p, e.defineProperty = s }
  7393. function v() { if ("undefined" != typeof module) { var n = t("knockout"),
  7394. o = t("weakmap");
  7395. f(n), _ = function() { return new o }, module.exports = n } else "ko" in i ? (f(i.ko), _ = function() { return new i.WeakMap }) : "undefined" != typeof e && (_ = function() { return new e.WeakMap }, r.attachToKo = f) } var y, g, _;
  7396. v() }(this) }), r("ThirdParty/knockout", ["./knockout-2.3.0", "./knockout-es5"], function(e, t) { "use strict"; return t.attachToKo(e), e }), r("Widgets/getElement", ["../Core/DeveloperError"], function(e) { "use strict"; var t = function(t) { if ("string" == typeof t) { var r = document.getElementById(t); if (null === r) throw new e('Element with id "' + t + '" does not exist in the document.');
  7397. t = r } return t }; return t }), r("Widgets/Animation/Animation", ["../../Core/defaultValue", "../../Core/defined", "../../Core/defineProperties", "../../Core/destroyObject", "../../Core/DeveloperError", "../../Core/Color", "../getElement", "../../ThirdParty/knockout"], function(e, t, r, i, n, o, a, s) {
  7398. "use strict";
  7399. function l(e) { return o.fromCssColorString(window.getComputedStyle(e).getPropertyValue("color")) }
  7400. function u(e, t, r, i) { return r.call(i, e[t]), s.getObservable(e, t).subscribe(r, i) }
  7401. function c(e) { var t = document.createElementNS(g, e.tagName); for (var r in e)
  7402. if (e.hasOwnProperty(r) && "tagName" !== r)
  7403. if ("children" === r) { var i, n = e.children.length; for (i = 0; n > i; ++i) t.appendChild(c(e.children[i])) } else 0 === r.indexOf("xlink:") ? t.setAttributeNS(_, r.substring(6), e[r]) : "textContent" === r ? t.textContent = e[r] : t.setAttribute(r, e[r]); return t }
  7404. function h(e, t, r) { var i = document.createElementNS(g, "text");
  7405. i.setAttribute("x", e), i.setAttribute("y", t), i.setAttribute("class", "cesium-animation-svgText"); var n = document.createElementNS(g, "tspan"); return n.textContent = r, i.appendChild(n), i }
  7406. function d(e, t, r) { e.setAttribute("transform", "translate(100,100) rotate(" + r + ")"), t.setAttribute("transform", "rotate(" + r + ")") }
  7407. function m(e, t) { var r = t.alpha,
  7408. i = 1 - r; return M.red = e.red * i + t.red * r, M.green = e.green * i + t.green * r, M.blue = e.blue * i + t.blue * r, M.toCssColorString() }
  7409. function p(e, t, r) { var i = { tagName: "g", "class": "cesium-animation-rectButton", transform: "translate(" + e + "," + t + ")", children: [{ tagName: "rect", "class": "cesium-animation-buttonGlow", width: 32, height: 32, rx: 2, ry: 2 }, { tagName: "rect", "class": "cesium-animation-buttonMain", width: 32, height: 32, rx: 4, ry: 4 }, { tagName: "use", "class": "cesium-animation-buttonPath", "xlink:href": r }, { tagName: "title", textContent: "" }] }; return c(i) }
  7410. function f(e, t, r) { var i = { tagName: "g", "class": "cesium-animation-rectButton", transform: "translate(" + e + "," + t + ")", children: [{ tagName: "use", "class": "cesium-animation-buttonGlow", "xlink:href": "#animation_pathWingButton" }, { tagName: "use", "class": "cesium-animation-buttonMain", "xlink:href": "#animation_pathWingButton" }, { tagName: "use", "class": "cesium-animation-buttonPath", "xlink:href": r }, { tagName: "title", textContent: "" }] }; return c(i) }
  7411. function v(e, t) { var r = e._viewModel,
  7412. i = r.shuttleRingDragging; if (!i || y === e)
  7413. if ("mousedown" === t.type || i && "mousemove" === t.type || "touchstart" === t.type && 1 === t.touches.length || i && "touchmove" === t.type && 1 === t.touches.length) { var n, o, a = e._centerX,
  7414. s = e._centerY,
  7415. l = e._svgNode,
  7416. u = l.getBoundingClientRect(); if ("touchstart" === t.type || "touchmove" === t.type ? (n = t.touches[0].clientX, o = t.touches[0].clientY) : (n = t.clientX, o = t.clientY), !i && (n > u.right || n < u.left || o < u.top || o > u.bottom)) return; var c = e._shuttleRingPointer.getBoundingClientRect(),
  7417. h = n - a - u.left,
  7418. d = o - s - u.top,
  7419. m = 180 * Math.atan2(d, h) / Math.PI + 90;
  7420. m > 180 && (m -= 360); var p = r.shuttleRingAngle;
  7421. i || n < c.right && n > c.left && o > c.top && o < c.bottom ? (y = e, r.shuttleRingDragging = !0, r.shuttleRingAngle = m) : p > m ? r.slower() : m > p && r.faster(), t.preventDefault() } else y = void 0, r.shuttleRingDragging = !1 }
  7422. var y, g = "http://www.w3.org/2000/svg",
  7423. _ = "http://www.w3.org/1999/xlink",
  7424. w = o.fromCssColorString("rgba(247,250,255,0.384)"),
  7425. C = o.fromCssColorString("rgba(143,191,255,0.216)"),
  7426. x = o.fromCssColorString("rgba(153,197,255,0.098)"),
  7427. S = o.fromCssColorString("rgba(255,255,255,0.086)"),
  7428. E = o.fromCssColorString("rgba(255,255,255,0.267)"),
  7429. b = o.fromCssColorString("rgba(255,255,255,0)"),
  7430. T = o.fromCssColorString("rgba(66,67,68,0.3)"),
  7431. A = o.fromCssColorString("rgba(0,0,0,0.5)"),
  7432. M = new o,
  7433. P = function(e, t) { this._viewModel = t, this.svgElement = e, this._enabled = void 0, this._toggled = void 0; var r = this;
  7434. this._clickFunction = function() { var e = r._viewModel.command;
  7435. e.canExecute && e() }, e.addEventListener("click", this._clickFunction, !0), this._subscriptions = [u(t, "toggled", this.setToggled, this), u(t, "tooltip", this.setTooltip, this), u(t.command, "canExecute", this.setEnabled, this)] };
  7436. P.prototype.destroy = function() { this.svgElement.removeEventListener("click", this._clickFunction, !0); for (var e = this._subscriptions, t = 0, r = e.length; r > t; t++) e[t].dispose();
  7437. i(this) }, P.prototype.isDestroyed = function() { return !1 }, P.prototype.setEnabled = function(e) { if (this._enabled !== e) { if (this._enabled = e, !e) return this.svgElement.setAttribute("class", "cesium-animation-buttonDisabled"), void 0; if (this._toggled) return this.svgElement.setAttribute("class", "cesium-animation-rectButton cesium-animation-buttonToggled"), void 0;
  7438. this.svgElement.setAttribute("class", "cesium-animation-rectButton") } }, P.prototype.setToggled = function(e) { this._toggled !== e && (this._toggled = e, this._enabled && (e ? this.svgElement.setAttribute("class", "cesium-animation-rectButton cesium-animation-buttonToggled") : this.svgElement.setAttribute("class", "cesium-animation-rectButton"))) }, P.prototype.setTooltip = function(e) { this.svgElement.getElementsByTagName("title")[0].textContent = e };
  7439. var D = function(e, r) { if (!t(e)) throw new n("container is required."); if (!t(r)) throw new n("viewModel is required.");
  7440. e = a(e), this._viewModel = r, this._container = e, this._centerX = 0, this._centerY = 0, this._defsElement = void 0, this._svgNode = void 0, this._topG = void 0, this._lastHeight = void 0, this._lastWidth = void 0; var i = document.createElement("style");
  7441. i.textContent = ".cesium-animation-rectButton .cesium-animation-buttonGlow { filter: url(#animation_blurred); }.cesium-animation-rectButton .cesium-animation-buttonMain { fill: url(#animation_buttonNormal); }.cesium-animation-buttonToggled .cesium-animation-buttonMain { fill: url(#animation_buttonToggled); }.cesium-animation-rectButton:hover .cesium-animation-buttonMain { fill: url(#animation_buttonHovered); }.cesium-animation-buttonDisabled .cesium-animation-buttonMain { fill: url(#animation_buttonDisabled); }.cesium-animation-shuttleRingG .cesium-animation-shuttleRingSwoosh { fill: url(#animation_shuttleRingSwooshGradient); }.cesium-animation-shuttleRingG:hover .cesium-animation-shuttleRingSwoosh { fill: url(#animation_shuttleRingSwooshHovered); }.cesium-animation-shuttleRingPointer { fill: url(#animation_shuttleRingPointerGradient); }.cesium-animation-shuttleRingPausePointer { fill: url(#animation_shuttleRingPointerPaused); }.cesium-animation-knobOuter { fill: url(#animation_knobOuter); }.cesium-animation-knobInner { fill: url(#animation_knobInner); }", document.head.insertBefore(i, document.head.childNodes[0]); var o = document.createElement("div");
  7442. o.className = "cesium-animation-theme", o.innerHTML = '<div class="cesium-animation-themeNormal"></div><div class="cesium-animation-themeHover"></div><div class="cesium-animation-themeSelect"></div><div class="cesium-animation-themeDisabled"></div><div class="cesium-animation-themeKnob"></div><div class="cesium-animation-themePointer"></div><div class="cesium-animation-themeSwoosh"></div><div class="cesium-animation-themeSwooshHover"></div>', this._theme = o, this._themeNormal = o.childNodes[0], this._themeHover = o.childNodes[1], this._themeSelect = o.childNodes[2], this._themeDisabled = o.childNodes[3], this._themeKnob = o.childNodes[4], this._themePointer = o.childNodes[5], this._themeSwoosh = o.childNodes[6], this._themeSwooshHover = o.childNodes[7]; var s = document.createElementNS(g, "svg:svg");
  7443. this._svgNode = s, s.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:xlink", _); var l = document.createElementNS(g, "g");
  7444. this._topG = l, this._realtimeSVG = new P(f(3, 4, "#animation_pathClock"), r.playRealtimeViewModel), this._playReverseSVG = new P(p(44, 99, "#animation_pathPlayReverse"), r.playReverseViewModel), this._playForwardSVG = new P(p(124, 99, "#animation_pathPlay"), r.playForwardViewModel), this._pauseSVG = new P(p(84, 99, "#animation_pathPause"), r.pauseViewModel); var m = document.createElementNS(g, "g");
  7445. m.appendChild(this._realtimeSVG.svgElement), m.appendChild(this._playReverseSVG.svgElement), m.appendChild(this._playForwardSVG.svgElement), m.appendChild(this._pauseSVG.svgElement); var y = c({ tagName: "circle", "class": "cesium-animation-shuttleRingBack", cx: 100, cy: 100, r: 99 });
  7446. this._shuttleRingBackPanel = y; var w = c({ tagName: "g", "class": "cesium-animation-shuttleRingSwoosh", children: [{ tagName: "use", transform: "translate(100,97) scale(-1,1)", "xlink:href": "#animation_pathSwooshFX" }, { tagName: "use", transform: "translate(100,97)", "xlink:href": "#animation_pathSwooshFX" }, { tagName: "line", x1: 100, y1: 8, x2: 100, y2: 22 }] });
  7447. this._shuttleRingSwooshG = w, this._shuttleRingPointer = c({ tagName: "use", "class": "cesium-animation-shuttleRingPointer", "xlink:href": "#animation_pathPointer" }); var C = c({ tagName: "g", transform: "translate(100,100)" });
  7448. this._knobOuter = c({ tagName: "circle", "class": "cesium-animation-knobOuter", cx: 0, cy: 0, r: 71 }); var x = 61,
  7449. S = c({ tagName: "circle", "class": "cesium-animation-knobInner", cx: 0, cy: 0, r: x });
  7450. this._knobDate = h(0, -24, ""), this._knobTime = h(0, -7, ""), this._knobStatus = h(0, -41, ""); var E = c({ tagName: "circle", "class": "cesium-animation-blank", cx: 0, cy: 0, r: x }),
  7451. b = document.createElementNS(g, "g");
  7452. b.setAttribute("class", "cesium-animation-shuttleRingG"), e.appendChild(o), l.appendChild(b), l.appendChild(C), l.appendChild(m), b.appendChild(y), b.appendChild(w), b.appendChild(this._shuttleRingPointer), C.appendChild(this._knobOuter), C.appendChild(S), C.appendChild(this._knobDate), C.appendChild(this._knobTime), C.appendChild(this._knobStatus), C.appendChild(E), s.appendChild(l), e.appendChild(s); var T = this,
  7453. A = function(e) { v(T, e) };
  7454. this._mouseCallback = A, y.addEventListener("mousedown", A, !0), y.addEventListener("touchstart", A, !0), w.addEventListener("mousedown", A, !0), w.addEventListener("touchstart", A, !0), document.addEventListener("mousemove", A, !0), document.addEventListener("touchmove", A, !0), document.addEventListener("mouseup", A, !0), document.addEventListener("touchend", A, !0), this._shuttleRingPointer.addEventListener("mousedown", A, !0), this._shuttleRingPointer.addEventListener("touchstart", A, !0), this._knobOuter.addEventListener("mousedown", A, !0), this._knobOuter.addEventListener("touchstart", A, !0); var M, D = this._knobTime.childNodes[0],
  7455. I = this._knobDate.childNodes[0],
  7456. O = this._knobStatus.childNodes[0];
  7457. this._subscriptions = [u(r.pauseViewModel, "toggled", function(e) { M !== e && (M = e, M ? T._shuttleRingPointer.setAttribute("class", "cesium-animation-shuttleRingPausePointer") : T._shuttleRingPointer.setAttribute("class", "cesium-animation-shuttleRingPointer")) }), u(r, "shuttleRingAngle", function(e) { d(T._shuttleRingPointer, T._knobOuter, e) }), u(r, "dateLabel", function(e) { I.textContent !== e && (I.textContent = e) }), u(r, "timeLabel", function(e) { D.textContent !== e && (D.textContent = e) }), u(r, "multiplierLabel", function(e) { O.textContent !== e && (O.textContent = e) })], this.applyThemeChanges(), this.resize() };
  7458. return r(D.prototype, { container: { get: function() { return this._container } }, viewModel: { get: function() { return this._viewModel } } }), D.prototype.isDestroyed = function() { return !1 }, D.prototype.destroy = function() { var e = this._mouseCallback;
  7459. this._shuttleRingBackPanel.removeEventListener("mousedown", e, !0), this._shuttleRingBackPanel.removeEventListener("touchstart", e, !0), this._shuttleRingSwooshG.removeEventListener("mousedown", e, !0), this._shuttleRingSwooshG.removeEventListener("touchstart", e, !0), document.removeEventListener("mousemove", e, !0), document.removeEventListener("touchmove", e, !0), document.removeEventListener("mouseup", e, !0), document.removeEventListener("touchend", e, !0), this._shuttleRingPointer.removeEventListener("mousedown", e, !0), this._shuttleRingPointer.removeEventListener("touchstart", e, !0), this._knobOuter.removeEventListener("mousedown", e, !0), this._knobOuter.removeEventListener("touchstart", e, !0), this._container.removeChild(this._svgNode), this._container.removeChild(this._theme), this._realtimeSVG.destroy(), this._playReverseSVG.destroy(), this._playForwardSVG.destroy(), this._pauseSVG.destroy(); for (var t = this._subscriptions, r = 0, n = t.length; n > r; r++) t[r].dispose(); return i(this) }, D.prototype.resize = function() { var e = this._container.clientWidth,
  7460. t = this._container.clientHeight; if (e !== this._lastWidth || t !== this._lastHeight) { var r = this._svgNode,
  7461. i = 200,
  7462. n = 132,
  7463. o = e,
  7464. a = t;
  7465. 0 === e && 0 === t ? (o = i, a = n) : 0 === e ? (a = t, o = i * (t / n)) : 0 === t && (o = e, a = n * (e / i)); var s = o / i,
  7466. l = a / n;
  7467. r.style.cssText = "width: " + o + "px; height: " + a + "px; position: absolute; bottom: 0; left: 0;", r.setAttribute("width", o), r.setAttribute("height", a), r.setAttribute("viewBox", "0 0 " + o + " " + a), this._topG.setAttribute("transform", "scale(" + s + "," + l + ")"), this._centerX = Math.max(1, 100 * s), this._centerY = Math.max(1, 100 * l), this._lastHeight = e, this._lastWidth = t } }, D.prototype.applyThemeChanges = function() {
  7468. var e = l(this._themeNormal),
  7469. r = l(this._themeHover),
  7470. i = l(this._themeSelect),
  7471. n = l(this._themeDisabled),
  7472. o = l(this._themeKnob),
  7473. a = l(this._themePointer),
  7474. s = l(this._themeSwoosh),
  7475. u = l(this._themeSwooshHover),
  7476. h = c({ tagName: "defs", children: [{ id: "animation_buttonNormal", tagName: "linearGradient", x1: "50%", y1: "0%", x2: "50%", y2: "100%", children: [{ tagName: "stop", offset: "0%", "stop-color": m(e, w) }, { tagName: "stop", offset: "12%", "stop-color": m(e, C) }, { tagName: "stop", offset: "46%", "stop-color": m(e, x) }, { tagName: "stop", offset: "81%", "stop-color": m(e, S) }] }, { id: "animation_buttonHovered", tagName: "linearGradient", x1: "50%", y1: "0%", x2: "50%", y2: "100%", children: [{ tagName: "stop", offset: "0%", "stop-color": m(r, w) }, { tagName: "stop", offset: "12%", "stop-color": m(r, C) }, { tagName: "stop", offset: "46%", "stop-color": m(r, x) }, { tagName: "stop", offset: "81%", "stop-color": m(r, S) }] }, { id: "animation_buttonToggled", tagName: "linearGradient", x1: "50%", y1: "0%", x2: "50%", y2: "100%", children: [{ tagName: "stop", offset: "0%", "stop-color": m(i, w) }, { tagName: "stop", offset: "12%", "stop-color": m(i, C) }, { tagName: "stop", offset: "46%", "stop-color": m(i, x) }, { tagName: "stop", offset: "81%", "stop-color": m(i, S) }] }, { id: "animation_buttonDisabled", tagName: "linearGradient", x1: "50%", y1: "0%", x2: "50%", y2: "100%", children: [{ tagName: "stop", offset: "0%", "stop-color": m(n, E) }, { tagName: "stop", offset: "75%", "stop-color": m(n, b) }] }, { id: "animation_blurred", tagName: "filter", width: "200%", height: "200%", x: "-50%", y: "-50%", children: [{ tagName: "feGaussianBlur", stdDeviation: 4, "in": "SourceGraphic" }] }, { id: "animation_shuttleRingSwooshGradient", tagName: "linearGradient", x1: "50%", y1: "0%", x2: "50%", y2: "100%", children: [{ tagName: "stop", offset: "0%", "stop-opacity": .2, "stop-color": s.toCssColorString() }, { tagName: "stop", offset: "85%", "stop-opacity": .85, "stop-color": s.toCssColorString() }, { tagName: "stop", offset: "95%", "stop-opacity": .05, "stop-color": s.toCssColorString() }] }, { id: "animation_shuttleRingSwooshHovered", tagName: "linearGradient", x1: "50%", y1: "0%", x2: "50%", y2: "100%", children: [{ tagName: "stop", offset: "0%", "stop-opacity": .2, "stop-color": u.toCssColorString() }, { tagName: "stop", offset: "85%", "stop-opacity": .85, "stop-color": u.toCssColorString() }, { tagName: "stop", offset: "95%", "stop-opacity": .05, "stop-color": u.toCssColorString() }] }, { id: "animation_shuttleRingPointerGradient", tagName: "linearGradient", x1: "0%", y1: "50%", x2: "100%", y2: "50%", children: [{ tagName: "stop", offset: "0%", "stop-color": a.toCssColorString() }, { tagName: "stop", offset: "40%", "stop-color": a.toCssColorString() }, { tagName: "stop", offset: "60%", "stop-color": m(a, A) }, { tagName: "stop", offset: "100%", "stop-color": m(a, A) }] }, { id: "animation_shuttleRingPointerPaused", tagName: "linearGradient", x1: "0%", y1: "50%", x2: "100%", y2: "50%", children: [{ tagName: "stop", offset: "0%", "stop-color": "#CCC" }, { tagName: "stop", offset: "40%", "stop-color": "#CCC" }, { tagName: "stop", offset: "60%", "stop-color": "#555" }, { tagName: "stop", offset: "100%", "stop-color": "#555" }] }, { id: "animation_knobOuter", tagName: "linearGradient", x1: "20%", y1: "0%", x2: "90%", y2: "100%", children: [{ tagName: "stop", offset: "5%", "stop-color": m(o, w) }, { tagName: "stop", offset: "60%", "stop-color": m(o, T) }, { tagName: "stop", offset: "85%", "stop-color": m(o, C) }] }, { id: "animation_knobInner", tagName: "linearGradient", x1: "20%", y1: "0%", x2: "90%", y2: "100%", children: [{ tagName: "stop", offset: "5%", "stop-color": m(o, T) }, { tagName: "stop", offset: "60%", "stop-color": m(o, w) }, { tagName: "stop", offset: "85%", "stop-color": m(o, S) }] }, { id: "animation_pathReset", tagName: "path", transform: "translate(16,16) scale(0.85) translate(-16,-16)", d: "M24.316,5.318,9.833,13.682,9.833,5.5,5.5,5.5,5.5,25.5,9.833,25.5,9.833,17.318,24.316,25.682z" }, { id: "animation_pathPause", tagName: "path", transform: "translate(16,16) scale(0.85) translate(-16,-16)", d: "M13,5.5,7.5,5.5,7.5,25.5,13,25.5zM24.5,5.5,19,5.5,19,25.5,24.5,25.5z" }, { id: "animation_pathPlay", tagName: "path", transform: "translate(16,16) scale(0.85) translate(-16,-16)", d: "M6.684,25.682L24.316,15.5L6.684,5.318V25.682z" }, { id: "animation_pathPlayReverse", tagName: "path", transform: "translate(16,16) scale(-0.85,0.85) translate(-16,-16)", d: "M6.684,25.682L24.316,15.5L6.684,5.318V25.682z" }, { id: "animation_pathLoop", tagName: "path", transform: "translate(16,16) scale(0.85) translate(-16,-16)", d: "M24.249,15.499c-0.009,4.832-3.918,8.741-8.75,8.75c-2.515,0-4.768-1.064-6.365-2.763l2.068-1.442l-7.901-3.703l0.744,8.694l2.193-1.529c2.244,2.594,5.562,4.242,9.26,4.242c6.767,0,12.249-5.482,12.249-12.249H24.249zM15.499,6.75c2.516,0,4.769,1.065,6.367,2.764l-2.068,1.443l7.901,3.701l-0.746-8.693l-2.192,1.529c-2.245-2.594-5.562-4.245-9.262-4.245C8.734,3.25,3.25,8.734,3.249,15.499H6.75C6.758,10.668,10.668,6.758,15.499,6.75z" }, { id: "animation_pathClock", tagName: "path", transform: "translate(16,16) scale(0.85) translate(-16,-15.5)", d: "M15.5,2.374C8.251,2.375,2.376,8.251,2.374,15.5C2.376,22.748,8.251,28.623,15.5,28.627c7.249-0.004,13.124-5.879,13.125-13.127C28.624,8.251,22.749,2.375,15.5,2.374zM15.5,25.623C9.909,25.615,5.385,21.09,5.375,15.5C5.385,9.909,9.909,5.384,15.5,5.374c5.59,0.01,10.115,4.535,10.124,10.125C25.615,21.09,21.091,25.615,15.5,25.623zM8.625,15.5c-0.001-0.552-0.448-0.999-1.001-1c-0.553,0-1,0.448-1,1c0,0.553,0.449,1,1,1C8.176,16.5,8.624,16.053,8.625,15.5zM8.179,18.572c-0.478,0.277-0.642,0.889-0.365,1.367c0.275,0.479,0.889,0.641,1.365,0.365c0.479-0.275,0.643-0.887,0.367-1.367C9.27,18.461,8.658,18.297,8.179,18.572zM9.18,10.696c-0.479-0.276-1.09-0.112-1.366,0.366s-0.111,1.09,0.365,1.366c0.479,0.276,1.09,0.113,1.367-0.366C9.821,11.584,9.657,10.973,9.18,10.696zM22.822,12.428c0.478-0.275,0.643-0.888,0.366-1.366c-0.275-0.478-0.89-0.642-1.366-0.366c-0.479,0.278-0.642,0.89-0.366,1.367C21.732,12.54,22.344,12.705,22.822,12.428zM12.062,21.455c-0.478-0.275-1.089-0.111-1.366,0.367c-0.275,0.479-0.111,1.09,0.366,1.365c0.478,0.277,1.091,0.111,1.365-0.365C12.704,22.344,12.54,21.732,12.062,21.455zM12.062,9.545c0.479-0.276,0.642-0.888,0.366-1.366c-0.276-0.478-0.888-0.642-1.366-0.366s-0.642,0.888-0.366,1.366C10.973,9.658,11.584,9.822,12.062,9.545zM22.823,18.572c-0.48-0.275-1.092-0.111-1.367,0.365c-0.275,0.479-0.112,1.092,0.367,1.367c0.477,0.275,1.089,0.113,1.365-0.365C23.464,19.461,23.3,18.848,22.823,18.572zM19.938,7.813c-0.477-0.276-1.091-0.111-1.365,0.366c-0.275,0.48-0.111,1.091,0.366,1.367s1.089,0.112,1.366-0.366C20.581,8.702,20.418,8.089,19.938,7.813zM23.378,14.5c-0.554,0.002-1.001,0.45-1.001,1c0.001,0.552,0.448,1,1.001,1c0.551,0,1-0.447,1-1C24.378,14.949,23.929,14.5,23.378,14.5zM15.501,6.624c-0.552,0-1,0.448-1,1l-0.466,7.343l-3.004,1.96c-0.478,0.277-0.642,0.889-0.365,1.365c0.275,0.479,0.889,0.643,1.365,0.367l3.305-1.676C15.39,16.99,15.444,17,15.501,17c0.828,0,1.5-0.671,1.5-1.5l-0.5-7.876C16.501,7.072,16.053,6.624,15.501,6.624zM15.501,22.377c-0.552,0-1,0.447-1,1s0.448,1,1,1s1-0.447,1-1S16.053,22.377,15.501,22.377zM18.939,21.455c-0.479,0.277-0.643,0.889-0.366,1.367c0.275,0.477,0.888,0.643,1.366,0.365c0.478-0.275,0.642-0.889,0.366-1.365C20.028,21.344,19.417,21.18,18.939,21.455z" }, { id: "animation_pathWingButton", tagName: "path", d: "m 4.5,0.5 c -2.216,0 -4,1.784 -4,4 l 0,24 c 0,2.216 1.784,4 4,4 l 13.71875,0 C 22.478584,27.272785 27.273681,22.511272 32.5,18.25 l 0,-13.75 c 0,-2.216 -1.784,-4 -4,-4 l -24,0 z" }, { id: "animation_pathPointer", tagName: "path", d: "M-15,-65,-15,-55,15,-55,15,-65,0,-95z" }, { id: "animation_pathSwooshFX", tagName: "path", d: "m 85,0 c 0,16.617 -4.813944,35.356 -13.131081,48.4508 h 6.099803 c 8.317138,-13.0948 13.13322,-28.5955 13.13322,-45.2124 0,-46.94483 -38.402714,-85.00262 -85.7743869,-85.00262 -1.0218522,0 -2.0373001,0.0241 -3.0506131,0.0589 45.958443,1.59437 82.723058,35.77285 82.723058,81.70532 z" }] });
  7477. t(this._defsElement) ? this._svgNode.replaceChild(h, this._defsElement) : this._svgNode.appendChild(h), this._defsElement = h
  7478. }, D
  7479. }), r("Widgets/createCommand", ["../Core/defaultValue", "../Core/defined", "../Core/defineProperties", "../Core/DeveloperError", "../Core/Event", "../ThirdParty/knockout"], function(e, t, r, i, n, o) { "use strict"; var a = function(a, s) {
  7480. function l() { if (!l.canExecute) throw new i("Cannot execute command, canExecute is false."); var e, t = { args: arguments, cancel: !1 }; return u.raiseEvent(t), t.cancel || (e = a.apply(null, arguments), c.raiseEvent(e)), e } if (!t(a)) throw new i("func is required.");
  7481. s = e(s, !0); var u = new n,
  7482. c = new n; return l.canExecute = s, o.track(l, ["canExecute"]), r(l, { beforeExecute: { value: u }, afterExecute: { value: c } }), l }; return a }), r("Widgets/ToggleButtonViewModel", ["../Core/defaultValue", "../Core/defined", "../Core/defineProperties", "../Core/DeveloperError", "../ThirdParty/knockout"], function(e, t, r, i, n) { "use strict"; var o = function(r, o) { if (!t(r)) throw new i("command is required.");
  7483. this._command = r, o = e(o, e.EMPTY_OBJECT), this.toggled = e(o.toggled, !1), this.tooltip = e(o.tooltip, ""), n.track(this, ["toggled", "tooltip"]) }; return r(o.prototype, { command: { get: function() { return this._command } } }), o }), r("Widgets/Animation/AnimationViewModel", ["../../Core/binarySearch", "../../Core/ClockStep", "../../Core/ClockRange", "../../Core/defined", "../../Core/defineProperties", "../../Core/DeveloperError", "../createCommand", "../ToggleButtonViewModel", "../../ThirdParty/sprintf", "../../ThirdParty/knockout"], function(e, t, r, i, n, o, a, s, l, u) { "use strict";
  7484. function c(e) { e.clockStep === t.SYSTEM_CLOCK && (e.clockStep = t.SYSTEM_CLOCK_MULTIPLIER, e.multiplier = 1) }
  7485. function h(e) { c(e), e.shouldAnimate = !0 }
  7486. function d(e, t) { return e - t }
  7487. function m(t, r) { var i = e(r, t, d); return 0 > i ? ~i : i }
  7488. function p(e, t) { if (Math.abs(e) <= y) return e / y; var r, i, n = y,
  7489. o = g,
  7490. a = 0; return e > 0 ? (r = Math.log(t[t.length - 1]), i = (r - a) / (o - n), Math.exp(a + i * (e - n))) : (r = Math.log(-t[0]), i = (r - a) / (o - n), -Math.exp(a + i * (Math.abs(e) - n))) }
  7491. function f(e, r, i) { if (i.clockStep === t.SYSTEM_CLOCK) return y; if (Math.abs(e) <= 1) return e * y; var n, o, a = y,
  7492. s = g,
  7493. l = 0; return e > 0 ? (n = Math.log(r[r.length - 1]), o = (n - l) / (s - a), (Math.log(e) - l) / o + a) : (n = Math.log(-r[0]), o = (n - l) / (s - a), -((Math.log(Math.abs(e)) - l) / o + a)) } var v = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
  7494. y = 15,
  7495. g = 105,
  7496. _ = function(e) { if (!i(e)) throw new o("clockViewModel is required."); var n = this;
  7497. this._clockViewModel = e, this._allShuttleRingTicks = [], this._dateFormatter = _.defaultDateFormatter, this._timeFormatter = _.defaultTimeFormatter, this.shuttleRingDragging = !1, this.snapToTicks = !1, u.track(this, ["_allShuttleRingTicks", "_dateFormatter", "_timeFormatter", "shuttleRingDragging", "snapToTicks"]), this._sortedFilteredPositiveTicks = [], this.setShuttleRingTicks(_.defaultTicks), this.timeLabel = void 0, u.defineProperty(this, "timeLabel", function() { return n._timeFormatter(n._clockViewModel.currentTime, n) }), this.dateLabel = void 0, u.defineProperty(this, "dateLabel", function() { return n._dateFormatter(n._clockViewModel.currentTime, n) }), this.multiplierLabel = void 0, u.defineProperty(this, "multiplierLabel", function() { var e = n._clockViewModel; if (e.clockStep === t.SYSTEM_CLOCK) return "Today"; var r = e.multiplier; return 0 === r % 1 ? r.toFixed(0) + "x" : r.toFixed(3).replace(/0{0,3}$/, "") + "x" }), this.shuttleRingAngle = void 0, u.defineProperty(this, "shuttleRingAngle", { get: function() { return f(e.multiplier, n._allShuttleRingTicks, e) }, set: function(e) { e = Math.max(Math.min(e, g), -g); var r = n._allShuttleRingTicks,
  7498. i = n._clockViewModel; if (i.clockStep = t.SYSTEM_CLOCK_MULTIPLIER, Math.abs(e) === g) return i.multiplier = e > 0 ? r[r.length - 1] : r[0], void 0; var o = p(e, r); if (n.snapToTicks) o = r[m(o, r)];
  7499. else if (0 !== o) { var a = Math.abs(o); if (a > 100) { var s = a.toFixed(0).length - 2,
  7500. l = Math.pow(10, s);
  7501. o = 0 | Math.round(o / l) * l } else a > y ? o = Math.round(o) : a > 1 ? o = +o.toFixed(1) : a > 0 && (o = +o.toFixed(2)) } i.multiplier = o } }), this._canAnimate = void 0, u.defineProperty(this, "_canAnimate", function() { var e = n._clockViewModel,
  7502. t = e.clockRange; if (n.shuttleRingDragging || t === r.UNBOUNDED) return !0; var i = e.multiplier,
  7503. o = e.currentTime,
  7504. a = e.startTime,
  7505. s = !1; if (t === r.LOOP_STOP) s = o.greaterThan(a) || o.equals(a) && i > 0;
  7506. else { var l = e.stopTime;
  7507. s = o.greaterThan(a) && o.lessThan(l) || o.equals(a) && i > 0 || o.equals(l) && 0 > i } return s || (e.shouldAnimate = !1), s }), this._isSystemTimeAvailable = void 0, u.defineProperty(this, "_isSystemTimeAvailable", function() { var e = n._clockViewModel,
  7508. t = e.clockRange; if (t === r.UNBOUNDED) return !0; var i = e.systemTime; return i.greaterThanOrEquals(e.startTime) && i.lessThanOrEquals(e.stopTime) }), this._isAnimating = void 0, u.defineProperty(this, "_isAnimating", function() { return n._clockViewModel.shouldAnimate && (n._canAnimate || n.shuttleRingDragging) }); var l = a(function() { var e = n._clockViewModel;
  7509. e.shouldAnimate ? (c(e), e.shouldAnimate = !1) : n._canAnimate && h(e) });
  7510. this._pauseViewModel = new s(l, { toggled: u.computed(function() { return !n._isAnimating }), tooltip: "Pause" }); var d = a(function() { var e = n._clockViewModel;
  7511. c(e); var t = e.multiplier;
  7512. t > 0 && (e.multiplier = -t), e.shouldAnimate = !0 });
  7513. this._playReverseViewModel = new s(d, { toggled: u.computed(function() { return n._isAnimating && e.multiplier < 0 }), tooltip: "Play Reverse" }); var v = a(function() { var e = n._clockViewModel;
  7514. c(e); var t = e.multiplier;
  7515. 0 > t && (e.multiplier = -t), e.shouldAnimate = !0 });
  7516. this._playForwardViewModel = new s(v, { toggled: u.computed(function() { return n._isAnimating && e.multiplier > 0 && e.clockStep !== t.SYSTEM_CLOCK }), tooltip: "Play Forward" }); var w = a(function() { var e = n._clockViewModel;
  7517. e.clockStep = t.SYSTEM_CLOCK, e.multiplier = 1, e.shouldAnimate = !0 }, u.getObservable(this, "_isSystemTimeAvailable"));
  7518. this._playRealtimeViewModel = new s(w, { toggled: u.computed(function() { return e.shouldAnimate && e.clockStep === t.SYSTEM_CLOCK }), tooltip: u.computed(function() { return n._isSystemTimeAvailable ? "Today (real-time)" : "Current time not in range" }) }), this._slower = a(function() { var e = n._clockViewModel;
  7519. c(e); var t = n._allShuttleRingTicks,
  7520. r = e.multiplier,
  7521. i = m(r, t) - 1;
  7522. i >= 0 && (e.multiplier = t[i]) }), this._faster = a(function() { var e = n._clockViewModel;
  7523. c(e); var t = n._allShuttleRingTicks,
  7524. r = e.multiplier,
  7525. i = m(r, t) + 1;
  7526. i < t.length && (e.multiplier = t[i]) }) }; return _.defaultDateFormatter = function(e) { var t = e.toGregorianDate(); return v[t.month - 1] + " " + t.day + " " + t.year }, _.defaultTicks = [.001, .002, .005, .01, .02, .05, .1, .25, .5, 1, 2, 5, 10, 15, 30, 60, 120, 300, 600, 900, 1800, 3600, 7200, 14400, 21600, 43200, 86400, 172800, 345600, 604800], _.defaultTimeFormatter = function(e, t) { var r = e.toGregorianDate(),
  7527. i = Math.round(r.millisecond); return Math.abs(t._clockViewModel.multiplier) < 1 ? l("%02d:%02d:%02d.%03d", r.hour, r.minute, r.second, i) : l("%02d:%02d:%02d UTC", r.hour, r.minute, r.second) }, _.prototype.getShuttleRingTicks = function() { return this._sortedFilteredPositiveTicks.slice(0) }, _.prototype.setShuttleRingTicks = function(e) { if (!i(e)) throw new o("positiveTicks is required."); var t, r, n, a = {},
  7528. s = this._sortedFilteredPositiveTicks; for (s.length = 0, t = 0, r = e.length; r > t; ++t) n = e[t], a.hasOwnProperty(n) || (a[n] = !0, s.push(n));
  7529. s.sort(d); var l = []; for (r = s.length, t = r - 1; t >= 0; --t) n = s[t], 0 !== n && l.push(-n);
  7530. Array.prototype.push.apply(l, s), this._allShuttleRingTicks = l }, n(_.prototype, { slower: { get: function() { return this._slower } }, faster: { get: function() { return this._faster } }, clockViewModel: { get: function() { return this._clockViewModel } }, pauseViewModel: { get: function() { return this._pauseViewModel } }, playReverseViewModel: { get: function() { return this._playReverseViewModel } }, playForwardViewModel: { get: function() { return this._playForwardViewModel } }, playRealtimeViewModel: { get: function() { return this._playRealtimeViewModel } }, dateFormatter: { get: function() { return this._dateFormatter }, set: function(e) { if ("function" != typeof e) throw new o("dateFormatter must be a function");
  7531. this._dateFormatter = e } }, timeFormatter: { get: function() { return this._timeFormatter }, set: function(e) { if ("function" != typeof e) throw new o("timeFormatter must be a function");
  7532. this._timeFormatter = e } } }), _._maxShuttleRingAngle = g, _._realtimeShuttleRingAngle = y, _ }), r("Widgets/BaseLayerPicker/BaseLayerPickerViewModel", ["../../Core/defined", "../../Core/defineProperties", "../../Core/DeveloperError", "../createCommand", "../../ThirdParty/knockout"], function(e, t, r, i, n) { "use strict"; var o = function(t, o) { if (!e(t)) throw new r("imageryLayers is required"); if (e(o)) { if (!Array.isArray(o)) throw new r("imageryProviderViewModels must be an array") } else o = []; var a = this;
  7533. this._imageryLayers = t, this.imageryProviderViewModels = o.slice(0), this.dropDownVisible = !1, n.track(this, ["imageryProviderViewModels", "dropDownVisible"]), this.selectedName = void 0, n.defineProperty(this, "selectedName", function() { var t = a.selectedItem; return e(t) ? t.name : void 0 }), this.selectedIconUrl = void 0, n.defineProperty(this, "selectedIconUrl", function() { var t = a.selectedItem; return e(t) ? t.iconUrl : void 0 }), this.selectedItem = void 0; var s = n.observable();
  7534. this._currentProviders = [], n.defineProperty(this, "selectedItem", { get: function() { return s() }, set: function(r) { var i, n = a._currentProviders,
  7535. o = n.length; for (i = 0; o > i; i++)
  7536. for (var l = t.getLength(), u = 0; l > u; u++) { var c = t.get(u); if (c.getImageryProvider() === n[i]) { t.remove(c); break } }
  7537. if (e(r)) { var h = r.creationCommand(); if (Array.isArray(h)) { var d = h.length; for (i = d - 1; i >= 0; i--) t.addImageryProvider(h[i], 0);
  7538. a._currentProviders = h.slice(0) } else a._currentProviders = [h], t.addImageryProvider(h, 0);
  7539. s(r) } a.dropDownVisible = !1 } }), this._toggleDropDown = i(function() { a.dropDownVisible = !a.dropDownVisible }) }; return t(o.prototype, { toggleDropDown: { get: function() { return this._toggleDropDown } }, imageryLayers: { get: function() { return this._imageryLayers } } }), o }), r("Widgets/BaseLayerPicker/BaseLayerPicker", ["../../Core/defined", "../../Core/defineProperties", "../../Core/destroyObject", "../../Core/DeveloperError", "../getElement", "./BaseLayerPickerViewModel", "../../ThirdParty/knockout"], function(e, t, r, i, n, o, a) { "use strict"; var s = function(t, r, s) { if (!e(t)) throw new i("container is required."); if (!e(r)) throw new i("imageryLayers is required.");
  7540. t = n(t); var l = new o(r, s);
  7541. this._viewModel = l, this._container = t, this._element = document.createElement("img"); var u = this._element;
  7542. u.setAttribute("draggable", "false"), u.className = "cesium-baseLayerPicker-selected", u.setAttribute("data-bind", " attr: {title: selectedName, src: selectedIconUrl}, click: toggleDropDown"), t.appendChild(u); var c = document.createElement("div");
  7543. this._choices = c, c.className = "cesium-baseLayerPicker-dropDown", c.setAttribute("data-bind", ' css: { "cesium-baseLayerPicker-visible" : dropDownVisible, "cesium-baseLayerPicker-hidden" : !dropDownVisible }, foreach: imageryProviderViewModels'), t.appendChild(c); var h = document.createElement("div");
  7544. h.className = "cesium-baseLayerPicker-item", h.setAttribute("data-bind", ' css: {"cesium-baseLayerPicker-selectedItem" : $data === $parent.selectedItem}, attr: {title: tooltip}, visible: creationCommand.canExecute, click: function($data) { $parent.selectedItem = $data }'), c.appendChild(h); var d = document.createElement("img");
  7545. d.className = "cesium-baseLayerPicker-itemIcon", d.setAttribute("data-bind", "attr: { src: iconUrl }"), d.setAttribute("draggable", "false"), h.appendChild(d); var m = document.createElement("div");
  7546. m.className = "cesium-baseLayerPicker-itemLabel", m.setAttribute("data-bind", "text: name"), h.appendChild(m), a.applyBindings(l, t), this._closeDropDown = function(e) { t.contains(e.target) || (l.dropDownVisible = !1) }, document.addEventListener("mousedown", this._closeDropDown, !0), document.addEventListener("touchstart", this._closeDropDown, !0) }; return t(s.prototype, { container: { get: function() { return this._container } }, viewModel: { get: function() { return this._viewModel } } }), s.prototype.isDestroyed = function() { return !1 }, s.prototype.destroy = function() { document.removeEventListener("mousedown", this._closeDropDown, !0), document.removeEventListener("touchstart", this._closeDropDown, !0); var e = this._container; return a.cleanNode(e), e.removeChild(this._element), e.removeChild(this._choices), r(this) }, s }), r("Widgets/BaseLayerPicker/ImageryProviderViewModel", ["../../Core/defineProperties", "../../Core/defined", "../../Core/DeveloperError", "../createCommand", "../../ThirdParty/knockout"], function(e, t, r, i, n) { "use strict"; var o = function(e) { if (!t(e.name)) throw new r("description.name is required."); if (!t(e.tooltip)) throw new r("description.tooltip is required."); if (!t(e.iconUrl)) throw new r("description.iconUrl is required."); if ("function" != typeof e.creationFunction) throw new r("description.creationFunction is required."); var o = e.creationFunction;
  7547. t(o.canExecute) || (o = i(o)), this._creationCommand = o, this.name = e.name, this.tooltip = e.tooltip, this.iconUrl = e.iconUrl, n.track(this, ["name", "tooltip", "iconUrl"]) }; return e(o.prototype, { creationCommand: { get: function() { return this._creationCommand } } }), o }), r("Widgets/BaseLayerPicker/createDefaultBaseLayers", ["require", "../BaseLayerPicker/ImageryProviderViewModel", "../../Core/buildModuleUrl", "../../Core/FeatureDetection", "../../Core/DefaultProxy", "../../Scene/BingMapsImageryProvider", "../../Scene/BingMapsStyle", "../../Scene/ArcGisMapServerImageryProvider", "../../Scene/OpenStreetMapImageryProvider", "../../Scene/TileMapServiceImageryProvider"], function(e, t, r, i, n, o, a, s, l, u) { "use strict";
  7548. function c() { var e = new n("http://cesium.agi.com/proxy/"),
  7549. c = i.supportsCrossOriginImagery() ? void 0 : e,
  7550. h = []; return h.push(new t({ name: "Bing Maps Aerial", iconUrl: r("Widgets/Images/ImageryProviders/bingAerial.png"), tooltip: "Bing Maps aerial imagery \nhttp://www.bing.com/maps", creationFunction: function() { return new o({ url: "http://dev.virtualearth.net", mapStyle: a.AERIAL, proxy: c }) } })), h.push(new t({ name: "Bing Maps Aerial with Labels", iconUrl: r("Widgets/Images/ImageryProviders/bingAerialLabels.png"), tooltip: "Bing Maps aerial imagery with label overlays \nhttp://www.bing.com/maps", creationFunction: function() { return new o({ url: "http://dev.virtualearth.net", mapStyle: a.AERIAL_WITH_LABELS, proxy: c }) } })), h.push(new t({ name: "Bing Maps Roads", iconUrl: r("Widgets/Images/ImageryProviders/bingRoads.png"), tooltip: "Bing Maps standard road maps\nhttp://www.bing.com/maps", creationFunction: function() { return new o({ url: "http://dev.virtualearth.net", mapStyle: a.ROAD, proxy: c }) } })), h.push(new t({ name: "ESRI World Imagery", iconUrl: r("Widgets/Images/ImageryProviders/esriWorldImagery.png"), tooltip: "World Imagery provides one meter or better satellite and aerial imagery in many parts of the world and lower resolution satellite imagery worldwide. The map includes NASA Blue Marble: Next Generation 500m resolution imagery at small scales (above 1:1,000,000), i-cubed 15m eSAT imagery at medium-to-large scales (down to 1:70,000) for the world, and USGS 15m Landsat imagery for Antarctica. The map features 0.3m resolution imagery in the continental United States and 0.6m resolution imagery in parts of Western Europe from DigitalGlobe. In other parts of the world, 1 meter resolution imagery is available from GeoEye IKONOS, i-cubed Nationwide Prime, Getmapping, AeroGRID, IGN Spain, and IGP Portugal. Additionally, imagery at different resolutions has been contributed by the GIS User Community.\nhttp://www.esri.com", creationFunction: function() { return new s({ url: "http://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer", proxy: e }) } })), h.push(new t({ name: "ESRI World Street Map", iconUrl: r("Widgets/Images/ImageryProviders/esriWorldStreetMap.png"), tooltip: "This worldwide street map presents highway-level data for the world. Street-level data includes the United States; much of Canada; Japan; most countries in Europe; Australia and New Zealand; India; parts of South America including Argentina, Brazil, Chile, Colombia, and Venezuela; Ghana; and parts of southern Africa including Botswana, Lesotho, Namibia, South Africa, and Swaziland.\nhttp://www.esri.com", creationFunction: function() { return new s({ url: "http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer", proxy: e }) } })), h.push(new t({ name: "ESRI National Geographic", iconUrl: r("Widgets/Images/ImageryProviders/esriNationalGeographic.png"), tooltip: "This web map contains the National Geographic World Map service. This map service is designed to be used as a general reference map for informational and educational purposes as well as a basemap by GIS professionals and other users for creating web maps and web mapping applications.\nhttp://www.esri.com", creationFunction: function() { return new s({ url: "http://services.arcgisonline.com/ArcGIS/rest/services/NatGeo_World_Map/MapServer/", proxy: e }) } })), h.push(new t({ name: "Open­Street­Map", iconUrl: r("Widgets/Images/ImageryProviders/openStreetMap.png"), tooltip: "OpenStreetMap (OSM) is a collaborative project to create a free editable map of the world.\nhttp://www.openstreetmap.org", creationFunction: function() { return new l({ url: "http://tile.openstreetmap.org/", proxy: c }) } })), h.push(new t({ name: "Stamen Watercolor", iconUrl: r("Widgets/Images/ImageryProviders/stamenWatercolor.png"), tooltip: "Reminiscent of hand drawn maps, Stamen watercolor maps apply raster effect area washes and organic edges over a paper texture to add warm pop to any map.\nhttp://maps.stamen.com", creationFunction: function() { return new l({ url: "http://tile.stamen.com/watercolor/", credit: "Map tiles by Stamen Design, under CC BY 3.0. Data by OpenStreetMap, under CC BY SA.", proxy: c }) } })), h.push(new t({ name: "Stamen Toner", iconUrl: r("Widgets/Images/ImageryProviders/stamenToner.png"), tooltip: "A high contrast black and white map.\nhttp://maps.stamen.com", creationFunction: function() { return new l({ url: "http://tile.stamen.com/toner/", credit: "Map tiles by Stamen Design, under CC BY 3.0. Data by OpenStreetMap, under CC BY SA.", proxy: c }) } })), h.push(new t({ name: "MapQuest Open­Street­Map", iconUrl: r("Widgets/Images/ImageryProviders/mapQuestOpenStreetMap.png"), tooltip: "OpenStreetMap (OSM) is a collaborative project to create a free editable map of the world.\nhttp://www.openstreetmap.org", creationFunction: function() { return new l({ url: "http://otile1.mqcdn.com/tiles/1.0.0/osm/", proxy: c }) } })), h.push(new t({ name: "The Black Marble", iconUrl: r("Widgets/Images/ImageryProviders/blackMarble.png"), tooltip: "The lights of cities and villages trace the outlines of civilization in this global view of the Earth at night as seen by NASA/NOAA's Suomi NPP satellite.", creationFunction: function() { return new u({ url: "http://cesium.agi.com/blackmarble", maximumLevel: 8, credit: "Black Marble imagery courtesy NASA Earth Observatory", proxy: c }) } })), h.push(new t({ name: "Natural Earth II", iconUrl: r("Widgets/Images/ImageryProviders/naturalEarthII.png"), tooltip: "Natural Earth II, darkened for contrast.\nhttp://www.naturalearthdata.com/", creationFunction: function() { return new u({ url: r("Assets/Textures/NaturalEarthII") }) } })), h } return c }), r("Widgets/isatCesiumWidget/isatCesiumWidget", ["../../Core/buildModuleUrl", "../../Core/Cartesian2", "../../Core/Cartesian3", "../../Core/Clock", "../../Core/DefaultProxy", "../../Core/defaultValue", "../../Core/defined", "../../Core/defineProperties", "../../Core/destroyObject", "../../Core/DeveloperError", "../../Core/Ellipsoid", "../../Core/Event", "../../Core/FeatureDetection", "../../Core/requestAnimationFrame", "../../Core/ScreenSpaceEventHandler", "../../Scene/BingMapsImageryProvider", "../../Scene/CentralBody", "../../Scene/Credit", "../../Scene/Scene", "../../Scene/SceneMode", "../../Scene/SceneTransitioner", "../../Scene/SkyAtmosphere", "../../Scene/SkyBox", "../../Scene/Sun", "../getElement"], function(e, t, r, i, n, o, a, s, l, u, c, h, d, m, p, f, v, y, g, _, w, C, x, S, E) { "use strict";
  7551. function b(t) { return e("Assets/Textures/SkyBox/tycho2t3_80_" + t + ".jpg") }
  7552. function T(e) {
  7553. function t() { if (!e.isDestroyed()) try { e._useDefaultRenderLoop ? (e.resize(), e.render(), m(t)) : e._renderLoopRunning = !1 } catch (r) { e._useDefaultRenderLoop = !1, e._renderLoopRunning = !1, e._onRenderLoopError.raiseEvent(e, r), e._showRenderLoopErrors && (e.showErrorPanel("An error occurred while rendering. Rendering has stopped.", r), console.error(r)) } } e._renderLoopRunning = !0, m(t) } var A = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHYAAAAaCAYAAABikagwAAAAAXNSR0IArs4c6QAAAAlwSFlzAAAN1wAADdcBQiibeAAAAAd0SU1FB9wGGRQyF371QVsAABOHSURBVGje7Vp5cFTHmf91v2Nm3owGnYMuEEJCOBiEjDlsDMYQjGMOOwmXcWxiLywpJ9iuTXZd612corJssFOxi8LerXizxEGUvWsivNxxHHCQ8WYBYSFzmUMCCXQjaUajOd/V+4f6Kc14kI/KZv/xq+p6M/PmO15/9/c1wa0vwpcMQAHgBuAFoPG7mz8jAGwASQBxADFhJQGYACwAjK+vrr/AJQ8jVMqfuwH4AGQByAaQnTNqXGHWqHGFbq8/g1BJsgw9GQ12Bds/qWsxEvEeAEEAfQDCAKKCgPGVcP//BOsIVQHgAZAJIACgsHTqvDvK7150T2bR2DFaZm6W4slwUypR20yaiUg4OtDbcaP36rlPPt6/7f2B3q5mAB0AeriAE18J9y93kVu4X4W73BwAhQBK5v/gZ98ZVXXvDG92IJMx569MQDEoK0tPmOHu1s4L7799sH7vtvcAXAPQCaCfu2qLu+7h+Eh3sS8Bcyt48iVgPos2+4J7jS+BIx2etDBSynfH/Xq46y0CUL70n3/zXMmUuXepWoZHFCQhFIQARCBFJYV6/Nn+QHnVBH9Ovq/51JFWADpfJhcqEzyDcx9ukTTr/xr2VnDpng0nuHR0h1u3wvWF6EspgBIAFYAfQAGAsuU/rfm7kePvvJ0QiTj6QSgBISS9ujEGSikkxaXklIwfK8uK2Xru2HVurWKspZyezGmmWwp/LqVsupPQub4grPQ5YIejKQvPJAGflLLJSBGmxPEqKXhU4XdJEBq7BR5Z+L+DKx3MTTHWEaybx9WCud/btCJQMeX2Qevk+NPoks0YPArF/RUj0NyXxOmO2CAy1a1OmL9yUVfTmatXTx52EildYFQVNlgRmBR1xQJgCBbPBAVUhcw8lTObLz0FVk4RIEmJJyJNZzFBiCTFBRL+f50rriFUATRFiZSU/XYEAw6X5LlIUghZqXvl5p8pfycRZsgjymlKGw1Adm7JbRUVs785nwGghP5pp9mfFMOxWstmuC3gwdcrRqA/buJUWwyKRMAYgydrZNZt9337623njn+ixyN9nAmdM5nBvYOPfxc3mnEmTQ4T5VZv8hfz8aUKnocJd5tvVhxAhOMADzNefleFjRUFa/D/xzi8LQhIEpTG4VXnNBzlZYISufk7juCfqaAoLkHYcZ6HBAEM8O+ObJz3HcFDpJfDJwWYfiHMMTklviocKHv6I3+zRFLdKhEEatmALBFIBIibNhQ6KFyJEjT2JHDoUj/a+nVIVIBhBGOnzptWXzhmTFfT2TZBOH4AgSeeeGJqRUVFqdfr9btcLnVQXwapmqZpJZPJRCgUCh47duzie++9dwWAXl5enrlp06bF0WhUM01TYYwRrmg2vzNKqS3Lsunz+Yy6urpTP//5z09blkVLSkryVq9ePT03NzegqqqbUnqTGyOEMNM0k319fX2///3vz9bW1l4DYD700EPFy5Ytm65pmvbBBx9c2rp166Wnnnqq7MEHH5zAGIu8/vrr+w8ePPgJVwrRO2gAcg8cOLA2mUx62tvbB9avX39s+fLlo++///5JXNiwbXugpqam9tChQ2cEj6NzuQwlsi+//PKSzMzMQtu2qcfjMZqbm09v2LDht4J3sQEQOU2Jo8mKKzt7VEU5lSgFBi3PZkBZrgv3lGbCo1Jc7I7iSGN40JcQgoGkhXdO94ESQJEoGI+1k/M9mDKqQHEv++akl186e45rNAAE3njjjccWLFhwfyAQyJEkiabGbcc7JJNJva2trX3Lli3vvPbaa+eKi4uLV6xY8d10cf5TcZ8x5OXl5b366qs9lFLtrbfeWldVVXW7pmkuxhjS0SSEIJlMGitXrrz2/PPPv1lTU3NtypQp0x955JG/kmVZdrlcR7du3WrOnTt33pIlS+YDwNGjR68ePHiwjVtukm+wI9ichQsXPgUAHR0d3evXr78xc+bMu9asWbOQUjpENz8/v/jQoUP/IiiH40UzAeQvW7Zs1rp16/7a5/NpDr/19fWlGzZsOM4tNsphkc5iPaXTvl6uuDUvY4MZLwNQ4Ffw+LR8+KQQTCuJSQUFcMsEe88FoSkSKCFwyWSISQbg9pEefHdGAJHIdUydVjFecL3K448/Pm3hwoUPBAKBHFGIlmU5pRCRpMGEze12q2PHjh2zatWqeTt37gwODAxkOQIJhUJ6Y2Njn6IojFJqE0KYsGyPx0POnTvXnUgkfGvXrr1j5syZU7iFsKampv5YLBZ34GzbJgAwatSo7MzMTE95eXnZT37yk0dramr+PRQKZSQSCdPn88nBYNADID8UCmkAYBiGGQ6Hna6cksbdZliWZUuSRKPRKAAUBINBfywWM30+n+yEtenTp9+5YsWKGTt37oxwz+a44RwARc8+++xSr9eriQrY398v8311CUncTTHN0Q7Vl1OQJymq4iBwyxQPT8qDVwri1d1/i8ttp/AP39mOBeMn41pQx9mOGFSZ3qT52ZqMR6aMRGvXKfzbgX9Ea3PnSLEdOWXKlK/5/X4/AFy8ePHG6tWr90QikS5VVaOEEIsxRhljngcffLBi8+bNjxBCUFJSMrKkpMRvGIbboXP27Nn+2bNn/3cgEIgSQmKEEAOARQixKKVxRVEioVAoYtu2dMcdd4x24Hbv3t3+ox/96ONoNBqklMa4ppNkMinNnz8///nnn6/y+Xw0mUxaANy6rrsdl28YhguAX9d1F98jwn9TUjJkJ5N1DWV0ti0ByDAMw+PsbzQatX0+Hy0oKMhcvnz5nP3791+IxWJRIUaPfO655+ZVVlaOA4BoNGprmkZ5uJJThZouKyYAqOrWVEKoE7cwszQDlQUK3jr8S5y++iEIIXh55/fwylOH8e3KHHSEdfQnLFBuRbJEsLQyF27Sh3eO/iuudV+EaSuqkJF6MjMzs9xutwIAv/rVr06eOHHiEwCtPBHQOaPaxYsXLxcXF8cKCwtzOzo6+ltbW4OFhYU+h2nDMAgAqbu7W8xkLSEBcsos1bbtocZIIBBQs7Ky5Pb2dkvXdV1wfaipqemsqak5yF1bFABljNEU4Sj87nia1LKHCJWGLLh6AkDhiksAoLq6um/VqlWZWVlZ8gMPPHDHwoULK2tqasJcYJ7y8vKyb33rW/f4/X43YwybNm26vnnz5pIUb0tvVe44maSVjEfizDJtmwFlOS4srczGiQvv4ncnd4ASAkIo+mN92LLrB/j7Vb/GQxOz8Z/1PTDsQXc6p3QEqopU7Dr6S5y8fAiKpCKhs6SQSUqyLKsO4d7e3j4AvbxD1csFQQF4EolEaP369TVCFjuiqKiogG8w5s6dm8sY++ZwcfbZZ5/dvHXr1isnT55scVz+rFmz8urr6xc4Ls22bZZIJExd181oNGr09PREDx06dPmFF144Ho/HTVGIjiE4guECoyl1LYTPcppGEAghDAAikUjixRdfbHnppZfKfD6fa82aNfMOHz7cHgwGbwBwr1ix4u677rqrgsfU4I4dO66lCPZTXSkqpOaMa60e7mjuosw0RmYoWHf3SLT3NOKt91+CbsZBeOlDCcX5luP4rw9fw4wSH+4p9cMlU3xtpAfLJmej/vIR7PnjLyDRwXeKhoxubokWAOYkDXxTLE5brB11oTZMCrWoNQgymJwZhsHC4bAZjUaNaDRqxGIx3VnxeDzJky8TQGLHjh3n9u3bd6ytrS3U2dkZ6e3tjfX398cHBgYS8XjcIIQQr9frKioq8ldWVhb88Ic/vHfbtm3zAXhs25aHUx7uEt1COeXEXM3JfAWLvWnSxRhLbNu2rampqSlMCME3vvGNyXPmzKkCUFZeXn776tWr72WMwbZtvPDCCx+5XK6wo6BcOdhwQ4Chuu/KR39onDGS9T80u9ivkgiqD/0UbT2NcKvelMaEhXfrqlGaPwEPT5qH0lwvqopcaOtpxPb3/gmGmYBEFRBC0HUlfp67tQQALxMKYsaYU+tlcSadNN8NIOO+++4bnZ2d7Q+Hw+zIkSNJxtiQ9TQ1NUW3bNnSmJWVlZBlWaeUWs5SVTUxYsSIRF1dXScAwzTN2MMPP7w3Pz//ZFVVVUFubq7L6/VKmqZRl8ulKIriVlVVmz59ev6cOXMCLpeLLliwYDyAOpGm08SglA659mQy6eHTrwiPtRYXbi6vP2/yjI61AoDL5Ur09vZ2bt++/ezGjRvvppSSjRs3Lti9e/fvnnzyyfHjx48fyRjDwYMHL9TW1jYWFhZ6xfIs3UhUTlPQRwGE9Gv/c/ba9YGi2rPv0FONf/iUUB3Lj8SDqD60GYtmdGBcYSVOnL+K39b9Gp19zVDkwZzBSpLY9Qv9Z3lKHgOgmaYZd9zg1KlTS994441L3G3lcD6oo/1btmxZFwgEctrb27vWrFlzwLIs2cmKW1pa4q+//vp1AbchdIKiPGZHAJDFixcHpk+ffnsoFNLefvvt3ra2Nl0YSDhdt4zy8vLwsWPHsl0ul6ooigSACuEZXKBJwzAMxhhUVZW8Xm8uH5hQ3mCwOf95VVVVYx03yQVhUEpNQbBxADfefPPN6NKlS8dUVlYWVlZW5r344osz1q1bV8IYQzAYjFVXV5+IxWIdkiTlpfDCUgcC6Sw2CqBvw4ZN+7/9d+Wzo1avT5HU9N1tMpj4dfU14z/efxletx9xPYpIPAhVccO2bVBKcf189I/h3mSLkBi5b9y40RWLxZJer9f12GOPTa6oqMjq6enpJYQYlFLGyx21tLQ0MGnSpDGEECQSCZMQIjuNCF6aqI8++mheVlZWJrdYkzcoLEVREj6fL1FfX39x165dzfPnzy/7/ve/v1LXdWvlypVde/bsuRKLxQyn1LEsS2aMeebNm1fs8/lkxhgsy7IAJBRF0Yc2TZZ1AANNTU0djoJt2rRpzqxZs/K6urq6JUnSCSHMMAxZ07SsxYsXV1JKCWMMAwMDMQBhVVWTjtU6gr1y5Yq1d+/ej8aNG5eraZr6zDPPjPV4PBJjDLW1ted27dr1MYCYqqpDcpMkyRIaEyydxToxNgagr7e3t+XEe0rNxPkjnvhTznNr4Sb0KBL6YO9BovJQnRXptTqaPgr9wTLsDgAhTkOurq4+unz58vs1TRvl9/vVuXPnljHGxgqxw2GcEjLYJLlw4cKV06dPd06bNo04+MePH+/ftm3bNNG1iW5KVVVl//79ew4cONC8d+/ey88884ysKIp85513jpo8eXJh2pHX4EUIITh58uRFAN1utzvHcb0ejycGoKuurk5vbW29u7i4ODB69OisJ5988i4xxDhsKIoiEUJgmqZ94MCBOgBdmqaVODxrmhbhiaP+4x//+N2lS5dOmjBhwhiPxyMBQFdXV191dfX7tm23AdBdLtdQzFYUxWmb3iRcmqbh7vQfOz9+v/PdjvP6kcHuE288MJZWuM4Smw1mgkQvHw/v6Wga+BjADY53AEDfmTNnLq9du/Znp06datB13RA3ROwGmaZphcPhgX379v326aefftO27Tafz9fJGGOmadqMMSbLMpEkiaZbjDFommYQQsK1tbWNr7zyymvhcLifEIJbwRBCmGVZ1vHjxz9atGjRLwA0Z2dndzpdHb/fHwTQcuLEiYann3761fPnz3+i67pBCCGUUkoIofwjpZQS27ZZd3f3ja1bt1Zv3LhxL4CrmZmZPYQQkxCCjIyMEIB2AG0Amrdv3/6beDweNwzD1nXdPHXq1Indu3cf48+7MjIyupw98ng8EW4wCWH4kHbQLgsnJ4oAlN332Ji1hbeps6lEaLohQLrhQCJi9zcei77TcLh9H4CrALp4rLN5LBvBE4scAP6JEyfmBQIBL6VUopSCMcYGBgYSly5dCvX19YW5QkQAmD6fz3PvvfeWxmIxr2EYHqFXPBRrKKWWJEmG1+uNtbW1dTU0NNzgz7wA/OXl5bkFBQV+XsYQwVpZMpk0jh8/3snpRQCYo0aN8k6YMCHX5XLRa9euBRsaGnr4Jnp458c7ceLEbK/X6xL5MQzDbGhoCNq2HeO4YgBYWVmZv6KiIkdVVbS0tHQ3NDR0CsORrDlz5oyllHoYY3p9ff31cDjczeGhaVrGkiVLSg3DkLu7u/s+/PDDFn4UKeJYLhnmAJvGs9QCAKOnLMhfNHqSNl/LlHOpTORbWa4et2ORXqv1wgf9NVfO9B7nTYcuPvlICq02t9CJ8ggjOJomodOF0ZQtHNvxCC08pBnbmcIhO53jdA7mpXaKUkOSWGoxYaaKlIa7IozT0uET+XDGehDGhhBGb6bTmBHezeb8OyNPCPQk/ptzeHConCSfcZDNI1hWQXaBVl5254hZmSPVce4MKUdxEQ+VJMnUbcNIWJFoyOzoa02eOX2k+yg/79TFNWkgZchOUobe4vA63WzUEmpYsa+dCoM0Izgz5aQkTUOPpGvUpKFJBaUR8Q03cLdT8NkppyEgPGOCYcnCiNASsn2SwrstDA2Gxnbkc5xSdHGrcmaBWYoqZ+YUe4pcXuqXJCobupWIhaze3vZohzAfdOaKN2mSwPxwR0ZSZ6uptZoIN9yxFCYIiqV5v3THStgwNNPhvtXxFgzDP9K8q52Cj6ZRNnaLffoUDfI5zhVLgrvxCN0Ux5URYXYYF84Wf2qqf4uDV591ZuiLHir7c8F+mZOU5M+Iazg8n3mYjnxORkV3I6dxg6KrMQW3Yaexlq+uv8D1v2IL+t4z3B/NAAAAAElFTkSuQmCC",
  7554. M = function(e, t) { if (!a(e)) throw new u("container is required.");
  7555. e = E(e), t = o(t, {}); var s = document.createElement("div");
  7556. s.className = "cesium-widget", e.appendChild(s), this._element = s; try { var l = document.createElement("canvas");
  7557. l.oncontextmenu = function() { return !1 }, l.onselectstart = function() { return !1 }, s.appendChild(l); var m = document.createElement("div");
  7558. m.className = "cesium-widget-credits", s.appendChild(m); var T = new g(l, t.contextOptions, m);
  7559. T.getCamera().controller.constrainedAxis = r.UNIT_Z; var M = c.WGS84,
  7560. P = T.getFrameState().creditDisplay,
  7561. D = new y("isatCesium", A, "http://cesium.agi.com/");
  7562. P.addDefaultCredit(D); var I = new v(M);
  7563. T.getPrimitives().setCentralBody(I), T.skyBox = new x({ positiveX: b("px"), negativeX: b("mx"), positiveY: b("py"), negativeY: b("my"), positiveZ: b("pz"), negativeZ: b("mz") }), T.skyAtmosphere = new C(M), T.sun = new S; var O = t.imageryProvider;
  7564. a(O) || (O = new f({ url: "http://dev.virtualearth.net", proxy: d.supportsCrossOriginImagery() ? void 0 : new n("http://cesium.agi.com/proxy/") })), O !== !1 && I.getImageryLayers().addImageryProvider(O), a(t.terrainProvider) && (I.terrainProvider = t.terrainProvider), this._container = e, this._canvas = l, this._canvasWidth = l.width, this._canvasHeight = l.height, this._scene = T, this._centralBody = I, this._clock = o(t.clock, new i), this._transitioner = new w(T, M), this._screenSpaceEventHandler = new p(l), this._useDefaultRenderLoop = void 0, this._renderLoopRunning = !1, this._creditContainer = m, this._canRender = !1, this._showRenderLoopErrors = o(t.showRenderLoopErrors, !0), this._onRenderLoopError = new h, t.sceneMode && (t.sceneMode === _.SCENE2D && this._transitioner.to2D(), t.sceneMode === _.COLUMBUS_VIEW && this._transitioner.toColumbusView()), this.useDefaultRenderLoop = o(t.useDefaultRenderLoop, !0) } catch (R) { var L = "Error constructing isatCesiumWidget. Check if WebGL is enabled."; throw this.showErrorPanel(L, R), R } }; return s(M.prototype, { container: { get: function() { return this._container } }, sceneTransitioner: { get: function() { return this._transitioner } }, canvas: { get: function() { return this._canvas } }, creditContainer: { get: function() { return this._creditContainer } }, scene: { get: function() { return this._scene } }, centralBody: { get: function() { return this._centralBody } }, clock: { get: function() { return this._clock } }, screenSpaceEventHandler: { get: function() { return this._screenSpaceEventHandler } }, onRenderLoopError: { get: function() { return this._onRenderLoopError } }, useDefaultRenderLoop: { get: function() { return this._useDefaultRenderLoop }, set: function(e) { this._useDefaultRenderLoop !== e && (this._useDefaultRenderLoop = e, e && !this._renderLoopRunning && T(this)) } } }), M.prototype.showErrorPanel = function(e, t) { var r = this._element,
  7565. i = document.createElement("div");
  7566. i.className = "cesium-widget-errorPanel"; var n = document.createElement("div");
  7567. n.className = "cesium-widget-errorPanel-content", i.appendChild(n); var o = document.createElement("div"); if (o.className = "cesium-widget-errorPanel-header", o.textContent = e, n.appendChild(o), a(t)) { var s = document.createElement("div");
  7568. s.className = "cesium-widget-errorPanel-message", s.textContent = t, n.appendChild(s) } var l = document.createElement("div");
  7569. l.className = "cesium-widget-errorPanel-buttonPanel", n.appendChild(l); var u = document.createElement("span");
  7570. u.className = "cesium-widget-button", u.textContent = "OK", u.tabIndex = 100, u.onclick = function() { r.removeChild(i) }, l.appendChild(u), r.appendChild(i) }, M.prototype.isDestroyed = function() { return !1 }, M.prototype.destroy = function() { this._container.removeChild(this._element), l(this) }, M.prototype.resize = function() { var e = this._canvas,
  7571. t = e.clientWidth,
  7572. r = e.clientHeight; if (this._canvasWidth !== t || this._canvasHeight !== r) { e.width = this._canvasWidth = t, e.height = this._canvasHeight = r; var i = 0 !== t && 0 !== r; if (this._canRender = i, i) { var n = this._scene.getCamera().frustum;
  7573. a(n.aspectRatio) ? n.aspectRatio = t / r : (n.top = n.right * (r / t), n.bottom = -n.top) } } }, M.prototype.render = function() { this._scene.initializeFrame(); var e = this._clock.tick();
  7574. this._canRender && this._scene.render(e) }, M }), r("Widgets/ClockViewModel", ["../Core/Clock", "../Core/defaultValue", "../Core/defineProperties", "../Core/destroyObject", "../Core/EventHelper", "../Core/JulianDate", "../ThirdParty/knockout"], function(e, t, r, i, n, o, a) {
  7575. "use strict";
  7576. var s = function(r) {
  7577. r = t(r, new e), this._clock = r, this._eventHelper = new n, this._eventHelper.add(r.onTick, this.synchronize, this);
  7578. var i = a.observable(r.startTime);
  7579. i.equalityComparer = o.equals, this.systemTime = a.observable(new o), this.systemTime.equalityComparer = o.equals, a.track(this, ["systemTime"]), this.startTime = void 0, a.defineProperty(this, "startTime", { get: i, set: function(e) { i(e), r.startTime = e } });
  7580. var s = a.observable(r.stopTime);
  7581. s.equalityComparer = o.equals, this.stopTime = void 0, a.defineProperty(this, "stopTime", { get: s, set: function(e) { r.stopTime = e, s(e) } });
  7582. var l = a.observable(r.currentTime);
  7583. l.equalityComparer = o.equals, this.currentTime = void 0, a.defineProperty(this, "currentTime", { get: l, set: function(e) { r.currentTime = e, l(e) } });
  7584. var u = a.observable(r.multiplier);
  7585. this.multiplier = void 0, a.defineProperty(this, "multiplier", { get: u, set: function(e) { r.multiplier = e, u(e) } });
  7586. var c = a.observable(r.clockStep);
  7587. c.equalityComparer = function(e, t) { return e === t }, this.clockStep = void 0, a.defineProperty(this, "clockStep", { get: c, set: function(e) { c(e), r.clockStep = e } });
  7588. var h = a.observable(r.clockRange);
  7589. h.equalityComparer = function(e, t) { return e === t }, this.clockRange = void 0, a.defineProperty(this, "clockRange", { get: h, set: function(e) { h(e), r.clockRange = e } });
  7590. var d = a.observable(r.shouldAnimate);
  7591. this.shouldAnimate = void 0, a.defineProperty(this, "shouldAnimate", {
  7592. get: d,
  7593. set: function(e) {
  7594. d(e), r.shouldAnimate = e
  7595. }
  7596. })
  7597. };
  7598. return r(s.prototype, { clock: { get: function() { return this._clock } } }), s.prototype.synchronize = function() { var e = this._clock,
  7599. t = e.startTime,
  7600. r = e.stopTime,
  7601. i = e.currentTime,
  7602. n = e.multiplier,
  7603. a = e.clockStep,
  7604. s = e.clockRange,
  7605. l = e.shouldAnimate;
  7606. this.systemTime = new o, this.startTime = t, this.stopTime = r, this.currentTime = i, this.multiplier = n, this.clockStep = a, this.clockRange = s, this.shouldAnimate = l }, s.prototype.isDestroyed = function() { return !1 }, s.prototype.destroy = function() { this._eventHelper.removeAll(), i(this) }, s
  7607. }), r("Widgets/Command", ["../Core/DeveloperError"], function(e) { "use strict"; var t = function() { throw this.canExecute = void 0, this.beforeExecute = void 0, this.afterExecute = void 0, new e("This type should not be instantiated directly.") }; return t }), r("Widgets/FullscreenButton/FullscreenButtonViewModel", ["../../Core/defaultValue", "../../Core/defineProperties", "../../Core/destroyObject", "../../Core/DeveloperError", "../../Core/Fullscreen", "../createCommand", "../../ThirdParty/knockout"], function(e, t, r, i, n, o, a) { "use strict"; var s = function(t) { var r = this,
  7608. i = a.observable(n.isFullscreen()),
  7609. s = a.observable(n.isFullscreenEnabled());
  7610. this.isFullscreen = void 0, a.defineProperty(this, "isFullscreen", { get: function() { return i() } }), this.isFullscreenEnabled = void 0, a.defineProperty(this, "isFullscreenEnabled", { get: function() { return s() }, set: function(e) { s(e && n.isFullscreenEnabled()) } }), this.tooltip = void 0, a.defineProperty(this, "tooltip", function() { return this.isFullscreenEnabled ? i() ? "Exit full screen" : "Full screen" : "Full screen unavailable" }), this._command = o(function() { n.isFullscreen() ? n.exitFullscreen() : n.requestFullscreen(r._fullscreenElement) }, a.getObservable(this, "isFullscreenEnabled")), this._fullscreenElement = e(t, document.body), this._callback = function() { i(n.isFullscreen()) }, document.addEventListener(n.getFullscreenChangeEventName(), this._callback) }; return t(s.prototype, { fullscreenElement: { get: function() { return this._fullscreenElement }, set: function(e) { if (!(e instanceof Element)) throw new i("value must be a valid Element.");
  7611. this._fullscreenElement = e } }, command: { get: function() { return this._command } } }), s.prototype.isDestroyed = function() { return !1 }, s.prototype.destroy = function() { document.removeEventListener(n.getFullscreenChangeEventName(), this._callback), r(this) }, s }), r("Widgets/FullscreenButton/FullscreenButton", ["../../Core/defined", "../../Core/defineProperties", "../../Core/DeveloperError", "../../Core/destroyObject", "../getElement", "./FullscreenButtonViewModel", "../../ThirdParty/knockout"], function(e, t, r, i, n, o, a) { "use strict"; var s = function(t, i) { if (!e(t)) throw new r("container is required.");
  7612. t = n(t), this._container = t, this._viewModel = new o(i), this._element = document.createElement("button"), this._element.type = "button", this._element.className = "cesium-fullscreenButton", this._element.setAttribute("data-bind", 'attr: { title: tooltip },css: { "cesium-fullscreenButton-exit": isFullscreen },click: command,enable: isFullscreenEnabled'), t.appendChild(this._element), a.applyBindings(this._viewModel, this._element) }; return t(s.prototype, { container: { get: function() { return this._container } }, viewModel: { get: function() { return this._viewModel } } }), s.prototype.isDestroyed = function() { return !1 }, s.prototype.destroy = function() { var e = this._container; return a.cleanNode(e), this._viewModel.destroy(), e.removeChild(this._element), i(this) }, s }), r("Widgets/HomeButton/HomeButtonViewModel", ["../../Core/Cartesian3", "../../Core/defaultValue", "../../Core/defined", "../../Core/defineProperties", "../../Core/DeveloperError", "../../Core/Ellipsoid", "../../Core/Extent", "../../Core/Math", "../../Core/Matrix4", "../../Scene/Camera", "../../Scene/CameraColumbusViewMode", "../../Scene/CameraFlightPath", "../../Scene/PerspectiveFrustum", "../../Scene/SceneMode", "../createCommand", "../../ThirdParty/knockout"], function(e, t, r, i, n, o, a, s, l, u, c, h, d, m, p, f) { "use strict";
  7613. function v(t, i, n, o) { var s = t.mode,
  7614. d = t.getCamera();
  7615. d.controller.constrainedAxis = e.UNIT_Z; var p = t.getScreenSpaceCameraController();
  7616. p.setEllipsoid(i), p.columbusViewMode = c.FREE; var f = t.getCanvas();
  7617. r(n) && s === m.MORPHING && n.completeMorph(); var v, y; if (s === m.SCENE2D) d.transform = new l(0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1), y = { destination: a.MAX_VALUE, duration: o }, v = h.createAnimationExtent(t, y), t.getAnimations().add(v);
  7618. else if (s === m.SCENE3D) { e.add(d.position, l.getTranslation(d.transform), d.position); var g = l.getRotation(d.transform);
  7619. g.multiplyByVector(d.direction, d.direction), g.multiplyByVector(d.up, d.up), g.multiplyByVector(d.right, d.right), d.transform = l.IDENTITY.clone(); var _ = new u(f);
  7620. y = { destination: _.position, duration: o, up: _.up, direction: _.direction }, v = h.createAnimation(t, y), t.getAnimations().add(v) } else if (s === m.COLUMBUS_VIEW) { d.transform = new l(0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1); var w = i.getMaximumRadius(),
  7621. C = new e(0, -1, 1).normalize().multiplyByScalar(5 * w),
  7622. x = e.ZERO.subtract(C).normalize(),
  7623. S = x.cross(e.UNIT_Z),
  7624. E = S.cross(x);
  7625. y = { destination: C, duration: o, up: E, direction: x }, v = h.createAnimation(t, y), t.getAnimations().add(v) } } var y = function(e, i, a, s) { if (!r(e)) throw new n("scene is required.");
  7626. a = t(a, o.WGS84), s = t(s, 1500), this._scene = e, this._ellipsoid = a, this._transitioner = i, this._flightDuration = s; var l = this;
  7627. this._command = p(function() { v(l._scene, l._ellipsoid, l._transitioner, l._flightDuration) }), this.tooltip = "View Home", f.track(this, ["tooltip"]) }; return i(y.prototype, { sceneTransitioner: { get: function() { return this._transitioner } }, scene: { get: function() { return this._scene } }, ellipsoid: { get: function() { return this._ellipsoid } }, command: { get: function() { return this._command } }, flightDuration: { get: function() { return this._flightDuration }, set: function(e) { if (0 > e) throw new n("value must be positive.");
  7628. this._flightDuration = e } } }), y }), r("Widgets/HomeButton/HomeButton", ["../../Core/defined", "../../Core/defineProperties", "../../Core/destroyObject", "../../Core/DeveloperError", "../getElement", "./HomeButtonViewModel", "../../ThirdParty/knockout"], function(e, t, r, i, n, o, a) { "use strict"; var s = function(t, r, s, l, u) { if (!e(t)) throw new i("container is required.");
  7629. t = n(t), this._container = t, this._viewModel = new o(r, s, l, u), this._element = document.createElement("span"), this._element.className = "cesium-homeButton", this._element.setAttribute("data-bind", "attr: { title: tooltip }, click: command"), t.appendChild(this._element), a.applyBindings(this._viewModel, this._element) }; return t(s.prototype, { container: { get: function() { return this._container } }, viewModel: { get: function() { return this._viewModel } } }), s.prototype.isDestroyed = function() { return !1 }, s.prototype.destroy = function() { var e = this._container; return a.cleanNode(e), e.removeChild(this._element), r(this) }, s }), r("Widgets/Observable", ["../Core/DeveloperError"], function(e) { "use strict"; var t = function() { throw new e("This type should not be instantiated directly.") }; return t }), r("Widgets/SceneModePicker/SceneModePickerViewModel", ["../../Core/defineProperties", "../../Core/defined", "../../Core/destroyObject", "../../Core/DeveloperError", "../../Core/EventHelper", "../../Scene/SceneMode", "../createCommand", "../../ThirdParty/knockout"], function(e, t, r, i, n, o, a, s) { "use strict"; var l = function(e) { if (!t(e)) throw new i("transitioner is required.");
  7630. this._transitioner = e; var r = this,
  7631. l = function(e, t, i) { r.sceneMode = i, r.dropDownVisible = !1 };
  7632. this._eventHelper = new n, this._eventHelper.add(e.onTransitionStart, l), this.sceneMode = e.getScene().mode, this.dropDownVisible = !1, this.tooltip2D = "2D", this.tooltip3D = "3D", this.tooltipColumbusView = "Columbus View", s.track(this, ["sceneMode", "dropDownVisible", "tooltip2D", "tooltip3D", "tooltipColumbusView"]), this.selectedTooltip = void 0, s.defineProperty(this, "selectedTooltip", function() { var e = r.sceneMode; return e === o.SCENE2D ? r.tooltip2D : e === o.SCENE3D ? r.tooltip3D : r.tooltipColumbusView }), this._toggleDropDown = a(function() { r.dropDownVisible = !r.dropDownVisible }), this._morphTo2D = a(function() { e.morphTo2D() }), this._morphTo3D = a(function() { e.morphTo3D() }), this._morphToColumbusView = a(function() { e.morphToColumbusView() }), this._sceneMode = o }; return e(l.prototype, { sceneTransitioner: { get: function() { return this._transitioner } }, toggleDropDown: { get: function() { return this._toggleDropDown } }, morphTo2D: { get: function() { return this._morphTo2D } }, morphTo3D: { get: function() { return this._morphTo3D } }, morphToColumbusView: { get: function() { return this._morphToColumbusView } } }), l.prototype.isDestroyed = function() { return !1 }, l.prototype.destroy = function() { this._eventHelper.removeAll(), r(this) }, l }), r("Widgets/SceneModePicker/SceneModePicker", ["../../Core/defineProperties", "../../Core/defined", "../../Core/destroyObject", "../../Core/DeveloperError", "../getElement", "./SceneModePickerViewModel", "../../ThirdParty/knockout"], function(e, t, r, i, n, o, a) { "use strict"; var s = function(e, r) { if (!t(e)) throw new i("container is required."); if (!t(r)) throw new i("transitioner is required.");
  7633. e = n(e); var s = new o(r);
  7634. this._viewModel = s, this._container = e, this._element = document.createElement("span"); var l = this._element;
  7635. l.className = "cesium-sceneModePicker-button", l.setAttribute("data-bind", ' css: { "cesium-sceneModePicker-button2D": sceneMode === _sceneMode.SCENE2D, "cesium-sceneModePicker-button3D": sceneMode === _sceneMode.SCENE3D, "cesium-sceneModePicker-buttonColumbusView": sceneMode === _sceneMode.COLUMBUS_VIEW, "cesium-sceneModePicker-selected": dropDownVisible}, attr: { title: selectedTooltip }, click: toggleDropDown'), e.appendChild(l); var u = document.createElement("span");
  7636. u.className = "cesium-sceneModePicker-button cesium-sceneModePicker-button3D", u.setAttribute("data-bind", ' css: { "cesium-sceneModePicker-visible" : (dropDownVisible && (sceneMode !== _sceneMode.SCENE3D)) || (!dropDownVisible && (sceneMode === _sceneMode.SCENE3D)), "cesium-sceneModePicker-none" : sceneMode === _sceneMode.SCENE3D, "cesium-sceneModePicker-hidden" : !dropDownVisible}, attr: { title: tooltip3D }, click: morphTo3D'), e.appendChild(u), this._node3D = u; var c = document.createElement("span");
  7637. c.className = "cesium-sceneModePicker-button cesium-sceneModePicker-button2D", c.setAttribute("data-bind", ' css: { "cesium-sceneModePicker-visible" : (dropDownVisible && (sceneMode !== _sceneMode.SCENE2D)), "cesium-sceneModePicker-none" : sceneMode === _sceneMode.SCENE2D, "cesium-sceneModePicker-hidden" : !dropDownVisible}, attr: { title: tooltip2D }, click: morphTo2D'), e.appendChild(c), this._node2D = c; var h = document.createElement("span");
  7638. h.className = "cesium-sceneModePicker-button cesium-sceneModePicker-buttonColumbusView", h.setAttribute("data-bind", ' css: { "cesium-sceneModePicker-visible" : (dropDownVisible && (sceneMode !== _sceneMode.COLUMBUS_VIEW)) || (!dropDownVisible && (sceneMode === _sceneMode.COLUMBUS_VIEW)), "cesium-sceneModePicker-none" : sceneMode === _sceneMode.COLUMBUS_VIEW, "cesium-sceneModePicker-hidden" : !dropDownVisible}, attr: { title: tooltipColumbusView }, click: morphToColumbusView'), e.appendChild(h), this._nodeColumbus = h, a.applyBindings(s, e), this._closeDropDown = function(t) { e.contains(t.target) || (s.dropDownVisible = !1) }, document.addEventListener("mousedown", this._closeDropDown, !0), document.addEventListener("touchstart", this._closeDropDown, !0) }; return e(s.prototype, { container: { get: function() { return this._container } }, viewModel: { get: function() { return this._viewModel } } }), s.prototype.isDestroyed = function() { return !1 }, s.prototype.destroy = function() { this._viewModel.destroy(), document.removeEventListener("mousedown", this._closeDropDown, !0), document.removeEventListener("touchstart", this._closeDropDown, !0); var e = this._container; return a.cleanNode(e), e.removeChild(this._element), e.removeChild(this._node3D), e.removeChild(this._node2D), e.removeChild(this._nodeColumbus), r(this) }, s }), r("Widgets/Timeline/TimelineTrack", ["../../Core/Color", "../../Core/defined"], function(e, t) { "use strict";
  7639. function r(t, r, i, n) { this.interval = t, this.height = r, this.color = i || new e(.5, .5, .5, 1), this.backgroundColor = n || new e(0, 0, 0, 0) } return r.prototype.render = function(e, r) { var i = this.interval.start,
  7640. n = this.interval.stop,
  7641. o = r.startJulian,
  7642. a = r.startJulian.addSeconds(r.duration); if (i.lessThan(o) && n.greaterThan(a)) e.fillStyle = this.color.toCssColorString(), e.fillRect(0, r.y, r.timeBarWidth, this.height);
  7643. else if (i.lessThanOrEquals(a) && n.greaterThanOrEquals(o)) { var s, l, u; for (s = 0; s < r.timeBarWidth; ++s) { var c = r.startJulian.addSeconds(s / r.timeBarWidth * r.duration);!t(l) && c.greaterThanOrEquals(i) ? l = s : !t(u) && c.greaterThanOrEquals(n) && (u = s) } e.fillStyle = this.backgroundColor.toCssColorString(), e.fillRect(0, r.y, r.timeBarWidth, this.height), t(l) && (t(u) || (u = r.timeBarWidth), e.fillStyle = this.color.toCssColorString(), e.fillRect(l, r.y, Math.max(u - l, 1), this.height)) } }, r }), r("Widgets/Timeline/TimelineHighlightRange", [], function() { "use strict";
  7644. function e(e, t) { this._color = e, this._height = t } return e.prototype.getHeight = function() { return this._height }, e.prototype.getStartTime = function() { return this._start }, e.prototype.getStopTime = function() { return this._stop }, e.prototype.setRange = function(e, t) { this._start = e, this._stop = t }, e.prototype.render = function(e) { var t = ""; if (this._start && this._stop && this._color) { var r = e.epochJulian.getSecondsDifference(this._start),
  7645. i = Math.round(e.timeBarWidth * e.getAlpha(r)),
  7646. n = e.epochJulian.getSecondsDifference(this._stop),
  7647. o = Math.round(e.timeBarWidth * e.getAlpha(n)) - i;
  7648. 0 > i && (o += i, i = 0), i + o > e.timeBarWidth && (o = e.timeBarWidth - i), o > 0 && (t = '<span class="cesium-timeline-highlight" style="left: ' + i.toString() + "px; width: " + o.toString() + "px; bottom: " + e.y.toString() + "px; height: " + this._height + "px; background-color: " + this._color + ';"></span>') } return e.y += this._height, t }, e }), r("Widgets/Timeline/Timeline", ["../../Core/DeveloperError", "../../Core/ClockRange", "../../Core/defined", "../../Core/destroyObject", "../../Core/JulianDate", "../getElement", "./TimelineTrack", "./TimelineHighlightRange"], function(e, t, r, i, n, o, a, s) { "use strict";
  7649. function l(t, i) { if (!r(t)) throw new e("container is required."); if (!r(i)) throw new e("clock is required.");
  7650. t = o(t), this.container = t; var n = document.createElement("div");
  7651. n.className = "cesium-timeline-main", t.appendChild(n), this._topDiv = n, this._endJulian = void 0, this._epochJulian = void 0, this._lastXPos = void 0, this._scrubElement = void 0, this._startJulian = void 0, this._timeBarSecondsSpan = void 0, this._clock = i, this._scrubJulian = i.currentTime, this._mainTicSpan = -1, this._mouseMode = g.none, this._touchMode = _.none, this._touchState = { centerX: 0, spanX: 0 }, this._mouseX = 0, this._timelineDrag = 0, this._timelineDragLocation = void 0, this._lastHeight = void 0, this._lastWidth = void 0, this._topDiv.innerHTML = '<div class="cesium-timeline-bar"></div><div class="cesium-timeline-trackContainer"><canvas class="cesium-timeline-tracks" width="10" height="1"></canvas></div><div class="cesium-timeline-needle"></div><span class="cesium-timeline-ruler"></span>', this._timeBarEle = this._topDiv.childNodes[0], this._trackContainer = this._topDiv.childNodes[1], this._trackListEle = this._topDiv.childNodes[1].childNodes[0], this._needleEle = this._topDiv.childNodes[2], this._rulerEle = this._topDiv.childNodes[3], this._context = this._trackListEle.getContext("2d"), this._trackList = [], this._highlightRanges = [], this.zoomTo(i.startTime, i.stopTime), this._onMouseDown = c(this), this._onMouseUp = h(this), this._onMouseMove = d(this), this._onMouseWheel = m(this), this._onTouchStart = p(this), this._onTouchMove = v(this), this._onTouchEnd = f(this); var a = this._timeBarEle;
  7652. document.addEventListener("mouseup", this._onMouseUp, !1), document.addEventListener("mousemove", this._onMouseMove, !1), a.addEventListener("mousedown", this._onMouseDown, !1), a.addEventListener("DOMMouseScroll", this._onMouseWheel, !1), a.addEventListener("mousewheel", this._onMouseWheel, !1), a.addEventListener("touchstart", this._onTouchStart, !1), a.addEventListener("touchmove", this._onTouchMove, !1), a.addEventListener("touchend", this._onTouchEnd, !1), this._topDiv.oncontextmenu = function() { return !1 }, i.onTick.addEventListener(this.updateFromClock, this), this.updateFromClock() }
  7653. function u(e) { return 10 > e ? "0" + e.toString() : e.toString() }
  7654. function c(e) { return function(t) { e._mouseMode !== g.touchOnly && (0 === t.button ? (e._mouseMode = g.scrub, e._scrubElement && (e._scrubElement.style.backgroundPosition = "-16px 0"), e._onMouseMove(t)) : (e._mouseX = t.clientX, e._mouseMode = 2 === t.button ? g.zoom : g.slide)), t.preventDefault() } }
  7655. function h(e) { return function() { e._mouseMode = g.none, e._scrubElement && (e._scrubElement.style.backgroundPosition = "0px 0px"), e._timelineDrag = 0, e._timelineDragLocation = void 0 } }
  7656. function d(e) { return function(t) { var r; if (e._mouseMode === g.scrub) { t.preventDefault(); var i = t.clientX - e._topDiv.getBoundingClientRect().left;
  7657. 0 > i ? (e._timelineDragLocation = 0, e._timelineDrag = -.01 * e._timeBarSecondsSpan) : i > e._topDiv.clientWidth ? (e._timelineDragLocation = e._topDiv.clientWidth, e._timelineDrag = .01 * e._timeBarSecondsSpan) : (e._timelineDragLocation = void 0, e._setTimeBarTime(i, i * e._timeBarSecondsSpan / e._topDiv.clientWidth)) } else if (e._mouseMode === g.slide) { if (r = e._mouseX - t.clientX, e._mouseX = t.clientX, 0 !== r) { var n = r * e._timeBarSecondsSpan / e._topDiv.clientWidth;
  7658. e.zoomTo(e._startJulian.addSeconds(n), e._endJulian.addSeconds(n)) } } else e._mouseMode === g.zoom && (r = e._mouseX - t.clientX, e._mouseX = t.clientX, 0 !== r && e.zoomFrom(Math.pow(1.01, r))) } }
  7659. function m(e) { return function(t) { var r = t.wheelDeltaY || t.wheelDelta || -t.detail;
  7660. y = Math.max(Math.min(Math.abs(r), y), 1), r /= y, e.zoomFrom(Math.pow(1.05, -r)) } }
  7661. function p(e) { return function(t) { var r, i, n = t.touches.length,
  7662. o = e._topDiv.getBoundingClientRect().left;
  7663. t.preventDefault(), e._mouseMode = g.touchOnly, 1 === n ? (r = e._startJulian.getSecondsDifference(e._scrubJulian), i = Math.round(r * e._topDiv.clientWidth / e._timeBarSecondsSpan + o), Math.abs(t.touches[0].clientX - i) < 50 ? (e._touchMode = _.scrub, e._scrubElement && (e._scrubElement.style.backgroundPosition = 1 === n ? "-16px 0" : "0 0")) : (e._touchMode = _.singleTap, e._touchState.centerX = t.touches[0].clientX - o)) : 2 === n ? (e._touchMode = _.slideZoom, e._touchState.centerX = .5 * (t.touches[0].clientX + t.touches[1].clientX) - o, e._touchState.spanX = Math.abs(t.touches[0].clientX - t.touches[1].clientX)) : e._touchMode = _.ignore } }
  7664. function f(e) { return function(t) { var r = t.touches.length,
  7665. i = e._topDiv.getBoundingClientRect().left;
  7666. e._touchMode === _.singleTap ? (e._touchMode = _.scrub, e._handleTouchMove(t)) : e._touchMode === _.scrub && e._handleTouchMove(t), e._mouseMode = g.touchOnly, 1 !== r ? e._touchMode = r > 0 ? _.ignore : _.none : e._touchMode === _.slideZoom && (e._touchState.centerX = t.touches[0].clientX - i), e._scrubElement && (e._scrubElement.style.backgroundPosition = "0 0") } }
  7667. function v(e) { return function(t) { var i, n, o, a, s, l, u = 1,
  7668. c = e._topDiv.getBoundingClientRect().left;
  7669. e._touchMode === _.singleTap && (e._touchMode = _.slideZoom), e._mouseMode = g.touchOnly, e._touchMode === _.scrub ? (t.preventDefault(), 1 === t.changedTouches.length && (n = t.changedTouches[0].clientX - c, n >= 0 && n <= e._topDiv.clientWidth && e._setTimeBarTime(n, n * e._timeBarSecondsSpan / e._topDiv.clientWidth))) : e._touchMode === _.slideZoom && (o = t.touches.length, 2 === o ? (a = .5 * (t.touches[0].clientX + t.touches[1].clientX) - c, s = Math.abs(t.touches[0].clientX - t.touches[1].clientX)) : 1 === o && (a = t.touches[0].clientX - c, s = 0), r(a) && (s > 0 && e._touchState.spanX > 0 ? (u = e._touchState.spanX / s, l = e._startJulian.addSeconds((e._touchState.centerX * e._timeBarSecondsSpan - a * e._timeBarSecondsSpan * u) / e._topDiv.clientWidth)) : (i = e._touchState.centerX - a, l = e._startJulian.addSeconds(i * e._timeBarSecondsSpan / e._topDiv.clientWidth)), e.zoomTo(l, l.addSeconds(e._timeBarSecondsSpan * u)), e._touchState.centerX = a, e._touchState.spanX = s)) } } var y = 1e12,
  7670. g = { none: 0, scrub: 1, slide: 2, zoom: 3, touchOnly: 4 },
  7671. _ = { none: 0, scrub: 1, slideZoom: 2, singleTap: 3, ignore: 4 },
  7672. w = [.001, .002, .005, .01, .02, .05, .1, .25, .5, 1, 2, 5, 10, 15, 30, 60, 120, 300, 600, 900, 1800, 3600, 7200, 14400, 21600, 43200, 86400, 172800, 345600, 604800, 1296e3, 2592e3, 5184e3, 7776e3, 15552e3, 31536e3, 63072e3, 126144e3, 15768e4, 31536e4, 63072e4, 126144e4, 15768e5, 31536e5, 63072e5, 126144e5, 15768e6, 31536e6],
  7673. C = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]; return l.prototype.addEventListener = function(e, t, r) { this._topDiv.addEventListener(e, t, r) }, l.prototype.removeEventListener = function(e, t, r) { this._topDiv.removeEventListener(e, t, r) }, l.prototype.isDestroyed = function() { return !1 }, l.prototype.destroy = function() { this._clock.onTick.removeEventListener(this.updateFromClock, this), document.removeEventListener("mouseup", this._onMouseUp, !1), document.removeEventListener("mousemove", this._onMouseMove, !1); var e = this._timeBarEle;
  7674. e.removeEventListener("mousedown", this._onMouseDown, !1), e.removeEventListener("DOMMouseScroll", this._onMouseWheel, !1), e.removeEventListener("mousewheel", this._onMouseWheel, !1), e.removeEventListener("touchstart", this._onTouchStart, !1), e.removeEventListener("touchmove", this._onTouchMove, !1), e.removeEventListener("touchend", this._onTouchEnd, !1), this.container.removeChild(this._topDiv), i(this) }, l.prototype.addHighlightRange = function(e, t) { var r = new s(e, t); return this._highlightRanges.push(r), this.resize(), r }, l.prototype.addTrack = function(e, t, r, i) { var n = new a(e, t, r, i); return this._trackList.push(n), this.resize(), n }, l.prototype.zoomTo = function(r, i) { if (this._timeBarSecondsSpan = r.getSecondsDifference(i), this._timeBarSecondsSpan <= 0) throw new e("Start time must come before end time."); if (this._startJulian = r, this._endJulian = i, this._clock && this._clock.clockRange !== t.UNBOUNDED) { var n = this._clock.startTime,
  7675. o = this._clock.stopTime,
  7676. a = n.getSecondsDifference(o),
  7677. s = this._startJulian.getSecondsDifference(n),
  7678. l = this._endJulian.getSecondsDifference(o);
  7679. this._timeBarSecondsSpan >= a ? (this._timeBarSecondsSpan = a, this._startJulian = this._clock.startTime, this._endJulian = this._clock.stopTime) : s > 0 ? (this._endJulian = this._endJulian.addSeconds(s), this._startJulian = n, this._timeBarSecondsSpan = this._startJulian.getSecondsDifference(this._endJulian)) : 0 > l && (this._startJulian = this._startJulian.addSeconds(l), this._endJulian = o, this._timeBarSecondsSpan = this._startJulian.getSecondsDifference(this._endJulian)) } this._makeTics(); var u = document.createEvent("Event");
  7680. u.initEvent("setzoom", !0, !0), u.startJulian = this._startJulian, u.endJulian = this._endJulian, u.epochJulian = this._epochJulian, u.totalSpan = this._timeBarSecondsSpan, u.mainTicSpan = this._mainTicSpan, this._topDiv.dispatchEvent(u) }, l.prototype.zoomFrom = function(e) { var t = this._startJulian.getSecondsDifference(this._scrubJulian);
  7681. e > 1 || 0 > t || t > this._timeBarSecondsSpan ? t = .5 * this._timeBarSecondsSpan : t += t - .5 * this._timeBarSecondsSpan; var r = this._timeBarSecondsSpan - t;
  7682. this.zoomTo(this._startJulian.addSeconds(t - t * e), this._endJulian.addSeconds(r * e - r)) }, l.prototype.makeLabel = function(e) { var t = e.toGregorianDate(),
  7683. r = t.millisecond,
  7684. i = " UTC"; if (r > 0 && this._timeBarSecondsSpan < 3600) { for (i = Math.floor(r).toString(); i.length < 3;) i = "0" + i;
  7685. i = "." + i } return C[t.month - 1] + " " + t.day + " " + t.year + " " + u(t.hour) + ":" + u(t.minute) + ":" + u(t.second) + i }, l.prototype.smallestTicInPixels = 7, l.prototype._makeTics = function() {
  7686. function e(e) { return Math.floor(x / e) * e }
  7687. function t(e, t) { return Math.ceil(e / t + .5) * t }
  7688. function r(e) { return (e - x) / v }
  7689. function i(e, t) { return e - t * Math.round(e / t) } var o, a = this._timeBarEle,
  7690. s = this._startJulian.getSecondsDifference(this._scrubJulian),
  7691. l = Math.round(s * this._topDiv.clientWidth / this._timeBarSecondsSpan),
  7692. u = l - 8,
  7693. c = this;
  7694. this._needleEle.style.left = l.toString() + "px"; var h = '<span class="cesium-timeline-icon16" style="left:' + u + 'px;bottom:0;background-position: 0px 0px;"></span>',
  7695. d = .01,
  7696. m = 31536e6,
  7697. p = 1e-10,
  7698. f = 0,
  7699. v = this._timeBarSecondsSpan;
  7700. d > v ? (v = d, this._timeBarSecondsSpan = d, this._endJulian = this._startJulian.addSeconds(d)) : v > m && (v = m, this._timeBarSecondsSpan = m, this._endJulian = this._startJulian.addSeconds(m)); var y = this._timeBarEle.clientWidth;
  7701. 10 > y && (y = 10); var g, _ = this._startJulian,
  7702. C = Math.min(1e-5 * (v / y), .4);
  7703. g = v > 31536e4 ? n.fromIso8601(_.toDate().toISOString().substring(0, 2) + "00-01-01T00:00:00Z") : v > 31536e3 ? n.fromIso8601(_.toDate().toISOString().substring(0, 3) + "0-01-01T00:00:00Z") : v > 86400 ? n.fromIso8601(_.toDate().toISOString().substring(0, 4) + "-01-01T00:00:00Z") : n.fromIso8601(_.toDate().toISOString().substring(0, 10) + "T00:00:00Z"); var x = g.addSeconds(C).getSecondsDifference(this._startJulian),
  7704. S = x + v;
  7705. this._epochJulian = g, this._rulerEle.innerHTML = this.makeLabel(this._endJulian.addSeconds(-d)); var E = this._rulerEle.offsetWidth + 20,
  7706. b = f;
  7707. f -= p; var T = { y: 0, startTime: x, startJulian: _, epochJulian: g, duration: v, timeBarWidth: y, getAlpha: r };
  7708. this._highlightRanges.forEach(function(e) { h += e.render(T) }); var A = 0,
  7709. M = 0,
  7710. P = 0,
  7711. D = E / y;
  7712. D > 1 && (D = 1), D *= this._timeBarSecondsSpan; var I, O = -1,
  7713. R = -1,
  7714. L = w.length; for (I = 0; L > I; ++I) { var z = w[I]; if (++O, A = z, z > D && z > f) break;
  7715. 0 > R && y * (z / this._timeBarSecondsSpan) >= this.smallestTicInPixels && (R = O) } if (O > 0) { for (; O > 0;)
  7716. if (--O, Math.abs(i(A, w[O])) < 1e-5) { w[O] >= f && (M = w[O]); break }
  7717. if (R >= 0)
  7718. for (; O > R;) { if (Math.abs(i(M, w[R])) < 1e-5 && w[R] >= f) { P = w[R]; break }++R } } f = b, f > p && 1e-5 > P && Math.abs(f - A) > p && (P = f, A + p >= f && (M = 0)); var N, F = -999999; if (y * (P / this._timeBarSecondsSpan) >= 3)
  7719. for (o = e(P); S >= o; o = t(o, P)) h += '<span class="cesium-timeline-ticTiny" style="left: ' + Math.round(y * r(o)).toString() + 'px;"></span>'; if (y * (M / this._timeBarSecondsSpan) >= 3)
  7720. for (o = e(M); S >= o; o = t(o, M)) h += '<span class="cesium-timeline-ticSub" style="left: ' + Math.round(y * r(o)).toString() + 'px;"></span>'; if (y * (A / this._timeBarSecondsSpan) >= 2) { this._mainTicSpan = A, S += A, o = e(A); for (var B = g.getTaiMinusUtc(); S >= o;) { var V = _.addSeconds(o - x); if (A > 2.1) { var q = V.getTaiMinusUtc();
  7721. Math.abs(q - B) > .1 && (o += q - B, V = _.addSeconds(o - x)) } var k = Math.round(y * r(o)),
  7722. U = this.makeLabel(V);
  7723. this._rulerEle.innerHTML = U, N = this._rulerEle.offsetWidth; var W = k - (N / 2 - 1);
  7724. W > F ? (F = W + N + 5, h += '<span class="cesium-timeline-ticMain" style="left: ' + k.toString() + 'px;"></span>' + '<span class="cesium-timeline-ticLabel" style="left: ' + W.toString() + 'px;">' + U + "</span>") : h += '<span class="cesium-timeline-ticSub" style="left: ' + k.toString() + 'px;"></span>', o = t(o, A) } } else this._mainTicSpan = -1;
  7725. a.innerHTML = h, this._scrubElement = a.childNodes[0], T.y = 0, this._trackList.forEach(function(e) { e.render(c._context, T), T.y += e.height }) }, l.prototype.updateFromClock = function() { this._scrubJulian = this._clock.currentTime; var e = this._scrubElement; if (r(this._scrubElement)) { var t = this._startJulian.getSecondsDifference(this._scrubJulian),
  7726. i = Math.round(t * this._topDiv.clientWidth / this._timeBarSecondsSpan);
  7727. this._lastXPos !== i && (this._lastXPos = i, e.style.left = i - 8 + "px", this._needleEle.style.left = i + "px") } r(this._timelineDragLocation) && (this._setTimeBarTime(this._timelineDragLocation, this._timelineDragLocation * this._timeBarSecondsSpan / this._topDiv.clientWidth), this.zoomTo(this._startJulian.addSeconds(this._timelineDrag), this._endJulian.addSeconds(this._timelineDrag))) }, l.prototype._setTimeBarTime = function(e, t) { if (e = Math.round(e), this._scrubJulian = this._startJulian.addSeconds(t), this._scrubElement) { var r = e - 8;
  7728. this._scrubElement.style.left = r.toString() + "px", this._needleEle.style.left = e.toString() + "px" } var i = document.createEvent("Event");
  7729. i.initEvent("settime", !0, !0), i.clientX = e, i.timeSeconds = t, i.timeJulian = this._scrubJulian, i.clock = this._clock, this._topDiv.dispatchEvent(i) }, l.prototype.resize = function() { var e = this.container.clientWidth,
  7730. t = this.container.clientHeight; if (e !== this._lastWidth || t !== this._lastHeight) { this._trackContainer.style.height = t + "px"; var r = 1;
  7731. this._trackList.forEach(function(e) { r += e.height }), this._trackListEle.style.height = r.toString() + "px", this._trackListEle.width = this._trackListEle.clientWidth, this._trackListEle.height = r, this._makeTics(), this._lastWidth = e, this._lastHeight = t } }, l }), r("Widgets/Viewer/Viewer", ["../../Core/Cartesian2", "../../Core/defaultValue", "../../Core/defined", "../../Core/DeveloperError", "../../Core/defineProperties", "../../Core/destroyObject", "../../Core/Event", "../../Core/EventHelper", "../../Core/requestAnimationFrame", "../../Core/ScreenSpaceEventType", "../../DynamicScene/DataSourceCollection", "../../DynamicScene/DataSourceDisplay", "../Animation/Animation", "../Animation/AnimationViewModel", "../BaseLayerPicker/BaseLayerPicker", "../BaseLayerPicker/createDefaultBaseLayers", "../isatCesiumWidget/isatCesiumWidget", "../ClockViewModel", "../FullscreenButton/FullscreenButton", "../getElement", "../HomeButton/HomeButton", "../SceneModePicker/SceneModePicker", "../Timeline/Timeline", "../../ThirdParty/knockout"], function(e, t, r, i, n, o, a, s, l, u, c, h, d, m, p, f, v, y, g, _, w, C, x, S) {
  7732. "use strict";
  7733. function E(e) { var t = e.clock;
  7734. t.currentTime = e.timeJulian, t.shouldAnimate = !1 }
  7735. function b(e) {
  7736. function t() { if (!e.isDestroyed()) try { e._useDefaultRenderLoop ? (e.resize(), e.render(), l(t)) : e._renderLoopRunning = !1 } catch (r) { e._useDefaultRenderLoop = !1, e._renderLoopRunning = !1, e._onRenderLoopError.raiseEvent(e, r), e._showRenderLoopErrors && (e.cesiumWidget.showErrorPanel("An error occurred while rendering. Rendering has stopped.", r), console.error(r)) } } e._renderLoopRunning = !0, l(t) }
  7737. var T = function(e, n) {
  7738. function o(e) { P.update(e.currentTime) }
  7739. function l(e, t) { if (1 === e.getLength()) { var i = t.getClock();
  7740. r(i) && (i.clone(D), r(W) && (W.updateFromClock(), W.zoomTo(i.startTime, i.stopTime))) } }
  7741. if (!r(e)) throw new i("container is required.");
  7742. e = _(e), n = t(n, t.EMPTY_OBJECT);
  7743. var u = !r(n.baseLayerPicker) || n.baseLayerPicker !== !1;
  7744. if (u && r(n.imageryProvider)) throw new i("options.imageryProvider is not available when using the BaseLayerPicker widget. Either specify options.selectedImageryProviderViewModel instead or set options.baseLayerPicker to false.");
  7745. if (!u && r(n.selectedImageryProviderViewModel)) throw new i("options.selectedImageryProviderViewModel is not available when not using the BaseLayerPicker widget. Either specify options.imageryProvider instead or set options.baseLayerPicker to true.");
  7746. var b = document.createElement("div");
  7747. b.className = "cesium-viewer", e.appendChild(b);
  7748. var T = document.createElement("div");
  7749. T.className = "cesium-viewer-cesiumWidgetContainer", b.appendChild(T);
  7750. var A = new v(T, { terrainProvider: n.terrainProvider, imageryProvider: u ? !1 : n.imageryProvider, sceneMode: n.sceneMode, contextOptions: n.contextOptions, useDefaultRenderLoop: !1 }),
  7751. M = new c,
  7752. P = new h(A.scene, M),
  7753. D = A.clock,
  7754. I = new y(D),
  7755. O = document.createElement("div");
  7756. O.className = "cesium-viewer-toolbar", b.appendChild(O);
  7757. var R;
  7758. if (!r(n.homeButton) || n.homeButton !== !1) { var L = document.createElement("div");
  7759. L.className = "cesium-viewer-homeButtonContainer", O.appendChild(L), R = new w(L, A.scene, A.sceneTransitioner, A.centralBody.getEllipsoid()) }
  7760. var z;
  7761. if (!r(n.sceneModePicker) || n.sceneModePicker !== !1) { var N = document.createElement("div");
  7762. N.className = "cesium-viewer-sceneModePickerContainer", O.appendChild(N), z = new C(N, A.sceneTransitioner) }
  7763. var F;
  7764. if (u) { var B = document.createElement("div");
  7765. B.className = "cesium-viewer-baseLayerPickerContainer", O.appendChild(B); var V = t(n.imageryProviderViewModels, f());
  7766. F = new p(B, A.centralBody.getImageryLayers(), V), F.viewModel.selectedItem = t(n.selectedImageryProviderViewModel, V[0]); var q = B.getElementsByClassName("cesium-baseLayerPicker-dropDown");
  7767. this._baseLayerPickerDropDown = q[0] }
  7768. var k;
  7769. if (!r(n.animation) || n.animation !== !1) { var U = document.createElement("div");
  7770. U.className = "cesium-viewer-animationContainer", b.appendChild(U), k = new d(U, new m(I)) }
  7771. var W;
  7772. if (!r(n.timeline) || n.timeline !== !1) { var G = document.createElement("div");
  7773. G.className = "cesium-viewer-timelineContainer", b.appendChild(G), W = new x(G, D), W.addEventListener("settime", E, !1), W.zoomTo(D.startTime, D.stopTime) }
  7774. var H;
  7775. if (r(n.fullscreenButton) && n.fullscreenButton === !1) r(W) && (W.container.style.right = 0);
  7776. else { var j = document.createElement("div");
  7777. j.className = "cesium-viewer-fullscreenContainer", b.appendChild(j), H = new g(j, t(n.fullscreenElement, e)); var Y = function(e) { j.style.display = e ? "block" : "none", r(W) && (W.container.style.right = j.clientWidth + "px", W.resize()) };
  7778. this._fullscreenSubscription = S.getObservable(H.viewModel, "isFullscreenEnabled").subscribe(Y), Y(H.viewModel.isFullscreenEnabled) }
  7779. var X = new s;
  7780. X.add(D.onTick, o), X.add(M.dataSourceAdded, l), this._container = e, this._element = b, this._cesiumWidget = A, this._dataSourceCollection = M, this._dataSourceDisplay = P, this._clockViewModel = I, this._toolbar = O, this._homeButton = R, this._sceneModePicker = z, this._baseLayerPicker = F, this._animation = k, this._timeline = W, this._fullscreenButton = H, this._eventHelper = X, this._lastWidth = 0, this._lastHeight = 0, this._useDefaultRenderLoop = void 0, this._renderLoopRunning = !1, this._showRenderLoopErrors = t(n.showRenderLoopErrors, !0), this._onRenderLoopError = new a, this.useDefaultRenderLoop = t(n.useDefaultRenderLoop, !0)
  7781. };
  7782. return n(T.prototype, { container: { get: function() { return this._container } }, cesiumWidget: { get: function() { return this._cesiumWidget } }, homeButton: { get: function() { return this._homeButton } }, sceneModePicker: { get: function() { return this._sceneModePicker } }, baseLayerPicker: { get: function() { return this._baseLayerPicker } }, animation: { get: function() { return this._animation } }, timeline: { get: function() { return this._timeline } }, fullscreenButton: { get: function() { return this._fullscreenButton } }, dataSourceDisplay: { get: function() { return this._dataSourceDisplay } }, dataSources: { get: function() { return this._dataSourceCollection } }, canvas: { get: function() { return this._cesiumWidget.canvas } }, cesiumLogo: { get: function() { return this._cesiumWidget.cesiumLogo } }, scene: { get: function() { return this._cesiumWidget.scene } }, centralBody: { get: function() { return this._cesiumWidget.centralBody } }, clock: { get: function() { return this._cesiumWidget.clock } }, sceneTransitioner: { get: function() { return this._cesiumWidget.sceneTransitioner } }, screenSpaceEventHandler: { get: function() { return this._cesiumWidget.screenSpaceEventHandler } }, onRenderLoopError: { get: function() { return this._onRenderLoopError } }, useDefaultRenderLoop: { get: function() { return this._useDefaultRenderLoop }, set: function(e) { this._useDefaultRenderLoop !== e && (this._useDefaultRenderLoop = e, e && !this._renderLoopRunning && b(this)) } } }), T.prototype.extend = function(e, t) { if (!r(e)) throw new i("mixin is required.");
  7783. e(this, t) }, T.prototype.resize = function() { var e = this._cesiumWidget;
  7784. e.resize(); var t = this._container,
  7785. i = t.clientWidth,
  7786. n = t.clientHeight; if (i !== this._lastWidth || n !== this._lastHeight) { var o = this._baseLayerPickerDropDown; if (r(o)) { var a = n - 125;
  7787. o.style.maxHeight = a + "px" } var s, l = r(this._timeline),
  7788. u = r(this._animation),
  7789. c = !u,
  7790. h = 0; if (u) { var d = this._lastWidth;
  7791. s = this._animation.container, i > 900 ? 900 >= d && (h = 169, s.style.width = "169px", s.style.height = "112px", c = !0, this._animation.resize()) : i >= 600 ? (600 > d || d > 900) && (h = 136, s.style.width = "136px", s.style.height = "90px", c = !0, this._animation.resize()) : (d > 600 || 0 === d) && (h = 106, s.style.width = "106px", s.style.height = "70px", c = !0, this._animation.resize()) } if (c) { var m = 0,
  7792. p = h + 5; if (l && (m = this._timeline.container.clientHeight + 3, this._timeline.container.style.left = h + "px"), l || u) { var f = e.creditContainer;
  7793. f.style.bottom = m + "px", f.style.left = p + "px" } } l && this._timeline.resize(), this._lastWidth = i, this._lastHeight = n } }, T.prototype.render = function() { this._cesiumWidget.render() }, T.prototype.isDestroyed = function() { return !1 }, T.prototype.destroy = function() { return this._container.removeChild(this._element), this._element.removeChild(this._toolbar), this._eventHelper.removeAll(), r(this._homeButton) && (this._homeButton = this._homeButton.destroy()), r(this._sceneModePicker) && (this._sceneModePicker = this._sceneModePicker.destroy()), r(this._baseLayerPicker) && (this._baseLayerPicker = this._baseLayerPicker.destroy()), r(this._animation) && (this._element.removeChild(this._animation.container), this._animation = this._animation.destroy()), r(this._timeline) && (this._timeline.removeEventListener("settime", E, !1), this._element.removeChild(this._timeline.container), this._timeline = this._timeline.destroy()), r(this._fullscreenButton) && (this._fullscreenSubscription.dispose(), this._element.removeChild(this._fullscreenButton.container), this._fullscreenButton = this._fullscreenButton.destroy()), this._clockViewModel = this._clockViewModel.destroy(), this._dataSourceDisplay = this._dataSourceDisplay.destroy(), this._cesiumWidget = this._cesiumWidget.destroy(), this._dataSourceCollection = this._dataSourceCollection.destroy(), o(this) }, T
  7794. }), r("Widgets/Viewer/viewerDragDropMixin", ["../../Core/defaultValue", "../../Core/defined", "../../Core/DeveloperError", "../../Core/defineProperties", "../../Core/Event", "../../Core/wrapFunction", "../../DynamicScene/CzmlDataSource", "../../DynamicScene/GeoJsonDataSource", "../../ThirdParty/when", "../getElement"], function(e, t, r, i, n, o, a, s, l, u) { "use strict";
  7795. function c(e) { e.stopPropagation(), e.preventDefault() }
  7796. function h(e, r) { var i = e;
  7797. t(i) && (i.removeEventListener("drop", r, !1), i.removeEventListener("dragenter", c, !1), i.removeEventListener("dragover", c, !1), i.removeEventListener("dragexit", c, !1)) }
  7798. function d(e, t) { e.addEventListener("drop", t, !1), e.addEventListener("dragenter", c, !1), e.addEventListener("dragover", c, !1), e.addEventListener("dragexit", c, !1) }
  7799. function m(e, t) { var r = e.length,
  7800. i = t.length; return r > i && -1 !== e.indexOf(t, r - i) }
  7801. function p(e, t) { var r, i = t.toUpperCase(); if (m(i, ".CZML")) r = a;
  7802. else { if (!(m(i, ".GEOJSON") || m(i, ".JSON") || m(i, ".TOPOJSON"))) return e.onDropError.raiseEvent(e, t, "Unrecognized file extension: " + t), void 0;
  7803. r = s } return function(i) { var n = new r; try { l(n.load(JSON.parse(i.target.result), t), function() { e.dataSources.add(n) }, function(r) { e.onDropError.raiseEvent(e, t, r) }) } catch (o) { e.onDropError.raiseEvent(e, t, o) } } }
  7804. function f(e, t) { return function(r) { e.onDropError.raiseEvent(e, t, r.target.error) } } var v = function(a, s) {
  7805. function l(e) { c(e), y && a.dataSources.removeAll(); for (var t = e.dataTransfer.files, r = t.length, i = 0; r > i; i++) { var n = t[i],
  7806. o = new FileReader;
  7807. o.onload = p(a, n.name), o.onerror = f(a, n.name), o.readAsText(n) } } if (!t(a)) throw new r("viewer is required."); if (a.hasOwnProperty("dropTarget")) throw new r("dropTarget is already defined by another mixin."); if (a.hasOwnProperty("dropEnabled")) throw new r("dropEnabled is already defined by another mixin."); if (a.hasOwnProperty("onDropError")) throw new r("onDropError is already defined by another mixin."); if (a.hasOwnProperty("clearOnDrop")) throw new r("clearOnDrop is already defined by another mixin.");
  7808. s = e(s, e.EMPTY_OBJECT); var m = !0,
  7809. v = new n,
  7810. y = e(s.clearOnDrop, !0),
  7811. g = e(s.dropTarget, a.container);
  7812. g = u(g), i(a, { dropTarget: { get: function() { return g }, set: function(e) { if (!t(e)) throw new r("value is required.");
  7813. h(g, l), g = e, d(g, l) } }, dropEnabled: { get: function() { return m }, set: function(e) { e !== m && (e ? d(g, l) : h(g, l), m = e) } }, onDropError: { get: function() { return v } }, clearOnDrop: { get: function() { return y }, set: function(e) { y = e } } }), d(g, l), a.destroy = o(a, a.destroy, function() { a.dropEnabled = !1 }), a._handleDrop = l }; return v }), r("Widgets/Viewer/viewerDynamicObjectMixin", ["../../Core/defaultValue", "../../Core/defined", "../../Core/DeveloperError", "../../Core/defineProperties", "../../Core/EventHelper", "../../Core/ScreenSpaceEventType", "../../Core/wrapFunction", "../../Scene/SceneMode", "../../DynamicScene/DynamicObjectView"], function(e, t, r, i, n, o, a, s, l) { "use strict"; var u = function(e) {
  7814. function u(e) { t(m) && m.update(e.currentTime) }
  7815. function c(r) { var i = e.scene.pick(r.position);
  7816. t(i) && t(i.dynamicObject) && t(i.dynamicObject.position) && (e.trackedObject = i.dynamicObject) }
  7817. function h() { e.trackedObject = void 0 } if (!t(e)) throw new r("viewer is required."); if (e.hasOwnProperty("trackedObject")) throw new r("trackedObject is already defined by another mixin."); var d, m, p = new n;
  7818. p.add(e.clock.onTick, u), t(e.homeButton) && p.add(e.homeButton.viewModel.command.beforeExecute, h), e.screenSpaceEventHandler.setInputAction(c, o.LEFT_CLICK), i(e, { trackedObject: { get: function() { return d }, set: function(r) { d !== r && (d = r, m = t(r) ? new l(r, e.scene, e.centralBody.getEllipsoid()) : void 0); var i = e.scene.getFrameState().mode;
  7819. (i === s.COLUMBUS_VIEW || i === s.SCENE2D) && (e.scene.getScreenSpaceCameraController().enableTranslate = !t(r)), (i === s.COLUMBUS_VIEW || i === s.SCENE3D) && (e.scene.getScreenSpaceCameraController().enableTilt = !t(r)) } } }), e.destroy = a(e, e.destroy, function() { p.removeAll(), e.screenSpaceEventHandler.removeInputAction(o.LEFT_CLICK) }) }; return u }), r("Widgets/checkForChromeFrame", ["../Core/FeatureDetection", "./getElement", "../ThirdParty/when"], function(e, t, r) { "use strict";
  7820. function i(e) { e = t(e); var r = document.createElement("div");
  7821. r.className = "cesium-widget-chromeFrameOverlay"; var i = document.createElement("div");
  7822. r.appendChild(i), i.innerHTML = 'isatCesium requires WebGL, an open standard for displaying 3D content in a web browser. To enable WebGL in Internet Explorer, we recommend installing <a href="https://developers.google.com/chrome/chrome-frame/" target="_blank">Google Chrome Frame</a>, a free, unobtrusive plug-in offered by Google. To learn more about WebGL, visit <a href="http://www.khronos.org/webgl/" target="_blank">http://www.khronos.org/webgl/</a>.<p>Would you like to install Chrome Frame now?</p>'; var n = document.createElement("p");
  7823. i.appendChild(n); var o = document.createElement("a");
  7824. o.href = "#", o.innerHTML = "Yes, install Google Chrome Frame", o.onclick = function() { window.CFInstall.check({ mode: "overlay", destination: document.URL }), e.removeChild(r) }, n.appendChild(o), n = document.createElement("p"), i.appendChild(n); var a = document.createElement("a");
  7825. a.href = "#", a.innerHTML = "No, not at this time", a.onclick = function() { e.removeChild(r) }, n.appendChild(a), e.appendChild(r) } var n = function(t) { var n = r.defer(); if (e.isInternetExplorer()) { var o = document.createElement("script");
  7826. o.type = "text/javascript", o.src = "//ajax.googleapis.com/ajax/libs/chrome-frame/1/CFInstall.min.js"; var a = document.getElementsByTagName("head")[0];
  7827. a.appendChild(o); var s = setInterval(function() { if (window.CFInstall) { clearInterval(s); var e = !1;
  7828. window.CFInstall.check({ mode: "overlay", preventPrompt: !0, onmissing: function() { e = !0 } }), e && i(t), n.resolve(e) } }, 50) } else n.resolve(!1); return n.promise }; return n }), r("isatCesium", ["./Core/AxisAlignedBoundingBox", "./Core/BoundingRectangle", "./Core/BoundingSphere", "./Core/BoxGeometry", "./Core/BoxOutlineGeometry", "./Core/Cartesian2", "./Core/Cartesian3", "./Core/Cartesian4", "./Core/Cartographic", "./Core/CatmullRomSpline", "./Core/CircleGeometry", "./Core/CircleOutlineGeometry", "./Core/Clock", "./Core/ClockRange", "./Core/ClockStep", "./Core/Color", "./Core/ColorGeometryInstanceAttribute", "./Core/ComponentDatatype", "./Core/CornerType", "./Core/CorridorGeometry", "./Core/CubicRealPolynomial", "./Core/CylinderGeometry", "./Core/CylinderGeometryLibrary", "./Core/CylinderOutlineGeometry", "./Core/DefaultProxy", "./Core/DeveloperError", "./Core/EarthOrientationParameters", "./Core/EarthOrientationParametersSample", "./Core/EllipseGeometry", "./Core/EllipseGeometryLibrary", "./Core/EllipseOutlineGeometry", "./Core/Ellipsoid", "./Core/EllipsoidGeodesic", "./Core/EllipsoidGeometry", "./Core/EllipsoidOutlineGeometry", "./Core/EllipsoidTangentPlane", "./Core/EllipsoidalOccluder", "./Core/EncodedCartesian3", "./Core/Enumeration", "./Core/Event", "./Core/EventHelper", "./Core/Extent", "./Core/ExtentGeometry", "./Core/ExtentOutlineGeometry", "./Core/FAR", "./Core/FeatureDetection", "./Core/Fullscreen", "./Core/GeographicProjection", "./Core/Geometry", "./Core/GeometryAttribute", "./Core/GeometryAttributes", "./Core/GeometryInstance", "./Core/GeometryInstanceAttribute", "./Core/GeometryPipeline", "./Core/HeightmapTessellator", "./Core/HermitePolynomialApproximation", "./Core/HermiteSpline", "./Core/Iau2006XysData", "./Core/Iau2006XysSample", "./Core/IndexDatatype", "./Core/InterpolationAlgorithm", "./Core/Intersect", "./Core/IntersectionTests", "./Core/Interval", "./Core/Iso8601", "./Core/JulianDate", "./Core/KeyboardEventModifier", "./Core/LagrangePolynomialApproximation", "./Core/LeapSecond", "./Core/LinearApproximation", "./Core/Math", "./Core/Matrix2", "./Core/Matrix3", "./Core/Matrix4", "./Core/NearFarScalar", "./Core/Occluder", "./Core/OrientationInterpolator", "./Core/Packable", "./Core/PackableForInterpolation", "./Core/Plane", "./Core/PolygonGeometry", "./Core/PolygonGeometryLibrary", "./Core/PolygonOutlineGeometry", "./Core/PolygonPipeline", "./Core/PolylinePipeline", "./Core/PrimitiveType", "./Core/QuadraticRealPolynomial", "./Core/QuarticRealPolynomial", "./Core/Quaternion", "./Core/Queue", "./Core/Ray", "./Core/ReferenceFrame", "./Core/RequestErrorEvent", "./Core/RuntimeError", "./Core/ScreenSpaceEventHandler", "./Core/ScreenSpaceEventType", "./Core/Shapes", "./Core/ShowGeometryInstanceAttribute", "./Core/Simon1994PlanetaryPositions", "./Core/SimplePolylineGeometry", "./Core/SphereGeometry", "./Core/SphereOutlineGeometry", "./Core/Spherical", "./Core/TaskProcessor", "./Core/TimeConstants", "./Core/TimeInterval", "./Core/TimeIntervalCollection", "./Core/TimeStandard", "./Core/Tipsify", "./Core/Transforms", "./Core/TridiagonalSystemSolver", "./Core/VertexFormat", "./Core/Visibility", "./Core/WallGeometry", "./Core/WallGeometryLibrary", "./Core/WallOutlineGeometry", "./Core/WebMercatorProjection", "./Core/WindingOrder", "./Core/barycentricCoordinates", "./Core/binarySearch", "./Core/buildModuleUrl", "./Core/cancelAnimationFrame", "./Core/clone", "./Core/combine", "./Core/createGuid", "./Core/defaultValue", "./Core/defineProperties", "./Core/defined", "./Core/destroyObject", "./Core/freezeObject", "./Core/getImagePixels", "./Core/isCrossOriginUrl", "./Core/isLeapYear", "./Core/jsonp", "./Core/loadArrayBuffer", "./Core/loadBlob", "./Core/loadImage", "./Core/loadImageViaBlob", "./Core/loadJson", "./Core/loadText", "./Core/loadWithXhr", "./Core/loadXML", "./Core/pointInsideTriangle", "./Core/requestAnimationFrame", "./Core/throttleRequestByServer", "./Core/wrapFunction", "./Core/writeTextToCanvas", "./DynamicScene/ColorMaterialProperty", "./DynamicScene/CompositeDynamicObjectCollection", "./DynamicScene/CompositeMaterialProperty", "./DynamicScene/CompositePositionProperty", "./DynamicScene/CompositeProperty", "./DynamicScene/ConstantPositionProperty", "./DynamicScene/ConstantProperty", "./DynamicScene/CzmlDataSource", "./DynamicScene/DataSource", "./DynamicScene/DataSourceCollection", "./DynamicScene/DataSourceDisplay", "./DynamicScene/DynamicBillboard", "./DynamicScene/DynamicBillboardVisualizer", "./DynamicScene/DynamicClock", "./DynamicScene/DynamicCone", "./DynamicScene/DynamicConeVisualizerUsingCustomSensor", "./DynamicScene/DynamicDirectionsProperty", "./DynamicScene/DynamicEllipse", "./DynamicScene/DynamicEllipsoid", "./DynamicScene/DynamicEllipsoidVisualizer", "./DynamicScene/DynamicLabel", "./DynamicScene/DynamicLabelVisualizer", "./DynamicScene/DynamicObject", "./DynamicScene/DynamicObjectCollection", "./DynamicScene/DynamicObjectView", "./DynamicScene/DynamicPath", "./DynamicScene/DynamicPathVisualizer", "./DynamicScene/DynamicPoint", "./DynamicScene/DynamicPointVisualizer", "./DynamicScene/DynamicPolygon", "./DynamicScene/DynamicPolygonVisualizer", "./DynamicScene/DynamicPolyline", "./DynamicScene/DynamicPolylineVisualizer", "./DynamicScene/DynamicPyramid", "./DynamicScene/DynamicPyramidVisualizer", "./DynamicScene/DynamicVector", "./DynamicScene/DynamicVectorVisualizer", "./DynamicScene/DynamicVertexPositionsProperty", "./DynamicScene/GeoJsonDataSource", "./DynamicScene/GridMaterialProperty", "./DynamicScene/ImageMaterialProperty", "./DynamicScene/MaterialProperty", "./DynamicScene/PositionProperty", "./DynamicScene/Property", "./DynamicScene/ReferenceProperty", "./DynamicScene/SampledPositionProperty", "./DynamicScene/SampledProperty", "./DynamicScene/TimeIntervalCollectionPositionProperty", "./DynamicScene/TimeIntervalCollectionProperty", "./DynamicScene/VisualizerCollection", "./Renderer/BlendEquation", "./Renderer/BlendFunction", "./Renderer/BlendingState", "./Renderer/Buffer", "./Renderer/BufferUsage", "./Renderer/ClearCommand", "./Renderer/CommandLists", "./Renderer/Context", "./Renderer/CubeMap", "./Renderer/CubeMapFace", "./Renderer/CullFace", "./Renderer/DepthFunction", "./Renderer/DrawCommand", "./Renderer/Framebuffer", "./Renderer/MipmapHint", "./Renderer/PassState", "./Renderer/PickFramebuffer", "./Renderer/PixelDatatype", "./Renderer/PixelFormat", "./Renderer/RenderState", "./Renderer/Renderbuffer", "./Renderer/RenderbufferFormat", "./Renderer/ShaderCache", "./Renderer/ShaderProgram", "./Renderer/StencilFunction", "./Renderer/StencilOperation", "./Renderer/Texture", "./Renderer/TextureAtlas", "./Renderer/TextureAtlasBuilder", "./Renderer/TextureMagnificationFilter", "./Renderer/TextureMinificationFilter", "./Renderer/TextureWrap", "./Renderer/UniformDatatype", "./Renderer/UniformState", "./Renderer/VertexArray", "./Renderer/VertexArrayFacade", "./Renderer/VertexLayout", "./Renderer/createShaderSource", "./Renderer/loadCubeMap", "./Scene/AnimationCollection", "./Scene/Appearance", "./Scene/ArcGisImageServerTerrainProvider", "./Scene/ArcGisMapServerImageryProvider", "./Scene/Billboard", "./Scene/BillboardCollection", "./Scene/BingMapsImageryProvider", "./Scene/BingMapsStyle", "./Scene/Camera", "./Scene/CameraColumbusViewMode", "./Scene/CameraController", "./Scene/CameraEventAggregator", "./Scene/CameraEventType", "./Scene/CameraFlightPath", "./Scene/CentralBody", "./Scene/CentralBodySurface", "./Scene/CentralBodySurfaceShaderSet", "./Scene/isatCesiumTerrainProvider", "./Scene/CompositePrimitive", "./Scene/Credit", "./Scene/CreditDisplay", "./Scene/CullingVolume", "./Scene/CustomSensorVolume", "./Scene/DebugAppearance", "./Scene/DiscardMissingTileImagePolicy", "./Scene/EllipsoidPrimitive", "./Scene/EllipsoidSurfaceAppearance", "./Scene/EllipsoidTerrainProvider", "./Scene/ExtentPrimitive", "./Scene/FrameState", "./Scene/FrustumCommands", "./Scene/GeographicTilingScheme", "./Scene/GridImageryProvider", "./Scene/HeightmapTerrainData", "./Scene/HorizontalOrigin", "./Scene/Imagery", "./Scene/ImageryLayer", "./Scene/ImageryLayerCollection", "./Scene/ImageryProvider", "./Scene/ImageryState", "./Scene/Label", "./Scene/LabelCollection", "./Scene/LabelStyle", "./Scene/Material", "./Scene/MaterialAppearance", "./Scene/NeverTileDiscardPolicy", "./Scene/OpenStreetMapImageryProvider", "./Scene/OrthographicFrustum", "./Scene/PerInstanceColorAppearance", "./Scene/PerformanceDisplay", "./Scene/PerspectiveFrustum", "./Scene/PerspectiveOffCenterFrustum", "./Scene/Polygon", "./Scene/Polyline", "./Scene/PolylineCollection", "./Scene/Primitive", "./Scene/PrimitivePipeline", "./Scene/PrimitiveState", "./Scene/RectangularPyramidSensorVolume", "./Scene/Scene", "./Scene/SceneMode", "./Scene/SceneTransforms", "./Scene/SceneTransitioner", "./Scene/ScreenSpaceCameraController", "./Scene/SensorVolumeCollection", "./Scene/SingleTileImageryProvider", "./Scene/SkyAtmosphere", "./Scene/SkyBox", "./Scene/Sun", "./Scene/SunPostProcess", "./Scene/TerrainData", "./Scene/TerrainMesh", "./Scene/TerrainProvider", "./Scene/TerrainState", "./Scene/TexturePool", "./Scene/Tile", "./Scene/TileCoordinatesImageryProvider", "./Scene/TileDiscardPolicy", "./Scene/TileImagery", "./Scene/TileMapServiceImageryProvider", "./Scene/TileProviderError", "./Scene/TileReplacementQueue", "./Scene/TileState", "./Scene/TileTerrain", "./Scene/TilingScheme", "./Scene/VRTheWorldTerrainProvider", "./Scene/VerticalOrigin", "./Scene/ViewportQuad", "./Scene/WebMapServiceImageryProvider", "./Scene/WebMercatorTilingScheme", "./Scene/createTangentSpaceDebugPrimitive", "./Scene/sampleTerrain", "./Shaders/Appearances/AllMaterialAppearanceFS", "./Shaders/Appearances/AllMaterialAppearanceVS", "./Shaders/Appearances/BasicMaterialAppearanceFS", "./Shaders/Appearances/BasicMaterialAppearanceVS", "./Shaders/Appearances/EllipsoidSurfaceAppearanceFS", "./Shaders/Appearances/EllipsoidSurfaceAppearanceVS", "./Shaders/Appearances/PerInstanceColorAppearanceFS", "./Shaders/Appearances/PerInstanceColorAppearanceVS", "./Shaders/Appearances/PerInstanceFlatColorAppearanceFS", "./Shaders/Appearances/PerInstanceFlatColorAppearanceVS", "./Shaders/Appearances/TexturedMaterialAppearanceFS", "./Shaders/Appearances/TexturedMaterialAppearanceVS", "./Shaders/BillboardCollectionFS", "./Shaders/BillboardCollectionVS", "./Shaders/Builtin/Constants", "./Shaders/Builtin/Functions/RGBToXYZ", "./Shaders/Builtin/Functions/XYZToRGB", "./Shaders/Builtin/Functions/antialias", "./Shaders/Builtin/Functions/cellular", "./Shaders/Builtin/Functions/columbusViewMorph", "./Shaders/Builtin/Functions/computePosition", "./Shaders/Builtin/Functions/eastNorthUpToEyeCoordinates", "./Shaders/Builtin/Functions/ellipsoidContainsPoint", "./Shaders/Builtin/Functions/ellipsoidNew", "./Shaders/Builtin/Functions/ellipsoidWgs84TextureCoordinates", "./Shaders/Builtin/Functions/equalsEpsilon", "./Shaders/Builtin/Functions/eyeOffset", "./Shaders/Builtin/Functions/eyeToWindowCoordinates", "./Shaders/Builtin/Functions/geodeticSurfaceNormal", "./Shaders/Builtin/Functions/getDefaultMaterial", "./Shaders/Builtin/Functions/getWaterNoise", "./Shaders/Builtin/Functions/getWgs84EllipsoidEC", "./Shaders/Builtin/Functions/hue", "./Shaders/Builtin/Functions/isEmpty", "./Shaders/Builtin/Functions/isFull", "./Shaders/Builtin/Functions/latitudeToWebMercatorFraction", "./Shaders/Builtin/Functions/luminance", "./Shaders/Builtin/Functions/modelToWindowCoordinates", "./Shaders/Builtin/Functions/multiplyWithColorBalance", "./Shaders/Builtin/Functions/phong", "./Shaders/Builtin/Functions/pointAlongRay", "./Shaders/Builtin/Functions/rayEllipsoidIntersectionInterval", "./Shaders/Builtin/Functions/saturation", "./Shaders/Builtin/Functions/snoise", "./Shaders/Builtin/Functions/tangentToEyeSpaceMatrix", "./Shaders/Builtin/Functions/translateRelativeToEye", "./Shaders/Builtin/Functions/transpose", "./Shaders/Builtin/Functions/windowToEyeCoordinates", "./Shaders/Builtin/Structs", "./Shaders/CentralBodyFS", "./Shaders/CentralBodyFSDepth", "./Shaders/CentralBodyFSPole", "./Shaders/CentralBodyVS", "./Shaders/CentralBodyVSDepth", "./Shaders/CentralBodyVSPole", "./Shaders/CustomSensorVolumeFS", "./Shaders/CustomSensorVolumeVS", "./Shaders/EllipsoidFS", "./Shaders/EllipsoidVS", "./Shaders/Materials/AsphaltMaterial", "./Shaders/Materials/BlobMaterial", "./Shaders/Materials/BrickMaterial", "./Shaders/Materials/BumpMapMaterial", "./Shaders/Materials/CementMaterial", "./Shaders/Materials/CheckerboardMaterial", "./Shaders/Materials/DotMaterial", "./Shaders/Materials/ErosionMaterial", "./Shaders/Materials/FacetMaterial", "./Shaders/Materials/FadeMaterial", "./Shaders/Materials/FresnelMaterial", "./Shaders/Materials/GrassMaterial", "./Shaders/Materials/GridMaterial", "./Shaders/Materials/NormalMapMaterial", "./Shaders/Materials/PolylineArrowMaterial", "./Shaders/Materials/PolylineGlowMaterial", "./Shaders/Materials/PolylineOutlineMaterial", "./Shaders/Materials/ReflectionMaterial", "./Shaders/Materials/RefractionMaterial", "./Shaders/Materials/RimLightingMaterial", "./Shaders/Materials/StripeMaterial", "./Shaders/Materials/TieDyeMaterial", "./Shaders/Materials/Water", "./Shaders/Materials/WoodMaterial", "./Shaders/PolylineFS", "./Shaders/PolylineVS", "./Shaders/PostProcessFilters/AdditiveBlend", "./Shaders/PostProcessFilters/BrightPass", "./Shaders/PostProcessFilters/GaussianBlur1D", "./Shaders/PostProcessFilters/PassThrough", "./Shaders/ReprojectWebMercatorFS", "./Shaders/ReprojectWebMercatorVS", "./Shaders/SensorVolume", "./Shaders/SkyAtmosphereFS", "./Shaders/SkyAtmosphereVS", "./Shaders/SkyBoxFS", "./Shaders/SkyBoxVS", "./Shaders/SunFS", "./Shaders/SunVS", "./Shaders/ViewportQuadFS", "./Shaders/ViewportQuadVS", "./ThirdParty/Tween", "./ThirdParty/Uri", "./ThirdParty/knockout-2.3.0", "./ThirdParty/knockout-es5", "./ThirdParty/knockout", "./ThirdParty/measureText", "./ThirdParty/mersenne-twister", "./ThirdParty/sprintf", "./ThirdParty/topojson", "./ThirdParty/weakmap", "./ThirdParty/when", "./Widgets/Animation/Animation", "./Widgets/Animation/AnimationViewModel", "./Widgets/BaseLayerPicker/BaseLayerPicker", "./Widgets/BaseLayerPicker/BaseLayerPickerViewModel", "./Widgets/BaseLayerPicker/ImageryProviderViewModel", "./Widgets/BaseLayerPicker/createDefaultBaseLayers", "./Widgets/isatCesiumWidget/isatCesiumWidget", "./Widgets/ClockViewModel", "./Widgets/Command", "./Widgets/FullscreenButton/FullscreenButton", "./Widgets/FullscreenButton/FullscreenButtonViewModel", "./Widgets/HomeButton/HomeButton", "./Widgets/HomeButton/HomeButtonViewModel", "./Widgets/Observable", "./Widgets/SceneModePicker/SceneModePicker", "./Widgets/SceneModePicker/SceneModePickerViewModel", "./Widgets/Timeline/Timeline", "./Widgets/Timeline/TimelineHighlightRange", "./Widgets/Timeline/TimelineTrack", "./Widgets/ToggleButtonViewModel", "./Widgets/Viewer/Viewer", "./Widgets/Viewer/viewerDragDropMixin", "./Widgets/Viewer/viewerDynamicObjectMixin", "./Widgets/checkForChromeFrame", "./Widgets/createCommand", "./Widgets/getElement"], function(e, t, r, i, n, o, a, s, l, u, c, h, d, m, p, f, v, y, g, _, w, C, x, S, E, b, T, A, M, P, D, I, O, R, L, z, N, F, B, V, q, k, U, W, G, H, j, Y, X, Z, K, J, Q, $, et, tt, rt, it, nt, ot, at, st, lt, ut, ct, ht, dt, mt, pt, ft, vt, yt, gt, _t, wt, Ct, xt, St, Et, bt, Tt, At, Mt, Pt, Dt, It, Ot, Rt, Lt, zt, Nt, Ft, Bt, Vt, qt, kt, Ut, Wt, Gt, Ht, jt, Yt, Xt, Zt, Kt, Jt, Qt, $t, er, tr, rr, ir, nr, or, ar, sr, lr, ur, cr, hr, dr, mr, pr, fr, vr, yr, gr, _r, wr, Cr, xr, Sr, Er, br, Tr, Ar, Mr, Pr, Dr, Ir, Or, Rr, Lr, zr, Nr, Fr, Br, Vr, qr, kr, Ur, Wr, Gr, Hr, jr, Yr, Xr, Zr, Kr, Jr, Qr, $r, ei, ti, ri, ii, ni, oi, ai, si, li, ui, ci, hi, di, mi, pi, fi, vi, yi, gi, _i, wi, Ci, xi, Si, Ei, bi, Ti, Ai, Mi, Pi, Di, Ii, Oi, Ri, Li, zi, Ni, Fi, Bi, Vi, qi, ki, Ui, Wi, Gi, Hi, ji, Yi, Xi, Zi, Ki, Ji, Qi, $i, en, tn, rn, nn, on, an, sn, ln, un, cn, hn, dn, mn, pn, fn, vn, yn, gn, _n, wn, Cn, xn, Sn, En, bn, Tn, An, Mn, Pn, Dn, In, On, Rn, Ln, zn, Nn, Fn, Bn, Vn, qn, kn, Un, Wn, Gn, Hn, jn, Yn, Xn, Zn, Kn, Jn, Qn, $n, eo, to, ro, io, no, oo, ao, so, lo, uo, co, ho, mo, po, fo, vo, yo, go, _o, wo, Co, xo, So, Eo, bo, To, Ao, Mo, Po, Do, Io, Oo, Ro, Lo, zo, No, Fo, Bo, Vo, qo, ko, Uo, Wo, Go, Ho, jo, Yo, Xo, Zo, Ko, Jo, Qo, $o, ea, ta, ra, ia, na, oa, aa, sa, la, ua, ca, ha, da, ma, pa, fa, va, ya, ga, _a, wa, Ca, xa, Sa, Ea, ba, Ta, Aa, Ma, Pa, Da, Ia, Oa, Ra, La, za, Na, Fa, Ba, Va, qa, ka, Ua, Wa, Ga, Ha, ja, Ya, Xa, Za, Ka, Ja, Qa, $a, es, ts, rs, is, ns, os, as, ss, ls, us, cs, hs, ds, ms, ps, fs, vs, ys, gs, _s, ws, Cs, xs, Ss, Es, bs, Ts, As, Ms, Ps, Ds, Is, Os, Rs, Ls, zs, Ns, Fs, Bs, Vs, qs, ks, Us, Ws, Gs, Hs, js, Ys, Xs, Zs, Ks, Js, Qs, $s, el, tl, rl, il, nl, ol, al, sl, ll, ul, cl, hl, dl, ml, pl, fl, vl, yl, gl, _l, wl, Cl, xl, Sl, El, bl, Tl, Al, Ml, Pl, Dl, Il, Ol, Rl, Ll) {
  7829. "use strict";
  7830. var zl = { _shaders: {} };
  7831. return zl.AxisAlignedBoundingBox = e, zl.BoundingRectangle = t, zl.BoundingSphere = r, zl.BoxGeometry = i, zl.BoxOutlineGeometry = n, zl.Cartesian2 = o, zl.Cartesian3 = a, zl.Cartesian4 = s, zl.Cartographic = l, zl.CatmullRomSpline = u, zl.CircleGeometry = c, zl.CircleOutlineGeometry = h, zl.Clock = d, zl.ClockRange = m, zl.ClockStep = p, zl.Color = f, zl.ColorGeometryInstanceAttribute = v, zl.ComponentDatatype = y, zl.CornerType = g, zl.CorridorGeometry = _, zl.CubicRealPolynomial = w, zl.CylinderGeometry = C, zl.CylinderGeometryLibrary = x, zl.CylinderOutlineGeometry = S, zl.DefaultProxy = E, zl.DeveloperError = b, zl.EarthOrientationParameters = T, zl.EarthOrientationParametersSample = A, zl.EllipseGeometry = M, zl.EllipseGeometryLibrary = P, zl.EllipseOutlineGeometry = D, zl.Ellipsoid = I, zl.EllipsoidGeodesic = O, zl.EllipsoidGeometry = R, zl.EllipsoidOutlineGeometry = L, zl.EllipsoidTangentPlane = z, zl.EllipsoidalOccluder = N, zl.EncodedCartesian3 = F, zl.Enumeration = B, zl.Event = V, zl.EventHelper = q, zl.Extent = k, zl.ExtentGeometry = U, zl.ExtentOutlineGeometry = W, zl.FAR = G, zl.FeatureDetection = H, zl.Fullscreen = j, zl.GeographicProjection = Y, zl.Geometry = X, zl.GeometryAttribute = Z, zl.GeometryAttributes = K, zl.GeometryInstance = J, zl.GeometryInstanceAttribute = Q, zl.GeometryPipeline = $, zl.HeightmapTessellator = et, zl.HermitePolynomialApproximation = tt, zl.HermiteSpline = rt, zl.Iau2006XysData = it, zl.Iau2006XysSample = nt, zl.IndexDatatype = ot, zl.InterpolationAlgorithm = at, zl.Intersect = st, zl.IntersectionTests = lt, zl.Interval = ut, zl.Iso8601 = ct, zl.JulianDate = ht, zl.KeyboardEventModifier = dt, zl.LagrangePolynomialApproximation = mt, zl.LeapSecond = pt, zl.LinearApproximation = ft, zl.Math = vt, zl.Matrix2 = yt, zl.Matrix3 = gt, zl.Matrix4 = _t, zl.NearFarScalar = wt, zl.Occluder = Ct, zl.OrientationInterpolator = xt, zl.Packable = St, zl.PackableForInterpolation = Et, zl.Plane = bt, zl.PolygonGeometry = Tt, zl.PolygonGeometryLibrary = At, zl.PolygonOutlineGeometry = Mt, zl.PolygonPipeline = Pt, zl.PolylinePipeline = Dt, zl.PrimitiveType = It, zl.QuadraticRealPolynomial = Ot, zl.QuarticRealPolynomial = Rt, zl.Quaternion = Lt, zl.Queue = zt, zl.Ray = Nt, zl.ReferenceFrame = Ft, zl.RequestErrorEvent = Bt, zl.RuntimeError = Vt, zl.ScreenSpaceEventHandler = qt, zl.ScreenSpaceEventType = kt, zl.Shapes = Ut, zl.ShowGeometryInstanceAttribute = Wt, zl.Simon1994PlanetaryPositions = Gt, zl.SimplePolylineGeometry = Ht, zl.SphereGeometry = jt, zl.SphereOutlineGeometry = Yt, zl.Spherical = Xt, zl.TaskProcessor = Zt, zl.TimeConstants = Kt, zl.TimeInterval = Jt, zl.TimeIntervalCollection = Qt, zl.TimeStandard = $t, zl.Tipsify = er, zl.Transforms = tr, zl.TridiagonalSystemSolver = rr, zl.VertexFormat = ir, zl.Visibility = nr, zl.WallGeometry = or, zl.WallGeometryLibrary = ar, zl.WallOutlineGeometry = sr, zl.WebMercatorProjection = lr, zl.WindingOrder = ur, zl.barycentricCoordinates = cr, zl.binarySearch = hr, zl.buildModuleUrl = dr, zl.cancelAnimationFrame = mr, zl.clone = pr, zl.combine = fr, zl.createGuid = vr, zl.defaultValue = yr, zl.defineProperties = gr, zl.defined = _r, zl.destroyObject = wr, zl.freezeObject = Cr, zl.getImagePixels = xr, zl.isCrossOriginUrl = Sr, zl.isLeapYear = Er, zl.jsonp = br, zl.loadArrayBuffer = Tr, zl.loadBlob = Ar, zl.loadImage = Mr, zl.loadImageViaBlob = Pr, zl.loadJson = Dr, zl.loadText = Ir, zl.loadWithXhr = Or, zl.loadXML = Rr, zl.pointInsideTriangle = Lr, zl.requestAnimationFrame = zr, zl.throttleRequestByServer = Nr, zl.wrapFunction = Fr, zl.writeTextToCanvas = Br, zl.ColorMaterialProperty = Vr, zl.CompositeDynamicObjectCollection = qr, zl.CompositeMaterialProperty = kr, zl.CompositePositionProperty = Ur, zl.CompositeProperty = Wr, zl.ConstantPositionProperty = Gr, zl.ConstantProperty = Hr, zl.CzmlDataSource = jr, zl.DataSource = Yr, zl.DataSourceCollection = Xr, zl.DataSourceDisplay = Zr, zl.DynamicBillboard = Kr, zl.DynamicBillboardVisualizer = Jr, zl.DynamicClock = Qr, zl.DynamicCone = $r, zl.DynamicConeVisualizerUsingCustomSensor = ei, zl.DynamicDirectionsProperty = ti, zl.DynamicEllipse = ri, zl.DynamicEllipsoid = ii, zl.DynamicEllipsoidVisualizer = ni, zl.DynamicLabel = oi, zl.DynamicLabelVisualizer = ai, zl.DynamicObject = si, zl.DynamicObjectCollection = li, zl.DynamicObjectView = ui, zl.DynamicPath = ci, zl.DynamicPathVisualizer = hi, zl.DynamicPoint = di, zl.DynamicPointVisualizer = mi, zl.DynamicPolygon = pi, zl.DynamicPolygonVisualizer = fi, zl.DynamicPolyline = vi, zl.DynamicPolylineVisualizer = yi, zl.DynamicPyramid = gi, zl.DynamicPyramidVisualizer = _i, zl.DynamicVector = wi, zl.DynamicVectorVisualizer = Ci, zl.DynamicVertexPositionsProperty = xi, zl.GeoJsonDataSource = Si, zl.GridMaterialProperty = Ei, zl.ImageMaterialProperty = bi, zl.MaterialProperty = Ti, zl.PositionProperty = Ai, zl.Property = Mi, zl.ReferenceProperty = Pi, zl.SampledPositionProperty = Di, zl.SampledProperty = Ii, zl.TimeIntervalCollectionPositionProperty = Oi, zl.TimeIntervalCollectionProperty = Ri, zl.VisualizerCollection = Li, zl.BlendEquation = zi, zl.BlendFunction = Ni, zl.BlendingState = Fi, zl.Buffer = Bi, zl.BufferUsage = Vi, zl.ClearCommand = qi, zl.CommandLists = ki, zl.Context = Ui, zl.CubeMap = Wi, zl.CubeMapFace = Gi, zl.CullFace = Hi, zl.DepthFunction = ji, zl.DrawCommand = Yi, zl.Framebuffer = Xi, zl.MipmapHint = Zi, zl.PassState = Ki, zl.PickFramebuffer = Ji, zl.PixelDatatype = Qi, zl.PixelFormat = $i, zl.RenderState = en, zl.Renderbuffer = tn, zl.RenderbufferFormat = rn, zl.ShaderCache = nn, zl.ShaderProgram = on, zl.StencilFunction = an, zl.StencilOperation = sn, zl.Texture = ln, zl.TextureAtlas = un, zl.TextureAtlasBuilder = cn, zl.TextureMagnificationFilter = hn, zl.TextureMinificationFilter = dn, zl.TextureWrap = mn, zl.UniformDatatype = pn, zl.UniformState = fn, zl.VertexArray = vn, zl.VertexArrayFacade = yn, zl.VertexLayout = gn, zl.createShaderSource = _n, zl.loadCubeMap = wn, zl.AnimationCollection = Cn, zl.Appearance = xn, zl.ArcGisImageServerTerrainProvider = Sn, zl.ArcGisMapServerImageryProvider = En, zl.Billboard = bn, zl.BillboardCollection = Tn, zl.BingMapsImageryProvider = An, zl.BingMapsStyle = Mn, zl.Camera = Pn, zl.CameraColumbusViewMode = Dn, zl.CameraController = In, zl.CameraEventAggregator = On, zl.CameraEventType = Rn, zl.CameraFlightPath = Ln, zl.CentralBody = zn, zl.CentralBodySurface = Nn, zl.CentralBodySurfaceShaderSet = Fn, zl.isatCesiumTerrainProvider = Bn, zl.CompositePrimitive = Vn, zl.Credit = qn, zl.CreditDisplay = kn, zl.CullingVolume = Un, zl.CustomSensorVolume = Wn, zl.DebugAppearance = Gn, zl.DiscardMissingTileImagePolicy = Hn, zl.EllipsoidPrimitive = jn, zl.EllipsoidSurfaceAppearance = Yn, zl.EllipsoidTerrainProvider = Xn, zl.ExtentPrimitive = Zn, zl.FrameState = Kn, zl.FrustumCommands = Jn, zl.GeographicTilingScheme = Qn, zl.GridImageryProvider = $n, zl.HeightmapTerrainData = eo, zl.HorizontalOrigin = to, zl.Imagery = ro, zl.ImageryLayer = io, zl.ImageryLayerCollection = no, zl.ImageryProvider = oo, zl.ImageryState = ao, zl.Label = so, zl.LabelCollection = lo, zl.LabelStyle = uo, zl.Material = co, zl.MaterialAppearance = ho, zl.NeverTileDiscardPolicy = mo, zl.OpenStreetMapImageryProvider = po, zl.OrthographicFrustum = fo, zl.PerInstanceColorAppearance = vo, zl.PerformanceDisplay = yo, zl.PerspectiveFrustum = go, zl.PerspectiveOffCenterFrustum = _o, zl.Polygon = wo, zl.Polyline = Co, zl.PolylineCollection = xo, zl.Primitive = So, zl.PrimitivePipeline = Eo, zl.PrimitiveState = bo, zl.RectangularPyramidSensorVolume = To, zl.Scene = Ao, zl.SceneMode = Mo, zl.SceneTransforms = Po, zl.SceneTransitioner = Do, zl.ScreenSpaceCameraController = Io, zl.SensorVolumeCollection = Oo, zl.SingleTileImageryProvider = Ro, zl.SkyAtmosphere = Lo, zl.SkyBox = zo, zl.Sun = No, zl.SunPostProcess = Fo, zl.TerrainData = Bo, zl.TerrainMesh = Vo, zl.TerrainProvider = qo, zl.TerrainState = ko, zl.TexturePool = Uo, zl.Tile = Wo, zl.TileCoordinatesImageryProvider = Go, zl.TileDiscardPolicy = Ho, zl.TileImagery = jo, zl.TileMapServiceImageryProvider = Yo, zl.TileProviderError = Xo, zl.TileReplacementQueue = Zo, zl.TileState = Ko, zl.TileTerrain = Jo, zl.TilingScheme = Qo, zl.VRTheWorldTerrainProvider = $o, zl.VerticalOrigin = ea, zl.ViewportQuad = ta, zl.WebMapServiceImageryProvider = ra, zl.WebMercatorTilingScheme = ia, zl.createTangentSpaceDebugPrimitive = na, zl.sampleTerrain = oa, zl._shaders.AllMaterialAppearanceFS = aa, zl._shaders.AllMaterialAppearanceVS = sa, zl._shaders.BasicMaterialAppearanceFS = la, zl._shaders.BasicMaterialAppearanceVS = ua, zl._shaders.EllipsoidSurfaceAppearanceFS = ca, zl._shaders.EllipsoidSurfaceAppearanceVS = ha, zl._shaders.PerInstanceColorAppearanceFS = da, zl._shaders.PerInstanceColorAppearanceVS = ma, zl._shaders.PerInstanceFlatColorAppearanceFS = pa, zl._shaders.PerInstanceFlatColorAppearanceVS = fa, zl._shaders.TexturedMaterialAppearanceFS = va, zl._shaders.TexturedMaterialAppearanceVS = ya, zl._shaders.BillboardCollectionFS = ga, zl._shaders.BillboardCollectionVS = _a, zl._shaders.Constants = wa, zl._shaders.RGBToXYZ = Ca, zl._shaders.XYZToRGB = xa, zl._shaders.antialias = Sa, zl._shaders.cellular = Ea, zl._shaders.columbusViewMorph = ba, zl._shaders.computePosition = Ta, zl._shaders.eastNorthUpToEyeCoordinates = Aa, zl._shaders.ellipsoidContainsPoint = Ma, zl._shaders.ellipsoidNew = Pa, zl._shaders.ellipsoidWgs84TextureCoordinates = Da, zl._shaders.equalsEpsilon = Ia, zl._shaders.eyeOffset = Oa, zl._shaders.eyeToWindowCoordinates = Ra, zl._shaders.geodeticSurfaceNormal = La, zl._shaders.getDefaultMaterial = za, zl._shaders.getWaterNoise = Na, zl._shaders.getWgs84EllipsoidEC = Fa, zl._shaders.hue = Ba, zl._shaders.isEmpty = Va, zl._shaders.isFull = qa, zl._shaders.latitudeToWebMercatorFraction = ka, zl._shaders.luminance = Ua, zl._shaders.modelToWindowCoordinates = Wa, zl._shaders.multiplyWithColorBalance = Ga, zl._shaders.phong = Ha, zl._shaders.pointAlongRay = ja, zl._shaders.rayEllipsoidIntersectionInterval = Ya, zl._shaders.saturation = Xa, zl._shaders.snoise = Za, zl._shaders.tangentToEyeSpaceMatrix = Ka, zl._shaders.translateRelativeToEye = Ja, zl._shaders.transpose = Qa, zl._shaders.windowToEyeCoordinates = $a, zl._shaders.Structs = es, zl._shaders.CentralBodyFS = ts, zl._shaders.CentralBodyFSDepth = rs, zl._shaders.CentralBodyFSPole = is, zl._shaders.CentralBodyVS = ns, zl._shaders.CentralBodyVSDepth = os, zl._shaders.CentralBodyVSPole = as, zl._shaders.CustomSensorVolumeFS = ss, zl._shaders.CustomSensorVolumeVS = ls, zl._shaders.EllipsoidFS = us, zl._shaders.EllipsoidVS = cs, zl._shaders.AsphaltMaterial = hs, zl._shaders.BlobMaterial = ds, zl._shaders.BrickMaterial = ms, zl._shaders.BumpMapMaterial = ps, zl._shaders.CementMaterial = fs, zl._shaders.CheckerboardMaterial = vs, zl._shaders.DotMaterial = ys, zl._shaders.ErosionMaterial = gs, zl._shaders.FacetMaterial = _s, zl._shaders.FadeMaterial = ws, zl._shaders.FresnelMaterial = Cs, zl._shaders.GrassMaterial = xs, zl._shaders.GridMaterial = Ss, zl._shaders.NormalMapMaterial = Es, zl._shaders.PolylineArrowMaterial = bs, zl._shaders.PolylineGlowMaterial = Ts, zl._shaders.PolylineOutlineMaterial = As, zl._shaders.ReflectionMaterial = Ms, zl._shaders.RefractionMaterial = Ps, zl._shaders.RimLightingMaterial = Ds, zl._shaders.StripeMaterial = Is, zl._shaders.TieDyeMaterial = Os, zl._shaders.Water = Rs, zl._shaders.WoodMaterial = Ls, zl._shaders.PolylineFS = zs, zl._shaders.PolylineVS = Ns, zl._shaders.AdditiveBlend = Fs, zl._shaders.BrightPass = Bs, zl._shaders.GaussianBlur1D = Vs, zl._shaders.PassThrough = qs, zl._shaders.ReprojectWebMercatorFS = ks, zl._shaders.ReprojectWebMercatorVS = Us, zl._shaders.SensorVolume = Ws, zl._shaders.SkyAtmosphereFS = Gs, zl._shaders.SkyAtmosphereVS = Hs, zl._shaders.SkyBoxFS = js, zl._shaders.SkyBoxVS = Ys, zl._shaders.SunFS = Xs, zl._shaders.SunVS = Zs, zl._shaders.ViewportQuadFS = Ks, zl._shaders.ViewportQuadVS = Js, zl.Tween = Qs, zl.Uri = $s, zl.knockout_2_3_0 = el, zl.knockout_es5 = tl, zl.knockout = rl, zl.measureText = il, zl.mersenne_twister = nl, zl.sprintf = ol, zl.topojson = al, zl.weakmap = sl, zl.when = ll, zl.Animation = ul, zl.AnimationViewModel = cl, zl.BaseLayerPicker = hl, zl.BaseLayerPickerViewModel = dl, zl.ImageryProviderViewModel = ml, zl.createDefaultBaseLayers = pl, zl.isatCesiumWidget = fl, zl.ClockViewModel = vl, zl.Command = yl, zl.FullscreenButton = gl, zl.FullscreenButtonViewModel = _l, zl.HomeButton = wl, zl.HomeButtonViewModel = Cl, zl.Observable = xl, zl.SceneModePicker = Sl, zl.SceneModePickerViewModel = El, zl.Timeline = bl, zl.TimelineHighlightRange = Tl, zl.TimelineTrack = Al, zl.ToggleButtonViewModel = Ml, zl.Viewer = Pl, zl.viewerDragDropMixin = Dl, zl.viewerDynamicObjectMixin = Il, zl.checkForChromeFrame = Ol, zl.createCommand = Rl, zl.getElement = Ll, zl
  7832. }), t(["isatCesium"], function(e) { "use strict"; var t = "undefined" != typeof window ? window : "undefined" != typeof self ? self : {};
  7833. t.isatCesium = e }, void 0, !0)
  7834. }();
  7835. function angl(vec1, vec2) {
  7836. 'use strict';
  7837. var SMALL = 0.00000001,
  7838. UNDEFINED = 999999.1,
  7839. magv1 = mag(vec1),
  7840. magv2 = mag(vec2),
  7841. temp,
  7842. theta;
  7843. if (magv1 * magv2 > SMALL * SMALL) {
  7844. temp = dot(vec1, vec2) / (magv1 * magv2);
  7845. if (Math.abs(temp) > 1.0) {
  7846. temp = sign(temp) * 1.0;
  7847. }
  7848. theta = Math.acos(temp);
  7849. }
  7850. else {
  7851. theta = UNDEFINED;
  7852. }
  7853. return theta;
  7854. }
  7855. // compat.js
  7856. if (typeof(String.prototype.trim) === 'undefined') {
  7857. String.prototype.trim = function () {
  7858. 'use strict';
  7859. return this.replace(/^\s+|\s+$/g, '');
  7860. };
  7861. }
  7862. if (typeof(String.prototype.ltrim) === 'undefined') {
  7863. String.prototype.ltrim = function () {
  7864. 'use strict';
  7865. return this.replace(/^\s+/, '');
  7866. };
  7867. }
  7868. if (typeof(String.prototype.rtrim) === 'undefined') {
  7869. String.prototype.rtrim = function () {
  7870. 'use strict';
  7871. return this.replace(/\s+$/, '');
  7872. };
  7873. }
  7874. // MATLAB fake compatibility output functions
  7875. // These rather assume the output elements are <pre/>
  7876. // so the \n gives linebreaks (adding <br/> would make double breaks)
  7877. // TODO: if the element doesn't exist, add it to the DOM.
  7878. function writeId(id, str) { // TODO: need varargs and sprintf() here
  7879. 'use strict';
  7880. // TODO: isnt' there an append() method?
  7881. document.getElementById(id).innerHTML += str + '<br/>\n';
  7882. }
  7883. function debug(str) {
  7884. 'use strict';
  7885. document.getElementById('debug').innerHTML += str + '\n';
  7886. }
  7887. function outfile(str) {
  7888. 'use strict';
  7889. // I'm using sprintf() so don't want "\n" from writeId()'s <br/>
  7890. document.getElementById('outfile').innerHTML += str;
  7891. }
  7892. function fprintf1(str) {
  7893. 'use strict';
  7894. // I'm using sprintf() so don't want "\n" from writeId()'s <br/>
  7895. document.getElementById('fprintf1').innerHTML += str;
  7896. }
  7897. // constastro.js
  7898. // ----------------------- physical constants ----------------
  7899. // WGS-84/EGM-96 constants used here
  7900. var re = 6378.137, // km
  7901. flat = 1.0 / 298.257223563,
  7902. omegaearth = 7.292115e-11, // rad/s
  7903. mu = 398600.4418, // km3/s2
  7904. mum = 3.986004418e14, // m3/s2
  7905. // derived constants from the base values
  7906. eccearth = Math.sqrt(2.0 * flat - flat * flat),
  7907. eccearthsqrd = eccearth * eccearth,
  7908. renm = re / nm2m,
  7909. reft = re * 1000.0 / ft2m,
  7910. tusec = Math.sqrt(Math.pow(re, 3) / mu),
  7911. tumin = tusec / 60.0,
  7912. tuday = tusec / 86400.0,
  7913. omegaearthradptu = omegaearth * tusec,
  7914. omegaearthradpmin = omegaearth * 60.0,
  7915. velkmps = Math.sqrt(mu / re),
  7916. velftps = velkmps * 1000.0 / ft2m,
  7917. velradpmin = velkmps * 60.0 / re,
  7918. //for afspc
  7919. //velkmps1 = velradpmin*6378.135/60.0 7.90537051051763
  7920. //mu1 = velkmps*velkmps*6378.135 3.986003602567418e+005
  7921. degpsec = (180.0 / Math.PI) / tusec,
  7922. radpday = 2.0 * Math.PI * 1.002737909350795,
  7923. speedoflight = 2.99792458e8, // m/s
  7924. au = 149597870.0, // km
  7925. earth2moon = 384400.0, // km
  7926. moonradius = 1738.0, // km
  7927. sunradius = 696000.0, // km
  7928. masssun = 1.9891e30,
  7929. massearth = 5.9742e24,
  7930. massmoon = 7.3483e22;
  7931. // constmath.js
  7932. var small = 0.00000001,
  7933. infinite = 999999.9,
  7934. UNDEFINED = 999999.1, // lowercase is JavaScript reserved word
  7935. // ------------------------- mathematical --------------------
  7936. rad = 180.0 / Math.PI,
  7937. twopi = 2.0 * Math.PI,
  7938. halfpi = Math.PI * 0.5,
  7939. // ------------------------- conversions ---------------------
  7940. ft2m = 0.3048,
  7941. mile2m = 1609.344,
  7942. nm2m = 1852,
  7943. mile2ft = 5280,
  7944. mileph2kmph = 0.44704,
  7945. nmph2kmph = 0.5144444;
  7946. // days2mdh.js
  7947. var i, lmonth = [], dayofyr, i, inttemp, mon, day, temp, hr, minute, sec, julianday;
  7948. function days2mdh(year, days) {
  7949. 'use strict';
  7950. // --------------- set up array of days in month --------------
  7951. // This is crazy, why not just:
  7952. // lmonth = [undefined, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
  7953. for (i = 1; i <= 12; i += 1) {
  7954. lmonth[i] = 31;
  7955. if (i === 2) {
  7956. lmonth[i] = 28;
  7957. }
  7958. if (i === 4 || i === 6 || i === 9 || i === 11) {
  7959. lmonth[i] = 30;
  7960. }
  7961. }
  7962. dayofyr = Math.floor(days);
  7963. // ----------------- find month and day of month ---------------
  7964. if ((year - 1900) % 4 === 0) {
  7965. lmonth[2] = 29;
  7966. }
  7967. i = 1;
  7968. inttemp = 0;
  7969. while ((dayofyr > inttemp + lmonth[i]) && (i < 12)) {
  7970. inttemp = inttemp + lmonth[i];
  7971. i += 1;
  7972. }
  7973. mon = i;
  7974. day = dayofyr - inttemp;
  7975. // ----------------- find hours minutes and seconds ------------
  7976. // MATLAB's fix() rounds toward zero which behaves differently for
  7977. // negative numbers than JavaScript's Math.floor() which rounds down.
  7978. // But it should be fine here, for positve numbers.
  7979. temp = (days - dayofyr) * 24.0;
  7980. hr = Math.floor(temp);
  7981. temp = (temp - hr) * 60.0;
  7982. minute = Math.floor(temp);
  7983. sec = (temp - minute) * 60.0;
  7984. julianday = jday(year, mon, day, hr, minute, sec);
  7985. return [mon, day, hr, minute, sec];
  7986. }
  7987. // dpper.js
  7988. function dpper(e3, ee2, peo, pgho, pho, pinco, plo, se2,
  7989. se3, sgh2, sgh3, sgh4, sh2, sh3, si2, si3,
  7990. sl2, sl3, sl4, t, xgh2, xgh3, xgh4, xh2,
  7991. xh3, xi2, xi3, xl2, xl3, xl4, zmol,
  7992. zmos, inclo, init, ep, inclp, nodep, argpp, mp) {
  7993. 'use strict';
  7994. if (typeof(opsmode) === 'undefined') {
  7995. throw new Error('Global opsmode is undefined, must be "a" or "i"');
  7996. }
  7997. if ((opsmode !== 'a') && (opsmode !== 'i')) {
  7998. throw new Error('Global must be "a" or "i" but opsmode=' + opsmode);
  7999. }
  8000. var twopi = 2.0 * Math.PI,
  8001. // /* ---------------------- constants ----------------------------- */
  8002. zns = 1.19459e-5,
  8003. zes = 0.01675,
  8004. znl = 1.5835218e-4,
  8005. zel = 0.05490,
  8006. zm = zmos + zns * t,
  8007. zf, sinzf, f2, f3, ses, sis, sls, sghs, shs,
  8008. sel, sil, sll, sghl, shll, pe, pinc, pl, pgh, ph,
  8009. sinip, cosip,
  8010. sinop, cosop, alfdp, betdb, dalf, dbet, betdp, xls, dls, xnoh;
  8011. // /* --------------- calculate time varying periodics ----------- */
  8012. // // be sure that the initial call has time set to zero
  8013. if (init === 'y') {
  8014. zm = zmos;
  8015. }
  8016. zf = zm + 2.0 * zes * Math.sin(zm);
  8017. sinzf = Math.sin(zf);
  8018. f2 = 0.5 * sinzf * sinzf - 0.25;
  8019. f3 = -0.5 * sinzf * Math.cos(zf);
  8020. ses = se2 * f2 + se3 * f3;
  8021. sis = si2 * f2 + si3 * f3;
  8022. sls = sl2 * f2 + sl3 * f3 + sl4 * sinzf;
  8023. sghs = sgh2 * f2 + sgh3 * f3 + sgh4 * sinzf;
  8024. shs = sh2 * f2 + sh3 * f3;
  8025. zm = zmol + znl * t;
  8026. if (init === 'y') {
  8027. zm = zmol;
  8028. }
  8029. zf = zm + 2.0 * zel * Math.sin(zm);
  8030. sinzf = Math.sin(zf);
  8031. f2 = 0.5 * sinzf * sinzf - 0.25;
  8032. f3 = -0.5 * sinzf * Math.cos(zf);
  8033. sel = ee2 * f2 + e3 * f3;
  8034. sil = xi2 * f2 + xi3 * f3;
  8035. sll = xl2 * f2 + xl3 * f3 + xl4 * sinzf;
  8036. sghl = xgh2 * f2 + xgh3 * f3 + xgh4 * sinzf;
  8037. shll = xh2 * f2 + xh3 * f3;
  8038. pe = ses + sel;
  8039. pinc = sis + sil;
  8040. pl = sls + sll;
  8041. pgh = sghs + sghl;
  8042. ph = shs + shll;
  8043. if (init === 'n') {
  8044. // 0.2 rad = 11.45916 deg
  8045. pe = pe - peo;
  8046. pinc = pinc - pinco;
  8047. pl = pl - plo;
  8048. pgh = pgh - pgho;
  8049. ph = ph - pho;
  8050. inclp = inclp + pinc;
  8051. ep = ep + pe;
  8052. sinip = Math.sin(inclp);
  8053. cosip = Math.cos(inclp);
  8054. // /* ----------------- apply periodics directly ------------ */
  8055. // sgp4fix for lyddane choice
  8056. // strn3 used original inclination - this is technically feasible
  8057. // gsfc used perturbed inclination - also technically feasible
  8058. // probably best to readjust the 0.2 limit value and limit discontinuity
  8059. // use next line for original strn3 approach and original inclination
  8060. // if (inclo >= 0.2)
  8061. // use next line for gsfc version and perturbed inclination
  8062. if (inclp >= 0.2) {
  8063. ph = ph / sinip;
  8064. pgh = pgh - cosip * ph;
  8065. argpp = argpp + pgh;
  8066. nodep = nodep + ph;
  8067. mp = mp + pl;
  8068. }
  8069. else {
  8070. // /* ---- apply periodics with lyddane modification ---- */
  8071. sinop = Math.sin(nodep);
  8072. cosop = Math.cos(nodep);
  8073. alfdp = sinip * sinop;
  8074. betdp = sinip * cosop;
  8075. dalf = ph * cosop + pinc * cosip * sinop;
  8076. dbet = -ph * sinop + pinc * cosip * cosop;
  8077. alfdp = alfdp + dalf;
  8078. betdp = betdp + dbet;
  8079. nodep = nodep % twopi;
  8080. // sgp4fix for afspc written intrinsic functions
  8081. // nodep used without a trigonometric function ahead
  8082. if ((nodep < 0.0) && (opsmode === 'a')) {
  8083. nodep = nodep + twopi;
  8084. }
  8085. xls = mp + argpp + cosip * nodep;
  8086. dls = pl + pgh - pinc * nodep * sinip;
  8087. xls = xls + dls;
  8088. xnoh = nodep;
  8089. nodep = Math.atan2(alfdp, betdp);
  8090. // sgp4fix for afspc written intrinsic functions
  8091. // nodep used without a trigonometric function ahead
  8092. if ((nodep < 0.0) && (opsmode === 'a')) {
  8093. nodep = nodep + twopi;
  8094. }
  8095. if (Math.abs(xnoh - nodep) > Math.PI) {
  8096. if (nodep < xnoh) {
  8097. nodep = nodep + twopi;
  8098. }
  8099. else {
  8100. nodep = nodep - twopi;
  8101. }
  8102. }
  8103. mp = mp + pl;
  8104. argpp = xls - mp - cosip * nodep;
  8105. }
  8106. } // if init == 'n'
  8107. return [ ep, inclp, nodep, argpp, mp];
  8108. }
  8109. // dscom.js
  8110. function dscom(epoch, ep, argpp, tc, inclp, nodep, np) {
  8111. 'use strict';
  8112. // /* -------------------------- constants ------------------------- */
  8113. var zes = 0.01675,
  8114. zel = 0.05490,
  8115. c1ss = 2.9864797e-6,
  8116. c1l = 4.7968065e-7,
  8117. zsinis = 0.39785416,
  8118. zcosis = 0.91744867,
  8119. zcosgs = 0.1945905,
  8120. zsings = -0.98088458,
  8121. twopi = 2.0 * Math.PI,
  8122. // /* --------------------- local variables ------------------------ */
  8123. nm = np,
  8124. em = ep,
  8125. snodm = Math.sin(nodep),
  8126. cnodm = Math.cos(nodep),
  8127. sinomm = Math.sin(argpp),
  8128. cosomm = Math.cos(argpp),
  8129. sinim = Math.sin(inclp),
  8130. cosim = Math.cos(inclp),
  8131. emsq = em * em,
  8132. betasq = 1.0 - emsq,
  8133. rtemsq = Math.sqrt(betasq),
  8134. // /* ----------------- initialize lunar solar terms --------------- */
  8135. peo = 0.0,
  8136. pinco = 0.0,
  8137. plo = 0.0,
  8138. pgho = 0.0,
  8139. pho = 0.0,
  8140. day = epoch + 18261.5 + tc / 1440.0,
  8141. xnodce = (4.5236020 - 9.2422029e-4 * day) % twopi,
  8142. stem = Math.sin(xnodce),
  8143. ctem = Math.cos(xnodce),
  8144. zcosil = 0.91375164 - 0.03568096 * ctem,
  8145. zsinil = Math.sqrt(1.0 - zcosil * zcosil),
  8146. zsinhl = 0.089683511 * stem / zsinil,
  8147. zcoshl = Math.sqrt(1.0 - zsinhl * zsinhl),
  8148. gam = 5.8351514 + 0.0019443680 * day,
  8149. zx = 0.39785416 * stem / zsinil,
  8150. zy = zcoshl * ctem + 0.91744867 * zsinhl * stem,
  8151. //
  8152. zcosgl, zsingl, zcosg, zsing, zcosi, zsini, zcosh, zsinh,
  8153. cc, xnoi,
  8154. lsflg,
  8155. a1, a3, a7, a8, a9, a10, a2, a4, a5, a6,
  8156. x1, x2, x3, x4, x5, x6, x7, x8,
  8157. z31, z32, z33, z1, z2, z3, z11, z12, z13, z21, z22, z23,
  8158. s3, s2, s4, s1, s5, s6, s7,
  8159. ss1, ss2, ss3, ss4, ss5, ss6, ss7,
  8160. sz1, sz2, sz3, sz11, sz12, sz13, sz21, sz22, sz23, sz31, sz32, sz33,
  8161. zmol, zmos,
  8162. se2, se3, si2, si3, sl2, sl3, sl4, sgh2, sgh3, sgh4, sh2, sh3,
  8163. ee2, e3, xi2, xi3, xl2, xl3, xl4, xgh2, xgh3, xgh4, xh2, xh3;
  8164. zx = Math.atan2(zx, zy);
  8165. zx = gam + zx - xnodce;
  8166. zcosgl = Math.cos(zx);
  8167. zsingl = Math.sin(zx);
  8168. // /* ------------------------- do solar terms --------------------- */
  8169. zcosg = zcosgs;
  8170. zsing = zsings;
  8171. zcosi = zcosis;
  8172. zsini = zsinis;
  8173. zcosh = cnodm;
  8174. zsinh = snodm;
  8175. cc = c1ss;
  8176. xnoi = 1.0 / nm;
  8177. for (lsflg = 1; lsflg <= 2; lsflg += 1) { // =1:2
  8178. a1 = zcosg * zcosh + zsing * zcosi * zsinh;
  8179. a3 = -zsing * zcosh + zcosg * zcosi * zsinh;
  8180. a7 = -zcosg * zsinh + zsing * zcosi * zcosh;
  8181. a8 = zsing * zsini;
  8182. a9 = zsing * zsinh + zcosg * zcosi * zcosh;
  8183. a10 = zcosg * zsini;
  8184. a2 = cosim * a7 + sinim * a8;
  8185. a4 = cosim * a9 + sinim * a10;
  8186. a5 = -sinim * a7 + cosim * a8;
  8187. a6 = -sinim * a9 + cosim * a10;
  8188. x1 = a1 * cosomm + a2 * sinomm;
  8189. x2 = a3 * cosomm + a4 * sinomm;
  8190. x3 = -a1 * sinomm + a2 * cosomm;
  8191. x4 = -a3 * sinomm + a4 * cosomm;
  8192. x5 = a5 * sinomm;
  8193. x6 = a6 * sinomm;
  8194. x7 = a5 * cosomm;
  8195. x8 = a6 * cosomm;
  8196. z31 = 12.0 * x1 * x1 - 3.0 * x3 * x3;
  8197. z32 = 24.0 * x1 * x2 - 6.0 * x3 * x4;
  8198. z33 = 12.0 * x2 * x2 - 3.0 * x4 * x4;
  8199. z1 = 3.0 * (a1 * a1 + a2 * a2) + z31 * emsq;
  8200. z2 = 6.0 * (a1 * a3 + a2 * a4) + z32 * emsq;
  8201. z3 = 3.0 * (a3 * a3 + a4 * a4) + z33 * emsq;
  8202. z11 = -6.0 * a1 * a5 + emsq * (-24.0 * x1 * x7 - 6.0 * x3 * x5);
  8203. z12 = -6.0 * (a1 * a6 + a3 * a5) + emsq * (-24.0 * (x2 * x7 + x1 * x8) - 6.0 * (x3 * x6 + x4 * x5));
  8204. z13 = -6.0 * a3 * a6 + emsq * (-24.0 * x2 * x8 - 6.0 * x4 * x6);
  8205. z21 = 6.0 * a2 * a5 + emsq * (24.0 * x1 * x5 - 6.0 * x3 * x7);
  8206. z22 = 6.0 * (a4 * a5 + a2 * a6) + emsq * (24.0 * (x2 * x5 + x1 * x6) - 6.0 * (x4 * x7 + x3 * x8));
  8207. z23 = 6.0 * a4 * a6 + emsq * (24.0 * x2 * x6 - 6.0 * x4 * x8);
  8208. z1 = z1 + z1 + betasq * z31;
  8209. z2 = z2 + z2 + betasq * z32;
  8210. z3 = z3 + z3 + betasq * z33;
  8211. s3 = cc * xnoi;
  8212. s2 = -0.5 * s3 / rtemsq;
  8213. s4 = s3 * rtemsq;
  8214. s1 = -15.0 * em * s4;
  8215. s5 = x1 * x3 + x2 * x4;
  8216. s6 = x2 * x3 + x1 * x4;
  8217. s7 = x2 * x4 - x1 * x3;
  8218. // /* ----------------------- do lunar terms ------------------- */
  8219. if (lsflg === 1) {
  8220. ss1 = s1;
  8221. ss2 = s2;
  8222. ss3 = s3;
  8223. ss4 = s4;
  8224. ss5 = s5;
  8225. ss6 = s6;
  8226. ss7 = s7;
  8227. sz1 = z1;
  8228. sz2 = z2;
  8229. sz3 = z3;
  8230. sz11 = z11;
  8231. sz12 = z12;
  8232. sz13 = z13;
  8233. sz21 = z21;
  8234. sz22 = z22;
  8235. sz23 = z23;
  8236. sz31 = z31;
  8237. sz32 = z32;
  8238. sz33 = z33;
  8239. zcosg = zcosgl;
  8240. zsing = zsingl;
  8241. zcosi = zcosil;
  8242. zsini = zsinil;
  8243. zcosh = zcoshl * cnodm + zsinhl * snodm;
  8244. zsinh = snodm * zcoshl - cnodm * zsinhl;
  8245. cc = c1l;
  8246. }
  8247. }
  8248. zmol = (4.7199672 + 0.22997150 * day - gam) % twopi;
  8249. zmos = (6.2565837 + 0.017201977 * day) % twopi;
  8250. // /* ------------------------ do solar terms ---------------------- */
  8251. se2 = 2.0 * ss1 * ss6;
  8252. se3 = 2.0 * ss1 * ss7;
  8253. si2 = 2.0 * ss2 * sz12;
  8254. si3 = 2.0 * ss2 * (sz13 - sz11);
  8255. sl2 = -2.0 * ss3 * sz2;
  8256. sl3 = -2.0 * ss3 * (sz3 - sz1);
  8257. sl4 = -2.0 * ss3 * (-21.0 - 9.0 * emsq) * zes;
  8258. sgh2 = 2.0 * ss4 * sz32;
  8259. sgh3 = 2.0 * ss4 * (sz33 - sz31);
  8260. sgh4 = -18.0 * ss4 * zes;
  8261. sh2 = -2.0 * ss2 * sz22;
  8262. sh3 = -2.0 * ss2 * (sz23 - sz21);
  8263. // /* ------------------------ do lunar terms ---------------------- */
  8264. ee2 = 2.0 * s1 * s6;
  8265. e3 = 2.0 * s1 * s7;
  8266. xi2 = 2.0 * s2 * z12;
  8267. xi3 = 2.0 * s2 * (z13 - z11);
  8268. xl2 = -2.0 * s3 * z2;
  8269. xl3 = -2.0 * s3 * (z3 - z1);
  8270. xl4 = -2.0 * s3 * (-21.0 - 9.0 * emsq) * zel;
  8271. xgh2 = 2.0 * s4 * z32;
  8272. xgh3 = 2.0 * s4 * (z33 - z31);
  8273. xgh4 = -18.0 * s4 * zel;
  8274. xh2 = -2.0 * s2 * z22;
  8275. xh3 = -2.0 * s2 * (z23 - z21);
  8276. return [sinim, cosim, sinomm, cosomm, snodm, cnodm, day, e3, ee2, em, emsq, gam,
  8277. peo, pgho, pho, pinco, plo, rtemsq, se2, se3, sgh2, sgh3, sgh4, sh2, sh3, si2,
  8278. si3, sl2, sl3, sl4, s1, s2, s3, s4, s5, s6, s7, ss1, ss2, ss3, ss4, ss5, ss6, ss7,
  8279. sz1, sz2, sz3, sz11, sz12, sz13, sz21, sz22, sz23, sz31, sz32, sz33, xgh2, xgh3,
  8280. xgh4, xh2, xh3, xi2, xi3, xl2, xl3, xl4, nm, z1, z2, z3, z11, z12, z13, z21, z22,
  8281. z23, z31, z32, z33, zmol, zmos];
  8282. }
  8283. // dsinit.js
  8284. function dsinit(
  8285. cosim, emsq, argpo, s1, s2, s3, s4,
  8286. s5, sinim, ss1, ss2, ss3, ss4, ss5,
  8287. sz1, sz3, sz11, sz13, sz21, sz23, sz31,
  8288. sz33, t, tc, gsto, mo, mdot, no,
  8289. nodeo, nodedot, xpidot, z1, z3, z11,
  8290. z13, z21, z23, z31, z33, em, argpm,
  8291. inclm, mm, nm, nodem, ecco, eccsq) {
  8292. 'use strict';
  8293. // /* --------------------- local variables ------------------------ */
  8294. var twopi = 2.0 * Math.PI,
  8295. aonv = 0.0,
  8296. q22 = 1.7891679e-6,
  8297. q31 = 2.1460748e-6,
  8298. q33 = 2.2123015e-7,
  8299. root22 = 1.7891679e-6,
  8300. root44 = 7.3636953e-9,
  8301. root54 = 2.1765803e-9,
  8302. rptim = 4.37526908801129966e-3,
  8303. root32 = 3.7393792e-7,
  8304. root52 = 1.1428639e-7,
  8305. x2o3 = 2.0 / 3.0,
  8306. znl = 1.5835218e-4,
  8307. zns = 1.19459e-5,
  8308. // sgp4fix identify constants and allow alternate values
  8309. irez = 0,
  8310. // TODO: FIGURE OUT HOW TO GET GLOBALS
  8311. //global tumin mu radiusearthkm xke j2 j3 j4 j3oj2
  8312. //tumin, mu, radiusearthkm, xke, j2, j3, j4, j3oj2,
  8313. // /* -------------------- deep space initialization ------------ */
  8314. d2201 = 0,
  8315. d2211 = 0,
  8316. d3210 = 0,
  8317. d3222 = 0,
  8318. d4410 = 0,
  8319. d4422 = 0,
  8320. d5220 = 0,
  8321. d5232 = 0,
  8322. d5421 = 0,
  8323. d5433 = 0,
  8324. del1 = 0,
  8325. del2 = 0,
  8326. del3 = 0,
  8327. atime = 0,
  8328. xfact = 0,
  8329. xlamo = 0,
  8330. xli = 0,
  8331. xni = 0,
  8332. // variable defined later
  8333. ses, sis, sls, sghs, shs, sgs, sghl,
  8334. dedt, didt, dmdt, sdhl, shll, domdt, dnodt, dndt, theta,
  8335. cosisq, emo, emsqo, eoc,
  8336. g201, g211, g310, g322, g410, g422, g520, g533, g521, g532,
  8337. sini2, f220, f221, f321, f322, f441, f442, f522, f523, f542, f543,
  8338. xno2, ainv2, temp1, temp,
  8339. g200, g300, f311, f330;
  8340. if ((nm < 0.0052359877) && (nm > 0.0034906585)) {
  8341. irez = 1;
  8342. }
  8343. if ((nm >= 8.26e-3) && (nm <= 9.24e-3) && (em >= 0.5)) {
  8344. irez = 2;
  8345. }
  8346. // /* ------------------------ do solar terms ------------------- */
  8347. ses = ss1 * zns * ss5;
  8348. sis = ss2 * zns * (sz11 + sz13);
  8349. sls = -zns * ss3 * (sz1 + sz3 - 14.0 - 6.0 * emsq);
  8350. sghs = ss4 * zns * (sz31 + sz33 - 6.0);
  8351. shs = -zns * ss2 * (sz21 + sz23);
  8352. // // sgp4fix for 180 deg incl
  8353. if ((inclm < 5.2359877e-2) || (inclm > Math.PI - 5.2359877e-2)) {
  8354. shs = 0.0;
  8355. }
  8356. if (sinim !== 0.0) { // WARN unreliable floating point comparison
  8357. shs = shs / sinim;
  8358. }
  8359. sgs = sghs - cosim * shs;
  8360. // /* ------------------------- do lunar terms ------------------ */
  8361. dedt = ses + s1 * znl * s5;
  8362. didt = sis + s2 * znl * (z11 + z13);
  8363. dmdt = sls - znl * s3 * (z1 + z3 - 14.0 - 6.0 * emsq);
  8364. sghl = s4 * znl * (z31 + z33 - 6.0);
  8365. shll = -znl * s2 * (z21 + z23);
  8366. // // sgp4fix for 180 deg incl
  8367. if ((inclm < 5.2359877e-2) || (inclm > Math.PI - 5.2359877e-2)) {
  8368. shll = 0.0;
  8369. }
  8370. domdt = sgs + sghl;
  8371. dnodt = shs;
  8372. if (sinim !== 0.0) { // WARN unrealiable
  8373. domdt = domdt - cosim / sinim * shll;
  8374. dnodt = dnodt + shll / sinim;
  8375. }
  8376. // /* ----------- calculate deep space resonance effects -------- */
  8377. dndt = 0.0;
  8378. theta = (gsto + tc * rptim) % twopi;
  8379. em = em + dedt * t;
  8380. inclm = inclm + didt * t;
  8381. argpm = argpm + domdt * t;
  8382. nodem = nodem + dnodt * t;
  8383. mm = mm + dmdt * t;
  8384. // // sgp4fix for negative inclinations
  8385. // // the following if statement should be commented out
  8386. // //if (inclm < 0.0)
  8387. // // {
  8388. // // inclm = -inclm;
  8389. // // argpm = argpm - pi;
  8390. // // nodem = nodem + pi;
  8391. // // }
  8392. // /* - update resonances : numerical (euler-maclaurin) integration - */
  8393. // /* ------------------------- epoch restart ---------------------- */
  8394. // // sgp4fix for propagator problems
  8395. // // the following integration works for negative time steps and periods
  8396. // // the specific changes are unknown because the original code was so convoluted
  8397. // /* -------------- initialize the resonance terms ------------- */
  8398. if (irez !== 0) {
  8399. aonv = Math.pow(nm / xke, x2o3); // TODO GLOBAL xke
  8400. // /* ---------- geopotential resonance for 12 hour orbits ------ */
  8401. if (irez === 2) {
  8402. cosisq = cosim * cosim;
  8403. emo = em;
  8404. em = ecco;
  8405. emsqo = emsq;
  8406. emsq = eccsq;
  8407. eoc = em * emsq;
  8408. g201 = -0.306 - (em - 0.64) * 0.440;
  8409. if (em <= 0.65) {
  8410. g211 = 3.616 - 13.2470 * em + 16.2900 * emsq;
  8411. g310 = -19.302 + 117.3900 * em - 228.4190 * emsq + 156.5910 * eoc;
  8412. g322 = -18.9068 + 109.7927 * em - 214.6334 * emsq + 146.5816 * eoc;
  8413. g410 = -41.122 + 242.6940 * em - 471.0940 * emsq + 313.9530 * eoc;
  8414. g422 = -146.407 + 841.8800 * em - 1629.014 * emsq + 1083.4350 * eoc;
  8415. g520 = -532.114 + 3017.977 * em - 5740.032 * emsq + 3708.2760 * eoc;
  8416. }
  8417. else {
  8418. g211 = -72.099 + 331.819 * em - 508.738 * emsq + 266.724 * eoc;
  8419. g310 = -346.844 + 1582.851 * em - 2415.925 * emsq + 1246.113 * eoc;
  8420. g322 = -342.585 + 1554.908 * em - 2366.899 * emsq + 1215.972 * eoc;
  8421. g410 = -1052.797 + 4758.686 * em - 7193.992 * emsq + 3651.957 * eoc;
  8422. g422 = -3581.690 + 16178.110 * em - 24462.770 * emsq + 12422.520 * eoc;
  8423. if (em > 0.715) {
  8424. g520 = -5149.66 + 29936.92 * em - 54087.36 * emsq + 31324.56 * eoc;
  8425. }
  8426. else {
  8427. g520 = 1464.74 - 4664.75 * em + 3763.64 * emsq;
  8428. }
  8429. }
  8430. if (em < 0.7) {
  8431. g533 = -919.22770 + 4988.6100 * em - 9064.7700 * emsq + 5542.21 * eoc;
  8432. g521 = -822.71072 + 4568.6173 * em - 8491.4146 * emsq + 5337.524 * eoc;
  8433. g532 = -853.66600 + 4690.2500 * em - 8624.7700 * emsq + 5341.4 * eoc;
  8434. }
  8435. else {
  8436. g533 = -37995.780 + 161616.52 * em - 229838.20 * emsq + 109377.94 * eoc;
  8437. g521 = -51752.104 + 218913.95 * em - 309468.16 * emsq + 146349.42 * eoc;
  8438. g532 = -40023.880 + 170470.89 * em - 242699.48 * emsq + 115605.82 * eoc;
  8439. }
  8440. ////
  8441. sini2 = sinim * sinim;
  8442. f220 = 0.75 * (1.0 + 2.0 * cosim + cosisq);
  8443. f221 = 1.5 * sini2;
  8444. f321 = 1.875 * sinim * (1.0 - 2.0 * cosim - 3.0 * cosisq);
  8445. f322 = -1.875 * sinim * (1.0 + 2.0 * cosim - 3.0 * cosisq);
  8446. f441 = 35.0 * sini2 * f220;
  8447. f442 = 39.3750 * sini2 * sini2;
  8448. f522 = 9.84375 * sinim * (sini2 * (1.0 - 2.0 * cosim - 5.0 * cosisq) +
  8449. 0.33333333 * (-2.0 + 4.0 * cosim + 6.0 * cosisq));
  8450. f523 = sinim * (4.92187512 * sini2 * (-2.0 - 4.0 * cosim +
  8451. 10.0 * cosisq) + 6.56250012 * (1.0 + 2.0 * cosim - 3.0 * cosisq));
  8452. f542 = 29.53125 * sinim * (2.0 - 8.0 * cosim + cosisq *
  8453. (-12.0 + 8.0 * cosim + 10.0 * cosisq));
  8454. f543 = 29.53125 * sinim * (-2.0 - 8.0 * cosim + cosisq *
  8455. (12.0 + 8.0 * cosim - 10.0 * cosisq));
  8456. xno2 = nm * nm;
  8457. ainv2 = aonv * aonv;
  8458. temp1 = 3.0 * xno2 * ainv2;
  8459. temp = temp1 * root22;
  8460. d2201 = temp * f220 * g201;
  8461. d2211 = temp * f221 * g211;
  8462. temp1 = temp1 * aonv;
  8463. temp = temp1 * root32;
  8464. d3210 = temp * f321 * g310;
  8465. d3222 = temp * f322 * g322;
  8466. temp1 = temp1 * aonv;
  8467. temp = 2.0 * temp1 * root44;
  8468. d4410 = temp * f441 * g410;
  8469. d4422 = temp * f442 * g422;
  8470. temp1 = temp1 * aonv;
  8471. temp = temp1 * root52;
  8472. d5220 = temp * f522 * g520;
  8473. d5232 = temp * f523 * g532;
  8474. temp = 2.0 * temp1 * root54;
  8475. d5421 = temp * f542 * g521;
  8476. d5433 = temp * f543 * g533;
  8477. xlamo = (mo + nodeo + nodeo - theta - theta) % twopi;
  8478. xfact = mdot + dmdt + 2.0 * (nodedot + dnodt - rptim) - no;
  8479. em = emo;
  8480. emsq = emsqo;
  8481. }
  8482. // /* ---------------- synchronous resonance terms -------------- */
  8483. if (irez === 1) {
  8484. g200 = 1.0 + emsq * (-2.5 + 0.8125 * emsq);
  8485. g310 = 1.0 + 2.0 * emsq;
  8486. g300 = 1.0 + emsq * (-6.0 + 6.60937 * emsq);
  8487. f220 = 0.75 * (1.0 + cosim) * (1.0 + cosim);
  8488. f311 = 0.9375 * sinim * sinim * (1.0 + 3.0 * cosim) - 0.75 * (1.0 + cosim);
  8489. f330 = 1.0 + cosim;
  8490. f330 = 1.875 * f330 * f330 * f330;
  8491. del1 = 3.0 * nm * nm * aonv * aonv;
  8492. del2 = 2.0 * del1 * f220 * g200 * q22;
  8493. del3 = 3.0 * del1 * f330 * g300 * q33 * aonv;
  8494. del1 = del1 * f311 * g310 * q31 * aonv;
  8495. xlamo = (mo + nodeo + argpo - theta) % twopi;
  8496. xfact = mdot + xpidot - rptim + dmdt + domdt + dnodt - no;
  8497. }
  8498. // /* ------------ for sgp4, initialize the integrator ---------- */
  8499. xli = xlamo;
  8500. xni = no;
  8501. atime = 0.0;
  8502. nm = no + dndt;
  8503. }
  8504. return [em, argpm, inclm, mm, nm, nodem, irez,
  8505. atime, d2201, d2211, d3210, d3222, d4410, d4422,
  8506. d5220, d5232, d5421, d5433, dedt, didt, dmdt,
  8507. dndt, dnodt, domdt, del1, del2, del3, xfact,
  8508. xlamo, xli, xni];
  8509. }
  8510. // dspace.js
  8511. function dspace(d2201, d2211, d3210, d3222, d4410, d4422, d5220,
  8512. d5232, d5421, d5433, dedt, del1, del2, del3,
  8513. didt, dmdt, dnodt, domdt, irez, argpo, argpdot,
  8514. t, tc, gsto, xfact, xlamo, no, atime,
  8515. em, argpm, inclm, xli, mm, xni, nodem,
  8516. nm) {
  8517. 'use strict';
  8518. var twopi = 2.0 * Math.PI,
  8519. fasx2 = 0.13130908,
  8520. fasx4 = 2.8843198,
  8521. fasx6 = 0.37448087,
  8522. g22 = 5.7686396,
  8523. g32 = 0.95240898,
  8524. g44 = 1.8014998,
  8525. g52 = 1.0508330,
  8526. g54 = 4.4108898,
  8527. rptim = 4.37526908801129966e-3,
  8528. stepp = 720.0,
  8529. stepn = -720.0,
  8530. step2 = 259200.0,
  8531. // /* ----------- calculate deep space resonance effects ----------- */
  8532. dndt = 0.0,
  8533. theta = (gsto + tc * rptim) % twopi,
  8534. // defined elsewhere
  8535. ft,
  8536. delt,
  8537. iretn, iret,
  8538. xndt, xldot, xnddt,
  8539. xomi, x2omi, x2li,
  8540. xl;
  8541. em = em + dedt * t;
  8542. inclm = inclm + didt * t;
  8543. argpm = argpm + domdt * t;
  8544. nodem = nodem + dnodt * t;
  8545. mm = mm + dmdt * t;
  8546. // // sgp4fix for negative inclinations
  8547. // // the following if statement should be commented out
  8548. // // if (inclm < 0.0)
  8549. // // {
  8550. // // inclm = -inclm;
  8551. // // argpm = argpm - pi;
  8552. // // nodem = nodem + pi;
  8553. // // }
  8554. // /* - update resonances : numerical (euler-maclaurin) integration - */
  8555. // /* ------------------------- epoch restart ---------------------- */
  8556. // // sgp4fix for propagator problems
  8557. // // the following integration works for negative time steps and periods
  8558. // // the specific changes are unknown because the original code was so convoluted
  8559. // // sgp4fix take out atime = 0.0 and fix for faster operation
  8560. ft = 0.0;
  8561. if (irez !== 0) {
  8562. // sgp4fix streamline check
  8563. if ((atime === 0.0) || (t * atime <= 0.0) || (Math.abs(t) < Math.abs(atime))) {
  8564. atime = 0.0;
  8565. xni = no;
  8566. xli = xlamo;
  8567. }
  8568. // sgp4fix move check outside loop
  8569. if (t >= 0.0) {
  8570. delt = stepp;
  8571. }
  8572. else {
  8573. delt = stepn;
  8574. }
  8575. iretn = 381; //// added for do loop
  8576. iret = 0; //// added for loop
  8577. while (iretn === 381) {
  8578. // /* ------------------- dot terms calculated ------------- */
  8579. // /* ----------- near - synchronous resonance terms ------- */
  8580. if (irez !== 2) {
  8581. xndt = del1 * Math.sin(xli - fasx2) + del2 * Math.sin(2.0 * (xli - fasx4)) +
  8582. del3 * Math.sin(3.0 * (xli - fasx6));
  8583. xldot = xni + xfact;
  8584. xnddt = del1 * Math.cos(xli - fasx2) +
  8585. 2.0 * del2 * Math.cos(2.0 * (xli - fasx4)) +
  8586. 3.0 * del3 * Math.cos(3.0 * (xli - fasx6));
  8587. xnddt = xnddt * xldot;
  8588. }
  8589. else {
  8590. // /* --------- near - half-day resonance terms -------- */
  8591. xomi = argpo + argpdot * atime;
  8592. x2omi = xomi + xomi;
  8593. x2li = xli + xli;
  8594. xndt =
  8595. d2201 * Math.sin(x2omi + xli - g22) + d2211 * Math.sin(xli - g22) +
  8596. d3210 * Math.sin(xomi + xli - g32) + d3222 * Math.sin(-xomi + xli - g32) +
  8597. d4410 * Math.sin(x2omi + x2li - g44) + d4422 * Math.sin(x2li - g44) +
  8598. d5220 * Math.sin(xomi + xli - g52) + d5232 * Math.sin(-xomi + xli - g52) +
  8599. d5421 * Math.sin(xomi + x2li - g54) + d5433 * Math.sin(-xomi + x2li - g54);
  8600. xldot = xni + xfact;
  8601. xnddt =
  8602. d2201 * Math.cos(x2omi + xli - g22) + d2211 * Math.cos(xli - g22) +
  8603. d3210 * Math.cos(xomi + xli - g32) + d3222 * Math.cos(-xomi + xli - g32) +
  8604. d5220 * Math.cos(xomi + xli - g52) + d5232 * Math.cos(-xomi + xli - g52) +
  8605. 2.0 * (d4410 * Math.cos(x2omi + x2li - g44) +
  8606. d4422 * Math.cos(x2li - g44) + d5421 * Math.cos(xomi + x2li - g54) +
  8607. d5433 * Math.cos(-xomi + x2li - g54));
  8608. xnddt = xnddt * xldot;
  8609. }
  8610. // /* ----------------------- integrator ------------------- */
  8611. // sgp4fix move end checks to end of routine
  8612. if (Math.abs(t - atime) >= stepp) {
  8613. iret = 0;
  8614. iretn = 381;
  8615. }
  8616. else {
  8617. ft = t - atime;
  8618. iretn = 0;
  8619. }
  8620. if (iretn === 381) {
  8621. xli = xli + xldot * delt + xndt * step2;
  8622. xni = xni + xndt * delt + xnddt * step2;
  8623. atime = atime + delt;
  8624. }
  8625. } // while iretn = 381
  8626. nm = xni + xndt * ft + xnddt * ft * ft * 0.5;
  8627. xl = xli + xldot * ft + xndt * ft * ft * 0.5;
  8628. if (irez !== 1) {
  8629. mm = xl - 2.0 * nodem + 2.0 * theta;
  8630. dndt = nm - no;
  8631. }
  8632. else {
  8633. mm = xl - nodem - argpm + theta;
  8634. dndt = nm - no;
  8635. }
  8636. nm = no + dndt;
  8637. }
  8638. return [atime, em, argpm, inclm, xli, mm, xni, nodem, dndt, nm];
  8639. }
  8640. // getgravc.js
  8641. function getgravc(whichconst) {
  8642. 'use strict';
  8643. var mu, radiusearthkm, xke, tumin, j2, j3, j4, j3oj2;
  8644. switch (whichconst) {
  8645. case 721:
  8646. // -- wgs-72 low precision str#3 constants --
  8647. mu = 398600.79964; // in km3 / s2
  8648. radiusearthkm = 6378.135; // km
  8649. xke = 0.0743669161;
  8650. tumin = 1.0 / xke;
  8651. j2 = 0.001082616;
  8652. j3 = -0.00000253881;
  8653. j4 = -0.00000165597;
  8654. j3oj2 = j3 / j2;
  8655. break;
  8656. case 72:
  8657. // ------------ wgs-72 constants ------------
  8658. mu = 398600.8; // in km3 / s2
  8659. radiusearthkm = 6378.135; // km
  8660. xke = 60.0 / Math.sqrt(radiusearthkm * radiusearthkm * radiusearthkm / mu);
  8661. tumin = 1.0 / xke;
  8662. j2 = 0.001082616;
  8663. j3 = -0.00000253881;
  8664. j4 = -0.00000165597;
  8665. j3oj2 = j3 / j2;
  8666. break;
  8667. case 84:
  8668. // ------------ wgs-84 constants ------------
  8669. mu = 398600.5; // in km3 / s2
  8670. radiusearthkm = 6378.137; // km
  8671. xke = 60.0 / Math.sqrt(radiusearthkm * radiusearthkm * radiusearthkm / mu);
  8672. tumin = 1.0 / xke;
  8673. j2 = 0.00108262998905;
  8674. j3 = -0.00000253215306;
  8675. j4 = -0.00000161098761;
  8676. j3oj2 = j3 / j2;
  8677. break;
  8678. default:
  8679. alert('getgravc: unknown gravity option: ' + whichconst);
  8680. throw new Error('getgravc: unknown gravity option: ' + whichconst);
  8681. }
  8682. return [tumin, mu, radiusearthkm, xke, j2, j3, j4, j3oj2];
  8683. }
  8684. // gstime.js
  8685. function gstime(jdut1) {
  8686. 'use strict';
  8687. var twopi = 2.0 * Math.PI,
  8688. deg2rad = Math.PI / 180.0,
  8689. tut1, temp;
  8690. // ------------------------ implementation ------------------
  8691. tut1 = (jdut1 - 2451545.0) / 36525.0;
  8692. temp = -6.2e-6 * tut1 * tut1 * tut1 + 0.093104 * tut1 * tut1 +
  8693. (876600.0 * 3600.0 + 8640184.812866) * tut1 + 67310.54841;
  8694. // 360/86400 = 1/240, to deg, to rad
  8695. temp = (temp * deg2rad / 240.0) % twopi;
  8696. // ------------------------ check quadrants --------------------
  8697. if (temp < 0.0) {
  8698. temp = temp + twopi;
  8699. }
  8700. return temp;
  8701. }
  8702. // initl.js
  8703. function initl(ecco, epoch, inclo, no, satn) {
  8704. 'use strict';
  8705. // /* -------------------- wgs-72 earth constants ----------------- */
  8706. // sgp4fix identify constants and allow alternate values
  8707. // MATLAB:
  8708. //global tumin mu radiusearthkm xke j2 j3 j4 j3oj2
  8709. // not used: tumin, mu, radiusearth, j3, j4, j3oj2
  8710. //global opsmode
  8711. if (typeof opsmode === 'undefined') {
  8712. throw new Error('opsmode undefined');
  8713. }
  8714. if (typeof xke === 'undefined') {
  8715. throw new Error('xke undefined');
  8716. }
  8717. if (typeof j2 === 'undefined') {
  8718. throw new Error('j2 undefined');
  8719. }
  8720. var x2o3 = 2.0 / 3.0,
  8721. // /* ------------- calculate auxillary epoch quantities ---------- */
  8722. eccsq = ecco * ecco,
  8723. omeosq = 1.0 - eccsq,
  8724. rteosq = Math.sqrt(omeosq),
  8725. cosio = Math.cos(inclo),
  8726. cosio2 = cosio * cosio,
  8727. // /* ------------------ un-kozai the mean motion ----------------- */
  8728. ak = Math.pow(xke / no, x2o3),
  8729. d1 = 0.75 * j2 * (3.0 * cosio2 - 1.0) / (rteosq * omeosq),
  8730. del = d1 / (ak * ak),
  8731. adel = ak * (1.0 - del * del - del *
  8732. (1.0 / 3.0 + 134.0 * del * del / 81.0)),
  8733. // defined elsewhere
  8734. ao, sinio, po, con42, con41, ainv, einv, posq, rp, method,
  8735. gsto, ts70, ids70, tfrac, c1, thgr70, fk5r, twopi, c1p2p;
  8736. del = d1 / (adel * adel);
  8737. no = no / (1.0 + del);
  8738. ao = Math.pow(xke / no, x2o3);
  8739. sinio = Math.sin(inclo);
  8740. po = ao * omeosq;
  8741. con42 = 1.0 - 5.0 * cosio2;
  8742. con41 = -con42 - cosio2 - cosio2;
  8743. ainv = 1.0 / ao;
  8744. einv = 1.0 / ecco;
  8745. posq = po * po;
  8746. rp = ao * (1.0 - ecco);
  8747. method = 'n';
  8748. // sgp4fix modern approach to finding sidereal time
  8749. if (opsmode !== 'a') {
  8750. gsto = gstime(epoch + 2433281.5); // EXTERNAL gstime()
  8751. }
  8752. else {
  8753. // sgp4fix use old way of finding gst
  8754. // count integer number of days from 0 jan 1970
  8755. ts70 = epoch - 7305.0;
  8756. ids70 = Math.floor(ts70 + 1.0e-8);
  8757. tfrac = ts70 - ids70;
  8758. // find greenwich location at epoch
  8759. c1 = 1.72027916940703639e-2;
  8760. thgr70 = 1.7321343856509374;
  8761. fk5r = 5.07551419432269442e-15;
  8762. twopi = 6.283185307179586;
  8763. c1p2p = c1 + twopi;
  8764. gsto = (thgr70 + c1 * ids70 + c1p2p * tfrac + ts70 * ts70 * fk5r) % twopi;
  8765. }
  8766. if (gsto < 0.0) {
  8767. gsto = gsto + twopi;
  8768. }
  8769. return [ainv, ao, con41, con42, cosio, cosio2, einv,
  8770. eccsq, method, omeosq, posq, rp, rteosq, sinio,
  8771. gsto, no];
  8772. }
  8773. // invjday.js
  8774. function invjday(jd) {
  8775. 'use strict';
  8776. // ----------------- find year and days of the year ---------------
  8777. var temp = jd - 2415019.5,
  8778. tu = temp / 365.25,
  8779. year = 1900 + Math.floor(tu),
  8780. leapyrs = Math.floor((year - 1901) * 0.25),
  8781. // days = temp - ((year-1900)*365.0 + leapyrs ) + 0.00000000001; // nudge by 8.64x10-7 sec to get even outputs
  8782. days = temp - ((year - 1900) * 365.0 + leapyrs),
  8783. mon, day, hr, min, sec,
  8784. rets;
  8785. // ------------ check for case of beginning of a year -------------
  8786. if (days < 1.0) {
  8787. year = year - 1;
  8788. leapyrs = Math.floor((year - 1901) * 0.25);
  8789. days = temp - ((year - 1900) * 365.0 + leapyrs);
  8790. }
  8791. // ------------------- find remaining data -----------------------
  8792. rets = days2mdh(year, days);
  8793. mon = rets.shift();
  8794. day = rets.shift();
  8795. hr = rets.shift();
  8796. min = rets.shift();
  8797. sec = rets.shift();
  8798. // sec= sec - 0.00000086400;
  8799. return [year, mon, day, hr, min, sec];
  8800. }
  8801. // jday.js
  8802. function jday(yr, mon, day, hr, min, sec) {
  8803. 'use strict';
  8804. return 367.0 * yr -
  8805. Math.floor((7 * (yr + Math.floor((mon + 9) / 12.0))) * 0.25) +
  8806. Math.floor(275 * mon / 9.0) +
  8807. day + 1721013.5 +
  8808. ((sec / 60.0 + min) / 60.0 + hr) / 24.0;
  8809. // - 0.5 * sign(100.0 * yr + mon - 190002.5) + 0.5;
  8810. }
  8811. // mag.js
  8812. function mag(vec) {
  8813. 'use strict';
  8814. var temp = vec[0] * vec[0] + vec[1] * vec[1] + vec[2] * vec[2],
  8815. mymag = 0.0;
  8816. if (Math.abs(temp) >= 1.0e-16) {
  8817. mymag = Math.sqrt(temp);
  8818. }
  8819. return mymag;
  8820. }
  8821. // math_utils.js
  8822. function sign(val) {
  8823. 'use strict';
  8824. if (val < 0) {
  8825. return -1;
  8826. }
  8827. if (val > 0) {
  8828. return 1;
  8829. }
  8830. return 0;
  8831. }
  8832. function cross(v1, v2) {
  8833. 'use strict';
  8834. // Return 3d cross product vector from two 3d vectors.
  8835. // http://knol.google.com/k/dot-product-cross-product-in-3d
  8836. // http://rosettacode.org/wiki/Vector_products
  8837. // Our vectors are represented as lists, for historical compatibility.
  8838. var x1 = v1[0],
  8839. y1 = v1[1],
  8840. z1 = v1[2],
  8841. x2 = v2[0],
  8842. y2 = v2[1],
  8843. z2 = v2[2];
  8844. return [y1 * z2 - y2 * z1, z1 * x2 - z2 * x1, x1 * y2 - x2 * y1];
  8845. }
  8846. function dot(a, b) {
  8847. 'use strict';
  8848. // Return a scalar dot product of two multidimensional vectors.
  8849. // http://c2.com/cgi/wiki?DotProductInManyProgrammingLanguages
  8850. var n = 0,
  8851. lim = Math.min(a.length, b.length),
  8852. i;
  8853. for (i = 0; i < lim; i += 1) {
  8854. n += a[i] * b[i];
  8855. }
  8856. return n;
  8857. }
  8858. // newtonu.js
  8859. function sinh(val) {
  8860. 'use strict';
  8861. return (Math.pow(Math.E, val) - Math.pow(Math.E, -val)) / 2;
  8862. }
  8863. function asinh(val) {
  8864. 'use strict';
  8865. return Math.log(val + Math.sqrt(val * val + 1));
  8866. }
  8867. function newtonnu(ecc, nu) {
  8868. 'use strict';
  8869. var e0 = 999999.9,
  8870. m = 999999.9,
  8871. small = 0.00000001,
  8872. sine, cose;
  8873. // --------------------------- circular ------------------------
  8874. if (Math.abs(ecc) < small) {
  8875. m = nu;
  8876. e0 = nu;
  8877. }
  8878. else {
  8879. // ---------------------- elliptical -----------------------
  8880. if (ecc < 1.0 - small) {
  8881. sine = (Math.sqrt(1.0 - ecc * ecc) * Math.sin(nu)) / (1.0 + ecc * Math.cos(nu));
  8882. cose = (ecc + Math.cos(nu)) / (1.0 + ecc * Math.cos(nu));
  8883. e0 = Math.atan2(sine, cose);
  8884. m = e0 - ecc * Math.sin(e0);
  8885. }
  8886. else {
  8887. // -------------------- hyperbolic --------------------
  8888. if (ecc > 1.0 + small) {
  8889. if ((ecc > 1.0) &&
  8890. (Math.abs(nu) + 0.00001 < Math.PI - Math.acos(1.0 / ecc))) {
  8891. sine = (Math.sqrt(ecc * ecc - 1.0) * Math.sin(nu)) / (1.0 + ecc * Math.cos(nu));
  8892. e0 = asinh(sine);
  8893. m = ecc * sinh(e0) - e0;
  8894. }
  8895. else {
  8896. // ----------------- parabolic ---------------------
  8897. if (Math.abs(nu) < 168.0 * Math.PI / 180.0) {
  8898. e0 = Math.tan(nu * 0.5);
  8899. m = e0 + (e0 * e0 * e0) / 3.0;
  8900. }
  8901. }
  8902. }
  8903. }
  8904. }
  8905. if (ecc < 1.0) {
  8906. m = m % (2.0 * Math.PI);
  8907. if (m < 0.0) {
  8908. m = m + 2.0 * Math.PI;
  8909. }
  8910. e0 = e0 % (2.0 * Math.PI);
  8911. }
  8912. return [e0, m];
  8913. }
  8914. // rv2coe.js
  8915. function rv2coe(r, v, mu) {
  8916. 'use strict';
  8917. // ------------------------- implementation -----------------
  8918. var magr, magv,
  8919. // ------------------ find h n and e vectors ----------------
  8920. hbar, // hbar is a vector
  8921. magh,
  8922. nbar = [],
  8923. magn, c1, rdotv,
  8924. ebar = [],
  8925. i, ecc, sme, a, p, hk, incl,
  8926. typeorbit,
  8927. temp, omega, argp,
  8928. nu, arglat, m, lonper,
  8929. truelon, em;
  8930. magr = mag(r);
  8931. magv = mag(v);
  8932. // ------------------ find h n and e vectors ----------------
  8933. hbar = cross(r, v); // hbar is a vector
  8934. magh = mag(hbar);
  8935. if (magh > small) {
  8936. nbar[0] = - hbar[1];
  8937. nbar[1] = hbar[0];
  8938. nbar[2] = 0.0;
  8939. magn = mag(nbar);
  8940. c1 = magv * magv - mu / magr;
  8941. rdotv = dot(r, v);
  8942. for (i in [0, 1, 2]) {
  8943. ebar[i] = (c1 * r[i] - rdotv * v[i]) / mu;
  8944. }
  8945. ecc = mag(ebar);
  8946. // ------------ find a e and semi-latus rectum ----------
  8947. sme = (magv * magv * 0.5) - (mu / magr);
  8948. if (Math.abs(sme) > small) {
  8949. a = -mu / (2.0 * sme);
  8950. }
  8951. else {
  8952. a = infinite;
  8953. }
  8954. p = magh * magh / mu;
  8955. // ----------------- find inclination -------------------
  8956. hk = hbar[2] / magh;
  8957. incl = Math.acos(hk);
  8958. // -------- determine type of orbit for later use --------
  8959. // ------ elliptical, parabolic, hyperbolic inclined -------
  8960. typeorbit = 'ei';
  8961. if (ecc < small) {
  8962. alert('ecc<small');
  8963. // ---------------- circular equatorial ---------------
  8964. if ((incl < small) || (Math.abs(incl - Math.PI) < small)) {
  8965. typeorbit = 'ce';
  8966. }
  8967. else {
  8968. // -------------- circular inclined ---------------
  8969. typeorbit = 'ci';
  8970. }
  8971. }
  8972. else {
  8973. // - elliptical, parabolic, hyperbolic equatorial --
  8974. if ((incl < small) || (Math.abs(incl - Math.PI) < small)) {
  8975. alert('eliptical/para/hyper: type=ee');
  8976. typeorbit = 'ee';
  8977. }
  8978. }
  8979. // ---------- find longitude of ascending node ------------
  8980. if (magn > small) {
  8981. temp = nbar[0] / magn;
  8982. if (Math.abs(temp) > 1.0) {
  8983. temp = sign(temp);
  8984. }
  8985. omega = Math.acos(temp);
  8986. if (nbar[1] < 0.0) {
  8987. omega = twopi - omega;
  8988. }
  8989. }
  8990. else {
  8991. alert('omega=UNDEFINED');
  8992. omega = UNDEFINED;
  8993. }
  8994. // ---------------- find argument of perigee ---------------
  8995. if (typeorbit === 'ei') {
  8996. argp = angl(nbar, ebar);
  8997. if (ebar[2] < 0.0) {
  8998. argp = twopi - argp;
  8999. }
  9000. }
  9001. else {
  9002. alert('argp=UNDEFINED');
  9003. argp = UNDEFINED;
  9004. }
  9005. // ------------ find true anomaly at epoch -------------
  9006. if (typeorbit[0] === 'e') {
  9007. nu = angl(ebar, r);
  9008. if (rdotv < 0.0) {
  9009. nu = twopi - nu;
  9010. }
  9011. }
  9012. else {
  9013. alert('nu=UNDEFINED');
  9014. nu = UNDEFINED;
  9015. }
  9016. // ---- find argument of latitude - circular inclined -----
  9017. if (typeorbit === 'ci') {
  9018. arglat = angl(nbar, r);
  9019. if (r[2] < 0.0) {
  9020. arglat = twopi - arglat;
  9021. }
  9022. m = arglat;
  9023. }
  9024. else {
  9025. //alert("arglat=UNDEFINED");
  9026. arglat = UNDEFINED;
  9027. }
  9028. // -- find longitude of perigee - elliptical equatorial ----
  9029. if ((ecc > small) && (typeorbit === 'ee')) {
  9030. temp = ebar[0] / ecc;
  9031. if (Math.abs(temp) > 1.0) {
  9032. temp = sign(temp);
  9033. }
  9034. lonper = Math.acos(temp);
  9035. if (ebar[1] < 0.0) {
  9036. lonper = twopi - lonper;
  9037. }
  9038. if (incl > halfpi) {
  9039. lonper = twopi - lonper;
  9040. }
  9041. }
  9042. else {
  9043. //alert("lonper=UNDEFINED");
  9044. lonper = UNDEFINED;
  9045. }
  9046. // -------- find true longitude - circular equatorial ------
  9047. if ((magr > small) && (typeorbit === 'ce')) {
  9048. temp = r[0] / magr;
  9049. if (Math.abs(temp) > 1.0) {
  9050. temp = sign(temp);
  9051. }
  9052. truelon = Math.acos(temp);
  9053. if (r[1] < 0.0) {
  9054. truelon = twopi - truelon;
  9055. }
  9056. if (incl > halfpi) {
  9057. truelon = twopi - truelon;
  9058. }
  9059. m = truelon;
  9060. }
  9061. else {
  9062. //alert("truelon=UNDEFINED");
  9063. truelon = UNDEFINED;
  9064. }
  9065. // ------------ find mean anomaly for all orbits -----------
  9066. if (typeorbit[0] === 'e') {
  9067. //[e, m] = newtonnu(ecc,nu ); // e is undefined, but unused
  9068. em = newtonnu(ecc, nu);
  9069. m = em[1];
  9070. }
  9071. }
  9072. else { // magh <= small
  9073. p = UNDEFINED;
  9074. a = UNDEFINED;
  9075. ecc = UNDEFINED;
  9076. incl = UNDEFINED;
  9077. omega = UNDEFINED;
  9078. argp = UNDEFINED;
  9079. nu = UNDEFINED;
  9080. m = UNDEFINED;
  9081. arglat = UNDEFINED;
  9082. truelon = UNDEFINED;
  9083. lonper = UNDEFINED;
  9084. }
  9085. return [p, a, ecc, incl, omega, argp, nu, m, arglat, truelon, lonper];
  9086. }
  9087. // sgp4.js
  9088. function sgp4(satrec, tsince) {
  9089. 'use strict';
  9090. // /* ------------------ set mathematical constants --------------- */
  9091. var twopi = 2.0 * Math.PI,
  9092. x2o3 = 2.0 / 3.0,
  9093. // sgp4fix divisor for divide by zero check on inclination
  9094. // the old check used 1.0 + Math.cos(pi-1.0e-9), but then compared it to
  9095. // 1.5 e-12, so the threshold was changed to 1.5e-12 for consistancy
  9096. temp4 = 1.5e-12,
  9097. // sgp4fix identify constants and allow alternate values
  9098. // TODO: global tumin mu radiusearthkm xke j2 j3 j4 j3oj2
  9099. rets, tumin, mu, radiusearthkm, xke, j2, j3, j4, j3oj2,
  9100. vkmpersec,
  9101. xmdf, argpdf, nodedf, argpm, mm, t2, nodem, tempa, tempe, templ,
  9102. delomg, delm, temp, t3, t4, temp3,
  9103. nm, em, inclm, tc, dndt, am,
  9104. xm, emsq, sl,
  9105. xlm, sinim, cosim, ep, xincp, argpp, nodep, mp, sinip, cosip,
  9106. axnl, aynl, xl, u, eo1, tem5, ktr, sineo1, coseo1,
  9107. ecose, esine, el2, pl,
  9108. r = [],
  9109. v = [],
  9110. rl, rdotl, rvdotl, betal, sinu, cosu, su, sin2u, cos2u, temp1, temp2,
  9111. cosisq, mrt, xnode, xinc, mvt, rvdot,
  9112. sinsu, cossu, snod, cnod, sini, cosi, xmx, xmy, ux, uy, uz, vx, vy, vz;
  9113. // TODO: how do we get `whichconst` from the caller? or (shudder) globals?
  9114. rets = getgravc(72); // TODO: sucks to have to call this all the time
  9115. tumin = rets.shift();
  9116. mu = rets.shift();
  9117. radiusearthkm = rets.shift();
  9118. xke = rets.shift();
  9119. j2 = rets.shift();
  9120. j3 = rets.shift();
  9121. j4 = rets.shift();
  9122. j3oj2 = rets.shift();
  9123. vkmpersec = radiusearthkm * xke / 60.0;
  9124. // /* --------------------- clear sgp4 error flag ----------------- */
  9125. //satrec.t = tsince/1440;
  9126. satrec.t = tsince;
  9127. satrec.error = 0;
  9128. // /* ------- update for secular gravity and atmospheric drag ----- */
  9129. xmdf = satrec.mo + satrec.mdot * satrec.t;
  9130. argpdf = satrec.argpo + satrec.argpdot * satrec.t;
  9131. nodedf = satrec.nodeo + satrec.nodedot * satrec.t;
  9132. argpm = argpdf;
  9133. mm = xmdf;
  9134. t2 = satrec.t * satrec.t;
  9135. nodem = nodedf + satrec.nodecf * t2;
  9136. tempa = 1.0 - satrec.cc1 * satrec.t;
  9137. tempe = satrec.bstar * satrec.cc4 * satrec.t;
  9138. templ = satrec.t2cof * t2;
  9139. if (satrec.isimp !== 1) {
  9140. delomg = satrec.omgcof * satrec.t;
  9141. delm = satrec.xmcof *
  9142. (Math.pow(1.0 + satrec.eta * Math.cos(xmdf), 3) -
  9143. satrec.delmo);
  9144. temp = delomg + delm;
  9145. mm = xmdf + temp;
  9146. argpm = argpdf - temp;
  9147. t3 = t2 * satrec.t;
  9148. t4 = t3 * satrec.t;
  9149. tempa = tempa - satrec.d2 * t2 - satrec.d3 * t3 - satrec.d4 * t4;
  9150. tempe = tempe + satrec.bstar * satrec.cc5 * (Math.sin(mm) - satrec.sinmao);
  9151. templ = templ + satrec.t3cof * t3 + t4 * (satrec.t4cof +
  9152. satrec.t * satrec.t5cof);
  9153. }
  9154. nm = satrec.no;
  9155. em = satrec.ecco;
  9156. inclm = satrec.inclo;
  9157. if (satrec.method === 'd') {
  9158. tc = satrec.t;
  9159. rets = dspace(satrec.d2201, satrec.d2211, satrec.d3210,
  9160. satrec.d3222, satrec.d4410, satrec.d4422,
  9161. satrec.d5220, satrec.d5232, satrec.d5421,
  9162. satrec.d5433, satrec.dedt, satrec.del1,
  9163. satrec.del2, satrec.del3, satrec.didt,
  9164. satrec.dmdt, satrec.dnodt, satrec.domdt,
  9165. satrec.irez, satrec.argpo, satrec.argpdot, satrec.t,
  9166. tc, satrec.gsto, satrec.xfact, satrec.xlamo, satrec.no,
  9167. satrec.atime, em, argpm, inclm, satrec.xli, mm,
  9168. satrec.xni, nodem, nm);
  9169. satrec.atime = rets.shift();
  9170. em = rets.shift();
  9171. argpm = rets.shift();
  9172. inclm = rets.shift();
  9173. satrec.xli = rets.shift();
  9174. mm = rets.shift();
  9175. satrec.xni = rets.shift();
  9176. nodem = rets.shift();
  9177. dndt = rets.shift();
  9178. nm = rets.shift();
  9179. } // if method = d
  9180. if (nm <= 0.0) {
  9181. // fprintf(1,'# error nm //f\n', nm);
  9182. satrec.error = 2;
  9183. }
  9184. am = Math.pow(xke / nm, x2o3) * tempa * tempa;
  9185. nm = xke / Math.pow(am, 1.5);
  9186. em = em - tempe;
  9187. // fix tolerance for error recognition
  9188. if ((em >= 1.0) || (em < -0.001) || (am < 0.95)) {
  9189. //fprintf(1,'# error em //f\n', em);
  9190. satrec.error = 1;
  9191. }
  9192. // sgp4fix change test condition for eccentricity
  9193. if (em < 1.0e-6) {
  9194. em = 1.0e-6;
  9195. }
  9196. mm = mm + satrec.no * templ;
  9197. xlm = mm + argpm + nodem;
  9198. emsq = em * em;
  9199. temp = 1.0 - emsq;
  9200. nodem = nodem % twopi;
  9201. argpm = argpm % twopi;
  9202. xlm = xlm % twopi;
  9203. mm = (xlm - argpm - nodem) % twopi;
  9204. // /* ----------------- compute extra mean quantities ------------- */
  9205. sinim = Math.sin(inclm);
  9206. cosim = Math.cos(inclm);
  9207. // /* -------------------- add lunar-solar periodics -------------- */
  9208. ep = em;
  9209. xincp = inclm;
  9210. argpp = argpm;
  9211. nodep = nodem;
  9212. mp = mm;
  9213. sinip = sinim;
  9214. cosip = cosim;
  9215. if (satrec.method === 'd') {
  9216. rets = dpper(satrec.e3, satrec.ee2, satrec.peo,
  9217. satrec.pgho, satrec.pho, satrec.pinco,
  9218. satrec.plo, satrec.se2, satrec.se3,
  9219. satrec.sgh2, satrec.sgh3, satrec.sgh4,
  9220. satrec.sh2, satrec.sh3, satrec.si2,
  9221. satrec.si3, satrec.sl2, satrec.sl3,
  9222. satrec.sl4, satrec.t, satrec.xgh2,
  9223. satrec.xgh3, satrec.xgh4, satrec.xh2,
  9224. satrec.xh3, satrec.xi2, satrec.xi3,
  9225. satrec.xl2, satrec.xl3, satrec.xl4,
  9226. satrec.zmol, satrec.zmos, satrec.inclo,
  9227. satrec.init, ep, xincp, nodep, argpp, mp);
  9228. ep = rets.shift();
  9229. xincp = rets.shift();
  9230. nodep = rets.shift();
  9231. argpp = rets.shift();
  9232. mp = rets.shift();
  9233. if (xincp < 0.0) {
  9234. xincp = -xincp;
  9235. nodep = nodep + Math.PI;
  9236. argpp = argpp - Math.PI;
  9237. }
  9238. if ((ep < 0.0) || (ep > 1.0)) {
  9239. //fprintf(1,'# error ep //f\n', ep);
  9240. satrec.error = 3;
  9241. }
  9242. } // if method = d
  9243. // /* -------------------- long period periodics ------------------ */
  9244. if (satrec.method === 'd') {
  9245. sinip = Math.sin(xincp);
  9246. cosip = Math.cos(xincp);
  9247. satrec.aycof = -0.5 * j3oj2 * sinip;
  9248. // sgp4fix for divide by zero with xinco = 180 deg
  9249. if (Math.abs(cosip + 1.0) > 1.5e-12) {
  9250. satrec.xlcof = -0.25 * j3oj2 * sinip * (3.0 + 5.0 * cosip) / (1.0 + cosip);
  9251. }
  9252. else {
  9253. satrec.xlcof = -0.25 * j3oj2 * sinip * (3.0 + 5.0 * cosip) / temp4;
  9254. }
  9255. }
  9256. axnl = ep * Math.cos(argpp);
  9257. temp = 1.0 / (am * (1.0 - ep * ep));
  9258. aynl = ep * Math.sin(argpp) + temp * satrec.aycof;
  9259. xl = mp + argpp + nodep + temp * satrec.xlcof * axnl;
  9260. // /* --------------------- solve kepler's equation --------------- */
  9261. u = (xl - nodep) % twopi;
  9262. eo1 = u;
  9263. tem5 = 9999.9;
  9264. ktr = 1;
  9265. // sgp4fix for kepler iteration
  9266. // the following iteration needs better limits on corrections
  9267. while ((Math.abs(tem5) >= 1.0e-12) && (ktr <= 10)) {
  9268. sineo1 = Math.sin(eo1);
  9269. coseo1 = Math.cos(eo1);
  9270. tem5 = 1.0 - coseo1 * axnl - sineo1 * aynl;
  9271. tem5 = (u - aynl * coseo1 + axnl * sineo1 - eo1) / tem5;
  9272. if (Math.abs(tem5) >= 0.95) {
  9273. if (tem5 > 0.0) {
  9274. tem5 = 0.95;
  9275. }
  9276. else {
  9277. tem5 = -0.95;
  9278. }
  9279. }
  9280. eo1 = eo1 + tem5;
  9281. ktr = ktr + 1;
  9282. }
  9283. // /* ------------- short period preliminary quantities ----------- */
  9284. ecose = axnl * coseo1 + aynl * sineo1;
  9285. esine = axnl * sineo1 - aynl * coseo1;
  9286. el2 = axnl * axnl + aynl * aynl;
  9287. pl = am * (1.0 - el2);
  9288. if (pl < 0.0) {
  9289. //fprintf(1,'# error pl //f\n', pl);
  9290. satrec.error = 4;
  9291. // WTF is this in MATLAB? ';' makes it columnar array
  9292. // r = [0;0;0];
  9293. // v = [0;0;0];
  9294. r = [0, 0, 0];
  9295. v = [0, 0, 0];
  9296. }
  9297. else {
  9298. rl = am * (1.0 - ecose);
  9299. rdotl = Math.sqrt(am) * esine / rl;
  9300. rvdotl = Math.sqrt(pl) / rl;
  9301. betal = Math.sqrt(1.0 - el2);
  9302. temp = esine / (1.0 + betal);
  9303. sinu = am / rl * (sineo1 - aynl - axnl * temp);
  9304. cosu = am / rl * (coseo1 - axnl + aynl * temp);
  9305. su = Math.atan2(sinu, cosu);
  9306. sin2u = (cosu + cosu) * sinu;
  9307. cos2u = 1.0 - 2.0 * sinu * sinu;
  9308. temp = 1.0 / pl;
  9309. temp1 = 0.5 * j2 * temp;
  9310. temp2 = temp1 * temp;
  9311. // /* -------------- update for short period periodics ------------ */
  9312. if (satrec.method === 'd') {
  9313. cosisq = cosip * cosip;
  9314. satrec.con41 = 3.0 * cosisq - 1.0;
  9315. satrec.x1mth2 = 1.0 - cosisq;
  9316. satrec.x7thm1 = 7.0 * cosisq - 1.0;
  9317. }
  9318. mrt = rl * (1.0 - 1.5 * temp2 * betal * satrec.con41) +
  9319. 0.5 * temp1 * satrec.x1mth2 * cos2u;
  9320. su = su - 0.25 * temp2 * satrec.x7thm1 * sin2u;
  9321. xnode = nodep + 1.5 * temp2 * cosip * sin2u;
  9322. xinc = xincp + 1.5 * temp2 * cosip * sinip * cos2u;
  9323. mvt = rdotl - nm * temp1 * satrec.x1mth2 * sin2u / xke;
  9324. rvdot = rvdotl + nm * temp1 * (satrec.x1mth2 * cos2u +
  9325. 1.5 * satrec.con41) / xke;
  9326. // /* --------------------- orientation vectors ------------------- */
  9327. sinsu = Math.sin(su);
  9328. cossu = Math.cos(su);
  9329. snod = Math.sin(xnode);
  9330. cnod = Math.cos(xnode);
  9331. sini = Math.sin(xinc);
  9332. cosi = Math.cos(xinc);
  9333. xmx = -snod * cosi;
  9334. xmy = cnod * cosi;
  9335. ux = xmx * sinsu + cnod * cossu;
  9336. uy = xmy * sinsu + snod * cossu;
  9337. uz = sini * sinsu;
  9338. vx = xmx * cossu - cnod * sinsu;
  9339. vy = xmy * cossu - snod * sinsu;
  9340. vz = sini * cossu;
  9341. // /* --------- position and velocity (in km and km/sec) ---------- */
  9342. r[0] = (mrt * ux) * radiusearthkm;
  9343. r[1] = (mrt * uy) * radiusearthkm;
  9344. r[2] = (mrt * uz) * radiusearthkm;
  9345. v[0] = (mvt * ux + rvdot * vx) * vkmpersec;
  9346. v[1] = (mvt * uy + rvdot * vy) * vkmpersec;
  9347. v[2] = (mvt * uz + rvdot * vz) * vkmpersec;
  9348. }// if pl > 0
  9349. // sgp4fix for decaying satellites
  9350. if (mrt < 1.0) {
  9351. // printf("# decay condition //11.6f \n",mrt);
  9352. satrec.error = 6;
  9353. }
  9354. return [satrec, r, v];
  9355. }
  9356. // sgp4init.js
  9357. function sgp4init(whichconst, satrec, xbstar, xecco, epoch,
  9358. xargpo, xinclo, xmo, xno, xnodeo) {
  9359. 'use strict';
  9360. var gravc, tumin, mu, radiusearthkm, xke, j2, j3, j4, j3oj2,
  9361. ss, qzms2t, x2o3, temp4, foo,
  9362. ainv, ao, con42, cosio, cosio2, einv, eccsq, omeosq, posq, rp, rteosq, sinio,
  9363. sfour, qzms24, perige, pinvsq, tsi, etasq, eeta, psisq, coef, coef1, cc2, cc3,
  9364. cosio4, temp1, temp2, temp3, xhdot1, xpidot,
  9365. tc, inclm,
  9366. dscomvars, sinim, cosim, sinomm, cosomm, snodm, cnodm, day, em, emsq, gam, rtemsq,
  9367. s1, s2, s3, s4, s5, s6, s7, ss1, ss2, ss3, ss4, ss5, ss6, ss7,
  9368. sz1, sz2, sz3, sz11, sz12, sz13, sz21, sz22, sz23, sz31, sz32, sz33,
  9369. nm, z1, z2, z3, z11, z12, z13, z21, z22, z23, z31, z32, z33,
  9370. rets,
  9371. argpm, nodem, mm,
  9372. dndt,
  9373. cc1sq, temp,
  9374. r, v;
  9375. // /* ------------------------ initialization --------------------- */
  9376. // /* ----------- set all near earth variables to zero ------------ */
  9377. satrec.isimp = 0;
  9378. satrec.method = 'n';
  9379. satrec.aycof = 0.0;
  9380. satrec.con41 = 0.0;
  9381. satrec.cc1 = 0.0;
  9382. satrec.cc4 = 0.0;
  9383. satrec.cc5 = 0.0;
  9384. satrec.d2 = 0.0;
  9385. satrec.d3 = 0.0;
  9386. satrec.d4 = 0.0;
  9387. satrec.delmo = 0.0;
  9388. satrec.eta = 0.0;
  9389. satrec.argpdot = 0.0;
  9390. satrec.omgcof = 0.0;
  9391. satrec.sinmao = 0.0;
  9392. satrec.t = 0.0;
  9393. satrec.t2cof = 0.0;
  9394. satrec.t3cof = 0.0;
  9395. satrec.t4cof = 0.0;
  9396. satrec.t5cof = 0.0;
  9397. satrec.x1mth2 = 0.0;
  9398. satrec.x7thm1 = 0.0;
  9399. satrec.mdot = 0.0;
  9400. satrec.nodedot = 0.0;
  9401. satrec.xlcof = 0.0;
  9402. satrec.xmcof = 0.0;
  9403. satrec.nodecf = 0.0;
  9404. // /* ----------- set all deep space variables to zero ------------ */
  9405. satrec.irez = 0;
  9406. satrec.d2201 = 0.0;
  9407. satrec.d2211 = 0.0;
  9408. satrec.d3210 = 0.0;
  9409. satrec.d3222 = 0.0;
  9410. satrec.d4410 = 0.0;
  9411. satrec.d4422 = 0.0;
  9412. satrec.d5220 = 0.0;
  9413. satrec.d5232 = 0.0;
  9414. satrec.d5421 = 0.0;
  9415. satrec.d5433 = 0.0;
  9416. satrec.dedt = 0.0;
  9417. satrec.del1 = 0.0;
  9418. satrec.del2 = 0.0;
  9419. satrec.del3 = 0.0;
  9420. satrec.didt = 0.0;
  9421. satrec.dmdt = 0.0;
  9422. satrec.dnodt = 0.0;
  9423. satrec.domdt = 0.0;
  9424. satrec.e3 = 0.0;
  9425. satrec.ee2 = 0.0;
  9426. satrec.peo = 0.0;
  9427. satrec.pgho = 0.0;
  9428. satrec.pho = 0.0;
  9429. satrec.pinco = 0.0;
  9430. satrec.plo = 0.0;
  9431. satrec.se2 = 0.0;
  9432. satrec.se3 = 0.0;
  9433. satrec.sgh2 = 0.0;
  9434. satrec.sgh3 = 0.0;
  9435. satrec.sgh4 = 0.0;
  9436. satrec.sh2 = 0.0;
  9437. satrec.sh3 = 0.0;
  9438. satrec.si2 = 0.0;
  9439. satrec.si3 = 0.0;
  9440. satrec.sl2 = 0.0;
  9441. satrec.sl3 = 0.0;
  9442. satrec.sl4 = 0.0;
  9443. satrec.gsto = 0.0;
  9444. satrec.xfact = 0.0;
  9445. satrec.xgh2 = 0.0;
  9446. satrec.xgh3 = 0.0;
  9447. satrec.xgh4 = 0.0;
  9448. satrec.xh2 = 0.0;
  9449. satrec.xh3 = 0.0;
  9450. satrec.xi2 = 0.0;
  9451. satrec.xi3 = 0.0;
  9452. satrec.xl2 = 0.0;
  9453. satrec.xl3 = 0.0;
  9454. satrec.xl4 = 0.0;
  9455. satrec.xlamo = 0.0;
  9456. satrec.zmol = 0.0;
  9457. satrec.zmos = 0.0;
  9458. satrec.atime = 0.0;
  9459. satrec.xli = 0.0;
  9460. satrec.xni = 0.0;
  9461. // sgp4fix - note the following variables are also passed directly via satrec.
  9462. // it is possible to streamline the sgp4init call by deleting the "x"
  9463. // variables, but the user would need to set the satrec.* values first. we
  9464. // include the additional assignment in case twoline2rv is not used.
  9465. satrec.bstar = xbstar;
  9466. satrec.ecco = xecco;
  9467. satrec.argpo = xargpo;
  9468. satrec.inclo = xinclo;
  9469. satrec.mo = xmo;
  9470. satrec.no = xno;
  9471. satrec.nodeo = xnodeo;
  9472. // /* -------------------- wgs-72 earth constants ----------------- */
  9473. // // sgp4fix identify constants and allow alternate values
  9474. // [tumin, mu, radiusearthkm, xke, j2, j3, j4, j3oj2] = getgravc( whichconst );
  9475. rets = getgravc(whichconst);
  9476. tumin = rets.shift();
  9477. mu = rets.shift();
  9478. radiusearthkm = rets.shift();
  9479. xke = rets.shift();
  9480. j2 = rets.shift();
  9481. j3 = rets.shift();
  9482. j4 = rets.shift();
  9483. j3oj2 = rets.shift();
  9484. ss = 78.0 / radiusearthkm + 1.0;
  9485. qzms2t = Math.pow((120.0 - 78.0) / radiusearthkm, 4);
  9486. x2o3 = 2.0 / 3.0;
  9487. // sgp4fix divisor for divide by zero check on inclination
  9488. // the old check used 1.0 + cos(pi-1.0e-9), but then compared it to
  9489. // 1.5 e-12, so the threshold was changed to 1.5e-12 for consistancy
  9490. temp4 = 1.5e-12;
  9491. satrec.init = 'y';
  9492. satrec.t = 0.0;
  9493. // [ainv, ao, satrec.con41, con42, cosio, cosio2, einv, eccsq,
  9494. // satrec.method, omeosq, posq, rp, rteosq, sinio,
  9495. // satrec.gsto, satrec.no]
  9496. rets = initl(satrec.ecco, epoch, satrec.inclo, satrec.no, satrec.satnum);
  9497. ainv = rets.shift();
  9498. ao = rets.shift();
  9499. satrec.con41 = rets.shift();
  9500. con42 = rets.shift();
  9501. cosio = rets.shift();
  9502. cosio2 = rets.shift();
  9503. einv = rets.shift();
  9504. eccsq = rets.shift();
  9505. satrec.method = rets.shift();
  9506. omeosq = rets.shift();
  9507. posq = rets.shift();
  9508. rp = rets.shift();
  9509. rteosq = rets.shift();
  9510. sinio = rets.shift();
  9511. satrec.gsto = rets.shift();
  9512. satrec.no = rets.shift();
  9513. satrec.error = 0;
  9514. if (rp < 1.0) {
  9515. // printf("# *** satn//d epoch elts sub-orbital ***\n" = rets[]; satn);
  9516. satrec.error = 5;
  9517. }
  9518. if ((omeosq >= 0.0) || (satrec.no >= 0.0)) {
  9519. satrec.isimp = 0;
  9520. if (rp < (220.0 / radiusearthkm + 1.0)) {
  9521. satrec.isimp = 1;
  9522. }
  9523. sfour = ss;
  9524. qzms24 = qzms2t;
  9525. perige = (rp - 1.0) * radiusearthkm;
  9526. // /* - for perigees below 156 km, s and qoms2t are altered - */
  9527. if (perige < 156.0) {
  9528. sfour = perige - 78.0;
  9529. if (perige < 98.0) {
  9530. sfour = 20.0;
  9531. }
  9532. qzms24 = Math.pow((120.0 - sfour) / radiusearthkm, 4.0);
  9533. sfour = sfour / radiusearthkm + 1.0;
  9534. }
  9535. pinvsq = 1.0 / posq;
  9536. tsi = 1.0 / (ao - sfour);
  9537. satrec.eta = ao * satrec.ecco * tsi;
  9538. etasq = satrec.eta * satrec.eta;
  9539. eeta = satrec.ecco * satrec.eta;
  9540. psisq = Math.abs(1.0 - etasq);
  9541. coef = qzms24 * Math.pow(tsi, 4.0);
  9542. coef1 = coef / Math.pow(psisq, 3.5);
  9543. cc2 = coef1 * satrec.no * (ao * (1.0 + 1.5 * etasq + eeta *
  9544. (4.0 + etasq)) + 0.375 * j2 * tsi / psisq * satrec.con41 *
  9545. (8.0 + 3.0 * etasq * (8.0 + etasq)));
  9546. satrec.cc1 = satrec.bstar * cc2;
  9547. cc3 = 0.0;
  9548. if (satrec.ecco > 1.0e-4) {
  9549. cc3 = -2.0 * coef * tsi * j3oj2 * satrec.no * sinio / satrec.ecco;
  9550. }
  9551. satrec.x1mth2 = 1.0 - cosio2;
  9552. satrec.cc4 = 2.0 * satrec.no * coef1 * ao * omeosq *
  9553. (satrec.eta * (2.0 + 0.5 * etasq) + satrec.ecco *
  9554. (0.5 + 2.0 * etasq) - j2 * tsi / (ao * psisq) *
  9555. (-3.0 * satrec.con41 * (1.0 - 2.0 * eeta + etasq *
  9556. (1.5 - 0.5 * eeta)) + 0.75 * satrec.x1mth2 *
  9557. (2.0 * etasq - eeta * (1.0 + etasq)) * Math.cos(2.0 * satrec.argpo)));
  9558. satrec.cc5 = 2.0 * coef1 * ao * omeosq * (1.0 + 2.75 *
  9559. (etasq + eeta) + eeta * etasq);
  9560. cosio4 = cosio2 * cosio2;
  9561. temp1 = 1.5 * j2 * pinvsq * satrec.no;
  9562. temp2 = 0.5 * temp1 * j2 * pinvsq;
  9563. temp3 = -0.46875 * j4 * pinvsq * pinvsq * satrec.no;
  9564. satrec.mdot = satrec.no + 0.5 * temp1 * rteosq * satrec.con41 +
  9565. 0.0625 * temp2 * rteosq * (13.0 - 78.0 * cosio2 + 137.0 * cosio4);
  9566. satrec.argpdot = -0.5 * temp1 * con42 + 0.0625 * temp2 *
  9567. (7.0 - 114.0 * cosio2 + 395.0 * cosio4) +
  9568. temp3 * (3.0 - 36.0 * cosio2 + 49.0 * cosio4);
  9569. xhdot1 = -temp1 * cosio;
  9570. satrec.nodedot = xhdot1 + (0.5 * temp2 * (4.0 - 19.0 * cosio2) +
  9571. 2.0 * temp3 * (3.0 - 7.0 * cosio2)) * cosio;
  9572. xpidot = satrec.argpdot + satrec.nodedot;
  9573. satrec.omgcof = satrec.bstar * cc3 * Math.cos(satrec.argpo);
  9574. satrec.xmcof = 0.0;
  9575. if (satrec.ecco > 1.0e-4) {
  9576. satrec.xmcof = -x2o3 * coef * satrec.bstar / eeta;
  9577. }
  9578. satrec.nodecf = 3.5 * omeosq * xhdot1 * satrec.cc1;
  9579. satrec.t2cof = 1.5 * satrec.cc1;
  9580. // sgp4fix for divide by zero with xinco = 180 deg
  9581. if (Math.abs(cosio + 1.0) > 1.5e-12) {
  9582. satrec.xlcof = -0.25 * j3oj2 * sinio *
  9583. (3.0 + 5.0 * cosio) / (1.0 + cosio);
  9584. }
  9585. else {
  9586. satrec.xlcof = -0.25 * j3oj2 * sinio *
  9587. (3.0 + 5.0 * cosio) / temp4;
  9588. }
  9589. satrec.aycof = -0.5 * j3oj2 * sinio;
  9590. satrec.delmo = Math.pow(1.0 + satrec.eta * Math.cos(satrec.mo), 3);
  9591. satrec.sinmao = Math.sin(satrec.mo);
  9592. satrec.x7thm1 = 7.0 * cosio2 - 1.0;
  9593. // /* --------------- deep space initialization ------------- */
  9594. if ((2 * Math.PI / satrec.no) >= 225.0) {
  9595. satrec.method = 'd';
  9596. satrec.isimp = 1;
  9597. tc = 0.0;
  9598. inclm = satrec.inclo;
  9599. // [sinim,cosim,sinomm,cosomm,snodm,cnodm,day,satrec.e3,satrec.ee2,
  9600. // em,emsq,gam,satrec.peo,satrec.pgho,satrec.pho,satrec.pinco,
  9601. // satrec.plo,rtemsq,satrec.se2,satrec.se3,satrec.sgh2,
  9602. // satrec.sgh3,satrec.sgh4,satrec.sh2,satrec.sh3,satrec.si2,
  9603. // satrec.si3,satrec.sl2,satrec.sl3,satrec.sl4,s1,s2,s3,s4,s5,
  9604. // s6,s7,ss1,ss2,ss3,ss4,ss5,ss6,ss7,sz1,sz2,sz3,sz11,sz12,
  9605. // sz13,sz21,sz22,sz23,sz31,sz32,sz33,satrec.xgh2,satrec.xgh3,
  9606. // satrec.xgh4,satrec.xh2,satrec.xh3,satrec.xi2,satrec.xi3,
  9607. // satrec.xl2,satrec.xl3,satrec.xl4,nm,z1,z2,z3,z11,z12,z13,
  9608. // z21,z22,z23,z31,z32,z33,satrec.zmol,satrec.zmos] =
  9609. rets = dscom(epoch, satrec.ecco, satrec.argpo, tc, satrec.inclo,
  9610. satrec.nodeo, satrec.no);
  9611. sinim = rets.shift();
  9612. cosim = rets.shift();
  9613. sinomm = rets.shift();
  9614. cosomm = rets.shift();
  9615. snodm = rets.shift();
  9616. cnodm = rets.shift();
  9617. day = rets.shift();
  9618. satrec.e3 = rets.shift();
  9619. satrec.ee2 = rets.shift();
  9620. em = rets.shift();
  9621. emsq = rets.shift();
  9622. gam = rets.shift();
  9623. satrec.peo = rets.shift();
  9624. satrec.pgho = rets.shift();
  9625. satrec.pho = rets.shift();
  9626. satrec.pinco = rets.shift();
  9627. satrec.plo = rets.shift();
  9628. rtemsq = rets.shift();
  9629. satrec.se2 = rets.shift();
  9630. satrec.se3 = rets.shift();
  9631. satrec.sgh2 = rets.shift();
  9632. satrec.sgh3 = rets.shift();
  9633. satrec.sgh4 = rets.shift();
  9634. satrec.sh2 = rets.shift();
  9635. satrec.sh3 = rets.shift();
  9636. satrec.si2 = rets.shift();
  9637. satrec.si3 = rets.shift();
  9638. satrec.sl2 = rets.shift();
  9639. satrec.sl3 = rets.shift();
  9640. satrec.sl4 = rets.shift();
  9641. s1 = rets.shift();
  9642. s2 = rets.shift();
  9643. s3 = rets.shift();
  9644. s4 = rets.shift();
  9645. s5 = rets.shift();
  9646. s6 = rets.shift();
  9647. s7 = rets.shift();
  9648. ss1 = rets.shift();
  9649. ss2 = rets.shift();
  9650. ss3 = rets.shift();
  9651. ss4 = rets.shift();
  9652. ss5 = rets.shift();
  9653. ss6 = rets.shift();
  9654. ss7 = rets.shift();
  9655. sz1 = rets.shift();
  9656. sz2 = rets.shift();
  9657. sz3 = rets.shift();
  9658. sz11 = rets.shift();
  9659. sz12 = rets.shift();
  9660. sz13 = rets.shift();
  9661. sz21 = rets.shift();
  9662. sz22 = rets.shift();
  9663. sz23 = rets.shift();
  9664. sz31 = rets.shift();
  9665. sz32 = rets.shift();
  9666. sz33 = rets.shift();
  9667. satrec.xgh2 = rets.shift();
  9668. satrec.xgh3 = rets.shift();
  9669. satrec.xgh4 = rets.shift();
  9670. satrec.xh2 = rets.shift();
  9671. satrec.xh3 = rets.shift();
  9672. satrec.xi2 = rets.shift();
  9673. satrec.xi3 = rets.shift();
  9674. satrec.xl2 = rets.shift();
  9675. satrec.xl3 = rets.shift();
  9676. satrec.xl4 = rets.shift();
  9677. nm = rets.shift();
  9678. z1 = rets.shift();
  9679. z2 = rets.shift();
  9680. z3 = rets.shift();
  9681. z11 = rets.shift();
  9682. z12 = rets.shift();
  9683. z13 = rets.shift();
  9684. z21 = rets.shift();
  9685. z22 = rets.shift();
  9686. z23 = rets.shift();
  9687. z31 = rets.shift();
  9688. z32 = rets.shift();
  9689. z33 = rets.shift();
  9690. satrec.zmol = rets.shift();
  9691. satrec.zmos = rets.shift();
  9692. //[satrec.ecco,satrec.inclo,satrec.nodeo,satrec.argpo,satrec.mo]
  9693. rets = dpper(satrec.e3, satrec.ee2, satrec.peo, satrec.pgho,
  9694. satrec.pho, satrec.pinco, satrec.plo, satrec.se2, satrec.se3,
  9695. satrec.sgh2, satrec.sgh3, satrec.sgh4, satrec.sh2, satrec.sh3,
  9696. satrec.si2, satrec.si3, satrec.sl2, satrec.sl3, satrec.sl4,
  9697. satrec.t, satrec.xgh2, satrec.xgh3, satrec.xgh4, satrec.xh2,
  9698. satrec.xh3, satrec.xi2, satrec.xi3, satrec.xl2, satrec.xl3,
  9699. satrec.xl4, satrec.zmol, satrec.zmos, inclm, satrec.init,
  9700. satrec.ecco, satrec.inclo, satrec.nodeo, satrec.argpo, satrec.mo);
  9701. satrec.ecco = rets.shift();
  9702. satrec.inclo = rets.shift();
  9703. satrec.nodeo = rets.shift();
  9704. satrec.argpo = rets.shift();
  9705. satrec.mo = rets.shift();
  9706. argpm = 0.0;
  9707. nodem = 0.0;
  9708. mm = 0.0;
  9709. // [em,argpm,inclm,mm,nm,nodem,satrec.irez,satrec.atime,
  9710. // satrec.d2201,satrec.d2211,satrec.d3210,satrec.d3222,
  9711. // satrec.d4410,satrec.d4422,satrec.d5220,satrec.d5232,
  9712. // satrec.d5421,satrec.d5433,satrec.dedt,satrec.didt,
  9713. // satrec.dmdt,dndt,satrec.dnodt,satrec.domdt,satrec.del1,
  9714. // satrec.del2,satrec.del3,
  9715. // //ses,sghl,sghs,sgs,shl,shs,sis,sls,theta,
  9716. // satrec.xfact,satrec.xlamo,satrec.xli,satrec.xni]
  9717. rets = dsinit(cosim, emsq, satrec.argpo, s1, s2, s3, s4, s5, sinim, ss1, ss2, ss3,
  9718. ss4, ss5, sz1, sz3, sz11, sz13, sz21, sz23, sz31, sz33, satrec.t, tc,
  9719. satrec.gsto, satrec.mo, satrec.mdot, satrec.no, satrec.nodeo,
  9720. satrec.nodedot, xpidot, z1, z3, z11, z13, z21, z23, z31, z33, em,
  9721. argpm, inclm, mm, nm, nodem, satrec.ecco, eccsq);
  9722. em = rets.shift();
  9723. argpm = rets.shift();
  9724. inclm = rets.shift();
  9725. mm = rets.shift();
  9726. nm = rets.shift();
  9727. nodem = rets.shift();
  9728. satrec.irez = rets.shift();
  9729. satrec.atime = rets.shift();
  9730. satrec.d2201 = rets.shift();
  9731. satrec.d2211 = rets.shift();
  9732. satrec.d3210 = rets.shift();
  9733. satrec.d3222 = rets.shift();
  9734. satrec.d4410 = rets.shift();
  9735. satrec.d4422 = rets.shift();
  9736. satrec.d5220 = rets.shift();
  9737. satrec.d5232 = rets.shift();
  9738. satrec.d5421 = rets.shift();
  9739. satrec.d5433 = rets.shift();
  9740. satrec.dedt = rets.shift();
  9741. satrec.didt = rets.shift();
  9742. satrec.dmdt = rets.shift();
  9743. dndt = rets.shift();
  9744. satrec.dnodt = rets.shift();
  9745. satrec.domdt = rets.shift();
  9746. satrec.del1 = rets.shift();
  9747. satrec.del2 = rets.shift();
  9748. satrec.del3 = rets.shift();
  9749. //ses,sghl,sghs,sgs,shl,shs,sis,sls,theta,
  9750. satrec.xfact = rets.shift();
  9751. satrec.xlamo = rets.shift();
  9752. satrec.xli = rets.shift();
  9753. satrec.xni = rets.shift();
  9754. }
  9755. // /* ----------- set variables if not deep space ----------- */
  9756. if (satrec.isimp !== 1) {
  9757. cc1sq = satrec.cc1 * satrec.cc1;
  9758. satrec.d2 = 4.0 * ao * tsi * cc1sq;
  9759. temp = satrec.d2 * tsi * satrec.cc1 / 3.0;
  9760. satrec.d3 = (17.0 * ao + sfour) * temp;
  9761. satrec.d4 = 0.5 * temp * ao * tsi *
  9762. (221.0 * ao + 31.0 * sfour) * satrec.cc1;
  9763. satrec.t3cof = satrec.d2 + 2.0 * cc1sq;
  9764. satrec.t4cof = 0.25 * (3.0 * satrec.d3 + satrec.cc1 *
  9765. (12.0 * satrec.d2 + 10.0 * cc1sq));
  9766. satrec.t5cof = 0.2 * (3.0 * satrec.d4 +
  9767. 12.0 * satrec.cc1 * satrec.d3 +
  9768. 6.0 * satrec.d2 * satrec.d2 +
  9769. 15.0 * cc1sq * (2.0 * satrec.d2 + cc1sq));
  9770. }
  9771. } // if omeosq = 0
  9772. // /* finally propogate to zero epoch to initialise all others. */
  9773. if (satrec.error === 0) {
  9774. rets = sgp4(satrec, 0.0);
  9775. satrec = rets.shift();
  9776. r = rets.shift();
  9777. v = rets.shift();
  9778. }
  9779. satrec.init = 'n';
  9780. return satrec; // MATLAB returns an unnecessary list "[satrec]", don't do it here
  9781. }
  9782. // sprintf.js
  9783. /**
  9784. sprintf() for JavaScript 0.7-beta1
  9785. http://www.diveintojavascript.com/projects/javascript-sprintf
  9786. Copyright (c) Alexandru Marasteanu <alexaholic [at) gmail (dot] com>
  9787. All rights reserved.
  9788. Redistribution and use in source and binary forms, with or without
  9789. modification, are permitted provided that the following conditions are met:
  9790. * Redistributions of source code must retain the above copyright
  9791. notice, this list of conditions and the following disclaimer.
  9792. * Redistributions in binary form must reproduce the above copyright
  9793. notice, this list of conditions and the following disclaimer in the
  9794. documentation and/or other materials provided with the distribution.
  9795. * Neither the name of sprintf() for JavaScript nor the
  9796. names of its contributors may be used to endorse or promote products
  9797. derived from this software without specific prior written permission.
  9798. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  9799. ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  9800. WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  9801. DISCLAIMED. IN NO EVENT SHALL Alexandru Marasteanu BE LIABLE FOR ANY
  9802. DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  9803. (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  9804. LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  9805. ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  9806. (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  9807. SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  9808. Changelog:
  9809. 2010.09.06 - 0.7-beta1
  9810. - features: vsprintf, support for named placeholders
  9811. - enhancements: format cache, reduced global namespace pollution
  9812. 2010.05.22 - 0.6:
  9813. - reverted to 0.4 and fixed the bug regarding the sign of the number 0
  9814. Note:
  9815. Thanks to Raphael Pigulla <raph (at] n3rd [dot) org> (http://www.n3rd.org/)
  9816. who warned me about a bug in 0.5, I discovered that the last update was
  9817. a regress. I appologize for that.
  9818. 2010.05.09 - 0.5:
  9819. - bug fix: 0 is now preceeded with a + sign
  9820. - bug fix: the sign was not at the right position on padded results (Kamal Abdali)
  9821. - switched from GPL to BSD license
  9822. 2007.10.21 - 0.4:
  9823. - unit test and patch (David Baird)
  9824. 2007.09.17 - 0.3:
  9825. - bug fix: no longer throws exception on empty paramenters (Hans Pufal)
  9826. 2007.09.11 - 0.2:
  9827. - feature: added argument swapping
  9828. 2007.04.03 - 0.1:
  9829. - initial release
  9830. **/
  9831. var sprintf = (function () {
  9832. 'use strict';
  9833. function getType(variable) {
  9834. return Object.prototype.toString.call(variable).slice(8, -1).toLowerCase();
  9835. }
  9836. function strRepeat(input, multiplier) {
  9837. for (var output = []; multiplier > 0; output[--multiplier] = input) {/* do nothing */}
  9838. return output.join('');
  9839. }
  9840. var strFormat = function () {
  9841. if (!strFormat.cache.hasOwnProperty(arguments[0])) {
  9842. strFormat.cache[arguments[0]] = strFormat.parse(arguments[0]);
  9843. }
  9844. return strFormat.format.call(null, strFormat.cache[arguments[0]], arguments);
  9845. };
  9846. strFormat.format = function (parseTree, argv) {
  9847. var cursor = 1, treeLength = parseTree.length,
  9848. nodeType = '',
  9849. arg,
  9850. output = [],
  9851. i,
  9852. k,
  9853. match,
  9854. pad,
  9855. padCharacter,
  9856. padLength;
  9857. for (i = 0; i < treeLength; i++) {
  9858. nodeType = getType(parseTree[i]);
  9859. if (nodeType === 'string') {
  9860. output.push(parseTree[i]);
  9861. }
  9862. else if (nodeType === 'array') {
  9863. match = parseTree[i]; // convenience purposes only
  9864. if (match[2]) { // keyword argument
  9865. arg = argv[cursor];
  9866. for (k = 0; k < match[2].length; k++) {
  9867. if (!arg.hasOwnProperty(match[2][k])) {
  9868. throw (sprintf('[sprintf] property "%s" does not exist', match[2][k]));
  9869. }
  9870. arg = arg[match[2][k]];
  9871. }
  9872. }
  9873. else if (match[1]) { // positional argument (explicit)
  9874. arg = argv[match[1]];
  9875. }
  9876. else { // positional argument (implicit)
  9877. arg = argv[cursor++];
  9878. }
  9879. if (/[^s]/.test(match[8]) && (getType(arg) !== 'number')) {
  9880. throw (sprintf('[sprintf] expecting number but found %s', getType(arg)));
  9881. }
  9882. switch (match[8]) {
  9883. case 'b':
  9884. arg = arg.toString(2);
  9885. break;
  9886. case 'c':
  9887. arg = String.fromCharCode(arg);
  9888. break;
  9889. case 'd':
  9890. arg = parseInt(arg, 10);
  9891. break;
  9892. case 'e':
  9893. arg = match[7] ? arg.toExponential(match[7]) : arg.toExponential();
  9894. break;
  9895. case 'f':
  9896. arg = match[7] ? parseFloat(arg).toFixed(match[7]) : parseFloat(arg);
  9897. break;
  9898. case 'o':
  9899. arg = arg.toString(8);
  9900. break;
  9901. case 's':
  9902. arg = ((arg = String(arg)) && match[7] ? arg.substring(0, match[7]) : arg);
  9903. break;
  9904. case 'u':
  9905. arg = Math.abs(arg);
  9906. break;
  9907. case 'x':
  9908. arg = arg.toString(16);
  9909. break;
  9910. case 'X':
  9911. arg = arg.toString(16).toUpperCase();
  9912. break;
  9913. }
  9914. arg = (/[def]/.test(match[8]) && match[3] && arg >= 0 ? '+' + arg : arg);
  9915. padCharacter = match[4] ? match[4] === '0' ? '0' : match[4].charAt(1) : ' ';
  9916. padLength = match[6] - String(arg).length;
  9917. pad = match[6] ? strRepeat(padCharacter, padLength) : '';
  9918. output.push(match[5] ? arg + pad : pad + arg);
  9919. }
  9920. }
  9921. return output.join('');
  9922. };
  9923. strFormat.cache = {};
  9924. strFormat.parse = function (fmt) {
  9925. var _fmt = fmt, match = [], parseTree = [], argNames = 0;
  9926. while (_fmt) {
  9927. if ((match = /^[^\x25]+/.exec(_fmt)) !== null) {
  9928. parseTree.push(match[0]);
  9929. }
  9930. else if ((match = /^\x25{2}/.exec(_fmt)) !== null) {
  9931. parseTree.push('%');
  9932. }
  9933. else if ((match = /^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fosuxX])/.exec(_fmt)) !== null) {
  9934. if (match[2]) {
  9935. argNames |= 1;
  9936. var fieldList = [], replacementField = match[2], fieldMatch = [];
  9937. if ((fieldMatch = /^([a-z_][a-z_\d]*)/i.exec(replacementField)) !== null) {
  9938. fieldList.push(fieldMatch[1]);
  9939. while ((replacementField = replacementField.substring(fieldMatch[0].length)) !== '') {
  9940. if ((fieldMatch = /^\.([a-z_][a-z_\d]*)/i.exec(replacementField)) !== null) {
  9941. fieldList.push(fieldMatch[1]);
  9942. }
  9943. else if ((fieldMatch = /^\[(\d+)\]/.exec(replacementField)) !== null) {
  9944. fieldList.push(fieldMatch[1]);
  9945. }
  9946. else {
  9947. throw ('[sprintf] huh?');
  9948. }
  9949. }
  9950. }
  9951. else {
  9952. throw ('[sprintf] huh?');
  9953. }
  9954. match[2] = fieldList;
  9955. }
  9956. else {
  9957. argNames |= 2;
  9958. }
  9959. if (argNames === 3) {
  9960. throw ('[sprintf] mixing positional and named placeholders is not (yet) supported');
  9961. }
  9962. parseTree.push(match);
  9963. }
  9964. else {
  9965. throw ('[sprintf] huh?');
  9966. }
  9967. _fmt = _fmt.substring(match[0].length);
  9968. }
  9969. return parseTree;
  9970. };
  9971. return strFormat;
  9972. })();
  9973. var vsprintf = function (fmt, argv) {
  9974. 'use strict';
  9975. argv.unshift(fmt);
  9976. return sprintf.apply(null, argv);
  9977. };
  9978. // testmat.js
  9979. function handleFileSelect(evt) {
  9980. 'use strict';
  9981. var files = evt.target.files, // FileList object
  9982. i, reader;
  9983. for (var i = 0, f; f = files[i]; i++) {
  9984. var reader = new FileReader();
  9985. // Closure to capture the file info
  9986. reader.onload = (function (theFile) { // theFile is unused(?)
  9987. return function (e) {
  9988. document.getElementById('tle-lines').value = e.target.result;
  9989. };
  9990. })(f);
  9991. reader.readAsText(f); // Read in the file as text
  9992. } // for file...
  9993. } // function
  9994. function getTLELines(htmlId) {
  9995. 'use strict';
  9996. // use like: for (var i = 0; i < lines.length; i++) { alert(lines[i]); }
  9997. var
  9998. lines,
  9999. TLELines = document.getElementById(htmlId).textContent;
  10000. if (document.all) { // IE
  10001. return TLELines.split('\r\n');
  10002. }
  10003. else { //Mozilla
  10004. return TLELines.split('\n');
  10005. }
  10006. }
  10007. // We should probably take some input and return output
  10008. // so that the QUnit test runner can validate results.
  10009. function testmat() {
  10010. 'use strict';
  10011. var USE_GLOBAL_opsmode = 'NO opsmode', // from verify procedure: improved mode
  10012. typerun = 'NO typerun', // from verify procedure: verify
  10013. typeinput = 'NO typeinput', // only if typerun is NOT 'm'
  10014. whichconst = 'NO whichconst', // from verify procedure: ???
  10015. infilename = 'OMFG WE DON\'T HAVE AN infilename',
  10016. rets, tumin, mu, radiusearthkm, xke, j2, j3, j4, j3oj2,
  10017. rad = 180.0 / Math.PI,
  10018. infile,
  10019. idebug = true, // enable debug output
  10020. longstr1, longstr2, fgets, // TODO matlab TLE file reader
  10021. catno,
  10022. satrec, startmfe, stopmfe, deltamin,
  10023. ro, vo,
  10024. tsince,
  10025. jd, year, mon, day, hr, minute, sec,
  10026. p, a, ecc, incl, node, argp, nu, m, arglat, truelon, lonper,
  10027. i,
  10028. TLELines,
  10029. startTime, satTime, totalTime;
  10030. TLELines = getTLELines('tle-lines');
  10031. // add operation smode for afspc (a) or improved (i)
  10032. opsmode = input('opsmode'); //'input opsmode afspc a, improved i ', 's');
  10033. //typerun = 'c' compare 1 year of full satcat data
  10034. //typerun = 'v' verification run, requires modified elm file with
  10035. //typerun = 'm' maunual operation- either mfe, epoch, or dayof yr
  10036. // start stop and delta times
  10037. typerun = input('typerun'); //'input type of run c, v, m: ', 's');
  10038. if (typerun === 'm') {
  10039. typeinput = input('typeinput'); //'input mfe, epoch (YMDHMS), or dayofyr approach, m,e,d: ', 's');
  10040. }
  10041. else {
  10042. typeinput = 'e';
  10043. }
  10044. whichconst = parseInt(input('whichconst'), 10); //'input constants 721, 72, 84 ');
  10045. //alert("testmat.js opsmode=" + opsmode + " typerun=" + typerun + " typeinput=" + typeinput + " whichconst=" + whichconst + "infile=" + infile);
  10046. // CSHENTON: I don't see how this function can operate without
  10047. // instantiating from getgravc(whichconst) we need mu and others below
  10048. rets = getgravc(whichconst);
  10049. tumin = rets.shift();
  10050. mu = rets.shift();
  10051. radiusearthkm = rets.shift();
  10052. xke = rets.shift();
  10053. j2 = rets.shift();
  10054. j3 = rets.shift();
  10055. j4 = rets.shift();
  10056. j3oj2 = rets.shift();
  10057. // ---------------- setup files for operation ------------------
  10058. // input 2-line element set file
  10059. // infilename = input('input elset filename: ', 's');
  10060. // infile = fopen(infilename, 'r');
  10061. // if (infile === -1) {
  10062. // fprintf(1, 'Failed to open file: //s\n', infilename);
  10063. // return;
  10064. // }
  10065. // if (typerun === 'c') {
  10066. // outfile = fopen('tmatall.out', 'wt');
  10067. // }
  10068. // else {
  10069. // if (typerun === 'v') {
  10070. // outfile = fopen('tmatver.out', 'wt');
  10071. // }
  10072. // else {
  10073. // outfile = fopen('tmat.out', 'wt');
  10074. // }
  10075. // }
  10076. // TLE file format repeats 3-line sets like:
  10077. //# # TEME example
  10078. //1 00005U 58002B 00179.78495062 .00000023 00000-0 28098-4 0 4753
  10079. //2 00005 34.2682 348.7242 1859667 331.7664 19.3264 10.82419157413667 0.00 4320.0 360.00
  10080. // ----------------- test simple propagation -------------------
  10081. startTime = new Date(); // overall run time
  10082. for (i = 0; i < TLELines.length; i += 1) {
  10083. satTime = new Date(); // time for each satelite (depends of course on period requested)
  10084. TLELines[i] = TLELines[i].trim();
  10085. if (TLELines[i] === '' || TLELines[i][0] === '#') {
  10086. continue;
  10087. }
  10088. else { // DANGER doesn't tolerate comments between TLE line 1 and 2
  10089. longstr1 = TLELines[i];
  10090. i += 1;
  10091. longstr2 = TLELines[i];
  10092. i += 1; // BUG I think this should not be here
  10093. }
  10094. // convert the char string to sgp4 elements
  10095. // includes initialization of sgp4
  10096. //[satrec, startmfe, stopmfe, deltamin] = twoline2rv(whichconst,
  10097. // longstr1, longstr2, typerun, typeinput);
  10098. rets = twoline2rv(whichconst, longstr1, longstr2, typerun, typeinput);
  10099. satrec = rets.shift();
  10100. startmfe = rets.shift();
  10101. stopmfe = rets.shift();
  10102. deltamin = rets.shift();
  10103. outfile(sprintf('\n %d xx\n', satrec.satnum));
  10104. fprintf1(sprintf(' %d\n', satrec.satnum));
  10105. // call the propagator to get the initial state vector value
  10106. //[satrec, ro ,vo] = sgp4 (satrec, 0.0);
  10107. rets = sgp4(satrec, 0.0);
  10108. satrec = rets.shift();
  10109. ro = rets.shift();
  10110. vo = rets.shift();
  10111. outfile(sprintf(' %16.8f %16.8f %16.8f %16.8f %12.9f %12.9f %12.9f\n',
  10112. satrec.t, ro[0], ro[1], ro[2], vo[0], vo[1], vo[2])); // MIG offsets shifted
  10113. // Why don't we print ymdhms or a,ecc,*rad as we do during the time intervals below?
  10114. //fprintf1(' %16.8f %16.8f %16.8f %16.8f %12.9f %12.9f %12.9f\n',...
  10115. // satrec.t,ro(1),ro(2),ro(3),vo(1),vo(2),vo(3));
  10116. tsince = startmfe;
  10117. // check so the first value isn't written twice
  10118. if (Math.abs(tsince) > 1.0e-8) {
  10119. tsince = tsince - deltamin;
  10120. }
  10121. // loop to perform the propagation
  10122. while ((tsince < stopmfe) && (satrec.error === 0)) {
  10123. tsince = tsince + deltamin;
  10124. if (tsince > stopmfe) {
  10125. tsince = stopmfe;
  10126. }
  10127. //[satrec, ro, vo] = sgp4(satrec, tsince);
  10128. rets = sgp4(satrec, tsince);
  10129. satrec = rets.shift();
  10130. ro = rets.shift();
  10131. vo = rets.shift();
  10132. if (satrec.error > 0) {
  10133. fprintf1(sprintf('# *** error: tsince=%f *** code=%d (satnum=%d)\n',
  10134. tsince, satrec.error, satrec.satnum));
  10135. }
  10136. if (satrec.error === 0) {
  10137. if ((typerun !== 'v') && (typerun !== 'c')) {
  10138. jd = satrec.jdsatepoch + tsince / 1440; // 24 hours/day * 60 minutes/hour = 1440 minutes/day
  10139. //[year,mon,day,hr,minute,sec] = invjday(jd);
  10140. rets = invjday(jd);
  10141. year = rets.shift();
  10142. mon = rets.shift();
  10143. day = rets.shift();
  10144. hr = rets.shift();
  10145. minute = rets.shift();
  10146. sec = rets.shift();
  10147. outfile(sprintf(' %16.8f %16.8f %16.8f %16.8f %12.9f %12.9f %12.9f %5i%3i%3i %2i:%2i:%9.6f %16.8f%16.8f%16.8%12.9f%12.9f%12.9f\n',
  10148. tsince, ro[0], ro[1], ro[2], vo[0], vo[1], vo[2],
  10149. year, mon, day, hr, minute, sec));
  10150. }
  10151. else {
  10152. outfile(sprintf(' %16.8f %16.8f %16.8f %16.8f %12.9f %12.9f %12.9f',
  10153. tsince, ro[0], ro[1], ro[2], vo[0], vo[1], vo[2]));
  10154. // fprintf1(' %16.8f %16.8f %16.8f %16.8f %12.9f %12.9f %12.9f',
  10155. // tsince, ro[0], ro[1], ro[2], vo[0], vo[1], vo[2]);
  10156. //[p,a,ecc,incl,node,argp,nu,m,arglat,truelon,lonper ] = rv2coe(ro, vo, mu);
  10157. rets = rv2coe(ro, vo, mu);
  10158. p = rets.shift();
  10159. a = rets.shift();
  10160. ecc = rets.shift();
  10161. incl = rets.shift();
  10162. node = rets.shift();
  10163. argp = rets.shift();
  10164. nu = rets.shift();
  10165. m = rets.shift();
  10166. arglat = rets.shift();
  10167. truelon = rets.shift();
  10168. lonper = rets.shift();
  10169. outfile(sprintf(' %14.6f %8.6f %10.5f %10.5f %10.5f %10.5f %10.5f\n',
  10170. a, ecc, incl * rad, node * rad, argp * rad, nu * rad, m * rad));
  10171. }
  10172. } // if satrec.error == 0
  10173. } // while propagating the orbit
  10174. debug('satnum=' + satrec.satnum +
  10175. ' time=' + (new Date() - satTime) + 'ms' +
  10176. ' ellapsed time=' + (new Date() - startTime) + 'ms');
  10177. } // if not eof
  10178. // window.onload = testmat();
  10179. // TODO: return results of test?
  10180. }
  10181. // twoline2rv.js
  10182. var xke, j2; // HACK: GLOBALS to pass to initl()
  10183. function twoline2rv(whichconst, longstr1, longstr2, typerun, typeinput) {
  10184. 'use strict';
  10185. var rets = getgravc(whichconst),
  10186. tumin = rets.shift(),
  10187. mu = rets.shift(),
  10188. radiusearthkm = rets.shift(),
  10189. LOCAL_xke = rets.shift(),
  10190. LOCAL_j2 = rets.shift(),
  10191. j3 = rets.shift(),
  10192. j4 = rets.shift(),
  10193. j3oj2 = rets.shift(),
  10194. deg2rad = Math.PI / 180.0, // 0.01745329251994330 [deg/rad]
  10195. xpdotp = 1440.0 / (2.0 * Math.PI), // 229.1831180523293 [rev/day]/[rad/min]
  10196. satrec = {},
  10197. revnum = 0,
  10198. elnum = 0,
  10199. year = 0,
  10200. j,
  10201. carnumb, classification, intldesg, nexp, ibexp, numb,
  10202. cardnumb, startmfe, stopmfe, deltamin,
  10203. mon, day, hr, minute, sec,
  10204. startyear, startmon, startday, starthr, startmin, startsec, jdstart,
  10205. stopyear, stopmon, stopday, stophr, stopmin, stopsec, jdstop,
  10206. startdayofyr, stopdayofyr,
  10207. sgp4epoch;
  10208. // Set globals to pass to initl() [vomit]
  10209. xke = LOCAL_xke;
  10210. j2 = LOCAL_j2;
  10211. // global tumin radiusearthkm xke j2 j3 j4 j3oj2
  10212. // Get these via getgravc() OR from caller's globals.
  10213. // [tumin, mu, radiusearthkm, xke, j2, j3, j4, j3oj2] = getgravc(whichconst);
  10214. if (typeof tumin === 'undefined') {
  10215. throw new Error('Global "tumin" is undefined');
  10216. }
  10217. if (typeof radiusearthkm === 'undefined') {
  10218. throw new Error('Global "radiusearthkm" is undefined');
  10219. }
  10220. if (typeof xke === 'undefined') {
  10221. throw new Error('Global "xke" is undefined');
  10222. }
  10223. if (typeof j2 === 'undefined') {
  10224. throw new Error('Global "j2" is undefined');
  10225. }
  10226. if (typeof j3 === 'undefined') {
  10227. throw new Error('Global "j3" is undefined');
  10228. }
  10229. if (typeof j4 === 'undefined') {
  10230. throw new Error('Global "j4" is undefined');
  10231. }
  10232. if (typeof j3oj2 === 'undefined') {
  10233. throw new Error('Global "j3oj2" is undefined');
  10234. }
  10235. satrec.error = 0;
  10236. // JavaScript's strings are immutable strings, so convert to
  10237. // mutable array, munge, then convert back to strings.
  10238. longstr1 = longstr1.split('');
  10239. longstr2 = longstr2.split('');
  10240. // set the implied decimal points since doing a formated read
  10241. // fixes for bad input data values (missing, ...)
  10242. for (j = 10; j <= 15; j += 1) { //"8002B " -> "8002B_"
  10243. if (longstr1[j] === ' ') {
  10244. longstr1[j] = '_';
  10245. }
  10246. }
  10247. if (longstr1[44] !== ' ') {
  10248. longstr1[43] = longstr1[44];
  10249. }
  10250. longstr1[44] = '.';
  10251. if (longstr1[7] === ' ') {
  10252. longstr1[7] = 'U';
  10253. }
  10254. if (longstr1[9] === ' ') {
  10255. longstr1[9] = '.';
  10256. }
  10257. for (j = 45; j <= 49; j += 1) {
  10258. if (longstr1[j] === ' ') {
  10259. longstr1[j] = '0';
  10260. }
  10261. }
  10262. if (longstr1[51] === ' ') {
  10263. longstr1[51] = '0';
  10264. }
  10265. if (longstr1[53] !== ' ') {
  10266. longstr1[52] = longstr1[53];
  10267. }
  10268. longstr1[53] = '.';
  10269. if (longstr1[62] === ' ') {
  10270. longstr1[62] = '0';
  10271. }
  10272. if ((longstr1.length < 68) || (longstr1[67] === ' ')) {
  10273. longstr1[67] = '0';
  10274. }
  10275. longstr2[25] = '.';
  10276. for (j = 26; j <= 32; j += 1) {
  10277. if (longstr2[j] === ' ') {
  10278. longstr2[j] = '0';
  10279. }
  10280. }
  10281. longstr1 = longstr1.join('');
  10282. longstr2 = longstr2.join('');
  10283. //00000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000
  10284. //01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
  10285. //1 00005U 58002B 00179.78495062 .00000023 00000-0 28098-4 0 4753
  10286. //2 00005 34.2682 348.7242 1859667 331.7664 19.3264 10.82419157413667 0.00 4320.0 360.00
  10287. // parse first line
  10288. carnumb = parseFloat(longstr1[0]); // caution: 'cardnum' in second line
  10289. satrec.satnum = parseFloat(longstr1.slice(2, 7));
  10290. classification = longstr1[7]; // "U"
  10291. intldesg = longstr1.slice(9, 17);
  10292. satrec.epochyr = parseFloat(longstr1.slice(18, 20)); // ??
  10293. satrec.epochdays = parseFloat(longstr1.slice(20, 32));
  10294. satrec.ndot = parseFloat(longstr1.slice(33, 43));
  10295. satrec.nddot = parseFloat(longstr1.slice(43, 50));
  10296. nexp = parseFloat(longstr1.slice(50, 52));
  10297. satrec.bstar = parseFloat(longstr1.slice(52, 59));
  10298. ibexp = parseFloat(longstr1.slice(59, 61));
  10299. numb = parseFloat(longstr1.slice(62, 63));
  10300. elnum = parseFloat(longstr1.slice(64, 68));
  10301. // parse second line
  10302. if (typerun === 'v') {
  10303. cardnumb = parseFloat(longstr2.slice(0, 1));
  10304. satrec.satnum = parseFloat(longstr2.slice(2, 7));
  10305. satrec.inclo = parseFloat(longstr2.slice(7, 16));
  10306. satrec.nodeo = parseFloat(longstr2.slice(16, 25));
  10307. satrec.ecco = parseFloat(longstr2.slice(25, 33));
  10308. satrec.argpo = parseFloat(longstr2.slice(33, 42));
  10309. satrec.mo = parseFloat(longstr2.slice(42, 51));
  10310. satrec.no = parseFloat(longstr2.slice(51, 63));
  10311. revnum = parseFloat(longstr2.slice(63, 68));
  10312. startmfe = parseFloat(longstr2.slice(69, 81)); // only for 'v'
  10313. stopmfe = parseFloat(longstr2.slice(82, 96)); // only for 'v'
  10314. deltamin = parseFloat(longstr2.slice(96, 105)); // only for 'v'
  10315. } else {
  10316. cardnumb = parseFloat(longstr2.slice(0, 1));
  10317. satrec.satnum = parseFloat(longstr2.slice(2, 7));
  10318. satrec.inclo = parseFloat(longstr2.slice(7, 16));
  10319. satrec.nodeo = parseFloat(longstr2.slice(16, 25));
  10320. satrec.ecco = parseFloat(longstr2.slice(25, 33));
  10321. satrec.argpo = parseFloat(longstr2.slice(33, 42));
  10322. satrec.mo = parseFloat(longstr2.slice(42, 51));
  10323. satrec.no = parseFloat(longstr2.slice(51, 63));
  10324. revnum = parseFloat(longstr2.slice(63, 68));
  10325. }
  10326. // ---- find no, ndot, nddot ----
  10327. satrec.no = satrec.no / xpdotp; ////* rad/min
  10328. satrec.nddot = satrec.nddot * Math.pow(10.0, nexp);
  10329. satrec.bstar = satrec.bstar * Math.pow(10.0, ibexp);
  10330. // ---- convert to sgp4 units ----
  10331. satrec.a = Math.pow(satrec.no * tumin, -2 / 3); // [er]
  10332. satrec.ndot = satrec.ndot / (xpdotp * 1440.0); // [rad/min^2]
  10333. satrec.nddot = satrec.nddot / (xpdotp * 1440.0 * 1440); // [rad/min^3]
  10334. // ---- find standard orbital elements ----
  10335. satrec.inclo = satrec.inclo * deg2rad;
  10336. satrec.nodeo = satrec.nodeo * deg2rad;
  10337. satrec.argpo = satrec.argpo * deg2rad;
  10338. satrec.mo = satrec.mo * deg2rad;
  10339. satrec.alta = satrec.a * (1.0 + satrec.ecco) - 1.0;
  10340. satrec.altp = satrec.a * (1.0 - satrec.ecco) - 1.0;
  10341. // ----------------------------------------------------------------
  10342. // find sgp4epoch time of element set
  10343. // remember that sgp4 uses units of days from 0 jan 1950 (sgp4epoch)
  10344. // and minutes from the epoch (time)
  10345. // --------------------------------------------------------------
  10346. // ------------- temp fix for years from 1957-2056 ----------------
  10347. // ------ correct fix will occur when year is 4-digit in 2le ------
  10348. if (satrec.epochyr < 57) {
  10349. year = satrec.epochyr + 2000;
  10350. } else {
  10351. year = satrec.epochyr + 1900;
  10352. }
  10353. //[mon,day,hr,minute,sec] = days2mdh(year, satrec.epochdays);
  10354. rets = days2mdh(year, satrec.epochdays);
  10355. mon = rets.shift();
  10356. day = rets.shift();
  10357. hr = rets.shift();
  10358. minute = rets.shift();
  10359. sec = rets.shift();
  10360. satrec.jdsatepoch = jday(year, mon, day, hr, minute, sec);
  10361. // input start stop times manually
  10362. if ((typerun !== 'v') && (typerun !== 'c')) {
  10363. // ------------- enter start/stop ymd hms values --------------------
  10364. if (typeinput === 'e') {
  10365. startyear = input('input start year');
  10366. startmon = input('input start mon');
  10367. startday = input('input start day');
  10368. starthr = input('input start hr');
  10369. startmin = input('input start min');
  10370. startsec = input('input start sec');
  10371. jdstart = jday(startyear, startmon, startday, starthr, startmin, startsec);
  10372. stopyear = input('input stop year');
  10373. stopmon = input('input stop mon');
  10374. stopday = input('input stop day');
  10375. stophr = input('input stop hr');
  10376. stopmin = input('input stop min');
  10377. stopsec = input('input stop sec');
  10378. jdstop = jday(stopyear, stopmon, stopday, stophr, stopmin, stopsec);
  10379. startmfe = (jdstart - satrec.jdsatepoch) * 1440.0;
  10380. stopmfe = (jdstop - satrec.jdsatepoch) * 1440.0;
  10381. deltamin = input('input time step in minutes ');
  10382. }
  10383. // -------- enter start/stop year and days of year values -----------
  10384. if (typeinput === 'd') {
  10385. startyear = input('input start year');
  10386. startdayofyr = input('input start dayofyr');
  10387. stopyear = input('input stop year');
  10388. stopdayofyr = input('input stop dayofyr');
  10389. //[mon, day, hr, minute, sec] = days2mdh ( startyear, startdayofyr);
  10390. rets = days2mdh(startyear, startdayofyr);
  10391. mon = rets.shift();
  10392. day = rets.shift();
  10393. hr = rets.shift();
  10394. minute = rets.shift();
  10395. sec = rets.shift();
  10396. jdstart = jday(startyear, mon, day, hr, minute, sec);
  10397. //[mon, day, hr, minute, sec] = days2mdh ( stopyear, stopdayofyr);
  10398. rets = days2mdh(stopyear, stopdayofyr);
  10399. mon = rets.shift();
  10400. day = rets.shift();
  10401. hr = rets.shift();
  10402. minute = rets.shift();
  10403. sec = rets.shift();
  10404. jdstop = jday(stopyear, mon, day, hr, minute, sec);
  10405. startmfe = (jdstart - satrec.jdsatepoch) * 1440.0;
  10406. stopmfe = (jdstop - satrec.jdsatepoch) * 1440.0;
  10407. deltamin = input('input time step in minutes ');
  10408. }
  10409. // ------------------ enter start/stop mfe values -------------------
  10410. if (typeinput === 'm') {
  10411. startmfe = input('input start mfe: ');
  10412. stopmfe = input('input stop mfe: ');
  10413. deltamin = input('input time step in minutes: ');
  10414. }
  10415. if (typeinput === 'n') { // HACK: 'now', from cesiumtry
  10416. var now = new Date();
  10417. jdstart = jday(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDay(),
  10418. now.getUTCHours(), now.getUTCMinutes(), now.getUTCSeconds());
  10419. jdstop = jday(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDay(),
  10420. now.getUTCHours(), now.getUTCMinutes(), (now.getUTCSeconds() + 1) % 60); // more than jdstart
  10421. startmfe = (jdstart - satrec.jdsatepoch) * 1440.0;
  10422. stopmfe = (jdstop - satrec.jdsatepoch) * 1440.0;
  10423. deltamin = 60; // minutes, we shouldn't need this
  10424. // Why is startmfe negative??
  10425. // satrec.jdsatepoch=2456195.79713419
  10426. // jdstart =2456156.1898611113
  10427. // Perhaps based on typerun==c use delta of ... 1?
  10428. startmfe = 0.0;
  10429. stopmfe = 1.0;
  10430. }
  10431. }
  10432. // // perform complete catalog evaluation
  10433. if (typerun === 'c') {
  10434. startmfe = -1440.0;
  10435. stopmfe = 1440.0;
  10436. deltamin = 20.0;
  10437. }
  10438. // ------------- initialize the orbit at sgp4epoch --------------
  10439. sgp4epoch = satrec.jdsatepoch - 2433281.5; // days since 0 Jan 1950
  10440. satrec = sgp4init(whichconst, satrec, satrec.bstar, satrec.ecco, sgp4epoch,
  10441. satrec.argpo, satrec.inclo, satrec.mo, satrec.no, satrec.nodeo);
  10442. return [satrec, startmfe, stopmfe, deltamin];
  10443. }
  10444. // tle.js
  10445. // Get, parse, and return TLE structures
  10446. var tle = {
  10447. // I need to get a grip on proper OO patterns :-(
  10448. content : null,
  10449. lines : null,
  10450. tles : null,
  10451. readFile : function (fileName) {
  10452. // https://developer.mozilla.org/en-US/docs/DOM/XMLHttpRequest/Using_XMLHttpRequest
  10453. var request = new XMLHttpRequest();
  10454. var ASYNC = false; // TODO do async callback properly
  10455. request.open('GET', fileName, ASYNC);
  10456. request.send(); // blocks until returned due to ASYNC=false
  10457. if (request.status !== 200) {
  10458. return null; // TODO throw an error
  10459. }
  10460. this.content = request.responseText;
  10461. return this.content;
  10462. },
  10463. readFileLines : function (fileName) {
  10464. this.readFile(fileName);
  10465. this.lines = this.content.split('\n');
  10466. return this.lines;
  10467. },
  10468. parseFile : function (fileName) {
  10469. // Read file: if line starts with '1' or '2' assume TLE line 1, 2, otherwise store as comment/name
  10470. var lines = this.readFileLines(fileName);
  10471. var line;
  10472. var tle = [];
  10473. var tles = [];
  10474. for (linenum = 0; linenum < lines.length; linenum++) {
  10475. if (lines[linenum].substring(0, 2) === '1 ') {
  10476. tle[1] = lines[linenum];
  10477. }
  10478. else if (lines[linenum].substring(0, 2) === '2 ') {
  10479. tle[2] = lines[linenum];
  10480. tles.push(tle);
  10481. tle = [];
  10482. }
  10483. else {
  10484. tle[0] = lines[linenum]; // TODO: trim whitespace
  10485. }
  10486. }
  10487. this.tles = tles;
  10488. return tles;
  10489. }
  10490. };