worldwind.min.js 922 KB
Newer Older
Muddsair Sharif's avatar
Muddsair Sharif committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
/**
 * @license almond 0.3.0 Copyright (c) 2011-2014, The Dojo Foundation All Rights Reserved.
 * Available via the MIT or new BSD license.
 * see: http://github.com/jrburke/almond for details
 */

/*
 * Copyright 2015-2017 WorldWind Contributors
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/*
 * @license
 * Copyright 2000, Silicon Graphics, Inc. All Rights Reserved.
 * Copyright 2014, Google Inc. All Rights Reserved.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to
 * deal in the Software without restriction, including without limitation the
 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 * sell copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice including the dates of first publication and
 * either this permission notice or a reference to http://oss.sgi.com/projects/FreeB/
 * shall be included in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
 * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
 * IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 *
 * Original Code. The Original Code is: OpenGL Sample Implementation,
 * Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
 * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
 * Copyright in any portions created by third parties is as indicated
 * elsewhere herein. All Rights Reserved.
 */

/*!
 * @overview es6-promise - a tiny implementation of Promises/A+.
 * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
 * @license   Licensed under MIT license
 *            See https://raw.githubusercontent.com/jakearchibald/es6-promise/master/LICENSE
 * @version   3.0.2
 */

/*!
JSZip - A Javascript class for generating and reading zip files
<http://stuartk.com/jszip>
(c) 2009-2014 Stuart Knightley <stuart [at] stuartk.com>
Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/master/LICENSE.markdown.
JSZip uses the library pako released under the MIT license :
https://github.com/nodeca/pako/blob/master/LICENSE

This AMD version of jszip was created with Webpack using the v2.x branch of jszip:
https://github.com/Stuk/jszip/tree/v2.x
*/

/*!
 * The buffer module from node.js, for the browser.
 *
 * @author   Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
 * @license  MIT
 */

/**
 * The following functions come from pako, from pako/lib/utils/strings
 * released under the MIT license, see pako https://github.com/nodeca/pako/
 */

!function(t,e){"object"==typeof exports?module.exports=e():"function"==typeof define&&define.amd?define([],e):t.WorldWind=e()}(this,function(){var t,e,i;!function(r){function n(t,e){return v.call(t,e)}function o(t,e){var i,r,n,o,s,a,l,h,u,c,d,p=e&&e.split("/"),f=y.map,g=f&&f["*"]||{};if(t&&"."===t.charAt(0))if(e){for(p=p.slice(0,p.length-1),t=t.split("/"),s=t.length-1,y.nodeIdCompat&&b.test(t[s])&&(t[s]=t[s].replace(b,"")),t=p.concat(t),u=0;u<t.length;u+=1)if("."===(d=t[u]))t.splice(u,1),u-=1;else if(".."===d){if(1===u&&(".."===t[2]||".."===t[0]))break;u>0&&(t.splice(u-1,2),u-=2)}t=t.join("/")}else 0===t.indexOf("./")&&(t=t.substring(2));if((p||g)&&f){for(i=t.split("/"),u=i.length;u>0;u-=1){if(r=i.slice(0,u).join("/"),p)for(c=p.length;c>0;c-=1)if((n=f[p.slice(0,c).join("/")])&&(n=n[r])){o=n,a=u;break}if(o)break;!l&&g&&g[r]&&(l=g[r],h=u)}!o&&l&&(o=l,a=h),o&&(i.splice(0,a,o),t=i.join("/"))}return t}function s(t,e){return function(){var i=S.call(arguments,0);return"string"!=typeof i[0]&&1===i.length&&i.push(null),p.apply(r,i.concat([t,e]))}}function a(t){return function(e){return o(e,t)}}function l(t){return function(e){m[t]=e}}function h(t){if(n(E,t)){var e=E[t];delete E[t],_[t]=!0,d.apply(r,e)}if(!n(m,t)&&!n(_,t))throw new Error("No "+t);return m[t]}function u(t){var e,i=t?t.indexOf("!"):-1;return i>-1&&(e=t.substring(0,i),t=t.substring(i+1,t.length)),[e,t]}function c(t){return function(){return y&&y.config&&y.config[t]||{}}}var d,p,f,g,m={},E={},y={},_={},v=Object.prototype.hasOwnProperty,S=[].slice,b=/\.js$/;f=function(t,e){var i,r=u(t),n=r[0];return t=r[1],n&&(n=o(n,e),i=h(n)),n?t=i&&i.normalize?i.normalize(t,a(e)):o(t,e):(t=o(t,e),r=u(t),n=r[0],t=r[1],n&&(i=h(n))),{f:n?n+"!"+t:t,n:t,pr:n,p:i}},g={require:function(t){return s(t)},exports:function(t){var e=m[t];return void 0!==e?e:m[t]={}},module:function(t){return{id:t,uri:"",exports:m[t],config:c(t)}}},d=function(t,e,i,o){var a,u,c,d,p,y,v=[],S=typeof i;if(o=o||t,"undefined"===S||"function"===S){for(e=!e.length&&i.length?["require","exports","module"]:e,p=0;p<e.length;p+=1)if(d=f(e[p],o),"require"===(u=d.f))v[p]=g.require(t);else if("exports"===u)v[p]=g.exports(t),y=!0;else if("module"===u)a=v[p]=g.module(t);else if(n(m,u)||n(E,u)||n(_,u))v[p]=h(u);else{if(!d.p)throw new Error(t+" missing "+u);d.p.load(d.n,s(o,!0),l(u),{}),v[p]=m[u]}c=i?i.apply(m[t],v):void 0,t&&(a&&a.exports!==r&&a.exports!==m[t]?m[t]=a.exports:c===r&&y||(m[t]=c))}else t&&(m[t]=i)},t=e=p=function(t,e,i,n,o){if("string"==typeof t)return g[t]?g[t](e):h(f(t,e).f);if(!t.splice){if(y=t,y.deps&&p(y.deps,y.callback),!e)return;e.splice?(t=e,e=i,i=null):t=r}return e=e||function(){},"function"==typeof i&&(i=n,n=o),n?d(r,t,e,i):setTimeout(function(){d(r,t,e,i)},4),p},p.config=function(t){return p(t)},t._defined=m,i=function(t,e,i){e.splice||(i=e,e=[]),n(m,t)||n(E,t)||(E[t]=[t,e,i])},i.amd={jQuery:!0}}(),i("../tools/almond",function(){}),i("error/AbstractError",[],function(){"use strict";var t=function(t,e){this.name=t,this.message=e};return t.prototype.toString=function(){var t=this.name+": "+this.message;return this.stack&&(t+="\n"+this.stack.toString()),t},t}),i("geom/Angle",[],function(){"use strict";return{DEGREES_TO_RADIANS:Math.PI/180,RADIANS_TO_DEGREES:180/Math.PI,TWO_PI:2*Math.PI,HALF_PI:Math.PI/2,normalizedDegrees:function(t){var e=t%360;return e>180?e-360:e<-180?360+e:e},normalizedDegreesLatitude:function(t){var e=t%180;return e>90?180-e:e<-90?-180-e:e},normalizedDegreesLongitude:function(t){var e=t%360;return e>180?e-360:e<-180?360+e:e},normalizedRadians:function(t){var e=t%this.TWO_PI;return e>Math.PI?e-this.TWO_PI:e<-Math.PI?this.TWO_PI+e:e},normalizedRadiansLatitude:function(t){var e=t%Math.PI;return e>this.HALF_PI?Math.PI-e:e<-this.HALF_PI?-Math.PI-e:e},normalizedRadiansLongitude:function(t){var e=t%this.TWO_PI;return e>Math.PI?e-this.TWO_PI:e<-Math.PI?this.TWO_PI+e:e},isValidLatitude:function(t){return t>=-90&&t<=90},isValidLongitude:function(t){return t>=-180&&t<=180},toString:function(t){return t.toString()+"°"},toDecimalDegreesString:function(t){return t.toString()+"°"},toDMSString:function(t){var e,i,r,n,o;return e=t<0?-1:1,i=e*t,r=Math.floor(i),i=60*(i-r),n=Math.floor(i),i=60*(i-n),o=Math.round(i),60==o&&(n++,o=0),60==n&&(r++,n=0),(-1==e?"-":"")+r+"° "+n+"’ "+o+"”"},toDMString:function(t){var e,i,r,n,o,s;return e=t<0?-1:1,i=e*t,r=Math.floor(i),i=60*(i-r),n=Math.floor(i),i=60*(i-n),o=Math.round(i),60==o&&(n++,o=0),60==n&&(r++,n=0),s=0==o?n:n+o/60,(-1==e?"-":"")+r+"° "+s+"’"}}}),i("util/Logger",[],function(){"use strict";var t={LEVEL_NONE:0,LEVEL_SEVERE:1,LEVEL_WARNING:2,LEVEL_INFO:3,setLoggingLevel:function(t){e=t},getLoggingLevel:function(){return e},log:function(i,r){r&&i>0&&i<=e&&(i===t.LEVEL_SEVERE?console.error(r):i===t.LEVEL_WARNING?console.warn(r):i===t.LEVEL_INFO?console.info(r):console.log(r))},makeMessage:function(t,e,i){return t+"."+e+": "+(this.messageTable[i]?this.messageTable[i]:i)},logMessage:function(t,e,i,r){var n=this.makeMessage(e,i,r);return this.log(t,n),n},messageTable:{abstractInvocation:"The function called is abstract and must be overridden in a subclass.",indexOutOfRange:"The specified index is out of range.",invalidHeight:"The specified height is zero or negative.",invalidWidth:"The specified width is zero or negative.",invalidSize:"The specified size is zero or negative.",missingAltitudeMode:"The specified altitude mode is null or undefined.",missingAttributeName:"The specified DBase attribute file name is null or undefined.",missingArray:"The specified array is null, undefined or of insufficient length.",missingBoundaries:"The specified boundaries array is null or undefined.",missingBuffer:"The specified buffer descriptor is null or undefined.",missingColor:"The specified color is null or undefined.",missingDc:"The specified draw context is null or undefined.",missingDomElement:"The specified DOM element is null or undefined.",missingEntry:"The specified entry is null or undefined.",missingFont:"The specified font is null or undefined.",missingFrustum:"The specified frustum is null or undefined.",missingFunction:"The specified function is null or undefined.",missingGlContext:"The specified WebGL rendering context is null or undefined.",missingGlobe:"The specified globe is null or undefined.",missingImage:"The specified image is null or undefined.",missingIndices:"The specified indices array is null or undefined.",missingKey:"The specified key is null or undefined.",missingLevel:"The specified level is null or undefined.",missingLine:"The specified line is null or undefined.",missingList:"The specified list is null or undefined.",missingListener:"The specified listener is null or undefined",missingLocation:"The specified location is null or undefined.",missingMatrix:"The specified matrix is null or undefined.",missingNavigatorState:"The specified navigator state is null or undefined.",missingOffset:"The specified offset is null or undefined.",missingPath:"The specified path is null or undefined.",missingPlacename:"The specified place name is null or undefined.",missingPlane:"The specified plane is null or undefined.",missingPoint:"The specified point is null or undefined.",missingPoints:"The specified points array is null or undefined.",missingPosition:"The specified position is null or undefined.",missingPositions:"The specified positions array is null or undefined.",missingProgram:"The specified program is null or undefined.",missingProjection:"The specified projection is null or undefined.",missingRectangle:"The specified rectangle is null or undefined.",missingRenderable:"The specified renderable is null or undefined.",missingResource:"The specified resource is null or undefined.",missingResult:"The specified result variable is null or undefined.",missingResults:"The specified results array is null or undefined.",missingSector:"The specified sector is null or undefined.",missingShapeType:"The specified shape type is null or undefined.",missingSize:"The specified size is null or undefined.",missingText:"The specified text is null or undefined.",missingTexture:"The specified texture is null or undefined.",missingTile:"The specified tile is null or undefined.",missingType:"The specified type is null or undefined.",missingUrl:"The specified URL is null or undefined",missingVector:"The specified vector is null or undefined.",missingVertex:"The specified vertex is null or undefined.",missingViewport:"The specified viewport is null or undefined.",missingWorldWindow:"The specified WorldWindow is null or undefined.",notYetImplemented:"This function is not yet implemented"}},e=1;return t}),i("util/Color",["../util/Logger"],function(t){"use strict";var e=function(t,e,i,r){this.red=t,this.green=e,this.blue=i,this.alpha=r};return e.WHITE=new e(1,1,1,1),e.BLACK=new e(0,0,0,1),e.RED=new e(1,0,0,1),e.GREEN=new e(0,1,0,1),e.BLUE=new e(0,0,1,1),e.CYAN=new e(0,1,1,1),e.YELLOW=new e(1,1,0,1),e.MAGENTA=new e(1,0,1,1),e.LIGHT_GRAY=new e(.75,.75,.75,1),e.MEDIUM_GRAY=new e(.5,.5,.5,1),e.DARK_GRAY=new e(.25,.25,.25,1),e.TRANSPARENT=new e(0,0,0,0),e.prototype.set=function(t,e,i,r){return this.red=t,this.green=e,this.blue=i,this.alpha=r,this},e.prototype.copy=function(e){if(!e)throw new ArgumentError(t.logMessage(t.LEVEL_SEVERE,"Color","copy","missingColor"));return this.red=e.red,this.green=e.green,this.blue=e.blue,this.alpha=e.alpha,this},e.prototype.clone=function(){return new e(this.red,this.green,this.blue,this.alpha)},e.prototype.premultipliedComponents=function(t){var e=this.alpha;return t[0]=this.red*e,t[1]=this.green*e,t[2]=this.blue*e,t[3]=e,t},e.colorFromByteArray=function(t){return new e(t[0]/255,t[1]/255,t[2]/255,t[3]/255)},e.colorFromBytes=function(t,i,r,n){return new e(t/255,i/255,r/255,n/255)},e.colorFromHex=function(t){var i=parseInt(t.substring(0,2),16),r=parseInt(t.substring(2,4),16),n=parseInt(t.substring(4,6),16),o=parseInt(t.substring(6,8),16);return e.colorFromBytes(i,r,n,o)},e.colorFromKmlHex=function(t){var i=parseInt(t.substring(0,2),16),r=parseInt(t.substring(2,4),16),n=parseInt(t.substring(4,6),16),o=parseInt(t.substring(6,8),16);return e.colorFromBytes(o,n,r,i)},e.prototype.nextColor=function(){var t=Math.round(255*this.red),e=Math.round(255*this.green),i=Math.round(255*this.blue);return t<255?this.red=(t+1)/255:e<255?(this.red=0,this.green=(e+1)/255):i<255?(this.red=0,this.green=0,this.blue=(i+1)/255):(this.red=1/255,this.green=0,this.blue=0),this},e.prototype.equals=function(t){var e=Math.round(255*this.red),i=Math.round(255*this.green),r=Math.round(255*this.blue),n=Math.round(255*this.alpha),o=Math.round(255*t.red),s=Math.round(255*t.green),a=Math.round(255*t.blue),l=Math.round(255*t.alpha);return e===o&&i===s&&r===a&&n===l},e.prototype.equalsBytes=function(t){var e=Math.round(255*this.red),i=Math.round(255*this.green),r=Math.round(255*this.blue),n=Math.round(255*this.alpha);return e===t[0]&&i===t[1]&&r===t[2]&&n===t[3]},e.prototype.toByteString=function(){return"("+Math.round(255*this.red)+","+Math.round(255*this.green)+","+Math.round(255*this.blue)+","+Math.round(255*this.alpha)+")"},e.prototype.toHexString=function(t){var e=Math.ceil(255*this.red).toString(16),i=Math.ceil(255*this.green).toString(16),r=Math.ceil(255*this.blue).toString(16),n=Math.ceil(255*this.alpha).toString(16),o="#";return o+=e.length<2?"0"+e:e,o+=i.length<2?"0"+i:i,o+=r.length<2?"0"+r:r,t&&(o+=n.length<2?"0"+n:n),o},e.prototype.toRGBAString=function(){return"rgba("+Math.floor(255*this.red)+" ,"+Math.floor(255*this.green)+" ,"+Math.floor(255*this.blue)+" ,"+this.alpha+")"},e}),i("error/ArgumentError",["../error/AbstractError"],function(t){"use strict";var e=function(e){t.call(this,"ArgumentError",e);var i;try{throw new Error}catch(t){i=t.stack}this.stack=i};return e.prototype=Object.create(t.prototype),e}),i("util/Font",["../error/ArgumentError","../util/Color","../util/Logger"],function(t,e,i){"use strict";var r=function(e,r,n,o,s,a){if(!e)throw new t(i.logMessage(i.LEVEL_SEVERE,"Font","constructor","missingSize"));if(e<=0)throw new t(i.logMessage(i.LEVEL_SEVERE,"Font","constructor","invalidSize"));this._size=e,this.style=r||"normal",this.variant=n||"normal",this.weight=o||"normal",this.family=s||"sans-serif",this.horizontalAlignment=a||"center"};return Object.defineProperties(r.prototype,{size:{get:function(){return this._size},set:function(t){this._fontString=null,this._size=t}},style:{get:function(){return this._style},set:function(t){this._fontString=null,this._style=t}},variant:{get:function(){return this._variant},set:function(t){this._fontString=null,this._variant=t}},weight:{get:function(){return this._weight},set:function(t){this._fontString=null,this._weight=t}},family:{get:function(){return this._family},set:function(t){this._fontString=null,this._family=t}},horizontalAlignment:{get:function(){return this._horizontalAlignment},set:function(t){this._toString=null,this._horizontalAlignment=t}},fontString:{get:function(){return this._fontString||(this._fontString=this._style+" "+this.variant+" "+this._weight+" "+this._size.toString()+"px "+this._family),this._fontString}}}),r.prototype.toString=function(){return this._toString&&this._fontString||(this._toString=this.fontString+" "+this.horizontalAlignment),this._toString},r}),i("util/Insets",["../error/ArgumentError","../util/Logger"],function(t,e){"use strict";var i=function(i,r,n,o){if(4!==arguments.length)throw new t(e.logMessage(e.LEVEL_SEVERE,"Insets","constructor","invalidArgumentCount"));this._top=i,this._left=r,this._bottom=n,this._right=o};return i.prototype.set=function(t,e,i,r){this._top=t,this._left=e,this._bottom=i,this._right=r},i.prototype.clone=function(){return new i(this._top,this._left,this._bottom,this._right)},i.prototype.toString=function(){return this._top+" "+this._left+" "+this._bottom+" "+this._right},Object.defineProperties(i.prototype,{top:{get:function(){return this._top},set:function(t){this._top=t}},left:{get:function(){return this._left},set:function(t){this._left=t}},bottom:{get:function(){return this._bottom},set:function(t){this._bottom=t}},right:{get:function(){return this._right},set:function(t){this._right=t}}}),i}),i("geom/Vec3",["../util/Logger","../error/ArgumentError"],function(t,e){"use strict";var i=function(t,e,i){this[0]=t,this[1]=e,this[2]=i};return i.prototype=new Float64Array(3),i.ZERO=new i(0,0,0),i.average=function(i,r){if(!i||i.length<1)throw new e(t.logMessage(t.LEVEL_SEVERE,"Vec3","average","missingArray"));if(!r)throw new e(t.logMessage(t.LEVEL_SEVERE,"Vec3","average","missingResult"));var n,o=i.length;r[0]=0,r[1]=0,r[2]=0;for(var s=0,a=i.length;s<a;s++)n=i[s],r[0]+=n[0]/o,r[1]+=n[1]/o,r[2]+=n[2]/o;return r},i.averageOfBuffer=function(i,r){if(!i||i.length<1)throw new e(t.logMessage(t.LEVEL_SEVERE,"Vec3","averageBuffer","missingArray"));if(!r)throw new e(t.logMessage(t.LEVEL_SEVERE,"Vec3","averageBuffer","missingResult"));var n=i.length/3;r[0]=0,r[1]=0,r[2]=0;for(var o=0;o<n;o++)r[0]+=i[3*o]/n,r[1]+=i[3*o+1]/n,r[2]+=i[3*o+2]/n;return r},i.areColinear=function(r,n,o){if(!r||!n||!o)throw new e(t.logMessage(t.LEVEL_SEVERE,"Vec3","areColinear","missingVector"));var s=new i(r[0]-n[0],r[1]-n[1],r[2]-n[2]).normalize(),a=new i(o[0]-n[0],o[1]-n[1],o[2]-n[2]).normalize();return Math.abs(s.dot(a))>.999},i.computeTriangleNormal=function(r,n,o){if(!r||!n||!o)throw new e(t.logMessage(t.LEVEL_SEVERE,"Vec3","areColinear","missingVector"));var s=(n[1]-r[1])*(o[2]-r[2])-(n[2]-r[2])*(o[1]-r[1]),a=(n[2]-r[2])*(o[0]-r[0])-(n[0]-r[0])*(o[2]-r[2]),l=(n[0]-r[0])*(o[1]-r[1])-(n[1]-r[1])*(o[0]-r[0]),h=s*s+a*a+l*l;return 0===h?new i(s,a,l):(h=Math.sqrt(h),new i(s/h,a/h,l/h))},i.findThreeIndependentVertices=function(t,e){var r=e&&e>0?e:3;if(!t||t.length<3*r)return null;for(var n=new i(t[0],t[1],t[2]),o=null,s=null,a=r;a<t.length&&(o=new i(t[a],t[a+1],t[a+2]),o[0]===n[0]&&o[1]===n[1]&&o[2]===n[2]);a+=r)o=null;if(!o)return null;for(a+=r;a<t.length&&(s=new i(t[a],t[a+1],t[a+2]),s[0]===n[0]&&s[1]===n[1]&&s[2]===n[2]||s[0]===o[0]&&s[1]===o[1]&&s[2]===o[2]||i.areColinear(n,o,s));a+=r)s=null;return s?[n,o,s]:null},i.computeBufferNormal=function(t,e){var r=i.findThreeIndependentVertices(t,e);return r?i.computeTriangleNormal(r[0],r[1],r[2]):null},i.prototype.set=function(t,e,i){return this[0]=t,this[1]=e,this[2]=i,this},i.prototype.copy=function(i){if(!i)throw new e(t.logMessage(t.LEVEL_SEVERE,"Vec3","copy","missingVector"));return this[0]=i[0],this[1]=i[1],this[2]=i[2],this},i.prototype.equals=function(t){return this[0]===t[0]&&this[1]===t[1]&&this[2]===t[2]},i.prototype.add=function(i){if(!i)throw new e(t.logMessage(t.LEVEL_SEVERE,"Vec3","add","missingVector"));return this[0]+=i[0],this[1]+=i[1],this[2]+=i[2],this},i.prototype.subtract=function(i){if(!i)throw new e(t.logMessage(t.LEVEL_SEVERE,"Vec3","subtract","missingVector"));return this[0]-=i[0],this[1]-=i[1],this[2]-=i[2],this},i.prototype.multiply=function(t){return this[0]*=t,this[1]*=t,this[2]*=t,this},i.prototype.divide=function(t){return this[0]/=t,this[1]/=t,this[2]/=t,this},i.prototype.multiplyByMatrix=function(i){if(!i)throw new e(t.logMessage(t.LEVEL_SEVERE,"Vec3","multiplyByMatrix","missingMatrix"));var r=i[0]*this[0]+i[1]*this[1]+i[2]*this[2]+i[3],n=i[4]*this[0]+i[5]*this[1]+i[6]*this[2]+i[7],o=i[8]*this[0]+i[9]*this[1]+i[10]*this[2]+i[11],s=i[12]*this[0]+i[13]*this[1]+i[14]*this[2]+i[15];return this[0]=r/s,this[1]=n/s,this[2]=o/s,this},i.prototype.mix=function(i,r){if(!i)throw new e(t.logMessage(t.LEVEL_SEVERE,"Vec3","mix","missingVector"));var n=1-r,o=r;return this[0]=this[0]*n+i[0]*o,this[1]=this[1]*n+i[1]*o,this[2]=this[2]*n+i[2]*o,this},i.prototype.negate=function(){return this[0]=-this[0],this[1]=-this[1],this[2]=-this[2],this},i.prototype.dot=function(i){if(!i)throw new e(t.logMessage(t.LEVEL_SEVERE,"Vec3","dot","missingVector"));return this[0]*i[0]+this[1]*i[1]+this[2]*i[2]},i.prototype.cross=function(i){if(!i)throw new e(t.logMessage(t.LEVEL_SEVERE,"Vec3","cross","missingVector"));var r=this[1]*i[2]-this[2]*i[1],n=this[2]*i[0]-this[0]*i[2],o=this[0]*i[1]-this[1]*i[0];return this[0]=r,this[1]=n,this[2]=o,this},i.prototype.magnitudeSquared=function(){return this.dot(this)},i.prototype.magnitude=function(){return Math.sqrt(this.magnitudeSquared())},i.prototype.normalize=function(){var t=this.magnitude(),e=1/t;return this[0]*=e,this[1]*=e,this[2]*=e,this},i.prototype.distanceToSquared=function(i){if(!i)throw new e(t.logMessage(t.LEVEL_SEVERE,"Vec3","distanceToSquared","missingVector"));var r=this[0]-i[0],n=this[1]-i[1],o=this[2]-i[2];return r*r+n*n+o*o},i.prototype.distanceTo=function(i){if(!i)throw new e(t.logMessage(t.LEVEL_SEVERE,"Vec3","distanceTo","missingVector"));return Math.sqrt(this.distanceToSquared(i))},i.prototype.swap=function(t){var e=this[0];return this[0]=t[0],t[0]=e,e=this[1],this[1]=t[1],t[1]=e,e=this[2],this[2]=t[2],t[2]=e,this},i.prototype.toString=function(){return"("+this[0]+", "+this[1]+", "+this[2]+")"},i}),i("geom/Vec2",["../util/Logger","../error/ArgumentError","../geom/Vec3"],function(t,e,i){"use strict";var r=function(t,e){this[0]=t,this[1]=e};return r.prototype=new Float64Array(2),r.prototype.set=function(t,e){return this[0]=t,this[1]=e,this},r.prototype.copy=function(i){if(!i)throw new e(t.logMessage(t.LEVEL_SEVERE,"Vec2","copy","missingVector"));return this[0]=i[0],this[1]=i[1],this},r.prototype.equals=function(t){return this[0]===t[0]&&this[1]===t[1]},r.average=function(i,r){if(!i||i.length<1)throw new e(t.logMessage(t.LEVEL_SEVERE,"Vec2","average","missingArray"));if(!r)throw new e(t.logMessage(t.LEVEL_SEVERE,"Vec2","average","missingResult"));var n,o=i.length;r[0]=0,r[1]=0;for(var s=0,a=i.length;s<a;s++)n=i[s],r[0]+=n[0]/o,r[1]+=n[1]/o;return r},r.prototype.add=function(i){if(!i)throw new e(t.logMessage(t.LEVEL_SEVERE,"Vec2","add","missingVector"));return this[0]+=i[0],this[1]+=i[1],this},r.prototype.subtract=function(i){if(!i)throw new e(t.logMessage(t.LEVEL_SEVERE,"Vec2","subtract","missingVector"));return this[0]-=i[0],this[1]-=i[1],this},r.prototype.multiply=function(t){return this[0]*=t,this[1]*=t,this},r.prototype.divide=function(t){return this[0]/=t,this[1]/=t,this},r.prototype.mix=function(i,r){if(!i)throw new e(t.logMessage(t.LEVEL_SEVERE,"Vec2","mix","missingVector"));var n=1-r,o=r;return this[0]=this[0]*n+i[0]*o,this[1]=this[1]*n+i[1]*o,this},r.prototype.negate=function(){return this[0]=-this[0],this[1]=-this[1],this},r.prototype.dot=function(i){if(!i)throw new e(t.logMessage(t.LEVEL_SEVERE,"Vec2","dot","missingVector"));return this[0]*i[0]+this[1]*i[1]},r.prototype.magnitudeSquared=function(){return this.dot(this)},r.prototype.magnitude=function(){return Math.sqrt(this.magnitudeSquared())},r.prototype.normalize=function(){var t=this.magnitude(),e=1/t;return this[0]*=e,this[1]*=e,this},r.prototype.distanceToSquared=function(i){if(!i)throw new e(t.logMessage(t.LEVEL_SEVERE,"Vec2","distanceToSquared","missingVector"));var r=this[0]-i[0],n=this[1]-i[1];return r*r+n*n},r.prototype.distanceTo=function(i){if(!i)throw new e(t.logMessage(t.LEVEL_SEVERE,"Vec2","distanceTo","missingVector"));return Math.sqrt(this.distanceToSquared(i))},r.prototype.toVec3=function(){return new i(this[0],this[1],0)},r.prototype.swap=function(t){var e=this[0];return this[0]=t[0],t[0]=e,e=this[1],this[1]=t[1],t[1]=e,this},r.prototype.toString=function(){return"("+this[0]+", "+this[1]+")"},r}),i("util/Offset",["../geom/Vec2"],function(t){"use strict";var e=function(t,e,i,r){this.x=e,this.y=r,this.xUnits=t,this.yUnits=i};return e.prototype.clone=function(){return new e(this.xUnits,this.x,this.yUnits,this.y)},e.prototype.offsetForSize=function(e,i){var r,n;return r=this.xUnits==WorldWind.OFFSET_FRACTION?e*this.x:this.xUnits==WorldWind.OFFSET_INSET_PIXELS?e-this.x:this.x,n=this.yUnits==WorldWind.OFFSET_FRACTION?i*this.y:this.yUnits==WorldWind.OFFSET_INSET_PIXELS?i-this.y:this.y,new t(r,n)},e.prototype.toString=function(){return this.xUnits+" "+this.x+" "+this.yUnits+" "+this.y},e}),i("shapes/TextAttributes",["../util/Color","../util/Font","../util/Offset"],function(t,e,i){"use strict";var r=function(r){this._color=r?r._color:new t(1,1,1,1),this._font=r?r._font:new e(14),this._offset=r?r._offset:new i(WorldWind.OFFSET_FRACTION,.5,WorldWind.OFFSET_FRACTION,0),this._scale=r?r._scale:1,this._depthTest=!!r&&r._depthTest,this.stateKeyInvalid=!0};return r.prototype.computeStateKey=function(){return"c "+this._color.toHexString(!0)+" f "+this._font.toString()+" o "+this._offset.toString()+" s "+this._scale+" dt "+this._depthTest},Object.defineProperties(r.prototype,{stateKey:{get:function(){return this.stateKeyInvalid&&(this._stateKey=this.computeStateKey(),this.stateKeyInvalid=!1),this._stateKey}},color:{get:function(){return this._color},set:function(t){this._color=t,this.stateKeyInvalid=!0}},font:{get:function(){return this._font},set:function(t){this._font=t,this.stateKeyInvalid=!0}},offset:{get:function(){return this._offset},set:function(t){this._offset=t,this.stateKeyInvalid=!0}},scale:{get:function(){return this._scale},set:function(t){this._scale=t,this.stateKeyInvalid=!0}},depthTest:{get:function(){return this._depthTest},set:function(t){this._depthTest=t,this.stateKeyInvalid=!0}}}),r}),i("shapes/AnnotationAttributes",["../util/Color","../util/Font","../util/Insets","../shapes/TextAttributes"],function(t,e,i,r){"use strict";var n=function(e){this._cornerRadius=e?e._cornerRadius:0,this._insets=e?e._insets:new i(0,0,0,0),this._backgroundColor=e?e._backgroundColor:t.WHITE,this._leaderGapWidth=e?e._leaderGapWidth:40,this._leaderGapHeight=e?e._leaderGapHeight:30,this._opacity=e?e._opacity:1,this._scale=e?e._scale:1,this._drawLeader=!e||e._drawLeader,this._width=e?e._width:200,this._height=e?e._height:100,this._textAttributes=e?e._textAttributes:new r(null),this.stateKeyInvalid=!0};return n.prototype.computeStateKey=function(){return"wi "+this._width+" he "+this._height+" cr "+this._cornerRadius+" in "+this._insets.toString()+" bg "+this.backgroundColor.toHexString(!0)+" dl "+this.drawLeader+" lgw "+this.leaderGapWidth+" lgh "+this.leaderGapHeight+" op "+this.opacity+" ta "+this._textAttributes.stateKey+" sc "+this.scale},Object.defineProperties(n.prototype,{width:{get:function(){return this._width},set:function(t){this._width=t,this.stateKeyInvalid=!0}},height:{get:function(){return this._height},set:function(t){this._height=t,this.stateKeyInvalid=!0}},cornerRadius:{get:function(){return this._cornerRadius},set:function(t){this._cornerRadius=t,this.stateKeyInvalid=!0}},insets:{get:function(){return this._insets},set:function(t){this._insets=t,this.stateKeyInvalid=!0}},backgroundColor:{get:function(){return this._backgroundColor},set:function(t){this._backgroundColor=t,this.stateKeyInvalid=!0}},textAttributes:{get:function(){return this._textAttributes},set:function(t){this._textAttributes=t,this.stateKeyInvalid=!0}},drawLeader:{get:function(){return this._drawLeader},set:function(t){this._drawLeader=t,this.stateKeyInvalid=!0}},leaderGapWidth:{get:function(){return this._leaderGapWidth},set:function(t){this._leaderGapWidth=t,this.stateKeyInvalid=!0}},leaderGapHeight:{get:function(){return this._leaderGapHeight},set:function(t){this._leaderGapHeight=t,this.stateKeyInvalid=!0}},opacity:{get:function(){return this._opacity},set:function(t){this._opacity=t,this.stateKeyInvalid=!0}},scale:{get:function(){return this._scale},set:function(t){this._scale=t,this.stateKeyInvalid=!0}},stateKey:{get:function(){return this.stateKeyInvalid&&(this._stateKey=this.computeStateKey(),this.stateKeyInvalid=!1),this._stateKey}}}),n}),i("shaders/GpuShader",["../error/ArgumentError","../util/Logger"],function(t,e){"use strict";var i=function(i,r,n){if(r!==i.VERTEX_SHADER&&r!==i.FRAGMENT_SHADER)throw new t(e.logMessage(e.LEVEL_SEVERE,"GpuShader","constructor","The specified shader type is unrecognized."));if(!n)throw new t(e.logMessage(e.LEVEL_SEVERE,"GpuShader","constructor","The specified shader source is null or undefined."));var o=i.createShader(r);if(!o)throw new t(e.logMessage(e.LEVEL_SEVERE,"GpuShader","constructor","Unable to create shader of type "+(r==i.VERTEX_SHADER?"VERTEX_SHADER.":"FRAGMENT_SHADER.")));if(!this.compile(i,o,r,n)){var s=i.getShaderInfoLog(o);throw i.deleteShader(o),new t(e.logMessage(e.LEVEL_SEVERE,"GpuShader","constructor","Unable to compile shader: "+s))}this.shaderId=o};return i.prototype.compile=function(t,e,i,r){return t.shaderSource(e,r),t.compileShader(e),t.getShaderParameter(e,t.COMPILE_STATUS)},i.prototype.dispose=function(t){this.shaderId&&(t.deleteShader(this.shaderId),delete this.shaderId)},i}),i("shaders/GpuProgram",["../error/ArgumentError","../util/Color","../shaders/GpuShader","../util/Logger"],function(t,e,i,r){"use strict";var n=function(e,n,o,s){if(!n||!o)throw new t(r.logMessage(r.LEVEL_SEVERE,"GpuProgram","constructor","The specified shader source is null or undefined."));var a,l,h;try{l=new i(e,e.VERTEX_SHADER,n),h=new i(e,e.FRAGMENT_SHADER,o)}catch(t){throw l&&l.dispose(e),h&&h.dispose(e),t}if(!(a=e.createProgram()))throw new t(r.logMessage(r.LEVEL_SEVERE,"GpuProgram","constructor","Unable to create shader program."));if(e.attachShader(a,l.shaderId),e.attachShader(a,h.shaderId),s)for(var u=0,c=s.length;u<c;u++)e.bindAttribLocation(a,u,s[u]);if(!this.link(e,a)){var d=e.getProgramInfoLog(a);throw e.detachShader(a,l.shaderId),e.detachShader(a,h.shaderId),e.deleteProgram(a),l.dispose(e),h.dispose(e),new t(r.logMessage(r.LEVEL_SEVERE,"GpuProgram","constructor","Unable to link shader program: "+d))}this.programId=a,this.attributeLocations={},this.uniformLocations={},this.vertexShader=l,this.fragmentShader=h,this.size=n.length+o.length,this.scratchArray=new Float32Array(16)};return n.prototype.dispose=function(t){this.programId&&(this.vertexShader&&t.detachShader(this.programId,this.vertexShader.shaderId),this.fragmentShader&&t.detachShader(this.programId,this.fragmentShader.shaderId),t.deleteProgram(this.programId),delete this.programId),this.vertexShader&&(this.vertexShader.dispose(t),delete this.vertexShader),this.fragmentShader&&(this.fragmentShader.dispose(t),delete this.fragmentShader),this.attributeLocations={},this.uniformLocations={}},n.prototype.attributeLocation=function(e,i){if(!i||0==i.length)throw new t(r.logMessage(r.LEVEL_SEVERE,"GpuProgram","attributeLocation","The specified attribute name is null, undefined or empty."));var n=this.attributeLocations[i];return n||(n=e.getAttribLocation(this.programId,i),this.attributeLocations[i]=n),n},n.prototype.uniformLocation=function(e,i){if(!i||0==i.length)throw new t(r.logMessage(r.LEVEL_SEVERE,"GpuProgram","uniformLocation","The specified uniform name is null, undefined or empty."));var n=this.uniformLocations[i];return n||(n=e.getUniformLocation(this.programId,i),this.uniformLocations[i]=n),n},n.prototype.link=function(t,e){return t.linkProgram(e),t.getProgramParameter(e,t.LINK_STATUS)},n.prototype.loadUniformMatrix=function(e,i,n){if(!i)throw new t(r.logMessage(r.LEVEL_SEVERE,"GpuProgram","loadUniformMatrix","missingMatrix"));var o=i.columnMajorComponents(this.scratchArray);e.uniformMatrix4fv(n,!1,o)},n.prototype.loadUniformColor=function(e,i,n){if(!i)throw new t(r.logMessage(r.LEVEL_SEVERE,"GpuProgram","loadUniformColor","missingColor"));var o=i.premultipliedComponents(this.scratchArray);e.uniform4f(n,o[0],o[1],o[2],o[3])},n.prototype.loadUniformColorComponents=function(t,e,i,r,n,o){t.uniform4f(o,e*n,i*n,r*n,n)},n}),i("shaders/BasicTextureProgram",["../error/ArgumentError","../util/Color","../shaders/GpuProgram","../util/Logger"],function(t,e,i,r){"use strict";var n=function(t){var e=["vertexPoint","normalVector","vertexTexCoord"];i.call(this,t,"attribute vec4 vertexPoint;\nattribute vec4 vertexTexCoord;\nattribute vec4 normalVector;\nuniform mat4 mvpMatrix;\nuniform mat4 mvInverseMatrix;\nuniform mat4 texCoordMatrix;\nuniform bool applyLighting;\nvarying vec2 texCoord;\nvarying vec4 normal;\nvoid main() {gl_Position = mvpMatrix * vertexPoint;\ntexCoord = (texCoordMatrix * vertexTexCoord).st;\nif (applyLighting) {normal = mvInverseMatrix * normalVector;}\n}","precision mediump float;\nuniform float opacity;\nuniform vec4 color;\nuniform bool enableTexture;\nuniform bool modulateColor;\nuniform sampler2D textureSampler;\nuniform bool applyLighting;\nvarying vec2 texCoord;\nvarying vec4 normal;\nvoid main() {\nvec4 textureColor = texture2D(textureSampler, texCoord);\nfloat ambient = 0.15; vec4 lightDirection = vec4(0, 0, 1, 0);\nif (enableTexture && !modulateColor)\n    gl_FragColor = textureColor * color * opacity;\nelse if (enableTexture && modulateColor)\n    gl_FragColor = color * floor(textureColor.a + 0.5);\nelse\n    gl_FragColor = color * opacity;\nif (gl_FragColor.a == 0.0) {discard;}\nif (applyLighting) {\n    vec4 n = normal * (gl_FrontFacing ? 1.0 : -1.0);\n    gl_FragColor.rgb *= clamp(ambient + dot(lightDirection, n), 0.0, 1.0);\n}\n}",e),this.vertexPointLocation=this.attributeLocation(t,"vertexPoint"),this.normalVectorLocation=this.attributeLocation(t,"normalVector"),this.vertexTexCoordLocation=this.attributeLocation(t,"vertexTexCoord"),this.mvpMatrixLocation=this.uniformLocation(t,"mvpMatrix"),this.mvInverseMatrixLocation=this.uniformLocation(t,"mvInverseMatrix"),this.colorLocation=this.uniformLocation(t,"color"),this.textureEnabledLocation=this.uniformLocation(t,"enableTexture"),this.modulateColorLocation=this.uniformLocation(t,"modulateColor"),this.textureUnitLocation=this.uniformLocation(t,"textureSampler"),this.textureMatrixLocation=this.uniformLocation(t,"texCoordMatrix"),this.opacityLocation=this.uniformLocation(t,"opacity"),this.applyLightingLocation=this.uniformLocation(t,"applyLighting")};return n.key="WorldWindGpuBasicTextureProgram",n.prototype=Object.create(i.prototype),n.prototype.loadModelviewInverse=function(e,i){if(!i)throw new t(r.logMessage(r.LEVEL_SEVERE,"BasicTextureProgram","loadModelviewInverse","missingMatrix"));this.loadUniformMatrix(e,i,this.mvInverseMatrixLocation)},n.prototype.loadModelviewProjection=function(e,i){
if(!i)throw new t(r.logMessage(r.LEVEL_SEVERE,"BasicTextureProgram","loadModelviewProjection","missingMatrix"));this.loadUniformMatrix(e,i,this.mvpMatrixLocation)},n.prototype.loadColor=function(e,i){if(!i)throw new t(r.logMessage(r.LEVEL_SEVERE,"BasicTextureProgram","loadColor","missingColor"));this.loadUniformColor(e,i,this.colorLocation)},n.prototype.loadTextureEnabled=function(t,e){t.uniform1i(this.textureEnabledLocation,e?1:0)},n.prototype.loadModulateColor=function(t,e){t.uniform1i(this.modulateColorLocation,e?1:0)},n.prototype.loadTextureUnit=function(t,e){t.uniform1i(this.textureUnitLocation,e-t.TEXTURE0)},n.prototype.loadTextureMatrix=function(t,e){this.loadUniformMatrix(t,e,this.textureMatrixLocation)},n.prototype.loadOpacity=function(t,e){t.uniform1f(this.opacityLocation,e)},n.prototype.loadApplyLighting=function(t,e){t.uniform1i(this.applyLightingLocation,e)},n}),i("geom/Line",["../error/ArgumentError","../util/Logger","../geom/Vec3"],function(t,e,i){"use strict";var r=function(i,r){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"Line","constructor","Origin is null or undefined."));if(!r)throw new t(e.logMessage(e.LEVEL_SEVERE,"Line","constructor","Direction is null or undefined."));this.origin=i,this.direction=r};return r.fromSegment=function(n,o){if(!n||!o)throw new t(e.logMessage(e.LEVEL_SEVERE,"Line","fromSegment","missingPoint"));var s=new i(n[0],n[1],n[2]),a=new i(o[0]-n[0],o[1]-n[1],o[2]-n[2]);return new r(s,a)},r.prototype.pointAt=function(i,r){if(!r)throw new t(e.logMessage(e.LEVEL_SEVERE,"Line","pointAt","missingResult."));return r[0]=this.origin[0]+this.direction[0]*i,r[1]=this.origin[1]+this.direction[1]*i,r[2]=this.origin[2]+this.direction[2]*i,r},r}),i("geom/Plane",["../error/ArgumentError","../geom/Line","../util/Logger","../geom/Vec3"],function(t,e,i,r){"use strict";var n=function(t,e,i,n){this.normal=new r(t,e,i),this.distance=n};return n.fromPoints=function(e,o,s){if(!e||!o||!s)throw new t(i.logMessage(i.LEVEL_SEVERE,"Plane","fromPoints","missingVector"));var a=new r(o[0],o[1],o[2]);a.subtract(e);var l=new r(s[0],s[1],s[2]);l.subtract(e),a.cross(l),a.normalize();var h=-a.dot(e);return new n(a[0],a[1],a[2],h)},n.prototype.dot=function(e){if(!e)throw new t(i.logMessage(i.LEVEL_SEVERE,"Plane","dot","missingVector"));return this.normal.dot(e)+this.distance},n.prototype.distanceToPoint=function(t){return this.dot(t)},n.prototype.transformByMatrix=function(e){if(!e)throw new t(i.logMessage(i.LEVEL_SEVERE,"Plane","transformByMatrix","missingMatrix"));var r=e[0]*this.normal[0]+e[1]*this.normal[1]+e[2]*this.normal[2]+e[3]*this.distance,n=e[4]*this.normal[0]+e[5]*this.normal[1]+e[6]*this.normal[2]+e[7]*this.distance,o=e[8]*this.normal[0]+e[9]*this.normal[1]+e[10]*this.normal[2]+e[11]*this.distance,s=e[12]*this.normal[0]+e[13]*this.normal[1]+e[14]*this.normal[2]+e[15]*this.distance;return this.normal[0]=r,this.normal[1]=n,this.normal[2]=o,this.distance=s,this},n.prototype.normalize=function(){var t=this.normal.magnitude();return 0===t?this:(this.normal.divide(t),this.distance/=t,this)},n.prototype.intersectsSegment=function(t,e){return this.dot(t)*this.dot(e)<=0},n.prototype.intersectsSegmentAt=function(t,e,i){var r=this.dot(t),n=this.dot(e);if(0===r&&0===n)return i[0]=t[0],i[1]=t[1],i[2]=t[2],!0;if(r===n)return!1;var o=-r/(n-r),s=1-o;return i[0]=o*t[0]+s*e[0],i[1]=o*t[1]+s*e[1],i[2]=o*t[2]+s*e[2],r*n<=0},n.prototype.onSameSide=function(e,r){if(!e||!r)throw new t(i.logMessage(i.LEVEL_SEVERE,"Plane","onSameSide","missingPoint"));var n=this.distanceToPoint(e),o=this.distanceToPoint(r);return n<0&&o<0?-1:n>0&&o>0?1:0},n.prototype.clip=function(n,o){if(!n||!o)throw new t(i.logMessage(i.LEVEL_SEVERE,"Plane","clip","missingPoint"));if(n.equals(o))return null;var s,a,l,h=e.fromSegment(n,o),u=this.normal.dot(h.direction);return 0===u?(s=this.dot(h.origin),0===s?[n,o]:null):(a=-this.dot(h.origin)/u)<0||a>1?null:(l=h.pointAt(a,new r(0,0,0)),u>0?[l,o]:[n,l])},n}),i("geom/Rectangle",["../util/Logger"],function(t){"use strict";var e=function(t,e,i,r){this.x=t,this.y=e,this.width=i,this.height=r};return e.prototype.set=function(t,e,i,r){this.x=t,this.y=e,this.width=i,this.height=r},e.prototype.getMinX=function(){return this.x},e.prototype.getMinY=function(){return this.y},e.prototype.getMaxX=function(){return this.x+this.width},e.prototype.getMaxY=function(){return this.y+this.height},e.prototype.containsPoint=function(t){return t[0]>=this.x&&t[0]<=this.x+this.width&&t[1]>=this.y&&t[1]<=this.y+this.height},e.prototype.intersects=function(t){return!(t.x+t.width<this.x)&&(!(t.x>this.x+this.width)&&(!(t.y+t.height<this.y)&&!(t.y>this.y+this.height)))},e.prototype.intersectsRectangles=function(t){if(t)for(var e=0;e<t.length;e++)if(this.intersects(t[e]))return!0;return!1},e.prototype.toString=function(){return this.x+", "+this.y+", "+this.width+", "+this.height},e}),i("util/WWMath",["../geom/Angle","../error/ArgumentError","../geom/Line","../util/Logger","../geom/Rectangle","../geom/Vec3"],function(t,e,i,r,n,o){"use strict";var s={clamp:function(t,e,i){return t<e?e:t>i?i:t},interpolate:function(t,e,i){return(1-t)*e+t*i},cbrt:function(t){return"function"==typeof Math.cbrt?Math.cbrt(t):Math.pow(t,1/3)},computeEllipsoidalGlobeIntersection:function(t,i,n,o){if(!t)throw new e(r.logMessage(r.LEVEL_SEVERE,"WWMath","computeEllipsoidalGlobeIntersection","missingLine"));if(!o)throw new e(r.logMessage(r.LEVEL_SEVERE,"WWMath","computeEllipsoidalGlobeIntersection","missingResult"));var s,a=t.direction[0],l=t.direction[1],h=t.direction[2],u=t.origin[0],c=t.origin[1],d=t.origin[2],p=i/n,f=p*p,g=i*i,m=a*a+f*l*l+h*h,E=2*(u*a+f*c*l+d*h),y=u*u+f*c*c+d*d-g,_=E*E-4*m*y;return!(_<0)&&(s=(-E-Math.sqrt(_))/(2*m),o[0]=u+a*s,o[1]=c+l*s,o[2]=d+h*s,!0)},computeTriangleIntersection:function(t,i,n,o,s){if(!t)throw new e(r.logMessage(r.LEVEL_SEVERE,"WWMath","computeTriangleIntersection","missingLine"));if(!i||!n||!o)throw new e(r.logMessage(r.LEVEL_SEVERE,"WWMath","computeTriangleIntersection","missingVertex"));if(!s)throw new e(r.logMessage(r.LEVEL_SEVERE,"WWMath","computeTriangleIntersection","missingResult"));var a=t.direction[0],l=t.direction[1],h=t.direction[2],u=t.origin[0],c=t.origin[1],d=t.origin[2],p=n[0]-i[0],f=n[1]-i[1],g=n[2]-i[2],m=o[0]-i[0],E=o[1]-i[1],y=o[2]-i[2],_=l*y-h*E,v=h*m-a*y,S=a*E-l*m,b=p*_+f*v+g*S;if(b>-1e-5&&b<1e-5)return!1;var T=1/b,L=u-i[0],w=c-i[1],R=d-i[2],x=T*(L*_+w*v+R*S);if(x<-1e-5||x>1+1e-5)return!1;var M=w*g-R*f,C=R*p-L*g,A=L*f-w*p,P=T*(a*M+l*C+h*A);if(P<-1e-5||x+P>1+1e-5)return!1;var I=T*(m*M+E*C+y*A);return!(I<0)&&(s[0]=u+a*I,s[1]=c+l*I,s[2]=d+h*I,!0)},computeIndexedTrianglesIntersection:function(t,i,n,a){if(!t)throw new e(r.logMessage(r.LEVEL_SEVERE,"WWMath","computeIndexedTrianglesIntersection","missingLine"));if(!i)throw new e(r.logMessage(r.LEVEL_SEVERE,"WWMath","computeIndexedTrianglesIntersection","missingPoints"));if(!n)throw new e(r.logMessage(r.LEVEL_SEVERE,"WWMath","computeIndexedTrianglesIntersection","missingIndices"));if(!a)throw new e(r.logMessage(r.LEVEL_SEVERE,"WWMath","computeIndexedTrianglesIntersection","missingResults"));for(var l=new o(0,0,0),h=new o(0,0,0),u=new o(0,0,0),c=new o(0,0,0),d=0,p=n.length;d<p;d+=3){var f=3*n[d],g=3*n[d+1],m=3*n[d+2];l[0]=i[f],l[1]=i[f+1],l[2]=i[f+2],h[0]=i[g],h[1]=i[g+1],h[2]=i[g+2],u[0]=i[m],u[1]=i[m+1],u[2]=i[m+2],s.computeTriangleIntersection(t,l,h,u,c)&&(a.push(c),c=new o(0,0,0))}return a.length>0},computeTriStripIntersections:function(t,i,n,s){if(!t)throw new e(r.logMessage(r.LEVEL_SEVERE,"WWMath","computeTriStripIntersections","missingLine"));if(!i)throw new e(r.logMessage(r.LEVEL_SEVERE,"WWMath","computeTriStripIntersections","missingPoints"));if(!n)throw new e(r.logMessage(r.LEVEL_SEVERE,"WWMath","computeTriStripIntersections","missingIndices"));if(!s)throw new e(r.logMessage(r.LEVEL_SEVERE,"WWMath","computeTriStripIntersections","missingResults"));var a,l,h,u,c,d,p,f,g,m,E,y,_,v,S,b,T,L,w,R,x,M,C,A,P,I,O,N,D,k,V=t.direction[0],F=t.direction[1],G=t.direction[2],W=t.origin[0],B=t.origin[1],U=t.origin[2];k=3*n[0],u=i[k++],c=i[k++],d=i[k],k=3*n[1],p=i[k++],f=i[k++],g=i[k];for(var K=2,j=n.length;K<j;K++)a=u,l=c,h=d,u=p,c=f,d=g,k=3*n[K],p=i[k++],f=i[k++],g=i[k],m=u-a,E=c-l,y=d-h,_=p-a,v=f-l,S=g-h,b=F*S-G*v,T=G*_-V*S,L=V*v-F*_,(N=m*b+E*T+y*L)>-1e-5&&N<1e-5||(D=1/N,w=W-a,R=B-l,x=U-h,(P=D*(w*b+R*T+x*L))<-1e-5||P>1+1e-5||(M=R*y-x*E,C=x*m-w*y,A=w*E-R*m,(I=D*(V*M+F*C+G*A))<-1e-5||P+I>1+1e-5||(O=D*(_*M+v*C+S*A))>=0&&s.push(new o(W+V*O,B+F*O,U+G*O))))},fabs:function(t){return t>=0?t:-t},fmod:function(t,e){return 0===e?0:t-Math.floor(t/e)*e},fract:function(t){return t-Math.floor(t)},mod:function(t,e){return(t%e+e)%e},max:function(t,e){return t>e?t:e},localCoordinateAxesAtPoint:function(t,i,n,o,s){if(!t)throw new e(r.logMessage(r.LEVEL_SEVERE,"WWMath","localCoordinateAxesAtPoint","missingVector"));if(!i)throw new e(r.logMessage(r.LEVEL_SEVERE,"WWMath","localCoordinateAxesAtPoint","missingGlobe"));if(!n||!o||!s)throw new e(r.logMessage(r.LEVEL_SEVERE,"WWMath","localCoordinateAxesAtPoint","missingResult"));var a=t[0],l=t[1],h=t[2];i.surfaceNormalAtPoint(a,l,h,s),i.northTangentAtPoint(a,l,h,o),n.set(o[0],o[1],o[2]),n.cross(s),n.normalize(),o.set(s[0],s[1],s[2]),o.cross(n),o.normalize()},horizonDistanceForGlobeRadius:function(t,i){if(t<0)throw new e(r.logMessage(r.LEVEL_SEVERE,"WWMath","horizontalDistanceForGlobeRadius","The specified globe radius is negative."));return t>0&&i>0?Math.sqrt(i*(2*t+i)):0},perspectiveNearDistanceForFarDistance:function(t,i,n){if(t<0)throw new e(r.logMessage(r.LEVEL_SEVERE,"WWMath","perspectiveNearDistanceForFarDistance","The specified distance is negative."));if(i<0)throw new e(r.logMessage(r.LEVEL_SEVERE,"WWMath","perspectiveNearDistanceForFarDistance","The specified resolution is negative."));if(n<1)throw new e(r.logMessage(r.LEVEL_SEVERE,"WWMath","perspectiveNearDistanceForFarDistance","The specified depth bits is negative."));var o=(1<<n)-1;return t/(o/(1-i/t)-o+1)},perspectiveNearDistance:function(t,i,n){if(t<=0)throw new e(r.logMessage(r.LEVEL_SEVERE,"WWMath","perspectiveNearDistance","invalidWidth"));if(i<=0)throw new e(r.logMessage(r.LEVEL_SEVERE,"WWMath","perspectiveNearDistance","invalidHeight"));if(n<0)throw new e(r.logMessage(r.LEVEL_SEVERE,"WWMath","perspectiveNearDistance","The specified distance is negative."));var o=i/t;return 2*n/Math.sqrt(o*o+5)},perspectiveFrustumRectangle:function(t,i,o){if(t<=0)throw new e(r.logMessage(r.LEVEL_SEVERE,"WWMath","perspectiveFrustumRectangle","invalidWidth"));if(i<=0)throw new e(r.logMessage(r.LEVEL_SEVERE,"WWMath","perspectiveFrustumRectangle","invalidHeight"));if(o<0)throw new e(r.logMessage(r.LEVEL_SEVERE,"WWMath","perspectiveFrustumRectangle","The specified distance is negative."));var s=o,a=o*i/t;return new n(-s/2,-a/2,s,a)},perspectivePixelSize:function(t,i,n){if(t<=0)throw new e(r.logMessage(r.LEVEL_SEVERE,"WWMath","perspectivePixelSize","invalidWidth"));if(i<=0)throw new e(r.logMessage(r.LEVEL_SEVERE,"WWMath","perspectivePixelSize","invalidHeight"));if(n<0)throw new e(r.logMessage(r.LEVEL_SEVERE,"WWMath","perspectivePixelSize","The specified distance is negative."));return s.perspectiveFrustumRectangle(t,i,n).height/i},boundingRectForUnitQuad:function(t){if(!t)throw new e(r.logMessage(r.LEVEL_SEVERE,"WWMath","boundingRectForUnitQuad","missingMatrix"));var i=t,o=i[3],s=i[7],a=i[0]+i[3],l=i[4]+i[7],h=i[1]+i[3],u=i[5]+i[7],c=i[0]+i[1]+i[3],d=i[4]+i[5]+i[7],p=Math.min(Math.min(o,a),Math.min(h,c)),f=Math.max(Math.max(o,a),Math.max(h,c)),g=Math.min(Math.min(s,l),Math.min(u,d)),m=Math.max(Math.max(s,l),Math.max(u,d));return new n(p,g,f-p,m-g)},isPowerOfTwo:function(t){return 0!=t&&0==(t&t-1)},signum:function(t){return t>0?1:t<0?-1:0},gudermannianInverse:function(e){return Math.log(Math.tan(Math.PI/4+e*t.DEGREES_TO_RADIANS/2))/Math.PI},epsg3857ToEpsg4326:function(e,i){var r=6378100,n=Math.PI/2-2*Math.atan(Math.exp(-i/r)),o=e/r;return[s.clamp(n*t.RADIANS_TO_DEGREES,-90,90),s.clamp(o*t.RADIANS_TO_DEGREES,-180,180)]},powerOfTwoFloor:function(t){var e=Math.floor(Math.log(t)/Math.log(2));return Math.pow(2,e)},normalizeAngle360:function(t){var e=t%360;return e>=0?e:e<0?360+e:360-e}};return s}),i("geom/Location",["../geom/Angle","../error/ArgumentError","../util/Logger","../geom/Plane","../geom/Vec3","../util/WWMath"],function(t,e,i,r,n,o){"use strict";var s=function(t,e){this.latitude=t,this.longitude=e};return s.ZERO=new s(0,0),s.fromRadians=function(e,i){return new s(e*t.RADIANS_TO_DEGREES,i*t.RADIANS_TO_DEGREES)},s.prototype.copy=function(t){if(!t)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","copy","missingLocation"));return this.latitude=t.latitude,this.longitude=t.longitude,this},s.prototype.set=function(t,e){return this.latitude=t,this.longitude=e,this},s.prototype.equals=function(t){return t&&t.latitude===this.latitude&&t.longitude===this.longitude},s.interpolateAlongPath=function(t,r,n,o,s){if(!n||!o)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","interpolateAlongPath","missingLocation"));if(!s)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","interpolateAlongPath","missingResult"));return t===WorldWind.GREAT_CIRCLE?this.interpolateGreatCircle(r,n,o,s):t&&t===WorldWind.RHUMB_LINE?this.interpolateRhumb(r,n,o,s):this.interpolateLinear(r,n,o,s)},s.interpolateGreatCircle=function(t,r,n,s){if(!r||!n)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","interpolateGreatCircle","missingLocation"));if(!s)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","interpolateGreatCircle","missingResult"));if(r.equals(n))return s.latitude=r.latitude,s.longitude=r.longitude,s;var a=o.clamp(t,0,1),l=this.greatCircleAzimuth(r,n),h=this.greatCircleDistance(r,n);return this.greatCircleLocation(r,l,a*h,s)},s.greatCircleAzimuth=function(r,n){if(!r||!n)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","greatCircleAzimuth","missingLocation"));var o,s,a,l=r.latitude*t.DEGREES_TO_RADIANS,h=n.latitude*t.DEGREES_TO_RADIANS,u=r.longitude*t.DEGREES_TO_RADIANS,c=n.longitude*t.DEGREES_TO_RADIANS;return l==h&&u==c?0:u==c?l>h?180:0:(s=Math.cos(h)*Math.sin(c-u),o=Math.cos(l)*Math.sin(h)-Math.sin(l)*Math.cos(h)*Math.cos(c-u),a=Math.atan2(s,o),isNaN(a)?0:a*t.RADIANS_TO_DEGREES)},s.greatCircleDistance=function(r,n){if(!r||!n)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","greatCircleDistance","missingLocation"));var o,s,a,l,h=r.latitude*t.DEGREES_TO_RADIANS,u=n.latitude*t.DEGREES_TO_RADIANS,c=r.longitude*t.DEGREES_TO_RADIANS,d=n.longitude*t.DEGREES_TO_RADIANS;return h==u&&c==d?0:(o=Math.sin((u-h)/2),s=Math.sin((d-c)/2),a=o*o+Math.cos(h)*Math.cos(u)*s*s,l=2*Math.asin(Math.sqrt(a)),isNaN(l)?0:l)},s.greatCircleLocation=function(r,n,o,s){if(!r)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","greatCircleLocation","missingLocation"));if(!s)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","greatCircleLocation","missingResult"));if(0==o)return s.latitude=r.latitude,s.longitude=r.longitude,s;var a,l,h=r.latitude*t.DEGREES_TO_RADIANS,u=r.longitude*t.DEGREES_TO_RADIANS,c=n*t.DEGREES_TO_RADIANS;return a=Math.asin(Math.sin(h)*Math.cos(o)+Math.cos(h)*Math.sin(o)*Math.cos(c)),l=u+Math.atan2(Math.sin(o)*Math.sin(c),Math.cos(h)*Math.cos(o)-Math.sin(h)*Math.sin(o)*Math.cos(c)),isNaN(a)||isNaN(l)?(s.latitude=r.latitude,s.longitude=r.longitude):(s.latitude=t.normalizedDegreesLatitude(a*t.RADIANS_TO_DEGREES),s.longitude=t.normalizedDegreesLongitude(l*t.RADIANS_TO_DEGREES)),s},s.interpolateRhumb=function(t,r,n,s){if(!r||!n)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","interpolateRhumb","missingLocation"));if(!s)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","interpolateRhumb","missingResult"));if(r.equals(n))return s.latitude=r.latitude,s.longitude=r.longitude,s;var a=o.clamp(t,0,1),l=this.rhumbAzimuth(r,n),h=this.rhumbDistance(r,n);return this.rhumbLocation(r,l,a*h,s)},s.rhumbAzimuth=function(r,n){if(!r||!n)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","rhumbAzimuth","missingLocation"));var s,a,l,h=r.latitude*t.DEGREES_TO_RADIANS,u=n.latitude*t.DEGREES_TO_RADIANS,c=r.longitude*t.DEGREES_TO_RADIANS,d=n.longitude*t.DEGREES_TO_RADIANS;return h==u&&c==d?0:(s=d-c,a=Math.log(Math.tan(u/2+Math.PI/4)/Math.tan(h/2+Math.PI/4)),o.fabs(s)>Math.PI&&(s=s>0?-(2*Math.PI-s):2*Math.PI+s),l=Math.atan2(s,a),isNaN(l)?0:l*t.RADIANS_TO_DEGREES)},s.rhumbDistance=function(r,n){if(!r||!n)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","rhumbDistance","missingLocation"));var s,a,l,h,u,c=r.latitude*t.DEGREES_TO_RADIANS,d=n.latitude*t.DEGREES_TO_RADIANS,p=r.longitude*t.DEGREES_TO_RADIANS,f=n.longitude*t.DEGREES_TO_RADIANS;return c==d&&p==f?0:(s=d-c,a=f-p,l=Math.log(Math.tan(d/2+Math.PI/4)/Math.tan(c/2+Math.PI/4)),h=s/l,(isNaN(l)||isNaN(h))&&(h=Math.cos(c)),o.fabs(a)>Math.PI&&(a=a>0?-(2*Math.PI-a):2*Math.PI+a),u=Math.sqrt(s*s+h*h*a*a),isNaN(u)?0:u)},s.rhumbLocation=function(r,n,s,a){if(!r)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","rhumbLocation","missingLocation"));if(!a)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","rhumbLocation","missingResult"));if(0==s)return a.latitude=r.latitude,a.longitude=r.longitude,a;var l,h,u=r.latitude*t.DEGREES_TO_RADIANS,c=r.longitude*t.DEGREES_TO_RADIANS,d=n*t.DEGREES_TO_RADIANS,p=u+s*Math.cos(d),f=Math.log(Math.tan(p/2+Math.PI/4)/Math.tan(u/2+Math.PI/4)),g=(p-u)/f;return(isNaN(f)||isNaN(g)||!isFinite(g))&&(g=Math.cos(u)),l=s*Math.sin(d)/g,o.fabs(p)>Math.PI/2&&(p=p>0?Math.PI-p:-Math.PI-p),h=o.fmod(c+l+Math.PI,2*Math.PI)-Math.PI,isNaN(p)||isNaN(h)?(a.latitude=r.latitude,a.longitude=r.longitude):(a.latitude=t.normalizedDegreesLatitude(p*t.RADIANS_TO_DEGREES),a.longitude=t.normalizedDegreesLongitude(h*t.RADIANS_TO_DEGREES)),a},s.interpolateLinear=function(t,r,n,s){if(!r||!n)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","interpolateLinear","missingLocation"));if(!s)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","interpolateLinear","missingResult"));if(r.equals(n))return s.latitude=r.latitude,s.longitude=r.longitude,s;var a=o.clamp(t,0,1),l=this.linearAzimuth(r,n),h=this.linearDistance(r,n);return this.linearLocation(r,l,a*h,s)},s.linearAzimuth=function(r,n){if(!r||!n)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","linearAzimuth","missingLocation"));var s,a,l,h=r.latitude*t.DEGREES_TO_RADIANS,u=n.latitude*t.DEGREES_TO_RADIANS,c=r.longitude*t.DEGREES_TO_RADIANS,d=n.longitude*t.DEGREES_TO_RADIANS;return h==u&&c==d?0:(s=d-c,a=u-h,o.fabs(s)>Math.PI&&(s=s>0?-(2*Math.PI-s):2*Math.PI+s),l=Math.atan2(s,a),isNaN(l)?0:l*t.RADIANS_TO_DEGREES)},s.linearDistance=function(r,n){if(!r||!n)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","linearDistance","missingLocation"));var s,a,l,h=r.latitude*t.DEGREES_TO_RADIANS,u=n.latitude*t.DEGREES_TO_RADIANS,c=r.longitude*t.DEGREES_TO_RADIANS,d=n.longitude*t.DEGREES_TO_RADIANS;return h==u&&c==d?0:(s=u-h,a=d-c,o.fabs(a)>Math.PI&&(a=a>0?-(2*Math.PI-a):2*Math.PI+a),l=Math.sqrt(s*s+a*a),isNaN(l)?0:l)},s.linearLocation=function(r,n,s,a){if(!r)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","linearLocation","missingLocation"));if(!a)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","linearLocation","missingResult"));if(0==s)return a.latitude=r.latitude,a.longitude=r.longitude,a;var l,h=r.latitude*t.DEGREES_TO_RADIANS,u=r.longitude*t.DEGREES_TO_RADIANS,c=n*t.DEGREES_TO_RADIANS,d=h+s*Math.cos(c);return o.fabs(d)>Math.PI/2&&(d=d>0?Math.PI-d:-Math.PI-d),l=o.fmod(u+s*Math.sin(c)+Math.PI,2*Math.PI)-Math.PI,isNaN(d)||isNaN(l)?(a.latitude=r.latitude,a.longitude=r.longitude):(a.latitude=t.normalizedDegreesLatitude(d*t.RADIANS_TO_DEGREES),a.longitude=t.normalizedDegreesLongitude(l*t.RADIANS_TO_DEGREES)),a},s.locationsCrossDateLine=function(t){if(!t)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","locationsCrossDateline","missingLocation"));for(var r=null,n=0,s=t.length;n<s;n+=1){var a=t[n];if(null!=r&&o.signum(r.longitude)!=o.signum(a.longitude)){var l=Math.abs(r.longitude-a.longitude);if(l>180&&l<360)return!0}r=a}return!1},s.greatCircleArcExtremeLocations=function(t){if(!t)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","greatCircleArcExtremeLocations","missingLocation"));for(var r=null,n=null,o=null,a=0,l=t.length;a<l;a+=1){var h=t[a];if(null!=o){var u=s.greatCircleArcExtremeForTwoLocations(o,h);if(null==u)continue;(null==r||r.latitude>u[0].latitude)&&(r=u[0]),(null==n||n.latitude<u[1].latitude)&&(n=u[1])}o=h}return[r,n]},s.greatCircleArcExtremeForTwoLocations=function(t,r){if(!t||!r)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","greatCircleArcExtremeForTwoLocations","missingLocation"));var n,a,l,h=null,u=null,c=90,d=-90,p=[t,r];for(n=0,a=p.length;n<a;n+=1)l=p[n],c>=l.latitude&&(c=l.latitude,h=l),d<=l.latitude&&(d=l.latitude,u=l);var f=s.greatCircleAzimuth(t,r),g=s.greatCircleDistance(t,r),m=s.greatCircleExtremeLocationsUsingAzimuth(t,f);for(n=0,a=m.length;n<a;n+=1){l=m[n];var E=s.greatCircleAzimuth(t,l),y=s.greatCircleDistance(t,l);o.signum(E)==o.signum(f)&&y>=0&&y<=g&&(c>=l.latitude&&(c=l.latitude,h=l),d<=l.latitude&&(d=l.latitude,u=l))}return[h,u]},s.greatCircleExtremeLocationsUsingAzimuth=function(r,n){if(!r)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","greatCircleArcExtremeLocationsUsingAzimuth","missingLocation"));var o=r.latitude,a=n*t.DEGREES_TO_RADIANS,l=-Math.tan(o)/Math.cos(a),h=Math.atan(l),u=h+Math.PI/2,c=h-Math.PI/2;return[s.greatCircleLocation(r,n,u,new s(0,0)),s.greatCircleLocation(r,n,c,new s(0,0))]},s.intersectionWithMeridian=function(t,e,i,o){var s=o.computePointFromLocation(t.latitude,t.longitude,new n(0,0,0)),a=o.computePointFromLocation(e.latitude,e.longitude,new n(0,0,0)),l=o.computePointFromLocation(90,i,new n(0,0,0)),h=o.computePointFromLocation(0,i,new n(0,0,0)),u=r.fromPoints(l,h,n.ZERO),c=new n(0,0,0);if(!u.intersectsSegmentAt(s,a,c))return null;var d=new WorldWind.Position(0,0,0);return o.computePositionFromPoint(c[0],c[1],c[2],d),d.latitude},s.meridianIntersection=function(t,e,i){var r=t.longitude<0?t.longitude+360:t.longitude,n=e.longitude<0?e.longitude+360:e.longitude;if(r===n)return null;var o=i<0?i+360:i,s=(e.latitude-t.latitude)/(n-r);return t.latitude+s*(o-r)},s.poles={NONE:0,NORTH:1,SOUTH:2},s}),i("geom/Position",["../geom/Angle","../error/ArgumentError","../geom/Location","../util/Logger","../util/WWMath"],function(t,e,i,r,n){"use strict";var o=function(t,e,i){this.latitude=t,this.longitude=e,this.altitude=i};return o.ZERO=new o(0,0,0),o.fromRadians=function(e,i,r){return new o(e*t.RADIANS_TO_DEGREES,i*t.RADIANS_TO_DEGREES,r)},o.prototype.copy=function(t){if(!t)throw new e(r.logMessage(r.LEVEL_SEVERE,"Position","copy","missingPosition"));return this.latitude=t.latitude,this.longitude=t.longitude,this.altitude=t.altitude,this},o.prototype.equals=function(t){return t&&t.latitude===this.latitude&&t.longitude===this.longitude&&t.altitude===this.altitude},o.interpolateGreatCircle=function(t,o,s,a){if(!o||!s)throw new e(r.logMessage(r.LEVEL_SEVERE,"Position","interpolateGreatCircle","missingPosition"));if(!a)throw new e(r.logMessage(r.LEVEL_SEVERE,"Position","interpolateGreatCircle","missingResult"));var l=n.clamp(t,0,1);return a.altitude=n.interpolate(l,o.altitude,s.altitude),i.interpolateGreatCircle(l,o,s,a),a},o.interpolateRhumb=function(t,o,s,a){if(!o||!s)throw new e(r.logMessage(r.LEVEL_SEVERE,"Position","interpolateRhumb","missingPosition"));if(!a)throw new e(r.logMessage(r.LEVEL_SEVERE,"Position","interpolateRhumb","missingResult"));var l=n.clamp(t,0,1);return a.altitude=n.interpolate(l,o.altitude,s.altitude),i.interpolateRhumb(l,o,s,a),a},o.interpolateLinear=function(t,o,s,a){if(!o||!s)throw new e(r.logMessage(r.LEVEL_SEVERE,"Position","interpolateLinear","missingPosition"));if(!a)throw new e(r.logMessage(r.LEVEL_SEVERE,"Position","interpolateLinear","missingResult"));var l=n.clamp(t,0,1);return a.altitude=n.interpolate(l,o.altitude,s.altitude),i.interpolateLinear(l,o,s,a),a},o.prototype.toString=function(){return"("+this.latitude.toString()+"°, "+this.longitude.toString()+"°, "+this.altitude.toString()+")"},o}),i("render/Texture",["../error/ArgumentError","../util/Logger","../util/WWMath"],function(t,e,i){"use strict";var r=function(r,n,o){if(!r)throw new t(e.logMessage(e.LEVEL_SEVERE,"Texture","constructor","missingGlContext"));if(!n)throw new t(e.logMessage(e.LEVEL_SEVERE,"Texture","constructor","missingImage"));o||(o=r.CLAMP_TO_EDGE);var s=r.createTexture(),a=i.isPowerOfTwo(n.width)&&i.isPowerOfTwo(n.height);this.originalImageWidth=n.width,this.originalImageHeight=n.height,o!==r.REPEAT||a||(n=this.resizeImage(n),a=!0),this.imageWidth=n.width,this.imageHeight=n.height,this.size=n.width*n.height*4,r.bindTexture(r.TEXTURE_2D,s),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,a?r.LINEAR_MIPMAP_LINEAR:r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,o),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,o);var l=r.getExtension("EXT_texture_filter_anisotropic")||r.getExtension("WEBKIT_EXT_texture_filter_anisotropic");l&&r.texParameteri(r.TEXTURE_2D,l.TEXTURE_MAX_ANISOTROPY_EXT,4),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,1),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,n),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,0),a&&r.generateMipmap(r.TEXTURE_2D),this.textureId=s,this.creationTime=new Date};return r.prototype.dispose=function(t){t.deleteTexture(this.textureId),delete this.textureId},r.prototype.bind=function(t){return t.currentGlContext.bindTexture(t.currentGlContext.TEXTURE_2D,this.textureId),t.frameStatistics.incrementTextureLoadCount(1),!0},r.prototype.resizeImage=function(t){var e=document.createElement("canvas");return e.width=i.powerOfTwoFloor(t.width),e.height=i.powerOfTwoFloor(t.height),e.getContext("2d").drawImage(t,0,0,e.width,e.height),e},r}),i("geom/Matrix",["../geom/Angle","../error/ArgumentError","../util/Logger","../geom/Plane","../geom/Position","../geom/Rectangle","../render/Texture","../geom/Vec3","../util/WWMath"],function(t,e,i,r,n,o,s,a,l){"use strict";var h=function(t,e,i,r,n,o,s,a,l,h,u,c,d,p,f,g){this[0]=t,this[1]=e,this[2]=i,this[3]=r,this[4]=n,this[5]=o,this[6]=s,this[7]=a,this[8]=l,this[9]=h,this[10]=u,this[11]=c,this[12]=d,this[13]=p,this[14]=f,this[15]=g};return h.prototype=new Float64Array(16),h.fromIdentity=function(){return new h(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)},h.principalAxesFromPoints=function(t,r,n,o){if(!t||t.length<1)throw new e(i.logMessage(i.LEVEL_SEVERE,"Matrix","principalAxesFromPoints","missingPoints"));if(!r||!n||!o)throw new e(i.logMessage(i.LEVEL_SEVERE,"Matrix","principalAxesFromPoints","An axis argument is null or undefined."));var s=h.fromIdentity();s.setToCovarianceOfPoints(t),s.eigensystemFromSymmetricMatrix(r,n,o),r.normalize(),n.normalize(),o.normalize()},h.prototype.set=function(t,e,i,r,n,o,s,a,l,h,u,c,d,p,f,g){return this[0]=t,this[1]=e,this[2]=i,this[3]=r,this[4]=n,this[5]=o,this[6]=s,this[7]=a,this[8]=l,this[9]=h,this[10]=u,this[11]=c,this[12]=d,this[13]=p,this[14]=f,this[15]=g,this},h.prototype.setToIdentity=function(){this[0]=1,this[1]=0,this[2]=0,this[3]=0,this[4]=0,this[5]=1,this[6]=0,this[7]=0,this[8]=0,this[9]=0,this[10]=1,this[11]=0,this[12]=0,this[13]=0,this[14]=0,this[15]=1},h.prototype.copy=function(t){if(!t)throw new e(i.logMessage(i.LEVEL_SEVERE,"Matrix","copy","missingMatrix"));this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this[4]=t[4],this[5]=t[5],this[6]=t[6],this[7]=t[7],this[8]=t[8],this[9]=t[9],this[10]=t[10],this[11]=t[11],this[12]=t[12],this[13]=t[13],this[14]=t[14],this[15]=t[15]},h.prototype.equals=function(t){return t&&this[0]==t[0]&&this[1]==t[1]&&this[2]==t[2]&&this[3]==t[3]&&this[4]==t[4]&&this[5]==t[5]&&this[6]==t[6]&&this[7]==t[7]&&this[8]==t[8]&&this[9]==t[9]&&this[10]==t[10]&&this[11]==t[11]&&this[12]==t[12]&&this[13]==t[13]&&this[14]==t[14]&&this[15]==t[15]},h.prototype.columnMajorComponents=function(t){if(!t)throw new e(i.logMessage(i.LEVEL_SEVERE,"Matrix","columnMajorComponents","missingResult"));return t[0]=this[0],t[1]=this[4],t[2]=this[8],t[3]=this[12],t[4]=this[1],t[5]=this[5],t[6]=this[9],t[7]=this[13],t[8]=this[2],t[9]=this[6],t[10]=this[10],t[11]=this[14],t[12]=this[3],t[13]=this[7],t[14]=this[11],t[15]=this[15],t},h.prototype.setToTranslation=function(t,e,i){return this[0]=1,this[1]=0,this[2]=0,this[3]=t,this[4]=0,this[5]=1,this[6]=0,this[7]=e,this[8]=0,this[9]=0,this[10]=1,this[11]=i,this[12]=0,this[13]=0,this[14]=0,this[15]=1,this},h.prototype.setTranslation=function(t,e,i){return this[3]=t,this[7]=e,this[11]=i,this},h.prototype.setToScale=function(t,e,i){return this[0]=t,this[1]=0,this[2]=0,this[3]=0,this[4]=0,this[5]=e,this[6]=0,this[7]=0,this[8]=0,this[9]=0,this[10]=i,this[11]=0,this[12]=0,this[13]=0,this[14]=0,this[15]=1,this},h.prototype.setScale=function(t,e,i){return this[0]=t,this[5]=e,this[10]=i,this},h.prototype.setToTransposeOfMatrix=function(t){if(!t)throw new e(i.logMessage(i.LEVEL_SEVERE,"Matrix","setToTransposeOfMatrix","missingMatrix"));return this[0]=t[0],this[1]=t[4],this[2]=t[8],this[3]=t[12],this[4]=t[1],this[5]=t[5],this[6]=t[9],this[7]=t[13],this[8]=t[2],this[9]=t[6],this[10]=t[10],this[11]=t[14],this[12]=t[3],this[13]=t[7],this[14]=t[11],this[15]=t[15],this},h.prototype.setToMultiply=function(t,r){if(!t||!r)throw new e(i.logMessage(i.LEVEL_SEVERE,"Matrix","setToMultiply","missingMatrix"));var n=t,o=r;return this[0]=n[0]*o[0]+n[1]*o[4]+n[2]*o[8]+n[3]*o[12],this[1]=n[0]*o[1]+n[1]*o[5]+n[2]*o[9]+n[3]*o[13],this[2]=n[0]*o[2]+n[1]*o[6]+n[2]*o[10]+n[3]*o[14],this[3]=n[0]*o[3]+n[1]*o[7]+n[2]*o[11]+n[3]*o[15],this[4]=n[4]*o[0]+n[5]*o[4]+n[6]*o[8]+n[7]*o[12],this[5]=n[4]*o[1]+n[5]*o[5]+n[6]*o[9]+n[7]*o[13],this[6]=n[4]*o[2]+n[5]*o[6]+n[6]*o[10]+n[7]*o[14],this[7]=n[4]*o[3]+n[5]*o[7]+n[6]*o[11]+n[7]*o[15],this[8]=n[8]*o[0]+n[9]*o[4]+n[10]*o[8]+n[11]*o[12],this[9]=n[8]*o[1]+n[9]*o[5]+n[10]*o[9]+n[11]*o[13],this[10]=n[8]*o[2]+n[9]*o[6]+n[10]*o[10]+n[11]*o[14],this[11]=n[8]*o[3]+n[9]*o[7]+n[10]*o[11]+n[11]*o[15],this[12]=n[12]*o[0]+n[13]*o[4]+n[14]*o[8]+n[15]*o[12],this[13]=n[12]*o[1]+n[13]*o[5]+n[14]*o[9]+n[15]*o[13],this[14]=n[12]*o[2]+n[13]*o[6]+n[14]*o[10]+n[15]*o[14],this[15]=n[12]*o[3]+n[13]*o[7]+n[14]*o[11]+n[15]*o[15],this},h.prototype.setToCovarianceOfPoints=function(t){if(!t||t.length<1)throw new e(i.logMessage(i.LEVEL_SEVERE,"Matrix","setToCovarianceOfPoints","missingArray"));var r,n,o,s,l=0,h=0,u=0,c=0,d=0,p=0,f=0,g=new a(0,0,0);r=a.averageOfBuffer(t,new a(0,0,0));for(var m=0,E=t.length/3;m<E;m++)g[0]=t[3*m],g[1]=t[3*m+1],g[2]=t[3*m+2],n=g[0]-r[0],o=g[1]-r[1],s=g[2]-r[2],++l,h+=n*n,u+=o*o,c+=s*s,d+=n*o,p+=n*s,f+=o*s;return this[0]=h/l,this[1]=d/l,this[2]=p/l,this[3]=0,this[4]=d/l,this[5]=u/l,this[6]=f/l,this[7]=0,this[8]=p/l,this[9]=f/l,this[10]=c/l,this[11]=0,this[12]=0,this[13]=0,this[14]=0,this[15]=0,this},h.prototype.multiplyByTranslation=function(t,e,i){return this.multiply(1,0,0,t,0,1,0,e,0,0,1,i,0,0,0,1),this},h.prototype.multiplyByRotation=function(e,i,r,n){var o=Math.cos(n*t.DEGREES_TO_RADIANS),s=Math.sin(n*t.DEGREES_TO_RADIANS);return this.multiply(o+(1-o)*e*e,(1-o)*e*i-s*r,(1-o)*e*r+s*i,0,(1-o)*e*i+s*r,o+(1-o)*i*i,(1-o)*i*r-s*e,0,(1-o)*e*r-s*i,(1-o)*i*r+s*e,o+(1-o)*r*r,0,0,0,0,1),this},h.prototype.multiplyByScale=function(t,e,i){return this.multiply(t,0,0,0,0,e,0,0,0,0,i,0,0,0,0,1),this},h.prototype.setToUnitYFlip=function(){return this[0]=1,this[1]=0,this[2]=0,this[3]=0,this[4]=0,this[5]=-1,this[6]=0,this[7]=1,this[8]=0,this[9]=0,this[10]=1,this[11]=0,this[12]=0,this[13]=0,this[14]=0,this[15]=1,this},h.prototype.multiplyByLocalCoordinateTransform=function(t,r){if(!t)throw new e(i.logMessage(i.LEVEL_SEVERE,"Matrix","multiplyByLocalCoordinateTransform","Origin vector is null or undefined"));if(!r)throw new e(i.logMessage(i.LEVEL_SEVERE,"Matrix","multiplyByLocalCoordinateTransform","missingGlobe"));var n=new a(0,0,0),o=new a(0,0,0),s=new a(0,0,0);return l.localCoordinateAxesAtPoint(t,r,n,o,s),this.multiply(n[0],o[0],s[0],t[0],n[1],o[1],s[1],t[1],n[2],o[2],s[2],t[2],0,0,0,1),this},h.prototype.multiplyByTextureTransform=function(t){if(!t)throw new e(i.logMessage(i.LEVEL_SEVERE,"Matrix","multiplyByTextureTransform","missingTexture"))
;var r=t.originalImageWidth/t.imageWidth,n=t.originalImageHeight/t.imageHeight;return this.multiply(r,0,0,0,0,-n,0,n,0,0,1,0,0,0,0,1),this},h.prototype.extractTranslation=function(t){if(!t)throw new e(i.logMessage(i.LEVEL_SEVERE,"Matrix","extractTranslation","missingResult"));return t[0]=this[3],t[1]=this[7],t[2]=this[11],t},h.prototype.extractRotationAngles=function(r){if(!r)throw new e(i.logMessage(i.LEVEL_SEVERE,"Matrix","extractRotationAngles","missingResult"));var n=Math.atan2(this[6],this[10]),o=Math.atan2(-this[2],Math.sqrt(this[0]*this[0]+this[1]*this[1])),s=Math.cos(n),a=Math.sin(n),l=Math.atan2(a*this[8]-s*this[4],s*this[5]-a*this[9]);return r[0]=n*t.RADIANS_TO_DEGREES,r[1]=o*t.RADIANS_TO_DEGREES,r[2]=l*t.RADIANS_TO_DEGREES,r},h.prototype.multiplyByFirstPersonModelview=function(r,n,o,s,h){if(!r)throw new e(i.logMessage(i.LEVEL_SEVERE,"Matrix","multiplyByFirstPersonModelview","missingPosition"));if(!h)throw new e(i.logMessage(i.LEVEL_SEVERE,"Matrix","multiplyByFirstPersonModelview","missingGlobe"));var u,c,d,p,f,g,m,E,y,_,v,S,b,T,L=new a(0,0,0),w=new a(0,0,0),R=new a(0,0,0),x=new a(0,0,0);return u=Math.cos(s*t.DEGREES_TO_RADIANS),c=Math.sin(s*t.DEGREES_TO_RADIANS),this.multiply(u,c,0,0,-c,u,0,0,0,0,1,0,0,0,0,1),u=Math.cos(o*t.DEGREES_TO_RADIANS),c=Math.sin(o*t.DEGREES_TO_RADIANS),this.multiply(1,0,0,0,0,u,c,0,0,-c,u,0,0,0,0,1),u=Math.cos(n*t.DEGREES_TO_RADIANS),c=Math.sin(n*t.DEGREES_TO_RADIANS),this.multiply(u,-c,0,0,c,u,0,0,0,0,1,0,0,0,0,1),h.computePointFromPosition(r.latitude,r.longitude,r.altitude,L),d=L[0],p=L[1],f=L[2],l.localCoordinateAxesAtPoint(L,h,w,R,x),g=w[0],m=w[1],E=w[2],y=R[0],_=R[1],v=R[2],S=x[0],b=x[1],T=x[2],this.multiply(g,m,E,-g*d-m*p-E*f,y,_,v,-y*d-_*p-v*f,S,b,T,-S*d-b*p-T*f,0,0,0,1),this},h.prototype.multiplyByLookAtModelview=function(t,r,n,o,s,a){if(!t)throw new e(i.logMessage(i.LEVEL_SEVERE,"Matrix","multiplyByLookAtModelview","missingPosition"));if(r<0)throw new e(i.logMessage(i.LEVEL_SEVERE,"Matrix","multiplyByLookAtModelview","Range is less than zero"));if(!a)throw new e(i.logMessage(i.LEVEL_SEVERE,"Matrix","multiplyByLookAtModelview","missingGlobe"));return this.multiplyByTranslation(0,0,-r),this.multiplyByFirstPersonModelview(t,n,o,s,a),this},h.prototype.setToPerspectiveProjection=function(t,r,n,o){if(t<=0)throw new e(i.logMessage(i.LEVEL_SEVERE,"Matrix","setToPerspectiveProjection","invalidWidth"));if(r<=0)throw new e(i.logMessage(i.LEVEL_SEVERE,"Matrix","setToPerspectiveProjection","invalidHeight"));if(n===o)throw new e(i.logMessage(i.LEVEL_SEVERE,"Matrix","setToPerspectiveProjection","Near and far distance are the same."));if(n<=0||o<=0)throw new e(i.logMessage(i.LEVEL_SEVERE,"Matrix","setToPerspectiveProjection","Near or far distance is less than or equal to zero."));var s=l.perspectiveFrustumRectangle(t,r,n),a=s.getMinX(),h=s.getMaxX(),u=s.getMinY(),c=s.getMaxY();return this[0]=2*n/(h-a),this[1]=0,this[2]=(h+a)/(h-a),this[3]=0,this[4]=0,this[5]=2*n/(c-u),this[6]=(c+u)/(c-u),this[7]=0,this[8]=0,this[9]=0,this[10]=-(o+n)/(o-n),this[11]=-2*n*o/(o-n),this[12]=0,this[13]=0,this[14]=-1,this[15]=0,this},h.prototype.setToScreenProjection=function(t,r){if(t<=0)throw new e(i.logMessage(i.LEVEL_SEVERE,"Matrix","setToScreenProjection","invalidWidth"));if(r<=0)throw new e(i.logMessage(i.LEVEL_SEVERE,"Matrix","setToScreenProjection","invalidHeight"));return this[0]=2/t,this[1]=0,this[2]=0,this[3]=-1,this[4]=0,this[5]=2/r,this[6]=0,this[7]=-1,this[8]=0,this[9]=0,this[10]=2,this[11]=-1,this[12]=0,this[13]=0,this[14]=0,this[15]=1,this},h.prototype.extractEyePoint=function(t){if(!t)throw new e(i.logMessage(i.LEVEL_SEVERE,"Matrix","extractEyePoint","missingResult"));return t[0]=-this[0]*this[3]-this[4]*this[7]-this[8]*this[11],t[1]=-this[1]*this[3]-this[5]*this[7]-this[9]*this[11],t[2]=-this[2]*this[3]-this[6]*this[7]-this[10]*this[11],t},h.prototype.extractForwardVector=function(t){if(!t)throw new e(i.logMessage(i.LEVEL_SEVERE,"Matrix","extractForwardVector","missingResult"));return t[0]=-this[8],t[1]=-this[9],t[2]=-this[10],t},h.prototype.extractViewingParameters=function(r,o,s,a){if(!r)throw new e(i.logMessage(i.LEVEL_SEVERE,"Matrix","extractViewingParameters","The specified origin is null or undefined."));if(!s)throw new e(i.logMessage(i.LEVEL_SEVERE,"Matrix","extractViewingParameters","missingGlobe"));if(!a)throw new e(i.logMessage(i.LEVEL_SEVERE,"Matrix","extractViewingParameters","missingResult"));var l,u,c,d,p,f,g,m,E,y=new n(0,0,0),_=h.fromIdentity();return s.computePositionFromPoint(r[0],r[1],r[2],y),_.copy(this),_.multiplyByLocalCoordinateTransform(r,s),l=-_[11],u=_[10],c=Math.sqrt(_[2]*_[2]+_[6]*_[6]),d=Math.atan2(c,u)*t.RADIANS_TO_DEGREES,p=Math.cos(o*t.DEGREES_TO_RADIANS),f=Math.sin(o*t.DEGREES_TO_RADIANS),g=p*_[0]-f*_[4],m=f*_[5]-p*_[1],E=Math.atan2(m,g)*t.RADIANS_TO_DEGREES,a.origin=y,a.range=l,a.heading=E,a.tilt=d,a.roll=o,a},h.prototype.offsetProjectionDepth=function(t){return this[10]*=1+t,this},h.prototype.multiplyMatrix=function(t){if(!t)throw new e(i.logMessage(i.LEVEL_SEVERE,"Matrix","multiplyMatrix","missingMatrix"));var r,n,o,s,a=this,l=t;return r=a[0],n=a[1],o=a[2],s=a[3],a[0]=r*l[0]+n*l[4]+o*l[8]+s*l[12],a[1]=r*l[1]+n*l[5]+o*l[9]+s*l[13],a[2]=r*l[2]+n*l[6]+o*l[10]+s*l[14],a[3]=r*l[3]+n*l[7]+o*l[11]+s*l[15],r=a[4],n=a[5],o=a[6],s=a[7],a[4]=r*l[0]+n*l[4]+o*l[8]+s*l[12],a[5]=r*l[1]+n*l[5]+o*l[9]+s*l[13],a[6]=r*l[2]+n*l[6]+o*l[10]+s*l[14],a[7]=r*l[3]+n*l[7]+o*l[11]+s*l[15],r=a[8],n=a[9],o=a[10],s=a[11],a[8]=r*l[0]+n*l[4]+o*l[8]+s*l[12],a[9]=r*l[1]+n*l[5]+o*l[9]+s*l[13],a[10]=r*l[2]+n*l[6]+o*l[10]+s*l[14],a[11]=r*l[3]+n*l[7]+o*l[11]+s*l[15],r=a[12],n=a[13],o=a[14],s=a[15],a[12]=r*l[0]+n*l[4]+o*l[8]+s*l[12],a[13]=r*l[1]+n*l[5]+o*l[9]+s*l[13],a[14]=r*l[2]+n*l[6]+o*l[10]+s*l[14],a[15]=r*l[3]+n*l[7]+o*l[11]+s*l[15],this},h.prototype.multiply=function(t,e,i,r,n,o,s,a,l,h,u,c,d,p,f,g){var m,E,y,_,v=this;return m=v[0],E=v[1],y=v[2],_=v[3],v[0]=m*t+E*n+y*l+_*d,v[1]=m*e+E*o+y*h+_*p,v[2]=m*i+E*s+y*u+_*f,v[3]=m*r+E*a+y*c+_*g,m=v[4],E=v[5],y=v[6],_=v[7],v[4]=m*t+E*n+y*l+_*d,v[5]=m*e+E*o+y*h+_*p,v[6]=m*i+E*s+y*u+_*f,v[7]=m*r+E*a+y*c+_*g,m=v[8],E=v[9],y=v[10],_=v[11],v[8]=m*t+E*n+y*l+_*d,v[9]=m*e+E*o+y*h+_*p,v[10]=m*i+E*s+y*u+_*f,v[11]=m*r+E*a+y*c+_*g,m=v[12],E=v[13],y=v[14],_=v[15],v[12]=m*t+E*n+y*l+_*d,v[13]=m*e+E*o+y*h+_*p,v[14]=m*i+E*s+y*u+_*f,v[15]=m*r+E*a+y*c+_*g,this},h.prototype.invertMatrix=function(t){if(!t)throw new e(i.logMessage(i.LEVEL_SEVERE,"Matrix","invertMatrix","missingMatrix"));var r=[[],[],[],[]];r[0][0]=t[0],r[0][1]=t[1],r[0][2]=t[2],r[0][3]=t[3],r[1][0]=t[4],r[1][1]=t[5],r[1][2]=t[6],r[1][3]=t[7],r[2][0]=t[8],r[2][1]=t[9],r[2][2]=t[10],r[2][3]=t[11],r[3][0]=t[12],r[3][1]=t[13],r[3][2]=t[14],r[3][3]=t[15];var n,o,s=[],a=h.ludcmp(r,s);for(n=0;n<4;n+=1)a*=r[n][n];if(Math.abs(a)<1e-8)return null;var l=[[],[],[],[]],u=[];for(o=0;o<4;o+=1){for(n=0;n<4;n+=1)u[n]=0;for(u[o]=1,h.lubksb(r,s,u),n=0;n<4;n+=1)l[n][o]=u[n]}return this[0]=l[0][0],this[1]=l[0][1],this[2]=l[0][2],this[3]=l[0][3],this[4]=l[1][0],this[5]=l[1][1],this[6]=l[1][2],this[7]=l[1][3],this[8]=l[2][0],this[9]=l[2][1],this[10]=l[2][2],this[11]=l[2][3],this[12]=l[3][0],this[13]=l[3][1],this[14]=l[3][2],this[15]=l[3][3],this},h.lubksb=function(t,e,i){var r,n,o,s=-1;for(r=0;r<4;r+=1){var a=e[r];if(o=i[a],i[a]=i[r],-1!=s)for(n=s;n<=r-1;n+=1)o-=t[r][n]*i[n];else 0!=o&&(s=r);i[r]=o}for(r=3;r>=0;r-=1){for(o=i[r],n=r+1;n<4;n+=1)o-=t[r][n]*i[n];i[r]=o/t[r][r]}},h.ludcmp=function(t,e){var i,r,n,o,s,a,l,h,u=[],c=1;for(r=0;r<4;r+=1){for(s=0,n=0;n<4;n+=1)(i=Math.abs(t[r][n]))>s&&(s=i);if(0==s)return 0;u[r]=1/s}for(n=0;n<4;n+=1){for(r=0;r<n;r+=1){for(a=t[r][n],o=0;o<r;o+=1)a-=t[r][o]*t[o][n];t[r][n]=a}for(s=0,l=-1,r=n;r<4;r+=1){for(a=t[r][n],o=0;o<n;o++)a-=t[r][o]*t[o][n];t[r][n]=a,(h=u[r]*Math.abs(a))>=s&&(s=h,l=r)}if(n!=l){for(o=0;o<4;o+=1)h=t[l][o],t[l][o]=t[n][o],t[n][o]=h;c=-c,u[l]=u[n]}if(e[n]=l,0==t[n][n]&&(t[n][n]=1e-20),3!=n)for(h=1/t[n][n],r=n+1;r<4;r+=1)t[r][n]*=h}return c},h.prototype.invertOrthonormalMatrix=function(t){if(!t)throw new e(i.logMessage(i.LEVEL_SEVERE,"Matrix","invertOrthonormalMatrix","missingMatrix"));var r=t;return this[0]=r[0],this[1]=r[4],this[2]=r[8],this[3]=0-r[0]*r[3]-r[4]*r[7]-r[8]*r[11],this[4]=r[1],this[5]=r[5],this[6]=r[9],this[7]=0-r[1]*r[3]-r[5]*r[7]-r[9]*r[11],this[8]=r[2],this[9]=r[6],this[10]=r[10],this[11]=0-r[2]*r[3]-r[6]*r[7]-r[10]*r[11],this[12]=0,this[13]=0,this[14]=0,this[15]=1,this},h.prototype.eigensystemFromSymmetricMatrix=function(t,r,n){if(!t||!r||!n)throw new e(i.logMessage(i.LEVEL_SEVERE,"Matrix","eigensystemFromSymmetricMatrix","missingResult"));if(this[1]!=this[4]||this[2]!=this[8]||this[6]!=this[9])throw new e(i.logMessage(i.LEVEL_SEVERE,"Matrix","eigensystemFromSymmetricMatrix","Matrix is not symmetric"));for(var o,s,a,h,u,c,d,p,f,g,m,E=this[0],y=this[1],_=this[2],v=this[5],S=this[6],b=this[10],T=[[1,0,0],[0,1,0],[0,0,1]],L=0;L<32&&!(l.fabs(y)<1e-10&&l.fabs(_)<1e-10&&l.fabs(S)<1e-10);L++){if(0!=y)for(o=.5*(v-E)/y,s=o*o,a=s+1,h=a!=s?(o<0?-1:1)*(Math.sqrt(a)-l.fabs(o)):.5/o,u=1/Math.sqrt(h*h+1),c=u*h,E-=h*y,v+=h*y,y=0,d=u*_-c*S,S=c*_+u*S,_=d,p=0;p<3;p++)d=u*T[p][0]-c*T[p][1],T[p][1]=c*T[p][0]+u*T[p][1],T[p][0]=d;if(0!=_)for(o=.5*(b-E)/_,s=o*o,a=s+1,h=a!=s?(o<0?-1:1)*(Math.sqrt(a)-l.fabs(o)):.5/o,u=1/Math.sqrt(h*h+1),c=u*h,E-=h*_,b+=h*_,_=0,d=u*y-c*S,S=c*y+u*S,y=d,p=0;p<3;p++)d=u*T[p][0]-c*T[p][2],T[p][2]=c*T[p][0]+u*T[p][2],T[p][0]=d;if(0!=S)for(o=.5*(b-v)/S,s=o*o,a=s+1,h=a!=s?(o<0?-1:1)*(Math.sqrt(a)-l.fabs(o)):.5/o,u=1/Math.sqrt(h*h+1),c=u*h,v-=h*S,b+=h*S,S=0,d=u*y-c*_,_=c*y+u*_,y=d,p=0;p<3;p++)d=u*T[p][1]-c*T[p][2],T[p][2]=c*T[p][1]+u*T[p][2],T[p][1]=d}f=0,g=1,m=2,E<v&&(d=E,E=v,v=d,d=f,f=g,g=d),v<b&&(d=v,v=b,b=d,d=g,g=m,m=d),E<v&&(d=E,E=v,v=d,d=f,f=g,g=d),t[0]=T[0][f],t[1]=T[1][f],t[2]=T[2][f],r[0]=T[0][g],r[1]=T[1][g],r[2]=T[2][g],n[0]=T[0][m],n[1]=T[1][m],n[2]=T[2][m],t.normalize(),r.normalize(),n.normalize(),t.multiply(E),r.multiply(v),n.multiply(b)},h.prototype.upper3By3=function(){var t=h.fromIdentity();return t[0]=this[0],t[1]=this[1],t[2]=this[2],t[4]=this[4],t[5]=this[5],t[6]=this[6],t[8]=this[8],t[9]=this[9],t[10]=this[10],t},h}),i("pick/PickedObject",[],function(){"use strict";return function(t,e,i,r,n){this.color=t,this.userObject=e,this.position=i,this.parentLayer=r,this.isTerrain=n,this.isOnTop=!1}}),i("error/UnsupportedOperationError",["../error/AbstractError"],function(t){"use strict";var e=function(e){t.call(this,"UnsupportedOperationError",e);var i;try{throw new Error}catch(t){i=t.stack}this.stack=i};return e.prototype=Object.create(t.prototype),e}),i("render/Renderable",["../util/Logger","../error/UnsupportedOperationError"],function(t,e){"use strict";var i=function(){this.displayName="Renderable",this.enabled=!0,this.pickDelegate=null,this.userProperties={}};return i.prototype.render=function(i){throw new e(t.logMessage(t.LEVEL_SEVERE,"Renderable","render","abstractInvocation"))},i}),i("shapes/Annotation",["../shapes/AnnotationAttributes","../error/ArgumentError","../shaders/BasicTextureProgram","../util/Color","../util/Font","../util/Insets","../util/Logger","../geom/Matrix","../util/Offset","../pick/PickedObject","../render/Renderable","../shapes/TextAttributes","../geom/Vec2","../geom/Vec3","../util/WWMath"],function(t,e,i,r,n,o,s,a,l,h,u,c,d,p,f){"use strict";var g=function(i,r){if(!i)throw new e(s.logMessage(s.LEVEL_SEVERE,"Annotation","constructor","missingPosition"));u.call(this),this.position=i,this.attributes=r||new t(null),this.altitudeMode=WorldWind.ABSOLUTE,this.layer=null,this.lastStateKey=null,this.calloutTransform=a.fromIdentity(),this.calloutOffset=new WorldWind.Offset(WorldWind.OFFSET_FRACTION,.5,WorldWind.OFFSET_FRACTION,0),this.label="",this.labelTexture=null,this.labelTransform=a.fromIdentity(),this.placePoint=new p(0,0,0),this.depthOffset=-2.05,this.calloutPoints=null};return g.matrix=a.fromIdentity(),g.screenPoint=new p(0,0,0),g.scratchPoint=new p(0,0,0),g.prototype=Object.create(u.prototype),Object.defineProperties(g.prototype,{text:{get:function(){return this.label},set:function(t){this.label=t,this.lastStateKey=null}}}),g.prototype.renderOrdered=function(t){if(this.drawOrderedAnnotation(t),t.pickingMode){var e=new h(this.pickColor.clone(),this,this.position,this.layer,!1);t.pickPoint&&this.labelBounds.containsPoint(t.navigatorState.convertPointToViewport(t.pickPoint,g.scratchPoint))&&(e.labelPicked=!0),t.resolvePick(e)}},g.prototype.clone=function(){var t=new g(this.position);return t.copy(this),t.pickDelegate=this.pickDelegate?this.pickDelegate:this,t},g.prototype.copy=function(t){return this.position=t.position,this.enabled=t.enabled,this.attributes=t.attributes,this.label=t.label,this.altitudeMode=t.altitudeMode,this.pickDelegate=t.pickDelegate,this.depthOffset=t.depthOffset,this},g.prototype.render=function(t){if(this.enabled&&t.accumulateOrderedRenderables&&(!t.globe.projectionLimits||t.globe.projectionLimits.containsLocation(this.position.latitude,this.position.longitude))){var e;if(this.lastFrameTime!==t.timestamp)e=this.makeOrderedRenderable(t);else{e=this.clone().makeOrderedRenderable(t)}e&&(e.layer=t.currentLayer,this.lastFrameTime=t.timestamp,t.addOrderedRenderable(e))}},g.prototype.drawOrderedAnnotation=function(t){this.beginDrawing(t);try{this.doDrawOrderedAnnotation(t)}finally{this.endDrawing(t)}},g.prototype.makeOrderedRenderable=function(t){var e,i,r,n,o,s,a,l,h;if(this.label=t.textSupport.wrap(this.label,this.attributes.width,this.attributes.height,this.attributes.textAttributes.font),t.surfacePointForMode(this.position.latitude,this.position.longitude,this.position.altitude,this.altitudeMode,this.placePoint),this.eyeDistance=t.navigatorState.eyePoint.distanceTo(this.placePoint),!t.navigatorState.projectWithDepth(this.placePoint,this.depthOffset,g.screenPoint))return null;var u=this.attributes.textAttributes.font,c=this.label+u.toString();this.labelTexture=t.gpuResourceCache.resourceForKey(c),this.labelTexture||(this.labelTexture=t.textSupport.createTexture(t,this.label,u,!1),t.gpuResourceCache.putResource(c,this.labelTexture,this.labelTexture.size)),e=this.labelTexture.imageWidth,i=this.labelTexture.imageHeight,r=this.attributes.scale,n=this.attributes.insets.left,o=this.attributes.insets.right,s=this.attributes.insets.top,a=this.attributes.insets.bottom,h=this.attributes.leaderGapHeight,l=this.calloutOffset.offsetForSize((e+n+o)*r,(i+s+a)*r),this.calloutTransform.setTranslation(g.screenPoint[0]-l[0],g.screenPoint[1]+h,g.screenPoint[2]),this.labelTransform.setTranslation(g.screenPoint[0]-l[0]+n*r,g.screenPoint[1]+h+a*r,g.screenPoint[2]),this.labelTransform.setScale(e*r,i*r,1),this.labelBounds=f.boundingRectForUnitQuad(this.labelTransform);var d=(e+n+o)*r,p=(i+s+a)*r,m=d/2,E=-h;return this.attributes.drawLeader||(E=0),this.attributes.stateKey!=this.lastStateKey&&(this.calloutPoints=this.createCallout(d,p,m,E,this.attributes.leaderGapWidth,this.attributes.cornerRadius)),this},g.prototype.beginDrawing=function(t){var e,r=t.currentGlContext;t.findAndBindProgram(i),e=t.currentProgram,r.enableVertexAttribArray(e.vertexPointLocation),r.enableVertexAttribArray(e.vertexTexCoordLocation),e.loadModulateColor(r,t.pickingMode)},g.prototype.endDrawing=function(t){var e=t.currentGlContext,i=t.currentProgram;e.disableVertexAttribArray(i.vertexPointLocation),e.disableVertexAttribArray(i.vertexTexCoordLocation),t.bindProgram(null)},g.prototype.drawCorner=function(t,e,i,r,n,o,s,a){if(i<1)return a;for(var l=(n-r)/(o-1),h=1;h<o-1;h++){var u=r+l*h,c=t+Math.cos(u)*i,d=e+Math.sin(u)*i;s[a++]=c,s[a++]=d}return a},g.prototype.createCallout=function(t,e,i,r,n,o){var s=2*(12+(o<1?0:56)),a=new Float32Array(s),l=0;return a[l++]=t/2+n/2,a[l++]=0,a[l++]=t-o,a[l++]=0,l=this.drawCorner(t-o,o,o,-Math.PI/2,0,16,a,l),a[l++]=t,a[l++]=o,a[l++]=t,a[l++]=e-o,l=this.drawCorner(t-o,e-o,o,0,Math.PI/2,16,a,l),a[l++]=t-o,a[l++]=e,a[l++]=o,a[l++]=e,l=this.drawCorner(o,e-o,o,Math.PI/2,Math.PI,16,a,l),a[l++]=0,a[l++]=e-o,a[l++]=0,a[l++]=o,l=this.drawCorner(o,o,o,Math.PI,1.5*Math.PI,16,a,l),a[l++]=o,a[l++]=0,a[l++]=t/2-n/2,a[l++]=0,a[l++]=i,a[l++]=r,a[l++]=t/2+n/2,a[l]=0,a},g.prototype.doDrawOrderedAnnotation=function(t){var e,i=t.currentGlContext,r=t.currentProgram,n=!1;t.pickingMode&&(this.pickColor=t.uniquePickColor()),r.loadOpacity(i,this.attributes.opacity);var o=this.attributes.stateKey!=this.lastStateKey;this.calloutCacheKey&&!o||(this.calloutCacheKey=t.gpuResourceCache.generateCacheKey());var s=t.gpuResourceCache.resourceForKey(this.calloutCacheKey);s||(s=i.createBuffer(),t.gpuResourceCache.putResource(this.calloutCacheKey,s,4*this.calloutPoints.length),n=!0),o&&this.calloutCacheKey&&t.gpuResourceCache.removeResource(this.calloutCacheKey),this.lastStateKey=this.attributes.stateKey,g.matrix.copy(t.screenProjection),g.matrix.multiplyMatrix(this.calloutTransform),r.loadModelviewProjection(i,g.matrix),i.bindBuffer(i.ARRAY_BUFFER,s),n&&(i.bufferData(i.ARRAY_BUFFER,this.calloutPoints,i.STATIC_DRAW),t.frameStatistics.incrementVboLoadCount(1)),r.loadColor(i,t.pickingMode?this.pickColor:this.attributes.backgroundColor),r.loadTextureEnabled(i,!1),i.vertexAttribPointer(r.vertexPointLocation,2,i.FLOAT,!1,0,0),i.vertexAttribPointer(r.vertexTexCoordLocation,2,i.FLOAT,!1,0,0),i.drawArrays(i.TRIANGLE_FAN,0,this.calloutPoints.length/2),g.matrix.copy(t.screenProjection),g.matrix.multiplyMatrix(this.labelTransform),r.loadModelviewProjection(i,g.matrix),g.matrix.setToIdentity(),g.matrix.multiplyByTextureTransform(this.labelTexture),r.loadTextureMatrix(i,g.matrix),r.loadColor(i,t.pickingMode?this.pickColor:this.attributes.textAttributes.color),e=this.labelTexture.bind(t),r.loadTextureEnabled(i,e),i.bindBuffer(i.ARRAY_BUFFER,t.unitQuadBuffer3()),i.vertexAttribPointer(r.vertexPointLocation,3,i.FLOAT,!1,0,0),i.bindBuffer(i.ARRAY_BUFFER,t.unitQuadBuffer()),i.vertexAttribPointer(r.vertexTexCoordLocation,2,i.FLOAT,!1,0,0),i.drawArrays(i.TRIANGLE_STRIP,0,4)},g}),i("util/measure/MeasurerUtils",["../../geom/Location","../../geom/Position"],function(t,e){"use strict";return{subdividePositions:function(i,r,n,o,s){var a,l=[],h=new t(0,0),u=new t(0,0),c=r[0];this.addPosition(i,l,c,n);for(var d=1;d<r.length;d++){var p=r[d],f=t.greatCircleDistance(c,p);h=t.interpolateAlongPath(o,.5,c,p,h);var g=f*i.radiusAt(h.latitude,h.longitude);if(g>s)for(var m=null,E=null,y=Math.ceil(g/s),_=1;_<y;_++){var v=_/y;o===WorldWind.LINEAR?u=t.interpolateLinear(v,c,p,u):o===WorldWind.RHUMB_LINE?(null==m&&(m=t.rhumbAzimuth(c,p),E=t.rhumbDistance(c,p)),u=t.rhumbLocation(c,m,v*E,u)):(null==m&&(m=t.greatCircleAzimuth(c,p),E=t.greatCircleDistance(c,p)),u=t.greatCircleLocation(c,m,v*E,u)),a=n?i.elevationAtLocation(u.latitude,u.longitude):c.altitude*(1-v)+p.altitude*v,l.push(new e(u.latitude,u.longitude,a))}this.addPosition(i,l,p,n),c=p}return l},addPosition:function(t,i,r,n){var o=r.altitude;return n&&(o=t.elevationAtLocation(r.latitude,r.longitude)),i.push(new e(r.latitude,r.longitude,o)),i},isLocationInside:function(t,e){for(var i=!1,r=e[0],n=1,o=e.length;n<o;n++){var s=e[n];(s.latitude<=t.latitude&&t.latitude<r.latitude||r.latitude<=t.latitude&&t.latitude<s.latitude)&&t.longitude<(r.longitude-s.longitude)*(t.latitude-s.latitude)/(r.latitude-s.latitude)+s.longitude&&(i=!i),r=s}return i},angleBetweenVectors:function(t,e){var i=t.dot(e),r=t.magnitude()*e.magnitude();return 0!==r&&1!==r&&(i/=r),i<-1?i=-1:i>1&&(i=1),Math.acos(i)}}}),i("geom/Sector",["../geom/Angle","../error/ArgumentError","../geom/Location","../util/Logger","../geom/Vec3","../util/WWMath"],function(t,e,i,r,n,o){"use strict";var s=function(t,e,i,r){this.minLatitude=t,this.maxLatitude=e,this.minLongitude=i,this.maxLongitude=r};return s.ZERO=new s(0,0,0,0),s.FULL_SPHERE=new s(-90,90,-180,180),s.prototype.copy=function(t){if(!t)throw new e(r.logMessage(r.LEVEL_SEVERE,"Sector","copy","missingSector"));return this.minLatitude=t.minLatitude,this.maxLatitude=t.maxLatitude,this.minLongitude=t.minLongitude,this.maxLongitude=t.maxLongitude,this},s.prototype.isEmpty=function(){return this.minLatitude===this.maxLatitude&&this.minLongitude===this.maxLongitude},s.prototype.deltaLatitude=function(){return this.maxLatitude-this.minLatitude},s.prototype.deltaLongitude=function(){return this.maxLongitude-this.minLongitude},s.prototype.centroidLatitude=function(){return.5*(this.minLatitude+this.maxLatitude)},s.prototype.centroidLongitude=function(){return.5*(this.minLongitude+this.maxLongitude)},s.prototype.centroid=function(t){if(!t)throw new e(r.logMessage(r.LEVEL_SEVERE,"Sector","centroid","missingResult"));return t.latitude=this.centroidLatitude(),t.longitude=this.centroidLongitude(),t},s.prototype.minLatitudeRadians=function(){return this.minLatitude*t.DEGREES_TO_RADIANS},s.prototype.maxLatitudeRadians=function(){return this.maxLatitude*t.DEGREES_TO_RADIANS},s.prototype.minLongitudeRadians=function(){return this.minLongitude*t.DEGREES_TO_RADIANS},s.prototype.maxLongitudeRadians=function(){return this.maxLongitude*t.DEGREES_TO_RADIANS},s.prototype.setToBoundingSector=function(t){if(!t||t.length<2)throw new e(r.logMessage(r.LEVEL_SEVERE,"Sector","setToBoundingSector","missingArray"));for(var i=90,n=-90,o=180,s=-180,a=0,l=t.length;a<l;a+=1){var h=t[a];h&&(i=Math.min(i,h.latitude),n=Math.max(n,h.latitude),o=Math.min(o,h.longitude),s=Math.max(s,h.longitude))}return this.minLatitude=i,this.maxLatitude=n,this.minLongitude=o,this.maxLongitude=s,this},s.splitBoundingSectors=function(t){if(!t||t.length<2)throw new e(r.logMessage(r.LEVEL_SEVERE,"Sector","splitBoundingSectors","missingArray"));for(var i=90,n=180,a=-90,l=-180,h=null,u=0,c=t.length;u<c;u+=1){var d=t[u],p=d.latitude;p<i&&(i=p),p>a&&(a=p);var f=d.longitude;if(f>=0&&f<n&&(n=f),f<=0&&f>l&&(l=f),null!=h){var g=h.longitude;o.signum(f)!=o.signum(g)&&Math.abs(f-g)<180&&(l=0,n=0)}h=d}return i===a&&n===l?null:[new s(i,a,n,180),new s(i,a,-180,l)]},s.prototype.intersects=function(t){return t&&this.minLongitude<=t.maxLongitude&&this.maxLongitude>=t.minLongitude&&this.minLatitude<=t.maxLatitude&&this.maxLatitude>=t.minLatitude},s.prototype.overlaps=function(t){return t&&this.minLongitude<t.maxLongitude&&this.maxLongitude>t.minLongitude&&this.minLatitude<t.maxLatitude&&this.maxLatitude>t.minLatitude},s.prototype.contains=function(t){return t&&this.minLatitude<=t.minLatitude&&this.maxLatitude>=t.maxLatitude&&this.minLongitude<=t.minLongitude&&this.maxLongitude>=t.maxLongitude},s.prototype.containsLocation=function(t,e){return this.minLatitude<=t&&this.maxLatitude>=t&&this.minLongitude<=e&&this.maxLongitude>=e},s.prototype.intersection=function(t){if(!t instanceof s)throw new e(r.logMessage(r.LEVEL_SEVERE,"Sector","intersection","missingSector"));return this.minLatitude<t.minLatitude&&(this.minLatitude=t.minLatitude),this.maxLatitude>t.maxLatitude&&(this.maxLatitude=t.maxLatitude),this.minLongitude<t.minLongitude&&(this.minLongitude=t.minLongitude),this.maxLongitude>t.maxLongitude&&(this.maxLongitude=t.maxLongitude),this.maxLatitude<this.minLatitude&&(this.maxLatitude=this.minLatitude),this.maxLongitude<this.minLongitude&&(this.maxLongitude=this.minLongitude),this},s.prototype.getCorners=function(){var t=[];return t.push(new i(this.minLatitude,this.minLongitude)),t.push(new i(this.minLatitude,this.maxLongitude)),t.push(new i(this.maxLatitude,this.maxLongitude)),t.push(new i(this.maxLatitude,this.minLongitude)),t},s.prototype.computeBoundingPoints=function(t,o){if(null===t)throw new e(r.logMessage(r.LEVEL_SEVERE,"Sector","computeBoundingBox","missingGlobe"));var s=t.minAndMaxElevationsForSector(this),a=s[0]*o,l=s[1]*o;a===l&&(l=a+10);for(var h=[],u=this.getCorners(),c=0;c<u.length;c++)h.push(t.computePointFromPosition(u[c].latitude,u[c].longitude,a,new n(0,0,0))),h.push(t.computePointFromPosition(u[c].latitude,u[c].longitude,l,new n(0,0,0)));var d=this.centroid(new i(0,0));if(h.push(t.computePointFromPosition(d.latitude,d.longitude,l,new n(0,0,0))),this.minLatitude<0&&this.maxLatitude>0?(h.push(t.computePointFromPosition(this.minLatitude,d.longitude,l,new n(0,0,0))),h.push(t.computePointFromPosition(this.maxLatitude,d.longitude,l,new n(0,0,0))),h.push(t.computePointFromPosition(0,this.minLongitude,l,new n(0,0,0))),h.push(t.computePointFromPosition(0,this.maxLongitude,l,new n(0,0,0)))):this.minLatitude<0?h.push(t.computePointFromPosition(this.maxLatitude,d.longitude,l,new n(0,0,0))):h.push(t.computePointFromPosition(this.minLatitude,d.longitude,l,new n(0,0,0))),this.deltaLongitude()>=360){var p=this.minLatitude;h.push(t.computePointFromPosition(p,0,l,new n(0,0,0))),h.push(t.computePointFromPosition(p,90,l,new n(0,0,0))),h.push(t.computePointFromPosition(p,-90,l,new n(0,0,0))),h.push(t.computePointFromPosition(p,180,l,new n(0,0,0)));var f=this.maxLatitude;h.push(t.computePointFromPosition(f,0,l,new n(0,0,0))),h.push(t.computePointFromPosition(f,90,l,new n(0,0,0))),h.push(t.computePointFromPosition(f,-90,l,new n(0,0,0))),h.push(t.computePointFromPosition(f,180,l,new n(0,0,0)))}else if(this.deltaLongitude()>180){var g=d.longitude,m=d.latitude,E=(this.minLongitude+g)/2;h.push(t.computePointFromPosition(m,E,l,new n(0,0,0))),E=(g+this.maxLongitude)/2,h.push(t.computePointFromPosition(m,E,l,new n(0,0,0))),h.push(t.computePointFromPosition(m,this.minLongitude,l,new n(0,0,0))),h.push(t.computePointFromPosition(m,this.maxLongitude,l,new n(0,0,0)))}return h},s.prototype.union=function(t){if(!t instanceof s)throw new e(r.logMessage(r.LEVEL_SEVERE,"Sector","union","missingSector"));return this.minLatitude>t.minLatitude&&(this.minLatitude=t.minLatitude),this.maxLatitude<t.maxLatitude&&(this.maxLatitude=t.maxLatitude),this.minLongitude>t.minLongitude&&(this.minLongitude=t.minLongitude),this.maxLongitude<t.maxLongitude&&(this.maxLongitude=t.maxLongitude),this},s});var r={};return r.DEBUG=!1,r.assert=function(t,e){if(r.DEBUG&&!t)throw new Error("Assertion failed"+(e?": "+e:""))},r.GLU_TESS_MAX_COORD=1e150,r.TRUE_PROJECT=!1,r.TESS_MAX_CACHE=100,r.GLU_TESS_DEFAULT_TOLERANCE=0,r.windingRule={GLU_TESS_WINDING_ODD:100130,GLU_TESS_WINDING_NONZERO:100131,GLU_TESS_WINDING_POSITIVE:100132,GLU_TESS_WINDING_NEGATIVE:100133,GLU_TESS_WINDING_ABS_GEQ_TWO:100134},r.primitiveType={GL_LINE_LOOP:2,GL_TRIANGLES:4,GL_TRIANGLE_STRIP:5,GL_TRIANGLE_FAN:6},r.errorType={GLU_TESS_MISSING_BEGIN_POLYGON:100151,GLU_TESS_MISSING_END_POLYGON:100153,GLU_TESS_MISSING_BEGIN_CONTOUR:100152,GLU_TESS_MISSING_END_CONTOUR:100154,GLU_TESS_COORD_TOO_LARGE:100155,GLU_TESS_NEED_COMBINE_CALLBACK:100156},r.gluEnum={GLU_TESS_BEGIN:100100,GLU_TESS_VERTEX:100101,GLU_TESS_END:100102,GLU_TESS_ERROR:100103,GLU_TESS_EDGE_FLAG:100104,GLU_TESS_COMBINE:100105,GLU_TESS_BEGIN_DATA:100106,GLU_TESS_VERTEX_DATA:100107,GLU_TESS_END_DATA:100108,GLU_TESS_ERROR_DATA:100109,GLU_TESS_EDGE_FLAG_DATA:100110,GLU_TESS_COMBINE_DATA:100111,GLU_TESS_MESH:100112,GLU_TESS_TOLERANCE:100142,GLU_TESS_WINDING_RULE:100140,GLU_TESS_BOUNDARY_ONLY:100141,GLU_INVALID_ENUM:100900,GLU_INVALID_VALUE:100901},r.PQHandle,r.PQKey,r.geom={},r.geom.vertEq=function(t,e){return t.s===e.s&&t.t===e.t},r.geom.vertLeq=function(t,e){return t.s<e.s||t.s===e.s&&t.t<=e.t},r.geom.edgeEval=function(t,e,i){var r=e.s-t.s,n=i.s-e.s;return r+n>0?r<n?e.t-t.t+(t.t-i.t)*(r/(r+n)):e.t-i.t+(i.t-t.t)*(n/(r+n)):0},r.geom.edgeSign=function(t,e,i){var r=e.s-t.s,n=i.s-e.s;return r+n>0?(e.t-i.t)*r+(e.t-t.t)*n:0},r.geom.transLeq=function(t,e){return t.t<e.t||t.t===e.t&&t.s<=e.s},r.geom.transEval=function(t,e,i){var r=e.t-t.t,n=i.t-e.t;return r+n>0?r<n?e.s-t.s+(t.s-i.s)*(r/(r+n)):e.s-i.s+(i.s-t.s)*(n/(r+n)):0},r.geom.transSign=function(t,e,i){var r=e.t-t.t,n=i.t-e.t;return r+n>0?(e.s-i.s)*r+(e.s-t.s)*n:0},r.geom.edgeGoesLeft=function(t){return r.geom.vertLeq(t.dst(),t.org)},r.geom.edgeGoesRight=function(t){return r.geom.vertLeq(t.org,t.dst())},r.geom.vertL1dist=function(t,e){return Math.abs(t.s-e.s)+Math.abs(t.t-e.t)},r.geom.vertCCW=function(t,e,i){return t.s*(e.t-i.t)+e.s*(i.t-t.t)+i.s*(t.t-e.t)>=0},r.geom.interpolate_=function(t,e,i,r){return t=t<0?0:t,i=i<0?0:i,t<=i?0===i?(e+r)/2:e+t/(t+i)*(r-e):r+i/(t+i)*(e-r)},r.geom.edgeIntersect=function(t,e,i,n,o){var s,a,l;r.geom.vertLeq(t,e)||(l=t,t=e,e=l),r.geom.vertLeq(i,n)||(l=i,i=n,n=l),r.geom.vertLeq(t,i)||(l=t,t=i,i=l,l=e,e=n,n=l),r.geom.vertLeq(i,e)?r.geom.vertLeq(e,n)?(s=r.geom.edgeEval(t,i,e),a=r.geom.edgeEval(i,e,n),s+a<0&&(s=-s,a=-a),o.s=r.geom.interpolate_(s,i.s,a,e.s)):(s=r.geom.edgeSign(t,i,e),a=-r.geom.edgeSign(t,n,e),s+a<0&&(s=-s,a=-a),o.s=r.geom.interpolate_(s,i.s,a,n.s)):o.s=(i.s+e.s)/2,r.geom.transLeq(t,e)||(l=t,t=e,e=l),r.geom.transLeq(i,n)||(l=i,i=n,n=l),r.geom.transLeq(t,i)||(l=t,t=i,i=l,l=e,e=n,n=l),r.geom.transLeq(i,e)?r.geom.transLeq(e,n)?(s=r.geom.transEval(t,i,e),a=r.geom.transEval(i,e,n),s+a<0&&(s=-s,a=-a),o.t=r.geom.interpolate_(s,i.t,a,e.t)):(s=r.geom.transSign(t,i,e),a=-r.geom.transSign(t,n,e),s+a<0&&(s=-s,a=-a),o.t=r.geom.interpolate_(s,i.t,a,n.t)):o.t=(i.t+e.t)/2},r.mesh={},r.mesh.makeEdge=function(t){var e=r.mesh.makeEdgePair_(t.eHead);return r.mesh.makeVertex_(e,t.vHead),r.mesh.makeVertex_(e.sym,t.vHead),r.mesh.makeFace_(e,t.fHead),e},r.mesh.meshSplice=function(t,e){var i=!1,n=!1;t!==e&&(e.org!==t.org&&(n=!0,r.mesh.killVertex_(e.org,t.org)),e.lFace!==t.lFace&&(i=!0,r.mesh.killFace_(e.lFace,t.lFace)),r.mesh.splice_(e,t),n||(r.mesh.makeVertex_(e,t.org),t.org.anEdge=t),i||(r.mesh.makeFace_(e,t.lFace),t.lFace.anEdge=t))},r.mesh.deleteEdge=function(t){var e=t.sym,i=!1;t.lFace!==t.rFace()&&(i=!0,r.mesh.killFace_(t.lFace,t.rFace())),t.oNext===t?r.mesh.killVertex_(t.org,null):(t.rFace().anEdge=t.oPrev(),t.org.anEdge=t.oNext,r.mesh.splice_(t,t.oPrev()),i||r.mesh.makeFace_(t,t.lFace)),e.oNext===e?(r.mesh.killVertex_(e.org,null),r.mesh.killFace_(e.lFace,null)):(t.lFace.anEdge=e.oPrev(),e.org.anEdge=e.oNext,r.mesh.splice_(e,e.oPrev())),r.mesh.killEdge_(t)},r.mesh.addEdgeVertex=function(t){var e=r.mesh.makeEdgePair_(t),i=e.sym;return r.mesh.splice_(e,t.lNext),e.org=t.dst(),r.mesh.makeVertex_(i,e.org),e.lFace=i.lFace=t.lFace,e},r.mesh.splitEdge=function(t){var e=r.mesh.addEdgeVertex(t),i=e.sym;return r.mesh.splice_(t.sym,t.sym.oPrev()),r.mesh.splice_(t.sym,i),t.sym.org=i.org,i.dst().anEdge=i.sym,i.sym.lFace=t.rFace(),i.winding=t.winding,i.sym.winding=t.sym.winding,i},r.mesh.connect=function(t,e){var i=!1,n=r.mesh.makeEdgePair_(t),o=n.sym;return e.lFace!==t.lFace&&(i=!0,r.mesh.killFace_(e.lFace,t.lFace)),r.mesh.splice_(n,t.lNext),r.mesh.splice_(o,e),n.org=t.dst(),o.org=e.org,n.lFace=o.lFace=t.lFace,t.lFace.anEdge=o,i||r.mesh.makeFace_(n,t.lFace),n},r.mesh.zapFace=function(t){var e,i=t.anEdge,n=i.lNext;do{if(e=n,n=e.lNext,e.lFace=null,null===e.rFace()){e.oNext===e?r.mesh.killVertex_(e.org,null):(e.org.anEdge=e.oNext,r.mesh.splice_(e,e.oPrev()));var o=e.sym;o.oNext===o?r.mesh.killVertex_(o.org,null):(o.org.anEdge=o.oNext,r.mesh.splice_(o,o.oPrev())),r.mesh.killEdge_(e)}}while(e!==i);var s=t.prev,a=t.next;a.prev=s,s.next=a},r.mesh.meshUnion=function(t,e){var i=t.fHead,r=t.vHead,n=t.eHead,o=e.fHead,s=e.vHead,a=e.eHead;return o.next!==o&&(i.prev.next=o.next,o.next.prev=i.prev,o.prev.next=i,i.prev=o.prev),s.next!==s&&(r.prev.next=s.next,s.next.prev=r.prev,s.prev.next=r,r.prev=s.prev),a.next!==a&&(n.sym.next.sym.next=a.next,a.next.sym.next=n.sym.next,a.sym.next.sym.next=n,n.sym.next=a.sym.next),t},r.mesh.deleteMesh=function(t){},r.mesh.makeEdgePair_=function(t){var e=new r.GluHalfEdge,i=new r.GluHalfEdge,n=t.sym.next;return i.next=n,n.sym.next=e,e.next=t,t.sym.next=i,e.sym=i,e.oNext=e,e.lNext=i,i.sym=e,i.oNext=i,i.lNext=e,e},r.mesh.splice_=function(t,e){var i=t.oNext,r=e.oNext;i.sym.lNext=e,r.sym.lNext=t,t.oNext=r,e.oNext=i},r.mesh.makeVertex_=function(t,e){var i=e.prev,n=new r.GluVertex(e,i);i.next=n,e.prev=n,n.anEdge=t;var o=t;do{o.org=n,o=o.oNext}while(o!==t)},r.mesh.makeFace_=function(t,e){var i=e.prev,n=new r.GluFace(e,i);i.next=n,e.prev=n,n.anEdge=t,n.inside=e.inside;var o=t;do{o.lFace=n,o=o.lNext}while(o!==t)},r.mesh.killEdge_=function(t){var e=t.next,i=t.sym.next;e.sym.next=i,i.sym.next=e},r.mesh.killVertex_=function(t,e){var i=t.anEdge,r=i;do{r.org=e,r=r.oNext}while(r!==i);var n=t.prev,o=t.next;o.prev=n,n.next=o},r.mesh.killFace_=function(t,e){
var i=t.anEdge,r=i;do{r.lFace=e,r=r.lNext}while(r!==i);var n=t.prev,o=t.next;o.prev=n,n.next=o},r.normal={},r.normal.S_UNIT_X_=1,r.normal.S_UNIT_Y_=0,r.normal.projectPolygon=function(t){var e=!1,i=[t.normal[0],t.normal[1],t.normal[2]];0===i[0]&&0===i[1]&&0===i[2]&&(r.normal.computeNormal_(t,i),e=!0);var n=t.sUnit,o=t.tUnit,s=r.normal.longAxis_(i);if(r.TRUE_PROJECT){r.normal.normalize_(i),n[s]=0,n[(s+1)%3]=r.normal.S_UNIT_X_,n[(s+2)%3]=r.normal.S_UNIT_Y_;var a=r.normal.dot_(n,i);n[0]-=a*i[0],n[1]-=a*i[1],n[2]-=a*i[2],r.normal.normalize_(n),o[0]=i[1]*n[2]-i[2]*n[1],o[1]=i[2]*n[0]-i[0]*n[2],o[2]=i[0]*n[1]-i[1]*n[0],r.normal.normalize_(o)}else n[s]=0,n[(s+1)%3]=r.normal.S_UNIT_X_,n[(s+2)%3]=r.normal.S_UNIT_Y_,o[s]=0,o[(s+1)%3]=i[s]>0?-r.normal.S_UNIT_Y_:r.normal.S_UNIT_Y_,o[(s+2)%3]=i[s]>0?r.normal.S_UNIT_X_:-r.normal.S_UNIT_X_;for(var l=t.mesh.vHead,h=l.next;h!==l;h=h.next)h.s=r.normal.dot_(h.coords,n),h.t=r.normal.dot_(h.coords,o);e&&r.normal.checkOrientation_(t)},r.normal.dot_=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]},r.normal.normalize_=function(t){var e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2];e=Math.sqrt(e),t[0]/=e,t[1]/=e,t[2]/=e},r.normal.longAxis_=function(t){var e=0;return Math.abs(t[1])>Math.abs(t[0])&&(e=1),Math.abs(t[2])>Math.abs(t[e])&&(e=2),e},r.normal.computeNormal_=function(t,e){var i,n=[-2*r.GLU_TESS_MAX_COORD,-2*r.GLU_TESS_MAX_COORD,-2*r.GLU_TESS_MAX_COORD],o=[2*r.GLU_TESS_MAX_COORD,2*r.GLU_TESS_MAX_COORD,2*r.GLU_TESS_MAX_COORD],s=[],a=[],l=t.mesh.vHead;for(i=l.next;i!==l;i=i.next)for(var h=0;h<3;++h){var u=i.coords[h];u<o[h]&&(o[h]=u,a[h]=i),u>n[h]&&(n[h]=u,s[h]=i)}var c=0;if(n[1]-o[1]>n[0]-o[0]&&(c=1),n[2]-o[2]>n[c]-o[c]&&(c=2),o[c]>=n[c])return e[0]=0,e[1]=0,void(e[2]=1);var d=0,p=a[c],f=s[c],g=[0,0,0],m=[p.coords[0]-f.coords[0],p.coords[1]-f.coords[1],p.coords[2]-f.coords[2]],E=[0,0,0];for(i=l.next;i!==l;i=i.next){E[0]=i.coords[0]-f.coords[0],E[1]=i.coords[1]-f.coords[1],E[2]=i.coords[2]-f.coords[2],g[0]=m[1]*E[2]-m[2]*E[1],g[1]=m[2]*E[0]-m[0]*E[2],g[2]=m[0]*E[1]-m[1]*E[0];var y=g[0]*g[0]+g[1]*g[1]+g[2]*g[2];y>d&&(d=y,e[0]=g[0],e[1]=g[1],e[2]=g[2])}d<=0&&(e[0]=e[1]=e[2]=0,e[r.normal.longAxis_(m)]=1)},r.normal.checkOrientation_=function(t){for(var e=0,i=t.mesh.fHead,r=i.next;r!==i;r=r.next){var n=r.anEdge;if(!(n.winding<=0))do{e+=(n.org.s-n.dst().s)*(n.org.t+n.dst().t),n=n.lNext}while(n!==r.anEdge)}if(e<0){for(var o=t.mesh.vHead,s=o.next;s!==o;s=s.next)s.t=-s.t;t.tUnit[0]=-t.tUnit[0],t.tUnit[1]=-t.tUnit[1],t.tUnit[2]=-t.tUnit[2]}},r.render={},r.render.renderMesh=function(t,e,i){for(var n=!1,o=-1,s=e.fHead.prev;s!==e.fHead;s=s.prev)if(s.inside){n||(t.callBeginOrBeginData(r.primitiveType.GL_TRIANGLES),n=!0);var a=s.anEdge;do{if(i){var l=a.rFace().inside?0:1;o!==l&&(o=l,t.callEdgeFlagOrEdgeFlagData(!!o))}t.callVertexOrVertexData(a.org.data),a=a.lNext}while(a!==s.anEdge)}n&&t.callEndOrEndData()},r.render.renderBoundary=function(t,e){for(var i=e.fHead.next;i!==e.fHead;i=i.next)if(i.inside){t.callBeginOrBeginData(r.primitiveType.GL_LINE_LOOP);var n=i.anEdge;do{t.callVertexOrVertexData(n.org.data),n=n.lNext}while(n!==i.anEdge);t.callEndOrEndData()}},r.sweep={},r.sweep.SENTINEL_COORD_=4*r.GLU_TESS_MAX_COORD,r.sweep.TOLERANCE_NONZERO_=!1,r.sweep.computeInterior=function(t){t.fatalError=!1,r.sweep.removeDegenerateEdges_(t),r.sweep.initPriorityQ_(t),r.sweep.initEdgeDict_(t);for(var e;null!==(e=t.pq.extractMin());){for(;;){var i=t.pq.minimum();if(null===i||!r.geom.vertEq(i,e))break;i=t.pq.extractMin(),r.sweep.spliceMergeVertices_(t,e.anEdge,i.anEdge)}r.sweep.sweepEvent_(t,e)}var n=t.dict.getMin().getKey();t.event=n.eUp.org,r.sweep.doneEdgeDict_(t),r.sweep.donePriorityQ_(t),r.sweep.removeDegenerateFaces_(t.mesh),t.mesh.checkMesh()},r.sweep.addWinding_=function(t,e){t.winding+=e.winding,t.sym.winding+=e.sym.winding},r.sweep.edgeLeq_=function(t,e,i){var n=t.event,o=e.eUp,s=i.eUp;return o.dst()===n?s.dst()===n?r.geom.vertLeq(o.org,s.org)?r.geom.edgeSign(s.dst(),o.org,s.org)<=0:r.geom.edgeSign(o.dst(),s.org,o.org)>=0:r.geom.edgeSign(s.dst(),n,s.org)<=0:s.dst()===n?r.geom.edgeSign(o.dst(),n,o.org)>=0:r.geom.edgeEval(o.dst(),n,o.org)>=r.geom.edgeEval(s.dst(),n,s.org)},r.sweep.deleteRegion_=function(t,e){e.fixUpperEdge,e.eUp.activeRegion=null,t.dict.deleteNode(e.nodeUp),e.nodeUp=null},r.sweep.fixUpperEdge_=function(t,e){r.mesh.deleteEdge(t.eUp),t.fixUpperEdge=!1,t.eUp=e,e.activeRegion=t},r.sweep.topLeftRegion_=function(t){var e=t.eUp.org;do{t=t.regionAbove()}while(t.eUp.org===e);if(t.fixUpperEdge){var i=r.mesh.connect(t.regionBelow().eUp.sym,t.eUp.lNext);r.sweep.fixUpperEdge_(t,i),t=t.regionAbove()}return t},r.sweep.topRightRegion_=function(t){var e=t.eUp.dst();do{t=t.regionAbove()}while(t.eUp.dst()===e);return t},r.sweep.addRegionBelow_=function(t,e,i){var n=new r.ActiveRegion;return n.eUp=i,n.nodeUp=t.dict.insertBefore(e.nodeUp,n),i.activeRegion=n,n},r.sweep.isWindingInside_=function(t,e){switch(t.windingRule){case r.windingRule.GLU_TESS_WINDING_ODD:return 0!=(1&e);case r.windingRule.GLU_TESS_WINDING_NONZERO:return 0!==e;case r.windingRule.GLU_TESS_WINDING_POSITIVE:return e>0;case r.windingRule.GLU_TESS_WINDING_NEGATIVE:return e<0;case r.windingRule.GLU_TESS_WINDING_ABS_GEQ_TWO:return e>=2||e<=-2}return!1},r.sweep.computeWinding_=function(t,e){e.windingNumber=e.regionAbove().windingNumber+e.eUp.winding,e.inside=r.sweep.isWindingInside_(t,e.windingNumber)},r.sweep.finishRegion_=function(t,e){var i=e.eUp,n=i.lFace;n.inside=e.inside,n.anEdge=i,r.sweep.deleteRegion_(t,e)},r.sweep.finishLeftRegions_=function(t,e,i){for(var n=e,o=e.eUp;n!==i;){n.fixUpperEdge=!1;var s=n.regionBelow(),a=s.eUp;if(a.org!==o.org){if(!s.fixUpperEdge){r.sweep.finishRegion_(t,n);break}a=r.mesh.connect(o.lPrev(),a.sym),r.sweep.fixUpperEdge_(s,a)}o.oNext!==a&&(r.mesh.meshSplice(a.oPrev(),a),r.mesh.meshSplice(o,a)),r.sweep.finishRegion_(t,n),o=s.eUp,n=s}return o},r.sweep.addRightEdges_=function(t,e,i,n,o,s){var a=!0,l=i;do{r.sweep.addRegionBelow_(t,e,l.sym),l=l.oNext}while(l!==n);null===o&&(o=e.regionBelow().eUp.rPrev());for(var h,u=e,c=o;h=u.regionBelow(),l=h.eUp.sym,l.org===c.org;)l.oNext!==c&&(r.mesh.meshSplice(l.oPrev(),l),r.mesh.meshSplice(c.oPrev(),l)),h.windingNumber=u.windingNumber-l.winding,h.inside=r.sweep.isWindingInside_(t,h.windingNumber),u.dirty=!0,!a&&r.sweep.checkForRightSplice_(t,u)&&(r.sweep.addWinding_(l,c),r.sweep.deleteRegion_(t,u),r.mesh.deleteEdge(c)),a=!1,u=h,c=l;u.dirty=!0,s&&r.sweep.walkDirtyRegions_(t,u)},r.sweep.callCombine_=function(t,e,i,n,o){var s=[e.coords[0],e.coords[1],e.coords[2]];e.data=null,e.data=t.callCombineOrCombineData(s,i,n),null===e.data&&(o?t.fatalError||(t.callErrorOrErrorData(r.errorType.GLU_TESS_NEED_COMBINE_CALLBACK),t.fatalError=!0):e.data=i[0])},r.sweep.spliceMergeVertices_=function(t,e,i){var n=[null,null,null,null],o=[.5,.5,0,0];n[0]=e.org.data,n[1]=i.org.data,r.sweep.callCombine_(t,e.org,n,o,!1),r.mesh.meshSplice(e,i)},r.sweep.vertexWeights_=function(t,e,i,n,o){var s=r.geom.vertL1dist(e,t),a=r.geom.vertL1dist(i,t),l=o,h=o+1;n[l]=.5*a/(s+a),n[h]=.5*s/(s+a),t.coords[0]+=n[l]*e.coords[0]+n[h]*i.coords[0],t.coords[1]+=n[l]*e.coords[1]+n[h]*i.coords[1],t.coords[2]+=n[l]*e.coords[2]+n[h]*i.coords[2]},r.sweep.getIntersectData_=function(t,e,i,n,o,s){var a=[0,0,0,0],l=[i.data,n.data,o.data,s.data];e.coords[0]=e.coords[1]=e.coords[2]=0,r.sweep.vertexWeights_(e,i,n,a,0),r.sweep.vertexWeights_(e,o,s,a,2),r.sweep.callCombine_(t,e,l,a,!0)},r.sweep.checkForRightSplice_=function(t,e){var i=e.regionBelow(),n=e.eUp,o=i.eUp;if(r.geom.vertLeq(n.org,o.org)){if(r.geom.edgeSign(o.dst(),n.org,o.org)>0)return!1;r.geom.vertEq(n.org,o.org)?n.org!==o.org&&(t.pq.remove(n.org.pqHandle),r.sweep.spliceMergeVertices_(t,o.oPrev(),n)):(r.mesh.splitEdge(o.sym),r.mesh.meshSplice(n,o.oPrev()),e.dirty=i.dirty=!0)}else{if(r.geom.edgeSign(n.dst(),o.org,n.org)<0)return!1;e.regionAbove().dirty=e.dirty=!0,r.mesh.splitEdge(n.sym),r.mesh.meshSplice(o.oPrev(),n)}return!0},r.sweep.checkForLeftSplice_=function(t,e){var i,n=e.regionBelow(),o=e.eUp,s=n.eUp;if(r.geom.vertLeq(o.dst(),s.dst())){if(r.geom.edgeSign(o.dst(),s.dst(),o.org)<0)return!1;e.regionAbove().dirty=e.dirty=!0,i=r.mesh.splitEdge(o),r.mesh.meshSplice(s.sym,i),i.lFace.inside=e.inside}else{if(r.geom.edgeSign(s.dst(),o.dst(),s.org)>0)return!1;e.dirty=n.dirty=!0,i=r.mesh.splitEdge(s),r.mesh.meshSplice(o.lNext,s.sym),i.rFace().inside=e.inside}return!0},r.sweep.checkForIntersect_=function(t,e){var i=e.regionBelow(),n=e.eUp,o=i.eUp,s=n.org,a=o.org,l=n.dst(),h=o.dst(),u=new r.GluVertex;if(s===a)return!1;if(Math.min(s.t,l.t)>Math.max(a.t,h.t))return!1;if(r.geom.vertLeq(s,a)){if(r.geom.edgeSign(h,s,a)>0)return!1}else if(r.geom.edgeSign(l,a,s)<0)return!1;r.geom.edgeIntersect(l,s,h,a,u),r.geom.vertLeq(u,t.event)&&(u.s=t.event.s,u.t=t.event.t);var c=r.geom.vertLeq(s,a)?s:a;if(r.geom.vertLeq(c,u)&&(u.s=c.s,u.t=c.t),r.geom.vertEq(u,s)||r.geom.vertEq(u,a))return r.sweep.checkForRightSplice_(t,e),!1;if(!r.geom.vertEq(l,t.event)&&r.geom.edgeSign(l,t.event,u)>=0||!r.geom.vertEq(h,t.event)&&r.geom.edgeSign(h,t.event,u)<=0){if(h===t.event)return r.mesh.splitEdge(n.sym),r.mesh.meshSplice(o.sym,n),e=r.sweep.topLeftRegion_(e),n=e.regionBelow().eUp,r.sweep.finishLeftRegions_(t,e.regionBelow(),i),r.sweep.addRightEdges_(t,e,n.oPrev(),n,n,!0),!0;if(l===t.event){r.mesh.splitEdge(o.sym),r.mesh.meshSplice(n.lNext,o.oPrev()),i=e,e=r.sweep.topRightRegion_(e);var d=e.regionBelow().eUp.rPrev();return i.eUp=o.oPrev(),o=r.sweep.finishLeftRegions_(t,i,null),r.sweep.addRightEdges_(t,e,o.oNext,n.rPrev(),d,!0),!0}return r.geom.edgeSign(l,t.event,u)>=0&&(e.regionAbove().dirty=e.dirty=!0,r.mesh.splitEdge(n.sym),n.org.s=t.event.s,n.org.t=t.event.t),r.geom.edgeSign(h,t.event,u)<=0&&(e.dirty=i.dirty=!0,r.mesh.splitEdge(o.sym),o.org.s=t.event.s,o.org.t=t.event.t),!1}return r.mesh.splitEdge(n.sym),r.mesh.splitEdge(o.sym),r.mesh.meshSplice(o.oPrev(),n),n.org.s=u.s,n.org.t=u.t,n.org.pqHandle=t.pq.insert(n.org),r.sweep.getIntersectData_(t,n.org,s,l,a,h),e.regionAbove().dirty=e.dirty=i.dirty=!0,!1},r.sweep.walkDirtyRegions_=function(t,e){for(var i=e.regionBelow();;){for(;i.dirty;)e=i,i=i.regionBelow();if(!e.dirty&&(i=e,null===(e=e.regionAbove())||!e.dirty))return;e.dirty=!1;var n=e.eUp,o=i.eUp;if(n.dst()!==o.dst()&&r.sweep.checkForLeftSplice_(t,e)&&(i.fixUpperEdge?(r.sweep.deleteRegion_(t,i),r.mesh.deleteEdge(o),i=e.regionBelow(),o=i.eUp):e.fixUpperEdge&&(r.sweep.deleteRegion_(t,e),r.mesh.deleteEdge(n),e=i.regionAbove(),n=e.eUp)),n.org!==o.org)if(n.dst()===o.dst()||e.fixUpperEdge||i.fixUpperEdge||n.dst()!==t.event&&o.dst()!==t.event)r.sweep.checkForRightSplice_(t,e);else if(r.sweep.checkForIntersect_(t,e))return;n.org===o.org&&n.dst()===o.dst()&&(r.sweep.addWinding_(o,n),r.sweep.deleteRegion_(t,e),r.mesh.deleteEdge(n),e=i.regionAbove())}},r.sweep.connectRightVertex_=function(t,e,i){var n=i.oNext,o=e.regionBelow(),s=e.eUp,a=o.eUp,l=!1;if(s.dst()!==a.dst()&&r.sweep.checkForIntersect_(t,e),r.geom.vertEq(s.org,t.event)&&(r.mesh.meshSplice(n.oPrev(),s),e=r.sweep.topLeftRegion_(e),n=e.regionBelow().eUp,r.sweep.finishLeftRegions_(t,e.regionBelow(),o),l=!0),r.geom.vertEq(a.org,t.event)&&(r.mesh.meshSplice(i,a.oPrev()),i=r.sweep.finishLeftRegions_(t,o,null),l=!0),l)return void r.sweep.addRightEdges_(t,e,i.oNext,n,n,!0);var h;h=r.geom.vertLeq(a.org,s.org)?a.oPrev():s,h=r.mesh.connect(i.lPrev(),h),r.sweep.addRightEdges_(t,e,h,h.oNext,h.oNext,!1),h.sym.activeRegion.fixUpperEdge=!0,r.sweep.walkDirtyRegions_(t,e)},r.sweep.connectLeftDegenerate_=function(t,e,i){var n=e.eUp;if(r.geom.vertEq(n.org,i))return void(r.sweep.TOLERANCE_NONZERO_&&r.sweep.spliceMergeVertices_(t,n,i.anEdge));if(!r.geom.vertEq(n.dst(),i))return r.mesh.splitEdge(n.sym),e.fixUpperEdge&&(r.mesh.deleteEdge(n.oNext),e.fixUpperEdge=!1),r.mesh.meshSplice(i.anEdge,n),void r.sweep.sweepEvent_(t,i);if(r.sweep.TOLERANCE_NONZERO_){e=r.sweep.topRightRegion_(e);var o=e.regionBelow(),s=o.eUp.sym,a=s.oNext,l=a;o.fixUpperEdge&&(r.sweep.deleteRegion_(t,o),r.mesh.deleteEdge(s),s=a.oPrev()),r.mesh.meshSplice(i.anEdge,s),r.geom.edgeGoesLeft(a)||(a=null),r.sweep.addRightEdges_(t,e,s.oNext,l,a,!0)}},r.sweep.connectLeftVertex_=function(t,e){var i=new r.ActiveRegion;i.eUp=e.anEdge.sym;var n=t.dict.search(i).getKey(),o=n.regionBelow(),s=n.eUp,a=o.eUp;if(0===r.geom.edgeSign(s.dst(),e,s.org))return void r.sweep.connectLeftDegenerate_(t,n,e);var l,h=r.geom.vertLeq(a.dst(),s.dst())?n:o;if(n.inside||h.fixUpperEdge){if(h===n)l=r.mesh.connect(e.anEdge.sym,s.lNext);else{l=r.mesh.connect(a.dNext(),e.anEdge).sym}h.fixUpperEdge?r.sweep.fixUpperEdge_(h,l):r.sweep.computeWinding_(t,r.sweep.addRegionBelow_(t,n,l)),r.sweep.sweepEvent_(t,e)}else r.sweep.addRightEdges_(t,n,e.anEdge,e.anEdge,null,!0)},r.sweep.sweepEvent_=function(t,e){t.event=e;for(var i=e.anEdge;null===i.activeRegion;)if((i=i.oNext)===e.anEdge)return void r.sweep.connectLeftVertex_(t,e);var n=r.sweep.topLeftRegion_(i.activeRegion),o=n.regionBelow(),s=o.eUp,a=r.sweep.finishLeftRegions_(t,o,null);a.oNext===s?r.sweep.connectRightVertex_(t,n,a):r.sweep.addRightEdges_(t,n,a.oNext,s,s,!0)},r.sweep.addSentinel_=function(t,e){var i=new r.ActiveRegion,n=r.mesh.makeEdge(t.mesh);n.org.s=r.sweep.SENTINEL_COORD_,n.org.t=e,n.dst().s=-r.sweep.SENTINEL_COORD_,n.dst().t=e,t.event=n.dst(),i.eUp=n,i.windingNumber=0,i.inside=!1,i.fixUpperEdge=!1,i.sentinel=!0,i.dirty=!1,i.nodeUp=t.dict.insert(i)},r.sweep.initEdgeDict_=function(t){t.dict=new r.Dict(t,r.sweep.edgeLeq_),r.sweep.addSentinel_(t,-r.sweep.SENTINEL_COORD_),r.sweep.addSentinel_(t,r.sweep.SENTINEL_COORD_)},r.sweep.doneEdgeDict_=function(t){for(var e;null!==(e=t.dict.getMin().getKey());)e.sentinel,r.sweep.deleteRegion_(t,e);t.dict=null},r.sweep.removeDegenerateEdges_=function(t){for(var e,i=t.mesh.eHead,n=i.next;n!==i;n=e){e=n.next;var o=n.lNext;r.geom.vertEq(n.org,n.dst())&&n.lNext.lNext!==n&&(r.sweep.spliceMergeVertices_(t,o,n),r.mesh.deleteEdge(n),n=o,o=n.lNext),o.lNext===n&&(o!==n&&(o!==e&&o!==e.sym||(e=e.next),r.mesh.deleteEdge(o)),n!==e&&n!==e.sym||(e=e.next),r.mesh.deleteEdge(n))}},r.sweep.initPriorityQ_=function(t){var e=new r.PriorityQ(r.geom.vertLeq);t.pq=e;var i,n=t.mesh.vHead;for(i=n.next;i!==n;i=i.next)i.pqHandle=e.insert(i);e.init()},r.sweep.donePriorityQ_=function(t){t.pq.deleteQ(),t.pq=null},r.sweep.removeDegenerateFaces_=function(t){for(var e,i=t.fHead.next;i!==t.fHead;i=e){e=i.next;var n=i.anEdge;n.lNext.lNext===n&&(r.sweep.addWinding_(n.oNext,n),r.mesh.deleteEdge(n))}},r.tessmono={},r.tessmono.tessellateMonoRegion_=function(t){for(var e=t.anEdge;r.geom.vertLeq(e.dst(),e.org);e=e.lPrev());for(;r.geom.vertLeq(e.org,e.dst());e=e.lNext);for(var i,n=e.lPrev();e.lNext!==n;)if(r.geom.vertLeq(e.dst(),n.org)){for(;n.lNext!==e&&(r.geom.edgeGoesLeft(n.lNext)||r.geom.edgeSign(n.org,n.dst(),n.lNext.dst())<=0);)i=r.mesh.connect(n.lNext,n),n=i.sym;n=n.lPrev()}else{for(;n.lNext!==e&&(r.geom.edgeGoesRight(e.lPrev())||r.geom.edgeSign(e.dst(),e.org,e.lPrev().org)>=0);)i=r.mesh.connect(e,e.lPrev()),e=i.sym;e=e.lNext}for(;n.lNext.lNext!==e;)i=r.mesh.connect(n.lNext,n),n=i.sym},r.tessmono.tessellateInterior=function(t){for(var e,i=t.fHead.next;i!==t.fHead;i=e)e=i.next,i.inside&&r.tessmono.tessellateMonoRegion_(i)},r.tessmono.discardExterior=function(t){for(var e,i=t.fHead.next;i!==t.fHead;i=e)e=i.next,i.inside||r.mesh.zapFace(i)},r.tessmono.setWindingNumber=function(t,e,i){for(var n,o=t.eHead.next;o!==t.eHead;o=n)n=o.next,o.rFace().inside!==o.lFace.inside?o.winding=o.lFace.inside?e:-e:i?r.mesh.deleteEdge(o):o.winding=0},r.Dict=function(t,e){this.head_=new r.DictNode,this.frame_=t,this.leq_=e},r.Dict.prototype.deleteDict_=function(){},r.Dict.prototype.insertBefore=function(t,e){do{t=t.prev}while(null!==t.key&&!this.leq_(this.frame_,t.key,e));var i=new r.DictNode(e,t.next,t);return t.next.prev=i,t.next=i,i},r.Dict.prototype.insert=function(t){return this.insertBefore(this.head_,t)},r.Dict.prototype.deleteNode=function(t){t.next.prev=t.prev,t.prev.next=t.next},r.Dict.prototype.search=function(t){var e=this.head_;do{e=e.next}while(null!==e.key&&!this.leq_(this.frame_,t,e.key));return e},r.Dict.prototype.getMin=function(){return this.head_.next},r.Dict.prototype.getMax=function(){return this.head_.prev},r.DictNode=function(t,e,i){this.key=t||null,this.next=e||this,this.prev=i||this},r.DictNode.prototype.getKey=function(){return this.key},r.DictNode.prototype.getSuccessor=function(){return this.next},r.DictNode.prototype.getPredecessor=function(){return this.prev},r.CachedVertex=function(){this.coords=[0,0,0],this.data=null},r.GluTesselator=function(){this.state=r.GluTesselator.tessState_.T_DORMANT,this.lastEdge_=null,this.mesh=null,this.callError_=null,this.normal=[0,0,0],this.sUnit=[0,0,0],this.tUnit=[0,0,0],this.relTolerance=r.GLU_TESS_DEFAULT_TOLERANCE,this.windingRule=r.windingRule.GLU_TESS_WINDING_ODD,this.fatalError=!1,this.dict=null,this.pq=null,this.event=null,this.callCombine_=null,this.boundaryOnly=!1,this.callBegin_=null,this.callEdgeFlag_=null,this.callVertex_=null,this.callEnd_=null,this.callMesh_=null,this.callBeginData_=null,this.callEdgeFlagData_=null,this.callVertexData_=null,this.callEndData_=null,this.callErrorData_=null,this.callCombineData_=null,this.polygonData_=null,this.emptyCache=!1,this.cacheCount=0,this.cache=new Array(r.TESS_MAX_CACHE);for(var t=0;t<r.TESS_MAX_CACHE;t++)this.cache[t]=new r.CachedVertex},r.GluTesselator.tessState_={T_DORMANT:0,T_IN_POLYGON:1,T_IN_CONTOUR:2},r.GluTesselator.prototype.gluDeleteTess=function(){this.requireState_(r.GluTesselator.tessState_.T_DORMANT)},r.GluTesselator.prototype.gluTessProperty=function(t,e){switch(t){case r.gluEnum.GLU_TESS_TOLERANCE:if(e<0||e>1)break;return void(this.relTolerance=e);case r.gluEnum.GLU_TESS_WINDING_RULE:var i=e;switch(i){case r.windingRule.GLU_TESS_WINDING_ODD:case r.windingRule.GLU_TESS_WINDING_NONZERO:case r.windingRule.GLU_TESS_WINDING_POSITIVE:case r.windingRule.GLU_TESS_WINDING_NEGATIVE:case r.windingRule.GLU_TESS_WINDING_ABS_GEQ_TWO:return void(this.windingRule=i)}break;case r.gluEnum.GLU_TESS_BOUNDARY_ONLY:return void(this.boundaryOnly=!!e);default:return void this.callErrorOrErrorData(r.gluEnum.GLU_INVALID_ENUM)}this.callErrorOrErrorData(r.gluEnum.GLU_INVALID_VALUE)},r.GluTesselator.prototype.gluGetTessProperty=function(t){switch(t){case r.gluEnum.GLU_TESS_TOLERANCE:return this.relTolerance;case r.gluEnum.GLU_TESS_WINDING_RULE:return this.windingRule;case r.gluEnum.GLU_TESS_BOUNDARY_ONLY:return this.boundaryOnly;default:this.callErrorOrErrorData(r.gluEnum.GLU_INVALID_ENUM)}return!1},r.GluTesselator.prototype.gluTessNormal=function(t,e,i){this.normal[0]=t,this.normal[1]=e,this.normal[2]=i},r.GluTesselator.prototype.gluTessCallback=function(t,e){var i=e||null;switch(t){case r.gluEnum.GLU_TESS_BEGIN:return void(this.callBegin_=i);case r.gluEnum.GLU_TESS_BEGIN_DATA:return void(this.callBeginData_=i);case r.gluEnum.GLU_TESS_EDGE_FLAG:return void(this.callEdgeFlag_=i);case r.gluEnum.GLU_TESS_EDGE_FLAG_DATA:return void(this.callEdgeFlagData_=i);case r.gluEnum.GLU_TESS_VERTEX:return void(this.callVertex_=i);case r.gluEnum.GLU_TESS_VERTEX_DATA:return void(this.callVertexData_=i);case r.gluEnum.GLU_TESS_END:return void(this.callEnd_=i);case r.gluEnum.GLU_TESS_END_DATA:return void(this.callEndData_=i);case r.gluEnum.GLU_TESS_ERROR:return void(this.callError_=i);case r.gluEnum.GLU_TESS_ERROR_DATA:return void(this.callErrorData_=i);case r.gluEnum.GLU_TESS_COMBINE:return void(this.callCombine_=i);case r.gluEnum.GLU_TESS_COMBINE_DATA:return void(this.callCombineData_=i);case r.gluEnum.GLU_TESS_MESH:return void(this.callMesh_=i);default:return void this.callErrorOrErrorData(r.gluEnum.GLU_INVALID_ENUM)}},r.GluTesselator.prototype.gluTessVertex=function(t,e){var i=!1,n=[0,0,0];this.requireState_(r.GluTesselator.tessState_.T_IN_CONTOUR),this.emptyCache&&(this.emptyCache_(),this.lastEdge_=null);for(var o=0;o<3;++o){var s=t[o];s<-r.GLU_TESS_MAX_COORD&&(s=-r.GLU_TESS_MAX_COORD,i=!0),s>r.GLU_TESS_MAX_COORD&&(s=r.GLU_TESS_MAX_COORD,i=!0),n[o]=s}if(i&&this.callErrorOrErrorData(r.errorType.GLU_TESS_COORD_TOO_LARGE),null===this.mesh){if(this.cacheCount<r.TESS_MAX_CACHE)return void this.cacheVertex_(n,e);this.emptyCache_()}this.addVertex_(n,e)},r.GluTesselator.prototype.gluTessBeginPolygon=function(t){this.requireState_(r.GluTesselator.tessState_.T_DORMANT),this.state=r.GluTesselator.tessState_.T_IN_POLYGON,this.cacheCount=0,this.emptyCache=!1,this.mesh=null,this.polygonData_=t},r.GluTesselator.prototype.gluTessBeginContour=function(){this.requireState_(r.GluTesselator.tessState_.T_IN_POLYGON),this.state=r.GluTesselator.tessState_.T_IN_CONTOUR,this.lastEdge_=null,this.cacheCount>0&&(this.emptyCache=!0)},r.GluTesselator.prototype.gluTessEndContour=function(){this.requireState_(r.GluTesselator.tessState_.T_IN_CONTOUR),this.state=r.GluTesselator.tessState_.T_IN_POLYGON},r.GluTesselator.prototype.gluTessEndPolygon=function(){if(this.requireState_(r.GluTesselator.tessState_.T_IN_POLYGON),this.state=r.GluTesselator.tessState_.T_DORMANT,null===this.mesh&&this.emptyCache_(),r.normal.projectPolygon(this),r.sweep.computeInterior(this),!this.fatalError){var t=this.mesh;if(this.boundaryOnly?r.tessmono.setWindingNumber(t,1,!0):r.tessmono.tessellateInterior(t),this.mesh.checkMesh(),this.callBegin_||this.callEnd_||this.callVertex_||this.callEdgeFlag_||this.callBeginData_||this.callEndData_||this.callVertexData_||this.callEdgeFlagData_)if(this.boundaryOnly)r.render.renderBoundary(this,this.mesh);else{var e=!(!this.callEdgeFlag_&&!this.callEdgeFlagData_);r.render.renderMesh(this,this.mesh,e)}if(this.callMesh_)return r.tessmono.discardExterior(this.mesh),this.callMesh_(this.mesh),this.mesh=null,void(this.polygonData_=null)}r.mesh.deleteMesh(this.mesh),this.polygonData_=null,this.mesh=null},r.GluTesselator.prototype.makeDormant_=function(){this.mesh&&r.mesh.deleteMesh(this.mesh),this.state=r.GluTesselator.tessState_.T_DORMANT,this.lastEdge_=null,this.mesh=null},r.GluTesselator.prototype.requireState_=function(t){this.state!==t&&this.gotoState_(t)},r.GluTesselator.prototype.gotoState_=function(t){for(;this.state!==t;)if(this.state<t)switch(this.state){case r.GluTesselator.tessState_.T_DORMANT:this.callErrorOrErrorData(r.errorType.GLU_TESS_MISSING_BEGIN_POLYGON),this.gluTessBeginPolygon(null);break;case r.GluTesselator.tessState_.T_IN_POLYGON:this.callErrorOrErrorData(r.errorType.GLU_TESS_MISSING_BEGIN_CONTOUR),this.gluTessBeginContour()}else switch(this.state){case r.GluTesselator.tessState_.T_IN_CONTOUR:this.callErrorOrErrorData(r.errorType.GLU_TESS_MISSING_END_CONTOUR),this.gluTessEndContour();break;case r.GluTesselator.tessState_.T_IN_POLYGON:this.callErrorOrErrorData(r.errorType.GLU_TESS_MISSING_END_POLYGON),this.makeDormant_()}},r.GluTesselator.prototype.addVertex_=function(t,e){var i=this.lastEdge_;null===i?(i=r.mesh.makeEdge(this.mesh),r.mesh.meshSplice(i,i.sym)):(r.mesh.splitEdge(i),i=i.lNext),i.org.data=e,i.org.coords[0]=t[0],i.org.coords[1]=t[1],i.org.coords[2]=t[2],i.winding=1,i.sym.winding=-1,this.lastEdge_=i},r.GluTesselator.prototype.cacheVertex_=function(t,e){var i=this.cache[this.cacheCount];i.data=e,i.coords[0]=t[0],i.coords[1]=t[1],i.coords[2]=t[2],++this.cacheCount},r.GluTesselator.prototype.emptyCache_=function(){this.mesh=new r.GluMesh;for(var t=0;t<this.cacheCount;t++){var e=this.cache[t];this.addVertex_(e.coords,e.data)}this.cacheCount=0,this.emptyCache=!1},r.GluTesselator.prototype.callBeginOrBeginData=function(t){this.callBeginData_?this.callBeginData_(t,this.polygonData_):this.callBegin_&&this.callBegin_(t)},r.GluTesselator.prototype.callVertexOrVertexData=function(t){this.callVertexData_?this.callVertexData_(t,this.polygonData_):this.callVertex_&&this.callVertex_(t)},r.GluTesselator.prototype.callEdgeFlagOrEdgeFlagData=function(t){this.callEdgeFlagData_?this.callEdgeFlagData_(t,this.polygonData_):this.callEdgeFlag_&&this.callEdgeFlag_(t)},r.GluTesselator.prototype.callEndOrEndData=function(){this.callEndData_?this.callEndData_(this.polygonData_):this.callEnd_&&this.callEnd_()},r.GluTesselator.prototype.callCombineOrCombineData=function(t,e,i){var r;return this.callCombineData_?r=this.callCombineData_(t,e,i,this.polygonData_):this.callCombine_&&(r=this.callCombine_(t,e,i)),void 0===r&&(r=null),r},r.GluTesselator.prototype.callErrorOrErrorData=function(t){this.callErrorData_?this.callErrorData_(t,this.polygonData_):this.callError_&&this.callError_(t)},r.GluFace=function(t,e){this.next=t||this,this.prev=e||this,this.anEdge=null,this.data=null,this.inside=!1},r.GluHalfEdge=function(t){this.next=t||this,this.sym=null,this.oNext=null,this.lNext=null,this.org=null,this.lFace=null,this.activeRegion=null,this.winding=0},r.GluHalfEdge.prototype.rFace=function(){return this.sym.lFace},r.GluHalfEdge.prototype.dst=function(){return this.sym.org},r.GluHalfEdge.prototype.oPrev=function(){return this.sym.lNext},r.GluHalfEdge.prototype.lPrev=function(){return this.oNext.sym},r.GluHalfEdge.prototype.dPrev=function(){return this.lNext.sym},r.GluHalfEdge.prototype.rPrev=function(){return this.sym.oNext},r.GluHalfEdge.prototype.dNext=function(){return this.rPrev().sym},r.GluHalfEdge.prototype.rNext=function(){return this.oPrev().sym},r.GluMesh=function(){this.vHead=new r.GluVertex,this.fHead=new r.GluFace,this.eHead=new r.GluHalfEdge,this.eHeadSym=new r.GluHalfEdge,this.eHead.sym=this.eHeadSym,this.eHeadSym.sym=this.eHead},r.GluMesh.prototype.checkMesh=function(){if(r.DEBUG){var t,e,i=this.fHead,n=this.vHead,o=this.eHead,s=i;for(s=i;(e=s.next)!==i;s=e){t=e.anEdge;do{t=t.lNext}while(t!==e.anEdge)}var a,l=n;for(l=n;(a=l.next)!==n;l=a){t=a.anEdge;do{t=t.oNext}while(t!==a.anEdge)}var h=o;for(h=o;(t=h.next)!==o;h=t);}},r.GluVertex=function(t,e){this.next=t||this,this.prev=e||this,this.anEdge=null,this.data=null,this.coords=[0,0,0],this.s=0,this.t=0,this.pqHandle=null},r.PQHandleElem=function(){this.key=null,this.node=0},r.PQHandleElem.realloc=function(t,e){var i=new Array(e),n=0;if(null!==t)for(;n<t.length;n++)i[n]=t[n];for(;n<e;n++)i[n]=new r.PQHandleElem;return i},r.PQNode=function(){this.handle=0},r.PQNode.realloc=function(t,e){var i=new Array(e),n=0;if(null!==t)for(;n<t.length;n++)i[n]=t[n];for(;n<e;n++)i[n]=new r.PQNode;return i},r.PriorityQ=function(t){this.keys_=r.PriorityQ.prototype.PQKeyRealloc_(null,r.PriorityQ.INIT_SIZE_),this.order_=null,this.size_=0,this.max_=r.PriorityQ.INIT_SIZE_,this.initialized_=!1,this.leq_=t,this.heap_=new r.PriorityQHeap(this.leq_)},r.PriorityQ.INIT_SIZE_=32,r.PriorityQ.prototype.deleteQ=function(){this.heap_.deleteHeap(),this.heap_=null,this.order_=null,this.keys_=null},r.PriorityQ.prototype.init=function(){this.order_=[];for(var t=0;t<this.size_;t++)this.order_[t]=t;var e=function(t,e){return function(i,r){return e(t[i],t[r])?1:-1}}(this.keys_,this.leq_);if(this.order_.sort(e),this.max_=this.size_,this.initialized_=!0,this.heap_.init(),r.DEBUG){var i=0+this.size_-1;for(t=0;t<i;++t);}},r.PriorityQ.prototype.insert=function(t){if(this.initialized_)return this.heap_.insert(t);var e=this.size_;return++this.size_>=this.max_&&(this.max_*=2,this.keys_=r.PriorityQ.prototype.PQKeyRealloc_(this.keys_,this.max_)),this.keys_[e]=t,-(e+1)},r.PriorityQ.prototype.PQKeyRealloc_=function(t,e){var i=new Array(e),r=0;if(null!==t)for(;r<t.length;r++)i[r]=t[r];for(;r<e;r++)i[r]=null;return i},r.PriorityQ.prototype.keyLessThan_=function(t,e){var i=this.keys_[t],r=this.keys_[e];return!this.leq_(r,i)},r.PriorityQ.prototype.keyGreaterThan_=function(t,e){var i=this.keys_[t],r=this.keys_[e];return!this.leq_(i,r)},r.PriorityQ.prototype.extractMin=function(){if(0===this.size_)return this.heap_.extractMin();var t=this.keys_[this.order_[this.size_-1]];if(!this.heap_.isEmpty()){var e=this.heap_.minimum();if(this.leq_(e,t))return this.heap_.extractMin()}do{--this.size_}while(this.size_>0&&null===this.keys_[this.order_[this.size_-1]]);return t},r.PriorityQ.prototype.minimum=function(){if(0===this.size_)return this.heap_.minimum();var t=this.keys_[this.order_[this.size_-1]];if(!this.heap_.isEmpty()){var e=this.heap_.minimum();if(this.leq_(e,t))return e}return t},r.PriorityQ.prototype.isEmpty_=function(){return 0===this.size_&&this.heap_.isEmpty()},r.PriorityQ.prototype.remove=function(t){if(t>=0)return void this.heap_.remove(t);for(t=-(t+1),this.keys_[t]=null;this.size_>0&&null===this.keys_[this.order_[this.size_-1]];)--this.size_},r.PriorityQHeap=function(t){this.nodes_=r.PQNode.realloc(null,r.PriorityQHeap.INIT_SIZE_+1),this.handles_=r.PQHandleElem.realloc(null,r.PriorityQHeap.INIT_SIZE_+1),this.size_=0,this.max_=r.PriorityQHeap.INIT_SIZE_,this.freeList_=0,this.initialized_=!1,this.leq_=t,this.nodes_[1].handle=1},r.PriorityQHeap.INIT_SIZE_=32,r.PriorityQHeap.prototype.deleteHeap=function(){this.handles_=null,this.nodes_=null},r.PriorityQHeap.prototype.init=function(){for(var t=this.size_;t>=1;--t)this.floatDown_(t);this.initialized_=!0},r.PriorityQHeap.prototype.insert=function(t){var e=++this.size_;2*e>this.max_&&(this.max_*=2,this.nodes_=r.PQNode.realloc(this.nodes_,this.max_+1),this.handles_=r.PQHandleElem.realloc(this.handles_,this.max_+1));var i;return 0===this.freeList_?i=e:(i=this.freeList_,this.freeList_=this.handles_[i].node),this.nodes_[e].handle=i,this.handles_[i].node=e,this.handles_[i].key=t,this.initialized_&&this.floatUp_(e),i},r.PriorityQHeap.prototype.isEmpty=function(){return 0===this.size_},r.PriorityQHeap.prototype.minimum=function(){return this.handles_[this.nodes_[1].handle].key},r.PriorityQHeap.prototype.extractMin=function(){var t=this.nodes_,e=this.handles_,i=t[1].handle,r=e[i].key;return this.size_>0&&(t[1].handle=t[this.size_].handle,e[t[1].handle].node=1,e[i].key=null,e[i].node=this.freeList_,this.freeList_=i,--this.size_>0&&this.floatDown_(1)),r},r.PriorityQHeap.prototype.remove=function(t){var e=this.nodes_,i=this.handles_,r=i[t].node;e[r].handle=e[this.size_].handle,i[e[r].handle].node=r,r<=--this.size_&&(r<=1||this.leq_(i[e[r>>1].handle].key,i[e[r].handle].key)?this.floatDown_(r):this.floatUp_(r)),i[t].key=null,i[t].node=this.freeList_,this.freeList_=t},r.PriorityQHeap.prototype.floatDown_=function(t){for(var e=this.nodes_,i=this.handles_,r=e[t].handle;;){var n=t<<1;n<this.size_&&this.leq_(i[e[n+1].handle].key,i[e[n].handle].key)&&++n;var o=e[n].handle;if(n>this.size_||this.leq_(i[r].key,i[o].key)){e[t].handle=r,i[r].node=t;break}e[t].handle=o,i[o].node=t,t=n}},r.PriorityQHeap.prototype.floatUp_=function(t){for(var e=this.nodes_,i=this.handles_,r=e[t].handle;;){var n=t>>1,o=e[n].handle;if(0===n||this.leq_(i[o].key,i[r].key)){e[t].handle=r,i[r].node=t;break}e[t].handle=o,i[o].node=t,t=n}},r.ActiveRegion=function(){this.eUp=null,this.nodeUp=null,this.windingNumber=0,this.inside=!1,this.sentinel=!1,this.dirty=!1,this.fixUpperEdge=!1},r.ActiveRegion.prototype.regionBelow=function(){return this.nodeUp.getPredecessor().getKey()},r.ActiveRegion.prototype.regionAbove=function(){return this.nodeUp.getSuccessor().getKey()},"undefined"!=typeof module&&(module.exports=r),i("util/libtess",function(){}),i("util/measure/AreaMeasurer",["../../geom/Angle","../../error/ArgumentError","../../geom/Location","../Logger","./MeasurerUtils","../../geom/Sector","../../geom/Vec3","../libtess"],function(t,e,i,n,o,s,a,l){"use strict";var h=function(t){if(!t)throw new e(n.logMessage(n.LEVEL_SEVERE,"AreaMeasurer","constructor","missingWorldWindow"));this.wwd=t,this.DEFAULT_AREA_SAMPLING_STEPS=32,this._areaTerrainSamplingSteps=this.DEFAULT_AREA_SAMPLING_STEPS,this._maxSegmentLength=1e5,this.subdividedPositions=null,this.vecZ=new a(0,0,1),this.scratchLocation=new i(0,0)};return Object.defineProperties(h.prototype,{areaTerrainSamplingSteps:{get:function(){return this._areaTerrainSamplingSteps},set:function(t){this._areaTerrainSamplingSteps=t}},maxSegmentLength:{get:function(){return this._maxSegmentLength},set:function(t){this._maxSegmentLength=t}}}),h.prototype.getArea=function(t,e,i){var r=this.wwd.globe;return e?this.computeSurfaceAreaSampling(r,t,i):this.computeProjectedAreaGeometry(r,t,i)},h.prototype.computeSurfaceAreaSampling=function(e,i,r){var n=new s(0,0,0,0);n.setToBoundingSector(i),
this.subdividedPositions=o.subdividePositions(e,i,!0,r,this._maxSegmentLength);for(var l=Math.max(this.DEFAULT_AREA_SAMPLING_STEPS,this._areaTerrainSamplingSteps),h=n.deltaLatitude()*t.DEGREES_TO_RADIANS,u=n.deltaLongitude()*t.DEGREES_TO_RADIANS,c=Math.max(h/l,u/l),d=Math.round(h/c),p=Math.round(u/c*Math.cos(n.centroidLatitude()*t.DEGREES_TO_RADIANS)),f=h/d,g=u/p,m=0,E=0;E<d;E++)for(var y=n.minLatitude*t.DEGREES_TO_RADIANS+f*E,_=e.radiusAt((y+f/2)*t.RADIANS_TO_DEGREES,n.centroidLongitude()),v=g*_*Math.cos(y+f/2),S=f*_,b=v*S,T=0;T<p;T++){var L=n.minLongitude*t.DEGREES_TO_RADIANS+g*T,w=y*t.RADIANS_TO_DEGREES,R=(y+f)*t.RADIANS_TO_DEGREES,x=L*t.RADIANS_TO_DEGREES,M=(L+g)*t.RADIANS_TO_DEGREES,C=new s(w,R,x,M),A=o.isLocationInside(C.centroid(this.scratchLocation),this.subdividedPositions);if(A){var P=e.elevationAtLocation(w,x),I=e.elevationAtLocation(w,M),O=e.elevationAtLocation(R,x),N=new a(v,0,I-P),D=new a(0,S,O-P);N.normalize(),D.normalize();var k=N.cross(D).normalize(),V=Math.tan(o.angleBetweenVectors(this.vecZ,k)),F=Math.sqrt(1+V*V);m+=b*F}}return m},h.prototype.computeProjectedAreaGeometry=function(e,i,r){this.subdividedPositions=o.subdividePositions(e,i,!1,r,this._maxSegmentLength);var n=this.subdividedPositions.length,s=this.subdividedPositions[0],a=this.subdividedPositions[n-1];s.equals(a)&&n--;for(var l=[],h=0,u=0;u<n;u++){var c=this.subdividedPositions[u];l[h++]=c.longitude*t.DEGREES_TO_RADIANS,l[h++]=c.latitude*t.DEGREES_TO_RADIANS,l[h++]=0}var d=this.tessellatePolygon(n,l),p=0,f=d.length/9;for(u=0;u<f;u++){h=9*u;var g=[d[h+0],d[h+1],d[h+2],d[h+3],d[h+4],d[h+5],d[h+6],d[h+7],d[h+8]];p+=this.computeTriangleProjectedArea(e,g)}return p},h.prototype.computeTriangleProjectedArea=function(e,i){var r=i[0],n=i[1],o=i[3],s=i[4],a=i[6],l=i[7],h=Math.abs(r*(s-l)+o*(l-n)+a*(n-s));h/=2;var u=(r+o+a)/3,c=(n+s+l)/3,d=e.radiusAt(c*t.RADIANS_TO_DEGREES,u*t.RADIANS_TO_DEGREES);return h*=Math.cos(c)*d*d},h.prototype.tessellatePolygon=function(t,e){var i,o=new r.GluTesselator,s=[];o.gluTessCallback(r.gluEnum.GLU_TESS_BEGIN,function(t){t!==r.primitiveType.GL_TRIANGLES&&n.logMessage(n.LEVEL_WARNING,"AreaMeasurer","tessellatePolygon","Tessellation error, primitive is not TRIANGLES.")}),o.gluTessCallback(r.gluEnum.GLU_TESS_VERTEX_DATA,function(t,e){e.push(t[0]),e.push(t[1]),e.push(t[2])}),o.gluTessCallback(r.gluEnum.GLU_TESS_EDGE_FLAG,function(){}),o.gluTessCallback(r.gluEnum.GLU_TESS_ERROR,function(t){n.logMessage(n.LEVEL_WARNING,"AreaMeasurer","tessellatePolygon","Tessellation error "+t+".")}),o.gluTessBeginPolygon(s),o.gluTessBeginContour();for(var a=0;a<t;a++)i=e.slice(3*a,3*a+3),o.gluTessVertex(i,i);return o.gluTessEndContour(),o.gluTessEndPolygon(),s},h}),i("shaders/AtmosphereProgram",["../error/ArgumentError","../shaders/GpuProgram","../util/Logger"],function(t,e,i){"use strict";var r=function(t,i,r,n){e.call(this,t,i,r,n),this.FRAGMODE_SKY=1,this.FRAGMODE_GROUND_PRIMARY=2,this.FRAGMODE_GROUND_SECONDARY=3,this.FRAGMODE_GROUND_PRIMARY_TEX_BLEND=4,this.altitude=16e4,this.rayleighScaleDepth=.25,this.fragModeLocation=this.uniformLocation(t,"fragMode"),this.mvpMatrixLocation=this.uniformLocation(t,"mvpMatrix"),this.texCoordMatrixLocation=this.uniformLocation(t,"texCoordMatrix"),this.vertexOriginLocation=this.uniformLocation(t,"vertexOrigin"),this.eyePointLocation=this.uniformLocation(t,"eyePoint"),this.eyeMagnitudeLocation=this.uniformLocation(t,"eyeMagnitude"),this.eyeMagnitude2Location=this.uniformLocation(t,"eyeMagnitude2"),this.lightDirectionLocation=this.uniformLocation(t,"lightDirection"),this.atmosphereRadiusLocation=this.uniformLocation(t,"atmosphereRadius"),this.atmosphereRadius2Location=this.uniformLocation(t,"atmosphereRadius2"),this.globeRadiusLocation=this.uniformLocation(t,"globeRadius"),this.scaleLocation=this.uniformLocation(t,"scale"),this.scaleDepthLocation=this.uniformLocation(t,"scaleDepth"),this.scaleOverScaleDepthLocation=this.uniformLocation(t,"scaleOverScaleDepth"),this.scratchArray9=new Float32Array(9)};return r.key="WorldWindGpuAtmosphereProgram",r.prototype=Object.create(e.prototype),r.prototype.getAltitude=function(){return this.altitude},r.prototype.loadFragMode=function(e,r){if(!r)throw new t(i.logMessage(i.LEVEL_SEVERE,"AtmosphereProgram","loadFragMode","missingFragMode"));e.uniform1i(this.fragModeLocation,r)},r.prototype.loadModelviewProjection=function(e,r){if(!r)throw new t(i.logMessage(i.LEVEL_SEVERE,"AtmosphereProgram","loadModelviewProjection","missingMatrix"));this.loadUniformMatrix(e,r,this.mvpMatrixLocation)},r.prototype.loadVertexOrigin=function(e,r){if(!r)throw new t(i.logMessage(i.LEVEL_SEVERE,"AtmosphereProgram","loadVertexOrigin","missingVector"));e.uniform3f(this.vertexOriginLocation,r[0],r[1],r[2])},r.prototype.loadLightDirection=function(e,r){if(!r)throw new t(i.logMessage(i.LEVEL_SEVERE,"AtmosphereProgram","loadLightDirection","missingVector"));e.uniform3f(this.lightDirectionLocation,r[0],r[1],r[2])},r.prototype.loadEyePoint=function(e,r){if(!r)throw new t(i.logMessage(i.LEVEL_SEVERE,"AtmosphereProgram","loadEyePoint","missingVector"));e.uniform3f(this.eyePointLocation,r[0],r[1],r[2]),e.uniform1f(this.eyeMagnitudeLocation,r.magnitude()),e.uniform1f(this.eyeMagnitude2Location,r.magnitudeSquared())},r.prototype.loadGlobeRadius=function(e,r){if(!r)throw new t(i.logMessage(i.LEVEL_SEVERE,"AtmosphereProgram","loadGlobeRadius","missingGlobeRadius"));var n=r,o=n+this.altitude;e.uniform1f(this.globeRadiusLocation,n),e.uniform1f(this.atmosphereRadiusLocation,o),e.uniform1f(this.atmosphereRadius2Location,o*o)},r.prototype.setScale=function(t){t.uniform1f(this.scaleLocation,1/this.getAltitude()),t.uniform1f(this.scaleDepthLocation,this.rayleighScaleDepth),t.uniform1f(this.scaleOverScaleDepthLocation,1/this.getAltitude()/this.rayleighScaleDepth)},r.prototype.loadTexMatrix=function(e,r){if(!r)throw new t(i.logMessage(i.LEVEL_SEVERE,"AtmosphereProgram","loadTexMatrix","missingMatrix"));r.columnMajorComponents(this.scratchArray9),e.uniformMatrix3fv(this.texCoordMatrixLocation,!1,this.scratchArray9)},r}),i("shaders/GroundProgram",["../shaders/AtmosphereProgram"],function(t){"use strict";var e=function(e){t.call(this,e,"precision mediump int;\nconst int FRAGMODE_GROUND_PRIMARY_TEX_BLEND = 4;\nconst int SAMPLE_COUNT = 2;\nconst float SAMPLES = 2.0;\nconst float PI = 3.141592653589;\nconst float Kr = 0.0025;\nconst float Kr4PI = Kr * 4.0 * PI;\nconst float Km = 0.0015;\nconst float Km4PI = Km * 4.0 * PI;\nconst float ESun = 15.0;\nconst float KmESun = Km * ESun;\nconst float KrESun = Kr * ESun;\nconst vec3 invWavelength = vec3(5.60204474633241, 9.473284437923038, 19.643802610477206);\nconst float rayleighScaleDepth = 0.25;\nuniform int fragMode;\nuniform mat4 mvpMatrix;\nuniform mat3 texCoordMatrix;\nuniform vec3 vertexOrigin;\nuniform vec3 eyePoint;\nuniform float eyeMagnitude;\nuniform float eyeMagnitude2;\nuniform vec3 lightDirection;\nuniform float atmosphereRadius;\nuniform float atmosphereRadius2;\nuniform float globeRadius;\nuniform float scale;\nuniform float scaleDepth;\nuniform float scaleOverScaleDepth;\nattribute vec4 vertexPoint;\nattribute vec2 vertexTexCoord;\nvarying vec3 primaryColor;\nvarying vec3 secondaryColor;\nvarying vec2 texCoord;\nfloat scaleFunc(float cos) {\n    float x = 1.0 - cos;\n    return scaleDepth * exp(-0.00287 + x*(0.459 + x*(3.83 + x*(-6.80 + x*5.25))));\n}\nvoid sampleGround() {\n    vec3 point = vertexPoint.xyz + vertexOrigin;\n    vec3 ray = point - eyePoint;\n    float far = length(ray);\n    ray /= far;\n    vec3 start;\n    if (eyeMagnitude < atmosphereRadius) {\n        start = eyePoint;\n    } else {\n        float B = 2.0 * dot(eyePoint, ray);\n        float C = eyeMagnitude2 - atmosphereRadius2;\n        float det = max(0.0, B*B - 4.0 * C);\n        float near = 0.5 * (-B - sqrt(det));\n        start = eyePoint + ray * near;\n        far -= near;\n}\n    float depth = exp((globeRadius - atmosphereRadius) / scaleDepth);\n    float eyeAngle = dot(-ray, point) / length(point);\n    float lightAngle = dot(lightDirection, point) / length(point);\n    float eyeScale = scaleFunc(eyeAngle);\n    float lightScale = scaleFunc(lightAngle);\n    float eyeOffset = depth*eyeScale;\n    float temp = (lightScale + eyeScale);\n    float sampleLength = far / SAMPLES;\n    float scaledLength = sampleLength * scale;\n    vec3 sampleRay = ray * sampleLength;\n    vec3 samplePoint = start + sampleRay * 0.5;\n    vec3 frontColor = vec3(0.0, 0.0, 0.0);\n    vec3 attenuate = vec3(0.0, 0.0, 0.0);\n    for(int i=0; i<SAMPLE_COUNT; i++)\n    {\n        float height = length(samplePoint);\n        float depth = exp(scaleOverScaleDepth * (globeRadius - height));\n        float scatter = depth*temp - eyeOffset;\n        attenuate = exp(-scatter * (invWavelength * Kr4PI + Km4PI));\n        frontColor += attenuate * (depth * scaledLength);\n        samplePoint += sampleRay;\n    }\n    primaryColor = frontColor * (invWavelength * KrESun + KmESun);\n    secondaryColor = attenuate;\n}\nvoid main()\n {\n    sampleGround();\n    gl_Position = mvpMatrix * vertexPoint;\n    if (fragMode == FRAGMODE_GROUND_PRIMARY_TEX_BLEND) {\n        texCoord = (texCoordMatrix * vec3(vertexTexCoord, 1.0)).st;\n    }\n}","precision mediump float;\nprecision mediump int;\nconst int FRAGMODE_GROUND_PRIMARY = 2;\nconst int FRAGMODE_GROUND_SECONDARY = 3;\nconst int FRAGMODE_GROUND_PRIMARY_TEX_BLEND = 4;\nuniform int fragMode;\nuniform sampler2D texSampler;\nvarying vec3 primaryColor;\nvarying vec3 secondaryColor;\nvarying vec2 texCoord;\nvoid main (void)\n{\n    if (fragMode == FRAGMODE_GROUND_PRIMARY) {\n        gl_FragColor = vec4(primaryColor, 1.0);\n    } else if (fragMode == FRAGMODE_GROUND_SECONDARY) {\n        gl_FragColor = vec4(secondaryColor, 1.0);\n    } else if (fragMode == FRAGMODE_GROUND_PRIMARY_TEX_BLEND) {\n        vec4 texColor = texture2D(texSampler, texCoord);\n        gl_FragColor = vec4(primaryColor + texColor.rgb * (1.0 - secondaryColor), 1.0);\n    }\n}",["vertexPoint","vertexTexCoord"])};return e.key="WorldWindGroundProgram",e.prototype=Object.create(t.prototype),e}),i("layer/Layer",["../util/Logger"],function(t){"use strict";var e=function(t){this.displayName=t||"Layer",this.enabled=!0,this.pickEnabled=!0,this.opacity=1,this.minActiveAltitude=-Number.MAX_VALUE,this.maxActiveAltitude=Number.MAX_VALUE,this.inCurrentFrame=!1,this.time=null};return e.prototype.refresh=function(){},e.prototype.render=function(t){this.inCurrentFrame=!1,this.enabled&&(t.pickingMode&&!this.pickEnabled||this.withinActiveAltitudes(t)&&this.isLayerInView(t)&&this.doRender(t))},e.prototype.doRender=function(t){},e.prototype.withinActiveAltitudes=function(t){var e=t.eyePosition;return!!e&&(e.altitude>=this.minActiveAltitude&&e.altitude<=this.maxActiveAltitude)},e.prototype.isLayerInView=function(t){return!0},e}),i("geom/Matrix3",["../error/ArgumentError","../util/Logger"],function(t,e){"use strict";var i=function(t,e,i,r,n,o,s,a,l){this[0]=t,this[1]=e,this[2]=i,this[3]=r,this[4]=n,this[5]=o,this[6]=s,this[7]=a,this[8]=l};return i.prototype=new Float64Array(9),i.fromIdentity=function(){return new i(1,0,0,0,1,0,0,0,1)},i.prototype.setToUnitYFlip=function(){return this[0]=1,this[1]=0,this[2]=0,this[3]=0,this[4]=-1,this[5]=1,this[6]=0,this[7]=0,this[8]=1,this},i.prototype.multiplyMatrix=function(i){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"Matrix3","multiplyMatrix","missingMatrix"));var r,n,o,s=this,a=i;return r=s[0],n=s[1],o=s[2],s[0]=r*a[0]+n*a[3]+o*a[6],s[1]=r*a[1]+n*a[4]+o*a[7],s[2]=r*a[2]+n*a[5]+o*a[8],r=s[3],n=s[4],o=s[5],s[3]=r*a[0]+n*a[3]+o*a[6],s[4]=r*a[1]+n*a[4]+o*a[7],s[5]=r*a[2]+n*a[5]+o*a[8],r=s[6],n=s[7],o=s[8],s[6]=r*a[0]+n*a[3]+o*a[6],s[7]=r*a[1]+n*a[4]+o*a[7],s[8]=r*a[2]+n*a[5]+o*a[8],this},i.prototype.multiplyByTileTransform=function(t,e){var i=t.deltaLatitude(),r=t.deltaLongitude(),n=e.deltaLatitude(),o=e.deltaLongitude(),s=r/o,a=i/n,l=(t.minLongitude-e.minLongitude)/o,h=(t.minLatitude-e.minLatitude)/n,u=this;return u[2]+=u[0]*l+u[1]*h,u[5]+=u[3]*l+u[4]*h,u[8]+=u[6]*l+u[6]*h,u[0]*=s,u[1]*=a,u[3]*=s,u[4]*=a,u[6]*=s,u[7]*=a,this},i.prototype.columnMajorComponents=function(i){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"Matrix3","columnMajorComponents","missingResult"));return i[0]=this[0],i[1]=this[3],i[2]=this[6],i[3]=this[1],i[4]=this[4],i[5]=this[7],i[6]=this[2],i[7]=this[5],i[8]=this[8],i},i}),i("shaders/SkyProgram",["../shaders/AtmosphereProgram"],function(t){"use strict";var e=function(e){t.call(this,e,"precision mediump int;\nconst int SAMPLE_COUNT = 2;\nconst float SAMPLES = 2.0;\nconst float PI = 3.141592653589;\nconst float Kr = 0.0025;\nconst float Kr4PI = Kr * 4.0 * PI;\nconst float Km = 0.0015;\nconst float Km4PI = Km * 4.0 * PI;\nconst float ESun = 15.0;\nconst float KmESun = Km * ESun;\nconst float KrESun = Kr * ESun;\nconst vec3 invWavelength = vec3(5.60204474633241, 9.473284437923038, 19.643802610477206);\nconst float rayleighScaleDepth = 0.25;\nuniform mat4 mvpMatrix;\nuniform vec3 vertexOrigin;\nuniform vec3 eyePoint;\nuniform float eyeMagnitude;\nuniform float eyeMagnitude2;\nuniform mediump vec3 lightDirection;\nuniform float atmosphereRadius;\nuniform float atmosphereRadius2;\nuniform float globeRadius;\nuniform float scale;\nuniform float scaleDepth;\nuniform float scaleOverScaleDepth;\nattribute vec4 vertexPoint;\nvarying vec3 primaryColor;\nvarying vec3 secondaryColor;\nvarying vec3 direction;\nfloat scaleFunc(float cos)\n{\n    float x = 1.0 - cos;\n    return scaleDepth * exp(-0.00287 + x*(0.459 + x*(3.83 + x*(-6.80 + x*5.25))));\n}\nvoid sampleSky() {\n    vec3 point = vertexPoint.xyz + vertexOrigin;\n    vec3 ray = point - eyePoint;\n    float far = length(ray);\n    ray /= far;\n    vec3 start;\n    float startOffset;\n    if (eyeMagnitude < atmosphereRadius) {\n        start = eyePoint;\n        float height = length(start);\n        float depth = exp(scaleOverScaleDepth * (globeRadius - eyeMagnitude));\n        float startAngle = dot(ray, start) / height;\n        startOffset = depth*scaleFunc(startAngle);\n    } else {\n        float B = 2.0 * dot(eyePoint, ray);\n        float C = eyeMagnitude2 - atmosphereRadius2;\n        float det = max(0.0, B*B - 4.0 * C);\n        float near = 0.5 * (-B - sqrt(det));\n        start = eyePoint + ray * near;\n        far -= near;\n        float startAngle = dot(ray, start) / atmosphereRadius;\n        float startDepth = exp(-1.0 / scaleDepth);\n        startOffset = startDepth*scaleFunc(startAngle);\n    }\n    float sampleLength = far / SAMPLES;\n    float scaledLength = sampleLength * scale;\n    vec3 sampleRay = ray * sampleLength;\n    vec3 samplePoint = start + sampleRay * 0.5;\n    vec3 frontColor = vec3(0.0, 0.0, 0.0);\n    for(int i=0; i<SAMPLE_COUNT; i++)\n    {\n       float height = length(samplePoint);\n       float depth = exp(scaleOverScaleDepth * (globeRadius - height));\n       float lightAngle = dot(lightDirection, samplePoint) / height;\n       float cameraAngle = dot(ray, samplePoint) / height;\n       float scatter = (startOffset + depth*(scaleFunc(lightAngle) - scaleFunc(cameraAngle)));\n       vec3 attenuate = exp(-scatter * (invWavelength * Kr4PI + Km4PI));\n       frontColor += attenuate * (depth * scaledLength);\n       samplePoint += sampleRay;\n    }\n    primaryColor = frontColor * (invWavelength * KrESun);\n    secondaryColor = frontColor * KmESun;\n    direction = eyePoint - point;\n}\nvoid main()\n{\n    sampleSky();\n    gl_Position = mvpMatrix * vertexPoint;\n}","#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nconst float g = -0.95;\nconst float g2 = g * g;\nuniform mediump vec3 lightDirection;\nvarying vec3 primaryColor;\nvarying vec3 secondaryColor;\nvarying vec3 direction;\nvoid main (void)\n{\n    float cos = dot(lightDirection, direction) / length(direction);\n    float rayleighPhase = 0.75 * (1.0 + cos * cos);\n    float miePhase = 1.5 * ((1.0 - g2) / (2.0 + g2)) * (1.0 + cos*cos) /         pow(1.0 + g2 - 2.0*g*cos, 1.5);\n    const float exposure = 2.0;\n    vec3 color = primaryColor * rayleighPhase + secondaryColor * miePhase;\n    color = vec3(1.0) - exp(-exposure * color);\n    gl_FragColor = vec4(color, color.b);\n}",["vertexPoint"])};return e.key="WorldWindSkyProgram",e.prototype=Object.create(t.prototype),e}),i("util/SunPosition",["../geom/Angle","../error/ArgumentError","./Logger","./WWMath"],function(t,e,i,r){"use strict";return{getAsGeographicLocation:function(t){if(t instanceof Date==!1)throw new e(i.logMessage(i.LEVEL_SEVERE,"SunPosition","getAsGeographicLocation","missingDate"));var r=this.getAsCelestialLocation(t);return this.celestialToGeographic(r,t)},getAsCelestialLocation:function(n){if(n instanceof Date==!1)throw new e(i.logMessage(i.LEVEL_SEVERE,"SunPosition","getAsCelestialLocation","missingDate"));var o=this.computeJulianDate(n),s=o-2451545,a=r.normalizeAngle360(280.46+.9856474*s),l=r.normalizeAngle360(357.528+.9856003*s)*t.DEGREES_TO_RADIANS,h=a+1.915*Math.sin(l)+.02*Math.sin(2*l),u=h*t.DEGREES_TO_RADIANS,c=(23.439-4e-7*s)*t.DEGREES_TO_RADIANS,d=Math.asin(Math.sin(c)*Math.sin(u))*t.RADIANS_TO_DEGREES,p=Math.atan(Math.cos(c)*Math.tan(u))*t.RADIANS_TO_DEGREES;return h>=90&&h<270&&(p+=180),p=r.normalizeAngle360(p),{declination:d,rightAscension:p}},celestialToGeographic:function(n,o){if(!n)throw new e(i.logMessage(i.LEVEL_SEVERE,"SunPosition","celestialToGeographic","missingCelestialLocation"));if(o instanceof Date==!1)throw new e(i.logMessage(i.LEVEL_SEVERE,"SunPosition","celestialToGeographic","missingDate"));var s=this.computeJulianDate(o),a=s-2451545,l=r.normalizeAngle360(280.46061837+360.98564736629*a),h=r.normalizeAngle360(l-n.rightAscension),u=t.normalizedDegreesLongitude(-h);return{latitude:n.declination,longitude:u}},computeJulianDate:function(t){if(t instanceof Date==!1)throw new e(i.logMessage(i.LEVEL_SEVERE,"SunPosition","computeJulianDate","missingDate"));var r=t.getUTCFullYear(),n=t.getUTCMonth()+1,o=t.getUTCDate(),s=t.getUTCHours(),a=t.getUTCMinutes(),l=t.getUTCSeconds(),h=(s+a/60+l/3600)/24;n<=2&&(r-=1,n+=12);var u=Math.floor(r/100),c=2-u+Math.floor(u/4);return Math.floor(365.25*(r+4716))+Math.floor(30.6001*(n+1))+o+c-1524.5+h}}}),i("util/WWUtil",["../error/ArgumentError","../geom/Line","../util/Logger","../geom/Rectangle","../geom/Vec3"],function(t,e,i,r,n){"use strict";var o={latLonRegex:/^(\-?\d+(\.\d+)?),\s*(\-?\d+(\.\d+)?)$/,suffixForMimeType:function(t){return"image/png"===t?"png":"image/jpeg"===t?"jpg":"application/bil16"===t?"bil":"application/bil32"===t?"bil":null},currentUrlSansFilePart:function(){for(var t=window.location.protocol,e=window.location.host,i=window.location.pathname,r=i.split("/"),n="",o=0,s=r.length;o<s-1;o++)r[o].length>0&&(n=n+"/"+r[o]);return t+"//"+e+n},worldwindlibLocation:function(){for(var t=document.getElementsByTagName("script"),e=0;e<t.length;e++){var i=t[e].src.indexOf("/worldwind.");if(i>=0)return t[e].src.substring(0,i)+"/"}return null},urlPath:function(t){if(!t)return"";for(var e=t.split("/"),i="",r=0,n=e.length;r<n;r++){var o=e[r];o&&0!==o.length&&-1==o.indexOf(":")&&"."!==o&&".."!==o&&"null"!==o&&"undefined"!==o&&(0!==i.length&&(i+="/"),i+=o)}return i},fillArray:function(t,e){if(t)for(var i=0,r=t.length;i<r;i++)t[i]=e},multiplyArray:function(t,e){if(t)for(var i=0,r=t.length;i<r;i++)t[i]*=e},jsonpCounter:0,jsonp:function(t,e,i){var r="gov_nasa_worldwind_jsonp_"+o.jsonpCounter++;window[r]=function(t){delete window[r],i(t)};var n=t+(-1===t.indexOf("?")?"?":"&");n+=e+"="+r;var s=document.createElement("script");s.async=!0,s.src=n;var a=document.getElementsByTagName("head")[0],l=function(){s.onload=void 0,s.onerror=void 0,a.removeChild(s)};s.onload=l,s.onerror=l,a.appendChild(s)},arrayEquals:function(t,e){return t.length==e.length&&t.every(function(t,i){return t===e[i]||t.equals&&t.equals(e[i])})},transformToBoolean:function(t){return 0!=t&&"0"!=t&&"false"!=t&&Boolean(t)},clone:function(t){var e,i={},r=Object.keys(t);for(e=0;e<r.length;e++)i[r[e]]=t[r[e]];return i},guid:function(){function t(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return t()+t()+"-"+t()+"-"+t()+"-"+t()+"-"+t()+t()+t()},date:function(t){return new Date(t)},startsWith:function(t,e,i){return i=i||0,t.substr(i,e.length)===e},endsWith:function(t,e,i){("number"!=typeof i||!isFinite(i)||Math.floor(i)!==i||i>t.length)&&(i=t.length),i-=e.length;var r=t.lastIndexOf(e,i);return-1!==r&&r===i}};return o}),i("layer/AtmosphereLayer",["../error/ArgumentError","../shaders/GroundProgram","../layer/Layer","../util/Logger","../geom/Matrix","../geom/Matrix3","../geom/Sector","../shaders/SkyProgram","../util/SunPosition","../geom/Vec3","../util/WWUtil"],function(t,e,i,r,n,o,s,a,l,h,u){"use strict";var c=function(t){i.call(this,"Atmosphere"),this.pickEnabled=!1,this._nightImageSource=t||WorldWind.configuration.baseUrl+"images/dnb_land_ocean_ice_2012.png",this._activeLightDirection=new h(0,0,0),this._fullSphereSector=s.FULL_SPHERE,this._skyData={},this._skyWidth=128,this._skyHeight=128,this._numIndices=0,this._texMatrix=o.fromIdentity(),this._activeTexture=null};return c.prototype=Object.create(i.prototype),Object.defineProperties(c.prototype,{nightImageSource:{get:function(){return this._nightImageSource},set:function(t){this._nightImageSource=t}}}),c.prototype.doRender=function(t){t.globe.is2D()||(this.determineLightDirection(t),this.drawSky(t),this.drawGround(t))},c.prototype.applySkyVertices=function(t){var e,i,r=t.currentGlContext,n=t.currentProgram,o=this._skyData;o.verticesVboCacheKey||(o.verticesVboCacheKey=t.gpuResourceCache.generateCacheKey()),i=t.gpuResourceCache.resourceForKey(o.verticesVboCacheKey),i?(r.bindBuffer(r.ARRAY_BUFFER,i),r.vertexAttribPointer(0,3,r.FLOAT,!1,0,0)):(e=this.assembleVertexPoints(t,this._skyHeight,this._skyWidth,n.getAltitude()),i=r.createBuffer(),r.bindBuffer(r.ARRAY_BUFFER,i),r.bufferData(r.ARRAY_BUFFER,e,r.STATIC_DRAW),r.vertexAttribPointer(0,3,r.FLOAT,!1,0,0),t.gpuResourceCache.putResource(o.verticesVboCacheKey,i,4*e.length),t.frameStatistics.incrementVboLoadCount(1))},c.prototype.applySkyIndices=function(t){var e,i,r=t.currentGlContext,n=this._skyData;n.indicesVboCacheKey||(n.indicesVboCacheKey=t.gpuResourceCache.generateCacheKey()),i=t.gpuResourceCache.resourceForKey(n.indicesVboCacheKey),i?r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,i):(e=this.assembleTriStripIndices(this._skyWidth,this._skyHeight),i=r.createBuffer(),r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,i),r.bufferData(r.ELEMENT_ARRAY_BUFFER,e,r.STATIC_DRAW),t.frameStatistics.incrementVboLoadCount(1),t.gpuResourceCache.putResource(n.indicesVboCacheKey,i,2*e.length))},c.prototype.drawSky=function(t){var e=t.currentGlContext,i=t.findAndBindProgram(a);i.loadGlobeRadius(e,t.globe.equatorialRadius),i.loadEyePoint(e,t.navigatorState.eyePoint),i.loadVertexOrigin(e,h.ZERO),i.loadModelviewProjection(e,t.navigatorState.modelviewProjection),i.loadLightDirection(e,this._activeLightDirection),i.setScale(e),this.applySkyVertices(t),this.applySkyIndices(t),e.depthMask(!1),e.frontFace(e.CW),e.enableVertexAttribArray(0),e.drawElements(e.TRIANGLE_STRIP,this._numIndices,e.UNSIGNED_SHORT,0),e.depthMask(!0),e.frontFace(e.CCW),e.disableVertexAttribArray(0)},c.prototype.drawGround=function(t){var i,r=t.currentGlContext,n=t.findAndBindProgram(e),o=t.terrain;n.loadGlobeRadius(r,t.globe.equatorialRadius),n.loadEyePoint(r,t.navigatorState.eyePoint),n.loadLightDirection(r,this._activeLightDirection),n.setScale(r),this.nightImageSource&&null!==this.time&&(this._activeTexture=t.gpuResourceCache.resourceForKey(this.nightImageSource),this._activeTexture||(this._activeTexture=t.gpuResourceCache.retrieveTexture(r,this.nightImageSource)),i=this._activeTexture&&this._activeTexture.bind(t)),o.beginRendering(t);for(var s=0,a=o.surfaceGeometry.length;s<a;s++){var l=o.surfaceGeometry[s],h=l.referencePoint;n.loadVertexOrigin(r,h),i&&(this._texMatrix.setToUnitYFlip(),this._texMatrix.multiplyByTileTransform(l.sector,this._fullSphereSector),n.loadTexMatrix(r,this._texMatrix)),o.beginRenderingTile(t,l),n.loadFragMode(r,n.FRAGMODE_GROUND_SECONDARY),r.blendFunc(r.DST_COLOR,r.ZERO),o.renderTile(t,l);var u=i?n.FRAGMODE_GROUND_PRIMARY_TEX_BLEND:n.FRAGMODE_GROUND_PRIMARY;n.loadFragMode(r,u),r.blendFunc(r.ONE,r.ONE),o.renderTile(t,l),o.endRenderingTile(t,l)}o.endRendering(t),r.blendFunc(r.ONE,r.ONE_MINUS_SRC_ALPHA),this._activeTexture=null},c.prototype.assembleVertexPoints=function(t,e,i,r){var n=e*i,o=new Array(n);u.fillArray(o,r);var s=new Float32Array(3*n);return t.globe.computePointsForGrid(this._fullSphereSector,e,i,o,h.ZERO,s)},c.prototype.assembleTriStripIndices=function(t,e){for(var i=[],r=0,n=0;n<t-1;n++){for(var o=0;o<e;o++)r=o+n*e,i.push(r+e),i.push(r);n<t-2&&(i.push(r),i.push((n+2)*e))}return this._numIndices=i.length,new Uint16Array(i)},c.prototype.determineLightDirection=function(t){if(null!==this.time){var e=l.getAsGeographicLocation(this.time);t.globe.computePointFromLocation(e.latitude,e.longitude,this._activeLightDirection)}else this._activeLightDirection.copy(t.navigatorState.eyePoint);this._activeLightDirection.normalize()},c}),i("shaders/BasicProgram",["../error/ArgumentError","../util/Color","../shaders/GpuProgram","../util/Logger"],function(t,e,i,r){"use strict";var n=function(t){i.call(this,t,"attribute vec4 vertexPoint;\nuniform mat4 mvpMatrix;\nvoid main() {gl_Position = mvpMatrix * vertexPoint;}","precision mediump float;\nuniform vec4 color;\nvoid main() {gl_FragColor = color;}"),this.vertexPointLocation=this.attributeLocation(t,"vertexPoint"),this.mvpMatrixLocation=this.uniformLocation(t,"mvpMatrix"),this.colorLocation=this.uniformLocation(t,"color")};return n.key="WorldWindGpuBasicProgram",n.prototype=Object.create(i.prototype),n.prototype.loadModelviewProjection=function(e,i){if(!i)throw new t(r.logMessage(r.LEVEL_SEVERE,"BasicProgram","loadModelviewProjection","missingMatrix"));this.loadUniformMatrix(e,i,this.mvpMatrixLocation)},n.prototype.loadColor=function(e,i){if(!i)throw new t(r.logMessage(r.LEVEL_SEVERE,"BasicProgram","loadColor","missingColor"));this.loadUniformColor(e,i,this.colorLocation)},n.prototype.loadColorComponents=function(t,e,i,r,n){this.loadUniformColorComponents(t,e,i,r,n,this.colorLocation)},n}),i("util/BasicTimeSequence",["../error/ArgumentError","../util/Logger"],function(t,e){"use strict";var i=function(i){if(!i&&i.length<2)throw new t(e.logMessage(e.LEVEL_SEVERE,"BasicTimeSequence","constructor","missingDates"));this.dates=i,this.currentIndex=0,this.currentTime=i[0]};return Object.defineProperties(i.prototype,{scaleForCurrentTime:{get:function(){return this.currentTime?this.currentIndex/this.dates.length:1}}}),i.prototype.next=function(){return this.currentIndex>=this.dates.length-1?null:(this.currentIndex++,this.currentTime=this.dates[this.currentIndex],this.currentTime)},i.prototype.previous=function(){return this.currentIndex<=0?null:(this.currentIndex--,this.currentTime=this.dates[this.currentIndex],this.currentTime)},i.prototype.reset=function(){this.currentIndex=-1,this.currentTime=null},i.prototype.getTimeForScale=function(t){return this.currentIndex=t<=0?0:t>=1?this.dates.length-1:Math.floor(this.dates.length*t),this.currentTime=this.dates[this.currentIndex],this.currentTime},i}),i("util/AbsentResourceList",[],function(){"use strict";var t=function(t,e){this.maxTrys=t,this.minCheckInterval=e,this.tryAgainInterval=6e4,this.possiblyAbsent={}};return t.prototype.isResourceAbsent=function(t){var e=this.possiblyAbsent[t];if(!e)return!1;if(e.permanent)return!0;var i=Date.now()-e.timeOfLastMark;return i>this.tryAgainInterval?(delete this.possiblyAbsent[t],!1):i<this.minCheckInterval||e.numTrys>this.maxTrys},t.prototype.markResourceAbsent=function(t){var e=this.possiblyAbsent[t];e||(e={timeOfLastMark:Date.now(),numTrys:0},this.possiblyAbsent[t]=e),e.numTrys=e.numTrys+1,e.timeOfLastMark=Date.now()},t.prototype.markResourceAbsentPermanently=function(t){var e=this.possiblyAbsent[t];e||(e={timeOfLastMark:Date.now(),numTrys:0},this.possiblyAbsent[t]=e),e.numTrys=e.numTrys+1,e.timeOfLastMark=Date.now(),e.permanent=!0},t.prototype.unmarkResourceAbsent=function(t){this.possiblyAbsent[t]&&delete this.possiblyAbsent[t]},t}),i("geom/Frustum",["../error/ArgumentError","../geom/Matrix","../geom/Plane","../util/Logger"],function(t,e,i,r){"use strict";var n=function(e,i,n,o,s,a){if(!(e&&i&&n&&o&&s&&a))throw new t(r.logMessage(r.LEVEL_SEVERE,"Frustum","constructor","missingPlane"));this._left=e,this._right=i,this._bottom=n,this._top=o,this._near=s,this._far=a,this._planes=[this._left,this._right,this._top,this._bottom,this._near,this._far]};return Object.defineProperties(n.prototype,{left:{get:function(){return this._left}},right:{get:function(){return this._right}},bottom:{get:function(){return this._bottom}},top:{get:function(){return this._top}},near:{get:function(){return this._near}},far:{get:function(){return this._far}}}),n.prototype.transformByMatrix=function(e){if(!e)throw new t(r.logMessage(r.LEVEL_SEVERE,"Frustum","transformByMatrix","missingMatrix"));return this._left.transformByMatrix(e),this._right.transformByMatrix(e),this._bottom.transformByMatrix(e),this._top.transformByMatrix(e),this._near.transformByMatrix(e),this._far.transformByMatrix(e),this},n.prototype.normalize=function(){return this._left.normalize(),this._right.normalize(),this._bottom.normalize(),this._top.normalize(),this._near.normalize(),this._far.normalize(),this},n.unitFrustum=function(){return new n(new i(1,0,0,1),new i(-1,0,0,1),new i(0,1,1,1),new i(0,-1,0,1),new i(0,0,-1,1),new i(0,0,1,1))},n.fromProjectionMatrix=function(e){if(!e)throw new t(r.logMessage(r.LEVEL_SEVERE,"Frustum","fromProjectionMatrix","missingMatrix"));var o,s,a,l,h,u,c,d,p,f,g;return o=e[12]+e[0],s=e[13]+e[1],a=e[14]+e[2],l=e[15]+e[3],h=Math.sqrt(o*o+s*s+a*a),u=new i(o/h,s/h,a/h,l/h),o=e[12]-e[0],s=e[13]-e[1],a=e[14]-e[2],l=e[15]-e[3],h=Math.sqrt(o*o+s*s+a*a),c=new i(o/h,s/h,a/h,l/h),o=e[12]+e[4],s=e[13]+e[5],a=e[14]+e[6],l=e[15]+e[7],h=Math.sqrt(o*o+s*s+a*a),p=new i(o/h,s/h,a/h,l/h),o=e[12]-e[4],s=e[13]-e[5],a=e[14]-e[6],l=e[15]-e[7],h=Math.sqrt(o*o+s*s+a*a),d=new i(o/h,s/h,a/h,l/h),o=e[12]+e[8],s=e[13]+e[9],a=e[14]+e[10],l=e[15]+e[11],h=Math.sqrt(o*o+s*s+a*a),f=new i(o/h,s/h,a/h,l/h),o=e[12]-e[8],s=e[13]-e[9],a=e[14]-e[10],l=e[15]-e[11],h=Math.sqrt(o*o+s*s+a*a),g=new i(o/h,s/h,a/h,l/h),new n(u,c,p,d,f,g)},n.prototype.containsPoint=function(e){if(!e)throw new t(r.logMessage(r.LEVEL_SEVERE,"Frustum","containsPoint","missingPoint"));return!(this._far.dot(e)<=0)&&(!(this._left.dot(e)<=0)&&(!(this._right.dot(e)<=0)&&(!(this._top.dot(e)<=0)&&(!(this._bottom.dot(e)<=0)&&!(this._near.dot(e)<=0)))))},n.prototype.intersectsSegment=function(e,i){if(!e||!i)throw new t(r.logMessage(r.LEVEL_SEVERE,"Frustum","containsPoint","missingPoint"));if(this.containsPoint(e)||this.containsPoint(i))return!0;if(e.equals(i))return!1;for(var n=0,o=this._planes.length;n<o;n++){if(this._planes[n].onSameSide(e,i)<0)return!1;if(null!=this._planes[n].clip(e,i))return!0}return!1},n}),i("error/NotYetImplementedError",["../error/AbstractError"],function(t){"use strict";var e=function(e){t.call(this,"NotYetImplementedError",e);var i;try{throw new Error}catch(t){i=t.stack}this.stack=i};return e.prototype=Object.create(t.prototype),e}),i("geom/BoundingBox",["../error/ArgumentError","../shaders/BasicProgram","../geom/Frustum","../util/Logger","../geom/Matrix","../error/NotYetImplementedError","../geom/Plane","../geom/Sector","../geom/Vec3","../util/WWMath","../util/WWUtil"],function(t,e,i,r,n,o,s,a,l,h,u){"use strict";var c=function(){this.center=new l(0,0,0),this.bottomCenter=new l(-.5,0,0),this.topCenter=new l(.5,0,0),this.r=new l(1,0,0),this.s=new l(0,1,0),this.t=new l(0,0,1),this.radius=Math.sqrt(3),this.tmp1=new l(0,0,0),this.tmp2=new l(0,0,0),this.tmp3=new l(0,0,0),this.scratchElevations=new Float64Array(9),this.scratchPoints=new Float64Array(3*this.scratchElevations.length)};return c.scratchMatrix=n.fromIdentity(),c.prototype.getCorners=function(){
var t=new l(this.s[0],this.s[1],this.s[2]),e=new l(this.t[0],this.t[1],this.t[2]),i=new l(this.s[0],this.s[1],this.s[2]),r=new l(this.s[0],this.s[1],this.s[2]);t.add(this.t).multiply(-.5),e.subtract(this.s).multiply(.5),i.add(this.t).multiply(.5),r.subtract(this.t).multiply(.5);for(var n=[],o=0;o<4;o++)n.push(new l(this.bottomCenter[0],this.bottomCenter[1],this.bottomCenter[2]));for(o=0;o<4;o++)n.push(new l(this.topCenter[0],this.topCenter[1],this.topCenter[2]));return n[0].add(t),n[1].add(e),n[2].add(i),n[3].add(r),n[4].add(t),n[5].add(e),n[6].add(i),n[7].add(r),n},c.prototype.setToPoints=function(e){if(!e||e.length<3)throw new t(r.logMessage(r.LEVEL_SEVERE,"BoundingBox","setToPoints","missingArray"));var i,o,s,a,h,u,c,d,p,f,g,m,E,y,_,v=+Number.MAX_VALUE,S=-Number.MAX_VALUE,b=+Number.MAX_VALUE,T=-Number.MAX_VALUE,L=+Number.MAX_VALUE,w=-Number.MAX_VALUE,R=this.r,x=this.s,M=this.t,C=new l(0,0,0);n.principalAxesFromPoints(e,R,x,M);for(var A=0,P=e.length/3;A<P;A++)C[0]=e[3*A],C[1]=e[3*A+1],C[2]=e[3*A+2],i=C.dot(R),v>i&&(v=i),S<i&&(S=i),o=C.dot(x),b>o&&(b=o),T<o&&(T=o),s=C.dot(M),L>s&&(L=s),w<s&&(w=s);return S===v&&(S=v+1),T===b&&(T=b+1),w===L&&(w=L+1),a=S-v,h=T-b,u=w-L,c=S+v,d=T+b,p=w+L,f=.5*R[0]*a,g=.5*R[1]*a,m=.5*R[2]*a,E=.5*(R[0]*c+x[0]*d+M[0]*p),y=.5*(R[1]*c+x[1]*d+M[1]*p),_=.5*(R[2]*c+x[2]*d+M[2]*p),this.center[0]=E,this.center[1]=y,this.center[2]=_,this.topCenter[0]=E+f,this.topCenter[1]=y+g,this.topCenter[2]=_+m,this.bottomCenter[0]=E-f,this.bottomCenter[1]=y-g,this.bottomCenter[2]=_-m,R.multiply(a),x.multiply(h),M.multiply(u),this.radius=.5*Math.sqrt(a*a+h*h+u*u),this},c.prototype.setToVec3Points=function(e){if(!e||0===e.length)throw new t(r.logMessage(r.LEVEL_SEVERE,"BoundingBox","setToVec3Points","missingArray"));for(var i=new Float32Array(3*e.length),n=0;n<e.length;n++)for(var o=e[n],s=0;s<3;s++)i[3*n+s]=o[s];return this.setToPoints(i)},c.prototype.setToSector=function(e,i,n,o){if(!e)throw new t(r.logMessage(r.LEVEL_SEVERE,"BoundingBox","setToSector","missingSector"));if(!i)throw new t(r.logMessage(r.LEVEL_SEVERE,"BoundingBox","setToSector","missingGlobe"));var s=this.scratchElevations,a=this.scratchPoints;u.fillArray(s,o),s[0]=s[2]=s[6]=s[8]=n,i.computePointsForGrid(e,3,3,s,l.ZERO,a);this.tmp1.set(a[12],a[13],a[14]),h.localCoordinateAxesAtPoint(this.tmp1,i,this.r,this.s,this.t);for(var c=[Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY],d=[Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY],p=[Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY],f=0,g=a.length;f<g;f+=3)this.tmp1.set(a[f],a[f+1],a[f+2]),this.adjustExtremes(this.r,c,this.s,d,this.t,p,this.tmp1);c[1]-c[0]<d[1]-d[0]&&this.swapAxes(this.r,c,this.s,d),d[1]-d[0]<p[1]-p[0]&&this.swapAxes(this.s,d,this.t,p),c[1]-c[0]<d[1]-d[0]&&this.swapAxes(this.r,c,this.s,d);var m=c[1]-c[0],E=d[1]-d[0],y=p[1]-p[0],_=c[1]+c[0],v=d[1]+d[0],S=p[1]+p[0],b=.5*(this.r[0]*_+this.s[0]*v+this.t[0]*S),T=.5*(this.r[1]*_+this.s[1]*v+this.t[1]*S),L=.5*(this.r[2]*_+this.s[2]*v+this.t[2]*S),w=.5*this.r[0]*m,R=.5*this.r[1]*m,x=.5*this.r[2]*m;return this.center.set(b,T,L),this.topCenter.set(b+w,T+R,L+x),this.bottomCenter.set(b-w,T-R,L-x),this.r.multiply(m),this.s.multiply(E),this.t.multiply(y),this.radius=.5*Math.sqrt(m*m+E*E+y*y),this},c.prototype.translate=function(e){if(!e)throw new t(r.logMessage(r.LEVEL_SEVERE,"BoundingBox","translate","missingVector"));return this.bottomCenter.add(e),this.topCenter.add(e),this.center.add(e),this},c.prototype.distanceTo=function(e){if(!e)throw new t(r.logMessage(r.LEVEL_SEVERE,"BoundingBox","distanceTo","missingPoint"));var i=this.center.distanceTo(e)-this.radius;return i>=0?i:-i},c.prototype.effectiveRadius=function(e){if(!e)throw new t(r.logMessage(r.LEVEL_SEVERE,"BoundingBox","effectiveRadius","missingPlane"));var i=e.normal;return.5*(h.fabs(this.r.dot(i))+h.fabs(this.s.dot(i))+h.fabs(this.t.dot(i)))},c.prototype.intersectsFrustum=function(e){if(!e)throw new t(r.logMessage(r.LEVEL_SEVERE,"BoundingBox","intersectsFrustum","missingFrustum"));return this.tmp1.copy(this.bottomCenter),this.tmp2.copy(this.topCenter),!(this.intersectionPoint(e.near)<0)&&(!(this.intersectionPoint(e.far)<0)&&(!(this.intersectionPoint(e.left)<0)&&(!(this.intersectionPoint(e.right)<0)&&(!(this.intersectionPoint(e.top)<0)&&!(this.intersectionPoint(e.bottom)<0)))))},c.prototype.intersectionPoint=function(t){var e=t.normal,i=.5*(Math.abs(this.s.dot(e))+Math.abs(this.t.dot(e)));return this.intersectsAt(t,i,this.tmp1,this.tmp2)},c.prototype.intersectsAt=function(t,e,i,r){var n=t.dot(i),o=n<=-e,s=t.dot(r),a=s<=-e;if(o&&a)return-1;if(o==a)return 0;this.tmp3.copy(i),this.tmp3.subtract(r);var l=(e+n)/t.normal.dot(this.tmp3);return this.tmp3.copy(r),this.tmp3.subtract(i),this.tmp3.multiply(l),this.tmp3.add(i),o?i.copy(this.tmp3):r.copy(this.tmp3),l},c.prototype.adjustExtremes=function(t,e,i,r,n,o,s){var a=s.dot(t);e[0]>a&&(e[0]=a),e[1]<a&&(e[1]=a);var l=s.dot(i);r[0]>l&&(r[0]=l),r[1]<l&&(r[1]=l);var h=s.dot(n);o[0]>h&&(o[0]=h),o[1]<h&&(o[1]=h)},c.prototype.swapAxes=function(t,e,i,r){t.swap(i);var n=e[0];e[0]=r[0],r[0]=n,n=e[1],e[1]=r[1],r[1]=n},c.prototype.render=function(t){var i=t.currentGlContext,r=c.scratchMatrix,n=t.findAndBindProgram(e);try{r.copy(t.navigatorState.modelviewProjection),r.multiply(this.r[0],this.s[0],this.t[0],this.center[0],this.r[1],this.s[1],this.t[1],this.center[1],this.r[2],this.s[2],this.t[2],this.center[2],0,0,0,1),r.multiplyByTranslation(-.5,-.5,-.5),n.loadModelviewProjection(i,r),i.disable(i.CULL_FACE),i.bindBuffer(i.ARRAY_BUFFER,t.unitCubeBuffer()),i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,t.unitCubeElements()),i.enableVertexAttribArray(n.vertexPointLocation),i.vertexAttribPointer(n.vertexPointLocation,3,i.FLOAT,!1,0,0),n.loadColorComponents(i,0,1,0,.6),i.drawElements(i.LINES,24,i.UNSIGNED_SHORT,72),n.loadColorComponents(i,1,1,1,.3),i.drawElements(i.TRIANGLES,36,i.UNSIGNED_SHORT,0)}finally{i.enable(i.CULL_FACE),i.bindBuffer(i.ARRAY_BUFFER,null),i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,null)}},c}),i("util/Tile",["../error/ArgumentError","../geom/BoundingBox","../util/Logger","../geom/Sector","../geom/Vec3","../util/WWUtil"],function(t,e,i,r,n,o){"use strict";var s=function(e,r,n,o){if(!e)throw new t(i.logMessage(i.LEVEL_SEVERE,"Tile","constructor","missingSector"));if(!r)throw new t(i.logMessage(i.LEVEL_SEVERE,"Tile","constructor","The specified level is null or undefined."));if(n<0||o<0)throw new t(i.logMessage(i.LEVEL_SEVERE,"Tile","constructor","The specified row or column is less than zero."));this.sector=e,this.level=r,this.row=n,this.column=o,this.tileWidth=r.tileWidth,this.tileHeight=r.tileHeight,this.texelSize=r.texelSize,this.tileKey=r.levelNumber.toString()+"."+n.toString()+"."+o.toString(),this.extent=null,this.referencePoint=null,this.opacity=1,this.samplePoints=null,this.sampleElevations=null,this.updateTimestamp=null,this.updateVerticalExaggeration=null,this.updateGlobeStateKey=null};return s.prototype.isEqual=function(t){return!!t&&(!!t.tileKey&&this.tileKey==t.tileKey)},s.prototype.size=function(){return 828},s.prototype.distanceTo=function(e){if(!e)throw new t(i.logMessage(i.LEVEL_SEVERE,"Tile","distanceTo","missingVector"));for(var r,n,o,s=e[0],a=e[1],l=e[2],h=this.samplePoints,u=Number.POSITIVE_INFINITY,c=0,d=h.length;c<d;c+=3)r=s-h[c],n=a-h[c+1],o=l-h[c+2],u=Math.min(u,r*r+n*n+o*o);return Math.sqrt(u)},s.prototype.subdivide=function(e,n){if(!e)throw new t(i.logMessage(i.LEVEL_SEVERE,"Tile","subdivide","The specified level is null or undefined."));if(!n)throw new t(i.logMessage(i.LEVEL_SEVERE,"Tile","subdivide","The specified tile factory is null or undefined."));var o,s,a,l=this.sector.minLatitude,h=this.sector.maxLatitude,u=this.sector.centroidLatitude(),c=this.sector.minLongitude,d=this.sector.maxLongitude,p=this.sector.centroidLongitude(),f=[];return o=2*this.row,s=2*this.column,a=new r(l,u,c,p),f.push(n.createTile(a,e,o,s)),o=2*this.row,s=2*this.column+1,a=new r(l,u,p,d),f.push(n.createTile(a,e,o,s)),o=2*this.row+1,s=2*this.column,a=new r(u,h,c,p),f.push(n.createTile(a,e,o,s)),o=2*this.row+1,s=2*this.column+1,a=new r(u,h,p,d),f.push(n.createTile(a,e,o,s)),f},s.prototype.subdivideToCache=function(e,r,n){if(!e)throw new t(i.logMessage(i.LEVEL_SEVERE,"Tile","subdivideToCache","The specified level is null or undefined."));if(!r)throw new t(i.logMessage(i.LEVEL_SEVERE,"Tile","subdivideToCache","The specified tile factory is null or undefined."));var o=n?n.entryForKey(this.tileKey):null;return o||(o=this.subdivide(e,r))&&n&&n.putEntry(this.tileKey,o,4*o[0].size()),o},s.prototype.mustSubdivide=function(t,e){var i=t.globe.equatorialRadius*this.texelSize,r=this.distanceTo(t.navigatorState.eyePoint),n=t.navigatorState.pixelSizeAtDistance(r);return i>Math.max(e*n,.5)},s.prototype.update=function(t){var e=t.globe.elevationTimestamp(),i=t.verticalExaggeration,r=t.globeStateKey;this.updateTimestamp==e&&this.updateVerticalExaggeration==i&&this.updateGlobeStateKey==r||(this.doUpdate(t),t.frameStatistics.incrementTileUpdateCount(1),this.updateTimestamp=e,this.updateVerticalExaggeration=i,this.updateGlobeStateKey=r)},s.prototype.doUpdate=function(t){var i=t.globe,r=t.verticalExaggeration,s=i.minAndMaxElevationsForSector(this.sector),a=s?s[0]*r:0,l=s?s[1]*r:0;a==l&&(a=l+10),this.extent||(this.extent=new e),this.extent.setToSector(this.sector,i,a,l),this.samplePoints||(this.sampleElevations=new Float64Array(9),this.samplePoints=new Float64Array(3*this.sampleElevations.length)),o.fillArray(this.sampleElevations,.5*(a+l)),i.computePointsForGrid(this.sector,3,3,this.sampleElevations,n.ZERO,this.samplePoints),this.referencePoint||(this.referencePoint=new n(0,0,0)),i.computePointFromPosition(this.sector.centroidLatitude(),this.sector.centroidLongitude(),0,this.referencePoint)},s.computeRow=function(t,e){var i=Math.floor((e+90)/t);return 90==e&&(i-=1),i},s.computeColumn=function(t,e){var i=Math.floor((e+180)/t);return 180==e&&(i-=1),i},s.computeLastRow=function(t,e){var i=Math.ceil((e+90)/t-1);return e+90<t&&(i=0),i},s.computeLastColumn=function(t,e){var i=Math.ceil((e+180)/t-1);return e+180<t&&(i=0),i},s.computeSector=function(e,n,o){if(!e)throw new t(i.logMessage(i.LEVEL_SEVERE,"Tile","computeSector","missingLevel"));if(n<0||o<0)throw new t(i.logMessage(i.LEVEL_SEVERE,"Tile","computeSector","The specified row or column is less than zero."));var s=e.tileDelta.latitude,a=e.tileDelta.longitude,l=n*s-90,h=o*a-180;return new r(l,l+s,h,h+a)},s.createTilesForLevel=function(e,n,o){if(!e)throw new t(i.logMessage(i.LEVEL_SEVERE,"Tile","createTilesForLevel","missingLevel"));if(!n)throw new t(i.logMessage(i.LEVEL_SEVERE,"Tile","createTilesForLevel","The specified tile factory is null or undefined"));if(!o)throw new t(i.logMessage(i.LEVEL_SEVERE,"Tile","createTilesForLevel","missingResult"));for(var a,l,h,u=e.tileDelta.latitude,c=e.tileDelta.longitude,d=e.sector,p=s.computeRow(u,d.minLatitude),f=s.computeRow(u,d.maxLatitude),g=s.computeColumn(c,d.minLongitude),m=s.computeColumn(c,d.maxLongitude),E=p*u-90,y=g*c-180,_=E,v=p;v<=f;v+=1){l=_+u,a=y;for(var S=g;S<=m;S+=1){h=a+c;var b=new r(_,l,a,h),T=n.createTile(b,e,v,S);o.push(T),a=h}_=l}},s}),i("render/TextureTile",["../error/ArgumentError","../util/Logger","../util/Tile"],function(t,e,i){"use strict";var r=function(t,e,r,n){i.call(this,t,e,r,n),this.gpuCacheKey=null};return r.prototype=Object.create(i.prototype),r.prototype.size=function(){return i.prototype.size.call(this)},r.prototype.bind=function(t){var e=t.gpuResourceCache.resourceForKey(this.gpuCacheKey);return!!e&&e.bind(t)},r.prototype.applyInternalTransform=function(t,e){},r}),i("render/ImageTile",["../error/ArgumentError","../util/Logger","../render/TextureTile","../util/Tile"],function(t,e,i,r){"use strict";var n=function(r,n,o,s,a){if(!a||a.length<1)throw new t(e.logMessage(e.LEVEL_SEVERE,"ImageTile","constructor","The specified image path is null, undefined or zero length."));i.call(this,r,n,o,s),this.imagePath=a,this.fallbackTile=null,this.gpuCacheKey=a};return n.prototype=Object.create(i.prototype),n.prototype.size=function(){return this.__proto__.__proto__.size.call(this)+this.imagePath.length+8},n.prototype.bind=function(t){return!!this.__proto__.__proto__.bind.call(this,t)||!!this.fallbackTile&&this.fallbackTile.bind(t)},n.prototype.applyInternalTransform=function(t,e){this.fallbackTile&&!t.gpuResourceCache.resourceForKey(this.imagePath)&&this.applyFallbackTransform(e)},n.prototype.applyFallbackTransform=function(t){if(!(this.level.levelNumber-this.fallbackTile.level.levelNumber<=0)){var e=this.fallbackTile.sector.deltaLatitude(),i=this.fallbackTile.sector.deltaLongitude(),r=this.sector.deltaLongitude()/i,n=this.sector.deltaLatitude()/e,o=(this.sector.minLongitude-this.fallbackTile.sector.minLongitude)/i,s=(this.sector.minLatitude-this.fallbackTile.sector.minLatitude)/e;t.multiply(r,0,0,o,0,n,0,s,0,0,1,0,0,0,0,1)}},n}),i("util/Level",["../geom/Angle","../error/ArgumentError","../geom/Location","../util/Logger"],function(t,e,i,r){"use strict";var n=function(i,n,o){if(!n)throw new e(r.logMessage(r.LEVEL_SEVERE,"Level","constructor","The specified tile delta is null or undefined"));if(!o)throw new e(r.logMessage(r.LEVEL_SEVERE,"Level","constructor","The specified parent level set is null or undefined"));this.levelNumber=i,this.tileDelta=n,this.parent=o,this.texelSize=n.latitude*t.DEGREES_TO_RADIANS/o.tileHeight,this.tileWidth=o.tileWidth,this.tileHeight=o.tileHeight,this.sector=o.sector};return n.prototype.isFirstLevel=function(){return this.parent.firstLevel()==this},n.prototype.isLastLevel=function(){return this.parent.lastLevel()==this},n.prototype.previousLevel=function(){return this.parent.level(this.levelNumber-1)},n.prototype.nextLevel=function(){return this.parent.level(this.levelNumber+1)},n.prototype.compare=function(t){if(!t)throw new e(r.logMessage(r.LEVEL_SEVERE,"Level","compare","The specified level is null or undefined"));return this.levelNumber<t.levelNumber?-1:this.levelNumber>t.levelNumber?1:0},n}),i("util/LevelSet",["../error/ArgumentError","../util/Level","../geom/Location","../util/Logger"],function(t,e,i,r){"use strict";var n=function(n,o,s,a,l){if(!n)throw new t(r.logMessage(r.LEVEL_SEVERE,"LevelSet","constructor","missingSector"));if(!o)throw new t(r.logMessage(r.LEVEL_SEVERE,"LevelSet","constructor","The specified level zero delta is null or undefined"));if(o.latitude<=0||o.longitude<=0)throw new t(r.logMessage(r.LEVEL_SEVERE,"LevelSet","constructor","The specified level zero delta is less than or equal to zero."));if(s<1)throw new t(r.logMessage(r.LEVEL_SEVERE,"LevelSet","constructor","The specified number of levels is less than one."));if(a<1||l<1)throw new t(r.logMessage(r.LEVEL_SEVERE,"LevelSet","constructor","The specified tile width or tile height is less than one."));this.sector=n,this.levelZeroDelta=o,this.numLevels=s,this.tileWidth=a,this.tileHeight=l,this.levels=[];for(var h=0;h<s;h+=1){var u=Math.pow(2,h),c=o.latitude/u,d=o.longitude/u,p=new i(c,d),f=new e(h,p,this);this.levels[h]=f}};return n.prototype.level=function(t){return t<0||t>=this.levels.length?null:this.levels[t]},n.prototype.levelForTexelSize=function(t){var e=this.lastLevel();if(e.texelSize>=t)return e;for(var i=0,r=this.levels.length;i<r;i+=1){var n=this.levels[i];if(n.texelSize<=t)return n}return e},n.prototype.firstLevel=function(){return this.levels[0]},n.prototype.lastLevel=function(){return this.levels[this.levels.length-1]},n}),i("cache/MemoryCache",["../error/ArgumentError","../util/Logger"],function(t,e){"use strict";var i=function(i,r){if(!i||i<1)throw new t(e.logMessage(e.LEVEL_SEVERE,"MemoryCache","constructor","The specified capacity is undefined, zero or negative"));if(!r||r>=i||r<0)throw new t(e.logMessage(e.LEVEL_SEVERE,"MemoryCache","constructor","The specified low-water value is undefined, greater than or equal to the capacity, or less than 1"));this._capacity=i,this._lowWater=r,this.usedCapacity=0,this.freeCapacity=i,this.entries={},this.listeners=[]};return Object.defineProperties(i.prototype,{capacity:{get:function(){return this._capacity},set:function(i){if(!i||i<1)throw new t(e.logMessage(e.LEVEL_SEVERE,"MemoryCache","capacity","Specified cache capacity is undefined, 0 or negative."));var r=this._capacity;this._capacity=i,this._capacity<=this.lowWater&&(this._lowWater=.85*this._capacity),this._capacity<r&&this.makeSpace(0)}},lowWater:{get:function(){return this._lowWater},set:function(i){if(!i||i>=this._capacity||i<0)throw new t(e.logMessage(e.LEVEL_SEVERE,"MemoryCache","lowWater","Specified cache low-water value is undefined, negative or not less than the current capacity."));this._lowWater=i}}}),i.prototype.entryForKey=function(t){if(!t)return null;var e=this.entries[t];return e?(e.lastUsed=Date.now(),e.entry):null},i.prototype.putEntry=function(i,r,n){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"MemoryCache","putEntry","missingKey."));if(!r)throw new t(e.logMessage(e.LEVEL_SEVERE,"MemoryCache","putEntry","missingEntry."));if(n<1)throw new t(e.logMessage(e.LEVEL_SEVERE,"MemoryCache","putEntry","The specified entry size is less than 1."));var o,s=this.entries[i];s&&this.removeEntry(i),this.usedCapacity+n>this._capacity&&this.makeSpace(n),this.usedCapacity+=n,this.freeCapacity=this._capacity-this.usedCapacity,o={key:i,entry:r,size:n,lastUsed:Date.now()},this.entries[i]=o},i.prototype.clear=function(t){if(t)for(var e in this.entries)this.entries.hasOwnProperty(e)&&this.removeCacheEntry(e);this.entries={},this.freeCapacity=this._capacity,this.usedCapacity=0},i.prototype.removeEntry=function(t){if(t){var e=this.entries[t];e&&this.removeCacheEntry(e)}},i.prototype.removeCacheEntry=function(t){delete this.entries[t.key],this.usedCapacity-=t.size,this.freeCapacity=this._capacity-this.usedCapacity;for(var e=0,i=this.listeners.length;e<i;e++)try{this.listeners[e].entryRemoved(t.key,t.entry)}catch(i){this.listeners[e].removalError(i,t.key,t.entry)}},i.prototype.containsKey=function(t){return t&&this.entries[t]},i.prototype.addCacheListener=function(i){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"MemoryCache","addCacheListener","missingListener"));if("function"!=typeof i.entryRemoved||"function"!=typeof i.removalError)throw new t(e.logMessage(e.LEVEL_SEVERE,"MemoryCache","addCacheListener","The specified listener does not implement the required functions."));this.listeners.push(i)},i.prototype.removeCacheListener=function(i){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"MemoryCache","removeCacheListener","missingListener"));var r=this.listeners.indexOf(i);r>-1&&this.listeners.splice(r,1)},i.prototype.makeSpace=function(t){var e=[];this.usedCapacity;for(var i in this.entries)this.entries.hasOwnProperty(i)&&e.push(this.entries[i]);e.sort(function(t,e){return t.lastUsed-e.lastUsed});for(var r=0,n=e.length;r<n&&(this.usedCapacity>this._lowWater||this.freeCapacity<t);r++)this.removeCacheEntry(e[r])},i}),i("layer/TiledImageLayer",["../util/AbsentResourceList","../error/ArgumentError","../render/ImageTile","../layer/Layer","../util/LevelSet","../util/Logger","../cache/MemoryCache","../render/Texture","../util/Tile","../util/WWUtil"],function(t,e,i,r,n,o,s,a,l,h){"use strict";var u=function(i,a,l,h,u,c,d){if(!i)throw new e(o.logMessage(o.LEVEL_SEVERE,"TiledImageLayer","constructor","missingSector"));if(!a)throw new e(o.logMessage(o.LEVEL_SEVERE,"TiledImageLayer","constructor","The specified level-zero delta is null or undefined."));if(!h)throw new e(o.logMessage(o.LEVEL_SEVERE,"TiledImageLayer","constructor","The specified image format is null or undefined."));if(!u)throw new e(o.logMessage(o.LEVEL_SEVERE,"TiledImageLayer","constructor","The specified cache path is null or undefined."));if(!l||l<1)throw new e(o.logMessage(o.LEVEL_SEVERE,"TiledImageLayer","constructor","The specified number of levels is less than one."));if(!c||!d||c<1||d<1)throw new e(o.logMessage(o.LEVEL_SEVERE,"TiledImageLayer","constructor","The specified tile width or height is less than one."));r.call(this,"Tiled Image Layer"),this.retrievalImageFormat=h,this.cachePath=u,this.levels=new n(i,a,l,c,d),this.detailControl=1.75,this.crossOrigin="anonymous",this.expiration=null,this.currentTiles=[],this.currentTilesInvalid=!0,this.tileCache=new s(5e5,4e5),this.currentRetrievals=[],this.absentResourceList=new t(3,5e4),this.pickEnabled=!1};return u.prototype=Object.create(r.prototype),u.prototype.refresh=function(){this.expiration=new Date,this.currentTilesInvalid=!0},u.prototype.prePopulate=function(t){if(!t)throw new e(o.logMessage(o.LEVEL_SEVERE,"TiledImageLayer","prePopulate","missingWorldWindow"));var i=t.drawContext;this.topLevelTiles&&0!==this.topLevelTiles.length||this.createTopLevelTiles(i);for(var r=0;r<this.topLevelTiles.length;r++){var n=this.topLevelTiles[r];this.isTileTextureInMemory(i,n)||this.retrieveTileImage(i,n,!0)}},u.prototype.prePopulateCurrentTiles=function(t){if(!t)throw new e(o.logMessage(o.LEVEL_SEVERE,"TiledImageLayer","prePopulate","missingWorldWindow"));var i=t.drawContext;this.assembleTiles(i);for(var r=0,n=this.currentTiles.length;r<n;r++){var s=this.currentTiles[r];this.isTileTextureInMemory(i,s)||this.retrieveTileImage(i,s,!0)}},u.prototype.isPrePopulated=function(t){if(!t)throw new e(o.logMessage(o.LEVEL_SEVERE,"TiledImageLayer","isPrePopulated","missingWorldWindow"));for(var i=0;i<this.topLevelTiles.length;i++)if(!this.isTileTextureInMemory(t.drawContext,this.topLevelTiles[i]))return!1;return!0},u.prototype.createTile=function(t,e,r,n){var o=this.cachePath+"-layer/"+e.levelNumber+"/"+r+"/"+r+"_"+n+"."+h.suffixForMimeType(this.retrievalImageFormat);return new i(t,e,r,n,o)},u.prototype.doRender=function(t){if(t.terrain){if(this.currentTilesInvalid||!this.lasTtMVP||!t.navigatorState.modelviewProjection.equals(this.lasTtMVP)||t.globeStateKey!=this.lastGlobeStateKey)if(this.currentTilesInvalid=!1,t.surfaceOpacity>=1&&this.opacity>=1){this.previousTiles={};for(var e=0;e<this.currentTiles.length;e++)this.previousTiles[this.currentTiles[e].imagePath]=this.currentTiles[e];this.assembleTiles(t),this.fadeOutgoingTiles(t)}else this.assembleTiles(t);this.lasTtMVP=t.navigatorState.modelviewProjection,this.lastGlobeStateKey=t.globeStateKey,this.currentTiles.length>0&&(t.surfaceTileRenderer.renderTiles(t,this.currentTiles,this.opacity,t.surfaceOpacity>=1),t.frameStatistics.incrementImageTileCount(this.currentTiles.length),this.inCurrentFrame=!0)}},u.prototype.fadeOutgoingTiles=function(t){for(var e=(t.timestamp-t.previousRedrawTimestamp)/t.fadeTime,i={},r=0;r<this.currentTiles.length;r++){var n=this.currentTiles[r];i[n.imagePath]=n}for(var o in this.previousTiles)this.previousTiles.hasOwnProperty(o)&&(n=this.previousTiles[o],n.opacity>0&&!i[n.imagePath]&&(n.opacity=Math.max(0,n.opacity-e),n.opacity>0&&(this.currentTiles.push(n),this.currentTilesInvalid=!0,t.redrawRequested=!0)))},u.prototype.isLayerInView=function(t){return t.terrain&&t.terrain.sector&&t.terrain.sector.intersects(this.levels.sector)},u.prototype.createTopLevelTiles=function(t){this.topLevelTiles=[],l.createTilesForLevel(this.levels.firstLevel(),this,this.topLevelTiles)},u.prototype.assembleTiles=function(t){this.currentTiles=[],this.topLevelTiles&&0!==this.topLevelTiles.length||this.createTopLevelTiles(t);for(var e=0,i=this.topLevelTiles.length;e<i;e++){var r=this.topLevelTiles[e];r.update(t),this.currentAncestorTile=null,this.isTileVisible(t,r)&&this.addTileOrDescendants(t,r)}},u.prototype.addTileOrDescendants=function(t,e){if(this.tileMeetsRenderingCriteria(t,e))return void this.addTile(t,e);var i=null;try{(this.isTileTextureInMemory(t,e)||0===e.level.levelNumber)&&(i=this.currentAncestorTile,this.currentAncestorTile=e);for(var r=this.levels.level(e.level.levelNumber+1),n=e.subdivideToCache(r,this,this.tileCache),o=0,s=n.length;o<s;o++){var a=n[o];a.update(t),this.levels.sector.intersects(a.sector)&&this.isTileVisible(t,a)&&this.addTileOrDescendants(t,a)}}finally{i&&(this.currentAncestorTile=i)}},u.prototype.addTile=function(t,e){e.fallbackTile=null;var i=t.gpuResourceCache.resourceForKey(e.imagePath);if(i)return e.opacity=1,this.currentTiles.push(e),void(this.expiration&&this.isTextureExpired(i)&&this.retrieveTileImage(t,e));this.retrieveTileImage(t,e),this.currentAncestorTile&&this.isTileTextureInMemory(t,this.currentAncestorTile)&&(e.fallbackTile=this.currentAncestorTile,e.fallbackTile.opacity=1,this.currentTiles.push(e))},u.prototype.isTileVisible=function(t,e){return!(t.globe.projectionLimits&&!e.sector.overlaps(t.globe.projectionLimits))&&e.extent.intersectsFrustum(t.navigatorState.frustumInModelCoordinates)},u.prototype.tileMeetsRenderingCriteria=function(t,e){var i=this.detailControl;return(e.sector.minLatitude>=75||e.sector.maxLatitude<=-75)&&(i*=1.2),e.level.isLastLevel()||!e.mustSubdivide(t,i)},u.prototype.isTileTextureInMemory=function(t,e){return t.gpuResourceCache.containsResource(e.imagePath)},u.prototype.isTextureExpired=function(t){return this.expiration&&t.creationTime.getTime()<=this.expiration.getTime()},u.prototype.retrieveTileImage=function(t,e,i){if(this.currentRetrievals.indexOf(e.imagePath)<0){if(this.absentResourceList.isResourceAbsent(e.imagePath))return;var r=this.resourceUrlForTile(e,this.retrievalImageFormat),n=new Image,s=e.imagePath,a=t.gpuResourceCache,l=t.currentGlContext.canvas,h=this;if(!r)return void(this.currentTilesInvalid=!0);n.onload=function(){o.log(o.LEVEL_INFO,"Image retrieval succeeded: "+r);var u=h.createTexture(t,e,n);if(h.removeFromCurrentRetrievals(s),u&&(a.putResource(s,u,u.size),h.currentTilesInvalid=!0,h.absentResourceList.unmarkResourceAbsent(s),!i)){var c=document.createEvent("Event");c.initEvent(WorldWind.REDRAW_EVENT_TYPE,!0,!0),l.dispatchEvent(c)}},n.onerror=function(){h.removeFromCurrentRetrievals(s),h.absentResourceList.markResourceAbsent(s),o.log(o.LEVEL_WARNING,"Image retrieval failed: "+r)},this.currentRetrievals.push(s),n.crossOrigin=this.crossOrigin,n.src=r}},u.prototype.createTexture=function(t,e,i){return new a(t.currentGlContext,i)},u.prototype.removeFromCurrentRetrievals=function(t){var e=this.currentRetrievals.indexOf(t);e>-1&&this.currentRetrievals.splice(e,1)},u.prototype.resourceUrlForTile=function(t,e){return this.urlBuilder?this.urlBuilder.urlForTile(t,e):null},u}),i("layer/MercatorTiledImageLayer",["../util/Color","../geom/Sector","../layer/TiledImageLayer","../geom/Vec2","../util/WWMath"],function(t,e,i,r,n){"use strict";var o=function(t,e,n,o,s,a,l){i.call(this,t,e,n,o,s,a,l),this.detectBlankImages=!1,this.testPixels=[new r(20,20),new r(235,20),new r(20,235),new r(235,235)],this.destCanvas=document.createElement("canvas"),this.destContext=this.destCanvas.getContext("2d")};return o.prototype=Object.create(i.prototype),o.prototype.createTile=function(t,r,o,s){var a,l,h,u,c,d,p=this.mapSizeForLevel(r.levelNumber),f=n.clamp(s*this.imageSize,0,p),g=n.clamp(o*this.imageSize,0,p),m=n.clamp(f+this.imageSize,0,p),E=n.clamp(g+this.imageSize,0,p);return a=f/p-.5,l=.5-E/p,h=90-360*Math.atan(Math.exp(2*-l*Math.PI))/Math.PI,u=360*a,a=m/p-.5,l=.5-g/p,c=90-360*Math.atan(Math.exp(2*-l*Math.PI))/Math.PI,d=360*a,t=new e(h,c,u,d),i.prototype.createTile.call(this,t,r,o,s)},o.prototype.createTexture=function(t,e,r){var o,s,a,l,h,u,c,d,p=t.canvas2D,f=t.ctx2D,g=this.destCanvas,m=this.destContext,E=m.createImageData(r.width,r.height),y=e.sector,_=n.gudermannianInverse(y.minLatitude),v=n.gudermannianInverse(y.maxLatitude);if(p.width=r.width,p.height=r.height,g.width=r.width,g.height=r.height,f.drawImage(r,0,0,r.width,r.height),o=f.getImageData(0,0,r.width,r.height),this.detectBlankImages&&this.isBlankImage(r,o))return this.absentResourceList.markResourceAbsentPermanently(e.imagePath),null;for(var S=0;S<1;S++)for(var b=0;b<r.height;b++){c=1-b/(r.height-1),s=c*y.deltaLatitude()+y.minLatitude,a=n.gudermannianInverse(s),d=1-(a-_)/(v-_),d=n.clamp(d,0,1),l=Math.floor(d*(r.height-1));for(var T=0;T<r.width;T++)h=4*(T+l*r.width),u=4*(T+b*r.width),E.data[u]=o.data[h],E.data[u+1]=o.data[h+1],E.data[u+2]=o.data[h+2],E.data[u+3]=o.data[h+3]}return m.putImageData(E,0,0),i.prototype.createTexture.call(this,t,e,g)},o.prototype.isBlankImage=function(t,e){for(var i,r,n=null,o=0,s=this.testPixels.length;o<s;o++)if(i=this.testPixels[o],r=4*(i[0]+i[1]*t.width),n){if(e.data[r]!=n[0]||e.data[r+1]!=n[1]||e.data[r+2]!=n[2])return!1}else n=[e.data[r],e.data[r+1],e.data[r+2]];return!0},o}),i("layer/BingTiledImageLayer",["../geom/Angle","../geom/Location","../geom/Sector","../layer/MercatorTiledImageLayer"],function(t,e,i,r){"use strict";var n=function(t){this.imageSize=256,r.call(this,new i(-85.05,85.05,-180,180),new e(85.05,180),23,"image/jpeg",t,this.imageSize,this.imageSize),this.displayName=t,this.pickEnabled=!1,this.detectBlankImages=!0,this.creditImage=WorldWind.configuration.baseUrl+"images/powered-by-bing.png"};return n.prototype=Object.create(r.prototype),n.prototype.doRender=function(t){r.prototype.doRender.call(this,t),this.inCurrentFrame&&t.screenCreditController.addImageCredit(this.creditImage)},n.prototype.createTopLevelTiles=function(t){this.topLevelTiles=[],this.topLevelTiles.push(this.createTile(null,this.levels.firstLevel(),0,0)),this.topLevelTiles.push(this.createTile(null,this.levels.firstLevel(),0,1)),this.topLevelTiles.push(this.createTile(null,this.levels.firstLevel(),1,0)),this.topLevelTiles.push(this.createTile(null,this.levels.firstLevel(),1,1))},n.prototype.mapSizeForLevel=function(t){return 256<<t+1},n}),i("util/BingImageryUrlBuilder",["../error/ArgumentError","../util/Logger","../util/WWUtil"],function(t,e,i){"use strict";var r=function(t,e){var i="AkttWCS8p6qzxvx5RH3qUcCPgwG9nRJ7IwlpFGb14B0rBorB5DvmXr2Y_eCUNIxH";this.bingMapsKey=e,this.bingMapsKey||(this.bingMapsKey=WorldWind.BingMapsKey),this.bingMapsKey||(this.bingMapsKey=i),this.bingMapsKey===i&&r.showBingMapsKeyWarning(),this.imagerySet=t};return r.showBingMapsKeyWarning=function(){r.keyMessagePrinted||(r.keyMessagePrinted=!0,e.log(e.LEVEL_WARNING,"WARNING: You are using a limited use, non-production Bing Maps key.\nIf you are developing an app or a web page this violates the Bing Terms of Use.\nPlease visit https://www.microsoft.com/maps/choose-your-bing-maps-API.aspx to obtain your own key for your application.\nSpecify that key to WorldWind by setting the WorldWind.BingMapsKey property to your key prior to creating any Bing Maps layers.\n"))},r.prototype.requestMetadata=function(){if(!this.metadataRetrievalInProcess){this.metadataRetrievalInProcess=!0;var t="https://dev.virtualearth.net/REST/V1/Imagery/Metadata/"+this.imagerySet+"/0,0?zl=1&uriScheme=https&key="+this.bingMapsKey,e=this;i.jsonp(t,"jsonp",function(t){e.imageUrl=t.resourceSets[0].resources[0].imageUrl;var i=document.createEvent("Event");i.initEvent(WorldWind.REDRAW_EVENT_TYPE,!0,!0),window.dispatchEvent(i),e.metadataRetrievalInProcess=!1})}},r.prototype.urlForTile=function(i,r){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"BingImageryUrlBuilder","urlForTile","missingTile"));if(!this.imageUrl)return this.requestMetadata(),null;var n,o=this.quadKeyFromLevelRowColumn(i.level.levelNumber,i.row,i.column);return"Aerial"===this.imagerySet?n=this.imageUrl.replace(/a3/,"a"+o):"AerialWithLabels"===this.imagerySet?n=this.imageUrl.replace(/h3/,"h"+o):"Road"===this.imagerySet&&(n=this.imageUrl.replace(/r3/,"r"+o)),n},r.prototype.quadKeyFromLevelRowColumn=function(t,e,i){for(var r,n,o="",s=t+1;s>0;s--)r=0,n=1<<s-1,0!=(i&n)&&(r+=1),0!=(e&n)&&(r+=2),o+=r.toString();return o},r}),i("layer/BingAerialLayer",["../geom/Location","../geom/Sector","../layer/BingTiledImageLayer","../util/BingImageryUrlBuilder"],function(t,e,i,r){"use strict";var n=function(t){i.call(this,"Bing Aerial"),this.urlBuilder=new r("Aerial",t)};return n.prototype=Object.create(i.prototype),n}),i("layer/BingAerialWithLabelsLayer",["../geom/Location","../geom/Sector","../layer/BingTiledImageLayer","../util/BingImageryUrlBuilder"],function(t,e,i,r){"use strict";var n=function(t){i.call(this,"Bing Aerial with Labels"),this.urlBuilder=new r("AerialWithLabels",t)};return n.prototype=Object.create(i.prototype),n}),
i("layer/BingRoadsLayer",["../geom/Location","../geom/Sector","../layer/BingTiledImageLayer","../util/BingImageryUrlBuilder"],function(t,e,i,r){"use strict";var n=function(t){i.call(this,"Bing Roads"),this.urlBuilder=new r("Road",t),this.detectBlankImages=!1};return n.prototype=Object.create(i.prototype),n}),i("util/WmsUrlBuilder",["../error/ArgumentError","../util/Logger"],function(t,e){"use strict";var i=function(i,r,n,o,s){if(!i||0===i.length)throw new t(e.logMessage(e.LEVEL_SEVERE,"WmsUrlBuilder","constructor","The WMS service address is missing."));if(!r||0===r.length)throw new t(e.logMessage(e.LEVEL_SEVERE,"WmsUrlBuilder","constructor","The WMS layer names are not specified."));this.serviceAddress=i,this.layerNames=r,this.styleNames=n||"",this.transparent=!0,this.wmsVersion=o&&o.length>0?o:"1.3.0",this.isWms130OrGreater=this.wmsVersion>="1.3.0",this.crs="EPSG:4326",this.timeString=s};return i.prototype.urlForTile=function(r,n){if(!r)throw new t(e.logMessage(e.LEVEL_SEVERE,"WmsUrlBuilder","urlForTile","missingTile"));if(!n)throw new t(e.logMessage(e.LEVEL_SEVERE,"WmsUrlBuilder","urlForTile","The image format is null or undefined."));var o=r.sector,s=i.fixGetMapString(this.serviceAddress);return s.search(/service=wms/i)<0&&(s+="service=WMS"),s+="&request=GetMap",s=s+"&version="+this.wmsVersion,s=s+"&transparent="+(this.transparent?"TRUE":"FALSE"),s=s+"&layers="+this.layerNames,s=s+"&styles="+this.styleNames,s=s+"&format="+n,s=s+"&width="+r.tileWidth,s=s+"&height="+r.tileHeight,this.timeString&&(s=s+"&time="+this.timeString),this.isWms130OrGreater?(s=s+"&crs="+this.crs,s+="&bbox=","CRS:84"===this.crs?(s=s+o.minLongitude+","+o.minLatitude+",",s=s+o.maxLongitude+","+o.maxLatitude):(s=s+o.minLatitude+","+o.minLongitude+",",s=s+o.maxLatitude+","+o.maxLongitude)):(s=s+"&srs="+this.crs,s+="&bbox=",s=s+o.minLongitude+","+o.minLatitude+",",s=s+o.maxLongitude+","+o.maxLatitude),s=s.replace(" ","%20")},i.fixGetMapString=function(i){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"WmsUrlBuilder","fixGetMapString","The specified service address is null or undefined."));var r=i.indexOf("?");return r<0?i+="?":r!==i.length-1&&(r=i.search(/&$/))<0&&(i+="&"),i},i}),i("layer/BingWMSLayer",["../geom/Location","../geom/Sector","../layer/TiledImageLayer","../util/WmsUrlBuilder"],function(t,e,i,r){"use strict";var n=function(){i.call(this,e.FULL_SPHERE,new t(45,45),16,"image/png","BingWMS",256,256),this.displayName="Bing WMS",this.pickEnabled=!1,this.maxActiveAltitude=1e4,this.urlBuilder=new r("https://worldwind27.arc.nasa.gov/wms/virtualearth","ve","","1.3.0")};return n.prototype=Object.create(i.prototype),n}),i("layer/BMNGLandsatLayer",["../geom/Location","../geom/Sector","../layer/TiledImageLayer","../util/WmsUrlBuilder"],function(t,e,i,r){"use strict";var n=function(){i.call(this,e.FULL_SPHERE,new t(45,45),10,"image/jpeg","BMNGLandsat256",256,256),this.displayName="Blue Marble & Landsat",this.pickEnabled=!1,this.urlBuilder=new r("https://worldwind25.arc.nasa.gov/wms","BlueMarble-200405,esat","","1.3.0")};return n.prototype=Object.create(i.prototype),n}),i("layer/BMNGLayer",["../geom/Location","../geom/Sector","../layer/TiledImageLayer","../util/WmsUrlBuilder"],function(t,e,i,r){"use strict";var n=function(n){i.call(this,e.FULL_SPHERE,new t(45,45),5,"image/jpeg",n||"BMNG256",256,256),this.displayName="Blue Marble",this.pickEnabled=!1,this.urlBuilder=new r("https://worldwind25.arc.nasa.gov/wms",n||"BlueMarble-200405","","1.3.0")};return n.prototype=Object.create(i.prototype),n}),i("layer/RenderableLayer",["../error/ArgumentError","../layer/Layer","../util/Logger"],function(t,e,i){"use strict";var r=function(t){e.call(this,t),this.renderables=[]};return r.prototype=Object.create(e.prototype),r.prototype.addRenderable=function(e){if(!e)throw new t(i.logMessage(i.LEVEL_SEVERE,"RenderableLayer","addRenderable","missingRenderable"));this.renderables.push(e)},r.prototype.addRenderables=function(e){if(!e)throw new t(i.logMessage(i.LEVEL_SEVERE,"RenderableLayer","addRenderables","The renderables array is null or undefined."));for(var r=0,n=e.length;r<n;r++)this.addRenderable(e[r])},r.prototype.removeRenderable=function(t){var e=this.renderables.indexOf(t);e>=0&&this.renderables.splice(e,1)},r.prototype.removeAllRenderables=function(){this.renderables=[]},r.prototype.doRender=function(t){for(var e=t.orderedRenderables.length,r=0,n=this.renderables.length;r<n;r++)try{this.renderables[r].render(t)}catch(t){i.logMessage(i.LEVEL_SEVERE,"RenderableLayer","doRender","Error while rendering shape "+this.renderables[r].displayName+".\n"+t.toString())}t.orderedRenderables.length>e&&(this.inCurrentFrame=!0)},r}),i("render/SurfaceTile",["../error/ArgumentError","../util/Logger","../geom/Matrix","../geom/Sector","../error/UnsupportedOperationError"],function(t,e,i,r,n){"use strict";var o=function(i){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"SurfaceTile","constructor","missingSector"));this.sector=i};return o.prototype.bind=function(t){throw new n(e.logMessage(e.LEVEL_SEVERE,"SurfaceTile","bind","abstractInvocation"))},o.prototype.applyInternalTransform=function(t,i){throw new n(e.logMessage(e.LEVEL_SEVERE,"SurfaceTile","applyInternalTransform","abstractInvocation"))},o}),i("shapes/SurfaceImage",["../error/ArgumentError","../util/Logger","../pick/PickedObject","../render/SurfaceTile"],function(t,e,i,r){"use strict";var n=function(i,n){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"SurfaceImage","constructor","missingSector"));if(!n)throw new t(e.logMessage(e.LEVEL_SEVERE,"SurfaceImage","constructor","missingImage"));r.call(this,i),this.enabled=!0,this._imageSource=n,this.opacity=1,this.displayName="Surface Image",this.imageSourceWasUpdated=!0};return n.prototype=Object.create(r.prototype),Object.defineProperties(n.prototype,{imageSource:{get:function(){return this._imageSource},set:function(i){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"SurfaceImage","imageSource","missingImage"));this._imageSource=i,this.imageSourceWasUpdated=!0}}}),n.prototype.bind=function(t){var e=t.gpuResourceCache.resourceForKey(this._imageSource);return e&&!this.imageSourceWasUpdated?e.bind(t):(e=t.gpuResourceCache.retrieveTexture(t.currentGlContext,this._imageSource),this.imageSourceWasUpdated=!1,e?e.bind(t):void 0)},n.prototype.applyInternalTransform=function(t,e){},n.prototype.render=function(t){if(this.enabled&&t.terrain&&this.sector.overlaps(t.terrain.sector)){if(t.pickingMode&&(this.pickColor=t.uniquePickColor()),t.surfaceTileRenderer.renderTiles(t,[this],this.opacity*t.currentLayer.opacity),t.pickingMode){var e=new i(this.pickColor.clone(),this.pickDelegate?this.pickDelegate:this,null,this.layer,!1);t.resolvePick(e)}t.currentLayer.inCurrentFrame=!0}},n}),i("layer/BMNGOneImageLayer",["../layer/RenderableLayer","../geom/Sector","../shapes/SurfaceImage","../util/WWUtil"],function(t,e,i,r){"use strict";var n=function(){t.call(this,"Blue Marble Image");var r=new i(e.FULL_SPHERE,WorldWind.configuration.baseUrl+"images/BMNG_world.topo.bathy.200405.3.2048x1024.jpg");this.addRenderable(r),this.pickEnabled=!1,this.minActiveAltitude=3e6};return n.prototype=Object.create(t.prototype),n}),i("util/PeriodicTimeSequence",["../error/ArgumentError","../util/Logger"],function(t,e){"use strict";var i=function(r){if(!r)throw new t(e.logMessage(e.LEVEL_SEVERE,"PeriodicTimeSequence","constructor","missingString"));var n=r.split("/");if(3!==n.length)throw new t(e.logMessage(e.LEVEL_SEVERE,"PeriodicTimeSequence","constructor","The interval string "+r+" does not contain 3 elements."));this.sequenceString=r,this.startTime=new Date(n[0]),this.endTime=new Date(n[1]),this.intervalMilliseconds=this.endTime.getTime()-this.startTime.getTime(),this._currentTime=this.startTime,this.infiniteInterval=this.startTime.getTime()==this.endTime.getTime(),this.period=i.parsePeriodString(n[2],!1)};return Object.defineProperties(i.prototype,{currentTime:{get:function(){return this._currentTime},set:function(t){this._currentTime=t}},scaleForCurrentTime:{get:function(){return this.currentTime?(this.currentTime.getTime()-this.startTime.getTime())/this.intervalMilliseconds:1}}}),i.prototype.next=function(){return this.currentTime?this.currentTime.getTime()>=this.endTime.getTime()&&!this.infiniteInterval?this.currentTime=null:this.currentTime=i.incrementTime(this.currentTime,this.period):this.currentTime=this.startTime,this.currentTime},i.prototype.previous=function(){return this.currentTime?this.currentTime.getTime()===this.startTime.getTime()?this.currentTime=null:this.currentTime=this.getTimeForScale(.9999*this.scaleForCurrentTime):this.currentTime=this.endTime,this.currentTime},i.prototype.reset=function(){this.currentTime=null},i.prototype.getTimeForScale=function(t){if(t<=0)return this.startTime;if(t>=1)return this.endTime;var e=new Date(this.startTime.getTime()),r=e,n=0;for(n=0;n<t;n=(e.getTime()-this.startTime.getTime())/this.intervalMilliseconds)r=e,e=i.incrementTime(e,this.period);return r},i.incrementTime=function(t,e){var r=new Date(t.getTime());return 0!=e[0]&&r.setUTCFullYear(r.getUTCFullYear()+e[0]),0!=e[1]&&i.addMonths(r,e[1]),0!=e[2]&&r.setUTCDate(r.getUTCDate()+7*e[2]),0!=e[3]&&r.setUTCDate(r.getUTCDate()+e[3]),0!=e[4]&&r.setUTCHours(r.getUTCHours()+e[4]),0!=e[5]&&r.setUTCMinutes(r.getUTCMinutes()+e[5]),0!=e[6]&&r.setUTCSeconds(r.getUTCSeconds()+e[6]),r},i.isLeapYear=function(t){return t%4==0&&t%100!=0||t%400==0},i.getDaysInMonth=function(t,e){return[31,i.isLeapYear(t)?29:28,31,30,31,30,31,31,30,31,30,31][e]},i.addMonths=function(t,e){var r=t.getUTCDate();return t.setUTCDate(1),t.setUTCMonth(t.getUTCMonth()+e),t.setUTCDate(Math.min(r,i.getDaysInMonth(t.getUTCFullYear(),t.getUTCMonth()))),t},i.parsePeriodString=function(i,r){var n,o=r||!1,s=[2,3,4,5,7,8,9],a=[0,0,0,0,0,0,0],l=[0,12,4,7,24,60,60];if(!(i=i.toUpperCase().trim()))return a;if("string"!=typeof i)throw new t(e.logMessage(e.LEVEL_SEVERE,"PeriodicTimeSequence","parsePeriodString","Invalid ISO8601 period string '"+i+"'"));if(!(n=/^P((\d+Y)?(\d+M)?(\d+W)?(\d+D)?)?(T(\d+H)?(\d+M)?(\d+S)?)?$/.exec(i)))throw new t(e.logMessage(e.LEVEL_SEVERE,"PeriodicTimeSequence","parsePeriodString","String '"+i+"' is not a valid ISO8601 period."));for(var h=0;h<s.length;h++){var u=s[h];a[h]=n[u]?+n[u].replace(/[A-Za-z]+/g,""):0}if(o)for(h=a.length-1;h>0;h--)a[h]>=l[h]&&(a[h-1]=a[h-1]+Math.floor(a[h]/l[h]),a[h]=a[h]%l[h]);return a},i}),i("util/LevelRowColumnUrlBuilder",["../error/ArgumentError","../util/Logger","../util/WWUtil"],function(t,e,i){"use strict";var r=function(t,e){this.serverAddress=t,t&&0!==t.length||(this.serverAddress=i.currentUrlSansFilePart()),this.pathToData=e};return r.prototype.urlForTile=function(r,n){if(!r)throw new t(e.logMessage(e.LEVEL_SEVERE,"WmsUrlBuilder","urlForTile","missingTile"));if(!n)throw new t(e.logMessage(e.LEVEL_SEVERE,"WmsUrlBuilder","urlForTile","The image format is null or undefined."));var o=this.serverAddress;return this.pathToData&&(o=o+"/"+this.pathToData),o=o+"/"+r.level.levelNumber.toString(),o=o+"/"+r.row.toString(),o=o+"/"+r.row.toString()+"_"+r.column.toString(),o=o+"."+i.suffixForMimeType(n),o=o.replace(" ","%20")},r}),i("layer/RestTiledImageLayer",["../error/ArgumentError","../geom/Location","../util/Logger","../geom/Sector","../layer/TiledImageLayer","../util/LevelRowColumnUrlBuilder","../util/WWUtil"],function(t,e,i,r,n,o,s){"use strict";var a=function(t,i,a,l){var h=s.urlPath(t+"/"+i);n.call(this,l&&l.sector||r.FULL_SPHERE,l&&l.levelZeroTileDelta||new e(45,45),l&&l.numLevels||5,l&&l.imageFormat||"image/jpeg",h,l&&l.tileWidth||256,l&&l.tileHeight||256),this.displayName=a,this.pickEnabled=!1,this.urlBuilder=new o(t,i)};return a.prototype=Object.create(n.prototype),a}),i("layer/BMNGRestLayer",["../error/ArgumentError","../layer/Layer","../util/Logger","../util/PeriodicTimeSequence","../layer/RestTiledImageLayer"],function(t,e,i,r,n){"use strict";var o=function(t,i,n,s){e.call(this,n||"Blue Marble time series"),this.time=s||new Date("2004-01"),this.timeSequence=new r("2004-01-01/2004-12-01/P1M"),this.serverAddress=t,this.pathToData=i,this.layers={},this.layerNames=[{month:"BlueMarble-200401",time:o.availableTimes[0]},{month:"BlueMarble-200402",time:o.availableTimes[1]},{month:"BlueMarble-200403",time:o.availableTimes[2]},{month:"BlueMarble-200404",time:o.availableTimes[3]},{month:"BlueMarble-200405",time:o.availableTimes[4]},{month:"BlueMarble-200406",time:o.availableTimes[5]},{month:"BlueMarble-200407",time:o.availableTimes[6]},{month:"BlueMarble-200408",time:o.availableTimes[7]},{month:"BlueMarble-200409",time:o.availableTimes[8]},{month:"BlueMarble-200410",time:o.availableTimes[9]},{month:"BlueMarble-200411",time:o.availableTimes[10]},{month:"BlueMarble-200412",time:o.availableTimes[11]}],this.pickEnabled=!1};return o.prototype=Object.create(e.prototype),o.availableTimes=[new Date("2004-01"),new Date("2004-02"),new Date("2004-03"),new Date("2004-04"),new Date("2004-05"),new Date("2004-06"),new Date("2004-07"),new Date("2004-08"),new Date("2004-09"),new Date("2004-10"),new Date("2004-11"),new Date("2004-12")],o.prototype.prePopulate=function(e){if(!e)throw new t(i.logMessage(i.LEVEL_SEVERE,"BMNGRestLayer","prePopulate","missingWorldWindow"));for(var r=0;r<this.layerNames.length;r++){var n=this.layerNames[r].month;this.layers[n]||this.createSubLayer(n),this.layers[n].prePopulate(e)}},o.prototype.isPrePopulated=function(t){for(var e=0;e<this.layerNames.length;e++){var i=this.layers[this.layerNames[e].month];if(!i||!i.isPrePopulated(t))return!1}return!0},o.prototype.doRender=function(t){var e=this.nearestLayer(this.time);e.opacity=this.opacity,this.detailControl&&(e.detailControl=this.detailControl),e.doRender(t),this.inCurrentFrame=e.inCurrentFrame},o.prototype.nearestLayer=function(t){var e=this.nearestLayerName(t);return this.layers[e]||this.createSubLayer(e),this.layers[e]},o.prototype.createSubLayer=function(t){var e="";e=this.pathToData?this.pathToData+"/"+t:t,this.layers[t]=new n(this.serverAddress,e,this.displayName)},o.prototype.nearestLayerName=function(t){var e=t.getTime();if(e<=this.layerNames[0].time.getTime())return this.layerNames[0].month;if(e>=this.layerNames[11].time.getTime())return this.layerNames[11].month;for(var i=0;i<this.layerNames.length-1;i++){var r=this.layerNames[i].time.getTime(),n=this.layerNames[i+1].time.getTime();if(e>=r&&e<=n){return e-r<n-e?this.layerNames[i].month:this.layerNames[i+1].month}}},o}),i("gesture/Touch",[],function(){"use strict";var t=function(t,e,i){this.identifier=t,this._clientX=e,this._clientY=i,this._clientStartX=e,this._clientStartY=i};return Object.defineProperties(t.prototype,{clientX:{get:function(){return this._clientX},set:function(t){this._clientX=t}},clientY:{get:function(){return this._clientY},set:function(t){this._clientY=t}},translationX:{get:function(){return this._clientX-this._clientStartX},set:function(t){this._clientStartX=this._clientX-t}},translationY:{get:function(){return this._clientY-this._clientStartY},set:function(t){this._clientStartY=this._clientY-t}}}),t}),i("gesture/GestureRecognizer",["../error/ArgumentError","../util/Logger","../gesture/Touch"],function(t,e,i){"use strict";var r=function(i,n){function o(t){s.handleEvent(t)}if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"GestureRecognizer","constructor","missingTarget"));this.target=i,this.enabled=!0,this._state=WorldWind.POSSIBLE,this._nextState=null,this._clientX=0,this._clientY=0,this._clientStartX=0,this._clientStartY=0,this._translationX=0,this._translationY=0,this._translationWeight=.4,this._mouseButtonMask=0,this._touches=[],this._touchCentroidShiftX=0,this._touchCentroidShiftY=0,this._gestureCallbacks=[],this._canRecognizeWith=[],this._requiresFailureOf=[],this._requiredToFailBy=[],n&&this._gestureCallbacks.push(n),r.allRecognizers.push(this);var s=this;window.PointerEvent?(i.addEventListener("pointerdown",o,!1),window.addEventListener("pointermove",o,!1),window.addEventListener("pointercancel",o,!1),window.addEventListener("pointerup",o,!1)):(i.addEventListener("mousedown",o,!1),window.addEventListener("mousemove",o,!1),window.addEventListener("mouseup",o,!1),i.addEventListener("touchstart",o,!1),i.addEventListener("touchmove",o,!1),i.addEventListener("touchend",o,!1),i.addEventListener("touchcancel",o,!1))};return r.allRecognizers=[],Object.defineProperties(r.prototype,{state:{get:function(){return this._state},set:function(t){this.transitionToState(t)}},clientX:{get:function(){return this._clientX},set:function(t){this._clientX=t}},clientY:{get:function(){return this._clientY},set:function(t){this._clientY=t}},translationX:{get:function(){return this._translationX},set:function(t){this._translationX=t,this._clientStartX=this._clientX,this._touchCentroidShiftX=0}},translationY:{get:function(){return this._translationY},set:function(t){this._translationY=t,this._clientStartY=this._clientY,this._touchCentroidShiftY=0}},mouseButtonMask:{get:function(){return this._mouseButtonMask}},touchCount:{get:function(){return this._touches.length}},gestureCallbacks:{get:function(){return this._gestureCallbacks}}}),r.prototype.touch=function(i){if(i<0||i>=this._touches.length)throw new t(e.logMessage(e.LEVEL_SEVERE,"GestureRecognizer","touch","indexOutOfRange"));return this._touches[i]},r.prototype.recognizeSimultaneouslyWith=function(i){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"GestureRecognizer","recognizeSimultaneouslyWith","The specified gesture recognizer is null or undefined."));-1==this._canRecognizeWith.indexOf(i)&&(this._canRecognizeWith.push(i),i._canRecognizeWith.push(this))},r.prototype.canRecognizeSimultaneouslyWith=function(t){return-1!=this._canRecognizeWith.indexOf(t)},r.prototype.requireRecognizerToFail=function(i){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"GestureRecognizer","requireRecognizerToFail","The specified gesture recognizer is null or undefined"));-1==this._requiresFailureOf.indexOf(i)&&(this._requiresFailureOf.push(i),i._requiredToFailBy.push(this))},r.prototype.requiresRecognizerToFail=function(t){return-1!=this._requiresFailureOf.indexOf(t)},r.prototype.requiredToFailByRecognizer=function(t){return-1!=this._requiredToFailBy.indexOf(t)},r.prototype.reset=function(){this._state=WorldWind.POSSIBLE,this._nextState=null,this._clientX=0,this._clientY=0,this._clientStartX=0,this._clientStartY=0,this._translationX=0,this._translationY=0,this._mouseButtonMask=0,this._touches=[],this._touchCentroidShiftX=0,this._touchCentroidShiftY=0},r.prototype.prepareToRecognize=function(){},r.prototype.mouseDown=function(t){},r.prototype.mouseMove=function(t){},r.prototype.mouseUp=function(t){},r.prototype.touchStart=function(t){},r.prototype.touchMove=function(t){},r.prototype.touchCancel=function(t){},r.prototype.touchEnd=function(t){},r.prototype.transitionToState=function(t){this._nextState=null,t==WorldWind.FAILED?(this._state=t,this.updateRecognizersWaitingForFailure(),this.resetIfEventsEnded()):t==WorldWind.RECOGNIZED?(this.tryToRecognize(t),this._state==t&&(this.prepareToRecognize(),this.callGestureCallbacks(),this.resetIfEventsEnded())):t==WorldWind.BEGAN?(this.tryToRecognize(t),this._state==t&&(this.prepareToRecognize(),this.callGestureCallbacks())):t==WorldWind.CHANGED?(this._state=t,this.callGestureCallbacks()):t==WorldWind.CANCELLED?(this._state=t,this.callGestureCallbacks(),this.resetIfEventsEnded()):t==WorldWind.ENDED&&(this._state=t,this.callGestureCallbacks(),this.resetIfEventsEnded())},r.prototype.updateRecognizersWaitingForFailure=function(){for(var t=0,e=this._requiredToFailBy.length;t<e;t++){var i=this._requiredToFailBy[t];null!=i._nextState&&i.transitionToState(i._nextState)}},r.prototype.tryToRecognize=function(t){if(r.allRecognizers.some(this.canBePreventedByRecognizer,this))return void this.transitionToState(WorldWind.FAILED);if(r.allRecognizers.some(this.isWaitingForRecognizerToFail,this))return void(this._nextState=t);for(var e=r.allRecognizers.filter(this.canPreventRecognizer,this),i=0,n=e.length;i<n;i++)e[i].transitionToState(WorldWind.FAILED);this._state=t},r.prototype.canPreventRecognizer=function(t){return this!=t&&this.target==t.target&&t.state==WorldWind.POSSIBLE&&(this.requiredToFailByRecognizer(t)||!this.canRecognizeSimultaneouslyWith(t))},r.prototype.canBePreventedByRecognizer=function(t){return this!=t&&this.target==t.target&&t.state==WorldWind.RECOGNIZED&&(this.requiresRecognizerToFail(t)||!this.canRecognizeSimultaneouslyWith(t))},r.prototype.isWaitingForRecognizerToFail=function(t){return this!=t&&this.target==t.target&&t.state==WorldWind.POSSIBLE&&this.requiresRecognizerToFail(t)},r.prototype.callGestureCallbacks=function(){for(var t=0,e=this._gestureCallbacks.length;t<e;t++)this._gestureCallbacks[t](this)},r.prototype.handleEvent=function(t){if(this.enabled&&(!t.defaultPrevented||this.state!=WorldWind.POSSIBLE)){var i,r;try{if("mousedown"==t.type)this.handleMouseDown(t);else if("mousemove"==t.type)this.handleMouseMove(t);else if("mouseup"==t.type)this.handleMouseUp(t);else if("touchstart"==t.type)for(i=0,r=t.changedTouches.length;i<r;i++)this.handleTouchStart(t.changedTouches.item(i));else if("touchmove"==t.type)for(i=0,r=t.changedTouches.length;i<r;i++)this.handleTouchMove(t.changedTouches.item(i));else if("touchcancel"==t.type)for(i=0,r=t.changedTouches.length;i<r;i++)this.handleTouchCancel(t.changedTouches.item(i));else if("touchend"==t.type)for(i=0,r=t.changedTouches.length;i<r;i++)this.handleTouchEnd(t.changedTouches.item(i));else"pointerdown"==t.type&&"mouse"==t.pointerType?this.handleMouseDown(t):"pointermove"==t.type&&"mouse"==t.pointerType?this.handleMouseMove(t):"pointercancel"==t.type&&"mouse"==t.pointerType||("pointerup"==t.type&&"mouse"==t.pointerType?this.handleMouseUp(t):"pointerdown"==t.type&&"touch"==t.pointerType?this.handleTouchStart(t):"pointermove"==t.type&&"touch"==t.pointerType?this.handleTouchMove(t):"pointercancel"==t.type&&"touch"==t.pointerType?this.handleTouchCancel(t):"pointerup"==t.type&&"touch"==t.pointerType?this.handleTouchEnd(t):e.logMessage(e.LEVEL_INFO,"GestureRecognizer","handleEvent","Unrecognized event type: "+t.type))}catch(t){e.logMessage(e.LEVEL_SEVERE,"GestureRecognizer","handleEvent","Error handling event.\n"+t.toString())}}},r.prototype.handleMouseDown=function(t){if(!("mousedown"==t.type&&this._touches.length>0)){var e=1<<t.button;e&0!=this._mouseButtonMask||(0==this._mouseButtonMask&&(this._clientX=t.clientX,this._clientY=t.clientY,this._clientStartX=t.clientX,this._clientStartY=t.clientY,this._translationX=0,this._translationY=0),this._mouseButtonMask|=e,this.mouseDown(t))}},r.prototype.handleMouseMove=function(t){if(0!=this._mouseButtonMask&&(this._clientX!=t.clientX||this._clientY!=t._clientY)){var e=t.clientX-this._clientStartX,i=t.clientY-this._clientStartY,r=this._translationWeight;this._clientX=t.clientX,this._clientY=t.clientY,this._translationX=this._translationX*(1-r)+e*r,this._translationY=this._translationY*(1-r)+i*r,this.mouseMove(t)}},r.prototype.handleMouseUp=function(t){var e=1<<t.button;e&0==this._mouseButtonMask||(this._mouseButtonMask&=~e,this.mouseUp(t),0==this._mouseButtonMask&&this.resetIfEventsEnded())},r.prototype.handleTouchStart=function(t){var e=new i(t.identifier||t.pointerId,t.clientX,t.clientY);this._touches.push(e),1==this._touches.length?(this._clientX=t.clientX,this._clientY=t.clientY,this._clientStartX=t.clientX,this._clientStartY=t.clientY,this._translationX=0,this._translationY=0,this._touchCentroidShiftX=0,this._touchCentroidShiftY=0):this.touchesAddedOrRemoved(),this.touchStart(e)},r.prototype.handleTouchMove=function(t){var e=this.indexOfTouchWithId(t.identifier||t.pointerId);if(-1!=e){var i=this._touches[e];if(i.clientX!=t.clientX||i.clientY!=t.clientY){i.clientX=t.clientX,i.clientY=t.clientY;var r=this.touchCentroid(),n=r.clientX-this._clientStartX+this._touchCentroidShiftX,o=r.clientY-this._clientStartY+this._touchCentroidShiftY,s=this._translationWeight;this._clientX=r.clientX,this._clientY=r.clientY,this._translationX=this._translationX*(1-s)+n*s,this._translationY=this._translationY*(1-s)+o*s,this.touchMove(i)}}},r.prototype.handleTouchCancel=function(t){var e=this.indexOfTouchWithId(t.identifier||t.pointerId);if(-1!=e){var i=this._touches[e];this._touches.splice(e,1),this.touchesAddedOrRemoved(),this.touchCancel(i),this.resetIfEventsEnded()}},r.prototype.handleTouchEnd=function(t){var e=this.indexOfTouchWithId(t.identifier||t.pointerId);if(-1!=e){var i=this._touches[e];this._touches.splice(e,1),this.touchesAddedOrRemoved(),this.touchEnd(i),this.resetIfEventsEnded()}},r.prototype.resetIfEventsEnded=function(){this._state!=WorldWind.POSSIBLE&&0==this._mouseButtonMask&&0==this._touches.length&&this.reset()},r.prototype.touchesAddedOrRemoved=function(){this._touchCentroidShiftX+=this._clientX,this._touchCentroidShiftY+=this._clientY;var t=this.touchCentroid();this._clientX=t.clientX,this._clientY=t.clientY,this._touchCentroidShiftX-=this._clientX,this._touchCentroidShiftY-=this._clientY},r.prototype.touchCentroid=function(){for(var t=0,e=0,i=0,r=this._touches.length;i<r;i++){var n=this._touches[i];t+=n.clientX/r,e+=n.clientY/r}return{clientX:t,clientY:e}},r.prototype.indexOfTouchWithId=function(t){for(var e=0,i=this._touches.length;e<i;e++)if(this._touches[e].identifier==t)return e;return-1},r}),i("gesture/ClickRecognizer",["../gesture/GestureRecognizer"],function(t){"use strict";var e=function(e,i){t.call(this,e,i),this.numberOfClicks=1,this.button=0,this.maxMouseMovement=5,this.maxClickDuration=500,this.maxClickInterval=400,this.clicks=[],this.timeout=null};return e.prototype=Object.create(t.prototype),e.prototype.reset=function(){t.prototype.reset.call(this),this.clicks=[],this.cancelFailAfterDelay()},e.prototype.mouseDown=function(t){if(this.state==WorldWind.POSSIBLE)if(this.button!=t.button)this.state=WorldWind.FAILED;else{var e={clientX:this.clientX,clientY:this.clientY};this.clicks.push(e),this.failAfterDelay(this.maxClickDuration)}},e.prototype.mouseMove=function(t){if(this.state==WorldWind.POSSIBLE){var e=this.translationX,i=this.translationY;Math.sqrt(e*e+i*i)>this.maxMouseMovement&&(this.state=WorldWind.FAILED)}},e.prototype.mouseUp=function(t){if(this.state==WorldWind.POSSIBLE&&0==this.mouseButtonMask){this.clicks.length==this.numberOfClicks?(this.clientX=this.clicks[0].clientX,this.clientY=this.clicks[0].clientY,this.state=WorldWind.RECOGNIZED):this.failAfterDelay(this.maxClickInterval)}},e.prototype.touchStart=function(t){this.state==WorldWind.POSSIBLE&&(this.state=WorldWind.FAILED)},e.prototype.failAfterDelay=function(t){var e=this;e.timeout&&window.clearTimeout(e.timeout),e.timeout=window.setTimeout(function(){e.timeout=null,e.state==WorldWind.POSSIBLE&&(e.state=WorldWind.FAILED)},t)},e.prototype.cancelFailAfterDelay=function(){var t=this;t.timeout&&(window.clearTimeout(t.timeout),t.timeout=null)},e}),i("formats/collada/ColladaAsset",[],function(){"use strict";var t=function(t){this.xmlAsset=t.getElementsByTagName("asset")[0],this.asset={daeVersion:t.querySelector("COLLADA").getAttribute("version")}};return t.prototype.parse=function(){if(!this.xmlAsset)return null;for(var t=0;t<this.xmlAsset.childNodes.length;t++){var e=this.xmlAsset.childNodes.item(t);if(1===e.nodeType)switch(e.nodeName){case"contributor":var i=e.querySelector("authoring_tool");i&&(this.asset.authoring_tool=i.textContext);break;case"unit":this.asset.unit=e.getAttribute("meter");break;default:this.asset[e.localName]=e.textContent}}return this.xmlAsset=null,this.asset},t}),i("formats/collada/ColladaUtils",["../../util/Logger"],function(t){"use strict";return{getRawValues:function(t){if(!t)return null;var e=t.textContent;return e=e.replace(/\n/gi," "),e=e.replace(/\s+/gi," "),e=e.trim(),0===e.length?null:e.split(" ")},bufferDataFloat32:function(t){var e=this.getRawValues(t);if(!e)return null;for(var i=e.length,r=new Float32Array(i),n=0;n<i;n++)r[n]=parseFloat(e[n]);return r},bufferDataUInt32:function(t){var e=this.getRawValues(t);if(!e)return null;for(var i=e.length,r=new Uint32Array(i),n=0;n<i;n++)r[n]=parseInt(e[n]);return r},getFirstChildElement:function(t,e){for(var i=t.childNodes,r=0;r<i.length;++r){var n=i.item(r);if(1===n.nodeType&&(n.nodeName&&!e||e&&e===n.nodeName))return n}return null},getFilename:function(t){var e=t.lastIndexOf("\\");return-1!==e&&(t=t.substr(e+1)),e=t.lastIndexOf("/"),-1!==e&&(t=t.substr(e+1)),t},replaceSpace:function(t){return t?t.replace(/ /g,"_"):""},querySelectorById:function(t,e){for(var i=0;i<t.length;i++){var r=t.item(i).getAttribute("id");if(r&&r.toString()===e)return t.item(i)}return null},getTextureType:function(t){for(var e=!0,i=0,r=t.length;i<r;i++)if(t[i]<0||t[i]>1){e=!1;break}return e},fetchFile:function(e,i){var r=new XMLHttpRequest;r.onload=function(){this.status>=200&&this.status<400?i(this.response):(t.log(t.LEVEL_SEVERE,"sever error: "+this.status),i(null))},r.onerror=function(e){t.log(t.LEVEL_SEVERE,"connection error: "+e),i(null)},r.open("get",e,!0),r.send()}}}),i("formats/collada/ColladaImage",["./ColladaUtils"],function(t){"use strict";var e=function(t,e){this.filename="",this.map=t,this.name=e,this.path=""};return e.prototype.parse=function(e){for(var i=0;i<e.childNodes.length;i++){var r=e.childNodes[i];if(1===r.nodeType)switch(r.nodeName){case"init_from":this.filename=t.getFilename(r.textContent),this.path=r.textContent}}return this},e}),i("formats/collada/ColladaMaterial",["./ColladaUtils"],function(t){"use strict";var e=function(t){this.id=t,this.newParams=[]};return e.prototype.parse=function(t){for(var e=0;e<t.childNodes.length;e++){var i=t.childNodes[e];if(1===i.nodeType)switch(i.nodeName){case"profile_COMMON":this.parseProfileCommon(i)}}return this},e.prototype.parseProfileCommon=function(t){for(var e=0;e<t.childNodes.length;e++){var i=t.childNodes[e];if(1===i.nodeType)switch(i.nodeName){case"newparam":this.parseNewparam(i);break;case"image":break;case"technique":this.parseTechnique(i)}}},e.prototype.parseNewparam=function(t){for(var e=t.getAttribute("sid"),i=0;i<t.childNodes.length;i++){var r=t.childNodes[i];if(1===r.nodeType)switch(r.nodeName){case"surface":var n=r.querySelector("init_from");n&&this.newParams.push({sid:e,type:"surface",initFrom:n.textContent});break;case"sampler2D":var o=r.querySelector("source");this.newParams.push({sid:e,type:"sampler2D",source:o.textContent})}}},e.prototype.parseTechnique=function(t){for(var e=0;e<t.childNodes.length;e++){var i=t.childNodes[e];if(1===i.nodeType)switch(i.nodeName){case"constant":case"lambert":case"blinn":case"phong":this.techniqueType=i.nodeName,this.parseTechniqueType(i)}}},e.prototype.parseTechniqueType=function(e){for(var i=0;i<e.childNodes.length;i++){var r=e.childNodes[i];if(1===r.nodeType&&r.nodeName){var n=r.nodeName,o=t.getFirstChildElement(r);if(o)switch(o.nodeName){case"color":this[n]=t.bufferDataFloat32(o).subarray(0,4);break;case"float":this[n]=t.bufferDataFloat32(o)[0];break;case"texture":var s=o.getAttribute("texture"),a=this.newParams.map(function(t){return t.sid}).indexOf(s),l=this.newParams[a].source;a=this.newParams.map(function(t){return t.sid}).indexOf(l);var h=this.newParams[a].initFrom;this.textures||(this.textures={}),this.textures[n]={mapId:h}}}}},e}),i("formats/collada/ColladaMesh",["./ColladaUtils"],function(t){"use strict";var e=function(t){this.filename=t||"",this.name=t||"",this.buffers=[]};return e.prototype.parse=function(e){for(var i={},r={},n={id:"",inputs:[]},o=0;o<e.childNodes.length;o++){var s=e.childNodes[o];if(1===s.nodeType)switch(s.nodeName){case"source":if(!s.querySelector)continue;var a=s.querySelector("float_array");if(!a)continue;var l=t.bufferDataFloat32(a),h=s.querySelector("accessor"),u=parseInt(h.getAttribute("stride"));i[s.getAttribute("id")]={stride:u,data:l};break;case"vertices":this.parseVertices(s,n);break;case"triangles":r=this.parsePolygons(s,i,n,3),this.buffers.push(r);break;case"polygons":r=this.parsePolygons(s,i,n,4),this.buffers.push(r);break;case"polylist":r=this.parsePolygons(s,i,n,null),this.buffers.push(r)}}return this},
e.prototype.parseVertices=function(t,e){e.id=t.getAttribute("id");for(var i=t.querySelectorAll("input"),r=0;r<i.length;r++){var n=i[r],o=n.getAttribute("source").substr(1),s=n.getAttribute("semantic").toUpperCase();e.inputs.push({semantic:s,source:o})}},e.prototype.parsePolygons=function(t,e,i,r){var n=[];if(null==r){n=t.querySelector("vcount").textContent.trim().split(" ")}var o=parseInt(t.getAttribute("count")),s=t.getAttribute("material"),a=this.parseInputs(t,e,i),l=a.inputs,h=a.maxOffset,u=t.querySelector("p"),c=[];u&&(c=u.textContent.trim().split(" "));for(var d=l.length,p=0,f={},g=[],m=0,E=!1,y=0;y<o;y++){if(n.length)var _=parseInt(n[y]);else _=r;for(var v=-1,S=-1,b=-1,T=0;T<_;T++){var L=c.slice(m,m+h).join(" ");if(b=S,f.hasOwnProperty(L))S=f[L],E=!0;else{for(var w=0;w<d;w++){var R=l[w],x=R[4],M=parseInt(c[m+x]),C=R[1],A=R[3];M*=R[2];for(var P=0;P<R[2];P++)C.push(A[M+P])}S=p,p+=1,f[L]=S}_>3&&(0===T&&(v=S),T>2*h&&(g.push(v),g.push(b))),g.push(S),m+=h}}var I={vertices:new Float32Array(l[0][1]),indexedRendering:E,material:s};return this.transformMeshInfo(I,l,g),I},e.prototype.parseInputs=function(t,e,i){for(var r=[],n=0,o=t.querySelectorAll("input"),s=0;s<o.length;s++){var a=o.item(s);if(a.getAttribute){var l=a.getAttribute("semantic").toUpperCase(),h=a.getAttribute("source").substr(1),u=parseInt(a.getAttribute("offset"));n=n<u+1?u+1:n;var c=0;if(a.getAttribute("set")&&(c=parseInt(a.getAttribute("set"))),i.id===h)for(var d=i.inputs,p=0;p<d.length;p++){var f=e[d[p].source];f&&r.push([d[p].semantic,[],f.stride,f.data,u,c])}else f=e[h],r.push([l,[],f.stride,f.data,u,c])}}return{inputs:r,maxOffset:n}},e.prototype.transformMeshInfo=function(e,i,r){for(var n={normal:"normals",texcoord:"uvs"},o=1;o<i.length;o++){var s=i[o][0].toLowerCase(),a=i[o][1];a.length&&(n[s]&&(s=n[s]),e[s]&&(s+=i[o][5]),e[s]=new Float32Array(a),"uvs"===s&&(e.isClamp=t.getTextureType(a)))}return e.indexedRendering&&(e.indices=new Uint16Array(r)),e},e}),i("formats/collada/ColladaNode",["./ColladaUtils","../../geom/Matrix","../../geom/Vec3"],function(t,e,i){"use strict";var r=function(){this.id="",this.name="",this.sid="",this.children=[],this.materials=[],this.mesh="",this.localMatrix=e.fromIdentity(),this.worldMatrix=e.fromIdentity()};return r.prototype.parse=function(t,i,n){this.id=t.getAttribute("id"),this.sid=t.getAttribute("sid"),this.name=t.getAttribute("name"),this.children=[],this.materials=[],this.mesh="",this.localMatrix=e.fromIdentity(),this.worldMatrix=e.fromIdentity(),this.setNodeTransforms(t,n);for(var o=0;o<t.childNodes.length;o++){var s=t.childNodes[o];if(1===s.nodeType)switch(s.nodeName){case"node":this.children.push((new r).parse(s,i,this.worldMatrix));break;case"instance_geometry":this.mesh=s.getAttribute("url").substr(1);for(var a=s.querySelectorAll("instance_material"),l=0;l<a.length;l++){var h=a.item(l);this.materials.push({id:h.getAttribute("target").substr(1),symbol:h.getAttribute("symbol")})}break;case"instance_node":var u=s.getAttribute("url").substr(1),c=this.getLibraryNode(i,u);c&&this.children.push((new r).parse(c,i,this.worldMatrix))}}return this},r.prototype.setNodeTransforms=function(r,n){var o=e.fromIdentity(),s=e.fromIdentity(),a=e.fromIdentity(),l=e.fromIdentity();n||(n=e.fromIdentity());for(var h=[],u=0;u<r.childNodes.length;u++){var c=r.childNodes[u];if(1===c.nodeType)switch(c.nodeName){case"matrix":var d=t.bufferDataFloat32(c);o.copy(d),h.push(o);break;case"rotate":d=t.bufferDataFloat32(c),s.multiplyByRotation(d[0],d[1],d[2],d[3]),h.push(s);break;case"translate":d=t.bufferDataFloat32(c),a.multiplyByTranslation(d[0],d[1],d[2]),h.push(a);break;case"scale":d=t.bufferDataFloat32(c),l.multiplyByScale(d[0],d[1],d[2]),h.push(l)}}for(u=0;u<h.length;u++)this.localMatrix.multiplyMatrix(h[u]);this.worldMatrix.setToMultiply(n,this.localMatrix),this.normalMatrix=e.fromIdentity();var p=new i(0,0,0);this.worldMatrix.extractRotationAngles(p),this.normalMatrix.multiplyByRotation(-1,0,0,p[0]),this.normalMatrix.multiplyByRotation(0,-1,0,p[1]),this.normalMatrix.multiplyByRotation(0,0,-1,p[2])},r.prototype.getLibraryNode=function(t,e){for(var i=0;i<t.length;i++){var r=t[i].attributes.getNamedItem("id");if(r&&r.value===e)return t[i]}return null},r}),i("formats/collada/ColladaScene",["../../error/ArgumentError","../../shaders/BasicTextureProgram","../../util/Color","../../util/Logger","../../geom/Matrix","../../geom/Position","../../pick/PickedObject","../../render/Renderable","../../geom/Vec3"],function(t,e,i,r,n,o,s,a,l){"use strict";var h=function(e,i){if(!e)throw new t(r.logMessage(r.LEVEL_SEVERE,"ColladaScene","constructor","missingPosition"));a.call(this),this._position=e,this._nodes=[],this._meshes={},this._materials={},this._images={},this._upAxis="",this._dirPath="",this._xRotation=0,this._yRotation=0,this._zRotation=0,this._xTranslation=0,this._yTranslation=0,this._zTranslation=0,this._scale=1,this._altitudeMode=WorldWind.ABSOLUTE,this._localTransforms=!0,this._useTexturePaths=!0,this._nodesToHide=[],this._hideNodes=!1,this.setSceneData(i),this._placePoint=new l(0,0,0),this._transformationMatrix=n.fromIdentity(),this._normalMatrix=n.fromIdentity(),this._texCoordMatrix=n.fromIdentity().setToUnitYFlip(),this._activeTexture=null};return h.prototype=Object.create(a.prototype),h.prototype.constructor=h,Object.defineProperties(h.prototype,{position:{get:function(){return this._position},set:function(t){this._position=t}},nodes:{get:function(){return this._nodes},set:function(t){this._nodes=t}},meshes:{get:function(){return this._meshes},set:function(t){this._meshes=t}},materials:{get:function(){return this._materials},set:function(t){this._materials=t}},images:{get:function(){return this._images},set:function(t){this._images=t}},upAxis:{get:function(){return this._upAxis},set:function(t){this._upAxis=t}},dirPath:{get:function(){return this._dirPath},set:function(t){this._dirPath=t}},xRotation:{get:function(){return this._xRotation},set:function(t){this._xRotation=t}},yRotation:{get:function(){return this._yRotation},set:function(t){this._yRotation=t}},zRotation:{get:function(){return this._zRotation},set:function(t){this._zRotation=t}},xTranslation:{get:function(){return this._xTranslation},set:function(t){this._xTranslation=t}},yTranslation:{get:function(){return this._yTranslation},set:function(t){this._yTranslation=t}},zTranslation:{get:function(){return this._zTranslation},set:function(t){this._zTranslation=t}},scale:{get:function(){return this._scale},set:function(t){this._scale=t}},placePoint:{get:function(){return this._placePoint},set:function(t){this._placePoint=t}},altitudeMode:{get:function(){return this._altitudeMode},set:function(t){this._altitudeMode=t}},transformationMatrix:{get:function(){return this._transformationMatrix},set:function(t){this._transformationMatrix=t}},normalMatrix:{get:function(){return this._normalMatrix},set:function(t){this._normalMatrix=t}},localTransforms:{get:function(){return this._localTransforms},set:function(t){this._localTransforms=t}},useTexturePaths:{get:function(){return this._useTexturePaths},set:function(t){this._useTexturePaths=t}},nodesToHide:{get:function(){return this._nodesToHide},set:function(t){this._nodesToHide=t}},hideNodes:{get:function(){return this._hideNodes},set:function(t){this._hideNodes=t}}}),h.prototype.setSceneData=function(t){t&&(this.nodes=t.root.children,this.meshes=t.meshes,this.materials=t.materials,this.images=t.images,this.upAxis=t.metadata.up_axis,this.dirPath=t.dirPath)},h.prototype.render=function(t){var e;this.enabled&&(this.lastFrameTime!==t.timestamp&&(e=this.makeOrderedRenderable(t)),e&&(e.layer=t.currentLayer,this.lastFrameTime=t.timestamp,t.addOrderedRenderable(e)))},h.prototype.makeOrderedRenderable=function(t){return t.surfacePointForMode(this.position.latitude,this.position.longitude,this.position.altitude,this.altitudeMode,this.placePoint),this.eyeDistance=t.navigatorState.eyePoint.distanceTo(this.placePoint),this},h.prototype.renderOrdered=function(t){if(this.drawOrderedScene(t),t.pickingMode){var e=new s(this.pickColor.clone(),this,this.position,this.layer,!1);t.resolvePick(e)}},h.prototype.drawOrderedScene=function(t){this.beginDrawing(t);try{this.doDrawOrderedScene(t)}finally{this.endDrawing(t)}},h.prototype.beginDrawing=function(t){var i=t.currentGlContext;t.findAndBindProgram(e),i.enable(i.CULL_FACE),i.enable(i.DEPTH_TEST)},h.prototype.doDrawOrderedScene=function(t){t.pickingMode&&(this.pickColor=t.uniquePickColor()),this.computeTransformationMatrix(t.globe);for(var e=0,i=this.nodes.length;e<i;e++)this.traverseNodeTree(t,this.nodes[e])},h.prototype.traverseNodeTree=function(t,e){if(this.mustRenderNode(e.id)){if(e.mesh)for(var i=e.mesh,r=this.meshes[i].buffers,n=0,o=r.length;n<o;n++){for(var s=r[n].material,a=0;a<e.materials.length;a++)if(s===e.materials[a].symbol){var l=e.materials[a].id;break}var h=this.materials[l];this.draw(t,r[n],h,e.worldMatrix,e.normalMatrix)}for(var u=0;u<e.children.length;u++)this.traverseNodeTree(t,e.children[u])}},h.prototype.draw=function(t,e,i,r,n){var o=t.currentGlContext,s=t.currentProgram;this.applyVertices(t,e),s.loadTextureEnabled(o,!1),this.applyColor(t,i);var a=i&&null!=i.textures&&e.uvs&&e.uvs.length>0;a&&this.applyTexture(t,e,i);var l=null!=e.normals&&e.normals.length>0;l&&!t.pickingMode&&this.applyLighting(t,e),this.applyMatrix(t,l,a,r,n),e.indexedRendering?(this.applyIndices(t,e),o.drawElements(o.TRIANGLES,e.indices.length,o.UNSIGNED_SHORT,0)):o.drawArrays(o.TRIANGLES,0,Math.floor(e.vertices.length/3)),this.resetDraw(t,l,a)},h.prototype.applyVertices=function(t,e){var i,r=t.currentGlContext,n=t.currentProgram;e.verticesVboCacheKey||(e.verticesVboCacheKey=t.gpuResourceCache.generateCacheKey()),i=t.gpuResourceCache.resourceForKey(e.verticesVboCacheKey),i||(i=r.createBuffer(),t.gpuResourceCache.putResource(e.verticesVboCacheKey,i,e.vertices.length),e.refreshVertexBuffer=!0),r.bindBuffer(r.ARRAY_BUFFER,i),e.refreshVertexBuffer&&(r.bufferData(r.ARRAY_BUFFER,e.vertices,r.STATIC_DRAW),t.frameStatistics.incrementVboLoadCount(1),e.refreshVertexBuffer=!1),r.enableVertexAttribArray(n.vertexPointLocation),r.vertexAttribPointer(n.vertexPointLocation,3,r.FLOAT,!1,0,0)},h.prototype.applyColor=function(t,e){var r=t.currentGlContext,n=t.currentProgram;if(e)if("constant"===e.techniqueType)var o=e.reflective;else o=e.diffuse;var s,a=1,l=1,h=1,u=1;o&&(a=o[0],l=o[1],h=o[2],u=null!=o[3]?o[3]:1);var c=new i(a,l,h,u);s=u*t.currentLayer.opacity,r.depthMask(s>=1||t.pickingMode),n.loadColor(r,t.pickingMode?this.pickColor:c),n.loadOpacity(r,t.pickingMode?s>0?1:0:s)},h.prototype.applyTexture=function(t,e,i){var r,n,o,s=t.currentGlContext,a=t.currentProgram;if(i.textures.diffuse)var l=i.textures.diffuse.mapId;else l=i.textures.reflective.mapId;var h=this.useTexturePaths?this.images[l].path:this.images[l].filename;this._activeTexture=t.gpuResourceCache.resourceForKey(this.dirPath+h+""),this._activeTexture||(o=e.isClamp?s.CLAMP_TO_EDGE:s.REPEAT,this._activeTexture=t.gpuResourceCache.retrieveTexture(s,this.dirPath+h+"",o)),(r=this._activeTexture&&this._activeTexture.bind(t))&&(e.texCoordsVboCacheKey||(e.texCoordsVboCacheKey=t.gpuResourceCache.generateCacheKey()),n=t.gpuResourceCache.resourceForKey(e.texCoordsVboCacheKey),n||(n=s.createBuffer(),t.gpuResourceCache.putResource(e.texCoordsVboCacheKey,n,e.uvs.length),e.refreshTexCoordBuffer=!0),s.bindBuffer(s.ARRAY_BUFFER,n),e.refreshTexCoordBuffer&&(s.bufferData(s.ARRAY_BUFFER,e.uvs,s.STATIC_DRAW),t.frameStatistics.incrementVboLoadCount(1),e.refreshTexCoordBuffer=!1),a.loadTextureEnabled(s,!0),s.enableVertexAttribArray(a.vertexTexCoordLocation),s.vertexAttribPointer(a.vertexTexCoordLocation,2,s.FLOAT,!1,0,0),a.loadTextureUnit(s,s.TEXTURE0),a.loadModulateColor(s,t.pickingMode))},h.prototype.applyLighting=function(t,e){var i,r=t.currentGlContext,n=t.currentProgram;n.loadApplyLighting(r,!0),e.normalsVboCacheKey||(e.normalsVboCacheKey=t.gpuResourceCache.generateCacheKey()),i=t.gpuResourceCache.resourceForKey(e.normalsVboCacheKey),i||(i=r.createBuffer(),t.gpuResourceCache.putResource(e.normalsVboCacheKey,i,e.normals.length),e.refreshNormalBuffer=!0),r.bindBuffer(r.ARRAY_BUFFER,i),e.refreshNormalBuffer&&(r.bufferData(r.ARRAY_BUFFER,e.normals,r.STATIC_DRAW),t.frameStatistics.incrementVboLoadCount(1),e.refreshNormalBuffer=!1),r.enableVertexAttribArray(n.normalVectorLocation),r.vertexAttribPointer(n.normalVectorLocation,3,r.FLOAT,!1,0,0)},h.prototype.applyMatrix=function(t,e,i,r,o){var s=n.fromIdentity();if(s.copy(t.navigatorState.modelviewProjection),s.multiplyMatrix(this.transformationMatrix),r&&this.localTransforms&&s.multiplyMatrix(r),e&&!t.pickingMode){var a=n.fromIdentity();a.copy(t.navigatorState.modelviewNormalTransform),a.multiplyMatrix(this.normalMatrix),o&&this.localTransforms&&a.multiplyMatrix(o),t.currentProgram.loadModelviewInverse(t.currentGlContext,a)}i&&this._activeTexture&&(t.currentProgram.loadTextureMatrix(t.currentGlContext,this._texCoordMatrix),this._activeTexture=null),t.currentProgram.loadModelviewProjection(t.currentGlContext,s)},h.prototype.applyIndices=function(t,e){var i,r=t.currentGlContext;e.indicesVboCacheKey||(e.indicesVboCacheKey=t.gpuResourceCache.generateCacheKey()),i=t.gpuResourceCache.resourceForKey(e.indicesVboCacheKey),i||(i=r.createBuffer(),t.gpuResourceCache.putResource(e.indicesVboCacheKey,i,e.indices.length),e.refreshIndicesBuffer=!0),r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,i),e.refreshIndicesBuffer&&(r.bufferData(r.ELEMENT_ARRAY_BUFFER,e.indices,r.STATIC_DRAW),t.frameStatistics.incrementVboLoadCount(1),e.refreshIndicesBuffer=!1)},h.prototype.resetDraw=function(t,e,i){var r=t.currentGlContext,n=t.currentProgram;e&&!t.pickingMode&&(n.loadApplyLighting(r,!1),r.disableVertexAttribArray(n.normalVectorLocation)),i&&r.disableVertexAttribArray(n.vertexTexCoordLocation),r.disableVertexAttribArray(n.vertexPointLocation)},h.prototype.endDrawing=function(t){t.bindProgram(null)},h.prototype.computeTransformationMatrix=function(t){this.transformationMatrix=n.fromIdentity(),this.transformationMatrix.multiplyByLocalCoordinateTransform(this.placePoint,t),this.transformationMatrix.multiplyByRotation(1,0,0,this.xRotation),this.transformationMatrix.multiplyByRotation(0,1,0,this.yRotation),this.transformationMatrix.multiplyByRotation(0,0,1,this.zRotation),this.transformationMatrix.multiplyByScale(this.scale,this.scale,this.scale),this.transformationMatrix.multiplyByTranslation(this.xTranslation,this.yTranslation,this.zTranslation),this.computeNormalMatrix()},h.prototype.computeNormalMatrix=function(){var t=new l(0,0,0);this.transformationMatrix.extractRotationAngles(t),this.normalMatrix=n.fromIdentity(),this.normalMatrix.multiplyByRotation(-1,0,0,t[0]),this.normalMatrix.multiplyByRotation(0,-1,0,t[1]),this.normalMatrix.multiplyByRotation(0,0,-1,t[2])},h.prototype.mustRenderNode=function(t){var e=!0;if(this.hideNodes){e=-1===this.nodesToHide.indexOf(t)}return e},h}),i("formats/collada/ColladaLoader",["../../error/ArgumentError","./ColladaAsset","./ColladaImage","./ColladaMaterial","./ColladaMesh","./ColladaNode","./ColladaScene","./ColladaUtils","../../util/Logger"],function(t,e,i,r,n,o,s,a,l){"use strict";var h=function(e,i){if(!e)throw new t(l.logMessage(l.LEVEL_SEVERE,"ColladaLoader","constructor","missingPosition"));this.position=e,this.dirPath="/",this.init(i)};return h.prototype.init=function(t){t&&(this.dirPath=t.dirPath||"/"),this.scene={type:"SceneTree",dirPath:this.dirPath,images:{},metadata:{},materials:{},meshes:{},root:{children:[]}},this.xmlDoc=null},h.prototype.load=function(t,e){-1===t.indexOf("://")&&(t=this.dirPath+t),a.fetchFile(t,function(t){if(t)try{i=this.parse(t)}catch(t){i=null,l.log(l.LEVEL_SEVERE,"error parsing collada file: "+t)}else var i=null;e(i)}.bind(this))},h.prototype.parse=function(t){this.init();var i=new DOMParser;this.xmlDoc=i.parseFromString(t,"text/xml");var r=this.xmlDoc.querySelectorAll("library_nodes node"),n=this.xmlDoc.querySelectorAll("library_effects effect");return this.scene.metadata=new e(this.xmlDoc).parse(),this.parseLib("visual_scene",r),this.parseLib("library_geometries"),this.parseLib("library_materials",n),this.parseLib("library_images"),this.xmlDoc=null,new s(this.position,this.scene)},h.prototype.parseLib=function(t,e){var s=this.xmlDoc.getElementsByTagName(t),l=[];s&&s.length&&(l=s[0].childNodes);for(var h=0;h<l.length;h++){var u=l[h];if(1===u.nodeType)switch(u.nodeName){case"node":var c=(new o).parse(u,e);c&&this.scene.root.children.push(c);break;case"geometry":var d=u.getAttribute("id"),p=u.querySelector("mesh"),f=new n(d).parse(p);f&&(this.scene.meshes[d]=f);break;case"material":var g=u.getAttribute("id"),m=u.querySelector("instance_effect"),E=m.getAttribute("url").substr(1),y=a.querySelectorById(e,E),_=new r(g).parse(y);_&&(this.scene.materials[g]=_);break;case"image":var v=u.getAttribute("id"),S=u.getAttribute("name"),b=new i(v,S).parse(u);b&&(this.scene.images[v]=b)}}},h}),i("util/ImageSource",["../error/ArgumentError","../util/Color","../util/Logger"],function(t,e,i){"use strict";var r=function(e){if(!e)throw new t(i.logMessage(i.LEVEL_SEVERE,"ImageSource","constructor","missingImage"));this.image=e,this.key="ImageSource "+ ++r.keyPool};return r.keyPool=0,r}),i("shapes/ScreenImage",["../error/ArgumentError","../shaders/BasicTextureProgram","../util/Color","../util/ImageSource","../util/Logger","../geom/Matrix","../util/Offset","../pick/PickedObject","../render/Renderable","../geom/Vec3","../util/WWMath"],function(t,e,i,r,n,o,s,a,l,h,u){"use strict";var c=function(e,r){if(!e)throw new t(n.logMessage(n.LEVEL_SEVERE,"ScreenImage","constructor","missingOffset"));if(!r)throw new t(n.logMessage(n.LEVEL_SEVERE,"ScreenImage","constructor","missingImage"));l.call(this),this.screenOffset=e,this._imageSource=r,this.imageColor=i.WHITE,this.imageOffset=new s(WorldWind.OFFSET_FRACTION,.5,WorldWind.OFFSET_FRACTION,.5),this.imageScale=1,this.imageRotation=0,this.imageTilt=0,this.enabled=!0,this.opacity=1,this.pickDelegate=null,this.activeTexture=null,this.imageTransform=o.fromIdentity(),this.texCoordMatrix=o.fromIdentity(),this.imageBounds=null,this.layer=null};return c.matrix=o.fromIdentity(),c.prototype=Object.create(l.prototype),Object.defineProperties(c.prototype,{imageSource:{get:function(){return this._imageSource},set:function(e){if(!e)throw new t(n.logMessage(n.LEVEL_SEVERE,"ScreenImage","imageSource","missingImage"));this._imageSource=e,this.imageSourceWasUpdated=!0}}}),c.prototype.render=function(t){if(this.enabled&&t.accumulateOrderedRenderables){var e=null;this.lastFrameTime!==t.timestamp&&(e=this.makeOrderedRenderable(t)),e&&e.isVisible(t)&&(e.layer=t.currentLayer,this.lastFrameTime=t.timestamp,t.addOrderedRenderable(e))}},c.prototype.renderOrdered=function(t){if(this.drawOrderedScreenImage(t),t.pickingMode){var e=new a(this.pickColor.clone(),this.pickDelegate?this.pickDelegate:this,null,this.layer,!1);t.resolvePick(e)}},c.prototype.makeOrderedRenderable=function(t){var e,i,r,n,o,s,a;return this.activeTexture=this.getActiveTexture(t),this.activeTexture&&!this.imageSourceWasUpdated||(this.activeTexture=t.gpuResourceCache.retrieveTexture(t.currentGlContext,this._imageSource),this.activeTexture)?(this.eyeDistance=0,e=this.activeTexture.imageWidth,i=this.activeTexture.imageHeight,r=this.imageScale,s=this.imageOffset.offsetForSize(e,i),n=t.navigatorState.viewport.width,o=t.navigatorState.viewport.height,a=this.screenOffset.offsetForSize(n,o),this.imageTransform.setTranslation(a[0]-s[0]*r,a[1]-s[1]*r,0),this.imageTransform.setScale(e*r,i*r,1),this.imageBounds=u.boundingRectForUnitQuad(this.imageTransform),this):null},c.prototype.getActiveTexture=function(t){return t.gpuResourceCache.resourceForKey(this._imageSource)},c.prototype.isVisible=function(t){return t.pickingMode?t.pickRectangle&&this.imageBounds.intersects(t.pickRectangle):this.imageBounds.intersects(t.navigatorState.viewport)},c.prototype.drawOrderedScreenImage=function(t){this.beginDrawing(t);try{this.doDrawOrderedScreenImage(t)}finally{this.endDrawing(t)}},c.prototype.beginDrawing=function(t){var i,r=t.currentGlContext;t.findAndBindProgram(e),i=t.currentProgram,r.bindBuffer(r.ARRAY_BUFFER,t.unitQuadBuffer()),r.vertexAttribPointer(i.vertexTexCoordLocation,2,r.FLOAT,!1,0,0),r.enableVertexAttribArray(i.vertexPointLocation),r.enableVertexAttribArray(i.vertexTexCoordLocation),i.loadTextureUnit(r,r.TEXTURE0),i.loadModulateColor(r,t.pickingMode),r.disable(r.DEPTH_TEST)},c.prototype.endDrawing=function(t){var e=t.currentGlContext,i=t.currentProgram;e.disableVertexAttribArray(i.vertexPointLocation),e.disableVertexAttribArray(i.vertexTexCoordLocation),e.bindBuffer(e.ARRAY_BUFFER,null),e.bindTexture(e.TEXTURE_2D,null),e.enable(e.DEPTH_TEST)},c.prototype.doDrawOrderedScreenImage=function(t){var e=t.currentGlContext,i=t.currentProgram;e.bindBuffer(e.ARRAY_BUFFER,t.unitQuadBuffer3()),e.vertexAttribPointer(i.vertexPointLocation,3,e.FLOAT,!1,0,0),c.matrix.copy(t.screenProjection),c.matrix.multiplyMatrix(this.imageTransform),c.matrix.multiplyByTranslation(.5,.5,.5),c.matrix.multiplyByRotation(1,0,0,this.imageTilt),c.matrix.multiplyByRotation(0,0,1,this.imageRotation),c.matrix.multiplyByTranslation(-.5,-.5,0),i.loadModelviewProjection(e,c.matrix),i.loadTextureEnabled(e,!0),t.pickingMode?(this.pickColor=t.uniquePickColor(),i.loadColor(e,this.pickColor)):(i.loadColor(e,this.imageColor),i.loadOpacity(e,this.opacity*this.layer.opacity)),this.texCoordMatrix.setToIdentity(),this.texCoordMatrix.multiplyByTextureTransform(this.activeTexture),i.loadTextureMatrix(e,this.texCoordMatrix),this.activeTexture.bind(t)&&e.drawArrays(e.TRIANGLE_STRIP,0,4)},c}),i("shapes/Compass",["../error/ArgumentError","../util/Logger","../util/Offset","../shapes/ScreenImage"],function(t,e,i,r){"use strict";var n=function(t,e){var n=t||new i(WorldWind.OFFSET_FRACTION,1,WorldWind.OFFSET_FRACTION,1),o=e||WorldWind.configuration.baseUrl+"images/notched-compass.png";r.call(this,n,o),t||(this.imageOffset=new i(WorldWind.OFFSET_FRACTION,1.1,WorldWind.OFFSET_FRACTION,1.1)),this.size=.15};return n.prototype=Object.create(r.prototype),n.prototype.render=function(t){this.imageRotation=t.navigatorState.heading,this.imageTilt=t.navigatorState.tilt;var e=this.getActiveTexture(t);e&&(this.imageScale=this.size*t.currentGlContext.drawingBufferWidth/e.imageWidth),r.prototype.render.call(this,t)},n}),i("layer/CompassLayer",["../shapes/Compass","../layer/RenderableLayer"],function(t,e){"use strict";var i=function(){e.call(this,"Compass"),this._compass=new t(null,null),this.addRenderable(this._compass)};return i.prototype=Object.create(e.prototype),Object.defineProperties(i.prototype,{compass:{get:function(){return this._compass},set:function(e){e&&e instanceof t&&(this.removeAllRenderables(),this.addRenderable(e),this._compass=e)}}}),i}),i("shapes/Text",["../error/ArgumentError","../shaders/BasicTextureProgram","../util/Color","../util/Font","../util/Logger","../geom/Matrix","../pick/PickedObject","../render/Renderable","../shapes/TextAttributes","../error/UnsupportedOperationError","../geom/Vec2","../geom/Vec3","../util/WWMath"],function(t,e,i,r,n,o,s,a,l,h,u,c,d){"use strict";var p=function(e){if(!e)throw new t(n.logMessage(n.LEVEL_SEVERE,"Text","constructor","missingText"));a.call(this),this.attributes=new l(null),this.highlightAttributes=null,this.highlighted=!1,this.enabled=!0,this.text=e,this.altitudeMode=WorldWind.ABSOLUTE,this.pickDelegate=null,this.alwaysOnTop=!1,this.targetVisibility=1,this.currentVisibility=1,this.declutterGroup=0,this.markerImageSource=WorldWind.configuration.baseUrl+"images/white-dot.png",this.markerImageScale=.1,this.activeAttributes=null,this.activeTexture=null,this.imageTransform=o.fromIdentity(),this.texCoordMatrix=o.fromIdentity(),this.imageBounds=null,this.layer=null,this.depthOffset=-.003,this.screenPoint=new c(0,0,0)};return p.matrix=o.fromIdentity(),p.glPickPoint=new c(0,0,0),p.prototype=Object.create(a.prototype),p.prototype.copy=function(t){return this.text=t.text,this.attributes=t.attributes,this.highlightAttributes=t.highlightAttributes,this.highlighted=t.highlighted,this.enabled=t.enabled,this.altitudeMode=t.altitudeMode,this.pickDelegate=t.pickDelegate,this.alwaysOnTop=t.alwaysOnTop,this.depthOffset=t.depthOffset,this.declutterGroup=t.declutterGroup,this.targetVisibility=t.targetVisibility,this.currentVisibility=t.currentVisibility,this},Object.defineProperties(p.prototype,{screenBounds:{get:function(){return this.imageBounds}}}),p.prototype.render=function(t){if(this.enabled&&this.text&&0!==this.text.length&&t.accumulateOrderedRenderables){var e;if(this.lastFrameTime!=t.timestamp)e=this.makeOrderedRenderable(t);else{e=this.clone().makeOrderedRenderable(t)}e&&e.isVisible(t)&&(e.layer=t.currentLayer,this.lastFrameTime=t.timestamp,t.addOrderedRenderable(e))}},p.prototype.renderOrdered=function(t){if((0!==this.currentVisibility||0!==this.targetVisibility||this.markerImageSource)&&(this.drawOrderedText(t),t.pickingMode)){var e=new s(this.pickColor.clone(),this.pickDelegate?this.pickDelegate:this,this.position,this.layer,!1);t.resolvePick(e)}},p.prototype.makeOrderedRenderable=function(t){var e,i,r,n;if(this.determineActiveAttributes(t),!this.activeAttributes)return null;if(!this.computeScreenPointAndEyeDistance(t))return null;var o=this.activeAttributes.font,s=this.text+o.toString();return this.activeTexture=t.gpuResourceCache.resourceForKey(s),this.activeTexture||(this.activeTexture=t.textSupport.createTexture(t,this.text,o,!0),t.gpuResourceCache.putResource(s,this.activeTexture,this.activeTexture.size)),e=this.activeTexture.imageWidth,i=this.activeTexture.imageHeight,r=this.activeAttributes.scale,n=this.activeAttributes.offset.offsetForSize(e,i),this.imageTransform.setTranslation(this.screenPoint[0]-n[0]*r,this.screenPoint[1]-n[1]*r,this.screenPoint[2]),this.imageTransform.setScale(e*r,i*r,1),this.imageBounds=d.boundingRectForUnitQuad(this.imageTransform),this},p.prototype.computeScreenPointAndEyeDistance=function(t){throw new h(n.logMessage(n.LEVEL_SEVERE,"Renderable","render","abstractInvocation"))},p.prototype.determineActiveAttributes=function(t){this.highlighted&&this.highlightAttributes?this.activeAttributes=this.highlightAttributes:this.activeAttributes=this.attributes},p.prototype.isVisible=function(t){return t.pickingMode?t.pickRectangle&&this.imageBounds.intersects(t.pickRectangle):this.imageBounds.intersects(t.navigatorState.viewport)},p.prototype.drawOrderedText=function(t){this.beginDrawing(t);try{this.doDrawOrderedText(t),t.pickingMode}finally{this.endDrawing(t)}},p.prototype.drawBatchOrderedText=function(t){for(var e;(e=t.peekOrderedRenderable())&&e instanceof p;){t.popOrderedRenderable();try{e.doDrawOrderedText(t)}catch(t){n.logMessage(n.LEVEL_WARNING,"Text","drawBatchOrderedText","Error occurred while rendering text using batching: "+t.message)}}},p.prototype.beginDrawing=function(t){var i,r=t.currentGlContext;t.findAndBindProgram(e),i=t.currentProgram,r.bindBuffer(r.ARRAY_BUFFER,t.unitQuadBuffer3()),r.vertexAttribPointer(i.vertexPointLocation,3,r.FLOAT,!1,0,0),r.bindBuffer(r.ARRAY_BUFFER,t.unitQuadBuffer()),r.vertexAttribPointer(i.vertexTexCoordLocation,2,r.FLOAT,!1,0,0),r.enableVertexAttribArray(i.vertexPointLocation),r.enableVertexAttribArray(i.vertexTexCoordLocation),i.loadTextureUnit(r,r.TEXTURE0),i.loadModulateColor(r,!1),r.depthMask(!1),p.currentTexture=null},p.prototype.endDrawing=function(t){var e=t.currentGlContext,i=t.currentProgram;e.disableVertexAttribArray(i.vertexPointLocation),e.disableVertexAttribArray(i.vertexTexCoordLocation),e.bindBuffer(e.ARRAY_BUFFER,null),e.bindTexture(e.TEXTURE_2D,null),e.depthMask(!0),p.currentTexture=null},p.prototype.doDrawOrderedText=function(t){var e,i=t.currentGlContext,r=t.currentProgram;if(!t.pickingMode&&this.currentVisibility!==this.targetVisibility){var n=(t.timestamp-t.previousRedrawTimestamp)/t.fadeTime;this.currentVisibility<this.targetVisibility?this.currentVisibility=Math.min(1,this.currentVisibility+n):this.currentVisibility=Math.max(0,this.currentVisibility-n),t.redrawRequested=!0}if(t.pickingMode?(this.pickColor=t.uniquePickColor(),r.loadColor(i,this.pickColor),r.loadOpacity(i,1),r.loadTextureEnabled(i,!1)):(r.loadColor(i,this.activeAttributes.color),r.loadOpacity(i,this.layer.opacity*this.currentVisibility)),this.currentVisibility>0&&(p.matrix.copy(t.screenProjection),p.matrix.multiplyMatrix(this.imageTransform),r.loadModelviewProjection(i,p.matrix),t.pickingMode||(this.texCoordMatrix.setToIdentity(),this.activeTexture&&this.texCoordMatrix.multiplyByTextureTransform(this.activeTexture),r.loadTextureMatrix(i,this.texCoordMatrix),this.activeTexture&&this.activeTexture!=p.currentTexture&&(e=this.activeTexture.bind(t),r.loadTextureEnabled(i,e),p.currentTexture=this.activeTexture)),this.activeAttributes.depthTest||i.disable(i.DEPTH_TEST,!1),i.drawArrays(i.TRIANGLE_STRIP,0,4),this.activeAttributes.depthTest||i.disable(i.DEPTH_TEST,!0)),this.currentVisibility<1&&this.markerImageSource){var s=t.gpuResourceCache.resourceForKey(this.markerImageSource);if(!s)return void t.gpuResourceCache.retrieveTexture(t.currentGlContext,this.markerImageSource);var a=this.markerImageScale,l=o.fromIdentity();if(l.setTranslation(this.screenPoint[0]-a*s.imageWidth/2,this.screenPoint[1]-a*s.imageWidth/2,this.screenPoint[2]),l.setScale(s.imageWidth*a,s.imageHeight*a,1),p.matrix.copy(t.screenProjection),p.matrix.multiplyMatrix(l),r.loadModelviewProjection(i,p.matrix),!t.pickingMode){r.loadOpacity(i,this.layer.opacity*(1-this.currentVisibility));var h=o.fromIdentity();h.multiplyByTextureTransform(s),r.loadTextureMatrix(i,h),s!=p.currentTexture&&(e=s.bind(t),r.loadTextureEnabled(i,e),p.currentTexture=s)}this.activeAttributes.depthTest||i.disable(i.DEPTH_TEST,!1),i.drawArrays(i.TRIANGLE_STRIP,0,4),this.activeAttributes.depthTest||i.enable(i.DEPTH_TEST,!0)}},p}),i("shapes/ScreenText",["../error/ArgumentError","../util/Logger","../util/Offset","../shapes/Text"],function(t,e,i,r){"use strict";var n=function(i,n){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"Text","constructor","missingOffset"));r.call(this,n),this.screenOffset=i,this.altitudeMode=null};return n.prototype=Object.create(r.prototype),n.prototype.render=function(t){this.lastFrameTime!=t.timestamp&&r.prototype.render.call(this,t)},n.prototype.computeScreenPointAndEyeDistance=function(t){var e=t.currentGlContext,i=this.screenOffset.offsetForSize(e.drawingBufferWidth,e.drawingBufferHeight);return this.screenPoint[0]=i[0],this.screenPoint[1]=i[1],this.screenPoint[2]=0,this.eyeDistance=0,!0},n}),i("layer/CoordinatesDisplayLayer",["../error/ArgumentError","../util/Color","../util/Font","../layer/Layer","../util/Logger","../util/Offset","../geom/Position","../shapes/ScreenImage","../shapes/ScreenText","../shapes/TextAttributes","../geom/Vec2"],function(t,e,i,r,n,o,s,a,l,h,u){"use strict";var c=function(i){function s(t){p.handleUIEvent(t)}function u(t,e){p.handleRedraw(e)}if(!i)throw new t(n.logMessage(n.LEVEL_SEVERE,"ViewControlsLayer","constructor","missingWorldWindow"));r.call(this,"Coordinates"),this.wwd=i,this.pickEnabled=!1,this.eventType=null,this.clientX=null,this.clientY=null,this.terrainPosition=null,this.latText=new l(new o(WorldWind.OFFSET_PIXELS,0,WorldWind.OFFSET_PIXELS,0)," "),this.latText.attributes=new h(null),this.latText.attributes.color=e.YELLOW,this.lonText=new l(new o(WorldWind.OFFSET_PIXELS,0,WorldWind.OFFSET_PIXELS,0)," "),this.lonText.attributes=new h(null),this.lonText.attributes.color=e.YELLOW,this.elevText=new l(new o(WorldWind.OFFSET_PIXELS,0,WorldWind.OFFSET_PIXELS,0)," "),this.elevText.attributes=new h(null),this.elevText.attributes.color=e.YELLOW,this.eyeText=new l(new o(WorldWind.OFFSET_PIXELS,0,WorldWind.OFFSET_PIXELS,0)," "),this.eyeText.attributes=new h(null),this.eyeText.attributes.color=e.YELLOW;var c=new o(WorldWind.OFFSET_FRACTION,.5,WorldWind.OFFSET_FRACTION,.5),d=WorldWind.configuration.baseUrl+"images/crosshair.png";this.crosshairImage=new a(c,d);var p=this
;window.PointerEvent?(i.addEventListener("pointerdown",s),i.addEventListener("pointermove",s),i.addEventListener("pointerleave",s)):(i.addEventListener("mousedown",s),i.addEventListener("mousemove",s),i.addEventListener("mouseleave",s),i.addEventListener("touchstart",s),i.addEventListener("touchmove",s)),this.wwd.redrawCallbacks.push(u)};return c.prototype=Object.create(r.prototype),c.prototype.doRender=function(t){var e,i,r,n,s,a=this.terrainPosition,l=t.eyePosition,h=t.currentGlContext.canvas.clientWidth;h>650?(e=h/2-50,i=5,r=WorldWind.OFFSET_PIXELS,n=0):h>400?(e=60,i=5,r=WorldWind.OFFSET_INSET_PIXELS,n=1):(e=60,i=5,r=WorldWind.OFFSET_INSET_PIXELS,n=1,s=!0),this.latText.text=a?this.formatLatitude(a.latitude):null,this.latText.screenOffset=new o(WorldWind.OFFSET_PIXELS,e,r,i),this.latText.attributes.offset=new o(WorldWind.OFFSET_FRACTION,1,WorldWind.OFFSET_FRACTION,n),this.latText.render(t),e+=70,this.lonText.text=a?this.formatLongitude(a.longitude):null,this.lonText.screenOffset=new o(WorldWind.OFFSET_PIXELS,e,r,i),this.lonText.attributes.offset=new o(WorldWind.OFFSET_FRACTION,1,WorldWind.OFFSET_FRACTION,n),this.lonText.render(t),t.globe.is2D()||(e+=70,this.elevText.text=a?this.formatAltitude(a.altitude,"m"):null,this.elevText.screenOffset=new o(WorldWind.OFFSET_PIXELS,e,r,i),this.elevText.attributes.offset=new o(WorldWind.OFFSET_FRACTION,1,WorldWind.OFFSET_FRACTION,n),this.elevText.render(t)),s||(e+=40,this.eyeText.text="Eye  "+this.formatAltitude(l.altitude,l.altitude<1e3?"m":"km"),this.eyeText.screenOffset=new o(WorldWind.OFFSET_PIXELS,e,r,i),this.eyeText.attributes.offset=new o(WorldWind.OFFSET_FRACTION,0,WorldWind.OFFSET_FRACTION,n),this.eyeText.render(t)),"touch"==this.eventType&&this.crosshairImage.render(t),this.inCurrentFrame=!0},c.prototype.handleUIEvent=function(t){-1!=t.type.indexOf("pointer")?this.eventType=t.pointerType:-1!=t.type.indexOf("mouse")?this.eventType="mouse":-1!=t.type.indexOf("touch")&&(this.eventType="touch"),-1!=t.type.indexOf("leave")?(this.clientX=null,this.clientY=null):(this.clientX=t.clientX,this.clientY=t.clientY),this.wwd.redraw()},c.prototype.handleRedraw=function(t){if(t==WorldWind.BEFORE_REDRAW){var e,i;("mouse"==this.eventType||"pen"==this.eventType)&&this.clientX&&this.clientY?(e=this.wwd.canvasCoordinates(this.clientX,this.clientY),e[0]>=0&&e[0]<this.wwd.canvas.width&&e[1]>=0&&e[1]<this.wwd.canvas.height&&(i=this.wwd.pickTerrain(e).terrainObject())):"touch"==this.eventType&&(e=new u(this.wwd.canvas.width/2,this.wwd.canvas.height/2),i=this.wwd.pickTerrain(e).terrainObject()),this.terrainPosition=i?i.position:null}},c.prototype.formatLatitude=function(t){var e=t<0?"°S":"°N";return Math.abs(t).toFixed(2)+e},c.prototype.formatLongitude=function(t){var e=t<0?"°W":"°E";return Math.abs(t).toFixed(2)+e},c.prototype.formatAltitude=function(t,e){return"km"===e&&(t/=1e3),t.toFixed(0).replace(/\B(?=(\d{3})+(?!\d))/g,",")+" "+e},c}),i("util/Date",[],function(){"use strict";var t=function(t){this._date=t?new Date(t):new Date};return t.prototype=Object.create(Date.prototype),t.prototype.isAfter=function(t){return-1==this.compare(t)},t.prototype.isBefore=function(t){return 1==this.compare(t)},t.prototype.valueOf=function(){return this._date.valueOf()},t.prototype.getTime=function(){return this._date.getTime()},t.prototype.compare=function(t){var e=this._date.valueOf(),i=t.valueOf();return e>i?-1:e<i?1:0},t}),i("layer/DigitalGlobeTiledImageLayer",["../geom/Angle","../error/ArgumentError","../util/Color","../geom/Location","../util/Logger","../geom/Sector","../layer/MercatorTiledImageLayer"],function(t,e,i,r,n,o,s){"use strict";var a=function(t,i,a){if(!i)throw new e(n.logMessage(n.LEVEL_SEVERE,"DigitalGlobeTiledImageLayer","constructor","The map ID is null or undefined."));if(!a)throw new e(n.logMessage(n.LEVEL_SEVERE,"DigitalGlobeTiledImageLayer","constructor","The access token is null or undefined."));this.imageSize=256,t=t||"Digital Globe",s.call(this,new o(-85.05,85.05,-180,180),new r(85.05,180),19,"image/jpeg",t,this.imageSize,this.imageSize),this.mapId=i,this.accessToken=a,this.displayName=t,this.pickEnabled=!1,this.destCanvas=document.createElement("canvas"),this.destContext=this.destCanvas.getContext("2d"),this.requestMetadata();var l=this;this.urlBuilder={urlForTile:function(t,e){return l.metadataRetrievalInProcess?null:l.urlTemplate.replace("{z}",t.level.levelNumber+1).replace("{x}",t.column).replace("{y}",t.row)}}};return a.prototype=Object.create(s.prototype),a.prototype.requestMetadata=function(){if(!this.metadataRetrievalInProcess){this.metadataRetrievalInProcess=!0;var t="https://api.mapbox.com/v4/"+this.mapId+".json?secure&access_token="+this.accessToken,e=new XMLHttpRequest,i=this;e.onreadystatechange=function(){if(4===e.readyState&&200===e.status){var t=JSON.parse(e.responseText);i.urlTemplate=t.tiles[0];var r=document.createEvent("Event");r.initEvent(WorldWind.REDRAW_EVENT_TYPE,!0,!0),window.dispatchEvent(r),i.metadataRetrievalInProcess=!1}},e.open("GET",t,!0),e.send()}},a.prototype.doRender=function(t){s.prototype.doRender.call(this,t),this.inCurrentFrame&&t.screenCreditController.addStringCredit("© Digital Globe",i.DARK_GRAY)},a.prototype.createTopLevelTiles=function(t){this.topLevelTiles=[],this.topLevelTiles.push(this.createTile(null,this.levels.firstLevel(),0,0)),this.topLevelTiles.push(this.createTile(null,this.levels.firstLevel(),0,1)),this.topLevelTiles.push(this.createTile(null,this.levels.firstLevel(),1,0)),this.topLevelTiles.push(this.createTile(null,this.levels.firstLevel(),1,1))},a.prototype.mapSizeForLevel=function(t){return 256<<t+1},a}),i("gesture/DragRecognizer",["../gesture/GestureRecognizer"],function(t){"use strict";var e=function(e,i){t.call(this,e,i),this.button=0,this.interpretDistance=5};return e.prototype=Object.create(t.prototype),e.prototype.mouseMove=function(t){this.state==WorldWind.POSSIBLE?this.shouldInterpret()&&(this.shouldRecognize()?(this.translationX=0,this.translationY=0,this.state=WorldWind.BEGAN):this.state=WorldWind.FAILED):this.state!=WorldWind.BEGAN&&this.state!=WorldWind.CHANGED||(this.state=WorldWind.CHANGED)},e.prototype.mouseUp=function(t){0==this.mouseButtonMask&&(this.state==WorldWind.POSSIBLE?this.state=WorldWind.FAILED:this.state!=WorldWind.BEGAN&&this.state!=WorldWind.CHANGED||(this.state=WorldWind.ENDED))},e.prototype.touchStart=function(t){this.state==WorldWind.POSSIBLE&&(this.state=WorldWind.FAILED)},e.prototype.shouldInterpret=function(){var t=this.translationX,e=this.translationY;return Math.sqrt(t*t+e*e)>this.interpretDistance},e.prototype.shouldRecognize=function(){return 1<<this.button==this.mouseButtonMask},e}),i("util/FrameStatistics",[],function(){"use strict";var t=function(){this.frameCount=0,this.frameTimeCumulative=0,this.frameTimeBase=0,this.frameTimeExtremes=[Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY],this.frameTime=0,this.tessellationTime=0,this.layerRenderingTime=0,this.orderedRenderingTime=0,this.terrainTileCount=0,this.imageTileCount=0,this.renderedTileCount=0,this.tileUpdateCount=0,this.textureLoadCount=0,this.vboLoadCount=0,this.frameTimeAverage=0,this.frameRateAverage=0,this.frameTimeMin=0,this.frameTimeMax=0};return t.prototype.beginFrame=function(){this.frameTime=Date.now(),this.tessellationTime=0,this.layerRenderingTime=0,this.orderedRenderingTime=0,this.terrainTileCount=0,this.imageTileCount=0,this.renderedTileCount=0,this.tileUpdateCount=0,this.textureLoadCount=0,this.vboLoadCount=0,++this.frameCount},t.prototype.endFrame=function(){var t=Date.now();this.frameTime=t-this.frameTime,this.frameTimeCumulative+=this.frameTime,this.frameTimeExtremes[0]=Math.min(this.frameTimeExtremes[0],this.frameTime),this.frameTimeExtremes[1]=Math.max(this.frameTimeExtremes[1],this.frameTime),t-this.frameTimeBase>2e3&&(this.frameTimeAverage=this.frameTimeCumulative/this.frameCount,this.frameRateAverage=1e3*this.frameCount/(t-this.frameTimeBase),this.frameTimeMin=this.frameTimeExtremes[0],this.frameTimeMax=this.frameTimeExtremes[1],this.frameCount=0,this.frameTimeCumulative=0,this.frameTimeBase=t,this.frameTimeExtremes=[Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY])},t.prototype.incrementRenderedTileCount=function(t){this.renderedTileCount+=t},t.prototype.setTerrainTileCount=function(t){this.terrainTileCount=t},t.prototype.incrementImageTileCount=function(t){this.imageTileCount=t},t.prototype.incrementTileUpdateCount=function(t){this.tileUpdateCount+=t},t.prototype.incrementTextureLoadCount=function(t){this.textureLoadCount+=t},t.prototype.incrementVboLoadCount=function(t){this.vboLoadCount+=t},t}),i("render/FramebufferTexture",["../error/ArgumentError","../util/Logger","../util/WWMath"],function(t,e){"use strict";var i=function(i,r,n,o){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"FramebufferTexture","constructor","missingGlContext"));if(r<0||n<0)throw new t(e.logMessage(e.LEVEL_SEVERE,"FramebufferTexture","constructor","The framebuffer width or height is less than zero."));this.width=r,this.height=n,this.depth=o,this.size=r*n*4+(o?r*n*2:0),this.framebufferId=i.createFramebuffer(),i.bindFramebuffer(i.FRAMEBUFFER,this.framebufferId),this.texture=i.createTexture(),i.bindTexture(i.TEXTURE_2D,this.texture),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,r,n,0,i.RGBA,i.UNSIGNED_BYTE,null),i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,this.texture,0),this.depthBuffer=null,o&&(this.depthBuffer=i.createRenderbuffer(),i.bindRenderbuffer(i.RENDERBUFFER,this.depthBuffer),i.renderbufferStorage(i.RENDERBUFFER,i.DEPTH_COMPONENT16,r,n),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.RENDERBUFFER,this.depthBuffer));var s=i.checkFramebufferStatus(i.FRAMEBUFFER);s!=i.FRAMEBUFFER_COMPLETE&&(e.logMessage(e.LEVEL_WARNING,"FramebufferTexture","constructor","Error creating framebuffer: "+s),this.framebufferId=null,this.texture=null,this.depthBuffer=null),i.bindFramebuffer(i.FRAMEBUFFER,null),i.bindRenderbuffer(i.RENDERBUFFER,null),i.bindTexture(i.TEXTURE_2D,null)};return i.prototype.bind=function(t){return this.texture&&t.currentGlContext.bindTexture(gl.TEXTURE_2D,this.texture),!!this.texture},i}),i("render/FramebufferTile",["../error/ArgumentError","../render/FramebufferTexture","../util/Logger","../geom/Matrix","../geom/Rectangle","../render/TextureTile"],function(t,e,i,r,n,o){"use strict";var s=function(e,n,s,a,l){if(!l||l.length<1)throw new t(i.logMessage(i.LEVEL_SEVERE,"FramebufferTile","constructor","The specified cache name is null, undefined or zero length."));o.call(this,e,n,s,a),this.gpuCacheKey=l,this.textureTransform=r.fromIdentity().setToUnitYFlip(),this.mustClear=!0};return s.prototype=Object.create(o.prototype),s.prototype.clearFramebuffer=function(t){this.mustClear=!0},s.prototype.bindFramebuffer=function(t){var e=t.gpuResourceCache.resourceForKey(this.gpuCacheKey);return e||(e=this.createFramebuffer(t)),t.bindFramebuffer(e),this.mustClear&&(this.doClearFramebuffer(t),this.mustClear=!1),!0},s.prototype.createFramebuffer=function(t){var i=new e(t.currentGlContext,this.tileWidth,this.tileHeight,!1);return t.gpuResourceCache.putResource(this.gpuCacheKey,i,i.size),i},s.prototype.doClearFramebuffer=function(t){var e=t.currentGlContext;e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT)},s.prototype.applyInternalTransform=function(t,e){e.multiplyMatrix(this.textureTransform)},s}),i("render/FramebufferTileController",["../error/ArgumentError","../render/FramebufferTile","../util/LevelSet","../geom/Location","../util/Logger","../cache/MemoryCache","../geom/Sector","../util/Tile"],function(t,e,i,r,n,o,s,a){"use strict";var l=function(){this.tileWidth=256,this.tileHeight=256,this.detailControl=1.75,this.levels=new i(s.FULL_SPHERE,new r(45,45),16,this.tileWidth,this.tileHeight),this.topLevelTiles=[],this.currentTiles=[],this.currentTimestamp=null,this.currentGlobeStateKey=null,this.tileCache=new o(5e5,4e5),this.key="FramebufferTileController "+ ++l.keyPool};return l.keyPool=0,l.prototype.selectTiles=function(e,i){if(!i)throw new t(n.logMessage(n.LEVEL_SEVERE,"FramebufferTileController","selectTiles","missingSector"));this.assembleTiles(e);for(var r=[],o=0,s=this.currentTiles.length;o<s;o++){var a=this.currentTiles[o];a.sector.overlaps(i)&&(a.selected=!0,r.push(a))}return r},l.prototype.render=function(t){if(0!=this.currentTiles.length){for(var e=[],i=0,r=this.currentTiles.length;i<r;i++){var n=this.currentTiles[i];n.selected&&e.push(n)}t.surfaceTileRenderer.renderTiles(t,e,1);var o=t.currentGlContext,s=t.currentFramebuffer;try{for(o.clearColor(0,0,0,0),i=0,r=e.length;i<r;i++)n=e[i],n.selected=!1,n.bindFramebuffer(t),o.clear(o.COLOR_BUFFER_BIT)}finally{t.bindFramebuffer(s)}}},l.prototype.assembleTiles=function(t){var e=t.timestamp,i=t.globeStateKey;this.currentTimestamp==e&&this.currentGlobeStateKey==i||(this.doAssembleTiles(t),this.currentTimestamp=e,this.currentGlobeStateKey=i)},l.prototype.doAssembleTiles=function(t){if(this.currentTiles=[],t.terrain){0==this.topLevelTiles.length&&this.createTopLevelTiles();for(var e=0,i=this.topLevelTiles.length;e<i;e++){var r=this.topLevelTiles[e];r.update(t),this.isTileVisible(t,r)&&this.addTileOrDescendants(t,r)}}},l.prototype.createTile=function(t,i,r,n){var o=this.key+" "+i.levelNumber+"."+r+"."+n;return new e(t,i,r,n,o)},l.prototype.createTopLevelTiles=function(){a.createTilesForLevel(this.levels.firstLevel(),this,this.topLevelTiles)},l.prototype.addTileOrDescendants=function(t,e){if(this.tileMeetsRenderingCriteria(t,e))return void this.addTile(e);for(var i=e.subdivideToCache(e.level.nextLevel(),this,this.tileCache),r=0,n=i.length;r<n;r++){var o=i[r];o.update(t),this.isTileVisible(t,o)&&this.addTileOrDescendants(t,o)}},l.prototype.addTile=function(t){this.currentTiles.push(t)},l.prototype.isTileVisible=function(t,e){return!(t.globe.projectionLimits&&!e.sector.overlaps(t.globe.projectionLimits))&&(t.pickingMode?e.extent.intersectsFrustum(t.pickFrustum):e.extent.intersectsFrustum(t.navigatorState.frustumInModelCoordinates))},l.prototype.tileMeetsRenderingCriteria=function(t,e){var i=this.detailControl;return(e.sector.minLatitude>=75||e.sector.maxLatitude<=-75)&&(i*=1.2),e.level.isLastLevel()||!e.mustSubdivide(t,i)},l}),i("globe/ElevationImage",["../error/ArgumentError","../util/Logger","../util/WWMath"],function(t,e,i){"use strict";var r=function(i,r,n,o){if(!i||i.length<1)throw new t(e.logMessage(e.LEVEL_SEVERE,"ElevationImage","constructor","The specified image path is null, undefined or zero length."));if(!r)throw new t(e.logMessage(e.LEVEL_SEVERE,"ElevationImage","constructor","missingSector"));this.sector=r,this.imagePath=i,this.imageWidth=n,this.imageHeight=o,this.size=this.imageWidth*this.imageHeight};return r.prototype.pixel=function(t,e){return t<0||t>=this.imageWidth?0:e<0||e>=this.imageHeight?0:(e=this.imageHeight-e-1,this.imageData[t+e*this.imageWidth])},r.prototype.elevationAtLocation=function(t,e){var r=this.sector.maxLatitude,n=this.sector.minLongitude,o=this.sector.deltaLatitude(),s=this.sector.deltaLongitude(),a=(this.imageWidth-1)*(e-n)/s,l=(this.imageHeight-1)*(r-t)/o,h=Math.floor(i.clamp(a,0,this.imageWidth-1)),u=Math.floor(i.clamp(h+1,0,this.imageWidth-1)),c=Math.floor(i.clamp(l,0,this.imageHeight-1)),d=Math.floor(i.clamp(c+1,0,this.imageHeight-1)),p=this.imageData,f=p[h+c*this.imageWidth],g=p[u+c*this.imageWidth],m=p[h+d*this.imageWidth],E=p[u+d*this.imageWidth],y=a-h,_=l-c;return(1-y)*(1-_)*f+y*(1-_)*g+(1-y)*_*m+y*_*E},r.prototype.elevationsForGrid=function(r,n,o,s){if(!r)throw new t(e.logMessage(e.LEVEL_SEVERE,"ElevationImage","elevationsForGrid","missingSector"));if(n<1||o<1)throw new t(e.logMessage(e.LEVEL_SEVERE,"ElevationImage","elevationsForGrid","The specified number of sample points is less than 1."));if(!s)throw new t(e.logMessage(e.LEVEL_SEVERE,"ElevationImage","elevationsForGrid","missingResult"));var a,l,h,u,c=this.sector.minLatitude,d=this.sector.maxLatitude,p=this.sector.minLongitude,f=this.sector.maxLongitude,g=d-c,m=f-p,E=r.minLatitude,y=r.maxLatitude,_=r.minLongitude,v=r.maxLongitude,S=(y-E)/(n>1?n-1:1),b=(v-_)/(o>1?o-1:1),T=0,L=this.imageData;for(u=0,a=E;u<n;u+=1,a+=S)if(u===n-1&&(a=y),a>=c&&a<=d){var w=(this.imageHeight-1)*(d-a)/g,R=Math.floor(i.clamp(w,0,this.imageHeight-1)),x=Math.floor(i.clamp(R+1,0,this.imageHeight-1)),M=w-R;for(h=0,l=_;h<o;h+=1,l+=b){if(h===o-1&&(l=v),l>=p&&l<=f){var C=(this.imageWidth-1)*(l-p)/m,A=Math.floor(i.clamp(C,0,this.imageWidth-1)),P=Math.floor(i.clamp(A+1,0,this.imageWidth-1)),I=C-A,O=L[A+R*this.imageWidth],N=L[P+R*this.imageWidth],D=L[A+x*this.imageWidth],k=L[P+x*this.imageWidth];s[T]=(1-I)*(1-M)*O+I*(1-M)*N+(1-I)*M*D+I*M*k}T++}}else T+=o},r.prototype.minAndMaxElevationsForSector=function(t){var e=[];if(t)if(t.contains(this.sector))e[0]>this.minElevation&&(e[0]=this.minElevation),e[1]<this.maxElevation&&(e[1]=this.maxElevation);else{var r=this.sector.maxLatitude,n=this.sector.minLongitude,o=this.sector.deltaLatitude(),s=this.sector.deltaLongitude(),a=t.minLatitude,l=t.maxLatitude,h=t.minLongitude,u=t.maxLongitude,c=Math.floor((this.imageHeight-1)*(r-l)/o),d=Math.ceil((this.imageHeight-1)*(r-a)/o),p=Math.floor((this.imageWidth-1)*(h-n)/s),f=Math.ceil((this.imageWidth-1)*(u-n)/s);c=i.clamp(c,0,this.imageHeight-1),d=i.clamp(d,0,this.imageHeight-1),p=i.clamp(p,0,this.imageWidth-1),f=i.clamp(f,0,this.imageWidth-1);for(var g=this.imageData,m=Number.MAX_VALUE,E=-m,y=c;y<=d;y++)for(var _=p;_<=f;_++){var v=g[Math.floor(_+y*this.imageWidth)];m>v&&(m=v),E<v&&(E=v)}e[0]>m&&(e[0]=m),e[1]<E&&(e[1]=E)}else e[0]=this.minElevation,e[1]=this.maxElevation;return e},r.prototype.findMinAndMaxElevation=function(){if(this.imageData&&this.imageData.length>0){this.minElevation=Number.MAX_VALUE,this.maxElevation=-this.minElevation;for(var t=this.imageData,e=this.imageWidth*this.imageHeight,i=0;i<e;i++){var r=t[i];this.minElevation>r&&(this.minElevation=r),this.maxElevation<r&&(this.maxElevation=r)}}else this.minElevation=0,this.maxElevation=0},r}),i("globe/ElevationTile",["../error/ArgumentError","../util/Logger","../util/Tile"],function(t,e,i){"use strict";var r=function(r,n,o,s,a,l){if(!a||a.length<1)throw new t(e.logMessage(e.LEVEL_SEVERE,"ElevationTile","constructor","The specified image path is null, undefined or zero length."));if(!l)throw new t(e.logMessage(e.LEVEL_SEVERE,"ElevationTile","constructor","The specified cache is null or undefined."));i.call(this,r,n,o,s),this.imagePath=a,this.memoryCache=l};return r.prototype=Object.create(i.prototype),r.prototype.size=function(){return i.prototype.size.call(this)+this.imagePath.length+8},r.prototype.image=function(){return this.memoryCache.entryForKey(this.imagePath)},r}),i("globe/ElevationModel",["../util/AbsentResourceList","../geom/Angle","../error/ArgumentError","../globe/ElevationImage","../globe/ElevationTile","../util/LevelSet","../util/Logger","../cache/MemoryCache","../geom/Sector","../util/Tile","../util/WWMath"],function(t,e,i,r,n,o,s,a,l,h,u){"use strict";var c=function(e,r,n,h,u,d,p){if(!e)throw new i(s.logMessage(s.LEVEL_SEVERE,"ElevationModel","constructor","missingSector"));if(!r)throw new i(s.logMessage(s.LEVEL_SEVERE,"ElevationModel","constructor","The specified level-zero delta is null or undefined."));if(!h)throw new i(s.logMessage(s.LEVEL_SEVERE,"ElevationModel","constructor","The specified image format is null or undefined."));if(!u)throw new i(s.logMessage(s.LEVEL_SEVERE,"ElevationModel","constructor","The specified cache path is null or undefined."));if(!n||n<1)throw new i(s.logMessage(s.LEVEL_SEVERE,"ElevationModel","constructor","The specified number of levels is not greater than zero."));if(!d||!p||d<1||p<1)throw new i(s.logMessage(s.LEVEL_SEVERE,"ElevationModel","constructor","The specified tile width or height is not greater than zero."));this.coverageSector=e,this.retrievalImageFormat=h,this.cachePath=u,this.displayName="Elevations",this.timestamp=Date.now(),this.minElevation=0,this.maxElevation=0,this.pixelIsPoint=!0,this.levels=new o(this.coverageSector,r,n,d,p),this.currentTiles=[],this.currentSector=new l(0,0,0,0),this.tileCache=new a(1e6,8e5),this.imageCache=new a(1e7,8e6),this.currentRetrievals=[],this.absentResourceList=new t(3,5e3),this.id=++c.idPool,this.stateKey="elevationModel "+this.id.toString()+" "};return c.idPool=0,c.prototype.minAndMaxElevationsForSector=function(t){if(!t)throw new i(s.logMessage(s.LEVEL_SEVERE,"ElevationModel","minAndMaxElevationsForSector","missingSector"));var r=this.levels.levelForTexelSize(t.deltaLatitude()*e.DEGREES_TO_RADIANS/64);if(this.assembleTiles(r,t,!1),0==this.currentTiles.length)return null;for(var n,o,a,l=Number.MAX_VALUE,h=-l,u=[],c=0,d=this.currentTiles.length;c<d;c++){if(!(n=this.currentTiles[c].image()))return u[0]=this.minElevation,u[1]=this.maxElevation,u;o=n.minElevation,l>o&&(l=o),a=n.maxElevation,h<a&&(h=a)}return u[0]=l,u[1]=h,u},c.prototype.elevationAtLocation=function(t,e){return this.coverageSector.containsLocation(t,e)?this.pointElevationForLocation(t,e):0},c.prototype.elevationsForGrid=function(t,e,r,n,o){if(!t)throw new i(s.logMessage(s.LEVEL_SEVERE,"ElevationModel","elevationsForSector","missingSector"));if(!o)throw new i(s.logMessage(s.LEVEL_SEVERE,"ElevationModel","elevationsForSector","missingResult"));if(!e||!r||e<1||r<1)throw new i(s.logMessage(s.LEVEL_SEVERE,"ElevationModel","constructor","The specified number of latitudinal or longitudinal positions is less than one."));var a=this.levels.levelForTexelSize(n);return this.pixelIsPoint?this.pointElevationsForGrid(t,e,r,a,o):this.areaElevationsForGrid(t,e,r,a,o)},c.prototype.pointElevationForLocation=function(t,e){for(var i,r=this.levels.lastLevel(),n=r.tileDelta.latitude,o=r.tileDelta.longitude,s=h.computeRow(n,t),a=h.computeColumn(o,e),l=null,u=r.levelNumber;u>=0;u--){if((i=this.tileCache.entryForKey(u+"."+s+"."+a))&&(l=i.image()))return l.elevationAtLocation(t,e);s=Math.floor(s/2),a=Math.floor(a/2)}return 0},c.prototype.pointElevationsForGrid=function(t,e,i,r,n){var o,s=0;if(this.assembleTiles(r,t,!0),0===this.currentTiles.length)return 0;this.currentTiles.sort(function(t,e){return t.level.levelNumber-e.level.levelNumber});for(var a=0,l=this.currentTiles.length;a<l;a++){var h=this.currentTiles[a],u=h.image();u?(u.elevationsForGrid(t,e,i,n),o=h.level.texelSize,s<o&&(s=o)):s=Number.MAX_VALUE}return s},c.prototype.areaElevationsForGrid=function(t,e,i,r,n){var o,s,a,l,h,u,c=t.minLatitude,d=t.maxLatitude,p=t.minLongitude,f=t.maxLongitude,g=t.deltaLatitude()/(e>1?e-1:1),m=t.deltaLongitude()/(i>1?i-1:1),E=0;for(h=0,o=c;h<e;h+=1,o+=g)for(h===e-1&&(o=d),u=0,s=p;u<i;u+=1,s+=m)u===i-1&&(s=f),this.coverageSector.containsLocation(o,s)&&(a=(s+180)/360,l=(o+90)/180,this.areaElevationForCoord(a,l,r.levelNumber,n,E)),E++;return r.texelSize},c.prototype.areaElevationForCoord=function(t,e,i,r,n){for(var o,s,a,l,h,c,d,p,f,g,m,E,y,_,v,S,b=new Float64Array(4),T=i;T>=0;T--)if(o=this.levels.level(T),s=Math.round(360*o.tileWidth/o.tileDelta.longitude),a=Math.round(180*o.tileHeight/o.tileDelta.latitude),l=1/(2*a),h=1-l,c=0,d=a-1,p=s*u.fract(t),f=a*u.clamp(e,l,h),g=u.mod(Math.floor(p-.5),s),m=u.mod(g+1,s),E=u.clamp(Math.floor(f-.5),c,d),y=u.clamp(E+1,c,d),_=u.fract(p-.5),v=u.fract(f-.5),S=T==i||0==T,this.lookupPixels(g,m,E,y,o,S,b))return void(r[n]=(1-_)*(1-v)*b[0]+_*(1-v)*b[1]+(1-_)*v*b[2]+_*v*b[3])},c.prototype.lookupPixels=function(t,e,i,r,n,o,s){var a,l,h,u,c=n.levelNumber,d=n.tileWidth,p=n.tileHeight,f=Math.floor(i/p),g=Math.floor(r/p),m=Math.floor(t/d),E=Math.floor(e/d);return f==g&&f==this.cachedRow&&m==E&&m==this.cachedCol?a=l=h=u=this.cachedImage:f==g&&m==E?(a=this.lookupImage(c,f,m,o),l=h=u=a,this.cachedRow=f,this.cachedCol=m,this.cachedImage=a):(a=this.lookupImage(c,f,m,o),l=this.lookupImage(c,f,E,o),h=this.lookupImage(c,g,m,o),u=this.lookupImage(c,g,E,o)),!!(a&&l&&h&&u)&&(s[0]=a.pixel(t%d,i%p),s[1]=l.pixel(e%d,i%p),s[2]=h.pixel(t%d,r%p),s[3]=u.pixel(e%d,r%p),!0)},c.prototype.lookupImage=function(t,e,i,r){var n=this.tileForLevel(t,e,i),o=n.image();return null==o&&r&&this.retrieveTileImage(n),o},c.prototype.createTile=function(t,e,i,r){var o=this.cachePath+"/"+e.levelNumber+"/"+i+"/"+i+"_"+r+".bil";return new n(t,e,i,r,o,this.imageCache)},c.prototype.assembleTiles=function(t,e,i){if(this.currentTiles=[],this.currentSector.copy(e),this.currentSector.intersection(this.coverageSector),!this.currentSector.isEmpty())for(var r=t.tileDelta.latitude,n=t.tileDelta.longitude,o=h.computeRow(r,this.currentSector.minLatitude),s=h.computeLastRow(r,this.currentSector.maxLatitude),a=h.computeColumn(n,this.currentSector.minLongitude),l=h.computeLastColumn(n,this.currentSector.maxLongitude),u=o;u<=s;u++)for(var c=a;c<=l;c++)this.addTileOrAncestor(t,u,c,i)},c.prototype.addTileOrAncestor=function(t,e,i,r){var n=this.tileForLevel(t.levelNumber,e,i);this.isTileImageInMemory(n)?this.addToCurrentTiles(n):(r&&this.retrieveTileImage(n),t.isFirstLevel()?this.currentTiles.push(n):this.addAncestor(t,e,i,r))},c.prototype.addAncestor=function(t,e,i,r){for(var n=null,o=Math.floor(e/2),s=Math.floor(i/2),a=t.levelNumber-1;a>=0;a--){if(n=this.tileForLevel(a,o,s),this.isTileImageInMemory(n))return void this.addToCurrentTiles(n);o=Math.floor(o/2),s=Math.floor(s/2)}this.addToCurrentTiles(n),r&&this.retrieveTileImage(n)},c.prototype.addToCurrentTiles=function(t){this.currentTiles.push(t)},c.prototype.tileForLevel=function(t,e,i){var r=t+"."+e+"."+i,n=this.tileCache.entryForKey(r);if(n)return n;var o=this.levels.level(t),s=h.computeSector(o,e,i);return n=this.createTile(s,o,e,i),this.tileCache.putEntry(r,n,n.size()),n},c.prototype.isTileImageInMemory=function(t){return this.imageCache.containsKey(t.imagePath)},c.prototype.resourceUrlForTile=function(t){return this.urlBuilder.urlForTile(t,this.retrievalImageFormat)},c.prototype.retrieveTileImage=function(t){if(this.currentRetrievals.indexOf(t.imagePath)<0){var e=this.resourceUrlForTile(t,this.retrievalImageFormat),i=new XMLHttpRequest,r=this;if(!e)return;i.open("GET",e,!0),i.responseType="arraybuffer",i.onreadystatechange=function(){if(4===i.readyState){r.removeFromCurrentRetrievals(t.imagePath);var n=i.getResponseHeader("content-type");if(200===i.status)if(n===r.retrievalImageFormat||"text/plain"===n||"application/octet-stream"===n){s.log(s.LEVEL_INFO,"Elevations retrieval succeeded: "+e),r.loadElevationImage(t,i),r.absentResourceList.unmarkResourceAbsent(t.imagePath);var o=document.createEvent("Event");o.initEvent(WorldWind.REDRAW_EVENT_TYPE,!0,!0),window.dispatchEvent(o)}else"text/xml"===n?(r.absentResourceList.markResourceAbsent(t.imagePath),s.log(s.LEVEL_WARNING,"Elevations retrieval failed ("+i.statusText+"): "+e+".\n "+String.fromCharCode.apply(null,new Uint8Array(i.response)))):(r.absentResourceList.markResourceAbsent(t.imagePath),s.log(s.LEVEL_WARNING,"Elevations retrieval failed: "+e+". Unexpected content type "+n));else r.absentResourceList.markResourceAbsent(t.imagePath),s.log(s.LEVEL_WARNING,"Elevations retrieval failed ("+i.statusText+"): "+e)}},i.onerror=function(){r.removeFromCurrentRetrievals(t.imagePath),r.absentResourceList.markResourceAbsent(t.imagePath),s.log(s.LEVEL_WARNING,"Elevations retrieval failed: "+e)},i.ontimeout=function(){r.removeFromCurrentRetrievals(t.imagePath),r.absentResourceList.markResourceAbsent(t.imagePath),s.log(s.LEVEL_WARNING,"Elevations retrieval timed out: "+e)},i.send(null),this.currentRetrievals.push(t.imagePath)}},c.prototype.removeFromCurrentRetrievals=function(t){var e=this.currentRetrievals.indexOf(t);e>-1&&this.currentRetrievals.splice(e,1)},c.prototype.loadElevationImage=function(t,e){var i=new r(t.imagePath,t.sector,t.tileWidth,t.tileHeight);"application/bil16"==this.retrievalImageFormat?(i.imageData=new Int16Array(e.response),i.size=2*i.imageData.length):"application/bil32"==this.retrievalImageFormat&&(i.imageData=new Float32Array(e.response),i.size=4*i.imageData.length),i.imageData&&(i.findMinAndMaxElevation(),this.imageCache.putEntry(t.imagePath,i,i.size),this.timestamp=Date.now())},c}),i("projections/GeographicProjection",["../error/ArgumentError","../util/Logger","../geom/Sector","../error/UnsupportedOperationError"],function(t,e,i,r){"use strict";var n=function(t,e,i){this.displayName=t||"Geographic Projection",this.continuous=e,this.projectionLimits=i,this.is2D=!0};return n.prototype.geographicToCartesian=function(t,i,n,o,s,a){throw new r(e.logMessage(e.LEVEL_SEVERE,"GeographicProjection","geographicToCartesian","abstractInvocation"))},n.prototype.geographicToCartesianGrid=function(t,i,n,o,s,a,l,h){throw new r(e.logMessage(e.LEVEL_SEVERE,"GeographicProjection","geographicToCartesianGrid","abstractInvocation"))},n.prototype.cartesianToGeographic=function(t,i,n,o,s,a){throw new r(e.logMessage(e.LEVEL_SEVERE,"GeographicProjection","cartesianToGeographic","abstractInvocation"))},n.prototype.northTangentAtLocation=function(i,r,n,o){if(!o)throw new t(e.logMessage(e.LEVEL_SEVERE,"ProjectionEquirectangular","northTangentAtLocation","missingResult"));return o[0]=0,o[1]=1,o[2]=0,o},n.prototype.northTangentAtPoint=function(i,r,n,o,s,a){if(!a)throw new t(e.logMessage(e.LEVEL_SEVERE,"ProjectionEquirectangular","northTangentAtPoint","missingResult"));return a[0]=0,a[1]=1,a[2]=0,a},n.prototype.surfaceNormalAtPoint=function(i,r,n,o,s){if(!s)throw new t(e.logMessage(e.LEVEL_SEVERE,"GeographicProjection","surfaceNormalAtPoint","missingResult"));return s[0]=0,s[1]=0,s[2]=1,s},n}),i("projections/ProjectionWgs84",["../geom/Angle","../error/ArgumentError","../projections/GeographicProjection","../util/Logger","../geom/Position","../geom/Vec3","../util/WWMath"],function(t,e,i,r,n,o,s){"use strict";var a=function(){i.call(this,"WGS84",!1,null),this.is2D=!1,this.scratchPosition=new n(0,0,0)};return a.prototype=Object.create(i.prototype),Object.defineProperties(a.prototype,{stateKey:{get:function(){return"projection wgs84 "}}}),a.prototype.geographicToCartesian=function(i,n,o,s,a,l){if(!i)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionWgs84","geographicToCartesian","missingGlobe"));var h=Math.cos(n*t.DEGREES_TO_RADIANS),u=Math.sin(n*t.DEGREES_TO_RADIANS),c=Math.cos(o*t.DEGREES_TO_RADIANS),d=Math.sin(o*t.DEGREES_TO_RADIANS),p=i.equatorialRadius/Math.sqrt(1-i.eccentricitySquared*u*u);return l[0]=(p+s)*h*d,l[1]=(p*(1-i.eccentricitySquared)+s)*u,l[2]=(p+s)*h*c,l},a.prototype.geographicToCartesianGrid=function(i,n,s,a,l,h,u,c){if(!i)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionWgs84","geographicToCartesianGrid","missingGlobe"));var d,p,f,g,m,E,y,_,v=n.minLatitude*t.DEGREES_TO_RADIANS,S=n.maxLatitude*t.DEGREES_TO_RADIANS,b=n.minLongitude*t.DEGREES_TO_RADIANS,T=n.maxLongitude*t.DEGREES_TO_RADIANS,L=(S-v)/(s>1?s-1:1),w=(T-b)/(a>1?a-1:1),R=h||new o(0,0,0),x=0,M=0,C=new Float64Array(a),A=new Float64Array(a);for(p=0,g=b;p<a;p++,g+=w)p===a-1&&(g=T),C[p]=Math.cos(g),A[p]=Math.sin(g);for(d=0,f=v;d<s;d++,f+=L)for(d===s-1&&(f=S),y=Math.cos(f),_=Math.sin(f),m=i.equatorialRadius/Math.sqrt(1-i.eccentricitySquared*_*_),p=0;p<a;p++)E=l[x++],c[M++]=(m+E)*y*A[p]-R[0],c[M++]=(m*(1-i.eccentricitySquared)+E)*_-R[1],c[M++]=(m+E)*y*C[p]-R[2];return c},a.prototype.cartesianToGeographic=function(i,n,o,a,l,h){if(!i)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionWgs84","cartesianToGeographic","missingGlobe"));var u,c,d,p,f,g,m,E,y,_,v,S,b,T,L,w=a,R=n,x=o,M=w*w+R*R,C=Math.sqrt(M),A=i.equatorialRadius,P=1/(A*A),I=i.eccentricitySquared,O=I*I,N=M*P,D=x*x*(1-I)*P,k=(N+D-O)/6,V=8*k*k*k+O*N*D;return V>0||0!=D?(V>0?(p=Math.sqrt(V),f=Math.sqrt(O*N*D),V>10*I?(g=s.cbrt((p+f)*(p+f)),d=k+.5*g+2*k*k/g):d=k+.5*s.cbrt((p+f)*(p+f))+.5*s.cbrt((p-f)*(p-f))):(p=Math.sqrt(-V),f=Math.sqrt(-8*k*k*k),g=Math.sqrt(O*N*D),m=2*Math.atan2(g,p+f)/3,d=-4*k*Math.sin(m)*Math.cos(Math.PI/6+m)),E=Math.sqrt(d*d+O*D),y=I*(d+E-D)/(2*E),_=(d+E)/(Math.sqrt(y*y+d+E)+y),v=_*C/(_+I),S=Math.sqrt(v*v+x*x),u=(_+I-1)*S/_,
c=2*Math.atan2(x,S+v)):(p=Math.sqrt(1-I),f=Math.sqrt(I-N),b=Math.sqrt(I),u=-A*p*f/b,c=f/(b*f+p*Math.sqrt(N))),L=Math.sqrt(2),T=(L-1)*R<C+w?2*Math.atan2(R,C+w):C+R<(L+1)*w?.5*-Math.PI+2*Math.atan2(w,C-R):.5*Math.PI-2*Math.atan2(w,C+R),h.latitude=t.RADIANS_TO_DEGREES*c,h.longitude=t.RADIANS_TO_DEGREES*T,h.altitude=u,h},a.prototype.northTangentAtLocation=function(e,i,r,n){var o=Math.cos(i*t.DEGREES_TO_RADIANS),s=Math.cos(r*t.DEGREES_TO_RADIANS),a=Math.sin(i*t.DEGREES_TO_RADIANS),l=Math.sin(r*t.DEGREES_TO_RADIANS);return n[0]=-a*l,n[1]=o,n[2]=-a*s,n},a.prototype.northTangentAtPoint=function(t,e,i,r,n,s){return this.cartesianToGeographic(t,e,i,r,o.ZERO,this.scratchPosition),this.northTangentAtLocation(t,this.scratchPosition.latitude,this.scratchPosition.longitude,s)},a.prototype.surfaceNormalAtPoint=function(t,i,n,o,s){if(!t)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionWgs84","surfaceNormalAtPoint","missingGlobe"));var a=t.equatorialRadius*t.equatorialRadius,l=t.polarRadius*t.polarRadius;return s[0]=i/a,s[1]=n/l,s[2]=o/a,s.normalize()},a}),i("navigate/NavigatorState",["../error/ArgumentError","../geom/Frustum","../geom/Line","../util/Logger","../geom/Matrix","../geom/Rectangle","../geom/Vec2","../geom/Vec3","../util/WWMath"],function(t,e,i,r,n,o,s,a,l){"use strict";var h=function(t,i,r,o,s){this.modelview=t,this.projection=i,this.modelviewProjection=n.fromIdentity(),this.modelviewProjection.setToMultiply(i,t),this.viewport=r,this.heading=o,this.tilt=s,this.eyePoint=this.modelview.extractEyePoint(new a(0,0,0)),this.frustumInModelCoordinates=null;var h=n.fromIdentity();h.setToTransposeOfMatrix(this.modelview),this.frustumInModelCoordinates=e.fromProjectionMatrix(this.projection),this.frustumInModelCoordinates.transformByMatrix(h),this.frustumInModelCoordinates.normalize(),this.modelviewInv=n.fromIdentity(),this.modelviewInv.invertOrthonormalMatrix(this.modelview),this.projectionInv=n.fromIdentity(),this.projectionInv.invertMatrix(this.projection),this.modelviewProjectionInv=n.fromIdentity(),this.modelviewProjectionInv.invertMatrix(this.modelviewProjection),this.modelviewNormalTransform=n.fromIdentity().setToTransposeOfMatrix(this.modelviewInv.upper3By3());var u=new a(-1,-1,-1),c=new a(1,1,-1),d=new a(-1,-1,1),p=new a(1,1,1);u.multiplyByMatrix(this.projectionInv),c.multiplyByMatrix(this.projectionInv),d.multiplyByMatrix(this.projectionInv),p.multiplyByMatrix(this.projectionInv);var f=l.fabs(c[0]-u[0]),g=l.fabs(p[0]-d[0]),m=-u[2],E=-d[2],y=(g-f)/(E-m),_=f-y*m;this.pixelSizeScale=y/r.width,this.pixelSizeOffset=_/r.height};return h.prototype.project=function(e,i){if(!e)throw new t(r.logMessage(r.LEVEL_SEVERE,"NavigatorState","project","missingPoint"));if(!i)throw new t(r.logMessage(r.LEVEL_SEVERE,"NavigatorState","project","missingResult"));var n=e[0],o=e[1],s=e[2],a=this.modelviewProjection,l=a[0]*n+a[1]*o+a[2]*s+a[3],h=a[4]*n+a[5]*o+a[6]*s+a[7],u=a[8]*n+a[9]*o+a[10]*s+a[11],c=a[12]*n+a[13]*o+a[14]*s+a[15],d=this.viewport;return 0!=c&&(l/=c,h/=c,!((u/=c)<-1||u>1)&&(l=.5*l+.5,h=.5*h+.5,u=.5*u+.5,l=l*d.width+d.x,h=h*d.height+d.y,i[0]=l,i[1]=h,i[2]=u,!0))},h.prototype.projectWithDepth=function(e,i,n){if(!e)throw new t(r.logMessage(r.LEVEL_SEVERE,"NavigatorState","projectWithDepth","missingPoint"));if(!n)throw new t(r.logMessage(r.LEVEL_SEVERE,"NavigatorState","projectWithDepth","missingResult"));var o=e[0],s=e[1],a=e[2],h=this.modelview,u=h[0]*o+h[1]*s+h[2]*a+h[3],c=h[4]*o+h[5]*s+h[6]*a+h[7],d=h[8]*o+h[9]*s+h[10]*a+h[11],p=h[12]*o+h[13]*s+h[14]*a+h[15],f=this.projection,g=f[0]*u+f[1]*c+f[2]*d+f[3]*p,m=f[4]*u+f[5]*c+f[6]*d+f[7]*p,E=f[8]*u+f[9]*c+f[10]*d+f[11]*p,y=f[12]*u+f[13]*c+f[14]*d+f[15]*p,_=this.viewport;return 0!==y&&(g/=y,m/=y,!((E/=y)<-1||E>1)&&(E=f[8]*u+f[9]*c+f[10]*d*(1+i)+f[11]*p,E/=y,E=l.clamp(E,-1,1),g=.5*g+.5,m=.5*m+.5,E=.5*E+.5,g=g*_.width+_.x,m=m*_.height+_.y,n[0]=g,n[1]=m,n[2]=E,!0))},h.prototype.unProject=function(e,i){if(!e)throw new t(r.logMessage(r.LEVEL_SEVERE,"NavigatorState","unProject","missingPoint"));if(!i)throw new t(r.logMessage(r.LEVEL_SEVERE,"NavigatorState","unProject","missingResult"));var n=e[0],o=e[1],s=e[2],a=this.viewport;if(n=(n-a.x)/a.width,o=(o-a.y)/a.height,n=2*n-1,o=2*o-1,(s=2*s-1)<-1||s>1)return!1;var l=this.modelviewProjectionInv,h=l[0]*n+l[1]*o+l[2]*s+l[3],u=l[4]*n+l[5]*o+l[6]*s+l[7],c=l[8]*n+l[9]*o+l[10]*s+l[11],d=l[12]*n+l[13]*o+l[14]*s+l[15];return 0!==d&&(i[0]=h/d,i[1]=u/d,i[2]=c/d,!0)},h.prototype.convertPointToWindow=function(e,i){if(!e)throw new t(r.logMessage(r.LEVEL_SEVERE,"NavigatorState","convertPointToWindow","missingPoint"));if(!i)throw new t(r.logMessage(r.LEVEL_SEVERE,"NavigatorState","convertPointToWindow","missingResult"));return i[0]=e[0],i[1]=this.viewport.height-e[1],i},h.prototype.convertPointToViewport=function(e,i){if(!e)throw new t(r.logMessage(r.LEVEL_SEVERE,"NavigatorState","convertPointToViewport","missingPoint"));if(!i)throw new t(r.logMessage(r.LEVEL_SEVERE,"NavigatorState","convertPointToViewport","missingResult"));return i[0]=e[0],i[1]=this.viewport.height-e[1],i},h.prototype.rayFromScreenPoint=function(e){if(!e)throw new t(r.logMessage(r.LEVEL_SEVERE,"NavigatorState","rayFromScreenPoint","missingPoint"));var n=this.convertPointToViewport(e,new a(0,0,0)),o=new a(0,0,0),s=new a(0,0,0);if(!this.unProject(n,o))return null;if(n[2]=1,!this.unProject(n,s))return null;var l=new a(this.eyePoint[0],this.eyePoint[1],this.eyePoint[2]),h=new a(s[0],s[1],s[2]);return h.subtract(o),h.normalize(),new i(l,h)},h.prototype.pixelSizeAtDistance=function(t){return this.pixelSizeScale*t+this.pixelSizeOffset},h}),i("globe/Terrain",["../error/ArgumentError","../util/Logger","../geom/Vec3"],function(t,e,i){"use strict";var r=function(t,e,i,r){this.globe=t,this.verticalExaggeration=r,this.sector=i.sector,this.tessellator=e,this.surfaceGeometry=i.tileArray,this.stateKey=t.stateKey+" ve "+r.toString()};return r.scratchPoint=new i(0,0,0),r.prototype.surfacePoint=function(i,n,o,s){if(!s)throw new t(e.logMessage(e.LEVEL_SEVERE,"Terrain","surfacePoint","missingResult"));for(var a=0,l=this.surfaceGeometry.length;a<l;a++)if(this.surfaceGeometry[a].sector.containsLocation(i,n)){if(this.surfaceGeometry[a].surfacePoint(i,n,s),o){var h=this.globe.surfaceNormalAtPoint(s[0],s[1],s[2],r.scratchPoint);s[0]+=h[0]*o,s[1]+=h[1]*o,s[2]+=h[2]*o}return s}var u=o+this.globe.elevationAtLocation(i,n)*this.verticalExaggeration;return this.globe.computePointFromPosition(i,n,u,s),s},r.prototype.surfacePointForMode=function(i,r,n,o,s){if(!s)throw new t(e.logMessage(e.LEVEL_SEVERE,"Terrain","surfacePointForMode","missingResult"));if(o||(o=WorldWind.ABSOLUTE),o===WorldWind.CLAMP_TO_GROUND)return this.surfacePoint(i,r,0,s);if(o===WorldWind.RELATIVE_TO_GROUND)return this.surfacePoint(i,r,n,s);var a=n*this.verticalExaggeration;return this.globe.computePointFromPosition(i,r,a,s),s},r.prototype.beginRendering=function(t){this.globe&&this.globe.tessellator&&this.globe.tessellator.beginRendering(t)},r.prototype.endRendering=function(t){this.globe&&this.globe.tessellator&&this.globe.tessellator.endRendering(t)},r.prototype.beginRenderingTile=function(i,r){if(!r)throw new t(e.logMessage(e.LEVEL_SEVERE,"Terrain","beginRenderingTile","missingTile"));this.globe&&this.globe.tessellator&&this.globe.tessellator.beginRenderingTile(i,r)},r.prototype.endRenderingTile=function(t,e){},r.prototype.renderTile=function(i,r){if(!r)throw new t(e.logMessage(e.LEVEL_SEVERE,"Terrain","renderTile","missingTile"));this.globe&&this.globe.tessellator&&this.globe.tessellator.renderTile(i,r)},r.prototype.pick=function(t){this.globe&&this.globe.tessellator&&this.globe.tessellator.pick(t,this.surfaceGeometry,this)},r}),i("globe/TerrainTile",["../error/ArgumentError","../util/Logger","../geom/Matrix","../util/Tile"],function(t,e,i,r){"use strict";var n=function(t,e,n,o){r.call(this,t,e,n,o),this.transformationMatrix=i.fromIdentity(),this.points=null,this.pointsStateKey=null,this.pointsVboStateKey=null,this.neighborMap={},this.neighborMap[WorldWind.NORTH]=null,this.neighborMap[WorldWind.SOUTH]=null,this.neighborMap[WorldWind.EAST]=null,this.neighborMap[WorldWind.WEST]=null,this._stateKey=null,this._elevationTimestamp=null,this.scratchArray=[]};return n.prototype=Object.create(r.prototype),Object.defineProperties(n.prototype,{stateKey:{get:function(){return this._stateKey||(this._stateKey=this.computeStateKey()),this._stateKey}}}),n.prototype.neighborLevel=function(t){return this.neighborMap[t]},n.prototype.setNeighborLevel=function(t,e){this.neighborMap[t]=e,this._stateKey=null},n.prototype.surfacePoint=function(i,r,n){if(!n)throw new t(e.logMessage(e.LEVEL_SEVERE,"TerrainTile","surfacePoint","missingResult"));var o,s,a,l,h,u,c,d,p,f,g=this.sector,m=g.minLatitude,E=g.maxLatitude,y=g.minLongitude,_=g.maxLongitude,v=this.tileWidth,S=this.tileHeight;o=(r-y)/(_-y)*v,s=(i-m)/(E-m)*S,a=o<v?Math.floor(o):v-1,l=s<S?Math.floor(s):S-1,h=v+1,u=this.points,c=this.scratchArray,d=3*(a+l*h);for(var b=0;b<6;b++)c[b]=u[d+b];d=3*(a+(l+1)*h);for(var T=6;T<12;T++)c[T]=u[d+(T-6)];return p=o<v?o-Math.floor(o):1,f=s<S?s-Math.floor(s):1,p>f?(n[0]=c[0]+p*(c[3]-c[0])+f*(c[6]-c[0]),n[1]=c[1]+p*(c[4]-c[1])+f*(c[7]-c[1]),n[2]=c[2]+p*(c[5]-c[2])+f*(c[8]-c[2])):(n[0]=c[9]+(1-p)*(c[6]-c[9])+(1-f)*(c[3]-c[9]),n[1]=c[10]+(1-p)*(c[7]-c[10])+(1-f)*(c[4]-c[10]),n[2]=c[11]+(1-p)*(c[8]-c[11])+(1-f)*(c[5]-c[11])),n[0]+=this.referencePoint[0],n[1]+=this.referencePoint[1],n[2]+=this.referencePoint[2],n},n.prototype.update=function(t){r.prototype.update.call(this,t);var e=t.globe.elevationTimestamp();this._elevationTimestamp!=e&&(this._elevationTimestamp=e,this._stateKey=null)},n.prototype.computeStateKey=function(){var t=[];return t.push(this._elevationTimestamp),t.push(this.neighborMap[WorldWind.NORTH]?this.neighborMap[WorldWind.NORTH].compare(this.level):0),t.push(this.neighborMap[WorldWind.SOUTH]?this.neighborMap[WorldWind.SOUTH].compare(this.level):0),t.push(this.neighborMap[WorldWind.EAST]?this.neighborMap[WorldWind.EAST].compare(this.level):0),t.push(this.neighborMap[WorldWind.WEST]?this.neighborMap[WorldWind.WEST].compare(this.level):0),t.join(".")},n}),i("globe/TerrainTileList",["../error/ArgumentError","../util/Logger","../geom/Sector"],function(t,e,i){"use strict";var r=function(i){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"TerrainTileList","TerrainTileList","missingTessellator"));this.tessellator=i,this.sector=null,this.tileArray=[]};return Object.defineProperties(r.prototype,{length:{get:function(){return this.tileArray.length}}}),r.prototype.addTile=function(r){if(!r)throw new t(e.logMessage(e.LEVEL_SEVERE,"TerrainTileList","addTile","missingTile"));-1==this.tileArray.indexOf(r)&&(this.tileArray.push(r),this.sector?this.sector.union(r.sector):(this.sector=new i(0,0,0,0),this.sector.copy(r.sector)))},r.prototype.removeAllTiles=function(){this.tileArray=[],this.sector=null},r}),i("globe/Tessellator",["../error/ArgumentError","../shaders/BasicProgram","../globe/Globe","../shaders/GpuProgram","../util/Level","../util/LevelSet","../geom/Location","../util/Logger","../geom/Matrix","../cache/MemoryCache","../navigate/NavigatorState","../error/NotYetImplementedError","../pick/PickedObject","../geom/Position","../geom/Rectangle","../geom/Sector","../globe/Terrain","../globe/TerrainTile","../globe/TerrainTileList","../util/Tile","../util/WWMath","../util/WWUtil"],function(t,e,i,r,n,o,s,a,l,h,u,c,d,p,f,g,m,E,y,_,v,S){"use strict";var b=function(){this.numRowsTilesInTopLevel=4,this.numColumnsTilesInTopLevel=8,this.maximumSubdivisionDepth=15,this.tileWidth=32,this.tileHeight=32,this.detailControl=40,this.levels=new o(g.FULL_SPHERE,new s(180/this.numRowsTilesInTopLevel,360/this.numColumnsTilesInTopLevel),this.maximumSubdivisionDepth,this.tileWidth,this.tileHeight),this.topLevelTiles={},this.currentTiles=new y(this),this.tileCache=new h(5e6,4e6),this.elevationTimestamp=void 0,this.lastModelViewProjection=void 0,this.vertexPointLocation=-1,this.vertexTexCoordLocation=-1,this.texCoords=null,this.texCoordVboCacheKey="global_tex_coords",this.indices=null,this.indicesVboCacheKey="global_indices",this.baseIndices=null,this.baseIndicesOffset=null,this.numBaseIndices=null,this.indicesNorth=null,this.indicesNorthOffset=null,this.numIndicesNorth=null,this.indicesSouth=null,this.indicesSouthOffset=null,this.numIndicesSouth=null,this.indicesWest=null,this.indicesWestOffset=null,this.numIndicesWest=null,this.indicesEast=null,this.indicesEastOffset=null,this.numIndicesEast=null,this.indicesLoresNorth=null,this.indicesLoresNorthOffset=null,this.numIndicesLoresNorth=null,this.indicesLoresSouth=null,this.indicesLoresSouthOffset=null,this.numIndicesLoresSouth=null,this.indicesLoresWest=null,this.indicesLoresWestOffset=null,this.numIndicesLoresWest=null,this.indicesLoresEast=null,this.indicesLoresEastOffset=null,this.numIndicesLoresEast=null,this.outlineIndicesOffset=null,this.numOutlineIndices=null,this.wireframeIndicesOffset=null,this.numWireframeIndices=null,this.scratchMatrix=l.fromIdentity(),this.scratchElevations=null,this.scratchPrevElevations=null,this.corners={},this.tiles=[]};return b.prototype.tessellate=function(e){if(!e)throw new t(a.logMessage(a.LEVEL_SEVERE,"Tessellator","tessellate","missingDC"));var i=e.globe.elevationTimestamp();if(this.lastGlobeStateKey===e.globeStateKey&&this.lastVerticalExaggeration===e.verticalExaggeration&&this.elevationTimestamp===i&&this.lastModelViewProjection&&e.navigatorState.modelviewProjection.equals(this.lastModelViewProjection))return this.lastTerrain;var r=e.navigatorState;this.lastModelViewProjection=r.modelviewProjection,this.lastGlobeStateKey=e.globeStateKey,this.elevationTimestamp=i,this.lastVerticalExaggeration=e.verticalExaggeration,this.currentTiles.removeAllTiles(),this.topLevelTiles[e.globeStateKey]&&0!=this.topLevelTiles[e.globeStateKey].length||this.createTopLevelTiles(e),this.corners={},this.tiles=[];for(var n=0,o=this.topLevelTiles[e.globeStateKey].length;n<o;n+=1){var s=this.topLevelTiles[e.globeStateKey][n];s.update(e),this.isTileVisible(e,s)&&this.addTileOrDescendants(e,s)}return this.refineNeighbors(e),this.finishTessellating(e),this.lastTerrain=0===this.currentTiles.length?null:new m(e.globe,this,this.currentTiles,e.verticalExaggeration),this.lastTerrain},b.prototype.createTile=function(e,i,r,n){if(!e)throw new t(a.logMessage(a.LEVEL_SEVERE,"Tile","constructor","missingSector"));if(!i)throw new t(a.logMessage(a.LEVEL_SEVERE,"Tile","constructor","The specified level is null or undefined."));if(r<0||n<0)throw new t(a.logMessage(a.LEVEL_SEVERE,"Tile","constructor","The specified row or column is less than zero."));return new E(e,i,r,n)},b.prototype.beginRendering=function(t){var e=t.currentProgram;if(!e)return void a.logMessage(a.LEVEL_INFO,"Tessellator","beginRendering","Current Program is empty");this.buildSharedGeometry(),this.cacheSharedGeometryVBOs(t);var i=t.currentGlContext,r=t.gpuResourceCache;if(this.vertexPointLocation=e.attributeLocation(i,"vertexPoint"),this.vertexTexCoordLocation=e.attributeLocation(i,"vertexTexCoord"),i.enableVertexAttribArray(this.vertexPointLocation),this.vertexTexCoordLocation>=0){var n=r.resourceForKey(this.texCoordVboCacheKey);i.bindBuffer(i.ARRAY_BUFFER,n),i.vertexAttribPointer(this.vertexTexCoordLocation,2,i.FLOAT,!1,0,0),i.enableVertexAttribArray(this.vertexTexCoordLocation)}var o=r.resourceForKey(this.indicesVboCacheKey);i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,o)},b.prototype.endRendering=function(t){var e=t.currentGlContext;e.bindBuffer(e.ARRAY_BUFFER,null),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,null),this.vertexPointLocation>=0&&e.disableVertexAttribArray(this.vertexPointLocation),this.vertexTexCoordLocation>=0&&e.disableVertexAttribArray(this.vertexTexCoordLocation)},b.prototype.beginRenderingTile=function(e,i){if(!i)throw new t(a.logMessage(a.LEVEL_SEVERE,"Tessellator","beginRenderingTile","missingTile"));var r=e.currentGlContext,n=e.gpuResourceCache;this.scratchMatrix.setToMultiply(e.navigatorState.modelviewProjection,i.transformationMatrix),e.currentProgram.loadModelviewProjection(r,this.scratchMatrix);var o=e.globeStateKey+i.tileKey,s=n.resourceForKey(o);s?i.pointsVboStateKey!=i.pointsStateKey?(r.bindBuffer(r.ARRAY_BUFFER,s),r.bufferSubData(r.ARRAY_BUFFER,0,i.points),i.pointsVboStateKey=i.pointsStateKey):e.currentGlContext.bindBuffer(r.ARRAY_BUFFER,s):(s=r.createBuffer(),r.bindBuffer(r.ARRAY_BUFFER,s),r.bufferData(r.ARRAY_BUFFER,i.points,r.STATIC_DRAW),e.frameStatistics.incrementVboLoadCount(1),n.putResource(o,s,4*i.points.length),i.pointsVboStateKey=i.pointsStateKey),r.vertexAttribPointer(this.vertexPointLocation,3,r.FLOAT,!1,0,0)},b.prototype.endRenderingTile=function(t,e){},b.prototype.renderTile=function(e,i){if(!i)throw new t(a.logMessage(a.LEVEL_SEVERE,"Tessellator","renderTile","missingTile"));var r=e.currentGlContext,n=r.TRIANGLE_STRIP;r.drawElements(n,this.numBaseIndices,r.UNSIGNED_SHORT,2*this.baseIndicesOffset);var o,s=i.level;o=i.neighborLevel(WorldWind.NORTH),o&&o.compare(s)<0?r.drawElements(n,this.numIndicesLoresNorth,r.UNSIGNED_SHORT,2*this.indicesLoresNorthOffset):r.drawElements(n,this.numIndicesNorth,r.UNSIGNED_SHORT,2*this.indicesNorthOffset),o=i.neighborLevel(WorldWind.SOUTH),o&&o.compare(s)<0?r.drawElements(n,this.numIndicesLoresSouth,r.UNSIGNED_SHORT,2*this.indicesLoresSouthOffset):r.drawElements(n,this.numIndicesSouth,r.UNSIGNED_SHORT,2*this.indicesSouthOffset),o=i.neighborLevel(WorldWind.WEST),o&&o.compare(s)<0?r.drawElements(n,this.numIndicesLoresWest,r.UNSIGNED_SHORT,2*this.indicesLoresWestOffset):r.drawElements(n,this.numIndicesWest,r.UNSIGNED_SHORT,2*this.indicesWestOffset),o=i.neighborLevel(WorldWind.EAST),o&&o.compare(s)<0?r.drawElements(n,this.numIndicesLoresEast,r.UNSIGNED_SHORT,2*this.indicesLoresEastOffset):r.drawElements(n,this.numIndicesEast,r.UNSIGNED_SHORT,2*this.indicesEastOffset)},b.prototype.renderWireframeTile=function(e,i){if(!i)throw new t(a.logMessage(a.LEVEL_SEVERE,"Tessellator","renderWireframeTile","missingTile"));var r=e.currentGlContext;this.vertexTexCoordLocation>=0&&r.disableVertexAttribArray(this.vertexTexCoordLocation),r.drawElements(r.LINES,this.numWireframeIndices,r.UNSIGNED_SHORT,2*this.wireframeIndicesOffset)},b.prototype.renderTileOutline=function(e,i){if(!i)throw new t(a.logMessage(a.LEVEL_SEVERE,"Tessellator","renderTileOutline","missingTile"));var r=e.currentGlContext;this.vertexTexCoordLocation>=0&&r.disableVertexAttribArray(this.vertexTexCoordLocation),r.drawElements(r.LINE_LOOP,this.numOutlineIndices,r.UNSIGNED_SHORT,2*this.outlineIndicesOffset)},b.prototype.pick=function(e,i,r){if(!e)throw new t(a.logMessage(a.LEVEL_SEVERE,"Tessellator","pick","missingDc"));if(!i)throw new t(a.logMessage(a.LEVEL_SEVERE,"Tessellator","pick","missingList"));for(var n=null,o=r||this,s=new p(0,0,0),l=[],h=0,u=i.length;h<u;h++){var c=i[h];c.extent.intersectsFrustum(e.pickFrustum)&&l.push(c)}if(e.pickTerrainOnly||(n=e.uniquePickColor(),this.drawPickTiles(e,l,n)),!e.regionPicking){var f=e.navigatorState.rayFromScreenPoint(e.pickPoint),g=this.computeNearestIntersection(f,l);g&&(e.globe.computePositionFromPoint(g[0],g[1],g[2],s),s.altitude=e.globe.elevationAtLocation(s.latitude,s.longitude),e.addPickedObject(new d(n,o,s,null,!0)))}},b.prototype.drawPickTiles=function(t,i,r){var n=t.currentGlContext;try{t.findAndBindProgram(e),t.currentProgram.loadColor(n,r),this.beginRendering(t);for(var o=0,s=i.length;o<s;o++){var a=i[o];this.beginRenderingTile(t,a),this.renderTile(t,a),this.endRenderingTile(t,a)}}finally{this.endRendering(t)}},b.prototype.computeNearestIntersection=function(t,e){for(var i=[],r=0,n=e.length;r<n;r++)this.computeIntersections(t,e[r],i);if(0==i.length)return null;var o,s=Number.POSITIVE_INFINITY;for(r=0,n=i.length;r<n;r++){var a=t.origin.distanceToSquared(i[r]);s>a&&(s=a,o=r)}return i[o]},b.prototype.computeIntersections=function(t,e,i){var r,n,o=e.level,s=e.points,a=i.length;t.origin.subtract(e.referencePoint),this.buildSharedGeometry(e),n=this.baseIndices,v.computeTriStripIntersections(t,s,n,i),r=e.neighborLevel(WorldWind.SOUTH),n=r&&r.compare(o)<0?this.indicesLoresSouth:this.indicesSouth,v.computeTriStripIntersections(t,s,n,i),r=e.neighborLevel(WorldWind.WEST),n=r&&r.compare(o)<0?this.indicesLoresWest:this.indicesWest,v.computeTriStripIntersections(t,s,n,i),r=e.neighborLevel(WorldWind.EAST),n=r&&r.compare(o)<0?this.indicesLoresEast:this.indicesEast,v.computeTriStripIntersections(t,s,n,i),r=e.neighborLevel(WorldWind.NORTH),n=r&&r.compare(o)<0?this.indicesLoresNorth:this.indicesNorth,v.computeTriStripIntersections(t,s,n,i),t.origin.add(e.referencePoint);for(var l=a,h=i.length;l<h;l++)i[l].add(e.referencePoint)},b.prototype.createTopLevelTiles=function(t){this.topLevelTiles[t.globeStateKey]=[],_.createTilesForLevel(this.levels.firstLevel(),this,this.topLevelTiles[t.globeStateKey])},b.prototype.addTileOrDescendants=function(t,e){if(this.tileMeetsRenderCriteria(t,e))return void this.addTile(t,e);this.addTileDescendants(t,e)},b.prototype.addTileDescendants=function(t,e){for(var i=e.level.nextLevel(),r=e.subdivideToCache(i,this,this.tileCache),n=0;n<r.length;n+=1){var o=r[n];o.update(t),this.levels.sector.intersects(o.sector)&&this.isTileVisible(t,o)&&this.addTileOrDescendants(t,o)}},b.prototype.addTile=function(t,e){var i=this.tiles.length;this.tiles.push(e);var r,n=e.sector,o=[n.maxLatitude,n.maxLongitude].toString(),s=[n.minLatitude,n.maxLongitude].toString(),a=[n.maxLatitude,n.minLongitude].toString(),l=[n.minLatitude,n.minLongitude].toString();r=this.corners[l],r?r.sw=i:this.corners[l]={sw:i},r=this.corners[a],r?r.nw=i:this.corners[a]={nw:i},r=this.corners[s],r?r.se=i:this.corners[s]={se:i},r=this.corners[o],r?r.ne=i:this.corners[o]={ne:i}},b.prototype.refineNeighbors=function(t){for(var e={},i=0,r=this.tiles.length;i<r;i+=1){var n,o,i,r,s=this.tiles[i],a=s.level.levelNumber,l=s.sector,h=[l.maxLatitude,l.maxLongitude].toString(),u=[l.minLatitude,l.maxLongitude].toString(),c=[l.maxLatitude,l.minLongitude].toString(),d=[l.minLatitude,l.minLongitude].toString();n=this.corners[h],n.hasOwnProperty("se")&&(o=n.se,this.tiles[o].level.levelNumber<a-1&&(e[o]||(e[o]=!0))),n.hasOwnProperty("nw")&&(o=n.nw,this.tiles[o].level.levelNumber<a-1&&(e[o]||(e[o]=!0))),n=this.corners[u],n.hasOwnProperty("ne")&&(o=n.ne,this.tiles[o].level.levelNumber<a-1&&(e[o]||(e[o]=!0))),n.hasOwnProperty("sw")&&(o=n.sw,this.tiles[o].level.levelNumber<a-1&&(e[o]||(e[o]=!0))),n=this.corners[c],n.hasOwnProperty("ne")&&(o=n.ne,this.tiles[o].level.levelNumber<a-1&&(e[o]||(e[o]=!0))),n.hasOwnProperty("sw")&&(o=n.sw,this.tiles[o].level.levelNumber<a-1&&(e[o]||(e[o]=!0))),n=this.corners[d],n.hasOwnProperty("se")&&(o=n.se,this.tiles[o].level.levelNumber<a-1&&(e[o]||(e[o]=!0))),n.hasOwnProperty("nw")&&(o=n.nw,this.tiles[o].level.levelNumber<a-1&&(e[o]||(e[o]=!0)))}var p=[],f=[];for(i=0,r=this.tiles.length;i<r;i+=1)s=this.tiles[i],e[i]?p.push(s):f.push(s);if(p.length>0){for(this.tiles=[],this.corners={},i=0,r=f.length;i<r;i+=1)s=f[i],this.addTile(t,s);for(i=0,r=p.length;i<r;i+=1){var s=p[i];this.addTileDescendants(t,s)}this.refineNeighbors(t)}},b.prototype.finishTessellating=function(t){for(var e=0,i=this.tiles.length;e<i;e+=1){var r=this.tiles[e];this.setNeighbors(r),this.regenerateTileGeometryIfNeeded(t,r),this.currentTiles.addTile(r)}},b.prototype.setNeighbors=function(t){var e=t.sector,i=[e.maxLatitude,e.maxLongitude].toString(),r=[e.minLatitude,e.maxLongitude].toString(),n=[e.maxLatitude,e.minLongitude].toString(),o=[e.minLatitude,e.minLongitude].toString(),s=this.corners[i],a=this.corners[r],l=this.corners[n],h=this.corners[o],u=-1,c=-1,d=-1,p=-1;s.hasOwnProperty("se")?u=s.se:l.hasOwnProperty("sw")&&(u=l.sw),a.hasOwnProperty("ne")?c=a.ne:h.hasOwnProperty("nw")&&(c=h.nw),s.hasOwnProperty("nw")?d=s.nw:a.hasOwnProperty("sw")&&(d=a.sw),l.hasOwnProperty("ne")?p=l.ne:h.hasOwnProperty("se")&&(p=h.se),t.setNeighborLevel(WorldWind.NORTH,u>=0?this.tiles[u].level:null),t.setNeighborLevel(WorldWind.SOUTH,c>=0?this.tiles[c].level:null),t.setNeighborLevel(WorldWind.EAST,d>=0?this.tiles[d].level:null),t.setNeighborLevel(WorldWind.WEST,p>=0?this.tiles[p].level:null)},b.prototype.isTileVisible=function(t,e){return!(t.globe.projectionLimits&&!e.sector.overlaps(t.globe.projectionLimits))&&e.extent.intersectsFrustum(t.navigatorState.frustumInModelCoordinates)},b.prototype.tileMeetsRenderCriteria=function(t,e){var i=this.detailControl;return(e.sector.minLatitude>=75||e.sector.maxLatitude<=-75)&&(i*=2),e.level.isLastLevel()||!e.mustSubdivide(t,i)},b.prototype.regenerateTileGeometryIfNeeded=function(t,e){var i=t.globeStateKey+e.stateKey+t.verticalExaggeration;e.points&&e.pointsStateKey==i||(this.regenerateTileGeometry(t,e),e.pointsStateKey=i)},b.prototype.regenerateTileGeometry=function(t,e){var i=e.tileHeight+1,r=e.tileWidth+1,n=e.referencePoint,o=this.scratchElevations;o||(o=new Float64Array(i*r),this.scratchElevations=o),e.points||(e.points=new Float32Array(i*r*3)),S.fillArray(o,0),t.globe.elevationsForGrid(e.sector,i,r,e.texelSize,o),this.mustAlignNeighborElevations(t,e)&&this.alignNeighborElevations(t,e,o),S.multiplyArray(o,t.verticalExaggeration),t.globe.computePointsForGrid(e.sector,i,r,o,n,e.points),e.transformationMatrix.setTranslation(n[0],n[1],n[2])},b.prototype.mustAlignNeighborElevations=function(t,e){var i=e.level,r=e.neighborLevel(WorldWind.NORTH),n=e.neighborLevel(WorldWind.SOUTH),o=e.neighborLevel(WorldWind.EAST),s=e.neighborLevel(WorldWind.WEST);return r&&r.compare(i)<0||n&&n.compare(i)<0||o&&o.compare(i)<0||s&&s.compare(i)<0},b.prototype.alignNeighborElevations=function(t,e,i){var r,n,o,s,a=e.tileHeight+1,l=e.tileWidth+1,h=e.level,u=Math.floor(a/2)+1,c=Math.floor(l/2)+1,d=h.previousLevel(),p=this.scratchPrevElevations;if(p||(p=new Float64Array(u*c),this.scratchPrevElevations=p),S.fillArray(p,0),t.globe.elevationsForGrid(e.sector,u,c,d.texelSize,p),(r=e.neighborLevel(WorldWind.NORTH))&&r.compare(h)<0)for(o=(a-1)*l,s=(u-1)*c,n=0;n<c;n++,o+=2,s+=1)i[o]=p[s],n<c-1&&(i[o+1]=.5*(p[s]+p[s+1]));if((r=e.neighborLevel(WorldWind.SOUTH))&&r.compare(h)<0)for(o=0,s=0,n=0;n<c;n++,o+=2,s+=1)i[o]=p[s],n<c-1&&(i[o+1]=.5*(p[s]+p[s+1]));if((r=e.neighborLevel(WorldWind.EAST))&&r.compare(h)<0)for(o=l-1,s=c-1,n=0;n<u;n++,o+=2*l,s+=c)i[o]=p[s],n<u-1&&(i[o+l]=.5*(p[s]+p[s+c]));if((r=e.neighborLevel(WorldWind.WEST))&&r.compare(h)<0)for(o=0,s=0,n=0;n<u;n++,o+=2*l,s+=c)i[o]=p[s],n<u-1&&(i[o+l]=.5*(p[s]+p[s+c]))},b.prototype.buildSharedGeometry=function(){var t=this.levels.tileWidth,e=this.levels.tileHeight;this.texCoords||this.buildTexCoords(t,e),this.indices||this.buildIndices(t,e)},b.prototype.buildTexCoords=function(t,e){for(var i=t+1,r=e+1,n=1/t,o=1/e,s=new Float32Array(i*r*2),a=0,l=0,h=0;l<r;l++,h+=o){l==r-1&&(h=1);for(var u=0,c=0;u<i;u++,c+=n)u==i-1&&(c=1),s[a++]=c,s[a++]=h}this.texCoords=s},b.prototype.buildIndices=function(t,e){for(var i,r=e+1,n=t+1,o=2*(r-3)*(n-2)+2*(r-3),s=[],a=0,l=1;l<n-2;l+=1){for(var h=1;h<r-1;h+=1)i=l+h*n,s[a++]=i,s[a++]=i+1;s[a++]=i+1,i=l+1+1*n,s[a++]=i}for(this.baseIndicesOffset=s.length-o,this.baseIndices=new Uint16Array(s.slice(this.baseIndicesOffset)),this.numBaseIndices=o,o=2*n-2,h=r-1,l=n-1,i=l+h*n,s[a++]=i,l=n-2;l>0;l-=1)i=l+h*n,s[a++]=i,s[a++]=i-n;for(l=0,i=l+h*n,s[a++]=i,this.indicesNorthOffset=s.length-o,this.indicesNorth=new Uint16Array(s.slice(this.indicesNorthOffset)),this.numIndicesNorth=o,o=2*n-2,h=0,l=0,i=l+h*n,s[a++]=i,l=1;l<n-1;l+=1)i=l+h*n,s[a++]=i,s[a++]=i+n;for(l=n-1,i=l+h*n,s[a++]=i,this.indicesSouthOffset=s.length-o,this.indicesSouth=new Uint16Array(s.slice(this.indicesSouthOffset)),this.numIndicesSouth=o,o=2*r-2,l=0,h=r-1,i=l+h*n,s[a++]=i,h=r-2;h>0;h-=1)i=l+h*n,s[a++]=i,s[a++]=i+1;for(h=0,i=l+h*n,s[a++]=i,this.indicesWestOffset=s.length-o,this.indicesWest=new Uint16Array(s.slice(this.indicesWestOffset)),this.numIndicesWest=o,o=2*r-2,l=n-1,h=0,i=l+h*n,s[a++]=i,h=1;h<r-1;h+=1)i=l+h*n,s[a++]=i,s[a++]=i-1;for(h=r-1,i=l+h*n,s[a++]=i,this.indicesEastOffset=s.length-o,this.indicesEast=new Uint16Array(s.slice(this.indicesEastOffset)),this.numIndicesEast=o,o=2*n-2,h=r-1,l=n-1,i=l+h*n,s[a++]=i,l=n-2;l>0;l-=1)i=(l+1&-2)+h*n,s[a++]=i,i=l+(h-1)*n,s[a++]=i;for(l=0,i=l+h*n,s[a++]=i,this.indicesLoresNorthOffset=s.length-o,this.indicesLoresNorth=new Uint16Array(s.slice(this.indicesLoresNorthOffset)),this.numIndicesLoresNorth=o,o=2*n-2,h=0,l=0,i=l+h*n,s[a++]=i,l=1;l<n-1;l+=1)i=(-2&l)+h*n,s[a++]=i,i=l+(h+1)*n,s[a++]=i;for(l=n-1,i=l+h*n,s[a++]=i,this.indicesLoresSouthOffset=s.length-o,this.indicesLoresSouth=new Uint16Array(s.slice(this.indicesLoresSouthOffset)),this.numIndicesLoresSouth=o,o=2*r-2,l=0,h=r-1,i=l+h*n,s[a++]=i,h=r-2;h>0;h-=1)i=l+(h+1&-2)*n,s[a++]=i,i=l+1+h*n,s[a++]=i;for(h=0,i=l+h*n,s[a++]=i,this.indicesLoresWestOffset=s.length-o,this.indicesLoresWest=new Uint16Array(s.slice(this.indicesLoresWestOffset)),this.numIndicesLoresWest=o,o=2*r-2,l=n-1,h=0,i=l+h*n,s[a++]=i,h=1;h<r-1;h+=1)i=l+(-2&h)*n,s[a++]=i,i=l-1+h*n,s[a++]=i;h=r-1,i=l+h*n,s[a++]=i,this.indicesLoresEastOffset=s.length-o,this.indicesLoresEast=new Uint16Array(s.slice(this.indicesLoresEastOffset)),this.numIndicesLoresEast=o;var u=this.buildWireframeIndices(t,e),c=this.buildOutlineIndices(t,e);s=s.concat(u),this.wireframeIndicesOffset=s.length-this.numWireframeIndices,s=s.concat(c),this.outlineIndicesOffset=s.length-this.numOutlineIndices,this.indices=new Uint16Array(s)},b.prototype.buildWireframeIndices=function(t,e){var i,r,n,o=e+1,s=t+1,a=2*t*o+2*e*s,l=[],h=s,u=0;for(r=0;r<o;r+=1)for(i=0;i<t;i+=1)n=i+r*h,l[u]=n,l[u+1]=n+1,u+=2;for(i=0;i<s;i+=1)for(r=0;r<e;r+=1)n=i+r*h,l[u]=n,l[u+1]=n+h,u+=2;return this.numWireframeIndices=a,l},b.prototype.buildOutlineIndices=function(t,e){var i,r,n,o=e+1,s=t+1,a=2*(o-2)+2*s+1,l=[],h=0;for(r=0,i=0;i<s;i+=1)n=i+r*s,l[h]=n,h+=1;for(i=s-1,r=1;r<o;r+=1)n=i+r*s,l[h]=n,h+=1;for(r=o-1,i=s-1;i>=0;i-=1)n=i+r*s,l[h]=n,h+=1;for(i=0,r=o-1;r>=0;r-=1)n=i+r*s,l[h]=n,h+=1;return this.numOutlineIndices=a,l},b.prototype.cacheSharedGeometryVBOs=function(t){var e=t.currentGlContext,i=t.gpuResourceCache,r=i.resourceForKey(this.texCoordVboCacheKey);r||(r=e.createBuffer(),e.bindBuffer(e.ARRAY_BUFFER,r),e.bufferData(e.ARRAY_BUFFER,this.texCoords,e.STATIC_DRAW),t.frameStatistics.incrementVboLoadCount(1),i.putResource(this.texCoordVboCacheKey,r,4*this.texCoords.length/2));var n=i.resourceForKey(this.indicesVboCacheKey);n||(n=e.createBuffer(),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n),e.bufferData(e.ELEMENT_ARRAY_BUFFER,this.indices,e.STATIC_DRAW),t.frameStatistics.incrementVboLoadCount(1),i.putResource(this.indicesVboCacheKey,n,2*this.indices.length))},b}),i("globe/Globe",["../geom/Angle","../error/ArgumentError","../geom/BoundingBox","../globe/ElevationModel","../geom/Line","../geom/Location","../util/Logger","../geom/Position","../projections/ProjectionWgs84","../geom/Sector","../globe/Tessellator","../geom/Vec3","../util/WWMath"],function(t,e,i,r,n,o,s,a,l,h,u,c,d){"use strict";var p=function(t,i){if(!t)throw new e(s.logMessage(s.LEVEL_SEVERE,"Globe","constructor","Elevation model is null or undefined."));this.elevationModel=t,this.equatorialRadius=6378137,this.polarRadius=6356752.3,this.eccentricitySquared=.00669437999013,this.tessellator=new u,this._projection=i||new l,this._offset=0,this.offsetVector=new c(0,0,0),this.id=++p.idPool,this._stateKey="globe "+this.id.toString()+" "};return p.idPool=0,Object.defineProperties(p.prototype,{stateKey:{get:function(){return this._stateKey+this.elevationModel.stateKey+"offset "+this.offset.toString()+" "+this.projection.stateKey}},continuous:{get:function(){return this.projection.continuous}},projection:{get:function(){return this._projection},set:function(t){if(!t)throw new e(s.logMessage(s.LEVEL_SEVERE,"Globe","projection","missingProjection"));this.projection!=t&&(this.tessellator=new u),this._projection=t}},projectionLimits:{get:function(){return this._projection.projectionLimits}},offset:{get:function(){return this._offset},set:function(t){this._offset=t,this.offsetVector[0]=2*t*Math.PI*this.equatorialRadius}}}),p.prototype.is2D=function(){return this.projection.is2D},
p.prototype.computePointFromPosition=function(t,i,r,n){if(!n)throw new e(s.logMessage(s.LEVEL_SEVERE,"Globe","computePointFromPosition","missingResult"));return this.projection.geographicToCartesian(this,t,i,r,this.offsetVector,n)},p.prototype.computePointFromLocation=function(t,i,r){if(!r)throw new e(s.logMessage(s.LEVEL_SEVERE,"Globe","computePointFromLocation","missingResult"));return this.computePointFromPosition(t,i,0,r)},p.prototype.computePointsForGrid=function(t,i,r,n,o,a){if(!t)throw new e(s.logMessage(s.LEVEL_SEVERE,"Globe","computePointsFromPositions","missingSector"));if(i<1||r<1)throw new e(s.logMessage(s.LEVEL_SEVERE,"Globe","computePointsFromPositions","Number of latitude or longitude locations is less than one."));var l=i*r;if(!n||n.length<l)throw new e(s.logMessage(s.LEVEL_SEVERE,"Globe","computePointsFromPositions","Elevations array is null, undefined or insufficient length."));if(!a||a.length<l)throw new e(s.logMessage(s.LEVEL_SEVERE,"Globe","computePointsFromPositions","Result array is null, undefined or insufficient length."));return this.projection.geographicToCartesianGrid(this,t,i,r,n,o,this.offsetVector,a)},p.prototype.computePositionFromPoint=function(t,i,r,n){if(!n)throw new e(s.logMessage(s.LEVEL_SEVERE,"Globe","computePositionFromPoint","missingResult"));return this.projection.cartesianToGeographic(this,t,i,r,this.offsetVector,n),this.continuous&&(n.longitude<-180?n.longitude+=360:n.longitude>180&&(n.longitude-=360)),n},p.prototype.radiusAt=function(e,i){var r=Math.sin(e*t.DEGREES_TO_RADIANS);return this.equatorialRadius/Math.sqrt(1-this.eccentricitySquared*r*r)*Math.sqrt(1+(this.eccentricitySquared*this.eccentricitySquared-2*this.eccentricitySquared)*r*r)},p.prototype.surfaceNormalAtLocation=function(i,r,n){if(!n)throw new e(s.logMessage(s.LEVEL_SEVERE,"Globe","surfaceNormalAtLocation","missingResult"));if(this.is2D())return n[0]=0,n[1]=0,n[2]=1,n;var o=Math.cos(i*t.DEGREES_TO_RADIANS),a=Math.cos(r*t.DEGREES_TO_RADIANS),l=Math.sin(i*t.DEGREES_TO_RADIANS),h=Math.sin(r*t.DEGREES_TO_RADIANS),u=this.equatorialRadius*this.equatorialRadius,c=this.polarRadius*this.polarRadius;return n[0]=o*h/u,n[1]=(1-this.eccentricitySquared)*l/c,n[2]=o*a/u,n.normalize()},p.prototype.surfaceNormalAtPoint=function(t,i,r,n){if(!n)throw new e(s.logMessage(s.LEVEL_SEVERE,"Globe","surfaceNormalAtPoint","missingResult"));if(this.projection.surfaceNormalAtPoint)return this.projection.surfaceNormalAtPoint(this,t,i,r,n);if(this.is2D())return n[0]=0,n[1]=0,n[2]=1,n;var o=this.equatorialRadius*this.equatorialRadius,a=this.polarRadius*this.polarRadius;return n[0]=t/o,n[1]=i/a,n[2]=r/o,n.normalize()},p.prototype.northTangentAtLocation=function(t,i,r){if(!r)throw new e(s.logMessage(s.LEVEL_SEVERE,"Globe","northTangentAtLocation","missingResult"));return this.projection.northTangentAtLocation(this,t,i,r)},p.prototype.northTangentAtPoint=function(t,i,r,n){if(!n)throw new e(s.logMessage(s.LEVEL_SEVERE,"Globe","northTangentAtPoint","missingResult"));return this.projection.northTangentAtPoint(this,t,i,r,this.offsetVector,n)},p.prototype.intersectsFrustum=function(t){if(!t)throw new e(s.logMessage(s.LEVEL_SEVERE,"Globe","intersectsFrustum","missingFrustum"));if(this.is2D()){var r=new i;return r.setToSector(h.FULL_SPHERE,this,this.elevationModel.minElevation,this.elevationModel.maxElevation),r.intersectsFrustum(t)}return!(t.far.distance<=this.equatorialRadius)&&(!(t.left.distance<=this.equatorialRadius)&&(!(t.right.distance<=this.equatorialRadius)&&(!(t.top.distance<=this.equatorialRadius)&&(!(t.bottom.distance<=this.equatorialRadius)&&!(t.near.distance<=this.equatorialRadius)))))},p.prototype.intersectsLine=function(t,i){if(!t)throw new e(s.logMessage(s.LEVEL_SEVERE,"Globe","intersectWithRay","missingLine"));if(!i)throw new e(s.logMessage(s.LEVEL_SEVERE,"Globe","intersectsLine","missingResult"));var r,n=t.direction[0],o=t.direction[1],a=t.direction[2],l=t.origin[0],h=t.origin[1],u=t.origin[2];if(this.is2D())return(0!=a||0==u)&&(!((r=-u/a)<0)&&(i[0]=l+n*r,i[1]=h+o*r,i[2]=u+a*r,!0));var c,d,p,f,g=this.equatorialRadius,m=g*g,E=g/this.polarRadius,y=E*E;return c=n*n+y*o*o+a*a,d=2*(l*n+y*h*o+u*a),p=l*l+y*h*h+u*u-m,!((f=d*d-4*c*p)<0)&&((r=(-d-Math.sqrt(f))/(2*c))>0?(i[0]=l+n*r,i[1]=h+o*r,i[2]=u+a*r,!0):(r=(-d+Math.sqrt(f))/(2*c))>0&&(i[0]=l+n*r,i[1]=h+o*r,i[2]=u+a*r,!0))},p.prototype.elevationTimestamp=function(){return this.elevationModel.timestamp},p.prototype.minElevation=function(){return this.elevationModel.minElevation},p.prototype.maxElevation=function(){return this.elevationModel.maxElevation},p.prototype.minAndMaxElevationsForSector=function(t){if(!t)throw new e(s.logMessage(s.LEVEL_SEVERE,"Globe","minAndMaxElevationsForSector","missingSector"));return this.elevationModel.minAndMaxElevationsForSector(t)},p.prototype.elevationAtLocation=function(t,e){return this.elevationModel.elevationAtLocation(t,e)},p.prototype.elevationsForGrid=function(t,i,r,n,o){if(!t)throw new e(s.logMessage(s.LEVEL_SEVERE,"Globe","elevationsForSector","missingSector"));if(i<=0||r<=0)throw new e(s.logMessage(s.LEVEL_SEVERE,"Globe","elevationsForSector","numLat or numLon is less than 1"));if(!o||o.length<i*r)throw new e(s.logMessage(s.LEVEL_SEVERE,"Globe","elevationsForSector","missingArray"));return this.elevationModel.elevationsForGrid(t,i,r,n,o)},p}),i("cache/GpuResourceCache",["../util/AbsentResourceList","../error/ArgumentError","../util/ImageSource","../util/Logger","../cache/MemoryCache","../render/Texture"],function(t,e,i,r,n,o){"use strict";var s=function(i,o){if(!i||i<1)throw new e(r.logMessage(r.LEVEL_SEVERE,"GpuResourceCache","constructor","Specified cache capacity is undefined, 0 or negative."));if(!o||o<0||o>=i)throw new e(r.logMessage(r.LEVEL_SEVERE,"GpuResourceCache","constructor","Specified cache low-water value is undefined, negative or not less than the capacity."));this.entries=new n(i,o),this.cacheKeyPool=0,this.currentRetrievals={},this.absentResourceList=new t(3,6e4)};return Object.defineProperties(s.prototype,{capacity:{get:function(){return this.entries.capacity}},lowWater:{get:function(){return this.entries.lowWater}},usedCapacity:{get:function(){return this.entries.usedCapacity}},freeCapacity:{get:function(){return this.entries.freeCapacity}}}),s.prototype.generateCacheKey=function(){return"GpuResourceCache "+ ++this.cacheKeyPool},s.prototype.putResource=function(t,n,o){if(!t)throw new e(r.logMessage(r.LEVEL_SEVERE,"GpuResourceCache","putResource","missingKey."));if(!n)throw new e(r.logMessage(r.LEVEL_SEVERE,"GpuResourceCache","putResource","missingResource."));if(!o||o<1)throw new e(r.logMessage(r.LEVEL_SEVERE,"GpuResourceCache","putResource","The specified resource size is undefined or less than 1."));var s={resource:n};this.entries.putEntry(t instanceof i?t.key:t,s,o)},s.prototype.resourceForKey=function(t){var e=t instanceof i?this.entries.entryForKey(t.key):this.entries.entryForKey(t);return e?e.resource:null},s.prototype.containsResource=function(t){return this.entries.containsKey(t instanceof i?t.key:t)},s.prototype.removeResource=function(t){this.entries.removeEntry(t instanceof i?t.key:t)},s.prototype.clear=function(){this.entries.clear(!1)},s.prototype.retrieveTexture=function(t,e,n){if(!e)return null;if(e instanceof i){var s=new o(t,e.image,n);return this.putResource(e.key,s,s.size),s}if(this.currentRetrievals[e]||this.absentResourceList.isResourceAbsent(e))return null;var a=this,l=new Image;return l.onload=function(){r.log(r.LEVEL_INFO,"Image retrieval succeeded: "+e);var i=new o(t,l,n);a.putResource(e,i,i.size),delete a.currentRetrievals[e],a.absentResourceList.unmarkResourceAbsent(e);var s=document.createEvent("Event");s.initEvent(WorldWind.REDRAW_EVENT_TYPE,!0,!0),window.dispatchEvent(s)},l.onerror=function(){delete a.currentRetrievals[e],a.absentResourceList.markResourceAbsent(e),r.log(r.LEVEL_WARNING,"Image retrieval failed: "+e)},this.currentRetrievals[e]=e,l.crossOrigin="anonymous",l.src=e,null},s}),i("pick/PickedObjectList",[],function(){"use strict";var t=function(){this.objects=[]};return t.prototype.hasNonTerrainObjects=function(){return this.objects.length>1||1===this.objects.length&&null==this.terrainObject()},t.prototype.terrainObject=function(){for(var t=0,e=this.objects.length;t<e;t++)if(this.objects[t].isTerrain)return this.objects[t];return null},t.prototype.add=function(t){if(t)if(t.isTerrain){for(var e=this.objects.length,i=0,r=this.objects.length;i<r;i++)if(this.objects[i].isTerrain){e=i;break}this.objects[e]=t}else this.objects.push(t)},t.prototype.clear=function(){this.objects=[]},t.prototype.topPickedObject=function(){var t=this.objects.length;if(t>1)for(var e=0;e<t;e++)if(this.objects[[e].isOnTop])return this.objects[e];return t>0?this.objects[0]:null},t}),i("render/ScreenCreditController",["../error/ArgumentError","../shaders/BasicTextureProgram","../util/Color","../util/Font","../util/Logger","../geom/Matrix","../util/Offset","../pick/PickedObject","../render/Renderable","../geom/Vec3","../util/WWMath"],function(t,e,i,r,n,o,s,a,l,h,u){"use strict";var c=function(){this.imageUrls=[],this.stringCredits=[],this.imageCreditSize=64,this.margin=5,this.opacity=.5,this.creditFont=new r(14)};return c.scratchMatrix=o.fromIdentity(),c.imageTransform=o.fromIdentity(),c.texCoordMatrix=o.fromIdentity(),c.prototype.clear=function(){this.imageUrls=[],this.stringCredits=[]},c.prototype.addImageCredit=function(e){if(!e)throw new t(n.logMessage(n.LEVEL_SEVERE,"ScreenCreditController","addImageCredit","missingUrl"));-1===this.imageUrls.indexOf(e)&&this.imageUrls.push(e)},c.prototype.addStringCredit=function(e,r){if(!e)throw new t(n.logMessage(n.LEVEL_SEVERE,"ScreenCreditController","addStringCredit","missingText"));if(!r)throw new t(n.logMessage(n.LEVEL_SEVERE,"ScreenCreditController","addStringCredit","missingColor"));-1===this.stringCredits.indexOf(e)&&this.stringCredits.push({text:e,color:r||i.WHITE})},c.prototype.drawCredits=function(t){if((0!==this.imageUrls.length||0!==this.stringCredits.length)&&!t.pickingMode&&t.timestamp!=this.lastFrameTimestamp){this.lastFrameTimestamp=t.timestamp,this.beginDrawingCredits(t);for(var e,i=t.navigatorState.viewport.width-(this.margin+this.imageCreditSize),r=0,n=0;n<this.imageUrls.length;n++)(e=this.drawImageCredit(t,this.imageUrls[n],i,this.margin))>0&&(i-=this.margin+this.imageCreditSize,r=u.max(e,r));for(var o=r+this.margin,s=0;s<this.stringCredits.length;s++)this.drawStringCredit(t,this.stringCredits[s],o),o+=this.margin+15;this.endDrawingCredits(t)}},c.prototype.beginDrawingCredits=function(t){var i,r=t.currentGlContext;t.findAndBindProgram(e),i=t.currentProgram,r.bindBuffer(r.ARRAY_BUFFER,t.unitQuadBuffer3()),r.vertexAttribPointer(i.vertexPointLocation,3,r.FLOAT,!1,0,0),r.bindBuffer(r.ARRAY_BUFFER,t.unitQuadBuffer()),r.vertexAttribPointer(i.vertexTexCoordLocation,2,r.FLOAT,!1,0,0),r.enableVertexAttribArray(i.vertexPointLocation),r.enableVertexAttribArray(i.vertexTexCoordLocation),i.loadTextureUnit(r,r.TEXTURE0),i.loadModulateColor(r,!1)},c.prototype.endDrawingCredits=function(t){var e=t.currentGlContext,i=t.currentProgram;e.disableVertexAttribArray(i.vertexPointLocation),e.disableVertexAttribArray(i.vertexTexCoordLocation),e.bindBuffer(e.ARRAY_BUFFER,null),e.bindTexture(e.TEXTURE_2D,null),e.enable(e.DEPTH_TEST)},c.prototype.drawImageCredit=function(t,e,r,n){var o,s,a,l,h,u;return(l=t.gpuResourceCache.resourceForKey(e))?(o=l.imageWidth,s=l.imageHeight,a=o<=this.imageCreditSize&&this.imageHeight<=this.imageCreditSize?1:o>=s?this.imageCreditSize/o:this.imageCreditSize/s,c.imageTransform.setTranslation(r,n,0),c.imageTransform.setScale(a*o,a*s,1),h=t.currentGlContext,u=t.currentProgram,c.scratchMatrix.copy(t.screenProjection),c.scratchMatrix.multiplyMatrix(c.imageTransform),u.loadModelviewProjection(h,c.scratchMatrix),u.loadTextureEnabled(h,!0),u.loadColor(h,i.WHITE),u.loadOpacity(h,this.opacity),c.texCoordMatrix.setToIdentity(),c.texCoordMatrix.multiplyByTextureTransform(l),u.loadTextureMatrix(h,c.texCoordMatrix),l.bind(t)&&h.drawArrays(h.TRIANGLE_STRIP,0,4),s):(t.gpuResourceCache.retrieveTexture(t.currentGlContext,e),0)},c.prototype.drawStringCredit=function(t,e,i){var r,n,o,s,a,l,h;return s=e.text+this.creditFont.toString(),o=t.gpuResourceCache.resourceForKey(s),o||(o=t.textSupport.createTexture(t,e.text,this.creditFont,!1),t.gpuResourceCache.putResource(s,o,o.size)),r=o.imageWidth,n=o.imageHeight,h=t.navigatorState.viewport.width-(r+this.margin),c.imageTransform.setTranslation(h,i,0),c.imageTransform.setScale(r,n,1),a=t.currentGlContext,l=t.currentProgram,c.scratchMatrix.copy(t.screenProjection),c.scratchMatrix.multiplyMatrix(c.imageTransform),l.loadModelviewProjection(a,c.scratchMatrix),l.loadTextureEnabled(a,!0),l.loadColor(a,e.color),l.loadOpacity(a,this.opacity),c.texCoordMatrix.setToIdentity(),c.texCoordMatrix.multiplyByTextureTransform(o),l.loadTextureMatrix(a,c.texCoordMatrix),o.bind(t)&&a.drawArrays(a.TRIANGLE_STRIP,0,4),!0},c}),i("util/HashMap",[],function(){"use strict";var t=function(){this._entries=Object.create(null)};return t.prototype.get=function(t){return this._entries[t]},t.prototype.set=function(t,e){this._entries[t]=e},t.prototype.remove=function(t){delete this._entries[t]},t.prototype.contains=function(t){return t in this._entries},t.reIndex=function(e,i,r){var n=new t;for(var o in e._entries){var s=parseInt(o);s>=i&&(s+=r);var a=e.get(o);a.index=s,n.set(s,a)}return n},t}),i("util/PolygonSplitter",["./HashMap","../geom/Location","../geom/Position","./WWMath"],function(t,e,i,r){"use strict";return{addedIndex:-1,poleIndexOffset:-1,splitContours:function(t,e){for(var i=!1,r=0,n=t.length;r<n;r++){var o=this.splitContour(t[r]);o.polygons.length>1&&(i=!0),e.push(o)}return i},splitContour:function(i){var r=new t,n=[],o=[],s=[],a=[],l=-1,h=this.findIntersectionAndPole(i,n,o,r);return 0===o.length?(s.push(n),a.push(r),this.formatContourOutput(s,h,l,a)):(o.length>2&&o.sort(function(t,e){return e.latitude-t.latitude}),h!==e.poles.NONE&&(n=this.handleOnePole(n,o,r,h),r=this.reindexIntersections(o,r,this.poleIndexOffset)),0===o.length?(s.push(n),a.push(r),l=0,this.formatContourOutput(s,h,l,a)):(this.linkIntersections(o,r),l=this.makePolygons(n,o,r,s,a),this.formatContourOutput(s,h,l,a)))},findIntersectionAndPole:function(t,i,n,o){var s=!1,a=90,l=-90;this.addedIndex=-1;for(var h=0,u=t.length;h<u;h++){var c=t[h],d=t[(h+1)%u];a=Math.min(a,c.latitude),l=Math.max(l,c.latitude);if(e.locationsCrossDateLine([c,d])){s=!s;var p=e.meridianIntersection(c,d,180);null===p&&(p=(c.latitude+d.latitude)/2);var f=180*r.signum(c.longitude)||180,g=this.createPoint(p,f,c.altitude),m=this.createPoint(p,-f,d.altitude);this.safeAdd(i,c,h,u);var E=i.length;o.set(E,this.makeIntersectionEntry(E)),o.set(E+1,this.makeIntersectionEntry(E+1)),n.push({indexEnd:E,indexStart:E+1,latitude:p}),i.push(g),i.push(m),this.safeAdd(i,d,h+1,u)}else this.safeAdd(i,c,h,u),this.safeAdd(i,d,h+1,u)}var y=e.poles.NONE;return s&&(y=this.determinePole(a,l)),y},determinePole:function(t,i){return t>0?e.poles.NORTH:i<0?e.poles.SOUTH:Math.abs(i)>=Math.abs(t)?e.poles.NORTH:e.poles.SOUTH},handleOnePole:function(t,i,r,n){var o;if(n===e.poles.NORTH)var s=i.shift(),a=90;else n===e.poles.SOUTH&&(s=i.pop(),a=-90);var l=r.get(s.indexEnd),h=r.get(s.indexStart);l.forPole=!0,h.forPole=!0,this.poleIndexOffset=s.indexStart,o=t.slice(0,s.indexEnd+1);var u=this.createPoint(a,t[l.index].longitude,t[l.index].altitude),c=this.createPoint(a,t[h.index].longitude,t[h.index].altitude);return o.push(u,c),o=o.concat(t.slice(this.poleIndexOffset))},linkIntersections:function(t,e){for(var i=0;i<t.length-1;i+=2){var r=t[i],n=t[i+1],o=e.get(r.indexEnd),s=e.get(r.indexStart),a=e.get(n.indexEnd),l=e.get(n.indexStart);o.linkTo=n.indexStart,s.linkTo=n.indexEnd,a.linkTo=r.indexStart,l.linkTo=r.indexEnd}},reindexIntersections:function(e,i,r){i=t.reIndex(i,r,2);for(var n=0,o=e.length;n<o;n++)e[n].indexEnd>=r&&(e[n].indexEnd+=2),e[n].indexStart>=r&&(e[n].indexStart+=2);return i},makePolygons:function(e,i,r,n,o){for(var s=-1,a=0;a<i.length-1;a+=2){var l=i[a],h=i[a+1],u=l.indexStart,c=h.indexEnd,d=[],p=new t,f=this.makePolygon(u,c,e,r,d,p);d.length&&(n.push(d),o.push(p),f&&(s=n.length-1)),u=h.indexStart,c=l.indexEnd,d=[],p=new t,f=this.makePolygon(u,c,e,r,d,p),d.length&&(n.push(d),o.push(p),f&&(s=n.length-1))}return s},makePolygon:function(t,e,i,r,n,o){var s=!1,a=i.length,l=!1;e<t&&(e+=a);for(var h=t;h<=e;h++){var u=h%a,c=i[u],d=r.get(u);if(d){if(d.visited)break;if(n.push(c),o.set(n.length-1,d),d.forPole)l=!0;else{if(s&&(h=d.linkTo-1)+1===t)break;s=!s,d.visited=!0}}else n.push(c)}return l},safeAdd:function(t,e,i,r){this.addedIndex<i&&this.addedIndex<r-1&&(t.push(e),this.addedIndex=i)},createPoint:function(t,r,n){return null==n?new e(t,r):new i(t,r,n)},formatContourOutput:function(t,e,i,r){return{polygons:t,pole:e,poleIndex:i,iMap:r}},makeIntersectionEntry:function(t){return null==t&&(t=-1),{visited:!1,forPole:!1,index:t,linkTo:-1}}}}),i("shapes/ShapeAttributes",["../util/Color","../util/ImageSource"],function(t,e){"use strict";var i=function(e){this._drawInterior=!e||e._drawInterior,this._drawOutline=!e||e._drawOutline,this._enableLighting=!!e&&e._enableLighting,this._interiorColor=e?e._interiorColor:t.WHITE,this._outlineColor=e?e._outlineColor:t.RED,this._outlineWidth=e?e._outlineWidth:1,this._outlineStippleFactor=e?e._outlineStippleFactor:0,this._outlineStipplePattern=e?e._outlineStipplePattern:61680,this._imageSource=e?e._imageSource:null,this._depthTest=!e||e._depthTest,this._drawVerticals=!!e&&e._drawVerticals,this._applyLighting=!!e&&e._applyLighting,this.stateKeyInvalid=!0};return i.prototype.computeStateKey=function(){return"di "+this._drawInterior+" do "+this._drawOutline+" el "+this._enableLighting+" ic "+this._interiorColor.toHexString(!0)+" oc "+this._outlineColor.toHexString(!0)+" ow "+this._outlineWidth+" osf "+this._outlineStippleFactor+" osp "+this._outlineStipplePattern+" is "+(this._imageSource?this.imageSource instanceof e?this.imageSource.key:this.imageSource:"null")+" dt "+this._depthTest+" dv "+this._drawVerticals+" li "+this._applyLighting},Object.defineProperties(i.prototype,{stateKey:{get:function(){return this.stateKeyInvalid&&(this._stateKey=this.computeStateKey(),this.stateKeyInvalid=!1),this._stateKey}},drawInterior:{get:function(){return this._drawInterior},set:function(t){this._drawInterior=t,this.stateKeyInvalid=!0}},drawOutline:{get:function(){return this._drawOutline},set:function(t){this._drawOutline=t,this.stateKeyInvalid=!0}},enableLighting:{get:function(){return this._enableLighting},set:function(t){this._enableLighting=t,this.stateKeyInvalid=!0}},interiorColor:{get:function(){return this._interiorColor},set:function(t){this._interiorColor=t,this.stateKeyInvalid=!0}},outlineColor:{get:function(){return this._outlineColor},set:function(t){this._outlineColor=t,this.stateKeyInvalid=!0}},outlineWidth:{get:function(){return this._outlineWidth},set:function(t){this._outlineWidth=t,this.stateKeyInvalid=!0}},outlineStipplePattern:{get:function(){return this._outlineStipplePattern},set:function(t){this._outlineStipplePattern=t,this.stateKeyInvalid=!0}},outlineStippleFactor:{get:function(){return this._outlineStippleFactor},set:function(t){this._outlineStippleFactor=t,this.stateKeyInvalid=!0}},imageSource:{get:function(){return this._imageSource},set:function(t){this._imageSource=t,this.stateKeyInvalid=!0}},depthTest:{get:function(){return this._depthTest},set:function(t){this._depthTest=t,this.stateKeyInvalid=!0}},drawVerticals:{get:function(){return this._drawVerticals},set:function(t){this._drawVerticals=t,this.stateKeyInvalid=!0}},applyLighting:{get:function(){return this._applyLighting},set:function(t){this._applyLighting=t,this.stateKeyInvalid=!0}}}),i}),i("shapes/SurfaceShape",["../error/AbstractError","../geom/Angle","../error/ArgumentError","../geom/BoundingBox","../geom/Location","../util/Logger","../cache/MemoryCache","../error/NotYetImplementedError","../pick/PickedObject","../util/PolygonSplitter","../render/Renderable","../geom/Sector","../shapes/ShapeAttributes","../error/UnsupportedOperationError","../util/WWMath"],function(t,e,i,r,n,o,s,a,l,h,u,c,d,p,f){"use strict";var g=function(t){u.call(this),this._displayName="Surface Shape",this._attributes=t||new d(null),this._highlightAttributes=null,this._highlighted=!1,this._enabled=!0,this._pathType=WorldWind.GREAT_CIRCLE,this._maximumNumEdgeIntervals=g.DEFAULT_NUM_EDGE_INTERVALS,this._polarThrottle=g.DEFAULT_POLAR_THROTTLE,this._sector=null,this.pickDelegate=null,this._sectors=[],this._locations=null,this._boundaries=null,this._interiorGeometry=null,this._outlineGeometry=null,this._isInteriorInhibited=!1,this.stateKeyInvalid=!0,this._attributesStateKey=null,this.boundariesArePrepared=!1,this.layer=null,this.pickColor=null,this.contours=[],this.containsPole=!1,this.crossesAntiMeridian=!1,this.expirationInterval=2e3,this.shapeDataCache=new s(3,2),this.currentData=null};return g.prototype=Object.create(u.prototype),Object.defineProperties(g.prototype,{stateKey:{get:function(){if(this._attributesStateKey){var t=null;this._highlighted?this._highlightAttributes&&(t=this._highlightAttributes.stateKey):this._attributes&&(t=this._attributes.stateKey),t!=this._attributesStateKey&&(this._attributesStateKey=t,this.stateKeyInvalid=!0)}else this._highlighted?this._highlightAttributes&&(this._attributesStateKey=this._highlightAttributes.stateKey):this._attributes&&(this._attributesStateKey=this._attributes.stateKey),this._attributesStateKey&&(this.stateKeyInvalid=!0);return this.stateKeyInvalid&&(this._stateKey=this.computeStateKey()),this._stateKey}},displayName:{get:function(){return this._displayName},set:function(t){this.stateKeyInvalid=!0,this._displayName=t}},attributes:{get:function(){return this._attributes},set:function(t){this.stateKeyInvalid=!0,this._attributes=t,this._attributesStateKey=t.stateKey}},highlightAttributes:{get:function(){return this._highlightAttributes},set:function(t){this.stateKeyInvalid=!0,this._highlightAttributes=t}},highlighted:{get:function(){return this._highlighted},set:function(t){this.stateKeyInvalid=!0,this._highlighted=t}},enabled:{get:function(){return this._enabled},set:function(t){this.stateKeyInvalid=!0,this._enabled=t}},pathType:{get:function(){return this._pathType},set:function(t){this.stateKeyInvalid=!0,this.resetBoundaries(),this._pathType=t}},maximumNumEdgeIntervals:{get:function(){return this._maximumNumEdgeIntervals},set:function(t){this.stateKeyInvalid=!0,this.resetBoundaries(),this._maximumNumEdgeIntervals=t}},polarThrottle:{get:function(){return this._polarThrottle},set:function(t){this.stateKeyInvalid=!0,this.resetBoundaries(),this._polarThrottle=t}},sector:{get:function(){return this._sector}}}),g.staticStateKey=function(t){return t.stateKeyInvalid=!1,t.highlighted&&t._highlightAttributes?t._attributesStateKey=t._highlightAttributes.stateKey:t._attributes?t._attributesStateKey=t._attributes.stateKey:t._attributesStateKey=null,"dn "+t.displayName+" at "+(t._attributesStateKey?t._attributesStateKey:"null")+" hi "+t.highlighted+" en "+t.enabled+" pt "+t.pathType+" ne "+t.maximumNumEdgeIntervals+" po "+t.polarThrottle+" se ["+t.sector.minLatitude+","+t.sector.maxLatitude+","+t.sector.minLongitude+","+t.sector.maxLongitude+"]"},g.prototype.computeStateKey=function(){return g.staticStateKey(this)},g.prototype.area=function(t,e){throw new a(o.logMessage(o.LEVEL_SEVERE,"SurfaceShape","area","notYetImplemented"))},g.prototype.computeBoundaries=function(e){throw new t(o.logMessage(o.LEVEL_SEVERE,"SurfaceShape","computeBoundaries","abstractInvocation"))},g.prototype.intersectsFrustum=function(t){return!this.currentData||!this.currentData.extent||(t.pickingMode?this.currentData.extent.intersectsFrustum(t.pickFrustum):this.currentData.extent.intersectsFrustum(t.navigatorState.frustumInModelCoordinates))},g.prototype.isShapeDataCurrent=function(t,e){return e.verticalExaggeration===t.verticalExaggeration&&e.expiryTime>Date.now()},g.prototype.createShapeDataObject=function(){return{}},g.prototype.resetExpiration=function(t){t.expiryTime=Date.now()+this.expirationInterval+1e3*Math.random()},g.prototype.establishCurrentData=function(t){this.currentData=this.shapeDataCache.entryForKey(t.globeStateKey),this.currentData||(this.currentData=this.createShapeDataObject(),this.resetExpiration(this.currentData),this.shapeDataCache.putEntry(t.globeStateKey,this.currentData,1)),this.currentData.isExpired=!this.isShapeDataCurrent(t,this.currentData)},g.prototype.render=function(t){this.enabled&&(this.layer=t.currentLayer,this.prepareBoundaries(t),this.establishCurrentData(t),!this.currentData.isExpired&&this.currentData.extent||(this.computeExtent(t),this.currentData.verticalExaggeration=t.verticalExaggeration,this.resetExpiration(this.currentData)),this.currentData&&this.currentData.extent&&!this.intersectsFrustum(t)||t.surfaceShapeTileBuilder.insertSurfaceShape(this))},g.prototype.interpolateLocations=function(t){var e,i,r,n=t[0],o=n,s=!0,a=!0,l=0,h=!0;for(this._locations=[n],i=1,r=t.length;i<r;i+=1)e=o,a=s,o=t[i],s=o.latitude==n.latitude&&o.longitude==n.longitude,h=!0,(s||a)&&(l+=1)>2&&(h=!1),h&&this.interpolateEdge(e,o,this._locations),this._locations.push(o),e=o;this._isInteriorInhibited||e.latitude==n.latitude&&e.longitude==n.longitude||(this.interpolateEdge(e,n,this._locations),this._locations.push(n))},g.prototype.interpolateEdge=function(t,e,i){var r,o,s=n.greatCircleDistance(t,e),a=Math.round(this._maximumNumEdgeIntervals*s/Math.PI);if(a>0){r=1/a,o=t;for(var l=this.throttledStep(r,o);l<1;l+=this.throttledStep(r,o))o=new n(0,0),n.interpolateAlongPath(this._pathType,l,t,e,o),180===t.longitude&&180===e.longitude?o.longitude=180:-180===t.longitude&&-180===e.longitude&&(o.longitude=-180),i.push(o)}},g.prototype.throttledStep=function(t,i){var r=Math.cos(i.latitude*e.DEGREES_TO_RADIANS);r*=r;var n=this._polarThrottle/(1+this._polarThrottle);return t*(1-n+n*r)},g.prototype.prepareBoundaries=function(t){if(!this.boundariesArePrepared){this.computeBoundaries(t);var e=this.formatBoundaries();this.normalizeAngles(e),e=this.interpolateBoundaries(e);var i=[],r=h.splitContours(e,i);this.contours=i,this.crossesAntiMeridian=r,this.prepareGeometry(t,i),this.prepareSectors(),this.boundariesArePrepared=!0}},g.prototype.formatBoundaries=function(){var t=[];return this._boundaries.length?(null!=this._boundaries[0].latitude?t.push(this._boundaries):t=this._boundaries,t):t},g.prototype.resetBoundaries=function(){this.boundariesArePrepared=!1,this.shapeDataCache.clear(!1)},g.prototype.normalizeAngles=function(t){for(var i=0,r=t.length;i<r;i++)for(var n=t[i],o=0,s=n.length;o<s;o++){var a=n[o];(a.longitude<-180||a.longitude>180)&&(a.longitude=e.normalizedDegreesLongitude(a.longitude)),(a.latitude<-90||a.latitude>90)&&(a.latitude=e.normalizedDegreesLatitude(a.latitude))}},g.prototype.interpolateBoundaries=function(t){for(var e=[],i=0,r=t.length;i<r;i++){var n=t[i];this.interpolateLocations(n),e.push(this._locations.slice()),this._locations.length=0}return e},g.prototype.computeSectors=function(t){return this._sectors&&this._sectors.length>0?this._sectors:(this.prepareBoundaries(t),this._sectors)},g.prototype.computeExtent=function(t){if(!this._sectors||0===this._sectors.length)return null;if(!this.currentData)return null;this.currentData.extent||(this.currentData.extent=new r);var e;if(1===this._sectors.length)e=this._sectors[0].computeBoundingPoints(t.globe,t.verticalExaggeration),this.currentData.extent.setToVec3Points(e);else{for(var i=[],n=0;n<this._sectors.length;n++){e=this._sectors[n].computeBoundingPoints(t.globe,t.verticalExaggeration);var o=new r;o.setToVec3Points(e);for(var s=o.getCorners(),a=0;a<s.length;a++)i.push(s[a])}this.currentData.extent.setToVec3Points(i)}return this.currentData.extent},g.prototype.prepareSectors=function(){this.determineSectors(),this.crossesAntiMeridian?this.sectorsOverAntiMeridian():this.sectorsNotOverAntiMeridian()},g.prototype.determineSectors=function(){for(var t=0,e=this.contours.length;t<e;t++){var i=this.contours[t],r=i.polygons;i.sectors=[];for(var o=0,s=r.length;o<s;o++){var a=r[o],l=new c(0,0,0,0);if(l.setToBoundingSector(a),this._pathType===WorldWind.GREAT_CIRCLE){var h=n.greatCircleArcExtremeLocations(a),u=Math.min(l.minLatitude,h[0].latitude),d=Math.max(l.maxLatitude,h[1].latitude);l.minLatitude=u,l.maxLatitude=d}i.sectors.push(l)}}},g.prototype.sectorsOverAntiMeridian=function(){for(var t=new c(90,-90,180,-180),e=new c(90,-90,180,-180),i=0,r=this.contours.length;i<r;i++)for(var n=this.contours[i].sectors,o=0,s=n.length;o<s;o++){var a=n[o];a.minLongitude<0&&a.maxLongitude>0?(e.union(a),t.union(a)):a.minLongitude<0?e.union(a):t.union(a)}var l=Math.min(t.minLatitude,e.minLatitude),h=Math.max(t.maxLatitude,t.maxLatitude);this._sector=new c(l,h,-180,180),this._sectors=[t,e]},g.prototype.sectorsNotOverAntiMeridian=function(){this._sector=new c(90,-90,180,-180);for(var t=0,e=this.contours.length;t<e;t++)for(var i=this.contours[t].sectors,r=0,n=i.length;r<n;r++)this._sector.union(i[r]);this._sectors=[this._sector]},g.prototype.prepareGeometry=function(t,e){for(var i=[],r=[],o=0,s=e.length;o<s;o++)for(var a=e[o],l=a.poleIndex,h=0,u=a.polygons.length;h<u;h++){var c=a.polygons[h],d=a.iMap[h];i.push(c),a.pole!==n.poles.NONE&&u>1?h===l?this.outlineForPole(c,d,r):this.outlineForSplit(c,d,r):a.pole!==n.poles.NONE&&1===u?this.outlineForPole(c,d,r):a.pole===n.poles.NONE&&u>1?this.outlineForSplit(c,d,r):a.pole===n.poles.NONE&&1===u&&r.push(c)}this._interiorGeometry=i,this._outlineGeometry=r},g.prototype.outlineForPole=function(t,e,i){this.containsPole=!0;for(var r=[],n=0,o=0,s=t.length;o<s;o++){var a=t[o],l=e.get(o);l&&l.forPole&&++n%2==1&&(r.push(a),i.push(r),r=[]),n%2==0&&r.push(a)}r.length&&i.push(r)},g.prototype.outlineForSplit=function(t,e,i){for(var r=[],n=0,o=0,s=t.length;o<s;o++){var a=t[o],l=e.get(o);l&&!l.forPole&&++n%2==0&&(r.push(a),i.push(r),r=[]),n%2==1&&r.push(a)}},g.prototype.resetPickColor=function(){this.pickColor=null},g.prototype.renderToTexture=function(t,e,i,r,n,o){var s=this._highlighted?this._highlightAttributes||this._attributes:this._attributes,a=!this._isInteriorInhibited&&s.drawInterior,h=s.drawOutline&&s.outlineWidth>0;if(a||h){if(t.pickingMode&&!this.pickColor&&(this.pickColor=t.uniquePickColor()),t.pickingMode)var u=this.pickColor.toHexString();if(this.crossesAntiMeridian||this.containsPole?(a&&(this.draw(this._interiorGeometry,e,i,r,n,o),e.fillStyle=t.pickingMode?u:s.interiorColor.toRGBAString(),e.fill()),h&&(this.draw(this._outlineGeometry,e,i,r,n,o),e.lineWidth=s.outlineWidth,e.strokeStyle=t.pickingMode?u:s.outlineColor.toRGBAString(),e.stroke())):(this.draw(this._interiorGeometry,e,i,r,n,o),a&&(e.fillStyle=t.pickingMode?u:s.interiorColor.toRGBAString(),e.fill()),h&&(e.lineWidth=s.outlineWidth,e.strokeStyle=t.pickingMode?u:s.outlineColor.toRGBAString(),e.stroke())),t.pickingMode){var c=new l(this.pickColor.clone(),this.pickDelegate?this.pickDelegate:this,null,this.layer,!1);t.resolvePick(c)}}},g.prototype.draw=function(t,e,i,r,n,o){e.beginPath();for(var s=0,a=t.length;s<a;s++){var l=t[s],h=l[0],u=h.longitude*i+n,c=h.latitude*r+o;e.moveTo(u,c);for(var d=1,p=l.length;d<p;d++)h=l[d],u=h.longitude*i+n,c=h.latitude*r+o,e.lineTo(u,c)}},g.DEFAULT_NUM_EDGE_INTERVALS=128,g.DEFAULT_POLAR_THROTTLE=10,g}),i("shapes/SurfaceShapeTile",["../geom/Angle","../error/ArgumentError","../util/Level","../util/Logger","../geom/Sector","../render/Texture","../render/TextureTile"],function(t,e,i,r,n,o,s){"use strict";var a=function(t,e,i,r){s.call(this,t,e,i,r),this.surfaceShapes=[],this.surfaceShapeStateKeys=[],this.asRenderedSurfaceShapeStateKeys=[],this.sector=t,this.cacheKey=null,this.pickSequence=0,this.createCtx2D()};return a.prototype=Object.create(s.prototype),a.prototype.clearShapes=function(){this.surfaceShapes=[],this.surfaceShapeStateKeys=[]},a.prototype.hasShapes=function(){return this.surfaceShapes.length>0},a.prototype.getShapes=function(){return this.surfaceShapes},
a.prototype.setShapes=function(t){this.surfaceShapes=t},a.prototype.getSector=function(){return this.sector},a.prototype.addSurfaceShape=function(t){this.surfaceShapes.push(t),this.surfaceShapeStateKeys.push(t.stateKey)},a.prototype.needsUpdate=function(t){var e,i;if(this.surfaceShapes.length!=this.asRenderedSurfaceShapeStateKeys.length)return!0;for(e=0,i=this.surfaceShapes.length;e<i;e+=1)if(this.surfaceShapeStateKeys[e]!==this.asRenderedSurfaceShapeStateKeys[e])return!0;return!this.hasTexture(t)},a.prototype.hasTexture=function(t){return!t.pickingMode&&(this.gpuCacheKey||(this.gpuCacheKey=this.getCacheKey()),!!t.gpuResourceCache.resourceForKey(this.gpuCacheKey))},a.prototype.updateTexture=function(t){var e=t.currentGlContext,i=a.canvas,r=a.ctx2D;i.width=this.tileWidth,i.height=this.tileHeight;var n=this.tileWidth/this.sector.deltaLongitude(),s=-this.tileHeight/this.sector.deltaLatitude(),l=-this.sector.minLongitude*n,h=-this.sector.maxLatitude*s;this.asRenderedSurfaceShapeStateKeys=[];for(var u=0,c=this.surfaceShapes.length;u<c;u+=1){var d=this.surfaceShapes[u];this.asRenderedSurfaceShapeStateKeys.push(this.surfaceShapeStateKeys[u]),d.renderToTexture(t,r,n,s,l,h)}this.gpuCacheKey=this.getCacheKey();var p=t.gpuResourceCache,f=new o(e,i);return p.putResource(this.gpuCacheKey,f,f.size),f},a.prototype.getCacheKey=function(){return this.cacheKey||(this.cacheKey="SurfaceShapeTile:"+this.tileKey+","+this.pickSequence.toString()),this.cacheKey},a.prototype.createCtx2D=function(){a.ctx2D||(a.canvas=document.createElement("canvas"),a.ctx2D=a.canvas.getContext("2d"))},a.canvas=null,a.ctx2D=null,a}),i("shapes/SurfaceShapeTileBuilder",["../error/ArgumentError","../render/DrawContext","../globe/Globe","../shaders/GpuProgram","../util/Level","../util/LevelSet","../geom/Location","../util/Logger","../geom/Matrix","../cache/MemoryCache","../navigate/NavigatorState","../error/NotYetImplementedError","../pick/PickedObject","../geom/Rectangle","../geom/Sector","../shapes/SurfaceShape","../shapes/SurfaceShapeTile","../globe/Terrain","../globe/TerrainTile","../globe/TerrainTileList","../render/TextureTile","../util/Tile"],function(t,e,i,r,n,o,s,a,l,h,u,c,d,p,f,g,m,E,y,_,v,S){"use strict";var b=function(){this.numRowsTilesInTopLevel=4,this.numColumnsTilesInTopLevel=8,this.maximumSubdivisionDepth=15,this.tileWidth=256,this.tileHeight=256,this.levels=new o(f.FULL_SPHERE,new s(180/this.numRowsTilesInTopLevel,360/this.numColumnsTilesInTopLevel),this.maximumSubdivisionDepth,this.tileWidth,this.tileHeight),this.surfaceShapes=[],this.surfaceShapeTiles=[],this.topLevelTiles=[],this.sector=new f(-90,90,-180,180),this.detailControl=1.25,this.tileCache=new h(5e5,4e5)};return b.prototype.clear=function(){this.surfaceShapeTiles.splice(0,this.surfaceShapeTiles.length),this.surfaceShapes.splice(0,this.surfaceShapes.length)},b.prototype.insertSurfaceShape=function(t){this.surfaceShapes.push(t)},b.prototype.doRender=function(t){if(t.pickingMode){for(var e=0,i=this.surfaceShapes.length;e<i;e+=1)this.surfaceShapes[e].resetPickColor();b.pickSequence+=1;var r=this.surfaceShapeTiles,n=this.topLevelTiles;this.surfaceShapeTiles=[],this.topLevelTiles=[],this.buildTiles(t),t.deepPicking?this.doDeepPickingRender(t):t.surfaceTileRenderer.renderTiles(t,this.surfaceShapeTiles,1),this.surfaceShapeTiles=r,this.topLevelTiles=n}else this.buildTiles(t),t.surfaceTileRenderer.renderTiles(t,this.surfaceShapeTiles,1)},b.prototype.doDeepPickingRender=function(t){var e,i,r,n,o,s,a,l,h,u=[];for(o=0,s=t.objectsAtPickPoint.objects.length;o<s;o+=1)a=t.objectsAtPickPoint.objects[o],a.userObject instanceof g&&(l=a.userObject,u.indexOf(l)<0&&(u.push(l),t.objectsAtPickPoint.objects.splice(o,1),o-=1,s-=1));if(!(u.length<=0)){var c=[];for(r=0,n=u.length;r<n;r+=1){for(l=u[r],e=0,i=this.surfaceShapeTiles.length;e<i;e+=1)h=this.surfaceShapeTiles[e],h.setShapes([l]),h.updateTexture(t);t.surfaceTileRenderer.renderTiles(t,this.surfaceShapeTiles,1);var p=t.readPickColor(t.pickPoint);p&&l.pickColor.equals(p)&&(a=new d(l.pickColor.clone(),l.pickDelegate?l.pickDelegate:l,null,l.layer,!1),c.push(a))}for(o=0,s=t.objectsAtPickPoint.objects.length;o<s;o+=1)a=t.objectsAtPickPoint.objects[o],a.userObject instanceof g&&(t.objectsAtPickPoint.objects.splice(o,1),o-=1,s-=1);for(o=0,s=c.length;o<s;o+=1)a=c[o],t.objectsAtPickPoint.objects.push(a)}},b.prototype.buildTiles=function(e){if(!e)throw new t(a.logMessage(a.LEVEL_SEVERE,"SurfaceShapeTileBuilder","buildTiles","missingDc"));if(this.surfaceShapes&&!(this.surfaceShapes.length<1)){this.assembleTiles(e),this.surfaceShapes.splice(0,this.surfaceShapes.length);for(var i=0,r=this.surfaceShapeTiles.length;i<r;i+=1){this.surfaceShapeTiles[i].clearShapes()}}},b.prototype.assembleTiles=function(t){var e,i,r,n,o,s,a;this.topLevelTiles.length<1&&this.createTopLevelTiles();var l={};for(i=0,r=this.surfaceShapes.length;i<r;i+=1){var h=this.surfaceShapes[i],u=h.computeSectors(t);if(u)for(s=0,a=u.length;s<a;s+=1){var c=u[s];for(n=0,o=this.topLevelTiles.length;n<o;n+=1)if(e=this.topLevelTiles[n],e.sector.intersects(c)){var d=e.tileKey;l[d]=e,e.addSurfaceShape(h)}}}for(var p in l)l.hasOwnProperty(p)&&(e=l[p],this.addTileOrDescendants(t,this.levels,null,e))},b.prototype.addTileOrDescendants=function(t,e,i,r){if(!this.intersectsFrustum(t,r))return void r.clearShapes();if(null!=i&&this.addIntersectingShapes(t,i,r),r.hasShapes()){if(this.meetsRenderCriteria(t,e,r))return void this.addTile(t,r);for(var n=e.level(r.level.levelNumber+1),o=t.pickingMode?r.subdivide(n,this):r.subdivideToCache(n,this,this.tileCache),s=0,a=o.length;s<a;s+=1){var l=o[s];this.addTileOrDescendants(t,e,r,l)}r.clearShapes()}},b.prototype.addIntersectingShapes=function(t,e,i){for(var r=e.getShapes(),n=0,o=r.length;n<o;n+=1){var s=r[n],a=s.computeSectors(t);if(a)for(var l=0,h=a.length;l<h;l+=1){var u=a[l];if(i.getSector().intersects(u)){i.addSurfaceShape(s);break}}}},b.prototype.addTile=function(t,e){t.pickingMode&&(e.pickSequence=b.pickSequence),e.needsUpdate(t)&&e.updateTexture(t),this.surfaceShapeTiles.push(e)},b.prototype.createTile=function(t,e,i,r){return new m(t,e,i,r)},b.prototype.createTopLevelTiles=function(){S.createTilesForLevel(this.levels.firstLevel(),this,this.topLevelTiles)},b.prototype.intersectsFrustum=function(t,e){return!(t.globe.projectionLimits&&!e.sector.overlaps(t.globe.projectionLimits))&&(e.update(t),e.extent.intersectsFrustum(t.pickingMode?t.pickFrustum:t.navigatorState.frustumInModelCoordinates))},b.prototype.meetsRenderCriteria=function(t,e,i){return i.level.levelNumber==e.lastLevel().levelNumber||!i.mustSubdivide(t,this.detailControl)},b.pickSequence=0,b}),i("shaders/SurfaceTileRendererProgram",["../error/ArgumentError","../util/Color","../shaders/GpuProgram","../util/Logger"],function(t,e,i,r){"use strict";var n=function(t){i.call(this,t,"attribute vec4 vertexPoint;\nattribute vec4 vertexTexCoord;\nuniform mat4 mvpMatrix;\nuniform mat4 texSamplerMatrix;\nuniform mat4 texMaskMatrix;\nvarying vec2 texSamplerCoord;\nvarying vec2 texMaskCoord;\nvoid main() {\ngl_Position = mvpMatrix * vertexPoint;\ntexSamplerCoord = (texSamplerMatrix * vertexTexCoord).st;\ntexMaskCoord = (texMaskMatrix * vertexTexCoord).st;\n}","precision mediump float;\nuniform sampler2D texSampler;\nuniform float opacity;\nuniform vec4 color;\nuniform bool modulateColor;\nvarying vec2 texSamplerCoord;\nvarying vec2 texMaskCoord;\nbool isInsideTextureImage(const vec2 coord) {\n    return coord.x >= 0.0 && coord.x <= 1.0 && coord.y >= 0.0 && coord.y <= 1.0;\n}\nvoid main(void) {\nfloat mask = float(isInsideTextureImage(texMaskCoord));if (modulateColor) {\n    gl_FragColor = color * mask * floor(texture2D(texSampler, texSamplerCoord).a + 0.5);\n} else {\n    gl_FragColor = texture2D(texSampler, texSamplerCoord) * mask * opacity;\n}\n}"),this.vertexPointLocation=this.attributeLocation(t,"vertexPoint"),this.vertexTexCoordLocation=this.attributeLocation(t,"vertexTexCoord"),this.mvpMatrixLocation=this.uniformLocation(t,"mvpMatrix"),this.colorLocation=this.uniformLocation(t,"color"),this.modulateColorLocation=this.uniformLocation(t,"modulateColor"),this.texSamplerMatrixLocation=this.uniformLocation(t,"texSamplerMatrix"),this.texMaskMatrixLocation=this.uniformLocation(t,"texMaskMatrix"),this.texSamplerLocation=this.uniformLocation(t,"texSampler"),this.opacityLocation=this.uniformLocation(t,"opacity"),this.vertexPointLocation=-1};return n.key="WorldWindGpuSurfaceTileRenderingProgram",n.prototype=Object.create(i.prototype),n.prototype.loadModelviewProjection=function(e,i){if(!i)throw new t(r.logMessage(r.LEVEL_SEVERE,"SurfaceTileRendererProgram","loadModelviewProjection","missingMatrix"));this.loadUniformMatrix(e,i,this.mvpMatrixLocation)},n.prototype.loadTexSamplerMatrix=function(e,i){if(!i)throw new t(r.logMessage(r.LEVEL_SEVERE,"SurfaceTileRendererProgram","loadTexSamplerMatrix","missingMatrix"));this.loadUniformMatrix(e,i,this.texSamplerMatrixLocation)},n.prototype.loadTexMaskMatrix=function(e,i){if(!i)throw new t(r.logMessage(r.LEVEL_SEVERE,"SurfaceTileRendererProgram","loadTexMaskMatrix","missingMatrix"));this.loadUniformMatrix(e,i,this.texMaskMatrixLocation)},n.prototype.loadTexSampler=function(t,e){t.uniform1i(this.texSamplerLocation,e-WebGLRenderingContext.TEXTURE0)},n.prototype.loadOpacity=function(t,e){t.uniform1f(this.opacityLocation,e)},n.prototype.loadColor=function(e,i){if(!i)throw new t(r.logMessage(r.LEVEL_SEVERE,"SurfaceTileRendererProgram","loadColor","missingColor"));this.loadUniformColor(e,i,this.colorLocation)},n.prototype.loadModulateColor=function(t,e){t.uniform1i(this.modulateColorLocation,e?1:0)},n}),i("render/SurfaceTileRenderer",["../error/ArgumentError","../util/Logger","../geom/Matrix","../shapes/SurfaceShapeTile","../shaders/SurfaceTileRendererProgram"],function(t,e,i,r,n){"use strict";var o=function(){this.texMaskMatrix=i.fromIdentity(),this.texSamplerMatrix=i.fromIdentity(),this.isSurfaceShapeTileRendering=!1};return o.prototype.renderTiles=function(i,n,o,s){if(!n)throw new t(e.logMessage(e.LEVEL_SEVERE,"SurfaceTileRenderer","renderTiles","Specified surface tiles array is null or undefined."));if(!(n.length<1)){var a,l,h,u,c=i.terrain,d=i.currentGlContext,p=0,f=1;if(c){this.isSurfaceShapeTileRendering=n[0]instanceof r,o*=i.surfaceOpacity,a=this.beginRendering(i,o),c.beginRendering(i);try{for(var g=0,m=c.surfaceGeometry.length;g<m;g++){l=c.surfaceGeometry[g],h=l.sector,c.beginRenderingTile(i,l);try{for(var E=0,y=n.length;E<y;E++)u=n[E],u.sector.overlaps(h)&&u.bind(i)&&(i.pickingMode?u.pickColor&&a.loadColor(d,u.pickColor):s&&u.opacity!=f&&(a.loadOpacity(d,o*u.opacity),f=u.opacity),this.applyTileState(i,l,u),c.renderTile(i,l),++p)}catch(t){console.log(t)}finally{c.endRenderingTile(i,l)}}}catch(t){console.log(t)}finally{c.endRendering(i),this.endRendering(i),i.frameStatistics.incrementRenderedTileCount(p)}}}},o.prototype.beginRendering=function(t,e){var i=t.currentGlContext,r=t.findAndBindProgram(n);return r.loadTexSampler(i,i.TEXTURE0),t.pickingMode&&!this.isSurfaceShapeTileRendering?r.loadModulateColor(i,!0):(r.loadModulateColor(i,!1),r.loadOpacity(i,e)),r},o.prototype.endRendering=function(t){var e=t.currentGlContext;e.bindTexture(e.TEXTURE_2D,null)},o.prototype.applyTileState=function(t,e,i){var r=t.currentGlContext,n=t.currentProgram,o=e.sector,s=o.deltaLatitude(),a=o.deltaLongitude(),l=i.sector,h=l.deltaLatitude(),u=l.deltaLongitude(),c=h>0?h:1,d=u>0?u:1,p=a/d,f=s/c,g=-(l.minLongitude-o.minLongitude)/d,m=-(l.minLatitude-o.minLatitude)/c;this.texMaskMatrix.set(p,0,0,g,0,f,0,m,0,0,1,0,0,0,0,1),this.texSamplerMatrix.setToUnitYFlip(),i.applyInternalTransform(t,this.texSamplerMatrix),this.texSamplerMatrix.multiplyMatrix(this.texMaskMatrix),n.loadTexSamplerMatrix(r,this.texSamplerMatrix),n.loadTexMaskMatrix(r,this.texMaskMatrix)},o}),i("render/TextSupport",["../error/ArgumentError","../shaders/BasicTextureProgram","../util/Color","../util/Logger","../geom/Matrix","../render/Texture","../geom/Vec2"],function(t,e,i,r,n,o,s){"use strict";var a=function(){this.canvas2D=document.createElement("canvas"),this.ctx2D=this.canvas2D.getContext("2d"),this.lineSpacing=.15,this.strokeStyle="rgba(0, 0, 0, 0.5)",this.strokeWidth=4};return a.prototype.textSize=function(t,e,i){if(0===t.length)return new s(0,0);this.ctx2D.font=e.fontString;for(var r=t.split("\n"),n=r.length*(e.size*(1+this.lineSpacing)),o=0,a=0;a<r.length;a++)o=Math.max(o,this.ctx2D.measureText(r[a]).width);return i&&(o+=this.strokeWidth,n+=this.strokeWidth),new s(o,n)},a.prototype.createTexture=function(t,e,r,n){var s=t.currentGlContext,a=this.ctx2D,l=this.canvas2D,h=this.textSize(e,r,n),u=e.split("\n"),c=n?this.strokeWidth/2:0,d=t.pixelScale;l.width=Math.ceil(h[0])*d,l.height=Math.ceil(h[1])*d,a.scale(d,d),a.font=r.fontString,a.textBaseline="top",a.textAlign=r.horizontalAlignment,a.fillStyle=i.WHITE.toHexString(!1),a.strokeStyle=this.strokeStyle,a.lineWidth=this.strokeWidth,a.lineCap="round",a.lineJoin="round","left"===r.horizontalAlignment?a.translate(c,0):"right"===r.horizontalAlignment?a.translate(h[0]-c,0):a.translate(h[0]/2,0);for(var p=0;p<u.length;p++)n&&a.strokeText(u[p],0,0),a.fillText(u[p],0,0),a.translate(0,r.size*(1+this.lineSpacing)+c);return new o(s,l)},a.prototype.getMaxLineHeight=function(t){return this.textSize("_É",t,0)[1]},a.prototype.wrap=function(e,i,n,o){if(!e)throw new t(r.logMessage(r.WARNING,"TextSupport","wrap","missing text"));var s,a=e.split("\n"),l="";for(s=0;s<a.length;s++)a[s]=this.wrapLine(a[s],i,o);var h=0,u=!1,c=this.getMaxLineHeight(o);for(s=0;s<a.length&&!u;s++){for(var d=a[s].split("\n"),p=0;p<d.length&&!u;p++)n<=0||h+c<=n?(l+=d[p],h+=c+this.lineSpacing,p<d.length-1&&(l+="\n")):u=!0;s<a.length-1&&!u&&(l+="\n")}return u&&(l.length>0&&(l=l.substring(0,l.length-1)),l+="..."),l},a.prototype.wrapLine=function(t,e,i){var r="",n=t.trim();if(this.textSize(n,i,0)[0]>e){for(var o="",s=0,a=n.indexOf(" ",s+1);s<n.length;){-1==a&&(a=n.length);var l=n.substring(s,a),h=o+l;this.textSize(h,i,0)[0]<=e?o+=l:0!=o.length?(r+=o,r+="\n",o="",o+=l.trim()):o+=l.trim(),(s=a)<n.length-1&&(a=n.indexOf(" ",s+1))}r+=o}else r+=n;return r},a}),i("render/DrawContext",["../error/ArgumentError","../util/Color","../util/FrameStatistics","../render/FramebufferTexture","../render/FramebufferTileController","../geom/Frustum","../globe/Globe","../shaders/GpuProgram","../cache/GpuResourceCache","../layer/Layer","../util/Logger","../geom/Matrix","../navigate/NavigatorState","../pick/PickedObjectList","../geom/Plane","../geom/Position","../geom/Rectangle","../render/ScreenCreditController","../geom/Sector","../shapes/SurfaceShape","../shapes/SurfaceShapeTileBuilder","../render/SurfaceTileRenderer","../render/TextSupport","../geom/Vec2","../geom/Vec3","../util/WWMath"],function(t,e,i,r,n,o,s,a,l,h,u,c,d,p,f,g,m,E,y,_,v,S,b,T,L,w){"use strict";var R=function(i){if(!i)throw new t(u.logMessage(u.LEVEL_SEVERE,"Texture","constructor","missingGlContext"));this.currentGlContext=i,this.canvas2D=document.createElement("canvas"),this.ctx2D=this.canvas2D.getContext("2d"),this.clearColor=e.TRANSPARENT,this.gpuResourceCache=new l(WorldWind.configuration.gpuCacheSize,.8*WorldWind.configuration.gpuCacheSize),this.surfaceTileRenderer=new S,this.surfaceShapeTileBuilder=new v,this.surfaceShapeTileController=new n,this.screenCreditController=new E,this.textSupport=new b,this.currentFramebuffer=null,this.currentProgram=null,this.surfaceRenderables=[],this.orderedRenderingMode=!1,this.orderedRenderables=[],this.screeRenderables=[],this.orderedRenderablesCounter=0,this.timestamp=Date.now(),this.previousRedrawTimestamp=this.timestamp,this.redrawRequested=!1,this.globe=null,this.globeStateKey=null,this.layers=null,this.currentLayer=null,this.navigatorState=null,this.eyePosition=new g(0,0,0),this.screenProjection=c.fromIdentity(),this.terrain=null,this.verticalExaggeration=1,this.fadeTime=500,this.surfaceOpacity=1,this.frameStatistics=null,this.pickingMode=!1,this.pickTerrainOnly=!1,this.deepPicking=!1,this.regionPicking=!1,this.pickPoint=null,this.pickRectangle=null,this.pickFramebuffer=null,this.pickFrustum=null,this.pickColor=new e(0,0,0,1),this.objectsAtPickPoint=new p,this.pixelScale=1};return R.unitCubeKey="DrawContextUnitCubeKey",R.unitCubeElementsKey="DrawContextUnitCubeElementsKey",R.unitQuadKey="DrawContextUnitQuadKey",R.unitQuadKey3="DrawContextUnitQuadKey3",R.prototype.reset=function(){this.screenCreditController.clear(),this.surfaceRenderables=[],this.orderedRenderingMode=!1,this.orderedRenderables=[],this.screenRenderables=[],this.orderedRenderablesCounter=0;var t=this.timestamp;this.timestamp=Date.now(),this.timestamp===t&&++this.timestamp,this.redrawRequested=!1,this.globe=null,this.globeStateKey=null,this.layers=null,this.currentLayer=null,this.navigatorState=null,this.terrain=null,this.verticalExaggeration=1,this.frameStatistics=null,this.accumulateOrderedRenderables=!0,this.pickingMode=!1,this.pickTerrainOnly=!1,this.deepPicking=!1,this.regionPicking=!1,this.pickPoint=null,this.pickRectangle=null,this.pickFrustum=null,this.pickColor=new e(0,0,0,1),this.objectsAtPickPoint.clear()},R.prototype.update=function(){var t=this.currentGlContext,e=this.navigatorState.eyePoint;this.globeStateKey=this.globe.stateKey,this.globe.computePositionFromPoint(e[0],e[1],e[2],this.eyePosition),this.screenProjection.setToScreenProjection(t.drawingBufferWidth,t.drawingBufferHeight)},R.prototype.contextLost=function(){this.gpuResourceCache.clear(),this.pickFramebuffer=null,this.currentFramebuffer=null,this.currentProgram=null},R.prototype.contextRestored=function(){this.gpuResourceCache.clear()},R.prototype.bindFramebuffer=function(t){this.currentFramebuffer!=t&&(this.currentGlContext.bindFramebuffer(this.currentGlContext.FRAMEBUFFER,t?t.framebufferId:null),this.currentFramebuffer=t)},R.prototype.bindProgram=function(t){this.currentProgram!=t&&(this.currentGlContext.useProgram(t?t.programId:null),this.currentProgram=t)},R.prototype.findAndBindProgram=function(e){if(!e)throw new t(u.logMessage(u.LEVEL_SEVERE,"DrawContext","findAndBindProgram","The specified program constructor is null or undefined."));var i=this.gpuResourceCache.resourceForKey(e.key);if(i)this.bindProgram(i);else try{i=new e(this.currentGlContext),this.bindProgram(i),this.gpuResourceCache.putResource(e.key,i,i.size)}catch(t){u.log(u.LEVEL_SEVERE,"Error attempting to create GPU program.")}return i},R.prototype.addSurfaceRenderable=function(t){t&&this.surfaceRenderables.push(t)},R.prototype.peekSurfaceRenderable=function(){return this.surfaceRenderables.length>0?this.surfaceRenderables[this.surfaceRenderables.length-1]:null},R.prototype.popSurfaceRenderable=function(){return this.surfaceRenderables.length>0?this.surfaceRenderables.pop():null},R.prototype.reverseSurfaceRenderables=function(){this.surfaceRenderables.reverse()},R.prototype.addOrderedRenderable=function(t,e){if(t){var i={orderedRenderable:t,insertionOrder:this.orderedRenderablesCounter++,eyeDistance:e||t.eyeDistance,globeStateKey:this.globeStateKey};this.globe.continuous&&(i.globeOffset=this.globe.offset),0===i.eyeDistance?this.screenRenderables.push(i):this.orderedRenderables.push(i)}},R.prototype.addOrderedRenderableToBack=function(t){if(t){var e={orderedRenderable:t,insertionOrder:this.orderedRenderablesCounter++,eyeDistance:Number.MAX_VALUE,globeStateKey:this.globeStateKey};this.globe.continuous&&(e.globeOffset=this.globe.offset),this.orderedRenderables.push(e)}},R.prototype.peekOrderedRenderable=function(){return this.orderedRenderables.length>0?this.orderedRenderables[this.orderedRenderables.length-1].orderedRenderable:null},R.prototype.popOrderedRenderable=function(){if(this.orderedRenderables.length>0){var t=this.orderedRenderables.pop();return this.globeStateKey=t.globeStateKey,this.globe.continuous&&(this.globe.offset=t.globeOffset),t.orderedRenderable}return null},R.prototype.nextScreenRenderable=function(){if(this.screenRenderables.length>0){var t=this.screenRenderables.shift();return this.globeStateKey=t.globeStateKey,this.globe.continuous&&(this.globe.offset=t.globeOffset),t.orderedRenderable}return null},R.prototype.sortOrderedRenderables=function(){this.orderedRenderables.sort(function(t,e){var i=t.eyeDistance,r=e.eyeDistance;if(i<r)return-1;if(i>r)return 1;var n=t.insertionOrder,o=e.insertionOrder;return n>o?-1:n<o?1:0})},R.prototype.readPickColor=function(t){var i=this.navigatorState.convertPointToViewport(t,new T(0,0)),r=new Uint8Array(4);return this.currentGlContext.readPixels(i[0],i[1],1,1,this.currentGlContext.RGBA,this.currentGlContext.UNSIGNED_BYTE,r),this.clearColor.equalsBytes(r)?null:e.colorFromByteArray(r)},R.prototype.readPickColors=function(t){var i,r=this.currentGlContext,n=new Uint8Array(t.width*t.height*4),o={},s=new e(0,0,0,0),a=r.getParameter(r.PACK_ALIGNMENT);r.pixelStorei(r.PACK_ALIGNMENT,1),this.currentGlContext.readPixels(t.x,t.y,t.width,t.height,r.RGBA,r.UNSIGNED_BYTE,n),r.pixelStorei(r.PACK_ALIGNMENT,a);for(var l=0,h=t.width*t.height;l<h;l++){var u=4*l;i=e.colorFromBytes(n[u],n[u+1],n[u+2],n[u+3]),i.equals(this.clearColor)||i.equals(s)||(o[i.toByteString()]=i)}return o},R.prototype.resolvePick=function(t){if(t.userObject instanceof _||!this.deepPicking||this.regionPicking)this.addPickedObject(t);else{var e=this.readPickColor(this.pickPoint);if(!e)return null;t.color.equals(e)&&this.addPickedObject(t)}},R.prototype.addPickedObject=function(t){t&&this.objectsAtPickPoint.add(t)},R.prototype.uniquePickColor=function(){var t=this.pickColor.nextColor().clone();return t.equals(this.clearColor)?t.nextColor():t},R.prototype.makePickFramebuffer=function(){var t=this.currentGlContext,e=t.drawingBufferWidth,i=t.drawingBufferHeight;return this.pickFramebuffer&&this.pickFramebuffer.width==e&&this.pickFramebuffer.height==i||(this.pickFramebuffer=new r(t,e,i,!0)),this.pickFramebuffer},R.prototype.makePickFrustum=function(){if(!this.pickPoint&&!this.pickRectangle)return!1;var t,e,i,r,n,s,a,l,h,u,c,d,p,g,E,y,_,v,S,b,R,x,M=new L(0,0,0),C=new L(0,0,0),A=this.pickRectangle,P=this.navigatorState.viewport;A||(x=this.navigatorState.convertPointToViewport(this.pickPoint,new T(0,0)),A=new m(x[0]-2,x[1]-2,4,4));var I=A.x,O=A.x+A.width,N=A.y,D=A.y+A.height;return!(O<0||D<0||I>P.x+P.width||N>P.y+P.height)&&(A.x=w.clamp(I,P.x,P.x+P.width),A.y=w.clamp(N,P.y,P.y+P.height),A.width=w.clamp(O,P.x,P.x+P.width)-A.x,A.height=w.clamp(D,P.y,P.y+P.height)-A.y,this.pickRectangle=A,C[0]=A.x,C[1]=A.y,C[2]=0,this.navigatorState.unProject(C,t=new L(0,0,0)),C[0]=A.x,C[1]=A.y,C[2]=1,this.navigatorState.unProject(C,e=new L(0,0,0)),C[0]=A.x+A.width,C[1]=A.y,C[2]=0,this.navigatorState.unProject(C,i=new L(0,0,0)),C[0]=A.x+A.width,C[1]=A.y,C[2]=1,this.navigatorState.unProject(C,r=new L(0,0,0)),C[0]=A.x,C[1]=A.y+A.height,C[2]=0,this.navigatorState.unProject(C,n=new L(0,0,0)),C[0]=A.x,C[1]=A.y+A.height,C[2]=1,this.navigatorState.unProject(C,s=new L(0,0,0)),C[0]=A.x+A.width,C[1]=A.y+A.height,C[2]=0,this.navigatorState.unProject(C,a=new L(0,0,0)),C[0]=A.x+A.width,C[1]=A.y+A.height,C[2]=1,this.navigatorState.unProject(C,l=new L(0,0,0)),R=new L(s[0]-t[0],s[1]-t[1],s[2]-t[2]),M.set(n[0]-e[0],n[1]-e[1],n[2]-e[2]),h=R.cross(M),E=new f(h[0],h[1],h[2],-h.dot(t)),E.normalize(),R=new L(a[0]-r[0],a[1]-r[1],a[2]-r[2]),M.set(l[0]-i[0],l[1]-i[1],l[2]-i[2]),u=R.cross(M),y=new f(u[0],u[1],u[2],-u.dot(i)),y.normalize(),R=new L(s[0]-a[0],s[1]-a[1],s[2]-a[2]),M.set(l[0]-n[0],l[1]-n[1],l[2]-n[2]),c=R.cross(M),_=new f(c[0],c[1],c[2],-c.dot(n)),_.normalize(),R=new L(r[0]-t[0],r[1]-t[1],r[2]-t[2]),M.set(e[0]-i[0],e[1]-i[1],e[2]-i[2]),d=R.cross(M),v=new f(d[0],d[1],d[2],-d.dot(i)),v.normalize(),R=new L(n[0]-i[0],n[1]-i[1],n[2]-i[2]),M.set(a[0]-t[0],a[1]-t[1],a[2]-t[2]),p=R.cross(M),S=new f(p[0],p[1],p[2],-p.dot(t)),S.normalize(),R=new L(l[0]-e[0],l[1]-e[1],l[2]-e[2]),M.set(s[0]-r[0],s[1]-r[1],s[2]-r[2]),g=R.cross(M),b=new f(g[0],g[1],g[2],-g.dot(e)),b.normalize(),this.pickFrustum=new o(E,y,v,_,S,b),!0)},R.prototype.isSmall=function(t,e){if(!t)return!1;var i=this.navigatorState.eyePoint.distanceTo(t.center),r=this.navigatorState.pixelSizeAtDistance(i);return 2*t.radius<e*r},R.prototype.unitCubeBuffer=function(){var t=this.gpuResourceCache.resourceForKey(R.unitCubeKey);if(!t){var e=this.currentGlContext,i=new Float32Array(24),r=0;i[r++]=0,i[r++]=1,i[r++]=0,i[r++]=0,i[r++]=0,i[r++]=0,i[r++]=1,i[r++]=1,i[r++]=0,i[r++]=1,i[r++]=0,i[r++]=0,i[r++]=0,i[r++]=1,i[r++]=1,i[r++]=0,i[r++]=0,i[r++]=1,i[r++]=1,i[r++]=1,i[r++]=1,i[r++]=1,i[r++]=0,i[r]=1,t=e.createBuffer(),e.bindBuffer(e.ARRAY_BUFFER,t),e.bufferData(e.ARRAY_BUFFER,i,e.STATIC_DRAW),e.bindBuffer(e.ARRAY_BUFFER,null),this.frameStatistics.incrementVboLoadCount(1),this.gpuResourceCache.putResource(R.unitCubeKey,t,4*i.length)}return t},R.prototype.unitCubeElements=function(){var t=this.gpuResourceCache.resourceForKey(R.unitCubeElementsKey);if(!t){var e=this.currentGlContext,i=new Int16Array(60),r=0;i[r++]=1,i[r++]=0,i[r++]=3,i[r++]=3,i[r++]=0,i[r++]=2,i[r++]=4,i[r++]=5,i[r++]=6,i[r++]=6,i[r++]=5,i[r++]=7,i[r++]=5,i[r++]=1,i[r++]=7,i[r++]=7,i[r++]=1,i[r++]=3,i[r++]=6,i[r++]=2,i[r++]=4,i[r++]=4,i[r++]=2,i[r++]=0,i[r++]=4,i[r++]=0,i[r++]=5,i[r++]=5,i[r++]=0,i[r++]=1,i[r++]=7,i[r++]=3,i[r++]=6,i[r++]=6,i[r++]=3,i[r++]=2,i[r++]=0,i[r++]=1,i[r++]=1,i[r++]=3,i[r++]=3,i[r++]=2,i[r++]=2,i[r++]=0,i[r++]=4,i[r++]=5,i[r++]=5,i[r++]=7,i[r++]=7,i[r++]=6,i[r++]=6,i[r++]=4,i[r++]=0,i[r++]=4,i[r++]=5,i[r++]=1,i[r++]=2,i[r++]=6,i[r++]=7,i[r]=3,t=e.createBuffer(),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t),e.bufferData(e.ELEMENT_ARRAY_BUFFER,i,e.STATIC_DRAW),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,null),this.frameStatistics.incrementVboLoadCount(1),this.gpuResourceCache.putResource(R.unitCubeElementsKey,t,2*i.length)}return t},R.prototype.unitQuadBuffer=function(){var t=this.gpuResourceCache.resourceForKey(R.unitQuadKey);if(!t){var e=this.currentGlContext,i=new Float32Array(8);i[0]=0,i[1]=1,i[2]=0,i[3]=0,i[4]=1,i[5]=1,i[6]=1,i[7]=0,t=e.createBuffer(),e.bindBuffer(e.ARRAY_BUFFER,t),e.bufferData(e.ARRAY_BUFFER,i,e.STATIC_DRAW),e.bindBuffer(e.ARRAY_BUFFER,null),this.frameStatistics.incrementVboLoadCount(1),this.gpuResourceCache.putResource(R.unitQuadKey,t,4*i.length)}return t},R.prototype.unitQuadBuffer3=function(){var t=this.gpuResourceCache.resourceForKey(R.unitQuadKey3);if(!t){var e=this.currentGlContext,i=new Float32Array(12);i[0]=0,i[1]=1,i[2]=0,i[3]=0,i[4]=0,i[5]=0,i[6]=1,i[7]=1,i[8]=0,i[9]=1,i[10]=0,i[11]=0,t=e.createBuffer(),e.bindBuffer(e.ARRAY_BUFFER,t),e.bufferData(e.ARRAY_BUFFER,i,e.STATIC_DRAW),e.bindBuffer(e.ARRAY_BUFFER,null),this.frameStatistics.incrementVboLoadCount(1),this.gpuResourceCache.putResource(R.unitQuadKey3,t,4*i.length)}return t},R.prototype.surfacePointForMode=function(e,i,r,n,o){if(!o)throw new t(u.logMessage(u.LEVEL_SEVERE,"DrawContext","surfacePointForMode","missingResult"));if(this.terrain)this.terrain.surfacePointForMode(e,i,r,n,o);else{var s=r+this.globe.elevationAtLocation(e,i)*this.verticalExaggeration;this.globe.computePointFromPosition(e,i,s,o)}return o},R}),i("globe/EarthElevationModel",["../geom/Location","../geom/Sector","../globe/ElevationModel","../util/WmsUrlBuilder"],function(t,e,i,r){"use strict";var n=function(){i.call(this,e.FULL_SPHERE,new t(45,45),12,"application/bil16","EarthElevations256",256,256),this.displayName="Earth Elevation Model",this.minElevation=-11e3,this.maxElevation=8850,this.pixelIsPoint=!1,this.urlBuilder=new r("https://worldwind26.arc.nasa.gov/elev","GEBCO,aster_v2,USGS-NED","","1.3.0")};return n.prototype=Object.create(i.prototype),n}),i("globe/EarthRestElevationModel",["../geom/Location","../geom/Sector","../globe/ElevationModel","../util/LevelRowColumnUrlBuilder"],function(t,e,i,r){"use strict";var n=function(n,o,s){i.call(this,e.FULL_SPHERE,new t(60,60),5,"application/bil16","EarthElevations",512,512),this.displayName=s,this.minElevation=-11e3,this.maxElevation=8850,this.urlBuilder=new r(n,o)};return n.prototype=Object.create(i.prototype),n}),i("layer/FrameStatisticsLayer",["../error/ArgumentError","../util/Color","../util/Font","../layer/Layer","../util/Logger","../util/Offset","../shapes/ScreenText","../shapes/TextAttributes"],function(t,e,i,r,n,o,s,a){"use strict";var l=function(l){function h(t,e){c.handleRedraw(t,e)}if(!l)throw new t(n.logMessage(n.LEVEL_SEVERE,"FrameStatisticsLayer","constructor","missingWorldWindow"));r.call(this,"Frame Statistics"),this.pickEnabled=!1;var u=new a(null);u.color=e.GREEN,u.font=new i(12),u.offset=new o(WorldWind.OFFSET_FRACTION,0,WorldWind.OFFSET_FRACTION,1),this.frameTime=new s(new o(WorldWind.OFFSET_PIXELS,5,WorldWind.OFFSET_INSET_PIXELS,5)," "),this.frameTime.attributes=u,this.frameRate=new s(new o(WorldWind.OFFSET_PIXELS,5,WorldWind.OFFSET_INSET_PIXELS,25)," "),this.frameRate.attributes=u;var c=this;l.redrawCallbacks.push(h)};return l.prototype=Object.create(r.prototype),l.prototype.doRender=function(t){this.frameRate.render(t),this.frameTime.render(t),this.inCurrentFrame=!0},l.prototype.handleRedraw=function(t,e){if(e==WorldWind.BEFORE_REDRAW){var i=t.frameStatistics;this.frameTime.text="Frame time  "+i.frameTimeAverage.toFixed(0)+" ms  ("+i.frameTimeMin.toFixed(0)+" - "+i.frameTimeMax.toFixed(0)+")",this.frameRate.text="Frame rate  "+i.frameRateAverage.toFixed(0)+" fps"}},l}),i("shapes/AbstractShape",["../error/ArgumentError","../util/Logger","../geom/Matrix","../cache/MemoryCache","../render/Renderable","../shapes/ShapeAttributes","../error/UnsupportedOperationError","../geom/Vec3"],function(t,e,i,r,n,o,s,a){"use strict";var l=function(t){n.call(this),this._attributes=t||new o(null),this._highlightAttributes=null,this.highlighted=!1,this._altitudeMode=WorldWind.ABSOLUTE,this.referencePosition=null,this.shapeDataCache=new r(3,2),this.currentData=null,this.activeAttributes=null,this.expirationInterval=2e3,this.useSurfaceShapeFor2D=!1,this.scratchMatrix=i.fromIdentity()};return l.prototype=Object.create(n.prototype),Object.defineProperties(l.prototype,{attributes:{get:function(){return this._attributes},set:function(t){this._attributes=t,this.surfaceShape&&(this.surfaceShape.attributes=this._attributes)}},highlightAttributes:{get:function(){return this._highlightAttributes},set:function(t){this._highlightAttributes=t,this.surfaceShape&&(this.surfaceShape.highlightAttributes=this._highlightAttributes)}},altitudeMode:{get:function(){return this._altitudeMode},set:function(i){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"AbstractShape","altitudeMode","missingAltitudeMode"));this._altitudeMode=i,this.reset()}}}),l.prototype.reset=function(){this.shapeDataCache.clear(!1),this.surfaceShape=null},l.prototype.updateSurfaceShape=function(){this.surfaceShape.displayName=this.displayName,this.surfaceShape.highlighted=this.highlighted,this.surfaceShape.enabled=this.enabled,this.surfaceShape.pathType=this.pathType,this.surfaceShape.pickDelegate=this.pickDelegate?this.pickDelegate:this},l.prototype.createSurfaceShape=function(){return null},l.prototype.render=function(t){if(this.enabled&&t.accumulateOrderedRenderables){if(t.globe.is2D()&&this.useSurfaceShapeFor2D&&(this.surfaceShape||(this.surfaceShape=this.createSurfaceShape(),this.surfaceShape&&(this.surfaceShape.attributes=this._attributes,this.surfaceShape.highlightAttributes=this._highlightAttributes)),this.surfaceShape))return this.updateSurfaceShape(),void this.surfaceShape.render(t);if((t.terrain||this.altitudeMode==WorldWind.ABSOLUTE)&&(this.establishCurrentData(t),(!t.globe.projectionLimits||this.isWithinProjectionLimits(t))&&(!this.currentData.extent||this.intersectsFrustum(t))&&(this.determineActiveAttributes(t),this.activeAttributes))){var e=this.makeOrderedRenderable(t);if(e){if(!this.intersectsFrustum(t))return;if(t.isSmall(this.currentData.extent,1))return;e.layer=t.currentLayer,t.addOrderedRenderable(e,this.currentData.eyeDistance)}}}},l.prototype.renderOrdered=function(t){this.currentData=this.shapeDataCache.entryForKey(t.globeStateKey),this.beginDrawing(t);try{this.doRenderOrdered(t)}finally{this.endDrawing(t)}},l.prototype.makeOrderedRenderable=function(t){
var e=this.doMakeOrderedRenderable(t);return this.currentData.verticalExaggeration=t.verticalExaggeration,e},l.prototype.doMakeOrderedRenderable=function(t){throw new s(e.logMessage(e.LEVEL_SEVERE,"AbstractShape","makeOrderedRenderable","abstractInvocation"))},l.prototype.doRenderOrdered=function(t){throw new s(e.logMessage(e.LEVEL_SEVERE,"AbstractShape","doRenderOrdered","abstractInvocation"))},l.prototype.beginDrawing=function(t){},l.prototype.endDrawing=function(t){},l.prototype.intersectsFrustum=function(t){return!this.currentData||!this.currentData.extent||(t.pickingMode?this.currentData.extent.intersectsFrustum(t.pickFrustum):this.currentData.extent.intersectsFrustum(t.navigatorState.frustumInModelCoordinates))},l.prototype.establishCurrentData=function(t){this.currentData=this.shapeDataCache.entryForKey(t.globeStateKey),this.currentData||(this.currentData=this.createShapeDataObject(),this.resetExpiration(this.currentData),this.shapeDataCache.putEntry(t.globeStateKey,this.currentData,1)),this.currentData.isExpired=!this.isShapeDataCurrent(t,this.currentData)},l.prototype.createShapeDataObject=function(){return{transformationMatrix:i.fromIdentity(),referencePoint:new a(0,0,0)}},l.prototype.resetExpiration=function(t){t.expiryTime=Date.now()+this.expirationInterval+1e3*Math.random()},l.prototype.isShapeDataCurrent=function(t,e){return e.verticalExaggeration===t.verticalExaggeration&&e.expiryTime>Date.now()},l.prototype.determineActiveAttributes=function(t){this.highlighted&&this._highlightAttributes?this.activeAttributes=this.highlightAttributes:this.activeAttributes=this._attributes},l.prototype.isWithinProjectionLimits=function(t){return!0},l.prototype.applyMvpMatrix=function(t){this.scratchMatrix.copy(t.navigatorState.modelviewProjection),this.scratchMatrix.multiplyMatrix(this.currentData.transformationMatrix),t.currentProgram.loadModelviewProjection(t.currentGlContext,this.scratchMatrix)},l.prototype.applyMvpMatrixForOutline=function(t){this.scratchMatrix.copy(t.navigatorState.projection),this.scratchMatrix.offsetProjectionDepth(-.001),this.scratchMatrix.multiplyMatrix(t.navigatorState.modelview),this.scratchMatrix.multiplyMatrix(this.currentData.transformationMatrix),t.currentProgram.loadModelviewProjection(t.currentGlContext,this.scratchMatrix)},l}),i("shapes/AbstractMesh",["../shapes/AbstractShape","../error/ArgumentError","../shaders/BasicTextureProgram","../geom/BoundingBox","../util/Color","../util/ImageSource","../geom/Line","../geom/Location","../util/Logger","../geom/Matrix","../pick/PickedObject","../geom/Position","../shapes/ShapeAttributes","../geom/Vec2","../geom/Vec3","../util/WWMath"],function(t,e,i,r,n,o,s,a,l,h,u,c,d,p,f,g){"use strict";var m=function(e){t.call(this,e),this.pickTransparentImagePixels=!0,this._altitudeScale=1};return m.prototype=Object.create(t.prototype),Object.defineProperties(m.prototype,{altitudeScale:{get:function(){return this._altitudeScale},set:function(t){this._altitudeScale=t,this.reset()}}}),m.prototype.mustGenerateGeometry=function(t){return!this.currentData.meshPoints||(this.currentData.drawInterior!==this.activeAttributes.drawInterior||(!(!this.activeAttributes.applyLighting||this.currentData.normals)||this.altitudeMode!==WorldWind.ABSOLUTE&&this.currentData.isExpired))},m.prototype.doMakeOrderedRenderable=function(t){if(!this.activeAttributes.drawInterior&&!this.activeAttributes.drawOutline)return null;if(!this.mustGenerateGeometry(t))return this;var e=this.currentData,i=e.referencePoint;return t.surfacePointForMode(this.referencePosition.latitude,this.referencePosition.longitude,this.referencePosition.altitude*this._altitudeScale,this._altitudeMode,i),e.transformationMatrix.setToTranslation(i[0],i[1],i[2]),e.meshPoints=this.computeMeshPoints(t,e),e.refreshVertexBuffer=!0,this.activeAttributes.imageSource&&!this.texCoords&&(this.texCoords=this.computeTexCoords(),this.texCoords&&(e.refreshTexCoordBuffer=!0)),this.meshIndices||(this.meshIndices=this.computeMeshIndices(),e.refreshMeshIndices=!0),this.meshOutlineIndices||(this.meshOutlineIndices=this.computeOutlineIndices(),this.meshOutlineIndices&&(e.refreshOutlineIndices=!0)),this.activeAttributes.applyLighting&&this.computeNormals(e),e.drawInterior=this.activeAttributes.drawInterior,this.resetExpiration(e),e.extent||(e.extent=new r),e.extent.setToPoints(e.meshPoints),e.extent.translate(e.referencePoint),this},m.prototype.computeMeshPoints=function(t,e){throw new UnsupportedOperationError(l.logMessage(l.LEVEL_SEVERE,"AbstractMesh","computeMeshPoints","abstractInvocation"))},m.prototype.computeTexCoords=function(){return null},m.prototype.computeMeshIndices=function(t){throw new UnsupportedOperationError(l.logMessage(l.LEVEL_SEVERE,"AbstractMesh","computeMeshIndices","abstractInvocation"))},m.prototype.computeOutlineIndices=function(t){},m.prototype.computeNormals=function(t){for(var e,i=new Float32Array(t.meshPoints.length),r=this.meshIndices,n=t.meshPoints,o=[],s=[new f(0,0,0),new f(0,0,0),new f(0,0,0)],a=0;a<r.length;a+=3){for(var l=0;l<3;l++)e=r[a+l],s[l].set(n[3*e],n[3*e+1],n[3*e+2]);var h=f.computeTriangleNormal(s[0],s[1],s[2]);for(l=0;l<3;l++)e=r[a+l],o[e]||(o[e]=[]),o[e].push(h)}for(h=new f(0,0,0),a=0;a<o.length;a++)o[a]?(f.average(o[a],h),h.normalize(),i[3*a]=h[0],i[3*a+1]=h[1],i[3*a+2]=h[2]):(i[3*a]=0,i[3*a+1]=0,i[3*a+2]=0);t.normals=i,t.refreshNormalsBuffer=!0},m.prototype.doRenderOrdered=function(t){var e,i,r,n,o=t.currentGlContext,s=t.currentProgram,a=this.currentData,l=this.texCoords&&!!this.activeAttributes.imageSource;if(t.pickingMode&&(n=t.uniquePickColor()),a.pointsVboCacheKey||(a.pointsVboCacheKey=t.gpuResourceCache.generateCacheKey()),e=t.gpuResourceCache.resourceForKey(a.pointsVboCacheKey),e||(e=o.createBuffer(),t.gpuResourceCache.putResource(a.pointsVboCacheKey,e,4*a.meshPoints.length),a.refreshVertexBuffer=!0),o.bindBuffer(o.ARRAY_BUFFER,e),a.refreshVertexBuffer&&(o.bufferData(o.ARRAY_BUFFER,a.meshPoints,o.STATIC_DRAW),t.frameStatistics.incrementVboLoadCount(1),a.refreshVertexBuffer=!1),o.vertexAttribPointer(s.vertexPointLocation,3,o.FLOAT,!1,0,0),s.loadTextureEnabled(o,!1),this.activeAttributes.drawInterior){var h=!t.pickingMode&&a.normals&&this.activeAttributes.applyLighting;this.applyMvpMatrix(t),a.meshIndicesVboCacheKey||(a.meshIndicesVboCacheKey=t.gpuResourceCache.generateCacheKey()),e=t.gpuResourceCache.resourceForKey(a.meshIndicesVboCacheKey),e||(e=o.createBuffer(),t.gpuResourceCache.putResource(a.meshIndicesVboCacheKey,e,2*this.meshIndices.length),a.refreshMeshIndices=!0),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,e),a.refreshMeshIndices&&(o.bufferData(o.ELEMENT_ARRAY_BUFFER,this.meshIndices,o.STATIC_DRAW),t.frameStatistics.incrementVboLoadCount(1),a.refreshMeshIndices=!1),r=this.activeAttributes.interiorColor,i=r.alpha*t.currentLayer.opacity,o.depthMask(i>=1||t.pickingMode),s.loadColor(o,t.pickingMode?n:r),s.loadOpacity(o,t.pickingMode?i>0?1:0:i),!l||t.pickingMode&&this.pickTransparentImagePixels||(this.activeTexture=t.gpuResourceCache.resourceForKey(this.activeAttributes.imageSource),this.activeTexture||(this.activeTexture=t.gpuResourceCache.retrieveTexture(t.currentGlContext,this.activeAttributes.imageSource)),this.activeTexture&&this.activeTexture.bind(t)&&(a.texCoordsVboCacheKey||(a.texCoordsVboCacheKey=t.gpuResourceCache.generateCacheKey()),e=t.gpuResourceCache.resourceForKey(a.texCoordsVboCacheKey),e||(e=o.createBuffer(),t.gpuResourceCache.putResource(a.texCoordsVboCacheKey,e,4*this.texCoords.length),a.refreshTexCoordBuffer=!0),o.bindBuffer(o.ARRAY_BUFFER,e),a.refreshTexCoordBuffer&&(o.bufferData(o.ARRAY_BUFFER,this.texCoords,o.STATIC_DRAW),t.frameStatistics.incrementVboLoadCount(1),a.refreshTexCoordBuffer=!1),o.enableVertexAttribArray(s.vertexTexCoordLocation),o.vertexAttribPointer(s.vertexTexCoordLocation,2,o.FLOAT,!1,0,0),this.scratchMatrix.setToIdentity(),this.scratchMatrix.multiplyByTextureTransform(this.activeTexture),s.loadTextureEnabled(o,!0),s.loadTextureUnit(o,o.TEXTURE0),s.loadTextureMatrix(o,this.scratchMatrix),s.loadModulateColor(o,t.pickingMode))),h&&(s.loadApplyLighting(o,!0),a.normalsVboCacheKey||(a.normalsVboCacheKey=t.gpuResourceCache.generateCacheKey()),e=t.gpuResourceCache.resourceForKey(a.normalsVboCacheKey),e||(e=o.createBuffer(),t.gpuResourceCache.putResource(a.normalsVboCacheKey,e,4*a.normals.length),a.refreshNormalsBuffer=!0),o.bindBuffer(o.ARRAY_BUFFER,e),a.refreshNormalsBuffer&&(o.bufferData(o.ARRAY_BUFFER,a.normals,o.STATIC_DRAW),t.frameStatistics.incrementVboLoadCount(1),a.refreshNormalsBuffer=!1),o.enableVertexAttribArray(s.normalVectorLocation),o.vertexAttribPointer(s.normalVectorLocation,3,o.FLOAT,!1,0,0)),o.drawElements(o.TRIANGLES,this.meshIndices.length,o.UNSIGNED_SHORT,0),l&&o.disableVertexAttribArray(s.vertexTexCoordLocation),h&&(s.loadApplyLighting(o,!1),o.disableVertexAttribArray(s.normalVectorLocation))}if(this.activeAttributes.drawOutline&&this.meshOutlineIndices&&(s.loadTextureEnabled(o,!1),o.disableVertexAttribArray(s.vertexTexCoordLocation),this.applyMvpMatrixForOutline(t),r=this.activeAttributes.outlineColor,i=r.alpha*t.currentLayer.opacity,o.depthMask(i>=1||t.pickingMode),s.loadColor(o,t.pickingMode?n:r),s.loadOpacity(o,t.pickingMode?1:i),o.lineWidth(this.activeAttributes.outlineWidth),a.outlineIndicesVboCacheKey||(a.outlineIndicesVboCacheKey=t.gpuResourceCache.generateCacheKey()),e=t.gpuResourceCache.resourceForKey(a.outlineIndicesVboCacheKey),e||(e=o.createBuffer(),t.gpuResourceCache.putResource(a.outlineIndicesVboCacheKey,e,2*this.meshOutlineIndices.length),a.refreshOutlineIndices=!0),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,e),a.refreshOutlineIndices&&(o.bufferData(o.ELEMENT_ARRAY_BUFFER,this.meshOutlineIndices,o.STATIC_DRAW),t.frameStatistics.incrementVboLoadCount(1),a.refreshOutlineIndices=!1),o.drawElements(o.LINE_STRIP,this.meshOutlineIndices.length,o.UNSIGNED_SHORT,0)),t.pickingMode){var c=this.computePickPosition(t),d=new u(n,this.pickDelegate?this.pickDelegate:this,c,t.currentLayer,!1);t.resolvePick(d)}},m.prototype.computePickPosition=function(t){var e=this.currentData,i=t.navigatorState.rayFromScreenPoint(t.pickPoint),r=new f(i.origin[0],i.origin[1],i.origin[2]).subtract(e.referencePoint),n=new s(r,i.direction),o=[];if(g.computeIndexedTrianglesIntersection(n,e.meshPoints,this.meshIndices,o)){var a=o[0];if(o.length>1)for(var l=a.distanceToSquared(t.navigatorState.eyePoint),h=1;h<o.length;h++){var u=o[h].distanceToSquared(t.navigatorState.eyePoint);u<l&&(l=u,a=o[h])}var d=new c(0,0,0);return t.globe.computePositionFromPoint(a[0]+e.referencePoint[0],a[1]+e.referencePoint[1],a[2]+e.referencePoint[2],d),d.altitude/=this._altitudeScale,d}return null},m.prototype.beginDrawing=function(t){var e=t.currentGlContext;if(this.activeAttributes.drawInterior){e.disable(e.CULL_FACE),t.findAndBindProgram(i);!t.pickMode&&this.currentData.normals&&this.activeAttributes.applyLighting&&t.currentProgram.loadModelviewInverse(e,t.navigatorState.modelviewNormalTransform)}e.enableVertexAttribArray(t.currentProgram.vertexPointLocation)},m.prototype.endDrawing=function(t){var e=t.currentGlContext;e.disableVertexAttribArray(t.currentProgram.vertexPointLocation),e.depthMask(!0),e.lineWidth(1),e.enable(e.CULL_FACE)},m}),i("shapes/SurfacePolygon",["../error/ArgumentError","../util/Logger","../shapes/ShapeAttributes","../shapes/SurfaceShape"],function(t,e,i,r){"use strict";var n=function(i,o){if(!Array.isArray(i))throw new t(e.logMessage(e.LEVEL_SEVERE,"SurfacePolygon","constructor","The specified boundary is not an array."));r.call(this,o),this._boundaries=i,this._stateId=n.stateId++};return n.prototype=Object.create(r.prototype),Object.defineProperties(n.prototype,{boundaries:{get:function(){return this._boundaries},set:function(i){if(!Array.isArray(i))throw new t(e.logMessage(e.LEVEL_SEVERE,"SurfacePolygon","set boundaries","The specified value is not an array."));this.resetBoundaries(),this._boundaries=i,this._stateId=n.stateId++,this.stateKeyInvalid=!0}}}),n.stateId=Number.MIN_SAFE_INTEGER,n.staticStateKey=function(t){return r.staticStateKey(t)+" pg "+t._stateId},n.prototype.computeStateKey=function(){return n.staticStateKey(this)},n.prototype.computeBoundaries=function(t){},n}),i("shapes/GeographicMesh",["../shapes/AbstractMesh","../error/ArgumentError","../shaders/BasicTextureProgram","../geom/BoundingBox","../util/Color","../util/ImageSource","../geom/Location","../util/Logger","../geom/Matrix","../pick/PickedObject","../geom/Position","../shapes/ShapeAttributes","../shapes/SurfacePolygon","../geom/Vec2","../geom/Vec3"],function(t,e,i,r,n,o,s,a,l,h,u,c,d,p,f){"use strict";var g=function(i,r){if(!i)throw new e(a.logMessage(a.LEVEL_SEVERE,"GeographicMesh","constructor","missingPositions"));if(i.length<2||i[0].length<2)throw new e(a.logMessage(a.LEVEL_SEVERE,"GeographicMesh","constructor","Number of positions is insufficient."));if(i.length*i[0].length>65536)throw new e(a.logMessage(a.LEVEL_SEVERE,"GeographicMesh","constructor","Too many positions. Must be fewer than 65536. Try using multiple meshes."));for(var n=i[0].length,o=1;o<i.length;o++)if(i[o].length!==n)throw new e(a.logMessage(a.LEVEL_SEVERE,"GeographicMesh","constructor","Array lengths are inconsistent."));var s=i.length,l=i[0].length;t.call(this,r),this.pickTransparentImagePixels=!0,this._positions=i,this._altitudeScale=1,this.numRows=s,this.numColumns=l,this._textureCoordinates=null,this.referencePosition=this.determineReferencePosition(this._positions)};return g.prototype=Object.create(t.prototype),Object.defineProperties(g.prototype,{positions:{get:function(){return this._positions},set:function(t){if(!t)throw new e(a.logMessage(a.LEVEL_SEVERE,"GeographicMesh","positions","missingPositions"));if(t.length<2||t[0].length<2)throw new e(a.logMessage(a.LEVEL_SEVERE,"GeographicMesh","positions","Number of positions is insufficient."));for(var i=t[0].length,r=1;r<t.length;r++)if(t[r].length!==i)throw new e(a.logMessage(a.LEVEL_SEVERE,"GeographicMesh","positions","Array lengths are inconsistent."));this.numRows=t.length,this.numColumns=t[0].length,this._positions=t,this.referencePosition=this.determineReferencePosition(this._positions),this.reset(),this.meshIndices=null,this.outlineIndices=null}},textureCoordinates:{get:function(){return this._textureCoordinates},set:function(t){if(t&&t.length!=this.numRows)throw new e(a.logMessage(a.LEVEL_SEVERE,"GeographicMesh","textureCoordinates","Number of texture coordinate rows is inconsistent with the currently specified positions."));for(var i=0;i<this.numRows;i++)if(t[i].length!==this.numColumns)throw new e(a.logMessage(a.LEVEL_SEVERE,"GeographicMesh","textureCoordinates","Texture coordinate row lengths are inconsistent with the currently specified positions."));this._textureCoordinates=t,this.reset(),this.texCoords=null}}}),g.makeGridIndices=function(t,e){for(var i=[],r=0,n=0;n<t-1;n++)for(var o=0;o<e-1;o++){var s=n*e+o;i[r++]=s,i[r++]=s+1,i[r++]=s+e,i[r++]=s+1,i[r++]=s+1+e,i[r++]=s+e}return i},g.prototype.determineReferencePosition=function(t){return t[0][0]},g.prototype.createSurfaceShape=function(){for(var t=[],e=0;e<this.numColumns;e++)t.push(this._positions[0][e]);for(var i=1;i<this.numRows;i++)t.push(this._positions[i][this.numColumns-1]);for(e=this.numColumns-2;e>=0;e--)t.push(this._positions[this.numRows-1][e]);for(i=this.numRows-2;i>0;i--)t.push(this._positions[i][0]);return new d(t,null)},g.prototype.computeMeshPoints=function(t,e){for(var i,r,n=Number.MAX_VALUE,o=t.navigatorState.eyePoint,s=new Float32Array(this.numRows*this.numColumns*3),a=new f(0,0,0),l=0,h=0;h<this._positions.length;h++)for(var u=0,c=this._positions[h].length;u<c;u++)i=this._positions[h][u],t.surfacePointForMode(i.latitude,i.longitude,i.altitude*this._altitudeScale,this.altitudeMode,a),r=a.distanceToSquared(o),r<n&&(n=r),a.subtract(this.currentData.referencePoint),s[l++]=a[0],s[l++]=a[1],s[l++]=a[2];return e.eyeDistance=Math.sqrt(n),s},g.prototype.computeTexCoords=function(){return this._textureCoordinates?this.computeExplicitTexCoords():this.computeImplicitTexCoords()},g.prototype.computeExplicitTexCoords=function(){for(var t=new Float32Array(2*this.numRows*this.numColumns),e=0,i=0;i<this._textureCoordinates.length;i++)for(var r=0,n=this._textureCoordinates[i].length;r<n;r++){var o=this._textureCoordinates[i][r];t[e++]=o[0],t[e++]=o[1]}return t},g.prototype.computeImplicitTexCoords=function(){for(var t=new Float32Array(2*this.numRows*this.numColumns),e=1/(this.numRows-1),i=1/(this.numColumns-1),r=0,n=0;n<this._positions.length;n++)for(var o=n===this.numRows-1?1:n*e,s=0,a=this._positions[n].length;s<a;s++)t[r++]=s===this.numColumns-1?1:s*i,t[r++]=o;return t},g.prototype.computeMeshIndices=function(){for(var t=new Uint16Array((this.numRows-1)*(this.numColumns-1)*6),e=0,i=0;i<this.numRows-1;i++)for(var r=0;r<this.numColumns-1;r++){var n=i*this.numColumns+r;t[e++]=n,t[e++]=n+1,t[e++]=n+this.numColumns,t[e++]=n+1,t[e++]=n+1+this.numColumns,t[e++]=n+this.numColumns}return t},g.prototype.computeOutlineIndices=function(){for(var t=new Uint16Array(2*this.numRows+2*this.numColumns),e=0,i=0;i<this.numColumns;i++)t[e++]=i;for(var r=1;r<this.numRows;r++)t[e++]=(r+1)*this.numColumns-1;for(i=this.numRows*this.numColumns-2;i>=(this.numRows-1)*this.numColumns;i--)t[e++]=i;for(r=this.numRows-2;r>=0;r--)t[e++]=r*this.numColumns;return t},g}),i("shapes/GeographicText",["../error/ArgumentError","../util/Logger","../shapes/Text","../geom/Vec3"],function(t,e,i,r){"use strict";var n=function(r,n){if(!r)throw new t(e.logMessage(e.LEVEL_SEVERE,"Text","constructor","missingPosition"));i.call(this,n),this.position=r,this.declutterGroup=1};return n.placePoint=new r(0,0,0),n.prototype=Object.create(i.prototype),n.prototype.clone=function(){var t=new n(this.position,this.text);return t.copy(this),t.pickDelegate=this.pickDelegate?this.pickDelegate:this,t},n.prototype.render=function(t){t.globe.projectionLimits&&!t.globe.projectionLimits.containsLocation(this.position.latitude,this.position.longitude)||i.prototype.render.call(this,t)},n.prototype.computeScreenPointAndEyeDistance=function(t){return t.surfacePointForMode(this.position.latitude,this.position.longitude,this.position.altitude,this.altitudeMode,n.placePoint),!!t.navigatorState.frustumInModelCoordinates.containsPoint(n.placePoint)&&(this.eyeDistance=this.alwaysOnTop?0:t.navigatorState.eyePoint.distanceTo(n.placePoint),!!t.navigatorState.projectWithDepth(n.placePoint,this.depthOffset,this.screenPoint))},n}),i("formats/geojson/GeoJSONConstants",[],function(){"use strict";var t=function(){};return t.FIELD_TYPE="type",t.FIELD_CRS="crs",t.FIELD_NAME="name",t.FIELD_BBOX="bbox",t.FIELD_COORDINATES="coordinates",t.FIELD_GEOMETRIES="geometries",t.FIELD_GEOMETRY="geometry",t.FIELD_PROPERTIES="properties",t.FIELD_FEATURES="features",t.FIELD_ID="id",t.TYPE_POINT="Point",t.TYPE_MULTI_POINT="MultiPoint",t.TYPE_LINE_STRING="LineString",t.TYPE_MULTI_LINE_STRING="MultiLineString",t.TYPE_POLYGON="Polygon",t.TYPE_MULTI_POLYGON="MultiPolygon",t.TYPE_GEOMETRY_COLLECTION="GeometryCollection",t.TYPE_FEATURE="Feature",t.TYPE_FEATURE_COLLECTION="FeatureCollection",t.FIELD_CRS_NAME="name",t.FIELD_CRS_LINK="link",t.WGS84_CRS="urn:ogc:def:crs:OGC:1.3:CRS84",t.EPSG4326_CRS="EPSG:4326",t}),i("formats/geojson/GeoJSONGeometry",["../../error/ArgumentError","./GeoJSONConstants","../../util/Logger"],function(t,e,i){"use strict";var r=function(e,r,n){if(!e)throw new t(i.logMessage(i.LEVEL_SEVERE,"GeoJSONGeometry","constructor","missingCoordinates"));if(!r)throw new t(i.logMessage(i.LEVEL_SEVERE,"GeoJSONGeometry","constructor","missingType"));this._coordinates=e,this._type=r,this._bbox=n||null};return Object.defineProperties(r.prototype,{coordinates:{get:function(){return this._coordinates}},type:{get:function(){return this._type}},bbox:{get:function(){return this._bbox}}}),r.prototype.isPointType=function(){return this.type===e.TYPE_POINT},r.prototype.isMultiPointType=function(){return this.type===e.TYPE_MULTI_POINT},r.prototype.isLineStringType=function(){return this.type===e.TYPE_LINE_STRING},r.prototype.isMultiLineStringType=function(){return this.type===e.TYPE_MULTI_LINE_STRING},r.prototype.isPolygonType=function(){return this.type===e.TYPE_POLYGON},r.prototype.isMultiPolygonType=function(){return this.type===e.TYPE_MULTI_POLYGON},r}),i("formats/geojson/GeoJSONGeometryCollection",["../../error/ArgumentError","./GeoJSONConstants","../../util/Logger"],function(t,e,i){"use strict";var r=function(e,r){if(!e)throw new t(i.logMessage(i.LEVEL_SEVERE,"GeoJSONGeometryCollection","constructor","missingGeometries"));if("[object Array]"!==Object.prototype.toString.call(e))throw new t(i.logMessage(i.LEVEL_SEVERE,"GeoJSONGeometryCollection","constructor","invalidGeometries"));this._geometries=e,this._bbox=r};return Object.defineProperties(r.prototype,{geometries:{get:function(){return this._geometries}},bbox:{get:function(){return this._bbox}}}),r}),i("formats/geojson/GeoJSONGeometryLineString",["../../error/ArgumentError","./GeoJSONGeometry","../../util/Logger"],function(t,e,i){"use strict";var r=function(r,n,o){if(!r)throw new t(i.logMessage(i.LEVEL_SEVERE,"GeoJSONGeometryLineString","constructor","missingCoordinates"));if(r.length<2||r[0].length<2)throw new t(i.logMessage(i.LEVEL_SEVERE,"GeoJSONGeometryLineString","constructor","invalidNumberOfCoordinates"));if("[object Array]"!==Object.prototype.toString.call(r[0])||"[object Number]"!==Object.prototype.toString.call(r[0][0]))throw new t(i.logMessage(i.LEVEL_SEVERE,"GeoJSONGeometryLineString","constructor","invalidCoordinatesType"));if(!n)throw new t(i.logMessage(i.LEVEL_SEVERE,"GeoJSONGeometryLineString","constructor","missingType"));e.call(this,r,n,o)};return r.prototype=Object.create(e.prototype),r}),i("formats/geojson/GeoJSONGeometryMultiLineString",["../../error/ArgumentError","./GeoJSONGeometry","../../util/Logger"],function(t,e,i){"use strict";var r=function(r,n,o){if(!r)throw new t(i.logMessage(i.LEVEL_SEVERE,"GeoJSONGeometryMultiLineString","constructor","missingCoordinates"));if(r[0].length<2||r[0][0].length<2)throw new t(i.logMessage(i.LEVEL_SEVERE,"GeoJSONGeometryMultiLineString","constructor","invalidNumberOfCoordinates"));if("[object Array]"!==Object.prototype.toString.call(r[0])||"[object Array]"!==Object.prototype.toString.call(r[0][0])||"[object Number]"!==Object.prototype.toString.call(r[0][0][0]))throw new t(i.logMessage(i.LEVEL_SEVERE,"GeoJSONGeometryMultiLineString","constructor","invalidCoordinatesType"));if(!n)throw new t(i.logMessage(i.LEVEL_SEVERE,"GeoJSONGeometryLineString","constructor","missingType"));e.call(this,r,n,o)};return r.prototype=Object.create(e.prototype),r}),i("formats/geojson/GeoJSONGeometryMultiPoint",["../../error/ArgumentError","./GeoJSONGeometry","../../util/Logger"],function(t,e,i){"use strict";var r=function(r,n,o){if(!r)throw new t(i.logMessage(i.LEVEL_SEVERE,"GeoJSONGeometryMultiPoint","constructor","missingCoordinates"));if(r[0].length<2)throw new t(i.logMessage(i.LEVEL_SEVERE,"GeoJSONGeometryMultiPoint","constructor","invalidNumberOfCoordinates"));if("[object Array]"!==Object.prototype.toString.call(r[0])||"[object Number]"!==Object.prototype.toString.call(r[0][0]))throw new t(i.logMessage(i.LEVEL_SEVERE,"GeoJSONGeometryMultiPoint","constructor","invalidCoordinatesType"));if(!n)throw new t(i.logMessage(i.LEVEL_SEVERE,"GeoJSONGeometryPoint","constructor","missingType"));e.call(this,r,n,o)};return r.prototype=Object.create(e.prototype),r}),i("formats/geojson/GeoJSONGeometryMultiPolygon",["../../error/ArgumentError","./GeoJSONGeometry","../../util/Logger"],function(t,e,i){"use strict";var r=function(r,n,o){if(!r)throw new t(i.logMessage(i.LEVEL_SEVERE,"GeoJSONGeometryMultiPolygon","constructor","missingCoordinates"));if("[object Array]"!==Object.prototype.toString.call(r[0])||"[object Array]"!==Object.prototype.toString.call(r[0][0])||"[object Array]"!==Object.prototype.toString.call(r[0][0][0])||"[object Number]"!==Object.prototype.toString.call(r[0][0][0][0]))throw new t(i.logMessage(i.LEVEL_SEVERE,"GeoJSONGeometryPolygon","constructor","invalidCoordinatesType"));if(!n)throw new t(i.logMessage(i.LEVEL_SEVERE,"GeoJSONGeometryPolygon","constructor","missingType"));e.call(this,r,n,o)};return r.prototype=Object.create(e.prototype),r}),i("formats/geojson/GeoJSONGeometryPoint",["../../error/ArgumentError","./GeoJSONGeometry","../../util/Logger"],function(t,e,i){"use strict";var r=function(r,n,o){if(!r)throw new t(i.logMessage(i.LEVEL_SEVERE,"GeoJSONGeometryPoint","constructor","missingCoordinates"));if(r.length<2)throw new t(i.logMessage(i.LEVEL_SEVERE,"GeoJSONGeometryPoint","constructor","invalidNumberOfCoordinates"));if("[object Array]"!==Object.prototype.toString.call(r)||"[object Number]"!==Object.prototype.toString.call(r[0]))throw new t(i.logMessage(i.LEVEL_SEVERE,"GeoJSONGeometryPoint","constructor","invalidCoordinatesType"));if(!n)throw new t(i.logMessage(i.LEVEL_SEVERE,"GeoJSONGeometryPoint","constructor","missingType"));e.call(this,r,n,o)};return r.prototype=Object.create(e.prototype),r}),i("formats/geojson/GeoJSONGeometryPolygon",["../../error/ArgumentError","./GeoJSONGeometry","../../util/Logger"],function(t,e,i){"use strict";var r=function(r,n,o){if(!r)throw new t(i.logMessage(i.LEVEL_SEVERE,"GeoJSONGeometryPolygon","constructor","missingCoordinates"));if(r[0].length<2||r[0][0].length<2)throw new t(i.logMessage(i.LEVEL_SEVERE,"GeoJSONGeometryPolygon","constructor","invalidNumberOfCoordinates"));if("[object Array]"!==Object.prototype.toString.call(r[0])||"[object Array]"!==Object.prototype.toString.call(r[0][0])||"[object Number]"!==Object.prototype.toString.call(r[0][0][0]))throw new t(i.logMessage(i.LEVEL_SEVERE,"GeoJSONGeometryPolygon","constructor","invalidCoordinatesType"));if(r[0][0]!==r[0][r.length-1])throw new t(i.logMessage(i.LEVEL_SEVERE,"GeoJSONGeometryPolygon","constructor","invalidLinearRing"));if(!n)throw new t(i.logMessage(i.LEVEL_SEVERE,"GeoJSONGeometryPolygon","constructor","missingType"));e.call(this,r,n,o)};return r.prototype=Object.create(e.prototype),r}),i("util/proj4-src",[],function(){"use strict";function t(t,e){if(t[e])return t[e];for(var i,r=Object.keys(t),n=e.toLowerCase().replace(Ge,""),o=-1;++o<r.length;)if(i=r[o],i.toLowerCase().replace(Ge,"")===n)return t[i]}function e(t){if("string"!=typeof t)throw new Error("not a string");this.text=t.trim(),this.level=0,this.place=0,this.root=null,this.stack=[],this.currentObject=null,this.state=Be}function i(t){return new e(t).output()}function r(t,e,i){Array.isArray(e)&&(i.unshift(e),e=null);var r=e?{}:t,o=i.reduce(function(t,e){return n(e,t),t},r);e&&(t[e]=o)}function n(t,e){if(!Array.isArray(t))return void(e[t]=!0);var i=t.shift();if("PARAMETER"===i&&(i=t.shift()),1===t.length)return Array.isArray(t[0])?(e[i]={},void n(t[0],e[i])):void(e[i]=t[0]);if(!t.length)return void(e[i]=!0);if("TOWGS84"===i)return void(e[i]=t);Array.isArray(i)||(e[i]={});var o;switch(i){case"UNIT":case"PRIMEM":case"VERT_DATUM":return e[i]={name:t[0].toLowerCase(),convert:t[1]},void(3===t.length&&n(t[2],e[i]));case"SPHEROID":case"ELLIPSOID":return e[i]={name:t[0],a:t[1],rf:t[2]},void(4===t.length&&n(t[3],e[i]));case"PROJECTEDCRS":case"PROJCRS":case"GEOGCS":case"GEOCCS":case"PROJCS":case"LOCAL_CS":case"GEODCRS":case"GEODETICCRS":case"GEODETICDATUM":case"EDATUM":case"ENGINEERINGDATUM":case"VERT_CS":case"VERTCRS":case"VERTICALCRS":case"COMPD_CS":case"COMPOUNDCRS":case"ENGINEERINGCRS":case"ENGCRS":case"FITTED_CS":case"LOCAL_DATUM":case"DATUM":return t[0]=["name",t[0]],void r(e,i,t);default:for(o=-1;++o<t.length;)if(!Array.isArray(t[o]))return n(t,e[i]);return r(e,i,t)}}function o(t,e){var i=e[0],r=e[1];!(i in t)&&r in t&&(t[i]=t[r],3===e.length&&(t[i]=e[2](t[i])))}function s(t){return t*Ye}function a(t){function e(e){return e*(t.to_meter||1)}"GEOGCS"===t.type?t.projName="longlat":"LOCAL_CS"===t.type?(t.projName="identity",t.local=!0):"object"==typeof t.PROJECTION?t.projName=Object.keys(t.PROJECTION)[0]:t.projName=t.PROJECTION,t.UNIT&&(t.units=t.UNIT.name.toLowerCase(),"metre"===t.units&&(t.units="meter"),t.UNIT.convert&&("GEOGCS"===t.type?t.DATUM&&t.DATUM.SPHEROID&&(t.to_meter=t.UNIT.convert*t.DATUM.SPHEROID.a):t.to_meter=t.UNIT.convert));var i=t.GEOGCS;"GEOGCS"===t.type&&(i=t),i&&(i.DATUM?t.datumCode=i.DATUM.name.toLowerCase():t.datumCode=i.name.toLowerCase(),"d_"===t.datumCode.slice(0,2)&&(t.datumCode=t.datumCode.slice(2)),"new_zealand_geodetic_datum_1949"!==t.datumCode&&"new_zealand_1949"!==t.datumCode||(t.datumCode="nzgd49"),"wgs_1984"===t.datumCode&&("Mercator_Auxiliary_Sphere"===t.PROJECTION&&(t.sphere=!0),t.datumCode="wgs84"),"_ferro"===t.datumCode.slice(-6)&&(t.datumCode=t.datumCode.slice(0,-6)),"_jakarta"===t.datumCode.slice(-8)&&(t.datumCode=t.datumCode.slice(0,-8)),~t.datumCode.indexOf("belge")&&(t.datumCode="rnb72"),i.DATUM&&i.DATUM.SPHEROID&&(t.ellps=i.DATUM.SPHEROID.name.replace("_19","").replace(/[Cc]larke\_18/,"clrk"),"international"===t.ellps.toLowerCase().slice(0,13)&&(t.ellps="intl"),t.a=i.DATUM.SPHEROID.a,t.rf=parseFloat(i.DATUM.SPHEROID.rf,10)),~t.datumCode.indexOf("osgb_1936")&&(t.datumCode="osgb36")),t.b&&!isFinite(t.b)&&(t.b=t.a),[["standard_parallel_1","Standard_Parallel_1"],["standard_parallel_2","Standard_Parallel_2"],["false_easting","False_Easting"],["false_northing","False_Northing"],["central_meridian","Central_Meridian"],["latitude_of_origin","Latitude_Of_Origin"],["latitude_of_origin","Central_Parallel"],["scale_factor","Scale_Factor"],["k0","scale_factor"],["latitude_of_center","Latitude_of_center"],["lat0","latitude_of_center",s],["longitude_of_center","Longitude_Of_Center"],["longc","longitude_of_center",s],["x0","false_easting",e],["y0","false_northing",e],["long0","central_meridian",s],["lat0","latitude_of_origin",s],["lat0","standard_parallel_1",s],["lat1","standard_parallel_1",s],["lat2","standard_parallel_2",s],["alpha","azimuth",s],["srsCode","name"]].forEach(function(e){return o(t,e)}),t.long0||!t.longc||"Albers_Conic_Equal_Area"!==t.projName&&"Lambert_Azimuthal_Equal_Area"!==t.projName||(t.long0=t.longc),t.lat_ts||!t.lat1||"Stereographic_South_Pole"!==t.projName&&"Polar Stereographic (variant B)"!==t.projName||(t.lat0=s(t.lat1>0?90:-90),t.lat_ts=t.lat1)}function l(t){var e=this;if(2===arguments.length){var i=arguments[1];"string"==typeof i?"+"===i.charAt(0)?l[t]=We(arguments[1]):l[t]=He(arguments[1]):l[t]=i}else if(1===arguments.length){if(Array.isArray(t))return t.map(function(t){Array.isArray(t)?l.apply(e,t):l(t)});if("string"==typeof t){if(t in l)return l[t]}else"EPSG"in t?l["EPSG:"+t.EPSG]=t:"ESRI"in t?l["ESRI:"+t.ESRI]=t:"IAU2000"in t?l["IAU2000:"+t.IAU2000]=t:console.log(t);return}}function h(t){return"string"==typeof t}function u(t){return t in l}function c(t){return Xe.some(function(e){return t.indexOf(e)>-1})}function d(t){return"+"===t[0]}function p(t){return h(t)?u(t)?l[t]:c(t)?He(t):d(t)?We(t):void 0:t}function f(){var t=this.b/this.a;this.es=1-t*t,"x0"in this||(this.x0=0),"y0"in this||(this.y0=0),this.e=Math.sqrt(this.es),this.lat_ts?this.sphere?this.k0=Math.cos(this.lat_ts):this.k0=Ze(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)):this.k0||(this.k?this.k0=this.k:this.k0=1)}function g(t){var e=t.x,i=t.y;if(i*Ne>90&&i*Ne<-90&&e*Ne>180&&e*Ne<-180)return null;var r,n;if(Math.abs(Math.abs(i)-Me)<=Ie)return null;if(this.sphere)r=this.x0+this.a*this.k0*$e(e-this.long0),n=this.y0+this.a*this.k0*Math.log(Math.tan(De+.5*i));else{var o=Math.sin(i),s=ti(this.e,i,o);r=this.x0+this.a*this.k0*$e(e-this.long0),n=this.y0-this.a*this.k0*Math.log(s)}return t.x=r,t.y=n,t}function m(t){var e,i,r=t.x-this.x0,n=t.y-this.y0;if(this.sphere)i=Me-2*Math.atan(Math.exp(-n/(this.a*this.k0)));else{var o=Math.exp(-n/(this.a*this.k0));if(-9999===(i=ei(this.e,o)))return null}return e=$e(this.long0+r/(this.a*this.k0)),t.x=e,t.y=i,t}function E(){}function y(t){return t}function _(t,e){var i=li.length;return t.names?(li[i]=t,t.names.forEach(function(t){ai[t.toLowerCase()]=i}),this):(console.log(e),!0)}function v(t){if(!t)return!1;var e=t.toLowerCase()
;return void 0!==ai[e]&&li[ai[e]]?li[ai[e]]:void 0}function S(){si.forEach(_)}function b(t,e,i,r){var n=t*t,o=e*e,s=(n-o)/n,a=0;return r?(t*=1-s*(Ce+s*(Ae+s*Pe)),n=t*t,s=0):a=Math.sqrt(s),{es:s,e:a,ep2:(n-o)/o}}function T(e,i,r,n,o){if(!e){var s=t(ui,n);s||(s=ci),e=s.a,i=s.b,r=s.rf}return r&&!i&&(i=(1-1/r)*e),(0===r||Math.abs(e-i)<Ie)&&(o=!0,i=e),{a:e,b:i,rf:r,sphere:o}}function L(t,e,i,r,n,o){var s={};return s.datum_type=void 0===t||"none"===t?Re:we,e&&(s.datum_params=e.map(parseFloat),0===s.datum_params[0]&&0===s.datum_params[1]&&0===s.datum_params[2]||(s.datum_type=Te),s.datum_params.length>3&&(0===s.datum_params[3]&&0===s.datum_params[4]&&0===s.datum_params[5]&&0===s.datum_params[6]||(s.datum_type=Le,s.datum_params[3]*=xe,s.datum_params[4]*=xe,s.datum_params[5]*=xe,s.datum_params[6]=s.datum_params[6]/1e6+1))),s.a=i,s.b=r,s.es=n,s.ep2=o,s}function w(e,i){if(!(this instanceof w))return new w(e);i=i||function(t){if(t)throw t};var r=p(e);if("object"!=typeof r)return void i(e);var n=w.projections.get(r.projName);if(!n)return void i(e);if(r.datumCode&&"none"!==r.datumCode){var o=t(di,r.datumCode);o&&(r.datum_params=o.towgs84?o.towgs84.split(","):null,r.ellps=o.ellipse,r.datumName=o.datumName?o.datumName:r.datumCode)}r.k0=r.k0||1,r.axis=r.axis||"enu",r.ellps=r.ellps||"wgs84";var s=T(r.a,r.b,r.rf,r.ellps,r.sphere),a=b(s.a,s.b,s.rf,r.R_A),l=r.datum||L(r.datumCode,r.datum_params,s.a,s.b,a.es,a.ep2);Je(this,r),Je(this,n),this.a=s.a,this.b=s.b,this.rf=s.rf,this.sphere=s.sphere,this.es=a.es,this.e=a.e,this.ep2=a.ep2,this.datum=l,this.init(),i(null,this)}function R(t,e){return t.datum_type===e.datum_type&&(!(t.a!==e.a||Math.abs(t.es-e.es)>5e-11)&&(t.datum_type===Te?t.datum_params[0]===e.datum_params[0]&&t.datum_params[1]===e.datum_params[1]&&t.datum_params[2]===e.datum_params[2]:t.datum_type!==Le||t.datum_params[0]===e.datum_params[0]&&t.datum_params[1]===e.datum_params[1]&&t.datum_params[2]===e.datum_params[2]&&t.datum_params[3]===e.datum_params[3]&&t.datum_params[4]===e.datum_params[4]&&t.datum_params[5]===e.datum_params[5]&&t.datum_params[6]===e.datum_params[6]))}function x(t,e,i){var r,n,o,s,a=t.x,l=t.y,h=t.z?t.z:0;if(l<-Me&&l>-1.001*Me)l=-Me;else if(l>Me&&l<1.001*Me)l=Me;else if(l<-Me||l>Me)return null;return a>Math.PI&&(a-=2*Math.PI),n=Math.sin(l),s=Math.cos(l),o=n*n,r=i/Math.sqrt(1-e*o),{x:(r+h)*s*Math.cos(a),y:(r+h)*s*Math.sin(a),z:(r*(1-e)+h)*n}}function M(t,e,i,r){var n,o,s,a,l,h,u,c,d,p,f,g,m,E,y,_,v=t.x,S=t.y,b=t.z?t.z:0;if(n=Math.sqrt(v*v+S*S),o=Math.sqrt(v*v+S*S+b*b),n/i<1e-12){if(E=0,o/i<1e-12)return y=Me,_=-r,{x:t.x,y:t.y,z:t.z}}else E=Math.atan2(S,v);s=b/o,a=n/o,l=1/Math.sqrt(1-e*(2-e)*a*a),c=a*(1-e)*l,d=s*l,m=0;do{m++,u=i/Math.sqrt(1-e*d*d),_=n*c+b*d-u*(1-e*d*d),h=e*u/(u+_),l=1/Math.sqrt(1-h*(2-h)*a*a),p=a*(1-h)*l,f=s*l,g=f*c-p*d,c=p,d=f}while(g*g>1e-24&&m<30);return y=Math.atan(f/Math.abs(p)),{x:E,y:y,z:_}}function C(t,e,i){if(e===Te)return{x:t.x+i[0],y:t.y+i[1],z:t.z+i[2]};if(e===Le){var r=i[0],n=i[1],o=i[2],s=i[3],a=i[4],l=i[5],h=i[6];return{x:h*(t.x-l*t.y+a*t.z)+r,y:h*(l*t.x+t.y-s*t.z)+n,z:h*(-a*t.x+s*t.y+t.z)+o}}}function A(t,e,i){if(e===Te)return{x:t.x-i[0],y:t.y-i[1],z:t.z-i[2]};if(e===Le){var r=i[0],n=i[1],o=i[2],s=i[3],a=i[4],l=i[5],h=i[6],u=(t.x-r)/h,c=(t.y-n)/h,d=(t.z-o)/h;return{x:u+l*c-a*d,y:-l*u+c+s*d,z:a*u-s*c+d}}}function P(t){return t===Te||t===Le}function I(t,e){return(t.datum.datum_type===Te||t.datum.datum_type===Le)&&"WGS84"!==e.datumCode||(e.datum.datum_type===Te||e.datum.datum_type===Le)&&"WGS84"!==t.datumCode}function O(t,e,i){var r;return Array.isArray(i)&&(i=gi(i)),t.datum&&e.datum&&I(t,e)&&(r=new w("WGS84"),i=O(t,r,i),t=r),"enu"!==t.axis&&(i=fi(t,!1,i)),"longlat"===t.projName?i={x:i.x*Oe,y:i.y*Oe}:(t.to_meter&&(i={x:i.x*t.to_meter,y:i.y*t.to_meter}),i=t.inverse(i)),t.from_greenwich&&(i.x+=t.from_greenwich),i=pi(t.datum,e.datum,i),e.from_greenwich&&(i={x:i.x-e.from_greenwich,y:i.y}),"longlat"===e.projName?i={x:i.x*Ne,y:i.y*Ne}:(i=e.forward(i),e.to_meter&&(i={x:i.x/e.to_meter,y:i.y/e.to_meter})),"enu"!==e.axis?fi(e,!0,i):i}function N(t,e,i){var r;return Array.isArray(i)?(r=O(t,e,i),3===i.length?[r.x,r.y,r.z]:[r.x,r.y]):O(t,e,i)}function D(t){return t instanceof w?t:t.oProj?t.oProj:w(t)}function k(t,e,i){t=D(t);var r,n=!1;return void 0===e?(e=t,t=mi,n=!0):(void 0!==e.x||Array.isArray(e))&&(i=e,e=t,t=mi,n=!0),e=D(e),i?N(t,e,i):(r={forward:function(i){return N(t,e,i)},inverse:function(i){return N(e,t,i)}},n&&(r.oProj=e),r)}function V(t,e){return e=e||5,z(U({lat:t[1],lon:t[0]}),e)}function F(t){var e=K(X(t.toUpperCase()));return e.lat&&e.lon?[e.lon,e.lat,e.lon,e.lat]:[e.left,e.bottom,e.right,e.top]}function G(t){var e=K(X(t.toUpperCase()));return e.lat&&e.lon?[e.lon,e.lat]:[(e.left+e.right)/2,(e.top+e.bottom)/2]}function W(t){return t*(Math.PI/180)}function B(t){return t/Math.PI*180}function U(t){var e,i,r,n,o,s,a,l,h,u=t.lat,c=t.lon,d=6378137,p=W(u),f=W(c);h=Math.floor((c+180)/6)+1,180===c&&(h=60),u>=56&&u<64&&c>=3&&c<12&&(h=32),u>=72&&u<84&&(c>=0&&c<9?h=31:c>=9&&c<21?h=33:c>=21&&c<33?h=35:c>=33&&c<42&&(h=37)),e=6*(h-1)-180+3,l=W(e),i=.006739496752268451,r=d/Math.sqrt(1-.00669438*Math.sin(p)*Math.sin(p)),n=Math.tan(p)*Math.tan(p),o=i*Math.cos(p)*Math.cos(p),s=Math.cos(p)*(f-l),a=d*(.9983242984503243*p-.002514607064228144*Math.sin(2*p)+2639046602129982e-21*Math.sin(4*p)-3.418046101696858e-9*Math.sin(6*p));var g=.9996*r*(s+(1-n+o)*s*s*s/6+(5-18*n+n*n+72*o-58*i)*s*s*s*s*s/120)+5e5,m=.9996*(a+r*Math.tan(p)*(s*s/2+(5-n+9*o+4*o*o)*s*s*s*s/24+(61-58*n+n*n+600*o-330*i)*s*s*s*s*s*s/720));return u<0&&(m+=1e7),{northing:Math.round(m),easting:Math.round(g),zoneNumber:h,zoneLetter:j(u)}}function K(t){var e=t.northing,i=t.easting,r=t.zoneLetter,n=t.zoneNumber;if(n<0||n>60)return null;var o,s,a,l,h,u,c,d,p,f,g=6378137,m=(1-Math.sqrt(.99330562))/(1+Math.sqrt(.99330562)),E=i-5e5,y=e;r<"N"&&(y-=1e7),d=6*(n-1)-180+3,o=.006739496752268451,c=y/.9996,p=c/6367449.145945056,f=p+(3*m/2-27*m*m*m/32)*Math.sin(2*p)+(21*m*m/16-55*m*m*m*m/32)*Math.sin(4*p)+151*m*m*m/96*Math.sin(6*p),s=g/Math.sqrt(1-.00669438*Math.sin(f)*Math.sin(f)),a=Math.tan(f)*Math.tan(f),l=o*Math.cos(f)*Math.cos(f),h=.99330562*g/Math.pow(1-.00669438*Math.sin(f)*Math.sin(f),1.5),u=E/(.9996*s);var _=f-s*Math.tan(f)/h*(u*u/2-(5+3*a+10*l-4*l*l-9*o)*u*u*u*u/24+(61+90*a+298*l+45*a*a-252*o-3*l*l)*u*u*u*u*u*u/720);_=B(_);var v=(u-(1+2*a+l)*u*u*u/6+(5-2*l+28*a-3*l*l+8*o+24*a*a)*u*u*u*u*u/120)/Math.cos(f);v=d+B(v);var S;if(t.accuracy){var b=K({northing:t.northing+t.accuracy,easting:t.easting+t.accuracy,zoneLetter:t.zoneLetter,zoneNumber:t.zoneNumber});S={top:b.lat,right:b.lon,bottom:_,left:v}}else S={lat:_,lon:v};return S}function j(t){var e="Z";return 84>=t&&t>=72?e="X":72>t&&t>=64?e="W":64>t&&t>=56?e="V":56>t&&t>=48?e="U":48>t&&t>=40?e="T":40>t&&t>=32?e="S":32>t&&t>=24?e="R":24>t&&t>=16?e="Q":16>t&&t>=8?e="P":8>t&&t>=0?e="N":0>t&&t>=-8?e="M":-8>t&&t>=-16?e="L":-16>t&&t>=-24?e="K":-24>t&&t>=-32?e="J":-32>t&&t>=-40?e="H":-40>t&&t>=-48?e="G":-48>t&&t>=-56?e="F":-56>t&&t>=-64?e="E":-64>t&&t>=-72?e="D":-72>t&&t>=-80&&(e="C"),e}function z(t,e){var i="00000"+t.easting,r="00000"+t.northing;return t.zoneNumber+t.zoneLetter+q(t.easting,t.northing,t.zoneNumber)+i.substr(i.length-5,e)+r.substr(r.length-5,e)}function q(t,e,i){var r=Y(i);return H(Math.floor(t/1e5),Math.floor(e/1e5)%20,r)}function Y(t){var e=t%Ei;return 0===e&&(e=Ei),e}function H(t,e,i){var r=i-1,n=yi.charCodeAt(r),o=_i.charCodeAt(r),s=n+t-1,a=o+e,l=!1;return s>Li&&(s=s-Li+vi-1,l=!0),(s===Si||n<Si&&s>Si||(s>Si||n<Si)&&l)&&s++,(s===bi||n<bi&&s>bi||(s>bi||n<bi)&&l)&&++s===Si&&s++,s>Li&&(s=s-Li+vi-1),a>Ti?(a=a-Ti+vi-1,l=!0):l=!1,(a===Si||o<Si&&a>Si||(a>Si||o<Si)&&l)&&a++,(a===bi||o<bi&&a>bi||(a>bi||o<bi)&&l)&&++a===Si&&a++,a>Ti&&(a=a-Ti+vi-1),String.fromCharCode(s)+String.fromCharCode(a)}function X(t){if(t&&0===t.length)throw"MGRSPoint coverting from nothing";for(var e,i=t.length,r=null,n="",o=0;!/[A-Z]/.test(e=t.charAt(o));){if(o>=2)throw"MGRSPoint bad conversion from: "+t;n+=e,o++}var s=parseInt(n,10);if(0===o||o+3>i)throw"MGRSPoint bad conversion from: "+t;var a=t.charAt(o++);if(a<="A"||"B"===a||"Y"===a||a>="Z"||"I"===a||"O"===a)throw"MGRSPoint zone letter "+a+" not handled: "+t;r=t.substring(o,o+=2);for(var l=Y(s),h=J(r.charAt(0),l),u=Z(r.charAt(1),l);u<Q(a);)u+=2e6;var c=i-o;if(c%2!=0)throw"MGRSPoint has to have an even number \nof digits after the zone letter and two 100km letters - front \nhalf for easting meters, second half for \nnorthing meters"+t;var d,p,f,g,m,E=c/2,y=0,_=0;return E>0&&(d=1e5/Math.pow(10,E),p=t.substring(o,o+E),y=parseFloat(p)*d,f=t.substring(o+E),_=parseFloat(f)*d),g=y+h,m=_+u,{easting:g,northing:m,zoneLetter:a,zoneNumber:s,accuracy:d}}function J(t,e){for(var i=yi.charCodeAt(e-1),r=1e5,n=!1;i!==t.charCodeAt(0);){if(i++,i===Si&&i++,i===bi&&i++,i>Li){if(n)throw"Bad character: "+t;i=vi,n=!0}r+=1e5}return r}function Z(t,e){if(t>"V")throw"MGRSPoint given invalid Northing "+t;for(var i=_i.charCodeAt(e-1),r=0,n=!1;i!==t.charCodeAt(0);){if(i++,i===Si&&i++,i===bi&&i++,i>Ti){if(n)throw"Bad character: "+t;i=vi,n=!0}r+=1e5}return r}function Q(t){var e;switch(t){case"C":e=11e5;break;case"D":e=2e6;break;case"E":e=28e5;break;case"F":e=37e5;break;case"G":e=46e5;break;case"H":e=55e5;break;case"J":e=64e5;break;case"K":e=73e5;break;case"L":e=82e5;break;case"M":e=91e5;break;case"N":e=0;break;case"P":e=8e5;break;case"Q":e=17e5;break;case"R":e=26e5;break;case"S":e=35e5;break;case"T":e=44e5;break;case"U":e=53e5;break;case"V":e=62e5;break;case"W":e=7e6;break;case"X":e=79e5;break;default:e=-1}if(e>=0)return e;throw"Invalid zone letter: "+t}function $(t,e,i){if(!(this instanceof $))return new $(t,e,i);if(Array.isArray(t))this.x=t[0],this.y=t[1],this.z=t[2]||0;else if("object"==typeof t)this.x=t.x,this.y=t.y,this.z=t.z||0;else if("string"==typeof t&&void 0===e){var r=t.split(",");this.x=parseFloat(r[0],10),this.y=parseFloat(r[1],10),this.z=parseFloat(r[2],10)||0}else this.x=t,this.y=e,this.z=i||0;console.warn("proj4.Point will be removed in version 3, use proj4.toPoint")}function tt(){this.x0=void 0!==this.x0?this.x0:0,this.y0=void 0!==this.y0?this.y0:0,this.long0=void 0!==this.long0?this.long0:0,this.lat0=void 0!==this.lat0?this.lat0:0,this.es&&(this.en=xi(this.es),this.ml0=Mi(this.lat0,Math.sin(this.lat0),Math.cos(this.lat0),this.en))}function et(t){var e,i,r,n=t.x,o=t.y,s=$e(n-this.long0),a=Math.sin(o),l=Math.cos(o);if(this.es){var h=l*s,u=Math.pow(h,2),c=this.ep2*Math.pow(l,2),d=Math.pow(c,2),p=Math.abs(l)>Ie?Math.tan(o):0,f=Math.pow(p,2),g=Math.pow(f,2);e=1-this.es*Math.pow(a,2),h/=Math.sqrt(e);var m=Mi(o,a,l,this.en);i=this.a*(this.k0*h*(1+u/6*(1-f+c+u/20*(5-18*f+g+14*c-58*f*c+u/42*(61+179*g-g*f-479*f)))))+this.x0,r=this.a*(this.k0*(m-this.ml0+a*s*h/2*(1+u/12*(5-f+9*c+4*d+u/30*(61+g-58*f+270*c-330*f*c+u/56*(1385+543*g-g*f-3111*f))))))+this.y0}else{var E=l*Math.sin(s);if(Math.abs(Math.abs(E)-1)<Ie)return 93;if(i=.5*this.a*this.k0*Math.log((1+E)/(1-E))+this.x0,r=l*Math.cos(s)/Math.sqrt(1-Math.pow(E,2)),(E=Math.abs(r))>=1){if(E-1>Ie)return 93;r=0}else r=Math.acos(r);o<0&&(r=-r),r=this.a*this.k0*(r-this.lat0)+this.y0}return t.x=i,t.y=r,t}function it(t){var e,i,r,n,o=(t.x-this.x0)*(1/this.a),s=(t.y-this.y0)*(1/this.a);if(this.es)if(e=this.ml0+s/this.k0,i=Ci(e,this.es,this.en),Math.abs(i)<Me){var a=Math.sin(i),l=Math.cos(i),h=Math.abs(l)>Ie?Math.tan(i):0,u=this.ep2*Math.pow(l,2),c=Math.pow(u,2),d=Math.pow(h,2),p=Math.pow(d,2);e=1-this.es*Math.pow(a,2);var f=o*Math.sqrt(e)/this.k0,g=Math.pow(f,2);e*=h,r=i-e*g/(1-this.es)*.5*(1-g/12*(5+3*d-9*u*d+u-4*c-g/30*(61+90*d-252*u*d+45*p+46*u-g/56*(1385+3633*d+4095*p+1574*p*d)))),n=$e(this.long0+f*(1-g/6*(1+2*d+u-g/20*(5+28*d+24*p+8*u*d+6*u-g/42*(61+662*d+1320*p+720*p*d))))/l)}else r=Me*Qe(s),n=0;else{var m=Math.exp(o/this.k0),E=.5*(m-1/m),y=this.lat0+s/this.k0,_=Math.cos(y);e=Math.sqrt((1-Math.pow(_,2))/(1+Math.pow(E,2))),r=Math.asin(e),s<0&&(r=-r),n=0===E&&0===_?0:$e(Math.atan2(E,_)+this.long0)}return t.x=n,t.y=r,t}function rt(){if(void 0===this.es||this.es<=0)throw new Error("incorrect elliptical usage");this.x0=void 0!==this.x0?this.x0:0,this.y0=void 0!==this.y0?this.y0:0,this.long0=void 0!==this.long0?this.long0:0,this.lat0=void 0!==this.lat0?this.lat0:0,this.cgb=[],this.cbg=[],this.utg=[],this.gtu=[];var t=this.es/(1+Math.sqrt(1-this.es)),e=t/(2-t),i=e;this.cgb[0]=e*(2+e*(-2/3+e*(e*(116/45+e*(26/45+e*(-2854/675)))-2))),this.cbg[0]=e*(e*(2/3+e*(4/3+e*(-82/45+e*(32/45+e*(4642/4725)))))-2),i*=e,this.cgb[1]=i*(7/3+e*(e*(-227/45+e*(2704/315+e*(2323/945)))-1.6)),this.cbg[1]=i*(5/3+e*(-16/15+e*(-13/9+e*(904/315+e*(-1522/945))))),i*=e,this.cgb[2]=i*(56/15+e*(-136/35+e*(-1262/105+e*(73814/2835)))),this.cbg[2]=i*(-26/15+e*(34/21+e*(1.6+e*(-12686/2835)))),i*=e,this.cgb[3]=i*(4279/630+e*(-332/35+e*(-399572/14175))),this.cbg[3]=i*(1237/630+e*(e*(-24832/14175)-2.4)),i*=e,this.cgb[4]=i*(4174/315+e*(-144838/6237)),this.cbg[4]=i*(-734/315+e*(109598/31185)),i*=e,this.cgb[5]=i*(601676/22275),this.cbg[5]=i*(444337/155925),i=Math.pow(e,2),this.Qn=this.k0/(1+e)*(1+i*(.25+i*(1/64+i/256))),this.utg[0]=e*(e*(2/3+e*(-37/96+e*(1/360+e*(81/512+e*(-96199/604800)))))-.5),this.gtu[0]=e*(.5+e*(-2/3+e*(5/16+e*(41/180+e*(-127/288+e*(7891/37800)))))),this.utg[1]=i*(-1/48+e*(-1/15+e*(437/1440+e*(-46/105+e*(1118711/3870720))))),this.gtu[1]=i*(13/48+e*(e*(557/1440+e*(281/630+e*(-1983433/1935360)))-.6)),i*=e,this.utg[2]=i*(-17/480+e*(37/840+e*(209/4480+e*(-5569/90720)))),this.gtu[2]=i*(61/240+e*(-103/140+e*(15061/26880+e*(167603/181440)))),i*=e,this.utg[3]=i*(-4397/161280+e*(11/504+e*(830251/7257600))),this.gtu[3]=i*(49561/161280+e*(-179/168+e*(6601661/7257600))),i*=e,this.utg[4]=i*(-4583/161280+e*(108847/3991680)),this.gtu[4]=i*(34729/80640+e*(-3418889/1995840)),i*=e,this.utg[5]=-.03233083094085698*i,this.gtu[5]=.6650675310896665*i;var r=ki(this.cbg,this.lat0);this.Zb=-this.Qn*(r+Vi(this.gtu,2*r))}function nt(t){var e=$e(t.x-this.long0),i=t.y;i=ki(this.cbg,i);var r=Math.sin(i),n=Math.cos(i),o=Math.sin(e),s=Math.cos(e);i=Math.atan2(r,s*n),e=Math.atan2(o*n,Oi(r,n*s)),e=Di(Math.tan(e));var a=Gi(this.gtu,2*i,2*e);i+=a[0],e+=a[1];var l,h;return Math.abs(e)<=2.623395162778?(l=this.a*(this.Qn*e)+this.x0,h=this.a*(this.Qn*i+this.Zb)+this.y0):(l=1/0,h=1/0),t.x=l,t.y=h,t}function ot(t){var e=(t.x-this.x0)*(1/this.a),i=(t.y-this.y0)*(1/this.a);i=(i-this.Zb)/this.Qn,e/=this.Qn;var r,n;if(Math.abs(e)<=2.623395162778){var o=Gi(this.utg,2*i,2*e);i+=o[0],e+=o[1],e=Math.atan(Ii(e));var s=Math.sin(i),a=Math.cos(i),l=Math.sin(e),h=Math.cos(e);i=Math.atan2(s*h,Oi(l,h*a)),e=Math.atan2(l,h*a),r=$e(e+this.long0),n=ki(this.cgb,i)}else r=1/0,n=1/0;return t.x=r,t.y=n,t}function st(){var t=Ui(this.zone,this.long0);if(void 0===t)throw new Error("unknown utm zone");this.lat0=0,this.long0=(6*Math.abs(t)-183)*Oe,this.x0=5e5,this.y0=this.utmSouth?1e7:0,this.k0=.9996,Bi.init.apply(this),this.forward=Bi.forward,this.inverse=Bi.inverse}function at(){var t=Math.sin(this.lat0),e=Math.cos(this.lat0);e*=e,this.rc=Math.sqrt(1-this.es)/(1-this.es*t*t),this.C=Math.sqrt(1+this.es*e*e/(1-this.es)),this.phic0=Math.asin(t/this.C),this.ratexp=.5*this.C*this.e,this.K=Math.tan(.5*this.phic0+De)/(Math.pow(Math.tan(.5*this.lat0+De),this.C)*zi(this.e*t,this.ratexp))}function lt(t){var e=t.x,i=t.y;return t.y=2*Math.atan(this.K*Math.pow(Math.tan(.5*i+De),this.C)*zi(this.e*Math.sin(i),this.ratexp))-Me,t.x=this.C*e,t}function ht(t){for(var e=t.x/this.C,i=t.y,r=Math.pow(Math.tan(.5*i+De)/this.K,1/this.C),n=qi;n>0&&(i=2*Math.atan(r*zi(this.e*Math.sin(t.y),-.5*this.e))-Me,!(Math.abs(i-t.y)<1e-14));--n)t.y=i;return n?(t.x=e,t.y=i,t):null}function ut(){Hi.init.apply(this),this.rc&&(this.sinc0=Math.sin(this.phic0),this.cosc0=Math.cos(this.phic0),this.R2=2*this.rc,this.title||(this.title="Oblique Stereographic Alternative"))}function ct(t){var e,i,r,n;return t.x=$e(t.x-this.long0),Hi.forward.apply(this,[t]),e=Math.sin(t.y),i=Math.cos(t.y),r=Math.cos(t.x),n=this.k0*this.R2/(1+this.sinc0*e+this.cosc0*i*r),t.x=n*i*Math.sin(t.x),t.y=n*(this.cosc0*e-this.sinc0*i*r),t.x=this.a*t.x+this.x0,t.y=this.a*t.y+this.y0,t}function dt(t){var e,i,r,n,o;if(t.x=(t.x-this.x0)/this.a,t.y=(t.y-this.y0)/this.a,t.x/=this.k0,t.y/=this.k0,o=Math.sqrt(t.x*t.x+t.y*t.y)){var s=2*Math.atan2(o,this.R2);e=Math.sin(s),i=Math.cos(s),n=Math.asin(i*this.sinc0+t.y*e*this.cosc0/o),r=Math.atan2(t.x*e,o*this.cosc0*i-t.y*this.sinc0*e)}else n=this.phic0,r=0;return t.x=r,t.y=n,Hi.inverse.apply(this,[t]),t.x=$e(t.x+this.long0),t}function pt(t,e,i){return e*=i,Math.tan(.5*(Me+t))*Math.pow((1-e)/(1+e),.5*i)}function ft(){this.coslat0=Math.cos(this.lat0),this.sinlat0=Math.sin(this.lat0),this.sphere?1===this.k0&&!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=Ie&&(this.k0=.5*(1+Qe(this.lat0)*Math.sin(this.lat_ts))):(Math.abs(this.coslat0)<=Ie&&(this.lat0>0?this.con=1:this.con=-1),this.cons=Math.sqrt(Math.pow(1+this.e,1+this.e)*Math.pow(1-this.e,1-this.e)),1===this.k0&&!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=Ie&&(this.k0=.5*this.cons*Ze(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts))/ti(this.e,this.con*this.lat_ts,this.con*Math.sin(this.lat_ts))),this.ms1=Ze(this.e,this.sinlat0,this.coslat0),this.X0=2*Math.atan(this.ssfn_(this.lat0,this.sinlat0,this.e))-Me,this.cosX0=Math.cos(this.X0),this.sinX0=Math.sin(this.X0))}function gt(t){var e,i,r,n,o,s,a=t.x,l=t.y,h=Math.sin(l),u=Math.cos(l),c=$e(a-this.long0);return Math.abs(Math.abs(a-this.long0)-Math.PI)<=Ie&&Math.abs(l+this.lat0)<=Ie?(t.x=NaN,t.y=NaN,t):this.sphere?(e=2*this.k0/(1+this.sinlat0*h+this.coslat0*u*Math.cos(c)),t.x=this.a*e*u*Math.sin(c)+this.x0,t.y=this.a*e*(this.coslat0*h-this.sinlat0*u*Math.cos(c))+this.y0,t):(i=2*Math.atan(this.ssfn_(l,h,this.e))-Me,n=Math.cos(i),r=Math.sin(i),Math.abs(this.coslat0)<=Ie?(o=ti(this.e,l*this.con,this.con*h),s=2*this.a*this.k0*o/this.cons,t.x=this.x0+s*Math.sin(a-this.long0),t.y=this.y0-this.con*s*Math.cos(a-this.long0),t):(Math.abs(this.sinlat0)<Ie?(e=2*this.a*this.k0/(1+n*Math.cos(c)),t.y=e*r):(e=2*this.a*this.k0*this.ms1/(this.cosX0*(1+this.sinX0*r+this.cosX0*n*Math.cos(c))),t.y=e*(this.cosX0*r-this.sinX0*n*Math.cos(c))+this.y0),t.x=e*n*Math.sin(c)+this.x0,t))}function mt(t){t.x-=this.x0,t.y-=this.y0;var e,i,r,n,o,s=Math.sqrt(t.x*t.x+t.y*t.y);if(this.sphere){var a=2*Math.atan(s/(.5*this.a*this.k0));return e=this.long0,(i=this.lat0,s<=Ie)?(t.x=e,t.y=i,t):(i=Math.asin(Math.cos(a)*this.sinlat0+t.y*Math.sin(a)*this.coslat0/s),e=$e(Math.abs(this.coslat0)<Ie?this.lat0>0?this.long0+Math.atan2(t.x,-1*t.y):this.long0+Math.atan2(t.x,t.y):this.long0+Math.atan2(t.x*Math.sin(a),s*this.coslat0*Math.cos(a)-t.y*this.sinlat0*Math.sin(a))),t.x=e,t.y=i,t)}if(Math.abs(this.coslat0)<=Ie){if(s<=Ie)return i=this.lat0,e=this.long0,t.x=e,t.y=i,t;t.x*=this.con,t.y*=this.con,r=s*this.cons/(2*this.a*this.k0),i=this.con*ei(this.e,r),e=this.con*$e(this.con*this.long0+Math.atan2(t.x,-1*t.y))}else n=2*Math.atan(s*this.cosX0/(2*this.a*this.k0*this.ms1)),e=this.long0,s<=Ie?o=this.X0:(o=Math.asin(Math.cos(n)*this.sinX0+t.y*Math.sin(n)*this.cosX0/s),e=$e(this.long0+Math.atan2(t.x*Math.sin(n),s*this.cosX0*Math.cos(n)-t.y*this.sinX0*Math.sin(n)))),i=-1*ei(this.e,Math.tan(.5*(Me+o)));return t.x=e,t.y=i,t}function Et(){var t=this.lat0;this.lambda0=this.long0;var e=Math.sin(t),i=this.a,r=this.rf,n=1/r,o=2*n-Math.pow(n,2),s=this.e=Math.sqrt(o);this.R=this.k0*i*Math.sqrt(1-o)/(1-o*Math.pow(e,2)),this.alpha=Math.sqrt(1+o/(1-o)*Math.pow(Math.cos(t),4)),this.b0=Math.asin(e/this.alpha);var a=Math.log(Math.tan(Math.PI/4+this.b0/2)),l=Math.log(Math.tan(Math.PI/4+t/2)),h=Math.log((1+s*e)/(1-s*e));this.K=a-this.alpha*l+this.alpha*s/2*h}function yt(t){var e=Math.log(Math.tan(Math.PI/4-t.y/2)),i=this.e/2*Math.log((1+this.e*Math.sin(t.y))/(1-this.e*Math.sin(t.y))),r=-this.alpha*(e+i)+this.K,n=2*(Math.atan(Math.exp(r))-Math.PI/4),o=this.alpha*(t.x-this.lambda0),s=Math.atan(Math.sin(o)/(Math.sin(this.b0)*Math.tan(n)+Math.cos(this.b0)*Math.cos(o))),a=Math.asin(Math.cos(this.b0)*Math.sin(n)-Math.sin(this.b0)*Math.cos(n)*Math.cos(o));return t.y=this.R/2*Math.log((1+Math.sin(a))/(1-Math.sin(a)))+this.y0,t.x=this.R*s+this.x0,t}function _t(t){for(var e=t.x-this.x0,i=t.y-this.y0,r=e/this.R,n=2*(Math.atan(Math.exp(i/this.R))-Math.PI/4),o=Math.asin(Math.cos(this.b0)*Math.sin(n)+Math.sin(this.b0)*Math.cos(n)*Math.cos(r)),s=Math.atan(Math.sin(r)/(Math.cos(this.b0)*Math.cos(r)-Math.sin(this.b0)*Math.tan(n))),a=this.lambda0+s/this.alpha,l=0,h=o,u=-1e3,c=0;Math.abs(h-u)>1e-7;){if(++c>20)return;l=1/this.alpha*(Math.log(Math.tan(Math.PI/4+o/2))-this.K)+this.e*Math.log(Math.tan(Math.PI/4+Math.asin(this.e*Math.sin(h))/2)),u=h,h=2*Math.atan(Math.exp(l))-Math.PI/2}return t.x=a,t.y=h,t}function vt(){this.no_off=this.no_off||!1,this.no_rot=this.no_rot||!1,isNaN(this.k0)&&(this.k0=1);var t=Math.sin(this.lat0),e=Math.cos(this.lat0),i=this.e*t;this.bl=Math.sqrt(1+this.es/(1-this.es)*Math.pow(e,4)),this.al=this.a*this.bl*this.k0*Math.sqrt(1-this.es)/(1-i*i);var r=ti(this.e,this.lat0,t),n=this.bl/e*Math.sqrt((1-this.es)/(1-i*i));n*n<1&&(n=1);var o,s;if(isNaN(this.longc)){var a=ti(this.e,this.lat1,Math.sin(this.lat1)),l=ti(this.e,this.lat2,Math.sin(this.lat2));this.lat0>=0?this.el=(n+Math.sqrt(n*n-1))*Math.pow(r,this.bl):this.el=(n-Math.sqrt(n*n-1))*Math.pow(r,this.bl);var h=Math.pow(a,this.bl),u=Math.pow(l,this.bl);o=this.el/h,s=.5*(o-1/o);var c=(this.el*this.el-u*h)/(this.el*this.el+u*h),d=(u-h)/(u+h),p=$e(this.long1-this.long2);this.long0=.5*(this.long1+this.long2)-Math.atan(c*Math.tan(.5*this.bl*p)/d)/this.bl,this.long0=$e(this.long0);var f=$e(this.long1-this.long0);this.gamma0=Math.atan(Math.sin(this.bl*f)/s),this.alpha=Math.asin(n*Math.sin(this.gamma0))}else o=this.lat0>=0?n+Math.sqrt(n*n-1):n-Math.sqrt(n*n-1),this.el=o*Math.pow(r,this.bl),s=.5*(o-1/o),this.gamma0=Math.asin(Math.sin(this.alpha)/n),this.long0=this.longc-Math.asin(s*Math.tan(this.gamma0))/this.bl;this.no_off?this.uc=0:this.lat0>=0?this.uc=this.al/this.bl*Math.atan2(Math.sqrt(n*n-1),Math.cos(this.alpha)):this.uc=-1*this.al/this.bl*Math.atan2(Math.sqrt(n*n-1),Math.cos(this.alpha))}function St(t){var e,i,r,n=t.x,o=t.y,s=$e(n-this.long0);if(Math.abs(Math.abs(o)-Me)<=Ie)r=o>0?-1:1,i=this.al/this.bl*Math.log(Math.tan(De+r*this.gamma0*.5)),e=-1*r*Me*this.al/this.bl;else{var a=ti(this.e,o,Math.sin(o)),l=this.el/Math.pow(a,this.bl),h=.5*(l-1/l),u=.5*(l+1/l),c=Math.sin(this.bl*s),d=(h*Math.sin(this.gamma0)-c*Math.cos(this.gamma0))/u;i=Math.abs(Math.abs(d)-1)<=Ie?Number.POSITIVE_INFINITY:.5*this.al*Math.log((1-d)/(1+d))/this.bl,e=Math.abs(Math.cos(this.bl*s))<=Ie?this.al*this.bl*s:this.al*Math.atan2(h*Math.cos(this.gamma0)+c*Math.sin(this.gamma0),Math.cos(this.bl*s))/this.bl}return this.no_rot?(t.x=this.x0+e,t.y=this.y0+i):(e-=this.uc,t.x=this.x0+i*Math.cos(this.alpha)+e*Math.sin(this.alpha),t.y=this.y0+e*Math.cos(this.alpha)-i*Math.sin(this.alpha)),t}function bt(t){var e,i;this.no_rot?(i=t.y-this.y0,e=t.x-this.x0):(i=(t.x-this.x0)*Math.cos(this.alpha)-(t.y-this.y0)*Math.sin(this.alpha),e=(t.y-this.y0)*Math.cos(this.alpha)+(t.x-this.x0)*Math.sin(this.alpha),e+=this.uc);var r=Math.exp(-1*this.bl*i/this.al),n=.5*(r-1/r),o=.5*(r+1/r),s=Math.sin(this.bl*e/this.al),a=(s*Math.cos(this.gamma0)+n*Math.sin(this.gamma0))/o,l=Math.pow(this.el/Math.sqrt((1+a)/(1-a)),1/this.bl);return Math.abs(a-1)<Ie?(t.x=this.long0,t.y=Me):Math.abs(a+1)<Ie?(t.x=this.long0,t.y=-1*Me):(t.y=ei(this.e,l),t.x=$e(this.long0-Math.atan2(n*Math.cos(this.gamma0)-s*Math.sin(this.gamma0),Math.cos(this.bl*e/this.al))/this.bl)),t}function Tt(){if(this.lat2||(this.lat2=this.lat1),this.k0||(this.k0=1),this.x0=this.x0||0,this.y0=this.y0||0,!(Math.abs(this.lat1+this.lat2)<Ie)){var t=this.b/this.a;this.e=Math.sqrt(1-t*t);var e=Math.sin(this.lat1),i=Math.cos(this.lat1),r=Ze(this.e,e,i),n=ti(this.e,this.lat1,e),o=Math.sin(this.lat2),s=Math.cos(this.lat2),a=Ze(this.e,o,s),l=ti(this.e,this.lat2,o),h=ti(this.e,this.lat0,Math.sin(this.lat0));Math.abs(this.lat1-this.lat2)>Ie?this.ns=Math.log(r/a)/Math.log(n/l):this.ns=e,isNaN(this.ns)&&(this.ns=e),this.f0=r/(this.ns*Math.pow(n,this.ns)),this.rh=this.a*this.f0*Math.pow(h,this.ns),this.title||(this.title="Lambert Conformal Conic")}}function Lt(t){var e=t.x,i=t.y;Math.abs(2*Math.abs(i)-Math.PI)<=Ie&&(i=Qe(i)*(Me-2*Ie));var r,n,o=Math.abs(Math.abs(i)-Me);if(o>Ie)r=ti(this.e,i,Math.sin(i)),n=this.a*this.f0*Math.pow(r,this.ns);else{if((o=i*this.ns)<=0)return null;n=0}var s=this.ns*$e(e-this.long0);return t.x=this.k0*(n*Math.sin(s))+this.x0,t.y=this.k0*(this.rh-n*Math.cos(s))+this.y0,t}function wt(t){var e,i,r,n,o,s=(t.x-this.x0)/this.k0,a=this.rh-(t.y-this.y0)/this.k0;this.ns>0?(e=Math.sqrt(s*s+a*a),i=1):(e=-Math.sqrt(s*s+a*a),i=-1);var l=0;if(0!==e&&(l=Math.atan2(i*s,i*a)),0!==e||this.ns>0){if(i=1/this.ns,r=Math.pow(e/(this.a*this.f0),i),-9999===(n=ei(this.e,r)))return null}else n=-Me;return o=$e(l/this.ns+this.long0),t.x=o,t.y=n,t}function Rt(){this.a=6377397.155,this.es=.006674372230614,this.e=Math.sqrt(this.es),this.lat0||(this.lat0=.863937979737193),this.long0||(this.long0=.4334234309119251),this.k0||(this.k0=.9999),this.s45=.785398163397448,this.s90=2*this.s45,this.fi0=this.lat0,this.e2=this.es,this.e=Math.sqrt(this.e2),this.alfa=Math.sqrt(1+this.e2*Math.pow(Math.cos(this.fi0),4)/(1-this.e2)),this.uq=1.04216856380474,this.u0=Math.asin(Math.sin(this.fi0)/this.alfa),this.g=Math.pow((1+this.e*Math.sin(this.fi0))/(1-this.e*Math.sin(this.fi0)),this.alfa*this.e/2),this.k=Math.tan(this.u0/2+this.s45)/Math.pow(Math.tan(this.fi0/2+this.s45),this.alfa)*this.g,this.k1=this.k0,this.n0=this.a*Math.sqrt(1-this.e2)/(1-this.e2*Math.pow(Math.sin(this.fi0),2)),this.s0=1.37008346281555,this.n=Math.sin(this.s0),this.ro0=this.k1*this.n0/Math.tan(this.s0),this.ad=this.s90-this.uq}function xt(t){var e,i,r,n,o,s,a,l=t.x,h=t.y,u=$e(l-this.long0);return e=Math.pow((1+this.e*Math.sin(h))/(1-this.e*Math.sin(h)),this.alfa*this.e/2),i=2*(Math.atan(this.k*Math.pow(Math.tan(h/2+this.s45),this.alfa)/e)-this.s45),r=-u*this.alfa,n=Math.asin(Math.cos(this.ad)*Math.sin(i)+Math.sin(this.ad)*Math.cos(i)*Math.cos(r)),o=Math.asin(Math.cos(i)*Math.sin(r)/Math.cos(n)),s=this.n*o,a=this.ro0*Math.pow(Math.tan(this.s0/2+this.s45),this.n)/Math.pow(Math.tan(n/2+this.s45),this.n),t.y=a*Math.cos(s)/1,t.x=a*Math.sin(s)/1,this.czech||(t.y*=-1,t.x*=-1),t}function Mt(t){var e,i,r,n,o,s,a,l,h=t.x;t.x=t.y,t.y=h,this.czech||(t.y*=-1,t.x*=-1),s=Math.sqrt(t.x*t.x+t.y*t.y),o=Math.atan2(t.y,t.x),n=o/Math.sin(this.s0),r=2*(Math.atan(Math.pow(this.ro0/s,1/this.n)*Math.tan(this.s0/2+this.s45))-this.s45),e=Math.asin(Math.cos(this.ad)*Math.sin(r)-Math.sin(this.ad)*Math.cos(r)*Math.cos(n)),i=Math.asin(Math.cos(r)*Math.sin(n)/Math.cos(e)),t.x=this.long0-i/this.alfa,a=e,l=0;var u=0;do{t.y=2*(Math.atan(Math.pow(this.k,-1/this.alfa)*Math.pow(Math.tan(e/2+this.s45),1/this.alfa)*Math.pow((1+this.e*Math.sin(a))/(1-this.e*Math.sin(a)),this.e/2))-this.s45),Math.abs(a-t.y)<1e-10&&(l=1),a=t.y,u+=1}while(0===l&&u<15);return u>=15?null:t}function Ct(){this.sphere||(this.e0=lr(this.es),this.e1=hr(this.es),this.e2=ur(this.es),this.e3=cr(this.es),this.ml0=this.a*ar(this.e0,this.e1,this.e2,this.e3,this.lat0))}function At(t){var e,i,r=t.x,n=t.y;if(r=$e(r-this.long0),this.sphere)e=this.a*Math.asin(Math.cos(n)*Math.sin(r)),i=this.a*(Math.atan2(Math.tan(n),Math.cos(r))-this.lat0);else{var o=Math.sin(n),s=Math.cos(n),a=dr(this.a,this.e,o),l=Math.tan(n)*Math.tan(n),h=r*Math.cos(n),u=h*h,c=this.es*s*s/(1-this.es),d=this.a*ar(this.e0,this.e1,this.e2,this.e3,n);e=a*h*(1-u*l*(1/6-(8-l+8*c)*u/120)),i=d-this.ml0+a*o/s*u*(.5+(5-l+6*c)*u/24)}return t.x=e+this.x0,t.y=i+this.y0,t}function Pt(t){t.x-=this.x0,t.y-=this.y0;var e,i,r=t.x/this.a,n=t.y/this.a;if(this.sphere){var o=n+this.lat0;e=Math.asin(Math.sin(o)*Math.cos(r)),i=Math.atan2(Math.tan(r),Math.cos(o))}else{var s=this.ml0/this.a+n,a=fr(s,this.e0,this.e1,this.e2,this.e3);if(Math.abs(Math.abs(a)-Me)<=Ie)return t.x=this.long0,t.y=Me,n<0&&(t.y*=-1),t;var l=dr(this.a,this.e,Math.sin(a)),h=l*l*l/this.a/this.a*(1-this.es),u=Math.pow(Math.tan(a),2),c=r*this.a/l,d=c*c;e=a-l*Math.tan(a)/h*c*c*(.5-(1+3*u)*c*c/24),i=c*(1-d*(u/3+(1+3*u)*u*d/15))/Math.cos(a)}return t.x=$e(i+this.long0),t.y=pr(e),t}function It(){var t=Math.abs(this.lat0);if(Math.abs(t-Me)<Ie?this.mode=this.lat0<0?this.S_POLE:this.N_POLE:Math.abs(t)<Ie?this.mode=this.EQUIT:this.mode=this.OBLIQ,this.es>0){var e;switch(this.qp=Er(this.e,1),this.mmf=.5/(1-this.es),this.apa=Dt(this.es),this.mode){case this.N_POLE:case this.S_POLE:this.dd=1;break;case this.EQUIT:this.rq=Math.sqrt(.5*this.qp),this.dd=1/this.rq,this.xmf=1,this.ymf=.5*this.qp;break;case this.OBLIQ:this.rq=Math.sqrt(.5*this.qp),e=Math.sin(this.lat0),this.sinb1=Er(this.e,e)/this.qp,this.cosb1=Math.sqrt(1-this.sinb1*this.sinb1),this.dd=Math.cos(this.lat0)/(Math.sqrt(1-this.es*e*e)*this.rq*this.cosb1),this.ymf=(this.xmf=this.rq)/this.dd,this.xmf*=this.dd}}else this.mode===this.OBLIQ&&(this.sinph0=Math.sin(this.lat0),this.cosph0=Math.cos(this.lat0))}function Ot(t){var e,i,r,n,o,s,a,l,h,u,c=t.x,d=t.y;if(c=$e(c-this.long0),this.sphere){if(o=Math.sin(d),u=Math.cos(d),r=Math.cos(c),this.mode===this.OBLIQ||this.mode===this.EQUIT){if((i=this.mode===this.EQUIT?1+u*r:1+this.sinph0*o+this.cosph0*u*r)<=Ie)return null;i=Math.sqrt(2/i),e=i*u*Math.sin(c),i*=this.mode===this.EQUIT?o:this.cosph0*o-this.sinph0*u*r}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(r=-r),Math.abs(d+this.phi0)<Ie)return null;i=De-.5*d,i=2*(this.mode===this.S_POLE?Math.cos(i):Math.sin(i)),e=i*Math.sin(c),i*=r}}else{switch(a=0,l=0,h=0,r=Math.cos(c),n=Math.sin(c),o=Math.sin(d),s=Er(this.e,o),this.mode!==this.OBLIQ&&this.mode!==this.EQUIT||(a=s/this.qp,l=Math.sqrt(1-a*a)),this.mode){case this.OBLIQ:h=1+this.sinb1*a+this.cosb1*l*r;break;case this.EQUIT:h=1+l*r;break;case this.N_POLE:h=Me+d,s=this.qp-s;break;case this.S_POLE:h=d-Me,s=this.qp+s}if(Math.abs(h)<Ie)return null;switch(this.mode){case this.OBLIQ:case this.EQUIT:h=Math.sqrt(2/h),i=this.mode===this.OBLIQ?this.ymf*h*(this.cosb1*a-this.sinb1*l*r):(h=Math.sqrt(2/(1+l*r)))*a*this.ymf,e=this.xmf*h*l*n;break;case this.N_POLE:case this.S_POLE:s>=0?(e=(h=Math.sqrt(s))*n,i=r*(this.mode===this.S_POLE?h:-h)):e=i=0}}return t.x=this.a*e+this.x0,t.y=this.a*i+this.y0,t}function Nt(t){t.x-=this.x0,t.y-=this.y0;var e,i,r,n,o,s,a,l=t.x/this.a,h=t.y/this.a;if(this.sphere){var u,c=0,d=0;if(u=Math.sqrt(l*l+h*h),(i=.5*u)>1)return null;switch(i=2*Math.asin(i),this.mode!==this.OBLIQ&&this.mode!==this.EQUIT||(d=Math.sin(i),c=Math.cos(i)),this.mode){case this.EQUIT:i=Math.abs(u)<=Ie?0:Math.asin(h*d/u),l*=d,h=c*u;break;case this.OBLIQ:i=Math.abs(u)<=Ie?this.phi0:Math.asin(c*this.sinph0+h*d*this.cosph0/u),l*=d*this.cosph0,h=(c-Math.sin(i)*this.sinph0)*u;break;case this.N_POLE:h=-h,i=Me-i;break;case this.S_POLE:i-=Me}e=0!==h||this.mode!==this.EQUIT&&this.mode!==this.OBLIQ?Math.atan2(l,h):0}else{if(a=0,this.mode===this.OBLIQ||this.mode===this.EQUIT){if(l/=this.dd,h*=this.dd,(s=Math.sqrt(l*l+h*h))<Ie)return t.x=0,t.y=this.phi0,t;n=2*Math.asin(.5*s/this.rq),r=Math.cos(n),l*=n=Math.sin(n),this.mode===this.OBLIQ?(a=r*this.sinb1+h*n*this.cosb1/s,o=this.qp*a,h=s*this.cosb1*r-h*this.sinb1*n):(a=h*n/s,o=this.qp*a,h=s*r)}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(h=-h),!(o=l*l+h*h))return t.x=0,t.y=this.phi0,t;a=1-o/this.qp,this.mode===this.S_POLE&&(a=-a)}e=Math.atan2(l,h),i=kt(Math.asin(a),this.apa)}return t.x=$e(this.long0+e),t.y=i,t}function Dt(t){var e,i=[];return i[0]=t*yr,e=t*t,i[0]+=e*_r,i[1]=e*Sr,e*=t,i[0]+=e*vr,i[1]+=e*br,i[2]=e*Tr,i}function kt(t,e){var i=t+t;return t+e[0]*Math.sin(i)+e[1]*Math.sin(i+i)+e[2]*Math.sin(i+i+i)}function Vt(){Math.abs(this.lat1+this.lat2)<Ie||(this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e3=Math.sqrt(this.es),this.sin_po=Math.sin(this.lat1),this.cos_po=Math.cos(this.lat1),this.t1=this.sin_po,this.con=this.sin_po,this.ms1=Ze(this.e3,this.sin_po,this.cos_po),this.qs1=Er(this.e3,this.sin_po,this.cos_po),this.sin_po=Math.sin(this.lat2),this.cos_po=Math.cos(this.lat2),this.t2=this.sin_po,this.ms2=Ze(this.e3,this.sin_po,this.cos_po),this.qs2=Er(this.e3,this.sin_po,this.cos_po),this.sin_po=Math.sin(this.lat0),
this.cos_po=Math.cos(this.lat0),this.t3=this.sin_po,this.qs0=Er(this.e3,this.sin_po,this.cos_po),Math.abs(this.lat1-this.lat2)>Ie?this.ns0=(this.ms1*this.ms1-this.ms2*this.ms2)/(this.qs2-this.qs1):this.ns0=this.con,this.c=this.ms1*this.ms1+this.ns0*this.qs1,this.rh=this.a*Math.sqrt(this.c-this.ns0*this.qs0)/this.ns0)}function Ft(t){var e=t.x,i=t.y;this.sin_phi=Math.sin(i),this.cos_phi=Math.cos(i);var r=Er(this.e3,this.sin_phi,this.cos_phi),n=this.a*Math.sqrt(this.c-this.ns0*r)/this.ns0,o=this.ns0*$e(e-this.long0),s=n*Math.sin(o)+this.x0,a=this.rh-n*Math.cos(o)+this.y0;return t.x=s,t.y=a,t}function Gt(t){var e,i,r,n,o,s;return t.x-=this.x0,t.y=this.rh-t.y+this.y0,this.ns0>=0?(e=Math.sqrt(t.x*t.x+t.y*t.y),r=1):(e=-Math.sqrt(t.x*t.x+t.y*t.y),r=-1),n=0,0!==e&&(n=Math.atan2(r*t.x,r*t.y)),r=e*this.ns0/this.a,this.sphere?s=Math.asin((this.c-r*r)/(2*this.ns0)):(i=(this.c-r*r)/this.ns0,s=this.phi1z(this.e3,i)),o=$e(n/this.ns0+this.long0),t.x=o,t.y=s,t}function Wt(t,e){var i,r,n,o,s,a=Rr(.5*e);if(t<Ie)return a;for(var l=t*t,h=1;h<=25;h++)if(i=Math.sin(a),r=Math.cos(a),n=t*i,o=1-n*n,s=.5*o*o/r*(e/(1-l)-i/o+.5/t*Math.log((1-n)/(1+n))),a+=s,Math.abs(s)<=1e-7)return a;return null}function Bt(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0),this.infinity_dist=1e3*this.a,this.rc=1}function Ut(t){var e,i,r,n,o,s,a,l,h=t.x,u=t.y;return r=$e(h-this.long0),e=Math.sin(u),i=Math.cos(u),n=Math.cos(r),s=this.sin_p14*e+this.cos_p14*i*n,o=1,s>0||Math.abs(s)<=Ie?(a=this.x0+this.a*o*i*Math.sin(r)/s,l=this.y0+this.a*o*(this.cos_p14*e-this.sin_p14*i*n)/s):(a=this.x0+this.infinity_dist*i*Math.sin(r),l=this.y0+this.infinity_dist*(this.cos_p14*e-this.sin_p14*i*n)),t.x=a,t.y=l,t}function Kt(t){var e,i,r,n,o,s;return t.x=(t.x-this.x0)/this.a,t.y=(t.y-this.y0)/this.a,t.x/=this.k0,t.y/=this.k0,(e=Math.sqrt(t.x*t.x+t.y*t.y))?(n=Math.atan2(e,this.rc),i=Math.sin(n),r=Math.cos(n),s=Rr(r*this.sin_p14+t.y*i*this.cos_p14/e),o=Math.atan2(t.x*i,e*this.cos_p14*r-t.y*this.sin_p14*i),o=$e(this.long0+o)):(s=this.phic0,o=0),t.x=o,t.y=s,t}function jt(){this.sphere||(this.k0=Ze(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)))}function zt(t){var e,i,r=t.x,n=t.y,o=$e(r-this.long0);if(this.sphere)e=this.x0+this.a*o*Math.cos(this.lat_ts),i=this.y0+this.a*Math.sin(n)/Math.cos(this.lat_ts);else{var s=Er(this.e,Math.sin(n));e=this.x0+this.a*this.k0*o,i=this.y0+this.a*s*.5/this.k0}return t.x=e,t.y=i,t}function qt(t){t.x-=this.x0,t.y-=this.y0;var e,i;return this.sphere?(e=$e(this.long0+t.x/this.a/Math.cos(this.lat_ts)),i=Math.asin(t.y/this.a*Math.cos(this.lat_ts))):(i=Pr(this.e,2*t.y*this.k0/this.a),e=$e(this.long0+t.x/(this.a*this.k0))),t.x=e,t.y=i,t}function Yt(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||"Equidistant Cylindrical (Plate Carre)",this.rc=Math.cos(this.lat_ts)}function Ht(t){var e=t.x,i=t.y,r=$e(e-this.long0),n=pr(i-this.lat0);return t.x=this.x0+this.a*r*this.rc,t.y=this.y0+this.a*n,t}function Xt(t){var e=t.x,i=t.y;return t.x=$e(this.long0+(e-this.x0)/(this.a*this.rc)),t.y=pr(this.lat0+(i-this.y0)/this.a),t}function Jt(){this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=lr(this.es),this.e1=hr(this.es),this.e2=ur(this.es),this.e3=cr(this.es),this.ml0=this.a*ar(this.e0,this.e1,this.e2,this.e3,this.lat0)}function Zt(t){var e,i,r,n=t.x,o=t.y,s=$e(n-this.long0);if(r=s*Math.sin(o),this.sphere)Math.abs(o)<=Ie?(e=this.a*s,i=-1*this.a*this.lat0):(e=this.a*Math.sin(r)/Math.tan(o),i=this.a*(pr(o-this.lat0)+(1-Math.cos(r))/Math.tan(o)));else if(Math.abs(o)<=Ie)e=this.a*s,i=-1*this.ml0;else{var a=dr(this.a,this.e,Math.sin(o))/Math.tan(o);e=a*Math.sin(r),i=this.a*ar(this.e0,this.e1,this.e2,this.e3,o)-this.ml0+a*(1-Math.cos(r))}return t.x=e+this.x0,t.y=i+this.y0,t}function Qt(t){var e,i,r,n,o,s,a,l,h;if(r=t.x-this.x0,n=t.y-this.y0,this.sphere)if(Math.abs(n+this.a*this.lat0)<=Ie)e=$e(r/this.a+this.long0),i=0;else{s=this.lat0+n/this.a,a=r*r/this.a/this.a+s*s,l=s;var u;for(o=kr;o;--o)if(u=Math.tan(l),h=-1*(s*(l*u+1)-l-.5*(l*l+a)*u)/((l-s)/u-1),l+=h,Math.abs(h)<=Ie){i=l;break}e=$e(this.long0+Math.asin(r*Math.tan(l)/this.a)/Math.sin(i))}else if(Math.abs(n+this.ml0)<=Ie)i=0,e=$e(this.long0+r/this.a);else{s=(this.ml0+n)/this.a,a=r*r/this.a/this.a+s*s,l=s;var c,d,p,f,g;for(o=kr;o;--o)if(g=this.e*Math.sin(l),c=Math.sqrt(1-g*g)*Math.tan(l),d=this.a*ar(this.e0,this.e1,this.e2,this.e3,l),p=this.e0-2*this.e1*Math.cos(2*l)+4*this.e2*Math.cos(4*l)-6*this.e3*Math.cos(6*l),f=d/this.a,h=(s*(c*f+1)-f-.5*c*(f*f+a))/(this.es*Math.sin(2*l)*(f*f+a-2*s*f)/(4*c)+(s-f)*(c*p-2/Math.sin(2*l))-p),l-=h,Math.abs(h)<=Ie){i=l;break}c=Math.sqrt(1-this.es*Math.pow(Math.sin(i),2))*Math.tan(i),e=$e(this.long0+Math.asin(r*c/this.a)/Math.sin(i))}return t.x=e,t.y=i,t}function $t(){this.A=[],this.A[1]=.6399175073,this.A[2]=-.1358797613,this.A[3]=.063294409,this.A[4]=-.02526853,this.A[5]=.0117879,this.A[6]=-.0055161,this.A[7]=.0026906,this.A[8]=-.001333,this.A[9]=67e-5,this.A[10]=-34e-5,this.B_re=[],this.B_im=[],this.B_re[1]=.7557853228,this.B_im[1]=0,this.B_re[2]=.249204646,this.B_im[2]=.003371507,this.B_re[3]=-.001541739,this.B_im[3]=.04105856,this.B_re[4]=-.10162907,this.B_im[4]=.01727609,this.B_re[5]=-.26623489,this.B_im[5]=-.36249218,this.B_re[6]=-.6870983,this.B_im[6]=-1.1651967,this.C_re=[],this.C_im=[],this.C_re[1]=1.3231270439,this.C_im[1]=0,this.C_re[2]=-.577245789,this.C_im[2]=-.007809598,this.C_re[3]=.508307513,this.C_im[3]=-.112208952,this.C_re[4]=-.15094762,this.C_im[4]=.18200602,this.C_re[5]=1.01418179,this.C_im[5]=1.64497696,this.C_re[6]=1.9660549,this.C_im[6]=2.5127645,this.D=[],this.D[1]=1.5627014243,this.D[2]=.5185406398,this.D[3]=-.03333098,this.D[4]=-.1052906,this.D[5]=-.0368594,this.D[6]=.007317,this.D[7]=.0122,this.D[8]=.00394,this.D[9]=-.0013}function te(t){var e,i=t.x,r=t.y,n=r-this.lat0,o=i-this.long0,s=n/xe*1e-5,a=o,l=1,h=0;for(e=1;e<=10;e++)l*=s,h+=this.A[e]*l;var u,c,d=h,p=a,f=1,g=0,m=0,E=0;for(e=1;e<=6;e++)u=f*d-g*p,c=g*d+f*p,f=u,g=c,m=m+this.B_re[e]*f-this.B_im[e]*g,E=E+this.B_im[e]*f+this.B_re[e]*g;return t.x=E*this.a+this.x0,t.y=m*this.a+this.y0,t}function ee(t){var e,i,r,n=t.x,o=t.y,s=n-this.x0,a=o-this.y0,l=a/this.a,h=s/this.a,u=1,c=0,d=0,p=0;for(e=1;e<=6;e++)i=u*l-c*h,r=c*l+u*h,u=i,c=r,d=d+this.C_re[e]*u-this.C_im[e]*c,p=p+this.C_im[e]*u+this.C_re[e]*c;for(var f=0;f<this.iterations;f++){var g,m,E=d,y=p,_=l,v=h;for(e=2;e<=6;e++)g=E*d-y*p,m=y*d+E*p,E=g,y=m,_+=(e-1)*(this.B_re[e]*E-this.B_im[e]*y),v+=(e-1)*(this.B_im[e]*E+this.B_re[e]*y);E=1,y=0;var S=this.B_re[1],b=this.B_im[1];for(e=2;e<=6;e++)g=E*d-y*p,m=y*d+E*p,E=g,y=m,S+=e*(this.B_re[e]*E-this.B_im[e]*y),b+=e*(this.B_im[e]*E+this.B_re[e]*y);var T=S*S+b*b;d=(_*S+v*b)/T,p=(v*S-_*b)/T}var L=d,w=p,R=1,x=0;for(e=1;e<=9;e++)R*=L,x+=this.D[e]*R;var M=this.lat0+x*xe*1e5,C=this.long0+w;return t.x=C,t.y=M,t}function ie(){}function re(t){var e=t.x,i=t.y,r=$e(e-this.long0),n=this.x0+this.a*r,o=this.y0+this.a*Math.log(Math.tan(Math.PI/4+i/2.5))*1.25;return t.x=n,t.y=o,t}function ne(t){t.x-=this.x0,t.y-=this.y0;var e=$e(this.long0+t.x/this.a),i=2.5*(Math.atan(Math.exp(.8*t.y/this.a))-Math.PI/4);return t.x=e,t.y=i,t}function oe(){this.sphere?(this.n=1,this.m=0,this.es=0,this.C_y=Math.sqrt((this.m+1)/this.n),this.C_x=this.C_y/(this.m+1)):this.en=xi(this.es)}function se(t){var e,i,r=t.x,n=t.y;if(r=$e(r-this.long0),this.sphere){if(this.m)for(var o=this.n*Math.sin(n),s=Kr;s;--s){var a=(this.m*n+Math.sin(n)-o)/(this.m+Math.cos(n));if(n-=a,Math.abs(a)<Ie)break}else n=1!==this.n?Math.asin(this.n*Math.sin(n)):n;e=this.a*this.C_x*r*(this.m+Math.cos(n)),i=this.a*this.C_y*n}else{var l=Math.sin(n),h=Math.cos(n);i=this.a*Mi(n,l,h,this.en),e=this.a*r*h/Math.sqrt(1-this.es*l*l)}return t.x=e,t.y=i,t}function ae(t){var e,i,r,n;return t.x-=this.x0,r=t.x/this.a,t.y-=this.y0,e=t.y/this.a,this.sphere?(e/=this.C_y,r/=this.C_x*(this.m+Math.cos(e)),this.m?e=Rr((this.m*e+Math.sin(e))/this.n):1!==this.n&&(e=Rr(Math.sin(e)/this.n)),r=$e(r+this.long0),e=pr(e)):(e=Ci(t.y/this.a,this.es,this.en),n=Math.abs(e),n<Me?(n=Math.sin(e),i=this.long0+t.x*Math.sqrt(1-this.es*n*n)/(this.a*Math.cos(e)),r=$e(i)):n-Ie<Me&&(r=this.long0)),t.x=r,t.y=e,t}function le(){}function he(t){for(var e=t.x,i=t.y,r=$e(e-this.long0),n=i,o=Math.PI*Math.sin(i),s=0;!0;s++){var a=-(n+Math.sin(n)-o)/(1+Math.cos(n));if(n+=a,Math.abs(a)<Ie)break}n/=2,Math.PI/2-Math.abs(i)<Ie&&(r=0);var l=.900316316158*this.a*r*Math.cos(n)+this.x0,h=1.4142135623731*this.a*Math.sin(n)+this.y0;return t.x=l,t.y=h,t}function ue(t){var e,i;t.x-=this.x0,t.y-=this.y0,i=t.y/(1.4142135623731*this.a),Math.abs(i)>.999999999999&&(i=.999999999999),e=Math.asin(i);var r=$e(this.long0+t.x/(.900316316158*this.a*Math.cos(e)));r<-Math.PI&&(r=-Math.PI),r>Math.PI&&(r=Math.PI),i=(2*e+Math.sin(2*e))/Math.PI,Math.abs(i)>1&&(i=1);var n=Math.asin(i);return t.x=r,t.y=n,t}function ce(){Math.abs(this.lat1+this.lat2)<Ie||(this.lat2=this.lat2||this.lat1,this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=lr(this.es),this.e1=hr(this.es),this.e2=ur(this.es),this.e3=cr(this.es),this.sinphi=Math.sin(this.lat1),this.cosphi=Math.cos(this.lat1),this.ms1=Ze(this.e,this.sinphi,this.cosphi),this.ml1=ar(this.e0,this.e1,this.e2,this.e3,this.lat1),Math.abs(this.lat1-this.lat2)<Ie?this.ns=this.sinphi:(this.sinphi=Math.sin(this.lat2),this.cosphi=Math.cos(this.lat2),this.ms2=Ze(this.e,this.sinphi,this.cosphi),this.ml2=ar(this.e0,this.e1,this.e2,this.e3,this.lat2),this.ns=(this.ms1-this.ms2)/(this.ml2-this.ml1)),this.g=this.ml1+this.ms1/this.ns,this.ml0=ar(this.e0,this.e1,this.e2,this.e3,this.lat0),this.rh=this.a*(this.g-this.ml0))}function de(t){var e,i=t.x,r=t.y;if(this.sphere)e=this.a*(this.g-r);else{var n=ar(this.e0,this.e1,this.e2,this.e3,r);e=this.a*(this.g-n)}var o=this.ns*$e(i-this.long0),s=this.x0+e*Math.sin(o),a=this.y0+this.rh-e*Math.cos(o);return t.x=s,t.y=a,t}function pe(t){t.x-=this.x0,t.y=this.rh-t.y+this.y0;var e,i,r,n;this.ns>=0?(i=Math.sqrt(t.x*t.x+t.y*t.y),e=1):(i=-Math.sqrt(t.x*t.x+t.y*t.y),e=-1);var o=0;if(0!==i&&(o=Math.atan2(e*t.x,e*t.y)),this.sphere)return n=$e(this.long0+o/this.ns),r=pr(this.g-i/this.a),t.x=n,t.y=r,t;var s=this.g-i/this.a;return r=fr(s,this.e0,this.e1,this.e2,this.e3),n=$e(this.long0+o/this.ns),t.x=n,t.y=r,t}function fe(){this.R=this.a}function ge(t){var e,i,r=t.x,n=t.y,o=$e(r-this.long0);Math.abs(n)<=Ie&&(e=this.x0+this.R*o,i=this.y0);var s=Rr(2*Math.abs(n/Math.PI));(Math.abs(o)<=Ie||Math.abs(Math.abs(n)-Me)<=Ie)&&(e=this.x0,i=n>=0?this.y0+Math.PI*this.R*Math.tan(.5*s):this.y0+Math.PI*this.R*-Math.tan(.5*s));var a=.5*Math.abs(Math.PI/o-o/Math.PI),l=a*a,h=Math.sin(s),u=Math.cos(s),c=u/(h+u-1),d=c*c,p=c*(2/h-1),f=p*p,g=Math.PI*this.R*(a*(c-f)+Math.sqrt(l*(c-f)*(c-f)-(f+l)*(d-f)))/(f+l);o<0&&(g=-g),e=this.x0+g;var m=l+c;return g=Math.PI*this.R*(p*m-a*Math.sqrt((f+l)*(l+1)-m*m))/(f+l),i=n>=0?this.y0+g:this.y0-g,t.x=e,t.y=i,t}function me(t){var e,i,r,n,o,s,a,l,h,u,c,d,p;return t.x-=this.x0,t.y-=this.y0,c=Math.PI*this.R,r=t.x/c,n=t.y/c,o=r*r+n*n,s=-Math.abs(n)*(1+o),a=s-2*n*n+r*r,l=-2*s+1+2*n*n+o*o,p=n*n/l+(2*a*a*a/l/l/l-9*s*a/l/l)/27,h=(s-a*a/3/l)/l,u=2*Math.sqrt(-h/3),c=3*p/h/u,Math.abs(c)>1&&(c=c>=0?1:-1),d=Math.acos(c)/3,i=t.y>=0?(-u*Math.cos(d+Math.PI/3)-a/3/l)*Math.PI:-(-u*Math.cos(d+Math.PI/3)-a/3/l)*Math.PI,e=Math.abs(r)<Ie?this.long0:$e(this.long0+Math.PI*(o-1+Math.sqrt(1+2*(r*r-n*n)+o*o))/2/r),t.x=e,t.y=i,t}function Ee(){this.sin_p12=Math.sin(this.lat0),this.cos_p12=Math.cos(this.lat0)}function ye(t){var e,i,r,n,o,s,a,l,h,u,c,d,p,f,g,m,E,y,_,v,S,b,T,L=t.x,w=t.y,R=Math.sin(t.y),x=Math.cos(t.y),M=$e(L-this.long0);return this.sphere?Math.abs(this.sin_p12-1)<=Ie?(t.x=this.x0+this.a*(Me-w)*Math.sin(M),t.y=this.y0-this.a*(Me-w)*Math.cos(M),t):Math.abs(this.sin_p12+1)<=Ie?(t.x=this.x0+this.a*(Me+w)*Math.sin(M),t.y=this.y0+this.a*(Me+w)*Math.cos(M),t):(y=this.sin_p12*R+this.cos_p12*x*Math.cos(M),m=Math.acos(y),E=m/Math.sin(m),t.x=this.x0+this.a*E*x*Math.sin(M),t.y=this.y0+this.a*E*(this.cos_p12*R-this.sin_p12*x*Math.cos(M)),t):(e=lr(this.es),i=hr(this.es),r=ur(this.es),n=cr(this.es),Math.abs(this.sin_p12-1)<=Ie?(o=this.a*ar(e,i,r,n,Me),s=this.a*ar(e,i,r,n,w),t.x=this.x0+(o-s)*Math.sin(M),t.y=this.y0-(o-s)*Math.cos(M),t):Math.abs(this.sin_p12+1)<=Ie?(o=this.a*ar(e,i,r,n,Me),s=this.a*ar(e,i,r,n,w),t.x=this.x0+(o+s)*Math.sin(M),t.y=this.y0+(o+s)*Math.cos(M),t):(a=R/x,l=dr(this.a,this.e,this.sin_p12),h=dr(this.a,this.e,R),u=Math.atan((1-this.es)*a+this.es*l*this.sin_p12/(h*x)),c=Math.atan2(Math.sin(M),this.cos_p12*Math.tan(u)-this.sin_p12*Math.cos(M)),_=0===c?Math.asin(this.cos_p12*Math.sin(u)-this.sin_p12*Math.cos(u)):Math.abs(Math.abs(c)-Math.PI)<=Ie?-Math.asin(this.cos_p12*Math.sin(u)-this.sin_p12*Math.cos(u)):Math.asin(Math.sin(M)*Math.cos(u)/Math.sin(c)),d=this.e*this.sin_p12/Math.sqrt(1-this.es),p=this.e*this.cos_p12*Math.cos(c)/Math.sqrt(1-this.es),f=d*p,g=p*p,v=_*_,S=v*_,b=S*_,T=b*_,m=l*_*(1-v*g*(1-g)/6+S/8*f*(1-2*g)+b/120*(g*(4-7*g)-3*d*d*(1-7*g))-T/48*f),t.x=this.x0+m*Math.sin(c),t.y=this.y0+m*Math.cos(c),t))}function _e(t){t.x-=this.x0,t.y-=this.y0;var e,i,r,n,o,s,a,l,h,u,c,d,p,f,g,m,E,y,_,v,S,b,T;if(this.sphere){if((e=Math.sqrt(t.x*t.x+t.y*t.y))>2*Me*this.a)return;return i=e/this.a,r=Math.sin(i),n=Math.cos(i),o=this.long0,Math.abs(e)<=Ie?s=this.lat0:(s=Rr(n*this.sin_p12+t.y*r*this.cos_p12/e),a=Math.abs(this.lat0)-Me,o=$e(Math.abs(a)<=Ie?this.lat0>=0?this.long0+Math.atan2(t.x,-t.y):this.long0-Math.atan2(-t.x,t.y):this.long0+Math.atan2(t.x*r,e*this.cos_p12*n-t.y*this.sin_p12*r))),t.x=o,t.y=s,t}return l=lr(this.es),h=hr(this.es),u=ur(this.es),c=cr(this.es),Math.abs(this.sin_p12-1)<=Ie?(d=this.a*ar(l,h,u,c,Me),e=Math.sqrt(t.x*t.x+t.y*t.y),p=d-e,s=fr(p/this.a,l,h,u,c),o=$e(this.long0+Math.atan2(t.x,-1*t.y)),t.x=o,t.y=s,t):Math.abs(this.sin_p12+1)<=Ie?(d=this.a*ar(l,h,u,c,Me),e=Math.sqrt(t.x*t.x+t.y*t.y),p=e-d,s=fr(p/this.a,l,h,u,c),o=$e(this.long0+Math.atan2(t.x,t.y)),t.x=o,t.y=s,t):(e=Math.sqrt(t.x*t.x+t.y*t.y),m=Math.atan2(t.x,t.y),f=dr(this.a,this.e,this.sin_p12),E=Math.cos(m),y=this.e*this.cos_p12*E,_=-y*y/(1-this.es),v=3*this.es*(1-_)*this.sin_p12*this.cos_p12*E/(1-this.es),S=e/f,b=S-_*(1+_)*Math.pow(S,3)/6-v*(1+3*_)*Math.pow(S,4)/24,T=1-_*b*b/2-S*b*b*b/6,g=Math.asin(this.sin_p12*Math.cos(b)+this.cos_p12*Math.sin(b)*E),o=$e(this.long0+Math.asin(Math.sin(m)*Math.sin(b)/Math.cos(g))),s=Math.atan((1-this.es*T*this.sin_p12/Math.sin(g))*Math.tan(g)/(1-this.es)),t.x=o,t.y=s,t)}function ve(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0)}function Se(t){var e,i,r,n,o,s,a,l,h=t.x,u=t.y;return r=$e(h-this.long0),e=Math.sin(u),i=Math.cos(u),n=Math.cos(r),s=this.sin_p14*e+this.cos_p14*i*n,o=1,(s>0||Math.abs(s)<=Ie)&&(a=this.a*o*i*Math.sin(r),l=this.y0+this.a*o*(this.cos_p14*e-this.sin_p14*i*n)),t.x=a,t.y=l,t}function be(t){var e,i,r,n,o,s,a;return t.x-=this.x0,t.y-=this.y0,e=Math.sqrt(t.x*t.x+t.y*t.y),i=Rr(e/this.a),r=Math.sin(i),n=Math.cos(i),s=this.long0,Math.abs(e)<=Ie?(a=this.lat0,t.x=s,t.y=a,t):(a=Rr(n*this.sin_p14+t.y*r*this.cos_p14/e),o=Math.abs(this.lat0)-Me,Math.abs(o)<=Ie?(s=$e(this.lat0>=0?this.long0+Math.atan2(t.x,-t.y):this.long0-Math.atan2(-t.x,t.y)),t.x=s,t.y=a,t):(s=$e(this.long0+Math.atan2(t.x*r,e*this.cos_p14*n-t.y*this.sin_p14*r)),t.x=s,t.y=a,t))}var Te=1,Le=2,we=4,Re=5,xe=484813681109536e-20,Me=Math.PI/2,Ce=.16666666666666666,Ae=.04722222222222222,Pe=.022156084656084655,Ie=void 0===Number.EPSILON?1e-10:Number.EPSILON,Oe=.017453292519943295,Ne=57.29577951308232,De=Math.PI/4,ke=2*Math.PI,Ve={};Ve.greenwich=0,Ve.lisbon=-9.131906111111,Ve.paris=2.337229166667,Ve.bogota=-74.080916666667,Ve.madrid=-3.687938888889,Ve.rome=12.452333333333,Ve.bern=7.439583333333,Ve.jakarta=106.807719444444,Ve.ferro=-17.666666666667,Ve.brussels=4.367975,Ve.stockholm=18.058277777778,Ve.athens=23.7163375,Ve.oslo=10.722916666667;var Fe={ft:{to_meter:.3048},"us-ft":{to_meter:1200/3937}},Ge=/[\s_\-\/\(\)]/g,We=function(e){var i,r,n,o={},s=e.split("+").map(function(t){return t.trim()}).filter(function(t){return t}).reduce(function(t,e){var i=e.split("=");return i.push(!0),t[i[0].toLowerCase()]=i[1],t},{}),a={proj:"projName",datum:"datumCode",rf:function(t){o.rf=parseFloat(t)},lat_0:function(t){o.lat0=t*Oe},lat_1:function(t){o.lat1=t*Oe},lat_2:function(t){o.lat2=t*Oe},lat_ts:function(t){o.lat_ts=t*Oe},lon_0:function(t){o.long0=t*Oe},lon_1:function(t){o.long1=t*Oe},lon_2:function(t){o.long2=t*Oe},alpha:function(t){o.alpha=parseFloat(t)*Oe},lonc:function(t){o.longc=t*Oe},x_0:function(t){o.x0=parseFloat(t)},y_0:function(t){o.y0=parseFloat(t)},k_0:function(t){o.k0=parseFloat(t)},k:function(t){o.k0=parseFloat(t)},a:function(t){o.a=parseFloat(t)},b:function(t){o.b=parseFloat(t)},r_a:function(){o.R_A=!0},zone:function(t){o.zone=parseInt(t,10)},south:function(){o.utmSouth=!0},towgs84:function(t){o.datum_params=t.split(",").map(function(t){return parseFloat(t)})},to_meter:function(t){o.to_meter=parseFloat(t)},units:function(e){o.units=e;var i=t(Fe,e);i&&(o.to_meter=i.to_meter)},from_greenwich:function(t){o.from_greenwich=t*Oe},pm:function(e){var i=t(Ve,e);o.from_greenwich=(i||parseFloat(e))*Oe},nadgrids:function(t){"@null"===t?o.datumCode="none":o.nadgrids=t},axis:function(t){var e="ewnsud";3===t.length&&-1!==e.indexOf(t.substr(0,1))&&-1!==e.indexOf(t.substr(1,1))&&-1!==e.indexOf(t.substr(2,1))&&(o.axis=t)}};for(i in s)r=s[i],i in a?(n=a[i],"function"==typeof n?n(r):o[n]=r):o[i]=r;return"string"==typeof o.datumCode&&"WGS84"!==o.datumCode&&(o.datumCode=o.datumCode.toLowerCase()),o},Be=1,Ue=/\s/,Ke=/[A-Za-z]/,je=/[A-Za-z84]/,ze=/[,\]]/,qe=/[\d\.E\-\+]/;e.prototype.readCharicter=function(){var t=this.text[this.place++];if(4!==this.state)for(;Ue.test(t);){if(this.place>=this.text.length)return;t=this.text[this.place++]}switch(this.state){case Be:return this.neutral(t);case 2:return this.keyword(t);case 4:return this.quoted(t);case 5:return this.afterquote(t);case 3:return this.number(t);case-1:return}},e.prototype.afterquote=function(t){if('"'===t)return this.word+='"',void(this.state=4);if(ze.test(t))return this.word=this.word.trim(),void this.afterItem(t);throw new Error("havn't handled \""+t+'" in afterquote yet, index '+this.place)},e.prototype.afterItem=function(t){return","===t?(null!==this.word&&this.currentObject.push(this.word),this.word=null,void(this.state=Be)):"]"===t?(this.level--,null!==this.word&&(this.currentObject.push(this.word),this.word=null),this.state=Be,this.currentObject=this.stack.pop(),void(this.currentObject||(this.state=-1))):void 0},e.prototype.number=function(t){if(qe.test(t))return void(this.word+=t);if(ze.test(t))return this.word=parseFloat(this.word),void this.afterItem(t);throw new Error("havn't handled \""+t+'" in number yet, index '+this.place)},e.prototype.quoted=function(t){if('"'===t)return void(this.state=5);this.word+=t},e.prototype.keyword=function(t){if(je.test(t))return void(this.word+=t);if("["===t){var e=[];return e.push(this.word),this.level++,null===this.root?this.root=e:this.currentObject.push(e),this.stack.push(this.currentObject),this.currentObject=e,void(this.state=Be)}if(ze.test(t))return void this.afterItem(t);throw new Error("havn't handled \""+t+'" in keyword yet, index '+this.place)},e.prototype.neutral=function(t){if(Ke.test(t))return this.word=t,void(this.state=2);if('"'===t)return this.word="",void(this.state=4);if(qe.test(t))return this.word=t,void(this.state=3);if(ze.test(t))return void this.afterItem(t);throw new Error("havn't handled \""+t+'" in neutral yet, index '+this.place)},e.prototype.output=function(){for(;this.place<this.text.length;)this.readCharicter();if(-1===this.state)return this.root;throw new Error('unable to parse string "'+this.text+'". State is '+this.state)};var Ye=.017453292519943295,He=function(t){var e=i(t),r=e.shift(),o=e.shift();e.unshift(["name",o]),e.unshift(["type",r]);var s={};return n(e,s),a(s),s};!function(t){t("EPSG:4326","+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees"),t("EPSG:4269","+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees"),t("EPSG:3857","+title=WGS 84 / Pseudo-Mercator +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs"),t.WGS84=t["EPSG:4326"],t["EPSG:3785"]=t["EPSG:3857"],t.GOOGLE=t["EPSG:3857"],t["EPSG:900913"]=t["EPSG:3857"],t["EPSG:102113"]=t["EPSG:3857"]}(l);var Xe=["PROJECTEDCRS","PROJCRS","GEOGCS","GEOCCS","PROJCS","LOCAL_CS","GEODCRS","GEODETICCRS","GEODETICDATUM","ENGCRS","ENGINEERINGCRS"],Je=function(t,e){t=t||{};var i,r;if(!e)return t;for(r in e)void 0!==(i=e[r])&&(t[r]=i);return t},Ze=function(t,e,i){var r=t*e;return i/Math.sqrt(1-r*r)},Qe=function(t){return t<0?-1:1},$e=function(t){return Math.abs(t)<=3.14159265359?t:t-Qe(t)*ke},ti=function(t,e,i){var r=t*i,n=.5*t;return r=Math.pow((1-r)/(1+r),n),Math.tan(.5*(Me-e))/r},ei=function(t,e){for(var i,r,n=.5*t,o=Me-2*Math.atan(e),s=0;s<=15;s++)if(i=t*Math.sin(o),r=Me-2*Math.atan(e*Math.pow((1-i)/(1+i),n))-o,o+=r,Math.abs(r)<=1e-10)return o;return-9999},ii=["Mercator","Popular Visualisation Pseudo Mercator","Mercator_1SP","Mercator_Auxiliary_Sphere","merc"],ri={init:f,forward:g,inverse:m,names:ii},ni=["longlat","identity"],oi={init:E,forward:y,inverse:y,names:ni},si=[ri,oi],ai={},li=[],hi={start:S,add:_,get:v},ui={};ui.MERIT={a:6378137,rf:298.257,ellipseName:"MERIT 1983"},ui.SGS85={a:6378136,rf:298.257,ellipseName:"Soviet Geodetic System 85"},ui.GRS80={a:6378137,rf:298.257222101,ellipseName:"GRS 1980(IUGG, 1980)"},ui.IAU76={a:6378140,rf:298.257,ellipseName:"IAU 1976"},ui.airy={a:6377563.396,b:6356256.91,ellipseName:"Airy 1830"},ui.APL4={a:6378137,rf:298.25,ellipseName:"Appl. Physics. 1965"},ui.NWL9D={a:6378145,rf:298.25,ellipseName:"Naval Weapons Lab., 1965"},ui.mod_airy={a:6377340.189,b:6356034.446,ellipseName:"Modified Airy"},ui.andrae={a:6377104.43,rf:300,ellipseName:"Andrae 1876 (Den., Iclnd.)"},ui.aust_SA={a:6378160,rf:298.25,ellipseName:"Australian Natl & S. Amer. 1969"},ui.GRS67={a:6378160,rf:298.247167427,ellipseName:"GRS 67(IUGG 1967)"},ui.bessel={a:6377397.155,rf:299.1528128,ellipseName:"Bessel 1841"},ui.bess_nam={a:6377483.865,rf:299.1528128,ellipseName:"Bessel 1841 (Namibia)"},ui.clrk66={a:6378206.4,b:6356583.8,ellipseName:"Clarke 1866"},ui.clrk80={a:6378249.145,rf:293.4663,ellipseName:"Clarke 1880 mod."},ui.clrk58={a:6378293.645208759,rf:294.2606763692654,ellipseName:"Clarke 1858"},ui.CPM={a:6375738.7,rf:334.29,ellipseName:"Comm. des Poids et Mesures 1799"},ui.delmbr={a:6376428,rf:311.5,ellipseName:"Delambre 1810 (Belgium)"},ui.engelis={a:6378136.05,rf:298.2566,ellipseName:"Engelis 1985"},ui.evrst30={a:6377276.345,rf:300.8017,ellipseName:"Everest 1830"},ui.evrst48={a:6377304.063,rf:300.8017,ellipseName:"Everest 1948"},ui.evrst56={a:6377301.243,rf:300.8017,ellipseName:"Everest 1956"},ui.evrst69={a:6377295.664,rf:300.8017,ellipseName:"Everest 1969"},ui.evrstSS={a:6377298.556,rf:300.8017,ellipseName:"Everest (Sabah & Sarawak)"},ui.fschr60={a:6378166,rf:298.3,ellipseName:"Fischer (Mercury Datum) 1960"},ui.fschr60m={a:6378155,rf:298.3,ellipseName:"Fischer 1960"},ui.fschr68={a:6378150,rf:298.3,ellipseName:"Fischer 1968"},ui.helmert={a:6378200,rf:298.3,ellipseName:"Helmert 1906"},ui.hough={a:6378270,rf:297,ellipseName:"Hough"},ui.intl={a:6378388,rf:297,ellipseName:"International 1909 (Hayford)"},ui.kaula={a:6378163,rf:298.24,ellipseName:"Kaula 1961"},ui.lerch={a:6378139,rf:298.257,ellipseName:"Lerch 1979"},ui.mprts={a:6397300,rf:191,ellipseName:"Maupertius 1738"},ui.new_intl={a:6378157.5,b:6356772.2,ellipseName:"New International 1967"},ui.plessis={a:6376523,rf:6355863,ellipseName:"Plessis 1817 (France)"},ui.krass={a:6378245,rf:298.3,ellipseName:"Krassovsky, 1942"},ui.SEasia={a:6378155,b:6356773.3205,ellipseName:"Southeast Asia"},ui.walbeck={a:6376896,b:6355834.8467,ellipseName:"Walbeck"},ui.WGS60={a:6378165,rf:298.3,ellipseName:"WGS 60"},ui.WGS66={a:6378145,rf:298.25,ellipseName:"WGS 66"},ui.WGS7={a:6378135,rf:298.26,ellipseName:"WGS 72"};var ci=ui.WGS84={a:6378137,rf:298.257223563,ellipseName:"WGS 84"};ui.sphere={a:6370997,b:6370997,ellipseName:"Normal Sphere (r=6370997)"};var di={};di.wgs84={towgs84:"0,0,0",ellipse:"WGS84",datumName:"WGS84"},di.ch1903={towgs84:"674.374,15.056,405.346",ellipse:"bessel",datumName:"swiss"},di.ggrs87={towgs84:"-199.87,74.79,246.62",ellipse:"GRS80",datumName:"Greek_Geodetic_Reference_System_1987"},di.nad83={towgs84:"0,0,0",ellipse:"GRS80",datumName:"North_American_Datum_1983"},di.nad27={nadgrids:"@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat",ellipse:"clrk66",datumName:"North_American_Datum_1927"},di.potsdam={towgs84:"606.0,23.0,413.0",ellipse:"bessel",datumName:"Potsdam Rauenberg 1950 DHDN"},di.carthage={towgs84:"-263.0,6.0,431.0",ellipse:"clark80",datumName:"Carthage 1934 Tunisia"},di.hermannskogel={towgs84:"653.0,-212.0,449.0",ellipse:"bessel",datumName:"Hermannskogel"},di.ire65={towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"mod_airy",datumName:"Ireland 1965"},di.rassadiran={towgs84:"-133.63,-157.5,-158.62",ellipse:"intl",datumName:"Rassadiran"},di.nzgd49={towgs84:"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993",ellipse:"intl",datumName:"New Zealand Geodetic Datum 1949"},di.osgb36={towgs84:"446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894",ellipse:"airy",datumName:"Airy 1830"},di.s_jtsk={towgs84:"589,76,480",ellipse:"bessel",datumName:"S-JTSK (Ferro)"},di.beduaram={towgs84:"-106,-87,188",ellipse:"clrk80",datumName:"Beduaram"},di.gunung_segara={towgs84:"-403,684,41",ellipse:"bessel",datumName:"Gunung Segara Jakarta"},di.rnb72={towgs84:"106.869,-52.2978,103.724,-0.33657,0.456955,-1.84218,1",ellipse:"intl",datumName:"Reseau National Belge 1972"},w.projections=hi,w.projections.start();var pi=function(t,e,i){return R(t,e)?i:t.datum_type===Re||e.datum_type===Re?i:t.es!==e.es||t.a!==e.a||P(t.datum_type)||P(e.datum_type)?(i=x(i,t.es,t.a),P(t.datum_type)&&(i=C(i,t.datum_type,t.datum_params)),P(e.datum_type)&&(i=A(i,e.datum_type,e.datum_params)),M(i,e.es,e.a,e.b)):i},fi=function(t,e,i){var r,n,o,s=i.x,a=i.y,l=i.z||0,h={};for(o=0;o<3;o++)if(!e||2!==o||void 0!==i.z)switch(0===o?(r=s,n="x"):1===o?(r=a,n="y"):(r=l,n="z"),t.axis[o]){case"e":h[n]=r;break;case"w":h[n]=-r;break;case"n":h[n]=r;break;case"s":h[n]=-r;break;case"u":void 0!==i[n]&&(h.z=r);break;case"d":void 0!==i[n]&&(h.z=-r);break;default:return null}return h},gi=function(t){var e={x:t[0],y:t[1]};return t.length>2&&(e.z=t[2]),t.length>3&&(e.m=t[3]),e},mi=w("WGS84"),Ei=6,yi="AJSAJS",_i="AFAFAF",vi=65,Si=73,bi=79,Ti=86,Li=90,wi={forward:V,inverse:F,toPoint:G};$.fromMGRS=function(t){return new $(G(t))},$.prototype.toMGRS=function(t){return V([this.x,this.y],t)};var Ri=.01068115234375,xi=function(t){var e=[];e[0]=1-t*(.25+t*(.046875+t*(.01953125+t*Ri))),e[1]=t*(.75-t*(.046875+t*(.01953125+t*Ri)));var i=t*t;return e[2]=i*(.46875-t*(.013020833333333334+.007120768229166667*t)),i*=t,e[3]=i*(.3645833333333333-.005696614583333333*t),e[4]=i*t*.3076171875,e},Mi=function(t,e,i,r){return i*=e,e*=e,r[0]*t-i*(r[1]+e*(r[2]+e*(r[3]+e*r[4])))},Ci=function(t,e,i){for(var r=1/(1-e),n=t,o=20;o;--o){var s=Math.sin(n),a=1-e*s*s;if(a=(Mi(n,s,Math.cos(n),i)-t)*(a*Math.sqrt(a))*r,n-=a,Math.abs(a)<Ie)return n}return n},Ai=["Transverse_Mercator","Transverse Mercator","tmerc"],Pi={init:tt,forward:et,inverse:it,names:Ai},Ii=function(t){var e=Math.exp(t);return e=(e-1/e)/2},Oi=function(t,e){t=Math.abs(t),e=Math.abs(e);var i=Math.max(t,e),r=Math.min(t,e)/(i||1);return i*Math.sqrt(1+Math.pow(r,2))},Ni=function(t){var e=1+t,i=e-1;return 0===i?t:t*Math.log(e)/i},Di=function(t){var e=Math.abs(t);return e=Ni(e*(1+e/(Oi(1,e)+1))),t<0?-e:e},ki=function(t,e){for(var i,r=2*Math.cos(2*e),n=t.length-1,o=t[n],s=0;--n>=0;)i=r*o-s+t[n],s=o,o=i;return e+i*Math.sin(2*e)},Vi=function(t,e){for(var i,r=2*Math.cos(e),n=t.length-1,o=t[n],s=0;--n>=0;)i=r*o-s+t[n],s=o,o=i;return Math.sin(e)*i},Fi=function(t){var e=Math.exp(t);return e=(e+1/e)/2},Gi=function(t,e,i){for(var r,n,o=Math.sin(e),s=Math.cos(e),a=Ii(i),l=Fi(i),h=2*s*l,u=-2*o*a,c=t.length-1,d=t[c],p=0,f=0,g=0;--c>=0;)r=f,n=p,f=d,p=g,d=h*f-r-u*p+t[c],g=u*f-n+h*p;return h=o*l,u=s*a,[h*d-u*g,h*g+u*d]},Wi=["Extended_Transverse_Mercator","Extended Transverse Mercator","etmerc"],Bi={init:rt,forward:nt,inverse:ot,names:Wi},Ui=function(t,e){if(void 0===t){if((t=Math.floor(30*($e(e)+Math.PI)/Math.PI)+1)<0)return 0;if(t>60)return 60}return t},Ki=["Universal Transverse Mercator System","utm"],ji={init:st,names:Ki,dependsOn:"etmerc"},zi=function(t,e){return Math.pow((1-t)/(1+t),e)},qi=20,Yi=["gauss"],Hi={init:at,forward:lt,inverse:ht,names:Yi},Xi=["Stereographic_North_Pole","Oblique_Stereographic","Polar_Stereographic","sterea","Oblique Stereographic Alternative"],Ji={init:ut,forward:ct,inverse:dt,names:Xi},Zi=["stere","Stereographic_South_Pole","Polar Stereographic (variant B)"],Qi={init:ft,forward:gt,inverse:mt,names:Zi,ssfn_:pt},$i=["somerc"],tr={init:Et,forward:yt,inverse:_t,names:$i},er=["Hotine_Oblique_Mercator","Hotine Oblique Mercator","Hotine_Oblique_Mercator_Azimuth_Natural_Origin","Hotine_Oblique_Mercator_Azimuth_Center","omerc"],ir={init:vt,forward:St,inverse:bt,names:er},rr=["Lambert Tangential Conformal Conic Projection","Lambert_Conformal_Conic","Lambert_Conformal_Conic_2SP","lcc"],nr={init:Tt,forward:Lt,inverse:wt,names:rr},or=["Krovak","krovak"],sr={init:Rt,forward:xt,inverse:Mt,names:or},ar=function(t,e,i,r,n){return t*n-e*Math.sin(2*n)+i*Math.sin(4*n)-r*Math.sin(6*n)},lr=function(t){return 1-.25*t*(1+t/16*(3+1.25*t))},hr=function(t){return.375*t*(1+.25*t*(1+.46875*t))},ur=function(t){return.05859375*t*t*(1+.75*t)},cr=function(t){return t*t*t*(35/3072)},dr=function(t,e,i){var r=e*i;return t/Math.sqrt(1-r*r)},pr=function(t){return Math.abs(t)<Me?t:t-Qe(t)*Math.PI},fr=function(t,e,i,r,n){var o,s;o=t/e;for(var a=0;a<15;a++)if(s=(t-(e*o-i*Math.sin(2*o)+r*Math.sin(4*o)-n*Math.sin(6*o)))/(e-2*i*Math.cos(2*o)+4*r*Math.cos(4*o)-6*n*Math.cos(6*o)),o+=s,Math.abs(s)<=1e-10)return o;return NaN},gr=["Cassini","Cassini_Soldner","cass"],mr={init:Ct,forward:At,inverse:Pt,names:gr},Er=function(t,e){var i;return t>1e-7?(i=t*e,(1-t*t)*(e/(1-i*i)-.5/t*Math.log((1-i)/(1+i)))):2*e},yr=.3333333333333333,_r=.17222222222222222,vr=.10257936507936508,Sr=.06388888888888888,br=.0664021164021164,Tr=.016415012942191543,Lr=["Lambert Azimuthal Equal Area","Lambert_Azimuthal_Equal_Area","laea"],wr={init:It,forward:Ot,inverse:Nt,names:Lr,S_POLE:1,N_POLE:2,EQUIT:3,OBLIQ:4},Rr=function(t){return Math.abs(t)>1&&(t=t>1?1:-1),Math.asin(t)},xr=["Albers_Conic_Equal_Area","Albers","aea"],Mr={init:Vt,forward:Ft,inverse:Gt,names:xr,phi1z:Wt},Cr=["gnom"],Ar={init:Bt,forward:Ut,inverse:Kt,names:Cr},Pr=function(t,e){var i=1-(1-t*t)/(2*t)*Math.log((1-t)/(1+t));if(Math.abs(Math.abs(e)-i)<1e-6)return e<0?-1*Me:Me;for(var r,n,o,s,a=Math.asin(.5*e),l=0;l<30;l++)if(n=Math.sin(a),o=Math.cos(a),s=t*n,r=Math.pow(1-s*s,2)/(2*o)*(e/(1-t*t)-n/(1-s*s)+.5/t*Math.log((1-s)/(1+s))),a+=r,Math.abs(r)<=1e-10)return a;return NaN},Ir=["cea"],Or={init:jt,forward:zt,inverse:qt,names:Ir},Nr=["Equirectangular","Equidistant_Cylindrical","eqc"],Dr={init:Yt,forward:Ht,inverse:Xt,names:Nr},kr=20,Vr=["Polyconic","poly"],Fr={init:Jt,forward:Zt,inverse:Qt,names:Vr},Gr=["New_Zealand_Map_Grid","nzmg"],Wr={init:$t,forward:te,inverse:ee,names:Gr},Br=["Miller_Cylindrical","mill"],Ur={init:ie,forward:re,inverse:ne,names:Br},Kr=20,jr=["Sinusoidal","sinu"],zr={init:oe,forward:se,inverse:ae,names:jr},qr=["Mollweide","moll"],Yr={init:le,forward:he,inverse:ue,names:qr},Hr=["Equidistant_Conic","eqdc"],Xr={init:ce,forward:de,inverse:pe,names:Hr},Jr=["Van_der_Grinten_I","VanDerGrinten","vandg"],Zr={init:fe,forward:ge,inverse:me,names:Jr},Qr=["Azimuthal_Equidistant","aeqd"],$r={init:Ee,forward:ye,inverse:_e,names:Qr},tn=["ortho"],en={init:ve,forward:Se,inverse:be,names:tn};return k.defaultDatum="WGS84",k.Proj=w,k.WGS84=new k.Proj("WGS84"),k.Point=$,k.toPoint=gi,k.defs=l,k.transform=O,k.mgrs=wi,k.version="2.4.3",function(t){t.Proj.projections.add(Pi),t.Proj.projections.add(Bi),
t.Proj.projections.add(ji),t.Proj.projections.add(Ji),t.Proj.projections.add(Qi),t.Proj.projections.add(tr),t.Proj.projections.add(ir),t.Proj.projections.add(nr),t.Proj.projections.add(sr),t.Proj.projections.add(mr),t.Proj.projections.add(wr),t.Proj.projections.add(Mr),t.Proj.projections.add(Ar),t.Proj.projections.add(Or),t.Proj.projections.add(Dr),t.Proj.projections.add(Fr),t.Proj.projections.add(Wr),t.Proj.projections.add(Ur),t.Proj.projections.add(zr),t.Proj.projections.add(Yr),t.Proj.projections.add(Xr),t.Proj.projections.add(Zr),t.Proj.projections.add($r),t.Proj.projections.add(en)}(k),k}),i("formats/geojson/GeoJSONCRS",["../../error/ArgumentError","./GeoJSONConstants","../../util/Logger","../../util/proj4-src"],function(t,e,i,r){"use strict";var n=function(e,r){if(!e)throw new t(i.logMessage(i.LEVEL_SEVERE,"GeoJSONCRS","constructor","missingType"));if(!r)throw new t(i.logMessage(i.LEVEL_SEVERE,"GeoJSONCRS","constructor","missingProperties"));this._type=e,this._properties=r,this._projectionString=null};return Object.defineProperties(n.prototype,{type:{get:function(){return this._type}},properties:{get:function(){return this._properties}},projectionString:{get:function(){return this._projectionString}}}),n.prototype.isDefault=function(){return!(!this.isNamed()||this._projectionString!==e.EPSG4326_CRS&&this._projectionString!==e.WGS84_CRS)},n.prototype.isNamed=function(){return this._type===e.FIELD_CRS_NAME},n.prototype.isLinked=function(){return this._type===e.FIELD_CRS_LINK},n.prototype.isCRSSupported=function(){try{r(this._projectionString,e.EPSG4326_CRS)}catch(t){return i.log(i.LEVEL_WARNING,"Unknown GeoJSON coordinate reference system ("+t+"): "+this._properties.name),!1}return!0},n.prototype.getLinkedCRSString=function(t,e){var r=new XMLHttpRequest;r.open("GET",t,!0),r.responseType="text",r.onreadystatechange=function(){4===r.readyState&&(200===r.status?(this._projectionString=r.response,e()):i.log(i.LEVEL_WARNING,"GeoJSON Linked CRS retrieval failed ("+r.statusText+"): "+t))}.bind(this),r.onerror=function(){i.log(i.LEVEL_WARNING,"GeoJSON Linked CRS retrieval failed: "+t)},r.ontimeout=function(){i.log(i.LEVEL_WARNING,"GeoJSON Linked CRS retrieval timed out: "+t)},r.send(null)},n.prototype.setCRSString=function(t){this.isNamed()?(this._projectionString=this._properties.name,t()):this.isLinked()&&this.getLinkedCRSString(this._properties.href,t)},n}),i("formats/geojson/GeoJSONFeature",["../../error/ArgumentError","./GeoJSONConstants","../../util/Logger"],function(t,e,i){"use strict";var r=function(r,n,o,s){if(!r)throw new t(i.logMessage(i.LEVEL_SEVERE,"GeoJSONFeature","constructor","missingGeometry"));if(!r[e.FIELD_TYPE])throw new t(i.logMessage(i.LEVEL_SEVERE,"GeoJSONFeature","constructor","missingFeatureGeometryType"));if(!n)throw new t(i.logMessage(i.LEVEL_SEVERE,"GeoJSONFeature","constructor","missingProperties"));this._geometry=r,this._properties=n,this._id=o,this._bbox=s};return Object.defineProperties(r.prototype,{geometry:{get:function(){return this._geometry}},properties:{get:function(){return this._properties}},id:{get:function(){return this._id}},bbox:{get:function(){return this._bbox}}}),r}),i("formats/geojson/GeoJSONFeatureCollection",["../../error/ArgumentError","./GeoJSONConstants","../../util/Logger"],function(t,e,i){"use strict";var r=function(e,r){if(!e)throw new t(i.logMessage(i.LEVEL_SEVERE,"GeoJSONFeatureCollection","constructor","missingFeatures"));if("[object Array]"!==Object.prototype.toString.call(e))throw new t(i.logMessage(i.LEVEL_SEVERE,"GeoJSONFeatureCollection","constructor","invalidFeatures"));this._features=e,this._bbox=r};return Object.defineProperties(r.prototype,{features:{get:function(){return this._features}},bbox:{get:function(){return this._bbox}}}),r}),i("shapes/PlacemarkAttributes",["../util/Color","../util/Font","../util/Offset","../shapes/ShapeAttributes","../shapes/TextAttributes"],function(t,e,i,r,n){"use strict";var o=function(e){this._imageColor=e?e._imageColor:new t(1,1,1,1),this._imageOffset=e?e._imageOffset:new i(WorldWind.OFFSET_FRACTION,.5,WorldWind.OFFSET_FRACTION,.5),this._imageScale=e?e._imageScale:1,this._imageSource=e?e._imageSource:null,this._depthTest=!e||e._depthTest,this._labelAttributes=e?e._labelAttributes:new n(null),this._drawLeaderLine=!!e&&e._drawLeaderLine,this._leaderLineAttributes=e?e._leaderLineAttributes:new r(null),this.stateKeyInvalid=!0};return o.prototype.computeStateKey=function(){return"ic "+this._imageColor.toHexString(!0)+" io "+this._imageOffset.toString()+" is "+this._imageScale+" ip "+this._imageSource+" dt "+this._depthTest+" la "+this._labelAttributes.stateKey+" dll "+this._drawLeaderLine+" lla "+this._leaderLineAttributes.stateKey},Object.defineProperties(o.prototype,{stateKey:{get:function(){return this.stateKeyInvalid&&(this._stateKey=this.computeStateKey(),this.stateKeyInvalid=!1),this._stateKey}},imageColor:{get:function(){return this._imageColor},set:function(t){this._imageColor=t,this.stateKeyInvalid=!0}},imageOffset:{get:function(){return this._imageOffset},set:function(t){this._imageOffset=t,this.stateKeyInvalid=!0}},imageScale:{get:function(){return this._imageScale},set:function(t){this._imageScale=t,this.stateKeyInvalid=!0}},imageSource:{get:function(){return this._imageSource},set:function(t){this._imageSource=t,this.stateKeyInvalid=!0}},depthTest:{get:function(){return this._depthTest},set:function(t){this._depthTest=t,this.stateKeyInvalid=!0}},labelAttributes:{get:function(){return this._labelAttributes},set:function(t){this._labelAttributes=t,this.stateKeyInvalid=!0}},drawLeaderLine:{get:function(){return this._drawLeaderLine},set:function(t){this._drawLeaderLine=t,this.stateKeyInvalid=!0}},leaderLineAttributes:{get:function(){return this._leaderLineAttributes},set:function(t){this._leaderLineAttributes=t,this.stateKeyInvalid=!0}}}),o}),i("shapes/Placemark",["../error/ArgumentError","../shaders/BasicTextureProgram","../util/Color","../util/Font","../util/Logger","../geom/Matrix","../pick/PickedObject","../shapes/PlacemarkAttributes","../render/Renderable","../geom/Vec2","../geom/Vec3","../util/WWMath"],function(t,e,i,r,n,o,s,a,l,h,u,c){"use strict";var d=function(e,i,r){if(!e)throw new t(n.logMessage(n.LEVEL_SEVERE,"Placemark","constructor","missingPosition"));l.call(this),this.attributes=r||new a(null),this.highlightAttributes=null,this.highlighted=!1,this.position=e,this.eyeDistanceScaling=i,this.eyeDistanceScalingThreshold=1e6,this.eyeDistanceScalingLabelThreshold=1.5*this.eyeDistanceScalingThreshold,this.label=null,this.altitudeMode=WorldWind.ABSOLUTE,this.alwaysOnTop=!1,this.enableLeaderLinePicking=!1,this.updateImage=!0,this.declutterGroup=2,this.targetVisibility=1,this.currentVisibility=1,this.imageRotation=0,this.imageTilt=0,this.imageRotationReference=WorldWind.RELATIVE_TO_SCREEN,this.imageTiltReference=WorldWind.RELATIVE_TO_SCREEN,this.activeAttributes=null,this.activeTexture=null,this.labelTexture=null,this.placePoint=new u(0,0,0),this.groundPoint=new u(0,0,0),this.imageTransform=o.fromIdentity(),this.labelTransform=o.fromIdentity(),this.texCoordMatrix=o.fromIdentity(),this.imageBounds=null,this.layer=null,this.depthOffset=-.003};return d.screenPoint=new u(0,0,0),d.matrix=o.fromIdentity(),d.scratchPoint=new u(0,0,0),d.prototype=Object.create(l.prototype),Object.defineProperties(d.prototype,{screenBounds:{get:function(){return this.labelBounds}}}),d.prototype.copy=function(t){return this.position=t.position,this.attributes=t.attributes,this.highlightAttributes=t.highlightAttributes,this.highlighted=t.highlighted,this.enabled=t.enabled,this.label=t.label,this.altitudeMode=t.altitudeMode,this.pickDelegate=t.pickDelegate,this.alwaysOnTop=t.alwaysOnTop,this.depthOffset=t.depthOffset,this.targetVisibility=t.targetVisibility,this.currentVisibility=t.currentVisibility,this.imageRotation=t.imageRotation,this.imageTilt=t.imageTilt,this.imageRotationReference=t.imageRotationReference,this.imageTiltReference=t.imageTiltReference,this},d.prototype.clone=function(){var t=new d(this.position);return t.copy(this),t.pickDelegate=this.pickDelegate?this.pickDelegate:this,t},d.prototype.render=function(t){if(this.enabled&&t.accumulateOrderedRenderables&&(!t.globe.projectionLimits||t.globe.projectionLimits.containsLocation(this.position.latitude,this.position.longitude))){var e;if(this.lastFrameTime!==t.timestamp)e=this.makeOrderedRenderable(t);else{e=this.clone().makeOrderedRenderable(t)}e&&e.isVisible(t)&&(e.layer=t.currentLayer,this.lastFrameTime=t.timestamp,t.addOrderedRenderable(e))}},d.prototype.renderOrdered=function(t){if(this.drawOrderedPlacemark(t),t.pickingMode){var e=new s(this.pickColor.clone(),this.pickDelegate?this.pickDelegate:this,this.position,this.layer,!1);t.pickPoint&&this.mustDrawLabel()&&this.labelBounds.containsPoint(t.navigatorState.convertPointToViewport(t.pickPoint,d.scratchPoint))&&(e.labelPicked=!0),t.resolvePick(e)}},d.prototype.makeOrderedRenderable=function(t){var e,i,r,n;if(this.determineActiveAttributes(t),!this.activeAttributes)return null;if(t.surfacePointForMode(this.position.latitude,this.position.longitude,this.position.altitude,this.altitudeMode,this.placePoint),this.eyeDistance=this.alwaysOnTop?0:t.navigatorState.eyePoint.distanceTo(this.placePoint),this.mustDrawLeaderLine(t)&&t.surfacePointForMode(this.position.latitude,this.position.longitude,0,this.altitudeMode,this.groundPoint),!t.navigatorState.projectWithDepth(this.placePoint,this.depthOffset,d.screenPoint))return null;var o=this.eyeDistanceScaling?Math.max(0,Math.min(1,this.eyeDistanceScalingThreshold/this.eyeDistance)):1;if(this.activeTexture?(e=this.activeTexture.originalImageWidth,i=this.activeTexture.originalImageHeight,r=this.activeAttributes.imageScale*o,n=this.activeAttributes.imageOffset.offsetForSize(e,i),this.imageTransform.setTranslation(d.screenPoint[0]-n[0]*r,d.screenPoint[1]-n[1]*r,d.screenPoint[2]),this.imageTransform.setScale(e*r,i*r,1)):(r=this.activeAttributes.imageScale*o,n=this.activeAttributes.imageOffset.offsetForSize(r,r),this.imageTransform.setTranslation(d.screenPoint[0]-n[0],d.screenPoint[1]-n[1],d.screenPoint[2]),this.imageTransform.setScale(r,r,1)),this.imageBounds=c.boundingRectForUnitQuad(this.imageTransform),this.mustDrawLabel()){var s=this.activeAttributes.labelAttributes.font,a=this.label+s.toString();this.labelTexture=t.gpuResourceCache.resourceForKey(a),this.labelTexture||(this.labelTexture=t.textSupport.createTexture(t,this.label,s,!0),t.gpuResourceCache.putResource(a,this.labelTexture,this.labelTexture.size)),e=this.labelTexture.imageWidth,i=this.labelTexture.imageHeight,r=this.activeAttributes.labelAttributes.scale*o,n=this.activeAttributes.labelAttributes.offset.offsetForSize(e,i),this.labelTransform.setTranslation(d.screenPoint[0]-n[0]*r,d.screenPoint[1]-n[1]*r,d.screenPoint[2]),this.labelTransform.setScale(e*r,i*r,1),this.labelBounds=c.boundingRectForUnitQuad(this.labelTransform)}return this},d.prototype.determineActiveAttributes=function(t){this.highlighted&&this.highlightAttributes?this.activeAttributes=this.highlightAttributes:this.activeAttributes=this.attributes,this.activeAttributes&&this.activeAttributes.imageSource&&(this.activeTexture=t.gpuResourceCache.resourceForKey(this.activeAttributes.imageSource),this.activeTexture&&!this.updateImage||(this.activeTexture=t.gpuResourceCache.retrieveTexture(t.currentGlContext,this.activeAttributes.imageSource),this.updateImage=!1))},d.prototype.isVisible=function(t){return t.pickingMode?t.pickRectangle&&(this.imageBounds.intersects(t.pickRectangle)||this.mustDrawLabel()&&this.labelBounds.intersects(t.pickRectangle)||this.mustDrawLeaderLine(t)&&t.pickFrustum.intersectsSegment(this.groundPoint,this.placePoint)):this.imageBounds.intersects(t.navigatorState.viewport)||this.mustDrawLabel()&&this.labelBounds.intersects(t.navigatorState.viewport)||this.mustDrawLeaderLine(t)&&t.navigatorState.frustumInModelCoordinates.intersectsSegment(this.groundPoint,this.placePoint)},d.prototype.drawOrderedPlacemark=function(t){this.beginDrawing(t);try{this.doDrawOrderedPlacemark(t),t.pickingMode||this.drawBatchOrderedPlacemarks(t)}finally{this.endDrawing(t)}},d.prototype.drawBatchOrderedPlacemarks=function(t){for(var e;(e=t.peekOrderedRenderable())&&e.doDrawOrderedPlacemark;){t.popOrderedRenderable();try{e.doDrawOrderedPlacemark(t)}catch(t){n.logMessage(n.LEVEL_WARNING,"Placemark","drawBatchOrderedPlacemarks","Error occurred while rendering placemark using batching: "+t.message)}}},d.prototype.beginDrawing=function(t){var i,r=t.currentGlContext;t.findAndBindProgram(e),i=t.currentProgram,r.bindBuffer(r.ARRAY_BUFFER,t.unitQuadBuffer()),r.vertexAttribPointer(i.vertexTexCoordLocation,2,r.FLOAT,!1,0,0),r.enableVertexAttribArray(i.vertexPointLocation),r.enableVertexAttribArray(i.vertexTexCoordLocation),i.loadTextureUnit(r,r.TEXTURE0),i.loadModulateColor(r,t.pickingMode)},d.prototype.endDrawing=function(t){var e=t.currentGlContext,i=t.currentProgram;e.disableVertexAttribArray(i.vertexPointLocation),e.disableVertexAttribArray(i.vertexTexCoordLocation),e.bindBuffer(e.ARRAY_BUFFER,null),e.bindTexture(e.TEXTURE_2D,null)},d.prototype.doDrawOrderedPlacemark=function(t){var e,i=t.currentGlContext,r=t.currentProgram,n=!0;if(t.pickingMode&&(this.pickColor=t.uniquePickColor()),this.eyeDistanceScaling&&this.eyeDistance>this.eyeDistanceScalingLabelThreshold&&(this.targetVisibility=0),!t.pickingMode&&this.mustDrawLabel()&&this.currentVisibility!=this.targetVisibility){var o=(t.timestamp-t.previousRedrawTimestamp)/t.fadeTime;this.currentVisibility<this.targetVisibility?this.currentVisibility=Math.min(1,this.currentVisibility+o):this.currentVisibility=Math.max(0,this.currentVisibility-o),t.redrawRequested=!0}if(r.loadOpacity(i,t.pickingMode?1:this.layer.opacity),this.mustDrawLeaderLine(t)){this.leaderLinePoints||(this.leaderLinePoints=new Float32Array(6)),this.leaderLinePoints[0]=this.groundPoint[0],this.leaderLinePoints[1]=this.groundPoint[1],this.leaderLinePoints[2]=this.groundPoint[2],this.leaderLinePoints[3]=this.placePoint[0],this.leaderLinePoints[4]=this.placePoint[1],this.leaderLinePoints[5]=this.placePoint[2],this.leaderLineCacheKey||(this.leaderLineCacheKey=t.gpuResourceCache.generateCacheKey());var s=t.gpuResourceCache.resourceForKey(this.leaderLineCacheKey);s||(s=i.createBuffer(),t.gpuResourceCache.putResource(this.leaderLineCacheKey,s,4*this.leaderLinePoints.length)),r.loadTextureEnabled(i,!1),r.loadColor(i,t.pickingMode?this.pickColor:this.activeAttributes.leaderLineAttributes.outlineColor),d.matrix.copy(t.navigatorState.modelviewProjection),r.loadModelviewProjection(i,d.matrix),this.activeAttributes.leaderLineAttributes.depthTest||i.disable(i.DEPTH_TEST),i.lineWidth(this.activeAttributes.leaderLineAttributes.outlineWidth),i.bindBuffer(i.ARRAY_BUFFER,s),i.bufferData(i.ARRAY_BUFFER,this.leaderLinePoints,i.STATIC_DRAW),t.frameStatistics.incrementVboLoadCount(1),i.vertexAttribPointer(r.vertexPointLocation,3,i.FLOAT,!1,0,0),i.drawArrays(i.LINES,0,2)}this.activeAttributes.depthTest||(n=!1,i.disable(i.DEPTH_TEST)),i.bindBuffer(i.ARRAY_BUFFER,t.unitQuadBuffer3()),i.vertexAttribPointer(r.vertexPointLocation,3,i.FLOAT,!1,0,0),d.matrix.copy(t.screenProjection),d.matrix.multiplyMatrix(this.imageTransform);var a=this.imageRotationReference===WorldWind.RELATIVE_TO_GLOBE?t.navigatorState.heading-this.imageRotation:-this.imageRotation;d.matrix.multiplyByTranslation(.5,.5,0),d.matrix.multiplyByRotation(0,0,1,a),d.matrix.multiplyByTranslation(-.5,-.5,0);var l=this.imageTiltReference===WorldWind.RELATIVE_TO_GLOBE?t.navigatorState.tilt+this.imageTilt:this.imageTilt;d.matrix.multiplyByRotation(-1,0,0,l),r.loadModelviewProjection(i,d.matrix),r.loadTextureEnabled(i,!0),t.pickingMode?r.loadColor(i,this.pickColor):r.loadColor(i,this.activeAttributes.imageColor),this.texCoordMatrix.setToIdentity(),this.activeTexture&&this.texCoordMatrix.multiplyByTextureTransform(this.activeTexture),r.loadTextureMatrix(i,this.texCoordMatrix),this.activeTexture?(e=this.activeTexture.bind(t),r.loadTextureEnabled(i,e)):r.loadTextureEnabled(i,!1),i.drawArrays(i.TRIANGLE_STRIP,0,4),this.mustDrawLabel()&&this.currentVisibility>0&&(r.loadOpacity(i,t.pickingMode?1:this.layer.opacity*this.currentVisibility),d.matrix.copy(t.screenProjection),d.matrix.multiplyMatrix(this.labelTransform),r.loadModelviewProjection(i,d.matrix),!t.pickingMode&&this.labelTexture?(this.texCoordMatrix.setToIdentity(),this.texCoordMatrix.multiplyByTextureTransform(this.labelTexture),r.loadTextureMatrix(i,this.texCoordMatrix),r.loadColor(i,this.activeAttributes.labelAttributes.color),e=this.labelTexture.bind(t),r.loadTextureEnabled(i,e)):(r.loadTextureEnabled(i,!1),r.loadColor(i,this.pickColor)),this.activeAttributes.labelAttributes.depthTest?n||(n=!0,i.enable(i.DEPTH_TEST)):(n=!1,i.disable(i.DEPTH_TEST)),i.drawArrays(i.TRIANGLE_STRIP,0,4)),n||i.enable(i.DEPTH_TEST)},d.prototype.mustDrawLabel=function(){return this.label&&this.label.length>0&&this.activeAttributes.labelAttributes},d.prototype.mustDrawLeaderLine=function(t){return this.activeAttributes.drawLeaderLine&&this.activeAttributes.leaderLineAttributes&&(!t.pickingMode||this.enableLeaderLinePicking)},d}),i("shapes/Polygon",["../shapes/AbstractShape","../error/ArgumentError","../shaders/BasicTextureProgram","../geom/BoundingBox","../util/Color","../util/ImageSource","../geom/Location","../util/Logger","../geom/Matrix","../pick/PickedObject","../geom/Position","../shapes/ShapeAttributes","../shapes/SurfacePolygon","../geom/Vec2","../geom/Vec3","../util/libtess"],function(t,e,i,n,o,s,a,l,h,u,c,d,p,f,g,m){"use strict";var E=function(i,r){if(!i)throw new e(l.logMessage(l.LEVEL_SEVERE,"Polygon","constructor","missingBoundaries"));t.call(this,r),i.length>0&&i[0].latitude&&(i=[i],this._boundariesSpecifiedSimply=!0),this._boundaries=i,this._textureCoordinates=null,this.referencePosition=this.determineReferencePosition(this._boundaries),this._extrude=!1,this.scratchPoint=new g(0,0,0)};return E.prototype=Object.create(t.prototype),Object.defineProperties(E.prototype,{boundaries:{get:function(){return this._boundariesSpecifiedSimply?this._boundaries[0]:this._boundaries},set:function(t){if(!t)throw new e(l.logMessage(l.LEVEL_SEVERE,"Polygon","boundaries","missingBoundaries"));t.length>0&&t[0].latitude&&(t=[t],this._boundariesSpecifiedSimply=!0),this._boundaries=t,this.referencePosition=this.determineReferencePosition(this._boundaries),this.reset()}},textureCoordinates:{get:function(){return this._textureCoordinates},set:function(t){this._textureCoordinates=t,this.reset()}},extrude:{get:function(){return this._extrude},set:function(t){this._extrude=t,this.reset()}}}),E.prototype.determineReferencePosition=function(t){return t.length>0&&t[0].length>2?t[0][0]:null},E.prototype.mustGenerateGeometry=function(t){return!this.currentData.boundaryPoints||(this.currentData.drawInterior!==this.activeAttributes.drawInterior||this.altitudeMode!==WorldWind.ABSOLUTE&&this.currentData.isExpired)},E.prototype.hasCapTexture=function(){return this.textureCoordinates&&this.capImageSource()},E.prototype.capImageSource=function(){return this.activeAttributes.imageSource?"string"==typeof this.activeAttributes.imageSource||this.activeAttributes.imageSource instanceof s?this.activeAttributes.imageSource:Array.isArray(this.activeAttributes.imageSource)&&this.activeAttributes.imageSource[0]&&("string"==typeof this.activeAttributes.imageSource[0]||this.activeAttributes.imageSource instanceof s)?this.activeAttributes.imageSource[0]:null:null},E.prototype.hasSideTextures=function(){return this.activeAttributes.imageSource&&Array.isArray(this.activeAttributes.imageSource)&&this.activeAttributes.imageSource.length>1},E.prototype.sideImageSource=function(t){if(0===t||2===this.activeAttributes.imageSource.length)return this.activeAttributes.imageSource[1];var e=this.activeAttributes.imageSource.length-1;return t=Math.min(t+1,e),this.activeAttributes.imageSource[t]},E.prototype.createSurfaceShape=function(){return new p(this.boundaries,null)},E.prototype.doMakeOrderedRenderable=function(t){if(!this.referencePosition)return null;if(!this.activeAttributes.drawInterior&&!this.activeAttributes.drawOutline)return null;if(!this.mustGenerateGeometry(t))return this;var e=this.currentData,i=e.referencePoint;t.surfacePointForMode(this.referencePosition.latitude,this.referencePosition.longitude,this.referencePosition.altitude,this._altitudeMode,i),e.transformationMatrix.setToTranslation(i[0],i[1],i[2]);for(var r=[],o=0;o<this._boundaries.length;o++)r[o]=this._boundaries[o].slice(0),r[o].push(this._boundaries[o][0]);var s=this.computeBoundaryPoints(t,r);if(this.activeAttributes.drawInterior){var a=this.tessellatePolygon(t,s);if(a){e.capTriangles=new Float32Array(a.length);for(var l=0,h=a.length;l<h;l++)e.capTriangles[l]=a[l]}}if(e.boundaryPoints=s,e.drawInterior=this.activeAttributes.drawInterior,this.resetExpiration(e),e.refreshBuffers=!0,e.extent||(e.extent=new n),1===s.length)e.extent.setToPoints(s[0]);else{var u=[];for(o=0;o<s.length;o++)for(var c=0;c<s[o].length;c++)u.push(s[o][c]);e.extent.setToPoints(u)}return e.extent.translate(e.referencePoint),this},E.prototype.computeBoundaryPoints=function(t,e){for(var i,r,n,o,s=Number.MAX_VALUE,a=t.navigatorState.eyePoint,l=[],h=this._extrude?6:3,u=new g(0,0,0),c=0;c<e.length;c++){i=(this._extrude?2:1)*e[c].length,l[c]=new Float32Array(3*i);for(var d=0,p=e[c].length;d<p;d++)r=e[c][d],t.surfacePointForMode(r.latitude,r.longitude,r.altitude,this.altitudeMode,u),o=u.distanceToSquared(a),o<s&&(s=o),u.subtract(this.currentData.referencePoint),n=h*d,l[c][n]=u[0],l[c][n+1]=u[1],l[c][n+2]=u[2],this._extrude&&(t.surfacePointForMode(r.latitude,r.longitude,0,WorldWind.CLAMP_TO_GROUND,u),o=u.distanceToSquared(a),o<s&&(s=o),u.subtract(this.currentData.referencePoint),l[c][n+3]=u[0],l[c][n+4]=u[1],l[c][n+5]=u[2])}return this.currentData.eyeDistance=0,l},E.prototype.tessellatePolygon=function(t,e){var i,n,o=[],s=0,a=this._extrude?6:3,h=this.hasCapTexture();this.polygonTessellator||(this.polygonTessellator=new r.GluTesselator,this.polygonTessellator.gluTessCallback(r.gluEnum.GLU_TESS_VERTEX_DATA,function(t,e){e[e.length]=t[0],e[e.length]=t[1],e[e.length]=t[2],h&&(e[e.length]=t[3],e[e.length]=t[4])}),this.polygonTessellator.gluTessCallback(r.gluEnum.GLU_TESS_COMBINE,function(t,e,i){var r=[t[0],t[1],t[2]];if(h)for(var n=3;n<=4;n++){for(var o=0,s=0;s<4;s++)i[s]>0&&(o+=i[s]*e[s][n]);r[n]=o}return r}),this.polygonTessellator.gluTessCallback(r.gluEnum.GLU_TESS_ERROR,function(t){s=t,l.logMessage(l.LEVEL_WARNING,"Polygon","tessellatePolygon","Tessellation error "+t+".")})),n=g.computeBufferNormal(e[0],a),n||(n=new g(0,0,0),t.globe.surfaceNormalAtLocation(this.referencePosition.latitude,this.referencePosition.longitude,n)),this.polygonTessellator.gluTessNormal(n[0],n[1],n[2]),this.currentData.capNormal=n,this.polygonTessellator.gluTessBeginPolygon(o);for(var u=0;u<e.length;u++){var c=0;this.polygonTessellator.gluTessBeginContour();for(var d=e[u],p=0;p<d.length;p+=a)i=[d[p],d[p+1],d[p+2]],h&&(c<this.textureCoordinates[u].length?(i[3]=this.textureCoordinates[u][c][0],i[4]=this.textureCoordinates[u][c][1]):(i[3]=this.textureCoordinates[u][0][0],i[4]=this.textureCoordinates[u][1][1]),++c),this.polygonTessellator.gluTessVertex(i,i);this.polygonTessellator.gluTessEndContour()}return this.polygonTessellator.gluTessEndPolygon(),0===s?o:null},E.prototype.mustDrawVerticals=function(t){return this._extrude&&this.activeAttributes.drawOutline&&this.activeAttributes.drawVerticals&&this.altitudeMode!==WorldWind.CLAMP_TO_GROUND},E.prototype.doRenderOrdered=function(t){var e,i=this.currentData;if(t.pickingMode&&(e=t.uniquePickColor()),this.activeAttributes.drawInterior&&i.capTriangles&&i.capTriangles.length>0&&this.drawCap(t,e),this._extrude&&this.activeAttributes.drawInterior&&this.drawSides(t,e),this.activeAttributes.drawOutline&&this.drawOutline(t,e),i.refreshBuffers=!1,t.pickingMode){var r=new u(e,this.pickDelegate?this.pickDelegate:this,null,t.currentLayer,!1);t.resolvePick(r)}},E.prototype.drawCap=function(t,e){var i,r,n,o,s,a=t.currentGlContext,l=t.currentProgram,h=this.currentData,u=h.refreshBuffers,c=!!this.hasCapTexture(),d=this.activeAttributes.applyLighting,p=h.capTriangles.length/(c?5:3);l.loadTextureEnabled(a,!1),this.applyMvpMatrix(t),h.capVboCacheKey||(h.capVboCacheKey=t.gpuResourceCache.generateCacheKey()),i=t.gpuResourceCache.resourceForKey(h.capVboCacheKey),i||(i=a.createBuffer(),t.gpuResourceCache.putResource(h.capVboCacheKey,i,4*h.capTriangles.length),u=!0),a.bindBuffer(a.ARRAY_BUFFER,i),u&&(s=d?this.makeCapBufferWithNormals():h.capTriangles,a.bufferData(a.ARRAY_BUFFER,s,a.STATIC_DRAW),t.frameStatistics.incrementVboLoadCount(1)),n=this.activeAttributes.interiorColor,r=n.alpha*t.currentLayer.opacity,a.depthMask(r>=1||t.pickingMode),l.loadColor(a,t.pickingMode?e:n),l.loadOpacity(a,t.pickingMode?r>0?1:0:r),o=12+(c?8:0)+(d?12:0),c&&!t.pickingMode&&(this.activeTexture=t.gpuResourceCache.resourceForKey(this.capImageSource()),this.activeTexture||(this.activeTexture=t.gpuResourceCache.retrieveTexture(t.currentGlContext,this.capImageSource())),this.activeTexture&&this.activeTexture.bind(t)&&(a.enableVertexAttribArray(l.vertexTexCoordLocation),a.vertexAttribPointer(l.vertexTexCoordLocation,2,a.FLOAT,!1,o,12),this.scratchMatrix.setToIdentity(),this.scratchMatrix.multiplyByTextureTransform(this.activeTexture),l.loadTextureEnabled(a,!0),l.loadTextureUnit(a,a.TEXTURE0),l.loadTextureMatrix(a,this.scratchMatrix),l.loadModulateColor(a,t.pickingMode))),d&&!t.pickingMode&&(l.loadApplyLighting(a,!0),a.enableVertexAttribArray(l.normalVectorLocation),a.vertexAttribPointer(l.normalVectorLocation,3,a.FLOAT,!1,o,o-12)),a.vertexAttribPointer(l.vertexPointLocation,3,a.FLOAT,!1,o,0),a.drawArrays(a.TRIANGLES,0,p)},E.prototype.makeCapBufferWithNormals=function(){for(var t=this.currentData,e=t.capNormal,i=this.hasCapTexture()?5:3,r=i+3,n=t.capTriangles.length/i,o=t.capTriangles,s=new Float32Array(n*r),a=0,l=0;l<n;l++){for(var h=0;h<i;h++)s[a++]=o[l*i+h];s[a++]=e[0],s[a++]=e[1],s[a++]=e[2]}return s},E.prototype.drawSides=function(t,e){var i,r,n,o,s,a,l=t.currentGlContext,h=t.currentProgram,u=this.currentData,c=u.refreshBuffers,d=this.hasSideTextures(),p=this.activeAttributes.applyLighting,f=3+(d?2:0)+(p?3:0),g=4*f;a=0;for(var m=0;m<u.boundaryPoints.length;m++)a+=u.boundaryPoints[m].length/6-1;if(u.sidesVboCacheKey||(u.sidesVboCacheKey=t.gpuResourceCache.generateCacheKey()),i=t.gpuResourceCache.resourceForKey(u.sidesVboCacheKey),!i||c?(s=this.makeSidesBuffer(a),u.numSideVertices=s.length/f,i||(i=l.createBuffer()),t.gpuResourceCache.putResource(u.sidesVboCacheKey,i,4*s.length),l.bindBuffer(l.ARRAY_BUFFER,i),l.bufferData(l.ARRAY_BUFFER,s,l.STATIC_DRAW),t.frameStatistics.incrementVboLoadCount(1)):l.bindBuffer(l.ARRAY_BUFFER,i),n=this.activeAttributes.interiorColor,r=n.alpha*t.currentLayer.opacity,l.depthMask(r>=1||t.pickingMode),h.loadColor(l,t.pickingMode?e:n),h.loadOpacity(l,t.pickingMode?r>0?1:0:r),d&&!t.pickingMode){this.activeTexture=t.gpuResourceCache.resourceForKey(this.capImageSource()),this.activeTexture||(this.activeTexture=t.gpuResourceCache.retrieveTexture(t.currentGlContext,this.capImageSource())),p?(h.loadApplyLighting(l,!0),l.enableVertexAttribArray(h.normalVectorLocation)):h.loadApplyLighting(l,!1);for(var E=0;E<a;E++){var y=this.sideImageSource(E),_=t.gpuResourceCache.resourceForKey(y),v=6*E*g;y&&!_&&(_=t.gpuResourceCache.retrieveTexture(t.currentGlContext,y)),o=_&&_.bind(t),o?(l.enableVertexAttribArray(h.vertexTexCoordLocation),l.vertexAttribPointer(h.vertexTexCoordLocation,2,l.FLOAT,!1,g,v+12),this.scratchMatrix.setToIdentity(),this.scratchMatrix.multiplyByTextureTransform(this.activeTexture),h.loadTextureEnabled(l,!0),h.loadTextureUnit(l,l.TEXTURE0),h.loadTextureMatrix(l,this.scratchMatrix)):(h.loadTextureEnabled(l,!1),l.disableVertexAttribArray(h.vertexTexCoordLocation)),p&&l.vertexAttribPointer(h.normalVectorLocation,3,l.FLOAT,!1,g,v+20),l.vertexAttribPointer(h.vertexPointLocation,3,l.FLOAT,!1,g,v),l.drawArrays(l.TRIANGLES,0,6)}}else h.loadTextureEnabled(l,!1),p&&!t.pickingMode?(h.loadApplyLighting(l,!0),l.enableVertexAttribArray(h.normalVectorLocation),l.vertexAttribPointer(h.normalVectorLocation,3,l.FLOAT,!1,g,g-12)):h.loadApplyLighting(l,!1),l.vertexAttribPointer(h.vertexPointLocation,3,l.FLOAT,!1,g,0),l.drawArrays(l.TRIANGLES,0,u.numSideVertices)},E.prototype.makeSidesBuffer=function(t){var e,i,r,n,o,s,a,l,h,u,c,d=this.currentData,p=this.hasSideTextures(),m=this.activeAttributes.applyLighting,E=3+(p?2:0)+(m?3:0);r=2*t*3*E,e=new Float32Array(r),i=0,n=new g(0,0,0),o=new g(0,0,0),s=new g(0,0,0),a=new g(0,0,0),p?(l=new f(0,1),h=new f(0,0),u=new f(1,1),c=new f(1,0)):l=h=u=c=null;for(var y=0;y<d.boundaryPoints.length;y++)for(var _,v=d.boundaryPoints[y],S=0;S<v.length-6;S+=6)n[0]=v[S],n[1]=v[S+1],n[2]=v[S+2],o[0]=v[S+3],o[1]=v[S+4],o[2]=v[S+5],s[0]=v[S+6],s[1]=v[S+7],s[2]=v[S+8],a[0]=v[S+9],a[1]=v[S+10],a[2]=v[S+11],_=m?g.computeTriangleNormal(n,o,s):null,this.addVertexToBuffer(n,l,_,e,i),i+=E,this.addVertexToBuffer(o,h,_,e,i),i+=E,this.addVertexToBuffer(s,u,_,e,i),i+=E,this.addVertexToBuffer(o,h,_,e,i),i+=E,this.addVertexToBuffer(a,c,_,e,i),i+=E,this.addVertexToBuffer(s,u,_,e,i),i+=E;return e},E.prototype.addVertexToBuffer=function(t,e,i,r,n){r[n++]=t[0],r[n++]=t[1],r[n++]=t[2],e&&(r[n++]=e[0],r[n++]=e[1]),i&&(r[n++]=i[0],r[n++]=i[1],r[n]=i[2])},E.prototype.drawOutline=function(t,e){var i,r,n,o,s,a,l=t.currentGlContext,h=t.currentProgram,u=this.currentData,c=u.refreshBuffers;h.loadTextureEnabled(l,!1),h.loadApplyLighting(l,!1),this.hasCapTexture()&&l.disableVertexAttribArray(h.vertexTexCoordLocation),this.activeAttributes.applyLighting&&l.disableVertexAttribArray(h.normalVectorLocation),u.boundaryVboCacheKeys||(this.currentData.boundaryVboCacheKeys=[]),this.applyMvpMatrixForOutline(t),h.loadTextureEnabled(l,!1),l.disableVertexAttribArray(h.vertexTexCoordLocation);for(var d=0;d<u.boundaryPoints.length;d++)i=u.boundaryPoints[d].length/3,u.boundaryVboCacheKeys[d]||(u.boundaryVboCacheKeys[d]=t.gpuResourceCache.generateCacheKey()),r=t.gpuResourceCache.resourceForKey(u.boundaryVboCacheKeys[d]),r||(r=l.createBuffer(),t.gpuResourceCache.putResource(u.boundaryVboCacheKeys[d],r,12*i),c=!0),l.bindBuffer(l.ARRAY_BUFFER,r),c&&(l.bufferData(l.ARRAY_BUFFER,u.boundaryPoints[d],l.STATIC_DRAW),t.frameStatistics.incrementVboLoadCount(1)),o=this.activeAttributes.outlineColor,n=o.alpha*t.currentLayer.opacity,l.depthMask(n>=1||t.pickingMode),h.loadColor(l,t.pickingMode?e:o),h.loadOpacity(l,t.pickingMode?1:n),l.lineWidth(this.activeAttributes.outlineWidth),this._extrude?(s=24,a=i/2):(s=12,a=i),l.vertexAttribPointer(h.vertexPointLocation,3,l.FLOAT,!1,s,0),l.drawArrays(l.LINE_STRIP,0,a),this.mustDrawVerticals(t)&&(l.vertexAttribPointer(h.vertexPointLocation,3,l.FLOAT,!1,0,0),l.drawArrays(l.LINES,0,i-2))},E.prototype.beginDrawing=function(t){var e=t.currentGlContext;this.activeAttributes.drawInterior&&e.disable(e.CULL_FACE),t.findAndBindProgram(i),e.enableVertexAttribArray(t.currentProgram.vertexPointLocation),!t.pickMode&&this.activeAttributes.applyLighting&&t.currentProgram.loadModelviewInverse(e,t.navigatorState.modelviewNormalTransform)},E.prototype.endDrawing=function(t){var e=t.currentGlContext;e.disableVertexAttribArray(t.currentProgram.vertexPointLocation),e.disableVertexAttribArray(t.currentProgram.normalVectorLocation),e.depthMask(!0),e.lineWidth(1),e.enable(e.CULL_FACE)},E}),i("shapes/SurfacePolyline",["../error/ArgumentError","../util/Logger","../shapes/ShapeAttributes","../shapes/SurfaceShape"],function(t,e,i,r){"use strict";var n=function(i,o){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"SurfacePolyline","constructor","The specified locations array is null or undefined."));r.call(this,o),this._boundaries=i,this._stateId=n.stateId++,this._isInteriorInhibited=!0};return n.prototype=Object.create(r.prototype),Object.defineProperties(n.prototype,{boundaries:{get:function(){return this._boundaries},
set:function(i){if(!Array.isArray(i))throw new t(e.logMessage(e.LEVEL_SEVERE,"SurfacePolyline","set boundaries","The specified value is not an array."));this.resetBoundaries(),this._boundaries=i,this._stateId=n.stateId++,this.stateKeyInvalid=!0}}}),n.stateId=Number.MIN_SAFE_INTEGER,n.staticStateKey=function(t){return r.staticStateKey(t)+" pl "+t._stateId},n.prototype.computeStateKey=function(){return n.staticStateKey(this)},n.prototype.computeBoundaries=function(t){},n}),i("formats/geojson/GeoJSONParser",["../../error/ArgumentError","../../util/Color","./GeoJSONConstants","./GeoJSONCRS","./GeoJSONFeature","./GeoJSONFeatureCollection","./GeoJSONGeometry","./GeoJSONGeometryCollection","./GeoJSONGeometryLineString","./GeoJSONGeometryMultiLineString","./GeoJSONGeometryMultiPoint","./GeoJSONGeometryMultiPolygon","./GeoJSONGeometryPoint","./GeoJSONGeometryPolygon","../../geom/Location","../../util/Logger","../../shapes/Placemark","../../shapes/PlacemarkAttributes","../../shapes/Polygon","../../geom/Position","../../util/proj4-src","../../layer/RenderableLayer","../../shapes/ShapeAttributes","../../shapes/SurfacePolygon","../../shapes/SurfacePolyline"],function(t,e,i,r,n,o,s,a,l,h,u,c,d,p,f,g,m,E,y,_,v,S,b,T,L){"use strict";var w=function(e){if(!e)throw new t(g.logMessage(g.LEVEL_SEVERE,"GeoJSON","constructor","missingDataSource"));this._dataSource=e,this._geoJSONObject=null,this._geoJSONType=null,this._crs=null,this._layer=null,this._parserCompletionCallback=null,this._shapeConfigurationCallback=this.defaultShapeConfigurationCallback,this.defaultPlacemarkAttributes=new E(null),this.defaultShapeAttributes=new b(null),this.setProj4jsAliases()};return Object.defineProperties(w.prototype,{dataSource:{get:function(){return this._dataSource}},geoJSONObject:{get:function(){return this._geoJSONObject}},geoJSONType:{get:function(){return this._geoJSONType}},crs:{get:function(){return this._crs}},layer:{get:function(){return this._layer}},parserCompletionCallback:{get:function(){return this._parserCompletionCallback}},shapeConfigurationCallback:{get:function(){return this._shapeConfigurationCallback}}}),w.prototype.load=function(t,e,i){t&&(this._parserCompletionCallback=t),e&&(this._shapeConfigurationCallback=e),this._layer=i||new S,this.isDataSourceJson()?this.parse(this.dataSource):this.requestUrl(this.dataSource)},w.prototype.defaultShapeConfigurationCallback=function(t,e){var i={},r=e.name||e.Name||e.NAME;return r&&(i.name=r),t.isPointType()||t.isMultiPointType()?i.attributes=this.defaultPlacemarkAttributes:t.isLineStringType()||t.isMultiLineStringType()?i.attributes=this.defaultShapeAttributes:(t.isPolygonType()||t.isMultiPolygonType())&&(i.attributes=this.defaultShapeAttributes),i},w.prototype.requestUrl=function(t){var e=new XMLHttpRequest;e.open("GET",t,!0),e.responseType="text",e.onreadystatechange=function(){4===e.readyState&&(200===e.status?this.parse(e.response):g.log(g.LEVEL_WARNING,"GeoJSON retrieval failed ("+e.statusText+"): "+t))}.bind(this),e.onerror=function(){g.log(g.LEVEL_WARNING,"GeoJSON retrieval failed: "+t)},e.ontimeout=function(){g.log(g.LEVEL_WARNING,"GeoJSON retrieval timed out: "+t)},e.send(null)},w.prototype.parse=function(e){try{this._geoJSONObject=JSON.parse(e)}catch(t){g.logMessage(g.LEVEL_SEVERE,"GeoJSON","parse","invalidGeoJSONObject")}finally{if(this.geoJSONObject){if("[object Array]"===Object.prototype.toString.call(this.geoJSONObject))throw new t(g.logMessage(g.LEVEL_SEVERE,"GeoJSON","parse","invalidGeoJSONObjectLength"));if(!this.geoJSONObject.hasOwnProperty(i.FIELD_TYPE))throw new t(g.logMessage(g.LEVEL_SEVERE,"GeoJSON","parse","missingGeoJSONType"));this.setGeoJSONType(),this.setGeoJSONCRS(),this._parserCompletionCallback&&"function"==typeof this._parserCompletionCallback&&this._parserCompletionCallback(this.layer)}}},w.prototype.setGeoJSONCRS=function(){if(this.geoJSONObject[i.FIELD_CRS]){this._crs=new r(this.geoJSONObject[i.FIELD_CRS][i.FIELD_TYPE],this.geoJSONObject[i.FIELD_CRS][i.FIELD_PROPERTIES]);var t=function(){this.addRenderablesForGeoJSON(this.layer)}.bind(this);this.crs.setCRSString(t)}else this.addRenderablesForGeoJSON(this.layer)},w.prototype.addRenderablesForGeoJSON=function(e){if(!e)throw new t(g.logMessage(g.LEVEL_SEVERE,"GeoJSON","addRenderablesForGeoJSON","missingLayer"));switch(this.geoJSONType){case i.TYPE_FEATURE:var r=new n(this.geoJSONObject[i.FIELD_GEOMETRY],this.geoJSONObject[i.FIELD_PROPERTIES],this.geoJSONObject[i.FIELD_ID],this.geoJSONObject[i.FIELD_BBOX]);this.addRenderablesForFeature(e,r);break;case i.TYPE_FEATURE_COLLECTION:var s=new o(this.geoJSONObject[i.FIELD_FEATURES],this.geoJSONObject[i.FIELD_BBOX]);this.addRenderablesForFeatureCollection(e,s);break;case i.TYPE_GEOMETRY_COLLECTION:var l=new a(this.geoJSONObject[i.FIELD_GEOMETRIES],this.geoJSONObject[i.FIELD_BBOX]);this.addRenderablesForGeometryCollection(e,l,null);break;default:this.addRenderablesForGeometry(e,this.geoJSONObject,null)}},w.prototype.addRenderablesForGeometry=function(e,r,n){if(!e)throw new t(g.logMessage(g.LEVEL_SEVERE,"GeoJSON","addRenderablesForGeometry","missingLayer"));if(!r)throw new t(g.logMessage(g.LEVEL_SEVERE,"GeoJSON","addRenderablesForGeometry","missingGeometry"));switch(r[i.FIELD_TYPE]){case i.TYPE_POINT:var o=new d(r[i.FIELD_COORDINATES],r[i.FIELD_TYPE],r[i.FIELD_BBOX]);this.addRenderablesForPoint(e,o,n||null);break;case i.TYPE_MULTI_POINT:var s=new u(r[i.FIELD_COORDINATES],r[i.FIELD_TYPE],r[i.FIELD_BBOX]);this.addRenderablesForMultiPoint(e,s,n||null);break;case i.TYPE_LINE_STRING:var a=new l(r[i.FIELD_COORDINATES],r[i.FIELD_TYPE],r[i.FIELD_BBOX]);this.addRenderablesForLineString(e,a,n||null);break;case i.TYPE_MULTI_LINE_STRING:var f=new h(r[i.FIELD_COORDINATES],r[i.FIELD_TYPE],r[i.FIELD_BBOX]);this.addRenderablesForMultiLineString(e,f,n||null);break;case i.TYPE_POLYGON:var m=new p(r[i.FIELD_COORDINATES],r[i.FIELD_TYPE],r[i.FIELD_BBOX]);this.addRenderablesForPolygon(e,m,n||null);break;case i.TYPE_MULTI_POLYGON:var E=new c(r[i.FIELD_COORDINATES],r[i.FIELD_TYPE],r[i.FIELD_BBOX]);this.addRenderablesForMultiPolygon(e,E,n||null)}},w.prototype.addRenderablesForPoint=function(e,i,r){if(!e)throw new t(g.logMessage(g.LEVEL_SEVERE,"GeoJSON","addRenderablesForPoint","missingLayer"));if(!i)throw new t(g.logMessage(g.LEVEL_SEVERE,"GeoJSON","addRenderablesForPoint","missingGeometry"));var n=this.shapeConfigurationCallback(i,r);if(!this.crs||this.crs.isCRSSupported()){var o=i.coordinates[0],s=i.coordinates[1],a=i.coordinates[2]?i.coordinates[2]:0,l=this.getReprojectedIfRequired(s,o,this.crs),h=new _(l[1],l[0],a),u=new m(h,!1,n&&n.attributes?n.attributes:null);u.altitudeMode=WorldWind.RELATIVE_TO_GROUND,n&&n.name&&(u.label=n.name),n.highlightAttributes&&(u.highlightAttributes=n.highlightAttributes),n&&n.pickDelegate&&(u.pickDelegate=n.pickDelegate),n&&n.userProperties&&(u.userProperties=n.userProperties),e.addRenderable(u)}},w.prototype.addRenderablesForMultiPoint=function(e,i,r){if(!e)throw new t(g.logMessage(g.LEVEL_SEVERE,"GeoJSON","addRenderablesForMultiPoint","missingLayer"));if(!i)throw new t(g.logMessage(g.LEVEL_SEVERE,"GeoJSON","addRenderablesForMultiPoint","missingGeometry"));var n=this.shapeConfigurationCallback(i,r);if(!this.crs||this.crs.isCRSSupported())for(var o=0,s=i.coordinates.length;o<s;o+=1){var a=i.coordinates[o][0],l=i.coordinates[o][1],h=i.coordinates[o][2]?i.coordinates[o][2]:0,u=this.getReprojectedIfRequired(l,a,this.crs),c=new _(u[1],u[0],h),d=new m(c,!1,n&&n.attributes?n.attributes:null);d.altitudeMode=WorldWind.RELATIVE_TO_GROUND,n&&n.name&&(d.label=n.name),n.highlightAttributes&&(d.highlightAttributes=n.highlightAttributes),n&&n.pickDelegate&&(d.pickDelegate=n.pickDelegate),n&&n.userProperties&&(d.userProperties=n.userProperties),e.addRenderable(d)}},w.prototype.addRenderablesForLineString=function(e,i,r){if(!e)throw new t(g.logMessage(g.LEVEL_SEVERE,"GeoJSON","addRenderablesForLineString","missingLayer"));if(!i)throw new t(g.logMessage(g.LEVEL_SEVERE,"GeoJSON","addRenderablesForLineString","missingGeometry"));var n=this.shapeConfigurationCallback(i,r);if(!this.crs||this.crs.isCRSSupported()){for(var o=[],s=0,a=i.coordinates;s<a.length;s++){var l=a[s][0],h=a[s][1],u=this.getReprojectedIfRequired(h,l,this.crs),c=new f(u[1],u[0]);o.push(c)}var d;d=new L(o,n&&n.attributes?n.attributes:null),n.highlightAttributes&&(d.highlightAttributes=n.highlightAttributes),n&&n.pickDelegate&&(d.pickDelegate=n.pickDelegate),n&&n.userProperties&&(d.userProperties=n.userProperties),e.addRenderable(d)}},w.prototype.addRenderablesForMultiLineString=function(e,i,r){if(!e)throw new t(g.logMessage(g.LEVEL_SEVERE,"GeoJSON","addRenderablesForMultiLineString","missingLayer"));if(!i)throw new t(g.logMessage(g.LEVEL_SEVERE,"GeoJSON","addRenderablesForMultiLineString","missingGeometry"));var n=this.shapeConfigurationCallback(i,r);if(!this.crs||this.crs.isCRSSupported())for(var o=0,s=i.coordinates;o<s.length;o++){for(var a=[],l=0,h=s[o];l<h.length;l++){var u=h[l][0],c=h[l][1],d=this.getReprojectedIfRequired(c,u,this.crs),p=new f(d[1],d[0]);a.push(p)}var m;m=new L(a,n&&n.attributes?n.attributes:null),n.highlightAttributes&&(m.highlightAttributes=n.highlightAttributes),n&&n.pickDelegate&&(m.pickDelegate=n.pickDelegate),n&&n.userProperties&&(m.userProperties=n.userProperties),e.addRenderable(m)}},w.prototype.addRenderablesForPolygon=function(e,i,r){if(!e)throw new t(g.logMessage(g.LEVEL_SEVERE,"GeoJSON","addRenderablesForPolygon","missingLayer"));if(!i)throw new t(g.logMessage(g.LEVEL_SEVERE,"GeoJSON","addRenderablesForPolygon","missingGeometry"));var n=this.shapeConfigurationCallback(i,r);if(!this.crs||this.crs.isCRSSupported())for(var o=0,s=i.coordinates;o<s.length;o++){for(var a=[],l=0,h=s[o];l<h.length;l++){var u=h[l][0],c=h[l][1],d=this.getReprojectedIfRequired(c,u,this.crs),p=new f(d[1],d[0]);a.push(p)}var m;m=new T(a,n&&n.attributes?n.attributes:null),n.highlightAttributes&&(m.highlightAttributes=n.highlightAttributes),n&&n.pickDelegate&&(m.pickDelegate=n.pickDelegate),n&&n.userProperties&&(m.userProperties=n.userProperties),e.addRenderable(m)}},w.prototype.addRenderablesForMultiPolygon=function(e,i,r){if(!e)throw new t(g.logMessage(g.LEVEL_SEVERE,"GeoJSON","addRenderablesForMultiPolygon","missingLayer"));if(!i)throw new t(g.logMessage(g.LEVEL_SEVERE,"GeoJSON","addRenderablesForMultiPolygon","missingGeometry"));var n=this.shapeConfigurationCallback(i,r);if(!this.crs||this.crs.isCRSSupported())for(var o=0,s=i.coordinates;o<s.length;o++){for(var a=[],l=0;l<s[o].length;l++){for(var h=[],u=0,c=s[o][l];u<c.length;u++){var d=c[u][0],p=c[u][1],m=this.getReprojectedIfRequired(p,d,this.crs),E=new f(m[1],m[0]);h.push(E)}a.push(h)}var y;y=new T(a,n&&n.attributes?n.attributes:null),n.highlightAttributes&&(y.highlightAttributes=n.highlightAttributes),n&&n.pickDelegate&&(y.pickDelegate=n.pickDelegate),n&&n.userProperties&&(y.userProperties=n.userProperties),e.addRenderable(y)}},w.prototype.addRenderablesForGeometryCollection=function(e,r,n){if(!e)throw new t(g.logMessage(g.LEVEL_SEVERE,"GeoJSON","addRenderablesForGeometryCollection","missingLayer"));if(!r)throw new t(g.logMessage(g.LEVEL_SEVERE,"GeoJSON","addRenderablesForGeometryCollection","missingGeometryCollection"));for(var o=0,s=r.geometries;o<s.length;o++)s[o].hasOwnProperty(i.FIELD_TYPE)&&this.addRenderablesForGeometry(e,s[o],n)},w.prototype.addRenderablesForFeature=function(e,r){if(!e)throw new t(g.logMessage(g.LEVEL_SEVERE,"GeoJSON","addRenderablesForFeature","missingLayer"));if(!r)throw new t(g.logMessage(g.LEVEL_SEVERE,"GeoJSON","addRenderablesForFeature","missingFeature"));if(r.geometry.type===i.TYPE_GEOMETRY_COLLECTION){var n=new a(r.geometry.geometries,r.bbox);this.addRenderablesForGeometryCollection(e,n,r.properties)}else this.addRenderablesForGeometry(e,r.geometry,r.properties)},w.prototype.addRenderablesForFeatureCollection=function(e,r){if(!e)throw new t(g.logMessage(g.LEVEL_SEVERE,"GeoJSON","addRenderablesForFeatureCollection","missingLayer"));if(!r)throw new t(g.logMessage(g.LEVEL_SEVERE,"GeoJSON","addRenderablesForFeatureCollection","missingFeatureCollection"));if(r.features.length>0)for(var o=0;o<r.features.length;o++){var s=new n(r.features[o][i.FIELD_GEOMETRY],r.features[o][i.FIELD_PROPERTIES],r.features[o][i.FIELD_ID],r.features[o][i.FIELD_BBOX]);this.addRenderablesForFeature(e,s)}},w.prototype.setGeoJSONType=function(){switch(this.geoJSONObject[i.FIELD_TYPE]){case i.TYPE_POINT:this._geoJSONType=i.TYPE_POINT;break;case i.TYPE_MULTI_POINT:this._geoJSONType=i.TYPE_MULTI_POINT;break;case i.TYPE_LINE_STRING:this._geoJSONType=i.TYPE_LINE_STRING;break;case i.TYPE_MULTI_LINE_STRING:this._geoJSONType=i.TYPE_MULTI_LINE_STRING;break;case i.TYPE_POLYGON:this._geoJSONType=i.TYPE_POLYGON;break;case i.TYPE_MULTI_POLYGON:this._geoJSONType=i.TYPE_MULTI_POLYGON;break;case i.TYPE_GEOMETRY_COLLECTION:this._geoJSONType=i.TYPE_GEOMETRY_COLLECTION;break;case i.TYPE_FEATURE:this._geoJSONType=i.TYPE_FEATURE;break;case i.TYPE_FEATURE_COLLECTION:this._geoJSONType=i.TYPE_FEATURE_COLLECTION;break;default:throw new t(g.logMessage(g.LEVEL_SEVERE,"GeoJSON","setGeoJSONType","invalidGeoJSONType"))}},w.prototype.getReprojectedIfRequired=function(e,r,n){if(!e&&0!==e)throw new t(g.logMessage(g.LEVEL_SEVERE,"GeoJSON","getReprojectedIfRequired","missingLatitude"));if(!r&&0!==r)throw new t(g.logMessage(g.LEVEL_SEVERE,"GeoJSON","getReprojectedIfRequired","missingLongitude"));return!n||n.isDefault()?[r,e]:v(n.projectionString,i.EPSG4326_CRS,[r,e])},w.prototype.setProj4jsAliases=function(){v.defs([["urn:ogc:def:crs:OGC:1.3:CRS84",v.defs("EPSG:4326")],["urn:ogc:def:crs:EPSG::3857",v.defs("EPSG:3857")]])},w.prototype.isDataSourceJson=function(){try{JSON.parse(this.dataSource)}catch(t){return!1}return!0},w}),i("formats/geotiff/GeoTiffConstants",[],function(){"use strict";return{Tag:{MODEL_PIXEL_SCALE:33550,MODEL_TRANSFORMATION:34264,MODEL_TIEPOINT:33922,GEO_KEY_DIRECTORY:34735,GEO_DOUBLE_PARAMS:34736,GEO_ASCII_PARAMS:34737,GDAL_NODATA:42113,GDAL_METADATA:42112},Key:{GTModelTypeGeoKey:1024,GTRasterTypeGeoKey:1025,GTCitationGeoKey:1026,GeographicTypeGeoKey:2048,GeogCitationGeoKey:2049,GeogGeodeticDatumGeoKey:2050,GeogPrimeMeridianGeoKey:2051,GeogLinearUnitsGeoKey:2052,GeogLinearUnitSizeGeoKey:2053,GeogAngularUnitsGeoKey:2054,GeogAngularUnitSizeGeoKey:2055,GeogEllipsoidGeoKey:2056,GeogSemiMajorAxisGeoKey:2057,GeogSemiMinorAxisGeoKey:2058,GeogInvFlatteningGeoKey:2059,GeogAzimuthUnitsGeoKey:2060,GeogPrimeMeridianLongGeoKey:2061,GeogTOWGS84GeoKey:2062,ProjectedCSTypeGeoKey:3072,PCSCitationGeoKey:3073,ProjectionGeoKey:3074,ProjCoordTransGeoKey:3075,ProjLinearUnitsGeoKey:3076,ProjLinearUnitSizeGeoKey:3077,ProjStdParallel1GeoKey:3078,ProjStdParallel2GeoKey:3079,ProjNatOriginLongGeoKey:3080,ProjNatOriginLatGeoKey:3081,ProjFalseEastingGeoKey:3082,ProjFalseNorthingGeoKey:3083,ProjFalseOriginLongGeoKey:3084,ProjFalseOriginLatGeoKey:3085,ProjFalseOriginEastingGeoKey:3086,ProjFalseOriginNorthingGeoKey:3087,ProjCenterLongGeoKey:3088,ProjCenterLatGeoKey:3089,ProjCenterEastingGeoKey:3090,ProjCenterNorthingGeoKey:3091,ProjScaleAtNatOriginGeoKey:3092,ProjScaleAtCenterGeoKey:3093,ProjAzimuthAngleGeoKey:3094,ProjStraightVertPoleLongGeoKey:3095,VerticalCSTypeGeoKey:4096,VerticalCitationGeoKey:4097,VerticalDatumGeoKey:4098,VerticalUnitsGeoKey:4099}}}),i("formats/geotiff/GeoTiffKeyEntry",["../../error/AbstractError","../../error/ArgumentError","./GeoTiffConstants","../../util/Logger"],function(t,e,i,r){"use strict";var n=function(t,i,n,o){if(!t)throw new e(r.logMessage(r.LEVEL_SEVERE,"GeoTiffKeyEntry","constructor","missingKeyId"));if(null===i||void 0===i)throw new e(r.logMessage(r.LEVEL_SEVERE,"GeoTiffKeyEntry","constructor","missingTiffTagLocation"));if(!n)throw new e(r.logMessage(r.LEVEL_SEVERE,"GeoTiffKeyEntry","constructor","missingCount"));if(null===o||void 0===o)throw new e(r.logMessage(r.LEVEL_SEVERE,"GeoTiffKeyEntry","constructor","missingValueOffset"));this._keyId=t,this._tiffTagLocation=i,this._count=n,this._valueOffset=o};return Object.defineProperties(n.prototype,{keyId:{get:function(){return this._keyId}},tiffTagLocation:{get:function(){return this._tiffTagLocation}},count:{get:function(){return this._count}},valueOffset:{get:function(){return this._valueOffset}}}),n.prototype.getGeoKeyValue=function(t,e){var r;if(0===this.tiffTagLocation)r=this.valueOffset;else if(this.tiffTagLocation===i.Tag.GEO_ASCII_PARAMS){var n="";if(e){for(var o=this.valueOffset;o<this.count-1;o++)n+=e[o];"|"!=e[this.count-1]&&(n+=e[this.count-1]),r=n}}else this.tiffTagLocation===i.Tag.GEO_DOUBLE_PARAMS&&t&&(r=t[this.valueOffset]);return r},n}),i("formats/geotiff/GeoTiffMetadata",[],function(){"use strict";var t=function(){this._bitsPerSample=null,this._colorMap=null,this._compression=null,this._extraSamples=null,this._imageLength=null,this._imageWidth=null,this._maxSampleValue=null,this._minSampleValue=null,this._orientation=0,this._photometricInterpretation=null,this._planarConfiguration=null,this._resolutionUnit=null,this._rowsPerStrip=null,this._samplesPerPixel=null,this._sampleFormat=null,this._software=null,this._stripByteCounts=null,this._stripOffsets=null,this._tileByteCounts=null,this._tileOffsets=null,this._tileLength=null,this._tileWidth=null,this._xResolution=null,this._yResolution=null,this._geoAsciiParams=null,this._geoDoubleParams=null,this._geoKeyDirectory=null,this._modelPixelScale=null,this._modelTiepoint=null,this._modelTransformation=null,this._noData=null,this._bbox=null,this._gtModelTypeGeoKey=null,this._gtRasterTypeGeoKey=null,this._gtCitationGeoKey=null,this._geographicTypeGeoKey=null,this._geogCitationGeoKey=null,this._geogAngularUnitsGeoKey=null,this._geogAngularUnitSizeGeoKey=null,this._geogSemiMajorAxisGeoKey=null,this._geogInvFlatteningGeoKey=null,this._projectedCSType=null};return Object.defineProperties(t.prototype,{bitsPerSample:{get:function(){return this._bitsPerSample},set:function(t){this._bitsPerSample=t}},colorMap:{get:function(){return this._colorMap},set:function(t){this._colorMap=t}},compression:{get:function(){return this._compression},set:function(t){this._compression=t}},extraSamples:{get:function(){return this._extraSamples},set:function(t){this._extraSamples=t}},imageLength:{get:function(){return this._imageLength},set:function(t){this._imageLength=t}},imageWidth:{get:function(){return this._imageWidth},set:function(t){this._imageWidth=t}},maxSampleValue:{get:function(){return this._maxSampleValue},set:function(t){this._maxSampleValue=t}},minSampleValue:{get:function(){return this._minSampleValue},set:function(t){this._minSampleValue=t}},orientation:{get:function(){return this._orientation},set:function(t){this._orientation=t}},photometricInterpretation:{get:function(){return this._photometricInterpretation},set:function(t){this._photometricInterpretation=t}},planarConfiguration:{get:function(){return this._planarConfiguration},set:function(t){this._planarConfiguration=t}},resolutionUnit:{get:function(){return this._resolutionUnit},set:function(t){this._resolutionUnit=t}},rowsPerStrip:{get:function(){return this._rowsPerStrip},set:function(t){this._rowsPerStrip=t}},samplesPerPixel:{get:function(){return this._samplesPerPixel},set:function(t){this._samplesPerPixel=t}},sampleFormat:{get:function(){return this._sampleFormat},set:function(t){this._sampleFormat=t}},software:{get:function(){return this._software},set:function(t){this._software=t}},stripByteCounts:{get:function(){return this._stripByteCounts},set:function(t){this._stripByteCounts=t}},stripOffsets:{get:function(){return this._stripOffsets},set:function(t){this._stripOffsets=t}},tileByteCounts:{get:function(){return this._tileByteCounts},set:function(t){this._tileByteCounts=t}},tileOffsets:{get:function(){return this._tileOffsets},set:function(t){this._tileOffsets=t}},tileLength:{get:function(){return this._tileLength},set:function(t){this._tileLength=t}},tileWidth:{get:function(){return this._tileWidth},set:function(t){this._tileWidth=t}},geoAsciiParams:{get:function(){return this._geoAsciiParams},set:function(t){this._geoAsciiParams=t}},geoDoubleParams:{get:function(){return this._geoDoubleParams},set:function(t){this._geoDoubleParams=t}},geoKeyDirectory:{get:function(){return this._geoKeyDirectory},set:function(t){this._geoKeyDirectory=t}},modelPixelScale:{get:function(){return this._modelPixelScale},set:function(t){this._modelPixelScale=t}},modelTiepoint:{get:function(){return this._modelTiepoint},set:function(t){this._modelTiepoint=t}},modelTransformation:{get:function(){return this._modelTransformation},set:function(t){this._modelTransformation=t}},noData:{get:function(){return this._noData},set:function(t){this._noData=t}},bbox:{get:function(){return this._bbox},set:function(t){this._bbox=t}},gtModelTypeGeoKey:{get:function(){return this._gtModelTypeGeoKey},set:function(t){this._gtModelTypeGeoKey=t}},gtRasterTypeGeoKey:{get:function(){return this._gtRasterTypeGeoKey},set:function(t){this._gtRasterTypeGeoKey=t}},gtCitationGeoKey:{get:function(){return this._gtCitationGeoKey},set:function(t){this._gtCitationGeoKey=t}},geographicTypeGeoKey:{get:function(){return this._geographicTypeGeoKey},set:function(t){this._geographicTypeGeoKey=t}},geogCitationGeoKey:{get:function(){return this._geogCitationGeoKey},set:function(t){this._geogCitationGeoKey=t}},geogAngularUnitsGeoKey:{get:function(){return this._geogAngularUnitsGeoKey},set:function(t){this._geogAngularUnitsGeoKey=t}},geogAngularUnitSizeGeoKey:{get:function(){return this._geogAngularUnitSizeGeoKey},set:function(t){this._geogAngularUnitSizeGeoKey=t}},geogSemiMajorAxisGeoKey:{get:function(){return this._geogSemiMajorAxisGeoKey},set:function(t){this._geogSemiMajorAxisGeoKey=t}},geogInvFlatteningGeoKey:{get:function(){return this._geogInvFlatteningGeoKey},set:function(t){this._geogInvFlatteningGeoKey=t}},projectedCSType:{get:function(){return this._projectedCSType},set:function(t){this._projectedCSType=t}},xResolution:{get:function(){return this._xResolution},set:function(t){this._xResolution=t}},yResolution:{get:function(){return this._yResolution},set:function(t){this._yResolution=t}}}),t}),i("formats/geotiff/TiffConstants",[],function(){"use strict";return{Tag:{NEW_SUBFILE_TYPE:254,SUBFILE_TYPE:255,IMAGE_WIDTH:256,IMAGE_LENGTH:257,BITS_PER_SAMPLE:258,COMPRESSION:259,PHOTOMETRIC_INTERPRETATION:262,THRESHHOLDING:263,CELL_WIDTH:264,CELL_LENGTH:265,FILL_ORDER:266,DOCUMENT_NAME:269,IMAGE_DESCRIPTION:270,MAKE:271,MODEL:272,STRIP_OFFSETS:273,ORIENTATION:274,SAMPLES_PER_PIXEL:277,ROWS_PER_STRIP:278,STRIP_BYTE_COUNTS:279,MIN_SAMPLE_VALUE:280,MAX_SAMPLE_VALUE:281,X_RESOLUTION:282,Y_RESOLUTION:283,PLANAR_CONFIGURATION:284,PAGE_NAME:285,X_POSITION:286,Y_POSITION:287,FREE_OFFSETS:288,FREE_BYTE_COUNTS:289,GRAY_RESPONSE_UNIT:290,GRAY_RESPONSE_CURVE:291,T4_OPTIONS:292,T6_PTIONS:293,RESOLUTION_UNIT:296,PAGE_NUMBER:297,TRANSFER_FUNCTION:301,SOFTWARE:305,DATE_TIME:306,ARTIST:315,HOST_COMPUTER:316,PREDICTOR:317,WHITE_POINT:318,PRIMARY_CHROMATICITIES:319,COLOR_MAP:320,HALFTONE_HINTS:321,TILE_WIDTH:322,TILE_LENGTH:323,TILE_OFFSETS:324,TILE_BYTE_COUNTS:325,INK_SET:332,INK_NAMES:333,NUMBER_OF_INKS:334,DOT_RANGE:336,TARGET_PRINTER:337,EXTRA_SAMPLES:338,SAMPLE_FORMAT:339,S_MIN_SAMPLE_VALUE:340,S_MAX_SAMPLE_VALUE:341,TRANSFER_RANGE:342,JPEG_PROC:512,JPEG_INTERCHANGE_FORMAT:513,JPEG_INTERCHANGE_FORMAT_LENGTH:514,JPEG_RESTART_INTERVAL:515,JPEG_LOSSLESS_PREDICTORS:517,JPEG_POINT_TRANSFORMS:518,JPEG_Q_TABLES:519,JPEG_DC_TABLES:520,JPEG_AC_TABLES:521,Y_Cb_Cr_COEFFICIENTS:529,Y_Cb_Cr_SUB_SAMPLING:530,Y_Cb_Cr_POSITIONING:531,REFERENCE_BLACK_WHITE:532,COPYRIGHT:33432},Compression:{UNCOMPRESSED:1,CCITT_1D:2,GROUP_3_FAX:3,GROUP_4_FAX:4,LZW:5,JPEG:6,PACK_BITS:32773},Orientation:{Row0_IS_TOP__Col0_IS_LHS:1,Row0_IS_TOP__Col0_IS_RHS:2,Row0_IS_BOTTOM__Col0_IS_RHS:3,Row0_IS_BOTTOM__Col0_IS_LHS:4,Row0_IS_LHS__Col0_IS_TOP:5,Row0_IS_RHS__Col0_IS_TOP:6,Row0_IS_RHS__Col0_IS_BOTTOM:7,Row0_IS_LHS__Col0_IS_BOTTOM:8},PhotometricInterpretation:{WHITE_IS_ZERO:0,BLACK_IS_ZERO:1,RGB:2,RGB_PALETTE:3,TRANSPARENCY_MASK:4,CMYK:5,Y_Cb_Cr:6,CIE_LAB:7},PlanarConfiguration:{CHUNKY:1,PLANAR:2},ResolutionUnit:{NONE:1,INCH:2,CENTIMETER:3},SampleFormat:{UNSIGNED:1,SIGNED:2,IEEE_FLOAT:3,UNDEFINED:4,DEFAULT:1},Type:{BYTE:1,ASCII:2,SHORT:3,LONG:4,RATIONAL:5,SBYTE:6,UNDEFINED:7,SSHORT:8,SLONG:9,SRATIONAL:10,FLOAT:11,DOUBLE:12}}}),i("formats/geotiff/GeoTiffUtil",["../../error/ArgumentError","../../util/Logger","./TiffConstants"],function(t,e,i){"use strict";return{getBytes:function(i,r,n,o,s){if(n<=0)throw new t(e.logMessage(e.LEVEL_SEVERE,"GeoTiffReader","getBytes","noBytesRequested"));if(n<=1)return s?i.getInt8(r,o):i.getUint8(r,o);if(n<=2)return s?i.getInt16(r,o):i.getUint16(r,o);if(n<=3)return s?i.getInt32(r,o)>>>8:i.getUint32(r,o)>>>8;if(n<=4)return s?i.getInt32(r,o):i.getUint32(r,o);if(n<=8)return i.getFloat64(r,o);throw new t(e.logMessage(e.LEVEL_SEVERE,"GeoTiffReader","getBytes","tooManyBytesRequested"))},getSampleBytes:function(t,r,n,o,s){var a;switch(o){case i.SampleFormat.UNSIGNED:a=this.getBytes(t,r,n,s,!1);break;case i.SampleFormat.SIGNED:a=this.getBytes(t,r,n,s,!0);break;case i.SampleFormat.IEEE_FLOAT:3==n?a=t.getFloat32(r,s)>>>8:4==n?a=t.getFloat32(r,s):8==n?a=t.getFloat64(r,s):e.log(e.LEVEL_WARNING,"Do not attempt to parse the data  not handled: "+n);break;case i.SampleFormat.UNDEFINED:default:a=this.getBytes(t,r,n,s,!1)}return a},canvasToTiffImage:function(t){var e=new Image;return e.src=t.toDataURL(),e},getRGBAFillValue:function(t,e,i,r){return void 0===r&&(r=1),"rgba("+t+", "+e+", "+i+", "+r+")"},getTagValueAsString:function(t,e){for(var i in t)if(t[i]===e)return i},clampColorSample:function(t,e){var i=Math.pow(2,8-e);return Math.floor(t*i+(i-1))},clampColorSampleForElevation:function(t,e,i){var r=255/(i-e);return Math.round(r*(t-e))},getMinMaxGeotiffSamples:function(t,e){for(var i=1/0,r=-1/0,n=0;n<t.length;n++)for(var o=0;o<t[n].length;o++)for(var s=0;s<t[n][o].length;s++)t[n][o][s]!=e&&(t[n][o][s]>r&&(r=t[n][o][s]),t[n][o][s]<i&&(i=t[n][o][s]));return{max:r,min:i}}}}),i("formats/geotiff/TiffIFDEntry",["../../error/AbstractError","../../error/ArgumentError","./GeoTiffUtil","../../util/Logger","./TiffConstants"],function(t,e,i,r,n){"use strict";var o=function(t,i,n,o,s,a){if(!t)throw new e(r.logMessage(r.LEVEL_SEVERE,"TiffIFDEntry","constructor","missingTag"));if(!i)throw new e(r.logMessage(r.LEVEL_SEVERE,"TiffIFDEntry","constructor","missingType"));if(!n)throw new e(r.logMessage(r.LEVEL_SEVERE,"TiffIFDEntry","constructor","missingCount"));if(null===o||void 0===o)throw new e(r.logMessage(r.LEVEL_SEVERE,"TiffIFDEntry","constructor","missingValueOffset"));if(!s)throw new e(r.logMessage(r.LEVEL_SEVERE,"TiffIFDEntry","constructor","missingGeoTiffData"));if(null===a||void 0===a)throw new e(r.logMessage(r.LEVEL_SEVERE,"TiffIFDEntry","constructor","missingIsLittleEndian"));this._tag=t,this._type=i,this._count=n,this._valueOffset=o,this._geoTiffData=s,this._isLittleEndian=a};return Object.defineProperties(o.prototype,{tag:{get:function(){return this._tag}},type:{get:function(){return this._type}},count:{get:function(){return this._count}},valueOffset:{get:function(){return this._valueOffset}},geoTiffData:{get:function(){return this._geoTiffData}},isLittleEndian:{get:function(){return this._isLittleEndian}}}),o.prototype.getIFDTypeLength=function(){switch(this.type){case n.Type.BYTE:case n.Type.ASCII:case n.Type.SBYTE:case n.Type.UNDEFINED:return 1;case n.Type.SHORT:case n.Type.SSHORT:return 2;case n.Type.LONG:case n.Type.SLONG:case n.Type.FLOAT:return 4;case n.Type.RATIONAL:case n.Type.SRATIONAL:case n.Type.DOUBLE:return 8;default:return-1}},o.prototype.getIFDEntryValue=function(){var e=[],o=null,s=this.getIFDTypeLength();if(s*this.count<=4)o=!1===this.isLittleEndian?this.valueOffset>>>8*(4-s):this.valueOffset,e.push(o);else for(var a=0;a<this.count;a++){var l=s*a;if(s>=8)if(this.type===n.Type.RATIONAL||this.type===n.Type.SRATIONAL)e.push(i.getBytes(this.geoTiffData,this.valueOffset+l,4,this.isLittleEndian)),e.push(i.getBytes(this.geoTiffData,this.valueOffset+l+4,4,this.isLittleEndian));else{if(this.type!==n.Type.DOUBLE)throw new t(r.logMessage(r.LEVEL_SEVERE,"TiffIFDEntry","parse","invalidTypeOfIFD"));e.push(i.getBytes(this.geoTiffData,this.valueOffset+l,8,this.isLittleEndian))}else e.push(i.getBytes(this.geoTiffData,this.valueOffset+l,s,this.isLittleEndian))}return this.type===n.Type.ASCII?(e.forEach(function(t,e,i){0===t?i.splice(e,1):i[e]=String.fromCharCode(t)}),e.join("")):e},o}),i("formats/geotiff/GeoTiffReader",["../../error/AbstractError","../../error/ArgumentError","./GeoTiffConstants","./GeoTiffKeyEntry","./GeoTiffMetadata","./GeoTiffUtil","../../geom/Location","../../geom/Sector","../../util/Logger","../../util/proj4-src","./TiffConstants","./TiffIFDEntry","../../util/WWUtil"],function(t,e,i,r,n,o,s,a,l,h,u,c,d){"use strict";var p=function(t){if(!t)throw new e(l.logMessage(l.LEVEL_SEVERE,"GeoTiffReader","constructor","missingUrl"));this._url=t,this._isLittleEndian=!1,this._imageFileDirectories=[],this._geoTiffData=null,this._metadata=new n};return Object.defineProperties(p.prototype,{url:{get:function(){return this._url}},isLittleEndian:{get:function(){return this._isLittleEndian}},imageFileDirectories:{get:function(){return this._imageFileDirectories}},geoTiffData:{get:function(){return this._geoTiffData}},metadata:{get:function(){return this._metadata}}}),p.prototype.requestUrl=function(t,e){var i=new XMLHttpRequest;i.open("GET",t,!0),i.responseType="arraybuffer",i.onreadystatechange=function(){if(4===i.readyState)if(200===i.status){var r=i.response;r&&(this.parse(r),e())}else l.log(l.LEVEL_WARNING,"GeoTiff retrieval failed ("+i.statusText+"): "+t)}.bind(this),i.onerror=function(){l.log(l.LEVEL_WARNING,"GeoTiff retrieval failed: "+t)},i.ontimeout=function(){l.log(l.LEVEL_WARNING,"GeoTiff retrieval timed out: "+t)},i.send(null)},p.prototype.parse=function(e){if(this._geoTiffData=new DataView(e),this.getEndianness(),!this.isTiffFileType())throw new t(l.logMessage(l.LEVEL_SEVERE,"GeoTiffReader","parse","invalidTiffFileType"));var i=o.getBytes(this.geoTiffData,4,4,this.isLittleEndian);this.parseImageFileDirectory(i),this.getMetadataFromImageFileDirectory(),this.parseGeoKeys(),this.setBBox()},p.prototype.getEndianness=function(){var e=o.getBytes(this.geoTiffData,0,2,this.isLittleEndian);if(18761===e)this._isLittleEndian=!0;else{if(19789!==e)throw new t(l.logMessage(l.LEVEL_SEVERE,"GeoTiffReader","getEndianness","invalidByteOrderValue"));this._isLittleEndian=!1}},p.prototype.isTiffFileType=function(){return 42===o.getBytes(this.geoTiffData,2,2,this.isLittleEndian)},p.prototype.isGeoTiff=function(){return!!this.getIFDByTag(i.Tag.GEO_KEY_DIRECTORY)},p.prototype.readAsImage=function(t){this.requestUrl(this.url,function(){var e=this.metadata.bitsPerSample,i=this.metadata.samplesPerPixel,r=this.metadata.photometricInterpretation,n=this.metadata.imageLength,o=this.metadata.imageWidth;if(this.metadata.colorMap)var s=this.metadata.colorMap,a=Math.pow(2,e[0]);var l=document.createElement("canvas");l.width=o,l.height=n;var h=l.getContext("2d");if(this.metadata.stripOffsets){var u=this.parseStrips(!1);if(this.metadata.rowsPerStrip)var c=this.metadata.rowsPerStrip;else var c=n;for(var d=u.length,p=0,f=n%c,g=0===f?c:f,m=0;m<d;m++){m+1===d&&g;for(var E=u[m].length,y=p*m,_=0,v=0;v<E;_++)for(var S=0;S<o;S++,v++){var b=u[m][v];h.fillStyle=this.getFillStyle(b,r,e,i,s,a),h.fillRect(S,y+_,1,1)}p=c}}else if(this.metadata.tileOffsets)for(var T=this.parseTiles(!1),L=this.metadata.tileWidth,w=this.metadata.tileLength,R=Math.ceil(o/L),_=0;_<n;_++)for(var S=0;S<o;S++){var x=Math.floor(S/L),M=Math.floor(_/w),C=M*R+x,A=S%L,P=_%w,I=P*L+A,b=T[C][I];h.fillStyle=this.getFillStyle(b,r,e,i,s,a),h.fillRect(S,_,1,1)}this._geoTiffData=null,t(l)}.bind(this))},p.prototype.getFillStyle=function(t,e,i,r,n,s){var a=0,h=0,c=0,d=1;switch(this.metadata.noData&&t[0]==this.metadata.noData&&(d=0),e){case u.PhotometricInterpretation.WHITE_IS_ZERO:var p=Math.pow(2,i)-1;t[0]=p-t[0]
;case u.PhotometricInterpretation.BLACK_IS_ZERO:a=h=c=o.clampColorSample(t[0],i[0]);break;case u.PhotometricInterpretation.RGB:if(a=o.clampColorSample(t[0],i[0]),h=o.clampColorSample(t[1],i[1]),c=o.clampColorSample(t[2],i[2]),4===r&&2===this.metadata.extraSamples[0]){var f=Math.pow(2,i[3]);d=t[3]/f}break;case u.PhotometricInterpretation.RGB_PALETTE:if(n){var g=t[0];a=o.clampColorSample(n[g],16),h=o.clampColorSample(n[s+g],16),c=o.clampColorSample(n[2*s+g],16)}break;case u.PhotometricInterpretation.TRANSPARENCY_MASK:l.log(l.LEVEL_WARNING,"Photometric interpretation not yet implemented: TRANSPARENCY_MASK");break;case u.PhotometricInterpretation.CMYK:l.log(l.LEVEL_WARNING,"Photometric interpretation not yet implemented: CMYK");break;case u.PhotometricInterpretation.Y_Cb_Cr:l.log(l.LEVEL_WARNING,"Photometric interpretation not yet implemented: Y_Cb_Cr");break;case u.PhotometricInterpretation.CIE_LAB:l.log(l.LEVEL_WARNING,"Photometric interpretation not yet implemented: CIE_LAB");break;default:l.log("Unknown photometric interpretation: "+e)}return o.getRGBAFillValue(a,h,c,d)},p.prototype.createTypedElevationArray=function(){var t,e=[],i=this.metadata.bitsPerSample[0];if(this.metadata.stripOffsets)for(var r=this.parseStrips(!0),n=0;n<r.length;n++)e=e.concat(r[n]);else if(this.metadata.tileOffsets)for(var o=this.parseTiles(!0),s=this.metadata.imageWidth,a=this.metadata.imageLength,l=this.metadata.tileWidth,h=this.metadata.tileLength,c=Math.ceil(s/l),d=0;d<a;d++)for(var p=0;p<s;p++){var f=Math.floor(p/l),g=Math.floor(d/h),m=g*c+f,E=p%l,y=d%h,_=y*l+E,v=o[m][_];e.push(v)}if(this.metadata.sampleFormat)var S=this.metadata.sampleFormat[0];else var S=u.SampleFormat.UNSIGNED;switch(i){case 8:t=S===u.SampleFormat.SIGNED?new Int8Array(e):new Uint8Array(e);break;case 16:t=S===u.SampleFormat.SIGNED?new Int16Array(e):new Uint16Array(e);break;case 32:t=S===u.SampleFormat.SIGNED?new Int32Array(e):S===u.SampleFormat.IEEE_FLOAT?new Float32Array(e):new Uint32Array(e);break;case 64:t=new Float64Array(e)}return t},p.prototype.readAsData=function(t){this.requestUrl(this.url,function(){t(this.createTypedElevationArray())}.bind(this))},p.prototype.parseStrips=function(t){var e=this.metadata.samplesPerPixel,i=this.metadata.bitsPerSample,r=this.metadata.stripOffsets,n=this.metadata.stripByteCounts,o=this.metadata.compression;if(this.metadata.sampleFormat)var s=this.metadata.sampleFormat;else var s=u.SampleFormat.UNSIGNED;for(var a=e*i[0],l=a/8,h=[],c=0;c<r.length;c++){var d=r[c],p=n[c];h[c]=this.parseBlock(t,o,l,p,d,i,s)}return h},p.prototype.parseBlock=function(t,e,i,r,n,s,a){var h=[];switch(e){case u.Compression.UNCOMPRESSED:for(var c=0,d=i;c<r;c+=d){for(var p=0,f=[];p<s.length;p++){var g=s[p]/8,m=p*g;f.push(o.getSampleBytes(this.geoTiffData,n+c+m,g,a[p],this.isLittleEndian))}t?h.push(f[0]):h.push(f)}break;case u.Compression.CCITT_1D:l.log(l.LEVEL_WARNING,"Compression type not yet implemented: CCITT_1D");break;case u.Compression.GROUP_3_FAX:l.log(l.LEVEL_WARNING,"Compression type not yet implemented: GROUP_3_FAX");break;case u.Compression.GROUP_4_FAX:l.log(l.LEVEL_WARNING,"Compression type not yet implemented: GROUP_4_FAX");break;case u.Compression.LZW:l.log(l.LEVEL_WARNING,"Compression type not yet implemented: LZW");break;case u.Compression.JPEG:l.log(l.LEVEL_WARNING,"Compression type not yet implemented: JPEG");break;case u.Compression.PACK_BITS:if(this.metadata.tileOffsets)var E=this.metadata.tileWidth,y=this.metadata.tileWidth,_=new ArrayBuffer(E*y*i);else var v=this.metadata.rowsPerStrip,S=this.metadata.imageWidth,_=new ArrayBuffer(v*S*i);for(var b=new DataView(_),T=!0,f=[],L=0,w=0,R=0,c=0;c<r;c+=1)if(T){L=1,w=1,T=!1;var x=this.geoTiffData.getInt8(n+c,this.isLittleEndian);x>=0&&x<=127?L=x+1:x>=-127&&x<=-1?w=1-x:T=!0}else{for(var M=o.getBytes(this.geoTiffData,n+c,1,this.isLittleEndian),C=0;C<w;C++)b.setInt8(R,M),R++;L--,0===L&&(T=!0)}for(var c=0,d=i;c<_.byteLength;c+=d){for(var p=0,f=[];p<s.length;p++){var g=s[p]/8,m=p*g;f.push(o.getSampleBytes(b,c+m,g,a[p],this.isLittleEndian))}t?h.push(f[0]):h.push(f)}}return h},p.prototype.parseTiles=function(t){var e=this.metadata.samplesPerPixel,i=this.metadata.bitsPerSample,r=this.metadata.compression;if(this.metadata.sampleFormat)var n=this.metadata.sampleFormat;else{var n=new Array(e);d.fillArray(n,u.SampleFormat.UNSIGNED)}for(var o=e*i[0],s=o/8,a=this.metadata.tileWidth,l=this.metadata.tileLength,h=this.metadata.tileOffsets,c=this.metadata.tileByteCounts,p=this.metadata.imageLength,f=this.metadata.imageWidth,g=Math.ceil(f/a),m=Math.ceil(p/l),E=[],y=0;y<m;y++)for(var _=0;_<g;_++){var v=g*y+_,S=h[v],b=c[v];E[v]=this.parseBlock(t,r,s,b,S,i,n)}return E},p.prototype.geoTiffImageToPCS=function(t,i){if(null===t||void 0===t)throw new e(l.logMessage(l.LEVEL_SEVERE,"GeoTiffReader","geoTiffImageToPCS","missingXValue"));if(null===i||void 0===i)throw new e(l.logMessage(l.LEVEL_SEVERE,"GeoTiffReader","geoTiffImageToPCS","missingYValue"));var r=[t,i],n=this.metadata.modelTiepoint,o=this.metadata.modelPixelScale,a=this.metadata.modelTransformation,u=n?n.length:0,c=o?o.length:0,d=a?a.length:0;if(u>6&&0===c);else if(16===d){var p=t,f=i;t=p*a[0]+f*a[1]+a[3],i=p*a[4]+f*a[5]+a[7],r=[t,i]}else c<3||u<6?r=[t,i]:(t=(t-n[0])*o[0]+n[3],i=(i-n[1])*(-1*o[1])+n[4],r=[t,i]);return h.defs([["EPSG:26771","+proj=tmerc +lat_0=36.66666666666666 +lon_0=-88.33333333333333 +k=0.9999749999999999 +x_0=152400.3048006096 +y_0=0 +ellps=clrk66 +datum=NAD27 +to_meter=0.3048006096012192 +no_defs "],["EPSG:32633","+proj=utm +zone=33 +datum=WGS84 +units=m +no_defs"]]),this.metadata.projectedCSType&&(r=h("EPSG:"+this.metadata.projectedCSType,"EPSG:4326",r)),new s(r[1],r[0])},p.prototype.setBBox=function(){var t=this.geoTiffImageToPCS(0,0),e=this.geoTiffImageToPCS(this.metadata.imageWidth,0),i=this.geoTiffImageToPCS(0,this.metadata.imageLength);this.geoTiffImageToPCS(this.metadata.imageWidth,this.metadata.imageLength);this.metadata.bbox=new a(i.latitude,t.latitude,t.longitude,e.longitude)},p.prototype.getMetadataFromImageFileDirectory=function(){for(var t=0;t<this.imageFileDirectories[0].length;t++)switch(this.imageFileDirectories[0][t].tag){case u.Tag.BITS_PER_SAMPLE:this.metadata.bitsPerSample=this.imageFileDirectories[0][t].getIFDEntryValue();break;case u.Tag.COLOR_MAP:this.metadata.colorMap=this.imageFileDirectories[0][t].getIFDEntryValue();break;case u.Tag.COMPRESSION:this.metadata.compression=this.imageFileDirectories[0][t].getIFDEntryValue()[0];break;case u.Tag.EXTRA_SAMPLES:this.metadata.extraSamples=this.imageFileDirectories[0][t].getIFDEntryValue();break;case u.Tag.IMAGE_LENGTH:this.metadata.imageLength=this.imageFileDirectories[0][t].getIFDEntryValue()[0];break;case u.Tag.IMAGE_WIDTH:this.metadata.imageWidth=this.imageFileDirectories[0][t].getIFDEntryValue()[0];break;case u.Tag.MAX_SAMPLE_VALUE:this.metadata.maxSampleValue=this.imageFileDirectories[0][t].getIFDEntryValue()[0];break;case u.Tag.MIN_SAMPLE_VALUE:this.metadata.minSampleValue=this.imageFileDirectories[0][t].getIFDEntryValue()[0];break;case u.Tag.ORIENTATION:this.metadata.orientation=this.imageFileDirectories[0][t].getIFDEntryValue()[0];break;case u.Tag.PHOTOMETRIC_INTERPRETATION:this.metadata.photometricInterpretation=this.imageFileDirectories[0][t].getIFDEntryValue()[0];break;case u.Tag.PLANAR_CONFIGURATION:this.metadata.planarConfiguration=this.imageFileDirectories[0][t].getIFDEntryValue()[0];break;case u.Tag.ROWS_PER_STRIP:this.metadata.rowsPerStrip=this.imageFileDirectories[0][t].getIFDEntryValue()[0];break;case u.Tag.RESOLUTION_UNIT:this.metadata.resolutionUnit=this.imageFileDirectories[0][t].getIFDEntryValue()[0];break;case u.Tag.SAMPLES_PER_PIXEL:this.metadata.samplesPerPixel=this.imageFileDirectories[0][t].getIFDEntryValue()[0];break;case u.Tag.SAMPLE_FORMAT:this.metadata.sampleFormat=this.imageFileDirectories[0][t].getIFDEntryValue();break;case u.Tag.SOFTWARE:this.metadata.software=this.imageFileDirectories[0][t].getIFDEntryValue();break;case u.Tag.STRIP_BYTE_COUNTS:this.metadata.stripByteCounts=this.imageFileDirectories[0][t].getIFDEntryValue();break;case u.Tag.STRIP_OFFSETS:this.metadata.stripOffsets=this.imageFileDirectories[0][t].getIFDEntryValue();break;case u.Tag.TILE_BYTE_COUNTS:this.metadata.tileByteCounts=this.imageFileDirectories[0][t].getIFDEntryValue();break;case u.Tag.TILE_OFFSETS:this.metadata.tileOffsets=this.imageFileDirectories[0][t].getIFDEntryValue();break;case u.Tag.TILE_LENGTH:this.metadata.tileLength=this.imageFileDirectories[0][t].getIFDEntryValue();break;case u.Tag.TILE_WIDTH:this.metadata.tileWidth=this.imageFileDirectories[0][t].getIFDEntryValue();break;case u.Tag.X_RESOLUTION:this.metadata.xResolution=this.imageFileDirectories[0][t].getIFDEntryValue();break;case u.Tag.Y_RESOLUTION:this.metadata.tileWidth=this.imageFileDirectories[0][t].getIFDEntryValue();break;case i.Tag.GEO_ASCII_PARAMS:this.metadata.geoAsciiParams=this.imageFileDirectories[0][t].getIFDEntryValue();break;case i.Tag.GEO_DOUBLE_PARAMS:this.metadata.geoDubleParams=this.imageFileDirectories[0][t].getIFDEntryValue();break;case i.Tag.GEO_KEY_DIRECTORY:this.metadata.geoKeyDirectory=this.imageFileDirectories[0][t].getIFDEntryValue();break;case i.Tag.MODEL_PIXEL_SCALE:this.metadata.modelPixelScale=this.imageFileDirectories[0][t].getIFDEntryValue();break;case i.Tag.MODEL_TIEPOINT:this.metadata.modelTiepoint=this.imageFileDirectories[0][t].getIFDEntryValue();break;case i.Tag.GDAL_NODATA:this.metadata.noData=this.imageFileDirectories[0][t].getIFDEntryValue();break;default:l.log(l.LEVEL_WARNING,"Ignored GeoTiff tag: "+this.imageFileDirectories[0][t].tag)}},p.prototype.getMetadataFromGeoKeys=function(){for(var t=0;t<this.geoKeys.length;t++){var e=o.getTagValueAsString(i.Key,this.geoKeys[t].keyId);e?this._metadata.geotiff.geoKeys[e]=this.geoKeys[t].getGeoKeyValue(this.metadata.geoDoubleParams,this.metadata.geoAsciiParams):l.log(l.LEVEL_WARNING,"Unknown GeoTiff key: "+this.geoKeys[t].keyId)}},p.prototype.parseGeoKeys=function(){if(!this.isGeoTiff())throw new t(l.logMessage(l.LEVEL_SEVERE,"GeoTiffReader","parse","invalidGeoTiffFile"));var e=this.metadata.geoKeyDirectory;if(!e)throw new t(l.logMessage(l.LEVEL_SEVERE,"GeoTiffReader","parseGeoKeys","missingGeoKeyDirectoryTag"));for(var n=(e[0],e[1],e[2],e[3]),o=0;o<n;o++){var s=e[4+4*o],a=e[5+4*o],h=e[6+4*o],u=e[7+4*o];switch(s){case i.Key.GTModelTypeGeoKey:this.metadata.gtModelTypeGeoKey=new r(s,a,h,u).getGeoKeyValue(this.metadata.geoDoubleParams,this.metadata.geoAsciiParams);break;case i.Key.GTRasterTypeGeoKey:this.metadata.gtRasterTypeGeoKey=new r(s,a,h,u).getGeoKeyValue(this.metadata.geoDoubleParams,this.metadata.geoAsciiParams);break;case i.Key.GTCitationGeoKey:this.metadata.gtCitationGeoKey=new r(s,a,h,u).getGeoKeyValue(this.metadata.geoDoubleParams,this.metadata.geoAsciiParams);break;case i.Key.GeographicTypeGeoKey:this.metadata.geographicTypeGeoKey=new r(s,a,h,u).getGeoKeyValue(this.metadata.geoDoubleParams,this.metadata.geoAsciiParams);break;case i.Key.GeogCitationGeoKey:this.metadata.geogCitationGeoKey=new r(s,a,h,u).getGeoKeyValue(this.metadata.geoDoubleParams,this.metadata.geoAsciiParams);break;case i.Key.GeogAngularUnitsGeoKey:this.metadata.geogAngularUnitsGeoKey=new r(s,a,h,u).getGeoKeyValue(this.metadata.geoDoubleParams,this.metadata.geoAsciiParams);break;case i.Key.GeogAngularUnitSizeGeoKey:this.metadata.geogAngularUnitSizeGeoKey=new r(s,a,h,u).getGeoKeyValue(this.metadata.geoDoubleParams,this.metadata.geoAsciiParams);break;case i.Key.GeogSemiMajorAxisGeoKey:this.metadata.geogSemiMajorAxisGeoKey=new r(s,a,h,u).getGeoKeyValue(this.metadata.geoDoubleParams,this.metadata.geoAsciiParams);break;case i.Key.GeogInvFlatteningGeoKey:this.metadata.geogInvFlatteningGeoKey=new r(s,a,h,u).getGeoKeyValue(this.metadata.geoDoubleParams,this.metadata.geoAsciiParams);break;case i.Key.ProjectedCSTypeGeoKey:this.metadata.projectedCSType=new r(s,a,h,u).getGeoKeyValue(this.metadata.geoDoubleParams,this.metadata.geoAsciiParams);break;default:l.log(l.LEVEL_WARNING,"Ignored GeoTiff key: "+s)}}},p.prototype.parseImageFileDirectory=function(t){if(!t)throw new e(l.logMessage(l.LEVEL_SEVERE,"GeoTiffReader","parseImageFileDirectory","missingOffset"));for(var i=o.getBytes(this.geoTiffData,t,2,this.isLittleEndian),r=[],n=t+2,s=0;s<i;n+=12,s++){var a=o.getBytes(this.geoTiffData,n,2,this.isLittleEndian),h=o.getBytes(this.geoTiffData,n+2,2,this.isLittleEndian),u=o.getBytes(this.geoTiffData,n+4,4,this.isLittleEndian),d=o.getBytes(this.geoTiffData,n+8,4,this.isLittleEndian);r.push(new c(a,h,u,d,this.geoTiffData,this.isLittleEndian))}this._imageFileDirectories.push(r);var p=o.getBytes(this.geoTiffData,n,4,this.isLittleEndian);0!==p&&this.parseImageFileDirectory(p)},p.prototype.getIFDByTag=function(t){if(!t)throw new e(l.logMessage(l.LEVEL_SEVERE,"GeoTiffReader","getIFDByTag","missingTag"));for(var i=0;i<this.imageFileDirectories[0].length;i++)if(this.imageFileDirectories[0][i].tag===t)return this.imageFileDirectories[0][i];return null},p}),i("projections/ProjectionEquirectangular",["../geom/Angle","../error/ArgumentError","../projections/GeographicProjection","../util/Logger","../geom/Vec3"],function(t,e,i,r,n){"use strict";var o=function(){i.call(this,"Equirectangular",!0,null)};return o.prototype=Object.create(i.prototype),Object.defineProperties(o.prototype,{stateKey:{get:function(){return"projection equirectangular "}}}),o.prototype.geographicToCartesian=function(i,n,o,s,a,l){if(!i)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionEquirectangular","geographicToCartesian","missingGlobe"));if(!l)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionEquirectangular","geographicToCartesian","missingResult"));return l[0]=i.equatorialRadius*o*t.DEGREES_TO_RADIANS+(a?a[0]:0),l[1]=i.equatorialRadius*n*t.DEGREES_TO_RADIANS,l[2]=s,l},o.prototype.geographicToCartesianGrid=function(i,o,s,a,l,h,u,c){if(!i)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionEquirectangular","geographicToCartesianGrid","missingGlobe"));if(!o)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionEquirectangular","geographicToCartesianGrid","missingSector"));if(!l||l.length<s*a)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionEquirectangular","geographicToCartesianGrid","The specified elevations array is null, undefined or insufficient length"));if(!c)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionEquirectangular","geographicToCartesianGrid","missingResult"));var d,p,f,g,m,E=i.equatorialRadius,y=o.minLatitude*t.DEGREES_TO_RADIANS,_=o.maxLatitude*t.DEGREES_TO_RADIANS,v=o.minLongitude*t.DEGREES_TO_RADIANS,S=o.maxLongitude*t.DEGREES_TO_RADIANS,b=(_-y)/(s>1?s-1:1),T=(S-v)/(a>1?a-1:1),L=h||new n(0,0,0),w=u?u[0]:0,R=0,x=0;for(d=0,f=y;d<s;d++,f+=b)for(d===s-1&&(f=_),m=E*f-L[1],p=0,g=v;p<a;p++,g+=T)p===a-1&&(g=S),c[x++]=E*g-L[0]+w,c[x++]=m,c[x++]=l[R++]-L[2];return c},o.prototype.cartesianToGeographic=function(i,n,o,s,a,l){if(!i)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionEquirectangular","cartesianToGeographic","missingGlobe"));if(!l)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionEquirectangular","cartesianToGeographic","missingResult"));return l.latitude=o/i.equatorialRadius*t.RADIANS_TO_DEGREES,l.longitude=(n-(a?a[0]:0))/i.equatorialRadius*t.RADIANS_TO_DEGREES,l.altitude=s,l},o}),i("globe/ZeroElevationModel",["../error/ArgumentError","../globe/ElevationModel","../geom/Location","../util/Logger","../geom/Sector"],function(t,e,i,r,n){"use strict";var o=function(){e.call(this,n.FULL_SPHERE,new i(45,45),1," "," ",150,150),this.displayName="Zero Elevations",this.timestamp=Date.now(),this.minElevation=0,this.maxElevation=0};return o.prototype=Object.create(e.prototype),o.prototype.minAndMaxElevationsForSector=function(t){return[0,0]},o.prototype.elevationAtLocation=function(t,e){return 0},o.prototype.elevationsForGrid=function(e,i,n,o,s){if(!e)throw new t(r.logMessage(r.LEVEL_SEVERE,"ZeroElevationModel","elevationsForSector","missingSector"));if(i<=0||n<=0)throw new t(r.logMessage(r.LEVEL_SEVERE,"ZeroElevationModel","elevationsForSector","numLat or numLon is less than 1"));if(!s||s.length<i*n)throw new t(r.logMessage(r.LEVEL_SEVERE,"ZeroElevationModel","elevationsForSector","missingArray"));for(var a=0,l=s.length;a<l;a++)s[a]=0;return 0},o}),i("globe/Globe2D",["../globe/Globe","../projections/ProjectionEquirectangular","../globe/ZeroElevationModel"],function(t,e,i){"use strict";var r=function(){t.call(this,new i,new e)};return r.prototype=Object.create(t.prototype),r}),i("util/GoToAnimator",["../geom/Location","../util/Logger","../geom/Position","../geom/Vec3"],function(t,e,i,r){"use strict";var n=function(t){if(!t)throw new ArgumentError(e.logMessage(e.LEVEL_SEVERE,"GoToAnimator","constructor","missingWorldWindow"));this.wwd=t,this.animationFrequency=20,this.travelTime=3e3,this.cancelled=!1};return n.prototype.cancel=function(){this.cancelled=!0},n.prototype.goTo=function(n,o){if(!n)throw new ArgumentError(e.logMessage(e.LEVEL_SEVERE,"GoToAnimator","goTo","missingPosition"));this.completionCallback=o,this.cancelled=!1,this.targetPosition=new i(n.latitude,n.longitude,n.altitude||this.wwd.navigator.range),this.startPosition=new i(this.wwd.navigator.lookAtLocation.latitude,this.wwd.navigator.lookAtLocation.longitude,this.wwd.navigator.range),this.startTime=Date.now();var s,a=this.travelTime,l=t.greatCircleDistance(this.startPosition,this.targetPosition),h=this.wwd.globe.computePointFromLocation(this.startPosition.latitude,this.startPosition.longitude,new r(0,0,0)),u=this.wwd.globe.computePointFromLocation(this.targetPosition.latitude,this.targetPosition.longitude,new r(0,0,0));this.maxAltitude=h.distanceTo(u);var c=this.wwd.navigator.currentState().pixelSizeAtDistance(this.startPosition.altitude)*this.wwd.canvas.clientWidth/this.wwd.globe.equatorialRadius;l<=2*c&&(this.maxAltitude=this.startPosition.altitude),this.maxAltitudeReachedTime=this.maxAltitude<=this.wwd.navigator.range?Date.now():null,this.maxAltitude>this.startPosition.altitude?(s=Math.max(0,this.maxAltitude-this.startPosition.altitude),s+=Math.abs(this.targetPosition.altitude-this.maxAltitude)):s=Math.abs(this.targetPosition.altitude-this.startPosition.altitude);var d=Math.max(l,s/this.wwd.globe.equatorialRadius);if(0!==d){d<2*c&&(a=Math.min(d/c*this.travelTime,this.travelTime)),a=Math.max(1,a),this.panVelocity=l/a,this.rangeVelocity=s/a;var p=this,f=function(){if(p.cancelled)return void(p.completionCallback&&p.completionCallback(p));p.update()?setTimeout(f,p.animationFrequency):p.completionCallback&&p.completionCallback(p)};setTimeout(f,this.animationFrequency)}},n.prototype.update=function(){var t=new i(this.wwd.navigator.lookAtLocation.latitude,this.wwd.navigator.lookAtLocation.longitude,this.wwd.navigator.range),e=this.updateRange(t);return e=this.updateLocation(t)||e,this.wwd.redraw(),e},n.prototype.updateRange=function(t){var e,i,r=!1;return this.maxAltitudeReachedTime?(i=Date.now()-this.maxAltitudeReachedTime,this.maxAltitude>this.targetPosition.altitude?(e=this.maxAltitude-this.rangeVelocity*i,e=Math.max(e,this.targetPosition.altitude)):(e=this.maxAltitude+this.rangeVelocity*i,e=Math.min(e,this.targetPosition.altitude)),this.wwd.navigator.range=e,r=Math.abs(this.wwd.navigator.range-this.targetPosition.altitude)>1):(i=Date.now()-this.startTime,e=Math.min(this.startPosition.altitude+this.rangeVelocity*i,this.maxAltitude),Math.abs(this.wwd.navigator.range-e)<1&&(this.maxAltitudeReachedTime=Date.now()),this.wwd.navigator.range=e,r=!0),r},n.prototype.updateLocation=function(e){var i=Date.now()-this.startTime,r=t.greatCircleDistance(this.startPosition,e),n=t.greatCircleDistance(e,this.targetPosition),o=t.greatCircleAzimuth(e,this.targetPosition),s=this.panVelocity*i,a=Math.min(s-r,n),l=t.greatCircleLocation(e,o,a,new t(0,0)),h=!1;return this.wwd.navigator.lookAtLocation.latitude=l.latitude,this.wwd.navigator.lookAtLocation.longitude=l.longitude,a<1/this.wwd.globe.equatorialRadius&&(h=!0),!h},n}),i("util/HighlightController",["../error/ArgumentError","../util/Logger"],function(t,e){"use strict";return function(i){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"HighlightController","constructor","missingWorldWindow"));this.worldWindow=i;var r=[],n=function(t){for(var e=t.clientX,n=t.clientY,o=r.length>0,s=0;s<r.length;s++)r[s].highlighted=!1;r=[];var a=i.pick(i.canvasCoordinates(e,n));if(a.objects.length>0&&(o=!0),a.objects.length>0)for(var l=0;l<a.objects.length;l++)a.objects[l].isTerrain||(a.objects[l].userObject.highlighted=!0,r.push(a.objects[l].userObject));o&&i.redraw()};this.worldWindow.addEventListener("mousemove",n);new WorldWind.TapRecognizer(this.worldWindow,n)}}),i("formats/kml/KmlElements",[],function(){"use strict";return{keys:{},addKey:function(t,e){this.keys[t]=e},getKey:function(t){return this.keys[t]}}}),i("formats/kml/util/Attribute",[],function(){"use strict";var t=function(t,e){this.node=t,this.name=e};return t.prototype.value=function(){return this.node.attributes&&this.node.attributes.getNamedItem(this.name)&&this.node.attributes.getNamedItem(this.name).value||null},t.prototype.exists=function(){return null!=this.value()},t.prototype.save=function(t){this.node.setAttribute(this.name,t)},t}),i("formats/kml/util/NodeTransformers",["./Attribute","../KmlElements","../../../geom/Position","../../../util/WWUtil"],function(t,e,i,r){function n(t){var e;return null!=t&&t.childNodes[0]?e=t.childNodes[0].nodeValue:null!=t&&(e=""),e}var o=function(){};return o.string=function(t){return String(n(t))},o.number=function(t){return Number(n(t))},o.boolean=function(t){return r.transformToBoolean(n(t))},o.date=function(t){return r.date(n(t))},o.kmlObject=function(t,i,r){var n=t.nodeName,o=e.getKey(n);return o?new o({objectNode:t,parent:i,controls:r}):null},o.linearRing=function(t,i,r){var n=e.getKey("LinearRing");if(!n)return null;var o=null;return Array.prototype.forEach.call(t.childNodes,function(t){t.nodeName.toUpperCase()=="LinearRing".toUpperCase()&&(o=t)}),new n({objectNode:o,parent:i,controls:r})},o.positions=function(t){var e=[];return n(t).trim().replace(/\s+/g," ").split(" ").forEach(function(t){t=t.split(","),e.push(new i(Number(t[1]),Number(t[0]),Number(t[2]||0)))}),e},o.attribute=function(e){return function(i){return new t(i,e).value()}},o}),i("formats/kml/util/KmlElementsFactory",["./NodeTransformers"],function(t){"use strict";var e=function(t){this.options=t||{},this.options.controls=this.options.controls||[]};e.prototype.specific=function(t,e){var i=t.node,r=null,n=this;return[].forEach.call(i.childNodes,function(i){i.nodeName==e.name&&(r=e.transformer(i,t,n.options.controls))}),r},e.prototype.any=function(e,i){var r=e.node,n=null,o=this;return[].forEach.call(r.childNodes,function(r){-1!=i.name.indexOf(r.nodeName)&&(n=t.kmlObject(r,e,o.options.controls))}),n},e.prototype.all=function(e){var i=e.node,r=[],n=this;return[].forEach.call(i.childNodes,function(i){var o=t.kmlObject(i,e,n.options.controls);o&&r.push(o)}),r};var i=new e;return e.applicationWide=function(){return i},e}),i("formats/kml/util/TreeKeyValueCache",["../../../util/WWUtil"],function(t){"use strict";var e=function(){this.map={}};e.prototype.add=function(t,e,i){this.map[t]||(this.map[t]={}),this.map[t][e]=i},e.prototype.value=function(e,i){if(!this.map[e])return null;if(-1==i.indexOf("#")){var r=this.level(e);for(var n in r)if(r.hasOwnProperty(n)&&t.startsWith(n,i))return r[n]}return this.map[e][i]||null},e.prototype.level=function(t){return this.map[t]},e.prototype.remove=function(t,e){delete this.map[t][e]};var i=new e;return e.applicationLevelCache=function(){return i},e}),i("formats/kml/util/KmlElementsFactoryCached",["./Attribute","./KmlElementsFactory","./TreeKeyValueCache","../../../util/WWUtil"],function(t,e,i,r){"use strict";var n=function(t){this.internalFactory=new e(t),this.cache=i.applicationLevelCache()};n.prototype.all=function(t){var e=t.node,i=this.cache.level(this.cacheKey(t.node,"All"));if(i){var r=[];for(var n in i)i.hasOwnProperty(n)&&r.push(i[n]);return r}var o=this.internalFactory.all(t);if(o&&o.length){var s=this;o.forEach(function(t){s.cache.add(s.cacheKey(e,"All"),s.cacheKey(t.node),t)})}return o},n.prototype.specific=function(t,e){var i=t.node,r=e.name;e.attribute&&(r=e.attribute+r);var n=this.cache.value(this.cacheKey(i),r);if(n)return n;var o=this.internalFactory.specific(t,e);return o&&o.node?this.cache.add(this.cacheKey(i),this.cacheKey(o.node),o):o&&this.cache.add(this.cacheKey(i),r,o),o},n.prototype.any=function(t,e){var i,r=t.node,n=this,o=null;if(e.name.forEach(function(t){(i=n.cache.value(n.cacheKey(r),t))&&(o=i)}),o)return o;var s=this.internalFactory.any(t,e);return s&&this.cache.add(n.cacheKey(r),n.cacheKey(s.node),s),s},n.prototype.cacheKey=function(e,i){var n=new t(e,"id");n.exists()||n.save(r.guid());var o=e.nodeName+"#"+n.value();return i&&(o=i+o),o};var o=new n;return n.applicationWide=function(){return o},n}),function(){"use strict";function t(t){return"function"==typeof t||"object"==typeof t&&null!==t}function r(t){return"function"==typeof t}function n(t){return"object"==typeof t&&null!==t}function o(t){G=t}function s(t){K=t}function a(){return function(){F(h)}}function l(){return function(){setTimeout(h,1)}}function h(){for(var t=0;t<U;t+=2){(0,X[t])(X[t+1]),X[t]=void 0,X[t+1]=void 0}U=0}function u(){}function c(){return new TypeError("You cannot resolve a promise with itself")}function d(){return new TypeError("A promises callback cannot return that same promise.")}function p(t){try{return t.then}catch(t){return $.error=t,$}}function f(t,e,i,r){try{t.call(e,i,r)}catch(t){return t}}function g(t,e,i){K(function(t){var r=!1,n=f(i,e,function(i){r||(r=!0,e!==i?y(t,i):v(t,i))},function(e){r||(r=!0,S(t,e))},"Settle: "+(t._label||" unknown promise"));!r&&n&&(r=!0,S(t,n))},t)}function m(t,e){e._state===Z?v(t,e._result):e._state===Q?S(t,e._result):b(e,void 0,function(e){y(t,e)},function(e){S(t,e)})}function E(t,e){if(e.constructor===t.constructor)m(t,e);else{var i=p(e);i===$?S(t,$.error):void 0===i?v(t,e):r(i)?g(t,e,i):v(t,e)}}function y(e,i){e===i?S(e,c()):t(i)?E(e,i):v(e,i)}function _(t){t._onerror&&t._onerror(t._result),T(t)}function v(t,e){t._state===J&&(t._result=e,t._state=Z,0!==t._subscribers.length&&K(T,t))}function S(t,e){t._state===J&&(t._state=Q,t._result=e,K(_,t))}function b(t,e,i,r){var n=t._subscribers,o=n.length;t._onerror=null,n[o]=e,n[o+Z]=i,n[o+Q]=r,0===o&&t._state&&K(T,t)}function T(t){var e=t._subscribers,i=t._state;if(0!==e.length){for(var r,n,o=t._result,s=0;s<e.length;s+=3)r=e[s],n=e[s+i],r?R(i,r,n,o):n(o);t._subscribers.length=0}}function L(){this.error=null}function w(t,e){try{return t(e)}catch(t){return tt.error=t,tt}}function R(t,e,i,n){var o,s,a,l,h=r(i);if(h){if(o=w(i,n),o===tt?(l=!0,s=o.error,o=null):a=!0,e===o)return void S(e,d())}else o=n,a=!0;e._state!==J||(h&&a?y(e,o):l?S(e,s):t===Z?v(e,o):t===Q&&S(e,o))}function x(t,e){try{e(function(e){y(t,e)},function(e){S(t,e)})}catch(e){S(t,e)}}function M(t,e){var i=this;i._instanceConstructor=t,i.promise=new t(u),i._validateInput(e)?(i._input=e,i.length=e.length,i._remaining=e.length,i._init(),0===i.length?v(i.promise,i._result):(i.length=i.length||0,i._enumerate(),0===i._remaining&&v(i.promise,i._result))):S(i.promise,i._validationError())}function C(t){return new et(this,t).promise}function A(t){function e(t){y(n,t)}function i(t){S(n,t)}var r=this,n=new r(u);if(!B(t))return S(n,new TypeError("You must pass an array to race.")),n;for(var o=t.length,s=0;n._state===J&&s<o;s++)b(r.resolve(t[s]),void 0,e,i);return n}function P(t){var e=this;if(t&&"object"==typeof t&&t.constructor===e)return t;var i=new e(u);return y(i,t),i}function I(t){var e=this,i=new e(u);return S(i,t),i}function O(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function N(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function D(t){this._id=st++,this._state=void 0,this._result=void 0,this._subscribers=[],u!==t&&(r(t)||O(),this instanceof D||N(),x(this,t))}function k(){var t;if(void 0!==ut)t=ut;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(t){throw new Error("polyfill failed because global object is unavailable in this environment")}var e=t.Promise;e&&"[object Promise]"===Object.prototype.toString.call(e.resolve())&&!e.cast||(t.Promise=at)}var V;V=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)};var F,G,W,B=V,U=0,K=function(t,e){X[U]=t,X[U+1]=e,2===(U+=2)&&(G?G(h):W())},j="undefined"!=typeof window?window:void 0,z=j||{},q=z.MutationObserver||z.WebKitMutationObserver,Y="undefined"!=typeof process&&"[object process]"==={}.toString.call(process),H="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,X=new Array(1e3);W=Y?function(){return function(){process.nextTick(h)}}():q?function(){var t=0,e=new q(h),i=document.createTextNode("");return e.observe(i,{characterData:!0}),function(){i.data=t=++t%2}}():H?function(){var t=new MessageChannel;return t.port1.onmessage=h,function(){t.port2.postMessage(0)}}():void 0===j&&"function"==typeof e?function(){try{var t=e,i=t("vertx");return F=i.runOnLoop||i.runOnContext,a()}catch(t){return l()}}():l();var J=void 0,Z=1,Q=2,$=new L,tt=new L;M.prototype._validateInput=function(t){return B(t)},M.prototype._validationError=function(){return new Error("Array Methods must be provided an Array")},M.prototype._init=function(){this._result=new Array(this.length)};var et=M;M.prototype._enumerate=function(){for(var t=this,e=t.length,i=t.promise,r=t._input,n=0;i._state===J&&n<e;n++)t._eachEntry(r[n],n)},M.prototype._eachEntry=function(t,e){var i=this,r=i._instanceConstructor;n(t)?t.constructor===r&&t._state!==J?(t._onerror=null,i._settledAt(t._state,e,t._result)):i._willSettleAt(r.resolve(t),e):(i._remaining--,i._result[e]=t)},M.prototype._settledAt=function(t,e,i){var r=this,n=r.promise;n._state===J&&(r._remaining--,t===Q?S(n,i):r._result[e]=i),0===r._remaining&&v(n,r._result)},M.prototype._willSettleAt=function(t,e){var i=this;b(t,void 0,function(t){i._settledAt(Z,e,t)},function(t){i._settledAt(Q,e,t)})};var it=C,rt=A,nt=P,ot=I,st=0,at=D;D.all=it,D.race=rt,D.resolve=nt,D.reject=ot,D._setScheduler=o,D._setAsap=s,D._asap=K,D.prototype={constructor:D,then:function(t,e){var i=this,r=i._state;if(r===Z&&!t||r===Q&&!e)return this;var n=new this.constructor(u),o=i._result;if(r){var s=arguments[r-1];K(function(){R(r,n,s,o)})}else b(i,n,t,e);return n},catch:function(t){return this.then(null,t)}};var lt=k,ht={Promise:at,polyfill:lt};"function"==typeof i&&i.amd?i("util/es6-promise",[],function(){return ht}):"undefined"!=typeof module&&module.exports?module.exports=ht:void 0!==this&&(this.ES6Promise=ht);var ut={};lt()}.call(this),i("util/Promise",["./es6-promise"],function(t){"use strict";return window.Promise?window.Promise:t.Promise}),i("formats/kml/KmlObject",["../../error/ArgumentError","./util/Attribute","./KmlElements","./util/KmlElementsFactoryCached","../../util/Logger","../../util/Promise","../../render/Renderable"],function(t,e,i,r,n,o,s){"use strict";var a=function(e){if(s.call(this),e=e||{},!e.objectNode)throw new t(n.logMessage(n.LEVEL_SEVERE,"KmlObject","constructor","Passed node isn't defined."));this._node=e.objectNode,this._cache={},this._controls=e.controls||[],this._factory=new r({controls:this._controls}),this.hook(this._controls,e)};return a.prototype=Object.create(s.prototype),Object.defineProperties(a.prototype,{id:{get:function(){return new e(this.node,"id").value()}},node:{get:function(){return this._node}}}),a.prototype.hook=function(t,e){var i=this;t.forEach(function(t){t.hook(i,e)})},a.prototype.render=function(t){},a.prototype.getTagNames=function(){return[]},a}),i("formats/kml/util/ImagePyramid",["../KmlElements","../KmlObject","../util/NodeTransformers"],function(t,e,i){"use strict";var r=function(t){e.call(this,t)};return r.prototype=Object.create(e.prototype),Object.defineProperties(r.prototype,{
kmlTileSize:{get:function(){return this._factory.specific(this,{name:"tileSize",transformer:i.number})}},kmlMaxWidth:{get:function(){return this._factory.specific(this,{name:"maxWidth",transformer:i.number})}},kmlMaxHeight:{get:function(){return this._factory.specific(this,{name:"maxHeight",transformer:i.number})}},kmlGridOrigin:{get:function(){return this._factory.specific(this,{name:"gridOrigin",transformer:i.string})}}}),r.prototype.getTagNames=function(){return["ImagePyramid"]},t.addKey(r.prototype.getTagNames()[0],r),r}),i("formats/kml/util/ItemIcon",["./../KmlElements","../KmlObject","./NodeTransformers"],function(t,e,i){"use strict";var r=function(t){e.call(this,t)};return r.prototype=Object.create(e.prototype),Object.defineProperties(r.prototype,{kmlState:{get:function(){return this._factory.specific(this,{name:"state",transformer:i.string})}},kmlHref:{get:function(){return this._factory.specific(this,{name:"href",transformer:i.string})}}}),r.prototype.getTagNames=function(){return["ItemIcon"]},t.addKey(r.prototype.getTagNames()[0],r),r}),i("formats/kml/KmlTimePrimitive",["./KmlObject"],function(t){"use strict";var e=function(e){t.call(this,e)};return e.prototype=Object.create(t.prototype),e.prototype.timeRange=function(){var t,e;return this.kmlBegin&&(e=t=this.kmlBegin.valueOf()),this.kmlEnd&&(e=this.kmlEnd.valueOf(),t||(t=e)),this.kmlWhen&&(e=t=this.kmlWhen.valueOf()),{from:t,to:e}},e.prototype.getTagNames=function(){return["TimeSpan","TimeStamp"]},e}),i("formats/kml/KmlAbstractView",["./KmlObject","./KmlElements","./KmlTimePrimitive"],function(t,e,i){"use strict";var r=function(e){t.call(this,e)};return r.prototype=Object.create(t.prototype),Object.defineProperties(r.prototype,{kmlTimePrimitive:{get:function(){return this._factory.any(this,{name:i.prototype.getTagNames()})}}}),r.prototype.getTagNames=function(){return["Camera","LookAt"]},r}),i("formats/kml/styles/KmlSubStyle",["./../KmlObject"],function(t){"use strict";var e=function(e){t.call(this,e)};return e.prototype=Object.create(t.prototype),e.prototype.getTagNames=function(){return["LineStyle","PolyStyle","IconStyle","LabelStyle","BalloonStyle","ListStyle"]},e}),i("formats/kml/styles/KmlBalloonStyle",["../KmlElements","./KmlSubStyle","../util/NodeTransformers"],function(t,e,i){"use strict";var r=function(t){e.call(this,t)};return r.prototype=Object.create(e.prototype),Object.defineProperties(r.prototype,{kmlBgColor:{get:function(){return this._factory.specific(this,{name:"bgColor",transformer:i.string})}},kmlTextColor:{get:function(){return this._factory.specific(this,{name:"textColor",transformer:i.string})}},kmlText:{get:function(){return this._factory.specific(this,{name:"text",transformer:i.string})}},kmlDisplayMode:{get:function(){return this._factory.specific(this,{name:"displayMode",transformer:i.string})}}}),r.update=function(){},r.prototype.getTagNames=function(){return["BalloonStyle"]},t.addKey(r.prototype.getTagNames()[0],r),r}),i("formats/kml/KmlCamera",["./KmlElements","./KmlAbstractView","./util/NodeTransformers"],function(t,e,i){"use strict";var r=function(t){e.call(this,t)};return r.prototype=Object.create(e.prototype),Object.defineProperties(r.prototype,{kmlLongitude:{get:function(){return this._factory.specific(this,{name:"longitude",transformer:i.string})}},kmlLatitude:{get:function(){return this._factory.specific(this,{name:"latitude",transformer:i.string})}},kmlAltitude:{get:function(){return this._factory.specific(this,{name:"altitude",transformer:i.string})}},kmlHeading:{get:function(){return this._factory.specific(this,{name:"heading",transformer:i.string})}},kmlTilt:{get:function(){return this._factory.specific(this,{name:"tilt",transformer:i.string})}},kmlRoll:{get:function(){return this._factory.specific(this,{name:"roll",transformer:i.string})}},kmlAltitudeMode:{get:function(){return this._factory.specific(this,{name:"altitudeMode",transformer:i.string})}}}),r.prototype.getTagNames=function(){return["Camera"]},t.addKey(r.prototype.getTagNames()[0],r),r}),i("formats/kml/styles/KmlColorStyle",["./KmlSubStyle","../util/NodeTransformers"],function(t,e){"use strict";var i=function(e){t.call(this,e)};return i.prototype=Object.create(t.prototype),Object.defineProperties(i.prototype,{kmlColor:{get:function(){return this._factory.specific(this,{name:"color",transformer:e.string})}},kmlColorMode:{get:function(){return this._factory.specific(this,{name:"colorMode",transformer:e.string})}}}),i.prototype.getTagNames=function(){return["LineStyle","PolyStyle","IconStyle","LabelStyle"]},i}),i("util/jszip",[],function(){return function(t){function e(r){if(i[r])return i[r].exports;var n=i[r]={i:r,l:!1,exports:{}};return t[r].call(n.exports,n,n.exports,e),n.l=!0,n.exports}var i={};return e.m=t,e.c=i,e.d=function(t,i,r){e.o(t,i)||Object.defineProperty(t,i,{configurable:!1,enumerable:!0,get:r})},e.n=function(t){var i=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(i,"a",i),i},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=22)}([function(t,e,i){function r(t){return t}function n(t,e){for(var i=0;i<t.length;++i)e[i]=255&t.charCodeAt(i);return e}function o(t){var i=65536,r=[],n=t.length,o=e.getTypeOf(t),s=0,a=!0;try{switch(o){case"uint8array":String.fromCharCode.apply(null,new Uint8Array(0));break;case"nodebuffer":String.fromCharCode.apply(null,h(0))}}catch(t){a=!1}if(!a){for(var l="",u=0;u<t.length;u++)l+=String.fromCharCode(t[u]);return l}for(;s<n&&i>1;)try{"array"===o||"nodebuffer"===o?r.push(String.fromCharCode.apply(null,t.slice(s,Math.min(s+i,n)))):r.push(String.fromCharCode.apply(null,t.subarray(s,Math.min(s+i,n)))),s+=i}catch(t){i=Math.floor(i/2)}return r.join("")}function s(t,e){for(var i=0;i<t.length;i++)e[i]=t[i];return e}var a=i(2),l=i(5),h=i(7);e.string2binary=function(t){for(var e="",i=0;i<t.length;i++)e+=String.fromCharCode(255&t.charCodeAt(i));return e},e.arrayBuffer2Blob=function(t,i){e.checkSupport("blob"),i=i||"application/zip";try{return new Blob([t],{type:i})}catch(e){try{var r=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder,n=new r;return n.append(t),n.getBlob(i)}catch(t){throw new Error("Bug : can't construct the Blob.")}}},e.applyFromCharCode=o;var u={};u.string={string:r,array:function(t){return n(t,new Array(t.length))},arraybuffer:function(t){return u.string.uint8array(t).buffer},uint8array:function(t){return n(t,new Uint8Array(t.length))},nodebuffer:function(t){return n(t,h(t.length))}},u.array={string:o,array:r,arraybuffer:function(t){return new Uint8Array(t).buffer},uint8array:function(t){return new Uint8Array(t)},nodebuffer:function(t){return h(t)}},u.arraybuffer={string:function(t){return o(new Uint8Array(t))},array:function(t){return s(new Uint8Array(t),new Array(t.byteLength))},arraybuffer:r,uint8array:function(t){return new Uint8Array(t)},nodebuffer:function(t){return h(new Uint8Array(t))}},u.uint8array={string:o,array:function(t){return s(t,new Array(t.length))},arraybuffer:function(t){return t.buffer},uint8array:r,nodebuffer:function(t){return h(t)}},u.nodebuffer={string:o,array:function(t){return s(t,new Array(t.length))},arraybuffer:function(t){return u.nodebuffer.uint8array(t).buffer},uint8array:function(t){return s(t,new Uint8Array(t.length))},nodebuffer:r},e.transformTo=function(t,i){if(i||(i=""),!t)return i;e.checkSupport(t);var r=e.getTypeOf(i);return u[r][t](i)},e.getTypeOf=function(t){return"string"==typeof t?"string":"[object Array]"===Object.prototype.toString.call(t)?"array":a.nodebuffer&&h.test(t)?"nodebuffer":a.uint8array&&t instanceof Uint8Array?"uint8array":a.arraybuffer&&t instanceof ArrayBuffer?"arraybuffer":void 0},e.checkSupport=function(t){if(!a[t.toLowerCase()])throw new Error(t+" is not supported by this browser")},e.MAX_VALUE_16BITS=65535,e.MAX_VALUE_32BITS=-1,e.pretty=function(t){var e,i,r="";for(i=0;i<(t||"").length;i++)e=t.charCodeAt(i),r+="\\x"+(e<16?"0":"")+e.toString(16).toUpperCase();return r},e.findCompression=function(t){for(var e in l)if(l.hasOwnProperty(e)&&l[e].magic===t)return l[e];return null},e.isRegExp=function(t){return"[object RegExp]"===Object.prototype.toString.call(t)},e.extend=function(){var t,e,i={};for(t=0;t<arguments.length;t++)for(e in arguments[t])arguments[t].hasOwnProperty(e)&&void 0===i[e]&&(i[e]=arguments[t][e]);return i}},function(t,e,i){var r="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;e.assign=function(t){for(var e=Array.prototype.slice.call(arguments,1);e.length;){var i=e.shift();if(i){if("object"!=typeof i)throw new TypeError(i+"must be non-object");for(var r in i)i.hasOwnProperty(r)&&(t[r]=i[r])}}return t},e.shrinkBuf=function(t,e){return t.length===e?t:t.subarray?t.subarray(0,e):(t.length=e,t)};var n={arraySet:function(t,e,i,r,n){if(e.subarray&&t.subarray)return void t.set(e.subarray(i,i+r),n);for(var o=0;o<r;o++)t[n+o]=e[i+o]},flattenChunks:function(t){var e,i,r,n,o,s;for(r=0,e=0,i=t.length;e<i;e++)r+=t[e].length;for(s=new Uint8Array(r),n=0,e=0,i=t.length;e<i;e++)o=t[e],s.set(o,n),n+=o.length;return s}},o={arraySet:function(t,e,i,r,n){for(var o=0;o<r;o++)t[n+o]=e[i+o]},flattenChunks:function(t){return[].concat.apply([],t)}};e.setTyped=function(t){t?(e.Buf8=Uint8Array,e.Buf16=Uint16Array,e.Buf32=Int32Array,e.assign(e,n)):(e.Buf8=Array,e.Buf16=Array,e.Buf32=Array,e.assign(e,o))},e.setTyped(r)},function(t,e,i){(function(t){if(e.base64=!0,e.array=!0,e.string=!0,e.arraybuffer="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array,e.nodebuffer=void 0!==t,e.uint8array="undefined"!=typeof Uint8Array,"undefined"==typeof ArrayBuffer)e.blob=!1;else{var i=new ArrayBuffer(0);try{e.blob=0===new Blob([i],{type:"application/zip"}).size}catch(t){try{var r=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder,n=new r;n.append(i),e.blob=0===n.getBlob("application/zip").size}catch(t){e.blob=!1}}}}).call(e,i(8).Buffer)},function(t,e,i){var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";e.encode=function(t,e){for(var i,n,o,s,a,l,h,u="",c=0;c<t.length;)i=t.charCodeAt(c++),n=t.charCodeAt(c++),o=t.charCodeAt(c++),s=i>>2,a=(3&i)<<4|n>>4,l=(15&n)<<2|o>>6,h=63&o,isNaN(n)?l=h=64:isNaN(o)&&(h=64),u=u+r.charAt(s)+r.charAt(a)+r.charAt(l)+r.charAt(h);return u},e.decode=function(t,e){var i,n,o,s,a,l,h,u="",c=0;for(t=t.replace(/[^A-Za-z0-9\+\/\=]/g,"");c<t.length;)s=r.indexOf(t.charAt(c++)),a=r.indexOf(t.charAt(c++)),l=r.indexOf(t.charAt(c++)),h=r.indexOf(t.charAt(c++)),i=s<<2|a>>4,n=(15&a)<<4|l>>2,o=(3&l)<<6|h,u+=String.fromCharCode(i),64!=l&&(u+=String.fromCharCode(n)),64!=h&&(u+=String.fromCharCode(o));return u}},function(t,e,i){var r=i(2),n=i(0),o=i(37),s=i(14),a=i(15),l=i(3),h=i(5),u=i(16),c=i(7),d=i(17),p=i(38),f=i(39),g=function(t){if(t._data instanceof u&&(t._data=t._data.getContent(),t.options.binary=!0,t.options.base64=!1,"uint8array"===n.getTypeOf(t._data))){var e=t._data;t._data=new Uint8Array(e.length),0!==e.length&&t._data.set(e,0)}return t._data},m=function(t){var e=g(t);return"string"===n.getTypeOf(e)?!t.options.binary&&r.nodebuffer?c(e,"utf-8"):t.asBinary():e},E=function(t){var e=g(this);return null===e||void 0===e?"":(this.options.base64&&(e=l.decode(e)),e=t&&this.options.binary?C.utf8decode(e):n.transformTo("string",e),t||this.options.binary||(e=n.transformTo("string",C.utf8encode(e))),e)},y=function(t,e,i){this.name=t,this.dir=i.dir,this.date=i.date,this.comment=i.comment,this.unixPermissions=i.unixPermissions,this.dosPermissions=i.dosPermissions,this._data=e,this.options=i,this._initialMetadata={dir:i.dir,date:i.date}};y.prototype={asText:function(){return E.call(this,!0)},asBinary:function(){return E.call(this,!1)},asNodeBuffer:function(){var t=m(this);return n.transformTo("nodebuffer",t)},asUint8Array:function(){var t=m(this);return n.transformTo("uint8array",t)},asArrayBuffer:function(){return this.asUint8Array().buffer}};var _=function(t,e){var i,r="";for(i=0;i<e;i++)r+=String.fromCharCode(255&t),t>>>=8;return r},v=function(t){return t=t||{},!0!==t.base64||null!==t.binary&&void 0!==t.binary||(t.binary=!0),t=n.extend(t,a),t.date=t.date||new Date,null!==t.compression&&(t.compression=t.compression.toUpperCase()),t},S=function(t,e,i){var r,o=n.getTypeOf(e);if(i=v(i),"string"==typeof i.unixPermissions&&(i.unixPermissions=parseInt(i.unixPermissions,8)),i.unixPermissions&&16384&i.unixPermissions&&(i.dir=!0),i.dosPermissions&&16&i.dosPermissions&&(i.dir=!0),i.dir&&(t=T(t)),i.createFolders&&(r=b(t))&&L.call(this,r,!0),i.dir||null===e||void 0===e)i.base64=!1,i.binary=!1,e=null,o=null;else if("string"===o)i.binary&&!i.base64&&!0!==i.optimizedBinaryString&&(e=n.string2binary(e));else{if(i.base64=!1,i.binary=!0,!(o||e instanceof u))throw new Error("The data of '"+t+"' is in an unsupported format !");"arraybuffer"===o&&(e=n.transformTo("uint8array",e))}var s=new y(t,e,i);return this.files[t]=s,s},b=function(t){"/"==t.slice(-1)&&(t=t.substring(0,t.length-1));var e=t.lastIndexOf("/");return e>0?t.substring(0,e):""},T=function(t){return"/"!=t.slice(-1)&&(t+="/"),t},L=function(t,e){return e=void 0!==e&&e,t=T(t),this.files[t]||S.call(this,t,null,{dir:!0,createFolders:e}),this.files[t]},w=function(t,e,i){var r,s=new u;return t._data instanceof u?(s.uncompressedSize=t._data.uncompressedSize,s.crc32=t._data.crc32,0===s.uncompressedSize||t.dir?(e=h.STORE,s.compressedContent="",s.crc32=0):t._data.compressionMethod===e.magic?s.compressedContent=t._data.getCompressedContent():(r=t._data.getContent(),s.compressedContent=e.compress(n.transformTo(e.compressInputType,r),i))):(r=m(t),r&&0!==r.length&&!t.dir||(e=h.STORE,r=""),s.uncompressedSize=r.length,s.crc32=o(r),s.compressedContent=e.compress(n.transformTo(e.compressInputType,r),i)),s.compressedSize=s.compressedContent.length,s.compressionMethod=e.magic,s},R=function(t,e){var i=t;return t||(i=e?16893:33204),(65535&i)<<16},x=function(t,e){return 63&(t||0)},M=function(t,e,i,r,a,l){var h,u,c,p,f=(i.compressedContent,l!==d.utf8encode),g=n.transformTo("string",l(e.name)),m=n.transformTo("string",d.utf8encode(e.name)),E=e.comment||"",y=n.transformTo("string",l(E)),v=n.transformTo("string",d.utf8encode(E)),S=m.length!==e.name.length,b=v.length!==E.length,T=e.options,L="",w="",M="";c=e._initialMetadata.dir!==e.dir?e.dir:T.dir,p=e._initialMetadata.date!==e.date?e.date:T.date;var C=0,A=0;c&&(C|=16),"UNIX"===a?(A=798,C|=R(e.unixPermissions,c)):(A=20,C|=x(e.dosPermissions)),h=p.getHours(),h<<=6,h|=p.getMinutes(),h<<=5,h|=p.getSeconds()/2,u=p.getFullYear()-1980,u<<=4,u|=p.getMonth()+1,u<<=5,u|=p.getDate(),S&&(w=_(1,1)+_(o(g),4)+m,L+="up"+_(w.length,2)+w),b&&(M=_(1,1)+_(this.crc32(y),4)+v,L+="uc"+_(M.length,2)+M);var P="";return P+="\n\0",P+=f||!S&&!b?"\0\0":"\0\b",P+=i.compressionMethod,P+=_(h,2),P+=_(u,2),P+=_(i.crc32,4),P+=_(i.compressedSize,4),P+=_(i.uncompressedSize,4),P+=_(g.length,2),P+=_(L.length,2),{fileRecord:s.LOCAL_FILE_HEADER+P+g+L,dirRecord:s.CENTRAL_FILE_HEADER+_(A,2)+P+_(y.length,2)+"\0\0\0\0"+_(C,4)+_(r,4)+g+L+y,compressedObject:i}},C={load:function(t,e){throw new Error("Load method is not defined. Is the file jszip-load.js included ?")},filter:function(t){var e,i,r,o,s=[];for(e in this.files)this.files.hasOwnProperty(e)&&(r=this.files[e],o=new y(r.name,r._data,n.extend(r.options)),i=e.slice(this.root.length,e.length),e.slice(0,this.root.length)===this.root&&t(i,o)&&s.push(o));return s},file:function(t,e,i){if(1===arguments.length){if(n.isRegExp(t)){var r=t;return this.filter(function(t,e){return!e.dir&&r.test(t)})}return this.filter(function(e,i){return!i.dir&&e===t})[0]||null}return t=this.root+t,S.call(this,t,e,i),this},folder:function(t){if(!t)return this;if(n.isRegExp(t))return this.filter(function(e,i){return i.dir&&t.test(e)});var e=this.root+t,i=L.call(this,e),r=this.clone();return r.root=i.name,r},remove:function(t){t=this.root+t;var e=this.files[t];if(e||("/"!=t.slice(-1)&&(t+="/"),e=this.files[t]),e&&!e.dir)delete this.files[t];else for(var i=this.filter(function(e,i){return i.name.slice(0,t.length)===t}),r=0;r<i.length;r++)delete this.files[i[r].name];return this},generate:function(t){t=n.extend(t||{},{base64:!0,compression:"STORE",compressionOptions:null,type:"base64",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:d.utf8encode}),n.checkSupport(t.type),"darwin"!==t.platform&&"freebsd"!==t.platform&&"linux"!==t.platform&&"sunos"!==t.platform||(t.platform="UNIX"),"win32"===t.platform&&(t.platform="DOS");var e,i,r=[],o=0,a=0,u=n.transformTo("string",t.encodeFileName(t.comment||this.comment||""));for(var c in this.files)if(this.files.hasOwnProperty(c)){var g=this.files[c],m=g.options.compression||t.compression.toUpperCase(),E=h[m];if(!E)throw new Error(m+" is not a valid compression method !");var y=g.options.compressionOptions||t.compressionOptions||{},v=w.call(this,g,E,y),S=M.call(this,c,g,v,o,t.platform,t.encodeFileName);o+=S.fileRecord.length+v.compressedSize,a+=S.dirRecord.length,r.push(S)}var b="";b=s.CENTRAL_DIRECTORY_END+"\0\0\0\0"+_(r.length,2)+_(r.length,2)+_(a,4)+_(o,4)+_(u.length,2)+u;var T=t.type.toLowerCase();for(e="uint8array"===T||"arraybuffer"===T||"blob"===T||"nodebuffer"===T?new f(o+a+b.length):new p(o+a+b.length),i=0;i<r.length;i++)e.append(r[i].fileRecord),e.append(r[i].compressedObject.compressedContent);for(i=0;i<r.length;i++)e.append(r[i].dirRecord);e.append(b);var L=e.finalize();switch(t.type.toLowerCase()){case"uint8array":case"arraybuffer":case"nodebuffer":return n.transformTo(t.type.toLowerCase(),L);case"blob":return n.arrayBuffer2Blob(n.transformTo("arraybuffer",L),t.mimeType);case"base64":return t.base64?l.encode(L):L;default:return L}},crc32:function(t,e){return o(t,e)},utf8encode:function(t){return n.transformTo("string",d.utf8encode(t))},utf8decode:function(t){return d.utf8decode(t)}};t.exports=C},function(t,e,i){e.STORE={magic:"\0\0",compress:function(t,e){return t},uncompress:function(t){return t},compressInputType:null,uncompressInputType:null},e.DEFLATE=i(27)},function(t,e,i){t.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},function(t,e,i){(function(e){t.exports=function(t,i){return new e(t,i)},t.exports.test=function(t){return e.isBuffer(t)}}).call(e,i(8).Buffer)},function(t,e,i){(function(t){function r(){return o.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function n(t,e){if(r()<e)throw new RangeError("Invalid typed array length");return o.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e),t.__proto__=o.prototype):(null===t&&(t=new o(e)),t.length=e),t}function o(t,e,i){if(!(o.TYPED_ARRAY_SUPPORT||this instanceof o))return new o(t,e,i);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return h(this,t)}return s(this,t,e,i)}function s(t,e,i,r){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?d(t,e,i,r):"string"==typeof e?u(t,e,i):p(t,e)}function a(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function l(t,e,i,r){return a(e),e<=0?n(t,e):void 0!==i?"string"==typeof r?n(t,e).fill(i,r):n(t,e).fill(i):n(t,e)}function h(t,e){if(a(e),t=n(t,e<0?0:0|f(e)),!o.TYPED_ARRAY_SUPPORT)for(var i=0;i<e;++i)t[i]=0;return t}function u(t,e,i){if("string"==typeof i&&""!==i||(i="utf8"),!o.isEncoding(i))throw new TypeError('"encoding" must be a valid string encoding');var r=0|m(e,i);t=n(t,r);var s=t.write(e,i);return s!==r&&(t=t.slice(0,s)),t}function c(t,e){var i=e.length<0?0:0|f(e.length);t=n(t,i);for(var r=0;r<i;r+=1)t[r]=255&e[r];return t}function d(t,e,i,r){if(e.byteLength,i<0||e.byteLength<i)throw new RangeError("'offset' is out of bounds");if(e.byteLength<i+(r||0))throw new RangeError("'length' is out of bounds");return e=void 0===i&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,i):new Uint8Array(e,i,r),o.TYPED_ARRAY_SUPPORT?(t=e,t.__proto__=o.prototype):t=c(t,e),t}function p(t,e){if(o.isBuffer(e)){var i=0|f(e.length);return t=n(t,i),0===t.length?t:(e.copy(t,0,0,i),t)}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||X(e.length)?n(t,0):c(t,e);if("Buffer"===e.type&&Q(e.data))return c(t,e.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function f(t){if(t>=r())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r().toString(16)+" bytes");return 0|t}function g(t){return+t!=t&&(t=0),o.alloc(+t)}function m(t,e){if(o.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var i=t.length;if(0===i)return 0;for(var r=!1;;)switch(e){case"ascii":case"latin1":case"binary":return i;case"utf8":case"utf-8":case void 0:return j(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*i;case"hex":return i>>>1;case"base64":return Y(t).length;default:if(r)return j(t).length;e=(""+e).toLowerCase(),r=!0}}function E(t,e,i){var r=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===i||i>this.length)&&(i=this.length),i<=0)return"";if(i>>>=0,e>>>=0,i<=e)return"";for(t||(t="utf8");;)switch(t){case"hex":return I(this,e,i);case"utf8":case"utf-8":return M(this,e,i);case"ascii":return A(this,e,i);case"latin1":case"binary":return P(this,e,i);case"base64":return x(this,e,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,e,i);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function y(t,e,i){var r=t[e];t[e]=t[i],t[i]=r}function _(t,e,i,r,n){if(0===t.length)return-1;if("string"==typeof i?(r=i,i=0):i>2147483647?i=2147483647:i<-2147483648&&(i=-2147483648),i=+i,isNaN(i)&&(i=n?0:t.length-1),i<0&&(i=t.length+i),i>=t.length){if(n)return-1;i=t.length-1}else if(i<0){if(!n)return-1;i=0}if("string"==typeof e&&(e=o.from(e,r)),o.isBuffer(e))return 0===e.length?-1:v(t,e,i,r,n);if("number"==typeof e)return e&=255,o.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(t,e,i):Uint8Array.prototype.lastIndexOf.call(t,e,i):v(t,[e],i,r,n);throw new TypeError("val must be string, number or Buffer")}function v(t,e,i,r,n){function o(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}var s=1,a=t.length,l=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;s=2,a/=2,l/=2,i/=2}var h;if(n){var u=-1;for(h=i;h<a;h++)if(o(t,h)===o(e,-1===u?0:h-u)){if(-1===u&&(u=h),h-u+1===l)return u*s}else-1!==u&&(h-=h-u),u=-1}else for(i+l>a&&(i=a-l),h=i;h>=0;h--){for(var c=!0,d=0;d<l;d++)if(o(t,h+d)!==o(e,d)){c=!1;break}if(c)return h}return-1}function S(t,e,i,r){i=Number(i)||0;var n=t.length-i;r?(r=Number(r))>n&&(r=n):r=n;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var s=0;s<r;++s){var a=parseInt(e.substr(2*s,2),16);if(isNaN(a))return s;t[i+s]=a}return s}function b(t,e,i,r){return H(j(e,t.length-i),t,i,r)}function T(t,e,i,r){return H(z(e),t,i,r)}function L(t,e,i,r){return T(t,e,i,r)}function w(t,e,i,r){return H(Y(e),t,i,r)}function R(t,e,i,r){return H(q(e,t.length-i),t,i,r)}function x(t,e,i){return 0===e&&i===t.length?J.fromByteArray(t):J.fromByteArray(t.slice(e,i))}function M(t,e,i){i=Math.min(t.length,i);for(var r=[],n=e;n<i;){var o=t[n],s=null,a=o>239?4:o>223?3:o>191?2:1;if(n+a<=i){var l,h,u,c;switch(a){case 1:o<128&&(s=o);break;case 2:l=t[n+1],128==(192&l)&&(c=(31&o)<<6|63&l)>127&&(s=c);break;case 3:l=t[n+1],h=t[n+2],128==(192&l)&&128==(192&h)&&(c=(15&o)<<12|(63&l)<<6|63&h)>2047&&(c<55296||c>57343)&&(s=c);break;case 4:l=t[n+1],h=t[n+2],u=t[n+3],128==(192&l)&&128==(192&h)&&128==(192&u)&&(c=(15&o)<<18|(63&l)<<12|(63&h)<<6|63&u)>65535&&c<1114112&&(s=c)}}null===s?(s=65533,a=1):s>65535&&(s-=65536,r.push(s>>>10&1023|55296),s=56320|1023&s),r.push(s),n+=a}return C(r)}function C(t){var e=t.length;if(e<=$)return String.fromCharCode.apply(String,t);for(var i="",r=0;r<e;)i+=String.fromCharCode.apply(String,t.slice(r,r+=$));return i}function A(t,e,i){var r="";i=Math.min(t.length,i);for(var n=e;n<i;++n)r+=String.fromCharCode(127&t[n]);return r}function P(t,e,i){var r="";i=Math.min(t.length,i);for(var n=e;n<i;++n)r+=String.fromCharCode(t[n]);return r}function I(t,e,i){var r=t.length;(!e||e<0)&&(e=0),(!i||i<0||i>r)&&(i=r);for(var n="",o=e;o<i;++o)n+=K(t[o]);return n}function O(t,e,i){for(var r=t.slice(e,i),n="",o=0;o<r.length;o+=2)n+=String.fromCharCode(r[o]+256*r[o+1]);return n}function N(t,e,i){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>i)throw new RangeError("Trying to access beyond buffer length")}function D(t,e,i,r,n,s){if(!o.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>n||e<s)throw new RangeError('"value" argument is out of bounds');if(i+r>t.length)throw new RangeError("Index out of range")}function k(t,e,i,r){e<0&&(e=65535+e+1);for(var n=0,o=Math.min(t.length-i,2);n<o;++n)t[i+n]=(e&255<<8*(r?n:1-n))>>>8*(r?n:1-n)}function V(t,e,i,r){e<0&&(e=4294967295+e+1);for(var n=0,o=Math.min(t.length-i,4);n<o;++n)t[i+n]=e>>>8*(r?n:3-n)&255}function F(t,e,i,r,n,o){if(i+r>t.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("Index out of range")}function G(t,e,i,r,n){return n||F(t,e,i,4,3.4028234663852886e38,-3.4028234663852886e38),Z.write(t,e,i,r,23,4),i+4}function W(t,e,i,r,n){return n||F(t,e,i,8,1.7976931348623157e308,-1.7976931348623157e308),Z.write(t,e,i,r,52,8),i+8}function B(t){if(t=U(t).replace(tt,""),t.length<2)return"";for(;t.length%4!=0;)t+="=";return t}function U(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function K(t){return t<16?"0"+t.toString(16):t.toString(16)}function j(t,e){e=e||1/0;for(var i,r=t.length,n=null,o=[],s=0;s<r;++s){if((i=t.charCodeAt(s))>55295&&i<57344){if(!n){if(i>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===r){(e-=3)>-1&&o.push(239,191,189);continue}n=i;continue}if(i<56320){(e-=3)>-1&&o.push(239,191,189),n=i;continue}i=65536+(n-55296<<10|i-56320)}else n&&(e-=3)>-1&&o.push(239,191,189);if(n=null,i<128){if((e-=1)<0)break;o.push(i)}else if(i<2048){if((e-=2)<0)break;o.push(i>>6|192,63&i|128)}else if(i<65536){if((e-=3)<0)break;o.push(i>>12|224,i>>6&63|128,63&i|128)}else{if(!(i<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(i>>18|240,i>>12&63|128,i>>6&63|128,63&i|128)}}return o}function z(t){for(var e=[],i=0;i<t.length;++i)e.push(255&t.charCodeAt(i));return e}function q(t,e){for(var i,r,n,o=[],s=0;s<t.length&&!((e-=2)<0);++s)i=t.charCodeAt(s),r=i>>8,n=i%256,o.push(n),o.push(r);return o}function Y(t){return J.toByteArray(B(t))}function H(t,e,i,r){for(var n=0;n<r&&!(n+i>=e.length||n>=t.length);++n)e[n+i]=t[n];return n}function X(t){return t!==t}var J=i(24),Z=i(25),Q=i(26);e.Buffer=o,e.SlowBuffer=g,e.INSPECT_MAX_BYTES=50,o.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}(),e.kMaxLength=r(),o.poolSize=8192,o._augment=function(t){return t.__proto__=o.prototype,t},o.from=function(t,e,i){return s(null,t,e,i)},o.TYPED_ARRAY_SUPPORT&&(o.prototype.__proto__=Uint8Array.prototype,o.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&o[Symbol.species]===o&&Object.defineProperty(o,Symbol.species,{value:null,configurable:!0})),o.alloc=function(t,e,i){return l(null,t,e,i)},o.allocUnsafe=function(t){return h(null,t)},o.allocUnsafeSlow=function(t){return h(null,t)},o.isBuffer=function(t){return!(null==t||!t._isBuffer)},o.compare=function(t,e){if(!o.isBuffer(t)||!o.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var i=t.length,r=e.length,n=0,s=Math.min(i,r);n<s;++n)if(t[n]!==e[n]){i=t[n],r=e[n];break}return i<r?-1:r<i?1:0},o.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},o.concat=function(t,e){if(!Q(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return o.alloc(0);var i;if(void 0===e)for(e=0,i=0;i<t.length;++i)e+=t[i].length;var r=o.allocUnsafe(e),n=0;for(i=0;i<t.length;++i){var s=t[i];if(!o.isBuffer(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(r,n),n+=s.length}return r},o.byteLength=m,o.prototype._isBuffer=!0,o.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)y(this,e,e+1);return this},o.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)y(this,e,e+3),y(this,e+1,e+2);return this},o.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)y(this,e,e+7),y(this,e+1,e+6),y(this,e+2,e+5),y(this,e+3,e+4);return this},o.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?M(this,0,t):E.apply(this,arguments)},o.prototype.equals=function(t){if(!o.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===o.compare(this,t)},o.prototype.inspect=function(){var t="",i=e.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,i).match(/.{2}/g).join(" "),this.length>i&&(t+=" ... ")),"<Buffer "+t+">"},o.prototype.compare=function(t,e,i,r,n){if(!o.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===i&&(i=t?t.length:0),void 0===r&&(r=0),void 0===n&&(n=this.length),e<0||i>t.length||r<0||n>this.length)throw new RangeError("out of range index");if(r>=n&&e>=i)return 0;if(r>=n)return-1;if(e>=i)return 1;if(e>>>=0,i>>>=0,r>>>=0,n>>>=0,this===t)return 0;for(var s=n-r,a=i-e,l=Math.min(s,a),h=this.slice(r,n),u=t.slice(e,i),c=0;c<l;++c)if(h[c]!==u[c]){s=h[c],a=u[c];break}return s<a?-1:a<s?1:0},o.prototype.includes=function(t,e,i){return-1!==this.indexOf(t,e,i)},o.prototype.indexOf=function(t,e,i){return _(this,t,e,i,!0)},o.prototype.lastIndexOf=function(t,e,i){return _(this,t,e,i,!1)},o.prototype.write=function(t,e,i,r){if(void 0===e)r="utf8",i=this.length,e=0;else if(void 0===i&&"string"==typeof e)r=e,i=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(i)?(i|=0,void 0===r&&(r="utf8")):(r=i,i=void 0)}var n=this.length-e;if((void 0===i||i>n)&&(i=n),t.length>0&&(i<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return S(this,t,e,i);case"utf8":case"utf-8":return b(this,t,e,i);case"ascii":return T(this,t,e,i);case"latin1":case"binary":return L(this,t,e,i);case"base64":return w(this,t,e,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,t,e,i);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var $=4096;o.prototype.slice=function(t,e){var i=this.length;t=~~t,e=void 0===e?i:~~e,t<0?(t+=i)<0&&(t=0):t>i&&(t=i),e<0?(e+=i)<0&&(e=0):e>i&&(e=i),e<t&&(e=t);var r;if(o.TYPED_ARRAY_SUPPORT)r=this.subarray(t,e),r.__proto__=o.prototype;else{var n=e-t;r=new o(n,void 0);for(var s=0;s<n;++s)r[s]=this[s+t]}return r},o.prototype.readUIntLE=function(t,e,i){t|=0,e|=0,i||N(t,e,this.length);for(var r=this[t],n=1,o=0;++o<e&&(n*=256);)r+=this[t+o]*n;return r
},o.prototype.readUIntBE=function(t,e,i){t|=0,e|=0,i||N(t,e,this.length);for(var r=this[t+--e],n=1;e>0&&(n*=256);)r+=this[t+--e]*n;return r},o.prototype.readUInt8=function(t,e){return e||N(t,1,this.length),this[t]},o.prototype.readUInt16LE=function(t,e){return e||N(t,2,this.length),this[t]|this[t+1]<<8},o.prototype.readUInt16BE=function(t,e){return e||N(t,2,this.length),this[t]<<8|this[t+1]},o.prototype.readUInt32LE=function(t,e){return e||N(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},o.prototype.readUInt32BE=function(t,e){return e||N(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},o.prototype.readIntLE=function(t,e,i){t|=0,e|=0,i||N(t,e,this.length);for(var r=this[t],n=1,o=0;++o<e&&(n*=256);)r+=this[t+o]*n;return n*=128,r>=n&&(r-=Math.pow(2,8*e)),r},o.prototype.readIntBE=function(t,e,i){t|=0,e|=0,i||N(t,e,this.length);for(var r=e,n=1,o=this[t+--r];r>0&&(n*=256);)o+=this[t+--r]*n;return n*=128,o>=n&&(o-=Math.pow(2,8*e)),o},o.prototype.readInt8=function(t,e){return e||N(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},o.prototype.readInt16LE=function(t,e){e||N(t,2,this.length);var i=this[t]|this[t+1]<<8;return 32768&i?4294901760|i:i},o.prototype.readInt16BE=function(t,e){e||N(t,2,this.length);var i=this[t+1]|this[t]<<8;return 32768&i?4294901760|i:i},o.prototype.readInt32LE=function(t,e){return e||N(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},o.prototype.readInt32BE=function(t,e){return e||N(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},o.prototype.readFloatLE=function(t,e){return e||N(t,4,this.length),Z.read(this,t,!0,23,4)},o.prototype.readFloatBE=function(t,e){return e||N(t,4,this.length),Z.read(this,t,!1,23,4)},o.prototype.readDoubleLE=function(t,e){return e||N(t,8,this.length),Z.read(this,t,!0,52,8)},o.prototype.readDoubleBE=function(t,e){return e||N(t,8,this.length),Z.read(this,t,!1,52,8)},o.prototype.writeUIntLE=function(t,e,i,r){if(t=+t,e|=0,i|=0,!r){D(this,t,e,i,Math.pow(2,8*i)-1,0)}var n=1,o=0;for(this[e]=255&t;++o<i&&(n*=256);)this[e+o]=t/n&255;return e+i},o.prototype.writeUIntBE=function(t,e,i,r){if(t=+t,e|=0,i|=0,!r){D(this,t,e,i,Math.pow(2,8*i)-1,0)}var n=i-1,o=1;for(this[e+n]=255&t;--n>=0&&(o*=256);)this[e+n]=t/o&255;return e+i},o.prototype.writeUInt8=function(t,e,i){return t=+t,e|=0,i||D(this,t,e,1,255,0),o.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},o.prototype.writeUInt16LE=function(t,e,i){return t=+t,e|=0,i||D(this,t,e,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):k(this,t,e,!0),e+2},o.prototype.writeUInt16BE=function(t,e,i){return t=+t,e|=0,i||D(this,t,e,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):k(this,t,e,!1),e+2},o.prototype.writeUInt32LE=function(t,e,i){return t=+t,e|=0,i||D(this,t,e,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):V(this,t,e,!0),e+4},o.prototype.writeUInt32BE=function(t,e,i){return t=+t,e|=0,i||D(this,t,e,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):V(this,t,e,!1),e+4},o.prototype.writeIntLE=function(t,e,i,r){if(t=+t,e|=0,!r){var n=Math.pow(2,8*i-1);D(this,t,e,i,n-1,-n)}var o=0,s=1,a=0;for(this[e]=255&t;++o<i&&(s*=256);)t<0&&0===a&&0!==this[e+o-1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+i},o.prototype.writeIntBE=function(t,e,i,r){if(t=+t,e|=0,!r){var n=Math.pow(2,8*i-1);D(this,t,e,i,n-1,-n)}var o=i-1,s=1,a=0;for(this[e+o]=255&t;--o>=0&&(s*=256);)t<0&&0===a&&0!==this[e+o+1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+i},o.prototype.writeInt8=function(t,e,i){return t=+t,e|=0,i||D(this,t,e,1,127,-128),o.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},o.prototype.writeInt16LE=function(t,e,i){return t=+t,e|=0,i||D(this,t,e,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):k(this,t,e,!0),e+2},o.prototype.writeInt16BE=function(t,e,i){return t=+t,e|=0,i||D(this,t,e,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):k(this,t,e,!1),e+2},o.prototype.writeInt32LE=function(t,e,i){return t=+t,e|=0,i||D(this,t,e,4,2147483647,-2147483648),o.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):V(this,t,e,!0),e+4},o.prototype.writeInt32BE=function(t,e,i){return t=+t,e|=0,i||D(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):V(this,t,e,!1),e+4},o.prototype.writeFloatLE=function(t,e,i){return G(this,t,e,!0,i)},o.prototype.writeFloatBE=function(t,e,i){return G(this,t,e,!1,i)},o.prototype.writeDoubleLE=function(t,e,i){return W(this,t,e,!0,i)},o.prototype.writeDoubleBE=function(t,e,i){return W(this,t,e,!1,i)},o.prototype.copy=function(t,e,i,r){if(i||(i=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r<i&&(r=i),r===i)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(i<0||i>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e<r-i&&(r=t.length-e+i);var n,s=r-i;if(this===t&&i<e&&e<r)for(n=s-1;n>=0;--n)t[n+e]=this[n+i];else if(s<1e3||!o.TYPED_ARRAY_SUPPORT)for(n=0;n<s;++n)t[n+e]=this[n+i];else Uint8Array.prototype.set.call(t,this.subarray(i,i+s),e);return s},o.prototype.fill=function(t,e,i,r){if("string"==typeof t){if("string"==typeof e?(r=e,e=0,i=this.length):"string"==typeof i&&(r=i,i=this.length),1===t.length){var n=t.charCodeAt(0);n<256&&(t=n)}if(void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!o.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<i)throw new RangeError("Out of range index");if(i<=e)return this;e>>>=0,i=void 0===i?this.length:i>>>0,t||(t=0);var s;if("number"==typeof t)for(s=e;s<i;++s)this[s]=t;else{var a=o.isBuffer(t)?t:j(new o(t,r).toString()),l=a.length;for(s=0;s<i-e;++s)this[s+e]=a[s%l]}return this};var tt=/[^+\/0-9A-Za-z-_]/g}).call(e,i(23))},function(t,e,i){function r(t,e,i,r){for(var n=65535&t|0,o=t>>>16&65535|0,s=0;0!==i;){s=i>2e3?2e3:i,i-=s;do{n=n+e[r++]|0,o=o+n|0}while(--s);n%=65521,o%=65521}return n|o<<16|0}t.exports=r},function(t,e,i){function r(t,e,i,r){var o=n,s=r+i;t^=-1;for(var a=r;a<s;a++)t=t>>>8^o[255&(t^e[a])];return-1^t}var n=function(){for(var t,e=[],i=0;i<256;i++){t=i;for(var r=0;r<8;r++)t=1&t?3988292384^t>>>1:t>>>1;e[i]=t}return e}();t.exports=r},function(t,e,i){function r(t,e){if(e<65537&&(t.subarray&&s||!t.subarray&&o))return String.fromCharCode.apply(null,n.shrinkBuf(t,e));for(var i="",r=0;r<e;r++)i+=String.fromCharCode(t[r]);return i}var n=i(1),o=!0,s=!0;try{String.fromCharCode.apply(null,[0])}catch(t){o=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(t){s=!1}for(var a=new n.Buf8(256),l=0;l<256;l++)a[l]=l>=252?6:l>=248?5:l>=240?4:l>=224?3:l>=192?2:1;a[254]=a[254]=1,e.string2buf=function(t){var e,i,r,o,s,a=t.length,l=0;for(o=0;o<a;o++)i=t.charCodeAt(o),55296==(64512&i)&&o+1<a&&56320==(64512&(r=t.charCodeAt(o+1)))&&(i=65536+(i-55296<<10)+(r-56320),o++),l+=i<128?1:i<2048?2:i<65536?3:4;for(e=new n.Buf8(l),s=0,o=0;s<l;o++)i=t.charCodeAt(o),55296==(64512&i)&&o+1<a&&56320==(64512&(r=t.charCodeAt(o+1)))&&(i=65536+(i-55296<<10)+(r-56320),o++),i<128?e[s++]=i:i<2048?(e[s++]=192|i>>>6,e[s++]=128|63&i):i<65536?(e[s++]=224|i>>>12,e[s++]=128|i>>>6&63,e[s++]=128|63&i):(e[s++]=240|i>>>18,e[s++]=128|i>>>12&63,e[s++]=128|i>>>6&63,e[s++]=128|63&i);return e},e.buf2binstring=function(t){return r(t,t.length)},e.binstring2buf=function(t){for(var e=new n.Buf8(t.length),i=0,r=e.length;i<r;i++)e[i]=t.charCodeAt(i);return e},e.buf2string=function(t,e){var i,n,o,s,l=e||t.length,h=new Array(2*l);for(n=0,i=0;i<l;)if((o=t[i++])<128)h[n++]=o;else if((s=a[o])>4)h[n++]=65533,i+=s-1;else{for(o&=2===s?31:3===s?15:7;s>1&&i<l;)o=o<<6|63&t[i++],s--;s>1?h[n++]=65533:o<65536?h[n++]=o:(o-=65536,h[n++]=55296|o>>10&1023,h[n++]=56320|1023&o)}return r(h,n)},e.utf8border=function(t,e){var i;for(e=e||t.length,e>t.length&&(e=t.length),i=e-1;i>=0&&128==(192&t[i]);)i--;return i<0?e:0===i?e:i+a[t[i]]>e?i:e}},function(t,e,i){function r(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}t.exports=r},function(t,e,i){t.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},function(t,e,i){e.LOCAL_FILE_HEADER="PK",e.CENTRAL_FILE_HEADER="PK",e.CENTRAL_DIRECTORY_END="PK",e.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK",e.ZIP64_CENTRAL_DIRECTORY_END="PK",e.DATA_DESCRIPTOR="PK\b"},function(t,e,i){e.base64=!1,e.binary=!1,e.dir=!1,e.createFolders=!1,e.date=null,e.compression=null,e.compressionOptions=null,e.comment=null,e.unixPermissions=null,e.dosPermissions=null},function(t,e,i){function r(){this.compressedSize=0,this.uncompressedSize=0,this.crc32=0,this.compressionMethod=null,this.compressedContent=null}r.prototype={getContent:function(){return null},getCompressedContent:function(){return null}},t.exports=r},function(t,e,i){for(var r=i(0),n=i(2),o=i(7),s=new Array(256),a=0;a<256;a++)s[a]=a>=252?6:a>=248?5:a>=240?4:a>=224?3:a>=192?2:1;s[254]=s[254]=1;var l=function(t){var e,i,r,o,s,a=t.length,l=0;for(o=0;o<a;o++)i=t.charCodeAt(o),55296==(64512&i)&&o+1<a&&56320==(64512&(r=t.charCodeAt(o+1)))&&(i=65536+(i-55296<<10)+(r-56320),o++),l+=i<128?1:i<2048?2:i<65536?3:4;for(e=n.uint8array?new Uint8Array(l):new Array(l),s=0,o=0;s<l;o++)i=t.charCodeAt(o),55296==(64512&i)&&o+1<a&&56320==(64512&(r=t.charCodeAt(o+1)))&&(i=65536+(i-55296<<10)+(r-56320),o++),i<128?e[s++]=i:i<2048?(e[s++]=192|i>>>6,e[s++]=128|63&i):i<65536?(e[s++]=224|i>>>12,e[s++]=128|i>>>6&63,e[s++]=128|63&i):(e[s++]=240|i>>>18,e[s++]=128|i>>>12&63,e[s++]=128|i>>>6&63,e[s++]=128|63&i);return e},h=function(t,e){var i;for(e=e||t.length,e>t.length&&(e=t.length),i=e-1;i>=0&&128==(192&t[i]);)i--;return i<0?e:0===i?e:i+s[t[i]]>e?i:e},u=function(t){var e,i,n,o,a=t.length,l=new Array(2*a);for(i=0,e=0;e<a;)if((n=t[e++])<128)l[i++]=n;else if((o=s[n])>4)l[i++]=65533,e+=o-1;else{for(n&=2===o?31:3===o?15:7;o>1&&e<a;)n=n<<6|63&t[e++],o--;o>1?l[i++]=65533:n<65536?l[i++]=n:(n-=65536,l[i++]=55296|n>>10&1023,l[i++]=56320|1023&n)}return l.length!==i&&(l.subarray?l=l.subarray(0,i):l.length=i),r.applyFromCharCode(l)};e.utf8encode=function(t){return n.nodebuffer?o(t,"utf-8"):l(t)},e.utf8decode=function(t){if(n.nodebuffer)return r.transformTo("nodebuffer",t).toString("utf-8");t=r.transformTo(n.uint8array?"uint8array":"array",t);for(var e=[],i=0,o=t.length;i<o;){var s=h(t,Math.min(i+65536,o));n.uint8array?e.push(u(t.subarray(i,s))):e.push(u(t.slice(i,s))),i=s}return e.join("")}},function(t,e,i){function r(t,e){this.data=t,e||(this.data=o.string2binary(this.data)),this.length=this.data.length,this.index=0,this.zero=0}var n=i(19),o=i(0);r.prototype=new n,r.prototype.byteAt=function(t){return this.data.charCodeAt(this.zero+t)},r.prototype.lastIndexOfSignature=function(t){return this.data.lastIndexOf(t)-this.zero},r.prototype.readData=function(t){this.checkOffset(t);var e=this.data.slice(this.zero+this.index,this.zero+this.index+t);return this.index+=t,e},t.exports=r},function(t,e,i){function r(t){this.data=null,this.length=0,this.index=0,this.zero=0}var n=i(0);r.prototype={checkOffset:function(t){this.checkIndex(this.index+t)},checkIndex:function(t){if(this.length<this.zero+t||t<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+t+"). Corrupted zip ?")},setIndex:function(t){this.checkIndex(t),this.index=t},skip:function(t){this.setIndex(this.index+t)},byteAt:function(t){},readInt:function(t){var e,i=0;for(this.checkOffset(t),e=this.index+t-1;e>=this.index;e--)i=(i<<8)+this.byteAt(e);return this.index+=t,i},readString:function(t){return n.transformTo("string",this.readData(t))},readData:function(t){},lastIndexOfSignature:function(t){},readDate:function(){var t=this.readInt(4);return new Date(1980+(t>>25&127),(t>>21&15)-1,t>>16&31,t>>11&31,t>>5&63,(31&t)<<1)}},t.exports=r},function(t,e,i){function r(t){t&&(this.data=t,this.length=this.data.length,this.index=0,this.zero=0)}var n=i(21);r.prototype=new n,r.prototype.readData=function(t){if(this.checkOffset(t),0===t)return new Uint8Array(0);var e=this.data.subarray(this.zero+this.index,this.zero+this.index+t);return this.index+=t,e},t.exports=r},function(t,e,i){function r(t){if(t){this.data=t,this.length=this.data.length,this.index=0,this.zero=0;for(var e=0;e<this.data.length;e++)t[e]=255&t[e]}}var n=i(19);r.prototype=new n,r.prototype.byteAt=function(t){return this.data[this.zero+t]},r.prototype.lastIndexOfSignature=function(t){for(var e=t.charCodeAt(0),i=t.charCodeAt(1),r=t.charCodeAt(2),n=t.charCodeAt(3),o=this.length-4;o>=0;--o)if(this.data[o]===e&&this.data[o+1]===i&&this.data[o+2]===r&&this.data[o+3]===n)return o-this.zero;return-1},r.prototype.readData=function(t){if(this.checkOffset(t),0===t)return[];var e=this.data.slice(this.zero+this.index,this.zero+this.index+t);return this.index+=t,e},t.exports=r},function(t,e,i){function r(t,e){if(!(this instanceof r))return new r(t,e);this.files={},this.comment=null,this.root="",t&&this.load(t,e),this.clone=function(){var t=new r;for(var e in this)"function"!=typeof this[e]&&(t[e]=this[e]);return t}}var n=i(3);r.prototype=i(4),r.prototype.load=i(40),r.support=i(2),r.defaults=i(15),r.utils=i(44),r.base64={encode:function(t){return n.encode(t)},decode:function(t){return n.decode(t)}},r.compressions=i(5),t.exports=r},function(t,e){var i;i=function(){return this}();try{i=i||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(i=window)}t.exports=i},function(t,e,i){function r(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===t[e-2]?2:"="===t[e-1]?1:0}function n(t){return 3*t.length/4-r(t)}function o(t){var e,i,n,o,s,a=t.length;o=r(t),s=new c(3*a/4-o),i=o>0?a-4:a;var l=0;for(e=0;e<i;e+=4)n=u[t.charCodeAt(e)]<<18|u[t.charCodeAt(e+1)]<<12|u[t.charCodeAt(e+2)]<<6|u[t.charCodeAt(e+3)],s[l++]=n>>16&255,s[l++]=n>>8&255,s[l++]=255&n;return 2===o?(n=u[t.charCodeAt(e)]<<2|u[t.charCodeAt(e+1)]>>4,s[l++]=255&n):1===o&&(n=u[t.charCodeAt(e)]<<10|u[t.charCodeAt(e+1)]<<4|u[t.charCodeAt(e+2)]>>2,s[l++]=n>>8&255,s[l++]=255&n),s}function s(t){return h[t>>18&63]+h[t>>12&63]+h[t>>6&63]+h[63&t]}function a(t,e,i){for(var r,n=[],o=e;o<i;o+=3)r=(t[o]<<16)+(t[o+1]<<8)+t[o+2],n.push(s(r));return n.join("")}function l(t){for(var e,i=t.length,r=i%3,n="",o=[],s=0,l=i-r;s<l;s+=16383)o.push(a(t,s,s+16383>l?l:s+16383));return 1===r?(e=t[i-1],n+=h[e>>2],n+=h[e<<4&63],n+="=="):2===r&&(e=(t[i-2]<<8)+t[i-1],n+=h[e>>10],n+=h[e>>4&63],n+=h[e<<2&63],n+="="),o.push(n),o.join("")}e.byteLength=n,e.toByteArray=o,e.fromByteArray=l;for(var h=[],u=[],c="undefined"!=typeof Uint8Array?Uint8Array:Array,d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",p=0,f=d.length;p<f;++p)h[p]=d[p],u[d.charCodeAt(p)]=p;u["-".charCodeAt(0)]=62,u["_".charCodeAt(0)]=63},function(t,e){e.read=function(t,e,i,r,n){var o,s,a=8*n-r-1,l=(1<<a)-1,h=l>>1,u=-7,c=i?n-1:0,d=i?-1:1,p=t[e+c];for(c+=d,o=p&(1<<-u)-1,p>>=-u,u+=a;u>0;o=256*o+t[e+c],c+=d,u-=8);for(s=o&(1<<-u)-1,o>>=-u,u+=r;u>0;s=256*s+t[e+c],c+=d,u-=8);if(0===o)o=1-h;else{if(o===l)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,r),o-=h}return(p?-1:1)*s*Math.pow(2,o-r)},e.write=function(t,e,i,r,n,o){var s,a,l,h=8*o-n-1,u=(1<<h)-1,c=u>>1,d=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:o-1,f=r?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=u):(s=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-s))<1&&(s--,l*=2),e+=s+c>=1?d/l:d*Math.pow(2,1-c),e*l>=2&&(s++,l/=2),s+c>=u?(a=0,s=u):s+c>=1?(a=(e*l-1)*Math.pow(2,n),s+=c):(a=e*Math.pow(2,c-1)*Math.pow(2,n),s=0));n>=8;t[i+p]=255&a,p+=f,a/=256,n-=8);for(s=s<<n|a,h+=n;h>0;t[i+p]=255&s,p+=f,s/=256,h-=8);t[i+p-f]|=128*g}},function(t,e){var i={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==i.call(t)}},function(t,e,i){var r="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array,n=i(28);e.uncompressInputType=r?"uint8array":"array",e.compressInputType=r?"uint8array":"array",e.magic="\b\0",e.compress=function(t,e){return n.deflateRaw(t,{level:e.level||-1})},e.uncompress=function(t){return n.inflateRaw(t)}},function(t,e,i){var r=i(1).assign,n=i(29),o=i(32),s=i(13),a={};r(a,n,o,s),t.exports=a},function(t,e,i){function r(t){if(!(this instanceof r))return new r(t);this.options=l.assign({level:f,method:m,chunkSize:16384,windowBits:15,memLevel:8,strategy:g,to:""},t||{});var e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new c,this.strm.avail_out=0;var i=a.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(i!==p)throw new Error(u[i]);if(e.header&&a.deflateSetHeader(this.strm,e.header),e.dictionary){var n;if(n="string"==typeof e.dictionary?h.string2buf(e.dictionary):"[object ArrayBuffer]"===d.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary,(i=a.deflateSetDictionary(this.strm,n))!==p)throw new Error(u[i]);this._dict_set=!0}}function n(t,e){var i=new r(e);if(i.push(t,!0),i.err)throw i.msg||u[i.err];return i.result}function o(t,e){return e=e||{},e.raw=!0,n(t,e)}function s(t,e){return e=e||{},e.gzip=!0,n(t,e)}var a=i(30),l=i(1),h=i(11),u=i(6),c=i(12),d=Object.prototype.toString,p=0,f=-1,g=0,m=8;r.prototype.push=function(t,e){var i,r,n=this.strm,o=this.options.chunkSize;if(this.ended)return!1;r=e===~~e?e:!0===e?4:0,"string"==typeof t?n.input=h.string2buf(t):"[object ArrayBuffer]"===d.call(t)?n.input=new Uint8Array(t):n.input=t,n.next_in=0,n.avail_in=n.input.length;do{if(0===n.avail_out&&(n.output=new l.Buf8(o),n.next_out=0,n.avail_out=o),1!==(i=a.deflate(n,r))&&i!==p)return this.onEnd(i),this.ended=!0,!1;0!==n.avail_out&&(0!==n.avail_in||4!==r&&2!==r)||("string"===this.options.to?this.onData(h.buf2binstring(l.shrinkBuf(n.output,n.next_out))):this.onData(l.shrinkBuf(n.output,n.next_out)))}while((n.avail_in>0||0===n.avail_out)&&1!==i);return 4===r?(i=a.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===p):2!==r||(this.onEnd(p),n.avail_out=0,!0)},r.prototype.onData=function(t){this.chunks.push(t)},r.prototype.onEnd=function(t){t===p&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=l.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},e.Deflate=r,e.deflate=n,e.deflateRaw=o,e.gzip=s},function(t,e,i){function r(t,e){return t.msg=N[e],e}function n(t){return(t<<1)-(t>4?9:0)}function o(t){for(var e=t.length;--e>=0;)t[e]=0}function s(t){var e=t.state,i=e.pending;i>t.avail_out&&(i=t.avail_out),0!==i&&(A.arraySet(t.output,e.pending_buf,e.pending_out,i,t.next_out),t.next_out+=i,e.pending_out+=i,t.total_out+=i,t.avail_out-=i,e.pending-=i,0===e.pending&&(e.pending_out=0))}function a(t,e){P._tr_flush_block(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,s(t.strm)}function l(t,e){t.pending_buf[t.pending++]=e}function h(t,e){t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e}function u(t,e,i,r){var n=t.avail_in;return n>r&&(n=r),0===n?0:(t.avail_in-=n,A.arraySet(e,t.input,t.next_in,n,i),1===t.state.wrap?t.adler=I(t.adler,e,n,i):2===t.state.wrap&&(t.adler=O(t.adler,e,n,i)),t.next_in+=n,t.total_in+=n,n)}function c(t,e){var i,r,n=t.max_chain_length,o=t.strstart,s=t.prev_length,a=t.nice_match,l=t.strstart>t.w_size-ht?t.strstart-(t.w_size-ht):0,h=t.window,u=t.w_mask,c=t.prev,d=t.strstart+lt,p=h[o+s-1],f=h[o+s];t.prev_length>=t.good_match&&(n>>=2),a>t.lookahead&&(a=t.lookahead);do{if(i=e,h[i+s]===f&&h[i+s-1]===p&&h[i]===h[o]&&h[++i]===h[o+1]){o+=2,i++;do{}while(h[++o]===h[++i]&&h[++o]===h[++i]&&h[++o]===h[++i]&&h[++o]===h[++i]&&h[++o]===h[++i]&&h[++o]===h[++i]&&h[++o]===h[++i]&&h[++o]===h[++i]&&o<d);if(r=lt-(d-o),o=d-lt,r>s){if(t.match_start=e,s=r,r>=a)break;p=h[o+s-1],f=h[o+s]}}}while((e=c[e&u])>l&&0!=--n);return s<=t.lookahead?s:t.lookahead}function d(t){var e,i,r,n,o,s=t.w_size;do{if(n=t.window_size-t.lookahead-t.strstart,t.strstart>=s+(s-ht)){A.arraySet(t.window,t.window,s,s,0),t.match_start-=s,t.strstart-=s,t.block_start-=s,i=t.hash_size,e=i;do{r=t.head[--e],t.head[e]=r>=s?r-s:0}while(--i);i=s,e=i;do{r=t.prev[--e],t.prev[e]=r>=s?r-s:0}while(--i);n+=s}if(0===t.strm.avail_in)break;if(i=u(t.strm,t.window,t.strstart+t.lookahead,n),t.lookahead+=i,t.lookahead+t.insert>=at)for(o=t.strstart-t.insert,t.ins_h=t.window[o],t.ins_h=(t.ins_h<<t.hash_shift^t.window[o+1])&t.hash_mask;t.insert&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[o+at-1])&t.hash_mask,t.prev[o&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=o,o++,t.insert--,!(t.lookahead+t.insert<at)););}while(t.lookahead<ht&&0!==t.strm.avail_in)}function p(t,e){var i=65535;for(i>t.pending_buf_size-5&&(i=t.pending_buf_size-5);;){if(t.lookahead<=1){if(d(t),0===t.lookahead&&e===D)return yt;if(0===t.lookahead)break}t.strstart+=t.lookahead,t.lookahead=0;var r=t.block_start+i;if((0===t.strstart||t.strstart>=r)&&(t.lookahead=t.strstart-r,t.strstart=r,a(t,!1),0===t.strm.avail_out))return yt;if(t.strstart-t.block_start>=t.w_size-ht&&(a(t,!1),0===t.strm.avail_out))return yt}return t.insert=0,e===F?(a(t,!0),0===t.strm.avail_out?vt:St):(t.strstart>t.block_start&&(a(t,!1),t.strm.avail_out),yt)}function f(t,e){for(var i,r;;){if(t.lookahead<ht){if(d(t),t.lookahead<ht&&e===D)return yt;if(0===t.lookahead)break}if(i=0,t.lookahead>=at&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+at-1])&t.hash_mask,i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!==i&&t.strstart-i<=t.w_size-ht&&(t.match_length=c(t,i)),t.match_length>=at)if(r=P._tr_tally(t,t.strstart-t.match_start,t.match_length-at),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=at){t.match_length--;do{t.strstart++,t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+at-1])&t.hash_mask,i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart}while(0!=--t.match_length);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+1])&t.hash_mask;else r=P._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(r&&(a(t,!1),0===t.strm.avail_out))return yt}return t.insert=t.strstart<at-1?t.strstart:at-1,e===F?(a(t,!0),0===t.strm.avail_out?vt:St):t.last_lit&&(a(t,!1),0===t.strm.avail_out)?yt:_t}function g(t,e){for(var i,r,n;;){if(t.lookahead<ht){if(d(t),t.lookahead<ht&&e===D)return yt;if(0===t.lookahead)break}if(i=0,t.lookahead>=at&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+at-1])&t.hash_mask,i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=at-1,0!==i&&t.prev_length<t.max_lazy_match&&t.strstart-i<=t.w_size-ht&&(t.match_length=c(t,i),t.match_length<=5&&(t.strategy===q||t.match_length===at&&t.strstart-t.match_start>4096)&&(t.match_length=at-1)),t.prev_length>=at&&t.match_length<=t.prev_length){n=t.strstart+t.lookahead-at,r=P._tr_tally(t,t.strstart-1-t.prev_match,t.prev_length-at),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=n&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+at-1])&t.hash_mask,i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart)}while(0!=--t.prev_length);if(t.match_available=0,t.match_length=at-1,t.strstart++,r&&(a(t,!1),0===t.strm.avail_out))return yt}else if(t.match_available){if(r=P._tr_tally(t,0,t.window[t.strstart-1]),r&&a(t,!1),t.strstart++,t.lookahead--,0===t.strm.avail_out)return yt}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(r=P._tr_tally(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<at-1?t.strstart:at-1,e===F?(a(t,!0),0===t.strm.avail_out?vt:St):t.last_lit&&(a(t,!1),0===t.strm.avail_out)?yt:_t}function m(t,e){for(var i,r,n,o,s=t.window;;){if(t.lookahead<=lt){if(d(t),t.lookahead<=lt&&e===D)return yt;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=at&&t.strstart>0&&(n=t.strstart-1,(r=s[n])===s[++n]&&r===s[++n]&&r===s[++n])){o=t.strstart+lt;do{}while(r===s[++n]&&r===s[++n]&&r===s[++n]&&r===s[++n]&&r===s[++n]&&r===s[++n]&&r===s[++n]&&r===s[++n]&&n<o);t.match_length=lt-(o-n),t.match_length>t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=at?(i=P._tr_tally(t,1,t.match_length-at),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(i=P._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),i&&(a(t,!1),0===t.strm.avail_out))return yt}return t.insert=0,e===F?(a(t,!0),0===t.strm.avail_out?vt:St):t.last_lit&&(a(t,!1),0===t.strm.avail_out)?yt:_t}function E(t,e){for(var i;;){if(0===t.lookahead&&(d(t),0===t.lookahead)){if(e===D)return yt;break}if(t.match_length=0,i=P._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,i&&(a(t,!1),0===t.strm.avail_out))return yt}return t.insert=0,e===F?(a(t,!0),0===t.strm.avail_out?vt:St):t.last_lit&&(a(t,!1),0===t.strm.avail_out)?yt:_t}function y(t,e,i,r,n){this.good_length=t,this.max_lazy=e,this.nice_length=i,this.max_chain=r,this.func=n}function _(t){t.window_size=2*t.w_size,o(t.head),t.max_lazy_match=C[t.level].max_lazy,t.good_match=C[t.level].good_length,t.nice_match=C[t.level].nice_length,t.max_chain_length=C[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=at-1,t.match_available=0,t.ins_h=0}function v(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Q,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new A.Buf16(2*ot),this.dyn_dtree=new A.Buf16(2*(2*rt+1)),this.bl_tree=new A.Buf16(2*(2*nt+1)),o(this.dyn_ltree),o(this.dyn_dtree),o(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new A.Buf16(st+1),this.heap=new A.Buf16(2*it+1),o(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new A.Buf16(2*it+1),o(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function S(t){var e;return t&&t.state?(t.total_in=t.total_out=0,t.data_type=Z,e=t.state,e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap?ct:mt,t.adler=2===e.wrap?0:1,e.last_flush=D,P._tr_init(e),W):r(t,U)}function b(t){var e=S(t);return e===W&&_(t.state),e}function T(t,e){return t&&t.state?2!==t.state.wrap?U:(t.state.gzhead=e,W):U}function L(t,e,i,n,o,s){if(!t)return U;var a=1;if(e===z&&(e=6),n<0?(a=0,n=-n):n>15&&(a=2,n-=16),o<1||o>$||i!==Q||n<8||n>15||e<0||e>9||s<0||s>X)return r(t,U);8===n&&(n=9);var l=new v;return t.state=l,l.strm=t,l.wrap=a,l.gzhead=null,l.w_bits=n,l.w_size=1<<l.w_bits,l.w_mask=l.w_size-1,l.hash_bits=o+7,l.hash_size=1<<l.hash_bits,l.hash_mask=l.hash_size-1,l.hash_shift=~~((l.hash_bits+at-1)/at),l.window=new A.Buf8(2*l.w_size),l.head=new A.Buf16(l.hash_size),l.prev=new A.Buf16(l.w_size),l.lit_bufsize=1<<o+6,l.pending_buf_size=4*l.lit_bufsize,l.pending_buf=new A.Buf8(l.pending_buf_size),l.d_buf=1*l.lit_bufsize,l.l_buf=3*l.lit_bufsize,l.level=e,l.strategy=s,l.method=i,b(t)}function w(t,e){return L(t,e,Q,tt,et,J)}function R(t,e){var i,a,u,c;if(!t||!t.state||e>G||e<0)return t?r(t,U):U;if(a=t.state,!t.output||!t.input&&0!==t.avail_in||a.status===Et&&e!==F)return r(t,0===t.avail_out?j:U);if(a.strm=t,i=a.last_flush,a.last_flush=e,a.status===ct)if(2===a.wrap)t.adler=0,l(a,31),l(a,139),l(a,8),a.gzhead?(l(a,(a.gzhead.text?1:0)+(a.gzhead.hcrc?2:0)+(a.gzhead.extra?4:0)+(a.gzhead.name?8:0)+(a.gzhead.comment?16:0)),l(a,255&a.gzhead.time),l(a,a.gzhead.time>>8&255),l(a,a.gzhead.time>>16&255),l(a,a.gzhead.time>>24&255),l(a,9===a.level?2:a.strategy>=Y||a.level<2?4:0),l(a,255&a.gzhead.os),a.gzhead.extra&&a.gzhead.extra.length&&(l(a,255&a.gzhead.extra.length),l(a,a.gzhead.extra.length>>8&255)),a.gzhead.hcrc&&(t.adler=O(t.adler,a.pending_buf,a.pending,0)),a.gzindex=0,a.status=dt):(l(a,0),l(a,0),l(a,0),l(a,0),l(a,0),l(a,9===a.level?2:a.strategy>=Y||a.level<2?4:0),l(a,bt),a.status=mt);else{var d=Q+(a.w_bits-8<<4)<<8,p=-1;p=a.strategy>=Y||a.level<2?0:a.level<6?1:6===a.level?2:3,d|=p<<6,0!==a.strstart&&(d|=ut),d+=31-d%31,a.status=mt,h(a,d),0!==a.strstart&&(h(a,t.adler>>>16),h(a,65535&t.adler)),t.adler=1}if(a.status===dt)if(a.gzhead.extra){for(u=a.pending;a.gzindex<(65535&a.gzhead.extra.length)&&(a.pending!==a.pending_buf_size||(a.gzhead.hcrc&&a.pending>u&&(t.adler=O(t.adler,a.pending_buf,a.pending-u,u)),s(t),u=a.pending,a.pending!==a.pending_buf_size));)l(a,255&a.gzhead.extra[a.gzindex]),a.gzindex++;a.gzhead.hcrc&&a.pending>u&&(t.adler=O(t.adler,a.pending_buf,a.pending-u,u)),a.gzindex===a.gzhead.extra.length&&(a.gzindex=0,a.status=pt)}else a.status=pt;if(a.status===pt)if(a.gzhead.name){u=a.pending;do{if(a.pending===a.pending_buf_size&&(a.gzhead.hcrc&&a.pending>u&&(t.adler=O(t.adler,a.pending_buf,a.pending-u,u)),s(t),u=a.pending,a.pending===a.pending_buf_size)){c=1;break}c=a.gzindex<a.gzhead.name.length?255&a.gzhead.name.charCodeAt(a.gzindex++):0,l(a,c)}while(0!==c);a.gzhead.hcrc&&a.pending>u&&(t.adler=O(t.adler,a.pending_buf,a.pending-u,u)),0===c&&(a.gzindex=0,a.status=ft)}else a.status=ft;if(a.status===ft)if(a.gzhead.comment){u=a.pending;do{if(a.pending===a.pending_buf_size&&(a.gzhead.hcrc&&a.pending>u&&(t.adler=O(t.adler,a.pending_buf,a.pending-u,u)),s(t),u=a.pending,a.pending===a.pending_buf_size)){c=1;break}c=a.gzindex<a.gzhead.comment.length?255&a.gzhead.comment.charCodeAt(a.gzindex++):0,l(a,c)}while(0!==c);a.gzhead.hcrc&&a.pending>u&&(t.adler=O(t.adler,a.pending_buf,a.pending-u,u)),0===c&&(a.status=gt)}else a.status=gt;if(a.status===gt&&(a.gzhead.hcrc?(a.pending+2>a.pending_buf_size&&s(t),a.pending+2<=a.pending_buf_size&&(l(a,255&t.adler),l(a,t.adler>>8&255),t.adler=0,a.status=mt)):a.status=mt),0!==a.pending){if(s(t),0===t.avail_out)return a.last_flush=-1,W}else if(0===t.avail_in&&n(e)<=n(i)&&e!==F)return r(t,j);if(a.status===Et&&0!==t.avail_in)return r(t,j);if(0!==t.avail_in||0!==a.lookahead||e!==D&&a.status!==Et){var f=a.strategy===Y?E(a,e):a.strategy===H?m(a,e):C[a.level].func(a,e);if(f!==vt&&f!==St||(a.status=Et),f===yt||f===vt)return 0===t.avail_out&&(a.last_flush=-1),W;if(f===_t&&(e===k?P._tr_align(a):e!==G&&(P._tr_stored_block(a,0,0,!1),e===V&&(o(a.head),0===a.lookahead&&(a.strstart=0,a.block_start=0,a.insert=0))),s(t),0===t.avail_out))return a.last_flush=-1,W}return e!==F?W:a.wrap<=0?B:(2===a.wrap?(l(a,255&t.adler),l(a,t.adler>>8&255),l(a,t.adler>>16&255),l(a,t.adler>>24&255),l(a,255&t.total_in),l(a,t.total_in>>8&255),l(a,t.total_in>>16&255),l(a,t.total_in>>24&255)):(h(a,t.adler>>>16),h(a,65535&t.adler)),s(t),a.wrap>0&&(a.wrap=-a.wrap),0!==a.pending?W:B)}function x(t){var e;return t&&t.state?(e=t.state.status)!==ct&&e!==dt&&e!==pt&&e!==ft&&e!==gt&&e!==mt&&e!==Et?r(t,U):(t.state=null,e===mt?r(t,K):W):U}function M(t,e){var i,r,n,s,a,l,h,u,c=e.length
;if(!t||!t.state)return U;if(i=t.state,2===(s=i.wrap)||1===s&&i.status!==ct||i.lookahead)return U;for(1===s&&(t.adler=I(t.adler,e,c,0)),i.wrap=0,c>=i.w_size&&(0===s&&(o(i.head),i.strstart=0,i.block_start=0,i.insert=0),u=new A.Buf8(i.w_size),A.arraySet(u,e,c-i.w_size,i.w_size,0),e=u,c=i.w_size),a=t.avail_in,l=t.next_in,h=t.input,t.avail_in=c,t.next_in=0,t.input=e,d(i);i.lookahead>=at;){r=i.strstart,n=i.lookahead-(at-1);do{i.ins_h=(i.ins_h<<i.hash_shift^i.window[r+at-1])&i.hash_mask,i.prev[r&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=r,r++}while(--n);i.strstart=r,i.lookahead=at-1,d(i)}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=at-1,i.match_available=0,t.next_in=l,t.input=h,t.avail_in=a,i.wrap=s,W}var C,A=i(1),P=i(31),I=i(9),O=i(10),N=i(6),D=0,k=1,V=3,F=4,G=5,W=0,B=1,U=-2,K=-3,j=-5,z=-1,q=1,Y=2,H=3,X=4,J=0,Z=2,Q=8,$=9,tt=15,et=8,it=286,rt=30,nt=19,ot=2*it+1,st=15,at=3,lt=258,ht=lt+at+1,ut=32,ct=42,dt=69,pt=73,ft=91,gt=103,mt=113,Et=666,yt=1,_t=2,vt=3,St=4,bt=3;C=[new y(0,0,0,0,p),new y(4,4,8,4,f),new y(4,5,16,8,f),new y(4,6,32,32,f),new y(4,4,16,16,g),new y(8,16,32,32,g),new y(8,16,128,128,g),new y(8,32,128,256,g),new y(32,128,258,1024,g),new y(32,258,258,4096,g)],e.deflateInit=w,e.deflateInit2=L,e.deflateReset=b,e.deflateResetKeep=S,e.deflateSetHeader=T,e.deflate=R,e.deflateEnd=x,e.deflateSetDictionary=M,e.deflateInfo="pako deflate (from Nodeca project)"},function(t,e,i){function r(t){for(var e=t.length;--e>=0;)t[e]=0}function n(t,e,i,r,n){this.static_tree=t,this.extra_bits=e,this.extra_base=i,this.elems=r,this.max_length=n,this.has_stree=t&&t.length}function o(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}function s(t){return t<256?ot[t]:ot[256+(t>>>7)]}function a(t,e){t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255}function l(t,e,i){t.bi_valid>Y-i?(t.bi_buf|=e<<t.bi_valid&65535,a(t,t.bi_buf),t.bi_buf=e>>Y-t.bi_valid,t.bi_valid+=i-Y):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=i)}function h(t,e,i){l(t,i[2*e],i[2*e+1])}function u(t,e){var i=0;do{i|=1&t,t>>>=1,i<<=1}while(--e>0);return i>>>1}function c(t){16===t.bi_valid?(a(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)}function d(t,e){var i,r,n,o,s,a,l=e.dyn_tree,h=e.max_code,u=e.stat_desc.static_tree,c=e.stat_desc.has_stree,d=e.stat_desc.extra_bits,p=e.stat_desc.extra_base,f=e.stat_desc.max_length,g=0;for(o=0;o<=q;o++)t.bl_count[o]=0;for(l[2*t.heap[t.heap_max]+1]=0,i=t.heap_max+1;i<z;i++)r=t.heap[i],o=l[2*l[2*r+1]+1]+1,o>f&&(o=f,g++),l[2*r+1]=o,r>h||(t.bl_count[o]++,s=0,r>=p&&(s=d[r-p]),a=l[2*r],t.opt_len+=a*(o+s),c&&(t.static_len+=a*(u[2*r+1]+s)));if(0!==g){do{for(o=f-1;0===t.bl_count[o];)o--;t.bl_count[o]--,t.bl_count[o+1]+=2,t.bl_count[f]--,g-=2}while(g>0);for(o=f;0!==o;o--)for(r=t.bl_count[o];0!==r;)(n=t.heap[--i])>h||(l[2*n+1]!==o&&(t.opt_len+=(o-l[2*n+1])*l[2*n],l[2*n+1]=o),r--)}}function p(t,e,i){var r,n,o=new Array(q+1),s=0;for(r=1;r<=q;r++)o[r]=s=s+i[r-1]<<1;for(n=0;n<=e;n++){var a=t[2*n+1];0!==a&&(t[2*n]=u(o[a]++,a))}}function f(){var t,e,i,r,o,s=new Array(q+1);for(i=0,r=0;r<W-1;r++)for(at[r]=i,t=0;t<1<<$[r];t++)st[i++]=r;for(st[i-1]=r,o=0,r=0;r<16;r++)for(lt[r]=o,t=0;t<1<<tt[r];t++)ot[o++]=r;for(o>>=7;r<K;r++)for(lt[r]=o<<7,t=0;t<1<<tt[r]-7;t++)ot[256+o++]=r;for(e=0;e<=q;e++)s[e]=0;for(t=0;t<=143;)rt[2*t+1]=8,t++,s[8]++;for(;t<=255;)rt[2*t+1]=9,t++,s[9]++;for(;t<=279;)rt[2*t+1]=7,t++,s[7]++;for(;t<=287;)rt[2*t+1]=8,t++,s[8]++;for(p(rt,U+1,s),t=0;t<K;t++)nt[2*t+1]=5,nt[2*t]=u(t,5);ht=new n(rt,$,B+1,U,q),ut=new n(nt,tt,0,K,q),ct=new n(new Array(0),et,0,j,H)}function g(t){var e;for(e=0;e<U;e++)t.dyn_ltree[2*e]=0;for(e=0;e<K;e++)t.dyn_dtree[2*e]=0;for(e=0;e<j;e++)t.bl_tree[2*e]=0;t.dyn_ltree[2*X]=1,t.opt_len=t.static_len=0,t.last_lit=t.matches=0}function m(t){t.bi_valid>8?a(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0}function E(t,e,i,r){m(t),r&&(a(t,i),a(t,~i)),I.arraySet(t.pending_buf,t.window,e,i,t.pending),t.pending+=i}function y(t,e,i,r){var n=2*e,o=2*i;return t[n]<t[o]||t[n]===t[o]&&r[e]<=r[i]}function _(t,e,i){for(var r=t.heap[i],n=i<<1;n<=t.heap_len&&(n<t.heap_len&&y(e,t.heap[n+1],t.heap[n],t.depth)&&n++,!y(e,r,t.heap[n],t.depth));)t.heap[i]=t.heap[n],i=n,n<<=1;t.heap[i]=r}function v(t,e,i){var r,n,o,a,u=0;if(0!==t.last_lit)do{r=t.pending_buf[t.d_buf+2*u]<<8|t.pending_buf[t.d_buf+2*u+1],n=t.pending_buf[t.l_buf+u],u++,0===r?h(t,n,e):(o=st[n],h(t,o+B+1,e),a=$[o],0!==a&&(n-=at[o],l(t,n,a)),r--,o=s(r),h(t,o,i),0!==(a=tt[o])&&(r-=lt[o],l(t,r,a)))}while(u<t.last_lit);h(t,X,e)}function S(t,e){var i,r,n,o=e.dyn_tree,s=e.stat_desc.static_tree,a=e.stat_desc.has_stree,l=e.stat_desc.elems,h=-1;for(t.heap_len=0,t.heap_max=z,i=0;i<l;i++)0!==o[2*i]?(t.heap[++t.heap_len]=h=i,t.depth[i]=0):o[2*i+1]=0;for(;t.heap_len<2;)n=t.heap[++t.heap_len]=h<2?++h:0,o[2*n]=1,t.depth[n]=0,t.opt_len--,a&&(t.static_len-=s[2*n+1]);for(e.max_code=h,i=t.heap_len>>1;i>=1;i--)_(t,o,i);n=l;do{i=t.heap[1],t.heap[1]=t.heap[t.heap_len--],_(t,o,1),r=t.heap[1],t.heap[--t.heap_max]=i,t.heap[--t.heap_max]=r,o[2*n]=o[2*i]+o[2*r],t.depth[n]=(t.depth[i]>=t.depth[r]?t.depth[i]:t.depth[r])+1,o[2*i+1]=o[2*r+1]=n,t.heap[1]=n++,_(t,o,1)}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],d(t,e),p(o,h,t.bl_count)}function b(t,e,i){var r,n,o=-1,s=e[1],a=0,l=7,h=4;for(0===s&&(l=138,h=3),e[2*(i+1)+1]=65535,r=0;r<=i;r++)n=s,s=e[2*(r+1)+1],++a<l&&n===s||(a<h?t.bl_tree[2*n]+=a:0!==n?(n!==o&&t.bl_tree[2*n]++,t.bl_tree[2*J]++):a<=10?t.bl_tree[2*Z]++:t.bl_tree[2*Q]++,a=0,o=n,0===s?(l=138,h=3):n===s?(l=6,h=3):(l=7,h=4))}function T(t,e,i){var r,n,o=-1,s=e[1],a=0,u=7,c=4;for(0===s&&(u=138,c=3),r=0;r<=i;r++)if(n=s,s=e[2*(r+1)+1],!(++a<u&&n===s)){if(a<c)do{h(t,n,t.bl_tree)}while(0!=--a);else 0!==n?(n!==o&&(h(t,n,t.bl_tree),a--),h(t,J,t.bl_tree),l(t,a-3,2)):a<=10?(h(t,Z,t.bl_tree),l(t,a-3,3)):(h(t,Q,t.bl_tree),l(t,a-11,7));a=0,o=n,0===s?(u=138,c=3):n===s?(u=6,c=3):(u=7,c=4)}}function L(t){var e;for(b(t,t.dyn_ltree,t.l_desc.max_code),b(t,t.dyn_dtree,t.d_desc.max_code),S(t,t.bl_desc),e=j-1;e>=3&&0===t.bl_tree[2*it[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e}function w(t,e,i,r){var n;for(l(t,e-257,5),l(t,i-1,5),l(t,r-4,4),n=0;n<r;n++)l(t,t.bl_tree[2*it[n]+1],3);T(t,t.dyn_ltree,e-1),T(t,t.dyn_dtree,i-1)}function R(t){var e,i=4093624447;for(e=0;e<=31;e++,i>>>=1)if(1&i&&0!==t.dyn_ltree[2*e])return N;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return D;for(e=32;e<B;e++)if(0!==t.dyn_ltree[2*e])return D;return N}function x(t){dt||(f(),dt=!0),t.l_desc=new o(t.dyn_ltree,ht),t.d_desc=new o(t.dyn_dtree,ut),t.bl_desc=new o(t.bl_tree,ct),t.bi_buf=0,t.bi_valid=0,g(t)}function M(t,e,i,r){l(t,(V<<1)+(r?1:0),3),E(t,e,i,!0)}function C(t){l(t,F<<1,3),h(t,X,rt),c(t)}function A(t,e,i,r){var n,o,s=0;t.level>0?(t.strm.data_type===k&&(t.strm.data_type=R(t)),S(t,t.l_desc),S(t,t.d_desc),s=L(t),n=t.opt_len+3+7>>>3,(o=t.static_len+3+7>>>3)<=n&&(n=o)):n=o=i+5,i+4<=n&&-1!==e?M(t,e,i,r):t.strategy===O||o===n?(l(t,(F<<1)+(r?1:0),3),v(t,rt,nt)):(l(t,(G<<1)+(r?1:0),3),w(t,t.l_desc.max_code+1,t.d_desc.max_code+1,s+1),v(t,t.dyn_ltree,t.dyn_dtree)),g(t),r&&m(t)}function P(t,e,i){return t.pending_buf[t.d_buf+2*t.last_lit]=e>>>8&255,t.pending_buf[t.d_buf+2*t.last_lit+1]=255&e,t.pending_buf[t.l_buf+t.last_lit]=255&i,t.last_lit++,0===e?t.dyn_ltree[2*i]++:(t.matches++,e--,t.dyn_ltree[2*(st[i]+B+1)]++,t.dyn_dtree[2*s(e)]++),t.last_lit===t.lit_bufsize-1}var I=i(1),O=4,N=0,D=1,k=2,V=0,F=1,G=2,W=29,B=256,U=B+1+W,K=30,j=19,z=2*U+1,q=15,Y=16,H=7,X=256,J=16,Z=17,Q=18,$=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],tt=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],et=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],it=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],rt=new Array(2*(U+2));r(rt);var nt=new Array(2*K);r(nt);var ot=new Array(512);r(ot);var st=new Array(256);r(st);var at=new Array(W);r(at);var lt=new Array(K);r(lt);var ht,ut,ct,dt=!1;e._tr_init=x,e._tr_stored_block=M,e._tr_flush_block=A,e._tr_tally=P,e._tr_align=C},function(t,e,i){function r(t){if(!(this instanceof r))return new r(t);this.options=a.assign({chunkSize:16384,windowBits:0,to:""},t||{});var e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(e.windowBits>=0&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&0==(15&e.windowBits)&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new c,this.strm.avail_out=0;var i=s.inflateInit2(this.strm,e.windowBits);if(i!==h.Z_OK)throw new Error(u[i]);this.header=new d,s.inflateGetHeader(this.strm,this.header)}function n(t,e){var i=new r(e);if(i.push(t,!0),i.err)throw i.msg||u[i.err];return i.result}function o(t,e){return e=e||{},e.raw=!0,n(t,e)}var s=i(33),a=i(1),l=i(11),h=i(13),u=i(6),c=i(12),d=i(36),p=Object.prototype.toString;r.prototype.push=function(t,e){var i,r,n,o,u,c,d=this.strm,f=this.options.chunkSize,g=this.options.dictionary,m=!1;if(this.ended)return!1;r=e===~~e?e:!0===e?h.Z_FINISH:h.Z_NO_FLUSH,"string"==typeof t?d.input=l.binstring2buf(t):"[object ArrayBuffer]"===p.call(t)?d.input=new Uint8Array(t):d.input=t,d.next_in=0,d.avail_in=d.input.length;do{if(0===d.avail_out&&(d.output=new a.Buf8(f),d.next_out=0,d.avail_out=f),i=s.inflate(d,h.Z_NO_FLUSH),i===h.Z_NEED_DICT&&g&&(c="string"==typeof g?l.string2buf(g):"[object ArrayBuffer]"===p.call(g)?new Uint8Array(g):g,i=s.inflateSetDictionary(this.strm,c)),i===h.Z_BUF_ERROR&&!0===m&&(i=h.Z_OK,m=!1),i!==h.Z_STREAM_END&&i!==h.Z_OK)return this.onEnd(i),this.ended=!0,!1;d.next_out&&(0!==d.avail_out&&i!==h.Z_STREAM_END&&(0!==d.avail_in||r!==h.Z_FINISH&&r!==h.Z_SYNC_FLUSH)||("string"===this.options.to?(n=l.utf8border(d.output,d.next_out),o=d.next_out-n,u=l.buf2string(d.output,n),d.next_out=o,d.avail_out=f-o,o&&a.arraySet(d.output,d.output,n,o,0),this.onData(u)):this.onData(a.shrinkBuf(d.output,d.next_out)))),0===d.avail_in&&0===d.avail_out&&(m=!0)}while((d.avail_in>0||0===d.avail_out)&&i!==h.Z_STREAM_END);return i===h.Z_STREAM_END&&(r=h.Z_FINISH),r===h.Z_FINISH?(i=s.inflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===h.Z_OK):r!==h.Z_SYNC_FLUSH||(this.onEnd(h.Z_OK),d.avail_out=0,!0)},r.prototype.onData=function(t){this.chunks.push(t)},r.prototype.onEnd=function(t){t===h.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=a.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},e.Inflate=r,e.inflate=n,e.inflateRaw=o,e.ungzip=n},function(t,e,i){function r(t){return(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24)}function n(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new y.Buf16(320),this.work=new y.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function o(t){var e;return t&&t.state?(e=t.state,t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=V,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new y.Buf32(gt),e.distcode=e.distdyn=new y.Buf32(mt),e.sane=1,e.back=-1,C):I}function s(t){var e;return t&&t.state?(e=t.state,e.wsize=0,e.whave=0,e.wnext=0,o(t)):I}function a(t,e){var i,r;return t&&t.state?(r=t.state,e<0?(i=0,e=-e):(i=1+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?I:(null!==r.window&&r.wbits!==e&&(r.window=null),r.wrap=i,r.wbits=e,s(t))):I}function l(t,e){var i,r;return t?(r=new n,t.state=r,r.window=null,i=a(t,e),i!==C&&(t.state=null),i):I}function h(t){return l(t,Et)}function u(t){if(yt){var e;for(m=new y.Buf32(512),E=new y.Buf32(32),e=0;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(b(L,t.lens,0,288,m,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;b(w,t.lens,0,32,E,0,t.work,{bits:5}),yt=!1}t.lencode=m,t.lenbits=9,t.distcode=E,t.distbits=5}function c(t,e,i,r){var n,o=t.state;return null===o.window&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new y.Buf8(o.wsize)),r>=o.wsize?(y.arraySet(o.window,e,i-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):(n=o.wsize-o.wnext,n>r&&(n=r),y.arraySet(o.window,e,i-r,n,o.wnext),r-=n,r?(y.arraySet(o.window,e,i-r,r,0),o.wnext=r,o.whave=o.wsize):(o.wnext+=n,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=n))),0}function d(t,e){var i,n,o,s,a,l,h,d,p,f,g,m,E,gt,mt,Et,yt,_t,vt,St,bt,Tt,Lt,wt,Rt=0,xt=new y.Buf8(4),Mt=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!t||!t.state||!t.output||!t.input&&0!==t.avail_in)return I;i=t.state,i.mode===H&&(i.mode=X),a=t.next_out,o=t.output,h=t.avail_out,s=t.next_in,n=t.input,l=t.avail_in,d=i.hold,p=i.bits,f=l,g=h,Tt=C;t:for(;;)switch(i.mode){case V:if(0===i.wrap){i.mode=X;break}for(;p<16;){if(0===l)break t;l--,d+=n[s++]<<p,p+=8}if(2&i.wrap&&35615===d){i.check=0,xt[0]=255&d,xt[1]=d>>>8&255,i.check=v(i.check,xt,2,0),d=0,p=0,i.mode=F;break}if(i.flags=0,i.head&&(i.head.done=!1),!(1&i.wrap)||(((255&d)<<8)+(d>>8))%31){t.msg="incorrect header check",i.mode=dt;break}if((15&d)!==k){t.msg="unknown compression method",i.mode=dt;break}if(d>>>=4,p-=4,bt=8+(15&d),0===i.wbits)i.wbits=bt;else if(bt>i.wbits){t.msg="invalid window size",i.mode=dt;break}i.dmax=1<<bt,t.adler=i.check=1,i.mode=512&d?q:H,d=0,p=0;break;case F:for(;p<16;){if(0===l)break t;l--,d+=n[s++]<<p,p+=8}if(i.flags=d,(255&i.flags)!==k){t.msg="unknown compression method",i.mode=dt;break}if(57344&i.flags){t.msg="unknown header flags set",i.mode=dt;break}i.head&&(i.head.text=d>>8&1),512&i.flags&&(xt[0]=255&d,xt[1]=d>>>8&255,i.check=v(i.check,xt,2,0)),d=0,p=0,i.mode=G;case G:for(;p<32;){if(0===l)break t;l--,d+=n[s++]<<p,p+=8}i.head&&(i.head.time=d),512&i.flags&&(xt[0]=255&d,xt[1]=d>>>8&255,xt[2]=d>>>16&255,xt[3]=d>>>24&255,i.check=v(i.check,xt,4,0)),d=0,p=0,i.mode=W;case W:for(;p<16;){if(0===l)break t;l--,d+=n[s++]<<p,p+=8}i.head&&(i.head.xflags=255&d,i.head.os=d>>8),512&i.flags&&(xt[0]=255&d,xt[1]=d>>>8&255,i.check=v(i.check,xt,2,0)),d=0,p=0,i.mode=B;case B:if(1024&i.flags){for(;p<16;){if(0===l)break t;l--,d+=n[s++]<<p,p+=8}i.length=d,i.head&&(i.head.extra_len=d),512&i.flags&&(xt[0]=255&d,xt[1]=d>>>8&255,i.check=v(i.check,xt,2,0)),d=0,p=0}else i.head&&(i.head.extra=null);i.mode=U;case U:if(1024&i.flags&&(m=i.length,m>l&&(m=l),m&&(i.head&&(bt=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Array(i.head.extra_len)),y.arraySet(i.head.extra,n,s,m,bt)),512&i.flags&&(i.check=v(i.check,n,m,s)),l-=m,s+=m,i.length-=m),i.length))break t;i.length=0,i.mode=K;case K:if(2048&i.flags){if(0===l)break t;m=0;do{bt=n[s+m++],i.head&&bt&&i.length<65536&&(i.head.name+=String.fromCharCode(bt))}while(bt&&m<l);if(512&i.flags&&(i.check=v(i.check,n,m,s)),l-=m,s+=m,bt)break t}else i.head&&(i.head.name=null);i.length=0,i.mode=j;case j:if(4096&i.flags){if(0===l)break t;m=0;do{bt=n[s+m++],i.head&&bt&&i.length<65536&&(i.head.comment+=String.fromCharCode(bt))}while(bt&&m<l);if(512&i.flags&&(i.check=v(i.check,n,m,s)),l-=m,s+=m,bt)break t}else i.head&&(i.head.comment=null);i.mode=z;case z:if(512&i.flags){for(;p<16;){if(0===l)break t;l--,d+=n[s++]<<p,p+=8}if(d!==(65535&i.check)){t.msg="header crc mismatch",i.mode=dt;break}d=0,p=0}i.head&&(i.head.hcrc=i.flags>>9&1,i.head.done=!0),t.adler=i.check=0,i.mode=H;break;case q:for(;p<32;){if(0===l)break t;l--,d+=n[s++]<<p,p+=8}t.adler=i.check=r(d),d=0,p=0,i.mode=Y;case Y:if(0===i.havedict)return t.next_out=a,t.avail_out=h,t.next_in=s,t.avail_in=l,i.hold=d,i.bits=p,P;t.adler=i.check=1,i.mode=H;case H:if(e===x||e===M)break t;case X:if(i.last){d>>>=7&p,p-=7&p,i.mode=ht;break}for(;p<3;){if(0===l)break t;l--,d+=n[s++]<<p,p+=8}switch(i.last=1&d,d>>>=1,p-=1,3&d){case 0:i.mode=J;break;case 1:if(u(i),i.mode=it,e===M){d>>>=2,p-=2;break t}break;case 2:i.mode=$;break;case 3:t.msg="invalid block type",i.mode=dt}d>>>=2,p-=2;break;case J:for(d>>>=7&p,p-=7&p;p<32;){if(0===l)break t;l--,d+=n[s++]<<p,p+=8}if((65535&d)!=(d>>>16^65535)){t.msg="invalid stored block lengths",i.mode=dt;break}if(i.length=65535&d,d=0,p=0,i.mode=Z,e===M)break t;case Z:i.mode=Q;case Q:if(m=i.length){if(m>l&&(m=l),m>h&&(m=h),0===m)break t;y.arraySet(o,n,s,m,a),l-=m,s+=m,h-=m,a+=m,i.length-=m;break}i.mode=H;break;case $:for(;p<14;){if(0===l)break t;l--,d+=n[s++]<<p,p+=8}if(i.nlen=257+(31&d),d>>>=5,p-=5,i.ndist=1+(31&d),d>>>=5,p-=5,i.ncode=4+(15&d),d>>>=4,p-=4,i.nlen>286||i.ndist>30){t.msg="too many length or distance symbols",i.mode=dt;break}i.have=0,i.mode=tt;case tt:for(;i.have<i.ncode;){for(;p<3;){if(0===l)break t;l--,d+=n[s++]<<p,p+=8}i.lens[Mt[i.have++]]=7&d,d>>>=3,p-=3}for(;i.have<19;)i.lens[Mt[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,Lt={bits:i.lenbits},Tt=b(T,i.lens,0,19,i.lencode,0,i.work,Lt),i.lenbits=Lt.bits,Tt){t.msg="invalid code lengths set",i.mode=dt;break}i.have=0,i.mode=et;case et:for(;i.have<i.nlen+i.ndist;){for(;Rt=i.lencode[d&(1<<i.lenbits)-1],mt=Rt>>>24,Et=Rt>>>16&255,yt=65535&Rt,!(mt<=p);){if(0===l)break t;l--,d+=n[s++]<<p,p+=8}if(yt<16)d>>>=mt,p-=mt,i.lens[i.have++]=yt;else{if(16===yt){for(wt=mt+2;p<wt;){if(0===l)break t;l--,d+=n[s++]<<p,p+=8}if(d>>>=mt,p-=mt,0===i.have){t.msg="invalid bit length repeat",i.mode=dt;break}bt=i.lens[i.have-1],m=3+(3&d),d>>>=2,p-=2}else if(17===yt){for(wt=mt+3;p<wt;){if(0===l)break t;l--,d+=n[s++]<<p,p+=8}d>>>=mt,p-=mt,bt=0,m=3+(7&d),d>>>=3,p-=3}else{for(wt=mt+7;p<wt;){if(0===l)break t;l--,d+=n[s++]<<p,p+=8}d>>>=mt,p-=mt,bt=0,m=11+(127&d),d>>>=7,p-=7}if(i.have+m>i.nlen+i.ndist){t.msg="invalid bit length repeat",i.mode=dt;break}for(;m--;)i.lens[i.have++]=bt}}if(i.mode===dt)break;if(0===i.lens[256]){t.msg="invalid code -- missing end-of-block",i.mode=dt;break}if(i.lenbits=9,Lt={bits:i.lenbits},Tt=b(L,i.lens,0,i.nlen,i.lencode,0,i.work,Lt),i.lenbits=Lt.bits,Tt){t.msg="invalid literal/lengths set",i.mode=dt;break}if(i.distbits=6,i.distcode=i.distdyn,Lt={bits:i.distbits},Tt=b(w,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,Lt),i.distbits=Lt.bits,Tt){t.msg="invalid distances set",i.mode=dt;break}if(i.mode=it,e===M)break t;case it:i.mode=rt;case rt:if(l>=6&&h>=258){t.next_out=a,t.avail_out=h,t.next_in=s,t.avail_in=l,i.hold=d,i.bits=p,S(t,g),a=t.next_out,o=t.output,h=t.avail_out,s=t.next_in,n=t.input,l=t.avail_in,d=i.hold,p=i.bits,i.mode===H&&(i.back=-1);break}for(i.back=0;Rt=i.lencode[d&(1<<i.lenbits)-1],mt=Rt>>>24,Et=Rt>>>16&255,yt=65535&Rt,!(mt<=p);){if(0===l)break t;l--,d+=n[s++]<<p,p+=8}if(Et&&0==(240&Et)){for(_t=mt,vt=Et,St=yt;Rt=i.lencode[St+((d&(1<<_t+vt)-1)>>_t)],mt=Rt>>>24,Et=Rt>>>16&255,yt=65535&Rt,!(_t+mt<=p);){if(0===l)break t;l--,d+=n[s++]<<p,p+=8}d>>>=_t,p-=_t,i.back+=_t}if(d>>>=mt,p-=mt,i.back+=mt,i.length=yt,0===Et){i.mode=lt;break}if(32&Et){i.back=-1,i.mode=H;break}if(64&Et){t.msg="invalid literal/length code",i.mode=dt;break}i.extra=15&Et,i.mode=nt;case nt:if(i.extra){for(wt=i.extra;p<wt;){if(0===l)break t;l--,d+=n[s++]<<p,p+=8}i.length+=d&(1<<i.extra)-1,d>>>=i.extra,p-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=ot;case ot:for(;Rt=i.distcode[d&(1<<i.distbits)-1],mt=Rt>>>24,Et=Rt>>>16&255,yt=65535&Rt,!(mt<=p);){if(0===l)break t;l--,d+=n[s++]<<p,p+=8}if(0==(240&Et)){for(_t=mt,vt=Et,St=yt;Rt=i.distcode[St+((d&(1<<_t+vt)-1)>>_t)],mt=Rt>>>24,Et=Rt>>>16&255,yt=65535&Rt,!(_t+mt<=p);){if(0===l)break t;l--,d+=n[s++]<<p,p+=8}d>>>=_t,p-=_t,i.back+=_t}if(d>>>=mt,p-=mt,i.back+=mt,64&Et){t.msg="invalid distance code",i.mode=dt;break}i.offset=yt,i.extra=15&Et,i.mode=st;case st:if(i.extra){for(wt=i.extra;p<wt;){if(0===l)break t;l--,d+=n[s++]<<p,p+=8}i.offset+=d&(1<<i.extra)-1,d>>>=i.extra,p-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){t.msg="invalid distance too far back",i.mode=dt;break}i.mode=at;case at:if(0===h)break t;if(m=g-h,i.offset>m){if((m=i.offset-m)>i.whave&&i.sane){t.msg="invalid distance too far back",i.mode=dt;break}m>i.wnext?(m-=i.wnext,E=i.wsize-m):E=i.wnext-m,m>i.length&&(m=i.length),gt=i.window}else gt=o,E=a-i.offset,m=i.length;m>h&&(m=h),h-=m,i.length-=m;do{o[a++]=gt[E++]}while(--m);0===i.length&&(i.mode=rt);break;case lt:if(0===h)break t;o[a++]=i.length,h--,i.mode=rt;break;case ht:if(i.wrap){for(;p<32;){if(0===l)break t;l--,d|=n[s++]<<p,p+=8}if(g-=h,t.total_out+=g,i.total+=g,g&&(t.adler=i.check=i.flags?v(i.check,o,g,a-g):_(i.check,o,g,a-g)),g=h,(i.flags?d:r(d))!==i.check){t.msg="incorrect data check",i.mode=dt;break}d=0,p=0}i.mode=ut;case ut:if(i.wrap&&i.flags){for(;p<32;){if(0===l)break t;l--,d+=n[s++]<<p,p+=8}if(d!==(4294967295&i.total)){t.msg="incorrect length check",i.mode=dt;break}d=0,p=0}i.mode=ct;case ct:Tt=A;break t;case dt:Tt=O;break t;case pt:return N;case ft:default:return I}return t.next_out=a,t.avail_out=h,t.next_in=s,t.avail_in=l,i.hold=d,i.bits=p,(i.wsize||g!==t.avail_out&&i.mode<dt&&(i.mode<ht||e!==R))&&c(t,t.output,t.next_out,g-t.avail_out)?(i.mode=pt,N):(f-=t.avail_in,g-=t.avail_out,t.total_in+=f,t.total_out+=g,i.total+=g,i.wrap&&g&&(t.adler=i.check=i.flags?v(i.check,o,g,t.next_out-g):_(i.check,o,g,t.next_out-g)),t.data_type=i.bits+(i.last?64:0)+(i.mode===H?128:0)+(i.mode===it||i.mode===Z?256:0),(0===f&&0===g||e===R)&&Tt===C&&(Tt=D),Tt)}function p(t){if(!t||!t.state)return I;var e=t.state;return e.window&&(e.window=null),t.state=null,C}function f(t,e){var i;return t&&t.state?(i=t.state,0==(2&i.wrap)?I:(i.head=e,e.done=!1,C)):I}function g(t,e){var i,r,n=e.length;return t&&t.state?(i=t.state,0!==i.wrap&&i.mode!==Y?I:i.mode===Y&&(r=1,(r=_(r,e,n,0))!==i.check)?O:c(t,e,n,n)?(i.mode=pt,N):(i.havedict=1,C)):I}var m,E,y=i(1),_=i(9),v=i(10),S=i(34),b=i(35),T=0,L=1,w=2,R=4,x=5,M=6,C=0,A=1,P=2,I=-2,O=-3,N=-4,D=-5,k=8,V=1,F=2,G=3,W=4,B=5,U=6,K=7,j=8,z=9,q=10,Y=11,H=12,X=13,J=14,Z=15,Q=16,$=17,tt=18,et=19,it=20,rt=21,nt=22,ot=23,st=24,at=25,lt=26,ht=27,ut=28,ct=29,dt=30,pt=31,ft=32,gt=852,mt=592,Et=15,yt=!0;e.inflateReset=s,e.inflateReset2=a,e.inflateResetKeep=o,e.inflateInit=h,e.inflateInit2=l,e.inflate=d,e.inflateEnd=p,e.inflateGetHeader=f,e.inflateSetDictionary=g,e.inflateInfo="pako inflate (from Nodeca project)"},function(t,e,i){t.exports=function(t,e){var i,r,n,o,s,a,l,h,u,c,d,p,f,g,m,E,y,_,v,S,b,T,L,w,R;i=t.state,r=t.next_in,w=t.input,n=r+(t.avail_in-5),o=t.next_out,R=t.output,s=o-(e-t.avail_out),a=o+(t.avail_out-257),l=i.dmax,h=i.wsize,u=i.whave,c=i.wnext,d=i.window,p=i.hold,f=i.bits,g=i.lencode,m=i.distcode,E=(1<<i.lenbits)-1,y=(1<<i.distbits)-1;t:do{f<15&&(p+=w[r++]<<f,f+=8,p+=w[r++]<<f,f+=8),_=g[p&E];e:for(;;){if(v=_>>>24,p>>>=v,f-=v,0===(v=_>>>16&255))R[o++]=65535&_;else{if(!(16&v)){if(0==(64&v)){_=g[(65535&_)+(p&(1<<v)-1)];continue e}if(32&v){i.mode=12;break t}t.msg="invalid literal/length code",i.mode=30;break t}S=65535&_,v&=15,v&&(f<v&&(p+=w[r++]<<f,f+=8),S+=p&(1<<v)-1,p>>>=v,f-=v),f<15&&(p+=w[r++]<<f,f+=8,p+=w[r++]<<f,f+=8),_=m[p&y];i:for(;;){if(v=_>>>24,p>>>=v,f-=v,!(16&(v=_>>>16&255))){if(0==(64&v)){_=m[(65535&_)+(p&(1<<v)-1)];continue i}t.msg="invalid distance code",i.mode=30;break t}if(b=65535&_,v&=15,f<v&&(p+=w[r++]<<f,(f+=8)<v&&(p+=w[r++]<<f,f+=8)),(b+=p&(1<<v)-1)>l){t.msg="invalid distance too far back",i.mode=30;break t}if(p>>>=v,f-=v,v=o-s,b>v){if((v=b-v)>u&&i.sane){t.msg="invalid distance too far back",i.mode=30;break t}if(T=0,L=d,0===c){if(T+=h-v,v<S){S-=v;do{R[o++]=d[T++]}while(--v);T=o-b,L=R}}else if(c<v){if(T+=h+c-v,(v-=c)<S){S-=v;do{R[o++]=d[T++]}while(--v);if(T=0,c<S){v=c,S-=v;do{R[o++]=d[T++]}while(--v);T=o-b,L=R}}}else if(T+=c-v,v<S){S-=v;do{R[o++]=d[T++]}while(--v);T=o-b,L=R}for(;S>2;)R[o++]=L[T++],R[o++]=L[T++],R[o++]=L[T++],S-=3;S&&(R[o++]=L[T++],S>1&&(R[o++]=L[T++]))}else{T=o-b;do{R[o++]=R[T++],R[o++]=R[T++],R[o++]=R[T++],S-=3}while(S>2);S&&(R[o++]=R[T++],S>1&&(R[o++]=R[T++]))}break}}break}}while(r<n&&o<a);S=f>>3,r-=S,f-=S<<3,p&=(1<<f)-1,t.next_in=r,t.next_out=o,t.avail_in=r<n?n-r+5:5-(r-n),t.avail_out=o<a?a-o+257:257-(o-a),i.hold=p,i.bits=f}},function(t,e,i){var r=i(1),n=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],o=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],s=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],a=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];t.exports=function(t,e,i,l,h,u,c,d){var p,f,g,m,E,y,_,v,S,b=d.bits,T=0,L=0,w=0,R=0,x=0,M=0,C=0,A=0,P=0,I=0,O=null,N=0,D=new r.Buf16(16),k=new r.Buf16(16),V=null,F=0;for(T=0;T<=15;T++)D[T]=0;for(L=0;L<l;L++)D[e[i+L]]++;for(x=b,R=15;R>=1&&0===D[R];R--);if(x>R&&(x=R),0===R)return h[u++]=20971520,h[u++]=20971520,d.bits=1,0;for(w=1;w<R&&0===D[w];w++);for(x<w&&(x=w),A=1,T=1;T<=15;T++)if(A<<=1,(A-=D[T])<0)return-1;if(A>0&&(0===t||1!==R))return-1;for(k[1]=0,T=1;T<15;T++)k[T+1]=k[T]+D[T];for(L=0;L<l;L++)0!==e[i+L]&&(c[k[e[i+L]]++]=L);if(0===t?(O=V=c,y=19):1===t?(O=n,N-=257,V=o,F-=257,y=256):(O=s,V=a,y=-1),I=0,L=0,T=w,E=u,M=x,C=0,g=-1,P=1<<x,m=P-1,1===t&&P>852||2===t&&P>592)return 1;for(;;){_=T-C,c[L]<y?(v=0,S=c[L]):c[L]>y?(v=V[F+c[L]],S=O[N+c[L]]):(v=96,S=0),p=1<<T-C,f=1<<M,w=f;do{f-=p,h[E+(I>>C)+f]=_<<24|v<<16|S|0}while(0!==f);for(p=1<<T-1;I&p;)p>>=1;if(0!==p?(I&=p-1,I+=p):I=0,L++,0==--D[T]){if(T===R)break;T=e[i+c[L]]}if(T>x&&(I&m)!==g){for(0===C&&(C=x),E+=w,M=T-C,A=1<<M;M+C<R&&!((A-=D[M+C])<=0);)M++,A<<=1;if(P+=1<<M,1===t&&P>852||2===t&&P>592)return 1;g=I&m,h[g]=x<<24|M<<16|E-u|0}}return 0!==I&&(h[E+I]=T-C<<24|64<<16|0),d.bits=x,0}},function(t,e,i){function r(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}t.exports=r},function(t,e,i){var r=i(0),n=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117];t.exports=function(t,e){if(void 0===t||!t.length)return 0;var i="string"!==r.getTypeOf(t);void 0===e&&(e=0);var o=0,s=0,a=0;e^=-1;for(var l=0,h=t.length;l<h;l++)a=i?t[l]:t.charCodeAt(l),s=255&(e^a),o=n[s],e=e>>>8^o;return-1^e}},function(t,e,i){var r=i(0),n=function(){this.data=[]};n.prototype={append:function(t){t=r.transformTo("string",t),this.data.push(t)},finalize:function(){return this.data.join("")}},t.exports=n},function(t,e,i){var r=i(0),n=function(t){this.data=new Uint8Array(t),this.index=0};n.prototype={append:function(t){0!==t.length&&(t=r.transformTo("uint8array",t),this.data.set(t,this.index),this.index+=t.length)},finalize:function(){return this.data}},t.exports=n},function(t,e,i){var r=i(3),n=i(17),o=i(0),s=i(41);t.exports=function(t,e){var i,a,l,h;for(e=o.extend(e||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:n.utf8decode}),e.base64&&(t=r.decode(t)),a=new s(t,e),i=a.files,l=0;l<i.length;l++)h=i[l],this.file(h.fileNameStr,h.decompressed,{binary:!0,optimizedBinaryString:!0,date:h.date,dir:h.dir,comment:h.fileCommentStr.length?h.fileCommentStr:null,unixPermissions:h.unixPermissions,dosPermissions:h.dosPermissions,createFolders:e.createFolders});return a.zipComment.length&&(this.comment=a.zipComment),this}},function(t,e,i){function r(t,e){this.files=[],this.loadOptions=e,t&&this.load(t)}var n=i(18),o=i(42),s=i(20),a=i(21),l=i(0),h=i(14),u=i(43),c=i(2);i(4);r.prototype={checkSignature:function(t){var e=this.reader.readString(4);if(e!==t)throw new Error("Corrupted zip or bug : unexpected signature ("+l.pretty(e)+", expected "+l.pretty(t)+")")},isSignature:function(t,e){var i=this.reader.index;this.reader.setIndex(t);var r=this.reader.readString(4),n=r===e;return this.reader.setIndex(i),n},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var t=this.reader.readData(this.zipCommentLength),e=c.uint8array?"uint8array":"array",i=l.transformTo(e,t);this.zipComment=this.loadOptions.decodeFileName(i)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.versionMadeBy=this.reader.readString(2),this.versionNeeded=this.reader.readInt(2),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var t,e,i,r=this.zip64EndOfCentralSize-44;0<r;)t=this.reader.readInt(2),e=this.reader.readInt(4),i=this.reader.readString(e),this.zip64ExtensibleData[t]={id:t,length:e,value:i}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),this.disksCount>1)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var t,e;for(t=0;t<this.files.length;t++)e=this.files[t],this.reader.setIndex(e.localHeaderOffset),this.checkSignature(h.LOCAL_FILE_HEADER),e.readLocalPart(this.reader),e.handleUTF8(),e.processAttributes()},readCentralDir:function(){var t
;for(this.reader.setIndex(this.centralDirOffset);this.reader.readString(4)===h.CENTRAL_FILE_HEADER;)t=new u({zip64:this.zip64},this.loadOptions),t.readCentralPart(this.reader),this.files.push(t);if(this.centralDirRecords!==this.files.length&&0!==this.centralDirRecords&&0===this.files.length)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var t=this.reader.lastIndexOfSignature(h.CENTRAL_DIRECTORY_END);if(t<0){throw!this.isSignature(0,h.LOCAL_FILE_HEADER)?new Error("Can't find end of central directory : is this a zip file ? If it is, see http://stuk.github.io/jszip/documentation/howto/read_zip.html"):new Error("Corrupted zip : can't find end of central directory")}this.reader.setIndex(t);var e=t;if(this.checkSignature(h.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===l.MAX_VALUE_16BITS||this.diskWithCentralDirStart===l.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===l.MAX_VALUE_16BITS||this.centralDirRecords===l.MAX_VALUE_16BITS||this.centralDirSize===l.MAX_VALUE_32BITS||this.centralDirOffset===l.MAX_VALUE_32BITS){if(this.zip64=!0,(t=this.reader.lastIndexOfSignature(h.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip : can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(t),this.checkSignature(h.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,h.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(h.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip : can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(h.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var i=this.centralDirOffset+this.centralDirSize;this.zip64&&(i+=20,i+=12+this.zip64EndOfCentralSize);var r=e-i;if(r>0)this.isSignature(e,h.CENTRAL_FILE_HEADER)||(this.reader.zero=r);else if(r<0)throw new Error("Corrupted zip: missing "+Math.abs(r)+" bytes.")},prepareReader:function(t){var e=l.getTypeOf(t);if(l.checkSupport(e),"string"!==e||c.uint8array)if("nodebuffer"===e)this.reader=new o(t);else if(c.uint8array)this.reader=new s(l.transformTo("uint8array",t));else{if(!c.array)throw new Error("Unexpected error: unsupported type '"+e+"'");this.reader=new a(l.transformTo("array",t))}else this.reader=new n(t,this.loadOptions.optimizedBinaryString)},load:function(t){this.prepareReader(t),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},t.exports=r},function(t,e,i){function r(t){this.data=t,this.length=this.data.length,this.index=0,this.zero=0}var n=i(20);r.prototype=new n,r.prototype.readData=function(t){this.checkOffset(t);var e=this.data.slice(this.zero+this.index,this.zero+this.index+t);return this.index+=t,e},t.exports=r},function(t,e,i){function r(t,e){this.options=t,this.loadOptions=e}var n=i(18),o=i(0),s=i(16),a=i(4),l=i(2);r.prototype={isEncrypted:function(){return 1==(1&this.bitFlag)},useUTF8:function(){return 2048==(2048&this.bitFlag)},prepareCompressedContent:function(t,e,i){return function(){var r=t.index;t.setIndex(e);var n=t.readData(i);return t.setIndex(r),n}},prepareContent:function(t,e,i,r,n){return function(){var t=o.transformTo(r.uncompressInputType,this.getCompressedContent()),e=r.uncompress(t);if(e.length!==n)throw new Error("Bug : uncompressed data size mismatch");return e}},readLocalPart:function(t){var e,i;if(t.skip(22),this.fileNameLength=t.readInt(2),i=t.readInt(2),this.fileName=t.readData(this.fileNameLength),t.skip(i),-1==this.compressedSize||-1==this.uncompressedSize)throw new Error("Bug or corrupted zip : didn't get enough informations from the central directory (compressedSize == -1 || uncompressedSize == -1)");if(null===(e=o.findCompression(this.compressionMethod)))throw new Error("Corrupted zip : compression "+o.pretty(this.compressionMethod)+" unknown (inner file : "+o.transformTo("string",this.fileName)+")");if(this.decompressed=new s,this.decompressed.compressedSize=this.compressedSize,this.decompressed.uncompressedSize=this.uncompressedSize,this.decompressed.crc32=this.crc32,this.decompressed.compressionMethod=this.compressionMethod,this.decompressed.getCompressedContent=this.prepareCompressedContent(t,t.index,this.compressedSize,e),this.decompressed.getContent=this.prepareContent(t,t.index,this.compressedSize,e,this.uncompressedSize),this.loadOptions.checkCRC32&&(this.decompressed=o.transformTo("string",this.decompressed.getContent()),a.crc32(this.decompressed)!==this.crc32))throw new Error("Corrupted zip : CRC32 mismatch")},readCentralPart:function(t){if(this.versionMadeBy=t.readInt(2),this.versionNeeded=t.readInt(2),this.bitFlag=t.readInt(2),this.compressionMethod=t.readString(2),this.date=t.readDate(),this.crc32=t.readInt(4),this.compressedSize=t.readInt(4),this.uncompressedSize=t.readInt(4),this.fileNameLength=t.readInt(2),this.extraFieldsLength=t.readInt(2),this.fileCommentLength=t.readInt(2),this.diskNumberStart=t.readInt(2),this.internalFileAttributes=t.readInt(2),this.externalFileAttributes=t.readInt(4),this.localHeaderOffset=t.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");this.fileName=t.readData(this.fileNameLength),this.readExtraFields(t),this.parseZIP64ExtraField(t),this.fileComment=t.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var t=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),0===t&&(this.dosPermissions=63&this.externalFileAttributes),3===t&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||"/"!==this.fileNameStr.slice(-1)||(this.dir=!0)},parseZIP64ExtraField:function(t){if(this.extraFields[1]){var e=new n(this.extraFields[1].value);this.uncompressedSize===o.MAX_VALUE_32BITS&&(this.uncompressedSize=e.readInt(8)),this.compressedSize===o.MAX_VALUE_32BITS&&(this.compressedSize=e.readInt(8)),this.localHeaderOffset===o.MAX_VALUE_32BITS&&(this.localHeaderOffset=e.readInt(8)),this.diskNumberStart===o.MAX_VALUE_32BITS&&(this.diskNumberStart=e.readInt(4))}},readExtraFields:function(t){var e,i,r,n=t.index;for(this.extraFields=this.extraFields||{};t.index<n+this.extraFieldsLength;)e=t.readInt(2),i=t.readInt(2),r=t.readString(i),this.extraFields[e]={id:e,length:i,value:r}},handleUTF8:function(){var t=l.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=a.utf8decode(this.fileName),this.fileCommentStr=a.utf8decode(this.fileComment);else{var e=this.findExtraFieldUnicodePath();if(null!==e)this.fileNameStr=e;else{var i=o.transformTo(t,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(i)}var r=this.findExtraFieldUnicodeComment();if(null!==r)this.fileCommentStr=r;else{var n=o.transformTo(t,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(n)}}},findExtraFieldUnicodePath:function(){var t=this.extraFields[28789];if(t){var e=new n(t.value);return 1!==e.readInt(1)?null:a.crc32(this.fileName)!==e.readInt(4)?null:a.utf8decode(e.readString(t.length-5))}return null},findExtraFieldUnicodeComment:function(){var t=this.extraFields[25461];if(t){var e=new n(t.value);return 1!==e.readInt(1)?null:a.crc32(this.fileComment)!==e.readInt(4)?null:a.utf8decode(e.readString(t.length-5))}return null}},t.exports=r},function(t,e,i){var r=i(0);e.string2binary=function(t){return r.string2binary(t)},e.string2Uint8Array=function(t){return r.transformTo("uint8array",t)},e.uint8Array2String=function(t){return r.transformTo("string",t)},e.string2Blob=function(t){var e=r.transformTo("arraybuffer",t);return r.arrayBuffer2Blob(e)},e.arrayBuffer2Blob=function(t){return r.arrayBuffer2Blob(t)},e.transformTo=function(t,e){return r.transformTo(t,e)},e.getTypeOf=function(t){return r.getTypeOf(t)},e.checkSupport=function(t){return r.checkSupport(t)},e.MAX_VALUE_16BITS=r.MAX_VALUE_16BITS,e.MAX_VALUE_32BITS=r.MAX_VALUE_32BITS,e.pretty=function(t){return r.pretty(t)},e.findCompression=function(t){return r.findCompression(t)},e.isRegExp=function(t){return r.isRegExp(t)}}])}),i("formats/kml/KmlFileCache",[],function(){"use strict";var t=function(){this._rootFile=null,this._map={}};return t.prototype.retrieve=function(t){if(0==t.indexOf("#")||null==t||0!=t.indexOf("http"))return this._rootFile;var e=t;return-1!=t.indexOf("#")&&(e=t.substr(0,t.indexOf("#")-1)),this._map[e]?this._map[e]:null},t.prototype.add=function(t,e){this._rootFile?this._map[t]=e:this._rootFile=e},t}),i("formats/kml/styles/KmlStyleSelector",["./../KmlObject"],function(t){"use strict";var e=function(e){t.call(this,e)};return e.prototype=Object.create(t.prototype),e.prototype.getTagNames=function(){return["Style","StyleMap"]},e}),i("formats/kml/styles/KmlPolyStyle",["../../../util/Color","./KmlColorStyle","./../KmlElements","../util/NodeTransformers"],function(t,e,i,r){"use strict";var n=function(t){e.call(this,t)};return n.prototype=Object.create(e.prototype),Object.defineProperties(n.prototype,{kmlFill:{get:function(){return this._factory.specific(this,{name:"fill",transformer:r.boolean})}},kmlOutline:{get:function(){return this._factory.specific(this,{name:"outline",transformer:r.boolean})}}}),n.update=function(e,i){e=e||{};var r=i||{};return r._drawInterior=e.kmlFill||!0,r._drawOutline=e.kmlOutline||!1,r._outlineColor=i._outlineColor||t.WHITE,r._interiorColor=e.kmlColor&&t.colorFromKmlHex(e.kmlColor)||t.WHITE,r._colorMode=e.kmlColorMode||"normal",r},n.prototype.getTagNames=function(){return["PolyStyle"]},i.addKey(n.prototype.getTagNames()[0],n),n}),i("formats/kml/KmlLink",["./KmlElements","./KmlObject","./util/NodeTransformers"],function(t,e,i){"use strict";var r=function(t){e.call(this,t),this.onChangeListeners=[]};return r.prototype=Object.create(e.prototype),Object.defineProperties(r.prototype,{kmlHref:{get:function(){return this._factory.specific(this,{name:"href",transformer:i.string})}},kmlRefreshMode:{get:function(){return this._factory.specific(this,{name:"refreshMode",transformer:i.string})}},kmlRefreshInterval:{get:function(){return this._factory.specific(this,{name:"refreshInterval",transformer:i.number})}},kmlViewRefreshMode:{get:function(){return this._factory.specific(this,{name:"viewRefreshMode",transformer:i.string})}},kmlViewRefreshTime:{get:function(){return this._factory.specific(this,{name:"viewRefreshTime",transformer:i.number})}},kmlViewBoundScale:{get:function(){return this._factory.specific(this,{name:"viewBoundScale",transformer:i.number})}},kmlViewFormat:{get:function(){return this._factory.specific(this,{name:"viewFormat",transformer:i.string})}},kmlHttpQuery:{get:function(){return this._factory.specific(this,{name:"httpQuery",transformer:i.string})}}}),r.prototype.getTagNames=function(){return["Link"]},t.addKey(r.prototype.getTagNames()[0],r),r}),i("formats/kml/KmlIcon",["./KmlLink","./KmlElements","./util/NodeTransformers"],function(t,e,i){"use strict";var r=function(e){t.call(this,e)};return r.prototype=Object.create(t.prototype),Object.defineProperties(r.prototype,{kmlX:{get:function(){return this._factory.specific(this,{name:"gx:x",transformer:i.number})}},kmlY:{get:function(){return this._factory.specific(this,{name:"gx:y",transformer:i.number})}},kmlW:{get:function(){return this._factory.specific(this,{name:"gx:w",transformer:i.number})}},kmlH:{get:function(){return this._factory.specific(this,{name:"gx:h",transformer:i.number})}}}),r.prototype.getTagNames=function(){return["Icon"]},e.addKey(r.prototype.getTagNames()[0],r),r}),i("formats/kml/styles/KmlIconStyle",["./KmlColorStyle","./../KmlElements","../KmlIcon","../util/NodeTransformers"],function(t,e,i,r){"use strict";var n=function(e){t.call(this,e)};return n.prototype=Object.create(t.prototype),Object.defineProperties(n.prototype,{kmlScale:{get:function(){return this._factory.specific(this,{name:"scale",transformer:r.number})}},kmlHeading:{get:function(){return this._factory.specific(this,{name:"heading",transformer:r.number})}},kmlIcon:{get:function(){return this._factory.any(this,{name:i.prototype.getTagNames()})}},kmlHotSpotX:{get:function(){return this._factory.specific(this,{name:"hotSpot",transformer:r.attribute("x")})}},kmlHotSpotY:{get:function(){return this._factory.specific(this,{name:"hotSpot",transformer:r.attribute("y")})}},kmlHotSpotXUnits:{get:function(){return this._factory.specific(this,{name:"hotSpot",transformer:r.attribute("xunits")})}},kmlHotSpotYUnits:{get:function(){return this._factory.specific(this,{name:"hotSpot",transformer:r.attribute("yunits")})}}}),n.update=function(t,e){t=t||{};var i=e||{};return i._imageScale=t.kmlScale||1,i._imageSource=t.kmlIcon&&t.kmlIcon.kmlHref||null,i},n.prototype.getTagNames=function(){return["IconStyle"]},e.addKey(n.prototype.getTagNames()[0],n),n}),i("formats/kml/styles/KmlLabelStyle",["./KmlColorStyle","../KmlElements","../util/NodeTransformers"],function(t,e,i){"use strict";var r=function(e){t.call(this,e)};return r.prototype=Object.create(t.prototype),Object.defineProperties(r.prototype,{kmlScale:{get:function(){return this._factory.specific(this,{name:"scale",transformer:i.number})}}}),r.update=function(){},r.prototype.getTagNames=function(){return["LabelStyle"]},e.addKey(r.prototype.getTagNames()[0],r),r}),i("formats/kml/styles/KmlLineStyle",["../../../util/Color","./KmlColorStyle","./../KmlElements","../util/NodeTransformers"],function(t,e,i,r){"use strict";var n=function(t){e.call(this,t)};return n.prototype=Object.create(e.prototype),Object.defineProperties(n.prototype,{kmlWidth:{get:function(){return this._factory.specific(this,{name:"width",transformer:r.number})}},kmlOuterColor:{get:function(){return this._factory.specific(this,{name:"gx:outerColor",transformer:r.string})}},kmlOuterWidth:{get:function(){return this._factory.specific(this,{name:"gx:outerWidth",transformer:r.number})}},kmlPhysicalWidth:{get:function(){return this._factory.specific(this,{name:"gx:physicalWidth",transformer:r.number})}},kmlLabelVisibility:{get:function(){return this._factory.specific(this,{name:"gx:labelVisibility",transformer:r.boolean})}}}),n.update=function(e,i){var r=i||{};return e=e||{},r._outlineColor=e.kmlColor&&t.colorFromKmlHex(e.kmlColor)||t.WHITE,r._outlineWidth=e.kmlWidth||10,r},n.prototype.getTagNames=function(){return["LineStyle"]},i.addKey(n.prototype.getTagNames()[0],n),n}),i("formats/kml/styles/KmlListStyle",["../util/ItemIcon","../KmlElements","./KmlSubStyle","../util/NodeTransformers"],function(t,e,i,r){"use strict";var n=function(t){i.call(this,t)};return n.prototype=Object.create(i.prototype),Object.defineProperties(n.prototype,{kmlBgColor:{get:function(){return this._factory.specific(this,{name:"bgColor",transformer:r.string})}},kmlListItemType:{get:function(){return this._factory.specific(this,{name:"listItemType",transformer:r.string})}},kmlItemIcon:{get:function(){return this._factory.any(this,{name:t.prototype.getTagNames()})}}}),n.update=function(t){},n.prototype.getTagNames=function(){return["ListStyle"]},e.addKey(n.prototype.getTagNames()[0],n),n}),i("formats/kml/styles/KmlStyle",["../../../util/Color","../../../util/Font","./KmlStyleSelector","./../KmlElements","./KmlPolyStyle","./KmlIconStyle","./KmlLabelStyle","./KmlLineStyle","./KmlListStyle","./KmlBalloonStyle","../../../util/Offset","../../../util/Promise","../../../shapes/ShapeAttributes","../../../shapes/TextAttributes"],function(t,e,i,r,n,o,s,a,l,h,u,c,d,p){"use strict";var f=function(t){i.call(this,t)};return f.prototype=Object.create(i.prototype),Object.defineProperties(f.prototype,{kmlIconStyle:{get:function(){return this._factory.any(this,{name:o.prototype.getTagNames()})}},kmlLabelStyle:{get:function(){return this._factory.any(this,{name:s.prototype.getTagNames()})}},kmlLineStyle:{get:function(){return this._factory.any(this,{name:a.prototype.getTagNames()})}},kmlPolyStyle:{get:function(){return this._factory.any(this,{name:n.prototype.getTagNames()})}},kmlBalloonStyle:{get:function(){return this._factory.any(this,{name:h.prototype.getTagNames()})}},kmlListStyle:{get:function(){return this._factory.any(this,{name:l.prototype.getTagNames()})}}}),f.prototype.generate=function(t){t=t||{};var e=this||{};return e.kmlIconStyle&&o.update(e.kmlIconStyle,t),e.kmlListStyle&&l.update(e.kmlListStyle,t),e.kmlBalloonStyle&&h.update(e.kmlBalloonStyle,t),e.kmlLabelStyle&&s.update(e.kmlLabelStyle,t),e.kmlPolyStyle&&n.update(e.kmlPolyStyle,t),e.kmlLineStyle&&a.update(e.kmlLineStyle,t),t},f.prototype.getStyle=function(){var t=this;return new c(function(e){window.setTimeout(function(){e(t)},0)})},f.prototype.getTagNames=function(){return["Style"]},r.addKey(f.prototype.getTagNames()[0],f),f.placemarkAttributes=function(e){return e=e||{},e._imageColor=e._imageColor||new t(1,1,1,1),e._imageOffset=e._imageOffset||new u(WorldWind.OFFSET_FRACTION,.5,WorldWind.OFFSET_FRACTION,.5),e._imageScale=e._imageScale||1,e._imageSource=e._imageSource||null,e._depthTest=e._depthTest||!0,e._labelAttributes=e._labelAttributes||new p(f.textAttributes()),e._drawLeaderLine=e._drawLeaderLine||!1,e._leaderLineAttributes=e._leaderLineAttributes||new d(f.shapeAttributes()),e},f.textAttributes=function(i){return i=i||{},i._color=i._color||new t(1,1,1,1),i._font=i._font||new e(14),i._offset=i._offset||new u(WorldWind.OFFSET_FRACTION,.5,WorldWind.OFFSET_FRACTION,0),i._scale=i._scale||1,i._depthTest=i._depthTest||!1,i},f.shapeAttributes=function(e){return e=e||{},e._drawInterior=e._drawInterior||!0,e._drawOutline=e._drawOutline||!0,e._enableLighting=e._enableLighting||!1,e._interiorColor=e._interiorColor||t.WHITE,e._outlineColor=e._outlineColor||t.RED,e._outlineWidth=e._outlineWidth||1,e._outlineStippleFactor=e._outlineStippleFactor||0,e._outlineStipplePattern=e._outlineStipplePattern||61680,e._imageSource=e._imageSource||null,e._depthTest=e._depthTest||!0,e._drawVerticals=e._drawVerticals||!1,e._applyLighting=e._applyLighting||!1,e},f.default=function(){return new f({objectNode:document.createElement("Style")})},f}),i("formats/kml/util/StyleResolver",["../KmlFile","../styles/KmlStyle","../../../util/Logger"],function(t,e,i){"use strict";var r=function(t){this._fileCache=t};return r.prototype.handleRemoteStyle=function(t,r,n,o,s){t?this.handleStyleUrl(t,n,o,s):r?this.handleStyleSelector(r,n,o):(i.logMessage(i.LEVEL_WARNING,"StyleResolver","handleRemoteStyle","Style was null."),n(e.default()))},r.prototype.handleStyleUrl=function(t,e,i,r){var n=this;r=this.handlePromiseOfFile(t,r),r.then(function(i){i.resolveStyle(t).then(function(t){t.isMap?t.resolve(e,n):e({normal:t,highlight:null})})})},r.prototype.handlePromiseOfFile=function(t,e){return e||(e=this._fileCache.retrieve(t))||(e=new WorldWind.KmlFile({url:t}),this._fileCache.add(e)),e},r.prototype.handleStyleSelector=function(t,e,i){t.isMap?t.resolve(e,this):window.setTimeout(function(){e({normal:t,highlight:null})},0)},r}),i("formats/kml/util/Pair",["./../KmlElements","../KmlObject","../styles/KmlStyleSelector","./NodeTransformers","../../../util/Promise","../util/StyleResolver"],function(t,e,i,r,n,o){"use strict";var s=function(t){e.call(this,t)};return s.prototype=Object.create(e.prototype),Object.defineProperties(s.prototype,{kmlKey:{get:function(){return this._factory.specific(this,{name:"key",transformer:r.string})}},kmlStyleUrl:{get:function(){return this._factory.specific(this,{name:"styleUrl",transformer:r.string})}},kmlStyleSelector:{get:function(){return this._factory.any(this,{name:i.prototype.getTagNames()})}}}),s.prototype.getTagNames=function(){return["Pair"]},s.prototype.getStyle=function(t){var e=this;return new n(function(i,r){window.setTimeout(function(){t.handleRemoteStyle(e.kmlStyleUrl,e.kmlStyleSelector,i,r)},0)})},t.addKey(s.prototype.getTagNames()[0],s),s}),i("formats/kml/styles/KmlStyleMap",["../KmlElements","./KmlSubStyle","../util/Pair","../../../util/Promise"],function(t,e,i,r){"use strict";var n=function(t){e.call(this,t)};return n.prototype=Object.create(e.prototype),Object.defineProperties(n.prototype,{kmlPairs:{get:function(){return this._factory.all(this)}},isMap:{get:function(){return!0}}}),n.prototype.resolve=function(t,e){var i=this,n={},o=[];i.kmlPairs.forEach(function(t){var i=t.kmlKey,r=t.getStyle(e);o.push(r),r.then(function(t){n[i]=t.normal})}),r.all(o).then(function(){n.normal||(n.normal=null),n.highlight||(n.highlight=null),t(n)})},n.prototype.getTagNames=function(){return["StyleMap"]},t.addKey(n.prototype.getTagNames()[0],n),n}),i("formats/kml/KmlTimeSpan",["./KmlElements","./KmlTimePrimitive","./util/NodeTransformers"],function(t,e,i){"use strict";var r=function(t){t.isTimeSpan=!0,e.call(this,t)};return r.prototype=Object.create(e.prototype),Object.defineProperties(r.prototype,{kmlBegin:{get:function(){return this._factory.specific(this,{name:"begin",transformer:i.date})}},kmlEnd:{get:function(){return this._factory.specific(this,{name:"end",transformer:i.date})}}}),r.prototype.getTagNames=function(){return["TimeSpan"]},t.addKey(r.prototype.getTagNames()[0],r),r}),i("formats/kml/KmlTimeStamp",["./KmlElements","./KmlTimePrimitive","./util/NodeTransformers"],function(t,e,i){"use strict";var r=function(t){t.isTimeStamp=!0,e.call(this,t)};return r.prototype=Object.create(e.prototype),Object.defineProperties(r.prototype,{kmlWhen:{get:function(){return this._factory.specific(this,{name:"when",transformer:i.date})}}}),r.prototype.getTagNames=function(){return["TimeStamp"]},t.addKey(r.prototype.getTagNames()[0],r),r}),i("formats/kml/util/RefreshListener",[],function(){var t=function(){this.currentActiveEvents=[]};return t.prototype.addEvent=function(t){var e=this;setTimeout(function(){e.currentActiveEvents.push(t)},t.time)},t.prototype.getActiveEvents=function(){var t=this.currentActiveEvents.slice();return this.currentActiveEvents=[],t},t.Event=function(t,e,i){this.type=t,this.payload=i,this.time=e},t}),i("formats/kml/util/RemoteFile",["../../../error/ArgumentError","../../../util/Logger","../../../util/Promise"],function(t,e,i){"use strict";var r=function(i){if(!i.ajax&&!i.zip)throw new t(e.logMessage(e.LEVEL_SEVERE,"RemoteDocument","constructor","Invalid option for retrieval specified. Use either ajax or zip option."));this.options=i};return r.prototype.get=function(){var i=this.options;if(i.ajax)return this.ajax(i.url,i);if(i.zip)return i.responseType=i.responseType||"arraybuffer",this.ajax(i.url,i);throw new t(e.logMessage(e.LEVEL_SEVERE,"RemoteDocument","constructor","Invalid option for retrieval specified. Use either ajax or zip option."))},r.prototype.ajax=function(t,r){return new i(function(i,n){var o=new XMLHttpRequest;o.open("GET",t,!0),r.responseType&&(o.responseType=r.responseType),o.onreadystatechange=function(){if(4===o.readyState)if(200===o.status){var n;n="arraybuffer"==r.responseType?this.response:this.responseText,i({text:n,headers:o.getAllResponseHeaders()})}else e.log(e.LEVEL_WARNING,"KmlFile retrieval failed ("+o.statusText+"): "+t)},o.onerror=function(){e.log(e.LEVEL_WARNING,"Remote file retrieval failed: "+t),n()}.bind(this),o.ontimeout=function(){e.log(e.LEVEL_WARNING,"Remote file retrieval timed out: "+t),n()}.bind(this),o.send(null)})},r}),i("util/XmlDocument",["../error/ArgumentError","../util/Logger"],function(t,e){var i=function(t){this._document=t};return i.prototype.dom=function(){if(DOMParser){var i=new DOMParser,r=i.parseFromString(this._document,"text/xml");if(r.getElementsByTagName("parsererror").length||!r)throw new t(e.logMessage(e.LEVEL_SEVERE,"XmlDocument","dom","Invalid XML document. "+r.getElementsByTagName("parsererror")[0].innerHTML));return r}var n=new ActiveXObject("Microsoft.XMLDOM");return n.async=!1,n.loadXML(text),n},i.isValid=function(t){try{return new i(t).dom(),!0}catch(t){return!1}},i}),i("formats/kml/KmlFile",["../../error/ArgumentError","../../util/jszip","./KmlElements","./KmlFileCache","./KmlObject","./styles/KmlStyle","./styles/KmlStyleMap","./KmlTimeSpan","./KmlTimeStamp","../../util/Logger","../../util/Promise","./util/RefreshListener","./util/RemoteFile","./util/StyleResolver","../../util/XmlDocument","../../util/WWUtil"],function(t,e,i,r,n,o,s,a,l,h,u,c,d,p,f,g){"use strict";var m=function(i,o){var s=this;if(!i)throw new t(h.logMessage(h.LEVEL_SEVERE,"KmlFile","constructor","invalidDocumentPassed"));this._controls=o||null,this._fileCache=new r,this._styleResolver=new p(this._fileCache),this._listener=new c,this._headers=null;var a;return a=new u(function(t){s.requestRemote(i).then(function(r){var a=null,l=r.text;if(s._headers=r.headers,s.hasExtension("kmz",i)){var h=new e;h.load(l);for(var u in h.files){var c=h.files[u];null==a&&s.hasExtension("kml",c.name)&&(a=c.asText())}}else a=l;s._document=new f(a).dom(),n.call(s,{objectNode:s._document.documentElement,controls:o}),window.setTimeout(function(){t(s)},0)})}),this._fileCache.add(i,a),a};return m.prototype=Object.create(n.prototype),Object.defineProperties(m.prototype,{shapes:{get:function(){return this._factory.all(this)}}}),m.prototype.render=function(t,e){var i=this;e=e||{},this.shapes.forEach(function(r){r.render(t,{lastStyle:e.lastStyle||null,lastVisibility:e.lastVisibility||null,currentTimeInterval:e.currentTimeInterval||null,regionInvisible:e.regionInvisible||null,fileCache:i._fileCache,styleResolver:i._styleResolver,listener:i._listener,activeEvents:i._listener.getActiveEvents()})})},m.prototype.hasExtension=function(t,e){return g.endsWith(e,"."+t)},m.prototype.requestRemote=function(t){var e={};return e.url=t,this.hasExtension("kmz",t)?e.zip=!0:e.ajax=!0,new d(e).get()},m.prototype.resolveStyle=function(t){var e=this,i=t.substring(t.indexOf("#")+1,t.length);return new u(function(t,r){var n;n=e._document.querySelector?e._document.querySelector("*[id='"+i+"']"):e._document.getElementById(i),n&&null!=n||r(),n.nodeName==o.prototype.getTagNames()[0]?t(new o({objectNode:n},{styleResolver:e._styleResolver})):n.nodeName==s.prototype.getTagNames()[0]?t(new s({objectNode:n},{styleResolver:e._styleResolver})):h.logMessage(h.LEVEL_WARNING,"KmlFile","resolveStyle","Style must contain either Style node or StyleMap node.")})},m.prototype.getExpired=function(){var t=new Date(this._headers.getRequestHeader("Expires"));return(new Date).getTime-t.getTime()},m}),i("formats/kml/KmlLatLonAltBox",["./KmlElements","./KmlObject","./util/NodeTransformers"],function(t,e,i){"use strict";var r=function(t){e.call(this,t)};return r.prototype=Object.create(e.prototype),Object.defineProperties(r.prototype,{kmlNorth:{get:function(){return this._factory.specific(this,{name:"north",transformer:i.number})}},kmlSouth:{get:function(){return this._factory.specific(this,{name:"south",transformer:i.number})}},kmlEast:{get:function(){return this._factory.specific(this,{name:"east",transformer:i.number})}},kmlWest:{get:function(){return this._factory.specific(this,{name:"west",transformer:i.number})}},kmlMinAltitude:{get:function(){return this._factory.specific(this,{name:"minAltitude",transformer:i.number})}},kmlMaxAltitude:{get:function(){return this._factory.specific(this,{name:"maxAltitude",transformer:i.number})}}}),r.prototype.getTagNames=function(){return["LatLonAltBox"]},t.addKey(r.prototype.getTagNames()[0],r),r}),i("formats/kml/KmlLod",["./KmlElements","./KmlObject","./util/NodeTransformers"],function(t,e,i){"use strict";var r=function(t){e.call(this,t)};return r.prototype=Object.create(e.prototype),Object.defineProperties(r.prototype,{kmlMinLodPixels:{get:function(){return this._factory.specific(this,{name:"minLodPixels",transformer:i.number})}},kmlMaxLodPixels:{get:function(){return this._factory.specific(this,{name:"maxLodPixels",transformer:i.number})}},kmlMinFadeExtent:{get:function(){return this._factory.specific(this,{name:"minFadeExtent",transformer:i.number})}},kmlMaxFadeExtent:{get:function(){return this._factory.specific(this,{name:"maxFadeExtent",transformer:i.number})}}}),r.prototype.getTagNames=function(){return["Lod"]},t.addKey(r.prototype.getTagNames()[0],r),r}),i("formats/kml/KmlRegion",["../../geom/BoundingBox","../../util/Color","./KmlElements","./KmlLatLonAltBox","./KmlLod","./KmlObject","./styles/KmlStyle","./util/NodeTransformers","../../geom/Sector"],function(t,e,i,r,n,o,s,a,l){"use strict";var h=function(t){o.call(this,t)};return h.prototype=Object.create(o.prototype),Object.defineProperties(h.prototype,{kmlLatLonAltBox:{get:function(){return this._factory.specific(this,{name:r.prototype.getTagNames(),transformer:a.kmlObject})}},kmlLod:{get:function(){return this._factory.specific(this,{name:n.prototype.getTagNames(),transformer:a.kmlObject})}}}),h.prototype.intersectsVisible=function(e){var i=this.kmlLatLonAltBox,r=new t;return r.setToSector(new l(i.kmlSouth,i.kmlNorth,i.kmlWest,i.kmlEast),e.globe,i.kmlMinAltitude,i.kmlMaxAltitude),r.intersectsFrustum(e.navigatorState.frustumInModelCoordinates)&&(!i.kmlMinAltitude||e.eyePosition.altitude>i.kmlMinAltitude)&&(!i.kmlMaxAltitude||e.eyePosition.altitude<i.kmlMaxAltitude)},h.prototype.getTagNames=function(){return["Region"]},i.addKey(h.prototype.getTagNames()[0],h),h}),i("formats/kml/features/KmlFeature",["./../KmlObject","../KmlAbstractView","../KmlFile","../styles/KmlStyleMap","../styles/KmlStyleSelector","../KmlRegion","../KmlTimePrimitive","../util/NodeTransformers","../../../util/Promise"],function(t,e,i,r,n,o,s,a,l){"use strict";var h=function(e){this.isFeature=e.isFeature=!0,t.call(this,e),this._pStyle=null,this.controlledVisibility=null};return h.prototype=Object.create(t.prototype),Object.defineProperties(h.prototype,{style:{get:function(){return this._pStyle}},kmlName:{get:function(){return this._factory.specific(this,{name:"name",transformer:a.string})}},kmlVisibility:{get:function(){return this._factory.specific(this,{name:"visibility",transformer:a.boolean})}},kmlOpen:{get:function(){return this._factory.specific(this,{name:"open",transformer:a.boolean})}},kmlAddress:{get:function(){return this._factory.specific(this,{name:"address",transformer:a.string})}},kmlPhoneNumber:{get:function(){return this._factory.specific(this,{name:"phoneNumber",transformer:a.string})}},kmlDescription:{get:function(){return this._factory.specific(this,{name:"description",transformer:a.string})}},kmlStyleUrl:{get:function(){return this._factory.specific(this,{name:"styleUrl",transformer:a.string})}},kmlSnippet:{get:function(){return this._factory.specific(this,{name:"Snippet",transformer:a.string})}},kmlAbstractView:{get:function(){return this._factory.any(this,{name:e.prototype.getTagNames()})}},kmlTimePrimitive:{get:function(){return this._factory.any(this,{name:s.prototype.getTagNames()})}},kmlStyleSelector:{get:function(){return this._factory.any(this,{name:n.prototype.getTagNames()})}},kmlRegion:{get:function(){return this._factory.any(this,{name:o.prototype.getTagNames()})}}}),h.prototype.render=function(e,i){t.prototype.render.call(this,e,i),this.solveStyle(e,i),this.solveVisibility(e,i)},h.prototype.solveStyle=function(t,e){this.getStyle(t,e),null!=this.style&&(e.lastStyle=this.style)},h.prototype.solveRegion=function(t){return!this.kmlRegion||this.kmlRegion.intersectsVisible(t)},h.prototype.solveVisibility=function(t,e){var i=!1!==e.lastVisibility,r=this.solveTimeVisibility(t),n=this.solveRegion(t),o=!1!==this.kmlVisibility,s=!1!==this.controlledVisibility;this.enabled=i&&r&&n&&o&&s,e.lastVisibility=this.enabled,this._renderable&&(this._renderable.enabled=this.enabled)},h.prototype.solveTimeVisibility=function(t){var e=this.kmlTimePrimitive&&this.kmlTimePrimitive.timeRange();if(t.currentLayer.currentTimeInterval&&e){var i=t.currentLayer.currentTimeInterval[0],r=t.currentLayer.currentTimeInterval[1];if(e&&(e.from<i||e.from>r||e.to>r))return!1}return!0},h.prototype.getStyle=function(t,e){if(!this._pStyle){var i=this;new l(function(t,r){window.setTimeout(function(){e.styleResolver.handleRemoteStyle(i.kmlStyleUrl,i.kmlStyleSelector,t,r)},0)}).then(function(e){i._pStyle=e,t.redrawRequested=!0})}},
h.prototype.getTagNames=function(){return["NetworkLink","Placemark","PhotoOverlay","ScreenOverlay","GroundOverlay","Folder","Document"]},h}),i("formats/kml/features/KmlContainer",["./KmlFeature"],function(t){"use strict";var e=function(e){t.call(this,e)};return e.prototype=Object.create(t.prototype),Object.defineProperties(e.prototype,{kmlShapes:{get:function(){return this._factory.all(this).filter(function(t){return t.isFeature})}}}),e.prototype.render=function(e,i){t.prototype.render.call(this,e,i);var r=this;this.kmlShapes.forEach(function(t){t.render(e,{lastStyle:i.lastStyle,lastVisibility:r.enabled,currentTimeInterval:i.currentTimeInterval,regionInvisible:i.regionInvisible,fileCache:i.fileCache,styleResolver:i.styleResolver,listener:i.listener,activeEvents:i.activeEvents})})},e.prototype.getTagNames=function(){return["Folder","Document"]},e}),i("formats/kml/controls/KmlControls",["../../../util/Logger"],function(t){"use strict";var e=function(){};return e.prototype.hook=function(){t.logMessage(t.LEVEL_WARNING,"KmlControls","hook","Every KML controls should override hook method.")},e}),i("formats/kml/util/Schema",["./../KmlElements","../KmlObject"],function(t,e){"use strict";var i=function(t){e.call(this,t)};return i.prototype=Object.create(e.prototype),i.prototype.getTagNames=function(){return["Schema"]},t.addKey(i.prototype.getTagNames()[0],i),i}),i("formats/kml/features/KmlDocument",["./KmlContainer","../KmlElements","./KmlFeature","../util/Schema"],function(t,e,i,r){"use strict";var n=function(e){t.call(this,e)};return n.prototype=Object.create(t.prototype),Object.defineProperties(n.prototype,{kmlSchemas:{get:function(){return this._factory.all(this).filter(function(t){return t instanceof r})}}}),n.prototype.getTagNames=function(){return["Document"]},e.addKey(n.prototype.getTagNames()[0],n),n}),i("formats/kml/features/KmlFolder",["./KmlContainer","./../KmlElements"],function(t,e){"use strict";var i=function(e){t.call(this,e)};return i.prototype=Object.create(t.prototype),i.prototype.getTagNames=function(){return["Folder"]},e.addKey(i.prototype.getTagNames()[0],i),i}),i("formats/kml/geom/KmlGeometry",["../KmlObject"],function(t){"use strict";var e=function(e){t.call(this,e),this._renderable=null};return e.prototype=Object.create(t.prototype),e.prototype.render=function(e,i){t.prototype.render.call(this,e,i),this.enabled=i.lastVisibility},e.prototype.getTagNames=e.getTagNames=function(){return["Point","LinearRing","LineString","MultiGeometry","Polygon"]},e}),i("formats/kml/KmlLatLonBox",["./KmlElements","./KmlObject","./util/NodeTransformers"],function(t,e,i){"use strict";var r=function(t){e.call(this,t)};return r.prototype=Object.create(e.prototype),Object.defineProperties(r.prototype,{kmlNorth:{get:function(){return this._factory.specific(this,{name:"north",transformer:i.number})}},kmlSouth:{get:function(){return this._factory.specific(this,{name:"south",transformer:i.number})}},kmlEast:{get:function(){return this._factory.specific(this,{name:"east",transformer:i.number})}},kmlWest:{get:function(){return this._factory.specific(this,{name:"west",transformer:i.number})}},kmlRotation:{get:function(){return this._factory.specific(this,{name:"rotation",transformer:i.string})}}}),r.prototype.getTagNames=function(){return["LatLonBox"]},t.addKey(r.prototype.getTagNames()[0],r),r}),i("formats/kml/KmlLatLonQuad",["./KmlElements","./KmlObject","./util/NodeTransformers"],function(t,e,i){"use strict";var r=function(t){e.call(this,t)};return r.prototype=Object.create(e.prototype),Object.defineProperties(r.prototype,{kmlCoordinates:{get:function(){return this._factory.specific(this,{name:"coordinates",transformer:i.string})}}}),r.prototype.getTagNames=function(){return["gx:LatLonQuad"]},t.addKey(r.prototype.getTagNames()[0],r),r}),i("formats/kml/features/KmlOverlay",["./KmlFeature","./../KmlIcon","../util/NodeTransformers"],function(t,e,i){"use strict";var r=function(e){t.call(this,e)};return r.prototype=Object.create(t.prototype),Object.defineProperties(r.prototype,{kmlColor:{get:function(){return this._factory.specific(this,{name:"color",transformer:i.string})}},kmlDrawOrder:{get:function(){return this._factory.specific(this,{name:"drawOrder",transformer:i.string})}},kmlIcon:{get:function(){return this._factory.any(this,{name:e.prototype.getTagNames()})}}}),r.prototype.getTagNames=function(){return["PhotoOverlay","ScreenOverlay","GroundOverlay"]},r}),i("formats/kml/features/KmlGroundOverlay",["./../KmlElements","./KmlFeature","../KmlLatLonBox","../KmlLatLonQuad","./KmlOverlay","../util/NodeTransformers","../../../geom/Sector","../../../shapes/SurfaceImage"],function(t,e,i,r,n,o,s,a){"use strict";var l=function(t){this.isGroundOverlay=!0,n.call(this,t)};return l.prototype=Object.create(n.prototype),Object.defineProperties(l.prototype,{kmlAltitude:{get:function(){return this._factory.specific(this,{name:"altitude",transformer:o.string})}},kmlAltitudeMode:{get:function(){return this._factory.specific(this,{name:"altitudeMode",transformer:o.string})}},kmlLatLonBox:{get:function(){return this._factory.any(this,{name:i.prototype.getTagNames()})}},kmlLatLonQuad:{get:function(){return this._factory.any(this,{name:r.prototype.getTagNames()})}}}),l.prototype.render=function(t,i){e.prototype.render.call(this,t,i),!this._renderable&&this.enabled&&this.kmlIcon&&this.kmlLatLonBox&&(this._renderable=new a(new s(this.kmlLatLonBox.kmlSouth,this.kmlLatLonBox.kmlNorth,this.kmlLatLonBox.kmlWest,this.kmlLatLonBox.kmlEast),this.kmlIcon.kmlHref),t.redrawRequested=!0),this._renderable&&this._renderable.render(t)},l.prototype.getTagNames=function(){return["GroundOverlay"]},t.addKey(l.prototype.getTagNames()[0],l),l}),i("shapes/Path",["../shapes/AbstractShape","../error/ArgumentError","../shaders/BasicTextureProgram","../geom/BoundingBox","../util/Color","../geom/Location","../util/Logger","../geom/Matrix","../pick/PickedObject","../geom/Position","../shapes/ShapeAttributes","../shapes/SurfacePolyline","../geom/Vec2","../geom/Vec3"],function(t,e,i,r,n,o,s,a,l,h,u,c,d,p){"use strict";var f=function(i,r){if(!i)throw new e(s.logMessage(s.LEVEL_SEVERE,"Path","constructor","missingPositions"));t.call(this,r),this._positions=i,this._pathType=WorldWind.GREAT_CIRCLE,this._terrainConformance=10,this._numSubSegments=10,this.referencePosition=this.determineReferencePosition(this._positions),this.scratchPoint=new p(0,0,0)};return f.prototype=Object.create(t.prototype),Object.defineProperties(f.prototype,{positions:{get:function(){return this._positions},set:function(t){if(!t)throw new e(s.logMessage(s.LEVEL_SEVERE,"Path","constructor","missingPositions"));this._positions=t,this.referencePosition=this.determineReferencePosition(this._positions),this.reset()}},followTerrain:{get:function(){return this._followTerrain},set:function(t){this._followTerrain=t,this.reset()}},terrainConformance:{get:function(){return this._terrainConformance},set:function(t){this._terrainConformance=t,this.reset()}},numSubSegments:{get:function(){return this._numSubSegments},set:function(t){this._numSubSegments=t>=0?t:0,this.reset()}},pathType:{get:function(){return this._pathType},set:function(t){this._pathType=t,this.reset()}},extrude:{get:function(){return this._extrude},set:function(t){this._extrude=t,this.reset()}}}),f.prototype.determineReferencePosition=function(t){return t.length>0?t[0]:null},f.prototype.mustGenerateGeometry=function(t){return!this.currentData.tessellatedPoints||(this.currentData.drawInterior!==this.activeAttributes.drawInterior||this.currentData.drawVerticals!==this.activeAttributes.drawVerticals||(!this.followTerrain&&this.currentData.numSubSegments!==this.numSubSegments||(!(!this.followTerrain||this.currentData.terrainConformance===this.terrainConformance)||this.altitudeMode!==WorldWind.ABSOLUTE&&this.currentData.isExpired)))},f.prototype.createSurfaceShape=function(){return new c(this.positions,null)},f.prototype.doMakeOrderedRenderable=function(t){if(!this.referencePosition)return null;if(!this.mustGenerateGeometry(t))return this;var e=this.currentData.referencePoint;t.surfacePointForMode(this.referencePosition.latitude,this.referencePosition.longitude,this.referencePosition.altitude,this._altitudeMode,e),this.currentData.transformationMatrix.setToTranslation(e[0],e[1],e[2]);var i=this.makeTessellatedPositions(t);if(i.length<2)return null;var n=this.computeRenderedPath(t,i);return this.currentData.tessellatedPoints=n,this.currentData.drawInterior=this.activeAttributes.drawInterior,this.currentData.drawVerticals=this.activeAttributes.drawVerticals,this.currentData.numSubSegments=this.numSubSegments,this.currentData.terrainConformance=this.terrainConformance,this.resetExpiration(this.currentData),this.currentData.fillVbo=!0,this.currentData.extent||(this.currentData.extent=new r),this.currentData.extent.setToPoints(n),this.currentData.extent.translate(this.currentData.referencePoint),this},f.prototype.makeTessellatedPositions=function(t){var e,i,r,n=[],o=t.navigatorState,s=this.mustDrawVerticals(t),a=new p(0,0,0),l=new p(0,0,0),h=this._positions[0];s&&(this.currentData.verticalIndices=new Int16Array(2*this.positions.length),this.currentData.verticalIndices[0]=0,this.currentData.verticalIndices[1]=1),n.push(h),t.surfacePointForMode(h.latitude,h.longitude,h.altitude,this._altitudeMode,a);for(var u=1,c=this._positions.length;u<c;u++)if(e=this._positions[u],t.surfacePointForMode(e.latitude,e.longitude,e.altitude,this._altitudeMode,l),i=o.eyePoint.distanceTo(a),r=o.pixelSizeAtDistance(i),a.distanceTo(l)<8*r&&this.altitudeMode!==WorldWind.ABSOLUTE?n.push(e):this.makeSegment(t,h,e,a,l,n),h=e,a.copy(l),s){var d=2*(n.length-1);this.currentData.verticalIndices[2*u]=d,this.currentData.verticalIndices[2*u+1]=d+1}return n},f.prototype.makeSegment=function(t,e,i,r,n,s){var a,l,u,c,d,p,f=t.navigatorState,g=f.eyePoint,m=new o(0,0),E=0;if(this._pathType===WorldWind.LINEAR&&!this._followTerrain)return void(r.equals(n)||s.push(i));if(u=this._pathType===WorldWind.LINEAR?o.linearDistance(e,i):this._pathType===WorldWind.RHUMB_LINE?o.rhumbDistance(e,i):o.greatCircleDistance(e,i),this._altitudeMode!==WorldWind.CLAMP_TO_GROUND&&(E=.5*(e.altitude+i.altitude)),!((a=u*(t.globe.equatorialRadius+E*t.verticalExaggeration))<=0)){for(l=this._pathType===WorldWind.LINEAR?o.linearAzimuth(e,i):this._pathType===WorldWind.RHUMB_LINE?o.rhumbAzimuth(e,i):o.greatCircleAzimuth(e,i),this.scratchPoint.copy(r),c=0,d=0;c<1&&(this._followTerrain?d+=this._terrainConformance*f.pixelSizeAtDistance(this.scratchPoint.distanceTo(g)):d+=a/this._numSubSegments,!(a<d||a-d<1e-9));)c=d/a,p=c*u,this._pathType===WorldWind.LINEAR?o.linearLocation(e,l,p,m):this._pathType===WorldWind.RHUMB_LINE?o.rhumbLocation(e,l,p,m):o.greatCircleLocation(e,l,p,m),m.altitude=(1-c)*e.altitude+c*i.altitude,s.push(new h(m.latitude,m.longitude,m.altitude)),this._followTerrain&&t.surfacePointForMode(m.latitude,m.longitude,m.altitude,WorldWind.CLAMP_TO_GROUND,this.scratchPoint);s.push(i)}},f.prototype.computeRenderedPath=function(t,e){var i,r,n,o,s=this.mustDrawInterior(t)||this.mustDrawVerticals(t),a=Number.MAX_VALUE,l=t.navigatorState.eyePoint,h=(s?2:1)*e.length,u=new Float32Array(3*h),c=s?6:3,d=new p(0,0,0);i=this._followTerrain&&this.altitudeMode!==WorldWind.CLAMP_TO_GROUND?WorldWind.RELATIVE_TO_GROUND:this.altitudeMode;for(var f=0,g=e.length;f<g;f++)r=e[f],t.surfacePointForMode(r.latitude,r.longitude,r.altitude,i,d),o=d.distanceToSquared(l),o<a&&(a=o),d.subtract(this.currentData.referencePoint),n=c*f,u[n]=d[0],u[n+1]=d[1],u[n+2]=d[2],s&&(t.surfacePointForMode(r.latitude,r.longitude,0,WorldWind.CLAMP_TO_GROUND,d),o=d.distanceToSquared(l),o<a&&(a=o),d.subtract(this.currentData.referencePoint),u[n+3]=d[0],u[n+4]=d[1],u[n+5]=d[2]);return this.currentData.pointBufferHasExtrusionPoints=s,this.currentData.eyeDistance=Math.sqrt(a),u},f.prototype.mustDrawInterior=function(t){return this.activeAttributes.drawInterior&&this._extrude&&this._altitudeMode!==WorldWind.CLAMP_TO_GROUND},f.prototype.mustDrawVerticals=function(t){return this.activeAttributes.drawOutline&&this.activeAttributes.drawVerticals&&this.altitudeMode!==WorldWind.CLAMP_TO_GROUND},f.prototype.doRenderOrdered=function(t){var e,i,r,n,o,s,a=t.currentGlContext,h=t.currentProgram,u=this.currentData,c=u.tessellatedPoints.length/3;if(this.applyMvpMatrix(t),u.vboCacheKey||(u.vboCacheKey=t.gpuResourceCache.generateCacheKey()),e=t.gpuResourceCache.resourceForKey(u.vboCacheKey),e||(e=a.createBuffer(),t.gpuResourceCache.putResource(this.currentData.vboCacheKey,e,4*u.tessellatedPoints.length),u.fillVbo=!0),a.bindBuffer(a.ARRAY_BUFFER,e),u.fillVbo&&(a.bufferData(a.ARRAY_BUFFER,u.tessellatedPoints,a.STATIC_DRAW),t.frameStatistics.incrementVboLoadCount(1)),h.loadTextureEnabled(a,!1),t.pickingMode&&(n=t.uniquePickColor()),this.mustDrawInterior(t)&&(r=this.activeAttributes.interiorColor,i=r.alpha*t.currentLayer.opacity,i<1&&!t.pickingMode&&a.depthMask(!1),h.loadColor(a,t.pickingMode?n:r),h.loadOpacity(a,t.pickingMode?i>0?1:0:i),a.vertexAttribPointer(h.vertexPointLocation,3,a.FLOAT,!1,0,0),a.drawArrays(a.TRIANGLE_STRIP,0,c)),this.activeAttributes.drawOutline&&((this.mustDrawVerticals(t)&&this.mustDrawInterior(t)||this.altitudeMode===WorldWind.CLAMP_TO_GROUND)&&this.applyMvpMatrixForOutline(t),r=this.activeAttributes.outlineColor,i=r.alpha*t.currentLayer.opacity,i<1&&!t.pickingMode&&a.depthMask(!1),h.loadColor(a,t.pickingMode?n:r),h.loadOpacity(a,t.pickingMode?1:i),a.lineWidth(this.activeAttributes.outlineWidth),this.currentData.pointBufferHasExtrusionPoints?(o=24,s=c/2):(o=12,s=c),a.vertexAttribPointer(h.vertexPointLocation,3,a.FLOAT,!1,o,0),a.drawArrays(a.LINE_STRIP,0,s),this.mustDrawVerticals(t)&&(u.verticalIndicesVboCacheKey||(u.verticalIndicesVboCacheKey=t.gpuResourceCache.generateCacheKey()),e=t.gpuResourceCache.resourceForKey(u.verticalIndicesVboCacheKey),e||(e=a.createBuffer(),t.gpuResourceCache.putResource(u.verticalIndicesVboCacheKey,e,4*u.verticalIndices.length),u.fillVbo=!0),a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,e),u.fillVbo&&(a.bufferData(a.ELEMENT_ARRAY_BUFFER,u.verticalIndices,a.STATIC_DRAW),t.frameStatistics.incrementVboLoadCount(1)),a.vertexAttribPointer(h.vertexPointLocation,3,a.FLOAT,!1,0,0),a.drawElements(a.LINES,u.verticalIndices.length,a.UNSIGNED_SHORT,0))),u.fillVbo=!1,t.pickingMode){var d=new l(n,this.pickDelegate?this.pickDelegate:this,null,t.currentLayer,!1);t.resolvePick(d)}},f.prototype.beginDrawing=function(t){var e=t.currentGlContext;this.mustDrawInterior(t)&&e.disable(e.CULL_FACE),t.findAndBindProgram(i),e.enableVertexAttribArray(t.currentProgram.vertexPointLocation)},f.prototype.endDrawing=function(t){var e=t.currentGlContext;e.disableVertexAttribArray(t.currentProgram.vertexPointLocation),e.depthMask(!0),e.lineWidth(1),e.enable(e.CULL_FACE)},f}),i("formats/kml/geom/KmlLineString",["../../../util/Color","../KmlElements","./KmlGeometry","../styles/KmlStyle","../../../geom/Location","../util/NodeTransformers","../../../shapes/Path","../../../geom/Position","../../../shapes/ShapeAttributes","../../../shapes/SurfacePolyline","../../../util/WWUtil"],function(t,e,i,r,n,o,s,a,l,h,u){"use strict";var c=function(t){i.call(this,t),this._style=null};return c.prototype=Object.create(i.prototype),Object.defineProperties(c.prototype,{kmlExtrude:{get:function(){return this._factory.specific(this,{name:"extrude",transformer:o.boolean})||!1}},kmlTessellate:{get:function(){return this._factory.specific(this,{name:"tessellate",transformer:o.boolean})||!1}},kmlAltitudeMode:{get:function(){return this._factory.specific(this,{name:"altitudeMode",transformer:o.string})||WorldWind.ABSOLUTE}},kmlPositions:{get:function(){return this._factory.specific(this,{name:"coordinates",transformer:o.positions})}},kmlCenter:{get:function(){var t=this.kmlPositions,e=0,i=0,r=0;return t.forEach(function(t){e+=t.latitude,i+=t.longitude,r+=t.altitude}),new a(e/this.kmlPositions.length,i/this.kmlPositions.length,r/this.kmlPositions.length)}}}),c.prototype.createPath=function(t){this.kmlAltitudeMode==WorldWind.CLAMP_TO_GROUND?this._renderable=new h(this.prepareLocations(),this.prepareAttributes(t.normal)):this._renderable=new s(this.prepareLocations(),this.prepareAttributes(t.normal)),t.highlight&&(this._renderable.highlightAttributes=this.prepareAttributes(t.highlight)),this.moveValidProperties()},c.prototype.render=function(t,e){i.prototype.render.call(this,t,e),e.lastStyle&&!this._renderable&&(this.createPath(e.lastStyle),t.redrawRequested=!0),this._renderable&&(this._renderable.enabled=this.enabled,this._renderable.render(t))},c.prototype.prepareAttributes=function(t){var e=t&&t.generate()||{};return e._applyLighting=!0,e._drawOutline=!0,e._drawInterior=!0,e._drawVerticals=this.kmlExtrude||!1,e._outlineStippleFactor=0,e._outlineStipplePattern=61680,e._enableLighting=!0,new l(r.shapeAttributes(e))},c.prototype.prepareLocations=function(){return this.kmlPositions},c.prototype.moveValidProperties=function(){this._renderable.extrude=this.kmlExtrude||!1,this._renderable.altitudeMode=this.kmlAltitudeMode||WorldWind.ABSOLUTE,this._renderable.tesselate=this.kmlTesselate||!1},c.prototype.equals=function(t){return!!t&&(u.arrayEquals(t.kmlPositions,this.kmlPositions)&&t.kmlExtrude==this.kmlExtrude&&t.kmlTessellate==this.kmlTessellate&&t.kmlAltitudeMode==this.kmlAltitudeMode)},c.prototype.getTagNames=function(){return["LineString"]},e.addKey(c.prototype.getTagNames()[0],c),c}),i("formats/kml/geom/KmlLinearRing",["./KmlLineString","../KmlElements"],function(t,e){"use strict";var i=function(e){t.call(this,e)};return i.prototype=Object.create(t.prototype),i.prototype.getTagNames=function(){return["LinearRing"]},e.addKey(i.prototype.getTagNames()[0],i),i}),i("formats/kml/KmlLocation",["./KmlElements","./KmlObject","./util/NodeTransformers"],function(t,e,i){"use strict";var r=function(t){e.call(this,t)};return r.prototype=Object.create(e.prototype),Object.defineProperties(r.prototype,{kmlLongitude:{get:function(){return this._factory.specific(this,{name:"longitude",transformer:i.string})}},kmlLatitude:{get:function(){return this._factory.specific(this,{name:"latitude",transformer:i.string})}},kmlAltitude:{get:function(){return this._factory.specific(this,{name:"altitude",transformer:i.string})}}}),r.prototype.getTagNames=function(){return["Location"]},t.addKey(r.prototype.getTagNames()[0],r),r}),i("formats/kml/KmlLookAt",["./KmlAbstractView","./KmlElements","./util/NodeTransformers","../../geom/Position"],function(t,e,i,r){"use strict";var n=function(e){t.call(this,e)};return n.prototype=Object.create(t.prototype),Object.defineProperties(n.prototype,{kmlLongitude:{get:function(){return this._factory.specific(this,{name:"longitude",transformer:i.number})}},kmlLatitude:{get:function(){return this._factory.specific(this,{name:"latitude",transformer:i.number})}},kmlAltitude:{get:function(){return this._factory.specific(this,{name:"altitude",transformer:i.number})}},kmlHeading:{get:function(){return this._factory.specific(this,{name:"heading",transformer:i.number})}},kmlTilt:{get:function(){return this._factory.specific(this,{name:"tilt",transformer:i.number})}},kmlRange:{get:function(){return this._factory.specific(this,{name:"range",transformer:i.number})}},kmlAltitudeMode:{get:function(){return this._factory.specific(this,{name:"altitudeMode",transformer:i.string})}}}),n.prototype.update=function(t){if(t.wwd){var e=this.kmlAltitude||4e3;t.wwd.goTo(new r(this.kmlLatitude,this.kmlLongitude,e))}},n.prototype.getTagNames=function(){return["LookAt"]},e.addKey(n.prototype.getTagNames()[0],n),n}),i("formats/kml/geom/KmlMultiGeometry",["./../KmlElements","./KmlGeometry","../../../geom/Position"],function(t,e,i){"use strict";var r=function(t){e.call(this,t),this._style=t.style};return r.prototype=Object.create(e.prototype),Object.defineProperties(r.prototype,{kmlShapes:{get:function(){return this._factory.all(this)}},kmlCenter:{get:function(){var t=this.kmlShapes.map(function(t){return t.kmlCenter}),e=0,r=0,n=0;return t.forEach(function(t){e+=t.latitude,r+=t.longitude,n+=t.altitude}),new i(e/t.length,r/t.length,n/t.length)}}}),r.prototype.render=function(t,i){e.prototype.render.call(this,t,i),this.kmlShapes.forEach(function(e){e.render(t,i)})},r.prototype.getTagNames=function(){return["MultiGeometry"]},t.addKey(r.prototype.getTagNames()[0],r),r}),i("formats/kml/features/KmlNetworkLink",["./../KmlElements","./KmlFeature","../KmlFile","../KmlLink","../util/NodeTransformers","../util/RefreshListener"],function(t,e,i,r,n,o){"use strict";var s=function(t){e.call(this,t),this.isFeature=!0,this.resolvedFile=null,this.displayed=!1,this.isDownloading=!1};return s.prototype=Object.create(e.prototype),Object.defineProperties(s.prototype,{kmlRefreshVisibility:{get:function(){return this._factory.specific(this,{name:"refreshVisibility",transformer:n.boolean})}},kmlFlyToView:{get:function(){return this._factory.specific(this,{name:"flyToView",transformer:n.boolean})}},kmlLink:{get:function(){return this._factory.any(this,{name:r.prototype.getTagNames()})}}}),s.prototype.getTagNames=function(){return["NetworkLink"]},s.prototype.render=function(t,r){if(e.prototype.render.call(this,t,r),r.lastVisibility||this.displayed){if(!this.isDownloading&&!this.resolvedFile){this.isDownloading=!0;var n=this;new i(n.buildUrl()).then(function(t){n.resolvedFile=t,n.isDownloading=!1,n.fireEvent(r)})}this.resolvedFile&&!this.displayed&&(this.resolvedFile.render(t,r),this.handleRefresh(r))}},s.prototype.buildUrl=function(){return this.kmlLink.kmlHref},s.prototype.handleRefresh=function(t){var e=t.activeEvents;if(e=e.filter(function(t){return"refreshNetworkLinkEvent"==t.type}),e.length>0){var r=this;new i(r.buildUrl()).then(function(e){r.resolvedFile=e,r.fireEvent(t)})}},s.prototype.fireEvent=function(t){var e=0;if("onInterval"==this.kmlLink.kmlRefreshMode)e=1e3*this.kmlLink.kmlRefreshInterval;else{if("onExpire"!=this.kmlLink.kmlRefreshMode)return;if(!this.resolvedFile)return;e=this.resolvedFile.getExpired()}t.listener.addEvent(new o.Event("refreshNetworkLinkEvent",e,null))},t.addKey(s.prototype.getTagNames()[0],s),s}),i("formats/kml/KmlOrientation",["./KmlElements","./KmlObject","./util/NodeTransformers"],function(t,e,i){"use strict";var r=function(t){e.call(this,t)};return r.prototype=Object.create(e.prototype),Object.defineProperties(r.prototype,{kmlHeading:{get:function(){return this._factory.specific(this,{name:"heading",transformer:i.number})}},kmlTilt:{get:function(){return this._factory.specific(this,{name:"tilt",transformer:i.number})}},kmlRoll:{get:function(){return this._factory.specific(this,{name:"roll",transformer:i.number})}}}),r.prototype.getTagNames=function(){return["Orientation"]},t.addKey(r.prototype.getTagNames()[0],r),r}),i("formats/kml/geom/KmlPoint",["../../../util/Color","../KmlElements","./KmlGeometry","../../../geom/Location","../util/NodeTransformers","../../../shapes/Polygon","../../../geom/Position"],function(t,e,i,r,n,o,s){"use strict";var a=function(t){i.call(this,t),this._shape=null};return a.prototype=Object.create(i.prototype),Object.defineProperties(a.prototype,{kmlPosition:{get:function(){var t=this._factory.specific(this,{name:"coordinates",transformer:n.string}).split(",");return new s(t[1],t[0],t[2]||0)}},kmlExtrude:{get:function(){return this._factory.specific(this,{name:"extrude",transformer:n.boolean})}},kmlAltitudeMode:{get:function(){return this._factory.specific(this,{name:"altitudeMode",transformer:n.string})}},kmlCenter:{get:function(){return this.kmlPosition}}}),a.prototype.getTagNames=function(){return["Point"]},e.addKey(a.prototype.getTagNames()[0],a),a}),i("formats/kml/util/ViewVolume",["../KmlElements","../KmlObject","./NodeTransformers"],function(t,e,i){"use strict";var r=function(t){e.call(this,t)};return r.prototype=Object.create(e.prototype),Object.defineProperties(r.prototype,{kmlLeftFov:{get:function(){return this._factory.specific(this,{name:"leftFov",transformer:i.number})}},kmlRightFov:{get:function(){return this._factory.specific(this,{name:"rightFov",transformer:i.number})}},kmlBottomFov:{get:function(){return this._factory.specific(this,{name:"bottomFov",transformer:i.number})}},kmlTopFov:{get:function(){return this._factory.specific(this,{name:"topFov",transformer:i.number})}},kmlNear:{get:function(){return this._factory.specific(this,{name:"near",transformer:i.string})}}}),r.prototype.getTagNames=function(){return["ViewVolume"]},t.addKey(r.prototype.getTagNames()[0],r),r}),i("formats/kml/features/KmlPhotoOverlay",["../util/ImagePyramid","./../KmlElements","./KmlOverlay","../geom/KmlPoint","../util/NodeTransformers","../util/ViewVolume"],function(t,e,i,r,n,o){"use strict";var s=function(t){i.call(this,t)};return s.prototype=Object.create(i.prototype),Object.defineProperties(s.prototype,{kmlRotation:{get:function(){return this._factory.specific(this,{name:"rotation",transformer:n.string})}},kmlShape:{get:function(){return this._factory.specific(this,{name:"shape",transformer:n.string})}},kmlPoint:{get:function(){return this._factory.any(this,{name:r.prototype.getTagNames()})}},kmlViewVolume:{get:function(){return this._factory.any(this,{name:o.prototype.getTagNames()})}},kmlImagePyramid:{get:function(){return this._factory.any(this,{name:t.prototype.getTagNames()})}}}),s.prototype.getTagNames=function(){return["PhotoOverlay"]},e.addKey(s.prototype.getTagNames[0],s),s}),i("formats/kml/features/KmlPlacemark",["./../KmlElements","./KmlFeature","../geom/KmlGeometry","../styles/KmlStyle","../KmlTimeSpan","../KmlTimeStamp","../../../shapes/PlacemarkAttributes","../../../shapes/Placemark","../../../util/Color","../../../shapes/ShapeAttributes","../../../shapes/TextAttributes","../../../util/Offset","../../../util/WWUtil"],function(t,e,i,r,n,o,s,a,l,h,u,c,d){"use strict";var p=function(t){e.call(this,t)};return p.prototype=Object.create(e.prototype),Object.defineProperties(p.prototype,{kmlGeometry:{get:function(){return this._factory.any(this,{name:i.prototype.getTagNames()})}}}),p.prototype.render=function(t,i){e.prototype.render.call(this,t,i),i=d.clone(i),i.lastStyle&&!this._renderable&&this.kmlGeometry&&(this._renderable=new a(this.kmlGeometry.kmlCenter,!1,this.prepareAttributes(i.lastStyle.normal)),i.lastStyle.highlight&&(this._renderable.highlightAttributes=this.prepareAttributes(i.lastStyle.highlight)),this.moveValidProperties(),t.redrawRequested=!0),this._renderable&&this.kmlGeometry&&(this.kmlGeometry.render(t,i),this._renderable.render(t))},p.prototype.prepareAttributes=function(t){var e=t&&t.generate()||{normal:{},highlight:{}},i=new s(r.placemarkAttributes(e));return i.imageOffset=new c(WorldWind.OFFSET_FRACTION,.3,WorldWind.OFFSET_FRACTION,0),i.imageColor=l.WHITE,i.labelAttributes=new u(r.textAttributes({_offset:new c(WorldWind.OFFSET_FRACTION,.5,WorldWind.OFFSET_FRACTION,1),_color:l.YELLOW})),i.drawLeaderLine=!0,i.leaderLineAttributes=new h(r.shapeAttributes({outlineColor:l.RED})),i},p.prototype.moveValidProperties=function(){this._renderable.label=this.kmlName||"",this._renderable.altitudeMode=this.kmlAltitudeMode||WorldWind.RELATIVE_TO_GROUND,this._renderable.enableLeaderLinePicking=!0},p.prototype.getTagNames=function(){return["Placemark"]},t.addKey(p.prototype.getTagNames()[0],p),p}),i("formats/kml/geom/KmlPolygon",["../../../util/Color","../KmlElements","./KmlGeometry","./KmlLinearRing","../styles/KmlStyle","../../../geom/Location","../util/NodeTransformers","../../../shapes/Polygon","../../../shapes/ShapeAttributes","../../../shapes/SurfacePolygon"],function(t,e,i,r,n,o,s,a,l,h){"use strict";var u=function(t){i.call(this,t),this.initialized=!1};return u.prototype=Object.create(i.prototype),Object.defineProperties(u.prototype,{kmlExtrude:{get:function(){return this._factory.specific(this,{name:"extrude",transformer:s.boolean})}},kmlTessellate:{get:function(){return this._factory.specific(this,{name:"tessellate",transformer:s.boolean})}},kmlAltitudeMode:{get:function(){return this._factory.specific(this,{name:"altitudeMode",transformer:s.string})}},kmlOuterBoundary:{get:function(){return this._factory.specific(this,{name:"outerBoundaryIs",transformer:s.linearRing})}},kmlInnerBoundary:{get:function(){return this._factory.specific(this,{name:"innerBoundaryIs",transformer:s.linearRing})}},kmlCenter:{get:function(){return this.kmlOuterBoundary.kmlCenter}}}),u.prototype.createPolygon=function(t){this.kmlAltitudeMode==WorldWind.CLAMP_TO_GROUND?this._renderable=new h(this.prepareLocations(),this.prepareAttributes(t.normal)):this._renderable=new a(this.prepareLocations(),this.prepareAttributes(t.normal)),t.highlight&&(this._renderable.highlightAttributes=this.prepareAttributes(t.highlight)),this.moveValidProperties()},u.prototype.render=function(t,e){i.prototype.render.call(this,t,e),e.lastStyle&&!this._renderable&&(this.createPolygon(e.lastStyle),t.redrawRequested=!0),this._renderable&&(this._renderable.enabled=this.enabled,this._renderable.render(t))},u.prototype.moveValidProperties=function(){this._renderable.extrude=this.kmlExtrude||!0,this._renderable.altitudeMode=this.kmlAltitudeMode||WorldWind.CLAMP_TO_GROUND},u.prototype.prepareAttributes=function(t){var e=t&&t.generate()||{};return e._drawVerticals=this.kmlExtrude||!1,e._applyLighting=!0,e._depthTest=!0,e._outlineStippleFactor=0,e._outlineStipplePattern=61680,e._enableLighting=!0,new l(n.shapeAttributes(e))},u.prototype.prepareLocations=function(){var t=[];return null!=this.kmlInnerBoundary?(t[0]=this.kmlInnerBoundary.kmlPositions,t[1]=this.kmlOuterBoundary.kmlPositions):t=this.kmlOuterBoundary.kmlPositions,t},u.prototype.getStyle=function(){return this._style},u.prototype.getTagNames=function(){return["Polygon"]},e.addKey(u.prototype.getTagNames()[0],u),u}),i("formats/kml/features/KmlScreenOverlay",["./../KmlElements","./KmlFeature","./KmlOverlay","../util/NodeTransformers","../../../util/Offset","../../../shapes/ScreenImage","../../../util/WWUtil"],function(t,e,i,r,n,o,s){"use strict";var a=function(t){i.call(this,t),console.log("Create Screen Overlay",this)};return a.prototype=Object.create(i.prototype),Object.defineProperties(a.prototype,{kmlRotation:{get:function(){return this._factory.specific(this,{name:"rotation",transformer:r.number})}},kmlOverlayXYx:{get:function(){return this._factory.specific(this,{name:"overlayXY",transformer:r.attribute("x"),attribute:"kmlOverlayXYx"})}},kmlOverlayXYy:{get:function(){return this._factory.specific(this,{name:"overlayXY",transformer:r.attribute("y"),attribute:"kmlOverlayXYy"})}},kmlOverlayXYxunits:{get:function(){return this._factory.specific(this,{name:"overlayXY",transformer:r.attribute("xunits"),attribute:"kmlOverlayXYxunits"})}},kmlOverlayXYyunits:{get:function(){return this._factory.specific(this,{name:"overlayXY",transformer:r.attribute("yunits"),attribute:"kmlOverlayXYyunits"})}},kmlScreenXYx:{get:function(){return this._factory.specific(this,{name:"screenXY",transformer:r.attribute("x"),attribute:"kmlScreenXYx"})}},kmlScreenXYy:{get:function(){return this._factory.specific(this,{name:"screenXY",transformer:r.attribute("y"),attribute:"kmlScreenXYy"})}},kmlScreenXYxunits:{get:function(){return this._factory.specific(this,{name:"screenXY",transformer:r.attribute("xunits"),attribute:"kmlScreenXYxunits"})}},kmlScreenXYyunits:{get:function(){return this._factory.specific(this,{name:"screenXY",transformer:r.attribute("yunits"),attribute:"kmlScreenXYyunits"})}},kmlRotationXYx:{get:function(){return this._factory.specific(this,{name:"rotationXY",transformer:r.attribute("x"),attribute:"kmlRotationXYx"})}},kmlRotationXYy:{get:function(){return this._factory.specific(this,{name:"rotationXY",transformer:r.attribute("y"),attribute:"kmlRotationXYy"})}},kmlRotationXYxunits:{get:function(){return this._factory.specific(this,{name:"rotationXY",transformer:r.attribute("xunits"),attribute:"kmlRotationXYxunits"})}},kmlRotationXYyunits:{get:function(){return this._factory.specific(this,{name:"rotationXY",transformer:r.attribute("yunits"),attribute:"kmlRotationXYyunits"})}},
kmlSizex:{get:function(){return this._factory.specific(this,{name:"size",transformer:r.attribute("x"),attribute:"kmlSizex"})}},kmlSizey:{get:function(){return this._factory.specific(this,{name:"size",transformer:r.attribute("y"),attribute:"kmlSizey"})}},kmlSizexunits:{get:function(){return this._factory.specific(this,{name:"size",transformer:r.attribute("xunits"),attribute:"kmlSizexunits"})}},kmlSizeyunits:{get:function(){return this._factory.specific(this,{name:"size",transformer:r.attribute("yunits"),attribute:"kmlSizeyunits"})}}}),a.prototype.render=function(t,i){e.prototype.render.call(this,t,i),this._renderable||this.kmlIcon&&(this._renderable=new o(new n(this.kmlScreenXYxunits,this.kmlScreenXYx,this.kmlScreenXYyunits,this.kmlScreenXYy),this.kmlIcon.kmlHref),this._renderable.imageOffset=new n(this.kmlOverlayXYxunits,this.kmlOverlayXYx,this.kmlOverlayXYyunits,this.kmlOverlayXYy),t.redrawRequested=!0),this._renderable&&this._renderable.render(t)},a.prototype.getTagNames=function(){return["ScreenOverlay"]},t.addKey(a.prototype.getTagNames()[0],a),a}),i("formats/kml/features/KmlTour",["./../KmlElements","./KmlFeature"],function(t,e){"use strict";var i=function(t){e.call(this,t)};return i.prototype=Object.create(e.prototype),i.prototype.getTagNames=function(){return["gx:Tour"]},t.addKey(i.prototype.getTagNames()[0],i),i}),i("formats/kml/geom/KmlTrack",["./../KmlElements","./KmlGeometry"],function(t,e){"use strict";var i=function(t){e.call(this,t)};return i.prototype=Object.create(e.prototype),i.prototype.getTagNames=function(){return["gx:Track"]},t.addKey(i.prototype.getTagNames()[0],i),i}),i("formats/kml/controls/KmlTreeVisibility",["../../../util/WWUtil","./KmlControls"],function(t,e){"use strict";var i=function(t,i){e.apply(this),this._visualElementId=t,this._wwd=i};return i.prototype=Object.create(e.prototype),i.prototype.hook=function(t,e){e.isFeature&&this.createControls(t)},i.prototype.createControls=function(e){function i(){o=!o,h.updateDescendants(e,o)}function r(){e.kmlAbstractView&&e.kmlAbstractView.update({wwd:h._wwd})}var n=e.kmlName||e.id||t.guid(),o=e.enabled||!0===e.kmlVisibility,s=document.createElement("div"),a=document.createElement("input");a.setAttribute("type","checkbox"),o&&a.setAttribute("checked","checked"),a.addEventListener("click",i,!0),s.appendChild(a);var l=document.createElement("span");l.appendChild(document.createTextNode(n)),l.addEventListener("click",r,!0),s.appendChild(l),document.getElementById(this._visualElementId).appendChild(s);var h=this},i.prototype.updateDescendants=function(t,e){t.controlledVisibility=e,this._wwd.redraw()},i}),i("layer/LandsatRestLayer",["../error/ArgumentError","../geom/Location","../util/Logger","../geom/Sector","../layer/TiledImageLayer","../util/LevelRowColumnUrlBuilder","../util/WWUtil"],function(t,e,i,r,n,o,s){"use strict";var a=function(t,i,a){var l=s.urlPath(t+"/"+i);n.call(this,r.FULL_SPHERE,new e(36,36),10,"image/png",l,512,512),this.displayName=a,this.pickEnabled=!1,this.urlBuilder=new o(t,i)};return a.prototype=Object.create(n.prototype),a}),i("util/measure/LengthMeasurer",["../../error/ArgumentError","../../geom/Location","../Logger","./MeasurerUtils","../../geom/Position","../../geom/Vec3"],function(t,e,i,r,n,o){var s=function(e){if(!e)throw new t(i.logMessage(i.LEVEL_SEVERE,"LengthMeasurer","constructor","missingWorldWindow"));this.wwd=e,this.DEFAULT_MIN_SEGMENT_LENGTH=30,this._maxSegmentLength=1e5,this._lengthTerrainSamplingSteps=128,this.subdividedPositions=null};return Object.defineProperties(s.prototype,{maxSegmentLength:{get:function(){return this._maxSegmentLength},set:function(t){this._maxSegmentLength=t}},lengthTerrainSamplingSteps:{get:function(){return this._lengthTerrainSamplingSteps},set:function(t){this._lengthTerrainSamplingSteps=t}}}),s.prototype.getLength=function(t,e,i){return i=i||WorldWind.GREAT_CIRCLE,this.subdividedPositions=null,this.computeLength(t,e,i)},s.prototype.getPathLength=function(t){return this.subdividedPositions=null,this.computeLength(t.positions,t.followTerrain,t.pathType)},s.prototype.getGeographicDistance=function(t,i){if(t instanceof WorldWind.Path)var r=t.positions,n=t.pathType;else Array.isArray(t)&&(r=t,n=i||WorldWind.GREAT_CIRCLE);if(!r||r.length<2)return-1;var o=e.greatCircleDistance;n===WorldWind.RHUMB_LINE?o=e.rhumbDistance:n===WorldWind.LINEAR&&(o=e.linearDistance);for(var s=0,a=0,l=r.length-1;a<l;a++){s+=o(r[a],r[a+1])}return s*this.wwd.globe.equatorialRadius},s.prototype.computeLength=function(t,e,i){if(!t||t.length<2)return-1;var n=this.wwd.globe;if(null==this.subdividedPositions){var s=this._maxSegmentLength;if(e){s=this.computeLength(t,!1,i)/this._lengthTerrainSamplingSteps,s=Math.min(Math.max(s,this.DEFAULT_MIN_SEGMENT_LENGTH),this._maxSegmentLength)}this.subdividedPositions=r.subdividePositions(n,t,e,i,s)}var a=0,l=this.subdividedPositions[0],h=new o(0,0,0),u=new o(0,0,0);h=n.computePointFromPosition(l.latitude,l.longitude,l.altitude,h);for(var c=1,d=this.subdividedPositions.length;c<d;c++){var p=this.subdividedPositions[c];u=n.computePointFromPosition(p.latitude,p.longitude,p.altitude,u),a+=h.distanceTo(u),h.copy(u)}return a},s}),i("navigate/Navigator",["../error/ArgumentError","../util/Logger","../geom/Matrix","../navigate/NavigatorState","../geom/Position","../error/UnsupportedOperationError","../geom/Vec3","../util/WWMath"],function(t,e,i,r,n,o,s,a){"use strict";var l=function(i){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"Navigator","constructor","missingWorldWindow"));this.worldWindow=i,this.heading=0,this.tilt=0,this.roll=0,this.nearDistance=1,this.farDistance=1e7};return l.prototype.currentState=function(){throw new o(e.logMessage(e.LEVEL_SEVERE,"Navigator","currentState","abstractInvocation"))},l.prototype.currentStateForModelview=function(o){if(!o)throw new t(e.logMessage(e.LEVEL_SEVERE,"Navigator","currentStateForModelview","missingMatrix"));var l,h,u=this.worldWindow.globe,c=a.max(u.equatorialRadius,u.polarRadius),d=o.extractEyePoint(new s(0,0,0)),p=u.computePositionFromPoint(d[0],d[1],d[2],new n(0,0,0)),f=a.horizonDistanceForGlobeRadius(c,p.altitude),g=a.horizonDistanceForGlobeRadius(c,16e4),m=this.worldWindow.viewport,E=this.worldWindow.depthBits,y=i.fromIdentity();return this.farDistance=f+g,this.farDistance<1e3&&(this.farDistance=1e3),this.nearDistance=a.perspectiveNearDistanceForFarDistance(this.farDistance,10,E),l=p.altitude-u.elevationAtLocation(p.latitude,p.longitude),l>0&&(h=a.perspectiveNearDistance(m.width,m.height,l),this.nearDistance>h&&(this.nearDistance=h)),this.nearDistance<1&&(this.nearDistance=1),y.setToPerspectiveProjection(m.width,m.height,this.nearDistance,this.farDistance),new r(o,y,m,this.heading,this.tilt)},l}),i("gesture/PanRecognizer",["../gesture/GestureRecognizer"],function(t){"use strict";var e=function(e,i){t.call(this,e,i),this.minNumberOfTouches=1,this.maxNumberOfTouches=Number.MAX_VALUE,this.interpretDistance=20};return e.prototype=Object.create(t.prototype),e.prototype.mouseDown=function(t){this.state==WorldWind.POSSIBLE&&(this.state=WorldWind.FAILED)},e.prototype.touchMove=function(t){this.state==WorldWind.POSSIBLE?this.shouldInterpret()&&(this.shouldRecognize()?this.state=WorldWind.BEGAN:this.state=WorldWind.FAILED):this.state!=WorldWind.BEGAN&&this.state!=WorldWind.CHANGED||(this.state=WorldWind.CHANGED)},e.prototype.touchEnd=function(t){0==this.touchCount&&(this.state==WorldWind.POSSIBLE?this.state=WorldWind.FAILED:this.state!=WorldWind.BEGAN&&this.state!=WorldWind.CHANGED||(this.state=WorldWind.ENDED))},e.prototype.touchCancel=function(t){0==this.touchCount&&(this.state==WorldWind.POSSIBLE?this.state=WorldWind.FAILED:this.state!=WorldWind.BEGAN&&this.state!=WorldWind.CHANGED||(this.state=WorldWind.CANCELLED))},e.prototype.prepareToRecognize=function(){this.translationX=0,this.translationY=0},e.prototype.shouldInterpret=function(){var t=this.translationX,e=this.translationY;return Math.sqrt(t*t+e*e)>this.interpretDistance},e.prototype.shouldRecognize=function(){var t=this.touchCount;return 0!=t&&t>=this.minNumberOfTouches&&t<=this.maxNumberOfTouches},e}),i("gesture/PinchRecognizer",["../gesture/GestureRecognizer"],function(t){"use strict";var e=function(e,i){t.call(this,e,i),this._scale=1,this._offsetScale=1,this.referenceDistance=0,this.interpretThreshold=20,this.weight=.4,this.pinchTouches=[]};return e.prototype=Object.create(t.prototype),Object.defineProperties(e.prototype,{scale:{get:function(){return this._scale*this._offsetScale}}}),e.prototype.reset=function(){t.prototype.reset.call(this),this._scale=1,this._offsetScale=1,this.referenceDistance=0,this.pinchTouches=[]},e.prototype.mouseDown=function(t){this.state==WorldWind.POSSIBLE&&(this.state=WorldWind.FAILED)},e.prototype.touchStart=function(t){this.pinchTouches.length<2&&2==this.pinchTouches.push(t)&&(this.referenceDistance=this.currentPinchDistance(),this._offsetScale*=this._scale,this._scale=1)},e.prototype.touchMove=function(t){if(2==this.pinchTouches.length)if(this.state==WorldWind.POSSIBLE)this.shouldRecognize()&&(this.state=WorldWind.BEGAN);else if(this.state==WorldWind.BEGAN||this.state==WorldWind.CHANGED){var e=this.currentPinchDistance(),i=Math.abs(e/this.referenceDistance),r=this.weight;this._scale=this._scale*(1-r)+i*r,this.state=WorldWind.CHANGED}},e.prototype.touchEnd=function(t){var e=this.pinchTouches.indexOf(t);-1!=e&&this.pinchTouches.splice(e,1),0==this.touchCount&&(this.state==WorldWind.POSSIBLE?this.state=WorldWind.FAILED:this.state!=WorldWind.BEGAN&&this.state!=WorldWind.CHANGED||(this.state=WorldWind.ENDED))},e.prototype.touchCancel=function(t){var e=this.pinchTouches.indexOf(t);-1!=e&&this.pinchTouches.splice(e,1),0==this.touchCount&&(this.state==WorldWind.POSSIBLE?this.state=WorldWind.FAILED:this.state!=WorldWind.BEGAN&&this.state!=WorldWind.CHANGED||(this.state=WorldWind.CANCELLED))},e.prototype.prepareToRecognize=function(){this.referenceDistance=this.currentPinchDistance(),this._scale=1},e.prototype.shouldRecognize=function(){var t=this.currentPinchDistance();return Math.abs(t-this.referenceDistance)>this.interpretThreshold},e.prototype.currentPinchDistance=function(){var t=this.pinchTouches[0],e=this.pinchTouches[1],i=t.clientX-e.clientX,r=t.clientY-e.clientY;return Math.sqrt(i*i+r*r)},e}),i("gesture/RotationRecognizer",["../geom/Angle","../gesture/GestureRecognizer"],function(t,e){"use strict";var i=function(t,i){e.call(this,t,i),this._rotation=0,this._offsetRotation=0,this.referenceAngle=0,this.interpretThreshold=20,this.weight=.4,this.rotationTouches=[]};return i.prototype=Object.create(e.prototype),Object.defineProperties(i.prototype,{rotation:{get:function(){return this._rotation+this._offsetRotation}}}),i.prototype.reset=function(){e.prototype.reset.call(this),this._rotation=0,this._offsetRotation=0,this.referenceAngle=0,this.rotationTouches=[]},i.prototype.mouseDown=function(t){this.state==WorldWind.POSSIBLE&&(this.state=WorldWind.FAILED)},i.prototype.touchStart=function(t){this.rotationTouches.length<2&&2==this.rotationTouches.push(t)&&(this.referenceAngle=this.currentTouchAngle(),this._offsetRotation+=this._rotation,this._rotation=0)},i.prototype.touchMove=function(e){if(2==this.rotationTouches.length)if(this.state==WorldWind.POSSIBLE)this.shouldRecognize()&&(this.state=WorldWind.BEGAN);else if(this.state==WorldWind.BEGAN||this.state==WorldWind.CHANGED){var i=this.currentTouchAngle(),r=t.normalizedDegrees(i-this.referenceAngle),n=this.weight;this._rotation=this._rotation*(1-n)+r*n,this.state=WorldWind.CHANGED}},i.prototype.touchEnd=function(t){var e=this.rotationTouches.indexOf(t);-1!=e&&this.rotationTouches.splice(e,1),0==this.touchCount&&(this.state==WorldWind.POSSIBLE?this.state=WorldWind.FAILED:this.state!=WorldWind.BEGAN&&this.state!=WorldWind.CHANGED||(this.state=WorldWind.ENDED))},i.prototype.touchCancel=function(t){var e=this.rotationTouches.indexOf(t);-1!=e&&(this.rotationTouches.splice(e,1),0==this.touchCount&&(this.state==WorldWind.POSSIBLE?this.state=WorldWind.FAILED:this.state!=WorldWind.BEGAN&&this.state!=WorldWind.CHANGED||(this.state=WorldWind.CANCELLED)))},i.prototype.prepareToRecognize=function(){this.referenceAngle=this.currentTouchAngle(),this._rotation=0},i.prototype.shouldRecognize=function(){var e=this.currentTouchAngle(),i=t.normalizedDegrees(e-this.referenceAngle);return Math.abs(i)>this.interpretThreshold},i.prototype.currentTouchAngle=function(){var e=this.rotationTouches[0],i=this.rotationTouches[1],r=e.clientX-i.clientX,n=e.clientY-i.clientY;return Math.atan2(n,r)*t.RADIANS_TO_DEGREES},i}),i("gesture/TiltRecognizer",["../gesture/PanRecognizer"],function(t){"use strict";var e=function(e,i){t.call(this,e,i),this.maxTouchDistance=250,this.maxTouchDivergence=50};return e.LEFT=1,e.RIGHT=2,e.UP=4,e.DOWN=8,e.prototype=Object.create(t.prototype),e.prototype.shouldInterpret=function(){for(var t=0,e=this.touchCount;t<e;t++){var i=this.touch(t),r=i.translationX,n=i.translationY;if(Math.sqrt(r*r+n*n)>this.interpretDistance)return!0}return!1},e.prototype.shouldRecognize=function(){if(this.touchCount<2)return!1;var t=this.touch(0),i=this.touch(1),r=t.clientX-i.clientX,n=t.clientY-i.clientY;if(Math.sqrt(r*r+n*n)>this.maxTouchDistance)return!1;var o=t.translationX-i.translationX,s=t.translationY-i.translationY;if(Math.sqrt(o*o+s*s)>this.maxTouchDivergence)return!1;var a=e.UP|e.DOWN;return 0!=(this.touchDirection(t)&a&this.touchDirection(i)&a)},e.prototype.touchDirection=function(t){var i=t.translationX,r=t.translationY,n=0;return Math.abs(i)>Math.abs(r)?(n|=i<0?e.LEFT:0,n|=i>0?e.RIGHT:0):(n|=r<0?e.UP:0,n|=r>0?e.DOWN:0),n},e}),i("navigate/LookAtNavigator",["../geom/Angle","../gesture/DragRecognizer","../geom/Frustum","../gesture/GestureRecognizer","../geom/Line","../geom/Location","../util/Logger","../geom/Matrix","../navigate/Navigator","../gesture/PanRecognizer","../gesture/PinchRecognizer","../geom/Position","../gesture/RotationRecognizer","../gesture/TiltRecognizer","../geom/Vec2","../geom/Vec3","../util/WWMath"],function(t,e,i,r,n,o,s,a,l,h,u,c,d,p,f,g,m){"use strict";var E=function(t){function i(t){t.preventDefault()}l.call(this,t),t.addEventListener("mousedown",i),t.addEventListener("touchstart",i),t.addEventListener("contextmenu",i),t.addEventListener("wheel",i),window.PointerEvent&&t.canvas.style.setProperty("touch-action","none"),this.lookAtLocation=new o(30,-110),this.range=1e7,this.enable2DLimits=!0;var r=this;this.primaryDragRecognizer=new e(t,function(t){r.handlePanOrDrag(t)}),this.secondaryDragRecognizer=new e(t,function(t){r.handleSecondaryDrag(t)}),this.secondaryDragRecognizer.button=2,this.panRecognizer=new h(t,function(t){r.handlePanOrDrag(t)}),this.pinchRecognizer=new u(t,function(t){r.handlePinch(t)}),this.rotationRecognizer=new d(t,function(t){r.handleRotation(t)}),this.tiltRecognizer=new p(t,function(t){r.handleTilt(t)}),t.addEventListener("wheel",function(t){r.handleWheelEvent(t)}),this.panRecognizer.recognizeSimultaneouslyWith(this.pinchRecognizer),this.panRecognizer.recognizeSimultaneouslyWith(this.rotationRecognizer),this.pinchRecognizer.recognizeSimultaneouslyWith(this.rotationRecognizer),this.panRecognizer.requireRecognizerToFail(this.tiltRecognizer),this.pinchRecognizer.requireRecognizerToFail(this.tiltRecognizer),this.rotationRecognizer.requireRecognizerToFail(this.tiltRecognizer),this.beginPoint=new f(0,0),this.lastPoint=new f(0,0),this.beginHeading=0,this.beginTilt=0,this.beginRange=0,this.lastRotation=0};return E.prototype=Object.create(l.prototype),E.prototype.currentState=function(){this.applyLimits();var t=this.worldWindow.globe,e=new c(this.lookAtLocation.latitude,this.lookAtLocation.longitude,0),i=a.fromIdentity();return i.multiplyByLookAtModelview(e,this.range,this.heading,this.tilt,this.roll,t),this.currentStateForModelview(i)},E.prototype.handlePanOrDrag=function(t){this.worldWindow.globe.is2D()?this.handlePanOrDrag2D(t):this.handlePanOrDrag3D(t)},E.prototype.handlePanOrDrag3D=function(e){var i=e.state,r=e.translationX,n=e.translationY;if(i==WorldWind.BEGAN)this.lastPoint.set(0,0);else if(i==WorldWind.CHANGED){var o=this.worldWindow.canvas,s=this.worldWindow.globe,a=m.max(s.equatorialRadius,s.polarRadius),l=m.max(1,this.range),h=m.perspectivePixelSize(o.clientWidth,o.clientHeight,l),u=(n-this.lastPoint[1])*h,c=-(r-this.lastPoint[0])*h,d=u/a*t.RADIANS_TO_DEGREES,p=c/a*t.RADIANS_TO_DEGREES,f=Math.sin(this.heading*t.DEGREES_TO_RADIANS),g=Math.cos(this.heading*t.DEGREES_TO_RADIANS);this.lookAtLocation.latitude+=d*g-p*f,this.lookAtLocation.longitude+=d*f+p*g,this.lastPoint.set(r,n),this.applyLimits(),this.worldWindow.redraw()}},E.prototype.handlePanOrDrag2D=function(t){var e=t.state,i=t.clientX,r=t.clientY,n=t.translationX,o=t.translationY;if(e==WorldWind.BEGAN)this.beginPoint.set(i,r),this.lastPoint.set(i,r);else if(e==WorldWind.CHANGED){var s=this.lastPoint[0],l=this.lastPoint[1],h=this.beginPoint[0]+n,u=this.beginPoint[1]+o;this.lastPoint.set(h,u);var c=this.currentState(),d=this.worldWindow.globe,p=c.rayFromScreenPoint(this.worldWindow.canvasCoordinates(s,l)),f=new g(0,0,0),m=new g(0,0,0),E=new g(0,0,0);if(!d.intersectsLine(p,f))return;if(p=c.rayFromScreenPoint(this.worldWindow.canvasCoordinates(h,u)),!d.intersectsLine(p,m))return;var y=a.fromIdentity();if(y.copy(c.modelview),y.multiplyByTranslation(m[0]-f[0],m[1]-f[1],m[2]-f[2]),y.extractEyePoint(p.origin),y.extractForwardVector(p.direction),!d.intersectsLine(p,E))return;var _=y.extractViewingParameters(E,this.roll,d,{});this.lookAtLocation.copy(_.origin),this.range=_.range,this.heading=_.heading,this.tilt=_.tilt,this.roll=_.roll,this.applyLimits(),this.worldWindow.redraw()}},E.prototype.handleSecondaryDrag=function(t){var e=t.state,i=t.translationX,r=t.translationY;if(e==WorldWind.BEGAN)this.beginHeading=this.heading,this.beginTilt=this.tilt;else if(e==WorldWind.CHANGED){var n=180*i/this.worldWindow.canvas.clientWidth,o=90*r/this.worldWindow.canvas.clientHeight;this.heading=this.beginHeading+n,this.tilt=this.beginTilt+o,this.applyLimits(),this.worldWindow.redraw()}},E.prototype.handlePinch=function(t){var e=t.state,i=t.scale;e==WorldWind.BEGAN?this.beginRange=this.range:e==WorldWind.CHANGED&&0!=i&&(this.range=this.beginRange/i,this.applyLimits(),this.worldWindow.redraw())},E.prototype.handleRotation=function(t){var e=t.state,i=t.rotation;e==WorldWind.BEGAN?this.lastRotation=0:e==WorldWind.CHANGED&&(this.heading-=i-this.lastRotation,this.lastRotation=i,this.applyLimits(),this.worldWindow.redraw())},E.prototype.handleTilt=function(t){var e=t.state,i=t.translationY;if(e==WorldWind.BEGAN)this.beginTilt=this.tilt;else if(e==WorldWind.CHANGED){var r=-90*i/this.worldWindow.canvas.clientHeight;this.tilt=this.beginTilt+r,this.applyLimits(),this.worldWindow.redraw()}},E.prototype.handleWheelEvent=function(t){var e;t.deltaMode==WheelEvent.DOM_DELTA_PIXEL?e=t.deltaY:t.deltaMode==WheelEvent.DOM_DELTA_LINE?e=40*t.deltaY:t.deltaMode==WheelEvent.DOM_DELTA_PAGE&&(e=400*t.deltaY);var i=1+e/1e3;this.range*=i,this.applyLimits(),this.worldWindow.redraw()},E.prototype.applyLimits=function(){if(this.lookAtLocation.latitude=m.clamp(this.lookAtLocation.latitude,-90,90),this.lookAtLocation.longitude=t.normalizedDegreesLongitude(this.lookAtLocation.longitude),this.range=m.clamp(this.range,1,Number.MAX_VALUE),this.heading=t.normalizedDegrees(this.heading),this.tilt=m.clamp(this.tilt,0,90),this.roll=t.normalizedDegrees(this.roll),this.worldWindow.globe.is2D()&&this.enable2DLimits){var e=2*Math.PI*this.worldWindow.globe.equatorialRadius;this.range=m.clamp(this.range,1,e),this.tilt=0}},E}),i("cache/MemoryCacheListener",["../util/Logger","../error/UnsupportedOperationError"],function(t,e){"use strict";var i=function(){};return i.prototype.entryRemoved=function(i,r){throw new e(t.logMessage(t.LEVEL_SEVERE,"MemoryCacheListener","entryRemoved","abstractInvocation"))},i.prototype.removalError=function(i,r,n){throw new e(t.logMessage(t.LEVEL_SEVERE,"MemoryCacheListener","removalError","abstractInvocation"))},i}),i("util/NominatimGeocoder",["../util/Logger"],function(t){"use strict";var e=function(){this.service="https://open.mapquestapi.com/nominatim/v1/search/"};return e.prototype.lookup=function(t,e,i){var r=this.service+t.replace(" ","%20")+"?format=json",n=new XMLHttpRequest,o=this;r+="&key="+(i||"lUvVRchXGGDh5Xwk3oidrXeIDAAevOUS"),n.open("GET",r,!0),n.onreadystatechange=function(){if(4===n.readyState&&200===n.status){var t=JSON.parse(n.responseText);e(o,t)}},n.send(null)},e}),i("layer/OpenStreetMapImageLayer",["../geom/Angle","../util/Color","../geom/Location","../geom/Sector","../layer/MercatorTiledImageLayer"],function(t,e,i,r,n){"use strict";var o=function(t){this.imageSize=256,t=t||"Open Street Map",n.call(this,new r(-85.05,85.05,-180,180),new i(85.05,180),19,"image/png",t,this.imageSize,this.imageSize),this.displayName=t,this.pickEnabled=!1,this.destCanvas=document.createElement("canvas"),this.destContext=this.destCanvas.getContext("2d"),this.urlBuilder={urlForTile:function(t,e){return"https://otile1.mqcdn.com/tiles/1.0.0/osm/"+(t.level.levelNumber+1)+"/"+t.column+"/"+t.row+".png"}}};return o.prototype=Object.create(n.prototype),o.prototype.doRender=function(t){n.prototype.doRender.call(this,t),this.inCurrentFrame&&(t.screenCreditController.addStringCredit("©OpenStreetMap",e.DARK_GRAY),t.screenCreditController.addStringCredit("Tiles Courtesy of MapQuest",e.DARK_GRAY))},o.prototype.createTopLevelTiles=function(t){this.topLevelTiles=[],this.topLevelTiles.push(this.createTile(null,this.levels.firstLevel(),0,0)),this.topLevelTiles.push(this.createTile(null,this.levels.firstLevel(),0,1)),this.topLevelTiles.push(this.createTile(null,this.levels.firstLevel(),1,0)),this.topLevelTiles.push(this.createTile(null,this.levels.firstLevel(),1,1))},o.prototype.mapSizeForLevel=function(t){return 256<<t+1},o}),i("projections/ProjectionGnomonic",["../geom/Angle","../error/ArgumentError","../projections/GeographicProjection","../util/Logger","../geom/Sector","../util/WWMath"],function(t,e,i,r,n,o){"use strict";var s=function(t){this.north=!("South"===t);var e=this.north?new n(30,90,-180,180):new n(-90,-30,-180,180);i.call(this,"Polar Gnomonic",!1,e),this._pole=t,this.displayName=this.north?"North Gnomonic":"South Gnomonic",this._stateKey="projection polar gnomonic "+this._pole+" "};return s.prototype=Object.create(i.prototype),Object.defineProperties(s.prototype,{pole:{get:function(){return this._pole},set:function(t){this._pole=t,this.north=!("South"===this._pole),this.projectionLimits=this.north?new n(30,90,-180,180):new n(-90,-30,-180,180),this._stateKey="projection polar gnomonic "+this._pole+" "}},stateKey:{get:function(){return this._stateKey}}}),s.prototype.geographicToCartesian=function(i,n,o,s,a,l){if(!i)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionGnomonic","geographicToCartesian","missingGlobe"));if(!l)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionGnomonic","geographicToCartesian","missingResult"));if(this.north&&90===n||!this.north&&-90===n)l[0]=0,l[1]=0,l[2]=s;else{var h=this.north?1:-1,u=i.equatorialRadius/Math.tan(n*t.DEGREES_TO_RADIANS);l[0]=u*Math.sin(o*t.DEGREES_TO_RADIANS)*h,l[1]=u*-Math.cos(o*t.DEGREES_TO_RADIANS),l[2]=s}return l},s.prototype.geographicToCartesianGrid=function(i,n,s,a,l,h,u,c){if(!i)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionGnomonic","geographicToCartesianGrid","missingGlobe"));if(!n)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionGnomonic","geographicToCartesianGrid","missingSector"));if(!l||l.length<s*a)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionGnomonic","geographicToCartesianGrid","The specified elevations array is null, undefined or insufficient length"));if(!c)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionGnomonic","geographicToCartesianGrid","missingResult"));var d,p,f,g,m,E,y=n.minLatitude*t.DEGREES_TO_RADIANS,_=n.maxLatitude*t.DEGREES_TO_RADIANS,v=n.minLongitude*t.DEGREES_TO_RADIANS,S=n.maxLongitude*t.DEGREES_TO_RADIANS,b=(_-y)/(s>1?s-1:1),T=(S-v)/(a>1?a-1:1),L=this.projectionLimits.minLatitude*t.DEGREES_TO_RADIANS,w=this.projectionLimits.maxLatitude*t.DEGREES_TO_RADIANS,R=this.north?1:-1,x=h||new Vec3(0,0,0),M=0,C=0;for(d=0,f=y;d<s;d++,f+=b)for(d===s-1&&(f=_),m=o.clamp(f,L,w),E=i.equatorialRadius/Math.tan(m),(this.north&&m===Math.PI/2||!this.north&&m===-Math.PI/2)&&(E=0),p=0,g=v;p<a;p++,g+=T)p===a-1&&(g=S),c[C++]=E*Math.sin(g)*R-x[0],c[C++]=E*-Math.cos(g)-x[1],c[C++]=l[M++]-x[2];return c},s.prototype.cartesianToGeographic=function(i,n,o,s,a,l){if(!i)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionGnomonic","cartesianToGeographic","missingGlobe"));if(!l)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionGnomonic","cartesianToGeographic","missingResult"));var h,u=Math.sqrt(n*n+o*o);return u<1e-4?(l.latitude=this.north?90:-90,l.longitude=0,l.altitude=s):(h=Math.atan2(u,i.equatorialRadius),h>Math.PI&&(h=Math.PI),l.latitude=Math.asin(Math.cos(h)*(this.north?1:-1))*t.RADIANS_TO_DEGREES,l.longitude=Math.atan2(n,o*(this.north?-1:1))*t.RADIANS_TO_DEGREES,l.altitude=s),l},s.prototype.northTangentAtLocation=function(i,n,o,s){if(!s)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionGnomonic","northTangentAtLocation","missingResult"));return s[0]=Math.sin(o*t.DEGREES_TO_RADIANS)*(this.north?-1:1),s[1]=Math.cos(o*t.DEGREES_TO_RADIANS),s[2]=0,s},s.prototype.northTangentAtPoint=function(t,i,n,o,s,a){if(!a)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionGnomonic","northTangentAtLocation","missingResult"));var l=Math.sqrt(i*i+n*n);return l<1e-4?(a[0]=0,a[1]=1,a[2]=0):(a[0]=i/l*(this.north?-1:1),a[1]=n/l*(this.north?-1:1),a[2]=0),a},s}),i("projections/ProjectionMercator",["../geom/Angle","../error/ArgumentError","../projections/GeographicProjection","../util/Logger","../geom/Sector","../geom/Vec3","../util/WWMath"],function(t,e,i,r,n,o,s){"use strict";var a=function(){i.call(this,"Mercator",!0,new n(-78,78,-180,180))};return a.prototype=Object.create(i.prototype),a.prototype.geographicToCartesian=function(i,n,o,s,a,l){if(!i)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionMercator","geographicToCartesian","missingGlobe"));if(!l)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionMercator","geographicToCartesian","missingResult"));n>this.projectionLimits.maxLatitude&&(n=this.projectionLimits.maxLatitude),n<this.projectionLimits.minLatitude&&(n=this.projectionLimits.minLatitude);var h=Math.sqrt(i.eccentricitySquared),u=Math.sin(n*t.DEGREES_TO_RADIANS),c=(1+u)/(1-u)*Math.pow((1-h*u)/(1+h*u),h);return l[0]=i.equatorialRadius*o*t.DEGREES_TO_RADIANS+(a?a[0]:0),l[1]=.5*i.equatorialRadius*Math.log(c),l[2]=s,l},Object.defineProperties(a.prototype,{stateKey:{get:function(){return"projection mercator "}}}),a.prototype.geographicToCartesianGrid=function(i,n,a,l,h,u,c,d){if(!i)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionMercator","geographicToCartesianGrid","missingGlobe"));if(!n)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionMercator","geographicToCartesianGrid","missingSector"));if(!h||h.length<a*l)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionMercator","geographicToCartesianGrid","The specified elevations array is null, undefined or insufficient length"));if(!d)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionMercator","geographicToCartesianGrid","missingResult"));var p,f,g,m,E,y,_,v,S=i.equatorialRadius,b=Math.sqrt(i.eccentricitySquared),T=n.minLatitude*t.DEGREES_TO_RADIANS,L=n.maxLatitude*t.DEGREES_TO_RADIANS,w=n.minLongitude*t.DEGREES_TO_RADIANS,R=n.maxLongitude*t.DEGREES_TO_RADIANS,x=(L-T)/(a>1?a-1:1),M=(R-w)/(l>1?l-1:1),C=this.projectionLimits.minLatitude*t.DEGREES_TO_RADIANS,A=this.projectionLimits.maxLatitude*t.DEGREES_TO_RADIANS,P=u||new o(0,0,0),I=c?c[0]:0,O=0,N=0;for(p=0,g=T;p<a;p++,g+=x)for(p===a-1&&(g=L),E=s.clamp(g,C,A),y=Math.sin(E),_=(1+y)/(1-y)*Math.pow((1-b*y)/(1+b*y),b),v=S*Math.log(_)*.5-P[1],f=0,m=w;f<l;f++,m+=M)f===l-1&&(m=R),d[N++]=S*m-P[0]+I,d[N++]=v,d[N++]=h[O++]-P[2];return d},a.prototype.cartesianToGeographic=function(i,n,o,s,a,l){if(!i)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionMercator","cartesianToGeographic","missingGlobe"));if(!l)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionMercator","cartesianToGeographic","missingResult"));var h=i.eccentricitySquared,u=h*h,c=u*h,d=c*h,p=Math.pow(Math.E,-o/i.equatorialRadius),f=Math.PI/2-2*Math.atan(p),g=h/2+5*u/24+c/12+13*d/360,m=7*u/48+29*c/240+811*d/11520,E=7*c/120+81*d/1120,y=4279*d/161280,_=f-m+y,v=g-3*E,S=2*m-8*y,b=4*E,T=8*y,L=Math.sin(2*f),w=_+L*(v+L*(S+L*(b+T*L)));return l.latitude=w*t.RADIANS_TO_DEGREES,l.longitude=(n-(a?a[0]:0))/i.equatorialRadius*t.RADIANS_TO_DEGREES,l.altitude=s,l},a}),i("projections/ProjectionPolarEquidistant",["../geom/Angle","../error/ArgumentError","../projections/GeographicProjection","../util/Logger"],function(t,e,i,r){"use strict";var n=function(t){i.call(this,"Polar Equidistant",!1,null),this._pole=t,this.north=!("South"===t),this.displayName=this.north?"North Polar":"South Polar",this._stateKey="projection polar equidistant "+this._pole+" "};return n.prototype=Object.create(i.prototype),Object.defineProperties(n.prototype,{pole:{get:function(){return this._pole},set:function(t){this._pole=t,this.north=!("South"===this._pole),this._stateKey="projection polar equidistant "+this._pole+" "}},stateKey:{get:function(){return this._stateKey}}}),n.prototype.geographicToCartesian=function(i,n,o,s,a,l){if(!i)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionPolarEquidistant","geographicToCartesian","missingGlobe"));if(!l)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionPolarEquidistant","geographicToCartesian","missingResult"));if(this.north&&90===n||!this.north&&-90===n)l[0]=0,l[1]=0,l[2]=s;else{var h=this.north?-1:1,u=i.equatorialRadius*(Math.PI/2+n*t.DEGREES_TO_RADIANS*h);l[0]=u*Math.sin(o*t.DEGREES_TO_RADIANS),l[1]=u*Math.cos(o*t.DEGREES_TO_RADIANS)*h,l[2]=s}return l},n.prototype.geographicToCartesianGrid=function(i,n,o,s,a,l,h,u){if(!i)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionPolarEquidistant","geographicToCartesianGrid","missingGlobe"));if(!n)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionPolarEquidistant","geographicToCartesianGrid","missingSector"));if(!a||a.length<o*s)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionPolarEquidistant","geographicToCartesianGrid","The specified elevations array is null, undefined or insufficient length"));if(!u)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionPolarEquidistant","geographicToCartesianGrid","missingResult"));var c,d,p,f,g,m=i.equatorialRadius,E=n.minLatitude*t.DEGREES_TO_RADIANS,y=n.maxLatitude*t.DEGREES_TO_RADIANS,_=n.minLongitude*t.DEGREES_TO_RADIANS,v=n.maxLongitude*t.DEGREES_TO_RADIANS,S=(y-E)/(o>1?o-1:1),b=(v-_)/(s>1?s-1:1),T=this.north?-1:1,L=l||new Vec3(0,0,0),w=Math.PI/2,R=0,x=0,M=new Float64Array(s),C=new Float64Array(s);for(d=0,f=_;d<s;d++,f+=b)d===s-1&&(f=v),M[d]=Math.cos(f),C[d]=Math.sin(f);for(c=0,p=E;c<o;c++,p+=S)for(c===o-1&&(p=y),g=m*(w+p*T),(this.north&&p===w||!this.north&&p===-w)&&(g=0),d=0;d<s;d++)u[x++]=g*C[d]-L[0],u[x++]=g*M[d]*T-L[1],u[x++]=a[R++]-L[2];return u},n.prototype.cartesianToGeographic=function(i,n,o,s,a,l){if(!i)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionPolarEquidistant","cartesianToGeographic","missingGlobe"));if(!l)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionPolarEquidistant","cartesianToGeographic","missingResult"));var h,u=Math.sqrt(n*n+o*o);return u<1e-4?(l.latitude=this.north?90:-90,l.longitude=0,l.altitude=s):(h=u/i.equatorialRadius,h>Math.PI&&(h=Math.PI),l.latitude=Math.asin(Math.cos(h)*(this.north?1:-1))*t.RADIANS_TO_DEGREES,l.longitude=Math.atan2(n,o*(this.north?-1:1))*t.RADIANS_TO_DEGREES,l.altitude=s),l},n.prototype.northTangentAtLocation=function(i,n,o,s){if(!s)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionPolarEquidistant","northTangentAtLocation","missingResult"));return s[0]=Math.sin(o*t.DEGREES_TO_RADIANS)*(this.north?-1:1),s[1]=Math.cos(o*t.DEGREES_TO_RADIANS),s[2]=0,s},n.prototype.northTangentAtPoint=function(t,i,n,o,s,a){
if(!a)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionPolarEquidistant","northTangentAtLocation","missingResult"));var l=Math.sqrt(i*i+n*n);return l<1e-4?(a[0]=0,a[1]=1,a[2]=0):(a[0]=i/l*(this.north?-1:1),a[1]=n/l*(this.north?-1:1),a[2]=0),a},n}),i("projections/ProjectionUPS",["../geom/Angle","../error/ArgumentError","../projections/GeographicProjection","../util/Logger","../geom/Sector","../geom/Vec3","../util/WWMath"],function(t,e,i,r,n,o,s){"use strict";var a=function(t){this.north=!("South"===t);var e=this.north?new n(0,90,-180,180):new n(-90,0,-180,180);i.call(this,"Uniform Polar Stereographic",!1,e),this._pole=t,this.displayName=this.north?"North UPS":"South UPS",this._stateKey="projection ups "+this._pole+" "};return a.prototype=Object.create(i.prototype),Object.defineProperties(a.prototype,{pole:{get:function(){return this._pole},set:function(t){this._pole=t,this.north=!("South"===this._pole),this.projectionLimits=this.north?new n(0,90,-180,180):new n(-90,0,-180,180),this._stateKey="projection ups "+this._pole+" "}},stateKey:{get:function(){return this._stateKey}}}),a.prototype.geographicToCartesian=function(i,n,o,s,a,l){if(!i)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionUPS","geographicToCartesian","missingGlobe"));if(!l)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionUPS","geographicToCartesian","missingResult"));if(this.north&&90===n||!this.north&&-90===n)l[0]=0,l[1]=0,l[2]=s;else{var h,u,c,d=this.north?1:-1,p=n*t.DEGREES_TO_RADIANS,f=o*t.DEGREES_TO_RADIANS,g=Math.sqrt(i.eccentricitySquared),m=Math.sqrt(Math.pow(1+g,1+g)*Math.pow(1-g,1-g));(this.north&&p<0||!this.north&&p>0)&&(p=0),h=Math.sin(p*d),u=Math.sqrt((1-h)/(1+h)*Math.pow((1+g*h)/(1-g*h),g)),c=2*i.equatorialRadius*.994*u/m,l[0]=c*Math.sin(f),l[1]=-c*Math.cos(f)*d,l[2]=s}return l},a.prototype.geographicToCartesianGrid=function(i,n,a,l,h,u,c,d){if(!i)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionUPS","geographicToCartesianGrid","missingGlobe"));if(!n)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionUPS","geographicToCartesianGrid","missingSector"));if(!h||h.length<a*l)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionUPS","geographicToCartesianGrid","The specified elevations array is null, undefined or insufficient length"));if(!d)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionUPS","geographicToCartesianGrid","missingResult"));var p,f,g,m,E,y,_,v,S=i.equatorialRadius,b=n.minLatitude*t.DEGREES_TO_RADIANS,T=n.maxLatitude*t.DEGREES_TO_RADIANS,L=n.minLongitude*t.DEGREES_TO_RADIANS,w=n.maxLongitude*t.DEGREES_TO_RADIANS,R=(T-b)/(a>1?a-1:1),x=(w-L)/(l>1?l-1:1),M=this.projectionLimits.minLatitude*t.DEGREES_TO_RADIANS,C=this.projectionLimits.maxLatitude*t.DEGREES_TO_RADIANS,A=Math.sqrt(i.eccentricitySquared),P=Math.sqrt(Math.pow(1+A,1+A)*Math.pow(1-A,1-A)),I=this.north?1:-1,O=u||new o(0,0,0),N=0,D=0;for(p=0,g=b;p<a;p++,g+=R)for(p===a-1&&(g=T),E=s.clamp(g,M,C),y=Math.sin(E*I),_=Math.sqrt((1-y)/(1+y)*Math.pow((1+A*y)/(1-A*y),A)),v=2*S*.994*_/P,f=0,m=L;f<l;f++,m+=x)f===l-1&&(m=w),d[D++]=v*Math.sin(m)-O[0],d[D++]=-v*Math.cos(m)*I-O[1],d[D++]=h[N++]-O[2];return d},a.prototype.cartesianToGeographic=function(i,n,o,s,a,l){if(!i)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionUPS","cartesianToGeographic","missingGlobe"));if(!l)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionUPS","cartesianToGeographic","missingResult"));var h=Math.atan2(n,o*(this.north?-1:1)),u=Math.sqrt(i.eccentricitySquared),c=Math.sqrt(n*n+o*o),d=Math.sqrt(Math.pow(1+u,1+u)*Math.pow(1-u,1-u)),p=c*d/(2*i.equatorialRadius*.994),f=i.eccentricitySquared,g=f*f,m=g*f,E=m*f,y=Math.PI/2-2*Math.atan(p),_=f/2+5*g/24+m/12+13*E/360,v=7*g/48+29*m/240+811*E/11520,S=7*m/120+81*E/1120,b=4279*E/161280,T=y-v+b,L=_-3*S,w=2*v-8*b,R=4*S,x=8*b,M=Math.sin(2*y),C=T+M*(L+M*(w+M*(R+x*M)));return C*=this.north?1:-1,l.latitude=C*t.RADIANS_TO_DEGREES,l.longitude=h*t.RADIANS_TO_DEGREES,l.altitude=s,l},a.prototype.northTangentAtLocation=function(i,n,o,s){if(!s)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionUPS","northTangentAtLocation","missingResult"));return s[0]=Math.sin(o*t.DEGREES_TO_RADIANS)*(this.north?-1:1),s[1]=Math.cos(o*t.DEGREES_TO_RADIANS),s[2]=0,s},a.prototype.northTangentAtPoint=function(t,i,n,o,s,a){if(!a)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionPolarEquidistant","northTangentAtLocation","missingResult"));var l=Math.sqrt(i*i+n*n);return l<1e-4?(a[0]=0,a[1]=1,a[2]=0):(a[0]=i/l*(this.north?-1:1),a[1]=n/l*(this.north?-1:1),a[2]=0),a},a}),i("formats/kml/util/Scale",["./../KmlElements","../KmlObject","./NodeTransformers"],function(t,e,i){"use strict";var r=function(t){e.call(this,t)};return r.prototype=Object.create(e.prototype),Object.defineProperties(r.prototype,{kmlX:{get:function(){return this._factory.specific(this,{name:"x",transformer:i.number})}},kmlY:{get:function(){return this._factory.specific(this,{name:"y",transformer:i.number})}},kmlZ:{get:function(){return this._factory.specific(this,{name:"z",transformer:i.number})}}}),r.prototype.getTagNames=function(){return["Scale"]},t.addKey(r.prototype.getTagNames()[0],r),r}),i("util/ByteBuffer",["../error/ArgumentError","../util/Logger"],function(t,e){"use strict";var i=function(r){if(!r)throw new t(e.logMessage(e.LEVEL_SEVERE,"ByteBuffer","constructor","missingArray"));this.array=r,this.data=new DataView(r),this.position=0,this._order=i.LITTLE_ENDIAN};return i.prototype.getByte=function(){var t=this.data.getUint8(this.position);return this.position+=i.BYTE_SIZE,t},i.prototype.getByteArray=function(t){var e=new Uint8Array(this.array,this.position,t);return this.position+=i.BYTE_SIZE*t,e},i.prototype.getInt16=function(){var t=this.data.getInt16(this.position,this._order);return this.position+=i.INT16_SIZE,t},i.prototype.getInt16Array=function(t){var e=new Int16Array(this.array,this.position,t);return this.position+=i.INT16_SIZE*t,e},i.prototype.getInt32=function(){var t=this.data.getInt32(this.position,this._order);return this.position+=i.INT32_SIZE,t},i.prototype.getInt32Array=function(t){var e=new Int32Array(this.array,this.position,t);return this.position+=i.INT32_SIZE*t,e},i.prototype.getFloat=function(){var t=this.data.getFloat32(this.position,this._order);return this.position+=i.FLOAT_SIZE,t},i.prototype.getFloatArray=function(t){var e=new Float32Array(this.array,this.position,t);return this.position+=i.FLOAT_SIZE*t,e},i.prototype.getDouble=function(){var t=this.data.getFloat64(this.position,this._order);return this.position+=i.DOUBLE_SIZE,t},i.prototype.getDoubleArray=function(t){var e;if(this.position%8!=0){var r=this.array.slice(this.position,this.position+t*i.DOUBLE_SIZE);e=new Float64Array(r)}else e=new Float64Array(this.array,this.position,t);return this.position+=i.DOUBLE_SIZE*t,e},i.prototype.skipBytes=function(t){this.position+=t*i.BYTE_SIZE},i.prototype.skipInt16s=function(t){this.position+=t*i.INT16_SIZE},i.prototype.skipInt32s=function(t){this.position+=t*i.INT32_SIZE},i.prototype.skipFloats=function(t){this.position+=t*i.FLOAT_SIZE},i.prototype.skipDoubles=function(t){this.position+=t*i.DOUBLE_SIZE},i.prototype.seek=function(t){this.position=t},i.prototype.order=function(t){this._order=t},i.prototype.limit=function(){return this.data.byteLength},i.prototype.hasRemaining=function(){return this.position<this.data.byteLength},i.BIG_ENDIAN=!1,i.LITTLE_ENDIAN=!0,i.BYTE_SIZE=1,i.INT16_SIZE=2,i.INT32_SIZE=4,i.FLOAT_SIZE=4,i.DOUBLE_SIZE=8,i}),i("formats/shapefile/DBaseField",["../../error/ArgumentError","../../util/ByteBuffer","../../formats/shapefile/DBaseFile","../../util/Logger"],function(t,e,i,r){"use strict";var n=function(e,i){if(!e)throw new t(r.logMessage(r.LEVEL_SEVERE,"DBaseField","constructor","missingAttributeName"));if(!i)throw new t(r.logMessage(r.LEVEL_SEVERE,"DBaseField","constructor","missingBuffer"));this.name=null,this.type=null,this.typeCode=-1,this.length=-1,this.decimals=-1,this.readFieldDescriptor(e,i)};return n.prototype.getName=function(){return this.name},n.prototype.getType=function(){return this.type},n.prototype.getLength=function(){return this.length},n.prototype.getDecimals=function(){return this.decimals},n.prototype.readFieldDescriptor=function(t,i){i.order(e.LITTLE_ENDIAN);var o=i.position;if(this.name=t.readNullTerminatedString(i,n.FIELD_NAME_LENGTH),i.seek(o+n.FIELD_NAME_LENGTH),this.typeCode=String.fromCharCode(i.getByte()),this.type=n.getFieldType(this.typeCode),null==this.type)throw new Error(r.log(r.LEVEL_SEVERE,"Shapefile dBase encountered unsupported field type: "+this.typeCode));i.skipBytes(4),this.length=i.getByte(),this.decimals=i.getByte(),i.seek(o+n.FIELD_DESCRIPTOR_LENGTH)},n.getFieldType=function(t){switch(t){case"C":return n.TYPE_CHAR;case"D":return n.TYPE_DATE;case"F":return n.TYPE_NUMBER;case"L":return n.TYPE_BOOLEAN;case"N":return n.TYPE_NUMBER;default:return null}},n.prototype.toString=function(){return this.name+"("+this.typeCode+")"},n.TYPE_CHAR="DBase.FieldTypeChar",n.TYPE_NUMBER="DBase.FieldTypeNumber",n.TYPE_DATE="DBase.FieldTypeDate",n.TYPE_BOOLEAN="DBase.FieldTypeBoolean",n.FIELD_NAME_LENGTH=11,n.FIELD_DESCRIPTOR_LENGTH=32,n}),i("formats/shapefile/DBaseRecord",["../../error/ArgumentError","../../util/ByteBuffer","../../formats/shapefile/DBaseField","../../formats/shapefile/DBaseFile","../../util/Logger"],function(t,e,i,r,n){"use strict";var o=function(e,i,r){if(!e)throw new t(n.logMessage(n.LEVEL_SEVERE,"DBaseRecord","constructor","missingAttributeName"));if(!i)throw new t(n.logMessage(n.LEVEL_SEVERE,"DBaseRecord","constructor","missingBuffer"));this.deleted=!1,this.recordNumber=r,this.values=null,this.readFromBuffer(e,i,r)};return o.prototype.isDeleted=function(){return this.deleted},o.prototype.getRecordNumber=function(){return this.recordNumber},o.prototype.readFromBuffer=function(t,r,o){r.order(e.LITTLE_ENDIAN),this.recordNumber=o;var s=r.getByte();this.deleted=42==s;var a=t.getFields();this.values={};for(var l=0,h=a.length;l<h;l+=1){var u=a[l],c=u.getName(),d=t.readNullTerminatedString(r,u.getLength()).trim();try{if(u.getType()==i.TYPE_BOOLEAN){var p=d.charAt(0);this.values[c]="t"==p||"T"==p||"Y"==p||"y"==p}else u.getType()==i.TYPE_CHAR?this.values[c]=d:u.getType()==i.TYPE_DATE?this.values[c]=new Date(d):u.getType()==i.TYPE_NUMBER&&(this.values[c]=+d)}catch(t){n.log(n.LEVEL_WARNING,"Shapefile attribute parsing error:"+u.toString()+" -> "+d.toString()+" ["+t+"]")}}},o}),i("formats/shapefile/DBaseFile",["../../error/ArgumentError","../../util/ByteBuffer","../../formats/shapefile/DBaseField","../../formats/shapefile/DBaseRecord","../../util/Logger"],function(t,e,i,r,n){"use strict";var o=function(e){if(!e)throw new t(n.logMessage(n.LEVEL_SEVERE,"DBaseFile","constructor","missingUrl"));this.url=e,this.header=null,this.fields=null,this.buffer=null,this.boolean=!0,this.numRecordsRead=0,this._completionCallback=null};return o.prototype.getLastModificationDate=function(){return this.header.lastModificationDate},o.prototype.getNumberOfRecords=function(){return this.header.numberOfRecords},o.prototype.getHeaderLength=function(){return this.header.headerLength},o.prototype.getRecordLength=function(){return this.header.recordLength},o.prototype.getNumberOfFields=function(){return(this.header.headerLength-1-o.FIXED_HEADER_LENGTH)/o.FIELD_DESCRIPTOR_LENGTH},o.prototype.getFields=function(){return this.fields},o.prototype.hasNext=function(){return this.numRecordsRead<this.header.numberOfRecords},o.prototype.nextRecord=function(){return this.numRecordsRead>=this.getNumberOfRecords()?null:this.readNextRecord(this._buffer,++this.numRecordsRead)},o.prototype.load=function(t){this._completionCallback=t,this.requestUrl(this.url)},o.prototype.requestUrl=function(t){var i=new XMLHttpRequest;i.open("GET",t,!0),i.responseType="arraybuffer",i.onreadystatechange=function(){4===i.readyState&&(200===i.status?(this._buffer=new e(i.response),this.parse(),this._completionCallback&&this._completionCallback(this)):(n.log(n.LEVEL_WARNING,"DBaseFile retrieval failed ("+i.statusText+"): "+t),this._completionCallback&&this._completionCallback(this)))}.bind(this),i.onerror=function(){n.log(n.LEVEL_WARNING,"DBaseFile retrieval failed: "+t),this._completionCallback&&this._completionCallback(this)},i.ontimeout=function(){n.log(n.LEVEL_WARNING,"DBaseFile retrieval timed out: "+t),this._completionCallback&&this._completionCallback(this)},i.send(null)},o.prototype.parse=function(){this.header=this.readHeader(this._buffer),this.fields=this.readFieldDescriptors(this._buffer,this.getNumberOfFields())},o.prototype.readHeader=function(t){var i=t.position;t.order(e.LITTLE_ENDIAN);var r=t.getByte();if(r>5)throw new Error("???");var n=t.getByte(),s=t.getByte(),a=t.getByte(),l=t.getInt32(),h=t.getInt16(),u=t.getInt16(),c={year:1900+n,month:s-1,day:a},d={fileCode:r,lastModificationDate:c,numberOfRecords:l,headerLength:h,recordLength:u};return t.seek(i+o.FIXED_HEADER_LENGTH),d},o.prototype.readFieldDescriptors=function(t,e){for(var r=t.position,n=[],s=0;s<e;s+=1)n[s]=new i(this,t);var a=this.header.headerLength-o.FIXED_HEADER_LENGTH;return t.seek(r+a),n},o.prototype.readNextRecord=function(t,e){return new r(this,t,e)},o.prototype.readNullTerminatedString=function(t,e){if(e<=0)return 0;for(var i="",r=0;r<e;r+=1){var n=t.getByte();if(0==n)break;i+=String.fromCharCode(n)}return this.isStringEmpty(i)?"":i},o.prototype.isStringEmpty=function(t){return t.length<=0||o.isStringFilled(t,32)||o.isStringFilled(t,42)},o.isStringFilled=function(t,e){if(t.length<=0)return!1;for(var i=0;i<t.length;i++)if(t.charAt(i)!=e)return!1;return!0},o.FIXED_HEADER_LENGTH=32,o.FIELD_DESCRIPTOR_LENGTH=32,o}),i("formats/shapefile/PrjFile",["../../error/ArgumentError","../../util/Logger","../../error/NotYetImplementedError"],function(t,e,i){"use strict";var r=function(i){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"DBaseFile","constructor","missingUrl"));this._url=i,this._completionCallback=null,this._params=null};return Object.defineProperties(r.prototype,{url:{get:function(){return this._url}},coordinateSystem:{get:function(){return this.params?this.params[r.COORDINATE_SYSTEM]:null}},params:{get:function(){return this._params}}}),r.prototype.load=function(t){this._completionCallback=t,this.requestUrl(this._url)},r.prototype.requestUrl=function(t){var i=new XMLHttpRequest;i.open("GET",t,!0),i.responseType="arraybuffer",i.onreadystatechange=function(){if(4===i.readyState){if(200===i.status){var r=String.fromCharCode.apply(null,new Uint8Array(i.response));this._params=this.decodeOGCCoordinateSystem(r)}else e.log(e.LEVEL_WARNING,"PrjFile retrieval failed ("+i.statusText+"): "+t);this._completionCallback&&this._completionCallback(this)}}.bind(this),i.onerror=function(){e.log(e.LEVEL_WARNING,"PrjFile retrieval failed: "+t),this._completionCallback&&this._completionCallback(this)}.bind(this),i.ontimeout=function(){e.log(e.LEVEL_WARNING,"PrjFile retrieval timed out: "+t),this._completionCallback&&this._completionCallback(this)}.bind(this),i.send(null)},r.prototype.decodeOGCCoordinateSystem=function(n){n||new t(e.logMessage(e.LEVEL_SEVERE,"PrjFile","decodeOGCCoordinateSystem","missingText"));var o={};if(n=n.trim().toUpperCase(),r.GEOGCS_WKT_PATTERN.test(n))o[r.COORDINATE_SYSTEM]=r.COORDINATE_SYSTEM_GEOGRAPHIC;else{if(n.match(r.PROJCS_WKT_PATTERN))throw o[PrfFile.COORDINATE_SYSTEM]=r.COORDINATE_SYSTEM_PROJECTED,new i(e.log(e.LEVEL_SEVERE,"PrjFile implementation  for projected coordinate systems in incomplete."));o[r.COORDINATE_SYSTEM]=r.COORDINATE_SYSTEM_UNKNOWN}return o},r.prototype.isUnknownCoordinateSystem=function(){return!this.params||this.params.coordinateSystem===r.COORDINATE_SYSTEM_UNKNOWN},r.prototype.isKnownCoordinateSystem=function(){return!!this.params&&this.params.coordinateSystem!==r.COORDINATE_SYSTEM_UNKNOWN},r.prototype.isGeographicCoordinateSystem=function(){return!!this.params&&this.params.coordinateSystem===r.COORDINATE_SYSTEM_GEOGRAPHIC},r.prototype.isProjectedCoordinateSystem=function(){return!!this.params&&this.params.coordinateSystem===r.COORDINATE_SYSTEM_PROJECTED},r.GEOGCS_WKT_PATTERN=new RegExp("\\{*GEOGCS[\\[\\(](.*)[\\]\\)]\\}*"),r.PROJCS_WKT_PATTERN=new RegExp("\\{*PROJCS[\\[\\(](.*)[\\]\\)]\\}*"),r.UTM_NAME_WKT_PATTERN=new RegExp(".*UTM.*ZONE.*?(\\d+).*?([\\w\\s]+).*?"),r.COORDINATE_SYSTEM="Coordinate_system",r.COORDINATE_SYSTEM_GEOGRAPHIC="Coordinate_system_geographic",r.COORDINATE_SYSTEM_PROJECTED="Coordinate_system_projected",r.COORDINATE_SYSTEM_UNKNOWN="Coordinate_system_unknown",r.PROJECTION_NAME="Projection_name",r.PROJECTION_UTM="Projection_UTM",r.PROJECTION_ZONE="Projection_zone",r.PROJECTION_HEMISPHERE="Projection_hemisphere",r.PROJECTION_HEMISPHERE_NORTH="Projection_hemisphere_north",r.PROJECTION_HEMISPHERE_SOUTH="Projection_hemisphere_south",r}),i("formats/shapefile/ShapefileRecord",["../../geom/Angle","../../error/ArgumentError","../../util/ByteBuffer","../../geom/Location","../../util/Logger","../../formats/shapefile/Shapefile"],function(t,e,i,r,n,o){"use strict";var s=function(t,i){if(!t)throw new e(n.logMessage(n.LEVEL_SEVERE,"ShapefileRecord","constructor","The specified shapefile is null or undefined"));if(!i)throw new e(n.logMessage(n.LEVEL_SEVERE,"ShapefileRecord","constructor","The specified buffer is null or undefined"));this._shapefile=t,this._recordNumber=-1,this._attributes={},this._numberOfParts=0,this._firstPartNumber=0,this._lastPartNumber=0,this._numberOfPoints=0,this._boundingRectangle=[],this._zRange=null,this._zValues=null,this._mRange=null,this._mValues=null,this._contentLengthInBytes=-1,this._buffer=i,this._isNormalized=!1,this._parts=[],this.readRecord()};return Object.defineProperties(s.prototype,{shapefile:{get:function(){return this._shapefile}},recordNumber:{get:function(){return this._recordNumber}},attributes:{get:function(){return this._attributes}},numberOfParts:{get:function(){return this._numberOfParts}},firstPartNumber:{get:function(){return this._firstPartNumber}},lastPartNumber:{get:function(){return this._lastPartNumber}},numberOfPoints:{get:function(){return this._numberOfPoints}},boundingRectangle:{get:function(){return this._boundingRectangle}},zRange:{get:function(){return this._zRange}},zValues:{get:function(){return this._zValues}},mRange:{get:function(){return this._mRange}},mValues:{get:function(){return this._mValues}}}),s.prototype.pointBuffer=function(t){return t>=0&&t<this._parts.length?this._parts[t]:null},s.prototype.readRecord=function(){this.readHeader(),this._buffer.order(i.LITTLE_ENDIAN);var t=this._buffer.getInt32(),e=this.shapefile.getShapeType(t);this.validateShapeType(e),this.readContents()},s.prototype.readHeader=function(){this._buffer.order(i.BIG_ENDIAN),this._recordNumber=this._buffer.getInt32(),this._contentLengthInBytes=2*this._buffer.getInt32()},s.prototype.validateShapeType=function(t){if(t!==this.shapefile.NULL&&t!==this.shapefile.shapeType)throw new Error(n.log(n.LEVEL_SEVERE,"Shapefile record is not supported."))},s.prototype.readNullContents=function(){this._numberOfParts=0,this._numberOfPoints=0,this._parts=null,this._boundingRectangle=null,this._buffer.seek(this._contentLengthInBytes-i.INT32_SIZE)},s.prototype.readPointContents=function(){this._numberOfParts=1,this._firstPartNumber=0,this._lastPartNumber=this._numberOfParts-1,this._numberOfPoints=1,this._parts=[this._buffer.getDoubleArray(2)];var t=this._parts[0][1],e=this._parts[0][0];this._boundingRectangle=[t,t,e,e],this.isZType()&&this.readZ(!0),this.isMeasureType()&&this.readOptionalMeasures(!0)},s.prototype.readPolylineContents=function(){var t=this.shapefile.readBoundingRectangle(this._buffer);if(this._boundingRectangle=t.coords,this._isNormalized=t.isNormalized,this._numberOfParts=this._buffer.getInt32(),this._firstPartNumber=0,this._lastPartNumber=this._numberOfParts-1,this._numberOfPoints=this._buffer.getInt32(),this._numberOfParts>0&&this._numberOfPoints>0)for(var e=this._buffer.getInt32Array(this.numberOfParts),i=0;i<this.numberOfParts;i+=1){var r=i==this.numberOfParts-1?this._numberOfPoints-e[i]:e[i+1]-e[i];this._parts[i]=this._buffer.getDoubleArray(2*r),s.normalizeLocations(this._parts[i])}this.isZType()&&this.readZ(!1),this.isMeasureType()&&this.readOptionalMeasures(!1)},s.prototype.readMultiPointContents=function(){var t=this.shapefile.readBoundingRectangle(this._buffer);this._boundingRectangle=t.coords,this._isNormalized=t.isNormalized,this._numberOfParts=1,this._numberOfPoints=this._buffer.getInt32(),this._parts=[this._buffer.getDoubleArray(2*this._numberOfPoints)],s.normalizeLocations(this._parts[0]),this.isZType()&&this.readZ(!1),this.isMeasureType()&&this.readOptionalMeasures(!1)},s.prototype.readZ=function(t){if(t){this._zValues=this._buffer.getDoubleArray(1);var e=this._zValues[0];this._zRange=[e,e]}else this._zRange=this._buffer.getDoubleArray(2),this._zValues=this._buffer.getDoubleArray(this.numberOfPoints)},s.prototype.readOptionalMeasures=function(t){if(this._buffer.hasRemaining()&&this._buffer.limit()-this._buffer.position>=8*this.numberOfPoints)if(t){this._mValues=this._buffer.getDoubleArray(1);var e=this._mValues[0];this._mRange=[e,e]}else this._mRange=this._buffer.getDoubleArray(2),this._mValues=this._buffer.getDoubleArray(this.numberOfPoints)},s.normalizeLocations=function(e){for(var i=0,r=e.length;i<r;i+=2){var n=e[i],o=e[i+1];e[i]=t.normalizedDegreesLongitude(n),e[i+1]=t.normalizedDegreesLatitude(o)}},s.prototype.isPointType=function(){return this.shapefile.isPointType()},s.prototype.isMultiPointType=function(){return this.shapefile.isMultiPointType()},s.prototype.isPolylineType=function(){return this.shapefile.isPolylineType()},s.prototype.isPolygonType=function(){return this.shapefile.isPolygonType()},s.prototype.isZType=function(){return this.shapefile.isZType()},s.prototype.isMeasureType=function(){return this.shapefile.isMeasureType()},s.prototype.setAttributes=function(t){this._attributes=t},s.RECORD_HEADER_LENGTH=8,s}),i("formats/shapefile/ShapefileRecordMultiPoint",["../../util/ByteBuffer","../../formats/shapefile/Shapefile","../../formats/shapefile/ShapefileRecord"],function(t,e,i){"use strict";var r=function(t,e){i.call(this,t,e)};return r.prototype=Object.create(i.prototype),r.prototype.readContents=function(){this.readMultiPointContents()},r}),i("formats/shapefile/ShapefileRecordNull",["../../formats/shapefile/Shapefile","../../formats/shapefile/ShapefileRecord"],function(t,e){"use strict";var i=function(t,i){e.call(this,t,i)};return i.prototype=Object.create(e.prototype),i.prototype.readContents=function(){this.readNullContents()},i}),i("formats/shapefile/ShapefileRecordPoint",["../../formats/shapefile/Shapefile","../../formats/shapefile/ShapefileRecord"],function(t,e){"use strict";var i=function(t,i){e.call(this,t,i)};return i.prototype=Object.create(e.prototype),i.prototype.readContents=function(){this.readPointContents()},i}),i("formats/shapefile/ShapefileRecordPolygon",["../../formats/shapefile/Shapefile","../../formats/shapefile/ShapefileRecord"],function(t,e){"use strict";var i=function(t,i){e.call(this,t,i)};return i.prototype=Object.create(e.prototype),i.prototype.readContents=function(){this.readPolylineContents()},i}),i("formats/shapefile/ShapefileRecordPolyline",["../../formats/shapefile/Shapefile","../../formats/shapefile/ShapefileRecord"],function(t,e){"use strict";var i=function(t,i){e.call(this,t,i)};return i.prototype=Object.create(e.prototype),i.prototype.readContents=function(){this.readPolylineContents()},i}),i("formats/shapefile/Shapefile",["../../geom/Angle","../../error/ArgumentError","../../util/ByteBuffer","../../util/Color","../../formats/shapefile/DBaseFile","../../geom/Location","../../util/Logger","../../error/NotYetImplementedError","../../shapes/Path","../../shapes/Placemark","../../shapes/PlacemarkAttributes","../../shapes/Polygon","../../geom/Position","../../formats/shapefile/PrjFile","../../layer/RenderableLayer","../../shapes/ShapeAttributes","../../formats/shapefile/ShapefileRecord","../../formats/shapefile/ShapefileRecordMultiPoint","../../formats/shapefile/ShapefileRecordNull","../../formats/shapefile/ShapefileRecordPoint","../../formats/shapefile/ShapefileRecordPolygon","../../formats/shapefile/ShapefileRecordPolyline","../../shapes/SurfacePolygon","../../shapes/SurfacePolyline"],function(t,e,i,r,n,o,s,a,l,h,u,c,d,p,f,g,m,E,y,_,v,S,b,T){"use strict";var L=function(t){if(!t)throw new e(s.logMessage(s.LEVEL_SEVERE,"Shapefile","constructor","missingUrl"));this._url=t,this._shapeType=null,this._layer=null,this._shapeConfigurationCallback=this.defaultShapeConfigurationCallback,this._parserCompletionCallback=this.defaultParserCompletionCallback,this._buffer=null,this.attributeFile=new n(t.replace(".shp",".dbf")),this.projectionFile=new p(t.replace(".shp",".prj")),this.defaultPlacemarkAttributes=new u(null),this.defaultShapeAttributes=new g(null)};return Object.defineProperties(L.prototype,{url:{get:function(){return this._url}},shapeType:{get:function(){return this._shapeType}},layer:{get:function(){return this._layer}},parserCompletionCallback:{get:function(){return this._parserCompletionCallback}},shapeConfigurationCallback:{get:function(){return this._shapeConfigurationCallback}}}),L.prototype.load=function(t,e,i){t&&(this._parserCompletionCallback=t),e&&(this._shapeConfigurationCallback=e),this._layer=i||new f;var r=function(){var t=function(){this.requestUrl(this.url)}.bind(this);this.attributeFile.load(t)}.bind(this);this.projectionFile.load(r)},L.prototype.defaultParserCompletionCallback=function(t){this.addRenderablesForShapefile(this.layer)},L.prototype.defaultShapeConfigurationCallback=function(t,e){var i={},r=t.values.name||t.values.Name||t.values.NAME;if(r&&(i.name=r),e.isPointType())i.attributes=this.defaultPlacemarkAttributes;else if(e.isMultiPointType())i.attributes=this.defaultPlacemarkAttributes;else if(e.isPolylineType())i.attributes=this.defaultShapeAttributes;else if(e.isPolygonType()){i.attributes=this.defaultShapeAttributes;var n=t.values.height||t.values.Height||t.values.HEIGHT;n&&(i.height=n)}return i},L.prototype.addRenderablesForShapefile=function(t){if(!t)throw new e(s.logMessage(s.LEVEL_SEVERE,"Shapefile","addRenderablesForShapefile","missingLayer"));this.isPointType()?this.addRenderablesForPoints(t):this.isMultiPointType()?this.addRenderablesForMultiPoints(t):this.isPolylineType()?this.addRenderablesForPolylines(t):this.isPolygonType()&&this.addRenderablesForPolygons(t)},L.prototype.addRenderablesForPoints=function(t){if(!t)throw new e(s.logMessage(s.LEVEL_SEVERE,"Shapefile","addRenderablesForPoints","missingLayer"));for(var i=this.next();i;i=this.next()){var r=this.shapeConfigurationCallback(i.attributes,i),n=r&&r.altitude?r.altitude:0;if(r)for(var o=0,a=i.numberOfParts;o<a;o+=1)for(var l=i.pointBuffer(o),u=0,c=l.length;u<c;u+=2){var p=l[u],f=l[u+1],g=new d(f,p,n),m=new h(g,!1,r.attributes);m.altitudeMode=r.altitudeMode||WorldWind.RELATIVE_TO_GROUND,r.highlightAttributes&&(m.highlightAttributes=r.highlightAttributes),r.name&&(m.label=r.name),r.pickDelegate&&(m.pickDelegate=r.pickDelegate),r.userProperties&&(m.userProperties=r.userProperties),t.addRenderable(m)}}},L.prototype.addRenderablesForMultiPoints=function(t){if(!t)throw new e(s.logMessage(s.LEVEL_SEVERE,"Shapefile","addRenderablesForMultiPoints","missingLayer"));for(var i=this.next();i;i=this.next()){var r=this.shapeConfigurationCallback(i.attributes,i),n=r&&r.altitude?r.altitude:0;if(r)for(var o=0,a=i.numberOfParts;o<a;o+=1)for(var l=i.pointBuffer(o),u=0,c=l.length;u<c;u+=2){var p=l[u],f=l[u+1],g=new d(f,p,n),m=new h(g,!1,r.attributes);m.altitudeMode=r.altitudeMode||WorldWind.RELATIVE_TO_GROUND,r.highlightAttributes&&(m.highlightAttributes=r.highlightAttributes),r.name&&(m.label=r.name),r.pickDelegate&&(m.pickDelegate=r.pickDelegate),r.userProperties&&(m.userProperties=r.userProperties),t.addRenderable(m)}}},L.prototype.addRenderablesForPolylines=function(t){if(!t)throw new e(s.logMessage(s.LEVEL_SEVERE,"Shapefile","addRenderablesForPolylines","missingLayer"));for(var i=this.next();i;i=this.next()){var r=this.shapeConfigurationCallback(i.attributes,i),n=r&&r.altitude?r.altitude:0;if(r)for(var a=0,h=i.numberOfParts;a<h;a+=1){for(var u=i.pointBuffer(a),c=[],p=0,f=u.length;p<f;p+=2){var g=u[p],m=u[p+1],E=n?new d(m,g,n):new o(m,g);c.push(E)}var y;n?(y=new l(c,r.attributes),y.altitudeMode=r.altitudeMode||WorldWind.RELATIVE_TO_GROUND):y=new T(c,r.attributes),r.highlightAttributes&&(y.highlightAttributes=r.highlightAttributes),r.name&&(y.displayName=r.name),r.pickDelegate&&(y.pickDelegate=r.pickDelegate),r.userProperties&&(y.userProperties=r.userProperties),t.addRenderable(y)}}},L.prototype.addRenderablesForPolygons=function(t){if(!t)throw new e(s.logMessage(s.LEVEL_SEVERE,"Shapefile","addRenderablesForPolygons","missingLayer"));for(var i=this.next();i;i=this.next()){for(var r,n=this.shapeConfigurationCallback(i.attributes,i),a=[],l=n.height,h=n.altitude,u=0,p=i.numberOfParts;u<p;u+=1){for(var f=i.pointBuffer(u),g=[],m=0,E=f.length-2;m<E;m+=2){var y=f[m],_=f[m+1];r=l?new d(_,y,l):h?new d(_,y,h):new o(_,y),g.push(r)}a.push(g)}var v;l?(v=new c(a,n.attributes),v.extrude=!0,v.altitudeMode=n.altitudeMode||WorldWind.RELATIVE_TO_GROUND):h?(v=new c(a,n.attributes),v.altitudeMode=n.altitudeMode||WorldWind.RELATIVE_TO_GROUND):v=new b(a,n.attributes),n.highlightAttributes&&(v.highlightAttributes=n.highlightAttributes),n.name&&(v.displayName=n.name),n.pickDelegate&&(v.pickDelegate=n.pickDelegate),n.userProperties&&(v.userProperties=n.userProperties),t.addRenderable(v)}},L.prototype.next=function(){for(;this._buffer.position<this._buffer.limit();){var t=this.readRecord(this._buffer);if(!(t instanceof y))return t}return null},L.prototype.requestUrl=function(t){var e=new XMLHttpRequest;e.open("GET",t,!0),e.responseType="arraybuffer",e.onreadystatechange=function(){4===e.readyState&&(200===e.status?(this._buffer=new i(e.response),this.parse()):s.log(s.LEVEL_WARNING,"Shapefile retrieval failed ("+e.statusText+"): "+t),this._parserCompletionCallback&&this._parserCompletionCallback(this))}.bind(this),e.onerror=function(){s.log(s.LEVEL_WARNING,"Shapefile retrieval failed: "+t),this._parserCompletionCallback&&this._parserCompletionCallback(this)},e.ontimeout=function(){s.log(s.LEVEL_WARNING,"Shapefile retrieval timed out: "+t),this._parserCompletionCallback&&this._parserCompletionCallback(this)},e.send(null)},L.prototype.parse=function(){try{var t=this.readHeader(this._buffer);this._shapeType=t.shapeType}catch(t){console.log(t)}},L.prototype.readHeader=function(t){if(t.order(i.BIG_ENDIAN),t.getInt32()!=L.FILE_CODE)throw new Error(s.log(s.LEVEL_SEVERE,"Shapefile header is invalid"));t.skipInt32s(5);var e=t.getInt32();t.order(i.LITTLE_ENDIAN);var r=t.getInt32(),n=t.getInt32(),o=this.readBoundingRectangle(t),a=this.getShapeType(n);if(null==a)throw new Error(s.log(s.LEVEL_SEVERE,"Shapefile type is unsupported: "+n.toString()));var l={fileLength:2*e,version:r,shapeType:a,boundingRectangle:o.coords,normalizePoints:o.isNormalized};return t.skipDoubles(4),l},L.prototype.readBoundingRectangle=function(t){return this.projectionFile?this.projectionFile.isGeographicCoordinateSystem()?this.readGeographicBoundingRectangle(t):this.projectionFile.isProjectedCoordinateSystem()?this.readProjectedBoundingRectangle(t):this.readUnspecifiedBoundingRectangle(t):this.readUnspecifiedBoundingRectangle(t)},L.prototype.readUnspecifiedBoundingRectangle=function(t){return{coords:this.readBoundingRectangleCoordinates(t),isNormalized:!1}},L.prototype.readGeographicBoundingRectangle=function(e){var i=this.readBoundingRectangleCoordinates(e),r=!1,n=0;return i[0]<-90&&(n=t.normalizedDegreesLatitude(i[0]),i[0]=90,r=!0,i[1]<n&&(i[1]=n)),i[1]>90&&(n=t.normalizedDegreesLatitude(i[1]),i[1]=90,r=!0,i[0]>n&&(i[0]=n)),(i[2]<-180||i[3]>180)&&(i[2]=-180,i[3]=180,r=!0),{coords:i,isNormalized:r}},L.prototype.readProjectedBoundingRectangle=function(t){throw new a(s.log(s.LEVEL_SEVERE,"Shapefile.readProjectedBoundingRectangle() not yet implemented"))},L.prototype.readBoundingRectangleCoordinates=function(t){
var e=t.getDouble(),i=t.getDouble(),r=t.getDouble();return[i,t.getDouble(),e,r]},L.prototype.readRecord=function(t){var e=this.createRecord(t);if(null!=e&&null!=this.attributeFile&&this.attributeFile.hasNext()){var i=this.attributeFile.nextRecord();e.setAttributes(i)}return e},L.prototype.createRecord=function(t){return this.isNullType()?this.createNull(t):this.isPointType()?this.createPoint(t):this.isMultiPointType()?this.createMultiPoint(t):this.isPolygonType()?this.createPolygon(t):this.isPolylineType()?this.createPolyline(t):null},L.prototype.createNull=function(t){return new y(this,t)},L.prototype.createPoint=function(t){return new _(this,t)},L.prototype.createMultiPoint=function(t){return new E(this,t)},L.prototype.createPolyline=function(t){return new S(this,t)},L.prototype.createPolygon=function(t){return new v(this,t)},L.prototype.getShapeType=function(t){switch(t){case 0:return L.NULL;case 1:return L.POINT;case 3:return L.POLYLINE;case 5:return L.POLYGON;case 8:return L.MULTI_POINT;case 11:return L.POINT_Z;case 13:return L.POLYLINE_Z;case 15:return L.POLYGON_Z;case 18:return L.MULTI_POINT_Z;case 21:return L.POINT_M;case 23:return L.POLYLINE_M;case 25:return L.POLYGON_M;case 28:return L.MULTI_POINT_M;default:return null}},L.prototype.isMeasureType=function(){return L.measureTypes.hasOwnProperty(this._shapeType)},L.prototype.isZType=function(){return L.zTypes.hasOwnProperty(this._shapeType)},L.prototype.isNullType=function(){return this._shapeType===L.NULL},L.prototype.isPointType=function(){return L.pointTypes.hasOwnProperty(this._shapeType)},L.prototype.isMultiPointType=function(){return L.multiPointTypes.hasOwnProperty(this._shapeType)},L.prototype.isPolylineType=function(){return L.polylineTypes.hasOwnProperty(this._shapeType)},L.prototype.isPolygonType=function(){return L.polygonTypes.hasOwnProperty(this._shapeType)},L.NULL="null",L.POINT="point",L.MULTI_POINT="multiPoint",L.POLYLINE="polyline",L.POLYGON="polygon",L.POINT_M=L.POINT+"M",L.MULTI_POINT_M=L.MULTI_POINT+"M",L.POLYLINE_M=L.POLYLINE+"M",L.POLYGON_M=L.POLYGON+"M",L.POINT_Z=L.POINT+"Z",L.MULTI_POINT_Z=L.MULTI_POINT+"Z",L.POLYLINE_Z=L.POLYLINE+"Z",L.POLYGON_Z=L.POLYGON+"Z",L.SHAPE_MULTI_PATCH="multiPatch",L.measureTypes={pointM:L.POINT_M,pointZ:L.POINT_Z,multiPointM:L.MULTI_POINT_M,multiPointZ:L.MULTI_POINT_Z,polylineM:L.POLYLINE_M,polylineZ:L.POLYLINE_Z,polygonM:L.POLYGON_M,polygonZ:L.POLYGON_Z},L.zTypes={pointZ:L.POINT_Z,multiPointZ:L.MULTI_POINT_Z,polylineZ:L.POLYLINE_Z,polygonZ:L.POLYGON_Z},L.pointTypes={point:L.POINT,pointZ:L.POINT_Z,pointM:L.POINT_M},L.multiPointTypes={multiPoint:L.MULTI_POINT,multiPointZ:L.MULTI_POINT_Z,multiPointM:L.MULTI_POINT_M},L.polylineTypes={polyline:L.POLYLINE,polylineZ:L.POLYLINE_Z,polylineM:L.POLYLINE_M},L.polygonTypes={polygon:L.POLYGON,polygonZ:L.POLYGON_Z,polygonM:L.POLYGON_M},L.FILE_CODE=9994,L}),i("layer/ShowTessellationLayer",["../shaders/BasicProgram","../layer/Layer"],function(t,e){"use strict";var i=function(){e.call(this,"Show Tessellation"),this.enableTerrainGeometry=!0,this.enableTerrainExtent=!1};return i.prototype=Object.create(e.prototype),i.prototype.doRender=function(t){try{this.beginRendering(t),this.enableTerrainGeometry&&this.drawTerrainGeometry(t),this.enableTerrainExtent&&this.drawTerrainExtent(t)}finally{this.endRendering(t)}},i.prototype.beginRendering=function(t){t.currentGlContext.depthMask(!1)},i.prototype.endRendering=function(t){t.currentGlContext.depthMask(!0)},i.prototype.drawTerrainGeometry=function(e){if(e.terrain&&e.terrain.tessellator){var i,r,n=e.currentGlContext,o=e.terrain,s=o.tessellator,a=o.surfaceGeometry;try{i=e.findAndBindProgram(t),s.beginRendering(e);for(var l=0,h=a.length;l<h;l++)r=a[l],s.beginRenderingTile(e,r),i.loadColorComponents(n,1,1,1,.3),s.renderWireframeTile(e,r),i.loadColorComponents(n,1,0,0,.6),s.renderTileOutline(e,r),s.endRenderingTile(e,r)}finally{s.endRendering(e)}}},i.prototype.drawTerrainExtent=function(t){for(var e,i=t.terrain.surfaceGeometry,r=0,n=i.length;r<n;r++)e=i[r],e.extent.render(t)},i}),i("shaders/StarFieldProgram",["../error/ArgumentError","../shaders/GpuProgram","../util/Logger"],function(t,e,i){"use strict";var r=function(t){e.call(this,t,"attribute vec4 vertexPoint;\nuniform mat4 mvpMatrix;\nuniform float numDays;\nuniform vec2 magnitudeRange;\nvarying float magnitudeWeight;\nfloat normalizeAngle(float angle) {\n   float angleDivisions = angle / 360.0;\n   return 360.0 * (angleDivisions - floor(angleDivisions));\n}\nvec3 computePosition(float dec, float ra) {\n   float GMST = normalizeAngle(280.46061837 + 360.98564736629 * numDays);\n   float GHA = normalizeAngle(GMST - ra);\n   float lon = -GHA + 360.0 * step(180.0, GHA);\n   float latRad = radians(dec);\n   float lonRad = radians(lon);\n   float radCosLat = cos(latRad);\n   return vec3(radCosLat * sin(lonRad), sin(latRad), radCosLat * cos(lonRad));\n}\nfloat normalizeScalar(float value, float minValue, float maxValue){\n   return (value - minValue) / (maxValue - minValue);\n}\nvoid main() {\n   vec3 vertexPosition = computePosition(vertexPoint.x, vertexPoint.y);\n   gl_Position = mvpMatrix * vec4(vertexPosition.xyz, 1.0);\n   gl_Position.z = gl_Position.w - 0.00001;\n   gl_PointSize = vertexPoint.z;\n   magnitudeWeight = normalizeScalar(vertexPoint.w, magnitudeRange.x, magnitudeRange.y);\n}","precision mediump float;\nuniform sampler2D textureSampler;\nuniform int textureEnabled;\nvarying float magnitudeWeight;\nconst vec4 white = vec4(1.0, 1.0, 1.0, 1.0);\nconst vec4 grey = vec4(0.5, 0.5, 0.5, 1.0);\nvoid main() {\n   if (textureEnabled == 1) {\n       gl_FragColor = texture2D(textureSampler, gl_PointCoord);\n   }\n   else {\n       gl_FragColor = mix(white, grey, magnitudeWeight);\n   }\n}",["vertexPoint"]),this.vertexPointLocation=this.attributeLocation(t,"vertexPoint"),this.mvpMatrixLocation=this.uniformLocation(t,"mvpMatrix"),this.numDaysLocation=this.uniformLocation(t,"numDays"),this.magnitudeRangeLocation=this.uniformLocation(t,"magnitudeRange"),this.textureUnitLocation=this.uniformLocation(t,"textureSampler"),this.textureEnabledLocation=this.uniformLocation(t,"textureEnabled")};return r.key="WorldWindGpuStarFieldProgram",r.prototype=Object.create(e.prototype),r.prototype.loadModelviewProjection=function(e,r){if(!r)throw new t(i.logMessage(i.LEVEL_SEVERE,"StarFieldProgram","loadModelviewProjection","missingMatrix"));this.loadUniformMatrix(e,r,this.mvpMatrixLocation)},r.prototype.loadNumDays=function(e,r){if(null==r)throw new t(i.logMessage(i.LEVEL_SEVERE,"StarFieldProgram","loadNumDays","missingNumDays"));e.uniform1f(this.numDaysLocation,r)},r.prototype.loadMagnitudeRange=function(e,r,n){if(null==r)throw new t(i.logMessage(i.LEVEL_SEVERE,"StarFieldProgram","loadMagRange","missingMinMag"));if(null==n)throw new t(i.logMessage(i.LEVEL_SEVERE,"StarFieldProgram","loadMagRange","missingMaxMag"));e.uniform2f(this.magnitudeRangeLocation,r,n)},r.prototype.loadTextureUnit=function(t,e){t.uniform1i(this.textureUnitLocation,e-t.TEXTURE0)},r.prototype.loadTextureEnabled=function(t,e){t.uniform1i(this.textureEnabledLocation,e?1:0)},r}),i("layer/StarFieldLayer",["./Layer","../util/Logger","../geom/Matrix","../shaders/StarFieldProgram","../util/SunPosition"],function(t,e,i,r,n){"use strict";var o=function(e){t.call(this,"StarField"),this.pickEnabled=!1,this.sunSize=128,this.showSun=!0,this._starDataSource=e||WorldWind.configuration.baseUrl+"images/stars.json",this._sunImageSource=WorldWind.configuration.baseUrl+"images/sunTexture.png",this._matrix=i.fromIdentity(),this._starsPositionsVboCacheKey=null,this._numStars=0,this._starData=null,this._minMagnitude=Number.MAX_VALUE,this._maxMagnitude=Number.MIN_VALUE,this._loadStarted=!1,this._minScale=1e7,this._sunPositionsCacheKey="",this._sunBufferView=new Float32Array(4),this._MAX_GL_POINT_SIZE=0};return o.prototype=Object.create(t.prototype),Object.defineProperties(o.prototype,{starDataSource:{get:function(){return this._starDataSource},set:function(t){this._starDataSource=t,this.invalidateStarData()}},sunImageSource:{get:function(){return this._sunImageSource},set:function(t){this._sunImageSource=t}}}),o.prototype.doRender=function(t){if(!t.globe.is2D()){if(!this.haveResources(t))return void this.loadResources(t);this.beginRendering(t);try{this.doDraw(t)}finally{this.endRendering(t)}}},o.prototype.haveResources=function(t){var e=t.gpuResourceCache.resourceForKey(this._sunImageSource);return null!=this._starData&&null!=e},o.prototype.loadResources=function(t){var e=t.currentGlContext,i=t.gpuResourceCache;this._starData||this.fetchStarData(),i.resourceForKey(this._sunImageSource)||i.retrieveTexture(e,this._sunImageSource)},o.prototype.beginRendering=function(t){var e=t.currentGlContext;t.findAndBindProgram(r),e.enableVertexAttribArray(0),e.depthMask(!1)},o.prototype.doDraw=function(t){this.loadCommonUniforms(t),this.renderStars(t),this.showSun&&this.renderSun(t)},o.prototype.loadCommonUniforms=function(t){var e=t.currentGlContext,i=t.currentProgram,r=t.navigatorState.eyePoint,o=t.globe.computePositionFromPoint(r[0],r[1],r[2],{}),s=Math.max(1.5*o.altitude,this._minScale);this._matrix.copy(t.navigatorState.modelviewProjection),this._matrix.multiplyByScale(s,s,s),i.loadModelviewProjection(e,this._matrix);var a=n.computeJulianDate(this.time||new Date);i.loadNumDays(e,a-2451545)},o.prototype.renderStars=function(t){var e=t.currentGlContext,i=t.gpuResourceCache,r=t.currentProgram;this._starsPositionsVboCacheKey||(this._starsPositionsVboCacheKey=i.generateCacheKey());var n=i.resourceForKey(this._starsPositionsVboCacheKey);if(n)e.bindBuffer(e.ARRAY_BUFFER,n);else{n=e.createBuffer();var o=this.createStarsGeometry();i.putResource(this._starsPositionsVboCacheKey,n,4*o.length),e.bindBuffer(e.ARRAY_BUFFER,n),e.bufferData(e.ARRAY_BUFFER,new Float32Array(o),e.STATIC_DRAW)}t.frameStatistics.incrementVboLoadCount(1),e.vertexAttribPointer(0,4,e.FLOAT,!1,0,0),r.loadMagnitudeRange(e,this._minMagnitude,this._maxMagnitude),r.loadTextureEnabled(e,!1),e.drawArrays(e.POINTS,0,this._numStars)},o.prototype.renderSun=function(t){var i=t.currentGlContext,r=t.currentProgram,o=t.gpuResourceCache;this._MAX_GL_POINT_SIZE||(this._MAX_GL_POINT_SIZE=i.getParameter(i.ALIASED_POINT_SIZE_RANGE)[1]),this.sunSize>this._MAX_GL_POINT_SIZE&&e.log(e.LEVEL_WARNING,"StarFieldLayer - sunSize is to big, max size allowed is: "+this._MAX_GL_POINT_SIZE);var s=n.getAsCelestialLocation(this.time||new Date);this._sunBufferView[0]=s.declination,this._sunBufferView[1]=s.rightAscension,this._sunBufferView[2]=Math.min(this.sunSize,this._MAX_GL_POINT_SIZE),this._sunBufferView[3]=1,this._sunPositionsCacheKey||(this._sunPositionsCacheKey=o.generateCacheKey());var a=o.resourceForKey(this._sunPositionsCacheKey);a?(i.bindBuffer(i.ARRAY_BUFFER,a),i.bufferSubData(i.ARRAY_BUFFER,0,this._sunBufferView)):(a=i.createBuffer(),o.putResource(this._sunPositionsCacheKey,a,4*this._sunBufferView.length),i.bindBuffer(i.ARRAY_BUFFER,a),i.bufferData(i.ARRAY_BUFFER,this._sunBufferView,i.DYNAMIC_DRAW)),t.frameStatistics.incrementVboLoadCount(1),i.vertexAttribPointer(0,4,i.FLOAT,!1,0,0),r.loadTextureEnabled(i,!0),t.gpuResourceCache.resourceForKey(this._sunImageSource).bind(t),i.drawArrays(i.POINTS,0,1)},o.prototype.endRendering=function(t){var e=t.currentGlContext;e.depthMask(!0),e.disableVertexAttribArray(0)},o.prototype.fetchStarData=function(){if(!this._loadStarted){this._loadStarted=!0;var t=this,i=new XMLHttpRequest;i.onload=function(){if(this.status>=200&&this.status<300)try{t._starData=JSON.parse(this.response),t.sendRedrawRequest()}catch(t){e.log(e.LEVEL_SEVERE,"StarFieldLayer unable to parse JSON for star data "+t.toString())}else e.log(e.LEVEL_SEVERE,"StarFieldLayer unable to fetch star data. Status: "+this.status+" "+this.statusText);t._loadStarted=!1},i.onerror=function(){e.log(e.LEVEL_SEVERE,"StarFieldLayer unable to fetch star data"),t._loadStarted=!1},i.ontimeout=function(){e.log(e.LEVEL_SEVERE,"StarFieldLayer fetch star data has timeout"),t._loadStarted=!1},i.open("GET",this._starDataSource,!0),i.send()}},o.prototype.createStarsGeometry=function(){var t=this.parseStarsMetadata(this._starData.metadata);if(-1===t.raIndex)throw new Error(e.logMessage(e.LEVEL_SEVERE,"StarFieldLayer","createStarsGeometry","Missing ra field in star data."));if(-1===t.decIndex)throw new Error(e.logMessage(e.LEVEL_SEVERE,"StarFieldLayer","createStarsGeometry","Missing dec field in star data."));if(-1===t.magIndex)throw new Error(e.logMessage(e.LEVEL_SEVERE,"StarFieldLayer","createStarsGeometry","Missing vmag field in star data."));var i=this._starData.data,r=[];this._minMagnitude=Number.MAX_VALUE,this._maxMagnitude=Number.MIN_VALUE;for(var n=0,o=i.length;n<o;n++){var s=i[n],a=s[t.decIndex],l=s[t.raIndex],h=s[t.magIndex],u=h<2?2:1;r.push(a,l,u,h),this._minMagnitude=Math.min(this._minMagnitude,h),this._maxMagnitude=Math.max(this._maxMagnitude,h)}return this._numStars=Math.floor(r.length/4),r},o.prototype.parseStarsMetadata=function(t){for(var e=-1,i=-1,r=-1,n=0,o=t.length;n<o;n++){var s=t[n];"ra"===s.name&&(e=n),"dec"===s.name&&(i=n),"vmag"===s.name&&(r=n)}return{raIndex:e,decIndex:i,magIndex:r}},o.prototype.invalidateStarData=function(){this._starData=null,this._starsPositionsVboCacheKey=null},o.prototype.sendRedrawRequest=function(){var t=document.createEvent("Event");t.initEvent(WorldWind.REDRAW_EVENT_TYPE,!0,!0),window.dispatchEvent(t)},o}),i("shapes/SurfaceCircle",["../error/ArgumentError","../geom/Location","../util/Logger","../shapes/ShapeAttributes","../shapes/SurfaceShape"],function(t,e,i,r,n){"use strict";var o=function(e,r,s){if(!e)throw new t(i.logMessage(i.LEVEL_SEVERE,"SurfaceCircle","constructor","missingLocation"));if(r<0)throw new t(i.logMessage(i.LEVEL_SEVERE,"SurfaceCircle","constructor","Radius is negative"));n.call(this,s),this._center=e,this._radius=r,this._intervals=o.DEFAULT_NUM_INTERVALS};return o.prototype=Object.create(n.prototype),Object.defineProperties(o.prototype,{center:{get:function(){return this._center},set:function(t){this.stateKeyInvalid=!0,this.resetBoundaries(),this._center=t}},radius:{get:function(){return this._radius},set:function(t){this.stateKeyInvalid=!0,this.resetBoundaries(),this._radius=t}},intervals:{get:function(){return this._intervals},set:function(t){this.stateKeyInvalid=!0,this.resetBoundaries(),this._intervals=t}}}),o.staticStateKey=function(t){return n.staticStateKey(t)+" ce "+t.center.toString()+" ra "+t.radius.toString()},o.prototype.computeStateKey=function(){return o.staticStateKey(this)},o.prototype.computeBoundaries=function(t){if(0===this.radius)return null;var i=1+Math.max(o.MIN_NUM_INTERVALS,this.intervals),r=360/(i-1),n=this.radius/t.globe.radiusAt(this.center.latitude,this.center.longitude);this._boundaries=new Array(i);for(var s=0;s<i;s++){var a=s!==i-1?s*r:0;this._boundaries[s]=e.greatCircleLocation(this.center,a,n,new e(0,0))}},o.MIN_NUM_INTERVALS=8,o.DEFAULT_NUM_INTERVALS=64,o}),i("shapes/SurfaceEllipse",["../geom/Angle","../error/ArgumentError","../geom/Location","../util/Logger","../shapes/ShapeAttributes","../shapes/SurfaceShape","../util/WWMath"],function(t,e,i,r,n,o,s){"use strict";var a=function(t,i,n,s,l){if(!t)throw new e(r.logMessage(r.LEVEL_SEVERE,"SurfaceEllipse","constructor","missingLocation"));if(i<0||n<0)throw new e(r.logMessage(r.LEVEL_SEVERE,"SurfaceEllipse","constructor","Radius is negative."));o.call(this,l),this._center=t,this._majorRadius=i,this._minorRadius=n,this._heading=s,this._intervals=a.DEFAULT_NUM_INTERVALS};return a.prototype=Object.create(o.prototype),Object.defineProperties(a.prototype,{center:{get:function(){return this._center},set:function(t){this.stateKeyInvalid=!0,this.resetBoundaries(),this._center=t}},majorRadius:{get:function(){return this._majorRadius},set:function(t){this.stateKeyInvalid=!0,this.resetBoundaries(),this._majorRadius=t}},minorRadius:{get:function(){return this._minorRadius},set:function(t){this.stateKeyInvalid=!0,this.resetBoundaries(),this._minorRadius=t}},heading:{get:function(){return this._heading},set:function(t){this.stateKeyInvalid=!0,this.resetBoundaries(),this._heading=t}},intervals:{get:function(){return this._intervals},set:function(t){this.stateKeyInvalid=!0,this.resetBoundaries(),this._intervals=t}}}),a.staticStateKey=function(t){return o.staticStateKey(t)+" ce "+t.center.toString()+" ma "+t.majorRadius.toString()+" mi "+t.minorRadius.toString()+" he "+t.heading.toString()+" in "+t.intervals.toString()},a.prototype.computeStateKey=function(){return a.staticStateKey(this)},a.prototype.computeBoundaries=function(e){if(0==this.majorRadius&&0==this.minorRadius)return null;var r=e.globe,n=1+Math.max(a.MIN_NUM_INTERVALS,this.intervals),o=2*Math.PI/(n-1),l=r.radiusAt(this.center.latitude,this.center.longitude);this._boundaries=new Array(n);for(var h=0;h<n;h++){var u=h!=n-1?h*o:0,c=this.majorRadius*Math.cos(u),d=this.minorRadius*Math.sin(u),p=Math.sqrt(c*c+d*d),f=Math.PI/2-(Math.acos(c/p)*s.signum(d)-this.heading*t.DEGREES_TO_RADIANS);this._boundaries[h]=i.greatCircleLocation(this.center,f*t.RADIANS_TO_DEGREES,p/l,new i(0,0))}},a.MIN_NUM_INTERVALS=8,a.DEFAULT_NUM_INTERVALS=64,a}),i("shapes/SurfaceRectangle",["../geom/Angle","../error/ArgumentError","../geom/Location","../util/Logger","../shapes/ShapeAttributes","../shapes/SurfaceShape","../util/WWMath"],function(t,e,i,r,n,o,s){"use strict";var a=function(t,i,n,s,a){if(!t)throw new e(r.logMessage(r.LEVEL_SEVERE,"SurfaceRectangle","constructor","missingLocation"));if(i<0||n<0)throw new e(r.logMessage(r.LEVEL_SEVERE,"SurfaceRectangle","constructor","Size is negative."));o.call(this,a),this._center=t,this._width=i,this._height=n,this._heading=s};return a.prototype=Object.create(o.prototype),Object.defineProperties(a.prototype,{center:{get:function(){return this._center},set:function(t){this.stateKeyInvalid=!0,this.resetBoundaries(),this._center=t}},width:{get:function(){return this._width},set:function(t){this.stateKeyInvalid=!0,this.resetBoundaries(),this._width=t}},height:{get:function(){return this._height},set:function(t){this.stateKeyInvalid=!0,this.resetBoundaries(),this._height=t}},heading:{get:function(){return this._heading},set:function(t){this.stateKeyInvalid=!0,this.resetBoundaries(),this._heading=t}}}),a.staticStateKey=function(t){return o.staticStateKey(t)+" ce "+t.center.toString()+" wi "+t.width.toString()+" he "+t.height.toString()+" hd "+t.heading.toString()},a.prototype.computeStateKey=function(){return a.staticStateKey(this)},a.prototype.computeBoundaries=function(t){var e=.5*this.width,i=.5*this.height,r=t.globe.radiusAt(this.center.latitude,this.center.longitude);this._boundaries=new Array(4),this.addLocation(0,-e,-i,r),this.addLocation(1,e,-i,r),this.addLocation(2,e,i,r),this.addLocation(3,-e,i,r)},a.prototype.addLocation=function(e,r,n,o){var a=Math.sqrt(r*r+n*n),l=Math.PI/2-(Math.acos(r/a)*s.signum(n)-this.heading*t.DEGREES_TO_RADIANS);this._boundaries[e]=i.greatCircleLocation(this.center,l*t.RADIANS_TO_DEGREES,a/o,new i(0,0))},a}),i("render/SurfaceRenderable",["../util/Logger","../error/UnsupportedOperationError"],function(t,e){"use strict";var i=function(){throw this.displayName="Renderable",this.enabled=!0,new e(t.logMessage(t.LEVEL_SEVERE,"SurfaceRenderable","constructor","abstractInvocation"))};return i.prototype.renderSurface=function(i){throw new e(t.logMessage(t.LEVEL_SEVERE,"SurfaceRenderable","renderSurface","abstractInvocation"))},i}),i("shapes/SurfaceSector",["../error/ArgumentError","../geom/Location","../util/Logger","../shapes/ShapeAttributes","../shapes/SurfaceShape"],function(t,e,i,r,n){"use strict";var o=function(e,r){if(!e)throw new t(i.logMessage(i.LEVEL_SEVERE,"SurfaceSector","constructor","missingSector"));n.call(this,r),this._sector=e};return o.prototype=Object.create(n.prototype),Object.defineProperties(o.prototype,{sector:{get:function(){return this._sector},set:function(t){this.stateKeyInvalid=!0,this.resetBoundaries(),this._sector=t}}}),o.staticStateKey=function(t){return n.staticStateKey(t)},o.prototype.computeStateKey=function(){return o.staticStateKey(this)},o.prototype.computeBoundaries=function(t){var i=this._sector;this._boundaries=new Array(4),this._boundaries[0]=new e(i.minLatitude,i.minLongitude),this._boundaries[1]=new e(i.maxLatitude,i.minLongitude),this._boundaries[2]=new e(i.maxLatitude,i.maxLongitude),this._boundaries[3]=new e(i.minLatitude,i.maxLongitude)},o}),i("gesture/TapRecognizer",["../gesture/GestureRecognizer"],function(t){"use strict";var e=function(e,i){t.call(this,e,i),this.numberOfTaps=1,this.numberOfTouches=1,this.maxTouchMovement=20,this.maxTapDuration=500,this.maxTapInterval=400,this.taps=[],this.timeout=null};return e.prototype=Object.create(t.prototype),e.prototype.reset=function(){t.prototype.reset.call(this),this.taps=[],this.cancelFailAfterDelay()},e.prototype.mouseDown=function(t){this.state==WorldWind.POSSIBLE&&(this.state=WorldWind.FAILED)},e.prototype.touchStart=function(t){if(this.state==WorldWind.POSSIBLE){var e;this.touchCount>this.numberOfTouches?this.state=WorldWind.FAILED:1==this.touchCount?(e={touchCount:this.touchCount,clientX:this.clientX,clientY:this.clientY},this.taps.push(e),this.failAfterDelay(this.maxTapDuration)):(e=this.taps[this.taps.length-1],e.touchCount=this.touchCount,e.clientX=this.clientX,e.clientY=this.clientY)}},e.prototype.touchMove=function(t){if(this.state==WorldWind.POSSIBLE){var e=this.translationX,i=this.translationY;Math.sqrt(e*e+i*i)>this.maxTouchMovement&&(this.state=WorldWind.FAILED)}},e.prototype.touchEnd=function(t){if(this.state==WorldWind.POSSIBLE&&0==this.touchCount){var e=this.taps.length;this.taps[e-1].touchCount!=this.numberOfTouches?this.state=WorldWind.FAILED:e==this.numberOfTaps?(this.clientX=this.taps[0].clientX,this.clientY=this.taps[0].clientY,this.state=WorldWind.RECOGNIZED):this.failAfterDelay(this.maxTapInterval)}},e.prototype.touchCancel=function(t){this.state==WorldWind.POSSIBLE&&(this.state=WorldWind.FAILED)},e.prototype.failAfterDelay=function(t){var e=this;e.timeout&&window.clearTimeout(e.timeout),e.timeout=window.setTimeout(function(){e.timeout=null,e.state==WorldWind.POSSIBLE&&(e.state=WorldWind.FAILED)},t)},e.prototype.cancelFailAfterDelay=function(){var t=this;t.timeout&&(window.clearTimeout(t.timeout),t.timeout=null)},e}),i("layer/TectonicPlatesLayer",["../error/ArgumentError","../util/Color","../geom/Location","../util/Logger","../layer/RenderableLayer","../shapes/ShapeAttributes","../shapes/SurfacePolygon"],function(t,e,i,r,n,o,s){"use strict";var a=function(t){n.call(this,"Tectonic Plates"),t?this._attributes=t:(this._attributes=new o(null),this._attributes.drawInterior=!1,this._attributes.drawOutline=!0,this._attributes.outlineColor=e.RED),this.loadPlateData()};return a.prototype=Object.create(n.prototype),Object.defineProperties(a.prototype,{attributes:{get:function(){return this._attributes},set:function(t){t&&this.renderables.map(function(e,i,r){e.attributes=t})}}}),a.prototype.loadPlateData=function(){var t=WorldWind.configuration.baseUrl+"images/TectonicPlates.json",e=new XMLHttpRequest;e.open("GET",t,!0),e.onreadystatechange=function(){4===e.readyState&&(200===e.status?this.parse(e.responseText):r.log(r.LEVEL_WARNING,"Tectonic plate data retrieval failed ("+e.statusText+"): "+t))}.bind(this),e.onerror=function(){r.log(r.LEVEL_WARNING,"Tectonic plate data retrieval failed: "+t)},e.ontimeout=function(){r.log(r.LEVEL_WARNING,"Tectonic plate data retrieval timed out: "+t)},e.send(null)},a.prototype.parse=function(t){var e=JSON.parse(t),r=this;e.features.map(function(t,e,n){var o=[];t.geometry.coordinates.map(function(t,e,r){o.push(new i(t[1],t[0]))});var a=new s(o,r._attributes);r.addRenderable(a)})},a}),i("util/TileFactory",["../util/Logger","../error/UnsupportedOperationError"],function(t,e){"use strict";var i=function(){};return i.prototype.createTile=function(i,r,n,o){throw new e(t.logMessage(t.LEVEL_SEVERE,"TileFactory","createTile","abstractInvocation"))},i}),i("shapes/TriangleMesh",["../shapes/AbstractMesh","../error/ArgumentError","../shaders/BasicTextureProgram","../geom/BoundingBox","../util/Color","../util/ImageSource","../geom/Location","../util/Logger","../geom/Matrix","../pick/PickedObject","../geom/Position","../shapes/ShapeAttributes","../shapes/SurfacePolygon","../geom/Vec2","../geom/Vec3"],function(t,e,i,r,n,o,s,a,l,h,u,c,d,p,f){"use strict";var g=function(i,r,n){if(!i)throw new e(a.logMessage(a.LEVEL_SEVERE,"TriangleMesh","constructor","missingPositions"));if(i.length<1)throw new e(a.logMessage(a.LEVEL_SEVERE,"TriangleMesh","constructor","missingPositions"));if(i.length>65536)throw new e(a.logMessage(a.LEVEL_SEVERE,"TriangleMesh","constructor","Too many positions. Must be fewer than 65537. Use TriangleMesh.split to split the shape."));if(!r)throw new e(a.logMessage(a.LEVEL_SEVERE,"TriangleMesh","constructor","Indices array is null or undefined"));if(r.length<3)throw new e(a.logMessage(a.LEVEL_SEVERE,"TriangleMesh","constructor","Too few indices."));t.call(this,n),this._positions=i,this._indices=r,this.referencePosition=this._positions[0]};return g.prototype=Object.create(t.prototype),Object.defineProperties(g.prototype,{positions:{get:function(){return this._positions},set:function(t){if(!t)throw new e(a.logMessage(a.LEVEL_SEVERE,"TriangleMesh","positions","missingPositions"));this._positions=t,this.referencePosition=this._positions[0],this.reset()}},indices:{get:function(){return this._indices},set:function(t){if(!t)throw new e(a.logMessage(a.LEVEL_SEVERE,"TriangleMesh","indices","Indices array is null or undefined"));this._indices=t,this.meshIndices=null,this.reset()}},outlineIndices:{get:function(){return this._outlineIndices},set:function(t){this._outlineIndices=t,this.meshOutlineIndices=null,this.reset()}},textureCoordinates:{get:function(){return this._textureCoordinates},set:function(t){if(t&&t.length!=this._positions.length)throw new e(a.logMessage(a.LEVEL_SEVERE,"TriangleMesh","textureCoordinates","Number of texture coordinates is inconsistent with the currently specified positions."));this._textureCoordinates=t,this.reset(),this.texCoords=null}}}),g.prototype.createSurfaceShape=function(){if(this._outlineIndices){for(var t=[],e=0;e<this._outlineIndices.length;e++)t.push(this._positions[this._outlineIndices[e]]);return new d(t,null)}return null},g.prototype.computeMeshPoints=function(t,e){for(var i,r,n=Number.MAX_VALUE,o=t.navigatorState.eyePoint,s=new Float32Array(3*this._positions.length),a=new f(0,0,0),l=0,h=0;h<this._positions.length;h++)i=this._positions[h],t.surfacePointForMode(i.latitude,i.longitude,i.altitude*this._altitudeScale,this.altitudeMode,a),r=a.distanceToSquared(o),r<n&&(n=r),a.subtract(this.currentData.referencePoint),s[l++]=a[0],s[l++]=a[1],s[l++]=a[2];return e.eyeDistance=Math.sqrt(n),s},g.prototype.computeTexCoords=function(){if(this._textureCoordinates){for(var t=new Float32Array(2*this._textureCoordinates.length),e=0,i=0,r=this._textureCoordinates.length;i<r;i++){var n=this._textureCoordinates[i];t[e++]=n[0],t[e++]=n[1]}return t}return null},g.prototype.computeMeshIndices=function(){for(var t=new Uint16Array(this._indices.length),e=0,i=this._indices.length;e<i;e++)t[e]=this._indices[e];return t},g.prototype.computeOutlineIndices=function(){if(this._outlineIndices){for(var t=new Uint16Array(this._outlineIndices.length),e=0;e<this._outlineIndices.length;e++)t[e]=this._outlineIndices[e];return t}return null},g.split=function(t,e,i,r){for(var n,o,s=[],a=[],l=[],h=[],u=[],c=0;c<=e.length;c++){if(c===e.length||s.length>65533&&l.length%3==0){if(s.length>0){var d={positions:s,indices:l};if(i&&(d.textureCoords=a),r){for(var p=[],f=0;f<r.length;f++)n=r[f],(o=h[n])&&p.push(h[r[f]]);d.outlineIndices=p}u.push(d)}if(c===e.length)break;s=[],l=[],h=[]}n=e[c],o=h[n],o||(o=s.length,h[n]=o,s.push(t[n]),i&&a.push(i[n])),l.push(o)}return u},g}),i("layer/ViewControlsLayer",["../geom/Angle","../error/ArgumentError","../layer/Layer","../geom/Location","../util/Logger","../util/Offset","../shapes/ScreenImage","../geom/Vec2","../util/WWUtil"],function(t,e,i,r,n,o,s,a,l){"use strict";var h=function(t){if(!t)throw new e(n.logMessage(n.LEVEL_SEVERE,"ViewControlsLayer","constructor","missingWorldWindow"));i.call(this,"View Controls"),this.wwd=t,this.placement=new o(WorldWind.OFFSET_FRACTION,0,WorldWind.OFFSET_FRACTION,0),this.alignment=new o(WorldWind.OFFSET_FRACTION,0,WorldWind.OFFSET_FRACTION,0),this.exaggerationIncrement=.01,this.zoomIncrement=.04,this.headingIncrement=1,this.tiltIncrement=1,this.fieldOfViewIncrement=.1,this.panIncrement=.001,this._inactiveOpacity=.5,this._activeOpacity=1;var r=new o(WorldWind.OFFSET_PIXELS,0,WorldWind.OFFSET_PIXELS,0),l=WorldWind.configuration.baseUrl+"images/view/";this.panControl=new s(r.clone(),l+"view-pan-64x64.png"),this.zoomInControl=new s(r.clone(),l+"view-zoom-in-32x32.png"),this.zoomOutControl=new s(r.clone(),l+"view-zoom-out-32x32.png"),this.headingLeftControl=new s(r.clone(),l+"view-heading-left-32x32.png"),this.headingRightControl=new s(r.clone(),l+"view-heading-right-32x32.png"),this.tiltUpControl=new s(r.clone(),l+"view-pitch-up-32x32.png"),this.tiltDownControl=new s(r.clone(),l+"view-pitch-down-32x32.png"),this.exaggerationUpControl=new s(r.clone(),l+"view-elevation-up-32x32.png"),this.exaggerationDownControl=new s(r.clone(),l+"view-elevation-down-32x32.png"),this.fovNarrowControl=new s(r.clone(),l+"view-fov-narrow-32x32.png"),this.fovWideControl=new s(r.clone(),l+"view-fov-wide-32x32.png"),this.fovNarrowControl.enabled=!1,this.fovWideControl.enabled=!1,this.controls=[this.panControl,this.zoomInControl,this.zoomOutControl,this.headingLeftControl,this.headingRightControl,this.tiltUpControl,this.tiltDownControl,this.exaggerationUpControl,this.exaggerationDownControl,this.fovNarrowControl,this.fovWideControl];for(var h=0;h<this.controls.length;h++)this.controls[h].imageOffset=r.clone(),this.controls[h].opacity=this._inactiveOpacity,this.controls[h]===this.panControl?this.controls[h].size=64:this.controls[h].size=32;this.panControlCenter=new a(0,0),this.isTouchDevice=!1,this.pickEnabled=!1,this.setupInteraction()};return h.prototype=Object.create(i.prototype),Object.defineProperties(h.prototype,{showPanControl:{get:function(){return this.panControl.enabled},set:function(t){this.panControl.enabled=t}},showZoomControl:{get:function(){return this.zoomInControl.enabled},set:function(t){this.zoomInControl.enabled=t,this.zoomOutControl.enabled=t}},showHeadingControl:{get:function(){return this.headingLeftControl.enabled},set:function(t){this.headingLeftControl.enabled=t,this.headingRightControl.enabled=t}},showTiltControl:{get:function(){return this.tiltUpControl.enabled},set:function(t){this.tiltUpControl.enabled=t,this.tiltDownControl.enabled=t}},showExaggerationControl:{get:function(){return this.exaggerationUpControl.enabled},set:function(t){this.exaggerationUpControl.enabled=t,this.exaggerationDownControl.enabled=t}},showFieldOfViewControl:{get:function(){return this.fovNarrowControl.enabled},set:function(t){this.fovNarrowControl.enabled=t,this.fovWideControl.enabled=t}},inactiveOpacity:{get:function(){return this._inactiveOpacity},set:function(t){this._inactiveOpacity=t;for(var e=0;e<this.controls.length;e++)this.controls[e].opacity=t}},activeOpacity:{get:function(){return this._activeOpacity},set:function(t){this._activeOpacity=t;for(var e=0;e<this.controls.length;e++)this.controls[e].opacity=t}}}),h.prototype.doRender=function(t){var e,i,r,n,o=0;this.inCurrentFrame=!1,this.showPanControl&&(o+=this.panControl.size,this.inCurrentFrame=!0),this.showZoomControl&&(o+=this.zoomInControl.size,this.inCurrentFrame=!0),this.showHeadingControl&&(o+=this.headingLeftControl.size,this.inCurrentFrame=!0),this.showTiltControl&&(o+=this.tiltDownControl.size,this.inCurrentFrame=!0),this.showExaggerationControl&&(o+=this.exaggerationDownControl.size,this.inCurrentFrame=!0),this.showFieldOfViewControl&&(o+=this.fovNarrowControl.size,this.inCurrentFrame=!0),
i=this.placement.offsetForSize(t.navigatorState.viewport.width,t.navigatorState.viewport.height),e=this.alignment.offsetForSize(o,64),r=i[0]-e[0],n=i[1]-e[1],this.showPanControl&&(this.panControl.screenOffset.x=r,this.panControl.screenOffset.y=n,this.panControl.render(t),this.panControlCenter[0]=r+this.panControl.size/2,this.panControlCenter[1]=n+this.panControl.size/2,r+=this.panControl.size),this.showZoomControl&&(this.zoomOutControl.screenOffset.x=r,this.zoomOutControl.screenOffset.y=n,this.zoomInControl.screenOffset.x=r,this.zoomInControl.screenOffset.y=n+this.zoomOutControl.size,this.zoomOutControl.render(t),this.zoomInControl.render(t),r+=this.zoomOutControl.size),this.showHeadingControl&&(this.headingRightControl.screenOffset.x=r,this.headingRightControl.screenOffset.y=n,this.headingLeftControl.screenOffset.x=r,this.headingLeftControl.screenOffset.y=n+this.headingLeftControl.size,this.headingRightControl.render(t),this.headingLeftControl.render(t),r+=this.headingLeftControl.size),this.showTiltControl&&(this.tiltDownControl.screenOffset.x=r,this.tiltDownControl.screenOffset.y=n,this.tiltUpControl.screenOffset.x=r,this.tiltUpControl.screenOffset.y=n+this.tiltDownControl.size,this.tiltDownControl.render(t),this.tiltUpControl.render(t),r+=this.tiltDownControl.size),this.showExaggerationControl&&(this.exaggerationDownControl.screenOffset.x=r,this.exaggerationDownControl.screenOffset.y=n,this.exaggerationUpControl.screenOffset.x=r,this.exaggerationUpControl.screenOffset.y=n+this.exaggerationDownControl.size,this.exaggerationUpControl.render(t),this.exaggerationDownControl.render(t),r+=this.exaggerationDownControl.size),this.showFieldOfViewControl&&(this.fovNarrowControl.screenOffset.x=r,this.fovNarrowControl.screenOffset.y=n,this.fovWideControl.screenOffset.x=r,this.fovWideControl.screenOffset.y=n+this.fovNarrowControl.size,this.fovNarrowControl.render(t),this.fovWideControl.render(t))},h.prototype.setupInteraction=function(){var t=this.wwd,e=this,i=function(i){if(e.enabled&&!e.isTouchDevice){var r,n;e.highlightedControl&&(e.highlight(e.highlightedControl,!1),e.wwd.redraw()),i.type&&"mouseup"===i.type&&1===i.which&&e.activeControl?(e.activeControl=null,e.activeOperation=null,i.preventDefault()):(e.activeOperation?(e.activeOperation.call(e,i,null),i.preventDefault()):(r=e.pickControl(t.canvasCoordinates(i.clientX,i.clientY)),(n=e.determineOperation(i,r))&&n.call(e,i,r)),e.handleHighlight(i,r),e.wwd.redraw())}};t.addEventListener("mousedown",i),t.addEventListener("mouseup",i),t.addEventListener("mousemove",i),window.addEventListener("mouseup",i),window.addEventListener("mousemove",i);var r=function(i){if(this.isTouchDevice=!0,e.enabled){if(e.highlightedControl&&(e.highlight(e.highlightedControl,!1),e.wwd.redraw()),!i.type||"touchend"!==i.type&&"touchcancel"!==i.type)if(e.activeOperation)e.activeOperation.call(e,i,null),i.preventDefault();else{var r,n,o=i.changedTouches.item(0);r=e.pickControl(t.canvasCoordinates(o.clientX,o.clientY)),n=e.determineOperation(i,r),n&&n.call(e,i,r)}else e.activeControl&&e.isCurrentTouch(i)&&(e.activeControl=null,e.activeOperation=null,i.preventDefault());e.handleHighlight(i,r),e.wwd.redraw()}};t.addEventListener("touchstart",r),t.addEventListener("touchend",r),t.addEventListener("touchcancel",r),t.addEventListener("touchmove",r)},h.prototype.isControl=function(t){for(var e=0;e<this.controls.length;e++)if(this.controls[e]==t)return!0;return!1},h.prototype.pickControl=function(t){for(var e,i=t[0],r=this.wwd.canvas.height-t[1],n=0;n<this.controls.length;n++)if(e=this.controls[n],e.enabled&&i>=e.screenOffset.x&&i<=e.screenOffset.x+e.size&&r>=e.screenOffset.y&&r<=e.screenOffset.y+e.size)return e;return null},h.prototype.determineOperation=function(t,e){var i=null;return e&&e instanceof s&&(e===this.panControl?i=this.handlePan:e===this.zoomInControl||e===this.zoomOutControl?i=this.handleZoom:e===this.headingLeftControl||e===this.headingRightControl?i=this.handleHeading:e===this.tiltUpControl||e===this.tiltDownControl?i=this.handleTilt:e===this.exaggerationUpControl||e===this.exaggerationDownControl?i=this.handleExaggeration:e!==this.fovNarrowControl&&e!==this.fovWideControl||(i=this.handleFov)),i},h.prototype.isCurrentTouch=function(t){for(var e=0;e<t.changedTouches.length;e++)if(t.changedTouches.item(e).identifier===this.currentTouchId)return!0;return!1},h.prototype.handlePan=function(e,i){if("mousedown"===e.type||"mousemove"===e.type)this.currentEventPoint=this.wwd.canvasCoordinates(e.clientX,e.clientY);else if("touchstart"===e.type||"touchmove"===e.type){var n=e.changedTouches.item(0);this.currentEventPoint=this.wwd.canvasCoordinates(n.clientX,n.clientY)}if("mousedown"===e.type&&1===e.which||"touchstart"===e.type){this.activeControl=i,this.activeOperation=this.handlePan,e.preventDefault(),"touchstart"===e.type&&(this.currentTouchId=e.changedTouches.item(0).identifier);var o=this,s=function(){if(o.activeControl){var e=o.panControlCenter[0]-o.currentEventPoint[0],i=o.panControlCenter[1]-(o.wwd.viewport.height-o.currentEventPoint[1]),n=o.wwd.navigator.lookAtLocation.latitude,a=o.wwd.navigator.lookAtLocation.longitude,l=o.panIncrement*(o.wwd.navigator.range/o.wwd.globe.radiusAt(n,a)),h=o.wwd.navigator.heading+Math.atan2(e,i)*t.RADIANS_TO_DEGREES,u=l*Math.sqrt(e*e+i*i);r.greatCircleLocation(o.wwd.navigator.lookAtLocation,h,-u,o.wwd.navigator.lookAtLocation),o.wwd.redraw(),setTimeout(s,50)}};setTimeout(s,50)}},h.prototype.handleZoom=function(t,e){if("mousedown"===t.type&&1===t.which||"touchstart"===t.type){this.activeControl=e,this.activeOperation=this.handleZoom,t.preventDefault(),"touchstart"===t.type&&(this.currentTouchId=t.changedTouches.item(0).identifier);var i=this,r=function(){i.activeControl&&(i.activeControl===i.zoomInControl?i.wwd.navigator.range*=1-i.zoomIncrement:i.activeControl===i.zoomOutControl&&(i.wwd.navigator.range*=1+i.zoomIncrement),i.wwd.redraw(),setTimeout(r,50))};setTimeout(r,50)}},h.prototype.handleHeading=function(t,e){if("mousedown"===t.type&&1===t.which||"touchstart"===t.type){this.activeControl=e,this.activeOperation=this.handleHeading,t.preventDefault(),"touchstart"===t.type&&(this.currentTouchId=t.changedTouches.item(0).identifier);var i=this,r=function(){i.activeControl&&(i.activeControl===i.headingLeftControl?i.wwd.navigator.heading+=i.headingIncrement:i.activeControl===i.headingRightControl&&(i.wwd.navigator.heading-=i.headingIncrement),i.wwd.redraw(),setTimeout(r,50))};setTimeout(r,50)}},h.prototype.handleTilt=function(t,e){if("mousedown"===t.type&&1===t.which||"touchstart"===t.type){this.activeControl=e,this.activeOperation=this.handleTilt,t.preventDefault(),"touchstart"===t.type&&(this.currentTouchId=t.changedTouches.item(0).identifier);var i=this,r=function(){i.activeControl&&(i.activeControl===i.tiltUpControl?i.wwd.navigator.tilt=Math.max(0,i.wwd.navigator.tilt-i.tiltIncrement):i.activeControl===i.tiltDownControl&&(i.wwd.navigator.tilt=Math.min(90,i.wwd.navigator.tilt+i.tiltIncrement)),i.wwd.redraw(),setTimeout(r,50))};setTimeout(r,50)}},h.prototype.handleExaggeration=function(t,e){if("mousedown"===t.type&&1===t.which||"touchstart"===t.type){this.activeControl=e,this.activeOperation=this.handleExaggeration,t.preventDefault(),"touchstart"===t.type&&(this.currentTouchId=t.changedTouches.item(0).identifier);var i=this,r=function(){i.activeControl&&(i.activeControl===i.exaggerationUpControl?i.wwd.verticalExaggeration+=i.exaggerationIncrement:i.activeControl===i.exaggerationDownControl&&(i.wwd.verticalExaggeration=Math.max(1,i.wwd.verticalExaggeration-i.exaggerationIncrement)),i.wwd.redraw(),setTimeout(r,50))};setTimeout(r,50)}},h.prototype.handleFov=function(t,e){if("mousedown"===t.type&&1===t.which||"touchstart"===t.type){this.activeControl=e,this.activeOperation=this.handleFov,t.preventDefault(),"touchstart"===t.type&&(this.currentTouchId=t.changedTouches.item(0).identifier);var i=this,r=function(){i.activeControl&&(i.activeControl===i.fovWideControl?i.wwd.navigator.fieldOfView=Math.max(90,i.wwd.navigator.fieldOfView+i.fieldOfViewIncrement):i.activeControl===i.fovNarrowControl&&(i.wwd.navigator.fieldOfView=Math.min(0,i.wwd.navigator.fieldOfView-i.fieldOfViewIncrement)),i.wwd.redraw(),setTimeout(r,50))};setTimeout(r,50)}},h.prototype.handleHighlight=function(t,e){this.activeControl?this.highlight(this.activeControl,!0):e&&this.isControl(e)&&this.highlight(e,!0)},h.prototype.highlight=function(t,e){t.opacity=e?this._activeOpacity:this._inactiveOpacity,this.highlightedControl=e?t:null},h}),i("util/WcsTileUrlBuilder",["../error/ArgumentError","../util/Logger"],function(t,e){"use strict";var i=function(i,r,n){if(!i||0===i.length)throw new t(e.logMessage(e.LEVEL_SEVERE,"WcsTileUrlBuilder","constructor","The WCS service address is missing."));if(!r||0===r.length)throw new t(e.logMessage(e.LEVEL_SEVERE,"WcsTileUrlBuilder","constructor","The WCS coverage name is missing."));this.serviceAddress=i,this.coverageName=r,this.wcsVersion=n&&n.length>0?n:"1.0.0",this.crs="EPSG:4326"};return i.prototype.urlForTile=function(r,n){if(!r)throw new t(e.logMessage(e.LEVEL_SEVERE,"WcsUrlBuilder","urlForTile","missingTile"));if(!n)throw new t(e.logMessage(e.LEVEL_SEVERE,"WcsUrlBuilder","urlForTile","The coverage format is null or undefined."));var o=r.sector,s=i.fixGetCoverageString(this.serviceAddress);return s.search(/service=wcs/i)<0&&(s+="service=WCS"),s+="&request=GetCoverage",s=s+"&version="+this.wcsVersion,s=s+"&coverage="+this.coverageName,s=s+"&format="+n,s=s+"&width="+r.tileWidth,s=s+"&height="+r.tileHeight,s=s+"&crs="+this.crs,s+="&bbox=",s=s+o.minLongitude+","+o.minLatitude+",",s=s+o.maxLongitude+","+o.maxLatitude,s=s.replace(" ","%20")},i.fixGetCoverageString=function(i){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"WcsTileUrlBuilder","fixGetCoverageString","The specified service address is null or undefined."));var r=i.indexOf("?");return r<0?i+="?":r!==i.length-1&&(r=i.search(/&$/))<0&&(i+="&"),i},i}),i("ogc/wmts/OwsLanguageString",["../../error/ArgumentError","../../util/Logger"],function(t,e){"use strict";return function(i){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"LanguageString","constructor","missingDomElement"));this.value=i.textContent,this.lang;var r=i.getAttribute("lang");r&&(this.lang=r)}}),i("ogc/wmts/OwsConstraint",["../../error/ArgumentError","../../util/Logger"],function(t,e){"use strict";return function(i){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"OwsConstraint","constructor","missingDomElement"));this.name=i.getAttribute("name");for(var r=i.children||i.childNodes,n=0;n<r.length;n++){var o=r[n];if("AllowedValues"===o.localName){this.allowedValues=this.allowedValues||[];for(var s=o.children||o.childNodes,a=0;a<s.length;a++)"Value"===s[a].localName&&this.allowedValues.push(s[a].textContent)}else"AnyValue"===o.localName?this.anyValue=!0:"NoValues"===o.localName&&(this.noValues=!0)}}}),i("ogc/wmts/OwsOperationsMetadata",["../../error/ArgumentError","../../util/Logger","../../ogc/wmts/OwsConstraint"],function(t,e,i){"use strict";var r=function(i){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"OwsOperationsMetadata","constructor","missingDomElement"));for(var n=i.children||i.childNodes,o=0;o<n.length;o++){var s=n[o];"Operation"===s.localName&&(this.operation=this.operation||[],this.operation.push(r.assembleOperation(s)))}};return r.prototype.getGetCapabilities=function(){return this.getOperationMetadataByName("GetCapabilities")},r.prototype.getGetTile=function(){return this.getOperationMetadataByName("GetTile")},r.prototype.getOperationMetadataByName=function(i){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"OwsOperationsMetadata","getOperationsMetadataByName","missingName"));for(var r=0;r<this.operation.length;r++)if(this.operation[r].name===i)return this.operation[r];return null},r.assembleOperation=function(t){var e={};e.name=t.getAttribute("name");for(var i=t.children||t.childNodes,n=0;n<i.length;n++){var o=i[n];"DCP"===o.localName&&(e.dcp=e.dcp||[],e.dcp.push(r.assembleDcp(o)))}return e},r.assembleDcp=function(t){for(var e={},i=t.children||t.childNodes,n=0;n<i.length;n++){var o=i[n];if("HTTP"===o.localName)for(var s=o.children||o.childNodes,a=0;a<s.length;a++){var l=s[a];"Get"===l.localName?(e.getMethods=e.getMethods||[],e.getMethods.push(r.assembleMethod(l))):"Post"===l.localName&&(e.postMethods=e.postMethods||[],e.postMethods.push(r.assembleMethod(l)))}}return e},r.assembleMethod=function(t){var e={};e.url=t.getAttribute("xlink:href");for(var r=t.children||t.childNodes,n=0;n<r.length;n++){var o=r[n];"Constraint"===o.localName&&(e.constraint=e.constraint||[],e.constraint.push(new i(o)))}return e},r}),i("ogc/wmts/OwsDescription",["../../error/ArgumentError","../../util/Logger","../../ogc/wmts/OwsLanguageString"],function(t,e,i){"use strict";return function(r){if(!r)throw new t(e.logMessage(e.LEVEL_SEVERE,"OwsDescription","assembleDescriptions","missingDomElement"));for(var n=r.children||r.childNodes,o=0;o<n.length;o++){var s=n[o];if("Title"===s.localName)this.titles=this.titles||[],this.titles.push(new i(s));else if("Abstract"===s.localName)this.abstracts=this.abstracts||[],this.abstracts.push(new i(s));else if("Keywords"===s.localName){this.keywords=this.keywords||[];for(var a=s.children||s.childNodes,l=0;l<a.length;l++){var h=a[l];"Keyword"===h.localName&&this.keywords.push(new i(h))}}}}}),i("ogc/wmts/OwsServiceIdentification",["../../error/ArgumentError","../../util/Logger","../../ogc/wmts/OwsDescription"],function(t,e,i){"use strict";var r=function(r){if(!r)throw new t(e.logMessage(e.LEVEL_SEVERE,"OwsServiceIdentification","constructor","missingDomElement"));i.call(this,r);for(var n=r.children||r.childNodes,o=0;o<n.length;o++){var s=n[o];"ServiceType"===s.localName?this.serviceType=s.textContent:"ServiceTypeVersion"===s.localName?(this.serviceTypeVersions=this.serviceTypeVersions||[],this.serviceTypeVersions.push(s.textContent)):"Profile"===s.localName?(this.profile=this.profiles||[],this.profile.push(s.textContent)):"Fees"===s.localName?this.fees=s.textContent:"AccessConstraints"===s.localName&&(this.accessConstraints=this.accessConstraints||[],this.accessConstraints.push(s.textContent))}};return r.prototype=Object.create(i.prototype),r}),i("ogc/wmts/OwsServiceProvider",["../../error/ArgumentError","../../util/Logger"],function(t,e){"use strict";var i=function(r){if(!r)throw new t(e.logMessage(e.LEVEL_SEVERE,"OwsServiceProvider","constructor","missingDomElement"));for(var n=r.children||r.childNodes,o=0;o<n.length;o++){var s=n[o];"ProviderName"===s.localName?this.providerName=s.textContent:"ProviderSite"===s.localName?this.providerSiteUrl=s.getAttribute("xlink:href"):"ServiceContact"===s.localName&&(this.serviceContact=i.assembleServiceContact(s))}};return i.assembleServiceContact=function(r){if(!r)throw new t(e.logMessage(e.LEVEL_SEVERE,"OwsServiceProvider","assembleServiceContact","missingDomElement"));for(var n={},o=r.children||r.childNodes,s=0;s<o.length;s++){var a=o[s];"IndividualName"===a.localName?n.individualName=a.textContent:"PositionName"===a.localName?n.positionName=a.textContent:"ContactInfo"===a.localName&&(n.contactInfo=i.assembleContacts(a))}return n},i.assembleContacts=function(r){if(!r)throw new t(e.logMessage(e.LEVEL_SEVERE,"OwsServiceProvider","assembleContacts","missingDomElement"));for(var n={},o=r.children||r.childNodes,s=0;s<o.length;s++){var a=o[s];"HoursOfService"===a.localName?n.hoursOfService=a.textContent:"ContactInstructions"===a.localName?n.contactInstructions=a.textContent:"Phone"===a.localName?n.phone=i.assemblePhone(a):"Address"===a.localName&&(n.address=i.assembleAddress(a))}return n},i.assemblePhone=function(i){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"OwsServiceProvider","assemblePhone","missingDomElement"));for(var r={},n=i.children||i.childNodes,o=0;o<n.length;o++){var s=n[o];"Voice"===s.localName?r.voice=s.textContent:"Facsimile"===s.localName&&(r.facsimile=s.textContent)}return r},i.assembleAddress=function(i){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"OwsServiceProvider","assembleAddress","missingDomElement"));for(var r={},n=i.children||i.childNodes,o=0;o<n.length;o++){var s=n[o];"DeliveryPoint"===s.localName?(r.deliveryPoints=r.deliveryPoints||[],r.deliveryPoints.push(s.textContent)):"City"===s.localName?r.city=s.textContent:"AdministrativeArea"===s.localName?r.administrativeArea=s.textContent:"PostalCode"===s.localName?(r.postalCodes=r.postalCodes||[],r.postalCodes.push(s.textContent)):"Country"===s.localName?(r.countries=r.countries||[],r.countries.push(s.textContent)):"ElectronicMailAddress"===s.localName&&(r.electronicMailAddresses=r.electronicMailAddresses||[],r.electronicMailAddresses.push(s.textContent))}return r},i}),i("ogc/WfsCapabilities",["../error/ArgumentError","../util/Logger","../ogc/wmts/OwsLanguageString","../ogc/wmts/OwsOperationsMetadata","../ogc/wmts/OwsServiceIdentification","../ogc/wmts/OwsServiceProvider"],function(t,e,i,r,n,o){"use strict";var s=function(i){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"WfsCapabilities","constructor","No XML DOM specified."));this.assembleDocument(i)};return s.prototype.assembleDocument=function(t){var e=t.documentElement;this.version=e.getAttribute("version"),this.updateSequence=e.getAttribute("updateSequence");for(var i=e.children||e.childNodes,s=0;s<i.length;s++){var a=i[s];"ServiceIdentification"===a.localName?this.serviceIdentification=new n(a):"ServiceProvider"===a.localName?this.serviceProvider=new o(a):"OperationsMetadata"===a.localName?this.operationsMetadata=new r(a):"FeatureTypeList"===a.localName?this.featureTypeList=this.assembleFeatureTypeList(a):"Filter_Capabilities"===a.localName&&(this.filterCapabilities=this.assembleFilterCapabilities(a))}},s.prototype.assembleFeatureTypeList=function(t){for(var i={},r=t.children||t.childNodes,n=0;n<r.length;n++){var o=r[n];if("Operations"==o.localName){i.operations=i.operations||[];try{i.operations=s.assembleOperations(o)}catch(t){e.logMessage(e.LEVEL_SEVERE,"WfsCapabilities","constructor","Exception reading WFS operations description: "+t.message)}}else if("FeatureType"==o.localName){i.featureType=i.featureType||[];try{i.featureType.push(s.assembleFeatureType(o))}catch(t){e.logMessage(e.LEVEL_SEVERE,"WfsCapabilities","constructor","Exception reading WFS operations description: "+t.message)}}}return i},s.prototype.assembleFilterCapabilities=function(t){for(var e={},i=t.children||t.childNodes,r=0;r<i.length;r++){var n=i[r];"Conformance"===n.localName?e.conformance=s.assembleConformance(n):"Id_Capabilities"===n.localName?e.idCapabilities=s.assembleIdCapabilities(n):"Scalar_Capabilities"===n.localName?e.scalarCapabilities=s.assembleScalarCapabilities(n):"Spatial_Capabilities"===n.localName?e.spatialCapabilities=s.assembleSpatialCapabilities(n):"Functions"===n.localName&&(e.functions=s.assembleFunctions(n))}return e},s.assembleOperations=function(t){for(var e=[],i=t.children||t.childNodes,r=0;r<i.length;r++){var n=i[r];"Operation"==n.localName&&e.push(n.textContent)}return e},s.assembleFeatureType=function(t){for(var e={},i=t.children||t.childNodes,r=0;r<i.length;r++){var n=i[r];"Name"==n.localName?e.name=n.textContent:"Title"==n.localName?e.title=n.textContent:"Abstract"==n.localName?e.abstract=n.textContent:"Keywords"==n.localName?(e.keywords=e.keywords||[],e.keywords=s.assembleKeywords(n)):"DefaultSRS"==n.localName?e.defaultSRS=n.textContent:"OtherSRS"==n.localName?(e.otherSRS=e.otherSRS||[],e.otherSRS.push(n.textContent)):"WGS84BoundingBox"==n.localName?e.wgs84BoundingBox=s.assembleBoundingBox(n):"DefaultCRS"==n.localName?e.defaultCRS=n.textContent:"OtherCRS"==n.localName?(e.otherCRS=e.otherCRS||[],e.otherCRS.push(n.textContent)):"OutputFormats"==n.localName?e.outputFormats=s.assembleOutputFormats(n):"MetadataURL"==n.localName&&(e.metadataUrl=s.assembleMetadataUrl(n))}return e},s.assembleBoundingBox=function(t){var e={},i=t.getAttribute("crs");i&&(e.crs=i);for(var r=t.children||t.childNodes,n=0;n<r.length;n++){var o=r[n];if("LowerCorner"===o.localName){var s=o.textContent.split(" ");e.lowerCorner=[parseFloat(s[0]),parseFloat(s[1])]}else if("UpperCorner"===o.localName){var a=o.textContent.split(" ");e.upperCorner=[parseFloat(a[0]),parseFloat(a[1])]}}return e},s.assembleOutputFormats=function(t){for(var e=[],i=t.children||t.childNodes,r=0;r<i.length;r++){var n=i[r];"Format"===n.localName&&e.push(n.textContent)}return e},s.assembleMetadataUrl=function(t){for(var e={},i=t.children||t.childNodes,r=0;r<i.length;r++){var n=i[r];"MetadataURL"===n.localName&&(e.format=n.getAttribute("format"),e.type=n.getAttribute("type"))}return outputFormats},s.assembleKeywords=function(t){for(var e=[],i=t.children||t.childNodes,r=0;r<i.length;r++){var n=i[r];"Keyword"===n.localName&&e.push(n.textContent)}return e},s.assembleConformance=function(t){for(var e=[],i=t.children||t.childNodes,r=0;r<i.length;r++){var n=i[r];if("Constraint"===n.localName){var o;o=s.assembleConstraint(n),o.name=n.getAttribute("name"),e.push(o)}}return e},s.assembleConstraint=function(t){for(var e={},i=t.children||t.childNodes,r=0;r<i.length;r++){var n=i[r];"DefaultValue"===n.localName&&(e.defaultValue=n.textContent)}return e},s.assembleIdCapabilities=function(t){for(var e={},i=t.children||t.childNodes,r=0;r<i.length;r++){var n=i[r];"ResourceIdentifier"===n.localName&&(e.resourceIdentifier=n.getAttribute("name"))}return e},s.assembleScalarCapabilities=function(t){for(var e={},i=t.children||t.childNodes,r=0;r<i.length;r++){var n=i[r];"ComparisonOperators"===n.localName?e.comparisonOperators=s.assembleComparisonOperators(n):"ArithmeticOperators"===n.localName&&(e.arithmeticOperators=s.assembleArithmeticOperators(n))}return e},s.assembleComparisonOperators=function(t){for(var e=[],i=t.children||t.childNodes,r=0;r<i.length;r++){var n=i[r];"ComparisonOperator"===n.localName&&e.push(n.textContent)}return e},s.assembleArithmeticOperators=function(t){for(var e={},i=t.children||t.childNodes,r=0;r<i.length;r++){var n=i[r];"Functions"===n.localName&&(e.functions=s.assembleArithmeticFunctions(n))}return e},s.assembleArithmeticFunctions=function(t){for(var e=[],i=t.children||t.childNodes,r=0;r<i.length;r++){var n=i[r];"FunctionNames"===n.localName&&(e=s.assembleFunctionNames(n))}return e},s.assembleFunctionNames=function(t){for(var e=[],i=t.children||t.childNodes,r=0;r<i.length;r++){var n=i[r];if("FunctionName"===n.localName){var o={name:n.textContent,nArgs:n.getAttribute("nArgs")};e.push(o)}}return e},s.assembleSpatialCapabilities=function(t){for(var e={},i=t.children||t.childNodes,r=0;r<i.length;r++){var n=i[r];"GeometryOperands"===n.localName?e.geometryOperands=s.assembleGeometryOperands(n):"SpatialOperators"===n.localName&&(e.spatialOperators=s.assembleSpatialOperators(n))}return e},s.assembleGeometryOperands=function(t){for(var e=[],i=t.children||t.childNodes,r=0;r<i.length;r++){var n=i[r];"GeometryOperand"===n.localName&&e.push(n.getAttribute("name"))}return e},s.assembleSpatialOperators=function(t){for(var e=[],i=t.children||t.childNodes,r=0;r<i.length;r++){var n=i[r];"SpatialOperator"===n.localName&&e.push(n.getAttribute("name"))}return e},s.assembleFunctions=function(t){for(var e=[],i=t.children||t.childNodes,r=0;r<i.length;r++){var n=i[r];"Function"===n.localName&&e.push(s.assembleFunction(n))}return e},s.assembleFunction=function(t){var e={};e.name=t.getAttribute("name");for(var i=t.children||t.childNodes,r=0;r<i.length;r++){var n=i[r];"Returns"===n.localName?e.returns=n.textContent:"Arguments"===n.localName&&(e.arguments=s.assembleArguments(n))}return e},s.assembleArguments=function(t){for(var e=[],i=t.children||t.childNodes,r=0;r<i.length;r++){var n=i[r];"Argument"===n.localName&&e.push(s.assembleArgument(n))}return e},s.assembleArgument=function(t){var e={};e.name=t.getAttribute("name");for(var i=t.children||t.childNodes,r=0;r<i.length;r++){var n=i[r];"Type"===n.localName&&(e.type=n.textContent)}return e},s}),i("formats/wkt/WktElements",[],function(){return{}}),i("formats/wkt/WktType",[],function(){var t=function(){};return t.SupportedGeometries={LINE_STRING:"LINESTRING",MULTI_LINE_STRING:"MULTILINESTRING",POLYGON:"POLYGON",MULTI_POLYGON:"MULTIPOLYGON",POINT:"POINT",MULTI_POINT:"MULTIPOINT",TRIANGLE:"TRIANGLE",GEOMETRY_COLLECTION:"GEOMETRYCOLLECTION"},t.TokenType={LEFT_PARENTHESIS:0,COMMA:1,RIGHT_PARENTHESIS:2,NUMBER:3,TEXT:4},t}),i("formats/wkt/geom/WktObject",["../../../geom/Location","../../../geom/Position","../WktElements","../WktType"],function(t,e,i,r){var n=function(t){this.type=t,this._is3d=!1,this._isLrs=!1,this.coordinates=[],this.options={coordinates:[],leftParenthesis:0,rightParenthesis:0,tokens:[]}};return n.prototype.set3d=function(){this._is3d=!0},n.prototype.setLrs=function(){this._isLrs=!0},n.prototype.addCoordinates=function(i){this._is3d?this.coordinates.push(new e(i[0],i[1],i[2]||0)):this.coordinates.push(new t(i[0],i[1]))},n.prototype.shapes=function(){return[]},n.prototype.handleToken=function(t){var e=t.value,i=this.options;t.type===r.TokenType.TEXT?this.text(i,e):t.type===r.TokenType.LEFT_PARENTHESIS?this.leftParenthesis(i):t.type===r.TokenType.RIGHT_PARENTHESIS?this.rightParenthesis(i):t.type===r.TokenType.NUMBER?this.number(i,e):t.type===r.TokenType.COMMA&&this.comma(i),i.tokens.push(t)},n.prototype.text=function(t,e){e=e.toUpperCase();if(e.length<=2)this.setOptions(e,this);else if(0===e.indexOf("EMPTY"))t.leftParenthesis=1,t.rightParenthesis=1;else{var r=e.match("[M]?[Z]?$");r&&r.length>0&&""!=r[0]&&this.setOptions(r,null);var o=i[e]&&new i[e];o||(o=new n),r&&r.length>0&&""!=r[0]&&o.setOptions(r[0],o),this.add(o)}},n.prototype.rightParenthesis=function(t){t.rightParenthesis++,t.coordinates&&(this.addCoordinates(t.coordinates),t.coordinates=null)},n.prototype.leftParenthesis=function(t){t.leftParenthesis++},n.prototype.comma=function(t){t.coordinates?(this.addCoordinates(t.coordinates),t.coordinates=null):this.commaWithoutCoordinates(t)},n.prototype.commaWithoutCoordinates=function(t){},n.prototype.number=function(t,e){t.coordinates=t.coordinates||[],t.coordinates.push(e)},n.prototype.setOptions=function(t,e){"Z"==t?e.set3d():"M"==t?e.setLrs():"MZ"==t&&(e.set3d(),e.setLrs())},n.prototype.isFinished=function(){return this.options.leftParenthesis===this.options.rightParenthesis&&this.options.leftParenthesis>0},n}),i("formats/wkt/WktTokens",["./WktElements","./geom/WktObject","./WktType"],function(t,e,i){var r=function(t){this.sourceText=t};return r.prototype.objects=function(){var i,r=[];return this.tokenize(this.sourceText).forEach(function(n){if(i&&i.isFinished()||!i){var o=n.value,s=o.match("[M]?[Z]?$");s&&s.length>0&&""!=s[0]&&(o=o.substring(0,o.length-s.length)),i=t[o]&&new t[o],i||(i=new e),s&&s.length>0&&""!=s[0]&&i.setOptions(s[0],i),r.push(i)}else i.handleToken(n)}),r},r.prototype.tokenize=function(t){this.currentPosition=0;for(var e=[];this.currentPosition<t.length;this.currentPosition++){var r=t.charAt(this.currentPosition);if("("==r)e.push({type:i.TokenType.LEFT_PARENTHESIS});else if(","==r)e.push({type:i.TokenType.COMMA});else if(")"==r)e.push({type:i.TokenType.RIGHT_PARENTHESIS});else if(this.isAlpha(r)){var n=this.readText(t);e.push({type:i.TokenType.TEXT,value:n})}else{if(!this.isNumeric(r)){if(this.isWhiteSpace(r))continue;throw new Error("Invalid character: {{",r,"}}")}var o=this.readNumeric(t);e.push({type:i.TokenType.NUMBER,value:o})}}return e},r.prototype.isAlpha=function(t){return t>="a"&&t<="z"||t>="A"&&t<="Z"},r.prototype.isNumeric=function(t){return t>="0"&&t<="9"||"."==t||"-"==t},r.prototype.isWhiteSpace=function(t){return" "==t||"\t"==t||"\r"==t||"\n"==t},r.prototype.readText=function(t){for(var e="";this.isAlpha(t.charAt(this.currentPosition));)e+=t.charAt(this.currentPosition),this.currentPosition++;return this.currentPosition--,e},r.prototype.readNumeric=function(t){for(var e="";this.isNumeric(t.charAt(this.currentPosition));)e+=t.charAt(this.currentPosition),this.currentPosition++;return this.currentPosition--,Number(e)},r}),i("formats/wkt/Wkt",["../../error/ArgumentError","../../util/Logger","./WktTokens"],function(t,e,i){var r=function(t){this.textRepresentation=t,this._parserCompletionCallback=this.defaultParserCompletionCallback,this._shapeConfigurationCallback=this.defaultShapeConfigurationCallback,this._layer=null};return Object.defineProperties(r.prototype,{parserCompletionCallback:{get:function(){return this._parserCompletionCallback}},shapeConfigurationCallback:{get:function(){return this._shapeConfigurationCallback}},layer:{get:function(){return this._layer}}}),r.prototype.load=function(t,e,r){r&&(this._layer=r),t&&(this._parserCompletionCallback=t),e&&(this._shapeConfigurationCallback=e),this.parserCompletionCallback(this,new i(this.textRepresentation).objects())},r.prototype.defaultShapeConfigurationCallback=function(t){},r.prototype.defaultParserCompletionCallback=function(t,e){var i=t.shapeConfigurationCallback,r=[];e.forEach(function(t){t.shapes().forEach(function(e){var n=i(t);n&&n.attributes&&(e.attributes=n.attributes),n&&n.highlightAttributes&&(e.highlightAttributes=n.highlightAttributes),n&&n.pickDelegate&&(e.pickDelegate=n.pickDelegate),n&&n.userProperties&&(e.userProperties=n.userProperties),r.push(e)})}),t.layer&&t.layer.addRenderables(r)},r}),i("formats/wkt/geom/WktGeometryCollection",["../../../geom/Location","../../../geom/Position","../WktElements","./WktObject","../WktType"],function(t,e,i,r,n){var o=function(){r.call(this,n.SupportedGeometries.GEOMETRY_COLLECTION),this.objects=[]};return o.prototype=Object.create(r.prototype),o.prototype.add=function(t){this.objects.push(t)},o.prototype.addCoordinates=function(i){var r=this.objects[this.objects.length-1];this._is3d?r.coordinates.push(new e(i[0],i[1],i[2]||0)):r.coordinates.push(new t(i[0],i[1]))},o.prototype.shapes=function(){var t=[];return this.objects.forEach(function(e){e.shapes().forEach(function(e){t.push(e)})}),t},i.GEOMETRYCOLLECTION=o,o}),i("formats/wkt/geom/WktLineString",["../../../shapes/Path","../../../shapes/ShapeAttributes","../../../shapes/SurfacePolyline","../WktElements","./WktObject","../WktType"],function(t,e,i,r,n,o){var s=function(){n.call(this,o.SupportedGeometries.LINE_STRING)};return s.prototype=Object.create(n.prototype),s.prototype.shapes=function(){return this._is3d?[new t(this.coordinates,new e(null))]:[new i(this.coordinates,new e(null))]},r.LINESTRING=s,s}),i("formats/wkt/geom/WktMultiLineString",["../../../shapes/Path","../../../shapes/ShapeAttributes","../../../shapes/SurfacePolyline","../WktElements","./WktObject","../WktType"],function(t,e,i,r,n,o){var s=function(){n.call(this,o.SupportedGeometries.MULTI_LINE_STRING),this.objectBoundaries=[]};return s.prototype=Object.create(n.prototype),s.prototype.commaWithoutCoordinates=function(){this.objectBoundaries.push(this.coordinates.slice()),this.coordinates=[]},s.prototype.shapes=function(){return this.commaWithoutCoordinates(),this._is3d?this.objectBoundaries.map(function(i){return new t(i,new e(null))}.bind(this)):this.objectBoundaries.map(function(t){return new i(t,new e(null))}.bind(this))},r.MULTILINESTRING=s,s}),i("formats/wkt/geom/WktPoint",["../../../shapes/Placemark","../../../shapes/PlacemarkAttributes","../WktElements","./WktObject","../WktType"],function(t,e,i,r,n){var o=function(){r.call(this,n.SupportedGeometries.POINT)};return o.prototype=Object.create(r.prototype),o.prototype.shapes=function(){return[o.placemark(this.coordinates[0])]},o.placemark=function(i){var r=new e(null);r.imageScale=1,r.imageOffset=new WorldWind.Offset(WorldWind.OFFSET_FRACTION,.3,WorldWind.OFFSET_FRACTION,0),r.imageColor=WorldWind.Color.WHITE,r.labelAttributes.offset=new WorldWind.Offset(WorldWind.OFFSET_FRACTION,.5,WorldWind.OFFSET_FRACTION,1),r.labelAttributes.color=WorldWind.Color.YELLOW,r.drawLeaderLine=!0,r.leaderLineAttributes.outlineColor=WorldWind.Color.RED,r.imageSource=WorldWind.configuration.baseUrl+"images/pushpins/castshadow-purple.png";var n=new t(i,!0,r);return n.altitudeMode=WorldWind.RELATIVE_TO_GROUND,n},i.POINT=o,o}),
i("formats/wkt/geom/WktMultiPoint",["../../../shapes/Placemark","../../../shapes/PlacemarkAttributes","../WktElements","./WktObject","./WktPoint","../WktType"],function(t,e,i,r,n,o){var s=function(){r.call(this,o.SupportedGeometries.MULTI_POINT)};return s.prototype=Object.create(r.prototype),s.prototype.commaWithoutCoordinates=function(){},s.prototype.shapes=function(){return this.coordinates.map(function(t){return n.placemark(t)}.bind(this))},i.MULTIPOINT=s,s}),i("formats/wkt/geom/WktMultiPolygon",["../../../shapes/Polygon","../../../shapes/ShapeAttributes","../../../shapes/SurfacePolygon","../WktElements","./WktObject","../WktType"],function(t,e,i,r,n,o){var s=function(){n.call(this,o.SupportedGeometries.MULTI_POLYGON),this.objectBoundaries=[],this.currentIndex=0};return s.prototype=Object.create(n.prototype),s.prototype.rightParenthesis=function(t){n.prototype.rightParenthesis.call(this,t),t.tokens[t.tokens.length-1].type!=o.TokenType.RIGHT_PARENTHESIS?this.addBoundaries():t.tokens[t.tokens.length-1].type==o.TokenType.RIGHT_PARENTHESIS&&t.tokens[t.tokens.length-2].type!=o.TokenType.RIGHT_PARENTHESIS&&this.addObject()},s.prototype.addBoundaries=function(){this.objectBoundaries[this.currentIndex]||(this.objectBoundaries[this.currentIndex]=[]),this.objectBoundaries[this.currentIndex].push(this.coordinates.slice()),this.coordinates=[]},s.prototype.addObject=function(){this.currentIndex++},s.prototype.shapes=function(){return this._is3d?this.objectBoundaries.map(function(i){return new t(i,new e(null))}.bind(this)):this.objectBoundaries.map(function(t){return new i(t,new e(null))}.bind(this))},r.MULTIPOLYGON=s,s}),i("formats/wkt/geom/WktPolygon",["../../../shapes/Polygon","../../../shapes/ShapeAttributes","../../../shapes/SurfacePolygon","../WktElements","./WktObject","../WktType"],function(t,e,i,r,n,o){var s=function(){n.call(this,o.SupportedGeometries.POLYGON),this._renderable=null};return s.prototype=Object.create(n.prototype),s.prototype.commaWithoutCoordinates=function(){this.outerBoundaries=this.coordinates.slice(),this.coordinates=[]},s.prototype.shapes=function(){return this._is3d?this.outerBoundaries?[new t([this.outerBoundaries,this.coordinates],new e(null))]:[new t(this.coordinates,new e(null))]:this.outerBoundaries?[new i([this.outerBoundaries,this.coordinates],new e(null))]:[new i(this.coordinates,new e(null))]},r.POLYGON=s,s}),i("formats/wkt/geom/WktTriangle",["../../../shapes/Polygon","../../../shapes/ShapeAttributes","../../../shapes/SurfacePolygon","../WktElements","./WktObject","../WktType"],function(t,e,i,r,n,o){var s=function(){n.call(this,o.SupportedGeometries.TRIANGLE),this._renderable=null};return s.prototype=Object.create(n.prototype),s.prototype.shapes=function(){return this._is3d?[new t(this.coordinates,new e(null))]:[new i(this.coordinates,new e(null))]},r.TRIANGLE=s,s}),i("ogc/wms/WmsLayerCapabilities",["../../error/ArgumentError","../../util/Logger"],function(t,e){"use strict";var i=function(i,r){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"WmsLayerCapabilities","constructor","Layer element is null or undefined."));this.parent=r,this.layers,this.name,this.title,this.abstract,this.keywordList,this.identifiers,this.metadataUrls,this.dataUrls,this.featureListUrls,this.assembleLayer(i)};return Object.defineProperties(i.prototype,{capability:{get:function(){for(var t=this;t&&t instanceof i;)t=t.parent;return t}},queryable:{get:function(){return i.replace(this,"_queryable")}},cascaded:{get:function(){return i.replace(this,"_cascaded")}},opaque:{get:function(){return i.replace(this,"_opaque")}},noSubsets:{get:function(){return i.replace(this,"_noSubsets")}},fixedWidth:{get:function(){return i.replace(this,"_fixedWidth")}},fixedHeight:{get:function(){return i.replace(this,"_fixedHeight")}},styles:{get:function(){return i.accumulate(this,"_styles",[])}},crses:{get:function(){return i.accumulate(this,"_crses",[])}},srses:{get:function(){return i.accumulate(this,"_srses",[])}},geographicBoundingBox:{get:function(){return i.replace(this,"_geographicBoundingBox")}},latLonBoundingBox:{get:function(){return i.replace(this,"_latLonBoundingBox")}},boundingBoxes:{get:function(){return i.replace(this,"_boundingBoxes")}},dimensions:{get:function(){for(var t=[],e=this;e&&e instanceof i;)e._dimensions&&e._dimensions.length>0&&e._dimensions.forEach(function(e){var i=e.name,r=!0;t.forEach(function(t){t.name===i&&(r=!1)}),r&&t.push(e)}),e=e.parent;return t.length>0?t:void 0}},extents:{get:function(){for(var t=[],e=this;e&&e instanceof i;)e._extents&&e._extents.length>0&&e._extents.forEach(function(e){var i=e.name,r=!0;t.forEach(function(t){t.name===i&&(r=!1)}),r&&t.push(e)}),e=e.parent;return t.length>0?t:void 0}},attribution:{get:function(){return i.replace(this,"_attribution")}},authorityUrls:{get:function(){return i.accumulate(this,"_authorityUrls",[])}},minScaleDenominator:{get:function(){return i.replace(this,"_minScaleDenominator")}},maxScaleDenominator:{get:function(){return i.replace(this,"_maxScaleDenominator")}},scaleHint:{get:function(){return i.replace(this,"_scaleHint")}}}),i.prototype.style=function(i){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"WmsLayerCapabilities","style","Style name is null or undefined."));var r=this.styles;if(!r)return null;for(var n,o=0,s=r.length;o<s;o++)if(n=r[o],n.name===i)return n},i.accumulate=function(t,e,r){for(;t&&t instanceof i;){var n=t[e];if(n)for(var o=0;o<n.length;o++)r.push(n[o]);t=t.parent}return r.length>0?r:null},i.replace=function(t,e){for(;t&&t instanceof i;){var r=t[e];if(r)return r;t=t.parent}},i.prototype.assembleLayer=function(t){var e,r;e=t.getAttribute("queryable"),e&&(this._queryable="1"===e||"true"===e),e=t.getAttribute("opaque"),e&&(this._opaque="1"===e||"true"===e),e=t.getAttribute("noSubsets"),e&&(this._noSubsets="1"===e||"true"===e),e=t.getAttribute("cascaded"),e&&(this._cascaded=parseInt("10")),e=t.getAttribute("fixedWidth"),e&&(this._fixedWidth=parseInt("10")),(e=t.getAttribute("fixedHeight"))&&(this._fixedHeight=parseInt("10"));var n=t.children||t.childNodes;for(r=0;r<n.length;r++){var o=n[r];if("Layer"===o.localName)this.layers||(this.layers=[]),this.layers.push(new i(o,this));else if("Name"===o.localName)this.name=o.textContent;else if("Title"===o.localName)this.title=o.textContent;else if("Abstract"===o.localName)this.abstract=o.textContent;else if("KeywordList"===o.localName){this.keywordList=this.keywordList||[];for(var s=o.children||o.childNodes,a=0;a<s.length;a++){var l=s[a];"Keyword"===l.localName&&this.keywordList.push(l.textContent)}}else"Style"===o.localName?(this._styles||(this._styles=[]),this._styles.push(i.assembleStyle(o))):"CRS"===o.localName?(this._crses||(this._crses=[]),this._crses.push(o.textContent)):"SRS"===o.localName?(this._srses||(this._srses=[]),this._srses.push(o.textContent)):"EX_GeographicBoundingBox"===o.localName?this._geographicBoundingBox=i.assembleGeographicBoundingBox(o):"LatLonBoundingBox"===o.localName?this._geographicBoundingBox=i.assembleLatLonBoundingBox(o):"BoundingBox"===o.localName?(this._boundingBoxes||(this._boundingBoxes=[]),this._boundingBoxes.push(i.assembleBoundingBox(o))):"Dimension"===o.localName?(this._dimensions||(this._dimensions=[]),this._dimensions.push(i.assembleDimension(o))):"Extent"===o.localName?(this._extents||(this._extents=[]),this._extents.push(i.assembleDimension(o))):"Attribution"===o.localName?this._attribution=i.assembleAttribution(o):"AuthorityURL"===o.localName?(this._authorityUrls||(this._authorityUrls=[]),this._authorityUrls.push(i.assembleAuthorityUrl(o))):"Identifier"===o.localName?(this.identifiers||(this.identifiers=[]),this.identifiers.push(i.assembleIdentifier(o))):"MetadataURL"===o.localName?(this.metadataUrls||(this.metadataUrls=[]),this.metadataUrls.push(i.assembleMetadataUrl(o))):"DataURL"===o.localName?(this.dataUrls||(this.dataUrls=[]),this.dataUrls.push(i.assembleUrl(o))):"FeatureListURL"===o.localName?(this.featureListUrls||(this.featureListUrls=[]),this.featureListUrls.push(i.assembleUrl(o))):"MinScaleDenominator"===o.localName?this._minScaleDenominator=parseFloat(o.textContent):"MaxScaleDenominator"===o.localName?this._maxScaleDenominator=parseFloat(o.textContent):"ScaleHint"===o.localName&&(this._scaleHint={},this._scaleHint.min=i.getFloatAttribute(o,"min"),this._scaleHint.max=i.getFloatAttribute(o,"max"))}},i.assembleStyle=function(t){for(var e={},r=t.children||t.childNodes,n=0;n<r.length;n++){var o=r[n];"Name"===o.localName?e.name=o.textContent:"Title"===o.localName?e.title=o.textContent:"Abstract"===o.localName?e.abstract=o.textContent:"LegendURL"===o.localName?(e.legendUrls||(e.legendUrls=[]),e.legendUrls.push(i.assembleLegendUrl(o))):"StyleSheetURL"===o.localName?e.styleSheetUrl=i.assembleUrl(o):"StyleURL"===o.localName&&(e.styleUrl=i.assembleUrl(o))}return e},i.assembleGeographicBoundingBox=function(t){for(var e={},i=t.children||t.childNodes,r=0;r<i.length;r++){var n=i[r];"westBoundLongitude"===n.localName?e.westBoundLongitude=parseFloat(n.textContent):"eastBoundLongitude"===n.localName?e.eastBoundLongitude=parseFloat(n.textContent):"southBoundLatitude"===n.localName?e.southBoundLatitude=parseFloat(n.textContent):"northBoundLatitude"===n.localName&&(e.northBoundLatitude=parseFloat(n.textContent))}return e},i.assembleLatLonBoundingBox=function(t){var e={};return e.minx=i.getFloatAttribute(t,"minx"),e.miny=i.getFloatAttribute(t,"miny"),e.maxx=i.getFloatAttribute(t,"maxx"),e.maxy=i.getFloatAttribute(t,"maxy"),e},i.assembleBoundingBox=function(t){var e={};return e.crs=t.getAttribute("CRS"),e.minx=i.getFloatAttribute(t,"minx"),e.miny=i.getFloatAttribute(t,"miny"),e.maxx=i.getFloatAttribute(t,"maxx"),e.maxy=i.getFloatAttribute(t,"maxy"),e.resx=i.getFloatAttribute(t,"resx"),e.resy=i.getFloatAttribute(t,"resy"),e},i.assembleDimension=function(t){var e={};return e.name=t.getAttribute("name"),e.units=t.getAttribute("units"),e.unitSymbol=t.getAttribute("unitSymbol"),e.default=t.getAttribute("default"),e.multipleValues=t.getAttribute("multipleValues"),e.multipleValues&&(e.multipleValues="true"===e.multipleValues||"1"===e.multipleValues),e.nearestValue=t.getAttribute("nearestValue"),e.nearestValue&&(e.nearestValue="true"===e.nearestValue||"1"===e.nearestValue),e.current=t.getAttribute("current"),e.current&&(e.current="true"===e.current||"1"===e.current),e.content=t.textContent,e},i.assembleAttribution=function(t){for(var e={},r=t.children||t.childNodes,n=0;n<r.length;n++){var o=r[n];"Title"===o.localName?e.title=o.textContent:"OnlineResource"===o.localName?e.url=o.getAttribute("xlink:href"):"LogoUrul"===o.localName&&(e.logoUrl=i.assembleLogoUrl(o))}return e},i.assembleAuthorityUrl=function(t){var e={};e.name=t.getAttribute("name");for(var i=t.children||t.childNodes,r=0;r<i.length;r++){var n=i[r];"OnlineResource"===n.localName&&(e.url=n.getAttribute("xlink:href"))}return e},i.assembleIdentifier=function(t){var e={};return e.authority=t.getAttribute("authority"),e.content=t.textContent,e},i.assembleMetadataUrl=function(t){var e={};e.type=t.getAttribute("type");for(var i=t.children||t.childNodes,r=0;r<i.length;r++){var n=i[r];"Format"===n.localName?e.format=n.textContent:"OnlineResource"===n.localName&&(e.url=n.getAttribute("xlink:href"))}return e},i.assembleLegendUrl=function(t){var e={};e.width=i.getIntegerAttribute(t,"width"),e.height=i.getIntegerAttribute(t,"height");for(var r=t.children||t.childNodes,n=0;n<r.length;n++){var o=r[n];"Format"===o.localName?e.format=o.textContent:"OnlineResource"===o.localName&&(e.url=o.getAttribute("xlink:href"))}return e},i.assembleLogoUrl=function(t){var e={};e.width=i.getIntegerAttribute(t,"width"),e.height=i.getIntegerAttribute(t,"height");for(var r=t.children||t.childNodes,n=0;n<r.length;n++){var o=r[n];"Format"===o.localName?e.format=o.textContent:"OnlineResource"===o.localName&&(e.url=o.getAttribute("xlink:href"))}return e},i.assembleUrl=function(t){for(var e={},i=t.children||t.childNodes,r=0;r<i.length;r++){var n=i[r];"Format"===n.localName?e.format=n.textContent:"OnlineResource"===n.localName&&(e.url=n.getAttribute("xlink:href"))}return e},i.getIntegerAttribute=function(t,e){var i=t.getAttribute(e);return i=i?parseInt(i):void 0},i.getFloatAttribute=function(t,e){var i=t.getAttribute(e);return i=i?parseFloat(i):void 0},i}),i("ogc/wms/WmsCapabilities",["../../error/ArgumentError","../../util/Logger","../../ogc/wms/WmsLayerCapabilities"],function(t,e,i){"use strict";var r=function(i){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"WmsCapabilities","constructor","No XML DOM specified."));this.assembleDocument(i)};return r.prototype.getNamedLayers=function(){return this.accumulateNamedLayers(this.capability.layers)},r.prototype.accumulateNamedLayers=function(t,e){var i=e||[];if(!t)return i;for(var r=0,n=t.length;r<n;r++){var o=t[r];o.name&&i.push(o),o.layers&&this.accumulateNamedLayers(o.layers,i)}return i},r.prototype.getNamedLayer=function(i){if(!i||0===i.length)throw new t(e.logMessage(e.LEVEL_SEVERE,"WmsCapabilities","getNamedLayer","No WMS layer name provided."));for(var r=this.getNamedLayers(),n=0,o=r.length;n<o;n++)if(i===r[n].name)return r[n];return null},r.prototype.assembleDocument=function(t){var e=t.documentElement;this.version=e.getAttribute("version"),this.updateSequence=e.getAttribute("updateSequence");for(var i=e.children||e.childNodes,r=0;r<i.length;r++){var n=i[r];"Service"===n.localName?this.service=this.assembleService(n):"Capability"===n.localName&&(this.capability=this.assembleCapability(n))}},r.prototype.assembleService=function(t){for(var e={capsDoc:this},i=t.children||t.childNodes,r=0;r<i.length;r++){var n=i[r];"Name"===n.localName?e.name=n.textContent:"Title"===n.localName?e.title=n.textContent:"Abstract"===n.localName?e.abstract=n.textContent:"KeywordList"===n.localName?e.keywordList=this.assembleKeywordList(n):"OnlineResource"===n.localName?e.url=n.getAttribute("xlink:href"):"Fees"===n.localName?e.fees=n.textContent:"AccessConstraints"===n.localName?e.accessConstraints=n.textContent:"LayerLimit"==n.localName?e.layerLimit=parseInt(n.textContent):"MaxWidth"==n.localName?e.maxWidth=parseInt(n.textContent):"MaxHeight"==n.localName?e.maxHeight=parseInt(n.textContent):"ContactInformation"===n.localName&&(e.contactInformation=this.assembleContactInformation(n))}return e},r.prototype.assembleKeywordList=function(t){for(var e=[],i=t.children||t.childNodes,r=0;r<i.length;r++){var n=i[r];"Keyword"===n.localName&&e.push(n.textContent)}return e},r.prototype.assembleContactInformation=function(t){for(var e={},i=t.children||t.childNodes,r=0;r<i.length;r++){var n=i[r];"ContactPersonPrimary"===n.localName?e.contactPersonPrimary=this.assembleContactPersonPrimary(n):"ContactPosition"===n.localName?e.contactPosition=n.textContent:"ContactVoiceTelephone"===n.localName?e.contactVoiceTelephone=n.textContent:"ContactFacsimileTelephone"===n.localName?e.contactFacsimileTelephone=n.textContent:"ContactElectronicMailAddress"===n.localName?e.contactElectronicMailAddress=n.textContent:"ContactAddress"===n.localName&&(e.contactAddress=this.assembleContactAddress(n))}return e},r.prototype.assembleContactPersonPrimary=function(t){for(var e={},i=t.children||t.childNodes,r=0;r<i.length;r++){var n=i[r];"ContactPerson"===n.localName?e.contactPerson=n.textContent:"ContactOrganization"===n.localName&&(e.contactOrganization=n.textContent)}return e},r.prototype.assembleContactAddress=function(t){for(var e={},i=t.children||t.childNodes,r=0;r<i.length;r++){var n=i[r];"AddressType"===n.localName?e.addressType=n.textContent:"Address"===n.localName?e.address=n.textContent:"City"===n.localName?e.city=n.textContent:"StateOrProvince"===n.localName?e.stateOrProvince=n.textContent:"PostCode"===n.localName?e.postCode=n.textContent:"Country"===n.localName&&(e.country=n.textContent)}return e},r.prototype.assembleCapability=function(t){for(var e={capsDoc:this},r=t.children||t.childNodes,n=0;n<r.length;n++){var o=r[n];"Request"===o.localName?e.request=this.assembleRequests(o):"Exception"===o.localName?e.exception=this.assembleException(o):"Layer"===o.localName&&(e.layers=e.layers||[],e.layers.push(new i(o,e)))}return e},r.prototype.assembleRequests=function(t){for(var e={},i=t.children||t.childNodes,r=0;r<i.length;r++){var n=i[r];"GetCapabilities"===n.localName?e.getCapabilities=this.assembleRequest(n):"GetMap"===n.localName?e.getMap=this.assembleRequest(n):"GetFeatureInfo"===n.localName&&(e.getFeatureInfo=this.assembleRequest(n))}return e},r.prototype.assembleRequest=function(t){for(var e={name:t.localName},i=t.children||t.childNodes,r=0;r<i.length;r++){var n=i[r];if("Format"===n.localName)e.formats=e.formats||[],e.formats.push(n.textContent);else if("DCPType"===n.localName)for(var o=n.children||n.childNodes,s=0;s<o.length;s++){var a=o[s];if("HTTP"===a.localName)for(var l=a.children||a.childNodes,h=0;h<l.length;h++){var u=l[h];if("Get"===u.localName)for(var c=u.children||u.childNodes,d=0;d<c.length;d++){var p=c[d];"OnlineResource"===p.localName&&(e.getUrl=p.getAttribute("xlink:href"))}}}}return e},r.prototype.assembleException=function(t){for(var e={},i=t.children||t.childNodes,r=0;r<i.length;r++){var n=i[r];"Format"===n.localName&&(e.formats=e.formats||[],e.formats.push(n.textContent))}return e},r}),i("layer/WmsLayer",["../error/ArgumentError","../geom/Location","../util/Logger","../util/PeriodicTimeSequence","../geom/Sector","../layer/TiledImageLayer","../util/WmsUrlBuilder"],function(t,e,i,r,n,o,s){"use strict";var a=function(e,r){if(!e)throw new t(i.logMessage(i.LEVEL_SEVERE,"WmsLayer","constructor","No configuration specified."));var n=e.service+e.layerNames+e.styleNames;r&&(n+=r),o.call(this,e.sector,e.levelZeroDelta,e.numLevels,e.format,n,e.size,e.size),this.displayName=e.title,this.pickEnabled=!1,this.urlBuilder=new s(e.service,e.layerNames,e.styleNames,e.version,r),e.coordinateSystem&&(this.urlBuilder.crs=e.coordinateSystem),this.timeString=r};return a.prototype=Object.create(o.prototype),a.formLayerConfiguration=function(t){var i={title:t.title,version:t.capability.capsDoc.version},r=t.geographicBoundingBox||t.latLonBoundingBox;r&&r.westBoundLongitude?i.sector=new n(r.southBoundLatitude,r.northBoundLatitude,r.westBoundLongitude,r.eastBoundLongitude):r&&r.minx?i.sector=new n(r.miny,r.maxy,r.minx,r.maxx):i.sector=n.FULL_SPHERE,i.levelZeroDelta=new e(36,36),i.numLevels=19,i.size=256,i.layerNames=t.name;var o=t.capability.request.getMap,s=o.formats;s.indexOf("image/png")>=0?i.format="image/png":s.indexOf("image/jpeg")>=0?i.format="image/jpeg":s.indexOf("image/tiff")>=0?i.format="image/tiff":s.indexOf("image/gif")>=0&&(i.format="image/gif"),i.service=o.getUrl;var l=t.crses;l||(l=t.srses),l&&(l.indexOf("EPSG:4326")>=0||l.indexOf("epsg:4326")>=0?i.coordinateSystem="EPSG:4326":(l.indexOf("CRS84")>=0||l.indexOf("CRS:84")>=0)&&(i.coordinateSystem="CRS:84"));var h=a.parseTimeDimensions(t);return h&&h.length>0&&(i.timeSequences=h),i},a.parseTimeDimensions=function(t){var e=t.extents||t.dimensions,i=null;if(e){i=[];for(var n=0;n<e.length;n++){var o=e[n];if("time"===o.name.toLowerCase()&&(!o.units||"iso8601"===o.units.toLowerCase()))for(var s=o.content.split(","),a=0;a<s.length;a++){var l=s[a],h=l.split("/");1===h.length?i.push(new Date(l)):3===h.length&&i.push(new r(l))}}}return i},a}),i("layer/WmsTimeDimensionedLayer",["../error/ArgumentError","../layer/Layer","../util/Logger","../layer/WmsLayer"],function(t,e,i,r){"use strict";var n=function(r){if(!r)throw new t(i.logMessage(i.LEVEL_SEVERE,"WmsTimeDimensionedLayer","constructor","No configuration specified."));e.call(this,"WMS Time Dimensioned Layer"),this.config=r,this.displayName=r.title,this.pickEnabled=!1,this.layers={}};return n.prototype=Object.create(e.prototype),n.prototype.doRender=function(t){if(this.time){var e=this.time.toISOString(),i=this.layers[e];i||(i=new r(this.config,e),this.layers[e]=i),i.opacity=this.opacity,i.doRender(t),this.inCurrentFrame=i.inCurrentFrame}},n}),i("ogc/wmts/WmtsLayerCapabilities",["../../error/ArgumentError","../../geom/Sector","../../ogc/wmts/OwsDescription","../../util/Logger"],function(t,e,i,r){"use strict";var n=function(e,n){if(!e)throw new t(r.logMessage(r.LEVEL_SEVERE,"WmtsLayerCapabilities","constructor","missingDomElement"));i.call(this,e),this.capabilities=n,this.identifier,this.title,this.abstract,this.keywords,this.wgs84BoundingBox,this.boundingBox,this.styles,this.formats,this.infoFormat,this.dimension,this.metadata,this.tileMatrixSetLink,this.resourceUrl,this.assembleLayer(e)};return n.prototype=Object.create(i.prototype),n.prototype.getLayerSupportedTileMatrixSets=function(){for(var t=[],e=0,i=this.tileMatrixSetLink.length;e<i;e++)for(var r=this.tileMatrixSetLink[e].tileMatrixSet,n=0,o=this.capabilities.contents.tileMatrixSet.length;n<o;n++){var s=this.capabilities.contents.tileMatrixSet[n].identifier;s===r&&t.push(this.capabilities.contents.tileMatrixSet[n])}return t},n.prototype.assembleLayer=function(t){for(var e=t.children||t.childNodes,i=0;i<e.length;i++){var r=e[i];"Identifier"===r.localName?this.identifier=r.textContent:"WGS84BoundingBox"===r.localName?this.wgs84BoundingBox=n.assembleBoundingBox(r):"BoundingBox"===r.localName?(this.boundingBox=this.boundingBox||[],this.boundingBox.push(n.assembleBoundingBox(r))):"Style"===r.localName?(this.style=this.style||[],this.style.push(n.assembleStyle(r))):"Format"===r.localName?(this.format=this.format||[],this.format.push(r.textContent)):"InfoFormat"===r.localName?(this.infoFormat=this.infoFormat||[],this.infoFormat.push(r.textContent)):"Dimension"===r.localName?(this.dimension=this.dimension||[],this.dimension.push(n.assembleDimension(r))):"Metadata"===r.localName?(this.metadata=this.metadata||[],this.metadata.push(n.assembleMetadata(r))):"ResourceURL"===r.localName?(this.resourceUrl=this.resourceUrl||[],this.resourceUrl.push(n.assembleResourceUrl(r))):"TileMatrixSetLink"===r.localName&&(this.tileMatrixSetLink=this.tileMatrixSetLink||[],this.tileMatrixSetLink.push(n.assembleTileMatrixSetLink(r)))}},n.assembleStyle=function(t){var e=new i(t);e.isDefault=t.getAttribute("isDefault");for(var r=t.children||t.childNodes,o=0;o<r.length;o++){var s=r[o];"Identifier"===s.localName?e.identifier=s.textContent:"LegendURL"===s.localName&&(e.legendUrl=e.legendUrl||[],e.legendUrl.push(n.assembleLegendUrl(s)))}return e},n.assembleBoundingBox=function(t){var i={},r=t.getAttribute("crs");r&&(i.crs=r);for(var n=t.children||t.childNodes,o=0;o<n.length;o++){var s=n[o];if("LowerCorner"===s.localName){var a=s.textContent.split(" ");i.lowerCorner=[parseFloat(a[0]),parseFloat(a[1])]}else if("UpperCorner"===s.localName){var l=s.textContent.split(" ");i.upperCorner=[parseFloat(l[0]),parseFloat(l[1])]}}return"WGS84BoundingBox"===t.localName&&(i.getSector=function(){return new e(i.lowerCorner[1],i.upperCorner[1],i.lowerCorner[0],i.upperCorner[0])}),i},n.assembleDimension=function(t){for(var e=new i(t),r=t.children||t.childNodes,n=0;n<r.length;n++){var o=r[n];"Identifier"===o.localName?e.identifier=o.textContent:"UOM"===o.localName?e.uom={name:o.getAttribute("name"),reference:o.getAttribute("reference")}:"UnitSymbol"==o.localName?e.unitSymbol=o.textContent:"Default"===o.localName?e.default=o.textContent:"Current"===o.localName?e.current="true"===o.textContent:"Value"===o.localName&&(e.value=e.value||[],e.value.push(o.textContent))}return e},n.assembleMetadata=function(t){var e={},i=t.getAttribute("xlink:href");i&&(e.url=i);var r=t.getAttribute("about");i&&(e.about=r);var n=t.getAttribute("xlink:type");n&&(e.type=n);var o=t.getAttribute("xlink:role");o&&(e.role=o);var s=t.getAttribute("xlink:title");s&&(e.title=s);for(var a=t.children||t.childNodes,l=0;l<a.length;l++){var h=a[l];"Metadata"===h.localName&&(e.metadata=WmsLayerCapabilities.assembleMetadata(h))}return e},n.assembleResourceUrl=function(t){var e={};return e.format=t.getAttribute("format"),e.resourceType=t.getAttribute("resourceType"),e.template=t.getAttribute("template"),e},n.assembleLegendUrl=function(t){var e={};return e.format=t.getAttribute("format"),e.minScaleDenominator=t.getAttribute("minScaleDenominator"),e.maxScaleDenominator=t.getAttribute("maxScaleDenominator"),e.href=t.getAttribute("xlink:href"),e.width=t.getAttribute("width"),e.height=t.getAttribute("height"),e},n.assembleTileMatrixSetLink=function(t){for(var e={},i=t.children||t.childNodes,r=0;r<i.length;r++){var o=i[r];"TileMatrixSet"===o.localName?e.tileMatrixSet=o.textContent:"TileMatrixSetLimits"===o.localName&&(e.tileMatrixSetLimits=n.assembleTileMatrixSetLimits(o))}return e},n.assembleTileMatrixSetLimits=function(t){for(var e={},i=t.children||t.childNodes,r=0;r<i.length;r++){var o=i[r];"TileMatrixLimits"===o.localName&&(e.tileMatrixLimits=e.tileMatrixLimits||[],e.tileMatrixLimits.push(n.assembleTileMatrixLimits(o)))}return e},n.assembleTileMatrixLimits=function(t){for(var e={},i=t.children||t.childNodes,r=0;r<i.length;r++){var n=i[r];"TileMatrix"===n.localName?e.tileMatrix=n.textContent:"MinTileRow"===n.localName?e.minTileRow=parseInt(n.textContent):"MaxTileRow"===n.localName?e.maxTileRow=parseInt(n.textContent):"MinTileCol"===n.localName?e.minTileCol=parseInt(n.textContent):"maxTileCol"===n.localName&&(e.maxTileCol=parseInt(n.textContent))}return e},n}),i("ogc/wmts/WmtsCapabilities",["../../error/ArgumentError","../../util/Logger","../../ogc/wmts/OwsDescription","../../ogc/wmts/OwsLanguageString","../../ogc/wmts/OwsOperationsMetadata","../../ogc/wmts/OwsServiceIdentification","../../ogc/wmts/OwsServiceProvider","../../ogc/wms/WmsCapabilities","../../ogc/wmts/WmtsLayerCapabilities"],function(t,e,i,r,n,o,s,a,l){"use strict";var h=function(i){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"WmtsCapabilities","constructor","No XML DOM specified."));this.assembleDocument(i)};return h.prototype.getLayers=function(){return this.contents.layer},h.prototype.getLayer=function(i){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"WmtsCapabilities","getLayer","empty identifier"));for(var r=0,n=this.contents.layer.length;r<n;r++){var o=this.contents.layer[r];if(o.identifier===i)return o}return null},h.prototype.assembleDocument=function(t){var e=t.documentElement;this.version=e.getAttribute("version"),this.updateSequence=e.getAttribute("updateSequence");for(var i=e.children||e.childNodes,r=0;r<i.length;r++){var a=i[r];"ServiceIdentification"===a.localName?this.serviceIdentification=new o(a):"ServiceProvider"===a.localName?this.serviceProvider=new s(a):"OperationsMetadata"===a.localName?this.operationsMetadata=new n(a):"Contents"===a.localName?this.contents=this.assembleContents(a):"Themes"===a.localName?this.themes=h.assembleThemes(a):"ServiceMetadataURL"===a.localName&&(this.serviceMetadataUrls=this.serviceMetadataUrls||[],this.serviceMetadataUrls.push(h.assembleServiceMetadataURL(a)))}},h.prototype.assembleContents=function(t){for(var i={},r=t.children||t.childNodes,n=0;n<r.length;n++){var o=r[n];if("Layer"===o.localName){i.layer=i.layer||[];try{i.layer.push(new l(o,this))}catch(t){e.logMessage(e.LEVEL_SEVERE,"WmtsCapabilities","constructor","Exception reading WMTS layer description: "+t.message)}}else if("TileMatrixSet"===o.localName){i.tileMatrixSet=i.tileMatrixSet||[];try{i.tileMatrixSet.push(h.assembleTileMatrixSet(o))}catch(t){e.logMessage(e.LEVEL_SEVERE,"WmtsCapabilities","constructor","Exception reading WMTS tile matrix set description: "+t.message)}}}return i},h.assembleTileMatrixSet=function(t){for(var e=new i(t),r=t.children||t.childNodes,n=0;n<r.length;n++){var o=r[n];"Identifier"===o.localName?e.identifier=o.textContent:"SupportedCRS"===o.localName?e.supportedCRS=o.textContent:"WellKnownScaleSet"===o.localName?e.wellKnownScaleSet=o.textContent:"BoundingBox"===o.localName?e.boundingBox=l.assembleBoundingBox(o):"TileMatrix"===o.localName&&(e.tileMatrix=e.tileMatrix||[],e.tileMatrix.push(h.assembleTileMatrix(o)))}h.sortTileMatrices(e);for(var s=0;s<e.tileMatrix.length;s++)e.tileMatrix[s].levelNumber=s;return e},h.assembleTileMatrix=function(t){for(var e=new i(t),r=t.children||t.childNodes,n=0;n<r.length;n++){var o=r[n];if("Identifier"===o.localName)e.identifier=o.textContent;else if("ScaleDenominator"===o.localName)e.scaleDenominator=parseFloat(o.textContent);else if("TileWidth"===o.localName)e.tileWidth=parseFloat(o.textContent);else if("TileHeight"===o.localName)e.tileHeight=parseFloat(o.textContent);else if("MatrixWidth"===o.localName)e.matrixWidth=parseFloat(o.textContent);else if("MatrixHeight"===o.localName)e.matrixHeight=parseFloat(o.textContent);else if("TopLeftCorner"===o.localName){var s=o.textContent.split(" ");e.topLeftCorner=[parseFloat(s[0]),parseFloat(s[1])]}}return e},h.assembleThemes=function(t){for(var e,i=t.children||t.childNodes,r=0;r<i.length;r++){var n=i[r];"Theme"===n.localName&&(e=e||[],e.push(h.assembleTheme(n)))}return e},h.assembleTheme=function(t){for(var e=new i(t),r=t.children||t.childNodes,n=0;n<r.length;n++){var o=r[n];"Identifier"===o.localName?e.identifier=o.textContent:"LayerRef"===o.localName?(e.layerRef=e.layerRef||[],e.layerRef.push(o.textContent)):"Theme"===o.localName&&(e.themes=e.themes||[],e.themes.push(h.assembleTheme(o)))}return e},h.assembleServiceMetadataURL=function(t){var e={},i=t.getAttribute("xlink:href");return i&&(e.url=i),e},h.sortTileMatrices=function(t){t.tileMatrix.sort(function(t,e){return e.scaleDenominator-t.scaleDenominator})},h.prototype.getGetTileKvpAddress=function(){for(var t=0;t<this.operationsMetadata.operation.length;t++){var e=this.operationsMetadata.operation[t];if("GetTile"===e.name)return e.dcp[0].getMethods[0].url}return null},h}),i("layer/WmtsLayerTile",["../geom/Angle","../error/ArgumentError","../geom/BoundingBox","../util/Logger","../geom/Vec3","../util/WWUtil"],function(t,e,i,r,n,o){"use strict";var s=function(e,i,r,n,o){this.sector=e,this.tileMatrix=i,this.row=r,this.column=n,this.imagePath=o,this.texelSize=e.deltaLatitude()*t.DEGREES_TO_RADIANS/i.tileHeight,this.tileKey=i.levelNumber.toString()+"."+r.toString()+"."+n.toString(),this.gpuCacheKey=o};return s.prototype.isEqual=function(t){return!!t&&(!!t.tileKey&&this.tileKey==t.tileKey)},s.prototype.distanceTo=function(t){if(!t)throw new e(r.logMessage(r.LEVEL_SEVERE,"Tile","distanceTo","missingVector"));for(var i,n,o,s=t[0],a=t[1],l=t[2],h=this.samplePoints,u=Number.POSITIVE_INFINITY,c=0,d=h.length;c<d;c+=3)i=s-h[c],n=a-h[c+1],o=l-h[c+2],u=Math.min(u,i*i+n*n+o*o);return Math.sqrt(u)},s.prototype.subdivide=function(t,i){if(!t)throw new e(r.logMessage(r.LEVEL_SEVERE,"WmtsLayerTile","subdivide","The specified tile matrix is null or undefined."));if(!i)throw new e(r.logMessage(r.LEVEL_SEVERE,"WmtsLayerTile","subdivide","The specified tile factory is null or undefined."));for(var n,o,s=[],a=t.matrixHeight/this.tileMatrix.matrixHeight,l=t.matrixWidth/this.tileMatrix.matrixWidth,h=0;h<a;h++)for(var u=0;u<l;u++)n=a*this.row+h,o=l*this.column+u,s.push(i.createTile(t,n,o));return s},s.prototype.subdivideToCache=function(t,i,n){if(!t)throw new e(r.logMessage(r.LEVEL_SEVERE,"Tile","subdivideToCache","The specified tile matrix is null or undefined."));if(!i)throw new e(r.logMessage(r.LEVEL_SEVERE,"Tile","subdivideToCache","The specified tile factory is null or undefined."));var o=n?n.entryForKey(this.tileKey):null;return o||(o=this.subdivide(t,i))&&n&&n.putEntry(this.tileKey,o,o.length),o},s.prototype.mustSubdivide=function(t,e){var i=t.globe.equatorialRadius*this.texelSize,r=this.distanceTo(t.navigatorState.eyePoint),n=t.navigatorState.pixelSizeAtDistance(r);return i>Math.max(e*n,.5)},s.prototype.update=function(t){var e=t.globe.elevationTimestamp(),i=t.verticalExaggeration,r=t.globeStateKey;this.updateTimestamp==e&&this.updateVerticalExaggeration==i&&this.updateGlobeStateKey==r||(this.doUpdate(t),t.frameStatistics.incrementTileUpdateCount(1),this.updateTimestamp=e,this.updateVerticalExaggeration=i,this.updateGlobeStateKey=r)},s.prototype.doUpdate=function(t){var e=t.globe,r=t.verticalExaggeration,s=e.minAndMaxElevationsForSector(this.sector),a=s?s[0]*r:0,l=s?s[1]*r:0;a==l&&(a=l+10),this.extent||(this.extent=new i),
this.extent.setToSector(this.sector,e,a,l),this.samplePoints||(this.sampleElevations=new Float64Array(9),this.samplePoints=new Float64Array(3*this.sampleElevations.length)),o.fillArray(this.sampleElevations,.5*(a+l)),e.computePointsForGrid(this.sector,3,3,this.sampleElevations,n.ZERO,this.samplePoints),this.referencePoint||(this.referencePoint=new n(0,0,0)),e.computePointFromPosition(this.sector.centroidLatitude(),this.sector.centroidLongitude(),0,this.referencePoint)},s.prototype.bind=function(t){var e=t.gpuResourceCache.resourceForKey(this.gpuCacheKey);return!(!e||!e.bind(t))||!!this.fallbackTile&&this.fallbackTile.bind(t)},s.prototype.applyInternalTransform=function(t,e){},s}),i("layer/WmtsLayer",["../util/AbsentResourceList","../error/ArgumentError","../util/Logger","../geom/Sector","../layer/Layer","../cache/MemoryCache","../render/Texture","../util/WmsUrlBuilder","../layer/WmtsLayerTile","../util/WWMath","../util/WWUtil"],function(t,e,i,r,n,o,s,a,l,h,u){"use strict";var c=function(s,a){if(!s)throw new e(i.logMessage(i.LEVEL_SEVERE,"WmtsLayer","constructor","No layer configuration specified."));if(n.call(this,"WMTS Layer"),this.layerIdentifier=s.identifier,this.styleIdentifier=s.style,this.timeString=a,this.imageFormat=s.format,this.resourceUrl=s.resourceUrl,this.serviceUrl=s.service,this.tileMatrixSet=s.tileMatrixSet,s.wgs84BoundingBox||s.boundingBox){if(s.wgs84BoundingBox)this.sector=s.wgs84BoundingBox.getSector();else if(this.tileMatrixSet.boundingBox&&c.isEpsg4326Crs(this.tileMatrixSet.boundingBox.crs))this.sector=new r(this.tileMatrixSet.boundingBox.lowerCorner[1],this.tileMatrixSet.boundingBox.upperCorner[1],this.tileMatrixSet.boundingBox.lowerCorner[0],this.tileMatrixSet.boundingBox.upperCorner[0]);else if(c.isEpsg4326Crs(this.tileMatrixSet.supportedCRS))throw new e(i.logMessage(i.LEVEL_SEVERE,"WmtsLayer","constructor","No EPSG:4326 bounding box was specified in the layer or tile matrix set capabilities."))}else{if(!this.tileMatrixSet.boundingBox)throw new e(i.logMessage(i.LEVEL_SEVERE,"WmtsLayer","constructor","No bounding box was specified in the layer or tile matrix set capabilities."));this.sector=new r(s.tileMatrixSet.boundingBox.lowerCorner[1],s.tileMatrixSet.boundingBox.upperCorner[1],s.tileMatrixSet.boundingBox.lowerCorner[0],s.tileMatrixSet.boundingBox.upperCorner[0])}var l,h=s.tileMatrixSet.tileMatrix,u=[],d=[];h.forEach(function(t){u.push(t.matrixWidth),d.push(t.matrixHeight)}),0!==c.checkTileSubdivision(u)?(l=c.checkTileSubdivision(u),i.logMessage(i.LEVEL_SEVERE,"WmtsLayer","constructor","Tile subdivision not supported for layer : "+s.identifier+". Display until level "+(l-1)),h.splice(l)):0!==c.checkTileSubdivision(d)&&(l=c.checkTileSubdivision(d),i.logMessage(i.LEVEL_SEVERE,"WmtsLayer","constructor","Tile subdivision not supported for layer : "+s.identifier+". Display until level "+(l-1)),h.splice(l)),this.cachePath=(this.resourceUrl||this.serviceUrl)+this.layerIdentifier+this.styleIdentifier+this.tileMatrixSet.identifier,a&&(this.cachePath=this.cachePath+a),this.displayName=s.title,this.currentTiles=[],this.currentTilesInvalid=!0,this.tileCache=new o(500,400),this.currentRetrievals=[],this.absentResourceList=new t(3,5e4),this.pickEnabled=!1,this.detailControl=1.75};return c.checkTileSubdivision=function(t){if(t.length<1)throw new e(i.logMessage(i.LEVEL_SEVERE,"WmtsLayer","checkTileSubdivision","Empty dimension array"));for(var r,n=0,o=0;++o<t.length&&0==n;){var s=t[o]/t[o-1];t[o]%t[o-1]!=0?n=o:r&&r!==s&&(n=o),r=s}return n},c.createTileMatrixSet=function(t){if(!t.matrixSet)throw new e(i.logMessage(i.LEVEL_SEVERE,"WmtsLayer","createTileMatrixSet","No matrixSet provided."));if(!t.projection)throw new e(i.logMessage(i.LEVEL_SEVERE,"WmtsLayer","createTileMatrixSet","No projection provided."));if(!t.extent||4!=t.extent.length)throw new e(i.logMessage(i.LEVEL_SEVERE,"WmtsLayer","createTileMatrixSet","No extent provided."));var r={lowerCorner:[t.extent[0],t.extent[1]],upperCorner:[t.extent[2],t.extent[3]]};if(!t.resolutions)throw new e(i.logMessage(i.LEVEL_SEVERE,"WmtsLayer","createTileMatrixSet","No resolutions provided."));if(!t.tileSize)throw new e(i.logMessage(i.LEVEL_SEVERE,"WmtsLayer","createTileMatrixSet","No tile size provided."));if(!t.topLeftCorner||2!=t.topLeftCorner.length)throw new e(i.logMessage(i.LEVEL_SEVERE,"WmtsLayer","createTileMatrixSet","No extent provided."));if(void 0===t.prefix)throw new e(i.logMessage(i.LEVEL_SEVERE,"WmtsLayer","createTileMatrixSet","Prefix not provided."));if(!(c.isEpsg4326Crs(t.projection)||c.isOGCCrs84(t.projection)||c.isEpsg3857Crs(t.projection)))throw new e(i.logMessage(i.LEVEL_SEVERE,"WmtsLayer","createTileMatrixSet","Projection provided not supported."));for(var n,o=[],s=0;s<t.resolutions.length;s++){c.isEpsg4326Crs(t.projection)||c.isOGCCrs84(t.projection)?n=6378137*t.resolutions[s]*2*Math.PI/360/28e-5:c.isEpsg3857Crs(t.projection)&&(n=t.resolutions[s]/28e-5);var a=t.tileSize*t.resolutions[s],l=t.tileSize*t.resolutions[s],h=Math.ceil((t.extent[2]-t.extent[0]-.01*a)/a),u=Math.ceil((t.extent[3]-t.extent[1]-.01*l)/l),d={identifier:t.prefix?t.matrixSet+":"+s:s,levelNumber:s,matrixHeight:u,matrixWidth:h,tileHeight:t.tileSize,tileWidth:t.tileSize,topLeftCorner:t.topLeftCorner,scaleDenominator:n};o.push(d)}return{identifier:t.matrixSet,supportedCRS:t.projection,boundingBox:r,tileMatrix:o}},c.formLayerConfiguration=function(t,r,n,o){var s={};if(s.identifier=t.identifier,o){for(var l=!1,h=0;h<t.format.length;h++)if(t.format[h]===o){l=!0,s.format=t.format[h];break}l||(i.logMessage(i.LEVEL_WARNING,"WmtsLayer","formLayerConfiguration","The specified image format is not available. Another one will be used."),s.format=null)}if(s.format||(t.format.indexOf("image/png")>=0?s.format="image/png":t.format.indexOf("image/jpeg")>=0?s.format="image/jpeg":t.format.indexOf("image/tiff")>=0?s.format="image/tiff":t.format.indexOf("image/gif")>=0?s.format="image/gif":s.format=t.format[0]),!s.format)throw new e(i.logMessage(i.LEVEL_SEVERE,"WmtsLayer","formLayerConfiguration","Layer does not provide a supported image format."));if(t.resourceUrl&&t.resourceUrl.length>=1){for(var h=0;h<t.resourceUrl.length;h++)if(s.format===t.resourceUrl[h].format){s.resourceUrl=t.resourceUrl[h].template;break}}else s.service=t.capabilities.getGetTileKvpAddress(),s.service&&(s.service=a.fixGetMapString(s.service));if(!s.resourceUrl&&!s.service)throw new e(i.logMessage(i.LEVEL_SEVERE,"WmtsLayer","formLayerConfiguration","No resource URL or KVP GetTile service URL specified in WMTS capabilities."));if(r){for(var u=!1,h=0;h<t.style.length;h++)if(t.style[h].identifier===r){u=!0,s.style=t.style[h].identifier;break}u||(i.logMessage(i.LEVEL_WARNING,"WmtsLayer","formLayerConfiguration","The specified style identifier is not available. The server's default style will be used."),s.style=null)}if(!s.style)for(h=0;h<t.style.length;h++)if(t.style[h].isDefault){s.style=t.style[h].identifier;break}s.style||i.logMessage(i.LEVEL_WARNING,"WmtsLayer","formLayerConfiguration","No default style available. A style will not be specified in tile requests.");var d=t.getLayerSupportedTileMatrixSets();if(n){for(var p=!1,h=0,f=d.length;h<f;h++)if(d[h].identifier===n){p=!0,s.tileMatrixSet=d[h];break}p||(i.logMessage(i.LEVEL_WARNING,"WmtsLayer","formLayerConfiguration","The specified tileMatrixSet is not available. Another one will be used."),s.tileMatrixSet=null)}if(!s.tileMatrixSet){for(var g,m=null,E=null,y=null,h=0,f=d.length;h<f;h++)g=d[h],c.isEpsg4326Crs(g.supportedCRS)?m=m||g:c.isEpsg3857Crs(g.supportedCRS)?E=E||g:c.isOGCCrs84(g.supportedCRS)&&(y=y||g);s.tileMatrixSet=m||E||y}if(!s.tileMatrixSet)throw new e(i.logMessage(i.LEVEL_SEVERE,"WmtsLayer","formLayerConfiguration","No supported Tile Matrix Set could be found."));return s.boundingBox=t.boundingBox,s.wgs84BoundingBox=t.wgs84BoundingBox,t.titles.length>0?s.title=t.titles[0].value:s.title=t.identifier,s},c.prototype=Object.create(n.prototype),c.prototype.doRender=function(t){t.terrain&&(!this.currentTilesInvalid&&this.lasTtMVP&&t.navigatorState.modelviewProjection.equals(this.lasTtMVP)&&t.globeStateKey==this.lastGlobeStateKey||(this.currentTilesInvalid=!1,this.assembleTiles(t)),this.lasTtMVP=t.navigatorState.modelviewProjection,this.lastGlobeStateKey=t.globeStateKey,this.currentTiles.length>0&&(t.surfaceTileRenderer.renderTiles(t,this.currentTiles,this.opacity),t.frameStatistics.incrementImageTileCount(this.currentTiles.length),this.inCurrentFrame=!0))},c.prototype.isLayerInView=function(t){return t.terrain&&t.terrain.sector&&t.terrain.sector.intersects(this.sector)},c.prototype.isTileVisible=function(t,e){return!(t.globe.projectionLimits&&!e.sector.overlaps(t.globe.projectionLimits))&&e.extent.intersectsFrustum(t.navigatorState.frustumInModelCoordinates)},c.prototype.assembleTiles=function(t){this.currentTiles=[],this.topLevelTiles&&0!==this.topLevelTiles.length||this.createTopLevelTiles(t);for(var e=0,i=this.topLevelTiles.length;e<i;e++){var r=this.topLevelTiles[e];r.update(t),this.currentAncestorTile=null,this.isTileVisible(t,r)&&this.addTileOrDescendants(t,r)}},c.prototype.addTileOrDescendants=function(t,e){if(e.column>=e.tileMatrix.matrixWidth&&(e.column=e.column-e.tileMatrix.matrixWidth),e.column<0&&(e.column=e.column+e.tileMatrix.matrixWidth),this.tileMeetsRenderingCriteria(t,e))return void this.addTile(t,e);var i=null;try{(this.isTileTextureInMemory(t,e)||0===e.tileMatrix.levelNumber)&&(i=this.currentAncestorTile,this.currentAncestorTile=e);for(var r=this.tileMatrixSet.tileMatrix[e.tileMatrix.levelNumber+1],n=e.subdivideToCache(r,this,this.tileCache),o=0,s=n.length;o<s;o++){var a=n[o];a.update(t),this.sector.intersects(a.sector)&&this.isTileVisible(t,a)&&this.addTileOrDescendants(t,a)}}finally{i&&(this.currentAncestorTile=i)}},c.prototype.addTile=function(t,e){e.fallbackTile=null;var i=t.gpuResourceCache.resourceForKey(e.imagePath);if(i)return this.currentTiles.push(e),void(this.expiration&&this.isTextureExpired(i)&&this.retrieveTileImage(t,e));this.retrieveTileImage(t,e),this.currentAncestorTile&&this.isTileTextureInMemory(t,this.currentAncestorTile)&&this.currentTiles.push(this.currentAncestorTile)},c.prototype.isTextureExpired=function(t){return this.expiration&&t.creationTime.getTime()<=this.expiration.getTime()},c.prototype.isTileTextureInMemory=function(t,e){return t.gpuResourceCache.containsResource(e.imagePath)},c.prototype.tileMeetsRenderingCriteria=function(t,e){var i=this.detailControl;return(e.sector.minLatitude>=75||e.sector.maxLatitude<=-75)&&(i*=1.2),e.tileMatrix.levelNumber===this.tileMatrixSet.tileMatrix.length-1||!e.mustSubdivide(t,i)},c.prototype.retrieveTileImage=function(t,e){if(this.currentRetrievals.indexOf(e.imagePath)<0){if(this.absentResourceList.isResourceAbsent(e.imagePath))return;var r=this.resourceUrlForTile(e,this.imageFormat),n=new Image,o=e.imagePath,s=t.gpuResourceCache,a=t.currentGlContext.canvas,l=this;if(!r)return void(this.currentTilesInvalid=!0);n.onload=function(){i.log(i.LEVEL_INFO,"Image retrieval succeeded: "+r);var h=l.createTexture(t,e,n);if(l.removeFromCurrentRetrievals(o),h){s.putResource(o,h,h.size),l.currentTilesInvalid=!0,l.absentResourceList.unmarkResourceAbsent(o);var u=document.createEvent("Event");u.initEvent(WorldWind.REDRAW_EVENT_TYPE,!0,!0),a.dispatchEvent(u)}},n.onerror=function(){l.removeFromCurrentRetrievals(o),l.absentResourceList.markResourceAbsent(o),i.log(i.LEVEL_WARNING,"Image retrieval failed: "+r)},this.currentRetrievals.push(o),n.crossOrigin="anonymous",n.src=r}},c.prototype.resourceUrlForTile=function(t,e){var i;return this.resourceUrl?(i=this.resourceUrl.replace("{Style}",this.styleIdentifier).replace("{TileMatrixSet}",this.tileMatrixSet.identifier).replace("{TileMatrix}",t.tileMatrix.identifier).replace("{TileCol}",t.column).replace("{TileRow}",t.row),this.timeString&&(i=i.replace("{Time}",this.timeString))):(i=this.serviceUrl+"service=WMTS&request=GetTile&version=1.0.0",i+="&Layer="+this.layerIdentifier,this.styleIdentifier&&(i+="&Style="+this.styleIdentifier),i+="&Format="+e,this.timeString&&(i+="&Time="+this.timeString),i+="&TileMatrixSet="+this.tileMatrixSet.identifier,i+="&TileMatrix="+t.tileMatrix.identifier,i+="&TileRow="+t.row,i+="&TileCol="+t.column),i},c.prototype.removeFromCurrentRetrievals=function(t){var e=this.currentRetrievals.indexOf(t);e>-1&&this.currentRetrievals.splice(e,1)},c.prototype.createTopLevelTiles=function(t){var e=this.tileMatrixSet.tileMatrix[0];this.topLevelTiles=[];for(var i=0;i<e.matrixHeight;i++)for(var r=0;r<e.matrixWidth;r++)this.topLevelTiles.push(this.createTile(e,i,r))},c.prototype.createTile=function(t,e,i){return c.isEpsg4326Crs(this.tileMatrixSet.supportedCRS)?this.createTile4326(t,e,i):c.isEpsg3857Crs(this.tileMatrixSet.supportedCRS)?this.createTile3857(t,e,i):c.isOGCCrs84(this.tileMatrixSet.supportedCRS)?this.createTileCrs84(t,e,i):void 0},c.prototype.createTileCrs84=function(t,e,i){var n=this.sector.deltaLatitude()/t.matrixHeight,o=this.sector.deltaLongitude()/t.matrixWidth,s=t.topLeftCorner[1]-e*n,a=s-n,l=t.topLeftCorner[0]+o*i,h=l+o,u=new r(a,s,l,h);return this.makeTile(u,t,e,i)},c.prototype.createTile4326=function(t,e,i){var n=this.sector.deltaLatitude()/t.matrixHeight,o=this.sector.deltaLongitude()/t.matrixWidth,s=t.topLeftCorner[0]-e*n,a=s-n,l=t.topLeftCorner[1]+o*i,h=l+o,u=new r(a,s,l,h);return this.makeTile(u,t,e,i)},c.prototype.createTile3857=function(t,e,i){t.mapWidth||this.computeTileMatrixValues3857(t);var n,o,s,a,l,u,c=h.clamp(i*t.tileWidth-.5,0,t.mapWidth),d=h.clamp(e*t.tileHeight-.5,0,t.mapHeight),p=h.clamp(c+t.tileWidth+.5,0,t.mapWidth),f=h.clamp(d+t.tileHeight+.5,0,t.mapHeight);n=c/t.mapWidth,o=f/t.mapHeight,a=t.topLeftCorner[0]+n*t.tileMatrixDeltaX,s=t.topLeftCorner[1]-o*t.tileMatrixDeltaY;var g=h.epsg3857ToEpsg4326(a,s);n=p/t.mapWidth,o=d/t.mapHeight,u=t.topLeftCorner[0]+n*t.tileMatrixDeltaX,l=t.topLeftCorner[1]-o*t.tileMatrixDeltaY;var m=h.epsg3857ToEpsg4326(u,l),E=new r(g[0],m[0],g[1],m[1]);return this.makeTile(E,t,e,i)},c.prototype.computeTileMatrixValues3857=function(t){var e=28e-5*t.scaleDenominator,i=t.tileWidth*e,r=t.tileHeight*e,n=t.topLeftCorner[0]+i*t.matrixWidth,o=t.topLeftCorner[1]-r*t.matrixHeight,s=[n,o],a=t.topLeftCorner;t.tileMatrixDeltaX=s[0]-a[0],t.tileMatrixDeltaY=a[1]-s[1],t.mapWidth=t.tileWidth*t.matrixWidth,t.mapHeight=t.tileHeight*t.matrixHeight},c.prototype.makeTile=function(t,e,i,r){var n=this.cachePath+"-layer/"+e.identifier+"/"+i+"/"+r+"."+u.suffixForMimeType(this.imageFormat);return new l(t,e,i,r,n)},c.prototype.createTexture=function(t,e,i){return c.isEpsg4326Crs(this.tileMatrixSet.supportedCRS)?new s(t.currentGlContext,i):c.isEpsg3857Crs(this.tileMatrixSet.supportedCRS)?this.createTexture3857(t,e,i):c.isOGCCrs84(this.tileMatrixSet.supportedCRS)?new s(t.currentGlContext,i):void 0},c.prototype.createTexture3857=function(t,e,i){this.destCanvas||(this.destCanvas=document.createElement("canvas"),this.destContext=this.destCanvas.getContext("2d"));var r,n,o,a,l,u,c,d,p=t.canvas2D,f=t.ctx2D,g=this.destCanvas,m=this.destContext,E=m.createImageData(i.width,i.height),y=e.sector,_=h.gudermannianInverse(y.minLatitude),v=h.gudermannianInverse(y.maxLatitude);p.width=i.width,p.height=i.height,g.width=i.width,g.height=i.height,f.drawImage(i,0,0,i.width,i.height),r=f.getImageData(0,0,i.width,i.height);for(var S=0;S<1;S++)for(var b=0;b<i.height;b++){c=1-b/(i.height-1),n=c*y.deltaLatitude()+y.minLatitude,o=h.gudermannianInverse(n),d=1-(o-_)/(v-_),d=h.clamp(d,0,1),a=Math.floor(d*(i.height-1));for(var T=0;T<i.width;T++)l=4*(T+a*i.width),u=4*(T+b*i.width),E.data[u]=r.data[l],E.data[u+1]=r.data[l+1],E.data[u+2]=r.data[l+2],E.data[u+3]=r.data[l+3]}return m.putImageData(E,0,0),new s(t.currentGlContext,g)},c.isEpsg4326Crs=function(t){return t.indexOf("EPSG")>=0&&t.indexOf("4326")>=0},c.isEpsg3857Crs=function(t){return t.indexOf("EPSG")>=0&&(t.indexOf("3857")>=0||t.indexOf("900913")>=0)},c.isOGCCrs84=function(t){return t.indexOf("OGC")>=0&&t.indexOf("CRS84")>=0},c}),i("WorldWindow",["./error/ArgumentError","./render/DrawContext","./globe/EarthElevationModel","./util/FrameStatistics","./globe/Globe","./globe/Globe2D","./util/GoToAnimator","./cache/GpuResourceCache","./util/Logger","./navigate/LookAtNavigator","./navigate/NavigatorState","./pick/PickedObjectList","./geom/Rectangle","./geom/Sector","./shapes/SurfaceShape","./shapes/SurfaceShapeTileBuilder","./globe/Terrain","./geom/Vec2"],function(t,e,i,r,n,o,s,a,l,h,u,c,d,p,f,g,m,E){"use strict";var y=function(o,a){function u(t){m.handleContextLost(t)}function c(t){m.handleContextRestored(t)}function p(t){m.handleRedrawEvent(t)}if(!window.WebGLRenderingContext)throw new t(l.logMessage(l.LEVEL_SEVERE,"WorldWindow","constructor","The specified canvas does not support WebGL."));var f=document.getElementById(o);if(!f)throw new t(l.logMessage(l.LEVEL_SEVERE,"WorldWindow","constructor","The specified canvas name is not in the document."));var g=this.createContext(f);this.drawContext=new e(g),this.eventListeners={},this.redrawRequested=!0,this.redrawRequestId=null,this.canvas=f,this.depthBits=g.getParameter(g.DEPTH_BITS),this.viewport=new d(0,0,g.drawingBufferWidth,g.drawingBufferHeight),this.globe=new n(a||new i),this.layers=[],this.navigator=new h(this),this.verticalExaggeration=1,this.deepPicking=!1,this.subsurfaceMode=!1,this.surfaceOpacity=1,this.frameStatistics=new r,this.goToAnimator=new s(this),this._redrawCallbacks=[],this._orderedRenderingFilters=[function(t){m.declutter(t,1)},function(t){m.declutter(t,2)}],this.pixelScale=1;var m=this;this.canvas.addEventListener("webglcontextlost",u,!1),this.canvas.addEventListener("webglcontextrestored",c,!1),this.canvas.addEventListener(WorldWind.REDRAW_EVENT_TYPE,p,!1),window.addEventListener(WorldWind.REDRAW_EVENT_TYPE,p,!1),this.animationFrameLoop()};return Object.defineProperties(y.prototype,{orderedRenderingFilters:{get:function(){return this._orderedRenderingFilters}},redrawCallbacks:{get:function(){return this._redrawCallbacks}}}),y.prototype.canvasCoordinates=function(t,e){var i=this.canvas.getBoundingClientRect(),r=t-(i.left+this.canvas.clientLeft),n=e-(i.top+this.canvas.clientTop);return new E(r,n)},y.prototype.addEventListener=function(e,i){if(!e)throw new t(l.logMessage(l.LEVEL_SEVERE,"WorldWindow","addEventListener","missingType"));if(!i)throw new t(l.logMessage(l.LEVEL_SEVERE,"WorldWindow","addEventListener","missingListener"));var r=this,n=this.eventListeners[e];n||(n={listeners:[],callback:function(t){t.worldWindow=r;for(var e=0,i=n.listeners.length;e<i;e++)n.listeners[e](t)}},this.eventListeners[e]=n),-1==n.listeners.indexOf(i)&&(n.listeners.splice(0,0,i),1==n.listeners.length&&this.canvas.addEventListener(e,n.callback,!1))},y.prototype.removeEventListener=function(e,i){if(!e)throw new t(l.logMessage(l.LEVEL_SEVERE,"WorldWindow","removeEventListener","missingType"));if(!i)throw new t(l.logMessage(l.LEVEL_SEVERE,"WorldWindow","removeEventListener","missingListener"));var r=this.eventListeners[e];if(r){var n=r.listeners.indexOf(i);-1!=n&&(r.listeners.splice(n,1),0==r.listeners.length&&this.canvas.removeEventListener(e,r.callback,!1))}},y.prototype.redraw=function(){this.redrawRequested=!0},y.prototype.pick=function(e){if(!e)throw new t(l.logMessage(l.LEVEL_SEVERE,"WorldWindow","pick","missingPoint"));return this.drawContext.currentGlContext.isContextLost()?new c:(this.resize(),this.resetDrawContext(),this.drawContext.pickingMode=!0,this.drawContext.pickPoint=e,this.drawFrame(),this.drawContext.objectsAtPickPoint)},y.prototype.pickTerrain=function(e){if(!e)throw new t(l.logMessage(l.LEVEL_SEVERE,"WorldWindow","pickTerrain","missingPoint"));return this.drawContext.currentGlContext.isContextLost()?new c:(this.resize(),this.resetDrawContext(),this.drawContext.pickingMode=!0,this.drawContext.pickTerrainOnly=!0,this.drawContext.pickPoint=e,this.drawFrame(),this.drawContext.objectsAtPickPoint)},y.prototype.pickShapesInRegion=function(e){if(!e)throw new t(l.logMessage(l.LEVEL_SEVERE,"WorldWindow","pickShapesInRegion","missingRectangle"));return this.drawContext.currentGlContext.isContextLost()?new c:(this.resize(),this.resetDrawContext(),this.drawContext.pickingMode=!0,this.drawContext.regionPicking=!0,this.drawContext.pickRectangle=new d(e.x,this.canvas.height-e.y,e.width,e.height),this.drawFrame(),this.drawContext.objectsAtPickPoint)},y.prototype.createContext=function(t){var e={antialias:!1,stencil:!0},i=t.getContext("webgl",e);i||(i=t.getContext("experimental-webgl",e));var r=i.getContextAttributes();return this.hasStencilBuffer=r.stencil,i},y.prototype.handleContextLost=function(t){l.log(l.LEVEL_INFO,"WebGL context event: "+t.statusMessage),t.preventDefault(),this.drawContext.contextLost(),window.cancelAnimationFrame(this.redrawRequestId)},y.prototype.handleContextRestored=function(t){l.log(l.LEVEL_INFO,"WebGL context event: "+t.statusMessage),this.drawContext.contextRestored(),this.redraw(),this.animationFrameLoop()},y.prototype.handleRedrawEvent=function(t){this.redraw()},y.prototype.animationFrameLoop=function(){function t(){e.animationFrameLoop()}this.redrawIfNeeded();var e=this;this.redrawRequestId=window.requestAnimationFrame(t)},y.prototype.redrawIfNeeded=function(){if(this.resize(),this.redrawRequested)try{this.redrawRequested=!1,this.drawContext.previousRedrawTimestamp=this.drawContext.timestamp,this.callRedrawCallbacks(WorldWind.BEFORE_REDRAW),this.resetDrawContext(),this.drawFrame()}catch(t){l.logMessage(l.LEVEL_SEVERE,"WorldWindow","redrawIfNeeded","Exception occurred during redrawing.\n"+t.toString())}finally{this.callRedrawCallbacks(WorldWind.AFTER_REDRAW),this.drawContext.redrawRequested&&(this.redrawRequested=!0)}},y.prototype.resize=function(){var t=this.drawContext.currentGlContext,e=t.canvas.clientWidth*this.pixelScale,i=t.canvas.clientHeight*this.pixelScale;t.canvas.width==e&&t.canvas.height==i||(t.canvas.width=e,t.canvas.height=i,t.viewport(0,0,t.drawingBufferWidth,t.drawingBufferHeight),this.viewport=new d(0,0,t.drawingBufferWidth,t.drawingBufferHeight),this.redrawRequested=!0)},y.prototype.resetDrawContext=function(){this.globe.offset=0;var t=this.drawContext;t.reset(),t.globe=this.globe,t.layers=this.layers,t.navigatorState=this.navigator.currentState(),t.verticalExaggeration=this.verticalExaggeration,t.surfaceOpacity=this.surfaceOpacity,t.deepPicking=this.deepPicking,t.frameStatistics=this.frameStatistics,t.pixelScale=this.pixelScale,t.update()},y.prototype.drawFrame=function(){try{this.drawContext.frameStatistics.beginFrame(),this.beginFrame(),this.drawContext.globe.is2D()&&this.drawContext.globe.continuous?this.do2DContiguousRepaint():this.doNormalRepaint()}finally{this.endFrame(),this.drawContext.frameStatistics.endFrame()}},y.prototype.doNormalRepaint=function(){this.createTerrain(),this.clearFrame(),this.deferOrderedRendering=!1,this.drawContext.pickingMode?this.drawContext.makePickFrustum()&&(this.doPick(),this.resolvePick()):(this.doDraw(),this.subsurfaceMode&&this.hasStencilBuffer&&(this.redrawSurface(),this.drawScreenRenderables()))},y.prototype.do2DContiguousRepaint=function(){this.createTerrain2DContiguous(),this.clearFrame(),this.drawContext.pickingMode?this.drawContext.makePickFrustum()&&(this.pick2DContiguous(),this.resolvePick()):this.draw2DContiguous()},y.prototype.resolvePick=function(){this.drawContext.pickTerrainOnly?this.resolveTerrainPick():this.drawContext.regionPicking?this.resolveRegionPick():this.resolveTopPick()},y.prototype.beginFrame=function(){var t=this.drawContext.currentGlContext;t.enable(t.BLEND),t.enable(t.CULL_FACE),t.enable(t.DEPTH_TEST),t.blendFunc(t.ONE,t.ONE_MINUS_SRC_ALPHA),t.depthFunc(t.LEQUAL),this.drawContext.pickingMode&&(this.drawContext.makePickFramebuffer(),this.drawContext.bindFramebuffer(this.drawContext.pickFramebuffer))},y.prototype.endFrame=function(){var t=this.drawContext.currentGlContext;t.disable(t.BLEND),t.disable(t.CULL_FACE),t.disable(t.DEPTH_TEST),t.blendFunc(t.ONE,t.ZERO),t.depthFunc(t.LESS),t.clearColor(0,0,0,1),this.drawContext.bindFramebuffer(null),this.drawContext.bindProgram(null)},y.prototype.clearFrame=function(){var t=this.drawContext,e=t.currentGlContext;e.clearColor(t.clearColor.red,t.clearColor.green,t.clearColor.blue,t.clearColor.alpha),e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT)},y.prototype.doDraw=function(){this.drawContext.renderShapes=!0,this.subsurfaceMode&&this.hasStencilBuffer?(this.drawContext.currentGlContext.disable(this.drawContext.currentGlContext.STENCIL_TEST),this.drawContext.surfaceShapeTileBuilder.clear(),this.drawLayers(!0),this.drawSurfaceRenderables(),this.drawContext.surfaceShapeTileBuilder.doRender(this.drawContext),this.deferOrderedRendering||(this.drawContext.currentGlContext.clear(this.drawContext.currentGlContext.DEPTH_BUFFER_BIT|this.drawContext.currentGlContext.STENCIL_BUFFER_BIT),this.drawContext.currentGlContext.enable(this.drawContext.currentGlContext.STENCIL_TEST),this.drawContext.currentGlContext.stencilFunc(this.drawContext.currentGlContext.ALWAYS,1,1),this.drawContext.currentGlContext.stencilOp(this.drawContext.currentGlContext.REPLACE,this.drawContext.currentGlContext.REPLACE,this.drawContext.currentGlContext.REPLACE),this.drawOrderedRenderables(),this.drawContext.screenCreditController.drawCredits(this.drawContext))):(this.drawContext.surfaceShapeTileBuilder.clear(),this.drawLayers(!0),this.drawSurfaceRenderables(),this.drawContext.surfaceShapeTileBuilder.doRender(this.drawContext),this.deferOrderedRendering||(this.drawOrderedRenderables(),this.drawScreenRenderables()),this.drawContext.screenCreditController.drawCredits(this.drawContext))},y.prototype.redrawSurface=function(){this.drawContext.currentGlContext.enable(this.drawContext.currentGlContext.STENCIL_TEST),this.drawContext.currentGlContext.stencilFunc(this.drawContext.currentGlContext.EQUAL,1,1),this.drawContext.currentGlContext.stencilOp(this.drawContext.currentGlContext.KEEP,this.drawContext.currentGlContext.KEEP,this.drawContext.currentGlContext.KEEP),this.drawContext.surfaceShapeTileBuilder.clear(),this.drawLayers(!1),this.drawSurfaceRenderables(),this.drawContext.surfaceShapeTileBuilder.doRender(this.drawContext),this.drawContext.currentGlContext.disable(this.drawContext.currentGlContext.STENCIL_TEST)},y.prototype.doPick=function(){this.drawContext.terrain&&this.drawContext.terrain.pick(this.drawContext),this.drawContext.pickTerrainOnly||(this.subsurfaceMode&&this.hasStencilBuffer?(this.drawContext.currentGlContext.disable(this.drawContext.currentGlContext.STENCIL_TEST),this.drawContext.surfaceShapeTileBuilder.clear(),this.drawLayers(!0),this.drawSurfaceRenderables(),this.drawContext.surfaceShapeTileBuilder.doRender(this.drawContext),this.deferOrderedRendering||(this.drawContext.currentGlContext.clear(this.drawContext.currentGlContext.DEPTH_BUFFER_BIT|this.drawContext.currentGlContext.STENCIL_BUFFER_BIT),this.drawContext.currentGlContext.enable(this.drawContext.currentGlContext.STENCIL_TEST),this.drawContext.currentGlContext.stencilFunc(this.drawContext.currentGlContext.ALWAYS,1,1),this.drawContext.currentGlContext.stencilOp(this.drawContext.currentGlContext.REPLACE,this.drawContext.currentGlContext.REPLACE,this.drawContext.currentGlContext.REPLACE),this.drawOrderedRenderables(),this.drawContext.terrain.pick(this.drawContext),this.drawScreenRenderables())):(this.drawContext.surfaceShapeTileBuilder.clear(),this.drawLayers(!0),this.drawSurfaceRenderables(),this.drawContext.surfaceShapeTileBuilder.doRender(this.drawContext),this.deferOrderedRendering||(this.drawOrderedRenderables(),this.drawScreenRenderables())))},y.prototype.createTerrain=function(){var t=this.drawContext;t.terrain=this.globe.tessellator.tessellate(t),t.frameStatistics.setTerrainTileCount(t.terrain?t.terrain.surfaceGeometry.length:0)},y.prototype.makeCurrent=function(t){var e=this.drawContext;switch(e.globe.offset=t,e.globeStateKey=e.globe.stateKey,t){case-1:e.terrain=this.terrainLeft;break;case 0:e.terrain=this.terrainCenter;break;case 1:e.terrain=this.terrainRight}},y.prototype.createTerrain2DContiguous=function(){var t=this.drawContext;this.terrainCenter=null,t.globe.offset=0,t.globeStateKey=t.globe.stateKey,t.globe.intersectsFrustum(t.navigatorState.frustumInModelCoordinates)&&(this.terrainCenter=t.globe.tessellator.tessellate(t)),this.terrainRight=null,t.globe.offset=1,t.globeStateKey=t.globe.stateKey,t.globe.intersectsFrustum(t.navigatorState.frustumInModelCoordinates)&&(this.terrainRight=t.globe.tessellator.tessellate(t)),this.terrainLeft=null,t.globe.offset=-1,t.globeStateKey=t.globe.stateKey,t.globe.intersectsFrustum(t.navigatorState.frustumInModelCoordinates)&&(this.terrainLeft=t.globe.tessellator.tessellate(t))},y.prototype.draw2DContiguous=function(){var t="";this.terrainCenter&&(t+=" 0 ",this.makeCurrent(0),this.deferOrderedRendering=this.terrainLeft||this.terrainRight,this.doDraw()),this.terrainRight&&(t+=" 1 ",this.makeCurrent(1),this.deferOrderedRendering=this.terrainLeft||this.terrainLeft,this.doDraw()),this.deferOrderedRendering=!1,this.terrainLeft&&(t+=" -1 ",this.makeCurrent(-1),this.doDraw()),this.subsurfaceMode&&this.hasStencilBuffer&&(this.deferOrderedRendering=!0,this.terrainCenter&&(t+=" 0 ",this.makeCurrent(0),this.redrawSurface()),this.terrainRight&&(t+=" 1 ",this.makeCurrent(1),this.redrawSurface()),this.terrainLeft&&(t+=" -1 ",this.makeCurrent(-1),this.redrawSurface())),this.drawScreenRenderables()},y.prototype.pick2DContiguous=function(){this.terrainCenter&&(this.makeCurrent(0),this.deferOrderedRendering=this.terrainLeft||this.terrainRight,this.doPick()),this.terrainRight&&(this.makeCurrent(1),this.deferOrderedRendering=this.terrainLeft||this.terrainLeft,this.doPick()),this.deferOrderedRendering=!1,this.terrainLeft&&(this.makeCurrent(-1),this.doPick())},y.prototype.drawLayers=function(t){var e,i=Date.now(),r=this.drawContext,n=r.layers;r.accumulateOrderedRenderables=t;for(var o=0,s=n.length;o<s;o++)if(e=n[o]){r.currentLayer=e;try{e.render(r)}catch(t){l.log(l.LEVEL_SEVERE,"Error while rendering layer "+e.displayName+".\n"+t.toString())}}var a=Date.now();r.frameStatistics.layerRenderingTime=a-i},y.prototype.addLayer=function(t){this.layers.push(t)},y.prototype.removeLayer=function(t){if(t){for(var e=-1,i=0,r=this.layers.length;i<r;i++)if(this.layers[i]==t){e=i;break}e>=0&&this.layers.splice(e,1)}},y.prototype.insertLayer=function(t,e){e&&this.layers.splice(t,0,e)},y.prototype.drawSurfaceRenderables=function(){var t,e=this.drawContext;for(e.reverseSurfaceRenderables();t=e.popSurfaceRenderable();)try{t.renderSurface(e)}catch(t){l.logMessage(l.LEVEL_WARNING,"WorldWindow","drawSurfaceRenderables","Error while rendering a surface renderable.\n"+t.message)}},y.prototype.drawOrderedRenderables=function(){var t,e=Date.now(),i=this.drawContext;if(i.sortOrderedRenderables(),this._orderedRenderingFilters)for(var r=0;r<this._orderedRenderingFilters.length;r++)this._orderedRenderingFilters[r](this.drawContext);for(i.orderedRenderingMode=!0;t=i.popOrderedRenderable();)try{t.renderOrdered(i)}catch(t){l.logMessage(l.LEVEL_WARNING,"WorldWindow","drawOrderedRenderables","Error while rendering an ordered renderable.\n"+t.message)}i.orderedRenderingMode=!1,i.frameStatistics.orderedRenderingTime=Date.now()-e},y.prototype.drawScreenRenderables=function(){for(var t,e=this.drawContext;t=e.nextScreenRenderable();)try{t.renderOrdered(e)}catch(t){l.logMessage(l.LEVEL_WARNING,"WorldWindow","drawOrderedRenderables","Error while rendering a screen renderable.\n"+t.message)}},y.prototype.resolveTopPick=function(){if(0!=this.drawContext.objectsAtPickPoint.objects.length){var t=this.drawContext.objectsAtPickPoint,e=this.drawContext.readPickColor(this.drawContext.pickPoint),i=null,r=null;if(e){for(var n=0,o=t.objects.length;n<o;n++){var s=t.objects[n];if(s.isTerrain&&(r=s),s.color.equals(e)&&(s.isOnTop=!0,i=s,r))break}this.drawContext.deepPicking||(t.clear(),i&&t.add(i),r&&r!=i&&t.add(r))}else t.clear()}},y.prototype.resolveTerrainPick=function(){
for(var t,e=this.drawContext.objectsAtPickPoint,i=0,r=e.objects.length;i<r;i++)if(t=e.objects[i],t.isTerrain){t.isOnTop=!0;break}},y.prototype.resolveRegionPick=function(){if(0!=this.drawContext.objectsAtPickPoint.objects.length)for(var t,e,i=this.drawContext.objectsAtPickPoint,r=this.drawContext.readPickColors(this.drawContext.pickRectangle),n=0,o=i.objects.length;n<o;n++)if(t=i.objects[n]){var s=t.color.toByteString();e=r[s],e?t.isOnTop=!0:t.userObject instanceof f&&(i.objects.splice(n,1),n-=1)}},y.prototype.callRedrawCallbacks=function(t){for(var e=0,i=this._redrawCallbacks.length;e<i;e++)try{this._redrawCallbacks[e](this,t)}catch(t){l.log(l.LEVEL_SEVERE,"Exception calling redraw callback.\n"+t.toString())}},y.prototype.goTo=function(t,e){this.goToAnimator.goTo(t,e)},y.prototype.declutter=function(e,i){if(!i)throw new t(l.logMessage(l.LEVEL_SEVERE,"WorldWindow","declutter","Group ID is null, undefined or 0."));for(var r=[],n=0;n<e.orderedRenderables.length;n++){var o=e.orderedRenderables[n].orderedRenderable;o.declutterGroup===i&&r.push(o)}for(var s=[],a=0;a<r.length;a++){var h=r[a],u=h.screenBounds;u&&u.intersectsRectangles(s)?h.targetVisibility=0:(h.targetVisibility=1,u&&s.push(u))}},y}),i("util/WWMessage",[],function(){"use strict";return function(t,e){this.type=t,this.source=e}}),i("WorldWind",["./error/AbstractError","./geom/Angle","./shapes/Annotation","./shapes/AnnotationAttributes","./util/measure/AreaMeasurer","./error/ArgumentError","./layer/AtmosphereLayer","./shaders/AtmosphereProgram","./shaders/BasicProgram","./shaders/BasicTextureProgram","./util/BasicTimeSequence","./layer/BingAerialLayer","./layer/BingAerialWithLabelsLayer","./layer/BingRoadsLayer","./layer/BingWMSLayer","./layer/BMNGLandsatLayer","./layer/BMNGLayer","./layer/BMNGOneImageLayer","./layer/BMNGRestLayer","./geom/BoundingBox","./gesture/ClickRecognizer","./formats/collada/ColladaLoader","./util/Color","./shapes/Compass","./layer/CompassLayer","./layer/CoordinatesDisplayLayer","./util/Date","./layer/DigitalGlobeTiledImageLayer","./gesture/DragRecognizer","./render/DrawContext","./globe/EarthElevationModel","./globe/EarthRestElevationModel","./globe/ElevationModel","./util/Font","./util/FrameStatistics","./layer/FrameStatisticsLayer","./render/FramebufferTexture","./render/FramebufferTile","./render/FramebufferTileController","./geom/Frustum","./shapes/GeographicMesh","./projections/GeographicProjection","./shapes/GeographicText","./formats/geojson/GeoJSONGeometry","./formats/geojson/GeoJSONGeometryCollection","./formats/geojson/GeoJSONGeometryLineString","./formats/geojson/GeoJSONGeometryMultiLineString","./formats/geojson/GeoJSONGeometryMultiPoint","./formats/geojson/GeoJSONGeometryMultiPolygon","./formats/geojson/GeoJSONGeometryPoint","./formats/geojson/GeoJSONGeometryPolygon","./formats/geojson/GeoJSONParser","./formats/geotiff/GeoTiffReader","./gesture/GestureRecognizer","./globe/Globe","./globe/Globe2D","./util/GoToAnimator","./shaders/GpuProgram","./cache/GpuResourceCache","./shaders/GpuShader","./shaders/GroundProgram","./util/HashMap","./util/HighlightController","./formats/kml/util/ImagePyramid","./util/ImageSource","./render/ImageTile","./util/Insets","./formats/kml/util/ItemIcon","./formats/kml/KmlAbstractView","./formats/kml/styles/KmlBalloonStyle","./formats/kml/KmlCamera","./formats/kml/styles/KmlColorStyle","./formats/kml/features/KmlContainer","./formats/kml/controls/KmlControls","./formats/kml/features/KmlDocument","./formats/kml/KmlElements","./formats/kml/features/KmlFeature","./formats/kml/KmlFile","./formats/kml/features/KmlFolder","./formats/kml/geom/KmlGeometry","./formats/kml/features/KmlGroundOverlay","./formats/kml/KmlIcon","./formats/kml/styles/KmlIconStyle","./formats/kml/styles/KmlLabelStyle","./formats/kml/KmlLatLonAltBox","./formats/kml/KmlLatLonBox","./formats/kml/KmlLatLonQuad","./formats/kml/geom/KmlLinearRing","./formats/kml/geom/KmlLineString","./formats/kml/styles/KmlLineStyle","./formats/kml/KmlLink","./formats/kml/styles/KmlListStyle","./formats/kml/KmlLocation","./formats/kml/KmlLod","./formats/kml/KmlLookAt","./formats/kml/geom/KmlMultiGeometry","./formats/kml/features/KmlNetworkLink","./formats/kml/KmlObject","./formats/kml/KmlOrientation","./formats/kml/features/KmlOverlay","./formats/kml/features/KmlPhotoOverlay","./formats/kml/features/KmlPlacemark","./formats/kml/geom/KmlPoint","./formats/kml/geom/KmlPolygon","./formats/kml/styles/KmlPolyStyle","./formats/kml/KmlRegion","./formats/kml/features/KmlScreenOverlay","./formats/kml/styles/KmlStyle","./formats/kml/styles/KmlStyleMap","./formats/kml/styles/KmlStyleSelector","./formats/kml/styles/KmlSubStyle","./formats/kml/KmlTimePrimitive","./formats/kml/KmlTimeSpan","./formats/kml/KmlTimeStamp","./formats/kml/features/KmlTour","./formats/kml/geom/KmlTrack","./formats/kml/controls/KmlTreeVisibility","./layer/LandsatRestLayer","./layer/Layer","./util/measure/LengthMeasurer","./util/Level","./util/LevelRowColumnUrlBuilder","./util/LevelSet","./geom/Line","./geom/Location","./util/Logger","./navigate/LookAtNavigator","./geom/Matrix","./util/measure/MeasurerUtils","./cache/MemoryCache","./cache/MemoryCacheListener","./layer/MercatorTiledImageLayer","./navigate/Navigator","./navigate/NavigatorState","./util/NominatimGeocoder","./error/NotYetImplementedError","./util/Offset","./layer/OpenStreetMapImageLayer","./formats/kml/util/Pair","./gesture/PanRecognizer","./shapes/Path","./util/PeriodicTimeSequence","./pick/PickedObject","./pick/PickedObjectList","./gesture/PinchRecognizer","./shapes/Placemark","./shapes/PlacemarkAttributes","./geom/Plane","./shapes/Polygon","./util/PolygonSplitter","./geom/Position","./projections/ProjectionEquirectangular","./projections/ProjectionGnomonic","./projections/ProjectionMercator","./projections/ProjectionPolarEquidistant","./projections/ProjectionUPS","./projections/ProjectionWgs84","./geom/Rectangle","./render/Renderable","./layer/RenderableLayer","./layer/RestTiledImageLayer","./gesture/RotationRecognizer","./formats/kml/util/Scale","./formats/kml/util/Schema","./shapes/ScreenImage","./shapes/ScreenText","./geom/Sector","./shapes/ShapeAttributes","./formats/shapefile/Shapefile","./layer/ShowTessellationLayer","./shaders/SkyProgram","./layer/StarFieldLayer","./shaders/StarFieldProgram","./util/SunPosition","./shapes/SurfaceImage","./shapes/SurfaceCircle","./shapes/SurfaceEllipse","./shapes/SurfacePolygon","./shapes/SurfacePolyline","./shapes/SurfaceRectangle","./render/SurfaceRenderable","./shapes/SurfaceSector","./shapes/SurfaceShape","./shapes/SurfaceShapeTile","./shapes/SurfaceShapeTileBuilder","./render/SurfaceTile","./render/SurfaceTileRenderer","./shaders/SurfaceTileRendererProgram","./gesture/TapRecognizer","./layer/TectonicPlatesLayer","./globe/Terrain","./globe/TerrainTile","./globe/TerrainTileList","./globe/Tessellator","./shapes/Text","./shapes/TextAttributes","./render/TextSupport","./render/Texture","./render/TextureTile","./util/Tile","./layer/TiledImageLayer","./util/TileFactory","./gesture/TiltRecognizer","./gesture/Touch","./shapes/TriangleMesh","./error/UnsupportedOperationError","./geom/Vec2","./geom/Vec3","./layer/ViewControlsLayer","./formats/kml/util/ViewVolume","./util/WcsTileUrlBuilder","./ogc/WfsCapabilities","./formats/wkt/Wkt","./formats/wkt/WktElements","./formats/wkt/geom/WktGeometryCollection","./formats/wkt/geom/WktLineString","./formats/wkt/geom/WktMultiLineString","./formats/wkt/geom/WktMultiPoint","./formats/wkt/geom/WktMultiPolygon","./formats/wkt/geom/WktObject","./formats/wkt/geom/WktPoint","./formats/wkt/geom/WktPolygon","./formats/wkt/WktTokens","./formats/wkt/geom/WktTriangle","./formats/wkt/WktType","./ogc/wms/WmsCapabilities","./layer/WmsLayer","./ogc/wms/WmsLayerCapabilities","./layer/WmsTimeDimensionedLayer","./util/WmsUrlBuilder","./ogc/wmts/WmtsCapabilities","./layer/WmtsLayer","./ogc/wmts/WmtsLayerCapabilities","./WorldWindow","./util/WWMath","./util/WWMessage","./util/WWUtil","./util/XmlDocument","./globe/ZeroElevationModel"],function(t,e,i,r,n,o,s,a,l,h,u,c,d,p,f,g,m,E,y,_,v,S,b,T,L,w,R,x,M,C,A,P,I,O,N,D,k,V,F,G,W,B,U,K,j,z,q,Y,H,X,J,Z,Q,$,tt,et,it,rt,nt,ot,st,at,lt,ht,ut,ct,dt,pt,ft,gt,mt,Et,yt,_t,vt,St,bt,Tt,Lt,wt,Rt,xt,Mt,Ct,At,Pt,It,Ot,Nt,Dt,kt,Vt,Ft,Gt,Wt,Bt,Ut,Kt,jt,zt,qt,Yt,Ht,Xt,Jt,Zt,Qt,$t,te,ee,ie,re,ne,oe,se,ae,le,he,ue,ce,de,pe,fe,ge,me,Ee,ye,_e,ve,Se,be,Te,Le,we,Re,xe,Me,Ce,Ae,Pe,Ie,Oe,Ne,De,ke,Ve,Fe,Ge,We,Be,Ue,Ke,je,ze,qe,Ye,He,Xe,Je,Ze,Qe,$e,ti,ei,ii,ri,ni,oi,si,ai,li,hi,ui,ci,di,pi,fi,gi,mi,Ei,yi,_i,vi,Si,bi,Ti,Li,wi,Ri,xi,Mi,Ci,Ai,Pi,Ii,Oi,Ni,Di,ki,Vi,Fi,Gi,Wi,Bi,Ui,Ki,ji,zi,qi,Yi,Hi,Xi,Ji,Zi,Qi,$i,tr,er,ir,rr,nr,or,sr,ar,lr,hr,ur,cr,dr,pr,fr,gr,mr,Er,yr,_r,vr,Sr,br){"use strict";var Tr={VERSION:"0.9.0",ABSOLUTE:"absolute",AFTER_REDRAW:"afterRedraw",BEFORE_REDRAW:"beforeRedraw",BEGAN:"began",CANCELLED:"cancelled",CHANGED:"changed",CLAMP_TO_GROUND:"clampToGround",EARTH_RADIUS:6371e3,EAST:"east",ENDED:"ended",FAILED:"failed",GREAT_CIRCLE:"greatCircle",LINEAR:"linear",MULTI_POINT:"multiPoint",NORTH:"north",NULL:"null",OFFSET_FRACTION:"fraction",OFFSET_INSET_PIXELS:"insetPixels",OFFSET_PIXELS:"pixels",POINT:"point",POLYLINE:"polyline",POLYGON:"polygon",POSSIBLE:"possible",RECOGNIZED:"recognized",REDRAW_EVENT_TYPE:"WorldWindRedraw",RELATIVE_TO_GLOBE:"relativeToGlobe",RELATIVE_TO_GROUND:"relativeToGround",RELATIVE_TO_SCREEN:"relativeToScreen",RHUMB_LINE:"rhumbLine",SOUTH:"south",WEST:"west"};return Tr.AbstractError=t,Tr.Angle=e,Tr.Annotation=i,Tr.AnnotationAttributes=r,Tr.AreaMeasurer=n,Tr.ArgumentError=o,Tr.AtmosphereLayer=s,Tr.AtmosphereProgram=a,Tr.BasicProgram=l,Tr.BasicTextureProgram=h,Tr.BasicTimeSequence=u,Tr.BingAerialLayer=c,Tr.BingAerialWithLabelsLayer=d,Tr.BingRoadsLayer=p,Tr.BingWMSLayer=f,Tr.BMNGLandsatLayer=g,Tr.BMNGLayer=m,Tr.BMNGOneImageLayer=E,Tr.BMNGRestLayer=y,Tr.BoundingBox=_,Tr.ClickRecognizer=v,Tr.ColladaLoader=S,Tr.Color=b,Tr.Compass=T,Tr.CompassLayer=L,Tr.CoordinatesDisplayLayer=w,Tr.DateWW=R,Tr.DigitalGlobeTiledImageLayer=x,Tr.DragRecognizer=M,Tr.DrawContext=C,Tr.EarthElevationModel=A,Tr.EarthRestElevationModel=P,Tr.ElevationModel=I,Tr.Font=O,Tr.FrameStatistics=N,Tr.FrameStatisticsLayer=D,Tr.FramebufferTexture=k,Tr.FramebufferTile=V,Tr.FramebufferTileController=F,Tr.Frustum=G,Tr.GeographicMesh=W,Tr.GeographicProjection=B,Tr.GeographicText=U,Tr.GeoJSONGeometry=K,Tr.GeoJSONGeometryCollection=j,Tr.GeoJSONGeometryLineString=z,Tr.GeoJSONGeometryMultiLineString=q,Tr.GeoJSONGeometryMultiPoint=Y,Tr.GeoJSONGeometryMultiPolygon=H,Tr.GeoJSONGeometryPoint=X,Tr.GeoJSONGeometryPolygon=J,Tr.GeoJSONParser=Z,Tr.GeoTiffReader=Q,Tr.GestureRecognizer=$,Tr.Globe=tt,Tr.Globe2D=et,Tr.GoToAnimator=it,Tr.GpuProgram=rt,Tr.GpuResourceCache=nt,Tr.GpuShader=ot,Tr.GroundProgram=st,Tr.HashMap=at,Tr.HighlightController=lt,Tr.ImageSource=ut,Tr.ImageTile=ct,Tr.Insets=dt,Tr.KmlControls=_t,Tr.KmlFile=Tt,Tr.KmlTreeVisibility=le,Tr.LandsatRestLayer=he,Tr.Layer=ue,Tr.LengthMeasurer=ce,Tr.Level=de,Tr.LevelRowColumnUrlBuilder=pe,Tr.LevelSet=fe,Tr.Line=ge,Tr.Location=me,Tr.Logger=Ee,Tr.LookAtNavigator=ye,Tr.Matrix=_e,Tr.MeasurerUtils=ve,Tr.MemoryCache=Se,Tr.MemoryCacheListener=be,Tr.MercatorTiledImageLayer=Te,Tr.Navigator=Le,Tr.NavigatorState=we,Tr.NominatimGeocoder=Re,Tr.NotYetImplementedError=xe,Tr.Offset=Me,Tr.OpenStreetMapImageLayer=Ce,Tr.PanRecognizer=Pe,Tr.Path=Ie,Tr.PeriodicTimeSequence=Oe,Tr.PickedObject=Ne,Tr.PickedObjectList=De,Tr.PinchRecognizer=ke,Tr.Placemark=Ve,Tr.PlacemarkAttributes=Fe,Tr.Plane=Ge,Tr.Polygon=We,Tr.PolygonSplitter=Be,Tr.Position=Ue,Tr.ProjectionEquirectangular=Ke,Tr.ProjectionGnomonic=je,Tr.ProjectionMercator=ze,Tr.ProjectionPolarEquidistant=qe,Tr.ProjectionUPS=Ye,Tr.ProjectionWgs84=He,Tr.Rectangle=Xe,Tr.Renderable=Je,Tr.RenderableLayer=Ze,Tr.RestTiledImageLayer=Qe,Tr.RotationRecognizer=$e,Tr.ScreenText=ri,Tr.ScreenImage=ii,Tr.Sector=ni,Tr.ShapeAttributes=oi,Tr.Shapefile=si,Tr.ShowTessellationLayer=ai,Tr.SkyProgram=li,Tr.StarFieldLayer=hi,Tr.StarFieldProgram=ui,Tr.SunPosition=ci,Tr.SurfaceImage=di,Tr.SurfaceCircle=pi,Tr.SurfaceEllipse=fi,Tr.SurfacePolygon=gi,Tr.SurfacePolyline=mi,Tr.SurfaceRectangle=Ei,Tr.SurfaceRenderable=yi,Tr.SurfaceSector=_i,Tr.SurfaceShape=vi,Tr.SurfaceShapeTile=Si,Tr.SurfaceShapeTileBuilder=bi,Tr.SurfaceTile=Ti,Tr.SurfaceTileRenderer=Li,Tr.SurfaceTileRendererProgram=wi,Tr.TapRecognizer=Ri,Tr.TectonicPlatesLayer=xi,Tr.Terrain=Mi,Tr.TerrainTile=Ci,Tr.TerrainTileList=Ai,Tr.Tessellator=Pi,Tr.Text=Ii,Tr.TextAttributes=Oi,Tr.TextSupport=Ni,Tr.Texture=Di,Tr.TextureTile=ki,Tr.Tile=Vi,Tr.TiledImageLayer=Fi,Tr.TileFactory=Gi,Tr.TiltRecognizer=Wi,Tr.Touch=Bi,Tr.TriangleMesh=Ui,Tr.UnsupportedOperationError=Ki,Tr.Vec2=ji,Tr.Vec3=zi,Tr.ViewControlsLayer=qi,Tr.WcsTileUrlBuilder=Hi,Tr.WfsCapabilities=Xi,Tr.Wkt=Ji,Tr.WktElements=Zi,Tr.WktGeometryCollection=Qi,Tr.WktLineString=$i,Tr.WktMultiLineString=tr,Tr.WktMultiPoint=er,Tr.WktMultiPolygon=ir,Tr.WktObject=rr,Tr.WktPoint=nr,Tr.WktPolygon=or,Tr.WktTokens=sr,Tr.WktTriangle=ar,Tr.WktType=lr,Tr.WmsCapabilities=hr,Tr.WmsLayer=ur,Tr.WmsLayerCapabilities=cr,Tr.WmsTimeDimensionedLayer=dr,Tr.WmsUrlBuilder=pr,Tr.WmtsCapabilities=fr,Tr.WmtsLayer=gr,Tr.WmtsLayerCapabilities=mr,Tr.WWMath=yr,Tr.WWMessage=_r,Tr.WWUtil=vr,Tr.WorldWindow=Er,Tr.ZeroElevationModel=br,Tr.configuration={gpuCacheSize:25e7,baseUrl:vr.worldwindlibLocation()||vr.currentUrlSansFilePart()+"/../"},Tr.BingMapsKey=null,window.WorldWind=Tr,Tr}),e("WorldWind")});