/** * @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 (C) 2014 United States Government as represented by the Administrator of the * National Aeronautics and Space Administration. All Rights Reserved. */ /* * Copyright (C) 2015 United States Government as represented by the Administrator of the * National Aeronautics and Space Administration. All Rights Reserved. */ /* * @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 (c) 2009-2014 Stuart Knightley 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 */ /** * The following functions come from pako, from pako/lib/utils/strings * released under the MIT license, see pako https://github.com/nodeca/pako/ */ (function(e,t){typeof define=="function"&&define.amd?define([],t):e.WorldWind=t()})(this,function(){var e,t,n;(function(r){function v(e,t){return h.call(e,t)}function m(e,t){var n,r,i,s,o,u,a,f,c,h,p,v=t&&t.split("/"),m=l.map,g=m&&m["*"]||{};if(e&&e.charAt(0)===".")if(t){v=v.slice(0,v.length-1),e=e.split("/"),o=e.length-1,l.nodeIdCompat&&d.test(e[o])&&(e[o]=e[o].replace(d,"")),e=v.concat(e);for(c=0;c0&&(e.splice(c-1,2),c-=2)}}e=e.join("/")}else e.indexOf("./")===0&&(e=e.substring(2));if((v||g)&&m){n=e.split("/");for(c=n.length;c>0;c-=1){r=n.slice(0,c).join("/");if(v)for(h=v.length;h>0;h-=1){i=m[v.slice(0,h).join("/")];if(i){i=i[r];if(i){s=i,u=c;break}}}if(s)break;!a&&g&&g[r]&&(a=g[r],f=c)}!s&&a&&(s=a,u=f),s&&(n.splice(0,u,s),e=n.join("/"))}return e}function g(e,t){return function(){var n=p.call(arguments,0);return typeof n[0]!="string"&&n.length===1&&n.push(null),s.apply(r,n.concat([e,t]))}}function y(e){return function(t){return m(t,e)}}function b(e){return function(t){a[e]=t}}function w(e){if(v(f,e)){var t=f[e];delete f[e],c[e]=!0,i.apply(r,t)}if(!v(a,e)&&!v(c,e))throw new Error("No "+e);return a[e]}function E(e){var t,n=e?e.indexOf("!"):-1;return n>-1&&(t=e.substring(0,n),e=e.substring(n+1,e.length)),[t,e]}function S(e){return function(){return l&&l.config&&l.config[e]||{}}}var i,s,o,u,a={},f={},l={},c={},h=Object.prototype.hasOwnProperty,p=[].slice,d=/\.js$/;o=function(e,t){var n,r=E(e),i=r[0];return e=r[1],i&&(i=m(i,t),n=w(i)),i?n&&n.normalize?e=n.normalize(e,y(t)):e=m(e,t):(e=m(e,t),r=E(e),i=r[0],e=r[1],i&&(n=w(i))),{f:i?i+"!"+e:e,n:e,pr:i,p:n}},u={require:function(e){return g(e)},exports:function(e){var t=a[e];return typeof t!="undefined"?t:a[e]={}},module:function(e){return{id:e,uri:"",exports:a[e],config:S(e)}}},i=function(e,t,n,i){var s,l,h,p,d,m=[],y=typeof n,E;i=i||e;if(y==="undefined"||y==="function"){t=!t.length&&n.length?["require","exports","module"]:t;for(d=0;d180?t-360:t<-180?360+t:t},normalizedDegreesLatitude:function(e){var t=e%180;return t>90?180-t:t<-90?-180-t:t},normalizedDegreesLongitude:function(e){var t=e%360;return t>180?t-360:t<-180?360+t:t},normalizedRadians:function(e){var t=e%this.TWO_PI;return t>Math.PI?t-this.TWO_PI:t<-Math.PI?this.TWO_PI+t:t},normalizedRadiansLatitude:function(e){var t=e%Math.PI;return t>this.HALF_PI?Math.PI-t:t<-this.HALF_PI?-Math.PI-t:t},normalizedRadiansLongitude:function(e){var t=e%this.TWO_PI;return t>Math.PI?t-this.TWO_PI:t<-Math.PI?this.TWO_PI+t:t},isValidLatitude:function(e){return e>=-90&&e<=90},isValidLongitude:function(e){return e>=-180&&e<=180},toString:function(e){return e.toString()+"°"},toDecimalDegreesString:function(e){return e.toString()+"°"},toDMSString:function(e){var t,n,r,i,s;return t=e<0?-1:1,n=t*e,r=Math.floor(n),n=(n-r)*60,i=Math.floor(n),n=(n-i)*60,s=Math.round(n),s==60&&(i++,s=0),i==60&&(r++,i=0),(t==-1?"-":"")+r+"°"+" "+i+"’"+" "+s+"”"},toDMString:function(e){var t,n,r,i,s,o;return t=e<0?-1:1,n=t*e,r=Math.floor(n),n=(n-r)*60,i=Math.floor(n),n=(n-i)*60,s=Math.round(n),s==60&&(i++,s=0),i==60&&(r++,i=0),o=s==0?i:i+s/60,(t==-1?"-":"")+r+"°"+" "+o+"’"}};return e}),n("util/Logger",[],function(){"use strict";var e={LEVEL_NONE:0,LEVEL_SEVERE:1,LEVEL_WARNING:2,LEVEL_INFO:3,setLoggingLevel:function(e){t=e},getLoggingLevel:function(){return t},log:function(n,r){r&&n>0&&n<=t&&(n===e.LEVEL_SEVERE?console.error(r):n===e.LEVEL_WARNING?console.warn(r):n===e.LEVEL_INFO?console.info(r):console.log(r))},makeMessage:function(e,t,n){var r=this.messageTable[n]?this.messageTable[n]:n;return e+"."+t+": "+r},logMessage:function(e,t,n,r){var i=this.makeMessage(t,n,r);return this.log(e,i),i},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 World Window is null or undefined.",notYetImplemented:"This function is not yet implemented"}},t=1;return e}),n("util/Color",["../util/Logger"],function(e){"use strict";var t=function(e,t,n,r){this.red=e,this.green=t,this.blue=n,this.alpha=r};return t.WHITE=new t(1,1,1,1),t.BLACK=new t(0,0,0,1),t.RED=new t(1,0,0,1),t.GREEN=new t(0,1,0,1),t.BLUE=new t(0,0,1,1),t.CYAN=new t(0,1,1,1),t.YELLOW=new t(1,1,0,1),t.MAGENTA=new t(1,0,1,1),t.LIGHT_GRAY=new t(.75,.75,.75,1),t.MEDIUM_GRAY=new t(.5,.5,.5,1),t.DARK_GRAY=new t(.25,.25,.25,1),t.TRANSPARENT=new t(0,0,0,0),t.prototype.set=function(e,t,n,r){return this.red=e,this.green=t,this.blue=n,this.alpha=r,this},t.prototype.copy=function(t){if(!t)throw new ArgumentError(e.logMessage(e.LEVEL_SEVERE,"Color","copy","missingColor"));return this.red=t.red,this.green=t.green,this.blue=t.blue,this.alpha=t.alpha,this},t.prototype.clone=function(){return new t(this.red,this.green,this.blue,this.alpha)},t.prototype.premultipliedComponents=function(e){var t=this.alpha;return e[0]=this.red*t,e[1]=this.green*t,e[2]=this.blue*t,e[3]=t,e},t.colorFromByteArray=function(e){return new t(e[0]/255,e[1]/255,e[2]/255,e[3]/255)},t.colorFromBytes=function(e,n,r,i){return new t(e/255,n/255,r/255,i/255)},t.colorFromHex=function(e){var n=parseInt(e.substring(0,2),16),r=parseInt(e.substring(2,4),16),i=parseInt(e.substring(4,6),16),s=parseInt(e.substring(6,8),16);return t.colorFromBytes(n,r,i,s)},t.colorFromKmlHex=function(e){return e=e.split("").reverse().join(""),t.colorFromHex(e)},t.prototype.nextColor=function(){var e=Math.round(this.red*255),t=Math.round(this.green*255),n=Math.round(this.blue*255);return e<255?this.red=(e+1)/255:t<255?(this.red=0,this.green=(t+1)/255):n<255?(this.red=0,this.green=0,this.blue=(n+1)/255):(this.red=1/255,this.green=0,this.blue=0),this},t.prototype.equals=function(e){var t=Math.round(this.red*255),n=Math.round(this.green*255),r=Math.round(this.blue*255),i=Math.round(this.alpha*255),s=Math.round(e.red*255),o=Math.round(e.green*255),u=Math.round(e.blue*255),a=Math.round(e.alpha*255);return t===s&&n===o&&r===u&&i===a},t.prototype.equalsBytes=function(e){var t=Math.round(this.red*255),n=Math.round(this.green*255),r=Math.round(this.blue*255),i=Math.round(this.alpha*255);return t===e[0]&&n===e[1]&&r===e[2]&&i===e[3]},t.prototype.toByteString=function(){var e=Math.round(this.red*255),t=Math.round(this.green*255),n=Math.round(this.blue*255),r=Math.round(this.alpha*255);return"("+e+","+t+","+n+","+r+")"},t.prototype.toHexString=function(e){var t=Math.ceil(this.red*255).toString(16),n=Math.ceil(this.green*255).toString(16),r=Math.ceil(this.blue*255).toString(16),i=Math.ceil(this.alpha*255).toString(16),s="#";return s+=t.length<2?"0"+t:t,s+=n.length<2?"0"+n:n,s+=r.length<2?"0"+r:r,e&&(s+=i.length<2?"0"+i:i),s},t.prototype.toRGBAString=function(){var e=Math.floor(this.red*255),t=Math.floor(this.green*255),n=Math.floor(this.blue*255);return"rgba("+e+" ,"+t+" ,"+n+" ,"+this.alpha+")"},t}),n("error/ArgumentError",["../error/AbstractError"],function(e){"use strict";var t=function(t){e.call(this,"ArgumentError",t);var n;try{throw new Error}catch(r){n=r.stack}this.stack=n};return t.prototype=Object.create(e.prototype),t}),n("util/Font",["../error/ArgumentError","../util/Color","../util/Logger"],function(e,t,n){"use strict";var r=function(t,r,i,s,o,u){if(!t)throw new e(n.logMessage(n.LEVEL_SEVERE,"Font","constructor","missingSize"));if(t<=0)throw new e(n.logMessage(n.LEVEL_SEVERE,"Font","constructor","invalidSize"));this._size=t,this.style=r||"normal",this.variant=i||"normal",this.weight=s||"normal",this.family=o||"sans-serif",this.horizontalAlignment=u||"center"};return Object.defineProperties(r.prototype,{size:{get:function(){return this._size},set:function(e){this._fontString=null,this._size=e}},style:{get:function(){return this._style},set:function(e){this._fontString=null,this._style=e}},variant:{get:function(){return this._variant},set:function(e){this._fontString=null,this._variant=e}},weight:{get:function(){return this._weight},set:function(e){this._fontString=null,this._weight=e}},family:{get:function(){return this._family},set:function(e){this._fontString=null,this._family=e}},horizontalAlignment:{get:function(){return this._horizontalAlignment},set:function(e){this._toString=null,this._horizontalAlignment=e}},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(){if(!this._toString||!this._fontString)this._toString=this.fontString+" "+this.horizontalAlignment;return this._toString},r}),n("util/Insets",["../error/ArgumentError","../util/Logger"],function(e,t){"use strict";var n=function(n,r,i,s){if(arguments.length!==4)throw new e(t.logMessage(t.LEVEL_SEVERE,"Insets","constructor","invalidArgumentCount"));this._top=n,this._left=r,this._bottom=i,this._right=s};return n.prototype.set=function(e,t,n,r){this._top=e,this._left=t,this._bottom=n,this._right=r},n.prototype.clone=function(){return new n(this._top,this._left,this._bottom,this._right)},n.prototype.toString=function(){return this._top+" "+this._left+" "+this._bottom+" "+this._right},Object.defineProperties(n.prototype,{top:{get:function(){return this._top},set:function(e){this._top=e}},left:{get:function(){return this._left},set:function(e){this._left=e}},bottom:{get:function(){return this._bottom},set:function(e){this._bottom=e}},right:{get:function(){return this._right},set:function(e){this._right=e}}}),n}),n("geom/Vec3",["../util/Logger","../error/ArgumentError"],function(e,t){"use strict";var n=function(t,n,r){this[0]=t,this[1]=n,this[2]=r};return n.prototype=new Float64Array(3),n.ZERO=new n(0,0,0),n.average=function(n,r){if(!n||n.length<1)throw new t(e.logMessage(e.LEVEL_SEVERE,"Vec3","average","missingArray"));if(!r)throw new t(e.logMessage(e.LEVEL_SEVERE,"Vec3","average","missingResult"));var i=n.length,s;r[0]=0,r[1]=0,r[2]=0;for(var o=0,u=n.length;o.999},n.computeTriangleNormal=function(r,i,s){if(!r||!i||!s)throw new t(e.logMessage(e.LEVEL_SEVERE,"Vec3","areColinear","missingVector"));var o=(i[1]-r[1])*(s[2]-r[2])-(i[2]-r[2])*(s[1]-r[1]),u=(i[2]-r[2])*(s[0]-r[0])-(i[0]-r[0])*(s[2]-r[2]),a=(i[0]-r[0])*(s[1]-r[1])-(i[1]-r[1])*(s[0]-r[0]),f=o*o+u*u+a*a;return f===0?new n(o,u,a):(f=Math.sqrt(f),new n(o/f,u/f,a/f))},n.findThreeIndependentVertices=function(e,t){var r=t&&t>0?t:3;if(!e||e.length<3*r)return null;var i=new n(e[0],e[1],e[2]),s=null,o=null,u=r;for(;u0&&s>0?1:0},i.prototype.clip=function(i,s){if(!i||!s)throw new e(n.logMessage(n.LEVEL_SEVERE,"Plane","clip","missingPoint"));if(i.equals(s))return null;var o=t.fromSegment(i,s),u=this.normal.dot(o.direction),a,f,l;return u===0?(a=this.dot(o.origin),a===0?[i,s]:null):(f=-this.dot(o.origin)/u,f<0||f>1?null:(l=o.pointAt(f,new r(0,0,0)),u>0?[l,s]:[i,l]))},i}),n("geom/Rectangle",["../util/Logger"],function(e){"use strict";var t=function(e,t,n,r){this.x=e,this.y=t,this.width=n,this.height=r};return t.prototype.set=function(e,t,n,r){this.x=e,this.y=t,this.width=n,this.height=r},t.prototype.getMinX=function(){return this.x},t.prototype.getMinY=function(){return this.y},t.prototype.getMaxX=function(){return this.x+this.width},t.prototype.getMaxY=function(){return this.y+this.height},t.prototype.containsPoint=function(e){return e[0]>=this.x&&e[0]<=this.x+this.width&&e[1]>=this.y&&e[1]<=this.y+this.height},t.prototype.intersects=function(e){return e.x+e.widththis.x+this.width?!1:e.y+e.heightthis.y+this.height?!1:!0},t.prototype.intersectsRectangles=function(e){if(e)for(var t=0;tn?n:e},interpolate:function(e,t,n){return(1-e)*t+e*n},cbrt:function(e){return typeof Math.cbrt=="function"?Math.cbrt(e):Math.pow(e,1/3)},computeEllipsoidalGlobeIntersection:function(e,n,i,s){if(!e)throw new t(r.logMessage(r.LEVEL_SEVERE,"WWMath","computeEllipsoidalGlobeIntersection","missingLine"));if(!s)throw new t(r.logMessage(r.LEVEL_SEVERE,"WWMath","computeEllipsoidalGlobeIntersection","missingResult"));var o=e.direction[0],u=e.direction[1],a=e.direction[2],f=e.origin[0],l=e.origin[1],c=e.origin[2],h=n/i,p=h*h,d=n*n,v=o*o+p*u*u+a*a,m=2*(f*o+p*l*u+c*a),g=f*f+p*l*l+c*c-d,y=m*m-4*v*g,b;return y<0?!1:(b=(-m-Math.sqrt(y))/(2*v),s[0]=f+o*b,s[1]=l+u*b,s[2]=c+a*b,!0)},computeTriangleIntersection:function(e,n,i,s,o){if(!e)throw new t(r.logMessage(r.LEVEL_SEVERE,"WWMath","computeTriangleIntersection","missingLine"));if(!n||!i||!s)throw new t(r.logMessage(r.LEVEL_SEVERE,"WWMath","computeTriangleIntersection","missingVertex"));if(!o)throw new t(r.logMessage(r.LEVEL_SEVERE,"WWMath","computeTriangleIntersection","missingResult"));var u=e.direction[0],a=e.direction[1],f=e.direction[2],l=e.origin[0],c=e.origin[1],h=e.origin[2],p=1e-5,d=i[0]-n[0],v=i[1]-n[1],m=i[2]-n[2],g=s[0]-n[0],y=s[1]-n[1],b=s[2]-n[2],w=a*b-f*y,E=f*g-u*b,S=u*y-a*g,x=d*w+v*E+m*S;if(x>-p&&x1+p)return!1;var A=C*m-k*v,O=k*d-N*m,M=N*v-C*d,_=T*(u*A+a*O+f*M);if(_<-p||L+_>1+p)return!1;var D=T*(g*A+y*O+b*M);return D<0?!1:(o[0]=l+u*D,o[1]=c+a*D,o[2]=h+f*D,!0)},computeIndexedTrianglesIntersection:function(e,n,i,u){if(!e)throw new t(r.logMessage(r.LEVEL_SEVERE,"WWMath","computeIndexedTrianglesIntersection","missingLine"));if(!n)throw new t(r.logMessage(r.LEVEL_SEVERE,"WWMath","computeIndexedTrianglesIntersection","missingPoints"));if(!i)throw new t(r.logMessage(r.LEVEL_SEVERE,"WWMath","computeIndexedTrianglesIntersection","missingIndices"));if(!u)throw new t(r.logMessage(r.LEVEL_SEVERE,"WWMath","computeIndexedTrianglesIntersection","missingResults"));var a=new s(0,0,0),f=new s(0,0,0),l=new s(0,0,0),c=new s(0,0,0);for(var h=0,p=i.length;h0},computeTriStripIntersections:function(e,n,i,o){if(!e)throw new t(r.logMessage(r.LEVEL_SEVERE,"WWMath","computeTriStripIntersections","missingLine"));if(!n)throw new t(r.logMessage(r.LEVEL_SEVERE,"WWMath","computeTriStripIntersections","missingPoints"));if(!i)throw new t(r.logMessage(r.LEVEL_SEVERE,"WWMath","computeTriStripIntersections","missingIndices"));if(!o)throw new t(r.logMessage(r.LEVEL_SEVERE,"WWMath","computeTriStripIntersections","missingResults"));var u=e.direction[0],a=e.direction[1],f=e.direction[2],l=e.origin[0],c=e.origin[1],h=e.origin[2],p,d,v,m,g,y,b,w,E,S,x,T,N,C,k,L,A,O,M,_,D,P,H,B,j,F,I,q,R,U,z=1e-5;U=3*i[0],m=n[U++],g=n[U++],y=n[U],U=3*i[1],b=n[U++],w=n[U++],E=n[U];for(var W=2,X=i.length;W-z&&q1+z)continue;P=_*T-D*x,H=D*S-M*T,B=M*x-_*S,F=R*(u*P+a*H+f*B);if(F<-z||j+F>1+z)continue;I=R*(N*P+C*H+k*B),I>=0&&o.push(new s(l+u*I,c+a*I,h+f*I))}},fabs:function(e){return e>=0?e:-e},fmod:function(e,t){return t===0?0:e-Math.floor(e/t)*t},fract:function(e){return e-Math.floor(e)},mod:function(e,t){return(e%t+t)%t},max:function(e,t){return e>t?e:t},localCoordinateAxesAtPoint:function(e,n,i,s,o){if(!e)throw new t(r.logMessage(r.LEVEL_SEVERE,"WWMath","localCoordinateAxesAtPoint","missingVector"));if(!n)throw new t(r.logMessage(r.LEVEL_SEVERE,"WWMath","localCoordinateAxesAtPoint","missingGlobe"));if(!i||!s||!o)throw new t(r.logMessage(r.LEVEL_SEVERE,"WWMath","localCoordinateAxesAtPoint","missingResult"));var u=e[0],a=e[1],f=e[2];n.surfaceNormalAtPoint(u,a,f,o),n.northTangentAtPoint(u,a,f,s),i.set(s[0],s[1],s[2]),i.cross(o),i.normalize(),s.set(o[0],o[1],o[2]),s.cross(i),s.normalize()},horizonDistanceForGlobeRadius:function(e,n){if(e<0)throw new t(r.logMessage(r.LEVEL_SEVERE,"WWMath","horizontalDistanceForGlobeRadius","The specified globe radius is negative."));return e>0&&n>0?Math.sqrt(n*(2*e+n)):0},perspectiveNearDistanceForFarDistance:function(e,n,i){if(e<0)throw new t(r.logMessage(r.LEVEL_SEVERE,"WWMath","perspectiveNearDistanceForFarDistance","The specified distance is negative."));if(n<0)throw new t(r.logMessage(r.LEVEL_SEVERE,"WWMath","perspectiveNearDistanceForFarDistance","The specified resolution is negative."));if(i<1)throw new t(r.logMessage(r.LEVEL_SEVERE,"WWMath","perspectiveNearDistanceForFarDistance","The specified depth bits is negative."));var s=(1<0?1:e<0?-1:0},gudermannianInverse:function(t){return Math.log(Math.tan(Math.PI/4+t*e.DEGREES_TO_RADIANS/2))/Math.PI},epsg3857ToEpsg4326:function(t,n){var r=6378100,i=Math.PI/2-2*Math.atan(Math.exp(-n/r)),s=t/r;return[o.clamp(i*e.RADIANS_TO_DEGREES,-90,90),o.clamp(s*e.RADIANS_TO_DEGREES,-180,180)]},powerOfTwoFloor:function(e){var t=Math.floor(Math.log(e)/Math.log(2));return Math.pow(2,t)}};return o}),n("geom/Location",["../geom/Angle","../error/ArgumentError","../util/Logger","../geom/Plane","../geom/Vec3","../util/WWMath"],function(e,t,n,r,i,s){"use strict";var o=function(e,t){this.latitude=e,this.longitude=t};return o.ZERO=new o(0,0),o.fromRadians=function(t,n){return new o(t*e.RADIANS_TO_DEGREES,n*e.RADIANS_TO_DEGREES)},o.prototype.copy=function(e){if(!e)throw new t(n.logMessage(n.LEVEL_SEVERE,"Location","copy","missingLocation"));return this.latitude=e.latitude,this.longitude=e.longitude,this},o.prototype.set=function(e,t){return this.latitude=e,this.longitude=t,this},o.prototype.equals=function(e){return e&&e.latitude===this.latitude&&e.longitude===this.longitude},o.interpolateAlongPath=function(e,r,i,s,o){if(!i||!s)throw new t(n.logMessage(n.LEVEL_SEVERE,"Location","interpolateAlongPath","missingLocation"));if(!o)throw new t(n.logMessage(n.LEVEL_SEVERE,"Location","interpolateAlongPath","missingResult"));return e===WorldWind.GREAT_CIRCLE?this.interpolateGreatCircle(r,i,s,o):e&&e===WorldWind.RHUMB_LINE?this.interpolateRhumb(r,i,s,o):this.interpolateLinear(r,i,s,o)},o.interpolateGreatCircle=function(e,r,i,o){if(!r||!i)throw new t(n.logMessage(n.LEVEL_SEVERE,"Location","interpolateGreatCircle","missingLocation"));if(!o)throw new t(n.logMessage(n.LEVEL_SEVERE,"Location","interpolateGreatCircle","missingResult"));if(r.equals(i))return o.latitude=r.latitude,o.longitude=r.longitude,o;var u=s.clamp(e,0,1),a=this.greatCircleAzimuth(r,i),f=this.greatCircleDistance(r,i);return this.greatCircleLocation(r,a,u*f,o)},o.greatCircleAzimuth=function(r,i){if(!r||!i)throw new t(n.logMessage(n.LEVEL_SEVERE,"Location","greatCircleAzimuth","missingLocation"));var s=r.latitude*e.DEGREES_TO_RADIANS,o=i.latitude*e.DEGREES_TO_RADIANS,u=r.longitude*e.DEGREES_TO_RADIANS,a=i.longitude*e.DEGREES_TO_RADIANS,f,l,c;return s==o&&u==a?0:u==a?s>o?180:0:(l=Math.cos(o)*Math.sin(a-u),f=Math.cos(s)*Math.sin(o)-Math.sin(s)*Math.cos(o)*Math.cos(a-u),c=Math.atan2(l,f),isNaN(c)?0:c*e.RADIANS_TO_DEGREES)},o.greatCircleDistance=function(r,i){if(!r||!i)throw new t(n.logMessage(n.LEVEL_SEVERE,"Location","greatCircleDistance","missingLocation"));var s=r.latitude*e.DEGREES_TO_RADIANS,o=i.latitude*e.DEGREES_TO_RADIANS,u=r.longitude*e.DEGREES_TO_RADIANS,a=i.longitude*e.DEGREES_TO_RADIANS,f,l,c,h;return s==o&&u==a?0:(f=Math.sin((o-s)/2),l=Math.sin((a-u)/2),c=f*f+Math.cos(s)*Math.cos(o)*l*l,h=2*Math.asin(Math.sqrt(c)),isNaN(h)?0:h)},o.greatCircleLocation=function(r,i,s,o){if(!r)throw new t(n.logMessage(n.LEVEL_SEVERE,"Location","greatCircleLocation","missingLocation"));if(!o)throw new t(n.logMessage(n.LEVEL_SEVERE,"Location","greatCircleLocation","missingResult"));if(s==0)return o.latitude=r.latitude,o.longitude=r.longitude,o;var u=r.latitude*e.DEGREES_TO_RADIANS,a=r.longitude*e.DEGREES_TO_RADIANS,f=i*e.DEGREES_TO_RADIANS,l,c;return l=Math.asin(Math.sin(u)*Math.cos(s)+Math.cos(u)*Math.sin(s)*Math.cos(f)),c=a+Math.atan2(Math.sin(s)*Math.sin(f),Math.cos(u)*Math.cos(s)-Math.sin(u)*Math.sin(s)*Math.cos(f)),isNaN(l)||isNaN(c)?(o.latitude=r.latitude,o.longitude=r.longitude):(o.latitude=e.normalizedDegreesLatitude(l*e.RADIANS_TO_DEGREES),o.longitude=e.normalizedDegreesLongitude(c*e.RADIANS_TO_DEGREES)),o},o.interpolateRhumb=function(e,r,i,o){if(!r||!i)throw new t(n.logMessage(n.LEVEL_SEVERE,"Location","interpolateRhumb","missingLocation"));if(!o)throw new t(n.logMessage(n.LEVEL_SEVERE,"Location","interpolateRhumb","missingResult"));if(r.equals(i))return o.latitude=r.latitude,o.longitude=r.longitude,o;var u=s.clamp(e,0,1),a=this.rhumbAzimuth(r,i),f=this.rhumbDistance(r,i);return this.rhumbLocation(r,a,u*f,o)},o.rhumbAzimuth=function(r,i){if(!r||!i)throw new t(n.logMessage(n.LEVEL_SEVERE,"Location","rhumbAzimuth","missingLocation"));var o=r.latitude*e.DEGREES_TO_RADIANS,u=i.latitude*e.DEGREES_TO_RADIANS,a=r.longitude*e.DEGREES_TO_RADIANS,f=i.longitude*e.DEGREES_TO_RADIANS,l,c,h;return o==u&&a==f?0:(l=f-a,c=Math.log(Math.tan(u/2+Math.PI/4)/Math.tan(o/2+Math.PI/4)),s.fabs(l)>Math.PI&&(l=l>0?-(2*Math.PI-l):2*Math.PI+l),h=Math.atan2(l,c),isNaN(h)?0:h*e.RADIANS_TO_DEGREES)},o.rhumbDistance=function(r,i){if(!r||!i)throw new t(n.logMessage(n.LEVEL_SEVERE,"Location","rhumbDistance","missingLocation"));var o=r.latitude*e.DEGREES_TO_RADIANS,u=i.latitude*e.DEGREES_TO_RADIANS,a=r.longitude*e.DEGREES_TO_RADIANS,f=i.longitude*e.DEGREES_TO_RADIANS,l,c,h,p,d;if(o==u&&a==f)return 0;l=u-o,c=f-a,h=Math.log(Math.tan(u/2+Math.PI/4)/Math.tan(o/2+Math.PI/4)),p=l/h;if(isNaN(h)||isNaN(p))p=Math.cos(o);return s.fabs(c)>Math.PI&&(c=c>0?-(2*Math.PI-c):2*Math.PI+c),d=Math.sqrt(l*l+p*p*c*c),isNaN(d)?0:d},o.rhumbLocation=function(r,i,o,u){if(!r)throw new t(n.logMessage(n.LEVEL_SEVERE,"Location","rhumbLocation","missingLocation"));if(!u)throw new t(n.logMessage(n.LEVEL_SEVERE,"Location","rhumbLocation","missingResult"));if(o==0)return u.latitude=r.latitude,u.longitude=r.longitude,u;var a=r.latitude*e.DEGREES_TO_RADIANS,f=r.longitude*e.DEGREES_TO_RADIANS,l=i*e.DEGREES_TO_RADIANS,c=a+o*Math.cos(l),h=Math.log(Math.tan(c/2+Math.PI/4)/Math.tan(a/2+Math.PI/4)),p=(c-a)/h,d,v;if(isNaN(h)||isNaN(p)||!isFinite(p))p=Math.cos(a);return d=o*Math.sin(l)/p,s.fabs(c)>Math.PI/2&&(c=c>0?Math.PI-c:-Math.PI-c),v=s.fmod(f+d+Math.PI,2*Math.PI)-Math.PI,isNaN(c)||isNaN(v)?(u.latitude=r.latitude,u.longitude=r.longitude):(u.latitude=e.normalizedDegreesLatitude(c*e.RADIANS_TO_DEGREES),u.longitude=e.normalizedDegreesLongitude(v*e.RADIANS_TO_DEGREES)),u},o.interpolateLinear=function(e,r,i,o){if(!r||!i)throw new t(n.logMessage(n.LEVEL_SEVERE,"Location","interpolateLinear","missingLocation"));if(!o)throw new t(n.logMessage(n.LEVEL_SEVERE,"Location","interpolateLinear","missingResult"));if(r.equals(i))return o.latitude=r.latitude,o.longitude=r.longitude,o;var u=s.clamp(e,0,1),a=this.linearAzimuth(r,i),f=this.linearDistance(r,i);return this.linearLocation(r,a,u*f,o)},o.linearAzimuth=function(r,i){if(!r||!i)throw new t(n.logMessage(n.LEVEL_SEVERE,"Location","linearAzimuth","missingLocation"));var o=r.latitude*e.DEGREES_TO_RADIANS,u=i.latitude*e.DEGREES_TO_RADIANS,a=r.longitude*e.DEGREES_TO_RADIANS,f=i.longitude*e.DEGREES_TO_RADIANS,l,c,h;return o==u&&a==f?0:(l=f-a,c=u-o,s.fabs(l)>Math.PI&&(l=l>0?-(2*Math.PI-l):2*Math.PI+l),h=Math.atan2(l,c),isNaN(h)?0:h*e.RADIANS_TO_DEGREES)},o.linearDistance=function(r,i){if(!r||!i)throw new t(n.logMessage(n.LEVEL_SEVERE,"Location","linearDistance","missingLocation"));var o=r.latitude*e.DEGREES_TO_RADIANS,u=i.latitude*e.DEGREES_TO_RADIANS,a=r.longitude*e.DEGREES_TO_RADIANS,f=i.longitude*e.DEGREES_TO_RADIANS,l,c,h;return o==u&&a==f?0:(l=u-o,c=f-a,s.fabs(c)>Math.PI&&(c=c>0?-(2*Math.PI-c):2*Math.PI+c),h=Math.sqrt(l*l+c*c),isNaN(h)?0:h)},o.linearLocation=function(r,i,o,u){if(!r)throw new t(n.logMessage(n.LEVEL_SEVERE,"Location","linearLocation","missingLocation"));if(!u)throw new t(n.logMessage(n.LEVEL_SEVERE,"Location","linearLocation","missingResult"));if(o==0)return u.latitude=r.latitude,u.longitude=r.longitude,u;var a=r.latitude*e.DEGREES_TO_RADIANS,f=r.longitude*e.DEGREES_TO_RADIANS,l=i*e.DEGREES_TO_RADIANS,c=a+o*Math.cos(l),h;return s.fabs(c)>Math.PI/2&&(c=c>0?Math.PI-c:-Math.PI-c),h=s.fmod(f+o*Math.sin(l)+Math.PI,2*Math.PI)-Math.PI,isNaN(c)||isNaN(h)?(u.latitude=r.latitude,u.longitude=r.longitude):(u.latitude=e.normalizedDegreesLatitude(c*e.RADIANS_TO_DEGREES),u.longitude=e.normalizedDegreesLongitude(h*e.RADIANS_TO_DEGREES)),u},o.locationsCrossDateLine=function(e){if(!e)throw new t(n.logMessage(n.LEVEL_SEVERE,"Location","locationsCrossDateline","missingLocation"));var r=null;for(var i=0,o=e.length;i180&&a<360)return!0}r=u}return!1},o.greatCircleArcExtremeLocations=function(e){if(!e)throw new t(n.logMessage(n.LEVEL_SEVERE,"Location","greatCircleArcExtremeLocations","missingLocation"));var r=null,i=null,s=null;for(var u=0,a=e.length;ul[0].latitude)r=l[0];if(i==null||i.latitude=a.latitude&&(c=a.latitude,f=a),h<=a.latitude&&(h=a.latitude,l=a);var d=o.greatCircleAzimuth(e,r),v=o.greatCircleDistance(e,r),m=o.greatCircleExtremeLocationsUsingAzimuth(e,d);for(i=0,u=m.length;i=0&&y<=v&&(c>=a.latitude&&(c=a.latitude,f=a),h<=a.latitude&&(h=a.latitude,l=a))}return[f,l]},o.greatCircleExtremeLocationsUsingAzimuth=function(r,i){if(!r)throw new t(n.logMessage(n.LEVEL_SEVERE,"Location","greatCircleArcExtremeLocationsUsingAzimuth","missingLocation"));var s=r.latitude,u=i*e.DEGREES_TO_RADIANS,a=-Math.tan(s)/Math.cos(u),f=Math.atan(a),l=f+Math.PI/2,c=f-Math.PI/2;return[o.greatCircleLocation(r,i,l,new o(0,0)),o.greatCircleLocation(r,i,c,new o(0,0))]},o.intersectionWithMeridian=function(e,t,n,s){var o=s.computePointFromLocation(e.latitude,e.longitude,new i(0,0,0)),u=s.computePointFromLocation(t.latitude,t.longitude,new i(0,0,0)),a=s.computePointFromLocation(90,n,new i(0,0,0)),f=s.computePointFromLocation(0,n,new i(0,0,0)),l=r.fromPoints(a,f,i.ZERO),c=new i(0,0,0);if(!l.intersectsSegmentAt(o,u,c))return null;var h=new WorldWind.Position(0,0,0);return s.computePositionFromPoint(c[0],c[1],c[2],h),h.latitude},o.poles={NONE:0,NORTH:1,SOUTH:2},o}),n("geom/Position",["../geom/Angle","../error/ArgumentError","../geom/Location","../util/Logger","../util/WWMath"],function(e,t,n,r,i){"use strict";var s=function(e,t,n){this.latitude=e,this.longitude=t,this.altitude=n};return s.ZERO=new s(0,0,0),s.fromRadians=function(t,n,r){return new s(t*e.RADIANS_TO_DEGREES,n*e.RADIANS_TO_DEGREES,r)},s.prototype.copy=function(e){if(!e)throw new t(r.logMessage(r.LEVEL_SEVERE,"Position","copy","missingPosition"));return this.latitude=e.latitude,this.longitude=e.longitude,this.altitude=e.altitude,this},s.prototype.equals=function(e){return e&&e.latitude===this.latitude&&e.longitude===this.longitude&&e.altitude===this.altitude},s.interpolateGreatCircle=function(e,s,o,u){if(!s||!o)throw new t(r.logMessage(r.LEVEL_SEVERE,"Position","interpolateGreatCircle","missingPosition"));if(!u)throw new t(r.logMessage(r.LEVEL_SEVERE,"Position","interpolateGreatCircle","missingResult"));var a=i.clamp(e,0,1);return u.altitude=i.interpolate(a,s.altitude,o.altitude),n.interpolateGreatCircle(a,s,o,u),u},s.interpolateRhumb=function(e,s,o,u){if(!s||!o)throw new t(r.logMessage(r.LEVEL_SEVERE,"Position","interpolateRhumb","missingPosition"));if(!u)throw new t(r.logMessage(r.LEVEL_SEVERE,"Position","interpolateRhumb","missingResult"));var a=i.clamp(e,0,1);return u.altitude=i.interpolate(a,s.altitude,o.altitude),n.interpolateRhumb(a,s,o,u),u},s.interpolateLinear=function(e,s,o,u){if(!s||!o)throw new t(r.logMessage(r.LEVEL_SEVERE,"Position","interpolateLinear","missingPosition"));if(!u)throw new t(r.logMessage(r.LEVEL_SEVERE,"Position","interpolateLinear","missingResult"));var a=i.clamp(e,0,1);return u.altitude=i.interpolate(a,s.altitude,o.altitude),n.interpolateLinear(a,s,o,u),u},s.prototype.toString=function(){return"("+this.latitude.toString()+"°, "+this.longitude.toString()+"°, "+this.altitude.toString()},s}),n("render/Texture",["../error/ArgumentError","../util/Logger","../util/WWMath"],function(e,t,n){"use strict";var r=function(r,i,s){if(!r)throw new e(t.logMessage(t.LEVEL_SEVERE,"Texture","constructor","missingGlContext"));if(!i)throw new e(t.logMessage(t.LEVEL_SEVERE,"Texture","constructor","missingImage"));s||(s=r.CLAMP_TO_EDGE);var o=r.createTexture(),u=n.isPowerOfTwo(i.width)&&n.isPowerOfTwo(i.height);this.originalImageWidth=i.width,this.originalImageHeight=i.height,s===r.REPEAT&&!u&&(i=this.resizeImage(i),u=!0),this.imageWidth=i.width,this.imageHeight=i.height,this.size=i.width*i.height*4,r.bindTexture(r.TEXTURE_2D,o),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,u?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,s),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,s);var a=r.getExtension("EXT_texture_filter_anisotropic")||r.getExtension("WEBKIT_EXT_texture_filter_anisotropic");a&&r.texParameteri(r.TEXTURE_2D,a.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,i),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,0),u&&r.generateMipmap(r.TEXTURE_2D),this.textureId=o,this.creationTime=new Date};return r.prototype.dispose=function(e){e.deleteTexture(this.textureId),delete this.textureId},r.prototype.bind=function(e){return e.currentGlContext.bindTexture(e.currentGlContext.TEXTURE_2D,this.textureId),e.frameStatistics.incrementTextureLoadCount(1),!0},r.prototype.resizeImage=function(e){var t=document.createElement("canvas");t.width=n.powerOfTwoFloor(e.width),t.height=n.powerOfTwoFloor(e.height);var r=t.getContext("2d");return r.drawImage(e,0,0,t.width,t.height),t},r}),n("geom/Matrix",["../geom/Angle","../error/ArgumentError","../util/Logger","../geom/Plane","../geom/Position","../geom/Rectangle","../render/Texture","../geom/Vec3","../util/WWMath"],function(e,t,n,r,i,s,o,u,a){"use strict";var f=function(e,t,n,r,i,s,o,u,a,f,l,c,h,p,d,v){this[0]=e,this[1]=t,this[2]=n,this[3]=r,this[4]=i,this[5]=s,this[6]=o,this[7]=u,this[8]=a,this[9]=f,this[10]=l,this[11]=c,this[12]=h,this[13]=p,this[14]=d,this[15]=v};return f.prototype=new Float64Array(16),f.fromIdentity=function(){return new f(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)},f.principalAxesFromPoints=function(e,r,i,s){if(!e||e.length<1)throw new t(n.logMessage(n.LEVEL_SEVERE,"Matrix","principalAxesFromPoints","missingPoints"));if(!r||!i||!s)throw new t(n.logMessage(n.LEVEL_SEVERE,"Matrix","principalAxesFromPoints","An axis argument is null or undefined."));var o=f.fromIdentity();o.setToCovarianceOfPoints(e),o.eigensystemFromSymmetricMatrix(r,i,s),r.normalize(),i.normalize(),s.normalize()},f.prototype.set=function(e,t,n,r,i,s,o,u,a,f,l,c,h,p,d,v){return this[0]=e,this[1]=t,this[2]=n,this[3]=r,this[4]=i,this[5]=s,this[6]=o,this[7]=u,this[8]=a,this[9]=f,this[10]=l,this[11]=c,this[12]=h,this[13]=p,this[14]=d,this[15]=v,this},f.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},f.prototype.copy=function(e){if(!e)throw new t(n.logMessage(n.LEVEL_SEVERE,"Matrix","copy","missingMatrix"));this[0]=e[0],this[1]=e[1],this[2]=e[2],this[3]=e[3],this[4]=e[4],this[5]=e[5],this[6]=e[6],this[7]=e[7],this[8]=e[8],this[9]=e[9],this[10]=e[10],this[11]=e[11],this[12]=e[12],this[13]=e[13],this[14]=e[14],this[15]=e[15]},f.prototype.equals=function(e){return e&&this[0]==e[0]&&this[1]==e[1]&&this[2]==e[2]&&this[3]==e[3]&&this[4]==e[4]&&this[5]==e[5]&&this[6]==e[6]&&this[7]==e[7]&&this[8]==e[8]&&this[9]==e[9]&&this[10]==e[10]&&this[11]==e[11]&&this[12]==e[12]&&this[13]==e[13]&&this[14]==e[14]&&this[15]==e[15]},f.prototype.columnMajorComponents=function(e){if(!e)throw new t(n.logMessage(n.LEVEL_SEVERE,"Matrix","columnMajorComponents","missingResult"));return e[0]=this[0],e[1]=this[4],e[2]=this[8],e[3]=this[12],e[4]=this[1],e[5]=this[5],e[6]=this[9],e[7]=this[13],e[8]=this[2],e[9]=this[6],e[10]=this[10],e[11]=this[14],e[12]=this[3],e[13]=this[7],e[14]=this[11],e[15]=this[15],e},f.prototype.setToTranslation=function(e,t,n){return this[0]=1,this[1]=0,this[2]=0,this[3]=e,this[4]=0,this[5]=1,this[6]=0,this[7]=t,this[8]=0,this[9]=0,this[10]=1,this[11]=n,this[12]=0,this[13]=0,this[14]=0,this[15]=1,this},f.prototype.setTranslation=function(e,t,n){return this[3]=e,this[7]=t,this[11]=n,this},f.prototype.setToScale=function(e,t,n){return this[0]=e,this[1]=0,this[2]=0,this[3]=0,this[4]=0,this[5]=t,this[6]=0,this[7]=0,this[8]=0,this[9]=0,this[10]=n,this[11]=0,this[12]=0,this[13]=0,this[14]=0,this[15]=1,this},f.prototype.setScale=function(e,t,n){return this[0]=e,this[5]=t,this[10]=n,this},f.prototype.setToTransposeOfMatrix=function(e){if(!e)throw new t(n.logMessage(n.LEVEL_SEVERE,"Matrix","setToTransposeOfMatrix","missingMatrix"));return this[0]=e[0],this[1]=e[4],this[2]=e[8],this[3]=e[12],this[4]=e[1],this[5]=e[5],this[6]=e[9],this[7]=e[13],this[8]=e[2],this[9]=e[6],this[10]=e[10],this[11]=e[14],this[12]=e[3],this[13]=e[7],this[14]=e[11],this[15]=e[15],this},f.prototype.setToMultiply=function(e,r){if(!e||!r)throw new t(n.logMessage(n.LEVEL_SEVERE,"Matrix","setToMultiply","missingMatrix"));var i=e,s=r;return this[0]=i[0]*s[0]+i[1]*s[4]+i[2]*s[8]+i[3]*s[12],this[1]=i[0]*s[1]+i[1]*s[5]+i[2]*s[9]+i[3]*s[13],this[2]=i[0]*s[2]+i[1]*s[6]+i[2]*s[10]+i[3]*s[14],this[3]=i[0]*s[3]+i[1]*s[7]+i[2]*s[11]+i[3]*s[15],this[4]=i[4]*s[0]+i[5]*s[4]+i[6]*s[8]+i[7]*s[12],this[5]=i[4]*s[1]+i[5]*s[5]+i[6]*s[9]+i[7]*s[13],this[6]=i[4]*s[2]+i[5]*s[6]+i[6]*s[10]+i[7]*s[14],this[7]=i[4]*s[3]+i[5]*s[7]+i[6]*s[11]+i[7]*s[15],this[8]=i[8]*s[0]+i[9]*s[4]+i[10]*s[8]+i[11]*s[12],this[9]=i[8]*s[1]+i[9]*s[5]+i[10]*s[9]+i[11]*s[13],this[10]=i[8]*s[2]+i[9]*s[6]+i[10]*s[10]+i[11]*s[14],this[11]=i[8]*s[3]+i[9]*s[7]+i[10]*s[11]+i[11]*s[15],this[12]=i[12]*s[0]+i[13]*s[4]+i[14]*s[8]+i[15]*s[12],this[13]=i[12]*s[1]+i[13]*s[5]+i[14]*s[9]+i[15]*s[13],this[14]=i[12]*s[2]+i[13]*s[6]+i[14]*s[10]+i[15]*s[14],this[15]=i[12]*s[3]+i[13]*s[7]+i[14]*s[11]+i[15]*s[15],this},f.prototype.setToCovarianceOfPoints=function(e){if(!e||e.length<1)throw new t(n.logMessage(n.LEVEL_SEVERE,"Matrix","setToCovarianceOfPoints","missingArray"));var r,i,s,o,a=0,f=0,l=0,c=0,h=0,p=0,d=0,v=new u(0,0,0);r=u.averageOfBuffer(e,new u(0,0,0));for(var m=0,g=e.length/3;m=0;i-=1){o=n[i];for(s=i+1;s<4;s+=1)o-=e[i][s]*n[s];n[i]=o/e[i][i]}},f.ludcmp=function(e,t){var n=1e-20,r=[],i=1,s,o,u,a,f,l,c,h;for(o=0;o<4;o+=1){f=0;for(u=0;u<4;u+=1)(s=Math.abs(e[o][u]))>f&&(f=s);if(f==0)return 0;r[o]=1/f}for(u=0;u<4;u+=1){for(o=0;o=f&&(f=h,c=o)}if(u!=c){for(a=0;a<4;a+=1)h=e[c][a],e[c][a]=e[u][a],e[u][a]=h;i=-i,r[c]=r[u]}t[u]=c,e[u][u]==0&&(e[u][u]=n);if(u!=3){h=1/e[u][u];for(o=u+1;o<4;o+=1)e[o][u]*=h}}return i},f.prototype.invertOrthonormalMatrix=function(e){if(!e)throw new t(n.logMessage(n.LEVEL_SEVERE,"Matrix","invertOrthonormalMatrix","missingMatrix"));var r=e;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},f.prototype.eigensystemFromSymmetricMatrix=function(e,r,i){if(!e||!r||!i)throw new t(n.logMessage(n.LEVEL_SEVERE,"Matrix","eigensystemFromSymmetricMatrix","missingResult"));if(this[1]!=this[4]||this[2]!=this[8]||this[6]!=this[9])throw new t(n.logMessage(n.LEVEL_SEVERE,"Matrix","eigensystemFromSymmetricMatrix","Matrix is not symmetric"));var s=1e-10,o=this[0],u=this[1],f=this[2],l=this[5],c=this[6],h=this[10],p=[[1,0,0],[0,1,0],[0,0,1]],d=32,v,m,g,y,b,w,E,S,x,T,N;for(var C=0;C=this.minActiveAltitude&&t.altitude<=this.maxActiveAltitude:!1},t.prototype.isLayerInView=function(e){return!0},t}),n("geom/Matrix3",["../error/ArgumentError","../util/Logger"],function(e,t){"use strict";var n=function(e,t,n,r,i,s,o,u,a){this[0]=e,this[1]=t,this[2]=n,this[3]=r,this[4]=i,this[5]=s,this[6]=o,this[7]=u,this[8]=a};return n.prototype=new Float64Array(9),n.fromIdentity=function(){return new n(1,0,0,0,1,0,0,0,1)},n.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},n.prototype.multiplyMatrix=function(n){if(!n)throw new e(t.logMessage(t.LEVEL_SEVERE,"Matrix3","multiplyMatrix","missingMatrix"));var r=this,i=n,s,o,u;return s=r[0],o=r[1],u=r[2],r[0]=s*i[0]+o*i[3]+u*i[6],r[1]=s*i[1]+o*i[4]+u*i[7],r[2]=s*i[2]+o*i[5]+u*i[8],s=r[3],o=r[4],u=r[5],r[3]=s*i[0]+o*i[3]+u*i[6],r[4]=s*i[1]+o*i[4]+u*i[7],r[5]=s*i[2]+o*i[5]+u*i[8],s=r[6],o=r[7],u=r[8],r[6]=s*i[0]+o*i[3]+u*i[6],r[7]=s*i[1]+o*i[4]+u*i[7],r[8]=s*i[2]+o*i[5]+u*i[8],this},n.prototype.multiplyByTileTransform=function(e,t){var n=e.deltaLatitude(),r=e.deltaLongitude(),i=t.deltaLatitude(),s=t.deltaLongitude(),o=r/s,u=n/i,a=(e.minLongitude-t.minLongitude)/s,f=(e.minLatitude-t.minLatitude)/i,l=this;return l[2]+=l[0]*a+l[1]*f,l[5]+=l[3]*a+l[4]*f,l[8]+=l[6]*a+l[6]*f,l[0]*=o,l[1]*=u,l[3]*=o,l[4]*=u,l[6]*=o,l[7]*=u,this},n.prototype.columnMajorComponents=function(n){if(!n)throw new e(t.logMessage(t.LEVEL_SEVERE,"Matrix3","columnMajorComponents","missingResult"));return n[0]=this[0],n[1]=this[3],n[2]=this[6],n[3]=this[1],n[4]=this[4],n[5]=this[7],n[6]=this[2],n[7]=this[5],n[8]=this[8],n},n}),n("geom/Sector",["../geom/Angle","../error/ArgumentError","../geom/Location","../util/Logger","../geom/Vec3","../util/WWMath"],function(e,t,n,r,i,s){"use strict";var o=function(e,t,n,r){this.minLatitude=e,this.maxLatitude=t,this.minLongitude=n,this.maxLongitude=r};return o.ZERO=new o(0,0,0,0),o.FULL_SPHERE=new o(-90,90,-180,180),o.prototype.copy=function(e){if(!e)throw new t(r.logMessage(r.LEVEL_SEVERE,"Sector","copy","missingSector"));return this.minLatitude=e.minLatitude,this.maxLatitude=e.maxLatitude,this.minLongitude=e.minLongitude,this.maxLongitude=e.maxLongitude,this},o.prototype.isEmpty=function(){return this.minLatitude===this.maxLatitude&&this.minLongitude===this.maxLongitude},o.prototype.deltaLatitude=function(){return this.maxLatitude-this.minLatitude},o.prototype.deltaLongitude=function(){return this.maxLongitude-this.minLongitude},o.prototype.centroidLatitude=function(){return.5*(this.minLatitude+this.maxLatitude)},o.prototype.centroidLongitude=function(){return.5*(this.minLongitude+this.maxLongitude)},o.prototype.centroid=function(e){if(!e)throw new t(r.logMessage(r.LEVEL_SEVERE,"Sector","centroid","missingResult"));return e.latitude=this.centroidLatitude(),e.longitude=this.centroidLongitude(),e},o.prototype.minLatitudeRadians=function(){return this.minLatitude*e.DEGREES_TO_RADIANS},o.prototype.maxLatitudeRadians=function(){return this.maxLatitude*e.DEGREES_TO_RADIANS},o.prototype.minLongitudeRadians=function(){return this.minLongitude*e.DEGREES_TO_RADIANS},o.prototype.maxLongitudeRadians=function(){return this.maxLongitude*e.DEGREES_TO_RADIANS},o.prototype.setToBoundingSector=function(e){if(!e||e.length<2)throw new t(r.logMessage(r.LEVEL_SEVERE,"Sector","setToBoundingSector","missingArray"));var n=90,i=-90,s=180,o=-180;for(var u=0,a=e.length;uu&&(u=p);var d=h.longitude;d>=0&&da&&(a=d);if(f!=null){var v=f.longitude;s.signum(d)!=s.signum(v)&&Math.abs(d-v)<180&&(a=0,i=0)}f=h}return n===u&&i===a?null:[new o(n,u,i,180),new o(n,u,-180,a)]},o.prototype.intersects=function(e){return e&&this.minLongitude<=e.maxLongitude&&this.maxLongitude>=e.minLongitude&&this.minLatitude<=e.maxLatitude&&this.maxLatitude>=e.minLatitude},o.prototype.overlaps=function(e){return e&&this.minLongitudee.minLongitude&&this.minLatitudee.minLatitude},o.prototype.contains=function(e){return e&&this.minLatitude<=e.minLatitude&&this.maxLatitude>=e.maxLatitude&&this.minLongitude<=e.minLongitude&&this.maxLongitude>=e.maxLongitude},o.prototype.containsLocation=function(e,t){return this.minLatitude<=e&&this.maxLatitude>=e&&this.minLongitude<=t&&this.maxLongitude>=t},o.prototype.intersection=function(e){if(!e instanceof o)throw new t(r.logMessage(r.LEVEL_SEVERE,"Sector","intersection","missingSector"));return this.minLatitudee.maxLatitude&&(this.maxLatitude=e.maxLatitude),this.minLongitudee.maxLongitude&&(this.maxLongitude=e.maxLongitude),this.maxLatitudee.minLatitude&&(this.minLatitude=e.minLatitude),this.maxLatitudee.minLongitude&&(this.minLongitude=e.minLongitude),this.maxLongitude0&&(i=i+"/"+r[s]);return e+"//"+t+i},worldwindlibLocation:function(){var e=document.getElementsByTagName("script"),t="/worldwind.";for(var n=0;n=0)return e[n].src.substring(0,r)+"/"}return null},urlPath:function(e){if(!e)return"";var t=e.split("/"),n="";for(var r=0,i=t.length;r=this.dates.length-1?null:(this.currentIndex++,this.currentTime=this.dates[this.currentIndex],this.currentTime)},n.prototype.previous=function(){return this.currentIndex<=0?null:(this.currentIndex--,this.currentTime=this.dates[this.currentIndex],this.currentTime)},n.prototype.reset=function(){this.currentIndex=-1,this.currentTime=null},n.prototype.getTimeForScale=function(e){return e<=0?this.currentIndex=0:e>=1?this.currentIndex=this.dates.length-1:this.currentIndex=Math.floor(this.dates.length*e),this.currentTime=this.dates[this.currentIndex],this.currentTime},n}),n("util/AbsentResourceList",[],function(){"use strict";var e=function(e,t){this.maxTrys=e,this.minCheckInterval=t,this.tryAgainInterval=6e4,this.possiblyAbsent={}};return e.prototype.isResourceAbsent=function(e){var t=this.possiblyAbsent[e];if(!t)return!1;if(t.permanent)return!0;var n=Date.now()-t.timeOfLastMark;return n>this.tryAgainInterval?(delete this.possiblyAbsent[e],!1):nthis.maxTrys},e.prototype.markResourceAbsent=function(e){var t=this.possiblyAbsent[e];t||(t={timeOfLastMark:Date.now(),numTrys:0},this.possiblyAbsent[e]=t),t.numTrys=t.numTrys+1,t.timeOfLastMark=Date.now()},e.prototype.markResourceAbsentPermanently=function(e){var t=this.possiblyAbsent[e];t||(t={timeOfLastMark:Date.now(),numTrys:0},this.possiblyAbsent[e]=t),t.numTrys=t.numTrys+1,t.timeOfLastMark=Date.now(),t.permanent=!0},e.prototype.unmarkResourceAbsent=function(e){var t=this.possiblyAbsent[e];t&&delete this.possiblyAbsent[e]},e}),n("geom/Frustum",["../error/ArgumentError","../geom/Matrix","../geom/Plane","../util/Logger"],function(e,t,n,r){"use strict";var i=function(t,n,i,s,o,u){if(!t||!n||!i||!s||!o||!u)throw new e(r.logMessage(r.LEVEL_SEVERE,"Frustum","constructor","missingPlane"));this._left=t,this._right=n,this._bottom=i,this._top=s,this._near=o,this._far=u,this._planes=[this._left,this._right,this._top,this._bottom,this._near,this._far]};return Object.defineProperties(i.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}}}),i.prototype.transformByMatrix=function(t){if(!t)throw new e(r.logMessage(r.LEVEL_SEVERE,"Frustum","transformByMatrix","missingMatrix"));return this._left.transformByMatrix(t),this._right.transformByMatrix(t),this._bottom.transformByMatrix(t),this._top.transformByMatrix(t),this._near.transformByMatrix(t),this._far.transformByMatrix(t),this},i.prototype.normalize=function(){return this._left.normalize(),this._right.normalize(),this._bottom.normalize(),this._top.normalize(),this._near.normalize(),this._far.normalize(),this},i.unitFrustum=function(){return new i(new n(1,0,0,1),new n(-1,0,0,1),new n(0,1,1,1),new n(0,-1,0,1),new n(0,0,-1,1),new n(0,0,1,1))},i.fromProjectionMatrix=function(t){if(!t)throw new e(r.logMessage(r.LEVEL_SEVERE,"Frustum","fromProjectionMatrix","missingMatrix"));var s,o,u,a,f,l,c,h,p,d,v;return s=t[12]+t[0],o=t[13]+t[1],u=t[14]+t[2],a=t[15]+t[3],f=Math.sqrt(s*s+o*o+u*u),l=new n(s/f,o/f,u/f,a/f),s=t[12]-t[0],o=t[13]-t[1],u=t[14]-t[2],a=t[15]-t[3],f=Math.sqrt(s*s+o*o+u*u),c=new n(s/f,o/f,u/f,a/f),s=t[12]+t[4],o=t[13]+t[5],u=t[14]+t[6],a=t[15]+t[7],f=Math.sqrt(s*s+o*o+u*u),p=new n(s/f,o/f,u/f,a/f),s=t[12]-t[4],o=t[13]-t[5],u=t[14]-t[6],a=t[15]-t[7],f=Math.sqrt(s*s+o*o+u*u),h=new n(s/f,o/f,u/f,a/f),s=t[12]+t[8],o=t[13]+t[9],u=t[14]+t[10],a=t[15]+t[11],f=Math.sqrt(s*s+o*o+u*u),d=new n(s/f,o/f,u/f,a/f),s=t[12]-t[8],o=t[13]-t[9],u=t[14]-t[10],a=t[15]-t[11],f=Math.sqrt(s*s+o*o+u*u),v=new n(s/f,o/f,u/f,a/f),new i(l,c,p,h,d,v)},i.prototype.containsPoint=function(t){if(!t)throw new e(r.logMessage(r.LEVEL_SEVERE,"Frustum","containsPoint","missingPoint"));return this._far.dot(t)<=0?!1:this._left.dot(t)<=0?!1:this._right.dot(t)<=0?!1:this._top.dot(t)<=0?!1:this._bottom.dot(t)<=0?!1:this._near.dot(t)<=0?!1:!0},i.prototype.intersectsSegment=function(t,n){if(!t||!n)throw new e(r.logMessage(r.LEVEL_SEVERE,"Frustum","containsPoint","missingPoint"));if(this.containsPoint(t)||this.containsPoint(n))return!0;if(t.equals(n))return!1;for(var i=0,s=this._planes.length;iv&&(n=v),sm&&(o=m),ug&&(f=g),l=0?n:-n},c.prototype.effectiveRadius=function(t){if(!t)throw new e(r.logMessage(r.LEVEL_SEVERE,"BoundingBox","effectiveRadius","missingPlane"));var n=t.normal;return.5*(f.fabs(this.r.dot(n))+f.fabs(this.s.dot(n))+f.fabs(this.t.dot(n)))},c.prototype.intersectsFrustum=function(t){if(!t)throw new e(r.logMessage(r.LEVEL_SEVERE,"BoundingBox","intersectsFrustum","missingFrustum"));return this.tmp1.copy(this.bottomCenter),this.tmp2.copy(this.topCenter),this.intersectionPoint(t.near)<0?!1:this.intersectionPoint(t.far)<0?!1:this.intersectionPoint(t.left)<0?!1:this.intersectionPoint(t.right)<0?!1:this.intersectionPoint(t.top)<0?!1:this.intersectionPoint(t.bottom)<0?!1:!0},c.prototype.intersectionPoint=function(e){var t=e.normal,n=.5*(Math.abs(this.s.dot(t))+Math.abs(this.t.dot(t)));return this.intersectsAt(e,n,this.tmp1,this.tmp2)},c.prototype.intersectsAt=function(e,t,n,r){var i=e.dot(n),s=i<=-t,o=e.dot(r),u=o<=-t;if(s&&u)return-1;if(s==u)return 0;this.tmp3.copy(n),this.tmp3.subtract(r);var a=(t+i)/e.normal.dot(this.tmp3);return this.tmp3.copy(r),this.tmp3.subtract(n),this.tmp3.multiply(a),this.tmp3.add(n),s?n.copy(this.tmp3):r.copy(this.tmp3),a},c.prototype.adjustExtremes=function(e,t,n,r,i,s,o){var u=o.dot(e);t[0]>u&&(t[0]=u),t[1]a&&(r[0]=a),r[1]f&&(s[0]=f),s[1]Math.max(t*i,.5)},o.prototype.update=function(e){var t=e.globe.elevationTimestamp(),n=e.verticalExaggeration,r=e.globeStateKey;if(this.updateTimestamp!=t||this.updateVerticalExaggeration!=n||this.updateGlobeStateKey!=r)this.doUpdate(e),e.frameStatistics.incrementTileUpdateCount(1),this.updateTimestamp=t,this.updateVerticalExaggeration=n,this.updateGlobeStateKey=r},o.prototype.doUpdate=function(e){var n=e.globe,r=e.verticalExaggeration,o=n.minAndMaxElevationsForSector(this.sector),u=o?o[0]*r:0,a=o?o[1]*r:0;u==a&&(u=a+10),this.extent||(this.extent=new t),this.extent.setToSector(this.sector,n,u,a),this.samplePoints||(this.sampleElevations=new Float64Array(9),this.samplePoints=new Float64Array(3*this.sampleElevations.length)),s.fillArray(this.sampleElevations,.5*(u+a)),n.computePointsForGrid(this.sector,3,3,this.sampleElevations,i.ZERO,this.samplePoints),this.referencePoint||(this.referencePoint=new i(0,0,0)),n.computePointFromPosition(this.sector.centroidLatitude(),this.sector.centroidLongitude(),0,this.referencePoint)},o.computeRow=function(e,t){var n=Math.floor((t+90)/e);return t==90&&(n-=1),n},o.computeColumn=function(e,t){var n=Math.floor((t+180)/e);return t==180&&(n-=1),n},o.computeLastRow=function(e,t){var n=Math.ceil((t+90)/e-1);return t+90e.levelNumber?1:0},i}),n("util/LevelSet",["../error/ArgumentError","../util/Level","../geom/Location","../util/Logger"],function(e,t,n,r){"use strict";var i=function(i,s,o,u,a){if(!i)throw new e(r.logMessage(r.LEVEL_SEVERE,"LevelSet","constructor","missingSector"));if(!s)throw new e(r.logMessage(r.LEVEL_SEVERE,"LevelSet","constructor","The specified level zero delta is null or undefined"));if(s.latitude<=0||s.longitude<=0)throw new e(r.logMessage(r.LEVEL_SEVERE,"LevelSet","constructor","The specified level zero delta is less than or equal to zero."));if(o<1)throw new e(r.logMessage(r.LEVEL_SEVERE,"LevelSet","constructor","The specified number of levels is less than one."));if(u<1||a<1)throw new e(r.logMessage(r.LEVEL_SEVERE,"LevelSet","constructor","The specified tile width or tile height is less than one."));this.sector=i,this.levelZeroDelta=s,this.numLevels=o,this.tileWidth=u,this.tileHeight=a,this.levels=[];for(var f=0;f=this.levels.length?null:this.levels[e]},i.prototype.levelForTexelSize=function(e){var t=this.lastLevel();if(t.texelSize>=e)return t;for(var n=0,r=this.levels.length;n=n||r<0)throw new e(t.logMessage(t.LEVEL_SEVERE,"MemoryCache","constructor","The specified low-water value is undefined, greater than or equal to the capacity, or less than 1"));this._capacity=n,this._lowWater=r,this.usedCapacity=0,this.freeCapacity=n,this.entries={},this.listeners=[]};return Object.defineProperties(n.prototype,{capacity:{get:function(){return this._capacity},set:function(n){if(!n||n<1)throw new e(t.logMessage(t.LEVEL_SEVERE,"MemoryCache","capacity","Specified cache capacity is undefined, 0 or negative."));var r=this._capacity;this._capacity=n,this._capacity<=this.lowWater&&(this._lowWater=.85*this._capacity),this._capacity=this._capacity||n<0)throw new e(t.logMessage(t.LEVEL_SEVERE,"MemoryCache","lowWater","Specified cache low-water value is undefined, negative or not less than the current capacity."));this._lowWater=n}}}),n.prototype.entryForKey=function(e){if(!e)return null;var t=this.entries[e];return t?(t.lastUsed=Date.now(),t.entry):null},n.prototype.putEntry=function(n,r,i){if(!n)throw new e(t.logMessage(t.LEVEL_SEVERE,"MemoryCache","putEntry","missingKey."));if(!r)throw new e(t.logMessage(t.LEVEL_SEVERE,"MemoryCache","putEntry","missingEntry."));if(i<1)throw new e(t.logMessage(t.LEVEL_SEVERE,"MemoryCache","putEntry","The specified entry size is less than 1."));var s=this.entries[n],o;s&&this.removeEntry(n),this.usedCapacity+i>this._capacity&&this.makeSpace(i),this.usedCapacity+=i,this.freeCapacity=this._capacity-this.usedCapacity,o={key:n,entry:r,size:i,lastUsed:Date.now()},this.entries[n]=o},n.prototype.clear=function(e){if(e)for(var t in this.entries)this.entries.hasOwnProperty(t)&&this.removeCacheEntry(t);this.entries={},this.freeCapacity=this._capacity,this.usedCapacity=0},n.prototype.removeEntry=function(e){if(!e)return;var t=this.entries[e];t&&this.removeCacheEntry(t)},n.prototype.removeCacheEntry=function(e){delete this.entries[e.key],this.usedCapacity-=e.size,this.freeCapacity=this._capacity-this.usedCapacity;for(var t=0,n=this.listeners.length;t-1&&this.listeners.splice(r,1)},n.prototype.makeSpace=function(e){var t=[],n=this.usedCapacity;for(var r in this.entries)this.entries.hasOwnProperty(r)&&t.push(this.entries[r]);t.sort(function(e,t){return e.lastUsed-t.lastUsed});for(var i=0,s=t.length;ithis._lowWater||this.freeCapacity=1&&this.opacity>=1){this.previousTiles={};for(var t=0;t0&&(e.surfaceTileRenderer.renderTiles(e,this.currentTiles,this.opacity,e.surfaceOpacity>=1),e.frameStatistics.incrementImageTileCount(this.currentTiles.length),this.inCurrentFrame=!0)},l.prototype.fadeOutgoingTiles=function(e){var t=(e.timestamp-e.previousRedrawTimestamp)/e.fadeTime,n={};for(var r=0;r0&&!n[i.imagePath]&&(i.opacity=Math.max(0,i.opacity-t),i.opacity>0&&(this.currentTiles.push(i),this.currentTilesInvalid=!0,e.redrawRequested=!0)))},l.prototype.isLayerInView=function(e){return e.terrain&&e.terrain.sector&&e.terrain.sector.intersects(this.levels.sector)},l.prototype.createTopLevelTiles=function(e){this.topLevelTiles=[],a.createTilesForLevel(this.levels.firstLevel(),this,this.topLevelTiles)},l.prototype.assembleTiles=function(e){this.currentTiles=[],(!this.topLevelTiles||this.topLevelTiles.length===0)&&this.createTopLevelTiles(e);for(var t=0,n=this.topLevelTiles.length;t=75||t.sector.maxLatitude<=-75)n*=1.2;return t.level.isLastLevel()||!t.mustSubdivide(e,n)},l.prototype.isTileTextureInMemory=function(e,t){return e.gpuResourceCache.containsResource(t.imagePath)},l.prototype.isTextureExpired=function(e){return this.expiration&&e.creationTime.getTime()<=this.expiration.getTime()},l.prototype.retrieveTileImage=function(e,t,n){if(this.currentRetrievals.indexOf(t.imagePath)<0){if(this.absentResourceList.isResourceAbsent(t.imagePath))return;var r=this.resourceUrlForTile(t,this.retrievalImageFormat),i=new Image,o=t.imagePath,u=e.gpuResourceCache,a=e.currentGlContext.canvas,f=this;if(!r){this.currentTilesInvalid=!0;return}i.onload=function(){s.log(s.LEVEL_INFO,"Image retrieval succeeded: "+r);var l=f.createTexture(e,t,i);f.removeFromCurrentRetrievals(o);if(l){u.putResource(o,l,l.size),f.currentTilesInvalid=!0,f.absentResourceList.unmarkResourceAbsent(o);if(!n){var c=document.createEvent("Event");c.initEvent(WorldWind.REDRAW_EVENT_TYPE,!0,!0),a.dispatchEvent(c)}}},i.onerror=function(){f.removeFromCurrentRetrievals(o),f.absentResourceList.markResourceAbsent(o),s.log(s.LEVEL_WARNING,"Image retrieval failed: "+r)},this.currentRetrievals.push(o),i.crossOrigin="anonymous",i.src=r}},l.prototype.createTexture=function(e,t,n){return new u(e.currentGlContext,n)},l.prototype.removeFromCurrentRetrievals=function(e){var t=this.currentRetrievals.indexOf(e);t>-1&&this.currentRetrievals.splice(t,1)},l.prototype.resourceUrlForTile=function(e,t){return this.urlBuilder?this.urlBuilder.urlForTile(e,t):null},l}),n("layer/MercatorTiledImageLayer",["../util/Color","../geom/Sector","../layer/TiledImageLayer","../geom/Vec2","../util/WWMath"],function(e,t,n,r,i){"use strict";var s=function(e,t,i,s,o,u,a){n.call(this,e,t,i,s,o,u,a),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 s.prototype=Object.create(n.prototype),s.prototype.createTile=function(e,r,s,o){var u=this.mapSizeForLevel(r.levelNumber),a=i.clamp(o*this.imageSize,0,u),f=i.clamp(s*this.imageSize,0,u),l=i.clamp(a+this.imageSize,0,u),c=i.clamp(f+this.imageSize,0,u),h,p,d,v,m,g;return h=a/u-.5,p=.5-c/u,d=90-360*Math.atan(Math.exp(-p*2*Math.PI))/Math.PI,v=360*h,h=l/u-.5,p=.5-f/u,m=90-360*Math.atan(Math.exp(-p*2*Math.PI))/Math.PI,g=360*h,e=new t(d,m,v,g),n.prototype.createTile.call(this,e,r,s,o)},s.prototype.createTexture=function(e,t,r){var s=e.canvas2D,o=e.ctx2D,u,a=this.destCanvas,f=this.destContext,l=f.createImageData(r.width,r.height),c=t.sector,h=i.gudermannianInverse(c.minLatitude),p=i.gudermannianInverse(c.maxLatitude),d,v,m,g,y,b,w;s.width=r.width,s.height=r.height,a.width=r.width,a.height=r.height,o.drawImage(r,0,0,r.width,r.height),u=o.getImageData(0,0,r.width,r.height);if(this.detectBlankImages&&this.isBlankImage(r,u))return this.absentResourceList.markResourceAbsentPermanently(t.imagePath),null;for(var E=0;E<1;E++)for(var S=0;S0;o--)r=0,i=1<0?s:"1.3.0",this.isWms130OrGreater=this.wmsVersion>="1.3.0",this.crs="EPSG:4326",this.timeString=o};return n.prototype.urlForTile=function(r,i){if(!r)throw new e(t.logMessage(t.LEVEL_SEVERE,"WmsUrlBuilder","urlForTile","missingTile"));if(!i)throw new e(t.logMessage(t.LEVEL_SEVERE,"WmsUrlBuilder","urlForTile","The image format is null or undefined."));var s=r.sector,o=n.fixGetMapString(this.serviceAddress);return o.search(/service=wms/i)<0&&(o+="service=WMS"),o+="&request=GetMap",o=o+"&version="+this.wmsVersion,o=o+"&transparent="+(this.transparent?"TRUE":"FALSE"),o=o+"&layers="+this.layerNames,o=o+"&styles="+this.styleNames,o=o+"&format="+i,o=o+"&width="+r.tileWidth,o=o+"&height="+r.tileHeight,this.timeString&&(o=o+"&time="+this.timeString),this.isWms130OrGreater?(o=o+"&crs="+this.crs,o+="&bbox=",this.crs==="CRS:84"?(o=o+s.minLongitude+","+s.minLatitude+",",o=o+s.maxLongitude+","+s.maxLatitude):(o=o+s.minLatitude+","+s.minLongitude+",",o=o+s.maxLatitude+","+s.maxLongitude)):(o=o+"&srs="+this.crs,o+="&bbox=",o=o+s.minLongitude+","+s.minLatitude+",",o=o+s.maxLongitude+","+s.maxLatitude),o=o.replace(" ","%20"),o},n.fixGetMapString=function(n){if(!n)throw new e(t.logMessage(t.LEVEL_SEVERE,"WmsUrlBuilder","fixGetMapString","The specified service address is null or undefined."));var r=n.indexOf("?");return r<0?n+="?":r!==n.length-1&&(r=n.search(/&$/),r<0&&(n+="&")),n},n}),n("layer/BingWMSLayer",["../geom/Location","../geom/Sector","../layer/TiledImageLayer","../util/WmsUrlBuilder"],function(e,t,n,r){"use strict";var i=function(){n.call(this,t.FULL_SPHERE,new e(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 i.prototype=Object.create(n.prototype),i}),n("util/PeriodicTimeSequence",["../error/ArgumentError","../util/Logger"],function(e,t){"use strict";var n=function(r){if(!r)throw new e(t.logMessage(t.LEVEL_SEVERE,"PeriodicTimeSequence","constructor","missingString"));var i=r.split("/");if(i.length!==3)throw new e(t.logMessage(t.LEVEL_SEVERE,"PeriodicTimeSequence","constructor","The interval string "+r+" does not contain 3 elements."));this.sequenceString=r,this.startTime=new Date(i[0]),this.endTime=new Date(i[1]),this.intervalMilliseconds=this.endTime.getTime()-this.startTime.getTime(),this._currentTime=this.startTime,this.infiniteInterval=this.startTime.getTime()==this.endTime.getTime(),this.period=n.parsePeriodString(i[2],!1)};return Object.defineProperties(n.prototype,{currentTime:{get:function(){return this._currentTime},set:function(e){this._currentTime=e}},scaleForCurrentTime:{get:function(){return this.currentTime?(this.currentTime.getTime()-this.startTime.getTime())/this.intervalMilliseconds:1}}}),n.prototype.next=function(){return this.currentTime?this.currentTime.getTime()>=this.endTime.getTime()&&!this.infiniteInterval?this.currentTime=null:this.currentTime=n.incrementTime(this.currentTime,this.period):this.currentTime=this.startTime,this.currentTime},n.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},n.prototype.reset=function(){this.currentTime=null},n.prototype.getTimeForScale=function(e){if(e<=0)return this.startTime;if(e>=1)return this.endTime;var t=new Date(this.startTime.getTime()),r=t,i=0;for(i=0;i0;f--)o[f]>=u[f]&&(o[f-1]=o[f-1]+Math.floor(o[f]/u[f]),o[f]=o[f]%u[f]);return o},n}),n("util/LevelRowColumnUrlBuilder",["../error/ArgumentError","../util/Logger","../util/WWUtil"],function(e,t,n){"use strict";var r=function(e,t){this.serverAddress=e;if(!e||e.length===0)this.serverAddress=n.currentUrlSansFilePart();this.pathToData=t};return r.prototype.urlForTile=function(r,i){if(!r)throw new e(t.logMessage(t.LEVEL_SEVERE,"WmsUrlBuilder","urlForTile","missingTile"));if(!i)throw new e(t.logMessage(t.LEVEL_SEVERE,"WmsUrlBuilder","urlForTile","The image format is null or undefined."));var s=this.serverAddress;return this.pathToData&&(s=s+"/"+this.pathToData),s=s+"/"+r.level.levelNumber.toString(),s=s+"/"+r.row.toString(),s=s+"/"+r.row.toString()+"_"+r.column.toString(),s=s+"."+n.suffixForMimeType(i),s=s.replace(" ","%20"),s},r}),n("layer/RestTiledImageLayer",["../error/ArgumentError","../geom/Location","../util/Logger","../geom/Sector","../layer/TiledImageLayer","../util/LevelRowColumnUrlBuilder","../util/WWUtil"],function(e,t,n,r,i,s,o){"use strict";var u=function(e,n,u,a){var f=o.urlPath(e+"/"+n);i.call(this,a&&a.sector||r.FULL_SPHERE,a&&a.levelZeroTileDelta||new t(45,45),a&&a.numLevels||5,a&&a.imageFormat||"image/jpeg",f,a&&a.tileWidth||256,a&&a.tileHeight||256),this.displayName=u,this.pickEnabled=!1,this.urlBuilder=new s(e,n)};return u.prototype=Object.create(i.prototype),u}),n("layer/BlueMarbleLayer",["../error/ArgumentError","../layer/Layer","../util/Logger","../util/PeriodicTimeSequence","../layer/RestTiledImageLayer"],function(e,t,n,r,i){"use strict";var s=function(e,n,i){t.call(this,e||"Blue Marble"),this.time=n||new Date("2004-01"),this.configuration=i,this.pickEnabled=!1,this.layers={},this.layerNames=[{month:"BlueMarble-200401",time:s.availableTimes[0]},{month:"BlueMarble-200402",time:s.availableTimes[1]},{month:"BlueMarble-200403",time:s.availableTimes[2]},{month:"BlueMarble-200404",time:s.availableTimes[3]},{month:"BlueMarble-200405",time:s.availableTimes[4]},{month:"BlueMarble-200406",time:s.availableTimes[5]},{month:"BlueMarble-200407",time:s.availableTimes[6]},{month:"BlueMarble-200408",time:s.availableTimes[7]},{month:"BlueMarble-200409",time:s.availableTimes[8]},{month:"BlueMarble-200410",time:s.availableTimes[9]},{month:"BlueMarble-200411",time:s.availableTimes[10]},{month:"BlueMarble-200412",time:s.availableTimes[11]}],this.timeSequence=new r("2004-01-01/2004-12-01/P1M"),this.serverAddress=null,this.pathToData="../standalonedata/Earth/BlueMarble256/"};return s.prototype=Object.create(t.prototype),s.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")],s.prototype.prePopulate=function(t){if(!t)throw new e(n.logMessage(n.LEVEL_SEVERE,"BlueMarbleLayer","prePopulate","missingWorldWindow"));for(var r=0;r=this.layerNames[11].time.getTime())return this.layerNames[11].month;for(var n=0;n=r&&t<=i){var s=t-r,o=i-t;return s=0&&this.renderables.splice(t,1)},r.prototype.removeAllRenderables=function(){this.renderables=[]},r.prototype.doRender=function(e){var t=e.orderedRenderables.length;for(var r=0,i=this.renderables.length;rt&&(this.inCurrentFrame=!0)},r}),n("render/SurfaceTile",["../error/ArgumentError","../util/Logger","../geom/Matrix","../geom/Sector","../error/UnsupportedOperationError"],function(e,t,n,r,i){"use strict";var s=function(n){if(!n)throw new e(t.logMessage(t.LEVEL_SEVERE,"SurfaceTile","constructor","missingSector"));this.sector=n};return s.prototype.bind=function(e){throw new i(t.logMessage(t.LEVEL_SEVERE,"SurfaceTile","bind","abstractInvocation"))},s.prototype.applyInternalTransform=function(e,n){throw new i(t.logMessage(t.LEVEL_SEVERE,"SurfaceTile","applyInternalTransform","abstractInvocation"))},s}),n("shapes/SurfaceImage",["../error/ArgumentError","../util/Logger","../pick/PickedObject","../render/SurfaceTile"],function(e,t,n,r){"use strict";var i=function(n,i){if(!n)throw new e(t.logMessage(t.LEVEL_SEVERE,"SurfaceImage","constructor","missingSector"));if(!i)throw new e(t.logMessage(t.LEVEL_SEVERE,"SurfaceImage","constructor","missingImage"));r.call(this,n),this.enabled=!0,this._imageSource=i,this.opacity=1,this.displayName="Surface Image",this.imageSourceWasUpdated=!0};return i.prototype=Object.create(r.prototype),Object.defineProperties(i.prototype,{imageSource:{get:function(){return this._imageSource},set:function(n){if(!n)throw new e(t.logMessage(t.LEVEL_SEVERE,"SurfaceImage","imageSource","missingImage"));this._imageSource=n,this.imageSourceWasUpdated=!0}}}),i.prototype.bind=function(e){var t=e.gpuResourceCache.resourceForKey(this._imageSource);if(t&&!this.imageSourceWasUpdated)return t.bind(e);t=e.gpuResourceCache.retrieveTexture(e.currentGlContext,this._imageSource),this.imageSourceWasUpdated=!1;if(t)return t.bind(e)},i.prototype.applyInternalTransform=function(e,t){},i.prototype.render=function(e){if(!this.enabled||!this.sector.overlaps(e.terrain.sector))return;e.pickingMode&&(this.pickColor=e.uniquePickColor()),e.surfaceTileRenderer.renderTiles(e,[this],this.opacity*e.currentLayer.opacity);if(e.pickingMode){var t=new n(this.pickColor.clone(),this.pickDelegate?this.pickDelegate:this,null,this.layer,!1);e.resolvePick(t)}e.currentLayer.inCurrentFrame=!0},i}),n("layer/BMNGOneImageLayer",["../layer/RenderableLayer","../geom/Sector","../shapes/SurfaceImage","../util/WWUtil"],function(e,t,n,r){"use strict";var i=function(){e.call(this,"Blue Marble Image");var r=new n(t.FULL_SPHERE,WorldWind.configuration.baseUrl+"images/BMNG_world.topo.bathy.200405.3.2048x1024.jpg");this.addRenderable(r),this.pickEnabled=!1,this.minActiveAltitude=3e6};return i.prototype=Object.create(e.prototype),i}),n("gesture/Touch",[],function(){"use strict";var e=function(e,t,n){this.identifier=e,this._clientX=t,this._clientY=n,this._clientStartX=t,this._clientStartY=n};return Object.defineProperties(e.prototype,{clientX:{get:function(){return this._clientX},set:function(e){this._clientX=e}},clientY:{get:function(){return this._clientY},set:function(e){this._clientY=e}},translationX:{get:function(){return this._clientX-this._clientStartX},set:function(e){this._clientStartX=this._clientX-e}},translationY:{get:function(){return this._clientY-this._clientStartY},set:function(e){this._clientStartY=this._clientY-e}}}),e}),n("gesture/GestureRecognizer",["../error/ArgumentError","../util/Logger","../gesture/Touch"],function(e,t,n){"use strict";var r=function(n,i){function o(e){s.handleEvent(e)}if(!n)throw new e(t.logMessage(t.LEVEL_SEVERE,"GestureRecognizer","constructor","missingTarget"));this.target=n,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=[],i&&this._gestureCallbacks.push(i),r.allRecognizers.push(this);var s=this;window.PointerEvent?(n.addEventListener("pointerdown",o,!1),window.addEventListener("pointermove",o,!1),window.addEventListener("pointercancel",o,!1),window.addEventListener("pointerup",o,!1)):(n.addEventListener("mousedown",o,!1),window.addEventListener("mousemove",o,!1),window.addEventListener("mouseup",o,!1),n.addEventListener("touchstart",o,!1),n.addEventListener("touchmove",o,!1),n.addEventListener("touchend",o,!1),n.addEventListener("touchcancel",o,!1))};return r.allRecognizers=[],Object.defineProperties(r.prototype,{state:{get:function(){return this._state},set:function(e){this.transitionToState(e)}},clientX:{get:function(){return this._clientX},set:function(e){this._clientX=e}},clientY:{get:function(){return this._clientY},set:function(e){this._clientY=e}},translationX:{get:function(){return this._translationX},set:function(e){this._translationX=e,this._clientStartX=this._clientX,this._touchCentroidShiftX=0}},translationY:{get:function(){return this._translationY},set:function(e){this._translationY=e,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(n){if(n<0||n>=this._touches.length)throw new e(t.logMessage(t.LEVEL_SEVERE,"GestureRecognizer","touch","indexOutOfRange"));return this._touches[n]},r.prototype.recognizeSimultaneouslyWith=function(n){if(!n)throw new e(t.logMessage(t.LEVEL_SEVERE,"GestureRecognizer","recognizeSimultaneouslyWith","The specified gesture recognizer is null or undefined."));var r=this._canRecognizeWith.indexOf(n);r==-1&&(this._canRecognizeWith.push(n),n._canRecognizeWith.push(this))},r.prototype.canRecognizeSimultaneouslyWith=function(e){var t=this._canRecognizeWith.indexOf(e);return t!=-1},r.prototype.requireRecognizerToFail=function(n){if(!n)throw new e(t.logMessage(t.LEVEL_SEVERE,"GestureRecognizer","requireRecognizerToFail","The specified gesture recognizer is null or undefined"));var r=this._requiresFailureOf.indexOf(n);r==-1&&(this._requiresFailureOf.push(n),n._requiredToFailBy.push(this))},r.prototype.requiresRecognizerToFail=function(e){var t=this._requiresFailureOf.indexOf(e);return t!=-1},r.prototype.requiredToFailByRecognizer=function(e){var t=this._requiredToFailBy.indexOf(e);return t!=-1},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(e){},r.prototype.mouseMove=function(e){},r.prototype.mouseUp=function(e){},r.prototype.touchStart=function(e){},r.prototype.touchMove=function(e){},r.prototype.touchCancel=function(e){},r.prototype.touchEnd=function(e){},r.prototype.transitionToState=function(e){this._nextState=null,e==WorldWind.FAILED?(this._state=e,this.updateRecognizersWaitingForFailure(),this.resetIfEventsEnded()):e==WorldWind.RECOGNIZED?(this.tryToRecognize(e),this._state==e&&(this.prepareToRecognize(),this.callGestureCallbacks(),this.resetIfEventsEnded())):e==WorldWind.BEGAN?(this.tryToRecognize(e),this._state==e&&(this.prepareToRecognize(),this.callGestureCallbacks())):e==WorldWind.CHANGED?(this._state=e,this.callGestureCallbacks()):e==WorldWind.CANCELLED?(this._state=e,this.callGestureCallbacks(),this.resetIfEventsEnded()):e==WorldWind.ENDED&&(this._state=e,this.callGestureCallbacks(),this.resetIfEventsEnded())},r.prototype.updateRecognizersWaitingForFailure=function(){for(var e=0,t=this._requiredToFailBy.length;e0)return;var t=1<this.maxMouseMovement&&(this.state=WorldWind.FAILED)},t.prototype.mouseUp=function(e){if(this.state!=WorldWind.POSSIBLE)return;if(this.mouseButtonMask!=0)return;var t=this.clicks.length;t==this.numberOfClicks?(this.clientX=this.clicks[0].clientX,this.clientY=this.clicks[0].clientY,this.state=WorldWind.RECOGNIZED):this.failAfterDelay(this.maxClickInterval)},t.prototype.touchStart=function(e){if(this.state!=WorldWind.POSSIBLE)return;this.state=WorldWind.FAILED},t.prototype.failAfterDelay=function(e){var t=this;t.timeout&&window.clearTimeout(t.timeout),t.timeout=window.setTimeout(function(){t.timeout=null,t.state==WorldWind.POSSIBLE&&(t.state=WorldWind.FAILED)},e)},t.prototype.cancelFailAfterDelay=function(){var e=this;e.timeout&&(window.clearTimeout(e.timeout),e.timeout=null)},t}),n("formats/collada/ColladaAsset",[],function(){"use strict";var e=function(e){this.xmlAsset=e.getElementsByTagName("asset")[0],this.asset={daeVersion:e.querySelector("COLLADA").getAttribute("version")}};return e.prototype.parse=function(){if(!this.xmlAsset)return null;for(var e=0;e1){t=!1;break}return t},fetchFile:function(t,n){var r=new XMLHttpRequest;r.onload=function(){this.status>=200&&this.status<400?n(this.response):(e.log(e.LEVEL_SEVERE,"sever error: "+this.status),n(null))},r.onerror=function(t){e.log(e.LEVEL_SEVERE,"connection error: "+t),n(null)},r.open("get",t,!0),r.send()}};return t}),n("formats/collada/ColladaImage",["./ColladaUtils"],function(e){"use strict";var t=function(e,t){this.filename="",this.map=e,this.name=t,this.path=""};return t.prototype.parse=function(t){for(var n=0;n3&&(T===0&&(E=S),T>2*l&&(m.push(E),m.push(x))),m.push(S),g+=l}}var D={vertices:new Float32Array(f[0][1]),indexedRendering:y,material:u};return this.transformMeshInfo(D,f,m),D},t.prototype.parseInputs=function(e,t,n){var r=[],i=0,s=e.querySelectorAll("input");for(var o=0;o0;a&&this.applyTexture(e,t,n);var f=t.normals!=null&&t.normals.length>0;f&&!e.pickingMode&&this.applyLighting(e,t),this.applyMatrix(e,f,a,r,i),t.indexedRendering?(this.applyIndices(e,t),s.drawElements(s.TRIANGLES,t.indices.length,s.UNSIGNED_SHORT,0)):s.drawArrays(s.TRIANGLES,0,Math.floor(t.vertices.length/3)),this.resetDraw(e,f,a)},f.prototype.applyVertices=function(e,t){var n=e.currentGlContext,r=e.currentProgram,i;t.verticesVboCacheKey||(t.verticesVboCacheKey=e.gpuResourceCache.generateCacheKey()),i=e.gpuResourceCache.resourceForKey(t.verticesVboCacheKey),i||(i=n.createBuffer(),e.gpuResourceCache.putResource(t.verticesVboCacheKey,i,t.vertices.length),t.refreshVertexBuffer=!0),n.bindBuffer(n.ARRAY_BUFFER,i),t.refreshVertexBuffer&&(n.bufferData(n.ARRAY_BUFFER,t.vertices,n.STATIC_DRAW),e.frameStatistics.incrementVboLoadCount(1),t.refreshVertexBuffer=!1),n.enableVertexAttribArray(r.vertexPointLocation),n.vertexAttribPointer(r.vertexPointLocation,3,n.FLOAT,!1,0,0)},f.prototype.applyColor=function(e,t){var r=e.currentGlContext,i=e.currentProgram;if(t)if(t.techniqueType==="constant")var s=t.reflective;else s=t.diffuse;var o,u=1,a=1,f=1,l=1;s&&(u=s[0],a=s[1],f=s[2],l=s[3]!=null?s[3]:1);var c=new n(u,a,f,l);o=l*e.currentLayer.opacity,r.depthMask(o>=1||e.pickingMode),i.loadColor(r,e.pickingMode?this.pickColor:c),i.loadOpacity(r,e.pickingMode?o>0?1:0:o)},f.prototype.applyTexture=function(e,t,n){var r,i,s=e.currentGlContext,o=e.currentProgram,u;if(n.textures.diffuse)var a=n.textures.diffuse.mapId;else a=n.textures.reflective.mapId;var f=this.useTexturePaths?this.images[a].path:this.images[a].filename;this._activeTexture=e.gpuResourceCache.resourceForKey(this.dirPath+f+""),this._activeTexture||(u=t.isClamp?s.CLAMP_TO_EDGE:s.REPEAT,this._activeTexture=e.gpuResourceCache.retrieveTexture(s,this.dirPath+f+"",u)),r=this._activeTexture&&this._activeTexture.bind(e),r&&(t.texCoordsVboCacheKey||(t.texCoordsVboCacheKey=e.gpuResourceCache.generateCacheKey()),i=e.gpuResourceCache.resourceForKey(t.texCoordsVboCacheKey),i||(i=s.createBuffer(),e.gpuResourceCache.putResource(t.texCoordsVboCacheKey,i,t.uvs.length),t.refreshTexCoordBuffer=!0),s.bindBuffer(s.ARRAY_BUFFER,i),t.refreshTexCoordBuffer&&(s.bufferData(s.ARRAY_BUFFER,t.uvs,s.STATIC_DRAW),e.frameStatistics.incrementVboLoadCount(1),t.refreshTexCoordBuffer=!1),o.loadTextureEnabled(s,!0),s.enableVertexAttribArray(o.vertexTexCoordLocation),s.vertexAttribPointer(o.vertexTexCoordLocation,2,s.FLOAT,!1,0,0),o.loadTextureUnit(s,s.TEXTURE0),o.loadModulateColor(s,e.pickingMode))},f.prototype.applyLighting=function(e,t){var n,r=e.currentGlContext,i=e.currentProgram;i.loadApplyLighting(r,!0),t.normalsVboCacheKey||(t.normalsVboCacheKey=e.gpuResourceCache.generateCacheKey()),n=e.gpuResourceCache.resourceForKey(t.normalsVboCacheKey),n||(n=r.createBuffer(),e.gpuResourceCache.putResource(t.normalsVboCacheKey,n,t.normals.length),t.refreshNormalBuffer=!0),r.bindBuffer(r.ARRAY_BUFFER,n),t.refreshNormalBuffer&&(r.bufferData(r.ARRAY_BUFFER,t.normals,r.STATIC_DRAW),e.frameStatistics.incrementVboLoadCount(1),t.refreshNormalBuffer=!1),r.enableVertexAttribArray(i.normalVectorLocation),r.vertexAttribPointer(i.normalVectorLocation,3,r.FLOAT,!1,0,0)},f.prototype.applyMatrix=function(e,t,n,r,s){var o=i.fromIdentity();o.copy(e.navigatorState.modelviewProjection),o.multiplyMatrix(this.transformationMatrix),r&&this.localTransforms&&o.multiplyMatrix(r);if(t&&!e.pickingMode){var u=i.fromIdentity();u.copy(e.navigatorState.modelviewNormalTransform),u.multiplyMatrix(this.normalMatrix),s&&this.localTransforms&&u.multiplyMatrix(s),e.currentProgram.loadModelviewInverse(e.currentGlContext,u)}n&&this._activeTexture&&(e.currentProgram.loadTextureMatrix(e.currentGlContext,this._texCoordMatrix),this._activeTexture=null),e.currentProgram.loadModelviewProjection(e.currentGlContext,o)},f.prototype.applyIndices=function(e,t){var n=e.currentGlContext,r;t.indicesVboCacheKey||(t.indicesVboCacheKey=e.gpuResourceCache.generateCacheKey()),r=e.gpuResourceCache.resourceForKey(t.indicesVboCacheKey),r||(r=n.createBuffer(),e.gpuResourceCache.putResource(t.indicesVboCacheKey,r,t.indices.length),t.refreshIndicesBuffer=!0),n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,r),t.refreshIndicesBuffer&&(n.bufferData(n.ELEMENT_ARRAY_BUFFER,t.indices,n.STATIC_DRAW),e.frameStatistics.incrementVboLoadCount(1),t.refreshIndicesBuffer=!1)},f.prototype.resetDraw=function(e,t,n){var r=e.currentGlContext,i=e.currentProgram;t&&!e.pickingMode&&(i.loadApplyLighting(r,!1),r.disableVertexAttribArray(i.normalVectorLocation)),n&&r.disableVertexAttribArray(i.vertexTexCoordLocation),r.disableVertexAttribArray(i.vertexPointLocation)},f.prototype.endDrawing=function(e){e.bindProgram(null)},f.prototype.computeTransformationMatrix=function(e){this.transformationMatrix=i.fromIdentity(),this.transformationMatrix.multiplyByLocalCoordinateTransform(this.placePoint,e),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()},f.prototype.computeNormalMatrix=function(){var e=new a(0,0,0);this.transformationMatrix.extractRotationAngles(e),this.normalMatrix=i.fromIdentity(),this.normalMatrix.multiplyByRotation(-1,0,0,e[0]),this.normalMatrix.multiplyByRotation(0,-1,0,e[1]),this.normalMatrix.multiplyByRotation(0,0,-1,e[2])},f.prototype.mustRenderNode=function(e){var t=!0;if(this.hideNodes){var n=this.nodesToHide.indexOf(e);t=n===-1}return t},f}),n("formats/collada/ColladaLoader",["../../error/ArgumentError","./ColladaAsset","./ColladaImage","./ColladaMaterial","./ColladaMesh","./ColladaNode","./ColladaScene","./ColladaUtils","../../util/Logger"],function(e,t,n,r,i,s,o,u,a){"use strict";var f=function(t,n){if(!t)throw new e(a.logMessage(a.LEVEL_SEVERE,"ColladaLoader","constructor","missingPosition"));this.position=t,this.dirPath="/",this.init(n)};return f.prototype.init=function(e){e&&(this.dirPath=e.dirPath||"/"),this.scene={type:"SceneTree",dirPath:this.dirPath,images:{},metadata:{},materials:{},meshes:{},root:{children:[]}},this.xmlDoc=null},f.prototype.load=function(e,t){e.indexOf("://")===-1&&(e=this.dirPath+e),u.fetchFile(e,function(e){if(!e)var n=null;else try{n=this.parse(e)}catch(r){n=null,a.log(a.LEVEL_SEVERE,"error parsing collada file: "+r)}t(n)}.bind(this))},f.prototype.parse=function(e){this.init();var n=new DOMParser;this.xmlDoc=n.parseFromString(e,"text/xml");var r=this.xmlDoc.querySelectorAll("library_nodes node"),i=this.xmlDoc.querySelectorAll("library_effects effect");return this.scene.metadata=(new t(this.xmlDoc)).parse(),this.parseLib("visual_scene",r),this.parseLib("library_geometries"),this.parseLib("library_materials",i),this.parseLib("library_images"),this.xmlDoc=null,new o(this.position,this.scene)},f.prototype.parseLib=function(e,t){var o=this.xmlDoc.getElementsByTagName(e),a=[];o&&o.length&&(a=o[0].childNodes);for(var f=0;f0&&(p.matrix.copy(e.screenProjection),p.matrix.multiplyMatrix(this.imageTransform),n.loadModelviewProjection(t,p.matrix),e.pickingMode?(n.loadColor(t,this.pickColor),n.loadTextureEnabled(t,!1)):(n.loadColor(t,this.activeAttributes.color),n.loadOpacity(t,this.layer.opacity*this.currentVisibility),this.texCoordMatrix.setToIdentity(),this.activeTexture&&this.texCoordMatrix.multiplyByTextureTransform(this.activeTexture),n.loadTextureMatrix(t,this.texCoordMatrix),this.activeTexture&&this.activeTexture!=p.currentTexture&&(r=this.activeTexture.bind(e),n.loadTextureEnabled(t,r),p.currentTexture=this.activeTexture)),this.activeAttributes.depthTest||t.disable(t.DEPTH_TEST,!1),t.drawArrays(t.TRIANGLE_STRIP,0,4),this.activeAttributes.depthTest||t.disable(t.DEPTH_TEST,!0));if(this.currentVisibility<1&&this.markerImageSource){var o=e.gpuResourceCache.resourceForKey(this.markerImageSource);if(!o){e.gpuResourceCache.retrieveTexture(e.currentGlContext,this.markerImageSource);return}var u=this.markerImageScale,a=s.fromIdentity();a.setTranslation(this.screenPoint[0]-u*o.imageWidth/2,this.screenPoint[1]-u*o.imageWidth/2,this.screenPoint[2]),a.setScale(o.imageWidth*u,o.imageHeight*u,1),p.matrix.copy(e.screenProjection),p.matrix.multiplyMatrix(a),n.loadModelviewProjection(t,p.matrix);if(e.pickingMode)n.loadColor(t,this.pickColor),n.loadTextureEnabled(t,!1);else{n.loadColor(t,this.activeAttributes.color),n.loadOpacity(t,this.layer.opacity*(1-this.currentVisibility));var f=s.fromIdentity();f.multiplyByTextureTransform(o),n.loadTextureMatrix(t,f),o!=p.currentTexture&&(r=o.bind(e),n.loadTextureEnabled(t,r),p.currentTexture=o)}this.activeAttributes.depthTest||t.disable(t.DEPTH_TEST,!1),t.drawArrays(t.TRIANGLE_STRIP,0,4),this.activeAttributes.depthTest||t.enable(t.DEPTH_TEST,!0)}},p}),n("shapes/ScreenText",["../error/ArgumentError","../util/Logger","../util/Offset","../shapes/Text"],function(e,t,n,r){"use strict";var i=function(n,i){if(!n)throw new e(t.logMessage(t.LEVEL_SEVERE,"Text","constructor","missingOffset"));r.call(this,i),this.screenOffset=n,this.altitudeMode=null};return i.prototype=Object.create(r.prototype),i.prototype.render=function(e){this.lastFrameTime!=e.timestamp&&r.prototype.render.call(this,e)},i.prototype.computeScreenPointAndEyeDistance=function(e){var t=e.currentGlContext,n=this.screenOffset.offsetForSize(t.drawingBufferWidth,t.drawingBufferHeight);return this.screenPoint[0]=n[0],this.screenPoint[1]=n[1],this.screenPoint[2]=0,this.eyeDistance=0,!0},i}),n("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(e,t,n,r,i,s,o,u,a,f,l){"use strict";var c=function(n){function h(e){c.handleUIEvent(e)}function p(e,t){c.handleRedraw(t)}if(!n)throw new e(i.logMessage(i.LEVEL_SEVERE,"ViewControlsLayer","constructor","missingWorldWindow"));r.call(this,"Coordinates"),this.wwd=n,this.pickEnabled=!1,this.eventType=null,this.clientX=null,this.clientY=null,this.terrainPosition=null,this.latText=new a(new s(WorldWind.OFFSET_PIXELS,0,WorldWind.OFFSET_PIXELS,0)," "),this.latText.attributes=new f(null),this.latText.attributes.color=t.YELLOW,this.lonText=new a(new s(WorldWind.OFFSET_PIXELS,0,WorldWind.OFFSET_PIXELS,0)," "),this.lonText.attributes=new f(null),this.lonText.attributes.color=t.YELLOW,this.elevText=new a(new s(WorldWind.OFFSET_PIXELS,0,WorldWind.OFFSET_PIXELS,0)," "),this.elevText.attributes=new f(null),this.elevText.attributes.color=t.YELLOW,this.eyeText=new a(new s(WorldWind.OFFSET_PIXELS,0,WorldWind.OFFSET_PIXELS,0)," "),this.eyeText.attributes=new f(null),this.eyeText.attributes.color=t.YELLOW;var o=new s(WorldWind.OFFSET_FRACTION,.5,WorldWind.OFFSET_FRACTION,.5),l=WorldWind.configuration.baseUrl+"images/crosshair.png";this.crosshairImage=new u(o,l);var c=this;window.PointerEvent?(n.addEventListener("pointerdown",h),n.addEventListener("pointermove",h),n.addEventListener("pointerleave",h)):(n.addEventListener("mousedown",h),n.addEventListener("mousemove",h),n.addEventListener("mouseleave",h),n.addEventListener("touchstart",h),n.addEventListener("touchmove",h)),this.wwd.redrawCallbacks.push(p)};return c.prototype=Object.create(r.prototype),c.prototype.doRender=function(e){var t=this.terrainPosition,n=e.eyePosition,r=e.currentGlContext.canvas.clientWidth,i,o,u,a,f;r>650?(i=r/2-50,o=5,u=WorldWind.OFFSET_PIXELS,a=0):r>400?(i=60,o=5,u=WorldWind.OFFSET_INSET_PIXELS,a=1):(i=60,o=5,u=WorldWind.OFFSET_INSET_PIXELS,a=1,f=!0),this.latText.text=t?this.formatLatitude(t.latitude):null,this.latText.screenOffset=new s(WorldWind.OFFSET_PIXELS,i,u,o),this.latText.attributes.offset=new s(WorldWind.OFFSET_FRACTION,1,WorldWind.OFFSET_FRACTION,a),this.latText.render(e),i+=70,this.lonText.text=t?this.formatLongitude(t.longitude):null,this.lonText.screenOffset=new s(WorldWind.OFFSET_PIXELS,i,u,o),this.lonText.attributes.offset=new s(WorldWind.OFFSET_FRACTION,1,WorldWind.OFFSET_FRACTION,a),this.lonText.render(e),e.globe.is2D()||(i+=70,this.elevText.text=t?this.formatAltitude(t.altitude,"m"):null,this.elevText.screenOffset=new s(WorldWind.OFFSET_PIXELS,i,u,o),this.elevText.attributes.offset=new s(WorldWind.OFFSET_FRACTION,1,WorldWind.OFFSET_FRACTION,a),this.elevText.render(e)),f||(i+=40,this.eyeText.text="Eye "+this.formatAltitude(n.altitude,n.altitude<1e3?"m":"km"),this.eyeText.screenOffset=new s(WorldWind.OFFSET_PIXELS,i,u,o),this.eyeText.attributes.offset=new s(WorldWind.OFFSET_FRACTION,0,WorldWind.OFFSET_FRACTION,a),this.eyeText.render(e)),this.eventType=="touch"&&this.crosshairImage.render(e),this.inCurrentFrame=!0},c.prototype.handleUIEvent=function(e){e.type.indexOf("pointer")!=-1?this.eventType=e.pointerType:e.type.indexOf("mouse")!=-1?this.eventType="mouse":e.type.indexOf("touch")!=-1&&(this.eventType="touch"),e.type.indexOf("leave")!=-1?(this.clientX=null,this.clientY=null):(this.clientX=e.clientX,this.clientY=e.clientY),this.wwd.redraw()},c.prototype.handleRedraw=function(e){if(e!=WorldWind.BEFORE_REDRAW)return;var t,n;(this.eventType=="mouse"||this.eventType=="pen")&&this.clientX&&this.clientY?(t=this.wwd.canvasCoordinates(this.clientX,this.clientY),t[0]>=0&&t[0]=0&&t[1]n?-1:tthis.interpretDistance},t.prototype.shouldRecognize=function(){var e=1<2e3&&(this.frameTimeAverage=this.frameTimeCumulative/this.frameCount,this.frameRateAverage=1e3*this.frameCount/(e-this.frameTimeBase),this.frameTimeMin=this.frameTimeExtremes[0],this.frameTimeMax=this.frameTimeExtremes[1],this.frameCount=0,this.frameTimeCumulative=0,this.frameTimeBase=e,this.frameTimeExtremes=[Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY])},e.prototype.incrementRenderedTileCount=function(e){this.renderedTileCount+=e},e.prototype.setTerrainTileCount=function(e){this.terrainTileCount=e},e.prototype.incrementImageTileCount=function(e){this.imageTileCount=e},e.prototype.incrementTileUpdateCount=function(e){this.tileUpdateCount+=e},e.prototype.incrementTextureLoadCount=function(e){this.textureLoadCount+=e},e.prototype.incrementVboLoadCount=function(e){this.vboLoadCount+=e},e}),n("render/FramebufferTexture",["../error/ArgumentError","../util/Logger","../util/WWMath"],function(e,t){"use strict";var n=function(n,r,i,s){if(!n)throw new e(t.logMessage(t.LEVEL_SEVERE,"FramebufferTexture","constructor","missingGlContext"));if(r<0||i<0)throw new e(t.logMessage(t.LEVEL_SEVERE,"FramebufferTexture","constructor","The framebuffer width or height is less than zero."));this.width=r,this.height=i,this.depth=s,this.size=r*i*4+(s?r*i*2:0),this.framebufferId=n.createFramebuffer(),n.bindFramebuffer(n.FRAMEBUFFER,this.framebufferId),this.texture=n.createTexture(),n.bindTexture(n.TEXTURE_2D,this.texture),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,r,i,0,n.RGBA,n.UNSIGNED_BYTE,null),n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,this.texture,0),this.depthBuffer=null,s&&(this.depthBuffer=n.createRenderbuffer(),n.bindRenderbuffer(n.RENDERBUFFER,this.depthBuffer),n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_COMPONENT16,r,i),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,this.depthBuffer));var o=n.checkFramebufferStatus(n.FRAMEBUFFER);o!=n.FRAMEBUFFER_COMPLETE&&(t.logMessage(t.LEVEL_WARNING,"FramebufferTexture","constructor","Error creating framebuffer: "+o),this.framebufferId=null,this.texture=null,this.depthBuffer=null),n.bindFramebuffer(n.FRAMEBUFFER,null),n.bindRenderbuffer(n.RENDERBUFFER,null),n.bindTexture(n.TEXTURE_2D,null)};return n.prototype.bind=function(e){return this.texture&&e.currentGlContext.bindTexture(gl.TEXTURE_2D,this.texture),!!this.texture},n}),n("render/FramebufferTile",["../error/ArgumentError","../render/FramebufferTexture","../util/Logger","../geom/Matrix","../geom/Rectangle","../render/TextureTile"],function(e,t,n,r,i,s){"use strict";var o=function(t,i,o,u,a){if(!a||a.length<1)throw new e(n.logMessage(n.LEVEL_SEVERE,"FramebufferTile","constructor","The specified cache name is null, undefined or zero length."));s.call(this,t,i,o,u),this.gpuCacheKey=a,this.textureTransform=r.fromIdentity().setToUnitYFlip(),this.mustClear=!0};return o.prototype=Object.create(s.prototype),o.prototype.clearFramebuffer=function(e){this.mustClear=!0},o.prototype.bindFramebuffer=function(e){var t=e.gpuResourceCache.resourceForKey(this.gpuCacheKey);return t||(t=this.createFramebuffer(e)),e.bindFramebuffer(t),this.mustClear&&(this.doClearFramebuffer(e),this.mustClear=!1),!0},o.prototype.createFramebuffer=function(e){var n=new t(e.currentGlContext,this.tileWidth,this.tileHeight,!1);return e.gpuResourceCache.putResource(this.gpuCacheKey,n,n.size),n},o.prototype.doClearFramebuffer=function(e){var t=e.currentGlContext;t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT)},o.prototype.applyInternalTransform=function(e,t){t.multiplyMatrix(this.textureTransform)},o}),n("render/FramebufferTileController",["../error/ArgumentError","../render/FramebufferTile","../util/LevelSet","../geom/Location","../util/Logger","../cache/MemoryCache","../geom/Sector","../util/Tile"],function(e,t,n,r,i,s,o,u){"use strict";var a=function(){this.tileWidth=256,this.tileHeight=256,this.detailControl=1.75,this.levels=new n(o.FULL_SPHERE,new r(45,45),16,this.tileWidth,this.tileHeight),this.topLevelTiles=[],this.currentTiles=[],this.currentTimestamp=null,this.currentGlobeStateKey=null,this.tileCache=new s(5e5,4e5),this.key="FramebufferTileController "+ ++a.keyPool};return a.keyPool=0,a.prototype.selectTiles=function(t,n){if(!n)throw new e(i.logMessage(i.LEVEL_SEVERE,"FramebufferTileController","selectTiles","missingSector"));this.assembleTiles(t);var r=[];for(var s=0,o=this.currentTiles.length;s=75||t.sector.maxLatitude<=-75)n*=1.2;return t.level.isLastLevel()||!t.mustSubdivide(e,n)},a}),n("globe/ElevationImage",["../error/ArgumentError","../util/Logger","../util/WWMath"],function(e,t,n){"use strict";var r=function(n,r,i,s){if(!n||n.length<1)throw new e(t.logMessage(t.LEVEL_SEVERE,"ElevationImage","constructor","The specified image path is null, undefined or zero length."));if(!r)throw new e(t.logMessage(t.LEVEL_SEVERE,"ElevationImage","constructor","missingSector"));this.sector=r,this.imagePath=n,this.imageWidth=i,this.imageHeight=s,this.size=this.imageWidth*this.imageHeight};return r.prototype.pixel=function(e,t){return e<0||e>=this.imageWidth?0:t<0||t>=this.imageHeight?0:(t=this.imageHeight-t-1,this.imageData[e+t*this.imageWidth])},r.prototype.elevationAtLocation=function(e,t){var r=this.sector.maxLatitude,i=this.sector.minLongitude,s=this.sector.deltaLatitude(),o=this.sector.deltaLongitude(),u=(this.imageWidth-1)*(t-i)/o,a=(this.imageHeight-1)*(r-e)/s,f=Math.floor(n.clamp(u,0,this.imageWidth-1)),l=Math.floor(n.clamp(f+1,0,this.imageWidth-1)),c=Math.floor(n.clamp(a,0,this.imageHeight-1)),h=Math.floor(n.clamp(c+1,0,this.imageHeight-1)),p=this.imageData,d=p[f+c*this.imageWidth],v=p[l+c*this.imageWidth],m=p[f+h*this.imageWidth],g=p[l+h*this.imageWidth],y=u-f,b=a-c;return(1-y)*(1-b)*d+y*(1-b)*v+(1-y)*b*m+y*b*g},r.prototype.elevationsForGrid=function(r,i,s,o){if(!r)throw new e(t.logMessage(t.LEVEL_SEVERE,"ElevationImage","elevationsForSector","missingSector"));if(i<1||s<1)throw new e(t.logMessage(t.LEVEL_SEVERE,"ElevationImage","elevationsForSector","The specified number of sample points is less than 1."));if(!o)throw new e(t.logMessage(t.LEVEL_SEVERE,"ElevationImage","elevationsForSector","missingResult"));var u=this.sector.minLatitude,a=this.sector.maxLatitude,f=this.sector.minLongitude,l=this.sector.maxLongitude,c=a-u,h=l-f,p=r.minLatitude,d=r.maxLatitude,v=r.minLongitude,m=r.maxLongitude,g=(d-p)/(i>1?i-1:1),y=(m-v)/(s>1?s-1:1),b,w,E,S,x=0,T=this.imageData;for(S=0,b=p;S=u&&b<=a){var N=(this.imageHeight-1)*(a-b)/c,C=Math.floor(n.clamp(N,0,this.imageHeight-1)),k=Math.floor(n.clamp(C+1,0,this.imageHeight-1)),L=N-C;for(E=0,w=v;E=f&&w<=l){var A=(this.imageWidth-1)*(w-f)/h,O=Math.floor(n.clamp(A,0,this.imageWidth-1)),M=Math.floor(n.clamp(O+1,0,this.imageWidth-1)),_=A-O,D=T[O+C*this.imageWidth],P=T[M+C*this.imageWidth],H=T[O+k*this.imageWidth],B=T[M+k*this.imageWidth];o[x]=(1-_)*(1-L)*D+_*(1-L)*P+(1-_)*L*H+_*L*B}x++}}else x+=s}},r.prototype.minAndMaxElevationsForSector=function(e){var t=[];if(!e)t[0]=this.minElevation,t[1]=this.maxElevation;else if(e.contains(this.sector))t[0]>this.minElevation&&(t[0]=this.minElevation),t[1]w&&(m=w),gm&&(t[0]=m),t[1]0){this.minElevation=Number.MAX_VALUE,this.maxElevation=-this.minElevation;var e=this.imageData,t=this.imageWidth*this.imageHeight;for(var n=0;nr&&(this.minElevation=r),this.maxElevationa&&(i=a),f=u.maxElevation,s=0;l--){u=this.tileCache.entryForKey(l+"."+s+"."+o);if(u){a=u.image();if(a)return a.elevationAtLocation(e,t)}s=Math.floor(s/2),o=Math.floor(o/2)}return 0},c.prototype.pointElevationsForGrid=function(e,t,n,r,i){var s=0,o;this.assembleTiles(r,e,!0);if(this.currentTiles.length===0)return 0;this.currentTiles.sort(function(e,t){return e.level.levelNumber-t.level.levelNumber});for(var u=0,a=this.currentTiles.length;u1?t-1:1),l=e.deltaLongitude()/(n>1?n-1:1),c,h,p,d,v,m,g=0;for(v=0,c=s;v=0;x--){s=this.levels.level(x),o=Math.round(s.tileWidth*360/s.tileDelta.longitude),u=Math.round(s.tileHeight*180/s.tileDelta.latitude),a=1/(2*u),f=1-a,c=0,h=u-1,p=o*l.fract(e),d=u*l.clamp(t,a,f),v=l.mod(Math.floor(p-.5),o),m=l.mod(v+1,o),g=l.clamp(Math.floor(d-.5),c,h),y=l.clamp(g+1,c,h),b=l.fract(p-.5),w=l.fract(d-.5),E=x==n||x==0;if(this.lookupPixels(v,m,g,y,s,E,S)){r[i]=(1-b)*(1-w)*S[0]+b*(1-w)*S[1]+(1-b)*w*S[2]+b*w*S[3];return}}},c.prototype.lookupPixels=function(e,t,n,r,i,s,o){var u=i.levelNumber,a=i.tileWidth,f=i.tileHeight,l=Math.floor(n/f),c=Math.floor(r/f),h=Math.floor(e/a),p=Math.floor(t/a),d,v,m,g;return l==c&&l==this.cachedRow&&h==p&&h==this.cachedCol?d=v=m=g=this.cachedImage:l==c&&h==p?(d=this.lookupImage(u,l,h,s),v=m=g=d,this.cachedRow=l,this.cachedCol=h,this.cachedImage=d):(d=this.lookupImage(u,l,h,s),v=this.lookupImage(u,l,p,s),m=this.lookupImage(u,c,h,s),g=this.lookupImage(u,c,p,s)),d&&v&&m&&g?(o[0]=d.pixel(e%a,n%f),o[1]=v.pixel(t%a,n%f),o[2]=m.pixel(e%a,r%f),o[3]=g.pixel(t%a,r%f),!0):!1},c.prototype.lookupImage=function(e,t,n,r){var i=this.tileForLevel(e,t,n),s=i.image();return s==null&&r&&this.retrieveTileImage(i),s},c.prototype.createTile=function(e,t,n,r){var s=this.cachePath+"/"+t.levelNumber+"/"+n+"/"+n+"_"+r+".bil";return new i(e,t,n,r,s,this.imageCache)},c.prototype.assembleTiles=function(e,t,n){this.currentTiles=[],this.currentSector.copy(t),this.currentSector.intersection(this.coverageSector);if(this.currentSector.isEmpty())return;var r=e.tileDelta.latitude,i=e.tileDelta.longitude,s=f.computeRow(r,this.currentSector.minLatitude),o=f.computeLastRow(r,this.currentSector.maxLatitude),u=f.computeColumn(i,this.currentSector.minLongitude),a=f.computeLastColumn(i,this.currentSector.maxLongitude);for(var l=s;l<=o;l++)for(var c=u;c<=a;c++)this.addTileOrAncestor(e,l,c,n)},c.prototype.addTileOrAncestor=function(e,t,n,r){var i=this.tileForLevel(e.levelNumber,t,n);this.isTileImageInMemory(i)?this.addToCurrentTiles(i):(r&&this.retrieveTileImage(i),e.isFirstLevel()?this.currentTiles.push(i):this.addAncestor(e,t,n,r))},c.prototype.addAncestor=function(e,t,n,r){var i=null,s=Math.floor(t/2),o=Math.floor(n/2);for(var u=e.levelNumber-1;u>=0;u--){i=this.tileForLevel(u,s,o);if(this.isTileImageInMemory(i)){this.addToCurrentTiles(i);return}s=Math.floor(s/2),o=Math.floor(o/2)}this.addToCurrentTiles(i),r&&this.retrieveTileImage(i)},c.prototype.addToCurrentTiles=function(e){this.currentTiles.push(e)},c.prototype.tileForLevel=function(e,t,n){var r=e+"."+t+"."+n,i=this.tileCache.entryForKey(r);if(i)return i;var s=this.levels.level(e),o=f.computeSector(s,t,n);return i=this.createTile(o,s,t,n),this.tileCache.putEntry(r,i,i.size()),i},c.prototype.isTileImageInMemory=function(e){return this.imageCache.containsKey(e.imagePath)},c.prototype.resourceUrlForTile=function(e){return this.urlBuilder.urlForTile(e,this.retrievalImageFormat)},c.prototype.retrieveTileImage=function(e){if(this.currentRetrievals.indexOf(e.imagePath)<0){var t=this.resourceUrlForTile(e,this.retrievalImageFormat),n=new XMLHttpRequest,r=this;if(!t)return;n.open("GET",t,!0),n.responseType="arraybuffer",n.onreadystatechange=function(){if(n.readyState===4){r.removeFromCurrentRetrievals(e.imagePath);var i=n.getResponseHeader("content-type");if(n.status===200)if(i===r.retrievalImageFormat||i==="text/plain"||i==="application/octet-stream"){o.log(o.LEVEL_INFO,"Elevations retrieval succeeded: "+t),r.loadElevationImage(e,n),r.absentResourceList.unmarkResourceAbsent(e.imagePath);var s=document.createEvent("Event");s.initEvent(WorldWind.REDRAW_EVENT_TYPE,!0,!0),window.dispatchEvent(s)}else i==="text/xml"?(r.absentResourceList.markResourceAbsent(e.imagePath),o.log(o.LEVEL_WARNING,"Elevations retrieval failed ("+n.statusText+"): "+t+".\n "+String.fromCharCode.apply(null,new Uint8Array(n.response)))):(r.absentResourceList.markResourceAbsent(e.imagePath),o.log(o.LEVEL_WARNING,"Elevations retrieval failed: "+t+". "+"Unexpected content type "+i));else r.absentResourceList.markResourceAbsent(e.imagePath),o.log(o.LEVEL_WARNING,"Elevations retrieval failed ("+n.statusText+"): "+t)}},n.onerror=function(){r.removeFromCurrentRetrievals(e.imagePath),r.absentResourceList.markResourceAbsent(e.imagePath),o.log(o.LEVEL_WARNING,"Elevations retrieval failed: "+t)},n.ontimeout=function(){r.removeFromCurrentRetrievals(e.imagePath),r.absentResourceList.markResourceAbsent(e.imagePath),o.log(o.LEVEL_WARNING,"Elevations retrieval timed out: "+t)},n.send(null),this.currentRetrievals.push(e.imagePath)}},c.prototype.removeFromCurrentRetrievals=function(e){var t=this.currentRetrievals.indexOf(e);t>-1&&this.currentRetrievals.splice(t,1)},c.prototype.loadElevationImage=function(e,t){var n=new r(e.imagePath,e.sector,e.tileWidth,e.tileHeight);this.retrievalImageFormat=="application/bil16"?(n.imageData=new Int16Array(t.response),n.size=n.imageData.length*2):this.retrievalImageFormat=="application/bil32"&&(n.imageData=new Float32Array(t.response),n.size=n.imageData.length*4),n.imageData&&(n.findMinAndMaxElevation(),this.imageCache.putEntry(e.imagePath,n,n.size),this.timestamp=Date.now())},c}),n("projections/GeographicProjection",["../error/ArgumentError","../util/Logger","../geom/Sector","../error/UnsupportedOperationError"],function(e,t,n,r){"use strict";var i=function(e,t,n){this.displayName=e||"Geographic Projection",this.continuous=t,this.projectionLimits=n,this.is2D=!0};return i.prototype.geographicToCartesian=function(e,n,i,s,o,u){throw new r(t.logMessage(t.LEVEL_SEVERE,"GeographicProjection","geographicToCartesian","abstractInvocation"))},i.prototype.geographicToCartesianGrid=function(e,n,i,s,o,u,a,f){throw new r(t.logMessage(t.LEVEL_SEVERE,"GeographicProjection","geographicToCartesianGrid","abstractInvocation"))},i.prototype.cartesianToGeographic=function(e,n,i,s,o,u){throw new r(t.logMessage(t.LEVEL_SEVERE,"GeographicProjection","cartesianToGeographic","abstractInvocation"))},i.prototype.northTangentAtLocation=function(n,r,i,s){if(!s)throw new e(t.logMessage(t.LEVEL_SEVERE,"ProjectionEquirectangular","northTangentAtLocation","missingResult"));return s[0]=0,s[1]=1,s[2]=0,s},i.prototype.northTangentAtPoint=function(n,r,i,s,o,u){if(!u)throw new e(t.logMessage(t.LEVEL_SEVERE,"ProjectionEquirectangular","northTangentAtPoint","missingResult"));return u[0]=0,u[1]=1,u[2]=0,u},i.prototype.surfaceNormalAtPoint=function(n,r,i,s,o){if(!o)throw new e(t.logMessage(t.LEVEL_SEVERE,"GeographicProjection","surfaceNormalAtPoint","missingResult"));return o[0]=0,o[1]=0,o[2]=1,o},i}),n("projections/ProjectionWgs84",["../geom/Angle","../error/ArgumentError","../projections/GeographicProjection","../util/Logger","../geom/Position","../geom/Vec3","../util/WWMath"],function(e,t,n,r,i,s,o){"use strict";var u=function(){n.call(this,"WGS84",!1,null),this.is2D=!1,this.scratchPosition=new i(0,0,0)};return u.prototype=Object.create(n.prototype),Object.defineProperties(u.prototype,{stateKey:{get:function(){return"projection wgs84 "}}}),u.prototype.geographicToCartesian=function(n,i,s,o,u,a){if(!n)throw new t(r.logMessage(r.LEVEL_SEVERE,"ProjectionWgs84","geographicToCartesian","missingGlobe"));var f=Math.cos(i*e.DEGREES_TO_RADIANS),l=Math.sin(i*e.DEGREES_TO_RADIANS),c=Math.cos(s*e.DEGREES_TO_RADIANS),h=Math.sin(s*e.DEGREES_TO_RADIANS),p=n.equatorialRadius/Math.sqrt(1-n.eccentricitySquared*l*l);return a[0]=(p+o)*f*h,a[1]=(p*(1-n.eccentricitySquared)+o)*l,a[2]=(p+o)*f*c,a},u.prototype.geographicToCartesianGrid=function(n,i,o,u,a,f,l,c){if(!n)throw new t(r.logMessage(r.LEVEL_SEVERE,"ProjectionWgs84","geographicToCartesianGrid","missingGlobe"));var h=i.minLatitude*e.DEGREES_TO_RADIANS,p=i.maxLatitude*e.DEGREES_TO_RADIANS,d=i.minLongitude*e.DEGREES_TO_RADIANS,v=i.maxLongitude*e.DEGREES_TO_RADIANS,m=(p-h)/(o>1?o-1:1),g=(v-d)/(u>1?u-1:1),y=f?f:new s(0,0,0),b,w,E=0,S=0,x,T,N,C,k,L,A=new Float64Array(u),O=new Float64Array(u);for(w=0,T=d;w0||w!=0?(N>0?(C=Math.sqrt(N),k=Math.sqrt(y*b*w),N>10*g?(L=o.cbrt((C+k)*(C+k)),T=E+.5*L+2*E*E/L):T=E+.5*o.cbrt((C+k)*(C+k))+.5*o.cbrt((C-k)*(C-k))):(C=Math.sqrt(-N),k=Math.sqrt(-8*E*E*E),L=Math.sqrt(y*b*w),A=2*Math.atan2(L,C+k)/3,T=-4*E*Math.sin(A)*Math.cos(Math.PI/6+A)),O=Math.sqrt(T*T+y*w),M=g*(T+O-w)/(2*O),_=(T+O)/(Math.sqrt(M*M+T+O)+M),D=_*d/(_+g),P=Math.sqrt(D*D+h*h),S=(_+g-1)*P/_,x=2*Math.atan2(h,P+D)):(C=Math.sqrt(1-g),k=Math.sqrt(g-b),H=Math.sqrt(g),S=-v*C*k/H,x=k/(H*k+C*Math.sqrt(b))),j=Math.sqrt(2),(j-1)*c1?!1:(a=a*.5+.5,f=f*.5+.5,l=l*.5+.5,a=a*h.width+h.x,f=f*h.height+h.y,n[0]=a,n[1]=f,n[2]=l,!0))},f.prototype.projectWithDepth=function(t,n,i){if(!t)throw new e(r.logMessage(r.LEVEL_SEVERE,"NavigatorState","projectWithDepth","missingPoint"));if(!i)throw new e(r.logMessage(r.LEVEL_SEVERE,"NavigatorState","projectWithDepth","missingResult"));var s=t[0],o=t[1],u=t[2],f=this.modelview,l=f[0]*s+f[1]*o+f[2]*u+f[3],c=f[4]*s+f[5]*o+f[6]*u+f[7],h=f[8]*s+f[9]*o+f[10]*u+f[11],p=f[12]*s+f[13]*o+f[14]*u+f[15],d=this.projection,v=d[0]*l+d[1]*c+d[2]*h+d[3]*p,m=d[4]*l+d[5]*c+d[6]*h+d[7]*p,g=d[8]*l+d[9]*c+d[10]*h+d[11]*p,y=d[12]*l+d[13]*c+d[14]*h+d[15]*p,b=this.viewport;return y===0?!1:(v/=y,m/=y,g/=y,g<-1||g>1?!1:(g=d[8]*l+d[9]*c+d[10]*h*(1+n)+d[11]*p,g/=y,g=a.clamp(g,-1,1),v=v*.5+.5,m=m*.5+.5,g=g*.5+.5,v=v*b.width+b.x,m=m*b.height+b.y,i[0]=v,i[1]=m,i[2]=g,!0))},f.prototype.unProject=function(t,n){if(!t)throw new e(r.logMessage(r.LEVEL_SEVERE,"NavigatorState","unProject","missingPoint"));if(!n)throw new e(r.logMessage(r.LEVEL_SEVERE,"NavigatorState","unProject","missingResult"));var i=t[0],s=t[1],o=t[2],u=this.viewport;i=(i-u.x)/u.width,s=(s-u.y)/u.height,i=i*2-1,s=s*2-1,o=o*2-1;if(o<-1||o>1)return!1;var a=this.modelviewProjectionInv,f=a[0]*i+a[1]*s+a[2]*o+a[3],l=a[4]*i+a[5]*s+a[6]*o+a[7],c=a[8]*i+a[9]*s+a[10]*o+a[11],h=a[12]*i+a[13]*s+a[14]*o+a[15];return h===0?!1:(n[0]=f/h,n[1]=l/h,n[2]=c/h,!0)},f.prototype.convertPointToWindow=function(t,n){if(!t)throw new e(r.logMessage(r.LEVEL_SEVERE,"NavigatorState","convertPointToWindow","missingPoint"));if(!n)throw new e(r.logMessage(r.LEVEL_SEVERE,"NavigatorState","convertPointToWindow","missingResult"));return n[0]=t[0],n[1]=this.viewport.height-t[1],n},f.prototype.convertPointToViewport=function(t,n){if(!t)throw new e(r.logMessage(r.LEVEL_SEVERE,"NavigatorState","convertPointToViewport","missingPoint"));if(!n)throw new e(r.logMessage(r.LEVEL_SEVERE,"NavigatorState","convertPointToViewport","missingResult"));return n[0]=t[0],n[1]=this.viewport.height-t[1],n},f.prototype.rayFromScreenPoint=function(t){if(!t)throw new e(r.logMessage(r.LEVEL_SEVERE,"NavigatorState","rayFromScreenPoint","missingPoint"));var i=this.convertPointToViewport(t,new u(0,0,0)),s=new u(0,0,0),o=new u(0,0,0);if(!this.unProject(i,s))return null;i[2]=1;if(!this.unProject(i,o))return null;var a=new u(this.eyePoint[0],this.eyePoint[1],this.eyePoint[2]),f=new u(o[0],o[1],o[2]);return f.subtract(s),f.normalize(),new n(a,f)},f.prototype.pixelSizeAtDistance=function(e){return this.pixelSizeScale*e+this.pixelSizeOffset},f}),n("globe/Terrain",["../error/ArgumentError","../util/Logger","../geom/Vec3"],function(e,t,n){"use strict";var r=function(e,t,n,r){this.globe=e,this.verticalExaggeration=r,this.sector=n.sector,this.tessellator=t,this.surfaceGeometry=n.tileArray,this.stateKey=e.stateKey+" ve "+r.toString()};return r.scratchPoint=new n(0,0,0),r.prototype.surfacePoint=function(n,i,s,o){if(!o)throw new e(t.logMessage(t.LEVEL_SEVERE,"Terrain","surfacePoint","missingResult"));for(var u=0,a=this.surfaceGeometry.length;uE?(i[0]=y[0]+w*(y[3]-y[0])+E*(y[6]-y[0]),i[1]=y[1]+w*(y[4]-y[1])+E*(y[7]-y[1]),i[2]=y[2]+w*(y[5]-y[2])+E*(y[8]-y[2])):(i[0]=y[9]+(1-w)*(y[6]-y[9])+(1-E)*(y[3]-y[9]),i[1]=y[10]+(1-w)*(y[7]-y[10])+(1-E)*(y[4]-y[10]),i[2]=y[11]+(1-w)*(y[8]-y[11])+(1-E)*(y[5]-y[11])),i[0]+=this.referencePoint[0],i[1]+=this.referencePoint[1],i[2]+=this.referencePoint[2],i},i.prototype.update=function(e){r.prototype.update.call(this,e);var t=e.globe.elevationTimestamp();this._elevationTimestamp!=t&&(this._elevationTimestamp=t,this._stateKey=null)},i.prototype.computeStateKey=function(){var e=[];return e.push(this._elevationTimestamp),e.push(this.neighborMap[WorldWind.NORTH]?this.neighborMap[WorldWind.NORTH].compare(this.level):0),e.push(this.neighborMap[WorldWind.SOUTH]?this.neighborMap[WorldWind.SOUTH].compare(this.level):0),e.push(this.neighborMap[WorldWind.EAST]?this.neighborMap[WorldWind.EAST].compare(this.level):0),e.push(this.neighborMap[WorldWind.WEST]?this.neighborMap[WorldWind.WEST].compare(this.level):0),e.join(".")},i}),n("globe/TerrainTileList",["../error/ArgumentError","../util/Logger","../geom/Sector"],function(e,t,n){"use strict";var r=function(r){if(!r)throw new e(t.logMessage(t.LEVEL_SEVERE,"TerrainTileList","TerrainTileList","missingTessellator"));this.tessellator=r,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 e(t.logMessage(t.LEVEL_SEVERE,"TerrainTileList","addTile","missingTile"));this.tileArray.indexOf(r)==-1&&(this.tileArray.push(r),this.sector?this.sector.union(r.sector):(this.sector=new n(0,0,0,0),this.sector.copy(r.sector)))},r.prototype.removeAllTiles=function(){this.tileArray=[],this.sector=null},r}),n("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(e,t,n,r,i,s,o,u,a,f,l,c,h,p,d,v,m,g,y,b,w,E){"use strict";var S=function(){this.numRowsTilesInTopLevel=4,this.numColumnsTilesInTopLevel=8,this.maximumSubdivisionDepth=15,this.tileWidth=32,this.tileHeight=32,this.detailControl=40,this.levels=new s(v.FULL_SPHERE,new o(180/this.numRowsTilesInTopLevel,360/this.numColumnsTilesInTopLevel),this.maximumSubdivisionDepth,this.tileWidth,this.tileHeight),this.topLevelTiles={},this.currentTiles=new y(this),this.tileCache=new f(5e6,4e6),this.elevationTimestamp=undefined,this.lastModelViewProjection=undefined,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=a.fromIdentity(),this.scratchElevations=null,this.scratchPrevElevations=null,this.corners={},this.tiles=[]};return S.prototype.tessellate=function(t){if(!t)throw new e(u.logMessage(u.LEVEL_SEVERE,"Tessellator","tessellate","missingDC"));var n=t.globe.elevationTimestamp();if(this.lastGlobeStateKey===t.globeStateKey&&this.lastVerticalExaggeration===t.verticalExaggeration&&this.elevationTimestamp===n&&this.lastModelViewProjection&&t.navigatorState.modelviewProjection.equals(this.lastModelViewProjection))return this.lastTerrain;var r=t.navigatorState;this.lastModelViewProjection=r.modelviewProjection,this.lastGlobeStateKey=t.globeStateKey,this.elevationTimestamp=n,this.lastVerticalExaggeration=t.verticalExaggeration,this.currentTiles.removeAllTiles(),(!this.topLevelTiles[t.globeStateKey]||this.topLevelTiles[t.globeStateKey].length==0)&&this.createTopLevelTiles(t),this.corners={},this.tiles=[];for(var i=0,s=this.topLevelTiles[t.globeStateKey].length;i=0){var i=r.resourceForKey(this.texCoordVboCacheKey);n.bindBuffer(n.ARRAY_BUFFER,i),n.vertexAttribPointer(this.vertexTexCoordLocation,2,n.FLOAT,!1,0,0),n.enableVertexAttribArray(this.vertexTexCoordLocation)}var s=r.resourceForKey(this.indicesVboCacheKey);n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,s)},S.prototype.endRendering=function(e){var t=e.currentGlContext;t.bindBuffer(t.ARRAY_BUFFER,null),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,null),this.vertexPointLocation>=0&&t.disableVertexAttribArray(this.vertexPointLocation),this.vertexTexCoordLocation>=0&&t.disableVertexAttribArray(this.vertexTexCoordLocation)},S.prototype.beginRenderingTile=function(t,n){if(!n)throw new e(u.logMessage(u.LEVEL_SEVERE,"Tessellator","beginRenderingTile","missingTile"));var r=t.currentGlContext,i=t.gpuResourceCache;this.scratchMatrix.setToMultiply(t.navigatorState.modelviewProjection,n.transformationMatrix),t.currentProgram.loadModelviewProjection(r,this.scratchMatrix);var s=t.globeStateKey+n.tileKey,o=i.resourceForKey(s);o?n.pointsVboStateKey!=n.pointsStateKey?(r.bindBuffer(r.ARRAY_BUFFER,o),r.bufferSubData(r.ARRAY_BUFFER,0,n.points),n.pointsVboStateKey=n.pointsStateKey):t.currentGlContext.bindBuffer(r.ARRAY_BUFFER,o):(o=r.createBuffer(),r.bindBuffer(r.ARRAY_BUFFER,o),r.bufferData(r.ARRAY_BUFFER,n.points,r.STATIC_DRAW),t.frameStatistics.incrementVboLoadCount(1),i.putResource(s,o,n.points.length*4),n.pointsVboStateKey=n.pointsStateKey),r.vertexAttribPointer(this.vertexPointLocation,3,r.FLOAT,!1,0,0)},S.prototype.endRenderingTile=function(e,t){},S.prototype.renderTile=function(t,n){if(!n)throw new e(u.logMessage(u.LEVEL_SEVERE,"Tessellator","renderTile","missingTile"));var r=t.currentGlContext,i=r.TRIANGLE_STRIP;r.drawElements(i,this.numBaseIndices,r.UNSIGNED_SHORT,this.baseIndicesOffset*2);var s=n.level,o;o=n.neighborLevel(WorldWind.NORTH),o&&o.compare(s)<0?r.drawElements(i,this.numIndicesLoresNorth,r.UNSIGNED_SHORT,this.indicesLoresNorthOffset*2):r.drawElements(i,this.numIndicesNorth,r.UNSIGNED_SHORT,this.indicesNorthOffset*2),o=n.neighborLevel(WorldWind.SOUTH),o&&o.compare(s)<0?r.drawElements(i,this.numIndicesLoresSouth,r.UNSIGNED_SHORT,this.indicesLoresSouthOffset*2):r.drawElements(i,this.numIndicesSouth,r.UNSIGNED_SHORT,this.indicesSouthOffset*2),o=n.neighborLevel(WorldWind.WEST),o&&o.compare(s)<0?r.drawElements(i,this.numIndicesLoresWest,r.UNSIGNED_SHORT,this.indicesLoresWestOffset*2):r.drawElements(i,this.numIndicesWest,r.UNSIGNED_SHORT,this.indicesWestOffset*2),o=n.neighborLevel(WorldWind.EAST),o&&o.compare(s)<0?r.drawElements(i,this.numIndicesLoresEast,r.UNSIGNED_SHORT,this.indicesLoresEastOffset*2):r.drawElements(i,this.numIndicesEast,r.UNSIGNED_SHORT,this.indicesEastOffset*2)},S.prototype.renderWireframeTile=function(t,n){if(!n)throw new e(u.logMessage(u.LEVEL_SEVERE,"Tessellator","renderWireframeTile","missingTile"));var r=t.currentGlContext;this.vertexTexCoordLocation>=0&&r.disableVertexAttribArray(this.vertexTexCoordLocation),r.drawElements(r.LINES,this.numWireframeIndices,r.UNSIGNED_SHORT,this.wireframeIndicesOffset*2)},S.prototype.renderTileOutline=function(t,n){if(!n)throw new e(u.logMessage(u.LEVEL_SEVERE,"Tessellator","renderTileOutline","missingTile"));var r=t.currentGlContext;this.vertexTexCoordLocation>=0&&r.disableVertexAttribArray(this.vertexTexCoordLocation),r.drawElements(r.LINE_LOOP,this.numOutlineIndices,r.UNSIGNED_SHORT,this.outlineIndicesOffset*2)},S.prototype.pick=function(t,n,r){if(!t)throw new e(u.logMessage(u.LEVEL_SEVERE,"Tessellator","pick","missingDc"));if(!n)throw new e(u.logMessage(u.LEVEL_SEVERE,"Tessellator","pick","missingList"));var i=null,s=r||this,o=new p(0,0,0),a=[];for(var f=0,l=n.length;fu&&(s=u,o=r)}return n[o]},S.prototype.computeIntersections=function(e,t,n){var r=t.level,i,s=t.points,o,u=n.length;e.origin.subtract(t.referencePoint),this.buildSharedGeometry(t),o=this.baseIndices,w.computeTriStripIntersections(e,s,o,n),i=t.neighborLevel(WorldWind.SOUTH),o=i&&i.compare(r)<0?this.indicesLoresSouth:this.indicesSouth,w.computeTriStripIntersections(e,s,o,n),i=t.neighborLevel(WorldWind.WEST),o=i&&i.compare(r)<0?this.indicesLoresWest:this.indicesWest,w.computeTriStripIntersections(e,s,o,n),i=t.neighborLevel(WorldWind.EAST),o=i&&i.compare(r)<0?this.indicesLoresEast:this.indicesEast,w.computeTriStripIntersections(e,s,o,n),i=t.neighborLevel(WorldWind.NORTH),o=i&&i.compare(r)<0?this.indicesLoresNorth:this.indicesNorth,w.computeTriStripIntersections(e,s,o,n),e.origin.add(t.referencePoint);for(var a=u,f=n.length;a0){this.tiles=[],this.corners={};for(n=0,r=d.length;n=0?this.tiles[l].level:null),e.setNeighborLevel(WorldWind.SOUTH,c>=0?this.tiles[c].level:null),e.setNeighborLevel(WorldWind.EAST,h>=0?this.tiles[h].level:null),e.setNeighborLevel(WorldWind.WEST,p>=0?this.tiles[p].level:null)},S.prototype.isTileVisible=function(e,t){return e.globe.projectionLimits&&!t.sector.overlaps(e.globe.projectionLimits)?!1:t.extent.intersectsFrustum(e.navigatorState.frustumInModelCoordinates)},S.prototype.tileMeetsRenderCriteria=function(e,t){var n=this.detailControl;if(t.sector.minLatitude>=75||t.sector.maxLatitude<=-75)n*=2;return t.level.isLastLevel()||!t.mustSubdivide(e,n)},S.prototype.regenerateTileGeometryIfNeeded=function(e,t){var n=e.globeStateKey+t.stateKey+e.verticalExaggeration;if(!t.points||t.pointsStateKey!=n)this.regenerateTileGeometry(e,t),t.pointsStateKey=n},S.prototype.regenerateTileGeometry=function(e,t){var n=t.tileHeight+1,r=t.tileWidth+1,i=t.referencePoint,s=this.scratchElevations;s||(s=new Float64Array(n*r),this.scratchElevations=s),t.points||(t.points=new Float32Array(n*r*3)),E.fillArray(s,0),e.globe.elevationsForGrid(t.sector,n,r,t.texelSize,s),this.mustAlignNeighborElevations(e,t)&&this.alignNeighborElevations(e,t,s),E.multiplyArray(s,e.verticalExaggeration),e.globe.computePointsForGrid(t.sector,n,r,s,i,t.points),t.transformationMatrix.setTranslation(i[0],i[1],i[2])},S.prototype.mustAlignNeighborElevations=function(e,t){var n=t.level,r=t.neighborLevel(WorldWind.NORTH),i=t.neighborLevel(WorldWind.SOUTH),s=t.neighborLevel(WorldWind.EAST),o=t.neighborLevel(WorldWind.WEST);return r&&r.compare(n)<0||i&&i.compare(n)<0||s&&s.compare(n)<0||o&&o.compare(n)<0},S.prototype.alignNeighborElevations=function(e,t,n){var r=t.tileHeight+1,i=t.tileWidth+1,s=t.level,o=Math.floor(r/2)+1,u=Math.floor(i/2)+1,a=s.previousLevel(),f=this.scratchPrevElevations,l,c,h,p;f||(f=new Float64Array(o*u),this.scratchPrevElevations=f),E.fillArray(f,0),e.globe.elevationsForGrid(t.sector,o,u,a.texelSize,f),l=t.neighborLevel(WorldWind.NORTH);if(l&&l.compare(s)<0){h=(r-1)*i,p=(o-1)*u;for(c=0;c0;l-=1)n=l+c*i,a[f++]=n,a[f++]=n-i;l=0,n=l+c*i,a[f++]=n,this.indicesNorthOffset=a.length-u,this.indicesNorth=new Uint16Array(a.slice(this.indicesNorthOffset)),this.numIndicesNorth=u,u=2*i-2,c=0,l=0,n=l+c*i,a[f++]=n;for(l=1;l0;c-=1)n=l+c*i,a[f++]=n,a[f++]=n+1;c=0,n=l+c*i,a[f++]=n,this.indicesWestOffset=a.length-u,this.indicesWest=new Uint16Array(a.slice(this.indicesWestOffset)),this.numIndicesWest=u,u=2*r-2,l=i-1,c=0,n=l+c*i,a[f++]=n;for(c=1;c0;l-=1)n=(l+1&-2)+c*i,a[f++]=n,n=l+(c-1)*i,a[f++]=n;l=0,n=l+c*i,a[f++]=n,this.indicesLoresNorthOffset=a.length-u,this.indicesLoresNorth=new Uint16Array(a.slice(this.indicesLoresNorthOffset)),this.numIndicesLoresNorth=u,u=2*i-2,c=0,l=0,n=l+c*i,a[f++]=n;for(l=1;l0;c-=1)n=l+(c+1&-2)*i,a[f++]=n,n=l+1+c*i,a[f++]=n;c=0,n=l+c*i,a[f++]=n,this.indicesLoresWestOffset=a.length-u,this.indicesLoresWest=new Uint16Array(a.slice(this.indicesLoresWestOffset)),this.numIndicesLoresWest=u,u=2*r-2,l=i-1,c=0,n=l+c*i,a[f++]=n;for(c=1;c=0;a-=1)l=a+f*r,s[u]=l,u+=1;a=0;for(f=n-1;f>=0;f-=1)l=a+f*r,s[u]=l,u+=1;return this.numOutlineIndices=i,s},S.prototype.cacheSharedGeometryVBOs=function(e){var t=e.currentGlContext,n=e.gpuResourceCache,r=n.resourceForKey(this.texCoordVboCacheKey);r||(r=t.createBuffer(),t.bindBuffer(t.ARRAY_BUFFER,r),t.bufferData(t.ARRAY_BUFFER,this.texCoords,t.STATIC_DRAW),e.frameStatistics.incrementVboLoadCount(1),n.putResource(this.texCoordVboCacheKey,r,this.texCoords.length*4/2));var i=n.resourceForKey(this.indicesVboCacheKey);i||(i=t.createBuffer(),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,i),t.bufferData(t.ELEMENT_ARRAY_BUFFER,this.indices,t.STATIC_DRAW),e.frameStatistics.incrementVboLoadCount(1),n.putResource(this.indicesVboCacheKey,i,this.indices.length*2))},S}),n("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(e,t,n,r,i,s,o,u,a,f,l,c,h){"use strict";var p=function(e,n){if(!e)throw new t(o.logMessage(o.LEVEL_SEVERE,"Globe","constructor","Elevation model is null or undefined."));this.elevationModel=e,this.equatorialRadius=6378137,this.polarRadius=6356752.3,this.eccentricitySquared=.00669437999013,this.tessellator=new l,this._projection=n||new a,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(e){if(!e)throw new t(o.logMessage(o.LEVEL_SEVERE,"Globe","projection","missingProjection"));this.projection!=e&&(this.tessellator=new l),this._projection=e}},projectionLimits:{get:function(){return this._projection.projectionLimits}},offset:{get:function(){return this._offset},set:function(e){this._offset=e,this.offsetVector[0]=e*2*Math.PI*this.equatorialRadius}}}),p.prototype.is2D=function(){return this.projection.is2D},p.prototype.computePointFromPosition=function(e,n,r,i){if(!i)throw new t(o.logMessage(o.LEVEL_SEVERE,"Globe","computePointFromPosition","missingResult"));return this.projection.geographicToCartesian(this,e,n,r,this.offsetVector,i)},p.prototype.computePointFromLocation=function(e,n,r){if(!r)throw new t(o.logMessage(o.LEVEL_SEVERE,"Globe","computePointFromLocation","missingResult"));return this.computePointFromPosition(e,n,0,r)},p.prototype.computePointsForGrid=function(e,n,r,i,s,u){if(!e)throw new t(o.logMessage(o.LEVEL_SEVERE,"Globe","computePointsFromPositions","missingSector"));if(n<1||r<1)throw new t(o.logMessage(o.LEVEL_SEVERE,"Globe","computePointsFromPositions","Number of latitude or longitude locations is less than one."));var a=n*r;if(!i||i.length180&&(i.longitude-=360)),i},p.prototype.radiusAt=function(t,n){var r=Math.sin(t*e.DEGREES_TO_RADIANS),i=this.equatorialRadius/Math.sqrt(1-this.eccentricitySquared*r*r);return i*Math.sqrt(1+(this.eccentricitySquared*this.eccentricitySquared-2*this.eccentricitySquared)*r*r)},p.prototype.surfaceNormalAtLocation=function(n,r,i){if(!i)throw new t(o.logMessage(o.LEVEL_SEVERE,"Globe","surfaceNormalAtLocation","missingResult"));if(this.is2D())return i[0]=0,i[1]=0,i[2]=1,i;var s=Math.cos(n*e.DEGREES_TO_RADIANS),u=Math.cos(r*e.DEGREES_TO_RADIANS),a=Math.sin(n*e.DEGREES_TO_RADIANS),f=Math.sin(r*e.DEGREES_TO_RADIANS),l=this.equatorialRadius*this.equatorialRadius,c=this.polarRadius*this.polarRadius;return i[0]=s*f/l,i[1]=(1-this.eccentricitySquared)*a/c,i[2]=s*u/l,i.normalize()},p.prototype.surfaceNormalAtPoint=function(e,n,r,i){if(!i)throw new t(o.logMessage(o.LEVEL_SEVERE,"Globe","surfaceNormalAtPoint","missingResult"));if(this.projection.surfaceNormalAtPoint)return this.projection.surfaceNormalAtPoint(this,e,n,r,i);if(this.is2D())return i[0]=0,i[1]=0,i[2]=1,i;var s=this.equatorialRadius*this.equatorialRadius,u=this.polarRadius*this.polarRadius;return i[0]=e/s,i[1]=n/u,i[2]=r/s,i.normalize()},p.prototype.northTangentAtLocation=function(e,n,r){if(!r)throw new t(o.logMessage(o.LEVEL_SEVERE,"Globe","northTangentAtLocation","missingResult"));return this.projection.northTangentAtLocation(this,e,n,r)},p.prototype.northTangentAtPoint=function(e,n,r,i){if(!i)throw new t(o.logMessage(o.LEVEL_SEVERE,"Globe","northTangentAtPoint","missingResult"));return this.projection.northTangentAtPoint(this,e,n,r,this.offsetVector,i)},p.prototype.intersectsFrustum=function(e){if(!e)throw new t(o.logMessage(o.LEVEL_SEVERE,"Globe","intersectsFrustum","missingFrustum"));if(this.is2D()){var r=new n;return r.setToSector(f.FULL_SPHERE,this,this.elevationModel.minElevation,this.elevationModel.maxElevation),r.intersectsFrustum(e)}return e.far.distance<=this.equatorialRadius?!1:e.left.distance<=this.equatorialRadius?!1:e.right.distance<=this.equatorialRadius?!1:e.top.distance<=this.equatorialRadius?!1:e.bottom.distance<=this.equatorialRadius?!1:e.near.distance<=this.equatorialRadius?!1:!0},p.prototype.intersectsLine=function(e,n){if(!e)throw new t(o.logMessage(o.LEVEL_SEVERE,"Globe","intersectWithRay","missingLine"));if(!n)throw new t(o.logMessage(o.LEVEL_SEVERE,"Globe","intersectsLine","missingResult"));if(this.is2D()){var r=e.direction[0],i=e.direction[1],s=e.direction[2],u=e.origin[0],a=e.origin[1],f=e.origin[2],l;return s==0&&f!=0?!1:(l=-f/s,l<0?!1:(n[0]=u+r*l,n[1]=a+i*l,n[2]=f+s*l,!0))}return h.computeEllipsoidalGlobeIntersection(e,this.equatorialRadius,this.polarRadius,n)},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(e){if(!e)throw new t(o.logMessage(o.LEVEL_SEVERE,"Globe","minAndMaxElevationsForSector","missingSector"));return this.elevationModel.minAndMaxElevationsForSector(e)},p.prototype.elevationAtLocation=function(e,t){return this.elevationModel.elevationAtLocation(e,t)},p.prototype.elevationsForGrid=function(e,n,r,i,s){if(!e)throw new t(o.logMessage(o.LEVEL_SEVERE,"Globe","elevationsForSector","missingSector"));if(n<=0||r<=0)throw new t(o.logMessage(o.LEVEL_SEVERE,"Globe","elevationsForSector","numLat or numLon is less than 1"));if(!s||s.length=n)throw new t(r.logMessage(r.LEVEL_SEVERE,"GpuResourceCache","constructor","Specified cache low-water value is undefined, negative or not less than the capacity."));this.entries=new i(n,s),this.cacheKeyPool=0,this.currentRetrievals={},this.absentResourceList=new e(3,6e4)};return Object.defineProperties(o.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}}}),o.prototype.generateCacheKey=function(){return"GpuResourceCache "+ ++this.cacheKeyPool},o.prototype.putResource=function(e,i,s){if(!e)throw new t(r.logMessage(r.LEVEL_SEVERE,"GpuResourceCache","putResource","missingKey."));if(!i)throw new t(r.logMessage(r.LEVEL_SEVERE,"GpuResourceCache","putResource","missingResource."));if(!s||s<1)throw new t(r.logMessage(r.LEVEL_SEVERE,"GpuResourceCache","putResource","The specified resource size is undefined or less than 1."));var o={resource:i};this.entries.putEntry(e instanceof n?e.key:e,o,s)},o.prototype.resourceForKey=function(e){var t=e instanceof n?this.entries.entryForKey(e.key):this.entries.entryForKey(e);return t?t.resource:null},o.prototype.containsResource=function(e){return this.entries.containsKey(e instanceof n?e.key:e)},o.prototype.removeResource=function(e){this.entries.removeEntry(e instanceof n?e.key:e)},o.prototype.clear=function(){this.entries.clear(!1)},o.prototype.retrieveTexture=function(e,t,i){if(!t)return null;if(t instanceof n){var o=new s(e,t.image,i);return this.putResource(t.key,o,o.size),o}if(this.currentRetrievals[t]||this.absentResourceList.isResourceAbsent(t))return null;var u=this,a=new Image;return a.onload=function(){r.log(r.LEVEL_INFO,"Image retrieval succeeded: "+t);var n=new s(e,a,i);u.putResource(t,n,n.size),delete u.currentRetrievals[t],u.absentResourceList.unmarkResourceAbsent(t);var o=document.createEvent("Event");o.initEvent(WorldWind.REDRAW_EVENT_TYPE,!0,!0),window.dispatchEvent(o)},a.onerror=function(){delete u.currentRetrievals[t],u.absentResourceList.markResourceAbsent(t),r.log(r.LEVEL_WARNING,"Image retrieval failed: "+t)},this.currentRetrievals[t]=t,a.crossOrigin="anonymous",a.src=t,null},o}),n("pick/PickedObjectList",[],function(){"use strict";var e=function(){this.objects=[]};return e.prototype.hasNonTerrainObjects=function(){return this.objects.length>1||this.objects.length===1&&this.terrainObject()==null},e.prototype.terrainObject=function(){for(var e=0,t=this.objects.length;e1)for(var t=0;t0?this.objects[0]:null},e}),n("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(e,t,n,r,i,s,o,u,a,f,l){"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=s.fromIdentity(),c.imageTransform=s.fromIdentity(),c.texCoordMatrix=s.fromIdentity(),c.prototype.clear=function(){this.imageUrls=[],this.stringCredits=[]},c.prototype.addImageCredit=function(t){if(!t)throw new e(i.logMessage(i.LEVEL_SEVERE,"ScreenCreditController","addImageCredit","missingUrl"));this.imageUrls.indexOf(t)===-1&&this.imageUrls.push(t)},c.prototype.addStringCredit=function(t,r){if(!t)throw new e(i.logMessage(i.LEVEL_SEVERE,"ScreenCreditController","addStringCredit","missingText"));if(!r)throw new e(i.logMessage(i.LEVEL_SEVERE,"ScreenCreditController","addStringCredit","missingColor"));this.stringCredits.indexOf(t)===-1&&this.stringCredits.push({text:t,color:r||n.WHITE})},c.prototype.drawCredits=function(e){if(this.imageUrls.length===0&&this.stringCredits.length===0)return;if(e.pickingMode)return;if(e.timestamp==this.lastFrameTimestamp)return;this.lastFrameTimestamp=e.timestamp,this.beginDrawingCredits(e);var t=e.navigatorState.viewport.width-(this.margin+this.imageCreditSize),n,r=0;for(var i=0;i0&&(t-=this.margin+this.imageCreditSize,r=l.max(n,r));var s=r+this.margin;for(var o=0;o=o?u=this.imageCreditSize/s:u=this.imageCreditSize/o,c.imageTransform.setTranslation(r,i,0),c.imageTransform.setScale(u*s,u*o,1),f=e.currentGlContext,l=e.currentProgram,c.scratchMatrix.copy(e.screenProjection),c.scratchMatrix.multiplyMatrix(c.imageTransform),l.loadModelviewProjection(f,c.scratchMatrix),l.loadTextureEnabled(f,!0),l.loadColor(f,n.WHITE),l.loadOpacity(f,this.opacity),c.texCoordMatrix.setToIdentity(),c.texCoordMatrix.multiplyByTextureTransform(a),l.loadTextureMatrix(f,c.texCoordMatrix),a.bind(e)&&f.drawArrays(f.TRIANGLE_STRIP,0,4),o):(e.gpuResourceCache.retrieveTexture(e.currentGlContext,t),0)},c.prototype.drawStringCredit=function(e,t,n){var r,i,s,o,u,a,f;return o=t.text+this.creditFont.toString(),s=e.gpuResourceCache.resourceForKey(o),s||(s=e.textSupport.createTexture(e,t.text,this.creditFont,!1),e.gpuResourceCache.putResource(o,s,s.size)),r=s.imageWidth,i=s.imageHeight,f=e.navigatorState.viewport.width-(r+this.margin),c.imageTransform.setTranslation(f,n,0),c.imageTransform.setScale(r,i,1),u=e.currentGlContext,a=e.currentProgram,c.scratchMatrix.copy(e.screenProjection),c.scratchMatrix.multiplyMatrix(c.imageTransform),a.loadModelviewProjection(u,c.scratchMatrix),a.loadTextureEnabled(u,!0),a.loadColor(u,t.color),a.loadOpacity(u,this.opacity),c.texCoordMatrix.setToIdentity(),c.texCoordMatrix.multiplyByTextureTransform(s),a.loadTextureMatrix(u,c.texCoordMatrix),s.bind(e)&&u.drawArrays(u.TRIANGLE_STRIP,0,4),!0},c}),n("shapes/ShapeAttributes",["../util/Color","../util/ImageSource"],function(e,t){"use strict";var n=function(t){this._drawInterior=t?t._drawInterior:!0,this._drawOutline=t?t._drawOutline:!0,this._enableLighting=t?t._enableLighting:!1,this._interiorColor=t?t._interiorColor:e.WHITE,this._outlineColor=t?t._outlineColor:e.RED,this._outlineWidth=t?t._outlineWidth:1,this._outlineStippleFactor=t?t._outlineStippleFactor:0,this._outlineStipplePattern=t?t._outlineStipplePattern:61680,this._imageSource=t?t._imageSource:null,this._depthTest=t?t._depthTest:!0,this._drawVerticals=t?t._drawVerticals:!1,this._applyLighting=t?t._applyLighting:!1,this.stateKeyInvalid=!0};return n.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 t?this.imageSource.key:this.imageSource:"null")+" dt "+this._depthTest+" dv "+this._drawVerticals+" li "+this._applyLighting},Object.defineProperties(n.prototype,{stateKey:{get:function(){return this.stateKeyInvalid&&(this._stateKey=this.computeStateKey(),this.stateKeyInvalid=!1),this._stateKey}},drawInterior:{get:function(){return this._drawInterior},set:function(e){this._drawInterior=e,this.stateKeyInvalid=!0}},drawOutline:{get:function(){return this._drawOutline},set:function(e){this._drawOutline=e,this.stateKeyInvalid=!0}},enableLighting:{get:function(){return this._enableLighting},set:function(e){this._enableLighting=e,this.stateKeyInvalid=!0}},interiorColor:{get:function(){return this._interiorColor},set:function(e){this._interiorColor=e,this.stateKeyInvalid=!0}},outlineColor:{get:function(){return this._outlineColor},set:function(e){this._outlineColor=e,this.stateKeyInvalid=!0}},outlineWidth:{get:function(){return this._outlineWidth},set:function(e){this._outlineWidth=e,this.stateKeyInvalid=!0}},outlineStipplePattern:{get:function(){return this._outlineStipplePattern},set:function(e){this._outlineStipplePattern=e,this.stateKeyInvalid=!0}},outlineStippleFactor:{get:function(){return this._outlineStippleFactor},set:function(e){this._outlineStippleFactor=e,this.stateKeyInvalid=!0}},imageSource:{get:function(){return this._imageSource},set:function(e){this._imageSource=e,this.stateKeyInvalid=!0}},depthTest:{get:function(){return this._depthTest},set:function(e){this._depthTest=e,this.stateKeyInvalid=!0}},drawVerticals:{get:function(){return this._drawVerticals},set:function(e){this._drawVerticals=e,this.stateKeyInvalid=!0}},applyLighting:{get:function(){return this._applyLighting},set:function(e){this._applyLighting=e,this.stateKeyInvalid=!0}}}),n}),n("shapes/SurfaceShape",["../error/AbstractError","../geom/Angle","../error/ArgumentError","../geom/Location","../util/Logger","../error/NotYetImplementedError","../pick/PickedObject","../render/Renderable","../geom/Sector","../shapes/ShapeAttributes","../error/UnsupportedOperationError","../util/WWMath"],function(e,t,n,r,i,s,o,u,a,f,l,c){"use strict";var h=function(e){u.call(this),this._displayName="Surface Shape",this._attributes=e?e:new f(null),this._highlightAttributes=null,this._highlighted=!1,this._enabled=!0,this._pathType=WorldWind.GREAT_CIRCLE,this._maximumNumEdgeIntervals=h.DEFAULT_NUM_EDGE_INTERVALS,this._polarThrottle=h.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.isPrepared=!1,this.layer=null,this.pickColor=null};return h.prototype=Object.create(u.prototype),Object.defineProperties(h.prototype,{stateKey:{get:function(){if(!this._attributesStateKey)this._highlighted?!this._highlightAttributes||(this._attributesStateKey=this._highlightAttributes.stateKey):!this._attributes||(this._attributesStateKey=this._attributes.stateKey),!this._attributesStateKey||(this.stateKeyInvalid=!0);else{var e=null;this._highlighted?!this._highlightAttributes||(e=this._highlightAttributes.stateKey):!this._attributes||(e=this._attributes.stateKey),e!=this._attributesStateKey&&(this._attributesStateKey=e,this.stateKeyInvalid=!0)}return this.stateKeyInvalid&&(this._stateKey=this.computeStateKey()),this._stateKey}},displayName:{get:function(){return this._displayName},set:function(e){this.stateKeyInvalid=!0,this._displayName=e}},attributes:{get:function(){return this._attributes},set:function(e){this.stateKeyInvalid=!0,this._attributes=e,this._attributesStateKey=e.stateKey}},highlightAttributes:{get:function(){return this._highlightAttributes},set:function(e){this.stateKeyInvalid=!0,this._highlightAttributes=e}},highlighted:{get:function(){return this._highlighted},set:function(e){this.stateKeyInvalid=!0,this._highlighted=e}},enabled:{get:function(){return this._enabled},set:function(e){this.stateKeyInvalid=!0,this._enabled=e}},pathType:{get:function(){return this._pathType},set:function(e){this.stateKeyInvalid=!0,this._pathType=e}},maximumNumEdgeIntervals:{get:function(){return this._maximumNumEdgeIntervals},set:function(e){this.stateKeyInvalid=!0,this._maximumNumEdgeIntervals=e}},polarThrottle:{get:function(){return this._polarThrottle},set:function(e){this.stateKeyInvalid=!0,this._polarThrottle=e}},sector:{get:function(){return this._sector}}}),h.staticStateKey=function(e){return e.stateKeyInvalid=!1,e.highlighted?e._highlightAttributes?e._attributesStateKey=e._highlightAttributes.stateKey:e._attributes?e._attributesStateKey=e._attributes.stateKey:e._attributesStateKey=null:e._attributes?e._attributesStateKey=e._attributes.stateKey:e._attributesStateKey=null,"dn "+e.displayName+" at "+(e._attributesStateKey?e._attributesStateKey:"null")+" hi "+e.highlighted+" en "+e.enabled+" pt "+e.pathType+" ne "+e.maximumNumEdgeIntervals+" po "+e.polarThrottle+" se "+"["+e.sector.minLatitude+","+e.sector.maxLatitude+","+e.sector.minLongitude+","+e.sector.maxLongitude+"]"},h.prototype.computeStateKey=function(){return h.staticStateKey(this)},h.prototype.area=function(e,t){throw new s(i.logMessage(i.LEVEL_SEVERE,"SurfaceShape","area","notYetImplemented"))},h.prototype.computeBoundaries=function(t){throw new e(i.logMessage(i.LEVEL_SEVERE,"SurfaceShape","computeBoundaries","abstractInvocation"))},h.prototype.render=function(e){if(!this.enabled)return;this.layer=e.currentLayer,this.prepareBoundaries(e),e.surfaceShapeTileBuilder.insertSurfaceShape(this)},h.prototype.interpolateLocations=function(e){var t=e[0],n=t,r,i=!0,s=!0,o=0,u=!0,a,f;this._locations=[t];for(a=1,f=e.length;a2&&(u=!1);u&&this.interpolateEdge(r,n,this._locations),this._locations.push(n),r=n}!this._isInteriorInhibited&&(r.latitude!=t.latitude||r.longitude!=t.longitude)&&(this.interpolateEdge(r,t,this._locations),this._locations.push(t))},h.prototype.interpolateEdge=function(e,t,n){var i=r.greatCircleDistance(e,t),s=Math.round(this._maximumNumEdgeIntervals*i/Math.PI),o,u;if(s>0){o=1/s,u=e;for(var a=this.throttledStep(o,u);a<1;a+=this.throttledStep(o,u))u=new r(0,0),r.interpolateAlongPath(this._pathType,a,e,t,u),n.push(u)}},h.prototype.throttledStep=function(e,n){var r=Math.cos(n.latitude*t.DEGREES_TO_RADIANS);r*=r;var i=this._polarThrottle/(1+this._polarThrottle);return e*(1-i+i*r)},h.prototype.prepareBoundaries=function(e){if(this.isPrepared)return;this._boundaries||this.computeBoundaries(e),this._locations||this.interpolateLocations(this._boundaries),this.prepareGeometry(e),this.prepareSectors(),this.isPrepared=!0},h.prototype.computeSectors=function(e){return this._sectors&&this._sectors.length>0?this._sectors:(this.prepareBoundaries(e),this._sectors)},h.prototype.prepareSectors=function(){var e=this._boundaries;if(!e)return;this._sector=new a(-90,90,-180,180),this._sector.setToBoundingSector(e);var t=this.containsPole(e);t!=r.poles.NONE?(t==r.poles.NORTH?this._sector=new a(this._sector.minLatitude,90,-180,180):this._sector=new a(-90,this._sector.maxLatitude,-180,180),this._sectors=[this._sector]):r.locationsCrossDateLine(e)?this._sectors=a.splitBoundingSectors(e):this._sector.isEmpty()||(this._sectors=[this._sector]);if(!this._sectors)return;if(this._pathType===WorldWind.GREAT_CIRCLE)for(var n=0,i=this._sectors.length;n1&&this._outlineGeometry.push(t[1])}else r.locationsCrossDateLine(n)?(t=this.repeatAroundDateline(n),this._interiorGeometry.push(t[0]),this._interiorGeometry.push(t[1]),this._outlineGeometry.push(t[0]),this._outlineGeometry.push(t[1])):(this._interiorGeometry.push(n),this._outlineGeometry.push(n))},h.prototype.containsPole=function(e){var t=!1,n=90,i=-90,s=e[0];for(var o=1,u=e.length;o0?r.poles.NORTH:i<0?r.poles.SOUTH:Math.abs(i)>=Math.abs(n)?r.poles.NORTH:r.poles.SOUTH:r.poles.NONE},h.prototype.cutAlongDateLine=function(e,t,n){if(t==r.poles.NONE)return e;var i=[],s=t==r.poles.NORTH?90:-90,o=e[e.length-1];for(var u=0,a=e.length;u0){t.lineWidth=4*p.outlineWidth,t.strokeStyle=h?this.pickColor.toRGBAString():p.outlineColor.toRGBAString();var d=this._attributes.outlineStipplePattern,v=this._attributes.outlineStippleFactor;for(u=0,a=this._outlineGeometry.length;u2)continue}t.beginPath(),t.moveTo(y,b),t.lineTo(w,E),t.stroke()}}}}if(h){var N=new o(this.pickColor.clone(),this.pickDelegate?this.pickDelegate:this,null,this.layer,!1);e.resolvePick(N)}},h.prototype.transformPath=function(e,t,n,r,i,s){var o,u,a,f,l,c,h,p,d,v,m,g,y,b,w,E=4,S,x,T,N,C;T=0,x=e[0],l=x.longitude*t+r,c=x.latitude*n+i,S=!0,d=m=o=a=l,v=g=u=f=c,s[T++]=a,s[T++]=f;for(N=1,C=e.length;N=E){d=Math.min(d,a),m=Math.max(m,a),v=Math.min(v,f),g=Math.max(g,f);if(s[T-2]!=h||s[T-1]!=p)s[T++]=h,s[T++]=p;s[T++]=a,s[T++]=f,o=a,u=f}}return m-d>=2||g-v>=2},h.DEFAULT_NUM_EDGE_INTERVALS=128,h.DEFAULT_POLAR_THROTTLE=10,h}),n("shapes/SurfaceShapeTile",["../geom/Angle","../error/ArgumentError","../util/Level","../util/Logger","../geom/Sector","../render/Texture","../render/TextureTile"],function(e,t,n,r,i,s,o){"use strict";var u=function(e,t,n,r){o.call(this,e,t,n,r),this.surfaceShapes=[],this.sector=e,this.cacheKey=null,this.pickSequence=0,this.surfaceShapeStateKeys=[],this.prevSurfaceShapes=[],this.createCtx2D()};return u.prototype=Object.create(o.prototype),u.prototype.clearShapes=function(){var e=this.prevSurfaceShapes;this.prevSurfaceShapes=this.surfaceShapes,this.surfaceShapes=e,this.surfaceShapes.splice(0,this.surfaceShapes.length)},u.prototype.hasShapes=function(){return this.surfaceShapes.length>0},u.prototype.getShapes=function(){return this.surfaceShapes},u.prototype.setShapes=function(e){this.surfaceShapes=e},u.prototype.getSector=function(){return this.sector},u.prototype.addSurfaceShape=function(e){this.surfaceShapes.push(e),this.surfaceShapeStateKeys.push(e.stateKey)},u.prototype.addAllSurfaceShapes=function(e){for(var t=0,n=e.length;t0?f:1,h=l>0?l:1,p=u/h,d=o/c,v=-(a.minLongitude-s.minLongitude)/h,m=-(a.minLatitude-s.minLatitude)/c;this.texMaskMatrix.set(p,0,0,v,0,d,0,m,0,0,1,0,0,0,0,1),this.texSamplerMatrix.setToUnitYFlip(),n.applyInternalTransform(e,this.texSamplerMatrix),this.texSamplerMatrix.multiplyMatrix(this.texMaskMatrix),i.loadTexSamplerMatrix(r,this.texSamplerMatrix),i.loadTexMaskMatrix(r,this.texMaskMatrix)},s}),n("render/TextSupport",["../error/ArgumentError","../shaders/BasicTextureProgram","../util/Color","../util/Logger","../geom/Matrix","../render/Texture","../geom/Vec2"],function(e,t,n,r,i,s,o){"use strict";var u=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 u.prototype.textSize=function(e,t,n){if(e.length===0)return new o(0,0);this.ctx2D.font=t.fontString;var r=e.split("\n"),i=r.length*t.size*(1+this.lineSpacing),s=0;for(var u=0;u0&&(a=a.substring(0,a.length-1)),a+="..."),a},u.prototype.wrapLine=function(e,t,n){var r="",i=e.trim(),s=this.textSize(i,n,0);if(s[0]>t){var o="",u=0,a=i.indexOf(" ",u+1);while(u0?this.surfaceRenderables[this.surfaceRenderables.length-1]:null},C.prototype.popSurfaceRenderable=function(){return this.surfaceRenderables.length>0?this.surfaceRenderables.pop():null},C.prototype.reverseSurfaceRenderables=function(){this.surfaceRenderables.reverse()},C.prototype.addOrderedRenderable=function(e,t){if(e){var n={orderedRenderable:e,insertionOrder:this.orderedRenderablesCounter++,eyeDistance:t||e.eyeDistance,globeStateKey:this.globeStateKey};this.globe.continuous&&(n.globeOffset=this.globe.offset),n.eyeDistance===0?this.screenRenderables.push(n):this.orderedRenderables.push(n)}},C.prototype.addOrderedRenderableToBack=function(e){if(e){var t={orderedRenderable:e,insertionOrder:this.orderedRenderablesCounter++,eyeDistance:Number.MAX_VALUE,globeStateKey:this.globeStateKey};this.globe.continuous&&(t.globeOffset=this.globe.offset),this.orderedRenderables.push(t)}},C.prototype.peekOrderedRenderable=function(){return this.orderedRenderables.length>0?this.orderedRenderables[this.orderedRenderables.length-1].orderedRenderable:null},C.prototype.popOrderedRenderable=function(){if(this.orderedRenderables.length>0){var e=this.orderedRenderables.pop();return this.globeStateKey=e.globeStateKey,this.globe.continuous&&(this.globe.offset=e.globeOffset),e.orderedRenderable}return null},C.prototype.nextScreenRenderable=function(){if(this.screenRenderables.length>0){var e=this.screenRenderables.shift();return this.globeStateKey=e.globeStateKey,this.globe.continuous&&(this.globe.offset=e.globeOffset),e.orderedRenderable}return null},C.prototype.sortOrderedRenderables=function(){this.orderedRenderables.sort(function(e,t){var n=e.eyeDistance,r=t.eyeDistance;if(nr)return 1;var i=e.insertionOrder,s=t.insertionOrder;return i>s?-1:i_.x+_.width||H>_.y+_.height?!1:(M.x=N.clamp(D,_.x,_.x+_.width),M.y=N.clamp(H,_.y,_.y+_.height),M.width=N.clamp(P,_.x,_.x+_.width)-M.x,M.height=N.clamp(B,_.y,_.y+_.height)-M.y,this.pickRectangle=M,A[0]=M.x,A[1]=M.y,A[2]=0,this.navigatorState.unProject(A,e=new T(0,0,0)),A[0]=M.x,A[1]=M.y,A[2]=1,this.navigatorState.unProject(A,t=new T(0,0,0)),A[0]=M.x+M.width,A[1]=M.y,A[2]=0,this.navigatorState.unProject(A,n=new T(0,0,0)),A[0]=M.x+M.width,A[1]=M.y,A[2]=1,this.navigatorState.unProject(A,r=new T(0,0,0)),A[0]=M.x,A[1]=M.y+M.height,A[2]=0,this.navigatorState.unProject(A,i=new T(0,0,0)),A[0]=M.x,A[1]=M.y+M.height,A[2]=1,this.navigatorState.unProject(A,o=new T(0,0,0)),A[0]=M.x+M.width,A[1]=M.y+M.height,A[2]=0,this.navigatorState.unProject(A,u=new T(0,0,0)),A[0]=M.x+M.width,A[1]=M.y+M.height,A[2]=1,this.navigatorState.unProject(A,a=new T(0,0,0)),C=new T(o[0]-e[0],o[1]-e[1],o[2]-e[2]),k.set(i[0]-t[0],i[1]-t[1],i[2]-t[2]),f=C.cross(k),g=new d(f[0],f[1],f[2],-f.dot(e)),g.normalize(),C=new T(u[0]-r[0],u[1]-r[1],u[2]-r[2]),k.set(a[0]-n[0],a[1]-n[1],a[2]-n[2]),l=C.cross(k),y=new d(l[0],l[1],l[2],-l.dot(n)),y.normalize(),C=new T(o[0]-u[0],o[1]-u[1],o[2]-u[2]),k.set(a[0]-i[0],a[1]-i[1],a[2]-i[2]),c=C.cross(k),b=new d(c[0],c[1],c[2],-c.dot(i)),b.normalize(),C=new T(r[0]-e[0],r[1]-e[1],r[2]-e[2]),k.set(t[0]-n[0],t[1]-n[1],t[2]-n[2]),h=C.cross(k),w=new d(h[0],h[1],h[2],-h.dot(n)),w.normalize(),C=new T(i[0]-n[0],i[1]-n[1],i[2]-n[2]),k.set(u[0]-e[0],u[1]-e[1],u[2]-e[2]),p=C.cross(k),E=new d(p[0],p[1],p[2],-p.dot(e)),E.normalize(),C=new T(a[0]-t[0],a[1]-t[1],a[2]-t[2]),k.set(o[0]-r[0],o[1]-r[1],o[2]-r[2]),v=C.cross(k),S=new d(v[0],v[1],v[2],-v.dot(t)),S.normalize(),this.pickFrustum=new s(g,y,w,b,E,S),!0)},C.prototype.isSmall=function(e,t){if(!e)return!1;var n=this.navigatorState.eyePoint.distanceTo(e.center),r=this.navigatorState.pixelSizeAtDistance(n);return 2*e.radiusDate.now()},a.prototype.determineActiveAttributes=function(e){this.highlighted&&this._highlightAttributes?this.activeAttributes=this.highlightAttributes:this.activeAttributes=this._attributes},a.prototype.isWithinProjectionLimits=function(e){return!0},a.prototype.applyMvpMatrix=function(e){this.scratchMatrix.copy(e.navigatorState.modelviewProjection),this.scratchMatrix.multiplyMatrix(this.currentData.transformationMatrix),e.currentProgram.loadModelviewProjection(e.currentGlContext,this.scratchMatrix)},a.prototype.applyMvpMatrixForOutline=function(e){this.scratchMatrix.copy(e.navigatorState.projection),this.scratchMatrix.offsetProjectionDepth(-0.001),this.scratchMatrix.multiplyMatrix(e.navigatorState.modelview),this.scratchMatrix.multiplyMatrix(this.currentData.transformationMatrix),e.currentProgram.loadModelviewProjection(e.currentGlContext,this.scratchMatrix)},a}),n("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(e,t,n,r,i,s,o,u,a,f,l,c,h,p,d,v){"use strict";var m=function(t){e.call(this,t),this.pickTransparentImagePixels=!0,this._altitudeScale=1};return m.prototype=Object.create(e.prototype),Object.defineProperties(m.prototype,{altitudeScale:{get:function(){return this._altitudeScale},set:function(e){this._altitudeScale=e,this.reset()}}}),m.prototype.mustGenerateGeometry=function(e){return this.currentData.meshPoints?this.currentData.drawInterior!==this.activeAttributes.drawInterior?!0:this.activeAttributes.applyLighting&&!this.currentData.normals?!0:this.altitudeMode===WorldWind.ABSOLUTE?!1:this.currentData.isExpired:!0},m.prototype.doMakeOrderedRenderable=function(e){if(!this.activeAttributes.drawInterior&&!this.activeAttributes.drawOutline)return null;if(!this.mustGenerateGeometry(e))return this;var t=this.currentData,n=t.referencePoint;return e.surfacePointForMode(this.referencePosition.latitude,this.referencePosition.longitude,this.referencePosition.altitude*this._altitudeScale,this._altitudeMode,n),t.transformationMatrix.setToTranslation(n[0],n[1],n[2]),t.meshPoints=this.computeMeshPoints(e,t),t.refreshVertexBuffer=!0,this.activeAttributes.imageSource&&!this.texCoords&&(this.texCoords=this.computeTexCoords(),this.texCoords&&(t.refreshTexCoordBuffer=!0)),this.meshIndices||(this.meshIndices=this.computeMeshIndices(),t.refreshMeshIndices=!0),this.meshOutlineIndices||(this.meshOutlineIndices=this.computeOutlineIndices(),this.meshOutlineIndices&&(t.refreshOutlineIndices=!0)),this.activeAttributes.applyLighting&&this.computeNormals(t),t.drawInterior=this.activeAttributes.drawInterior,this.resetExpiration(t),t.extent||(t.extent=new r),t.extent.setToPoints(t.meshPoints),t.extent.translate(t.referencePoint),this},m.prototype.computeMeshPoints=function(e,t){throw new UnsupportedOperationError(a.logMessage(a.LEVEL_SEVERE,"AbstractMesh","computeMeshPoints","abstractInvocation"))},m.prototype.computeTexCoords=function(){return null},m.prototype.computeMeshIndices=function(e){throw new UnsupportedOperationError(a.logMessage(a.LEVEL_SEVERE,"AbstractMesh","computeMeshIndices","abstractInvocation"))},m.prototype.computeOutlineIndices=function(e){},m.prototype.computeNormals=function(e){var t=new Float32Array(e.meshPoints.length),n=this.meshIndices,r=e.meshPoints,i=[],s=[new d(0,0,0),new d(0,0,0),new d(0,0,0)],o;for(var u=0;u=1||e.pickingMode),n.loadColor(t,e.pickingMode?a:u),n.loadOpacity(t,e.pickingMode?o>0?1:0:o),i&&(!e.pickingMode||!this.pickTransparentImagePixels)&&(this.activeTexture=e.gpuResourceCache.resourceForKey(this.activeAttributes.imageSource),this.activeTexture||(this.activeTexture=e.gpuResourceCache.retrieveTexture(e.currentGlContext,this.activeAttributes.imageSource)),f=this.activeTexture&&this.activeTexture.bind(e),f&&(r.texCoordsVboCacheKey||(r.texCoordsVboCacheKey=e.gpuResourceCache.generateCacheKey()),s=e.gpuResourceCache.resourceForKey(r.texCoordsVboCacheKey),s||(s=t.createBuffer(),e.gpuResourceCache.putResource(r.texCoordsVboCacheKey,s,this.texCoords.length*4),r.refreshTexCoordBuffer=!0),t.bindBuffer(t.ARRAY_BUFFER,s),r.refreshTexCoordBuffer&&(t.bufferData(t.ARRAY_BUFFER,this.texCoords,t.STATIC_DRAW),e.frameStatistics.incrementVboLoadCount(1),r.refreshTexCoordBuffer=!1),n.loadTextureEnabled(t,!0),t.enableVertexAttribArray(n.vertexTexCoordLocation),t.vertexAttribPointer(n.vertexTexCoordLocation,2,t.FLOAT,!1,0,0),n.loadTextureUnit(t,t.TEXTURE0),n.loadModulateColor(t,e.pickingMode))),c&&(n.loadApplyLighting(t,!0),r.normalsVboCacheKey||(r.normalsVboCacheKey=e.gpuResourceCache.generateCacheKey()),s=e.gpuResourceCache.resourceForKey(r.normalsVboCacheKey),s||(s=t.createBuffer(),e.gpuResourceCache.putResource(r.normalsVboCacheKey,s,r.normals.length*4),r.refreshNormalsBuffer=!0),t.bindBuffer(t.ARRAY_BUFFER,s),r.refreshNormalsBuffer&&(t.bufferData(t.ARRAY_BUFFER,r.normals,t.STATIC_DRAW),e.frameStatistics.incrementVboLoadCount(1),r.refreshNormalsBuffer=!1),t.enableVertexAttribArray(n.normalVectorLocation),t.vertexAttribPointer(n.normalVectorLocation,3,t.FLOAT,!1,0,0)),t.drawElements(t.TRIANGLES,this.meshIndices.length,t.UNSIGNED_SHORT,0),i&&t.disableVertexAttribArray(n.vertexTexCoordLocation),c&&(n.loadApplyLighting(t,!1),t.disableVertexAttribArray(n.normalVectorLocation))}this.activeAttributes.drawOutline&&this.meshOutlineIndices&&(n.loadTextureEnabled(t,!1),t.disableVertexAttribArray(n.vertexTexCoordLocation),this.applyMvpMatrixForOutline(e),u=this.activeAttributes.outlineColor,o=u.alpha*e.currentLayer.opacity,t.depthMask(o>=1||e.pickingMode),n.loadColor(t,e.pickingMode?a:u),n.loadOpacity(t,e.pickingMode?1:o),t.lineWidth(this.activeAttributes.outlineWidth),r.outlineIndicesVboCacheKey||(r.outlineIndicesVboCacheKey=e.gpuResourceCache.generateCacheKey()),s=e.gpuResourceCache.resourceForKey(r.outlineIndicesVboCacheKey),s||(s=t.createBuffer(),e.gpuResourceCache.putResource(r.outlineIndicesVboCacheKey,s,this.meshOutlineIndices.length*2),r.refreshOutlineIndices=!0),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,s),r.refreshOutlineIndices&&(t.bufferData(t.ELEMENT_ARRAY_BUFFER,this.meshOutlineIndices,t.STATIC_DRAW),e.frameStatistics.incrementVboLoadCount(1),r.refreshOutlineIndices=!1),t.drawElements(t.LINE_STRIP,this.meshOutlineIndices.length,t.UNSIGNED_SHORT,0));if(e.pickingMode){var h=this.computePickPosition(e),p=new l(a,this.pickDelegate?this.pickDelegate:this,h,e.currentLayer,!1);e.resolvePick(p)}},m.prototype.computePickPosition=function(e){var t=this.currentData,n=e.navigatorState.rayFromScreenPoint(e.pickPoint),r=(new d(n.origin[0],n.origin[1],n.origin[2])).subtract(t.referencePoint),i=new o(r,n.direction),s=[];if(v.computeIndexedTrianglesIntersection(i,t.meshPoints,this.meshIndices,s)){var u=s[0];if(s.length>1){var a=u.distanceToSquared(e.navigatorState.eyePoint);for(var f=1;f0&&n[0].latitude!==undefined)s=n.slice(0),s.push(n[0]),this._boundariesSpecifiedSimply=!0;else if(n.length>1){var o=null;s=[];for(var u=0;u65536)throw new t(u.logMessage(u.LEVEL_SEVERE,"GeographicMesh","constructor","Too many positions. Must be fewer than 65536. Try using multiple meshes."));var i=n[0].length;for(var s=1;s=0;t--)e.push(this._positions[this.numRows-1][t]);for(n=this.numRows-2;n>0;n--)e.push(this._positions[n][0]);return new h(e,null)},v.prototype.computeMeshPoints=function(e,t){var n=Number.MAX_VALUE,r=e.navigatorState.eyePoint,i=new Float32Array(this.numRows*this.numColumns*3),s=new d(0,0,0),o=0,u,a;for(var f=0;f=(this.numRows-1)*this.numColumns;n--)e[t++]=n;for(r=this.numRows-2;r>=0;r--)e[t++]=r*this.numColumns;return e},v}),n("shapes/GeographicText",["../error/ArgumentError","../util/Logger","../shapes/Text","../geom/Vec3"],function(e,t,n,r){"use strict";var i=function(r,i){if(!r)throw new e(t.logMessage(t.LEVEL_SEVERE,"Text","constructor","missingPosition"));n.call(this,i),this.position=r,this.declutterGroup=1};return i.placePoint=new r(0,0,0),i.prototype=Object.create(n.prototype),i.prototype.clone=function(){var e=new i(this.position,this.text);return e.copy(this),e.pickDelegate=this.pickDelegate?this.pickDelegate:this,e},i.prototype.render=function(e){if(e.globe.projectionLimits&&!e.globe.projectionLimits.containsLocation(this.position.latitude,this.position.longitude))return;n.prototype.render.call(this,e)},i.prototype.computeScreenPointAndEyeDistance=function(e){return e.surfacePointForMode(this.position.latitude,this.position.longitude,this.position.altitude,this.altitudeMode,i.placePoint),e.navigatorState.frustumInModelCoordinates.containsPoint(i.placePoint)?(this.eyeDistance=this.alwaysOnTop?0:e.navigatorState.eyePoint.distanceTo(i.placePoint),e.navigatorState.projectWithDepth(i.placePoint,this.depthOffset,this.screenPoint)?!0:!1):!1},i}),n("formats/geojson/GeoJSONConstants",[],function(){"use strict";var e=function(){};return e.FIELD_TYPE="type",e.FIELD_CRS="crs",e.FIELD_NAME="name",e.FIELD_BBOX="bbox",e.FIELD_COORDINATES="coordinates",e.FIELD_GEOMETRIES="geometries",e.FIELD_GEOMETRY="geometry",e.FIELD_PROPERTIES="properties",e.FIELD_FEATURES="features",e.FIELD_ID="id",e.TYPE_POINT="Point",e.TYPE_MULTI_POINT="MultiPoint",e.TYPE_LINE_STRING="LineString",e.TYPE_MULTI_LINE_STRING="MultiLineString",e.TYPE_POLYGON="Polygon",e.TYPE_MULTI_POLYGON="MultiPolygon",e.TYPE_GEOMETRY_COLLECTION="GeometryCollection",e.TYPE_FEATURE="Feature",e.TYPE_FEATURE_COLLECTION="FeatureCollection",e.FIELD_CRS_NAME="name",e.FIELD_CRS_LINK="link",e.WGS84_CRS="urn:ogc:def:crs:OGC:1.3:CRS84",e.EPSG4326_CRS="EPSG:4326",e}),n("formats/geojson/GeoJSONGeometry",["./GeoJSONConstants"],function(e){"use strict";var t=function(e,t,n){if(!e)throw new ArgumentError(Logger.logMessage(Logger.LEVEL_SEVERE,"GeoJSONGeometry","constructor","missingCoordinates"));if(!t)throw new ArgumentError(Logger.logMessage(Logger.LEVEL_SEVERE,"GeoJSONGeometry","constructor","missingType"));this._coordinates=e,this._type=t,this._bbox=n?n:null};return Object.defineProperties(t.prototype,{coordinates:{get:function(){return this._coordinates}},type:{get:function(){return this._type}},bbox:{get:function(){return this._bbox}}}),t.prototype.isPointType=function(){return this.type===e.TYPE_POINT},t.prototype.isMultiPointType=function(){return this.type===e.TYPE_MULTI_POINT},t.prototype.isLineStringType=function(){return this.type===e.TYPE_LINE_STRING},t.prototype.isMultiLineStringType=function(){return this.type===e.TYPE_MULTI_LINE_STRING},t.prototype.isPolygonType=function(){return this.type===e.TYPE_POLYGON},t.prototype.isMultiPolygonType=function(){return this.type===e.TYPE_MULTI_POLYGON},t}),n("formats/geojson/GeoJSONGeometryCollection",["../../error/ArgumentError","./GeoJSONConstants","../../util/Logger"],function(e,t,n){"use strict";var r=function(t,r){if(!t)throw new e(n.logMessage(n.LEVEL_SEVERE,"GeoJSONGeometryCollection","constructor","missingGeometries"));if(Object.prototype.toString.call(t)!=="[object Array]")throw new e(n.logMessage(n.LEVEL_SEVERE,"GeoJSONGeometryCollection","constructor","invalidGeometries"));this._geometries=t,this._bbox=r};return Object.defineProperties(r.prototype,{geometries:{get:function(){return this._geometries}},bbox:{get:function(){return this._bbox}}}),r}),n("formats/geojson/GeoJSONGeometryLineString",["../../error/ArgumentError","./GeoJSONGeometry","../../util/Logger"],function(e,t,n){"use strict";var r=function(r,i,s){if(!r)throw new e(n.logMessage(n.LEVEL_SEVERE,"GeoJSONGeometryLineString","constructor","missingCoordinates"));if(r.length<2||r[0].length<2)throw new e(n.logMessage(n.LEVEL_SEVERE,"GeoJSONGeometryLineString","constructor","invalidNumberOfCoordinates"));if(Object.prototype.toString.call(r[0])!=="[object Array]"||Object.prototype.toString.call(r[0][0])!=="[object Number]")throw new e(n.logMessage(n.LEVEL_SEVERE,"GeoJSONGeometryLineString","constructor","invalidCoordinatesType"));if(!i)throw new e(n.logMessage(n.LEVEL_SEVERE,"GeoJSONGeometryLineString","constructor","missingType"));t.call(this,r,i,s)};return r.prototype=Object.create(t.prototype),r}),n("formats/geojson/GeoJSONGeometryMultiLineString",["../../error/ArgumentError","./GeoJSONGeometry","../../util/Logger"],function(e,t,n){"use strict";var r=function(r,i,s){if(!r)throw new e(n.logMessage(n.LEVEL_SEVERE,"GeoJSONGeometryMultiLineString","constructor","missingCoordinates"));if(r[0].length<2||r[0][0].length<2)throw new e(n.logMessage(n.LEVEL_SEVERE,"GeoJSONGeometryMultiLineString","constructor","invalidNumberOfCoordinates"));if(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]")throw new e(n.logMessage(n.LEVEL_SEVERE,"GeoJSONGeometryMultiLineString","constructor","invalidCoordinatesType"));if(!i)throw new e(n.logMessage(n.LEVEL_SEVERE,"GeoJSONGeometryLineString","constructor","missingType"));t.call(this,r,i,s)};return r.prototype=Object.create(t.prototype),r}),n("formats/geojson/GeoJSONGeometryMultiPoint",["../../error/ArgumentError","./GeoJSONGeometry","../../util/Logger"],function(e,t,n){"use strict";var r=function(r,i,s){if(!r)throw new e(n.logMessage(n.LEVEL_SEVERE,"GeoJSONGeometryMultiPoint","constructor","missingCoordinates"));if(r[0].length<2)throw new e(n.logMessage(n.LEVEL_SEVERE,"GeoJSONGeometryMultiPoint","constructor","invalidNumberOfCoordinates"));if(Object.prototype.toString.call(r[0])!=="[object Array]"||Object.prototype.toString.call(r[0][0])!=="[object Number]")throw new e(n.logMessage(n.LEVEL_SEVERE,"GeoJSONGeometryMultiPoint","constructor","invalidCoordinatesType"));if(!i)throw new e(n.logMessage(n.LEVEL_SEVERE,"GeoJSONGeometryPoint","constructor","missingType"));t.call(this,r,i,s)};return r.prototype=Object.create(t.prototype),r}),n("formats/geojson/GeoJSONGeometryMultiPolygon",["../../error/ArgumentError","./GeoJSONGeometry","../../util/Logger"],function(e,t,n){"use strict";var r=function(r,i,s){if(!r)throw new e(n.logMessage(n.LEVEL_SEVERE,"GeoJSONGeometryMultiPolygon","constructor","missingCoordinates"));if(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 Array]"||Object.prototype.toString.call(r[0][0][0][0])!=="[object Number]")throw new e(n.logMessage(n.LEVEL_SEVERE,"GeoJSONGeometryPolygon","constructor","invalidCoordinatesType"));if(!i)throw new e(n.logMessage(n.LEVEL_SEVERE,"GeoJSONGeometryPolygon","constructor","missingType"));t.call(this,r,i,s)};return r.prototype=Object.create(t.prototype),r}),n("formats/geojson/GeoJSONGeometryPoint",["../../error/ArgumentError","./GeoJSONGeometry","../../util/Logger"],function(e,t,n){"use strict";var r=function(r,i,s){if(!r)throw new e(n.logMessage(n.LEVEL_SEVERE,"GeoJSONGeometryPoint","constructor","missingCoordinates"));if(r.length<2)throw new e(n.logMessage(n.LEVEL_SEVERE,"GeoJSONGeometryPoint","constructor","invalidNumberOfCoordinates"));if(Object.prototype.toString.call(r)!=="[object Array]"||Object.prototype.toString.call(r[0])!=="[object Number]")throw new e(n.logMessage(n.LEVEL_SEVERE,"GeoJSONGeometryPoint","constructor","invalidCoordinatesType"));if(!i)throw new e(n.logMessage(n.LEVEL_SEVERE,"GeoJSONGeometryPoint","constructor","missingType"));t.call(this,r,i,s)};return r.prototype=Object.create(t.prototype),r}),n("formats/geojson/GeoJSONGeometryPolygon",["../../error/ArgumentError","./GeoJSONGeometry","../../util/Logger"],function(e,t,n){"use strict";var r=function(r,i,s){if(!r)throw new e(n.logMessage(n.LEVEL_SEVERE,"GeoJSONGeometryPolygon","constructor","missingCoordinates"));if(r[0].length<2||r[0][0].length<2)throw new e(n.logMessage(n.LEVEL_SEVERE,"GeoJSONGeometryPolygon","constructor","invalidNumberOfCoordinates"));if(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]")throw new e(n.logMessage(n.LEVEL_SEVERE,"GeoJSONGeometryPolygon","constructor","invalidCoordinatesType"));if(r[0][0]!==r[0][r.length-1])throw new e(n.logMessage(n.LEVEL_SEVERE,"GeoJSONGeometryPolygon","constructor","invalidLinearRing"));if(!i)throw new e(n.logMessage(n.LEVEL_SEVERE,"GeoJSONGeometryPolygon","constructor","missingType"));t.call(this,r,i,s)};return r.prototype=Object.create(t.prototype),r}),!function(e){if("object"==typeof exports)module.exports=e();else if("function"==typeof n&&n.amd)n("util/proj4-src",e);else{var t;"undefined"!=typeof window?t=window:"undefined"!=typeof global?t=global:"undefined"!=typeof self&&(t=self),t.proj4=e()}}(function(){var e,n,r;return function i(e,n,r){function s(u,a){if(!n[u]){if(!e[u]){var f=typeof t=="function"&&t;if(!a&&f)return f(u,!0);if(o)return o(u,!0);throw new Error("Cannot find module '"+u+"'")}var l=n[u]={exports:{}};e[u][0].call(l.exports,function(t){var n=e[u][1][t];return s(n?n:t)},l,l.exports,i,e,n,r)}return n[u].exports}var o=typeof t=="function"&&t;for(var u=0;u1&&(e=e>1?1:-1),Math.asin(e)}},{}],7:[function(e,t,n){t.exports=function(e){return 1-.25*e*(1+e/16*(3+1.25*e))}},{}],8:[function(e,t,n){t.exports=function(e){return.375*e*(1+.25*e*(1+.46875*e))}},{}],9:[function(e,t,n){t.exports=function(e){return.05859375*e*e*(1+.75*e)}},{}],10:[function(e,t,n){t.exports=function(e){return e*e*e*(35/3072)}},{}],11:[function(e,t,n){t.exports=function(e,t,n){var r=t*n;return e/Math.sqrt(1-r*r)}},{}],12:[function(e,t,n){t.exports=function(e,t,n,r,i){var s,o;s=e/t;for(var u=0;u<15;u++){o=(e-(t*s-n*Math.sin(2*s)+r*Math.sin(4*s)-i*Math.sin(6*s)))/(t-2*n*Math.cos(2*s)+4*r*Math.cos(4*s)-6*i*Math.cos(6*s)),s+=o;if(Math.abs(o)<=1e-10)return s}return NaN}},{}],13:[function(e,t,n){var r=Math.PI/2;t.exports=function(e,t){var n=1-(1-e*e)/(2*e)*Math.log((1-e)/(1+e));if(Math.abs(Math.abs(t)-n)<1e-6)return t<0?-1*r:r;var i=Math.asin(.5*t),s,o,u,a;for(var f=0;f<30;f++){o=Math.sin(i),u=Math.cos(i),a=e*o,s=Math.pow(1-a*a,2)/(2*u)*(t/(1-e*e)-o/(1-a*a)+.5/e*Math.log((1-a)/(1+a))),i+=s;if(Math.abs(s)<=1e-10)return i}return NaN}},{}],14:[function(e,t,n){t.exports=function(e,t,n,r,i){return e*i-t*Math.sin(2*i)+n*Math.sin(4*i)-r*Math.sin(6*i)}},{}],15:[function(e,t,n){t.exports=function(e,t,n){var r=e*t;return n/Math.sqrt(1-r*r)}},{}],16:[function(e,t,n){var r=Math.PI/2;t.exports=function(e,t){var n=.5*e,i,s,o=r-2*Math.atan(t);for(var u=0;u<=15;u++){i=e*Math.sin(o),s=r-2*Math.atan(t*Math.pow((1-i)/(1+i),n))-o,o+=s;if(Math.abs(s)<=1e-10)return o}return-9999}},{}],17:[function(e,t,n){var r=1,i=.25,s=.046875,o=.01953125,u=.01068115234375,a=.75,f=.46875,l=.013020833333333334,c=.007120768229166667,h=.3645833333333333,p=.005696614583333333,d=.3076171875;t.exports=function(e){var t=[];t[0]=r-e*(i+e*(s+e*(o+e*u))),t[1]=e*(a-e*(s+e*(o+e*u)));var n=e*e;return t[2]=n*(f-e*(l+e*c)),n*=e,t[3]=n*(h-e*p),t[4]=n*e*d,t}},{}],18:[function(e,t,n){var r=e("./pj_mlfn"),i=1e-10,s=20;t.exports=function(e,t,n){var o=1/(1-t),u=e;for(var a=s;a;--a){var f=Math.sin(u),l=1-t*f*f;l=(r(u,f,Math.cos(u),n)-e)*l*Math.sqrt(l)*o,u-=l;if(Math.abs(l)1e-7?(n=e*t,(1-e*e)*(t/(1-n*n)-.5/e*Math.log((1-n)/(1+n)))):2*t}},{}],21:[function(e,t,n){t.exports=function(e){return e<0?-1:1}},{}],22:[function(e,t,n){t.exports=function(e,t){return Math.pow((1-e)/(1+e),t)}},{}],23:[function(e,t,n){t.exports=function(e){var t={x:e[0],y:e[1]};return e.length>2&&(t.z=e[2]),e.length>3&&(t.m=e[3]),t}},{}],24:[function(e,t,n){var r=Math.PI/2;t.exports=function(e,t,n){var i=e*n,s=.5*e;return i=Math.pow((1-i)/(1+i),s),Math.tan(.5*(r-t))/i}},{}],25:[function(e,t,n){n.wgs84={towgs84:"0,0,0",ellipse:"WGS84",datumName:"WGS84"},n.ch1903={towgs84:"674.374,15.056,405.346",ellipse:"bessel",datumName:"swiss"},n.ggrs87={towgs84:"-199.87,74.79,246.62",ellipse:"GRS80",datumName:"Greek_Geodetic_Reference_System_1987"},n.nad83={towgs84:"0,0,0",ellipse:"GRS80",datumName:"North_American_Datum_1983"},n.nad27={nadgrids:"@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat",ellipse:"clrk66",datumName:"North_American_Datum_1927"},n.potsdam={towgs84:"606.0,23.0,413.0",ellipse:"bessel",datumName:"Potsdam Rauenberg 1950 DHDN"},n.carthage={towgs84:"-263.0,6.0,431.0",ellipse:"clark80",datumName:"Carthage 1934 Tunisia"},n.hermannskogel={towgs84:"653.0,-212.0,449.0",ellipse:"bessel",datumName:"Hermannskogel"},n.ire65={towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"mod_airy",datumName:"Ireland 1965"},n.rassadiran={towgs84:"-133.63,-157.5,-158.62",ellipse:"intl",datumName:"Rassadiran"},n.nzgd49={towgs84:"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993",ellipse:"intl",datumName:"New Zealand Geodetic Datum 1949"},n.osgb36={towgs84:"446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894",ellipse:"airy",datumName:"Airy 1830"},n.s_jtsk={towgs84:"589,76,480",ellipse:"bessel",datumName:"S-JTSK (Ferro)"},n.beduaram={towgs84:"-106,-87,188",ellipse:"clrk80",datumName:"Beduaram"},n.gunung_segara={towgs84:"-403,684,41",ellipse:"bessel",datumName:"Gunung Segara Jakarta"},n.rnb72={towgs84:"106.869,-52.2978,103.724,-0.33657,0.456955,-1.84218,1",ellipse:"intl",datumName:"Reseau National Belge 1972"}},{}],26:[function(e,t,n){n.MERIT={a:6378137,rf:298.257,ellipseName:"MERIT 1983"},n.SGS85={a:6378136,rf:298.257,ellipseName:"Soviet Geodetic System 85"},n.GRS80={a:6378137,rf:298.257222101,ellipseName:"GRS 1980(IUGG, 1980)"},n.IAU76={a:6378140,rf:298.257,ellipseName:"IAU 1976"},n.airy={a:6377563.396,b:6356256.91,ellipseName:"Airy 1830"},n.APL4={a:6378137,rf:298.25,ellipseName:"Appl. Physics. 1965"},n.NWL9D={a:6378145,rf:298.25,ellipseName:"Naval Weapons Lab., 1965"},n.mod_airy={a:6377340.189,b:6356034.446,ellipseName:"Modified Airy"},n.andrae={a:6377104.43,rf:300,ellipseName:"Andrae 1876 (Den., Iclnd.)"},n.aust_SA={a:6378160,rf:298.25,ellipseName:"Australian Natl & S. Amer. 1969"},n.GRS67={a:6378160,rf:298.247167427,ellipseName:"GRS 67(IUGG 1967)"},n.bessel={a:6377397.155,rf:299.1528128,ellipseName:"Bessel 1841"},n.bess_nam={a:6377483.865,rf:299.1528128,ellipseName:"Bessel 1841 (Namibia)"},n.clrk66={a:6378206.4,b:6356583.8,ellipseName:"Clarke 1866"},n.clrk80={a:6378249.145,rf:293.4663,ellipseName:"Clarke 1880 mod."},n.clrk58={a:6378293.645208759,rf:294.2606763692654,ellipseName:"Clarke 1858"},n.CPM={a:6375738.7,rf:334.29,ellipseName:"Comm. des Poids et Mesures 1799"},n.delmbr={a:6376428,rf:311.5,ellipseName:"Delambre 1810 (Belgium)"},n.engelis={a:6378136.05,rf:298.2566,ellipseName:"Engelis 1985"},n.evrst30={a:6377276.345,rf:300.8017,ellipseName:"Everest 1830"},n.evrst48={a:6377304.063,rf:300.8017,ellipseName:"Everest 1948"},n.evrst56={a:6377301.243,rf:300.8017,ellipseName:"Everest 1956"},n.evrst69={a:6377295.664,rf:300.8017,ellipseName:"Everest 1969"},n.evrstSS={a:6377298.556,rf:300.8017,ellipseName:"Everest (Sabah & Sarawak)"},n.fschr60={a:6378166,rf:298.3,ellipseName:"Fischer (Mercury Datum) 1960"},n.fschr60m={a:6378155,rf:298.3,ellipseName:"Fischer 1960"},n.fschr68={a:6378150,rf:298.3,ellipseName:"Fischer 1968"},n.helmert={a:6378200,rf:298.3,ellipseName:"Helmert 1906"},n.hough={a:6378270,rf:297,ellipseName:"Hough"},n.intl={a:6378388,rf:297,ellipseName:"International 1909 (Hayford)"},n.kaula={a:6378163,rf:298.24,ellipseName:"Kaula 1961"},n.lerch={a:6378139,rf:298.257,ellipseName:"Lerch 1979"},n.mprts={a:6397300,rf:191,ellipseName:"Maupertius 1738"},n.new_intl={a:6378157.5,b:6356772.2,ellipseName:"New International 1967"},n.plessis={a:6376523,rf:6355863,ellipseName:"Plessis 1817 (France)"},n.krass={a:6378245,rf:298.3,ellipseName:"Krassovsky, 1942"},n.SEasia={a:6378155,b:6356773.3205,ellipseName:"Southeast Asia"},n.walbeck={a:6376896,b:6355834.8467,ellipseName:"Walbeck"},n.WGS60={a:6378165,rf:298.3,ellipseName:"WGS 60"},n.WGS66={a:6378145,rf:298.25,ellipseName:"WGS 66"},n.WGS7={a:6378135,rf:298.26,ellipseName:"WGS 72"},n.WGS84={a:6378137,rf:298.257223563,ellipseName:"WGS 84"},n.sphere={a:6370997,b:6370997,ellipseName:"Normal Sphere (r=6370997)"}},{}],27:[function(e,t,n){n.greenwich=0,n.lisbon=-9.131906111111,n.paris=2.337229166667,n.bogota=-74.080916666667,n.madrid=-3.687938888889,n.rome=12.452333333333,n.bern=7.439583333333,n.jakarta=106.807719444444,n.ferro=-17.666666666667,n.brussels=4.367975,n.stockholm=18.058277777778,n.athens=23.7163375,n.oslo=10.722916666667},{}],28:[function(e,t,n){function o(e,t,n){var r;return Array.isArray(n)?(r=i(e,t,n),n.length===3?[r.x,r.y,r.z]:[r.x,r.y]):i(e,t,n)}function u(e){return e instanceof r?e:e.oProj?e.oProj:r(e)}function a(e,t,n){e=u(e);var r=!1,i;if(typeof t=="undefined")t=e,e=s,r=!0;else if(typeof t.x!="undefined"||Array.isArray(t))n=t,t=e,e=s,r=!0;return t=u(t),n?o(e,t,n):(i={forward:function(n){return o(e,t,n)},inverse:function(n){return o(t,e,n)}},r&&(i.oProj=t),i)}var r=e("./Proj"),i=e("./transform"),s=r("WGS84");t.exports=a},{"./Proj":2,"./transform":64}],29:[function(e,t,n){var r=Math.PI/2,i=1,s=2,o=3,u=4,a=5,f=484813681109536e-20,l=1.0026,c=.3826834323650898,h=function(e){if(!(this instanceof h))return new h(e);this.datum_type=u;if(!e)return;e.datumCode&&e.datumCode==="none"&&(this.datum_type=a);if(e.datum_params){for(var t=0;t3&&(e.datum_params[3]!==0||e.datum_params[4]!==0||e.datum_params[5]!==0||e.datum_params[6]!==0)&&(this.datum_type=s,e.datum_params[3]*=f,e.datum_params[4]*=f,e.datum_params[5]*=f,e.datum_params[6]=e.datum_params[6]/1e6+1)}this.datum_type=e.grids?o:this.datum_type,this.a=e.a,this.b=e.b,this.es=e.es,this.ep2=e.ep2,this.datum_params=e.datum_params,this.datum_type===o&&(this.grids=e.grids)};h.prototype={compare_datums:function(e){return this.datum_type!==e.datum_type?!1:this.a!==e.a||Math.abs(this.es-e.es)>5e-11?!1:this.datum_type===i?this.datum_params[0]===e.datum_params[0]&&this.datum_params[1]===e.datum_params[1]&&this.datum_params[2]===e.datum_params[2]:this.datum_type===s?this.datum_params[0]===e.datum_params[0]&&this.datum_params[1]===e.datum_params[1]&&this.datum_params[2]===e.datum_params[2]&&this.datum_params[3]===e.datum_params[3]&&this.datum_params[4]===e.datum_params[4]&&this.datum_params[5]===e.datum_params[5]&&this.datum_params[6]===e.datum_params[6]:this.datum_type===o||e.datum_type===o?this.nadgrids===e.nadgrids:!0},geodetic_to_geocentric:function(e){var t=e.x,n=e.y,i=e.z?e.z:0,s,o,u,a=0,f,l,c,h;if(n<-r&&n>-1.001*r)n=-r;else if(n>r&&n<1.001*r)n=r;else if(n<-r||n>r)return null;return t>Math.PI&&(t-=2*Math.PI),l=Math.sin(n),h=Math.cos(n),c=l*l,f=this.a/Math.sqrt(1-this.es*c),s=(f+i)*h*Math.cos(t),o=(f+i)*h*Math.sin(t),u=(f*(1-this.es)+i)*l,e.x=s,e.y=o,e.z=u,a},geocentric_to_geodetic:function(e){var t=1e-12,n=t*t,i=30,s,o,u,a,f,l,c,h,p,d,v,m,g,y,b=e.x,w=e.y,E=e.z?e.z:0,S,x,T;g=!1,s=Math.sqrt(b*b+w*w),o=Math.sqrt(b*b+w*w+E*E);if(s/this.an&&y0)s=r;else if(n<0)s=-r;else{x=!0,s=0;if(i>0)o=r;else{if(!(i<0)){o=r,u=-this.b;return}o=-r}}return f=t*t+n*n,a=Math.sqrt(f),h=i*l,d=Math.sqrt(h*h+f),m=h/d,y=a/d,g=m*m*m,p=i+this.b*this.ep2*g,S=a-this.a*this.es*y*y*y,v=Math.sqrt(p*p+S*S),b=p/v,w=S/v,E=this.a/Math.sqrt(1-this.es*b*b),w>=c?u=a/w-E:w<=-c?u=a/-w-E:u=i/b+E*(this.es-1),x===!1&&(o=Math.atan(b/w)),e.x=s,e.y=o,e.z=u,e},geocentric_to_wgs84:function(e){if(this.datum_type===i)e.x+=this.datum_params[0],e.y+=this.datum_params[1],e.z+=this.datum_params[2];else if(this.datum_type===s){var t=this.datum_params[0],n=this.datum_params[1],r=this.datum_params[2],o=this.datum_params[3],u=this.datum_params[4],a=this.datum_params[5],f=this.datum_params[6],l=f*(e.x-a*e.y+u*e.z)+t,c=f*(a*e.x+e.y-o*e.z)+n,h=f*(-u*e.x+o*e.y+e.z)+r;e.x=l,e.y=c,e.z=h}},geocentric_from_wgs84:function(e){if(this.datum_type===i)e.x-=this.datum_params[0],e.y-=this.datum_params[1],e.z-=this.datum_params[2];else if(this.datum_type===s){var t=this.datum_params[0],n=this.datum_params[1],r=this.datum_params[2],o=this.datum_params[3],u=this.datum_params[4],a=this.datum_params[5],f=this.datum_params[6],l=(e.x-t)/f,c=(e.y-n)/f,h=(e.z-r)/f;e.x=l+a*c-u*h,e.y=-a*l+c+o*h,e.z=u*l-o*c+h}}},t.exports=h},{}],30:[function(e,t,n){var r=1,i=2,s=3,o=5,u=6378137,a=.006694379990141316;t.exports=function(e,t,n){function h(e){return e===r||e===i}var f,l,c;if(e.compare_datums(t))return n;if(e.datum_type===o||t.datum_type===o)return n;var p=e.a,d=e.es,v=t.a,m=t.es,g=e.datum_type;if(g===s)if(this.apply_gridshift(e,0,n)===0)e.a=u,e.es=a;else{if(!e.datum_params)return e.a=p,e.es=e.es,n;f=1;for(l=0,c=e.datum_params.length;l3?g=i:g=r}t.datum_type===s&&(t.a=u,t.es=a);if(e.es!==t.es||e.a!==t.a||h(g)||h(t.datum_type))e.geodetic_to_geocentric(n),h(e.datum_type)&&e.geocentric_to_wgs84(n),h(t.datum_type)&&t.geocentric_from_wgs84(n),t.geocentric_to_geodetic(n);return t.datum_type===s&&this.apply_gridshift(t,1,n),e.a=p,e.es=d,t.a=v,t.es=m,n}},{}],31:[function(e,t,n){function o(e){var t=this;if(arguments.length===2){var n=arguments[1];typeof n=="string"?n.charAt(0)==="+"?o[e]=i(arguments[1]):o[e]=s(arguments[1]):o[e]=n}else if(arguments.length===1){if(Array.isArray(e))return e.map(function(e){Array.isArray(e)?o.apply(t,e):o(e)});if(typeof e=="string"){if(e in o)return o[e]}else"EPSG"in e?o["EPSG:"+e.EPSG]=e:"ESRI"in e?o["ESRI:"+e.ESRI]=e:"IAU2000"in e?o["IAU2000:"+e.IAU2000]=e:console.log(e);return}}var r=e("./global"),i=e("./projString"),s=e("./wkt");r(o),t.exports=o},{"./global":34,"./projString":37,"./wkt":65}],32:[function(e,t,n){var r=e("./constants/Datum"),i=e("./constants/Ellipsoid"),s=e("./extend"),o=e("./datum"),u=1e-10,a=.16666666666666666,f=.04722222222222222,l=.022156084656084655;t.exports=function(e){if(e.datumCode&&e.datumCode!=="none"){var t=r[e.datumCode];t&&(e.datum_params=t.towgs84?t.towgs84.split(","):null,e.ellps=t.ellipse,e.datumName=t.datumName?t.datumName:e.datumCode)}if(!e.a){var n=i[e.ellps]?i[e.ellps]:i.WGS84;s(e,n)}e.rf&&!e.b&&(e.b=(1-1/e.rf)*e.a);if(e.rf===0||Math.abs(e.a-e.b)r?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},n.forward=function(e){var t=e.x,n=e.y;this.sin_phi=Math.sin(n),this.cos_phi=Math.cos(n);var r=s(this.e3,this.sin_phi,this.cos_phi),i=this.a*Math.sqrt(this.c-this.ns0*r)/this.ns0,u=this.ns0*o(t-this.long0),a=i*Math.sin(u)+this.x0,f=this.rh-i*Math.cos(u)+this.y0;return e.x=a,e.y=f,e},n.inverse=function(e){var t,n,r,i,s,u;return e.x-=this.x0,e.y=this.rh-e.y+this.y0,this.ns0>=0?(t=Math.sqrt(e.x*e.x+e.y*e.y),r=1):(t=-Math.sqrt(e.x*e.x+e.y*e.y),r=-1),i=0,t!==0&&(i=Math.atan2(r*e.x,r*e.y)),r=t*this.ns0/this.a,this.sphere?u=Math.asin((this.c-r*r)/(2*this.ns0)):(n=(this.c-r*r)/this.ns0,u=this.phi1z(this.e3,n)),s=o(i/this.ns0+this.long0),e.x=s,e.y=u,e},n.phi1z=function(e,t){var n,i,s,o,a,f=u(.5*t);if(e2*i*this.a)return;return n=t/this.a,d=Math.sin(n),v=Math.cos(n),m=this.long0,Math.abs(t)<=s?g=this.lat0:(g=h(v*this.sin_p12+e.y*d*this.cos_p12/t),y=Math.abs(this.lat0)-i,Math.abs(y)<=s?this.lat0>=0?m=r(this.long0+Math.atan2(e.x,-e.y)):m=r(this.long0-Math.atan2(-e.x,e.y)):m=r(this.long0+Math.atan2(e.x*d,t*this.cos_p12*v-e.y*this.sin_p12*d))),e.x=m,e.y=g,e}return b=u(this.es),w=a(this.es),E=f(this.es),S=l(this.es),Math.abs(this.sin_p12-1)<=s?(x=this.a*o(b,w,E,S,i),t=Math.sqrt(e.x*e.x+e.y*e.y),T=x-t,g=p(T/this.a,b,w,E,S),m=r(this.long0+Math.atan2(e.x,-1*e.y)),e.x=m,e.y=g,e):Math.abs(this.sin_p12+1)<=s?(x=this.a*o(b,w,E,S,i),t=Math.sqrt(e.x*e.x+e.y*e.y),T=t-x,g=p(T/this.a,b,w,E,S),m=r(this.long0+Math.atan2(e.x,e.y)),e.x=m,e.y=g,e):(t=Math.sqrt(e.x*e.x+e.y*e.y),k=Math.atan2(e.x,e.y),N=c(this.a,this.e,this.sin_p12),L=Math.cos(k),A=this.e*this.cos_p12*L,O=-A*A/(1-this.es),M=3*this.es*(1-O)*this.sin_p12*this.cos_p12*L/(1-this.es),_=t/N,D=_-O*(1+O)*Math.pow(_,3)/6-M*(1+3*O)*Math.pow(_,4)/24,P=1-O*D*D/2-_*D*D*D/6,C=Math.asin(this.sin_p12*Math.cos(D)+this.cos_p12*Math.sin(D)*L),m=r(this.long0+Math.asin(Math.sin(k)*Math.sin(D)/Math.cos(C))),g=Math.atan((1-this.es*P*this.sin_p12/Math.sin(C))*Math.tan(C)/(1-this.es)),e.x=m,e.y=g,e)},n.names=["Azimuthal_Equidistant","aeqd"]},{"../common/adjust_lon":5,"../common/asinz":6,"../common/e0fn":7,"../common/e1fn":8,"../common/e2fn":9,"../common/e3fn":10,"../common/gN":11,"../common/imlfn":12,"../common/mlfn":14}],41:[function(e,t,n){var r=e("../common/mlfn"),i=e("../common/e0fn"),s=e("../common/e1fn"),o=e("../common/e2fn"),u=e("../common/e3fn"),a=e("../common/gN"),f=e("../common/adjust_lon"),l=e("../common/adjust_lat"),c=e("../common/imlfn"),h=Math.PI/2,p=1e-10;n.init=function(){this.sphere||(this.e0=i(this.es),this.e1=s(this.es),this.e2=o(this.es),this.e3=u(this.es),this.ml0=this.a*r(this.e0,this.e1,this.e2,this.e3,this.lat0))},n.forward=function(e){var t,n,i=e.x,s=e.y;i=f(i-this.long0);if(this.sphere)t=this.a*Math.asin(Math.cos(s)*Math.sin(i)),n=this.a*(Math.atan2(Math.tan(s),Math.cos(i))-this.lat0);else{var o=Math.sin(s),u=Math.cos(s),l=a(this.a,this.e,o),c=Math.tan(s)*Math.tan(s),h=i*Math.cos(s),p=h*h,d=this.es*u*u/(1-this.es),v=this.a*r(this.e0,this.e1,this.e2,this.e3,s);t=l*h*(1-p*c*(1/6-(8-c+8*d)*p/120)),n=v-this.ml0+l*o/u*p*(.5+(5-c+6*d)*p/24)}return e.x=t+this.x0,e.y=n+this.y0,e},n.inverse=function(e){e.x-=this.x0,e.y-=this.y0;var t=e.x/this.a,n=e.y/this.a,r,i;if(this.sphere){var s=n+this.lat0;r=Math.asin(Math.sin(s)*Math.cos(t)),i=Math.atan2(Math.tan(t),Math.cos(s))}else{var o=this.ml0/this.a+n,u=c(o,this.e0,this.e1,this.e2,this.e3);if(Math.abs(Math.abs(u)-h)<=p)return e.x=this.long0,e.y=h,n<0&&(e.y*=-1),e;var d=a(this.a,this.e,Math.sin(u)),v=d*d*d/this.a/this.a*(1-this.es),m=Math.pow(Math.tan(u),2),g=t*this.a/d,y=g*g;r=u-d*Math.tan(u)/v*g*g*(.5-(1+3*m)*g*g/24),i=g*(1-y*(m/3+(1+3*m)*m*y/15))/Math.cos(u)}return e.x=f(i+this.long0),e.y=l(r),e},n.names=["Cassini","Cassini_Soldner","cass"]},{"../common/adjust_lat":4,"../common/adjust_lon":5,"../common/e0fn":7,"../common/e1fn":8,"../common/e2fn":9,"../common/e3fn":10,"../common/gN":11,"../common/imlfn":12,"../common/mlfn":14}],42:[function(e,t,n){var r=e("../common/adjust_lon"),i=e("../common/qsfnz"),s=e("../common/msfnz"),o=e("../common/iqsfnz");n.init=function(){this.sphere||(this.k0=s(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)))},n.forward=function(e){var t=e.x,n=e.y,s,o,u=r(t-this.long0);if(this.sphere)s=this.x0+this.a*u*Math.cos(this.lat_ts),o=this.y0+this.a*Math.sin(n)/Math.cos(this.lat_ts);else{var a=i(this.e,Math.sin(n));s=this.x0+this.a*this.k0*u,o=this.y0+this.a*a*.5/this.k0}return e.x=s,e.y=o,e},n.inverse=function(e){e.x-=this.x0,e.y-=this.y0;var t,n;return this.sphere?(t=r(this.long0+e.x/this.a/Math.cos(this.lat_ts)),n=Math.asin(e.y/this.a*Math.cos(this.lat_ts))):(n=o(this.e,2*e.y*this.k0/this.a),t=r(this.long0+e.x/(this.a*this.k0))),e.x=t,e.y=n,e},n.names=["cea"]},{"../common/adjust_lon":5,"../common/iqsfnz":13,"../common/msfnz":15,"../common/qsfnz":20}],43:[function(e,t,n){var r=e("../common/adjust_lon"),i=e("../common/adjust_lat");n.init=function(){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)},n.forward=function(e){var t=e.x,n=e.y,s=r(t-this.long0),o=i(n-this.lat0);return e.x=this.x0+this.a*s*this.rc,e.y=this.y0+this.a*o,e},n.inverse=function(e){var t=e.x,n=e.y;return e.x=r(this.long0+(t-this.x0)/(this.a*this.rc)),e.y=i(this.lat0+(n-this.y0)/this.a),e},n.names=["Equirectangular","Equidistant_Cylindrical","eqc"]},{"../common/adjust_lat":4,"../common/adjust_lon":5}],44:[function(e,t,n){var r=e("../common/e0fn"),i=e("../common/e1fn"),s=e("../common/e2fn"),o=e("../common/e3fn"),u=e("../common/msfnz"),a=e("../common/mlfn"),f=e("../common/adjust_lon"),l=e("../common/adjust_lat"),c=e("../common/imlfn"),h=1e-10;n.init=function(){if(Math.abs(this.lat1+this.lat2)=0?(n=Math.sqrt(e.x*e.x+e.y*e.y),t=1):(n=-Math.sqrt(e.x*e.x+e.y*e.y),t=-1);var s=0;n!==0&&(s=Math.atan2(t*e.x,t*e.y));if(this.sphere)return i=f(this.long0+s/this.ns),r=l(this.g-n/this.a),e.x=i,e.y=r,e;var o=this.g-n/this.a;return r=c(o,this.e0,this.e1,this.e2,this.e3),i=f(this.long0+s/this.ns),e.x=i,e.y=r,e},n.names=["Equidistant_Conic","eqdc"]},{"../common/adjust_lat":4,"../common/adjust_lon":5,"../common/e0fn":7,"../common/e1fn":8,"../common/e2fn":9,"../common/e3fn":10,"../common/imlfn":12,"../common/mlfn":14,"../common/msfnz":15}],45:[function(e,t,n){var r=Math.PI/4,i=e("../common/srat"),s=Math.PI/2,o=20;n.init=function(){var e=Math.sin(this.lat0),t=Math.cos(this.lat0);t*=t,this.rc=Math.sqrt(1-this.es)/(1-this.es*e*e),this.C=Math.sqrt(1+this.es*t*t/(1-this.es)),this.phic0=Math.asin(e/this.C),this.ratexp=.5*this.C*this.e,this.K=Math.tan(.5*this.phic0+r)/(Math.pow(Math.tan(.5*this.lat0+r),this.C)*i(this.e*e,this.ratexp))},n.forward=function(e){var t=e.x,n=e.y;return e.y=2*Math.atan(this.K*Math.pow(Math.tan(.5*n+r),this.C)*i(this.e*Math.sin(n),this.ratexp))-s,e.x=this.C*t,e},n.inverse=function(e){var t=1e-14,n=e.x/this.C,u=e.y,a=Math.pow(Math.tan(.5*u+r)/this.K,1/this.C);for(var f=o;f>0;--f){u=2*Math.atan(a*i(this.e*Math.sin(e.y),-0.5*this.e))-s;if(Math.abs(u-e.y)0||Math.abs(a)<=i?(f=this.x0+this.a*u*n*Math.sin(s)/a,l=this.y0+this.a*u*(this.cos_p14*t-this.sin_p14*n*o)/a):(f=this.x0+this.infinity_dist*n*Math.sin(s),l=this.y0+this.infinity_dist*(this.cos_p14*t-this.sin_p14*n*o)),e.x=f,e.y=l,e},n.inverse=function(e){var t,n,i,o,u,a;return e.x=(e.x-this.x0)/this.a,e.y=(e.y-this.y0)/this.a,e.x/=this.k0,e.y/=this.k0,(t=Math.sqrt(e.x*e.x+e.y*e.y))?(o=Math.atan2(t,this.rc),n=Math.sin(o),i=Math.cos(o),a=s(i*this.sin_p14+e.y*n*this.cos_p14/t),u=Math.atan2(e.x*n,t*this.cos_p14*i-e.y*this.sin_p14*n),u=r(this.long0+u)):(a=this.phic0,u=0),e.x=u,e.y=a,e},n.names=["gnom"]},{"../common/adjust_lon":5,"../common/asinz":6}],47:[function(e,t,n){var r=e("../common/adjust_lon");n.init=function(){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},n.forward=function(e){var t,n,i,s,o,u,a,f=e.x,l=e.y,c=r(f-this.long0);return t=Math.pow((1+this.e*Math.sin(l))/(1-this.e*Math.sin(l)),this.alfa*this.e/2),n=2*(Math.atan(this.k*Math.pow(Math.tan(l/2+this.s45),this.alfa)/t)-this.s45),i=-c*this.alfa,s=Math.asin(Math.cos(this.ad)*Math.sin(n)+Math.sin(this.ad)*Math.cos(n)*Math.cos(i)),o=Math.asin(Math.cos(n)*Math.sin(i)/Math.cos(s)),u=this.n*o,a=this.ro0*Math.pow(Math.tan(this.s0/2+this.s45),this.n)/Math.pow(Math.tan(s/2+this.s45),this.n),e.y=a*Math.cos(u)/1,e.x=a*Math.sin(u)/1,this.czech||(e.y*=-1,e.x*=-1),e},n.inverse=function(e){var t,n,r,i,s,o,u,a,f=e.x;e.x=e.y,e.y=f,this.czech||(e.y*=-1,e.x*=-1),o=Math.sqrt(e.x*e.x+e.y*e.y),s=Math.atan2(e.y,e.x),i=s/Math.sin(this.s0),r=2*(Math.atan(Math.pow(this.ro0/o,1/this.n)*Math.tan(this.s0/2+this.s45))-this.s45),t=Math.asin(Math.cos(this.ad)*Math.sin(r)-Math.sin(this.ad)*Math.cos(r)*Math.cos(i)),n=Math.asin(Math.cos(r)*Math.sin(i)/Math.cos(t)),e.x=this.long0-n/this.alfa,u=t,a=0;var l=0;do e.y=2*(Math.atan(Math.pow(this.k,-1/this.alfa)*Math.pow(Math.tan(t/2+this.s45),1/this.alfa)*Math.pow((1+this.e*Math.sin(u))/(1-this.e*Math.sin(u)),this.e/2))-this.s45),Math.abs(u-e.y)<1e-10&&(a=1),u=e.y,l+=1;while(a===0&&l<15);return l>=15?null:e},n.names=["Krovak","krovak"]},{"../common/adjust_lon":5}],48:[function(e,t,n){var r=Math.PI/2,i=Math.PI/4,s=1e-10,o=e("../common/qsfnz"),u=e("../common/adjust_lon");n.S_POLE=1,n.N_POLE=2,n.EQUIT=3,n.OBLIQ=4,n.init=function(){var e=Math.abs(this.lat0);Math.abs(e-r)0){var t;this.qp=o(this.e,1),this.mmf=.5/(1-this.es),this.apa=this.authset(this.es);switch(this.mode){case this.N_POLE:this.dd=1;break;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),t=Math.sin(this.lat0),this.sinb1=o(this.e,t)/this.qp,this.cosb1=Math.sqrt(1-this.sinb1*this.sinb1),this.dd=Math.cos(this.lat0)/(Math.sqrt(1-this.es*t*t)*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))},n.forward=function(e){var t,n,a,f,l,c,h,p,d,v,m=e.x,g=e.y;m=u(m-this.long0);if(this.sphere){l=Math.sin(g),v=Math.cos(g),a=Math.cos(m);if(this.mode===this.OBLIQ||this.mode===this.EQUIT){n=this.mode===this.EQUIT?1+v*a:1+this.sinph0*l+this.cosph0*v*a;if(n<=s)return null;n=Math.sqrt(2/n),t=n*v*Math.sin(m),n*=this.mode===this.EQUIT?l:this.cosph0*l-this.sinph0*v*a}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){this.mode===this.N_POLE&&(a=-a);if(Math.abs(g+this.phi0)=0?(t=(d=Math.sqrt(c))*f,n=a*(this.mode===this.S_POLE?d:-d)):t=n=0}}return e.x=this.a*t+this.x0,e.y=this.a*n+this.y0,e},n.inverse=function(e){e.x-=this.x0,e.y-=this.y0;var t=e.x/this.a,n=e.y/this.a,i,o,a,f,l,c,h;if(this.sphere){var p=0,d,v=0;d=Math.sqrt(t*t+n*n),o=d*.5;if(o>1)return null;o=2*Math.asin(o);if(this.mode===this.OBLIQ||this.mode===this.EQUIT)v=Math.sin(o),p=Math.cos(o);switch(this.mode){case this.EQUIT:o=Math.abs(d)<=s?0:Math.asin(n*v/d),t*=v,n=p*d;break;case this.OBLIQ:o=Math.abs(d)<=s?this.phi0:Math.asin(p*this.sinph0+n*v*this.cosph0/d),t*=v*this.cosph0,n=(p-Math.sin(o)*this.sinph0)*d;break;case this.N_POLE:n=-n,o=r-o;break;case this.S_POLE:o-=r}i=n!==0||this.mode!==this.EQUIT&&this.mode!==this.OBLIQ?Math.atan2(t,n):0}else{h=0;if(this.mode===this.OBLIQ||this.mode===this.EQUIT){t/=this.dd,n*=this.dd,c=Math.sqrt(t*t+n*n);if(cr?this.ns=Math.log(o/l)/Math.log(u/c):this.ns=t,isNaN(this.ns)&&(this.ns=t),this.f0=o/(this.ns*Math.pow(u,this.ns)),this.rh=this.a*this.f0*Math.pow(h,this.ns),this.title||(this.title="Lambert Conformal Conic")},n.forward=function(e){var t=e.x,n=e.y;Math.abs(2*Math.abs(n)-Math.PI)<=r&&(n=u(n)*(o-2*r));var i=Math.abs(Math.abs(n)-o),f,l;if(i>r)f=s(this.e,n,Math.sin(n)),l=this.a*this.f0*Math.pow(f,this.ns);else{i=n*this.ns;if(i<=0)return null;l=0}var c=this.ns*a(t-this.long0);return e.x=this.k0*l*Math.sin(c)+this.x0,e.y=this.k0*(this.rh-l*Math.cos(c))+this.y0,e},n.inverse=function(e){var t,n,r,i,s,u=(e.x-this.x0)/this.k0,l=this.rh-(e.y-this.y0)/this.k0;this.ns>0?(t=Math.sqrt(u*u+l*l),n=1):(t=-Math.sqrt(u*u+l*l),n=-1);var c=0;t!==0&&(c=Math.atan2(n*u,n*l));if(t!==0||this.ns>0){n=1/this.ns,r=Math.pow(t/(this.a*this.f0),n),i=f(this.e,r);if(i===-9999)return null}else i=-o;return s=a(c/this.ns+this.long0),e.x=s,e.y=i,e},n.names=["Lambert Tangential Conformal Conic Projection","Lambert_Conformal_Conic","Lambert_Conformal_Conic_2SP","lcc"]},{"../common/adjust_lon":5,"../common/msfnz":15,"../common/phi2z":16,"../common/sign":21,"../common/tsfnz":24}],50:[function(e,t,n){function r(e){return e}n.init=function(){},n.forward=r,n.inverse=r,n.names=["longlat","identity"]},{}],51:[function(e,t,n){var r=e("../common/msfnz"),i=Math.PI/2,s=1e-10,o=57.29577951308232,u=e("../common/adjust_lon"),a=Math.PI/4,f=e("../common/tsfnz"),l=e("../common/phi2z");n.init=function(){var e=this.b/this.a;this.es=1-e*e,"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=r(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)):this.k0||(this.k?this.k0=this.k:this.k0=1)},n.forward=function(e){var t=e.x,n=e.y;if(n*o>90&&n*o<-90&&t*o>180&&t*o<-180)return null;var r,l;if(Math.abs(Math.abs(n)-i)<=s)return null;if(this.sphere)r=this.x0+this.a*this.k0*u(t-this.long0),l=this.y0+this.a*this.k0*Math.log(Math.tan(a+.5*n));else{var c=Math.sin(n),h=f(this.e,n,c);r=this.x0+this.a*this.k0*u(t-this.long0),l=this.y0-this.a*this.k0*Math.log(h)}return e.x=r,e.y=l,e},n.inverse=function(e){var t=e.x-this.x0,n=e.y-this.y0,r,s;if(this.sphere)s=i-2*Math.atan(Math.exp(-n/(this.a*this.k0)));else{var o=Math.exp(-n/(this.a*this.k0));s=l(this.e,o);if(s===-9999)return null}return r=u(this.long0+t/(this.a*this.k0)),e.x=r,e.y=s,e},n.names=["Mercator","Popular Visualisation Pseudo Mercator","Mercator_1SP","Mercator_Auxiliary_Sphere","merc"]},{"../common/adjust_lon":5,"../common/msfnz":15,"../common/phi2z":16,"../common/tsfnz":24}],52:[function(e,t,n){var r=e("../common/adjust_lon");n.init=function(){},n.forward=function(e){var t=e.x,n=e.y,i=r(t-this.long0),s=this.x0+this.a*i,o=this.y0+this.a*Math.log(Math.tan(Math.PI/4+n/2.5))*1.25;return e.x=s,e.y=o,e},n.inverse=function(e){e.x-=this.x0,e.y-=this.y0;var t=r(this.long0+e.x/this.a),n=2.5*(Math.atan(Math.exp(.8*e.y/this.a))-Math.PI/4);return e.x=t,e.y=n,e},n.names=["Miller_Cylindrical","mill"]},{"../common/adjust_lon":5}],53:[function(e,t,n){var r=e("../common/adjust_lon"),i=1e-10;n.init=function(){},n.forward=function(e){var t=e.x,n=e.y,s=r(t-this.long0),o=n,u=Math.PI*Math.sin(n);for(var a=0;!0;a++){var f=-(o+Math.sin(o)-u)/(1+Math.cos(o));o+=f;if(Math.abs(f).999999999999&&(n=.999999999999),t=Math.asin(n);var i=r(this.long0+e.x/(.900316316158*this.a*Math.cos(t)));i<-Math.PI&&(i=-Math.PI),i>Math.PI&&(i=Math.PI),n=(2*t+Math.sin(2*t))/Math.PI,Math.abs(n)>1&&(n=1);var s=Math.asin(n);return e.x=i,e.y=s,e},n.names=["Mollweide","moll"]},{"../common/adjust_lon":5}],54:[function(e,t,n){var r=484813681109536e-20;n.iterations=1,n.init=function(){this.A=[],this.A[1]=.6399175073,this.A[2]=-0.1358797613,this.A[3]=.063294409,this.A[4]=-0.02526853,this.A[5]=.0117879,this.A[6]=-0.0055161,this.A[7]=.0026906,this.A[8]=-0.001333,this.A[9]=67e-5,this.A[10]=-0.00034,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]=-0.001541739,this.B_im[3]=.04105856,this.B_re[4]=-0.10162907,this.B_im[4]=.01727609,this.B_re[5]=-0.26623489,this.B_im[5]=-0.36249218,this.B_re[6]=-0.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]=-0.577245789,this.C_im[2]=-0.007809598,this.C_re[3]=.508307513,this.C_im[3]=-0.112208952,this.C_re[4]=-0.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]=-0.03333098,this.D[4]=-0.1052906,this.D[5]=-0.0368594,this.D[6]=.007317,this.D[7]=.0122,this.D[8]=.00394,this.D[9]=-0.0013},n.forward=function(e){var t,n=e.x,i=e.y,s=i-this.lat0,o=n-this.long0,u=s/r*1e-5,a=o,f=1,l=0;for(t=1;t<=10;t++)f*=u,l+=this.A[t]*f;var c=l,h=a,p=1,d=0,v,m,g=0,y=0;for(t=1;t<=6;t++)v=p*c-d*h,m=d*c+p*h,p=v,d=m,g=g+this.B_re[t]*p-this.B_im[t]*d,y=y+this.B_im[t]*p+this.B_re[t]*d;return e.x=y*this.a+this.x0,e.y=g*this.a+this.y0,e},n.inverse=function(e){var t,n=e.x,i=e.y,s=n-this.x0,o=i-this.y0,u=o/this.a,a=s/this.a,f=1,l=0,c,h,p=0,d=0;for(t=1;t<=6;t++)c=f*u-l*a,h=l*u+f*a,f=c,l=h,p=p+this.C_re[t]*f-this.C_im[t]*l,d=d+this.C_im[t]*f+this.C_re[t]*l;for(var v=0;v=0?u=o+Math.sqrt(o*o-1):u=o-Math.sqrt(o*o-1),this.el=u*Math.pow(s,this.bl),a=.5*(u-1/u),this.gamma0=Math.asin(Math.sin(this.alpha)/o),this.long0=this.longc-Math.asin(a*Math.tan(this.gamma0))/this.bl;else{var f=r(this.e,this.lat1,Math.sin(this.lat1)),l=r(this.e,this.lat2,Math.sin(this.lat2));this.lat0>=0?this.el=(o+Math.sqrt(o*o-1))*Math.pow(s,this.bl):this.el=(o-Math.sqrt(o*o-1))*Math.pow(s,this.bl);var c=Math.pow(f,this.bl),h=Math.pow(l,this.bl);u=this.el/c,a=.5*(u-1/u);var p=(this.el*this.el-h*c)/(this.el*this.el+h*c),d=(h-c)/(h+c),v=i(this.long1-this.long2);this.long0=.5*(this.long1+this.long2)-Math.atan(p*Math.tan(.5*this.bl*v)/d)/this.bl,this.long0=i(this.long0);var m=i(this.long1-this.long0);this.gamma0=Math.atan(Math.sin(this.bl*m)/a),this.alpha=Math.asin(o*Math.sin(this.gamma0))}this.no_off?this.uc=0:this.lat0>=0?this.uc=this.al/this.bl*Math.atan2(Math.sqrt(o*o-1),Math.cos(this.alpha)):this.uc=-1*this.al/this.bl*Math.atan2(Math.sqrt(o*o-1),Math.cos(this.alpha))},n.forward=function(e){var t=e.x,n=e.y,s=i(t-this.long0),f,l,c;if(Math.abs(Math.abs(n)-o)<=a)n>0?c=-1:c=1,l=this.al/this.bl*Math.log(Math.tan(u+c*this.gamma0*.5)),f=-1*c*o*this.al/this.bl;else{var h=r(this.e,n,Math.sin(n)),p=this.el/Math.pow(h,this.bl),d=.5*(p-1/p),v=.5*(p+1/p),m=Math.sin(this.bl*s),g=(d*Math.sin(this.gamma0)-m*Math.cos(this.gamma0))/v;Math.abs(Math.abs(g)-1)<=a?l=Number.POSITIVE_INFINITY:l=.5*this.al*Math.log((1-g)/(1+g))/this.bl,Math.abs(Math.cos(this.bl*s))<=a?f=this.al*this.bl*s:f=this.al*Math.atan2(d*Math.cos(this.gamma0)+m*Math.sin(this.gamma0),Math.cos(this.bl*s))/this.bl}return this.no_rot?(e.x=this.x0+f,e.y=this.y0+l):(f-=this.uc,e.x=this.x0+l*Math.cos(this.alpha)+f*Math.sin(this.alpha),e.y=this.y0+f*Math.cos(this.alpha)-l*Math.sin(this.alpha)),e},n.inverse=function(e){var t,n;this.no_rot?(n=e.y-this.y0,t=e.x-this.x0):(n=(e.x-this.x0)*Math.cos(this.alpha)-(e.y-this.y0)*Math.sin(this.alpha),t=(e.y-this.y0)*Math.cos(this.alpha)+(e.x-this.x0)*Math.sin(this.alpha),t+=this.uc);var r=Math.exp(-1*this.bl*n/this.al),u=.5*(r-1/r),f=.5*(r+1/r),l=Math.sin(this.bl*t/this.al),c=(l*Math.cos(this.gamma0)+u*Math.sin(this.gamma0))/f,h=Math.pow(this.el/Math.sqrt((1+c)/(1-c)),1/this.bl);return Math.abs(c-1)1e-7){if(++c>20)return;a=1/this.alpha*(Math.log(Math.tan(Math.PI/4+s/2))-this.K)+this.e*Math.log(Math.tan(Math.PI/4+Math.asin(this.e*Math.sin(f))/2)),l=f,f=2*Math.atan(Math.exp(a))-Math.PI/2}return e.x=u,e.y=f,e},n.names=["somerc"]},{}],59:[function(e,t,n){var r=Math.PI/2,i=1e-10,s=e("../common/sign"),o=e("../common/msfnz"),u=e("../common/tsfnz"),a=e("../common/phi2z"),f=e("../common/adjust_lon");n.ssfn_=function(e,t,n){return t*=n,Math.tan(.5*(r+e))*Math.pow((1-t)/(1+t),.5*n)},n.init=function(){this.coslat0=Math.cos(this.lat0),this.sinlat0=Math.sin(this.lat0),this.sphere?this.k0===1&&!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=i&&(this.k0=.5*(1+s(this.lat0)*Math.sin(this.lat_ts))):(Math.abs(this.coslat0)<=i&&(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)),this.k0===1&&!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=i&&(this.k0=.5*this.cons*o(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts))/u(this.e,this.con*this.lat_ts,this.con*Math.sin(this.lat_ts))),this.ms1=o(this.e,this.sinlat0,this.coslat0),this.X0=2*Math.atan(this.ssfn_(this.lat0,this.sinlat0,this.e))-r,this.cosX0=Math.cos(this.X0),this.sinX0=Math.sin(this.X0))},n.forward=function(e){var t=e.x,n=e.y,s=Math.sin(n),o=Math.cos(n),a,l,c,h,p,d,v=f(t-this.long0);return Math.abs(Math.abs(t-this.long0)-Math.PI)<=i&&Math.abs(n+this.lat0)<=i?(e.x=NaN,e.y=NaN,e):this.sphere?(a=2*this.k0/(1+this.sinlat0*s+this.coslat0*o*Math.cos(v)),e.x=this.a*a*o*Math.sin(v)+this.x0,e.y=this.a*a*(this.coslat0*s-this.sinlat0*o*Math.cos(v))+this.y0,e):(l=2*Math.atan(this.ssfn_(n,s,this.e))-r,h=Math.cos(l),c=Math.sin(l),Math.abs(this.coslat0)<=i?(p=u(this.e,n*this.con,this.con*s),d=2*this.a*this.k0*p/this.cons,e.x=this.x0+d*Math.sin(t-this.long0),e.y=this.y0-this.con*d*Math.cos(t-this.long0),e):(Math.abs(this.sinlat0)0?t=f(this.long0+Math.atan2(e.x,-1*e.y)):t=f(this.long0+Math.atan2(e.x,e.y)):t=f(this.long0+Math.atan2(e.x*Math.sin(c),l*this.coslat0*Math.cos(c)-e.y*this.sinlat0*Math.sin(c))),e.x=t,e.y=n,e)}if(Math.abs(this.coslat0)<=i){if(l<=i)return n=this.lat0,t=this.long0,e.x=t,e.y=n,e;e.x*=this.con,e.y*=this.con,s=l*this.cons/(2*this.a*this.k0),n=this.con*a(this.e,s),t=this.con*f(this.con*this.long0+Math.atan2(e.x,-1*e.y))}else o=2*Math.atan(l*this.cosX0/(2*this.a*this.k0*this.ms1)),t=this.long0,l<=i?u=this.X0:(u=Math.asin(Math.cos(o)*this.sinX0+e.y*Math.sin(o)*this.cosX0/l),t=f(this.long0+Math.atan2(e.x*Math.sin(o),l*this.cosX0*Math.cos(o)-e.y*this.sinX0*Math.sin(o)))),n=-1*a(this.e,Math.tan(.5*(r+u)));return e.x=t,e.y=n,e},n.names=["stere"]},{"../common/adjust_lon":5,"../common/msfnz":15,"../common/phi2z":16,"../common/sign":21,"../common/tsfnz":24}],60:[function(e,t,n){var r=e("./gauss"),i=e("../common/adjust_lon");n.init=function(){r.init.apply(this);if(!this.rc)return;this.sinc0=Math.sin(this.phic0),this.cosc0=Math.cos(this.phic0),this.R2=2*this.rc,this.title||(this.title="Oblique Stereographic Alternative")},n.forward=function(e){var t,n,s,o;return e.x=i(e.x-this.long0),r.forward.apply(this,[e]),t=Math.sin(e.y),n=Math.cos(e.y),s=Math.cos(e.x),o=this.k0*this.R2/(1+this.sinc0*t+this.cosc0*n*s),e.x=o*n*Math.sin(e.x),e.y=o*(this.cosc0*t-this.sinc0*n*s),e.x=this.a*e.x+this.x0,e.y=this.a*e.y+this.y0,e},n.inverse=function(e){var t,n,s,o,u;e.x=(e.x-this.x0)/this.a,e.y=(e.y-this.y0)/this.a,e.x/=this.k0,e.y/=this.k0;if(u=Math.sqrt(e.x*e.x+e.y*e.y)){var a=2*Math.atan2(u,this.R2);t=Math.sin(a),n=Math.cos(a),o=Math.asin(n*this.sinc0+e.y*t*this.cosc0/u),s=Math.atan2(e.x*t,u*this.cosc0*n-e.y*this.sinc0*t)}else o=this.phic0,s=0;return e.x=s,e.y=o,r.inverse.apply(this,[e]),e.x=i(e.x+this.long0),e},n.names=["Stereographic_North_Pole","Oblique_Stereographic","Polar_Stereographic","sterea","Oblique Stereographic Alternative"]},{"../common/adjust_lon":5,"./gauss":45}],61:[function(e,t,n){var r=e("../common/e0fn"),i=e("../common/e1fn"),s=e("../common/e2fn"),o=e("../common/e3fn"),u=e("../common/mlfn"),a=e("../common/adjust_lon"),f=Math.PI/2,l=1e-10,c=e("../common/sign"),h=e("../common/asinz");n.init=function(){this.e0=r(this.es),this.e1=i(this.es),this.e2=s(this.es),this.e3=o(this.es),this.ml0=this.a*u(this.e0,this.e1,this.e2,this.e3,this.lat0)},n.forward=function(e){var t=e.x,n=e.y,r=a(t-this.long0),i,s,o,f=Math.sin(n),l=Math.cos(n);if(this.sphere){var c=l*Math.sin(r);if(Math.abs(Math.abs(c)-1)<1e-10)return 93;s=.5*this.a*this.k0*Math.log((1+c)/(1-c)),i=Math.acos(l*Math.cos(r)/Math.sqrt(1-c*c)),n<0&&(i=-i),o=this.a*this.k0*(i-this.lat0)}else{var h=l*r,p=Math.pow(h,2),d=this.ep2*Math.pow(l,2),v=Math.tan(n),m=Math.pow(v,2);i=1-this.es*Math.pow(f,2);var g=this.a/Math.sqrt(i),y=this.a*u(this.e0,this.e1,this.e2,this.e3,n);s=this.k0*g*h*(1+p/6*(1-m+d+p/20*(5-18*m+Math.pow(m,2)+72*d-58*this.ep2)))+this.x0,o=this.k0*(y-this.ml0+g*v*p*(.5+p/24*(5-m+9*d+4*Math.pow(d,2)+p/30*(61-58*m+Math.pow(m,2)+600*d-330*this.ep2))))+this.y0}return e.x=s,e.y=o,e},n.inverse=function(e){var t,n,r,i,s=6,o,u;if(this.sphere){var p=Math.exp(e.x/(this.a*this.k0)),d=.5*(p-1/p),v=this.lat0+e.y/(this.a*this.k0),m=Math.cos(v);t=Math.sqrt((1-m*m)/(1+d*d)),o=h(t),v<0&&(o=-o),d===0&&m===0?u=this.long0:u=a(Math.atan2(d,m)+this.long0)}else{var g=e.x-this.x0,y=e.y-this.y0;t=(this.ml0+y/this.k0)/this.a,n=t;for(i=0;!0;i++){r=(t+this.e1*Math.sin(2*n)-this.e2*Math.sin(4*n)+this.e3*Math.sin(6*n))/this.e0-n,n+=r;if(Math.abs(r)<=l)break;if(i>=s)return 95}if(Math.abs(n)=0?f=this.y0+Math.PI*this.R*Math.tan(.5*l):f=this.y0+Math.PI*this.R*-Math.tan(.5*l);var c=.5*Math.abs(Math.PI/u-u/Math.PI),h=c*c,p=Math.sin(l),d=Math.cos(l),v=d/(p+d-1),m=v*v,g=v*(2/p-1),y=g*g,b=Math.PI*this.R*(c*(v-y)+Math.sqrt(h*(v-y)*(v-y)-(y+h)*(m-y)))/(y+h);u<0&&(b=-b),a=this.x0+b;var w=h+v;return b=Math.PI*this.R*(g*w-c*Math.sqrt((y+h)*(h+1)-w*w))/(y+h),n>=0?f=this.y0+b:f=this.y0-b,e.x=a,e.y=f,e},n.inverse=function(e){var t,n,i,o,u,a,f,l,c,h,p,d,v;return e.x-=this.x0,e.y-=this.y0,p=Math.PI*this.R,i=e.x/p,o=e.y/p,u=i*i+o*o,a=-Math.abs(o)*(1+u),f=a-2*o*o+i*i,l=-2*a+1+2*o*o+u*u,v=o*o/l+(2*f*f*f/l/l/l-9*a*f/l/l)/27,c=(a-f*f/3/l)/l,h=2*Math.sqrt(-c/3),p=3*v/c/h,Math.abs(p)>1&&(p>=0?p=1:p=-1),d=Math.acos(p)/3,e.y>=0?n=(-h*Math.cos(d+Math.PI/3)-f/3/l)*Math.PI:n=-(-h*Math.cos(d+Math.PI/3)-f/3/l)*Math.PI,Math.abs(i)-1?(t[n]={name:e[0].toLowerCase(),convert:e[1]},e.length===3&&(t[n].auth=e[2])):n==="SPHEROID"?(t[n]={name:e[0],a:e[1],rf:e[2]},e.length===4&&(t[n].auth=e[3])):["GEOGCS","GEOCCS","DATUM","VERT_CS","COMPD_CS","LOCAL_CS","FITTED_CS","LOCAL_DATUM"].indexOf(n)>-1?(e[0]=["name",e[0]],s(t,n,e)):e.every(function(e){return Array.isArray(e)})?s(t,n,e):o(e,t[n])):t[n]=!0}function u(e,t){var n=t[0],r=t[1];!(n in e)&&r in e&&(e[n]=e[r],t.length===3&&(e[n]=t[2](e[n])))}function a(e){return e*r}function f(e){function t(t){var n=e.to_meter||1;return parseFloat(t,10)*n}e.type==="GEOGCS"?e.projName="longlat":e.type==="LOCAL_CS"?(e.projName="identity",e.local=!0):typeof e.PROJECTION=="object"?e.projName=Object.keys(e.PROJECTION)[0]:e.projName=e.PROJECTION,e.UNIT&&(e.units=e.UNIT.name.toLowerCase(),e.units==="metre"&&(e.units="meter"),e.UNIT.convert&&(e.to_meter=parseFloat(e.UNIT.convert,10)));if(e.GEOGCS){e.GEOGCS.DATUM?e.datumCode=e.GEOGCS.DATUM.name.toLowerCase():e.datumCode=e.GEOGCS.name.toLowerCase(),e.datumCode.slice(0,2)==="d_"&&(e.datumCode=e.datumCode.slice(2));if(e.datumCode==="new_zealand_geodetic_datum_1949"||e.datumCode==="new_zealand_1949")e.datumCode="nzgd49";e.datumCode==="wgs_1984"&&(e.PROJECTION==="Mercator_Auxiliary_Sphere"&&(e.sphere=!0),e.datumCode="wgs84"),e.datumCode.slice(-6)==="_ferro"&&(e.datumCode=e.datumCode.slice(0,-6)),e.datumCode.slice(-8)==="_jakarta"&&(e.datumCode=e.datumCode.slice(0,-8)),~e.datumCode.indexOf("belge")&&(e.datumCode="rnb72"),e.GEOGCS.DATUM&&e.GEOGCS.DATUM.SPHEROID&&(e.ellps=e.GEOGCS.DATUM.SPHEROID.name.replace("_19","").replace(/[Cc]larke\_18/,"clrk"),e.ellps.toLowerCase().slice(0,13)==="international"&&(e.ellps="intl"),e.a=e.GEOGCS.DATUM.SPHEROID.a,e.rf=parseFloat(e.GEOGCS.DATUM.SPHEROID.rf,10)),~e.datumCode.indexOf("osgb_1936")&&(e.datumCode="osgb36")}e.b&&!isFinite(e.b)&&(e.b=e.a);var n=function(t){return u(e,t)},r=[["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",a],["longitude_of_center","Longitude_Of_Center"],["longc","longitude_of_center",a],["x0","false_easting",t],["y0","false_northing",t],["long0","central_meridian",a],["lat0","latitude_of_origin",a],["lat0","standard_parallel_1",a],["lat1","standard_parallel_1",a],["lat2","standard_parallel_2",a],["alpha","azimuth",a],["srsCode","name"]];r.forEach(n),!e.long0&&e.longc&&(e.PROJECTION==="Albers_Conic_Equal_Area"||e.PROJECTION==="Lambert_Azimuthal_Equal_Area")&&(e.long0=e.longc)}var r=.017453292519943295,i=e("./extend");t.exports=function(e,t){var n=JSON.parse((","+e).replace(/\s*\,\s*([A-Z_0-9]+?)(\[)/g,',["$1",').slice(1).replace(/\s*\,\s*([A-Z_0-9]+?)\]/g,',"$1"]').replace(/,\["VERTCS".+/,"")),r=n.shift(),s=n.shift();n.unshift(["name",s]),n.unshift(["type",r]),n.unshift("output");var u={};return o(n,u),f(u.output),i(t,u.output)}},{"./extend":33}],66:[function(e,t,n){function c(e){return e*(Math.PI/180)}function h(e){return 180*(e/Math.PI)}function p(e){var t=e.lat,n=e.lon,r=6378137,i=.00669438,s=.9996,o,u,a,f,l,h,p,d=c(t),m=c(n),g,y;y=Math.floor((n+180)/6)+1,n===180&&(y=60),t>=56&&t<64&&n>=3&&n<12&&(y=32),t>=72&&t<84&&(n>=0&&n<9?y=31:n>=9&&n<21?y=33:n>=21&&n<33?y=35:n>=33&&n<42&&(y=37)),o=(y-1)*6-180+3,g=c(o),u=i/(1-i),a=r/Math.sqrt(1-i*Math.sin(d)*Math.sin(d)),f=Math.tan(d)*Math.tan(d),l=u*Math.cos(d)*Math.cos(d),h=Math.cos(d)*(m-g),p=r*((1-i/4-3*i*i/64-5*i*i*i/256)*d-(3*i/8+3*i*i/32+45*i*i*i/1024)*Math.sin(2*d)+(15*i*i/256+45*i*i*i/1024)*Math.sin(4*d)-35*i*i*i/3072*Math.sin(6*d));var b=s*a*(h+(1-f+l)*h*h*h/6+(5-18*f+f*f+72*l-58*u)*h*h*h*h*h/120)+5e5,w=s*(p+a*Math.tan(d)*(h*h/2+(5-f+9*l+4*l*l)*h*h*h*h/24+(61-58*f+f*f+600*l-330*u)*h*h*h*h*h*h/720));return t<0&&(w+=1e7),{northing:Math.round(w),easting:Math.round(b),zoneNumber:y,zoneLetter:v(t)}}function d(e){var t=e.northing,n=e.easting,r=e.zoneLetter,i=e.zoneNumber;if(i<0||i>60)return null;var s=.9996,o=6378137,u=.00669438,a,f=(1-Math.sqrt(1-u))/(1+Math.sqrt(1-u)),l,c,p,v,m,g,y,b,w,E=n-5e5,S=t;r<"N"&&(S-=1e7),y=(i-1)*6-180+3,a=u/(1-u),g=S/s,b=g/(o*(1-u/4-3*u*u/64-5*u*u*u/256)),w=b+(3*f/2-27*f*f*f/32)*Math.sin(2*b)+(21*f*f/16-55*f*f*f*f/32)*Math.sin(4*b)+151*f*f*f/96*Math.sin(6*b),l=o/Math.sqrt(1-u*Math.sin(w)*Math.sin(w)),c=Math.tan(w)*Math.tan(w),p=a*Math.cos(w)*Math.cos(w),v=o*(1-u)/Math.pow(1-u*Math.sin(w)*Math.sin(w),1.5),m=E/(l*s);var x=w-l*Math.tan(w)/v*(m*m/2-(5+3*c+10*p-4*p*p-9*a)*m*m*m*m/24+(61+90*c+298*p+45*c*c-252*a-3*p*p)*m*m*m*m*m*m/720);x=h(x);var T=(m-(1+2*c+p)*m*m*m/6+(5-2*p+28*c-3*p*p+8*a+24*c*c)*m*m*m*m*m/120)/Math.cos(w);T=y+h(T);var N;if(e.accuracy){var C=d({northing:e.northing+e.accuracy,easting:e.easting+e.accuracy,zoneLetter:e.zoneLetter,zoneNumber:e.zoneNumber});N={top:C.lat,right:C.lon,bottom:x,left:T}}else N={lat:x,lon:T};return N}function v(e){var t="Z";return 84>=e&&e>=72?t="X":72>e&&e>=64?t="W":64>e&&e>=56?t="V":56>e&&e>=48?t="U":48>e&&e>=40?t="T":40>e&&e>=32?t="S":32>e&&e>=24?t="R":24>e&&e>=16?t="Q":16>e&&e>=8?t="P":8>e&&e>=0?t="N":0>e&&e>=-8?t="M":-8>e&&e>=-16?t="L":-16>e&&e>=-24?t="K":-24>e&&e>=-32?t="J":-32>e&&e>=-40?t="H":-40>e&&e>=-48?t="G":-48>e&&e>=-56?t="F":-56>e&&e>=-64?t="E":-64>e&&e>=-72?t="D":-72>e&&e>=-80&&(t="C"),t}function m(e,t){var n=""+e.easting,r=""+e.northing;return e.zoneNumber+e.zoneLetter+g(e.easting,e.northing,e.zoneNumber)+n.substr(n.length-5,t)+r.substr(r.length-5,t)}function g(e,t,n){var r=y(n),i=Math.floor(e/1e5),s=Math.floor(t/1e5)%20;return b(i,s,r)}function y(e){var t=e%r;return t===0&&(t=r),t}function b(e,t,n){var r=n-1,c=i.charCodeAt(r),h=s.charCodeAt(r),p=c+e-1,d=h+t,v=!1;p>l&&(p=p-l+o-1,v=!0),(p===u||cu||(p>u||ca||(p>a||cl&&(p=p-l+o-1),d>f?(d=d-f+o-1,v=!0):v=!1,(d===u||hu||(d>u||ha||(d>a||hf&&(d=d-f+o-1);var m=String.fromCharCode(p)+String.fromCharCode(d);return m}function w(e){if(e&&e.length===0)throw"MGRSPoint coverting from nothing";var t=e.length,n=null,r="",i,s=0;while(!/[A-Z]/.test(i=e.charAt(s))){if(s>=2)throw"MGRSPoint bad conversion from: "+e;r+=i,s++}var o=parseInt(r,10);if(s===0||s+3>t)throw"MGRSPoint bad conversion from: "+e;var u=e.charAt(s++);if(u<="A"||u==="B"||u==="Y"||u>="Z"||u==="I"||u==="O")throw"MGRSPoint zone letter "+u+" not handled: "+e;n=e.substring(s,s+=2);var a=y(o),f=E(n.charAt(0),a),l=S(n.charAt(1),a);while(l0&&(v=1e5/Math.pow(10,h),m=e.substring(s,s+h),p=parseFloat(m)*v,g=e.substring(s+h),d=parseFloat(g)*v),b=p+f,w=d+l,{easting:b,northing:w,zoneLetter:u,zoneNumber:o,accuracy:v}}function E(e,t){var n=i.charCodeAt(t-1),r=1e5,s=!1;while(n!==e.charCodeAt(0)){n++,n===u&&n++,n===a&&n++;if(n>l){if(s)throw"Bad character: "+e;n=o,s=!0}r+=1e5}return r}function S(e,t){if(e>"V")throw"MGRSPoint given invalid Northing "+e;var n=s.charCodeAt(t-1),r=0,i=!1;while(n!==e.charCodeAt(0)){n++,n===u&&n++,n===a&&n++;if(n>f){if(i)throw"Bad character: "+e;n=o,i=!0}r+=1e5}return r}function x(e){var t;switch(e){case"C":t=11e5;break;case"D":t=2e6;break;case"E":t=28e5;break;case"F":t=37e5;break;case"G":t=46e5;break;case"H":t=55e5;break;case"J":t=64e5;break;case"K":t=73e5;break;case"L":t=82e5;break;case"M":t=91e5;break;case"N":t=0;break;case"P":t=8e5;break;case"Q":t=17e5;break;case"R":t=26e5;break;case"S":t=35e5;break;case"T":t=44e5;break;case"U":t=53e5;break;case"V":t=62e5;break;case"W":t=7e6;break;case"X":t=79e5;break;default:t=-1}if(t>=0)return t;throw"Invalid zone letter: "+e}var r=6,i="AJSAJS",s="AFAFAF",o=65,u=73,a=79,f=86,l=90;n.forward=function(e,t){return t=t||5,m(p({lat:e[1],lon:e[0]}),t)},n.inverse=function(e){var t=d(w(e.toUpperCase()));return[t.left,t.bottom,t.right,t.top]},n.toPoint=function(e){var t=n.inverse(e);return[(t[2]+t[0])/2,(t[3]+t[1])/2]}},{}],67:[function(e,t,n){t.exports={name:"proj4",version:"2.3.3",description:"Proj4js is a JavaScript library to transform point coordinates from one coordinate system to another, including datum transformations.",main:"lib/index.js",directories:{test:"test",doc:"docs"},scripts:{test:"./node_modules/istanbul/lib/cli.js test ./node_modules/mocha/bin/_mocha test/test.js"},repository:{type:"git",url:"git://github.com/proj4js/proj4js.git"},author:"",license:"MIT",jam:{main:"dist/proj4.js",include:["dist/proj4.js","README.md","AUTHORS","LICENSE.md"]},devDependencies:{"grunt-cli":"~0.1.13",grunt:"~0.4.2","grunt-contrib-connect":"~0.6.0","grunt-contrib-jshint":"~0.8.0",chai:"~1.8.1",mocha:"~1.17.1","grunt-mocha-phantomjs":"~0.4.0",browserify:"~3.24.5","grunt-browserify":"~1.3.0","grunt-contrib-uglify":"~0.3.2",curl:"git://github.com/cujojs/curl.git",istanbul:"~0.2.4",tin:"~0.4.0"},dependencies:{mgrs:"0.0.0"}}},{}],"./includedProjections":[function(e,t,n){t.exports=e("gWUPNW")},{}],gWUPNW:[function(e,t,n){var r=[e("./lib/projections/tmerc"),e("./lib/projections/utm"),e("./lib/projections/sterea"),e("./lib/projections/stere"),e("./lib/projections/somerc"),e("./lib/projections/omerc"),e("./lib/projections/lcc"),e("./lib/projections/krovak"),e("./lib/projections/cass"),e("./lib/projections/laea"),e("./lib/projections/aea"),e("./lib/projections/gnom"),e("./lib/projections/cea"),e("./lib/projections/eqc"),e("./lib/projections/poly"),e("./lib/projections/nzmg"),e("./lib/projections/mill"),e("./lib/projections/sinu"),e("./lib/projections/moll"),e("./lib/projections/eqdc"),e("./lib/projections/vandg"),e("./lib/projections/aeqd")];t.exports=function(e){r.forEach(function(t){e.Proj.projections.add(t)})}},{"./lib/projections/aea":39,"./lib/projections/aeqd":40,"./lib/projections/cass":41,"./lib/projections/cea":42,"./lib/projections/eqc":43,"./lib/projections/eqdc":44,"./lib/projections/gnom":46,"./lib/projections/krovak":47,"./lib/projections/laea":48,"./lib/projections/lcc":49,"./lib/projections/mill":52,"./lib/projections/moll":53,"./lib/projections/nzmg":54,"./lib/projections/omerc":55,"./lib/projections/poly":56,"./lib/projections/sinu":57,"./lib/projections/somerc":58,"./lib/projections/stere":59,"./lib/projections/sterea":60,"./lib/projections/tmerc":61,"./lib/projections/utm":62,"./lib/projections/vandg":63}]},{},[35])(35)}),n("formats/geojson/GeoJSONCRS",["../../error/ArgumentError","./GeoJSONConstants","../../util/Logger","../../util/proj4-src"],function(e,t,n,r){"use strict";var i=function(t,r){if(!t)throw new e(n.logMessage(n.LEVEL_SEVERE,"GeoJSONCRS","constructor","missingType"));if(!r)throw new e(n.logMessage(n.LEVEL_SEVERE,"GeoJSONCRS","constructor","missingProperties"));this._type=t,this._properties=r,this._projectionString=null};return Object.defineProperties(i.prototype,{type:{get:function(){return this._type}},properties:{get:function(){return this._properties}},projectionString:{get:function(){return this._projectionString}}}),i.prototype.isDefault=function(){if(this.isNamed())if(this._projectionString===t.EPSG4326_CRS||this._projectionString===t.WGS84_CRS)return!0;return!1},i.prototype.isNamed=function(){return this._type===t.FIELD_CRS_NAME},i.prototype.isLinked=function(){return this._type===t.FIELD_CRS_LINK},i.prototype.isCRSSupported=function(){try{r(this._projectionString,t.EPSG4326_CRS)}catch(e){return n.log(n.LEVEL_WARNING,"Unknown GeoJSON coordinate reference system ("+e+"): "+this._properties.name),!1}return!0},i.prototype.getLinkedCRSString=function(e,t){var r=new XMLHttpRequest;r.open("GET",e,!0),r.responseType="text",r.onreadystatechange=function(){r.readyState===4&&(r.status===200?(this._projectionString=r.response,t()):n.log(n.LEVEL_WARNING,"GeoJSON Linked CRS retrieval failed ("+r.statusText+"): "+e))}.bind(this),r.onerror=function(){n.log(n.LEVEL_WARNING,"GeoJSON Linked CRS retrieval failed: "+e)},r.ontimeout=function(){n.log(n.LEVEL_WARNING,"GeoJSON Linked CRS retrieval timed out: "+e)},r.send(null)},i.prototype.setCRSString=function(e){this.isNamed()?(this._projectionString=this._properties.name,e()):this.isLinked()&&this.getLinkedCRSString(this._properties.href,e)},i}),n("formats/geojson/GeoJSONFeature",["../../error/ArgumentError","./GeoJSONConstants","../../util/Logger"],function(e,t,n){"use strict";var r=function(r,i,s,o){if(!r)throw new e(n.logMessage(n.LEVEL_SEVERE,"GeoJSONFeature","constructor","missingGeometry"));if(!r[t.FIELD_TYPE])throw new e(n.logMessage(n.LEVEL_SEVERE,"GeoJSONFeature","constructor","missingFeatureGeometryType"));if(!i)throw new e(n.logMessage(n.LEVEL_SEVERE,"GeoJSONFeature","constructor","missingProperties"));this._geometry=r,this._properties=i,this._id=s,this._bbox=o};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}),n("formats/geojson/GeoJSONFeatureCollection",["../../error/ArgumentError","./GeoJSONConstants","../../util/Logger"],function(e,t,n){"use strict";var r=function(t,r){if(!t)throw new e(n.logMessage(n.LEVEL_SEVERE,"GeoJSONFeatureCollection","constructor","missingFeatures"));if(Object.prototype.toString.call(t)!=="[object Array]")throw new e(n.logMessage(n.LEVEL_SEVERE,"GeoJSONFeatureCollection","constructor","invalidFeatures"));this._features=t,this._bbox=r};return Object.defineProperties(r.prototype,{features:{get:function(){return this._features}},bbox:{get:function(){return this._bbox}}}),r}),n("shapes/PlacemarkAttributes",["../util/Color","../util/Font","../util/Offset","../shapes/ShapeAttributes","../shapes/TextAttributes"],function(e,t,n,r,i){"use strict";var s=function(t){this._imageColor=t?t._imageColor:new e(1,1,1,1),this._imageOffset=t?t._imageOffset:new n(WorldWind.OFFSET_FRACTION,.5,WorldWind.OFFSET_FRACTION,.5),this._imageScale=t?t._imageScale:1,this._imageSource=t?t._imageSource:null,this._depthTest=t?t._depthTest:!0,this._labelAttributes=t?t._labelAttributes:new i(null),this._drawLeaderLine=t?t._drawLeaderLine:!1,this._leaderLineAttributes=t?t._leaderLineAttributes:new r(null),this.stateKeyInvalid=!0};return s.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(s.prototype,{stateKey:{get:function(){return this.stateKeyInvalid&&(this._stateKey=this.computeStateKey(),this.stateKeyInvalid=!1),this._stateKey}},imageColor:{get:function(){return this._imageColor},set:function(e){this._imageColor=e,this.stateKeyInvalid=!0}},imageOffset:{get:function(){return this._imageOffset},set:function(e){this._imageOffset=e,this.stateKeyInvalid=!0}},imageScale:{get:function(){return this._imageScale},set:function(e){this._imageScale=e,this.stateKeyInvalid=!0}},imageSource:{get:function(){return this._imageSource},set:function(e){this._imageSource=e,this.stateKeyInvalid=!0}},depthTest:{get:function(){return this._depthTest},set:function(e){this._depthTest=e,this.stateKeyInvalid=!0}},labelAttributes:{get:function(){return this._labelAttributes},set:function(e){this._labelAttributes=e,this.stateKeyInvalid=!0}},drawLeaderLine:{get:function(){return this._drawLeaderLine},set:function(e){this._drawLeaderLine=e,this.stateKeyInvalid=!0}},leaderLineAttributes:{get:function(){return this._leaderLineAttributes},set:function(e){this._leaderLineAttributes=e,this.stateKeyInvalid=!0}}}),s}),n("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(e,t,n,r,i,s,o,u,a,f,l,c){"use strict";var h=function(t,n,r){if(!t)throw new e(i.logMessage(i.LEVEL_SEVERE,"Placemark","constructor","missingPosition"));a.call(this),this.attributes=r?r:new u(null),this.highlightAttributes=null,this.highlighted=!1,this.position=t,this.eyeDistanceScaling=n,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 l(0,0,0),this.groundPoint=new l(0,0,0),this.imageTransform=s.fromIdentity(),this.labelTransform=s.fromIdentity(),this.texCoordMatrix=s.fromIdentity(),this.imageBounds=null,this.layer=null,this.depthOffset=-0.003};return h.screenPoint=new l(0,0,0),h.matrix=s.fromIdentity(),h.scratchPoint=new l(0,0,0),h.prototype=Object.create(a.prototype),Object.defineProperties(h.prototype,{screenBounds:{get:function(){return this.labelBounds}}}),h.prototype.copy=function(e){return this.position=e.position,this.attributes=e.attributes,this.highlightAttributes=e.highlightAttributes,this.highlighted=e.highlighted,this.enabled=e.enabled,this.label=e.label,this.altitudeMode=e.altitudeMode,this.pickDelegate=e.pickDelegate,this.alwaysOnTop=e.alwaysOnTop,this.depthOffset=e.depthOffset,this.targetVisibility=e.targetVisibility,this.currentVisibility=e.currentVisibility,this.imageRotation=e.imageRotation,this.imageTilt=e.imageTilt,this.imageRotationReference=e.imageRotationReference,this.imageTiltReference=e.imageTiltReference,this},h.prototype.clone=function(){var e=new h(this.position);return e.copy(this),e.pickDelegate=this.pickDelegate?this.pickDelegate:this,e},h.prototype.render=function(e){if(!this.enabled)return;if(!e.accumulateOrderedRenderables)return;if(e.globe.projectionLimits&&!e.globe.projectionLimits.containsLocation(this.position.latitude,this.position.longitude))return;var t;if(this.lastFrameTime!==e.timestamp)t=this.makeOrderedRenderable(e);else{var n=this.clone();t=n.makeOrderedRenderable(e)}if(!t)return;if(!t.isVisible(e))return;t.layer=e.currentLayer,this.lastFrameTime=e.timestamp,e.addOrderedRenderable(t)},h.prototype.renderOrdered=function(e){this.drawOrderedPlacemark(e);if(e.pickingMode){var t=new o(this.pickColor.clone(),this.pickDelegate?this.pickDelegate:this,this.position,this.layer,!1);e.pickPoint&&this.mustDrawLabel()&&this.labelBounds.containsPoint(e.navigatorState.convertPointToViewport(e.pickPoint,h.scratchPoint))&&(t.labelPicked=!0),e.resolvePick(t)}},h.prototype.makeOrderedRenderable=function(e){var t,n,r,i;this.determineActiveAttributes(e);if(!this.activeAttributes)return null;e.surfacePointForMode(this.position.latitude,this.position.longitude,this.position.altitude,this.altitudeMode,this.placePoint),this.eyeDistance=this.alwaysOnTop?0:e.navigatorState.eyePoint.distanceTo(this.placePoint),this.mustDrawLeaderLine(e)&&e.surfacePointForMode(this.position.latitude,this.position.longitude,0,this.altitudeMode,this.groundPoint);if(!e.navigatorState.projectWithDepth(this.placePoint,this.depthOffset,h.screenPoint))return null;var s=this.eyeDistanceScaling?Math.max(0,Math.min(1,this.eyeDistanceScalingThreshold/this.eyeDistance)):1;this.activeTexture?(t=this.activeTexture.originalImageWidth,n=this.activeTexture.originalImageHeight,r=this.activeAttributes.imageScale*s,i=this.activeAttributes.imageOffset.offsetForSize(t,n),this.imageTransform.setTranslation(h.screenPoint[0]-i[0]*r,h.screenPoint[1]-i[1]*r,h.screenPoint[2]),this.imageTransform.setScale(t*r,n*r,1)):(r=this.activeAttributes.imageScale*s,i=this.activeAttributes.imageOffset.offsetForSize(r,r),this.imageTransform.setTranslation(h.screenPoint[0]-i[0],h.screenPoint[1]-i[1],h.screenPoint[2]),this.imageTransform.setScale(r,r,1)),this.imageBounds=c.boundingRectForUnitQuad(this.imageTransform);if(this.mustDrawLabel()){var o=this.activeAttributes.labelAttributes.font,u=this.label+o.toString();this.labelTexture=e.gpuResourceCache.resourceForKey(u),this.labelTexture||(this.labelTexture=e.textSupport.createTexture(e,this.label,o,!0),e.gpuResourceCache.putResource(u,this.labelTexture,this.labelTexture.size)),t=this.labelTexture.imageWidth,n=this.labelTexture.imageHeight,r=this.activeAttributes.labelAttributes.scale*s,i=this.activeAttributes.labelAttributes.offset.offsetForSize(t,n),this.labelTransform.setTranslation(h.screenPoint[0]-i[0]*r,h.screenPoint[1]-i[1]*r,h.screenPoint[2]),this.labelTransform.setScale(t*r,n*r,1),this.labelBounds=c.boundingRectForUnitQuad(this.labelTransform)}return this},h.prototype.determineActiveAttributes=function(e){this.highlighted&&this.highlightAttributes?this.activeAttributes=this.highlightAttributes:this.activeAttributes=this.attributes;if(this.activeAttributes&&this.activeAttributes.imageSource){this.activeTexture=e.gpuResourceCache.resourceForKey(this.activeAttributes.imageSource);if(!this.activeTexture||this.updateImage)this.activeTexture=e.gpuResourceCache.retrieveTexture(e.currentGlContext,this.activeAttributes.imageSource),this.updateImage=!1}},h.prototype.isVisible=function(e){return e.pickingMode?e.pickRectangle&&(this.imageBounds.intersects(e.pickRectangle)||this.mustDrawLabel()&&this.labelBounds.intersects(e.pickRectangle)||this.mustDrawLeaderLine(e)&&e.pickFrustum.intersectsSegment(this.groundPoint,this.placePoint)):this.imageBounds.intersects(e.navigatorState.viewport)||this.mustDrawLabel()&&this.labelBounds.intersects(e.navigatorState.viewport)||this.mustDrawLeaderLine(e)&&e.navigatorState.frustumInModelCoordinates.intersectsSegment(this.groundPoint,this.placePoint)},h.prototype.drawOrderedPlacemark=function(e){this.beginDrawing(e);try{this.doDrawOrderedPlacemark(e),e.pickingMode||this.drawBatchOrderedPlacemarks(e)}finally{this.endDrawing(e)}},h.prototype.drawBatchOrderedPlacemarks=function(e){var t;while((t=e.peekOrderedRenderable())&&t.doDrawOrderedPlacemark){e.popOrderedRenderable();try{t.doDrawOrderedPlacemark(e)}catch(n){i.logMessage(i.LEVEL_WARNING,"Placemark","drawBatchOrderedPlacemarks","Error occurred while rendering placemark using batching: "+n.message)}}},h.prototype.beginDrawing=function(e){var n=e.currentGlContext,r;e.findAndBindProgram(t),r=e.currentProgram,n.bindBuffer(n.ARRAY_BUFFER,e.unitQuadBuffer()),n.vertexAttribPointer(r.vertexTexCoordLocation,2,n.FLOAT,!1,0,0),n.enableVertexAttribArray(r.vertexPointLocation),n.enableVertexAttribArray(r.vertexTexCoordLocation),r.loadTextureUnit(n,n.TEXTURE0),r.loadModulateColor(n,e.pickingMode)},h.prototype.endDrawing=function(e){var t=e.currentGlContext,n=e.currentProgram;t.disableVertexAttribArray(n.vertexPointLocation),t.disableVertexAttribArray(n.vertexTexCoordLocation),t.bindBuffer(t.ARRAY_BUFFER,null),t.bindTexture(t.TEXTURE_2D,null)},h.prototype.doDrawOrderedPlacemark=function(e){var t=e.currentGlContext,n=e.currentProgram,r=!0,i;e.pickingMode&&(this.pickColor=e.uniquePickColor()),this.eyeDistanceScaling&&this.eyeDistance>this.eyeDistanceScalingLabelThreshold&&(this.targetVisibility=0);if(!e.pickingMode&&this.mustDrawLabel()&&this.currentVisibility!=this.targetVisibility){var s=(e.timestamp-e.previousRedrawTimestamp)/e.fadeTime;this.currentVisibility0&&(n.loadOpacity(t,e.pickingMode?1:this.layer.opacity*this.currentVisibility),h.matrix.copy(e.screenProjection),h.matrix.multiplyMatrix(this.labelTransform),n.loadModelviewProjection(t,h.matrix),!e.pickingMode&&this.labelTexture?(this.texCoordMatrix.setToIdentity(),this.texCoordMatrix.multiplyByTextureTransform(this.labelTexture),n.loadTextureMatrix(t,this.texCoordMatrix),n.loadColor(t,this.activeAttributes.labelAttributes.color),i=this.labelTexture.bind(e),n.loadTextureEnabled(t,i)):(n.loadTextureEnabled(t,!1),n.loadColor(t,this.pickColor)),this.activeAttributes.labelAttributes.depthTest?r||(r=!0,t.enable(t.DEPTH_TEST)):(r=!1,t.disable(t.DEPTH_TEST)),t.drawArrays(t.TRIANGLE_STRIP,0,4)),r||t.enable(t.DEPTH_TEST)},h.prototype.mustDrawLabel=function(){return this.label&&this.label.length>0&&this.activeAttributes.labelAttributes},h.prototype.mustDrawLeaderLine=function(e){return this.activeAttributes.drawLeaderLine&&this.activeAttributes.leaderLineAttributes&&(!e.pickingMode||this.enableLeaderLinePicking)},h});var r={};return r.DEBUG=!1,r.assert=function(e,t){if(r.DEBUG&&!e)throw new Error("Assertion failed"+(t?": "+t:""))},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(e,t){return e.s===t.s&&e.t===t.t},r.geom.vertLeq=function(e,t){return e.s0?r0?(t.t-n.t)*r+(t.t-e.t)*i:0},r.geom.transLeq=function(e,t){return e.t0?r0?(t.s-n.s)*r+(t.s-e.s)*i:0},r.geom.edgeGoesLeft=function(e){return r.geom.vertLeq(e.dst(),e.org)},r.geom.edgeGoesRight=function(e){return r.geom.vertLeq(e.org,e.dst())},r.geom.vertL1dist=function(e,t){return Math.abs(e.s-t.s)+Math.abs(e.t-t.t)},r.geom.vertCCW=function(e,t,n){return e.s*(t.t-n.t)+t.s*(n.t-e.t)+n.s*(e.t-t.t)>=0},r.geom.interpolate_=function(e,t,n,r){return e=e<0?0:e,n=n<0?0:n,e<=n?n===0?(t+r)/2:t+(r-t)*(e/(e+n)):r+(t-r)*(n/(e+n))},r.geom.edgeIntersect=function(e,t,n,i,s){var o,u,a;r.geom.vertLeq(e,t)||(a=e,e=t,t=a),r.geom.vertLeq(n,i)||(a=n,n=i,i=a),r.geom.vertLeq(e,n)||(a=e,e=n,n=a,a=t,t=i,i=a),r.geom.vertLeq(n,t)?r.geom.vertLeq(t,i)?(o=r.geom.edgeEval(e,n,t),u=r.geom.edgeEval(n,t,i),o+u<0&&(o=-o,u=-u),s.s=r.geom.interpolate_(o,n.s,u,t.s)):(o=r.geom.edgeSign(e,n,t),u=-r.geom.edgeSign(e,i,t),o+u<0&&(o=-o,u=-u),s.s=r.geom.interpolate_(o,n.s,u,i.s)):s.s=(n.s+t.s)/2,r.geom.transLeq(e,t)||(a=e,e=t,t=a),r.geom.transLeq(n,i)||(a=n,n=i,i=a),r.geom.transLeq(e,n)||(a=e,e=n,n=a,a=t,t=i,i=a),r.geom.transLeq(n,t)?r.geom.transLeq(t,i)?(o=r.geom.transEval(e,n,t),u=r.geom.transEval(n,t,i),o+u<0&&(o=-o,u=-u),s.t=r.geom.interpolate_(o,n.t,u,t.t)):(o=r.geom.transSign(e,n,t),u=-r.geom.transSign(e,i,t),o+u<0&&(o=-o,u=-u),s.t=r.geom.interpolate_(o,n.t,u,i.t)):s.t=(n.t+t.t)/2},r.mesh={},r.mesh.makeEdge=function(e){var t=r.mesh.makeEdgePair_(e.eHead);return r.mesh.makeVertex_(t,e.vHead),r.mesh.makeVertex_(t.sym,e.vHead),r.mesh.makeFace_(t,e.fHead),t},r.mesh.meshSplice=function(e,t){var n=!1,i=!1;if(e===t)return;t.org!==e.org&&(i=!0,r.mesh.killVertex_(t.org,e.org)),t.lFace!==e.lFace&&(n=!0,r.mesh.killFace_(t.lFace,e.lFace)),r.mesh.splice_(t,e),i||(r.mesh.makeVertex_(t,e.org),e.org.anEdge=e),n||(r.mesh.makeFace_(t,e.lFace),e.lFace.anEdge=e)},r.mesh.deleteEdge=function(e){var t=e.sym,n=!1;e.lFace!==e.rFace()&&(n=!0,r.mesh.killFace_(e.lFace,e.rFace())),e.oNext===e?r.mesh.killVertex_(e.org,null):(e.rFace().anEdge=e.oPrev(),e.org.anEdge=e.oNext,r.mesh.splice_(e,e.oPrev()),n||r.mesh.makeFace_(e,e.lFace)),t.oNext===t?(r.mesh.killVertex_(t.org,null),r.mesh.killFace_(t.lFace,null)):(e.lFace.anEdge=t.oPrev(),t.org.anEdge=t.oNext,r.mesh.splice_(t,t.oPrev())),r.mesh.killEdge_(e)},r.mesh.addEdgeVertex=function(e){var t=r.mesh.makeEdgePair_(e),n=t.sym;return r.mesh.splice_(t,e.lNext),t.org=e.dst(),r.mesh.makeVertex_(n,t.org),t.lFace=n.lFace=e.lFace,t},r.mesh.splitEdge=function(e){var t=r.mesh.addEdgeVertex(e),n=t.sym;return r.mesh.splice_(e.sym,e.sym.oPrev()),r.mesh.splice_(e.sym,n),e.sym.org=n.org,n.dst().anEdge=n.sym,n.sym.lFace=e.rFace(),n.winding=e.winding,n.sym.winding=e.sym.winding,n},r.mesh.connect=function(e,t){var n=!1,i=r.mesh.makeEdgePair_(e),s=i.sym;return t.lFace!==e.lFace&&(n=!0,r.mesh.killFace_(t.lFace,e.lFace)),r.mesh.splice_(i,e.lNext),r.mesh.splice_(s,t),i.org=e.dst(),s.org=t.org,i.lFace=s.lFace=e.lFace,e.lFace.anEdge=s,n||r.mesh.makeFace_(i,e.lFace),i},r.mesh.zapFace=function(e){var t=e.anEdge,n=t.lNext,i;do{i=n,n=i.lNext,i.lFace=null;if(i.rFace()===null){i.oNext===i?r.mesh.killVertex_(i.org,null):(i.org.anEdge=i.oNext,r.mesh.splice_(i,i.oPrev()));var s=i.sym;s.oNext===s?r.mesh.killVertex_(s.org,null):(s.org.anEdge=s.oNext,r.mesh.splice_(s,s.oPrev())),r.mesh.killEdge_(i)}}while(i!==t);var o=e.prev,u=e.next;u.prev=o,o.next=u},r.mesh.meshUnion=function(e,t){var n=e.fHead,r=e.vHead,i=e.eHead,s=t.fHead,o=t.vHead,u=t.eHead;return s.next!==s&&(n.prev.next=s.next,s.next.prev=n.prev,s.prev.next=n,n.prev=s.prev),o.next!==o&&(r.prev.next=o.next,o.next.prev=r.prev,o.prev.next=r,r.prev=o.prev),u.next!==u&&(i.sym.next.sym.next=u.next,u.next.sym.next=i.sym.next,u.sym.next.sym.next=i,i.sym.next=u.sym.next),e},r.mesh.deleteMesh=function(e){},r.mesh.makeEdgePair_=function(e){var t=new r.GluHalfEdge,n=new r.GluHalfEdge,i=e.sym.next;return n.next=i,i.sym.next=t,t.next=e,e.sym.next=n,t.sym=n,t.oNext=t,t.lNext=n,n.sym=t,n.oNext=n,n.lNext=t,t},r.mesh.splice_=function(e,t){var n=e.oNext,r=t.oNext;n.sym.lNext=t,r.sym.lNext=e,e.oNext=r,t.oNext=n},r.mesh.makeVertex_=function(e,t){var n=t.prev,i=new r.GluVertex(t,n);n.next=i,t.prev=i,i.anEdge=e;var s=e;do s.org=i,s=s.oNext;while(s!==e)},r.mesh.makeFace_=function(e,t){var n=t.prev,i=new r.GluFace(t,n);n.next=i,t.prev=i,i.anEdge=e,i.inside=t.inside;var s=e;do s.lFace=i,s=s.lNext;while(s!==e)},r.mesh.killEdge_=function(e){var t=e.next,n=e.sym.next;t.sym.next=n,n.sym.next=t},r.mesh.killVertex_=function(e,t){var n=e.anEdge,r=n;do r.org=t,r=r.oNext;while(r!==n);var i=e.prev,s=e.next;s.prev=i,i.next=s},r.mesh.killFace_=function(e,t){var n=e.anEdge,r=n;do r.lFace=t,r=r.lNext;while(r!==n);var i=e.prev,s=e.next;s.prev=i,i.next=s},r.normal={},r.normal.S_UNIT_X_=1,r.normal.S_UNIT_Y_=0,r.normal.projectPolygon=function(e){var t=!1,n=[e.normal[0],e.normal[1],e.normal[2]];n[0]===0&&n[1]===0&&n[2]===0&&(r.normal.computeNormal_(e,n),t=!0);var i=e.sUnit,s=e.tUnit,o=r.normal.longAxis_(n);if(r.TRUE_PROJECT){r.normal.normalize_(n),i[o]=0,i[(o+1)%3]=r.normal.S_UNIT_X_,i[(o+2)%3]=r.normal.S_UNIT_Y_;var u=r.normal.dot_(i,n);i[0]-=u*n[0],i[1]-=u*n[1],i[2]-=u*n[2],r.normal.normalize_(i),s[0]=n[1]*i[2]-n[2]*i[1],s[1]=n[2]*i[0]-n[0]*i[2],s[2]=n[0]*i[1]-n[1]*i[0],r.normal.normalize_(s)}else i[o]=0,i[(o+1)%3]=r.normal.S_UNIT_X_,i[(o+2)%3]=r.normal.S_UNIT_Y_,s[o]=0,s[(o+1)%3]=n[o]>0?-r.normal.S_UNIT_Y_:r.normal.S_UNIT_Y_,s[(o+2)%3]=n[o]>0?r.normal.S_UNIT_X_:-r.normal.S_UNIT_X_;var a=e.mesh.vHead;for(var f=a.next;f!==a;f=f.next)f.s=r.normal.dot_(f.coords,i),f.t=r.normal.dot_(f.coords,s);t&&r.normal.checkOrientation_(e)},r.normal.dot_=function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]},r.normal.normalize_=function(e){var t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2];t=Math.sqrt(t),e[0]/=t,e[1]/=t,e[2]/=t},r.normal.longAxis_=function(e){var t=0;return Math.abs(e[1])>Math.abs(e[0])&&(t=1),Math.abs(e[2])>Math.abs(e[t])&&(t=2),t},r.normal.computeNormal_=function(e,t){var n=[-2*r.GLU_TESS_MAX_COORD,-2*r.GLU_TESS_MAX_COORD,-2*r.GLU_TESS_MAX_COORD],i=[2*r.GLU_TESS_MAX_COORD,2*r.GLU_TESS_MAX_COORD,2*r.GLU_TESS_MAX_COORD],s=[],o=[],u,a=e.mesh.vHead;for(u=a.next;u!==a;u=u.next)for(var f=0;f<3;++f){var l=u.coords[f];ln[f]&&(n[f]=l,s[f]=u)}var c=0;n[1]-i[1]>n[0]-i[0]&&(c=1),n[2]-i[2]>n[c]-i[c]&&(c=2);if(i[c]>=n[c]){t[0]=0,t[1]=0,t[2]=1;return}var h=0,p=o[c],d=s[c],v=[0,0,0],m=[p.coords[0]-d.coords[0],p.coords[1]-d.coords[1],p.coords[2]-d.coords[2]],g=[0,0,0];for(u=a.next;u!==a;u=u.next){g[0]=u.coords[0]-d.coords[0],g[1]=u.coords[1]-d.coords[1],g[2]=u.coords[2]-d.coords[2],v[0]=m[1]*g[2]-m[2]*g[1],v[1]=m[2]*g[0]-m[0]*g[2],v[2]=m[0]*g[1]-m[1]*g[0];var y=v[0]*v[0]+v[1]*v[1]+v[2]*v[2];y>h&&(h=y,t[0]=v[0],t[1]=v[1],t[2]=v[2])}h<=0&&(t[0]=t[1]=t[2]=0,t[r.normal.longAxis_(m)]=1)},r.normal.checkOrientation_=function(e){var t=0,n=e.mesh.fHead;for(var r=n.next;r!==n;r=r.next){var i=r.anEdge;if(i.winding<=0)continue;do t+=(i.org.s-i.dst().s)*(i.org.t+i.dst().t),i=i.lNext;while(i!==r.anEdge)}if(t<0){var s=e.mesh.vHead;for(var o=s.next;o!==s;o=o.next)o.t=-o.t;e.tUnit[0]=-e.tUnit[0],e.tUnit[1]=-e.tUnit[1],e.tUnit[2]=-e.tUnit[2]}},r.render={},r.render.renderMesh=function(e,t,n){var i=!1,s=-1;for(var o=t.fHead.prev;o!==t.fHead;o=o.prev)if(o.inside){i||(e.callBeginOrBeginData(r.primitiveType.GL_TRIANGLES),i=!0);var u=o.anEdge;do{if(n){var a=u.rFace().inside?0:1;s!==a&&(s=a,e.callEdgeFlagOrEdgeFlagData(!!s))}e.callVertexOrVertexData(u.org.data),u=u.lNext}while(u!==o.anEdge)}i&&e.callEndOrEndData()},r.render.renderBoundary=function(e,t){for(var n=t.fHead.next;n!==t.fHead;n=n.next)if(n.inside){e.callBeginOrBeginData(r.primitiveType.GL_LINE_LOOP);var i=n.anEdge;do e.callVertexOrVertexData(i.org.data),i=i.lNext;while(i!==n.anEdge);e.callEndOrEndData()}},r.sweep={},r.sweep.SENTINEL_COORD_=4*r.GLU_TESS_MAX_COORD,r.sweep.TOLERANCE_NONZERO_=!1,r.sweep.computeInterior=function(e){e.fatalError=!1,r.sweep.removeDegenerateEdges_(e),r.sweep.initPriorityQ_(e),r.sweep.initEdgeDict_(e);var t;while((t=e.pq.extractMin())!==null){for(;;){var n=e.pq.minimum();if(n===null||!r.geom.vertEq(n,t))break;n=e.pq.extractMin(),r.sweep.spliceMergeVertices_(e,t.anEdge,n.anEdge)}r.sweep.sweepEvent_(e,t)}var i=e.dict.getMin().getKey();e.event=i.eUp.org,r.sweep.doneEdgeDict_(e),r.sweep.donePriorityQ_(e),r.sweep.removeDegenerateFaces_(e.mesh),e.mesh.checkMesh()},r.sweep.addWinding_=function(e,t){e.winding+=t.winding,e.sym.winding+=t.sym.winding},r.sweep.edgeLeq_=function(e,t,n){var i=e.event,s=t.eUp,o=n.eUp;if(s.dst()===i)return o.dst()===i?r.geom.vertLeq(s.org,o.org)?r.geom.edgeSign(o.dst(),s.org,o.org)<=0:r.geom.edgeSign(s.dst(),o.org,s.org)>=0:r.geom.edgeSign(o.dst(),i,o.org)<=0;if(o.dst()===i)return r.geom.edgeSign(s.dst(),i,s.org)>=0;var u=r.geom.edgeEval(s.dst(),i,s.org),a=r.geom.edgeEval(o.dst(),i,o.org);return u>=a},r.sweep.deleteRegion_=function(e,t){t.fixUpperEdge,t.eUp.activeRegion=null,e.dict.deleteNode(t.nodeUp),t.nodeUp=null},r.sweep.fixUpperEdge_=function(e,t){r.mesh.deleteEdge(e.eUp),e.fixUpperEdge=!1,e.eUp=t,t.activeRegion=e},r.sweep.topLeftRegion_=function(e){var t=e.eUp.org;do e=e.regionAbove();while(e.eUp.org===t);if(e.fixUpperEdge){var n=r.mesh.connect(e.regionBelow().eUp.sym,e.eUp.lNext);r.sweep.fixUpperEdge_(e,n),e=e.regionAbove()}return e},r.sweep.topRightRegion_=function(e){var t=e.eUp.dst();do e=e.regionAbove();while(e.eUp.dst()===t);return e},r.sweep.addRegionBelow_=function(e,t,n){var i=new r.ActiveRegion;return i.eUp=n,i.nodeUp=e.dict.insertBefore(t.nodeUp,i),n.activeRegion=i,i},r.sweep.isWindingInside_=function(e,t){switch(e.windingRule){case r.windingRule.GLU_TESS_WINDING_ODD:return(t&1)!==0;case r.windingRule.GLU_TESS_WINDING_NONZERO:return t!==0;case r.windingRule.GLU_TESS_WINDING_POSITIVE:return t>0;case r.windingRule.GLU_TESS_WINDING_NEGATIVE:return t<0;case r.windingRule.GLU_TESS_WINDING_ABS_GEQ_TWO:return t>=2||t<=-2}return!1},r.sweep.computeWinding_=function(e,t){t.windingNumber=t.regionAbove().windingNumber+t.eUp.winding,t.inside=r.sweep.isWindingInside_(e,t.windingNumber)},r.sweep.finishRegion_=function(e,t){var n=t.eUp,i=n.lFace;i.inside=t.inside,i.anEdge=n,r.sweep.deleteRegion_(e,t)},r.sweep.finishLeftRegions_=function(e,t,n){var i=t,s=t.eUp;while(i!==n){i.fixUpperEdge=!1;var o=i.regionBelow(),u=o.eUp;if(u.org!==s.org){if(!o.fixUpperEdge){r.sweep.finishRegion_(e,i);break}u=r.mesh.connect(s.lPrev(),u.sym),r.sweep.fixUpperEdge_(o,u)}s.oNext!==u&&(r.mesh.meshSplice(u.oPrev(),u),r.mesh.meshSplice(s,u)),r.sweep.finishRegion_(e,i),s=o.eUp,i=o}return s},r.sweep.addRightEdges_=function(e,t,n,i,s,o){var u=!0,a=n;do r.sweep.addRegionBelow_(e,t,a.sym),a=a.oNext;while(a!==i);s===null&&(s=t.regionBelow().eUp.rPrev());var f=t,l=s,c;for(;;){c=f.regionBelow(),a=c.eUp.sym;if(a.org!==l.org)break;a.oNext!==l&&(r.mesh.meshSplice(a.oPrev(),a),r.mesh.meshSplice(l.oPrev(),a)),c.windingNumber=f.windingNumber-a.winding,c.inside=r.sweep.isWindingInside_(e,c.windingNumber),f.dirty=!0,!u&&r.sweep.checkForRightSplice_(e,f)&&(r.sweep.addWinding_(a,l),r.sweep.deleteRegion_(e,f),r.mesh.deleteEdge(l)),u=!1,f=c,l=a}f.dirty=!0,o&&r.sweep.walkDirtyRegions_(e,f)},r.sweep.callCombine_=function(e,t,n,i,s){var o=[t.coords[0],t.coords[1],t.coords[2]];t.data=null,t.data=e.callCombineOrCombineData(o,n,i),t.data===null&&(s?e.fatalError||(e.callErrorOrErrorData(r.errorType.GLU_TESS_NEED_COMBINE_CALLBACK),e.fatalError=!0):t.data=n[0])},r.sweep.spliceMergeVertices_=function(e,t,n){var i=[null,null,null,null],s=[.5,.5,0,0];i[0]=t.org.data,i[1]=n.org.data,r.sweep.callCombine_(e,t.org,i,s,!1),r.mesh.meshSplice(t,n)},r.sweep.vertexWeights_=function(e,t,n,i,s){var o=r.geom.vertL1dist(t,e),u=r.geom.vertL1dist(n,e),a=s,f=s+1;i[a]=.5*u/(o+u),i[f]=.5*o/(o+u),e.coords[0]+=i[a]*t.coords[0]+i[f]*n.coords[0],e.coords[1]+=i[a]*t.coords[1]+i[f]*n.coords[1],e.coords[2]+=i[a]*t.coords[2]+i[f]*n.coords[2]},r.sweep.getIntersectData_=function(e,t,n,i,s,o){var u=[0,0,0,0],a=[n.data,i.data,s.data,o.data];t.coords[0]=t.coords[1]=t.coords[2]=0,r.sweep.vertexWeights_(t,n,i,u,0),r.sweep.vertexWeights_(t,s,o,u,2),r.sweep.callCombine_(e,t,a,u,!0)},r.sweep.checkForRightSplice_=function(e,t){var n=t.regionBelow(),i=t.eUp,s=n.eUp;if(r.geom.vertLeq(i.org,s.org)){if(r.geom.edgeSign(s.dst(),i.org,s.org)>0)return!1;r.geom.vertEq(i.org,s.org)?i.org!==s.org&&(e.pq.remove(i.org.pqHandle),r.sweep.spliceMergeVertices_(e,s.oPrev(),i)):(r.mesh.splitEdge(s.sym),r.mesh.meshSplice(i,s.oPrev()),t.dirty=n.dirty=!0)}else{if(r.geom.edgeSign(i.dst(),s.org,i.org)<0)return!1;t.regionAbove().dirty=t.dirty=!0,r.mesh.splitEdge(i.sym),r.mesh.meshSplice(s.oPrev(),i)}return!0},r.sweep.checkForLeftSplice_=function(e,t){var n=t.regionBelow(),i=t.eUp,s=n.eUp,o;if(r.geom.vertLeq(i.dst(),s.dst())){if(r.geom.edgeSign(i.dst(),s.dst(),i.org)<0)return!1;t.regionAbove().dirty=t.dirty=!0,o=r.mesh.splitEdge(i),r.mesh.meshSplice(s.sym,o),o.lFace.inside=t.inside}else{if(r.geom.edgeSign(s.dst(),i.dst(),s.org)>0)return!1;t.dirty=n.dirty=!0,o=r.mesh.splitEdge(s),r.mesh.meshSplice(i.lNext,s.sym),o.rFace().inside=t.inside}return!0},r.sweep.checkForIntersect_=function(e,t){var n=t.regionBelow(),i=t.eUp,s=n.eUp,o=i.org,u=s.org,a=i.dst(),f=s.dst(),l=new r.GluVertex;if(o===u)return!1;var c=Math.min(o.t,a.t),h=Math.max(u.t,f.t);if(c>h)return!1;if(r.geom.vertLeq(o,u)){if(r.geom.edgeSign(f,o,u)>0)return!1}else if(r.geom.edgeSign(a,u,o)<0)return!1;r.geom.edgeIntersect(a,o,f,u,l),r.geom.vertLeq(l,e.event)&&(l.s=e.event.s,l.t=e.event.t);var p=r.geom.vertLeq(o,u)?o:u;r.geom.vertLeq(p,l)&&(l.s=p.s,l.t=p.t);if(r.geom.vertEq(l,o)||r.geom.vertEq(l,u))return r.sweep.checkForRightSplice_(e,t),!1;if(!r.geom.vertEq(a,e.event)&&r.geom.edgeSign(a,e.event,l)>=0||!r.geom.vertEq(f,e.event)&&r.geom.edgeSign(f,e.event,l)<=0){if(f===e.event)return r.mesh.splitEdge(i.sym),r.mesh.meshSplice(s.sym,i),t=r.sweep.topLeftRegion_(t),i=t.regionBelow().eUp,r.sweep.finishLeftRegions_(e,t.regionBelow(),n),r.sweep.addRightEdges_(e,t,i.oPrev(),i,i,!0),!0;if(a===e.event){r.mesh.splitEdge(s.sym),r.mesh.meshSplice(i.lNext,s.oPrev()),n=t,t=r.sweep.topRightRegion_(t);var d=t.regionBelow().eUp.rPrev();return n.eUp=s.oPrev(),s=r.sweep.finishLeftRegions_(e,n,null),r.sweep.addRightEdges_(e,t,s.oNext,i.rPrev(),d,!0),!0}return r.geom.edgeSign(a,e.event,l)>=0&&(t.regionAbove().dirty=t.dirty=!0,r.mesh.splitEdge(i.sym),i.org.s=e.event.s,i.org.t=e.event.t),r.geom.edgeSign(f,e.event,l)<=0&&(t.dirty=n.dirty=!0,r.mesh.splitEdge(s.sym),s.org.s=e.event.s,s.org.t=e.event.t),!1}return r.mesh.splitEdge(i.sym),r.mesh.splitEdge(s.sym),r.mesh.meshSplice(s.oPrev(),i),i.org.s=l.s,i.org.t=l.t,i.org.pqHandle=e.pq.insert(i.org),r.sweep.getIntersectData_(e,i.org,o,a,u,f),t.regionAbove().dirty=t.dirty=n.dirty=!0,!1},r.sweep.walkDirtyRegions_=function(e,t){var n=t.regionBelow();for(;;){while(n.dirty)t=n,n=n.regionBelow();if(!t.dirty){n=t,t=t.regionAbove();if(t===null||!t.dirty)return}t.dirty=!1;var i=t.eUp,s=n.eUp;i.dst()!==s.dst()&&r.sweep.checkForLeftSplice_(e,t)&&(n.fixUpperEdge?(r.sweep.deleteRegion_(e,n),r.mesh.deleteEdge(s),n=t.regionBelow(),s=n.eUp):t.fixUpperEdge&&(r.sweep.deleteRegion_(e,t),r.mesh.deleteEdge(i),t=n.regionAbove(),i=t.eUp));if(i.org!==s.org)if(i.dst()!==s.dst()&&!t.fixUpperEdge&&!n.fixUpperEdge&&(i.dst()===e.event||s.dst()===e.event)){if(r.sweep.checkForIntersect_(e,t))return}else r.sweep.checkForRightSplice_(e,t);i.org===s.org&&i.dst()===s.dst()&&(r.sweep.addWinding_(s,i),r.sweep.deleteRegion_(e,t),r.mesh.deleteEdge(i),t=n.regionAbove())}},r.sweep.connectRightVertex_=function(e,t,n){var i=n.oNext,s=t.regionBelow(),o=t.eUp,u=s.eUp,a=!1;o.dst()!==u.dst()&&r.sweep.checkForIntersect_(e,t),r.geom.vertEq(o.org,e.event)&&(r.mesh.meshSplice(i.oPrev(),o),t=r.sweep.topLeftRegion_(t),i=t.regionBelow().eUp,r.sweep.finishLeftRegions_(e,t.regionBelow(),s),a=!0),r.geom.vertEq(u.org,e.event)&&(r.mesh.meshSplice(n,u.oPrev()),n=r.sweep.finishLeftRegions_(e,s,null),a=!0);if(a){r.sweep.addRightEdges_(e,t,n.oNext,i,i,!0);return}var f;r.geom.vertLeq(u.org,o.org)?f=u.oPrev():f=o,f=r.mesh.connect(n.lPrev(),f),r.sweep.addRightEdges_(e,t,f,f.oNext,f.oNext,!1),f.sym.activeRegion.fixUpperEdge=!0,r.sweep.walkDirtyRegions_(e,t)},r.sweep.connectLeftDegenerate_=function(e,t,n){var i=t.eUp;if(r.geom.vertEq(i.org,n)){r.sweep.TOLERANCE_NONZERO_&&r.sweep.spliceMergeVertices_(e,i,n.anEdge);return}if(!r.geom.vertEq(i.dst(),n)){r.mesh.splitEdge(i.sym),t.fixUpperEdge&&(r.mesh.deleteEdge(i.oNext),t.fixUpperEdge=!1),r.mesh.meshSplice(n.anEdge,i),r.sweep.sweepEvent_(e,n);return}if(r.sweep.TOLERANCE_NONZERO_){t=r.sweep.topRightRegion_(t);var s=t.regionBelow(),o=s.eUp.sym,u=o.oNext,a=u;s.fixUpperEdge&&(r.sweep.deleteRegion_(e,s),r.mesh.deleteEdge(o),o=u.oPrev()),r.mesh.meshSplice(n.anEdge,o),r.geom.edgeGoesLeft(u)||(u=null),r.sweep.addRightEdges_(e,t,o.oNext,a,u,!0)}},r.sweep.connectLeftVertex_=function(e,t){var n=new r.ActiveRegion;n.eUp=t.anEdge.sym;var i=e.dict.search(n).getKey(),s=i.regionBelow(),o=i.eUp,u=s.eUp;if(r.geom.edgeSign(o.dst(),t,o.org)===0){r.sweep.connectLeftDegenerate_(e,i,t);return}var a=r.geom.vertLeq(u.dst(),o.dst())?i:s,f;if(i.inside||a.fixUpperEdge){if(a===i)f=r.mesh.connect(t.anEdge.sym,o.lNext);else{var l=r.mesh.connect(u.dNext(),t.anEdge);f=l.sym}a.fixUpperEdge?r.sweep.fixUpperEdge_(a,f):r.sweep.computeWinding_(e,r.sweep.addRegionBelow_(e,i,f)),r.sweep.sweepEvent_(e,t)}else r.sweep.addRightEdges_(e,i,t.anEdge,t.anEdge,null,!0)},r.sweep.sweepEvent_=function(e,t){e.event=t;var n=t.anEdge;while(n.activeRegion===null){n=n.oNext;if(n===t.anEdge){r.sweep.connectLeftVertex_(e,t);return}}var i=r.sweep.topLeftRegion_(n.activeRegion),s=i.regionBelow(),o=s.eUp,u=r.sweep.finishLeftRegions_(e,s,null);u.oNext===o?r.sweep.connectRightVertex_(e,i,u):r.sweep.addRightEdges_(e,i,u.oNext,o,o,!0)},r.sweep.addSentinel_=function(e,t){var n=new r.ActiveRegion,i=r.mesh.makeEdge(e.mesh);i.org.s=r.sweep.SENTINEL_COORD_,i.org.t=t,i.dst().s=-r.sweep.SENTINEL_COORD_,i.dst().t=t,e.event=i.dst(),n.eUp=i,n.windingNumber=0,n.inside=!1,n.fixUpperEdge=!1,n.sentinel=!0,n.dirty=!1,n.nodeUp=e.dict.insert(n)},r.sweep.initEdgeDict_=function(e){e.dict=new r.Dict(e,r.sweep.edgeLeq_),r.sweep.addSentinel_(e,-r.sweep.SENTINEL_COORD_),r.sweep.addSentinel_(e,r.sweep.SENTINEL_COORD_)},r.sweep.doneEdgeDict_=function(e){var t=0,n;while((n=e.dict.getMin().getKey())!==null)!n.sentinel,r.sweep.deleteRegion_(e,n);e.dict=null},r.sweep.removeDegenerateEdges_=function(e){var t=e.mesh.eHead,n;for(var i=t.next;i!==t;i=n){n=i.next;var s=i.lNext;r.geom.vertEq(i.org,i.dst())&&i.lNext.lNext!==i&&(r.sweep.spliceMergeVertices_(e,s,i),r.mesh.deleteEdge(i),i=s,s=i.lNext);if(s.lNext===i){if(s!==i){if(s===n||s===n.sym)n=n.next;r.mesh.deleteEdge(s)}if(i===n||i===n.sym)n=n.next;r.mesh.deleteEdge(i)}}},r.sweep.initPriorityQ_=function(e){var t=new r.PriorityQ(r.geom.vertLeq);e.pq=t;var n=e.mesh.vHead,i;for(i=n.next;i!==n;i=i.next)i.pqHandle=t.insert(i);t.init()},r.sweep.donePriorityQ_=function(e){e.pq.deleteQ(),e.pq=null},r.sweep.removeDegenerateFaces_=function(e){var t;for(var n=e.fHead.next;n!==e.fHead;n=t){t=n.next;var i=n.anEdge;i.lNext.lNext===i&&(r.sweep.addWinding_(i.oNext,i),r.mesh.deleteEdge(i))}},r.tessmono={},r.tessmono.tessellateMonoRegion_=function(e){var t=e.anEdge;for(;r.geom.vertLeq(t.dst(),t.org);t=t.lPrev());for(;r.geom.vertLeq(t.org,t.dst());t=t.lNext);var n=t.lPrev(),i;while(t.lNext!==n)if(r.geom.vertLeq(t.dst(),n.org)){while(n.lNext!==t&&(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{while(n.lNext!==t&&(r.geom.edgeGoesRight(t.lPrev())||r.geom.edgeSign(t.dst(),t.org,t.lPrev().org)>=0))i=r.mesh.connect(t,t.lPrev()),t=i.sym;t=t.lNext}while(n.lNext.lNext!==t)i=r.mesh.connect(n.lNext,n),n=i.sym},r.tessmono.tessellateInterior=function(e){var t;for(var n=e.fHead.next;n!==e.fHead;n=t)t=n.next,n.inside&&r.tessmono.tessellateMonoRegion_(n)},r.tessmono.discardExterior=function(e){var t;for(var n=e.fHead.next;n!==e.fHead;n=t)t=n.next,n.inside||r.mesh.zapFace(n)},r.tessmono.setWindingNumber=function(e,t,n){var i;for(var s=e.eHead.next;s!==e.eHead;s=i)i=s.next,s.rFace().inside!==s.lFace.inside?s.winding=s.lFace.inside?t:-t:n?r.mesh.deleteEdge(s):s.winding=0},r.Dict=function(e,t){this.head_=new r.DictNode,this.frame_=e,this.leq_=t},r.Dict.prototype.deleteDict_=function(){},r.Dict.prototype.insertBefore=function(e,t){do e=e.prev;while(e.key!==null&&!this.leq_(this.frame_,e.key,t));var n=new r.DictNode(t,e.next,e);return e.next.prev=n,e.next=n,n},r.Dict.prototype.insert=function(e){return this.insertBefore(this.head_,e)},r.Dict.prototype.deleteNode=function(e){e.next.prev=e.prev,e.prev.next=e.next},r.Dict.prototype.search=function(e){var t=this.head_;do t=t.next;while(t.key!==null&&!this.leq_(this.frame_,e,t.key));return t},r.Dict.prototype.getMin=function(){return this.head_.next},r.Dict.prototype.getMax=function(){return this.head_.prev},r.DictNode=function(e,t,n){this.key=e||null,this.next=t||this,this.prev=n||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 e=0;e1)break;this.relTolerance=t;return;case r.gluEnum.GLU_TESS_WINDING_RULE:var n=t;switch(n){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:this.windingRule=n;return;default:}break;case r.gluEnum.GLU_TESS_BOUNDARY_ONLY:this.boundaryOnly=!!t;return;default:this.callErrorOrErrorData(r.gluEnum.GLU_INVALID_ENUM);return}this.callErrorOrErrorData(r.gluEnum.GLU_INVALID_VALUE)},r.GluTesselator.prototype.gluGetTessProperty=function(e){switch(e){case r.gluEnum.GLU_TESS_TOLERANCE:return this.relTolerance;case r.gluEnum.GLU_TESS_WINDING_RULE:var t=this.windingRule;return t;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(e,t,n){this.normal[0]=e,this.normal[1]=t,this.normal[2]=n},r.GluTesselator.prototype.gluTessCallback=function(e,t){var n=t?t:null;switch(e){case r.gluEnum.GLU_TESS_BEGIN:this.callBegin_=n;return;case r.gluEnum.GLU_TESS_BEGIN_DATA:this.callBeginData_=n;return;case r.gluEnum.GLU_TESS_EDGE_FLAG:this.callEdgeFlag_=n;return;case r.gluEnum.GLU_TESS_EDGE_FLAG_DATA:this.callEdgeFlagData_=n;return;case r.gluEnum.GLU_TESS_VERTEX:this.callVertex_=n;return;case r.gluEnum.GLU_TESS_VERTEX_DATA:this.callVertexData_=n;return;case r.gluEnum.GLU_TESS_END:this.callEnd_=n;return;case r.gluEnum.GLU_TESS_END_DATA:this.callEndData_=n;return;case r.gluEnum.GLU_TESS_ERROR:this.callError_=n;return;case r.gluEnum.GLU_TESS_ERROR_DATA:this.callErrorData_=n;return;case r.gluEnum.GLU_TESS_COMBINE:this.callCombine_=n;return;case r.gluEnum.GLU_TESS_COMBINE_DATA:this.callCombineData_=n;return;case r.gluEnum.GLU_TESS_MESH:this.callMesh_=n;return;default:this.callErrorOrErrorData(r.gluEnum.GLU_INVALID_ENUM);return}},r.GluTesselator.prototype.gluTessVertex=function(e,t){var n=!1,i=[0,0,0];this.requireState_(r.GluTesselator.tessState_.T_IN_CONTOUR),this.emptyCache&&(this.emptyCache_(),this.lastEdge_=null);for(var s=0;s<3;++s){var o=e[s];o<-r.GLU_TESS_MAX_COORD&&(o=-r.GLU_TESS_MAX_COORD,n=!0),o>r.GLU_TESS_MAX_COORD&&(o=r.GLU_TESS_MAX_COORD,n=!0),i[s]=o}n&&this.callErrorOrErrorData(r.errorType.GLU_TESS_COORD_TOO_LARGE);if(this.mesh===null){if(this.cacheCount0&&(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(){this.requireState_(r.GluTesselator.tessState_.T_IN_POLYGON),this.state=r.GluTesselator.tessState_.T_DORMANT,this.mesh===null&&this.emptyCache_(),r.normal.projectPolygon(this),r.sweep.computeInterior(this);if(!this.fatalError){var e=this.mesh;this.boundaryOnly?r.tessmono.setWindingNumber(e,1,!0):r.tessmono.tessellateInterior(e),this.mesh.checkMesh();if(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 t=!!this.callEdgeFlag_||!!this.callEdgeFlagData_;r.render.renderMesh(this,this.mesh,t)}if(this.callMesh_){r.tessmono.discardExterior(this.mesh),this.callMesh_(this.mesh),this.mesh=null,this.polygonData_=null;return}}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(e){this.state!==e&&this.gotoState_(e)},r.GluTesselator.prototype.gotoState_=function(e){while(this.state!==e)if(this.state=this.max_&&(this.max_*=2,this.keys_=r.PriorityQ.prototype.PQKeyRealloc_(this.keys_,this.max_)),this.keys_[t]=e,-(t+1)},r.PriorityQ.prototype.PQKeyRealloc_=function(e,t){var n=new Array(t),r=0;if(e!==null)for(;r0&&this.keys_[this.order_[this.size_-1]]===null);return e},r.PriorityQ.prototype.minimum=function(){if(this.size_===0)return this.heap_.minimum();var e=this.keys_[this.order_[this.size_-1]];if(!this.heap_.isEmpty()){var t=this.heap_.minimum();if(this.leq_(t,e))return t}return e},r.PriorityQ.prototype.isEmpty_=function(){return this.size_===0&&this.heap_.isEmpty()},r.PriorityQ.prototype.remove=function(e){if(e>=0){this.heap_.remove(e);return}e=-(e+1),this.keys_[e]=null;while(this.size_>0&&this.keys_[this.order_[this.size_-1]]===null)--this.size_},r.PriorityQHeap=function(e){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_=e,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 e=this.size_;e>=1;--e)this.floatDown_(e);this.initialized_=!0},r.PriorityQHeap.prototype.insert=function(e){var t=++this.size_;t*2>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 n;return this.freeList_===0?n=t:(n=this.freeList_,this.freeList_=this.handles_[n].node),this.nodes_[t].handle=n,this.handles_[n].node=t,this.handles_[n].key=e,this.initialized_&&this.floatUp_(t),n},r.PriorityQHeap.prototype.isEmpty=function(){return this.size_===0},r.PriorityQHeap.prototype.minimum=function(){return this.handles_[this.nodes_[1].handle].key},r.PriorityQHeap.prototype.extractMin=function(){var e=this.nodes_,t=this.handles_,n=e[1].handle,r=t[n].key;return this.size_>0&&(e[1].handle=e[this.size_].handle,t[e[1].handle].node=1,t[n].key=null,t[n].node=this.freeList_,this.freeList_=n,--this.size_>0&&this.floatDown_(1)),r},r.PriorityQHeap.prototype.remove=function(e){var t=this.nodes_,n=this.handles_,r=n[e].node;t[r].handle=t[this.size_].handle,n[t[r].handle].node=r,r<=--this.size_&&(r<=1||this.leq_(n[t[r>>1].handle].key,n[t[r].handle].key)?this.floatDown_(r):this.floatUp_(r)),n[e].key=null,n[e].node=this.freeList_,this.freeList_=e},r.PriorityQHeap.prototype.floatDown_=function(e){var t=this.nodes_,n=this.handles_,r=t[e].handle;for(;;){var i=e<<1;ithis.size_||this.leq_(n[r].key,n[s].key)){t[e].handle=r,n[r].node=e;break}t[e].handle=s,n[s].node=e,e=i}},r.PriorityQHeap.prototype.floatUp_=function(e){var t=this.nodes_,n=this.handles_,r=t[e].handle;for(;;){var i=e>>1,s=t[i].handle;if(i===0||this.leq_(n[s].key,n[r].key)){t[e].handle=r,n[r].node=e;break}t[e].handle=s,n[s].node=e,e=i}},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()},typeof module!="undefined"&&(module.exports=r),n("util/libtess",function(){}),n("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(e,t,n,i,s,o,u,a,f,l,c,h,p,d,v,m){"use strict";var g=function(n,r){if(!n)throw new t(a.logMessage(a.LEVEL_SEVERE,"Polygon","constructor","missingBoundaries"));e.call(this,r),n.length>0&&n[0].latitude&&(n=[n],this._boundariesSpecifiedSimply=!0),this._boundaries=n,this._textureCoordinates=null,this.referencePosition=this.determineReferencePosition(this._boundaries),this._extrude=!1,this.scratchPoint=new v(0,0,0)};return g.prototype=Object.create(e.prototype),Object.defineProperties(g.prototype,{boundaries:{get:function(){return this._boundariesSpecifiedSimply?this._boundaries[0]:this._boundaries},set:function(e){if(!e)throw new t(a.logMessage(a.LEVEL_SEVERE,"Polygon","boundaries","missingBoundaries"));e.length>0&&e[0].latitude&&(e=[e],this._boundariesSpecifiedSimply=!0),this._boundaries=e,this.referencePosition=this.determineReferencePosition(this._boundaries),this.reset()}},textureCoordinates:{get:function(){return this._textureCoordinates},set:function(e){this._textureCoordinates=e,this.reset()}},extrude:{get:function(){return this._extrude},set:function(e){this._extrude=e,this.reset()}}}),g.prototype.determineReferencePosition=function(e){return e.length>0&&e[0].length>2?e[0][0]:null},g.prototype.mustGenerateGeometry=function(e){return this.currentData.boundaryPoints?this.currentData.drawInterior!==this.activeAttributes.drawInterior?!0:this.altitudeMode===WorldWind.ABSOLUTE?!1:this.currentData.isExpired:!0},g.prototype.hasCapTexture=function(){return this.textureCoordinates&&this.capImageSource()},g.prototype.capImageSource=function(){return this.activeAttributes.imageSource?typeof this.activeAttributes.imageSource=="string"||this.activeAttributes.imageSource instanceof o?this.activeAttributes.imageSource:Array.isArray(this.activeAttributes.imageSource)&&this.activeAttributes.imageSource[0]&&(typeof this.activeAttributes.imageSource[0]=="string"||this.activeAttributes.imageSource instanceof o)?this.activeAttributes.imageSource[0]:null:null},g.prototype.hasSideTextures=function(){return this.activeAttributes.imageSource&&Array.isArray(this.activeAttributes.imageSource)&&this.activeAttributes.imageSource.length>1},g.prototype.sideImageSource=function(e){if(e===0||this.activeAttributes.imageSource.length===2)return this.activeAttributes.imageSource[1];var t=this.activeAttributes.imageSource.length-1;return e=Math.min(e+1,t),this.activeAttributes.imageSource[e]},g.prototype.createSurfaceShape=function(){return new p(this.boundaries,null)},g.prototype.doMakeOrderedRenderable=function(e){if(!this.referencePosition)return null;if(!this.activeAttributes.drawInterior&&!this.activeAttributes.drawOutline)return null;if(!this.mustGenerateGeometry(e))return this;var t=this.currentData,n=t.referencePoint;e.surfacePointForMode(this.referencePosition.latitude,this.referencePosition.longitude,this.referencePosition.altitude,this._altitudeMode,n),t.transformationMatrix.setToTranslation(n[0],n[1],n[2]);var r=[];for(var s=0;s0&&(s+=n[u]*t[u][i]);r[i]=s}return r}),this.polygonTessellator.gluTessCallback(r.gluEnum.GLU_TESS_ERROR,function(e){i=e,a.logMessage(a.LEVEL_WARNING,"Polygon","tessellatePolygon","Tessellation error "+e+".")})),f=v.computeBufferNormal(t[0],s),f||(f=new v(0,0,0),e.globe.surfaceNormalAtLocation(this.referencePosition.latitude,this.referencePosition.longitude,f)),this.polygonTessellator.gluTessNormal(f[0],f[1],f[2]),this.currentData.capNormal=f,this.polygonTessellator.gluTessBeginPolygon(n);for(var l=0;l0&&this.drawCap(e,n),this._extrude&&this.activeAttributes.drawInterior&&this.drawSides(e,n),this.activeAttributes.drawOutline&&this.drawOutline(e,n),t.refreshBuffers=!1;if(e.pickingMode){var r=new l(n,this.pickDelegate?this.pickDelegate:this,null,e.currentLayer,!1);e.resolvePick(r)}},g.prototype.drawCap=function(e,t){var n=e.currentGlContext,r=e.currentProgram,i=this.currentData,s=i.refreshBuffers,o=!!this.hasCapTexture(),u=this.activeAttributes.applyLighting,a=i.capTriangles.length/(o?5:3),f,l,c,h,p,d;r.loadTextureEnabled(n,!1),this.applyMvpMatrix(e),i.capVboCacheKey||(i.capVboCacheKey=e.gpuResourceCache.generateCacheKey()),f=e.gpuResourceCache.resourceForKey(i.capVboCacheKey),f||(f=n.createBuffer(),e.gpuResourceCache.putResource(i.capVboCacheKey,f,i.capTriangles.length*4),s=!0),n.bindBuffer(n.ARRAY_BUFFER,f),s&&(d=u?this.makeCapBufferWithNormals():i.capTriangles,n.bufferData(n.ARRAY_BUFFER,d,n.STATIC_DRAW),e.frameStatistics.incrementVboLoadCount(1)),c=this.activeAttributes.interiorColor,l=c.alpha*e.currentLayer.opacity,n.depthMask(l>=1||e.pickingMode),r.loadColor(n,e.pickingMode?t:c),r.loadOpacity(n,e.pickingMode?l>0?1:0:l),h=12+(o?8:0)+(u?12:0),o&&!e.pickingMode&&(this.activeTexture=e.gpuResourceCache.resourceForKey(this.capImageSource()),this.activeTexture||(this.activeTexture=e.gpuResourceCache.retrieveTexture(e.currentGlContext,this.capImageSource())),p=this.activeTexture&&this.activeTexture.bind(e),p&&(r.loadTextureEnabled(n,!0),n.enableVertexAttribArray(r.vertexTexCoordLocation),n.vertexAttribPointer(r.vertexTexCoordLocation,2,n.FLOAT,!1,h,12),r.loadTextureUnit(n,n.TEXTURE0),r.loadModulateColor(n,e.pickingMode))),u&&!e.pickingMode&&(r.loadApplyLighting(n,!0),n.enableVertexAttribArray(r.normalVectorLocation),n.vertexAttribPointer(r.normalVectorLocation,3,n.FLOAT,!1,h,h-12)),n.vertexAttribPointer(r.vertexPointLocation,3,n.FLOAT,!1,h,0),n.drawArrays(n.TRIANGLES,0,a)},g.prototype.makeCapBufferWithNormals=function(){var e=this.currentData,t=e.capNormal,n=this.hasCapTexture()?5:3,r=n+3,i=e.capTriangles.length/n,s=e.capTriangles,o=new Float32Array(i*r),u=0;for(var a=0;a=1||e.pickingMode),r.loadColor(n,e.pickingMode?t:h),r.loadOpacity(n,e.pickingMode?c>0?1:0:c);if(o&&!e.pickingMode){this.activeTexture=e.gpuResourceCache.resourceForKey(this.capImageSource()),this.activeTexture||(this.activeTexture=e.gpuResourceCache.retrieveTexture(e.currentGlContext,this.capImageSource())),u?(r.loadApplyLighting(n,!0),n.enableVertexAttribArray(r.normalVectorLocation)):r.loadApplyLighting(n,!1);for(var g=0;g=1||e.pickingMode),r.loadColor(n,e.pickingMode?t:f),r.loadOpacity(n,e.pickingMode?1:a),n.lineWidth(this.activeAttributes.outlineWidth),this._extrude?(l=24,c=o/2):(l=12,c=o),n.vertexAttribPointer(r.vertexPointLocation,3,n.FLOAT,!1,l,0),n.drawArrays(n.LINE_STRIP,0,c),this.mustDrawVerticals(e)&&(n.vertexAttribPointer(r.vertexPointLocation,3,n.FLOAT,!1,0,0),n.drawArrays(n.LINES,0,o-2))},g.prototype.beginDrawing=function(e){var t=e.currentGlContext;this.activeAttributes.drawInterior&&t.disable(t.CULL_FACE),e.findAndBindProgram(n),t.enableVertexAttribArray(e.currentProgram.vertexPointLocation);var r=!e.pickMode&&this.activeAttributes.applyLighting;r&&e.currentProgram.loadModelviewInverse(t,e.navigatorState.modelviewNormalTransform)},g.prototype.endDrawing=function(e){var t=e.currentGlContext;t.disableVertexAttribArray(e.currentProgram.vertexPointLocation),t.disableVertexAttribArray(e.currentProgram.normalVectorLocation),t.depthMask(!0),t.lineWidth(1),t.enable(t.CULL_FACE)},g}),n("shapes/SurfacePolyline",["../error/ArgumentError","../util/Logger","../shapes/ShapeAttributes","../shapes/SurfaceShape"],function(e,t,n,r){"use strict";var i=function(n,i){if(!n)throw new e(t.logMessage(t.LEVEL_SEVERE,"SurfacePolyline","constructor","The specified locations array is null or undefined."));r.call(this,i),this._boundaries=n,this._isInteriorInhibited=!0};return i.prototype=Object.create(r.prototype),i.staticStateKey=function(e){var t=r.staticStateKey(e);return t},i.prototype.computeStateKey=function(){return i.staticStateKey(this)},i}),n("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(e,t,n,r,i,s,o,u,a,f,l,c,h,p,d,v,m,g,y,b,w,E,S,x,T){"use strict";var N=function(t){if(!t)throw new e(v.logMessage(v.LEVEL_SEVERE,"GeoJSON","constructor","missingDataSource"));this._dataSource=t,this._geoJSONObject=null,this._geoJSONType=null,this._crs=null,this._layer=null,this._parserCompletionCallback=null,this._shapeConfigurationCallback=this.defaultShapeConfigurationCallback,this.defaultPlacemarkAttributes=new g(null),this.defaultShapeAttributes=new S(null),this.setProj4jsAliases()};return Object.defineProperties(N.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}}}),N.prototype.load=function(e,t,n){e&&(this._parserCompletionCallback=e),t&&(this._shapeConfigurationCallback=t),this._layer=n||new E,this.isDataSourceJson()?this.parse(this.dataSource):this.requestUrl(this.dataSource)},N.prototype.defaultShapeConfigurationCallback=function(e,t){var n={},r=t.name||t.Name||t.NAME;r&&(n.name=r);if(e.isPointType()||e.isMultiPointType())n.attributes=this.defaultPlacemarkAttributes;else if(e.isLineStringType()||e.isMultiLineStringType())n.attributes=this.defaultShapeAttributes;else if(e.isPolygonType()||e.isMultiPolygonType())n.attributes=this.defaultShapeAttributes;return n},N.prototype.requestUrl=function(e){var t=new XMLHttpRequest;t.open("GET",e,!0),t.responseType="text",t.onreadystatechange=function(){t.readyState===4&&(t.status===200?this.parse(t.response):v.log(v.LEVEL_WARNING,"GeoJSON retrieval failed ("+t.statusText+"): "+e))}.bind(this),t.onerror=function(){v.log(v.LEVEL_WARNING,"GeoJSON retrieval failed: "+e)},t.ontimeout=function(){v.log(v.LEVEL_WARNING,"GeoJSON retrieval timed out: "+e)},t.send(null)},N.prototype.parse=function(t){try{this._geoJSONObject=JSON.parse(t)}catch(r){v.logMessage(v.LEVEL_SEVERE,"GeoJSON","parse","invalidGeoJSONObject")}finally{if(this.geoJSONObject){if(Object.prototype.toString.call(this.geoJSONObject)==="[object Array]")throw new e(v.logMessage(v.LEVEL_SEVERE,"GeoJSON","parse","invalidGeoJSONObjectLength"));if(!this.geoJSONObject.hasOwnProperty(n.FIELD_TYPE))throw new e(v.logMessage(v.LEVEL_SEVERE,"GeoJSON","parse","missingGeoJSONType"));this.setGeoJSONType(),this.setGeoJSONCRS(),!!this._parserCompletionCallback&&typeof this._parserCompletionCallback=="function"&&this._parserCompletionCallback(this.layer)}}},N.prototype.setGeoJSONCRS=function(){if(this.geoJSONObject[n.FIELD_CRS]){this._crs=new r(this.geoJSONObject[n.FIELD_CRS][n.FIELD_TYPE],this.geoJSONObject[n.FIELD_CRS][n.FIELD_PROPERTIES]);var e=function(){this.addRenderablesForGeoJSON(this.layer)}.bind(this);this.crs.setCRSString(e)}else this.addRenderablesForGeoJSON(this.layer)},N.prototype.addRenderablesForGeoJSON=function(t){if(!t)throw new e(v.logMessage(v.LEVEL_SEVERE,"GeoJSON","addRenderablesForGeoJSON","missingLayer"));switch(this.geoJSONType){case n.TYPE_FEATURE:var r=new i(this.geoJSONObject[n.FIELD_GEOMETRY],this.geoJSONObject[n.FIELD_PROPERTIES],this.geoJSONObject[n.FIELD_ID],this.geoJSONObject[n.FIELD_BBOX]);this.addRenderablesForFeature(t,r);break;case n.TYPE_FEATURE_COLLECTION:var o=new s(this.geoJSONObject[n.FIELD_FEATURES],this.geoJSONObject[n.FIELD_BBOX]);this.addRenderablesForFeatureCollection(t,o);break;case n.TYPE_GEOMETRY_COLLECTION:var a=new u(this.geoJSONObject[n.FIELD_GEOMETRIES],this.geoJSONObject[n.FIELD_BBOX]);this.addRenderablesForGeometryCollection(t,a,null);break;default:this.addRenderablesForGeometry(t,this.geoJSONObject,null)}},N.prototype.addRenderablesForGeometry=function(t,r,i){if(!t)throw new e(v.logMessage(v.LEVEL_SEVERE,"GeoJSON","addRenderablesForGeometry","missingLayer"));if(!r)throw new e(v.logMessage(v.LEVEL_SEVERE,"GeoJSON","addRenderablesForGeometry","missingGeometry"));switch(r[n.FIELD_TYPE]){case n.TYPE_POINT:var s=new h(r[n.FIELD_COORDINATES],r[n.FIELD_TYPE],r[n.FIELD_BBOX]);this.addRenderablesForPoint(t,s,i?i:null);break;case n.TYPE_MULTI_POINT:var o=new l(r[n.FIELD_COORDINATES],r[n.FIELD_TYPE],r[n.FIELD_BBOX]);this.addRenderablesForMultiPoint(t,o,i?i:null);break;case n.TYPE_LINE_STRING:var u=new a(r[n.FIELD_COORDINATES],r[n.FIELD_TYPE],r[n.FIELD_BBOX]);this.addRenderablesForLineString(t,u,i?i:null);break;case n.TYPE_MULTI_LINE_STRING:var d=new f(r[n.FIELD_COORDINATES],r[n.FIELD_TYPE],r[n.FIELD_BBOX]);this.addRenderablesForMultiLineString(t,d,i?i:null);break;case n.TYPE_POLYGON:var m=new p(r[n.FIELD_COORDINATES],r[n.FIELD_TYPE],r[n.FIELD_BBOX]);this.addRenderablesForPolygon(t,m,i?i:null);break;case n.TYPE_MULTI_POLYGON:var g=new c(r[n.FIELD_COORDINATES],r[n.FIELD_TYPE],r[n.FIELD_BBOX]);this.addRenderablesForMultiPolygon(t,g,i?i:null);break;default:}},N.prototype.addRenderablesForPoint=function(t,n,r){if(!t)throw new e(v.logMessage(v.LEVEL_SEVERE,"GeoJSON","addRenderablesForPoint","missingLayer"));if(!n)throw new e(v.logMessage(v.LEVEL_SEVERE,"GeoJSON","addRenderablesForPoint","missingGeometry"));var i=this.shapeConfigurationCallback(n,r);if(!this.crs||this.crs.isCRSSupported()){var s=n.coordinates[0],o=n.coordinates[1],u=n.coordinates[2]?n.coordinates[2]:0,a=this.getReprojectedIfRequired(o,s,this.crs),f=new b(a[1],a[0],u),l=new m(f,!1,i&&i.attributes?i.attributes:null);l.altitudeMode=WorldWind.RELATIVE_TO_GROUND,i&&i.name&&(l.label=i.name),i.highlightAttributes&&(l.highlightAttributes=i.highlightAttributes),i&&i.pickDelegate&&(l.pickDelegate=i.pickDelegate),i&&i.userProperties&&(l.userProperties=i.userProperties),t.addRenderable(l)}},N.prototype.addRenderablesForMultiPoint=function(t,n,r){if(!t)throw new e(v.logMessage(v.LEVEL_SEVERE,"GeoJSON","addRenderablesForMultiPoint","missingLayer"));if(!n)throw new e(v.logMessage(v.LEVEL_SEVERE,"GeoJSON","addRenderablesForMultiPoint","missingGeometry"));var i=this.shapeConfigurationCallback(n,r);if(!this.crs||this.crs.isCRSSupported())for(var s=0,o=n.coordinates.length;s0)for(var s=0;s>>8:n.getUint32(r,s)>>>8;if(i<=4)return o?n.getInt32(r,s):n.getUint32(r,s);if(i<=8)return n.getFloat64(r,s);throw new e(t.logMessage(t.LEVEL_SEVERE,"GeoTiffReader","getBytes","tooManyBytesRequested"))},getSampleBytes:function(e,r,i,s,o){var u;switch(s){case n.SampleFormat.UNSIGNED:u=this.getBytes(e,r,i,o,!1);break;case n.SampleFormat.SIGNED:u=this.getBytes(e,r,i,o,!0);break;case n.SampleFormat.IEEE_FLOAT:i==3?u=e.getFloat32(r,o)>>>8:i==4?u=e.getFloat32(r,o):i==8?u=e.getFloat64(r,o):t.log(t.LEVEL_WARNING,"Do not attempt to parse the data not handled: "+i);break;case n.SampleFormat.UNDEFINED:default:u=this.getBytes(e,r,i,o,!1)}return u},canvasToTiffImage:function(e){var t=new Image;return t.src=e.toDataURL(),t},getRGBAFillValue:function(e,t,n,r){return typeof r=="undefined"&&(r=1),"rgba("+e+", "+t+", "+n+", "+r+")"},getTagValueAsString:function(e,t){for(var n in e)if(e[n]===t)return n;return undefined},clampColorSample:function(e,t){var n=Math.pow(2,8-t);return Math.floor(e*n+(n-1))},clampColorSampleForElevation:function(e,t,n){var r=255/(n-t);return Math.round(r*(e-t))},getMinMaxGeotiffSamples:function(e,t){var n=Infinity,r=-Infinity;for(var i=0;ir&&(r=e[i][s][o]),e[i][s][o]>>(4-o)*8:s=this.valueOffset,t.push(s);else for(var a=0;a=8)if(this.type===i.Type.RATIONAL||this.type===i.Type.SRATIONAL)t.push(n.getBytes(this.geoTiffData,this.valueOffset+f,4,this.isLittleEndian)),t.push(n.getBytes(this.geoTiffData,this.valueOffset+f+4,4,this.isLittleEndian));else{if(this.type!==i.Type.DOUBLE)throw new e(r.logMessage(r.LEVEL_SEVERE,"TiffIFDEntry","parse","invalidTypeOfIFD"));t.push(n.getBytes(this.geoTiffData,this.valueOffset+f,8,this.isLittleEndian))}else t.push(n.getBytes(this.geoTiffData,this.valueOffset+f,o,this.isLittleEndian))}return this.type===i.Type.ASCII?(t.forEach(function(e,t,n){e===0?n.splice(t,1):n[t]=String.fromCharCode(e)}),t.join("")):t},s}),n("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(e,t,n,r,i,s,o,u,a,f,l,c,h){"use strict";var p=function(e){if(!e)throw new t(a.logMessage(a.LEVEL_SEVERE,"GeoTiffReader","constructor","missingUrl"));this._url=e,this._isLittleEndian=!1,this._imageFileDirectories=[],this._geoTiffData=null,this._metadata=new i};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(e,t){var n=new XMLHttpRequest;n.open("GET",e,!0),n.responseType="arraybuffer",n.onreadystatechange=function(){if(n.readyState===4)if(n.status===200){var r=n.response;r&&(this.parse(r),t())}else a.log(a.LEVEL_WARNING,"GeoTiff retrieval failed ("+n.statusText+"): "+e)}.bind(this),n.onerror=function(){a.log(a.LEVEL_WARNING,"GeoTiff retrieval failed: "+e)},n.ontimeout=function(){a.log(a.LEVEL_WARNING,"GeoTiff retrieval timed out: "+e)},n.send(null)},p.prototype.parse=function(t){this._geoTiffData=new DataView(t),this.getEndianness();if(!this.isTiffFileType())throw new e(a.logMessage(a.LEVEL_SEVERE,"GeoTiffReader","parse","invalidTiffFileType"));var n=s.getBytes(this.geoTiffData,4,4,this.isLittleEndian);this.parseImageFileDirectory(n),this.getMetadataFromImageFileDirectory(),this.parseGeoKeys(),this.setBBox()},p.prototype.getEndianness=function(){var t=s.getBytes(this.geoTiffData,0,2,this.isLittleEndian);if(t===18761)this._isLittleEndian=!0;else{if(t!==19789)throw new e(a.logMessage(a.LEVEL_SEVERE,"GeoTiffReader","getEndianness","invalidByteOrderValue"));this._isLittleEndian=!1}},p.prototype.isTiffFileType=function(){var e=s.getBytes(this.geoTiffData,2,2,this.isLittleEndian);return e===42?!0:!1},p.prototype.isGeoTiff=function(){return this.getIFDByTag(n.Tag.GEO_KEY_DIRECTORY)?!0:!1},p.prototype.readAsImage=function(e){this.requestUrl(this.url,function(){var t=this.metadata.bitsPerSample,n=this.metadata.samplesPerPixel,r=this.metadata.photometricInterpretation,i=this.metadata.imageLength,s=this.metadata.imageWidth;if(this.metadata.colorMap)var o=this.metadata.colorMap,u=Math.pow(2,t[0]);var a=document.createElement("canvas");a.width=s,a.height=i;var f=a.getContext("2d");if(this.metadata.stripOffsets){var l=this.parseStrips(!1);if(this.metadata.rowsPerStrip)var c=this.metadata.rowsPerStrip;else var c=i;var h=l.length,p=0,d=c,v=i%c,m=v===0?c:v;for(var g=0;g=0&&k<=127?T=k+1:k>=-127&&k<=-1?N=-k+1:x=!0}else{var L=s.getBytes(this.geoTiffData,i+c,1,this.isLittleEndian);for(var A=0;A6&&c===0))if(h===16){var p=e,d=n;e=p*u[0]+d*u[1]+u[3],n=p*u[4]+d*u[5]+u[7],r=[e,n]}else c<3||l<6?r=[e,n]:(e=(e-i[0])*s[0]+i[3],n=(n-i[1])*-1*s[1]+i[4],r=[e,n]);return f.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=f("EPSG:"+this.metadata.projectedCSType,"EPSG:4326",r)),new o(r[1],r[0])},p.prototype.setBBox=function(){var e=this.geoTiffImageToPCS(0,0),t=this.geoTiffImageToPCS(this.metadata.imageWidth,0),n=this.geoTiffImageToPCS(0,this.metadata.imageLength),r=this.geoTiffImageToPCS(this.metadata.imageWidth,this.metadata.imageLength);this.metadata.bbox=new u(n.latitude,e.latitude,e.longitude,t.longitude)},p.prototype.getMetadataFromImageFileDirectory=function(){for(var e=0;e1?o-1:1),y=(m-v)/(u>1?u-1:1),b=f?f:new i(0,0,0),w=l?l[0]:0,E,S,x=0,T=0,N,C,k;for(E=0,N=p;Ethis.startPosition.altitude?(a=Math.max(0,this.maxAltitude-this.startPosition.altitude),a+=Math.abs(this.targetPosition.altitude-this.maxAltitude)):a=Math.abs(this.targetPosition.altitude-this.startPosition.altitude);var h=Math.max(u,a/this.wwd.globe.equatorialRadius);if(h===0)return;h<2*c&&(o=Math.min(h/c*this.travelTime,this.travelTime)),o=Math.max(1,o),this.panVelocity=u/o,this.rangeVelocity=a/o;var p=this,d=function(){if(p.cancelled){p.completionCallback&&p.completionCallback(p);return}p.update()?setTimeout(d,p.animationFrequency):p.completionCallback&&p.completionCallback(p)};setTimeout(d,this.animationFrequency)},i.prototype.update=function(){var e=new n(this.wwd.navigator.lookAtLocation.latitude,this.wwd.navigator.lookAtLocation.longitude,this.wwd.navigator.range),t=this.updateRange(e);return t=this.updateLocation(e)||t,this.wwd.redraw(),t},i.prototype.updateRange=function(e){var t=!1,n,r;return this.maxAltitudeReachedTime?(r=Date.now()-this.maxAltitudeReachedTime,this.maxAltitude>this.targetPosition.altitude?(n=this.maxAltitude-this.rangeVelocity*r,n=Math.max(n,this.targetPosition.altitude)):(n=this.maxAltitude+this.rangeVelocity*r,n=Math.min(n,this.targetPosition.altitude)),this.wwd.navigator.range=n,t=Math.abs(this.wwd.navigator.range-this.targetPosition.altitude)>1):(r=Date.now()-this.startTime,n=Math.min(this.startPosition.altitude+this.rangeVelocity*r,this.maxAltitude),Math.abs(this.wwd.navigator.range-n)<1&&(this.maxAltitudeReachedTime=Date.now()),this.wwd.navigator.range=n,t=!0),t},i.prototype.updateLocation=function(t){var n=Date.now()-this.startTime,r=e.greatCircleDistance(this.startPosition,t),i=e.greatCircleDistance(t,this.targetPosition),s=e.greatCircleAzimuth(t,this.targetPosition),o=this.panVelocity*n,u=Math.min(o-r,i),a=e.greatCircleLocation(t,s,u,new e(0,0)),f=!1;return this.wwd.navigator.lookAtLocation.latitude=a.latitude,this.wwd.navigator.lookAtLocation.longitude=a.longitude,u<1/this.wwd.globe.equatorialRadius&&(f=!0),!f},i}),n("util/HighlightController",["../error/ArgumentError","../util/Logger"],function(e,t){"use strict";var n=function(n){if(!n)throw new e(t.logMessage(t.LEVEL_SEVERE,"HighlightController","constructor","missingWorldWindow"));this.worldWindow=n;var r=[],i=function(e){var t=e.clientX,i=e.clientY,s=r.length>0;for(var o=0;o0&&(s=!0);if(u.objects.length>0)for(var a=0;a>2,a=(i&3)<<4|s>>4,f=(s&15)<<2|o>>6,l=o&63,isNaN(s)?f=l=64:isNaN(o)&&(l=64),n=n+r.charAt(u)+r.charAt(a)+r.charAt(f)+r.charAt(l);return n},n.decode=function(e,t){var n="",i,s,o,u,a,f,l,c=0;e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");while(c>4,s=(a&15)<<4|f>>2,o=(f&3)<<6|l,n+=String.fromCharCode(i),f!=64&&(n+=String.fromCharCode(s)),l!=64&&(n+=String.fromCharCode(o));return n}},{}],2:[function(e,t,n){"use strict";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},{}],3:[function(e,t,n){"use strict";n.STORE={magic:"\0\0",compress:function(e,t){return e},uncompress:function(e){return e},compressInputType:null,uncompressInputType:null},n.DEFLATE=e("./flate")},{"./flate":8}],4:[function(e,t,n){"use strict";var r=e("./utils"),i=[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,n){if(typeof t=="undefined"||!t.length)return 0;var s=r.getTypeOf(t)!=="string";typeof n=="undefined"&&(n=0);var o=0,u=0,a=0;n^=-1;for(var f=0,l=t.length;f>>8^o;return n^-1}},{"./utils":21}],5:[function(e,t,n){"use strict";function i(e){this.data=null,this.length=0,this.index=0}var r=e("./utils");i.prototype={checkOffset:function(e){this.checkIndex(this.index+e)},checkIndex:function(e){if(this.length=this.index;n--)t=(t<<8)+this.byteAt(n);return this.index+=e,t},readString:function(e){return r.transformTo("string",this.readData(e))},readData:function(e){},lastIndexOfSignature:function(e){},readDate:function(){var e=this.readInt(4);return new Date((e>>25&127)+1980,(e>>21&15)-1,e>>16&31,e>>11&31,e>>5&63,(e&31)<<1)}},t.exports=i},{"./utils":21}],6:[function(e,t,n){"use strict";n.base64=!1,n.binary=!1,n.dir=!1,n.createFolders=!1,n.date=null,n.compression=null,n.compressionOptions=null,n.comment=null,n.unixPermissions=null,n.dosPermissions=null},{}],7:[function(e,t,n){"use strict";var r=e("./utils");n.string2binary=function(e){return r.string2binary(e)},n.string2Uint8Array=function(e){return r.transformTo("uint8array",e)},n.uint8Array2String=function(e){return r.transformTo("string",e)},n.string2Blob=function(e){var t=r.transformTo("arraybuffer",e);return r.arrayBuffer2Blob(t)},n.arrayBuffer2Blob=function(e){return r.arrayBuffer2Blob(e)},n.transformTo=function(e,t){return r.transformTo(e,t)},n.getTypeOf=function(e){return r.getTypeOf(e)},n.checkSupport=function(e){return r.checkSupport(e)},n.MAX_VALUE_16BITS=r.MAX_VALUE_16BITS,n.MAX_VALUE_32BITS=r.MAX_VALUE_32BITS,n.pretty=function(e){return r.pretty(e)},n.findCompression=function(e){return r.findCompression(e)},n.isRegExp=function(e){return r.isRegExp(e)}},{"./utils":21}],8:[function(e,t,n){"use strict";var r=typeof Uint8Array!="undefined"&&typeof Uint16Array!="undefined"&&typeof Uint32Array!="undefined",i=e("pako");n.uncompressInputType=r?"uint8array":"array",n.compressInputType=r?"uint8array":"array",n.magic="\b\0",n.compress=function(e,t){return i.deflateRaw(e,{level:t.level||-1})},n.uncompress=function(e){return i.inflateRaw(e)}},{pako:24}],9:[function(e,t,n){"use strict";function i(e,t){if(!(this instanceof i))return new i(e,t);this.files={},this.comment=null,this.root="",e&&this.load(e,t),this.clone=function(){var e=new i;for(var t in this)typeof this[t]!="function"&&(e[t]=this[t]);return e}}var r=e("./base64");i.prototype=e("./object"),i.prototype.load=e("./load"),i.support=e("./support"),i.defaults=e("./defaults"),i.utils=e("./deprecatedPublicUtils"),i.base64={encode:function(e){return r.encode(e)},decode:function(e){return r.decode(e)}},i.compressions=e("./compressions"),t.exports=i},{"./base64":1,"./compressions":3,"./defaults":6,"./deprecatedPublicUtils":7,"./load":10,"./object":13,"./support":17}],10:[function(e,t,n){"use strict";var r=e("./base64"),i=e("./zipEntries");t.exports=function(e,t){var n,s,o,u;t=t||{},t.base64&&(e=r.decode(e)),s=new i(e,t),n=s.files;for(o=0;o>>=8;return n},w=function(){var e={},t,n;for(t=0;t0?e.substring(0,t):""},T=function(e){return e.slice(-1)!="/"&&(e+="/"),e},N=function(e,t){return t=typeof t!="undefined"?t:!1,e=T(e),this.files[e]||S.call(this,e,null,{dir:!0,createFolders:t}),this.files[e]},C=function(e,t,n){var r=new l,o;if(e._data instanceof l)r.uncompressedSize=e._data.uncompressedSize,r.crc32=e._data.crc32,r.uncompressedSize===0||e.dir?(t=f.STORE,r.compressedContent="",r.crc32=0):e._data.compressionMethod===t.magic?r.compressedContent=e._data.getCompressedContent():(o=e._data.getContent(),r.compressedContent=t.compress(i.transformTo(t.compressInputType,o),n));else{o=m(e);if(!o||o.length===0||e.dir)t=f.STORE,o="";r.uncompressedSize=o.length,r.crc32=s(o),r.compressedContent=t.compress(i.transformTo(t.compressInputType,o),n)}return r.compressedSize=r.compressedContent.length,r.compressionMethod=t.magic,r},k=function(e,t){var n=e;return e||(n=t?16893:33204),(n&65535)<<16},L=function(e,t){return(e||0)&63},A=function(e,t,n,r,u){var a=n.compressedContent,f=i.transformTo("string",h.utf8encode(t.name)),l=t.comment||"",c=i.transformTo("string",h.utf8encode(l)),p=f.length!==t.name.length,d=c.length!==l.length,v=t.options,m,g,y="",w="",E="",S,x;t._initialMetadata.dir!==t.dir?S=t.dir:S=v.dir,t._initialMetadata.date!==t.date?x=t.date:x=v.date;var T=0,N=0;S&&(T|=16),u==="UNIX"?(N=798,T|=k(t.unixPermissions,S)):(N=20,T|=L(t.dosPermissions,S)),m=x.getHours(),m<<=6,m|=x.getMinutes(),m<<=5,m|=x.getSeconds()/2,g=x.getFullYear()-1980,g<<=4,g|=x.getMonth()+1,g<<=5,g|=x.getDate(),p&&(w=b(1,1)+b(s(f),4)+f,y+="up"+b(w.length,2)+w),d&&(E=b(1,1)+b(this.crc32(c),4)+c,y+="uc"+b(E.length,2)+E);var C="";C+="\n\0",C+=p||d?"\0\b":"\0\0",C+=n.compressionMethod,C+=b(m,2),C+=b(g,2),C+=b(n.crc32,4),C+=b(n.compressedSize,4),C+=b(n.uncompressedSize,4),C+=b(f.length,2),C+=b(y.length,2);var A=o.LOCAL_FILE_HEADER+C+f+y,O=o.CENTRAL_FILE_HEADER+b(N,2)+C+b(c.length,2)+"\0\0"+"\0\0"+b(T,4)+b(r,4)+f+y+c;return{fileRecord:A,dirRecord:O,compressedObject:n}},O={load:function(e,t){throw new Error("Load method is not defined. Is the file jszip-load.js included ?")},filter:function(e){var t=[],n,r,i,s;for(n in this.files){if(!this.files.hasOwnProperty(n))continue;i=this.files[n],s=new y(i.name,i._data,w(i.options)),r=n.slice(this.root.length,n.length),n.slice(0,this.root.length)===this.root&&e(r,s)&&t.push(s)}return t},file:function(e,t,n){if(arguments.length===1){if(i.isRegExp(e)){var r=e;return this.filter(function(e,t){return!t.dir&&r.test(e)})}return this.filter(function(t,n){return!n.dir&&t===e})[0]||null}return e=this.root+e,S.call(this,e,t,n),this},folder:function(e){if(!e)return this;if(i.isRegExp(e))return this.filter(function(t,n){return n.dir&&e.test(t)});var t=this.root+e,n=N.call(this,t),r=this.clone();return r.root=n.name,r},remove:function(e){e=this.root+e;var t=this.files[e];t||(e.slice(-1)!="/"&&(e+="/"),t=this.files[e]);if(t&&!t.dir)delete this.files[e];else{var n=this.filter(function(t,n){return n.name.slice(0,e.length)===e});for(var r=0;r=0;--s)if(this.data[s]===t&&this.data[s+1]===n&&this.data[s+2]===r&&this.data[s+3]===i)return s;return-1},i.prototype.readData=function(e){this.checkOffset(e);if(e===0)return new Uint8Array(0);var t=this.data.subarray(this.index,this.index+e);return this.index+=e,t},t.exports=i},{"./dataReader":5}],19:[function(e,t,n){"use strict";var r=e("./utils"),i=function(e){this.data=new Uint8Array(e),this.index=0};i.prototype={append:function(e){e.length!==0&&(e=r.transformTo("uint8array",e),this.data.set(e,this.index),this.index+=e.length)},finalize:function(){return this.data}},t.exports=i},{"./utils":21}],20:[function(e,t,n){"use strict";var r=e("./utils"),i=e("./support"),s=e("./nodeBuffer"),o=new Array(256);for(var u=0;u<256;u++)o[u]=u>=252?6:u>=248?5:u>=240?4:u>=224?3:u>=192?2:1;o[254]=o[254]=1;var a=function(e){var t,n,r,s,o,u=e.length,a=0;for(s=0;s>>6,t[o++]=128|n&63):n<65536?(t[o++]=224|n>>>12,t[o++]=128|n>>>6&63,t[o++]=128|n&63):(t[o++]=240|n>>>18,t[o++]=128|n>>>12&63,t[o++]=128|n>>>6&63,t[o++]=128|n&63);return t},f=function(e,t){var n;t=t||e.length,t>e.length&&(t=e.length),n=t-1;while(n>=0&&(e[n]&192)===128)n--;return n<0?t:n===0?t:n+o[e[n]]>t?n:t},l=function(e){var t,n,i,s,u,a=e.length,f=new Array(a*2);for(i=0,n=0;n4){f[i++]=65533,n+=u-1;continue}s&=u===2?31:u===3?15:7;while(u>1&&n1){f[i++]=65533;continue}s<65536?f[i++]=s:(s-=65536,f[i++]=55296|s>>10&1023,f[i++]=56320|s&1023)}return f.length!==i&&(f.subarray?f=f.subarray(0,i):f.length=i),r.applyFromCharCode(f)};n.utf8encode=function(t){return i.nodebuffer?s(t,"utf-8"):a(t)},n.utf8decode=function(t){if(i.nodebuffer)return r.transformTo("nodebuffer",t).toString("utf-8");t=r.transformTo(i.uint8array?"uint8array":"array",t);var n=[],s=0,o=t.length,u=65536;while(s1)try{o==="array"||o==="nodebuffer"?r.push(String.fromCharCode.apply(null,e.slice(u,Math.min(u+t,i)))):r.push(String.fromCharCode.apply(null,e.subarray(u,Math.min(u+t,i)))),u+=t}catch(f){t=Math.floor(t/2)}return r.join("")}function f(e,t){for(var n=0;n1)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var e,t;for(e=0;e>8;this.dir=this.externalFileAttributes&16?!0:!1,e===u&&(this.dosPermissions=this.externalFileAttributes&63),e===a&&(this.unixPermissions=this.externalFileAttributes>>16&65535),!this.dir&&this.fileName.slice(-1)==="/"&&(this.dir=!0)},parseZIP64ExtraField:function(e){if(!this.extraFields[1])return;var t=new r(this.extraFields[1].value);this.uncompressedSize===i.MAX_VALUE_32BITS&&(this.uncompressedSize=t.readInt(8)),this.compressedSize===i.MAX_VALUE_32BITS&&(this.compressedSize=t.readInt(8)),this.localHeaderOffset===i.MAX_VALUE_32BITS&&(this.localHeaderOffset=t.readInt(8)),this.diskNumberStart===i.MAX_VALUE_32BITS&&(this.diskNumberStart=t.readInt(4))},readExtraFields:function(e){var t=e.index,n,r,i;this.extraFields=this.extraFields||{};while(e.index0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new u,this.strm.avail_out=0;var n=r.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(n!==l)throw new Error(o[n]);t.header&&r.deflateSetHeader(this.strm,t.header)};v.prototype.push=function(e,t){var n=this.strm,o=this.options.chunkSize,u,h;if(this.ended)return!1;h=t===~~t?t:t===!0?f:a,typeof e=="string"?n.input=s.string2buf(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;do{n.avail_out===0&&(n.output=new i.Buf8(o),n.next_out=0,n.avail_out=o),u=r.deflate(n,h);if(u!==c&&u!==l)return this.onEnd(u),this.ended=!0,!1;if(n.avail_out===0||n.avail_in===0&&h===f)this.options.to==="string"?this.onData(s.buf2binstring(i.shrinkBuf(n.output,n.next_out))):this.onData(i.shrinkBuf(n.output,n.next_out))}while((n.avail_in>0||n.avail_out===0)&&u!==c);return h===f?(u=r.deflateEnd(this.strm),this.onEnd(u),this.ended=!0,u===l):!0},v.prototype.onData=function(e){this.chunks.push(e)},v.prototype.onEnd=function(e){e===l&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},n.Deflate=v,n.deflate=m,n.deflateRaw=g,n.gzip=y},{"./utils/common":27,"./utils/strings":28,"./zlib/deflate.js":32,"./zlib/messages":37,"./zlib/zstream":39}],26:[function(e,t,n){"use strict";function c(e,t){var n=new l(t);n.push(e,!0);if(n.err)throw n.msg;return n.result}function h(e,t){return t=t||{},t.raw=!0,c(e,t)}var r=e("./zlib/inflate.js"),i=e("./utils/common"),s=e("./utils/strings"),o=e("./zlib/constants"),u=e("./zlib/messages"),a=e("./zlib/zstream"),f=e("./zlib/gzheader"),l=function(e){this.options=i.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,t.windowBits===0&&(t.windowBits=-15)),t.windowBits>=0&&t.windowBits<16&&(!e||!e.windowBits)&&(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(t.windowBits&15)===0&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new a,this.strm.avail_out=0;var n=r.inflateInit2(this.strm,t.windowBits);if(n!==o.Z_OK)throw new Error(u[n]);this.header=new f,r.inflateGetHeader(this.strm,this.header)};l.prototype.push=function(e,t){var n=this.strm,u=this.options.chunkSize,a,f,l,c,h;if(this.ended)return!1;f=t===~~t?t:t===!0?o.Z_FINISH:o.Z_NO_FLUSH,typeof e=="string"?n.input=s.binstring2buf(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;do{n.avail_out===0&&(n.output=new i.Buf8(u),n.next_out=0,n.avail_out=u),a=r.inflate(n,o.Z_NO_FLUSH);if(a!==o.Z_STREAM_END&&a!==o.Z_OK)return this.onEnd(a),this.ended=!0,!1;n.next_out&&(n.avail_out===0||a===o.Z_STREAM_END||n.avail_in===0&&f===o.Z_FINISH)&&(this.options.to==="string"?(l=s.utf8border(n.output,n.next_out),c=n.next_out-l,h=s.buf2string(n.output,l),n.next_out=c,n.avail_out=u-c,c&&i.arraySet(n.output,n.output,l,c,0),this.onData(h)):this.onData(i.shrinkBuf(n.output,n.next_out)))}while(n.avail_in>0&&a!==o.Z_STREAM_END);return a===o.Z_STREAM_END&&(f=o.Z_FINISH),f===o.Z_FINISH?(a=r.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,a===o.Z_OK):!0},l.prototype.onData=function(e){this.chunks.push(e)},l.prototype.onEnd=function(e){e===o.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},n.Inflate=l,n.inflate=c,n.inflateRaw=h,n.ungzip=c},{"./utils/common":27,"./utils/strings":28,"./zlib/constants":30,"./zlib/gzheader":33,"./zlib/inflate.js":35,"./zlib/messages":37,"./zlib/zstream":39}],27:[function(e,t,n){"use strict";var r=typeof Uint8Array!="undefined"&&typeof Uint16Array!="undefined"&&typeof Int32Array!="undefined";n.assign=function(e){var t=Array.prototype.slice.call(arguments,1);while(t.length){var n=t.shift();if(!n)continue;if(typeof n!="object")throw new TypeError(n+"must be non-object");for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e},n.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var i={arraySet:function(e,t,n,r,i){if(t.subarray&&e.subarray){e.set(t.subarray(n,n+r),i);return}for(var s=0;s=252?6:a>=248?5:a>=240?4:a>=224?3:a>=192?2:1;u[254]=u[254]=1,n.string2buf=function(e){var t,n,i,s,o,u=e.length,a=0;for(s=0;s>>6,t[o++]=128|n&63):n<65536?(t[o++]=224|n>>>12,t[o++]=128|n>>>6&63,t[o++]=128|n&63):(t[o++]=240|n>>>18,t[o++]=128|n>>>12&63,t[o++]=128|n>>>6&63,t[o++]=128|n&63);return t},n.buf2binstring=function(e){return f(e,e.length)},n.binstring2buf=function(e){var t=new r.Buf8(e.length);for(var n=0,i=t.length;n4){a[r++]=65533,n+=s-1;continue}i&=s===2?31:s===3?15:7;while(s>1&&n1){a[r++]=65533;continue}i<65536?a[r++]=i:(i-=65536,a[r++]=55296|i>>10&1023,a[r++]=56320|i&1023)}return f(a,r)},n.utf8border=function(e,t){var n;t=t||e.length,t>e.length&&(t=e.length),n=t-1;while(n>=0&&(e[n]&192)===128)n--;return n<0?t:n===0?t:n+u[e[n]]>t?n:t}},{"./common":27}],29:[function(e,t,n){"use strict";function r(e,t,n,r){var i=e&65535|0,s=e>>>16&65535|0,o=0;while(n!==0){o=n>2e3?2e3:n,n-=o;do i=i+t[r++]|0,s=s+i|0;while(--o);i%=65521,s%=65521}return i|s<<16|0}t.exports=r},{}],30:[function(e,t,n){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}},{}],31:[function(e,t,n){"use strict";function r(){var e,t=[];for(var n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=e&1?3988292384^e>>>1:e>>>1;t[n]=e}return t}function s(e,t,n,r){var s=i,o=r+n;e^=-1;for(var u=r;u>>8^s[(e^t[u])&255];return e^-1}var i=r();t.exports=s},{}],32:[function(e,t,n){"use strict";function Y(e,t){return e.msg=u[t],t}function Z(e){return(e<<1)-(e>4?9:0)}function et(e){var t=e.length;while(--t>=0)e[t]=0}function tt(e){var t=e.state,n=t.pending;n>e.avail_out&&(n=e.avail_out);if(n===0)return;r.arraySet(e.output,t.pending_buf,t.pending_out,n,e.next_out),e.next_out+=n,t.pending_out+=n,e.total_out+=n,e.avail_out-=n,t.pending-=n,t.pending===0&&(t.pending_out=0)}function nt(e,t){i._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,tt(e.strm)}function rt(e,t){e.pending_buf[e.pending++]=t}function it(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=t&255}function st(e,t,n,i){var u=e.avail_in;return u>i&&(u=i),u===0?0:(e.avail_in-=u,r.arraySet(t,e.input,e.next_in,u,n),e.state.wrap===1?e.adler=s(e.adler,t,u,n):e.state.wrap===2&&(e.adler=o(e.adler,t,u,n)),e.next_in+=u,e.total_in+=u,u)}function ot(e,t){var n=e.max_chain_length,r=e.strstart,i,s,o=e.prev_length,u=e.nice_match,a=e.strstart>e.w_size-F?e.strstart-(e.w_size-F):0,f=e.window,l=e.w_mask,c=e.prev,h=e.strstart+j,p=f[r+o-1],d=f[r+o];e.prev_length>=e.good_match&&(n>>=2),u>e.lookahead&&(u=e.lookahead);do{i=t;if(f[i+o]!==d||f[i+o-1]!==p||f[i]!==f[r]||f[++i]!==f[r+1])continue;r+=2,i++;do;while(f[++r]===f[++i]&&f[++r]===f[++i]&&f[++r]===f[++i]&&f[++r]===f[++i]&&f[++r]===f[++i]&&f[++r]===f[++i]&&f[++r]===f[++i]&&f[++r]===f[++i]&&ro){e.match_start=t,o=s;if(s>=u)break;p=f[r+o-1],d=f[r+o]}}while((t=c[t&l])>a&&--n!==0);return o<=e.lookahead?o:e.lookahead}function ut(e){var t=e.w_size,n,i,s,o,u;do{o=e.window_size-e.lookahead-e.strstart;if(e.strstart>=t+(t-F)){r.arraySet(e.window,e.window,t,t,0),e.match_start-=t,e.strstart-=t,e.block_start-=t,i=e.hash_size,n=i;do s=e.head[--n],e.head[n]=s>=t?s-t:0;while(--i);i=t,n=i;do s=e.prev[--n],e.prev[n]=s>=t?s-t:0;while(--i);o+=t}if(e.strm.avail_in===0)break;i=st(e.strm,e.window,e.strstart+e.lookahead,o),e.lookahead+=i;if(e.lookahead+e.insert>=B){u=e.strstart-e.insert,e.ins_h=e.window[u],e.ins_h=(e.ins_h<e.pending_buf_size-5&&(n=e.pending_buf_size-5);for(;;){if(e.lookahead<=1){ut(e);if(e.lookahead===0&&t===a)return $;if(e.lookahead===0)break}e.strstart+=e.lookahead,e.lookahead=0;var r=e.block_start+n;if(e.strstart===0||e.strstart>=r){e.lookahead=e.strstart-r,e.strstart=r,nt(e,!1);if(e.strm.avail_out===0)return $}if(e.strstart-e.block_start>=e.w_size-F){nt(e,!1);if(e.strm.avail_out===0)return $}}e.insert=0;if(t===c)return nt(e,!0),e.strm.avail_out===0?K:Q;if(e.strstart>e.block_start){nt(e,!1);if(e.strm.avail_out===0)return $}return $}function ft(e,t){var n,r;for(;;){if(e.lookahead=B&&(e.ins_h=(e.ins_h<=B){r=i._tr_tally(e,e.strstart-e.match_start,e.match_length-B),e.lookahead-=e.match_length;if(e.match_length<=e.max_lazy_match&&e.lookahead>=B){e.match_length--;do e.strstart++,e.ins_h=(e.ins_h<=B&&(e.ins_h=(e.ins_h<4096)&&(e.match_length=B-1));if(e.prev_length>=B&&e.match_length<=e.prev_length){s=e.strstart+e.lookahead-B,r=i._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-B),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=s&&(e.ins_h=(e.ins_h<=B&&e.strstart>0){s=e.strstart-1,r=u[s];if(r===u[++s]&&r===u[++s]&&r===u[++s]){o=e.strstart+j;do;while(r===u[++s]&&r===u[++s]&&r===u[++s]&&r===u[++s]&&r===u[++s]&&r===u[++s]&&r===u[++s]&&r===u[++s]&&se.lookahead&&(e.match_length=e.lookahead)}}e.match_length>=B?(n=i._tr_tally(e,1,e.match_length-B),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=i._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++);if(n){nt(e,!1);if(e.strm.avail_out===0)return $}}e.insert=0;if(t===c)return nt(e,!0),e.strm.avail_out===0?K:Q;if(e.last_lit){nt(e,!1);if(e.strm.avail_out===0)return $}return J}function ht(e,t){var n;for(;;){if(e.lookahead===0){ut(e);if(e.lookahead===0){if(t===a)return $;break}}e.match_length=0,n=i._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(n){nt(e,!1);if(e.strm.avail_out===0)return $}}e.insert=0;if(t===c)return nt(e,!0),e.strm.avail_out===0?K:Q;if(e.last_lit){nt(e,!1);if(e.strm.avail_out===0)return $}return J}function vt(e){e.window_size=2*e.w_size,et(e.head),e.max_lazy_match=dt[e.level].max_lazy,e.good_match=dt[e.level].good_length,e.nice_match=dt[e.level].nice_length,e.max_chain_length=dt[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=B-1,e.match_available=0,e.ins_h=0}function mt(){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=N,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 r.Buf16(P*2),this.dyn_dtree=new r.Buf16((2*_+1)*2),this.bl_tree=new r.Buf16((2*D+1)*2),et(this.dyn_ltree),et(this.dyn_dtree),et(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new r.Buf16(H+1),this.heap=new r.Buf16(2*M+1),et(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new r.Buf16(2*M+1),et(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 gt(e){var t;return!e||!e.state?Y(e,v):(e.total_in=e.total_out=0,e.data_type=T,t=e.state,t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?q:X,e.adler=t.wrap===2?0:1,t.last_flush=a,i._tr_init(t),p)}function yt(e){var t=gt(e);return t===p&&vt(e.state),t}function bt(e,t){return!e||!e.state?v:e.state.wrap!==2?v:(e.state.gzhead=t,p)}function wt(e,t,n,i,s,o){if(!e)return v;var u=1;t===y&&(t=6),i<0?(u=0,i=-i):i>15&&(u=2,i-=16);if(s<1||s>C||n!==N||i<8||i>15||t<0||t>9||o<0||o>S)return Y(e,v);i===8&&(i=9);var a=new mt;return e.state=a,a.strm=e,a.wrap=u,a.gzhead=null,a.w_bits=i,a.w_size=1<>1,a.l_buf=3*a.lit_bufsize,a.level=t,a.strategy=o,a.method=n,yt(e)}function Et(e,t){return wt(e,t,N,k,L,x)}function St(e,t){var n,r,s,u;if(!e||!e.state||t>h||t<0)return e?Y(e,v):v;r=e.state;if(!e.output||!e.input&&e.avail_in!==0||r.status===V&&t!==c)return Y(e,e.avail_out===0?g:v);r.strm=e,n=r.last_flush,r.last_flush=t;if(r.status===q)if(r.wrap===2)e.adler=0,rt(r,31),rt(r,139),rt(r,8),r.gzhead?(rt(r,(r.gzhead.text?1:0)+(r.gzhead.hcrc?2:0)+(r.gzhead.extra?4:0)+(r.gzhead.name?8:0)+(r.gzhead.comment?16:0)),rt(r,r.gzhead.time&255),rt(r,r.gzhead.time>>8&255),rt(r,r.gzhead.time>>16&255),rt(r,r.gzhead.time>>24&255),rt(r,r.level===9?2:r.strategy>=w||r.level<2?4:0),rt(r,r.gzhead.os&255),r.gzhead.extra&&r.gzhead.extra.length&&(rt(r,r.gzhead.extra.length&255),rt(r,r.gzhead.extra.length>>8&255)),r.gzhead.hcrc&&(e.adler=o(e.adler,r.pending_buf,r.pending,0)),r.gzindex=0,r.status=R):(rt(r,0),rt(r,0),rt(r,0),rt(r,0),rt(r,0),rt(r,r.level===9?2:r.strategy>=w||r.level<2?4:0),rt(r,G),r.status=X);else{var m=N+(r.w_bits-8<<4)<<8,y=-1;r.strategy>=w||r.level<2?y=0:r.level<6?y=1:r.level===6?y=2:y=3,m|=y<<6,r.strstart!==0&&(m|=I),m+=31-m%31,r.status=X,it(r,m),r.strstart!==0&&(it(r,e.adler>>>16),it(r,e.adler&65535)),e.adler=1}if(r.status===R)if(r.gzhead.extra){s=r.pending;while(r.gzindex<(r.gzhead.extra.length&65535)){if(r.pending===r.pending_buf_size){r.gzhead.hcrc&&r.pending>s&&(e.adler=o(e.adler,r.pending_buf,r.pending-s,s)),tt(e),s=r.pending;if(r.pending===r.pending_buf_size)break}rt(r,r.gzhead.extra[r.gzindex]&255),r.gzindex++}r.gzhead.hcrc&&r.pending>s&&(e.adler=o(e.adler,r.pending_buf,r.pending-s,s)),r.gzindex===r.gzhead.extra.length&&(r.gzindex=0,r.status=U)}else r.status=U;if(r.status===U)if(r.gzhead.name){s=r.pending;do{if(r.pending===r.pending_buf_size){r.gzhead.hcrc&&r.pending>s&&(e.adler=o(e.adler,r.pending_buf,r.pending-s,s)),tt(e),s=r.pending;if(r.pending===r.pending_buf_size){u=1;break}}r.gzindexs&&(e.adler=o(e.adler,r.pending_buf,r.pending-s,s)),u===0&&(r.gzindex=0,r.status=z)}else r.status=z;if(r.status===z)if(r.gzhead.comment){s=r.pending;do{if(r.pending===r.pending_buf_size){r.gzhead.hcrc&&r.pending>s&&(e.adler=o(e.adler,r.pending_buf,r.pending-s,s)),tt(e),s=r.pending;if(r.pending===r.pending_buf_size){u=1;break}}r.gzindexs&&(e.adler=o(e.adler,r.pending_buf,r.pending-s,s)),u===0&&(r.status=W)}else r.status=W;r.status===W&&(r.gzhead.hcrc?(r.pending+2>r.pending_buf_size&&tt(e),r.pending+2<=r.pending_buf_size&&(rt(r,e.adler&255),rt(r,e.adler>>8&255),e.adler=0,r.status=X)):r.status=X);if(r.pending!==0){tt(e);if(e.avail_out===0)return r.last_flush=-1,p}else if(e.avail_in===0&&Z(t)<=Z(n)&&t!==c)return Y(e,g);if(r.status===V&&e.avail_in!==0)return Y(e,g);if(e.avail_in!==0||r.lookahead!==0||t!==a&&r.status!==V){var b=r.strategy===w?ht(r,t):r.strategy===E?ct(r,t):dt[r.level].func(r,t);if(b===K||b===Q)r.status=V;if(b===$||b===K)return e.avail_out===0&&(r.last_flush=-1),p;if(b===J){t===f?i._tr_align(r):t!==h&&(i._tr_stored_block(r,0,0,!1),t===l&&(et(r.head),r.lookahead===0&&(r.strstart=0,r.block_start=0,r.insert=0))),tt(e);if(e.avail_out===0)return r.last_flush=-1,p}}return t!==c?p:r.wrap<=0?d:(r.wrap===2?(rt(r,e.adler&255),rt(r,e.adler>>8&255),rt(r,e.adler>>16&255),rt(r,e.adler>>24&255),rt(r,e.total_in&255),rt(r,e.total_in>>8&255),rt(r,e.total_in>>16&255),rt(r,e.total_in>>24&255)):(it(r,e.adler>>>16),it(r,e.adler&65535)),tt(e),r.wrap>0&&(r.wrap=-r.wrap),r.pending!==0?p:d)}function xt(e){var t;return!e||!e.state?v:(t=e.state.status,t!==q&&t!==R&&t!==U&&t!==z&&t!==W&&t!==X&&t!==V?Y(e,v):(e.state=null,t===X?Y(e,m):p))}var r=e("../utils/common"),i=e("./trees"),s=e("./adler32"),o=e("./crc32"),u=e("./messages"),a=0,f=1,l=3,c=4,h=5,p=0,d=1,v=-2,m=-3,g=-5,y=-1,b=1,w=2,E=3,S=4,x=0,T=2,N=8,C=9,k=15,L=8,A=29,O=256,M=O+1+A,_=30,D=19,P=2*M+1,H=15,B=3,j=258,F=j+B+1,I=32,q=42,R=69,U=73,z=91,W=103,X=113,V=666,$=1,J=2,K=3,Q=4,G=3,pt=function(e,t,n,r,i){this.good_length=e,this.max_lazy=t,this.nice_length=n,this.max_chain=r,this.func=i},dt;dt=[new pt(0,0,0,0,at),new pt(4,4,8,4,ft),new pt(4,5,16,8,ft),new pt(4,6,32,32,ft),new pt(4,4,16,16,lt),new pt(8,16,32,32,lt),new pt(8,16,128,128,lt),new pt(8,32,128,256,lt),new pt(32,128,258,1024,lt),new pt(32,258,258,4096,lt)],n.deflateInit=Et,n.deflateInit2=wt,n.deflateReset=yt,n.deflateResetKeep=gt,n.deflateSetHeader=bt,n.deflate=St,n.deflateEnd=xt,n.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":27,"./adler32":29,"./crc32":31,"./messages":37,"./trees":38}],33:[function(e,t,n){"use strict";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},{}],34:[function(e,t,n){"use strict";var r=30,i=12;t.exports=function(t,n){var s,o,u,a,f,l,c,h,p,d,v,m,g,y,b,w,E,S,x,T,N,C,k,L,A;s=t.state,o=t.next_in,L=t.input,u=o+(t.avail_in-5),a=t.next_out,A=t.output,f=a-(n-t.avail_out),l=a+(t.avail_out-257),c=s.dmax,h=s.wsize,p=s.whave,d=s.wnext,v=s.window,m=s.hold,g=s.bits,y=s.lencode,b=s.distcode,w=(1<>>24,m>>>=x,g-=x,x=S>>>16&255;if(x===0)A[a++]=S&65535;else{if(!(x&16)){if((x&64)===0){S=y[(S&65535)+(m&(1<>>=x,g-=x),g<15&&(m+=L[o++]<>>24,m>>>=x,g-=x,x=S>>>16&255;if(!(x&16)){if((x&64)===0){S=b[(S&65535)+(m&(1<c){t.msg="invalid distance too far back",s.mode=r;break e}m>>>=x,g-=x,x=a-f;if(N>x){x=N-x;if(x>p&&s.sane){t.msg="invalid distance too far back",s.mode=r;break e}C=0,k=v;if(d===0){C+=h-x;if(x2)A[a++]=k[C++],A[a++]=k[C++],A[a++]=k[C++],T-=3;T&&(A[a++]=k[C++],T>1&&(A[a++]=k[C++]))}else{C=a-N;do A[a++]=A[C++],A[a++]=A[C++],A[a++]=A[C++],T-=3;while(T>2);T&&(A[a++]=A[C++],T>1&&(A[a++]=A[C++]))}break}}break}}while(o>3,o-=T,g-=T<<3,m&=(1<>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24)}function st(){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 r.Buf16(320),this.work=new r.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function ot(e){var t;return!e||!e.state?g:(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=t.wrap&1),t.mode=S,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new r.Buf32(et),t.distcode=t.distdyn=new r.Buf32(tt),t.sane=1,t.back=-1,d)}function ut(e){var t;return!e||!e.state?g:(t=e.state,t.wsize=0,t.whave=0,t.wnext=0,ot(e))}function at(e,t){var n,r;return!e||!e.state?g:(r=e.state,t<0?(n=0,t=-t):(n=(t>>4)+1,t<48&&(t&=15)),t&&(t<8||t>15)?g:(r.window!==null&&r.wbits!==t&&(r.window=null),r.wrap=n,r.wbits=t,ut(e)))}function ft(e,t){var n,r;return e?(r=new st,e.state=r,r.window=null,n=at(e,t),n!==d&&(e.state=null),n):g}function lt(e){return ft(e,rt)}function dt(e){if(ct){var t;ht=new r.Buf32(512),pt=new r.Buf32(32),t=0;while(t<144)e.lens[t++]=8;while(t<256)e.lens[t++]=9;while(t<280)e.lens[t++]=7;while(t<288)e.lens[t++]=8;u(f,e.lens,0,288,ht,0,e.work,{bits:9}),t=0;while(t<32)e.lens[t++]=5;u(l,e.lens,0,32,pt,0,e.work,{bits:5}),ct=!1}e.lencode=ht,e.lenbits=9,e.distcode=pt,e.distbits=5}function vt(e,t,n,i){var s,o=e.state;return o.window===null&&(o.wsize=1<=o.wsize?(r.arraySet(o.window,t,n-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):(s=o.wsize-o.wnext,s>i&&(s=i),r.arraySet(o.window,t,n-i,s,o.wnext),i-=s,i?(r.arraySet(o.window,t,n-i,i,0),o.wnext=i,o.whave=o.wsize):(o.wnext+=s,o.wnext===o.wsize&&(o.wnext=0),o.whave>>8&255,n.check=s(n.check,Nt,2,0),ut=0,at=0,n.mode=x;break}n.flags=0,n.head&&(n.head.done=!1);if(!(n.wrap&1)||(((ut&255)<<8)+(ut>>8))%31){e.msg="incorrect header check",n.mode=G;break}if((ut&15)!==E){e.msg="unknown compression method",n.mode=G;break}ut>>>=4,at-=4,xt=(ut&15)+8;if(n.wbits===0)n.wbits=xt;else if(xt>n.wbits){e.msg="invalid window size",n.mode=G;break}n.dmax=1<>8&1),n.flags&512&&(Nt[0]=ut&255,Nt[1]=ut>>>8&255,n.check=s(n.check,Nt,2,0)),ut=0,at=0,n.mode=T;case T:while(at<32){if(st===0)break e;st--,ut+=et[nt++]<>>8&255,Nt[2]=ut>>>16&255,Nt[3]=ut>>>24&255,n.check=s(n.check,Nt,4,0)),ut=0,at=0,n.mode=N;case N:while(at<16){if(st===0)break e;st--,ut+=et[nt++]<>8),n.flags&512&&(Nt[0]=ut&255,Nt[1]=ut>>>8&255,n.check=s(n.check,Nt,2,0)),ut=0,at=0,n.mode=C;case C:if(n.flags&1024){while(at<16){if(st===0)break e;st--,ut+=et[nt++]<>>8&255,n.check=s(n.check,Nt,2,0)),ut=0,at=0}else n.head&&(n.head.extra=null);n.mode=k;case k:if(n.flags&1024){ct=n.length,ct>st&&(ct=st),ct&&(n.head&&(xt=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Array(n.head.extra_len)),r.arraySet(n.head.extra,et,nt,ct,xt)),n.flags&512&&(n.check=s(n.check,et,ct,nt)),st-=ct,nt+=ct,n.length-=ct);if(n.length)break e}n.length=0,n.mode=L;case L:if(n.flags&2048){if(st===0)break e;ct=0;do xt=et[nt+ct++],n.head&&xt&&n.length<65536&&(n.head.name+=String.fromCharCode(xt));while(xt&&ct>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=D;break;case M:while(at<32){if(st===0)break e;st--,ut+=et[nt++]<>>=at&7,at-=at&7,n.mode=J;break}while(at<3){if(st===0)break e;st--,ut+=et[nt++]<>>=1,at-=1;switch(ut&3){case 0:n.mode=H;break;case 1:dt(n),n.mode=R;if(t===p){ut>>>=2,at-=2;break e}break;case 2:n.mode=F;break;case 3:e.msg="invalid block type",n.mode=G}ut>>>=2,at-=2;break;case H:ut>>>=at&7,at-=at&7;while(at<32){if(st===0)break e;st--,ut+=et[nt++]<>>16^65535)){e.msg="invalid stored block lengths",n.mode=G;break}n.length=ut&65535,ut=0,at=0,n.mode=B;if(t===p)break e;case B:n.mode=j;case j:ct=n.length;if(ct){ct>st&&(ct=st),ct>ot&&(ct=ot);if(ct===0)break e;r.arraySet(tt,et,nt,ct,rt),st-=ct,nt+=ct,ot-=ct,rt+=ct,n.length-=ct;break}n.mode=D;break;case F:while(at<14){if(st===0)break e;st--,ut+=et[nt++]<>>=5,at-=5,n.ndist=(ut&31)+1,ut>>>=5,at-=5,n.ncode=(ut&15)+4,ut>>>=4,at-=4;if(n.nlen>286||n.ndist>30){e.msg="too many length or distance symbols",n.mode=G;break}n.have=0,n.mode=I;case I:while(n.have>>=3,at-=3}while(n.have<19)n.lens[Lt[n.have++]]=0;n.lencode=n.lendyn,n.lenbits=7,Ct={bits:n.lenbits},Tt=u(a,n.lens,0,19,n.lencode,0,n.work,Ct),n.lenbits=Ct.bits;if(Tt){e.msg="invalid code lengths set",n.mode=G;break}n.have=0,n.mode=q;case q:while(n.have>>24,yt=mt>>>16&255,bt=mt&65535;if(gt<=at)break;if(st===0)break e;st--,ut+=et[nt++]<>>=gt,at-=gt,n.lens[n.have++]=bt;else{if(bt===16){kt=gt+2;while(at>>=gt,at-=gt;if(n.have===0){e.msg="invalid bit length repeat",n.mode=G;break}xt=n.lens[n.have-1],ct=3+(ut&3),ut>>>=2,at-=2}else if(bt===17){kt=gt+3;while(at>>=gt,at-=gt,xt=0,ct=3+(ut&7),ut>>>=3,at-=3}else{kt=gt+7;while(at>>=gt,at-=gt,xt=0,ct=11+(ut&127),ut>>>=7,at-=7}if(n.have+ct>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=G;break}while(ct--)n.lens[n.have++]=xt}}if(n.mode===G)break;if(n.lens[256]===0){e.msg="invalid code -- missing end-of-block",n.mode=G;break}n.lenbits=9,Ct={bits:n.lenbits},Tt=u(f,n.lens,0,n.nlen,n.lencode,0,n.work,Ct),n.lenbits=Ct.bits;if(Tt){e.msg="invalid literal/lengths set",n.mode=G;break}n.distbits=6,n.distcode=n.distdyn,Ct={bits:n.distbits},Tt=u(l,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,Ct),n.distbits=Ct.bits;if(Tt){e.msg="invalid distances set",n.mode=G;break}n.mode=R;if(t===p)break e;case R:n.mode=U;case U:if(st>=6&&ot>=258){e.next_out=rt,e.avail_out=ot,e.next_in=nt,e.avail_in=st,n.hold=ut,n.bits=at,o(e,lt),rt=e.next_out,tt=e.output,ot=e.avail_out,nt=e.next_in,et=e.input,st=e.avail_in,ut=n.hold,at=n.bits,n.mode===D&&(n.back=-1);break}n.back=0;for(;;){mt=n.lencode[ut&(1<>>24,yt=mt>>>16&255,bt=mt&65535;if(gt<=at)break;if(st===0)break e;st--,ut+=et[nt++]<>wt)],gt=mt>>>24,yt=mt>>>16&255,bt=mt&65535;if(wt+gt<=at)break;if(st===0)break e;st--,ut+=et[nt++]<>>=wt,at-=wt,n.back+=wt}ut>>>=gt,at-=gt,n.back+=gt,n.length=bt;if(yt===0){n.mode=$;break}if(yt&32){n.back=-1,n.mode=D;break}if(yt&64){e.msg="invalid literal/length code",n.mode=G;break}n.extra=yt&15,n.mode=z;case z:if(n.extra){kt=n.extra;while(at>>=n.extra,at-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=W;case W:for(;;){mt=n.distcode[ut&(1<>>24,yt=mt>>>16&255,bt=mt&65535;if(gt<=at)break;if(st===0)break e;st--,ut+=et[nt++]<>wt)],gt=mt>>>24,yt=mt>>>16&255,bt=mt&65535;if(wt+gt<=at)break;if(st===0)break e;st--,ut+=et[nt++]<>>=wt,at-=wt,n.back+=wt}ut>>>=gt,at-=gt,n.back+=gt;if(yt&64){e.msg="invalid distance code",n.mode=G;break}n.offset=bt,n.extra=yt&15,n.mode=X;case X:if(n.extra){kt=n.extra;while(at>>=n.extra,at-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg="invalid distance too far back",n.mode=G;break}n.mode=V;case V:if(ot===0)break e;ct=lt-ot;if(n.offset>ct){ct=n.offset-ct;if(ct>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=G;break}ct>n.wnext?(ct-=n.wnext,ht=n.wsize-ct):ht=n.wnext-ct,ct>n.length&&(ct=n.length),pt=n.window}else pt=tt,ht=rt-n.offset,ct=n.length;ct>ot&&(ct=ot),ot-=ct,n.length-=ct;do tt[rt++]=pt[ht++];while(--ct);n.length===0&&(n.mode=U);break;case $:if(ot===0)break e;tt[rt++]=n.length,ot--,n.mode=U;break;case J:if(n.wrap){while(at<32){if(st===0)break e;st--,ut|=et[nt++]<=1;T--)if(I[T]!==0)break;N>T&&(N=T);if(T===0)return m[g++]=20971520,m[g++]=20971520,b.bits=1,0;for(x=1;x0&&(t===u||T!==1))return-1;q[1]=0;for(E=1;Es||t===f&&A>o)return 1;var V=0;for(;;){V++,z=E-k,y[S]F?(W=R[U+y[S]],X=B[j+y[S]]):(W=96,X=0),M=1<>k)+_]=z<<24|W<<16|X|0;while(_!==0);M=1<>=1;M!==0?(O&=M-1,O+=M):O=0,S++;if(--I[E]===0){if(E===T)break;E=n[d+y[S]]}if(E>N&&(O&P)!==D){k===0&&(k=N),H+=x,C=E-k,L=1<s||t===f&&A>o)return 1;D=O&P,m[D]=N<<24|C<<16|H-g|0}}return O!==0&&(m[H+O]=E-k<<24|64<<16|0),b.bits=N,0}},{"../utils/common":27}],37:[function(e,t,n){"use strict";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"}},{}],38:[function(e,t,n){"use strict";function a(e){var t=e.length;while(--t>=0)e[t]=0}function z(e){return e<256?P[e]:P[256+(e>>>7)]}function W(e,t){e.pending_buf[e.pending++]=t&255,e.pending_buf[e.pending++]=t>>>8&255}function X(e,t,n){e.bi_valid>E-n?(e.bi_buf|=t<>E-e.bi_valid,e.bi_valid+=n-E):(e.bi_buf|=t<>>=1,n<<=1;while(--t>0);return n>>>1}function J(e){e.bi_valid===16?(W(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=e.bi_buf&255,e.bi_buf>>=8,e.bi_valid-=8)}function K(e,t){var n=t.dyn_tree,r=t.max_code,i=t.stat_desc.static_tree,s=t.stat_desc.has_stree,o=t.stat_desc.extra_bits,u=t.stat_desc.extra_base,a=t.stat_desc.max_length,f,l,c,h,p,d,v=0;for(h=0;h<=w;h++)e.bl_count[h]=0;n[e.heap[e.heap_max]*2+1]=0;for(f=e.heap_max+1;fa&&(h=a,v++),n[l*2+1]=h;if(l>r)continue;e.bl_count[h]++,p=0,l>=u&&(p=o[l-u]),d=n[l*2],e.opt_len+=d*(h+p),s&&(e.static_len+=d*(i[l*2+1]+p))}if(v===0)return;do{h=a-1;while(e.bl_count[h]===0)h--;e.bl_count[h]--,e.bl_count[h+1]+=2,e.bl_count[a]--,v-=2}while(v>0);for(h=a;h!==0;h--){l=e.bl_count[h];while(l!==0){c=e.heap[--f];if(c>r)continue;n[c*2+1]!==h&&(e.opt_len+=(h-n[c*2+1])*n[c*2],n[c*2+1]=h),l--}}}function Q(e,t,n){var r=new Array(w+1),i=0,s,o;for(s=1;s<=w;s++)r[s]=i=i+n[s-1]<<1;for(o=0;o<=t;o++){var u=e[o*2+1];if(u===0)continue;e[o*2]=$(r[u]++,u)}}function G(){var e,t,n,r,i,s=new Array(w+1);n=0;for(r=0;r>=7;for(;r8?W(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function et(e,t,n,i){Z(e),i&&(W(e,n),W(e,~n)),r.arraySet(e.pending_buf,e.window,t,n,e.pending),e.pending+=n}function tt(e,t,n,r){var i=t*2,s=n*2;return e[i]>1;o>=1;o--)nt(e,n,o);f=s;do o=e.heap[1],e.heap[1]=e.heap[e.heap_len--],nt(e,n,1),u=e.heap[1],e.heap[--e.heap_max]=o,e.heap[--e.heap_max]=u,n[f*2]=n[o*2]+n[u*2],e.depth[f]=(e.depth[o]>=e.depth[u]?e.depth[o]:e.depth[u])+1,n[o*2+1]=n[u*2+1]=f,e.heap[1]=f++,nt(e,n,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],K(e,t),Q(n,a,e.bl_count)}function st(e,t,n){var r,i=-1,s,o=t[1],u=0,a=7,f=4;o===0&&(a=138,f=3),t[(n+1)*2+1]=65535;for(r=0;r<=n;r++){s=o,o=t[(r+1)*2+1];if(++u=3;t--)if(e.bl_tree[O[t]*2+1]!==0)break;return e.opt_len+=3*(t+1)+5+5+4,t}function at(e,t,n,r){var i;X(e,t-257,5),X(e,n-1,5),X(e,r-4,4);for(i=0;i>>=1)if(t&1&&e.dyn_ltree[n*2]!==0)return s;if(e.dyn_ltree[18]!==0||e.dyn_ltree[20]!==0||e.dyn_ltree[26]!==0)return o;for(n=32;n0?(e.strm.data_type===u&&(e.strm.data_type=ft(e)),it(e,e.l_desc),it(e,e.d_desc),a=ut(e),s=e.opt_len+3+7>>>3,o=e.static_len+3+7>>>3,o<=s&&(s=o)):s=o=n+5,n+4<=s&&t!==-1?ht(e,t,n,r):e.strategy===i||o===s?(X(e,(l<<1)+(r?1:0),3),rt(e,_,D)):(X(e,(c<<1)+(r?1:0),3),at(e,e.l_desc.max_code+1,e.d_desc.max_code+1,a+1),rt(e,e.dyn_ltree,e.dyn_dtree)),Y(e),r&&Z(e)}function vt(e,t,n){return e.pending_buf[e.d_buf+e.last_lit*2]=t>>>8&255,e.pending_buf[e.d_buf+e.last_lit*2+1]=t&255,e.pending_buf[e.l_buf+e.last_lit]=n&255,e.last_lit++,t===0?e.dyn_ltree[n*2]++:(e.matches++,t--,e.dyn_ltree[(H[n]+v+1)*2]++,e.dyn_dtree[z(t)*2]++),e.last_lit===e.lit_bufsize-1}var r=e("../utils/common"),i=4,s=0,o=1,u=2,f=0,l=1,c=2,h=3,p=258,d=29,v=256,m=v+1+d,g=30,y=19,b=2*m+1,w=15,E=16,S=7,x=256,T=16,N=17,C=18,k=[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],L=[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],A=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],O=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],M=512,_=new Array((m+2)*2);a(_);var D=new Array(g*2);a(D);var P=new Array(M);a(P);var H=new Array(p-h+1);a(H);var B=new Array(d);a(B);var j=new Array(g);a(j);var F=function(e,t,n,r,i){this.static_tree=e,this.extra_bits=t,this.extra_base=n,this.elems=r,this.max_length=i,this.has_stree=e&&e.length},I,q,R,U=function(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t},lt=!1;n._tr_init=ct,n._tr_stored_block=ht,n._tr_flush_block=dt,n._tr_tally=vt,n._tr_align=pt},{"../utils/common":27}],39:[function(e,t,n){"use strict";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},{}]},{},[9])(9)}),n("formats/kml/KmlFileCache",[],function(){"use strict";var e=function(){this._rootFile=null,this._map={}};return e.prototype.retrieve=function(e){if(e.indexOf("#")==0||e==null||e.indexOf("http")!=0)return this._rootFile;var t=e;return e.indexOf("#")!=-1&&(t=e.substr(0,e.indexOf("#")-1)),this._map[t]?this._map[t]:null},e.prototype.add=function(e,t){this._rootFile?this._map[e]=t:this._rootFile=t},e}),n("formats/kml/styles/KmlStyleSelector",["./../KmlObject"],function(e){"use strict";var t=function(t){e.call(this,t)};return t.prototype=Object.create(e.prototype),t.prototype.getTagNames=function(){return["Style","StyleMap"]},t}),n("formats/kml/styles/KmlPolyStyle",["../../../util/Color","./KmlColorStyle","./../KmlElements","../util/NodeTransformers"],function(e,t,n,r){"use strict";var i=function(e){t.call(this,e)};return i.prototype=Object.create(t.prototype),Object.defineProperties(i.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})}}}),i.update=function(t,n){t=t||{};var r=n||{};return r._drawInterior=t.kmlFill||!0,r._drawOutline=t.kmlOutline||!1,r._outlineColor=n._outlineColor||e.WHITE,r._interiorColor=t.kmlColor&&e.colorFromKmlHex(t.kmlColor)||e.WHITE,r._colorMode=t.kmlColorMode||"normal",r},i.prototype.getTagNames=function(){return["PolyStyle"]},n.addKey(i.prototype.getTagNames()[0],i),i}),n("formats/kml/KmlLink",["./KmlElements","./KmlObject","./util/NodeTransformers"],function(e,t,n){"use strict";var r=function(e){t.call(this,e),this.onChangeListeners=[]};return r.prototype=Object.create(t.prototype),Object.defineProperties(r.prototype,{kmlHref:{get:function(){return this._factory.specific(this,{name:"href",transformer:n.string})}},kmlRefreshMode:{get:function(){return this._factory.specific(this,{name:"refreshMode",transformer:n.string})}},kmlRefreshInterval:{get:function(){return this._factory.specific(this,{name:"refreshInterval",transformer:n.number})}},kmlViewRefreshMode:{get:function(){return this._factory.specific(this,{name:"viewRefreshMode",transformer:n.string})}},kmlViewRefreshTime:{get:function(){return this._factory.specific(this,{name:"viewRefreshTime",transformer:n.number})}},kmlViewBoundScale:{get:function(){return this._factory.specific(this,{name:"viewBoundScale",transformer:n.number})}},kmlViewFormat:{get:function(){return this._factory.specific(this,{name:"viewFormat",transformer:n.string})}},kmlHttpQuery:{get:function(){return this._factory.specific(this,{name:"httpQuery",transformer:n.string})}}}),r.prototype.getTagNames=function(){return["Link"]},e.addKey(r.prototype.getTagNames()[0],r),r}),n("formats/kml/KmlIcon",["./KmlLink","./KmlElements","./util/NodeTransformers"],function(e,t,n){"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:"gx:x",transformer:n.number})}},kmlY:{get:function(){return this._factory.specific(this,{name:"gx:y",transformer:n.number})}},kmlW:{get:function(){return this._factory.specific(this,{name:"gx:w",transformer:n.number})}},kmlH:{get:function(){return this._factory.specific(this,{name:"gx:h",transformer:n.number})}}}),r.prototype.getTagNames=function(){return["Icon"]},t.addKey(r.prototype.getTagNames()[0],r),r}),n("formats/kml/styles/KmlIconStyle",["./KmlColorStyle","./../KmlElements","../KmlIcon","../util/NodeTransformers"],function(e,t,n,r){"use strict";var i=function(t){e.call(this,t)};return i.prototype=Object.create(e.prototype),Object.defineProperties(i.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:n.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")})}}}),i.update=function(e,t){e=e||{};var n=t||{};return n._imageScale=e.kmlScale||1,n._imageSource=e.kmlIcon&&e.kmlIcon.kmlHref||null,n},i.prototype.getTagNames=function(){return["IconStyle"]},t.addKey(i.prototype.getTagNames()[0],i),i}),n("formats/kml/styles/KmlLabelStyle",["./KmlColorStyle","../KmlElements","../util/NodeTransformers"],function(e,t,n){"use strict";var r=function(t){e.call(this,t)};return r.prototype=Object.create(e.prototype),Object.defineProperties(r.prototype,{kmlScale:{get:function(){return this._factory.specific(this,{name:"scale",transformer:n.number})}}}),r.update=function(){},r.prototype.getTagNames=function(){return["LabelStyle"]},t.addKey(r.prototype.getTagNames()[0],r),r}),n("formats/kml/styles/KmlLineStyle",["../../../util/Color","./KmlColorStyle","./../KmlElements","../util/NodeTransformers"],function(e,t,n,r){"use strict";var i=function(e){t.call(this,e)};return i.prototype=Object.create(t.prototype),Object.defineProperties(i.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})}}}),i.update=function(t,n){var r=n||{};return t=t||{},r._outlineColor=t.kmlColor&&e.colorFromKmlHex(t.kmlColor)||e.WHITE,r._outlineWidth=t.kmlWidth||10,r},i.prototype.getTagNames=function(){return["LineStyle"]},n.addKey(i.prototype.getTagNames()[0],i),i}),n("formats/kml/styles/KmlListStyle",["../util/ItemIcon","../KmlElements","./KmlSubStyle","../util/NodeTransformers"],function(e,t,n,r){"use strict";var i=function(e){n.call(this,e)};return i.prototype=Object.create(n.prototype),Object.defineProperties(i.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:e.prototype.getTagNames()})}}}),i.update=function(e){},i.prototype.getTagNames=function(){return["ListStyle"]},t.addKey(i.prototype.getTagNames()[0],i),i}),n("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(e,t,n,r,i,s,o,u,a,f,l,c,h,p){"use strict";var d=function(e){n.call(this,e)};return d.prototype=Object.create(n.prototype),Object.defineProperties(d.prototype,{kmlIconStyle:{get:function(){return this._factory.any(this,{name:s.prototype.getTagNames()})}},kmlLabelStyle:{get:function(){return this._factory.any(this,{name:o.prototype.getTagNames()})}},kmlLineStyle:{get:function(){return this._factory.any(this,{name:u.prototype.getTagNames()})}},kmlPolyStyle:{get:function(){return this._factory.any(this,{name:i.prototype.getTagNames()})}},kmlBalloonStyle:{get:function(){return this._factory.any(this,{name:f.prototype.getTagNames()})}},kmlListStyle:{get:function(){return this._factory.any(this,{name:a.prototype.getTagNames()})}}}),d.prototype.generate=function(e){e=e||{};var t=this||{};return t.kmlIconStyle&&s.update(t.kmlIconStyle,e),t.kmlListStyle&&a.update(t.kmlListStyle,e),t.kmlBalloonStyle&&f.update(t.kmlBalloonStyle,e),t.kmlLabelStyle&&o.update(t.kmlLabelStyle,e),t.kmlPolyStyle&&i.update(t.kmlPolyStyle,e),t.kmlLineStyle&&u.update(t.kmlLineStyle,e),e},d.prototype.getStyle=function(){var e=this;return new c(function(t){window.setTimeout(function(){t(e)},0)})},d.prototype.getTagNames=function(){return["Style"]},r.addKey(d.prototype.getTagNames()[0],d),d.placemarkAttributes=function(t){return t=t||{},t._imageColor=t._imageColor||new e(1,1,1,1),t._imageOffset=t._imageOffset||new l(WorldWind.OFFSET_FRACTION,.5,WorldWind.OFFSET_FRACTION,.5),t._imageScale=t._imageScale||1,t._imageSource=t._imageSource||null,t._depthTest=t._depthTest||!0,t._labelAttributes=t._labelAttributes||new p(d.textAttributes()),t._drawLeaderLine=t._drawLeaderLine||!1,t._leaderLineAttributes=t._leaderLineAttributes||new h(d.shapeAttributes()),t},d.textAttributes=function(n){return n=n||{},n._color=n._color||new e(1,1,1,1),n._font=n._font||new t(14),n._offset=n._offset||new l(WorldWind.OFFSET_FRACTION,.5,WorldWind.OFFSET_FRACTION,0),n._scale=n._scale||1,n._depthTest=n._depthTest||!1,n},d.shapeAttributes=function(t){return t=t||{},t._drawInterior=t._drawInterior||!0,t._drawOutline=t._drawOutline||!0,t._enableLighting=t._enableLighting||!1,t._interiorColor=t._interiorColor||e.WHITE,t._outlineColor=t._outlineColor||e.RED,t._outlineWidth=t._outlineWidth||1,t._outlineStippleFactor=t._outlineStippleFactor||0,t._outlineStipplePattern=t._outlineStipplePattern||61680,t._imageSource=t._imageSource||null,t._depthTest=t._depthTest||!0,t._drawVerticals=t._drawVerticals||!1,t._applyLighting=t._applyLighting||!1,t},d}),n("formats/kml/util/StyleResolver",["../KmlFile","../../../util/Logger"],function(e,t){"use strict";var n=function(e){this._fileCache=e};return n.prototype.handleRemoteStyle=function(e,n,r,i,s){e?this.handleStyleUrl(e,r,i,s):n?this.handleStyleSelector(n,r,i):t.logMessage(t.LEVEL_WARNING,"StyleResolver","handleRemoteStyle","Style was null.")},n.prototype.handleStyleUrl=function(e,t,n,r){r=this.handlePromiseOfFile(e,r),r.then(function(r){r.resolveStyle(e).then(function(e){e.isMap?e.resolve(t,n):t({normal:e,highlight:null})})})},n.prototype.handlePromiseOfFile=function(e,t){return t||(t=this._fileCache.retrieve(e),t||(t=new WorldWind.KmlFile({url:e}),this._fileCache.add(t))),t},n.prototype.handleStyleSelector=function(e,t,n){e.isMap?e.resolve(t,n):window.setTimeout(function(){t({normal:e,highlight:null})},0)},n}),n("formats/kml/util/Pair",["./../KmlElements","../KmlObject","../styles/KmlStyleSelector","./NodeTransformers","../../../util/Promise","../util/StyleResolver"],function(e,t,n,r,i,s){"use strict";var o=function(e){t.call(this,e)};return o.prototype=Object.create(t.prototype),Object.defineProperties(o.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:n.prototype.getTagNames()})}}}),o.prototype.getTagNames=function(){return["Pair"]},o.prototype.getStyle=function(){var e=this;return new i(function(t,n){window.setTimeout(function(){s.handleRemoteStyle(e.kmlStyleUrl,e.kmlStyleSelector,t,n)},0)})},e.addKey(o.prototype.getTagNames()[0],o),o}),n("formats/kml/styles/KmlStyleMap",["../KmlElements","./KmlSubStyle","../util/Pair","../../../util/Promise"],function(e,t,n,r){"use strict";var i=function(e){t.call(this,e)};return i.prototype=Object.create(t.prototype),Object.defineProperties(i.prototype,{kmlPairs:{get:function(){return this._factory.all(this)}},isMap:{get:function(){return!0}}}),i.prototype.resolve=function(e){var t=this,n={},i=[],s=t.kmlPairs;s.forEach(function(e){var t=e.kmlKey,r=e.getStyle();i.push(r),r.then(function(e){n[t]=e.normal})});var o=r.all(i);o.then(function(){n.normal||(n.normal=null),n.highlight||(n.highlight=null),e(n)})},i.prototype.getTagNames=function(){return["StyleMap"]},e.addKey(i.prototype.getTagNames()[0],i),i}),n("formats/kml/KmlTimeSpan",["./KmlElements","./KmlTimePrimitive","./util/NodeTransformers"],function(e,t,n){"use strict";var r=function(e){e.isTimeSpan=!0,t.call(this,e)};return r.prototype=Object.create(t.prototype),Object.defineProperties(r.prototype,{kmlBegin:{get:function(){return this._factory.specific(this,{name:"begin",transformer:n.date})}},kmlEnd:{get:function(){return this._factory.specific(this,{name:"end",transformer:n.date})}}}),r.prototype.getTagNames=function(){return["TimeSpan"]},e.addKey(r.prototype.getTagNames()[0],r),r}),n("formats/kml/KmlTimeStamp",["./KmlElements","./KmlTimePrimitive","./util/NodeTransformers"],function(e,t,n){"use strict";var r=function(e){e.isTimeStamp=!0,t.call(this,e)};return r.prototype=Object.create(t.prototype),Object.defineProperties(r.prototype,{kmlWhen:{get:function(){return this._factory.specific(this,{name:"when",transformer:n.date})}}}),r.prototype.getTagNames=function(){return["TimeStamp"]},e.addKey(r.prototype.getTagNames()[0],r),r}),n("formats/kml/util/RefreshListener",[],function(){var e=function(){this.currentActiveEvents=[]};return e.prototype.addEvent=function(e){var t=this;setTimeout(function(){t.currentActiveEvents.push(e)},e.time)},e.prototype.getActiveEvents=function(){var e=this.currentActiveEvents.slice();return this.currentActiveEvents=[],e},e.Event=function(e,t,n){this.type=e,this.payload=n,this.time=t},e}),n("formats/kml/util/RemoteFile",["../../../error/ArgumentError","../../../util/Logger","../../../util/Promise"],function(e,t,n){"use strict";var r=function(n){if(!n.ajax&&!n.zip)throw new e(t.logMessage(t.LEVEL_SEVERE,"RemoteDocument","constructor","Invalid option for retrieval specified. Use either ajax or zip option."));this.options=n};return r.prototype.get=function(){var n=this.options;if(n.ajax)return this.ajax(n.url,n);if(n.zip)return n.responseType=n.responseType||"arraybuffer",this.ajax(n.url,n);throw new e(t.logMessage(t.LEVEL_SEVERE,"RemoteDocument","constructor","Invalid option for retrieval specified. Use either ajax or zip option."))},r.prototype.ajax=function(e,r){return new n(function(n,i){var s=new XMLHttpRequest;s.open("GET",e,!0),r.responseType&&(s.responseType=r.responseType),s.onreadystatechange=function(){if(s.readyState===4)if(s.status===200){var r=this.responseText;n({text:r,headers:s.getAllResponseHeaders()})}else t.log(t.LEVEL_WARNING,"KmlFile retrieval failed ("+s.statusText+"): "+e)},s.onerror=function(){t.log(t.LEVEL_WARNING,"Remote file retrieval failed: "+e),i()}.bind(this),s.ontimeout=function(){t.log(t.LEVEL_WARNING,"Remote file retrieval timed out: "+e),i()}.bind(this),s.send(null)})},r}),n("util/XmlDocument",["../error/ArgumentError","../util/Logger"],function(e,t){var n=function(e){this._document=e};return n.prototype.dom=function(){if(DOMParser){var n=new DOMParser,r=n.parseFromString(this._document,"text/xml");if(r.getElementsByTagName("parsererror").length||!r)throw new e(t.logMessage(t.LEVEL_SEVERE,"XmlDocument","dom","Invalid XML document. "+r.getElementsByTagName("parsererror")[0].innerHTML));return r}var i=new ActiveXObject("Microsoft.XMLDOM");return i.async=!1,i.loadXML(text),i},n.isValid=function(e){try{return(new n(e)).dom(),!0}catch(t){return!1}},n}),n("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"],function(e,t,n,r,i,s,o,u,a,f,l,c,h,p,d){"use strict";var v=function(n,s){var o=this;if(!n)throw new e(f.logMessage(f.LEVEL_SEVERE,"KmlFile","constructor","invalidDocumentPassed"));this._controls=s||null,this._fileCache=new r,this._styleResolver=new p(this._fileCache),this._listener=new c,this._headers=null;var u;return u=new l(function(e){var r=o.requestRemote(n);r.then(function(r){var u,a=r.text;o._headers=r.headers;if(n.indexOf(".kmz")==-1)u=a;else{var f=new t;f.load(a),f.files.forEach(function(e){e.endsWith(".kml")&&u==null&&(u=e.asText())})}o._document=(new d(u)).dom(),i.call(o,{objectNode:o._document.documentElement,controls:s}),window.setTimeout(function(){e(o)},0)})}),this._fileCache.add(n,u),u};return v.prototype=Object.create(i.prototype),Object.defineProperties(v.prototype,{shapes:{get:function(){return this._factory.all(this)}}}),v.prototype.render=function(e,t){var n=this;t=t||{},this.shapes.forEach(function(r){r.render(e,{lastStyle:t.lastStyle||null,lastVisibility:t.lastVisibility||null,currentTimeInterval:t.currentTimeInterval||null,regionInvisible:t.regionInvisible||null,fileCache:n._fileCache,styleResolver:n._styleResolver,listener:n._listener,activeEvents:n._listener.getActiveEvents()})})},v.prototype.requestRemote=function(e){var t={};return t.url=e,e.endsWith&&e.endsWith(".kmz")||e.indexOf(".kmz")!=-1?t.zip=!0:t.ajax=!0,(new h(t)).get()},v.prototype.resolveStyle=function(e){var t=this,n=e.substring(e.indexOf("#")+1,e.length);return new l(function(e,r){var i;t._document.querySelector?i=t._document.querySelector("*[id='"+n+"']"):i=t._document.getElementById(n),(!i||i==null)&&r(),i.nodeName==s.prototype.getTagNames()[0]?e(new s({objectNode:i})):i.nodeName==o.prototype.getTagNames()[0]?e(new o({objectNode:i})):f.logMessage(f.LEVEL_WARNING,"KmlFile","resolveStyle","Style must contain either Style node or StyleMap node.")})},v.prototype.getExpired=function(){var e=new Date(this._headers.getRequestHeader("Expires")),t=new Date;return t.getTime-e.getTime()},v}),n("formats/kml/KmlLatLonAltBox",["./KmlElements","./KmlObject","./util/NodeTransformers"],function(e,t,n){"use strict";var r=function(e){t.call(this,e)};return r.prototype=Object.create(t.prototype),Object.defineProperties(r.prototype,{kmlNorth:{get:function(){return this._factory.specific(this,{name:"north",transformer:n.number})}},kmlSouth:{get:function(){return this._factory.specific(this,{name:"south",transformer:n.number})}},kmlEast:{get:function(){return this._factory.specific(this,{name:"east",transformer:n.number})}},kmlWest:{get:function(){return this._factory.specific(this,{name:"west",transformer:n.number})}},kmlMinAltitude:{get:function(){return this._factory.specific(this,{name:"minAltitude",transformer:n.number})}},kmlMaxAltitude:{get:function(){return this._factory.specific(this,{name:"maxAltitude",transformer:n.number})}}}),r.prototype.getTagNames=function(){return["LatLonAltBox"]},e.addKey(r.prototype.getTagNames()[0],r),r}),n("formats/kml/KmlLod",["./KmlElements","./KmlObject","./util/NodeTransformers"],function(e,t,n){"use strict";var r=function(e){t.call(this,e)};return r.prototype=Object.create(t.prototype),Object.defineProperties(r.prototype,{kmlMinLodPixels:{get:function(){return this._factory.specific(this,{name:"minLodPixels",transformer:n.number})}},kmlMaxLodPixels:{get:function(){return this._factory.specific(this,{name:"maxLodPixels",transformer:n.number})}},kmlMinFadeExtent:{get:function(){return this._factory.specific(this,{name:"minFadeExtent",transformer:n.number})}},kmlMaxFadeExtent:{get:function(){return this._factory.specific(this,{name:"maxFadeExtent",transformer:n.number})}}}),r.prototype.getTagNames=function(){return["Lod"]},e.addKey(r.prototype.getTagNames()[0],r),r}),n("formats/kml/KmlRegion",["../../geom/BoundingBox","../../util/Color","./KmlElements","./KmlLatLonAltBox","./KmlLod","./KmlObject","./styles/KmlStyle","./util/NodeTransformers","../../geom/Sector"],function(e,t,n,r,i,s,o,u,a){"use strict";var f=function(e){s.call(this,e)};return f.prototype=Object.create(s.prototype),Object.defineProperties(f.prototype,{kmlLatLonAltBox:{get:function(){return this._factory.specific(this,{name:r.prototype.getTagNames(),transformer:u.kmlObject})}},kmlLod:{get:function(){return this._factory.specific(this,{name:i.prototype.getTagNames(),transformer:u.kmlObject})}}}),f.prototype.intersectsVisible=function(t){var n=this.kmlLatLonAltBox,r=new e;return r.setToSector(new a(n.kmlSouth,n.kmlNorth,n.kmlWest,n.kmlEast),t.globe,n.kmlMinAltitude,n.kmlMaxAltitude),r.intersectsFrustum(t.navigatorState.frustumInModelCoordinates)&&(!n.kmlMinAltitude||t.eyePosition.altitude>n.kmlMinAltitude)&&(!n.kmlMaxAltitude||t.eyePosition.altituder||t.to>r))return!1}return!0},f.prototype.getStyle=function(e,t){if(this._pStyle||!this.kmlStyleUrl&&!this.kmlStyleSelector)return;var n=this;(new a(function(e,r){window.setTimeout(function(){t.styleResolver.handleRemoteStyle(n.kmlStyleUrl,n.kmlStyleSelector,e,r)},0)})).then(function(t){n._pStyle=t,e.redrawRequested=!0})},f.prototype.getTagNames=function(){return["NetworkLink","Placemark","PhotoOverlay","ScreenOverlay","GroundOverlay","Folder","Document"]},f}),n("formats/kml/features/KmlContainer",["./KmlFeature"],function(e){"use strict";var t=function(t){e.call(this,t)};return t.prototype=Object.create(e.prototype),Object.defineProperties(t.prototype,{kmlShapes:{get:function(){var e=this._factory.all(this);return e.filter(function(e){return e.isFeature})}}}),t.prototype.render=function(t,n){e.prototype.render.call(this,t,n);var r=this;this.kmlShapes.forEach(function(e){e.render(t,{lastStyle:n.lastStyle,lastVisibility:r.enabled,currentTimeInterval:n.currentTimeInterval,regionInvisible:n.regionInvisible,fileCache:n.fileCache,styleResolver:n.styleResolver,listener:n.listener,activeEvents:n.activeEvents})})},t.prototype.getTagNames=function(){return["Folder","Document"]},t}),n("formats/kml/util/Schema",["./../KmlElements","../KmlObject"],function(e,t){"use strict";var n=function(e){t.call(this,e)};return n.prototype=Object.create(t.prototype),n.prototype.getTagNames=function(){return["Schema"]},e.addKey(n.prototype.getTagNames()[0],n),n}),n("formats/kml/features/KmlDocument",["./KmlContainer","../KmlElements","./KmlFeature","../util/Schema"],function(e,t,n,r){"use strict";var i=function(t){e.call(this,t)};return i.prototype=Object.create(e.prototype),Object.defineProperties(i.prototype,{kmlSchemas:{get:function(){var e=this._factory.all(this);return e.filter(function(e){return e instanceof r})}}}),i.prototype.getTagNames=function(){return["Document"]},t.addKey(i.prototype.getTagNames()[0],i),i}),n("formats/kml/features/KmlFolder",["./KmlContainer","./../KmlElements"],function(e,t){"use strict";var n=function(t){e.call(this,t)};return n.prototype=Object.create(e.prototype),n.prototype.getTagNames=function(){return["Folder"]},t.addKey(n.prototype.getTagNames()[0],n),n}),n("formats/kml/geom/KmlGeometry",["../KmlObject"],function(e){"use strict";var t=function(t){e.call(this,t),this._renderable=null};return t.prototype=Object.create(e.prototype),t.prototype.render=function(t,n){e.prototype.render.call(this,t,n),this.enabled=n.lastVisibility},t.prototype.getTagNames=t.getTagNames=function(){return["Point","LinearRing","LineString","MultiGeometry","Polygon"]},t}),n("formats/kml/KmlLatLonBox",["./KmlElements","./KmlObject","./util/NodeTransformers"],function(e,t,n){"use strict";var r=function(e){t.call(this,e)};return r.prototype=Object.create(t.prototype),Object.defineProperties(r.prototype,{kmlNorth:{get:function(){return this._factory.specific(this,{name:"north",transformer:n.number})}},kmlSouth:{get:function(){return this._factory.specific(this,{name:"south",transformer:n.number})}},kmlEast:{get:function(){return this._factory.specific(this,{name:"east",transformer:n.number})}},kmlWest:{get:function(){return this._factory.specific(this,{name:"west",transformer:n.number})}},kmlRotation:{get:function(){return this._factory.specific(this,{name:"rotation",transformer:n.string})}}}),r.prototype.getTagNames=function(){return["LatLonBox"]},e.addKey(r.prototype.getTagNames()[0],r),r}),n("formats/kml/KmlLatLonQuad",["./KmlElements","./KmlObject","./util/NodeTransformers"],function(e,t,n){"use strict";var r=function(e){t.call(this,e)};return r.prototype=Object.create(t.prototype),Object.defineProperties(r.prototype,{kmlCoordinates:{get:function(){return this._factory.specific(this,{name:"coordinates",transformer:n.string})}}}),r.prototype.getTagNames=function(){return["gx:LatLonQuad"]},e.addKey(r.prototype.getTagNames()[0],r),r}),n("formats/kml/features/KmlOverlay",["./KmlFeature","./../KmlIcon","../util/NodeTransformers"],function(e,t,n){"use strict";var r=function(t){e.call(this,t)};return r.prototype=Object.create(e.prototype),Object.defineProperties(r.prototype,{kmlColor:{get:function(){return this._factory.specific(this,{name:"color",transformer:n.string})}},kmlDrawOrder:{get:function(){return this._factory.specific(this,{name:"drawOrder",transformer:n.string})}},kmlIcon:{get:function(){return this._factory.any(this,{name:t.prototype.getTagNames()})}}}),r.prototype.getTagNames=function(){return["PhotoOverlay","ScreenOverlay","GroundOverlay"]},r}),n("formats/kml/features/KmlGroundOverlay",["./../KmlElements","./KmlFeature","../KmlLatLonBox","../KmlLatLonQuad","./KmlOverlay","../util/NodeTransformers","../../../geom/Sector","../../../shapes/SurfaceImage"],function(e,t,n,r,i,s,o,u){"use strict";var a=function(e){this.isGroundOverlay=!0,i.call(this,e)};return a.prototype=Object.create(i.prototype),Object.defineProperties(a.prototype,{kmlAltitude:{get:function(){return this._factory.specific(this,{name:"altitude",transformer:s.string})}},kmlAltitudeMode:{get:function(){return this._factory.specific(this,{name:"altitudeMode",transformer:s.string})}},kmlLatLonBox:{get:function(){return this._factory.any(this,{name:n.prototype.getTagNames()})}},kmlLatLonQuad:{get:function(){return this._factory.any(this,{name:r.prototype.getTagNames()})}}}),a.prototype.render=function(e,n){t.prototype.render.call(this,e,n),!this._renderable&&this.enabled&&this.kmlIcon&&this.kmlLatLonBox&&(this._renderable=new u(new o(this.kmlLatLonBox.kmlSouth,this.kmlLatLonBox.kmlNorth,this.kmlLatLonBox.kmlWest,this.kmlLatLonBox.kmlEast),this.kmlIcon.kmlHref),e.redrawRequested=!0),this._renderable&&this._renderable.render(e)},a.prototype.getTagNames=function(){return["GroundOverlay"]},e.addKey(a.prototype.getTagNames()[0],a),a}),n("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(e,t,n,r,i,s,o,u,a,f,l,c,h,p){"use strict";var d=function(n,r){if(!n)throw new t(o.logMessage(o.LEVEL_SEVERE,"Path","constructor","missingPositions"));e.call(this,r),this._positions=n,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 d.prototype=Object.create(e.prototype),Object.defineProperties(d.prototype,{positions:{get:function(){return this._positions},set:function(e){if(!e)throw new t(o.logMessage(o.LEVEL_SEVERE,"Path","constructor","missingPositions"));this._positions=e,this.referencePosition=this.determineReferencePosition(this._positions),this.reset()}},followTerrain:{get:function(){return this._followTerrain},set:function(e){this._followTerrain=e,this.reset()}},terrainConformance:{get:function(){return this._terrainConformance},set:function(e){this._terrainConformance=e,this.reset()}},numSubSegments:{get:function(){return this._numSubSegments},set:function(e){this._numSubSegments=e>=0?e:0,this.reset()}},pathType:{get:function(){return this._pathType},set:function(e){this._pathType=e,this.reset()}},extrude:{get:function(){return this._extrude},set:function(e){this._extrude=e,this.reset()}}}),d.prototype.determineReferencePosition=function(e){return e.length>0?e[0]:null},d.prototype.mustGenerateGeometry=function(e){return this.currentData.tessellatedPoints?this.currentData.drawInterior!==this.activeAttributes.drawInterior||this.currentData.drawVerticals!==this.activeAttributes.drawVerticals?!0:!this.followTerrain&&this.currentData.numSubSegments!==this.numSubSegments?!0:this.followTerrain&&this.currentData.terrainConformance!==this.terrainConformance?!0:this.altitudeMode===WorldWind.ABSOLUTE?!1:this.currentData.isExpired:!0},d.prototype.createSurfaceShape=function(){return new c(this.positions,null)},d.prototype.doMakeOrderedRenderable=function(e){if(!this.referencePosition)return null;if(!this.mustGenerateGeometry(e))return this;var t=this.currentData.referencePoint;e.surfacePointForMode(this.referencePosition.latitude,this.referencePosition.longitude,this.referencePosition.altitude,this._altitudeMode,t),this.currentData.transformationMatrix.setToTranslation(t[0],t[1],t[2]);var n=this.makeTessellatedPositions(e);if(n.length<2)return null;var i=this.computeRenderedPath(e,n);return this.currentData.tessellatedPoints=i,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(i),this.currentData.extent.translate(this.currentData.referencePoint),this},d.prototype.makeTessellatedPositions=function(e){var t=[],n=e.navigatorState,r=this.mustDrawVerticals(e),i=new p(0,0,0),s=new p(0,0,0),o=this._positions[0],u,a,f;r&&(this.currentData.verticalIndices=new Int16Array(this.positions.length*2),this.currentData.verticalIndices[0]=0,this.currentData.verticalIndices[1]=1),t.push(o),e.surfacePointForMode(o.latitude,o.longitude,o.altitude,this._altitudeMode,i);for(var l=1,c=this._positions.length;l0?1:0:o),t.vertexAttribPointer(n.vertexPointLocation,3,t.FLOAT,!1,0,0),t.drawArrays(t.TRIANGLE_STRIP,0,i)),this.activeAttributes.drawOutline&&((this.mustDrawVerticals(e)&&this.mustDrawInterior(e)||this.altitudeMode===WorldWind.CLAMP_TO_GROUND)&&this.applyMvpMatrixForOutline(e),u=this.activeAttributes.outlineColor,o=u.alpha*e.currentLayer.opacity,o<1&&!e.pickingMode&&t.depthMask(!1),n.loadColor(t,e.pickingMode?f:u),n.loadOpacity(t,e.pickingMode?1:o),t.lineWidth(this.activeAttributes.outlineWidth),this.currentData.pointBufferHasExtrusionPoints?(l=24,c=i/2):(l=12,c=i),t.vertexAttribPointer(n.vertexPointLocation,3,t.FLOAT,!1,l,0),t.drawArrays(t.LINE_STRIP,0,c),this.mustDrawVerticals(e)&&(r.verticalIndicesVboCacheKey||(r.verticalIndicesVboCacheKey=e.gpuResourceCache.generateCacheKey()),s=e.gpuResourceCache.resourceForKey(r.verticalIndicesVboCacheKey),s||(s=t.createBuffer(),e.gpuResourceCache.putResource(r.verticalIndicesVboCacheKey,s,r.verticalIndices.length*4),r.fillVbo=!0),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,s),r.fillVbo&&(t.bufferData(t.ELEMENT_ARRAY_BUFFER,r.verticalIndices,t.STATIC_DRAW),e.frameStatistics.incrementVboLoadCount(1)),t.vertexAttribPointer(n.vertexPointLocation,3,t.FLOAT,!1,0,0),t.drawElements(t.LINES,r.verticalIndices.length,t.UNSIGNED_SHORT,0))),r.fillVbo=!1;if(e.pickingMode){var h=new a(f,this.pickDelegate?this.pickDelegate:this,null,e.currentLayer,!1);e.resolvePick(h)}},d.prototype.beginDrawing=function(e){var t=e.currentGlContext;this.mustDrawInterior(e)&&t.disable(t.CULL_FACE),e.findAndBindProgram(n),t.enableVertexAttribArray(e.currentProgram.vertexPointLocation)},d.prototype.endDrawing=function(e){var t=e.currentGlContext;t.disableVertexAttribArray(e.currentProgram.vertexPointLocation),t.depthMask(!0),t.lineWidth(1),t.enable(t.CULL_FACE)},d}),n("formats/kml/geom/KmlLineString",["../../../util/Color","../KmlElements","./KmlGeometry","../styles/KmlStyle","../../../geom/Location","../util/NodeTransformers","../../../shapes/Path","../../../geom/Position","../../../shapes/ShapeAttributes","../../../util/WWUtil"],function(e,t,n,r,i,s,o,u,a,f){"use strict";var l=function(e){n.call(this,e),this._style=null};return l.prototype=Object.create(n.prototype),Object.defineProperties(l.prototype,{kmlExtrude:{get:function(){return this._factory.specific(this,{name:"extrude",transformer:s.boolean})||!1}},kmlTessellate:{get:function(){return this._factory.specific(this,{name:"tessellate",transformer:s.boolean})||!1}},kmlAltitudeMode:{get:function(){return this._factory.specific(this,{name:"altitudeMode",transformer:s.string})||WorldWind.ABSOLUTE}},kmlPositions:{get:function(){return this._factory.specific(this,{name:"coordinates",transformer:s.positions})}},kmlCenter:{get:function(){var e=this.kmlPositions,t=0,n=0,r=0;return e.forEach(function(e){t+=e.latitude,n+=e.longitude,r+=e.altitude}),new u(t/this.kmlPositions.length,n/this.kmlPositions.length,r/this.kmlPositions.length)}}}),l.prototype.createPath=function(e){this._renderable=new o(this.prepareLocations(),this.prepareAttributes(e.normal)),this.moveValidProperties()},l.prototype.render=function(e,t){n.prototype.render.call(this,e,t),t.lastStyle&&!this._renderable&&(this.createPath(t.lastStyle),e.redrawRequested=!0),this._renderable&&(this._renderable.enabled=this.enabled,this._renderable.render(e))},l.prototype.prepareAttributes=function(e){var t=e&&e.generate()||{};return t._applyLighting=!0,t._drawOutline=!0,t._drawInterior=!0,t._drawVerticals=this.kmlExtrude||!1,t._outlineStippleFactor=0,t._outlineStipplePattern=61680,t._enableLighting=!0,new a(r.shapeAttributes(t))},l.prototype.prepareLocations=function(){return this.kmlPositions},l.prototype.moveValidProperties=function(){this._renderable.extrude=this.kmlExtrude||!1,this._renderable.altitudeMode=this.kmlAltitudeMode||WorldWind.ABSOLUTE,this._renderable.tesselate=this.kmlTesselate||!1},l.prototype.equals=function(e){if(!e)return!1;var t=f.arrayEquals(e.kmlPositions,this.kmlPositions);return t&&e.kmlExtrude==this.kmlExtrude&&e.kmlTessellate==this.kmlTessellate&&e.kmlAltitudeMode==this.kmlAltitudeMode},l.prototype.getTagNames=function(){return["LineString"]},t.addKey(l.prototype.getTagNames()[0],l),l}),n("formats/kml/geom/KmlLinearRing",["./KmlLineString","../KmlElements"],function(e,t){"use strict";var n=function(t){e.call(this,t)};return n.prototype=Object.create(e.prototype),n.prototype.getTagNames=function(){return["LinearRing"]},t.addKey(n.prototype.getTagNames()[0],n),n}),n("formats/kml/KmlLocation",["./KmlElements","./KmlObject","./util/NodeTransformers"],function(e,t,n){"use strict";var r=function(e){t.call(this,e)};return r.prototype=Object.create(t.prototype),Object.defineProperties(r.prototype,{kmlLongitude:{get:function(){return this._factory.specific(this,{name:"longitude",transformer:n.string})}},kmlLatitude:{get:function(){return this._factory.specific(this,{name:"latitude",transformer:n.string})}},kmlAltitude:{get:function(){return this._factory.specific(this,{name:"altitude",transformer:n.string})}}}),r.prototype.getTagNames=function(){return["Location"]},e.addKey(r.prototype.getTagNames()[0],r),r}),n("formats/kml/KmlLookAt",["./KmlAbstractView","./KmlElements","./util/NodeTransformers","../../geom/Position"],function(e,t,n,r){"use strict";var i=function(t){e.call(this,t)};return i.prototype=Object.create(e.prototype),Object.defineProperties(i.prototype,{kmlLongitude:{get:function(){return this._factory.specific(this,{name:"longitude",transformer:n.number})}},kmlLatitude:{get:function(){return this._factory.specific(this,{name:"latitude",transformer:n.number})}},kmlAltitude:{get:function(){return this._factory.specific(this,{name:"altitude",transformer:n.number})}},kmlHeading:{get:function(){return this._factory.specific(this,{name:"heading",transformer:n.number})}},kmlTilt:{get:function(){return this._factory.specific(this,{name:"tilt",transformer:n.number})}},kmlRange:{get:function(){return this._factory.specific(this,{name:"range",transformer:n.number})}},kmlAltitudeMode:{get:function(){return this._factory.specific(this,{name:"altitudeMode",transformer:n.string})}}}),i.prototype.update=function(e){if(e.wwd){var t=this.kmlAltitude||4e3;e.wwd.goTo(new r(this.kmlLatitude,this.kmlLongitude,t))}},i.prototype.getTagNames=function(){return["LookAt"]},t.addKey(i.prototype.getTagNames()[0],i),i}),n("formats/kml/geom/KmlMultiGeometry",["./../KmlElements","./KmlGeometry","../../../geom/Position"],function(e,t,n){"use strict";var r=function(e){t.call(this,e),this._style=e.style};return r.prototype=Object.create(t.prototype),Object.defineProperties(r.prototype,{kmlShapes:{get:function(){return this._factory.all(this)}},kmlCenter:{get:function(){var e=this.kmlShapes.map(function(e){return e.kmlCenter}),t=0,r=0,i=0;return e.forEach(function(e){t+=e.latitude,r+=e.longitude,i+=e.altitude}),new n(t/e.length,r/e.length,i/e.length)}}}),r.prototype.render=function(e){t.prototype.render.call(this,e),this.kmlShapes.forEach(function(t){t.render(e)})},r.prototype.getTagNames=function(){return["MultiGeometry"]},e.addKey(r.prototype.getTagNames()[0],r),r}),n("formats/kml/features/KmlNetworkLink",["./../KmlElements","./KmlFeature","../KmlFile","../KmlLink","../util/NodeTransformers","../util/RefreshListener"],function(e,t,n,r,i,s){"use strict";var o="refreshNetworkLinkEvent",u=function(e){t.call(this,e),this.isFeature=!0,this.resolvedFile=null,this.displayed=!1,this.isDownloading=!1};return u.prototype=Object.create(t.prototype),Object.defineProperties(u.prototype,{kmlRefreshVisibility:{get:function(){return this._factory.specific(this,{name:"refreshVisibility",transformer:i.boolean})}},kmlFlyToView:{get:function(){return this._factory.specific(this,{name:"flyToView",transformer:i.boolean})}},kmlLink:{get:function(){return this._factory.any(this,{name:r.prototype.getTagNames()})}}}),u.prototype.getTagNames=function(){return["NetworkLink"]},u.prototype.render=function(e,r){t.prototype.render.call(this,e,r);if(!r.lastVisibility&&!this.displayed)return;if(!this.isDownloading&&!this.resolvedFile){this.isDownloading=!0;var i=this;(new n(i.buildUrl())).then(function(e){i.resolvedFile=e,i.isDownloading=!1,i.fireEvent(r)})}this.resolvedFile&&!this.displayed&&(this.resolvedFile.render(e,r),this.handleRefresh(r))},u.prototype.buildUrl=function(){return this.kmlLink.kmlHref},u.prototype.handleRefresh=function(e){var t=e.activeEvents;t=t.filter(function(e){return e.type==o});if(t.length>0){var r=this;(new n(r.buildUrl())).then(function(t){r.resolvedFile=t,r.fireEvent(e)})}},u.prototype.fireEvent=function(e){var t=0;if(this.kmlLink.kmlRefreshMode=="onInterval")t=this.kmlLink.kmlRefreshInterval*1e3;else{if(this.kmlLink.kmlRefreshMode!="onExpire")return;if(!this.resolvedFile)return;t=this.resolvedFile.getExpired()}e.listener.addEvent(new s.Event(o,t,null))},e.addKey(u.prototype.getTagNames()[0],u),u}),n("formats/kml/KmlOrientation",["./KmlElements","./KmlObject","./util/NodeTransformers"],function(e,t,n){"use strict";var r=function(e){t.call(this,e)};return r.prototype=Object.create(t.prototype),Object.defineProperties(r.prototype,{kmlHeading:{get:function(){return this._factory.specific(this,{name:"heading",transformer:n.number})}},kmlTilt:{get:function(){return this._factory.specific(this,{name:"tilt",transformer:n.number})}},kmlRoll:{get:function(){return this._factory.specific(this,{name:"roll",transformer:n.number})}}}),r.prototype.getTagNames=function(){return["Orientation"]},e.addKey(r.prototype.getTagNames()[0],r),r}),n("formats/kml/geom/KmlPoint",["../../../util/Color","../KmlElements","./KmlGeometry","../../../geom/Location","../util/NodeTransformers","../../../shapes/Polygon","../../../geom/Position"],function(e,t,n,r,i,s,o){"use strict";var u=function(e){n.call(this,e),this._shape=null};return u.prototype=Object.create(n.prototype),Object.defineProperties(u.prototype,{kmlPosition:{get:function(){var e=this._factory.specific(this,{name:"coordinates",transformer:i.string}).split(",");return new o(e[1],e[0],e[2]||0)}},kmlExtrude:{get:function(){return this._factory.specific(this,{name:"extrude",transformer:i.boolean})}},kmlAltitudeMode:{get:function(){return this._factory.specific(this,{name:"altitudeMode",transformer:i.string})}},kmlCenter:{get:function(){return this.kmlPosition}}}),u.prototype.getTagNames=function(){return["Point"]},t.addKey(u.prototype.getTagNames()[0],u),u}),n("formats/kml/util/ViewVolume",["../KmlElements","../KmlObject","./NodeTransformers"],function(e,t,n){"use strict";var r=function(e){t.call(this,e)};return r.prototype=Object.create(t.prototype),Object.defineProperties(r.prototype,{kmlLeftFov:{get:function(){return this._factory.specific(this,{name:"leftFov",transformer:n.number})}},kmlRightFov:{get:function(){return this._factory.specific(this,{name:"rightFov",transformer:n.number})}},kmlBottomFov:{get:function(){return this._factory.specific(this,{name:"bottomFov",transformer:n.number})}},kmlTopFov:{get:function(){return this._factory.specific(this,{name:"topFov",transformer:n.number})}},kmlNear:{get:function(){return this._factory.specific(this,{name:"near",transformer:n.string})}}}),r.prototype.getTagNames=function(){return["ViewVolume"]},e.addKey(r.prototype.getTagNames()[0],r),r}),n("formats/kml/features/KmlPhotoOverlay",["../util/ImagePyramid","./../KmlElements","./KmlOverlay","../geom/KmlPoint","../util/NodeTransformers","../util/ViewVolume"],function(e,t,n,r,i,s){"use strict";var o=function(e){n.call(this,e)};return o.prototype=Object.create(n.prototype),Object.defineProperties(o.prototype,{kmlRotation:{get:function(){return this._factory.specific(this,{name:"rotation",transformer:i.string})}},kmlShape:{get:function(){return this._factory.specific(this,{name:"shape",transformer:i.string})}},kmlPoint:{get:function(){return this._factory.any(this,{name:r.prototype.getTagNames()})}},kmlViewVolume:{get:function(){return this._factory.any(this,{name:s.prototype.getTagNames()})}},kmlImagePyramid:{get:function(){return this._factory.any(this,{name:e.prototype.getTagNames()})}}}),o.prototype.getTagNames=function(){return["PhotoOverlay"]},t.addKey(o.prototype.getTagNames[0],o),o}),n("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(e,t,n,r,i,s,o,u,a,f,l,c,h){"use strict";var p=function(e){t.call(this,e)};return p.prototype=Object.create(t.prototype),Object.defineProperties(p.prototype,{kmlGeometry:{get:function(){return this._factory.any(this,{name:n.prototype.getTagNames()})}}}),p.prototype.render=function(e,n){t.prototype.render.call(this,e,n),n=h.clone(n),n.lastStyle&&!this._renderable&&this.kmlGeometry&&(this._renderable=new u(this.kmlGeometry.kmlCenter,!1,this.prepareAttributes(n.lastStyle.normal)),this.moveValidProperties(),e.redrawRequested=!0),this._renderable&&this.kmlGeometry&&(this.kmlGeometry.render(e,n),this._renderable.render(e))},p.prototype.prepareAttributes=function(e){var t=e&&e.generate()||{normal:{},highlight:{}},n=new o(r.placemarkAttributes(t));return n.imageOffset=new c(WorldWind.OFFSET_FRACTION,.3,WorldWind.OFFSET_FRACTION,0),n.imageColor=a.WHITE,n.labelAttributes=new l(r.textAttributes({_offset:new c(WorldWind.OFFSET_FRACTION,.5,WorldWind.OFFSET_FRACTION,1),_color:a.YELLOW})),n.drawLeaderLine=!0,n.leaderLineAttributes=new f(r.shapeAttributes({outlineColor:a.RED})),n},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"]},e.addKey(p.prototype.getTagNames()[0],p),p}),n("formats/kml/geom/KmlPolygon",["../../../util/Color","../KmlElements","./KmlGeometry","./KmlLinearRing","../styles/KmlStyle","../../../geom/Location","../util/NodeTransformers","../../../shapes/Polygon","../../../shapes/ShapeAttributes"],function(e,t,n,r,i,s,o,u,a){"use strict";var f=function(e){n.call(this,e),this.initialized=!1};return f.prototype=Object.create(n.prototype),Object.defineProperties(f.prototype,{kmlExtrude:{get:function(){return this._factory.specific(this,{name:"extrude",transformer:o.boolean})}},kmlTessellate:{get:function(){return this._factory.specific(this,{name:"tessellate",transformer:o.boolean})}},kmlAltitudeMode:{get:function(){return this._factory.specific(this,{name:"altitudeMode",transformer:o.string})}},kmlOuterBoundary:{get:function(){return this._factory.specific(this,{name:"outerBoundaryIs",transformer:o.linearRing})}},kmlInnerBoundary:{get:function(){return this._factory.specific(this,{name:"innerBoundaryIs",transformer:o.linearRing})}},kmlCenter:{get:function(){return this.kmlOuterBoundary.kmlCenter}}}),f.prototype.createPolygon=function(e){this._renderable=new u(this.prepareLocations(),this.prepareAttributes(e.normal)),this.moveValidProperties()},f.prototype.render=function(e,t){n.prototype.render.call(this,e,t),t.lastStyle&&!this._renderable&&(this.createPolygon(t.lastStyle),e.redrawRequested=!0),this._renderable&&(this._renderable.enabled=this.enabled,this._renderable.render(e))},f.prototype.moveValidProperties=function(){this._renderable.extrude=this.kmlExtrude||!0,this._renderable.altitudeMode=this.kmlAltitudeMode||WorldWind.CLAMP_TO_GROUND},f.prototype.prepareAttributes=function(e){var t=e&&e.generate()||{};return t._drawVerticals=this.kmlExtrude||!1,t._applyLighting=!0,t._depthTest=!0,t._outlineStippleFactor=0,t._outlineStipplePattern=61680,t._enableLighting=!0,new a(i.shapeAttributes(t))},f.prototype.prepareLocations=function(){var e=[];return this.kmlInnerBoundary!=null?(e[0]=this.kmlInnerBoundary.kmlPositions,e[1]=this.kmlOuterBoundary.kmlPositions):e=this.kmlOuterBoundary.kmlPositions,e},f.prototype.getStyle=function(){return this._style},f.prototype.getTagNames=function(){return["Polygon"]},t.addKey(f.prototype.getTagNames()[0],f),f}),n("formats/kml/features/KmlScreenOverlay",["./../KmlElements","./KmlFeature","./KmlOverlay","../util/NodeTransformers","../../../util/Offset","../../../shapes/ScreenImage","../../../util/WWUtil"],function(e,t,n,r,i,s,o){"use strict";var u=function(e){n.call(this,e),console.log("Create Screen Overlay",this)};return u.prototype=Object.create(n.prototype),Object.defineProperties(u.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"})}}}),u.prototype.render=function(e,n){t.prototype.render.call(this,e,n),this._renderable||this.kmlIcon&&(this._renderable=new s(new i(this.kmlScreenXYxunits,this.kmlScreenXYx,this.kmlScreenXYyunits,this.kmlScreenXYy),this.kmlIcon.kmlHref),this._renderable.imageOffset=new i(this.kmlOverlayXYxunits,this.kmlOverlayXYx,this.kmlOverlayXYyunits,this.kmlOverlayXYy),e.redrawRequested=!0),this._renderable&&this._renderable.render(e)},u.prototype.getTagNames=function(){return["ScreenOverlay"]},e.addKey(u.prototype.getTagNames()[0],u),u}),n("formats/kml/features/KmlTour",["./../KmlElements","./KmlFeature"],function(e,t){"use strict";var n=function(e){t.call(this,e)};return n.prototype=Object.create(t.prototype),n.prototype.getTagNames=function(){return["gx:Tour"]},e.addKey(n.prototype.getTagNames()[0],n),n}),n("formats/kml/geom/KmlTrack",["./../KmlElements","./KmlGeometry"],function(e,t){"use strict";var n=function(e){t.call(this,e)};return n.prototype=Object.create(t.prototype),n.prototype.getTagNames=function(){return["gx:Track"]},e.addKey(n.prototype.getTagNames()[0],n),n}),n("layer/LandsatRestLayer",["../error/ArgumentError","../geom/Location","../util/Logger","../geom/Sector","../layer/TiledImageLayer","../util/LevelRowColumnUrlBuilder","../util/WWUtil"],function(e,t,n,r,i,s,o){"use strict";var u=function(e,n,u){var a=o.urlPath(e+"/"+n);i.call(this,r.FULL_SPHERE,new t(36,36),10,"image/png",a,512,512),this.displayName=u,this.pickEnabled=!1,this.urlBuilder=new s(e,n)};return u.prototype=Object.create(i.prototype),u}),n("navigate/Navigator",["../error/ArgumentError","../util/Logger","../geom/Matrix","../navigate/NavigatorState","../geom/Position","../error/UnsupportedOperationError","../geom/Vec3","../util/WWMath"],function(e,t,n,r,i,s,o,u){"use strict";var a=function(n){if(!n)throw new e(t.logMessage(t.LEVEL_SEVERE,"Navigator","constructor","missingWorldWindow"));this.worldWindow=n,this.heading=0,this.tilt=0,this.roll=0,this.nearDistance=1,this.farDistance=1e7};return a.prototype.currentState=function(){throw new s(t.logMessage(t.LEVEL_SEVERE,"Navigator","currentState","abstractInvocation"))},a.prototype.currentStateForModelview=function(s){if(!s)throw new e(t.logMessage(t.LEVEL_SEVERE,"Navigator","currentStateForModelview","missingMatrix"));var a=this.worldWindow.globe,f=u.max(a.equatorialRadius,a.polarRadius),l=s.extractEyePoint(new o(0,0,0)),c=a.computePositionFromPoint(l[0],l[1],l[2],new i(0,0,0)),h=this.worldWindow.viewport,p=this.worldWindow.depthBits,d,v,m=n.fromIdentity();return this.farDistance=u.horizonDistanceForGlobeRadius(f,c.altitude),this.farDistance<1e3&&(this.farDistance=1e3),this.nearDistance=u.perspectiveNearDistanceForFarDistance(this.farDistance,10,p),d=c.altitude-a.elevationAtLocation(c.latitude,c.longitude),d>0&&(v=u.perspectiveNearDistance(h.width,h.height,d),this.nearDistance>v&&(this.nearDistance=v)),this.nearDistance<1&&(this.nearDistance=1),m.setToPerspectiveProjection(h.width,h.height,this.nearDistance,this.farDistance),new r(s,m,h,this.heading,this.tilt)},a}),n("gesture/PanRecognizer",["../gesture/GestureRecognizer"],function(e){"use strict";var t=function(t,n){e.call(this,t,n),this.minNumberOfTouches=1,this.maxNumberOfTouches=Number.MAX_VALUE,this.interpretDistance=20};return t.prototype=Object.create(e.prototype),t.prototype.mouseDown=function(e){this.state==WorldWind.POSSIBLE&&(this.state=WorldWind.FAILED)},t.prototype.touchMove=function(e){if(this.state==WorldWind.POSSIBLE)this.shouldInterpret()&&(this.shouldRecognize()?this.state=WorldWind.BEGAN:this.state=WorldWind.FAILED);else if(this.state==WorldWind.BEGAN||this.state==WorldWind.CHANGED)this.state=WorldWind.CHANGED},t.prototype.touchEnd=function(e){if(this.touchCount==0)if(this.state==WorldWind.POSSIBLE)this.state=WorldWind.FAILED;else if(this.state==WorldWind.BEGAN||this.state==WorldWind.CHANGED)this.state=WorldWind.ENDED},t.prototype.touchCancel=function(e){if(this.touchCount==0)if(this.state==WorldWind.POSSIBLE)this.state=WorldWind.FAILED;else if(this.state==WorldWind.BEGAN||this.state==WorldWind.CHANGED)this.state=WorldWind.CANCELLED},t.prototype.prepareToRecognize=function(){this.translationX=0,this.translationY=0},t.prototype.shouldInterpret=function(){var e=this.translationX,t=this.translationY,n=Math.sqrt(e*e+t*t);return n>this.interpretDistance},t.prototype.shouldRecognize=function(){var e=this.touchCount;return e!=0&&e>=this.minNumberOfTouches&&e<=this.maxNumberOfTouches},t}),n("gesture/PinchRecognizer",["../gesture/GestureRecognizer"],function(e){"use strict";var t=function(t,n){e.call(this,t,n),this._scale=1,this._offsetScale=1,this.referenceDistance=0,this.interpretThreshold=20,this.weight=.4,this.pinchTouches=[]};return t.prototype=Object.create(e.prototype),Object.defineProperties(t.prototype,{scale:{get:function(){return this._scale*this._offsetScale}}}),t.prototype.reset=function(){e.prototype.reset.call(this),this._scale=1,this._offsetScale=1,this.referenceDistance=0,this.pinchTouches=[]},t.prototype.mouseDown=function(e){this.state==WorldWind.POSSIBLE&&(this.state=WorldWind.FAILED)},t.prototype.touchStart=function(e){this.pinchTouches.length<2&&this.pinchTouches.push(e)==2&&(this.referenceDistance=this.currentPinchDistance(),this._offsetScale*=this._scale,this._scale=1)},t.prototype.touchMove=function(e){if(this.pinchTouches.length==2)if(this.state==WorldWind.POSSIBLE)this.shouldRecognize()&&(this.state=WorldWind.BEGAN);else if(this.state==WorldWind.BEGAN||this.state==WorldWind.CHANGED){var t=this.currentPinchDistance(),n=Math.abs(t/this.referenceDistance),r=this.weight;this._scale=this._scale*(1-r)+n*r,this.state=WorldWind.CHANGED}},t.prototype.touchEnd=function(e){var t=this.pinchTouches.indexOf(e);t!=-1&&this.pinchTouches.splice(t,1);if(this.touchCount==0)if(this.state==WorldWind.POSSIBLE)this.state=WorldWind.FAILED;else if(this.state==WorldWind.BEGAN||this.state==WorldWind.CHANGED)this.state=WorldWind.ENDED},t.prototype.touchCancel=function(e){var t=this.pinchTouches.indexOf(e);t!=-1&&this.pinchTouches.splice(t,1);if(this.touchCount==0)if(this.state==WorldWind.POSSIBLE)this.state=WorldWind.FAILED;else if(this.state==WorldWind.BEGAN||this.state==WorldWind.CHANGED)this.state=WorldWind.CANCELLED},t.prototype.prepareToRecognize=function(){this.referenceDistance=this.currentPinchDistance(),this._scale=1},t.prototype.shouldRecognize=function(){var e=this.currentPinchDistance();return Math.abs(e-this.referenceDistance)>this.interpretThreshold},t.prototype.currentPinchDistance=function(){var e=this.pinchTouches[0],t=this.pinchTouches[1],n=e.clientX-t.clientX,r=e.clientY-t.clientY;return Math.sqrt(n*n+r*r)},t}),n("gesture/RotationRecognizer",["../geom/Angle","../gesture/GestureRecognizer"],function(e,t){"use strict";var n=function(e,n){t.call(this,e,n),this._rotation=0,this._offsetRotation=0,this.referenceAngle=0,this.interpretThreshold=20,this.weight=.4,this.rotationTouches=[]};return n.prototype=Object.create(t.prototype),Object.defineProperties(n.prototype,{rotation:{get:function(){return this._rotation+this._offsetRotation}}}),n.prototype.reset=function(){t.prototype.reset.call(this),this._rotation=0,this._offsetRotation=0,this.referenceAngle=0,this.rotationTouches=[]},n.prototype.mouseDown=function(e){this.state==WorldWind.POSSIBLE&&(this.state=WorldWind.FAILED)},n.prototype.touchStart=function(e){this.rotationTouches.length<2&&this.rotationTouches.push(e)==2&&(this.referenceAngle=this.currentTouchAngle(),this._offsetRotation+=this._rotation,this._rotation=0)},n.prototype.touchMove=function(t){if(this.rotationTouches.length==2)if(this.state==WorldWind.POSSIBLE)this.shouldRecognize()&&(this.state=WorldWind.BEGAN);else if(this.state==WorldWind.BEGAN||this.state==WorldWind.CHANGED){var n=this.currentTouchAngle(),r=e.normalizedDegrees(n-this.referenceAngle),i=this.weight;this._rotation=this._rotation*(1-i)+r*i,this.state=WorldWind.CHANGED}},n.prototype.touchEnd=function(e){var t=this.rotationTouches.indexOf(e);t!=-1&&this.rotationTouches.splice(t,1);if(this.touchCount==0)if(this.state==WorldWind.POSSIBLE)this.state=WorldWind.FAILED;else if(this.state==WorldWind.BEGAN||this.state==WorldWind.CHANGED)this.state=WorldWind.ENDED},n.prototype.touchCancel=function(e){var t=this.rotationTouches.indexOf(e);if(t!=-1){this.rotationTouches.splice(t,1);if(this.touchCount==0)if(this.state==WorldWind.POSSIBLE)this.state=WorldWind.FAILED;else if(this.state==WorldWind.BEGAN||this.state==WorldWind.CHANGED)this.state=WorldWind.CANCELLED}},n.prototype.prepareToRecognize=function(){this.referenceAngle=this.currentTouchAngle(),this._rotation=0},n.prototype.shouldRecognize=function(){var t=this.currentTouchAngle(),n=e.normalizedDegrees(t-this.referenceAngle);return Math.abs(n)>this.interpretThreshold},n.prototype.currentTouchAngle=function(){var t=this.rotationTouches[0],n=this.rotationTouches[1],r=t.clientX-n.clientX,i=t.clientY-n.clientY;return Math.atan2(i,r)*e.RADIANS_TO_DEGREES},n}),n("gesture/TiltRecognizer",["../gesture/PanRecognizer"],function(e){"use strict";var t=function(t,n){e.call(this,t,n),this.maxTouchDistance=250,this.maxTouchDivergence=50};return t.LEFT=1,t.RIGHT=2,t.UP=4,t.DOWN=8,t.prototype=Object.create(e.prototype),t.prototype.shouldInterpret=function(){for(var e=0,t=this.touchCount;ethis.interpretDistance)return!0}return!1},t.prototype.shouldRecognize=function(){var e=this.touchCount;if(e<2)return!1;var n=this.touch(0),r=this.touch(1),i=n.clientX-r.clientX,s=n.clientY-r.clientY,o=Math.sqrt(i*i+s*s);if(o>this.maxTouchDistance)return!1;var u=n.translationX-r.translationX,a=n.translationY-r.translationY,f=Math.sqrt(u*u+a*a);if(f>this.maxTouchDivergence)return!1;var l=t.UP|t.DOWN,c=this.touchDirection(n)&l,h=this.touchDirection(r)&l;return(c&h)!=0},t.prototype.touchDirection=function(e){var n=e.translationX,r=e.translationY,i=0;return Math.abs(n)>Math.abs(r)?(i|=n<0?t.LEFT:0,i|=n>0?t.RIGHT:0):(i|=r<0?t.UP:0,i|=r>0?t.DOWN:0),i},t}),n("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(e,t,n,r,i,s,o,u,a,f,l,c,h,p,d,v,m){"use strict";var g=function(e){function n(e){e.preventDefault()}a.call(this,e),e.addEventListener("mousedown",n),e.addEventListener("touchstart",n),e.addEventListener("contextmenu",n),e.addEventListener("wheel",n),window.PointerEvent&&e.canvas.style.setProperty("touch-action","none"),this.lookAtLocation=new s(30,-110),this.range=1e7,this.enable2DLimits=!0;var r=this;this.primaryDragRecognizer=new t(e,function(e){r.handlePanOrDrag(e)}),this.secondaryDragRecognizer=new t(e,function(e){r.handleSecondaryDrag(e)}),this.secondaryDragRecognizer.button=2,this.panRecognizer=new f(e,function(e){r.handlePanOrDrag(e)}),this.pinchRecognizer=new l(e,function(e){r.handlePinch(e)}),this.rotationRecognizer=new h(e,function(e){r.handleRotation(e)}),this.tiltRecognizer=new p(e,function(e){r.handleTilt(e)}),e.addEventListener("wheel",function(e){r.handleWheelEvent(e)}),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 d(0,0),this.lastPoint=new d(0,0),this.beginHeading=0,this.beginTilt=0,this.beginRange=0,this.lastRotation=0};return g.prototype=Object.create(a.prototype),g.prototype.currentState=function(){this.applyLimits();var e=this.worldWindow.globe,t=new c(this.lookAtLocation.latitude,this.lookAtLocation.longitude,0),n=u.fromIdentity();return n.multiplyByLookAtModelview(t,this.range,this.heading,this.tilt,this.roll,e),this.currentStateForModelview(n)},g.prototype.handlePanOrDrag=function(e){this.worldWindow.globe.is2D()?this.handlePanOrDrag2D(e):this.handlePanOrDrag3D(e)},g.prototype.handlePanOrDrag3D=function(t){var n=t.state,r=t.translationX,i=t.translationY;if(n==WorldWind.BEGAN)this.lastPoint.set(0,0);else if(n==WorldWind.CHANGED){var s=this.worldWindow.canvas,o=this.worldWindow.globe,u=m.max(o.equatorialRadius,o.polarRadius),a=m.max(1,this.range),f=m.perspectivePixelSize(s.clientWidth,s.clientHeight,a),l=(i-this.lastPoint[1])*f,c=-(r-this.lastPoint[0])*f,h=l/u*e.RADIANS_TO_DEGREES,p=c/u*e.RADIANS_TO_DEGREES,d=Math.sin(this.heading*e.DEGREES_TO_RADIANS),v=Math.cos(this.heading*e.DEGREES_TO_RADIANS);this.lookAtLocation.latitude+=h*v-p*d,this.lookAtLocation.longitude+=h*d+p*v,this.lastPoint.set(r,i),this.applyLimits(),this.worldWindow.redraw()}},g.prototype.handlePanOrDrag2D=function(e){var t=e.state,n=e.clientX,r=e.clientY,i=e.translationX,s=e.translationY;if(t==WorldWind.BEGAN)this.beginPoint.set(n,r),this.lastPoint.set(n,r);else if(t==WorldWind.CHANGED){var o=this.lastPoint[0],a=this.lastPoint[1],f=this.beginPoint[0]+i,l=this.beginPoint[1]+s;this.lastPoint.set(f,l);var c=this.currentState(),h=this.worldWindow.globe,p=c.rayFromScreenPoint(this.worldWindow.canvasCoordinates(o,a)),d=new v(0,0,0),m=new v(0,0,0),g=new v(0,0,0);if(!h.intersectsLine(p,d))return;p=c.rayFromScreenPoint(this.worldWindow.canvasCoordinates(f,l));if(!h.intersectsLine(p,m))return;var y=u.fromIdentity();y.copy(c.modelview),y.multiplyByTranslation(m[0]-d[0],m[1]-d[1],m[2]-d[2]),y.extractEyePoint(p.origin),y.extractForwardVector(p.direction);if(!h.intersectsLine(p,g))return;var b=y.extractViewingParameters(g,this.roll,h,{});this.lookAtLocation.copy(b.origin),this.range=b.range,this.heading=b.heading,this.tilt=b.tilt,this.roll=b.roll,this.applyLimits(),this.worldWindow.redraw()}},g.prototype.handleSecondaryDrag=function(e){var t=e.state,n=e.translationX,r=e.translationY;if(t==WorldWind.BEGAN)this.beginHeading=this.heading,this.beginTilt=this.tilt;else if(t==WorldWind.CHANGED){var i=180*n/this.worldWindow.canvas.clientWidth,s=90*r/this.worldWindow.canvas.clientHeight;this.heading=this.beginHeading+i,this.tilt=this.beginTilt+s,this.applyLimits(),this.worldWindow.redraw()}},g.prototype.handlePinch=function(e){var t=e.state,n=e.scale;t==WorldWind.BEGAN?this.beginRange=this.range:t==WorldWind.CHANGED&&n!=0&&(this.range=this.beginRange/n,this.applyLimits(),this.worldWindow.redraw())},g.prototype.handleRotation=function(e){var t=e.state,n=e.rotation;t==WorldWind.BEGAN?this.lastRotation=0:t==WorldWind.CHANGED&&(this.heading-=n-this.lastRotation,this.lastRotation=n,this.applyLimits(),this.worldWindow.redraw())},g.prototype.handleTilt=function(e){var t=e.state,n=e.translationY;if(t==WorldWind.BEGAN)this.beginTilt=this.tilt;else if(t==WorldWind.CHANGED){var r=-90*n/this.worldWindow.canvas.clientHeight;this.tilt=this.beginTilt+r,this.applyLimits(),this.worldWindow.redraw()}},g.prototype.handleWheelEvent=function(e){var t;e.deltaMode==WheelEvent.DOM_DELTA_PIXEL?t=e.deltaY:e.deltaMode==WheelEvent.DOM_DELTA_LINE?t=e.deltaY*40:e.deltaMode==WheelEvent.DOM_DELTA_PAGE&&(t=e.deltaY*400);var n=1+t/1e3;this.range*=n,this.applyLimits(),this.worldWindow.redraw()},g.prototype.applyLimits=function(){this.lookAtLocation.latitude=m.clamp(this.lookAtLocation.latitude,-90,90),this.lookAtLocation.longitude=e.normalizedDegreesLongitude(this.lookAtLocation.longitude),this.range=m.clamp(this.range,1,Number.MAX_VALUE),this.heading=e.normalizedDegrees(this.heading),this.tilt=m.clamp(this.tilt,0,90),this.roll=e.normalizedDegrees(this.roll);if(this.worldWindow.globe.is2D()&&this.enable2DLimits){var t=2*Math.PI*this.worldWindow.globe.equatorialRadius;this.range=m.clamp(this.range,1,t),this.tilt=0}},g}),n("cache/MemoryCacheListener",["../util/Logger","../error/UnsupportedOperationError"],function(e,t){"use strict";var n=function(){};return n.prototype.entryRemoved=function(n,r){throw new t(e.logMessage(e.LEVEL_SEVERE,"MemoryCacheListener","entryRemoved","abstractInvocation"))},n.prototype.removalError=function(n,r,i){throw new t(e.logMessage(e.LEVEL_SEVERE,"MemoryCacheListener","removalError","abstractInvocation"))},n}),n("util/NominatimGeocoder",["../util/Logger"],function(e){"use strict";var t=function(){this.service="https://open.mapquestapi.com/nominatim/v1/search/"};return t.prototype.lookup=function(e,t,n){var r=this.service+e.replace(" ","%20")+"?format=json",i=new XMLHttpRequest,s=this;r+="&key="+(n||"lUvVRchXGGDh5Xwk3oidrXeIDAAevOUS"),i.open("GET",r,!0),i.onreadystatechange=function(){if(i.readyState===4&&i.status===200){var e=JSON.parse(i.responseText);t(s,e)}},i.send(null)},t}),n("layer/OpenStreetMapImageLayer",["../geom/Angle","../util/Color","../geom/Location","../geom/Sector","../layer/MercatorTiledImageLayer"],function(e,t,n,r,i){"use strict";var s=function(e){this.imageSize=256,e=e||"Open Street Map",i.call(this,new r(-85.05,85.05,-180,180),new n(85.05,180),19,"image/png",e,this.imageSize,this.imageSize),this.displayName=e,this.pickEnabled=!1,this.destCanvas=document.createElement("canvas"),this.destContext=this.destCanvas.getContext("2d"),this.urlBuilder={urlForTile:function(e,t){return"http://otile1.mqcdn.com/tiles/1.0.0/osm/"+(e.level.levelNumber+1)+"/"+e.column+"/"+e.row+".png"}}};return s.prototype=Object.create(i.prototype),s.prototype.doRender=function(e){i.prototype.doRender.call(this,e),this.inCurrentFrame&&(e.screenCreditController.addStringCredit("©OpenStreetMap",t.DARK_GRAY),e.screenCreditController.addStringCredit("Tiles Courtesy of MapQuest",t.DARK_GRAY))},s.prototype.createTopLevelTiles=function(e){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))},s.prototype.mapSizeForLevel=function(e){return 256<1?o-1:1),g=(v-d)/(u>1?u-1:1),y=this.projectionLimits.minLatitude*e.DEGREES_TO_RADIANS,b=this.projectionLimits.maxLatitude*e.DEGREES_TO_RADIANS,w=this.north?1:-1,E=f?f:new Vec3(0,0,0),S,x,T=0,N=0,C,k,L,A;for(S=0,C=h;SMath.PI&&(l=Math.PI),a.latitude=Math.asin(Math.cos(l)*(this.north?1:-1))*e.RADIANS_TO_DEGREES,a.longitude=Math.atan2(i,s*(this.north?-1:1))*e.RADIANS_TO_DEGREES,a.altitude=o),a},o.prototype.northTangentAtLocation=function(n,i,s,o){if(!o)throw new t(r.logMessage(r.LEVEL_SEVERE,"ProjectionGnomonic","northTangentAtLocation","missingResult"));return o[0]=Math.sin(s*e.DEGREES_TO_RADIANS)*(this.north?-1:1),o[1]=Math.cos(s*e.DEGREES_TO_RADIANS),o[2]=0,o},o.prototype.northTangentAtPoint=function(e,n,i,s,o,u){if(!u)throw new t(r.logMessage(r.LEVEL_SEVERE,"ProjectionGnomonic","northTangentAtLocation","missingResult"));var a=Math.sqrt(n*n+i*i);return a<1e-4?(u[0]=0,u[1]=1,u[2]=0):(u[0]=n/a*(this.north?-1:1),u[1]=i/a*(this.north?-1:1),u[2]=0),u},o}),n("projections/ProjectionMercator",["../geom/Angle","../error/ArgumentError","../projections/GeographicProjection","../util/Logger","../geom/Sector","../geom/Vec3","../util/WWMath"],function(e,t,n,r,i,s,o){"use strict";var u=function(){n.call(this,"Mercator",!0,new i(-78,78,-180,180))};return u.prototype=Object.create(n.prototype),u.prototype.geographicToCartesian=function(n,i,s,o,u,a){if(!n)throw new t(r.logMessage(r.LEVEL_SEVERE,"ProjectionMercator","geographicToCartesian","missingGlobe"));if(!a)throw new t(r.logMessage(r.LEVEL_SEVERE,"ProjectionMercator","geographicToCartesian","missingResult"));i>this.projectionLimits.maxLatitude&&(i=this.projectionLimits.maxLatitude),i1?u-1:1),w=(y-g)/(a>1?a-1:1),E=this.projectionLimits.minLatitude*e.DEGREES_TO_RADIANS,S=this.projectionLimits.maxLatitude*e.DEGREES_TO_RADIANS,x=l?l:new s(0,0,0),T=c?c[0]:0,N,C,k=0,L=0,A,O,M,_,D,P;for(N=0,A=v;N1?s-1:1),g=(v-d)/(o>1?o-1:1),y=this.north?-1:1,b=a?a:new Vec3(0,0,0),w=Math.PI/2,E,S,x=0,T=0,N=new Float64Array(o),C=new Float64Array(o),k,L,A;for(S=0,L=d;SMath.PI&&(l=Math.PI),a.latitude=Math.asin(Math.cos(l)*(this.north?1:-1))*e.RADIANS_TO_DEGREES,a.longitude=Math.atan2(i,s*(this.north?-1:1))*e.RADIANS_TO_DEGREES,a.altitude=o),a},i.prototype.northTangentAtLocation=function(n,i,s,o){if(!o)throw new t(r.logMessage(r.LEVEL_SEVERE,"ProjectionPolarEquidistant","northTangentAtLocation","missingResult"));return o[0]=Math.sin(s*e.DEGREES_TO_RADIANS)*(this.north?-1:1),o[1]=Math.cos(s*e.DEGREES_TO_RADIANS),o[2]=0,o},i.prototype.northTangentAtPoint=function(e,n,i,s,o,u){if(!u)throw new t(r.logMessage(r.LEVEL_SEVERE,"ProjectionPolarEquidistant","northTangentAtLocation","missingResult"));var a=Math.sqrt(n*n+i*i);return a<1e-4?(u[0]=0,u[1]=1,u[2]=0):(u[0]=n/a*(this.north?-1:1),u[1]=i/a*(this.north?-1:1),u[2]=0),u},i}),n("projections/ProjectionUPS",["../geom/Angle","../error/ArgumentError","../projections/GeographicProjection","../util/Logger","../geom/Sector","../geom/Vec3","../util/WWMath"],function(e,t,n,r,i,s,o){"use strict";var u=function(e){this.north=e!=="South";var t=this.north?new i(0,90,-180,180):new i(-90,0,-180,180);n.call(this,"Uniform Polar Stereographic",!1,t),this._pole=e,this.displayName=this.north?"North UPS":"South UPS",this._stateKey="projection ups "+this._pole+" "};return u.prototype=Object.create(n.prototype),Object.defineProperties(u.prototype,{pole:{get:function(){return this._pole},set:function(e){this._pole=e,this.north=this._pole!=="South",this.projectionLimits=this.north?new i(0,90,-180,180):new i(-90,0,-180,180),this._stateKey="projection ups "+this._pole+" "}},stateKey:{get:function(){return this._stateKey}}}),u.prototype.geographicToCartesian=function(n,i,s,o,u,a){if(!n)throw new t(r.logMessage(r.LEVEL_SEVERE,"ProjectionUPS","geographicToCartesian","missingGlobe"));if(!a)throw new t(r.logMessage(r.LEVEL_SEVERE,"ProjectionUPS","geographicToCartesian","missingResult"));if(this.north&&i===90||!this.north&&i===-90)a[0]=0,a[1]=0,a[2]=o;else{var f=this.north?1:-1,l=i*e.DEGREES_TO_RADIANS,c=s*e.DEGREES_TO_RADIANS,h=.994,p=Math.sqrt(n.eccentricitySquared),d=Math.sqrt(Math.pow(1+p,1+p)*Math.pow(1-p,1-p)),v,m,g;if(this.north&&l<0||!this.north&&l>0)l=0;v=Math.sin(l*f),m=Math.sqrt((1-v)/(1+v)*Math.pow((1+p*v)/(1-p*v),p)),g=2*n.equatorialRadius*h*m/d,a[0]=g*Math.sin(c),a[1]=-g*Math.cos(c)*f,a[2]=o}return a},u.prototype.geographicToCartesianGrid=function(n,i,u,a,f,l,c,h){if(!n)throw new t(r.logMessage(r.LEVEL_SEVERE,"ProjectionUPS","geographicToCartesianGrid","missingGlobe"));if(!i)throw new t(r.logMessage(r.LEVEL_SEVERE,"ProjectionUPS","geographicToCartesianGrid","missingSector"));if(!f||f.length1?u-1:1),b=(g-m)/(a>1?a-1:1),w=this.projectionLimits.minLatitude*e.DEGREES_TO_RADIANS,E=this.projectionLimits.maxLatitude*e.DEGREES_TO_RADIANS,S=.994,x=Math.sqrt(n.eccentricitySquared),T=Math.sqrt(Math.pow(1+x,1+x)*Math.pow(1-x,1-x)),N=this.north?1:-1,C=l?l:new s(0,0,0),k,L,A=0,O=0,M,_,D,P,H,B;for(k=0,M=d;k "+h.toString()+" ["+d+"]")}}},s}),n("formats/shapefile/DBaseFile",["../../error/ArgumentError","../../util/ByteBuffer","../../formats/shapefile/DBaseField","../../formats/shapefile/DBaseRecord","../../util/Logger"],function(e,t,n,r,i){"use strict";var s=function(t){if(!t)throw new e(i.logMessage(i.LEVEL_SEVERE,"DBaseFile","constructor","missingUrl"));this.url=t,this.header=null,this.fields=null,this.buffer=null,this.boolean=!0,this.numRecordsRead=0,this._completionCallback=null};return s.prototype.getLastModificationDate=function(){return this.header.lastModificationDate},s.prototype.getNumberOfRecords=function(){return this.header.numberOfRecords},s.prototype.getHeaderLength=function(){return this.header.headerLength},s.prototype.getRecordLength=function(){return this.header.recordLength},s.prototype.getNumberOfFields=function(){return(this.header.headerLength-1-s.FIXED_HEADER_LENGTH)/s.FIELD_DESCRIPTOR_LENGTH},s.prototype.getFields=function(){return this.fields},s.prototype.hasNext=function(){return this.numRecordsRead=this.getNumberOfRecords()?null:this.readNextRecord(this._buffer,++this.numRecordsRead)},s.prototype.load=function(e){this._completionCallback=e,this.requestUrl(this.url)},s.prototype.requestUrl=function(e){var n=new XMLHttpRequest;n.open("GET",e,!0),n.responseType="arraybuffer",n.onreadystatechange=function(){n.readyState===4&&(n.status===200?(this._buffer=new t(n.response),this.parse(),!this._completionCallback||this._completionCallback(this)):(i.log(i.LEVEL_WARNING,"DBaseFile retrieval failed ("+n.statusText+"): "+e),!this._completionCallback||this._completionCallback(this)))}.bind(this),n.onerror=function(){i.log(i.LEVEL_WARNING,"DBaseFile retrieval failed: "+e),!this._completionCallback||this._completionCallback(this)},n.ontimeout=function(){i.log(i.LEVEL_WARNING,"DBaseFile retrieval timed out: "+e),!this._completionCallback||this._completionCallback(this)},n.send(null)},s.prototype.parse=function(){this.header=this.readHeader(this._buffer),this.fields=this.readFieldDescriptors(this._buffer,this.getNumberOfFields())},s.prototype.readHeader=function(e){var n=e.position;e.order(t.LITTLE_ENDIAN);var r=e.getByte();if(r>5)throw new Error("???");var i=e.getByte(),o=e.getByte(),u=e.getByte(),a=e.getInt32(),f=e.getInt16(),l=e.getInt16(),c={year:1900+i,month:o-1,day:u},h={fileCode:r,lastModificationDate:c,numberOfRecords:a,headerLength:f,recordLength:l};return e.seek(n+s.FIXED_HEADER_LENGTH),h},s.prototype.readFieldDescriptors=function(e,t){var r=e.position,i=[];for(var o=0;o=0&&e0&&this._numberOfPoints>0){var t=this._buffer.getInt32Array(this.numberOfParts);for(var n=0;n=this.numberOfPoints*8)if(e){this._mValues=this._buffer.getDoubleArray(1);var t=this._mValues[0];this._mRange=[t,t]}else this._mRange=this._buffer.getDoubleArray(2),this._mValues=this._buffer.getDoubleArray(this.numberOfPoints)},o.normalizeLocations=function(t){for(var n=0,r=t.length;n90&&(i=e.normalizedDegreesLatitude(n[1]),n[1]=90,r=!0,n[0]>i&&(n[0]=i));if(n[2]<-180||n[3]>180)n[2]=-180,n[3]=180,r=!0;return{coords:n,isNormalized:r}},T.prototype.readProjectedBoundingRectangle=function(e){throw new u(o.log(o.LEVEL_SEVERE,"Shapefile.readProjectedBoundingRectangle() not yet implemented"))},T.prototype.readBoundingRectangleCoordinates=function(e){var t=e.getDouble(),n=e.getDouble(),r=e.getDouble(),i=e.getDouble();return[n,i,t,r]},T.prototype.readRecord=function(e){var t=this.createRecord(e);if(t!=null&&this.attributeFile!=null&&this.attributeFile.hasNext()){var n=this.attributeFile.nextRecord();t.setAttributes(n)}return t},T.prototype.createRecord=function(e){return this.isNullType()?this.createNull(e):this.isPointType()?this.createPoint(e):this.isMultiPointType()?this.createMultiPoint(e):this.isPolygonType()?this.createPolygon(e):this.isPolylineType()?this.createPolyline(e):null},T.prototype.createNull=function(e){return new y(this,e)},T.prototype.createPoint=function(e){return new b(this,e)},T.prototype.createMultiPoint=function(e){return new g(this,e)},T.prototype.createPolyline=function(e){return new E(this,e)},T.prototype.createPolygon=function(e){return new w(this,e)},T.prototype.getShapeType=function(e){switch(e){case 0:return T.NULL;case 1:return T.POINT;case 3:return T.POLYLINE;case 5:return T.POLYGON;case 8:return T.MULTI_POINT;case 11:return T.POINT_Z;case 13:return T.POLYLINE_Z;case 15:return T.POLYGON_Z;case 18:return T.MULTI_POINT_Z;case 21:return T.POINT_M;case 23:return T.POLYLINE_M;case 25:return T.POLYGON_M;case 28:return T.MULTI_POINT_M;default:return null}},T.prototype.isMeasureType=function(){return T.measureTypes.hasOwnProperty(this._shapeType)},T.prototype.isZType=function(){return T.zTypes.hasOwnProperty(this._shapeType)},T.prototype.isNullType=function(){return this._shapeType===T.NULL},T.prototype.isPointType=function(){return T.pointTypes.hasOwnProperty(this._shapeType)},T.prototype.isMultiPointType=function(){return T.multiPointTypes.hasOwnProperty(this._shapeType)},T.prototype.isPolylineType=function(){return T.polylineTypes.hasOwnProperty(this._shapeType)},T.prototype.isPolygonType=function(){return T.polygonTypes.hasOwnProperty(this._shapeType)},T.NULL="null",T.POINT="point",T.MULTI_POINT="multiPoint",T.POLYLINE="polyline",T.POLYGON="polygon",T.POINT_M=T.POINT+"M",T.MULTI_POINT_M=T.MULTI_POINT+"M",T.POLYLINE_M=T.POLYLINE+"M",T.POLYGON_M=T.POLYGON+"M",T.POINT_Z=T.POINT+"Z",T.MULTI_POINT_Z=T.MULTI_POINT+"Z",T.POLYLINE_Z=T.POLYLINE+"Z",T.POLYGON_Z=T.POLYGON+"Z",T.SHAPE_MULTI_PATCH="multiPatch",T.measureTypes={pointM:T.POINT_M,pointZ:T.POINT_Z,multiPointM:T.MULTI_POINT_M,multiPointZ:T.MULTI_POINT_Z,polylineM:T.POLYLINE_M,polylineZ:T.POLYLINE_Z,polygonM:T.POLYGON_M,polygonZ:T.POLYGON_Z},T.zTypes={pointZ:T.POINT_Z,multiPointZ:T.MULTI_POINT_Z,polylineZ:T.POLYLINE_Z,polygonZ:T.POLYGON_Z},T.pointTypes={point:T.POINT,pointZ:T.POINT_Z,pointM:T.POINT_M},T.multiPointTypes={multiPoint:T.MULTI_POINT,multiPointZ:T.MULTI_POINT_Z,multiPointM:T.MULTI_POINT_M},T.polylineTypes={polyline:T.POLYLINE,polylineZ:T.POLYLINE_Z,polylineM:T.POLYLINE_M},T.polygonTypes={polygon:T.POLYGON,polygonZ:T.POLYGON_Z,polygonM:T.POLYGON_M},T.FILE_CODE=9994,T}),n("layer/ShowTessellationLayer",["../shaders/BasicProgram","../layer/Layer"],function(e,t){"use strict";var n=function(){t.call(this,"Show Tessellation"),this.enableTerrainGeometry=!0,this.enableTerrainExtent=!1};return n.prototype=Object.create(t.prototype),n.prototype.doRender=function(e){try{this.beginRendering(e),this.enableTerrainGeometry&&this.drawTerrainGeometry(e),this.enableTerrainExtent&&this.drawTerrainExtent(e)}finally{this.endRendering(e)}},n.prototype.beginRendering=function(e){var t=e.currentGlContext;t.depthMask(!1)},n.prototype.endRendering=function(e){var t=e.currentGlContext;t.depthMask(!0)},n.prototype.drawTerrainGeometry=function(t){if(!t.terrain||!t.terrain.tessellator)return;var n=t.currentGlContext,r=t.terrain,i=r.tessellator,s=r.surfaceGeometry,o,u;try{o=t.findAndBindProgram(e),i.beginRendering(t);for(var a=0,f=s.length;athis.numberOfTouches?this.state=WorldWind.FAILED:this.touchCount==1?(t={touchCount:this.touchCount,clientX:this.clientX,clientY:this.clientY},this.taps.push(t),this.failAfterDelay(this.maxTapDuration)):(t=this.taps[this.taps.length-1],t.touchCount=this.touchCount,t.clientX=this.clientX,t.clientY=this.clientY)},t.prototype.touchMove=function(e){if(this.state!=WorldWind.POSSIBLE)return;var t=this.translationX,n=this.translationY,r=Math.sqrt(t*t+n*n);r>this.maxTouchMovement&&(this.state=WorldWind.FAILED)},t.prototype.touchEnd=function(e){if(this.state!=WorldWind.POSSIBLE)return;if(this.touchCount!=0)return;var t=this.taps.length,n=this.taps[t-1];n.touchCount!=this.numberOfTouches?this.state=WorldWind.FAILED:t==this.numberOfTaps?(this.clientX=this.taps[0].clientX,this.clientY=this.taps[0].clientY,this.state=WorldWind.RECOGNIZED):this.failAfterDelay(this.maxTapInterval)},t.prototype.touchCancel=function(e){if(this.state!=WorldWind.POSSIBLE)return;this.state=WorldWind.FAILED},t.prototype.failAfterDelay=function(e){var t=this;t.timeout&&window.clearTimeout(t.timeout),t.timeout=window.setTimeout(function(){t.timeout=null,t.state==WorldWind.POSSIBLE&&(t.state=WorldWind.FAILED)},e)},t.prototype.cancelFailAfterDelay=function(){var e=this;e.timeout&&(window.clearTimeout(e.timeout),e.timeout=null)},t}),n("layer/TectonicPlatesLayer",["../error/ArgumentError","../util/Color","../geom/Location","../util/Logger","../layer/RenderableLayer","../shapes/ShapeAttributes","../shapes/SurfacePolygon"],function(e,t,n,r,i,s,o){"use strict";var u=function(e){i.call(this,"Tectonic Plates"),e?this._attributes=e:(this._attributes=new s(null),this._attributes.drawInterior=!1,this._attributes.drawOutline=!0,this._attributes.outlineColor=t.RED),this.loadPlateData()};return u.prototype=Object.create(i.prototype),Object.defineProperties(o.prototype,{attributes:{get:function(){return this._attributes},set:function(e){e&&this.renderables.map(function(t,n,r){t.attributes=e})}}}),u.prototype.loadPlateData=function(){var e="http://worldwindserver.net/webworldwind/data/TectonicPlates.json",t=new XMLHttpRequest;t.open("GET",e,!0),t.onreadystatechange=function(){t.readyState===4&&(t.status===200?this.parse(t.responseText):r.log(r.LEVEL_WARNING,"Tectonic plate data retrieval failed ("+t.statusText+"): "+e))}.bind(this),t.onerror=function(){r.log(r.LEVEL_WARNING,"Tectonic plate data retrieval failed: "+e)},t.ontimeout=function(){r.log(r.LEVEL_WARNING,"Tectonic plate data retrieval timed out: "+e)},t.send(null)},u.prototype.parse=function(e){var t=JSON.parse(e),r=this;t.features.map(function(e,t,i){var s=[];e.geometry.coordinates.map(function(e,t,r){s.push(new n(e[1],e[0]))});var u=new o(s,r._attributes);r.addRenderable(u)})},u}),n("util/TileFactory",["../util/Logger","../error/UnsupportedOperationError"],function(e,t){"use strict";var n=function(){};return n.prototype.createTile=function(n,r,i,s){throw new t(e.logMessage(e.LEVEL_SEVERE,"TileFactory","createTile","abstractInvocation"))},n}),n("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(e,t,n,r,i,s,o,u,a,f,l,c,h,p,d){"use strict";var v=function(n,r,i){if(!n)throw new t(u.logMessage(u.LEVEL_SEVERE,"TriangleMesh","constructor","missingPositions"));if(n.length<1)throw new t(u.logMessage(u.LEVEL_SEVERE,"TriangleMesh","constructor","missingPositions"));if(n.length>65536)throw new t(u.logMessage(u.LEVEL_SEVERE,"TriangleMesh","constructor","Too many positions. Must be fewer than 65537. Use TriangleMesh.split to split the shape."));if(!r)throw new t(u.logMessage(u.LEVEL_SEVERE,"TriangleMesh","constructor","Indices array is null or undefined"));if(r.length<3)throw new t(u.logMessage(u.LEVEL_SEVERE,"TriangleMesh","constructor","Too few indices."));e.call(this,i),this._positions=n,this._indices=r,this.referencePosition=this._positions[0]};return v.prototype=Object.create(e.prototype),Object.defineProperties(v.prototype,{positions:{get:function(){return this._positions},set:function(e){if(!e)throw new t(u.logMessage(u.LEVEL_SEVERE,"TriangleMesh","positions","missingPositions"));this._positions=e,this.referencePosition=this._positions[0],this.reset()}},indices:{get:function(){return this._indices},set:function(e){if(!e)throw new t(u.logMessage(u.LEVEL_SEVERE,"TriangleMesh","indices","Indices array is null or undefined"));this._indices=e,this.meshIndices=null,this.reset()}},outlineIndices:{get:function(){return this._outlineIndices},set:function(e){this._outlineIndices=e,this.meshOutlineIndices=null,this.reset()}},textureCoordinates:{get:function(){return this._textureCoordinates},set:function(e){if(e&&e.length!=this._positions.length)throw new t(u.logMessage(u.LEVEL_SEVERE,"TriangleMesh","textureCoordinates","Number of texture coordinates is inconsistent with the currently specified positions."));this._textureCoordinates=e,this.reset(),this.texCoords=null}}}),v.prototype.createSurfaceShape=function(){if(this._outlineIndices){var e=[];for(var t=0;t65533&&o.length%3===0){if(i.length>0){var h={positions:i,indices:o};n&&(h.textureCoords=s);if(r){var p=[];for(var d=0;d=r.screenOffset.x&&t<=r.screenOffset.x+r.size&&n>=r.screenOffset.y&&n<=r.screenOffset.y+r.size)return r}return null},f.prototype.determineOperation=function(e,t){var n=null;if(t&&t instanceof o)if(t===this.panControl)n=this.handlePan;else if(t===this.zoomInControl||t===this.zoomOutControl)n=this.handleZoom;else if(t===this.headingLeftControl||t===this.headingRightControl)n=this.handleHeading;else if(t===this.tiltUpControl||t===this.tiltDownControl)n=this.handleTilt;else if(t===this.exaggerationUpControl||t===this.exaggerationDownControl)n=this.handleExaggeration;else if(t===this.fovNarrowControl||t===this.fovWideControl)n=this.handleFov;return n},f.prototype.isCurrentTouch=function(e){for(var t=0;t0?i:"1.0.0",this.crs="EPSG:4326"};return n.prototype.urlForTile=function(r,i){if(!r)throw new e(t.logMessage(t.LEVEL_SEVERE,"WcsUrlBuilder","urlForTile","missingTile"));if(!i)throw new e(t.logMessage(t.LEVEL_SEVERE,"WcsUrlBuilder","urlForTile","The coverage format is null or undefined."));var s=r.sector,o=n.fixGetCoverageString(this.serviceAddress);return o.search(/service=wcs/i)<0&&(o+="service=WCS"),o+="&request=GetCoverage",o=o+"&version="+this.wcsVersion,o=o+"&coverage="+this.coverageName,o=o+"&format="+i,o=o+"&width="+r.tileWidth,o=o+"&height="+r.tileHeight,o=o+"&crs="+this.crs,o+="&bbox=",o=o+s.minLongitude+","+s.minLatitude+",",o=o+s.maxLongitude+","+s.maxLatitude,o=o.replace(" ","%20"),o},n.fixGetCoverageString=function(n){if(!n)throw new e(t.logMessage(t.LEVEL_SEVERE,"WcsTileUrlBuilder","fixGetCoverageString","The specified service address is null or undefined."));var r=n.indexOf("?");return r<0?n+="?":r!==n.length-1&&(r=n.search(/&$/),r<0&&(n+="&")),n},n}),n("ogc/OwsLanguageString",["../error/ArgumentError","../util/Logger"],function(e,t){"use strict";var n=function(n){if(!n)throw new e(t.logMessage(t.LEVEL_SEVERE,"LanguageString","constructor","missingDomElement"));this.value=n.textContent;var r=n.getAttribute("lang");r&&(this.lang=r)};return n}),n("ogc/OwsConstraint",["../error/ArgumentError","../util/Logger"],function(e,t){"use strict";var n=function(n){if(!n)throw new e(t.logMessage(t.LEVEL_SEVERE,"OwsConstraint","constructor","missingDomElement"));this.name=n.getAttribute("name");var r=n.children;for(var i=0;i0&&t._dimensions.forEach(function(t){var n=t.name,r=!0;e.forEach(function(e){e.name===n&&(r=!1)}),r&&e.push(t)}),t=t.parent;return e.length>0?e:undefined}},extents:{get:function(){var e=[],t=this;while(t&&t instanceof n)t._extents&&t._extents.length>0&&t._extents.forEach(function(t){var n=t.name,r=!0;e.forEach(function(e){e.name===n&&(r=!1)}),r&&e.push(t)}),t=t.parent;return e.length>0?e:undefined}},attribution:{get:function(){return n.replace(this,"_attribution")}},authorityUrls:{get:function(){return n.accumulate(this,"_authorityUrls",[])}},minScaleDenominator:{get:function(){return n.replace(this,"_minScaleDenominator")}},maxScaleDenominator:{get:function(){return n.replace(this,"_maxScaleDenominator")}},scaleHint:{get:function(){return n.replace(this,"_scaleHint")}}}),n.accumulate=function(e,t,r){while(e&&e instanceof n){var i=e[t];if(i)for(var s=0;s0?r:null},n.replace=function(e,t){while(e&&e instanceof n){var r=e[t];if(r)return r;e=e.parent}},n.prototype.assembleLayer=function(e){var t,r,i,s;r=e.getAttribute("queryable"),r&&(this._queryable=r==="1"||r==="true"),r=e.getAttribute("opaque"),r&&(this._opaque=r==="1"||r==="true"),r=e.getAttribute("noSubsets"),r&&(this._noSubsets=r==="1"||r==="true"),r=e.getAttribute("cascaded"),r&&(this._cascaded=parseInt("10")),r=e.getAttribute("fixedWidth"),r&&(this._fixedWidth=parseInt("10")),r=e.getAttribute("fixedHeight"),r&&(this._fixedHeight=parseInt("10"));var o=e.children||e.childNodes;for(i=0;i=0?n.format="image/png":o.indexOf("image/jpeg")>=0?n.format="image/jpeg":o.indexOf("image/tiff")>=0?n.format="image/tiff":o.indexOf("image/gif")>=0&&(n.format="image/gif"),n.service=s.url;var a=e.crses;a||(a=e.srses);if(a)if(a.indexOf("EPSG:4326")>=0||a.indexOf("epsg:4326")>=0)n.coordinateSystem="EPSG:4326";else if(a.indexOf("CRS84")>=0||a.indexOf("CRS:84")>=0)n.coordinateSystem="CRS:84";var f=u.parseTimeDimensions(e);return f&&f.length>0&&(n.timeSequences=f),n},u.parseTimeDimensions=function(e){var t=e.extents||e.dimensions,n=null;if(t){n=[];for(var i=0;iMath.max(t*i,.5)},o.prototype.update=function(e){var t=e.globe.elevationTimestamp(),n=e.verticalExaggeration,r=e.globeStateKey;if(this.updateTimestamp!=t||this.updateVerticalExaggeration!=n||this.updateGlobeStateKey!=r)this.doUpdate(e),e.frameStatistics.incrementTileUpdateCount(1),this.updateTimestamp=t,this.updateVerticalExaggeration=n,this.updateGlobeStateKey=r},o.prototype.doUpdate=function(e){var t=e.globe,r=e.verticalExaggeration,o=t.minAndMaxElevationsForSector(this.sector),u=o?o[0]*r:0,a=o?o[1]*r:0;u==a&&(u=a+10),this.extent||(this.extent=new n),this.extent.setToSector(this.sector,t,u,a),this.samplePoints||(this.sampleElevations=new Float64Array(9),this.samplePoints=new Float64Array(3*this.sampleElevations.length)),s.fillArray(this.sampleElevations,.5*(u+a)),t.computePointsForGrid(this.sector,3,3,this.sampleElevations,i.ZERO,this.samplePoints),this.referencePoint||(this.referencePoint=new i(0,0,0)),t.computePointFromPosition(this.sector.centroidLatitude(),this.sector.centroidLongitude(),0,this.referencePoint)},o.prototype.bind=function(e){var t=e.gpuResourceCache.resourceForKey(this.gpuCacheKey);return t&&t.bind(e)?!0:this.fallbackTile?this.fallbackTile.bind(e):!1},o.prototype.applyInternalTransform=function(e,t){},o}),n("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(e,t,n,r,i,s,o,u,a,f,l){"use strict";var c=function(o,a,f){if(!o)throw new t(n.logMessage(n.LEVEL_SEVERE,"WmtsLayer","constructor","No layer configuration specified."));i.call(this,"WMTS Layer"),this.layerIdentifier=o.identifier,this.styleIdentifier=a,this.timeString=f;var l=o.format;l.indexOf("image/png")>=0?this.imageFormat="image/png":l.indexOf("image/jpeg")>=0?this.imageFormat="image/jpeg":l.indexOf("image/tiff")>=0?this.imageFormat="image/tiff":l.indexOf("image/gif")>=0?this.imageFormat="image/gif":this.imageFormat=l[0];if(!this.imageFormat)throw new t(n.logMessage(n.LEVEL_SEVERE,"WmtsLayer","constructor","Layer does not provide a supported image format."));if(o.resourceUrl&&o.resourceUrl.length>1){for(var h=0;h0?this.displayName=o.title[0].value:this.displayName=o.identifier,this.pickEnabled=!1,this.currentTiles=[],this.currentTilesInvalid=!0,this.tileCache=new s(500,400),this.currentRetrievals=[],this.absentResourceList=new e(3,5e4),this.pickEnabled=!1,this.detailControl=1.75};return c.prototype=Object.create(i.prototype),c.prototype.doRender=function(e){if(!e.terrain)return;if(this.currentTilesInvalid||!this.lasTtMVP||!e.navigatorState.modelviewProjection.equals(this.lasTtMVP)||e.globeStateKey!=this.lastGlobeStateKey)this.currentTilesInvalid=!1,this.assembleTiles(e);this.lasTtMVP=e.navigatorState.modelviewProjection,this.lastGlobeStateKey=e.globeStateKey,this.currentTiles.length>0&&(e.surfaceTileRenderer.renderTiles(e,this.currentTiles,this.opacity),e.frameStatistics.incrementImageTileCount(this.currentTiles.length),this.inCurrentFrame=!0)},c.prototype.isLayerInView=function(e){return e.terrain&&e.terrain.sector&&e.terrain.sector.intersects(this.sector)},c.prototype.isTileVisible=function(e,t){return e.globe.projectionLimits&&!t.sector.overlaps(e.globe.projectionLimits)?!1:t.extent.intersectsFrustum(e.navigatorState.frustumInModelCoordinates)},c.prototype.assembleTiles=function(e){this.currentTiles=[],(!this.topLevelTiles||this.topLevelTiles.length===0)&&this.createTopLevelTiles(e);for(var t=0,n=this.topLevelTiles.length;t=75||t.sector.maxLatitude<=-75)n*=1.2;return t.tileMatrix.levelNumber===this.tileMatrixSet.tileMatrix.length-1||!t.mustSubdivide(e,n)},c.prototype.retrieveTileImage=function(e,t){if(this.currentRetrievals.indexOf(t.imagePath)<0){if(this.absentResourceList.isResourceAbsent(t.imagePath))return;var r=this.resourceUrlForTile(t,this.imageFormat),i=new Image,s=t.imagePath,o=e.gpuResourceCache,u=e.currentGlContext.canvas,a=this;if(!r){this.currentTilesInvalid=!0;return}i.onload=function(){n.log(n.LEVEL_INFO,"Image retrieval succeeded: "+r);var f=a.createTexture(e,t,i);a.removeFromCurrentRetrievals(s);if(f){o.putResource(s,f,f.size),a.currentTilesInvalid=!0,a.absentResourceList.unmarkResourceAbsent(s);var l=document.createEvent("Event");l.initEvent(WorldWind.REDRAW_EVENT_TYPE,!0,!0),u.dispatchEvent(l)}},i.onerror=function(){a.removeFromCurrentRetrievals(s),a.absentResourceList.markResourceAbsent(s),n.log(n.LEVEL_WARNING,"Image retrieval failed: "+r)},this.currentRetrievals.push(s),i.crossOrigin="anonymous",i.src=r}},c.prototype.resourceUrlForTile=function(e,t){var n;return this.resourceUrl?(n=this.resourceUrl.replace("{Style}",this.styleIdentifier).replace("{TileMatrixSet}",this.tileMatrixSet.identifier).replace("{TileMatrix}",e.tileMatrix.identifier).replace("{TileCol}",e.column).replace("{TileRow}",e.row),this.timeString&&n.replace("{Time}",this.timeString)):(n=this.serviceUrl+"service=WMTS&request=GetTile&version=1.0.0",n+="&Layer="+this.layerIdentifier,this.styleIdentifier&&(n+="&Style="+this.styleIdentifier),n+="&Format="+t,this.timeString&&(n+="&Time="+this.timeString),n+="&TileMatrixSet="+this.tileMatrixSet.identifier,n+="&TileMatrix="+e.tileMatrix.identifier,n+="&TileRow="+e.row,n+="&TileCol="+e.column),n},c.prototype.removeFromCurrentRetrievals=function(e){var t=this.currentRetrievals.indexOf(e);t>-1&&this.currentRetrievals.splice(t,1)},c.prototype.createTopLevelTiles=function(e){var t=this.tileMatrixSet.tileMatrix[0];this.topLevelTiles=[];for(var n=0;n=0&&e.indexOf("4326")>=0},c.isEpsg3857Crs=function(e){return e.indexOf("EPSG")>=0&&(e.indexOf("3857")>=0||e.indexOf("900913")>=0)},c}),n("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(e,t,n,r,i,s,o,u,a,f,l,c,h,p,d,v,m,g){"use strict";var y=function(s,u){function d(e){p.handleContextLost(e)}function v(e){p.handleContextRestored(e)}function m(e){p.handleRedrawEvent(e)}if(!window.WebGLRenderingContext)throw new e(a.logMessage(a.LEVEL_SEVERE,"WorldWindow","constructor","The specified canvas does not support WebGL."));var l=document.getElementById(s);if(!l)throw new e(a.logMessage(a.LEVEL_SEVERE,"WorldWindow","constructor","The specified canvas name is not in the document."));var c=this.createContext(l);this.drawContext=new t(c),this.eventListeners={},this.redrawRequested=!0,this.redrawRequestId=null,this.canvas=l,this.depthBits=c.getParameter(c.DEPTH_BITS),this.viewport=new h(0,0,c.drawingBufferWidth,c.drawingBufferHeight),this.globe=new i(u||new n),this.layers=[],this.navigator=new f(this),this.verticalExaggeration=1,this.deepPicking=!1,this.subsurfaceMode=!1,this.surfaceOpacity=1,this.frameStatistics=new r,this.goToAnimator=new o(this),this._redrawCallbacks=[],this._orderedRenderingFilters=[function(e){p.declutter(e,1)},function(e){p.declutter(e,2)}],this.pixelScale=1;var p=this;this.canvas.addEventListener("webglcontextlost",d,!1),this.canvas.addEventListener("webglcontextrestored",v,!1),this.canvas.addEventListener(WorldWind.REDRAW_EVENT_TYPE,m,!1),window.addEventListener(WorldWind.REDRAW_EVENT_TYPE,m,!1),this.animationFrameLoop()};return Object.defineProperties(y.prototype,{orderedRenderingFilters:{get:function(){return this._orderedRenderingFilters}},redrawCallbacks:{get:function(){return this._redrawCallbacks}}}),y.prototype.canvasCoordinates=function(e,t){var n=this.canvas.getBoundingClientRect(),r=e-(n.left+this.canvas.clientLeft),i=t-(n.top+this.canvas.clientTop);return new g(r,i)},y.prototype.addEventListener=function(t,n){if(!t)throw new e(a.logMessage(a.LEVEL_SEVERE,"WorldWindow","addEventListener","missingType"));if(!n)throw new e(a.logMessage(a.LEVEL_SEVERE,"WorldWindow","addEventListener","missingListener"));var r=this,i=this.eventListeners[t];i||(i={listeners:[],callback:function(e){e.worldWindow=r;for(var t=0,n=i.listeners.length;t=0&&this.layers.splice(t,1)},y.prototype.insertLayer=function(e,t){t&&this.layers.splice(e,0,t)},y.prototype.drawSurfaceRenderables=function(){var e=this.drawContext,t;e.reverseSurfaceRenderables();while(t=e.popSurfaceRenderable())try{t.renderSurface(e)}catch(n){a.logMessage(a.LEVEL_WARNING,"WorldWindow","drawSurfaceRenderables","Error while rendering a surface renderable.\n"+n.message)}},y.prototype.drawOrderedRenderables=function(){var e=Date.now(),t=this.drawContext,n;t.sortOrderedRenderables();if(this._orderedRenderingFilters)for(var r=0;r